potreeFormat.js 3.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385
  1. !function(e, t) {
  2. "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = e || self).Potree = {})
  3. }(this, function(le) {
  4. "use strict";
  5. function i(t, e) {
  6. var n, i = Object.keys(t);
  7. return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t),
  8. e && (n = n.filter(function(e) {
  9. return Object.getOwnPropertyDescriptor(t, e).enumerable
  10. })),
  11. i.push.apply(i, n)),
  12. i
  13. }
  14. function X(e) {
  15. return (X = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
  16. return typeof e
  17. }
  18. : function(e) {
  19. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
  20. }
  21. )(e)
  22. }
  23. function l(e, t, n, i, r, a, o) {
  24. try {
  25. var s = e[a](o)
  26. , l = s.value
  27. } catch (e) {
  28. return void n(e)
  29. }
  30. s.done ? t(l) : Promise.resolve(l).then(i, r)
  31. }
  32. function r(s) {
  33. return function() {
  34. var e = this
  35. , o = arguments;
  36. return new Promise(function(t, n) {
  37. var i = s.apply(e, o);
  38. function r(e) {
  39. l(i, t, n, r, a, "next", e)
  40. }
  41. function a(e) {
  42. l(i, t, n, r, a, "throw", e)
  43. }
  44. r(void 0)
  45. }
  46. )
  47. }
  48. }
  49. function O(e, t) {
  50. if (!(e instanceof t))
  51. throw new TypeError("Cannot call a class as a function")
  52. }
  53. function o(e, t) {
  54. for (var n = 0; n < t.length; n++) {
  55. var i = t[n];
  56. i.enumerable = i.enumerable || !1,
  57. i.configurable = !0,
  58. "value"in i && (i.writable = !0),
  59. Object.defineProperty(e, i.key, i)
  60. }
  61. }
  62. function h(e, t, n) {
  63. return t && o(e.prototype, t),
  64. n && o(e, n),
  65. Object.defineProperty(e, "prototype", {
  66. writable: !1
  67. }),
  68. e
  69. }
  70. function H(e, t, n) {
  71. return t in e ? Object.defineProperty(e, t, {
  72. value: n,
  73. enumerable: !0,
  74. configurable: !0,
  75. writable: !0
  76. }) : e[t] = n,
  77. e
  78. }
  79. function y(e, t) {
  80. if ("function" != typeof t && null !== t)
  81. throw new TypeError("Super expression must either be null or a function");
  82. e.prototype = Object.create(t && t.prototype, {
  83. constructor: {
  84. value: e,
  85. writable: !0,
  86. configurable: !0
  87. }
  88. }),
  89. Object.defineProperty(e, "prototype", {
  90. writable: !1
  91. }),
  92. t && s(e, t)
  93. }
  94. function v(e) {
  95. return (v = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
  96. return e.__proto__ || Object.getPrototypeOf(e)
  97. }
  98. )(e)
  99. }
  100. function s(e, t) {
  101. return (s = Object.setPrototypeOf || function(e, t) {
  102. return e.__proto__ = t,
  103. e
  104. }
  105. )(e, t)
  106. }
  107. function u() {
  108. if ("undefined" == typeof Reflect || !Reflect.construct)
  109. return !1;
  110. if (Reflect.construct.sham)
  111. return !1;
  112. if ("function" == typeof Proxy)
  113. return !0;
  114. try {
  115. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
  116. !0
  117. } catch (e) {
  118. return !1
  119. }
  120. }
  121. function B(e, t, n) {
  122. return (B = u() ? Reflect.construct : function(e, t, n) {
  123. var i = [null];
  124. i.push.apply(i, t);
  125. i = new (Function.bind.apply(e, i));
  126. return n && s(i, n.prototype),
  127. i
  128. }
  129. ).apply(null, arguments)
  130. }
  131. function g(e) {
  132. if (void 0 === e)
  133. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  134. return e
  135. }
  136. function c(e, t) {
  137. if (t && ("object" == typeof t || "function" == typeof t))
  138. return t;
  139. if (void 0 !== t)
  140. throw new TypeError("Derived constructors may only return object or undefined");
  141. return g(e)
  142. }
  143. function w(n) {
  144. var i = u();
  145. return function() {
  146. var e, t = v(n);
  147. return c(this, i ? (e = v(this).constructor,
  148. Reflect.construct(t, arguments, e)) : t.apply(this, arguments))
  149. }
  150. }
  151. function d(e, t) {
  152. for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = v(e)); )
  153. ;
  154. return e
  155. }
  156. function b() {
  157. return (b = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, n) {
  158. var i = d(e, t);
  159. if (i) {
  160. t = Object.getOwnPropertyDescriptor(i, t);
  161. return t.get ? t.get.call(arguments.length < 3 ? e : n) : t.value
  162. }
  163. }
  164. ).apply(this, arguments)
  165. }
  166. function N(e, t) {
  167. return p(e) || function(e, t) {
  168. var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
  169. if (null != n) {
  170. var i, r, a = [], o = !0, s = !1;
  171. try {
  172. for (n = n.call(e); !(o = (i = n.next()).done) && (a.push(i.value),
  173. !t || a.length !== t); o = !0)
  174. ;
  175. } catch (e) {
  176. s = !0,
  177. r = e
  178. } finally {
  179. try {
  180. o || null == n.return || n.return()
  181. } finally {
  182. if (s)
  183. throw r
  184. }
  185. }
  186. return a
  187. }
  188. }(e, t) || f(e, t) || E()
  189. }
  190. function Q(e) {
  191. return function(e) {
  192. if (Array.isArray(e))
  193. return m(e)
  194. }(e) || t(e) || f(e) || function() {
  195. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  196. }()
  197. }
  198. function p(e) {
  199. if (Array.isArray(e))
  200. return e
  201. }
  202. function t(e) {
  203. if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"])
  204. return Array.from(e)
  205. }
  206. function f(e, t) {
  207. if (e) {
  208. if ("string" == typeof e)
  209. return m(e, t);
  210. var n = Object.prototype.toString.call(e).slice(8, -1);
  211. return "Map" === (n = "Object" === n && e.constructor ? e.constructor.name : n) || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? m(e, t) : void 0
  212. }
  213. }
  214. function m(e, t) {
  215. (null == t || t > e.length) && (t = e.length);
  216. for (var n = 0, i = new Array(t); n < t; n++)
  217. i[n] = e[n];
  218. return i
  219. }
  220. function E() {
  221. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  222. }
  223. function ue(e, t) {
  224. var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
  225. if (!n) {
  226. if (Array.isArray(e) || (n = f(e)) || t && e && "number" == typeof e.length) {
  227. n && (e = n);
  228. var i = 0
  229. , t = function() {};
  230. return {
  231. s: t,
  232. n: function() {
  233. return i >= e.length ? {
  234. done: !0
  235. } : {
  236. done: !1,
  237. value: e[i++]
  238. }
  239. },
  240. e: function(e) {
  241. throw e
  242. },
  243. f: t
  244. }
  245. }
  246. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  247. }
  248. var r, a = !0, o = !1;
  249. return {
  250. s: function() {
  251. n = n.call(e)
  252. },
  253. n: function() {
  254. var e = n.next();
  255. return a = e.done,
  256. e
  257. },
  258. e: function(e) {
  259. o = !0,
  260. r = e
  261. },
  262. f: function() {
  263. try {
  264. a || null == n.return || n.return()
  265. } finally {
  266. if (o)
  267. throw r
  268. }
  269. }
  270. }
  271. }
  272. function _(e, t) {
  273. e = (e = window.navigator.userAgent.match(e)) ? e[1].split(t) : [];
  274. return {
  275. major: parseInt(e[0]) || 0,
  276. minor: parseInt(e[1]) || 0,
  277. patch: parseInt(e[2]) || 0
  278. }
  279. }
  280. var A = {
  281. isFullscreen: function() {
  282. return document.fullscreenElement || document.mozFullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
  283. },
  284. supportsFullscreen: function() {
  285. return document.fullscreenEnabled || document.mozFullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled
  286. },
  287. isPointerLocked: function() {
  288. return document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement
  289. },
  290. requestFullscreen: function(e, t) {
  291. e.requestFullscreen ? e.requestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : e.msRequestFullscreen && e.msRequestFullscreen(),
  292. t && $(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", A.requestPointerLock)
  293. },
  294. requestPointerLock: function() {
  295. var e;
  296. if (document.fullscreenElement)
  297. e = document.fullscreenElement();
  298. else if (document.mozFullscreenElement)
  299. e = document.mozFullscreenElement();
  300. else if (document.mozFullScreenElement)
  301. e = document.mozFullScreenElement();
  302. else {
  303. if (!document.webkitFullscreenElement)
  304. return;
  305. e = document.webkitFullscreenElement()
  306. }
  307. e.requestPointerLock = e.requestPointerLock || e.mozRequestPointerLock || e.webkitRequestPointerLock,
  308. e.requestPointerLock(),
  309. $(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", this)
  310. },
  311. exitPointerLock: function() {
  312. document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock,
  313. document.exitPointerLock()
  314. },
  315. exitFullscreen: function() {
  316. document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen()
  317. },
  318. details: function() {
  319. var e = navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");
  320. return e ? {
  321. name: e[1],
  322. version: parseInt(e[2]),
  323. platform: navigator.platform
  324. } : {}
  325. },
  326. is: function(e) {
  327. return this.details() && this.details().name === e
  328. },
  329. inIframe: function() {
  330. return window.parent !== window
  331. },
  332. aspectRatio: function(e) {
  333. e = (e = e || $("#player")).width() / e.height();
  334. return isFinite(e) ? e : 0
  335. },
  336. userAgent: function() {
  337. return window.navigator.userAgent
  338. },
  339. isMobile: function() {
  340. var e = navigator.userAgent || navigator.vendor || window.opera;
  341. return /(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0, 4))
  342. },
  343. isLandscape: function() {
  344. return this.isMobile && 1 < this.aspectRatio()
  345. },
  346. isSmallScreen: function() {
  347. return screen.width / window.devicePixelRatio < 240
  348. },
  349. detectIE: function() {
  350. return -1 !== window.navigator.userAgent.indexOf("MSIE ") || !!navigator.userAgent.match(/Trident.*rv\:11\./)
  351. },
  352. detectSafari: function() {
  353. return -1 !== window.navigator.userAgent.indexOf("Safari") && !this.detectOpera() && !this.detectChrome()
  354. },
  355. detectFirefox: function() {
  356. return -1 !== window.navigator.userAgent.indexOf("Firefox")
  357. },
  358. detectChrome: function() {
  359. return -1 !== window.navigator.userAgent.indexOf("Chrome") && !this.detectOpera()
  360. },
  361. detectOpera: function() {
  362. return -1 !== window.navigator.userAgent.indexOf("OPR")
  363. },
  364. detectIOS: function() {
  365. return this.detectIPhone() || this.detectIPad() || this.detectIPod()
  366. },
  367. detectIPad: function() {
  368. var e = window.navigator.userAgent;
  369. return /iPad/.test(e)
  370. },
  371. detectIPod: function() {
  372. var e = window.navigator.userAgent;
  373. return /iPod/.test(e)
  374. },
  375. detectIPhone: function() {
  376. var e = window.navigator.userAgent;
  377. return /iPhone/.test(e)
  378. },
  379. detectAndroid: function() {
  380. return -1 !== window.navigator.userAgent.indexOf("Android")
  381. },
  382. detectAndroidMobile: function() {
  383. var e = window.navigator.userAgent;
  384. return this.detectAndroid() && -1 !== e.indexOf("Mobile")
  385. },
  386. detectSamsungNative: function() {
  387. var e = window.navigator.userAgent;
  388. return -1 !== e.indexOf("SM-G900H") || -1 !== e.indexOf("GT-I9500") || -1 !== e.indexOf("SM-N900")
  389. },
  390. detectSamsungS6: function() {
  391. return -1 !== window.navigator.userAgent.indexOf("SM-G92")
  392. },
  393. detectHUAWEI5X: function() {
  394. return -1 !== window.navigator.userAgent.indexOf("KIW-TL00H")
  395. },
  396. detectWebVR: function() {
  397. return !(!window.navigator.getVRDisplays || !window.VRDisplay)
  398. },
  399. getVRDisplay: function() {
  400. var t = $.Deferred();
  401. return this.detectWebVR() ? (navigator.getVRDisplays().then(function(e) {
  402. 1 <= e.length && t.resolve(e[0]),
  403. t.reject(null)
  404. }),
  405. t) : t.reject(null)
  406. },
  407. iosVersion: function() {
  408. if (!this.detectIOS())
  409. throw new DeviceMismatchException("Did not detect an iDevice");
  410. return _(/((?:\d+\_?){1,3}) like Mac OS/, "_")
  411. },
  412. androidVersion: function() {
  413. if (!this.detectAndroid())
  414. throw new DeviceMismatchException("Did not detect an Android based device");
  415. return _(/Android ((?:\d+\.?){1,3})/, ".")
  416. },
  417. valueFromCookie: function(e, t) {
  418. e = new RegExp(e + "=([0-9a-f]+)(; ?|$)").exec(document.cookie);
  419. if (!e)
  420. return t;
  421. e = e[1];
  422. return "boolean" == typeof t ? "true" === e || "1" === e : "number" == typeof t ? parseFloat(e) : e
  423. },
  424. valueFromHash: function(e, t) {
  425. e = new RegExp("[#&?]" + e + "=([^#&?]*)").exec(window.location.href);
  426. if (!e)
  427. return t;
  428. e = e[1];
  429. return "boolean" == typeof t ? "true" === e || "1" === e : "number" == typeof t ? parseFloat(e) : window.decodeURIComponent(e)
  430. },
  431. getProjectNum: function() {
  432. if (window.__ProjectNum && "__ProjectNum__" != window.__ProjectNum)
  433. return window.__ProjectNum;
  434. var e = window.location.href.substring(window.location.href.indexOf("=") + 1);
  435. return e = -1 != (e = -1 != e.indexOf("&") ? e.substring(0, e.indexOf("&")) : e).indexOf("#") ? e.substring(0, e.indexOf("#")) : e
  436. },
  437. urlHasValue: function(e, t) {
  438. if ("m" === e && window.__ProjectNum && "__ProjectNum__" != window.__ProjectNum)
  439. return window.__ProjectNum;
  440. var n = window.location.search.substr(1).split("&");
  441. if (t) {
  442. for (var i = 0; i < n.length; i++) {
  443. var r = n[i].split("=");
  444. if (2 === r.length && r[0] === e)
  445. return r[1]
  446. }
  447. return ""
  448. }
  449. for (var a = 0; a < n.length; a++)
  450. if (n[a].split("=")[0] == e)
  451. return !0;
  452. return !1
  453. },
  454. urlQueryValue: function(e) {
  455. return this.urlHasValue(e, !0) || ""
  456. },
  457. urlHashValue: function(e) {
  458. for (var t = window.location.hash.substr(1).replace("/?", "").split("&"), n = 0; n < t.length; n++) {
  459. var i = t[n].split("=");
  460. if (2 === i.length && i[0] === e)
  461. return i[1]
  462. }
  463. return ""
  464. },
  465. urlIsHasHash: function(e) {
  466. return window.location.hash.substr(1).replace("/?", "").split("&").includes(e)
  467. },
  468. islongPhone: function() {
  469. var e = screen.height / screen.width;
  470. return this.isMobile() && (1.99 < e || e < .502512)
  471. },
  472. detectWeixin: function() {
  473. return "micromessenger" == window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)
  474. },
  475. detectWeixinMiniProgram: function() {
  476. return window.navigator.userAgent.match("miniProgram")
  477. },
  478. detectEdge: function() {
  479. return -1 < window.navigator.userAgent.indexOf("Edge")
  480. },
  481. detectApp: function() {
  482. return this.urlHasValue("app")
  483. },
  484. isTabHidden: function() {
  485. var e = ["webkit", "moz", "ms", "o"];
  486. if ("hidden"in document)
  487. return document.hidden;
  488. for (var t = 0; t < e.length; t++)
  489. if (e[t] + "Hidden"in document)
  490. return document[e[t] + "Hidden"];
  491. return !1
  492. }
  493. }
  494. , T = {
  495. displayMode: {
  496. showPointCloud: {
  497. atPano: {
  498. showPoint: !0,
  499. showSkybox: !function(e) {
  500. return this._invoke("return", e)
  501. }
  502. ,
  503. pointUsePanoTex: !1
  504. },
  505. transition: {
  506. showPoint: !0,
  507. showSkybox: !1,
  508. pointUsePanoTex: !1
  509. },
  510. canLeavePano: !0
  511. },
  512. showPanos: {
  513. atPano: {
  514. showPoint: !1,
  515. showSkybox: !0,
  516. pointUsePanoTex: !1
  517. },
  518. transition: {
  519. showSkybox: !0
  520. },
  521. canLeavePano: !1
  522. },
  523. showBoth: {
  524. atPano: {
  525. showPoint: !0,
  526. showSkybox: !0,
  527. pointUsePanoTex: !1
  528. },
  529. transition: {
  530. showPoint: !0,
  531. showSkybox: !0,
  532. pointUsePanoTex: !0
  533. },
  534. canLeavePano: !0
  535. },
  536. pointUsePanoTex: {
  537. atPano: {
  538. showPoint: !0,
  539. showSkybox: !1,
  540. pointUsePanoTex: !0
  541. },
  542. transition: {
  543. showPoint: !0,
  544. showSkybox: !0,
  545. pointUsePanoTex: !0
  546. },
  547. canLeavePano: !1
  548. }
  549. },
  550. urls: {
  551. prefix: "https://laser-oss.4dkankan.com",
  552. prefix2: "https://testlaser.4dkankan.com",
  553. prefix3: "https://4dkk.4dage.com",
  554. prefix4: "https://uat-laser.4dkankan.com/"
  555. },
  556. transitionsTime: {
  557. flyMinTime: 500,
  558. flytimeDistanceMultiplier: 150,
  559. panoToPanoMax: 2e3,
  560. flyIn: 1e3,
  561. flyOut: 1e3
  562. },
  563. moveSpeedAdujust: .5,
  564. view: {
  565. fov: 70,
  566. near: .1,
  567. far: 1e4
  568. },
  569. map: {
  570. mapHeight: -1e3,
  571. cameraHeight: 1e3
  572. },
  573. pointDensity: {
  574. magnifier: {
  575. maxLevelPercent: 1,
  576. pointBudget: 8e6
  577. },
  578. panorama: {
  579. maxLevelPercent: .6,
  580. pointBudget: A.isMobile() ? 1e5 : 4e5
  581. },
  582. fourViewports: {
  583. maxLevelPercent: .4,
  584. pointBudget: 1e6
  585. },
  586. fourViewportsMain: {
  587. maxLevelPercent: .8,
  588. pointBudget: 1e6
  589. },
  590. panoEdit: {
  591. maxLevelPercent: 1,
  592. pointBudget: 1e6
  593. },
  594. low: {
  595. maxLevelPercent: .4,
  596. percentByUser: !0,
  597. pointBudget: 1e6
  598. },
  599. middle: {
  600. maxLevelPercent: .7,
  601. percentByUser: !0,
  602. pointBudget: A.isMobile() ? 4e6 : 2e6
  603. },
  604. high: {
  605. maxLevelPercent: 1,
  606. percentByUser: !0,
  607. pointBudget: A.isMobile() ? 8e6 : 4e6
  608. }
  609. },
  610. clip: {
  611. color: "#FFC266"
  612. },
  613. panoFieldRadius: 10,
  614. measure: {
  615. color: "#00C8AF",
  616. default: {
  617. color: "#64C8BB",
  618. opacity: .7
  619. },
  620. highlight: {
  621. color: "#00C8AF",
  622. opacity: 1
  623. },
  624. guide: {
  625. color: "#FFFFFF",
  626. opacity: 1
  627. },
  628. backColor: "#333333",
  629. lineWidth: 4,
  630. textColor: "#FFFFFF"
  631. },
  632. material: {
  633. pointSize: .1,
  634. realPointSize: .1,
  635. minSize: .1,
  636. maxSize: 1e4,
  637. pointSizeType: "ATTENUATED",
  638. absolutePanoramaSize: 1.3,
  639. pointColor: "#ffffff"
  640. },
  641. renderLayers: {
  642. bg: 20,
  643. bg2: 21,
  644. skybox: 1,
  645. pointcloud: 11,
  646. sceneObjects: 0,
  647. model: 2,
  648. measure: 4,
  649. magnifier: 5,
  650. magnifierContent: 16,
  651. volume: 6,
  652. transformationTool: 7,
  653. map: 8,
  654. mapObjects: 9,
  655. bothMapAndScene: 3,
  656. siteModeOnlyMapVisi: 12,
  657. siteModelMapUnvisi: 13,
  658. siteModeSideVisi: 14
  659. },
  660. siteModel: {
  661. names: {
  662. building: "建筑",
  663. floor: "楼层",
  664. room: "房间"
  665. },
  666. floorHeightDefault: 5
  667. },
  668. panosEdit: {},
  669. tiling: {
  670. panoPreRenderRepeatDelay: 2500,
  671. panoPreRenderDelay: 500,
  672. preRenderTourPanos: A.valueFromHash("tileprerender", 0),
  673. tilingFlagNames: ["usetiles", "tiles"],
  674. maxNavPanoQuality: A.valueFromHash("maxtileq", null),
  675. maxZoomPanoQuality: A.valueFromHash("maxztileq", null),
  676. overlayStyle: A.valueFromHash("tileoverlay", 0),
  677. uploadIntervalDelay: A.valueFromHash("tileupdelay", 10),
  678. initialIntervalDelay: A.valueFromHash("itiledelay", 0),
  679. maxNonBaseUploadsPerFrame: A.valueFromHash("maxnbtpf", 2),
  680. maxBaseUploadsPerFrame: A.valueFromHash("maxbtpf", 6),
  681. customCompression: A.valueFromHash("tilecustcomp", 0),
  682. mobileHighQualityOverride: !1,
  683. allowUltraHighResolution: !0
  684. },
  685. navigation: {
  686. panoScores: !1,
  687. mouseDirection: !0,
  688. filterStrictness: .75,
  689. angleFactor: -30,
  690. directionFactor: 10,
  691. distanceFactor: -1,
  692. optionalityFactor: 3
  693. },
  694. axis: {
  695. x: {
  696. color: "#d0021b"
  697. },
  698. y: {
  699. color: "#86c542"
  700. },
  701. z: {
  702. color: "#3399c8"
  703. }
  704. },
  705. highQualityMaxZoom: 2,
  706. ultraHighQualityMaxZoom: 3,
  707. clickMaxDragDis: 5,
  708. clickMaxPressTime: 500,
  709. doubleClickTime: 200,
  710. background: "#232323",
  711. mapBG: "#F5F5F5",
  712. colors: {
  713. red: [213, 0, 0],
  714. pink: [197, 17, 98],
  715. purple: [170, 0, 255],
  716. "deep purple": [98, 0, 234],
  717. blue: [41, 98, 255],
  718. "light blue": [0, 145, 234],
  719. cyan: [0, 184, 212],
  720. teal: [0, 191, 165],
  721. green: [0, 200, 83],
  722. "light green": [100, 221, 23],
  723. lime: [174, 234, 0],
  724. yellow: [255, 214, 0],
  725. amber: [255, 171, 0],
  726. orange: [255, 109, 0],
  727. "deep orange": [255, 61, 0]
  728. }
  729. };
  730. T.OrthoCameraLimit = {
  731. standard: {
  732. zoom: {
  733. min: .001,
  734. max: 500
  735. },
  736. posBound: {
  737. min: {
  738. x: -1e5,
  739. y: -1e5,
  740. z: T.map.cameraHeight
  741. },
  742. max: {
  743. x: 1e5,
  744. y: 1e5,
  745. z: 1 / 0
  746. }
  747. }
  748. },
  749. expand: {
  750. zoom: {
  751. min: 4e-4,
  752. max: 100
  753. },
  754. posBound: {
  755. min: {
  756. x: -5e6,
  757. y: -1e6,
  758. z: T.map.cameraHeight
  759. },
  760. max: {
  761. x: 5e6,
  762. y: 1e6,
  763. z: 1 / 0
  764. }
  765. }
  766. }
  767. };
  768. var S = {
  769. editType: "",
  770. number: "",
  771. originDatasetId: "",
  772. isOfficial: !(window.testLevelSteps = function(e) {
  773. var t;
  774. e || (e = [(t = Potree.config.pointDensity).low.maxLevelPercent, t.middle.maxLevelPercent, t.high.maxLevelPercent]);
  775. for (var n = 1; ++n <= 12; ) {
  776. var i = e.map(function(e) {
  777. return e * n
  778. })
  779. , r = e.map(function(e) {
  780. return Math.round(e * n)
  781. });
  782. console.log("当nodeMaxLevel为".concat(n, "时,每一级的level分别为").concat(r, ", (小数:").concat(i, ")"))
  783. }
  784. console.log("请检查每一层的三个level是否有重复")
  785. }
  786. ),
  787. webSite: "testdata",
  788. isLocal: !1,
  789. libsUrl: "../libs/",
  790. displayMode: "",
  791. isTest: A.urlHasValue("test"),
  792. prefix: window.location.href.split("//")[1].split("/")[0],
  793. pointDensity: "",
  794. UserPointDensity: "",
  795. UserDensityPercent: null,
  796. ifShowMarker: !0,
  797. floorplanType: {},
  798. floorplanEnable: !1,
  799. floorplanEnables: {},
  800. floorplanRequests: {},
  801. mapEnable: !0,
  802. cameraFar: T.view.far,
  803. showPanoMesh: !1,
  804. dblToFocusPoint: !1,
  805. unableNavigate: !1,
  806. sizeFitToLevel: !1,
  807. zoom: {
  808. enabled: !0,
  809. min: 1,
  810. max: T.highQualityMaxZoom,
  811. activationThreshold: 1.1
  812. },
  813. navConstantly: !0,
  814. navTileClass: A.isMobile() ? "1k" : "2k",
  815. tileClass: "4k",
  816. drawEntityData: !1,
  817. zoomFromPointert: {
  818. whenPanos: !0,
  819. whenPointCloud: !0,
  820. map: !0
  821. },
  822. rotAroundPoint: !0,
  823. tourTestCameraMove: !1,
  824. cameraAniSmoothRatio: 20,
  825. urls: $.extend({}, T.urls),
  826. useDepthTex: !0,
  827. datasetsPanos: {},
  828. boundAddObjs: !1,
  829. intersectOnObjs: !1,
  830. intersectWhenHover: !0
  831. };
  832. S.isLocalhost = S.prefix.includes("localhost");
  833. var C = {
  834. LEFT: 0,
  835. MIDDLE: 1,
  836. RIGHT: 2,
  837. ROTATE: 0,
  838. DOLLY: 1,
  839. PAN: 2
  840. }
  841. , V = 0
  842. , j = 1
  843. , W = 2
  844. , P = 1
  845. , D = 3
  846. , q = 0
  847. , J = 1
  848. , Y = 2
  849. , Z = 0
  850. , K = 1
  851. , ee = 2
  852. , te = 3
  853. , ne = 4
  854. , ie = 5
  855. , re = 100
  856. , ae = 101
  857. , oe = 102
  858. , se = 103
  859. , ce = 104
  860. , de = 200
  861. , he = 201
  862. , pe = 202
  863. , fe = 203
  864. , me = 204
  865. , ve = 205
  866. , ge = 206
  867. , ye = 207
  868. , we = 208
  869. , be = 209
  870. , xe = 210
  871. , Ee = 0
  872. , _e = 1
  873. , Me = 2
  874. , Ae = 3
  875. , Te = 4
  876. , Se = 5
  877. , Ce = 6
  878. , Pe = 7
  879. , k = 0
  880. , De = 0
  881. , L = 301
  882. , R = 302
  883. , F = 303
  884. , I = 304
  885. , z = 306
  886. , U = 307
  887. , ke = 1e3
  888. , Be = 1001
  889. , Le = 1002
  890. , Re = 1003
  891. , Fe = 1004
  892. , Ie = 1005
  893. , Oe = 1006
  894. , ze = 1007
  895. , Ne = 1008
  896. , G = 1008
  897. , Ue = 1009
  898. , Ge = 1010
  899. , He = 1011
  900. , Ve = 1012
  901. , je = 1013
  902. , We = 1014
  903. , Xe = 1015
  904. , qe = 1016
  905. , Je = 1017
  906. , Ye = 1018
  907. , Ze = 1019
  908. , Qe = 1020
  909. , Ke = 1021
  910. , $e = 1022
  911. , et = 1023
  912. , tt = 1024
  913. , nt = 1025
  914. , it = et
  915. , rt = 1026
  916. , at = 1027
  917. , ot = 1028
  918. , st = 1029
  919. , lt = 1030
  920. , ut = 1031
  921. , ct = 1032
  922. , dt = 1033
  923. , ht = 33776
  924. , pt = 33777
  925. , ft = 33778
  926. , mt = 33779
  927. , vt = 35840
  928. , gt = 35841
  929. , yt = 35842
  930. , wt = 35843
  931. , bt = 36196
  932. , xt = 37492
  933. , Et = 37496
  934. , _t = 37808
  935. , Mt = 37809
  936. , At = 37810
  937. , Tt = 37811
  938. , St = 37812
  939. , Ct = 37813
  940. , Pt = 37814
  941. , Dt = 37815
  942. , kt = 37816
  943. , Bt = 37817
  944. , Lt = 37818
  945. , Rt = 37819
  946. , Ft = 37820
  947. , It = 37821
  948. , Ot = 36492
  949. , zt = 37840
  950. , Nt = 37841
  951. , Ut = 37842
  952. , Gt = 37843
  953. , Ht = 37844
  954. , Vt = 37845
  955. , jt = 37846
  956. , Wt = 37847
  957. , Xt = 37848
  958. , qt = 37849
  959. , Jt = 37850
  960. , Yt = 37851
  961. , Zt = 37852
  962. , Qt = 37853
  963. , Kt = 2300
  964. , $t = 2301
  965. , en = 2400
  966. , tn = 2401
  967. , nn = 2402
  968. , rn = 3e3
  969. , an = 3001
  970. , on = 3201
  971. , sn = 0
  972. , ln = 1
  973. , un = 35044
  974. , cn = 35048
  975. , dn = "300 es";
  976. function hn() {}
  977. Object.assign(hn.prototype, {
  978. addEventListener: function(e, t) {
  979. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0;
  980. void 0 === this._listeners && (this._listeners = {});
  981. var i = this._listeners;
  982. void 0 === i[e] && (i[e] = []),
  983. i[e].some(function(e) {
  984. return e.listener == t
  985. }) || (i[e].push({
  986. listener: t,
  987. importance: n
  988. }),
  989. i[e] = i[e].sort(function(e, t) {
  990. return t.importance - e.importance
  991. }))
  992. },
  993. hasEventListener: function(e, t) {
  994. if (void 0 === this._listeners)
  995. return !1;
  996. var n = this._listeners;
  997. return void 0 !== n[e] && n[e].some(function(e) {
  998. return e.listener == t
  999. })
  1000. },
  1001. removeEventListener: function(e, t) {
  1002. var n;
  1003. void 0 !== this._listeners && (void 0 === (n = this._listeners[e]) || (e = n.find(function(e) {
  1004. return e.listener == t
  1005. })) && n.splice(n.indexOf(e), 1))
  1006. },
  1007. removeEventListeners: function(e) {
  1008. this._listeners && void 0 !== this._listeners[e] && delete this._listeners[e]
  1009. },
  1010. removeAllListeners: function() {
  1011. this._listeners = {}
  1012. },
  1013. dispatchEvent: function(e) {
  1014. if ("string" == typeof e && (e = {
  1015. type: e
  1016. }),
  1017. void 0 !== this._listeners) {
  1018. var t = this._listeners[e.type];
  1019. if (void 0 !== t) {
  1020. e.target = this;
  1021. var n, i = ue(t.slice(0));
  1022. try {
  1023. for (i.s(); !(n = i.n()).done; ) {
  1024. var r = n.value.listener.call(this, e);
  1025. if (r && r.stopContinue)
  1026. break
  1027. }
  1028. } catch (e) {
  1029. i.e(e)
  1030. } finally {
  1031. i.f()
  1032. }
  1033. }
  1034. }
  1035. }
  1036. });
  1037. for (var pn = [], fn = 0; fn < 256; fn++)
  1038. pn[fn] = (fn < 16 ? "0" : "") + fn.toString(16);
  1039. var mn, vn = 1234567, gn = {
  1040. DEG2RAD: Math.PI / 180,
  1041. RAD2DEG: 180 / Math.PI,
  1042. generateUUID: function() {
  1043. var e = 4294967295 * Math.random() | 0
  1044. , t = 4294967295 * Math.random() | 0
  1045. , n = 4294967295 * Math.random() | 0
  1046. , i = 4294967295 * Math.random() | 0;
  1047. return (pn[255 & e] + pn[e >> 8 & 255] + pn[e >> 16 & 255] + pn[e >> 24 & 255] + "-" + pn[255 & t] + pn[t >> 8 & 255] + "-" + pn[t >> 16 & 15 | 64] + pn[t >> 24 & 255] + "-" + pn[63 & n | 128] + pn[n >> 8 & 255] + "-" + pn[n >> 16 & 255] + pn[n >> 24 & 255] + pn[255 & i] + pn[i >> 8 & 255] + pn[i >> 16 & 255] + pn[i >> 24 & 255]).toUpperCase()
  1048. },
  1049. clamp: function(e, t, n) {
  1050. return Math.max(t, Math.min(n, e))
  1051. },
  1052. euclideanModulo: function(e, t) {
  1053. return (e % t + t) % t
  1054. },
  1055. mapLinear: function(e, t, n, i, r) {
  1056. return i + (e - t) * (r - i) / (n - t)
  1057. },
  1058. lerp: function(e, t, n) {
  1059. return (1 - n) * e + n * t
  1060. },
  1061. smoothstep: function(e, t, n) {
  1062. return e <= t ? 0 : n <= e ? 1 : (e = (e - t) / (n - t)) * e * (3 - 2 * e)
  1063. },
  1064. smootherstep: function(e, t, n) {
  1065. return e <= t ? 0 : n <= e ? 1 : (e = (e - t) / (n - t)) * e * e * (e * (6 * e - 15) + 10)
  1066. },
  1067. randInt: function(e, t) {
  1068. return e + Math.floor(Math.random() * (t - e + 1))
  1069. },
  1070. randFloat: function(e, t) {
  1071. return e + Math.random() * (t - e)
  1072. },
  1073. randFloatSpread: function(e) {
  1074. return e * (.5 - Math.random())
  1075. },
  1076. seededRandom: function(e) {
  1077. return ((vn = 16807 * (vn = void 0 !== e ? e % 2147483647 : vn) % 2147483647) - 1) / 2147483646
  1078. },
  1079. degToRad: function(e) {
  1080. return e * gn.DEG2RAD
  1081. },
  1082. radToDeg: function(e) {
  1083. return e * gn.RAD2DEG
  1084. },
  1085. isPowerOfTwo: function(e) {
  1086. return 0 == (e & e - 1) && 0 !== e
  1087. },
  1088. ceilPowerOfTwo: function(e) {
  1089. return Math.pow(2, Math.ceil(Math.log(e) / Math.LN2))
  1090. },
  1091. floorPowerOfTwo: function(e) {
  1092. return Math.pow(2, Math.floor(Math.log(e) / Math.LN2))
  1093. },
  1094. setQuaternionFromProperEuler: function(e, t, n, i, r) {
  1095. var a = Math.cos
  1096. , o = Math.sin
  1097. , s = a(n / 2)
  1098. , l = o(n / 2)
  1099. , u = a((t + i) / 2)
  1100. , c = o((t + i) / 2)
  1101. , d = a((t - i) / 2)
  1102. , h = o((t - i) / 2)
  1103. , p = a((i - t) / 2)
  1104. , f = o((i - t) / 2);
  1105. switch (r) {
  1106. case "XYX":
  1107. e.set(s * c, l * d, l * h, s * u);
  1108. break;
  1109. case "YZY":
  1110. e.set(l * h, s * c, l * d, s * u);
  1111. break;
  1112. case "ZXZ":
  1113. e.set(l * d, l * h, s * c, s * u);
  1114. break;
  1115. case "XZX":
  1116. e.set(s * c, l * f, l * p, s * u);
  1117. break;
  1118. case "YXY":
  1119. e.set(l * p, s * c, l * f, s * u);
  1120. break;
  1121. case "ZYZ":
  1122. e.set(l * f, l * p, s * c, s * u);
  1123. break;
  1124. default:
  1125. console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r)
  1126. }
  1127. }
  1128. }, yn = function() {
  1129. function n() {
  1130. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
  1131. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  1132. O(this, n),
  1133. Object.defineProperty(this, "isVector2", {
  1134. value: !0
  1135. }),
  1136. this.x = e,
  1137. this.y = t
  1138. }
  1139. return h(n, [{
  1140. key: "width",
  1141. get: function() {
  1142. return this.x
  1143. },
  1144. set: function(e) {
  1145. this.x = e
  1146. }
  1147. }, {
  1148. key: "height",
  1149. get: function() {
  1150. return this.y
  1151. },
  1152. set: function(e) {
  1153. this.y = e
  1154. }
  1155. }, {
  1156. key: "set",
  1157. value: function(e, t) {
  1158. return this.x = e,
  1159. this.y = t,
  1160. this
  1161. }
  1162. }, {
  1163. key: "setScalar",
  1164. value: function(e) {
  1165. return this.x = e,
  1166. this.y = e,
  1167. this
  1168. }
  1169. }, {
  1170. key: "setX",
  1171. value: function(e) {
  1172. return this.x = e,
  1173. this
  1174. }
  1175. }, {
  1176. key: "setY",
  1177. value: function(e) {
  1178. return this.y = e,
  1179. this
  1180. }
  1181. }, {
  1182. key: "setComponent",
  1183. value: function(e, t) {
  1184. switch (e) {
  1185. case 0:
  1186. this.x = t;
  1187. break;
  1188. case 1:
  1189. this.y = t;
  1190. break;
  1191. default:
  1192. throw new Error("index is out of range: " + e)
  1193. }
  1194. return this
  1195. }
  1196. }, {
  1197. key: "getComponent",
  1198. value: function(e) {
  1199. switch (e) {
  1200. case 0:
  1201. return this.x;
  1202. case 1:
  1203. return this.y;
  1204. default:
  1205. throw new Error("index is out of range: " + e)
  1206. }
  1207. }
  1208. }, {
  1209. key: "clone",
  1210. value: function() {
  1211. return new this.constructor(this.x,this.y)
  1212. }
  1213. }, {
  1214. key: "copy",
  1215. value: function(e) {
  1216. return this.x = e.x,
  1217. this.y = e.y,
  1218. this
  1219. }
  1220. }, {
  1221. key: "add",
  1222. value: function(e, t) {
  1223. return void 0 !== t ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
  1224. this.addVectors(e, t)) : (this.x += e.x,
  1225. this.y += e.y,
  1226. this)
  1227. }
  1228. }, {
  1229. key: "addScalar",
  1230. value: function(e) {
  1231. return this.x += e,
  1232. this.y += e,
  1233. this
  1234. }
  1235. }, {
  1236. key: "addVectors",
  1237. value: function(e, t) {
  1238. return this.x = e.x + t.x,
  1239. this.y = e.y + t.y,
  1240. this
  1241. }
  1242. }, {
  1243. key: "addScaledVector",
  1244. value: function(e, t) {
  1245. return this.x += e.x * t,
  1246. this.y += e.y * t,
  1247. this
  1248. }
  1249. }, {
  1250. key: "sub",
  1251. value: function(e, t) {
  1252. return void 0 !== t ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
  1253. this.subVectors(e, t)) : (this.x -= e.x,
  1254. this.y -= e.y,
  1255. this)
  1256. }
  1257. }, {
  1258. key: "subScalar",
  1259. value: function(e) {
  1260. return this.x -= e,
  1261. this.y -= e,
  1262. this
  1263. }
  1264. }, {
  1265. key: "subVectors",
  1266. value: function(e, t) {
  1267. return this.x = e.x - t.x,
  1268. this.y = e.y - t.y,
  1269. this
  1270. }
  1271. }, {
  1272. key: "multiply",
  1273. value: function(e) {
  1274. return this.x *= e.x,
  1275. this.y *= e.y,
  1276. this
  1277. }
  1278. }, {
  1279. key: "multiplyScalar",
  1280. value: function(e) {
  1281. return this.x *= e,
  1282. this.y *= e,
  1283. this
  1284. }
  1285. }, {
  1286. key: "divide",
  1287. value: function(e) {
  1288. return this.x /= e.x,
  1289. this.y /= e.y,
  1290. this
  1291. }
  1292. }, {
  1293. key: "divideScalar",
  1294. value: function(e) {
  1295. return this.multiplyScalar(1 / e)
  1296. }
  1297. }, {
  1298. key: "applyMatrix3",
  1299. value: function(e) {
  1300. var t = this.x
  1301. , n = this.y
  1302. , e = e.elements;
  1303. return this.x = e[0] * t + e[3] * n + e[6],
  1304. this.y = e[1] * t + e[4] * n + e[7],
  1305. this
  1306. }
  1307. }, {
  1308. key: "min",
  1309. value: function(e) {
  1310. return this.x = Math.min(this.x, e.x),
  1311. this.y = Math.min(this.y, e.y),
  1312. this
  1313. }
  1314. }, {
  1315. key: "max",
  1316. value: function(e) {
  1317. return this.x = Math.max(this.x, e.x),
  1318. this.y = Math.max(this.y, e.y),
  1319. this
  1320. }
  1321. }, {
  1322. key: "clamp",
  1323. value: function(e, t) {
  1324. return this.x = Math.max(e.x, Math.min(t.x, this.x)),
  1325. this.y = Math.max(e.y, Math.min(t.y, this.y)),
  1326. this
  1327. }
  1328. }, {
  1329. key: "clampScalar",
  1330. value: function(e, t) {
  1331. return this.x = Math.max(e, Math.min(t, this.x)),
  1332. this.y = Math.max(e, Math.min(t, this.y)),
  1333. this
  1334. }
  1335. }, {
  1336. key: "clampLength",
  1337. value: function(e, t) {
  1338. var n = this.length();
  1339. return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n)))
  1340. }
  1341. }, {
  1342. key: "floor",
  1343. value: function() {
  1344. return this.x = Math.floor(this.x),
  1345. this.y = Math.floor(this.y),
  1346. this
  1347. }
  1348. }, {
  1349. key: "ceil",
  1350. value: function() {
  1351. return this.x = Math.ceil(this.x),
  1352. this.y = Math.ceil(this.y),
  1353. this
  1354. }
  1355. }, {
  1356. key: "round",
  1357. value: function() {
  1358. return this.x = Math.round(this.x),
  1359. this.y = Math.round(this.y),
  1360. this
  1361. }
  1362. }, {
  1363. key: "roundToZero",
  1364. value: function() {
  1365. return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x),
  1366. this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y),
  1367. this
  1368. }
  1369. }, {
  1370. key: "negate",
  1371. value: function() {
  1372. return this.x = -this.x,
  1373. this.y = -this.y,
  1374. this
  1375. }
  1376. }, {
  1377. key: "dot",
  1378. value: function(e) {
  1379. return this.x * e.x + this.y * e.y
  1380. }
  1381. }, {
  1382. key: "cross",
  1383. value: function(e) {
  1384. return this.x * e.y - this.y * e.x
  1385. }
  1386. }, {
  1387. key: "lengthSq",
  1388. value: function() {
  1389. return this.x * this.x + this.y * this.y
  1390. }
  1391. }, {
  1392. key: "length",
  1393. value: function() {
  1394. return Math.sqrt(this.x * this.x + this.y * this.y)
  1395. }
  1396. }, {
  1397. key: "manhattanLength",
  1398. value: function() {
  1399. return Math.abs(this.x) + Math.abs(this.y)
  1400. }
  1401. }, {
  1402. key: "normalize",
  1403. value: function() {
  1404. return this.divideScalar(this.length() || 1)
  1405. }
  1406. }, {
  1407. key: "angle",
  1408. value: function() {
  1409. return Math.atan2(-this.y, -this.x) + Math.PI
  1410. }
  1411. }, {
  1412. key: "distanceTo",
  1413. value: function(e) {
  1414. return Math.sqrt(this.distanceToSquared(e))
  1415. }
  1416. }, {
  1417. key: "distanceToSquared",
  1418. value: function(e) {
  1419. var t = this.x - e.x
  1420. , e = this.y - e.y;
  1421. return t * t + e * e
  1422. }
  1423. }, {
  1424. key: "manhattanDistanceTo",
  1425. value: function(e) {
  1426. return Math.abs(this.x - e.x) + Math.abs(this.y - e.y)
  1427. }
  1428. }, {
  1429. key: "setLength",
  1430. value: function(e) {
  1431. return this.normalize().multiplyScalar(e)
  1432. }
  1433. }, {
  1434. key: "lerp",
  1435. value: function(e, t) {
  1436. return this.x += (e.x - this.x) * t,
  1437. this.y += (e.y - this.y) * t,
  1438. this
  1439. }
  1440. }, {
  1441. key: "lerpVectors",
  1442. value: function(e, t, n) {
  1443. return this.x = e.x + (t.x - e.x) * n,
  1444. this.y = e.y + (t.y - e.y) * n,
  1445. this
  1446. }
  1447. }, {
  1448. key: "equals",
  1449. value: function(e) {
  1450. return e.x === this.x && e.y === this.y
  1451. }
  1452. }, {
  1453. key: "fromArray",
  1454. value: function(e) {
  1455. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  1456. return this.x = e[t],
  1457. this.y = e[t + 1],
  1458. this
  1459. }
  1460. }, {
  1461. key: "toArray",
  1462. value: function() {
  1463. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  1464. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  1465. return e[t] = this.x,
  1466. e[t + 1] = this.y,
  1467. e
  1468. }
  1469. }, {
  1470. key: "fromBufferAttribute",
  1471. value: function(e, t, n) {
  1472. return void 0 !== n && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),
  1473. this.x = e.getX(t),
  1474. this.y = e.getY(t),
  1475. this
  1476. }
  1477. }, {
  1478. key: "rotateAround",
  1479. value: function(e, t) {
  1480. var n = Math.cos(t)
  1481. , i = Math.sin(t)
  1482. , r = this.x - e.x
  1483. , t = this.y - e.y;
  1484. return this.x = r * n - t * i + e.x,
  1485. this.y = r * i + t * n + e.y,
  1486. this
  1487. }
  1488. }, {
  1489. key: "random",
  1490. value: function() {
  1491. return this.x = Math.random(),
  1492. this.y = Math.random(),
  1493. this
  1494. }
  1495. }]),
  1496. n
  1497. }(), wn = function() {
  1498. function e() {
  1499. O(this, e),
  1500. Object.defineProperty(this, "isMatrix3", {
  1501. value: !0
  1502. }),
  1503. this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1],
  1504. 0 < arguments.length && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")
  1505. }
  1506. return h(e, [{
  1507. key: "set",
  1508. value: function(e, t, n, i, r, a, o, s, l) {
  1509. var u = this.elements;
  1510. return u[0] = e,
  1511. u[1] = i,
  1512. u[2] = o,
  1513. u[3] = t,
  1514. u[4] = r,
  1515. u[5] = s,
  1516. u[6] = n,
  1517. u[7] = a,
  1518. u[8] = l,
  1519. this
  1520. }
  1521. }, {
  1522. key: "identity",
  1523. value: function() {
  1524. return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1),
  1525. this
  1526. }
  1527. }, {
  1528. key: "clone",
  1529. value: function() {
  1530. return (new this.constructor).fromArray(this.elements)
  1531. }
  1532. }, {
  1533. key: "copy",
  1534. value: function(e) {
  1535. var t = this.elements
  1536. , e = e.elements;
  1537. return t[0] = e[0],
  1538. t[1] = e[1],
  1539. t[2] = e[2],
  1540. t[3] = e[3],
  1541. t[4] = e[4],
  1542. t[5] = e[5],
  1543. t[6] = e[6],
  1544. t[7] = e[7],
  1545. t[8] = e[8],
  1546. this
  1547. }
  1548. }, {
  1549. key: "extractBasis",
  1550. value: function(e, t, n) {
  1551. return e.setFromMatrix3Column(this, 0),
  1552. t.setFromMatrix3Column(this, 1),
  1553. n.setFromMatrix3Column(this, 2),
  1554. this
  1555. }
  1556. }, {
  1557. key: "setFromMatrix4",
  1558. value: function(e) {
  1559. e = e.elements;
  1560. return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]),
  1561. this
  1562. }
  1563. }, {
  1564. key: "multiply",
  1565. value: function(e) {
  1566. return this.multiplyMatrices(this, e)
  1567. }
  1568. }, {
  1569. key: "premultiply",
  1570. value: function(e) {
  1571. return this.multiplyMatrices(e, this)
  1572. }
  1573. }, {
  1574. key: "multiplyMatrices",
  1575. value: function(e, t) {
  1576. var n = e.elements
  1577. , i = t.elements
  1578. , r = this.elements
  1579. , a = n[0]
  1580. , o = n[3]
  1581. , s = n[6]
  1582. , l = n[1]
  1583. , u = n[4]
  1584. , c = n[7]
  1585. , d = n[2]
  1586. , h = n[5]
  1587. , p = n[8]
  1588. , f = i[0]
  1589. , m = i[3]
  1590. , v = i[6]
  1591. , g = i[1]
  1592. , y = i[4]
  1593. , e = i[7]
  1594. , t = i[2]
  1595. , n = i[5]
  1596. , i = i[8];
  1597. return r[0] = a * f + o * g + s * t,
  1598. r[3] = a * m + o * y + s * n,
  1599. r[6] = a * v + o * e + s * i,
  1600. r[1] = l * f + u * g + c * t,
  1601. r[4] = l * m + u * y + c * n,
  1602. r[7] = l * v + u * e + c * i,
  1603. r[2] = d * f + h * g + p * t,
  1604. r[5] = d * m + h * y + p * n,
  1605. r[8] = d * v + h * e + p * i,
  1606. this
  1607. }
  1608. }, {
  1609. key: "multiplyScalar",
  1610. value: function(e) {
  1611. var t = this.elements;
  1612. return t[0] *= e,
  1613. t[3] *= e,
  1614. t[6] *= e,
  1615. t[1] *= e,
  1616. t[4] *= e,
  1617. t[7] *= e,
  1618. t[2] *= e,
  1619. t[5] *= e,
  1620. t[8] *= e,
  1621. this
  1622. }
  1623. }, {
  1624. key: "determinant",
  1625. value: function() {
  1626. var e = this.elements
  1627. , t = e[0]
  1628. , n = e[1]
  1629. , i = e[2]
  1630. , r = e[3]
  1631. , a = e[4]
  1632. , o = e[5]
  1633. , s = e[6]
  1634. , l = e[7]
  1635. , e = e[8];
  1636. return t * a * e - t * o * l - n * r * e + n * o * s + i * r * l - i * a * s
  1637. }
  1638. }, {
  1639. key: "invert",
  1640. value: function() {
  1641. var e = this.elements
  1642. , t = e[0]
  1643. , n = e[1]
  1644. , i = e[2]
  1645. , r = e[3]
  1646. , a = e[4]
  1647. , o = e[5]
  1648. , s = e[6]
  1649. , l = e[7]
  1650. , u = e[8]
  1651. , c = u * a - o * l
  1652. , d = o * s - u * r
  1653. , h = l * r - a * s
  1654. , p = t * c + n * d + i * h;
  1655. if (0 == p)
  1656. return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
  1657. p = 1 / p;
  1658. return e[0] = c * p,
  1659. e[1] = (i * l - u * n) * p,
  1660. e[2] = (o * n - i * a) * p,
  1661. e[3] = d * p,
  1662. e[4] = (u * t - i * s) * p,
  1663. e[5] = (i * r - o * t) * p,
  1664. e[6] = h * p,
  1665. e[7] = (n * s - l * t) * p,
  1666. e[8] = (a * t - n * r) * p,
  1667. this
  1668. }
  1669. }, {
  1670. key: "transpose",
  1671. value: function() {
  1672. var e = this.elements
  1673. , t = e[1];
  1674. return e[1] = e[3],
  1675. e[3] = t,
  1676. t = e[2],
  1677. e[2] = e[6],
  1678. e[6] = t,
  1679. t = e[5],
  1680. e[5] = e[7],
  1681. e[7] = t,
  1682. this
  1683. }
  1684. }, {
  1685. key: "getNormalMatrix",
  1686. value: function(e) {
  1687. return this.setFromMatrix4(e).copy(this).invert().transpose()
  1688. }
  1689. }, {
  1690. key: "transposeIntoArray",
  1691. value: function(e) {
  1692. var t = this.elements;
  1693. return e[0] = t[0],
  1694. e[1] = t[3],
  1695. e[2] = t[6],
  1696. e[3] = t[1],
  1697. e[4] = t[4],
  1698. e[5] = t[7],
  1699. e[6] = t[2],
  1700. e[7] = t[5],
  1701. e[8] = t[8],
  1702. this
  1703. }
  1704. }, {
  1705. key: "setUvTransform",
  1706. value: function(e, t, n, i, r, a, o) {
  1707. var s = Math.cos(r)
  1708. , r = Math.sin(r);
  1709. return this.set(n * s, n * r, -n * (s * a + r * o) + a + e, -i * r, i * s, -i * (-r * a + s * o) + o + t, 0, 0, 1),
  1710. this
  1711. }
  1712. }, {
  1713. key: "scale",
  1714. value: function(e, t) {
  1715. var n = this.elements;
  1716. return n[0] *= e,
  1717. n[3] *= e,
  1718. n[6] *= e,
  1719. n[1] *= t,
  1720. n[4] *= t,
  1721. n[7] *= t,
  1722. this
  1723. }
  1724. }, {
  1725. key: "rotate",
  1726. value: function(e) {
  1727. var t = Math.cos(e)
  1728. , n = Math.sin(e)
  1729. , i = this.elements
  1730. , r = i[0]
  1731. , a = i[3]
  1732. , o = i[6]
  1733. , s = i[1]
  1734. , l = i[4]
  1735. , e = i[7];
  1736. return i[0] = t * r + n * s,
  1737. i[3] = t * a + n * l,
  1738. i[6] = t * o + n * e,
  1739. i[1] = -n * r + t * s,
  1740. i[4] = -n * a + t * l,
  1741. i[7] = -n * o + t * e,
  1742. this
  1743. }
  1744. }, {
  1745. key: "translate",
  1746. value: function(e, t) {
  1747. var n = this.elements;
  1748. return n[0] += e * n[2],
  1749. n[3] += e * n[5],
  1750. n[6] += e * n[8],
  1751. n[1] += t * n[2],
  1752. n[4] += t * n[5],
  1753. n[7] += t * n[8],
  1754. this
  1755. }
  1756. }, {
  1757. key: "equals",
  1758. value: function(e) {
  1759. for (var t = this.elements, n = e.elements, i = 0; i < 9; i++)
  1760. if (t[i] !== n[i])
  1761. return !1;
  1762. return !0
  1763. }
  1764. }, {
  1765. key: "fromArray",
  1766. value: function(e) {
  1767. for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = 0; n < 9; n++)
  1768. this.elements[n] = e[n + t];
  1769. return this
  1770. }
  1771. }, {
  1772. key: "toArray",
  1773. value: function() {
  1774. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  1775. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  1776. , n = this.elements;
  1777. return e[t] = n[0],
  1778. e[t + 1] = n[1],
  1779. e[t + 2] = n[2],
  1780. e[t + 3] = n[3],
  1781. e[t + 4] = n[4],
  1782. e[t + 5] = n[5],
  1783. e[t + 6] = n[6],
  1784. e[t + 7] = n[7],
  1785. e[t + 8] = n[8],
  1786. e
  1787. }
  1788. }]),
  1789. e
  1790. }(), bn = {
  1791. getDataURL: function(e) {
  1792. if (/^data:/i.test(e.src))
  1793. return e.src;
  1794. if ("undefined" == typeof HTMLCanvasElement)
  1795. return e.src;
  1796. var t, e = e instanceof HTMLCanvasElement ? e : ((mn = void 0 === mn ? document.createElementNS("http://www.w3.org/1999/xhtml", "canvas") : mn).width = e.width,
  1797. mn.height = e.height,
  1798. t = mn.getContext("2d"),
  1799. e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height),
  1800. mn);
  1801. return 2048 < e.width || 2048 < e.height ? e.toDataURL("image/jpeg", .6) : e.toDataURL("image/png")
  1802. }
  1803. }, xn = 0;
  1804. function En() {
  1805. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : En.DEFAULT_IMAGE
  1806. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : En.DEFAULT_MAPPING
  1807. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : Be
  1808. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : Be
  1809. , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : Oe
  1810. , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : Ne
  1811. , o = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : et
  1812. , s = 7 < arguments.length && void 0 !== arguments[7] ? arguments[7] : Ue
  1813. , l = 8 < arguments.length && void 0 !== arguments[8] ? arguments[8] : 1
  1814. , u = 9 < arguments.length && void 0 !== arguments[9] ? arguments[9] : rn;
  1815. Object.defineProperty(this, "id", {
  1816. value: xn++
  1817. }),
  1818. this.uuid = gn.generateUUID(),
  1819. this.name = "",
  1820. this.image = e,
  1821. this.mipmaps = [],
  1822. this.mapping = t,
  1823. this.wrapS = n,
  1824. this.wrapT = i,
  1825. this.magFilter = r,
  1826. this.minFilter = a,
  1827. this.anisotropy = l,
  1828. this.format = o,
  1829. this.internalFormat = null,
  1830. this.type = s,
  1831. this.offset = new yn(0,0),
  1832. this.repeat = new yn(1,1),
  1833. this.center = new yn(0,0),
  1834. this.rotation = 0,
  1835. this.matrixAutoUpdate = !0,
  1836. this.matrix = new wn,
  1837. this.generateMipmaps = !0,
  1838. this.premultiplyAlpha = !1,
  1839. this.flipY = !0,
  1840. this.unpackAlignment = 4,
  1841. this.encoding = u,
  1842. this.version = 0,
  1843. this.onUpdate = null
  1844. }
  1845. function _n(e) {
  1846. return "undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap ? bn.getDataURL(e) : e.data ? {
  1847. data: Array.prototype.slice.call(e.data),
  1848. width: e.width,
  1849. height: e.height,
  1850. type: e.data.constructor.name
  1851. } : (console.warn("THREE.Texture: Unable to serialize Texture."),
  1852. {})
  1853. }
  1854. En.DEFAULT_IMAGE = void 0,
  1855. En.DEFAULT_MAPPING = 300,
  1856. En.prototype = Object.assign(Object.create(hn.prototype), {
  1857. constructor: En,
  1858. isTexture: !0,
  1859. updateMatrix: function() {
  1860. this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y)
  1861. },
  1862. clone: function() {
  1863. return (new this.constructor).copy(this)
  1864. },
  1865. copy: function(e) {
  1866. return this.name = e.name,
  1867. this.image = e.image,
  1868. this.mipmaps = e.mipmaps.slice(0),
  1869. this.mapping = e.mapping,
  1870. this.wrapS = e.wrapS,
  1871. this.wrapT = e.wrapT,
  1872. this.magFilter = e.magFilter,
  1873. this.minFilter = e.minFilter,
  1874. this.anisotropy = e.anisotropy,
  1875. this.format = e.format,
  1876. this.internalFormat = e.internalFormat,
  1877. this.type = e.type,
  1878. this.offset.copy(e.offset),
  1879. this.repeat.copy(e.repeat),
  1880. this.center.copy(e.center),
  1881. this.rotation = e.rotation,
  1882. this.matrixAutoUpdate = e.matrixAutoUpdate,
  1883. this.matrix.copy(e.matrix),
  1884. this.generateMipmaps = e.generateMipmaps,
  1885. this.premultiplyAlpha = e.premultiplyAlpha,
  1886. this.flipY = e.flipY,
  1887. this.unpackAlignment = e.unpackAlignment,
  1888. this.encoding = e.encoding,
  1889. this
  1890. },
  1891. toJSON: function(e) {
  1892. var t = void 0 === e || "string" == typeof e;
  1893. if (!t && void 0 !== e.textures[this.uuid])
  1894. return e.textures[this.uuid];
  1895. var n = {
  1896. metadata: {
  1897. version: 4.5,
  1898. type: "Texture",
  1899. generator: "Texture.toJSON"
  1900. },
  1901. uuid: this.uuid,
  1902. name: this.name,
  1903. mapping: this.mapping,
  1904. repeat: [this.repeat.x, this.repeat.y],
  1905. offset: [this.offset.x, this.offset.y],
  1906. center: [this.center.x, this.center.y],
  1907. rotation: this.rotation,
  1908. wrap: [this.wrapS, this.wrapT],
  1909. format: this.format,
  1910. type: this.type,
  1911. encoding: this.encoding,
  1912. minFilter: this.minFilter,
  1913. magFilter: this.magFilter,
  1914. anisotropy: this.anisotropy,
  1915. flipY: this.flipY,
  1916. premultiplyAlpha: this.premultiplyAlpha,
  1917. unpackAlignment: this.unpackAlignment
  1918. };
  1919. if (void 0 !== this.image) {
  1920. var i = this.image;
  1921. if (void 0 === i.uuid && (i.uuid = gn.generateUUID()),
  1922. !t && void 0 === e.images[i.uuid]) {
  1923. if (Array.isArray(i))
  1924. for (var r = [], a = 0, o = i.length; a < o; a++)
  1925. i[a].isDataTexture ? r.push(_n(i[a].image)) : r.push(_n(i[a]));
  1926. else
  1927. r = _n(i);
  1928. e.images[i.uuid] = {
  1929. uuid: i.uuid,
  1930. url: r
  1931. }
  1932. }
  1933. n.image = i.uuid
  1934. }
  1935. return t || (e.textures[this.uuid] = n),
  1936. n
  1937. },
  1938. dispose: function() {
  1939. this.dispatchEvent({
  1940. type: "dispose"
  1941. })
  1942. },
  1943. transformUv: function(e) {
  1944. if (300 !== this.mapping)
  1945. return e;
  1946. if (e.applyMatrix3(this.matrix),
  1947. e.x < 0 || 1 < e.x)
  1948. switch (this.wrapS) {
  1949. case ke:
  1950. e.x = e.x - Math.floor(e.x);
  1951. break;
  1952. case Be:
  1953. e.x = e.x < 0 ? 0 : 1;
  1954. break;
  1955. case Le:
  1956. 1 === Math.abs(Math.floor(e.x) % 2) ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x)
  1957. }
  1958. if (e.y < 0 || 1 < e.y)
  1959. switch (this.wrapT) {
  1960. case ke:
  1961. e.y = e.y - Math.floor(e.y);
  1962. break;
  1963. case Be:
  1964. e.y = e.y < 0 ? 0 : 1;
  1965. break;
  1966. case Le:
  1967. 1 === Math.abs(Math.floor(e.y) % 2) ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y)
  1968. }
  1969. return this.flipY && (e.y = 1 - e.y),
  1970. e
  1971. }
  1972. }),
  1973. Object.defineProperty(En.prototype, "needsUpdate", {
  1974. set: function(e) {
  1975. !0 === e && this.version++
  1976. }
  1977. });
  1978. var Mn = function() {
  1979. function r() {
  1980. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
  1981. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  1982. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  1983. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1;
  1984. O(this, r),
  1985. Object.defineProperty(this, "isVector4", {
  1986. value: !0
  1987. }),
  1988. this.x = e,
  1989. this.y = t,
  1990. this.z = n,
  1991. this.w = i
  1992. }
  1993. return h(r, [{
  1994. key: "width",
  1995. get: function() {
  1996. return this.z
  1997. },
  1998. set: function(e) {
  1999. this.z = e
  2000. }
  2001. }, {
  2002. key: "height",
  2003. get: function() {
  2004. return this.w
  2005. },
  2006. set: function(e) {
  2007. this.w = e
  2008. }
  2009. }, {
  2010. key: "set",
  2011. value: function(e, t, n, i) {
  2012. return this.x = e,
  2013. this.y = t,
  2014. this.z = n,
  2015. this.w = i,
  2016. this
  2017. }
  2018. }, {
  2019. key: "setScalar",
  2020. value: function(e) {
  2021. return this.x = e,
  2022. this.y = e,
  2023. this.z = e,
  2024. this.w = e,
  2025. this
  2026. }
  2027. }, {
  2028. key: "setX",
  2029. value: function(e) {
  2030. return this.x = e,
  2031. this
  2032. }
  2033. }, {
  2034. key: "setY",
  2035. value: function(e) {
  2036. return this.y = e,
  2037. this
  2038. }
  2039. }, {
  2040. key: "setZ",
  2041. value: function(e) {
  2042. return this.z = e,
  2043. this
  2044. }
  2045. }, {
  2046. key: "setW",
  2047. value: function(e) {
  2048. return this.w = e,
  2049. this
  2050. }
  2051. }, {
  2052. key: "setComponent",
  2053. value: function(e, t) {
  2054. switch (e) {
  2055. case 0:
  2056. this.x = t;
  2057. break;
  2058. case 1:
  2059. this.y = t;
  2060. break;
  2061. case 2:
  2062. this.z = t;
  2063. break;
  2064. case 3:
  2065. this.w = t;
  2066. break;
  2067. default:
  2068. throw new Error("index is out of range: " + e)
  2069. }
  2070. return this
  2071. }
  2072. }, {
  2073. key: "getComponent",
  2074. value: function(e) {
  2075. switch (e) {
  2076. case 0:
  2077. return this.x;
  2078. case 1:
  2079. return this.y;
  2080. case 2:
  2081. return this.z;
  2082. case 3:
  2083. return this.w;
  2084. default:
  2085. throw new Error("index is out of range: " + e)
  2086. }
  2087. }
  2088. }, {
  2089. key: "clone",
  2090. value: function() {
  2091. return new this.constructor(this.x,this.y,this.z,this.w)
  2092. }
  2093. }, {
  2094. key: "copy",
  2095. value: function(e) {
  2096. return this.x = e.x,
  2097. this.y = e.y,
  2098. this.z = e.z,
  2099. this.w = void 0 !== e.w ? e.w : 1,
  2100. this
  2101. }
  2102. }, {
  2103. key: "add",
  2104. value: function(e, t) {
  2105. return void 0 !== t ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
  2106. this.addVectors(e, t)) : (this.x += e.x,
  2107. this.y += e.y,
  2108. this.z += e.z,
  2109. this.w += e.w,
  2110. this)
  2111. }
  2112. }, {
  2113. key: "addScalar",
  2114. value: function(e) {
  2115. return this.x += e,
  2116. this.y += e,
  2117. this.z += e,
  2118. this.w += e,
  2119. this
  2120. }
  2121. }, {
  2122. key: "addVectors",
  2123. value: function(e, t) {
  2124. return this.x = e.x + t.x,
  2125. this.y = e.y + t.y,
  2126. this.z = e.z + t.z,
  2127. this.w = e.w + t.w,
  2128. this
  2129. }
  2130. }, {
  2131. key: "addScaledVector",
  2132. value: function(e, t) {
  2133. return this.x += e.x * t,
  2134. this.y += e.y * t,
  2135. this.z += e.z * t,
  2136. this.w += e.w * t,
  2137. this
  2138. }
  2139. }, {
  2140. key: "sub",
  2141. value: function(e, t) {
  2142. return void 0 !== t ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
  2143. this.subVectors(e, t)) : (this.x -= e.x,
  2144. this.y -= e.y,
  2145. this.z -= e.z,
  2146. this.w -= e.w,
  2147. this)
  2148. }
  2149. }, {
  2150. key: "subScalar",
  2151. value: function(e) {
  2152. return this.x -= e,
  2153. this.y -= e,
  2154. this.z -= e,
  2155. this.w -= e,
  2156. this
  2157. }
  2158. }, {
  2159. key: "subVectors",
  2160. value: function(e, t) {
  2161. return this.x = e.x - t.x,
  2162. this.y = e.y - t.y,
  2163. this.z = e.z - t.z,
  2164. this.w = e.w - t.w,
  2165. this
  2166. }
  2167. }, {
  2168. key: "multiplyScalar",
  2169. value: function(e) {
  2170. return this.x *= e,
  2171. this.y *= e,
  2172. this.z *= e,
  2173. this.w *= e,
  2174. this
  2175. }
  2176. }, {
  2177. key: "applyMatrix4",
  2178. value: function(e) {
  2179. var t = this.x
  2180. , n = this.y
  2181. , i = this.z
  2182. , r = this.w
  2183. , e = e.elements;
  2184. return this.x = e[0] * t + e[4] * n + e[8] * i + e[12] * r,
  2185. this.y = e[1] * t + e[5] * n + e[9] * i + e[13] * r,
  2186. this.z = e[2] * t + e[6] * n + e[10] * i + e[14] * r,
  2187. this.w = e[3] * t + e[7] * n + e[11] * i + e[15] * r,
  2188. this
  2189. }
  2190. }, {
  2191. key: "divideScalar",
  2192. value: function(e) {
  2193. return this.multiplyScalar(1 / e)
  2194. }
  2195. }, {
  2196. key: "setAxisAngleFromQuaternion",
  2197. value: function(e) {
  2198. this.w = 2 * Math.acos(e.w);
  2199. var t = Math.sqrt(1 - e.w * e.w);
  2200. return t < 1e-4 ? (this.x = 1,
  2201. this.y = 0,
  2202. this.z = 0) : (this.x = e.x / t,
  2203. this.y = e.y / t,
  2204. this.z = e.z / t),
  2205. this
  2206. }
  2207. }, {
  2208. key: "setAxisAngleFromRotationMatrix",
  2209. value: function(e) {
  2210. var t, n, i, r = e.elements, a = r[0], o = r[4], s = r[8], l = r[1], u = r[5], c = r[9], d = r[2], h = r[6], p = r[10];
  2211. if (Math.abs(o - l) < .01 && Math.abs(s - d) < .01 && Math.abs(c - h) < .01) {
  2212. if (Math.abs(o + l) < .1 && Math.abs(s + d) < .1 && Math.abs(c + h) < .1 && Math.abs(a + u + p - 3) < .1)
  2213. return this.set(1, 0, 0, 0),
  2214. this;
  2215. var f = Math.PI
  2216. , m = (a + 1) / 2
  2217. , v = (u + 1) / 2
  2218. , g = (p + 1) / 2
  2219. , y = (o + l) / 4
  2220. , e = (s + d) / 4
  2221. , r = (c + h) / 4;
  2222. return v < m && g < m ? i = m < .01 ? (t = 0,
  2223. n = .707106781) : (n = y / (t = Math.sqrt(m)),
  2224. e / t) : g < v ? i = v < .01 ? (n = 0,
  2225. t = .707106781) : (t = y / (n = Math.sqrt(v)),
  2226. r / n) : g < .01 ? (n = t = .707106781,
  2227. i = 0) : (t = e / (i = Math.sqrt(g)),
  2228. n = r / i),
  2229. this.set(t, n, i, f),
  2230. this
  2231. }
  2232. f = Math.sqrt((h - c) * (h - c) + (s - d) * (s - d) + (l - o) * (l - o));
  2233. return Math.abs(f) < .001 && (f = 1),
  2234. this.x = (h - c) / f,
  2235. this.y = (s - d) / f,
  2236. this.z = (l - o) / f,
  2237. this.w = Math.acos((a + u + p - 1) / 2),
  2238. this
  2239. }
  2240. }, {
  2241. key: "min",
  2242. value: function(e) {
  2243. return this.x = Math.min(this.x, e.x),
  2244. this.y = Math.min(this.y, e.y),
  2245. this.z = Math.min(this.z, e.z),
  2246. this.w = Math.min(this.w, e.w),
  2247. this
  2248. }
  2249. }, {
  2250. key: "max",
  2251. value: function(e) {
  2252. return this.x = Math.max(this.x, e.x),
  2253. this.y = Math.max(this.y, e.y),
  2254. this.z = Math.max(this.z, e.z),
  2255. this.w = Math.max(this.w, e.w),
  2256. this
  2257. }
  2258. }, {
  2259. key: "clamp",
  2260. value: function(e, t) {
  2261. return this.x = Math.max(e.x, Math.min(t.x, this.x)),
  2262. this.y = Math.max(e.y, Math.min(t.y, this.y)),
  2263. this.z = Math.max(e.z, Math.min(t.z, this.z)),
  2264. this.w = Math.max(e.w, Math.min(t.w, this.w)),
  2265. this
  2266. }
  2267. }, {
  2268. key: "clampScalar",
  2269. value: function(e, t) {
  2270. return this.x = Math.max(e, Math.min(t, this.x)),
  2271. this.y = Math.max(e, Math.min(t, this.y)),
  2272. this.z = Math.max(e, Math.min(t, this.z)),
  2273. this.w = Math.max(e, Math.min(t, this.w)),
  2274. this
  2275. }
  2276. }, {
  2277. key: "clampLength",
  2278. value: function(e, t) {
  2279. var n = this.length();
  2280. return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n)))
  2281. }
  2282. }, {
  2283. key: "floor",
  2284. value: function() {
  2285. return this.x = Math.floor(this.x),
  2286. this.y = Math.floor(this.y),
  2287. this.z = Math.floor(this.z),
  2288. this.w = Math.floor(this.w),
  2289. this
  2290. }
  2291. }, {
  2292. key: "ceil",
  2293. value: function() {
  2294. return this.x = Math.ceil(this.x),
  2295. this.y = Math.ceil(this.y),
  2296. this.z = Math.ceil(this.z),
  2297. this.w = Math.ceil(this.w),
  2298. this
  2299. }
  2300. }, {
  2301. key: "round",
  2302. value: function() {
  2303. return this.x = Math.round(this.x),
  2304. this.y = Math.round(this.y),
  2305. this.z = Math.round(this.z),
  2306. this.w = Math.round(this.w),
  2307. this
  2308. }
  2309. }, {
  2310. key: "roundToZero",
  2311. value: function() {
  2312. return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x),
  2313. this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y),
  2314. this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z),
  2315. this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w),
  2316. this
  2317. }
  2318. }, {
  2319. key: "negate",
  2320. value: function() {
  2321. return this.x = -this.x,
  2322. this.y = -this.y,
  2323. this.z = -this.z,
  2324. this.w = -this.w,
  2325. this
  2326. }
  2327. }, {
  2328. key: "dot",
  2329. value: function(e) {
  2330. return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w
  2331. }
  2332. }, {
  2333. key: "lengthSq",
  2334. value: function() {
  2335. return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w
  2336. }
  2337. }, {
  2338. key: "length",
  2339. value: function() {
  2340. return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
  2341. }
  2342. }, {
  2343. key: "manhattanLength",
  2344. value: function() {
  2345. return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w)
  2346. }
  2347. }, {
  2348. key: "normalize",
  2349. value: function() {
  2350. return this.divideScalar(this.length() || 1)
  2351. }
  2352. }, {
  2353. key: "setLength",
  2354. value: function(e) {
  2355. return this.normalize().multiplyScalar(e)
  2356. }
  2357. }, {
  2358. key: "lerp",
  2359. value: function(e, t) {
  2360. return this.x += (e.x - this.x) * t,
  2361. this.y += (e.y - this.y) * t,
  2362. this.z += (e.z - this.z) * t,
  2363. this.w += (e.w - this.w) * t,
  2364. this
  2365. }
  2366. }, {
  2367. key: "lerpVectors",
  2368. value: function(e, t, n) {
  2369. return this.x = e.x + (t.x - e.x) * n,
  2370. this.y = e.y + (t.y - e.y) * n,
  2371. this.z = e.z + (t.z - e.z) * n,
  2372. this.w = e.w + (t.w - e.w) * n,
  2373. this
  2374. }
  2375. }, {
  2376. key: "equals",
  2377. value: function(e) {
  2378. return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w
  2379. }
  2380. }, {
  2381. key: "fromArray",
  2382. value: function(e) {
  2383. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  2384. return this.x = e[t],
  2385. this.y = e[t + 1],
  2386. this.z = e[t + 2],
  2387. this.w = e[t + 3],
  2388. this
  2389. }
  2390. }, {
  2391. key: "toArray",
  2392. value: function() {
  2393. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  2394. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  2395. return e[t] = this.x,
  2396. e[t + 1] = this.y,
  2397. e[t + 2] = this.z,
  2398. e[t + 3] = this.w,
  2399. e
  2400. }
  2401. }, {
  2402. key: "fromBufferAttribute",
  2403. value: function(e, t, n) {
  2404. return void 0 !== n && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),
  2405. this.x = e.getX(t),
  2406. this.y = e.getY(t),
  2407. this.z = e.getZ(t),
  2408. this.w = e.getW(t),
  2409. this
  2410. }
  2411. }, {
  2412. key: "random",
  2413. value: function() {
  2414. return this.x = Math.random(),
  2415. this.y = Math.random(),
  2416. this.z = Math.random(),
  2417. this.w = Math.random(),
  2418. this
  2419. }
  2420. }]),
  2421. r
  2422. }();
  2423. function An(e, t, n) {
  2424. this.width = e,
  2425. this.height = t,
  2426. this.scissor = new Mn(0,0,e,t),
  2427. this.scissorTest = !1,
  2428. this.viewport = new Mn(0,0,e,t),
  2429. this.texture = new En(void 0,(n = n || {}).mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),
  2430. this.texture.image = {},
  2431. this.texture.image.width = e,
  2432. this.texture.image.height = t,
  2433. this.texture.generateMipmaps = void 0 !== n.generateMipmaps && n.generateMipmaps,
  2434. this.texture.minFilter = void 0 !== n.minFilter ? n.minFilter : Oe,
  2435. this.depthBuffer = void 0 === n.depthBuffer || n.depthBuffer,
  2436. this.stencilBuffer = void 0 !== n.stencilBuffer && n.stencilBuffer,
  2437. this.depthTexture = void 0 !== n.depthTexture ? n.depthTexture : null
  2438. }
  2439. function Tn(e, t, n) {
  2440. An.call(this, e, t, n),
  2441. this.samples = 4
  2442. }
  2443. An.prototype = Object.assign(Object.create(hn.prototype), {
  2444. constructor: An,
  2445. isWebGLRenderTarget: !0,
  2446. setSize: function(e, t) {
  2447. this.width === e && this.height === t || (this.width = e,
  2448. this.height = t,
  2449. this.texture.image.width = e,
  2450. this.texture.image.height = t,
  2451. this.dispose()),
  2452. this.viewport.set(0, 0, e, t),
  2453. this.scissor.set(0, 0, e, t)
  2454. },
  2455. clone: function() {
  2456. return (new this.constructor).copy(this)
  2457. },
  2458. copy: function(e) {
  2459. return this.width = e.width,
  2460. this.height = e.height,
  2461. this.viewport.copy(e.viewport),
  2462. this.texture = e.texture.clone(),
  2463. this.depthBuffer = e.depthBuffer,
  2464. this.stencilBuffer = e.stencilBuffer,
  2465. this.depthTexture = e.depthTexture,
  2466. this
  2467. },
  2468. dispose: function() {
  2469. this.dispatchEvent({
  2470. type: "dispose"
  2471. })
  2472. }
  2473. }),
  2474. Tn.prototype = Object.assign(Object.create(An.prototype), {
  2475. constructor: Tn,
  2476. isWebGLMultisampleRenderTarget: !0,
  2477. copy: function(e) {
  2478. return An.prototype.copy.call(this, e),
  2479. this.samples = e.samples,
  2480. this
  2481. }
  2482. });
  2483. var Sn = function() {
  2484. function r() {
  2485. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
  2486. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  2487. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  2488. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1;
  2489. O(this, r),
  2490. Object.defineProperty(this, "isQuaternion", {
  2491. value: !0
  2492. }),
  2493. this._x = e,
  2494. this._y = t,
  2495. this._z = n,
  2496. this._w = i
  2497. }
  2498. return h(r, [{
  2499. key: "x",
  2500. get: function() {
  2501. return this._x
  2502. },
  2503. set: function(e) {
  2504. this._x = e,
  2505. this._onChangeCallback()
  2506. }
  2507. }, {
  2508. key: "y",
  2509. get: function() {
  2510. return this._y
  2511. },
  2512. set: function(e) {
  2513. this._y = e,
  2514. this._onChangeCallback()
  2515. }
  2516. }, {
  2517. key: "z",
  2518. get: function() {
  2519. return this._z
  2520. },
  2521. set: function(e) {
  2522. this._z = e,
  2523. this._onChangeCallback()
  2524. }
  2525. }, {
  2526. key: "w",
  2527. get: function() {
  2528. return this._w
  2529. },
  2530. set: function(e) {
  2531. this._w = e,
  2532. this._onChangeCallback()
  2533. }
  2534. }, {
  2535. key: "set",
  2536. value: function(e, t, n, i) {
  2537. return this._x = e,
  2538. this._y = t,
  2539. this._z = n,
  2540. this._w = i,
  2541. this._onChangeCallback(),
  2542. this
  2543. }
  2544. }, {
  2545. key: "clone",
  2546. value: function() {
  2547. return new this.constructor(this._x,this._y,this._z,this._w)
  2548. }
  2549. }, {
  2550. key: "copy",
  2551. value: function(e) {
  2552. return this._x = e.x,
  2553. this._y = e.y,
  2554. this._z = e.z,
  2555. this._w = e.w,
  2556. this._onChangeCallback(),
  2557. this
  2558. }
  2559. }, {
  2560. key: "setFromEuler",
  2561. value: function(e, t) {
  2562. if (!e || !e.isEuler)
  2563. throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
  2564. var n = e._x
  2565. , i = e._y
  2566. , r = e._z
  2567. , a = e._order
  2568. , o = Math.cos
  2569. , e = Math.sin
  2570. , s = o(n / 2)
  2571. , l = o(i / 2)
  2572. , u = o(r / 2)
  2573. , c = e(n / 2)
  2574. , d = e(i / 2)
  2575. , h = e(r / 2);
  2576. switch (a) {
  2577. case "XYZ":
  2578. this._x = c * l * u + s * d * h,
  2579. this._y = s * d * u - c * l * h,
  2580. this._z = s * l * h + c * d * u,
  2581. this._w = s * l * u - c * d * h;
  2582. break;
  2583. case "YXZ":
  2584. this._x = c * l * u + s * d * h,
  2585. this._y = s * d * u - c * l * h,
  2586. this._z = s * l * h - c * d * u,
  2587. this._w = s * l * u + c * d * h;
  2588. break;
  2589. case "ZXY":
  2590. this._x = c * l * u - s * d * h,
  2591. this._y = s * d * u + c * l * h,
  2592. this._z = s * l * h + c * d * u,
  2593. this._w = s * l * u - c * d * h;
  2594. break;
  2595. case "ZYX":
  2596. this._x = c * l * u - s * d * h,
  2597. this._y = s * d * u + c * l * h,
  2598. this._z = s * l * h - c * d * u,
  2599. this._w = s * l * u + c * d * h;
  2600. break;
  2601. case "YZX":
  2602. this._x = c * l * u + s * d * h,
  2603. this._y = s * d * u + c * l * h,
  2604. this._z = s * l * h - c * d * u,
  2605. this._w = s * l * u - c * d * h;
  2606. break;
  2607. case "XZY":
  2608. this._x = c * l * u - s * d * h,
  2609. this._y = s * d * u - c * l * h,
  2610. this._z = s * l * h + c * d * u,
  2611. this._w = s * l * u + c * d * h;
  2612. break;
  2613. default:
  2614. console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a)
  2615. }
  2616. return !1 !== t && this._onChangeCallback(),
  2617. this
  2618. }
  2619. }, {
  2620. key: "setFromAxisAngle",
  2621. value: function(e, t) {
  2622. var n = t / 2
  2623. , t = Math.sin(n);
  2624. return this._x = e.x * t,
  2625. this._y = e.y * t,
  2626. this._z = e.z * t,
  2627. this._w = Math.cos(n),
  2628. this._onChangeCallback(),
  2629. this
  2630. }
  2631. }, {
  2632. key: "setFromRotationMatrix",
  2633. value: function(e) {
  2634. var t, n = e.elements, i = n[0], r = n[4], a = n[8], o = n[1], s = n[5], l = n[9], u = n[2], c = n[6], e = n[10], n = i + s + e;
  2635. return 0 < n ? (n = .5 / Math.sqrt(n + 1),
  2636. this._w = .25 / n,
  2637. this._x = (c - l) * n,
  2638. this._y = (a - u) * n,
  2639. this._z = (o - r) * n) : s < i && e < i ? (t = 2 * Math.sqrt(1 + i - s - e),
  2640. this._w = (c - l) / t,
  2641. this._x = .25 * t,
  2642. this._y = (r + o) / t,
  2643. this._z = (a + u) / t) : e < s ? (t = 2 * Math.sqrt(1 + s - i - e),
  2644. this._w = (a - u) / t,
  2645. this._x = (r + o) / t,
  2646. this._y = .25 * t,
  2647. this._z = (l + c) / t) : (s = 2 * Math.sqrt(1 + e - i - s),
  2648. this._w = (o - r) / s,
  2649. this._x = (a + u) / s,
  2650. this._y = (l + c) / s,
  2651. this._z = .25 * s),
  2652. this._onChangeCallback(),
  2653. this
  2654. }
  2655. }, {
  2656. key: "setFromUnitVectors",
  2657. value: function(e, t) {
  2658. var n = e.dot(t) + 1;
  2659. return n < 1e-6 ? (n = 0,
  2660. Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y,
  2661. this._y = e.x,
  2662. this._z = 0) : (this._x = 0,
  2663. this._y = -e.z,
  2664. this._z = e.y)) : (this._x = e.y * t.z - e.z * t.y,
  2665. this._y = e.z * t.x - e.x * t.z,
  2666. this._z = e.x * t.y - e.y * t.x),
  2667. this._w = n,
  2668. this.normalize()
  2669. }
  2670. }, {
  2671. key: "angleTo",
  2672. value: function(e) {
  2673. return 2 * Math.acos(Math.abs(gn.clamp(this.dot(e), -1, 1)))
  2674. }
  2675. }, {
  2676. key: "rotateTowards",
  2677. value: function(e, t) {
  2678. var n = this.angleTo(e);
  2679. if (0 === n)
  2680. return this;
  2681. n = Math.min(1, t / n);
  2682. return this.slerp(e, n),
  2683. this
  2684. }
  2685. }, {
  2686. key: "identity",
  2687. value: function() {
  2688. return this.set(0, 0, 0, 1)
  2689. }
  2690. }, {
  2691. key: "invert",
  2692. value: function() {
  2693. return this.conjugate()
  2694. }
  2695. }, {
  2696. key: "conjugate",
  2697. value: function() {
  2698. return this._x *= -1,
  2699. this._y *= -1,
  2700. this._z *= -1,
  2701. this._onChangeCallback(),
  2702. this
  2703. }
  2704. }, {
  2705. key: "dot",
  2706. value: function(e) {
  2707. return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w
  2708. }
  2709. }, {
  2710. key: "lengthSq",
  2711. value: function() {
  2712. return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
  2713. }
  2714. }, {
  2715. key: "length",
  2716. value: function() {
  2717. return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
  2718. }
  2719. }, {
  2720. key: "normalize",
  2721. value: function() {
  2722. var e = this.length();
  2723. return 0 === e ? (this._x = 0,
  2724. this._y = 0,
  2725. this._z = 0,
  2726. this._w = 1) : (this._x = this._x * (e = 1 / e),
  2727. this._y = this._y * e,
  2728. this._z = this._z * e,
  2729. this._w = this._w * e),
  2730. this._onChangeCallback(),
  2731. this
  2732. }
  2733. }, {
  2734. key: "multiply",
  2735. value: function(e, t) {
  2736. return void 0 !== t ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
  2737. this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e)
  2738. }
  2739. }, {
  2740. key: "premultiply",
  2741. value: function(e) {
  2742. return this.multiplyQuaternions(e, this)
  2743. }
  2744. }, {
  2745. key: "multiplyQuaternions",
  2746. value: function(e, t) {
  2747. var n = e._x
  2748. , i = e._y
  2749. , r = e._z
  2750. , a = e._w
  2751. , o = t._x
  2752. , s = t._y
  2753. , e = t._z
  2754. , t = t._w;
  2755. return this._x = n * t + a * o + i * e - r * s,
  2756. this._y = i * t + a * s + r * o - n * e,
  2757. this._z = r * t + a * e + n * s - i * o,
  2758. this._w = a * t - n * o - i * s - r * e,
  2759. this._onChangeCallback(),
  2760. this
  2761. }
  2762. }, {
  2763. key: "slerp",
  2764. value: function(e, t) {
  2765. if (0 === t)
  2766. return this;
  2767. if (1 === t)
  2768. return this.copy(e);
  2769. var n = this._x
  2770. , i = this._y
  2771. , r = this._z
  2772. , a = this._w
  2773. , o = a * e._w + n * e._x + i * e._y + r * e._z;
  2774. if (o < 0 ? (this._w = -e._w,
  2775. this._x = -e._x,
  2776. this._y = -e._y,
  2777. this._z = -e._z,
  2778. o = -o) : this.copy(e),
  2779. 1 <= o)
  2780. return this._w = a,
  2781. this._x = n,
  2782. this._y = i,
  2783. this._z = r,
  2784. this;
  2785. e = 1 - o * o;
  2786. if (e <= Number.EPSILON) {
  2787. var s = 1 - t;
  2788. return this._w = s * a + t * this._w,
  2789. this._x = s * n + t * this._x,
  2790. this._y = s * i + t * this._y,
  2791. this._z = s * r + t * this._z,
  2792. this.normalize(),
  2793. this._onChangeCallback(),
  2794. this
  2795. }
  2796. s = Math.sqrt(e),
  2797. e = Math.atan2(s, o),
  2798. o = Math.sin((1 - t) * e) / s,
  2799. s = Math.sin(t * e) / s;
  2800. return this._w = a * o + this._w * s,
  2801. this._x = n * o + this._x * s,
  2802. this._y = i * o + this._y * s,
  2803. this._z = r * o + this._z * s,
  2804. this._onChangeCallback(),
  2805. this
  2806. }
  2807. }, {
  2808. key: "equals",
  2809. value: function(e) {
  2810. return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w
  2811. }
  2812. }, {
  2813. key: "fromArray",
  2814. value: function(e) {
  2815. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  2816. return this._x = e[t],
  2817. this._y = e[t + 1],
  2818. this._z = e[t + 2],
  2819. this._w = e[t + 3],
  2820. this._onChangeCallback(),
  2821. this
  2822. }
  2823. }, {
  2824. key: "toArray",
  2825. value: function() {
  2826. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  2827. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  2828. return e[t] = this._x,
  2829. e[t + 1] = this._y,
  2830. e[t + 2] = this._z,
  2831. e[t + 3] = this._w,
  2832. e
  2833. }
  2834. }, {
  2835. key: "fromBufferAttribute",
  2836. value: function(e, t) {
  2837. return this._x = e.getX(t),
  2838. this._y = e.getY(t),
  2839. this._z = e.getZ(t),
  2840. this._w = e.getW(t),
  2841. this
  2842. }
  2843. }, {
  2844. key: "_onChange",
  2845. value: function(e) {
  2846. return this._onChangeCallback = e,
  2847. this
  2848. }
  2849. }, {
  2850. key: "_onChangeCallback",
  2851. value: function() {}
  2852. }], [{
  2853. key: "slerp",
  2854. value: function(e, t, n, i) {
  2855. return n.copy(e).slerp(t, i)
  2856. }
  2857. }, {
  2858. key: "slerpFlat",
  2859. value: function(e, t, n, i, r, a, o) {
  2860. var s = n[i + 0]
  2861. , l = n[i + 1]
  2862. , u = n[i + 2]
  2863. , c = n[i + 3]
  2864. , d = r[a + 0]
  2865. , h = r[a + 1]
  2866. , p = r[a + 2]
  2867. , f = r[a + 3];
  2868. c === f && s === d && l === h && u === p || (n = 1 - o,
  2869. r = 0 <= (i = s * d + l * h + u * p + c * f) ? 1 : -1,
  2870. (a = 1 - i * i) > Number.EPSILON && (a = Math.sqrt(a),
  2871. i = Math.atan2(a, i * r),
  2872. n = Math.sin(n * i) / a,
  2873. o = Math.sin(o * i) / a),
  2874. s = s * n + d * (r = o * r),
  2875. l = l * n + h * r,
  2876. u = u * n + p * r,
  2877. c = c * n + f * r,
  2878. n === 1 - o && (s *= o = 1 / Math.sqrt(s * s + l * l + u * u + c * c),
  2879. l *= o,
  2880. u *= o,
  2881. c *= o)),
  2882. e[t] = s,
  2883. e[t + 1] = l,
  2884. e[t + 2] = u,
  2885. e[t + 3] = c
  2886. }
  2887. }, {
  2888. key: "multiplyQuaternionsFlat",
  2889. value: function(e, t, n, i, r, a) {
  2890. var o = n[i]
  2891. , s = n[i + 1]
  2892. , l = n[i + 2]
  2893. , u = n[i + 3]
  2894. , c = r[a]
  2895. , n = r[a + 1]
  2896. , i = r[a + 2]
  2897. , a = r[a + 3];
  2898. return e[t] = o * a + u * c + s * i - l * n,
  2899. e[t + 1] = s * a + u * n + l * c - o * i,
  2900. e[t + 2] = l * a + u * i + o * n - s * c,
  2901. e[t + 3] = u * a - o * c - s * n - l * i,
  2902. e
  2903. }
  2904. }]),
  2905. r
  2906. }()
  2907. , Cn = function() {
  2908. function i() {
  2909. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
  2910. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  2911. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0;
  2912. O(this, i),
  2913. Object.defineProperty(this, "isVector3", {
  2914. value: !0
  2915. }),
  2916. this.x = e,
  2917. this.y = t,
  2918. this.z = n
  2919. }
  2920. return h(i, [{
  2921. key: "set",
  2922. value: function(e, t, n) {
  2923. return void 0 === n && (n = this.z),
  2924. this.x = e,
  2925. this.y = t,
  2926. this.z = n,
  2927. this
  2928. }
  2929. }, {
  2930. key: "setScalar",
  2931. value: function(e) {
  2932. return this.x = e,
  2933. this.y = e,
  2934. this.z = e,
  2935. this
  2936. }
  2937. }, {
  2938. key: "setX",
  2939. value: function(e) {
  2940. return this.x = e,
  2941. this
  2942. }
  2943. }, {
  2944. key: "setY",
  2945. value: function(e) {
  2946. return this.y = e,
  2947. this
  2948. }
  2949. }, {
  2950. key: "setZ",
  2951. value: function(e) {
  2952. return this.z = e,
  2953. this
  2954. }
  2955. }, {
  2956. key: "setComponent",
  2957. value: function(e, t) {
  2958. switch (e) {
  2959. case 0:
  2960. this.x = t;
  2961. break;
  2962. case 1:
  2963. this.y = t;
  2964. break;
  2965. case 2:
  2966. this.z = t;
  2967. break;
  2968. default:
  2969. throw new Error("index is out of range: " + e)
  2970. }
  2971. return this
  2972. }
  2973. }, {
  2974. key: "getComponent",
  2975. value: function(e) {
  2976. switch (e) {
  2977. case 0:
  2978. return this.x;
  2979. case 1:
  2980. return this.y;
  2981. case 2:
  2982. return this.z;
  2983. default:
  2984. throw new Error("index is out of range: " + e)
  2985. }
  2986. }
  2987. }, {
  2988. key: "clone",
  2989. value: function() {
  2990. return new this.constructor(this.x,this.y,this.z)
  2991. }
  2992. }, {
  2993. key: "copy",
  2994. value: function(e) {
  2995. return this.x = e.x,
  2996. this.y = e.y,
  2997. this.z = e.z,
  2998. this
  2999. }
  3000. }, {
  3001. key: "add",
  3002. value: function(e, t) {
  3003. return void 0 !== t ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
  3004. this.addVectors(e, t)) : (this.x += e.x,
  3005. this.y += e.y,
  3006. this.z += e.z,
  3007. this)
  3008. }
  3009. }, {
  3010. key: "addScalar",
  3011. value: function(e) {
  3012. return this.x += e,
  3013. this.y += e,
  3014. this.z += e,
  3015. this
  3016. }
  3017. }, {
  3018. key: "addVectors",
  3019. value: function(e, t) {
  3020. return this.x = e.x + t.x,
  3021. this.y = e.y + t.y,
  3022. this.z = e.z + t.z,
  3023. this
  3024. }
  3025. }, {
  3026. key: "addScaledVector",
  3027. value: function(e, t) {
  3028. return this.x += e.x * t,
  3029. this.y += e.y * t,
  3030. this.z += e.z * t,
  3031. this
  3032. }
  3033. }, {
  3034. key: "sub",
  3035. value: function(e, t) {
  3036. return void 0 !== t ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
  3037. this.subVectors(e, t)) : (this.x -= e.x,
  3038. this.y -= e.y,
  3039. this.z -= e.z,
  3040. this)
  3041. }
  3042. }, {
  3043. key: "subScalar",
  3044. value: function(e) {
  3045. return this.x -= e,
  3046. this.y -= e,
  3047. this.z -= e,
  3048. this
  3049. }
  3050. }, {
  3051. key: "subVectors",
  3052. value: function(e, t) {
  3053. return this.x = e.x - t.x,
  3054. this.y = e.y - t.y,
  3055. this.z = e.z - t.z,
  3056. this
  3057. }
  3058. }, {
  3059. key: "multiply",
  3060. value: function(e, t) {
  3061. return void 0 !== t ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),
  3062. this.multiplyVectors(e, t)) : (this.x *= e.x,
  3063. this.y *= e.y,
  3064. this.z *= e.z,
  3065. this)
  3066. }
  3067. }, {
  3068. key: "multiplyScalar",
  3069. value: function(e) {
  3070. return this.x *= e,
  3071. this.y *= e,
  3072. this.z *= e,
  3073. this
  3074. }
  3075. }, {
  3076. key: "multiplyVectors",
  3077. value: function(e, t) {
  3078. return this.x = e.x * t.x,
  3079. this.y = e.y * t.y,
  3080. this.z = e.z * t.z,
  3081. this
  3082. }
  3083. }, {
  3084. key: "applyEuler",
  3085. value: function(e) {
  3086. return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),
  3087. this.applyQuaternion(Dn.setFromEuler(e))
  3088. }
  3089. }, {
  3090. key: "applyAxisAngle",
  3091. value: function(e, t) {
  3092. return this.applyQuaternion(Dn.setFromAxisAngle(e, t))
  3093. }
  3094. }, {
  3095. key: "applyMatrix3",
  3096. value: function(e) {
  3097. var t = this.x
  3098. , n = this.y
  3099. , i = this.z
  3100. , e = e.elements;
  3101. return this.x = e[0] * t + e[3] * n + e[6] * i,
  3102. this.y = e[1] * t + e[4] * n + e[7] * i,
  3103. this.z = e[2] * t + e[5] * n + e[8] * i,
  3104. this
  3105. }
  3106. }, {
  3107. key: "applyNormalMatrix",
  3108. value: function(e) {
  3109. return this.applyMatrix3(e).normalize()
  3110. }
  3111. }, {
  3112. key: "applyMatrix4",
  3113. value: function(e) {
  3114. var t = this.x
  3115. , n = this.y
  3116. , i = this.z
  3117. , r = e.elements
  3118. , e = 1 / (r[3] * t + r[7] * n + r[11] * i + r[15]);
  3119. return this.x = (r[0] * t + r[4] * n + r[8] * i + r[12]) * e,
  3120. this.y = (r[1] * t + r[5] * n + r[9] * i + r[13]) * e,
  3121. this.z = (r[2] * t + r[6] * n + r[10] * i + r[14]) * e,
  3122. this
  3123. }
  3124. }, {
  3125. key: "applyQuaternion",
  3126. value: function(e) {
  3127. var t = this.x
  3128. , n = this.y
  3129. , i = this.z
  3130. , r = e.x
  3131. , a = e.y
  3132. , o = e.z
  3133. , s = e.w
  3134. , l = s * t + a * i - o * n
  3135. , u = s * n + o * t - r * i
  3136. , e = s * i + r * n - a * t
  3137. , i = -r * t - a * n - o * i;
  3138. return this.x = l * s + i * -r + u * -o - e * -a,
  3139. this.y = u * s + i * -a + e * -r - l * -o,
  3140. this.z = e * s + i * -o + l * -a - u * -r,
  3141. this
  3142. }
  3143. }, {
  3144. key: "project",
  3145. value: function(e) {
  3146. return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)
  3147. }
  3148. }, {
  3149. key: "unproject",
  3150. value: function(e) {
  3151. return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)
  3152. }
  3153. }, {
  3154. key: "transformDirection",
  3155. value: function(e) {
  3156. var t = this.x
  3157. , n = this.y
  3158. , i = this.z
  3159. , e = e.elements;
  3160. return this.x = e[0] * t + e[4] * n + e[8] * i,
  3161. this.y = e[1] * t + e[5] * n + e[9] * i,
  3162. this.z = e[2] * t + e[6] * n + e[10] * i,
  3163. this.normalize()
  3164. }
  3165. }, {
  3166. key: "divide",
  3167. value: function(e) {
  3168. return this.x /= e.x,
  3169. this.y /= e.y,
  3170. this.z /= e.z,
  3171. this
  3172. }
  3173. }, {
  3174. key: "divideScalar",
  3175. value: function(e) {
  3176. return this.multiplyScalar(1 / e)
  3177. }
  3178. }, {
  3179. key: "min",
  3180. value: function(e) {
  3181. return this.x = Math.min(this.x, e.x),
  3182. this.y = Math.min(this.y, e.y),
  3183. this.z = Math.min(this.z, e.z),
  3184. this
  3185. }
  3186. }, {
  3187. key: "max",
  3188. value: function(e) {
  3189. return this.x = Math.max(this.x, e.x),
  3190. this.y = Math.max(this.y, e.y),
  3191. this.z = Math.max(this.z, e.z),
  3192. this
  3193. }
  3194. }, {
  3195. key: "clamp",
  3196. value: function(e, t) {
  3197. return this.x = Math.max(e.x, Math.min(t.x, this.x)),
  3198. this.y = Math.max(e.y, Math.min(t.y, this.y)),
  3199. this.z = Math.max(e.z, Math.min(t.z, this.z)),
  3200. this
  3201. }
  3202. }, {
  3203. key: "clampScalar",
  3204. value: function(e, t) {
  3205. return this.x = Math.max(e, Math.min(t, this.x)),
  3206. this.y = Math.max(e, Math.min(t, this.y)),
  3207. this.z = Math.max(e, Math.min(t, this.z)),
  3208. this
  3209. }
  3210. }, {
  3211. key: "clampLength",
  3212. value: function(e, t) {
  3213. var n = this.length();
  3214. return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n)))
  3215. }
  3216. }, {
  3217. key: "floor",
  3218. value: function() {
  3219. return this.x = Math.floor(this.x),
  3220. this.y = Math.floor(this.y),
  3221. this.z = Math.floor(this.z),
  3222. this
  3223. }
  3224. }, {
  3225. key: "ceil",
  3226. value: function() {
  3227. return this.x = Math.ceil(this.x),
  3228. this.y = Math.ceil(this.y),
  3229. this.z = Math.ceil(this.z),
  3230. this
  3231. }
  3232. }, {
  3233. key: "round",
  3234. value: function() {
  3235. return this.x = Math.round(this.x),
  3236. this.y = Math.round(this.y),
  3237. this.z = Math.round(this.z),
  3238. this
  3239. }
  3240. }, {
  3241. key: "roundToZero",
  3242. value: function() {
  3243. return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x),
  3244. this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y),
  3245. this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z),
  3246. this
  3247. }
  3248. }, {
  3249. key: "negate",
  3250. value: function() {
  3251. return this.x = -this.x,
  3252. this.y = -this.y,
  3253. this.z = -this.z,
  3254. this
  3255. }
  3256. }, {
  3257. key: "dot",
  3258. value: function(e) {
  3259. return this.x * e.x + this.y * e.y + this.z * e.z
  3260. }
  3261. }, {
  3262. key: "lengthSq",
  3263. value: function() {
  3264. return this.x * this.x + this.y * this.y + this.z * this.z
  3265. }
  3266. }, {
  3267. key: "length",
  3268. value: function() {
  3269. return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
  3270. }
  3271. }, {
  3272. key: "manhattanLength",
  3273. value: function() {
  3274. return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
  3275. }
  3276. }, {
  3277. key: "normalize",
  3278. value: function() {
  3279. return this.divideScalar(this.length() || 1)
  3280. }
  3281. }, {
  3282. key: "setLength",
  3283. value: function(e) {
  3284. return this.normalize().multiplyScalar(e)
  3285. }
  3286. }, {
  3287. key: "lerp",
  3288. value: function(e, t) {
  3289. return this.x += (e.x - this.x) * t,
  3290. this.y += (e.y - this.y) * t,
  3291. this.z += (e.z - this.z) * t,
  3292. this
  3293. }
  3294. }, {
  3295. key: "lerpVectors",
  3296. value: function(e, t, n) {
  3297. return this.x = e.x + (t.x - e.x) * n,
  3298. this.y = e.y + (t.y - e.y) * n,
  3299. this.z = e.z + (t.z - e.z) * n,
  3300. this
  3301. }
  3302. }, {
  3303. key: "cross",
  3304. value: function(e, t) {
  3305. return void 0 !== t ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
  3306. this.crossVectors(e, t)) : this.crossVectors(this, e)
  3307. }
  3308. }, {
  3309. key: "crossVectors",
  3310. value: function(e, t) {
  3311. var n = e.x
  3312. , i = e.y
  3313. , r = e.z
  3314. , a = t.x
  3315. , e = t.y
  3316. , t = t.z;
  3317. return this.x = i * t - r * e,
  3318. this.y = r * a - n * t,
  3319. this.z = n * e - i * a,
  3320. this
  3321. }
  3322. }, {
  3323. key: "projectOnVector",
  3324. value: function(e) {
  3325. var t = e.lengthSq();
  3326. if (0 === t)
  3327. return this.set(0, 0, 0);
  3328. t = e.dot(this) / t;
  3329. return this.copy(e).multiplyScalar(t)
  3330. }
  3331. }, {
  3332. key: "projectOnPlane",
  3333. value: function(e) {
  3334. return Pn.copy(this).projectOnVector(e),
  3335. this.sub(Pn)
  3336. }
  3337. }, {
  3338. key: "reflect",
  3339. value: function(e) {
  3340. return this.sub(Pn.copy(e).multiplyScalar(2 * this.dot(e)))
  3341. }
  3342. }, {
  3343. key: "angleTo",
  3344. value: function(e) {
  3345. var t = Math.sqrt(this.lengthSq() * e.lengthSq());
  3346. if (0 === t)
  3347. return Math.PI / 2;
  3348. t = this.dot(e) / t;
  3349. return Math.acos(gn.clamp(t, -1, 1))
  3350. }
  3351. }, {
  3352. key: "distanceTo",
  3353. value: function(e) {
  3354. return Math.sqrt(this.distanceToSquared(e))
  3355. }
  3356. }, {
  3357. key: "distanceToSquared",
  3358. value: function(e) {
  3359. var t = this.x - e.x
  3360. , n = this.y - e.y
  3361. , e = this.z - e.z;
  3362. return t * t + n * n + e * e
  3363. }
  3364. }, {
  3365. key: "manhattanDistanceTo",
  3366. value: function(e) {
  3367. return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z)
  3368. }
  3369. }, {
  3370. key: "setFromSpherical",
  3371. value: function(e) {
  3372. return this.setFromSphericalCoords(e.radius, e.phi, e.theta)
  3373. }
  3374. }, {
  3375. key: "setFromSphericalCoords",
  3376. value: function(e, t, n) {
  3377. var i = Math.sin(t) * e;
  3378. return this.x = i * Math.sin(n),
  3379. this.y = Math.cos(t) * e,
  3380. this.z = i * Math.cos(n),
  3381. this
  3382. }
  3383. }, {
  3384. key: "setFromCylindrical",
  3385. value: function(e) {
  3386. return this.setFromCylindricalCoords(e.radius, e.theta, e.y)
  3387. }
  3388. }, {
  3389. key: "setFromCylindricalCoords",
  3390. value: function(e, t, n) {
  3391. return this.x = e * Math.sin(t),
  3392. this.y = n,
  3393. this.z = e * Math.cos(t),
  3394. this
  3395. }
  3396. }, {
  3397. key: "setFromMatrixPosition",
  3398. value: function(e) {
  3399. e = e.elements;
  3400. return this.x = e[12],
  3401. this.y = e[13],
  3402. this.z = e[14],
  3403. this
  3404. }
  3405. }, {
  3406. key: "setFromMatrixScale",
  3407. value: function(e) {
  3408. var t = this.setFromMatrixColumn(e, 0).length()
  3409. , n = this.setFromMatrixColumn(e, 1).length()
  3410. , e = this.setFromMatrixColumn(e, 2).length();
  3411. return this.x = t,
  3412. this.y = n,
  3413. this.z = e,
  3414. this
  3415. }
  3416. }, {
  3417. key: "setFromMatrixColumn",
  3418. value: function(e, t) {
  3419. return this.fromArray(e.elements, 4 * t)
  3420. }
  3421. }, {
  3422. key: "setFromMatrix3Column",
  3423. value: function(e, t) {
  3424. return this.fromArray(e.elements, 3 * t)
  3425. }
  3426. }, {
  3427. key: "equals",
  3428. value: function(e) {
  3429. return e.x === this.x && e.y === this.y && e.z === this.z
  3430. }
  3431. }, {
  3432. key: "fromArray",
  3433. value: function(e) {
  3434. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  3435. return this.x = e[t],
  3436. this.y = e[t + 1],
  3437. this.z = e[t + 2],
  3438. this
  3439. }
  3440. }, {
  3441. key: "toArray",
  3442. value: function() {
  3443. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  3444. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  3445. return e[t] = this.x,
  3446. e[t + 1] = this.y,
  3447. e[t + 2] = this.z,
  3448. e
  3449. }
  3450. }, {
  3451. key: "fromBufferAttribute",
  3452. value: function(e, t, n) {
  3453. return void 0 !== n && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),
  3454. this.x = e.getX(t),
  3455. this.y = e.getY(t),
  3456. this.z = e.getZ(t),
  3457. this
  3458. }
  3459. }, {
  3460. key: "random",
  3461. value: function() {
  3462. return this.x = Math.random(),
  3463. this.y = Math.random(),
  3464. this.z = Math.random(),
  3465. this
  3466. }
  3467. }]),
  3468. i
  3469. }()
  3470. , Pn = new Cn
  3471. , Dn = new Sn
  3472. , kn = function() {
  3473. function n(e, t) {
  3474. O(this, n),
  3475. Object.defineProperty(this, "isBox3", {
  3476. value: !0
  3477. }),
  3478. this.min = void 0 !== e ? e : new Cn(1 / 0,1 / 0,1 / 0),
  3479. this.max = void 0 !== t ? t : new Cn(-1 / 0,-1 / 0,-1 / 0)
  3480. }
  3481. return h(n, [{
  3482. key: "set",
  3483. value: function(e, t) {
  3484. return this.min.copy(e),
  3485. this.max.copy(t),
  3486. this
  3487. }
  3488. }, {
  3489. key: "setFromArray",
  3490. value: function(e) {
  3491. for (var t = 1 / 0, n = 1 / 0, i = 1 / 0, r = -1 / 0, a = -1 / 0, o = -1 / 0, s = 0, l = e.length; s < l; s += 3) {
  3492. var u = e[s]
  3493. , c = e[s + 1]
  3494. , d = e[s + 2];
  3495. u < t && (t = u),
  3496. c < n && (n = c),
  3497. d < i && (i = d),
  3498. r < u && (r = u),
  3499. a < c && (a = c),
  3500. o < d && (o = d)
  3501. }
  3502. return this.min.set(t, n, i),
  3503. this.max.set(r, a, o),
  3504. this
  3505. }
  3506. }, {
  3507. key: "setFromBufferAttribute",
  3508. value: function(e) {
  3509. for (var t = 1 / 0, n = 1 / 0, i = 1 / 0, r = -1 / 0, a = -1 / 0, o = -1 / 0, s = 0, l = e.count; s < l; s++) {
  3510. var u = e.getX(s)
  3511. , c = e.getY(s)
  3512. , d = e.getZ(s);
  3513. u < t && (t = u),
  3514. c < n && (n = c),
  3515. d < i && (i = d),
  3516. r < u && (r = u),
  3517. a < c && (a = c),
  3518. o < d && (o = d)
  3519. }
  3520. return this.min.set(t, n, i),
  3521. this.max.set(r, a, o),
  3522. this
  3523. }
  3524. }, {
  3525. key: "setFromPoints",
  3526. value: function(e) {
  3527. this.makeEmpty();
  3528. for (var t = 0, n = e.length; t < n; t++)
  3529. this.expandByPoint(e[t]);
  3530. return this
  3531. }
  3532. }, {
  3533. key: "setFromCenterAndSize",
  3534. value: function(e, t) {
  3535. t = Rn.copy(t).multiplyScalar(.5);
  3536. return this.min.copy(e).sub(t),
  3537. this.max.copy(e).add(t),
  3538. this
  3539. }
  3540. }, {
  3541. key: "setFromObject",
  3542. value: function(e) {
  3543. return this.makeEmpty(),
  3544. this.expandByObject(e)
  3545. }
  3546. }, {
  3547. key: "clone",
  3548. value: function() {
  3549. return (new this.constructor).copy(this)
  3550. }
  3551. }, {
  3552. key: "copy",
  3553. value: function(e) {
  3554. return this.min.copy(e.min),
  3555. this.max.copy(e.max),
  3556. this
  3557. }
  3558. }, {
  3559. key: "makeEmpty",
  3560. value: function() {
  3561. return this.min.x = this.min.y = this.min.z = 1 / 0,
  3562. this.max.x = this.max.y = this.max.z = -1 / 0,
  3563. this
  3564. }
  3565. }, {
  3566. key: "isEmpty",
  3567. value: function() {
  3568. return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z
  3569. }
  3570. }, {
  3571. key: "getCenter",
  3572. value: function(e) {
  3573. return void 0 === e && (console.warn("THREE.Box3: .getCenter() target is now required"),
  3574. e = new Cn),
  3575. this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5)
  3576. }
  3577. }, {
  3578. key: "getSize",
  3579. value: function(e) {
  3580. return void 0 === e && (console.warn("THREE.Box3: .getSize() target is now required"),
  3581. e = new Cn),
  3582. this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min)
  3583. }
  3584. }, {
  3585. key: "expandByPoint",
  3586. value: function(e) {
  3587. return this.min.min(e),
  3588. this.max.max(e),
  3589. this
  3590. }
  3591. }, {
  3592. key: "expandByVector",
  3593. value: function(e) {
  3594. return this.min.sub(e),
  3595. this.max.add(e),
  3596. this
  3597. }
  3598. }, {
  3599. key: "expandByScalar",
  3600. value: function(e) {
  3601. return this.min.addScalar(-e),
  3602. this.max.addScalar(e),
  3603. this
  3604. }
  3605. }, {
  3606. key: "expandByObject",
  3607. value: function(e) {
  3608. e.updateWorldMatrix(!1, !1);
  3609. var t = e.geometry;
  3610. void 0 !== t && (null === t.boundingBox && t.computeBoundingBox(),
  3611. Fn.copy(t.boundingBox),
  3612. Fn.applyMatrix4(e.matrixWorld),
  3613. this.union(Fn));
  3614. for (var n = e.children, i = 0, r = n.length; i < r; i++)
  3615. this.expandByObject(n[i]);
  3616. return this
  3617. }
  3618. }, {
  3619. key: "containsPoint",
  3620. value: function(e) {
  3621. return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z)
  3622. }
  3623. }, {
  3624. key: "containsBox",
  3625. value: function(e) {
  3626. return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z
  3627. }
  3628. }, {
  3629. key: "getParameter",
  3630. value: function(e, t) {
  3631. return void 0 === t && (console.warn("THREE.Box3: .getParameter() target is now required"),
  3632. t = new Cn),
  3633. t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z))
  3634. }
  3635. }, {
  3636. key: "intersectsBox",
  3637. value: function(e) {
  3638. return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z)
  3639. }
  3640. }, {
  3641. key: "intersectsSphere",
  3642. value: function(e) {
  3643. return this.clampPoint(e.center, Rn),
  3644. Rn.distanceToSquared(e.center) <= e.radius * e.radius
  3645. }
  3646. }, {
  3647. key: "intersectsPlane",
  3648. value: function(e) {
  3649. var t, n = 0 < e.normal.x ? (t = e.normal.x * this.min.x,
  3650. e.normal.x * this.max.x) : (t = e.normal.x * this.max.x,
  3651. e.normal.x * this.min.x);
  3652. return 0 < e.normal.y ? (t += e.normal.y * this.min.y,
  3653. n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y,
  3654. n += e.normal.y * this.min.y),
  3655. 0 < e.normal.z ? (t += e.normal.z * this.min.z,
  3656. n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z,
  3657. n += e.normal.z * this.min.z),
  3658. t <= -e.constant && n >= -e.constant
  3659. }
  3660. }, {
  3661. key: "intersectsTriangle",
  3662. value: function(e) {
  3663. return !this.isEmpty() && (this.getCenter(Hn),
  3664. Vn.subVectors(this.max, Hn),
  3665. In.subVectors(e.a, Hn),
  3666. On.subVectors(e.b, Hn),
  3667. zn.subVectors(e.c, Hn),
  3668. Nn.subVectors(On, In),
  3669. Un.subVectors(zn, On),
  3670. Gn.subVectors(In, zn),
  3671. !!Bn([0, -Nn.z, Nn.y, 0, -Un.z, Un.y, 0, -Gn.z, Gn.y, Nn.z, 0, -Nn.x, Un.z, 0, -Un.x, Gn.z, 0, -Gn.x, -Nn.y, Nn.x, 0, -Un.y, Un.x, 0, -Gn.y, Gn.x, 0], In, On, zn, Vn) && (!!Bn([1, 0, 0, 0, 1, 0, 0, 0, 1], In, On, zn, Vn) && (jn.crossVectors(Nn, Un),
  3672. Bn([jn.x, jn.y, jn.z], In, On, zn, Vn))))
  3673. }
  3674. }, {
  3675. key: "clampPoint",
  3676. value: function(e, t) {
  3677. return void 0 === t && (console.warn("THREE.Box3: .clampPoint() target is now required"),
  3678. t = new Cn),
  3679. t.copy(e).clamp(this.min, this.max)
  3680. }
  3681. }, {
  3682. key: "distanceToPoint",
  3683. value: function(e) {
  3684. return Rn.copy(e).clamp(this.min, this.max).sub(e).length()
  3685. }
  3686. }, {
  3687. key: "getBoundingSphere",
  3688. value: function(e) {
  3689. return void 0 === e && console.error("THREE.Box3: .getBoundingSphere() target is now required"),
  3690. this.getCenter(e.center),
  3691. e.radius = .5 * this.getSize(Rn).length(),
  3692. e
  3693. }
  3694. }, {
  3695. key: "intersect",
  3696. value: function(e) {
  3697. return this.min.max(e.min),
  3698. this.max.min(e.max),
  3699. this.isEmpty() && this.makeEmpty(),
  3700. this
  3701. }
  3702. }, {
  3703. key: "union",
  3704. value: function(e) {
  3705. return this.min.min(e.min),
  3706. this.max.max(e.max),
  3707. this
  3708. }
  3709. }, {
  3710. key: "applyMatrix4",
  3711. value: function(e) {
  3712. return this.isEmpty() || (Ln[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e),
  3713. Ln[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e),
  3714. Ln[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e),
  3715. Ln[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e),
  3716. Ln[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e),
  3717. Ln[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e),
  3718. Ln[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e),
  3719. Ln[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e),
  3720. this.setFromPoints(Ln)),
  3721. this
  3722. }
  3723. }, {
  3724. key: "translate",
  3725. value: function(e) {
  3726. return this.min.add(e),
  3727. this.max.add(e),
  3728. this
  3729. }
  3730. }, {
  3731. key: "equals",
  3732. value: function(e) {
  3733. return e.min.equals(this.min) && e.max.equals(this.max)
  3734. }
  3735. }]),
  3736. n
  3737. }();
  3738. function Bn(e, t, n, i, r) {
  3739. for (var a = 0, o = e.length - 3; a <= o; a += 3) {
  3740. Wn.fromArray(e, a);
  3741. var s = r.x * Math.abs(Wn.x) + r.y * Math.abs(Wn.y) + r.z * Math.abs(Wn.z)
  3742. , l = t.dot(Wn)
  3743. , u = n.dot(Wn)
  3744. , c = i.dot(Wn);
  3745. if (Math.max(-Math.max(l, u, c), Math.min(l, u, c)) > s)
  3746. return !1
  3747. }
  3748. return !0
  3749. }
  3750. var Ln = [new Cn, new Cn, new Cn, new Cn, new Cn, new Cn, new Cn, new Cn]
  3751. , Rn = new Cn
  3752. , Fn = new kn
  3753. , In = new Cn
  3754. , On = new Cn
  3755. , zn = new Cn
  3756. , Nn = new Cn
  3757. , Un = new Cn
  3758. , Gn = new Cn
  3759. , Hn = new Cn
  3760. , Vn = new Cn
  3761. , jn = new Cn
  3762. , Wn = new Cn
  3763. , Xn = new kn
  3764. , qn = function() {
  3765. function n(e, t) {
  3766. O(this, n),
  3767. this.center = void 0 !== e ? e : new Cn,
  3768. this.radius = void 0 !== t ? t : -1
  3769. }
  3770. return h(n, [{
  3771. key: "set",
  3772. value: function(e, t) {
  3773. return this.center.copy(e),
  3774. this.radius = t,
  3775. this
  3776. }
  3777. }, {
  3778. key: "setFromPoints",
  3779. value: function(e, t) {
  3780. var n = this.center;
  3781. void 0 !== t ? n.copy(t) : Xn.setFromPoints(e).getCenter(n);
  3782. for (var i = 0, r = 0, a = e.length; r < a; r++)
  3783. i = Math.max(i, n.distanceToSquared(e[r]));
  3784. return this.radius = Math.sqrt(i),
  3785. this
  3786. }
  3787. }, {
  3788. key: "clone",
  3789. value: function() {
  3790. return (new this.constructor).copy(this)
  3791. }
  3792. }, {
  3793. key: "copy",
  3794. value: function(e) {
  3795. return this.center.copy(e.center),
  3796. this.radius = e.radius,
  3797. this
  3798. }
  3799. }, {
  3800. key: "isEmpty",
  3801. value: function() {
  3802. return this.radius < 0
  3803. }
  3804. }, {
  3805. key: "makeEmpty",
  3806. value: function() {
  3807. return this.center.set(0, 0, 0),
  3808. this.radius = -1,
  3809. this
  3810. }
  3811. }, {
  3812. key: "containsPoint",
  3813. value: function(e) {
  3814. return e.distanceToSquared(this.center) <= this.radius * this.radius
  3815. }
  3816. }, {
  3817. key: "distanceToPoint",
  3818. value: function(e) {
  3819. return e.distanceTo(this.center) - this.radius
  3820. }
  3821. }, {
  3822. key: "intersectsSphere",
  3823. value: function(e) {
  3824. var t = this.radius + e.radius;
  3825. return e.center.distanceToSquared(this.center) <= t * t
  3826. }
  3827. }, {
  3828. key: "intersectsBox",
  3829. value: function(e) {
  3830. return e.intersectsSphere(this)
  3831. }
  3832. }, {
  3833. key: "intersectsPlane",
  3834. value: function(e) {
  3835. return Math.abs(e.distanceToPoint(this.center)) <= this.radius
  3836. }
  3837. }, {
  3838. key: "clampPoint",
  3839. value: function(e, t) {
  3840. var n = this.center.distanceToSquared(e);
  3841. return void 0 === t && (console.warn("THREE.Sphere: .clampPoint() target is now required"),
  3842. t = new Cn),
  3843. t.copy(e),
  3844. n > this.radius * this.radius && (t.sub(this.center).normalize(),
  3845. t.multiplyScalar(this.radius).add(this.center)),
  3846. t
  3847. }
  3848. }, {
  3849. key: "getBoundingBox",
  3850. value: function(e) {
  3851. return void 0 === e && (console.warn("THREE.Sphere: .getBoundingBox() target is now required"),
  3852. e = new kn),
  3853. this.isEmpty() ? e.makeEmpty() : (e.set(this.center, this.center),
  3854. e.expandByScalar(this.radius)),
  3855. e
  3856. }
  3857. }, {
  3858. key: "applyMatrix4",
  3859. value: function(e) {
  3860. return this.center.applyMatrix4(e),
  3861. this.radius = this.radius * e.getMaxScaleOnAxis(),
  3862. this
  3863. }
  3864. }, {
  3865. key: "translate",
  3866. value: function(e) {
  3867. return this.center.add(e),
  3868. this
  3869. }
  3870. }, {
  3871. key: "equals",
  3872. value: function(e) {
  3873. return e.center.equals(this.center) && e.radius === this.radius
  3874. }
  3875. }]),
  3876. n
  3877. }()
  3878. , Jn = new Cn
  3879. , Yn = new Cn
  3880. , Zn = new Cn
  3881. , Qn = new Cn
  3882. , Kn = new Cn
  3883. , $n = new Cn
  3884. , ei = new Cn
  3885. , ti = function() {
  3886. function n(e, t) {
  3887. O(this, n),
  3888. this.origin = void 0 !== e ? e : new Cn,
  3889. this.direction = void 0 !== t ? t : new Cn(0,0,-1)
  3890. }
  3891. return h(n, [{
  3892. key: "set",
  3893. value: function(e, t) {
  3894. return this.origin.copy(e),
  3895. this.direction.copy(t),
  3896. this
  3897. }
  3898. }, {
  3899. key: "clone",
  3900. value: function() {
  3901. return (new this.constructor).copy(this)
  3902. }
  3903. }, {
  3904. key: "copy",
  3905. value: function(e) {
  3906. return this.origin.copy(e.origin),
  3907. this.direction.copy(e.direction),
  3908. this
  3909. }
  3910. }, {
  3911. key: "at",
  3912. value: function(e, t) {
  3913. return void 0 === t && (console.warn("THREE.Ray: .at() target is now required"),
  3914. t = new Cn),
  3915. t.copy(this.direction).multiplyScalar(e).add(this.origin)
  3916. }
  3917. }, {
  3918. key: "lookAt",
  3919. value: function(e) {
  3920. return this.direction.copy(e).sub(this.origin).normalize(),
  3921. this
  3922. }
  3923. }, {
  3924. key: "recast",
  3925. value: function(e) {
  3926. return this.origin.copy(this.at(e, Jn)),
  3927. this
  3928. }
  3929. }, {
  3930. key: "closestPointToPoint",
  3931. value: function(e, t) {
  3932. void 0 === t && (console.warn("THREE.Ray: .closestPointToPoint() target is now required"),
  3933. t = new Cn),
  3934. t.subVectors(e, this.origin);
  3935. e = t.dot(this.direction);
  3936. return e < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(e).add(this.origin)
  3937. }
  3938. }, {
  3939. key: "distanceToPoint",
  3940. value: function(e) {
  3941. return Math.sqrt(this.distanceSqToPoint(e))
  3942. }
  3943. }, {
  3944. key: "distanceSqToPoint",
  3945. value: function(e) {
  3946. var t = Jn.subVectors(e, this.origin).dot(this.direction);
  3947. return t < 0 ? this.origin.distanceToSquared(e) : (Jn.copy(this.direction).multiplyScalar(t).add(this.origin),
  3948. Jn.distanceToSquared(e))
  3949. }
  3950. }, {
  3951. key: "distanceSqToSegment",
  3952. value: function(e, t, n, i) {
  3953. Yn.copy(e).add(t).multiplyScalar(.5),
  3954. Zn.copy(t).sub(e).normalize(),
  3955. Qn.copy(this.origin).sub(Yn);
  3956. var r, a, o = .5 * e.distanceTo(t), s = -this.direction.dot(Zn), l = Qn.dot(this.direction), u = -Qn.dot(Zn), c = Qn.lengthSq(), e = Math.abs(1 - s * s);
  3957. return c = 0 < e ? (a = s * l - u,
  3958. t = o * e,
  3959. 0 <= (r = s * u - l) ? -t <= a ? a <= t ? (r *= e = 1 / e) * (r + s * (a *= e) + 2 * l) + a * (s * r + a + 2 * u) + c : (a = o,
  3960. -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c) : (a = -o,
  3961. -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c) : a <= -t ? -(r = Math.max(0, -(-s * o + l))) * r + (a = 0 < r ? -o : Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c : a <= t ? (r = 0,
  3962. (a = Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c) : -(r = Math.max(0, -(s * o + l))) * r + (a = 0 < r ? o : Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c) : (a = 0 < s ? -o : o,
  3963. -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c),
  3964. n && n.copy(this.direction).multiplyScalar(r).add(this.origin),
  3965. i && i.copy(Zn).multiplyScalar(a).add(Yn),
  3966. c
  3967. }
  3968. }, {
  3969. key: "intersectSphere",
  3970. value: function(e, t) {
  3971. Jn.subVectors(e.center, this.origin);
  3972. var n = Jn.dot(this.direction)
  3973. , i = Jn.dot(Jn) - n * n
  3974. , e = e.radius * e.radius;
  3975. if (e < i)
  3976. return null;
  3977. e = Math.sqrt(e - i),
  3978. i = n - e,
  3979. e = n + e;
  3980. return i < 0 && e < 0 ? null : i < 0 ? this.at(e, t) : this.at(i, t)
  3981. }
  3982. }, {
  3983. key: "intersectsSphere",
  3984. value: function(e) {
  3985. return this.distanceSqToPoint(e.center) <= e.radius * e.radius
  3986. }
  3987. }, {
  3988. key: "distanceToPlane",
  3989. value: function(e) {
  3990. var t = e.normal.dot(this.direction);
  3991. if (0 === t)
  3992. return 0 === e.distanceToPoint(this.origin) ? 0 : null;
  3993. t = -(this.origin.dot(e.normal) + e.constant) / t;
  3994. return 0 <= t ? t : null
  3995. }
  3996. }, {
  3997. key: "intersectPlane",
  3998. value: function(e, t) {
  3999. e = this.distanceToPlane(e);
  4000. return null === e ? null : this.at(e, t)
  4001. }
  4002. }, {
  4003. key: "intersectsPlane",
  4004. value: function(e) {
  4005. var t = e.distanceToPoint(this.origin);
  4006. return 0 === t || e.normal.dot(this.direction) * t < 0
  4007. }
  4008. }, {
  4009. key: "intersectBox",
  4010. value: function(e, t) {
  4011. var n, i, r, a = 1 / this.direction.x, o = 1 / this.direction.y, s = 1 / this.direction.z, l = this.origin, a = 0 <= a ? (n = (e.min.x - l.x) * a,
  4012. (e.max.x - l.x) * a) : (n = (e.max.x - l.x) * a,
  4013. (e.min.x - l.x) * a), o = 0 <= o ? (i = (e.min.y - l.y) * o,
  4014. (e.max.y - l.y) * o) : (i = (e.max.y - l.y) * o,
  4015. (e.min.y - l.y) * o);
  4016. return o < n || a < i ? null : ((n < i || n != n) && (n = i),
  4017. (o < a || a != a) && (a = o),
  4018. (s = 0 <= s ? (r = (e.min.z - l.z) * s,
  4019. (e.max.z - l.z) * s) : (r = (e.max.z - l.z) * s,
  4020. (e.min.z - l.z) * s)) < n || a < r ? null : ((n < r || n != n) && (n = r),
  4021. (a = s < a || a != a ? s : a) < 0 ? null : this.at(0 <= n ? n : a, t)))
  4022. }
  4023. }, {
  4024. key: "intersectsBox",
  4025. value: function(e) {
  4026. return null !== this.intersectBox(e, Jn)
  4027. }
  4028. }, {
  4029. key: "intersectTriangle",
  4030. value: function(e, t, n, i, r) {
  4031. Kn.subVectors(t, e),
  4032. $n.subVectors(n, e),
  4033. ei.crossVectors(Kn, $n);
  4034. n = this.direction.dot(ei);
  4035. if (0 < n) {
  4036. if (i)
  4037. return null;
  4038. a = 1
  4039. } else {
  4040. if (!(n < 0))
  4041. return null;
  4042. a = -1,
  4043. n = -n
  4044. }
  4045. Qn.subVectors(this.origin, e);
  4046. i = a * this.direction.dot($n.crossVectors(Qn, $n));
  4047. if (i < 0)
  4048. return null;
  4049. e = a * this.direction.dot(Kn.cross(Qn));
  4050. if (e < 0)
  4051. return null;
  4052. if (n < i + e)
  4053. return null;
  4054. var a = -a * Qn.dot(ei);
  4055. return a < 0 ? null : this.at(a / n, r)
  4056. }
  4057. }, {
  4058. key: "applyMatrix4",
  4059. value: function(e) {
  4060. return this.origin.applyMatrix4(e),
  4061. this.direction.transformDirection(e),
  4062. this
  4063. }
  4064. }, {
  4065. key: "equals",
  4066. value: function(e) {
  4067. return e.origin.equals(this.origin) && e.direction.equals(this.direction)
  4068. }
  4069. }]),
  4070. n
  4071. }()
  4072. , ni = function() {
  4073. function e() {
  4074. O(this, e),
  4075. Object.defineProperty(this, "isMatrix4", {
  4076. value: !0
  4077. }),
  4078. this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
  4079. 0 < arguments.length && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")
  4080. }
  4081. return h(e, [{
  4082. key: "set",
  4083. value: function(e, t, n, i, r, a, o, s, l, u, c, d, h, p, f, m) {
  4084. var v = this.elements;
  4085. return v[0] = e,
  4086. v[4] = t,
  4087. v[8] = n,
  4088. v[12] = i,
  4089. v[1] = r,
  4090. v[5] = a,
  4091. v[9] = o,
  4092. v[13] = s,
  4093. v[2] = l,
  4094. v[6] = u,
  4095. v[10] = c,
  4096. v[14] = d,
  4097. v[3] = h,
  4098. v[7] = p,
  4099. v[11] = f,
  4100. v[15] = m,
  4101. this
  4102. }
  4103. }, {
  4104. key: "identity",
  4105. value: function() {
  4106. return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
  4107. this
  4108. }
  4109. }, {
  4110. key: "clone",
  4111. value: function() {
  4112. return (new e).fromArray(this.elements)
  4113. }
  4114. }, {
  4115. key: "copy",
  4116. value: function(e) {
  4117. var t = this.elements
  4118. , e = e.elements;
  4119. return t[0] = e[0],
  4120. t[1] = e[1],
  4121. t[2] = e[2],
  4122. t[3] = e[3],
  4123. t[4] = e[4],
  4124. t[5] = e[5],
  4125. t[6] = e[6],
  4126. t[7] = e[7],
  4127. t[8] = e[8],
  4128. t[9] = e[9],
  4129. t[10] = e[10],
  4130. t[11] = e[11],
  4131. t[12] = e[12],
  4132. t[13] = e[13],
  4133. t[14] = e[14],
  4134. t[15] = e[15],
  4135. this
  4136. }
  4137. }, {
  4138. key: "copyPosition",
  4139. value: function(e) {
  4140. var t = this.elements
  4141. , e = e.elements;
  4142. return t[12] = e[12],
  4143. t[13] = e[13],
  4144. t[14] = e[14],
  4145. this
  4146. }
  4147. }, {
  4148. key: "extractBasis",
  4149. value: function(e, t, n) {
  4150. return e.setFromMatrixColumn(this, 0),
  4151. t.setFromMatrixColumn(this, 1),
  4152. n.setFromMatrixColumn(this, 2),
  4153. this
  4154. }
  4155. }, {
  4156. key: "makeBasis",
  4157. value: function(e, t, n) {
  4158. return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1),
  4159. this
  4160. }
  4161. }, {
  4162. key: "extractRotation",
  4163. value: function(e) {
  4164. var t = this.elements
  4165. , n = e.elements
  4166. , i = 1 / ii.setFromMatrixColumn(e, 0).length()
  4167. , r = 1 / ii.setFromMatrixColumn(e, 1).length()
  4168. , e = 1 / ii.setFromMatrixColumn(e, 2).length();
  4169. return t[0] = n[0] * i,
  4170. t[1] = n[1] * i,
  4171. t[2] = n[2] * i,
  4172. t[3] = 0,
  4173. t[4] = n[4] * r,
  4174. t[5] = n[5] * r,
  4175. t[6] = n[6] * r,
  4176. t[7] = 0,
  4177. t[8] = n[8] * e,
  4178. t[9] = n[9] * e,
  4179. t[10] = n[10] * e,
  4180. t[11] = 0,
  4181. t[12] = 0,
  4182. t[13] = 0,
  4183. t[14] = 0,
  4184. t[15] = 1,
  4185. this
  4186. }
  4187. }, {
  4188. key: "makeRotationFromEuler",
  4189. value: function(e) {
  4190. e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");
  4191. var t, n, i, r, a, o, s, l, u, c, d, h = this.elements, p = e.x, f = e.y, m = e.z, v = Math.cos(p), g = Math.sin(p), y = Math.cos(f), w = Math.sin(f), p = Math.cos(m), f = Math.sin(m);
  4192. return "XYZ" === e.order ? (t = v * p,
  4193. i = v * f,
  4194. n = g * p,
  4195. m = g * f,
  4196. h[0] = y * p,
  4197. h[4] = -y * f,
  4198. h[8] = w,
  4199. h[1] = i + n * w,
  4200. h[5] = t - m * w,
  4201. h[9] = -g * y,
  4202. h[2] = m - t * w,
  4203. h[6] = n + i * w,
  4204. h[10] = v * y) : "YXZ" === e.order ? (t = y * f,
  4205. n = w * p,
  4206. h[0] = (r = y * p) + (i = w * f) * g,
  4207. h[4] = n * g - t,
  4208. h[8] = v * w,
  4209. h[1] = v * f,
  4210. h[5] = v * p,
  4211. h[9] = -g,
  4212. h[2] = t * g - n,
  4213. h[6] = i + r * g,
  4214. h[10] = v * y) : "ZXY" === e.order ? (r = y * f,
  4215. a = w * p,
  4216. h[0] = (s = y * p) - (o = w * f) * g,
  4217. h[4] = -v * f,
  4218. h[8] = a + r * g,
  4219. h[1] = r + a * g,
  4220. h[5] = v * p,
  4221. h[9] = o - s * g,
  4222. h[2] = -v * w,
  4223. h[6] = g,
  4224. h[10] = v * y) : "ZYX" === e.order ? (a = v * p,
  4225. o = v * f,
  4226. l = g * p,
  4227. s = g * f,
  4228. h[0] = y * p,
  4229. h[4] = l * w - o,
  4230. h[8] = a * w + s,
  4231. h[1] = y * f,
  4232. h[5] = s * w + a,
  4233. h[9] = o * w - l,
  4234. h[2] = -w,
  4235. h[6] = g * y,
  4236. h[10] = v * y) : "YZX" === e.order ? (c = v * y,
  4237. l = v * w,
  4238. u = g * y,
  4239. d = g * w,
  4240. h[0] = y * p,
  4241. h[4] = d - c * f,
  4242. h[8] = u * f + l,
  4243. h[1] = f,
  4244. h[5] = v * p,
  4245. h[9] = -g * p,
  4246. h[2] = -w * p,
  4247. h[6] = l * f + u,
  4248. h[10] = c - d * f) : "XZY" === e.order && (u = v * y,
  4249. c = v * w,
  4250. d = g * y,
  4251. e = g * w,
  4252. h[0] = y * p,
  4253. h[4] = -f,
  4254. h[8] = w * p,
  4255. h[1] = u * f + e,
  4256. h[5] = v * p,
  4257. h[9] = c * f - d,
  4258. h[2] = d * f - c,
  4259. h[6] = g * p,
  4260. h[10] = e * f + u),
  4261. h[3] = 0,
  4262. h[7] = 0,
  4263. h[11] = 0,
  4264. h[12] = 0,
  4265. h[13] = 0,
  4266. h[14] = 0,
  4267. h[15] = 1,
  4268. this
  4269. }
  4270. }, {
  4271. key: "makeRotationFromQuaternion",
  4272. value: function(e) {
  4273. return this.compose(ai, e, oi)
  4274. }
  4275. }, {
  4276. key: "lookAt",
  4277. value: function(e, t, n) {
  4278. var i = this.elements;
  4279. return ui.subVectors(e, t),
  4280. 0 === ui.lengthSq() && (ui.z = 1),
  4281. ui.normalize(),
  4282. si.crossVectors(n, ui),
  4283. 0 === si.lengthSq() && (1 === Math.abs(n.z) ? ui.x += 1e-4 : ui.z += 1e-4,
  4284. ui.normalize(),
  4285. si.crossVectors(n, ui)),
  4286. si.normalize(),
  4287. li.crossVectors(ui, si),
  4288. i[0] = si.x,
  4289. i[4] = li.x,
  4290. i[8] = ui.x,
  4291. i[1] = si.y,
  4292. i[5] = li.y,
  4293. i[9] = ui.y,
  4294. i[2] = si.z,
  4295. i[6] = li.z,
  4296. i[10] = ui.z,
  4297. this
  4298. }
  4299. }, {
  4300. key: "multiply",
  4301. value: function(e, t) {
  4302. return void 0 !== t ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),
  4303. this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e)
  4304. }
  4305. }, {
  4306. key: "premultiply",
  4307. value: function(e) {
  4308. return this.multiplyMatrices(e, this)
  4309. }
  4310. }, {
  4311. key: "multiplyMatrices",
  4312. value: function(e, t) {
  4313. var n = e.elements
  4314. , i = t.elements
  4315. , r = this.elements
  4316. , a = n[0]
  4317. , o = n[4]
  4318. , s = n[8]
  4319. , l = n[12]
  4320. , u = n[1]
  4321. , c = n[5]
  4322. , d = n[9]
  4323. , h = n[13]
  4324. , p = n[2]
  4325. , f = n[6]
  4326. , m = n[10]
  4327. , v = n[14]
  4328. , g = n[3]
  4329. , y = n[7]
  4330. , w = n[11]
  4331. , b = n[15]
  4332. , x = i[0]
  4333. , E = i[4]
  4334. , _ = i[8]
  4335. , M = i[12]
  4336. , A = i[1]
  4337. , T = i[5]
  4338. , S = i[9]
  4339. , C = i[13]
  4340. , P = i[2]
  4341. , D = i[6]
  4342. , k = i[10]
  4343. , B = i[14]
  4344. , e = i[3]
  4345. , t = i[7]
  4346. , n = i[11]
  4347. , i = i[15];
  4348. return r[0] = a * x + o * A + s * P + l * e,
  4349. r[4] = a * E + o * T + s * D + l * t,
  4350. r[8] = a * _ + o * S + s * k + l * n,
  4351. r[12] = a * M + o * C + s * B + l * i,
  4352. r[1] = u * x + c * A + d * P + h * e,
  4353. r[5] = u * E + c * T + d * D + h * t,
  4354. r[9] = u * _ + c * S + d * k + h * n,
  4355. r[13] = u * M + c * C + d * B + h * i,
  4356. r[2] = p * x + f * A + m * P + v * e,
  4357. r[6] = p * E + f * T + m * D + v * t,
  4358. r[10] = p * _ + f * S + m * k + v * n,
  4359. r[14] = p * M + f * C + m * B + v * i,
  4360. r[3] = g * x + y * A + w * P + b * e,
  4361. r[7] = g * E + y * T + w * D + b * t,
  4362. r[11] = g * _ + y * S + w * k + b * n,
  4363. r[15] = g * M + y * C + w * B + b * i,
  4364. this
  4365. }
  4366. }, {
  4367. key: "multiplyScalar",
  4368. value: function(e) {
  4369. var t = this.elements;
  4370. return t[0] *= e,
  4371. t[4] *= e,
  4372. t[8] *= e,
  4373. t[12] *= e,
  4374. t[1] *= e,
  4375. t[5] *= e,
  4376. t[9] *= e,
  4377. t[13] *= e,
  4378. t[2] *= e,
  4379. t[6] *= e,
  4380. t[10] *= e,
  4381. t[14] *= e,
  4382. t[3] *= e,
  4383. t[7] *= e,
  4384. t[11] *= e,
  4385. t[15] *= e,
  4386. this
  4387. }
  4388. }, {
  4389. key: "determinant",
  4390. value: function() {
  4391. var e = this.elements
  4392. , t = e[0]
  4393. , n = e[4]
  4394. , i = e[8]
  4395. , r = e[12]
  4396. , a = e[1]
  4397. , o = e[5]
  4398. , s = e[9]
  4399. , l = e[13]
  4400. , u = e[2]
  4401. , c = e[6]
  4402. , d = e[10]
  4403. , h = e[14];
  4404. return e[3] * (+r * s * c - i * l * c - r * o * d + n * l * d + i * o * h - n * s * h) + e[7] * (+t * s * h - t * l * d + r * a * d - i * a * h + i * l * u - r * s * u) + e[11] * (+t * l * c - t * o * h - r * a * c + n * a * h + r * o * u - n * l * u) + e[15] * (-i * o * u - t * s * c + t * o * d + i * a * c - n * a * d + n * s * u)
  4405. }
  4406. }, {
  4407. key: "transpose",
  4408. value: function() {
  4409. var e = this.elements
  4410. , t = e[1];
  4411. return e[1] = e[4],
  4412. e[4] = t,
  4413. t = e[2],
  4414. e[2] = e[8],
  4415. e[8] = t,
  4416. t = e[6],
  4417. e[6] = e[9],
  4418. e[9] = t,
  4419. t = e[3],
  4420. e[3] = e[12],
  4421. e[12] = t,
  4422. t = e[7],
  4423. e[7] = e[13],
  4424. e[13] = t,
  4425. t = e[11],
  4426. e[11] = e[14],
  4427. e[14] = t,
  4428. this
  4429. }
  4430. }, {
  4431. key: "setPosition",
  4432. value: function(e, t, n) {
  4433. var i = this.elements;
  4434. return e.isVector3 ? (i[12] = e.x,
  4435. i[13] = e.y,
  4436. i[14] = e.z) : (i[12] = e,
  4437. i[13] = t,
  4438. i[14] = n),
  4439. this
  4440. }
  4441. }, {
  4442. key: "invert",
  4443. value: function() {
  4444. var e = this.elements
  4445. , t = e[0]
  4446. , n = e[1]
  4447. , i = e[2]
  4448. , r = e[3]
  4449. , a = e[4]
  4450. , o = e[5]
  4451. , s = e[6]
  4452. , l = e[7]
  4453. , u = e[8]
  4454. , c = e[9]
  4455. , d = e[10]
  4456. , h = e[11]
  4457. , p = e[12]
  4458. , f = e[13]
  4459. , m = e[14]
  4460. , v = e[15]
  4461. , g = c * m * l - f * d * l + f * s * h - o * m * h - c * s * v + o * d * v
  4462. , y = p * d * l - u * m * l - p * s * h + a * m * h + u * s * v - a * d * v
  4463. , w = u * f * l - p * c * l + p * o * h - a * f * h - u * o * v + a * c * v
  4464. , b = p * c * s - u * f * s - p * o * d + a * f * d + u * o * m - a * c * m
  4465. , x = t * g + n * y + i * w + r * b;
  4466. if (0 == x)
  4467. return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  4468. x = 1 / x;
  4469. return e[0] = g * x,
  4470. e[1] = (f * d * r - c * m * r - f * i * h + n * m * h + c * i * v - n * d * v) * x,
  4471. e[2] = (o * m * r - f * s * r + f * i * l - n * m * l - o * i * v + n * s * v) * x,
  4472. e[3] = (c * s * r - o * d * r - c * i * l + n * d * l + o * i * h - n * s * h) * x,
  4473. e[4] = y * x,
  4474. e[5] = (u * m * r - p * d * r + p * i * h - t * m * h - u * i * v + t * d * v) * x,
  4475. e[6] = (p * s * r - a * m * r - p * i * l + t * m * l + a * i * v - t * s * v) * x,
  4476. e[7] = (a * d * r - u * s * r + u * i * l - t * d * l - a * i * h + t * s * h) * x,
  4477. e[8] = w * x,
  4478. e[9] = (p * c * r - u * f * r - p * n * h + t * f * h + u * n * v - t * c * v) * x,
  4479. e[10] = (a * f * r - p * o * r + p * n * l - t * f * l - a * n * v + t * o * v) * x,
  4480. e[11] = (u * o * r - a * c * r - u * n * l + t * c * l + a * n * h - t * o * h) * x,
  4481. e[12] = b * x,
  4482. e[13] = (u * f * i - p * c * i + p * n * d - t * f * d - u * n * m + t * c * m) * x,
  4483. e[14] = (p * o * i - a * f * i - p * n * s + t * f * s + a * n * m - t * o * m) * x,
  4484. e[15] = (a * c * i - u * o * i + u * n * s - t * c * s - a * n * d + t * o * d) * x,
  4485. this
  4486. }
  4487. }, {
  4488. key: "scale",
  4489. value: function(e) {
  4490. var t = this.elements
  4491. , n = e.x
  4492. , i = e.y
  4493. , e = e.z;
  4494. return t[0] *= n,
  4495. t[4] *= i,
  4496. t[8] *= e,
  4497. t[1] *= n,
  4498. t[5] *= i,
  4499. t[9] *= e,
  4500. t[2] *= n,
  4501. t[6] *= i,
  4502. t[10] *= e,
  4503. t[3] *= n,
  4504. t[7] *= i,
  4505. t[11] *= e,
  4506. this
  4507. }
  4508. }, {
  4509. key: "getMaxScaleOnAxis",
  4510. value: function() {
  4511. var e = this.elements
  4512. , t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2]
  4513. , n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6]
  4514. , e = e[8] * e[8] + e[9] * e[9] + e[10] * e[10];
  4515. return Math.sqrt(Math.max(t, n, e))
  4516. }
  4517. }, {
  4518. key: "makeTranslation",
  4519. value: function(e, t, n) {
  4520. return this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1),
  4521. this
  4522. }
  4523. }, {
  4524. key: "makeRotationX",
  4525. value: function(e) {
  4526. var t = Math.cos(e)
  4527. , e = Math.sin(e);
  4528. return this.set(1, 0, 0, 0, 0, t, -e, 0, 0, e, t, 0, 0, 0, 0, 1),
  4529. this
  4530. }
  4531. }, {
  4532. key: "makeRotationY",
  4533. value: function(e) {
  4534. var t = Math.cos(e)
  4535. , e = Math.sin(e);
  4536. return this.set(t, 0, e, 0, 0, 1, 0, 0, -e, 0, t, 0, 0, 0, 0, 1),
  4537. this
  4538. }
  4539. }, {
  4540. key: "makeRotationZ",
  4541. value: function(e) {
  4542. var t = Math.cos(e)
  4543. , e = Math.sin(e);
  4544. return this.set(t, -e, 0, 0, e, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
  4545. this
  4546. }
  4547. }, {
  4548. key: "makeRotationAxis",
  4549. value: function(e, t) {
  4550. var n = Math.cos(t)
  4551. , i = Math.sin(t)
  4552. , r = 1 - n
  4553. , a = e.x
  4554. , o = e.y
  4555. , s = e.z
  4556. , t = r * a
  4557. , e = r * o;
  4558. return this.set(t * a + n, t * o - i * s, t * s + i * o, 0, t * o + i * s, e * o + n, e * s - i * a, 0, t * s - i * o, e * s + i * a, r * s * s + n, 0, 0, 0, 0, 1),
  4559. this
  4560. }
  4561. }, {
  4562. key: "makeScale",
  4563. value: function(e, t, n) {
  4564. return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1),
  4565. this
  4566. }
  4567. }, {
  4568. key: "makeShear",
  4569. value: function(e, t, n) {
  4570. return this.set(1, t, n, 0, e, 1, n, 0, e, t, 1, 0, 0, 0, 0, 1),
  4571. this
  4572. }
  4573. }, {
  4574. key: "compose",
  4575. value: function(e, t, n) {
  4576. var i = this.elements
  4577. , r = t._x
  4578. , a = t._y
  4579. , o = t._z
  4580. , s = t._w
  4581. , l = r + r
  4582. , u = a + a
  4583. , c = o + o
  4584. , d = r * l
  4585. , h = r * u
  4586. , p = r * c
  4587. , t = a * u
  4588. , r = a * c
  4589. , a = o * c
  4590. , o = s * l
  4591. , l = s * u
  4592. , u = s * c
  4593. , s = n.x
  4594. , c = n.y
  4595. , n = n.z;
  4596. return i[0] = (1 - (t + a)) * s,
  4597. i[1] = (h + u) * s,
  4598. i[2] = (p - l) * s,
  4599. i[3] = 0,
  4600. i[4] = (h - u) * c,
  4601. i[5] = (1 - (d + a)) * c,
  4602. i[6] = (r + o) * c,
  4603. i[7] = 0,
  4604. i[8] = (p + l) * n,
  4605. i[9] = (r - o) * n,
  4606. i[10] = (1 - (d + t)) * n,
  4607. i[11] = 0,
  4608. i[12] = e.x,
  4609. i[13] = e.y,
  4610. i[14] = e.z,
  4611. i[15] = 1,
  4612. this
  4613. }
  4614. }, {
  4615. key: "decompose",
  4616. value: function(e, t, n) {
  4617. var i = this.elements
  4618. , r = ii.set(i[0], i[1], i[2]).length()
  4619. , a = ii.set(i[4], i[5], i[6]).length()
  4620. , o = ii.set(i[8], i[9], i[10]).length();
  4621. this.determinant() < 0 && (r = -r),
  4622. e.x = i[12],
  4623. e.y = i[13],
  4624. e.z = i[14],
  4625. ri.copy(this);
  4626. var s = 1 / r
  4627. , e = 1 / a
  4628. , i = 1 / o;
  4629. return ri.elements[0] *= s,
  4630. ri.elements[1] *= s,
  4631. ri.elements[2] *= s,
  4632. ri.elements[4] *= e,
  4633. ri.elements[5] *= e,
  4634. ri.elements[6] *= e,
  4635. ri.elements[8] *= i,
  4636. ri.elements[9] *= i,
  4637. ri.elements[10] *= i,
  4638. t.setFromRotationMatrix(ri),
  4639. n.x = r,
  4640. n.y = a,
  4641. n.z = o,
  4642. this
  4643. }
  4644. }, {
  4645. key: "makePerspective",
  4646. value: function(e, t, n, i, r, a) {
  4647. void 0 === a && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");
  4648. var o = this.elements
  4649. , s = 2 * r / (n - i)
  4650. , l = (t + e) / (t - e)
  4651. , n = (n + i) / (n - i)
  4652. , i = -(a + r) / (a - r)
  4653. , a = -2 * a * r / (a - r);
  4654. return o[0] = 2 * r / (t - e),
  4655. o[4] = 0,
  4656. o[8] = l,
  4657. o[12] = 0,
  4658. o[1] = 0,
  4659. o[5] = s,
  4660. o[9] = n,
  4661. o[13] = 0,
  4662. o[2] = 0,
  4663. o[6] = 0,
  4664. o[10] = i,
  4665. o[14] = a,
  4666. o[3] = 0,
  4667. o[7] = 0,
  4668. o[11] = -1,
  4669. o[15] = 0,
  4670. this
  4671. }
  4672. }, {
  4673. key: "makeOrthographic",
  4674. value: function(e, t, n, i, r, a) {
  4675. var o = this.elements
  4676. , s = 1 / (t - e)
  4677. , l = 1 / (n - i)
  4678. , u = 1 / (a - r)
  4679. , e = (t + e) * s
  4680. , i = (n + i) * l
  4681. , r = (a + r) * u;
  4682. return o[0] = 2 * s,
  4683. o[4] = 0,
  4684. o[8] = 0,
  4685. o[12] = -e,
  4686. o[1] = 0,
  4687. o[5] = 2 * l,
  4688. o[9] = 0,
  4689. o[13] = -i,
  4690. o[2] = 0,
  4691. o[6] = 0,
  4692. o[10] = -2 * u,
  4693. o[14] = -r,
  4694. o[3] = 0,
  4695. o[7] = 0,
  4696. o[11] = 0,
  4697. o[15] = 1,
  4698. this
  4699. }
  4700. }, {
  4701. key: "equals",
  4702. value: function(e) {
  4703. for (var t = this.elements, n = e.elements, i = 0; i < 16; i++)
  4704. if (t[i] !== n[i])
  4705. return !1;
  4706. return !0
  4707. }
  4708. }, {
  4709. key: "fromArray",
  4710. value: function(e) {
  4711. for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = 0; n < 16; n++)
  4712. this.elements[n] = e[n + t];
  4713. return this
  4714. }
  4715. }, {
  4716. key: "toArray",
  4717. value: function() {
  4718. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  4719. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  4720. , n = this.elements;
  4721. return e[t] = n[0],
  4722. e[t + 1] = n[1],
  4723. e[t + 2] = n[2],
  4724. e[t + 3] = n[3],
  4725. e[t + 4] = n[4],
  4726. e[t + 5] = n[5],
  4727. e[t + 6] = n[6],
  4728. e[t + 7] = n[7],
  4729. e[t + 8] = n[8],
  4730. e[t + 9] = n[9],
  4731. e[t + 10] = n[10],
  4732. e[t + 11] = n[11],
  4733. e[t + 12] = n[12],
  4734. e[t + 13] = n[13],
  4735. e[t + 14] = n[14],
  4736. e[t + 15] = n[15],
  4737. e
  4738. }
  4739. }]),
  4740. e
  4741. }()
  4742. , ii = new Cn
  4743. , ri = new ni
  4744. , ai = new Cn(0,0,0)
  4745. , oi = new Cn(1,1,1)
  4746. , si = new Cn
  4747. , li = new Cn
  4748. , ui = new Cn
  4749. , ci = function() {
  4750. function r() {
  4751. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
  4752. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  4753. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  4754. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : r.DefaultOrder;
  4755. O(this, r),
  4756. Object.defineProperty(this, "isEuler", {
  4757. value: !0
  4758. }),
  4759. this._x = e,
  4760. this._y = t,
  4761. this._z = n,
  4762. this._order = i
  4763. }
  4764. return h(r, [{
  4765. key: "x",
  4766. get: function() {
  4767. return this._x
  4768. },
  4769. set: function(e) {
  4770. this._x = e,
  4771. this._onChangeCallback()
  4772. }
  4773. }, {
  4774. key: "y",
  4775. get: function() {
  4776. return this._y
  4777. },
  4778. set: function(e) {
  4779. this._y = e,
  4780. this._onChangeCallback()
  4781. }
  4782. }, {
  4783. key: "z",
  4784. get: function() {
  4785. return this._z
  4786. },
  4787. set: function(e) {
  4788. this._z = e,
  4789. this._onChangeCallback()
  4790. }
  4791. }, {
  4792. key: "order",
  4793. get: function() {
  4794. return this._order
  4795. },
  4796. set: function(e) {
  4797. this._order = e,
  4798. this._onChangeCallback()
  4799. }
  4800. }, {
  4801. key: "set",
  4802. value: function(e, t, n, i) {
  4803. return this._x = e,
  4804. this._y = t,
  4805. this._z = n,
  4806. this._order = i || this._order,
  4807. this._onChangeCallback(),
  4808. this
  4809. }
  4810. }, {
  4811. key: "clone",
  4812. value: function() {
  4813. return new this.constructor(this._x,this._y,this._z,this._order)
  4814. }
  4815. }, {
  4816. key: "copy",
  4817. value: function(e) {
  4818. return this._x = e._x,
  4819. this._y = e._y,
  4820. this._z = e._z,
  4821. this._order = e._order,
  4822. this._onChangeCallback(),
  4823. this
  4824. }
  4825. }, {
  4826. key: "setFromRotationMatrix",
  4827. value: function(e, t, n) {
  4828. var i = gn.clamp
  4829. , e = e.elements
  4830. , r = e[0]
  4831. , a = e[4]
  4832. , o = e[8]
  4833. , s = e[1]
  4834. , l = e[5]
  4835. , u = e[9]
  4836. , c = e[2]
  4837. , d = e[6]
  4838. , h = e[10];
  4839. switch (t = t || this._order) {
  4840. case "XYZ":
  4841. this._y = Math.asin(i(o, -1, 1)),
  4842. Math.abs(o) < .9999999 ? (this._x = Math.atan2(-u, h),
  4843. this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(d, l),
  4844. this._z = 0);
  4845. break;
  4846. case "YXZ":
  4847. this._x = Math.asin(-i(u, -1, 1)),
  4848. Math.abs(u) < .9999999 ? (this._y = Math.atan2(o, h),
  4849. this._z = Math.atan2(s, l)) : (this._y = Math.atan2(-c, r),
  4850. this._z = 0);
  4851. break;
  4852. case "ZXY":
  4853. this._x = Math.asin(i(d, -1, 1)),
  4854. Math.abs(d) < .9999999 ? (this._y = Math.atan2(-c, h),
  4855. this._z = Math.atan2(-a, l)) : (this._y = 0,
  4856. this._z = Math.atan2(s, r));
  4857. break;
  4858. case "ZYX":
  4859. this._y = Math.asin(-i(c, -1, 1)),
  4860. Math.abs(c) < .9999999 ? (this._x = Math.atan2(d, h),
  4861. this._z = Math.atan2(s, r)) : (this._x = 0,
  4862. this._z = Math.atan2(-a, l));
  4863. break;
  4864. case "YZX":
  4865. this._z = Math.asin(i(s, -1, 1)),
  4866. Math.abs(s) < .9999999 ? (this._x = Math.atan2(-u, l),
  4867. this._y = Math.atan2(-c, r)) : (this._x = 0,
  4868. this._y = Math.atan2(o, h));
  4869. break;
  4870. case "XZY":
  4871. this._z = Math.asin(-i(a, -1, 1)),
  4872. Math.abs(a) < .9999999 ? (this._x = Math.atan2(d, l),
  4873. this._y = Math.atan2(o, r)) : (this._x = Math.atan2(-u, h),
  4874. this._y = 0);
  4875. break;
  4876. default:
  4877. console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t)
  4878. }
  4879. return this._order = t,
  4880. !1 !== n && this._onChangeCallback(),
  4881. this
  4882. }
  4883. }, {
  4884. key: "setFromQuaternion",
  4885. value: function(e, t, n) {
  4886. return di.makeRotationFromQuaternion(e),
  4887. this.setFromRotationMatrix(di, t, n)
  4888. }
  4889. }, {
  4890. key: "setFromVector3",
  4891. value: function(e, t) {
  4892. return this.set(e.x, e.y, e.z, t || this._order)
  4893. }
  4894. }, {
  4895. key: "reorder",
  4896. value: function(e) {
  4897. return hi.setFromEuler(this),
  4898. this.setFromQuaternion(hi, e)
  4899. }
  4900. }, {
  4901. key: "equals",
  4902. value: function(e) {
  4903. return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order
  4904. }
  4905. }, {
  4906. key: "fromArray",
  4907. value: function(e) {
  4908. return this._x = e[0],
  4909. this._y = e[1],
  4910. this._z = e[2],
  4911. void 0 !== e[3] && (this._order = e[3]),
  4912. this._onChangeCallback(),
  4913. this
  4914. }
  4915. }, {
  4916. key: "toArray",
  4917. value: function() {
  4918. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  4919. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  4920. return e[t] = this._x,
  4921. e[t + 1] = this._y,
  4922. e[t + 2] = this._z,
  4923. e[t + 3] = this._order,
  4924. e
  4925. }
  4926. }, {
  4927. key: "toVector3",
  4928. value: function(e) {
  4929. return e ? e.set(this._x, this._y, this._z) : new Cn(this._x,this._y,this._z)
  4930. }
  4931. }, {
  4932. key: "_onChange",
  4933. value: function(e) {
  4934. return this._onChangeCallback = e,
  4935. this
  4936. }
  4937. }, {
  4938. key: "_onChangeCallback",
  4939. value: function() {}
  4940. }]),
  4941. r
  4942. }();
  4943. ci.DefaultOrder = "XYZ",
  4944. ci.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
  4945. var di = new ni
  4946. , hi = new Sn
  4947. , pi = function() {
  4948. function e() {
  4949. O(this, e),
  4950. this.mask = 1
  4951. }
  4952. return h(e, [{
  4953. key: "set",
  4954. value: function(e) {
  4955. this.mask = 1 << e | 0
  4956. }
  4957. }, {
  4958. key: "enable",
  4959. value: function(e) {
  4960. this.mask |= 1 << e | 0
  4961. }
  4962. }, {
  4963. key: "enableAll",
  4964. value: function() {
  4965. this.mask = -1
  4966. }
  4967. }, {
  4968. key: "toggle",
  4969. value: function(e) {
  4970. this.mask ^= 1 << e | 0
  4971. }
  4972. }, {
  4973. key: "disable",
  4974. value: function(e) {
  4975. this.mask &= ~(1 << e | 0)
  4976. }
  4977. }, {
  4978. key: "disableAll",
  4979. value: function() {
  4980. this.mask = 0
  4981. }
  4982. }, {
  4983. key: "test",
  4984. value: function(e) {
  4985. return 0 != (this.mask & e.mask)
  4986. }
  4987. }]),
  4988. e
  4989. }()
  4990. , fi = 0
  4991. , mi = new Cn
  4992. , vi = new Sn
  4993. , gi = new ni
  4994. , yi = new Cn
  4995. , wi = new Cn
  4996. , bi = new Cn
  4997. , xi = new Sn
  4998. , Ei = new Cn(1,0,0)
  4999. , _i = new Cn(0,1,0)
  5000. , Mi = new Cn(0,0,1)
  5001. , Ai = {
  5002. type: "added"
  5003. }
  5004. , Ti = {
  5005. type: "removed"
  5006. };
  5007. function Si() {
  5008. Object.defineProperty(this, "id", {
  5009. value: fi++
  5010. }),
  5011. this.uuid = gn.generateUUID(),
  5012. this.name = "",
  5013. this.type = "Object3D",
  5014. this.parent = null,
  5015. this.children = [],
  5016. this.up = Si.DefaultUp.clone();
  5017. var e = new Cn
  5018. , t = new ci
  5019. , n = new Sn
  5020. , i = new Cn(1,1,1);
  5021. t._onChange(function() {
  5022. n.setFromEuler(t, !1)
  5023. }),
  5024. n._onChange(function() {
  5025. t.setFromQuaternion(n, void 0, !1)
  5026. }),
  5027. Object.defineProperties(this, {
  5028. position: {
  5029. configurable: !0,
  5030. enumerable: !0,
  5031. value: e
  5032. },
  5033. rotation: {
  5034. configurable: !0,
  5035. enumerable: !0,
  5036. value: t
  5037. },
  5038. quaternion: {
  5039. configurable: !0,
  5040. enumerable: !0,
  5041. value: n
  5042. },
  5043. scale: {
  5044. configurable: !0,
  5045. enumerable: !0,
  5046. value: i
  5047. },
  5048. modelViewMatrix: {
  5049. value: new ni
  5050. },
  5051. normalMatrix: {
  5052. value: new wn
  5053. }
  5054. }),
  5055. this.matrix = new ni,
  5056. this.matrixWorld = new ni,
  5057. this.matrixAutoUpdate = Si.DefaultMatrixAutoUpdate,
  5058. this.matrixWorldNeedsUpdate = !1,
  5059. this.layers = new pi,
  5060. this.visible = !0,
  5061. this.castShadow = !1,
  5062. this.receiveShadow = !1,
  5063. this.frustumCulled = !0,
  5064. this.renderOrder = 0,
  5065. this.animations = [],
  5066. this.userData = {}
  5067. }
  5068. Si.DefaultUp = new Cn(0,1,0),
  5069. Si.DefaultMatrixAutoUpdate = !0,
  5070. Si.prototype = Object.assign(Object.create(hn.prototype), {
  5071. constructor: Si,
  5072. isObject3D: !0,
  5073. onBeforeRender: function() {},
  5074. onAfterRender: function() {},
  5075. applyMatrix4: function(e) {
  5076. this.matrixAutoUpdate && this.updateMatrix(),
  5077. this.matrix.premultiply(e),
  5078. this.matrix.decompose(this.position, this.quaternion, this.scale)
  5079. },
  5080. applyQuaternion: function(e) {
  5081. return this.quaternion.premultiply(e),
  5082. this
  5083. },
  5084. setRotationFromAxisAngle: function(e, t) {
  5085. this.quaternion.setFromAxisAngle(e, t)
  5086. },
  5087. setRotationFromEuler: function(e) {
  5088. this.quaternion.setFromEuler(e, !0)
  5089. },
  5090. setRotationFromMatrix: function(e) {
  5091. this.quaternion.setFromRotationMatrix(e)
  5092. },
  5093. setRotationFromQuaternion: function(e) {
  5094. this.quaternion.copy(e)
  5095. },
  5096. rotateOnAxis: function(e, t) {
  5097. return vi.setFromAxisAngle(e, t),
  5098. this.quaternion.multiply(vi),
  5099. this
  5100. },
  5101. rotateOnWorldAxis: function(e, t) {
  5102. return vi.setFromAxisAngle(e, t),
  5103. this.quaternion.premultiply(vi),
  5104. this
  5105. },
  5106. rotateX: function(e) {
  5107. return this.rotateOnAxis(Ei, e)
  5108. },
  5109. rotateY: function(e) {
  5110. return this.rotateOnAxis(_i, e)
  5111. },
  5112. rotateZ: function(e) {
  5113. return this.rotateOnAxis(Mi, e)
  5114. },
  5115. translateOnAxis: function(e, t) {
  5116. return mi.copy(e).applyQuaternion(this.quaternion),
  5117. this.position.add(mi.multiplyScalar(t)),
  5118. this
  5119. },
  5120. translateX: function(e) {
  5121. return this.translateOnAxis(Ei, e)
  5122. },
  5123. translateY: function(e) {
  5124. return this.translateOnAxis(_i, e)
  5125. },
  5126. translateZ: function(e) {
  5127. return this.translateOnAxis(Mi, e)
  5128. },
  5129. localToWorld: function(e) {
  5130. return e.applyMatrix4(this.matrixWorld)
  5131. },
  5132. worldToLocal: function(e) {
  5133. return e.applyMatrix4(gi.copy(this.matrixWorld).invert())
  5134. },
  5135. lookAt: function(e, t, n) {
  5136. e.isVector3 ? yi.copy(e) : yi.set(e, t, n);
  5137. n = this.parent;
  5138. this.updateWorldMatrix(!0, !1),
  5139. wi.setFromMatrixPosition(this.matrixWorld),
  5140. this.isCamera || this.isLight ? gi.lookAt(wi, yi, this.up) : gi.lookAt(yi, wi, this.up),
  5141. this.quaternion.setFromRotationMatrix(gi),
  5142. n && (gi.extractRotation(n.matrixWorld),
  5143. vi.setFromRotationMatrix(gi),
  5144. this.quaternion.premultiply(vi.invert()))
  5145. },
  5146. add: function(e) {
  5147. if (1 < arguments.length) {
  5148. for (var t = 0; t < arguments.length; t++)
  5149. this.add(arguments[t]);
  5150. return this
  5151. }
  5152. return e === this ? console.error("THREE.Object3D.add: object can't be added as a child of itself.", e) : e && e.isObject3D ? (null !== e.parent && e.parent.remove(e),
  5153. (e.parent = this).children.push(e),
  5154. e.dispatchEvent(Ai)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e),
  5155. this
  5156. },
  5157. remove: function(e) {
  5158. if (1 < arguments.length) {
  5159. for (var t = 0; t < arguments.length; t++)
  5160. this.remove(arguments[t]);
  5161. return this
  5162. }
  5163. var n = this.children.indexOf(e);
  5164. return -1 !== n && (e.parent = null,
  5165. this.children.splice(n, 1),
  5166. e.dispatchEvent(Ti)),
  5167. this
  5168. },
  5169. clear: function() {
  5170. for (var e = 0; e < this.children.length; e++) {
  5171. var t = this.children[e];
  5172. t.parent = null,
  5173. t.dispatchEvent(Ti)
  5174. }
  5175. return this.children.length = 0,
  5176. this
  5177. },
  5178. attach: function(e) {
  5179. return this.updateWorldMatrix(!0, !1),
  5180. gi.copy(this.matrixWorld).invert(),
  5181. null !== e.parent && (e.parent.updateWorldMatrix(!0, !1),
  5182. gi.multiply(e.parent.matrixWorld)),
  5183. e.applyMatrix4(gi),
  5184. e.updateWorldMatrix(!1, !1),
  5185. this.add(e),
  5186. this
  5187. },
  5188. getObjectById: function(e) {
  5189. return this.getObjectByProperty("id", e)
  5190. },
  5191. getObjectByName: function(e) {
  5192. return this.getObjectByProperty("name", e)
  5193. },
  5194. getObjectByProperty: function(e, t) {
  5195. if (this[e] === t)
  5196. return this;
  5197. for (var n = 0, i = this.children.length; n < i; n++) {
  5198. var r = this.children[n].getObjectByProperty(e, t);
  5199. if (void 0 !== r)
  5200. return r
  5201. }
  5202. },
  5203. getWorldPosition: function(e) {
  5204. return void 0 === e && (console.warn("THREE.Object3D: .getWorldPosition() target is now required"),
  5205. e = new Cn),
  5206. this.updateWorldMatrix(!0, !1),
  5207. e.setFromMatrixPosition(this.matrixWorld)
  5208. },
  5209. getWorldQuaternion: function(e) {
  5210. return void 0 === e && (console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),
  5211. e = new Sn),
  5212. this.updateWorldMatrix(!0, !1),
  5213. this.matrixWorld.decompose(wi, e, bi),
  5214. e
  5215. },
  5216. getWorldScale: function(e) {
  5217. return void 0 === e && (console.warn("THREE.Object3D: .getWorldScale() target is now required"),
  5218. e = new Cn),
  5219. this.updateWorldMatrix(!0, !1),
  5220. this.matrixWorld.decompose(wi, xi, e),
  5221. e
  5222. },
  5223. getWorldDirection: function(e) {
  5224. void 0 === e && (console.warn("THREE.Object3D: .getWorldDirection() target is now required"),
  5225. e = new Cn),
  5226. this.updateWorldMatrix(!0, !1);
  5227. var t = this.matrixWorld.elements;
  5228. return e.set(t[8], t[9], t[10]).normalize()
  5229. },
  5230. raycast: function() {},
  5231. traverse: function(e) {
  5232. var t = e(this);
  5233. if (!t || !t.stopContinue)
  5234. for (var n = this.children, i = 0, r = n.length; i < r; i++)
  5235. n[i].traverse(e)
  5236. },
  5237. traverseVisible: function(e) {
  5238. if (!1 !== this.visible) {
  5239. e(this);
  5240. for (var t = this.children, n = 0, i = t.length; n < i; n++)
  5241. t[n].traverseVisible(e)
  5242. }
  5243. },
  5244. traverseAncestors: function(e) {
  5245. var t = this.parent;
  5246. null !== t && (e(t),
  5247. t.traverseAncestors(e))
  5248. },
  5249. updateMatrix: function() {
  5250. this.matrix.compose(this.position, this.quaternion, this.scale),
  5251. this.matrixWorldNeedsUpdate = !0
  5252. },
  5253. updateMatrixWorld: function(e) {
  5254. this.matrixAutoUpdate && this.updateMatrix(),
  5255. (this.matrixWorldNeedsUpdate || e) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
  5256. e = !(this.matrixWorldNeedsUpdate = !1));
  5257. for (var t = this.children, n = 0, i = t.length; n < i; n++)
  5258. t[n].updateMatrixWorld(e)
  5259. },
  5260. updateWorldMatrix: function(e, t) {
  5261. var n = this.parent;
  5262. if (!0 === e && null !== n && n.updateWorldMatrix(!0, !1),
  5263. this.matrixAutoUpdate && this.updateMatrix(),
  5264. null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
  5265. !0 === t)
  5266. for (var i = this.children, r = 0, a = i.length; r < a; r++)
  5267. i[r].updateWorldMatrix(!1, !0)
  5268. },
  5269. toJSON: function(n) {
  5270. var e = void 0 === n || "string" == typeof n
  5271. , t = {};
  5272. e && (n = {
  5273. geometries: {},
  5274. materials: {},
  5275. textures: {},
  5276. images: {},
  5277. shapes: {},
  5278. skeletons: {},
  5279. animations: {}
  5280. },
  5281. t.metadata = {
  5282. version: 4.5,
  5283. type: "Object",
  5284. generator: "Object3D.toJSON"
  5285. });
  5286. var i, r, a, o, s, l = {};
  5287. function u(e, t) {
  5288. return void 0 === e[t.uuid] && (e[t.uuid] = t.toJSON(n)),
  5289. t.uuid
  5290. }
  5291. if (l.uuid = this.uuid,
  5292. l.type = this.type,
  5293. "" !== this.name && (l.name = this.name),
  5294. !0 === this.castShadow && (l.castShadow = !0),
  5295. !0 === this.receiveShadow && (l.receiveShadow = !0),
  5296. !1 === this.visible && (l.visible = !1),
  5297. !1 === this.frustumCulled && (l.frustumCulled = !1),
  5298. 0 !== this.renderOrder && (l.renderOrder = this.renderOrder),
  5299. "{}" !== JSON.stringify(this.userData) && (l.userData = this.userData),
  5300. l.layers = this.layers.mask,
  5301. l.matrix = this.matrix.toArray(),
  5302. !1 === this.matrixAutoUpdate && (l.matrixAutoUpdate = !1),
  5303. this.isInstancedMesh && (l.type = "InstancedMesh",
  5304. l.count = this.count,
  5305. l.instanceMatrix = this.instanceMatrix.toJSON()),
  5306. this.isMesh || this.isLine || this.isPoints) {
  5307. l.geometry = u(n.geometries, this.geometry);
  5308. var c = this.geometry.parameters;
  5309. if (void 0 !== c && void 0 !== c.shapes) {
  5310. var d = c.shapes;
  5311. if (Array.isArray(d))
  5312. for (var h = 0, p = d.length; h < p; h++) {
  5313. var f = d[h];
  5314. u(n.shapes, f)
  5315. }
  5316. else
  5317. u(n.shapes, d)
  5318. }
  5319. }
  5320. if (this.isSkinnedMesh && (l.bindMode = this.bindMode,
  5321. l.bindMatrix = this.bindMatrix.toArray(),
  5322. void 0 !== this.skeleton && (u(n.skeletons, this.skeleton),
  5323. l.skeleton = this.skeleton.uuid)),
  5324. void 0 !== this.material)
  5325. if (Array.isArray(this.material)) {
  5326. for (var m = [], v = 0, g = this.material.length; v < g; v++)
  5327. m.push(u(n.materials, this.material[v]));
  5328. l.material = m
  5329. } else
  5330. l.material = u(n.materials, this.material);
  5331. if (0 < this.children.length) {
  5332. l.children = [];
  5333. for (var y = 0; y < this.children.length; y++)
  5334. l.children.push(this.children[y].toJSON(n).object)
  5335. }
  5336. if (0 < this.animations.length) {
  5337. l.animations = [];
  5338. for (var w = 0; w < this.animations.length; w++) {
  5339. var b = this.animations[w];
  5340. l.animations.push(u(n.animations, b))
  5341. }
  5342. }
  5343. return e && (i = x(n.geometries),
  5344. r = x(n.materials),
  5345. a = x(n.textures),
  5346. o = x(n.images),
  5347. s = x(n.shapes),
  5348. c = x(n.skeletons),
  5349. e = x(n.animations),
  5350. 0 < i.length && (t.geometries = i),
  5351. 0 < r.length && (t.materials = r),
  5352. 0 < a.length && (t.textures = a),
  5353. 0 < o.length && (t.images = o),
  5354. 0 < s.length && (t.shapes = s),
  5355. 0 < c.length && (t.skeletons = c),
  5356. 0 < e.length && (t.animations = e)),
  5357. t.object = l,
  5358. t;
  5359. function x(e) {
  5360. var t, n = [];
  5361. for (t in e) {
  5362. var i = e[t];
  5363. delete i.metadata,
  5364. n.push(i)
  5365. }
  5366. return n
  5367. }
  5368. },
  5369. clone: function(e) {
  5370. return (new this.constructor).copy(this, e)
  5371. },
  5372. copy: function(e) {
  5373. var t = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1];
  5374. if (this.name = e.name,
  5375. this.up.copy(e.up),
  5376. this.position.copy(e.position),
  5377. this.rotation.order = e.rotation.order,
  5378. this.quaternion.copy(e.quaternion),
  5379. this.scale.copy(e.scale),
  5380. this.matrix.copy(e.matrix),
  5381. this.matrixWorld.copy(e.matrixWorld),
  5382. this.matrixAutoUpdate = e.matrixAutoUpdate,
  5383. this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate,
  5384. this.layers.mask = e.layers.mask,
  5385. this.visible = e.visible,
  5386. this.castShadow = e.castShadow,
  5387. this.receiveShadow = e.receiveShadow,
  5388. this.frustumCulled = e.frustumCulled,
  5389. this.renderOrder = e.renderOrder,
  5390. this.userData = JSON.parse(JSON.stringify(e.userData)),
  5391. !0 === t)
  5392. for (var n = 0; n < e.children.length; n++) {
  5393. var i = e.children[n];
  5394. this.add(i.clone())
  5395. }
  5396. return this
  5397. }
  5398. });
  5399. var Ci = new Cn
  5400. , Pi = new Cn
  5401. , Di = new wn
  5402. , ki = function() {
  5403. function n(e, t) {
  5404. O(this, n),
  5405. Object.defineProperty(this, "isPlane", {
  5406. value: !0
  5407. }),
  5408. this.normal = void 0 !== e ? e : new Cn(1,0,0),
  5409. this.constant = void 0 !== t ? t : 0
  5410. }
  5411. return h(n, [{
  5412. key: "set",
  5413. value: function(e, t) {
  5414. return this.normal.copy(e),
  5415. this.constant = t,
  5416. this
  5417. }
  5418. }, {
  5419. key: "setComponents",
  5420. value: function(e, t, n, i) {
  5421. return this.normal.set(e, t, n),
  5422. this.constant = i,
  5423. this
  5424. }
  5425. }, {
  5426. key: "setFromNormalAndCoplanarPoint",
  5427. value: function(e, t) {
  5428. return this.normal.copy(e),
  5429. this.constant = -t.dot(this.normal),
  5430. this
  5431. }
  5432. }, {
  5433. key: "setFromCoplanarPoints",
  5434. value: function(e, t, n) {
  5435. t = Ci.subVectors(n, t).cross(Pi.subVectors(e, t)).normalize();
  5436. return this.setFromNormalAndCoplanarPoint(t, e),
  5437. this
  5438. }
  5439. }, {
  5440. key: "clone",
  5441. value: function() {
  5442. return (new this.constructor).copy(this)
  5443. }
  5444. }, {
  5445. key: "copy",
  5446. value: function(e) {
  5447. return this.normal.copy(e.normal),
  5448. this.constant = e.constant,
  5449. this
  5450. }
  5451. }, {
  5452. key: "normalize",
  5453. value: function() {
  5454. var e = 1 / this.normal.length();
  5455. return this.normal.multiplyScalar(e),
  5456. this.constant *= e,
  5457. this
  5458. }
  5459. }, {
  5460. key: "negate",
  5461. value: function() {
  5462. return this.constant *= -1,
  5463. this.normal.negate(),
  5464. this
  5465. }
  5466. }, {
  5467. key: "distanceToPoint",
  5468. value: function(e) {
  5469. return this.normal.dot(e) + this.constant
  5470. }
  5471. }, {
  5472. key: "distanceToSphere",
  5473. value: function(e) {
  5474. return this.distanceToPoint(e.center) - e.radius
  5475. }
  5476. }, {
  5477. key: "projectPoint",
  5478. value: function(e, t) {
  5479. return void 0 === t && (console.warn("THREE.Plane: .projectPoint() target is now required"),
  5480. t = new Cn),
  5481. t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)
  5482. }
  5483. }, {
  5484. key: "intersectLine",
  5485. value: function(e, t) {
  5486. void 0 === t && (console.warn("THREE.Plane: .intersectLine() target is now required"),
  5487. t = new Cn);
  5488. var n = e.delta(Ci)
  5489. , i = this.normal.dot(n);
  5490. if (0 === i)
  5491. return 0 === this.distanceToPoint(e.start) ? t.copy(e.start) : void 0;
  5492. i = -(e.start.dot(this.normal) + this.constant) / i;
  5493. return i < 0 || 1 < i ? void 0 : t.copy(n).multiplyScalar(i).add(e.start)
  5494. }
  5495. }, {
  5496. key: "intersectsLine",
  5497. value: function(e) {
  5498. var t = this.distanceToPoint(e.start)
  5499. , e = this.distanceToPoint(e.end);
  5500. return t < 0 && 0 < e || e < 0 && 0 < t
  5501. }
  5502. }, {
  5503. key: "intersectsBox",
  5504. value: function(e) {
  5505. return e.intersectsPlane(this)
  5506. }
  5507. }, {
  5508. key: "intersectsSphere",
  5509. value: function(e) {
  5510. return e.intersectsPlane(this)
  5511. }
  5512. }, {
  5513. key: "coplanarPoint",
  5514. value: function(e) {
  5515. return void 0 === e && (console.warn("THREE.Plane: .coplanarPoint() target is now required"),
  5516. e = new Cn),
  5517. e.copy(this.normal).multiplyScalar(-this.constant)
  5518. }
  5519. }, {
  5520. key: "applyMatrix4",
  5521. value: function(e, t) {
  5522. t = t || Di.getNormalMatrix(e),
  5523. e = this.coplanarPoint(Ci).applyMatrix4(e),
  5524. t = this.normal.applyMatrix3(t).normalize();
  5525. return this.constant = -e.dot(t),
  5526. this
  5527. }
  5528. }, {
  5529. key: "translate",
  5530. value: function(e) {
  5531. return this.constant -= e.dot(this.normal),
  5532. this
  5533. }
  5534. }, {
  5535. key: "equals",
  5536. value: function(e) {
  5537. return e.normal.equals(this.normal) && e.constant === this.constant
  5538. }
  5539. }]),
  5540. n
  5541. }()
  5542. , Bi = new Cn
  5543. , Li = new Cn
  5544. , Ri = new Cn
  5545. , Fi = new Cn
  5546. , Ii = new Cn
  5547. , Oi = new Cn
  5548. , zi = new Cn
  5549. , Ni = new Cn
  5550. , Ui = new Cn
  5551. , Gi = new Cn
  5552. , Hi = function() {
  5553. function a(e, t, n) {
  5554. O(this, a),
  5555. this.a = void 0 !== e ? e : new Cn,
  5556. this.b = void 0 !== t ? t : new Cn,
  5557. this.c = void 0 !== n ? n : new Cn
  5558. }
  5559. return h(a, [{
  5560. key: "set",
  5561. value: function(e, t, n) {
  5562. return this.a.copy(e),
  5563. this.b.copy(t),
  5564. this.c.copy(n),
  5565. this
  5566. }
  5567. }, {
  5568. key: "setFromPointsAndIndices",
  5569. value: function(e, t, n, i) {
  5570. return this.a.copy(e[t]),
  5571. this.b.copy(e[n]),
  5572. this.c.copy(e[i]),
  5573. this
  5574. }
  5575. }, {
  5576. key: "clone",
  5577. value: function() {
  5578. return (new this.constructor).copy(this)
  5579. }
  5580. }, {
  5581. key: "copy",
  5582. value: function(e) {
  5583. return this.a.copy(e.a),
  5584. this.b.copy(e.b),
  5585. this.c.copy(e.c),
  5586. this
  5587. }
  5588. }, {
  5589. key: "getArea",
  5590. value: function() {
  5591. return Bi.subVectors(this.c, this.b),
  5592. Li.subVectors(this.a, this.b),
  5593. .5 * Bi.cross(Li).length()
  5594. }
  5595. }, {
  5596. key: "getMidpoint",
  5597. value: function(e) {
  5598. return void 0 === e && (console.warn("THREE.Triangle: .getMidpoint() target is now required"),
  5599. e = new Cn),
  5600. e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3)
  5601. }
  5602. }, {
  5603. key: "getNormal",
  5604. value: function(e) {
  5605. return a.getNormal(this.a, this.b, this.c, e)
  5606. }
  5607. }, {
  5608. key: "getPlane",
  5609. value: function(e) {
  5610. return void 0 === e && (console.warn("THREE.Triangle: .getPlane() target is now required"),
  5611. e = new ki),
  5612. e.setFromCoplanarPoints(this.a, this.b, this.c)
  5613. }
  5614. }, {
  5615. key: "getBarycoord",
  5616. value: function(e, t) {
  5617. return a.getBarycoord(e, this.a, this.b, this.c, t)
  5618. }
  5619. }, {
  5620. key: "getUV",
  5621. value: function(e, t, n, i, r) {
  5622. return a.getUV(e, this.a, this.b, this.c, t, n, i, r)
  5623. }
  5624. }, {
  5625. key: "containsPoint",
  5626. value: function(e) {
  5627. return a.containsPoint(e, this.a, this.b, this.c)
  5628. }
  5629. }, {
  5630. key: "isFrontFacing",
  5631. value: function(e) {
  5632. return a.isFrontFacing(this.a, this.b, this.c, e)
  5633. }
  5634. }, {
  5635. key: "intersectsBox",
  5636. value: function(e) {
  5637. return e.intersectsTriangle(this)
  5638. }
  5639. }, {
  5640. key: "closestPointToPoint",
  5641. value: function(e, t) {
  5642. void 0 === t && (console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),
  5643. t = new Cn);
  5644. var n = this.a
  5645. , i = this.b
  5646. , r = this.c;
  5647. Ii.subVectors(i, n),
  5648. Oi.subVectors(r, n),
  5649. Ni.subVectors(e, n);
  5650. var a = Ii.dot(Ni)
  5651. , o = Oi.dot(Ni);
  5652. if (a <= 0 && o <= 0)
  5653. return t.copy(n);
  5654. Ui.subVectors(e, i);
  5655. var s = Ii.dot(Ui)
  5656. , l = Oi.dot(Ui);
  5657. if (0 <= s && l <= s)
  5658. return t.copy(i);
  5659. var u = a * l - s * o;
  5660. if (u <= 0 && 0 <= a && s <= 0)
  5661. return d = a / (a - s),
  5662. t.copy(n).addScaledVector(Ii, d);
  5663. Gi.subVectors(e, r);
  5664. var c = Ii.dot(Gi)
  5665. , e = Oi.dot(Gi);
  5666. if (0 <= e && c <= e)
  5667. return t.copy(r);
  5668. a = c * o - a * e;
  5669. if (a <= 0 && 0 <= o && e <= 0)
  5670. return h = o / (o - e),
  5671. t.copy(n).addScaledVector(Oi, h);
  5672. o = s * e - c * l;
  5673. if (o <= 0 && 0 <= l - s && 0 <= c - e)
  5674. return zi.subVectors(r, i),
  5675. h = (l - s) / (l - s + (c - e)),
  5676. t.copy(i).addScaledVector(zi, h);
  5677. var o = 1 / (o + a + u)
  5678. , d = a * o
  5679. , h = u * o;
  5680. return t.copy(n).addScaledVector(Ii, d).addScaledVector(Oi, h)
  5681. }
  5682. }, {
  5683. key: "equals",
  5684. value: function(e) {
  5685. return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c)
  5686. }
  5687. }], [{
  5688. key: "getNormal",
  5689. value: function(e, t, n, i) {
  5690. void 0 === i && (console.warn("THREE.Triangle: .getNormal() target is now required"),
  5691. i = new Cn),
  5692. i.subVectors(n, t),
  5693. Bi.subVectors(e, t),
  5694. i.cross(Bi);
  5695. t = i.lengthSq();
  5696. return 0 < t ? i.multiplyScalar(1 / Math.sqrt(t)) : i.set(0, 0, 0)
  5697. }
  5698. }, {
  5699. key: "getBarycoord",
  5700. value: function(e, t, n, i, r) {
  5701. Bi.subVectors(i, t),
  5702. Li.subVectors(n, t),
  5703. Ri.subVectors(e, t);
  5704. var a = Bi.dot(Bi)
  5705. , o = Bi.dot(Li)
  5706. , i = Bi.dot(Ri)
  5707. , n = Li.dot(Li)
  5708. , e = Li.dot(Ri)
  5709. , t = a * n - o * o;
  5710. if (void 0 === r && (console.warn("THREE.Triangle: .getBarycoord() target is now required"),
  5711. r = new Cn),
  5712. 0 == t)
  5713. return r.set(-2, -1, -1);
  5714. t = 1 / t,
  5715. n = (n * i - o * e) * t,
  5716. t *= a * e - o * i;
  5717. return r.set(1 - n - t, t, n)
  5718. }
  5719. }, {
  5720. key: "containsPoint",
  5721. value: function(e, t, n, i) {
  5722. return this.getBarycoord(e, t, n, i, Fi),
  5723. 0 <= Fi.x && 0 <= Fi.y && Fi.x + Fi.y <= 1
  5724. }
  5725. }, {
  5726. key: "getUV",
  5727. value: function(e, t, n, i, r, a, o, s) {
  5728. return this.getBarycoord(e, t, n, i, Fi),
  5729. s.set(0, 0),
  5730. s.addScaledVector(r, Fi.x),
  5731. s.addScaledVector(a, Fi.y),
  5732. s.addScaledVector(o, Fi.z),
  5733. s
  5734. }
  5735. }, {
  5736. key: "isFrontFacing",
  5737. value: function(e, t, n, i) {
  5738. return Bi.subVectors(n, t),
  5739. Li.subVectors(e, t),
  5740. Bi.cross(Li).dot(i) < 0
  5741. }
  5742. }]),
  5743. a
  5744. }()
  5745. , Vi = {
  5746. aliceblue: 15792383,
  5747. antiquewhite: 16444375,
  5748. aqua: 65535,
  5749. aquamarine: 8388564,
  5750. azure: 15794175,
  5751. beige: 16119260,
  5752. bisque: 16770244,
  5753. black: 0,
  5754. blanchedalmond: 16772045,
  5755. blue: 255,
  5756. blueviolet: 9055202,
  5757. brown: 10824234,
  5758. burlywood: 14596231,
  5759. cadetblue: 6266528,
  5760. chartreuse: 8388352,
  5761. chocolate: 13789470,
  5762. coral: 16744272,
  5763. cornflowerblue: 6591981,
  5764. cornsilk: 16775388,
  5765. crimson: 14423100,
  5766. cyan: 65535,
  5767. darkblue: 139,
  5768. darkcyan: 35723,
  5769. darkgoldenrod: 12092939,
  5770. darkgray: 11119017,
  5771. darkgreen: 25600,
  5772. darkgrey: 11119017,
  5773. darkkhaki: 12433259,
  5774. darkmagenta: 9109643,
  5775. darkolivegreen: 5597999,
  5776. darkorange: 16747520,
  5777. darkorchid: 10040012,
  5778. darkred: 9109504,
  5779. darksalmon: 15308410,
  5780. darkseagreen: 9419919,
  5781. darkslateblue: 4734347,
  5782. darkslategray: 3100495,
  5783. darkslategrey: 3100495,
  5784. darkturquoise: 52945,
  5785. darkviolet: 9699539,
  5786. deeppink: 16716947,
  5787. deepskyblue: 49151,
  5788. dimgray: 6908265,
  5789. dimgrey: 6908265,
  5790. dodgerblue: 2003199,
  5791. firebrick: 11674146,
  5792. floralwhite: 16775920,
  5793. forestgreen: 2263842,
  5794. fuchsia: 16711935,
  5795. gainsboro: 14474460,
  5796. ghostwhite: 16316671,
  5797. gold: 16766720,
  5798. goldenrod: 14329120,
  5799. gray: 8421504,
  5800. green: 32768,
  5801. greenyellow: 11403055,
  5802. grey: 8421504,
  5803. honeydew: 15794160,
  5804. hotpink: 16738740,
  5805. indianred: 13458524,
  5806. indigo: 4915330,
  5807. ivory: 16777200,
  5808. khaki: 15787660,
  5809. lavender: 15132410,
  5810. lavenderblush: 16773365,
  5811. lawngreen: 8190976,
  5812. lemonchiffon: 16775885,
  5813. lightblue: 11393254,
  5814. lightcoral: 15761536,
  5815. lightcyan: 14745599,
  5816. lightgoldenrodyellow: 16448210,
  5817. lightgray: 13882323,
  5818. lightgreen: 9498256,
  5819. lightgrey: 13882323,
  5820. lightpink: 16758465,
  5821. lightsalmon: 16752762,
  5822. lightseagreen: 2142890,
  5823. lightskyblue: 8900346,
  5824. lightslategray: 7833753,
  5825. lightslategrey: 7833753,
  5826. lightsteelblue: 11584734,
  5827. lightyellow: 16777184,
  5828. lime: 65280,
  5829. limegreen: 3329330,
  5830. linen: 16445670,
  5831. magenta: 16711935,
  5832. maroon: 8388608,
  5833. mediumaquamarine: 6737322,
  5834. mediumblue: 205,
  5835. mediumorchid: 12211667,
  5836. mediumpurple: 9662683,
  5837. mediumseagreen: 3978097,
  5838. mediumslateblue: 8087790,
  5839. mediumspringgreen: 64154,
  5840. mediumturquoise: 4772300,
  5841. mediumvioletred: 13047173,
  5842. midnightblue: 1644912,
  5843. mintcream: 16121850,
  5844. mistyrose: 16770273,
  5845. moccasin: 16770229,
  5846. navajowhite: 16768685,
  5847. navy: 128,
  5848. oldlace: 16643558,
  5849. olive: 8421376,
  5850. olivedrab: 7048739,
  5851. orange: 16753920,
  5852. orangered: 16729344,
  5853. orchid: 14315734,
  5854. palegoldenrod: 15657130,
  5855. palegreen: 10025880,
  5856. paleturquoise: 11529966,
  5857. palevioletred: 14381203,
  5858. papayawhip: 16773077,
  5859. peachpuff: 16767673,
  5860. peru: 13468991,
  5861. pink: 16761035,
  5862. plum: 14524637,
  5863. powderblue: 11591910,
  5864. purple: 8388736,
  5865. rebeccapurple: 6697881,
  5866. red: 16711680,
  5867. rosybrown: 12357519,
  5868. royalblue: 4286945,
  5869. saddlebrown: 9127187,
  5870. salmon: 16416882,
  5871. sandybrown: 16032864,
  5872. seagreen: 3050327,
  5873. seashell: 16774638,
  5874. sienna: 10506797,
  5875. silver: 12632256,
  5876. skyblue: 8900331,
  5877. slateblue: 6970061,
  5878. slategray: 7372944,
  5879. slategrey: 7372944,
  5880. snow: 16775930,
  5881. springgreen: 65407,
  5882. steelblue: 4620980,
  5883. tan: 13808780,
  5884. teal: 32896,
  5885. thistle: 14204888,
  5886. tomato: 16737095,
  5887. turquoise: 4251856,
  5888. violet: 15631086,
  5889. wheat: 16113331,
  5890. white: 16777215,
  5891. whitesmoke: 16119285,
  5892. yellow: 16776960,
  5893. yellowgreen: 10145074
  5894. }
  5895. , ji = {
  5896. h: 0,
  5897. s: 0,
  5898. l: 0
  5899. }
  5900. , Wi = {
  5901. h: 0,
  5902. s: 0,
  5903. l: 0
  5904. };
  5905. function Xi(e, t, n) {
  5906. return n < 0 && (n += 1),
  5907. 1 < n && --n,
  5908. n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + 6 * (t - e) * (2 / 3 - n) : e
  5909. }
  5910. function qi(e) {
  5911. return e < .04045 ? .0773993808 * e : Math.pow(.9478672986 * e + .0521327014, 2.4)
  5912. }
  5913. function Ji(e) {
  5914. return e < .0031308 ? 12.92 * e : 1.055 * Math.pow(e, .41666) - .055
  5915. }
  5916. var Yi = function() {
  5917. function i(e, t, n) {
  5918. return O(this, i),
  5919. Object.defineProperty(this, "isColor", {
  5920. value: !0
  5921. }),
  5922. void 0 === t && void 0 === n ? this.set(e) : this.setRGB(e, t, n)
  5923. }
  5924. return h(i, [{
  5925. key: "set",
  5926. value: function(e) {
  5927. return e && e.isColor ? this.copy(e) : "number" == typeof e ? this.setHex(e) : "string" == typeof e && this.setStyle(e),
  5928. this
  5929. }
  5930. }, {
  5931. key: "setScalar",
  5932. value: function(e) {
  5933. return this.r = e,
  5934. this.g = e,
  5935. this.b = e,
  5936. this
  5937. }
  5938. }, {
  5939. key: "setHex",
  5940. value: function(e) {
  5941. return e = Math.floor(e),
  5942. this.r = (e >> 16 & 255) / 255,
  5943. this.g = (e >> 8 & 255) / 255,
  5944. this.b = (255 & e) / 255,
  5945. this
  5946. }
  5947. }, {
  5948. key: "setRGB",
  5949. value: function(e, t, n) {
  5950. return this.r = e,
  5951. this.g = t,
  5952. this.b = n,
  5953. this
  5954. }
  5955. }, {
  5956. key: "setHSL",
  5957. value: function(e, t, n) {
  5958. return e = gn.euclideanModulo(e, 1),
  5959. t = gn.clamp(t, 0, 1),
  5960. n = gn.clamp(n, 0, 1),
  5961. 0 === t ? this.r = this.g = this.b = n : (this.r = Xi(t = 2 * n - (n = n <= .5 ? n * (1 + t) : n + t - n * t), n, e + 1 / 3),
  5962. this.g = Xi(t, n, e),
  5963. this.b = Xi(t, n, e - 1 / 3)),
  5964. this
  5965. }
  5966. }, {
  5967. key: "setStyle",
  5968. value: function(t) {
  5969. function e(e) {
  5970. void 0 !== e && parseFloat(e) < 1 && console.warn("THREE.Color: Alpha component of " + t + " will be ignored.")
  5971. }
  5972. if (l = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)) {
  5973. var n, i = l[1], r = l[2];
  5974. switch (i) {
  5975. case "rgb":
  5976. case "rgba":
  5977. if (n = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))
  5978. return this.r = Math.min(255, parseInt(n[1], 10)) / 255,
  5979. this.g = Math.min(255, parseInt(n[2], 10)) / 255,
  5980. this.b = Math.min(255, parseInt(n[3], 10)) / 255,
  5981. e(n[4]),
  5982. this;
  5983. if (n = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))
  5984. return this.r = Math.min(100, parseInt(n[1], 10)) / 100,
  5985. this.g = Math.min(100, parseInt(n[2], 10)) / 100,
  5986. this.b = Math.min(100, parseInt(n[3], 10)) / 100,
  5987. e(n[4]),
  5988. this;
  5989. break;
  5990. case "hsl":
  5991. case "hsla":
  5992. if (n = /^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)) {
  5993. var a = parseFloat(n[1]) / 360
  5994. , o = parseInt(n[2], 10) / 100
  5995. , s = parseInt(n[3], 10) / 100;
  5996. return e(n[4]),
  5997. this.setHSL(a, o, s)
  5998. }
  5999. }
  6000. } else if (l = /^\#([A-Fa-f\d]+)$/.exec(t)) {
  6001. var i = l[1]
  6002. , l = i.length;
  6003. if (3 === l)
  6004. return this.r = parseInt(i.charAt(0) + i.charAt(0), 16) / 255,
  6005. this.g = parseInt(i.charAt(1) + i.charAt(1), 16) / 255,
  6006. this.b = parseInt(i.charAt(2) + i.charAt(2), 16) / 255,
  6007. this;
  6008. if (6 === l)
  6009. return this.r = parseInt(i.charAt(0) + i.charAt(1), 16) / 255,
  6010. this.g = parseInt(i.charAt(2) + i.charAt(3), 16) / 255,
  6011. this.b = parseInt(i.charAt(4) + i.charAt(5), 16) / 255,
  6012. this
  6013. }
  6014. return t && 0 < t.length ? this.setColorName(t) : this
  6015. }
  6016. }, {
  6017. key: "setColorName",
  6018. value: function(e) {
  6019. var t = Vi[e];
  6020. return void 0 !== t ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e),
  6021. this
  6022. }
  6023. }, {
  6024. key: "clone",
  6025. value: function() {
  6026. return new this.constructor(this.r,this.g,this.b)
  6027. }
  6028. }, {
  6029. key: "copy",
  6030. value: function(e) {
  6031. return this.r = e.r,
  6032. this.g = e.g,
  6033. this.b = e.b,
  6034. this
  6035. }
  6036. }, {
  6037. key: "copyGammaToLinear",
  6038. value: function(e) {
  6039. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2;
  6040. return this.r = Math.pow(e.r, t),
  6041. this.g = Math.pow(e.g, t),
  6042. this.b = Math.pow(e.b, t),
  6043. this
  6044. }
  6045. }, {
  6046. key: "copyLinearToGamma",
  6047. value: function(e) {
  6048. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2
  6049. , t = 0 < t ? 1 / t : 1;
  6050. return this.r = Math.pow(e.r, t),
  6051. this.g = Math.pow(e.g, t),
  6052. this.b = Math.pow(e.b, t),
  6053. this
  6054. }
  6055. }, {
  6056. key: "convertGammaToLinear",
  6057. value: function(e) {
  6058. return this.copyGammaToLinear(this, e),
  6059. this
  6060. }
  6061. }, {
  6062. key: "convertLinearToGamma",
  6063. value: function(e) {
  6064. return this.copyLinearToGamma(this, e),
  6065. this
  6066. }
  6067. }, {
  6068. key: "copySRGBToLinear",
  6069. value: function(e) {
  6070. return this.r = qi(e.r),
  6071. this.g = qi(e.g),
  6072. this.b = qi(e.b),
  6073. this
  6074. }
  6075. }, {
  6076. key: "copyLinearToSRGB",
  6077. value: function(e) {
  6078. return this.r = Ji(e.r),
  6079. this.g = Ji(e.g),
  6080. this.b = Ji(e.b),
  6081. this
  6082. }
  6083. }, {
  6084. key: "convertSRGBToLinear",
  6085. value: function() {
  6086. return this.copySRGBToLinear(this),
  6087. this
  6088. }
  6089. }, {
  6090. key: "convertLinearToSRGB",
  6091. value: function() {
  6092. return this.copyLinearToSRGB(this),
  6093. this
  6094. }
  6095. }, {
  6096. key: "getHex",
  6097. value: function() {
  6098. return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0
  6099. }
  6100. }, {
  6101. key: "getHexString",
  6102. value: function() {
  6103. return ("000000" + this.getHex().toString(16)).slice(-6)
  6104. }
  6105. }, {
  6106. key: "getHSL",
  6107. value: function(e) {
  6108. void 0 === e && (console.warn("THREE.Color: .getHSL() target is now required"),
  6109. e = {
  6110. h: 0,
  6111. s: 0,
  6112. l: 0
  6113. });
  6114. var t, n = this.r, i = this.g, r = this.b, a = Math.max(n, i, r), o = Math.min(n, i, r), s = (o + a) / 2;
  6115. if (o === a)
  6116. u = t = 0;
  6117. else {
  6118. var l = a - o
  6119. , u = s <= .5 ? l / (a + o) : l / (2 - a - o);
  6120. switch (a) {
  6121. case n:
  6122. t = (i - r) / l + (i < r ? 6 : 0);
  6123. break;
  6124. case i:
  6125. t = (r - n) / l + 2;
  6126. break;
  6127. case r:
  6128. t = (n - i) / l + 4
  6129. }
  6130. t /= 6
  6131. }
  6132. return e.h = t,
  6133. e.s = u,
  6134. e.l = s,
  6135. e
  6136. }
  6137. }, {
  6138. key: "getStyle",
  6139. value: function() {
  6140. return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")"
  6141. }
  6142. }, {
  6143. key: "offsetHSL",
  6144. value: function(e, t, n) {
  6145. return this.getHSL(ji),
  6146. ji.h += e,
  6147. ji.s += t,
  6148. ji.l += n,
  6149. this.setHSL(ji.h, ji.s, ji.l),
  6150. this
  6151. }
  6152. }, {
  6153. key: "add",
  6154. value: function(e) {
  6155. return this.r += e.r,
  6156. this.g += e.g,
  6157. this.b += e.b,
  6158. this
  6159. }
  6160. }, {
  6161. key: "addColors",
  6162. value: function(e, t) {
  6163. return this.r = e.r + t.r,
  6164. this.g = e.g + t.g,
  6165. this.b = e.b + t.b,
  6166. this
  6167. }
  6168. }, {
  6169. key: "addScalar",
  6170. value: function(e) {
  6171. return this.r += e,
  6172. this.g += e,
  6173. this.b += e,
  6174. this
  6175. }
  6176. }, {
  6177. key: "sub",
  6178. value: function(e) {
  6179. return this.r = Math.max(0, this.r - e.r),
  6180. this.g = Math.max(0, this.g - e.g),
  6181. this.b = Math.max(0, this.b - e.b),
  6182. this
  6183. }
  6184. }, {
  6185. key: "multiply",
  6186. value: function(e) {
  6187. return this.r *= e.r,
  6188. this.g *= e.g,
  6189. this.b *= e.b,
  6190. this
  6191. }
  6192. }, {
  6193. key: "multiplyScalar",
  6194. value: function(e) {
  6195. return this.r *= e,
  6196. this.g *= e,
  6197. this.b *= e,
  6198. this
  6199. }
  6200. }, {
  6201. key: "lerp",
  6202. value: function(e, t) {
  6203. return this.r += (e.r - this.r) * t,
  6204. this.g += (e.g - this.g) * t,
  6205. this.b += (e.b - this.b) * t,
  6206. this
  6207. }
  6208. }, {
  6209. key: "lerpHSL",
  6210. value: function(e, t) {
  6211. this.getHSL(ji),
  6212. e.getHSL(Wi);
  6213. var n = gn.lerp(ji.h, Wi.h, t)
  6214. , e = gn.lerp(ji.s, Wi.s, t)
  6215. , t = gn.lerp(ji.l, Wi.l, t);
  6216. return this.setHSL(n, e, t),
  6217. this
  6218. }
  6219. }, {
  6220. key: "equals",
  6221. value: function(e) {
  6222. return e.r === this.r && e.g === this.g && e.b === this.b
  6223. }
  6224. }, {
  6225. key: "fromArray",
  6226. value: function(e) {
  6227. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  6228. return this.r = e[t],
  6229. this.g = e[t + 1],
  6230. this.b = e[t + 2],
  6231. this
  6232. }
  6233. }, {
  6234. key: "toArray",
  6235. value: function() {
  6236. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  6237. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  6238. return e[t] = this.r,
  6239. e[t + 1] = this.g,
  6240. e[t + 2] = this.b,
  6241. e
  6242. }
  6243. }, {
  6244. key: "fromBufferAttribute",
  6245. value: function(e, t) {
  6246. return this.r = e.getX(t),
  6247. this.g = e.getY(t),
  6248. this.b = e.getZ(t),
  6249. !0 === e.normalized && (this.r /= 255,
  6250. this.g /= 255,
  6251. this.b /= 255),
  6252. this
  6253. }
  6254. }, {
  6255. key: "toJSON",
  6256. value: function() {
  6257. return this.getHex()
  6258. }
  6259. }]),
  6260. i
  6261. }();
  6262. Yi.NAMES = Vi,
  6263. Yi.prototype.r = 1,
  6264. Yi.prototype.g = 1,
  6265. Yi.prototype.b = 1;
  6266. var Zi = function() {
  6267. function o(e, t, n, i, r) {
  6268. var a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0;
  6269. O(this, o),
  6270. this.a = e,
  6271. this.b = t,
  6272. this.c = n,
  6273. this.normal = i && i.isVector3 ? i : new Cn,
  6274. this.vertexNormals = Array.isArray(i) ? i : [],
  6275. this.color = r && r.isColor ? r : new Yi,
  6276. this.vertexColors = Array.isArray(r) ? r : [],
  6277. this.materialIndex = a
  6278. }
  6279. return h(o, [{
  6280. key: "clone",
  6281. value: function() {
  6282. return (new this.constructor).copy(this)
  6283. }
  6284. }, {
  6285. key: "copy",
  6286. value: function(e) {
  6287. this.a = e.a,
  6288. this.b = e.b,
  6289. this.c = e.c,
  6290. this.normal.copy(e.normal),
  6291. this.color.copy(e.color),
  6292. this.materialIndex = e.materialIndex;
  6293. for (var t = 0, n = e.vertexNormals.length; t < n; t++)
  6294. this.vertexNormals[t] = e.vertexNormals[t].clone();
  6295. for (var i = 0, r = e.vertexColors.length; i < r; i++)
  6296. this.vertexColors[i] = e.vertexColors[i].clone();
  6297. return this
  6298. }
  6299. }]),
  6300. o
  6301. }()
  6302. , Qi = 0;
  6303. function Ki() {
  6304. Object.defineProperty(this, "id", {
  6305. value: Qi++
  6306. }),
  6307. this.uuid = gn.generateUUID(),
  6308. this.name = "",
  6309. this.type = "Material",
  6310. this.fog = !0,
  6311. this.blending = K,
  6312. this.side = q,
  6313. this.flatShading = !1,
  6314. this.vertexColors = !1,
  6315. this.opacity = 1,
  6316. this.transparent = !1,
  6317. this.blendSrc = me,
  6318. this.blendDst = ve,
  6319. this.blendEquation = re,
  6320. this.blendSrcAlpha = null,
  6321. this.blendDstAlpha = null,
  6322. this.blendEquationAlpha = null,
  6323. this.depthFunc = Ae,
  6324. this.depthTest = !0,
  6325. this.depthWrite = !0,
  6326. this.stencilWriteMask = 255,
  6327. this.stencilFunc = 519,
  6328. this.stencilRef = 0,
  6329. this.stencilFuncMask = 255,
  6330. this.stencilFail = 7680,
  6331. this.stencilZFail = 7680,
  6332. this.stencilZPass = 7680,
  6333. this.stencilWrite = !1,
  6334. this.clippingPlanes = null,
  6335. this.clipIntersection = !1,
  6336. this.clipShadows = !1,
  6337. this.shadowSide = null,
  6338. this.colorWrite = !0,
  6339. this.precision = null,
  6340. this.polygonOffset = !1,
  6341. this.polygonOffsetFactor = 0,
  6342. this.polygonOffsetUnits = 0,
  6343. this.dithering = !1,
  6344. this.alphaTest = 0,
  6345. this.premultipliedAlpha = !1,
  6346. this.visible = !0,
  6347. this.toneMapped = !0,
  6348. this.userData = {},
  6349. this.version = 0
  6350. }
  6351. function $i(e) {
  6352. Ki.call(this),
  6353. this.type = "MeshBasicMaterial",
  6354. this.color = new Yi(16777215),
  6355. this.map = null,
  6356. this.lightMap = null,
  6357. this.lightMapIntensity = 1,
  6358. this.aoMap = null,
  6359. this.aoMapIntensity = 1,
  6360. this.specularMap = null,
  6361. this.alphaMap = null,
  6362. this.envMap = null,
  6363. this.combine = k,
  6364. this.reflectivity = 1,
  6365. this.refractionRatio = .98,
  6366. this.wireframe = !1,
  6367. this.wireframelineWidth = 1,
  6368. this.wireframeLinecap = "round",
  6369. this.wireframeLinejoin = "round",
  6370. this.skinning = !1,
  6371. this.morphTargets = !1,
  6372. this.setValues(e)
  6373. }
  6374. Ki.prototype = Object.assign(Object.create(hn.prototype), {
  6375. constructor: Ki,
  6376. isMaterial: !0,
  6377. onBeforeCompile: function() {},
  6378. customProgramCacheKey: function() {
  6379. return this.onBeforeCompile.toString()
  6380. },
  6381. setValues: function(e) {
  6382. if (void 0 !== e)
  6383. for (var t in e) {
  6384. var n, i = e[t];
  6385. void 0 !== i ? "shading" !== t ? void 0 !== (n = this[t]) ? n && n.isColor ? n.set(i) : n && n.isVector3 && i && i.isVector3 ? n.copy(i) : this[t] = i : console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material.") : (console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."),
  6386. this.flatShading = 1 === i) : console.warn("THREE.Material: '" + t + "' parameter is undefined.")
  6387. }
  6388. },
  6389. toJSON: function(e) {
  6390. var t = void 0 === e || "string" == typeof e;
  6391. t && (e = {
  6392. textures: {},
  6393. images: {}
  6394. });
  6395. var n = {
  6396. metadata: {
  6397. version: 4.5,
  6398. type: "Material",
  6399. generator: "Material.toJSON"
  6400. }
  6401. };
  6402. function i(e) {
  6403. var t, n = [];
  6404. for (t in e) {
  6405. var i = e[t];
  6406. delete i.metadata,
  6407. n.push(i)
  6408. }
  6409. return n
  6410. }
  6411. return n.uuid = this.uuid,
  6412. n.type = this.type,
  6413. "" !== this.name && (n.name = this.name),
  6414. this.color && this.color.isColor && (n.color = this.color.getHex()),
  6415. void 0 !== this.roughness && (n.roughness = this.roughness),
  6416. void 0 !== this.metalness && (n.metalness = this.metalness),
  6417. this.sheen && this.sheen.isColor && (n.sheen = this.sheen.getHex()),
  6418. this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()),
  6419. this.emissiveIntensity && 1 !== this.emissiveIntensity && (n.emissiveIntensity = this.emissiveIntensity),
  6420. this.specular && this.specular.isColor && (n.specular = this.specular.getHex()),
  6421. void 0 !== this.shininess && (n.shininess = this.shininess),
  6422. void 0 !== this.clearcoat && (n.clearcoat = this.clearcoat),
  6423. void 0 !== this.clearcoatRoughness && (n.clearcoatRoughness = this.clearcoatRoughness),
  6424. this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid),
  6425. this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid),
  6426. this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid,
  6427. n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()),
  6428. this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid),
  6429. this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid),
  6430. this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid),
  6431. this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid),
  6432. this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid,
  6433. n.aoMapIntensity = this.aoMapIntensity),
  6434. this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid,
  6435. n.bumpScale = this.bumpScale),
  6436. this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid,
  6437. n.normalMapType = this.normalMapType,
  6438. n.normalScale = this.normalScale.toArray()),
  6439. this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid,
  6440. n.displacementScale = this.displacementScale,
  6441. n.displacementBias = this.displacementBias),
  6442. this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid),
  6443. this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid),
  6444. this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid),
  6445. this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid),
  6446. this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid,
  6447. n.reflectivity = this.reflectivity,
  6448. n.refractionRatio = this.refractionRatio,
  6449. void 0 !== this.combine && (n.combine = this.combine),
  6450. void 0 !== this.envMapIntensity && (n.envMapIntensity = this.envMapIntensity)),
  6451. this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid),
  6452. void 0 !== this.size && (n.size = this.size),
  6453. void 0 !== this.sizeAttenuation && (n.sizeAttenuation = this.sizeAttenuation),
  6454. this.blending !== K && (n.blending = this.blending),
  6455. !0 === this.flatShading && (n.flatShading = this.flatShading),
  6456. this.side !== q && (n.side = this.side),
  6457. this.vertexColors && (n.vertexColors = !0),
  6458. this.opacity < 1 && (n.opacity = this.opacity),
  6459. !0 === this.transparent && (n.transparent = this.transparent),
  6460. n.depthFunc = this.depthFunc,
  6461. n.depthTest = this.depthTest,
  6462. n.depthWrite = this.depthWrite,
  6463. n.stencilWrite = this.stencilWrite,
  6464. n.stencilWriteMask = this.stencilWriteMask,
  6465. n.stencilFunc = this.stencilFunc,
  6466. n.stencilRef = this.stencilRef,
  6467. n.stencilFuncMask = this.stencilFuncMask,
  6468. n.stencilFail = this.stencilFail,
  6469. n.stencilZFail = this.stencilZFail,
  6470. n.stencilZPass = this.stencilZPass,
  6471. this.rotation && 0 !== this.rotation && (n.rotation = this.rotation),
  6472. !0 === this.polygonOffset && (n.polygonOffset = !0),
  6473. 0 !== this.polygonOffsetFactor && (n.polygonOffsetFactor = this.polygonOffsetFactor),
  6474. 0 !== this.polygonOffsetUnits && (n.polygonOffsetUnits = this.polygonOffsetUnits),
  6475. this.lineWidth && 1 !== this.lineWidth && (n.lineWidth = this.lineWidth),
  6476. void 0 !== this.dashSize && (n.dashSize = this.dashSize),
  6477. void 0 !== this.gapSize && (n.gapSize = this.gapSize),
  6478. void 0 !== this.scale && (n.scale = this.scale),
  6479. !0 === this.dithering && (n.dithering = !0),
  6480. 0 < this.alphaTest && (n.alphaTest = this.alphaTest),
  6481. !0 === this.premultipliedAlpha && (n.premultipliedAlpha = this.premultipliedAlpha),
  6482. !0 === this.wireframe && (n.wireframe = this.wireframe),
  6483. 1 < this.wireframelineWidth && (n.wireframelineWidth = this.wireframelineWidth),
  6484. "round" !== this.wireframeLinecap && (n.wireframeLinecap = this.wireframeLinecap),
  6485. "round" !== this.wireframeLinejoin && (n.wireframeLinejoin = this.wireframeLinejoin),
  6486. !0 === this.morphTargets && (n.morphTargets = !0),
  6487. !0 === this.morphNormals && (n.morphNormals = !0),
  6488. !0 === this.skinning && (n.skinning = !0),
  6489. !1 === this.visible && (n.visible = !1),
  6490. !1 === this.toneMapped && (n.toneMapped = !1),
  6491. "{}" !== JSON.stringify(this.userData) && (n.userData = this.userData),
  6492. t && (t = i(e.textures),
  6493. e = i(e.images),
  6494. 0 < t.length && (n.textures = t),
  6495. 0 < e.length && (n.images = e)),
  6496. n
  6497. },
  6498. clone: function() {
  6499. return (new this.constructor).copy(this)
  6500. },
  6501. copy: function(e) {
  6502. this.name = e.name,
  6503. this.fog = e.fog,
  6504. this.blending = e.blending,
  6505. this.side = e.side,
  6506. this.flatShading = e.flatShading,
  6507. this.vertexColors = e.vertexColors,
  6508. this.opacity = e.opacity,
  6509. this.transparent = e.transparent,
  6510. this.blendSrc = e.blendSrc,
  6511. this.blendDst = e.blendDst,
  6512. this.blendEquation = e.blendEquation,
  6513. this.blendSrcAlpha = e.blendSrcAlpha,
  6514. this.blendDstAlpha = e.blendDstAlpha,
  6515. this.blendEquationAlpha = e.blendEquationAlpha,
  6516. this.depthFunc = e.depthFunc,
  6517. this.depthTest = e.depthTest,
  6518. this.depthWrite = e.depthWrite,
  6519. this.stencilWriteMask = e.stencilWriteMask,
  6520. this.stencilFunc = e.stencilFunc,
  6521. this.stencilRef = e.stencilRef,
  6522. this.stencilFuncMask = e.stencilFuncMask,
  6523. this.stencilFail = e.stencilFail,
  6524. this.stencilZFail = e.stencilZFail,
  6525. this.stencilZPass = e.stencilZPass,
  6526. this.stencilWrite = e.stencilWrite;
  6527. var t = e.clippingPlanes
  6528. , n = null;
  6529. if (null !== t)
  6530. for (var i = t.length, n = new Array(i), r = 0; r !== i; ++r)
  6531. n[r] = t[r].clone();
  6532. return this.clippingPlanes = n,
  6533. this.clipIntersection = e.clipIntersection,
  6534. this.clipShadows = e.clipShadows,
  6535. this.shadowSide = e.shadowSide,
  6536. this.colorWrite = e.colorWrite,
  6537. this.precision = e.precision,
  6538. this.polygonOffset = e.polygonOffset,
  6539. this.polygonOffsetFactor = e.polygonOffsetFactor,
  6540. this.polygonOffsetUnits = e.polygonOffsetUnits,
  6541. this.dithering = e.dithering,
  6542. this.alphaTest = e.alphaTest,
  6543. this.premultipliedAlpha = e.premultipliedAlpha,
  6544. this.visible = e.visible,
  6545. this.toneMapped = e.toneMapped,
  6546. this.userData = JSON.parse(JSON.stringify(e.userData)),
  6547. this
  6548. },
  6549. dispose: function() {
  6550. this.dispatchEvent({
  6551. type: "dispose"
  6552. })
  6553. }
  6554. }),
  6555. Object.defineProperty(Ki.prototype, "needsUpdate", {
  6556. set: function(e) {
  6557. !0 === e && this.version++
  6558. }
  6559. }),
  6560. (($i.prototype = Object.create(Ki.prototype)).constructor = $i).prototype.isMeshBasicMaterial = !0,
  6561. $i.prototype.copy = function(e) {
  6562. return Ki.prototype.copy.call(this, e),
  6563. this.color.copy(e.color),
  6564. this.map = e.map,
  6565. this.lightMap = e.lightMap,
  6566. this.lightMapIntensity = e.lightMapIntensity,
  6567. this.aoMap = e.aoMap,
  6568. this.aoMapIntensity = e.aoMapIntensity,
  6569. this.specularMap = e.specularMap,
  6570. this.alphaMap = e.alphaMap,
  6571. this.envMap = e.envMap,
  6572. this.combine = e.combine,
  6573. this.reflectivity = e.reflectivity,
  6574. this.refractionRatio = e.refractionRatio,
  6575. this.wireframe = e.wireframe,
  6576. this.wireframelineWidth = e.wireframelineWidth,
  6577. this.wireframeLinecap = e.wireframeLinecap,
  6578. this.wireframeLinejoin = e.wireframeLinejoin,
  6579. this.skinning = e.skinning,
  6580. this.morphTargets = e.morphTargets,
  6581. this
  6582. }
  6583. ;
  6584. var er = new Cn
  6585. , tr = new yn;
  6586. function nr(e, t, n) {
  6587. if (Array.isArray(e))
  6588. throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
  6589. this.name = "",
  6590. this.array = e,
  6591. this.itemSize = t,
  6592. this.count = void 0 !== e ? e.length / t : 0,
  6593. this.normalized = !0 === n,
  6594. this.usage = un,
  6595. this.updateRange = {
  6596. offset: 0,
  6597. count: -1
  6598. },
  6599. this.version = 0
  6600. }
  6601. function ir(e, t, n) {
  6602. nr.call(this, new Int8Array(e), t, n)
  6603. }
  6604. function rr(e, t, n) {
  6605. nr.call(this, new Uint8Array(e), t, n)
  6606. }
  6607. function ar(e, t, n) {
  6608. nr.call(this, new Uint8ClampedArray(e), t, n)
  6609. }
  6610. function or(e, t, n) {
  6611. nr.call(this, new Int16Array(e), t, n)
  6612. }
  6613. function sr(e, t, n) {
  6614. nr.call(this, new Uint16Array(e), t, n)
  6615. }
  6616. function lr(e, t, n) {
  6617. nr.call(this, new Int32Array(e), t, n)
  6618. }
  6619. function ur(e, t, n) {
  6620. nr.call(this, new Uint32Array(e), t, n)
  6621. }
  6622. function cr(e, t, n) {
  6623. nr.call(this, new Uint16Array(e), t, n)
  6624. }
  6625. function dr(e, t, n) {
  6626. nr.call(this, new Float32Array(e), t, n)
  6627. }
  6628. function hr(e, t, n) {
  6629. nr.call(this, new Float64Array(e), t, n)
  6630. }
  6631. Object.defineProperty(nr.prototype, "needsUpdate", {
  6632. set: function(e) {
  6633. !0 === e && this.version++
  6634. }
  6635. }),
  6636. Object.assign(nr.prototype, {
  6637. isBufferAttribute: !0,
  6638. onUploadCallback: function() {},
  6639. setUsage: function(e) {
  6640. return this.usage = e,
  6641. this
  6642. },
  6643. copy: function(e) {
  6644. return this.name = e.name,
  6645. this.array = new e.array.constructor(e.array),
  6646. this.itemSize = e.itemSize,
  6647. this.count = e.count,
  6648. this.normalized = e.normalized,
  6649. this.usage = e.usage,
  6650. this
  6651. },
  6652. copyAt: function(e, t, n) {
  6653. e *= this.itemSize,
  6654. n *= t.itemSize;
  6655. for (var i = 0, r = this.itemSize; i < r; i++)
  6656. this.array[e + i] = t.array[n + i];
  6657. return this
  6658. },
  6659. copyArray: function(e) {
  6660. return this.array.set(e),
  6661. this
  6662. },
  6663. copyColorsArray: function(e) {
  6664. for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) {
  6665. var a = e[i];
  6666. void 0 === a && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", i),
  6667. a = new Yi),
  6668. t[n++] = a.r,
  6669. t[n++] = a.g,
  6670. t[n++] = a.b
  6671. }
  6672. return this
  6673. },
  6674. copyVector2sArray: function(e) {
  6675. for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) {
  6676. var a = e[i];
  6677. void 0 === a && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", i),
  6678. a = new yn),
  6679. t[n++] = a.x,
  6680. t[n++] = a.y
  6681. }
  6682. return this
  6683. },
  6684. copyVector3sArray: function(e) {
  6685. for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) {
  6686. var a = e[i];
  6687. void 0 === a && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", i),
  6688. a = new Cn),
  6689. t[n++] = a.x,
  6690. t[n++] = a.y,
  6691. t[n++] = a.z
  6692. }
  6693. return this
  6694. },
  6695. copyVector4sArray: function(e) {
  6696. for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) {
  6697. var a = e[i];
  6698. void 0 === a && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", i),
  6699. a = new Mn),
  6700. t[n++] = a.x,
  6701. t[n++] = a.y,
  6702. t[n++] = a.z,
  6703. t[n++] = a.w
  6704. }
  6705. return this
  6706. },
  6707. applyMatrix3: function(e) {
  6708. if (2 === this.itemSize)
  6709. for (var t = 0, n = this.count; t < n; t++)
  6710. tr.fromBufferAttribute(this, t),
  6711. tr.applyMatrix3(e),
  6712. this.setXY(t, tr.x, tr.y);
  6713. else if (3 === this.itemSize)
  6714. for (var i = 0, r = this.count; i < r; i++)
  6715. er.fromBufferAttribute(this, i),
  6716. er.applyMatrix3(e),
  6717. this.setXYZ(i, er.x, er.y, er.z);
  6718. return this
  6719. },
  6720. applyMatrix4: function(e) {
  6721. for (var t = 0, n = this.count; t < n; t++)
  6722. er.x = this.getX(t),
  6723. er.y = this.getY(t),
  6724. er.z = this.getZ(t),
  6725. er.applyMatrix4(e),
  6726. this.setXYZ(t, er.x, er.y, er.z);
  6727. return this
  6728. },
  6729. applyNormalMatrix: function(e) {
  6730. for (var t = 0, n = this.count; t < n; t++)
  6731. er.x = this.getX(t),
  6732. er.y = this.getY(t),
  6733. er.z = this.getZ(t),
  6734. er.applyNormalMatrix(e),
  6735. this.setXYZ(t, er.x, er.y, er.z);
  6736. return this
  6737. },
  6738. transformDirection: function(e) {
  6739. for (var t = 0, n = this.count; t < n; t++)
  6740. er.x = this.getX(t),
  6741. er.y = this.getY(t),
  6742. er.z = this.getZ(t),
  6743. er.transformDirection(e),
  6744. this.setXYZ(t, er.x, er.y, er.z);
  6745. return this
  6746. },
  6747. set: function(e) {
  6748. return this.array.set(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0),
  6749. this
  6750. },
  6751. getX: function(e) {
  6752. return this.array[e * this.itemSize]
  6753. },
  6754. setX: function(e, t) {
  6755. return this.array[e * this.itemSize] = t,
  6756. this
  6757. },
  6758. getY: function(e) {
  6759. return this.array[e * this.itemSize + 1]
  6760. },
  6761. setY: function(e, t) {
  6762. return this.array[e * this.itemSize + 1] = t,
  6763. this
  6764. },
  6765. getZ: function(e) {
  6766. return this.array[e * this.itemSize + 2]
  6767. },
  6768. setZ: function(e, t) {
  6769. return this.array[e * this.itemSize + 2] = t,
  6770. this
  6771. },
  6772. getW: function(e) {
  6773. return this.array[e * this.itemSize + 3]
  6774. },
  6775. setW: function(e, t) {
  6776. return this.array[e * this.itemSize + 3] = t,
  6777. this
  6778. },
  6779. setXY: function(e, t, n) {
  6780. return e *= this.itemSize,
  6781. this.array[e + 0] = t,
  6782. this.array[e + 1] = n,
  6783. this
  6784. },
  6785. setXYZ: function(e, t, n, i) {
  6786. return e *= this.itemSize,
  6787. this.array[e + 0] = t,
  6788. this.array[e + 1] = n,
  6789. this.array[e + 2] = i,
  6790. this
  6791. },
  6792. setXYZW: function(e, t, n, i, r) {
  6793. return e *= this.itemSize,
  6794. this.array[e + 0] = t,
  6795. this.array[e + 1] = n,
  6796. this.array[e + 2] = i,
  6797. this.array[e + 3] = r,
  6798. this
  6799. },
  6800. onUpload: function(e) {
  6801. return this.onUploadCallback = e,
  6802. this
  6803. },
  6804. clone: function() {
  6805. return new this.constructor(this.array,this.itemSize).copy(this)
  6806. },
  6807. toJSON: function() {
  6808. return {
  6809. itemSize: this.itemSize,
  6810. type: this.array.constructor.name,
  6811. array: Array.prototype.slice.call(this.array),
  6812. normalized: this.normalized
  6813. }
  6814. }
  6815. }),
  6816. (ir.prototype = Object.create(nr.prototype)).constructor = ir,
  6817. (rr.prototype = Object.create(nr.prototype)).constructor = rr,
  6818. (ar.prototype = Object.create(nr.prototype)).constructor = ar,
  6819. (or.prototype = Object.create(nr.prototype)).constructor = or,
  6820. sr.prototype = Object.create(nr.prototype),
  6821. sr.prototype.constructor = sr,
  6822. (lr.prototype = Object.create(nr.prototype)).constructor = lr,
  6823. ur.prototype = Object.create(nr.prototype),
  6824. ur.prototype.constructor = ur,
  6825. ((cr.prototype = Object.create(nr.prototype)).constructor = cr).prototype.isFloat16BufferAttribute = !0,
  6826. (dr.prototype = Object.create(nr.prototype)).constructor = dr,
  6827. (hr.prototype = Object.create(nr.prototype)).constructor = hr;
  6828. var pr = function() {
  6829. function e() {
  6830. O(this, e),
  6831. this.vertices = [],
  6832. this.normals = [],
  6833. this.colors = [],
  6834. this.uvs = [],
  6835. this.uvs2 = [],
  6836. this.groups = [],
  6837. this.morphTargets = {},
  6838. this.skinWeights = [],
  6839. this.skinIndices = [],
  6840. this.boundingBox = null,
  6841. this.boundingSphere = null,
  6842. this.verticesNeedUpdate = !1,
  6843. this.normalsNeedUpdate = !1,
  6844. this.colorsNeedUpdate = !1,
  6845. this.uvsNeedUpdate = !1,
  6846. this.groupsNeedUpdate = !1
  6847. }
  6848. return h(e, [{
  6849. key: "computeGroups",
  6850. value: function(e) {
  6851. for (var t, n = [], i = void 0, r = e.faces, a = 0; a < r.length; a++) {
  6852. var o = r[a];
  6853. o.materialIndex !== i && (i = o.materialIndex,
  6854. void 0 !== t && (t.count = 3 * a - t.start,
  6855. n.push(t)),
  6856. t = {
  6857. start: 3 * a,
  6858. materialIndex: i
  6859. })
  6860. }
  6861. void 0 !== t && (t.count = 3 * a - t.start,
  6862. n.push(t)),
  6863. this.groups = n
  6864. }
  6865. }, {
  6866. key: "fromGeometry",
  6867. value: function(e) {
  6868. var t = e.faces
  6869. , n = e.vertices
  6870. , i = e.faceVertexUvs
  6871. , r = i[0] && 0 < i[0].length
  6872. , a = i[1] && 0 < i[1].length
  6873. , o = e.morphTargets
  6874. , s = o.length;
  6875. if (0 < s) {
  6876. for (var l = [], u = 0; u < s; u++)
  6877. l[u] = {
  6878. name: o[u].name,
  6879. data: []
  6880. };
  6881. this.morphTargets.position = l
  6882. }
  6883. var c = e.morphNormals
  6884. , d = c.length;
  6885. if (0 < d) {
  6886. for (var h = [], p = 0; p < d; p++)
  6887. h[p] = {
  6888. name: c[p].name,
  6889. data: []
  6890. };
  6891. this.morphTargets.normal = h
  6892. }
  6893. var f = e.skinIndices
  6894. , m = e.skinWeights
  6895. , v = f.length === n.length
  6896. , g = m.length === n.length;
  6897. 0 < n.length && 0 === t.length && console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
  6898. for (var y = 0; y < t.length; y++) {
  6899. var w = t[y];
  6900. this.vertices.push(n[w.a], n[w.b], n[w.c]);
  6901. var b = w.vertexNormals;
  6902. 3 === b.length ? this.normals.push(b[0], b[1], b[2]) : (E = w.normal,
  6903. this.normals.push(E, E, E));
  6904. var x, E = w.vertexColors;
  6905. 3 === E.length ? this.colors.push(E[0], E[1], E[2]) : (E = w.color,
  6906. this.colors.push(E, E, E)),
  6907. !0 === r && (void 0 !== (x = i[0][y]) ? this.uvs.push(x[0], x[1], x[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", y),
  6908. this.uvs.push(new yn, new yn, new yn))),
  6909. !0 === a && (void 0 !== (x = i[1][y]) ? this.uvs2.push(x[0], x[1], x[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", y),
  6910. this.uvs2.push(new yn, new yn, new yn)));
  6911. for (var _ = 0; _ < s; _++) {
  6912. var M = o[_].vertices;
  6913. l[_].data.push(M[w.a], M[w.b], M[w.c])
  6914. }
  6915. for (var A = 0; A < d; A++) {
  6916. var T = c[A].vertexNormals[y];
  6917. h[A].data.push(T.a, T.b, T.c)
  6918. }
  6919. v && this.skinIndices.push(f[w.a], f[w.b], f[w.c]),
  6920. g && this.skinWeights.push(m[w.a], m[w.b], m[w.c])
  6921. }
  6922. return this.computeGroups(e),
  6923. this.verticesNeedUpdate = e.verticesNeedUpdate,
  6924. this.normalsNeedUpdate = e.normalsNeedUpdate,
  6925. this.colorsNeedUpdate = e.colorsNeedUpdate,
  6926. this.uvsNeedUpdate = e.uvsNeedUpdate,
  6927. this.groupsNeedUpdate = e.groupsNeedUpdate,
  6928. null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
  6929. null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()),
  6930. this
  6931. }
  6932. }]),
  6933. e
  6934. }();
  6935. function fr(e) {
  6936. if (0 === e.length)
  6937. return -1 / 0;
  6938. for (var t = e[0], n = 1, i = e.length; n < i; ++n)
  6939. e[n] > t && (t = e[n]);
  6940. return t
  6941. }
  6942. var mr = {
  6943. Int8Array: Int8Array,
  6944. Uint8Array: Uint8Array,
  6945. Uint8ClampedArray: "undefined" != typeof Uint8ClampedArray ? Uint8ClampedArray : Uint8Array,
  6946. Int16Array: Int16Array,
  6947. Uint16Array: Uint16Array,
  6948. Int32Array: Int32Array,
  6949. Uint32Array: Uint32Array,
  6950. Float32Array: Float32Array,
  6951. Float64Array: Float64Array
  6952. };
  6953. function vr(e, t) {
  6954. return new mr[e](t)
  6955. }
  6956. var gr = 1
  6957. , yr = new ni
  6958. , wr = new Si
  6959. , br = new Cn
  6960. , xr = new kn
  6961. , Er = new kn
  6962. , _r = new Cn;
  6963. function Mr() {
  6964. Object.defineProperty(this, "id", {
  6965. value: gr += 2
  6966. }),
  6967. this.uuid = gn.generateUUID(),
  6968. this.name = "",
  6969. this.type = "BufferGeometry",
  6970. this.index = null,
  6971. this.attributes = {},
  6972. this.morphAttributes = {},
  6973. this.morphTargetsRelative = !1,
  6974. this.groups = [],
  6975. this.boundingBox = null,
  6976. this.boundingSphere = null,
  6977. this.drawRange = {
  6978. start: 0,
  6979. count: 1 / 0
  6980. },
  6981. this.userData = {}
  6982. }
  6983. Mr.prototype = Object.assign(Object.create(hn.prototype), {
  6984. constructor: Mr,
  6985. isBufferGeometry: !0,
  6986. getIndex: function() {
  6987. return this.index
  6988. },
  6989. setIndex: function(e) {
  6990. return Array.isArray(e) ? this.index = new (65535 < fr(e) ? ur : sr)(e,1) : this.index = e,
  6991. this
  6992. },
  6993. getAttribute: function(e) {
  6994. return this.attributes[e]
  6995. },
  6996. setAttribute: function(e, t) {
  6997. return this.attributes[e] = t,
  6998. this
  6999. },
  7000. deleteAttribute: function(e) {
  7001. return delete this.attributes[e],
  7002. this
  7003. },
  7004. hasAttribute: function(e) {
  7005. return void 0 !== this.attributes[e]
  7006. },
  7007. addGroup: function(e, t) {
  7008. this.groups.push({
  7009. start: e,
  7010. count: t,
  7011. materialIndex: 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  7012. })
  7013. },
  7014. clearGroups: function() {
  7015. this.groups = []
  7016. },
  7017. setDrawRange: function(e, t) {
  7018. this.drawRange.start = e,
  7019. this.drawRange.count = t
  7020. },
  7021. applyMatrix4: function(e) {
  7022. var t = this.attributes.position;
  7023. void 0 !== t && (t.applyMatrix4(e),
  7024. t.needsUpdate = !0);
  7025. var n = this.attributes.normal;
  7026. void 0 !== n && (t = (new wn).getNormalMatrix(e),
  7027. n.applyNormalMatrix(t),
  7028. n.needsUpdate = !0);
  7029. n = this.attributes.tangent;
  7030. return void 0 !== n && (n.transformDirection(e),
  7031. n.needsUpdate = !0),
  7032. null !== this.boundingBox && this.computeBoundingBox(),
  7033. null !== this.boundingSphere && this.computeBoundingSphere(),
  7034. this
  7035. },
  7036. rotateX: function(e) {
  7037. return yr.makeRotationX(e),
  7038. this.applyMatrix4(yr),
  7039. this
  7040. },
  7041. rotateY: function(e) {
  7042. return yr.makeRotationY(e),
  7043. this.applyMatrix4(yr),
  7044. this
  7045. },
  7046. rotateZ: function(e) {
  7047. return yr.makeRotationZ(e),
  7048. this.applyMatrix4(yr),
  7049. this
  7050. },
  7051. translate: function(e, t, n) {
  7052. return yr.makeTranslation(e, t, n),
  7053. this.applyMatrix4(yr),
  7054. this
  7055. },
  7056. scale: function(e, t, n) {
  7057. return yr.makeScale(e, t, n),
  7058. this.applyMatrix4(yr),
  7059. this
  7060. },
  7061. lookAt: function(e) {
  7062. return wr.lookAt(e),
  7063. wr.updateMatrix(),
  7064. this.applyMatrix4(wr.matrix),
  7065. this
  7066. },
  7067. center: function() {
  7068. return this.computeBoundingBox(),
  7069. this.boundingBox.getCenter(br).negate(),
  7070. this.translate(br.x, br.y, br.z),
  7071. this
  7072. },
  7073. setFromObject: function(e) {
  7074. var t, n, i = e.geometry;
  7075. return e.isPoints || e.isLine ? (t = new dr(3 * i.vertices.length,3),
  7076. n = new dr(3 * i.colors.length,3),
  7077. this.setAttribute("position", t.copyVector3sArray(i.vertices)),
  7078. this.setAttribute("color", n.copyColorsArray(i.colors)),
  7079. i.lineDistances && i.lineDistances.length === i.vertices.length && (n = new dr(i.lineDistances.length,1),
  7080. this.setAttribute("lineDistance", n.copyArray(i.lineDistances))),
  7081. null !== i.boundingSphere && (this.boundingSphere = i.boundingSphere.clone()),
  7082. null !== i.boundingBox && (this.boundingBox = i.boundingBox.clone())) : e.isMesh && i && i.isGeometry && this.fromGeometry(i),
  7083. this
  7084. },
  7085. setFromPoints: function(e) {
  7086. for (var t = [], n = 0, i = e.length; n < i; n++) {
  7087. var r = e[n];
  7088. t.push(r.x, r.y, r.z || 0)
  7089. }
  7090. return this.setAttribute("position", new dr(t,3)),
  7091. this
  7092. },
  7093. updateFromObject: function(e) {
  7094. var t, n, i = e.geometry;
  7095. if (e.isMesh) {
  7096. var r = i.__directGeometry;
  7097. if (!0 === i.elementsNeedUpdate && (r = void 0,
  7098. i.elementsNeedUpdate = !1),
  7099. void 0 === r)
  7100. return this.fromGeometry(i);
  7101. r.verticesNeedUpdate = i.verticesNeedUpdate,
  7102. r.normalsNeedUpdate = i.normalsNeedUpdate,
  7103. r.colorsNeedUpdate = i.colorsNeedUpdate,
  7104. r.uvsNeedUpdate = i.uvsNeedUpdate,
  7105. r.groupsNeedUpdate = i.groupsNeedUpdate,
  7106. i.verticesNeedUpdate = !1,
  7107. i.normalsNeedUpdate = !1,
  7108. i.colorsNeedUpdate = !1,
  7109. i.uvsNeedUpdate = !1,
  7110. i.groupsNeedUpdate = !1,
  7111. i = r
  7112. }
  7113. return !0 === i.verticesNeedUpdate && (void 0 !== (r = this.attributes.position) && (r.copyVector3sArray(i.vertices),
  7114. r.needsUpdate = !0),
  7115. i.verticesNeedUpdate = !1),
  7116. !0 === i.normalsNeedUpdate && (void 0 !== (t = this.attributes.normal) && (t.copyVector3sArray(i.normals),
  7117. t.needsUpdate = !0),
  7118. i.normalsNeedUpdate = !1),
  7119. !0 === i.colorsNeedUpdate && (void 0 !== (t = this.attributes.color) && (t.copyColorsArray(i.colors),
  7120. t.needsUpdate = !0),
  7121. i.colorsNeedUpdate = !1),
  7122. i.uvsNeedUpdate && (void 0 !== (n = this.attributes.uv) && (n.copyVector2sArray(i.uvs),
  7123. n.needsUpdate = !0),
  7124. i.uvsNeedUpdate = !1),
  7125. i.lineDistancesNeedUpdate && (void 0 !== (n = this.attributes.lineDistance) && (n.copyArray(i.lineDistances),
  7126. n.needsUpdate = !0),
  7127. i.lineDistancesNeedUpdate = !1),
  7128. i.groupsNeedUpdate && (i.computeGroups(e.geometry),
  7129. this.groups = i.groups,
  7130. i.groupsNeedUpdate = !1),
  7131. this
  7132. },
  7133. fromGeometry: function(e) {
  7134. return e.__directGeometry = (new pr).fromGeometry(e),
  7135. this.fromDirectGeometry(e.__directGeometry)
  7136. },
  7137. fromDirectGeometry: function(e) {
  7138. var t, n, i, r, a = new Float32Array(3 * e.vertices.length);
  7139. for (i in this.setAttribute("position", new nr(a,3).copyVector3sArray(e.vertices)),
  7140. 0 < e.normals.length && (t = new Float32Array(3 * e.normals.length),
  7141. this.setAttribute("normal", new nr(t,3).copyVector3sArray(e.normals))),
  7142. 0 < e.colors.length && (t = new Float32Array(3 * e.colors.length),
  7143. this.setAttribute("color", new nr(t,3).copyColorsArray(e.colors))),
  7144. 0 < e.uvs.length && (n = new Float32Array(2 * e.uvs.length),
  7145. this.setAttribute("uv", new nr(n,2).copyVector2sArray(e.uvs))),
  7146. 0 < e.uvs2.length && (n = new Float32Array(2 * e.uvs2.length),
  7147. this.setAttribute("uv2", new nr(n,2).copyVector2sArray(e.uvs2))),
  7148. this.groups = e.groups,
  7149. e.morphTargets) {
  7150. for (var o = [], s = e.morphTargets[i], l = 0, u = s.length; l < u; l++) {
  7151. var c = s[l]
  7152. , d = new dr(3 * c.data.length,3);
  7153. d.name = c.name,
  7154. o.push(d.copyVector3sArray(c.data))
  7155. }
  7156. this.morphAttributes[i] = o
  7157. }
  7158. return 0 < e.skinIndices.length && (r = new dr(4 * e.skinIndices.length,4),
  7159. this.setAttribute("skinIndex", r.copyVector4sArray(e.skinIndices))),
  7160. 0 < e.skinWeights.length && (r = new dr(4 * e.skinWeights.length,4),
  7161. this.setAttribute("skinWeight", r.copyVector4sArray(e.skinWeights))),
  7162. null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
  7163. null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()),
  7164. this
  7165. },
  7166. computeBoundingBox: function() {
  7167. null === this.boundingBox && (this.boundingBox = new kn);
  7168. var e = this.attributes.position
  7169. , t = this.morphAttributes.position;
  7170. if (e && e.isGLBufferAttribute)
  7171. return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this),
  7172. void this.boundingBox.set(new Cn(-1 / 0,-1 / 0,-1 / 0), new Cn(1 / 0,1 / 0,1 / 0));
  7173. if (void 0 !== e) {
  7174. if (this.boundingBox.setFromBufferAttribute(e),
  7175. t)
  7176. for (var n = 0, i = t.length; n < i; n++) {
  7177. var r = t[n];
  7178. xr.setFromBufferAttribute(r),
  7179. this.morphTargetsRelative ? (_r.addVectors(this.boundingBox.min, xr.min),
  7180. this.boundingBox.expandByPoint(_r),
  7181. _r.addVectors(this.boundingBox.max, xr.max),
  7182. this.boundingBox.expandByPoint(_r)) : (this.boundingBox.expandByPoint(xr.min),
  7183. this.boundingBox.expandByPoint(xr.max))
  7184. }
  7185. } else
  7186. this.boundingBox.makeEmpty();
  7187. (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this)
  7188. },
  7189. computeBoundingSphere: function() {
  7190. null === this.boundingSphere && (this.boundingSphere = new qn);
  7191. var e = this.attributes.position
  7192. , t = this.morphAttributes.position;
  7193. if (e && e.isGLBufferAttribute)
  7194. return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this),
  7195. void this.boundingSphere.set(new Cn, 1 / 0);
  7196. if (e) {
  7197. var n = this.boundingSphere.center;
  7198. if (xr.setFromBufferAttribute(e),
  7199. t)
  7200. for (var i = 0, r = t.length; i < r; i++) {
  7201. var a = t[i];
  7202. Er.setFromBufferAttribute(a),
  7203. this.morphTargetsRelative ? (_r.addVectors(xr.min, Er.min),
  7204. xr.expandByPoint(_r),
  7205. _r.addVectors(xr.max, Er.max),
  7206. xr.expandByPoint(_r)) : (xr.expandByPoint(Er.min),
  7207. xr.expandByPoint(Er.max))
  7208. }
  7209. xr.getCenter(n);
  7210. for (var o = 0, s = 0, l = e.count; s < l; s++)
  7211. _r.fromBufferAttribute(e, s),
  7212. o = Math.max(o, n.distanceToSquared(_r));
  7213. if (t)
  7214. for (var u = 0, c = t.length; u < c; u++)
  7215. for (var d = t[u], h = this.morphTargetsRelative, p = 0, f = d.count; p < f; p++)
  7216. _r.fromBufferAttribute(d, p),
  7217. h && (br.fromBufferAttribute(e, p),
  7218. _r.add(br)),
  7219. o = Math.max(o, n.distanceToSquared(_r));
  7220. this.boundingSphere.radius = Math.sqrt(o),
  7221. isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this)
  7222. }
  7223. },
  7224. computeFaceNormals: function() {},
  7225. computeVertexNormals: function() {
  7226. var e = this.index
  7227. , t = this.getAttribute("position");
  7228. if (void 0 !== t) {
  7229. var n = this.getAttribute("normal");
  7230. if (void 0 === n)
  7231. n = new nr(new Float32Array(3 * t.count),3),
  7232. this.setAttribute("normal", n);
  7233. else
  7234. for (var i = 0, r = n.count; i < r; i++)
  7235. n.setXYZ(i, 0, 0, 0);
  7236. var a = new Cn
  7237. , o = new Cn
  7238. , s = new Cn
  7239. , l = new Cn
  7240. , u = new Cn
  7241. , c = new Cn
  7242. , d = new Cn
  7243. , h = new Cn;
  7244. if (e)
  7245. for (var p = 0, f = e.count; p < f; p += 3) {
  7246. var m = e.getX(p + 0)
  7247. , v = e.getX(p + 1)
  7248. , g = e.getX(p + 2);
  7249. a.fromBufferAttribute(t, m),
  7250. o.fromBufferAttribute(t, v),
  7251. s.fromBufferAttribute(t, g),
  7252. d.subVectors(s, o),
  7253. h.subVectors(a, o),
  7254. d.cross(h),
  7255. l.fromBufferAttribute(n, m),
  7256. u.fromBufferAttribute(n, v),
  7257. c.fromBufferAttribute(n, g),
  7258. l.add(d),
  7259. u.add(d),
  7260. c.add(d),
  7261. n.setXYZ(m, l.x, l.y, l.z),
  7262. n.setXYZ(v, u.x, u.y, u.z),
  7263. n.setXYZ(g, c.x, c.y, c.z)
  7264. }
  7265. else
  7266. for (var y = 0, w = t.count; y < w; y += 3)
  7267. a.fromBufferAttribute(t, y + 0),
  7268. o.fromBufferAttribute(t, y + 1),
  7269. s.fromBufferAttribute(t, y + 2),
  7270. d.subVectors(s, o),
  7271. h.subVectors(a, o),
  7272. d.cross(h),
  7273. n.setXYZ(y + 0, d.x, d.y, d.z),
  7274. n.setXYZ(y + 1, d.x, d.y, d.z),
  7275. n.setXYZ(y + 2, d.x, d.y, d.z);
  7276. this.normalizeNormals(),
  7277. n.needsUpdate = !0
  7278. }
  7279. },
  7280. merge: function(e, t) {
  7281. if (e && e.isBufferGeometry) {
  7282. void 0 === t && (t = 0,
  7283. console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));
  7284. var n, i = this.attributes;
  7285. for (n in i)
  7286. if (void 0 !== e.attributes[n])
  7287. for (var r = i[n].array, a = e.attributes[n], o = a.array, a = a.itemSize * t, s = Math.min(o.length, r.length - a), l = 0, u = a; l < s; l++,
  7288. u++)
  7289. r[u] = o[l];
  7290. return this
  7291. }
  7292. console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e)
  7293. },
  7294. normalizeNormals: function() {
  7295. for (var e = this.attributes.normal, t = 0, n = e.count; t < n; t++)
  7296. _r.fromBufferAttribute(e, t),
  7297. _r.normalize(),
  7298. e.setXYZ(t, _r.x, _r.y, _r.z)
  7299. },
  7300. toNonIndexed: function() {
  7301. function e(e, t) {
  7302. for (var n = e.array, i = e.itemSize, e = e.normalized, r = new n.constructor(t.length * i), a = 0, o = 0, s = 0, l = t.length; s < l; s++)
  7303. for (var a = t[s] * i, u = 0; u < i; u++)
  7304. r[o++] = n[a++];
  7305. return new nr(r,i,e)
  7306. }
  7307. if (null === this.index)
  7308. return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),
  7309. this;
  7310. var t, n = new Mr, i = this.index.array, r = this.attributes;
  7311. for (t in r) {
  7312. var a = e(r[t], i);
  7313. n.setAttribute(t, a)
  7314. }
  7315. var o, s = this.morphAttributes;
  7316. for (o in s) {
  7317. for (var l = [], u = s[o], c = 0, d = u.length; c < d; c++) {
  7318. var h = e(u[c], i);
  7319. l.push(h)
  7320. }
  7321. n.morphAttributes[o] = l
  7322. }
  7323. n.morphTargetsRelative = this.morphTargetsRelative;
  7324. for (var p = this.groups, f = 0, m = p.length; f < m; f++) {
  7325. var v = p[f];
  7326. n.addGroup(v.start, v.count, v.materialIndex)
  7327. }
  7328. return n
  7329. },
  7330. toJSON: function() {
  7331. var e = {
  7332. metadata: {
  7333. version: 4.5,
  7334. type: "BufferGeometry",
  7335. generator: "BufferGeometry.toJSON"
  7336. }
  7337. };
  7338. if (e.uuid = this.uuid,
  7339. e.type = this.type,
  7340. "" !== this.name && (e.name = this.name),
  7341. 0 < Object.keys(this.userData).length && (e.userData = this.userData),
  7342. void 0 !== this.parameters) {
  7343. var t, n = this.parameters;
  7344. for (t in n)
  7345. void 0 !== n[t] && (e[t] = n[t]);
  7346. return e
  7347. }
  7348. e.data = {
  7349. attributes: {}
  7350. };
  7351. var i = this.index;
  7352. null !== i && (e.data.index = {
  7353. type: i.array.constructor.name,
  7354. array: Array.prototype.slice.call(i.array)
  7355. });
  7356. var r, a = this.attributes;
  7357. for (r in a) {
  7358. var o = a[r]
  7359. , s = o.toJSON(e.data);
  7360. "" !== o.name && (s.name = o.name),
  7361. e.data.attributes[r] = s
  7362. }
  7363. var l, u = {}, c = !1;
  7364. for (l in this.morphAttributes) {
  7365. for (var d = this.morphAttributes[l], h = [], p = 0, f = d.length; p < f; p++) {
  7366. var m = d[p]
  7367. , v = m.toJSON(e.data);
  7368. "" !== m.name && (v.name = m.name),
  7369. h.push(v)
  7370. }
  7371. 0 < h.length && (u[l] = h,
  7372. c = !0)
  7373. }
  7374. c && (e.data.morphAttributes = u,
  7375. e.data.morphTargetsRelative = this.morphTargetsRelative);
  7376. i = this.groups;
  7377. 0 < i.length && (e.data.groups = JSON.parse(JSON.stringify(i)));
  7378. i = this.boundingSphere;
  7379. return null !== i && (e.data.boundingSphere = {
  7380. center: i.center.toArray(),
  7381. radius: i.radius
  7382. }),
  7383. e
  7384. },
  7385. clone: function() {
  7386. return (new Mr).copy(this)
  7387. },
  7388. copy: function(e) {
  7389. this.index = null,
  7390. this.attributes = {},
  7391. this.morphAttributes = {},
  7392. this.groups = [],
  7393. this.boundingBox = null,
  7394. this.boundingSphere = null;
  7395. var t = {};
  7396. this.name = e.name;
  7397. var n = e.index;
  7398. null !== n && this.setIndex(n.clone(t));
  7399. var i, r = e.attributes;
  7400. for (i in r) {
  7401. var a = r[i];
  7402. this.setAttribute(i, a.clone(t))
  7403. }
  7404. var o, s = e.morphAttributes;
  7405. for (o in s) {
  7406. for (var l = [], u = s[o], c = 0, d = u.length; c < d; c++)
  7407. l.push(u[c].clone(t));
  7408. this.morphAttributes[o] = l
  7409. }
  7410. this.morphTargetsRelative = e.morphTargetsRelative;
  7411. for (var h = e.groups, p = 0, f = h.length; p < f; p++) {
  7412. var m = h[p];
  7413. this.addGroup(m.start, m.count, m.materialIndex)
  7414. }
  7415. n = e.boundingBox;
  7416. null !== n && (this.boundingBox = n.clone());
  7417. n = e.boundingSphere;
  7418. return null !== n && (this.boundingSphere = n.clone()),
  7419. this.drawRange.start = e.drawRange.start,
  7420. this.drawRange.count = e.drawRange.count,
  7421. this.userData = e.userData,
  7422. this
  7423. },
  7424. dispose: function() {
  7425. this.dispatchEvent({
  7426. type: "dispose"
  7427. })
  7428. }
  7429. });
  7430. var Ar = new ni
  7431. , Tr = new ti
  7432. , Sr = new qn
  7433. , Cr = new Cn
  7434. , Pr = new Cn
  7435. , Dr = new Cn
  7436. , kr = new Cn
  7437. , Br = new Cn
  7438. , Lr = new Cn
  7439. , Rr = new Cn
  7440. , Fr = new Cn
  7441. , Ir = new Cn
  7442. , Or = new yn
  7443. , zr = new yn
  7444. , Nr = new yn
  7445. , Ur = new Cn
  7446. , Gr = new Cn;
  7447. function Hr() {
  7448. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr
  7449. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new $i;
  7450. Si.call(this),
  7451. this.type = "Mesh",
  7452. this.geometry = e,
  7453. this.material = t,
  7454. this.updateMorphTargets()
  7455. }
  7456. function Vr(e, t, n, i, r, a, o, s) {
  7457. t = t.side === J ? i.intersectTriangle(o, a, r, !0, s) : i.intersectTriangle(r, a, o, t.side !== Y, s);
  7458. if (null === t)
  7459. return null;
  7460. Gr.copy(s),
  7461. Gr.applyMatrix4(e.matrixWorld);
  7462. s = n.ray.origin.distanceTo(Gr);
  7463. return s < n.near || s > n.far ? null : {
  7464. distance: s,
  7465. point: Gr.clone(),
  7466. object: e
  7467. }
  7468. }
  7469. function jr(e, t, n, i, r, a, o, s, l, u, c, d) {
  7470. Cr.fromBufferAttribute(r, u),
  7471. Pr.fromBufferAttribute(r, c),
  7472. Dr.fromBufferAttribute(r, d);
  7473. var h = e.morphTargetInfluences;
  7474. if (t.morphTargets && a && h) {
  7475. Rr.set(0, 0, 0),
  7476. Fr.set(0, 0, 0),
  7477. Ir.set(0, 0, 0);
  7478. for (var p = 0, f = a.length; p < f; p++) {
  7479. var m = h[p]
  7480. , v = a[p];
  7481. 0 !== m && (kr.fromBufferAttribute(v, u),
  7482. Br.fromBufferAttribute(v, c),
  7483. Lr.fromBufferAttribute(v, d),
  7484. o ? (Rr.addScaledVector(kr, m),
  7485. Fr.addScaledVector(Br, m),
  7486. Ir.addScaledVector(Lr, m)) : (Rr.addScaledVector(kr.sub(Cr), m),
  7487. Fr.addScaledVector(Br.sub(Pr), m),
  7488. Ir.addScaledVector(Lr.sub(Dr), m)))
  7489. }
  7490. Cr.add(Rr),
  7491. Pr.add(Fr),
  7492. Dr.add(Ir)
  7493. }
  7494. e.isSkinnedMesh && (e.boneTransform(u, Cr),
  7495. e.boneTransform(c, Pr),
  7496. e.boneTransform(d, Dr));
  7497. i = Vr(e, t, n, i, Cr, Pr, Dr, Ur);
  7498. return i && (s && (Or.fromBufferAttribute(s, u),
  7499. zr.fromBufferAttribute(s, c),
  7500. Nr.fromBufferAttribute(s, d),
  7501. i.uv = Hi.getUV(Ur, Cr, Pr, Dr, Or, zr, Nr, new yn)),
  7502. l && (Or.fromBufferAttribute(l, u),
  7503. zr.fromBufferAttribute(l, c),
  7504. Nr.fromBufferAttribute(l, d),
  7505. i.uv2 = Hi.getUV(Ur, Cr, Pr, Dr, Or, zr, Nr, new yn)),
  7506. l = new Zi(u,c,d),
  7507. Hi.getNormal(Cr, Pr, Dr, l.normal),
  7508. i.face = l),
  7509. i
  7510. }
  7511. Hr.prototype = Object.assign(Object.create(Si.prototype), {
  7512. constructor: Hr,
  7513. isMesh: !0,
  7514. copy: function(e) {
  7515. return Si.prototype.copy.call(this, e),
  7516. void 0 !== e.morphTargetInfluences && (this.morphTargetInfluences = e.morphTargetInfluences.slice()),
  7517. void 0 !== e.morphTargetDictionary && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)),
  7518. this.material = e.material,
  7519. this.geometry = e.geometry,
  7520. this
  7521. },
  7522. updateMorphTargets: function() {
  7523. var e = this.geometry;
  7524. if (e.isBufferGeometry) {
  7525. var t = e.morphAttributes
  7526. , n = Object.keys(t);
  7527. if (0 < n.length) {
  7528. var i = t[n[0]];
  7529. if (void 0 !== i) {
  7530. this.morphTargetInfluences = [],
  7531. this.morphTargetDictionary = {};
  7532. for (var r = 0, a = i.length; r < a; r++) {
  7533. var o = i[r].name || String(r);
  7534. this.morphTargetInfluences.push(0),
  7535. this.morphTargetDictionary[o] = r
  7536. }
  7537. }
  7538. }
  7539. } else {
  7540. e = e.morphTargets;
  7541. void 0 !== e && 0 < e.length && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")
  7542. }
  7543. },
  7544. raycast: function(e, t) {
  7545. var n = this.geometry
  7546. , i = this.material
  7547. , r = this.matrixWorld;
  7548. if (void 0 !== i && (null === n.boundingSphere && n.computeBoundingSphere(),
  7549. Sr.copy(n.boundingSphere),
  7550. Sr.applyMatrix4(r),
  7551. !1 !== e.ray.intersectsSphere(Sr) && (Ar.copy(r).invert(),
  7552. Tr.copy(e.ray).applyMatrix4(Ar),
  7553. null === n.boundingBox || !1 !== Tr.intersectsBox(n.boundingBox))))
  7554. if (n.isBufferGeometry) {
  7555. var a = n.index
  7556. , o = n.attributes.position
  7557. , s = n.morphAttributes.position
  7558. , l = n.morphTargetsRelative
  7559. , u = n.attributes.uv
  7560. , c = n.attributes.uv2
  7561. , d = n.groups
  7562. , h = n.drawRange;
  7563. if (null !== a)
  7564. if (Array.isArray(i))
  7565. for (var p = 0, f = d.length; p < f; p++)
  7566. for (var m = d[p], v = i[m.materialIndex], g = Math.max(m.start, h.start), y = Math.min(m.start + m.count, h.start + h.count); g < y; g += 3) {
  7567. var w, b = a.getX(g), x = a.getX(g + 1), E = a.getX(g + 2);
  7568. (w = jr(this, v, e, Tr, o, s, l, u, c, b, x, E)) && (w.faceIndex = Math.floor(g / 3),
  7569. w.face.materialIndex = m.materialIndex,
  7570. t.push(w))
  7571. }
  7572. else
  7573. for (var _ = Math.max(0, h.start), M = Math.min(a.count, h.start + h.count); _ < M; _ += 3) {
  7574. var A = a.getX(_)
  7575. , T = a.getX(_ + 1)
  7576. , S = a.getX(_ + 2);
  7577. (w = jr(this, i, e, Tr, o, s, l, u, c, A, T, S)) && (w.faceIndex = Math.floor(_ / 3),
  7578. t.push(w))
  7579. }
  7580. else if (void 0 !== o)
  7581. if (Array.isArray(i))
  7582. for (var C = 0, P = d.length; C < P; C++)
  7583. for (var D = d[C], k = i[D.materialIndex], B = Math.max(D.start, h.start), L = Math.min(D.start + D.count, h.start + h.count); B < L; B += 3)
  7584. (w = jr(this, k, e, Tr, o, s, l, u, c, B, B + 1, B + 2)) && (w.faceIndex = Math.floor(B / 3),
  7585. w.face.materialIndex = D.materialIndex,
  7586. t.push(w));
  7587. else
  7588. for (var R = Math.max(0, h.start), F = Math.min(o.count, h.start + h.count); R < F; R += 3)
  7589. (w = jr(this, i, e, Tr, o, s, l, u, c, R, R + 1, R + 2)) && (w.faceIndex = Math.floor(R / 3),
  7590. t.push(w))
  7591. } else if (n.isGeometry) {
  7592. var I, O = Array.isArray(i), z = n.vertices, N = n.faces, n = n.faceVertexUvs[0];
  7593. 0 < n.length && (I = n);
  7594. for (var U = 0, G = N.length; U < G; U++) {
  7595. var H, V, j, W = N[U], X = O ? i[W.materialIndex] : i;
  7596. void 0 !== X && (H = z[W.a],
  7597. V = z[W.b],
  7598. j = z[W.c],
  7599. (w = Vr(this, X, e, Tr, H, V, j, Ur)) && (I && I[U] && (X = I[U],
  7600. Or.copy(X[0]),
  7601. zr.copy(X[1]),
  7602. Nr.copy(X[2]),
  7603. w.uv = Hi.getUV(Ur, H, V, j, Or, zr, Nr, new yn)),
  7604. w.face = W,
  7605. w.faceIndex = U,
  7606. t.push(w)))
  7607. }
  7608. }
  7609. }
  7610. });
  7611. var Wr = function() {
  7612. y(u, Mr);
  7613. var l = w(u);
  7614. function u() {
  7615. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 1;
  7616. O(this, u),
  7617. (e = l.call(this)).type = "BoxBufferGeometry",
  7618. e.parameters = {
  7619. width: t,
  7620. height: n,
  7621. depth: i,
  7622. widthSegments: r,
  7623. heightSegments: a,
  7624. depthSegments: o
  7625. };
  7626. var D = g(e)
  7627. , r = Math.floor(r)
  7628. , a = Math.floor(a)
  7629. , o = Math.floor(o)
  7630. , k = []
  7631. , B = []
  7632. , L = []
  7633. , R = []
  7634. , F = 0
  7635. , I = 0;
  7636. function s(e, t, n, i, r, a, o, s, l, u, c) {
  7637. for (var d = a / l, h = o / u, p = a / 2, f = o / 2, m = s / 2, v = l + 1, g = u + 1, y = 0, w = 0, b = new Cn, x = 0; x < g; x++)
  7638. for (var E = x * h - f, _ = 0; _ < v; _++)
  7639. b[e] = (_ * d - p) * i,
  7640. b[t] = E * r,
  7641. b[n] = m,
  7642. B.push(b.x, b.y, b.z),
  7643. b[e] = 0,
  7644. b[t] = 0,
  7645. b[n] = 0 < s ? 1 : -1,
  7646. L.push(b.x, b.y, b.z),
  7647. R.push(_ / l),
  7648. R.push(1 - x / u),
  7649. y += 1;
  7650. for (var M = 0; M < u; M++)
  7651. for (var A = 0; A < l; A++) {
  7652. var T = F + A + v * M
  7653. , S = F + A + v * (M + 1)
  7654. , C = F + (A + 1) + v * (M + 1)
  7655. , P = F + (A + 1) + v * M;
  7656. k.push(T, S, P),
  7657. k.push(S, C, P),
  7658. w += 6
  7659. }
  7660. D.addGroup(I, w, c),
  7661. I += w,
  7662. F += y
  7663. }
  7664. return s("z", "y", "x", -1, -1, i, n, t, o, a, 0),
  7665. s("z", "y", "x", 1, -1, i, n, -t, o, a, 1),
  7666. s("x", "z", "y", 1, 1, t, i, n, r, o, 2),
  7667. s("x", "z", "y", 1, -1, t, i, -n, r, o, 3),
  7668. s("x", "y", "z", 1, -1, t, n, i, r, a, 4),
  7669. s("x", "y", "z", -1, -1, t, n, -i, r, a, 5),
  7670. e.setIndex(k),
  7671. e.setAttribute("position", new dr(B,3)),
  7672. e.setAttribute("normal", new dr(L,3)),
  7673. e.setAttribute("uv", new dr(R,2)),
  7674. e
  7675. }
  7676. return h(u)
  7677. }();
  7678. function Xr(e) {
  7679. var t, n = {};
  7680. for (t in e)
  7681. for (var i in n[t] = {},
  7682. e[t]) {
  7683. var r = e[t][i];
  7684. r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture) ? n[t][i] = r.clone() : Array.isArray(r) ? n[t][i] = r.slice() : n[t][i] = r
  7685. }
  7686. return n
  7687. }
  7688. function qr(e) {
  7689. for (var t = {}, n = 0; n < e.length; n++) {
  7690. var i, r = Xr(e[n]);
  7691. for (i in r)
  7692. t[i] = r[i]
  7693. }
  7694. return t
  7695. }
  7696. var Jr = {
  7697. clone: Xr,
  7698. merge: qr
  7699. }
  7700. , Yr = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"
  7701. , Zr = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
  7702. function Qr(e) {
  7703. Ki.call(this),
  7704. this.type = "ShaderMaterial",
  7705. this.defines = {},
  7706. this.uniforms = {},
  7707. this.vertexShader = Yr,
  7708. this.fragmentShader = Zr,
  7709. this.lineWidth = 1,
  7710. this.wireframe = !1,
  7711. this.wireframelineWidth = 1,
  7712. this.fog = !1,
  7713. this.lights = !1,
  7714. this.clipping = !1,
  7715. this.skinning = !1,
  7716. this.morphTargets = !1,
  7717. this.morphNormals = !1,
  7718. this.extensions = {
  7719. derivatives: !1,
  7720. fragDepth: !1,
  7721. drawBuffers: !1,
  7722. shaderTextureLOD: !1
  7723. },
  7724. this.defaultAttributeValues = {
  7725. color: [1, 1, 1],
  7726. uv: [0, 0],
  7727. uv2: [0, 0]
  7728. },
  7729. this.index0AttributeName = void 0,
  7730. this.uniformsNeedUpdate = !1,
  7731. this.glslVersion = null,
  7732. void 0 !== e && (void 0 !== e.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
  7733. this.setValues(e))
  7734. }
  7735. function Kr() {
  7736. Si.call(this),
  7737. this.type = "Camera",
  7738. this.matrixWorldInverse = new ni,
  7739. this.projectionMatrix = new ni,
  7740. this.projectionMatrixInverse = new ni
  7741. }
  7742. function $r() {
  7743. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 50
  7744. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1
  7745. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .1
  7746. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2e3;
  7747. Kr.call(this),
  7748. this.type = "PerspectiveCamera",
  7749. this.fov = e,
  7750. this.zoom = 1,
  7751. this.near = n,
  7752. this.far = i,
  7753. this.focus = 10,
  7754. this.aspect = t,
  7755. this.view = null,
  7756. this.filmGauge = 35,
  7757. this.filmOffset = 0,
  7758. this.updateProjectionMatrix()
  7759. }
  7760. ((Qr.prototype = Object.create(Ki.prototype)).constructor = Qr).prototype.isShaderMaterial = !0,
  7761. Qr.prototype.copy = function(e) {
  7762. return Ki.prototype.copy.call(this, e),
  7763. this.fragmentShader = e.fragmentShader,
  7764. this.vertexShader = e.vertexShader,
  7765. this.uniforms = Xr(e.uniforms),
  7766. this.defines = Object.assign({}, e.defines),
  7767. this.wireframe = e.wireframe,
  7768. this.wireframelineWidth = e.wireframelineWidth,
  7769. this.lights = e.lights,
  7770. this.clipping = e.clipping,
  7771. this.skinning = e.skinning,
  7772. this.morphTargets = e.morphTargets,
  7773. this.morphNormals = e.morphNormals,
  7774. this.extensions = Object.assign({}, e.extensions),
  7775. this.glslVersion = e.glslVersion,
  7776. this
  7777. }
  7778. ,
  7779. Qr.prototype.toJSON = function(e) {
  7780. var t, n = Ki.prototype.toJSON.call(this, e);
  7781. for (t in n.glslVersion = this.glslVersion,
  7782. n.uniforms = {},
  7783. this.uniforms) {
  7784. var i = this.uniforms[t].value;
  7785. i && i.isTexture ? n.uniforms[t] = {
  7786. type: "t",
  7787. value: i.toJSON(e).uuid
  7788. } : i && i.isColor ? n.uniforms[t] = {
  7789. type: "c",
  7790. value: i.getHex()
  7791. } : i && i.isVector2 ? n.uniforms[t] = {
  7792. type: "v2",
  7793. value: i.toArray()
  7794. } : i && i.isVector3 ? n.uniforms[t] = {
  7795. type: "v3",
  7796. value: i.toArray()
  7797. } : i && i.isVector4 ? n.uniforms[t] = {
  7798. type: "v4",
  7799. value: i.toArray()
  7800. } : i && i.isMatrix3 ? n.uniforms[t] = {
  7801. type: "m3",
  7802. value: i.toArray()
  7803. } : i && i.isMatrix4 ? n.uniforms[t] = {
  7804. type: "m4",
  7805. value: i.toArray()
  7806. } : n.uniforms[t] = {
  7807. value: i
  7808. }
  7809. }
  7810. 0 < Object.keys(this.defines).length && (n.defines = this.defines),
  7811. n.vertexShader = this.vertexShader,
  7812. n.fragmentShader = this.fragmentShader;
  7813. var r, a = {};
  7814. for (r in this.extensions)
  7815. !0 === this.extensions[r] && (a[r] = !0);
  7816. return 0 < Object.keys(a).length && (n.extensions = a),
  7817. n
  7818. }
  7819. ,
  7820. Kr.prototype = Object.assign(Object.create(Si.prototype), {
  7821. constructor: Kr,
  7822. isCamera: !0,
  7823. copy: function(e, t) {
  7824. return Si.prototype.copy.call(this, e, t),
  7825. this.matrixWorldInverse.copy(e.matrixWorldInverse),
  7826. this.projectionMatrix.copy(e.projectionMatrix),
  7827. this.projectionMatrixInverse.copy(e.projectionMatrixInverse),
  7828. this
  7829. },
  7830. getWorldDirection: function(e) {
  7831. void 0 === e && (console.warn("THREE.Camera: .getWorldDirection() target is now required"),
  7832. e = new Cn),
  7833. this.updateWorldMatrix(!0, !1);
  7834. var t = this.matrixWorld.elements;
  7835. return e.set(-t[8], -t[9], -t[10]).normalize()
  7836. },
  7837. updateMatrixWorld: function(e) {
  7838. Si.prototype.updateMatrixWorld.call(this, e),
  7839. this.matrixWorldInverse.copy(this.matrixWorld).invert()
  7840. },
  7841. updateWorldMatrix: function(e, t) {
  7842. Si.prototype.updateWorldMatrix.call(this, e, t),
  7843. this.matrixWorldInverse.copy(this.matrixWorld).invert()
  7844. },
  7845. clone: function() {
  7846. return (new this.constructor).copy(this)
  7847. }
  7848. }),
  7849. $r.prototype = Object.assign(Object.create(Kr.prototype), {
  7850. constructor: $r,
  7851. isPerspectiveCamera: !0,
  7852. copy: function(e, t) {
  7853. return Kr.prototype.copy.call(this, e, t),
  7854. this.fov = e.fov,
  7855. this.zoom = e.zoom,
  7856. this.near = e.near,
  7857. this.far = e.far,
  7858. this.focus = e.focus,
  7859. this.aspect = e.aspect,
  7860. this.view = null === e.view ? null : Object.assign({}, e.view),
  7861. this.filmGauge = e.filmGauge,
  7862. this.filmOffset = e.filmOffset,
  7863. this
  7864. },
  7865. setFocalLength: function(e) {
  7866. e = .5 * this.getFilmHeight() / e;
  7867. this.fov = 2 * gn.RAD2DEG * Math.atan(e),
  7868. this.updateProjectionMatrix()
  7869. },
  7870. getFocalLength: function() {
  7871. var e = Math.tan(.5 * gn.DEG2RAD * this.fov);
  7872. return .5 * this.getFilmHeight() / e
  7873. },
  7874. getEffectiveFOV: function() {
  7875. return 2 * gn.RAD2DEG * Math.atan(Math.tan(.5 * gn.DEG2RAD * this.fov) / this.zoom)
  7876. },
  7877. getFilmWidth: function() {
  7878. return this.filmGauge * Math.min(this.aspect, 1)
  7879. },
  7880. getFilmHeight: function() {
  7881. return this.filmGauge / Math.max(this.aspect, 1)
  7882. },
  7883. setViewOffset: function(e, t, n, i, r, a) {
  7884. this.aspect = e / t,
  7885. null === this.view && (this.view = {
  7886. enabled: !0,
  7887. fullWidth: 1,
  7888. fullHeight: 1,
  7889. offsetX: 0,
  7890. offsetY: 0,
  7891. width: 1,
  7892. height: 1
  7893. }),
  7894. this.view.enabled = !0,
  7895. this.view.fullWidth = e,
  7896. this.view.fullHeight = t,
  7897. this.view.offsetX = n,
  7898. this.view.offsetY = i,
  7899. this.view.width = r,
  7900. this.view.height = a,
  7901. this.updateProjectionMatrix()
  7902. },
  7903. clearViewOffset: function() {
  7904. null !== this.view && (this.view.enabled = !1),
  7905. this.updateProjectionMatrix()
  7906. },
  7907. updateProjectionMatrix: function() {
  7908. var e, t = this.near, n = t * Math.tan(.5 * gn.DEG2RAD * this.fov) / this.zoom, i = 2 * n, r = this.aspect * i, a = -.5 * r, o = this.view;
  7909. null !== this.view && this.view.enabled && (e = o.fullWidth,
  7910. s = o.fullHeight,
  7911. a += o.offsetX * r / e,
  7912. n -= o.offsetY * i / s,
  7913. r *= o.width / e,
  7914. i *= o.height / s);
  7915. var s = this.filmOffset;
  7916. 0 !== s && (a += t * s / this.getFilmWidth()),
  7917. this.projectionMatrix.makePerspective(a, a + r, n, n - i, t, this.far),
  7918. this.projectionMatrixInverse.copy(this.projectionMatrix).invert()
  7919. },
  7920. toJSON: function(e) {
  7921. e = Si.prototype.toJSON.call(this, e);
  7922. return e.object.fov = this.fov,
  7923. e.object.zoom = this.zoom,
  7924. e.object.near = this.near,
  7925. e.object.far = this.far,
  7926. e.object.focus = this.focus,
  7927. e.object.aspect = this.aspect,
  7928. null !== this.view && (e.object.view = Object.assign({}, this.view)),
  7929. e.object.filmGauge = this.filmGauge,
  7930. e.object.filmOffset = this.filmOffset,
  7931. e
  7932. }
  7933. });
  7934. function ea(e, t, a) {
  7935. var o, s, l, u, c, d;
  7936. Si.call(this),
  7937. this.type = "CubeCamera",
  7938. !0 === a.isWebGLCubeRenderTarget ? (this.renderTarget = a,
  7939. (o = new $r(90,1,e,t)).layers = this.layers,
  7940. o.up.set(0, -1, 0),
  7941. o.lookAt(new Cn(1,0,0)),
  7942. this.add(o),
  7943. (s = new $r(90,1,e,t)).layers = this.layers,
  7944. s.up.set(0, -1, 0),
  7945. s.lookAt(new Cn(-1,0,0)),
  7946. this.add(s),
  7947. (l = new $r(90,1,e,t)).layers = this.layers,
  7948. l.up.set(0, 0, 1),
  7949. l.lookAt(new Cn(0,1,0)),
  7950. this.add(l),
  7951. (u = new $r(90,1,e,t)).layers = this.layers,
  7952. u.up.set(0, 0, -1),
  7953. u.lookAt(new Cn(0,-1,0)),
  7954. this.add(u),
  7955. (c = new $r(90,1,e,t)).layers = this.layers,
  7956. c.up.set(0, -1, 0),
  7957. c.lookAt(new Cn(0,0,1)),
  7958. this.add(c),
  7959. (d = new $r(90,1,e,t)).layers = this.layers,
  7960. d.up.set(0, -1, 0),
  7961. d.lookAt(new Cn(0,0,-1)),
  7962. this.add(d),
  7963. this.update = function(e, t) {
  7964. null === this.parent && this.updateMatrixWorld();
  7965. var n = e.xr.enabled
  7966. , i = e.getRenderTarget();
  7967. e.xr.enabled = !1;
  7968. var r = a.texture.generateMipmaps;
  7969. a.texture.generateMipmaps = !1,
  7970. e.setRenderTarget(a, 0),
  7971. e.render(t, o),
  7972. e.setRenderTarget(a, 1),
  7973. e.render(t, s),
  7974. e.setRenderTarget(a, 2),
  7975. e.render(t, l),
  7976. e.setRenderTarget(a, 3),
  7977. e.render(t, u),
  7978. e.setRenderTarget(a, 4),
  7979. e.render(t, c),
  7980. a.texture.generateMipmaps = r,
  7981. e.setRenderTarget(a, 5),
  7982. e.render(t, d),
  7983. e.setRenderTarget(i),
  7984. e.xr.enabled = n
  7985. }
  7986. ) : console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")
  7987. }
  7988. function ta(e, t, n, i, r, a, o, s, l, u) {
  7989. En.call(this, e = void 0 !== e ? e : [], t = void 0 !== t ? t : L, n, i, r, a, o = void 0 !== o ? o : $e, s, l, u),
  7990. this.flipY = !1,
  7991. this._needsFlipEnvMap = !0
  7992. }
  7993. function na(e, t, n) {
  7994. Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),
  7995. t = n),
  7996. An.call(this, e, e, t),
  7997. this.texture = new ta(void 0,(t = t || {}).mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),
  7998. this.texture._needsFlipEnvMap = !1
  7999. }
  8000. function ia(e, t, n, i, r, a, o, s, l, u, c, d) {
  8001. En.call(this, null, a, o, s, l, u, i, r, c, d),
  8002. this.image = {
  8003. data: e || null,
  8004. width: t || 1,
  8005. height: n || 1
  8006. },
  8007. this.magFilter = void 0 !== l ? l : Re,
  8008. this.minFilter = void 0 !== u ? u : Re,
  8009. this.generateMipmaps = !1,
  8010. this.flipY = !1,
  8011. this.unpackAlignment = 1,
  8012. this.needsUpdate = !0
  8013. }
  8014. (ea.prototype = Object.create(Si.prototype)).constructor = ea,
  8015. ((ta.prototype = Object.create(En.prototype)).constructor = ta).prototype.isCubeTexture = !0,
  8016. Object.defineProperty(ta.prototype, "images", {
  8017. get: function() {
  8018. return this.image
  8019. },
  8020. set: function(e) {
  8021. this.image = e
  8022. }
  8023. }),
  8024. ((na.prototype = Object.create(An.prototype)).constructor = na).prototype.isWebGLCubeRenderTarget = !0,
  8025. na.prototype.fromEquirectangularTexture = function(e, t) {
  8026. this.texture.type = t.type,
  8027. this.texture.format = et,
  8028. this.texture.encoding = t.encoding,
  8029. this.texture.generateMipmaps = t.generateMipmaps,
  8030. this.texture.minFilter = t.minFilter,
  8031. this.texture.magFilter = t.magFilter;
  8032. var n = {
  8033. tEquirect: {
  8034. value: null
  8035. }
  8036. }
  8037. , i = "\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t"
  8038. , r = "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t"
  8039. , a = new Wr(5,5,5)
  8040. , r = new Qr({
  8041. name: "CubemapFromEquirect",
  8042. uniforms: Xr(n),
  8043. vertexShader: i,
  8044. fragmentShader: r,
  8045. side: J,
  8046. blending: Z
  8047. });
  8048. r.uniforms.tEquirect.value = t;
  8049. a = new Hr(a,r),
  8050. r = t.minFilter;
  8051. return t.minFilter === Ne && (t.minFilter = Oe),
  8052. new ea(1,10,this).update(e, a),
  8053. t.minFilter = r,
  8054. a.geometry.dispose(),
  8055. a.material.dispose(),
  8056. this
  8057. }
  8058. ,
  8059. na.prototype.clear = function(e, t, n, i) {
  8060. for (var r = e.getRenderTarget(), a = 0; a < 6; a++)
  8061. e.setRenderTarget(this, a),
  8062. e.clear(t, n, i);
  8063. e.setRenderTarget(r)
  8064. }
  8065. ,
  8066. ((ia.prototype = Object.create(En.prototype)).constructor = ia).prototype.isDataTexture = !0;
  8067. var ra = new qn
  8068. , aa = new Cn
  8069. , oa = function() {
  8070. function o(e, t, n, i, r, a) {
  8071. O(this, o),
  8072. this.planes = [void 0 !== e ? e : new ki, void 0 !== t ? t : new ki, void 0 !== n ? n : new ki, void 0 !== i ? i : new ki, void 0 !== r ? r : new ki, void 0 !== a ? a : new ki]
  8073. }
  8074. return h(o, [{
  8075. key: "set",
  8076. value: function(e, t, n, i, r, a) {
  8077. var o = this.planes;
  8078. return o[0].copy(e),
  8079. o[1].copy(t),
  8080. o[2].copy(n),
  8081. o[3].copy(i),
  8082. o[4].copy(r),
  8083. o[5].copy(a),
  8084. this
  8085. }
  8086. }, {
  8087. key: "clone",
  8088. value: function() {
  8089. return (new this.constructor).copy(this)
  8090. }
  8091. }, {
  8092. key: "copy",
  8093. value: function(e) {
  8094. for (var t = this.planes, n = 0; n < 6; n++)
  8095. t[n].copy(e.planes[n]);
  8096. return this
  8097. }
  8098. }, {
  8099. key: "setFromProjectionMatrix",
  8100. value: function(e) {
  8101. var t = this.planes
  8102. , n = e.elements
  8103. , i = n[0]
  8104. , r = n[1]
  8105. , a = n[2]
  8106. , o = n[3]
  8107. , s = n[4]
  8108. , l = n[5]
  8109. , u = n[6]
  8110. , c = n[7]
  8111. , d = n[8]
  8112. , h = n[9]
  8113. , p = n[10]
  8114. , f = n[11]
  8115. , m = n[12]
  8116. , v = n[13]
  8117. , e = n[14]
  8118. , n = n[15];
  8119. return t[0].setComponents(o - i, c - s, f - d, n - m).normalize(),
  8120. t[1].setComponents(o + i, c + s, f + d, n + m).normalize(),
  8121. t[2].setComponents(o + r, c + l, f + h, n + v).normalize(),
  8122. t[3].setComponents(o - r, c - l, f - h, n - v).normalize(),
  8123. t[4].setComponents(o - a, c - u, f - p, n - e).normalize(),
  8124. t[5].setComponents(o + a, c + u, f + p, n + e).normalize(),
  8125. this
  8126. }
  8127. }, {
  8128. key: "intersectsObject",
  8129. value: function(e) {
  8130. var t = e.geometry;
  8131. return null === t.boundingSphere && t.computeBoundingSphere(),
  8132. ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),
  8133. this.intersectsSphere(ra)
  8134. }
  8135. }, {
  8136. key: "intersectsSprite",
  8137. value: function(e) {
  8138. return ra.center.set(0, 0, 0),
  8139. ra.radius = .7071067811865476,
  8140. ra.applyMatrix4(e.matrixWorld),
  8141. this.intersectsSphere(ra)
  8142. }
  8143. }, {
  8144. key: "intersectsSphere",
  8145. value: function(e) {
  8146. for (var t = this.planes, n = e.center, i = -e.radius, r = 0; r < 6; r++)
  8147. if (t[r].distanceToPoint(n) < i)
  8148. return !1;
  8149. return !0
  8150. }
  8151. }, {
  8152. key: "intersectsBox",
  8153. value: function(e) {
  8154. for (var t = this.planes, n = 0; n < 6; n++) {
  8155. var i = t[n];
  8156. if (aa.x = (0 < i.normal.x ? e.max : e.min).x,
  8157. aa.y = (0 < i.normal.y ? e.max : e.min).y,
  8158. aa.z = (0 < i.normal.z ? e.max : e.min).z,
  8159. i.distanceToPoint(aa) < 0)
  8160. return !1
  8161. }
  8162. return !0
  8163. }
  8164. }, {
  8165. key: "containsPoint",
  8166. value: function(e) {
  8167. for (var t = this.planes, n = 0; n < 6; n++)
  8168. if (t[n].distanceToPoint(e) < 0)
  8169. return !1;
  8170. return !0
  8171. }
  8172. }]),
  8173. o
  8174. }();
  8175. function sa() {
  8176. var n = null
  8177. , e = !1
  8178. , i = null
  8179. , r = null;
  8180. function a(e, t) {
  8181. i(e, t),
  8182. r = n.requestAnimationFrame(a)
  8183. }
  8184. return {
  8185. start: function() {
  8186. !0 !== e && null !== i && (r = n.requestAnimationFrame(a),
  8187. e = !0)
  8188. },
  8189. stop: function() {
  8190. n.cancelAnimationFrame(r),
  8191. e = !1
  8192. },
  8193. setAnimationLoop: function(e) {
  8194. i = e
  8195. },
  8196. setContext: function(e) {
  8197. n = e
  8198. }
  8199. }
  8200. }
  8201. function la(l, e) {
  8202. var u = e.isWebGL2
  8203. , c = new WeakMap;
  8204. return {
  8205. get: function(e) {
  8206. return e.isInterleavedBufferAttribute && (e = e.data),
  8207. c.get(e)
  8208. },
  8209. remove: function(e) {
  8210. e.isInterleavedBufferAttribute && (e = e.data);
  8211. var t = c.get(e);
  8212. t && (l.deleteBuffer(t.buffer),
  8213. c.delete(e))
  8214. },
  8215. update: function(e, t) {
  8216. var n, i, r, a, o, s;
  8217. e.isGLBufferAttribute ? (!(s = c.get(e)) || s.version < e.version) && c.set(e, {
  8218. buffer: e.buffer,
  8219. type: e.type,
  8220. bytesPerElement: e.elementSize,
  8221. version: e.version
  8222. }) : (e.isInterleavedBufferAttribute && (e = e.data),
  8223. void 0 === (n = c.get(e)) ? c.set(e, (r = t,
  8224. a = (i = e).array,
  8225. o = i.usage,
  8226. s = l.createBuffer(),
  8227. l.bindBuffer(r, s),
  8228. l.bufferData(r, a, o),
  8229. i.onUploadCallback(),
  8230. o = 5126,
  8231. a instanceof Float32Array ? o = 5126 : a instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : a instanceof Uint16Array ? i.isFloat16BufferAttribute ? u ? o = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : o = 5123 : a instanceof Int16Array ? o = 5122 : a instanceof Uint32Array ? o = 5125 : a instanceof Int32Array ? o = 5124 : a instanceof Int8Array ? o = 5120 : a instanceof Uint8Array && (o = 5121),
  8232. {
  8233. buffer: s,
  8234. type: o,
  8235. bytesPerElement: a.BYTES_PER_ELEMENT,
  8236. version: i.version
  8237. })) : n.version < e.version && (o = n.buffer,
  8238. a = t,
  8239. t = (i = e).array,
  8240. i = i.updateRange,
  8241. l.bindBuffer(a, o),
  8242. -1 === i.count ? l.bufferSubData(a, 0, t) : (u ? l.bufferSubData(a, i.offset * t.BYTES_PER_ELEMENT, t, i.offset, i.count) : l.bufferSubData(a, i.offset * t.BYTES_PER_ELEMENT, t.subarray(i.offset, i.offset + i.count)),
  8243. i.count = -1),
  8244. n.version = e.version))
  8245. }
  8246. }
  8247. }
  8248. var ua = function() {
  8249. y(T, Mr);
  8250. var A = w(T);
  8251. function T() {
  8252. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1;
  8253. O(this, T),
  8254. (e = A.call(this)).type = "PlaneBufferGeometry",
  8255. e.parameters = {
  8256. width: t,
  8257. height: n,
  8258. widthSegments: i,
  8259. heightSegments: r
  8260. };
  8261. for (var a = t / 2, o = n / 2, s = Math.floor(i), l = Math.floor(r), u = s + 1, c = l + 1, d = t / s, h = n / l, p = [], f = [], m = [], v = [], g = 0; g < c; g++)
  8262. for (var y = g * h - o, w = 0; w < u; w++)
  8263. f.push(w * d - a, -y, 0),
  8264. m.push(0, 0, 1),
  8265. v.push(w / s),
  8266. v.push(1 - g / l);
  8267. for (var b = 0; b < l; b++)
  8268. for (var x = 0; x < s; x++) {
  8269. var E = x + u * (b + 1)
  8270. , _ = x + 1 + u * (b + 1)
  8271. , M = x + 1 + u * b;
  8272. p.push(x + u * b, E, M),
  8273. p.push(E, _, M)
  8274. }
  8275. return e.setIndex(p),
  8276. e.setAttribute("position", new dr(f,3)),
  8277. e.setAttribute("normal", new dr(m,3)),
  8278. e.setAttribute("uv", new dr(v,2)),
  8279. e
  8280. }
  8281. return h(T)
  8282. }()
  8283. , ca = {
  8284. alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",
  8285. alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
  8286. alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",
  8287. aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",
  8288. aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",
  8289. begin_vertex: "vec3 transformed = vec3( position );",
  8290. beginnormal_vertex: "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",
  8291. bsdfs: "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",
  8292. bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",
  8293. clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",
  8294. clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",
  8295. clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",
  8296. clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",
  8297. color_fragment: "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",
  8298. color_pars_fragment: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",
  8299. color_pars_vertex: "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",
  8300. color_vertex: "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",
  8301. common: "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",
  8302. cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",
  8303. defaultnormal_vertex: "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",
  8304. displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",
  8305. displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",
  8306. emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",
  8307. emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",
  8308. encodings_fragment: "gl_FragColor = linearToOutputTexel( gl_FragColor );",
  8309. encodings_pars_fragment: "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",
  8310. envmap_fragment: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",
  8311. envmap_common_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",
  8312. envmap_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",
  8313. envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",
  8314. envmap_physical_pars_fragment: "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",
  8315. envmap_vertex: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",
  8316. fog_vertex: "#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",
  8317. fog_pars_vertex: "#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",
  8318. fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",
  8319. fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",
  8320. gradientmap_pars_fragment: "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",
  8321. lightmap_fragment: "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",
  8322. lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",
  8323. lights_lambert_vertex: "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",
  8324. lights_pars_begin: "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",
  8325. lights_toon_fragment: "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",
  8326. lights_toon_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",
  8327. lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",
  8328. lights_phong_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",
  8329. lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",
  8330. lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",
  8331. lights_fragment_begin: "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",
  8332. lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",
  8333. lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",
  8334. logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",
  8335. logdepthbuf_pars_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",
  8336. logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",
  8337. logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",
  8338. map_fragment: "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",
  8339. map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",
  8340. map_particle_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",
  8341. map_particle_pars_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
  8342. metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",
  8343. metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",
  8344. morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",
  8345. morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",
  8346. morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",
  8347. normal_fragment_begin: "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",
  8348. normal_fragment_maps: "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",
  8349. normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",
  8350. clearcoat_normal_fragment_begin: "#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",
  8351. clearcoat_normal_fragment_maps: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",
  8352. clearcoat_pars_fragment: "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",
  8353. packing: "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",
  8354. premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",
  8355. project_vertex: "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",
  8356. dithering_fragment: "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",
  8357. dithering_pars_fragment: "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",
  8358. roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",
  8359. roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",
  8360. shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",
  8361. shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",
  8362. shadowmap_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",
  8363. shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",
  8364. skinbase_vertex: "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",
  8365. skinning_pars_vertex: "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",
  8366. skinning_vertex: "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",
  8367. skinnormal_vertex: "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",
  8368. specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",
  8369. specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",
  8370. tonemapping_fragment: "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",
  8371. tonemapping_pars_fragment: "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",
  8372. transmissionmap_fragment: "#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",
  8373. transmissionmap_pars_fragment: "#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",
  8374. uv_pars_fragment: "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",
  8375. uv_pars_vertex: "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",
  8376. uv_vertex: "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",
  8377. uv2_pars_fragment: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",
  8378. uv2_pars_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",
  8379. uv2_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",
  8380. worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",
  8381. background_frag: "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
  8382. background_vert: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",
  8383. cube_frag: "#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
  8384. cube_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",
  8385. depth_frag: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",
  8386. depth_vert: "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",
  8387. distanceRGBA_frag: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",
  8388. distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",
  8389. equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
  8390. equirect_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",
  8391. linedashed_frag: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
  8392. linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",
  8393. meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8394. meshbasic_vert: "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",
  8395. meshlambert_frag: "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8396. meshlambert_vert: "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
  8397. meshmatcap_frag: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8398. meshmatcap_vert: "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",
  8399. meshtoon_frag: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8400. meshtoon_vert: "#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
  8401. meshphong_frag: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8402. meshphong_vert: "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
  8403. meshphysical_frag: "#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
  8404. meshphysical_vert: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
  8405. normal_frag: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",
  8406. normal_vert: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",
  8407. points_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
  8408. points_vert: "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",
  8409. shadow_frag: "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",
  8410. shadow_vert: "#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
  8411. sprite_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",
  8412. sprite_vert: "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"
  8413. }
  8414. , da = {
  8415. common: {
  8416. diffuse: {
  8417. value: new Yi(15658734)
  8418. },
  8419. opacity: {
  8420. value: 1
  8421. },
  8422. map: {
  8423. value: null
  8424. },
  8425. uvTransform: {
  8426. value: new wn
  8427. },
  8428. uv2Transform: {
  8429. value: new wn
  8430. },
  8431. alphaMap: {
  8432. value: null
  8433. }
  8434. },
  8435. specularmap: {
  8436. specularMap: {
  8437. value: null
  8438. }
  8439. },
  8440. envmap: {
  8441. envMap: {
  8442. value: null
  8443. },
  8444. flipEnvMap: {
  8445. value: -1
  8446. },
  8447. reflectivity: {
  8448. value: 1
  8449. },
  8450. refractionRatio: {
  8451. value: .98
  8452. },
  8453. maxMipLevel: {
  8454. value: 0
  8455. }
  8456. },
  8457. aomap: {
  8458. aoMap: {
  8459. value: null
  8460. },
  8461. aoMapIntensity: {
  8462. value: 1
  8463. }
  8464. },
  8465. lightmap: {
  8466. lightMap: {
  8467. value: null
  8468. },
  8469. lightMapIntensity: {
  8470. value: 1
  8471. }
  8472. },
  8473. emissivemap: {
  8474. emissiveMap: {
  8475. value: null
  8476. }
  8477. },
  8478. bumpmap: {
  8479. bumpMap: {
  8480. value: null
  8481. },
  8482. bumpScale: {
  8483. value: 1
  8484. }
  8485. },
  8486. normalmap: {
  8487. normalMap: {
  8488. value: null
  8489. },
  8490. normalScale: {
  8491. value: new yn(1,1)
  8492. }
  8493. },
  8494. displacementmap: {
  8495. displacementMap: {
  8496. value: null
  8497. },
  8498. displacementScale: {
  8499. value: 1
  8500. },
  8501. displacementBias: {
  8502. value: 0
  8503. }
  8504. },
  8505. roughnessmap: {
  8506. roughnessMap: {
  8507. value: null
  8508. }
  8509. },
  8510. metalnessmap: {
  8511. metalnessMap: {
  8512. value: null
  8513. }
  8514. },
  8515. gradientmap: {
  8516. gradientMap: {
  8517. value: null
  8518. }
  8519. },
  8520. fog: {
  8521. fogDensity: {
  8522. value: 25e-5
  8523. },
  8524. fogNear: {
  8525. value: 1
  8526. },
  8527. fogFar: {
  8528. value: 2e3
  8529. },
  8530. fogColor: {
  8531. value: new Yi(16777215)
  8532. }
  8533. },
  8534. lights: {
  8535. ambientLightColor: {
  8536. value: []
  8537. },
  8538. lightProbe: {
  8539. value: []
  8540. },
  8541. directionalLights: {
  8542. value: [],
  8543. properties: {
  8544. direction: {},
  8545. color: {}
  8546. }
  8547. },
  8548. directionalLightShadows: {
  8549. value: [],
  8550. properties: {
  8551. shadowBias: {},
  8552. shadowNormalBias: {},
  8553. shadowRadius: {},
  8554. shadowMapSize: {}
  8555. }
  8556. },
  8557. directionalShadowMap: {
  8558. value: []
  8559. },
  8560. directionalShadowMatrix: {
  8561. value: []
  8562. },
  8563. spotLights: {
  8564. value: [],
  8565. properties: {
  8566. color: {},
  8567. position: {},
  8568. direction: {},
  8569. distance: {},
  8570. coneCos: {},
  8571. penumbraCos: {},
  8572. decay: {}
  8573. }
  8574. },
  8575. spotLightShadows: {
  8576. value: [],
  8577. properties: {
  8578. shadowBias: {},
  8579. shadowNormalBias: {},
  8580. shadowRadius: {},
  8581. shadowMapSize: {}
  8582. }
  8583. },
  8584. spotShadowMap: {
  8585. value: []
  8586. },
  8587. spotShadowMatrix: {
  8588. value: []
  8589. },
  8590. pointLights: {
  8591. value: [],
  8592. properties: {
  8593. color: {},
  8594. position: {},
  8595. decay: {},
  8596. distance: {}
  8597. }
  8598. },
  8599. pointLightShadows: {
  8600. value: [],
  8601. properties: {
  8602. shadowBias: {},
  8603. shadowNormalBias: {},
  8604. shadowRadius: {},
  8605. shadowMapSize: {},
  8606. shadowCameraNear: {},
  8607. shadowCameraFar: {}
  8608. }
  8609. },
  8610. pointShadowMap: {
  8611. value: []
  8612. },
  8613. pointShadowMatrix: {
  8614. value: []
  8615. },
  8616. hemisphereLights: {
  8617. value: [],
  8618. properties: {
  8619. direction: {},
  8620. skyColor: {},
  8621. groundColor: {}
  8622. }
  8623. },
  8624. rectAreaLights: {
  8625. value: [],
  8626. properties: {
  8627. color: {},
  8628. position: {},
  8629. width: {},
  8630. height: {}
  8631. }
  8632. },
  8633. ltc_1: {
  8634. value: null
  8635. },
  8636. ltc_2: {
  8637. value: null
  8638. }
  8639. },
  8640. points: {
  8641. diffuse: {
  8642. value: new Yi(15658734)
  8643. },
  8644. opacity: {
  8645. value: 1
  8646. },
  8647. size: {
  8648. value: 1
  8649. },
  8650. scale: {
  8651. value: 1
  8652. },
  8653. map: {
  8654. value: null
  8655. },
  8656. alphaMap: {
  8657. value: null
  8658. },
  8659. uvTransform: {
  8660. value: new wn
  8661. }
  8662. },
  8663. sprite: {
  8664. diffuse: {
  8665. value: new Yi(15658734)
  8666. },
  8667. opacity: {
  8668. value: 1
  8669. },
  8670. center: {
  8671. value: new yn(.5,.5)
  8672. },
  8673. rotation: {
  8674. value: 0
  8675. },
  8676. map: {
  8677. value: null
  8678. },
  8679. alphaMap: {
  8680. value: null
  8681. },
  8682. uvTransform: {
  8683. value: new wn
  8684. }
  8685. }
  8686. }
  8687. , ha = {
  8688. basic: {
  8689. uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.fog]),
  8690. vertexShader: ca.meshbasic_vert,
  8691. fragmentShader: ca.meshbasic_frag
  8692. },
  8693. lambert: {
  8694. uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.fog, da.lights, {
  8695. emissive: {
  8696. value: new Yi(0)
  8697. }
  8698. }]),
  8699. vertexShader: ca.meshlambert_vert,
  8700. fragmentShader: ca.meshlambert_frag
  8701. },
  8702. phong: {
  8703. uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.fog, da.lights, {
  8704. emissive: {
  8705. value: new Yi(0)
  8706. },
  8707. specular: {
  8708. value: new Yi(1118481)
  8709. },
  8710. shininess: {
  8711. value: 30
  8712. }
  8713. }]),
  8714. vertexShader: ca.meshphong_vert,
  8715. fragmentShader: ca.meshphong_frag
  8716. },
  8717. standard: {
  8718. uniforms: qr([da.common, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.roughnessmap, da.metalnessmap, da.fog, da.lights, {
  8719. emissive: {
  8720. value: new Yi(0)
  8721. },
  8722. roughness: {
  8723. value: 1
  8724. },
  8725. metalness: {
  8726. value: 0
  8727. },
  8728. envMapIntensity: {
  8729. value: 1
  8730. }
  8731. }]),
  8732. vertexShader: ca.meshphysical_vert,
  8733. fragmentShader: ca.meshphysical_frag
  8734. },
  8735. toon: {
  8736. uniforms: qr([da.common, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.gradientmap, da.fog, da.lights, {
  8737. emissive: {
  8738. value: new Yi(0)
  8739. }
  8740. }]),
  8741. vertexShader: ca.meshtoon_vert,
  8742. fragmentShader: ca.meshtoon_frag
  8743. },
  8744. matcap: {
  8745. uniforms: qr([da.common, da.bumpmap, da.normalmap, da.displacementmap, da.fog, {
  8746. matcap: {
  8747. value: null
  8748. }
  8749. }]),
  8750. vertexShader: ca.meshmatcap_vert,
  8751. fragmentShader: ca.meshmatcap_frag
  8752. },
  8753. points: {
  8754. uniforms: qr([da.points, da.fog]),
  8755. vertexShader: ca.points_vert,
  8756. fragmentShader: ca.points_frag
  8757. },
  8758. dashed: {
  8759. uniforms: qr([da.common, da.fog, {
  8760. scale: {
  8761. value: 1
  8762. },
  8763. dashSize: {
  8764. value: 1
  8765. },
  8766. totalSize: {
  8767. value: 2
  8768. }
  8769. }]),
  8770. vertexShader: ca.linedashed_vert,
  8771. fragmentShader: ca.linedashed_frag
  8772. },
  8773. depth: {
  8774. uniforms: qr([da.common, da.displacementmap]),
  8775. vertexShader: ca.depth_vert,
  8776. fragmentShader: ca.depth_frag
  8777. },
  8778. normal: {
  8779. uniforms: qr([da.common, da.bumpmap, da.normalmap, da.displacementmap, {
  8780. opacity: {
  8781. value: 1
  8782. }
  8783. }]),
  8784. vertexShader: ca.normal_vert,
  8785. fragmentShader: ca.normal_frag
  8786. },
  8787. sprite: {
  8788. uniforms: qr([da.sprite, da.fog]),
  8789. vertexShader: ca.sprite_vert,
  8790. fragmentShader: ca.sprite_frag
  8791. },
  8792. background: {
  8793. uniforms: {
  8794. uvTransform: {
  8795. value: new wn
  8796. },
  8797. t2D: {
  8798. value: null
  8799. }
  8800. },
  8801. vertexShader: ca.background_vert,
  8802. fragmentShader: ca.background_frag
  8803. },
  8804. cube: {
  8805. uniforms: qr([da.envmap, {
  8806. opacity: {
  8807. value: 1
  8808. }
  8809. }]),
  8810. vertexShader: ca.cube_vert,
  8811. fragmentShader: ca.cube_frag
  8812. },
  8813. equirect: {
  8814. uniforms: {
  8815. tEquirect: {
  8816. value: null
  8817. }
  8818. },
  8819. vertexShader: ca.equirect_vert,
  8820. fragmentShader: ca.equirect_frag
  8821. },
  8822. distanceRGBA: {
  8823. uniforms: qr([da.common, da.displacementmap, {
  8824. referencePosition: {
  8825. value: new Cn
  8826. },
  8827. nearDistance: {
  8828. value: 1
  8829. },
  8830. farDistance: {
  8831. value: 1e3
  8832. }
  8833. }]),
  8834. vertexShader: ca.distanceRGBA_vert,
  8835. fragmentShader: ca.distanceRGBA_frag
  8836. },
  8837. shadow: {
  8838. uniforms: qr([da.lights, da.fog, {
  8839. color: {
  8840. value: new Yi(0)
  8841. },
  8842. opacity: {
  8843. value: 1
  8844. }
  8845. }]),
  8846. vertexShader: ca.shadow_vert,
  8847. fragmentShader: ca.shadow_frag
  8848. }
  8849. };
  8850. function pa(a, o, n, s, i) {
  8851. var l, u, c = new Yi(0), d = 0, h = null, p = 0, f = null;
  8852. function m(e, t) {
  8853. n.buffers.color.setClear(e.r, e.g, e.b, t, i)
  8854. }
  8855. return {
  8856. getClearColor: function() {
  8857. return c
  8858. },
  8859. setClearColor: function(e) {
  8860. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1;
  8861. c.set(e),
  8862. m(c, d = t)
  8863. },
  8864. getClearAlpha: function() {
  8865. return d
  8866. },
  8867. setClearAlpha: function(e) {
  8868. m(c, d = e)
  8869. },
  8870. render: function(e, t, n, i) {
  8871. var r = !0 === t.isScene ? t.background : null;
  8872. r && r.isTexture && (r = o.get(r)),
  8873. t = (t = a.xr).getSession && t.getSession(),
  8874. null === (r = t && "additive" === t.environmentBlendMode ? null : r) ? m(c, d) : r && r.isColor && (m(r, 1),
  8875. i = !0),
  8876. (a.autoClear || i) && a.clear(a.autoClearColor, a.autoClearDepth, a.autoClearStencil),
  8877. r && (r.isCubeTexture || r.isWebGLCubeRenderTarget || r.mapping === z) ? (void 0 === u && ((u = new Hr(new Wr(1,1,1),new Qr({
  8878. name: "BackgroundCubeMaterial",
  8879. uniforms: Xr(ha.cube.uniforms),
  8880. vertexShader: ha.cube.vertexShader,
  8881. fragmentShader: ha.cube.fragmentShader,
  8882. side: J,
  8883. depthTest: !1,
  8884. depthWrite: !1,
  8885. fog: !1
  8886. }))).geometry.deleteAttribute("normal"),
  8887. u.geometry.deleteAttribute("uv"),
  8888. u.onBeforeRender = function(e, t, n) {
  8889. this.matrixWorld.copyPosition(n.matrixWorld)
  8890. }
  8891. ,
  8892. Object.defineProperty(u.material, "envMap", {
  8893. get: function() {
  8894. return this.uniforms.envMap.value
  8895. }
  8896. }),
  8897. s.update(u)),
  8898. r.isWebGLCubeRenderTarget && (r = r.texture),
  8899. u.material.uniforms.envMap.value = r,
  8900. u.material.uniforms.flipEnvMap.value = r.isCubeTexture && r._needsFlipEnvMap ? -1 : 1,
  8901. h === r && p === r.version && f === a.toneMapping || (u.material.needsUpdate = !0,
  8902. p = (h = r).version,
  8903. f = a.toneMapping),
  8904. e.unshift(u, u.geometry, u.material, 0, 0, null)) : r && r.isTexture && (void 0 === l && ((l = new Hr(new ua(2,2),new Qr({
  8905. name: "BackgroundMaterial",
  8906. uniforms: Xr(ha.background.uniforms),
  8907. vertexShader: ha.background.vertexShader,
  8908. fragmentShader: ha.background.fragmentShader,
  8909. side: q,
  8910. depthTest: !1,
  8911. depthWrite: !1,
  8912. fog: !1
  8913. }))).geometry.deleteAttribute("normal"),
  8914. Object.defineProperty(l.material, "map", {
  8915. get: function() {
  8916. return this.uniforms.t2D.value
  8917. }
  8918. }),
  8919. s.update(l)),
  8920. !0 === (l.material.uniforms.t2D.value = r).matrixAutoUpdate && r.updateMatrix(),
  8921. l.material.uniforms.uvTransform.value.copy(r.matrix),
  8922. h === r && p === r.version && f === a.toneMapping || (l.material.needsUpdate = !0,
  8923. p = (h = r).version,
  8924. f = a.toneMapping),
  8925. e.unshift(l, l.geometry, l.material, 0, 0, null))
  8926. }
  8927. }
  8928. }
  8929. function fa(x, E, _, M) {
  8930. var a = x.getParameter(34921)
  8931. , s = M.isWebGL2 ? null : E.get("OES_vertex_array_object")
  8932. , l = M.isWebGL2 || null !== s
  8933. , u = {}
  8934. , e = h(null)
  8935. , c = e;
  8936. function d(e) {
  8937. return M.isWebGL2 ? x.bindVertexArray(e) : s.bindVertexArrayOES(e)
  8938. }
  8939. function o(e) {
  8940. return M.isWebGL2 ? x.deleteVertexArray(e) : s.deleteVertexArrayOES(e)
  8941. }
  8942. function h(e) {
  8943. for (var t = [], n = [], i = [], r = 0; r < a; r++)
  8944. t[r] = 0,
  8945. n[r] = 0,
  8946. i[r] = 0;
  8947. return {
  8948. geometry: null,
  8949. program: null,
  8950. wireframe: !1,
  8951. newAttributes: t,
  8952. enabledAttributes: n,
  8953. attributeDivisors: i,
  8954. object: e,
  8955. attributes: {},
  8956. index: null
  8957. }
  8958. }
  8959. function A() {
  8960. for (var e = c.newAttributes, t = 0, n = e.length; t < n; t++)
  8961. e[t] = 0
  8962. }
  8963. function T(e) {
  8964. S(e, 0)
  8965. }
  8966. function S(e, t) {
  8967. var n = c.newAttributes
  8968. , i = c.enabledAttributes
  8969. , r = c.attributeDivisors;
  8970. n[e] = 1,
  8971. 0 === i[e] && (x.enableVertexAttribArray(e),
  8972. i[e] = 1),
  8973. r[e] !== t && ((M.isWebGL2 ? x : E.get("ANGLE_instanced_arrays"))[M.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](e, t),
  8974. r[e] = t)
  8975. }
  8976. function C() {
  8977. for (var e = c.newAttributes, t = c.enabledAttributes, n = 0, i = t.length; n < i; n++)
  8978. t[n] !== e[n] && (x.disableVertexAttribArray(n),
  8979. t[n] = 0)
  8980. }
  8981. function P(e, t, n, i, r, a) {
  8982. !0 !== M.isWebGL2 || 5124 !== n && 5125 !== n ? x.vertexAttribPointer(e, t, n, i, r, a) : x.vertexAttribIPointer(e, t, n, r, a)
  8983. }
  8984. function p() {
  8985. t(),
  8986. c !== e && d((c = e).object)
  8987. }
  8988. function t() {
  8989. e.geometry = null,
  8990. e.program = null,
  8991. e.wireframe = !1
  8992. }
  8993. return {
  8994. setup: function(e, t, n, i, r) {
  8995. var a, o = !1;
  8996. l ? (a = function(e, t, n) {
  8997. var i = !0 === n.wireframe
  8998. , n = u[e.id];
  8999. void 0 === n && (n = {},
  9000. u[e.id] = n);
  9001. e = n[t.id];
  9002. void 0 === e && (e = {},
  9003. n[t.id] = e);
  9004. t = e[i];
  9005. void 0 === t && (t = h(M.isWebGL2 ? x.createVertexArray() : s.createVertexArrayOES()),
  9006. e[i] = t);
  9007. return t
  9008. }(i, n, t),
  9009. c !== a && d((c = a).object),
  9010. (o = function(e, t) {
  9011. var n, i = c.attributes, r = e.attributes, a = 0;
  9012. for (n in r) {
  9013. var o = i[n]
  9014. , s = r[n];
  9015. if (void 0 === o)
  9016. return !0;
  9017. if (o.attribute !== s)
  9018. return !0;
  9019. if (o.data !== s.data)
  9020. return !0;
  9021. a++
  9022. }
  9023. return c.attributesNum !== a || c.index !== t
  9024. }(i, r)) && function(e, t) {
  9025. var n, i = {}, r = e.attributes, a = 0;
  9026. for (n in r) {
  9027. var o = r[n]
  9028. , s = {};
  9029. (s.attribute = o).data && (s.data = o.data),
  9030. i[n] = s,
  9031. a++
  9032. }
  9033. c.attributes = i,
  9034. c.attributesNum = a,
  9035. c.index = t
  9036. }(i, r)) : (a = !0 === t.wireframe,
  9037. c.geometry === i.id && c.program === n.id && c.wireframe === a || (c.geometry = i.id,
  9038. c.program = n.id,
  9039. c.wireframe = a,
  9040. o = !0)),
  9041. !0 === e.isInstancedMesh && (o = !0),
  9042. null !== r && _.update(r, 34963),
  9043. o && (function(e, t, n, i) {
  9044. if (!1 === M.isWebGL2 && (e.isInstancedMesh || i.isInstancedBufferGeometry) && null === E.get("ANGLE_instanced_arrays"))
  9045. return;
  9046. A();
  9047. var r, a = i.attributes, o = n.getAttributes(), s = t.defaultAttributeValues;
  9048. for (r in o) {
  9049. var l = o[r];
  9050. if (0 <= l) {
  9051. var u = a[r];
  9052. if (void 0 !== u) {
  9053. var c, d, h, p, f, m = u.normalized, v = u.itemSize, g = _.get(u);
  9054. void 0 !== g && (c = g.buffer,
  9055. d = g.type,
  9056. h = g.bytesPerElement,
  9057. u.isInterleavedBufferAttribute ? (p = u.data,
  9058. f = p.stride,
  9059. g = u.offset,
  9060. p && p.isInstancedInterleavedBuffer ? (S(l, p.meshPerAttribute),
  9061. void 0 === i._maxInstanceCount && (i._maxInstanceCount = p.meshPerAttribute * p.count)) : T(l),
  9062. x.bindBuffer(34962, c),
  9063. P(l, v, d, m, f * h, g * h)) : (u.isInstancedBufferAttribute ? (S(l, u.meshPerAttribute),
  9064. void 0 === i._maxInstanceCount && (i._maxInstanceCount = u.meshPerAttribute * u.count)) : T(l),
  9065. x.bindBuffer(34962, c),
  9066. P(l, v, d, m, 0, 0)))
  9067. } else if ("instanceMatrix" === r) {
  9068. m = _.get(e.instanceMatrix);
  9069. void 0 !== m && (w = m.buffer,
  9070. y = m.type,
  9071. S(l + 0, 1),
  9072. S(l + 1, 1),
  9073. S(l + 2, 1),
  9074. S(l + 3, 1),
  9075. x.bindBuffer(34962, w),
  9076. x.vertexAttribPointer(l + 0, 4, y, !1, 64, 0),
  9077. x.vertexAttribPointer(l + 1, 4, y, !1, 64, 16),
  9078. x.vertexAttribPointer(l + 2, 4, y, !1, 64, 32),
  9079. x.vertexAttribPointer(l + 3, 4, y, !1, 64, 48))
  9080. } else if ("instanceColor" === r) {
  9081. var y, w = _.get(e.instanceColor);
  9082. void 0 !== w && (y = w.buffer,
  9083. w = w.type,
  9084. S(l, 1),
  9085. x.bindBuffer(34962, y),
  9086. x.vertexAttribPointer(l, 3, w, !1, 12, 0))
  9087. } else if (void 0 !== s) {
  9088. var b = s[r];
  9089. if (void 0 !== b)
  9090. switch (b.length) {
  9091. case 2:
  9092. x.vertexAttrib2fv(l, b);
  9093. break;
  9094. case 3:
  9095. x.vertexAttrib3fv(l, b);
  9096. break;
  9097. case 4:
  9098. x.vertexAttrib4fv(l, b);
  9099. break;
  9100. default:
  9101. x.vertexAttrib1fv(l, b)
  9102. }
  9103. }
  9104. }
  9105. }
  9106. C()
  9107. }(e, t, n, i),
  9108. null !== r && x.bindBuffer(34963, _.get(r).buffer))
  9109. },
  9110. reset: p,
  9111. resetDefaultState: t,
  9112. dispose: function() {
  9113. for (var e in p(),
  9114. u) {
  9115. var t, n = u[e];
  9116. for (t in n) {
  9117. var i, r = n[t];
  9118. for (i in r)
  9119. o(r[i].object),
  9120. delete r[i];
  9121. delete n[t]
  9122. }
  9123. delete u[e]
  9124. }
  9125. },
  9126. releaseStatesOfGeometry: function(e) {
  9127. if (void 0 !== u[e.id]) {
  9128. var t, n = u[e.id];
  9129. for (t in n) {
  9130. var i, r = n[t];
  9131. for (i in r)
  9132. o(r[i].object),
  9133. delete r[i];
  9134. delete n[t]
  9135. }
  9136. delete u[e.id]
  9137. }
  9138. },
  9139. releaseStatesOfProgram: function(e) {
  9140. for (var t in u) {
  9141. t = u[t];
  9142. if (void 0 !== t[e.id]) {
  9143. var n, i = t[e.id];
  9144. for (n in i)
  9145. o(i[n].object),
  9146. delete i[n];
  9147. delete t[e.id]
  9148. }
  9149. }
  9150. },
  9151. initAttributes: A,
  9152. enableAttribute: T,
  9153. disableUnusedAttributes: C
  9154. }
  9155. }
  9156. function ma(a, o, s, e) {
  9157. var l, u = e.isWebGL2;
  9158. this.setMode = function(e) {
  9159. l = e
  9160. }
  9161. ,
  9162. this.render = function(e, t) {
  9163. a.drawArrays(l, e, t),
  9164. s.update(t, l, 1)
  9165. }
  9166. ,
  9167. this.renderInstances = function(e, t, n) {
  9168. if (0 !== n) {
  9169. var i, r;
  9170. if (u)
  9171. i = a,
  9172. r = "drawArraysInstanced";
  9173. else if (r = "drawArraysInstancedANGLE",
  9174. null === (i = o.get("ANGLE_instanced_arrays")))
  9175. return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
  9176. i[r](l, e, t, n),
  9177. s.update(t, l, n)
  9178. }
  9179. }
  9180. }
  9181. function va(t, n, e) {
  9182. var i;
  9183. function r(e) {
  9184. if ("highp" === e) {
  9185. if (0 < t.getShaderPrecisionFormat(35633, 36338).precision && 0 < t.getShaderPrecisionFormat(35632, 36338).precision)
  9186. return "highp";
  9187. e = "mediump"
  9188. }
  9189. return "mediump" === e && 0 < t.getShaderPrecisionFormat(35633, 36337).precision && 0 < t.getShaderPrecisionFormat(35632, 36337).precision ? "mediump" : "lowp"
  9190. }
  9191. var a = "undefined" != typeof WebGL2RenderingContext && t instanceof WebGL2RenderingContext || "undefined" != typeof WebGL2ComputeRenderingContext && t instanceof WebGL2ComputeRenderingContext
  9192. , o = void 0 !== e.precision ? e.precision : "highp"
  9193. , s = r(o);
  9194. s !== o && (console.warn("THREE.WebGLRenderer:", o, "not supported, using", s, "instead."),
  9195. o = s);
  9196. var l = !0 === e.logarithmicDepthBuffer
  9197. , u = t.getParameter(34930)
  9198. , c = t.getParameter(35660)
  9199. , d = t.getParameter(3379)
  9200. , h = t.getParameter(34076)
  9201. , p = t.getParameter(34921)
  9202. , f = t.getParameter(36347)
  9203. , m = t.getParameter(36348)
  9204. , v = t.getParameter(36349)
  9205. , s = 0 < c
  9206. , e = a || !!n.get("OES_texture_float");
  9207. return {
  9208. isWebGL2: a,
  9209. getMaxAnisotropy: function() {
  9210. if (void 0 !== i)
  9211. return i;
  9212. var e = n.get("EXT_texture_filter_anisotropic");
  9213. return i = null !== e ? t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0
  9214. },
  9215. getMaxPrecision: r,
  9216. precision: o,
  9217. logarithmicDepthBuffer: l,
  9218. maxTextures: u,
  9219. maxVertexTextures: c,
  9220. maxTextureSize: d,
  9221. maxCubemapSize: h,
  9222. maxAttributes: p,
  9223. maxVertexUniforms: f,
  9224. maxVaryings: m,
  9225. maxFragmentUniforms: v,
  9226. vertexTextures: s,
  9227. floatFragmentTextures: e,
  9228. floatVertexTextures: s && e,
  9229. maxSamples: a ? t.getParameter(36183) : 0
  9230. }
  9231. }
  9232. function ga(u) {
  9233. var c = this
  9234. , d = null
  9235. , h = 0
  9236. , p = !1
  9237. , f = !1
  9238. , m = new ki
  9239. , v = new wn
  9240. , g = {
  9241. value: null,
  9242. needsUpdate: !1
  9243. };
  9244. function y() {
  9245. g.value !== d && (g.value = d,
  9246. g.needsUpdate = 0 < h),
  9247. c.numPlanes = h,
  9248. c.numIntersection = 0
  9249. }
  9250. function w(e, t, n, i) {
  9251. var r = null !== e ? e.length : 0
  9252. , a = null;
  9253. if (0 !== r) {
  9254. if (a = g.value,
  9255. !0 !== i || null === a) {
  9256. var i = n + 4 * r
  9257. , o = t.matrixWorldInverse;
  9258. v.getNormalMatrix(o),
  9259. (null === a || a.length < i) && (a = new Float32Array(i));
  9260. for (var s = 0, l = n; s !== r; ++s,
  9261. l += 4)
  9262. m.copy(e[s]).applyMatrix4(o, v),
  9263. m.normal.toArray(a, l),
  9264. a[l + 3] = m.constant
  9265. }
  9266. g.value = a,
  9267. g.needsUpdate = !0
  9268. }
  9269. return c.numPlanes = r,
  9270. c.numIntersection = 0,
  9271. a
  9272. }
  9273. this.uniform = g,
  9274. this.numPlanes = 0,
  9275. this.numIntersection = 0,
  9276. this.init = function(e, t, n) {
  9277. var i = 0 !== e.length || t || 0 !== h || p;
  9278. return p = t,
  9279. d = w(e, n, 0),
  9280. h = e.length,
  9281. i
  9282. }
  9283. ,
  9284. this.beginShadows = function() {
  9285. f = !0,
  9286. w(null)
  9287. }
  9288. ,
  9289. this.endShadows = function() {
  9290. f = !1,
  9291. y()
  9292. }
  9293. ,
  9294. this.setState = function(e, t, n) {
  9295. var i = e.clippingPlanes
  9296. , r = e.clipIntersection
  9297. , a = e.clipShadows
  9298. , e = u.get(e);
  9299. if (!p || null === i || 0 === i.length || f && !a)
  9300. f ? w(null) : y();
  9301. else {
  9302. var a = f ? 0 : h
  9303. , o = 4 * a
  9304. , s = e.clippingState || null;
  9305. g.value = s;
  9306. for (var s = w(i, t, o, n), l = 0; l !== o; ++l)
  9307. s[l] = d[l];
  9308. e.clippingState = s,
  9309. this.numIntersection = r ? this.numPlanes : 0,
  9310. this.numPlanes += a
  9311. }
  9312. }
  9313. }
  9314. function ya(r) {
  9315. var a = new WeakMap;
  9316. function o(e, t) {
  9317. return t === F ? e.mapping = L : t === I && (e.mapping = R),
  9318. e
  9319. }
  9320. function s(e) {
  9321. var t = e.target;
  9322. t.removeEventListener("dispose", s);
  9323. e = a.get(t);
  9324. void 0 !== e && (a.delete(t),
  9325. e.dispose())
  9326. }
  9327. return {
  9328. get: function(e) {
  9329. if (e && e.isTexture) {
  9330. var t = e.mapping;
  9331. if (t === F || t === I) {
  9332. if (a.has(e))
  9333. return o(a.get(e).texture, e.mapping);
  9334. var n = e.image;
  9335. if (n && 0 < n.height) {
  9336. var i = r.getRenderList()
  9337. , t = r.getRenderTarget()
  9338. , n = new na(n.height / 2);
  9339. return n.fromEquirectangularTexture(r, e),
  9340. a.set(e, n),
  9341. r.setRenderTarget(t),
  9342. r.setRenderList(i),
  9343. e.addEventListener("dispose", s),
  9344. o(n.texture, e.mapping)
  9345. }
  9346. return null
  9347. }
  9348. }
  9349. return e
  9350. },
  9351. dispose: function() {
  9352. a = new WeakMap
  9353. }
  9354. }
  9355. }
  9356. function wa(n) {
  9357. var i = {};
  9358. return {
  9359. has: function(e) {
  9360. if (void 0 !== i[e])
  9361. return null !== i[e];
  9362. var t;
  9363. switch (e) {
  9364. case "WEBGL_depth_texture":
  9365. t = n.getExtension("WEBGL_depth_texture") || n.getExtension("MOZ_WEBGL_depth_texture") || n.getExtension("WEBKIT_WEBGL_depth_texture");
  9366. break;
  9367. case "EXT_texture_filter_anisotropic":
  9368. t = n.getExtension("EXT_texture_filter_anisotropic") || n.getExtension("MOZ_EXT_texture_filter_anisotropic") || n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
  9369. break;
  9370. case "WEBGL_compressed_texture_s3tc":
  9371. t = n.getExtension("WEBGL_compressed_texture_s3tc") || n.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
  9372. break;
  9373. case "WEBGL_compressed_texture_pvrtc":
  9374. t = n.getExtension("WEBGL_compressed_texture_pvrtc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
  9375. break;
  9376. default:
  9377. t = n.getExtension(e)
  9378. }
  9379. return null !== (i[e] = t)
  9380. },
  9381. get: function(e) {
  9382. return this.has(e) || console.warn("THREE.WebGLRenderer: " + e + " extension not supported."),
  9383. i[e]
  9384. }
  9385. }
  9386. }
  9387. function ba(e, g, r, a) {
  9388. var o = new WeakMap
  9389. , y = new WeakMap;
  9390. function s(e) {
  9391. var t, n = e.target, i = o.get(n);
  9392. for (t in null !== i.index && g.remove(i.index),
  9393. i.attributes)
  9394. g.remove(i.attributes[t]);
  9395. n.removeEventListener("dispose", s),
  9396. o.delete(n);
  9397. e = y.get(i);
  9398. e && (g.remove(e),
  9399. y.delete(i)),
  9400. a.releaseStatesOfGeometry(i),
  9401. !0 === n.isInstancedBufferGeometry && delete n._maxInstanceCount,
  9402. r.memory.geometries--
  9403. }
  9404. function i(e) {
  9405. var t = []
  9406. , n = e.index
  9407. , i = e.attributes.position
  9408. , r = 0;
  9409. if (null !== n)
  9410. for (var a = n.array, r = n.version, o = 0, s = a.length; o < s; o += 3) {
  9411. var l = a[o + 0]
  9412. , u = a[o + 1]
  9413. , c = a[o + 2];
  9414. t.push(l, u, u, c, c, l)
  9415. }
  9416. else {
  9417. var d = i.array;
  9418. r = i.version;
  9419. for (var h = 0, p = d.length / 3 - 1; h < p; h += 3) {
  9420. var f = h + 0
  9421. , m = h + 1
  9422. , v = h + 2;
  9423. t.push(f, m, m, v, v, f)
  9424. }
  9425. }
  9426. d = new (65535 < fr(t) ? ur : sr)(t,1);
  9427. d.version = r;
  9428. r = y.get(e);
  9429. r && g.remove(r),
  9430. y.set(e, d)
  9431. }
  9432. return {
  9433. get: function(e, t) {
  9434. var n = o.get(t);
  9435. return n || (t.addEventListener("dispose", s),
  9436. t.isBufferGeometry ? n = t : t.isGeometry && (void 0 === t._bufferGeometry && (t._bufferGeometry = (new Mr).setFromObject(e)),
  9437. n = t._bufferGeometry),
  9438. o.set(t, n),
  9439. r.memory.geometries++,
  9440. n)
  9441. },
  9442. update: function(e) {
  9443. var t, n = e.attributes;
  9444. for (t in n)
  9445. g.update(n[t], 34962);
  9446. var i, r = e.morphAttributes;
  9447. for (i in r)
  9448. for (var a = r[i], o = 0, s = a.length; o < s; o++)
  9449. g.update(a[o], 34962)
  9450. },
  9451. getWireframeAttribute: function(e) {
  9452. var t, n = y.get(e);
  9453. return (!n || null !== (t = e.index) && n.version < t.version) && i(e),
  9454. y.get(e)
  9455. }
  9456. }
  9457. }
  9458. function xa(a, o, s, e) {
  9459. var l, u, c, d = e.isWebGL2;
  9460. this.setMode = function(e) {
  9461. l = e
  9462. }
  9463. ,
  9464. this.setIndex = function(e) {
  9465. u = e.type,
  9466. c = e.bytesPerElement
  9467. }
  9468. ,
  9469. this.render = function(e, t) {
  9470. a.drawElements(l, t, u, e * c),
  9471. s.update(t, l, 1)
  9472. }
  9473. ,
  9474. this.renderInstances = function(e, t, n) {
  9475. if (0 !== n) {
  9476. var i, r;
  9477. if (d)
  9478. i = a,
  9479. r = "drawElementsInstanced";
  9480. else if (r = "drawElementsInstancedANGLE",
  9481. null === (i = o.get("ANGLE_instanced_arrays")))
  9482. return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
  9483. i[r](l, t, u, e * c, n),
  9484. s.update(t, l, n)
  9485. }
  9486. }
  9487. }
  9488. function Ea(e) {
  9489. var i = {
  9490. frame: 0,
  9491. calls: 0,
  9492. triangles: 0,
  9493. points: 0,
  9494. lines: 0
  9495. };
  9496. return {
  9497. memory: {
  9498. geometries: 0,
  9499. textures: 0
  9500. },
  9501. render: i,
  9502. programs: null,
  9503. autoReset: !0,
  9504. reset: function() {
  9505. i.frame++,
  9506. i.calls = 0,
  9507. i.triangles = 0,
  9508. i.points = 0,
  9509. i.lines = 0
  9510. },
  9511. update: function(e, t, n) {
  9512. switch (i.calls++,
  9513. t) {
  9514. case 4:
  9515. i.triangles += n * (e / 3);
  9516. break;
  9517. case 1:
  9518. i.lines += n * (e / 2);
  9519. break;
  9520. case 3:
  9521. i.lines += n * (e - 1);
  9522. break;
  9523. case 2:
  9524. i.lines += n * e;
  9525. break;
  9526. case 0:
  9527. i.points += n * e;
  9528. break;
  9529. default:
  9530. console.error("THREE.WebGLInfo: Unknown draw mode:", t)
  9531. }
  9532. }
  9533. }
  9534. }
  9535. function _a(e, t) {
  9536. return e[0] - t[0]
  9537. }
  9538. function Ma(e, t) {
  9539. return Math.abs(t[1]) - Math.abs(e[1])
  9540. }
  9541. function Aa(g) {
  9542. for (var y = {}, w = new Float32Array(8), b = [], e = 0; e < 8; e++)
  9543. b[e] = [e, 0];
  9544. return {
  9545. update: function(e, t, n, i) {
  9546. var r = e.morphTargetInfluences
  9547. , a = void 0 === r ? 0 : r.length;
  9548. if (void 0 === (o = y[t.id])) {
  9549. for (var o = [], s = 0; s < a; s++)
  9550. o[s] = [s, 0];
  9551. y[t.id] = o
  9552. }
  9553. for (var l = 0; l < a; l++) {
  9554. var u = o[l];
  9555. u[0] = l,
  9556. u[1] = r[l]
  9557. }
  9558. o.sort(Ma);
  9559. for (var c = 0; c < 8; c++)
  9560. c < a && o[c][1] ? (b[c][0] = o[c][0],
  9561. b[c][1] = o[c][1]) : (b[c][0] = Number.MAX_SAFE_INTEGER,
  9562. b[c][1] = 0);
  9563. b.sort(_a);
  9564. for (var d = n.morphTargets && t.morphAttributes.position, h = n.morphNormals && t.morphAttributes.normal, p = 0, f = 0; f < 8; f++) {
  9565. var m = b[f]
  9566. , v = m[0]
  9567. , m = m[1];
  9568. v !== Number.MAX_SAFE_INTEGER && m ? (d && t.getAttribute("morphTarget" + f) !== d[v] && t.setAttribute("morphTarget" + f, d[v]),
  9569. h && t.getAttribute("morphNormal" + f) !== h[v] && t.setAttribute("morphNormal" + f, h[v]),
  9570. p += w[f] = m) : (d && !0 === t.hasAttribute("morphTarget" + f) && t.deleteAttribute("morphTarget" + f),
  9571. h && !0 === t.hasAttribute("morphNormal" + f) && t.deleteAttribute("morphNormal" + f),
  9572. w[f] = 0)
  9573. }
  9574. n = t.morphTargetsRelative ? 1 : 1 - p,
  9575. i.getUniforms().setValue(g, "morphTargetBaseInfluence", n),
  9576. i.getUniforms().setValue(g, "morphTargetInfluences", w)
  9577. }
  9578. }
  9579. }
  9580. function Ta(e, r, a, o) {
  9581. var s = new WeakMap;
  9582. function l(e) {
  9583. e = e.target;
  9584. e.removeEventListener("dispose", l),
  9585. a.remove(e.instanceMatrix),
  9586. null !== e.instanceColor && a.remove(e.instanceColor)
  9587. }
  9588. return {
  9589. update: function(e) {
  9590. var t = o.render.frame
  9591. , n = e.geometry
  9592. , i = r.get(e, n);
  9593. return s.get(i) !== t && (n.isGeometry && i.updateFromObject(e),
  9594. r.update(i),
  9595. s.set(i, t)),
  9596. e.isInstancedMesh && (!1 === e.hasEventListener("dispose", l) && e.addEventListener("dispose", l),
  9597. a.update(e.instanceMatrix, 34962),
  9598. null !== e.instanceColor && a.update(e.instanceColor, 34962)),
  9599. i
  9600. },
  9601. dispose: function() {
  9602. s = new WeakMap
  9603. }
  9604. }
  9605. }
  9606. function Sa() {
  9607. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null
  9608. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1
  9609. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1
  9610. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1;
  9611. En.call(this, null),
  9612. this.image = {
  9613. data: e,
  9614. width: t,
  9615. height: n,
  9616. depth: i
  9617. },
  9618. this.magFilter = Re,
  9619. this.minFilter = Re,
  9620. this.wrapR = Be,
  9621. this.generateMipmaps = !1,
  9622. this.flipY = !1,
  9623. this.needsUpdate = !0
  9624. }
  9625. function Ca() {
  9626. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null
  9627. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1
  9628. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1
  9629. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1;
  9630. En.call(this, null),
  9631. this.image = {
  9632. data: e,
  9633. width: t,
  9634. height: n,
  9635. depth: i
  9636. },
  9637. this.magFilter = Re,
  9638. this.minFilter = Re,
  9639. this.wrapR = Be,
  9640. this.generateMipmaps = !1,
  9641. this.flipY = !1,
  9642. this.needsUpdate = !0
  9643. }
  9644. ha.physical = {
  9645. uniforms: qr([ha.standard.uniforms, {
  9646. clearcoat: {
  9647. value: 0
  9648. },
  9649. clearcoatMap: {
  9650. value: null
  9651. },
  9652. clearcoatRoughness: {
  9653. value: 0
  9654. },
  9655. clearcoatRoughnessMap: {
  9656. value: null
  9657. },
  9658. clearcoatNormalScale: {
  9659. value: new yn(1,1)
  9660. },
  9661. clearcoatNormalMap: {
  9662. value: null
  9663. },
  9664. sheen: {
  9665. value: new Yi(0)
  9666. },
  9667. transmission: {
  9668. value: 0
  9669. },
  9670. transmissionMap: {
  9671. value: null
  9672. }
  9673. }]),
  9674. vertexShader: ca.meshphysical_vert,
  9675. fragmentShader: ca.meshphysical_frag
  9676. },
  9677. ((Sa.prototype = Object.create(En.prototype)).constructor = Sa).prototype.isDataTexture2DArray = !0,
  9678. ((Ca.prototype = Object.create(En.prototype)).constructor = Ca).prototype.isDataTexture3D = !0;
  9679. var Pa = new En
  9680. , Da = new Sa
  9681. , ka = new Ca
  9682. , Ba = new ta
  9683. , La = []
  9684. , Ra = []
  9685. , Fa = new Float32Array(16)
  9686. , Ia = new Float32Array(9)
  9687. , Oa = new Float32Array(4);
  9688. function za(e, t, n) {
  9689. var i = e[0];
  9690. if (i <= 0 || 0 < i)
  9691. return e;
  9692. var r = t * n
  9693. , a = La[r];
  9694. if (void 0 === a && (a = new Float32Array(r),
  9695. La[r] = a),
  9696. 0 !== t) {
  9697. i.toArray(a, 0);
  9698. for (var o = 1, s = 0; o !== t; ++o)
  9699. e[o].toArray(a, s += n)
  9700. }
  9701. return a
  9702. }
  9703. function Na(e, t) {
  9704. if (e.length === t.length) {
  9705. for (var n = 0, i = e.length; n < i; n++)
  9706. if (e[n] !== t[n])
  9707. return;
  9708. return 1
  9709. }
  9710. }
  9711. function Ua(e, t) {
  9712. for (var n = 0, i = t.length; n < i; n++)
  9713. e[n] = t[n]
  9714. }
  9715. function Ga(e, t) {
  9716. var n = Ra[t];
  9717. void 0 === n && (n = new Int32Array(t),
  9718. Ra[t] = n);
  9719. for (var i = 0; i !== t; ++i)
  9720. n[i] = e.allocateTextureUnit();
  9721. return n
  9722. }
  9723. function Ha(e, t) {
  9724. var n = this.cache;
  9725. n[0] !== t && (e.uniform1f(this.addr, t),
  9726. n[0] = t)
  9727. }
  9728. function Va(e, t) {
  9729. var n = this.cache;
  9730. void 0 !== t.x ? n[0] === t.x && n[1] === t.y || (e.uniform2f(this.addr, t.x, t.y),
  9731. n[0] = t.x,
  9732. n[1] = t.y) : Na(n, t) || (e.uniform2fv(this.addr, t),
  9733. Ua(n, t))
  9734. }
  9735. function ja(e, t) {
  9736. var n = this.cache;
  9737. void 0 !== t.x ? n[0] === t.x && n[1] === t.y && n[2] === t.z || (e.uniform3f(this.addr, t.x, t.y, t.z),
  9738. n[0] = t.x,
  9739. n[1] = t.y,
  9740. n[2] = t.z) : void 0 !== t.r ? n[0] === t.r && n[1] === t.g && n[2] === t.b || (e.uniform3f(this.addr, t.r, t.g, t.b),
  9741. n[0] = t.r,
  9742. n[1] = t.g,
  9743. n[2] = t.b) : Na(n, t) || (e.uniform3fv(this.addr, t),
  9744. Ua(n, t))
  9745. }
  9746. function Wa(e, t) {
  9747. var n = this.cache;
  9748. void 0 !== t.x ? n[0] === t.x && n[1] === t.y && n[2] === t.z && n[3] === t.w || (e.uniform4f(this.addr, t.x, t.y, t.z, t.w),
  9749. n[0] = t.x,
  9750. n[1] = t.y,
  9751. n[2] = t.z,
  9752. n[3] = t.w) : Na(n, t) || (e.uniform4fv(this.addr, t),
  9753. Ua(n, t))
  9754. }
  9755. function Xa(e, t) {
  9756. var n = this.cache
  9757. , i = t.elements;
  9758. void 0 === i ? Na(n, t) || (e.uniformMatrix2fv(this.addr, !1, t),
  9759. Ua(n, t)) : Na(n, i) || (Oa.set(i),
  9760. e.uniformMatrix2fv(this.addr, !1, Oa),
  9761. Ua(n, i))
  9762. }
  9763. function qa(e, t) {
  9764. var n = this.cache
  9765. , i = t.elements;
  9766. void 0 === i ? Na(n, t) || (e.uniformMatrix3fv(this.addr, !1, t),
  9767. Ua(n, t)) : Na(n, i) || (Ia.set(i),
  9768. e.uniformMatrix3fv(this.addr, !1, Ia),
  9769. Ua(n, i))
  9770. }
  9771. function Ja(e, t) {
  9772. var n = this.cache
  9773. , i = t.elements;
  9774. void 0 === i ? Na(n, t) || (e.uniformMatrix4fv(this.addr, !1, t),
  9775. Ua(n, t)) : Na(n, i) || (Fa.set(i),
  9776. e.uniformMatrix4fv(this.addr, !1, Fa),
  9777. Ua(n, i))
  9778. }
  9779. function Ya(e, t, n) {
  9780. var i = this.cache
  9781. , r = n.allocateTextureUnit();
  9782. i[0] !== r && (e.uniform1i(this.addr, r),
  9783. i[0] = r),
  9784. n.safeSetTexture2D(t || Pa, r)
  9785. }
  9786. function Za(e, t, n) {
  9787. var i = this.cache
  9788. , r = n.allocateTextureUnit();
  9789. i[0] !== r && (e.uniform1i(this.addr, r),
  9790. i[0] = r),
  9791. n.setTexture2DArray(t || Da, r)
  9792. }
  9793. function Qa(e, t, n) {
  9794. var i = this.cache
  9795. , r = n.allocateTextureUnit();
  9796. i[0] !== r && (e.uniform1i(this.addr, r),
  9797. i[0] = r),
  9798. n.setTexture3D(t || ka, r)
  9799. }
  9800. function Ka(e, t, n) {
  9801. var i = this.cache
  9802. , r = n.allocateTextureUnit();
  9803. i[0] !== r && (e.uniform1i(this.addr, r),
  9804. i[0] = r),
  9805. n.safeSetTextureCube(t || Ba, r)
  9806. }
  9807. function $a(e, t) {
  9808. var n = this.cache;
  9809. n[0] !== t && (e.uniform1i(this.addr, t),
  9810. n[0] = t)
  9811. }
  9812. function eo(e, t) {
  9813. var n = this.cache;
  9814. Na(n, t) || (e.uniform2iv(this.addr, t),
  9815. Ua(n, t))
  9816. }
  9817. function to(e, t) {
  9818. var n = this.cache;
  9819. Na(n, t) || (e.uniform3iv(this.addr, t),
  9820. Ua(n, t))
  9821. }
  9822. function no(e, t) {
  9823. var n = this.cache;
  9824. Na(n, t) || (e.uniform4iv(this.addr, t),
  9825. Ua(n, t))
  9826. }
  9827. function io(e, t) {
  9828. var n = this.cache;
  9829. n[0] !== t && (e.uniform1ui(this.addr, t),
  9830. n[0] = t)
  9831. }
  9832. function ro(e, t) {
  9833. e.uniform1fv(this.addr, t)
  9834. }
  9835. function ao(e, t) {
  9836. e.uniform1iv(this.addr, t)
  9837. }
  9838. function oo(e, t) {
  9839. e.uniform2iv(this.addr, t)
  9840. }
  9841. function so(e, t) {
  9842. e.uniform3iv(this.addr, t)
  9843. }
  9844. function lo(e, t) {
  9845. e.uniform4iv(this.addr, t)
  9846. }
  9847. function uo(e, t) {
  9848. t = za(t, this.size, 2);
  9849. e.uniform2fv(this.addr, t)
  9850. }
  9851. function co(e, t) {
  9852. t = za(t, this.size, 3);
  9853. e.uniform3fv(this.addr, t)
  9854. }
  9855. function ho(e, t) {
  9856. t = za(t, this.size, 4);
  9857. e.uniform4fv(this.addr, t)
  9858. }
  9859. function po(e, t) {
  9860. t = za(t, this.size, 4);
  9861. e.uniformMatrix2fv(this.addr, !1, t)
  9862. }
  9863. function fo(e, t) {
  9864. t = za(t, this.size, 9);
  9865. e.uniformMatrix3fv(this.addr, !1, t)
  9866. }
  9867. function mo(e, t) {
  9868. t = za(t, this.size, 16);
  9869. e.uniformMatrix4fv(this.addr, !1, t)
  9870. }
  9871. function vo(e, t, n) {
  9872. var i = t.length
  9873. , r = Ga(n, i);
  9874. e.uniform1iv(this.addr, r);
  9875. for (var a = 0; a !== i; ++a)
  9876. n.safeSetTexture2D(t[a] || Pa, r[a])
  9877. }
  9878. function go(e, t, n) {
  9879. var i = t.length
  9880. , r = Ga(n, i);
  9881. e.uniform1iv(this.addr, r);
  9882. for (var a = 0; a !== i; ++a)
  9883. n.safeSetTextureCube(t[a] || Ba, r[a])
  9884. }
  9885. function yo(e, t, n) {
  9886. this.id = e,
  9887. this.addr = n,
  9888. this.cache = [],
  9889. this.setValue = function(e) {
  9890. switch (e) {
  9891. case 5126:
  9892. return Ha;
  9893. case 35664:
  9894. return Va;
  9895. case 35665:
  9896. return ja;
  9897. case 35666:
  9898. return Wa;
  9899. case 35674:
  9900. return Xa;
  9901. case 35675:
  9902. return qa;
  9903. case 35676:
  9904. return Ja;
  9905. case 5124:
  9906. case 35670:
  9907. return $a;
  9908. case 35667:
  9909. case 35671:
  9910. return eo;
  9911. case 35668:
  9912. case 35672:
  9913. return to;
  9914. case 35669:
  9915. case 35673:
  9916. return no;
  9917. case 5125:
  9918. return io;
  9919. case 35678:
  9920. case 36198:
  9921. case 36298:
  9922. case 36306:
  9923. case 35682:
  9924. return Ya;
  9925. case 35679:
  9926. case 36299:
  9927. case 36307:
  9928. return Qa;
  9929. case 35680:
  9930. case 36300:
  9931. case 36308:
  9932. case 36293:
  9933. return Ka;
  9934. case 36289:
  9935. case 36303:
  9936. case 36311:
  9937. case 36292:
  9938. return Za
  9939. }
  9940. }(t.type)
  9941. }
  9942. function wo(e, t, n) {
  9943. this.id = e,
  9944. this.addr = n,
  9945. this.cache = [],
  9946. this.size = t.size,
  9947. this.setValue = function(e) {
  9948. switch (e) {
  9949. case 5126:
  9950. return ro;
  9951. case 35664:
  9952. return uo;
  9953. case 35665:
  9954. return co;
  9955. case 35666:
  9956. return ho;
  9957. case 35674:
  9958. return po;
  9959. case 35675:
  9960. return fo;
  9961. case 35676:
  9962. return mo;
  9963. case 5124:
  9964. case 35670:
  9965. return ao;
  9966. case 35667:
  9967. case 35671:
  9968. return oo;
  9969. case 35668:
  9970. case 35672:
  9971. return so;
  9972. case 35669:
  9973. case 35673:
  9974. return lo;
  9975. case 35678:
  9976. case 36198:
  9977. case 36298:
  9978. case 36306:
  9979. case 35682:
  9980. return vo;
  9981. case 35680:
  9982. case 36300:
  9983. case 36308:
  9984. case 36293:
  9985. return go
  9986. }
  9987. }(t.type)
  9988. }
  9989. function bo(e) {
  9990. this.id = e,
  9991. this.seq = [],
  9992. this.map = {}
  9993. }
  9994. wo.prototype.updateCache = function(e) {
  9995. var t = this.cache;
  9996. e instanceof Float32Array && t.length !== e.length && (this.cache = new Float32Array(e.length)),
  9997. Ua(t, e)
  9998. }
  9999. ,
  10000. bo.prototype.setValue = function(e, t, n) {
  10001. for (var i = this.seq, r = 0, a = i.length; r !== a; ++r) {
  10002. var o = i[r];
  10003. o.setValue(e, t[o.id], n)
  10004. }
  10005. }
  10006. ;
  10007. var xo = /(\w+)(\])?(\[|\.)?/g;
  10008. function Eo(e, t) {
  10009. e.seq.push(t),
  10010. e.map[t.id] = t
  10011. }
  10012. function _o(e, t) {
  10013. this.seq = [],
  10014. this.map = {};
  10015. for (var n = e.getProgramParameter(t, 35718), i = 0; i < n; ++i) {
  10016. var r = e.getActiveUniform(t, i);
  10017. !function(e, t, n) {
  10018. var i = e.name
  10019. , r = i.length;
  10020. for (xo.lastIndex = 0; ; ) {
  10021. var a = xo.exec(i)
  10022. , o = xo.lastIndex
  10023. , s = a[1]
  10024. , l = "]" === a[2]
  10025. , a = a[3];
  10026. if (l && (s |= 0),
  10027. void 0 === a || "[" === a && o + 2 === r) {
  10028. Eo(n, new (void 0 === a ? yo : wo)(s,e,t));
  10029. break
  10030. }
  10031. a = n.map[s];
  10032. void 0 === a && Eo(n, a = new bo(s)),
  10033. n = a
  10034. }
  10035. }(r, e.getUniformLocation(t, r.name), this)
  10036. }
  10037. }
  10038. function Mo(e, t, n) {
  10039. t = e.createShader(t);
  10040. return e.shaderSource(t, n),
  10041. e.compileShader(t),
  10042. t
  10043. }
  10044. _o.prototype.setValue = function(e, t, n, i) {
  10045. t = this.map[t];
  10046. void 0 !== t && t.setValue(e, n, i)
  10047. }
  10048. ,
  10049. _o.prototype.setOptional = function(e, t, n) {
  10050. t = t[n];
  10051. void 0 !== t && this.setValue(e, n, t)
  10052. }
  10053. ,
  10054. _o.upload = function(e, t, n, i) {
  10055. for (var r = 0, a = t.length; r !== a; ++r) {
  10056. var o = t[r]
  10057. , s = n[o.id];
  10058. !1 !== s.needsUpdate && o.setValue(e, s.value, i)
  10059. }
  10060. }
  10061. ,
  10062. _o.seqWithValue = function(e, t) {
  10063. for (var n = [], i = 0, r = e.length; i !== r; ++i) {
  10064. var a = e[i];
  10065. a.id in t && n.push(a)
  10066. }
  10067. return n
  10068. }
  10069. ;
  10070. var Ao = 0;
  10071. function To(e) {
  10072. switch (e) {
  10073. case rn:
  10074. return ["Linear", "( value )"];
  10075. case an:
  10076. return ["sRGB", "( value )"];
  10077. case 3002:
  10078. return ["RGBE", "( value )"];
  10079. case 3004:
  10080. return ["RGBM", "( value, 7.0 )"];
  10081. case 3005:
  10082. return ["RGBM", "( value, 16.0 )"];
  10083. case 3006:
  10084. return ["RGBD", "( value, 256.0 )"];
  10085. case 3007:
  10086. return ["Gamma", "( value, float( GAMMA_FACTOR ) )"];
  10087. case 3003:
  10088. return ["LogLuv", "( value )"];
  10089. default:
  10090. return console.warn("THREE.WebGLProgram: Unsupported encoding:", e),
  10091. ["Linear", "( value )"]
  10092. }
  10093. }
  10094. function So(e, t, n) {
  10095. var i = e.getShaderParameter(t, 35713)
  10096. , r = e.getShaderInfoLog(t).trim();
  10097. return i && "" === r ? "" : "THREE.WebGLShader: gl.getShaderInfoLog() " + n + "\n" + r + function(e) {
  10098. for (var t = e.split("\n"), n = 0; n < t.length; n++)
  10099. t[n] = n + 1 + ": " + t[n];
  10100. return t.join("\n")
  10101. }(e.getShaderSource(t))
  10102. }
  10103. function Co(e, t) {
  10104. t = To(t);
  10105. return "vec4 " + e + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }"
  10106. }
  10107. function Po(e) {
  10108. return "" !== e
  10109. }
  10110. function Do(e, t) {
  10111. return e.replace(/NUM_DIR_LIGHTS/g, t.numDirLights).replace(/NUM_SPOT_LIGHTS/g, t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, t.numPointLights).replace(/NUM_HEMI_LIGHTS/g, t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, t.numPointLightShadows)
  10112. }
  10113. function ko(e, t) {
  10114. return e.replace(/NUM_CLIPPING_PLANES/g, t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, t.numClippingPlanes - t.numClipIntersection)
  10115. }
  10116. var Bo = /^[ \t]*#include +<([\w\d./]+)>/gm;
  10117. function Lo(e) {
  10118. return e.replace(Bo, Ro)
  10119. }
  10120. function Ro(e, t) {
  10121. var n = ca[t];
  10122. if (void 0 === n)
  10123. throw new Error("Can not resolve #include <" + t + ">");
  10124. return Lo(n)
  10125. }
  10126. var Fo = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g
  10127. , Io = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
  10128. function Oo(e) {
  10129. return e.replace(Io, No).replace(Fo, zo)
  10130. }
  10131. function zo(e, t, n, i) {
  10132. return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),
  10133. No(0, t, n, i)
  10134. }
  10135. function No(e, t, n, i) {
  10136. for (var r = "", a = parseInt(t); a < parseInt(n); a++)
  10137. r += i.replace(/\[\s*i\s*\]/g, "[ " + a + " ]").replace(/UNROLLED_LOOP_INDEX/g, a);
  10138. return r
  10139. }
  10140. function Uo(e) {
  10141. var t = "precision " + e.precision + " float;\nprecision " + e.precision + " int;";
  10142. return "highp" === e.precision ? t += "\n#define HIGH_PRECISION" : "mediump" === e.precision ? t += "\n#define MEDIUM_PRECISION" : "lowp" === e.precision && (t += "\n#define LOW_PRECISION"),
  10143. t
  10144. }
  10145. function Go(e, t, n, i) {
  10146. var r, a, o = e.getContext(), s = n.defines, l = n.vertexShader, u = n.fragmentShader, c = (m = "SHADOWMAP_TYPE_BASIC",
  10147. (f = n).shadowMapType === P ? m = "SHADOWMAP_TYPE_PCF" : 2 === f.shadowMapType ? m = "SHADOWMAP_TYPE_PCF_SOFT" : f.shadowMapType === D && (m = "SHADOWMAP_TYPE_VSM"),
  10148. m), d = function(e) {
  10149. var t = "ENVMAP_TYPE_CUBE";
  10150. if (e.envMap)
  10151. switch (e.envMapMode) {
  10152. case L:
  10153. case R:
  10154. t = "ENVMAP_TYPE_CUBE";
  10155. break;
  10156. case z:
  10157. case U:
  10158. t = "ENVMAP_TYPE_CUBE_UV"
  10159. }
  10160. return t
  10161. }(n), h = function(e) {
  10162. var t = "ENVMAP_MODE_REFLECTION";
  10163. if (e.envMap)
  10164. switch (e.envMapMode) {
  10165. case R:
  10166. case U:
  10167. t = "ENVMAP_MODE_REFRACTION"
  10168. }
  10169. return t
  10170. }(n), p = function(e) {
  10171. var t = "ENVMAP_BLENDING_NONE";
  10172. if (e.envMap)
  10173. switch (e.combine) {
  10174. case k:
  10175. t = "ENVMAP_BLENDING_MULTIPLY";
  10176. break;
  10177. case 1:
  10178. t = "ENVMAP_BLENDING_MIX";
  10179. break;
  10180. case 2:
  10181. t = "ENVMAP_BLENDING_ADD"
  10182. }
  10183. return t
  10184. }(n), f = 0 < e.gammaFactor ? e.gammaFactor : 1, m = n.isWebGL2 ? "" : [(v = n).extensionDerivatives || v.envMapCubeUV || v.bumpMap || v.tangentSpaceNormalMap || v.clearcoatNormalMap || v.flatShading || "physical" === v.shaderID ? "#extension GL_OES_standard_derivatives : enable" : "", (v.extensionFragDepth || v.logarithmicDepthBuffer) && v.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", v.extensionDrawBuffers && v.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (v.extensionShaderTextureLOD || v.envMap) && v.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : ""].filter(Po).join("\n"), v = function(e) {
  10185. var t, n = [];
  10186. for (t in e) {
  10187. var i = e[t];
  10188. !1 !== i && n.push("#define " + t + " " + i)
  10189. }
  10190. return n.join("\n")
  10191. }(s), g = o.createProgram(), s = n.glslVersion ? "#version " + n.glslVersion + "\n" : "";
  10192. n.isRawShaderMaterial ? (0 < (r = [v].filter(Po).join("\n")).length && (r += "\n"),
  10193. 0 < (a = [m, v].filter(Po).join("\n")).length && (a += "\n")) : (r = [Uo(n), "#define SHADER_NAME " + n.shaderName, v, n.instancing ? "#define USE_INSTANCING" : "", n.instancingColor ? "#define USE_INSTANCING_COLOR" : "", n.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + f, "#define MAX_BONES " + n.maxBones, n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.map ? "#define USE_MAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + h : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMap && n.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", n.normalMap && n.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.displacementMap && n.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.vertexTangents ? "#define USE_TANGENT" : "", n.vertexColors ? "#define USE_COLOR" : "", n.vertexUvs ? "#define USE_UV" : "", n.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.skinning ? "#define USE_SKINNING" : "", n.useVertexTexture ? "#define BONE_TEXTURE" : "", n.morphTargets ? "#define USE_MORPHTARGETS" : "", n.morphNormals && !1 === n.flatShading ? "#define USE_MORPHNORMALS" : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + c : "", n.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.logarithmicDepthBuffer && n.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", "\tattribute mat4 instanceMatrix;", "#endif", "#ifdef USE_INSTANCING_COLOR", "\tattribute vec3 instanceColor;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", "\tattribute vec4 tangent;", "#endif", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(Po).join("\n"),
  10194. a = [m, Uo(n), "#define SHADER_NAME " + n.shaderName, v, n.alphaTest ? "#define ALPHATEST " + n.alphaTest + (n.alphaTest % 1 ? "" : ".0") : "", "#define GAMMA_FACTOR " + f, n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.map ? "#define USE_MAP" : "", n.matcap ? "#define USE_MATCAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + d : "", n.envMap ? "#define " + h : "", n.envMap ? "#define " + p : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMap && n.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", n.normalMap && n.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.sheen ? "#define USE_SHEEN" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.vertexTangents ? "#define USE_TANGENT" : "", n.vertexColors || n.instancingColor ? "#define USE_COLOR" : "", n.vertexUvs ? "#define USE_UV" : "", n.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", n.gradientMap ? "#define USE_GRADIENTMAP" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + c : "", n.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", n.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.logarithmicDepthBuffer && n.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", (n.extensionShaderTextureLOD || n.envMap) && n.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", n.toneMapping !== De ? "#define TONE_MAPPING" : "", n.toneMapping !== De ? ca.tonemapping_pars_fragment : "", n.toneMapping !== De ? function(e, t) {
  10195. var n;
  10196. switch (t) {
  10197. case 1:
  10198. n = "Linear";
  10199. break;
  10200. case 2:
  10201. n = "Reinhard";
  10202. break;
  10203. case 3:
  10204. n = "OptimizedCineon";
  10205. break;
  10206. case 4:
  10207. n = "ACESFilmic";
  10208. break;
  10209. case 5:
  10210. n = "Custom";
  10211. break;
  10212. default:
  10213. console.warn("THREE.WebGLProgram: Unsupported toneMapping:", t),
  10214. n = "Linear"
  10215. }
  10216. return "vec3 " + e + "( vec3 color ) { return " + n + "ToneMapping( color ); }"
  10217. }("toneMapping", n.toneMapping) : "", n.dithering ? "#define DITHERING" : "", ca.encodings_pars_fragment, n.map ? Co("mapTexelToLinear", n.mapEncoding) : "", n.matcap ? Co("matcapTexelToLinear", n.matcapEncoding) : "", n.envMap ? Co("envMapTexelToLinear", n.envMapEncoding) : "", n.emissiveMap ? Co("emissiveMapTexelToLinear", n.emissiveMapEncoding) : "", n.lightMap ? Co("lightMapTexelToLinear", n.lightMapEncoding) : "", (y = "linearToOutputTexel",
  10218. w = To(w = n.outputEncoding),
  10219. "vec4 " + y + "( vec4 value ) { return LinearTo" + w[0] + w[1] + "; }"), n.depthPacking ? "#define DEPTH_PACKING " + n.depthPacking : "", "\n"].filter(Po).join("\n")),
  10220. l = ko(Do(Lo(l), n), n),
  10221. u = ko(Do(Lo(u), n), n),
  10222. l = Oo(l),
  10223. u = Oo(u),
  10224. n.isWebGL2 && !0 !== n.isRawShaderMaterial && (s = "#version 300 es\n",
  10225. r = ["#define attribute in", "#define varying out", "#define texture2D texture"].join("\n") + "\n" + r,
  10226. a = ["#define varying in", n.glslVersion === dn ? "" : "out highp vec4 pc_fragColor;", n.glslVersion === dn ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad"].join("\n") + "\n" + a);
  10227. var y, w, b, x, f = s + r + l, d = s + a + u, h = Mo(o, 35633, f), p = Mo(o, 35632, d);
  10228. return o.attachShader(g, h),
  10229. o.attachShader(g, p),
  10230. void 0 !== n.index0AttributeName ? o.bindAttribLocation(g, 0, n.index0AttributeName) : !0 === n.morphTargets && o.bindAttribLocation(g, 0, "position"),
  10231. o.linkProgram(g),
  10232. e.debug.checkShaderErrors && (c = o.getProgramInfoLog(g).trim(),
  10233. y = o.getShaderInfoLog(h).trim(),
  10234. w = o.getShaderInfoLog(p).trim(),
  10235. !(s = l = !0) === o.getProgramParameter(g, 35714) ? (l = !1,
  10236. u = So(o, h, "vertex"),
  10237. e = So(o, p, "fragment"),
  10238. console.error("THREE.WebGLProgram: shader error: ", o.getError(), "35715", o.getProgramParameter(g, 35715), "gl.getProgramInfoLog", c, u, e),
  10239. e ? console.log(d.split("\n").map(function(e, t) {
  10240. return "".concat(t + 1).padEnd(5) + e
  10241. }).join("\n")) : console.log(f.split("\n").map(function(e, t) {
  10242. return "".concat(t + 1).padEnd(5) + e
  10243. }).join("\n"))) : "" !== c ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", c) : "" !== y && "" !== w || (s = !1),
  10244. s && (this.diagnostics = {
  10245. runnable: l,
  10246. programLog: c,
  10247. vertexShader: {
  10248. log: y,
  10249. prefix: r
  10250. },
  10251. fragmentShader: {
  10252. log: w,
  10253. prefix: a
  10254. }
  10255. })),
  10256. o.deleteShader(h),
  10257. o.deleteShader(p),
  10258. this.getUniforms = function() {
  10259. return b = void 0 === b ? new _o(o,g) : b
  10260. }
  10261. ,
  10262. this.getAttributes = function() {
  10263. return x = void 0 === x ? function(e, t) {
  10264. for (var n = {}, i = e.getProgramParameter(t, 35721), r = 0; r < i; r++) {
  10265. var a = e.getActiveAttrib(t, r).name;
  10266. n[a] = e.getAttribLocation(t, a)
  10267. }
  10268. return n
  10269. }(o, g) : x
  10270. }
  10271. ,
  10272. this.destroy = function() {
  10273. i.releaseStatesOfProgram(this),
  10274. o.deleteProgram(g),
  10275. this.program = void 0
  10276. }
  10277. ,
  10278. this.name = n.shaderName,
  10279. this.id = Ao++,
  10280. this.cacheKey = t,
  10281. this.usedTimes = 1,
  10282. this.program = g,
  10283. this.vertexShader = h,
  10284. this.fragmentShader = p,
  10285. this
  10286. }
  10287. function Ho(d, h, p, f, o, m) {
  10288. var s = []
  10289. , v = f.isWebGL2
  10290. , g = f.logarithmicDepthBuffer
  10291. , y = f.floatVertexTextures
  10292. , w = f.maxVertexUniforms
  10293. , b = f.vertexTextures
  10294. , x = f.precision
  10295. , E = {
  10296. MeshDepthMaterial: "depth",
  10297. MeshDistanceMaterial: "distanceRGBA",
  10298. MeshNormalMaterial: "normal",
  10299. MeshBasicMaterial: "basic",
  10300. MeshLambertMaterial: "lambert",
  10301. MeshPhongMaterial: "phong",
  10302. MeshToonMaterial: "toon",
  10303. MeshStandardMaterial: "physical",
  10304. MeshPhysicalMaterial: "physical",
  10305. MeshMatcapMaterial: "matcap",
  10306. LineBasicMaterial: "basic",
  10307. LineDashedMaterial: "dashed",
  10308. PointsMaterial: "points",
  10309. ShadowMaterial: "shadow",
  10310. SpriteMaterial: "sprite"
  10311. }
  10312. , r = ["precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "instancingColor", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen", "transmissionMap"];
  10313. function _(e) {
  10314. e = e && e.isTexture ? e.encoding : e && e.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),
  10315. e.texture.encoding) : rn;
  10316. return e
  10317. }
  10318. return {
  10319. getParameters: function(e, t, n, i, r) {
  10320. var a, o, s = i.fog, l = e.isMeshStandardMaterial ? i.environment : null, i = h.get(e.envMap || l), l = E[e.type], u = r.isSkinnedMesh ? (u = (o = r).skeleton.bones,
  10321. y ? 1024 : (o = Math.floor((w - 20) / 4),
  10322. (o = Math.min(o, u.length)) < u.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + u.length + " bones. This GPU supports " + o + "."),
  10323. 0) : o)) : 0;
  10324. null !== e.precision && (x = f.getMaxPrecision(e.precision)) !== e.precision && console.warn("THREE.WebGLProgram.getParameters:", e.precision, "not supported, using", x, "instead."),
  10325. o = l ? (a = (c = ha[l]).vertexShader,
  10326. c.fragmentShader) : (a = e.vertexShader,
  10327. e.fragmentShader);
  10328. var c = d.getRenderTarget();
  10329. return {
  10330. isWebGL2: v,
  10331. shaderID: l,
  10332. shaderName: e.type,
  10333. vertexShader: a,
  10334. fragmentShader: o,
  10335. defines: e.defines,
  10336. isRawShaderMaterial: !0 === e.isRawShaderMaterial,
  10337. glslVersion: e.glslVersion,
  10338. precision: x,
  10339. instancing: !0 === r.isInstancedMesh,
  10340. instancingColor: !0 === r.isInstancedMesh && null !== r.instanceColor,
  10341. supportsVertexTextures: b,
  10342. outputEncoding: null !== c ? _(c.texture) : d.outputEncoding,
  10343. map: !!e.map,
  10344. mapEncoding: _(e.map),
  10345. matcap: !!e.matcap,
  10346. matcapEncoding: _(e.matcap),
  10347. envMap: !!i,
  10348. envMapMode: i && i.mapping,
  10349. envMapEncoding: _(i),
  10350. envMapCubeUV: !!i && (i.mapping === z || i.mapping === U),
  10351. lightMap: !!e.lightMap,
  10352. lightMapEncoding: _(e.lightMap),
  10353. aoMap: !!e.aoMap,
  10354. emissiveMap: !!e.emissiveMap,
  10355. emissiveMapEncoding: _(e.emissiveMap),
  10356. bumpMap: !!e.bumpMap,
  10357. normalMap: !!e.normalMap,
  10358. objectSpaceNormalMap: e.normalMapType === ln,
  10359. tangentSpaceNormalMap: e.normalMapType === sn,
  10360. clearcoatMap: !!e.clearcoatMap,
  10361. clearcoatRoughnessMap: !!e.clearcoatRoughnessMap,
  10362. clearcoatNormalMap: !!e.clearcoatNormalMap,
  10363. displacementMap: !!e.displacementMap,
  10364. roughnessMap: !!e.roughnessMap,
  10365. metalnessMap: !!e.metalnessMap,
  10366. specularMap: !!e.specularMap,
  10367. alphaMap: !!e.alphaMap,
  10368. gradientMap: !!e.gradientMap,
  10369. sheen: !!e.sheen,
  10370. transmissionMap: !!e.transmissionMap,
  10371. combine: e.combine,
  10372. vertexTangents: e.normalMap && e.vertexTangents,
  10373. vertexColors: e.vertexColors,
  10374. vertexUvs: !!(e.map || e.bumpMap || e.normalMap || e.specularMap || e.alphaMap || e.emissiveMap || e.roughnessMap || e.metalnessMap || e.clearcoatMap || e.clearcoatRoughnessMap || e.clearcoatNormalMap || e.displacementMap || e.transmissionMap),
  10375. uvsVertexOnly: !(e.map || e.bumpMap || e.normalMap || e.specularMap || e.alphaMap || e.emissiveMap || e.roughnessMap || e.metalnessMap || e.clearcoatNormalMap || e.transmissionMap || !e.displacementMap),
  10376. fog: !!s,
  10377. useFog: e.fog,
  10378. fogExp2: s && s.isFogExp2,
  10379. flatShading: e.flatShading,
  10380. sizeAttenuation: e.sizeAttenuation,
  10381. logarithmicDepthBuffer: g,
  10382. skinning: e.skinning && 0 < u,
  10383. maxBones: u,
  10384. useVertexTexture: y,
  10385. morphTargets: e.morphTargets,
  10386. morphNormals: e.morphNormals,
  10387. maxMorphTargets: d.maxMorphTargets,
  10388. maxMorphNormals: d.maxMorphNormals,
  10389. numDirLights: t.directional.length,
  10390. numPointLights: t.point.length,
  10391. numSpotLights: t.spot.length,
  10392. numRectAreaLights: t.rectArea.length,
  10393. numHemiLights: t.hemi.length,
  10394. numDirLightShadows: t.directionalShadowMap.length,
  10395. numPointLightShadows: t.pointShadowMap.length,
  10396. numSpotLightShadows: t.spotShadowMap.length,
  10397. numClippingPlanes: m.numPlanes,
  10398. numClipIntersection: m.numIntersection,
  10399. dithering: e.dithering,
  10400. shadowMapEnabled: d.shadowMap.enabled && 0 < n.length,
  10401. shadowMapType: d.shadowMap.type,
  10402. toneMapping: e.toneMapped ? d.toneMapping : De,
  10403. physicallyCorrectLights: d.physicallyCorrectLights,
  10404. premultipliedAlpha: e.premultipliedAlpha,
  10405. alphaTest: e.alphaTest,
  10406. doubleSided: e.side === Y,
  10407. flipSided: e.side === J,
  10408. depthPacking: void 0 !== e.depthPacking && e.depthPacking,
  10409. index0AttributeName: e.index0AttributeName,
  10410. extensionDerivatives: e.extensions && e.extensions.derivatives,
  10411. extensionFragDepth: e.extensions && e.extensions.fragDepth,
  10412. extensionDrawBuffers: e.extensions && e.extensions.drawBuffers,
  10413. extensionShaderTextureLOD: e.extensions && e.extensions.shaderTextureLOD,
  10414. rendererExtensionFragDepth: v || p.has("EXT_frag_depth"),
  10415. rendererExtensionDrawBuffers: v || p.has("WEBGL_draw_buffers"),
  10416. rendererExtensionShaderTextureLod: v || p.has("EXT_shader_texture_lod"),
  10417. customProgramCacheKey: e.customProgramCacheKey()
  10418. }
  10419. },
  10420. getProgramCacheKey: function(e) {
  10421. var t = [];
  10422. if (e.shaderID ? t.push(e.shaderID) : (t.push(e.fragmentShader),
  10423. t.push(e.vertexShader)),
  10424. void 0 !== e.defines)
  10425. for (var n in e.defines)
  10426. t.push(n),
  10427. t.push(e.defines[n]);
  10428. if (!1 === e.isRawShaderMaterial) {
  10429. for (var i = 0; i < r.length; i++)
  10430. t.push(e[r[i]]);
  10431. t.push(d.outputEncoding),
  10432. t.push(d.gammaFactor)
  10433. }
  10434. return t.push(e.customProgramCacheKey),
  10435. t.join()
  10436. },
  10437. getUniforms: function(e) {
  10438. var t = E[e.type];
  10439. return t ? (t = ha[t],
  10440. Jr.clone(t.uniforms)) : e.uniforms
  10441. },
  10442. acquireProgram: function(e, t) {
  10443. for (var n, i = 0, r = s.length; i < r; i++) {
  10444. var a = s[i];
  10445. if (a.cacheKey === t) {
  10446. ++(n = a).usedTimes;
  10447. break
  10448. }
  10449. }
  10450. return void 0 === n && (n = new Go(d,t,e,o),
  10451. s.push(n)),
  10452. n
  10453. },
  10454. releaseProgram: function(e) {
  10455. var t;
  10456. 0 == --e.usedTimes && (t = s.indexOf(e),
  10457. s[t] = s[s.length - 1],
  10458. s.pop(),
  10459. e.destroy())
  10460. },
  10461. programs: s
  10462. }
  10463. }
  10464. function Vo() {
  10465. var i = new WeakMap;
  10466. return {
  10467. get: function(e) {
  10468. var t = i.get(e);
  10469. return void 0 === t && i.set(e, t = {}),
  10470. t
  10471. },
  10472. remove: function(e) {
  10473. i.delete(e)
  10474. },
  10475. update: function(e, t, n) {
  10476. i.get(e)[t] = n
  10477. },
  10478. dispose: function() {
  10479. i = new WeakMap
  10480. }
  10481. }
  10482. }
  10483. function jo(e, t) {
  10484. return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.program !== t.program ? e.program.id - t.program.id : e.material.id !== t.material.id ? e.material.id - t.material.id : e.z !== t.z ? e.z - t.z : e.id - t.id
  10485. }
  10486. function Wo(e, t) {
  10487. return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.z !== t.z ? t.z - e.z : e.id - t.id
  10488. }
  10489. function Xo(l) {
  10490. var u = []
  10491. , c = 0
  10492. , o = []
  10493. , s = []
  10494. , d = {
  10495. id: -1
  10496. };
  10497. function h(e, t, n, i, r, a) {
  10498. var o = u[c]
  10499. , s = l.get(n);
  10500. return void 0 === o ? (o = {
  10501. id: e.id,
  10502. object: e,
  10503. geometry: t,
  10504. material: n,
  10505. program: s.program || d,
  10506. groupOrder: i,
  10507. renderOrder: e.renderOrder,
  10508. z: r,
  10509. group: a
  10510. },
  10511. u[c] = o) : (o.id = e.id,
  10512. o.object = e,
  10513. o.geometry = t,
  10514. o.material = n,
  10515. o.program = s.program || d,
  10516. o.groupOrder = i,
  10517. o.renderOrder = e.renderOrder,
  10518. o.z = r,
  10519. o.group = a),
  10520. c++,
  10521. o
  10522. }
  10523. return {
  10524. opaque: o,
  10525. transparent: s,
  10526. init: function() {
  10527. c = 0,
  10528. o.length = 0,
  10529. s.length = 0
  10530. },
  10531. push: function(e, t, n, i, r, a) {
  10532. a = h(e, t, n, i, r, a),
  10533. (!0 === n.transparent ? s : o).push(a)
  10534. },
  10535. unshift: function(e, t, n, i, r, a) {
  10536. a = h(e, t, n, i, r, a),
  10537. (!0 === n.transparent ? s : o).unshift(a)
  10538. },
  10539. finish: function() {
  10540. for (var e = c, t = u.length; e < t; e++) {
  10541. var n = u[e];
  10542. if (null === n.id)
  10543. break;
  10544. n.id = null,
  10545. n.object = null,
  10546. n.geometry = null,
  10547. n.material = null,
  10548. n.program = null,
  10549. n.group = null
  10550. }
  10551. },
  10552. sort: function(e, t) {
  10553. 1 < o.length && o.sort(e || jo),
  10554. 1 < s.length && s.sort(t || Wo)
  10555. }
  10556. }
  10557. }
  10558. function qo(r) {
  10559. var a = new WeakMap;
  10560. return {
  10561. get: function(e, t) {
  10562. var n, i = a.get(e);
  10563. return void 0 === i ? (n = new Xo(r),
  10564. a.set(e, new WeakMap),
  10565. a.get(e).set(t, n)) : void 0 === (n = i.get(t)) && (n = new Xo(r),
  10566. i.set(t, n)),
  10567. n
  10568. },
  10569. dispose: function() {
  10570. a = new WeakMap
  10571. }
  10572. }
  10573. }
  10574. function Jo() {
  10575. var n = {};
  10576. return {
  10577. get: function(e) {
  10578. if (void 0 !== n[e.id])
  10579. return n[e.id];
  10580. var t;
  10581. switch (e.type) {
  10582. case "DirectionalLight":
  10583. t = {
  10584. direction: new Cn,
  10585. color: new Yi
  10586. };
  10587. break;
  10588. case "SpotLight":
  10589. t = {
  10590. position: new Cn,
  10591. direction: new Cn,
  10592. color: new Yi,
  10593. distance: 0,
  10594. coneCos: 0,
  10595. penumbraCos: 0,
  10596. decay: 0
  10597. };
  10598. break;
  10599. case "PointLight":
  10600. t = {
  10601. position: new Cn,
  10602. color: new Yi,
  10603. distance: 0,
  10604. decay: 0
  10605. };
  10606. break;
  10607. case "HemisphereLight":
  10608. t = {
  10609. direction: new Cn,
  10610. skyColor: new Yi,
  10611. groundColor: new Yi
  10612. };
  10613. break;
  10614. case "RectAreaLight":
  10615. t = {
  10616. color: new Yi,
  10617. position: new Cn,
  10618. halfWidth: new Cn,
  10619. halfHeight: new Cn
  10620. }
  10621. }
  10622. return n[e.id] = t
  10623. }
  10624. }
  10625. }
  10626. var Yo = 0;
  10627. function Zo(e, t) {
  10628. return (t.castShadow ? 1 : 0) - (e.castShadow ? 1 : 0)
  10629. }
  10630. function Qo(S, C) {
  10631. for (var n, P = new Jo, D = (n = {},
  10632. {
  10633. get: function(e) {
  10634. if (void 0 !== n[e.id])
  10635. return n[e.id];
  10636. var t;
  10637. switch (e.type) {
  10638. case "DirectionalLight":
  10639. case "SpotLight":
  10640. t = {
  10641. shadowBias: 0,
  10642. shadowNormalBias: 0,
  10643. shadowRadius: 1,
  10644. shadowMapSize: new yn
  10645. };
  10646. break;
  10647. case "PointLight":
  10648. t = {
  10649. shadowBias: 0,
  10650. shadowNormalBias: 0,
  10651. shadowRadius: 1,
  10652. shadowMapSize: new yn,
  10653. shadowCameraNear: 1,
  10654. shadowCameraFar: 1e3
  10655. }
  10656. }
  10657. return n[e.id] = t
  10658. }
  10659. }), k = {
  10660. version: 0,
  10661. hash: {
  10662. directionalLength: -1,
  10663. pointLength: -1,
  10664. spotLength: -1,
  10665. rectAreaLength: -1,
  10666. hemiLength: -1,
  10667. numDirectionalShadows: -1,
  10668. numPointShadows: -1,
  10669. numSpotShadows: -1
  10670. },
  10671. ambient: [0, 0, 0],
  10672. probe: [],
  10673. directional: [],
  10674. directionalShadow: [],
  10675. directionalShadowMap: [],
  10676. directionalShadowMatrix: [],
  10677. spot: [],
  10678. spotShadow: [],
  10679. spotShadowMap: [],
  10680. spotShadowMatrix: [],
  10681. rectArea: [],
  10682. rectAreaLTC1: null,
  10683. rectAreaLTC2: null,
  10684. point: [],
  10685. pointShadow: [],
  10686. pointShadowMap: [],
  10687. pointShadowMatrix: [],
  10688. hemi: []
  10689. }, e = 0; e < 9; e++)
  10690. k.probe.push(new Cn);
  10691. var f = new Cn
  10692. , m = new ni
  10693. , v = new ni;
  10694. return {
  10695. setup: function(e) {
  10696. for (var t = 0, n = 0, i = 0, r = 0; r < 9; r++)
  10697. k.probe[r].set(0, 0, 0);
  10698. var a = 0
  10699. , o = 0
  10700. , s = 0
  10701. , l = 0
  10702. , u = 0
  10703. , c = 0
  10704. , d = 0
  10705. , h = 0;
  10706. e.sort(Zo);
  10707. for (var p = 0, f = e.length; p < f; p++) {
  10708. var m, v, g, y, w, b = e[p], x = b.color, E = b.intensity, _ = b.distance, M = b.shadow && b.shadow.map ? b.shadow.map.texture : null;
  10709. if (b.isAmbientLight)
  10710. t += x.r * E,
  10711. n += x.g * E,
  10712. i += x.b * E;
  10713. else if (b.isLightProbe)
  10714. for (var A = 0; A < 9; A++)
  10715. k.probe[A].addScaledVector(b.sh.coefficients[A], E);
  10716. else
  10717. b.isDirectionalLight ? ((g = P.get(b)).color.copy(b.color).multiplyScalar(b.intensity),
  10718. b.castShadow && (m = b.shadow,
  10719. (v = D.get(b)).shadowBias = m.bias,
  10720. v.shadowNormalBias = m.normalBias,
  10721. v.shadowRadius = m.radius,
  10722. v.shadowMapSize = m.mapSize,
  10723. k.directionalShadow[a] = v,
  10724. k.directionalShadowMap[a] = M,
  10725. k.directionalShadowMatrix[a] = b.shadow.matrix,
  10726. c++),
  10727. k.directional[a] = g,
  10728. a++) : b.isSpotLight ? ((v = P.get(b)).position.setFromMatrixPosition(b.matrixWorld),
  10729. v.color.copy(x).multiplyScalar(E),
  10730. v.distance = _,
  10731. v.coneCos = Math.cos(b.angle),
  10732. v.penumbraCos = Math.cos(b.angle * (1 - b.penumbra)),
  10733. v.decay = b.decay,
  10734. b.castShadow && (g = b.shadow,
  10735. (_ = D.get(b)).shadowBias = g.bias,
  10736. _.shadowNormalBias = g.normalBias,
  10737. _.shadowRadius = g.radius,
  10738. _.shadowMapSize = g.mapSize,
  10739. k.spotShadow[s] = _,
  10740. k.spotShadowMap[s] = M,
  10741. k.spotShadowMatrix[s] = b.shadow.matrix,
  10742. h++),
  10743. k.spot[s] = v,
  10744. s++) : b.isRectAreaLight ? ((y = P.get(b)).color.copy(x).multiplyScalar(E),
  10745. y.halfWidth.set(.5 * b.width, 0, 0),
  10746. y.halfHeight.set(0, .5 * b.height, 0),
  10747. k.rectArea[l] = y,
  10748. l++) : b.isPointLight ? ((w = P.get(b)).color.copy(b.color).multiplyScalar(b.intensity),
  10749. w.distance = b.distance,
  10750. w.decay = b.decay,
  10751. b.castShadow && (x = b.shadow,
  10752. (y = D.get(b)).shadowBias = x.bias,
  10753. y.shadowNormalBias = x.normalBias,
  10754. y.shadowRadius = x.radius,
  10755. y.shadowMapSize = x.mapSize,
  10756. y.shadowCameraNear = x.camera.near,
  10757. y.shadowCameraFar = x.camera.far,
  10758. k.pointShadow[o] = y,
  10759. k.pointShadowMap[o] = M,
  10760. k.pointShadowMatrix[o] = b.shadow.matrix,
  10761. d++),
  10762. k.point[o] = w,
  10763. o++) : b.isHemisphereLight && ((w = P.get(b)).skyColor.copy(b.color).multiplyScalar(E),
  10764. w.groundColor.copy(b.groundColor).multiplyScalar(E),
  10765. k.hemi[u] = w,
  10766. u++)
  10767. }
  10768. 0 < l && (C.isWebGL2 || !0 === S.has("OES_texture_float_linear") ? (k.rectAreaLTC1 = da.LTC_FLOAT_1,
  10769. k.rectAreaLTC2 = da.LTC_FLOAT_2) : !0 === S.has("OES_texture_half_float_linear") ? (k.rectAreaLTC1 = da.LTC_HALF_1,
  10770. k.rectAreaLTC2 = da.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),
  10771. k.ambient[0] = t,
  10772. k.ambient[1] = n,
  10773. k.ambient[2] = i;
  10774. var T = k.hash;
  10775. T.directionalLength === a && T.pointLength === o && T.spotLength === s && T.rectAreaLength === l && T.hemiLength === u && T.numDirectionalShadows === c && T.numPointShadows === d && T.numSpotShadows === h || (k.directional.length = a,
  10776. k.spot.length = s,
  10777. k.rectArea.length = l,
  10778. k.point.length = o,
  10779. k.hemi.length = u,
  10780. k.directionalShadow.length = c,
  10781. k.directionalShadowMap.length = c,
  10782. k.pointShadow.length = d,
  10783. k.pointShadowMap.length = d,
  10784. k.spotShadow.length = h,
  10785. k.spotShadowMap.length = h,
  10786. k.directionalShadowMatrix.length = c,
  10787. k.pointShadowMatrix.length = d,
  10788. k.spotShadowMatrix.length = h,
  10789. T.directionalLength = a,
  10790. T.pointLength = o,
  10791. T.spotLength = s,
  10792. T.rectAreaLength = l,
  10793. T.hemiLength = u,
  10794. T.numDirectionalShadows = c,
  10795. T.numPointShadows = d,
  10796. T.numSpotShadows = h,
  10797. k.version = Yo++)
  10798. },
  10799. setupView: function(e, t) {
  10800. for (var n = 0, i = 0, r = 0, a = 0, o = 0, s = t.matrixWorldInverse, l = 0, u = e.length; l < u; l++) {
  10801. var c, d, h, p = e[l];
  10802. p.isDirectionalLight ? ((c = k.directional[n]).direction.setFromMatrixPosition(p.matrixWorld),
  10803. f.setFromMatrixPosition(p.target.matrixWorld),
  10804. c.direction.sub(f),
  10805. c.direction.transformDirection(s),
  10806. n++) : p.isSpotLight ? ((d = k.spot[r]).position.setFromMatrixPosition(p.matrixWorld),
  10807. d.position.applyMatrix4(s),
  10808. d.direction.setFromMatrixPosition(p.matrixWorld),
  10809. f.setFromMatrixPosition(p.target.matrixWorld),
  10810. d.direction.sub(f),
  10811. d.direction.transformDirection(s),
  10812. r++) : p.isRectAreaLight ? ((d = k.rectArea[a]).position.setFromMatrixPosition(p.matrixWorld),
  10813. d.position.applyMatrix4(s),
  10814. v.identity(),
  10815. m.copy(p.matrixWorld),
  10816. m.premultiply(s),
  10817. v.extractRotation(m),
  10818. d.halfWidth.set(.5 * p.width, 0, 0),
  10819. d.halfHeight.set(0, .5 * p.height, 0),
  10820. d.halfWidth.applyMatrix4(v),
  10821. d.halfHeight.applyMatrix4(v),
  10822. a++) : p.isPointLight ? ((h = k.point[i]).position.setFromMatrixPosition(p.matrixWorld),
  10823. h.position.applyMatrix4(s),
  10824. i++) : p.isHemisphereLight && ((h = k.hemi[o]).direction.setFromMatrixPosition(p.matrixWorld),
  10825. h.direction.transformDirection(s),
  10826. h.direction.normalize(),
  10827. o++)
  10828. }
  10829. },
  10830. state: k
  10831. }
  10832. }
  10833. function Ko(e, t) {
  10834. var n = new Qo(e,t)
  10835. , i = []
  10836. , r = [];
  10837. return {
  10838. init: function() {
  10839. i.length = 0,
  10840. r.length = 0
  10841. },
  10842. state: {
  10843. lightsArray: i,
  10844. shadowsArray: r,
  10845. lights: n
  10846. },
  10847. setupLights: function() {
  10848. n.setup(i)
  10849. },
  10850. setupLightsView: function(e) {
  10851. n.setupView(i, e)
  10852. },
  10853. pushLight: function(e) {
  10854. i.push(e)
  10855. },
  10856. pushShadow: function(e) {
  10857. r.push(e)
  10858. }
  10859. }
  10860. }
  10861. function $o(i, r) {
  10862. var a = new WeakMap;
  10863. return {
  10864. get: function(e) {
  10865. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  10866. return !1 === a.has(e) ? (t = new Ko(i,r),
  10867. a.set(e, []),
  10868. a.get(e).push(t)) : n >= a.get(e).length ? (t = new Ko(i,r),
  10869. a.get(e).push(t)) : t = a.get(e)[n],
  10870. t
  10871. },
  10872. dispose: function() {
  10873. a = new WeakMap
  10874. }
  10875. }
  10876. }
  10877. function es(e) {
  10878. Ki.call(this),
  10879. this.type = "MeshDepthMaterial",
  10880. this.depthPacking = 3200,
  10881. this.skinning = !1,
  10882. this.morphTargets = !1,
  10883. this.map = null,
  10884. this.alphaMap = null,
  10885. this.displacementMap = null,
  10886. this.displacementScale = 1,
  10887. this.displacementBias = 0,
  10888. this.wireframe = !1,
  10889. this.wireframelineWidth = 1,
  10890. this.fog = !1,
  10891. this.setValues(e)
  10892. }
  10893. function ts(e) {
  10894. Ki.call(this),
  10895. this.type = "MeshDistanceMaterial",
  10896. this.referencePosition = new Cn,
  10897. this.nearDistance = 1,
  10898. this.farDistance = 1e3,
  10899. this.skinning = !1,
  10900. this.morphTargets = !1,
  10901. this.map = null,
  10902. this.alphaMap = null,
  10903. this.displacementMap = null,
  10904. this.displacementScale = 1,
  10905. this.displacementBias = 0,
  10906. this.fog = !1,
  10907. this.setValues(e)
  10908. }
  10909. ((es.prototype = Object.create(Ki.prototype)).constructor = es).prototype.isMeshDepthMaterial = !0,
  10910. es.prototype.copy = function(e) {
  10911. return Ki.prototype.copy.call(this, e),
  10912. this.depthPacking = e.depthPacking,
  10913. this.skinning = e.skinning,
  10914. this.morphTargets = e.morphTargets,
  10915. this.map = e.map,
  10916. this.alphaMap = e.alphaMap,
  10917. this.displacementMap = e.displacementMap,
  10918. this.displacementScale = e.displacementScale,
  10919. this.displacementBias = e.displacementBias,
  10920. this.wireframe = e.wireframe,
  10921. this.wireframelineWidth = e.wireframelineWidth,
  10922. this
  10923. }
  10924. ,
  10925. ((ts.prototype = Object.create(Ki.prototype)).constructor = ts).prototype.isMeshDistanceMaterial = !0,
  10926. ts.prototype.copy = function(e) {
  10927. return Ki.prototype.copy.call(this, e),
  10928. this.referencePosition.copy(e.referencePosition),
  10929. this.nearDistance = e.nearDistance,
  10930. this.farDistance = e.farDistance,
  10931. this.skinning = e.skinning,
  10932. this.morphTargets = e.morphTargets,
  10933. this.map = e.map,
  10934. this.alphaMap = e.alphaMap,
  10935. this.displacementMap = e.displacementMap,
  10936. this.displacementScale = e.displacementScale,
  10937. this.displacementBias = e.displacementBias,
  10938. this
  10939. }
  10940. ;
  10941. var ns = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"
  10942. , is = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
  10943. function rs(g, y, w) {
  10944. var b = new oa
  10945. , x = new yn
  10946. , E = new yn
  10947. , _ = new Mn
  10948. , r = []
  10949. , a = []
  10950. , h = {}
  10951. , p = {
  10952. 0: J,
  10953. 1: q,
  10954. 2: Y
  10955. }
  10956. , M = new Qr({
  10957. defines: {
  10958. SAMPLE_RATE: .25,
  10959. HALF_SAMPLE_RATE: 1 / 8
  10960. },
  10961. uniforms: {
  10962. shadow_pass: {
  10963. value: null
  10964. },
  10965. resolution: {
  10966. value: new yn
  10967. },
  10968. radius: {
  10969. value: 4
  10970. }
  10971. },
  10972. vertexShader: is,
  10973. fragmentShader: ns
  10974. })
  10975. , A = M.clone();
  10976. A.defines.HORIZONTAL_PASS = 1;
  10977. var e = new Mr;
  10978. e.setAttribute("position", new nr(new Float32Array([-1, -1, .5, 3, -1, .5, -1, 3, .5]),3));
  10979. var T = new Hr(e,M)
  10980. , S = this;
  10981. function f(e, t, n) {
  10982. var i = e << 0 | t << 1 | n << 2
  10983. , n = r[i];
  10984. return void 0 === n && (n = new es({
  10985. depthPacking: on,
  10986. morphTargets: e,
  10987. skinning: t
  10988. }),
  10989. r[i] = n),
  10990. n
  10991. }
  10992. function m(e, t, n) {
  10993. var i = e << 0 | t << 1 | n << 2
  10994. , n = a[i];
  10995. return void 0 === n && (n = new ts({
  10996. morphTargets: e,
  10997. skinning: t
  10998. }),
  10999. a[i] = n),
  11000. n
  11001. }
  11002. function C(e, t, n, i, r, a, o) {
  11003. var s, l, u = null, c = f, d = e.customDepthMaterial;
  11004. return !0 === i.isPointLight && (c = m,
  11005. d = e.customDistanceMaterial),
  11006. u = void 0 === d ? (!(s = !1) === n.morphTargets && (s = t.morphAttributes && t.morphAttributes.position && 0 < t.morphAttributes.position.length),
  11007. !(l = !1) === e.isSkinnedMesh && (!0 === n.skinning ? l = !0 : console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:", e)),
  11008. c(s, l, !0 === e.isInstancedMesh)) : d,
  11009. g.localClippingEnabled && !0 === n.clipShadows && 0 !== n.clippingPlanes.length && (l = u.uuid,
  11010. e = n.uuid,
  11011. void 0 === (d = h[l]) && (h[l] = d = {}),
  11012. void 0 === (l = d[e]) && (l = u.clone(),
  11013. d[e] = l),
  11014. u = l),
  11015. u.visible = n.visible,
  11016. u.wireframe = n.wireframe,
  11017. u.side = o === D ? null !== n.shadowSide ? n.shadowSide : n.side : null !== n.shadowSide ? n.shadowSide : p[n.side],
  11018. u.clipShadows = n.clipShadows,
  11019. u.clippingPlanes = n.clippingPlanes,
  11020. u.clipIntersection = n.clipIntersection,
  11021. u.wireframelineWidth = n.wireframelineWidth,
  11022. u.lineWidth = n.lineWidth,
  11023. !0 === i.isPointLight && !0 === u.isMeshDistanceMaterial && (u.referencePosition.setFromMatrixPosition(i.matrixWorld),
  11024. u.nearDistance = r,
  11025. u.farDistance = a),
  11026. u
  11027. }
  11028. this.enabled = !1,
  11029. this.autoUpdate = !0,
  11030. this.needsUpdate = !1,
  11031. this.type = P,
  11032. this.render = function(e, t, n) {
  11033. if (!1 !== S.enabled && (!1 !== S.autoUpdate || !1 !== S.needsUpdate) && 0 !== e.length) {
  11034. var i = g.getRenderTarget()
  11035. , r = g.getActiveCubeFace()
  11036. , a = g.getActiveMipmapLevel()
  11037. , o = g.state;
  11038. o.setBlending(Z),
  11039. o.buffers.color.setClear(1, 1, 1, 1),
  11040. o.buffers.depth.setTest(!0),
  11041. o.setScissorTest(!1);
  11042. for (var s, l = 0, u = e.length; l < u; l++) {
  11043. var c = e[l]
  11044. , d = c.shadow;
  11045. if (void 0 !== d) {
  11046. if (!1 !== d.autoUpdate || !1 !== d.needsUpdate) {
  11047. x.copy(d.mapSize);
  11048. var h, p = d.getFrameExtents();
  11049. x.multiply(p),
  11050. E.copy(d.mapSize),
  11051. (x.x > w || x.y > w) && (x.x > w && (E.x = Math.floor(w / p.x),
  11052. x.x = E.x * p.x,
  11053. d.mapSize.x = E.x),
  11054. x.y > w && (E.y = Math.floor(w / p.y),
  11055. x.y = E.y * p.y,
  11056. d.mapSize.y = E.y)),
  11057. null !== d.map || d.isPointLightShadow || this.type !== D || (d.map = new An(x.x,x.y,h = {
  11058. minFilter: Oe,
  11059. magFilter: Oe,
  11060. format: et
  11061. }),
  11062. d.map.texture.name = c.name + ".shadowMap",
  11063. d.mapPass = new An(x.x,x.y,h),
  11064. d.camera.updateProjectionMatrix()),
  11065. null === d.map && (d.map = new An(x.x,x.y,{
  11066. minFilter: Re,
  11067. magFilter: Re,
  11068. format: et
  11069. }),
  11070. d.map.texture.name = c.name + ".shadowMap",
  11071. d.camera.updateProjectionMatrix()),
  11072. g.setRenderTarget(d.map),
  11073. g.clear();
  11074. for (var f = d.getViewportCount(), m = 0; m < f; m++) {
  11075. var v = d.getViewport(m);
  11076. _.set(E.x * v.x, E.y * v.y, E.x * v.z, E.y * v.w),
  11077. o.viewport(_),
  11078. d.updateMatrices(c, m),
  11079. b = d.getFrustum(),
  11080. function e(t, n, i, r, a) {
  11081. if (!1 === t.visible)
  11082. return;
  11083. var o = t.layers.test(n.layers);
  11084. if (o && (t.isMesh || t.isLine || t.isPoints) && (t.castShadow || t.receiveShadow && a === D) && (!t.frustumCulled || b.intersectsObject(t))) {
  11085. t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse, t.matrixWorld);
  11086. var s = y.update(t)
  11087. , l = t.material;
  11088. if (Array.isArray(l))
  11089. for (var u = s.groups, c = 0, d = u.length; c < d; c++) {
  11090. var h = u[c]
  11091. , p = l[h.materialIndex];
  11092. p && p.visible && (p = C(t, s, p, r, i.near, i.far, a),
  11093. g.renderBufferDirect(i, null, s, p, t, h))
  11094. }
  11095. else
  11096. l.visible && (o = C(t, s, l, r, i.near, i.far, a),
  11097. g.renderBufferDirect(i, null, s, o, t, null))
  11098. }
  11099. var f = t.children;
  11100. for (var m = 0, v = f.length; m < v; m++)
  11101. e(f[m], n, i, r, a)
  11102. }(t, n, d.camera, c, this.type)
  11103. }
  11104. d.isPointLightShadow || this.type !== D || (s = d,
  11105. p = n,
  11106. h = void 0,
  11107. h = y.update(T),
  11108. M.uniforms.shadow_pass.value = s.map.texture,
  11109. M.uniforms.resolution.value = s.mapSize,
  11110. M.uniforms.radius.value = s.radius,
  11111. g.setRenderTarget(s.mapPass),
  11112. g.clear(),
  11113. g.renderBufferDirect(p, null, h, M, T, null),
  11114. A.uniforms.shadow_pass.value = s.mapPass.texture,
  11115. A.uniforms.resolution.value = s.mapSize,
  11116. A.uniforms.radius.value = s.radius,
  11117. g.setRenderTarget(s.map),
  11118. g.clear(),
  11119. g.renderBufferDirect(p, null, h, A, T, null)),
  11120. d.needsUpdate = !1
  11121. }
  11122. } else
  11123. console.warn("THREE.WebGLShadowMap:", c, "has no shadow.")
  11124. }
  11125. S.needsUpdate = !1,
  11126. g.setRenderTarget(i, r, a)
  11127. }
  11128. }
  11129. }
  11130. function as(c, e, t) {
  11131. var n = t.isWebGL2;
  11132. var i = new function() {
  11133. var t = !1
  11134. , a = new Mn
  11135. , n = null
  11136. , o = new Mn(0,0,0,0);
  11137. return {
  11138. setMask: function(e) {
  11139. n === e || t || (c.colorMask(e, e, e, e),
  11140. n = e)
  11141. },
  11142. setLocked: function(e) {
  11143. t = e
  11144. },
  11145. setClear: function(e, t, n, i, r) {
  11146. !0 === r && (e *= i,
  11147. t *= i,
  11148. n *= i),
  11149. a.set(e, t, n, i),
  11150. !1 === o.equals(a) && (c.clearColor(e, t, n, i),
  11151. o.copy(a))
  11152. },
  11153. reset: function() {
  11154. t = !1,
  11155. n = null,
  11156. o.set(-1, 0, 0, 0)
  11157. }
  11158. }
  11159. }
  11160. , r = new function() {
  11161. var t = !1
  11162. , n = null
  11163. , i = null
  11164. , r = null;
  11165. return {
  11166. setTest: function(e) {
  11167. (e ? B : L)(2929)
  11168. },
  11169. setMask: function(e) {
  11170. n === e || t || (c.depthMask(e),
  11171. n = e)
  11172. },
  11173. setFunc: function(e) {
  11174. if (i !== e) {
  11175. if (e)
  11176. switch (e) {
  11177. case Ee:
  11178. c.depthFunc(512);
  11179. break;
  11180. case _e:
  11181. c.depthFunc(519);
  11182. break;
  11183. case Me:
  11184. c.depthFunc(513);
  11185. break;
  11186. case Ae:
  11187. c.depthFunc(515);
  11188. break;
  11189. case Te:
  11190. c.depthFunc(514);
  11191. break;
  11192. case Se:
  11193. c.depthFunc(518);
  11194. break;
  11195. case Ce:
  11196. c.depthFunc(516);
  11197. break;
  11198. case Pe:
  11199. c.depthFunc(517);
  11200. break;
  11201. default:
  11202. c.depthFunc(515)
  11203. }
  11204. else
  11205. c.depthFunc(515);
  11206. i = e
  11207. }
  11208. },
  11209. setLocked: function(e) {
  11210. t = e
  11211. },
  11212. setClear: function(e) {
  11213. r !== e && (c.clearDepth(e),
  11214. r = e)
  11215. },
  11216. reset: function() {
  11217. t = !1,
  11218. r = i = n = null
  11219. }
  11220. }
  11221. }
  11222. , a = new function() {
  11223. var t = !1
  11224. , n = null
  11225. , i = null
  11226. , r = null
  11227. , a = null
  11228. , o = null
  11229. , s = null
  11230. , l = null
  11231. , u = null;
  11232. return {
  11233. setTest: function(e) {
  11234. t || (e ? B : L)(2960)
  11235. },
  11236. setMask: function(e) {
  11237. n === e || t || (c.stencilMask(e),
  11238. n = e)
  11239. },
  11240. setFunc: function(e, t, n) {
  11241. i === e && r === t && a === n || (c.stencilFunc(e, t, n),
  11242. i = e,
  11243. r = t,
  11244. a = n)
  11245. },
  11246. setOp: function(e, t, n) {
  11247. o === e && s === t && l === n || (c.stencilOp(e, t, n),
  11248. o = e,
  11249. s = t,
  11250. l = n)
  11251. },
  11252. setLocked: function(e) {
  11253. t = e
  11254. },
  11255. setClear: function(e) {
  11256. u !== e && (c.clearStencil(e),
  11257. u = e)
  11258. },
  11259. reset: function() {
  11260. t = !1,
  11261. u = l = s = o = a = r = i = n = null
  11262. }
  11263. }
  11264. }
  11265. , o = {}
  11266. , s = null
  11267. , l = null
  11268. , u = null
  11269. , d = null
  11270. , h = null
  11271. , p = null
  11272. , f = null
  11273. , m = null
  11274. , v = null
  11275. , g = !1
  11276. , y = null
  11277. , w = null
  11278. , b = null
  11279. , x = null
  11280. , E = null
  11281. , _ = c.getParameter(35661)
  11282. , M = !1
  11283. , A = 0
  11284. , t = c.getParameter(7938);
  11285. -1 !== t.indexOf("WebGL") ? (A = parseFloat(/^WebGL (\d)/.exec(t)[1]),
  11286. M = 1 <= A) : -1 !== t.indexOf("OpenGL ES") && (A = parseFloat(/^OpenGL ES (\d)/.exec(t)[1]),
  11287. M = 2 <= A);
  11288. var T = null
  11289. , S = {}
  11290. , C = new Mn
  11291. , P = new Mn;
  11292. function D(e, t, n) {
  11293. var i = new Uint8Array(4)
  11294. , r = c.createTexture();
  11295. c.bindTexture(e, r),
  11296. c.texParameteri(e, 10241, 9728),
  11297. c.texParameteri(e, 10240, 9728);
  11298. for (var a = 0; a < n; a++)
  11299. c.texImage2D(t + a, 0, 6408, 1, 1, 0, 6408, 5121, i);
  11300. return r
  11301. }
  11302. var k = {};
  11303. function B(e) {
  11304. !0 !== o[e] && (c.enable(e),
  11305. o[e] = !0)
  11306. }
  11307. function L(e) {
  11308. !1 !== o[e] && (c.disable(e),
  11309. o[e] = !1)
  11310. }
  11311. k[3553] = D(3553, 3553, 1),
  11312. k[34067] = D(34067, 34069, 6),
  11313. i.setClear(0, 0, 0, 1),
  11314. r.setClear(1),
  11315. a.setClear(0),
  11316. B(2929),
  11317. r.setFunc(Ae),
  11318. z(!1),
  11319. N(j),
  11320. B(2884),
  11321. O(Z);
  11322. var R, F = (H(A = {}, re, 32774),
  11323. H(A, ae, 32778),
  11324. H(A, oe, 32779),
  11325. A);
  11326. n ? (F[se] = 32775,
  11327. F[ce] = 32776) : null !== (R = e.get("EXT_blend_minmax")) && (F[se] = R.MIN_EXT,
  11328. F[ce] = R.MAX_EXT);
  11329. var I = (H(R = {}, de, 0),
  11330. H(R, he, 1),
  11331. H(R, pe, 768),
  11332. H(R, me, 770),
  11333. H(R, xe, 776),
  11334. H(R, we, 774),
  11335. H(R, ge, 772),
  11336. H(R, fe, 769),
  11337. H(R, ve, 771),
  11338. H(R, be, 775),
  11339. H(R, ye, 773),
  11340. R);
  11341. function O(e, t, n, i, r, a, o, s) {
  11342. if (e !== Z) {
  11343. if (l || (B(3042),
  11344. l = !0),
  11345. e === ie)
  11346. r = r || t,
  11347. a = a || n,
  11348. o = o || i,
  11349. t === d && r === f || (c.blendEquationSeparate(F[t], F[r]),
  11350. d = t,
  11351. f = r),
  11352. n === h && i === p && a === m && o === v || (c.blendFuncSeparate(I[n], I[i], I[a], I[o]),
  11353. h = n,
  11354. p = i,
  11355. m = a,
  11356. v = o),
  11357. u = e,
  11358. g = null;
  11359. else if (e !== u || s !== g) {
  11360. if (d === re && f === re || (c.blendEquation(32774),
  11361. f = d = re),
  11362. s)
  11363. switch (e) {
  11364. case K:
  11365. c.blendFuncSeparate(1, 771, 1, 771);
  11366. break;
  11367. case ee:
  11368. c.blendFunc(1, 1);
  11369. break;
  11370. case te:
  11371. c.blendFuncSeparate(0, 0, 769, 771);
  11372. break;
  11373. case ne:
  11374. c.blendFuncSeparate(0, 768, 0, 770);
  11375. break;
  11376. default:
  11377. console.error("THREE.WebGLState: Invalid blending: ", e)
  11378. }
  11379. else
  11380. switch (e) {
  11381. case K:
  11382. c.blendFuncSeparate(770, 771, 1, 771);
  11383. break;
  11384. case ee:
  11385. c.blendFunc(770, 1);
  11386. break;
  11387. case te:
  11388. c.blendFunc(0, 769);
  11389. break;
  11390. case ne:
  11391. c.blendFunc(0, 768);
  11392. break;
  11393. default:
  11394. console.error("THREE.WebGLState: Invalid blending: ", e)
  11395. }
  11396. v = m = p = h = null,
  11397. u = e,
  11398. g = s
  11399. }
  11400. } else
  11401. l && (L(3042),
  11402. l = !1)
  11403. }
  11404. function z(e) {
  11405. y !== e && (e ? c.frontFace(2304) : c.frontFace(2305),
  11406. y = e)
  11407. }
  11408. function N(e) {
  11409. e !== V ? (B(2884),
  11410. e !== w && (e === j ? c.cullFace(1029) : e === W ? c.cullFace(1028) : c.cullFace(1032))) : L(2884),
  11411. w = e
  11412. }
  11413. function U(e, t, n) {
  11414. e ? (B(32823),
  11415. x === t && E === n || (c.polygonOffset(t, n),
  11416. x = t,
  11417. E = n)) : L(32823)
  11418. }
  11419. function G(e) {
  11420. T !== (e = void 0 === e ? 33984 + _ - 1 : e) && (c.activeTexture(e),
  11421. T = e)
  11422. }
  11423. return {
  11424. buffers: {
  11425. color: i,
  11426. depth: r,
  11427. stencil: a
  11428. },
  11429. enable: B,
  11430. disable: L,
  11431. useProgram: function(e) {
  11432. return s !== e && (c.useProgram(e),
  11433. s = e,
  11434. !0)
  11435. },
  11436. setBlending: O,
  11437. setMaterial: function(e, t) {
  11438. (e.side === Y ? L : B)(2884);
  11439. var n = e.side === J;
  11440. z(n = t ? !n : n),
  11441. e.blending === K && !1 === e.transparent ? O(Z) : O(e.blending, e.blendEquation, e.blendSrc, e.blendDst, e.blendEquationAlpha, e.blendSrcAlpha, e.blendDstAlpha, e.premultipliedAlpha),
  11442. r.setFunc(e.depthFunc),
  11443. r.setTest(e.depthTest),
  11444. r.setMask(e.depthWrite),
  11445. i.setMask(e.colorWrite),
  11446. n = e.stencilWrite,
  11447. a.setTest(n),
  11448. n && (a.setMask(e.stencilWriteMask),
  11449. a.setFunc(e.stencilFunc, e.stencilRef, e.stencilFuncMask),
  11450. a.setOp(e.stencilFail, e.stencilZFail, e.stencilZPass)),
  11451. U(e.polygonOffset, e.polygonOffsetFactor, e.polygonOffsetUnits)
  11452. },
  11453. setFlipSided: z,
  11454. setCullFace: N,
  11455. setlineWidth: function(e) {
  11456. e !== b && (M && c.lineWidth(e),
  11457. b = e)
  11458. },
  11459. setPolygonOffset: U,
  11460. setScissorTest: function(e) {
  11461. (e ? B : L)(3089)
  11462. },
  11463. activeTexture: G,
  11464. bindTexture: function(e, t) {
  11465. null === T && G();
  11466. var n = S[T];
  11467. void 0 === n && (S[T] = n = {
  11468. type: void 0,
  11469. texture: void 0
  11470. }),
  11471. n.type === e && n.texture === t || (c.bindTexture(e, t || k[e]),
  11472. n.type = e,
  11473. n.texture = t)
  11474. },
  11475. unbindTexture: function() {
  11476. var e = S[T];
  11477. void 0 !== e && void 0 !== e.type && (c.bindTexture(e.type, null),
  11478. e.type = void 0,
  11479. e.texture = void 0)
  11480. },
  11481. compressedTexImage2D: function() {
  11482. try {
  11483. c.compressedTexImage2D.apply(c, arguments)
  11484. } catch (e) {
  11485. console.error("THREE.WebGLState:", e)
  11486. }
  11487. },
  11488. texImage2D: function() {
  11489. try {
  11490. c.texImage2D.apply(c, arguments)
  11491. } catch (e) {
  11492. console.error("THREE.WebGLState:", e)
  11493. }
  11494. },
  11495. texImage3D: function() {
  11496. try {
  11497. c.texImage3D.apply(c, arguments)
  11498. } catch (e) {
  11499. console.error("THREE.WebGLState:", e)
  11500. }
  11501. },
  11502. scissor: function(e) {
  11503. !1 === C.equals(e) && (c.scissor(e.x, e.y, e.z, e.w),
  11504. C.copy(e))
  11505. },
  11506. viewport: function(e) {
  11507. !1 === P.equals(e) && (c.viewport(e.x, e.y, e.z, e.w),
  11508. P.copy(e))
  11509. },
  11510. reset: function() {
  11511. o = {},
  11512. g = !(S = {}),
  11513. E = x = b = w = y = v = m = f = p = h = d = u = l = s = T = null,
  11514. i.reset(),
  11515. r.reset(),
  11516. a.reset()
  11517. }
  11518. }
  11519. }
  11520. function os(b, i, x, u, r, E, c) {
  11521. var e, a, _ = r.isWebGL2, t = r.maxTextures, M = r.maxCubemapSize, v = r.maxTextureSize, n = r.maxSamples, o = new WeakMap, s = !1;
  11522. try {
  11523. s = "undefined" != typeof OffscreenCanvas && null !== new OffscreenCanvas(1,1).getContext("2d")
  11524. } catch (e) {}
  11525. function l(e, t) {
  11526. return s ? new OffscreenCanvas(e,t) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")
  11527. }
  11528. function A(e, t, n, i) {
  11529. var r = 1;
  11530. if ((r = e.width > i || e.height > i ? i / Math.max(e.width, e.height) : r) < 1 || !0 === t) {
  11531. if ("undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap) {
  11532. i = t ? gn.floorPowerOfTwo : Math.floor,
  11533. t = i(r * e.width),
  11534. r = i(r * e.height);
  11535. void 0 === a && (a = l(t, r));
  11536. n = n ? l(t, r) : a;
  11537. return n.width = t,
  11538. n.height = r,
  11539. n.getContext("2d").drawImage(e, 0, 0, t, r),
  11540. console.warn("THREE.WebGLRenderer: Texture has been resized from (" + e.width + "x" + e.height + ") to (" + t + "x" + r + ")."),
  11541. n
  11542. }
  11543. return "data"in e && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + e.width + "x" + e.height + ")."),
  11544. e
  11545. }
  11546. return e
  11547. }
  11548. function T(e) {
  11549. return gn.isPowerOfTwo(e.width) && gn.isPowerOfTwo(e.height)
  11550. }
  11551. function S(e, t) {
  11552. return e.generateMipmaps && t && e.minFilter !== Re && e.minFilter !== Oe
  11553. }
  11554. function C(e, t, n, i) {
  11555. b.generateMipmap(e),
  11556. u.get(t).__maxMipLevel = Math.log(Math.max(n, i)) * Math.LOG2E
  11557. }
  11558. function P(e, t, n) {
  11559. if (!1 === _)
  11560. return t;
  11561. if (null !== e) {
  11562. if (void 0 !== b[e])
  11563. return b[e];
  11564. console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + e + "'")
  11565. }
  11566. e = t;
  11567. return 6403 === t && (5126 === n && (e = 33326),
  11568. 5131 === n && (e = 33325),
  11569. 5121 === n && (e = 33321)),
  11570. 6407 === t && (5126 === n && (e = 34837),
  11571. 5131 === n && (e = 34843),
  11572. 5121 === n && (e = 32849)),
  11573. 6408 === t && (5126 === n && (e = 34836),
  11574. 5131 === n && (e = 34842),
  11575. 5121 === n && (e = 32856)),
  11576. 33325 !== e && 33326 !== e && 34842 !== e && 34836 !== e || i.get("EXT_color_buffer_float"),
  11577. e
  11578. }
  11579. function d(e) {
  11580. return e === Re || e === Fe || e === Ie ? 9728 : 9729
  11581. }
  11582. function h(e) {
  11583. var t, n = e.target;
  11584. n.removeEventListener("dispose", h),
  11585. t = n,
  11586. void 0 !== (e = u.get(t)).__webglInit && (b.deleteTexture(e.__webglTexture),
  11587. u.remove(t)),
  11588. n.isVideoTexture && o.delete(n),
  11589. c.memory.textures--
  11590. }
  11591. function p(e) {
  11592. e = e.target;
  11593. e.removeEventListener("dispose", p),
  11594. function(e) {
  11595. var t = u.get(e)
  11596. , n = u.get(e.texture);
  11597. if (e) {
  11598. if (void 0 !== n.__webglTexture && b.deleteTexture(n.__webglTexture),
  11599. e.depthTexture && e.depthTexture.dispose(),
  11600. e.isWebGLCubeRenderTarget)
  11601. for (var i = 0; i < 6; i++)
  11602. b.deleteFramebuffer(t.__webglFramebuffer[i]),
  11603. t.__webglDepthbuffer && b.deleteRenderbuffer(t.__webglDepthbuffer[i]);
  11604. else
  11605. b.deleteFramebuffer(t.__webglFramebuffer),
  11606. t.__webglDepthbuffer && b.deleteRenderbuffer(t.__webglDepthbuffer),
  11607. t.__webglMultisampledFramebuffer && b.deleteFramebuffer(t.__webglMultisampledFramebuffer),
  11608. t.__webglColorRenderbuffer && b.deleteRenderbuffer(t.__webglColorRenderbuffer),
  11609. t.__webglDepthRenderbuffer && b.deleteRenderbuffer(t.__webglDepthRenderbuffer);
  11610. u.remove(e.texture),
  11611. u.remove(e)
  11612. }
  11613. }(e),
  11614. c.memory.textures--
  11615. }
  11616. var f = 0;
  11617. function m(e, t) {
  11618. var n, i = u.get(e);
  11619. if (e.isVideoTexture && (r = e,
  11620. n = c.render.frame,
  11621. o.get(r) !== n && (o.set(r, n),
  11622. r.update())),
  11623. 0 < e.version && i.__version !== e.version) {
  11624. var r = e.image;
  11625. if (void 0 === r)
  11626. console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
  11627. else {
  11628. if (!1 !== r.complete)
  11629. return void B(i, e, t);
  11630. console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")
  11631. }
  11632. }
  11633. x.activeTexture(33984 + t),
  11634. x.bindTexture(3553, i.__webglTexture)
  11635. }
  11636. function g(e, t) {
  11637. var n = u.get(e);
  11638. 0 < e.version && n.__version !== e.version ? function(e, t, n) {
  11639. if (6 === t.image.length) {
  11640. k(e, t),
  11641. x.activeTexture(33984 + n),
  11642. x.bindTexture(34067, e.__webglTexture),
  11643. b.pixelStorei(37440, t.flipY);
  11644. for (var i = t && (t.isCompressedTexture || t.image[0].isCompressedTexture), r = t.image[0] && t.image[0].isDataTexture, a = [], o = 0; o < 6; o++)
  11645. a[o] = i || r ? r ? t.image[o].image : t.image[o] : A(t.image[o], !1, !0, M);
  11646. var s, l = a[0], n = T(l) || _, u = E.convert(t.format), c = E.convert(t.type), d = P(t.internalFormat, u, c);
  11647. if (D(34067, t, n),
  11648. i) {
  11649. for (var h = 0; h < 6; h++) {
  11650. s = a[h].mipmaps;
  11651. for (var p = 0; p < s.length; p++) {
  11652. var f = s[p];
  11653. t.format !== et && t.format !== $e ? null !== u ? x.compressedTexImage2D(34069 + h, p, d, f.width, f.height, 0, f.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : x.texImage2D(34069 + h, p, d, f.width, f.height, 0, u, c, f.data)
  11654. }
  11655. }
  11656. e.__maxMipLevel = s.length - 1
  11657. } else {
  11658. s = t.mipmaps;
  11659. for (var m = 0; m < 6; m++)
  11660. if (r) {
  11661. x.texImage2D(34069 + m, 0, d, a[m].width, a[m].height, 0, u, c, a[m].data);
  11662. for (var v = 0; v < s.length; v++) {
  11663. var g = s[v].image[m].image;
  11664. x.texImage2D(34069 + m, v + 1, d, g.width, g.height, 0, u, c, g.data)
  11665. }
  11666. } else {
  11667. x.texImage2D(34069 + m, 0, d, u, c, a[m]);
  11668. for (var y = 0; y < s.length; y++) {
  11669. var w = s[y];
  11670. x.texImage2D(34069 + m, y + 1, d, u, c, w.image[m])
  11671. }
  11672. }
  11673. e.__maxMipLevel = s.length
  11674. }
  11675. S(t, n) && C(34067, t, l.width, l.height),
  11676. e.__version = t.version,
  11677. t.onUpdate && t.onUpdate(t)
  11678. }
  11679. }(n, e, t) : (x.activeTexture(33984 + t),
  11680. x.bindTexture(34067, n.__webglTexture))
  11681. }
  11682. var y = (H(e = {}, ke, 10497),
  11683. H(e, Be, 33071),
  11684. H(e, Le, 33648),
  11685. e)
  11686. , w = (H(e = {}, Re, 9728),
  11687. H(e, Fe, 9984),
  11688. H(e, Ie, 9986),
  11689. H(e, Oe, 9729),
  11690. H(e, ze, 9985),
  11691. H(e, Ne, 9987),
  11692. e);
  11693. function D(e, t, n) {
  11694. n ? (b.texParameteri(e, 10242, y[t.wrapS]),
  11695. b.texParameteri(e, 10243, y[t.wrapT]),
  11696. 32879 !== e && 35866 !== e || b.texParameteri(e, 32882, y[t.wrapR]),
  11697. b.texParameteri(e, 10240, w[t.magFilter]),
  11698. b.texParameteri(e, 10241, w[t.minFilter])) : (b.texParameteri(e, 10242, 33071),
  11699. b.texParameteri(e, 10243, 33071),
  11700. 32879 !== e && 35866 !== e || b.texParameteri(e, 32882, 33071),
  11701. t.wrapS === Be && t.wrapT === Be || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),
  11702. b.texParameteri(e, 10240, d(t.magFilter)),
  11703. b.texParameteri(e, 10241, d(t.minFilter)),
  11704. t.minFilter !== Re && t.minFilter !== Oe && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));
  11705. n = i.get("EXT_texture_filter_anisotropic");
  11706. n && (t.type === Xe && null === i.get("OES_texture_float_linear") || t.type === qe && null === (_ || i.get("OES_texture_half_float_linear")) || (1 < t.anisotropy || u.get(t).__currentAnisotropy) && (b.texParameterf(e, n.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(t.anisotropy, r.getMaxAnisotropy())),
  11707. u.get(t).__currentAnisotropy = t.anisotropy))
  11708. }
  11709. function k(e, t) {
  11710. void 0 === e.__webglInit && (e.__webglInit = !0,
  11711. t.addEventListener("dispose", h),
  11712. e.__webglTexture = b.createTexture(),
  11713. c.memory.textures++)
  11714. }
  11715. function B(e, t, n) {
  11716. var i = 3553;
  11717. t.isDataTexture2DArray && (i = 35866),
  11718. t.isDataTexture3D && (i = 32879),
  11719. k(e, t),
  11720. x.activeTexture(33984 + n),
  11721. x.bindTexture(i, e.__webglTexture),
  11722. b.pixelStorei(37440, t.flipY),
  11723. b.pixelStorei(37441, t.premultiplyAlpha),
  11724. b.pixelStorei(3317, t.unpackAlignment);
  11725. var r, n = (a = t,
  11726. !_ && (a.wrapS !== Be || a.wrapT !== Be || a.minFilter !== Re && a.minFilter !== Oe) && !1 === T(t.image)), a = A(t.image, n, !1, v), n = T(a) || _, o = E.convert(t.format), s = E.convert(t.type), l = P(t.internalFormat, o, s);
  11727. D(i, t, n);
  11728. var u = t.mipmaps;
  11729. if (t.isDepthTexture)
  11730. l = 6402,
  11731. _ ? l = t.type === Xe ? 36012 : t.type === We ? 33190 : t.type === Qe ? 35056 : 33189 : t.type === Xe && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),
  11732. t.format === rt && 6402 === l && t.type !== Ve && t.type !== We && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),
  11733. t.type = Ve,
  11734. s = E.convert(t.type)),
  11735. t.format === at && 6402 === l && (l = 34041,
  11736. t.type !== Qe && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),
  11737. t.type = Qe,
  11738. s = E.convert(t.type))),
  11739. x.texImage2D(3553, 0, l, a.width, a.height, 0, o, s, null);
  11740. else if (t.isDataTexture)
  11741. if (0 < u.length && n) {
  11742. for (var c = 0, d = u.length; c < d; c++)
  11743. r = u[c],
  11744. x.texImage2D(3553, c, l, r.width, r.height, 0, o, s, r.data);
  11745. t.generateMipmaps = !1,
  11746. e.__maxMipLevel = u.length - 1
  11747. } else
  11748. x.texImage2D(3553, 0, l, a.width, a.height, 0, o, s, a.data),
  11749. e.__maxMipLevel = 0;
  11750. else if (t.isCompressedTexture) {
  11751. for (var h = 0, p = u.length; h < p; h++)
  11752. r = u[h],
  11753. t.format !== et && t.format !== $e ? null !== o ? x.compressedTexImage2D(3553, h, l, r.width, r.height, 0, r.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : x.texImage2D(3553, h, l, r.width, r.height, 0, o, s, r.data);
  11754. e.__maxMipLevel = u.length - 1
  11755. } else if (t.isDataTexture2DArray)
  11756. x.texImage3D(35866, 0, l, a.width, a.height, a.depth, 0, o, s, a.data),
  11757. e.__maxMipLevel = 0;
  11758. else if (t.isDataTexture3D)
  11759. x.texImage3D(32879, 0, l, a.width, a.height, a.depth, 0, o, s, a.data),
  11760. e.__maxMipLevel = 0;
  11761. else if (0 < u.length && n) {
  11762. for (var f = 0, m = u.length; f < m; f++)
  11763. r = u[f],
  11764. x.texImage2D(3553, f, l, o, s, r);
  11765. t.generateMipmaps = !1,
  11766. e.__maxMipLevel = u.length - 1
  11767. } else
  11768. x.texImage2D(3553, 0, l, o, s, a),
  11769. e.__maxMipLevel = 0;
  11770. S(t, n) && C(i, t, a.width, a.height),
  11771. e.__version = t.version,
  11772. t.onUpdate && t.onUpdate(t)
  11773. }
  11774. function L(e, t, n, i) {
  11775. var r = E.convert(t.texture.format)
  11776. , a = E.convert(t.texture.type)
  11777. , o = P(t.texture.internalFormat, r, a);
  11778. x.texImage2D(i, 0, o, t.width, t.height, 0, r, a, null),
  11779. b.bindFramebuffer(36160, e),
  11780. b.framebufferTexture2D(36160, n, i, u.get(t.texture).__webglTexture, 0),
  11781. b.bindFramebuffer(36160, null)
  11782. }
  11783. function R(e, t, n) {
  11784. var i, r, a;
  11785. b.bindRenderbuffer(36161, e),
  11786. t.depthBuffer && !t.stencilBuffer ? (i = 33189,
  11787. n ? ((r = t.depthTexture) && r.isDepthTexture && (r.type === Xe ? i = 36012 : r.type === We && (i = 33190)),
  11788. r = I(t),
  11789. b.renderbufferStorageMultisample(36161, r, i, t.width, t.height)) : b.renderbufferStorage(36161, i, t.width, t.height),
  11790. b.framebufferRenderbuffer(36160, 36096, 36161, e)) : t.depthBuffer && t.stencilBuffer ? (n ? (a = I(t),
  11791. b.renderbufferStorageMultisample(36161, a, 35056, t.width, t.height)) : b.renderbufferStorage(36161, 34041, t.width, t.height),
  11792. b.framebufferRenderbuffer(36160, 33306, 36161, e)) : (a = E.convert(t.texture.format),
  11793. e = E.convert(t.texture.type),
  11794. e = P(t.texture.internalFormat, a, e),
  11795. n ? (n = I(t),
  11796. b.renderbufferStorageMultisample(36161, n, e, t.width, t.height)) : b.renderbufferStorage(36161, e, t.width, t.height)),
  11797. b.bindRenderbuffer(36161, null)
  11798. }
  11799. function F(e) {
  11800. var t = u.get(e)
  11801. , n = !0 === e.isWebGLCubeRenderTarget;
  11802. if (e.depthTexture) {
  11803. if (n)
  11804. throw new Error("target.depthTexture not supported in Cube render targets");
  11805. !function(e, t) {
  11806. if (t && t.isWebGLCubeRenderTarget)
  11807. throw new Error("Depth Texture with cube render targets is not supported");
  11808. if (b.bindFramebuffer(36160, e),
  11809. !t.depthTexture || !t.depthTexture.isDepthTexture)
  11810. throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
  11811. if (u.get(t.depthTexture).__webglTexture && t.depthTexture.image.width === t.width && t.depthTexture.image.height === t.height || (t.depthTexture.image.width = t.width,
  11812. t.depthTexture.image.height = t.height,
  11813. t.depthTexture.needsUpdate = !0),
  11814. m(t.depthTexture, 0),
  11815. e = u.get(t.depthTexture).__webglTexture,
  11816. t.depthTexture.format === rt)
  11817. b.framebufferTexture2D(36160, 36096, 3553, e, 0);
  11818. else {
  11819. if (t.depthTexture.format !== at)
  11820. throw new Error("Unknown depthTexture format");
  11821. b.framebufferTexture2D(36160, 33306, 3553, e, 0)
  11822. }
  11823. }(t.__webglFramebuffer, e)
  11824. } else if (n) {
  11825. t.__webglDepthbuffer = [];
  11826. for (var i = 0; i < 6; i++)
  11827. b.bindFramebuffer(36160, t.__webglFramebuffer[i]),
  11828. t.__webglDepthbuffer[i] = b.createRenderbuffer(),
  11829. R(t.__webglDepthbuffer[i], e, !1)
  11830. } else
  11831. b.bindFramebuffer(36160, t.__webglFramebuffer),
  11832. t.__webglDepthbuffer = b.createRenderbuffer(),
  11833. R(t.__webglDepthbuffer, e, !1);
  11834. b.bindFramebuffer(36160, null)
  11835. }
  11836. function I(e) {
  11837. return _ && e.isWebGLMultisampleRenderTarget ? Math.min(n, e.samples) : 0
  11838. }
  11839. var O = !1
  11840. , z = !1;
  11841. this.allocateTextureUnit = function() {
  11842. var e = f;
  11843. return t <= e && console.warn("THREE.WebGLTextures: Trying to use " + e + " texture units while this GPU supports only " + t),
  11844. f += 1,
  11845. e
  11846. }
  11847. ,
  11848. this.resetTextureUnits = function() {
  11849. f = 0
  11850. }
  11851. ,
  11852. this.setTexture2D = m,
  11853. this.setTexture2DArray = function(e, t) {
  11854. var n = u.get(e);
  11855. 0 < e.version && n.__version !== e.version ? B(n, e, t) : (x.activeTexture(33984 + t),
  11856. x.bindTexture(35866, n.__webglTexture))
  11857. }
  11858. ,
  11859. this.setTexture3D = function(e, t) {
  11860. var n = u.get(e);
  11861. 0 < e.version && n.__version !== e.version ? B(n, e, t) : (x.activeTexture(33984 + t),
  11862. x.bindTexture(32879, n.__webglTexture))
  11863. }
  11864. ,
  11865. this.setTextureCube = g,
  11866. this.setupRenderTarget = function(e) {
  11867. var t = u.get(e)
  11868. , n = u.get(e.texture);
  11869. e.addEventListener("dispose", p),
  11870. n.__webglTexture = b.createTexture(),
  11871. c.memory.textures++;
  11872. var i, r = !0 === e.isWebGLCubeRenderTarget, a = !0 === e.isWebGLMultisampleRenderTarget, o = T(e) || _;
  11873. if (!_ || e.texture.format !== $e || e.texture.type !== Xe && e.texture.type !== qe || (e.texture.format = et,
  11874. console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),
  11875. r) {
  11876. t.__webglFramebuffer = [];
  11877. for (var s = 0; s < 6; s++)
  11878. t.__webglFramebuffer[s] = b.createFramebuffer()
  11879. } else
  11880. t.__webglFramebuffer = b.createFramebuffer(),
  11881. a && (_ ? (t.__webglMultisampledFramebuffer = b.createFramebuffer(),
  11882. t.__webglColorRenderbuffer = b.createRenderbuffer(),
  11883. b.bindRenderbuffer(36161, t.__webglColorRenderbuffer),
  11884. i = E.convert(e.texture.format),
  11885. a = E.convert(e.texture.type),
  11886. i = P(e.texture.internalFormat, i, a),
  11887. a = I(e),
  11888. b.renderbufferStorageMultisample(36161, a, i, e.width, e.height),
  11889. b.bindFramebuffer(36160, t.__webglMultisampledFramebuffer),
  11890. b.framebufferRenderbuffer(36160, 36064, 36161, t.__webglColorRenderbuffer),
  11891. b.bindRenderbuffer(36161, null),
  11892. e.depthBuffer && (t.__webglDepthRenderbuffer = b.createRenderbuffer(),
  11893. R(t.__webglDepthRenderbuffer, e, !0)),
  11894. b.bindFramebuffer(36160, null)) : console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."));
  11895. if (r) {
  11896. x.bindTexture(34067, n.__webglTexture),
  11897. D(34067, e.texture, o);
  11898. for (var l = 0; l < 6; l++)
  11899. L(t.__webglFramebuffer[l], e, 36064, 34069 + l);
  11900. S(e.texture, o) && C(34067, e.texture, e.width, e.height),
  11901. x.bindTexture(34067, null)
  11902. } else
  11903. x.bindTexture(3553, n.__webglTexture),
  11904. D(3553, e.texture, o),
  11905. L(t.__webglFramebuffer, e, 36064, 3553),
  11906. S(e.texture, o) && C(3553, e.texture, e.width, e.height),
  11907. x.bindTexture(3553, null);
  11908. e.depthBuffer && F(e)
  11909. }
  11910. ,
  11911. this.updateRenderTargetMipmap = function(e) {
  11912. var t, n, i = e.texture;
  11913. S(i, T(e) || _) && (t = e.isWebGLCubeRenderTarget ? 34067 : 3553,
  11914. n = u.get(i).__webglTexture,
  11915. x.bindTexture(t, n),
  11916. C(t, i, e.width, e.height),
  11917. x.bindTexture(t, null))
  11918. }
  11919. ,
  11920. this.updateMultisampleRenderTarget = function(e) {
  11921. var t, n, i, r;
  11922. e.isWebGLMultisampleRenderTarget && (_ ? (t = u.get(e),
  11923. b.bindFramebuffer(36008, t.__webglMultisampledFramebuffer),
  11924. b.bindFramebuffer(36009, t.__webglFramebuffer),
  11925. n = e.width,
  11926. i = e.height,
  11927. r = 16384,
  11928. e.depthBuffer && (r |= 256),
  11929. e.stencilBuffer && (r |= 1024),
  11930. b.blitFramebuffer(0, 0, n, i, 0, 0, n, i, r, 9728),
  11931. b.bindFramebuffer(36160, t.__webglMultisampledFramebuffer)) : console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."))
  11932. }
  11933. ,
  11934. this.safeSetTexture2D = function(e, t) {
  11935. e && e.isWebGLRenderTarget && (!1 === O && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),
  11936. O = !0),
  11937. e = e.texture),
  11938. m(e, t)
  11939. }
  11940. ,
  11941. this.safeSetTextureCube = function(e, t) {
  11942. e && e.isWebGLCubeRenderTarget && (!1 === z && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),
  11943. z = !0),
  11944. e = e.texture),
  11945. g(e, t)
  11946. }
  11947. }
  11948. function ss(e, n, t) {
  11949. var i = t.isWebGL2;
  11950. return {
  11951. convert: function(e) {
  11952. var t;
  11953. if (e === Ue)
  11954. return 5121;
  11955. if (e === Je)
  11956. return 32819;
  11957. if (e === Ye)
  11958. return 32820;
  11959. if (e === Ze)
  11960. return 33635;
  11961. if (e === Ge)
  11962. return 5120;
  11963. if (e === He)
  11964. return 5122;
  11965. if (e === Ve)
  11966. return 5123;
  11967. if (e === je)
  11968. return 5124;
  11969. if (e === We)
  11970. return 5125;
  11971. if (e === Xe)
  11972. return 5126;
  11973. if (e === qe)
  11974. return i ? 5131 : null !== (t = n.get("OES_texture_half_float")) ? t.HALF_FLOAT_OES : null;
  11975. if (e === Ke)
  11976. return 6406;
  11977. if (e === $e)
  11978. return 6407;
  11979. if (e === et)
  11980. return 6408;
  11981. if (e === tt)
  11982. return 6409;
  11983. if (e === nt)
  11984. return 6410;
  11985. if (e === rt)
  11986. return 6402;
  11987. if (e === at)
  11988. return 34041;
  11989. if (e === ot)
  11990. return 6403;
  11991. if (e === st)
  11992. return 36244;
  11993. if (e === lt)
  11994. return 33319;
  11995. if (e === ut)
  11996. return 33320;
  11997. if (e === ct)
  11998. return 36248;
  11999. if (e === dt)
  12000. return 36249;
  12001. if (e === ht || e === pt || e === ft || e === mt) {
  12002. if (null === (t = n.get("WEBGL_compressed_texture_s3tc")))
  12003. return null;
  12004. if (e === ht)
  12005. return t.COMPRESSED_RGB_S3TC_DXT1_EXT;
  12006. if (e === pt)
  12007. return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;
  12008. if (e === ft)
  12009. return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;
  12010. if (e === mt)
  12011. return t.COMPRESSED_RGBA_S3TC_DXT5_EXT
  12012. }
  12013. if (e === vt || e === gt || e === yt || e === wt) {
  12014. if (null === (t = n.get("WEBGL_compressed_texture_pvrtc")))
  12015. return null;
  12016. if (e === vt)
  12017. return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
  12018. if (e === gt)
  12019. return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
  12020. if (e === yt)
  12021. return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
  12022. if (e === wt)
  12023. return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
  12024. }
  12025. if (e === bt)
  12026. return null !== (t = n.get("WEBGL_compressed_texture_etc1")) ? t.COMPRESSED_RGB_ETC1_WEBGL : null;
  12027. if ((e === xt || e === Et) && null !== (t = n.get("WEBGL_compressed_texture_etc"))) {
  12028. if (e === xt)
  12029. return t.COMPRESSED_RGB8_ETC2;
  12030. if (e === Et)
  12031. return t.COMPRESSED_RGBA8_ETC2_EAC
  12032. }
  12033. return e === _t || e === Mt || e === At || e === Tt || e === St || e === Ct || e === Pt || e === Dt || e === kt || e === Bt || e === Lt || e === Rt || e === Ft || e === It || e === zt || e === Nt || e === Ut || e === Gt || e === Ht || e === Vt || e === jt || e === Wt || e === Xt || e === qt || e === Jt || e === Yt || e === Zt || e === Qt ? null !== (t = n.get("WEBGL_compressed_texture_astc")) ? e : null : e === Ot ? null !== (t = n.get("EXT_texture_compression_bptc")) ? e : null : e === Qe ? i ? 34042 : null !== (t = n.get("WEBGL_depth_texture")) ? t.UNSIGNED_INT_24_8_WEBGL : null : void 0
  12034. }
  12035. }
  12036. }
  12037. function ls() {
  12038. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [];
  12039. $r.call(this),
  12040. this.cameras = e
  12041. }
  12042. function us() {
  12043. Si.call(this),
  12044. this.type = "Group"
  12045. }
  12046. function cs() {
  12047. this._targetRay = null,
  12048. this._grip = null,
  12049. this._hand = null
  12050. }
  12051. function ds(p, t) {
  12052. var n = this
  12053. , f = null
  12054. , i = 1
  12055. , m = null
  12056. , r = "local-floor"
  12057. , v = null
  12058. , g = []
  12059. , u = new Map
  12060. , s = new $r;
  12061. s.layers.enable(1),
  12062. s.viewport = new Mn;
  12063. var l = new $r;
  12064. l.layers.enable(2),
  12065. l.viewport = new Mn;
  12066. var y = [s, l]
  12067. , w = new ls;
  12068. w.layers.enable(1),
  12069. w.layers.enable(2);
  12070. var c = null
  12071. , d = null;
  12072. function a(e) {
  12073. var t = u.get(e.inputSource);
  12074. t && t.dispatchEvent({
  12075. type: e.type,
  12076. data: e.inputSource
  12077. })
  12078. }
  12079. function o() {
  12080. u.forEach(function(e, t) {
  12081. e.disconnect(t)
  12082. }),
  12083. u.clear(),
  12084. p.setFramebuffer(null),
  12085. p.setRenderTarget(p.getRenderTarget()),
  12086. A.stop(),
  12087. n.isPresenting = !1,
  12088. n.dispatchEvent({
  12089. type: "sessionend"
  12090. })
  12091. }
  12092. function h(e) {
  12093. m = e,
  12094. A.setContext(f),
  12095. A.start(),
  12096. n.isPresenting = !0,
  12097. n.dispatchEvent({
  12098. type: "sessionstart"
  12099. })
  12100. }
  12101. function b(e) {
  12102. for (var t = f.inputSources, n = 0; n < g.length; n++)
  12103. u.set(t[n], g[n]);
  12104. for (var i = 0; i < e.removed.length; i++) {
  12105. var r = e.removed[i]
  12106. , a = u.get(r);
  12107. a && (a.dispatchEvent({
  12108. type: "disconnected",
  12109. data: r
  12110. }),
  12111. u.delete(r))
  12112. }
  12113. for (var o = 0; o < e.added.length; o++) {
  12114. var s = e.added[o]
  12115. , l = u.get(s);
  12116. l && l.dispatchEvent({
  12117. type: "connected",
  12118. data: s
  12119. })
  12120. }
  12121. }
  12122. this.enabled = !1,
  12123. this.isPresenting = !1,
  12124. this.getController = function(e) {
  12125. var t = g[e];
  12126. return void 0 === t && (t = new cs,
  12127. g[e] = t),
  12128. t.getTargetRaySpace()
  12129. }
  12130. ,
  12131. this.getControllerGrip = function(e) {
  12132. var t = g[e];
  12133. return void 0 === t && (t = new cs,
  12134. g[e] = t),
  12135. t.getGripSpace()
  12136. }
  12137. ,
  12138. this.getHand = function(e) {
  12139. var t = g[e];
  12140. return void 0 === t && (t = new cs,
  12141. g[e] = t),
  12142. t.getHandSpace()
  12143. }
  12144. ,
  12145. this.setFramebufferScaleFactor = function(e) {
  12146. i = e,
  12147. !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")
  12148. }
  12149. ,
  12150. this.setReferenceSpaceType = function(e) {
  12151. r = e,
  12152. !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")
  12153. }
  12154. ,
  12155. this.getReferenceSpace = function() {
  12156. return m
  12157. }
  12158. ,
  12159. this.getSession = function() {
  12160. return f
  12161. }
  12162. ,
  12163. this.setSession = function(e) {
  12164. null !== (f = e) && (f.addEventListener("select", a),
  12165. f.addEventListener("selectstart", a),
  12166. f.addEventListener("selectend", a),
  12167. f.addEventListener("squeeze", a),
  12168. f.addEventListener("squeezestart", a),
  12169. f.addEventListener("squeezeend", a),
  12170. f.addEventListener("end", o),
  12171. !0 !== (e = t.getContextAttributes()).xrCompatible && t.makeXRCompatible(),
  12172. e = {
  12173. antialias: e.antialias,
  12174. alpha: e.alpha,
  12175. depth: e.depth,
  12176. stencil: e.stencil,
  12177. framebufferScaleFactor: i
  12178. },
  12179. e = new XRWebGLLayer(f,t,e),
  12180. f.updateRenderState({
  12181. baseLayer: e
  12182. }),
  12183. f.requestReferenceSpace(r).then(h),
  12184. f.addEventListener("inputsourceschange", b))
  12185. }
  12186. ;
  12187. var x = new Cn
  12188. , E = new Cn;
  12189. function _(e, t) {
  12190. null === t ? e.matrixWorld.copy(e.matrix) : e.matrixWorld.multiplyMatrices(t.matrixWorld, e.matrix),
  12191. e.matrixWorldInverse.copy(e.matrixWorld).invert()
  12192. }
  12193. this.getCamera = function(e) {
  12194. w.near = l.near = s.near = e.near,
  12195. w.far = l.far = s.far = e.far,
  12196. c === w.near && d === w.far || (f.updateRenderState({
  12197. depthNear: w.near,
  12198. depthFar: w.far
  12199. }),
  12200. c = w.near,
  12201. d = w.far);
  12202. var t = e.parent
  12203. , n = w.cameras;
  12204. _(w, t);
  12205. for (var i = 0; i < n.length; i++)
  12206. _(n[i], t);
  12207. e.matrixWorld.copy(w.matrixWorld);
  12208. for (var r = e.children, a = 0, o = r.length; a < o; a++)
  12209. r[a].updateMatrixWorld(!0);
  12210. return 2 === n.length ? function(e, t, n) {
  12211. x.setFromMatrixPosition(t.matrixWorld),
  12212. E.setFromMatrixPosition(n.matrixWorld);
  12213. var i = x.distanceTo(E)
  12214. , r = t.projectionMatrix.elements
  12215. , a = n.projectionMatrix.elements
  12216. , o = r[14] / (r[10] - 1)
  12217. , s = r[14] / (r[10] + 1)
  12218. , l = (r[9] + 1) / r[5]
  12219. , u = (r[9] - 1) / r[5]
  12220. , c = (r[8] - 1) / r[0]
  12221. , n = (a[8] + 1) / a[0]
  12222. , r = o * c
  12223. , a = o * n
  12224. , c = (n = i / (n - c)) * -c;
  12225. t.matrixWorld.decompose(e.position, e.quaternion, e.scale),
  12226. e.translateX(c),
  12227. e.translateZ(n),
  12228. e.matrixWorld.compose(e.position, e.quaternion, e.scale),
  12229. e.matrixWorldInverse.copy(e.matrixWorld).invert(),
  12230. o += n,
  12231. n = s + n,
  12232. e.projectionMatrix.makePerspective(r - c, i - c + a, l * s / n * o, u * s / n * o, o, n)
  12233. }(w, s, l) : w.projectionMatrix.copy(s.projectionMatrix),
  12234. w
  12235. }
  12236. ;
  12237. var M = null;
  12238. var A = new sa;
  12239. A.setAnimationLoop(function(e, t) {
  12240. if (null !== (v = t.getViewerPose(m))) {
  12241. var n = v.views
  12242. , i = f.renderState.baseLayer;
  12243. p.setFramebuffer(i.framebuffer);
  12244. var r = !1;
  12245. n.length !== w.cameras.length && (r = !(w.cameras.length = 0));
  12246. for (var a = 0; a < n.length; a++) {
  12247. var o = n[a]
  12248. , s = i.getViewport(o)
  12249. , l = y[a];
  12250. l.matrix.fromArray(o.transform.matrix),
  12251. l.projectionMatrix.fromArray(o.projectionMatrix),
  12252. l.viewport.set(s.x, s.y, s.width, s.height),
  12253. 0 === a && w.matrix.copy(l.matrix),
  12254. !0 === r && w.cameras.push(l)
  12255. }
  12256. }
  12257. for (var u = f.inputSources, c = 0; c < g.length; c++) {
  12258. var d = g[c]
  12259. , h = u[c];
  12260. d.update(h, t, m)
  12261. }
  12262. M && M(e, t)
  12263. }),
  12264. this.setAnimationLoop = function(e) {
  12265. M = e
  12266. }
  12267. ,
  12268. this.dispose = function() {}
  12269. }
  12270. function hs(a) {
  12271. function l(e, t) {
  12272. e.opacity.value = t.opacity,
  12273. t.color && e.diffuse.value.copy(t.color),
  12274. t.emissive && e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),
  12275. t.map && (e.map.value = t.map),
  12276. t.alphaMap && (e.alphaMap.value = t.alphaMap),
  12277. t.specularMap && (e.specularMap.value = t.specularMap);
  12278. var n, i, r = a.get(t).envMap;
  12279. r && (e.envMap.value = r,
  12280. e.flipEnvMap.value = r.isCubeTexture && r._needsFlipEnvMap ? -1 : 1,
  12281. e.reflectivity.value = t.reflectivity,
  12282. e.refractionRatio.value = t.refractionRatio,
  12283. void 0 !== (r = a.get(r).__maxMipLevel) && (e.maxMipLevel.value = r)),
  12284. t.lightMap && (e.lightMap.value = t.lightMap,
  12285. e.lightMapIntensity.value = t.lightMapIntensity),
  12286. t.aoMap && (e.aoMap.value = t.aoMap,
  12287. e.aoMapIntensity.value = t.aoMapIntensity),
  12288. t.map ? n = t.map : t.specularMap ? n = t.specularMap : t.displacementMap ? n = t.displacementMap : t.normalMap ? n = t.normalMap : t.bumpMap ? n = t.bumpMap : t.roughnessMap ? n = t.roughnessMap : t.metalnessMap ? n = t.metalnessMap : t.alphaMap ? n = t.alphaMap : t.emissiveMap ? n = t.emissiveMap : t.clearcoatMap ? n = t.clearcoatMap : t.clearcoatNormalMap ? n = t.clearcoatNormalMap : t.clearcoatRoughnessMap && (n = t.clearcoatRoughnessMap),
  12289. void 0 !== n && (!0 === (n = n.isWebGLRenderTarget ? n.texture : n).matrixAutoUpdate && n.updateMatrix(),
  12290. e.uvTransform.value.copy(n.matrix)),
  12291. t.aoMap ? i = t.aoMap : t.lightMap && (i = t.lightMap),
  12292. void 0 !== i && (!0 === (i = i.isWebGLRenderTarget ? i.texture : i).matrixAutoUpdate && i.updateMatrix(),
  12293. e.uv2Transform.value.copy(i.matrix))
  12294. }
  12295. function u(e, t) {
  12296. e.roughness.value = t.roughness,
  12297. e.metalness.value = t.metalness,
  12298. t.roughnessMap && (e.roughnessMap.value = t.roughnessMap),
  12299. t.metalnessMap && (e.metalnessMap.value = t.metalnessMap),
  12300. t.emissiveMap && (e.emissiveMap.value = t.emissiveMap),
  12301. t.bumpMap && (e.bumpMap.value = t.bumpMap,
  12302. e.bumpScale.value = t.bumpScale,
  12303. t.side === J && (e.bumpScale.value *= -1)),
  12304. t.normalMap && (e.normalMap.value = t.normalMap,
  12305. e.normalScale.value.copy(t.normalScale),
  12306. t.side === J && e.normalScale.value.negate()),
  12307. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12308. e.displacementScale.value = t.displacementScale,
  12309. e.displacementBias.value = t.displacementBias),
  12310. a.get(t).envMap && (e.envMapIntensity.value = t.envMapIntensity)
  12311. }
  12312. return {
  12313. refreshFogUniforms: function(e, t) {
  12314. e.fogColor.value.copy(t.color),
  12315. t.isFog ? (e.fogNear.value = t.near,
  12316. e.fogFar.value = t.far) : t.isFogExp2 && (e.fogDensity.value = t.density)
  12317. },
  12318. refreshMaterialUniforms: function(e, t, n, i) {
  12319. var r, a, o, s;
  12320. t.isMeshBasicMaterial ? l(e, t) : t.isMeshLambertMaterial ? (l(e, t),
  12321. o = e,
  12322. (s = t).emissiveMap && (o.emissiveMap.value = s.emissiveMap)) : t.isMeshToonMaterial ? (l(e, t),
  12323. function(e, t) {
  12324. t.gradientMap && (e.gradientMap.value = t.gradientMap);
  12325. t.emissiveMap && (e.emissiveMap.value = t.emissiveMap);
  12326. t.bumpMap && (e.bumpMap.value = t.bumpMap,
  12327. e.bumpScale.value = t.bumpScale,
  12328. t.side === J && (e.bumpScale.value *= -1));
  12329. t.normalMap && (e.normalMap.value = t.normalMap,
  12330. e.normalScale.value.copy(t.normalScale),
  12331. t.side === J && e.normalScale.value.negate());
  12332. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12333. e.displacementScale.value = t.displacementScale,
  12334. e.displacementBias.value = t.displacementBias)
  12335. }(e, t)) : t.isMeshPhongMaterial ? (l(e, t),
  12336. function(e, t) {
  12337. e.specular.value.copy(t.specular),
  12338. e.shininess.value = Math.max(t.shininess, 1e-4),
  12339. t.emissiveMap && (e.emissiveMap.value = t.emissiveMap);
  12340. t.bumpMap && (e.bumpMap.value = t.bumpMap,
  12341. e.bumpScale.value = t.bumpScale,
  12342. t.side === J && (e.bumpScale.value *= -1));
  12343. t.normalMap && (e.normalMap.value = t.normalMap,
  12344. e.normalScale.value.copy(t.normalScale),
  12345. t.side === J && e.normalScale.value.negate());
  12346. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12347. e.displacementScale.value = t.displacementScale,
  12348. e.displacementBias.value = t.displacementBias)
  12349. }(e, t)) : t.isMeshStandardMaterial ? (l(e, t),
  12350. (t.isMeshPhysicalMaterial ? function(e, t) {
  12351. u(e, t),
  12352. e.reflectivity.value = t.reflectivity,
  12353. e.clearcoat.value = t.clearcoat,
  12354. e.clearcoatRoughness.value = t.clearcoatRoughness,
  12355. t.sheen && e.sheen.value.copy(t.sheen);
  12356. t.clearcoatMap && (e.clearcoatMap.value = t.clearcoatMap);
  12357. t.clearcoatRoughnessMap && (e.clearcoatRoughnessMap.value = t.clearcoatRoughnessMap);
  12358. t.clearcoatNormalMap && (e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),
  12359. e.clearcoatNormalMap.value = t.clearcoatNormalMap,
  12360. t.side === J && e.clearcoatNormalScale.value.negate());
  12361. e.transmission.value = t.transmission,
  12362. t.transmissionMap && (e.transmissionMap.value = t.transmissionMap)
  12363. }
  12364. : u)(e, t)) : t.isMeshMatcapMaterial ? (l(e, t),
  12365. function(e, t) {
  12366. t.matcap && (e.matcap.value = t.matcap);
  12367. t.bumpMap && (e.bumpMap.value = t.bumpMap,
  12368. e.bumpScale.value = t.bumpScale,
  12369. t.side === J && (e.bumpScale.value *= -1));
  12370. t.normalMap && (e.normalMap.value = t.normalMap,
  12371. e.normalScale.value.copy(t.normalScale),
  12372. t.side === J && e.normalScale.value.negate());
  12373. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12374. e.displacementScale.value = t.displacementScale,
  12375. e.displacementBias.value = t.displacementBias)
  12376. }(e, t)) : t.isMeshDepthMaterial ? (l(e, t),
  12377. r = e,
  12378. (a = t).displacementMap && (r.displacementMap.value = a.displacementMap,
  12379. r.displacementScale.value = a.displacementScale,
  12380. r.displacementBias.value = a.displacementBias)) : t.isMeshDistanceMaterial ? (l(e, t),
  12381. function(e, t) {
  12382. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12383. e.displacementScale.value = t.displacementScale,
  12384. e.displacementBias.value = t.displacementBias);
  12385. e.referencePosition.value.copy(t.referencePosition),
  12386. e.nearDistance.value = t.nearDistance,
  12387. e.farDistance.value = t.farDistance
  12388. }(e, t)) : t.isMeshNormalMaterial ? (l(e, t),
  12389. function(e, t) {
  12390. t.bumpMap && (e.bumpMap.value = t.bumpMap,
  12391. e.bumpScale.value = t.bumpScale,
  12392. t.side === J && (e.bumpScale.value *= -1));
  12393. t.normalMap && (e.normalMap.value = t.normalMap,
  12394. e.normalScale.value.copy(t.normalScale),
  12395. t.side === J && e.normalScale.value.negate());
  12396. t.displacementMap && (e.displacementMap.value = t.displacementMap,
  12397. e.displacementScale.value = t.displacementScale,
  12398. e.displacementBias.value = t.displacementBias)
  12399. }(e, t)) : t.isLineBasicMaterial ? (r = t,
  12400. (a = e).diffuse.value.copy(r.color),
  12401. a.opacity.value = r.opacity,
  12402. t.isLineDashedMaterial && (a = t,
  12403. (r = e).dashSize.value = a.dashSize,
  12404. r.totalSize.value = a.dashSize + a.gapSize,
  12405. r.scale.value = a.scale)) : t.isPointsMaterial ? function(e, t, n, i) {
  12406. e.diffuse.value.copy(t.color),
  12407. e.opacity.value = t.opacity,
  12408. e.size.value = t.size * n,
  12409. e.scale.value = .5 * i,
  12410. t.map && (e.map.value = t.map);
  12411. t.alphaMap && (e.alphaMap.value = t.alphaMap);
  12412. var r;
  12413. t.map ? r = t.map : t.alphaMap && (r = t.alphaMap);
  12414. void 0 !== r && (!0 === r.matrixAutoUpdate && r.updateMatrix(),
  12415. e.uvTransform.value.copy(r.matrix))
  12416. }(e, t, n, i) : t.isSpriteMaterial ? function(e, t) {
  12417. e.diffuse.value.copy(t.color),
  12418. e.opacity.value = t.opacity,
  12419. e.rotation.value = t.rotation,
  12420. t.map && (e.map.value = t.map);
  12421. t.alphaMap && (e.alphaMap.value = t.alphaMap);
  12422. var n;
  12423. t.map ? n = t.map : t.alphaMap && (n = t.alphaMap);
  12424. void 0 !== n && (!0 === n.matrixAutoUpdate && n.updateMatrix(),
  12425. e.uvTransform.value.copy(n.matrix))
  12426. }(e, t) : t.isShadowMaterial ? (e.color.value.copy(t.color),
  12427. e.opacity.value = t.opacity) : t.isShaderMaterial && (t.uniformsNeedUpdate = !1)
  12428. }
  12429. }
  12430. }
  12431. function ps(e) {
  12432. var r = void 0 !== (e = e || {}).canvas ? e.canvas : ((c = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")).style.display = "block",
  12433. c)
  12434. , t = void 0 !== e.context ? e.context : null
  12435. , n = void 0 !== e.alpha && e.alpha
  12436. , i = void 0 === e.depth || e.depth
  12437. , a = void 0 === e.stencil || e.stencil
  12438. , o = void 0 !== e.antialias && e.antialias
  12439. , s = void 0 === e.premultipliedAlpha || e.premultipliedAlpha
  12440. , l = void 0 !== e.preserveDrawingBuffer && e.preserveDrawingBuffer
  12441. , u = void 0 !== e.powerPreference ? e.powerPreference : "default"
  12442. , c = void 0 !== e.failIfMajorPerformanceCaveat && e.failIfMajorPerformanceCaveat
  12443. , g = null
  12444. , y = null
  12445. , d = [];
  12446. this.domElement = r,
  12447. this.debug = {
  12448. checkShaderErrors: !0
  12449. },
  12450. this.autoClear = !0,
  12451. this.autoClearColor = !0,
  12452. this.autoClearDepth = !0,
  12453. this.autoClearStencil = !0,
  12454. this.sortObjects = !0,
  12455. this.clippingPlanes = [],
  12456. this.localClippingEnabled = !1,
  12457. this.gammaFactor = 2,
  12458. this.outputEncoding = rn,
  12459. this.physicallyCorrectLights = !1,
  12460. this.toneMapping = De,
  12461. this.toneMappingExposure = 1,
  12462. this.maxMorphTargets = 8,
  12463. this.maxMorphNormals = 4;
  12464. var p = this
  12465. , h = !1
  12466. , f = null
  12467. , m = 0
  12468. , v = 0
  12469. , w = null
  12470. , b = null
  12471. , x = -1
  12472. , E = null
  12473. , _ = new Mn
  12474. , M = new Mn
  12475. , A = null
  12476. , T = r.width
  12477. , S = r.height
  12478. , C = 1
  12479. , P = null
  12480. , D = null
  12481. , k = new Mn(0,0,T,S)
  12482. , B = new Mn(0,0,T,S)
  12483. , L = !1
  12484. , R = new oa
  12485. , F = !1
  12486. , I = !1
  12487. , O = new ni
  12488. , z = new Cn
  12489. , N = {
  12490. background: null,
  12491. fog: null,
  12492. environment: null,
  12493. overrideMaterial: null,
  12494. isScene: !0
  12495. };
  12496. function U() {
  12497. return null === w ? C : 1
  12498. }
  12499. var G, H, V, j, W, X, q, J, Y, Z, Q, K, $, ee, te, ne, ie, re, ae, oe, se, le = t;
  12500. function ue(e, t) {
  12501. for (var n = 0; n < e.length; n++) {
  12502. var i = e[n]
  12503. , i = r.getContext(i, t);
  12504. if (null !== i)
  12505. return i
  12506. }
  12507. return null
  12508. }
  12509. try {
  12510. var ce = {
  12511. alpha: n,
  12512. depth: i,
  12513. stencil: a,
  12514. antialias: o,
  12515. premultipliedAlpha: s,
  12516. preserveDrawingBuffer: l,
  12517. powerPreference: u,
  12518. failIfMajorPerformanceCaveat: c
  12519. };
  12520. if (r.addEventListener("webglcontextlost", me, !1),
  12521. r.addEventListener("webglcontextrestored", ve, !1),
  12522. null === le) {
  12523. var de = ["webgl2", "webgl", "experimental-webgl"];
  12524. if (!0 === p.isWebGL1Renderer && de.shift(),
  12525. null === (le = ue(de, ce)))
  12526. throw ue(de) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.")
  12527. }
  12528. void 0 === le.getShaderPrecisionFormat && (le.getShaderPrecisionFormat = function() {
  12529. return {
  12530. rangeMin: 1,
  12531. rangeMax: 1,
  12532. precision: 1
  12533. }
  12534. }
  12535. )
  12536. } catch (e) {
  12537. throw console.error("THREE.WebGLRenderer: " + e.message),
  12538. e
  12539. }
  12540. function he() {
  12541. G = new wa(le),
  12542. !1 === (H = new va(le,G,e)).isWebGL2 && (G.get("WEBGL_depth_texture"),
  12543. G.get("OES_texture_float"),
  12544. G.get("OES_texture_half_float"),
  12545. G.get("OES_texture_half_float_linear"),
  12546. G.get("OES_standard_derivatives"),
  12547. G.get("OES_element_index_uint"),
  12548. G.get("OES_vertex_array_object"),
  12549. G.get("ANGLE_instanced_arrays")),
  12550. G.get("OES_texture_float_linear"),
  12551. oe = new ss(0,G,H),
  12552. (V = new as(le,G,H)).scissor(M.copy(B).multiplyScalar(C).floor()),
  12553. V.viewport(_.copy(k).multiplyScalar(C).floor()),
  12554. j = new Ea,
  12555. W = new Vo,
  12556. X = new os(le,G,V,W,H,oe,j),
  12557. q = new ya(p),
  12558. J = new la(le,H),
  12559. se = new fa(le,G,J,H),
  12560. Y = new ba(0,J,j,se),
  12561. Z = new Ta(0,Y,J,j),
  12562. ie = new Aa(le),
  12563. te = new ga(W),
  12564. Q = new Ho(p,q,G,H,se,te),
  12565. K = new hs(W),
  12566. $ = new qo(W),
  12567. ee = new $o(G,H),
  12568. ne = new pa(p,q,V,Z,s),
  12569. re = new ma(le,G,j,H),
  12570. ae = new xa(le,G,j,H),
  12571. j.programs = Q.programs,
  12572. p.capabilities = H,
  12573. p.extensions = G,
  12574. p.properties = W,
  12575. p.renderLists = $,
  12576. p.state = V,
  12577. p.info = j,
  12578. p._textures = X
  12579. }
  12580. he();
  12581. var pe = new ds(p,le);
  12582. this.xr = pe;
  12583. var fe = new rs(p,Z,H.maxTextureSize);
  12584. function me(e) {
  12585. e.preventDefault(),
  12586. console.log("THREE.WebGLRenderer: Context Lost."),
  12587. h = !0
  12588. }
  12589. function ve() {
  12590. console.log("THREE.WebGLRenderer: Context Restored."),
  12591. h = !1,
  12592. he()
  12593. }
  12594. function ge(e) {
  12595. var e = e.target;
  12596. e.removeEventListener("dispose", ge),
  12597. ye(e = e),
  12598. W.remove(e)
  12599. }
  12600. function ye(e) {
  12601. e = W.get(e).program;
  12602. void 0 !== e && Q.releaseProgram(e)
  12603. }
  12604. this.shadowMap = fe,
  12605. this.getContext = function() {
  12606. return le
  12607. }
  12608. ,
  12609. this.getContextAttributes = function() {
  12610. return le.getContextAttributes()
  12611. }
  12612. ,
  12613. this.forceContextLoss = function() {
  12614. var e = G.get("WEBGL_lose_context");
  12615. e && e.loseContext()
  12616. }
  12617. ,
  12618. this.forceContextRestore = function() {
  12619. var e = G.get("WEBGL_lose_context");
  12620. e && e.restoreContext()
  12621. }
  12622. ,
  12623. this.getPixelRatio = function() {
  12624. return C
  12625. }
  12626. ,
  12627. this.setPixelRatio = function(e) {
  12628. void 0 !== e && (C = e,
  12629. this.setSize(T, S, !1))
  12630. }
  12631. ,
  12632. this.getSize = function(e) {
  12633. return void 0 === e && (console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),
  12634. e = new yn),
  12635. e.set(T, S)
  12636. }
  12637. ,
  12638. this.setSize = function(e, t, n, i) {
  12639. null != i && (C = i),
  12640. pe.isPresenting ? console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.") : (T = e,
  12641. S = t,
  12642. r.width = Math.floor(e * C),
  12643. r.height = Math.floor(t * C),
  12644. !1 !== n && (r.style.width = e + "px",
  12645. r.style.height = t + "px"),
  12646. this.setViewport(0, 0, e, t))
  12647. }
  12648. ,
  12649. this.getDrawingBufferSize = function(e) {
  12650. return void 0 === e && (console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),
  12651. e = new yn),
  12652. e.set(T * C, S * C).floor()
  12653. }
  12654. ,
  12655. this.setDrawingBufferSize = function(e, t, n) {
  12656. T = e,
  12657. S = t,
  12658. C = n,
  12659. r.width = Math.floor(e * n),
  12660. r.height = Math.floor(t * n),
  12661. this.setViewport(0, 0, e, t)
  12662. }
  12663. ,
  12664. this.getCurrentViewport = function(e) {
  12665. return void 0 === e && (console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),
  12666. e = new Mn),
  12667. e.copy(_)
  12668. }
  12669. ,
  12670. this.getViewport = function(e) {
  12671. return e.copy(k)
  12672. }
  12673. ,
  12674. this.setViewport = function(e, t, n, i) {
  12675. e.isVector4 ? k.set(e.x, e.y, e.z, e.w) : k.set(e, t, n, i),
  12676. V.viewport(_.copy(k).multiplyScalar(C).floor())
  12677. }
  12678. ,
  12679. this.getScissor = function(e) {
  12680. return e.copy(B)
  12681. }
  12682. ,
  12683. this.setScissor = function(e, t, n, i) {
  12684. e.isVector4 ? B.set(e.x, e.y, e.z, e.w) : B.set(e, t, n, i),
  12685. V.scissor(M.copy(B).multiplyScalar(C).floor())
  12686. }
  12687. ,
  12688. this.getScissorTest = function() {
  12689. return L
  12690. }
  12691. ,
  12692. this.setScissorTest = function(e) {
  12693. V.setScissorTest(L = e)
  12694. }
  12695. ,
  12696. this.setOpaqueSort = function(e) {
  12697. P = e
  12698. }
  12699. ,
  12700. this.setTransparentSort = function(e) {
  12701. D = e
  12702. }
  12703. ,
  12704. this.getClearColor = function(e) {
  12705. return void 0 === e && (console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),
  12706. e = new Yi),
  12707. e.copy(ne.getClearColor())
  12708. }
  12709. ,
  12710. this.setClearColor = function() {
  12711. ne.setClearColor.apply(ne, arguments)
  12712. }
  12713. ,
  12714. this.getClearAlpha = function() {
  12715. return ne.getClearAlpha()
  12716. }
  12717. ,
  12718. this.setClearAlpha = function() {
  12719. ne.setClearAlpha.apply(ne, arguments)
  12720. }
  12721. ,
  12722. this.clear = function(e, t, n) {
  12723. var i = 0;
  12724. void 0 !== e && !e || (i |= 16384),
  12725. void 0 !== t && !t || (i |= 256),
  12726. void 0 !== n && !n || (i |= 1024),
  12727. le.clear(i)
  12728. }
  12729. ,
  12730. this.clearColor = function() {
  12731. this.clear(!0, !1, !1)
  12732. }
  12733. ,
  12734. this.clearDepth = function() {
  12735. this.clear(!1, !0, !1)
  12736. }
  12737. ,
  12738. this.clearStencil = function() {
  12739. this.clear(!1, !1, !0)
  12740. }
  12741. ,
  12742. this.dispose = function() {
  12743. r.removeEventListener("webglcontextlost", me, !1),
  12744. r.removeEventListener("webglcontextrestored", ve, !1),
  12745. $.dispose(),
  12746. ee.dispose(),
  12747. W.dispose(),
  12748. q.dispose(),
  12749. Z.dispose(),
  12750. se.dispose(),
  12751. pe.dispose(),
  12752. be.stop()
  12753. }
  12754. ,
  12755. this.renderBufferImmediate = function(e, t) {
  12756. se.initAttributes();
  12757. var n = W.get(e);
  12758. e.hasPositions && !n.position && (n.position = le.createBuffer()),
  12759. e.hasNormals && !n.normal && (n.normal = le.createBuffer()),
  12760. e.hasUvs && !n.uv && (n.uv = le.createBuffer()),
  12761. e.hasColors && !n.color && (n.color = le.createBuffer());
  12762. t = t.getAttributes();
  12763. e.hasPositions && (le.bindBuffer(34962, n.position),
  12764. le.bufferData(34962, e.positionArray, 35048),
  12765. se.enableAttribute(t.position),
  12766. le.vertexAttribPointer(t.position, 3, 5126, !1, 0, 0)),
  12767. e.hasNormals && (le.bindBuffer(34962, n.normal),
  12768. le.bufferData(34962, e.normalArray, 35048),
  12769. se.enableAttribute(t.normal),
  12770. le.vertexAttribPointer(t.normal, 3, 5126, !1, 0, 0)),
  12771. e.hasUvs && (le.bindBuffer(34962, n.uv),
  12772. le.bufferData(34962, e.uvArray, 35048),
  12773. se.enableAttribute(t.uv),
  12774. le.vertexAttribPointer(t.uv, 2, 5126, !1, 0, 0)),
  12775. e.hasColors && (le.bindBuffer(34962, n.color),
  12776. le.bufferData(34962, e.colorArray, 35048),
  12777. se.enableAttribute(t.color),
  12778. le.vertexAttribPointer(t.color, 3, 5126, !1, 0, 0)),
  12779. se.disableUnusedAttributes(),
  12780. le.drawArrays(4, 0, e.count),
  12781. e.count = 0
  12782. }
  12783. ,
  12784. this.renderBufferDirect = function(e, t, n, i, r, a) {
  12785. null === t && (t = N);
  12786. var o = r.isMesh && r.matrixWorld.determinant() < 0
  12787. , s = Me(e, t, i, r);
  12788. V.setMaterial(i, o);
  12789. var l = n.index
  12790. , e = n.attributes.position;
  12791. if (null === l) {
  12792. if (void 0 === e || 0 === e.count)
  12793. return
  12794. } else if (0 === l.count)
  12795. return;
  12796. t = 1;
  12797. !0 === i.wireframe && (l = Y.getWireframeAttribute(n),
  12798. t = 2),
  12799. (i.morphTargets || i.morphNormals) && ie.update(r, n, i, s),
  12800. se.setup(r, i, s, n, l);
  12801. o = re;
  12802. null !== l && (u = J.get(l),
  12803. (o = ae).setIndex(u));
  12804. var s = (null !== l ? l : e).count
  12805. , u = n.drawRange.start * t
  12806. , l = n.drawRange.count * t
  12807. , e = null !== a ? a.start * t : 0
  12808. , a = null !== a ? a.count * t : 1 / 0
  12809. , t = Math.max(u, e)
  12810. , a = Math.min(s, u + l, e + a) - 1
  12811. , a = Math.max(0, a - t + 1);
  12812. 0 !== a && (r.isMesh ? !0 === i.wireframe ? (V.setlineWidth(i.wireframelineWidth * U()),
  12813. o.setMode(1)) : o.setMode(4) : r.isLine ? (i = i.lineWidth,
  12814. V.setlineWidth((i = void 0 === i ? 1 : i) * U()),
  12815. r.isLineSegments ? o.setMode(1) : r.isLineLoop ? o.setMode(2) : o.setMode(3)) : r.isPoints ? o.setMode(0) : r.isSprite && o.setMode(4),
  12816. r.isInstancedMesh ? o.renderInstances(t, a, r.count) : n.isInstancedBufferGeometry ? (n = Math.min(n.instanceCount, n._maxInstanceCount),
  12817. o.renderInstances(t, a, n)) : o.render(t, a))
  12818. }
  12819. ,
  12820. this.compile = function(r, t) {
  12821. (y = ee.get(r)).init(),
  12822. r.traverseVisible(function(e) {
  12823. e.isLight && e.layers.test(t.layers) && (y.pushLight(e),
  12824. e.castShadow && y.pushShadow(e))
  12825. }),
  12826. y.setupLights();
  12827. var a = new WeakMap;
  12828. r.traverse(function(e) {
  12829. var t = e.material;
  12830. if (t)
  12831. if (Array.isArray(t))
  12832. for (var n = 0; n < t.length; n++) {
  12833. var i = t[n];
  12834. !1 === a.has(i) && (_e(i, r, e),
  12835. a.set(i))
  12836. }
  12837. else
  12838. !1 === a.has(t) && (_e(t, r, e),
  12839. a.set(t))
  12840. })
  12841. }
  12842. ;
  12843. var we = null;
  12844. var be = new sa;
  12845. function xe(e, t, n) {
  12846. for (var i = !0 === t.isScene ? t.overrideMaterial : null, r = 0, a = e.length; r < a; r++) {
  12847. var o = e[r]
  12848. , s = o.object
  12849. , l = o.geometry
  12850. , u = null === i ? o.material : i
  12851. , c = o.group;
  12852. if (n.isArrayCamera)
  12853. for (var d = n.cameras, h = 0, p = d.length; h < p; h++) {
  12854. var f = d[h];
  12855. s.layers.test(f.layers) && (V.viewport(_.copy(f.viewport)),
  12856. y.setupLightsView(f),
  12857. Ee(s, t, f, l, u, c))
  12858. }
  12859. else
  12860. Ee(s, t, n, l, u, c)
  12861. }
  12862. }
  12863. function Ee(e, t, n, i, r, a) {
  12864. var o, s;
  12865. e.onBeforeRender(p, t, n, i, r, a),
  12866. e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, e.matrixWorld),
  12867. e.normalMatrix.getNormalMatrix(e.modelViewMatrix),
  12868. e.isImmediateRenderObject ? (o = Me(n, t, r, e),
  12869. V.setMaterial(r),
  12870. se.reset(),
  12871. s = o,
  12872. e.render(function(e) {
  12873. p.renderBufferImmediate(e, s)
  12874. })) : p.renderBufferDirect(n, t, i, r, e, a),
  12875. e.onAfterRender(p, t, n, i, r, a)
  12876. }
  12877. function _e(e, t, n) {
  12878. !0 !== t.isScene && (t = N);
  12879. var i = W.get(e)
  12880. , r = y.state.lights
  12881. , a = y.state.shadowsArray
  12882. , o = r.state.version
  12883. , s = Q.getParameters(e, r.state, a, t, n)
  12884. , l = Q.getProgramCacheKey(s)
  12885. , u = i.program
  12886. , a = !0;
  12887. if (void 0 === u)
  12888. e.addEventListener("dispose", ge);
  12889. else if (u.cacheKey !== l)
  12890. ye(e);
  12891. else if (i.lightsStateVersion !== o)
  12892. a = !1;
  12893. else {
  12894. if (void 0 !== s.shaderID) {
  12895. n = e.isMeshStandardMaterial ? t.environment : null;
  12896. return void (i.envMap = q.get(e.envMap || n))
  12897. }
  12898. a = !1
  12899. }
  12900. a && (s.uniforms = Q.getUniforms(e),
  12901. e.onBeforeCompile(s, p),
  12902. u = Q.acquireProgram(s, l),
  12903. i.program = u,
  12904. i.uniforms = s.uniforms,
  12905. i.outputEncoding = s.outputEncoding);
  12906. s = i.uniforms;
  12907. (e.isShaderMaterial || e.isRawShaderMaterial) && !0 !== e.clipping || (i.numClippingPlanes = te.numPlanes,
  12908. i.numIntersection = te.numIntersection,
  12909. s.clippingPlanes = te.uniform),
  12910. i.environment = e.isMeshStandardMaterial ? t.environment : null,
  12911. i.fog = t.fog,
  12912. i.envMap = q.get(e.envMap || i.environment),
  12913. i.needsLights = (e = e).isMeshLambertMaterial || e.isMeshToonMaterial || e.isMeshPhongMaterial || e.isMeshStandardMaterial || e.isShadowMaterial || e.isShaderMaterial && !0 === e.lights,
  12914. i.lightsStateVersion = o,
  12915. i.needsLights && (s.ambientLightColor.value = r.state.ambient,
  12916. s.lightProbe.value = r.state.probe,
  12917. s.directionalLights.value = r.state.directional,
  12918. s.directionalLightShadows.value = r.state.directionalShadow,
  12919. s.spotLights.value = r.state.spot,
  12920. s.spotLightShadows.value = r.state.spotShadow,
  12921. s.rectAreaLights.value = r.state.rectArea,
  12922. s.ltc_1.value = r.state.rectAreaLTC1,
  12923. s.ltc_2.value = r.state.rectAreaLTC2,
  12924. s.pointLights.value = r.state.point,
  12925. s.pointLightShadows.value = r.state.pointShadow,
  12926. s.hemisphereLights.value = r.state.hemi,
  12927. s.directionalShadowMap.value = r.state.directionalShadowMap,
  12928. s.directionalShadowMatrix.value = r.state.directionalShadowMatrix,
  12929. s.spotShadowMap.value = r.state.spotShadowMap,
  12930. s.spotShadowMatrix.value = r.state.spotShadowMatrix,
  12931. s.pointShadowMap.value = r.state.pointShadowMap,
  12932. s.pointShadowMatrix.value = r.state.pointShadowMatrix);
  12933. r = i.program.getUniforms(),
  12934. s = _o.seqWithValue(r.seq, s);
  12935. i.uniformsList = s
  12936. }
  12937. function Me(e, t, n, i) {
  12938. !0 !== t.isScene && (t = N),
  12939. X.resetTextureUnits();
  12940. var r = t.fog
  12941. , a = n.isMeshStandardMaterial ? t.environment : null
  12942. , o = null === w ? p.outputEncoding : w.texture.encoding
  12943. , s = q.get(n.envMap || a)
  12944. , l = W.get(n)
  12945. , u = y.state.lights;
  12946. !0 === F && (!0 !== I && e === E || (h = e === E && n.id === x,
  12947. te.setState(n, e, h))),
  12948. n.version === l.__version ? (n.fog && l.fog !== r || l.environment !== a || l.needsLights && l.lightsStateVersion !== u.state.version || void 0 !== l.numClippingPlanes && (l.numClippingPlanes !== te.numPlanes || l.numIntersection !== te.numIntersection) || l.outputEncoding !== o || l.envMap !== s) && _e(n, t, i) : (_e(n, t, i),
  12949. l.__version = n.version);
  12950. var c, d = !1, h = !1, a = !1, u = l.program, o = u.getUniforms(), s = l.uniforms;
  12951. return V.useProgram(u.program) && (a = h = d = !0),
  12952. n.id !== x && (x = n.id,
  12953. h = !0),
  12954. !d && E === e || (o.setValue(le, "projectionMatrix", e.projectionMatrix),
  12955. H.logarithmicDepthBuffer && o.setValue(le, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)),
  12956. E !== e && (E = e,
  12957. a = h = !0),
  12958. !(n.isShaderMaterial || n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshStandardMaterial || n.envMap) || void 0 !== (c = o.map.cameraPosition) && c.setValue(le, z.setFromMatrixPosition(e.matrixWorld)),
  12959. (n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial) && o.setValue(le, "isOrthographic", !0 === e.isOrthographicCamera),
  12960. (n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial || n.isShadowMaterial || n.skinning) && o.setValue(le, "viewMatrix", e.matrixWorldInverse)),
  12961. n.skinning && (o.setOptional(le, i, "bindMatrix"),
  12962. o.setOptional(le, i, "bindMatrixInverse"),
  12963. (t = i.skeleton) && (d = t.bones,
  12964. H.floatVertexTextures ? (null === t.boneTexture && (c = Math.sqrt(4 * d.length),
  12965. c = gn.ceilPowerOfTwo(c),
  12966. c = Math.max(c, 4),
  12967. (e = new Float32Array(c * c * 4)).set(t.boneMatrices),
  12968. d = new ia(e,c,c,et,Xe),
  12969. t.boneMatrices = e,
  12970. t.boneTexture = d,
  12971. t.boneTextureSize = c),
  12972. o.setValue(le, "boneTexture", t.boneTexture, X),
  12973. o.setValue(le, "boneTextureSize", t.boneTextureSize)) : o.setOptional(le, t, "boneMatrices"))),
  12974. !h && l.receiveShadow === i.receiveShadow || (l.receiveShadow = i.receiveShadow,
  12975. o.setValue(le, "receiveShadow", i.receiveShadow)),
  12976. h && (o.setValue(le, "toneMappingExposure", p.toneMappingExposure),
  12977. l.needsLights && (h = a,
  12978. (a = s).ambientLightColor.needsUpdate = h,
  12979. a.lightProbe.needsUpdate = h,
  12980. a.directionalLights.needsUpdate = h,
  12981. a.directionalLightShadows.needsUpdate = h,
  12982. a.pointLights.needsUpdate = h,
  12983. a.pointLightShadows.needsUpdate = h,
  12984. a.spotLights.needsUpdate = h,
  12985. a.spotLightShadows.needsUpdate = h,
  12986. a.rectAreaLights.needsUpdate = h,
  12987. a.hemisphereLights.needsUpdate = h),
  12988. r && n.fog && K.refreshFogUniforms(s, r),
  12989. K.refreshMaterialUniforms(s, n, C, S),
  12990. _o.upload(le, l.uniformsList, s, X)),
  12991. n.isShaderMaterial && !0 === n.uniformsNeedUpdate && (_o.upload(le, l.uniformsList, s, X),
  12992. n.uniformsNeedUpdate = !1),
  12993. n.isSpriteMaterial && o.setValue(le, "center", i.center),
  12994. o.setValue(le, "modelViewMatrix", i.modelViewMatrix),
  12995. o.setValue(le, "normalMatrix", i.normalMatrix),
  12996. o.setValue(le, "modelMatrix", i.matrixWorld),
  12997. u
  12998. }
  12999. be.setAnimationLoop(function(e) {
  13000. pe.isPresenting || we && we(e)
  13001. }),
  13002. "undefined" != typeof window && be.setContext(window),
  13003. this.setAnimationLoop = function(e) {
  13004. we = e,
  13005. pe.setAnimationLoop(e),
  13006. null === e ? be.stop() : be.start()
  13007. }
  13008. ,
  13009. this.render = function(e, t) {
  13010. var n, i, r;
  13011. void 0 !== arguments[2] && (console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),
  13012. i = arguments[2]),
  13013. void 0 !== arguments[3] && (console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),
  13014. r = arguments[3]),
  13015. void 0 === t || !0 === t.isCamera ? !0 !== h && (se.resetDefaultState(),
  13016. x = -1,
  13017. !(E = null) === e.autoUpdate && e.updateMatrixWorld(),
  13018. null === t.parent && t.updateMatrixWorld(),
  13019. !0 === pe.enabled && !0 === pe.isPresenting && (t = pe.getCamera(t)),
  13020. !0 === e.isScene && e.onBeforeRender(p, e, t, i || w),
  13021. (y = ee.get(e, d.length)).init(),
  13022. d.push(y),
  13023. O.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse),
  13024. R.setFromProjectionMatrix(O),
  13025. I = this.localClippingEnabled,
  13026. F = te.init(this.clippingPlanes, I, t),
  13027. (g = $.get(e, t)).init(),
  13028. function e(t, n, i, r) {
  13029. if (!1 === t.visible)
  13030. return;
  13031. var a = t.layers.test(n.layers);
  13032. if (a)
  13033. if (t.isGroup)
  13034. i = t.renderOrder;
  13035. else if (t.isLOD)
  13036. !0 === t.autoUpdate && t.update(n);
  13037. else if (t.isLight)
  13038. y.pushLight(t),
  13039. t.castShadow && y.pushShadow(t);
  13040. else if (t.isSprite) {
  13041. var o;
  13042. t.frustumCulled && !R.intersectsSprite(t) || (r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O),
  13043. o = Z.update(t),
  13044. (a = t.material).visible && g.push(t, o, a, i, z.z, null))
  13045. } else if (t.isImmediateRenderObject)
  13046. r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O),
  13047. g.push(t, null, t.material, i, z.z, null);
  13048. else if ((t.isMesh || t.isLine || t.isPoints) && (t.isSkinnedMesh && t.skeleton.frame !== j.render.frame && (t.skeleton.update(),
  13049. t.skeleton.frame = j.render.frame),
  13050. !t.frustumCulled || R.intersectsObject(t))) {
  13051. r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O);
  13052. var s = Z.update(t)
  13053. , l = t.material;
  13054. if (Array.isArray(l))
  13055. for (var u = s.groups, c = 0, d = u.length; c < d; c++) {
  13056. var h = u[c]
  13057. , p = l[h.materialIndex];
  13058. p && p.visible && g.push(t, s, p, i, z.z, h)
  13059. }
  13060. else
  13061. l.visible && g.push(t, s, l, i, z.z, null)
  13062. }
  13063. var f = t.children;
  13064. for (var m = 0, v = f.length; m < v; m++)
  13065. e(f[m], n, i, r)
  13066. }(e, t, 0, p.sortObjects),
  13067. g.finish(),
  13068. !0 === p.sortObjects && g.sort(P, D),
  13069. !0 === F && te.beginShadows(),
  13070. n = y.state.shadowsArray,
  13071. fe.render(n, e, t),
  13072. y.setupLights(),
  13073. y.setupLightsView(t),
  13074. !0 === F && te.endShadows(),
  13075. !0 === this.info.autoReset && this.info.reset(),
  13076. void 0 !== i && this.setRenderTarget(i),
  13077. ne.render(g, e, t, r),
  13078. i = g.opaque,
  13079. r = g.transparent,
  13080. 0 < i.length && xe(i, e, t),
  13081. 0 < r.length && xe(r, e, t),
  13082. !0 === e.isScene && e.onAfterRender(p, e, t),
  13083. null !== w && (X.updateRenderTargetMipmap(w),
  13084. X.updateMultisampleRenderTarget(w)),
  13085. V.buffers.depth.setTest(!0),
  13086. V.buffers.depth.setMask(!0),
  13087. V.buffers.color.setMask(!0),
  13088. V.setPolygonOffset(!1),
  13089. d.pop(),
  13090. y = 0 < d.length ? d[d.length - 1] : null,
  13091. g = null) : console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")
  13092. }
  13093. ,
  13094. this.setFramebuffer = function(e) {
  13095. f !== e && null === w && le.bindFramebuffer(36160, e),
  13096. f = e
  13097. }
  13098. ,
  13099. this.getActiveCubeFace = function() {
  13100. return m
  13101. }
  13102. ,
  13103. this.getActiveMipmapLevel = function() {
  13104. return v
  13105. }
  13106. ,
  13107. this.getRenderList = function() {
  13108. return g
  13109. }
  13110. ,
  13111. this.setRenderList = function(e) {
  13112. g = e
  13113. }
  13114. ,
  13115. this.getRenderTarget = function() {
  13116. return w
  13117. }
  13118. ,
  13119. this.setRenderTarget = function(e) {
  13120. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  13121. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0;
  13122. m = t,
  13123. v = n,
  13124. (w = e) && void 0 === W.get(e).__webglFramebuffer && X.setupRenderTarget(e);
  13125. var i, r = f, a = !1;
  13126. A = e ? (i = W.get(e).__webglFramebuffer,
  13127. e.isWebGLCubeRenderTarget ? (r = i[t],
  13128. a = !0) : r = e.isWebGLMultisampleRenderTarget ? W.get(e).__webglMultisampledFramebuffer : i,
  13129. _.copy(e.viewport),
  13130. M.copy(e.scissor),
  13131. e.scissorTest) : (_.copy(k).multiplyScalar(C).floor(),
  13132. M.copy(B).multiplyScalar(C).floor(),
  13133. L),
  13134. b !== r && (le.bindFramebuffer(36160, r),
  13135. b = r),
  13136. V.viewport(_),
  13137. V.scissor(M),
  13138. V.setScissorTest(A),
  13139. a && (e = W.get(e.texture),
  13140. le.framebufferTexture2D(36160, 36064, 34069 + t, e.__webglTexture, n))
  13141. }
  13142. ,
  13143. this.readRenderTargetPixels = function(e, t, n, i, r, a, o) {
  13144. if (e && e.isWebGLRenderTarget) {
  13145. var s = W.get(e).__webglFramebuffer;
  13146. if (s = e.isWebGLCubeRenderTarget && void 0 !== o ? s[o] : s) {
  13147. o = !1;
  13148. s !== b && (le.bindFramebuffer(36160, s),
  13149. o = !0);
  13150. try {
  13151. var l = e.texture
  13152. , u = l.format
  13153. , c = l.type;
  13154. if (u !== et && oe.convert(u) !== le.getParameter(35739))
  13155. return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
  13156. if (!(c === Ue || oe.convert(c) === le.getParameter(35738) || c === Xe && (H.isWebGL2 || G.get("OES_texture_float") || G.get("WEBGL_color_buffer_float")) || c === qe && (H.isWebGL2 ? G.get("EXT_color_buffer_float") : G.get("EXT_color_buffer_half_float"))))
  13157. return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
  13158. 36053 === le.checkFramebufferStatus(36160) ? 0 <= t && t <= e.width - i && 0 <= n && n <= e.height - r && le.readPixels(t, n, i, r, oe.convert(u), oe.convert(c), a) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")
  13159. } finally {
  13160. o && le.bindFramebuffer(36160, b)
  13161. }
  13162. }
  13163. } else
  13164. console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")
  13165. }
  13166. ,
  13167. this.copyFramebufferToTexture = function(e, t) {
  13168. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  13169. , i = Math.pow(2, -n)
  13170. , r = Math.floor(t.image.width * i)
  13171. , a = Math.floor(t.image.height * i)
  13172. , i = oe.convert(t.format);
  13173. X.setTexture2D(t, 0),
  13174. le.copyTexImage2D(3553, n, i, e.x, e.y, r, a, 0),
  13175. V.unbindTexture()
  13176. }
  13177. ,
  13178. this.copyTextureToTexture = function(e, t, n) {
  13179. var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0
  13180. , r = t.image.width
  13181. , a = t.image.height
  13182. , o = oe.convert(n.format)
  13183. , s = oe.convert(n.type);
  13184. X.setTexture2D(n, 0),
  13185. le.pixelStorei(37440, n.flipY),
  13186. le.pixelStorei(37441, n.premultiplyAlpha),
  13187. le.pixelStorei(3317, n.unpackAlignment),
  13188. t.isDataTexture ? le.texSubImage2D(3553, i, e.x, e.y, r, a, o, s, t.image.data) : t.isCompressedTexture ? le.compressedTexSubImage2D(3553, i, e.x, e.y, t.mipmaps[0].width, t.mipmaps[0].height, o, t.mipmaps[0].data) : le.texSubImage2D(3553, i, e.x, e.y, o, s, t.image),
  13189. 0 === i && n.generateMipmaps && le.generateMipmap(3553),
  13190. V.unbindTexture()
  13191. }
  13192. ,
  13193. this.initTexture = function(e) {
  13194. X.setTexture2D(e, 0),
  13195. V.unbindTexture()
  13196. }
  13197. ,
  13198. this.resetState = function() {
  13199. V.reset(),
  13200. se.reset()
  13201. }
  13202. ,
  13203. "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{
  13204. detail: this
  13205. }))
  13206. }
  13207. function fs(e) {
  13208. ps.call(this, e)
  13209. }
  13210. ls.prototype = Object.assign(Object.create($r.prototype), {
  13211. constructor: ls,
  13212. isArrayCamera: !0
  13213. }),
  13214. us.prototype = Object.assign(Object.create(Si.prototype), {
  13215. constructor: us,
  13216. isGroup: !0
  13217. }),
  13218. Object.assign(cs.prototype, {
  13219. constructor: cs,
  13220. getHandSpace: function() {
  13221. if (null === this._hand && (this._hand = new us,
  13222. this._hand.matrixAutoUpdate = !1,
  13223. this._hand.visible = !1,
  13224. this._hand.joints = [],
  13225. this._hand.inputState = {
  13226. pinching: !1
  13227. },
  13228. window.XRHand))
  13229. for (var e = 0; e <= window.XRHand.LITTLE_PHALANX_TIP; e++) {
  13230. var t = new us;
  13231. t.matrixAutoUpdate = !1,
  13232. t.visible = !1,
  13233. this._hand.joints.push(t),
  13234. this._hand.add(t)
  13235. }
  13236. return this._hand
  13237. },
  13238. getTargetRaySpace: function() {
  13239. return null === this._targetRay && (this._targetRay = new us,
  13240. this._targetRay.matrixAutoUpdate = !1,
  13241. this._targetRay.visible = !1),
  13242. this._targetRay
  13243. },
  13244. getGripSpace: function() {
  13245. return null === this._grip && (this._grip = new us,
  13246. this._grip.matrixAutoUpdate = !1,
  13247. this._grip.visible = !1),
  13248. this._grip
  13249. },
  13250. dispatchEvent: function(e) {
  13251. return null !== this._targetRay && this._targetRay.dispatchEvent(e),
  13252. null !== this._grip && this._grip.dispatchEvent(e),
  13253. null !== this._hand && this._hand.dispatchEvent(e),
  13254. this
  13255. },
  13256. disconnect: function(e) {
  13257. return this.dispatchEvent({
  13258. type: "disconnected",
  13259. data: e
  13260. }),
  13261. null !== this._targetRay && (this._targetRay.visible = !1),
  13262. null !== this._grip && (this._grip.visible = !1),
  13263. null !== this._hand && (this._hand.visible = !1),
  13264. this
  13265. },
  13266. update: function(e, t, n) {
  13267. var i = null
  13268. , r = null
  13269. , a = null
  13270. , o = this._targetRay
  13271. , s = this._grip
  13272. , l = this._hand;
  13273. if (e && "visible-blurred" !== t.session.visibilityState)
  13274. if (l && e.hand)
  13275. for (var u, c, a = !0, d = 0; d <= window.XRHand.LITTLE_PHALANX_TIP; d++)
  13276. e.hand[d] && (c = t.getJointPose(e.hand[d], n),
  13277. u = l.joints[d],
  13278. null !== c && (u.matrix.fromArray(c.transform.matrix),
  13279. u.matrix.decompose(u.position, u.rotation, u.scale),
  13280. u.jointRadius = c.radius),
  13281. u.visible = null !== c,
  13282. u = l.joints[window.XRHand.INDEX_PHALANX_TIP],
  13283. c = l.joints[window.XRHand.THUMB_PHALANX_TIP],
  13284. c = u.position.distanceTo(c.position),
  13285. l.inputState.pinching && .025 < c ? (l.inputState.pinching = !1,
  13286. this.dispatchEvent({
  13287. type: "pinchend",
  13288. handedness: e.handedness,
  13289. target: this
  13290. })) : !l.inputState.pinching && c <= .015 && (l.inputState.pinching = !0,
  13291. this.dispatchEvent({
  13292. type: "pinchstart",
  13293. handedness: e.handedness,
  13294. target: this
  13295. })));
  13296. else
  13297. null !== o && null !== (i = t.getPose(e.targetRaySpace, n)) && (o.matrix.fromArray(i.transform.matrix),
  13298. o.matrix.decompose(o.position, o.rotation, o.scale)),
  13299. null !== s && e.gripSpace && null !== (r = t.getPose(e.gripSpace, n)) && (s.matrix.fromArray(r.transform.matrix),
  13300. s.matrix.decompose(s.position, s.rotation, s.scale));
  13301. return null !== o && (o.visible = null !== i),
  13302. null !== s && (s.visible = null !== r),
  13303. null !== l && (l.visible = null !== a),
  13304. this
  13305. }
  13306. }),
  13307. Object.assign(ds.prototype, hn.prototype),
  13308. fs.prototype = Object.assign(Object.create(ps.prototype), {
  13309. constructor: fs,
  13310. isWebGL1Renderer: !0
  13311. });
  13312. var ms = function() {
  13313. function n(e, t) {
  13314. O(this, n),
  13315. Object.defineProperty(this, "isFogExp2", {
  13316. value: !0
  13317. }),
  13318. this.name = "",
  13319. this.color = new Yi(e),
  13320. this.density = void 0 !== t ? t : 25e-5
  13321. }
  13322. return h(n, [{
  13323. key: "clone",
  13324. value: function() {
  13325. return new n(this.color,this.density)
  13326. }
  13327. }, {
  13328. key: "toJSON",
  13329. value: function() {
  13330. return {
  13331. type: "FogExp2",
  13332. color: this.color.getHex(),
  13333. density: this.density
  13334. }
  13335. }
  13336. }]),
  13337. n
  13338. }()
  13339. , vs = function() {
  13340. function i(e, t, n) {
  13341. O(this, i),
  13342. Object.defineProperty(this, "isFog", {
  13343. value: !0
  13344. }),
  13345. this.name = "",
  13346. this.color = new Yi(e),
  13347. this.near = void 0 !== t ? t : 1,
  13348. this.far = void 0 !== n ? n : 1e3
  13349. }
  13350. return h(i, [{
  13351. key: "clone",
  13352. value: function() {
  13353. return new i(this.color,this.near,this.far)
  13354. }
  13355. }, {
  13356. key: "toJSON",
  13357. value: function() {
  13358. return {
  13359. type: "Fog",
  13360. color: this.color.getHex(),
  13361. near: this.near,
  13362. far: this.far
  13363. }
  13364. }
  13365. }]),
  13366. i
  13367. }()
  13368. , gs = function() {
  13369. y(n, Si);
  13370. var t = w(n);
  13371. function n() {
  13372. var e;
  13373. return O(this, n),
  13374. e = t.call(this),
  13375. Object.defineProperty(g(e), "isScene", {
  13376. value: !0
  13377. }),
  13378. e.type = "Scene",
  13379. e.background = null,
  13380. e.environment = null,
  13381. e.fog = null,
  13382. e.overrideMaterial = null,
  13383. e.autoUpdate = !0,
  13384. "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{
  13385. detail: g(e)
  13386. })),
  13387. e
  13388. }
  13389. return h(n, [{
  13390. key: "copy",
  13391. value: function(e, t) {
  13392. return b(v(n.prototype), "copy", this).call(this, e, t),
  13393. null !== e.background && (this.background = e.background.clone()),
  13394. null !== e.environment && (this.environment = e.environment.clone()),
  13395. null !== e.fog && (this.fog = e.fog.clone()),
  13396. null !== e.overrideMaterial && (this.overrideMaterial = e.overrideMaterial.clone()),
  13397. this.autoUpdate = e.autoUpdate,
  13398. this.matrixAutoUpdate = e.matrixAutoUpdate,
  13399. this
  13400. }
  13401. }, {
  13402. key: "toJSON",
  13403. value: function(e) {
  13404. var t = b(v(n.prototype), "toJSON", this).call(this, e);
  13405. return null !== this.background && (t.object.background = this.background.toJSON(e)),
  13406. null !== this.environment && (t.object.environment = this.environment.toJSON(e)),
  13407. null !== this.fog && (t.object.fog = this.fog.toJSON()),
  13408. t
  13409. }
  13410. }]),
  13411. n
  13412. }();
  13413. function ys(e, t) {
  13414. this.array = e,
  13415. this.stride = t,
  13416. this.count = void 0 !== e ? e.length / t : 0,
  13417. this.usage = un,
  13418. this.updateRange = {
  13419. offset: 0,
  13420. count: -1
  13421. },
  13422. this.version = 0,
  13423. this.uuid = gn.generateUUID()
  13424. }
  13425. Object.defineProperty(ys.prototype, "needsUpdate", {
  13426. set: function(e) {
  13427. !0 === e && this.version++
  13428. }
  13429. }),
  13430. Object.assign(ys.prototype, {
  13431. isInterleavedBuffer: !0,
  13432. onUploadCallback: function() {},
  13433. setUsage: function(e) {
  13434. return this.usage = e,
  13435. this
  13436. },
  13437. copy: function(e) {
  13438. return this.array = new e.array.constructor(e.array),
  13439. this.count = e.count,
  13440. this.stride = e.stride,
  13441. this.usage = e.usage,
  13442. this
  13443. },
  13444. copyAt: function(e, t, n) {
  13445. e *= this.stride,
  13446. n *= t.stride;
  13447. for (var i = 0, r = this.stride; i < r; i++)
  13448. this.array[e + i] = t.array[n + i];
  13449. return this
  13450. },
  13451. set: function(e) {
  13452. return this.array.set(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0),
  13453. this
  13454. },
  13455. clone: function(e) {
  13456. void 0 === e.arrayBuffers && (e.arrayBuffers = {}),
  13457. void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = gn.generateUUID()),
  13458. void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
  13459. e = new ys(new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),this.stride);
  13460. return e.setUsage(this.usage),
  13461. e
  13462. },
  13463. onUpload: function(e) {
  13464. return this.onUploadCallback = e,
  13465. this
  13466. },
  13467. toJSON: function(e) {
  13468. return void 0 === e.arrayBuffers && (e.arrayBuffers = {}),
  13469. void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = gn.generateUUID()),
  13470. void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer))),
  13471. {
  13472. uuid: this.uuid,
  13473. buffer: this.array.buffer._uuid,
  13474. type: this.array.constructor.name,
  13475. stride: this.stride
  13476. }
  13477. }
  13478. });
  13479. var ws, bs = new Cn;
  13480. function xs(e, t, n, i) {
  13481. this.name = "",
  13482. this.data = e,
  13483. this.itemSize = t,
  13484. this.offset = n,
  13485. this.normalized = !0 === i
  13486. }
  13487. function Es(e) {
  13488. Ki.call(this),
  13489. this.type = "SpriteMaterial",
  13490. this.color = new Yi(16777215),
  13491. this.map = null,
  13492. this.alphaMap = null,
  13493. this.rotation = 0,
  13494. this.sizeAttenuation = !0,
  13495. this.transparent = !0,
  13496. this.setValues(e)
  13497. }
  13498. Object.defineProperties(xs.prototype, {
  13499. count: {
  13500. get: function() {
  13501. return this.data.count
  13502. }
  13503. },
  13504. array: {
  13505. get: function() {
  13506. return this.data.array
  13507. }
  13508. },
  13509. needsUpdate: {
  13510. set: function(e) {
  13511. this.data.needsUpdate = e
  13512. }
  13513. }
  13514. }),
  13515. Object.assign(xs.prototype, {
  13516. isInterleavedBufferAttribute: !0,
  13517. applyMatrix4: function(e) {
  13518. for (var t = 0, n = this.data.count; t < n; t++)
  13519. bs.x = this.getX(t),
  13520. bs.y = this.getY(t),
  13521. bs.z = this.getZ(t),
  13522. bs.applyMatrix4(e),
  13523. this.setXYZ(t, bs.x, bs.y, bs.z);
  13524. return this
  13525. },
  13526. setX: function(e, t) {
  13527. return this.data.array[e * this.data.stride + this.offset] = t,
  13528. this
  13529. },
  13530. setY: function(e, t) {
  13531. return this.data.array[e * this.data.stride + this.offset + 1] = t,
  13532. this
  13533. },
  13534. setZ: function(e, t) {
  13535. return this.data.array[e * this.data.stride + this.offset + 2] = t,
  13536. this
  13537. },
  13538. setW: function(e, t) {
  13539. return this.data.array[e * this.data.stride + this.offset + 3] = t,
  13540. this
  13541. },
  13542. getX: function(e) {
  13543. return this.data.array[e * this.data.stride + this.offset]
  13544. },
  13545. getY: function(e) {
  13546. return this.data.array[e * this.data.stride + this.offset + 1]
  13547. },
  13548. getZ: function(e) {
  13549. return this.data.array[e * this.data.stride + this.offset + 2]
  13550. },
  13551. getW: function(e) {
  13552. return this.data.array[e * this.data.stride + this.offset + 3]
  13553. },
  13554. setXY: function(e, t, n) {
  13555. return e = e * this.data.stride + this.offset,
  13556. this.data.array[e + 0] = t,
  13557. this.data.array[e + 1] = n,
  13558. this
  13559. },
  13560. setXYZ: function(e, t, n, i) {
  13561. return e = e * this.data.stride + this.offset,
  13562. this.data.array[e + 0] = t,
  13563. this.data.array[e + 1] = n,
  13564. this.data.array[e + 2] = i,
  13565. this
  13566. },
  13567. setXYZW: function(e, t, n, i, r) {
  13568. return e = e * this.data.stride + this.offset,
  13569. this.data.array[e + 0] = t,
  13570. this.data.array[e + 1] = n,
  13571. this.data.array[e + 2] = i,
  13572. this.data.array[e + 3] = r,
  13573. this
  13574. },
  13575. clone: function(e) {
  13576. if (void 0 !== e)
  13577. return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}),
  13578. void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)),
  13579. new xs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);
  13580. console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");
  13581. for (var t = [], n = 0; n < this.count; n++)
  13582. for (var i = n * this.data.stride + this.offset, r = 0; r < this.itemSize; r++)
  13583. t.push(this.data.array[i + r]);
  13584. return new nr(new this.array.constructor(t),this.itemSize,this.normalized)
  13585. },
  13586. toJSON: function(e) {
  13587. if (void 0 !== e)
  13588. return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}),
  13589. void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)),
  13590. {
  13591. isInterleavedBufferAttribute: !0,
  13592. itemSize: this.itemSize,
  13593. data: this.data.uuid,
  13594. offset: this.offset,
  13595. normalized: this.normalized
  13596. };
  13597. console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");
  13598. for (var t = [], n = 0; n < this.count; n++)
  13599. for (var i = n * this.data.stride + this.offset, r = 0; r < this.itemSize; r++)
  13600. t.push(this.data.array[i + r]);
  13601. return {
  13602. itemSize: this.itemSize,
  13603. type: this.array.constructor.name,
  13604. array: t,
  13605. normalized: this.normalized
  13606. }
  13607. }
  13608. }),
  13609. ((Es.prototype = Object.create(Ki.prototype)).constructor = Es).prototype.isSpriteMaterial = !0,
  13610. Es.prototype.copy = function(e) {
  13611. return Ki.prototype.copy.call(this, e),
  13612. this.color.copy(e.color),
  13613. this.map = e.map,
  13614. this.alphaMap = e.alphaMap,
  13615. this.rotation = e.rotation,
  13616. this.sizeAttenuation = e.sizeAttenuation,
  13617. this
  13618. }
  13619. ;
  13620. var _s = new Cn
  13621. , Ms = new Cn
  13622. , As = new Cn
  13623. , Ts = new yn
  13624. , Ss = new yn
  13625. , Cs = new ni
  13626. , Ps = new Cn
  13627. , Ds = new Cn
  13628. , ks = new Cn
  13629. , Bs = new yn
  13630. , Ls = new yn
  13631. , Rs = new yn;
  13632. function Fs(e) {
  13633. var t;
  13634. Si.call(this),
  13635. this.type = "Sprite",
  13636. void 0 === ws && (ws = new Mr,
  13637. t = new ys(new Float32Array([-.5, -.5, 0, 0, 0, .5, -.5, 0, 1, 0, .5, .5, 0, 1, 1, -.5, .5, 0, 0, 1]),5),
  13638. ws.setIndex([0, 1, 2, 0, 2, 3]),
  13639. ws.setAttribute("position", new xs(t,3,0,!1)),
  13640. ws.setAttribute("uv", new xs(t,2,3,!1))),
  13641. this.geometry = ws,
  13642. this.material = void 0 !== e ? e : new Es,
  13643. this.center = new yn(.5,.5)
  13644. }
  13645. function Is(e, t, n, i, r, a) {
  13646. Ts.subVectors(e, n).addScalar(.5).multiply(i),
  13647. void 0 !== r ? (Ss.x = a * Ts.x - r * Ts.y,
  13648. Ss.y = r * Ts.x + a * Ts.y) : Ss.copy(Ts),
  13649. e.copy(t),
  13650. e.x += Ss.x,
  13651. e.y += Ss.y,
  13652. e.applyMatrix4(Cs)
  13653. }
  13654. Fs.prototype = Object.assign(Object.create(Si.prototype), {
  13655. constructor: Fs,
  13656. isSprite: !0,
  13657. raycast: function(e, t) {
  13658. null === e.camera && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),
  13659. Ms.setFromMatrixScale(this.matrixWorld),
  13660. Cs.copy(e.camera.matrixWorld),
  13661. this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld),
  13662. As.setFromMatrixPosition(this.modelViewMatrix),
  13663. e.camera.isPerspectiveCamera && !1 === this.material.sizeAttenuation && Ms.multiplyScalar(-As.z);
  13664. var n, i = this.material.rotation;
  13665. 0 !== i && (r = Math.cos(i),
  13666. n = Math.sin(i));
  13667. var r, i = this.center;
  13668. Is(Ps.set(-.5, -.5, 0), As, i, Ms, n, r),
  13669. Is(Ds.set(.5, -.5, 0), As, i, Ms, n, r),
  13670. Is(ks.set(.5, .5, 0), As, i, Ms, n, r),
  13671. Bs.set(0, 0),
  13672. Ls.set(1, 0),
  13673. Rs.set(1, 1),
  13674. null === e.ray.intersectTriangle(Ps, Ds, ks, !1, _s) && (Is(Ds.set(-.5, .5, 0), As, i, Ms, n, r),
  13675. Ls.set(0, 1),
  13676. null === e.ray.intersectTriangle(Ps, ks, Ds, !1, _s)) || ((r = e.ray.origin.distanceTo(_s)) < e.near || r > e.far || t.push({
  13677. distance: r,
  13678. point: _s.clone(),
  13679. uv: Hi.getUV(_s, Ps, Ds, ks, Bs, Ls, Rs, new yn),
  13680. face: null,
  13681. object: this
  13682. }))
  13683. },
  13684. copy: function(e) {
  13685. return Si.prototype.copy.call(this, e),
  13686. void 0 !== e.center && this.center.copy(e.center),
  13687. this.material = e.material,
  13688. this
  13689. }
  13690. });
  13691. var Os = new Cn
  13692. , zs = new Cn;
  13693. function Ns() {
  13694. Si.call(this),
  13695. this._currentLevel = 0,
  13696. this.type = "LOD",
  13697. Object.defineProperties(this, {
  13698. levels: {
  13699. enumerable: !0,
  13700. value: []
  13701. }
  13702. }),
  13703. this.autoUpdate = !0
  13704. }
  13705. Ns.prototype = Object.assign(Object.create(Si.prototype), {
  13706. constructor: Ns,
  13707. isLOD: !0,
  13708. copy: function(e) {
  13709. Si.prototype.copy.call(this, e, !1);
  13710. for (var t = e.levels, n = 0, i = t.length; n < i; n++) {
  13711. var r = t[n];
  13712. this.addLevel(r.object.clone(), r.distance)
  13713. }
  13714. return this.autoUpdate = e.autoUpdate,
  13715. this
  13716. },
  13717. addLevel: function(e) {
  13718. for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, t = Math.abs(t), n = this.levels, i = 0; i < n.length && !(t < n[i].distance); i++)
  13719. ;
  13720. return n.splice(i, 0, {
  13721. distance: t,
  13722. object: e
  13723. }),
  13724. this.add(e),
  13725. this
  13726. },
  13727. getCurrentLevel: function() {
  13728. return this._currentLevel
  13729. },
  13730. getObjectForDistance: function(e) {
  13731. var t = this.levels;
  13732. if (0 < t.length) {
  13733. for (var n = 1, i = t.length; n < i && !(e < t[n].distance); n++)
  13734. ;
  13735. return t[n - 1].object
  13736. }
  13737. return null
  13738. },
  13739. raycast: function(e, t) {
  13740. var n;
  13741. 0 < this.levels.length && (Os.setFromMatrixPosition(this.matrixWorld),
  13742. n = e.ray.origin.distanceTo(Os),
  13743. this.getObjectForDistance(n).raycast(e, t))
  13744. },
  13745. update: function(e) {
  13746. var t = this.levels;
  13747. if (1 < t.length) {
  13748. Os.setFromMatrixPosition(e.matrixWorld),
  13749. zs.setFromMatrixPosition(this.matrixWorld);
  13750. var n, i, r = Os.distanceTo(zs) / e.zoom;
  13751. for (t[0].object.visible = !0,
  13752. n = 1,
  13753. i = t.length; n < i && r >= t[n].distance; n++)
  13754. t[n - 1].object.visible = !1,
  13755. t[n].object.visible = !0;
  13756. for (this._currentLevel = n - 1; n < i; n++)
  13757. t[n].object.visible = !1
  13758. }
  13759. },
  13760. toJSON: function(e) {
  13761. var t = Si.prototype.toJSON.call(this, e);
  13762. !1 === this.autoUpdate && (t.object.autoUpdate = !1),
  13763. t.object.levels = [];
  13764. for (var n = this.levels, i = 0, r = n.length; i < r; i++) {
  13765. var a = n[i];
  13766. t.object.levels.push({
  13767. object: a.object.uuid,
  13768. distance: a.distance
  13769. })
  13770. }
  13771. return t
  13772. }
  13773. });
  13774. var Us = new Cn
  13775. , Gs = new Mn
  13776. , Hs = new Mn
  13777. , Vs = new Cn
  13778. , js = new ni;
  13779. function Ws(e, t) {
  13780. e && e.isGeometry && console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),
  13781. Hr.call(this, e, t),
  13782. this.type = "SkinnedMesh",
  13783. this.bindMode = "attached",
  13784. this.bindMatrix = new ni,
  13785. this.bindMatrixInverse = new ni
  13786. }
  13787. function Xs() {
  13788. Si.call(this),
  13789. this.type = "Bone"
  13790. }
  13791. Ws.prototype = Object.assign(Object.create(Hr.prototype), {
  13792. constructor: Ws,
  13793. isSkinnedMesh: !0,
  13794. copy: function(e) {
  13795. return Hr.prototype.copy.call(this, e),
  13796. this.bindMode = e.bindMode,
  13797. this.bindMatrix.copy(e.bindMatrix),
  13798. this.bindMatrixInverse.copy(e.bindMatrixInverse),
  13799. this.skeleton = e.skeleton,
  13800. this
  13801. },
  13802. bind: function(e, t) {
  13803. this.skeleton = e,
  13804. void 0 === t && (this.updateMatrixWorld(!0),
  13805. this.skeleton.calculateInverses(),
  13806. t = this.matrixWorld),
  13807. this.bindMatrix.copy(t),
  13808. this.bindMatrixInverse.copy(t).invert()
  13809. },
  13810. pose: function() {
  13811. this.skeleton.pose()
  13812. },
  13813. normalizeSkinWeights: function() {
  13814. for (var e = new Mn, t = this.geometry.attributes.skinWeight, n = 0, i = t.count; n < i; n++) {
  13815. e.x = t.getX(n),
  13816. e.y = t.getY(n),
  13817. e.z = t.getZ(n),
  13818. e.w = t.getW(n);
  13819. var r = 1 / e.manhattanLength();
  13820. r != 1 / 0 ? e.multiplyScalar(r) : e.set(1, 0, 0, 0),
  13821. t.setXYZW(n, e.x, e.y, e.z, e.w)
  13822. }
  13823. },
  13824. updateMatrixWorld: function(e) {
  13825. Hr.prototype.updateMatrixWorld.call(this, e),
  13826. "attached" === this.bindMode ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : "detached" === this.bindMode ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode)
  13827. },
  13828. boneTransform: function(e, t) {
  13829. var n = this.skeleton
  13830. , i = this.geometry;
  13831. Gs.fromBufferAttribute(i.attributes.skinIndex, e),
  13832. Hs.fromBufferAttribute(i.attributes.skinWeight, e),
  13833. Us.fromBufferAttribute(i.attributes.position, e).applyMatrix4(this.bindMatrix),
  13834. t.set(0, 0, 0);
  13835. for (var r = 0; r < 4; r++) {
  13836. var a, o = Hs.getComponent(r);
  13837. 0 !== o && (a = Gs.getComponent(r),
  13838. js.multiplyMatrices(n.bones[a].matrixWorld, n.boneInverses[a]),
  13839. t.addScaledVector(Vs.copy(Us).applyMatrix4(js), o))
  13840. }
  13841. return t.applyMatrix4(this.bindMatrixInverse)
  13842. }
  13843. }),
  13844. Xs.prototype = Object.assign(Object.create(Si.prototype), {
  13845. constructor: Xs,
  13846. isBone: !0
  13847. });
  13848. var qs = new ni
  13849. , Js = new ni;
  13850. function Ys() {
  13851. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  13852. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [];
  13853. this.uuid = gn.generateUUID(),
  13854. this.bones = e.slice(0),
  13855. this.boneInverses = t,
  13856. this.boneMatrices = null,
  13857. this.boneTexture = null,
  13858. this.boneTextureSize = 0,
  13859. this.frame = -1,
  13860. this.init()
  13861. }
  13862. Object.assign(Ys.prototype, {
  13863. init: function() {
  13864. var e = this.bones
  13865. , t = this.boneInverses;
  13866. if (this.boneMatrices = new Float32Array(16 * e.length),
  13867. 0 === t.length)
  13868. this.calculateInverses();
  13869. else if (e.length !== t.length) {
  13870. console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),
  13871. this.boneInverses = [];
  13872. for (var n = 0, i = this.bones.length; n < i; n++)
  13873. this.boneInverses.push(new ni)
  13874. }
  13875. },
  13876. calculateInverses: function() {
  13877. for (var e = this.boneInverses.length = 0, t = this.bones.length; e < t; e++) {
  13878. var n = new ni;
  13879. this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(),
  13880. this.boneInverses.push(n)
  13881. }
  13882. },
  13883. pose: function() {
  13884. for (var e = 0, t = this.bones.length; e < t; e++) {
  13885. var n = this.bones[e];
  13886. n && n.matrixWorld.copy(this.boneInverses[e]).invert()
  13887. }
  13888. for (var i = 0, r = this.bones.length; i < r; i++) {
  13889. var a = this.bones[i];
  13890. a && (a.parent && a.parent.isBone ? (a.matrix.copy(a.parent.matrixWorld).invert(),
  13891. a.matrix.multiply(a.matrixWorld)) : a.matrix.copy(a.matrixWorld),
  13892. a.matrix.decompose(a.position, a.quaternion, a.scale))
  13893. }
  13894. },
  13895. update: function() {
  13896. for (var e = this.bones, t = this.boneInverses, n = this.boneMatrices, i = this.boneTexture, r = 0, a = e.length; r < a; r++) {
  13897. var o = e[r] ? e[r].matrixWorld : Js;
  13898. qs.multiplyMatrices(o, t[r]),
  13899. qs.toArray(n, 16 * r)
  13900. }
  13901. null !== i && (i.needsUpdate = !0)
  13902. },
  13903. clone: function() {
  13904. return new Ys(this.bones,this.boneInverses)
  13905. },
  13906. getBoneByName: function(e) {
  13907. for (var t = 0, n = this.bones.length; t < n; t++) {
  13908. var i = this.bones[t];
  13909. if (i.name === e)
  13910. return i
  13911. }
  13912. },
  13913. dispose: function() {
  13914. null !== this.boneTexture && (this.boneTexture.dispose(),
  13915. this.boneTexture = null)
  13916. },
  13917. fromJSON: function(e, t) {
  13918. this.uuid = e.uuid;
  13919. for (var n = 0, i = e.bones.length; n < i; n++) {
  13920. var r = e.bones[n]
  13921. , a = t[r];
  13922. void 0 === a && (console.warn("THREE.Skeleton: No bone found with UUID:", r),
  13923. a = new Xs),
  13924. this.bones.push(a),
  13925. this.boneInverses.push((new ni).fromArray(e.boneInverses[n]))
  13926. }
  13927. return this.init(),
  13928. this
  13929. },
  13930. toJSON: function() {
  13931. var e = {
  13932. metadata: {
  13933. version: 4.5,
  13934. type: "Skeleton",
  13935. generator: "Skeleton.toJSON"
  13936. },
  13937. bones: [],
  13938. boneInverses: []
  13939. };
  13940. e.uuid = this.uuid;
  13941. for (var t = this.bones, n = this.boneInverses, i = 0, r = t.length; i < r; i++) {
  13942. var a = t[i];
  13943. e.bones.push(a.uuid);
  13944. a = n[i];
  13945. e.boneInverses.push(a.toArray())
  13946. }
  13947. return e
  13948. }
  13949. });
  13950. var Zs = new ni
  13951. , Qs = new ni
  13952. , Ks = []
  13953. , $s = new Hr;
  13954. function el(e, t, n) {
  13955. Hr.call(this, e, t),
  13956. this.instanceMatrix = new nr(new Float32Array(16 * n),16),
  13957. this.instanceColor = null,
  13958. this.count = n,
  13959. this.frustumCulled = !1
  13960. }
  13961. function tl(e) {
  13962. Ki.call(this),
  13963. this.type = "LineBasicMaterial",
  13964. this.color = new Yi(16777215),
  13965. this.lineWidth = 1,
  13966. this.linecap = "round",
  13967. this.linejoin = "round",
  13968. this.morphTargets = !1,
  13969. this.setValues(e)
  13970. }
  13971. el.prototype = Object.assign(Object.create(Hr.prototype), {
  13972. constructor: el,
  13973. isInstancedMesh: !0,
  13974. copy: function(e) {
  13975. return Hr.prototype.copy.call(this, e),
  13976. this.instanceMatrix.copy(e.instanceMatrix),
  13977. this.count = e.count,
  13978. this
  13979. },
  13980. getColorAt: function(e, t) {
  13981. t.fromArray(this.instanceColor.array, 3 * e)
  13982. },
  13983. getMatrixAt: function(e, t) {
  13984. t.fromArray(this.instanceMatrix.array, 16 * e)
  13985. },
  13986. raycast: function(e, t) {
  13987. var n = this.matrixWorld
  13988. , i = this.count;
  13989. if ($s.geometry = this.geometry,
  13990. $s.material = this.material,
  13991. void 0 !== $s.material)
  13992. for (var r = 0; r < i; r++) {
  13993. this.getMatrixAt(r, Zs),
  13994. Qs.multiplyMatrices(n, Zs),
  13995. $s.matrixWorld = Qs,
  13996. $s.raycast(e, Ks);
  13997. for (var a = 0, o = Ks.length; a < o; a++) {
  13998. var s = Ks[a];
  13999. s.instanceId = r,
  14000. s.object = this,
  14001. t.push(s)
  14002. }
  14003. Ks.length = 0
  14004. }
  14005. },
  14006. setColorAt: function(e, t) {
  14007. null === this.instanceColor && (this.instanceColor = new nr(new Float32Array(3 * this.count),3)),
  14008. t.toArray(this.instanceColor.array, 3 * e)
  14009. },
  14010. setMatrixAt: function(e, t) {
  14011. t.toArray(this.instanceMatrix.array, 16 * e)
  14012. },
  14013. updateMorphTargets: function() {},
  14014. dispose: function() {
  14015. this.dispatchEvent({
  14016. type: "dispose"
  14017. })
  14018. }
  14019. }),
  14020. ((tl.prototype = Object.create(Ki.prototype)).constructor = tl).prototype.isLineBasicMaterial = !0,
  14021. tl.prototype.copy = function(e) {
  14022. return Ki.prototype.copy.call(this, e),
  14023. this.color.copy(e.color),
  14024. this.lineWidth = e.lineWidth,
  14025. this.linecap = e.linecap,
  14026. this.linejoin = e.linejoin,
  14027. this.morphTargets = e.morphTargets,
  14028. this
  14029. }
  14030. ;
  14031. var nl = new Cn
  14032. , il = new Cn
  14033. , rl = new ni
  14034. , al = new ti
  14035. , ol = new qn;
  14036. function sl() {
  14037. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr
  14038. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new tl;
  14039. Si.call(this),
  14040. this.type = "Line",
  14041. this.geometry = e,
  14042. this.material = t,
  14043. this.updateMorphTargets()
  14044. }
  14045. sl.prototype = Object.assign(Object.create(Si.prototype), {
  14046. constructor: sl,
  14047. isLine: !0,
  14048. copy: function(e) {
  14049. return Si.prototype.copy.call(this, e),
  14050. this.material = e.material,
  14051. this.geometry = e.geometry,
  14052. this
  14053. },
  14054. computeLineDistances: function() {
  14055. var e = this.geometry;
  14056. if (e.isBufferGeometry)
  14057. if (null === e.index) {
  14058. for (var t = e.attributes.position, n = [0], i = 1, r = t.count; i < r; i++)
  14059. nl.fromBufferAttribute(t, i - 1),
  14060. il.fromBufferAttribute(t, i),
  14061. n[i] = n[i - 1],
  14062. n[i] += nl.distanceTo(il);
  14063. e.setAttribute("lineDistance", new dr(n,1))
  14064. } else
  14065. console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
  14066. else if (e.isGeometry) {
  14067. var a = e.vertices
  14068. , o = e.lineDistances;
  14069. o[0] = 0;
  14070. for (var s = 1, l = a.length; s < l; s++)
  14071. o[s] = o[s - 1],
  14072. o[s] += a[s - 1].distanceTo(a[s])
  14073. }
  14074. return this
  14075. },
  14076. raycast: function(e, t) {
  14077. var n = this.geometry
  14078. , i = this.matrixWorld
  14079. , r = e.params.Line.threshold;
  14080. if (null === n.boundingSphere && n.computeBoundingSphere(),
  14081. ol.copy(n.boundingSphere),
  14082. ol.applyMatrix4(i),
  14083. ol.radius += r,
  14084. !1 !== e.ray.intersectsSphere(ol)) {
  14085. rl.copy(i).invert(),
  14086. al.copy(e.ray).applyMatrix4(rl);
  14087. var r = r / ((this.scale.x + this.scale.y + this.scale.z) / 3)
  14088. , a = r * r
  14089. , o = new Cn
  14090. , s = new Cn
  14091. , l = new Cn
  14092. , u = new Cn
  14093. , c = this.isLineSegments ? 2 : 1;
  14094. if (n.isBufferGeometry) {
  14095. var r = n.index
  14096. , d = n.attributes.position;
  14097. if (null !== r)
  14098. for (var h = r.array, p = 0, f = h.length - 1; p < f; p += c) {
  14099. var m = h[p]
  14100. , v = h[p + 1];
  14101. o.fromBufferAttribute(d, m),
  14102. s.fromBufferAttribute(d, v),
  14103. a < al.distanceSqToSegment(o, s, u, l) || (u.applyMatrix4(this.matrixWorld),
  14104. (v = e.ray.origin.distanceTo(u)) < e.near || v > e.far || t.push({
  14105. distance: v,
  14106. point: l.clone().applyMatrix4(this.matrixWorld),
  14107. index: p,
  14108. face: null,
  14109. faceIndex: null,
  14110. object: this
  14111. }))
  14112. }
  14113. else
  14114. for (var g, y = 0, w = d.count - 1; y < w; y += c)
  14115. o.fromBufferAttribute(d, y),
  14116. s.fromBufferAttribute(d, y + 1),
  14117. a < al.distanceSqToSegment(o, s, u, l) || (u.applyMatrix4(this.matrixWorld),
  14118. (g = e.ray.origin.distanceTo(u)) < e.near || g > e.far || t.push({
  14119. distance: g,
  14120. point: l.clone().applyMatrix4(this.matrixWorld),
  14121. index: y,
  14122. face: null,
  14123. faceIndex: null,
  14124. object: this
  14125. }))
  14126. } else if (n.isGeometry)
  14127. for (var b, x = n.vertices, E = x.length, _ = 0; _ < E - 1; _ += c)
  14128. a < al.distanceSqToSegment(x[_], x[_ + 1], u, l) || (u.applyMatrix4(this.matrixWorld),
  14129. (b = e.ray.origin.distanceTo(u)) < e.near || b > e.far || t.push({
  14130. distance: b,
  14131. point: l.clone().applyMatrix4(this.matrixWorld),
  14132. index: _,
  14133. face: null,
  14134. faceIndex: null,
  14135. object: this
  14136. }))
  14137. }
  14138. },
  14139. updateMorphTargets: function() {
  14140. var e = this.geometry;
  14141. if (e.isBufferGeometry) {
  14142. var t = e.morphAttributes
  14143. , n = Object.keys(t);
  14144. if (0 < n.length) {
  14145. var i = t[n[0]];
  14146. if (void 0 !== i) {
  14147. this.morphTargetInfluences = [],
  14148. this.morphTargetDictionary = {};
  14149. for (var r = 0, a = i.length; r < a; r++) {
  14150. var o = i[r].name || String(r);
  14151. this.morphTargetInfluences.push(0),
  14152. this.morphTargetDictionary[o] = r
  14153. }
  14154. }
  14155. }
  14156. } else {
  14157. e = e.morphTargets;
  14158. void 0 !== e && 0 < e.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")
  14159. }
  14160. }
  14161. });
  14162. var ll = new Cn
  14163. , ul = new Cn;
  14164. function cl(e, t) {
  14165. sl.call(this, e, t),
  14166. this.type = "LineSegments"
  14167. }
  14168. function dl(e, t) {
  14169. sl.call(this, e, t),
  14170. this.type = "LineLoop"
  14171. }
  14172. function hl(e) {
  14173. Ki.call(this),
  14174. this.type = "PointsMaterial",
  14175. this.color = new Yi(16777215),
  14176. this.map = null,
  14177. this.alphaMap = null,
  14178. this.size = 1,
  14179. this.sizeAttenuation = !0,
  14180. this.morphTargets = !1,
  14181. this.setValues(e)
  14182. }
  14183. cl.prototype = Object.assign(Object.create(sl.prototype), {
  14184. constructor: cl,
  14185. isLineSegments: !0,
  14186. computeLineDistances: function() {
  14187. var e = this.geometry;
  14188. if (e.isBufferGeometry)
  14189. if (null === e.index) {
  14190. for (var t = e.attributes.position, n = [], i = 0, r = t.count; i < r; i += 2)
  14191. ll.fromBufferAttribute(t, i),
  14192. ul.fromBufferAttribute(t, i + 1),
  14193. n[i] = 0 === i ? 0 : n[i - 1],
  14194. n[i + 1] = n[i] + ll.distanceTo(ul);
  14195. e.setAttribute("lineDistance", new dr(n,1))
  14196. } else
  14197. console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
  14198. else if (e.isGeometry)
  14199. for (var a = e.vertices, o = e.lineDistances, s = 0, l = a.length; s < l; s += 2)
  14200. ll.copy(a[s]),
  14201. ul.copy(a[s + 1]),
  14202. o[s] = 0 === s ? 0 : o[s - 1],
  14203. o[s + 1] = o[s] + ll.distanceTo(ul);
  14204. return this
  14205. }
  14206. }),
  14207. dl.prototype = Object.assign(Object.create(sl.prototype), {
  14208. constructor: dl,
  14209. isLineLoop: !0
  14210. }),
  14211. ((hl.prototype = Object.create(Ki.prototype)).constructor = hl).prototype.isPointsMaterial = !0,
  14212. hl.prototype.copy = function(e) {
  14213. return Ki.prototype.copy.call(this, e),
  14214. this.color.copy(e.color),
  14215. this.map = e.map,
  14216. this.alphaMap = e.alphaMap,
  14217. this.size = e.size,
  14218. this.sizeAttenuation = e.sizeAttenuation,
  14219. this.morphTargets = e.morphTargets,
  14220. this
  14221. }
  14222. ;
  14223. var pl = new ni
  14224. , fl = new ti
  14225. , ml = new qn
  14226. , vl = new Cn;
  14227. function gl() {
  14228. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr
  14229. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new hl;
  14230. Si.call(this),
  14231. this.type = "Points",
  14232. this.geometry = e,
  14233. this.material = t,
  14234. this.updateMorphTargets()
  14235. }
  14236. function yl(e, t, n, i, r, a, o) {
  14237. var s = fl.distanceSqToPoint(e);
  14238. s < n && (n = new Cn,
  14239. fl.closestPointToPoint(e, n),
  14240. n.applyMatrix4(i),
  14241. (i = r.ray.origin.distanceTo(n)) < r.near || i > r.far || a.push({
  14242. distance: i,
  14243. distanceToRay: Math.sqrt(s),
  14244. point: n,
  14245. index: t,
  14246. face: null,
  14247. object: o
  14248. }))
  14249. }
  14250. function wl(t, e, n, i, r, a, o, s, l) {
  14251. En.call(this, t, e, n, i, r, a, o, s, l),
  14252. this.format = void 0 !== o ? o : $e,
  14253. this.minFilter = void 0 !== a ? a : Oe,
  14254. this.magFilter = void 0 !== r ? r : Oe,
  14255. this.generateMipmaps = !1;
  14256. var u = this;
  14257. "requestVideoFrameCallback"in t && t.requestVideoFrameCallback(function e() {
  14258. u.needsUpdate = !0,
  14259. t.requestVideoFrameCallback(e)
  14260. })
  14261. }
  14262. function bl(e, t, n, i, r, a, o, s, l, u, c, d) {
  14263. En.call(this, null, a, o, s, l, u, i, r, c, d),
  14264. this.image = {
  14265. width: t,
  14266. height: n
  14267. },
  14268. this.mipmaps = e,
  14269. this.flipY = !1,
  14270. this.generateMipmaps = !1
  14271. }
  14272. function xl(e, t, n, i, r, a, o, s, l) {
  14273. En.call(this, e, t, n, i, r, a, o, s, l),
  14274. this.needsUpdate = !0
  14275. }
  14276. function El(e, t, n, i, r, a, o, s, l, u) {
  14277. if ((u = void 0 !== u ? u : rt) !== rt && u !== at)
  14278. throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
  14279. En.call(this, null, i, r, a, o, s, u, n = void 0 === (n = void 0 === n && u === rt ? Ve : n) && u === at ? Qe : n, l),
  14280. this.image = {
  14281. width: e,
  14282. height: t
  14283. },
  14284. this.magFilter = void 0 !== o ? o : Re,
  14285. this.minFilter = void 0 !== s ? s : Re,
  14286. this.flipY = !1,
  14287. this.generateMipmaps = !1
  14288. }
  14289. gl.prototype = Object.assign(Object.create(Si.prototype), {
  14290. constructor: gl,
  14291. isPoints: !0,
  14292. copy: function(e) {
  14293. return Si.prototype.copy.call(this, e),
  14294. this.material = e.material,
  14295. this.geometry = e.geometry,
  14296. this
  14297. },
  14298. raycast: function(e, t) {
  14299. var n = this.geometry
  14300. , i = this.matrixWorld
  14301. , r = e.params.Points.threshold;
  14302. if (null === n.boundingSphere && n.computeBoundingSphere(),
  14303. ml.copy(n.boundingSphere),
  14304. ml.applyMatrix4(i),
  14305. ml.radius += r,
  14306. !1 !== e.ray.intersectsSphere(ml)) {
  14307. pl.copy(i).invert(),
  14308. fl.copy(e.ray).applyMatrix4(pl);
  14309. var r = r / ((this.scale.x + this.scale.y + this.scale.z) / 3)
  14310. , a = r * r;
  14311. if (n.isBufferGeometry) {
  14312. var r = n.index
  14313. , o = n.attributes.position;
  14314. if (null !== r)
  14315. for (var s = r.array, l = 0, u = s.length; l < u; l++) {
  14316. var c = s[l];
  14317. vl.fromBufferAttribute(o, c),
  14318. yl(vl, c, a, i, e, t, this)
  14319. }
  14320. else
  14321. for (var d = 0, h = o.count; d < h; d++)
  14322. vl.fromBufferAttribute(o, d),
  14323. yl(vl, d, a, i, e, t, this)
  14324. } else
  14325. for (var p = n.vertices, f = 0, m = p.length; f < m; f++)
  14326. yl(p[f], f, a, i, e, t, this)
  14327. }
  14328. },
  14329. updateMorphTargets: function() {
  14330. var e = this.geometry;
  14331. if (e.isBufferGeometry) {
  14332. var t = e.morphAttributes
  14333. , n = Object.keys(t);
  14334. if (0 < n.length) {
  14335. var i = t[n[0]];
  14336. if (void 0 !== i) {
  14337. this.morphTargetInfluences = [],
  14338. this.morphTargetDictionary = {};
  14339. for (var r = 0, a = i.length; r < a; r++) {
  14340. var o = i[r].name || String(r);
  14341. this.morphTargetInfluences.push(0),
  14342. this.morphTargetDictionary[o] = r
  14343. }
  14344. }
  14345. }
  14346. } else {
  14347. e = e.morphTargets;
  14348. void 0 !== e && 0 < e.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")
  14349. }
  14350. }
  14351. }),
  14352. wl.prototype = Object.assign(Object.create(En.prototype), {
  14353. constructor: wl,
  14354. clone: function() {
  14355. return new this.constructor(this.image).copy(this)
  14356. },
  14357. isVideoTexture: !0,
  14358. update: function() {
  14359. var e = this.image;
  14360. !1 == "requestVideoFrameCallback"in e && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0)
  14361. }
  14362. }),
  14363. ((bl.prototype = Object.create(En.prototype)).constructor = bl).prototype.isCompressedTexture = !0,
  14364. ((xl.prototype = Object.create(En.prototype)).constructor = xl).prototype.isCanvasTexture = !0,
  14365. ((El.prototype = Object.create(En.prototype)).constructor = El).prototype.isDepthTexture = !0;
  14366. var _l = 0
  14367. , Ml = new ni
  14368. , Al = new Si
  14369. , Tl = new Cn;
  14370. function Sl() {
  14371. Object.defineProperty(this, "id", {
  14372. value: _l += 2
  14373. }),
  14374. this.uuid = gn.generateUUID(),
  14375. this.name = "",
  14376. this.type = "Geometry",
  14377. this.vertices = [],
  14378. this.colors = [],
  14379. this.faces = [],
  14380. this.faceVertexUvs = [[]],
  14381. this.morphTargets = [],
  14382. this.morphNormals = [],
  14383. this.skinWeights = [],
  14384. this.skinIndices = [],
  14385. this.lineDistances = [],
  14386. this.boundingBox = null,
  14387. this.boundingSphere = null,
  14388. this.elementsNeedUpdate = !1,
  14389. this.verticesNeedUpdate = !1,
  14390. this.uvsNeedUpdate = !1,
  14391. this.normalsNeedUpdate = !1,
  14392. this.colorsNeedUpdate = !1,
  14393. this.lineDistancesNeedUpdate = !1,
  14394. this.groupsNeedUpdate = !1
  14395. }
  14396. Sl.prototype = Object.assign(Object.create(hn.prototype), {
  14397. constructor: Sl,
  14398. isGeometry: !0,
  14399. applyMatrix4: function(e) {
  14400. for (var t = (new wn).getNormalMatrix(e), n = 0, i = this.vertices.length; n < i; n++)
  14401. this.vertices[n].applyMatrix4(e);
  14402. for (var r = 0, a = this.faces.length; r < a; r++) {
  14403. var o = this.faces[r];
  14404. o.normal.applyMatrix3(t).normalize();
  14405. for (var s = 0, l = o.vertexNormals.length; s < l; s++)
  14406. o.vertexNormals[s].applyMatrix3(t).normalize()
  14407. }
  14408. return null !== this.boundingBox && this.computeBoundingBox(),
  14409. null !== this.boundingSphere && this.computeBoundingSphere(),
  14410. this.verticesNeedUpdate = !0,
  14411. this.normalsNeedUpdate = !0,
  14412. this
  14413. },
  14414. rotateX: function(e) {
  14415. return Ml.makeRotationX(e),
  14416. this.applyMatrix4(Ml),
  14417. this
  14418. },
  14419. rotateY: function(e) {
  14420. return Ml.makeRotationY(e),
  14421. this.applyMatrix4(Ml),
  14422. this
  14423. },
  14424. rotateZ: function(e) {
  14425. return Ml.makeRotationZ(e),
  14426. this.applyMatrix4(Ml),
  14427. this
  14428. },
  14429. translate: function(e, t, n) {
  14430. return Ml.makeTranslation(e, t, n),
  14431. this.applyMatrix4(Ml),
  14432. this
  14433. },
  14434. scale: function(e, t, n) {
  14435. return Ml.makeScale(e, t, n),
  14436. this.applyMatrix4(Ml),
  14437. this
  14438. },
  14439. lookAt: function(e) {
  14440. return Al.lookAt(e),
  14441. Al.updateMatrix(),
  14442. this.applyMatrix4(Al.matrix),
  14443. this
  14444. },
  14445. fromBufferGeometry: function(e) {
  14446. var o = this
  14447. , t = null !== e.index ? e.index : void 0
  14448. , n = e.attributes;
  14449. if (void 0 === n.position)
  14450. return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),
  14451. this;
  14452. var i = n.position
  14453. , s = n.normal
  14454. , l = n.color
  14455. , u = n.uv
  14456. , c = n.uv2;
  14457. void 0 !== c && (this.faceVertexUvs[1] = []);
  14458. for (var r = 0; r < i.count; r++)
  14459. o.vertices.push((new Cn).fromBufferAttribute(i, r)),
  14460. void 0 !== l && o.colors.push((new Yi).fromBufferAttribute(l, r));
  14461. function a(e, t, n, i) {
  14462. var r = void 0 === l ? [] : [o.colors[e].clone(), o.colors[t].clone(), o.colors[n].clone()]
  14463. , a = void 0 === s ? [] : [(new Cn).fromBufferAttribute(s, e), (new Cn).fromBufferAttribute(s, t), (new Cn).fromBufferAttribute(s, n)]
  14464. , i = new Zi(e,t,n,a,r,i);
  14465. o.faces.push(i),
  14466. void 0 !== u && o.faceVertexUvs[0].push([(new yn).fromBufferAttribute(u, e), (new yn).fromBufferAttribute(u, t), (new yn).fromBufferAttribute(u, n)]),
  14467. void 0 !== c && o.faceVertexUvs[1].push([(new yn).fromBufferAttribute(c, e), (new yn).fromBufferAttribute(c, t), (new yn).fromBufferAttribute(c, n)])
  14468. }
  14469. var d = e.groups;
  14470. if (0 < d.length)
  14471. for (var h = 0; h < d.length; h++)
  14472. for (var p = d[h], f = p.start, m = f, v = f + p.count; m < v; m += 3)
  14473. void 0 !== t ? a(t.getX(m), t.getX(m + 1), t.getX(m + 2), p.materialIndex) : a(m, m + 1, m + 2, p.materialIndex);
  14474. else if (void 0 !== t)
  14475. for (var g = 0; g < t.count; g += 3)
  14476. a(t.getX(g), t.getX(g + 1), t.getX(g + 2));
  14477. else
  14478. for (var y = 0; y < i.count; y += 3)
  14479. a(y, y + 1, y + 2);
  14480. return this.computeFaceNormals(),
  14481. null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()),
  14482. null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
  14483. this
  14484. },
  14485. center: function() {
  14486. return this.computeBoundingBox(),
  14487. this.boundingBox.getCenter(Tl).negate(),
  14488. this.translate(Tl.x, Tl.y, Tl.z),
  14489. this
  14490. },
  14491. normalize: function() {
  14492. this.computeBoundingSphere();
  14493. var e = this.boundingSphere.center
  14494. , t = this.boundingSphere.radius
  14495. , n = 0 === t ? 1 : 1 / t
  14496. , t = new ni;
  14497. return t.set(n, 0, 0, -n * e.x, 0, n, 0, -n * e.y, 0, 0, n, -n * e.z, 0, 0, 0, 1),
  14498. this.applyMatrix4(t),
  14499. this
  14500. },
  14501. computeFaceNormals: function() {
  14502. for (var e = new Cn, t = new Cn, n = 0, i = this.faces.length; n < i; n++) {
  14503. var r = this.faces[n]
  14504. , a = this.vertices[r.a]
  14505. , o = this.vertices[r.b]
  14506. , s = this.vertices[r.c];
  14507. e.subVectors(s, o),
  14508. t.subVectors(a, o),
  14509. e.cross(t),
  14510. e.normalize(),
  14511. r.normal.copy(e)
  14512. }
  14513. },
  14514. computeVertexNormals: function() {
  14515. for (var e = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], t = new Array(this.vertices.length), n = 0, i = this.vertices.length; n < i; n++)
  14516. t[n] = new Cn;
  14517. if (e)
  14518. for (var r = new Cn, a = new Cn, o = 0, s = this.faces.length; o < s; o++) {
  14519. var l = this.faces[o]
  14520. , u = this.vertices[l.a]
  14521. , c = this.vertices[l.b]
  14522. , d = this.vertices[l.c];
  14523. r.subVectors(d, c),
  14524. a.subVectors(u, c),
  14525. r.cross(a),
  14526. t[l.a].add(r),
  14527. t[l.b].add(r),
  14528. t[l.c].add(r)
  14529. }
  14530. else {
  14531. this.computeFaceNormals();
  14532. for (var h = 0, p = this.faces.length; h < p; h++) {
  14533. var f = this.faces[h];
  14534. t[f.a].add(f.normal),
  14535. t[f.b].add(f.normal),
  14536. t[f.c].add(f.normal)
  14537. }
  14538. }
  14539. for (var m = 0, v = this.vertices.length; m < v; m++)
  14540. t[m].normalize();
  14541. for (var g = 0, y = this.faces.length; g < y; g++) {
  14542. var w = this.faces[g]
  14543. , b = w.vertexNormals;
  14544. 3 === b.length ? (b[0].copy(t[w.a]),
  14545. b[1].copy(t[w.b]),
  14546. b[2].copy(t[w.c])) : (b[0] = t[w.a].clone(),
  14547. b[1] = t[w.b].clone(),
  14548. b[2] = t[w.c].clone())
  14549. }
  14550. 0 < this.faces.length && (this.normalsNeedUpdate = !0)
  14551. },
  14552. computeFlatVertexNormals: function() {
  14553. this.computeFaceNormals();
  14554. for (var e = 0, t = this.faces.length; e < t; e++) {
  14555. var n = this.faces[e]
  14556. , i = n.vertexNormals;
  14557. 3 === i.length ? (i[0].copy(n.normal),
  14558. i[1].copy(n.normal),
  14559. i[2].copy(n.normal)) : (i[0] = n.normal.clone(),
  14560. i[1] = n.normal.clone(),
  14561. i[2] = n.normal.clone())
  14562. }
  14563. 0 < this.faces.length && (this.normalsNeedUpdate = !0)
  14564. },
  14565. computeMorphNormals: function() {
  14566. for (var e = 0, t = this.faces.length; e < t; e++) {
  14567. var n = this.faces[e];
  14568. n.__originalFaceNormal ? n.__originalFaceNormal.copy(n.normal) : n.__originalFaceNormal = n.normal.clone(),
  14569. n.__originalVertexNormals || (n.__originalVertexNormals = []);
  14570. for (var i = 0, r = n.vertexNormals.length; i < r; i++)
  14571. n.__originalVertexNormals[i] ? n.__originalVertexNormals[i].copy(n.vertexNormals[i]) : n.__originalVertexNormals[i] = n.vertexNormals[i].clone()
  14572. }
  14573. var a = new Sl;
  14574. a.faces = this.faces;
  14575. for (var o = 0, s = this.morphTargets.length; o < s; o++) {
  14576. if (!this.morphNormals[o]) {
  14577. this.morphNormals[o] = {},
  14578. this.morphNormals[o].faceNormals = [],
  14579. this.morphNormals[o].vertexNormals = [];
  14580. for (var l = this.morphNormals[o].faceNormals, u = this.morphNormals[o].vertexNormals, c = 0, d = this.faces.length; c < d; c++) {
  14581. var h = new Cn
  14582. , p = {
  14583. a: new Cn,
  14584. b: new Cn,
  14585. c: new Cn
  14586. };
  14587. l.push(h),
  14588. u.push(p)
  14589. }
  14590. }
  14591. var f = this.morphNormals[o];
  14592. a.vertices = this.morphTargets[o].vertices,
  14593. a.computeFaceNormals(),
  14594. a.computeVertexNormals();
  14595. for (var m = 0, v = this.faces.length; m < v; m++) {
  14596. var g = this.faces[m]
  14597. , y = f.faceNormals[m]
  14598. , w = f.vertexNormals[m];
  14599. y.copy(g.normal),
  14600. w.a.copy(g.vertexNormals[0]),
  14601. w.b.copy(g.vertexNormals[1]),
  14602. w.c.copy(g.vertexNormals[2])
  14603. }
  14604. }
  14605. for (var b = 0, x = this.faces.length; b < x; b++) {
  14606. var E = this.faces[b];
  14607. E.normal = E.__originalFaceNormal,
  14608. E.vertexNormals = E.__originalVertexNormals
  14609. }
  14610. },
  14611. computeBoundingBox: function() {
  14612. null === this.boundingBox && (this.boundingBox = new kn),
  14613. this.boundingBox.setFromPoints(this.vertices)
  14614. },
  14615. computeBoundingSphere: function() {
  14616. null === this.boundingSphere && (this.boundingSphere = new qn),
  14617. this.boundingSphere.setFromPoints(this.vertices)
  14618. },
  14619. merge: function(e, t) {
  14620. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0;
  14621. if (e && e.isGeometry) {
  14622. var i, r = this.vertices.length, a = this.vertices, o = e.vertices, s = this.faces, l = e.faces, u = this.colors, c = e.colors;
  14623. void 0 !== t && (i = (new wn).getNormalMatrix(t));
  14624. for (var d = 0, h = o.length; d < h; d++) {
  14625. var p = o[d].clone();
  14626. void 0 !== t && p.applyMatrix4(t),
  14627. a.push(p)
  14628. }
  14629. for (var f = 0, m = c.length; f < m; f++)
  14630. u.push(c[f].clone());
  14631. for (var v = 0, g = l.length; v < g; v++) {
  14632. var y = l[v]
  14633. , w = void 0
  14634. , b = void 0
  14635. , x = y.vertexNormals
  14636. , E = y.vertexColors
  14637. , _ = new Zi(y.a + r,y.b + r,y.c + r);
  14638. _.normal.copy(y.normal),
  14639. void 0 !== i && _.normal.applyMatrix3(i).normalize();
  14640. for (var M = 0, A = x.length; M < A; M++)
  14641. w = x[M].clone(),
  14642. void 0 !== i && w.applyMatrix3(i).normalize(),
  14643. _.vertexNormals.push(w);
  14644. _.color.copy(y.color);
  14645. for (var T = 0, S = E.length; T < S; T++)
  14646. b = E[T],
  14647. _.vertexColors.push(b.clone());
  14648. _.materialIndex = y.materialIndex + n,
  14649. s.push(_)
  14650. }
  14651. for (var C = 0, P = e.faceVertexUvs.length; C < P; C++) {
  14652. var D = e.faceVertexUvs[C];
  14653. void 0 === this.faceVertexUvs[C] && (this.faceVertexUvs[C] = []);
  14654. for (var k = 0, B = D.length; k < B; k++) {
  14655. for (var L = D[k], R = [], F = 0, I = L.length; F < I; F++)
  14656. R.push(L[F].clone());
  14657. this.faceVertexUvs[C].push(R)
  14658. }
  14659. }
  14660. } else
  14661. console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", e)
  14662. },
  14663. mergeMesh: function(e) {
  14664. e && e.isMesh ? (e.matrixAutoUpdate && e.updateMatrix(),
  14665. this.merge(e.geometry, e.matrix)) : console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", e)
  14666. },
  14667. mergeVertices: function() {
  14668. for (var e = {}, t = [], n = [], i = Math.pow(10, 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 4), r = 0, a = this.vertices.length; r < a; r++) {
  14669. var o = this.vertices[r]
  14670. , o = Math.round(o.x * i) + "_" + Math.round(o.y * i) + "_" + Math.round(o.z * i);
  14671. void 0 === e[o] ? (e[o] = r,
  14672. t.push(this.vertices[r]),
  14673. n[r] = t.length - 1) : n[r] = n[e[o]]
  14674. }
  14675. for (var s = [], l = 0, u = this.faces.length; l < u; l++) {
  14676. var c = this.faces[l];
  14677. c.a = n[c.a],
  14678. c.b = n[c.b],
  14679. c.c = n[c.c];
  14680. for (var d = [c.a, c.b, c.c], h = 0; h < 3; h++)
  14681. if (d[h] === d[(h + 1) % 3]) {
  14682. s.push(l);
  14683. break
  14684. }
  14685. }
  14686. for (var p = s.length - 1; 0 <= p; p--) {
  14687. var f = s[p];
  14688. this.faces.splice(f, 1);
  14689. for (var m = 0, v = this.faceVertexUvs.length; m < v; m++)
  14690. this.faceVertexUvs[m].splice(f, 1)
  14691. }
  14692. var g = this.vertices.length - t.length;
  14693. return this.vertices = t,
  14694. g
  14695. },
  14696. setFromPoints: function(e) {
  14697. this.vertices = [];
  14698. for (var t = 0, n = e.length; t < n; t++) {
  14699. var i = e[t];
  14700. this.vertices.push(new Cn(i.x,i.y,i.z || 0))
  14701. }
  14702. return this
  14703. },
  14704. sortFacesByMaterialIndex: function() {
  14705. for (var e = this.faces, t = e.length, n = 0; n < t; n++)
  14706. e[n]._id = n;
  14707. e.sort(function(e, t) {
  14708. return e.materialIndex - t.materialIndex
  14709. });
  14710. var i, r, a = this.faceVertexUvs[0], o = this.faceVertexUvs[1];
  14711. a && a.length === t && (i = []),
  14712. o && o.length === t && (r = []);
  14713. for (var s = 0; s < t; s++) {
  14714. var l = e[s]._id;
  14715. i && i.push(a[l]),
  14716. r && r.push(o[l])
  14717. }
  14718. i && (this.faceVertexUvs[0] = i),
  14719. r && (this.faceVertexUvs[1] = r)
  14720. },
  14721. toJSON: function() {
  14722. var e = {
  14723. metadata: {
  14724. version: 4.5,
  14725. type: "Geometry",
  14726. generator: "Geometry.toJSON"
  14727. }
  14728. };
  14729. if (e.uuid = this.uuid,
  14730. e.type = this.type,
  14731. "" !== this.name && (e.name = this.name),
  14732. void 0 !== this.parameters) {
  14733. var t, n = this.parameters;
  14734. for (t in n)
  14735. void 0 !== n[t] && (e[t] = n[t]);
  14736. return e
  14737. }
  14738. for (var i = [], r = 0; r < this.vertices.length; r++) {
  14739. var a = this.vertices[r];
  14740. i.push(a.x, a.y, a.z)
  14741. }
  14742. for (var o = [], s = [], l = {}, u = [], c = {}, d = [], h = {}, p = 0; p < this.faces.length; p++) {
  14743. var f, m = this.faces[p], v = void 0 !== this.faceVertexUvs[0][p], g = 0 < m.normal.length(), y = 0 < m.vertexNormals.length, w = 1 !== m.color.r || 1 !== m.color.g || 1 !== m.color.b, b = 0 < m.vertexColors.length;
  14744. f = x(2, 3, v),
  14745. f = x(f, 4, g),
  14746. f = x(f, 5, y),
  14747. f = x(f, 6, w),
  14748. f = x(f, 7, b),
  14749. o.push(f),
  14750. o.push(m.a, m.b, m.c),
  14751. o.push(m.materialIndex),
  14752. v && (v = this.faceVertexUvs[0][p],
  14753. o.push(M(v[0]), M(v[1]), M(v[2]))),
  14754. g && o.push(E(m.normal)),
  14755. y && (y = m.vertexNormals,
  14756. o.push(E(y[0]), E(y[1]), E(y[2]))),
  14757. w && o.push(_(m.color)),
  14758. b && (m = m.vertexColors,
  14759. o.push(_(m[0]), _(m[1]), _(m[2])))
  14760. }
  14761. function x(e, t, n) {
  14762. return n ? e | 1 << t : e & ~(1 << t)
  14763. }
  14764. function E(e) {
  14765. var t = e.x.toString() + e.y.toString() + e.z.toString();
  14766. return void 0 !== l[t] || (l[t] = s.length / 3,
  14767. s.push(e.x, e.y, e.z)),
  14768. l[t]
  14769. }
  14770. function _(e) {
  14771. var t = e.r.toString() + e.g.toString() + e.b.toString();
  14772. return void 0 !== c[t] || (c[t] = u.length,
  14773. u.push(e.getHex())),
  14774. c[t]
  14775. }
  14776. function M(e) {
  14777. var t = e.x.toString() + e.y.toString();
  14778. return void 0 !== h[t] || (h[t] = d.length / 2,
  14779. d.push(e.x, e.y)),
  14780. h[t]
  14781. }
  14782. return e.data = {},
  14783. e.data.vertices = i,
  14784. e.data.normals = s,
  14785. 0 < u.length && (e.data.colors = u),
  14786. 0 < d.length && (e.data.uvs = [d]),
  14787. e.data.faces = o,
  14788. e
  14789. },
  14790. clone: function() {
  14791. return (new Sl).copy(this)
  14792. },
  14793. copy: function(e) {
  14794. this.vertices = [],
  14795. this.colors = [],
  14796. this.faces = [],
  14797. this.faceVertexUvs = [[]],
  14798. this.morphTargets = [],
  14799. this.morphNormals = [],
  14800. this.skinWeights = [],
  14801. this.skinIndices = [],
  14802. this.lineDistances = [],
  14803. this.boundingBox = null,
  14804. this.boundingSphere = null,
  14805. this.name = e.name;
  14806. for (var t = e.vertices, n = 0, i = t.length; n < i; n++)
  14807. this.vertices.push(t[n].clone());
  14808. for (var r = e.colors, a = 0, o = r.length; a < o; a++)
  14809. this.colors.push(r[a].clone());
  14810. for (var s = e.faces, l = 0, u = s.length; l < u; l++)
  14811. this.faces.push(s[l].clone());
  14812. for (var c = 0, d = e.faceVertexUvs.length; c < d; c++) {
  14813. var h = e.faceVertexUvs[c];
  14814. void 0 === this.faceVertexUvs[c] && (this.faceVertexUvs[c] = []);
  14815. for (var p = 0, f = h.length; p < f; p++) {
  14816. for (var m = h[p], v = [], g = 0, y = m.length; g < y; g++) {
  14817. var w = m[g];
  14818. v.push(w.clone())
  14819. }
  14820. this.faceVertexUvs[c].push(v)
  14821. }
  14822. }
  14823. for (var b = e.morphTargets, x = 0, E = b.length; x < E; x++) {
  14824. var _ = {};
  14825. if (_.name = b[x].name,
  14826. void 0 !== b[x].vertices) {
  14827. _.vertices = [];
  14828. for (var M = 0, A = b[x].vertices.length; M < A; M++)
  14829. _.vertices.push(b[x].vertices[M].clone())
  14830. }
  14831. if (void 0 !== b[x].normals) {
  14832. _.normals = [];
  14833. for (var T = 0, S = b[x].normals.length; T < S; T++)
  14834. _.normals.push(b[x].normals[T].clone())
  14835. }
  14836. this.morphTargets.push(_)
  14837. }
  14838. for (var C = e.morphNormals, P = 0, D = C.length; P < D; P++) {
  14839. var k = {};
  14840. if (void 0 !== C[P].vertexNormals) {
  14841. k.vertexNormals = [];
  14842. for (var B = 0, L = C[P].vertexNormals.length; B < L; B++) {
  14843. var R = C[P].vertexNormals[B]
  14844. , F = {};
  14845. F.a = R.a.clone(),
  14846. F.b = R.b.clone(),
  14847. F.c = R.c.clone(),
  14848. k.vertexNormals.push(F)
  14849. }
  14850. }
  14851. if (void 0 !== C[P].faceNormals) {
  14852. k.faceNormals = [];
  14853. for (var I = 0, O = C[P].faceNormals.length; I < O; I++)
  14854. k.faceNormals.push(C[P].faceNormals[I].clone())
  14855. }
  14856. this.morphNormals.push(k)
  14857. }
  14858. for (var z = e.skinWeights, N = 0, U = z.length; N < U; N++)
  14859. this.skinWeights.push(z[N].clone());
  14860. for (var G = e.skinIndices, H = 0, V = G.length; H < V; H++)
  14861. this.skinIndices.push(G[H].clone());
  14862. for (var j = e.lineDistances, W = 0, X = j.length; W < X; W++)
  14863. this.lineDistances.push(j[W]);
  14864. var q = e.boundingBox;
  14865. null !== q && (this.boundingBox = q.clone());
  14866. q = e.boundingSphere;
  14867. return null !== q && (this.boundingSphere = q.clone()),
  14868. this.elementsNeedUpdate = e.elementsNeedUpdate,
  14869. this.verticesNeedUpdate = e.verticesNeedUpdate,
  14870. this.uvsNeedUpdate = e.uvsNeedUpdate,
  14871. this.normalsNeedUpdate = e.normalsNeedUpdate,
  14872. this.colorsNeedUpdate = e.colorsNeedUpdate,
  14873. this.lineDistancesNeedUpdate = e.lineDistancesNeedUpdate,
  14874. this.groupsNeedUpdate = e.groupsNeedUpdate,
  14875. this
  14876. },
  14877. dispose: function() {
  14878. this.dispatchEvent({
  14879. type: "dispose"
  14880. })
  14881. }
  14882. });
  14883. var Cl = function() {
  14884. y(l, Sl);
  14885. var s = w(l);
  14886. function l(e, t, n, i, r, a) {
  14887. var o;
  14888. return O(this, l),
  14889. (o = s.call(this)).type = "BoxGeometry",
  14890. o.parameters = {
  14891. width: e,
  14892. height: t,
  14893. depth: n,
  14894. widthSegments: i,
  14895. heightSegments: r,
  14896. depthSegments: a
  14897. },
  14898. o.fromBufferGeometry(new Wr(e,t,n,i,r,a)),
  14899. o.mergeVertices(),
  14900. o
  14901. }
  14902. return h(l)
  14903. }()
  14904. , Pl = function() {
  14905. y(v, Mr);
  14906. var m = w(v);
  14907. function v() {
  14908. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 8, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2 * Math.PI;
  14909. O(this, v),
  14910. (e = m.call(this)).type = "CircleBufferGeometry",
  14911. e.parameters = {
  14912. radius: t,
  14913. segments: n,
  14914. thetaStart: i,
  14915. thetaLength: r
  14916. };
  14917. var n = Math.max(3, n)
  14918. , a = []
  14919. , o = []
  14920. , s = []
  14921. , l = []
  14922. , u = new Cn
  14923. , c = new yn;
  14924. o.push(0, 0, 0),
  14925. s.push(0, 0, 1),
  14926. l.push(.5, .5);
  14927. for (var d = 0, h = 3; d <= n; d++,
  14928. h += 3) {
  14929. var p = i + d / n * r;
  14930. u.x = t * Math.cos(p),
  14931. u.y = t * Math.sin(p),
  14932. o.push(u.x, u.y, u.z),
  14933. s.push(0, 0, 1),
  14934. c.x = (o[h] / t + 1) / 2,
  14935. c.y = (o[h + 1] / t + 1) / 2,
  14936. l.push(c.x, c.y)
  14937. }
  14938. for (var f = 1; f <= n; f++)
  14939. a.push(f, f + 1, 0);
  14940. return e.setIndex(a),
  14941. e.setAttribute("position", new dr(o,3)),
  14942. e.setAttribute("normal", new dr(s,3)),
  14943. e.setAttribute("uv", new dr(l,2)),
  14944. e
  14945. }
  14946. return h(v)
  14947. }()
  14948. , Dl = function() {
  14949. y(o, Sl);
  14950. var a = w(o);
  14951. function o(e, t, n, i) {
  14952. var r;
  14953. return O(this, o),
  14954. (r = a.call(this)).type = "CircleGeometry",
  14955. r.parameters = {
  14956. radius: e,
  14957. segments: t,
  14958. thetaStart: n,
  14959. thetaLength: i
  14960. },
  14961. r.fromBufferGeometry(new Pl(e,t,n,i)),
  14962. r.mergeVertices(),
  14963. r
  14964. }
  14965. return h(o)
  14966. }()
  14967. , kl = function() {
  14968. y(r, Mr);
  14969. var i = w(r);
  14970. function r() {
  14971. var e, y = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, w = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, b = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, x = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, E = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1, t = 5 < arguments.length && void 0 !== arguments[5] && arguments[5], _ = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : 0, M = 7 < arguments.length && void 0 !== arguments[7] ? arguments[7] : 2 * Math.PI;
  14972. O(this, r),
  14973. (e = i.call(this)).type = "CylinderBufferGeometry",
  14974. e.parameters = {
  14975. radiusTop: y,
  14976. radiusBottom: w,
  14977. height: b,
  14978. radialSegments: x,
  14979. heightSegments: E,
  14980. openEnded: t,
  14981. thetaStart: _,
  14982. thetaLength: M
  14983. };
  14984. var A = g(e)
  14985. , x = Math.floor(x)
  14986. , E = Math.floor(E)
  14987. , T = []
  14988. , S = []
  14989. , C = []
  14990. , P = []
  14991. , D = 0
  14992. , k = []
  14993. , B = b / 2
  14994. , L = 0;
  14995. function n(e) {
  14996. for (var t = D, n = new yn, i = new Cn, r = 0, a = !0 === e ? y : w, o = !0 === e ? 1 : -1, s = 1; s <= x; s++)
  14997. S.push(0, B * o, 0),
  14998. C.push(0, o, 0),
  14999. P.push(.5, .5),
  15000. D++;
  15001. for (var l = D, u = 0; u <= x; u++) {
  15002. var c = u / x * M + _
  15003. , d = Math.cos(c)
  15004. , c = Math.sin(c);
  15005. i.x = a * c,
  15006. i.y = B * o,
  15007. i.z = a * d,
  15008. S.push(i.x, i.y, i.z),
  15009. C.push(0, o, 0),
  15010. n.x = .5 * d + .5,
  15011. n.y = .5 * c * o + .5,
  15012. P.push(n.x, n.y),
  15013. D++
  15014. }
  15015. for (var h = 0; h < x; h++) {
  15016. var p = t + h
  15017. , f = l + h;
  15018. !0 === e ? T.push(f, f + 1, p) : T.push(f + 1, f, p),
  15019. r += 3
  15020. }
  15021. A.addGroup(L, r, !0 === e ? 1 : 2),
  15022. L += r
  15023. }
  15024. return function() {
  15025. for (var e = new Cn, t = new Cn, n = 0, i = (w - y) / b, r = 0; r <= E; r++) {
  15026. for (var a = [], o = r / E, s = o * (w - y) + y, l = 0; l <= x; l++) {
  15027. var u = l / x
  15028. , c = u * M + _
  15029. , d = Math.sin(c)
  15030. , c = Math.cos(c);
  15031. t.x = s * d,
  15032. t.y = -o * b + B,
  15033. t.z = s * c,
  15034. S.push(t.x, t.y, t.z),
  15035. e.set(d, i, c).normalize(),
  15036. C.push(e.x, e.y, e.z),
  15037. P.push(u, 1 - o),
  15038. a.push(D++)
  15039. }
  15040. k.push(a)
  15041. }
  15042. for (var h = 0; h < x; h++)
  15043. for (var p = 0; p < E; p++) {
  15044. var f = k[p][h]
  15045. , m = k[p + 1][h]
  15046. , v = k[p + 1][h + 1]
  15047. , g = k[p][h + 1];
  15048. T.push(f, m, g),
  15049. T.push(m, v, g),
  15050. n += 6
  15051. }
  15052. A.addGroup(L, n, 0),
  15053. L += n
  15054. }(),
  15055. !1 === t && (0 < y && n(!0),
  15056. 0 < w && n(!1)),
  15057. e.setIndex(T),
  15058. e.setAttribute("position", new dr(S,3)),
  15059. e.setAttribute("normal", new dr(C,3)),
  15060. e.setAttribute("uv", new dr(P,2)),
  15061. e
  15062. }
  15063. return h(r)
  15064. }()
  15065. , Bl = function() {
  15066. y(c, Sl);
  15067. var u = w(c);
  15068. function c(e, t, n, i, r, a, o, s) {
  15069. var l;
  15070. return O(this, c),
  15071. (l = u.call(this)).type = "CylinderGeometry",
  15072. l.parameters = {
  15073. radiusTop: e,
  15074. radiusBottom: t,
  15075. height: n,
  15076. radialSegments: i,
  15077. heightSegments: r,
  15078. openEnded: a,
  15079. thetaStart: o,
  15080. thetaLength: s
  15081. },
  15082. l.fromBufferGeometry(new kl(e,t,n,i,r,a,o,s)),
  15083. l.mergeVertices(),
  15084. l
  15085. }
  15086. return h(c)
  15087. }()
  15088. , Ll = function() {
  15089. y(u, Bl);
  15090. var l = w(u);
  15091. function u(e, t, n, i, r, a, o) {
  15092. var s;
  15093. return O(this, u),
  15094. (s = l.call(this, 0, e, t, n, i, r, a, o)).type = "ConeGeometry",
  15095. s.parameters = {
  15096. radius: e,
  15097. height: t,
  15098. radialSegments: n,
  15099. heightSegments: i,
  15100. openEnded: r,
  15101. thetaStart: a,
  15102. thetaLength: o
  15103. },
  15104. s
  15105. }
  15106. return h(u)
  15107. }()
  15108. , Rl = function() {
  15109. y(u, kl);
  15110. var l = w(u);
  15111. function u() {
  15112. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] && arguments[4], o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0, s = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : 2 * Math.PI;
  15113. return O(this, u),
  15114. (e = l.call(this, 0, t, n, i, r, a, o, s)).type = "ConeBufferGeometry",
  15115. e.parameters = {
  15116. radius: t,
  15117. height: n,
  15118. radialSegments: i,
  15119. heightSegments: r,
  15120. openEnded: a,
  15121. thetaStart: o,
  15122. thetaLength: s
  15123. },
  15124. e
  15125. }
  15126. return h(u)
  15127. }()
  15128. , Fl = function() {
  15129. y(s, Mr);
  15130. var r = w(s);
  15131. function s(n, a) {
  15132. var e, t = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0;
  15133. O(this, s),
  15134. (e = r.call(this)).type = "PolyhedronBufferGeometry",
  15135. e.parameters = {
  15136. vertices: n,
  15137. indices: a,
  15138. radius: t,
  15139. detail: i
  15140. };
  15141. var c = []
  15142. , d = [];
  15143. function f(e) {
  15144. c.push(e.x, e.y, e.z)
  15145. }
  15146. function o(e, t) {
  15147. e *= 3;
  15148. t.x = n[0 + e],
  15149. t.y = n[1 + e],
  15150. t.z = n[2 + e]
  15151. }
  15152. function h(e, t, n, i) {
  15153. i < 0 && 1 === e.x && (d[t] = e.x - 1),
  15154. 0 === n.x && 0 === n.z && (d[t] = i / 2 / Math.PI + .5)
  15155. }
  15156. function p(e) {
  15157. return Math.atan2(e.z, -e.x)
  15158. }
  15159. return function(e) {
  15160. for (var t = new Cn, n = new Cn, i = new Cn, r = 0; r < a.length; r += 3)
  15161. o(a[r + 0], t),
  15162. o(a[r + 1], n),
  15163. o(a[r + 2], i),
  15164. function(e, t, n, i) {
  15165. for (var r = i + 1, a = [], o = 0; o <= r; o++) {
  15166. a[o] = [];
  15167. for (var s = e.clone().lerp(n, o / r), l = t.clone().lerp(n, o / r), u = r - o, c = 0; c <= u; c++)
  15168. a[o][c] = 0 === c && o === r ? s : s.clone().lerp(l, c / u)
  15169. }
  15170. for (var d = 0; d < r; d++)
  15171. for (var h = 0; h < 2 * (r - d) - 1; h++) {
  15172. var p = Math.floor(h / 2);
  15173. h % 2 == 0 ? (f(a[d][p + 1]),
  15174. f(a[d + 1][p]),
  15175. f(a[d][p])) : (f(a[d][p + 1]),
  15176. f(a[d + 1][p + 1]),
  15177. f(a[d + 1][p]))
  15178. }
  15179. }(t, n, i, e)
  15180. }(i),
  15181. function(e) {
  15182. for (var t = new Cn, n = 0; n < c.length; n += 3)
  15183. t.x = c[n + 0],
  15184. t.y = c[n + 1],
  15185. t.z = c[n + 2],
  15186. t.normalize().multiplyScalar(e),
  15187. c[n + 0] = t.x,
  15188. c[n + 1] = t.y,
  15189. c[n + 2] = t.z
  15190. }(t),
  15191. function() {
  15192. for (var e = new Cn, t = 0; t < c.length; t += 3) {
  15193. e.x = c[t + 0],
  15194. e.y = c[t + 1],
  15195. e.z = c[t + 2];
  15196. var n = p(e) / 2 / Math.PI + .5
  15197. , i = function(e) {
  15198. return Math.atan2(-e.y, Math.sqrt(e.x * e.x + e.z * e.z))
  15199. }(e) / Math.PI + .5;
  15200. d.push(n, 1 - i)
  15201. }
  15202. (function() {
  15203. for (var e = new Cn, t = new Cn, n = new Cn, i = new Cn, r = new yn, a = new yn, o = new yn, s = 0, l = 0; s < c.length; s += 9,
  15204. l += 6) {
  15205. e.set(c[s + 0], c[s + 1], c[s + 2]),
  15206. t.set(c[s + 3], c[s + 4], c[s + 5]),
  15207. n.set(c[s + 6], c[s + 7], c[s + 8]),
  15208. r.set(d[l + 0], d[l + 1]),
  15209. a.set(d[l + 2], d[l + 3]),
  15210. o.set(d[l + 4], d[l + 5]),
  15211. i.copy(e).add(t).add(n).divideScalar(3);
  15212. var u = p(i);
  15213. h(r, l + 0, e, u),
  15214. h(a, l + 2, t, u),
  15215. h(o, l + 4, n, u)
  15216. }
  15217. }
  15218. )(),
  15219. function() {
  15220. for (var e = 0; e < d.length; e += 6) {
  15221. var t = d[e + 0]
  15222. , n = d[e + 2]
  15223. , i = d[e + 4]
  15224. , r = Math.max(t, n, i)
  15225. , a = Math.min(t, n, i);
  15226. .9 < r && a < .1 && (t < .2 && (d[e + 0] += 1),
  15227. n < .2 && (d[e + 2] += 1),
  15228. i < .2 && (d[e + 4] += 1))
  15229. }
  15230. }()
  15231. }(),
  15232. e.setAttribute("position", new dr(c,3)),
  15233. e.setAttribute("normal", new dr(c.slice(),3)),
  15234. e.setAttribute("uv", new dr(d,2)),
  15235. 0 === i ? e.computeVertexNormals() : e.normalizeNormals(),
  15236. e
  15237. }
  15238. return h(s)
  15239. }()
  15240. , Il = function() {
  15241. y(a, Fl);
  15242. var r = w(a);
  15243. function a() {
  15244. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  15245. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  15246. O(this, a);
  15247. var n = (1 + Math.sqrt(5)) / 2
  15248. , i = 1 / n;
  15249. return (i = r.call(this, [-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, 0, -n, 0, -i, n, 0, -i, -n, 0, i, n, 0, i], [3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9], e, t)).type = "DodecahedronBufferGeometry",
  15250. i.parameters = {
  15251. radius: e,
  15252. detail: t
  15253. },
  15254. i
  15255. }
  15256. return h(a)
  15257. }()
  15258. , Ol = function() {
  15259. y(r, Sl);
  15260. var i = w(r);
  15261. function r(e, t) {
  15262. var n;
  15263. return O(this, r),
  15264. (n = i.call(this)).type = "DodecahedronGeometry",
  15265. n.parameters = {
  15266. radius: e,
  15267. detail: t
  15268. },
  15269. n.fromBufferGeometry(new Il(e,t)),
  15270. n.mergeVertices(),
  15271. n
  15272. }
  15273. return h(r)
  15274. }()
  15275. , zl = new Cn
  15276. , Nl = new Cn
  15277. , Ul = new Cn
  15278. , Gl = new Hi
  15279. , Hl = function() {
  15280. y(C, Mr);
  15281. var S = w(C);
  15282. function C(e, t) {
  15283. var n;
  15284. O(this, C),
  15285. (n = S.call(this)).type = "EdgesGeometry",
  15286. n.parameters = {
  15287. thresholdAngle: t
  15288. },
  15289. t = void 0 !== t ? t : 1,
  15290. e.isGeometry && (e = (new Mr).fromGeometry(e));
  15291. for (var i, r, a, o = Math.pow(10, 4), s = Math.cos(gn.DEG2RAD * t), l = e.getIndex(), u = e.getAttribute("position"), c = (l || u).count, d = [0, 0, 0], h = ["a", "b", "c"], p = new Array(3), f = {}, m = [], v = 0; v < c; v += 3) {
  15292. l ? (d[0] = l.getX(v),
  15293. d[1] = l.getX(v + 1),
  15294. d[2] = l.getX(v + 2)) : (d[0] = v,
  15295. d[1] = v + 1,
  15296. d[2] = v + 2);
  15297. var g = Gl.a
  15298. , y = Gl.b
  15299. , w = Gl.c;
  15300. if (g.fromBufferAttribute(u, d[0]),
  15301. y.fromBufferAttribute(u, d[1]),
  15302. w.fromBufferAttribute(u, d[2]),
  15303. Gl.getNormal(Ul),
  15304. p[0] = "".concat(Math.round(g.x * o), ",").concat(Math.round(g.y * o), ",").concat(Math.round(g.z * o)),
  15305. p[1] = "".concat(Math.round(y.x * o), ",").concat(Math.round(y.y * o), ",").concat(Math.round(y.z * o)),
  15306. p[2] = "".concat(Math.round(w.x * o), ",").concat(Math.round(w.y * o), ",").concat(Math.round(w.z * o)),
  15307. p[0] !== p[1] && p[1] !== p[2] && p[2] !== p[0])
  15308. for (var b = 0; b < 3; b++) {
  15309. var x = (b + 1) % 3
  15310. , E = p[b]
  15311. , _ = p[x]
  15312. , M = Gl[h[b]]
  15313. , A = Gl[h[x]]
  15314. , T = "".concat(E, "_").concat(_)
  15315. , E = "".concat(_, "_").concat(E);
  15316. E in f && f[E] ? (Ul.dot(f[E].normal) <= s && (m.push(M.x, M.y, M.z),
  15317. m.push(A.x, A.y, A.z)),
  15318. f[E] = null) : T in f || (f[T] = {
  15319. index0: d[b],
  15320. index1: d[x],
  15321. normal: Ul.clone()
  15322. })
  15323. }
  15324. }
  15325. for (i in f)
  15326. f[i] && (r = (a = f[i]).index0,
  15327. a = a.index1,
  15328. zl.fromBufferAttribute(u, r),
  15329. Nl.fromBufferAttribute(u, a),
  15330. m.push(zl.x, zl.y, zl.z),
  15331. m.push(Nl.x, Nl.y, Nl.z));
  15332. return n.setAttribute("position", new dr(m,3)),
  15333. n
  15334. }
  15335. return h(C)
  15336. }()
  15337. , Vl = function(e, t, n) {
  15338. n = n || 2;
  15339. var i, r, a, o, s, l = t && t.length, u = l ? t[0] * n : e.length, c = jl(e, 0, u, n, !0), d = [];
  15340. if (!c || c.next === c.prev)
  15341. return d;
  15342. if (l && (c = function(e, t, n, i) {
  15343. var r, a, o, s, l = [];
  15344. for (r = 0,
  15345. a = t.length; r < a; r++)
  15346. o = t[r] * i,
  15347. s = r < a - 1 ? t[r + 1] * i : e.length,
  15348. (s = jl(e, o, s, i, !1)) === s.next && (s.steiner = !0),
  15349. l.push(function(e) {
  15350. var t = e
  15351. , n = e;
  15352. for (; (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t),
  15353. t = t.next,
  15354. t !== e; )
  15355. ;
  15356. return n
  15357. }(s));
  15358. for (l.sort(ql),
  15359. r = 0; r < l.length; r++)
  15360. !function(e, t) {
  15361. (t = function(e, t) {
  15362. var n, i = t, r = e.x, a = e.y, o = -1 / 0;
  15363. do {
  15364. if (a <= i.y && a >= i.next.y && i.next.y !== i.y) {
  15365. var s = i.x + (a - i.y) * (i.next.x - i.x) / (i.next.y - i.y);
  15366. if (s <= r && o < s) {
  15367. if ((o = s) === r) {
  15368. if (a === i.y)
  15369. return i;
  15370. if (a === i.next.y)
  15371. return i.next
  15372. }
  15373. n = i.x < i.next.x ? i : i.next
  15374. }
  15375. }
  15376. } while (i = i.next,
  15377. i !== t);
  15378. if (!n)
  15379. return null;
  15380. if (r === o)
  15381. return n;
  15382. var l, u = n, c = n.x, d = n.y, h = 1 / 0;
  15383. i = n;
  15384. for (; r >= i.x && i.x >= c && r !== i.x && Yl(a < d ? r : o, a, c, d, a < d ? o : r, a, i.x, i.y) && (l = Math.abs(a - i.y) / (r - i.x),
  15385. tu(i, e) && (l < h || l === h && (i.x > n.x || i.x === n.x && function(e, t) {
  15386. return Zl(e.prev, e, t.prev) < 0 && Zl(t.next, e, e.next) < 0
  15387. }(n, i))) && (n = i,
  15388. h = l)),
  15389. i = i.next,
  15390. i !== u; )
  15391. ;
  15392. return n
  15393. }(e, t)) && (e = nu(t, e),
  15394. Wl(t, t.next),
  15395. Wl(e, e.next))
  15396. }(l[r], n),
  15397. n = Wl(n, n.next);
  15398. return n
  15399. }(e, t, c, n)),
  15400. e.length > 80 * n) {
  15401. for (var h = i = e[0], p = r = e[1], f = n; f < u; f += n)
  15402. (a = e[f]) < h && (h = a),
  15403. (o = e[f + 1]) < p && (p = o),
  15404. i < a && (i = a),
  15405. r < o && (r = o);
  15406. s = 0 !== (s = Math.max(i - h, r - p)) ? 1 / s : 0
  15407. }
  15408. return Xl(c, d, n, h, p, s),
  15409. d
  15410. };
  15411. function jl(e, t, n, i, r) {
  15412. var a, o;
  15413. if (r === 0 < function(e, t, n, i) {
  15414. for (var r = 0, a = t, o = n - i; a < n; a += i)
  15415. r += (e[o] - e[a]) * (e[a + 1] + e[o + 1]),
  15416. o = a;
  15417. return r
  15418. }(e, t, n, i))
  15419. for (a = t; a < n; a += i)
  15420. o = iu(a, e[a], e[a + 1], o);
  15421. else
  15422. for (a = n - i; t <= a; a -= i)
  15423. o = iu(a, e[a], e[a + 1], o);
  15424. return o && Ql(o, o.next) && (ru(o),
  15425. o = o.next),
  15426. o
  15427. }
  15428. function Wl(e, t) {
  15429. if (!e)
  15430. return e;
  15431. t = t || e;
  15432. var n, i = e;
  15433. do {
  15434. if (n = !1,
  15435. i.steiner || !Ql(i, i.next) && 0 !== Zl(i.prev, i, i.next))
  15436. i = i.next;
  15437. else {
  15438. if (ru(i),
  15439. (i = t = i.prev) === i.next)
  15440. break;
  15441. n = !0
  15442. }
  15443. } while (n || i !== t);
  15444. return t
  15445. }
  15446. function Xl(e, t, n, i, r, a, o) {
  15447. if (e) {
  15448. !o && a && function(e, t, n, i) {
  15449. var r = e;
  15450. for (; null === r.z && (r.z = Jl(r.x, r.y, t, n, i)),
  15451. r.prevZ = r.prev,
  15452. r.nextZ = r.next,
  15453. r = r.next,
  15454. r !== e; )
  15455. ;
  15456. r.prevZ.nextZ = null,
  15457. r.prevZ = null,
  15458. function(e) {
  15459. var t, n, i, r, a, o, s, l, u = 1;
  15460. do {
  15461. for (n = e,
  15462. a = e = null,
  15463. o = 0; n; ) {
  15464. for (o++,
  15465. i = n,
  15466. t = s = 0; t < u && (s++,
  15467. i = i.nextZ); t++)
  15468. ;
  15469. for (l = u; 0 < s || 0 < l && i; )
  15470. 0 !== s && (0 === l || !i || n.z <= i.z) ? (n = (r = n).nextZ,
  15471. s--) : (i = (r = i).nextZ,
  15472. l--),
  15473. a ? a.nextZ = r : e = r,
  15474. r.prevZ = a,
  15475. a = r;
  15476. n = i
  15477. }
  15478. } while (a.nextZ = null,
  15479. u *= 2,
  15480. 1 < o)
  15481. }(r)
  15482. }(e, i, r, a);
  15483. for (var s, l, u = e; e.prev !== e.next; )
  15484. if (s = e.prev,
  15485. l = e.next,
  15486. a ? function(e, t, n, i) {
  15487. var r = e.prev
  15488. , a = e
  15489. , o = e.next;
  15490. if (0 <= Zl(r, a, o))
  15491. return !1;
  15492. var s = (r.x < a.x ? r.x < o.x ? r : o : a.x < o.x ? a : o).x
  15493. , l = (r.y < a.y ? r.y < o.y ? r : o : a.y < o.y ? a : o).y
  15494. , u = (r.x > a.x ? r.x > o.x ? r : o : a.x > o.x ? a : o).x
  15495. , c = (r.y > a.y ? r.y > o.y ? r : o : a.y > o.y ? a : o).y
  15496. , d = Jl(s, l, t, n, i)
  15497. , h = Jl(u, c, t, n, i)
  15498. , p = e.prevZ
  15499. , f = e.nextZ;
  15500. for (; p && p.z >= d && f && f.z <= h; ) {
  15501. if (p !== e.prev && p !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, p.x, p.y) && 0 <= Zl(p.prev, p, p.next))
  15502. return !1;
  15503. if (p = p.prevZ,
  15504. f !== e.prev && f !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, f.x, f.y) && 0 <= Zl(f.prev, f, f.next))
  15505. return !1;
  15506. f = f.nextZ
  15507. }
  15508. for (; p && p.z >= d; ) {
  15509. if (p !== e.prev && p !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, p.x, p.y) && 0 <= Zl(p.prev, p, p.next))
  15510. return !1;
  15511. p = p.prevZ
  15512. }
  15513. for (; f && f.z <= h; ) {
  15514. if (f !== e.prev && f !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, f.x, f.y) && 0 <= Zl(f.prev, f, f.next))
  15515. return !1;
  15516. f = f.nextZ
  15517. }
  15518. return !0
  15519. }(e, i, r, a) : function(e) {
  15520. var t = e.prev
  15521. , n = e
  15522. , i = e.next;
  15523. if (0 <= Zl(t, n, i))
  15524. return !1;
  15525. var r = e.next.next;
  15526. for (; r !== e.prev; ) {
  15527. if (Yl(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && 0 <= Zl(r.prev, r, r.next))
  15528. return !1;
  15529. r = r.next
  15530. }
  15531. return !0
  15532. }(e))
  15533. t.push(s.i / n),
  15534. t.push(e.i / n),
  15535. t.push(l.i / n),
  15536. ru(e),
  15537. e = l.next,
  15538. u = l.next;
  15539. else if ((e = l) === u) {
  15540. o ? 1 === o ? Xl(e = function(e, t, n) {
  15541. var i = e;
  15542. do {
  15543. var r = i.prev
  15544. , a = i.next.next
  15545. } while (!Ql(r, a) && Kl(r, i, i.next, a) && tu(r, a) && tu(a, r) && (t.push(r.i / n),
  15546. t.push(i.i / n),
  15547. t.push(a.i / n),
  15548. ru(i),
  15549. ru(i.next),
  15550. i = e = a),
  15551. i = i.next,
  15552. i !== e);
  15553. return Wl(i)
  15554. }(Wl(e), t, n), t, n, i, r, a, 2) : 2 === o && function(e, t, n, i, r, a) {
  15555. var o = e;
  15556. do {
  15557. for (var s = o.next.next; s !== o.prev; ) {
  15558. if (o.i !== s.i && function(e, t) {
  15559. return e.next.i !== t.i && e.prev.i !== t.i && !function(e, t) {
  15560. var n = e;
  15561. do {
  15562. if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Kl(n, n.next, e, t))
  15563. return !0
  15564. } while (n = n.next,
  15565. n !== e);
  15566. return !1
  15567. }(e, t) && (tu(e, t) && tu(t, e) && function(e, t) {
  15568. var n = e
  15569. , i = !1
  15570. , r = (e.x + t.x) / 2
  15571. , a = (e.y + t.y) / 2;
  15572. for (; n.y > a != n.next.y > a && n.next.y !== n.y && r < (n.next.x - n.x) * (a - n.y) / (n.next.y - n.y) + n.x && (i = !i),
  15573. n = n.next,
  15574. n !== e; )
  15575. ;
  15576. return i
  15577. }(e, t) && (Zl(e.prev, e, t.prev) || Zl(e, t.prev, t)) || Ql(e, t) && 0 < Zl(e.prev, e, e.next) && 0 < Zl(t.prev, t, t.next))
  15578. }(o, s)) {
  15579. var l = nu(o, s);
  15580. return o = Wl(o, o.next),
  15581. l = Wl(l, l.next),
  15582. Xl(o, t, n, i, r, a),
  15583. Xl(l, t, n, i, r, a)
  15584. }
  15585. s = s.next
  15586. }
  15587. } while (o = o.next,
  15588. o !== e)
  15589. }(e, t, n, i, r, a) : Xl(Wl(e), t, n, i, r, a, 1);
  15590. break
  15591. }
  15592. }
  15593. }
  15594. function ql(e, t) {
  15595. return e.x - t.x
  15596. }
  15597. function Jl(e, t, n, i, r) {
  15598. return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) * r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) * r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1
  15599. }
  15600. function Yl(e, t, n, i, r, a, o, s) {
  15601. return 0 <= (r - o) * (t - s) - (e - o) * (a - s) && 0 <= (e - o) * (i - s) - (n - o) * (t - s) && 0 <= (n - o) * (a - s) - (r - o) * (i - s)
  15602. }
  15603. function Zl(e, t, n) {
  15604. return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y)
  15605. }
  15606. function Ql(e, t) {
  15607. return e.x === t.x && e.y === t.y
  15608. }
  15609. function Kl(e, t, n, i) {
  15610. var r = eu(Zl(e, t, n))
  15611. , a = eu(Zl(e, t, i))
  15612. , o = eu(Zl(n, i, e))
  15613. , s = eu(Zl(n, i, t));
  15614. return r !== a && o !== s || (0 === r && $l(e, n, t) || (0 === a && $l(e, i, t) || (0 === o && $l(n, e, i) || !(0 !== s || !$l(n, t, i)))))
  15615. }
  15616. function $l(e, t, n) {
  15617. return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y)
  15618. }
  15619. function eu(e) {
  15620. return 0 < e ? 1 : e < 0 ? -1 : 0
  15621. }
  15622. function tu(e, t) {
  15623. return Zl(e.prev, e, e.next) < 0 ? 0 <= Zl(e, t, e.next) && 0 <= Zl(e, e.prev, t) : Zl(e, t, e.prev) < 0 || Zl(e, e.next, t) < 0
  15624. }
  15625. function nu(e, t) {
  15626. var n = new au(e.i,e.x,e.y)
  15627. , i = new au(t.i,t.x,t.y)
  15628. , r = e.next
  15629. , a = t.prev;
  15630. return (e.next = t).prev = e,
  15631. (n.next = r).prev = n,
  15632. (i.next = n).prev = i,
  15633. (a.next = i).prev = a,
  15634. i
  15635. }
  15636. function iu(e, t, n, i) {
  15637. n = new au(e,t,n);
  15638. return i ? (n.next = i.next,
  15639. (n.prev = i).next.prev = n,
  15640. i.next = n) : (n.prev = n).next = n,
  15641. n
  15642. }
  15643. function ru(e) {
  15644. e.next.prev = e.prev,
  15645. e.prev.next = e.next,
  15646. e.prevZ && (e.prevZ.nextZ = e.nextZ),
  15647. e.nextZ && (e.nextZ.prevZ = e.prevZ)
  15648. }
  15649. function au(e, t, n) {
  15650. this.i = e,
  15651. this.x = t,
  15652. this.y = n,
  15653. this.prev = null,
  15654. this.next = null,
  15655. this.z = null,
  15656. this.prevZ = null,
  15657. this.nextZ = null,
  15658. this.steiner = !1
  15659. }
  15660. var ou = {
  15661. area: function(e) {
  15662. for (var t = e.length, n = 0, i = t - 1, r = 0; r < t; i = r++)
  15663. n += e[i].x * e[r].y - e[r].x * e[i].y;
  15664. return .5 * n
  15665. },
  15666. isClockWise: function(e) {
  15667. return ou.area(e) < 0
  15668. },
  15669. triangulateShape: function(e, t) {
  15670. var n = []
  15671. , i = []
  15672. , r = [];
  15673. su(e),
  15674. lu(n, e);
  15675. var a = e.length;
  15676. t.forEach(su);
  15677. for (var o = 0; o < t.length; o++)
  15678. i.push(a),
  15679. a += t[o].length,
  15680. lu(n, t[o]);
  15681. for (var s = Vl(n, i), l = 0; l < s.length; l += 3)
  15682. r.push(s.slice(l, l + 3));
  15683. return r
  15684. }
  15685. };
  15686. function su(e) {
  15687. var t = e.length;
  15688. 2 < t && e[t - 1].equals(e[0]) && e.pop()
  15689. }
  15690. function lu(e, t) {
  15691. for (var n = 0; n < t.length; n++)
  15692. e.push(t[n].x),
  15693. e.push(t[n].y)
  15694. }
  15695. var uu = function() {
  15696. y(a, Mr);
  15697. var r = w(a);
  15698. function a(e, De) {
  15699. var t;
  15700. O(this, a),
  15701. (t = r.call(this)).type = "ExtrudeBufferGeometry",
  15702. t.parameters = {
  15703. shapes: e,
  15704. options: De
  15705. },
  15706. e = Array.isArray(e) ? e : [e];
  15707. for (var ke = g(t), Be = [], Le = [], n = 0, i = e.length; n < i; n++)
  15708. !function(e) {
  15709. var i = []
  15710. , t = void 0 !== De.curveSegments ? De.curveSegments : 12
  15711. , c = void 0 !== De.steps ? De.steps : 1
  15712. , n = void 0 !== De.depth ? De.depth : 100
  15713. , d = void 0 === De.bevelEnabled || De.bevelEnabled
  15714. , r = void 0 !== De.bevelThickness ? De.bevelThickness : 6
  15715. , a = void 0 !== De.bevelSize ? De.bevelSize : r - 2
  15716. , o = void 0 !== De.bevelOffset ? De.bevelOffset : 0
  15717. , h = void 0 !== De.bevelSegments ? De.bevelSegments : 3
  15718. , s = De.extrudePath
  15719. , u = void 0 !== De.UVGenerator ? De.UVGenerator : cu;
  15720. void 0 !== De.amount && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),
  15721. n = De.amount);
  15722. var l, p, f, m, v, g = !1;
  15723. s && (l = s.getSpacedPoints(c),
  15724. d = !(g = !0),
  15725. p = s.computeFrenetFrames(c, !1),
  15726. f = new Cn,
  15727. m = new Cn,
  15728. v = new Cn);
  15729. d || (o = a = r = h = 0);
  15730. var t = e.extractPoints(t)
  15731. , y = t.shape
  15732. , w = t.holes;
  15733. if (!ou.isClockWise(y)) {
  15734. y = y.reverse();
  15735. for (var b = 0, x = w.length; b < x; b++) {
  15736. var E = w[b];
  15737. ou.isClockWise(E) && (w[b] = E.reverse())
  15738. }
  15739. }
  15740. for (var _ = ou.triangulateShape(y, w), M = y, A = 0, T = w.length; A < T; A++) {
  15741. var S = w[A];
  15742. y = y.concat(S)
  15743. }
  15744. function C(e, t, n) {
  15745. return t || console.error("THREE.ExtrudeGeometry: vec does not exist"),
  15746. t.clone().multiplyScalar(n).add(e)
  15747. }
  15748. var P = y.length
  15749. , D = _.length;
  15750. function k(e, t, n) {
  15751. var i = e.x - t.x
  15752. , r = e.y - t.y
  15753. , a = n.x - e.x
  15754. , o = n.y - e.y
  15755. , s = i * i + r * r;
  15756. if (Math.abs(i * o - r * a) > Number.EPSILON) {
  15757. var l = Math.sqrt(s)
  15758. , u = Math.sqrt(a * a + o * o)
  15759. , c = t.x - r / l
  15760. , d = t.y + i / l
  15761. , l = ((n.x - o / u - c) * o - (n.y + a / u - d) * a) / (i * o - r * a)
  15762. , d = (u = c + i * l - e.x) * u + (c = d + r * l - e.y) * c;
  15763. if (d <= 2)
  15764. return new yn(u,c);
  15765. l = Math.sqrt(d / 2)
  15766. } else {
  15767. d = !1;
  15768. i > Number.EPSILON ? a > Number.EPSILON && (d = !0) : i < -Number.EPSILON ? a < -Number.EPSILON && (d = !0) : Math.sign(r) === Math.sign(o) && (d = !0),
  15769. l = d ? (u = -r,
  15770. c = i,
  15771. Math.sqrt(s)) : (u = i,
  15772. c = r,
  15773. Math.sqrt(s / 2))
  15774. }
  15775. return new yn(u / l,c / l)
  15776. }
  15777. for (var B = [], L = 0, R = M.length, F = R - 1, I = L + 1; L < R; L++,
  15778. F++,
  15779. I++)
  15780. F === R && (F = 0),
  15781. I === R && (I = 0),
  15782. B[L] = k(M[L], M[F], M[I]);
  15783. for (var O, z = [], N = B.concat(), U = 0, G = w.length; U < G; U++) {
  15784. var H = w[U];
  15785. O = [];
  15786. for (var V = 0, j = H.length, W = j - 1, X = V + 1; V < j; V++,
  15787. W++,
  15788. X++)
  15789. W === j && (W = 0),
  15790. X === j && (X = 0),
  15791. O[V] = k(H[V], H[W], H[X]);
  15792. z.push(O),
  15793. N = N.concat(O)
  15794. }
  15795. for (var q = 0; q < h; q++) {
  15796. for (var J = q / h, Y = r * Math.cos(J * Math.PI / 2), Z = a * Math.sin(J * Math.PI / 2) + o, Q = 0, K = M.length; Q < K; Q++) {
  15797. var $ = C(M[Q], B[Q], Z);
  15798. Te($.x, $.y, -Y)
  15799. }
  15800. for (var ee = 0, te = w.length; ee < te; ee++) {
  15801. var ne = w[ee];
  15802. O = z[ee];
  15803. for (var ie = 0, re = ne.length; ie < re; ie++) {
  15804. var ae = C(ne[ie], O[ie], Z);
  15805. Te(ae.x, ae.y, -Y)
  15806. }
  15807. }
  15808. }
  15809. for (var oe = a + o, se = 0; se < P; se++) {
  15810. var le = d ? C(y[se], N[se], oe) : y[se];
  15811. g ? (m.copy(p.normals[0]).multiplyScalar(le.x),
  15812. f.copy(p.binormals[0]).multiplyScalar(le.y),
  15813. v.copy(l[0]).add(m).add(f),
  15814. Te(v.x, v.y, v.z)) : Te(le.x, le.y, 0)
  15815. }
  15816. for (var ue = 1; ue <= c; ue++)
  15817. for (var ce = 0; ce < P; ce++) {
  15818. var de = d ? C(y[ce], N[ce], oe) : y[ce];
  15819. g ? (m.copy(p.normals[ue]).multiplyScalar(de.x),
  15820. f.copy(p.binormals[ue]).multiplyScalar(de.y),
  15821. v.copy(l[ue]).add(m).add(f),
  15822. Te(v.x, v.y, v.z)) : Te(de.x, de.y, n / c * ue)
  15823. }
  15824. for (var he = h - 1; 0 <= he; he--) {
  15825. for (var pe = he / h, fe = r * Math.cos(pe * Math.PI / 2), me = a * Math.sin(pe * Math.PI / 2) + o, ve = 0, ge = M.length; ve < ge; ve++) {
  15826. var ye = C(M[ve], B[ve], me);
  15827. Te(ye.x, ye.y, n + fe)
  15828. }
  15829. for (var we = 0, be = w.length; we < be; we++) {
  15830. var xe = w[we];
  15831. O = z[we];
  15832. for (var Ee = 0, _e = xe.length; Ee < _e; Ee++) {
  15833. var Me = C(xe[Ee], O[Ee], me);
  15834. g ? Te(Me.x, Me.y + l[c - 1].y, l[c - 1].x + fe) : Te(Me.x, Me.y, n + fe)
  15835. }
  15836. }
  15837. }
  15838. function Ae(e, t) {
  15839. for (var n = e.length; 0 <= --n; ) {
  15840. var i = n
  15841. , r = n - 1;
  15842. r < 0 && (r = e.length - 1);
  15843. for (var a = 0, o = c + 2 * h; a < o; a++) {
  15844. var s = P * a
  15845. , l = P * (a + 1);
  15846. !function(e, t, n, i) {
  15847. Ce(e),
  15848. Ce(t),
  15849. Ce(i),
  15850. Ce(t),
  15851. Ce(n),
  15852. Ce(i);
  15853. i = Be.length / 3,
  15854. i = u.generateSideWallUV(ke, Be, i - 6, i - 3, i - 2, i - 1);
  15855. Pe(i[0]),
  15856. Pe(i[1]),
  15857. Pe(i[3]),
  15858. Pe(i[1]),
  15859. Pe(i[2]),
  15860. Pe(i[3])
  15861. }(t + i + s, t + r + s, t + r + l, t + i + l)
  15862. }
  15863. }
  15864. }
  15865. function Te(e, t, n) {
  15866. i.push(e),
  15867. i.push(t),
  15868. i.push(n)
  15869. }
  15870. function Se(e, t, n) {
  15871. Ce(e),
  15872. Ce(t),
  15873. Ce(n);
  15874. n = Be.length / 3,
  15875. n = u.generateTopUV(ke, Be, n - 3, n - 2, n - 1);
  15876. Pe(n[0]),
  15877. Pe(n[1]),
  15878. Pe(n[2])
  15879. }
  15880. function Ce(e) {
  15881. Be.push(i[3 * e + 0]),
  15882. Be.push(i[3 * e + 1]),
  15883. Be.push(i[3 * e + 2])
  15884. }
  15885. function Pe(e) {
  15886. Le.push(e.x),
  15887. Le.push(e.y)
  15888. }
  15889. (function() {
  15890. var e = Be.length / 3;
  15891. if (d) {
  15892. for (var t = 0 * P, n = 0; n < D; n++) {
  15893. var i = _[n];
  15894. Se(i[2] + t, i[1] + t, i[0] + t)
  15895. }
  15896. for (var t = P * (c + 2 * h), r = 0; r < D; r++) {
  15897. var a = _[r];
  15898. Se(a[0] + t, a[1] + t, a[2] + t)
  15899. }
  15900. } else {
  15901. for (var o = 0; o < D; o++) {
  15902. var s = _[o];
  15903. Se(s[2], s[1], s[0])
  15904. }
  15905. for (var l = 0; l < D; l++) {
  15906. var u = _[l];
  15907. Se(u[0] + P * c, u[1] + P * c, u[2] + P * c)
  15908. }
  15909. }
  15910. ke.addGroup(e, Be.length / 3 - e, 0)
  15911. }
  15912. )(),
  15913. function() {
  15914. var e = Be.length / 3
  15915. , t = 0;
  15916. Ae(M, t),
  15917. t += M.length;
  15918. for (var n = 0, i = w.length; n < i; n++) {
  15919. var r = w[n];
  15920. Ae(r, t),
  15921. t += r.length
  15922. }
  15923. ke.addGroup(e, Be.length / 3 - e, 1)
  15924. }()
  15925. }(e[n]);
  15926. return t.setAttribute("position", new dr(Be,3)),
  15927. t.setAttribute("uv", new dr(Le,2)),
  15928. t.computeVertexNormals(),
  15929. t
  15930. }
  15931. return h(a, [{
  15932. key: "toJSON",
  15933. value: function() {
  15934. var e = Mr.prototype.toJSON.call(this);
  15935. return function(e, t, n) {
  15936. if (n.shapes = [],
  15937. Array.isArray(e))
  15938. for (var i = 0, r = e.length; i < r; i++) {
  15939. var a = e[i];
  15940. n.shapes.push(a.uuid)
  15941. }
  15942. else
  15943. n.shapes.push(e.uuid);
  15944. void 0 !== t.extrudePath && (n.options.extrudePath = t.extrudePath.toJSON());
  15945. return n
  15946. }(this.parameters.shapes, this.parameters.options, e)
  15947. }
  15948. }]),
  15949. a
  15950. }()
  15951. , cu = {
  15952. generateTopUV: function(e, t, n, i, r) {
  15953. var a = t[3 * n]
  15954. , o = t[3 * n + 1]
  15955. , s = t[3 * i]
  15956. , n = t[3 * i + 1]
  15957. , i = t[3 * r]
  15958. , r = t[3 * r + 1];
  15959. return [new yn(a,o), new yn(s,n), new yn(i,r)]
  15960. },
  15961. generateSideWallUV: function(e, t, n, i, r, a) {
  15962. var o = t[3 * n]
  15963. , s = t[3 * n + 1]
  15964. , l = t[3 * n + 2]
  15965. , u = t[3 * i]
  15966. , c = t[3 * i + 1]
  15967. , d = t[3 * i + 2]
  15968. , h = t[3 * r]
  15969. , p = t[3 * r + 1]
  15970. , n = t[3 * r + 2]
  15971. , i = t[3 * a]
  15972. , r = t[3 * a + 1]
  15973. , a = t[3 * a + 2];
  15974. return Math.abs(s - c) < .01 ? [new yn(o,1 - l), new yn(u,1 - d), new yn(h,1 - n), new yn(i,1 - a)] : [new yn(s,1 - l), new yn(c,1 - d), new yn(p,1 - n), new yn(r,1 - a)]
  15975. }
  15976. };
  15977. var du = function() {
  15978. y(r, Sl);
  15979. var i = w(r);
  15980. function r(e, t) {
  15981. var n;
  15982. return O(this, r),
  15983. (n = i.call(this)).type = "ExtrudeGeometry",
  15984. n.parameters = {
  15985. shapes: e,
  15986. options: t
  15987. },
  15988. n.fromBufferGeometry(new uu(e,t)),
  15989. n.mergeVertices(),
  15990. n
  15991. }
  15992. return h(r, [{
  15993. key: "toJSON",
  15994. value: function() {
  15995. var e = b(v(r.prototype), "toJSON", this).call(this);
  15996. return function(e, t, n) {
  15997. if (n.shapes = [],
  15998. Array.isArray(e))
  15999. for (var i = 0, r = e.length; i < r; i++) {
  16000. var a = e[i];
  16001. n.shapes.push(a.uuid)
  16002. }
  16003. else
  16004. n.shapes.push(e.uuid);
  16005. void 0 !== t.extrudePath && (n.options.extrudePath = t.extrudePath.toJSON());
  16006. return n
  16007. }(this.parameters.shapes, this.parameters.options, e)
  16008. }
  16009. }]),
  16010. r
  16011. }();
  16012. var hu = function() {
  16013. y(r, Fl);
  16014. var i = w(r);
  16015. function r() {
  16016. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  16017. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  16018. O(this, r);
  16019. var n = (1 + Math.sqrt(5)) / 2;
  16020. return (n = i.call(this, [-1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, 0, 0, -1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, n, 0, -1, n, 0, 1, -n, 0, -1, -n, 0, 1], [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1], e, t)).type = "IcosahedronBufferGeometry",
  16021. n.parameters = {
  16022. radius: e,
  16023. detail: t
  16024. },
  16025. n
  16026. }
  16027. return h(r)
  16028. }()
  16029. , pu = function() {
  16030. y(r, Sl);
  16031. var i = w(r);
  16032. function r(e, t) {
  16033. var n;
  16034. return O(this, r),
  16035. (n = i.call(this)).type = "IcosahedronGeometry",
  16036. n.parameters = {
  16037. radius: e,
  16038. detail: t
  16039. },
  16040. n.fromBufferGeometry(new hu(e,t)),
  16041. n.mergeVertices(),
  16042. n
  16043. }
  16044. return h(r)
  16045. }()
  16046. , fu = function() {
  16047. y(D, Mr);
  16048. var P = w(D);
  16049. function D(e) {
  16050. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 12, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2 * Math.PI;
  16051. O(this, D),
  16052. (t = P.call(this)).type = "LatheBufferGeometry",
  16053. t.parameters = {
  16054. points: e,
  16055. segments: n,
  16056. phiStart: i,
  16057. phiLength: r
  16058. };
  16059. for (var n = Math.floor(n), r = gn.clamp(r, 0, 2 * Math.PI), a = [], o = [], s = [], l = 1 / n, u = new Cn, c = new yn, d = 0; d <= n; d++)
  16060. for (var h = i + d * l * r, p = Math.sin(h), f = Math.cos(h), m = 0; m <= e.length - 1; m++)
  16061. u.x = e[m].x * p,
  16062. u.y = e[m].y,
  16063. u.z = e[m].x * f,
  16064. o.push(u.x, u.y, u.z),
  16065. c.x = d / n,
  16066. c.y = m / (e.length - 1),
  16067. s.push(c.x, c.y);
  16068. for (var v = 0; v < n; v++)
  16069. for (var g = 0; g < e.length - 1; g++) {
  16070. var y = g + v * e.length
  16071. , w = y + e.length
  16072. , b = y + e.length + 1
  16073. , x = y + 1;
  16074. a.push(y, w, x),
  16075. a.push(w, b, x)
  16076. }
  16077. if (t.setIndex(a),
  16078. t.setAttribute("position", new dr(o,3)),
  16079. t.setAttribute("uv", new dr(s,2)),
  16080. t.computeVertexNormals(),
  16081. r === 2 * Math.PI)
  16082. for (var E = t.attributes.normal.array, _ = new Cn, M = new Cn, A = new Cn, T = n * e.length * 3, S = 0, C = 0; S < e.length; S++,
  16083. C += 3)
  16084. _.x = E[C + 0],
  16085. _.y = E[C + 1],
  16086. _.z = E[C + 2],
  16087. M.x = E[T + C + 0],
  16088. M.y = E[T + C + 1],
  16089. M.z = E[T + C + 2],
  16090. A.addVectors(_, M).normalize(),
  16091. E[C + 0] = E[T + C + 0] = A.x,
  16092. E[C + 1] = E[T + C + 1] = A.y,
  16093. E[C + 2] = E[T + C + 2] = A.z;
  16094. return t
  16095. }
  16096. return h(D)
  16097. }()
  16098. , mu = function() {
  16099. y(o, Sl);
  16100. var a = w(o);
  16101. function o(e, t, n, i) {
  16102. var r;
  16103. return O(this, o),
  16104. (r = a.call(this)).type = "LatheGeometry",
  16105. r.parameters = {
  16106. points: e,
  16107. segments: t,
  16108. phiStart: n,
  16109. phiLength: i
  16110. },
  16111. r.fromBufferGeometry(new fu(e,t,n,i)),
  16112. r.mergeVertices(),
  16113. r
  16114. }
  16115. return h(o)
  16116. }()
  16117. , vu = function() {
  16118. y(r, Fl);
  16119. var i = w(r);
  16120. function r() {
  16121. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  16122. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  16123. O(this, r);
  16124. var n;
  16125. return (n = i.call(this, [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1], [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2], e, t)).type = "OctahedronBufferGeometry",
  16126. n.parameters = {
  16127. radius: e,
  16128. detail: t
  16129. },
  16130. n
  16131. }
  16132. return h(r)
  16133. }()
  16134. , gu = function() {
  16135. y(r, Sl);
  16136. var i = w(r);
  16137. function r(e, t) {
  16138. var n;
  16139. return O(this, r),
  16140. (n = i.call(this)).type = "OctahedronGeometry",
  16141. n.parameters = {
  16142. radius: e,
  16143. detail: t
  16144. },
  16145. n.fromBufferGeometry(new vu(e,t)),
  16146. n.mergeVertices(),
  16147. n
  16148. }
  16149. return h(r)
  16150. }();
  16151. function yu(e, t, n) {
  16152. Mr.call(this),
  16153. this.type = "ParametricBufferGeometry",
  16154. this.parameters = {
  16155. func: e,
  16156. slices: t,
  16157. stacks: n
  16158. };
  16159. var i = []
  16160. , r = []
  16161. , a = []
  16162. , o = []
  16163. , s = new Cn
  16164. , l = new Cn
  16165. , u = new Cn
  16166. , c = new Cn
  16167. , d = new Cn;
  16168. e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
  16169. for (var h = t + 1, p = 0; p <= n; p++)
  16170. for (var f = p / n, m = 0; m <= t; m++) {
  16171. var v = m / t;
  16172. e(v, f, l),
  16173. r.push(l.x, l.y, l.z),
  16174. 0 <= v - 1e-5 ? (e(v - 1e-5, f, u),
  16175. c.subVectors(l, u)) : (e(1e-5 + v, f, u),
  16176. c.subVectors(u, l)),
  16177. 0 <= f - 1e-5 ? (e(v, f - 1e-5, u),
  16178. d.subVectors(l, u)) : (e(v, 1e-5 + f, u),
  16179. d.subVectors(u, l)),
  16180. s.crossVectors(c, d).normalize(),
  16181. a.push(s.x, s.y, s.z),
  16182. o.push(v, f)
  16183. }
  16184. for (var g = 0; g < n; g++)
  16185. for (var y = 0; y < t; y++) {
  16186. var w = g * h + y + 1
  16187. , b = (g + 1) * h + y + 1
  16188. , x = (g + 1) * h + y;
  16189. i.push(g * h + y, w, x),
  16190. i.push(w, b, x)
  16191. }
  16192. this.setIndex(i),
  16193. this.setAttribute("position", new dr(r,3)),
  16194. this.setAttribute("normal", new dr(a,3)),
  16195. this.setAttribute("uv", new dr(o,2))
  16196. }
  16197. function wu(e, t, n) {
  16198. Sl.call(this),
  16199. this.type = "ParametricGeometry",
  16200. this.parameters = {
  16201. func: e,
  16202. slices: t,
  16203. stacks: n
  16204. },
  16205. this.fromBufferGeometry(new yu(e,t,n)),
  16206. this.mergeVertices()
  16207. }
  16208. (yu.prototype = Object.create(Mr.prototype)).constructor = yu,
  16209. (wu.prototype = Object.create(Sl.prototype)).constructor = wu;
  16210. var bu = function() {
  16211. y(o, Sl);
  16212. var a = w(o);
  16213. function o(e, t, n, i) {
  16214. var r;
  16215. return O(this, o),
  16216. (r = a.call(this)).type = "PlaneGeometry",
  16217. r.parameters = {
  16218. width: e,
  16219. height: t,
  16220. widthSegments: n,
  16221. heightSegments: i
  16222. },
  16223. r.fromBufferGeometry(new ua(e,t,n,i)),
  16224. r.mergeVertices(),
  16225. r
  16226. }
  16227. return h(o)
  16228. }()
  16229. , xu = function() {
  16230. y(o, Sl);
  16231. var a = w(o);
  16232. function o(e, t, n, i) {
  16233. var r;
  16234. return O(this, o),
  16235. (r = a.call(this)).type = "PolyhedronGeometry",
  16236. r.parameters = {
  16237. vertices: e,
  16238. indices: t,
  16239. radius: n,
  16240. detail: i
  16241. },
  16242. r.fromBufferGeometry(new Fl(e,t,n,i)),
  16243. r.mergeVertices(),
  16244. r
  16245. }
  16246. return h(o)
  16247. }()
  16248. , Eu = function() {
  16249. y(T, Mr);
  16250. var A = w(T);
  16251. function T() {
  16252. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : .5, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 0, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 2 * Math.PI;
  16253. O(this, T),
  16254. (e = A.call(this)).type = "RingBufferGeometry",
  16255. e.parameters = {
  16256. innerRadius: t,
  16257. outerRadius: n,
  16258. thetaSegments: i,
  16259. phiSegments: r,
  16260. thetaStart: a,
  16261. thetaLength: o
  16262. };
  16263. for (var i = Math.max(3, i), s = [], l = [], u = [], c = [], d = t, h = (n - t) / (r = Math.max(1, r)), p = new Cn, f = new yn, m = 0; m <= r; m++) {
  16264. for (var v = 0; v <= i; v++) {
  16265. var g = a + v / i * o;
  16266. p.x = d * Math.cos(g),
  16267. p.y = d * Math.sin(g),
  16268. l.push(p.x, p.y, p.z),
  16269. u.push(0, 0, 1),
  16270. f.x = (p.x / n + 1) / 2,
  16271. f.y = (p.y / n + 1) / 2,
  16272. c.push(f.x, f.y)
  16273. }
  16274. d += h
  16275. }
  16276. for (var y = 0; y < r; y++)
  16277. for (var w = y * (i + 1), b = 0; b < i; b++) {
  16278. var x = b + w
  16279. , E = x + i + 1
  16280. , _ = x + i + 2
  16281. , M = x + 1;
  16282. s.push(x, E, M),
  16283. s.push(E, _, M)
  16284. }
  16285. return e.setIndex(s),
  16286. e.setAttribute("position", new dr(l,3)),
  16287. e.setAttribute("normal", new dr(u,3)),
  16288. e.setAttribute("uv", new dr(c,2)),
  16289. e
  16290. }
  16291. return h(T)
  16292. }()
  16293. , _u = function() {
  16294. y(l, Sl);
  16295. var s = w(l);
  16296. function l(e, t, n, i, r, a) {
  16297. var o;
  16298. return O(this, l),
  16299. (o = s.call(this)).type = "RingGeometry",
  16300. o.parameters = {
  16301. innerRadius: e,
  16302. outerRadius: t,
  16303. thetaSegments: n,
  16304. phiSegments: i,
  16305. thetaStart: r,
  16306. thetaLength: a
  16307. },
  16308. o.fromBufferGeometry(new Eu(e,t,n,i,r,a)),
  16309. o.mergeVertices(),
  16310. o
  16311. }
  16312. return h(l)
  16313. }()
  16314. , Mu = function() {
  16315. y(o, Mr);
  16316. var a = w(o);
  16317. function o(e) {
  16318. var t, w = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 12;
  16319. O(this, o),
  16320. (t = a.call(this)).type = "ShapeBufferGeometry",
  16321. t.parameters = {
  16322. shapes: e,
  16323. curveSegments: w
  16324. };
  16325. var b = []
  16326. , x = []
  16327. , E = []
  16328. , _ = []
  16329. , n = 0
  16330. , M = 0;
  16331. if (!1 === Array.isArray(e))
  16332. r(e);
  16333. else
  16334. for (var i = 0; i < e.length; i++)
  16335. r(e[i]),
  16336. t.addGroup(n, M, i),
  16337. n += M,
  16338. M = 0;
  16339. function r(e) {
  16340. var t = x.length / 3
  16341. , e = e.extractPoints(w)
  16342. , n = e.shape
  16343. , i = e.holes;
  16344. !1 === ou.isClockWise(n) && (n = n.reverse());
  16345. for (var r = 0, a = i.length; r < a; r++) {
  16346. var o = i[r];
  16347. !0 === ou.isClockWise(o) && (i[r] = o.reverse())
  16348. }
  16349. for (var s = ou.triangulateShape(n, i), l = 0, u = i.length; l < u; l++)
  16350. var c = i[l]
  16351. , n = n.concat(c);
  16352. for (var d = 0, h = n.length; d < h; d++) {
  16353. var p = n[d];
  16354. x.push(p.x, p.y, 0),
  16355. E.push(0, 0, 1),
  16356. _.push(p.x, p.y)
  16357. }
  16358. for (var f = 0, m = s.length; f < m; f++) {
  16359. var v = s[f]
  16360. , g = v[0] + t
  16361. , y = v[1] + t
  16362. , v = v[2] + t;
  16363. b.push(g, y, v),
  16364. M += 3
  16365. }
  16366. }
  16367. return t.setIndex(b),
  16368. t.setAttribute("position", new dr(x,3)),
  16369. t.setAttribute("normal", new dr(E,3)),
  16370. t.setAttribute("uv", new dr(_,2)),
  16371. t
  16372. }
  16373. return h(o, [{
  16374. key: "toJSON",
  16375. value: function() {
  16376. var e = Mr.prototype.toJSON.call(this);
  16377. return function(e, t) {
  16378. if (t.shapes = [],
  16379. Array.isArray(e))
  16380. for (var n = 0, i = e.length; n < i; n++) {
  16381. var r = e[n];
  16382. t.shapes.push(r.uuid)
  16383. }
  16384. else
  16385. t.shapes.push(e.uuid);
  16386. return t
  16387. }(this.parameters.shapes, e)
  16388. }
  16389. }]),
  16390. o
  16391. }();
  16392. var Au = function() {
  16393. y(r, Sl);
  16394. var i = w(r);
  16395. function r(e, t) {
  16396. var n;
  16397. return O(this, r),
  16398. (n = i.call(this)).type = "ShapeGeometry",
  16399. "object" === X(t) && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."),
  16400. t = t.curveSegments),
  16401. n.parameters = {
  16402. shapes: e,
  16403. curveSegments: t
  16404. },
  16405. n.fromBufferGeometry(new Mu(e,t)),
  16406. n.mergeVertices(),
  16407. n
  16408. }
  16409. return h(r, [{
  16410. key: "toJSON",
  16411. value: function() {
  16412. var e = Sl.prototype.toJSON.call(this);
  16413. return function(e, t) {
  16414. if (t.shapes = [],
  16415. Array.isArray(e))
  16416. for (var n = 0, i = e.length; n < i; n++) {
  16417. var r = e[n];
  16418. t.shapes.push(r.uuid)
  16419. }
  16420. else
  16421. t.shapes.push(e.uuid);
  16422. return t
  16423. }(this.parameters.shapes, e)
  16424. }
  16425. }]),
  16426. r
  16427. }();
  16428. var Tu = function() {
  16429. y(D, Mr);
  16430. var P = w(D);
  16431. function D() {
  16432. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 8, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 6, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2 * Math.PI, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0, s = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : Math.PI;
  16433. O(this, D),
  16434. (e = P.call(this)).type = "SphereBufferGeometry",
  16435. e.parameters = {
  16436. radius: t,
  16437. widthSegments: n,
  16438. heightSegments: i,
  16439. phiStart: r,
  16440. phiLength: a,
  16441. thetaStart: o,
  16442. thetaLength: s
  16443. };
  16444. for (var n = Math.max(3, Math.floor(n)), i = Math.max(2, Math.floor(i)), l = Math.min(o + s, Math.PI), u = 0, c = [], d = new Cn, h = new Cn, p = [], f = [], m = [], v = [], g = 0; g <= i; g++) {
  16445. var y = []
  16446. , w = g / i
  16447. , b = 0;
  16448. 0 == g && 0 == o ? b = .5 / n : g == i && l == Math.PI && (b = -.5 / n);
  16449. for (var x = 0; x <= n; x++) {
  16450. var E = x / n;
  16451. d.x = -t * Math.cos(r + E * a) * Math.sin(o + w * s),
  16452. d.y = t * Math.cos(o + w * s),
  16453. d.z = t * Math.sin(r + E * a) * Math.sin(o + w * s),
  16454. f.push(d.x, d.y, d.z),
  16455. h.copy(d).normalize(),
  16456. m.push(h.x, h.y, h.z),
  16457. v.push(E + b, 1 - w),
  16458. y.push(u++)
  16459. }
  16460. c.push(y)
  16461. }
  16462. for (var _ = 0; _ < i; _++)
  16463. for (var M = 0; M < n; M++) {
  16464. var A = c[_][M + 1]
  16465. , T = c[_][M]
  16466. , S = c[_ + 1][M]
  16467. , C = c[_ + 1][M + 1];
  16468. (0 !== _ || 0 < o) && p.push(A, T, C),
  16469. (_ !== i - 1 || l < Math.PI) && p.push(T, S, C)
  16470. }
  16471. return e.setIndex(p),
  16472. e.setAttribute("position", new dr(f,3)),
  16473. e.setAttribute("normal", new dr(m,3)),
  16474. e.setAttribute("uv", new dr(v,2)),
  16475. e
  16476. }
  16477. return h(D)
  16478. }()
  16479. , Su = function() {
  16480. y(u, Sl);
  16481. var l = w(u);
  16482. function u(e, t, n, i, r, a, o) {
  16483. var s;
  16484. return O(this, u),
  16485. (s = l.call(this)).type = "SphereGeometry",
  16486. s.parameters = {
  16487. radius: e,
  16488. widthSegments: t,
  16489. heightSegments: n,
  16490. phiStart: i,
  16491. phiLength: r,
  16492. thetaStart: a,
  16493. thetaLength: o
  16494. },
  16495. s.fromBufferGeometry(new Tu(e,t,n,i,r,a,o)),
  16496. s.mergeVertices(),
  16497. s
  16498. }
  16499. return h(u)
  16500. }()
  16501. , Cu = function() {
  16502. y(r, Fl);
  16503. var i = w(r);
  16504. function r() {
  16505. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  16506. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;
  16507. O(this, r);
  16508. var n;
  16509. return (n = i.call(this, [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1], [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1], e, t)).type = "TetrahedronBufferGeometry",
  16510. n.parameters = {
  16511. radius: e,
  16512. detail: t
  16513. },
  16514. n
  16515. }
  16516. return h(r)
  16517. }()
  16518. , Pu = function() {
  16519. y(r, Sl);
  16520. var i = w(r);
  16521. function r(e, t) {
  16522. var n;
  16523. return O(this, r),
  16524. (n = i.call(this)).type = "TetrahedronGeometry",
  16525. n.parameters = {
  16526. radius: e,
  16527. detail: t
  16528. },
  16529. n.fromBufferGeometry(new Cu(e,t)),
  16530. n.mergeVertices(),
  16531. n
  16532. }
  16533. return h(r)
  16534. }()
  16535. , Du = function() {
  16536. y(a, uu);
  16537. var r = w(a);
  16538. function a(e) {
  16539. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
  16540. O(this, a);
  16541. var i = n.font;
  16542. if (!i || !i.isFont)
  16543. return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),
  16544. c(t, new Mr);
  16545. e = i.generateShapes(e, n.size);
  16546. return n.depth = void 0 !== n.height ? n.height : 50,
  16547. void 0 === n.bevelThickness && (n.bevelThickness = 10),
  16548. void 0 === n.bevelSize && (n.bevelSize = 8),
  16549. void 0 === n.bevelEnabled && (n.bevelEnabled = !1),
  16550. (t = r.call(this, e, n)).type = "TextBufferGeometry",
  16551. t
  16552. }
  16553. return h(a)
  16554. }()
  16555. , ku = function() {
  16556. y(r, Sl);
  16557. var i = w(r);
  16558. function r(e, t) {
  16559. var n;
  16560. return O(this, r),
  16561. (n = i.call(this)).type = "TextGeometry",
  16562. n.parameters = {
  16563. text: e,
  16564. parameters: t
  16565. },
  16566. n.fromBufferGeometry(new Du(e,t)),
  16567. n.mergeVertices(),
  16568. n
  16569. }
  16570. return h(r)
  16571. }()
  16572. , Bu = function() {
  16573. y(_, Mr);
  16574. var E = w(_);
  16575. function _() {
  16576. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : .4, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 6, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2 * Math.PI;
  16577. O(this, _),
  16578. (e = E.call(this)).type = "TorusBufferGeometry",
  16579. e.parameters = {
  16580. radius: t,
  16581. tube: n,
  16582. radialSegments: i,
  16583. tubularSegments: r,
  16584. arc: a
  16585. };
  16586. for (var i = Math.floor(i), r = Math.floor(r), o = [], s = [], l = [], u = [], c = new Cn, d = new Cn, h = new Cn, p = 0; p <= i; p++)
  16587. for (var f = 0; f <= r; f++) {
  16588. var m = f / r * a
  16589. , v = p / i * Math.PI * 2;
  16590. d.x = (t + n * Math.cos(v)) * Math.cos(m),
  16591. d.y = (t + n * Math.cos(v)) * Math.sin(m),
  16592. d.z = n * Math.sin(v),
  16593. s.push(d.x, d.y, d.z),
  16594. c.x = t * Math.cos(m),
  16595. c.y = t * Math.sin(m),
  16596. h.subVectors(d, c).normalize(),
  16597. l.push(h.x, h.y, h.z),
  16598. u.push(f / r),
  16599. u.push(p / i)
  16600. }
  16601. for (var g = 1; g <= i; g++)
  16602. for (var y = 1; y <= r; y++) {
  16603. var w = (r + 1) * (g - 1) + y - 1
  16604. , b = (r + 1) * (g - 1) + y
  16605. , x = (r + 1) * g + y;
  16606. o.push((r + 1) * g + y - 1, w, x),
  16607. o.push(w, b, x)
  16608. }
  16609. return e.setIndex(o),
  16610. e.setAttribute("position", new dr(s,3)),
  16611. e.setAttribute("normal", new dr(l,3)),
  16612. e.setAttribute("uv", new dr(u,2)),
  16613. e
  16614. }
  16615. return h(_)
  16616. }()
  16617. , Lu = function() {
  16618. y(s, Sl);
  16619. var o = w(s);
  16620. function s(e, t, n, i, r) {
  16621. var a;
  16622. return O(this, s),
  16623. (a = o.call(this)).type = "TorusGeometry",
  16624. a.parameters = {
  16625. radius: e,
  16626. tube: t,
  16627. radialSegments: n,
  16628. tubularSegments: i,
  16629. arc: r
  16630. },
  16631. a.fromBufferGeometry(new Bu(e,t,n,i,r)),
  16632. a.mergeVertices(),
  16633. a
  16634. }
  16635. return h(s)
  16636. }()
  16637. , Ru = function() {
  16638. y(D, Mr);
  16639. var P = w(D);
  16640. function D() {
  16641. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : .4, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 64, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 3;
  16642. O(this, D),
  16643. (e = P.call(this)).type = "TorusKnotBufferGeometry",
  16644. e.parameters = {
  16645. radius: t,
  16646. tube: n,
  16647. tubularSegments: i,
  16648. radialSegments: r,
  16649. p: a,
  16650. q: o
  16651. };
  16652. for (var i = Math.floor(i), r = Math.floor(r), s = [], l = [], u = [], c = [], d = new Cn, h = new Cn, p = new Cn, f = new Cn, m = new Cn, v = new Cn, g = new Cn, y = 0; y <= i; ++y) {
  16653. var w = y / i * a * Math.PI * 2;
  16654. C(w, a, o, t, p),
  16655. C(.01 + w, a, o, t, f),
  16656. v.subVectors(f, p),
  16657. g.addVectors(f, p),
  16658. m.crossVectors(v, g),
  16659. g.crossVectors(m, v),
  16660. m.normalize(),
  16661. g.normalize();
  16662. for (var b = 0; b <= r; ++b) {
  16663. var x = b / r * Math.PI * 2
  16664. , E = -n * Math.cos(x)
  16665. , x = n * Math.sin(x);
  16666. d.x = p.x + (E * g.x + x * m.x),
  16667. d.y = p.y + (E * g.y + x * m.y),
  16668. d.z = p.z + (E * g.z + x * m.z),
  16669. l.push(d.x, d.y, d.z),
  16670. h.subVectors(d, p).normalize(),
  16671. u.push(h.x, h.y, h.z),
  16672. c.push(y / i),
  16673. c.push(b / r)
  16674. }
  16675. }
  16676. for (var _ = 1; _ <= i; _++)
  16677. for (var M = 1; M <= r; M++) {
  16678. var A = (r + 1) * _ + (M - 1)
  16679. , T = (r + 1) * _ + M
  16680. , S = (r + 1) * (_ - 1) + M;
  16681. s.push((r + 1) * (_ - 1) + (M - 1), A, S),
  16682. s.push(A, T, S)
  16683. }
  16684. function C(e, t, n, i, r) {
  16685. var a = Math.cos(e)
  16686. , o = Math.sin(e)
  16687. , t = n / t * e
  16688. , e = Math.cos(t);
  16689. r.x = i * (2 + e) * .5 * a,
  16690. r.y = i * (2 + e) * o * .5,
  16691. r.z = i * Math.sin(t) * .5
  16692. }
  16693. return e.setIndex(s),
  16694. e.setAttribute("position", new dr(l,3)),
  16695. e.setAttribute("normal", new dr(u,3)),
  16696. e.setAttribute("uv", new dr(c,2)),
  16697. e
  16698. }
  16699. return h(D)
  16700. }()
  16701. , Fu = function() {
  16702. y(u, Sl);
  16703. var l = w(u);
  16704. function u(e, t, n, i, r, a, o) {
  16705. var s;
  16706. return O(this, u),
  16707. (s = l.call(this)).type = "TorusKnotGeometry",
  16708. s.parameters = {
  16709. radius: e,
  16710. tube: t,
  16711. tubularSegments: n,
  16712. radialSegments: i,
  16713. p: r,
  16714. q: a
  16715. },
  16716. void 0 !== o && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),
  16717. s.fromBufferGeometry(new Ru(e,t,n,i,r,a)),
  16718. s.mergeVertices(),
  16719. s
  16720. }
  16721. return h(u)
  16722. }()
  16723. , Iu = function() {
  16724. y(g, Mr);
  16725. var a = w(g);
  16726. function g(o) {
  16727. var e, s = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 64, l = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, u = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, t = 4 < arguments.length && void 0 !== arguments[4] && arguments[4];
  16728. O(this, g),
  16729. (e = a.call(this)).type = "TubeBufferGeometry",
  16730. e.parameters = {
  16731. path: o,
  16732. tubularSegments: s,
  16733. radius: l,
  16734. radialSegments: u,
  16735. closed: t
  16736. };
  16737. var c = o.computeFrenetFrames(s, t);
  16738. e.tangents = c.tangents,
  16739. e.normals = c.normals,
  16740. e.binormals = c.binormals;
  16741. var d = new Cn
  16742. , h = new Cn
  16743. , n = new yn
  16744. , p = new Cn
  16745. , f = []
  16746. , m = []
  16747. , i = []
  16748. , v = [];
  16749. function r(e) {
  16750. p = o.getPointAt(e / s, p);
  16751. for (var t = c.normals[e], n = c.binormals[e], i = 0; i <= u; i++) {
  16752. var r = i / u * Math.PI * 2
  16753. , a = Math.sin(r)
  16754. , r = -Math.cos(r);
  16755. h.x = r * t.x + a * n.x,
  16756. h.y = r * t.y + a * n.y,
  16757. h.z = r * t.z + a * n.z,
  16758. h.normalize(),
  16759. m.push(h.x, h.y, h.z),
  16760. d.x = p.x + l * h.x,
  16761. d.y = p.y + l * h.y,
  16762. d.z = p.z + l * h.z,
  16763. f.push(d.x, d.y, d.z)
  16764. }
  16765. }
  16766. return function() {
  16767. for (var e = 0; e < s; e++)
  16768. r(e);
  16769. r(!1 === t ? s : 0),
  16770. function() {
  16771. for (var e = 0; e <= s; e++)
  16772. for (var t = 0; t <= u; t++)
  16773. n.x = e / s,
  16774. n.y = t / u,
  16775. i.push(n.x, n.y)
  16776. }(),
  16777. function() {
  16778. for (var e = 1; e <= s; e++)
  16779. for (var t = 1; t <= u; t++) {
  16780. var n = (u + 1) * (e - 1) + (t - 1)
  16781. , i = (u + 1) * e + (t - 1)
  16782. , r = (u + 1) * e + t
  16783. , a = (u + 1) * (e - 1) + t;
  16784. v.push(n, i, a),
  16785. v.push(i, r, a)
  16786. }
  16787. }()
  16788. }(),
  16789. e.setIndex(v),
  16790. e.setAttribute("position", new dr(f,3)),
  16791. e.setAttribute("normal", new dr(m,3)),
  16792. e.setAttribute("uv", new dr(i,2)),
  16793. e
  16794. }
  16795. return h(g, [{
  16796. key: "toJSON",
  16797. value: function() {
  16798. var e = Mr.prototype.toJSON.call(this);
  16799. return e.path = this.parameters.path.toJSON(),
  16800. e
  16801. }
  16802. }]),
  16803. g
  16804. }()
  16805. , Ou = function() {
  16806. y(l, Sl);
  16807. var s = w(l);
  16808. function l(e, t, n, i, r, a) {
  16809. var o;
  16810. O(this, l),
  16811. (o = s.call(this)).type = "TubeGeometry",
  16812. o.parameters = {
  16813. path: e,
  16814. tubularSegments: t,
  16815. radius: n,
  16816. radialSegments: i,
  16817. closed: r
  16818. },
  16819. void 0 !== a && console.warn("THREE.TubeGeometry: taper has been removed.");
  16820. r = new Iu(e,t,n,i,r);
  16821. return o.tangents = r.tangents,
  16822. o.normals = r.normals,
  16823. o.binormals = r.binormals,
  16824. o.fromBufferGeometry(r),
  16825. o.mergeVertices(),
  16826. o
  16827. }
  16828. return h(l)
  16829. }()
  16830. , zu = function() {
  16831. y(I, Mr);
  16832. var F = w(I);
  16833. function I(e) {
  16834. var t;
  16835. O(this, I),
  16836. (t = F.call(this)).type = "WireframeGeometry";
  16837. var n = []
  16838. , i = [0, 0]
  16839. , r = {}
  16840. , a = ["a", "b", "c"];
  16841. if (e && e.isGeometry) {
  16842. for (var o, s = e.faces, l = 0, u = s.length; l < u; l++)
  16843. for (var c = s[l], d = 0; d < 3; d++) {
  16844. var h = c[a[d]]
  16845. , p = c[a[(d + 1) % 3]];
  16846. i[0] = Math.min(h, p),
  16847. i[1] = Math.max(h, p);
  16848. p = i[0] + "," + i[1];
  16849. void 0 === r[p] && (r[p] = {
  16850. index1: i[0],
  16851. index2: i[1]
  16852. })
  16853. }
  16854. for (o in r) {
  16855. var f = r[o]
  16856. , m = e.vertices[f.index1];
  16857. n.push(m.x, m.y, m.z),
  16858. m = e.vertices[f.index2],
  16859. n.push(m.x, m.y, m.z)
  16860. }
  16861. } else if (e && e.isBufferGeometry) {
  16862. var v = new Cn;
  16863. if (null !== e.index) {
  16864. for (var g, y = e.attributes.position, w = e.index, b = e.groups, x = 0, E = (b = 0 === b.length ? [{
  16865. start: 0,
  16866. count: w.count,
  16867. materialIndex: 0
  16868. }] : b).length; x < E; ++x)
  16869. for (var _ = b[x], M = _.start, A = M, T = M + _.count; A < T; A += 3)
  16870. for (var S = 0; S < 3; S++) {
  16871. var C = w.getX(A + S)
  16872. , P = w.getX(A + (S + 1) % 3);
  16873. i[0] = Math.min(C, P),
  16874. i[1] = Math.max(C, P);
  16875. P = i[0] + "," + i[1];
  16876. void 0 === r[P] && (r[P] = {
  16877. index1: i[0],
  16878. index2: i[1]
  16879. })
  16880. }
  16881. for (g in r) {
  16882. var D = r[g];
  16883. v.fromBufferAttribute(y, D.index1),
  16884. n.push(v.x, v.y, v.z),
  16885. v.fromBufferAttribute(y, D.index2),
  16886. n.push(v.x, v.y, v.z)
  16887. }
  16888. } else
  16889. for (var k = e.attributes.position, B = 0, L = k.count / 3; B < L; B++)
  16890. for (var R = 0; R < 3; R++)
  16891. v.fromBufferAttribute(k, 3 * B + R),
  16892. n.push(v.x, v.y, v.z),
  16893. v.fromBufferAttribute(k, 3 * B + (R + 1) % 3),
  16894. n.push(v.x, v.y, v.z)
  16895. }
  16896. return t.setAttribute("position", new dr(n,3)),
  16897. t
  16898. }
  16899. return h(I)
  16900. }()
  16901. , Nu = Object.freeze({
  16902. __proto__: null,
  16903. BoxGeometry: Cl,
  16904. BoxBufferGeometry: Wr,
  16905. CircleGeometry: Dl,
  16906. CircleBufferGeometry: Pl,
  16907. ConeGeometry: Ll,
  16908. ConeBufferGeometry: Rl,
  16909. CylinderGeometry: Bl,
  16910. CylinderBufferGeometry: kl,
  16911. DodecahedronGeometry: Ol,
  16912. DodecahedronBufferGeometry: Il,
  16913. EdgesGeometry: Hl,
  16914. ExtrudeGeometry: du,
  16915. ExtrudeBufferGeometry: uu,
  16916. IcosahedronGeometry: pu,
  16917. IcosahedronBufferGeometry: hu,
  16918. LatheGeometry: mu,
  16919. LatheBufferGeometry: fu,
  16920. OctahedronGeometry: gu,
  16921. OctahedronBufferGeometry: vu,
  16922. ParametricGeometry: wu,
  16923. ParametricBufferGeometry: yu,
  16924. PlaneGeometry: bu,
  16925. PlaneBufferGeometry: ua,
  16926. PolyhedronGeometry: xu,
  16927. PolyhedronBufferGeometry: Fl,
  16928. RingGeometry: _u,
  16929. RingBufferGeometry: Eu,
  16930. ShapeGeometry: Au,
  16931. ShapeBufferGeometry: Mu,
  16932. SphereGeometry: Su,
  16933. SphereBufferGeometry: Tu,
  16934. TetrahedronGeometry: Pu,
  16935. TetrahedronBufferGeometry: Cu,
  16936. TextGeometry: ku,
  16937. TextBufferGeometry: Du,
  16938. TorusGeometry: Lu,
  16939. TorusBufferGeometry: Bu,
  16940. TorusKnotGeometry: Fu,
  16941. TorusKnotBufferGeometry: Ru,
  16942. TubeGeometry: Ou,
  16943. TubeBufferGeometry: Iu,
  16944. WireframeGeometry: zu
  16945. });
  16946. function Uu(e) {
  16947. Ki.call(this),
  16948. this.type = "ShadowMaterial",
  16949. this.color = new Yi(0),
  16950. this.transparent = !0,
  16951. this.setValues(e)
  16952. }
  16953. function Gu(e) {
  16954. Qr.call(this, e),
  16955. this.type = "RawShaderMaterial"
  16956. }
  16957. function Hu(e) {
  16958. Ki.call(this),
  16959. this.defines = {
  16960. STANDARD: ""
  16961. },
  16962. this.type = "MeshStandardMaterial",
  16963. this.color = new Yi(16777215),
  16964. this.roughness = 1,
  16965. this.metalness = 0,
  16966. this.map = null,
  16967. this.lightMap = null,
  16968. this.lightMapIntensity = 1,
  16969. this.aoMap = null,
  16970. this.aoMapIntensity = 1,
  16971. this.emissive = new Yi(0),
  16972. this.emissiveIntensity = 1,
  16973. this.emissiveMap = null,
  16974. this.bumpMap = null,
  16975. this.bumpScale = 1,
  16976. this.normalMap = null,
  16977. this.normalMapType = sn,
  16978. this.normalScale = new yn(1,1),
  16979. this.displacementMap = null,
  16980. this.displacementScale = 1,
  16981. this.displacementBias = 0,
  16982. this.roughnessMap = null,
  16983. this.metalnessMap = null,
  16984. this.alphaMap = null,
  16985. this.envMap = null,
  16986. this.envMapIntensity = 1,
  16987. this.refractionRatio = .98,
  16988. this.wireframe = !1,
  16989. this.wireframelineWidth = 1,
  16990. this.wireframeLinecap = "round",
  16991. this.wireframeLinejoin = "round",
  16992. this.skinning = !1,
  16993. this.morphTargets = !1,
  16994. this.morphNormals = !1,
  16995. this.vertexTangents = !1,
  16996. this.setValues(e)
  16997. }
  16998. function Vu(e) {
  16999. Hu.call(this),
  17000. this.defines = {
  17001. STANDARD: "",
  17002. PHYSICAL: ""
  17003. },
  17004. this.type = "MeshPhysicalMaterial",
  17005. this.clearcoat = 0,
  17006. this.clearcoatMap = null,
  17007. this.clearcoatRoughness = 0,
  17008. this.clearcoatRoughnessMap = null,
  17009. this.clearcoatNormalScale = new yn(1,1),
  17010. this.clearcoatNormalMap = null,
  17011. this.reflectivity = .5,
  17012. Object.defineProperty(this, "ior", {
  17013. get: function() {
  17014. return (1 + .4 * this.reflectivity) / (1 - .4 * this.reflectivity)
  17015. },
  17016. set: function(e) {
  17017. this.reflectivity = gn.clamp(2.5 * (e - 1) / (e + 1), 0, 1)
  17018. }
  17019. }),
  17020. this.sheen = null,
  17021. this.transmission = 0,
  17022. this.transmissionMap = null,
  17023. this.setValues(e)
  17024. }
  17025. function ju(e) {
  17026. Ki.call(this),
  17027. this.type = "MeshPhongMaterial",
  17028. this.color = new Yi(16777215),
  17029. this.specular = new Yi(1118481),
  17030. this.shininess = 30,
  17031. this.map = null,
  17032. this.lightMap = null,
  17033. this.lightMapIntensity = 1,
  17034. this.aoMap = null,
  17035. this.aoMapIntensity = 1,
  17036. this.emissive = new Yi(0),
  17037. this.emissiveIntensity = 1,
  17038. this.emissiveMap = null,
  17039. this.bumpMap = null,
  17040. this.bumpScale = 1,
  17041. this.normalMap = null,
  17042. this.normalMapType = sn,
  17043. this.normalScale = new yn(1,1),
  17044. this.displacementMap = null,
  17045. this.displacementScale = 1,
  17046. this.displacementBias = 0,
  17047. this.specularMap = null,
  17048. this.alphaMap = null,
  17049. this.envMap = null,
  17050. this.combine = k,
  17051. this.reflectivity = 1,
  17052. this.refractionRatio = .98,
  17053. this.wireframe = !1,
  17054. this.wireframelineWidth = 1,
  17055. this.wireframeLinecap = "round",
  17056. this.wireframeLinejoin = "round",
  17057. this.skinning = !1,
  17058. this.morphTargets = !1,
  17059. this.morphNormals = !1,
  17060. this.setValues(e)
  17061. }
  17062. function Wu(e) {
  17063. Ki.call(this),
  17064. this.defines = {
  17065. TOON: ""
  17066. },
  17067. this.type = "MeshToonMaterial",
  17068. this.color = new Yi(16777215),
  17069. this.map = null,
  17070. this.gradientMap = null,
  17071. this.lightMap = null,
  17072. this.lightMapIntensity = 1,
  17073. this.aoMap = null,
  17074. this.aoMapIntensity = 1,
  17075. this.emissive = new Yi(0),
  17076. this.emissiveIntensity = 1,
  17077. this.emissiveMap = null,
  17078. this.bumpMap = null,
  17079. this.bumpScale = 1,
  17080. this.normalMap = null,
  17081. this.normalMapType = sn,
  17082. this.normalScale = new yn(1,1),
  17083. this.displacementMap = null,
  17084. this.displacementScale = 1,
  17085. this.displacementBias = 0,
  17086. this.alphaMap = null,
  17087. this.wireframe = !1,
  17088. this.wireframelineWidth = 1,
  17089. this.wireframeLinecap = "round",
  17090. this.wireframeLinejoin = "round",
  17091. this.skinning = !1,
  17092. this.morphTargets = !1,
  17093. this.morphNormals = !1,
  17094. this.setValues(e)
  17095. }
  17096. function Xu(e) {
  17097. Ki.call(this),
  17098. this.type = "MeshNormalMaterial",
  17099. this.bumpMap = null,
  17100. this.bumpScale = 1,
  17101. this.normalMap = null,
  17102. this.normalMapType = sn,
  17103. this.normalScale = new yn(1,1),
  17104. this.displacementMap = null,
  17105. this.displacementScale = 1,
  17106. this.displacementBias = 0,
  17107. this.wireframe = !1,
  17108. this.wireframelineWidth = 1,
  17109. this.fog = !1,
  17110. this.skinning = !1,
  17111. this.morphTargets = !1,
  17112. this.morphNormals = !1,
  17113. this.setValues(e)
  17114. }
  17115. function qu(e) {
  17116. Ki.call(this),
  17117. this.type = "MeshLambertMaterial",
  17118. this.color = new Yi(16777215),
  17119. this.map = null,
  17120. this.lightMap = null,
  17121. this.lightMapIntensity = 1,
  17122. this.aoMap = null,
  17123. this.aoMapIntensity = 1,
  17124. this.emissive = new Yi(0),
  17125. this.emissiveIntensity = 1,
  17126. this.emissiveMap = null,
  17127. this.specularMap = null,
  17128. this.alphaMap = null,
  17129. this.envMap = null,
  17130. this.combine = k,
  17131. this.reflectivity = 1,
  17132. this.refractionRatio = .98,
  17133. this.wireframe = !1,
  17134. this.wireframelineWidth = 1,
  17135. this.wireframeLinecap = "round",
  17136. this.wireframeLinejoin = "round",
  17137. this.skinning = !1,
  17138. this.morphTargets = !1,
  17139. this.morphNormals = !1,
  17140. this.setValues(e)
  17141. }
  17142. function Ju(e) {
  17143. Ki.call(this),
  17144. this.defines = {
  17145. MATCAP: ""
  17146. },
  17147. this.type = "MeshMatcapMaterial",
  17148. this.color = new Yi(16777215),
  17149. this.matcap = null,
  17150. this.map = null,
  17151. this.bumpMap = null,
  17152. this.bumpScale = 1,
  17153. this.normalMap = null,
  17154. this.normalMapType = sn,
  17155. this.normalScale = new yn(1,1),
  17156. this.displacementMap = null,
  17157. this.displacementScale = 1,
  17158. this.displacementBias = 0,
  17159. this.alphaMap = null,
  17160. this.skinning = !1,
  17161. this.morphTargets = !1,
  17162. this.morphNormals = !1,
  17163. this.setValues(e)
  17164. }
  17165. function Yu(e) {
  17166. tl.call(this),
  17167. this.type = "LineDashedMaterial",
  17168. this.scale = 1,
  17169. this.dashSize = 3,
  17170. this.gapSize = 1,
  17171. this.setValues(e)
  17172. }
  17173. ((Uu.prototype = Object.create(Ki.prototype)).constructor = Uu).prototype.isShadowMaterial = !0,
  17174. Uu.prototype.copy = function(e) {
  17175. return Ki.prototype.copy.call(this, e),
  17176. this.color.copy(e.color),
  17177. this
  17178. }
  17179. ,
  17180. ((Gu.prototype = Object.create(Qr.prototype)).constructor = Gu).prototype.isRawShaderMaterial = !0,
  17181. ((Hu.prototype = Object.create(Ki.prototype)).constructor = Hu).prototype.isMeshStandardMaterial = !0,
  17182. Hu.prototype.copy = function(e) {
  17183. return Ki.prototype.copy.call(this, e),
  17184. this.defines = {
  17185. STANDARD: ""
  17186. },
  17187. this.color.copy(e.color),
  17188. this.roughness = e.roughness,
  17189. this.metalness = e.metalness,
  17190. this.map = e.map,
  17191. this.lightMap = e.lightMap,
  17192. this.lightMapIntensity = e.lightMapIntensity,
  17193. this.aoMap = e.aoMap,
  17194. this.aoMapIntensity = e.aoMapIntensity,
  17195. this.emissive.copy(e.emissive),
  17196. this.emissiveMap = e.emissiveMap,
  17197. this.emissiveIntensity = e.emissiveIntensity,
  17198. this.bumpMap = e.bumpMap,
  17199. this.bumpScale = e.bumpScale,
  17200. this.normalMap = e.normalMap,
  17201. this.normalMapType = e.normalMapType,
  17202. this.normalScale.copy(e.normalScale),
  17203. this.displacementMap = e.displacementMap,
  17204. this.displacementScale = e.displacementScale,
  17205. this.displacementBias = e.displacementBias,
  17206. this.roughnessMap = e.roughnessMap,
  17207. this.metalnessMap = e.metalnessMap,
  17208. this.alphaMap = e.alphaMap,
  17209. this.envMap = e.envMap,
  17210. this.envMapIntensity = e.envMapIntensity,
  17211. this.refractionRatio = e.refractionRatio,
  17212. this.wireframe = e.wireframe,
  17213. this.wireframelineWidth = e.wireframelineWidth,
  17214. this.wireframeLinecap = e.wireframeLinecap,
  17215. this.wireframeLinejoin = e.wireframeLinejoin,
  17216. this.skinning = e.skinning,
  17217. this.morphTargets = e.morphTargets,
  17218. this.morphNormals = e.morphNormals,
  17219. this.vertexTangents = e.vertexTangents,
  17220. this
  17221. }
  17222. ,
  17223. ((Vu.prototype = Object.create(Hu.prototype)).constructor = Vu).prototype.isMeshPhysicalMaterial = !0,
  17224. Vu.prototype.copy = function(e) {
  17225. return Hu.prototype.copy.call(this, e),
  17226. this.defines = {
  17227. STANDARD: "",
  17228. PHYSICAL: ""
  17229. },
  17230. this.clearcoat = e.clearcoat,
  17231. this.clearcoatMap = e.clearcoatMap,
  17232. this.clearcoatRoughness = e.clearcoatRoughness,
  17233. this.clearcoatRoughnessMap = e.clearcoatRoughnessMap,
  17234. this.clearcoatNormalMap = e.clearcoatNormalMap,
  17235. this.clearcoatNormalScale.copy(e.clearcoatNormalScale),
  17236. this.reflectivity = e.reflectivity,
  17237. e.sheen ? this.sheen = (this.sheen || new Yi).copy(e.sheen) : this.sheen = null,
  17238. this.transmission = e.transmission,
  17239. this.transmissionMap = e.transmissionMap,
  17240. this
  17241. }
  17242. ,
  17243. ((ju.prototype = Object.create(Ki.prototype)).constructor = ju).prototype.isMeshPhongMaterial = !0,
  17244. ju.prototype.copy = function(e) {
  17245. return Ki.prototype.copy.call(this, e),
  17246. this.color.copy(e.color),
  17247. this.specular.copy(e.specular),
  17248. this.shininess = e.shininess,
  17249. this.map = e.map,
  17250. this.lightMap = e.lightMap,
  17251. this.lightMapIntensity = e.lightMapIntensity,
  17252. this.aoMap = e.aoMap,
  17253. this.aoMapIntensity = e.aoMapIntensity,
  17254. this.emissive.copy(e.emissive),
  17255. this.emissiveMap = e.emissiveMap,
  17256. this.emissiveIntensity = e.emissiveIntensity,
  17257. this.bumpMap = e.bumpMap,
  17258. this.bumpScale = e.bumpScale,
  17259. this.normalMap = e.normalMap,
  17260. this.normalMapType = e.normalMapType,
  17261. this.normalScale.copy(e.normalScale),
  17262. this.displacementMap = e.displacementMap,
  17263. this.displacementScale = e.displacementScale,
  17264. this.displacementBias = e.displacementBias,
  17265. this.specularMap = e.specularMap,
  17266. this.alphaMap = e.alphaMap,
  17267. this.envMap = e.envMap,
  17268. this.combine = e.combine,
  17269. this.reflectivity = e.reflectivity,
  17270. this.refractionRatio = e.refractionRatio,
  17271. this.wireframe = e.wireframe,
  17272. this.wireframelineWidth = e.wireframelineWidth,
  17273. this.wireframeLinecap = e.wireframeLinecap,
  17274. this.wireframeLinejoin = e.wireframeLinejoin,
  17275. this.skinning = e.skinning,
  17276. this.morphTargets = e.morphTargets,
  17277. this.morphNormals = e.morphNormals,
  17278. this
  17279. }
  17280. ,
  17281. ((Wu.prototype = Object.create(Ki.prototype)).constructor = Wu).prototype.isMeshToonMaterial = !0,
  17282. Wu.prototype.copy = function(e) {
  17283. return Ki.prototype.copy.call(this, e),
  17284. this.color.copy(e.color),
  17285. this.map = e.map,
  17286. this.gradientMap = e.gradientMap,
  17287. this.lightMap = e.lightMap,
  17288. this.lightMapIntensity = e.lightMapIntensity,
  17289. this.aoMap = e.aoMap,
  17290. this.aoMapIntensity = e.aoMapIntensity,
  17291. this.emissive.copy(e.emissive),
  17292. this.emissiveMap = e.emissiveMap,
  17293. this.emissiveIntensity = e.emissiveIntensity,
  17294. this.bumpMap = e.bumpMap,
  17295. this.bumpScale = e.bumpScale,
  17296. this.normalMap = e.normalMap,
  17297. this.normalMapType = e.normalMapType,
  17298. this.normalScale.copy(e.normalScale),
  17299. this.displacementMap = e.displacementMap,
  17300. this.displacementScale = e.displacementScale,
  17301. this.displacementBias = e.displacementBias,
  17302. this.alphaMap = e.alphaMap,
  17303. this.wireframe = e.wireframe,
  17304. this.wireframelineWidth = e.wireframelineWidth,
  17305. this.wireframeLinecap = e.wireframeLinecap,
  17306. this.wireframeLinejoin = e.wireframeLinejoin,
  17307. this.skinning = e.skinning,
  17308. this.morphTargets = e.morphTargets,
  17309. this.morphNormals = e.morphNormals,
  17310. this
  17311. }
  17312. ,
  17313. ((Xu.prototype = Object.create(Ki.prototype)).constructor = Xu).prototype.isMeshNormalMaterial = !0,
  17314. Xu.prototype.copy = function(e) {
  17315. return Ki.prototype.copy.call(this, e),
  17316. this.bumpMap = e.bumpMap,
  17317. this.bumpScale = e.bumpScale,
  17318. this.normalMap = e.normalMap,
  17319. this.normalMapType = e.normalMapType,
  17320. this.normalScale.copy(e.normalScale),
  17321. this.displacementMap = e.displacementMap,
  17322. this.displacementScale = e.displacementScale,
  17323. this.displacementBias = e.displacementBias,
  17324. this.wireframe = e.wireframe,
  17325. this.wireframelineWidth = e.wireframelineWidth,
  17326. this.skinning = e.skinning,
  17327. this.morphTargets = e.morphTargets,
  17328. this.morphNormals = e.morphNormals,
  17329. this
  17330. }
  17331. ,
  17332. ((qu.prototype = Object.create(Ki.prototype)).constructor = qu).prototype.isMeshLambertMaterial = !0,
  17333. qu.prototype.copy = function(e) {
  17334. return Ki.prototype.copy.call(this, e),
  17335. this.color.copy(e.color),
  17336. this.map = e.map,
  17337. this.lightMap = e.lightMap,
  17338. this.lightMapIntensity = e.lightMapIntensity,
  17339. this.aoMap = e.aoMap,
  17340. this.aoMapIntensity = e.aoMapIntensity,
  17341. this.emissive.copy(e.emissive),
  17342. this.emissiveMap = e.emissiveMap,
  17343. this.emissiveIntensity = e.emissiveIntensity,
  17344. this.specularMap = e.specularMap,
  17345. this.alphaMap = e.alphaMap,
  17346. this.envMap = e.envMap,
  17347. this.combine = e.combine,
  17348. this.reflectivity = e.reflectivity,
  17349. this.refractionRatio = e.refractionRatio,
  17350. this.wireframe = e.wireframe,
  17351. this.wireframelineWidth = e.wireframelineWidth,
  17352. this.wireframeLinecap = e.wireframeLinecap,
  17353. this.wireframeLinejoin = e.wireframeLinejoin,
  17354. this.skinning = e.skinning,
  17355. this.morphTargets = e.morphTargets,
  17356. this.morphNormals = e.morphNormals,
  17357. this
  17358. }
  17359. ,
  17360. ((Ju.prototype = Object.create(Ki.prototype)).constructor = Ju).prototype.isMeshMatcapMaterial = !0,
  17361. Ju.prototype.copy = function(e) {
  17362. return Ki.prototype.copy.call(this, e),
  17363. this.defines = {
  17364. MATCAP: ""
  17365. },
  17366. this.color.copy(e.color),
  17367. this.matcap = e.matcap,
  17368. this.map = e.map,
  17369. this.bumpMap = e.bumpMap,
  17370. this.bumpScale = e.bumpScale,
  17371. this.normalMap = e.normalMap,
  17372. this.normalMapType = e.normalMapType,
  17373. this.normalScale.copy(e.normalScale),
  17374. this.displacementMap = e.displacementMap,
  17375. this.displacementScale = e.displacementScale,
  17376. this.displacementBias = e.displacementBias,
  17377. this.alphaMap = e.alphaMap,
  17378. this.skinning = e.skinning,
  17379. this.morphTargets = e.morphTargets,
  17380. this.morphNormals = e.morphNormals,
  17381. this
  17382. }
  17383. ,
  17384. ((Yu.prototype = Object.create(tl.prototype)).constructor = Yu).prototype.isLineDashedMaterial = !0,
  17385. Yu.prototype.copy = function(e) {
  17386. return tl.prototype.copy.call(this, e),
  17387. this.scale = e.scale,
  17388. this.dashSize = e.dashSize,
  17389. this.gapSize = e.gapSize,
  17390. this
  17391. }
  17392. ;
  17393. var Zu = Object.freeze({
  17394. __proto__: null,
  17395. ShadowMaterial: Uu,
  17396. SpriteMaterial: Es,
  17397. RawShaderMaterial: Gu,
  17398. ShaderMaterial: Qr,
  17399. PointsMaterial: hl,
  17400. MeshPhysicalMaterial: Vu,
  17401. MeshStandardMaterial: Hu,
  17402. MeshPhongMaterial: ju,
  17403. MeshToonMaterial: Wu,
  17404. MeshNormalMaterial: Xu,
  17405. MeshLambertMaterial: qu,
  17406. MeshDepthMaterial: es,
  17407. MeshDistanceMaterial: ts,
  17408. MeshBasicMaterial: $i,
  17409. MeshMatcapMaterial: Ju,
  17410. LineDashedMaterial: Yu,
  17411. LineBasicMaterial: tl,
  17412. Material: Ki
  17413. })
  17414. , Qu = {
  17415. arraySlice: function(e, t, n) {
  17416. return Qu.isTypedArray(e) ? new e.constructor(e.subarray(t, void 0 !== n ? n : e.length)) : e.slice(t, n)
  17417. },
  17418. convertArray: function(e, t, n) {
  17419. return !e || !n && e.constructor === t ? e : "number" == typeof t.BYTES_PER_ELEMENT ? new t(e) : Array.prototype.slice.call(e)
  17420. },
  17421. isTypedArray: function(e) {
  17422. return ArrayBuffer.isView(e) && !(e instanceof DataView)
  17423. },
  17424. getKeyframeOrder: function(n) {
  17425. for (var e = n.length, t = new Array(e), i = 0; i !== e; ++i)
  17426. t[i] = i;
  17427. return t.sort(function(e, t) {
  17428. return n[e] - n[t]
  17429. }),
  17430. t
  17431. },
  17432. sortedArray: function(e, t, n) {
  17433. for (var i = e.length, r = new e.constructor(i), a = 0, o = 0; o !== i; ++a)
  17434. for (var s = n[a] * t, l = 0; l !== t; ++l)
  17435. r[o++] = e[s + l];
  17436. return r
  17437. },
  17438. flattenJSON: function(e, t, n, i) {
  17439. for (var r = 1, a = e[0]; void 0 !== a && void 0 === a[i]; )
  17440. a = e[r++];
  17441. if (void 0 !== a) {
  17442. var o = a[i];
  17443. if (void 0 !== o)
  17444. if (Array.isArray(o))
  17445. for (; void 0 !== (o = a[i]) && (t.push(a.time),
  17446. n.push.apply(n, o)),
  17447. void 0 !== (a = e[r++]); )
  17448. ;
  17449. else if (void 0 !== o.toArray)
  17450. for (; void 0 !== (o = a[i]) && (t.push(a.time),
  17451. o.toArray(n, n.length)),
  17452. void 0 !== (a = e[r++]); )
  17453. ;
  17454. else
  17455. for (; void 0 !== (o = a[i]) && (t.push(a.time),
  17456. n.push(o)),
  17457. void 0 !== (a = e[r++]); )
  17458. ;
  17459. }
  17460. },
  17461. subclip: function(e, t, n, i) {
  17462. var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 30
  17463. , a = e.clone();
  17464. a.name = t;
  17465. for (var o = [], s = 0; s < a.tracks.length; ++s) {
  17466. for (var l = a.tracks[s], u = l.getValueSize(), c = [], d = [], h = 0; h < l.times.length; ++h) {
  17467. var p = l.times[h] * r;
  17468. if (!(p < n || i <= p)) {
  17469. c.push(l.times[h]);
  17470. for (var f = 0; f < u; ++f)
  17471. d.push(l.values[h * u + f])
  17472. }
  17473. }
  17474. 0 !== c.length && (l.times = Qu.convertArray(c, l.times.constructor),
  17475. l.values = Qu.convertArray(d, l.values.constructor),
  17476. o.push(l))
  17477. }
  17478. a.tracks = o;
  17479. for (var m = 1 / 0, v = 0; v < a.tracks.length; ++v)
  17480. m > a.tracks[v].times[0] && (m = a.tracks[v].times[0]);
  17481. for (var g = 0; g < a.tracks.length; ++g)
  17482. a.tracks[g].shift(-1 * m);
  17483. return a.resetDuration(),
  17484. a
  17485. },
  17486. makeClipAdditive: function(v) {
  17487. for (var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, g = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : v, t = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 30, n = g.tracks.length, y = e / (t = t <= 0 ? 30 : t), i = 0; i < n; ++i)
  17488. (function(e) {
  17489. var t = g.tracks[e]
  17490. , n = t.ValueTypeName;
  17491. if ("bool" === n || "string" === n)
  17492. return;
  17493. var i = v.tracks.find(function(e) {
  17494. return e.name === t.name && e.ValueTypeName === n
  17495. });
  17496. if (void 0 === i)
  17497. return;
  17498. var r = 0
  17499. , a = t.getValueSize();
  17500. t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (r = a / 3);
  17501. var o = 0
  17502. , s = i.getValueSize();
  17503. i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (o = s / 3);
  17504. var l, u = t.times.length - 1, c = void 0;
  17505. c = y <= t.times[0] ? (e = r,
  17506. Qu.arraySlice(t.values, e, a - r)) : y >= t.times[u] ? Qu.arraySlice(t.values, l = u * a + r, l + a - r) : (a = a - (l = r),
  17507. (r = t.createInterpolant()).evaluate(y),
  17508. Qu.arraySlice(r.resultBuffer, l, a)),
  17509. "quaternion" === n && (new Sn).fromArray(c).normalize().conjugate().toArray(c);
  17510. for (var d = i.times.length, h = 0; h < d; ++h) {
  17511. var p = h * s + o;
  17512. if ("quaternion" === n)
  17513. Sn.multiplyQuaternionsFlat(i.values, p, c, 0, i.values, p);
  17514. else
  17515. for (var f = s - 2 * o, m = 0; m < f; ++m)
  17516. i.values[p + m] -= c[m]
  17517. }
  17518. }
  17519. )(i);
  17520. return v.blendMode = 2501,
  17521. v
  17522. }
  17523. };
  17524. function Ku(e, t, n, i) {
  17525. this.parameterPositions = e,
  17526. this._cachedIndex = 0,
  17527. this.resultBuffer = void 0 !== i ? i : new t.constructor(n),
  17528. this.sampleValues = t,
  17529. this.valueSize = n
  17530. }
  17531. function $u(e, t, n, i) {
  17532. Ku.call(this, e, t, n, i),
  17533. this._weightPrev = -0,
  17534. this._offsetPrev = -0,
  17535. this._weightNext = -0,
  17536. this._offsetNext = -0
  17537. }
  17538. function ec(e, t, n, i) {
  17539. Ku.call(this, e, t, n, i)
  17540. }
  17541. function tc(e, t, n, i) {
  17542. Ku.call(this, e, t, n, i)
  17543. }
  17544. function nc(e, t, n, i) {
  17545. if (void 0 === e)
  17546. throw new Error("THREE.KeyframeTrack: track name is undefined");
  17547. if (void 0 === t || 0 === t.length)
  17548. throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e);
  17549. this.name = e,
  17550. this.times = Qu.convertArray(t, this.TimeBufferType),
  17551. this.values = Qu.convertArray(n, this.ValueBufferType),
  17552. this.setInterpolation(i || this.DefaultInterpolation)
  17553. }
  17554. function ic(e, t, n) {
  17555. nc.call(this, e, t, n)
  17556. }
  17557. function rc(e, t, n, i) {
  17558. nc.call(this, e, t, n, i)
  17559. }
  17560. function ac(e, t, n, i) {
  17561. nc.call(this, e, t, n, i)
  17562. }
  17563. function oc(e, t, n, i) {
  17564. Ku.call(this, e, t, n, i)
  17565. }
  17566. function sc(e, t, n, i) {
  17567. nc.call(this, e, t, n, i)
  17568. }
  17569. function lc(e, t, n, i) {
  17570. nc.call(this, e, t, n, i)
  17571. }
  17572. function uc(e, t, n, i) {
  17573. nc.call(this, e, t, n, i)
  17574. }
  17575. function cc(e) {
  17576. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : -1
  17577. , n = 2 < arguments.length ? arguments[2] : void 0
  17578. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2500;
  17579. this.name = e,
  17580. this.tracks = n,
  17581. this.duration = t,
  17582. this.blendMode = i,
  17583. this.uuid = gn.generateUUID(),
  17584. this.duration < 0 && this.resetDuration()
  17585. }
  17586. function dc(e) {
  17587. if (void 0 === e.type)
  17588. throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
  17589. var t, n, i = function(e) {
  17590. switch (e.toLowerCase()) {
  17591. case "scalar":
  17592. case "double":
  17593. case "float":
  17594. case "number":
  17595. case "integer":
  17596. return ac;
  17597. case "vector":
  17598. case "vector2":
  17599. case "vector3":
  17600. case "vector4":
  17601. return uc;
  17602. case "color":
  17603. return rc;
  17604. case "quaternion":
  17605. return sc;
  17606. case "bool":
  17607. case "boolean":
  17608. return ic;
  17609. case "string":
  17610. return lc
  17611. }
  17612. throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + e)
  17613. }(e.type);
  17614. return void 0 === e.times && (Qu.flattenJSON(e.keys, t = [], n = [], "value"),
  17615. e.times = t,
  17616. e.values = n),
  17617. void 0 !== i.parse ? i.parse(e) : new i(e.name,e.times,e.values,e.interpolation)
  17618. }
  17619. Object.assign(Ku.prototype, {
  17620. evaluate: function(e) {
  17621. var t, n = this.parameterPositions, i = this._cachedIndex, r = n[i], a = n[i - 1];
  17622. e: {
  17623. t: {
  17624. n: {
  17625. i: if (!(e < r)) {
  17626. for (var o = i + 2; ; ) {
  17627. if (void 0 === r) {
  17628. if (e < a)
  17629. break i;
  17630. return i = n.length,
  17631. this._cachedIndex = i,
  17632. this.afterEnd_(i - 1, e, a)
  17633. }
  17634. if (i === o)
  17635. break;
  17636. if (a = r,
  17637. e < (r = n[++i]))
  17638. break t
  17639. }
  17640. t = n.length;
  17641. break n
  17642. }
  17643. if (a <= e)
  17644. break e;
  17645. var s = n[1];
  17646. e < s && (i = 2,
  17647. a = s);
  17648. for (var l = i - 2; ; ) {
  17649. if (void 0 === a)
  17650. return this._cachedIndex = 0,
  17651. this.beforeStart_(0, e, r);
  17652. if (i === l)
  17653. break;
  17654. if (r = a,
  17655. (a = n[--i - 1]) <= e)
  17656. break t
  17657. }
  17658. t = i,
  17659. i = 0
  17660. }
  17661. for (; i < t; ) {
  17662. var u = i + t >>> 1;
  17663. e < n[u] ? t = u : i = 1 + u
  17664. }
  17665. if (r = n[i],
  17666. void 0 === (a = n[i - 1]))
  17667. return this._cachedIndex = 0,
  17668. this.beforeStart_(0, e, r);
  17669. if (void 0 === r)
  17670. return i = n.length,
  17671. this._cachedIndex = i,
  17672. this.afterEnd_(i - 1, a, e)
  17673. }
  17674. this._cachedIndex = i,
  17675. this.intervalChanged_(i, a, r)
  17676. }
  17677. return this.interpolate_(i, a, e, r)
  17678. },
  17679. settings: null,
  17680. DefaultSettings_: {},
  17681. getSettings_: function() {
  17682. return this.settings || this.DefaultSettings_
  17683. },
  17684. copySampleValue_: function(e) {
  17685. for (var t = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = e * i, a = 0; a !== i; ++a)
  17686. t[a] = n[r + a];
  17687. return t
  17688. },
  17689. interpolate_: function() {
  17690. throw new Error("call to abstract method")
  17691. },
  17692. intervalChanged_: function() {}
  17693. }),
  17694. Object.assign(Ku.prototype, {
  17695. beforeStart_: Ku.prototype.copySampleValue_,
  17696. afterEnd_: Ku.prototype.copySampleValue_
  17697. }),
  17698. $u.prototype = Object.assign(Object.create(Ku.prototype), {
  17699. constructor: $u,
  17700. DefaultSettings_: {
  17701. endingStart: en,
  17702. endingEnd: en
  17703. },
  17704. intervalChanged_: function(e, t, n) {
  17705. var i = this.parameterPositions
  17706. , r = e - 2
  17707. , a = e + 1
  17708. , o = i[r]
  17709. , s = i[a];
  17710. if (void 0 === o)
  17711. switch (this.getSettings_().endingStart) {
  17712. case tn:
  17713. r = e,
  17714. o = 2 * t - n;
  17715. break;
  17716. case nn:
  17717. o = t + i[r = i.length - 2] - i[r + 1];
  17718. break;
  17719. default:
  17720. r = e,
  17721. o = n
  17722. }
  17723. if (void 0 === s)
  17724. switch (this.getSettings_().endingEnd) {
  17725. case tn:
  17726. a = e,
  17727. s = 2 * n - t;
  17728. break;
  17729. case nn:
  17730. s = n + i[a = 1] - i[0];
  17731. break;
  17732. default:
  17733. a = e - 1,
  17734. s = t
  17735. }
  17736. var l = .5 * (n - t)
  17737. , u = this.valueSize;
  17738. this._weightPrev = l / (t - o),
  17739. this._weightNext = l / (s - n),
  17740. this._offsetPrev = r * u,
  17741. this._offsetNext = a * u
  17742. },
  17743. interpolate_: function(e, t, n, i) {
  17744. for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, l = s - o, u = this._offsetPrev, c = this._offsetNext, d = this._weightPrev, e = this._weightNext, n = (n - t) / (i - t), i = n * n, t = i * n, h = -d * t + 2 * d * i - d * n, p = (1 + d) * t + (-1.5 - 2 * d) * i + (-.5 + d) * n + 1, f = (-1 - e) * t + (1.5 + e) * i + .5 * n, m = e * t - e * i, v = 0; v !== o; ++v)
  17745. r[v] = h * a[u + v] + p * a[l + v] + f * a[s + v] + m * a[c + v];
  17746. return r
  17747. }
  17748. }),
  17749. ec.prototype = Object.assign(Object.create(Ku.prototype), {
  17750. constructor: ec,
  17751. interpolate_: function(e, t, n, i) {
  17752. for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, l = s - o, u = (n - t) / (i - t), c = 1 - u, d = 0; d !== o; ++d)
  17753. r[d] = a[l + d] * c + a[s + d] * u;
  17754. return r
  17755. }
  17756. }),
  17757. tc.prototype = Object.assign(Object.create(Ku.prototype), {
  17758. constructor: tc,
  17759. interpolate_: function(e) {
  17760. return this.copySampleValue_(e - 1)
  17761. }
  17762. }),
  17763. Object.assign(nc, {
  17764. toJSON: function(e) {
  17765. var t, n = e.constructor;
  17766. return void 0 !== n.toJSON ? t = n.toJSON(e) : (t = {
  17767. name: e.name,
  17768. times: Qu.convertArray(e.times, Array),
  17769. values: Qu.convertArray(e.values, Array)
  17770. },
  17771. (n = e.getInterpolation()) !== e.DefaultInterpolation && (t.interpolation = n)),
  17772. t.type = e.ValueTypeName,
  17773. t
  17774. }
  17775. }),
  17776. Object.assign(nc.prototype, {
  17777. constructor: nc,
  17778. TimeBufferType: Float32Array,
  17779. ValueBufferType: Float32Array,
  17780. DefaultInterpolation: $t,
  17781. InterpolantFactoryMethodDiscrete: function(e) {
  17782. return new tc(this.times,this.values,this.getValueSize(),e)
  17783. },
  17784. InterpolantFactoryMethodLinear: function(e) {
  17785. return new ec(this.times,this.values,this.getValueSize(),e)
  17786. },
  17787. InterpolantFactoryMethodSmooth: function(e) {
  17788. return new $u(this.times,this.values,this.getValueSize(),e)
  17789. },
  17790. setInterpolation: function(e) {
  17791. var t;
  17792. switch (e) {
  17793. case Kt:
  17794. t = this.InterpolantFactoryMethodDiscrete;
  17795. break;
  17796. case $t:
  17797. t = this.InterpolantFactoryMethodLinear;
  17798. break;
  17799. case 2302:
  17800. t = this.InterpolantFactoryMethodSmooth
  17801. }
  17802. if (void 0 !== t)
  17803. return this.createInterpolant = t,
  17804. this;
  17805. var n = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name;
  17806. if (void 0 === this.createInterpolant) {
  17807. if (e === this.DefaultInterpolation)
  17808. throw new Error(n);
  17809. this.setInterpolation(this.DefaultInterpolation)
  17810. }
  17811. return console.warn("THREE.KeyframeTrack:", n),
  17812. this
  17813. },
  17814. getInterpolation: function() {
  17815. switch (this.createInterpolant) {
  17816. case this.InterpolantFactoryMethodDiscrete:
  17817. return Kt;
  17818. case this.InterpolantFactoryMethodLinear:
  17819. return $t;
  17820. case this.InterpolantFactoryMethodSmooth:
  17821. return 2302
  17822. }
  17823. },
  17824. getValueSize: function() {
  17825. return this.values.length / this.times.length
  17826. },
  17827. shift: function(e) {
  17828. if (0 !== e)
  17829. for (var t = this.times, n = 0, i = t.length; n !== i; ++n)
  17830. t[n] += e;
  17831. return this
  17832. },
  17833. scale: function(e) {
  17834. if (1 !== e)
  17835. for (var t = this.times, n = 0, i = t.length; n !== i; ++n)
  17836. t[n] *= e;
  17837. return this
  17838. },
  17839. trim: function(e, t) {
  17840. for (var n, i = this.times, r = i.length, a = 0, o = r - 1; a !== r && i[a] < e; )
  17841. ++a;
  17842. for (; -1 !== o && i[o] > t; )
  17843. --o;
  17844. return ++o,
  17845. 0 === a && o === r || (o <= a && (a = (o = Math.max(o, 1)) - 1),
  17846. n = this.getValueSize(),
  17847. this.times = Qu.arraySlice(i, a, o),
  17848. this.values = Qu.arraySlice(this.values, a * n, o * n)),
  17849. this
  17850. },
  17851. validate: function() {
  17852. var e = !0
  17853. , t = this.getValueSize();
  17854. t - Math.floor(t) != 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this),
  17855. e = !1);
  17856. var n = this.times
  17857. , i = this.values
  17858. , r = n.length;
  17859. 0 === r && (console.error("THREE.KeyframeTrack: Track is empty.", this),
  17860. e = !1);
  17861. for (var a = null, o = 0; o !== r; o++) {
  17862. var s = n[o];
  17863. if ("number" == typeof s && isNaN(s)) {
  17864. console.error("THREE.KeyframeTrack: Time is not a valid number.", this, o, s),
  17865. e = !1;
  17866. break
  17867. }
  17868. if (null !== a && s < a) {
  17869. console.error("THREE.KeyframeTrack: Out of order keys.", this, o, s, a),
  17870. e = !1;
  17871. break
  17872. }
  17873. a = s
  17874. }
  17875. if (void 0 !== i && Qu.isTypedArray(i))
  17876. for (var l = 0, u = i.length; l !== u; ++l) {
  17877. var c = i[l];
  17878. if (isNaN(c)) {
  17879. console.error("THREE.KeyframeTrack: Value is not a valid number.", this, l, c),
  17880. e = !1;
  17881. break
  17882. }
  17883. }
  17884. return e
  17885. },
  17886. optimize: function() {
  17887. for (var e = Qu.arraySlice(this.times), t = Qu.arraySlice(this.values), n = this.getValueSize(), i = 2302 === this.getInterpolation(), r = e.length - 1, a = 1, o = 1; o < r; ++o) {
  17888. var s = !1
  17889. , l = e[o];
  17890. if (l !== e[o + 1] && (1 !== o || l !== l[0]))
  17891. if (i)
  17892. s = !0;
  17893. else
  17894. for (var u = o * n, c = u - n, d = u + n, h = 0; h !== n; ++h) {
  17895. var p = t[u + h];
  17896. if (p !== t[c + h] || p !== t[d + h]) {
  17897. s = !0;
  17898. break
  17899. }
  17900. }
  17901. if (s) {
  17902. if (o !== a) {
  17903. e[a] = e[o];
  17904. for (var f = o * n, m = a * n, v = 0; v !== n; ++v)
  17905. t[m + v] = t[f + v]
  17906. }
  17907. ++a
  17908. }
  17909. }
  17910. if (0 < r) {
  17911. e[a] = e[r];
  17912. for (var g = r * n, y = a * n, w = 0; w !== n; ++w)
  17913. t[y + w] = t[g + w];
  17914. ++a
  17915. }
  17916. return a !== e.length ? (this.times = Qu.arraySlice(e, 0, a),
  17917. this.values = Qu.arraySlice(t, 0, a * n)) : (this.times = e,
  17918. this.values = t),
  17919. this
  17920. },
  17921. clone: function() {
  17922. var e = Qu.arraySlice(this.times, 0)
  17923. , t = Qu.arraySlice(this.values, 0)
  17924. , t = new this.constructor(this.name,e,t);
  17925. return t.createInterpolant = this.createInterpolant,
  17926. t
  17927. }
  17928. }),
  17929. ic.prototype = Object.assign(Object.create(nc.prototype), {
  17930. constructor: ic,
  17931. ValueTypeName: "bool",
  17932. ValueBufferType: Array,
  17933. DefaultInterpolation: Kt,
  17934. InterpolantFactoryMethodLinear: void 0,
  17935. InterpolantFactoryMethodSmooth: void 0
  17936. }),
  17937. rc.prototype = Object.assign(Object.create(nc.prototype), {
  17938. constructor: rc,
  17939. ValueTypeName: "color"
  17940. }),
  17941. ac.prototype = Object.assign(Object.create(nc.prototype), {
  17942. constructor: ac,
  17943. ValueTypeName: "number"
  17944. }),
  17945. oc.prototype = Object.assign(Object.create(Ku.prototype), {
  17946. constructor: oc,
  17947. interpolate_: function(e, t, n, i) {
  17948. for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = (n - t) / (i - t), l = e * o, u = l + o; l !== u; l += 4)
  17949. Sn.slerpFlat(r, 0, a, l - o, a, l, s);
  17950. return r
  17951. }
  17952. }),
  17953. sc.prototype = Object.assign(Object.create(nc.prototype), {
  17954. constructor: sc,
  17955. ValueTypeName: "quaternion",
  17956. DefaultInterpolation: $t,
  17957. InterpolantFactoryMethodLinear: function(e) {
  17958. return new oc(this.times,this.values,this.getValueSize(),e)
  17959. },
  17960. InterpolantFactoryMethodSmooth: void 0
  17961. }),
  17962. lc.prototype = Object.assign(Object.create(nc.prototype), {
  17963. constructor: lc,
  17964. ValueTypeName: "string",
  17965. ValueBufferType: Array,
  17966. DefaultInterpolation: Kt,
  17967. InterpolantFactoryMethodLinear: void 0,
  17968. InterpolantFactoryMethodSmooth: void 0
  17969. }),
  17970. uc.prototype = Object.assign(Object.create(nc.prototype), {
  17971. constructor: uc,
  17972. ValueTypeName: "vector"
  17973. }),
  17974. Object.assign(cc, {
  17975. parse: function(e) {
  17976. for (var t = [], n = e.tracks, i = 1 / (e.fps || 1), r = 0, a = n.length; r !== a; ++r)
  17977. t.push(dc(n[r]).scale(i));
  17978. var o = new cc(e.name,e.duration,t,e.blendMode);
  17979. return o.uuid = e.uuid,
  17980. o
  17981. },
  17982. toJSON: function(e) {
  17983. for (var t = [], n = e.tracks, e = {
  17984. name: e.name,
  17985. duration: e.duration,
  17986. tracks: t,
  17987. uuid: e.uuid,
  17988. blendMode: e.blendMode
  17989. }, i = 0, r = n.length; i !== r; ++i)
  17990. t.push(nc.toJSON(n[i]));
  17991. return e
  17992. },
  17993. CreateFromMorphTargetSequence: function(e, t, n, i) {
  17994. for (var r = t.length, a = [], o = 0; o < r; o++) {
  17995. var s = [];
  17996. (u = []).push((o + r - 1) % r, o, (o + 1) % r),
  17997. s.push(0, 1, 0);
  17998. var l = Qu.getKeyframeOrder(u)
  17999. , u = Qu.sortedArray(u, 1, l)
  18000. , s = Qu.sortedArray(s, 1, l);
  18001. i || 0 !== u[0] || (u.push(r),
  18002. s.push(s[0])),
  18003. a.push(new ac(".morphTargetInfluences[" + t[o].name + "]",u,s).scale(1 / n))
  18004. }
  18005. return new cc(e,-1,a)
  18006. },
  18007. findByName: function(e, t) {
  18008. var n = e;
  18009. Array.isArray(e) || (n = e.geometry && e.geometry.animations || e.animations);
  18010. for (var i = 0; i < n.length; i++)
  18011. if (n[i].name === t)
  18012. return n[i];
  18013. return null
  18014. },
  18015. CreateClipsFromMorphTargetSequences: function(e, t, n) {
  18016. for (var i = {}, r = /^([\w-]*?)([\d]+)$/, a = 0, o = e.length; a < o; a++) {
  18017. var s, l = e[a], u = l.name.match(r);
  18018. u && 1 < u.length && ((u = i[s = u[1]]) || (i[s] = u = []),
  18019. u.push(l))
  18020. }
  18021. var c, d = [];
  18022. for (c in i)
  18023. d.push(cc.CreateFromMorphTargetSequence(c, i[c], t, n));
  18024. return d
  18025. },
  18026. parseAnimation: function(e, t) {
  18027. if (!e)
  18028. return console.error("THREE.AnimationClip: No animation in JSONLoader data."),
  18029. null;
  18030. for (var n = function(e, t, n, i, r) {
  18031. var a;
  18032. 0 !== n.length && (Qu.flattenJSON(n, a = [], n = [], i),
  18033. 0 !== a.length && r.push(new e(t,a,n)))
  18034. }, i = [], r = e.name || "default", a = e.fps || 30, o = e.blendMode, s = e.length || -1, l = e.hierarchy || [], u = 0; u < l.length; u++) {
  18035. var c = l[u].keys;
  18036. if (c && 0 !== c.length)
  18037. if (c[0].morphTargets) {
  18038. for (var d, h = {}, p = void 0, p = 0; p < c.length; p++)
  18039. if (c[p].morphTargets)
  18040. for (var f = 0; f < c[p].morphTargets.length; f++)
  18041. h[c[p].morphTargets[f]] = -1;
  18042. for (d in h) {
  18043. for (var m = [], v = [], g = 0; g !== c[p].morphTargets.length; ++g) {
  18044. var y = c[p];
  18045. m.push(y.time),
  18046. v.push(y.morphTarget === d ? 1 : 0)
  18047. }
  18048. i.push(new ac(".morphTargetInfluence[" + d + "]",m,v))
  18049. }
  18050. s = h.length * (a || 1)
  18051. } else {
  18052. var w = ".bones[" + t[u].name + "]";
  18053. n(uc, w + ".position", c, "pos", i),
  18054. n(sc, w + ".quaternion", c, "rot", i),
  18055. n(uc, w + ".scale", c, "scl", i)
  18056. }
  18057. }
  18058. return 0 === i.length ? null : new cc(r,s,i,o)
  18059. }
  18060. }),
  18061. Object.assign(cc.prototype, {
  18062. resetDuration: function() {
  18063. for (var e = 0, t = 0, n = this.tracks.length; t !== n; ++t)
  18064. var i = this.tracks[t]
  18065. , e = Math.max(e, i.times[i.times.length - 1]);
  18066. return this.duration = e,
  18067. this
  18068. },
  18069. trim: function() {
  18070. for (var e = 0; e < this.tracks.length; e++)
  18071. this.tracks[e].trim(0, this.duration);
  18072. return this
  18073. },
  18074. validate: function() {
  18075. for (var e = !0, t = 0; t < this.tracks.length; t++)
  18076. e = e && this.tracks[t].validate();
  18077. return e
  18078. },
  18079. optimize: function() {
  18080. for (var e = 0; e < this.tracks.length; e++)
  18081. this.tracks[e].optimize();
  18082. return this
  18083. },
  18084. clone: function() {
  18085. for (var e = [], t = 0; t < this.tracks.length; t++)
  18086. e.push(this.tracks[t].clone());
  18087. return new cc(this.name,this.duration,e,this.blendMode)
  18088. },
  18089. toJSON: function() {
  18090. return cc.toJSON(this)
  18091. }
  18092. });
  18093. var hc = {
  18094. enabled: !1,
  18095. files: {},
  18096. add: function(e, t) {
  18097. !1 !== this.enabled && (this.files[e] = t)
  18098. },
  18099. get: function(e) {
  18100. if (!1 !== this.enabled)
  18101. return this.files[e]
  18102. },
  18103. remove: function(e) {
  18104. delete this.files[e]
  18105. },
  18106. clear: function() {
  18107. this.files = {}
  18108. }
  18109. };
  18110. function pc(e, t, n) {
  18111. var i = this
  18112. , r = !1
  18113. , a = 0
  18114. , o = 0
  18115. , s = void 0
  18116. , l = [];
  18117. this.onStart = void 0,
  18118. this.onLoad = e,
  18119. this.onProgress = t,
  18120. this.onError = n,
  18121. this.itemStart = function(e) {
  18122. o++,
  18123. !1 === r && void 0 !== i.onStart && i.onStart(e, a, o),
  18124. r = !0
  18125. }
  18126. ,
  18127. this.itemEnd = function(e) {
  18128. a++,
  18129. void 0 !== i.onProgress && i.onProgress(e, a, o),
  18130. a === o && (r = !1,
  18131. void 0 !== i.onLoad && i.onLoad())
  18132. }
  18133. ,
  18134. this.itemError = function(e) {
  18135. void 0 !== i.onError && i.onError(e)
  18136. }
  18137. ,
  18138. this.resolveURL = function(e) {
  18139. return s ? s(e) : e
  18140. }
  18141. ,
  18142. this.setURLModifier = function(e) {
  18143. return s = e,
  18144. this
  18145. }
  18146. ,
  18147. this.addHandler = function(e, t) {
  18148. return l.push(e, t),
  18149. this
  18150. }
  18151. ,
  18152. this.removeHandler = function(e) {
  18153. e = l.indexOf(e);
  18154. return -1 !== e && l.splice(e, 2),
  18155. this
  18156. }
  18157. ,
  18158. this.getHandler = function(e) {
  18159. for (var t = 0, n = l.length; t < n; t += 2) {
  18160. var i = l[t]
  18161. , r = l[t + 1];
  18162. if (i.global && (i.lastIndex = 0),
  18163. i.test(e))
  18164. return r
  18165. }
  18166. return null
  18167. }
  18168. }
  18169. var fc = new pc;
  18170. function mc(e) {
  18171. this.manager = void 0 !== e ? e : fc,
  18172. this.crossOrigin = "anonymous",
  18173. this.withCredentials = !1,
  18174. this.path = "",
  18175. this.resourcePath = "",
  18176. this.requestHeader = {}
  18177. }
  18178. Object.assign(mc.prototype, {
  18179. load: function() {},
  18180. loadAsync: function(n, i) {
  18181. var r = this;
  18182. return new Promise(function(e, t) {
  18183. r.load(n, e, i, t)
  18184. }
  18185. )
  18186. },
  18187. parse: function() {},
  18188. setCrossOrigin: function(e) {
  18189. return this.crossOrigin = e,
  18190. this
  18191. },
  18192. setWithCredentials: function(e) {
  18193. return this.withCredentials = e,
  18194. this
  18195. },
  18196. setPath: function(e) {
  18197. return this.path = e,
  18198. this
  18199. },
  18200. setResourcePath: function(e) {
  18201. return this.resourcePath = e,
  18202. this
  18203. },
  18204. setRequestHeader: function(e) {
  18205. return this.requestHeader = e,
  18206. this
  18207. }
  18208. });
  18209. var vc = {};
  18210. function gc(e) {
  18211. mc.call(this, e)
  18212. }
  18213. function yc(e) {
  18214. mc.call(this, e)
  18215. }
  18216. function wc(e) {
  18217. mc.call(this, e)
  18218. }
  18219. function bc(e) {
  18220. mc.call(this, e)
  18221. }
  18222. function xc(e) {
  18223. mc.call(this, e)
  18224. }
  18225. function Ec(e) {
  18226. mc.call(this, e)
  18227. }
  18228. function _c(e) {
  18229. mc.call(this, e)
  18230. }
  18231. function Mc() {
  18232. this.type = "Curve",
  18233. this.arcLengthDivisions = 200
  18234. }
  18235. function Ac(e, t, n, i, r, a, o, s) {
  18236. Mc.call(this),
  18237. this.type = "EllipseCurve",
  18238. this.aX = e || 0,
  18239. this.aY = t || 0,
  18240. this.xRadius = n || 1,
  18241. this.yRadius = i || 1,
  18242. this.aStartAngle = r || 0,
  18243. this.aEndAngle = a || 2 * Math.PI,
  18244. this.aClockwise = o || !1,
  18245. this.aRotation = s || 0
  18246. }
  18247. function Tc(e, t, n, i, r, a) {
  18248. Ac.call(this, e, t, n, n, i, r, a),
  18249. this.type = "ArcCurve"
  18250. }
  18251. function Sc() {
  18252. var r = 0
  18253. , a = 0
  18254. , o = 0
  18255. , s = 0;
  18256. function l(e, t, n, i) {
  18257. o = -3 * (r = e) + 3 * t - 2 * (a = n) - i,
  18258. s = 2 * e - 2 * t + n + i
  18259. }
  18260. return {
  18261. initCatmullRom: function(e, t, n, i, r) {
  18262. l(t, n, r * (n - e), r * (i - t))
  18263. },
  18264. initNonuniformCatmullRom: function(e, t, n, i, r, a, o) {
  18265. r = (t - e) / r - (n - e) / (r + a) + (n - t) / a,
  18266. o = (n - t) / a - (i - t) / (a + o) + (i - n) / o;
  18267. l(t, n, r *= a, o *= a)
  18268. },
  18269. calc: function(e) {
  18270. var t = e * e;
  18271. return r + a * e + o * t + s * (t * e)
  18272. }
  18273. }
  18274. }
  18275. gc.prototype = Object.assign(Object.create(mc.prototype), {
  18276. constructor: gc,
  18277. load: function(u, e, t, n) {
  18278. void 0 === u && (u = ""),
  18279. void 0 !== this.path && (u = this.path + u),
  18280. u = this.manager.resolveURL(u);
  18281. var c = this
  18282. , i = hc.get(u);
  18283. if (void 0 !== i)
  18284. return c.manager.itemStart(u),
  18285. setTimeout(function() {
  18286. e && e(i),
  18287. c.manager.itemEnd(u)
  18288. }, 0),
  18289. i;
  18290. if (void 0 === vc[u]) {
  18291. var r, a = u.match(/^data:(.*?)(;base64)?,(.*)$/);
  18292. if (a) {
  18293. var o = a[1]
  18294. , s = !!a[2]
  18295. , l = a[3]
  18296. , l = decodeURIComponent(l);
  18297. s && (l = atob(l));
  18298. try {
  18299. var d = (this.responseType || "").toLowerCase();
  18300. switch (d) {
  18301. case "arraybuffer":
  18302. case "blob":
  18303. for (var h = new Uint8Array(l.length), p = 0; p < l.length; p++)
  18304. h[p] = l.charCodeAt(p);
  18305. f = "blob" === d ? new Blob([h.buffer],{
  18306. type: o
  18307. }) : h.buffer;
  18308. break;
  18309. case "document":
  18310. var f = (new DOMParser).parseFromString(l, o);
  18311. break;
  18312. case "json":
  18313. f = JSON.parse(l);
  18314. break;
  18315. default:
  18316. f = l
  18317. }
  18318. setTimeout(function() {
  18319. e && e(f),
  18320. c.manager.itemEnd(u)
  18321. }, 0)
  18322. } catch (e) {
  18323. setTimeout(function() {
  18324. n && n(e),
  18325. c.manager.itemError(u),
  18326. c.manager.itemEnd(u)
  18327. }, 0)
  18328. }
  18329. } else {
  18330. for (var m in vc[u] = [],
  18331. vc[u].push({
  18332. onLoad: e,
  18333. onProgress: t,
  18334. onError: n
  18335. }),
  18336. (r = new XMLHttpRequest).open("GET", u, !0),
  18337. r.addEventListener("load", function(e) {
  18338. var t = this.response
  18339. , n = vc[u];
  18340. if (delete vc[u],
  18341. 200 === this.status || 0 === this.status) {
  18342. 0 === this.status && console.warn("THREE.FileLoader: HTTP Status 0 received."),
  18343. hc.add(u, t);
  18344. for (var i = 0, r = n.length; i < r; i++) {
  18345. var a = n[i];
  18346. a.onLoad && a.onLoad(t, e.total)
  18347. }
  18348. c.manager.itemEnd(u)
  18349. } else {
  18350. for (var o = 0, s = n.length; o < s; o++) {
  18351. var l = n[o];
  18352. l.onError && l.onError(e)
  18353. }
  18354. c.manager.itemError(u),
  18355. c.manager.itemEnd(u)
  18356. }
  18357. }, !1),
  18358. r.addEventListener("progress", function(e) {
  18359. for (var t = vc[u], n = 0, i = t.length; n < i; n++) {
  18360. var r = t[n];
  18361. r.onProgress && r.onProgress(e)
  18362. }
  18363. }, !1),
  18364. r.addEventListener("error", function(e) {
  18365. var t = vc[u];
  18366. delete vc[u];
  18367. for (var n = 0, i = t.length; n < i; n++) {
  18368. var r = t[n];
  18369. r.onError && r.onError(e)
  18370. }
  18371. c.manager.itemError(u),
  18372. c.manager.itemEnd(u)
  18373. }, !1),
  18374. r.addEventListener("abort", function(e) {
  18375. var t = vc[u];
  18376. delete vc[u];
  18377. for (var n = 0, i = t.length; n < i; n++) {
  18378. var r = t[n];
  18379. r.onError && r.onError(e)
  18380. }
  18381. c.manager.itemError(u),
  18382. c.manager.itemEnd(u)
  18383. }, !1),
  18384. void 0 !== this.responseType && (r.responseType = this.responseType),
  18385. void 0 !== this.withCredentials && (r.withCredentials = this.withCredentials),
  18386. r.overrideMimeType && r.overrideMimeType(void 0 !== this.mimeType ? this.mimeType : "text/plain"),
  18387. this.requestHeader)
  18388. r.setRequestHeader(m, this.requestHeader[m]);
  18389. r.send(null)
  18390. }
  18391. return c.manager.itemStart(u),
  18392. r
  18393. }
  18394. vc[u].push({
  18395. onLoad: e,
  18396. onProgress: t,
  18397. onError: n
  18398. })
  18399. },
  18400. setResponseType: function(e) {
  18401. return this.responseType = e,
  18402. this
  18403. },
  18404. setMimeType: function(e) {
  18405. return this.mimeType = e,
  18406. this
  18407. }
  18408. }),
  18409. yc.prototype = Object.assign(Object.create(mc.prototype), {
  18410. constructor: yc,
  18411. load: function(t, n, e, i) {
  18412. var r = this
  18413. , a = new gc(r.manager);
  18414. a.setPath(r.path),
  18415. a.setRequestHeader(r.requestHeader),
  18416. a.setWithCredentials(r.withCredentials),
  18417. a.load(t, function(e) {
  18418. try {
  18419. n(r.parse(JSON.parse(e)))
  18420. } catch (e) {
  18421. i ? i(e) : console.error(e),
  18422. r.manager.itemError(t)
  18423. }
  18424. }, e, i)
  18425. },
  18426. parse: function(e) {
  18427. for (var t = [], n = 0; n < e.length; n++) {
  18428. var i = cc.parse(e[n]);
  18429. t.push(i)
  18430. }
  18431. return t
  18432. }
  18433. }),
  18434. wc.prototype = Object.assign(Object.create(mc.prototype), {
  18435. constructor: wc,
  18436. load: function(e, a, n, i) {
  18437. var o = this
  18438. , s = []
  18439. , l = new bl
  18440. , r = new gc(this.manager);
  18441. r.setPath(this.path),
  18442. r.setResponseType("arraybuffer"),
  18443. r.setRequestHeader(this.requestHeader),
  18444. r.setWithCredentials(o.withCredentials);
  18445. var u = 0;
  18446. if (Array.isArray(e))
  18447. for (var t = 0, c = e.length; t < c; ++t)
  18448. !function(t) {
  18449. r.load(e[t], function(e) {
  18450. e = o.parse(e, !0);
  18451. s[t] = {
  18452. width: e.width,
  18453. height: e.height,
  18454. format: e.format,
  18455. mipmaps: e.mipmaps
  18456. },
  18457. 6 === (u += 1) && (1 === e.mipmapCount && (l.minFilter = Oe),
  18458. l.image = s,
  18459. l.format = e.format,
  18460. l.needsUpdate = !0,
  18461. a && a(l))
  18462. }, n, i)
  18463. }(t);
  18464. else
  18465. r.load(e, function(e) {
  18466. var t = o.parse(e, !0);
  18467. if (t.isCubemap) {
  18468. for (var n = t.mipmaps.length / t.mipmapCount, i = 0; i < n; i++) {
  18469. s[i] = {
  18470. mipmaps: []
  18471. };
  18472. for (var r = 0; r < t.mipmapCount; r++)
  18473. s[i].mipmaps.push(t.mipmaps[i * t.mipmapCount + r]),
  18474. s[i].format = t.format,
  18475. s[i].width = t.width,
  18476. s[i].height = t.height
  18477. }
  18478. l.image = s
  18479. } else
  18480. l.image.width = t.width,
  18481. l.image.height = t.height,
  18482. l.mipmaps = t.mipmaps;
  18483. 1 === t.mipmapCount && (l.minFilter = Oe),
  18484. l.format = t.format,
  18485. l.needsUpdate = !0,
  18486. a && a(l)
  18487. }, n, i);
  18488. return l
  18489. }
  18490. }),
  18491. bc.prototype = Object.assign(Object.create(mc.prototype), {
  18492. constructor: bc,
  18493. load: function(t, e, n, i) {
  18494. void 0 !== this.path && (t = this.path + t),
  18495. t = this.manager.resolveURL(t);
  18496. var r = this
  18497. , a = hc.get(t);
  18498. if (void 0 !== a)
  18499. return r.manager.itemStart(t),
  18500. setTimeout(function() {
  18501. e && e(a),
  18502. r.manager.itemEnd(t)
  18503. }, 0),
  18504. a;
  18505. var o = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
  18506. function s() {
  18507. o.removeEventListener("load", s, !1),
  18508. o.removeEventListener("error", l, !1),
  18509. hc.add(t, this),
  18510. e && e(this),
  18511. r.manager.itemEnd(t)
  18512. }
  18513. function l(e) {
  18514. o.removeEventListener("load", s, !1),
  18515. o.removeEventListener("error", l, !1),
  18516. i && i(e),
  18517. r.manager.itemError(t),
  18518. r.manager.itemEnd(t)
  18519. }
  18520. return o.addEventListener("load", s, !1),
  18521. o.addEventListener("error", l, !1),
  18522. "data:" !== t.substr(0, 5) && void 0 !== this.crossOrigin && (o.crossOrigin = this.crossOrigin),
  18523. r.manager.itemStart(t),
  18524. o.src = t,
  18525. o
  18526. }
  18527. }),
  18528. xc.prototype = Object.assign(Object.create(mc.prototype), {
  18529. constructor: xc,
  18530. load: function(e, n, t, i) {
  18531. var r = new ta
  18532. , a = new bc(this.manager);
  18533. a.setCrossOrigin(this.crossOrigin),
  18534. a.setPath(this.path);
  18535. var o = 0;
  18536. for (var s = 0; s < e.length; ++s)
  18537. !function(t) {
  18538. a.load(e[t], function(e) {
  18539. r.images[t] = e,
  18540. 6 === ++o && (r.needsUpdate = !0,
  18541. n && n(r))
  18542. }, void 0, i)
  18543. }(s);
  18544. return r
  18545. }
  18546. }),
  18547. Ec.prototype = Object.assign(Object.create(mc.prototype), {
  18548. constructor: Ec,
  18549. load: function(e, t, n, i) {
  18550. var r = this
  18551. , a = new ia
  18552. , o = new gc(this.manager);
  18553. return o.setResponseType("arraybuffer"),
  18554. o.setRequestHeader(this.requestHeader),
  18555. o.setPath(this.path),
  18556. o.setWithCredentials(r.withCredentials),
  18557. o.load(e, function(e) {
  18558. e = r.parse(e);
  18559. e && (void 0 !== e.image ? a.image = e.image : void 0 !== e.data && (a.image.width = e.width,
  18560. a.image.height = e.height,
  18561. a.image.data = e.data),
  18562. a.wrapS = void 0 !== e.wrapS ? e.wrapS : Be,
  18563. a.wrapT = void 0 !== e.wrapT ? e.wrapT : Be,
  18564. a.magFilter = void 0 !== e.magFilter ? e.magFilter : Oe,
  18565. a.minFilter = void 0 !== e.minFilter ? e.minFilter : Oe,
  18566. a.anisotropy = void 0 !== e.anisotropy ? e.anisotropy : 1,
  18567. void 0 !== e.format && (a.format = e.format),
  18568. void 0 !== e.type && (a.type = e.type),
  18569. void 0 !== e.mipmaps && (a.mipmaps = e.mipmaps,
  18570. a.minFilter = Ne),
  18571. 1 === e.mipmapCount && (a.minFilter = Oe),
  18572. a.needsUpdate = !0,
  18573. t && t(a, e))
  18574. }, n, i),
  18575. a
  18576. }
  18577. }),
  18578. _c.prototype = Object.assign(Object.create(mc.prototype), {
  18579. constructor: _c,
  18580. load: function(t, n, e, i) {
  18581. var r = new En
  18582. , a = new bc(this.manager);
  18583. return a.setCrossOrigin(this.crossOrigin),
  18584. a.setPath(this.path),
  18585. a.load(t, function(e) {
  18586. r.image = e;
  18587. e = 0 < t.search(/\.jpe?g($|\?)/i) || 0 === t.search(/^data\:image\/jpeg/);
  18588. r.format = e ? $e : et,
  18589. r.needsUpdate = !0,
  18590. void 0 !== n && n(r)
  18591. }, e, i),
  18592. r
  18593. }
  18594. }),
  18595. Object.assign(Mc.prototype, {
  18596. getPoint: function() {
  18597. return console.warn("THREE.Curve: .getPoint() not implemented."),
  18598. null
  18599. },
  18600. getPointAt: function(e, t) {
  18601. e = this.getUtoTmapping(e);
  18602. return this.getPoint(e, t)
  18603. },
  18604. getPoints: function() {
  18605. for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 5, t = [], n = 0; n <= e; n++)
  18606. t.push(this.getPoint(n / e));
  18607. return t
  18608. },
  18609. getSpacedPoints: function() {
  18610. for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 5, t = [], n = 0; n <= e; n++)
  18611. t.push(this.getPointAt(n / e));
  18612. return t
  18613. },
  18614. getLength: function() {
  18615. var e = this.getLengths();
  18616. return e[e.length - 1]
  18617. },
  18618. getLengths: function(e) {
  18619. if (void 0 === e && (e = this.arcLengthDivisions),
  18620. this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate)
  18621. return this.cacheArcLengths;
  18622. this.needsUpdate = !1;
  18623. var t, n = [], i = this.getPoint(0), r = 0;
  18624. n.push(0);
  18625. for (var a = 1; a <= e; a++)
  18626. r += (t = this.getPoint(a / e)).distanceTo(i),
  18627. n.push(r),
  18628. i = t;
  18629. return this.cacheArcLengths = n
  18630. },
  18631. updateArcLengths: function() {
  18632. this.needsUpdate = !0,
  18633. this.getLengths()
  18634. },
  18635. getUtoTmapping: function(e, t) {
  18636. for (var n, i = this.getLengths(), r = 0, a = i.length, o = t || e * i[a - 1], s = 0, l = a - 1; s <= l; )
  18637. if ((n = i[r = Math.floor(s + (l - s) / 2)] - o) < 0)
  18638. s = r + 1;
  18639. else {
  18640. if (!(0 < n)) {
  18641. l = r;
  18642. break
  18643. }
  18644. l = r - 1
  18645. }
  18646. if (i[r = l] === o)
  18647. return r / (a - 1);
  18648. e = i[r];
  18649. return (r + (o - e) / (i[r + 1] - e)) / (a - 1)
  18650. },
  18651. getTangent: function(e, t) {
  18652. var n = e - 1e-4
  18653. , e = e + 1e-4;
  18654. 1 < e && (e = 1);
  18655. n = this.getPoint(n = n < 0 ? 0 : n),
  18656. e = this.getPoint(e),
  18657. t = t || new (n.isVector2 ? yn : Cn);
  18658. return t.copy(e).sub(n).normalize(),
  18659. t
  18660. },
  18661. getTangentAt: function(e, t) {
  18662. e = this.getUtoTmapping(e);
  18663. return this.getTangent(e, t)
  18664. },
  18665. computeFrenetFrames: function(e, t) {
  18666. for (var n = new Cn, i = [], r = [], a = [], o = new Cn, s = new ni, l = 0; l <= e; l++)
  18667. i[l] = this.getTangentAt(l / e, new Cn),
  18668. i[l].normalize();
  18669. r[0] = new Cn,
  18670. a[0] = new Cn;
  18671. var u = Number.MAX_VALUE
  18672. , c = Math.abs(i[0].x)
  18673. , d = Math.abs(i[0].y)
  18674. , h = Math.abs(i[0].z);
  18675. c <= u && (u = c,
  18676. n.set(1, 0, 0)),
  18677. d <= u && (u = d,
  18678. n.set(0, 1, 0)),
  18679. h <= u && n.set(0, 0, 1),
  18680. o.crossVectors(i[0], n).normalize(),
  18681. r[0].crossVectors(i[0], o),
  18682. a[0].crossVectors(i[0], r[0]);
  18683. for (var p, f = 1; f <= e; f++)
  18684. r[f] = r[f - 1].clone(),
  18685. a[f] = a[f - 1].clone(),
  18686. o.crossVectors(i[f - 1], i[f]),
  18687. o.length() > Number.EPSILON && (o.normalize(),
  18688. p = Math.acos(gn.clamp(i[f - 1].dot(i[f]), -1, 1)),
  18689. r[f].applyMatrix4(s.makeRotationAxis(o, p))),
  18690. a[f].crossVectors(i[f], r[f]);
  18691. if (!0 === t) {
  18692. var m = Math.acos(gn.clamp(r[0].dot(r[e]), -1, 1));
  18693. m /= e,
  18694. 0 < i[0].dot(o.crossVectors(r[0], r[e])) && (m = -m);
  18695. for (var v = 1; v <= e; v++)
  18696. r[v].applyMatrix4(s.makeRotationAxis(i[v], m * v)),
  18697. a[v].crossVectors(i[v], r[v])
  18698. }
  18699. return {
  18700. tangents: i,
  18701. normals: r,
  18702. binormals: a
  18703. }
  18704. },
  18705. clone: function() {
  18706. return (new this.constructor).copy(this)
  18707. },
  18708. copy: function(e) {
  18709. return this.arcLengthDivisions = e.arcLengthDivisions,
  18710. this
  18711. },
  18712. toJSON: function() {
  18713. var e = {
  18714. metadata: {
  18715. version: 4.5,
  18716. type: "Curve",
  18717. generator: "Curve.toJSON"
  18718. }
  18719. };
  18720. return e.arcLengthDivisions = this.arcLengthDivisions,
  18721. e.type = this.type,
  18722. e
  18723. },
  18724. fromJSON: function(e) {
  18725. return this.arcLengthDivisions = e.arcLengthDivisions,
  18726. this
  18727. }
  18728. }),
  18729. ((Ac.prototype = Object.create(Mc.prototype)).constructor = Ac).prototype.isEllipseCurve = !0,
  18730. Ac.prototype.getPoint = function(e, t) {
  18731. for (var n = t || new yn, i = 2 * Math.PI, r = this.aEndAngle - this.aStartAngle, a = Math.abs(r) < Number.EPSILON; r < 0; )
  18732. r += i;
  18733. for (; i < r; )
  18734. r -= i;
  18735. r < Number.EPSILON && (r = a ? 0 : i),
  18736. !0 !== this.aClockwise || a || (r === i ? r = -i : r -= i);
  18737. var o = this.aStartAngle + e * r
  18738. , s = this.aX + this.xRadius * Math.cos(o)
  18739. , l = this.aY + this.yRadius * Math.sin(o);
  18740. return 0 !== this.aRotation && (t = Math.cos(this.aRotation),
  18741. a = Math.sin(this.aRotation),
  18742. s = (e = s - this.aX) * t - (o = l - this.aY) * a + this.aX,
  18743. l = e * a + o * t + this.aY),
  18744. n.set(s, l)
  18745. }
  18746. ,
  18747. Ac.prototype.copy = function(e) {
  18748. return Mc.prototype.copy.call(this, e),
  18749. this.aX = e.aX,
  18750. this.aY = e.aY,
  18751. this.xRadius = e.xRadius,
  18752. this.yRadius = e.yRadius,
  18753. this.aStartAngle = e.aStartAngle,
  18754. this.aEndAngle = e.aEndAngle,
  18755. this.aClockwise = e.aClockwise,
  18756. this.aRotation = e.aRotation,
  18757. this
  18758. }
  18759. ,
  18760. Ac.prototype.toJSON = function() {
  18761. var e = Mc.prototype.toJSON.call(this);
  18762. return e.aX = this.aX,
  18763. e.aY = this.aY,
  18764. e.xRadius = this.xRadius,
  18765. e.yRadius = this.yRadius,
  18766. e.aStartAngle = this.aStartAngle,
  18767. e.aEndAngle = this.aEndAngle,
  18768. e.aClockwise = this.aClockwise,
  18769. e.aRotation = this.aRotation,
  18770. e
  18771. }
  18772. ,
  18773. Ac.prototype.fromJSON = function(e) {
  18774. return Mc.prototype.fromJSON.call(this, e),
  18775. this.aX = e.aX,
  18776. this.aY = e.aY,
  18777. this.xRadius = e.xRadius,
  18778. this.yRadius = e.yRadius,
  18779. this.aStartAngle = e.aStartAngle,
  18780. this.aEndAngle = e.aEndAngle,
  18781. this.aClockwise = e.aClockwise,
  18782. this.aRotation = e.aRotation,
  18783. this
  18784. }
  18785. ,
  18786. ((Tc.prototype = Object.create(Ac.prototype)).constructor = Tc).prototype.isArcCurve = !0;
  18787. var Cc = new Cn
  18788. , Pc = new Sc
  18789. , Dc = new Sc
  18790. , kc = new Sc;
  18791. function Bc() {
  18792. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []
  18793. , t = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]
  18794. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : "centripetal"
  18795. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : .5;
  18796. Mc.call(this),
  18797. this.type = "CatmullRomCurve3",
  18798. this.points = e,
  18799. this.closed = t,
  18800. this.curveType = n,
  18801. this.tension = i
  18802. }
  18803. function Lc(e, t, n, i, r) {
  18804. var a = .5 * (i - t)
  18805. , t = .5 * (r - n)
  18806. , r = e * e;
  18807. return (2 * n - 2 * i + a + t) * (e * r) + (-3 * n + 3 * i - 2 * a - t) * r + a * e + n
  18808. }
  18809. function Rc(e, t, n, i) {
  18810. return (r = 1 - (r = e)) * r * t + 2 * (1 - e) * e * n + e * e * i;
  18811. var r
  18812. }
  18813. function Fc(e, t, n, i, r) {
  18814. return (a = 1 - (a = e)) * a * a * t + 3 * (t = 1 - e) * t * e * n + 3 * (1 - e) * e * e * i + e * e * e * r;
  18815. var a
  18816. }
  18817. function Ic() {
  18818. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn
  18819. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn
  18820. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new yn
  18821. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : new yn;
  18822. Mc.call(this),
  18823. this.type = "CubicBezierCurve",
  18824. this.v0 = e,
  18825. this.v1 = t,
  18826. this.v2 = n,
  18827. this.v3 = i
  18828. }
  18829. function Oc() {
  18830. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn
  18831. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn
  18832. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new Cn
  18833. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : new Cn;
  18834. Mc.call(this),
  18835. this.type = "CubicBezierCurve3",
  18836. this.v0 = e,
  18837. this.v1 = t,
  18838. this.v2 = n,
  18839. this.v3 = i
  18840. }
  18841. function zc() {
  18842. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn
  18843. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn;
  18844. Mc.call(this),
  18845. this.type = "LineCurve",
  18846. this.v1 = e,
  18847. this.v2 = t
  18848. }
  18849. function Nc() {
  18850. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn
  18851. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn;
  18852. Mc.call(this),
  18853. this.type = "LineCurve3",
  18854. this.v1 = e,
  18855. this.v2 = t
  18856. }
  18857. function Uc() {
  18858. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn
  18859. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn
  18860. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new yn;
  18861. Mc.call(this),
  18862. this.type = "QuadraticBezierCurve",
  18863. this.v0 = e,
  18864. this.v1 = t,
  18865. this.v2 = n
  18866. }
  18867. function Gc() {
  18868. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn
  18869. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn
  18870. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new Cn;
  18871. Mc.call(this),
  18872. this.type = "QuadraticBezierCurve3",
  18873. this.v0 = e,
  18874. this.v1 = t,
  18875. this.v2 = n
  18876. }
  18877. function Hc() {
  18878. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [];
  18879. Mc.call(this),
  18880. this.type = "SplineCurve",
  18881. this.points = e
  18882. }
  18883. ((Bc.prototype = Object.create(Mc.prototype)).constructor = Bc).prototype.isCatmullRomCurve3 = !0,
  18884. Bc.prototype.getPoint = function(e) {
  18885. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn
  18886. , n = this.points
  18887. , i = n.length
  18888. , r = (i - (this.closed ? 0 : 1)) * e
  18889. , a = Math.floor(r)
  18890. , o = r - a;
  18891. this.closed ? a += 0 < a ? 0 : (Math.floor(Math.abs(a) / i) + 1) * i : 0 === o && a === i - 1 && (a = i - 2,
  18892. o = 1);
  18893. var s = this.closed || 0 < a ? n[(a - 1) % i] : (Cc.subVectors(n[0], n[1]).add(n[0]),
  18894. Cc)
  18895. , l = n[a % i]
  18896. , e = n[(a + 1) % i]
  18897. , r = this.closed || a + 2 < i ? n[(a + 2) % i] : (Cc.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]),
  18898. Cc);
  18899. return "centripetal" === this.curveType || "chordal" === this.curveType ? (a = "chordal" === this.curveType ? .5 : .25,
  18900. n = Math.pow(s.distanceToSquared(l), a),
  18901. (i = Math.pow(l.distanceToSquared(e), a)) < 1e-4 && (i = 1),
  18902. n < 1e-4 && (n = i),
  18903. (a = Math.pow(e.distanceToSquared(r), a)) < 1e-4 && (a = i),
  18904. Pc.initNonuniformCatmullRom(s.x, l.x, e.x, r.x, n, i, a),
  18905. Dc.initNonuniformCatmullRom(s.y, l.y, e.y, r.y, n, i, a),
  18906. kc.initNonuniformCatmullRom(s.z, l.z, e.z, r.z, n, i, a)) : "catmullrom" === this.curveType && (Pc.initCatmullRom(s.x, l.x, e.x, r.x, this.tension),
  18907. Dc.initCatmullRom(s.y, l.y, e.y, r.y, this.tension),
  18908. kc.initCatmullRom(s.z, l.z, e.z, r.z, this.tension)),
  18909. t.set(Pc.calc(o), Dc.calc(o), kc.calc(o)),
  18910. t
  18911. }
  18912. ,
  18913. Bc.prototype.copy = function(e) {
  18914. Mc.prototype.copy.call(this, e),
  18915. this.points = [];
  18916. for (var t = 0, n = e.points.length; t < n; t++) {
  18917. var i = e.points[t];
  18918. this.points.push(i.clone())
  18919. }
  18920. return this.closed = e.closed,
  18921. this.curveType = e.curveType,
  18922. this.tension = e.tension,
  18923. this
  18924. }
  18925. ,
  18926. Bc.prototype.toJSON = function() {
  18927. var e = Mc.prototype.toJSON.call(this);
  18928. e.points = [];
  18929. for (var t = 0, n = this.points.length; t < n; t++) {
  18930. var i = this.points[t];
  18931. e.points.push(i.toArray())
  18932. }
  18933. return e.closed = this.closed,
  18934. e.curveType = this.curveType,
  18935. e.tension = this.tension,
  18936. e
  18937. }
  18938. ,
  18939. Bc.prototype.fromJSON = function(e) {
  18940. Mc.prototype.fromJSON.call(this, e),
  18941. this.points = [];
  18942. for (var t = 0, n = e.points.length; t < n; t++) {
  18943. var i = e.points[t];
  18944. this.points.push((new Cn).fromArray(i))
  18945. }
  18946. return this.closed = e.closed,
  18947. this.curveType = e.curveType,
  18948. this.tension = e.tension,
  18949. this
  18950. }
  18951. ,
  18952. ((Ic.prototype = Object.create(Mc.prototype)).constructor = Ic).prototype.isCubicBezierCurve = !0,
  18953. Ic.prototype.getPoint = function(e) {
  18954. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn
  18955. , n = this.v0
  18956. , i = this.v1
  18957. , r = this.v2
  18958. , a = this.v3;
  18959. return t.set(Fc(e, n.x, i.x, r.x, a.x), Fc(e, n.y, i.y, r.y, a.y)),
  18960. t
  18961. }
  18962. ,
  18963. Ic.prototype.copy = function(e) {
  18964. return Mc.prototype.copy.call(this, e),
  18965. this.v0.copy(e.v0),
  18966. this.v1.copy(e.v1),
  18967. this.v2.copy(e.v2),
  18968. this.v3.copy(e.v3),
  18969. this
  18970. }
  18971. ,
  18972. Ic.prototype.toJSON = function() {
  18973. var e = Mc.prototype.toJSON.call(this);
  18974. return e.v0 = this.v0.toArray(),
  18975. e.v1 = this.v1.toArray(),
  18976. e.v2 = this.v2.toArray(),
  18977. e.v3 = this.v3.toArray(),
  18978. e
  18979. }
  18980. ,
  18981. Ic.prototype.fromJSON = function(e) {
  18982. return Mc.prototype.fromJSON.call(this, e),
  18983. this.v0.fromArray(e.v0),
  18984. this.v1.fromArray(e.v1),
  18985. this.v2.fromArray(e.v2),
  18986. this.v3.fromArray(e.v3),
  18987. this
  18988. }
  18989. ,
  18990. ((Oc.prototype = Object.create(Mc.prototype)).constructor = Oc).prototype.isCubicBezierCurve3 = !0,
  18991. Oc.prototype.getPoint = function(e) {
  18992. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn
  18993. , n = this.v0
  18994. , i = this.v1
  18995. , r = this.v2
  18996. , a = this.v3;
  18997. return t.set(Fc(e, n.x, i.x, r.x, a.x), Fc(e, n.y, i.y, r.y, a.y), Fc(e, n.z, i.z, r.z, a.z)),
  18998. t
  18999. }
  19000. ,
  19001. Oc.prototype.copy = function(e) {
  19002. return Mc.prototype.copy.call(this, e),
  19003. this.v0.copy(e.v0),
  19004. this.v1.copy(e.v1),
  19005. this.v2.copy(e.v2),
  19006. this.v3.copy(e.v3),
  19007. this
  19008. }
  19009. ,
  19010. Oc.prototype.toJSON = function() {
  19011. var e = Mc.prototype.toJSON.call(this);
  19012. return e.v0 = this.v0.toArray(),
  19013. e.v1 = this.v1.toArray(),
  19014. e.v2 = this.v2.toArray(),
  19015. e.v3 = this.v3.toArray(),
  19016. e
  19017. }
  19018. ,
  19019. Oc.prototype.fromJSON = function(e) {
  19020. return Mc.prototype.fromJSON.call(this, e),
  19021. this.v0.fromArray(e.v0),
  19022. this.v1.fromArray(e.v1),
  19023. this.v2.fromArray(e.v2),
  19024. this.v3.fromArray(e.v3),
  19025. this
  19026. }
  19027. ,
  19028. ((zc.prototype = Object.create(Mc.prototype)).constructor = zc).prototype.isLineCurve = !0,
  19029. zc.prototype.getPoint = function(e) {
  19030. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn;
  19031. return 1 === e ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1),
  19032. t.multiplyScalar(e).add(this.v1)),
  19033. t
  19034. }
  19035. ,
  19036. zc.prototype.getPointAt = function(e, t) {
  19037. return this.getPoint(e, t)
  19038. }
  19039. ,
  19040. zc.prototype.getTangent = function(e, t) {
  19041. t = t || new yn;
  19042. return t.copy(this.v2).sub(this.v1).normalize(),
  19043. t
  19044. }
  19045. ,
  19046. zc.prototype.copy = function(e) {
  19047. return Mc.prototype.copy.call(this, e),
  19048. this.v1.copy(e.v1),
  19049. this.v2.copy(e.v2),
  19050. this
  19051. }
  19052. ,
  19053. zc.prototype.toJSON = function() {
  19054. var e = Mc.prototype.toJSON.call(this);
  19055. return e.v1 = this.v1.toArray(),
  19056. e.v2 = this.v2.toArray(),
  19057. e
  19058. }
  19059. ,
  19060. zc.prototype.fromJSON = function(e) {
  19061. return Mc.prototype.fromJSON.call(this, e),
  19062. this.v1.fromArray(e.v1),
  19063. this.v2.fromArray(e.v2),
  19064. this
  19065. }
  19066. ,
  19067. ((Nc.prototype = Object.create(Mc.prototype)).constructor = Nc).prototype.isLineCurve3 = !0,
  19068. Nc.prototype.getPoint = function(e) {
  19069. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn;
  19070. return 1 === e ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1),
  19071. t.multiplyScalar(e).add(this.v1)),
  19072. t
  19073. }
  19074. ,
  19075. Nc.prototype.getPointAt = function(e, t) {
  19076. return this.getPoint(e, t)
  19077. }
  19078. ,
  19079. Nc.prototype.copy = function(e) {
  19080. return Mc.prototype.copy.call(this, e),
  19081. this.v1.copy(e.v1),
  19082. this.v2.copy(e.v2),
  19083. this
  19084. }
  19085. ,
  19086. Nc.prototype.toJSON = function() {
  19087. var e = Mc.prototype.toJSON.call(this);
  19088. return e.v1 = this.v1.toArray(),
  19089. e.v2 = this.v2.toArray(),
  19090. e
  19091. }
  19092. ,
  19093. Nc.prototype.fromJSON = function(e) {
  19094. return Mc.prototype.fromJSON.call(this, e),
  19095. this.v1.fromArray(e.v1),
  19096. this.v2.fromArray(e.v2),
  19097. this
  19098. }
  19099. ,
  19100. ((Uc.prototype = Object.create(Mc.prototype)).constructor = Uc).prototype.isQuadraticBezierCurve = !0,
  19101. Uc.prototype.getPoint = function(e) {
  19102. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn
  19103. , n = this.v0
  19104. , i = this.v1
  19105. , r = this.v2;
  19106. return t.set(Rc(e, n.x, i.x, r.x), Rc(e, n.y, i.y, r.y)),
  19107. t
  19108. }
  19109. ,
  19110. Uc.prototype.copy = function(e) {
  19111. return Mc.prototype.copy.call(this, e),
  19112. this.v0.copy(e.v0),
  19113. this.v1.copy(e.v1),
  19114. this.v2.copy(e.v2),
  19115. this
  19116. }
  19117. ,
  19118. Uc.prototype.toJSON = function() {
  19119. var e = Mc.prototype.toJSON.call(this);
  19120. return e.v0 = this.v0.toArray(),
  19121. e.v1 = this.v1.toArray(),
  19122. e.v2 = this.v2.toArray(),
  19123. e
  19124. }
  19125. ,
  19126. Uc.prototype.fromJSON = function(e) {
  19127. return Mc.prototype.fromJSON.call(this, e),
  19128. this.v0.fromArray(e.v0),
  19129. this.v1.fromArray(e.v1),
  19130. this.v2.fromArray(e.v2),
  19131. this
  19132. }
  19133. ,
  19134. ((Gc.prototype = Object.create(Mc.prototype)).constructor = Gc).prototype.isQuadraticBezierCurve3 = !0,
  19135. Gc.prototype.getPoint = function(e) {
  19136. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn
  19137. , n = this.v0
  19138. , i = this.v1
  19139. , r = this.v2;
  19140. return t.set(Rc(e, n.x, i.x, r.x), Rc(e, n.y, i.y, r.y), Rc(e, n.z, i.z, r.z)),
  19141. t
  19142. }
  19143. ,
  19144. Gc.prototype.copy = function(e) {
  19145. return Mc.prototype.copy.call(this, e),
  19146. this.v0.copy(e.v0),
  19147. this.v1.copy(e.v1),
  19148. this.v2.copy(e.v2),
  19149. this
  19150. }
  19151. ,
  19152. Gc.prototype.toJSON = function() {
  19153. var e = Mc.prototype.toJSON.call(this);
  19154. return e.v0 = this.v0.toArray(),
  19155. e.v1 = this.v1.toArray(),
  19156. e.v2 = this.v2.toArray(),
  19157. e
  19158. }
  19159. ,
  19160. Gc.prototype.fromJSON = function(e) {
  19161. return Mc.prototype.fromJSON.call(this, e),
  19162. this.v0.fromArray(e.v0),
  19163. this.v1.fromArray(e.v1),
  19164. this.v2.fromArray(e.v2),
  19165. this
  19166. }
  19167. ,
  19168. ((Hc.prototype = Object.create(Mc.prototype)).constructor = Hc).prototype.isSplineCurve = !0,
  19169. Hc.prototype.getPoint = function(e) {
  19170. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn
  19171. , n = this.points
  19172. , i = (n.length - 1) * e
  19173. , r = Math.floor(i)
  19174. , a = i - r
  19175. , o = n[0 === r ? r : r - 1]
  19176. , e = n[r]
  19177. , i = n[r > n.length - 2 ? n.length - 1 : r + 1]
  19178. , r = n[r > n.length - 3 ? n.length - 1 : r + 2];
  19179. return t.set(Lc(a, o.x, e.x, i.x, r.x), Lc(a, o.y, e.y, i.y, r.y)),
  19180. t
  19181. }
  19182. ,
  19183. Hc.prototype.copy = function(e) {
  19184. Mc.prototype.copy.call(this, e),
  19185. this.points = [];
  19186. for (var t = 0, n = e.points.length; t < n; t++) {
  19187. var i = e.points[t];
  19188. this.points.push(i.clone())
  19189. }
  19190. return this
  19191. }
  19192. ,
  19193. Hc.prototype.toJSON = function() {
  19194. var e = Mc.prototype.toJSON.call(this);
  19195. e.points = [];
  19196. for (var t = 0, n = this.points.length; t < n; t++) {
  19197. var i = this.points[t];
  19198. e.points.push(i.toArray())
  19199. }
  19200. return e
  19201. }
  19202. ,
  19203. Hc.prototype.fromJSON = function(e) {
  19204. Mc.prototype.fromJSON.call(this, e),
  19205. this.points = [];
  19206. for (var t = 0, n = e.points.length; t < n; t++) {
  19207. var i = e.points[t];
  19208. this.points.push((new yn).fromArray(i))
  19209. }
  19210. return this
  19211. }
  19212. ;
  19213. var Vc = Object.freeze({
  19214. __proto__: null,
  19215. ArcCurve: Tc,
  19216. CatmullRomCurve3: Bc,
  19217. CubicBezierCurve: Ic,
  19218. CubicBezierCurve3: Oc,
  19219. EllipseCurve: Ac,
  19220. LineCurve: zc,
  19221. LineCurve3: Nc,
  19222. QuadraticBezierCurve: Uc,
  19223. QuadraticBezierCurve3: Gc,
  19224. SplineCurve: Hc
  19225. });
  19226. function jc() {
  19227. Mc.call(this),
  19228. this.type = "CurvePath",
  19229. this.curves = [],
  19230. this.autoClose = !1
  19231. }
  19232. function Wc(e) {
  19233. jc.call(this),
  19234. this.type = "Path",
  19235. this.currentPoint = new yn,
  19236. e && this.setFromPoints(e)
  19237. }
  19238. function Xc(e) {
  19239. Wc.call(this, e),
  19240. this.uuid = gn.generateUUID(),
  19241. this.type = "Shape",
  19242. this.holes = []
  19243. }
  19244. function qc(e) {
  19245. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1;
  19246. Si.call(this),
  19247. this.type = "Light",
  19248. this.color = new Yi(e),
  19249. this.intensity = t
  19250. }
  19251. function Jc(e, t, n) {
  19252. qc.call(this, e, n),
  19253. this.type = "HemisphereLight",
  19254. this.position.copy(Si.DefaultUp),
  19255. this.updateMatrix(),
  19256. this.groundColor = new Yi(t)
  19257. }
  19258. function Yc(e) {
  19259. this.camera = e,
  19260. this.bias = 0,
  19261. this.normalBias = 0,
  19262. this.radius = 1,
  19263. this.mapSize = new yn(512,512),
  19264. this.map = null,
  19265. this.mapPass = null,
  19266. this.matrix = new ni,
  19267. this.autoUpdate = !0,
  19268. this.needsUpdate = !1,
  19269. this._frustum = new oa,
  19270. this._frameExtents = new yn(1,1),
  19271. this._viewportCount = 1,
  19272. this._viewports = [new Mn(0,0,1,1)]
  19273. }
  19274. function Zc() {
  19275. Yc.call(this, new $r(50,1,.5,500)),
  19276. this.focus = 1
  19277. }
  19278. function Qc(e, t, n, i, r, a) {
  19279. qc.call(this, e, t),
  19280. this.type = "SpotLight",
  19281. this.position.copy(Si.DefaultUp),
  19282. this.updateMatrix(),
  19283. this.target = new Si,
  19284. Object.defineProperty(this, "power", {
  19285. get: function() {
  19286. return this.intensity * Math.PI
  19287. },
  19288. set: function(e) {
  19289. this.intensity = e / Math.PI
  19290. }
  19291. }),
  19292. this.distance = void 0 !== n ? n : 0,
  19293. this.angle = void 0 !== i ? i : Math.PI / 3,
  19294. this.penumbra = void 0 !== r ? r : 0,
  19295. this.decay = void 0 !== a ? a : 1,
  19296. this.shadow = new Zc
  19297. }
  19298. function Kc() {
  19299. Yc.call(this, new $r(90,1,.5,500)),
  19300. this._frameExtents = new yn(4,2),
  19301. this._viewportCount = 6,
  19302. this._viewports = [new Mn(2,1,1,1), new Mn(0,1,1,1), new Mn(3,1,1,1), new Mn(1,1,1,1), new Mn(3,0,1,1), new Mn(1,0,1,1)],
  19303. this._cubeDirections = [new Cn(1,0,0), new Cn(-1,0,0), new Cn(0,0,1), new Cn(0,0,-1), new Cn(0,1,0), new Cn(0,-1,0)],
  19304. this._cubeUps = [new Cn(0,1,0), new Cn(0,1,0), new Cn(0,1,0), new Cn(0,1,0), new Cn(0,0,1), new Cn(0,0,-1)]
  19305. }
  19306. function $c(e, t, n, i) {
  19307. qc.call(this, e, t),
  19308. this.type = "PointLight",
  19309. Object.defineProperty(this, "power", {
  19310. get: function() {
  19311. return 4 * this.intensity * Math.PI
  19312. },
  19313. set: function(e) {
  19314. this.intensity = e / (4 * Math.PI)
  19315. }
  19316. }),
  19317. this.distance = void 0 !== n ? n : 0,
  19318. this.decay = void 0 !== i ? i : 1,
  19319. this.shadow = new Kc
  19320. }
  19321. function ed() {
  19322. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : -1
  19323. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1
  19324. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1
  19325. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : -1
  19326. , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .1
  19327. , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 2e3;
  19328. Kr.call(this),
  19329. this.type = "OrthographicCamera",
  19330. this.zoom = 1,
  19331. this.view = null,
  19332. this.left = e,
  19333. this.right = t,
  19334. this.top = n,
  19335. this.bottom = i,
  19336. this.near = r,
  19337. this.far = a,
  19338. this.updateProjectionMatrix()
  19339. }
  19340. function td() {
  19341. Yc.call(this, new ed(-5,5,5,-5,.5,500))
  19342. }
  19343. function nd(e, t) {
  19344. qc.call(this, e, t),
  19345. this.type = "DirectionalLight",
  19346. this.position.copy(Si.DefaultUp),
  19347. this.updateMatrix(),
  19348. this.target = new Si,
  19349. this.shadow = new td
  19350. }
  19351. function id(e, t) {
  19352. qc.call(this, e, t),
  19353. this.type = "AmbientLight"
  19354. }
  19355. function rd(e, t, n, i) {
  19356. qc.call(this, e, t),
  19357. this.type = "RectAreaLight",
  19358. this.width = void 0 !== n ? n : 10,
  19359. this.height = void 0 !== i ? i : 10
  19360. }
  19361. jc.prototype = Object.assign(Object.create(Mc.prototype), {
  19362. constructor: jc,
  19363. add: function(e) {
  19364. this.curves.push(e)
  19365. },
  19366. closePath: function() {
  19367. var e = this.curves[0].getPoint(0)
  19368. , t = this.curves[this.curves.length - 1].getPoint(1);
  19369. e.equals(t) || this.curves.push(new zc(t,e))
  19370. },
  19371. getPoint: function(e) {
  19372. for (var t = e * this.getLength(), n = this.getCurveLengths(), i = 0; i < n.length; ) {
  19373. if (n[i] >= t) {
  19374. var r = n[i] - t
  19375. , a = this.curves[i]
  19376. , o = a.getLength();
  19377. return a.getPointAt(0 === o ? 0 : 1 - r / o)
  19378. }
  19379. i++
  19380. }
  19381. return null
  19382. },
  19383. getLength: function() {
  19384. var e = this.getCurveLengths();
  19385. return e[e.length - 1]
  19386. },
  19387. updateArcLengths: function() {
  19388. this.needsUpdate = !0,
  19389. this.cacheLengths = null,
  19390. this.getCurveLengths()
  19391. },
  19392. getCurveLengths: function() {
  19393. if (this.cacheLengths && this.cacheLengths.length === this.curves.length)
  19394. return this.cacheLengths;
  19395. for (var e = [], t = 0, n = 0, i = this.curves.length; n < i; n++)
  19396. t += this.curves[n].getLength(),
  19397. e.push(t);
  19398. return this.cacheLengths = e
  19399. },
  19400. getSpacedPoints: function() {
  19401. for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 40, t = [], n = 0; n <= e; n++)
  19402. t.push(this.getPoint(n / e));
  19403. return this.autoClose && t.push(t[0]),
  19404. t
  19405. },
  19406. getPoints: function() {
  19407. for (var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 12, n = [], i = 0, r = this.curves; i < r.length; i++)
  19408. for (var a = r[i], o = a && a.isEllipseCurve ? 2 * t : a && (a.isLineCurve || a.isLineCurve3) ? 1 : a && a.isSplineCurve ? t * a.points.length : t, s = a.getPoints(o), l = 0; l < s.length; l++) {
  19409. var u = s[l];
  19410. e && e.equals(u) || (n.push(u),
  19411. e = u)
  19412. }
  19413. return this.autoClose && 1 < n.length && !n[n.length - 1].equals(n[0]) && n.push(n[0]),
  19414. n
  19415. },
  19416. copy: function(e) {
  19417. Mc.prototype.copy.call(this, e),
  19418. this.curves = [];
  19419. for (var t = 0, n = e.curves.length; t < n; t++) {
  19420. var i = e.curves[t];
  19421. this.curves.push(i.clone())
  19422. }
  19423. return this.autoClose = e.autoClose,
  19424. this
  19425. },
  19426. toJSON: function() {
  19427. var e = Mc.prototype.toJSON.call(this);
  19428. e.autoClose = this.autoClose,
  19429. e.curves = [];
  19430. for (var t = 0, n = this.curves.length; t < n; t++) {
  19431. var i = this.curves[t];
  19432. e.curves.push(i.toJSON())
  19433. }
  19434. return e
  19435. },
  19436. fromJSON: function(e) {
  19437. Mc.prototype.fromJSON.call(this, e),
  19438. this.autoClose = e.autoClose,
  19439. this.curves = [];
  19440. for (var t = 0, n = e.curves.length; t < n; t++) {
  19441. var i = e.curves[t];
  19442. this.curves.push((new Vc[i.type]).fromJSON(i))
  19443. }
  19444. return this
  19445. }
  19446. }),
  19447. Wc.prototype = Object.assign(Object.create(jc.prototype), {
  19448. constructor: Wc,
  19449. setFromPoints: function(e) {
  19450. this.moveTo(e[0].x, e[0].y);
  19451. for (var t = 1, n = e.length; t < n; t++)
  19452. this.lineTo(e[t].x, e[t].y);
  19453. return this
  19454. },
  19455. moveTo: function(e, t) {
  19456. return this.currentPoint.set(e, t),
  19457. this
  19458. },
  19459. lineTo: function(e, t) {
  19460. var n = new zc(this.currentPoint.clone(),new yn(e,t));
  19461. return this.curves.push(n),
  19462. this.currentPoint.set(e, t),
  19463. this
  19464. },
  19465. quadraticCurveTo: function(e, t, n, i) {
  19466. t = new Uc(this.currentPoint.clone(),new yn(e,t),new yn(n,i));
  19467. return this.curves.push(t),
  19468. this.currentPoint.set(n, i),
  19469. this
  19470. },
  19471. bezierCurveTo: function(e, t, n, i, r, a) {
  19472. i = new Ic(this.currentPoint.clone(),new yn(e,t),new yn(n,i),new yn(r,a));
  19473. return this.curves.push(i),
  19474. this.currentPoint.set(r, a),
  19475. this
  19476. },
  19477. splineThru: function(e) {
  19478. var t = new Hc([this.currentPoint.clone()].concat(e));
  19479. return this.curves.push(t),
  19480. this.currentPoint.copy(e[e.length - 1]),
  19481. this
  19482. },
  19483. arc: function(e, t, n, i, r, a) {
  19484. var o = this.currentPoint.x
  19485. , s = this.currentPoint.y;
  19486. return this.absarc(e + o, t + s, n, i, r, a),
  19487. this
  19488. },
  19489. absarc: function(e, t, n, i, r, a) {
  19490. return this.absellipse(e, t, n, n, i, r, a),
  19491. this
  19492. },
  19493. ellipse: function(e, t, n, i, r, a, o, s) {
  19494. var l = this.currentPoint.x
  19495. , u = this.currentPoint.y;
  19496. return this.absellipse(e + l, t + u, n, i, r, a, o, s),
  19497. this
  19498. },
  19499. absellipse: function(e, t, n, i, r, a, o, s) {
  19500. o = new Ac(e,t,n,i,r,a,o,s);
  19501. 0 < this.curves.length && ((s = o.getPoint(0)).equals(this.currentPoint) || this.lineTo(s.x, s.y)),
  19502. this.curves.push(o);
  19503. o = o.getPoint(1);
  19504. return this.currentPoint.copy(o),
  19505. this
  19506. },
  19507. copy: function(e) {
  19508. return jc.prototype.copy.call(this, e),
  19509. this.currentPoint.copy(e.currentPoint),
  19510. this
  19511. },
  19512. toJSON: function() {
  19513. var e = jc.prototype.toJSON.call(this);
  19514. return e.currentPoint = this.currentPoint.toArray(),
  19515. e
  19516. },
  19517. fromJSON: function(e) {
  19518. return jc.prototype.fromJSON.call(this, e),
  19519. this.currentPoint.fromArray(e.currentPoint),
  19520. this
  19521. }
  19522. }),
  19523. Xc.prototype = Object.assign(Object.create(Wc.prototype), {
  19524. constructor: Xc,
  19525. getPointsHoles: function(e) {
  19526. for (var t = [], n = 0, i = this.holes.length; n < i; n++)
  19527. t[n] = this.holes[n].getPoints(e);
  19528. return t
  19529. },
  19530. extractPoints: function(e) {
  19531. return {
  19532. shape: this.getPoints(e),
  19533. holes: this.getPointsHoles(e)
  19534. }
  19535. },
  19536. copy: function(e) {
  19537. Wc.prototype.copy.call(this, e),
  19538. this.holes = [];
  19539. for (var t = 0, n = e.holes.length; t < n; t++) {
  19540. var i = e.holes[t];
  19541. this.holes.push(i.clone())
  19542. }
  19543. return this
  19544. },
  19545. toJSON: function() {
  19546. var e = Wc.prototype.toJSON.call(this);
  19547. e.uuid = this.uuid,
  19548. e.holes = [];
  19549. for (var t = 0, n = this.holes.length; t < n; t++) {
  19550. var i = this.holes[t];
  19551. e.holes.push(i.toJSON())
  19552. }
  19553. return e
  19554. },
  19555. fromJSON: function(e) {
  19556. Wc.prototype.fromJSON.call(this, e),
  19557. this.uuid = e.uuid,
  19558. this.holes = [];
  19559. for (var t = 0, n = e.holes.length; t < n; t++) {
  19560. var i = e.holes[t];
  19561. this.holes.push((new Wc).fromJSON(i))
  19562. }
  19563. return this
  19564. }
  19565. }),
  19566. qc.prototype = Object.assign(Object.create(Si.prototype), {
  19567. constructor: qc,
  19568. isLight: !0,
  19569. copy: function(e) {
  19570. return Si.prototype.copy.call(this, e),
  19571. this.color.copy(e.color),
  19572. this.intensity = e.intensity,
  19573. this
  19574. },
  19575. toJSON: function(e) {
  19576. e = Si.prototype.toJSON.call(this, e);
  19577. return e.object.color = this.color.getHex(),
  19578. e.object.intensity = this.intensity,
  19579. void 0 !== this.groundColor && (e.object.groundColor = this.groundColor.getHex()),
  19580. void 0 !== this.distance && (e.object.distance = this.distance),
  19581. void 0 !== this.angle && (e.object.angle = this.angle),
  19582. void 0 !== this.decay && (e.object.decay = this.decay),
  19583. void 0 !== this.penumbra && (e.object.penumbra = this.penumbra),
  19584. void 0 !== this.shadow && (e.object.shadow = this.shadow.toJSON()),
  19585. e
  19586. }
  19587. }),
  19588. Jc.prototype = Object.assign(Object.create(qc.prototype), {
  19589. constructor: Jc,
  19590. isHemisphereLight: !0,
  19591. copy: function(e) {
  19592. return qc.prototype.copy.call(this, e),
  19593. this.groundColor.copy(e.groundColor),
  19594. this
  19595. }
  19596. }),
  19597. Object.assign(Yc.prototype, {
  19598. _projScreenMatrix: new ni,
  19599. _lightPositionWorld: new Cn,
  19600. _lookTarget: new Cn,
  19601. getViewportCount: function() {
  19602. return this._viewportCount
  19603. },
  19604. getFrustum: function() {
  19605. return this._frustum
  19606. },
  19607. updateMatrices: function(e) {
  19608. var t = this.camera
  19609. , n = this.matrix
  19610. , i = this._projScreenMatrix
  19611. , r = this._lookTarget
  19612. , a = this._lightPositionWorld;
  19613. a.setFromMatrixPosition(e.matrixWorld),
  19614. t.position.copy(a),
  19615. r.setFromMatrixPosition(e.target.matrixWorld),
  19616. t.lookAt(r),
  19617. t.updateMatrixWorld(),
  19618. i.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse),
  19619. this._frustum.setFromProjectionMatrix(i),
  19620. n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
  19621. n.multiply(t.projectionMatrix),
  19622. n.multiply(t.matrixWorldInverse)
  19623. },
  19624. getViewport: function(e) {
  19625. return this._viewports[e]
  19626. },
  19627. getFrameExtents: function() {
  19628. return this._frameExtents
  19629. },
  19630. copy: function(e) {
  19631. return this.camera = e.camera.clone(),
  19632. this.bias = e.bias,
  19633. this.radius = e.radius,
  19634. this.mapSize.copy(e.mapSize),
  19635. this
  19636. },
  19637. clone: function() {
  19638. return (new this.constructor).copy(this)
  19639. },
  19640. toJSON: function() {
  19641. var e = {};
  19642. return 0 !== this.bias && (e.bias = this.bias),
  19643. 0 !== this.normalBias && (e.normalBias = this.normalBias),
  19644. 1 !== this.radius && (e.radius = this.radius),
  19645. 512 === this.mapSize.x && 512 === this.mapSize.y || (e.mapSize = this.mapSize.toArray()),
  19646. e.camera = this.camera.toJSON(!1).object,
  19647. delete e.camera.matrix,
  19648. e
  19649. }
  19650. }),
  19651. Zc.prototype = Object.assign(Object.create(Yc.prototype), {
  19652. constructor: Zc,
  19653. isSpotLightShadow: !0,
  19654. updateMatrices: function(e) {
  19655. var t = this.camera
  19656. , n = 2 * gn.RAD2DEG * e.angle * this.focus
  19657. , i = this.mapSize.width / this.mapSize.height
  19658. , r = e.distance || t.far;
  19659. n === t.fov && i === t.aspect && r === t.far || (t.fov = n,
  19660. t.aspect = i,
  19661. t.far = r,
  19662. t.updateProjectionMatrix()),
  19663. Yc.prototype.updateMatrices.call(this, e)
  19664. }
  19665. }),
  19666. Qc.prototype = Object.assign(Object.create(qc.prototype), {
  19667. constructor: Qc,
  19668. isSpotLight: !0,
  19669. copy: function(e) {
  19670. return qc.prototype.copy.call(this, e),
  19671. this.distance = e.distance,
  19672. this.angle = e.angle,
  19673. this.penumbra = e.penumbra,
  19674. this.decay = e.decay,
  19675. this.target = e.target.clone(),
  19676. this.shadow = e.shadow.clone(),
  19677. this
  19678. }
  19679. }),
  19680. Kc.prototype = Object.assign(Object.create(Yc.prototype), {
  19681. constructor: Kc,
  19682. isPointLightShadow: !0,
  19683. updateMatrices: function(e) {
  19684. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  19685. , n = this.camera
  19686. , i = this.matrix
  19687. , r = this._lightPositionWorld
  19688. , a = this._lookTarget
  19689. , o = this._projScreenMatrix;
  19690. r.setFromMatrixPosition(e.matrixWorld),
  19691. n.position.copy(r),
  19692. a.copy(n.position),
  19693. a.add(this._cubeDirections[t]),
  19694. n.up.copy(this._cubeUps[t]),
  19695. n.lookAt(a),
  19696. n.updateMatrixWorld(),
  19697. i.makeTranslation(-r.x, -r.y, -r.z),
  19698. o.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse),
  19699. this._frustum.setFromProjectionMatrix(o)
  19700. }
  19701. }),
  19702. $c.prototype = Object.assign(Object.create(qc.prototype), {
  19703. constructor: $c,
  19704. isPointLight: !0,
  19705. copy: function(e) {
  19706. return qc.prototype.copy.call(this, e),
  19707. this.distance = e.distance,
  19708. this.decay = e.decay,
  19709. this.shadow = e.shadow.clone(),
  19710. this
  19711. }
  19712. }),
  19713. ed.prototype = Object.assign(Object.create(Kr.prototype), {
  19714. constructor: ed,
  19715. isOrthographicCamera: !0,
  19716. copy: function(e, t) {
  19717. return Kr.prototype.copy.call(this, e, t),
  19718. this.left = e.left,
  19719. this.right = e.right,
  19720. this.top = e.top,
  19721. this.bottom = e.bottom,
  19722. this.near = e.near,
  19723. this.far = e.far,
  19724. this.zoom = e.zoom,
  19725. this.view = null === e.view ? null : Object.assign({}, e.view),
  19726. this
  19727. },
  19728. setViewOffset: function(e, t, n, i, r, a) {
  19729. null === this.view && (this.view = {
  19730. enabled: !0,
  19731. fullWidth: 1,
  19732. fullHeight: 1,
  19733. offsetX: 0,
  19734. offsetY: 0,
  19735. width: 1,
  19736. height: 1
  19737. }),
  19738. this.view.enabled = !0,
  19739. this.view.fullWidth = e,
  19740. this.view.fullHeight = t,
  19741. this.view.offsetX = n,
  19742. this.view.offsetY = i,
  19743. this.view.width = r,
  19744. this.view.height = a,
  19745. this.updateProjectionMatrix()
  19746. },
  19747. clearViewOffset: function() {
  19748. null !== this.view && (this.view.enabled = !1),
  19749. this.updateProjectionMatrix()
  19750. },
  19751. updateProjectionMatrix: function() {
  19752. var e = (this.right - this.left) / (2 * this.zoom)
  19753. , t = (this.top - this.bottom) / (2 * this.zoom)
  19754. , n = (this.right + this.left) / 2
  19755. , i = (this.top + this.bottom) / 2
  19756. , r = n - e
  19757. , a = n + e
  19758. , n = i + t
  19759. , e = i - t;
  19760. null !== this.view && this.view.enabled && (i = (this.right - this.left) / this.view.fullWidth / this.zoom,
  19761. t = (this.top - this.bottom) / this.view.fullHeight / this.zoom,
  19762. a = (r += i * this.view.offsetX) + i * this.view.width,
  19763. e = (n -= t * this.view.offsetY) - t * this.view.height),
  19764. this.projectionMatrix.makeOrthographic(r, a, n, e, this.near, this.far),
  19765. this.projectionMatrixInverse.copy(this.projectionMatrix).invert()
  19766. },
  19767. toJSON: function(e) {
  19768. e = Si.prototype.toJSON.call(this, e);
  19769. return e.object.zoom = this.zoom,
  19770. e.object.left = this.left,
  19771. e.object.right = this.right,
  19772. e.object.top = this.top,
  19773. e.object.bottom = this.bottom,
  19774. e.object.near = this.near,
  19775. e.object.far = this.far,
  19776. null !== this.view && (e.object.view = Object.assign({}, this.view)),
  19777. e
  19778. }
  19779. }),
  19780. td.prototype = Object.assign(Object.create(Yc.prototype), {
  19781. constructor: td,
  19782. isDirectionalLightShadow: !0,
  19783. updateMatrices: function(e) {
  19784. Yc.prototype.updateMatrices.call(this, e)
  19785. }
  19786. }),
  19787. nd.prototype = Object.assign(Object.create(qc.prototype), {
  19788. constructor: nd,
  19789. isDirectionalLight: !0,
  19790. copy: function(e) {
  19791. return qc.prototype.copy.call(this, e),
  19792. this.target = e.target.clone(),
  19793. this.shadow = e.shadow.clone(),
  19794. this
  19795. }
  19796. }),
  19797. id.prototype = Object.assign(Object.create(qc.prototype), {
  19798. constructor: id,
  19799. isAmbientLight: !0
  19800. }),
  19801. rd.prototype = Object.assign(Object.create(qc.prototype), {
  19802. constructor: rd,
  19803. isRectAreaLight: !0,
  19804. copy: function(e) {
  19805. return qc.prototype.copy.call(this, e),
  19806. this.width = e.width,
  19807. this.height = e.height,
  19808. this
  19809. },
  19810. toJSON: function(e) {
  19811. e = qc.prototype.toJSON.call(this, e);
  19812. return e.object.width = this.width,
  19813. e.object.height = this.height,
  19814. e
  19815. }
  19816. });
  19817. var ad = function() {
  19818. function t() {
  19819. O(this, t),
  19820. Object.defineProperty(this, "isSphericalHarmonics3", {
  19821. value: !0
  19822. }),
  19823. this.coefficients = [];
  19824. for (var e = 0; e < 9; e++)
  19825. this.coefficients.push(new Cn)
  19826. }
  19827. return h(t, [{
  19828. key: "set",
  19829. value: function(e) {
  19830. for (var t = 0; t < 9; t++)
  19831. this.coefficients[t].copy(e[t]);
  19832. return this
  19833. }
  19834. }, {
  19835. key: "zero",
  19836. value: function() {
  19837. for (var e = 0; e < 9; e++)
  19838. this.coefficients[e].set(0, 0, 0);
  19839. return this
  19840. }
  19841. }, {
  19842. key: "getAt",
  19843. value: function(e, t) {
  19844. var n = e.x
  19845. , i = e.y
  19846. , r = e.z
  19847. , e = this.coefficients;
  19848. return t.copy(e[0]).multiplyScalar(.282095),
  19849. t.addScaledVector(e[1], .488603 * i),
  19850. t.addScaledVector(e[2], .488603 * r),
  19851. t.addScaledVector(e[3], .488603 * n),
  19852. t.addScaledVector(e[4], n * i * 1.092548),
  19853. t.addScaledVector(e[5], i * r * 1.092548),
  19854. t.addScaledVector(e[6], .315392 * (3 * r * r - 1)),
  19855. t.addScaledVector(e[7], n * r * 1.092548),
  19856. t.addScaledVector(e[8], .546274 * (n * n - i * i)),
  19857. t
  19858. }
  19859. }, {
  19860. key: "getIrradianceAt",
  19861. value: function(e, t) {
  19862. var n = e.x
  19863. , i = e.y
  19864. , r = e.z
  19865. , e = this.coefficients;
  19866. return t.copy(e[0]).multiplyScalar(.886227),
  19867. t.addScaledVector(e[1], 1.023328 * i),
  19868. t.addScaledVector(e[2], 1.023328 * r),
  19869. t.addScaledVector(e[3], 1.023328 * n),
  19870. t.addScaledVector(e[4], .858086 * n * i),
  19871. t.addScaledVector(e[5], .858086 * i * r),
  19872. t.addScaledVector(e[6], .743125 * r * r - .247708),
  19873. t.addScaledVector(e[7], .858086 * n * r),
  19874. t.addScaledVector(e[8], .429043 * (n * n - i * i)),
  19875. t
  19876. }
  19877. }, {
  19878. key: "add",
  19879. value: function(e) {
  19880. for (var t = 0; t < 9; t++)
  19881. this.coefficients[t].add(e.coefficients[t]);
  19882. return this
  19883. }
  19884. }, {
  19885. key: "addScaledSH",
  19886. value: function(e, t) {
  19887. for (var n = 0; n < 9; n++)
  19888. this.coefficients[n].addScaledVector(e.coefficients[n], t);
  19889. return this
  19890. }
  19891. }, {
  19892. key: "scale",
  19893. value: function(e) {
  19894. for (var t = 0; t < 9; t++)
  19895. this.coefficients[t].multiplyScalar(e);
  19896. return this
  19897. }
  19898. }, {
  19899. key: "lerp",
  19900. value: function(e, t) {
  19901. for (var n = 0; n < 9; n++)
  19902. this.coefficients[n].lerp(e.coefficients[n], t);
  19903. return this
  19904. }
  19905. }, {
  19906. key: "equals",
  19907. value: function(e) {
  19908. for (var t = 0; t < 9; t++)
  19909. if (!this.coefficients[t].equals(e.coefficients[t]))
  19910. return !1;
  19911. return !0
  19912. }
  19913. }, {
  19914. key: "copy",
  19915. value: function(e) {
  19916. return this.set(e.coefficients)
  19917. }
  19918. }, {
  19919. key: "clone",
  19920. value: function() {
  19921. return (new this.constructor).copy(this)
  19922. }
  19923. }, {
  19924. key: "fromArray",
  19925. value: function(e) {
  19926. for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this.coefficients, i = 0; i < 9; i++)
  19927. n[i].fromArray(e, t + 3 * i);
  19928. return this
  19929. }
  19930. }, {
  19931. key: "toArray",
  19932. value: function() {
  19933. for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this.coefficients, i = 0; i < 9; i++)
  19934. n[i].toArray(e, t + 3 * i);
  19935. return e
  19936. }
  19937. }], [{
  19938. key: "getBasisAt",
  19939. value: function(e, t) {
  19940. var n = e.x
  19941. , i = e.y
  19942. , e = e.z;
  19943. t[0] = .282095,
  19944. t[1] = .488603 * i,
  19945. t[2] = .488603 * e,
  19946. t[3] = .488603 * n,
  19947. t[4] = 1.092548 * n * i,
  19948. t[5] = 1.092548 * i * e,
  19949. t[6] = .315392 * (3 * e * e - 1),
  19950. t[7] = 1.092548 * n * e,
  19951. t[8] = .546274 * (n * n - i * i)
  19952. }
  19953. }]),
  19954. t
  19955. }();
  19956. function od(e, t) {
  19957. qc.call(this, void 0, t),
  19958. this.type = "LightProbe",
  19959. this.sh = void 0 !== e ? e : new ad
  19960. }
  19961. function sd(e) {
  19962. mc.call(this, e),
  19963. this.textures = {}
  19964. }
  19965. od.prototype = Object.assign(Object.create(qc.prototype), {
  19966. constructor: od,
  19967. isLightProbe: !0,
  19968. copy: function(e) {
  19969. return qc.prototype.copy.call(this, e),
  19970. this.sh.copy(e.sh),
  19971. this
  19972. },
  19973. fromJSON: function(e) {
  19974. return this.intensity = e.intensity,
  19975. this.sh.fromArray(e.sh),
  19976. this
  19977. },
  19978. toJSON: function(e) {
  19979. e = qc.prototype.toJSON.call(this, e);
  19980. return e.object.sh = this.sh.toArray(),
  19981. e
  19982. }
  19983. }),
  19984. sd.prototype = Object.assign(Object.create(mc.prototype), {
  19985. constructor: sd,
  19986. load: function(t, n, e, i) {
  19987. var r = this
  19988. , a = new gc(r.manager);
  19989. a.setPath(r.path),
  19990. a.setRequestHeader(r.requestHeader),
  19991. a.setWithCredentials(r.withCredentials),
  19992. a.load(t, function(e) {
  19993. try {
  19994. n(r.parse(JSON.parse(e)))
  19995. } catch (e) {
  19996. i ? i(e) : console.error(e),
  19997. r.manager.itemError(t)
  19998. }
  19999. }, e, i)
  20000. },
  20001. parse: function(e) {
  20002. var t = this.textures;
  20003. function n(e) {
  20004. return void 0 === t[e] && console.warn("THREE.MaterialLoader: Undefined texture", e),
  20005. t[e]
  20006. }
  20007. var i, r = new Zu[e.type];
  20008. if (void 0 !== e.uuid && (r.uuid = e.uuid),
  20009. void 0 !== e.name && (r.name = e.name),
  20010. void 0 !== e.color && void 0 !== r.color && r.color.setHex(e.color),
  20011. void 0 !== e.roughness && (r.roughness = e.roughness),
  20012. void 0 !== e.metalness && (r.metalness = e.metalness),
  20013. void 0 !== e.sheen && (r.sheen = (new Yi).setHex(e.sheen)),
  20014. void 0 !== e.emissive && void 0 !== r.emissive && r.emissive.setHex(e.emissive),
  20015. void 0 !== e.specular && void 0 !== r.specular && r.specular.setHex(e.specular),
  20016. void 0 !== e.shininess && (r.shininess = e.shininess),
  20017. void 0 !== e.clearcoat && (r.clearcoat = e.clearcoat),
  20018. void 0 !== e.clearcoatRoughness && (r.clearcoatRoughness = e.clearcoatRoughness),
  20019. void 0 !== e.fog && (r.fog = e.fog),
  20020. void 0 !== e.flatShading && (r.flatShading = e.flatShading),
  20021. void 0 !== e.blending && (r.blending = e.blending),
  20022. void 0 !== e.combine && (r.combine = e.combine),
  20023. void 0 !== e.side && (r.side = e.side),
  20024. void 0 !== e.opacity && (r.opacity = e.opacity),
  20025. void 0 !== e.transparent && (r.transparent = e.transparent),
  20026. void 0 !== e.alphaTest && (r.alphaTest = e.alphaTest),
  20027. void 0 !== e.depthTest && (r.depthTest = e.depthTest),
  20028. void 0 !== e.depthWrite && (r.depthWrite = e.depthWrite),
  20029. void 0 !== e.colorWrite && (r.colorWrite = e.colorWrite),
  20030. void 0 !== e.stencilWrite && (r.stencilWrite = e.stencilWrite),
  20031. void 0 !== e.stencilWriteMask && (r.stencilWriteMask = e.stencilWriteMask),
  20032. void 0 !== e.stencilFunc && (r.stencilFunc = e.stencilFunc),
  20033. void 0 !== e.stencilRef && (r.stencilRef = e.stencilRef),
  20034. void 0 !== e.stencilFuncMask && (r.stencilFuncMask = e.stencilFuncMask),
  20035. void 0 !== e.stencilFail && (r.stencilFail = e.stencilFail),
  20036. void 0 !== e.stencilZFail && (r.stencilZFail = e.stencilZFail),
  20037. void 0 !== e.stencilZPass && (r.stencilZPass = e.stencilZPass),
  20038. void 0 !== e.wireframe && (r.wireframe = e.wireframe),
  20039. void 0 !== e.wireframelineWidth && (r.wireframelineWidth = e.wireframelineWidth),
  20040. void 0 !== e.wireframeLinecap && (r.wireframeLinecap = e.wireframeLinecap),
  20041. void 0 !== e.wireframeLinejoin && (r.wireframeLinejoin = e.wireframeLinejoin),
  20042. void 0 !== e.rotation && (r.rotation = e.rotation),
  20043. 1 !== e.lineWidth && (r.lineWidth = e.lineWidth),
  20044. void 0 !== e.dashSize && (r.dashSize = e.dashSize),
  20045. void 0 !== e.gapSize && (r.gapSize = e.gapSize),
  20046. void 0 !== e.scale && (r.scale = e.scale),
  20047. void 0 !== e.polygonOffset && (r.polygonOffset = e.polygonOffset),
  20048. void 0 !== e.polygonOffsetFactor && (r.polygonOffsetFactor = e.polygonOffsetFactor),
  20049. void 0 !== e.polygonOffsetUnits && (r.polygonOffsetUnits = e.polygonOffsetUnits),
  20050. void 0 !== e.skinning && (r.skinning = e.skinning),
  20051. void 0 !== e.morphTargets && (r.morphTargets = e.morphTargets),
  20052. void 0 !== e.morphNormals && (r.morphNormals = e.morphNormals),
  20053. void 0 !== e.dithering && (r.dithering = e.dithering),
  20054. void 0 !== e.vertexTangents && (r.vertexTangents = e.vertexTangents),
  20055. void 0 !== e.visible && (r.visible = e.visible),
  20056. void 0 !== e.toneMapped && (r.toneMapped = e.toneMapped),
  20057. void 0 !== e.userData && (r.userData = e.userData),
  20058. void 0 !== e.vertexColors && ("number" == typeof e.vertexColors ? r.vertexColors = 0 < e.vertexColors : r.vertexColors = e.vertexColors),
  20059. void 0 !== e.uniforms)
  20060. for (var a in e.uniforms) {
  20061. var o = e.uniforms[a];
  20062. switch (r.uniforms[a] = {},
  20063. o.type) {
  20064. case "t":
  20065. r.uniforms[a].value = n(o.value);
  20066. break;
  20067. case "c":
  20068. r.uniforms[a].value = (new Yi).setHex(o.value);
  20069. break;
  20070. case "v2":
  20071. r.uniforms[a].value = (new yn).fromArray(o.value);
  20072. break;
  20073. case "v3":
  20074. r.uniforms[a].value = (new Cn).fromArray(o.value);
  20075. break;
  20076. case "v4":
  20077. r.uniforms[a].value = (new Mn).fromArray(o.value);
  20078. break;
  20079. case "m3":
  20080. r.uniforms[a].value = (new wn).fromArray(o.value);
  20081. break;
  20082. case "m4":
  20083. r.uniforms[a].value = (new ni).fromArray(o.value);
  20084. break;
  20085. default:
  20086. r.uniforms[a].value = o.value
  20087. }
  20088. }
  20089. if (void 0 !== e.defines && (r.defines = e.defines),
  20090. void 0 !== e.vertexShader && (r.vertexShader = e.vertexShader),
  20091. void 0 !== e.fragmentShader && (r.fragmentShader = e.fragmentShader),
  20092. void 0 !== e.extensions)
  20093. for (var s in e.extensions)
  20094. r.extensions[s] = e.extensions[s];
  20095. return void 0 !== e.shading && (r.flatShading = 1 === e.shading),
  20096. void 0 !== e.size && (r.size = e.size),
  20097. void 0 !== e.sizeAttenuation && (r.sizeAttenuation = e.sizeAttenuation),
  20098. void 0 !== e.map && (r.map = n(e.map)),
  20099. void 0 !== e.matcap && (r.matcap = n(e.matcap)),
  20100. void 0 !== e.alphaMap && (r.alphaMap = n(e.alphaMap)),
  20101. void 0 !== e.bumpMap && (r.bumpMap = n(e.bumpMap)),
  20102. void 0 !== e.bumpScale && (r.bumpScale = e.bumpScale),
  20103. void 0 !== e.normalMap && (r.normalMap = n(e.normalMap)),
  20104. void 0 !== e.normalMapType && (r.normalMapType = e.normalMapType),
  20105. void 0 !== e.normalScale && (i = e.normalScale,
  20106. !1 === Array.isArray(i) && (i = [i, i]),
  20107. r.normalScale = (new yn).fromArray(i)),
  20108. void 0 !== e.displacementMap && (r.displacementMap = n(e.displacementMap)),
  20109. void 0 !== e.displacementScale && (r.displacementScale = e.displacementScale),
  20110. void 0 !== e.displacementBias && (r.displacementBias = e.displacementBias),
  20111. void 0 !== e.roughnessMap && (r.roughnessMap = n(e.roughnessMap)),
  20112. void 0 !== e.metalnessMap && (r.metalnessMap = n(e.metalnessMap)),
  20113. void 0 !== e.emissiveMap && (r.emissiveMap = n(e.emissiveMap)),
  20114. void 0 !== e.emissiveIntensity && (r.emissiveIntensity = e.emissiveIntensity),
  20115. void 0 !== e.specularMap && (r.specularMap = n(e.specularMap)),
  20116. void 0 !== e.envMap && (r.envMap = n(e.envMap)),
  20117. void 0 !== e.envMapIntensity && (r.envMapIntensity = e.envMapIntensity),
  20118. void 0 !== e.reflectivity && (r.reflectivity = e.reflectivity),
  20119. void 0 !== e.refractionRatio && (r.refractionRatio = e.refractionRatio),
  20120. void 0 !== e.lightMap && (r.lightMap = n(e.lightMap)),
  20121. void 0 !== e.lightMapIntensity && (r.lightMapIntensity = e.lightMapIntensity),
  20122. void 0 !== e.aoMap && (r.aoMap = n(e.aoMap)),
  20123. void 0 !== e.aoMapIntensity && (r.aoMapIntensity = e.aoMapIntensity),
  20124. void 0 !== e.gradientMap && (r.gradientMap = n(e.gradientMap)),
  20125. void 0 !== e.clearcoatMap && (r.clearcoatMap = n(e.clearcoatMap)),
  20126. void 0 !== e.clearcoatRoughnessMap && (r.clearcoatRoughnessMap = n(e.clearcoatRoughnessMap)),
  20127. void 0 !== e.clearcoatNormalMap && (r.clearcoatNormalMap = n(e.clearcoatNormalMap)),
  20128. void 0 !== e.clearcoatNormalScale && (r.clearcoatNormalScale = (new yn).fromArray(e.clearcoatNormalScale)),
  20129. void 0 !== e.transmission && (r.transmission = e.transmission),
  20130. void 0 !== e.transmissionMap && (r.transmissionMap = n(e.transmissionMap)),
  20131. r
  20132. },
  20133. setTextures: function(e) {
  20134. return this.textures = e,
  20135. this
  20136. }
  20137. });
  20138. var ld = {
  20139. decodeText: function(e) {
  20140. if ("undefined" != typeof TextDecoder)
  20141. return (new TextDecoder).decode(e);
  20142. for (var t = "", n = 0, i = e.length; n < i; n++)
  20143. t += String.fromCharCode(e[n]);
  20144. try {
  20145. return decodeURIComponent(escape(t))
  20146. } catch (e) {
  20147. return t
  20148. }
  20149. },
  20150. extractUrlBase: function(e) {
  20151. var t = e.lastIndexOf("/");
  20152. return -1 === t ? "./" : e.substr(0, t + 1)
  20153. }
  20154. };
  20155. function ud() {
  20156. Mr.call(this),
  20157. this.type = "InstancedBufferGeometry",
  20158. this.instanceCount = 1 / 0
  20159. }
  20160. function cd(e, t, n, i) {
  20161. "number" == typeof n && (i = n,
  20162. n = !1,
  20163. console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),
  20164. nr.call(this, e, t, n),
  20165. this.meshPerAttribute = i || 1
  20166. }
  20167. function dd(e) {
  20168. mc.call(this, e)
  20169. }
  20170. ud.prototype = Object.assign(Object.create(Mr.prototype), {
  20171. constructor: ud,
  20172. isInstancedBufferGeometry: !0,
  20173. copy: function(e) {
  20174. return Mr.prototype.copy.call(this, e),
  20175. this.instanceCount = e.instanceCount,
  20176. this
  20177. },
  20178. clone: function() {
  20179. return (new this.constructor).copy(this)
  20180. },
  20181. toJSON: function() {
  20182. var e = Mr.prototype.toJSON.call(this);
  20183. return e.instanceCount = this.instanceCount,
  20184. e.isInstancedBufferGeometry = !0,
  20185. e
  20186. }
  20187. }),
  20188. cd.prototype = Object.assign(Object.create(nr.prototype), {
  20189. constructor: cd,
  20190. isInstancedBufferAttribute: !0,
  20191. copy: function(e) {
  20192. return nr.prototype.copy.call(this, e),
  20193. this.meshPerAttribute = e.meshPerAttribute,
  20194. this
  20195. },
  20196. toJSON: function() {
  20197. var e = nr.prototype.toJSON.call(this);
  20198. return e.meshPerAttribute = this.meshPerAttribute,
  20199. e.isInstancedBufferAttribute = !0,
  20200. e
  20201. }
  20202. }),
  20203. dd.prototype = Object.assign(Object.create(mc.prototype), {
  20204. constructor: dd,
  20205. load: function(t, n, e, i) {
  20206. var r = this
  20207. , a = new gc(r.manager);
  20208. a.setPath(r.path),
  20209. a.setRequestHeader(r.requestHeader),
  20210. a.setWithCredentials(r.withCredentials),
  20211. a.load(t, function(e) {
  20212. try {
  20213. n(r.parse(JSON.parse(e)))
  20214. } catch (e) {
  20215. i ? i(e) : console.error(e),
  20216. r.manager.itemError(t)
  20217. }
  20218. }, e, i)
  20219. },
  20220. parse: function(e) {
  20221. var i = {}
  20222. , r = {};
  20223. function t(e, t) {
  20224. if (void 0 !== i[t])
  20225. return i[t];
  20226. var n = e.interleavedBuffers[t]
  20227. , e = function(e, t) {
  20228. if (void 0 !== r[t])
  20229. return r[t];
  20230. e = e.arrayBuffers[t],
  20231. e = new Uint32Array(e).buffer;
  20232. return r[t] = e
  20233. }(e, n.buffer)
  20234. , e = new ys(vr(n.type, e),n.stride);
  20235. return e.uuid = n.uuid,
  20236. i[t] = e
  20237. }
  20238. var n = new (e.isInstancedBufferGeometry ? ud : Mr)
  20239. , a = e.data.index;
  20240. void 0 !== a && (_ = vr(a.type, a.array),
  20241. n.setIndex(new nr(_,1)));
  20242. var o, s = e.data.attributes;
  20243. for (o in s) {
  20244. var l, u = s[o], c = void 0;
  20245. c = u.isInterleavedBufferAttribute ? new xs(t(e.data, u.data),u.itemSize,u.offset,u.normalized) : (l = vr(u.type, u.array),
  20246. new (u.isInstancedBufferAttribute ? cd : nr)(l,u.itemSize,u.normalized)),
  20247. void 0 !== u.name && (c.name = u.name),
  20248. n.setAttribute(o, c)
  20249. }
  20250. var d = e.data.morphAttributes;
  20251. if (d)
  20252. for (var h in d) {
  20253. for (var p = d[h], f = [], m = 0, v = p.length; m < v; m++) {
  20254. var g = p[m]
  20255. , y = void 0;
  20256. y = g.isInterleavedBufferAttribute ? new xs(t(e.data, g.data),g.itemSize,g.offset,g.normalized) : new nr(vr(g.type, g.array),g.itemSize,g.normalized),
  20257. void 0 !== g.name && (y.name = g.name),
  20258. f.push(y)
  20259. }
  20260. n.morphAttributes[h] = f
  20261. }
  20262. e.data.morphTargetsRelative && (n.morphTargetsRelative = !0);
  20263. var w = e.data.groups || e.data.drawcalls || e.data.offsets;
  20264. if (void 0 !== w)
  20265. for (var b = 0, x = w.length; b !== x; ++b) {
  20266. var E = w[b];
  20267. n.addGroup(E.start, E.count, E.materialIndex)
  20268. }
  20269. var _, a = e.data.boundingSphere;
  20270. return void 0 !== a && (_ = new Cn,
  20271. void 0 !== a.center && _.fromArray(a.center),
  20272. n.boundingSphere = new qn(_,a.radius)),
  20273. e.name && (n.name = e.name),
  20274. e.userData && (n.userData = e.userData),
  20275. n
  20276. }
  20277. });
  20278. var hd, pd = function() {
  20279. y(n, mc);
  20280. var t = w(n);
  20281. function n(e) {
  20282. return O(this, n),
  20283. t.call(this, e)
  20284. }
  20285. return h(n, [{
  20286. key: "load",
  20287. value: function(n, i, e, r) {
  20288. var a = this
  20289. , t = "" === this.path ? ld.extractUrlBase(n) : this.path;
  20290. this.resourcePath = this.resourcePath || t;
  20291. t = new gc(this.manager);
  20292. t.setPath(this.path),
  20293. t.setRequestHeader(this.requestHeader),
  20294. t.setWithCredentials(this.withCredentials),
  20295. t.load(n, function(e) {
  20296. var t = null;
  20297. try {
  20298. t = JSON.parse(e)
  20299. } catch (e) {
  20300. return void 0 !== r && r(e),
  20301. void console.error("THREE:ObjectLoader: Can't parse " + n + ".", e.message)
  20302. }
  20303. e = t.metadata;
  20304. void 0 !== e && void 0 !== e.type && "geometry" !== e.type.toLowerCase() ? a.parse(t, i) : console.error("THREE.ObjectLoader: Can't load " + n)
  20305. }, e, r)
  20306. }
  20307. }, {
  20308. key: "parse",
  20309. value: function(e, t) {
  20310. var n = this.parseAnimations(e.animations)
  20311. , i = this.parseShapes(e.shapes)
  20312. , r = this.parseGeometries(e.geometries, i)
  20313. , a = this.parseImages(e.images, function() {
  20314. void 0 !== t && t(o)
  20315. })
  20316. , i = this.parseTextures(e.textures, a)
  20317. , i = this.parseMaterials(e.materials, i)
  20318. , o = this.parseObject(e.object, r, i, n)
  20319. , e = this.parseSkeletons(e.skeletons, o);
  20320. if (this.bindSkeletons(o, e),
  20321. void 0 !== t) {
  20322. var s, l = !1;
  20323. for (s in a)
  20324. if (a[s]instanceof HTMLImageElement) {
  20325. l = !0;
  20326. break
  20327. }
  20328. !1 === l && t(o)
  20329. }
  20330. return o
  20331. }
  20332. }, {
  20333. key: "parseShapes",
  20334. value: function(e) {
  20335. var t = {};
  20336. if (void 0 !== e)
  20337. for (var n = 0, i = e.length; n < i; n++) {
  20338. var r = (new Xc).fromJSON(e[n]);
  20339. t[r.uuid] = r
  20340. }
  20341. return t
  20342. }
  20343. }, {
  20344. key: "parseSkeletons",
  20345. value: function(e, t) {
  20346. var n = {}
  20347. , i = {};
  20348. if (t.traverse(function(e) {
  20349. e.isBone && (i[e.uuid] = e)
  20350. }),
  20351. void 0 !== e)
  20352. for (var r = 0, a = e.length; r < a; r++) {
  20353. var o = (new Ys).fromJSON(e[r], i);
  20354. n[o.uuid] = o
  20355. }
  20356. return n
  20357. }
  20358. }, {
  20359. key: "parseGeometries",
  20360. value: function(e, t) {
  20361. var n = {};
  20362. if (void 0 !== e)
  20363. for (var i = new dd, r = 0, a = e.length; r < a; r++) {
  20364. var o = void 0
  20365. , s = e[r];
  20366. switch (s.type) {
  20367. case "PlaneGeometry":
  20368. case "PlaneBufferGeometry":
  20369. o = new Nu[s.type](s.width,s.height,s.widthSegments,s.heightSegments);
  20370. break;
  20371. case "BoxGeometry":
  20372. case "BoxBufferGeometry":
  20373. case "CubeGeometry":
  20374. o = new Nu[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);
  20375. break;
  20376. case "CircleGeometry":
  20377. case "CircleBufferGeometry":
  20378. o = new Nu[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);
  20379. break;
  20380. case "CylinderGeometry":
  20381. case "CylinderBufferGeometry":
  20382. o = new Nu[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);
  20383. break;
  20384. case "ConeGeometry":
  20385. case "ConeBufferGeometry":
  20386. o = new Nu[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);
  20387. break;
  20388. case "SphereGeometry":
  20389. case "SphereBufferGeometry":
  20390. o = new Nu[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);
  20391. break;
  20392. case "DodecahedronGeometry":
  20393. case "DodecahedronBufferGeometry":
  20394. case "IcosahedronGeometry":
  20395. case "IcosahedronBufferGeometry":
  20396. case "OctahedronGeometry":
  20397. case "OctahedronBufferGeometry":
  20398. case "TetrahedronGeometry":
  20399. case "TetrahedronBufferGeometry":
  20400. o = new Nu[s.type](s.radius,s.detail);
  20401. break;
  20402. case "RingGeometry":
  20403. case "RingBufferGeometry":
  20404. o = new Nu[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);
  20405. break;
  20406. case "TorusGeometry":
  20407. case "TorusBufferGeometry":
  20408. o = new Nu[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);
  20409. break;
  20410. case "TorusKnotGeometry":
  20411. case "TorusKnotBufferGeometry":
  20412. o = new Nu[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);
  20413. break;
  20414. case "TubeGeometry":
  20415. case "TubeBufferGeometry":
  20416. o = new Nu[s.type]((new Vc[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);
  20417. break;
  20418. case "LatheGeometry":
  20419. case "LatheBufferGeometry":
  20420. o = new Nu[s.type](s.points,s.segments,s.phiStart,s.phiLength);
  20421. break;
  20422. case "PolyhedronGeometry":
  20423. case "PolyhedronBufferGeometry":
  20424. o = new Nu[s.type](s.vertices,s.indices,s.radius,s.details);
  20425. break;
  20426. case "ShapeGeometry":
  20427. case "ShapeBufferGeometry":
  20428. for (var l = [], u = 0, c = s.shapes.length; u < c; u++) {
  20429. var d = t[s.shapes[u]];
  20430. l.push(d)
  20431. }
  20432. o = new Nu[s.type](l,s.curveSegments);
  20433. break;
  20434. case "ExtrudeGeometry":
  20435. case "ExtrudeBufferGeometry":
  20436. l = [];
  20437. for (var h = 0, p = s.shapes.length; h < p; h++) {
  20438. var f = t[s.shapes[h]];
  20439. l.push(f)
  20440. }
  20441. var m = s.options.extrudePath;
  20442. void 0 !== m && (s.options.extrudePath = (new Vc[m.type]).fromJSON(m)),
  20443. o = new Nu[s.type](l,s.options);
  20444. break;
  20445. case "BufferGeometry":
  20446. case "InstancedBufferGeometry":
  20447. o = i.parse(s);
  20448. break;
  20449. case "Geometry":
  20450. console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');
  20451. break;
  20452. default:
  20453. console.warn('THREE.ObjectLoader: Unsupported geometry type "' + s.type + '"');
  20454. continue
  20455. }
  20456. o.uuid = s.uuid,
  20457. void 0 !== s.name && (o.name = s.name),
  20458. !0 === o.isBufferGeometry && void 0 !== s.userData && (o.userData = s.userData),
  20459. n[s.uuid] = o
  20460. }
  20461. return n
  20462. }
  20463. }, {
  20464. key: "parseMaterials",
  20465. value: function(e, t) {
  20466. var n = {}
  20467. , i = {};
  20468. if (void 0 !== e) {
  20469. var r = new sd;
  20470. r.setTextures(t);
  20471. for (var a = 0, o = e.length; a < o; a++) {
  20472. var s = e[a];
  20473. if ("MultiMaterial" === s.type) {
  20474. for (var l = [], u = 0; u < s.materials.length; u++) {
  20475. var c = s.materials[u];
  20476. void 0 === n[c.uuid] && (n[c.uuid] = r.parse(c)),
  20477. l.push(n[c.uuid])
  20478. }
  20479. i[s.uuid] = l
  20480. } else
  20481. void 0 === n[s.uuid] && (n[s.uuid] = r.parse(s)),
  20482. i[s.uuid] = n[s.uuid]
  20483. }
  20484. }
  20485. return i
  20486. }
  20487. }, {
  20488. key: "parseAnimations",
  20489. value: function(e) {
  20490. var t = {};
  20491. if (void 0 !== e)
  20492. for (var n = 0; n < e.length; n++) {
  20493. var i = e[n]
  20494. , i = cc.parse(i);
  20495. t[i.uuid] = i
  20496. }
  20497. return t
  20498. }
  20499. }, {
  20500. key: "parseImages",
  20501. value: function(e, t) {
  20502. var n = this
  20503. , i = {};
  20504. function r(e) {
  20505. if ("string" != typeof e)
  20506. return e.data ? {
  20507. data: vr(e.type, e.data),
  20508. width: e.width,
  20509. height: e.height
  20510. } : null;
  20511. var t, e = e, e = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(e) ? e : n.resourcePath + e;
  20512. return t = e,
  20513. n.manager.itemStart(t),
  20514. a.load(t, function() {
  20515. n.manager.itemEnd(t)
  20516. }, void 0, function() {
  20517. n.manager.itemError(t),
  20518. n.manager.itemEnd(t)
  20519. })
  20520. }
  20521. if (void 0 !== e && 0 < e.length) {
  20522. var a, t = new pc(t);
  20523. (a = new bc(t)).setCrossOrigin(this.crossOrigin);
  20524. for (var o = 0, s = e.length; o < s; o++) {
  20525. var l = e[o]
  20526. , u = l.url;
  20527. if (Array.isArray(u)) {
  20528. i[l.uuid] = [];
  20529. for (var c = 0, d = u.length; c < d; c++) {
  20530. var h = r(u[c]);
  20531. null !== h && (h instanceof HTMLImageElement ? i[l.uuid].push(h) : i[l.uuid].push(new ia(h.data,h.width,h.height)))
  20532. }
  20533. } else {
  20534. var p = r(l.url);
  20535. null !== p && (i[l.uuid] = p)
  20536. }
  20537. }
  20538. }
  20539. return i
  20540. }
  20541. }, {
  20542. key: "parseTextures",
  20543. value: function(e, t) {
  20544. function n(e, t) {
  20545. return "number" == typeof e ? e : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", e),
  20546. t[e])
  20547. }
  20548. var i = {};
  20549. if (void 0 !== e)
  20550. for (var r = 0, a = e.length; r < a; r++) {
  20551. var o = e[r];
  20552. void 0 === o.image && console.warn('THREE.ObjectLoader: No "image" specified for', o.uuid),
  20553. void 0 === t[o.image] && console.warn("THREE.ObjectLoader: Undefined image", o.image);
  20554. var s = void 0
  20555. , l = t[o.image];
  20556. Array.isArray(l) ? (s = new ta(l),
  20557. 6 === l.length && (s.needsUpdate = !0)) : (s = l && l.data ? new ia(l.data,l.width,l.height) : new En(l),
  20558. l && (s.needsUpdate = !0)),
  20559. s.uuid = o.uuid,
  20560. void 0 !== o.name && (s.name = o.name),
  20561. void 0 !== o.mapping && (s.mapping = n(o.mapping, fd)),
  20562. void 0 !== o.offset && s.offset.fromArray(o.offset),
  20563. void 0 !== o.repeat && s.repeat.fromArray(o.repeat),
  20564. void 0 !== o.center && s.center.fromArray(o.center),
  20565. void 0 !== o.rotation && (s.rotation = o.rotation),
  20566. void 0 !== o.wrap && (s.wrapS = n(o.wrap[0], md),
  20567. s.wrapT = n(o.wrap[1], md)),
  20568. void 0 !== o.format && (s.format = o.format),
  20569. void 0 !== o.type && (s.type = o.type),
  20570. void 0 !== o.encoding && (s.encoding = o.encoding),
  20571. void 0 !== o.minFilter && (s.minFilter = n(o.minFilter, vd)),
  20572. void 0 !== o.magFilter && (s.magFilter = n(o.magFilter, vd)),
  20573. void 0 !== o.anisotropy && (s.anisotropy = o.anisotropy),
  20574. void 0 !== o.flipY && (s.flipY = o.flipY),
  20575. void 0 !== o.premultiplyAlpha && (s.premultiplyAlpha = o.premultiplyAlpha),
  20576. void 0 !== o.unpackAlignment && (s.unpackAlignment = o.unpackAlignment),
  20577. i[o.uuid] = s
  20578. }
  20579. return i
  20580. }
  20581. }, {
  20582. key: "parseObject",
  20583. value: function(e, t, a, n) {
  20584. function i(e) {
  20585. return void 0 === t[e] && console.warn("THREE.ObjectLoader: Undefined geometry", e),
  20586. t[e]
  20587. }
  20588. function r(e) {
  20589. if (void 0 !== e) {
  20590. if (Array.isArray(e)) {
  20591. for (var t = [], n = 0, i = e.length; n < i; n++) {
  20592. var r = e[n];
  20593. void 0 === a[r] && console.warn("THREE.ObjectLoader: Undefined material", r),
  20594. t.push(a[r])
  20595. }
  20596. return t
  20597. }
  20598. return void 0 === a[e] && console.warn("THREE.ObjectLoader: Undefined material", e),
  20599. a[e]
  20600. }
  20601. }
  20602. switch (e.type) {
  20603. case "Scene":
  20604. o = new gs,
  20605. void 0 !== e.background && Number.isInteger(e.background) && (o.background = new Yi(e.background)),
  20606. void 0 !== e.fog && ("Fog" === e.fog.type ? o.fog = new vs(e.fog.color,e.fog.near,e.fog.far) : "FogExp2" === e.fog.type && (o.fog = new ms(e.fog.color,e.fog.density)));
  20607. break;
  20608. case "PerspectiveCamera":
  20609. o = new $r(e.fov,e.aspect,e.near,e.far),
  20610. void 0 !== e.focus && (o.focus = e.focus),
  20611. void 0 !== e.zoom && (o.zoom = e.zoom),
  20612. void 0 !== e.filmGauge && (o.filmGauge = e.filmGauge),
  20613. void 0 !== e.filmOffset && (o.filmOffset = e.filmOffset),
  20614. void 0 !== e.view && (o.view = Object.assign({}, e.view));
  20615. break;
  20616. case "OrthographicCamera":
  20617. o = new ed(e.left,e.right,e.top,e.bottom,e.near,e.far),
  20618. void 0 !== e.zoom && (o.zoom = e.zoom),
  20619. void 0 !== e.view && (o.view = Object.assign({}, e.view));
  20620. break;
  20621. case "AmbientLight":
  20622. o = new id(e.color,e.intensity);
  20623. break;
  20624. case "DirectionalLight":
  20625. o = new nd(e.color,e.intensity);
  20626. break;
  20627. case "PointLight":
  20628. o = new $c(e.color,e.intensity,e.distance,e.decay);
  20629. break;
  20630. case "RectAreaLight":
  20631. o = new rd(e.color,e.intensity,e.width,e.height);
  20632. break;
  20633. case "SpotLight":
  20634. o = new Qc(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);
  20635. break;
  20636. case "HemisphereLight":
  20637. o = new Jc(e.color,e.groundColor,e.intensity);
  20638. break;
  20639. case "LightProbe":
  20640. o = (new od).fromJSON(e);
  20641. break;
  20642. case "SkinnedMesh":
  20643. o = new Ws(s = i(e.geometry),l = r(e.material)),
  20644. void 0 !== e.bindMode && (o.bindMode = e.bindMode),
  20645. void 0 !== e.bindMatrix && o.bindMatrix.fromArray(e.bindMatrix),
  20646. void 0 !== e.skeleton && (o.skeleton = e.skeleton);
  20647. break;
  20648. case "Mesh":
  20649. o = new Hr(s = i(e.geometry),l = r(e.material));
  20650. break;
  20651. case "InstancedMesh":
  20652. var o, s = i(e.geometry), l = r(e.material), u = e.count, c = e.instanceMatrix;
  20653. (o = new el(s,l,u)).instanceMatrix = new nr(new Float32Array(c.array),16);
  20654. break;
  20655. case "LOD":
  20656. o = new Ns;
  20657. break;
  20658. case "Line":
  20659. o = new sl(i(e.geometry),r(e.material));
  20660. break;
  20661. case "LineLoop":
  20662. o = new dl(i(e.geometry),r(e.material));
  20663. break;
  20664. case "LineSegments":
  20665. o = new cl(i(e.geometry),r(e.material));
  20666. break;
  20667. case "PointCloud":
  20668. case "Points":
  20669. o = new gl(i(e.geometry),r(e.material));
  20670. break;
  20671. case "Sprite":
  20672. o = new Fs(r(e.material));
  20673. break;
  20674. case "Group":
  20675. o = new us;
  20676. break;
  20677. case "Bone":
  20678. o = new Xs;
  20679. break;
  20680. default:
  20681. o = new Si
  20682. }
  20683. if (o.uuid = e.uuid,
  20684. void 0 !== e.name && (o.name = e.name),
  20685. void 0 !== e.matrix ? (o.matrix.fromArray(e.matrix),
  20686. void 0 !== e.matrixAutoUpdate && (o.matrixAutoUpdate = e.matrixAutoUpdate),
  20687. o.matrixAutoUpdate && o.matrix.decompose(o.position, o.quaternion, o.scale)) : (void 0 !== e.position && o.position.fromArray(e.position),
  20688. void 0 !== e.rotation && o.rotation.fromArray(e.rotation),
  20689. void 0 !== e.quaternion && o.quaternion.fromArray(e.quaternion),
  20690. void 0 !== e.scale && o.scale.fromArray(e.scale)),
  20691. void 0 !== e.castShadow && (o.castShadow = e.castShadow),
  20692. void 0 !== e.receiveShadow && (o.receiveShadow = e.receiveShadow),
  20693. e.shadow && (void 0 !== e.shadow.bias && (o.shadow.bias = e.shadow.bias),
  20694. void 0 !== e.shadow.normalBias && (o.shadow.normalBias = e.shadow.normalBias),
  20695. void 0 !== e.shadow.radius && (o.shadow.radius = e.shadow.radius),
  20696. void 0 !== e.shadow.mapSize && o.shadow.mapSize.fromArray(e.shadow.mapSize),
  20697. void 0 !== e.shadow.camera && (o.shadow.camera = this.parseObject(e.shadow.camera))),
  20698. void 0 !== e.visible && (o.visible = e.visible),
  20699. void 0 !== e.frustumCulled && (o.frustumCulled = e.frustumCulled),
  20700. void 0 !== e.renderOrder && (o.renderOrder = e.renderOrder),
  20701. void 0 !== e.userData && (o.userData = e.userData),
  20702. void 0 !== e.layers && (o.layers.mask = e.layers),
  20703. void 0 !== e.children)
  20704. for (var d = e.children, h = 0; h < d.length; h++)
  20705. o.add(this.parseObject(d[h], t, a, n));
  20706. if (void 0 !== e.animations)
  20707. for (var p = e.animations, f = 0; f < p.length; f++) {
  20708. var m = p[f];
  20709. o.animations.push(n[m])
  20710. }
  20711. if ("LOD" === e.type) {
  20712. void 0 !== e.autoUpdate && (o.autoUpdate = e.autoUpdate);
  20713. for (var v = e.levels, g = 0; g < v.length; g++) {
  20714. var y = v[g]
  20715. , w = o.getObjectByProperty("uuid", y.object);
  20716. void 0 !== w && o.addLevel(w, y.distance)
  20717. }
  20718. }
  20719. return o
  20720. }
  20721. }, {
  20722. key: "bindSkeletons",
  20723. value: function(e, n) {
  20724. 0 !== Object.keys(n).length && e.traverse(function(e) {
  20725. var t;
  20726. !0 === e.isSkinnedMesh && void 0 !== e.skeleton && (void 0 === (t = n[e.skeleton]) ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", e.skeleton) : e.bind(t, e.bindMatrix))
  20727. })
  20728. }
  20729. }, {
  20730. key: "setTexturePath",
  20731. value: function(e) {
  20732. return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),
  20733. this.setResourcePath(e)
  20734. }
  20735. }]),
  20736. n
  20737. }(), fd = {
  20738. UVMapping: 300,
  20739. CubeReflectionMapping: L,
  20740. CubeRefractionMapping: R,
  20741. EquirectangularReflectionMapping: F,
  20742. EquirectangularRefractionMapping: I,
  20743. CubeUVReflectionMapping: z,
  20744. CubeUVRefractionMapping: U
  20745. }, md = {
  20746. RepeatWrapping: ke,
  20747. ClampToEdgeWrapping: Be,
  20748. MirroredRepeatWrapping: Le
  20749. }, vd = {
  20750. NearestFilter: Re,
  20751. NearestMipmapNearestFilter: Fe,
  20752. NearestMipmapLinearFilter: Ie,
  20753. LinearFilter: Oe,
  20754. LinearMipmapNearestFilter: ze,
  20755. LinearMipmapLinearFilter: Ne
  20756. };
  20757. function gd(e) {
  20758. "undefined" == typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),
  20759. "undefined" == typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."),
  20760. mc.call(this, e),
  20761. this.options = {
  20762. premultiplyAlpha: "none"
  20763. }
  20764. }
  20765. function yd() {
  20766. this.type = "ShapePath",
  20767. this.color = new Yi,
  20768. this.subPaths = [],
  20769. this.currentPath = null
  20770. }
  20771. function wd(e) {
  20772. this.type = "Font",
  20773. this.data = e
  20774. }
  20775. function bd(e) {
  20776. mc.call(this, e)
  20777. }
  20778. gd.prototype = Object.assign(Object.create(mc.prototype), {
  20779. constructor: gd,
  20780. isImageBitmapLoader: !0,
  20781. setOptions: function(e) {
  20782. return this.options = e,
  20783. this
  20784. },
  20785. load: function(t, n, e, i) {
  20786. void 0 === t && (t = ""),
  20787. void 0 !== this.path && (t = this.path + t),
  20788. t = this.manager.resolveURL(t);
  20789. var r = this
  20790. , a = hc.get(t);
  20791. if (void 0 !== a)
  20792. return r.manager.itemStart(t),
  20793. setTimeout(function() {
  20794. n && n(a),
  20795. r.manager.itemEnd(t)
  20796. }, 0),
  20797. a;
  20798. var o = {};
  20799. o.credentials = "anonymous" === this.crossOrigin ? "same-origin" : "include",
  20800. fetch(t, o).then(function(e) {
  20801. return e.blob()
  20802. }).then(function(e) {
  20803. return createImageBitmap(e, r.options)
  20804. }).then(function(e) {
  20805. hc.add(t, e),
  20806. n && n(e),
  20807. r.manager.itemEnd(t)
  20808. }).catch(function(e) {
  20809. i && i(e, t),
  20810. r.manager.itemError(t),
  20811. r.manager.itemEnd(t)
  20812. }),
  20813. r.manager.itemStart(t)
  20814. }
  20815. }),
  20816. Object.assign(yd.prototype, {
  20817. moveTo: function(e, t) {
  20818. return this.currentPath = new Wc,
  20819. this.subPaths.push(this.currentPath),
  20820. this.currentPath.moveTo(e, t),
  20821. this
  20822. },
  20823. lineTo: function(e, t) {
  20824. return this.currentPath.lineTo(e, t),
  20825. this
  20826. },
  20827. quadraticCurveTo: function(e, t, n, i) {
  20828. return this.currentPath.quadraticCurveTo(e, t, n, i),
  20829. this
  20830. },
  20831. bezierCurveTo: function(e, t, n, i, r, a) {
  20832. return this.currentPath.bezierCurveTo(e, t, n, i, r, a),
  20833. this
  20834. },
  20835. splineThru: function(e) {
  20836. return this.currentPath.splineThru(e),
  20837. this
  20838. },
  20839. toShapes: function(e, t) {
  20840. function n(e) {
  20841. for (var t = [], n = 0, i = e.length; n < i; n++) {
  20842. var r = e[n]
  20843. , a = new Xc;
  20844. a.curves = r.curves,
  20845. t.push(a)
  20846. }
  20847. return t
  20848. }
  20849. var i, r, a, o = ou.isClockWise, s = this.subPaths;
  20850. if (0 === s.length)
  20851. return [];
  20852. if (!0 === t)
  20853. return n(s);
  20854. var l = [];
  20855. if (1 === s.length)
  20856. return r = s[0],
  20857. (a = new Xc).curves = r.curves,
  20858. l.push(a),
  20859. l;
  20860. var u, c = !o(s[0].getPoints()), c = e ? !c : c, d = [], h = [], p = [], f = 0;
  20861. h[f] = void 0,
  20862. p[f] = [];
  20863. for (var m = 0, v = s.length; m < v; m++)
  20864. i = o(u = (r = s[m]).getPoints()),
  20865. (i = e ? !i : i) ? (!c && h[f] && f++,
  20866. h[f] = {
  20867. s: new Xc,
  20868. p: u
  20869. },
  20870. h[f].s.curves = r.curves,
  20871. c && f++,
  20872. p[f] = []) : p[f].push({
  20873. h: r,
  20874. p: u[0]
  20875. });
  20876. if (!h[0])
  20877. return n(s);
  20878. if (1 < h.length) {
  20879. for (var g = !1, y = [], w = 0, b = h.length; w < b; w++)
  20880. d[w] = [];
  20881. for (var x = 0, E = h.length; x < E; x++)
  20882. for (var _ = p[x], M = 0; M < _.length; M++) {
  20883. for (var A = _[M], T = !0, S = 0; S < h.length; S++)
  20884. !function(e, t) {
  20885. for (var n = t.length, i = !1, r = n - 1, a = 0; a < n; r = a++) {
  20886. var o = t[r]
  20887. , s = t[a]
  20888. , l = s.x - o.x
  20889. , u = s.y - o.y;
  20890. if (Math.abs(u) > Number.EPSILON) {
  20891. if (u < 0 && (o = t[a],
  20892. l = -l,
  20893. s = t[r],
  20894. u = -u),
  20895. !(e.y < o.y || e.y > s.y))
  20896. if (e.y === o.y) {
  20897. if (e.x === o.x)
  20898. return 1
  20899. } else {
  20900. l = u * (e.x - o.x) - l * (e.y - o.y);
  20901. if (0 == l)
  20902. return 1;
  20903. l < 0 || (i = !i)
  20904. }
  20905. } else if (e.y === o.y && (s.x <= e.x && e.x <= o.x || o.x <= e.x && e.x <= s.x))
  20906. return 1
  20907. }
  20908. return i
  20909. }(A.p, h[S].p) || (x !== S && y.push({
  20910. froms: x,
  20911. tos: S,
  20912. hole: M
  20913. }),
  20914. T ? (T = !1,
  20915. d[S].push(A)) : g = !0);
  20916. T && d[x].push(A)
  20917. }
  20918. 0 < y.length && (g || (p = d))
  20919. }
  20920. for (var C = 0, P = h.length; C < P; C++) {
  20921. a = h[C].s,
  20922. l.push(a);
  20923. for (var D, k = 0, B = (D = p[C]).length; k < B; k++)
  20924. a.holes.push(D[k].h)
  20925. }
  20926. return l
  20927. }
  20928. }),
  20929. Object.assign(wd.prototype, {
  20930. isFont: !0,
  20931. generateShapes: function(e) {
  20932. for (var t = [], n = function(e, t, n) {
  20933. for (var i = Array.from ? Array.from(e) : String(e).split(""), r = t / n.resolution, a = (n.boundingBox.yMax - n.boundingBox.yMin + n.underlineThickness) * r, o = [], s = 0, l = 0, u = 0; u < i.length; u++) {
  20934. var c = i[u];
  20935. "\n" === c ? (s = 0,
  20936. l -= a) : (c = function(e, t, n, i, r) {
  20937. var a = r.glyphs[e] || r.glyphs["?"];
  20938. if (a) {
  20939. var o, s, l, u, c, d, h, p, f = new yd;
  20940. if (a.o)
  20941. for (var m = a._cachedOutline || (a._cachedOutline = a.o.split(" ")), v = 0, g = m.length; v < g; )
  20942. switch (m[v++]) {
  20943. case "m":
  20944. o = m[v++] * t + n,
  20945. s = m[v++] * t + i,
  20946. f.moveTo(o, s);
  20947. break;
  20948. case "l":
  20949. o = m[v++] * t + n,
  20950. s = m[v++] * t + i,
  20951. f.lineTo(o, s);
  20952. break;
  20953. case "q":
  20954. l = m[v++] * t + n,
  20955. u = m[v++] * t + i,
  20956. c = m[v++] * t + n,
  20957. d = m[v++] * t + i,
  20958. f.quadraticCurveTo(c, d, l, u);
  20959. break;
  20960. case "b":
  20961. l = m[v++] * t + n,
  20962. u = m[v++] * t + i,
  20963. c = m[v++] * t + n,
  20964. d = m[v++] * t + i,
  20965. h = m[v++] * t + n,
  20966. p = m[v++] * t + i,
  20967. f.bezierCurveTo(c, d, h, p, l, u)
  20968. }
  20969. return {
  20970. offsetX: a.ha * t,
  20971. path: f
  20972. }
  20973. }
  20974. console.error('THREE.Font: character "' + e + '" does not exists in font family ' + r.familyName + ".")
  20975. }(c, r, s, l, n),
  20976. s += c.offsetX,
  20977. o.push(c.path))
  20978. }
  20979. return o
  20980. }(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 100, this.data), i = 0, r = n.length; i < r; i++)
  20981. Array.prototype.push.apply(t, n[i].toShapes());
  20982. return t
  20983. }
  20984. }),
  20985. bd.prototype = Object.assign(Object.create(mc.prototype), {
  20986. constructor: bd,
  20987. load: function(e, i, t, n) {
  20988. var r = this
  20989. , a = new gc(this.manager);
  20990. a.setPath(this.path),
  20991. a.setRequestHeader(this.requestHeader),
  20992. a.setWithCredentials(r.withCredentials),
  20993. a.load(e, function(t) {
  20994. try {
  20995. n = JSON.parse(t)
  20996. } catch (e) {
  20997. console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),
  20998. n = JSON.parse(t.substring(65, t.length - 2))
  20999. }
  21000. var n = r.parse(n);
  21001. i && i(n)
  21002. }, t, n)
  21003. },
  21004. parse: function(e) {
  21005. return new wd(e)
  21006. }
  21007. });
  21008. var xd = {
  21009. getContext: function() {
  21010. return hd = void 0 === hd ? new (window.AudioContext || window.webkitAudioContext) : hd
  21011. },
  21012. setContext: function(e) {
  21013. hd = e
  21014. }
  21015. };
  21016. function Ed(e) {
  21017. mc.call(this, e)
  21018. }
  21019. function _d(e, t, n) {
  21020. od.call(this, void 0, n);
  21021. var i = (new Yi).set(e)
  21022. , n = (new Yi).set(t)
  21023. , e = new Cn(i.r,i.g,i.b)
  21024. , t = new Cn(n.r,n.g,n.b)
  21025. , i = Math.sqrt(Math.PI)
  21026. , n = i * Math.sqrt(.75);
  21027. this.sh.coefficients[0].copy(e).add(t).multiplyScalar(i),
  21028. this.sh.coefficients[1].copy(e).sub(t).multiplyScalar(n)
  21029. }
  21030. function Md(e, t) {
  21031. od.call(this, void 0, t);
  21032. e = (new Yi).set(e);
  21033. this.sh.coefficients[0].set(e.r, e.g, e.b).multiplyScalar(2 * Math.sqrt(Math.PI))
  21034. }
  21035. Ed.prototype = Object.assign(Object.create(mc.prototype), {
  21036. constructor: Ed,
  21037. load: function(n, i, e, r) {
  21038. var a = this
  21039. , t = new gc(a.manager);
  21040. t.setResponseType("arraybuffer"),
  21041. t.setPath(a.path),
  21042. t.setRequestHeader(a.requestHeader),
  21043. t.setWithCredentials(a.withCredentials),
  21044. t.load(n, function(e) {
  21045. try {
  21046. var t = e.slice(0);
  21047. xd.getContext().decodeAudioData(t, function(e) {
  21048. i(e)
  21049. })
  21050. } catch (e) {
  21051. r ? r(e) : console.error(e),
  21052. a.manager.itemError(n)
  21053. }
  21054. }, e, r)
  21055. }
  21056. }),
  21057. _d.prototype = Object.assign(Object.create(od.prototype), {
  21058. constructor: _d,
  21059. isHemisphereLightProbe: !0,
  21060. copy: function(e) {
  21061. return od.prototype.copy.call(this, e),
  21062. this
  21063. },
  21064. toJSON: function(e) {
  21065. return od.prototype.toJSON.call(this, e)
  21066. }
  21067. }),
  21068. Md.prototype = Object.assign(Object.create(od.prototype), {
  21069. constructor: Md,
  21070. isAmbientLightProbe: !0,
  21071. copy: function(e) {
  21072. return od.prototype.copy.call(this, e),
  21073. this
  21074. },
  21075. toJSON: function(e) {
  21076. return od.prototype.toJSON.call(this, e)
  21077. }
  21078. });
  21079. var Ad = new ni
  21080. , Td = new ni;
  21081. function Sd() {
  21082. this.type = "StereoCamera",
  21083. this.aspect = 1,
  21084. this.eyeSep = .064,
  21085. this.cameraL = new $r,
  21086. this.cameraL.layers.enable(1),
  21087. this.cameraL.matrixAutoUpdate = !1,
  21088. this.cameraR = new $r,
  21089. this.cameraR.layers.enable(2),
  21090. this.cameraR.matrixAutoUpdate = !1,
  21091. this._cache = {
  21092. focus: null,
  21093. fov: null,
  21094. aspect: null,
  21095. near: null,
  21096. far: null,
  21097. zoom: null,
  21098. eyeSep: null
  21099. }
  21100. }
  21101. Object.assign(Sd.prototype, {
  21102. update: function(e) {
  21103. var t, n, i, r, a, o = this._cache;
  21104. o.focus === e.focus && o.fov === e.fov && o.aspect === e.aspect * this.aspect && o.near === e.near && o.far === e.far && o.zoom === e.zoom && o.eyeSep === this.eyeSep || (o.focus = e.focus,
  21105. o.fov = e.fov,
  21106. o.aspect = e.aspect * this.aspect,
  21107. o.near = e.near,
  21108. o.far = e.far,
  21109. o.zoom = e.zoom,
  21110. o.eyeSep = this.eyeSep,
  21111. t = e.projectionMatrix.clone(),
  21112. n = (a = o.eyeSep / 2) * o.near / o.focus,
  21113. i = o.near * Math.tan(gn.DEG2RAD * o.fov * .5) / o.zoom,
  21114. Td.elements[12] = -a,
  21115. Ad.elements[12] = a,
  21116. r = -i * o.aspect + n,
  21117. a = i * o.aspect + n,
  21118. t.elements[0] = 2 * o.near / (a - r),
  21119. t.elements[8] = (a + r) / (a - r),
  21120. this.cameraL.projectionMatrix.copy(t),
  21121. r = -i * o.aspect - n,
  21122. a = i * o.aspect - n,
  21123. t.elements[0] = 2 * o.near / (a - r),
  21124. t.elements[8] = (a + r) / (a - r),
  21125. this.cameraR.projectionMatrix.copy(t)),
  21126. this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Td),
  21127. this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ad)
  21128. }
  21129. });
  21130. var Cd = function() {
  21131. function t(e) {
  21132. O(this, t),
  21133. this.autoStart = void 0 === e || e,
  21134. this.startTime = 0,
  21135. this.oldTime = 0,
  21136. this.elapsedTime = 0,
  21137. this.running = !1
  21138. }
  21139. return h(t, [{
  21140. key: "start",
  21141. value: function() {
  21142. this.startTime = Pd(),
  21143. this.oldTime = this.startTime,
  21144. this.elapsedTime = 0,
  21145. this.running = !0
  21146. }
  21147. }, {
  21148. key: "stop",
  21149. value: function() {
  21150. this.getElapsedTime(),
  21151. this.running = !1,
  21152. this.autoStart = !1
  21153. }
  21154. }, {
  21155. key: "getElapsedTime",
  21156. value: function() {
  21157. return this.getDelta(),
  21158. this.elapsedTime
  21159. }
  21160. }, {
  21161. key: "getDelta",
  21162. value: function() {
  21163. var e, t = 0;
  21164. return this.autoStart && !this.running ? (this.start(),
  21165. 0) : (this.running && (t = ((e = Pd()) - this.oldTime) / 1e3,
  21166. this.oldTime = e,
  21167. this.elapsedTime += t),
  21168. t)
  21169. }
  21170. }]),
  21171. t
  21172. }();
  21173. function Pd() {
  21174. return ("undefined" == typeof performance ? Date : performance).now()
  21175. }
  21176. var Dd = new Cn
  21177. , kd = new Sn
  21178. , Bd = new Cn
  21179. , Ld = new Cn
  21180. , Rd = function() {
  21181. y(i, Si);
  21182. var t = w(i);
  21183. function i() {
  21184. var e;
  21185. return O(this, i),
  21186. (e = t.call(this)).type = "AudioListener",
  21187. e.context = xd.getContext(),
  21188. e.gain = e.context.createGain(),
  21189. e.gain.connect(e.context.destination),
  21190. e.filter = null,
  21191. e.timeDelta = 0,
  21192. e._clock = new Cd,
  21193. e
  21194. }
  21195. return h(i, [{
  21196. key: "getInput",
  21197. value: function() {
  21198. return this.gain
  21199. }
  21200. }, {
  21201. key: "removeFilter",
  21202. value: function() {
  21203. return null !== this.filter && (this.gain.disconnect(this.filter),
  21204. this.filter.disconnect(this.context.destination),
  21205. this.gain.connect(this.context.destination),
  21206. this.filter = null),
  21207. this
  21208. }
  21209. }, {
  21210. key: "getFilter",
  21211. value: function() {
  21212. return this.filter
  21213. }
  21214. }, {
  21215. key: "setFilter",
  21216. value: function(e) {
  21217. return null !== this.filter ? (this.gain.disconnect(this.filter),
  21218. this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination),
  21219. this.filter = e,
  21220. this.gain.connect(this.filter),
  21221. this.filter.connect(this.context.destination),
  21222. this
  21223. }
  21224. }, {
  21225. key: "getMasterVolume",
  21226. value: function() {
  21227. return this.gain.gain.value
  21228. }
  21229. }, {
  21230. key: "setMasterVolume",
  21231. value: function(e) {
  21232. return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01),
  21233. this
  21234. }
  21235. }, {
  21236. key: "updateMatrixWorld",
  21237. value: function(e) {
  21238. b(v(i.prototype), "updateMatrixWorld", this).call(this, e);
  21239. var t = this.context.listener
  21240. , n = this.up;
  21241. this.timeDelta = this._clock.getDelta(),
  21242. this.matrixWorld.decompose(Dd, kd, Bd),
  21243. Ld.set(0, 0, -1).applyQuaternion(kd),
  21244. t.positionX ? (e = this.context.currentTime + this.timeDelta,
  21245. t.positionX.linearRampToValueAtTime(Dd.x, e),
  21246. t.positionY.linearRampToValueAtTime(Dd.y, e),
  21247. t.positionZ.linearRampToValueAtTime(Dd.z, e),
  21248. t.forwardX.linearRampToValueAtTime(Ld.x, e),
  21249. t.forwardY.linearRampToValueAtTime(Ld.y, e),
  21250. t.forwardZ.linearRampToValueAtTime(Ld.z, e),
  21251. t.upX.linearRampToValueAtTime(n.x, e),
  21252. t.upY.linearRampToValueAtTime(n.y, e),
  21253. t.upZ.linearRampToValueAtTime(n.z, e)) : (t.setPosition(Dd.x, Dd.y, Dd.z),
  21254. t.setOrientation(Ld.x, Ld.y, Ld.z, n.x, n.y, n.z))
  21255. }
  21256. }]),
  21257. i
  21258. }()
  21259. , Fd = function() {
  21260. y(i, Si);
  21261. var n = w(i);
  21262. function i(e) {
  21263. var t;
  21264. return O(this, i),
  21265. (t = n.call(this)).type = "Audio",
  21266. t.listener = e,
  21267. t.context = e.context,
  21268. t.gain = t.context.createGain(),
  21269. t.gain.connect(e.getInput()),
  21270. t.autoplay = !1,
  21271. t.buffer = null,
  21272. t.detune = 0,
  21273. t.loop = !1,
  21274. t.loopStart = 0,
  21275. t.loopEnd = 0,
  21276. t.offset = 0,
  21277. t.duration = void 0,
  21278. t.playbackRate = 1,
  21279. t.isPlaying = !1,
  21280. t.hasPlaybackControl = !0,
  21281. t.source = null,
  21282. t.sourceType = "empty",
  21283. t._startedAt = 0,
  21284. t._progress = 0,
  21285. t._connected = !1,
  21286. t.filters = [],
  21287. t
  21288. }
  21289. return h(i, [{
  21290. key: "getOutput",
  21291. value: function() {
  21292. return this.gain
  21293. }
  21294. }, {
  21295. key: "setNodeSource",
  21296. value: function(e) {
  21297. return this.hasPlaybackControl = !1,
  21298. this.sourceType = "audioNode",
  21299. this.source = e,
  21300. this.connect(),
  21301. this
  21302. }
  21303. }, {
  21304. key: "setMediaElementSource",
  21305. value: function(e) {
  21306. return this.hasPlaybackControl = !1,
  21307. this.sourceType = "mediaNode",
  21308. this.source = this.context.createMediaElementSource(e),
  21309. this.connect(),
  21310. this
  21311. }
  21312. }, {
  21313. key: "setMediaStreamSource",
  21314. value: function(e) {
  21315. return this.hasPlaybackControl = !1,
  21316. this.sourceType = "mediaStreamNode",
  21317. this.source = this.context.createMediaStreamSource(e),
  21318. this.connect(),
  21319. this
  21320. }
  21321. }, {
  21322. key: "setBuffer",
  21323. value: function(e) {
  21324. return this.buffer = e,
  21325. this.sourceType = "buffer",
  21326. this.autoplay && this.play(),
  21327. this
  21328. }
  21329. }, {
  21330. key: "play",
  21331. value: function() {
  21332. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;
  21333. if (!0 !== this.isPlaying) {
  21334. if (!1 !== this.hasPlaybackControl) {
  21335. this._startedAt = this.context.currentTime + e;
  21336. e = this.context.createBufferSource();
  21337. return e.buffer = this.buffer,
  21338. e.loop = this.loop,
  21339. e.loopStart = this.loopStart,
  21340. e.loopEnd = this.loopEnd,
  21341. e.onended = this.onEnded.bind(this),
  21342. e.start(this._startedAt, this._progress + this.offset, this.duration),
  21343. this.isPlaying = !0,
  21344. this.source = e,
  21345. this.setDetune(this.detune),
  21346. this.setPlaybackRate(this.playbackRate),
  21347. this.connect()
  21348. }
  21349. console.warn("THREE.Audio: this Audio has no playback control.")
  21350. } else
  21351. console.warn("THREE.Audio: Audio is already playing.")
  21352. }
  21353. }, {
  21354. key: "pause",
  21355. value: function() {
  21356. if (!1 !== this.hasPlaybackControl)
  21357. return !0 === this.isPlaying && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate,
  21358. !0 === this.loop && (this._progress = this._progress % (this.duration || this.buffer.duration)),
  21359. this.source.stop(),
  21360. this.source.onended = null,
  21361. this.isPlaying = !1),
  21362. this;
  21363. console.warn("THREE.Audio: this Audio has no playback control.")
  21364. }
  21365. }, {
  21366. key: "stop",
  21367. value: function() {
  21368. if (!1 !== this.hasPlaybackControl)
  21369. return this._progress = 0,
  21370. this.source.stop(),
  21371. this.source.onended = null,
  21372. this.isPlaying = !1,
  21373. this;
  21374. console.warn("THREE.Audio: this Audio has no playback control.")
  21375. }
  21376. }, {
  21377. key: "connect",
  21378. value: function() {
  21379. if (0 < this.filters.length) {
  21380. this.source.connect(this.filters[0]);
  21381. for (var e = 1, t = this.filters.length; e < t; e++)
  21382. this.filters[e - 1].connect(this.filters[e]);
  21383. this.filters[this.filters.length - 1].connect(this.getOutput())
  21384. } else
  21385. this.source.connect(this.getOutput());
  21386. return this._connected = !0,
  21387. this
  21388. }
  21389. }, {
  21390. key: "disconnect",
  21391. value: function() {
  21392. if (0 < this.filters.length) {
  21393. this.source.disconnect(this.filters[0]);
  21394. for (var e = 1, t = this.filters.length; e < t; e++)
  21395. this.filters[e - 1].disconnect(this.filters[e]);
  21396. this.filters[this.filters.length - 1].disconnect(this.getOutput())
  21397. } else
  21398. this.source.disconnect(this.getOutput());
  21399. return this._connected = !1,
  21400. this
  21401. }
  21402. }, {
  21403. key: "getFilters",
  21404. value: function() {
  21405. return this.filters
  21406. }
  21407. }, {
  21408. key: "setFilters",
  21409. value: function(e) {
  21410. return e = e || [],
  21411. !0 === this._connected ? (this.disconnect(),
  21412. this.filters = e.slice(),
  21413. this.connect()) : this.filters = e.slice(),
  21414. this
  21415. }
  21416. }, {
  21417. key: "setDetune",
  21418. value: function(e) {
  21419. if (this.detune = e,
  21420. void 0 !== this.source.detune)
  21421. return !0 === this.isPlaying && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01),
  21422. this
  21423. }
  21424. }, {
  21425. key: "getDetune",
  21426. value: function() {
  21427. return this.detune
  21428. }
  21429. }, {
  21430. key: "getFilter",
  21431. value: function() {
  21432. return this.getFilters()[0]
  21433. }
  21434. }, {
  21435. key: "setFilter",
  21436. value: function(e) {
  21437. return this.setFilters(e ? [e] : [])
  21438. }
  21439. }, {
  21440. key: "setPlaybackRate",
  21441. value: function(e) {
  21442. if (!1 !== this.hasPlaybackControl)
  21443. return this.playbackRate = e,
  21444. !0 === this.isPlaying && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01),
  21445. this;
  21446. console.warn("THREE.Audio: this Audio has no playback control.")
  21447. }
  21448. }, {
  21449. key: "getPlaybackRate",
  21450. value: function() {
  21451. return this.playbackRate
  21452. }
  21453. }, {
  21454. key: "onEnded",
  21455. value: function() {
  21456. this.isPlaying = !1
  21457. }
  21458. }, {
  21459. key: "getLoop",
  21460. value: function() {
  21461. return !1 === this.hasPlaybackControl ? (console.warn("THREE.Audio: this Audio has no playback control."),
  21462. !1) : this.loop
  21463. }
  21464. }, {
  21465. key: "setLoop",
  21466. value: function(e) {
  21467. if (!1 !== this.hasPlaybackControl)
  21468. return this.loop = e,
  21469. !0 === this.isPlaying && (this.source.loop = this.loop),
  21470. this;
  21471. console.warn("THREE.Audio: this Audio has no playback control.")
  21472. }
  21473. }, {
  21474. key: "setLoopStart",
  21475. value: function(e) {
  21476. return this.loopStart = e,
  21477. this
  21478. }
  21479. }, {
  21480. key: "setLoopEnd",
  21481. value: function(e) {
  21482. return this.loopEnd = e,
  21483. this
  21484. }
  21485. }, {
  21486. key: "getVolume",
  21487. value: function() {
  21488. return this.gain.gain.value
  21489. }
  21490. }, {
  21491. key: "setVolume",
  21492. value: function(e) {
  21493. return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01),
  21494. this
  21495. }
  21496. }]),
  21497. i
  21498. }()
  21499. , Id = new Cn
  21500. , Od = new Sn
  21501. , zd = new Cn
  21502. , Nd = new Cn
  21503. , Ud = function() {
  21504. y(n, Fd);
  21505. var t = w(n);
  21506. function n(e) {
  21507. return O(this, n),
  21508. (e = t.call(this, e)).panner = e.context.createPanner(),
  21509. e.panner.panningModel = "HRTF",
  21510. e.panner.connect(e.gain),
  21511. e
  21512. }
  21513. return h(n, [{
  21514. key: "getOutput",
  21515. value: function() {
  21516. return this.panner
  21517. }
  21518. }, {
  21519. key: "getRefDistance",
  21520. value: function() {
  21521. return this.panner.refDistance
  21522. }
  21523. }, {
  21524. key: "setRefDistance",
  21525. value: function(e) {
  21526. return this.panner.refDistance = e,
  21527. this
  21528. }
  21529. }, {
  21530. key: "getRolloffFactor",
  21531. value: function() {
  21532. return this.panner.rolloffFactor
  21533. }
  21534. }, {
  21535. key: "setRolloffFactor",
  21536. value: function(e) {
  21537. return this.panner.rolloffFactor = e,
  21538. this
  21539. }
  21540. }, {
  21541. key: "getDistanceModel",
  21542. value: function() {
  21543. return this.panner.distanceModel
  21544. }
  21545. }, {
  21546. key: "setDistanceModel",
  21547. value: function(e) {
  21548. return this.panner.distanceModel = e,
  21549. this
  21550. }
  21551. }, {
  21552. key: "getMaxDistance",
  21553. value: function() {
  21554. return this.panner.maxDistance
  21555. }
  21556. }, {
  21557. key: "setMaxDistance",
  21558. value: function(e) {
  21559. return this.panner.maxDistance = e,
  21560. this
  21561. }
  21562. }, {
  21563. key: "setDirectionalCone",
  21564. value: function(e, t, n) {
  21565. return this.panner.coneInnerAngle = e,
  21566. this.panner.coneOuterAngle = t,
  21567. this.panner.coneOuterGain = n,
  21568. this
  21569. }
  21570. }, {
  21571. key: "updateMatrixWorld",
  21572. value: function(e) {
  21573. var t;
  21574. b(v(n.prototype), "updateMatrixWorld", this).call(this, e),
  21575. !0 === this.hasPlaybackControl && !1 === this.isPlaying || (this.matrixWorld.decompose(Id, Od, zd),
  21576. Nd.set(0, 0, 1).applyQuaternion(Od),
  21577. (t = this.panner).positionX ? (e = this.context.currentTime + this.listener.timeDelta,
  21578. t.positionX.linearRampToValueAtTime(Id.x, e),
  21579. t.positionY.linearRampToValueAtTime(Id.y, e),
  21580. t.positionZ.linearRampToValueAtTime(Id.z, e),
  21581. t.orientationX.linearRampToValueAtTime(Nd.x, e),
  21582. t.orientationY.linearRampToValueAtTime(Nd.y, e),
  21583. t.orientationZ.linearRampToValueAtTime(Nd.z, e)) : (t.setPosition(Id.x, Id.y, Id.z),
  21584. t.setOrientation(Nd.x, Nd.y, Nd.z)))
  21585. }
  21586. }]),
  21587. n
  21588. }()
  21589. , Gd = function() {
  21590. function n(e) {
  21591. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2048;
  21592. O(this, n),
  21593. this.analyser = e.context.createAnalyser(),
  21594. this.analyser.fftSize = t,
  21595. this.data = new Uint8Array(this.analyser.frequencyBinCount),
  21596. e.getOutput().connect(this.analyser)
  21597. }
  21598. return h(n, [{
  21599. key: "getFrequencyData",
  21600. value: function() {
  21601. return this.analyser.getByteFrequencyData(this.data),
  21602. this.data
  21603. }
  21604. }, {
  21605. key: "getAverageFrequency",
  21606. value: function() {
  21607. for (var e = 0, t = this.getFrequencyData(), n = 0; n < t.length; n++)
  21608. e += t[n];
  21609. return e / t.length
  21610. }
  21611. }]),
  21612. n
  21613. }();
  21614. function Hd(e, t, n) {
  21615. var i, r, a;
  21616. switch (this.binding = e,
  21617. this.valueSize = n,
  21618. t) {
  21619. case "quaternion":
  21620. i = this._slerp,
  21621. r = this._slerpAdditive,
  21622. a = this._setAdditiveIdentityQuaternion,
  21623. this.buffer = new Float64Array(6 * n),
  21624. this._workIndex = 5;
  21625. break;
  21626. case "string":
  21627. case "bool":
  21628. i = this._select,
  21629. r = this._select,
  21630. a = this._setAdditiveIdentityOther,
  21631. this.buffer = new Array(5 * n);
  21632. break;
  21633. default:
  21634. i = this._lerp,
  21635. r = this._lerpAdditive,
  21636. a = this._setAdditiveIdentityNumeric,
  21637. this.buffer = new Float64Array(5 * n)
  21638. }
  21639. this._mixBufferRegion = i,
  21640. this._mixBufferRegionAdditive = r,
  21641. this._setIdentity = a,
  21642. this._origIndex = 3,
  21643. this._addIndex = 4,
  21644. this.cumulativeWeight = 0,
  21645. this.cumulativeWeightAdditive = 0,
  21646. this.useCount = 0,
  21647. this.referenceCount = 0
  21648. }
  21649. Object.assign(Hd.prototype, {
  21650. accumulate: function(e, t) {
  21651. var n = this.buffer
  21652. , i = this.valueSize
  21653. , r = e * i + i
  21654. , e = this.cumulativeWeight;
  21655. if (0 === e) {
  21656. for (var a = 0; a !== i; ++a)
  21657. n[r + a] = n[a];
  21658. e = t
  21659. } else
  21660. this._mixBufferRegion(n, r, 0, t / (e += t), i);
  21661. this.cumulativeWeight = e
  21662. },
  21663. accumulateAdditive: function(e) {
  21664. var t = this.buffer
  21665. , n = this.valueSize
  21666. , i = n * this._addIndex;
  21667. 0 === this.cumulativeWeightAdditive && this._setIdentity(),
  21668. this._mixBufferRegionAdditive(t, i, 0, e, n),
  21669. this.cumulativeWeightAdditive += e
  21670. },
  21671. apply: function(e) {
  21672. var t = this.valueSize
  21673. , n = this.buffer
  21674. , i = e * t + t
  21675. , r = this.cumulativeWeight
  21676. , a = this.cumulativeWeightAdditive
  21677. , o = this.binding;
  21678. this.cumulativeWeight = 0,
  21679. this.cumulativeWeightAdditive = 0,
  21680. r < 1 && (e = t * this._origIndex,
  21681. this._mixBufferRegion(n, i, e, 1 - r, t)),
  21682. 0 < a && this._mixBufferRegionAdditive(n, i, this._addIndex * t, 1, t);
  21683. for (var s = t, l = t + t; s !== l; ++s)
  21684. if (n[s] !== n[s + t]) {
  21685. o.setValue(n, i);
  21686. break
  21687. }
  21688. },
  21689. saveOriginalState: function() {
  21690. var e = this.binding
  21691. , t = this.buffer
  21692. , n = this.valueSize
  21693. , i = n * this._origIndex;
  21694. e.getValue(t, i);
  21695. for (var r = n, a = i; r !== a; ++r)
  21696. t[r] = t[i + r % n];
  21697. this._setIdentity(),
  21698. this.cumulativeWeight = 0,
  21699. this.cumulativeWeightAdditive = 0
  21700. },
  21701. restoreOriginalState: function() {
  21702. var e = 3 * this.valueSize;
  21703. this.binding.setValue(this.buffer, e)
  21704. },
  21705. _setAdditiveIdentityNumeric: function() {
  21706. for (var e = this._addIndex * this.valueSize, t = e + this.valueSize, n = e; n < t; n++)
  21707. this.buffer[n] = 0
  21708. },
  21709. _setAdditiveIdentityQuaternion: function() {
  21710. this._setAdditiveIdentityNumeric(),
  21711. this.buffer[this._addIndex * this.valueSize + 3] = 1
  21712. },
  21713. _setAdditiveIdentityOther: function() {
  21714. for (var e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize, n = 0; n < this.valueSize; n++)
  21715. this.buffer[t + n] = this.buffer[e + n]
  21716. },
  21717. _select: function(e, t, n, i, r) {
  21718. if (.5 <= i)
  21719. for (var a = 0; a !== r; ++a)
  21720. e[t + a] = e[n + a]
  21721. },
  21722. _slerp: function(e, t, n, i) {
  21723. Sn.slerpFlat(e, t, e, t, e, n, i)
  21724. },
  21725. _slerpAdditive: function(e, t, n, i, r) {
  21726. r = this._workIndex * r;
  21727. Sn.multiplyQuaternionsFlat(e, r, e, t, e, n),
  21728. Sn.slerpFlat(e, t, e, t, e, r, i)
  21729. },
  21730. _lerp: function(e, t, n, i, r) {
  21731. for (var a = 1 - i, o = 0; o !== r; ++o) {
  21732. var s = t + o;
  21733. e[s] = e[s] * a + e[n + o] * i
  21734. }
  21735. },
  21736. _lerpAdditive: function(e, t, n, i, r) {
  21737. for (var a = 0; a !== r; ++a) {
  21738. var o = t + a;
  21739. e[o] = e[o] + e[n + a] * i
  21740. }
  21741. }
  21742. });
  21743. var Vd = "\\[\\]\\.:\\/"
  21744. , jd = new RegExp("[" + Vd + "]","g")
  21745. , Wd = "[^" + Vd + "]"
  21746. , Xd = "[^" + Vd.replace("\\.", "") + "]"
  21747. , qd = /((?:WC+[\/:])*)/.source.replace("WC", Wd)
  21748. , Jd = /(WCOD+)?/.source.replace("WCOD", Xd)
  21749. , Yd = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Wd)
  21750. , Zd = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Wd)
  21751. , Qd = new RegExp("^" + qd + Jd + Yd + Zd + "$")
  21752. , Kd = ["material", "materials", "bones"];
  21753. function $d(e, t, n) {
  21754. n = n || eh.parseTrackName(t);
  21755. this._targetGroup = e,
  21756. this._bindings = e.subscribe_(t, n)
  21757. }
  21758. function eh(e, t, n) {
  21759. this.path = t,
  21760. this.parsedPath = n || eh.parseTrackName(t),
  21761. this.node = eh.findNode(e, this.parsedPath.nodeName) || e,
  21762. this.rootNode = e
  21763. }
  21764. function th() {
  21765. this.uuid = gn.generateUUID(),
  21766. this._objects = Array.prototype.slice.call(arguments),
  21767. this.nCachedObjects_ = 0;
  21768. var e = {};
  21769. this._indicesByUUID = e;
  21770. for (var t = 0, n = arguments.length; t !== n; ++t)
  21771. e[arguments[t].uuid] = t;
  21772. this._paths = [],
  21773. this._parsedPaths = [],
  21774. this._bindings = [],
  21775. this._bindingsIndicesByPath = {};
  21776. var i = this;
  21777. this.stats = {
  21778. objects: {
  21779. get total() {
  21780. return i._objects.length
  21781. },
  21782. get inUse() {
  21783. return this.total - i.nCachedObjects_
  21784. }
  21785. },
  21786. get bindingsPerObject() {
  21787. return i._bindings.length
  21788. }
  21789. }
  21790. }
  21791. Object.assign($d.prototype, {
  21792. getValue: function(e, t) {
  21793. this.bind();
  21794. var n = this._targetGroup.nCachedObjects_
  21795. , n = this._bindings[n];
  21796. void 0 !== n && n.getValue(e, t)
  21797. },
  21798. setValue: function(e, t) {
  21799. for (var n = this._bindings, i = this._targetGroup.nCachedObjects_, r = n.length; i !== r; ++i)
  21800. n[i].setValue(e, t)
  21801. },
  21802. bind: function() {
  21803. for (var e = this._bindings, t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)
  21804. e[t].bind()
  21805. },
  21806. unbind: function() {
  21807. for (var e = this._bindings, t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)
  21808. e[t].unbind()
  21809. }
  21810. }),
  21811. Object.assign(eh, {
  21812. Composite: $d,
  21813. create: function(e, t, n) {
  21814. return new (e && e.isAnimationObjectGroup ? eh.Composite : eh)(e,t,n)
  21815. },
  21816. sanitizeNodeName: function(e) {
  21817. return e.replace(/\s/g, "_").replace(jd, "")
  21818. },
  21819. parseTrackName: function(e) {
  21820. var t = Qd.exec(e);
  21821. if (!t)
  21822. throw new Error("PropertyBinding: Cannot parse trackName: " + e);
  21823. var n = {
  21824. nodeName: t[2],
  21825. objectName: t[3],
  21826. objectIndex: t[4],
  21827. propertyName: t[5],
  21828. propertyIndex: t[6]
  21829. }
  21830. , i = n.nodeName && n.nodeName.lastIndexOf(".");
  21831. if (void 0 !== i && -1 !== i && (t = n.nodeName.substring(i + 1),
  21832. -1 !== Kd.indexOf(t) && (n.nodeName = n.nodeName.substring(0, i),
  21833. n.objectName = t)),
  21834. null === n.propertyName || 0 === n.propertyName.length)
  21835. throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e);
  21836. return n
  21837. },
  21838. findNode: function(e, r) {
  21839. if (!r || "" === r || "." === r || -1 === r || r === e.name || r === e.uuid)
  21840. return e;
  21841. if (e.skeleton) {
  21842. var t = e.skeleton.getBoneByName(r);
  21843. if (void 0 !== t)
  21844. return t
  21845. }
  21846. if (e.children) {
  21847. e = function e(t) {
  21848. for (var n = 0; n < t.length; n++) {
  21849. var i = t[n];
  21850. if (i.name === r || i.uuid === r)
  21851. return i;
  21852. i = e(i.children);
  21853. if (i)
  21854. return i
  21855. }
  21856. return null
  21857. }(e.children);
  21858. if (e)
  21859. return e
  21860. }
  21861. return null
  21862. }
  21863. }),
  21864. Object.assign(eh.prototype, {
  21865. _getValue_unavailable: function() {},
  21866. _setValue_unavailable: function() {},
  21867. BindingType: {
  21868. Direct: 0,
  21869. EntireArray: 1,
  21870. ArrayElement: 2,
  21871. HasFromToArray: 3
  21872. },
  21873. Versioning: {
  21874. None: 0,
  21875. NeedsUpdate: 1,
  21876. MatrixWorldNeedsUpdate: 2
  21877. },
  21878. GetterByBindingType: [function(e, t) {
  21879. e[t] = this.node[this.propertyName]
  21880. }
  21881. , function(e, t) {
  21882. for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i)
  21883. e[t++] = n[i]
  21884. }
  21885. , function(e, t) {
  21886. e[t] = this.resolvedProperty[this.propertyIndex]
  21887. }
  21888. , function(e, t) {
  21889. this.resolvedProperty.toArray(e, t)
  21890. }
  21891. ],
  21892. SetterByBindingTypeAndVersioning: [[function(e, t) {
  21893. this.targetObject[this.propertyName] = e[t]
  21894. }
  21895. , function(e, t) {
  21896. this.targetObject[this.propertyName] = e[t],
  21897. this.targetObject.needsUpdate = !0
  21898. }
  21899. , function(e, t) {
  21900. this.targetObject[this.propertyName] = e[t],
  21901. this.targetObject.matrixWorldNeedsUpdate = !0
  21902. }
  21903. ], [function(e, t) {
  21904. for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i)
  21905. n[i] = e[t++]
  21906. }
  21907. , function(e, t) {
  21908. for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i)
  21909. n[i] = e[t++];
  21910. this.targetObject.needsUpdate = !0
  21911. }
  21912. , function(e, t) {
  21913. for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i)
  21914. n[i] = e[t++];
  21915. this.targetObject.matrixWorldNeedsUpdate = !0
  21916. }
  21917. ], [function(e, t) {
  21918. this.resolvedProperty[this.propertyIndex] = e[t]
  21919. }
  21920. , function(e, t) {
  21921. this.resolvedProperty[this.propertyIndex] = e[t],
  21922. this.targetObject.needsUpdate = !0
  21923. }
  21924. , function(e, t) {
  21925. this.resolvedProperty[this.propertyIndex] = e[t],
  21926. this.targetObject.matrixWorldNeedsUpdate = !0
  21927. }
  21928. ], [function(e, t) {
  21929. this.resolvedProperty.fromArray(e, t)
  21930. }
  21931. , function(e, t) {
  21932. this.resolvedProperty.fromArray(e, t),
  21933. this.targetObject.needsUpdate = !0
  21934. }
  21935. , function(e, t) {
  21936. this.resolvedProperty.fromArray(e, t),
  21937. this.targetObject.matrixWorldNeedsUpdate = !0
  21938. }
  21939. ]],
  21940. getValue: function(e, t) {
  21941. this.bind(),
  21942. this.getValue(e, t)
  21943. },
  21944. setValue: function(e, t) {
  21945. this.bind(),
  21946. this.setValue(e, t)
  21947. },
  21948. bind: function() {
  21949. var e = this.node
  21950. , t = this.parsedPath
  21951. , n = t.objectName
  21952. , i = t.propertyName
  21953. , r = t.propertyIndex;
  21954. if (e || (e = eh.findNode(this.rootNode, t.nodeName) || this.rootNode,
  21955. this.node = e),
  21956. this.getValue = this._getValue_unavailable,
  21957. this.setValue = this._setValue_unavailable,
  21958. e) {
  21959. if (n) {
  21960. var a = t.objectIndex;
  21961. switch (n) {
  21962. case "materials":
  21963. if (!e.material)
  21964. return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
  21965. if (!e.material.materials)
  21966. return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
  21967. e = e.material.materials;
  21968. break;
  21969. case "bones":
  21970. if (!e.skeleton)
  21971. return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
  21972. for (var e = e.skeleton.bones, o = 0; o < e.length; o++)
  21973. if (e[o].name === a) {
  21974. a = o;
  21975. break
  21976. }
  21977. break;
  21978. default:
  21979. if (void 0 === e[n])
  21980. return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this);
  21981. e = e[n]
  21982. }
  21983. if (void 0 !== a) {
  21984. if (void 0 === e[a])
  21985. return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e);
  21986. e = e[a]
  21987. }
  21988. }
  21989. var s = e[i];
  21990. if (void 0 !== s) {
  21991. var l = this.Versioning.None;
  21992. void 0 !== (this.targetObject = e).needsUpdate ? l = this.Versioning.NeedsUpdate : void 0 !== e.matrixWorldNeedsUpdate && (l = this.Versioning.MatrixWorldNeedsUpdate);
  21993. var u = this.BindingType.Direct;
  21994. if (void 0 !== r) {
  21995. if ("morphTargetInfluences" === i) {
  21996. if (!e.geometry)
  21997. return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
  21998. if (!e.geometry.isBufferGeometry)
  21999. return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.", this);
  22000. if (!e.geometry.morphAttributes)
  22001. return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
  22002. void 0 !== e.morphTargetDictionary[r] && (r = e.morphTargetDictionary[r])
  22003. }
  22004. u = this.BindingType.ArrayElement,
  22005. this.resolvedProperty = s,
  22006. this.propertyIndex = r
  22007. } else
  22008. void 0 !== s.fromArray && void 0 !== s.toArray ? (u = this.BindingType.HasFromToArray,
  22009. this.resolvedProperty = s) : Array.isArray(s) ? (u = this.BindingType.EntireArray,
  22010. this.resolvedProperty = s) : this.propertyName = i;
  22011. this.getValue = this.GetterByBindingType[u],
  22012. this.setValue = this.SetterByBindingTypeAndVersioning[u][l]
  22013. } else {
  22014. t = t.nodeName;
  22015. console.error("THREE.PropertyBinding: Trying to update property for track: " + t + "." + i + " but it wasn't found.", e)
  22016. }
  22017. } else
  22018. console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found.")
  22019. },
  22020. unbind: function() {
  22021. this.node = null,
  22022. this.getValue = this._getValue_unbound,
  22023. this.setValue = this._setValue_unbound
  22024. }
  22025. }),
  22026. Object.assign(eh.prototype, {
  22027. _getValue_unbound: eh.prototype.getValue,
  22028. _setValue_unbound: eh.prototype.setValue
  22029. }),
  22030. Object.assign(th.prototype, {
  22031. isAnimationObjectGroup: !0,
  22032. add: function() {
  22033. for (var e = this._objects, t = this._indicesByUUID, n = this._paths, i = this._parsedPaths, r = this._bindings, a = r.length, o = void 0, s = e.length, l = this.nCachedObjects_, u = 0, c = arguments.length; u !== c; ++u) {
  22034. var d = arguments[u]
  22035. , h = d.uuid
  22036. , p = t[h];
  22037. if (void 0 === p) {
  22038. p = s++,
  22039. t[h] = p,
  22040. e.push(d);
  22041. for (var f = 0, m = a; f !== m; ++f)
  22042. r[f].push(new eh(d,n[f],i[f]))
  22043. } else if (p < l) {
  22044. var o = e[p]
  22045. , v = --l
  22046. , g = e[v];
  22047. e[t[g.uuid] = p] = g,
  22048. e[t[h] = v] = d;
  22049. for (var y = 0, w = a; y !== w; ++y) {
  22050. var b = r[y]
  22051. , x = b[v]
  22052. , E = b[p];
  22053. b[p] = x,
  22054. void 0 === E && (E = new eh(d,n[y],i[y])),
  22055. b[v] = E
  22056. }
  22057. } else
  22058. e[p] !== o && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")
  22059. }
  22060. this.nCachedObjects_ = l
  22061. },
  22062. remove: function() {
  22063. for (var e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_, a = 0, o = arguments.length; a !== o; ++a) {
  22064. var s = arguments[a]
  22065. , l = s.uuid
  22066. , u = t[l];
  22067. if (void 0 !== u && r <= u) {
  22068. var c = r++
  22069. , d = e[c];
  22070. e[t[d.uuid] = u] = d,
  22071. e[t[l] = c] = s;
  22072. for (var h = 0, p = i; h !== p; ++h) {
  22073. var f = n[h]
  22074. , m = f[c]
  22075. , v = f[u];
  22076. f[u] = m,
  22077. f[c] = v
  22078. }
  22079. }
  22080. }
  22081. this.nCachedObjects_ = r
  22082. },
  22083. uncache: function() {
  22084. for (var e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_, a = e.length, o = 0, s = arguments.length; o !== s; ++o) {
  22085. var l = arguments[o].uuid
  22086. , u = t[l];
  22087. if (void 0 !== u)
  22088. if (delete t[l],
  22089. u < r) {
  22090. var c = --r
  22091. , l = e[c]
  22092. , d = --a
  22093. , h = e[d];
  22094. e[t[l.uuid] = u] = l,
  22095. e[t[h.uuid] = c] = h,
  22096. e.pop();
  22097. for (var p = 0, f = i; p !== f; ++p) {
  22098. var m = n[p]
  22099. , v = m[c]
  22100. , g = m[d];
  22101. m[u] = v,
  22102. m[c] = g,
  22103. m.pop()
  22104. }
  22105. } else {
  22106. var y = --a
  22107. , h = e[y];
  22108. 0 < y && (t[h.uuid] = u),
  22109. e[u] = h,
  22110. e.pop();
  22111. for (var w = 0, b = i; w !== b; ++w) {
  22112. var x = n[w];
  22113. x[u] = x[y],
  22114. x.pop()
  22115. }
  22116. }
  22117. }
  22118. this.nCachedObjects_ = r
  22119. },
  22120. subscribe_: function(e, t) {
  22121. var n = this._bindingsIndicesByPath
  22122. , i = n[e]
  22123. , r = this._bindings;
  22124. if (void 0 !== i)
  22125. return r[i];
  22126. var a = this._paths
  22127. , o = this._parsedPaths
  22128. , s = this._objects
  22129. , l = s.length
  22130. , u = this.nCachedObjects_
  22131. , c = new Array(l)
  22132. , i = r.length;
  22133. n[e] = i,
  22134. a.push(e),
  22135. o.push(t),
  22136. r.push(c);
  22137. for (var d = u, h = s.length; d !== h; ++d) {
  22138. var p = s[d];
  22139. c[d] = new eh(p,e,t)
  22140. }
  22141. return c
  22142. },
  22143. unsubscribe_: function(e) {
  22144. var t, n, i, r, a, o = this._bindingsIndicesByPath, s = o[e];
  22145. void 0 !== s && (t = this._paths,
  22146. n = this._parsedPaths,
  22147. a = (i = this._bindings)[r = i.length - 1],
  22148. i[o[e[r]] = s] = a,
  22149. i.pop(),
  22150. n[s] = n[r],
  22151. n.pop(),
  22152. t[s] = t[r],
  22153. t.pop())
  22154. }
  22155. });
  22156. var nh = function() {
  22157. function c(e, t) {
  22158. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null
  22159. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : t.blendMode;
  22160. O(this, c),
  22161. this._mixer = e,
  22162. this._clip = t,
  22163. this._localRoot = n,
  22164. this.blendMode = i;
  22165. for (var r = t.tracks, a = r.length, o = new Array(a), s = {
  22166. endingStart: en,
  22167. endingEnd: en
  22168. }, l = 0; l !== a; ++l) {
  22169. var u = r[l].createInterpolant(null);
  22170. (o[l] = u).settings = s
  22171. }
  22172. this._interpolantSettings = s,
  22173. this._interpolants = o,
  22174. this._propertyBindings = new Array(a),
  22175. this._cacheIndex = null,
  22176. this._byClipCacheIndex = null,
  22177. this._timeScaleInterpolant = null,
  22178. this._weightInterpolant = null,
  22179. this.loop = 2201,
  22180. this._loopCount = -1,
  22181. this._startTime = null,
  22182. this.time = 0,
  22183. this.timeScale = 1,
  22184. this._effectiveTimeScale = 1,
  22185. this.weight = 1,
  22186. this._effectiveWeight = 1,
  22187. this.repetitions = 1 / 0,
  22188. this.paused = !1,
  22189. this.enabled = !0,
  22190. this.clampWhenFinished = !1,
  22191. this.zeroSlopeAtStart = !0,
  22192. this.zeroSlopeAtEnd = !0
  22193. }
  22194. return h(c, [{
  22195. key: "play",
  22196. value: function() {
  22197. return this._mixer._activateAction(this),
  22198. this
  22199. }
  22200. }, {
  22201. key: "stop",
  22202. value: function() {
  22203. return this._mixer._deactivateAction(this),
  22204. this.reset()
  22205. }
  22206. }, {
  22207. key: "reset",
  22208. value: function() {
  22209. return this.paused = !1,
  22210. this.enabled = !0,
  22211. this.time = 0,
  22212. this._loopCount = -1,
  22213. this._startTime = null,
  22214. this.stopFading().stopWarping()
  22215. }
  22216. }, {
  22217. key: "isRunning",
  22218. value: function() {
  22219. return this.enabled && !this.paused && 0 !== this.timeScale && null === this._startTime && this._mixer._isActiveAction(this)
  22220. }
  22221. }, {
  22222. key: "isScheduled",
  22223. value: function() {
  22224. return this._mixer._isActiveAction(this)
  22225. }
  22226. }, {
  22227. key: "startAt",
  22228. value: function(e) {
  22229. return this._startTime = e,
  22230. this
  22231. }
  22232. }, {
  22233. key: "setLoop",
  22234. value: function(e, t) {
  22235. return this.loop = e,
  22236. this.repetitions = t,
  22237. this
  22238. }
  22239. }, {
  22240. key: "setEffectiveWeight",
  22241. value: function(e) {
  22242. return this.weight = e,
  22243. this._effectiveWeight = this.enabled ? e : 0,
  22244. this.stopFading()
  22245. }
  22246. }, {
  22247. key: "getEffectiveWeight",
  22248. value: function() {
  22249. return this._effectiveWeight
  22250. }
  22251. }, {
  22252. key: "fadeIn",
  22253. value: function(e) {
  22254. return this._scheduleFading(e, 0, 1)
  22255. }
  22256. }, {
  22257. key: "fadeOut",
  22258. value: function(e) {
  22259. return this._scheduleFading(e, 1, 0)
  22260. }
  22261. }, {
  22262. key: "crossFadeFrom",
  22263. value: function(e, t, n) {
  22264. var i, r;
  22265. return e.fadeOut(t),
  22266. this.fadeIn(t),
  22267. n && (n = (i = this._clip.duration) / (r = e._clip.duration),
  22268. e.warp(1, r / i, t),
  22269. this.warp(n, 1, t)),
  22270. this
  22271. }
  22272. }, {
  22273. key: "crossFadeTo",
  22274. value: function(e, t, n) {
  22275. return e.crossFadeFrom(this, t, n)
  22276. }
  22277. }, {
  22278. key: "stopFading",
  22279. value: function() {
  22280. var e = this._weightInterpolant;
  22281. return null !== e && (this._weightInterpolant = null,
  22282. this._mixer._takeBackControlInterpolant(e)),
  22283. this
  22284. }
  22285. }, {
  22286. key: "setEffectiveTimeScale",
  22287. value: function(e) {
  22288. return this.timeScale = e,
  22289. this._effectiveTimeScale = this.paused ? 0 : e,
  22290. this.stopWarping()
  22291. }
  22292. }, {
  22293. key: "getEffectiveTimeScale",
  22294. value: function() {
  22295. return this._effectiveTimeScale
  22296. }
  22297. }, {
  22298. key: "setDuration",
  22299. value: function(e) {
  22300. return this.timeScale = this._clip.duration / e,
  22301. this.stopWarping()
  22302. }
  22303. }, {
  22304. key: "syncWith",
  22305. value: function(e) {
  22306. return this.time = e.time,
  22307. this.timeScale = e.timeScale,
  22308. this.stopWarping()
  22309. }
  22310. }, {
  22311. key: "halt",
  22312. value: function(e) {
  22313. return this.warp(this._effectiveTimeScale, 0, e)
  22314. }
  22315. }, {
  22316. key: "warp",
  22317. value: function(e, t, n) {
  22318. var i = this._mixer
  22319. , r = i.time
  22320. , a = this.timeScale
  22321. , o = this._timeScaleInterpolant;
  22322. null === o && (o = i._lendControlInterpolant(),
  22323. this._timeScaleInterpolant = o);
  22324. i = o.parameterPositions,
  22325. o = o.sampleValues;
  22326. return i[0] = r,
  22327. i[1] = r + n,
  22328. o[0] = e / a,
  22329. o[1] = t / a,
  22330. this
  22331. }
  22332. }, {
  22333. key: "stopWarping",
  22334. value: function() {
  22335. var e = this._timeScaleInterpolant;
  22336. return null !== e && (this._timeScaleInterpolant = null,
  22337. this._mixer._takeBackControlInterpolant(e)),
  22338. this
  22339. }
  22340. }, {
  22341. key: "getMixer",
  22342. value: function() {
  22343. return this._mixer
  22344. }
  22345. }, {
  22346. key: "getClip",
  22347. value: function() {
  22348. return this._clip
  22349. }
  22350. }, {
  22351. key: "getRoot",
  22352. value: function() {
  22353. return this._localRoot || this._mixer._root
  22354. }
  22355. }, {
  22356. key: "_update",
  22357. value: function(e, t, n, i) {
  22358. if (this.enabled) {
  22359. var r = this._startTime;
  22360. if (null !== r) {
  22361. r = (e - r) * n;
  22362. if (r < 0 || 0 === n)
  22363. return;
  22364. this._startTime = null,
  22365. t = n * r
  22366. }
  22367. t *= this._updateTimeScale(e);
  22368. var a = this._updateTime(t)
  22369. , o = this._updateWeight(e);
  22370. if (0 < o) {
  22371. var s = this._interpolants
  22372. , l = this._propertyBindings;
  22373. if (2501 === this.blendMode)
  22374. for (var u = 0, c = s.length; u !== c; ++u)
  22375. s[u].evaluate(a),
  22376. l[u].accumulateAdditive(o);
  22377. else
  22378. for (var d = 0, h = s.length; d !== h; ++d)
  22379. s[d].evaluate(a),
  22380. l[d].accumulate(i, o)
  22381. }
  22382. } else
  22383. this._updateWeight(e)
  22384. }
  22385. }, {
  22386. key: "_updateWeight",
  22387. value: function(e) {
  22388. var t, n, i = 0;
  22389. return this.enabled && (i = this.weight,
  22390. null !== (t = this._weightInterpolant) && (i *= n = t.evaluate(e)[0],
  22391. e > t.parameterPositions[1] && (this.stopFading(),
  22392. 0 === n && (this.enabled = !1)))),
  22393. this._effectiveWeight = i
  22394. }
  22395. }, {
  22396. key: "_updateTimeScale",
  22397. value: function(e) {
  22398. var t, n = 0;
  22399. return this.paused || (n = this.timeScale,
  22400. null !== (t = this._timeScaleInterpolant) && (n *= t.evaluate(e)[0],
  22401. e > t.parameterPositions[1] && (this.stopWarping(),
  22402. 0 === n ? this.paused = !0 : this.timeScale = n))),
  22403. this._effectiveTimeScale = n
  22404. }
  22405. }, {
  22406. key: "_updateTime",
  22407. value: function(e) {
  22408. var t, n = this._clip.duration, i = this.loop, r = this.time + e, a = this._loopCount, o = 2202 === i;
  22409. if (0 === e)
  22410. return -1 !== a && o && 1 == (1 & a) ? n - r : r;
  22411. if (2200 === i) {
  22412. -1 === a && (this._loopCount = 0,
  22413. this._setEndings(!0, !0, !1));
  22414. e: {
  22415. if (n <= r)
  22416. r = n;
  22417. else {
  22418. if (!(r < 0)) {
  22419. this.time = r;
  22420. break e
  22421. }
  22422. r = 0
  22423. }
  22424. this.clampWhenFinished ? this.paused = !0 : this.enabled = !1,
  22425. this.time = r,
  22426. this._mixer.dispatchEvent({
  22427. type: "finished",
  22428. action: this,
  22429. direction: e < 0 ? -1 : 1
  22430. })
  22431. }
  22432. } else if (-1 === a && (0 <= e ? this._setEndings(!(a = 0), 0 === this.repetitions, o) : this._setEndings(0 === this.repetitions, !0, o)),
  22433. n <= r || r < 0 ? (r -= n * (t = Math.floor(r / n)),
  22434. a += Math.abs(t),
  22435. (i = this.repetitions - a) <= 0 ? (this.clampWhenFinished ? this.paused = !0 : this.enabled = !1,
  22436. this.time = r = 0 < e ? n : 0,
  22437. this._mixer.dispatchEvent({
  22438. type: "finished",
  22439. action: this,
  22440. direction: 0 < e ? 1 : -1
  22441. })) : (1 == i ? this._setEndings(i = e < 0, !i, o) : this._setEndings(!1, !1, o),
  22442. this._loopCount = a,
  22443. this.time = r,
  22444. this._mixer.dispatchEvent({
  22445. type: "loop",
  22446. action: this,
  22447. loopDelta: t
  22448. }))) : this.time = r,
  22449. o && 1 == (1 & a))
  22450. return n - r;
  22451. return r
  22452. }
  22453. }, {
  22454. key: "_setEndings",
  22455. value: function(e, t, n) {
  22456. var i = this._interpolantSettings;
  22457. n ? (i.endingStart = tn,
  22458. i.endingEnd = tn) : (i.endingStart = e ? this.zeroSlopeAtStart ? tn : en : nn,
  22459. i.endingEnd = t ? this.zeroSlopeAtEnd ? tn : en : nn)
  22460. }
  22461. }, {
  22462. key: "_scheduleFading",
  22463. value: function(e, t, n) {
  22464. var i = this._mixer
  22465. , r = i.time
  22466. , a = this._weightInterpolant;
  22467. null === a && (a = i._lendControlInterpolant(),
  22468. this._weightInterpolant = a);
  22469. i = a.parameterPositions,
  22470. a = a.sampleValues;
  22471. return i[0] = r,
  22472. a[0] = t,
  22473. i[1] = r + e,
  22474. a[1] = n,
  22475. this
  22476. }
  22477. }]),
  22478. c
  22479. }();
  22480. function ih(e) {
  22481. this._root = e,
  22482. this._initMemoryManager(),
  22483. this._accuIndex = 0,
  22484. this.time = 0,
  22485. this.timeScale = 1
  22486. }
  22487. ih.prototype = Object.assign(Object.create(hn.prototype), {
  22488. constructor: ih,
  22489. _bindAction: function(e, t) {
  22490. var n = e._localRoot || this._root
  22491. , i = e._clip.tracks
  22492. , r = i.length
  22493. , a = e._propertyBindings
  22494. , o = e._interpolants
  22495. , s = n.uuid
  22496. , e = this._bindingsByRootAndName
  22497. , l = e[s];
  22498. void 0 === l && (e[s] = l = {});
  22499. for (var u = 0; u !== r; ++u) {
  22500. var c = i[u]
  22501. , d = c.name;
  22502. if (void 0 !== (h = l[d]))
  22503. a[u] = h;
  22504. else {
  22505. if (void 0 !== (h = a[u])) {
  22506. null === h._cacheIndex && (++h.referenceCount,
  22507. this._addInactiveBinding(h, s, d));
  22508. continue
  22509. }
  22510. var h, p = t && t._propertyBindings[u].binding.parsedPath;
  22511. ++(h = new Hd(eh.create(n, d, p),c.ValueTypeName,c.getValueSize())).referenceCount,
  22512. this._addInactiveBinding(h, s, d),
  22513. a[u] = h
  22514. }
  22515. o[u].resultBuffer = h.buffer
  22516. }
  22517. },
  22518. _activateAction: function(e) {
  22519. if (!this._isActiveAction(e)) {
  22520. var t, n, i;
  22521. null === e._cacheIndex && (t = (e._localRoot || this._root).uuid,
  22522. n = e._clip.uuid,
  22523. i = this._actionsByClip[n],
  22524. this._bindAction(e, i && i.knownActions[0]),
  22525. this._addInactiveAction(e, n, t));
  22526. for (var r = e._propertyBindings, a = 0, o = r.length; a !== o; ++a) {
  22527. var s = r[a];
  22528. 0 == s.useCount++ && (this._lendBinding(s),
  22529. s.saveOriginalState())
  22530. }
  22531. this._lendAction(e)
  22532. }
  22533. },
  22534. _deactivateAction: function(e) {
  22535. if (this._isActiveAction(e)) {
  22536. for (var t = e._propertyBindings, n = 0, i = t.length; n !== i; ++n) {
  22537. var r = t[n];
  22538. 0 == --r.useCount && (r.restoreOriginalState(),
  22539. this._takeBackBinding(r))
  22540. }
  22541. this._takeBackAction(e)
  22542. }
  22543. },
  22544. _initMemoryManager: function() {
  22545. this._actions = [],
  22546. this._nActiveActions = 0,
  22547. this._actionsByClip = {},
  22548. this._bindings = [],
  22549. this._nActiveBindings = 0,
  22550. this._bindingsByRootAndName = {},
  22551. this._controlInterpolants = [],
  22552. this._nActiveControlInterpolants = 0;
  22553. var e = this;
  22554. this.stats = {
  22555. actions: {
  22556. get total() {
  22557. return e._actions.length
  22558. },
  22559. get inUse() {
  22560. return e._nActiveActions
  22561. }
  22562. },
  22563. bindings: {
  22564. get total() {
  22565. return e._bindings.length
  22566. },
  22567. get inUse() {
  22568. return e._nActiveBindings
  22569. }
  22570. },
  22571. controlInterpolants: {
  22572. get total() {
  22573. return e._controlInterpolants.length
  22574. },
  22575. get inUse() {
  22576. return e._nActiveControlInterpolants
  22577. }
  22578. }
  22579. }
  22580. },
  22581. _isActiveAction: function(e) {
  22582. e = e._cacheIndex;
  22583. return null !== e && e < this._nActiveActions
  22584. },
  22585. _addInactiveAction: function(e, t, n) {
  22586. var i = this._actions
  22587. , r = this._actionsByClip
  22588. , a = r[t];
  22589. void 0 === a ? (a = {
  22590. knownActions: [e],
  22591. actionByRoot: {}
  22592. },
  22593. e._byClipCacheIndex = 0,
  22594. r[t] = a) : (t = a.knownActions,
  22595. e._byClipCacheIndex = t.length,
  22596. t.push(e)),
  22597. e._cacheIndex = i.length,
  22598. i.push(e),
  22599. a.actionByRoot[n] = e
  22600. },
  22601. _removeInactiveAction: function(e) {
  22602. var t = this._actions
  22603. , n = t[t.length - 1]
  22604. , i = e._cacheIndex;
  22605. t[n._cacheIndex = i] = n,
  22606. t.pop(),
  22607. e._cacheIndex = null;
  22608. var r = e._clip.uuid
  22609. , a = this._actionsByClip
  22610. , o = a[r]
  22611. , i = o.knownActions
  22612. , n = i[i.length - 1]
  22613. , t = e._byClipCacheIndex;
  22614. i[n._byClipCacheIndex = t] = n,
  22615. i.pop(),
  22616. e._byClipCacheIndex = null,
  22617. delete o.actionByRoot[(e._localRoot || this._root).uuid],
  22618. 0 === i.length && delete a[r],
  22619. this._removeInactiveBindingsForAction(e)
  22620. },
  22621. _removeInactiveBindingsForAction: function(e) {
  22622. for (var t = e._propertyBindings, n = 0, i = t.length; n !== i; ++n) {
  22623. var r = t[n];
  22624. 0 == --r.referenceCount && this._removeInactiveBinding(r)
  22625. }
  22626. },
  22627. _lendAction: function(e) {
  22628. var t = this._actions
  22629. , n = e._cacheIndex
  22630. , i = this._nActiveActions++
  22631. , r = t[i];
  22632. t[e._cacheIndex = i] = e,
  22633. t[r._cacheIndex = n] = r
  22634. },
  22635. _takeBackAction: function(e) {
  22636. var t = this._actions
  22637. , n = e._cacheIndex
  22638. , i = --this._nActiveActions
  22639. , r = t[i];
  22640. t[e._cacheIndex = i] = e,
  22641. t[r._cacheIndex = n] = r
  22642. },
  22643. _addInactiveBinding: function(e, t, n) {
  22644. var i = this._bindingsByRootAndName
  22645. , r = this._bindings
  22646. , a = i[t];
  22647. void 0 === a && (i[t] = a = {}),
  22648. (a[n] = e)._cacheIndex = r.length,
  22649. r.push(e)
  22650. },
  22651. _removeInactiveBinding: function(e) {
  22652. var t = this._bindings
  22653. , n = e.binding
  22654. , i = n.rootNode.uuid
  22655. , r = n.path
  22656. , a = this._bindingsByRootAndName
  22657. , o = a[i]
  22658. , n = t[t.length - 1]
  22659. , e = e._cacheIndex;
  22660. t[n._cacheIndex = e] = n,
  22661. t.pop(),
  22662. delete o[r],
  22663. 0 === Object.keys(o).length && delete a[i]
  22664. },
  22665. _lendBinding: function(e) {
  22666. var t = this._bindings
  22667. , n = e._cacheIndex
  22668. , i = this._nActiveBindings++
  22669. , r = t[i];
  22670. t[e._cacheIndex = i] = e,
  22671. t[r._cacheIndex = n] = r
  22672. },
  22673. _takeBackBinding: function(e) {
  22674. var t = this._bindings
  22675. , n = e._cacheIndex
  22676. , i = --this._nActiveBindings
  22677. , r = t[i];
  22678. t[e._cacheIndex = i] = e,
  22679. t[r._cacheIndex = n] = r
  22680. },
  22681. _lendControlInterpolant: function() {
  22682. var e = this._controlInterpolants
  22683. , t = this._nActiveControlInterpolants++
  22684. , n = e[t];
  22685. return void 0 === n && (e[(n = new ec(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex = t] = n),
  22686. n
  22687. },
  22688. _takeBackControlInterpolant: function(e) {
  22689. var t = this._controlInterpolants
  22690. , n = e.__cacheIndex
  22691. , i = --this._nActiveControlInterpolants
  22692. , r = t[i];
  22693. t[e.__cacheIndex = i] = e,
  22694. t[r.__cacheIndex = n] = r
  22695. },
  22696. _controlInterpolantsResultBuffer: new Float32Array(1),
  22697. clipAction: function(e, t, n) {
  22698. var i = t || this._root
  22699. , r = i.uuid
  22700. , a = "string" == typeof e ? cc.findByName(i, e) : e
  22701. , o = null !== a ? a.uuid : e
  22702. , s = this._actionsByClip[o]
  22703. , i = null;
  22704. if (void 0 === n && (n = null !== a ? a.blendMode : 2500),
  22705. void 0 !== s) {
  22706. e = s.actionByRoot[r];
  22707. if (void 0 !== e && e.blendMode === n)
  22708. return e;
  22709. i = s.knownActions[0],
  22710. null === a && (a = i._clip)
  22711. }
  22712. if (null === a)
  22713. return null;
  22714. n = new nh(this,a,t,n);
  22715. return this._bindAction(n, i),
  22716. this._addInactiveAction(n, o, r),
  22717. n
  22718. },
  22719. existingAction: function(e, t) {
  22720. var n = t || this._root
  22721. , t = n.uuid
  22722. , n = "string" == typeof e ? cc.findByName(n, e) : e
  22723. , e = n ? n.uuid : e
  22724. , e = this._actionsByClip[e];
  22725. return void 0 !== e && e.actionByRoot[t] || null
  22726. },
  22727. stopAllAction: function() {
  22728. for (var e = this._actions, t = this._nActiveActions - 1; 0 <= t; --t)
  22729. e[t].stop();
  22730. return this
  22731. },
  22732. update: function(e) {
  22733. e *= this.timeScale;
  22734. for (var t = this._actions, n = this._nActiveActions, i = this.time += e, r = Math.sign(e), a = this._accuIndex ^= 1, o = 0; o !== n; ++o)
  22735. t[o]._update(i, e, r, a);
  22736. for (var s = this._bindings, l = this._nActiveBindings, u = 0; u !== l; ++u)
  22737. s[u].apply(a);
  22738. return this
  22739. },
  22740. setTime: function(e) {
  22741. for (var t = this.time = 0; t < this._actions.length; t++)
  22742. this._actions[t].time = 0;
  22743. return this.update(e)
  22744. },
  22745. getRoot: function() {
  22746. return this._root
  22747. },
  22748. uncacheClip: function(e) {
  22749. var t = this._actions
  22750. , n = e.uuid
  22751. , i = this._actionsByClip
  22752. , e = i[n];
  22753. if (void 0 !== e) {
  22754. for (var r = e.knownActions, a = 0, o = r.length; a !== o; ++a) {
  22755. var s = r[a];
  22756. this._deactivateAction(s);
  22757. var l = s._cacheIndex
  22758. , u = t[t.length - 1];
  22759. s._cacheIndex = null,
  22760. s._byClipCacheIndex = null,
  22761. t[u._cacheIndex = l] = u,
  22762. t.pop(),
  22763. this._removeInactiveBindingsForAction(s)
  22764. }
  22765. delete i[n]
  22766. }
  22767. },
  22768. uncacheRoot: function(e) {
  22769. var t, n = e.uuid, i = this._actionsByClip;
  22770. for (t in i) {
  22771. var r = i[t].actionByRoot[n];
  22772. void 0 !== r && (this._deactivateAction(r),
  22773. this._removeInactiveAction(r))
  22774. }
  22775. var a = this._bindingsByRootAndName[n];
  22776. if (void 0 !== a)
  22777. for (var o in a) {
  22778. o = a[o];
  22779. o.restoreOriginalState(),
  22780. this._removeInactiveBinding(o)
  22781. }
  22782. },
  22783. uncacheAction: function(e, t) {
  22784. t = this.existingAction(e, t);
  22785. null !== t && (this._deactivateAction(t),
  22786. this._removeInactiveAction(t))
  22787. }
  22788. });
  22789. var rh = function() {
  22790. function t(e) {
  22791. O(this, t),
  22792. "string" == typeof e && (console.warn("THREE.Uniform: Type parameter is no longer needed."),
  22793. e = arguments[1]),
  22794. this.value = e
  22795. }
  22796. return h(t, [{
  22797. key: "clone",
  22798. value: function() {
  22799. return new t(void 0 === this.value.clone ? this.value : this.value.clone())
  22800. }
  22801. }]),
  22802. t
  22803. }();
  22804. function ah(e, t, n) {
  22805. ys.call(this, e, t),
  22806. this.meshPerAttribute = n || 1
  22807. }
  22808. function oh(e, t, n, i, r) {
  22809. this.buffer = e,
  22810. this.type = t,
  22811. this.itemSize = n,
  22812. this.elementSize = i,
  22813. this.count = r,
  22814. this.version = 0
  22815. }
  22816. function sh(e, t, n, i) {
  22817. this.ray = new ti(e,t),
  22818. this.near = n || 0,
  22819. this.far = i || 1 / 0,
  22820. this.camera = null,
  22821. this.layers = new pi,
  22822. this.params = {
  22823. Mesh: {},
  22824. Line: {
  22825. threshold: 1
  22826. },
  22827. LOD: {},
  22828. Points: {
  22829. threshold: 1
  22830. },
  22831. Sprite: {}
  22832. },
  22833. Object.defineProperties(this.params, {
  22834. PointCloud: {
  22835. get: function() {
  22836. return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),
  22837. this.Points
  22838. }
  22839. }
  22840. })
  22841. }
  22842. function lh(e, t) {
  22843. return e.distance - t.distance
  22844. }
  22845. function uh(e, t, n, i) {
  22846. if (e.layers.test(t.layers) && e.raycast(t, n),
  22847. !0 === i)
  22848. for (var r = e.children, a = 0, o = r.length; a < o; a++)
  22849. uh(r[a], t, n, !0)
  22850. }
  22851. ah.prototype = Object.assign(Object.create(ys.prototype), {
  22852. constructor: ah,
  22853. isInstancedInterleavedBuffer: !0,
  22854. copy: function(e) {
  22855. return ys.prototype.copy.call(this, e),
  22856. this.meshPerAttribute = e.meshPerAttribute,
  22857. this
  22858. },
  22859. clone: function(e) {
  22860. e = ys.prototype.clone.call(this, e);
  22861. return e.meshPerAttribute = this.meshPerAttribute,
  22862. e
  22863. },
  22864. toJSON: function(e) {
  22865. e = ys.prototype.toJSON.call(this, e);
  22866. return e.isInstancedInterleavedBuffer = !0,
  22867. e.meshPerAttribute = this.meshPerAttribute,
  22868. e
  22869. }
  22870. }),
  22871. Object.defineProperty(oh.prototype, "needsUpdate", {
  22872. set: function(e) {
  22873. !0 === e && this.version++
  22874. }
  22875. }),
  22876. Object.assign(oh.prototype, {
  22877. isGLBufferAttribute: !0,
  22878. setBuffer: function(e) {
  22879. return this.buffer = e,
  22880. this
  22881. },
  22882. setType: function(e, t) {
  22883. return this.type = e,
  22884. this.elementSize = t,
  22885. this
  22886. },
  22887. setItemSize: function(e) {
  22888. return this.itemSize = e,
  22889. this
  22890. },
  22891. setCount: function(e) {
  22892. return this.count = e,
  22893. this
  22894. }
  22895. }),
  22896. Object.assign(sh.prototype, {
  22897. set: function(e, t) {
  22898. this.ray.set(e, t)
  22899. },
  22900. setFromCamera: function(e, t) {
  22901. t && t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld),
  22902. this.ray.direction.set(e.x, e.y, .5).unproject(t).sub(this.ray.origin).normalize(),
  22903. this.camera = t) : t && t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t),
  22904. this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld),
  22905. this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type)
  22906. },
  22907. intersectObject: function(e, t, n) {
  22908. n = n || [];
  22909. return uh(e, this, n, t),
  22910. n.sort(lh),
  22911. n
  22912. },
  22913. intersectObjects: function(e, t, n) {
  22914. var i = n || [];
  22915. if (!1 === Array.isArray(e))
  22916. return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),
  22917. i;
  22918. for (var r = 0, a = e.length; r < a; r++)
  22919. uh(e[r], this, i, t);
  22920. return i.sort(lh),
  22921. i
  22922. }
  22923. });
  22924. var ch = function() {
  22925. function i() {
  22926. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  22927. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  22928. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0;
  22929. return O(this, i),
  22930. this.radius = e,
  22931. this.phi = t,
  22932. this.theta = n,
  22933. this
  22934. }
  22935. return h(i, [{
  22936. key: "set",
  22937. value: function(e, t, n) {
  22938. return this.radius = e,
  22939. this.phi = t,
  22940. this.theta = n,
  22941. this
  22942. }
  22943. }, {
  22944. key: "clone",
  22945. value: function() {
  22946. return (new this.constructor).copy(this)
  22947. }
  22948. }, {
  22949. key: "copy",
  22950. value: function(e) {
  22951. return this.radius = e.radius,
  22952. this.phi = e.phi,
  22953. this.theta = e.theta,
  22954. this
  22955. }
  22956. }, {
  22957. key: "makeSafe",
  22958. value: function() {
  22959. return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)),
  22960. this
  22961. }
  22962. }, {
  22963. key: "setFromVector3",
  22964. value: function(e) {
  22965. return this.setFromCartesianCoords(e.x, e.y, e.z)
  22966. }
  22967. }, {
  22968. key: "setFromCartesianCoords",
  22969. value: function(e, t, n) {
  22970. return this.radius = Math.sqrt(e * e + t * t + n * n),
  22971. 0 === this.radius ? (this.theta = 0,
  22972. this.phi = 0) : (this.theta = Math.atan2(e, n),
  22973. this.phi = Math.acos(gn.clamp(t / this.radius, -1, 1))),
  22974. this
  22975. }
  22976. }]),
  22977. i
  22978. }()
  22979. , dh = function() {
  22980. function i(e, t, n) {
  22981. return O(this, i),
  22982. this.radius = void 0 !== e ? e : 1,
  22983. this.theta = void 0 !== t ? t : 0,
  22984. this.y = void 0 !== n ? n : 0,
  22985. this
  22986. }
  22987. return h(i, [{
  22988. key: "set",
  22989. value: function(e, t, n) {
  22990. return this.radius = e,
  22991. this.theta = t,
  22992. this.y = n,
  22993. this
  22994. }
  22995. }, {
  22996. key: "clone",
  22997. value: function() {
  22998. return (new this.constructor).copy(this)
  22999. }
  23000. }, {
  23001. key: "copy",
  23002. value: function(e) {
  23003. return this.radius = e.radius,
  23004. this.theta = e.theta,
  23005. this.y = e.y,
  23006. this
  23007. }
  23008. }, {
  23009. key: "setFromVector3",
  23010. value: function(e) {
  23011. return this.setFromCartesianCoords(e.x, e.y, e.z)
  23012. }
  23013. }, {
  23014. key: "setFromCartesianCoords",
  23015. value: function(e, t, n) {
  23016. return this.radius = Math.sqrt(e * e + n * n),
  23017. this.theta = Math.atan2(e, n),
  23018. this.y = t,
  23019. this
  23020. }
  23021. }]),
  23022. i
  23023. }()
  23024. , hh = new yn
  23025. , ph = function() {
  23026. function n(e, t) {
  23027. O(this, n),
  23028. Object.defineProperty(this, "isBox2", {
  23029. value: !0
  23030. }),
  23031. this.min = void 0 !== e ? e : new yn(1 / 0,1 / 0),
  23032. this.max = void 0 !== t ? t : new yn(-1 / 0,-1 / 0)
  23033. }
  23034. return h(n, [{
  23035. key: "set",
  23036. value: function(e, t) {
  23037. return this.min.copy(e),
  23038. this.max.copy(t),
  23039. this
  23040. }
  23041. }, {
  23042. key: "setFromPoints",
  23043. value: function(e) {
  23044. this.makeEmpty();
  23045. for (var t = 0, n = e.length; t < n; t++)
  23046. this.expandByPoint(e[t]);
  23047. return this
  23048. }
  23049. }, {
  23050. key: "setFromCenterAndSize",
  23051. value: function(e, t) {
  23052. t = hh.copy(t).multiplyScalar(.5);
  23053. return this.min.copy(e).sub(t),
  23054. this.max.copy(e).add(t),
  23055. this
  23056. }
  23057. }, {
  23058. key: "clone",
  23059. value: function() {
  23060. return (new this.constructor).copy(this)
  23061. }
  23062. }, {
  23063. key: "copy",
  23064. value: function(e) {
  23065. return this.min.copy(e.min),
  23066. this.max.copy(e.max),
  23067. this
  23068. }
  23069. }, {
  23070. key: "makeEmpty",
  23071. value: function() {
  23072. return this.min.x = this.min.y = 1 / 0,
  23073. this.max.x = this.max.y = -1 / 0,
  23074. this
  23075. }
  23076. }, {
  23077. key: "isEmpty",
  23078. value: function() {
  23079. return this.max.x < this.min.x || this.max.y < this.min.y
  23080. }
  23081. }, {
  23082. key: "getCenter",
  23083. value: function(e) {
  23084. return void 0 === e && (console.warn("THREE.Box2: .getCenter() target is now required"),
  23085. e = new yn),
  23086. this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5)
  23087. }
  23088. }, {
  23089. key: "getSize",
  23090. value: function(e) {
  23091. return void 0 === e && (console.warn("THREE.Box2: .getSize() target is now required"),
  23092. e = new yn),
  23093. this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min)
  23094. }
  23095. }, {
  23096. key: "expandByPoint",
  23097. value: function(e) {
  23098. return this.min.min(e),
  23099. this.max.max(e),
  23100. this
  23101. }
  23102. }, {
  23103. key: "expandByVector",
  23104. value: function(e) {
  23105. return this.min.sub(e),
  23106. this.max.add(e),
  23107. this
  23108. }
  23109. }, {
  23110. key: "expandByScalar",
  23111. value: function(e) {
  23112. return this.min.addScalar(-e),
  23113. this.max.addScalar(e),
  23114. this
  23115. }
  23116. }, {
  23117. key: "containsPoint",
  23118. value: function(e) {
  23119. return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y)
  23120. }
  23121. }, {
  23122. key: "containsBox",
  23123. value: function(e) {
  23124. return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y
  23125. }
  23126. }, {
  23127. key: "getParameter",
  23128. value: function(e, t) {
  23129. return void 0 === t && (console.warn("THREE.Box2: .getParameter() target is now required"),
  23130. t = new yn),
  23131. t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y))
  23132. }
  23133. }, {
  23134. key: "intersectsBox",
  23135. value: function(e) {
  23136. return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y)
  23137. }
  23138. }, {
  23139. key: "clampPoint",
  23140. value: function(e, t) {
  23141. return void 0 === t && (console.warn("THREE.Box2: .clampPoint() target is now required"),
  23142. t = new yn),
  23143. t.copy(e).clamp(this.min, this.max)
  23144. }
  23145. }, {
  23146. key: "distanceToPoint",
  23147. value: function(e) {
  23148. return hh.copy(e).clamp(this.min, this.max).sub(e).length()
  23149. }
  23150. }, {
  23151. key: "intersect",
  23152. value: function(e) {
  23153. return this.min.max(e.min),
  23154. this.max.min(e.max),
  23155. this
  23156. }
  23157. }, {
  23158. key: "union",
  23159. value: function(e) {
  23160. return this.min.min(e.min),
  23161. this.max.max(e.max),
  23162. this
  23163. }
  23164. }, {
  23165. key: "translate",
  23166. value: function(e) {
  23167. return this.min.add(e),
  23168. this.max.add(e),
  23169. this
  23170. }
  23171. }, {
  23172. key: "equals",
  23173. value: function(e) {
  23174. return e.min.equals(this.min) && e.max.equals(this.max)
  23175. }
  23176. }]),
  23177. n
  23178. }()
  23179. , fh = new Cn
  23180. , mh = new Cn
  23181. , vh = function() {
  23182. function n(e, t) {
  23183. O(this, n),
  23184. this.start = void 0 !== e ? e : new Cn,
  23185. this.end = void 0 !== t ? t : new Cn
  23186. }
  23187. return h(n, [{
  23188. key: "set",
  23189. value: function(e, t) {
  23190. return this.start.copy(e),
  23191. this.end.copy(t),
  23192. this
  23193. }
  23194. }, {
  23195. key: "clone",
  23196. value: function() {
  23197. return (new this.constructor).copy(this)
  23198. }
  23199. }, {
  23200. key: "copy",
  23201. value: function(e) {
  23202. return this.start.copy(e.start),
  23203. this.end.copy(e.end),
  23204. this
  23205. }
  23206. }, {
  23207. key: "getCenter",
  23208. value: function(e) {
  23209. return void 0 === e && (console.warn("THREE.Line3: .getCenter() target is now required"),
  23210. e = new Cn),
  23211. e.addVectors(this.start, this.end).multiplyScalar(.5)
  23212. }
  23213. }, {
  23214. key: "delta",
  23215. value: function(e) {
  23216. return void 0 === e && (console.warn("THREE.Line3: .delta() target is now required"),
  23217. e = new Cn),
  23218. e.subVectors(this.end, this.start)
  23219. }
  23220. }, {
  23221. key: "distanceSq",
  23222. value: function() {
  23223. return this.start.distanceToSquared(this.end)
  23224. }
  23225. }, {
  23226. key: "distance",
  23227. value: function() {
  23228. return this.start.distanceTo(this.end)
  23229. }
  23230. }, {
  23231. key: "at",
  23232. value: function(e, t) {
  23233. return void 0 === t && (console.warn("THREE.Line3: .at() target is now required"),
  23234. t = new Cn),
  23235. this.delta(t).multiplyScalar(e).add(this.start)
  23236. }
  23237. }, {
  23238. key: "closestPointToPointParameter",
  23239. value: function(e, t) {
  23240. fh.subVectors(e, this.start),
  23241. mh.subVectors(this.end, this.start);
  23242. e = mh.dot(mh),
  23243. e = mh.dot(fh) / e;
  23244. return e = t ? gn.clamp(e, 0, 1) : e
  23245. }
  23246. }, {
  23247. key: "closestPointToPoint",
  23248. value: function(e, t, n) {
  23249. t = this.closestPointToPointParameter(e, t);
  23250. return void 0 === n && (console.warn("THREE.Line3: .closestPointToPoint() target is now required"),
  23251. n = new Cn),
  23252. this.delta(n).multiplyScalar(t).add(this.start)
  23253. }
  23254. }, {
  23255. key: "applyMatrix4",
  23256. value: function(e) {
  23257. return this.start.applyMatrix4(e),
  23258. this.end.applyMatrix4(e),
  23259. this
  23260. }
  23261. }, {
  23262. key: "equals",
  23263. value: function(e) {
  23264. return e.start.equals(this.start) && e.end.equals(this.end)
  23265. }
  23266. }]),
  23267. n
  23268. }();
  23269. function gh(e) {
  23270. Si.call(this),
  23271. this.material = e,
  23272. this.render = function() {}
  23273. ,
  23274. this.hasPositions = !1,
  23275. this.hasNormals = !1,
  23276. this.hasColors = !1,
  23277. this.hasUvs = !1,
  23278. this.positionArray = null,
  23279. this.normalArray = null,
  23280. this.colorArray = null,
  23281. this.uvArray = null,
  23282. this.count = 0
  23283. }
  23284. ((gh.prototype = Object.create(Si.prototype)).constructor = gh).prototype.isImmediateRenderObject = !0;
  23285. var yh = new Cn
  23286. , wh = function() {
  23287. y(u, Si);
  23288. var l = w(u);
  23289. function u(e, t) {
  23290. var n;
  23291. O(this, u),
  23292. (n = l.call(this)).light = e,
  23293. n.light.updateMatrixWorld(),
  23294. n.matrix = e.matrixWorld,
  23295. n.matrixAutoUpdate = !1,
  23296. n.color = t;
  23297. for (var e = new Mr, i = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], r = 0, a = 1; r < 32; r++,
  23298. a++) {
  23299. var o = r / 32 * Math.PI * 2
  23300. , s = a / 32 * Math.PI * 2;
  23301. i.push(Math.cos(o), Math.sin(o), 1, Math.cos(s), Math.sin(s), 1)
  23302. }
  23303. e.setAttribute("position", new dr(i,3));
  23304. t = new tl({
  23305. fog: !1,
  23306. toneMapped: !1
  23307. });
  23308. return n.cone = new cl(e,t),
  23309. n.add(n.cone),
  23310. n.update(),
  23311. n
  23312. }
  23313. return h(u, [{
  23314. key: "dispose",
  23315. value: function() {
  23316. this.cone.geometry.dispose(),
  23317. this.cone.material.dispose()
  23318. }
  23319. }, {
  23320. key: "update",
  23321. value: function() {
  23322. this.light.updateMatrixWorld();
  23323. var e = this.light.distance || 1e3
  23324. , t = e * Math.tan(this.light.angle);
  23325. this.cone.scale.set(t, t, e),
  23326. yh.setFromMatrixPosition(this.light.target.matrixWorld),
  23327. this.cone.lookAt(yh),
  23328. void 0 !== this.color ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color)
  23329. }
  23330. }]),
  23331. u
  23332. }()
  23333. , bh = new Cn
  23334. , xh = new ni
  23335. , Eh = new ni
  23336. , _h = function() {
  23337. y(d, cl);
  23338. var c = w(d);
  23339. function d(e) {
  23340. O(this, d);
  23341. for (var t = function e(t) {
  23342. var n = [];
  23343. t && t.isBone && n.push(t);
  23344. for (var i = 0; i < t.children.length; i++)
  23345. n.push.apply(n, e(t.children[i]));
  23346. return n
  23347. }(e), n = new Mr, i = [], r = [], a = new Yi(0,0,1), o = new Yi(0,1,0), s = 0; s < t.length; s++) {
  23348. var l = t[s];
  23349. l.parent && l.parent.isBone && (i.push(0, 0, 0),
  23350. i.push(0, 0, 0),
  23351. r.push(a.r, a.g, a.b),
  23352. r.push(o.r, o.g, o.b))
  23353. }
  23354. n.setAttribute("position", new dr(i,3)),
  23355. n.setAttribute("color", new dr(r,3));
  23356. var u = new tl({
  23357. vertexColors: !0,
  23358. depthTest: !1,
  23359. depthWrite: !1,
  23360. toneMapped: !1,
  23361. transparent: !0
  23362. });
  23363. return (u = c.call(this, n, u)).type = "SkeletonHelper",
  23364. u.isSkeletonHelper = !0,
  23365. u.root = e,
  23366. u.bones = t,
  23367. u.matrix = e.matrixWorld,
  23368. u.matrixAutoUpdate = !1,
  23369. u
  23370. }
  23371. return h(d, [{
  23372. key: "updateMatrixWorld",
  23373. value: function(e) {
  23374. var t = this.bones
  23375. , n = this.geometry
  23376. , i = n.getAttribute("position");
  23377. Eh.copy(this.root.matrixWorld).invert();
  23378. for (var r = 0, a = 0; r < t.length; r++) {
  23379. var o = t[r];
  23380. o.parent && o.parent.isBone && (xh.multiplyMatrices(Eh, o.matrixWorld),
  23381. bh.setFromMatrixPosition(xh),
  23382. i.setXYZ(a, bh.x, bh.y, bh.z),
  23383. xh.multiplyMatrices(Eh, o.parent.matrixWorld),
  23384. bh.setFromMatrixPosition(xh),
  23385. i.setXYZ(a + 1, bh.x, bh.y, bh.z),
  23386. a += 2)
  23387. }
  23388. n.getAttribute("position").needsUpdate = !0,
  23389. b(v(d.prototype), "updateMatrixWorld", this).call(this, e)
  23390. }
  23391. }]),
  23392. d
  23393. }();
  23394. var Mh = function() {
  23395. y(a, Hr);
  23396. var r = w(a);
  23397. function a(e, t, n) {
  23398. O(this, a);
  23399. var i = new Tu(t,4,2)
  23400. , t = new $i({
  23401. wireframe: !0,
  23402. fog: !1,
  23403. toneMapped: !1
  23404. });
  23405. return (t = r.call(this, i, t)).light = e,
  23406. t.light.updateMatrixWorld(),
  23407. t.color = n,
  23408. t.type = "PointLightHelper",
  23409. t.matrix = t.light.matrixWorld,
  23410. t.matrixAutoUpdate = !1,
  23411. t.update(),
  23412. t
  23413. }
  23414. return h(a, [{
  23415. key: "dispose",
  23416. value: function() {
  23417. this.geometry.dispose(),
  23418. this.material.dispose()
  23419. }
  23420. }, {
  23421. key: "update",
  23422. value: function() {
  23423. void 0 !== this.color ? this.material.color.set(this.color) : this.material.color.copy(this.light.color)
  23424. }
  23425. }]),
  23426. a
  23427. }()
  23428. , Ah = new Cn
  23429. , Th = new Yi
  23430. , Sh = new Yi
  23431. , Ch = function() {
  23432. y(a, Si);
  23433. var r = w(a);
  23434. function a(e, t, n) {
  23435. var i;
  23436. O(this, a),
  23437. (i = r.call(this)).light = e,
  23438. i.light.updateMatrixWorld(),
  23439. i.matrix = e.matrixWorld,
  23440. i.matrixAutoUpdate = !1,
  23441. i.color = n;
  23442. n = new vu(t);
  23443. n.rotateY(.5 * Math.PI),
  23444. i.material = new $i({
  23445. wireframe: !0,
  23446. fog: !1,
  23447. toneMapped: !1
  23448. }),
  23449. void 0 === i.color && (i.material.vertexColors = !0);
  23450. t = n.getAttribute("position"),
  23451. t = new Float32Array(3 * t.count);
  23452. return n.setAttribute("color", new nr(t,3)),
  23453. i.add(new Hr(n,i.material)),
  23454. i.update(),
  23455. i
  23456. }
  23457. return h(a, [{
  23458. key: "dispose",
  23459. value: function() {
  23460. this.children[0].geometry.dispose(),
  23461. this.children[0].material.dispose()
  23462. }
  23463. }, {
  23464. key: "update",
  23465. value: function() {
  23466. var e = this.children[0];
  23467. if (void 0 !== this.color)
  23468. this.material.color.set(this.color);
  23469. else {
  23470. var t = e.geometry.getAttribute("color");
  23471. Th.copy(this.light.color),
  23472. Sh.copy(this.light.groundColor);
  23473. for (var n = 0, i = t.count; n < i; n++) {
  23474. var r = n < i / 2 ? Th : Sh;
  23475. t.setXYZ(n, r.r, r.g, r.b)
  23476. }
  23477. t.needsUpdate = !0
  23478. }
  23479. e.lookAt(Ah.setFromMatrixPosition(this.light.matrixWorld).negate())
  23480. }
  23481. }]),
  23482. a
  23483. }()
  23484. , Ph = function() {
  23485. y(m, cl);
  23486. var f = w(m);
  23487. function m() {
  23488. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 10
  23489. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 10
  23490. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 4473924
  23491. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8947848;
  23492. O(this, m);
  23493. for (var n = new Yi(n), i = new Yi(i), r = t / 2, a = e / t, o = e / 2, s = [], l = [], u = 0, c = 0, d = -o; u <= t; u++,
  23494. d += a) {
  23495. s.push(-o, 0, d, o, 0, d),
  23496. s.push(d, 0, -o, d, 0, o);
  23497. var h = u === r ? n : i;
  23498. h.toArray(l, c),
  23499. c += 3,
  23500. h.toArray(l, c),
  23501. c += 3,
  23502. h.toArray(l, c),
  23503. c += 3,
  23504. h.toArray(l, c),
  23505. c += 3
  23506. }
  23507. var p = new Mr;
  23508. p.setAttribute("position", new dr(s,3)),
  23509. p.setAttribute("color", new dr(l,3));
  23510. var e = new tl({
  23511. vertexColors: !0,
  23512. toneMapped: !1
  23513. });
  23514. return (e = f.call(this, p, e)).type = "GridHelper",
  23515. e
  23516. }
  23517. return h(m)
  23518. }()
  23519. , Dh = function() {
  23520. y(x, cl);
  23521. var b = w(x);
  23522. function x() {
  23523. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 10
  23524. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16
  23525. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8
  23526. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 64
  23527. , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 4473924
  23528. , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 8947848;
  23529. O(this, x);
  23530. for (var r = new Yi(r), a = new Yi(a), o = [], s = [], l = 0; l <= t; l++) {
  23531. var u = l / t * (2 * Math.PI)
  23532. , c = Math.sin(u) * e
  23533. , u = Math.cos(u) * e;
  23534. o.push(0, 0, 0),
  23535. o.push(c, 0, u);
  23536. u = 1 & l ? r : a;
  23537. s.push(u.r, u.g, u.b),
  23538. s.push(u.r, u.g, u.b)
  23539. }
  23540. for (var d = 0; d <= n; d++)
  23541. for (var h = 1 & d ? r : a, p = e - e / n * d, f = 0; f < i; f++) {
  23542. var m = f / i * (2 * Math.PI)
  23543. , v = Math.sin(m) * p
  23544. , g = Math.cos(m) * p;
  23545. o.push(v, 0, g),
  23546. s.push(h.r, h.g, h.b),
  23547. m = (f + 1) / i * (2 * Math.PI),
  23548. v = Math.sin(m) * p,
  23549. g = Math.cos(m) * p,
  23550. o.push(v, 0, g),
  23551. s.push(h.r, h.g, h.b)
  23552. }
  23553. var y = new Mr;
  23554. y.setAttribute("position", new dr(o,3)),
  23555. y.setAttribute("color", new dr(s,3));
  23556. var w = new tl({
  23557. vertexColors: !0,
  23558. toneMapped: !1
  23559. });
  23560. return (w = b.call(this, y, w)).type = "PolarGridHelper",
  23561. w
  23562. }
  23563. return h(x)
  23564. }()
  23565. , kh = new Cn
  23566. , Bh = new Cn
  23567. , Lh = new Cn
  23568. , Rh = function() {
  23569. y(a, Si);
  23570. var r = w(a);
  23571. function a(e, t, n) {
  23572. var i;
  23573. O(this, a),
  23574. (i = r.call(this)).light = e,
  23575. i.light.updateMatrixWorld(),
  23576. i.matrix = e.matrixWorld,
  23577. i.matrixAutoUpdate = !1,
  23578. i.color = n,
  23579. void 0 === t && (t = 1);
  23580. n = new Mr;
  23581. n.setAttribute("position", new dr([-t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0],3));
  23582. t = new tl({
  23583. fog: !1,
  23584. toneMapped: !1
  23585. });
  23586. return i.lightPlane = new sl(n,t),
  23587. i.add(i.lightPlane),
  23588. (n = new Mr).setAttribute("position", new dr([0, 0, 0, 0, 0, 1],3)),
  23589. i.targetLine = new sl(n,t),
  23590. i.add(i.targetLine),
  23591. i.update(),
  23592. i
  23593. }
  23594. return h(a, [{
  23595. key: "dispose",
  23596. value: function() {
  23597. this.lightPlane.geometry.dispose(),
  23598. this.lightPlane.material.dispose(),
  23599. this.targetLine.geometry.dispose(),
  23600. this.targetLine.material.dispose()
  23601. }
  23602. }, {
  23603. key: "update",
  23604. value: function() {
  23605. kh.setFromMatrixPosition(this.light.matrixWorld),
  23606. Bh.setFromMatrixPosition(this.light.target.matrixWorld),
  23607. Lh.subVectors(Bh, kh),
  23608. this.lightPlane.lookAt(Bh),
  23609. void 0 !== this.color ? (this.lightPlane.material.color.set(this.color),
  23610. this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color),
  23611. this.targetLine.material.color.copy(this.light.color)),
  23612. this.targetLine.lookAt(Bh),
  23613. this.targetLine.scale.z = Lh.length()
  23614. }
  23615. }]),
  23616. a
  23617. }()
  23618. , Fh = new Cn
  23619. , Ih = new Kr
  23620. , Vd = function() {
  23621. y(f, cl);
  23622. var p = w(f);
  23623. function f(e) {
  23624. O(this, f);
  23625. var t = new Mr
  23626. , n = new tl({
  23627. color: 16777215,
  23628. vertexColors: !0,
  23629. toneMapped: !1
  23630. })
  23631. , i = []
  23632. , r = []
  23633. , a = {}
  23634. , o = new Yi(16755200)
  23635. , s = new Yi(16711680)
  23636. , l = new Yi(43775)
  23637. , u = new Yi(16777215)
  23638. , c = new Yi(3355443);
  23639. function d(e, t, n) {
  23640. h(e, n),
  23641. h(t, n)
  23642. }
  23643. function h(e, t) {
  23644. i.push(0, 0, 0),
  23645. r.push(t.r, t.g, t.b),
  23646. void 0 === a[e] && (a[e] = []),
  23647. a[e].push(i.length / 3 - 1)
  23648. }
  23649. return d("n1", "n2", o),
  23650. d("n2", "n4", o),
  23651. d("n4", "n3", o),
  23652. d("n3", "n1", o),
  23653. d("f1", "f2", o),
  23654. d("f2", "f4", o),
  23655. d("f4", "f3", o),
  23656. d("f3", "f1", o),
  23657. d("n1", "f1", o),
  23658. d("n2", "f2", o),
  23659. d("n3", "f3", o),
  23660. d("n4", "f4", o),
  23661. d("p", "n1", s),
  23662. d("p", "n2", s),
  23663. d("p", "n3", s),
  23664. d("p", "n4", s),
  23665. d("u1", "u2", l),
  23666. d("u2", "u3", l),
  23667. d("u3", "u1", l),
  23668. d("c", "t", u),
  23669. d("p", "c", c),
  23670. d("cn1", "cn2", c),
  23671. d("cn3", "cn4", c),
  23672. d("cf1", "cf2", c),
  23673. d("cf3", "cf4", c),
  23674. t.setAttribute("position", new dr(i,3)),
  23675. t.setAttribute("color", new dr(r,3)),
  23676. (n = p.call(this, t, n)).type = "CameraHelper",
  23677. n.camera = e,
  23678. n.camera.updateProjectionMatrix && n.camera.updateProjectionMatrix(),
  23679. n.matrix = e.matrixWorld,
  23680. n.matrixAutoUpdate = !1,
  23681. n.pointMap = a,
  23682. n.update(),
  23683. n
  23684. }
  23685. return h(f, [{
  23686. key: "update",
  23687. value: function() {
  23688. var e = this.geometry
  23689. , t = this.pointMap;
  23690. Ih.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),
  23691. Oh("c", t, e, Ih, 0, 0, -1),
  23692. Oh("t", t, e, Ih, 0, 0, 1),
  23693. Oh("n1", t, e, Ih, -1, -1, -1),
  23694. Oh("n2", t, e, Ih, 1, -1, -1),
  23695. Oh("n3", t, e, Ih, -1, 1, -1),
  23696. Oh("n4", t, e, Ih, 1, 1, -1),
  23697. Oh("f1", t, e, Ih, -1, -1, 1),
  23698. Oh("f2", t, e, Ih, 1, -1, 1),
  23699. Oh("f3", t, e, Ih, -1, 1, 1),
  23700. Oh("f4", t, e, Ih, 1, 1, 1),
  23701. Oh("u1", t, e, Ih, .7, 1.1, -1),
  23702. Oh("u2", t, e, Ih, -.7, 1.1, -1),
  23703. Oh("u3", t, e, Ih, 0, 2, -1),
  23704. Oh("cf1", t, e, Ih, -1, 0, 1),
  23705. Oh("cf2", t, e, Ih, 1, 0, 1),
  23706. Oh("cf3", t, e, Ih, 0, -1, 1),
  23707. Oh("cf4", t, e, Ih, 0, 1, 1),
  23708. Oh("cn1", t, e, Ih, -1, 0, -1),
  23709. Oh("cn2", t, e, Ih, 1, 0, -1),
  23710. Oh("cn3", t, e, Ih, 0, -1, -1),
  23711. Oh("cn4", t, e, Ih, 0, 1, -1),
  23712. e.getAttribute("position").needsUpdate = !0
  23713. }
  23714. }]),
  23715. f
  23716. }();
  23717. function Oh(e, t, n, i, r, a, o) {
  23718. Fh.set(r, a, o).unproject(i);
  23719. var s = t[e];
  23720. if (void 0 !== s)
  23721. for (var l = n.getAttribute("position"), u = 0, c = s.length; u < c; u++)
  23722. l.setXYZ(s[u], Fh.x, Fh.y, Fh.z)
  23723. }
  23724. var zh, Nh, Uh = new kn, Gh = function() {
  23725. y(o, cl);
  23726. var a = w(o);
  23727. function o(e) {
  23728. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16776960;
  23729. O(this, o);
  23730. var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
  23731. , i = new Float32Array(24)
  23732. , r = new Mr;
  23733. return r.setIndex(new nr(n,1)),
  23734. r.setAttribute("position", new nr(i,3)),
  23735. (t = a.call(this, r, new tl({
  23736. color: t,
  23737. toneMapped: !1
  23738. }))).object = e,
  23739. t.type = "BoxHelper",
  23740. t.matrixAutoUpdate = !1,
  23741. t.update(),
  23742. t
  23743. }
  23744. return h(o, [{
  23745. key: "update",
  23746. value: function(e) {
  23747. var t, n, i;
  23748. void 0 !== e && console.warn("THREE.BoxHelper: .update() has no longer arguments."),
  23749. void 0 !== this.object && Uh.setFromObject(this.object),
  23750. Uh.isEmpty() || (t = Uh.min,
  23751. n = Uh.max,
  23752. (e = (i = this.geometry.attributes.position).array)[0] = n.x,
  23753. e[1] = n.y,
  23754. e[2] = n.z,
  23755. e[3] = t.x,
  23756. e[4] = n.y,
  23757. e[5] = n.z,
  23758. e[6] = t.x,
  23759. e[7] = t.y,
  23760. e[8] = n.z,
  23761. e[9] = n.x,
  23762. e[10] = t.y,
  23763. e[11] = n.z,
  23764. e[12] = n.x,
  23765. e[13] = n.y,
  23766. e[14] = t.z,
  23767. e[15] = t.x,
  23768. e[16] = n.y,
  23769. e[17] = t.z,
  23770. e[18] = t.x,
  23771. e[19] = t.y,
  23772. e[20] = t.z,
  23773. e[21] = n.x,
  23774. e[22] = t.y,
  23775. e[23] = t.z,
  23776. i.needsUpdate = !0,
  23777. this.geometry.computeBoundingSphere())
  23778. }
  23779. }, {
  23780. key: "setFromObject",
  23781. value: function(e) {
  23782. return this.object = e,
  23783. this.update(),
  23784. this
  23785. }
  23786. }, {
  23787. key: "copy",
  23788. value: function(e) {
  23789. return cl.prototype.copy.call(this, e),
  23790. this.object = e.object,
  23791. this
  23792. }
  23793. }]),
  23794. o
  23795. }(), Xd = function() {
  23796. y(a, cl);
  23797. var r = w(a);
  23798. function a(e) {
  23799. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16776960;
  23800. O(this, a);
  23801. var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
  23802. , i = new Mr;
  23803. return i.setIndex(new nr(n,1)),
  23804. i.setAttribute("position", new dr([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1],3)),
  23805. (t = r.call(this, i, new tl({
  23806. color: t,
  23807. toneMapped: !1
  23808. }))).box = e,
  23809. t.type = "Box3Helper",
  23810. t.geometry.computeBoundingSphere(),
  23811. t
  23812. }
  23813. return h(a, [{
  23814. key: "updateMatrixWorld",
  23815. value: function(e) {
  23816. var t = this.box;
  23817. t.isEmpty() || (t.getCenter(this.position),
  23818. t.getSize(this.scale),
  23819. this.scale.multiplyScalar(.5),
  23820. b(v(a.prototype), "updateMatrixWorld", this).call(this, e))
  23821. }
  23822. }]),
  23823. a
  23824. }(), Hh = function() {
  23825. y(a, sl);
  23826. var r = w(a);
  23827. function a(e) {
  23828. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1
  23829. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 16776960;
  23830. O(this, a);
  23831. var i = n
  23832. , n = new Mr;
  23833. n.setAttribute("position", new dr([1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0],3)),
  23834. n.computeBoundingSphere(),
  23835. (n = r.call(this, n, new tl({
  23836. color: i,
  23837. toneMapped: !1
  23838. }))).type = "PlaneHelper",
  23839. n.plane = e,
  23840. n.size = t;
  23841. t = new Mr;
  23842. return t.setAttribute("position", new dr([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1],3)),
  23843. t.computeBoundingSphere(),
  23844. n.add(new Hr(t,new $i({
  23845. color: i,
  23846. opacity: .2,
  23847. transparent: !0,
  23848. depthWrite: !1,
  23849. toneMapped: !1
  23850. }))),
  23851. n
  23852. }
  23853. return h(a, [{
  23854. key: "updateMatrixWorld",
  23855. value: function(e) {
  23856. var t = -this.plane.constant;
  23857. Math.abs(t) < 1e-8 && (t = 1e-8),
  23858. this.scale.set(.5 * this.size, .5 * this.size, t),
  23859. this.children[0].material.side = t < 0 ? J : q,
  23860. this.lookAt(this.plane.normal),
  23861. b(v(a.prototype), "updateMatrixWorld", this).call(this, e)
  23862. }
  23863. }]),
  23864. a
  23865. }(), Vh = new Cn, Wd = function() {
  23866. y(l, Si);
  23867. var s = w(l);
  23868. function l(e, t, n, i, r, a) {
  23869. var o;
  23870. return O(this, l),
  23871. (o = s.call(this)).type = "ArrowHelper",
  23872. void 0 === e && (e = new Cn(0,0,1)),
  23873. void 0 === t && (t = new Cn(0,0,0)),
  23874. void 0 === n && (n = 1),
  23875. void 0 === i && (i = 16776960),
  23876. void 0 === r && (r = .2 * n),
  23877. void 0 === a && (a = .2 * r),
  23878. void 0 === zh && ((zh = new Mr).setAttribute("position", new dr([0, 0, 0, 0, 1, 0],3)),
  23879. (Nh = new kl(0,.5,1,5,1)).translate(0, -.5, 0)),
  23880. o.position.copy(t),
  23881. o.line = new sl(zh,new tl({
  23882. color: i,
  23883. toneMapped: !1
  23884. })),
  23885. o.line.matrixAutoUpdate = !1,
  23886. o.add(o.line),
  23887. o.cone = new Hr(Nh,new $i({
  23888. color: i,
  23889. toneMapped: !1
  23890. })),
  23891. o.cone.matrixAutoUpdate = !1,
  23892. o.add(o.cone),
  23893. o.setDirection(e),
  23894. o.setLength(n, r, a),
  23895. o
  23896. }
  23897. return h(l, [{
  23898. key: "setDirection",
  23899. value: function(e) {
  23900. .99999 < e.y ? this.quaternion.set(0, 0, 0, 1) : e.y < -.99999 ? this.quaternion.set(1, 0, 0, 0) : (Vh.set(e.z, 0, -e.x).normalize(),
  23901. e = Math.acos(e.y),
  23902. this.quaternion.setFromAxisAngle(Vh, e))
  23903. }
  23904. }, {
  23905. key: "setLength",
  23906. value: function(e, t, n) {
  23907. void 0 === t && (t = .2 * e),
  23908. void 0 === n && (n = .2 * t),
  23909. this.line.scale.set(1, Math.max(1e-4, e - t), 1),
  23910. this.line.updateMatrix(),
  23911. this.cone.scale.set(n, t, n),
  23912. this.cone.position.y = e,
  23913. this.cone.updateMatrix()
  23914. }
  23915. }, {
  23916. key: "setColor",
  23917. value: function(e) {
  23918. this.line.material.color.set(e),
  23919. this.cone.material.color.set(e)
  23920. }
  23921. }, {
  23922. key: "copy",
  23923. value: function(e) {
  23924. return b(v(l.prototype), "copy", this).call(this, e, !1),
  23925. this.line.copy(e.line),
  23926. this.cone.copy(e.cone),
  23927. this
  23928. }
  23929. }]),
  23930. l
  23931. }(), jh = function() {
  23932. y(i, cl);
  23933. var n = w(i);
  23934. function i() {
  23935. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1;
  23936. O(this, i);
  23937. var t = [0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e]
  23938. , e = new Mr;
  23939. e.setAttribute("position", new dr(t,3)),
  23940. e.setAttribute("color", new dr([1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1],3));
  23941. var t = new tl({
  23942. vertexColors: !0,
  23943. toneMapped: !1
  23944. });
  23945. return (t = n.call(this, e, t)).type = "AxesHelper",
  23946. t
  23947. }
  23948. return h(i)
  23949. }(), Wh = new Float32Array(1), Xh = new Int32Array(Wh.buffer), qd = {
  23950. toHalfFloat: function(e) {
  23951. Wh[0] = e;
  23952. var t = Xh[0]
  23953. , n = t >> 16 & 32768
  23954. , i = t >> 12 & 2047
  23955. , e = t >> 23 & 255;
  23956. return e < 103 ? n : 142 < e ? (n |= 31744,
  23957. n |= (255 == e ? 0 : 1) && 8388607 & t) : e < 113 ? n |= ((i |= 2048) >> 114 - e) + (i >> 113 - e & 1) : (n |= e - 112 << 10 | i >> 1,
  23958. n += 1 & i)
  23959. }
  23960. }, qh = Math.pow(2, 8), Jh = [.125, .215, .35, .446, .526, .582], Yh = 5 + Jh.length, Zh = (H(Jd = {}, rn, 0),
  23961. H(Jd, an, 1),
  23962. H(Jd, 3002, 2),
  23963. H(Jd, 3004, 3),
  23964. H(Jd, 3005, 4),
  23965. H(Jd, 3006, 5),
  23966. H(Jd, 3007, 6),
  23967. Jd), Qh = new ed, Yd = rp(), Kh = Yd._lodPlanes, $h = Yd._sizeLods, ep = Yd._sigmas, tp = new Yi, np = null, Zd = (1 + Math.sqrt(5)) / 2, Jd = 1 / Zd, ip = [new Cn(1,1,1), new Cn(-1,1,1), new Cn(1,1,-1), new Cn(-1,1,-1), new Cn(0,Zd,Jd), new Cn(0,Zd,-Jd), new Cn(Jd,0,Zd), new Cn(-Jd,0,Zd), new Cn(Zd,Jd,0), new Cn(-Zd,Jd,0)], Yd = function() {
  23968. function i(e) {
  23969. var t, n;
  23970. O(this, i),
  23971. this._renderer = e,
  23972. this._pingPongRenderTarget = null,
  23973. this._blurMaterial = (t = 20,
  23974. n = new Float32Array(t),
  23975. e = new Cn(0,1,0),
  23976. new Gu({
  23977. name: "SphericalGaussianBlur",
  23978. defines: {
  23979. n: t
  23980. },
  23981. uniforms: {
  23982. envMap: {
  23983. value: null
  23984. },
  23985. samples: {
  23986. value: 1
  23987. },
  23988. weights: {
  23989. value: n
  23990. },
  23991. latitudinal: {
  23992. value: !1
  23993. },
  23994. dTheta: {
  23995. value: 0
  23996. },
  23997. mipInt: {
  23998. value: 0
  23999. },
  24000. poleAxis: {
  24001. value: e
  24002. },
  24003. inputEncoding: {
  24004. value: Zh[rn]
  24005. },
  24006. outputEncoding: {
  24007. value: Zh[rn]
  24008. }
  24009. },
  24010. vertexShader: up(),
  24011. fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t".concat(cp(), "\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),
  24012. blending: Z,
  24013. depthTest: !1,
  24014. depthWrite: !1
  24015. })),
  24016. this._equirectShader = null,
  24017. this._cubemapShader = null,
  24018. this._compileMaterial(this._blurMaterial)
  24019. }
  24020. return h(i, [{
  24021. key: "fromScene",
  24022. value: function(e) {
  24023. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  24024. , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .1
  24025. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 100;
  24026. np = this._renderer.getRenderTarget();
  24027. var r = this._allocateTargets();
  24028. return this._sceneToCubeUV(e, n, i, r),
  24029. 0 < t && this._blur(r, 0, 0, t),
  24030. this._applyPMREM(r),
  24031. this._cleanup(r),
  24032. r
  24033. }
  24034. }, {
  24035. key: "fromEquirectangular",
  24036. value: function(e) {
  24037. return this._fromTexture(e)
  24038. }
  24039. }, {
  24040. key: "fromCubemap",
  24041. value: function(e) {
  24042. return this._fromTexture(e)
  24043. }
  24044. }, {
  24045. key: "compileCubemapShader",
  24046. value: function() {
  24047. null === this._cubemapShader && (this._cubemapShader = lp(),
  24048. this._compileMaterial(this._cubemapShader))
  24049. }
  24050. }, {
  24051. key: "compileEquirectangularShader",
  24052. value: function() {
  24053. null === this._equirectShader && (this._equirectShader = sp(),
  24054. this._compileMaterial(this._equirectShader))
  24055. }
  24056. }, {
  24057. key: "dispose",
  24058. value: function() {
  24059. this._blurMaterial.dispose(),
  24060. null !== this._cubemapShader && this._cubemapShader.dispose(),
  24061. null !== this._equirectShader && this._equirectShader.dispose();
  24062. for (var e = 0; e < Kh.length; e++)
  24063. Kh[e].dispose()
  24064. }
  24065. }, {
  24066. key: "_cleanup",
  24067. value: function(e) {
  24068. this._pingPongRenderTarget.dispose(),
  24069. this._renderer.setRenderTarget(np),
  24070. e.scissorTest = !1,
  24071. op(e, 0, 0, e.width, e.height)
  24072. }
  24073. }, {
  24074. key: "_fromTexture",
  24075. value: function(e) {
  24076. np = this._renderer.getRenderTarget();
  24077. var t = this._allocateTargets(e);
  24078. return this._textureToCubeUV(e, t),
  24079. this._applyPMREM(t),
  24080. this._cleanup(t),
  24081. t
  24082. }
  24083. }, {
  24084. key: "_allocateTargets",
  24085. value: function(e) {
  24086. var t = {
  24087. magFilter: Re,
  24088. minFilter: Re,
  24089. generateMipmaps: !1,
  24090. type: Ue,
  24091. format: it,
  24092. encoding: void 0 === (n = e) || n.type !== Ue || n.encoding !== rn && n.encoding !== an && 3007 !== n.encoding ? 3002 : e.encoding,
  24093. depthBuffer: !1
  24094. }
  24095. , n = ap(t);
  24096. return n.depthBuffer = !e,
  24097. this._pingPongRenderTarget = ap(t),
  24098. n
  24099. }
  24100. }, {
  24101. key: "_compileMaterial",
  24102. value: function(e) {
  24103. e = new Hr(Kh[0],e);
  24104. this._renderer.compile(e, Qh)
  24105. }
  24106. }, {
  24107. key: "_sceneToCubeUV",
  24108. value: function(e, t, n, i) {
  24109. var r = new $r(90,1,t,n)
  24110. , a = [1, -1, 1, 1, 1, 1]
  24111. , o = [1, 1, 1, -1, -1, -1]
  24112. , s = this._renderer
  24113. , l = s.outputEncoding
  24114. , u = s.toneMapping;
  24115. s.getClearColor(tp);
  24116. var c = s.getClearAlpha();
  24117. s.toneMapping = De,
  24118. s.outputEncoding = rn;
  24119. var t = e.background;
  24120. t && t.isColor && (t.convertSRGBToLinear(),
  24121. n = Math.max(t.r, t.g, t.b),
  24122. n = Math.min(Math.max(Math.ceil(Math.log2(n)), -128), 127),
  24123. t = t.multiplyScalar(Math.pow(2, -n)),
  24124. s.setClearColor(t, (n + 128) / 255),
  24125. e.background = null);
  24126. for (var d = 0; d < 6; d++) {
  24127. var h = d % 3;
  24128. 0 == h ? (r.up.set(0, a[d], 0),
  24129. r.lookAt(o[d], 0, 0)) : 1 == h ? (r.up.set(0, 0, a[d]),
  24130. r.lookAt(0, o[d], 0)) : (r.up.set(0, a[d], 0),
  24131. r.lookAt(0, 0, o[d])),
  24132. op(i, h * qh, 2 < d ? qh : 0, qh, qh),
  24133. s.setRenderTarget(i),
  24134. s.render(e, r)
  24135. }
  24136. s.toneMapping = u,
  24137. s.outputEncoding = l,
  24138. s.setClearColor(tp, c)
  24139. }
  24140. }, {
  24141. key: "_textureToCubeUV",
  24142. value: function(e, t) {
  24143. var n = this._renderer;
  24144. e.isCubeTexture ? null == this._cubemapShader && (this._cubemapShader = lp()) : null == this._equirectShader && (this._equirectShader = sp());
  24145. var i = e.isCubeTexture ? this._cubemapShader : this._equirectShader
  24146. , r = new Hr(Kh[0],i)
  24147. , i = i.uniforms;
  24148. (i.envMap.value = e).isCubeTexture || i.texelSize.value.set(1 / e.image.width, 1 / e.image.height),
  24149. i.inputEncoding.value = Zh[e.encoding],
  24150. i.outputEncoding.value = Zh[t.texture.encoding],
  24151. op(t, 0, 0, 3 * qh, 2 * qh),
  24152. n.setRenderTarget(t),
  24153. n.render(r, Qh)
  24154. }
  24155. }, {
  24156. key: "_applyPMREM",
  24157. value: function(e) {
  24158. var t = this._renderer
  24159. , n = t.autoClear;
  24160. t.autoClear = !1;
  24161. for (var i = 1; i < Yh; i++) {
  24162. var r = Math.sqrt(ep[i] * ep[i] - ep[i - 1] * ep[i - 1]);
  24163. this._blur(e, i - 1, i, r, ip[(i - 1) % ip.length])
  24164. }
  24165. t.autoClear = n
  24166. }
  24167. }, {
  24168. key: "_blur",
  24169. value: function(e, t, n, i, r) {
  24170. var a = this._pingPongRenderTarget;
  24171. this._halfBlur(e, a, t, n, i, "latitudinal", r),
  24172. this._halfBlur(a, e, n, n, i, "longitudinal", r)
  24173. }
  24174. }, {
  24175. key: "_halfBlur",
  24176. value: function(e, t, n, i, r, a, o) {
  24177. var s = this._renderer
  24178. , l = this._blurMaterial;
  24179. "latitudinal" !== a && "longitudinal" !== a && console.error("blur direction must be either latitudinal or longitudinal!");
  24180. var u = new Hr(Kh[i],l)
  24181. , c = l.uniforms
  24182. , l = $h[n] - 1
  24183. , l = isFinite(r) ? Math.PI / (2 * l) : 2 * Math.PI / 39
  24184. , d = r / l
  24185. , h = isFinite(r) ? 1 + Math.floor(3 * d) : 20;
  24186. 20 < h && console.warn("sigmaRadians, ".concat(r, ", is too large and will clip, as it requested ").concat(h, " samples when the maximum is set to ").concat(20));
  24187. for (var p = [], f = 0, m = 0; m < 20; ++m) {
  24188. var v = m / d
  24189. , v = Math.exp(-v * v / 2);
  24190. p.push(v),
  24191. 0 == m ? f += v : m < h && (f += 2 * v)
  24192. }
  24193. for (var g = 0; g < p.length; g++)
  24194. p[g] = p[g] / f;
  24195. c.envMap.value = e.texture,
  24196. c.samples.value = h,
  24197. c.weights.value = p,
  24198. c.latitudinal.value = "latitudinal" === a,
  24199. o && (c.poleAxis.value = o),
  24200. c.dTheta.value = l,
  24201. c.mipInt.value = 8 - n,
  24202. c.inputEncoding.value = Zh[e.texture.encoding],
  24203. c.outputEncoding.value = Zh[e.texture.encoding];
  24204. e = $h[i];
  24205. op(t, 3 * Math.max(0, qh - 2 * e), (0 === i ? 0 : 2 * qh) + 2 * e * (4 < i ? i - 8 + 4 : 0), 3 * e, 2 * e),
  24206. s.setRenderTarget(t),
  24207. s.render(u, Qh)
  24208. }
  24209. }]),
  24210. i
  24211. }();
  24212. function rp() {
  24213. for (var e = [], t = [], n = [], i = 8, r = 0; r < Yh; r++) {
  24214. var a = Math.pow(2, i);
  24215. t.push(a);
  24216. var o = 1 / a;
  24217. 4 < r ? o = Jh[r - 8 + 4 - 1] : 0 == r && (o = 0),
  24218. n.push(o);
  24219. for (var o = 1 / (a - 1), a = -o / 2, o = 1 + o / 2, s = [a, a, o, a, o, o, a, a, o, o, a, o], l = new Float32Array(108), u = new Float32Array(72), c = new Float32Array(36), d = 0; d < 6; d++) {
  24220. var h = d % 3 * 2 / 3 - 1
  24221. , p = 2 < d ? 0 : -1;
  24222. l.set([h, p, 0, h + 2 / 3, p, 0, h + 2 / 3, 1 + p, 0, h, p, 0, h + 2 / 3, 1 + p, 0, h, 1 + p, 0], 18 * d),
  24223. u.set(s, 12 * d),
  24224. c.set([d, d, d, d, d, d], 6 * d)
  24225. }
  24226. o = new Mr;
  24227. o.setAttribute("position", new nr(l,3)),
  24228. o.setAttribute("uv", new nr(u,2)),
  24229. o.setAttribute("faceIndex", new nr(c,1)),
  24230. e.push(o),
  24231. 4 < i && i--
  24232. }
  24233. return {
  24234. _lodPlanes: e,
  24235. _sizeLods: t,
  24236. _sigmas: n
  24237. }
  24238. }
  24239. function ap(e) {
  24240. e = new An(3 * qh,3 * qh,e);
  24241. return e.texture.mapping = z,
  24242. e.texture.name = "PMREM.cubeUv",
  24243. e.scissorTest = !0,
  24244. e
  24245. }
  24246. function op(e, t, n, i, r) {
  24247. e.viewport.set(t, n, i, r),
  24248. e.scissor.set(t, n, i, r)
  24249. }
  24250. function sp() {
  24251. return new Gu({
  24252. name: "EquirectangularToCubeUV",
  24253. uniforms: {
  24254. envMap: {
  24255. value: null
  24256. },
  24257. texelSize: {
  24258. value: new yn(1,1)
  24259. },
  24260. inputEncoding: {
  24261. value: Zh[rn]
  24262. },
  24263. outputEncoding: {
  24264. value: Zh[rn]
  24265. }
  24266. },
  24267. vertexShader: up(),
  24268. fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t".concat(cp(), "\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),
  24269. blending: Z,
  24270. depthTest: !1,
  24271. depthWrite: !1
  24272. })
  24273. }
  24274. function lp() {
  24275. return new Gu({
  24276. name: "CubemapToCubeUV",
  24277. uniforms: {
  24278. envMap: {
  24279. value: null
  24280. },
  24281. inputEncoding: {
  24282. value: Zh[rn]
  24283. },
  24284. outputEncoding: {
  24285. value: Zh[rn]
  24286. }
  24287. },
  24288. vertexShader: up(),
  24289. fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t".concat(cp(), "\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),
  24290. blending: Z,
  24291. depthTest: !1,
  24292. depthWrite: !1
  24293. })
  24294. }
  24295. function up() {
  24296. return "\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"
  24297. }
  24298. function cp() {
  24299. return "\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"
  24300. }
  24301. function dp(e, t) {
  24302. return console.warn("THREE.PointCloud has been renamed to THREE.Points."),
  24303. new gl(e,t)
  24304. }
  24305. function hp(e) {
  24306. console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),
  24307. Bc.call(this, e),
  24308. this.type = "catmullrom",
  24309. this.closed = !0
  24310. }
  24311. function pp(e) {
  24312. console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),
  24313. Bc.call(this, e),
  24314. this.type = "catmullrom"
  24315. }
  24316. function fp(e) {
  24317. console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),
  24318. Bc.call(this, e),
  24319. this.type = "catmullrom"
  24320. }
  24321. Mc.create = function(e, t) {
  24322. return console.log("THREE.Curve.create() has been deprecated"),
  24323. e.prototype = Object.create(Mc.prototype),
  24324. (e.prototype.constructor = e).prototype.getPoint = t,
  24325. e
  24326. }
  24327. ,
  24328. Object.assign(jc.prototype, {
  24329. createPointsGeometry: function(e) {
  24330. console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
  24331. e = this.getPoints(e);
  24332. return this.createGeometry(e)
  24333. },
  24334. createSpacedPointsGeometry: function(e) {
  24335. console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
  24336. e = this.getSpacedPoints(e);
  24337. return this.createGeometry(e)
  24338. },
  24339. createGeometry: function(e) {
  24340. console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
  24341. for (var t = new Sl, n = 0, i = e.length; n < i; n++) {
  24342. var r = e[n];
  24343. t.vertices.push(new Cn(r.x,r.y,r.z || 0))
  24344. }
  24345. return t
  24346. }
  24347. }),
  24348. Object.assign(Wc.prototype, {
  24349. fromPoints: function(e) {
  24350. return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),
  24351. this.setFromPoints(e)
  24352. }
  24353. }),
  24354. hp.prototype = Object.create(Bc.prototype),
  24355. pp.prototype = Object.create(Bc.prototype),
  24356. fp.prototype = Object.create(Bc.prototype),
  24357. Object.assign(fp.prototype, {
  24358. initFromArray: function() {
  24359. console.error("THREE.Spline: .initFromArray() has been removed.")
  24360. },
  24361. getControlPointsArray: function() {
  24362. console.error("THREE.Spline: .getControlPointsArray() has been removed.")
  24363. },
  24364. reparametrizeByArcLength: function() {
  24365. console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")
  24366. }
  24367. }),
  24368. Ph.prototype.setColors = function() {
  24369. console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")
  24370. }
  24371. ,
  24372. _h.prototype.update = function() {
  24373. console.error("THREE.SkeletonHelper: update() no longer needs to be called.")
  24374. }
  24375. ,
  24376. Object.assign(mc.prototype, {
  24377. extractUrlBase: function(e) {
  24378. return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),
  24379. ld.extractUrlBase(e)
  24380. }
  24381. }),
  24382. mc.Handlers = {
  24383. add: function() {
  24384. console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")
  24385. },
  24386. get: function() {
  24387. console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")
  24388. }
  24389. },
  24390. Object.assign(ph.prototype, {
  24391. center: function(e) {
  24392. return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),
  24393. this.getCenter(e)
  24394. },
  24395. empty: function() {
  24396. return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),
  24397. this.isEmpty()
  24398. },
  24399. isIntersectionBox: function(e) {
  24400. return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),
  24401. this.intersectsBox(e)
  24402. },
  24403. size: function(e) {
  24404. return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),
  24405. this.getSize(e)
  24406. }
  24407. }),
  24408. Object.assign(kn.prototype, {
  24409. center: function(e) {
  24410. return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),
  24411. this.getCenter(e)
  24412. },
  24413. empty: function() {
  24414. return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),
  24415. this.isEmpty()
  24416. },
  24417. isIntersectionBox: function(e) {
  24418. return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),
  24419. this.intersectsBox(e)
  24420. },
  24421. isIntersectionSphere: function(e) {
  24422. return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),
  24423. this.intersectsSphere(e)
  24424. },
  24425. size: function(e) {
  24426. return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),
  24427. this.getSize(e)
  24428. }
  24429. }),
  24430. Object.assign(qn.prototype, {
  24431. empty: function() {
  24432. return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),
  24433. this.isEmpty()
  24434. }
  24435. }),
  24436. oa.prototype.setFromMatrix = function(e) {
  24437. return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),
  24438. this.setFromProjectionMatrix(e)
  24439. }
  24440. ,
  24441. vh.prototype.center = function(e) {
  24442. return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),
  24443. this.getCenter(e)
  24444. }
  24445. ,
  24446. Object.assign(gn, {
  24447. random16: function() {
  24448. return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),
  24449. Math.random()
  24450. },
  24451. nearestPowerOfTwo: function(e) {
  24452. return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),
  24453. gn.floorPowerOfTwo(e)
  24454. },
  24455. nextPowerOfTwo: function(e) {
  24456. return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),
  24457. gn.ceilPowerOfTwo(e)
  24458. }
  24459. }),
  24460. Object.assign(wn.prototype, {
  24461. flattenToArrayOffset: function(e, t) {
  24462. return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),
  24463. this.toArray(e, t)
  24464. },
  24465. multiplyVector3: function(e) {
  24466. return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),
  24467. e.applyMatrix3(this)
  24468. },
  24469. multiplyVector3Array: function() {
  24470. console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")
  24471. },
  24472. applyToBufferAttribute: function(e) {
  24473. return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),
  24474. e.applyMatrix3(this)
  24475. },
  24476. applyToVector3Array: function() {
  24477. console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")
  24478. },
  24479. getInverse: function(e) {
  24480. return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),
  24481. this.copy(e).invert()
  24482. }
  24483. }),
  24484. Object.assign(ni.prototype, {
  24485. extractPosition: function(e) {
  24486. return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),
  24487. this.copyPosition(e)
  24488. },
  24489. flattenToArrayOffset: function(e, t) {
  24490. return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),
  24491. this.toArray(e, t)
  24492. },
  24493. getPosition: function() {
  24494. return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),
  24495. (new Cn).setFromMatrixColumn(this, 3)
  24496. },
  24497. setRotationFromQuaternion: function(e) {
  24498. return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),
  24499. this.makeRotationFromQuaternion(e)
  24500. },
  24501. multiplyToArray: function() {
  24502. console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")
  24503. },
  24504. multiplyVector3: function(e) {
  24505. return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),
  24506. e.applyMatrix4(this)
  24507. },
  24508. multiplyVector4: function(e) {
  24509. return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),
  24510. e.applyMatrix4(this)
  24511. },
  24512. multiplyVector3Array: function() {
  24513. console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")
  24514. },
  24515. rotateAxis: function(e) {
  24516. console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),
  24517. e.transformDirection(this)
  24518. },
  24519. crossVector: function(e) {
  24520. return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),
  24521. e.applyMatrix4(this)
  24522. },
  24523. translate: function() {
  24524. console.error("THREE.Matrix4: .translate() has been removed.")
  24525. },
  24526. rotateX: function() {
  24527. console.error("THREE.Matrix4: .rotateX() has been removed.")
  24528. },
  24529. rotateY: function() {
  24530. console.error("THREE.Matrix4: .rotateY() has been removed.")
  24531. },
  24532. rotateZ: function() {
  24533. console.error("THREE.Matrix4: .rotateZ() has been removed.")
  24534. },
  24535. rotateByAxis: function() {
  24536. console.error("THREE.Matrix4: .rotateByAxis() has been removed.")
  24537. },
  24538. applyToBufferAttribute: function(e) {
  24539. return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),
  24540. e.applyMatrix4(this)
  24541. },
  24542. applyToVector3Array: function() {
  24543. console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")
  24544. },
  24545. makeFrustum: function(e, t, n, i, r, a) {
  24546. return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),
  24547. this.makePerspective(e, t, i, n, r, a)
  24548. },
  24549. getInverse: function(e) {
  24550. return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),
  24551. this.copy(e).invert()
  24552. }
  24553. }),
  24554. ki.prototype.isIntersectionLine = function(e) {
  24555. return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),
  24556. this.intersectsLine(e)
  24557. }
  24558. ,
  24559. Object.assign(Sn.prototype, {
  24560. multiplyVector3: function(e) {
  24561. return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),
  24562. e.applyQuaternion(this)
  24563. },
  24564. inverse: function() {
  24565. return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),
  24566. this.invert()
  24567. }
  24568. }),
  24569. Object.assign(ti.prototype, {
  24570. isIntersectionBox: function(e) {
  24571. return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),
  24572. this.intersectsBox(e)
  24573. },
  24574. isIntersectionPlane: function(e) {
  24575. return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),
  24576. this.intersectsPlane(e)
  24577. },
  24578. isIntersectionSphere: function(e) {
  24579. return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),
  24580. this.intersectsSphere(e)
  24581. }
  24582. }),
  24583. Object.assign(Hi.prototype, {
  24584. area: function() {
  24585. return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),
  24586. this.getArea()
  24587. },
  24588. barycoordFromPoint: function(e, t) {
  24589. return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),
  24590. this.getBarycoord(e, t)
  24591. },
  24592. midpoint: function(e) {
  24593. return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),
  24594. this.getMidpoint(e)
  24595. },
  24596. normal: function(e) {
  24597. return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),
  24598. this.getNormal(e)
  24599. },
  24600. plane: function(e) {
  24601. return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),
  24602. this.getPlane(e)
  24603. }
  24604. }),
  24605. Object.assign(Hi, {
  24606. barycoordFromPoint: function(e, t, n, i, r) {
  24607. return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),
  24608. Hi.getBarycoord(e, t, n, i, r)
  24609. },
  24610. normal: function(e, t, n, i) {
  24611. return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),
  24612. Hi.getNormal(e, t, n, i)
  24613. }
  24614. }),
  24615. Object.assign(Xc.prototype, {
  24616. extractAllPoints: function(e) {
  24617. return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),
  24618. this.extractPoints(e)
  24619. },
  24620. extrude: function(e) {
  24621. return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),
  24622. new du(this,e)
  24623. },
  24624. makeGeometry: function(e) {
  24625. return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),
  24626. new Au(this,e)
  24627. }
  24628. }),
  24629. Object.assign(yn.prototype, {
  24630. fromAttribute: function(e, t, n) {
  24631. return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),
  24632. this.fromBufferAttribute(e, t, n)
  24633. },
  24634. distanceToManhattan: function(e) {
  24635. return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),
  24636. this.manhattanDistanceTo(e)
  24637. },
  24638. lengthManhattan: function() {
  24639. return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),
  24640. this.manhattanLength()
  24641. }
  24642. }),
  24643. Object.assign(Cn.prototype, {
  24644. setEulerFromRotationMatrix: function() {
  24645. console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")
  24646. },
  24647. setEulerFromQuaternion: function() {
  24648. console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")
  24649. },
  24650. getPositionFromMatrix: function(e) {
  24651. return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),
  24652. this.setFromMatrixPosition(e)
  24653. },
  24654. getScaleFromMatrix: function(e) {
  24655. return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),
  24656. this.setFromMatrixScale(e)
  24657. },
  24658. getColumnFromMatrix: function(e, t) {
  24659. return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),
  24660. this.setFromMatrixColumn(t, e)
  24661. },
  24662. applyProjection: function(e) {
  24663. return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),
  24664. this.applyMatrix4(e)
  24665. },
  24666. fromAttribute: function(e, t, n) {
  24667. return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),
  24668. this.fromBufferAttribute(e, t, n)
  24669. },
  24670. distanceToManhattan: function(e) {
  24671. return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),
  24672. this.manhattanDistanceTo(e)
  24673. },
  24674. lengthManhattan: function() {
  24675. return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),
  24676. this.manhattanLength()
  24677. }
  24678. }),
  24679. Object.assign(Mn.prototype, {
  24680. fromAttribute: function(e, t, n) {
  24681. return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),
  24682. this.fromBufferAttribute(e, t, n)
  24683. },
  24684. lengthManhattan: function() {
  24685. return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),
  24686. this.manhattanLength()
  24687. }
  24688. }),
  24689. Object.assign(Sl.prototype, {
  24690. computeTangents: function() {
  24691. console.error("THREE.Geometry: .computeTangents() has been removed.")
  24692. },
  24693. computeLineDistances: function() {
  24694. console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")
  24695. },
  24696. applyMatrix: function(e) {
  24697. return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),
  24698. this.applyMatrix4(e)
  24699. }
  24700. }),
  24701. Object.assign(Si.prototype, {
  24702. getChildByName: function(e) {
  24703. return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),
  24704. this.getObjectByName(e)
  24705. },
  24706. renderDepth: function() {
  24707. console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")
  24708. },
  24709. translate: function(e, t) {
  24710. return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),
  24711. this.translateOnAxis(t, e)
  24712. },
  24713. getWorldRotation: function() {
  24714. console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")
  24715. },
  24716. applyMatrix: function(e) {
  24717. return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),
  24718. this.applyMatrix4(e)
  24719. }
  24720. }),
  24721. Object.defineProperties(Si.prototype, {
  24722. eulerOrder: {
  24723. get: function() {
  24724. return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),
  24725. this.rotation.order
  24726. },
  24727. set: function(e) {
  24728. console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),
  24729. this.rotation.order = e
  24730. }
  24731. },
  24732. useQuaternion: {
  24733. get: function() {
  24734. console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")
  24735. },
  24736. set: function() {
  24737. console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")
  24738. }
  24739. }
  24740. }),
  24741. Object.assign(Hr.prototype, {
  24742. setDrawMode: function() {
  24743. console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")
  24744. }
  24745. }),
  24746. Object.defineProperties(Hr.prototype, {
  24747. drawMode: {
  24748. get: function() {
  24749. return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),
  24750. 0
  24751. },
  24752. set: function() {
  24753. console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")
  24754. }
  24755. }
  24756. }),
  24757. Object.defineProperties(Ns.prototype, {
  24758. objects: {
  24759. get: function() {
  24760. return console.warn("THREE.LOD: .objects has been renamed to .levels."),
  24761. this.levels
  24762. }
  24763. }
  24764. }),
  24765. Object.defineProperty(Ys.prototype, "useVertexTexture", {
  24766. get: function() {
  24767. console.warn("THREE.Skeleton: useVertexTexture has been removed.")
  24768. },
  24769. set: function() {
  24770. console.warn("THREE.Skeleton: useVertexTexture has been removed.")
  24771. }
  24772. }),
  24773. Ws.prototype.initBones = function() {
  24774. console.error("THREE.SkinnedMesh: initBones() has been removed.")
  24775. }
  24776. ,
  24777. Object.defineProperty(Mc.prototype, "__arcLengthDivisions", {
  24778. get: function() {
  24779. return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),
  24780. this.arcLengthDivisions
  24781. },
  24782. set: function(e) {
  24783. console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),
  24784. this.arcLengthDivisions = e
  24785. }
  24786. }),
  24787. $r.prototype.setLens = function(e, t) {
  24788. console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),
  24789. void 0 !== t && (this.filmGauge = t),
  24790. this.setFocalLength(e)
  24791. }
  24792. ,
  24793. Object.defineProperties(qc.prototype, {
  24794. onlyShadow: {
  24795. set: function() {
  24796. console.warn("THREE.Light: .onlyShadow has been removed.")
  24797. }
  24798. },
  24799. shadowCameraFov: {
  24800. set: function(e) {
  24801. console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),
  24802. this.shadow.camera.fov = e
  24803. }
  24804. },
  24805. shadowCameraLeft: {
  24806. set: function(e) {
  24807. console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),
  24808. this.shadow.camera.left = e
  24809. }
  24810. },
  24811. shadowCameraRight: {
  24812. set: function(e) {
  24813. console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),
  24814. this.shadow.camera.right = e
  24815. }
  24816. },
  24817. shadowCameraTop: {
  24818. set: function(e) {
  24819. console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),
  24820. this.shadow.camera.top = e
  24821. }
  24822. },
  24823. shadowCameraBottom: {
  24824. set: function(e) {
  24825. console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),
  24826. this.shadow.camera.bottom = e
  24827. }
  24828. },
  24829. shadowCameraNear: {
  24830. set: function(e) {
  24831. console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),
  24832. this.shadow.camera.near = e
  24833. }
  24834. },
  24835. shadowCameraFar: {
  24836. set: function(e) {
  24837. console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),
  24838. this.shadow.camera.far = e
  24839. }
  24840. },
  24841. shadowCameraVisible: {
  24842. set: function() {
  24843. console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")
  24844. }
  24845. },
  24846. shadowBias: {
  24847. set: function(e) {
  24848. console.warn("THREE.Light: .shadowBias is now .shadow.bias."),
  24849. this.shadow.bias = e
  24850. }
  24851. },
  24852. shadowDarkness: {
  24853. set: function() {
  24854. console.warn("THREE.Light: .shadowDarkness has been removed.")
  24855. }
  24856. },
  24857. shadowMapWidth: {
  24858. set: function(e) {
  24859. console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),
  24860. this.shadow.mapSize.width = e
  24861. }
  24862. },
  24863. shadowMapHeight: {
  24864. set: function(e) {
  24865. console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),
  24866. this.shadow.mapSize.height = e
  24867. }
  24868. }
  24869. }),
  24870. Object.defineProperties(nr.prototype, {
  24871. length: {
  24872. get: function() {
  24873. return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),
  24874. this.array.length
  24875. }
  24876. },
  24877. dynamic: {
  24878. get: function() {
  24879. return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),
  24880. this.usage === cn
  24881. },
  24882. set: function() {
  24883. console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),
  24884. this.setUsage(cn)
  24885. }
  24886. }
  24887. }),
  24888. Object.assign(nr.prototype, {
  24889. setDynamic: function(e) {
  24890. return this.setUsage(!0 === e ? cn : un),
  24891. this
  24892. },
  24893. copyIndicesArray: function() {
  24894. console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")
  24895. },
  24896. setArray: function() {
  24897. console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")
  24898. }
  24899. }),
  24900. Object.assign(Mr.prototype, {
  24901. addIndex: function(e) {
  24902. console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),
  24903. this.setIndex(e)
  24904. },
  24905. addAttribute: function(e, t) {
  24906. return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),
  24907. t && t.isBufferAttribute || t && t.isInterleavedBufferAttribute ? "index" === e ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),
  24908. this.setIndex(t),
  24909. this) : this.setAttribute(e, t) : (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),
  24910. this.setAttribute(e, new nr(t,arguments[2])))
  24911. },
  24912. addDrawCall: function(e, t, n) {
  24913. void 0 !== n && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),
  24914. console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),
  24915. this.addGroup(e, t)
  24916. },
  24917. clearDrawCalls: function() {
  24918. console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),
  24919. this.clearGroups()
  24920. },
  24921. computeTangents: function() {
  24922. console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")
  24923. },
  24924. computeOffsets: function() {
  24925. console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")
  24926. },
  24927. removeAttribute: function(e) {
  24928. return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),
  24929. this.deleteAttribute(e)
  24930. },
  24931. applyMatrix: function(e) {
  24932. return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),
  24933. this.applyMatrix4(e)
  24934. }
  24935. }),
  24936. Object.defineProperties(Mr.prototype, {
  24937. drawcalls: {
  24938. get: function() {
  24939. return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),
  24940. this.groups
  24941. }
  24942. },
  24943. offsets: {
  24944. get: function() {
  24945. return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),
  24946. this.groups
  24947. }
  24948. }
  24949. }),
  24950. Object.defineProperties(ud.prototype, {
  24951. maxInstancedCount: {
  24952. get: function() {
  24953. return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),
  24954. this.instanceCount
  24955. },
  24956. set: function(e) {
  24957. console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),
  24958. this.instanceCount = e
  24959. }
  24960. }
  24961. }),
  24962. Object.defineProperties(sh.prototype, {
  24963. linePrecision: {
  24964. get: function() {
  24965. return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),
  24966. this.params.Line.threshold
  24967. },
  24968. set: function(e) {
  24969. console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),
  24970. this.params.Line.threshold = e
  24971. }
  24972. }
  24973. }),
  24974. Object.defineProperties(ys.prototype, {
  24975. dynamic: {
  24976. get: function() {
  24977. return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),
  24978. this.usage === cn
  24979. },
  24980. set: function(e) {
  24981. console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),
  24982. this.setUsage(e)
  24983. }
  24984. }
  24985. }),
  24986. Object.assign(ys.prototype, {
  24987. setDynamic: function(e) {
  24988. return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),
  24989. this.setUsage(!0 === e ? cn : un),
  24990. this
  24991. },
  24992. setArray: function() {
  24993. console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")
  24994. }
  24995. }),
  24996. Object.assign(uu.prototype, {
  24997. getArrays: function() {
  24998. console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")
  24999. },
  25000. addShapeList: function() {
  25001. console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")
  25002. },
  25003. addShape: function() {
  25004. console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")
  25005. }
  25006. }),
  25007. Object.assign(gs.prototype, {
  25008. dispose: function() {
  25009. console.error("THREE.Scene: .dispose() has been removed.")
  25010. }
  25011. }),
  25012. Object.defineProperties(rh.prototype, {
  25013. dynamic: {
  25014. set: function() {
  25015. console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")
  25016. }
  25017. },
  25018. onUpdate: {
  25019. value: function() {
  25020. return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),
  25021. this
  25022. }
  25023. }
  25024. }),
  25025. Object.defineProperties(Ki.prototype, {
  25026. wrapAround: {
  25027. get: function() {
  25028. console.warn("THREE.Material: .wrapAround has been removed.")
  25029. },
  25030. set: function() {
  25031. console.warn("THREE.Material: .wrapAround has been removed.")
  25032. }
  25033. },
  25034. overdraw: {
  25035. get: function() {
  25036. console.warn("THREE.Material: .overdraw has been removed.")
  25037. },
  25038. set: function() {
  25039. console.warn("THREE.Material: .overdraw has been removed.")
  25040. }
  25041. },
  25042. wrapRGB: {
  25043. get: function() {
  25044. return console.warn("THREE.Material: .wrapRGB has been removed."),
  25045. new Yi
  25046. }
  25047. },
  25048. shading: {
  25049. get: function() {
  25050. console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead.")
  25051. },
  25052. set: function(e) {
  25053. console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."),
  25054. this.flatShading = 1 === e
  25055. }
  25056. },
  25057. stencilMask: {
  25058. get: function() {
  25059. return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."),
  25060. this.stencilFuncMask
  25061. },
  25062. set: function(e) {
  25063. console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."),
  25064. this.stencilFuncMask = e
  25065. }
  25066. }
  25067. }),
  25068. Object.defineProperties(ju.prototype, {
  25069. metal: {
  25070. get: function() {
  25071. return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),
  25072. !1
  25073. },
  25074. set: function() {
  25075. console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")
  25076. }
  25077. }
  25078. }),
  25079. Object.defineProperties(Vu.prototype, {
  25080. transparency: {
  25081. get: function() {
  25082. return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),
  25083. this.transmission
  25084. },
  25085. set: function(e) {
  25086. console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),
  25087. this.transmission = e
  25088. }
  25089. }
  25090. }),
  25091. Object.defineProperties(Qr.prototype, {
  25092. derivatives: {
  25093. get: function() {
  25094. return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),
  25095. this.extensions.derivatives
  25096. },
  25097. set: function(e) {
  25098. console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),
  25099. this.extensions.derivatives = e
  25100. }
  25101. }
  25102. }),
  25103. Object.assign(ps.prototype, {
  25104. clearTarget: function(e, t, n, i) {
  25105. console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),
  25106. this.setRenderTarget(e),
  25107. this.clear(t, n, i)
  25108. },
  25109. animate: function(e) {
  25110. console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),
  25111. this.setAnimationLoop(e)
  25112. },
  25113. getCurrentRenderTarget: function() {
  25114. return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),
  25115. this.getRenderTarget()
  25116. },
  25117. getMaxAnisotropy: function() {
  25118. return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),
  25119. this.capabilities.getMaxAnisotropy()
  25120. },
  25121. getPrecision: function() {
  25122. return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),
  25123. this.capabilities.precision
  25124. },
  25125. resetGLState: function() {
  25126. return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),
  25127. this.state.reset()
  25128. },
  25129. supportsFloatTextures: function() {
  25130. return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),
  25131. this.extensions.get("OES_texture_float")
  25132. },
  25133. supportsHalfFloatTextures: function() {
  25134. return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),
  25135. this.extensions.get("OES_texture_half_float")
  25136. },
  25137. supportsStandardDerivatives: function() {
  25138. return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),
  25139. this.extensions.get("OES_standard_derivatives")
  25140. },
  25141. supportsCompressedTextureS3TC: function() {
  25142. return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),
  25143. this.extensions.get("WEBGL_compressed_texture_s3tc")
  25144. },
  25145. supportsCompressedTexturePVRTC: function() {
  25146. return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),
  25147. this.extensions.get("WEBGL_compressed_texture_pvrtc")
  25148. },
  25149. supportsBlendMinMax: function() {
  25150. return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),
  25151. this.extensions.get("EXT_blend_minmax")
  25152. },
  25153. supportsVertexTextures: function() {
  25154. return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),
  25155. this.capabilities.vertexTextures
  25156. },
  25157. supportsInstancedArrays: function() {
  25158. return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),
  25159. this.extensions.get("ANGLE_instanced_arrays")
  25160. },
  25161. enableScissorTest: function(e) {
  25162. console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),
  25163. this.setScissorTest(e)
  25164. },
  25165. initMaterial: function() {
  25166. console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")
  25167. },
  25168. addPrePlugin: function() {
  25169. console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")
  25170. },
  25171. addPostPlugin: function() {
  25172. console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")
  25173. },
  25174. updateShadowMap: function() {
  25175. console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")
  25176. },
  25177. setFaceCulling: function() {
  25178. console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")
  25179. },
  25180. allocTextureUnit: function() {
  25181. console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")
  25182. },
  25183. setTexture: function() {
  25184. console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")
  25185. },
  25186. setTexture2D: function() {
  25187. console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")
  25188. },
  25189. setTextureCube: function() {
  25190. console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")
  25191. },
  25192. getActiveMipMapLevel: function() {
  25193. return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),
  25194. this.getActiveMipmapLevel()
  25195. }
  25196. }),
  25197. Object.defineProperties(ps.prototype, {
  25198. shadowMapEnabled: {
  25199. get: function() {
  25200. return this.shadowMap.enabled
  25201. },
  25202. set: function(e) {
  25203. console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),
  25204. this.shadowMap.enabled = e
  25205. }
  25206. },
  25207. shadowMapType: {
  25208. get: function() {
  25209. return this.shadowMap.type
  25210. },
  25211. set: function(e) {
  25212. console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),
  25213. this.shadowMap.type = e
  25214. }
  25215. },
  25216. shadowMapCullFace: {
  25217. get: function() {
  25218. console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")
  25219. },
  25220. set: function() {
  25221. console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")
  25222. }
  25223. },
  25224. context: {
  25225. get: function() {
  25226. return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),
  25227. this.getContext()
  25228. }
  25229. },
  25230. vr: {
  25231. get: function() {
  25232. return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),
  25233. this.xr
  25234. }
  25235. },
  25236. gammaInput: {
  25237. get: function() {
  25238. return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),
  25239. !1
  25240. },
  25241. set: function() {
  25242. console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")
  25243. }
  25244. },
  25245. gammaOutput: {
  25246. get: function() {
  25247. return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),
  25248. !1
  25249. },
  25250. set: function(e) {
  25251. console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),
  25252. this.outputEncoding = !0 === e ? an : rn
  25253. }
  25254. },
  25255. toneMappingWhitePoint: {
  25256. get: function() {
  25257. return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),
  25258. 1
  25259. },
  25260. set: function() {
  25261. console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")
  25262. }
  25263. }
  25264. }),
  25265. Object.defineProperties(rs.prototype, {
  25266. cullFace: {
  25267. get: function() {
  25268. console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")
  25269. },
  25270. set: function() {
  25271. console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")
  25272. }
  25273. },
  25274. renderReverseSided: {
  25275. get: function() {
  25276. console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")
  25277. },
  25278. set: function() {
  25279. console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")
  25280. }
  25281. },
  25282. renderSingleSided: {
  25283. get: function() {
  25284. console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")
  25285. },
  25286. set: function() {
  25287. console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")
  25288. }
  25289. }
  25290. }),
  25291. Object.defineProperties(An.prototype, {
  25292. wrapS: {
  25293. get: function() {
  25294. return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),
  25295. this.texture.wrapS
  25296. },
  25297. set: function(e) {
  25298. console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),
  25299. this.texture.wrapS = e
  25300. }
  25301. },
  25302. wrapT: {
  25303. get: function() {
  25304. return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),
  25305. this.texture.wrapT
  25306. },
  25307. set: function(e) {
  25308. console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),
  25309. this.texture.wrapT = e
  25310. }
  25311. },
  25312. magFilter: {
  25313. get: function() {
  25314. return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),
  25315. this.texture.magFilter
  25316. },
  25317. set: function(e) {
  25318. console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),
  25319. this.texture.magFilter = e
  25320. }
  25321. },
  25322. minFilter: {
  25323. get: function() {
  25324. return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),
  25325. this.texture.minFilter
  25326. },
  25327. set: function(e) {
  25328. console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),
  25329. this.texture.minFilter = e
  25330. }
  25331. },
  25332. anisotropy: {
  25333. get: function() {
  25334. return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),
  25335. this.texture.anisotropy
  25336. },
  25337. set: function(e) {
  25338. console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),
  25339. this.texture.anisotropy = e
  25340. }
  25341. },
  25342. offset: {
  25343. get: function() {
  25344. return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),
  25345. this.texture.offset
  25346. },
  25347. set: function(e) {
  25348. console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),
  25349. this.texture.offset = e
  25350. }
  25351. },
  25352. repeat: {
  25353. get: function() {
  25354. return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),
  25355. this.texture.repeat
  25356. },
  25357. set: function(e) {
  25358. console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),
  25359. this.texture.repeat = e
  25360. }
  25361. },
  25362. format: {
  25363. get: function() {
  25364. return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),
  25365. this.texture.format
  25366. },
  25367. set: function(e) {
  25368. console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),
  25369. this.texture.format = e
  25370. }
  25371. },
  25372. type: {
  25373. get: function() {
  25374. return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),
  25375. this.texture.type
  25376. },
  25377. set: function(e) {
  25378. console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),
  25379. this.texture.type = e
  25380. }
  25381. },
  25382. generateMipmaps: {
  25383. get: function() {
  25384. return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),
  25385. this.texture.generateMipmaps
  25386. },
  25387. set: function(e) {
  25388. console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),
  25389. this.texture.generateMipmaps = e
  25390. }
  25391. }
  25392. }),
  25393. Object.defineProperties(Fd.prototype, {
  25394. load: {
  25395. value: function(e) {
  25396. console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");
  25397. var t = this;
  25398. return (new Ed).load(e, function(e) {
  25399. t.setBuffer(e)
  25400. }),
  25401. this
  25402. }
  25403. },
  25404. startTime: {
  25405. set: function() {
  25406. console.warn("THREE.Audio: .startTime is now .play( delay ).")
  25407. }
  25408. }
  25409. }),
  25410. Gd.prototype.getData = function() {
  25411. return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),
  25412. this.getFrequencyData()
  25413. }
  25414. ,
  25415. ea.prototype.updateCubeMap = function(e, t) {
  25416. return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),
  25417. this.update(e, t)
  25418. }
  25419. ,
  25420. ea.prototype.clear = function(e, t, n, i) {
  25421. return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),
  25422. this.renderTarget.clear(e, t, n, i)
  25423. }
  25424. ;
  25425. Zd = {
  25426. merge: function(e, t, n) {
  25427. var i;
  25428. console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),
  25429. t.isMesh && (t.matrixAutoUpdate && t.updateMatrix(),
  25430. i = t.matrix,
  25431. t = t.geometry),
  25432. e.merge(t, i, n)
  25433. },
  25434. center: function(e) {
  25435. return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),
  25436. e.center()
  25437. }
  25438. };
  25439. bn.crossOrigin = void 0,
  25440. bn.loadTexture = function(e, t, n, i) {
  25441. console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");
  25442. var r = new _c;
  25443. r.setCrossOrigin(this.crossOrigin);
  25444. i = r.load(e, n, void 0, i);
  25445. return t && (i.mapping = t),
  25446. i
  25447. }
  25448. ,
  25449. bn.loadTextureCube = function(e, t, n, i) {
  25450. console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
  25451. var r = new xc;
  25452. r.setCrossOrigin(this.crossOrigin);
  25453. i = r.load(e, n, void 0, i);
  25454. return t && (i.mapping = t),
  25455. i
  25456. }
  25457. ,
  25458. bn.loadCompressedTexture = function() {
  25459. console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")
  25460. }
  25461. ,
  25462. bn.loadCompressedTextureCube = function() {
  25463. console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")
  25464. }
  25465. ;
  25466. Jd = {
  25467. createMultiMaterialObject: function() {
  25468. console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
  25469. },
  25470. detach: function() {
  25471. console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
  25472. },
  25473. attach: function() {
  25474. console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
  25475. }
  25476. };
  25477. "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{
  25478. detail: {
  25479. revision: "124"
  25480. }
  25481. }));
  25482. var mp = Object.freeze({
  25483. __proto__: null,
  25484. ACESFilmicToneMapping: 4,
  25485. AddEquation: re,
  25486. AddOperation: 2,
  25487. AdditiveAnimationBlendMode: 2501,
  25488. AdditiveBlending: ee,
  25489. AlphaFormat: Ke,
  25490. AlwaysDepth: _e,
  25491. AlwaysStencilFunc: 519,
  25492. AmbientLight: id,
  25493. AmbientLightProbe: Md,
  25494. AnimationClip: cc,
  25495. AnimationLoader: yc,
  25496. AnimationMixer: ih,
  25497. AnimationObjectGroup: th,
  25498. AnimationUtils: Qu,
  25499. ArcCurve: Tc,
  25500. ArrayCamera: ls,
  25501. ArrowHelper: Wd,
  25502. Audio: Fd,
  25503. AudioAnalyser: Gd,
  25504. AudioContext: xd,
  25505. AudioListener: Rd,
  25506. AudioLoader: Ed,
  25507. AxesHelper: jh,
  25508. AxisHelper: function(e) {
  25509. return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),
  25510. new jh(e)
  25511. },
  25512. BackSide: J,
  25513. BasicDepthPacking: 3200,
  25514. BasicShadowMap: 0,
  25515. BinaryTextureLoader: function(e) {
  25516. return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),
  25517. new Ec(e)
  25518. },
  25519. Bone: Xs,
  25520. BooleanKeyframeTrack: ic,
  25521. BoundingBoxHelper: function(e, t) {
  25522. return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),
  25523. new Gh(e,t)
  25524. },
  25525. Box2: ph,
  25526. Box3: kn,
  25527. Box3Helper: Xd,
  25528. BoxBufferGeometry: Wr,
  25529. BoxGeometry: Cl,
  25530. BoxHelper: Gh,
  25531. BufferAttribute: nr,
  25532. BufferGeometry: Mr,
  25533. BufferGeometryLoader: dd,
  25534. ByteType: Ge,
  25535. Cache: hc,
  25536. Camera: Kr,
  25537. CameraHelper: Vd,
  25538. CanvasRenderer: function() {
  25539. console.error("THREE.CanvasRenderer has been removed")
  25540. },
  25541. CanvasTexture: xl,
  25542. CatmullRomCurve3: Bc,
  25543. CineonToneMapping: 3,
  25544. CircleBufferGeometry: Pl,
  25545. CircleGeometry: Dl,
  25546. ClampToEdgeWrapping: Be,
  25547. Clock: Cd,
  25548. ClosedSplineCurve3: hp,
  25549. Color: Yi,
  25550. ColorKeyframeTrack: rc,
  25551. CompressedTexture: bl,
  25552. CompressedTextureLoader: wc,
  25553. ConeBufferGeometry: Rl,
  25554. ConeGeometry: Ll,
  25555. CubeCamera: ea,
  25556. CubeGeometry: Cl,
  25557. CubeReflectionMapping: L,
  25558. CubeRefractionMapping: R,
  25559. CubeTexture: ta,
  25560. CubeTextureLoader: xc,
  25561. CubeUVReflectionMapping: z,
  25562. CubeUVRefractionMapping: U,
  25563. CubicBezierCurve: Ic,
  25564. CubicBezierCurve3: Oc,
  25565. CubicInterpolant: $u,
  25566. CullFaceBack: j,
  25567. CullFaceFront: W,
  25568. CullFaceFrontBack: 3,
  25569. CullFaceNone: V,
  25570. Curve: Mc,
  25571. CurvePath: jc,
  25572. CustomBlending: ie,
  25573. CustomToneMapping: 5,
  25574. CylinderBufferGeometry: kl,
  25575. CylinderGeometry: Bl,
  25576. Cylindrical: dh,
  25577. DataTexture: ia,
  25578. DataTexture2DArray: Sa,
  25579. DataTexture3D: Ca,
  25580. DataTextureLoader: Ec,
  25581. DataUtils: qd,
  25582. DecrementStencilOp: 7683,
  25583. DecrementWrapStencilOp: 34056,
  25584. DefaultLoadingManager: fc,
  25585. DepthFormat: rt,
  25586. DepthStencilFormat: at,
  25587. DepthTexture: El,
  25588. DirectionalLight: nd,
  25589. DirectionalLightHelper: Rh,
  25590. DiscreteInterpolant: tc,
  25591. DodecahedronBufferGeometry: Il,
  25592. DodecahedronGeometry: Ol,
  25593. DoubleSide: Y,
  25594. DstAlphaFactor: ge,
  25595. DstColorFactor: we,
  25596. DynamicBufferAttribute: function(e, t) {
  25597. return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),
  25598. new nr(e,t).setUsage(cn)
  25599. },
  25600. DynamicCopyUsage: 35050,
  25601. DynamicDrawUsage: cn,
  25602. DynamicReadUsage: 35049,
  25603. EdgesGeometry: Hl,
  25604. EdgesHelper: function(e, t) {
  25605. return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),
  25606. new cl(new Hl(e.geometry),new tl({
  25607. color: void 0 !== t ? t : 16777215
  25608. }))
  25609. },
  25610. EllipseCurve: Ac,
  25611. EqualDepth: Te,
  25612. EqualStencilFunc: 514,
  25613. EquirectangularReflectionMapping: F,
  25614. EquirectangularRefractionMapping: I,
  25615. Euler: ci,
  25616. EventDispatcher: hn,
  25617. ExtrudeBufferGeometry: uu,
  25618. ExtrudeGeometry: du,
  25619. Face3: Zi,
  25620. Face4: function(e, t, n, i, r, a, o) {
  25621. return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),
  25622. new Zi(e,t,n,r,a,o)
  25623. },
  25624. FaceColors: 1,
  25625. FileLoader: gc,
  25626. FlatShading: 1,
  25627. Float16BufferAttribute: cr,
  25628. Float32Attribute: function(e, t) {
  25629. return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),
  25630. new dr(e,t)
  25631. },
  25632. Float32BufferAttribute: dr,
  25633. Float64Attribute: function(e, t) {
  25634. return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),
  25635. new hr(e,t)
  25636. },
  25637. Float64BufferAttribute: hr,
  25638. FloatType: Xe,
  25639. Fog: vs,
  25640. FogExp2: ms,
  25641. Font: wd,
  25642. FontLoader: bd,
  25643. FrontSide: q,
  25644. Frustum: oa,
  25645. GLBufferAttribute: oh,
  25646. GLSL1: "100",
  25647. GLSL3: dn,
  25648. GammaEncoding: 3007,
  25649. Geometry: Sl,
  25650. GeometryUtils: Zd,
  25651. GreaterDepth: Ce,
  25652. GreaterEqualDepth: Se,
  25653. GreaterEqualStencilFunc: 518,
  25654. GreaterStencilFunc: 516,
  25655. GridHelper: Ph,
  25656. Group: us,
  25657. HalfFloatType: qe,
  25658. HemisphereLight: Jc,
  25659. HemisphereLightHelper: Ch,
  25660. HemisphereLightProbe: _d,
  25661. IcosahedronBufferGeometry: hu,
  25662. IcosahedronGeometry: pu,
  25663. ImageBitmapLoader: gd,
  25664. ImageLoader: bc,
  25665. ImageUtils: bn,
  25666. ImmediateRenderObject: gh,
  25667. IncrementStencilOp: 7682,
  25668. IncrementWrapStencilOp: 34055,
  25669. InstancedBufferAttribute: cd,
  25670. InstancedBufferGeometry: ud,
  25671. InstancedInterleavedBuffer: ah,
  25672. InstancedMesh: el,
  25673. Int16Attribute: function(e, t) {
  25674. return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),
  25675. new or(e,t)
  25676. },
  25677. Int16BufferAttribute: or,
  25678. Int32Attribute: function(e, t) {
  25679. return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),
  25680. new lr(e,t)
  25681. },
  25682. Int32BufferAttribute: lr,
  25683. Int8Attribute: function(e, t) {
  25684. return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),
  25685. new ir(e,t)
  25686. },
  25687. Int8BufferAttribute: ir,
  25688. IntType: je,
  25689. InterleavedBuffer: ys,
  25690. InterleavedBufferAttribute: xs,
  25691. Interpolant: Ku,
  25692. InterpolateDiscrete: Kt,
  25693. InterpolateLinear: $t,
  25694. InterpolateSmooth: 2302,
  25695. InvertStencilOp: 5386,
  25696. JSONLoader: function() {
  25697. console.error("THREE.JSONLoader has been removed.")
  25698. },
  25699. KeepStencilOp: 7680,
  25700. KeyframeTrack: nc,
  25701. LOD: Ns,
  25702. LatheBufferGeometry: fu,
  25703. LatheGeometry: mu,
  25704. Layers: pi,
  25705. LensFlare: function() {
  25706. console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")
  25707. },
  25708. LessDepth: Me,
  25709. LessEqualDepth: Ae,
  25710. LessEqualStencilFunc: 515,
  25711. LessStencilFunc: 513,
  25712. Light: qc,
  25713. LightProbe: od,
  25714. Line: sl,
  25715. Line3: vh,
  25716. LineBasicMaterial: tl,
  25717. LineCurve: zc,
  25718. LineCurve3: Nc,
  25719. LineDashedMaterial: Yu,
  25720. LineLoop: dl,
  25721. LinePieces: 1,
  25722. LineSegments: cl,
  25723. LineStrip: 0,
  25724. LinearEncoding: rn,
  25725. LinearFilter: Oe,
  25726. LinearInterpolant: ec,
  25727. LinearMipMapLinearFilter: G,
  25728. LinearMipMapNearestFilter: 1007,
  25729. LinearMipmapLinearFilter: Ne,
  25730. LinearMipmapNearestFilter: ze,
  25731. LinearToneMapping: 1,
  25732. Loader: mc,
  25733. LoaderUtils: ld,
  25734. LoadingManager: pc,
  25735. LogLuvEncoding: 3003,
  25736. LoopOnce: 2200,
  25737. LoopPingPong: 2202,
  25738. LoopRepeat: 2201,
  25739. LuminanceAlphaFormat: nt,
  25740. LuminanceFormat: tt,
  25741. MOUSE: C,
  25742. Material: Ki,
  25743. MaterialLoader: sd,
  25744. Math: gn,
  25745. MathUtils: gn,
  25746. Matrix3: wn,
  25747. Matrix4: ni,
  25748. MaxEquation: ce,
  25749. Mesh: Hr,
  25750. MeshBasicMaterial: $i,
  25751. MeshDepthMaterial: es,
  25752. MeshDistanceMaterial: ts,
  25753. MeshFaceMaterial: function(e) {
  25754. return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),
  25755. e
  25756. },
  25757. MeshLambertMaterial: qu,
  25758. MeshMatcapMaterial: Ju,
  25759. MeshNormalMaterial: Xu,
  25760. MeshPhongMaterial: ju,
  25761. MeshPhysicalMaterial: Vu,
  25762. MeshStandardMaterial: Hu,
  25763. MeshToonMaterial: Wu,
  25764. MinEquation: se,
  25765. MirroredRepeatWrapping: Le,
  25766. MixOperation: 1,
  25767. MultiMaterial: function() {
  25768. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [];
  25769. return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),
  25770. e.isMultiMaterial = !0,
  25771. (e.materials = e).clone = function() {
  25772. return e.slice()
  25773. }
  25774. ,
  25775. e
  25776. },
  25777. MultiplyBlending: ne,
  25778. MultiplyOperation: k,
  25779. NearestFilter: Re,
  25780. NearestMipMapLinearFilter: 1005,
  25781. NearestMipMapNearestFilter: 1004,
  25782. NearestMipmapLinearFilter: Ie,
  25783. NearestMipmapNearestFilter: Fe,
  25784. NeverDepth: Ee,
  25785. NeverStencilFunc: 512,
  25786. NoBlending: Z,
  25787. NoColors: 0,
  25788. NoToneMapping: De,
  25789. NormalAnimationBlendMode: 2500,
  25790. NormalBlending: K,
  25791. NotEqualDepth: Pe,
  25792. NotEqualStencilFunc: 517,
  25793. NumberKeyframeTrack: ac,
  25794. Object3D: Si,
  25795. ObjectLoader: pd,
  25796. ObjectSpaceNormalMap: ln,
  25797. OctahedronBufferGeometry: vu,
  25798. OctahedronGeometry: gu,
  25799. OneFactor: he,
  25800. OneMinusDstAlphaFactor: ye,
  25801. OneMinusDstColorFactor: be,
  25802. OneMinusSrcAlphaFactor: ve,
  25803. OneMinusSrcColorFactor: fe,
  25804. OrthographicCamera: ed,
  25805. PCFShadowMap: P,
  25806. PCFSoftShadowMap: 2,
  25807. PMREMGenerator: Yd,
  25808. ParametricBufferGeometry: yu,
  25809. ParametricGeometry: wu,
  25810. Particle: function(e) {
  25811. return console.warn("THREE.Particle has been renamed to THREE.Sprite."),
  25812. new Fs(e)
  25813. },
  25814. ParticleBasicMaterial: function(e) {
  25815. return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),
  25816. new hl(e)
  25817. },
  25818. ParticleSystem: function(e, t) {
  25819. return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),
  25820. new gl(e,t)
  25821. },
  25822. ParticleSystemMaterial: function(e) {
  25823. return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),
  25824. new hl(e)
  25825. },
  25826. Path: Wc,
  25827. PerspectiveCamera: $r,
  25828. Plane: ki,
  25829. PlaneBufferGeometry: ua,
  25830. PlaneGeometry: bu,
  25831. PlaneHelper: Hh,
  25832. PointCloud: dp,
  25833. PointCloudMaterial: function(e) {
  25834. return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),
  25835. new hl(e)
  25836. },
  25837. PointLight: $c,
  25838. PointLightHelper: Mh,
  25839. Points: gl,
  25840. PointsMaterial: hl,
  25841. PolarGridHelper: Dh,
  25842. PolyhedronBufferGeometry: Fl,
  25843. PolyhedronGeometry: xu,
  25844. PositionalAudio: Ud,
  25845. PropertyBinding: eh,
  25846. PropertyMixer: Hd,
  25847. QuadraticBezierCurve: Uc,
  25848. QuadraticBezierCurve3: Gc,
  25849. Quaternion: Sn,
  25850. QuaternionKeyframeTrack: sc,
  25851. QuaternionLinearInterpolant: oc,
  25852. REVISION: "124",
  25853. RGBADepthPacking: on,
  25854. RGBAFormat: et,
  25855. RGBAIntegerFormat: dt,
  25856. RGBA_ASTC_10x10_Format: Rt,
  25857. RGBA_ASTC_10x5_Format: kt,
  25858. RGBA_ASTC_10x6_Format: Bt,
  25859. RGBA_ASTC_10x8_Format: Lt,
  25860. RGBA_ASTC_12x10_Format: Ft,
  25861. RGBA_ASTC_12x12_Format: It,
  25862. RGBA_ASTC_4x4_Format: _t,
  25863. RGBA_ASTC_5x4_Format: Mt,
  25864. RGBA_ASTC_5x5_Format: At,
  25865. RGBA_ASTC_6x5_Format: Tt,
  25866. RGBA_ASTC_6x6_Format: St,
  25867. RGBA_ASTC_8x5_Format: Ct,
  25868. RGBA_ASTC_8x6_Format: Pt,
  25869. RGBA_ASTC_8x8_Format: Dt,
  25870. RGBA_BPTC_Format: Ot,
  25871. RGBA_ETC2_EAC_Format: Et,
  25872. RGBA_PVRTC_2BPPV1_Format: wt,
  25873. RGBA_PVRTC_4BPPV1_Format: yt,
  25874. RGBA_S3TC_DXT1_Format: pt,
  25875. RGBA_S3TC_DXT3_Format: ft,
  25876. RGBA_S3TC_DXT5_Format: mt,
  25877. RGBDEncoding: 3006,
  25878. RGBEEncoding: 3002,
  25879. RGBEFormat: it,
  25880. RGBFormat: $e,
  25881. RGBIntegerFormat: ct,
  25882. RGBM16Encoding: 3005,
  25883. RGBM7Encoding: 3004,
  25884. RGB_ETC1_Format: bt,
  25885. RGB_ETC2_Format: xt,
  25886. RGB_PVRTC_2BPPV1_Format: gt,
  25887. RGB_PVRTC_4BPPV1_Format: vt,
  25888. RGB_S3TC_DXT1_Format: ht,
  25889. RGFormat: lt,
  25890. RGIntegerFormat: ut,
  25891. RawShaderMaterial: Gu,
  25892. Ray: ti,
  25893. Raycaster: sh,
  25894. RectAreaLight: rd,
  25895. RedFormat: ot,
  25896. RedIntegerFormat: st,
  25897. ReinhardToneMapping: 2,
  25898. RepeatWrapping: ke,
  25899. ReplaceStencilOp: 7681,
  25900. ReverseSubtractEquation: oe,
  25901. RingBufferGeometry: Eu,
  25902. RingGeometry: _u,
  25903. SRGB8_ALPHA8_ASTC_10x10_Format: Yt,
  25904. SRGB8_ALPHA8_ASTC_10x5_Format: Xt,
  25905. SRGB8_ALPHA8_ASTC_10x6_Format: qt,
  25906. SRGB8_ALPHA8_ASTC_10x8_Format: Jt,
  25907. SRGB8_ALPHA8_ASTC_12x10_Format: Zt,
  25908. SRGB8_ALPHA8_ASTC_12x12_Format: Qt,
  25909. SRGB8_ALPHA8_ASTC_4x4_Format: zt,
  25910. SRGB8_ALPHA8_ASTC_5x4_Format: Nt,
  25911. SRGB8_ALPHA8_ASTC_5x5_Format: Ut,
  25912. SRGB8_ALPHA8_ASTC_6x5_Format: Gt,
  25913. SRGB8_ALPHA8_ASTC_6x6_Format: Ht,
  25914. SRGB8_ALPHA8_ASTC_8x5_Format: Vt,
  25915. SRGB8_ALPHA8_ASTC_8x6_Format: jt,
  25916. SRGB8_ALPHA8_ASTC_8x8_Format: Wt,
  25917. Scene: gs,
  25918. SceneUtils: Jd,
  25919. ShaderChunk: ca,
  25920. ShaderLib: ha,
  25921. ShaderMaterial: Qr,
  25922. ShadowMaterial: Uu,
  25923. Shape: Xc,
  25924. ShapeBufferGeometry: Mu,
  25925. ShapeGeometry: Au,
  25926. ShapePath: yd,
  25927. ShapeUtils: ou,
  25928. ShortType: He,
  25929. Skeleton: Ys,
  25930. SkeletonHelper: _h,
  25931. SkinnedMesh: Ws,
  25932. SmoothShading: 2,
  25933. Sphere: qn,
  25934. SphereBufferGeometry: Tu,
  25935. SphereGeometry: Su,
  25936. Spherical: ch,
  25937. SphericalHarmonics3: ad,
  25938. Spline: fp,
  25939. SplineCurve: Hc,
  25940. SplineCurve3: pp,
  25941. SpotLight: Qc,
  25942. SpotLightHelper: wh,
  25943. Sprite: Fs,
  25944. SpriteMaterial: Es,
  25945. SrcAlphaFactor: me,
  25946. SrcAlphaSaturateFactor: xe,
  25947. SrcColorFactor: pe,
  25948. StaticCopyUsage: 35046,
  25949. StaticDrawUsage: un,
  25950. StaticReadUsage: 35045,
  25951. StereoCamera: Sd,
  25952. StreamCopyUsage: 35042,
  25953. StreamDrawUsage: 35040,
  25954. StreamReadUsage: 35041,
  25955. StringKeyframeTrack: lc,
  25956. SubtractEquation: ae,
  25957. SubtractiveBlending: te,
  25958. TOUCH: {
  25959. ROTATE: 0,
  25960. PAN: 1,
  25961. DOLLY_PAN: 2,
  25962. DOLLY_ROTATE: 3
  25963. },
  25964. TangentSpaceNormalMap: sn,
  25965. TetrahedronBufferGeometry: Cu,
  25966. TetrahedronGeometry: Pu,
  25967. TextBufferGeometry: Du,
  25968. TextGeometry: ku,
  25969. Texture: En,
  25970. TextureLoader: _c,
  25971. TorusBufferGeometry: Bu,
  25972. TorusGeometry: Lu,
  25973. TorusKnotBufferGeometry: Ru,
  25974. TorusKnotGeometry: Fu,
  25975. Triangle: Hi,
  25976. TriangleFanDrawMode: 2,
  25977. TriangleStripDrawMode: 1,
  25978. TrianglesDrawMode: 0,
  25979. TubeBufferGeometry: Iu,
  25980. TubeGeometry: Ou,
  25981. UVMapping: 300,
  25982. Uint16Attribute: function(e, t) {
  25983. return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),
  25984. new sr(e,t)
  25985. },
  25986. Uint16BufferAttribute: sr,
  25987. Uint32Attribute: function(e, t) {
  25988. return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),
  25989. new ur(e,t)
  25990. },
  25991. Uint32BufferAttribute: ur,
  25992. Uint8Attribute: function(e, t) {
  25993. return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),
  25994. new rr(e,t)
  25995. },
  25996. Uint8BufferAttribute: rr,
  25997. Uint8ClampedAttribute: function(e, t) {
  25998. return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),
  25999. new ar(e,t)
  26000. },
  26001. Uint8ClampedBufferAttribute: ar,
  26002. Uniform: rh,
  26003. UniformsLib: da,
  26004. UniformsUtils: Jr,
  26005. UnsignedByteType: Ue,
  26006. UnsignedInt248Type: Qe,
  26007. UnsignedIntType: We,
  26008. UnsignedShort4444Type: Je,
  26009. UnsignedShort5551Type: Ye,
  26010. UnsignedShort565Type: Ze,
  26011. UnsignedShortType: Ve,
  26012. VSMShadowMap: D,
  26013. Vector2: yn,
  26014. Vector3: Cn,
  26015. Vector4: Mn,
  26016. VectorKeyframeTrack: uc,
  26017. Vertex: function(e, t, n) {
  26018. return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),
  26019. new Cn(e,t,n)
  26020. },
  26021. VertexColors: 2,
  26022. VideoTexture: wl,
  26023. WebGL1Renderer: fs,
  26024. WebGLCubeRenderTarget: na,
  26025. WebGLMultisampleRenderTarget: Tn,
  26026. WebGLRenderTarget: An,
  26027. WebGLRenderTargetCube: function(e, t, n) {
  26028. return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),
  26029. new na(e,n)
  26030. },
  26031. WebGLRenderer: ps,
  26032. WebGLUtils: ss,
  26033. WireframeGeometry: zu,
  26034. WireframeHelper: function(e, t) {
  26035. return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),
  26036. new cl(new zu(e.geometry),new tl({
  26037. color: void 0 !== t ? t : 16777215
  26038. }))
  26039. },
  26040. WrapAroundEnding: nn,
  26041. XHRLoader: function(e) {
  26042. return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),
  26043. new gc(e)
  26044. },
  26045. ZeroCurvatureEnding: en,
  26046. ZeroFactor: de,
  26047. ZeroSlopeEnding: tn,
  26048. ZeroStencilOp: 0,
  26049. sRGBEncoding: an
  26050. })
  26051. , vp = []
  26052. , gp = []
  26053. , yp = []
  26054. , wp = .1
  26055. , bp = function(t, e) {
  26056. var n;
  26057. return "string" == typeof t || "number" == typeof t ? n = vp.find(function(e) {
  26058. return e.ids.includes(t)
  26059. }) : (n = vp.find(function(e) {
  26060. return Up.closeTo(e.x, t.x, wp) && Up.closeTo(e.y, t.y, wp)
  26061. })) ? n.addPoint(t.id) : n = new xp(t.x,t.y,{
  26062. record: !0,
  26063. id: t.id
  26064. },e),
  26065. n || console.log("no point!"),
  26066. n
  26067. }
  26068. , xp = function() {
  26069. y(r, yn);
  26070. var i = w(r);
  26071. function r(e, t) {
  26072. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};
  26073. return O(this, r),
  26074. t = i.call(this, e, t),
  26075. n.record && (t.id = n.id,
  26076. null == t.id && (t.id = "add_" + vp.length),
  26077. t.ids = [t.id],
  26078. vp.push(g(t))),
  26079. t.type = n.type || "",
  26080. t.lines = [],
  26081. t
  26082. }
  26083. return h(r, [{
  26084. key: "addPoint",
  26085. value: function(e) {
  26086. this.ids.push(e)
  26087. }
  26088. }, {
  26089. key: "searchLineByFactor",
  26090. value: function(i, r, t) {
  26091. var a, o = this, e = this.lines.filter(function(e) {
  26092. return e.searchTime < 2
  26093. });
  26094. if (0 != e.length)
  26095. return 1 == e.length || 1 == (e = e.filter(function(e) {
  26096. return e != t
  26097. })).length ? e[0] : (e.forEach(function(e) {
  26098. var t = e.getVector();
  26099. e.points[1] == o && t.negate();
  26100. var n = Up.getVec2Angle(i, t);
  26101. new Cn(i.x,i.y,0).cross(new Cn(t.x,t.y,0)).z < 0 && (n *= -1),
  26102. (!a || "min" == r && n < a.factor || "max" == r && n > a.factor) && (a = {
  26103. line: e,
  26104. factor: n
  26105. })
  26106. }),
  26107. a.line)
  26108. }
  26109. }]),
  26110. r
  26111. }()
  26112. , Ep = 0
  26113. , _p = function() {
  26114. function a(t) {
  26115. var n = this;
  26116. if (O(this, a),
  26117. t.points[0] != t.points[1]) {
  26118. if (this.points = t.points,
  26119. this.type = t.type || "line",
  26120. "line" == this.type) {
  26121. var e = gp.find(function(e) {
  26122. return e.points.includes(t.points[0]) && e.points.includes(t.points[1])
  26123. });
  26124. if (e)
  26125. return null != t.id && e.ids.push(t.id),
  26126. e;
  26127. this.id = null == t.id ? "line" + Ep++ : t.id,
  26128. this.ids = [this.id],
  26129. t.dontWriteToPoint || this.points.forEach(function(e) {
  26130. e.lines.push(n)
  26131. }),
  26132. t.isChild || gp.push(this),
  26133. this.searchTime = 0
  26134. }
  26135. this.children = [],
  26136. this.parents = [],
  26137. this.match = []
  26138. }
  26139. }
  26140. return h(a, [{
  26141. key: "getAngleInfo",
  26142. value: function() {
  26143. var e, t = (e = this.points,
  26144. (t = {}).angle = e[1].clone().sub(e[0]).angle(),
  26145. Up.closeTo(t.angle, 2 * Math.PI) ? t.angle -= 2 * Math.PI : (t.angle > Math.PI || Up.closeTo(t.angle, Math.PI)) && (t.angle -= Math.PI,
  26146. t.reverse = !0),
  26147. t);
  26148. this.angle = t.angle,
  26149. this.reverse = t.reverse
  26150. }
  26151. }, {
  26152. key: "getIntersectWithLine",
  26153. value: function(e, t) {
  26154. var n = this
  26155. , i = e.points.find(function(e) {
  26156. return n.points.includes(e)
  26157. });
  26158. if (i)
  26159. return {
  26160. point: i,
  26161. type: "joint"
  26162. };
  26163. t = Up.isLineIntersect(e.points, this.points, !1, t);
  26164. return t ? {
  26165. point: t,
  26166. type: "intersect"
  26167. } : void 0
  26168. }
  26169. }, {
  26170. key: "writeToPoint",
  26171. value: function() {
  26172. var t = this;
  26173. this.points.forEach(function(e) {
  26174. e.lines.includes(t) || e.lines.push(t)
  26175. })
  26176. }
  26177. }, {
  26178. key: "checkIfParent",
  26179. value: function(t) {
  26180. return this == t || this.parents.find(function(e) {
  26181. return e.checkIfParent(t)
  26182. })
  26183. }
  26184. }, {
  26185. key: "splitByPoint",
  26186. value: function(e) {
  26187. var t = this
  26188. , n = new a({
  26189. points: [e, this.points[0]],
  26190. dontWriteToPoint: !0,
  26191. hasntsure: !0
  26192. })
  26193. , i = new a({
  26194. points: [e, this.points[1]],
  26195. dontWriteToPoint: !0,
  26196. hasntsure: !0
  26197. });
  26198. if (n.points && i.points) {
  26199. if (!(this.checkIfParent(n) || this.checkIfParent(i) || n.checkIfParent(this) || i.checkIfParent(this))) {
  26200. var e = function(e) {
  26201. t.children.push(e),
  26202. e.parents.push(t),
  26203. gp.includes(e) || gp.push(e),
  26204. e.writeToPoint()
  26205. };
  26206. e(n),
  26207. e(i);
  26208. e = this.points[0].lines.indexOf(this);
  26209. return -1 < e && this.points[0].lines.splice(e, 1),
  26210. -1 < (e = this.points[1].lines.indexOf(this)) && this.points[1].lines.splice(e, 1),
  26211. [n, i]
  26212. }
  26213. console.warn("splitByPoint 发现parent和children一样")
  26214. } else
  26215. console.warn("splitByPoint 线有点相同")
  26216. }
  26217. }, {
  26218. key: "splitByPoints",
  26219. value: function(n) {
  26220. var i = this;
  26221. (n = n.map(function(e) {
  26222. return {
  26223. dis: e.distanceTo(i.points[0]),
  26224. point: e
  26225. }
  26226. })).sort(function(e, t) {
  26227. return e.dis - t.dis
  26228. });
  26229. var r = [];
  26230. n.forEach(function(e, t) {
  26231. t = new a({
  26232. points: [e.point, 0 == t ? i.points[0] : n[t - 1].point],
  26233. group: i.group,
  26234. dontWriteToPoint: !0,
  26235. hasntsure: !0
  26236. });
  26237. r.push(t)
  26238. });
  26239. var e = new a({
  26240. points: [n[n.length - 1].point, this.points[1]],
  26241. group: this.group,
  26242. dontWriteToPoint: !0,
  26243. hasntsure: !0
  26244. });
  26245. r.push(e),
  26246. r.find(function(e) {
  26247. return !e.points || i.checkIfParent(e) || e.checkIfParent(i)
  26248. }) ? console.error("splitByPoints return") : (r.forEach(function(e) {
  26249. i.children.push(e),
  26250. e.parents.push(i),
  26251. gp.includes(e) || gp.push(e),
  26252. e.writeToPoint(),
  26253. e.writeToPoint()
  26254. }),
  26255. -1 < (e = this.points[0].lines.indexOf(this)) && this.points[0].lines.splice(e, 1),
  26256. -1 < (e = this.points[1].lines.indexOf(this)) && this.points[1].lines.splice(e, 1))
  26257. }
  26258. }, {
  26259. key: "getAllSlices",
  26260. value: function() {
  26261. var n = [];
  26262. return function e(t) {
  26263. 0 == t.children.length ? n.push(t) : t.children.forEach(e)
  26264. }(this),
  26265. n
  26266. }
  26267. }, {
  26268. key: "getVector",
  26269. value: function() {
  26270. return this.points[1].clone().sub(this.points[0])
  26271. }
  26272. }, {
  26273. key: "getLength",
  26274. value: function() {
  26275. return this.points[0].distanceTo(this.points[1])
  26276. }
  26277. }, {
  26278. key: "getCenter",
  26279. value: function() {
  26280. return this.points[1].clone().add(this.points[0]).multiplyScalar(.5)
  26281. }
  26282. }]),
  26283. a
  26284. }()
  26285. , Mp = function(t, n) {
  26286. var e = t.filter(function(e) {
  26287. return !n.includes(e)
  26288. })
  26289. , i = n.filter(function(e) {
  26290. return !t.includes(e)
  26291. });
  26292. return e.concat(i)
  26293. };
  26294. function Ap(t, n) {
  26295. return gp.find(function(e) {
  26296. return e.points.includes(t) && e.points.includes(n)
  26297. })
  26298. }
  26299. function Tp(e, t) {
  26300. if (e instanceof Cp && (e = e.points),
  26301. t instanceof Cp && (t = t.points),
  26302. e.length != t.length)
  26303. return !1;
  26304. if (e.lines && t.lines) {
  26305. if (0 == Mp(e.lines, t.lines).length)
  26306. return !0
  26307. } else if (Pp(e, t))
  26308. return !0
  26309. }
  26310. var Sp = 0
  26311. , Cp = h(function e(t) {
  26312. O(this, e),
  26313. this.id = Sp++,
  26314. this.type = t.type || "normal",
  26315. this.points = t.points,
  26316. this.lines = t.lines,
  26317. yp.push(this),
  26318. this.child = [],
  26319. this.parent = [],
  26320. this.smallNeibours = [];
  26321. t = Up.getArea(this.points);
  26322. this.area = Math.abs(t),
  26323. this.isClockwise = t < 0
  26324. })
  26325. , Pp = function(e, t) {
  26326. for (var n, i, r = [], a = 0, o = e.length; a < o; a++)
  26327. -1 < t.indexOf(e[a]) && r.push(e[a]);
  26328. for (var s = 0, l = t.length; s < l; s++) {
  26329. var u = r.indexOf(t[s]);
  26330. if (-1 == u)
  26331. return !1;
  26332. if (0 == s)
  26333. i = u;
  26334. else if (1 == s) {
  26335. if ((n = u - i) == l - 1 ? n = -1 : n == 1 - l && (n = 1),
  26336. -1 != n && 1 != n)
  26337. return !1
  26338. } else if (u != (i + n * s + l) % l)
  26339. return !1
  26340. }
  26341. return {
  26342. sameAxis: 0 < n
  26343. }
  26344. }
  26345. , Dp = function e(t, n, i) {
  26346. if (0 == n.children.length) {
  26347. if (Up.ifPointAtLineBound(t, n.points, i))
  26348. return n
  26349. } else
  26350. for (var r = 0; r < n.children.length; r++) {
  26351. var a = e(t, n.children[r], i);
  26352. if (a)
  26353. return a
  26354. }
  26355. };
  26356. function kp() {
  26357. var e, c = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  26358. vp = [],
  26359. gp = [],
  26360. yp = [],
  26361. Ep = Sp = 0,
  26362. c.points = c.points || [],
  26363. c.lines = c.lines || [],
  26364. (u = c).points.forEach(function(e) {
  26365. Np.expandByPoint(new yn(e.x,e.y))
  26366. }),
  26367. wp = null != u.precision ? u.precision : (e = Np.getSize(new yn),
  26368. gn.clamp(Math.max(e.x, e.y) / 70, .2, 2)),
  26369. u.points.forEach(function(e) {
  26370. return bp(e)
  26371. }),
  26372. u.lines.forEach(function(e) {
  26373. new _p({
  26374. points: [bp(e.p1), bp(e.p2)],
  26375. id: e.id
  26376. })
  26377. }),
  26378. c.dontSliceLines || function() {
  26379. for (var e = gp.length, t = function n(e, t) {
  26380. if (e != t) {
  26381. null == e.angle && e.getAngleInfo(),
  26382. null == t.angle && t.getAngleInfo();
  26383. var i = e.getIntersectWithLine(t, wp);
  26384. if (i)
  26385. if ("intersect" == i.type) {
  26386. var r = bp(i.point, "whenGetSliceLines")
  26387. , a = Dp(r, e)
  26388. , o = Dp(r, t);
  26389. if (a = (a = a || Dp(r, e, wp)) || Dp(r, e, 2 * wp),
  26390. o = (o = o || Dp(r, t, wp)) || Dp(r, t, 2 * wp),
  26391. !a || !o)
  26392. return console.warn("atWhichChildLine仍旧找不到 :" + e.id + "," + t.id + ", pointId: " + r.id),
  26393. a || console.warn("找不到line1"),
  26394. void (o || console.warn("找不到line2"));
  26395. a.points.find(function(e) {
  26396. return e == r
  26397. }) && o.points.find(function(e) {
  26398. return e == r
  26399. }) || (a.points.find(function(e) {
  26400. return e == r
  26401. }) ? o.splitByPoint(r) : o.points.find(function(e) {
  26402. return e == r
  26403. }) ? a.splitByPoint(r) : (a.splitByPoint(r),
  26404. o.splitByPoint(r)))
  26405. } else
  26406. r = i.point,
  26407. Up.closeTo(e.angle, t.angle) && (l = e.getAllSlices(),
  26408. u = t.getAllSlices(),
  26409. 1 < l.length || 1 < u.length ? l.forEach(function(t) {
  26410. u.forEach(function(e) {
  26411. n(t, e)
  26412. })
  26413. }) : (s = e.points.find(function(e) {
  26414. return e != r
  26415. }),
  26416. c = t.points.find(function(e) {
  26417. return e != r
  26418. }),
  26419. Up.ifPointAtLineBound(s, t.points) ? t.splitByPoint(s) : Up.ifPointAtLineBound(c, e.points) && e.splitByPoint(c)));
  26420. else if (Up.closeTo(e.angle, t.angle)) {
  26421. var o = e.getVector()
  26422. , i = e.points[0].clone().sub(t.points[0])
  26423. , s = Up.getVec2Cos(o, i);
  26424. if (Up.closeTo(s, -1, 1e-4) || Up.closeTo(s, 1, 1e-4)) {
  26425. var l = e.getAllSlices()
  26426. , u = t.getAllSlices();
  26427. if (1 < l.length || 1 < u.length)
  26428. l.forEach(function(t) {
  26429. u.forEach(function(e) {
  26430. n(t, e)
  26431. })
  26432. });
  26433. else {
  26434. var c = e.points[0]
  26435. , o = e.reverse == t.reverse ? t.points[0] : t.points[1]
  26436. , i = e.points[1]
  26437. , s = e.reverse == t.reverse ? t.points[1] : t.points[0]
  26438. , l = o.clone().sub(i)
  26439. , o = s.clone().sub(c);
  26440. if (l.length() < o.length()) {
  26441. s = c.clone().sub(i);
  26442. if (1.57 <= Up.getVec2Angle(l, s))
  26443. return
  26444. } else {
  26445. var d = i.clone().sub(c);
  26446. if (1.57 <= Up.getVec2Angle(o, d))
  26447. return
  26448. }
  26449. d = function(e, t) {
  26450. var n = Up.ifPointAtLineBound(e.points[0], t.points)
  26451. , i = Up.ifPointAtLineBound(e.points[1], t.points);
  26452. if (n && i)
  26453. return t.splitByPoints(e.points),
  26454. !0;
  26455. if (n || i) {
  26456. i = n ? e.points[0] : e.points[1],
  26457. n = n ? e.points[1] : e.points[0],
  26458. n = t.points[0].distanceTo(n) < t.points[1].distanceTo(n) ? t.points[0] : t.points[1];
  26459. return e.splitByPoint(n),
  26460. t.splitByPoint(i),
  26461. !0
  26462. }
  26463. }
  26464. ;
  26465. d(e, t) || d(t, e)
  26466. }
  26467. }
  26468. }
  26469. }
  26470. }, n = 0; n < e; n++)
  26471. for (var i = gp[n], r = n + 1; r < e; r++)
  26472. t(i, gp[r])
  26473. }();
  26474. for (var n = function e(t, n, i, r) {
  26475. if (s = i.includes("big") ? n ? (a = n.points[n.points.length - 1],
  26476. o = t.clone().sub(a),
  26477. t.searchLineByFactor(o, "min", Ap(t, a))) : (o = i.includes("Left") ? new yn(1,0) : new yn(-1,0),
  26478. t.searchLineByFactor(o, "min")) : n ? (a = n.points[n.points.length - 1],
  26479. o = t.clone().sub(a),
  26480. t.searchLineByFactor(o, "max", Ap(t, a))) : (o = new yn(1,0),
  26481. t.searchLineByFactor(o, "min"))) {
  26482. s.searchTime++,
  26483. r.includes(s) || r.push(s);
  26484. var a = s.points.find(function(e) {
  26485. return t != e
  26486. })
  26487. , o = n ? n.points.concat([t]) : [t]
  26488. , s = n ? n.lines.concat([s]) : [s];
  26489. return a == o[0] ? function(t, e, n) {
  26490. if (!c.onlyGetOutRing || "small" != n) {
  26491. if ("small" != n && !c.onlyGetOutRing)
  26492. return t;
  26493. for (var i = []; t.length; ) {
  26494. for (var r = [], a = !1, o = 0; o < t.length; o++) {
  26495. if (r.includes(t[o])) {
  26496. var s = r.indexOf(t[o])
  26497. , l = t.slice(s, o)
  26498. , u = e.slice(s, o);
  26499. t.splice(s, o - s),
  26500. e.splice(s, o - s),
  26501. 2 < l.length && (yp.find(function(e) {
  26502. return Tp(l, e)
  26503. }) || i.push(new Cp({
  26504. points: l,
  26505. lines: u
  26506. }))),
  26507. a = !0;
  26508. break
  26509. }
  26510. r.push(t[o]),
  26511. a = !1
  26512. }
  26513. if (!a) {
  26514. 2 < t.length && (yp.find(function(e) {
  26515. return Tp(t, e)
  26516. }) || i.push(new Cp({
  26517. points: t,
  26518. lines: e
  26519. })));
  26520. break
  26521. }
  26522. }
  26523. "small" != n && i.forEach(function(e) {
  26524. return e.isOutRing = !0
  26525. })
  26526. }
  26527. }(o, s, i) : e(a, {
  26528. lines: s,
  26529. points: o
  26530. }, i, r)
  26531. }
  26532. }; ; ) {
  26533. var i = []
  26534. , r = null;
  26535. if (vp.forEach(function(e) {
  26536. e.lines.find(function(e) {
  26537. return e.searchTime < 2
  26538. }) && (!r || e.x < r.x) && (r = e)
  26539. }),
  26540. !r)
  26541. break;
  26542. n(r, null, "bigLeft", i);
  26543. for (i = i.filter(function(e) {
  26544. return e.searchTime < 2
  26545. }); 0 < i.length; )
  26546. if ("break" === function() {
  26547. var t = [];
  26548. if (i.forEach(function(e) {
  26549. return e.points.forEach(function(e) {
  26550. t.includes(e) || t.push(e)
  26551. })
  26552. }),
  26553. r = null,
  26554. t.forEach(function(e) {
  26555. e.lines.find(function(e) {
  26556. return e.searchTime < 2
  26557. }) && (!r || e.x < r.x) && (r = e)
  26558. }),
  26559. !r)
  26560. return "break";
  26561. n(r, null, "small", i),
  26562. i = i.filter(function(e) {
  26563. return e.searchTime < 2
  26564. })
  26565. }())
  26566. break
  26567. }
  26568. for (var o = yp.length, t = 0; t < o; t++)
  26569. for (var a = yp[t], s = t + 1; s < o; s++) {
  26570. var l = yp[s];
  26571. (function(e, t) {
  26572. return e.filter(function(e) {
  26573. return t.includes(e)
  26574. })
  26575. }
  26576. )(a.lines, l.lines).length && (a.smallNeibours.push(l),
  26577. l.smallNeibours.push(a))
  26578. }
  26579. yp.forEach(function(e) {
  26580. for (var t = 0; t < o; t++) {
  26581. var n = yp[t];
  26582. if (e != n && !e.smallNeibours.includes(n)) {
  26583. for (var i = void 0, r = 0; r < e.points.length && (i = Up.isPointInArea(n.points, null, e.points[r])) && i.atLine; r++)
  26584. ;
  26585. if (i) {
  26586. if (i.atLine) {
  26587. var a = Up.getCenterOfGravityPoint(e.points);
  26588. if (!Up.isPointInArea(n.points, null, a))
  26589. continue
  26590. }
  26591. n.child.push(e),
  26592. e.parent.push(n)
  26593. }
  26594. }
  26595. }
  26596. });
  26597. var u = yp.filter(function(e) {
  26598. return !e.isClockwise
  26599. });
  26600. return 0 < u.length && u.forEach(function(n) {
  26601. var e, i;
  26602. 0 < n.smallNeibours.length && (Mp(n.lines, (e = n.smallNeibours.concat(n.child).map(function(e) {
  26603. return e.lines
  26604. }),
  26605. i = [],
  26606. e.forEach(function(e) {
  26607. e.forEach(function(e) {
  26608. var t = i.indexOf(e);
  26609. -1 < t ? i.splice(t, 1) : i.push(e)
  26610. })
  26611. }),
  26612. i)).every(function(t) {
  26613. return n.child.find(function(e) {
  26614. return e.lines.includes(t)
  26615. })
  26616. }) && (console.log("%c删除非最小环 ring" + n.id, "color:#00f"),
  26617. console.log(n),
  26618. yp.splice(yp.indexOf(n), 1),
  26619. n.child.forEach(function(e) {
  26620. var t = e.parent.indexOf(n);
  26621. -1 < t && e.parent.splice(t, 1)
  26622. }),
  26623. n.parent.forEach(function(e) {
  26624. var t = e.child.indexOf(n);
  26625. -1 < t && e.child.splice(t, 1)
  26626. }),
  26627. n.smallNeibours.forEach(function(e) {
  26628. var t = e.smallNeibours.indexOf(n);
  26629. -1 < t && e.smallNeibours.splice(t, 1)
  26630. })))
  26631. }),
  26632. yp.forEach(function(t) {
  26633. t.parent.length && (t.closetParent = t.parent.find(function(e) {
  26634. return e.parent.length == t.parent.length - 1
  26635. }),
  26636. t.closetParent.closetChilds || (t.closetParent.closetChilds = []),
  26637. t.closetParent.closetChilds.push(t))
  26638. }),
  26639. yp.map(function(e) {
  26640. return {
  26641. id: e.id,
  26642. points: e.points.map(function(e) {
  26643. return {
  26644. id: e.ids[0],
  26645. x: e.x,
  26646. y: e.y
  26647. }
  26648. }),
  26649. area: e.area,
  26650. closetParent: e.closetParent && e.closetParent.id,
  26651. closetChilds: e.closetChilds && e.closetChilds.map(function(e) {
  26652. return e.id
  26653. })
  26654. }
  26655. })
  26656. }
  26657. var Bp, Lp, Rp, Fp, Ip, Op, zp, Np = new ph, Up = {
  26658. getBaseLog: function(e, t) {
  26659. return Math.log(t) / Math.log(e)
  26660. },
  26661. convertVector: {
  26662. ZupToYup: function(e) {
  26663. return new Cn(e.x,e.z,-e.y)
  26664. },
  26665. YupToZup: function(e) {
  26666. return new Cn(e.x,-e.z,e.y)
  26667. }
  26668. },
  26669. convertQuaternion: {
  26670. ZupToYup: function(e) {
  26671. var t = new ci(-Math.PI / 2,0,0)
  26672. , t = (new Sn).setFromEuler(t);
  26673. return e.clone().premultiply(t)
  26674. },
  26675. YupToZup: function(e) {
  26676. var t = new ci(Math.PI / 2,0,0)
  26677. , t = (new Sn).setFromEuler(t);
  26678. return e.clone().premultiply(t)
  26679. }
  26680. },
  26681. convertVisionQuaternion: function(e) {
  26682. return new Sn(e.x,e.z,-e.y,e.w).multiply((new Sn).setFromAxisAngle(new Cn(0,1,0), gn.degToRad(90)))
  26683. },
  26684. invertVisionQuaternion: function(e) {
  26685. e = e.clone().multiply((new Sn).setFromAxisAngle(new Cn(0,1,0), gn.degToRad(-90)));
  26686. return new Sn(e.x,-e.z,e.y,e.w)
  26687. },
  26688. getVec2Angle: function(e, t) {
  26689. return Math.acos(gn.clamp(this.getVec2Cos(e, t), -1, 1))
  26690. },
  26691. getVec2Cos: function(e, t) {
  26692. return e.dot(t) / e.length() / t.length()
  26693. },
  26694. getAngle: function(e, t, n) {
  26695. var i = e.angleTo(t);
  26696. return e.clone().cross(t)[n] < 0 && (i *= -1),
  26697. i
  26698. },
  26699. closeTo: function(t, n) {
  26700. function i(e, t) {
  26701. return Math.abs(e - t) < r
  26702. }
  26703. var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1e-6;
  26704. if ("number" == typeof t)
  26705. return i(t, n);
  26706. function e(e) {
  26707. return null == t[e] || i(t[e], n[e])
  26708. }
  26709. return e("x") && e("y") && e("z") && e("w")
  26710. },
  26711. toPrecision: function(e, t) {
  26712. function n(e, t) {
  26713. return t = Math.pow(10, t),
  26714. Math.round(e * t) / t
  26715. }
  26716. if (e instanceof Array) {
  26717. for (var i = 0; i < e.length; i++)
  26718. e[i] = n(e[i], t);
  26719. return e
  26720. }
  26721. if (e instanceof Object) {
  26722. for (var i in e)
  26723. e[i] = n(e[i], t);
  26724. return e
  26725. }
  26726. return n(e, t)
  26727. },
  26728. isEmptyQuaternion: function(e) {
  26729. return 0 === Math.abs(e.x) && 0 === Math.abs(e.y) && 0 === Math.abs(e.z) && 0 === Math.abs(e.w)
  26730. },
  26731. projectPositionToCanvas: function(e, t, n) {
  26732. (n = n || new Cn).copy(e);
  26733. var i = .5 * $("#player").width()
  26734. , e = .5 * $("#player").height();
  26735. return n.project(t),
  26736. n.x = n.x * i + i,
  26737. n.y = -n.y * e + e,
  26738. n
  26739. },
  26740. handelPadResize: !1,
  26741. getOffset: function(e, t, n) {
  26742. var i = "left" == e ? t.offsetLeft : t.offsetTop;
  26743. for (n = n || $("body")[0]; (t = t.offsetParent) && t != n; )
  26744. i += "left" == e ? t.offsetLeft : t.offsetTop;
  26745. return i
  26746. },
  26747. constrainedTurn: function(e) {
  26748. e %= 2 * Math.PI;
  26749. return e > Math.PI ? e - 2 * Math.PI : e < -Math.PI ? e + 2 * Math.PI : e
  26750. },
  26751. getFOVDotThreshold: function(e) {
  26752. return Math.cos(gn.degToRad(e / 2))
  26753. },
  26754. transform2DForwardVectorByCubeFace: function(e, t, n, i) {
  26755. switch (e) {
  26756. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:
  26757. n.set(1, t.y, t.x);
  26758. break;
  26759. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
  26760. n.set(-1, t.y, -t.x);
  26761. break;
  26762. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
  26763. n.set(-t.x, 1, -t.y);
  26764. break;
  26765. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
  26766. n.set(-t.x, -1, t.y);
  26767. break;
  26768. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
  26769. n.set(-t.x, t.y, 1);
  26770. break;
  26771. case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
  26772. n.set(t.x, t.y, -1)
  26773. }
  26774. i && n.normalize()
  26775. },
  26776. getFootPoint: function(e, t, n, i) {
  26777. if (t.equals(n))
  26778. return t.clone();
  26779. var r = e.clone().sub(t)
  26780. , a = t.clone().sub(n)
  26781. , e = a.length()
  26782. , r = r.dot(a) / e
  26783. , e = t.clone().add(a.multiplyScalar(r / e));
  26784. return e = i && 0 < e.clone().sub(t).dot(e.clone().sub(n)) ? (e.distanceTo(t) < e.distanceTo(n) ? t : n).clone() : e
  26785. },
  26786. getCenterOfGravityPoint: function(e) {
  26787. for (var t = 0, n = 0, i = 0, r = 1; r <= e.length; r++) {
  26788. var a = e[r % e.length].x
  26789. , o = e[r % e.length].y
  26790. , s = e[r - 1].x
  26791. , l = e[r - 1].y
  26792. , u = (a * l - o * s) / 2;
  26793. t += u,
  26794. n += u * (a + s) / 3,
  26795. i += u * (o + l) / 3
  26796. }
  26797. return {
  26798. x: n /= t,
  26799. y: i /= t
  26800. }
  26801. },
  26802. getBound: function(e) {
  26803. for (var t = new ph, n = 0, i = e.length; n < i; n++)
  26804. t.expandByPoint(e[n]);
  26805. return t
  26806. },
  26807. isPointInArea: function(e, t, n, i) {
  26808. var r = this
  26809. , a = this.getBound(e);
  26810. if (n.x < a.min.x || n.x > a.max.x || n.y < a.min.y || n.y > a.max.y)
  26811. return !1;
  26812. for (var o = !1, s = n.x, l = n.y, u = 0, c = e.length - 1; u < e.length; c = u++) {
  26813. var d = e[u].x
  26814. , h = e[u].y
  26815. , p = e[c].x
  26816. , f = e[c].y;
  26817. if ((d - s) * (f - l) == (d - s) * (h - l) && s >= Math.min(d, p) && s <= Math.max(d, p) && l >= Math.min(h, f) && l <= Math.max(h, f))
  26818. return {
  26819. atLine: !0
  26820. };
  26821. l < h != l < f && s < (p - d) * (l - h) / (f - h) + d && (o = !o)
  26822. }
  26823. return o && t ? !t.some(function(e) {
  26824. return r.isPointInArea(e, null, n, i)
  26825. }) : o
  26826. },
  26827. getArea: function(e) {
  26828. for (var t = e.length, n = 0, i = t - 1, r = 0; r < t; i = r++)
  26829. n += e[i].x * e[r].y - e[r].x * e[i].y;
  26830. return -.5 * n
  26831. },
  26832. isInBetween: function(e, t, n, i) {
  26833. return e <= t && t <= n || n <= t && t <= e || this.closeTo(e, t, i) || this.closeTo(t, n, i)
  26834. },
  26835. ifPointAtLineBound: function(e, t, n) {
  26836. return Up.isInBetween(t[0].x, e.x, t[1].x, n) && Up.isInBetween(t[0].y, e.y, t[1].y, n)
  26837. },
  26838. isLineIntersect: function(e, t, n, i) {
  26839. var r = e[1].y - e[0].y
  26840. , a = e[0].x - e[1].x
  26841. , o = r * e[0].x + a * e[0].y
  26842. , s = t[1].y - t[0].y
  26843. , l = t[0].x - t[1].x
  26844. , u = s * t[0].x + l * t[0].y
  26845. , c = r * l - s * a;
  26846. if (0 == c)
  26847. return !1;
  26848. a = (l * o - a * u) / c,
  26849. c = (r * u - s * o) / c;
  26850. return n || Up.ifPointAtLineBound({
  26851. x: a,
  26852. y: c
  26853. }, e, i) && Up.ifPointAtLineBound({
  26854. x: a,
  26855. y: c
  26856. }, t, i) ? {
  26857. x: a,
  26858. y: c
  26859. } : void 0
  26860. },
  26861. getNormal2d: function() {
  26862. var e, t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = i.vec ? (n = i.vec.x,
  26863. i.vec.y) : (n = i.p1.x - i.p2.x,
  26864. i.p1.y - i.p2.y);
  26865. if (0 != r)
  26866. t = -n * (e = 1) / r;
  26867. else {
  26868. if (0 == n)
  26869. return console.log("两个点一样"),
  26870. null;
  26871. e = -r * (t = 1) / n
  26872. }
  26873. i = new Cn(e,0,t),
  26874. r = new Cn(n,0,r);
  26875. return 0 < i.cross(r).y && (e *= -1,
  26876. t *= -1),
  26877. new yn(e,t).normalize()
  26878. },
  26879. getQuaBetween2Vector: function(e, t, n) {
  26880. var i = e.angleTo(t)
  26881. , t = e.clone().cross(t).normalize();
  26882. return 0 == t.length() ? (new Sn).setFromAxisAngle(n, i) : (new Sn).setFromAxisAngle(t, i)
  26883. },
  26884. getScaleForConstantSize: (Lp = new Cn,
  26885. Rp = new Cn,
  26886. Fp = new Cn,
  26887. Ip = new Cn,
  26888. Op = new Cn,
  26889. function() {
  26890. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  26891. return Bp = t.width2d || (e = "OrthographicCamera" == t.camera.type ? 200 / t.camera.zoom : t.position.distanceTo(t.camera.position),
  26892. t.maxSize - (t.maxSize - t.minSize) * gn.smoothstep(e, t.nearBound, t.farBound)),
  26893. Lp.copy(t.position).project(t.camera),
  26894. Rp.set(t.resolution.x / 2, t.resolution.y / 2, 1).multiply(Lp),
  26895. Fp.set(Bp / 2, 0, 0).add(Rp),
  26896. Ip.set(2 / t.resolution.x, 2 / t.resolution.y, 1).multiply(Fp),
  26897. Op.copy(Ip).unproject(t.camera),
  26898. Op.distanceTo(t.position)
  26899. }
  26900. ),
  26901. getCrossPointAtRect: function(e, t, n, i, r, a) {
  26902. var o = (t.x - e.x) / (t.y - e.y)
  26903. , n = t.x >= e.x ? n + r : r
  26904. , r = n;
  26905. return ((n = 1 / o * (r - e.x) + e.y) < a || a + i < n) && (r = o * ((n = n < a ? a : a + i) - e.y) + e.x),
  26906. new yn(r,n)
  26907. },
  26908. getDirFromUV: function(e) {
  26909. var t = Math.cos(e.y * Math.PI)
  26910. , n = 2 * Math.PI * e.x - Math.PI
  26911. , i = (Math.PI,
  26912. -Math.PI / 2 <= n && n < Math.PI / 2 ? 1 : -1)
  26913. , e = Math.tan(n)
  26914. , n = Math.sqrt((1 - t * t) / (1 + e * e))
  26915. , e = e * n;
  26916. return n * i < 0 && (n *= -1,
  26917. e *= -1),
  26918. this.convertVector.YupToZup(new Cn(e *= -1,t,n))
  26919. },
  26920. getUVfromDir: function(e) {
  26921. (e = this.convertVector.ZupToYup(e)).x *= -1;
  26922. var t = Math.atan2(e.x, e.z) / (2 * Math.PI) + .5
  26923. , e = Math.acos(e.y) / Math.PI;
  26924. return new yn(t,e)
  26925. },
  26926. getDirByLonLat: function(e, t) {
  26927. var n = new Cn
  26928. , t = gn.degToRad(90 - t)
  26929. , e = gn.degToRad(e);
  26930. return n.x = Math.sin(t) * Math.cos(e),
  26931. n.y = Math.cos(t),
  26932. n.z = Math.sin(t) * Math.sin(e),
  26933. n
  26934. },
  26935. projectPointAtPlane: function() {
  26936. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  26937. return (e = new ki).setFromCoplanarPoints.apply(e, Q(t.facePoints)).projectPoint(t.point, new Cn)
  26938. },
  26939. getPolygonsMixedRings: function(e, t) {
  26940. var n = []
  26941. , r = []
  26942. , a = 0;
  26943. return e.forEach(function(e) {
  26944. return n.push.apply(n, Q(e.map(function(e) {
  26945. return (new yn).copy(e)
  26946. })))
  26947. }),
  26948. e.forEach(function(e, t) {
  26949. for (var n = e.length, i = 0; i < n; )
  26950. r.push({
  26951. p1: i + a,
  26952. p2: (i + 1) % n + a
  26953. }),
  26954. i++;
  26955. a += n
  26956. }),
  26957. n.forEach(function(e, t) {
  26958. e.id = t
  26959. }),
  26960. kp({
  26961. points: n,
  26962. lines: r,
  26963. onlyGetOutRing: t
  26964. }).filter(function(e) {
  26965. return null == e.closetParent
  26966. })
  26967. },
  26968. getQuaFromPosAim: function(e, t) {
  26969. t = (new ni).lookAt(e, t, new Cn(0,0,1));
  26970. return (new Sn).setFromRotationMatrix(t)
  26971. },
  26972. getBoundByPoints: function(e, t) {
  26973. var n = new kn;
  26974. e.forEach(function(e) {
  26975. n.expandByPoint(e)
  26976. });
  26977. e = n.getCenter(new Cn);
  26978. return t && (t = (new kn).setFromCenterAndSize(e, t),
  26979. n.union(t)),
  26980. {
  26981. bounding: n,
  26982. size: n.getSize(new Cn),
  26983. center: e
  26984. }
  26985. }
  26986. };
  26987. Potree.math = Up,
  26988. "performance"in window == 0 && (window.performance = {}),
  26989. "now"in window.performance == 0 && (zp = Date.now(),
  26990. performance.timing && performance.timing.navigationStart && (zp = performance.timing.navigationStart),
  26991. window.performance.now = function() {
  26992. return Date.now() - zp
  26993. }
  26994. );
  26995. var Gp = {
  26996. config: {
  26997. withCredentials: !(ps.prototype.paramThreeToGL = function(e) {
  26998. var t, n = this.extensions, i = this.getContext();
  26999. if (e === ke)
  27000. return i.REPEAT;
  27001. if (e === Be)
  27002. return i.CLAMP_TO_EDGE;
  27003. if (e === Le)
  27004. return i.MIRRORED_REPEAT;
  27005. if (e === Re)
  27006. return i.NEAREST;
  27007. if (1004 === e)
  27008. return i.NEAREST_MIPMAP_NEAREST;
  27009. if (1005 === e)
  27010. return i.NEAREST_MIPMAP_LINEAR;
  27011. if (e === Oe)
  27012. return i.LINEAR;
  27013. if (1007 === e)
  27014. return i.LINEAR_MIPMAP_NEAREST;
  27015. if (e === G)
  27016. return i.LINEAR_MIPMAP_LINEAR;
  27017. if (e === Ue)
  27018. return i.UNSIGNED_BYTE;
  27019. if (e === Je)
  27020. return i.UNSIGNED_SHORT_4_4_4_4;
  27021. if (e === Ye)
  27022. return i.UNSIGNED_SHORT_5_5_5_1;
  27023. if (e === Ze)
  27024. return i.UNSIGNED_SHORT_5_6_5;
  27025. if (e === Ge)
  27026. return i.BYTE;
  27027. if (e === He)
  27028. return i.SHORT;
  27029. if (e === Ve)
  27030. return i.UNSIGNED_SHORT;
  27031. if (e === je)
  27032. return i.INT;
  27033. if (e === We)
  27034. return i.UNSIGNED_INT;
  27035. if (e === Xe)
  27036. return i.FLOAT;
  27037. if (null !== (t = n.get("OES_texture_half_float")) && e === qe)
  27038. return t.HALF_FLOAT_OES;
  27039. if (e === Ke)
  27040. return i.ALPHA;
  27041. if (e === $e)
  27042. return i.RGB;
  27043. if (e === et)
  27044. return i.RGBA;
  27045. if (e === tt)
  27046. return i.LUMINANCE;
  27047. if (e === nt)
  27048. return i.LUMINANCE_ALPHA;
  27049. if (e === re)
  27050. return i.FUNC_ADD;
  27051. if (e === ae)
  27052. return i.FUNC_SUBTRACT;
  27053. if (e === oe)
  27054. return i.FUNC_REVERSE_SUBTRACT;
  27055. if (e === de)
  27056. return i.ZERO;
  27057. if (e === he)
  27058. return i.ONE;
  27059. if (e === pe)
  27060. return i.SRC_COLOR;
  27061. if (e === fe)
  27062. return i.ONE_MINUS_SRC_COLOR;
  27063. if (e === me)
  27064. return i.SRC_ALPHA;
  27065. if (e === ve)
  27066. return i.ONE_MINUS_SRC_ALPHA;
  27067. if (e === ge)
  27068. return i.DST_ALPHA;
  27069. if (e === ye)
  27070. return i.ONE_MINUS_DST_ALPHA;
  27071. if (e === we)
  27072. return i.DST_COLOR;
  27073. if (e === be)
  27074. return i.ONE_MINUS_DST_COLOR;
  27075. if (e === xe)
  27076. return i.SRC_ALPHA_SATURATE;
  27077. if (null !== (t = n.get("WEBGL_compressed_texture_s3tc"))) {
  27078. if (e === ht)
  27079. return t.COMPRESSED_RGB_S3TC_DXT1_EXT;
  27080. if (e === pt)
  27081. return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;
  27082. if (e === ft)
  27083. return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;
  27084. if (e === mt)
  27085. return t.COMPRESSED_RGBA_S3TC_DXT5_EXT
  27086. }
  27087. if (null !== (t = n.get("WEBGL_compressed_texture_pvrtc"))) {
  27088. if (e === vt)
  27089. return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
  27090. if (e === gt)
  27091. return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
  27092. if (e === yt)
  27093. return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
  27094. if (e === wt)
  27095. return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
  27096. }
  27097. if (null !== (t = n.get("WEBGL_compressed_texture_etc1")) && e === bt)
  27098. return t.COMPRESSED_RGB_ETC1_WEBGL;
  27099. if (null !== (t = n.get("EXT_blend_minmax"))) {
  27100. if (e === se)
  27101. return t.MIN_EXT;
  27102. if (e === ce)
  27103. return t.MAX_EXT
  27104. }
  27105. return 0
  27106. }
  27107. ),
  27108. customHeaders: [{
  27109. header: null,
  27110. value: null
  27111. }]
  27112. },
  27113. createXMLHttpRequest: function() {
  27114. var e, t, n = new XMLHttpRequest;
  27115. return this.config.customHeaders && Array.isArray(this.config.customHeaders) && 0 < this.config.customHeaders.length && (e = n.open,
  27116. t = this.config.customHeaders,
  27117. n.open = function() {
  27118. e.apply(this, [].slice.call(arguments)),
  27119. t.forEach(function(e) {
  27120. e.header && e.value && n.setRequestHeader(e.header, e.value)
  27121. })
  27122. }
  27123. ),
  27124. n
  27125. }
  27126. }
  27127. , Hp = {
  27128. "pointcloud.vs": '\nprecision highp float;\nprecision highp int;\n\n#define max_clip_polygons 8\n#define PI 3.141592653589793\n\n \n\n\n\n#if defined(usePanoMap) \n \n uniform samplerCube pano0Map; //随便设置一个samplerCube去使用都会让点云消失\n uniform samplerCube pano1Map;\n \n uniform float progress;\n uniform float easeInOutRatio;\n\n \n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix; \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n /*\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n */\n#endif \n\n\n\n\n \n\n//--------------\n\n\n\n\n\nattribute vec3 position;\nattribute vec3 color;\nattribute float intensity;\nattribute float classification;\nattribute float returnNumber;\nattribute float numberOfReturns;\nattribute float pointSourceID;\nattribute vec4 indices; //每个点的index\nattribute float spacing;\nattribute float gpsTime;\nattribute vec3 normal;\nattribute float aExtra;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\n\n//uniform float uScreenWidth;\n//uniform float uScreenHeight;\nuniform vec2 resolution;\n\n\nuniform float fov;\nuniform float near;\nuniform float far;\n\n\n\n\nuniform bool uDebug;\n\nuniform bool uUseOrthographicCamera;\nuniform float uOrthoWidth;\nuniform float uOrthoHeight;\n\n#define CLIPTASK_NONE 0\n#define CLIPTASK_HIGHLIGHT 1\n#define CLIPTASK_SHOW_INSIDE 2\n#define CLIPTASK_SHOW_OUTSIDE 3\n\n#define CLIPMETHOD_INSIDE_ANY 0\n#define CLIPMETHOD_INSIDE_ALL 1\n\nuniform int clipTask;\nuniform int clipMethod;\n#if defined(num_clipboxes) && num_clipboxes > 0\n\tuniform mat4 clipBoxes[num_clipboxes];\n#endif\n\n#if defined(num_clipspheres) && num_clipspheres > 0\n\tuniform mat4 uClipSpheres[num_clipspheres];\n#endif\n\n#if defined(num_clippolygons) && num_clippolygons > 0\n\tuniform int uClipPolygonVCount[num_clippolygons];\n\tuniform vec3 uClipPolygonVertices[num_clippolygons * 8];\n\tuniform mat4 uClipPolygonWVP[num_clippolygons];\n#endif\n\n\nuniform float size;\nuniform float minSize;\nuniform float maxSize;\n\nuniform float uPCIndex;\nuniform float uOctreeSpacing;\nuniform float uNodeSpacing;\nuniform float uOctreeSize;\nuniform vec3 uBBSize;\nuniform float uLevel;\nuniform float uVNStart;\nuniform bool uIsLeafNode;\n\nuniform vec3 uColor;\nuniform float uOpacity; \nvarying float vOpacity; //add\n\n\n\nuniform vec2 elevationRange;\nuniform vec2 intensityRange;\n\nuniform vec2 uFilterReturnNumberRange;\nuniform vec2 uFilterNumberOfReturnsRange;\nuniform vec2 uFilterPointSourceIDClipRange;\nuniform vec2 uFilterGPSTimeClipRange;\n//uniform float ufilterByNormalThreshold; \n\nuniform float uGpsScale;\nuniform float uGpsOffset;\n\nuniform vec2 uNormalizedGpsBufferRange;\n\nuniform vec3 uIntensity_gbc;\nuniform vec3 uRGB_gbc;\nuniform vec3 uExtra_gbc;\n\nuniform float uTransition;\nuniform float wRGB;\nuniform float wIntensity;\nuniform float wElevation;\nuniform float wClassification;\nuniform float wReturnNumber;\nuniform float wSourceID;\n\nuniform vec2 uExtraNormalizedRange;\nuniform vec2 uExtraRange;\nuniform float uExtraScale;\nuniform float uExtraOffset;\n\nuniform vec3 uShadowColor;\n\nuniform sampler2D visibleNodes;\nuniform sampler2D gradient;\nuniform sampler2D classificationLUT;\n\n#if defined(color_type_matcap)\nuniform sampler2D matcapTextureUniform;\n#endif\nuniform bool backfaceCulling;\n\n#if defined(num_shadowmaps) && num_shadowmaps > 0\nuniform sampler2D uShadowMap[num_shadowmaps];\nuniform mat4 uShadowWorldView[num_shadowmaps];\nuniform mat4 uShadowProj[num_shadowmaps];\n#endif\n\n\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float \tvRadius;\nvarying float \tvPointSize;\n\n\nfloat round(float number){\n\treturn floor(number + 0.5);\n}\n\n// \n// ### ######## ### ######## ######## #### ## ## ######## ###### #### ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ######## ## ## ## ## ###### ###### ## ## ###### ###### \n// ######### ## ## ######### ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ######## ## ## ## ## #### ### ######## ###### #### ######## ######## ###### \n// \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_octree)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nint numberOfOnes(int number, int index){\n\tint numOnes = 0;\n\tint tmp = 128;\n\tfor(int i = 7; i >= 0; i--){\n\t\t\n\t\tif(number >= tmp){\n\t\t\tnumber = number - tmp;\n\n\t\t\tif(i <= index){\n\t\t\t\tnumOnes++;\n\t\t\t}\n\t\t}\n\t\t\n\t\ttmp = tmp / 2;\n\t}\n\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(int number, int index){\n\n\t// weird multi else if due to lack of proper array, int and bitwise support in WebGL 1.0\n\tint powi = 1;\n\tif(index == 0){\n\t\tpowi = 1;\n\t}else if(index == 1){\n\t\tpowi = 2;\n\t}else if(index == 2){\n\t\tpowi = 4;\n\t}else if(index == 3){\n\t\tpowi = 8;\n\t}else if(index == 4){\n\t\tpowi = 16;\n\t}else if(index == 5){\n\t\tpowi = 32;\n\t}else if(index == 6){\n\t\tpowi = 64;\n\t}else if(index == 7){\n\t\tpowi = 128;\n\t}else{\n\t\treturn false;\n\t}\n\n\tint ndp = number / powi;\n\n\treturn mod(float(ndp), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){//////\n\t \n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\t//return value.a * 255.0;\n\n\t\t\tfloat lodOffset = (255.0 * value.a) / 10.0 - 10.0;\n\n\t\t\treturn depth + lodOffset;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\nfloat getSpacing(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfloat spacing = uNodeSpacing;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\t\tfloat spacingFactor = value.a;\n\n\t\tif(i > 0.0){\n\t\t\tspacing = spacing / (255.0 * spacingFactor);\n\t\t}\n\t\t\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\n\t\t\t//spacing = spacing / (255.0 * spacingFactor);\n\t\t\t//spacing = spacing / 3.0;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn spacing;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn spacing;\n}\n\nfloat getPointSizeAttenuation(){\n\treturn pow(2.0, getLOD());\n}\n\n\n#endif\n\n\n// ---------------------\n// KD-TREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_kdtree)\n\nfloat getLOD(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = 0.0;\n\tfloat depth = 0.0;\n\t\t\n\t\t\n\tvec3 size = uBBSize;\t\n\tvec3 pos = position;\n\t\t\n\tfor(float i = 0.0; i <= 1000.0; i++){\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\t\n\t\tint children = int(value.r * 255.0);\n\t\tfloat next = value.g * 255.0;\n\t\tint split = int(value.b * 255.0);\n\t\t\n\t\tif(next == 0.0){\n\t\t \treturn depth;\n\t\t}\n\t\t\n\t\tvec3 splitv = vec3(0.0, 0.0, 0.0);\n\t\tif(split == 1){\n\t\t\tsplitv.x = 1.0;\n\t\t}else if(split == 2){\n\t\t \tsplitv.y = 1.0;\n\t\t}else if(split == 4){\n\t\t \tsplitv.z = 1.0;\n\t\t}\n\t\t\n\t\tiOffset = iOffset + next;\n\t\t\n\t\tfloat factor = length(pos * splitv / size);\n\t\tif(factor < 0.5){\n\t\t\t// left\n\t\tif(children == 0 || children == 2){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t}else{\n\t\t\t// right\n\t\t\tpos = pos - size * splitv * 0.5;\n\t\t\tif(children == 0 || children == 1){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t\tif(children == 3){\n\t\t\t\tiOffset = iOffset + 1.0;\n\t\t\t}\n\t\t}\n\t\tsize = size * ((1.0 - (splitv + 1.0) / 2.0) + 0.5);\n\t\t\n\t\tdepth++;\n\t}\n\t\t\n\t\t\n\treturn depth;\t\n}\n\nfloat getPointSizeAttenuation(){\n\treturn 0.5 * pow(1.3, getLOD());\n}\n\n#endif\n\n\n\n// \n// ### ######## ######## ######## #### ######## ## ## ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ######## ## ######## ## ## ## ###### ###### \n// ######### ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## #### ######## ####### ## ######## ###### \n// \n\n\n\n// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/\nfloat getContrastFactor(float contrast){\n\treturn (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);\n}\n\nvec3 getRGB(){\n\tvec3 rgb = color;\n\t\n\trgb = pow(rgb, vec3(uRGB_gbc.x));\n\trgb = rgb + uRGB_gbc.y;\n\trgb = (rgb - 0.5) * getContrastFactor(uRGB_gbc.z) + 0.5;\n\trgb = clamp(rgb, 0.0, 1.0);\n\n\treturn rgb;\n}\n\nfloat getIntensity(){\n\tfloat w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);\n\tw = pow(w, uIntensity_gbc.x);\n\tw = w + uIntensity_gbc.y;\n\tw = (w - 0.5) * getContrastFactor(uIntensity_gbc.z) + 0.5;\n\tw = clamp(w, 0.0, 1.0);\n\n\treturn w;\n}\n\nvec3 getGpsTime(){\n\n\tfloat w = (gpsTime + uGpsOffset) * uGpsScale;\n\n\n\tvec3 c = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\n\t// vec2 r = uNormalizedGpsBufferRange;\n\t// float w = gpsTime * (r.y - r.x) + r.x;\n\t// w = clamp(w, 0.0, 1.0);\n\t// vec3 c = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn c;\n}\n\nvec3 getElevation(){\n\tvec4 world = modelMatrix * vec4( position, 1.0 );\n\tfloat w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);\n\tvec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn cElevation;\n}\n\nvec4 getClassification(){\n\tvec2 uv = vec2(classification / 255.0, 0.5);\n\tvec4 classColor = texture2D(classificationLUT, uv);\n\t\n\treturn classColor;\n}\n\nvec3 getReturns(){\n\n\t// 0b 00_000_111\n\tfloat rn = mod(returnNumber, 8.0);\n\t// 0b 00_111_000\n\tfloat nr = mod(returnNumber / 8.0, 8.0);\n\n\tif(nr <= 1.0){\n\t\treturn vec3(1.0, 0.0, 0.0);\n\t}else{\n\t\treturn vec3(0.0, 1.0, 0.0);\n\t}\n\n\t// return vec3(nr / 4.0, 0.0, 0.0);\n\n\t// if(nr == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(rn == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(rn == nr){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n\n\t// if(numberOfReturns == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(returnNumber == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(returnNumber == numberOfReturns){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n}\n\nvec3 getReturnNumber(){\n\tif(numberOfReturns == 1.0){\n\t\treturn vec3(1.0, 1.0, 0.0);\n\t}else{\n\t\tif(returnNumber == 1.0){\n\t\t\treturn vec3(1.0, 0.0, 0.0);\n\t\t}else if(returnNumber == numberOfReturns){\n\t\t\treturn vec3(0.0, 0.0, 1.0);\n\t\t}else{\n\t\t\treturn vec3(0.0, 1.0, 0.0);\n\t\t}\n\t}\n}\n\nvec3 getNumberOfReturns(){\n\tfloat value = numberOfReturns;\n\n\tfloat w = value / 6.0;\n\n\tvec3 color = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\treturn color;\n}\n\nvec3 getSourceID(){\n\tfloat w = mod(pointSourceID, 10.0) / 10.0;\n\treturn texture2D(gradient, vec2(w,1.0 - w)).rgb;\n}\n\nvec3 getCompositeColor(){\n\tvec3 c;\n\tfloat w;\n\n\tc += wRGB * getRGB();\n\tw += wRGB;\n\t\n\tc += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);\n\tw += wIntensity;\n\t\n\tc += wElevation * getElevation();\n\tw += wElevation;\n\t\n\tc += wReturnNumber * getReturnNumber();\n\tw += wReturnNumber;\n\t\n\tc += wSourceID * getSourceID();\n\tw += wSourceID;\n\t\n\tvec4 cl = wClassification * getClassification();\n\tc += cl.a * cl.rgb;\n\tw += wClassification * cl.a;\n\n\tc = c / w;\n\t\n\tif(w == 0.0){\n\t\t//c = color;\n\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t}\n\t\n\treturn c;\n}\n\n\nvec3 getNormal(){\n\t//vec3 n_hsv = vec3( modelMatrix * vec4( normal, 0.0 )) * 0.5 + 0.5; // (n_world.xyz + vec3(1.,1.,1.)) / 2.;\n\tvec3 n_view = normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\treturn n_view;\n}\nbool applyBackfaceCulling() {\n\t// Black not facing vertices / Backface culling\n \n\tvec3 e = normalize(vec3(modelViewMatrix * vec4( position, 1. )));\n\tvec3 n = getNormal(); // normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\n\tif((uUseOrthographicCamera && n.z <= 0.) || (!uUseOrthographicCamera && dot( n, e ) >= 0.)) { \n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}\n\n#if defined(color_type_matcap)\n// Matcap Material\nvec3 getMatcap(){ \n\tvec3 eye = normalize( vec3( modelViewMatrix * vec4( position, 1. ) ) ); \n\tif(uUseOrthographicCamera) { \n\t\teye = vec3(0., 0., -1.);\n\t}\n\tvec3 r_en = reflect( eye, getNormal() ); // or r_en = e - 2. * dot( n, e ) * n;\n\tfloat m = 2. * sqrt(pow( r_en.x, 2. ) + pow( r_en.y, 2. ) + pow( r_en.z + 1., 2. ));\n\tvec2 vN = r_en.xy / m + .5;\n\treturn texture2D(matcapTextureUniform, vN).rgb; \n}\n#endif\n\nvec3 getExtra(){\n\n\tfloat w = (aExtra + uExtraOffset) * uExtraScale;\n\tw = clamp(w, 0.0, 1.0);\n\n\tvec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\t// vec2 r = uExtraNormalizedRange;\n\n\t// float w = aExtra * (r.y - r.x) + r.x;\n\n\t// w = (w - uExtraRange.x) / (uExtraRange.y - uExtraRange.x);\n\n\t// w = clamp(w, 0.0, 1.0);\n\n\t// vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\treturn color;\n}\n\nvec3 getColor(){\n\tvec3 color;\n\t\n\t#ifdef color_type_rgba\n\t\tcolor = getRGB();\n \n \n\t#elif defined color_type_height || defined color_type_elevation\n\t\tcolor = getElevation();\n\t#elif defined color_type_rgb_height\n\t\tvec3 cHeight = getElevation();\n\t\tcolor = (1.0 - uTransition) * getRGB() + uTransition * cHeight;\n\t#elif defined color_type_depth\n\t\tfloat linearDepth = gl_Position.w;\n\t\tfloat expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;\n\t\tcolor = vec3(linearDepth, expDepth, 0.0);\n\t\t//color = vec3(1.0, 0.5, 0.3);\n\t#elif defined color_type_intensity\n\t\tfloat w = getIntensity();\n\t\tcolor = vec3(w, w, w);\n\t#elif defined color_type_gps_time\n\t\tcolor = getGpsTime();\n\t#elif defined color_type_intensity_gradient\n\t\tfloat w = getIntensity();\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_color\n\t\tcolor = uColor;\n\t#elif defined color_type_level_of_detail\n\t\tfloat depth = getLOD();\n\t\tfloat w = depth / 10.0;\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_indices\n\t\tcolor = indices.rgb;\n\t#elif defined color_type_classification\n\t\tvec4 cl = getClassification(); \n\t\tcolor = cl.rgb;\n\t#elif defined color_type_return_number\n\t\tcolor = getReturnNumber();\n\t#elif defined color_type_returns\n\t\tcolor = getReturns();\n\t#elif defined color_type_number_of_returns\n\t\tcolor = getNumberOfReturns();\n\t#elif defined color_type_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_point_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_normal\n\t\tcolor = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#elif defined color_type_phong\n\t\tcolor = color;\n\t#elif defined color_type_composite\n\t\tcolor = getCompositeColor();\n\t#elif defined color_type_matcap\n\t\tcolor = getMatcap();\n\t#else \n\t\tcolor = getExtra();\n\t#endif\n\t\n\tif (backfaceCulling && applyBackfaceCulling()){\n //color = vec3(0.);\n }\n //applyBackfaceCulling直接返回false或者注释color = vec3(0.);都没问题\n\treturn color;\n}\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * resolution.y / (slope * vViewPosition.z);\n \n \n \n /*\n\tfloat scale = length(\n\t\tmodelViewMatrix * vec4(0, 0, 0, 1) - \n\t\tmodelViewMatrix * vec4(uOctreeSpacing, 0, 0, 1)\n\t) / uOctreeSpacing;\n \n\tprojFactor = projFactor * scale;\n\t*/\n \n \n\tfloat r = uOctreeSpacing * 1.7;\n\t//vRadius = r;\n \n \n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size * 10.0; //加个乘数\n\t\t}else{ //近大远小,模拟真实mesh,边缘放大\n\t\t\t//pointSize = size * spacing * projFactor; //spacing是attribute 为空 如果有这个值就能更自适应填补\n //pointSize = size * uOctreeSpacing * projFactor / 18.0; //直接用cloud的spacing里,不过因为都一样所以可能没有什么意义\n\t\t\t//pointSize = pointSize * projFactor;\n pointSize = size * projFactor ;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * resolution.x; //uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n#if defined(num_clippolygons) && num_clippolygons > 0\nbool pointInClipPolygon(vec3 point, int polyIdx) {\n\n\tmat4 wvp = uClipPolygonWVP[polyIdx];\n\t//vec4 screenClipPos = uClipPolygonVP[polyIdx] * modelMatrix * vec4(point, 1.0);\n\t//screenClipPos.xy = screenClipPos.xy / screenClipPos.w * 0.5 + 0.5;\n\n\tvec4 pointNDC = wvp * vec4(point, 1.0);\n\tpointNDC.xy = pointNDC.xy / pointNDC.w;\n\n\tint j = uClipPolygonVCount[polyIdx] - 1;\n\tbool c = false;\n\tfor(int i = 0; i < 8; i++) {\n\t\tif(i == uClipPolygonVCount[polyIdx]) {\n\t\t\tbreak;\n\t\t}\n\n\t\t//vec4 verti = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + i], 1);\n\t\t//vec4 vertj = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + j], 1);\n\n\t\t//verti.xy = verti.xy / verti.w;\n\t\t//vertj.xy = vertj.xy / vertj.w;\n\n\t\t//verti.xy = verti.xy / verti.w * 0.5 + 0.5;\n\t\t//vertj.xy = vertj.xy / vertj.w * 0.5 + 0.5;\n\n\t\tvec3 verti = uClipPolygonVertices[polyIdx * 8 + i];\n\t\tvec3 vertj = uClipPolygonVertices[polyIdx * 8 + j];\n\n\t\tif( ((verti.y > pointNDC.y) != (vertj.y > pointNDC.y)) && \n\t\t\t(pointNDC.x < (vertj.x-verti.x) * (pointNDC.y-verti.y) / (vertj.y-verti.y) + verti.x) ) {\n\t\t\tc = !c;\n\t\t}\n\t\tj = i;\n\t}\n\n\treturn c;\n}\n#endif\n\nvoid doClipping(){\n\n\t{\n\t\tvec4 cl = getClassification(); \n\t\tif(cl.a == 0.0){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#if defined(clip_return_number_enabled)\n\t{ // return number filter\n\t\tvec2 range = uFilterReturnNumberRange;\n\t\tif(returnNumber < range.x || returnNumber > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_number_of_returns_enabled)\n\t{ // number of return filter\n\t\tvec2 range = uFilterNumberOfReturnsRange;\n\t\tif(numberOfReturns < range.x || numberOfReturns > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_gps_enabled)\n\t{ // GPS time filter\n\t\tfloat time = (gpsTime + uGpsOffset) * uGpsScale;\n\t\tvec2 range = uFilterGPSTimeClipRange;\n\n\t\tif(time < range.x || time > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_point_source_id_enabled)\n\t{ // point source id filter\n\t\tvec2 range = uFilterPointSourceIDClipRange;\n\t\tif(pointSourceID < range.x || pointSourceID > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\tint clipVolumesCount = 0;\n\tint insideCount = 0;\n\n\t#if defined(num_clipboxes) && num_clipboxes > 0\n\t\tfor(int i = 0; i < num_clipboxes; i++){\n\t\t\tvec4 clipPosition = clipBoxes[i] * modelMatrix * vec4( position, 1.0 );\n\t\t\tbool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\t\n\t#endif\n\n\t#if defined(num_clippolygons) && num_clippolygons > 0\n\t\tfor(int i = 0; i < num_clippolygons; i++) {\n\t\t\tbool inside = pointInClipPolygon(position, i);\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\n\t#endif\n\n\tbool insideAny = insideCount > 0;\n\tbool insideAll = (clipVolumesCount > 0) && (clipVolumesCount == insideCount);\n\n\tif(clipMethod == CLIPMETHOD_INSIDE_ANY){\n\t\tif(insideAny && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAny && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAny && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}else if(clipMethod == CLIPMETHOD_INSIDE_ALL){\n\t\tif(insideAll && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAll && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAll && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}\n}\n\n\n\n// \n// ## ## ### #### ## ## \n// ### ### ## ## ## ### ## \n// #### #### ## ## ## #### ## \n// ## ### ## ## ## ## ## ## ## \n// ## ## ######### ## ## #### \n// ## ## ## ## ## ## ### \n// ## ## ## ## #### ## ## \n//\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\n\nvoid main() {\n //bool filtered_by_normal = false; \n float normalZ = 0.0;\n\n\n\n #ifdef use_filter_by_normal\n /*if(abs(getNormal().z) > 0.4) { //ufilterByNormalThreshold 暂定 3\n\t\t\t// Move point outside clip space space to discard it.\n\t\t\t//gl_Position = vec4(0.0, 0.0, 2.0, 1.0); //gl_Position的可视区域是 x,y,z都是[-1,1] \n //return;\n //filtered_by_normal = true; //标记一下。不直接不绘制,因为有的法线都是垂直向上\n \n\t\t}*/\n \n normalZ = abs(getNormal().z);\n #endif\n \n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );\n vViewPosition = mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n vLogDepth = log2(-mvPosition.z);\n \n \n \n // COLOR\n //加-------------------\n #if defined(usePanoMap)\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz; \n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vec3 vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz; \n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /*\n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0 = texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);\n */\n \n \n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n\n vColor = mix(colorFromPano0,colorFromPano1,progress).xyz; \n\n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }\n \n\n #else\n \n vColor = getColor();\n \n #endif\n \n \n //------------------- \n \n #ifdef attenuated_opacity \n //zoom不会改变z 所以这并不是用在分屏时候的\n //vOpacity = uOpacity * exp(-length(-mvPosition.xyz) / 1000.0); // e为底的指数函数 opacityAttenuation = 1000\n vOpacity = uOpacity * exp(gl_Position.z/50.0); \n vOpacity = clamp(vOpacity, 0.001, 1.0); \n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.2; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n } */ \n #else\n vOpacity = uOpacity;\n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.3; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n }*/ \n \n vOpacity *= max(0.1, (1.0 - normalZ));\n #endif\n\t \n\n // POINT SIZE\n float pointSize = getPointSize();\n \n gl_PointSize = pointSize;\n vPointSize = pointSize;\n\n \n \n \n \n\n // only for "replacing" approaches\n // if(getLOD() != uLevel){\n // \tgl_Position = vec4(10.0, 10.0, 10.0, 1.0);\n // }\n\n\n #if defined hq_depth_pass\n float originalDepth = gl_Position.w;\n float adjustedDepth = originalDepth + 2.0 * vRadius;\n float adjust = adjustedDepth / originalDepth;\n\n mvPosition.xyz = mvPosition.xyz * adjust;\n gl_Position = projectionMatrix * mvPosition;\n #endif\n\n\n // CLIPPING\n doClipping();\n\n #if defined(num_clipspheres) && num_clipspheres > 0\n for(int i = 0; i < num_clipspheres; i++){\n vec4 sphereLocal = uClipSpheres[i] * mvPosition;\n\n float distance = length(sphereLocal.xyz);\n\n if(distance < 1.0){\n float w = distance;\n vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n \n vColor = cGradient;\n //vColor = cGradient * 0.7 + vColor * 0.3;\n }\n }\n #endif\n\n #if defined(num_shadowmaps) && num_shadowmaps > 0\n\n const float sm_near = 0.1;\n const float sm_far = 10000.0;\n\n for(int i = 0; i < num_shadowmaps; i++){\n vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;\n float distanceToLight = abs(viewPos.z);\n \n vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);\n vec3 nc = projPos.xyz / projPos.w;\n \n float u = nc.x * 0.5 + 0.5;\n float v = nc.y * 0.5 + 0.5;\n\n vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;\n vec2 sampleLocations[9];\n sampleLocations[0] = vec2(0.0, 0.0);\n sampleLocations[1] = sampleStep;\n sampleLocations[2] = -sampleStep;\n sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);\n sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);\n\n sampleLocations[5] = vec2(0.0, sampleStep.y);\n sampleLocations[6] = vec2(0.0, -sampleStep.y);\n sampleLocations[7] = vec2(sampleStep.x, 0.0);\n sampleLocations[8] = vec2(-sampleStep.x, 0.0);\n\n float visibleSamples = 0.0;\n float numSamples = 0.0;\n\n float bias = vRadius * 2.0;\n\n for(int j = 0; j < 9; j++){\n vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);\n\n float linearDepthFromSM = depthMapValue.x + bias;\n float linearDepthFromViewer = distanceToLight;\n\n if(linearDepthFromSM > linearDepthFromViewer){\n visibleSamples += 1.0;\n }\n\n numSamples += 1.0;\n }\n\n float visibility = visibleSamples / numSamples;\n\n if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){\n //vColor = vec3(0.0, 0.0, 0.2);\n }else{\n //vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);\n vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);\n }\n\n\n }\n\n #endif\n\n \n \n}\n',
  27129. "pointcloud.fs": "\n#if defined paraboloid_point_shape\n\t#extension GL_EXT_frag_depth : enable\n#endif\n#define PI 3.141592653589793\n\n\n\nprecision highp float;\nprecision highp int;\n\n/*\n#if defined(usePanoMap) \n \n uniform samplerCube pano0Map; //随便设置一个samplerCube去使用都会让点云消失\n uniform samplerCube pano1Map;\n \n uniform float progress;\n uniform float easeInOutRatio;\n\n \n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix; \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n#endif \n*/\n\n\n\n//------------\n\n\n\n\n\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\nuniform mat4 uProjInv;\nuniform vec3 cameraPosition;\n\n\nuniform mat4 projectionMatrix;\n//uniform float uOpacity;\nvarying float vOpacity; //add\n\nuniform float blendHardness;\nuniform float blendDepthSupplement;\nuniform float fov;\nuniform float uSpacing;\nuniform float near;\nuniform float far;\nuniform float uPCIndex;\nuniform float uScreenWidth;\nuniform float uScreenHeight;\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float\tvRadius;\nvarying float \tvPointSize;\nvarying vec3 \tvPosition;\n\n\nfloat specularStrength = 1.0;\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\n\n\n\nvoid main() {\n\n vec3 color = vColor; \n\t \n \n /*#if defined(usePanoMap) //加 经测试,即使全部写在fragment里也是无论pointsize多大都是一个点一个颜色,所以干脆写在vectex里\n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n color = mix(colorFromPano0,colorFromPano1,progress).xyz; \n \n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }\n \n \n #else \n color = vColor;\n #endif*/\n \n \n \n\tfloat depth = gl_FragCoord.z;\n\n\t#if defined(circle_point_shape) || defined(paraboloid_point_shape) \n\t\tfloat u = 2.0 * gl_PointCoord.x - 1.0;\n\t\tfloat v = 2.0 * gl_PointCoord.y - 1.0;\n\t#endif\n\t\n\t#if defined(circle_point_shape) \n\t\tfloat cc = u*u + v*v;\n\t\tif(cc > 1.0){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\t\n\n \n\n\t\n \n #if defined color_type_indices //pick point recognize\n\t\tgl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index\n\t#else\n\t\tgl_FragColor = vec4(color, vOpacity);\n\t#endif\n \n \n \n \n \n \n \n \n\n\t#if defined paraboloid_point_shape\n\t\tfloat wi = 0.0 - ( u*u + v*v);\n\t\tvec4 pos = vec4(vViewPosition, 1.0);\n\t\tpos.z += wi * vRadius;\n\t\tfloat linearDepth = -pos.z;\n\t\tpos = projectionMatrix * pos;\n\t\tpos = pos / pos.w;\n\t\tfloat expDepth = pos.z;\n\t\tdepth = (pos.z + 1.0) / 2.0;\n\t\tgl_FragDepthEXT = depth;\n\t\t\n\t\t#if defined(color_type_depth)\n\t\t\tcolor.r = linearDepth;\n\t\t\tcolor.g = expDepth;\n\t\t#endif\n\t\t\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = log2(linearDepth);\n\t\t#endif\n\t\t\n\t#else\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = vLogDepth;\n\t\t#endif\n\t#endif\n\n\t#if defined(weighted_splats)\n\t\tfloat distance = 2.0 * length(gl_PointCoord.xy - 0.5);\n\t\tfloat weight = max(0.0, 1.0 - distance);\n\t\tweight = pow(weight, 1.5);\n\n\t\tgl_FragColor.a = weight;\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * weight;\n\t#endif\n\n\t//gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);\n\t\n}\n\n\n",
  27130. "pointcloud_sm.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec3 color;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\n\nuniform float uScreenWidth;\nuniform float uScreenHeight;\nuniform float near;\nuniform float far;\n\nuniform float uSpacing;\nuniform float uOctreeSize;\nuniform float uLevel;\nuniform float uVNStart;\n\nuniform sampler2D visibleNodes;\n\nvarying float vLinearDepth;\nvarying vec3 vColor;\n\n#define PI 3.141592653589793\n\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if defined(adaptive_point_size)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nfloat numberOfOnes(float number, float index){\n\tfloat tmp = mod(number, pow(2.0, index + 1.0));\n\tfloat numOnes = 0.0;\n\tfor(float i = 0.0; i < 8.0; i++){\n\t\tif(mod(tmp, 2.0) != 0.0){\n\t\t\tnumOnes++;\n\t\t}\n\t\ttmp = floor(tmp / 2.0);\n\t}\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(float number, float index){\n\treturn mod(floor(number / pow(2.0, index)), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){\n\t\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = uVNStart;\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tfloat index = 4.0 * index3d.x + 2.0 * index3d.y + index3d.z;\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\tfloat mask = value.r * 255.0;\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tiOffset = iOffset + value.g * 255.0 * 256.0 + value.b * 255.0 + numberOfOnes(mask, index - 1.0);\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn depth;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\n#endif\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);\n\t\n\tfloat r = uOctreeSpacing * 1.5;\n\tvRadius = r;\n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size;\t\t\t\n\t\t}else{\n\t\t\tpointSize = pointSize * projFactor;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n\nvoid main() {\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tvLinearDepth = gl_Position.w;\n\n\tfloat pointSize = getPointSize();\n\tgl_PointSize = pointSize;\n\n}\n",
  27131. "pointcloud_sm.fs": "\nprecision mediump float;\nprecision mediump int;\n\nvarying vec3 vColor;\nvarying float vLinearDepth;\n\nvoid main() {\n\n\t//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\t//gl_FragColor = vec4(vColor, 1.0);\n\t//gl_FragColor = vec4(vLinearDepth, pow(vLinearDepth, 2.0), 0.0, 1.0);\n\tgl_FragColor = vec4(vLinearDepth, vLinearDepth / 30.0, vLinearDepth / 30.0, 1.0);\n\t\n}\n\n\n",
  27132. "normalize.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}",
  27133. "normalize.fs": "\n#extension GL_EXT_frag_depth : enable\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uDepthMap;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\t\n\tif(depth >= 1.0){\n\t\tdiscard;\n\t}\n\n\tgl_FragColor = vec4(depth, 1.0, 0.0, 1.0);\n\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\t\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\t\n\tgl_FragDepthEXT = depth;\n\n\n}",
  27134. "normalize_and_edl.fs": "\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uEDLMap;\nuniform sampler2D uDepthMap;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\n\nvarying vec2 vUv;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t\n\t\tfloat neighbourDepth = texture2D(uEDLMap, uvNeighbor).a;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\tif(depth == 0.0){\n\t\t\t\tsum += 100.0;\n\t\t\t}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main() {\n\n\tfloat edlDepth = texture2D(uEDLMap, vUv).a;\n\tfloat res = response(edlDepth);\n\tfloat shade = exp(-res * 300.0 * edlStrength);\n\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\tif(depth >= 1.0 && res == 0.0){\n\t\tdiscard;\n\t}\n\t\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\tcolor = color * shade;\n\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\n\tgl_FragDepthEXT = depth;\n}",
  27135. "edl.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\t\n\tvec4 mvPosition = modelViewMatrix * vec4(position,1.0);\n\n\tgl_Position = projectionMatrix * mvPosition;\n}",
  27136. "edl.fs": "\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\n//uniform float screenWidth;\n//uniform float screenHeight;\nuniform vec2 resolution;\n\n\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\nuniform float opacity;\n\n//uniform float uNear;\n//uniform float uFar;\n\nuniform mat4 uProj;\n\nuniform sampler2D uEDLColor;\nuniform sampler2D uEDLDepth;\n\nvarying vec2 vUv;\n\nuniform int useEDL;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / resolution; //vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t//获取周围八个格子的值\n\t\tfloat neighbourDepth = texture2D(uEDLColor, uvNeighbor).a;\n\t\tneighbourDepth = (neighbourDepth == 1.0) ? 0.0 : neighbourDepth;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\t//if(depth == 0.0){\n\t\t\t//\tsum += 100.0;\n\t\t\t//}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth); //获取差值\n\t\t\t//}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main(){\n\tvec4 cEDL = texture2D(uEDLColor, vUv);\n\t\n\tfloat depth = cEDL.a;\n\tdepth = (depth == 1.0) ? 0.0 : depth;\n \n if(depth == 0.0){ //去掉这句就能在无点云像素的地方渲染outline,但会遮住其他mesh\n\t\tdiscard;\n\t}\n \n \n if(useEDL == 1){\n float res = response(depth);\n \n //if(depth == 0.0 && res == 0.0){ //test\n // discard;\n //}\n \n float shade = exp(-res * 300.0 * edlStrength); //自然常数e为底的指数函数\n\n gl_FragColor = vec4(cEDL.rgb * shade, opacity); \n \n //const vec3 outlineColor = vec3(1.0,0.0,0.0);//test -outline\n //gl_FragColor = vec4(mix(cEDL.rgb, outlineColor, -res), opacity );\n }else{//加 不改颜色的情况 \n gl_FragColor = vec4(cEDL.rgb, opacity);\n } \n \n \n { // write regular hyperbolic depth values to depth buffer 修改深度\n float dl = pow(2.0, depth);\n\n vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);\n float pz = dp.z / dp.w;\n float fragDepth = (pz + 1.0) / 2.0;\n\n gl_FragDepthEXT = fragDepth;\n }\n\t\n}\n",
  27137. "blur.vs": "\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}",
  27138. "blur.fs": "\nuniform mat4 projectionMatrix;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float near;\nuniform float far;\n\nuniform sampler2D map;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tfloat dx = 1.0 / screenWidth;\n\tfloat dy = 1.0 / screenHeight;\n\n\tvec3 color = vec3(0.0, 0.0, 0.0);\n\tcolor += texture2D(map, vUv + vec2(-dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, dy)).rgb;\n\n\tcolor = color / 9.0;\n\t\n\tgl_FragColor = vec4(color, 1.0);\n}",
  27139. "depthBasic.vs": "\n \n\nvarying vec2 vUv;\nvoid main() {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ",
  27140. "depthBasic.fs": "varying vec2 vUv;\nuniform float opacity;\n\nuniform vec3 baseColor;\nuniform vec3 backColor;\nuniform float occlusionDistance;\nuniform float clipDistance;\nuniform float maxClipFactor;\n\n\n#if defined use_map\n uniform sampler2D map; \n#endif\n \n#if defined(GL_EXT_frag_depth) && defined(useDepth) \n //似乎通过gl.getExtension('EXT_frag_depth')得到的GL_EXT_frag_depth\n \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset; // viewportOffset 范围从0-整个画布的像素\n \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n#endif\n \nvoid main() {\n \n \n vec4 color = vec4(baseColor, opacity);\n \n \n \n #if defined(GL_EXT_frag_depth) && defined(useDepth)\n // mixFactor and clipFactor define the color mixing proportion between the states of\n // full visibility and occluded visibility\n // and\n // full visibility and total invisibility\n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n \n \n // The linear depth value of the current fragment\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n // The coordinates of the current fragment in the depth texture\n vec2 depthTxtCoords = vec2(gl_FragCoord.x-viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n \n // The linear depth value of the pixel occupied by this fragment in the depth buffer\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n // The difference between the two depths\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)//差距\n {\n // occlusionDistance and clipDistance define the width of the respective zones and\n // mixFactor and clipFactor express the interpolation between the two colors depending on the position\n // of the current fragment withing those zones.\n \n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n // If the fragment is totally transparent, don't bother drawing it\n if (clipFactor == 1.0)\n {\n discard;\n }else{\n \n #if defined use_map\n color = texture2D(map, vUv) * color; \n #endif\n \n \n \n color = vec4(mix(color.rgb, backColor, mixFactor), color.a * (1.0 - clipFactor));\n }\n \n #else\n #if defined use_map\n color = texture2D(map, vUv) * color;\n #endif \n #endif\n \n gl_FragColor = color;\n \n}\n",
  27141. "copyCubeMap.vs": "varying vec3 vWorldPos;\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n //vWorldPos = transformAxis(vWorldPos);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ",
  27142. "copyCubeMap.fs": "varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\n\n\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n} \n ",
  27143. "basicTextured.vs": "varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ",
  27144. "basicTextured.fs": "varying vec2 vUv;\nuniform float alpha;\nuniform sampler2D tDiffuse;\n\n\nvoid main() {\n vec4 texColor = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}\n"
  27145. }
  27146. , Vp = document.createElement("canvas")
  27147. , jp = function() {
  27148. var i = Vp.getContext("webgl") || Vp.getContext("experimental-webgl");
  27149. if (null === i)
  27150. return null;
  27151. var e = i.getShaderPrecisionFormat(i.VERTEX_SHADER, i.HIGH_FLOAT)
  27152. , t = i.getShaderPrecisionFormat(i.VERTEX_SHADER, i.MEDIUM_FLOAT)
  27153. , n = i.getShaderPrecisionFormat(i.FRAGMENT_SHADER, i.HIGH_FLOAT)
  27154. , r = i.getShaderPrecisionFormat(i.FRAGMENT_SHADER, i.MEDIUM_FLOAT)
  27155. , n = 0 < e.precision && 0 < n.precision
  27156. , r = 0 < t.precision && 0 < r.precision
  27157. , r = n ? "highp" : r ? "mediump" : "lowp";
  27158. return {
  27159. SHADER_INTERPOLATION: {
  27160. isSupported: function() {
  27161. return i.getExtension("EXT_frag_depth") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS)
  27162. }
  27163. },
  27164. SHADER_SPLATS: {
  27165. isSupported: function() {
  27166. return i.getExtension("EXT_frag_depth") && i.getExtension("OES_texture_float") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS)
  27167. }
  27168. },
  27169. SHADER_EDL: {
  27170. isSupported: function() {
  27171. return i.getExtension("EXT_frag_depth") && i.getExtension("OES_texture_float") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS)
  27172. }
  27173. },
  27174. EXT_DEPTH: {
  27175. isSupported: function() {
  27176. if (A.detectIOS()) {
  27177. var e = A.iosVersion()
  27178. , t = e.major
  27179. , n = e.minor
  27180. , e = e.patch;
  27181. if (15 == t && 4 == n && 1 == e)
  27182. return console.warn("检测到是ios15.4.1, 关闭EXT_frag_depth"),
  27183. !1
  27184. }
  27185. return i.getExtension("EXT_frag_depth")
  27186. }
  27187. },
  27188. precision: r
  27189. }
  27190. }()
  27191. , Wp = function() {
  27192. y(s, Qr);
  27193. var o = w(s);
  27194. function s() {
  27195. var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  27196. O(this, s);
  27197. var t, i = viewer.renderer.getSize(new yn), r = i.width, a = i.height, i = {
  27198. resolution: {
  27199. type: "v2",
  27200. value: new yn(r,a)
  27201. },
  27202. viewportOffset: {
  27203. type: "v2",
  27204. value: new yn(0,0)
  27205. },
  27206. nearPlane: {
  27207. type: "f",
  27208. value: .1
  27209. },
  27210. farPlane: {
  27211. type: "f",
  27212. value: 1e4
  27213. },
  27214. depthTexture: {
  27215. type: "t",
  27216. value: null
  27217. },
  27218. opacity: {
  27219. type: "f",
  27220. value: 1
  27221. },
  27222. map: {
  27223. type: "t",
  27224. value: e.map
  27225. },
  27226. baseColor: {
  27227. type: "v3",
  27228. value: e.color ? new Yi(e.color) : new Yi("#ffffff")
  27229. },
  27230. backColor: {
  27231. type: "v3",
  27232. value: e.backColor ? new Yi(e.backColor) : new Yi("#ddd")
  27233. },
  27234. clipDistance: {
  27235. type: "f",
  27236. value: e.clipDistance || 4
  27237. },
  27238. occlusionDistance: {
  27239. type: "f",
  27240. value: e.occlusionDistance || 1
  27241. },
  27242. maxClipFactor: {
  27243. type: "f",
  27244. value: e.maxClipFactor || 1
  27245. }
  27246. }, r = {}, a = e.useDepth && jp.EXT_DEPTH.isSupported();
  27247. return a && (r.useDepth = ""),
  27248. e.map && (r.use_map = ""),
  27249. n = o.call(this, {
  27250. uniforms: i,
  27251. vertexShader: Hp["depthBasic.vs"],
  27252. fragmentShader: Hp["depthBasic.fs"],
  27253. depthWrite: !1,
  27254. depthTest: !1,
  27255. transparent: null == e.transparent || e.transparent,
  27256. side: e.side || 0,
  27257. defines: r
  27258. }),
  27259. null != e.opacity && (n.opacity = e.opacity),
  27260. a && (n.useDepth_ = !0),
  27261. n.useDepth && (t = function(e) {
  27262. var t = e.viewport
  27263. , e = t.offset || new yn;
  27264. n.uniforms.resolution.value.copy(t.resolution2),
  27265. n.uniforms.viewportOffset.value.copy(e)
  27266. }
  27267. ,
  27268. a = viewer.mainViewport,
  27269. t({
  27270. viewport: a
  27271. }),
  27272. viewer.addEventListener("resize", function(e) {
  27273. n.useDepth && e.viewport && !e.viewport.camera.isPerspectiveCamera || t(e)
  27274. }),
  27275. viewer.addEventListener("render.begin", function(e) {
  27276. e.viewport.camera.isPerspectiveCamera && n.updateDepthParams(e)
  27277. }),
  27278. n.updateDepthParams()),
  27279. n
  27280. }
  27281. return h(s, [{
  27282. key: "updateDepthParams",
  27283. value: function() {
  27284. var e, t;
  27285. this.useDepth && (t = (e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).viewport || viewer.mainViewport).camera,
  27286. this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(e).depthTexture,
  27287. this.uniforms.nearPlane.value = t.near,
  27288. this.uniforms.farPlane.value = t.far)
  27289. }
  27290. }, {
  27291. key: "map",
  27292. set: function(e) {
  27293. this.uniforms.map.value = e
  27294. }
  27295. }, {
  27296. key: "useDepth",
  27297. get: function() {
  27298. return this.useDepth_
  27299. },
  27300. set: function(e) {
  27301. this.useDepth_ != e && (e && jp.EXT_DEPTH.isSupported() ? (this.defines.useDepth = "",
  27302. this.updateDepthParams()) : delete this.defines.useDepth,
  27303. this.useDepth_ = e,
  27304. this.needsUpdate = !0)
  27305. }
  27306. }, {
  27307. key: "opacity",
  27308. get: function() {
  27309. return this.uniforms.opacity.value
  27310. },
  27311. set: function(e) {
  27312. this.uniforms && (this.uniforms.opacity.value = e)
  27313. }
  27314. }]),
  27315. s
  27316. }()
  27317. , Xp = new ua(1,1)
  27318. , qp = function() {
  27319. y(a, Hr);
  27320. var r = w(a);
  27321. function a(e) {
  27322. var t;
  27323. O(this, a),
  27324. (t = r.call(this, Xp, e.mat || new Wp({
  27325. map: e.map,
  27326. useDepth: e.useDepth
  27327. }))).root = e.root || g(t),
  27328. t.renderOrder = null != e.renderOrder ? e.renderOrder : 4,
  27329. t.pickOrder = e.pickOrder || 0,
  27330. t.sizeInfo = e.sizeInfo,
  27331. t.dontFixOrient = e.dontFixOrient,
  27332. t.root.matrixAutoUpdate = !1,
  27333. t.matrixMap = new Map,
  27334. t.name = e.name || "sprite",
  27335. t.useViewport = null,
  27336. t.viewports = e.viewports,
  27337. t.visible_ = !0;
  27338. function n(e) {
  27339. t.update(e)
  27340. }
  27341. viewer.mapViewer && viewer.mapViewer.addEventListener("camera_changed", n),
  27342. viewer.addEventListener("camera_changed", n);
  27343. function i(e) {
  27344. t.applyMatrix(e)
  27345. }
  27346. return viewer.addEventListener("raycaster", i),
  27347. viewer.addEventListener("render.begin", i),
  27348. t.addEventListener("dispose", function() {
  27349. viewer.mapViewer && viewer.mapViewer.removeEventListener("camera_changed", n),
  27350. viewer.removeEventListener("camera_changed", n),
  27351. viewer.removeEventListener("raycaster", i),
  27352. viewer.removeEventListener("render.begin", i),
  27353. t.dispose()
  27354. }),
  27355. t
  27356. }
  27357. return h(a, [{
  27358. key: "visible",
  27359. get: function() {
  27360. return this.visible_
  27361. },
  27362. set: function(e) {
  27363. (this.visible_ = e) && this.update()
  27364. }
  27365. }, {
  27366. key: "update",
  27367. value: function(e) {
  27368. var t, n, i, r = this;
  27369. e ? this.visible && this.root && (this.viewports && !this.viewports.includes(e.viewport) || "magnifier" != e.viewport.name && (i = e.viewport.camera,
  27370. this.dontFixOrient || this.root.quaternion.copy(i.quaternion),
  27371. (t = this.sizeInfo) && (this.root.updateMatrix(),
  27372. this.root.updateMatrixWorld(!0),
  27373. i = t.restricMeshScale ? (n = i.position.distanceTo(this.root.getWorldPosition(new Cn))) < t.nearBound ? t.scale * n / t.nearBound : t.scale : Up.getScaleForConstantSize($.extend(t, {
  27374. camera: i,
  27375. position: this.root.getWorldPosition(new Cn),
  27376. resolution: e.viewport.resolution
  27377. })),
  27378. isNaN(i) || this.root.scale.set(i, i, i)),
  27379. this.root.updateMatrix(),
  27380. this.root.updateMatrixWorld(!0),
  27381. this.matrixMap.set(e.viewport, this.root.matrix.clone()),
  27382. this.useViewport = e.viewport)) : (this.viewports || viewer.viewports).forEach(function(e) {
  27383. r.update({
  27384. viewport: e
  27385. })
  27386. })
  27387. }
  27388. }, {
  27389. key: "applyMatrix",
  27390. value: function(e) {
  27391. var t;
  27392. "magnifier" != (e = e || {
  27393. viewport: viewer.mainViewport
  27394. }).viewport.name && (this.viewports && !this.viewports.includes(e.viewport) || this.visible && this.root && ((t = this.matrixMap.get(e.viewport)) || (this.update(e),
  27395. t = this.matrixMap.get(e.viewport)),
  27396. e.viewport != this.useViewport && (this.useViewport = e.viewport,
  27397. this.root.matrix.copy(t),
  27398. this.root.updateMatrixWorld(!0))))
  27399. }
  27400. }, {
  27401. key: "setUniforms",
  27402. value: function(e, t) {
  27403. this.material.setUniforms(e, t)
  27404. }
  27405. }, {
  27406. key: "dispose",
  27407. value: function() {
  27408. this.removeAllListeners(),
  27409. this.parent && this.parent.remove(this)
  27410. }
  27411. }]),
  27412. a
  27413. }()
  27414. , Jp = function() {
  27415. y(r, Si);
  27416. var i = w(r);
  27417. function r() {
  27418. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  27419. O(this, r);
  27420. var t = i.call(this)
  27421. , n = new En;
  27422. return n.minFilter = Oe,
  27423. n.magFilter = Oe,
  27424. t.sprite = new qp(Object.assign({
  27425. root: g(t)
  27426. }, e, {
  27427. map: n
  27428. })),
  27429. t.add(t.sprite),
  27430. t.fontWeight = null == e.fontWeight ? "Bold" : e.fontWeight,
  27431. t.rectBorderThick = e.rectBorderThick || 0,
  27432. t.textBorderThick = e.textBorderThick || 0,
  27433. t.fontface = "Arial",
  27434. t.fontsize = e.fontsize || 16,
  27435. t.textBorderColor = e.textBorderColor || {
  27436. r: 0,
  27437. g: 0,
  27438. b: 0,
  27439. a: 0
  27440. },
  27441. t.backgroundColor = e.backgroundColor || {
  27442. r: 255,
  27443. g: 255,
  27444. b: 255,
  27445. a: 1
  27446. },
  27447. t.textColor = e.textColor || {
  27448. r: 0,
  27449. g: 0,
  27450. b: 0,
  27451. a: 1
  27452. },
  27453. t.borderColor = e.borderColor || {
  27454. r: 0,
  27455. g: 0,
  27456. b: 0,
  27457. a: 0
  27458. },
  27459. t.borderRadius = e.borderRadius || 6,
  27460. null != e.text && t.setText(e.text),
  27461. t.name = e.name,
  27462. t.addEventListener("dispose", t.dispose.bind(g(t))),
  27463. t
  27464. }
  27465. return h(r, [{
  27466. key: "setText",
  27467. value: function(e) {
  27468. this.text !== e && (this.text = e + "",
  27469. this.updateTexture())
  27470. }
  27471. }, {
  27472. key: "setTextColor",
  27473. value: function(e) {
  27474. this.textColor = e,
  27475. this.updateTexture()
  27476. }
  27477. }, {
  27478. key: "setBorderColor",
  27479. value: function(e) {
  27480. this.borderColor = e,
  27481. this.updateTexture()
  27482. }
  27483. }, {
  27484. key: "setBackgroundColor",
  27485. value: function(e) {
  27486. this.backgroundColor = e,
  27487. this.updateTexture()
  27488. }
  27489. }, {
  27490. key: "setPos",
  27491. value: function(e) {
  27492. this.position.copy(e),
  27493. this.sprite.update()
  27494. }
  27495. }, {
  27496. key: "update",
  27497. value: function() {
  27498. this.sprite.update()
  27499. }
  27500. }, {
  27501. key: "setVisible",
  27502. value: function(e) {
  27503. this.visible = e
  27504. }
  27505. }, {
  27506. key: "setUniforms",
  27507. value: function(e, t) {
  27508. this.sprite.setUniforms(e, t)
  27509. }
  27510. }, {
  27511. key: "updateTexture",
  27512. value: function() {
  27513. var e = document.createElement("canvas")
  27514. , t = e.getContext("2d");
  27515. t.font = this.fontWeight + " " + this.fontsize + "px " + this.fontface;
  27516. var n = t.measureText(this.text).width
  27517. , i = new yn(this.fontsize,Math.max(.4 * this.fontsize, 10))
  27518. , r = 2 * i.x + n + 2 * this.rectBorderThick
  27519. , n = 2 * i.y + this.fontsize + 2 * this.rectBorderThick;
  27520. t.canvas.width = r,
  27521. t.canvas.height = n,
  27522. t.font = this.fontWeight + " " + this.fontsize + "px " + this.fontface;
  27523. t.textBaseline = "middle",
  27524. t.strokeStyle = "rgba(" + this.borderColor.r + "," + this.borderColor.g + "," + this.borderColor.b + "," + this.borderColor.a + ")",
  27525. t.lineWidth = this.rectBorderThick,
  27526. t.fillStyle = "rgba(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + "," + this.backgroundColor.a + ")",
  27527. this.roundRect(t, this.rectBorderThick / 2, this.rectBorderThick / 2, r - this.rectBorderThick, n - this.rectBorderThick, this.borderRadius),
  27528. this.textBorderThick && (t.strokeStyle = "rgba(" + this.textBorderColor.r + "," + this.textBorderColor.g + "," + this.textBorderColor.b + "," + this.textBorderColor.a + ")",
  27529. t.lineWidth = this.textBorderThick,
  27530. t.strokeText(this.text, this.rectBorderThick + i.x, n / 2 + 2)),
  27531. t.fillStyle = "rgba(" + this.textColor.r + "," + this.textColor.g + "," + this.textColor.b + "," + this.textColor.a + ")",
  27532. t.fillText(this.text, this.rectBorderThick + i.x, n / 2 + 2);
  27533. e = new En(e);
  27534. e.minFilter = Oe,
  27535. e.magFilter = Oe,
  27536. e.needsUpdate = !0,
  27537. this.sprite.material.map && this.sprite.material.map.dispose(),
  27538. this.sprite.material.map = e,
  27539. this.sprite.scale.set(.01 * r, .01 * n, 1)
  27540. }
  27541. }, {
  27542. key: "roundRect",
  27543. value: function(e, t, n, i, r, a) {
  27544. e.beginPath(),
  27545. e.moveTo(t + a, n),
  27546. e.lineTo(t + i - a, n),
  27547. e.arcTo(t + i, n, t + i, n + a, a),
  27548. e.lineTo(t + i, n + r - a),
  27549. e.arcTo(t + i, n + r, t + i - a, n + r, a),
  27550. e.lineTo(t + a, n + r),
  27551. e.arcTo(t, n + r, t, n + r - a, a),
  27552. e.lineTo(t, n + a),
  27553. e.arcTo(t, n, t + a, n, a),
  27554. e.closePath(),
  27555. e.fill(),
  27556. e.stroke()
  27557. }
  27558. }, {
  27559. key: "dispose",
  27560. value: function() {
  27561. this.sprite.material.uniforms.map.value.dispose(),
  27562. this.parent && this.parent.remove(this),
  27563. this.sprite.dispatchEvent({
  27564. type: "dispose"
  27565. }),
  27566. this.removeAllListeners()
  27567. }
  27568. }]),
  27569. r
  27570. }()
  27571. , Yp = function() {
  27572. y(i, Si);
  27573. var n = w(i);
  27574. function i() {
  27575. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  27576. return O(this, i),
  27577. "Volume" === (e = n.call(this)).constructor.name && console.warn("Can't create object of class Volume directly. Use classes BoxVolume or SphereVolume instead."),
  27578. e._clip = t.clip || !1,
  27579. e._visible = !0,
  27580. e._modifiable = t.modifiable || !0,
  27581. e.addEventListener("select", function(e) {}),
  27582. e.addEventListener("deselect", function(e) {}),
  27583. e
  27584. }
  27585. return h(i, [{
  27586. key: "visible",
  27587. get: function() {
  27588. return this._visible
  27589. },
  27590. set: function(e) {
  27591. this._visible !== e && (this._visible = e,
  27592. this.dispatchEvent({
  27593. type: "visibility_changed",
  27594. object: this
  27595. }))
  27596. }
  27597. }, {
  27598. key: "getVolume",
  27599. value: function() {
  27600. console.warn("override this in subclass")
  27601. }
  27602. }, {
  27603. key: "update",
  27604. value: function() {}
  27605. }, {
  27606. key: "raycast",
  27607. value: function(e, t) {}
  27608. }, {
  27609. key: "clip",
  27610. get: function() {
  27611. return this._clip
  27612. },
  27613. set: function(e) {
  27614. this._clip !== e && (this._clip = e,
  27615. this.update(),
  27616. this.dispatchEvent({
  27617. type: "clip_changed",
  27618. object: this
  27619. }))
  27620. }
  27621. }, {
  27622. key: "modifieable",
  27623. get: function() {
  27624. return this._modifiable
  27625. },
  27626. set: function(e) {
  27627. this._modifiable = e,
  27628. this.update()
  27629. }
  27630. }]),
  27631. i
  27632. }()
  27633. , Zp = function() {
  27634. y(a, Yp);
  27635. var r = w(a);
  27636. function a() {
  27637. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  27638. O(this, a),
  27639. (e = r.call(this, t)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1,
  27640. e.name = "box_" + e.constructor.counter;
  27641. var n = new Cl(1,1,1);
  27642. n.computeBoundingBox();
  27643. var i = new Sl
  27644. , t = Cn;
  27645. return i.vertices.push(new t(-.5,-.5,.5), new t(.5,-.5,.5), new t(.5,-.5,.5), new t(.5,-.5,-.5), new t(.5,-.5,-.5), new t(-.5,-.5,-.5), new t(-.5,-.5,-.5), new t(-.5,-.5,.5), new t(-.5,.5,.5), new t(.5,.5,.5), new t(.5,.5,.5), new t(.5,.5,-.5), new t(.5,.5,-.5), new t(-.5,.5,-.5), new t(-.5,.5,-.5), new t(-.5,.5,.5), new t(-.5,-.5,.5), new t(-.5,.5,.5), new t(.5,-.5,.5), new t(.5,.5,.5), new t(.5,-.5,-.5), new t(.5,.5,-.5), new t(-.5,-.5,-.5), new t(-.5,.5,-.5)),
  27646. e.material = new $i({
  27647. color: 65280,
  27648. transparent: !0,
  27649. opacity: .3,
  27650. depthTest: !0,
  27651. depthWrite: !1
  27652. }),
  27653. e.box = new Hr(n,e.material),
  27654. e.box.geometry.computeBoundingBox(),
  27655. e.boundingBox = e.box.geometry.boundingBox,
  27656. e.add(e.box),
  27657. e.frame = new cl(i,new tl({
  27658. color: 0
  27659. })),
  27660. e.add(e.frame),
  27661. viewer.setObjectLayers(g(e), "volume"),
  27662. e.update(),
  27663. e
  27664. }
  27665. return h(a, [{
  27666. key: "update",
  27667. value: function() {
  27668. this.boundingBox = this.box.geometry.boundingBox,
  27669. this.boundingSphere = this.boundingBox.getBoundingSphere(new qn),
  27670. this._clip ? this.box.visible = !1 : this.box.visible = !0
  27671. }
  27672. }, {
  27673. key: "raycast",
  27674. value: function(e, t) {
  27675. var n = [];
  27676. this.box.raycast(e, n),
  27677. 0 < n.length && t.push({
  27678. distance: (n = n[0]).distance,
  27679. object: this,
  27680. point: n.point.clone()
  27681. })
  27682. }
  27683. }, {
  27684. key: "getVolume",
  27685. value: function() {
  27686. return Math.abs(this.scale.x * this.scale.y * this.scale.z)
  27687. }
  27688. }]),
  27689. a
  27690. }()
  27691. , Qp = function() {
  27692. y(_, Yp);
  27693. var E = w(_);
  27694. function _() {
  27695. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  27696. O(this, _),
  27697. (e = E.call(this, t)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1,
  27698. e.name = "sphere_" + e.constructor.counter;
  27699. var n = new Su(1,32,32);
  27700. n.computeBoundingBox(),
  27701. e.material = new $i({
  27702. color: 65280,
  27703. transparent: !0,
  27704. opacity: .3,
  27705. depthTest: !0,
  27706. depthWrite: !1
  27707. }),
  27708. e.sphere = new Hr(n,e.material),
  27709. e.sphere.visible = !1,
  27710. e.sphere.geometry.computeBoundingBox(),
  27711. e.boundingBox = e.sphere.geometry.boundingBox,
  27712. e.add(e.sphere);
  27713. for (var i = new Sl, r = 0; r < 8; r++)
  27714. for (var a = r / 8 * Math.PI * 2, o = Math.cos(a), s = Math.sin(a), l = 0; l <= 64; l++) {
  27715. var u = l / 64 * Math.PI * 2
  27716. , c = u + 2 * Math.PI / 64
  27717. , d = Math.sin(u)
  27718. , h = Math.cos(u)
  27719. , u = Math.sin(c)
  27720. , c = Math.cos(c)
  27721. , d = new Cn(o * h,s * h,d);
  27722. i.vertices.push(d);
  27723. u = new Cn(o * c,s * c,u);
  27724. i.vertices.push(u)
  27725. }
  27726. for (var p = 0; p <= 6; p++) {
  27727. var f = (1 - (f = p / 6)) * (-Math.PI / 2) + f * (Math.PI / 2)
  27728. , m = Math.sin(f);
  27729. console.log(f, m);
  27730. for (var v = 0; v <= 64; v++) {
  27731. var g = v / 64 * Math.PI * 2
  27732. , y = g + 2 * Math.PI / 64
  27733. , w = Math.cos(g)
  27734. , b = Math.sin(g)
  27735. , x = Math.cos(y)
  27736. , g = Math.sin(y)
  27737. , y = Math.sqrt(1 - m * m)
  27738. , b = new Cn(w * y,b * y,m);
  27739. i.vertices.push(b);
  27740. y = new Cn(x * y,g * y,m);
  27741. i.vertices.push(y)
  27742. }
  27743. }
  27744. e.frame = new cl(i,new tl({
  27745. color: 0
  27746. })),
  27747. e.add(e.frame);
  27748. t = new $i({
  27749. wireframe: !0,
  27750. color: 0
  27751. });
  27752. return e.frame = new Hr(n,t),
  27753. e.update(),
  27754. e
  27755. }
  27756. return h(_, [{
  27757. key: "update",
  27758. value: function() {
  27759. this.boundingBox = this.sphere.geometry.boundingBox,
  27760. this.boundingSphere = this.boundingBox.getBoundingSphere(new qn)
  27761. }
  27762. }, {
  27763. key: "raycast",
  27764. value: function(e, t) {
  27765. var n = [];
  27766. this.sphere.raycast(e, n),
  27767. 0 < n.length && t.push({
  27768. distance: (n = n[0]).distance,
  27769. object: this,
  27770. point: n.point.clone()
  27771. })
  27772. }
  27773. }, {
  27774. key: "getVolume",
  27775. value: function() {
  27776. return 4 / 3 * Math.PI * this.scale.x * this.scale.y * this.scale.z
  27777. }
  27778. }]),
  27779. _
  27780. }()
  27781. , Kp = function() {
  27782. y(n, Si);
  27783. var t = w(n);
  27784. function n() {
  27785. var e;
  27786. return O(this, n),
  27787. (e = t.call(this)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1,
  27788. e.name = "Profile_" + e.constructor.counter,
  27789. e.points = [],
  27790. e.spheres = [],
  27791. e.edges = [],
  27792. e.boxes = [],
  27793. e.width = 1,
  27794. e.height = 20,
  27795. e._modifiable = !0,
  27796. e.sphereGeometry = new Su(.4,10,10),
  27797. e.color = new Yi(16711680),
  27798. e.lineColor = new Yi(16711680),
  27799. e
  27800. }
  27801. return h(n, [{
  27802. key: "createSphereMaterial",
  27803. value: function() {
  27804. return new qu({
  27805. color: 16711680,
  27806. depthTest: !1,
  27807. depthWrite: !1
  27808. })
  27809. }
  27810. }, {
  27811. key: "getSegments",
  27812. value: function() {
  27813. for (var e = [], t = 0; t < this.points.length - 1; t++) {
  27814. var n = this.points[t].clone()
  27815. , i = this.points[t + 1].clone();
  27816. e.push({
  27817. start: n,
  27818. end: i
  27819. })
  27820. }
  27821. return e
  27822. }
  27823. }, {
  27824. key: "getSegmentMatrices",
  27825. value: function() {
  27826. var e, t = [], n = ue(this.getSegments());
  27827. try {
  27828. for (n.s(); !(e = n.n()).done; ) {
  27829. var i = e.value
  27830. , r = i.start
  27831. , a = i.end
  27832. , o = new Si
  27833. , s = void 0;
  27834. window.axisYup ? (s = r.clone().setY(0).distanceTo(a.clone().setY(0)),
  27835. o.scale.set(s, 1e4, this.width)) : (s = r.clone().setZ(0).distanceTo(a.clone().setZ(0)),
  27836. o.scale.set(s, 1e4, this.width),
  27837. o.up.set(0, 0, 1));
  27838. var l = (new Cn).addVectors(r, a).multiplyScalar(.5)
  27839. , u = (new Cn).subVectors(a, r)
  27840. , c = new Cn(u.y,-u.x,0);
  27841. o.position.set(0, 0, 0),
  27842. o.lookAt(c),
  27843. o.position.copy(l),
  27844. o.updateMatrixWorld(),
  27845. t.push(o.matrixWorld)
  27846. }
  27847. } catch (e) {
  27848. n.e(e)
  27849. } finally {
  27850. n.f()
  27851. }
  27852. return t
  27853. }
  27854. }, {
  27855. key: "addMarker",
  27856. value: function(e) {
  27857. var n = this;
  27858. this.points.push(e);
  27859. var t, i, r = new Hr(this.sphereGeometry,this.createSphereMaterial());
  27860. this.add(r),
  27861. this.spheres.push(r),
  27862. 1 < this.points.length && ((t = new Sl).vertices.push(new Cn, new Cn),
  27863. t.colors.push(this.lineColor, this.lineColor, this.lineColor),
  27864. (i = new tl({
  27865. vertexColors: 2,
  27866. lineWidth: 2,
  27867. transparent: !0,
  27868. opacity: .4
  27869. })).depthTest = !1,
  27870. (i = new sl(t,i)).visible = !1,
  27871. this.add(i),
  27872. this.edges.push(i),
  27873. (i = new Hr(new Cl(1,1,1),new $i({
  27874. color: 16711680,
  27875. transparent: !0,
  27876. opacity: .2
  27877. }))).visible = !1,
  27878. this.add(i),
  27879. this.boxes.push(i));
  27880. r.addEventListener("drag", function(e) {
  27881. var t = Jf.getMousePointCloudIntersection(e.drag.end, e.viewer.scene.getActiveCamera(), e.viewer, e.viewer.scene.pointclouds);
  27882. !t || -1 !== (e = n.spheres.indexOf(e.drag.object)) && n.setPosition(e, t.location)
  27883. }),
  27884. r.addEventListener("drop", function(e) {
  27885. e = n.spheres.indexOf(e.drag.object);
  27886. -1 !== e && n.dispatchEvent({
  27887. type: "marker_dropped",
  27888. profile: n,
  27889. index: e
  27890. })
  27891. }),
  27892. r.addEventListener("mouseover", function(e) {
  27893. return e.object.material.emissive.setHex(8947848)
  27894. }),
  27895. r.addEventListener("mouseleave", function(e) {
  27896. return e.object.material.emissive.setHex(0)
  27897. }),
  27898. this.dispatchEvent({
  27899. type: "marker_added",
  27900. profile: this,
  27901. sphere: r
  27902. }),
  27903. this.setPosition(this.points.length - 1, e)
  27904. }
  27905. }, {
  27906. key: "removeMarker",
  27907. value: function(e) {
  27908. this.points.splice(e, 1),
  27909. this.remove(this.spheres[e]);
  27910. var t = 0 === e ? 0 : e - 1;
  27911. this.remove(this.edges[t]),
  27912. this.edges.splice(t, 1),
  27913. this.remove(this.boxes[t]),
  27914. this.boxes.splice(t, 1),
  27915. this.spheres.splice(e, 1),
  27916. this.update(),
  27917. this.dispatchEvent({
  27918. type: "marker_removed",
  27919. profile: this
  27920. })
  27921. }
  27922. }, {
  27923. key: "setPosition",
  27924. value: function(e, t) {
  27925. var n = this.points[e];
  27926. n.copy(t);
  27927. n = {
  27928. type: "marker_moved",
  27929. profile: this,
  27930. index: e,
  27931. position: n.clone()
  27932. };
  27933. this.dispatchEvent(n),
  27934. this.update()
  27935. }
  27936. }, {
  27937. key: "setWidth",
  27938. value: function(e) {
  27939. this.width = e,
  27940. this.dispatchEvent({
  27941. type: "width_changed",
  27942. profile: this,
  27943. width: e
  27944. }),
  27945. this.update()
  27946. }
  27947. }, {
  27948. key: "getWidth",
  27949. value: function() {
  27950. return this.width
  27951. }
  27952. }, {
  27953. key: "update",
  27954. value: function() {
  27955. if (0 !== this.points.length)
  27956. if (1 !== this.points.length) {
  27957. for (var e = this.points[0].clone(), t = this.points[0].clone(), n = new Cn, i = this.points.length - 1, r = 0; r <= i; r++) {
  27958. var a = this.points[r]
  27959. , o = this.spheres[r]
  27960. , s = 0 === r ? i : r - 1
  27961. , l = this.points[s]
  27962. , u = this.edges[s]
  27963. , c = this.edges[r]
  27964. , s = this.boxes[s];
  27965. o.position.copy(a),
  27966. this._modifiable ? o.visible = !0 : o.visible = !1,
  27967. u && (u.geometry.vertices[1].copy(a),
  27968. u.geometry.verticesNeedUpdate = !0,
  27969. u.geometry.computeBoundingSphere()),
  27970. c && (c.geometry.vertices[0].copy(a),
  27971. c.geometry.verticesNeedUpdate = !0,
  27972. c.geometry.computeBoundingSphere()),
  27973. s && (u = l,
  27974. c = a,
  27975. l = void 0,
  27976. window.axisYup ? l = u.clone().setY(0).distanceTo(c.clone().setY(0)) : (l = u.clone().setZ(0).distanceTo(c.clone().setZ(0)),
  27977. s.up.set(0, 0, 1)),
  27978. s.scale.set(l, 1e6, this.width),
  27979. l = (new Cn).addVectors(u, c).multiplyScalar(.5),
  27980. u = (new Cn).subVectors(c, u),
  27981. u = new Cn(u.y,-u.x,0),
  27982. s.position.set(0, 0, 0),
  27983. s.lookAt(u),
  27984. s.position.copy(l)),
  27985. n.add(a),
  27986. e.min(a),
  27987. t.max(a)
  27988. }
  27989. n.multiplyScalar(1 / this.points.length);
  27990. for (var d = 0; d < this.boxes.length; d++)
  27991. this.boxes[d].position.z = e.z + (t.z - e.z) / 2
  27992. } else {
  27993. var h = this.points[0];
  27994. this.spheres[0].position.copy(h)
  27995. }
  27996. }
  27997. }, {
  27998. key: "raycast",
  27999. value: function(e, t) {
  28000. for (var n = 0; n < this.points.length; n++)
  28001. this.spheres[n].raycast(e, t);
  28002. for (var i = 0; i < t.length; i++) {
  28003. var r = t[i];
  28004. r.distance = e.ray.origin.distanceTo(r.point)
  28005. }
  28006. t.sort(function(e, t) {
  28007. return e.distance - t.distance
  28008. })
  28009. }
  28010. }, {
  28011. key: "modifiable",
  28012. get: function() {
  28013. return this._modifiable
  28014. },
  28015. set: function(e) {
  28016. this._modifiable = e,
  28017. this.update()
  28018. }
  28019. }]),
  28020. n
  28021. }()
  28022. , $p = function() {
  28023. y(r, hn);
  28024. var i = w(r);
  28025. function r() {
  28026. var t, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  28027. O(this, r),
  28028. (t = i.call(this)).position = e.pos,
  28029. t.text = e.text || "",
  28030. t.elem = $('<div class="hide"><a></a></div>'),
  28031. e.className && t.elem.addClass(e.className),
  28032. t.elem.find("a").html(t.text),
  28033. $("#potree_labels").append(t.elem),
  28034. t.pos2d = new Cn,
  28035. t.dom = e.dom || viewer.renderArea,
  28036. t.camera = e.camera || viewer.scene.getActiveCamera();
  28037. function n(e) {
  28038. t.update(e)
  28039. }
  28040. return viewer.addEventListener("camera_changed", n),
  28041. t.addEventListener("dispose", function() {
  28042. viewer.removeEventListener("camera_changed", n),
  28043. t.dispose()
  28044. }),
  28045. t
  28046. }
  28047. return h(r, [{
  28048. key: "update",
  28049. value: function() {
  28050. var e;
  28051. this.position && !this.elem.hasClass("unvisible") && ((e = Jf.getPos2d(this.position, this.camera, this.dom, viewer.mainViewport)).trueSide ? (this.elem.css({
  28052. left: e.pos.x + "px",
  28053. top: e.pos.y + "px"
  28054. }),
  28055. this.elem.removeClass("hide"),
  28056. this.pos2d = e.vector) : this.elem.addClass("hide"))
  28057. }
  28058. }, {
  28059. key: "setVisible",
  28060. value: function(e) {
  28061. e ? (this.elem.removeClass("unvisible"),
  28062. this.update()) : this.elem.addClass("unvisible")
  28063. }
  28064. }, {
  28065. key: "setText",
  28066. value: function(e) {
  28067. this.text = e || "",
  28068. this.elem.find("a").html(this.text)
  28069. }
  28070. }, {
  28071. key: "setPos",
  28072. value: function(e) {
  28073. this.position = e
  28074. }
  28075. }, {
  28076. key: "dispose",
  28077. value: function() {
  28078. this.elem.remove(),
  28079. this.removeAllListeners()
  28080. }
  28081. }]),
  28082. r
  28083. }()
  28084. , ef = new kn
  28085. , tf = new Cn
  28086. , nf = function() {
  28087. y(n, ud);
  28088. var t = w(n);
  28089. function n() {
  28090. var e;
  28091. O(this, n),
  28092. (e = t.call(this)).isLineSegmentsGeometry = !0,
  28093. e.type = "LineSegmentsGeometry";
  28094. return e.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]),
  28095. e.setAttribute("position", new dr([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0],3)),
  28096. e.setAttribute("uv", new dr([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2],2)),
  28097. e
  28098. }
  28099. return h(n, [{
  28100. key: "applyMatrix4",
  28101. value: function(e) {
  28102. var t = this.attributes.instanceStart
  28103. , n = this.attributes.instanceEnd;
  28104. return void 0 !== t && (t.applyMatrix4(e),
  28105. n.applyMatrix4(e),
  28106. t.needsUpdate = !0),
  28107. null !== this.boundingBox && this.computeBoundingBox(),
  28108. null !== this.boundingSphere && this.computeBoundingSphere(),
  28109. this
  28110. }
  28111. }, {
  28112. key: "setPositions",
  28113. value: function(e) {
  28114. e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
  28115. var t = new ah(t,6,1);
  28116. return this.setAttribute("instanceStart", new xs(t,3,0)),
  28117. this.setAttribute("instanceEnd", new xs(t,3,3)),
  28118. this.computeBoundingBox(),
  28119. this.computeBoundingSphere(),
  28120. this
  28121. }
  28122. }, {
  28123. key: "setColors",
  28124. value: function(e) {
  28125. e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
  28126. var t = new ah(t,6,1);
  28127. return this.setAttribute("instanceColorStart", new xs(t,3,0)),
  28128. this.setAttribute("instanceColorEnd", new xs(t,3,3)),
  28129. this
  28130. }
  28131. }, {
  28132. key: "fromWireframeGeometry",
  28133. value: function(e) {
  28134. return this.setPositions(e.attributes.position.array),
  28135. this
  28136. }
  28137. }, {
  28138. key: "fromEdgesGeometry",
  28139. value: function(e) {
  28140. return this.setPositions(e.attributes.position.array),
  28141. this
  28142. }
  28143. }, {
  28144. key: "fromMesh",
  28145. value: function(e) {
  28146. return this.fromWireframeGeometry(new zu(e.geometry)),
  28147. this
  28148. }
  28149. }, {
  28150. key: "fromLineSegments",
  28151. value: function(e) {
  28152. e = e.geometry;
  28153. return this.setPositions(e.attributes.position.array),
  28154. this
  28155. }
  28156. }, {
  28157. key: "computeBoundingBox",
  28158. value: function() {
  28159. null === this.boundingBox && (this.boundingBox = new kn);
  28160. var e = this.attributes.instanceStart
  28161. , t = this.attributes.instanceEnd;
  28162. void 0 !== e && void 0 !== t && (this.boundingBox.setFromBufferAttribute(e),
  28163. ef.setFromBufferAttribute(t),
  28164. this.boundingBox.union(ef))
  28165. }
  28166. }, {
  28167. key: "computeBoundingSphere",
  28168. value: function() {
  28169. null === this.boundingSphere && (this.boundingSphere = new qn),
  28170. null === this.boundingBox && this.computeBoundingBox();
  28171. var e = this.attributes.instanceStart
  28172. , t = this.attributes.instanceEnd;
  28173. if (void 0 !== e && void 0 !== t) {
  28174. var n = this.boundingSphere.center;
  28175. this.boundingBox.getCenter(n);
  28176. for (var i = 0, r = 0, a = e.count; r < a; r++)
  28177. tf.fromBufferAttribute(e, r),
  28178. i = Math.max(i, n.distanceToSquared(tf)),
  28179. tf.fromBufferAttribute(t, r),
  28180. i = Math.max(i, n.distanceToSquared(tf));
  28181. this.boundingSphere.radius = Math.sqrt(i),
  28182. isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this)
  28183. }
  28184. }
  28185. }, {
  28186. key: "toJSON",
  28187. value: function() {}
  28188. }, {
  28189. key: "applyMatrix",
  28190. value: function(e) {
  28191. return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),
  28192. this.applyMatrix4(e)
  28193. }
  28194. }]),
  28195. n
  28196. }();
  28197. da.line = {
  28198. worldUnits: {
  28199. value: 1
  28200. },
  28201. lineWidth: {
  28202. value: 1
  28203. },
  28204. resolution: {
  28205. value: new yn(1,1)
  28206. },
  28207. viewportOffset: {
  28208. value: new yn(0,0)
  28209. },
  28210. dashScale: {
  28211. value: 1
  28212. },
  28213. dashSize: {
  28214. value: 1
  28215. },
  28216. dashOffset: {
  28217. value: 0
  28218. },
  28219. gapSize: {
  28220. value: 1
  28221. },
  28222. opacity: {
  28223. value: 1
  28224. },
  28225. backColor: {
  28226. type: "v3",
  28227. value: new Yi("#ddd")
  28228. },
  28229. clipDistance: {
  28230. type: "f",
  28231. value: 4
  28232. },
  28233. occlusionDistance: {
  28234. type: "f",
  28235. value: 1
  28236. },
  28237. maxClipFactor: {
  28238. type: "f",
  28239. value: 1
  28240. },
  28241. depthTexture: {
  28242. value: null
  28243. },
  28244. nearPlane: {
  28245. value: .1
  28246. },
  28247. farPlane: {
  28248. value: 1e5
  28249. }
  28250. },
  28251. ha.line = {
  28252. uniforms: Jr.merge([da.common, da.fog, da.line]),
  28253. vertexShader: "\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float lineWidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * lineWidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * lineWidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",
  28254. fragmentShader: "\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float lineWidth;\n uniform vec3 backColor;\n uniform float occlusionDistance;\n uniform float clipDistance;\n uniform float maxClipFactor;\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset;\n #endif\n\n\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n #endif\n\n\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t/*#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif*/\n \n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n \n \n bool unvisible = mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize;\n //加\n #ifdef DASH_with_depth\n \n #else \n if (unvisible) discard; // todo - FIX\n #endif\n\t\t\t#endif\n \n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / lineWidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n vec2 depthTxtCoords = vec2(gl_FragCoord.x - viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)\n {\n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n if (clipFactor == 1.0)\n {\n discard;\n }\n \n vec4 backColor_ = vec4(backColor, opacity); //vec4(0.8,0.8,0.8, 0.8*opacity);\n \n #ifdef DASH_with_depth \n // 只在被遮住的部分显示虚线, 所以若同时是虚线不可见部分和被遮住时, a为0\n if(unvisible) backColor_.a = 0.0;\n #endif \n \n //vec4 diffuseColor = vec4(mix(diffuse, backColor_, mixFactor), opacity*(1.0 - clipFactor));\n \n \n \n diffuseColor = mix(diffuseColor, backColor_ , mixFactor); \n \n \n diffuseColor.a *= (1.0 - clipFactor); \n \n #endif\n\n\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\t//gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"
  28255. };
  28256. var rf, af, of, sf, lf = function() {
  28257. y(r, Qr);
  28258. var i = w(r);
  28259. function r(e) {
  28260. var n;
  28261. O(this, r),
  28262. (n = i.call(this, {
  28263. type: "LineMaterial",
  28264. uniforms: Jr.clone(ha.line.uniforms),
  28265. vertexShader: ha.line.vertexShader,
  28266. fragmentShader: ha.line.fragmentShader,
  28267. clipping: !0
  28268. })).isLineMaterial = !0,
  28269. n.lineWidth_ = 0,
  28270. n.supportExtDepth = e.supportExtDepth,
  28271. n.depthTestWhenPick = !1,
  28272. e.color && (n.color = new Yi(e.color)),
  28273. e.backColor && (n.uniforms.backColor.value = new Yi(e.backColor)),
  28274. e.clipDistance && (n.uniforms.clipDistance.value = e.clipDistance),
  28275. e.occlusionDistance && (n.uniforms.occlusionDistance.value = e.occlusionDistance),
  28276. e.maxClipFactor && (n.uniforms.maxClipFactor.value = e.maxClipFactor),
  28277. Object.defineProperties(g(n), {
  28278. color: {
  28279. enumerable: !0,
  28280. get: function() {
  28281. return this.uniforms.diffuse.value
  28282. },
  28283. set: function(e) {
  28284. this.uniforms.diffuse.value = e
  28285. }
  28286. },
  28287. worldUnits: {
  28288. enumerable: !0,
  28289. get: function() {
  28290. return "WORLD_UNITS"in this.defines
  28291. },
  28292. set: function(e) {
  28293. !0 === e ? this.defines.WORLD_UNITS = "" : delete this.defines.WORLD_UNITS
  28294. }
  28295. },
  28296. lineWidth: {
  28297. enumerable: !0,
  28298. get: function() {
  28299. return this.lineWidth_
  28300. },
  28301. set: function(e) {
  28302. this.uniforms.lineWidth.value = e * window.devicePixelRatio,
  28303. this.lineWidth_ = e
  28304. }
  28305. },
  28306. dashed: {
  28307. enumerable: !0,
  28308. get: function() {
  28309. return Boolean("USE_DASH"in this.defines)
  28310. },
  28311. set: function(e) {
  28312. Boolean(e) !== Boolean("USE_DASH"in this.defines) && (this.needsUpdate = !0),
  28313. !0 === e ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH
  28314. }
  28315. },
  28316. dashScale: {
  28317. enumerable: !0,
  28318. get: function() {
  28319. return this.uniforms.dashScale.value
  28320. },
  28321. set: function(e) {
  28322. this.uniforms.dashScale.value = e
  28323. }
  28324. },
  28325. dashSize: {
  28326. enumerable: !0,
  28327. get: function() {
  28328. return this.uniforms.dashSize.value
  28329. },
  28330. set: function(e) {
  28331. this.uniforms.dashSize.value = e
  28332. }
  28333. },
  28334. dashOffset: {
  28335. enumerable: !0,
  28336. get: function() {
  28337. return this.uniforms.dashOffset.value
  28338. },
  28339. set: function(e) {
  28340. this.uniforms.dashOffset.value = e
  28341. }
  28342. },
  28343. gapSize: {
  28344. enumerable: !0,
  28345. get: function() {
  28346. return this.uniforms.gapSize.value
  28347. },
  28348. set: function(e) {
  28349. this.uniforms.gapSize.value = e
  28350. }
  28351. },
  28352. opacity: {
  28353. enumerable: !0,
  28354. get: function() {
  28355. return this.uniforms.opacity.value
  28356. },
  28357. set: function(e) {
  28358. this.uniforms.opacity.value = e
  28359. }
  28360. },
  28361. resolution: {
  28362. enumerable: !0,
  28363. get: function() {
  28364. return this.uniforms.resolution.value
  28365. },
  28366. set: function(e) {
  28367. this.uniforms.resolution.value.copy(e)
  28368. }
  28369. },
  28370. alphaToCoverage: {
  28371. enumerable: !0,
  28372. get: function() {
  28373. return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)
  28374. },
  28375. set: function(e) {
  28376. Boolean(e) !== Boolean("USE_ALPHA_TO_COVERAGE"in this.defines) && (this.needsUpdate = !0),
  28377. !0 === e ? (this.defines.USE_ALPHA_TO_COVERAGE = "",
  28378. this.extensions.derivatives = !0) : (delete this.defines.USE_ALPHA_TO_COVERAGE,
  28379. this.extensions.derivatives = !1)
  28380. }
  28381. },
  28382. useDepth: {
  28383. enumerable: !0,
  28384. get: function() {
  28385. return "useDepth"in this.defines
  28386. },
  28387. set: function(e) {
  28388. (e = e && !!this.supportExtDepth) != this.useDepth && (e ? (this.defines.useDepth = "",
  28389. this.updateDepthParams()) : delete this.defines.useDepth,
  28390. this.needsUpdate = !0)
  28391. }
  28392. },
  28393. dashWithDepth: {
  28394. enumerable: !0,
  28395. get: function() {
  28396. return "DASH_with_depth"in this.defines
  28397. },
  28398. set: function(e) {
  28399. (e = e && !!this.supportExtDepth) != this.dashWithDepth && (e ? this.defines.DASH_with_depth = "" : delete this.defines.DASH_with_depth,
  28400. this.needsUpdate = !0)
  28401. }
  28402. }
  28403. }),
  28404. n.setValues(e);
  28405. function t(e) {
  28406. var t = e.viewport
  28407. , e = t.offset || new yn;
  28408. n.uniforms.resolution.value.copy(t.resolution2),
  28409. n.uniforms.viewportOffset.value.copy(e),
  28410. n.lineWidth = n.lineWidth_
  28411. }
  28412. e = viewer.mainViewport;
  28413. return t({
  28414. viewport: e
  28415. }),
  28416. viewer.addEventListener("resize", function(e) {
  28417. t(e)
  28418. }),
  28419. n.supportExtDepth && (n.updateDepthParams(),
  28420. viewer.addEventListener("render.begin", function(e) {
  28421. e.viewport.camera.isPerspectiveCamera && n.updateDepthParams(e)
  28422. })),
  28423. n
  28424. }
  28425. return h(r, [{
  28426. key: "updateDepthParams",
  28427. value: function() {
  28428. var e, t;
  28429. this.useDepth && (t = (e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).viewport || viewer.mainViewport).camera,
  28430. this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(e).depthTexture,
  28431. this.uniforms.nearPlane.value = t.near,
  28432. this.uniforms.farPlane.value = t.far)
  28433. }
  28434. }]),
  28435. r
  28436. }(), uf = new Cn, cf = new Cn, df = new Mn, hf = new Mn, pf = new Mn, ff = new Cn, mf = new ni, vf = new vh, gf = new Cn, yf = new kn, wf = new qn, bf = new Mn;
  28437. function xf(e, t, n) {
  28438. return bf.set(0, 0, -t, 1).applyMatrix4(e.projectionMatrix),
  28439. bf.multiplyScalar(1 / bf.w),
  28440. bf.x = sf / n.width,
  28441. bf.y = sf / n.height,
  28442. bf.applyMatrix4(e.projectionMatrixInverse),
  28443. bf.multiplyScalar(1 / bf.w),
  28444. Math.abs(Math.max(bf.x, bf.y))
  28445. }
  28446. var Ef, _f = function() {
  28447. y(i, Hr);
  28448. var n = w(i);
  28449. function i() {
  28450. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new nf
  28451. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new lf({
  28452. color: 16777215 * Math.random()
  28453. });
  28454. return O(this, i),
  28455. (t = n.call(this, e, t)).isLineSegments2 = !0,
  28456. t.type = "LineSegments2",
  28457. t
  28458. }
  28459. return h(i, [{
  28460. key: "computeLineDistances",
  28461. value: function() {
  28462. for (var e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, i = new Float32Array(2 * t.count), r = 0, a = 0, o = t.count; r < o; r++,
  28463. a += 2)
  28464. uf.fromBufferAttribute(t, r),
  28465. cf.fromBufferAttribute(n, r),
  28466. i[a] = 0 === a ? 0 : i[a - 1],
  28467. i[a + 1] = i[a] + uf.distanceTo(cf);
  28468. var s = new ah(i,2,1);
  28469. return e.setAttribute("instanceDistanceStart", new xs(s,1,0)),
  28470. e.setAttribute("instanceDistanceEnd", new xs(s,1,1)),
  28471. this
  28472. }
  28473. }, {
  28474. key: "raycast",
  28475. value: function(e, t) {
  28476. var n = this.material.worldUnits
  28477. , i = e.camera;
  28478. null !== i || n || console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');
  28479. var r = void 0 !== e.params.Line2 && e.params.Line2.threshold || 0;
  28480. rf = e.ray;
  28481. var a = this.matrixWorld
  28482. , o = this.geometry
  28483. , e = this.material;
  28484. sf = e.lineWidth + r,
  28485. af = o.attributes.instanceStart,
  28486. of = o.attributes.instanceEnd,
  28487. null === o.boundingSphere && o.computeBoundingSphere(),
  28488. wf.copy(o.boundingSphere).applyMatrix4(a),
  28489. r = n ? .5 * sf : xf(i, Math.max(i.near, wf.distanceToPoint(rf.origin)), e.resolution),
  28490. wf.radius += r,
  28491. !1 !== rf.intersectsSphere(wf) && (null === o.boundingBox && o.computeBoundingBox(),
  28492. yf.copy(o.boundingBox).applyMatrix4(a),
  28493. e = n ? .5 * sf : xf(i, Math.max(i.near, yf.distanceToPoint(rf.origin)), e.resolution),
  28494. yf.expandByScalar(e),
  28495. !1 !== rf.intersectsBox(yf) && (n ? function(e, t) {
  28496. for (var n = 0, i = af.count; n < i; n++) {
  28497. vf.start.fromBufferAttribute(af, n),
  28498. vf.end.fromBufferAttribute(of, n);
  28499. var r = new Cn
  28500. , a = new Cn;
  28501. rf.distanceSqToSegment(vf.start, vf.end, a, r),
  28502. a.distanceTo(r) < .5 * sf && t.push({
  28503. point: a,
  28504. pointOnLine: r,
  28505. distance: rf.origin.distanceTo(a),
  28506. object: e,
  28507. face: null,
  28508. faceIndex: n,
  28509. uv: null,
  28510. uv2: null
  28511. })
  28512. }
  28513. }(this, t) : function(e, t, n) {
  28514. var i = t.projectionMatrix
  28515. , r = e.material.resolution
  28516. , a = e.matrixWorld
  28517. , o = e.geometry
  28518. , s = o.attributes.instanceStart
  28519. , l = o.attributes.instanceEnd
  28520. , u = -t.near;
  28521. rf.at(1, pf),
  28522. pf.w = 1,
  28523. pf.applyMatrix4(t.matrixWorldInverse),
  28524. pf.applyMatrix4(i),
  28525. pf.multiplyScalar(1 / pf.w),
  28526. pf.x *= r.x / 2,
  28527. pf.y *= r.y / 2,
  28528. pf.z = 0,
  28529. ff.copy(pf),
  28530. mf.multiplyMatrices(t.matrixWorldInverse, a);
  28531. for (var c, d, h, p = 0, f = s.count; p < f; p++)
  28532. df.fromBufferAttribute(s, p),
  28533. hf.fromBufferAttribute(l, p),
  28534. df.w = 1,
  28535. hf.w = 1,
  28536. df.applyMatrix4(mf),
  28537. hf.applyMatrix4(mf),
  28538. df.z > u && hf.z > u || (df.z > u ? (c = df.z - hf.z,
  28539. c = (df.z - u) / c,
  28540. df.lerp(hf, c)) : hf.z > u && (d = hf.z - df.z,
  28541. h = (hf.z - u) / d,
  28542. hf.lerp(df, h)),
  28543. df.applyMatrix4(i),
  28544. hf.applyMatrix4(i),
  28545. df.multiplyScalar(1 / df.w),
  28546. hf.multiplyScalar(1 / hf.w),
  28547. df.x *= r.x / 2,
  28548. df.y *= r.y / 2,
  28549. hf.x *= r.x / 2,
  28550. hf.y *= r.y / 2,
  28551. vf.start.copy(df),
  28552. vf.start.z = 0,
  28553. vf.end.copy(hf),
  28554. vf.end.z = 0,
  28555. d = vf.closestPointToPointParameter(ff, !0),
  28556. vf.at(d, gf),
  28557. d = -1 <= (h = gn.lerp(df.z, hf.z, d)) && h <= 1,
  28558. h = ff.distanceTo(gf) < .5 * sf,
  28559. d && h && (vf.start.fromBufferAttribute(s, p),
  28560. vf.end.fromBufferAttribute(l, p),
  28561. vf.start.applyMatrix4(a),
  28562. vf.end.applyMatrix4(a),
  28563. d = new Cn,
  28564. h = new Cn,
  28565. rf.distanceSqToSegment(vf.start, vf.end, h, d),
  28566. n.push({
  28567. point: h,
  28568. pointOnLine: d,
  28569. distance: rf.origin.distanceTo(h),
  28570. object: e,
  28571. face: null,
  28572. faceIndex: p,
  28573. uv: null,
  28574. uv2: null
  28575. })))
  28576. }(this, i, t)))
  28577. }
  28578. }]),
  28579. i
  28580. }(), Mf = function() {
  28581. y(r, nf);
  28582. var t = w(r);
  28583. function r() {
  28584. var e;
  28585. return O(this, r),
  28586. (e = t.call(this)).isLineGeometry = !0,
  28587. e.type = "LineGeometry",
  28588. e
  28589. }
  28590. return h(r, [{
  28591. key: "setPositions",
  28592. value: function(e) {
  28593. for (var t = e.length - 3, n = new Float32Array(2 * t), i = 0; i < t; i += 3)
  28594. n[2 * i] = e[i],
  28595. n[2 * i + 1] = e[i + 1],
  28596. n[2 * i + 2] = e[i + 2],
  28597. n[2 * i + 3] = e[i + 3],
  28598. n[2 * i + 4] = e[i + 4],
  28599. n[2 * i + 5] = e[i + 5];
  28600. return b(v(r.prototype), "setPositions", this).call(this, n),
  28601. this
  28602. }
  28603. }, {
  28604. key: "setColors",
  28605. value: function(e) {
  28606. for (var t = e.length - 3, n = new Float32Array(2 * t), i = 0; i < t; i += 3)
  28607. n[2 * i] = e[i],
  28608. n[2 * i + 1] = e[i + 1],
  28609. n[2 * i + 2] = e[i + 2],
  28610. n[2 * i + 3] = e[i + 3],
  28611. n[2 * i + 4] = e[i + 4],
  28612. n[2 * i + 5] = e[i + 5];
  28613. return b(v(r.prototype), "setColors", this).call(this, n),
  28614. this
  28615. }
  28616. }, {
  28617. key: "fromLine",
  28618. value: function(e) {
  28619. e = e.geometry;
  28620. return this.setPositions(e.attributes.position.array),
  28621. this
  28622. }
  28623. }]),
  28624. r
  28625. }(), Af = function() {
  28626. y(i, _f);
  28627. var n = w(i);
  28628. function i() {
  28629. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mf
  28630. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new lf({
  28631. color: 16777215 * Math.random()
  28632. });
  28633. return O(this, i),
  28634. (t = n.call(this, e, t)).isLine2 = !0,
  28635. t.type = "Line2",
  28636. t
  28637. }
  28638. return h(i)
  28639. }(), Tf = new Yi(1,1,1), Sf = {
  28640. createLine: function(e) {
  28641. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  28642. , n = t.mat || (n = {
  28643. lineWidth: t.lineWidth || 1,
  28644. color: t.color || Tf,
  28645. transparent: !t.dontAlwaysSeen,
  28646. depthTest: !!t.dontAlwaysSeen
  28647. },
  28648. t.deshed && (n.dashSize = t.dashSize || .1,
  28649. n.gapSize = t.gapSize || .1),
  28650. new mp[t.deshed ? "LineDashedMaterial" : "LineBasicMaterial"](n))
  28651. , n = new cl(new Mr,n);
  28652. return n.renderOrder = t.renderOrder || 4,
  28653. this.moveLine(n, e),
  28654. n
  28655. },
  28656. moveLine: function(e, t) {
  28657. var n;
  28658. 0 != t.length && (n = [],
  28659. t.forEach(function(e) {
  28660. return n.push(e.x, e.y, e.z)
  28661. }),
  28662. e.geometry.setAttribute("position", new dr(n,3)),
  28663. e.geometry.attributes.position.needsUpdate = !0,
  28664. e.geometry.computeBoundingSphere(),
  28665. e.material instanceof Yu && (e.computeLineDistances(),
  28666. e.geometry.verticesNeedUpdate = !0))
  28667. },
  28668. createFatLineMat: function(e) {
  28669. var t = !!jp.EXT_DEPTH.isSupported()
  28670. , t = $.extend({}, {
  28671. lineWidth: 5,
  28672. color: 16777215,
  28673. transparent: !0,
  28674. depthWrite: !1,
  28675. depthTest: !1,
  28676. dashSize: .1,
  28677. gapSize: .1
  28678. }, e, {
  28679. dashed: (!e.dashWithDepth || t) && !!e.dashed,
  28680. dashWithDepth: !!e.dashWithDepth,
  28681. useDepth: !!e.useDepth,
  28682. supportExtDepth: t
  28683. });
  28684. return new lf(t)
  28685. },
  28686. createFatLine: function(e, t) {
  28687. var n = new Mf;
  28688. n.setColors(t.color || [1, 1, 1]);
  28689. t = t.material || this.createFatLineMat(t),
  28690. t = new Af(n,t);
  28691. return t.scale.set(1, 1, 1),
  28692. t.renderOrder = 2,
  28693. this.moveFatLine(t, e),
  28694. t
  28695. },
  28696. moveFatLine: function(e, t) {
  28697. var n = e.geometry
  28698. , i = [];
  28699. t.forEach(function(e) {
  28700. i.push.apply(i, Q(e.toArray()))
  28701. }),
  28702. 0 < i.length ? ((n = n || (e.geometry = new Mf)).attributes.instanceEnd && n.attributes.instanceEnd.data.array.length != i.length && (n.dispose(),
  28703. n = new Mf,
  28704. e.geometry = n),
  28705. n.setPositions(i),
  28706. null != e.material.defines.USE_DASH && (e.geometry.computeBoundingSphere(),
  28707. e.computeLineDistances())) : (n.dispose(),
  28708. e.geometry = new Mf)
  28709. },
  28710. updateLine: function(e, t) {
  28711. e instanceof Af ? Sf.moveFatLine(e, t) : Sf.moveLine(e, t)
  28712. },
  28713. createBoldLine: function(e, t) {
  28714. function n() {
  28715. i.lastVector = r;
  28716. var e = (t = new Cn(0,-1,0)).clone().cross(r).normalize()
  28717. , t = t.angleTo(r);
  28718. i.quaternion.setFromAxisAngle(e, t)
  28719. }
  28720. var i = (t = t || {}) && t.cylinder
  28721. , r = e[1].clone().sub(e[0]);
  28722. if (t && "init" == t.type) {
  28723. if ((i = new Hr).material = t.mat,
  28724. 0 == r.length())
  28725. return i;
  28726. n()
  28727. }
  28728. if (0 == r.length())
  28729. return i;
  28730. if ("update" != t.type) {
  28731. var a = e[0].clone().add(e[1]).multiplyScalar(.5);
  28732. if (i.position.copy(a),
  28733. (!i.lastVector || "moveAndRotate" == t.type || i.lastVector && 0 < r.angleTo(i.lastVector)) && n(),
  28734. config.isEdit && !objects.mainDesign.editing)
  28735. return i
  28736. }
  28737. var o = e[0].distanceTo(e[1])
  28738. , s = t && t.standPos || objects.player.position
  28739. , l = config.isMobile ? 20 : 40
  28740. , u = e[0].distanceTo(s)
  28741. , c = e[1].distanceTo(s)
  28742. , a = Up.getFootPoint(s, e[0], e[1]);
  28743. return o = t.constantBold || "panorama" != objects.player.mode ? [new yn(.1,o / 2), new yn(.1,-o / 2)] : 0 < a.clone().sub(e[0]).dot(a.clone().sub(e[1])) ? [new yn(u / l,o / 2), new yn(c / l,-o / 2)] : (s = a.distanceTo(s),
  28744. e = a.distanceTo(e[0]),
  28745. [new yn(u / l,o / 2), new yn(s / l,o / 2 - e), new yn(c / l,-o / 2)]),
  28746. i.geometry && i.geometry.dispose(),
  28747. i.geometry = new fu(o,4),
  28748. i.renderOrder = 2,
  28749. i
  28750. },
  28751. updateBoldLine: function(e, t, n, i, r) {
  28752. this.createBoldLine(t, {
  28753. type: n,
  28754. cylinder: e,
  28755. standPos: i,
  28756. constantBold: r
  28757. })
  28758. }
  28759. }, Cf = {
  28760. getShape: function(e, t) {
  28761. var r = new Xc;
  28762. r.moveTo(e[0].x, e[0].y);
  28763. for (var n = 1, i = e.length; n < i; n++)
  28764. r.lineTo(e[n].x, e[n].y);
  28765. return t && t.forEach(function(e) {
  28766. var t = new Wc;
  28767. t.moveTo(e[0].x, e[0].y);
  28768. for (var n = 1, i = e.length; n < i; n++)
  28769. t.lineTo(e[n].x, e[n].y);
  28770. r.holes.push(t)
  28771. }),
  28772. r
  28773. },
  28774. getShapeGeo: function(e, t) {
  28775. return new Mu(this.getShape(e, t))
  28776. },
  28777. getExtrudeGeo: function(e, t) {
  28778. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}
  28779. , t = this.getShape(e, t);
  28780. n.extrudePath && (i = extrudePath.reduce(function(e, t, n, i) {
  28781. return 0 == n ? 0 : e + t.distanceTo(i[n - 1])
  28782. }, 0),
  28783. n.extrudePath = new Bc(extrudePath,n.closed,"catmullrom",n.tension));
  28784. var i = $.extend(n, {
  28785. steps: null != n.steps ? n.steps : n.extrudePath ? Math.round(i / .3) : 1,
  28786. bevelEnabled: !1
  28787. });
  28788. return new uu(t,i)
  28789. },
  28790. getUnPosPlaneGeo: (Ch = new Uint16Array([0, 1, 2, 0, 2, 3]),
  28791. pu = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
  28792. (Ef = new Mr).setIndex(new nr(Ch,1)),
  28793. Ef.setAttribute("uv", new nr(pu,2)),
  28794. function() {
  28795. return Ef
  28796. }
  28797. ),
  28798. getPlaneGeo: function(e, t, n, i) {
  28799. var r = this.getUnPosPlaneGeo().clone()
  28800. , i = [e.x, e.y, e.z, t.x, t.y, t.z, n.x, n.y, n.z, i.x, i.y, i.z];
  28801. return r.setAttribute("position", new dr(i,3)),
  28802. r.computeVertexNormals(),
  28803. r.computeBoundingSphere(),
  28804. r
  28805. },
  28806. drawPlane: function(e, t, n, i, r) {
  28807. return new Hr(this.getPlaneGeo(e, t, n, i),r)
  28808. },
  28809. movePlane: function(e, t, n, i, r) {
  28810. r = new Float32Array([t.x, t.y, t.z, n.x, n.y, n.z, i.x, i.y, i.z, r.x, r.y, r.z]);
  28811. e.geometry.addAttribute("position", new nr(r,3)),
  28812. e.geometry.computeBoundingSphere()
  28813. },
  28814. createGeometry: function(e, t, n, i) {
  28815. var r, a, o, s = new Mr, l = [];
  28816. return e.forEach(function(e) {
  28817. return l.push(e.x, e.y, e.z)
  28818. }),
  28819. s.setAttribute("position", new dr(l,3)),
  28820. t && (r = [],
  28821. t.forEach(function(e) {
  28822. return r.push.apply(r, Q(e))
  28823. }),
  28824. s.setIndex(r)),
  28825. n && (a = [],
  28826. n.forEach(function(e) {
  28827. return a.push(e.x, e.y)
  28828. }),
  28829. s.setAttribute("uv", new dr(a,2))),
  28830. i && (o = [],
  28831. i.forEach(function(e) {
  28832. return o.push(e.x, e.y, e.z)
  28833. }),
  28834. s.setAttribute("normal", new dr(o,3))),
  28835. s
  28836. },
  28837. updateGeometry: function(e, t, n, i, r) {
  28838. var a, o, s, l = [];
  28839. return t.forEach(function(e) {
  28840. return l.push(e.x, e.y, e.z)
  28841. }),
  28842. e.setAttribute("position", new dr(l,3)),
  28843. e.attributes.position.needsUpdate = !0,
  28844. n && (a = [],
  28845. n.forEach(function(e) {
  28846. return a.push.apply(a, Q(e))
  28847. }),
  28848. e.setIndex(a)),
  28849. i && (o = [],
  28850. i.forEach(function(e) {
  28851. return o.push(e.x, e.y)
  28852. }),
  28853. e.setAttribute("uv", new dr(o,2))),
  28854. r && (s = [],
  28855. r.forEach(function(e) {
  28856. return s.push(e.x, e.y, e.z)
  28857. }),
  28858. e.setAttribute("normal", new dr(s,3))),
  28859. e.computeBoundingSphere(),
  28860. e
  28861. }
  28862. }, Pf = new vh, Df = function() {
  28863. y(a, Si);
  28864. var r = w(a);
  28865. function a(e, t) {
  28866. var n, i;
  28867. for (i in O(this, a),
  28868. (n = r.call(this)).type = e,
  28869. n.maxMarkers = Number.MAX_SAFE_INTEGER,
  28870. n.transformData(t),
  28871. t)
  28872. n[i] = t[i];
  28873. return n.closed && "2d" == n.dimension && (n.areaPlane = n.createAreaPlane(),
  28874. n.add(n.areaPlane)),
  28875. n.points = [],
  28876. n.markers = [],
  28877. n.edges = [],
  28878. n.center,
  28879. n
  28880. }
  28881. return h(a, [{
  28882. key: "initData",
  28883. value: function(e) {
  28884. var n = this;
  28885. if ("merge" == Potree.settings.editType)
  28886. if (this.dataset_points) {
  28887. if (this.dataset_points = this.dataset_points.map(function(e) {
  28888. return e && (new Cn).copy(e)
  28889. }),
  28890. e.points = this.dataset_points.map(function(e, t) {
  28891. return Potree.Utils.datasetPosTransform({
  28892. fromDataset: !0,
  28893. datasetId: n.points_datasets[t],
  28894. position: e
  28895. })
  28896. }),
  28897. e.points.some(function(e) {
  28898. return null == e
  28899. }))
  28900. return !1
  28901. } else
  28902. this.dataset_points = [];
  28903. if (e.points) {
  28904. var t, i = ue(e.points);
  28905. try {
  28906. for (i.s(); !(t = i.n()).done; ) {
  28907. var r = t.value
  28908. , a = (new Cn).copy(r);
  28909. this.addMarker({
  28910. point: a
  28911. })
  28912. }
  28913. } catch (e) {
  28914. i.e(e)
  28915. } finally {
  28916. i.f()
  28917. }
  28918. return "merge" != Potree.settings.editType && (null != this.datasetId ? this.dataset_points && (this.dataset_points = this.dataset_points.map(function(e) {
  28919. return e && (new Cn).copy(e)
  28920. }),
  28921. this.transformByPointcloud()) : e.dataset_points && e.dataset_points.some(function(e) {
  28922. return null != e
  28923. }) && (console.error("存在测量线的datasetId为空而dataset_points有值,请检查并删除:" + this.sid),
  28924. console.log(this))),
  28925. this.getFacePlane(),
  28926. this.getPoint2dInfo(this.points),
  28927. this.update({
  28928. ifUpdateMarkers: !0
  28929. }),
  28930. this.setSelected(!1),
  28931. this.markers.forEach(function(e) {
  28932. e.dispatchEvent("addHoverEvent")
  28933. }),
  28934. !0
  28935. }
  28936. }
  28937. }, {
  28938. key: "addMarker",
  28939. value: function() {
  28940. var n = this
  28941. , i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  28942. , e = null == i.index ? this.points.length : i.index;
  28943. this.points = [].concat(Q(this.points.slice(0, e)), [i.point], Q(this.points.slice(e, this.points.length))),
  28944. i.marker && (this.add(i.marker),
  28945. this.markers = [].concat(Q(this.markers.slice(0, e)), [i.marker], Q(this.markers.slice(e, this.markers.length))),
  28946. this.updateMarker(i.marker, i.point),
  28947. i.marker.addEventListener("drag", this.dragMarker.bind(this)),
  28948. i.marker.addEventListener("drop", this.dropMarker.bind(this)),
  28949. i.marker.addEventListener("addHoverEvent", function e(t) {
  28950. i.marker.addEventListener("mouseover", function(e) {
  28951. n.setMarkerSelected(e.object, "hover", "single"),
  28952. viewer.dispatchEvent({
  28953. type: "CursorChange",
  28954. action: "add",
  28955. name: "markerMove"
  28956. })
  28957. }),
  28958. i.marker.addEventListener("mouseleave", function(e) {
  28959. n.setMarkerSelected(e.object, "unhover", "single"),
  28960. viewer.dispatchEvent({
  28961. type: "CursorChange",
  28962. action: "remove",
  28963. name: "markerMove"
  28964. })
  28965. }),
  28966. i.marker.removeEventListener("addHoverEvent", e)
  28967. }),
  28968. this.isNew || i.marker.dispatchEvent("addHoverEvent")),
  28969. i.edge && (this.add(i.edge),
  28970. this.edges = [].concat(Q(this.edges.slice(0, e)), [i.edge], Q(this.edges.slice(e, this.edges.length))))
  28971. }
  28972. }, {
  28973. key: "dragMarker",
  28974. value: function(e) {
  28975. var t, n;
  28976. if (e.hoverViewport == e.drag.dragViewport) {
  28977. if (viewer.dispatchEvent({
  28978. type: "CursorChange",
  28979. action: "remove",
  28980. name: "polygon_AtWrongPlace"
  28981. }),
  28982. (n = "mapViewport" == e.drag.dragViewport.name) && this.unableDragAtMap)
  28983. e.drag.object = null;
  28984. else if (e.drag.object.isDragging = !0,
  28985. t = e.intersect && (e.intersect.orthoIntersect || e.intersect.location)) {
  28986. var i = this.markers.indexOf(e.drag.object);
  28987. return -1 !== i && (this.dragChange(t.clone(), i, n),
  28988. this.points_datasets && (e.intersect.pointcloud ? this.points_datasets[i] = e.intersect.pointcloud.dataset_id : e.intersect.object ? this.points_datasets[i] = e.intersect.object.dataset_id : this.points_datasets[i] = null)),
  28989. this.editStateChange(!0),
  28990. !0
  28991. }
  28992. } else
  28993. viewer.dispatchEvent({
  28994. type: "CursorChange",
  28995. action: "add",
  28996. name: "polygon_AtWrongPlace"
  28997. })
  28998. }
  28999. }, {
  29000. key: "dragChange",
  29001. value: function(e, t, n) {
  29002. var i = this
  29003. , r = this.markers.length
  29004. , a = this.points[t];
  29005. n && e.setZ(a.z);
  29006. var o = e.clone();
  29007. if (this.faceDirection && 2 == this.maxMarkers && 2 == r) {
  29008. var s = this.markers[0].position;
  29009. a = "horizontal" == this.faceDirection ? o.clone().setZ(s.z) : s.clone().setZ(o.z),
  29010. Sf.updateLine(this.guideLine, [o, a]),
  29011. o = a,
  29012. this.guideLine.visible = !0
  29013. } else if (1 < r) {
  29014. var l, u = this.points.map(function(e) {
  29015. return e.clone()
  29016. });
  29017. if (u[t].copy(o),
  29018. "horizontal" == this.faceDirection)
  29019. 2 == r && o.setZ(u[0].z),
  29020. this.facePlane || (this.facePlane = (new ki).setFromNormalAndCoplanarPoint(new Cn(0,0,1), this.points[0]));
  29021. else if ("vertical" == this.faceDirection)
  29022. if (2 == r)
  29023. this.isRect && (c = u[0].clone().sub(o),
  29024. Math.sqrt(c.x * c.x + c.y * c.y) > Math.abs(c.z) ? o.setZ(u[0].z) : (o.setX(u[0].x),
  29025. o.setY(u[0].y)));
  29026. else {
  29027. this.cannotConfirmNormal = !0;
  29028. for (var c, d, h = this.isRect ? 1 : r - 2, p = 0; p < h; p++) {
  29029. var f = u[p].clone()
  29030. , m = u[p + 1].clone()
  29031. , m = f.sub(m);
  29032. if (0 != m.x || 0 != m.y) {
  29033. this.cannotConfirmNormal = !1;
  29034. break
  29035. }
  29036. }
  29037. this.facePlane && !this.cannotConfirmNormal || (c = kf(u.map(function(e) {
  29038. return new yn(e.x,e.y)
  29039. }), 2)) && (d = Up.getNormal2d({
  29040. p1: c[0],
  29041. p2: c[1]
  29042. }),
  29043. d = new Cn(d.x,d.y,0),
  29044. this.facePlane = (new ki).setFromNormalAndCoplanarPoint(d, this.points[0]))
  29045. }
  29046. if (2 < r) {
  29047. if (this.faceDirection || (3 != r && !this.isRect || (this.cannotConfirmNormal = !0),
  29048. this.facePlane && !this.cannotConfirmNormal || (l = kf(u, 3)) && (this.facePlane = (d = new ki).setFromCoplanarPoints.apply(d, Q(l)))),
  29049. this.facePlane && !this.cannotConfirmNormal)
  29050. if (n) {
  29051. if (Pf.set(o.clone().setZ(1e5), o.clone().setZ(-1e5)),
  29052. !(o = this.facePlane.intersectLine(Pf, new Cn)))
  29053. return
  29054. } else
  29055. o = this.facePlane.projectPoint(e, new Cn);
  29056. if (u[t].copy(o),
  29057. this.isRect && (s = u[(t - 2 + r) % r],
  29058. l = u[(t - 1 + r) % r],
  29059. s.equals(l) && ("vertical" == this.faceDirection ? l.add(new Cn(0,0,1e-4)) : l.add(new Cn(0,1e-4,0))),
  29060. l = (n = Up.getFootPoint(o, s, l)).clone().sub(o),
  29061. l = s.clone().sub(l),
  29062. u[(t - 1 + r) % r].copy(n),
  29063. u[(t + 1) % r].copy(l),
  29064. this.setPosition((t - 1 + r) % r, n),
  29065. this.setPosition((t + 1) % r, l)),
  29066. this.getPoint2dInfo(u),
  29067. !this.isRect && 3 < r && this.intersectSelf(this.point2dInfo.points2d))
  29068. return viewer.dispatchEvent({
  29069. type: "CursorChange",
  29070. action: "add",
  29071. name: "polygon_isIntersectSelf"
  29072. }),
  29073. void (this.isIntersectSelf = !0);
  29074. this.isIntersectSelf = !1,
  29075. viewer.dispatchEvent({
  29076. type: "CursorChange",
  29077. action: "remove",
  29078. name: "polygon_isIntersectSelf"
  29079. })
  29080. }
  29081. 1 < r && (this.faceDirection || 3 < r) && this.guideLine && (Sf.updateLine(this.guideLine, [e, o]),
  29082. this.guideLine.visible = !0)
  29083. }
  29084. if (this.restrictArea) {
  29085. e = this.restrictArea.holes.concat(this.restrictArea.parentHoles).filter(function(e) {
  29086. return e != i && 2 < e.points.length
  29087. }).map(function(e) {
  29088. return e.points
  29089. });
  29090. if (!Up.isPointInArea(this.restrictArea.points, e, o))
  29091. return viewer.dispatchEvent({
  29092. type: "CursorChange",
  29093. action: "add",
  29094. name: "polygon_AtWrongPlace"
  29095. }),
  29096. void (this.isAtWrongPlace = !0)
  29097. }
  29098. viewer.dispatchEvent({
  29099. type: "CursorChange",
  29100. action: "remove",
  29101. name: "polygon_AtWrongPlace"
  29102. }),
  29103. this.isAtWrongPlace = !1,
  29104. this.setPosition(t, o),
  29105. this.update(),
  29106. this.dispatchEvent({
  29107. type: "dragChange",
  29108. index: t
  29109. })
  29110. }
  29111. }, {
  29112. key: "dropMarker",
  29113. value: function(e) {
  29114. if (this.isNew && e.pressDistance > Potree.config.clickMaxDragDis)
  29115. return this.continueDrag(null, e);
  29116. if (e.isTouch) {
  29117. if (e.hoverViewport != viewer.mainViewport && this.unableDragAtMap)
  29118. return viewer.dispatchEvent({
  29119. type: "reticule_forbit",
  29120. v: !0
  29121. }),
  29122. this.continueDrag(null, e);
  29123. viewer.dispatchEvent({
  29124. type: "reticule_forbit",
  29125. v: !1
  29126. }),
  29127. this.dragMarker(e)
  29128. }
  29129. if (e.button != C.RIGHT && (this.isIntersectSelf && this.isNew || this.isAtWrongPlace && this.isNew || !e.isAtDomElement && this.isNew || e.hoverViewport != viewer.mainViewport && this.unableDragAtMap || !kf(this.points, this.points.length)))
  29130. return this.continueDrag(null, e);
  29131. var t = this.markers.indexOf(e.drag.object);
  29132. return -1 !== t && (this.dispatchEvent({
  29133. type: "marker_dropped",
  29134. index: t
  29135. }),
  29136. 2 < this.markers.length && this.facePlane && (this.cannotConfirmNormal = !1),
  29137. this.guideLine && (this.guideLine.visible = !1)),
  29138. this.setMarkerSelected(e.drag.object, "unhover", "single"),
  29139. this.editStateChange(!1),
  29140. e.drag.endDragFun && e.drag.endDragFun(e),
  29141. !0
  29142. }
  29143. }, {
  29144. key: "getFacePlane",
  29145. value: function() {
  29146. var e;
  29147. this.points.length < 3 || (this.facePlane = (e = new ki).setFromCoplanarPoints.apply(e, Q(this.points.slice(0, 3))))
  29148. }
  29149. }, {
  29150. key: "getPoint2dInfo",
  29151. value: function(e) {
  29152. var t, n;
  29153. this.facePlane && (t = e[0].clone(),
  29154. n = Up.getQuaBetween2Vector(this.facePlane.normal, new Cn(0,0,1), new Cn(0,0,1)),
  29155. e = e.map(function(e) {
  29156. return e.clone().applyQuaternion(n)
  29157. }),
  29158. this.point2dInfo = {
  29159. originPoint0: t,
  29160. points2d: e,
  29161. quaInverse: n.clone().invert()
  29162. })
  29163. }
  29164. }, {
  29165. key: "setPosition",
  29166. value: function(e, t) {
  29167. var n = this.points[e];
  29168. n.copy(t);
  29169. e = this.markers[e];
  29170. this.updateMarker(e, n)
  29171. }
  29172. }, {
  29173. key: "updateMarker",
  29174. value: function(e, t) {
  29175. e.position.copy(t),
  29176. e.update()
  29177. }
  29178. }, {
  29179. key: "intersectSelf",
  29180. value: function(e) {
  29181. for (var t = e.length, n = 0; n < t; n++)
  29182. for (var i = n + 2; i < t; i++)
  29183. if (!(Math.abs(i - t - n) < 2)) {
  29184. var r = e[n]
  29185. , a = e[n + 1]
  29186. , o = e[i]
  29187. , s = e[(i + 1) % t];
  29188. if (!(r.equals(a) || o.equals(s) || r.equals(o) || a.equals(o) || r.equals(s) || a.equals(s)))
  29189. if (Up.isLineIntersect([r, a], [o, s], !1, .001))
  29190. return !0
  29191. }
  29192. }
  29193. }, {
  29194. key: "removeMarker",
  29195. value: function(e) {
  29196. this.points.splice(e, 1);
  29197. var t = this.markers[e];
  29198. this.markers.splice(e, 1),
  29199. t.dispatchEvent({
  29200. type: "dispose"
  29201. });
  29202. var n = e
  29203. , i = this.edges[n];
  29204. i && (this.remove(i),
  29205. this.edges.splice(n, 1),
  29206. i.dispatchEvent({
  29207. type: "dispose"
  29208. })),
  29209. this.point2dInfo && this.point2dInfo.points2d.splice(e, 1),
  29210. this.dispatchEvent({
  29211. type: "removeMarker",
  29212. index: e,
  29213. marker: t
  29214. })
  29215. }
  29216. }, {
  29217. key: "createAreaPlane",
  29218. value: function(e) {
  29219. return new Hr(new Sl,e)
  29220. }
  29221. }, {
  29222. key: "updateAreaPlane",
  29223. value: function() {
  29224. var e, t;
  29225. this.point2dInfo && (this.areaPlane.geometry.dispose(),
  29226. 2 < this.points.length ? (this.areaPlane.geometry = Cf.getShapeGeo(this.point2dInfo.points2d),
  29227. t = Up.getCenterOfGravityPoint(this.point2dInfo.points2d),
  29228. (e = this.point2dInfo.points2d[0].clone()).z = 0,
  29229. e.applyQuaternion(this.point2dInfo.quaInverse),
  29230. e = this.point2dInfo.originPoint0.clone().sub(e),
  29231. (t = new Cn(t.x,t.y,0)).applyQuaternion(this.point2dInfo.quaInverse),
  29232. this.areaPlane.quaternion.copy(this.point2dInfo.quaInverse),
  29233. this.areaPlane.position.copy(e),
  29234. t.add(e),
  29235. this.center = t) : this.areaPlane.geometry = new Sl)
  29236. }
  29237. }, {
  29238. key: "update",
  29239. value: function() {
  29240. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  29241. if (0 !== this.points.length) {
  29242. for (var t = this.points.length - 1, n = 0; n <= t; n++) {
  29243. var i = this.points[n]
  29244. , r = this.points[t < n + 1 ? 0 : n + 1];
  29245. this.points[0 === n ? t : n - 1];
  29246. e.ifUpdateMarkers && this.updateMarker(this.markers[n], i);
  29247. var a = this.edges[n];
  29248. a && Sf.updateLine(a, [i, r])
  29249. }
  29250. this.areaPlane && this.updateAreaPlane(),
  29251. viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed")
  29252. }
  29253. }
  29254. }, {
  29255. key: "dispose",
  29256. value: function() {
  29257. this.parent.remove(this),
  29258. this.markers.concat(this.edges).forEach(function(e) {
  29259. return e.dispatchEvent({
  29260. type: "dispose"
  29261. })
  29262. })
  29263. }
  29264. }, {
  29265. key: "reDraw",
  29266. value: function() {
  29267. for (var e = this.points.length - (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0); 0 < e; )
  29268. this.removeMarker(--e);
  29269. this.point2dInfo = null,
  29270. this.facePlane = null
  29271. }
  29272. }, {
  29273. key: "setMarkerSelected",
  29274. value: function() {}
  29275. }, {
  29276. key: "editStateChange",
  29277. value: function(e) {
  29278. e || (viewer.dispatchEvent({
  29279. type: "CursorChange",
  29280. action: "remove",
  29281. name: "polygon_isIntersectSelf"
  29282. }),
  29283. viewer.dispatchEvent({
  29284. type: "CursorChange",
  29285. action: "remove",
  29286. name: "polygon_AtWrongPlace"
  29287. }),
  29288. viewer.dispatchEvent({
  29289. type: "reticule_forbit",
  29290. v: !1
  29291. }),
  29292. this.markers.forEach(function(e) {
  29293. return e.isDragging = !1
  29294. }))
  29295. }
  29296. }, {
  29297. key: "transformData",
  29298. value: function() {}
  29299. }, {
  29300. key: "setSelected",
  29301. value: function() {}
  29302. }, {
  29303. key: "continueDrag",
  29304. value: function(e, t) {
  29305. var n = this
  29306. , i = e || t.drag.object;
  29307. return i.isDragging = !0,
  29308. setTimeout(function() {
  29309. n.parent && i.isDragging && viewer.inputHandler.startDragging(i, {
  29310. endDragFun: t.drag.endDragFun,
  29311. notPressMouse: t.drag.notPressMouse,
  29312. dragViewport: t.drag.dragViewport
  29313. })
  29314. }, 1)
  29315. }
  29316. }]),
  29317. a
  29318. }();
  29319. function kf(e, t) {
  29320. for (var n = [], i = 0; i < e.length; i++) {
  29321. var r = e[i];
  29322. if (!n.find(function(e) {
  29323. return e.equals(r)
  29324. }) && (n.push(r),
  29325. n.length == t))
  29326. break
  29327. }
  29328. if (n.length == t)
  29329. return n
  29330. }
  29331. var Bf, Lf, Rf = new _c, mu = new Yi(T.measure.default.color), Ff = new Yi(T.measure.highlight.color), If = new Yi(T.measure.color), pd = new Yi(T.measure.textColor), Of = {
  29332. clipDistance: 4,
  29333. occlusionDistance: 1
  29334. }, zf = {
  29335. clipDistance: 6,
  29336. occlusionDistance: 2
  29337. }, Nf = {
  29338. minSize: 25,
  29339. maxSize: 65,
  29340. nearBound: .2,
  29341. farBound: 4
  29342. }, Uf = {
  29343. width2d: 200
  29344. }, Gf = {
  29345. backgroundColor: {
  29346. r: 255 * mu.r,
  29347. g: 255 * mu.g,
  29348. b: 255 * mu.b,
  29349. a: T.measure.default.opacity
  29350. },
  29351. textColor: {
  29352. r: 255 * pd.r,
  29353. g: 255 * pd.g,
  29354. b: 255 * pd.b,
  29355. a: 1
  29356. },
  29357. fontsize: 16,
  29358. useDepth: !0,
  29359. renderOrder: 5,
  29360. pickOrder: 5
  29361. }, Hf = {
  29362. backgroundColor: {
  29363. r: 255,
  29364. g: 255,
  29365. b: 255,
  29366. a: 1
  29367. },
  29368. textColor: {
  29369. r: 0,
  29370. g: 0,
  29371. b: 0,
  29372. a: 1
  29373. },
  29374. fontsize: 14,
  29375. renderOrder: 4,
  29376. pickOrder: 4
  29377. }, gu = gn.degToRad(5), Vf = gu, jf = Math.PI / 2 - gu, Wf = function() {
  29378. y(m, Df);
  29379. var n = w(m);
  29380. function m(e) {
  29381. var t;
  29382. return O(this, m),
  29383. e.dimension = "2d",
  29384. (t = n.call(this, "measure", e)).constructor.counter = void 0 === t.constructor.counter ? 0 : t.constructor.counter + 1,
  29385. t.name = t.measureType + t.constructor.counter,
  29386. t.markerLabels = [],
  29387. t.edgeLabels = [],
  29388. t.angleLabels = [],
  29389. t.coordinateLabels = [],
  29390. t.area = {
  29391. value: 0,
  29392. string: ""
  29393. },
  29394. t.closed && (t.areaLabel = t.createAreaLabel(),
  29395. t.add(t.areaLabel)),
  29396. (2 < t.maxMarkers || t.faceDirection) && t.createGuideLine(),
  29397. "Distance" == t.measureType && t.createHorVerGuideLine(),
  29398. t.selectStates = {},
  29399. t.setUnitSystem(e.unit || viewer.unitConvert.UnitService.defaultSystem),
  29400. viewer.setObjectLayers(g(t), "measure"),
  29401. t.initData(e),
  29402. t.points_datasets || (t.points_datasets = []),
  29403. t.addEventListener("marker_dropped", function(e) {
  29404. t.updateDatasetBelong(e.index)
  29405. }),
  29406. t.addEventListener("isVisible", function() {
  29407. viewer.mapViewer && viewer.mapViewer.dispatchEvent({
  29408. type: "content_changed"
  29409. })
  29410. }),
  29411. t
  29412. }
  29413. return h(m, [{
  29414. key: "initData",
  29415. value: function(e) {
  29416. b(v(m.prototype), "initData", this).call(this, e) ? this.edges.forEach(function(e) {
  29417. e.dispatchEvent("addHoverEvent")
  29418. }) : this.failBuilded = !0
  29419. }
  29420. }, {
  29421. key: "updateDatasetBelong",
  29422. value: function(e) {
  29423. var t = this;
  29424. if ("merge" != Potree.settings.editType) {
  29425. this.datasetId;
  29426. var n, i = {
  29427. id: null,
  29428. count: 0
  29429. }, r = {};
  29430. for (n in this.points_datasets.forEach(function(e) {
  29431. null != e && (r[e] ? r[e]++ : r[e] = 1)
  29432. }),
  29433. r)
  29434. r[n] > i.count && (i = {
  29435. id: n,
  29436. count: r[n]
  29437. });
  29438. this.datasetId = 0 < i.count ? i.id : null,
  29439. null == this.datasetId ? this.dataset_points = null : this.dataset_points = this.points.map(function(e) {
  29440. return Potree.Utils.datasetPosTransform({
  29441. toDataset: !0,
  29442. datasetId: t.datasetId,
  29443. position: e.clone()
  29444. })
  29445. })
  29446. } else
  29447. this.dataset_points[e] = Potree.Utils.datasetPosTransform({
  29448. toDataset: !0,
  29449. datasetId: this.points_datasets[e],
  29450. position: this.points[e].clone()
  29451. })
  29452. }
  29453. }, {
  29454. key: "transformByPointcloud",
  29455. value: function() {
  29456. var t = this;
  29457. null != this.datasetId && (this.points = this.dataset_points.map(function(e) {
  29458. return Potree.Utils.datasetPosTransform({
  29459. fromDataset: !0,
  29460. datasetId: t.datasetId,
  29461. position: e.clone()
  29462. })
  29463. }),
  29464. this.getPoint2dInfo(this.points),
  29465. this.update({
  29466. ifUpdateMarkers: !0
  29467. }),
  29468. this.setSelected(!1))
  29469. }
  29470. }, {
  29471. key: "update",
  29472. value: function() {
  29473. var a = this
  29474. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  29475. if (b(v(m.prototype), "update", this).call(this, e),
  29476. this.showCoordinates && 0 < this.points.length) {
  29477. var t = this.points[0];
  29478. this.markers[0].position.copy(t);
  29479. var n = this.coordinateLabels[0]
  29480. , i = viewer.transform.lonlatToLocal.inverse(t.toArray())
  29481. , e = viewer.transform.lonlatTo4550.forward(i)
  29482. , e = [t.toArray(), i, e].map(function(e) {
  29483. return e.map(function(e) {
  29484. return Jf.addCommas(e.toFixed(10))
  29485. }).join(", ")
  29486. }).join("<br>");
  29487. return n.setText(e),
  29488. n.setPos(t),
  29489. void n.setVisible(!0)
  29490. }
  29491. for (var r, o, s, l = function(e, t, n, i) {
  29492. var r = (new Cn).addVectors(t, n).multiplyScalar(.5);
  29493. e.setPos(r),
  29494. i = null == i ? t.distanceTo(n) : i;
  29495. n = viewer.unitConvert.convert(i, "distance", 3, a.unitSystem, .1, !0);
  29496. return e.setText(n),
  29497. i
  29498. }, u = this.points.length - 1, c = 0; c <= u; c++) {
  29499. var d, h, p = this.points[c], f = this.points[u < c + 1 ? 0 : c + 1];
  29500. this.points[0 === c ? u : c - 1];
  29501. this.showDistances && (d = this.edgeLabels[c],
  29502. h = p.distanceTo(f),
  29503. d.shouldVisi = (c < u || this.isRect || this.closed && !this.isNew) && 0 < h,
  29504. d.setVisible(d.shouldVisi),
  29505. d.visible && l(d, p, f, h))
  29506. }
  29507. "Distance" == this.measureType && 1 < this.points.length && (o = this.points[0].z > this.points[1].z ? (r = this.points[0],
  29508. this.points[1]) : (r = this.points[1],
  29509. this.points[0]),
  29510. s = new Cn(r.x,r.y,o.z),
  29511. n = r.distanceTo(s) / o.distanceTo(s),
  29512. n = Math.atan(n),
  29513. this.shouldShowHorVerGuide = Vf < n && n < jf,
  29514. Sf.updateLine(this.verGuideEdge, [r, s]),
  29515. Sf.updateLine(this.horGuideEdge, [o, s]),
  29516. l(this.verEdgeLabel, r, s),
  29517. l(this.horEdgeLabel, o, s),
  29518. this.verGuideEdge.visible = this.horGuideEdge.visible = this.shouldShowHorVerGuide,
  29519. this.verEdgeLabel.visible = this.horEdgeLabel.visible = this.shouldShowHorVerGuide),
  29520. this.showArea && this.point2dInfo && (o = Math.abs(Up.getArea(this.point2dInfo.points2d)),
  29521. s = viewer.unitConvert.convert(o, "area", 3, this.unitSystem),
  29522. this.area = {
  29523. value: o,
  29524. string: s
  29525. },
  29526. this.areaLabel.setPos(this.center),
  29527. this.areaLabel.setText(s),
  29528. this.areaLabel.setVisible(!0))
  29529. }
  29530. }, {
  29531. key: "addMarker",
  29532. value: function() {
  29533. var t, e, n = this, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = new qp({
  29534. mat: this.getMarkerMaterial("default"),
  29535. sizeInfo: Nf,
  29536. name: "measure_point"
  29537. });
  29538. return viewer.setObjectLayers(r, "measure"),
  29539. r.pickOrder = r.renderOrder = 3,
  29540. r.markerSelectStates = {},
  29541. r.addEventListener("startDragging", function(e) {
  29542. "MainView" == e.drag.dragViewport.name && viewer.inputHandler.dispatchEvent({
  29543. type: "isMeasuring",
  29544. v: !0,
  29545. cause: "startDragging"
  29546. })
  29547. }),
  29548. r.addEventListener("drop", function(e) {
  29549. viewer.inputHandler.dispatchEvent({
  29550. type: "isMeasuring",
  29551. v: !1,
  29552. cause: "stopDragging"
  29553. })
  29554. }),
  29555. (t = Sf.createFatLine([], {
  29556. material: this.getLineMat("edgeDefault")
  29557. })).pickOrder = 0,
  29558. viewer.setObjectLayers(t, "measure"),
  29559. t.addEventListener("addHoverEvent", function e() {
  29560. t.addEventListener("mouseover", function(e) {
  29561. n.setSelected(!0, "edge")
  29562. }),
  29563. t.addEventListener("mouseleave", function(e) {
  29564. n.setSelected(!1, "edge")
  29565. }),
  29566. t.removeEventListener("addHoverEvent", e)
  29567. }),
  29568. b(v(m.prototype), "addMarker", this).call(this, {
  29569. point: i.point,
  29570. marker: r,
  29571. edge: t
  29572. }),
  29573. this.showEdges && (e = this.createEdgeLabel("edgeLabel", !this.closed),
  29574. this.edgeLabels.push(e)),
  29575. this.showCoordinates && ((e = new $p({
  29576. className: "measure_pointPos",
  29577. camera: viewer.scene.getActiveCamera()
  29578. })).setVisible(!1),
  29579. this.coordinateLabels.push(e)),
  29580. this.dispatchEvent({
  29581. type: "marker_added",
  29582. measurement: this,
  29583. marker: r
  29584. }),
  29585. this.update(),
  29586. r
  29587. }
  29588. }, {
  29589. key: "editStateChange",
  29590. value: function(e) {
  29591. var t = this;
  29592. b(v(m.prototype), "editStateChange", this).call(this, e),
  29593. e ? this.isEditing || (this.dispatchEvent({
  29594. type: "editStateChange",
  29595. state: !0
  29596. }),
  29597. this.setEdgesDisplay(!0),
  29598. clearTimeout(this.editStateTimer)) : this.editStateTimer = setTimeout(function() {
  29599. t.isEditing || (t.dispatchEvent({
  29600. type: "editStateChange",
  29601. state: !1
  29602. }),
  29603. t.setEdgesDisplay(!1))
  29604. }, 100),
  29605. this.isEditing = e
  29606. }
  29607. }, {
  29608. key: "setMarkerSelected",
  29609. value: function(e, t, n) {
  29610. e.markerSelectStates[n] = t;
  29611. var i, r = !1;
  29612. for (i in e.markerSelectStates)
  29613. if ("hover" == e.markerSelectStates[i]) {
  29614. r = !0;
  29615. break
  29616. }
  29617. e.material = r ? this.getMarkerMaterial("select") : this.getMarkerMaterial("default"),
  29618. e.selected = r,
  29619. viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed")
  29620. }
  29621. }, {
  29622. key: "setEdgesDisplay",
  29623. value: function(t, e) {
  29624. this.closed && this.edgeLabels.forEach(function(e) {
  29625. return e.setVisible(!(!t || !e.shouldVisi))
  29626. }),
  29627. e || "Distance" != this.measureType || (this.horEdgeLabel.visible = this.verEdgeLabel.visible = this.horGuideEdge.visible = this.verGuideEdge.visible = !(!t || !this.shouldShowHorVerGuide))
  29628. }
  29629. }, {
  29630. key: "setSelected",
  29631. value: function(e, t) {
  29632. var n = this;
  29633. t && (this.selectStates[t] = e);
  29634. var i, r = !1;
  29635. for (i in this.selectStates)
  29636. if (this.selectStates[i]) {
  29637. r = !0;
  29638. break
  29639. }
  29640. r ? (this.markers.forEach(function(e) {
  29641. return n.setMarkerSelected(e, "hover", "selectAll")
  29642. }),
  29643. this.edges.forEach(function(e) {
  29644. return e.material = n.getLineMat("edgeSelect")
  29645. }),
  29646. this.areaPlane && (this.areaPlane.material = Lf.selected),
  29647. this.setEdgesDisplay(!0, "screenshot" == t),
  29648. this.areaLabel && Xf(this.areaLabel, !0),
  29649. this.closed || this.edgeLabels.forEach(function(e) {
  29650. return Xf(e, !0)
  29651. })) : (this.markers.forEach(function(e) {
  29652. return n.setMarkerSelected(e, "unhover", "selectAll")
  29653. }),
  29654. this.edges.forEach(function(e) {
  29655. return e.material = n.getLineMat("edgeDefault")
  29656. }),
  29657. this.areaPlane && (this.areaPlane.material = Lf.default),
  29658. this.setEdgesDisplay(!1, "screenshot" == t),
  29659. this.areaLabel && Xf(this.areaLabel, !1),
  29660. this.closed || this.edgeLabels.forEach(function(e) {
  29661. return Xf(e, !1)
  29662. })),
  29663. this.selected = r,
  29664. viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed"),
  29665. "byList" != t && this.dispatchEvent({
  29666. type: "highlight",
  29667. state: this.selected
  29668. })
  29669. }
  29670. }, {
  29671. key: "removeMarker",
  29672. value: function(e) {
  29673. b(v(m.prototype), "removeMarker", this).call(this, e),
  29674. this.points_datasets.splice(e, 1),
  29675. this.dataset_points && this.dataset_points.splice(e, 1),
  29676. this.coordinateLabels.splice(e, 1);
  29677. this.edgeLabels[e] && (this.edgeLabels[e].dispose(),
  29678. this.edgeLabels.splice(e, 1)),
  29679. this.update(),
  29680. this.dispatchEvent({
  29681. type: "marker_removed",
  29682. measurement: this
  29683. })
  29684. }
  29685. }, {
  29686. key: "setPosition",
  29687. value: function(e, t) {
  29688. b(v(m.prototype), "setPosition", this).call(this, e, t);
  29689. t = {
  29690. type: "marker_moved",
  29691. measure: this,
  29692. index: e,
  29693. position: t.clone()
  29694. };
  29695. this.dispatchEvent(t)
  29696. }
  29697. }, {
  29698. key: "dispose",
  29699. value: function() {
  29700. var e = this.edgeLabels.concat(this.coordinateLabels);
  29701. this.areaLabel && e.push(this.areaLabel),
  29702. e.forEach(function(e) {
  29703. return e.dispatchEvent({
  29704. type: "dispose"
  29705. })
  29706. }),
  29707. b(v(m.prototype), "dispose", this).call(this)
  29708. }
  29709. }, {
  29710. key: "getTotalDistance",
  29711. value: function() {
  29712. if (0 === this.points.length)
  29713. return 0;
  29714. for (var e, t = 0, n = 1; n < this.points.length; n++) {
  29715. var i = this.points[n - 1]
  29716. , r = this.points[n];
  29717. t += i.distanceTo(r)
  29718. }
  29719. return this.closed && 1 < this.points.length && (e = this.points[0],
  29720. t += this.points[this.points.length - 1].distanceTo(e)),
  29721. t
  29722. }
  29723. }, {
  29724. key: "getAngleBetweenLines",
  29725. value: function(e, t, n) {
  29726. t = (new Cn).subVectors(t, e),
  29727. e = (new Cn).subVectors(n, e);
  29728. return 0 === Math.sqrt(t.lengthSq() * e.lengthSq()) ? 0 : t.angleTo(e)
  29729. }
  29730. }, {
  29731. key: "getAngle",
  29732. value: function(e) {
  29733. if (this.points.length < 3 || e >= this.points.length)
  29734. return 0;
  29735. var t = 0 === e ? this.points[this.points.length - 1] : this.points[e - 1]
  29736. , n = this.points[e]
  29737. , e = this.points[(e + 1) % this.points.length];
  29738. return this.getAngleBetweenLines(n, t, e)
  29739. }
  29740. }, {
  29741. key: "getCenter",
  29742. value: function() {
  29743. return 3 <= this.points.length ? this.center.clone() : 2 == this.points.length ? this.points[0].clone().add(this.points[1]).multiplyScalar(.5) : this.points[0].clone()
  29744. }
  29745. }, {
  29746. key: "createGuideLine",
  29747. value: function() {
  29748. var e = Sf.createFatLine([], {
  29749. material: this.getLineMat("guide")
  29750. });
  29751. e.visible = !1,
  29752. this.guideLine = e,
  29753. this.add(e)
  29754. }
  29755. }, {
  29756. key: "createHorVerGuideLine",
  29757. value: function() {
  29758. var e = Sf.createFatLine([], {
  29759. material: this.getLineMat("guide")
  29760. });
  29761. e.visible = !1,
  29762. this.verGuideEdge = e;
  29763. e = Sf.createFatLine([], {
  29764. material: this.getLineMat("guide")
  29765. });
  29766. e.visible = !1,
  29767. this.horGuideEdge = e,
  29768. this.add(this.verGuideEdge),
  29769. this.add(this.horGuideEdge),
  29770. this.verEdgeLabel = this.createEdgeLabel("verGuideEdge"),
  29771. this.horEdgeLabel = this.createEdgeLabel("horGuideEdge")
  29772. }
  29773. }, {
  29774. key: "createEdgeLabel",
  29775. value: function(e, t) {
  29776. var n = this
  29777. , e = new Jp($.extend(t ? Gf : Hf, {
  29778. sizeInfo: Uf,
  29779. name: e || "edgeLabel"
  29780. }));
  29781. return t && (e.addEventListener("mouseover", function() {
  29782. n.setSelected(!0, "edgeLabel")
  29783. }),
  29784. e.addEventListener("mouseleave", function() {
  29785. n.setSelected(!1, "edgeLabel")
  29786. }),
  29787. e.addEventListener("click", function() {
  29788. viewer.focusOnObject(n, "measure")
  29789. })),
  29790. e.visible = !1,
  29791. e.sprite.material.depthTestWhenPick = !0,
  29792. viewer.setObjectLayers(e, "measure"),
  29793. this.add(e),
  29794. e
  29795. }
  29796. }, {
  29797. key: "createAreaLabel",
  29798. value: function() {
  29799. var e = this
  29800. , t = new Jp($.extend(Gf, {
  29801. sizeInfo: Uf,
  29802. name: "areaLabel_"
  29803. }));
  29804. return t.addEventListener("mouseover", function() {
  29805. e.setSelected(!0, "areaLabel")
  29806. }),
  29807. t.addEventListener("mouseleave", function() {
  29808. e.setSelected(!1, "areaLabel")
  29809. }),
  29810. t.addEventListener("click", function() {
  29811. viewer.focusOnObject(e, "measure")
  29812. }),
  29813. viewer.setObjectLayers(t, "measure"),
  29814. t.visible = !1,
  29815. t
  29816. }
  29817. }, {
  29818. key: "getMarkerMaterial",
  29819. value: function(e) {
  29820. return Bf || (Bf = {
  29821. default: new Wp($.extend({}, Of, {
  29822. transparent: !0,
  29823. opacity: 1,
  29824. map: Rf.load(Potree.resourcePath + "/textures/pic_point_s32.png"),
  29825. useDepth: !0
  29826. })),
  29827. select: new $i({
  29828. transparent: !0,
  29829. opacity: 1,
  29830. depthTest: !1,
  29831. map: Rf.load(Potree.resourcePath + "/textures/pic_point32.png")
  29832. })
  29833. },
  29834. m.markerMats = Bf),
  29835. Bf[e]
  29836. }
  29837. }, {
  29838. key: "getLineMat",
  29839. value: function(e) {
  29840. return (m.lineMats = !m.lineMats ? {
  29841. edgeDefault: Sf.createFatLineMat({
  29842. color: T.measure.default.color,
  29843. lineWidth: T.measure.lineWidth,
  29844. useDepth: !0,
  29845. dashWithDepth: !0,
  29846. dashed: !0,
  29847. dashSize: .04,
  29848. gapSize: .04,
  29849. transparent: !0,
  29850. opacity: T.measure.default.opacity,
  29851. depthTestWhenPick: !0
  29852. }),
  29853. edgeSelect: Sf.createFatLineMat({
  29854. color: T.measure.highlight.color,
  29855. dashSize: .5,
  29856. gapSize: .2,
  29857. lineWidth: T.measure.lineWidth,
  29858. transparent: !0,
  29859. opacity: T.measure.highlight.opacity
  29860. }),
  29861. guide: Sf.createFatLineMat({
  29862. color: T.measure.guide.color,
  29863. dashSize: .1,
  29864. gapSize: .02,
  29865. dashed: !0,
  29866. lineWidth: T.measure.lineWidth
  29867. })
  29868. } : m.lineMats)[e]
  29869. }
  29870. }, {
  29871. key: "createAreaPlane",
  29872. value: function() {
  29873. return Lf || (Lf = {
  29874. default: new Wp($.extend({}, zf, {
  29875. color: If,
  29876. side: Y,
  29877. opacity: .2,
  29878. transparent: !0,
  29879. useDepth: !0
  29880. })),
  29881. selected: new $i({
  29882. color: If,
  29883. side: Y,
  29884. opacity: .3,
  29885. transparent: !0
  29886. })
  29887. },
  29888. m.planeMats = Lf),
  29889. b(v(m.prototype), "createAreaPlane", this).call(this, Lf.default)
  29890. }
  29891. }, {
  29892. key: "raycast",
  29893. value: function(e, t) {
  29894. for (var n = 0; n < this.points.length; n++)
  29895. this.markers[n].raycast(e, t);
  29896. for (var i = 0; i < t.length; i++) {
  29897. var r = t[i];
  29898. r.distance = e.ray.origin.distanceTo(r.point)
  29899. }
  29900. t.sort(function(e, t) {
  29901. return e.distance - t.distance
  29902. })
  29903. }
  29904. }, {
  29905. key: "transformData",
  29906. value: function(e) {
  29907. "Point" == e.measureType ? (e.showCoordinates = !0,
  29908. e.closed = !0,
  29909. e.maxMarkers = 1,
  29910. e.minMarkers = 1) : "Distance" == e.measureType ? (e.showDistances = !0,
  29911. e.closed = !1,
  29912. e.showEdges = !0,
  29913. e.maxMarkers = 2,
  29914. e.minMarkers = 2) : "Ver Distance" == e.measureType ? (e.showDistances = !0,
  29915. e.closed = !1,
  29916. e.showEdges = !0,
  29917. e.maxMarkers = 2,
  29918. e.minMarkers = 2,
  29919. e.faceDirection = "vertical",
  29920. e.unableDragAtMap = !0) : "Hor Distance" == e.measureType ? (e.showDistances = !0,
  29921. e.closed = !1,
  29922. e.showEdges = !0,
  29923. e.maxMarkers = 2,
  29924. e.minMarkers = 2,
  29925. e.faceDirection = "horizontal") : "Area" == e.measureType ? (e.showDistances = !0,
  29926. e.showArea = !0,
  29927. e.showEdges = !0,
  29928. e.closed = !0,
  29929. e.minMarkers = 3) : "Hor Area" == e.measureType ? (e.showDistances = !0,
  29930. e.showArea = !0,
  29931. e.showEdges = !0,
  29932. e.closed = !0,
  29933. e.minMarkers = 3,
  29934. e.faceDirection = "horizontal") : "Ver Area" == e.measureType ? (e.showDistances = !0,
  29935. e.showArea = !0,
  29936. e.showEdges = !0,
  29937. e.closed = !0,
  29938. e.minMarkers = 3,
  29939. e.faceDirection = "vertical",
  29940. e.unableDragAtMap = !0) : "Rect Area" == e.measureType ? (e.showDistances = !0,
  29941. e.showArea = !0,
  29942. e.showEdges = !0,
  29943. e.closed = !0,
  29944. e.minMarkers = 4,
  29945. e.maxMarkers = 4) : "Hor Rect Area" == e.measureType ? (e.showDistances = !0,
  29946. e.showArea = !0,
  29947. e.showEdges = !0,
  29948. e.closed = !0,
  29949. e.minMarkers = 4,
  29950. e.maxMarkers = 4,
  29951. e.isRect = !0,
  29952. e.faceDirection = "horizontal") : "Ver Rect Area" == e.measureType && (e.showDistances = !0,
  29953. e.showArea = !0,
  29954. e.showEdges = !0,
  29955. e.closed = !0,
  29956. e.minMarkers = 4,
  29957. e.maxMarkers = 4,
  29958. e.isRect = !0,
  29959. e.faceDirection = "vertical",
  29960. e.unableDragAtMap = !0)
  29961. }
  29962. }, {
  29963. key: "setUnitSystem",
  29964. value: function(e) {
  29965. e != this.unitSystem && (this.unitSystem = e,
  29966. this.update())
  29967. }
  29968. }, {
  29969. key: "reDraw",
  29970. value: function() {
  29971. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;
  29972. b(v(m.prototype), "reDraw", this).call(this, e),
  29973. "Distance" == this.measureType && (this.shouldShowHorVerGuide = !1,
  29974. this.setEdgesDisplay(!1)),
  29975. this.showArea && (this.area = {
  29976. value: 0
  29977. },
  29978. this.areaLabel && this.areaLabel.setVisible(!1)),
  29979. viewer.inputHandler.dispatchEvent({
  29980. type: "isMeasuring",
  29981. v: !0,
  29982. cause: "reDraw"
  29983. })
  29984. }
  29985. }]),
  29986. m
  29987. }();
  29988. function Xf(e, t) {
  29989. t ? (e.backgroundColor = {
  29990. r: 255 * Ff.r,
  29991. g: 255 * Ff.g,
  29992. b: 255 * Ff.b,
  29993. a: T.measure.highlight.opacity
  29994. },
  29995. e.backgroundColor.a = T.measure.highlight.opacity,
  29996. e.sprite.material.useDepth = !1) : (e.backgroundColor = Gf.backgroundColor,
  29997. e.backgroundColor.a = T.measure.default.opacity,
  29998. e.sprite.material.useDepth = !0),
  29999. e.updateTexture()
  30000. }
  30001. var qf = function() {
  30002. y(r, Si);
  30003. var i = w(r);
  30004. function r(e) {
  30005. var t, n;
  30006. return O(this, r),
  30007. (n = i.call(this)).constructor.counter = void 0 === n.constructor.counter ? 0 : n.constructor.counter + 1,
  30008. n.name = "polygon_clip_volume_" + n.constructor.counter,
  30009. n.camera = e.clone(),
  30010. (t = n.camera.rotation).set.apply(t, Q(e.rotation.toArray())),
  30011. n.camera.rotation.order = e.rotation.order,
  30012. n.camera.updateMatrixWorld(),
  30013. n.camera.updateProjectionMatrix(),
  30014. n.camera.matrixWorldInverse.copy(n.camera.matrixWorld).invert(),
  30015. n.viewMatrix = n.camera.matrixWorldInverse.clone(),
  30016. n.projMatrix = n.camera.projectionMatrix.clone(),
  30017. n.markers = [],
  30018. n.initialized = !1,
  30019. n
  30020. }
  30021. return h(r, [{
  30022. key: "addMarker",
  30023. value: function() {
  30024. function t(e) {
  30025. var t = e.viewer.renderer.getSize(new yn)
  30026. , t = new Cn(e.drag.end.x / t.width * 2 - 1,e.drag.end.y / t.height * -2 + 1,0);
  30027. i.position.copy(t)
  30028. }
  30029. function n(e) {
  30030. r()
  30031. }
  30032. var i = new Hr
  30033. , r = function(e) {
  30034. i.removeEventListener("drag", t),
  30035. i.removeEventListener("drop", n)
  30036. };
  30037. i.addEventListener("drag", t),
  30038. i.addEventListener("drop", n),
  30039. this.markers.push(i)
  30040. }
  30041. }, {
  30042. key: "removeLastMarker",
  30043. value: function() {
  30044. 0 < this.markers.length && this.markers.splice(this.markers.length - 1, 1)
  30045. }
  30046. }]),
  30047. r
  30048. }()
  30049. , Jf = function() {
  30050. function g() {
  30051. O(this, g)
  30052. }
  30053. var t, n, i;
  30054. return h(g, null, [{
  30055. key: "loadShapefileFeatures",
  30056. value: (i = r(regeneratorRuntime.mark(function e(t, n) {
  30057. var i, r, a, o;
  30058. return regeneratorRuntime.wrap(function(e) {
  30059. for (; ; )
  30060. switch (e.prev = e.next) {
  30061. case 0:
  30062. return i = [],
  30063. r = function() {
  30064. n(i)
  30065. }
  30066. ,
  30067. e.next = 4,
  30068. shapefile.open(t);
  30069. case 4:
  30070. a = e.sent;
  30071. case 5:
  30072. return e.next = 8,
  30073. a.read();
  30074. case 8:
  30075. if ((o = e.sent).done)
  30076. return r(),
  30077. e.abrupt("break", 15);
  30078. e.next = 12;
  30079. break;
  30080. case 12:
  30081. o.value && "Feature" === o.value.type && void 0 !== o.value.geometry && i.push(o.value),
  30082. e.next = 5;
  30083. break;
  30084. case 15:
  30085. case "end":
  30086. return e.stop()
  30087. }
  30088. }, e)
  30089. })),
  30090. function(e, t) {
  30091. return i.apply(this, arguments)
  30092. }
  30093. )
  30094. }, {
  30095. key: "toString",
  30096. value: function(e) {
  30097. return null != e.x ? e.x.toFixed(2) + ", " + e.y.toFixed(2) + ", " + e.z.toFixed(2) : "" + e
  30098. }
  30099. }, {
  30100. key: "normalizeURL",
  30101. value: function(e) {
  30102. e = new URL(e);
  30103. return e.protocol + "//" + e.hostname + e.pathname.replace(/\/+/g, "/")
  30104. }
  30105. }, {
  30106. key: "pathExists",
  30107. value: function(e) {
  30108. var t = Gp.createXMLHttpRequest();
  30109. return t.open("GET", e, !1),
  30110. t.send(null),
  30111. 200 === t.status
  30112. }
  30113. }, {
  30114. key: "debugSphere",
  30115. value: function(e, t, n, i) {
  30116. var r = new Su(1,8,8)
  30117. , i = void 0 !== i ? new $i({
  30118. color: i
  30119. }) : new Xu
  30120. , i = new Hr(r,i);
  30121. return i.position.copy(t),
  30122. i.scale.set(n, n, n),
  30123. e.add(i),
  30124. i
  30125. }
  30126. }, {
  30127. key: "debugLine",
  30128. value: function(e, t, n, i) {
  30129. var r = new tl({
  30130. color: i
  30131. })
  30132. , a = new Sl
  30133. , i = new Cn(0,0,0)
  30134. , n = n.clone().sub(t);
  30135. a.vertices.push(i, n);
  30136. r = new sl(a,r);
  30137. return r.position.copy(t),
  30138. e.add(r),
  30139. {
  30140. node: r,
  30141. set: function(e, t) {
  30142. a.vertices[0].copy(e),
  30143. a.vertices[1].copy(t),
  30144. a.verticesNeedUpdate = !0
  30145. }
  30146. }
  30147. }
  30148. }, {
  30149. key: "debugCircle",
  30150. value: function(e, t, n, i, r) {
  30151. for (var r = new tl({
  30152. color: r
  30153. }), a = new Sl, o = 0; o <= 32; o++) {
  30154. var s = 2 * Math.PI * (o / 32)
  30155. , l = 2 * Math.PI * (o + 1) / 32
  30156. , s = new Cn(Math.cos(s),Math.sin(s),0)
  30157. , l = new Cn(Math.cos(l),Math.sin(l),0);
  30158. a.vertices.push(s, l)
  30159. }
  30160. r = new sl(a,r);
  30161. r.position.copy(t),
  30162. r.scale.set(n, n, n),
  30163. e.add(r)
  30164. }
  30165. }, {
  30166. key: "debugBox",
  30167. value: function(e, t) {
  30168. var n, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new ni, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 16776960, a = [[t.min.x, t.min.y, t.min.z], [t.min.x, t.min.y, t.max.z], [t.min.x, t.max.y, t.min.z], [t.min.x, t.max.y, t.max.z], [t.max.x, t.min.y, t.min.z], [t.max.x, t.min.y, t.max.z], [t.max.x, t.max.y, t.min.z], [t.max.x, t.max.y, t.max.z]].map(function(e) {
  30169. return B(Cn, Q(e))
  30170. }), o = t.getCenter(new Cn), t = [{
  30171. position: [t.min.x, o.y, o.z],
  30172. color: 16711680
  30173. }, {
  30174. position: [t.max.x, o.y, o.z],
  30175. color: 8912896
  30176. }, {
  30177. position: [o.x, t.min.y, o.z],
  30178. color: 65280
  30179. }, {
  30180. position: [o.x, t.max.y, o.z],
  30181. color: 34816
  30182. }, {
  30183. position: [o.x, o.y, t.min.z],
  30184. color: 255
  30185. }, {
  30186. position: [o.x, o.y, t.max.z],
  30187. color: 136
  30188. }], s = ue(a);
  30189. try {
  30190. for (s.s(); !(n = s.n()).done; ) {
  30191. var l = n.value.clone().applyMatrix4(i);
  30192. g.debugSphere(e, l, .1, 16711680)
  30193. }
  30194. } catch (e) {
  30195. s.e(e)
  30196. } finally {
  30197. s.f()
  30198. }
  30199. for (var u = 0, c = [[0, 4], [4, 5], [5, 1], [1, 0], [2, 6], [6, 7], [7, 3], [3, 2], [0, 2], [4, 6], [5, 7], [1, 3]]; u < c.length; u++) {
  30200. var d = c[u]
  30201. , h = a[d[0]].clone().applyMatrix4(i)
  30202. , d = a[d[1]].clone().applyMatrix4(i);
  30203. g.debugLine(e, h, d, r)
  30204. }
  30205. for (var p = 0, f = t; p < f.length; p++) {
  30206. var m = f[p]
  30207. , v = B(Cn, Q(m.position)).applyMatrix4(i);
  30208. g.debugSphere(e, v, .1, m.color)
  30209. }
  30210. }
  30211. }, {
  30212. key: "debugPlane",
  30213. value: function(e, t) {
  30214. t = new Hh(t,2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1,3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 255);
  30215. e.add(t)
  30216. }
  30217. }, {
  30218. key: "computeTransformedBoundingBox",
  30219. value: function(e, t) {
  30220. e = [new Cn(e.min.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.max.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.max.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.min.y,e.max.z).applyMatrix4(t), new Cn(e.min.x,e.max.y,e.max.z).applyMatrix4(t), new Cn(e.max.x,e.max.y,e.min.z).applyMatrix4(t), new Cn(e.max.x,e.min.y,e.max.z).applyMatrix4(t), new Cn(e.max.x,e.max.y,e.max.z).applyMatrix4(t)],
  30221. t = new kn;
  30222. return t.setFromPoints(e),
  30223. t
  30224. }
  30225. }, {
  30226. key: "addCommas",
  30227. value: function(e) {
  30228. for (var e = (e += "").split("."), t = e[0], e = 1 < e.length ? "." + e[1] : "", n = /(\d+)(\d{3})/; n.test(t); )
  30229. t = t.replace(n, "$1,$2");
  30230. return t + e
  30231. }
  30232. }, {
  30233. key: "removeCommas",
  30234. value: function(e) {
  30235. return e.replace(/,/g, "")
  30236. }
  30237. }, {
  30238. key: "createWorker",
  30239. value: function(e) {
  30240. e = new Blob([e],{
  30241. type: "application/javascript"
  30242. });
  30243. return new Worker(URL.createObjectURL(e))
  30244. }
  30245. }, {
  30246. key: "moveTo",
  30247. value: function(e, t, n) {
  30248. var i = e.view
  30249. , r = e.getActiveCamera()
  30250. , e = TWEEN.Easing.Quartic.Out
  30251. , t = new TWEEN.Tween(i.position).to(t, 500);
  30252. t.easing(e),
  30253. t.start();
  30254. var t = r.position.distanceTo(n)
  30255. , a = (new Cn).addVectors(r.position, r.getWorldDirection(new Cn).clone().multiplyScalar(t))
  30256. , n = new TWEEN.Tween(a).to(n, 500);
  30257. n.easing(e),
  30258. n.onUpdate(function() {
  30259. i.lookAt(a)
  30260. }),
  30261. n.onComplete(function() {
  30262. i.lookAt(a)
  30263. }),
  30264. n.start()
  30265. }
  30266. }, {
  30267. key: "loadSkybox",
  30268. value: function(e) {
  30269. var t = new Si
  30270. , n = new $r(75,window.innerWidth / window.innerHeight,1,1e5);
  30271. window.axisYup || n.up.set(0, 0, 1);
  30272. for (var i = new gs, r = ".jpg", a = [e + "px" + r, e + "nx" + r, e + "py" + r, e + "ny" + r, e + "pz" + r, e + "nz" + r], o = [], s = 0; s < 6; s++)
  30273. !function(e) {
  30274. var t = new $i({
  30275. map: null,
  30276. side: J,
  30277. depthTest: !1,
  30278. depthWrite: !1,
  30279. color: 4343126
  30280. });
  30281. o.push(t),
  30282. (new _c).load(a[e], function(e) {
  30283. t.map = e,
  30284. t.needsUpdate = !0,
  30285. t.color.setHex(16777215)
  30286. }, function(e) {}, function(e) {
  30287. console.log("An error happened", e)
  30288. })
  30289. }(s);
  30290. r = new Hr(new Cl(700,700,700),o);
  30291. return i.add(r),
  30292. i.traverse(function(e) {
  30293. return e.frustumCulled = !1
  30294. }),
  30295. i.rotation.x = Math.PI / 2,
  30296. t.children.push(n),
  30297. n.parent = t,
  30298. {
  30299. camera: n,
  30300. scene: i,
  30301. parent: t
  30302. }
  30303. }
  30304. }, {
  30305. key: "createGrid",
  30306. value: function(e, t, n, i) {
  30307. for (var i = new tl({
  30308. color: i || 8947848
  30309. }), r = new Sl, a = 0; a <= t; a++)
  30310. r.vertices.push(new Cn(-n * e / 2,a * n - n * t / 2,0)),
  30311. r.vertices.push(new Cn(+n * e / 2,a * n - n * t / 2,0));
  30312. for (var o = 0; o <= e; o++)
  30313. r.vertices.push(new Cn(o * n - n * e / 2,-n * t / 2,0)),
  30314. r.vertices.push(new Cn(o * n - n * e / 2,+n * t / 2,0));
  30315. i = new cl(r,i);
  30316. return i.receiveShadow = !0,
  30317. i
  30318. }
  30319. }, {
  30320. key: "createBackgroundTexture",
  30321. value: function(e, t) {
  30322. function n(e, t) {
  30323. return 1 / (2 * Math.PI) * Math.exp(-(e * e + t * t) / 2)
  30324. }
  30325. for (var i = new Uint8Array(3 * (e * t)), r = [1, 1.5, 1.7], a = n(0, 0), o = 0; o < e; o++)
  30326. for (var s = 0; s < t; s++) {
  30327. var l = o + e * s
  30328. , u = n(2 * (o / e * 2 - 1), 2 * (s / t * 2 - 1)) / a
  30329. , c = (.5 * u + .5) * (c = (Math.random() + Math.random() + Math.random()) / 3) * .03;
  30330. c *= .4,
  30331. i[3 * l + 0] = 255 * (u / 15 + .05 + c) * r[0],
  30332. i[3 * l + 1] = 255 * (u / 15 + .05 + c) * r[1],
  30333. i[3 * l + 2] = 255 * (u / 15 + .05 + c) * r[2]
  30334. }
  30335. var d = new ia(i,e,t,$e);
  30336. return d.needsUpdate = !0,
  30337. d
  30338. }
  30339. }, {
  30340. key: "getMousePointCloudIntersection",
  30341. value: function(e, t, n, i, r, a) {
  30342. var o = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : {};
  30343. if (a && 0 != a.length) {
  30344. var s = r.renderer;
  30345. e ? (o.x = t.x,
  30346. o.y = e.resolution.y - t.y) : (o.x = t.x,
  30347. o.y = s.domElement.clientHeight - t.y);
  30348. t = new sh;
  30349. t.setFromCamera(n, i);
  30350. var l, u, c = t.ray, d = null, h = 1 / 0, p = null, f = null, m = new Map;
  30351. o.isMeasuring || "showPanos" == Potree.settings.displayMode ? (l = Potree.settings.pointDensity,
  30352. Potree.settings.pointDensity = "magnifier",
  30353. a.forEach(function(e) {
  30354. m.set(e, e.temp.pointSize),
  30355. u = e.material.pointSizeType,
  30356. e.material.pointSizeType = Potree.config.material.pointSizeType,
  30357. e.changePointSize(2 * Potree.config.material.realPointSize, !0)
  30358. }),
  30359. Potree.updatePointClouds(a, i, e.resolution)) : (1 < r.viewports.filter(function(e) {
  30360. return !e.noPointcloud && e.active
  30361. }).length || o.cameraChanged) && (e.beforeRender && e.beforeRender(),
  30362. Potree.updatePointClouds(a, i, e.resolution));
  30363. var v, g = [], y = ue(a);
  30364. try {
  30365. for (y.s(); !(v = y.n()).done; ) {
  30366. var w, b = v.value, x = b.pick(r, e, i, c, o);
  30367. x && (g.push(b),
  30368. (w = i.position.distanceTo(x.position)) < h && (h = w,
  30369. d = b,
  30370. p = x.position,
  30371. f = x))
  30372. }
  30373. } catch (e) {
  30374. y.e(e)
  30375. } finally {
  30376. y.f()
  30377. }
  30378. return !o.isMeasuring && "showPanos" != Potree.settings.displayMode || (Potree.settings.pointDensity = l,
  30379. a.forEach(function(e) {
  30380. e.material.pointSizeType = u,
  30381. e.changePointSize(m.get(e))
  30382. })),
  30383. d ? {
  30384. location: p,
  30385. distance: h,
  30386. pointcloud: d,
  30387. point: f,
  30388. pointclouds: g,
  30389. normal: (new Cn).fromArray(f.normal)
  30390. } : null
  30391. }
  30392. }
  30393. }, {
  30394. key: "renderTargetToDataUrl",
  30395. value: function(e, t, n, i) {
  30396. var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .7
  30397. , a = new Uint8Array(4 * (t * n));
  30398. return i.readRenderTargetPixels(e, 0, 0, t, n, a),
  30399. Potree.Utils.pixelsArrayToDataUrl(a, t, n, r)
  30400. }
  30401. }, {
  30402. key: "pixelsArrayToDataUrl",
  30403. value: function(e, t, n) {
  30404. var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : .7
  30405. , r = document.createElement("canvas");
  30406. r.width = t,
  30407. r.height = n;
  30408. var a = r.getContext("2d");
  30409. e = new e.constructor(e);
  30410. for (var o = 4 * t, s = 0; s < parseInt(n / 2); s++) {
  30411. var l = n - s - 1
  30412. , u = e.slice(s * o, s * o + o)
  30413. , c = e.slice(l * o, l * o + o);
  30414. e.set(c, s * o),
  30415. e.set(u, l * o)
  30416. }
  30417. t = a.createImageData(t, n);
  30418. return t.data.set(e),
  30419. a.putImageData(t, 0, 0),
  30420. r.toDataURL(i)
  30421. }
  30422. }, {
  30423. key: "removeListeners",
  30424. value: function(e, t) {
  30425. void 0 !== e._listeners && e._listeners[t] && delete e._listeners[t]
  30426. }
  30427. }, {
  30428. key: "mouseToRay",
  30429. value: function(e, t) {
  30430. var n = new Cn(e.x,e.y,1)
  30431. , e = new Cn(e.x,e.y,-1);
  30432. n.unproject(t),
  30433. e.unproject(t);
  30434. n = (new Cn).subVectors(n, e).normalize();
  30435. return new ti(e,n)
  30436. }
  30437. }, {
  30438. key: "getPos2d",
  30439. value: function(e, t, n, i) {
  30440. var r = Up.closeTo(t.position, e, 1e-5) ? new Cn(0,0,1.5) : e.clone().project(t)
  30441. , a = (r.x + 1) / 2 * n.clientWidth * i.width
  30442. , e = (1 - (r.y + 1) / 2) * n.clientHeight * i.height
  30443. , t = i.left * n.clientWidth
  30444. , i = (1 - i.bottom - i.height) * n.clientHeight
  30445. , n = r.x <= 1 && -1 <= r.x && r.x <= 1 && -1 <= r.y;
  30446. return {
  30447. pos: new yn(t + a,i + e),
  30448. vector: r,
  30449. trueSide: r.z < 1,
  30450. inSight: n,
  30451. posInViewport: new yn(a,e)
  30452. }
  30453. }
  30454. }, {
  30455. key: "projectedRadius",
  30456. value: function(e, t, n, i, r) {
  30457. if (t instanceof ed)
  30458. return g.projectedRadiusOrtho(e, t.projectionMatrix, i, r);
  30459. if (t instanceof $r)
  30460. return g.projectedRadiusPerspective(e, t.fov * Math.PI / 180, n, r);
  30461. throw new Error("invalid parameters")
  30462. }
  30463. }, {
  30464. key: "projectedRadiusPerspective",
  30465. value: function(e, t, n, i) {
  30466. return e * (1 / Math.tan(t / 2) / n * i / 2)
  30467. }
  30468. }, {
  30469. key: "projectedRadiusOrtho",
  30470. value: function(e, t, n, i) {
  30471. var r = new Mn(0)
  30472. , e = new Mn(e);
  30473. return r.applyMatrix4(t),
  30474. e.applyMatrix4(t),
  30475. r = new Cn(r.x,r.y,r.z),
  30476. e = new Cn(e.x,e.y,e.z),
  30477. r.x = .5 * (r.x + 1) * n,
  30478. r.y = .5 * (r.y + 1) * i,
  30479. e.x = .5 * (e.x + 1) * n,
  30480. e.y = .5 * (e.y + 1) * i,
  30481. r.distanceTo(e)
  30482. }
  30483. }, {
  30484. key: "topView",
  30485. value: function(e, t) {
  30486. e.position.set(0, 1, 0),
  30487. e.rotation.set(-Math.PI / 2, 0, 0),
  30488. e.zoomTo(t, 1)
  30489. }
  30490. }, {
  30491. key: "frontView",
  30492. value: function(e, t) {
  30493. e.position.set(0, 0, 1),
  30494. e.rotation.set(0, 0, 0),
  30495. e.zoomTo(t, 1)
  30496. }
  30497. }, {
  30498. key: "leftView",
  30499. value: function(e, t) {
  30500. e.position.set(-1, 0, 0),
  30501. e.rotation.set(0, -Math.PI / 2, 0),
  30502. e.zoomTo(t, 1)
  30503. }
  30504. }, {
  30505. key: "rightView",
  30506. value: function(e, t) {
  30507. e.position.set(1, 0, 0),
  30508. e.rotation.set(0, Math.PI / 2, 0),
  30509. e.zoomTo(t, 1)
  30510. }
  30511. }, {
  30512. key: "findClosestGpsTime",
  30513. value: function(e, t) {
  30514. var n, i = performance.now(), r = [], a = ue(t.scene.pointclouds);
  30515. try {
  30516. for (a.s(); !(n = a.n()).done; ) {
  30517. var o = n.value;
  30518. r.push(o.root);
  30519. var s, l = ue(o.root.children);
  30520. try {
  30521. for (l.s(); !(s = l.n()).done; ) {
  30522. var u = s.value;
  30523. u && r.push(u)
  30524. }
  30525. } catch (e) {
  30526. l.e(e)
  30527. } finally {
  30528. l.f()
  30529. }
  30530. }
  30531. } catch (e) {
  30532. a.e(e)
  30533. } finally {
  30534. a.f()
  30535. }
  30536. for (var c = null, d = 1 / 0, h = 1 / 0, p = 0, f = r; p < f.length; p++) {
  30537. var m = f[p];
  30538. if (null != m.geometryNode && null != m.geometryNode.geometry && null != m.sceneNode)
  30539. for (var v = m.geometryNode.geometry.attributes["gps-time"], g = v.potree.range, y = 0; y < v.array.length; y++) {
  30540. var w = (w = v.array[y]) * (g[1] - g[0]) + g[0]
  30541. , w = Math.abs(e - w);
  30542. w < h && (d = y,
  30543. h = w,
  30544. c = m)
  30545. }
  30546. }
  30547. t = c.geometryNode.geometry,
  30548. t = new Cn(t.attributes.position.array[3 * d + 0],t.attributes.position.array[3 * d + 1],t.attributes.position.array[3 * d + 2]);
  30549. t.applyMatrix4(c.sceneNode.matrixWorld);
  30550. i = performance.now() - i;
  30551. return console.log("duration: ".concat(i.toFixed(3), "ms")),
  30552. {
  30553. node: c,
  30554. index: d,
  30555. position: t
  30556. }
  30557. }
  30558. }, {
  30559. key: "frustumSphereIntersection",
  30560. value: function(e, t) {
  30561. for (var n = e.planes, i = t.center, r = -t.radius, a = Number.MAX_VALUE, o = 0; o < 6; o++) {
  30562. var s = n[o].distanceToPoint(i);
  30563. if (s < r)
  30564. return 0;
  30565. a = Math.min(a, s)
  30566. }
  30567. return a >= t.radius ? 2 : 1
  30568. }
  30569. }, {
  30570. key: "generateDataTexture",
  30571. value: function(e, t, n) {
  30572. for (var i = e * t, r = new Uint8Array(4 * e * t), a = Math.floor(255 * n.r), o = Math.floor(255 * n.g), s = Math.floor(255 * n.b), l = 0; l < i; l++)
  30573. r[3 * l] = a,
  30574. r[3 * l + 1] = o,
  30575. r[3 * l + 2] = s;
  30576. t = new ia(r,e,t,et);
  30577. return t.needsUpdate = !0,
  30578. t.magFilter = Re,
  30579. t
  30580. }
  30581. }, {
  30582. key: "getParameterByName",
  30583. value: function(e) {
  30584. e = e.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
  30585. e = new RegExp("[\\?&]" + e + "=([^&#]*)").exec(document.location.search);
  30586. return null === e ? null : decodeURIComponent(e[1].replace(/\+/g, " "))
  30587. }
  30588. }, {
  30589. key: "setParameter",
  30590. value: function(e, t) {
  30591. e = e.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
  30592. var n = new RegExp("([\\?&])(" + e + "=([^&#]*))").exec(document.location.search)
  30593. , i = window.location.href;
  30594. i = null === n ? (0 === window.location.search.length ? i += "?" : i += "&",
  30595. i + e + "=" + t) : i.replace(n[2], e + "=" + t),
  30596. window.history.replaceState({}, "", i)
  30597. }
  30598. }, {
  30599. key: "createChildAABB",
  30600. value: function(e, t) {
  30601. var n = e.min.clone()
  30602. , i = e.max.clone()
  30603. , e = (new Cn).subVectors(i, n);
  30604. return 0 < (1 & t) ? n.z += e.z / 2 : i.z -= e.z / 2,
  30605. 0 < (2 & t) ? n.y += e.y / 2 : i.y -= e.y / 2,
  30606. 0 < (4 & t) ? n.x += e.x / 2 : i.x -= e.x / 2,
  30607. new kn(n,i)
  30608. }
  30609. }, {
  30610. key: "clipboardCopy",
  30611. value: function(e) {
  30612. var t = document.createElement("textarea");
  30613. t.style.position = "fixed",
  30614. t.style.top = 0,
  30615. t.style.left = 0,
  30616. t.style.width = "2em",
  30617. t.style.height = "2em",
  30618. t.style.padding = 0,
  30619. t.style.border = "none",
  30620. t.style.outline = "none",
  30621. t.style.boxShadow = "none",
  30622. t.style.background = "transparent",
  30623. t.value = e,
  30624. document.body.appendChild(t),
  30625. t.select();
  30626. try {
  30627. document.execCommand("copy") ? console.log("copied text to clipboard") : console.log("copy to clipboard failed")
  30628. } catch (e) {
  30629. console.log("error while trying to copy to clipboard")
  30630. }
  30631. document.body.removeChild(t)
  30632. }
  30633. }, {
  30634. key: "getMeasurementIcon",
  30635. value: function(e) {
  30636. return e instanceof Wf ? !e.showDistances || e.showArea || e.showAngles ? e.showDistances && e.showArea && !e.showAngles ? "".concat(Potree.resourcePath, "/icons/area.svg") : 1 === e.maxMarkers ? "".concat(Potree.resourcePath, "/icons/point.svg") : e.showDistances || e.showArea || !e.showAngles ? e.showHeight ? "".concat(Potree.resourcePath, "/icons/height.svg") : "".concat(Potree.resourcePath, "/icons/distance.svg") : "".concat(Potree.resourcePath, "/icons/angle.png") : "".concat(Potree.resourcePath, "/icons/distance.svg") : e instanceof Kp ? "".concat(Potree.resourcePath, "/icons/profile.svg") : e instanceof Yp ? "".concat(Potree.resourcePath, "/icons/volume.svg") : e instanceof qf ? "".concat(Potree.resourcePath, "/icons/clip-polygon.svg") : void 0
  30637. }
  30638. }, {
  30639. key: "lineToLineIntersection",
  30640. value: function(e, t, n, i) {
  30641. function r(e, t, n, i) {
  30642. return (a[e].x - a[t].x) * (a[n].x - a[i].x) + (a[e].y - a[t].y) * (a[n].y - a[i].y) + (a[e].z - a[t].z) * (a[n].z - a[i].z)
  30643. }
  30644. var a = [e, t, n, i]
  30645. , o = (r(0, 2, 3, 2) * r(3, 2, 1, 0) - r(0, 2, 1, 0) * r(3, 2, 3, 2)) / (r(1, 0, 1, 0) * r(3, 2, 3, 2) - r(3, 2, 1, 0) * r(3, 2, 1, 0))
  30646. , s = (r(0, 2, 3, 2) + o * r(3, 2, 1, 0)) / r(3, 2, 3, 2)
  30647. , t = t.clone().sub(e)
  30648. , i = i.clone().sub(n)
  30649. , o = e.clone().add(t.multiplyScalar(o))
  30650. , s = n.clone().add(i.multiplyScalar(s));
  30651. return o.clone().add(s).multiplyScalar(.5)
  30652. }
  30653. }, {
  30654. key: "computeCircleCenter",
  30655. value: function(e, t, n) {
  30656. var i = t.clone().sub(e)
  30657. , r = n.clone().sub(e)
  30658. , a = r.clone().cross(i).normalize()
  30659. , i = i.clone().cross(a).normalize()
  30660. , a = r.clone().cross(a).normalize()
  30661. , t = e.clone().add(t).multiplyScalar(.5)
  30662. , e = e.clone().add(n).multiplyScalar(.5)
  30663. , n = t
  30664. , t = t.clone().add(i)
  30665. , i = e
  30666. , a = e.clone().add(a);
  30667. return g.lineToLineIntersection(n, t, i, a)
  30668. }
  30669. }, {
  30670. key: "getNorthVec",
  30671. value: function(e, t, n) {
  30672. if (n) {
  30673. proj4.defs("pointcloud", n);
  30674. var i = proj4("pointcloud", "WGS84")
  30675. , r = i.forward(e.toArray())
  30676. , a = i.forward([e.x, e.y + t])
  30677. , n = Math.sqrt(Math.pow(a[0] - r[0], 2) + Math.pow(a[1] - r[1], 2))
  30678. , a = [r[0], r[1] + n]
  30679. , a = i.inverse(a);
  30680. return B(Cn, Q(a).concat([e.z])).sub(e)
  30681. }
  30682. return new Cn(0,1,0).multiplyScalar(t)
  30683. }
  30684. }, {
  30685. key: "computeAzimuth",
  30686. value: function(e, t, n) {
  30687. var i;
  30688. return -(n ? (n = (i = n.includes("EPSG") ? proj4(n, "WGS84") : (proj4.defs("pointcloud", n),
  30689. proj4("pointcloud", "WGS84"))).forward(e.toArray()),
  30690. n = [(i = i.forward(t.toArray()))[0] - n[0], i[1] - n[1]],
  30691. Math.atan2(n[1], n[0]) - Math.PI / 2) : (e = [t.x - e.x, t.y - e.y],
  30692. Math.atan2(e[1], e[0]) - Math.PI / 2))
  30693. }
  30694. }, {
  30695. key: "loadScript",
  30696. value: (n = r(regeneratorRuntime.mark(function e(n) {
  30697. return regeneratorRuntime.wrap(function(e) {
  30698. for (; ; )
  30699. switch (e.prev = e.next) {
  30700. case 0:
  30701. return e.abrupt("return", new Promise(function(e) {
  30702. var t;
  30703. document.getElementById(n) ? e() : ((t = document.createElement("script")).id = n,
  30704. t.onload = function() {
  30705. e()
  30706. }
  30707. ,
  30708. t.src = n,
  30709. document.body.appendChild(t))
  30710. }
  30711. ));
  30712. case 1:
  30713. case "end":
  30714. return e.stop()
  30715. }
  30716. }, e)
  30717. })),
  30718. function(e) {
  30719. return n.apply(this, arguments)
  30720. }
  30721. )
  30722. }, {
  30723. key: "createSvgGradient",
  30724. value: function(e) {
  30725. var t = "".concat(Math.random(), "_").concat(Date.now())
  30726. , n = "http://www.w3.org/2000/svg"
  30727. , i = document.createElementNS(n, "svg");
  30728. i.setAttributeNS(null, "width", "2em"),
  30729. i.setAttributeNS(null, "height", "3em");
  30730. var r = document.createElementNS(n, "defs")
  30731. , a = document.createElementNS(n, "linearGradient");
  30732. a.setAttributeNS(null, "id", t),
  30733. a.setAttributeNS(null, "gradientTransform", "rotate(90)");
  30734. for (var o = e.length - 1; 0 <= o; o--) {
  30735. var s = e[o]
  30736. , l = parseInt(100 - 100 * s[0])
  30737. , u = N(s[1].toArray().map(function(e) {
  30738. return parseInt(255 * e)
  30739. }), 3)
  30740. , c = u[0]
  30741. , d = u[1]
  30742. , s = u[2]
  30743. , u = document.createElementNS(n, "stop");
  30744. u.setAttributeNS(null, "offset", "".concat(l, "%")),
  30745. u.setAttributeNS(null, "stop-color", "rgb(".concat(c, ", ").concat(d, ", ").concat(s, ")")),
  30746. a.appendChild(u)
  30747. }
  30748. r.appendChild(a),
  30749. i.appendChild(r);
  30750. r = document.createElementNS(n, "rect");
  30751. return r.setAttributeNS(null, "width", "100%"),
  30752. r.setAttributeNS(null, "height", "100%"),
  30753. r.setAttributeNS(null, "fill", 'url("#'.concat(t, '")')),
  30754. r.setAttributeNS(null, "stroke", "black"),
  30755. r.setAttributeNS(null, "stroke-width", "0.1em"),
  30756. i.appendChild(r),
  30757. i
  30758. }
  30759. }, {
  30760. key: "waitAny",
  30761. value: (t = r(regeneratorRuntime.mark(function e(n) {
  30762. return regeneratorRuntime.wrap(function(e) {
  30763. for (; ; )
  30764. switch (e.prev = e.next) {
  30765. case 0:
  30766. return e.abrupt("return", new Promise(function(t) {
  30767. n.map(function(e) {
  30768. e.then(function() {
  30769. t()
  30770. })
  30771. })
  30772. }
  30773. ));
  30774. case 1:
  30775. case "end":
  30776. return e.stop()
  30777. }
  30778. }, e)
  30779. })),
  30780. function(e) {
  30781. return t.apply(this, arguments)
  30782. }
  30783. )
  30784. }]),
  30785. g
  30786. }();
  30787. Jf.screenPass = new function() {
  30788. this.screenScene = new gs,
  30789. this.screenQuad = new Hr(new ua(2,2,1)),
  30790. this.screenQuad.material.depthTest = !0,
  30791. this.screenQuad.material.depthWrite = !0,
  30792. this.screenQuad.material.transparent = !0,
  30793. this.screenScene.add(this.screenQuad),
  30794. this.camera = new Kr,
  30795. this.render = function(e, t, n) {
  30796. this.screenQuad.material = t,
  30797. void 0 === n || e.setRenderTarget(n),
  30798. e.render(this.screenScene, this.camera)
  30799. }
  30800. }
  30801. ,
  30802. Jf.computePointcloudsBound = function(e) {
  30803. var t = new kn;
  30804. return e.forEach(function(e) {
  30805. e.updateBound(),
  30806. t.union(e.bound)
  30807. }),
  30808. {
  30809. boundSize: t.getSize(new Cn),
  30810. center: t.getCenter(new Cn),
  30811. boundingBox: t
  30812. }
  30813. }
  30814. ,
  30815. Jf.convertScreenPositionToNDC = function(e, t, n, i) {
  30816. return (e = e || new yn).x = t.x / n * 2 - 1,
  30817. e.y = -t.y / i * 2 + 1,
  30818. e
  30819. }
  30820. ,
  30821. Jf.convertNDCToScreenPosition = function(e, t, n, i) {
  30822. return (t = t || new yn).x = Math.round((e.x + 1) / 2 * n),
  30823. t.y = Math.round(-(e.y - 1) / 2 * i),
  30824. t
  30825. }
  30826. ,
  30827. Jf.getOrthoCameraMoveVec = function(e, t) {
  30828. var n = t.right / t.zoom
  30829. , i = t.top / t.zoom
  30830. , r = new Cn;
  30831. return r.set(e.x * n, e.y * i, 0).applyQuaternion(t.quaternion),
  30832. r
  30833. }
  30834. ,
  30835. Jf.VectorFactory = {
  30836. fromArray: function(e) {
  30837. if (e)
  30838. return (e.length < 2 || 3 < e.length) && console.error("Wrong number of ordinates for a point!"),
  30839. (new (3 === e.length ? Cn : yn)).fromArray(e)
  30840. },
  30841. fromArray3: function(e) {
  30842. if (e)
  30843. return 3 !== e.length && console.error("Wrong number of ordinates for a point!"),
  30844. (new Cn).fromArray(e)
  30845. },
  30846. fromArray2: function(e) {
  30847. if (e)
  30848. return 2 !== e.length && console.error("Wrong number of ordinates for a point!"),
  30849. (new yn).fromArray(e)
  30850. },
  30851. toString: function(e) {
  30852. return e.x.toFixed(8) + "," + e.y.toFixed(8) + "," + e.z.toFixed(3)
  30853. }
  30854. },
  30855. Jf.QuaternionFactory = {
  30856. rot90: (new Sn).setFromAxisAngle(new Cn(0,0,1), gn.degToRad(-90)),
  30857. fromArray: function(e) {
  30858. if (e)
  30859. return 4 !== e.length && console.error("Wrong number of ordinates for a quaternion!"),
  30860. new Sn(e[1],e[2],e[3],e[0]).multiply(this.rot90)
  30861. },
  30862. toArray: function(e) {
  30863. if (e) {
  30864. e = e.clone().multiply(a).toArray();
  30865. return [e[3], e[0], e[1], e[2]]
  30866. }
  30867. },
  30868. fromLonLat: function(e) {
  30869. if (e)
  30870. return (new Sn).setFromEuler(new ci(e.lon,e.lat,0))
  30871. },
  30872. toLonLat: function(e) {
  30873. if (e) {
  30874. e = (new ci).setFromQuaternion(e);
  30875. return {
  30876. lon: e.x,
  30877. lat: e.y
  30878. }
  30879. }
  30880. }
  30881. },
  30882. Jf.datasetPosTransform = function() {
  30883. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, n = t.pointcloud || viewer.scene.pointclouds.find(function(e) {
  30884. return e.dataset_id == t.datasetId
  30885. });
  30886. if (n ? e = "merge" == Potree.settings.editType ? t.fromDataset ? n.matrixWorld : (new ni).copy(n.matrixWorld).invert() : t.fromDataset ? n.transformMatrix : n.transformInvMatrix : !Potree.settings.intersectOnObjs || (n = t.object || viewer.objs.children.find(function(e) {
  30887. return e.dataset_id == t.datasetId
  30888. })) && (e = t.fromDataset ? n.matrixWorld : (new ni).copy(n.matrixWorld).invert()),
  30889. e)
  30890. return (new Cn).copy(t.position).applyMatrix4(e);
  30891. null != t.datasetId && console.error("datasetPosTransform找不到datasetId为".concat(t.datasetId, "的数据集或模型,请检查数据, 模型未创建或删除"))
  30892. }
  30893. ,
  30894. Jf.datasetRotTransform = function() {
  30895. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, n = t.pointcloud || viewer.scene.pointclouds.find(function(e) {
  30896. return e.dataset_id == t.datasetId
  30897. });
  30898. if (n) {
  30899. if (t.rotation)
  30900. i = (new ni).makeRotationFromEuler(t.rotation);
  30901. else if (t.quaternion)
  30902. i = (new ni).makeRotationFromQuaternion(t.quaternion);
  30903. else {
  30904. if (!t.matrix)
  30905. return;
  30906. i = t.matrix.clone()
  30907. }
  30908. var n = t.fromDataset ? n.rotateMatrix : n.rotateInvMatrix
  30909. , i = (new ni).multiplyMatrices(n, i);
  30910. return t.getRotation ? e = (new ci).setFromRotationMatrix(i) : t.getQuaternion ? e = (new Sn).setFromRotationMatrix(i) : t.getMatrix && (e = i),
  30911. e
  30912. }
  30913. }
  30914. ,
  30915. Jf.isInsideFrustum = function(e, t) {
  30916. var n = new ni;
  30917. n.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse);
  30918. t = new oa;
  30919. return t.setFromProjectionMatrix(n),
  30920. e instanceof qn ? t.intersectsSphere(e) : t.intersectsBox(e)
  30921. }
  30922. ,
  30923. Jf.isInsideBox = function(e, t) {
  30924. var n = new oa;
  30925. if (n.setFromProjectionMatrix(t),
  30926. e instanceof kn)
  30927. return n.intersectsSphere(e);
  30928. if (e instanceof Array) {
  30929. var i = new qn;
  30930. return i.setFromPoints(e),
  30931. this.isInsideBox(i, t)
  30932. }
  30933. return e instanceof qn ? n.intersectsSphere(e) : e instanceof Cn ? n.containsPoint(e) : void 0
  30934. }
  30935. ,
  30936. Jf.getIntersect = function(e, t, n, i) {
  30937. var r;
  30938. e.updateMatrixWorld(),
  30939. i || (i = new sh,
  30940. r = new Cn(n.x,n.y,-1).unproject(e),
  30941. e = new Cn(n.x,n.y,1).unproject(e).sub(r).normalize(),
  30942. i.set(r, e)),
  30943. t.forEach(function(e) {
  30944. i.layers.enable(Up.getBaseLog(e.layers.mask, 2))
  30945. });
  30946. t = i.intersectObjects(t);
  30947. return 0 === t.length ? null : t[0]
  30948. }
  30949. ;
  30950. var Yf, Zf = function() {
  30951. y(i, hn);
  30952. var n = w(i);
  30953. function i() {
  30954. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  30955. return O(this, i),
  30956. (e = n.call(this)).icon = t.icon || "",
  30957. e.tooltip = t.tooltip,
  30958. void 0 !== t.onclick && (e.onclick = t.onclick),
  30959. e
  30960. }
  30961. return h(i, [{
  30962. key: "onclick",
  30963. value: function(e) {}
  30964. }, {
  30965. key: "pairWith",
  30966. value: function(e) {}
  30967. }, {
  30968. key: "setIcon",
  30969. value: function(e) {
  30970. var t = this.icon;
  30971. e !== t && (this.icon = e,
  30972. this.dispatchEvent({
  30973. type: "icon_changed",
  30974. action: this,
  30975. icon: e,
  30976. oldIcon: t
  30977. }))
  30978. }
  30979. }]),
  30980. i
  30981. }(), Qf = function() {
  30982. function a(e, t, n, i, r) {
  30983. O(this, a),
  30984. this.path = e,
  30985. this.length = this.path.spline.getLength(),
  30986. this.speed = i,
  30987. this.callback = r,
  30988. this.tween = null,
  30989. this.startPoint = Math.max(t, 0),
  30990. this.endPoint = Math.min(n, this.length),
  30991. this.t = 0
  30992. }
  30993. return h(a, [{
  30994. key: "start",
  30995. value: function() {
  30996. var t = this
  30997. , e = 0 < arguments.length && void 0 !== arguments[0] && arguments[0];
  30998. this.tween && (this.tween.stop(),
  30999. this.tween = null);
  31000. var n = e ? this.t : this.startPoint / this.length
  31001. , i = this.endPoint / this.length
  31002. , e = (i - n) * this.length * 1e3 / this.speed
  31003. , r = {
  31004. t: n
  31005. };
  31006. this.tween = new TWEEN.Tween(r).to({
  31007. t: i
  31008. }, e),
  31009. this.tween.easing(TWEEN.Easing.Linear.None),
  31010. this.tween.onUpdate(function(e) {
  31011. t.t = r.t,
  31012. t.callback(r.t)
  31013. }),
  31014. this.tween.onComplete(function() {
  31015. t.repeat && t.start()
  31016. }),
  31017. setTimeout(function() {
  31018. t.tween.start()
  31019. }, 0)
  31020. }
  31021. }, {
  31022. key: "stop",
  31023. value: function() {
  31024. this.tween && (this.tween.stop(),
  31025. this.tween = null,
  31026. this.t = 0)
  31027. }
  31028. }, {
  31029. key: "pause",
  31030. value: function() {
  31031. this.tween && (this.tween.stop(),
  31032. TWEEN.remove(this.tween),
  31033. this.tween = null)
  31034. }
  31035. }, {
  31036. key: "resume",
  31037. value: function() {
  31038. this.start(!0)
  31039. }
  31040. }, {
  31041. key: "getPoint",
  31042. value: function(e) {
  31043. return this.path.spline.getPoint(e)
  31044. }
  31045. }]),
  31046. a
  31047. }(), Yd = function() {
  31048. function t() {
  31049. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [];
  31050. O(this, t),
  31051. this.points = e,
  31052. this.spline = new Bc(e)
  31053. }
  31054. return h(t, [{
  31055. key: "get",
  31056. value: function(e) {
  31057. return this.spline.getPoint(e)
  31058. }
  31059. }, {
  31060. key: "getLength",
  31061. value: function() {
  31062. return this.spline.getLength()
  31063. }
  31064. }, {
  31065. key: "animate",
  31066. value: function(e, t, n, i) {
  31067. i = new Qf(this,e,t,n,i);
  31068. return i.start(),
  31069. i
  31070. }
  31071. }, {
  31072. key: "pause",
  31073. value: function() {
  31074. this.tween && this.tween.stop()
  31075. }
  31076. }, {
  31077. key: "resume",
  31078. value: function() {
  31079. this.tween && this.tween.start()
  31080. }
  31081. }, {
  31082. key: "getGeometry",
  31083. value: function() {
  31084. for (var e, t = new Sl, n = 0, i = 0; i <= 1; i += .002) {
  31085. var r = this.spline.getPoint(i);
  31086. t.vertices[n] = new Cn(r.x,r.y,r.z),
  31087. n++
  31088. }
  31089. return this.closed && (e = this.spline.getPoint(0),
  31090. t.vertices[n] = new Cn(e.x,e.y,e.z)),
  31091. t
  31092. }
  31093. }, {
  31094. key: "closed",
  31095. get: function() {
  31096. return this.spline.closed
  31097. },
  31098. set: function(e) {
  31099. this.spline.closed = e
  31100. }
  31101. }]),
  31102. t
  31103. }(), Kf = function() {
  31104. y(s, hn);
  31105. var o = w(s);
  31106. function s() {
  31107. var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  31108. O(this, s),
  31109. (n = o.call(this)).scene = null,
  31110. n._title = e.title || "No Title",
  31111. n._description = e.description || "",
  31112. n.offset = new Cn,
  31113. n.uuid = gn.generateUUID(),
  31114. e.position ? null != e.position.x ? n.position = e.position : n.position = B(Cn, Q(e.position)) : n.position = null,
  31115. n.cameraPosition = e.cameraPosition instanceof Array ? (new Cn).fromArray(e.cameraPosition) : e.cameraPosition,
  31116. n.cameraTarget = e.cameraTarget instanceof Array ? (new Cn).fromArray(e.cameraTarget) : e.cameraTarget,
  31117. !n.cameraTarget && n.position && (n.cameraTarget = n.position.clone()),
  31118. n.radius = e.radius,
  31119. n.view = e.view || null,
  31120. n.keepOpen = !1,
  31121. n.descriptionVisible = !1,
  31122. n.showDescription = !0,
  31123. n.actions = e.actions || [],
  31124. n.isHighlighted = !1,
  31125. n._visible = !0,
  31126. n.__visible = !0,
  31127. n._display = !0,
  31128. n._expand = !1,
  31129. n.collapseThreshold = [e.collapseThreshold, 100].find(function(e) {
  31130. return void 0 !== e
  31131. }),
  31132. n.children = [],
  31133. n.parent = null,
  31134. n.boundingBox = new kn;
  31135. e = le.resourcePath + "/icons/close.svg";
  31136. n.domElement = $('\n\t\t\t<div class="annotation" oncontextmenu="return false;">\n\t\t\t\t<div class="annotation-titlebar">\n\t\t\t\t\t<span class="annotation-label"></span>\n\t\t\t\t</div>\n\t\t\t\t<div class="annotation-description">\n\t\t\t\t\t<span class="annotation-description-close">\n\t\t\t\t\t\t<img src="'.concat(e, '" width="16px">\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class="annotation-description-content">').concat(n._description, "</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t")),
  31137. n.elTitlebar = n.domElement.find(".annotation-titlebar"),
  31138. n.elTitle = n.elTitlebar.find(".annotation-label"),
  31139. n.elTitle.append(n._title),
  31140. n.elDescription = n.domElement.find(".annotation-description"),
  31141. n.elDescriptionClose = n.elDescription.find(".annotation-description-close"),
  31142. n.clickTitle = function() {
  31143. n.moveHere(n.scene.getActiveCamera()),
  31144. n.dispatchEvent({
  31145. type: "click",
  31146. target: g(n)
  31147. }),
  31148. viewer.renderer.domElement.focus()
  31149. }
  31150. ,
  31151. n.elTitle.click(n.clickTitle),
  31152. n.actions = n.actions.map(function(e) {
  31153. return e instanceof Zf ? e : new Zf(e)
  31154. });
  31155. var t, i = ue(n.actions);
  31156. try {
  31157. for (i.s(); !(t = i.n()).done; )
  31158. t.value.pairWith(g(n))
  31159. } catch (e) {
  31160. i.e(e)
  31161. } finally {
  31162. i.f()
  31163. }
  31164. var r, a = ue(n.actions.filter(function(e) {
  31165. return void 0 === e.showIn || e.showIn.includes("scene")
  31166. }));
  31167. try {
  31168. for (a.s(); !(r = a.n()).done; )
  31169. !function() {
  31170. var e = r.value
  31171. , t = $('<img src="'.concat(e.icon, '" class="annotation-action-icon">'));
  31172. n.elTitlebar.append(t),
  31173. t.click(function() {
  31174. return e.onclick({
  31175. annotation: g(n)
  31176. })
  31177. })
  31178. }()
  31179. } catch (e) {
  31180. a.e(e)
  31181. } finally {
  31182. a.f()
  31183. }
  31184. return n.elDescriptionClose.hover(function(e) {
  31185. return n.elDescriptionClose.css("opacity", "1")
  31186. }, function(e) {
  31187. return n.elDescriptionClose.css("opacity", "0.5")
  31188. }),
  31189. n.elDescriptionClose.click(function(e) {
  31190. return n.setHighlighted(!1)
  31191. }),
  31192. n.domElement.mouseenter(function(e) {
  31193. return n.setHighlighted(!0)
  31194. }),
  31195. n.domElement.mouseleave(function(e) {
  31196. return n.setHighlighted(!1)
  31197. }),
  31198. n.domElement.on("touchstart", function(e) {
  31199. n.setHighlighted(!n.isHighlighted)
  31200. }),
  31201. n.display = !1,
  31202. n
  31203. }
  31204. return h(s, [{
  31205. key: "installHandles",
  31206. value: function(o) {
  31207. var i, r, a, s, l, u, c, d, e, h = this;
  31208. void 0 === this.handles && (i = $('\n\t\t\t<div style="position: absolute; left: 300; top: 200; pointer-events: none">\n\t\t\t\t<svg width="300" height="600">\n\t\t\t\t\t<line x1="0" y1="0" x2="1200" y2="200" style="stroke: black; stroke-width:2" />\n\t\t\t\t\t<circle cx="50" cy="50" r="4" stroke="black" stroke-width="2" fill="gray" />\n\t\t\t\t\t<circle cx="150" cy="50" r="4" stroke="black" stroke-width="2" fill="gray" />\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t'),
  31209. r = i.find("svg")[0],
  31210. a = i.find("line")[0],
  31211. s = i.find("circle")[0],
  31212. l = i.find("circle")[1],
  31213. u = function(e, t) {
  31214. s.setAttribute("cx", "".concat(e.x)),
  31215. s.setAttribute("cy", "".concat(e.y)),
  31216. l.setAttribute("cx", "".concat(t.x)),
  31217. l.setAttribute("cy", "".concat(t.y)),
  31218. a.setAttribute("x1", e.x),
  31219. a.setAttribute("y1", e.y),
  31220. a.setAttribute("x2", t.x),
  31221. a.setAttribute("y2", t.y);
  31222. var n = r.getBBox();
  31223. r.setAttribute("width", "".concat(n.width)),
  31224. r.setAttribute("height", "".concat(n.height)),
  31225. r.setAttribute("viewBox", "".concat(n.x, " ").concat(n.y, " ").concat(n.width, " ").concat(n.height));
  31226. n = e.y - t.y,
  31227. t = e.x - t.x;
  31228. 0 < n && (e.y = e.y - n),
  31229. 0 < t && (e.x = e.x - t),
  31230. i.css("left", "".concat(e.x, "px")),
  31231. i.css("top", "".concat(e.y, "px"))
  31232. }
  31233. ,
  31234. $(o.renderArea).append(i),
  31235. c = this.position.clone(),
  31236. d = this.offset.clone(),
  31237. $(this.domElement).draggable({
  31238. start: function(e, t) {
  31239. c = h.position.clone(),
  31240. d = h.offset.clone(),
  31241. $(h.domElement).find(".annotation-titlebar").css("pointer-events", "none"),
  31242. console.log($(h.domElement).find(".annotation-titlebar"))
  31243. },
  31244. stop: function() {
  31245. $(h.domElement).find(".annotation-titlebar").css("pointer-events", "")
  31246. },
  31247. drag: function(e, t) {
  31248. var n = o.renderer.getSize(new yn).width
  31249. , i = -(t.originalPosition.left - t.position.left) / n * 2
  31250. , r = (t.originalPosition.top - t.position.top) / n * 2
  31251. , t = o.scene.getActiveCamera()
  31252. , n = (new Cn).addVectors(c, d).project(t).clone();
  31253. n.x += i,
  31254. n.y += r;
  31255. n = n.clone();
  31256. n.unproject(t);
  31257. n = (new Cn).subVectors(n, h.position);
  31258. h.offset.copy(n)
  31259. }
  31260. }),
  31261. o.addEventListener("update", e = function() {
  31262. h.position;
  31263. function e(e) {
  31264. var t = i.getActiveCamera()
  31265. , n = new Cn
  31266. , t = (new ni).multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse);
  31267. return (t = new Mn(e.x,e.y,e.z,1).applyMatrix4(t)).w = Math.max(t.w, .1),
  31268. t.divideScalar(t.w),
  31269. n.copy(t),
  31270. n.x = r * (n.x + 1) / 2,
  31271. n.y = a * (1 - (n.y + 1) / 2),
  31272. n
  31273. }
  31274. var i = o.scene
  31275. , t = o.renderer.getSize(new yn)
  31276. , r = t.width
  31277. , a = t.height
  31278. , n = h.position.clone()
  31279. , t = (new Cn).addVectors(h.position, h.offset)
  31280. , n = e(n)
  31281. , t = e(t);
  31282. u(n, t)
  31283. }
  31284. ),
  31285. this.handles = {
  31286. domElement: i,
  31287. setCoordinates: u,
  31288. updateCallback: e
  31289. })
  31290. }
  31291. }, {
  31292. key: "removeHandles",
  31293. value: function(e) {
  31294. void 0 !== this.handles && (this.handles.domElement.remove(),
  31295. e.removeEventListener("update", this.handles.updateCallback),
  31296. delete this.handles)
  31297. }
  31298. }, {
  31299. key: "visible",
  31300. get: function() {
  31301. return this._visible
  31302. },
  31303. set: function(e) {
  31304. this._visible !== e && (this._visible = e,
  31305. this.dispatchEvent({
  31306. type: "visibility_changed",
  31307. annotation: this
  31308. }))
  31309. }
  31310. }, {
  31311. key: "display",
  31312. get: function() {
  31313. return this._display
  31314. },
  31315. set: function(e) {
  31316. this._display !== e && ((this._display = e) ? this.domElement.show() : this.domElement.hide())
  31317. }
  31318. }, {
  31319. key: "expand",
  31320. get: function() {
  31321. return this._expand
  31322. },
  31323. set: function(e) {
  31324. this._expand !== e && (e ? this.display = !1 : (this.display = !0,
  31325. this.traverseDescendants(function(e) {
  31326. e.display = !1
  31327. })),
  31328. this._expand = e)
  31329. }
  31330. }, {
  31331. key: "title",
  31332. get: function() {
  31333. return this._title
  31334. },
  31335. set: function(e) {
  31336. this._title !== e && (this._title = e,
  31337. this.elTitle.empty(),
  31338. this.elTitle.append(this._title),
  31339. this.dispatchEvent({
  31340. type: "annotation_changed",
  31341. annotation: this
  31342. }))
  31343. }
  31344. }, {
  31345. key: "description",
  31346. get: function() {
  31347. return this._description
  31348. },
  31349. set: function(e) {
  31350. this._description !== e && (this._description = e,
  31351. (e = this.elDescription.find(".annotation-description-content")).empty(),
  31352. e.append(this._description),
  31353. this.dispatchEvent({
  31354. type: "annotation_changed",
  31355. annotation: this
  31356. }))
  31357. }
  31358. }, {
  31359. key: "add",
  31360. value: function(e) {
  31361. if (!this.children.includes(e)) {
  31362. this.children.push(e),
  31363. e.parent = this;
  31364. var t = [];
  31365. e.traverse(function(e) {
  31366. t.push(e)
  31367. });
  31368. for (var n = 0, i = t; n < i.length; n++)
  31369. for (var r = i[n], a = this; null !== a; )
  31370. a.dispatchEvent({
  31371. type: "annotation_added",
  31372. annotation: r
  31373. }),
  31374. a = a.parent
  31375. }
  31376. }
  31377. }, {
  31378. key: "level",
  31379. value: function() {
  31380. return null === this.parent ? 0 : this.parent.level() + 1
  31381. }
  31382. }, {
  31383. key: "hasChild",
  31384. value: function(e) {
  31385. return this.children.includes(e)
  31386. }
  31387. }, {
  31388. key: "remove",
  31389. value: function(t) {
  31390. this.hasChild(t) && (t.removeAllChildren(),
  31391. t.dispose(),
  31392. this.children = this.children.filter(function(e) {
  31393. return e !== t
  31394. }),
  31395. t.parent = null)
  31396. }
  31397. }, {
  31398. key: "removeAllChildren",
  31399. value: function() {
  31400. var t = this;
  31401. this.children.forEach(function(e) {
  31402. 0 < e.children.length && e.removeAllChildren(),
  31403. t.remove(e)
  31404. })
  31405. }
  31406. }, {
  31407. key: "updateBounds",
  31408. value: function() {
  31409. var e = new kn;
  31410. this.position && e.expandByPoint(this.position);
  31411. var t, n = ue(this.children);
  31412. try {
  31413. for (n.s(); !(t = n.n()).done; ) {
  31414. var i = t.value;
  31415. i.updateBounds(),
  31416. e.union(i.boundingBox)
  31417. }
  31418. } catch (e) {
  31419. n.e(e)
  31420. } finally {
  31421. n.f()
  31422. }
  31423. this.boundingBox.copy(e)
  31424. }
  31425. }, {
  31426. key: "traverse",
  31427. value: function(e) {
  31428. var t = e(this);
  31429. if (void 0 === t || !0 === t) {
  31430. var n, i = ue(this.children);
  31431. try {
  31432. for (i.s(); !(n = i.n()).done; )
  31433. n.value.traverse(e)
  31434. } catch (e) {
  31435. i.e(e)
  31436. } finally {
  31437. i.f()
  31438. }
  31439. }
  31440. }
  31441. }, {
  31442. key: "traverseDescendants",
  31443. value: function(e) {
  31444. var t, n = ue(this.children);
  31445. try {
  31446. for (n.s(); !(t = n.n()).done; )
  31447. t.value.traverse(e)
  31448. } catch (e) {
  31449. n.e(e)
  31450. } finally {
  31451. n.f()
  31452. }
  31453. }
  31454. }, {
  31455. key: "flatten",
  31456. value: function() {
  31457. var t = [];
  31458. return this.traverse(function(e) {
  31459. t.push(e)
  31460. }),
  31461. t
  31462. }
  31463. }, {
  31464. key: "descendants",
  31465. value: function() {
  31466. var t = this
  31467. , n = [];
  31468. return this.traverse(function(e) {
  31469. e !== t && n.push(e)
  31470. }),
  31471. n
  31472. }
  31473. }, {
  31474. key: "setHighlighted",
  31475. value: function(e) {
  31476. e ? (this.domElement.css("opacity", "0.8"),
  31477. this.elTitlebar.css("box-shadow", "0 0 5px #fff"),
  31478. this.domElement.css("z-index", "1000"),
  31479. this._description && (this.descriptionVisible = !0,
  31480. this.elDescription.fadeIn(200),
  31481. this.elDescription.css("position", "relative"))) : (this.domElement.css("opacity", "0.5"),
  31482. this.elTitlebar.css("box-shadow", ""),
  31483. this.domElement.css("z-index", "100"),
  31484. this.descriptionVisible = !1,
  31485. this.elDescription.css("display", "none")),
  31486. this.isHighlighted = e
  31487. }
  31488. }, {
  31489. key: "hasView",
  31490. value: function() {
  31491. var e = (e = null != this.cameraTarget.x) && null != this.cameraPosition.x
  31492. , t = void 0 !== this.radius;
  31493. return e || t
  31494. }
  31495. }, {
  31496. key: "moveHere",
  31497. value: function(e) {
  31498. var t, n, i, r, a, o;
  31499. this.hasView() && (t = this.scene.view,
  31500. n = TWEEN.Easing.Quartic.Out,
  31501. o = this.cameraTarget || this.position || this.boundingBox.getCenter(new Cn),
  31502. this.cameraPosition ? (a = this.cameraPosition,
  31503. Jf.moveTo(this.scene, a, o)) : this.radius && (a = t.direction,
  31504. a = o.clone().add(a.multiplyScalar(-this.radius)),
  31505. i = t.radius,
  31506. r = this.radius,
  31507. (a = new TWEEN.Tween(t.position).to(a, 500)).easing(n),
  31508. a.start(),
  31509. (a = new TWEEN.Tween({
  31510. x: 0
  31511. }).to({
  31512. x: 1
  31513. }, 500).onUpdate(function() {
  31514. t.radius = this.x * r + (1 - this.x) * i
  31515. })).easing(n),
  31516. a.start()))
  31517. }
  31518. }, {
  31519. key: "dispose",
  31520. value: function() {
  31521. this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement)
  31522. }
  31523. }, {
  31524. key: "toString",
  31525. value: function() {
  31526. return "Annotation: " + this._title
  31527. }
  31528. }]),
  31529. s
  31530. }(), $f = function() {
  31531. function r(e) {
  31532. O(this, r);
  31533. for (var t = 0, n = Object.keys(e); t < n.length; t++) {
  31534. var i = n[t];
  31535. this[i] = e[i]
  31536. }
  31537. }
  31538. return h(r, [{
  31539. key: "inspect",
  31540. value: function() {
  31541. return "Enum(".concat(this.name, ": ").concat(this.value, ")")
  31542. }
  31543. }]),
  31544. r
  31545. }(), Mh = function() {
  31546. function a(e) {
  31547. O(this, a),
  31548. this.object = e;
  31549. for (var t = 0, n = Object.keys(e); t < n.length; t++) {
  31550. var i = n[t]
  31551. , r = e[i];
  31552. "object" === X(r) ? r.name = i : r = {
  31553. name: i,
  31554. value: r
  31555. },
  31556. this[i] = new $f(r)
  31557. }
  31558. }
  31559. return h(a, [{
  31560. key: "fromValue",
  31561. value: function(e) {
  31562. for (var t = 0, n = Object.keys(this.object); t < n.length; t++) {
  31563. var i = n[t];
  31564. if (this[i].value === e)
  31565. return this[i]
  31566. }
  31567. throw new Error("No enum for value: ".concat(e))
  31568. }
  31569. }]),
  31570. a
  31571. }(), em = {
  31572. ORTHOGRAPHIC: 0,
  31573. PERSPECTIVE: 1,
  31574. VR: 2
  31575. }, tm = {
  31576. NONE: 0,
  31577. HIGHLIGHT: 1,
  31578. SHOW_INSIDE: 2,
  31579. SHOW_OUTSIDE: 3
  31580. }, nm = {
  31581. INSIDE_ANY: 0,
  31582. INSIDE_ALL: 1
  31583. }, im = {
  31584. CLAMP: 0,
  31585. REPEAT: 1,
  31586. MIRRORED_REPEAT: 2
  31587. }, rm = {
  31588. NONE: 0,
  31589. LEFT: 1,
  31590. RIGHT: 2,
  31591. MIDDLE: 4
  31592. }, am = {
  31593. FIXED: 0,
  31594. ATTENUATED: 1,
  31595. ADAPTIVE: 2
  31596. }, om = {
  31597. SQUARE: 0,
  31598. CIRCLE: 1,
  31599. PARABOLOID: 2
  31600. }, sm = {
  31601. OCTREE: 0,
  31602. KDTREE: 1
  31603. }, lm = {
  31604. METER: {
  31605. code: "m",
  31606. unitspermeter: 1
  31607. },
  31608. FEET: {
  31609. code: "ft",
  31610. unitspermeter: 3.28084
  31611. },
  31612. INCH: {
  31613. code: "″",
  31614. unitspermeter: 39.3701
  31615. }
  31616. }, um = {
  31617. GL_TEXTURE_CUBE_MAP_POSITIVE_X: 0,
  31618. GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 1,
  31619. GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 2,
  31620. GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 3,
  31621. GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 4,
  31622. GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 5
  31623. }, cm = {
  31624. BASE: 1,
  31625. STANDARD: 2,
  31626. HIGH: 3,
  31627. ULTRAHIGH: 4
  31628. }, dm = {
  31629. PanoRenderComplete: "panorama.render.complete",
  31630. TileRenderFailure: "panorama.tile.render.failed",
  31631. TileRenderSuccess: "panorama.tile.render.success",
  31632. TileUploadAttempted: "panorama.tile.upload.attempted",
  31633. UploadAttemptedForAllTiles: "panorama.upload.attempted.all.tiles",
  31634. ZoomLevelRenderStarted: "panorama.zoom.render.started"
  31635. }, hm = {
  31636. TileDownloadSuccess: "tiledownloader.download.success",
  31637. TileDownloadFailure: "tiledownloader.download.failure",
  31638. PanoDownloadComplete: "tiledownloader.pano.download.complete"
  31639. }, pm = {
  31640. UP: new Cn(0,1,0),
  31641. DOWN: new Cn(0,-1,0),
  31642. LEFT: new Cn(-1,0,0),
  31643. RIGHT: new Cn(1,0,0),
  31644. FORWARD: new Cn(0,0,-1),
  31645. BACK: new Cn(0,0,1)
  31646. }, fm = {};
  31647. for (Yf in pm)
  31648. fm[Yf] = Up.convertVector.YupToZup(pm[Yf]);
  31649. var mm, vm = Object.freeze({
  31650. None: 0,
  31651. Queued: 1,
  31652. ForceQueued: 2,
  31653. Downloading: 3,
  31654. Downloaded: 4,
  31655. DownloadFailed: 5
  31656. }), gm = {
  31657. Enter: "panorama.enter",
  31658. Exit: "panorama.exit",
  31659. LoadComplete: "panorama.load.complete",
  31660. LoadFailed: "panorama.load.failed",
  31661. TileLoaded: "panorama.tile.loaded",
  31662. VideoRendered: "panorama.video.rendered"
  31663. }, Dh = function() {
  31664. function e() {
  31665. O(this, e),
  31666. this._listeners = {}
  31667. }
  31668. return h(e, [{
  31669. key: "addEventListener",
  31670. value: function(e, t) {
  31671. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  31672. , i = this._listeners;
  31673. void 0 === i[e] && (i[e] = []),
  31674. -1 === i[e].indexOf(t) && (i[e].push({
  31675. listener: t,
  31676. importance: n
  31677. }),
  31678. i[e] = i[e].sort(function(e, t) {
  31679. return t.importance - e.importance
  31680. }))
  31681. }
  31682. }, {
  31683. key: "hasEventListener",
  31684. value: function(e, t) {
  31685. var n = this._listeners;
  31686. return void 0 !== n[e] && -1 !== n[e].indexOf(t)
  31687. }
  31688. }, {
  31689. key: "removeEventListener",
  31690. value: function(e, t) {
  31691. var n = this._listeners[e];
  31692. void 0 === n || (e = n.find(function(e) {
  31693. return e.listener == t
  31694. })) && n.splice(n.indexOf(e), 1)
  31695. }
  31696. }, {
  31697. key: "removeEventListeners",
  31698. value: function(e) {
  31699. void 0 !== this._listeners[e] && delete this._listeners[e]
  31700. }
  31701. }, {
  31702. key: "dispatchEvent",
  31703. value: function(e) {
  31704. var t = this._listeners[(e = "string" == typeof e ? {
  31705. type: e
  31706. } : e).type];
  31707. if (void 0 !== t) {
  31708. e.target = this;
  31709. var n, i = ue(t.slice(0));
  31710. try {
  31711. for (i.s(); !(n = i.n()).done; ) {
  31712. var r = n.value.listener.call(this, e);
  31713. if (r && r.stopContinue)
  31714. break
  31715. }
  31716. } catch (e) {
  31717. i.e(e)
  31718. } finally {
  31719. i.f()
  31720. }
  31721. }
  31722. }
  31723. }, {
  31724. key: "removeAllListeners",
  31725. value: function() {
  31726. this._listeners = {}
  31727. }
  31728. }]),
  31729. e
  31730. }(), ym = {
  31731. LEFT: 37,
  31732. UP: 38,
  31733. RIGHT: 39,
  31734. BOTTOM: 40,
  31735. DELETE: 46,
  31736. BACKSPACE: 8,
  31737. A: "A".charCodeAt(0),
  31738. S: "S".charCodeAt(0),
  31739. D: "D".charCodeAt(0),
  31740. W: "W".charCodeAt(0),
  31741. Q: "Q".charCodeAt(0),
  31742. E: "E".charCodeAt(0),
  31743. R: "R".charCodeAt(0),
  31744. F: "F".charCodeAt(0)
  31745. }, wm = h(function e(t) {
  31746. O(this, e),
  31747. this.previous = null,
  31748. this.next = null,
  31749. this.node = t
  31750. }), xu = function() {
  31751. function e() {
  31752. O(this, e),
  31753. this.first = null,
  31754. this.last = null,
  31755. this.items = {},
  31756. this.elements = 0,
  31757. this.numPoints = 0
  31758. }
  31759. return h(e, [{
  31760. key: "size",
  31761. value: function() {
  31762. return this.elements
  31763. }
  31764. }, {
  31765. key: "contains",
  31766. value: function(e) {
  31767. return null == this.items[e.id]
  31768. }
  31769. }, {
  31770. key: "touch",
  31771. value: function(e) {
  31772. var t;
  31773. e.loaded && (null == this.items[e.id] ? ((t = new wm(e)).previous = this.last,
  31774. null !== (this.last = t).previous && (t.previous.next = t),
  31775. this.items[e.id] = t,
  31776. this.elements++,
  31777. null === this.first && (this.first = t),
  31778. this.numPoints += e.numPoints) : null === (t = this.items[e.id]).previous ? null !== t.next && (this.first = t.next,
  31779. this.first.previous = null,
  31780. t.previous = this.last,
  31781. t.next = null,
  31782. (this.last = t).previous.next = t) : null === t.next || (t.previous.next = t.next,
  31783. t.next.previous = t.previous,
  31784. t.previous = this.last,
  31785. t.next = null,
  31786. (this.last = t).previous.next = t))
  31787. }
  31788. }, {
  31789. key: "remove",
  31790. value: function(e) {
  31791. var t = this.items[e.id];
  31792. t && (1 === this.elements ? (this.first = null,
  31793. this.last = null) : (t.previous || (this.first = t.next,
  31794. this.first.previous = null),
  31795. t.next || (this.last = t.previous,
  31796. this.last.next = null),
  31797. t.previous && t.next && (t.previous.next = t.next,
  31798. t.next.previous = t.previous)),
  31799. delete this.items[e.id],
  31800. this.elements--,
  31801. this.numPoints -= e.numPoints)
  31802. }
  31803. }, {
  31804. key: "getLRUItem",
  31805. value: function() {
  31806. return null === this.first ? null : this.first.node
  31807. }
  31808. }, {
  31809. key: "toString",
  31810. value: function() {
  31811. for (var e = "{ ", t = this.first; null !== t; )
  31812. e += t.node.id,
  31813. null !== t.next && (e += ", "),
  31814. t = t.next;
  31815. return e += "}",
  31816. e += "(" + this.size() + ")"
  31817. }
  31818. }, {
  31819. key: "freeMemory",
  31820. value: function() {
  31821. if (!(this.elements <= 1))
  31822. for (var e = 2 * viewer.viewports.length * Potree.pointBudget; this.numPoints > e; ) {
  31823. var t = this.getLRUItem();
  31824. t && this.disposeSubtree(t)
  31825. }
  31826. }
  31827. }, {
  31828. key: "disposeSubtree",
  31829. value: function(e) {
  31830. var t = [e];
  31831. e.traverse(function(e) {
  31832. e.loaded && t.push(e)
  31833. });
  31834. for (var n = 0, i = t; n < i.length; n++) {
  31835. var r = i[n];
  31836. r.dispose(),
  31837. this.remove(r)
  31838. }
  31839. }
  31840. }, {
  31841. key: "disposeDescendants",
  31842. value: function(e) {
  31843. var t = [];
  31844. for (t.push(e); 0 < t.length; ) {
  31845. var n, i = t.pop();
  31846. for (n in i.dispose(),
  31847. this.remove(i),
  31848. i.children)
  31849. i.children.hasOwnProperty(n) && i.children[n].loaded && t.push(i.children[n])
  31850. }
  31851. }
  31852. }]),
  31853. e
  31854. }(), bm = function() {
  31855. y(n, hn);
  31856. var t = w(n);
  31857. function n() {
  31858. var e;
  31859. return O(this, n),
  31860. (e = t.call(this)).needsTransformUpdate = !0,
  31861. e
  31862. }
  31863. return h(n, [{
  31864. key: "getChildren",
  31865. value: function() {
  31866. throw new Error("override function")
  31867. }
  31868. }, {
  31869. key: "getBoundingBox",
  31870. value: function() {
  31871. throw new Error("override function")
  31872. }
  31873. }, {
  31874. key: "isLoaded",
  31875. value: function() {
  31876. throw new Error("override function")
  31877. }
  31878. }, {
  31879. key: "isGeometryNode",
  31880. value: function() {
  31881. throw new Error("override function")
  31882. }
  31883. }, {
  31884. key: "isTreeNode",
  31885. value: function() {
  31886. throw new Error("override function")
  31887. }
  31888. }, {
  31889. key: "getLevel",
  31890. value: function() {
  31891. throw new Error("override function")
  31892. }
  31893. }, {
  31894. key: "getBoundingSphere",
  31895. value: function() {
  31896. throw new Error("override function")
  31897. }
  31898. }]),
  31899. n
  31900. }(), xm = function() {
  31901. y(t, Si);
  31902. var e = w(t);
  31903. function t() {
  31904. return O(this, t),
  31905. e.call(this)
  31906. }
  31907. return h(t, [{
  31908. key: "initialized",
  31909. value: function() {
  31910. return null !== this.root
  31911. }
  31912. }]),
  31913. t
  31914. }(), Em = {
  31915. DATA_TYPE_DOUBLE: {
  31916. ordinal: 0,
  31917. name: "double",
  31918. size: 8
  31919. },
  31920. DATA_TYPE_FLOAT: {
  31921. ordinal: 1,
  31922. name: "float",
  31923. size: 4
  31924. },
  31925. DATA_TYPE_INT8: {
  31926. ordinal: 2,
  31927. name: "int8",
  31928. size: 1
  31929. },
  31930. DATA_TYPE_UINT8: {
  31931. ordinal: 3,
  31932. name: "uint8",
  31933. size: 1
  31934. },
  31935. DATA_TYPE_INT16: {
  31936. ordinal: 4,
  31937. name: "int16",
  31938. size: 2
  31939. },
  31940. DATA_TYPE_UINT16: {
  31941. ordinal: 5,
  31942. name: "uint16",
  31943. size: 2
  31944. },
  31945. DATA_TYPE_INT32: {
  31946. ordinal: 6,
  31947. name: "int32",
  31948. size: 4
  31949. },
  31950. DATA_TYPE_UINT32: {
  31951. ordinal: 7,
  31952. name: "uint32",
  31953. size: 4
  31954. },
  31955. DATA_TYPE_INT64: {
  31956. ordinal: 8,
  31957. name: "int64",
  31958. size: 8
  31959. },
  31960. DATA_TYPE_UINT64: {
  31961. ordinal: 9,
  31962. name: "uint64",
  31963. size: 8
  31964. }
  31965. }, _m = 0;
  31966. for (mm in Em)
  31967. Em[_m] = Em[mm],
  31968. _m++;
  31969. function Mm(e) {
  31970. return Tm[e] || e
  31971. }
  31972. var Am = h(function e(t, n, i) {
  31973. O(this, e),
  31974. this.name = t,
  31975. this.type = n,
  31976. this.numElements = i,
  31977. this.byteSize = this.numElements * this.type.size,
  31978. this.description = "",
  31979. this.range = [1 / 0, -1 / 0]
  31980. })
  31981. , Tm = {
  31982. COLOR_PACKED: "rgba",
  31983. RGBA: "rgba",
  31984. INTENSITY: "intensity",
  31985. CLASSIFICATION: "classification",
  31986. GPS_TIME: "gps-time"
  31987. };
  31988. Am.POSITION_CARTESIAN = new Am("POSITION_CARTESIAN",Em.DATA_TYPE_FLOAT,3),
  31989. Am.RGBA_PACKED = new Am(Mm("COLOR_PACKED"),Em.DATA_TYPE_INT8,4),
  31990. Am.COLOR_PACKED = Am.RGBA_PACKED,
  31991. Am.RGB_PACKED = new Am("COLOR_PACKED",Em.DATA_TYPE_INT8,3),
  31992. Am.NORMAL_FLOATS = new Am("NORMAL_FLOATS",Em.DATA_TYPE_FLOAT,3),
  31993. Am.INTENSITY = new Am(Mm("INTENSITY"),Em.DATA_TYPE_UINT16,1),
  31994. Am.CLASSIFICATION = new Am(Mm("CLASSIFICATION"),Em.DATA_TYPE_UINT8,1),
  31995. Am.NORMAL_SPHEREMAPPED = new Am("NORMAL_SPHEREMAPPED",Em.DATA_TYPE_UINT8,2),
  31996. Am.NORMAL_OCT16 = new Am("NORMAL_OCT16",Em.DATA_TYPE_UINT8,2),
  31997. Am.NORMAL = new Am("NORMAL",Em.DATA_TYPE_FLOAT,3),
  31998. Am.RETURN_NUMBER = new Am("RETURN_NUMBER",Em.DATA_TYPE_UINT8,1),
  31999. Am.NUMBER_OF_RETURNS = new Am("NUMBER_OF_RETURNS",Em.DATA_TYPE_UINT8,1),
  32000. Am.SOURCE_ID = new Am("SOURCE_ID",Em.DATA_TYPE_UINT16,1),
  32001. Am.INDICES = new Am("INDICES",Em.DATA_TYPE_UINT32,1),
  32002. Am.SPACING = new Am("SPACING",Em.DATA_TYPE_FLOAT,1),
  32003. Am.GPS_TIME = new Am(Mm("GPS_TIME"),Em.DATA_TYPE_DOUBLE,1);
  32004. var Sm = function() {
  32005. function i(e) {
  32006. if (O(this, i),
  32007. this.attributes = [],
  32008. this.byteSize = 0,
  32009. this.size = 0,
  32010. this.vectors = [],
  32011. null != e)
  32012. for (var t = 0; t < e.length; t++) {
  32013. var n = e[t]
  32014. , n = Am[n];
  32015. this.attributes.push(n),
  32016. this.byteSize += n.byteSize,
  32017. this.size++
  32018. }
  32019. }
  32020. return h(i, [{
  32021. key: "add",
  32022. value: function(e) {
  32023. this.attributes.push(e),
  32024. this.byteSize += e.byteSize,
  32025. this.size++
  32026. }
  32027. }, {
  32028. key: "addVector",
  32029. value: function(e) {
  32030. this.vectors.push(e)
  32031. }
  32032. }, {
  32033. key: "hasNormals",
  32034. value: function() {
  32035. for (var e in this.attributes) {
  32036. e = this.attributes[e];
  32037. if (e === Am.NORMAL_SPHEREMAPPED || e === Am.NORMAL_FLOATS || e === Am.NORMAL || e === Am.NORMAL_OCT16)
  32038. return !0
  32039. }
  32040. return !1
  32041. }
  32042. }]),
  32043. i
  32044. }()
  32045. , Cm = function() {
  32046. function t() {
  32047. O(this, t)
  32048. }
  32049. return h(t, null, [{
  32050. key: "toVector3",
  32051. value: function(e, t) {
  32052. return (new Cn).fromArray(e, t || 0)
  32053. }
  32054. }, {
  32055. key: "toBox3",
  32056. value: function(e) {
  32057. return new kn(t.toVector3(e),t.toVector3(e, 3))
  32058. }
  32059. }, {
  32060. key: "findDim",
  32061. value: function(e, t) {
  32062. e = e.find(function(e) {
  32063. return e.name == t
  32064. });
  32065. if (!e)
  32066. throw new Error("Failed to find " + t + " in schema");
  32067. return e
  32068. }
  32069. }, {
  32070. key: "sphereFrom",
  32071. value: function(e) {
  32072. return e.getBoundingSphere(new qn)
  32073. }
  32074. }]),
  32075. t
  32076. }()
  32077. , Ud = h(function e(t, n) {
  32078. O(this, e);
  32079. n.version;
  32080. var i = n.schema
  32081. , r = n.bounds
  32082. , a = n.boundsConforming
  32083. , o = [Cm.findDim(i, "X"), Cm.findDim(i, "Y"), Cm.findDim(i, "Z")]
  32084. , s = o.map(function(e) {
  32085. return e.scale || 1
  32086. })
  32087. , o = o.map(function(e) {
  32088. return e.offset || 0
  32089. });
  32090. this.eptScale = Cm.toVector3(s),
  32091. this.eptOffset = Cm.toVector3(o),
  32092. this.url = t,
  32093. this.info = n,
  32094. this.type = "ept",
  32095. this.schema = i,
  32096. this.span = n.span || n.ticks,
  32097. this.boundingBox = Cm.toBox3(r),
  32098. this.tightBoundingBox = Cm.toBox3(a),
  32099. this.offset = Cm.toVector3([0, 0, 0]),
  32100. this.boundingSphere = Cm.sphereFrom(this.boundingBox),
  32101. this.tightBoundingSphere = Cm.sphereFrom(this.tightBoundingBox),
  32102. this.version = new Potree.Version("1.7"),
  32103. this.projection = null,
  32104. this.fallbackProjection = null,
  32105. n.srs && n.srs.horizontal && (this.projection = n.srs.authority + ":" + n.srs.horizontal),
  32106. n.srs.wkt && (this.projection ? this.fallbackProjection = n.srs.wkt : this.projection = n.srs.wkt);
  32107. try {
  32108. proj4(this.projection)
  32109. } catch (e) {
  32110. this.projection = null
  32111. }
  32112. a = new Sm;
  32113. a.add(Am.POSITION_CARTESIAN),
  32114. a.add(new Am("rgba",Em.DATA_TYPE_UINT8,4)),
  32115. a.add(new Am("intensity",Em.DATA_TYPE_UINT16,1)),
  32116. a.add(new Am("classification",Em.DATA_TYPE_UINT8,1)),
  32117. a.add(new Am("gps-time",Em.DATA_TYPE_DOUBLE,1)),
  32118. a.add(new Am("returnNumber",Em.DATA_TYPE_UINT8,1)),
  32119. a.add(new Am("number of returns",Em.DATA_TYPE_UINT8,1)),
  32120. a.add(new Am("return number",Em.DATA_TYPE_UINT8,1)),
  32121. a.add(new Am("source id",Em.DATA_TYPE_UINT16,1)),
  32122. this.pointAttributes = a,
  32123. this.spacing = (this.boundingBox.max.x - this.boundingBox.min.x) / this.span;
  32124. n.hierarchyType;
  32125. n = n.dataType;
  32126. if ("laszip" == n)
  32127. this.loader = new Potree.EptLaszipLoader;
  32128. else if ("binary" == n)
  32129. this.loader = new Potree.EptBinaryLoader;
  32130. else {
  32131. if ("zstandard" != n)
  32132. throw new Error("Could not read data type: " + n);
  32133. this.loader = new Potree.EptZstandardLoader
  32134. }
  32135. })
  32136. , _u = function() {
  32137. function o(e, t, n, i, r, a) {
  32138. O(this, o),
  32139. this.ept = e,
  32140. this.b = t,
  32141. this.d = n,
  32142. this.x = i || 0,
  32143. this.y = r || 0,
  32144. this.z = a || 0
  32145. }
  32146. return h(o, [{
  32147. key: "name",
  32148. value: function() {
  32149. return this.d + "-" + this.x + "-" + this.y + "-" + this.z
  32150. }
  32151. }, {
  32152. key: "step",
  32153. value: function(e, t, n) {
  32154. var i = this.b.min.clone()
  32155. , r = this.b.max.clone()
  32156. , a = (new Cn).subVectors(r, i);
  32157. return e ? i.x += a.x / 2 : r.x -= a.x / 2,
  32158. t ? i.y += a.y / 2 : r.y -= a.y / 2,
  32159. n ? i.z += a.z / 2 : r.z -= a.z / 2,
  32160. new Potree.EptKey(this.ept,new kn(i,r),this.d + 1,2 * this.x + e,2 * this.y + t,2 * this.z + n)
  32161. }
  32162. }, {
  32163. key: "children",
  32164. value: function() {
  32165. for (var e = [], t = 0; t < 2; ++t)
  32166. for (var n = 0; n < 2; ++n)
  32167. for (var i = 0; i < 2; ++i) {
  32168. var r = this.step(t, n, i).name();
  32169. e.includes(r) || (e = e.concat(r))
  32170. }
  32171. return e
  32172. }
  32173. }]),
  32174. o
  32175. }()
  32176. , Jd = function() {
  32177. y(l, bm);
  32178. var e, s = w(l);
  32179. function l(e, t, n, i, r, a) {
  32180. var o;
  32181. O(this, l),
  32182. (o = s.call(this)).ept = e,
  32183. o.key = new Potree.EptKey(o.ept,t || o.ept.boundingBox,n || 0,i,r,a),
  32184. o.id = l.IDCount++,
  32185. o.geometry = null,
  32186. o.boundingBox = o.key.b,
  32187. o.tightBoundingBox = o.boundingBox,
  32188. o.spacing = o.ept.spacing / Math.pow(2, o.key.d),
  32189. o.boundingSphere = Cm.sphereFrom(o.boundingBox),
  32190. o.hasChildren = !1,
  32191. o.children = {},
  32192. o.numPoints = -1,
  32193. o.level = o.key.d,
  32194. o.loaded = !1,
  32195. o.loading = !1,
  32196. o.oneTimeDisposeHandlers = [];
  32197. a = o.key;
  32198. return o.name = o.toPotreeName(a.d, a.x, a.y, a.z),
  32199. o.index = parseInt(o.name.charAt(o.name.length - 1)),
  32200. o
  32201. }
  32202. return h(l, [{
  32203. key: "isGeometryNode",
  32204. value: function() {
  32205. return !0
  32206. }
  32207. }, {
  32208. key: "getLevel",
  32209. value: function() {
  32210. return this.level
  32211. }
  32212. }, {
  32213. key: "isTreeNode",
  32214. value: function() {
  32215. return !1
  32216. }
  32217. }, {
  32218. key: "isLoaded",
  32219. value: function() {
  32220. return this.loaded
  32221. }
  32222. }, {
  32223. key: "getBoundingSphere",
  32224. value: function() {
  32225. return this.boundingSphere
  32226. }
  32227. }, {
  32228. key: "getBoundingBox",
  32229. value: function() {
  32230. return this.boundingBox
  32231. }
  32232. }, {
  32233. key: "url",
  32234. value: function() {
  32235. return this.ept.url + "ept-data/" + this.filename()
  32236. }
  32237. }, {
  32238. key: "getNumPoints",
  32239. value: function() {
  32240. return this.numPoints
  32241. }
  32242. }, {
  32243. key: "filename",
  32244. value: function() {
  32245. return this.key.name()
  32246. }
  32247. }, {
  32248. key: "getChildren",
  32249. value: function() {
  32250. for (var e = [], t = 0; t < 8; t++)
  32251. this.children[t] && e.push(this.children[t]);
  32252. return e
  32253. }
  32254. }, {
  32255. key: "addChild",
  32256. value: function(e) {
  32257. (this.children[e.index] = e).parent = this
  32258. }
  32259. }, {
  32260. key: "load",
  32261. value: function() {
  32262. this.loaded || this.loading || Potree.numNodesLoading >= Potree.maxNodesLoading || (this.loading = !0,
  32263. ++Potree.numNodesLoading,
  32264. -1 == this.numPoints && this.loadHierarchy(),
  32265. this.loadPoints())
  32266. }
  32267. }, {
  32268. key: "loadPoints",
  32269. value: function() {
  32270. this.ept.loader.load(this)
  32271. }
  32272. }, {
  32273. key: "loadHierarchy",
  32274. value: (e = r(regeneratorRuntime.mark(function e() {
  32275. var l, t, u, c = this;
  32276. return regeneratorRuntime.wrap(function(e) {
  32277. for (; ; )
  32278. switch (e.prev = e.next) {
  32279. case 0:
  32280. return ((l = {})[this.filename()] = this).hasChildren = !1,
  32281. t = "".concat(this.ept.url, "ept-hierarchy/").concat(this.filename(), ".json"),
  32282. e.next = 6,
  32283. fetch(t);
  32284. case 6:
  32285. return t = e.sent,
  32286. e.next = 9,
  32287. t.json();
  32288. case 9:
  32289. u = e.sent,
  32290. Object.keys(u).sort(function(e, t) {
  32291. var n = N(e.split("-").map(function(e) {
  32292. return parseInt(e, 10)
  32293. }), 4)
  32294. , i = n[0]
  32295. , r = n[1]
  32296. , a = n[2]
  32297. , o = n[3]
  32298. , s = N(t.split("-").map(function(e) {
  32299. return parseInt(e, 10)
  32300. }), 4)
  32301. , e = s[0]
  32302. , n = s[1]
  32303. , t = s[2]
  32304. , s = s[3];
  32305. return i < e ? -1 : e < i ? 1 : r < n ? -1 : n < r ? 1 : a < t ? -1 : t < a ? 1 : o < s ? -1 : s < o ? 1 : 0
  32306. }).forEach(function(e) {
  32307. var t = N(e.split("-").map(function(e) {
  32308. return parseInt(e, 10)
  32309. }), 4)
  32310. , n = t[0]
  32311. , i = t[1]
  32312. , r = t[2]
  32313. , a = t[3]
  32314. , o = 1 & i
  32315. , s = 1 & r
  32316. , t = 1 & a
  32317. , a = l[n - 1 + "-" + (i >> 1) + "-" + (r >> 1) + "-" + (a >> 1)];
  32318. a && (a.hasChildren = !0,
  32319. s = a.key.step(o, s, t),
  32320. (t = new Potree.PointCloudEptGeometryNode(c.ept,s.b,s.d,s.x,s.y,s.z)).level = n,
  32321. t.numPoints = u[e],
  32322. a.addChild(t),
  32323. l[s.name()] = t)
  32324. });
  32325. case 12:
  32326. case "end":
  32327. return e.stop()
  32328. }
  32329. }, e, this)
  32330. })),
  32331. function() {
  32332. return e.apply(this, arguments)
  32333. }
  32334. )
  32335. }, {
  32336. key: "doneLoading",
  32337. value: function(e, t, n, i) {
  32338. e.boundingBox = this.boundingBox,
  32339. this.geometry = e,
  32340. this.tightBoundingBox = t,
  32341. this.numPoints = n,
  32342. this.mean = i,
  32343. this.loaded = !0,
  32344. this.loading = !1,
  32345. --Potree.numNodesLoading
  32346. }
  32347. }, {
  32348. key: "toPotreeName",
  32349. value: function(e, t, n, i) {
  32350. for (var r = "r", a = 0; a < e; ++a) {
  32351. var o = 1 << e - a - 1
  32352. , s = 0;
  32353. t & o && (s += 4),
  32354. n & o && (s += 2),
  32355. i & o && (s += 1),
  32356. r += s
  32357. }
  32358. return r
  32359. }
  32360. }, {
  32361. key: "dispose",
  32362. value: function() {
  32363. if (this.geometry && null != this.parent) {
  32364. this.geometry.dispose(),
  32365. this.geometry = null,
  32366. this.loaded = !1;
  32367. for (var e = 0; e < this.oneTimeDisposeHandlers.length; e++)
  32368. (0,
  32369. this.oneTimeDisposeHandlers[e])();
  32370. this.oneTimeDisposeHandlers = []
  32371. }
  32372. }
  32373. }]),
  32374. l
  32375. }();
  32376. Jd.IDCount = 0;
  32377. var Pm = function() {
  32378. y(n, hn);
  32379. var t = w(n);
  32380. function n() {
  32381. var e;
  32382. return O(this, n),
  32383. (e = t.call(this)).url = null,
  32384. e.octreeDir = null,
  32385. e.spacing = 0,
  32386. e.boundingBox = null,
  32387. e.root = null,
  32388. e.nodes = null,
  32389. e.pointAttributes = null,
  32390. e.hierarchyStepSize = -1,
  32391. e.loader = null,
  32392. e
  32393. }
  32394. return h(n)
  32395. }()
  32396. , Dm = function() {
  32397. y(E, bm);
  32398. var r = w(E);
  32399. function E(e, t, n) {
  32400. var i;
  32401. return O(this, E),
  32402. (i = r.call(this)).id = E.IDCount++,
  32403. i.name = e,
  32404. i.index = parseInt(e.charAt(e.length - 1)),
  32405. i.pcoGeometry = t,
  32406. i.geometry = null,
  32407. i.boundingBox = n,
  32408. i.boundingSphere = n.getBoundingSphere(new qn),
  32409. i.children = {},
  32410. i.numPoints = 0,
  32411. i.level = null,
  32412. i.loaded = !1,
  32413. i.oneTimeDisposeHandlers = [],
  32414. i
  32415. }
  32416. return h(E, [{
  32417. key: "isGeometryNode",
  32418. value: function() {
  32419. return !0
  32420. }
  32421. }, {
  32422. key: "getLevel",
  32423. value: function() {
  32424. return this.level
  32425. }
  32426. }, {
  32427. key: "isTreeNode",
  32428. value: function() {
  32429. return !1
  32430. }
  32431. }, {
  32432. key: "isLoaded",
  32433. value: function() {
  32434. return this.loaded
  32435. }
  32436. }, {
  32437. key: "getBoundingSphere",
  32438. value: function() {
  32439. return this.boundingSphere
  32440. }
  32441. }, {
  32442. key: "getBoundingBox",
  32443. value: function() {
  32444. return this.boundingBox
  32445. }
  32446. }, {
  32447. key: "getChildren",
  32448. value: function() {
  32449. for (var e = [], t = 0; t < 8; t++)
  32450. this.children[t] && e.push(this.children[t]);
  32451. return e
  32452. }
  32453. }, {
  32454. key: "getURL",
  32455. value: function() {
  32456. var e = ""
  32457. , t = this.pcoGeometry.loader.version;
  32458. return t.equalOrHigher("1.5") ? e = this.pcoGeometry.octreeDir + "/" + this.getHierarchyPath() + "/" + this.name : (t.equalOrHigher("1.4") || t.upTo("1.3")) && (e = this.pcoGeometry.octreeDir + "/" + this.name),
  32459. e
  32460. }
  32461. }, {
  32462. key: "getHierarchyPath",
  32463. value: function() {
  32464. for (var e = "r/", t = this.pcoGeometry.hierarchyStepSize, n = this.name.substr(1), i = Math.floor(n.length / t), r = 0; r < i; r++)
  32465. e += n.substr(r * t, t) + "/";
  32466. return e = e.slice(0, -1)
  32467. }
  32468. }, {
  32469. key: "addChild",
  32470. value: function(e) {
  32471. (this.children[e.index] = e).parent = this
  32472. }
  32473. }, {
  32474. key: "load",
  32475. value: function() {
  32476. !0 === this.loading || !0 === this.loaded || Potree.numNodesLoading >= Potree.maxNodesLoading || (this.loading = !0,
  32477. Potree.numNodesLoading++,
  32478. this.pcoGeometry.loader.version.equalOrHigher("1.5") && this.level % this.pcoGeometry.hierarchyStepSize == 0 && this.hasChildren ? this.loadHierachyThenPoints() : this.loadPoints())
  32479. }
  32480. }, {
  32481. key: "loadPoints",
  32482. value: function() {
  32483. this.pcoGeometry.loader.load(this)
  32484. }
  32485. }, {
  32486. key: "loadHierachyThenPoints",
  32487. value: function(e) {
  32488. var t = this;
  32489. if (t.level % t.pcoGeometry.hierarchyStepSize == 0) {
  32490. var n = t.pcoGeometry.octreeDir + "/" + t.getHierarchyPath() + "/" + t.name + ".hrc";
  32491. n += "?m=" + t.pcoGeometry.timeStamp;
  32492. var i = Gp.createXMLHttpRequest();
  32493. i.open("GET", n, !0),
  32494. i.responseType = "arraybuffer",
  32495. i.overrideMimeType("text/plain; charset=x-user-defined"),
  32496. i.onreadystatechange = function() {
  32497. var e;
  32498. 4 === i.readyState && (200 === i.status || 0 === i.status ? (e = i.response,
  32499. function(e, t) {
  32500. performance.now();
  32501. var n = new DataView(t)
  32502. , i = []
  32503. , r = n.getUint8(0)
  32504. , a = n.getUint32(1, !0);
  32505. e.numPoints = a,
  32506. i.push({
  32507. children: r,
  32508. numPoints: a,
  32509. name: e.name
  32510. });
  32511. for (var o = [], s = 5; 0 < i.length; ) {
  32512. for (var l, u, c, d = i.shift(), h = 1, p = 0; p < 8; p++)
  32513. 0 != (d.children & h) && (l = d.name + p,
  32514. u = n.getUint8(s),
  32515. c = n.getUint32(s + 1, !0),
  32516. i.push({
  32517. children: u,
  32518. numPoints: c,
  32519. name: l
  32520. }),
  32521. o.push({
  32522. children: u,
  32523. numPoints: c,
  32524. name: l
  32525. }),
  32526. s += 5),
  32527. h *= 2;
  32528. if (s === t.byteLength)
  32529. break
  32530. }
  32531. for (var f = {}, m = (f[e.name] = e).pcoGeometry, v = 0; v < o.length; v++) {
  32532. var g = o[v].name
  32533. , y = o[v].numPoints
  32534. , w = parseInt(g.charAt(g.length - 1))
  32535. , b = f[g.substring(0, g.length - 1)]
  32536. , x = g.length - 1;
  32537. m.dispatchEvent({
  32538. type: "updateNodeMaxLevel",
  32539. level: x
  32540. });
  32541. w = new E(g,m,Jf.createChildAABB(b.boundingBox, w));
  32542. w.level = x,
  32543. w.numPoints = y,
  32544. w.hasChildren = 0 < o[v].children,
  32545. w.spacing = m.spacing / Math.pow(2, x),
  32546. b.addChild(w),
  32547. f[g] = w
  32548. }
  32549. performance.now();
  32550. e.loadPoints()
  32551. }(t, e)) : (console.log("Failed to load file! HTTP status: " + i.status + ", file: " + n),
  32552. Potree.numNodesLoading--))
  32553. }
  32554. ;
  32555. try {
  32556. i.send(null)
  32557. } catch (e) {
  32558. console.log("fehler beim laden der punktwolke: " + e)
  32559. }
  32560. }
  32561. }
  32562. }, {
  32563. key: "getNumPoints",
  32564. value: function() {
  32565. return this.numPoints
  32566. }
  32567. }, {
  32568. key: "dispose",
  32569. value: function() {
  32570. if (this.geometry && null != this.parent) {
  32571. this.geometry.dispose(),
  32572. this.geometry = null,
  32573. this.loaded = !1,
  32574. this.dispatchEvent({
  32575. type: "dispose"
  32576. });
  32577. for (var e = 0; e < this.oneTimeDisposeHandlers.length; e++)
  32578. (0,
  32579. this.oneTimeDisposeHandlers[e])();
  32580. this.oneTimeDisposeHandlers = []
  32581. }
  32582. }
  32583. }, {
  32584. key: "traverse",
  32585. value: function(e, t) {
  32586. for (var n, i = (t = void 0 === t ? !0 : t) ? [this] : []; void 0 !== (n = i.pop()); ) {
  32587. e(n);
  32588. for (var r = 0, a = n.children; r < a.length; r++) {
  32589. var o = a[r];
  32590. null !== o && i.push(o)
  32591. }
  32592. }
  32593. }
  32594. }]),
  32595. E
  32596. }()
  32597. , km = {
  32598. SPECTRAL: [[Dm.IDCount = 0, new Yi(.3686,.3098,.6353)], [.1, new Yi(.1961,.5333,.7412)], [.2, new Yi(.4,.7608,.6471)], [.3, new Yi(.6706,.8667,.6431)], [.4, new Yi(.902,.9608,.5961)], [.5, new Yi(1,1,.749)], [.6, new Yi(.9961,.8784,.5451)], [.7, new Yi(.9922,.6824,.3804)], [.8, new Yi(.9569,.4275,.2627)], [.9, new Yi(.8353,.2431,.3098)], [1, new Yi(.6196,.0039,.2588)]],
  32599. PLASMA: [[0, new Yi(.241,.015,.61)], [.1, new Yi(.387,.001,.654)], [.2, new Yi(.524,.025,.653)], [.3, new Yi(.651,.125,.596)], [.4, new Yi(.752,.227,.513)], [.5, new Yi(.837,.329,.431)], [.6, new Yi(.907,.435,.353)], [.7, new Yi(.963,.554,.272)], [.8, new Yi(.992,.681,.195)], [.9, new Yi(.987,.822,.144)], [1, new Yi(.94,.975,.131)]],
  32600. YELLOW_GREEN: [[0, new Yi(.1647,.2824,.3451)], [.1, new Yi(.1338,.3555,.4227)], [.2, new Yi(.061,.4319,.4864)], [.3, new Yi(0,.5099,.5319)], [.4, new Yi(0,.5881,.5569)], [.5, new Yi(.137,.665,.5614)], [.6, new Yi(.2906,.7395,.5477)], [.7, new Yi(.4453,.8099,.5201)], [.8, new Yi(.6102,.8748,.485)], [.9, new Yi(.7883,.9323,.4514)], [1, new Yi(.9804,.9804,.4314)]],
  32601. VIRIDIS: [[0, new Yi(.267,.005,.329)], [.1, new Yi(.283,.141,.458)], [.2, new Yi(.254,.265,.53)], [.3, new Yi(.207,.372,.553)], [.4, new Yi(.164,.471,.558)], [.5, new Yi(.128,.567,.551)], [.6, new Yi(.135,.659,.518)], [.7, new Yi(.267,.749,.441)], [.8, new Yi(.478,.821,.318)], [.9, new Yi(.741,.873,.15)], [1, new Yi(.993,.906,.144)]],
  32602. INFERNO: [[0, new Yi(.077,.042,.206)], [.1, new Yi(.225,.036,.388)], [.2, new Yi(.373,.074,.432)], [.3, new Yi(.522,.128,.42)], [.4, new Yi(.665,.182,.37)], [.5, new Yi(.797,.255,.287)], [.6, new Yi(.902,.364,.184)], [.7, new Yi(.969,.516,.063)], [.8, new Yi(.988,.683,.072)], [.9, new Yi(.961,.859,.298)], [1, new Yi(.988,.998,.645)]],
  32603. GRAYSCALE: [[0, new Yi(0,0,0)], [1, new Yi(1,1,1)]],
  32604. TURBO: [[0, new Yi(.18995,.07176,.23217)], [.07, new Yi(.25107,.25237,.63374)], [.13, new Yi(.27628,.42118,.89123)], [.2, new Yi(.25862,.57958,.99876)], [.27, new Yi(.15844,.73551,.92305)], [.33, new Yi(.09267,.86554,.7623)], [.4, new Yi(.19659,.94901,.59466)], [.47, new Yi(.42778,.99419,.38575)], [.53, new Yi(.64362,.98999,.23356)], [.6, new Yi(.80473,.92452,.20459)], [.67, new Yi(.93301,.81236,.22667)], [.73, new Yi(.99314,.67408,.20348)], [.8, new Yi(.9836,.49291,.12849)], [.87, new Yi(.92105,.31489,.05475)], [.93, new Yi(.81608,.18462,.01809)], [1, new Yi(.66449,.08436,.00424)]],
  32605. RAINBOW: [[0, new Yi(.278,0,.714)], [1 / 6, new Yi(0,0,1)], [2 / 6, new Yi(0,1,1)], [.5, new Yi(0,1,0)], [4 / 6, new Yi(1,1,0)], [5 / 6, new Yi(1,.64,0)], [1, new Yi(1,0,0)]],
  32606. CONTOUR: [[0, new Yi(0,0,0)], [.03, new Yi(0,0,0)], [.04, new Yi(1,1,1)], [1, new Yi(1,1,1)]]
  32607. }
  32608. , Bm = {
  32609. DEFAULT: {
  32610. 0: {
  32611. visible: !0,
  32612. name: "never classified",
  32613. color: [.5, .5, .5, 1]
  32614. },
  32615. 1: {
  32616. visible: !0,
  32617. name: "unclassified",
  32618. color: [.5, .5, .5, 1]
  32619. },
  32620. 2: {
  32621. visible: !0,
  32622. name: "ground",
  32623. color: [.63, .32, .18, 1]
  32624. },
  32625. 3: {
  32626. visible: !0,
  32627. name: "low vegetation",
  32628. color: [0, 1, 0, 1]
  32629. },
  32630. 4: {
  32631. visible: !0,
  32632. name: "medium vegetation",
  32633. color: [0, .8, 0, 1]
  32634. },
  32635. 5: {
  32636. visible: !0,
  32637. name: "high vegetation",
  32638. color: [0, .6, 0, 1]
  32639. },
  32640. 6: {
  32641. visible: !0,
  32642. name: "building",
  32643. color: [1, .66, 0, 1]
  32644. },
  32645. 7: {
  32646. visible: !0,
  32647. name: "low point(noise)",
  32648. color: [1, 0, 1, 1]
  32649. },
  32650. 8: {
  32651. visible: !0,
  32652. name: "key-point",
  32653. color: [1, 0, 0, 1]
  32654. },
  32655. 9: {
  32656. visible: !0,
  32657. name: "water",
  32658. color: [0, 0, 1, 1]
  32659. },
  32660. 12: {
  32661. visible: !0,
  32662. name: "overlap",
  32663. color: [1, 1, 0, 1]
  32664. },
  32665. DEFAULT: {
  32666. visible: !0,
  32667. name: "default",
  32668. color: [.3, .6, .6, .5]
  32669. }
  32670. }
  32671. };
  32672. Object.defineProperty(Bm, "RANDOM", {
  32673. get: function() {
  32674. for (var e = {}, t = 0; t <= 255; t++)
  32675. e[t] = new Mn(Math.random(),Math.random(),Math.random());
  32676. return e.DEFAULT = new Mn(Math.random(),Math.random(),Math.random()),
  32677. e
  32678. }
  32679. });
  32680. var Lm, Rm = function() {
  32681. y(s, Gu);
  32682. var o = w(s);
  32683. function s() {
  32684. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  32685. O(this, s),
  32686. (e = o.call(this)).visibleNodesTexture = Jf.generateDataTexture(2048, 1, new Yi(16777215)),
  32687. e.visibleNodesTexture.minFilter = Re,
  32688. e.visibleNodesTexture.magFilter = Re;
  32689. function n(e, t) {
  32690. return void 0 !== e ? e : t
  32691. }
  32692. var i = n(t.size, 1)
  32693. , r = n(t.minSize, 2)
  32694. , a = n(t.maxSize, 1550)
  32695. , t = n(t.treeType, sm.OCTREE);
  32696. e._pointSizeType = am.FIXED,
  32697. e._shape = om.SQUARE,
  32698. e._useClipBox = !1,
  32699. e.clipBoxes = [],
  32700. e.clipPolygons = [],
  32701. e._weighted = !1,
  32702. e._gradient = km.RAINBOW,
  32703. e.gradientTexture = s.generateGradientTexture(e._gradient),
  32704. e._matcap = "matcap.jpg",
  32705. e.matcapTexture = Potree.PointCloudMaterial.generateMatcapTexture(e._matcap),
  32706. e.lights = !1,
  32707. e.fog = !1,
  32708. e._treeType = t,
  32709. e._useEDL = !1,
  32710. e.defines = new Map,
  32711. e.ranges = new Map,
  32712. e._activeAttributeName = null,
  32713. e._defaultIntensityRangeChanged = !1,
  32714. e._defaultElevationRangeChanged = !1;
  32715. t = new ia(new Uint8Array(1024),256,1,et);
  32716. return t.magFilter = Re,
  32717. t.needsUpdate = !0,
  32718. e.classificationTexture = t,
  32719. e.attributes = {
  32720. position: {
  32721. type: "fv",
  32722. value: []
  32723. },
  32724. color: {
  32725. type: "fv",
  32726. value: []
  32727. },
  32728. normal: {
  32729. type: "fv",
  32730. value: []
  32731. },
  32732. intensity: {
  32733. type: "f",
  32734. value: []
  32735. },
  32736. classification: {
  32737. type: "f",
  32738. value: []
  32739. },
  32740. returnNumber: {
  32741. type: "f",
  32742. value: []
  32743. },
  32744. numberOfReturns: {
  32745. type: "f",
  32746. value: []
  32747. },
  32748. pointSourceID: {
  32749. type: "f",
  32750. value: []
  32751. },
  32752. indices: {
  32753. type: "fv",
  32754. value: []
  32755. }
  32756. },
  32757. e.uniforms = {
  32758. level: {
  32759. type: "f",
  32760. value: 0
  32761. },
  32762. vnStart: {
  32763. type: "f",
  32764. value: 0
  32765. },
  32766. spacing: {
  32767. type: "f",
  32768. value: 1
  32769. },
  32770. blendHardness: {
  32771. type: "f",
  32772. value: 2
  32773. },
  32774. blendDepthSupplement: {
  32775. type: "f",
  32776. value: 0
  32777. },
  32778. fov: {
  32779. type: "f",
  32780. value: 1
  32781. },
  32782. resolution: {
  32783. type: "v2",
  32784. value: new yn
  32785. },
  32786. near: {
  32787. type: "f",
  32788. value: .1
  32789. },
  32790. far: {
  32791. type: "f",
  32792. value: 1
  32793. },
  32794. uColor: {
  32795. type: "c",
  32796. value: new Yi(16777215)
  32797. },
  32798. uOpacity: {
  32799. type: "f",
  32800. value: 1
  32801. },
  32802. size: {
  32803. type: "f",
  32804. value: i
  32805. },
  32806. minSize: {
  32807. type: "f",
  32808. value: r
  32809. },
  32810. maxSize: {
  32811. type: "f",
  32812. value: a
  32813. },
  32814. octreeSize: {
  32815. type: "f",
  32816. value: 0
  32817. },
  32818. bbSize: {
  32819. type: "fv",
  32820. value: [0, 0, 0]
  32821. },
  32822. elevationRange: {
  32823. type: "2fv",
  32824. value: [0, 0]
  32825. },
  32826. clipBoxCount: {
  32827. type: "f",
  32828. value: 0
  32829. },
  32830. clipPolygonCount: {
  32831. type: "i",
  32832. value: 0
  32833. },
  32834. clipBoxes: {
  32835. type: "Matrix4fv",
  32836. value: []
  32837. },
  32838. clipPolygons: {
  32839. type: "3fv",
  32840. value: []
  32841. },
  32842. clipPolygonVCount: {
  32843. type: "iv",
  32844. value: []
  32845. },
  32846. clipPolygonVP: {
  32847. type: "Matrix4fv",
  32848. value: []
  32849. },
  32850. visibleNodes: {
  32851. type: "t",
  32852. value: e.visibleNodesTexture
  32853. },
  32854. pcIndex: {
  32855. type: "f",
  32856. value: 0
  32857. },
  32858. gradient: {
  32859. type: "t",
  32860. value: e.gradientTexture
  32861. },
  32862. classificationLUT: {
  32863. type: "t",
  32864. value: e.classificationTexture
  32865. },
  32866. uHQDepthMap: {
  32867. type: "t",
  32868. value: null
  32869. },
  32870. toModel: {
  32871. type: "Matrix4f",
  32872. value: []
  32873. },
  32874. diffuse: {
  32875. type: "fv",
  32876. value: [1, 1, 1]
  32877. },
  32878. transition: {
  32879. type: "f",
  32880. value: .5
  32881. },
  32882. intensityRange: {
  32883. type: "fv",
  32884. value: [1 / 0, -1 / 0]
  32885. },
  32886. intensity_gbc: {
  32887. type: "fv",
  32888. value: [1, 0, 0]
  32889. },
  32890. uRGB_gbc: {
  32891. type: "fv",
  32892. value: [1, 0, 0]
  32893. },
  32894. wRGB: {
  32895. type: "f",
  32896. value: 1
  32897. },
  32898. wIntensity: {
  32899. type: "f",
  32900. value: 0
  32901. },
  32902. wElevation: {
  32903. type: "f",
  32904. value: 0
  32905. },
  32906. wClassification: {
  32907. type: "f",
  32908. value: 0
  32909. },
  32910. wReturnNumber: {
  32911. type: "f",
  32912. value: 0
  32913. },
  32914. wSourceID: {
  32915. type: "f",
  32916. value: 0
  32917. },
  32918. useOrthographicCamera: {
  32919. type: "b",
  32920. value: !1
  32921. },
  32922. elevationGradientRepat: {
  32923. type: "i",
  32924. value: im.CLAMP
  32925. },
  32926. clipTask: {
  32927. type: "i",
  32928. value: 1
  32929. },
  32930. clipMethod: {
  32931. type: "i",
  32932. value: 1
  32933. },
  32934. uShadowColor: {
  32935. type: "3fv",
  32936. value: [0, 0, 0]
  32937. },
  32938. uExtraScale: {
  32939. type: "f",
  32940. value: 1
  32941. },
  32942. uExtraOffset: {
  32943. type: "f",
  32944. value: 0
  32945. },
  32946. uExtraRange: {
  32947. type: "2fv",
  32948. value: [0, 1]
  32949. },
  32950. uExtraGammaBrightContr: {
  32951. type: "3fv",
  32952. value: [1, 0, 0]
  32953. },
  32954. uFilterReturnNumberRange: {
  32955. type: "fv",
  32956. value: [0, 7]
  32957. },
  32958. uFilterNumberOfReturnsRange: {
  32959. type: "fv",
  32960. value: [0, 7]
  32961. },
  32962. uFilterGPSTimeClipRange: {
  32963. type: "fv",
  32964. value: [0, 7]
  32965. },
  32966. uFilterPointSourceIDClipRange: {
  32967. type: "fv",
  32968. value: [0, 65535]
  32969. },
  32970. matcapTextureUniform: {
  32971. type: "t",
  32972. value: e.matcapTexture
  32973. },
  32974. backfaceCulling: {
  32975. type: "b",
  32976. value: !1
  32977. },
  32978. progress: {
  32979. type: "f",
  32980. value: 0
  32981. },
  32982. easeInOutRatio: {
  32983. type: "f",
  32984. value: .3
  32985. },
  32986. pano0Map: {
  32987. type: "t",
  32988. value: null
  32989. },
  32990. pano0Position: {
  32991. type: "v3",
  32992. value: new Cn
  32993. },
  32994. pano0Matrix: {
  32995. type: "m4",
  32996. value: new ni
  32997. },
  32998. pano1Map: {
  32999. type: "t",
  33000. value: null
  33001. },
  33002. pano1Position: {
  33003. type: "v3",
  33004. value: new Cn
  33005. },
  33006. pano1Matrix: {
  33007. type: "m4",
  33008. value: new ni
  33009. }
  33010. },
  33011. e.classification = Bm.DEFAULT,
  33012. e.defaultAttributeValues.normal = [0, 0, 0],
  33013. e.defaultAttributeValues.classification = [0, 0, 0],
  33014. e.defaultAttributeValues.indices = [0, 0, 0, 0],
  33015. e.vertexShader = Hp["pointcloud.vs"],
  33016. e.fragmentShader = Hp["pointcloud.fs"],
  33017. e.vertexColors = 2,
  33018. e.updateShaderSource(),
  33019. e
  33020. }
  33021. return h(s, [{
  33022. key: "setDefine",
  33023. value: function(e, t) {
  33024. null != t ? this.defines.get(e) !== t && (this.defines.set(e, t),
  33025. this.updateShaderSource()) : this.removeDefine(e)
  33026. }
  33027. }, {
  33028. key: "removeDefine",
  33029. value: function(e) {
  33030. this.defines.delete(e)
  33031. }
  33032. }, {
  33033. key: "updateShaderSource",
  33034. value: function() {
  33035. var e = Hp["pointcloud.vs"]
  33036. , t = Hp["pointcloud.fs"]
  33037. , n = this.getDefines()
  33038. , i = e.indexOf("#version ")
  33039. , r = t.indexOf("#version ")
  33040. , e = 0 <= i ? e.replace(/(#version .*)/, "$1\n".concat(n)) : "".concat(n, "\n").concat(e)
  33041. , t = 0 <= r ? t.replace(/(#version .*)/, "$1\n".concat(n)) : "".concat(n, "\n").concat(t);
  33042. this.vertexShader = e,
  33043. this.fragmentShader = t,
  33044. 1 !== this.opacity || this.useFilterByNormal ? (this.opacity < 1 || this.useFilterByNormal) && !this.useEDL && (this.blending = ee,
  33045. this.transparent = !0,
  33046. this.depthTest = !1,
  33047. this.depthWrite = !0,
  33048. this.depthFunc = _e) : (this.blending = Z,
  33049. this.transparent = !1,
  33050. this.depthTest = !0,
  33051. this.depthWrite = !0,
  33052. this.depthFunc = Ae),
  33053. this.weighted && (this.blending = ee,
  33054. this.transparent = !0,
  33055. this.depthTest = !0,
  33056. this.depthWrite = !1),
  33057. this.needsUpdate = !0
  33058. }
  33059. }, {
  33060. key: "getDefines",
  33061. value: function() {
  33062. var e, t = [];
  33063. this.pointSizeType === am.FIXED ? t.push("#define fixed_point_size") : this.pointSizeType === am.ATTENUATED ? t.push("#define attenuated_point_size") : this.pointSizeType === am.ADAPTIVE && t.push("#define adaptive_point_size"),
  33064. jp.EXT_DEPTH.isSupported() || this.shape !== om.PARABOLOID || (this.shape = om.SQUARE),
  33065. this.shape === om.SQUARE ? t.push("#define square_point_shape") : this.shape === om.CIRCLE ? t.push("#define circle_point_shape") : this.shape === om.PARABOLOID && t.push("#define paraboloid_point_shape"),
  33066. (this._useEDL || this.fakeEDL) && t.push("#define use_edl"),
  33067. this.activeAttributeName && (e = this.activeAttributeName.replace(/[^a-zA-Z0-9]/g, "_"),
  33068. t.push("#define color_type_".concat(e))),
  33069. this._treeType === sm.OCTREE ? t.push("#define tree_type_octree") : this._treeType === sm.KDTREE && t.push("#define tree_type_kdtree"),
  33070. this.weighted && t.push("#define weighted_splats");
  33071. var n, i = ue(this.defines);
  33072. try {
  33073. for (i.s(); !(n = i.n()).done; ) {
  33074. var r = N(n.value, 2)
  33075. , a = (r[0],
  33076. r[1]);
  33077. t.push(a)
  33078. }
  33079. } catch (e) {
  33080. i.e(e)
  33081. } finally {
  33082. i.f()
  33083. }
  33084. return t.join("\n")
  33085. }
  33086. }, {
  33087. key: "setClipBoxes",
  33088. value: function(e) {
  33089. if (e) {
  33090. var t = this.clipBoxes.length !== e.length && (0 === e.length || 0 === this.clipBoxes.length);
  33091. this.uniforms.clipBoxCount.value = this.clipBoxes.length,
  33092. this.clipBoxes = e,
  33093. t && this.updateShaderSource(),
  33094. this.uniforms.clipBoxes.value = new Float32Array(16 * this.clipBoxes.length);
  33095. for (var n = 0; n < this.clipBoxes.length; n++) {
  33096. var i = e[n];
  33097. this.uniforms.clipBoxes.value.set(i.inverse.elements, 16 * n)
  33098. }
  33099. for (var r = 0; r < this.uniforms.clipBoxes.value.length; r++)
  33100. Number.isNaN(this.uniforms.clipBoxes.value[r]) && (this.uniforms.clipBoxes.value[r] = 1 / 0)
  33101. }
  33102. }
  33103. }, {
  33104. key: "setClipPolygons",
  33105. value: function(e, t) {
  33106. e && (this.clipPolygons = e,
  33107. this.clipPolygons.length !== e.length && this.updateShaderSource())
  33108. }
  33109. }, {
  33110. key: "gradient",
  33111. get: function() {
  33112. return this._gradient
  33113. },
  33114. set: function(e) {
  33115. this._gradient !== e && (this._gradient = e,
  33116. this.gradientTexture = s.generateGradientTexture(this._gradient),
  33117. this.uniforms.gradient.value = this.gradientTexture)
  33118. }
  33119. }, {
  33120. key: "matcap",
  33121. get: function() {
  33122. return this._matcap
  33123. },
  33124. set: function(e) {
  33125. this._matcap !== e && (this._matcap = e,
  33126. this.matcapTexture = Potree.PointCloudMaterial.generateMatcapTexture(this._matcap),
  33127. this.uniforms.matcapTextureUniform.value = this.matcapTexture)
  33128. }
  33129. }, {
  33130. key: "useOrthographicCamera",
  33131. get: function() {
  33132. return this.uniforms.useOrthographicCamera.value
  33133. },
  33134. set: function(e) {
  33135. this.uniforms.useOrthographicCamera.value !== e && (this.uniforms.useOrthographicCamera.value = e)
  33136. }
  33137. }, {
  33138. key: "backfaceCulling",
  33139. get: function() {
  33140. return this.uniforms.backfaceCulling.value
  33141. },
  33142. set: function(e) {
  33143. this.uniforms.backfaceCulling.value !== e && (this.uniforms.backfaceCulling.value = e,
  33144. this.dispatchEvent({
  33145. type: "backface_changed",
  33146. target: this
  33147. }))
  33148. }
  33149. }, {
  33150. key: "recomputeClassification",
  33151. value: function() {
  33152. for (var e = this.classification, t = this.classificationTexture.image.data, n = [1, 1, 1, 1], i = !1, r = 0; r < 256; r++) {
  33153. var a = void 0
  33154. , o = !0;
  33155. e[r] ? (a = e[r].color,
  33156. o = e[r].visible) : e[r % 32] ? (a = e[r % 32].color,
  33157. o = e[r % 32].visible) : e.DEFAULT ? (a = e.DEFAULT.color,
  33158. o = e.DEFAULT.visible) : a = n;
  33159. var s = parseInt(255 * a[0])
  33160. , l = parseInt(255 * a[1])
  33161. , u = parseInt(255 * a[2])
  33162. , a = o ? parseInt(255 * a[3]) : 0;
  33163. t[4 * r + 0] !== s && (t[4 * r + 0] = s,
  33164. i = !0),
  33165. t[4 * r + 1] !== l && (t[4 * r + 1] = l,
  33166. i = !0),
  33167. t[4 * r + 2] !== u && (t[4 * r + 2] = u,
  33168. i = !0),
  33169. t[4 * r + 3] !== a && (t[4 * r + 3] = a,
  33170. i = !0)
  33171. }
  33172. i && (this.classificationTexture.needsUpdate = !0,
  33173. this.dispatchEvent({
  33174. type: "material_property_changed",
  33175. target: this
  33176. }))
  33177. }
  33178. }, {
  33179. key: "spacing",
  33180. get: function() {
  33181. return this.uniforms.spacing.value
  33182. },
  33183. set: function(e) {
  33184. this.uniforms.spacing.value !== e && (this.uniforms.spacing.value = e)
  33185. }
  33186. }, {
  33187. key: "useClipBox",
  33188. get: function() {
  33189. return this._useClipBox
  33190. },
  33191. set: function(e) {
  33192. this._useClipBox !== e && (this._useClipBox = e,
  33193. this.updateShaderSource())
  33194. }
  33195. }, {
  33196. key: "clipTask",
  33197. get: function() {
  33198. return this.uniforms.clipTask.value
  33199. },
  33200. set: function(e) {
  33201. this.uniforms.clipTask.value = e
  33202. }
  33203. }, {
  33204. key: "elevationGradientRepat",
  33205. get: function() {
  33206. return this.uniforms.elevationGradientRepat.value
  33207. },
  33208. set: function(e) {
  33209. this.uniforms.elevationGradientRepat.value = e
  33210. }
  33211. }, {
  33212. key: "clipMethod",
  33213. get: function() {
  33214. return this.uniforms.clipMethod.value
  33215. },
  33216. set: function(e) {
  33217. this.uniforms.clipMethod.value = e
  33218. }
  33219. }, {
  33220. key: "weighted",
  33221. get: function() {
  33222. return this._weighted
  33223. },
  33224. set: function(e) {
  33225. this._weighted !== e && (this._weighted = e,
  33226. this.updateShaderSource())
  33227. }
  33228. }, {
  33229. key: "fov",
  33230. get: function() {
  33231. return this.uniforms.fov.value
  33232. },
  33233. set: function(e) {
  33234. this.uniforms.fov.value !== e && (this.uniforms.fov.value = e)
  33235. }
  33236. }, {
  33237. key: "resolution",
  33238. get: function() {
  33239. return this.uniforms.resolution.value
  33240. },
  33241. set: function(e) {
  33242. this.uniforms.resolution.value.copy(e)
  33243. }
  33244. }, {
  33245. key: "near",
  33246. get: function() {
  33247. return this.uniforms.near.value
  33248. },
  33249. set: function(e) {
  33250. this.uniforms.near.value !== e && (this.uniforms.near.value = e)
  33251. }
  33252. }, {
  33253. key: "far",
  33254. get: function() {
  33255. return this.uniforms.far.value
  33256. },
  33257. set: function(e) {
  33258. this.uniforms.far.value !== e && (this.uniforms.far.value = e)
  33259. }
  33260. }, {
  33261. key: "opacity",
  33262. get: function() {
  33263. return this.uniforms.uOpacity.value
  33264. },
  33265. set: function(e) {
  33266. this.uniforms && this.uniforms.uOpacity && this.uniforms.uOpacity.value !== e && (this.uniforms.uOpacity.value = e,
  33267. this.updateShaderSource(),
  33268. this.dispatchEvent({
  33269. type: "opacity_changed",
  33270. target: this
  33271. }),
  33272. this.dispatchEvent({
  33273. type: "material_property_changed",
  33274. target: this
  33275. }))
  33276. }
  33277. }, {
  33278. key: "activeAttributeName",
  33279. get: function() {
  33280. return this._activeAttributeName
  33281. },
  33282. set: function(e) {
  33283. this._activeAttributeName !== e && (this._activeAttributeName = e,
  33284. this.updateShaderSource(),
  33285. this.dispatchEvent({
  33286. type: "active_attribute_changed",
  33287. target: this
  33288. }),
  33289. this.dispatchEvent({
  33290. type: "material_property_changed",
  33291. target: this
  33292. }))
  33293. }
  33294. }, {
  33295. key: "pointSizeType",
  33296. get: function() {
  33297. return this._pointSizeType
  33298. },
  33299. set: function(e) {
  33300. this._pointSizeType !== (e = "string" == typeof e ? am[e] : e) && (this._pointSizeType = e,
  33301. this.updateShaderSource(),
  33302. this.dispatchEvent({
  33303. type: "point_size_type_changed",
  33304. target: this
  33305. }),
  33306. this.dispatchEvent({
  33307. type: "material_property_changed",
  33308. target: this
  33309. }))
  33310. }
  33311. }, {
  33312. key: "useEDL",
  33313. get: function() {
  33314. return this._useEDL
  33315. },
  33316. set: function(e) {
  33317. this._useEDL !== e && (this._useEDL = e,
  33318. this.updateShaderSource())
  33319. }
  33320. }, {
  33321. key: "fakeEDL",
  33322. get: function() {
  33323. return this._fakeEDL
  33324. },
  33325. set: function(e) {
  33326. this._fakeEDL !== e && (this._fakeEDL = e,
  33327. this.updateShaderSource())
  33328. }
  33329. }, {
  33330. key: "color",
  33331. get: function() {
  33332. return this.uniforms.uColor.value
  33333. },
  33334. set: function(e) {
  33335. var t, n;
  33336. e != this.color_ && ("string" != typeof (t = e) || (n = Potree.config.colors[e]) && (t = (new Yi).fromArray(n).multiplyScalar(1 / 255)),
  33337. this.uniforms.uColor.value.set(t),
  33338. this.dispatchEvent({
  33339. type: "color_changed",
  33340. target: this
  33341. }),
  33342. this.dispatchEvent({
  33343. type: "material_property_changed",
  33344. target: this
  33345. }),
  33346. this.color_ = e)
  33347. }
  33348. }, {
  33349. key: "shape",
  33350. get: function() {
  33351. return this._shape
  33352. },
  33353. set: function(e) {
  33354. this._shape !== e && (this._shape = e,
  33355. this.updateShaderSource(),
  33356. this.dispatchEvent({
  33357. type: "point_shape_changed",
  33358. target: this
  33359. }),
  33360. this.dispatchEvent({
  33361. type: "material_property_changed",
  33362. target: this
  33363. }))
  33364. }
  33365. }, {
  33366. key: "treeType",
  33367. get: function() {
  33368. return this._treeType
  33369. },
  33370. set: function(e) {
  33371. this._treeType !== e && (this._treeType = e,
  33372. this.updateShaderSource())
  33373. }
  33374. }, {
  33375. key: "bbSize",
  33376. get: function() {
  33377. return this.uniforms.bbSize.value
  33378. },
  33379. set: function(e) {
  33380. this.uniforms.bbSize.value = e
  33381. }
  33382. }, {
  33383. key: "size",
  33384. get: function() {
  33385. return this.uniforms.size.value
  33386. },
  33387. set: function(e) {
  33388. this.uniforms.size.value !== e && (this.uniforms.size.value = e,
  33389. this.dispatchEvent({
  33390. type: "point_size_changed",
  33391. target: this
  33392. }),
  33393. this.dispatchEvent({
  33394. type: "material_property_changed",
  33395. target: this
  33396. }))
  33397. }
  33398. }, {
  33399. key: "minSize",
  33400. get: function() {
  33401. return this.uniforms.minSize.value
  33402. },
  33403. set: function(e) {
  33404. this.uniforms.minSize.value !== e && (this.uniforms.minSize.value = e,
  33405. this.dispatchEvent({
  33406. type: "point_size_changed",
  33407. target: this
  33408. }),
  33409. this.dispatchEvent({
  33410. type: "material_property_changed",
  33411. target: this
  33412. }))
  33413. }
  33414. }, {
  33415. key: "elevationRange",
  33416. get: function() {
  33417. return this.uniforms.elevationRange.value
  33418. },
  33419. set: function(e) {
  33420. this.uniforms.elevationRange.value[0] === e[0] && this.uniforms.elevationRange.value[1] === e[1] || (this.uniforms.elevationRange.value = e,
  33421. this._defaultElevationRangeChanged = !0,
  33422. this.dispatchEvent({
  33423. type: "material_property_changed",
  33424. target: this
  33425. }))
  33426. }
  33427. }, {
  33428. key: "heightMin",
  33429. get: function() {
  33430. return this.uniforms.elevationRange.value[0]
  33431. },
  33432. set: function(e) {
  33433. this.elevationRange = [e, this.elevationRange[1]]
  33434. }
  33435. }, {
  33436. key: "heightMax",
  33437. get: function() {
  33438. return this.uniforms.elevationRange.value[1]
  33439. },
  33440. set: function(e) {
  33441. this.elevationRange = [this.elevationRange[0], e]
  33442. }
  33443. }, {
  33444. key: "transition",
  33445. get: function() {
  33446. return this.uniforms.transition.value
  33447. },
  33448. set: function(e) {
  33449. this.uniforms.transition.value = e
  33450. }
  33451. }, {
  33452. key: "intensityRange",
  33453. get: function() {
  33454. return this.uniforms.intensityRange.value
  33455. },
  33456. set: function(e) {
  33457. e instanceof Array && 2 === e.length && (e[0] === this.uniforms.intensityRange.value[0] && e[1] === this.uniforms.intensityRange.value[1] || (this.uniforms.intensityRange.value = e,
  33458. this._defaultIntensityRangeChanged = !0,
  33459. this.dispatchEvent({
  33460. type: "material_property_changed",
  33461. target: this
  33462. })))
  33463. }
  33464. }, {
  33465. key: "intensityGamma",
  33466. get: function() {
  33467. return this.uniforms.intensity_gbc.value[0]
  33468. },
  33469. set: function(e) {
  33470. this.uniforms.intensity_gbc.value[0] !== e && (this.uniforms.intensity_gbc.value[0] = e,
  33471. this.dispatchEvent({
  33472. type: "material_property_changed",
  33473. target: this
  33474. }))
  33475. }
  33476. }, {
  33477. key: "intensityContrast",
  33478. get: function() {
  33479. return this.uniforms.intensity_gbc.value[2]
  33480. },
  33481. set: function(e) {
  33482. this.uniforms.intensity_gbc.value[2] !== e && (this.uniforms.intensity_gbc.value[2] = e,
  33483. this.dispatchEvent({
  33484. type: "material_property_changed",
  33485. target: this
  33486. }))
  33487. }
  33488. }, {
  33489. key: "intensityBrightness",
  33490. get: function() {
  33491. return this.uniforms.intensity_gbc.value[1]
  33492. },
  33493. set: function(e) {
  33494. this.uniforms.intensity_gbc.value[1] !== e && (this.uniforms.intensity_gbc.value[1] = e,
  33495. this.dispatchEvent({
  33496. type: "material_property_changed",
  33497. target: this
  33498. }))
  33499. }
  33500. }, {
  33501. key: "rgbGamma",
  33502. get: function() {
  33503. return this.uniforms.uRGB_gbc.value[0]
  33504. },
  33505. set: function(e) {
  33506. this.uniforms.uRGB_gbc.value[0] !== e && (this.uniforms.uRGB_gbc.value[0] = e,
  33507. this.dispatchEvent({
  33508. type: "material_property_changed",
  33509. target: this
  33510. }))
  33511. }
  33512. }, {
  33513. key: "rgbContrast",
  33514. get: function() {
  33515. return this.uniforms.uRGB_gbc.value[2]
  33516. },
  33517. set: function(e) {
  33518. this.uniforms.uRGB_gbc.value[2] !== e && (this.uniforms.uRGB_gbc.value[2] = e,
  33519. this.dispatchEvent({
  33520. type: "material_property_changed",
  33521. target: this
  33522. }))
  33523. }
  33524. }, {
  33525. key: "rgbBrightness",
  33526. get: function() {
  33527. return this.uniforms.uRGB_gbc.value[1]
  33528. },
  33529. set: function(e) {
  33530. this.uniforms.uRGB_gbc.value[1] !== e && (this.uniforms.uRGB_gbc.value[1] = e,
  33531. this.dispatchEvent({
  33532. type: "material_property_changed",
  33533. target: this
  33534. }))
  33535. }
  33536. }, {
  33537. key: "extraGamma",
  33538. get: function() {
  33539. return this.uniforms.uExtraGammaBrightContr.value[0]
  33540. },
  33541. set: function(e) {
  33542. this.uniforms.uExtraGammaBrightContr.value[0] !== e && (this.uniforms.uExtraGammaBrightContr.value[0] = e,
  33543. this.dispatchEvent({
  33544. type: "material_property_changed",
  33545. target: this
  33546. }))
  33547. }
  33548. }, {
  33549. key: "extraBrightness",
  33550. get: function() {
  33551. return this.uniforms.uExtraGammaBrightContr.value[1]
  33552. },
  33553. set: function(e) {
  33554. this.uniforms.uExtraGammaBrightContr.value[1] !== e && (this.uniforms.uExtraGammaBrightContr.value[1] = e,
  33555. this.dispatchEvent({
  33556. type: "material_property_changed",
  33557. target: this
  33558. }))
  33559. }
  33560. }, {
  33561. key: "extraContrast",
  33562. get: function() {
  33563. return this.uniforms.uExtraGammaBrightContr.value[2]
  33564. },
  33565. set: function(e) {
  33566. this.uniforms.uExtraGammaBrightContr.value[2] !== e && (this.uniforms.uExtraGammaBrightContr.value[2] = e,
  33567. this.dispatchEvent({
  33568. type: "material_property_changed",
  33569. target: this
  33570. }))
  33571. }
  33572. }, {
  33573. key: "getRange",
  33574. value: function(e) {
  33575. return this.ranges.get(e)
  33576. }
  33577. }, {
  33578. key: "setRange",
  33579. value: function(e, t) {
  33580. var n = !1
  33581. , i = this.ranges.get(e)
  33582. , n = null == i || null == t || (i[0] !== t[0] || i[1] !== t[1]);
  33583. this.ranges.set(e, t),
  33584. n && this.dispatchEvent({
  33585. type: "material_property_changed",
  33586. target: this
  33587. })
  33588. }
  33589. }, {
  33590. key: "extraRange",
  33591. get: function() {
  33592. return this.uniforms.uExtraRange.value
  33593. },
  33594. set: function(e) {
  33595. e instanceof Array && 2 === e.length && (e[0] === this.uniforms.uExtraRange.value[0] && e[1] === this.uniforms.uExtraRange.value[1] || (this.uniforms.uExtraRange.value = e,
  33596. this._defaultExtraRangeChanged = !0,
  33597. this.dispatchEvent({
  33598. type: "material_property_changed",
  33599. target: this
  33600. })))
  33601. }
  33602. }, {
  33603. key: "weightRGB",
  33604. get: function() {
  33605. return this.uniforms.wRGB.value
  33606. },
  33607. set: function(e) {
  33608. this.uniforms.wRGB.value !== e && (this.uniforms.wRGB.value = e,
  33609. this.dispatchEvent({
  33610. type: "material_property_changed",
  33611. target: this
  33612. }))
  33613. }
  33614. }, {
  33615. key: "weightIntensity",
  33616. get: function() {
  33617. return this.uniforms.wIntensity.value
  33618. },
  33619. set: function(e) {
  33620. this.uniforms.wIntensity.value !== e && (this.uniforms.wIntensity.value = e,
  33621. this.dispatchEvent({
  33622. type: "material_property_changed",
  33623. target: this
  33624. }))
  33625. }
  33626. }, {
  33627. key: "weightElevation",
  33628. get: function() {
  33629. return this.uniforms.wElevation.value
  33630. },
  33631. set: function(e) {
  33632. this.uniforms.wElevation.value !== e && (this.uniforms.wElevation.value = e,
  33633. this.dispatchEvent({
  33634. type: "material_property_changed",
  33635. target: this
  33636. }))
  33637. }
  33638. }, {
  33639. key: "weightClassification",
  33640. get: function() {
  33641. return this.uniforms.wClassification.value
  33642. },
  33643. set: function(e) {
  33644. this.uniforms.wClassification.value !== e && (this.uniforms.wClassification.value = e,
  33645. this.dispatchEvent({
  33646. type: "material_property_changed",
  33647. target: this
  33648. }))
  33649. }
  33650. }, {
  33651. key: "weightReturnNumber",
  33652. get: function() {
  33653. return this.uniforms.wReturnNumber.value
  33654. },
  33655. set: function(e) {
  33656. this.uniforms.wReturnNumber.value !== e && (this.uniforms.wReturnNumber.value = e,
  33657. this.dispatchEvent({
  33658. type: "material_property_changed",
  33659. target: this
  33660. }))
  33661. }
  33662. }, {
  33663. key: "weightSourceID",
  33664. get: function() {
  33665. return this.uniforms.wSourceID.value
  33666. },
  33667. set: function(e) {
  33668. this.uniforms.wSourceID.value !== e && (this.uniforms.wSourceID.value = e,
  33669. this.dispatchEvent({
  33670. type: "material_property_changed",
  33671. target: this
  33672. }))
  33673. }
  33674. }, {
  33675. key: "disableEvents",
  33676. value: function() {
  33677. void 0 === this._hiddenListeners && (this._hiddenListeners = this._listeners,
  33678. this._listeners = {})
  33679. }
  33680. }, {
  33681. key: "enableEvents",
  33682. value: function() {
  33683. this._listeners = this._hiddenListeners,
  33684. this._hiddenListeners = void 0
  33685. }
  33686. }, {
  33687. key: "setProjectedPanos",
  33688. value: function(e, t, n, i) {
  33689. this.usePanoMap = !0,
  33690. null != n && (this.uniforms.progress.value = n),
  33691. this.uniforms.pano0Map.value = e.getSkyboxTexture(),
  33692. this.uniforms.pano0Position.value.copy(e.position),
  33693. this.uniforms.pano0Matrix.value.copy(e.panoMatrix),
  33694. this.uniforms.easeInOutRatio.value = i || 0,
  33695. this.uniforms.pano1Map.value = t.getSkyboxTexture(),
  33696. this.uniforms.pano1Position.value.copy(t.position),
  33697. this.uniforms.pano1Matrix.value.copy(t.panoMatrix)
  33698. }
  33699. }, {
  33700. key: "stopProjectedPanos",
  33701. value: function() {
  33702. this.usePanoMap = !1
  33703. }
  33704. }], [{
  33705. key: "generateGradientTexture",
  33706. value: function(e) {
  33707. var t = document.createElement("canvas");
  33708. t.width = 64,
  33709. t.height = 64;
  33710. var n = t.getContext("2d");
  33711. n.rect(0, 0, 64, 64);
  33712. for (var i = n.createLinearGradient(0, 0, 64, 64), r = 0; r < e.length; r++) {
  33713. var a = e[r];
  33714. i.addColorStop(a[0], "#" + a[1].getHexString())
  33715. }
  33716. n.fillStyle = i,
  33717. n.fill();
  33718. t = new xl(t);
  33719. return t.needsUpdate = !0,
  33720. t.minFilter = Oe,
  33721. t.wrap = ke,
  33722. t.repeat = 2,
  33723. t
  33724. }
  33725. }, {
  33726. key: "generateMatcapTexture",
  33727. value: function(e) {
  33728. e = new URL(Potree.resourcePath + "/textures/matcap/" + e).href,
  33729. e = (new _c).load(e);
  33730. return e.magFilter = e.minFilter = Oe,
  33731. e.needsUpdate = !0,
  33732. e
  33733. }
  33734. }]),
  33735. s
  33736. }(), Fm = {
  33737. sortByScore: function(e, t, i) {
  33738. e = t ? Fm.filterAll(e, t) : e;
  33739. return 0 === e.length ? null : e.map(function(n) {
  33740. return {
  33741. item: n,
  33742. score: i.reduce(function(e, t) {
  33743. return e + t(n)
  33744. }, 0)
  33745. }
  33746. }).sort(function(e, t) {
  33747. return t.score - e.score
  33748. })
  33749. },
  33750. filterAll: function(e, n) {
  33751. return e.filter(function(t) {
  33752. return n.every(function(e) {
  33753. return e(t)
  33754. })
  33755. })
  33756. },
  33757. find: function(e, t, n, i) {
  33758. if (i) {
  33759. i = this.sortByScore(e, t, n);
  33760. return i && i[0] && i[0].item
  33761. }
  33762. var r = t ? Fm.filterAll(e, t) : e;
  33763. return 0 === r.length ? null : (n && n.forEach(function(e) {
  33764. r = Fm.stableSort(r, e)
  33765. }),
  33766. r[0])
  33767. },
  33768. stableSort: function(e, i) {
  33769. return e.map(function(e, t) {
  33770. return {
  33771. value: e,
  33772. index: t
  33773. }
  33774. }).sort(function(e, t) {
  33775. var n = i(e.value, t.value);
  33776. return 0 !== n ? n : e.index - t.index
  33777. }).map(function(e) {
  33778. return e.value
  33779. })
  33780. },
  33781. average: function(e, t) {
  33782. if (0 === e.length)
  33783. return null;
  33784. for (var n = 0, i = 0, r = 0; r < e.length; r++)
  33785. n += t ? e[r][t] : e[r],
  33786. i++;
  33787. return n / i
  33788. },
  33789. getMixedSet: function(e, t) {
  33790. return e.filter(function(e) {
  33791. return t.includes(e)
  33792. })
  33793. },
  33794. getUnionSet: function(t, e) {
  33795. return t.concat(e.filter(function(e) {
  33796. return !t.includes(e)
  33797. }))
  33798. },
  33799. getDifferenceSet: function(t, n) {
  33800. var e = t.filter(function(e) {
  33801. return !n.includes(e)
  33802. })
  33803. , i = n.filter(function(e) {
  33804. return !t.includes(e)
  33805. });
  33806. return e.concat(i)
  33807. },
  33808. getDifferenceSetMuti: function(e) {
  33809. var n = [];
  33810. return e.forEach(function(e) {
  33811. e.forEach(function(e) {
  33812. var t = n.indexOf(e);
  33813. -1 < t ? n.splice(t, 1) : n.push(e)
  33814. })
  33815. }),
  33816. n
  33817. },
  33818. CloneJson: function(e) {
  33819. e = JSON.stringify(e);
  33820. return JSON.parse(e)
  33821. },
  33822. CloneObject: function(t, e, n) {
  33823. var i, r = this, a = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : [];
  33824. if (a.push(Si),
  33825. !t || "number" == typeof t || "string" == typeof t || t instanceof Function || a.some(function(e) {
  33826. return t instanceof e
  33827. }))
  33828. return t;
  33829. if (e = e || {},
  33830. t instanceof Array)
  33831. return t.map(function(e) {
  33832. return r.CloneObject(e)
  33833. });
  33834. if (t.clone instanceof Function)
  33835. return t.clone();
  33836. for (i in t)
  33837. t[i]instanceof Object && !n ? e[i] = this.CloneObject(t[i]) : e[i] = t[i];
  33838. return e
  33839. },
  33840. CloneClassObject: function(e) {
  33841. var t = new e.constructor;
  33842. return this.CopyClassObject(t, e),
  33843. t
  33844. },
  33845. CopyClassObject: function(e, t) {
  33846. for (var n in t) {
  33847. if (n in t.__proto__)
  33848. break;
  33849. e[n] = this.CloneObject(t[n], null)
  33850. }
  33851. },
  33852. ifSame: (Lm = function(n, e) {
  33853. if (n == e)
  33854. return !0;
  33855. if (!n || !e)
  33856. return !1;
  33857. if (n.constructor != e.constructor)
  33858. return !1;
  33859. if (n instanceof Array) {
  33860. if (n.length != e.length)
  33861. return !1;
  33862. for (var i = e.slice(0), t = 0; t < n.length; t++) {
  33863. var r, a = function(t) {
  33864. if (null == (r = i.find(function(e) {
  33865. return ifSame(n[t], e)
  33866. })) && !i.includes(r) && !n.includes(r))
  33867. return {
  33868. v: !1
  33869. };
  33870. var e = i.indexOf(r);
  33871. i.splice(e, 1)
  33872. }(t);
  33873. if ("object" === X(a))
  33874. return a.v
  33875. }
  33876. return !0
  33877. }
  33878. if (n.equals instanceof Function)
  33879. return n.equals(e);
  33880. if ("number" == typeof n || "string" == typeof n)
  33881. return !(!isNaN(n) || !isNaN(e)) || n == e;
  33882. if ("object" == X(n)) {
  33883. var o, s = Object.keys(n), l = Object.keys(e);
  33884. if (!ifSame(s, l))
  33885. return !1;
  33886. for (o in n)
  33887. if (!ifSame(n[o], e[o]))
  33888. return !1;
  33889. return !0
  33890. }
  33891. console.log("isSame出现例外")
  33892. }
  33893. ,
  33894. Im.toString = function() {
  33895. return Lm.toString()
  33896. }
  33897. ,
  33898. Im),
  33899. replaceAll: function(e, t, n) {
  33900. t = new RegExp(t,"g");
  33901. return e.replace(t, n)
  33902. },
  33903. downloadFile: function(e, t, n) {
  33904. var i = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
  33905. i.href = e,
  33906. i.download = t;
  33907. t = document.createEvent("MouseEvents");
  33908. t.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null),
  33909. i.dispatchEvent(t),
  33910. n && n()
  33911. },
  33912. intervalTool: {
  33913. list: [],
  33914. isWaiting: function(t, n, i) {
  33915. var r = this;
  33916. this.list.includes(t) || n() && (this.list.push(t),
  33917. setTimeout(function() {
  33918. var e = r.list.indexOf(t);
  33919. r.list.splice(e, 1),
  33920. r.isWaiting(t, n, i)
  33921. }, i))
  33922. }
  33923. },
  33924. pushToGroupAuto: function(t, n, i) {
  33925. i = i || function() {}
  33926. ;
  33927. var r, a = n.filter(function(e) {
  33928. return e.find(function(e) {
  33929. return t[0] == e || i(e, t[0]) || t[1] == e || t[1] && i(e, t[1])
  33930. })
  33931. });
  33932. a.length ? (t.forEach(function(e) {
  33933. a[0].includes(e) || a[0].push(e)
  33934. }),
  33935. 1 < a.length && (r = [],
  33936. a.forEach(function(e) {
  33937. r = Fm.getUnionSet(r, e),
  33938. n.splice(n.indexOf(e), 1)
  33939. }),
  33940. n.push(r))) : n.push(t)
  33941. },
  33942. addOrRemoveDefine: function(e, t, n) {
  33943. var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : ""
  33944. , r = e.defines;
  33945. if ("add" == n) {
  33946. if (null != r[t] && r[t] == i)
  33947. return;
  33948. r[t] = i
  33949. } else {
  33950. if (null != r[t])
  33951. return;
  33952. delete r[t]
  33953. }
  33954. e.needsUpdate = !0
  33955. },
  33956. makeTexDontResize: function(e) {
  33957. !e || e.image && gn.isPowerOfTwo(e.image.width) && gn.isPowerOfTwo(e.image.height) || (e.wrapS = e.wrapT = Be,
  33958. e.minFilter = Oe)
  33959. }
  33960. };
  33961. function Im(e, t) {
  33962. return Lm.apply(this, arguments)
  33963. }
  33964. new ua(1,1);
  33965. function Om(e, t) {
  33966. var n = zm.get(e);
  33967. return n || (t = new $i({
  33968. color: (new Yi).setHSL(Math.random(), .5, .9),
  33969. transparent: !0,
  33970. side: 2,
  33971. opacity: t ? .3 : .9
  33972. }),
  33973. zm.set(e, t),
  33974. t)
  33975. }
  33976. var zm = new Map
  33977. , Nm = function() {
  33978. y(n, bm);
  33979. var t = w(n);
  33980. function n() {
  33981. var e;
  33982. return O(this, n),
  33983. (e = t.call(this)).children = [],
  33984. e.sceneNode = null,
  33985. e.octree = null,
  33986. e
  33987. }
  33988. return h(n, [{
  33989. key: "getNumPoints",
  33990. value: function() {
  33991. return this.geometryNode.numPoints
  33992. }
  33993. }, {
  33994. key: "isLoaded",
  33995. value: function() {
  33996. return !0
  33997. }
  33998. }, {
  33999. key: "isTreeNode",
  34000. value: function() {
  34001. return !0
  34002. }
  34003. }, {
  34004. key: "isGeometryNode",
  34005. value: function() {
  34006. return !1
  34007. }
  34008. }, {
  34009. key: "getLevel",
  34010. value: function() {
  34011. return this.geometryNode.level
  34012. }
  34013. }, {
  34014. key: "getBoundingSphere",
  34015. value: function() {
  34016. return this.geometryNode.boundingSphere
  34017. }
  34018. }, {
  34019. key: "getBoundingBox",
  34020. value: function() {
  34021. return this.geometryNode.boundingBox
  34022. }
  34023. }, {
  34024. key: "getChildren",
  34025. value: function() {
  34026. for (var e = [], t = 0; t < 8; t++)
  34027. this.children[t] && e.push(this.children[t]);
  34028. return e
  34029. }
  34030. }, {
  34031. key: "getPointsInBox",
  34032. value: function(e) {
  34033. if (!this.sceneNode)
  34034. return null;
  34035. for (var t = this.geometryNode.buffer, n = t.offset("position"), i = t.stride, r = new DataView(t.data), e = e.matrixWorld.clone().invert(), a = (new ni).multiplyMatrices(e, this.sceneNode.matrixWorld), o = [], s = new Mn, l = 0; l < t.numElements; l++) {
  34036. var u = r.getFloat32(l * i + n + 0, !0)
  34037. , c = r.getFloat32(l * i + n + 4, !0)
  34038. , d = r.getFloat32(l * i + n + 8, !0);
  34039. s.set(u, c, d, 1),
  34040. s.applyMatrix4(a),
  34041. -.5 < s.x && s.x < .5 && -.5 < s.y && s.y < .5 && -.5 < s.z && s.z < .5 && (s.set(u, c, d, 1).applyMatrix4(this.sceneNode.matrixWorld),
  34042. o.push(new Cn(s.x,s.y,s.z)))
  34043. }
  34044. return o
  34045. }
  34046. }, {
  34047. key: "name",
  34048. get: function() {
  34049. return this.geometryNode.name
  34050. }
  34051. }]),
  34052. n
  34053. }()
  34054. , Um = function() {
  34055. y(u, xm);
  34056. var l = w(u);
  34057. function u(e, t) {
  34058. var i;
  34059. O(this, u),
  34060. (i = l.call(this)).pcoGeometry = e,
  34061. i.boundingBox = i.pcoGeometry.tightBoundingBox,
  34062. i.boundingSphere = i.boundingBox.getBoundingSphere(new qn),
  34063. i.material = t || new Rm,
  34064. i.visiblePointsTarget = 2e6,
  34065. i.minimumNodePixelSize = 150,
  34066. i.level = 0,
  34067. i.position.copy(e.offset),
  34068. i.updateMatrix(),
  34069. i.nodeMaxLevel = 0,
  34070. i.maxLevel = 1 / 0,
  34071. i.temp = {
  34072. sizeFitToLevel: {},
  34073. opacity: {}
  34074. },
  34075. i.panos = [],
  34076. i.matrixAutoUpdate = !1,
  34077. i.orientationUser = 0,
  34078. i.translateUser = new Cn,
  34079. i.rotateMatrix = new ni,
  34080. i.transformMatrix = new ni,
  34081. i.transformInvMatrix = new ni,
  34082. i.rotateInvMatrix = new ni,
  34083. i.nodeMaxLevelPredict = i.predictNodeMaxLevel(),
  34084. i.testMaxNodeCount = i.testMaxNodeCount2 = 0,
  34085. i.material.spacing = i.pcoGeometry.spacing;
  34086. for (var r = "rgba", a = 0, o = ["rgba", "rgb", "intensity", "classification"]; a < o.length; a++) {
  34087. var n = function() {
  34088. var t = o[a]
  34089. , e = i.pcoGeometry.pointAttributes.attributes.find(function(e) {
  34090. return e.name === t
  34091. });
  34092. if (!e)
  34093. return "continue";
  34094. var n = "Array" === e.range[0].constructor.name ? e.range[0] : [e.range[0]]
  34095. , e = "Array" === e.range[1].constructor.name ? e.range[1] : [e.range[1]]
  34096. , n = B(Cn, Q(n))
  34097. , e = B(Cn, Q(e));
  34098. return 0 === n.distanceTo(e) ? "continue" : (r = t,
  34099. "break")
  34100. }();
  34101. if ("continue" !== n && "break" === n)
  34102. break
  34103. }
  34104. i.material.activeAttributeName = r,
  34105. i.showBoundingBox = !1,
  34106. i.boundingBoxNodes = [],
  34107. i.loadQueue = [],
  34108. i.visibleBounds = new kn,
  34109. i.visibleNodes = [],
  34110. i.visibleGeometry = [],
  34111. i.generateDEM = !1,
  34112. i.profileRequests = [],
  34113. i.name = "",
  34114. i._visible = !0;
  34115. var s = [i.pcoGeometry.tightBoundingBox, i.getBoundingBoxWorld()].find(function(e) {
  34116. return void 0 !== e
  34117. });
  34118. i.updateMatrixWorld(!0);
  34119. t = (s = Jf.computeTransformedBoundingBox(s, i.matrixWorld)).min.z,
  34120. s = s.max.z;
  34121. return i.material.heightMin = t,
  34122. i.material.heightMax = s,
  34123. i.projection = e.projection,
  34124. i.fallbackProjection = e.fallbackProjection,
  34125. i.root = i.pcoGeometry.root,
  34126. i.pcoGeometry.addEventListener("updateNodeMaxLevel", i.updateNodeMaxLevel.bind(g(i))),
  34127. i.isPointcloud = !0,
  34128. i
  34129. }
  34130. return h(u, [{
  34131. key: "updateNodeMaxLevel",
  34132. value: function(e) {
  34133. e = Math.max(e.level, this.nodeMaxLevel);
  34134. e != this.nodeMaxLevel && (this.nodeMaxLevel = e,
  34135. console.log("updateNodeMaxLevel " + this.dataset_id + " : " + this.nodeMaxLevel),
  34136. this.setPointLevel(),
  34137. Potree.settings.sizeFitToLevel || this.changePointSize())
  34138. }
  34139. }, {
  34140. key: "testMaxNodeLevel",
  34141. value: function() {
  34142. if (!this.testMaxNodeLevelDone) {
  34143. if (0 == this.nodeMaxLevel)
  34144. return !0;
  34145. if (!viewer.atDatasets.includes(this))
  34146. return !0;
  34147. var e = this.visibleNodes.map(function(e) {
  34148. return e.getLevel()
  34149. });
  34150. if (Math.max.apply(null, e) < this.maxLevel)
  34151. return !0;
  34152. e = this.maxLevel;
  34153. this.maxLevel = 12,
  34154. Potree.updatePointClouds([this], viewer.scene.getActiveCamera(), viewer.mainViewport.resolution);
  34155. this.visibleNodes.map(function(e) {
  34156. return e.getLevel()
  34157. });
  34158. return (this.maxLevel = e,
  34159. this.testMaxNodeCount++,
  34160. 500 < this.testMaxNodeCount) ? (console.log("testMaxNodeLevel次数超出,强制结束:", this.dataset_id, this.nodeMaxLevel, this.nodeMaxLevelPredict.min),
  34161. void (this.testMaxNodeLevelDone = "moreThanMaxCount")) : this.nodeMaxLevel < this.nodeMaxLevelPredict.min || (this.testMaxNodeCount2++,
  34162. this.testMaxNodeCount2 < 50 || void (this.testMaxNodeLevelDone = !0))
  34163. }
  34164. }
  34165. }, {
  34166. key: "setPointLevel",
  34167. value: function() {
  34168. var e = Potree.settings.pointDensity
  34169. , e = Potree.config.pointDensity[e];
  34170. e && (e = e.percentByUser && null != Potree.settings.UserDensityPercent ? Potree.settings.UserDensityPercent : e.maxLevelPercent,
  34171. this.maxLevel = Math.round(e * this.nodeMaxLevel),
  34172. Potree.settings.sizeFitToLevel && this.changePointSize(),
  34173. this.changePointOpacity())
  34174. }
  34175. }, {
  34176. key: "predictNodeMaxLevel",
  34177. value: function() {
  34178. var e = .005
  34179. , t = .014;
  34180. return {
  34181. min: Math.log2(this.material.spacing / t),
  34182. max: Math.log2(this.material.spacing / e)
  34183. }
  34184. }
  34185. }, {
  34186. key: "getHighestNodeSpacing",
  34187. value: function() {
  34188. return this.material.spacing / Math.pow(2, this.nodeMaxLevel)
  34189. }
  34190. }, {
  34191. key: "setName",
  34192. value: function(e) {
  34193. this.name !== e && (this.name = e,
  34194. this.dispatchEvent({
  34195. type: "name_changed",
  34196. name: e,
  34197. pointcloud: this
  34198. }))
  34199. }
  34200. }, {
  34201. key: "getName",
  34202. value: function() {
  34203. return this.name
  34204. }
  34205. }, {
  34206. key: "getAttribute",
  34207. value: function(t) {
  34208. var e = this.pcoGeometry.pointAttributes.attributes.find(function(e) {
  34209. return e.name === t
  34210. });
  34211. return e || null
  34212. }
  34213. }, {
  34214. key: "getAttributes",
  34215. value: function() {
  34216. return this.pcoGeometry.pointAttributes
  34217. }
  34218. }, {
  34219. key: "toTreeNode",
  34220. value: function(l, t) {
  34221. var u = this
  34222. , c = new Nm
  34223. , e = new gl(l.geometry,this.material);
  34224. e.name = l.name,
  34225. e.position.copy(l.boundingBox.min),
  34226. e.frustumCulled = !1,
  34227. e.onBeforeRender = function(e, t, n, i, r, a) {
  34228. var o, s;
  34229. r.program && (e.getContext().useProgram(r.program.program),
  34230. r.program.getUniforms().map.level && (o = l.getLevel(),
  34231. r.uniforms.level.value = o,
  34232. r.program.getUniforms().map.level.setValue(e.getContext(), o)),
  34233. u.visibleNodeTextureOffsets && r.program.getUniforms().map.vnStart && (s = u.visibleNodeTextureOffsets.get(c),
  34234. r.uniforms.vnStart.value = s,
  34235. r.program.getUniforms().map.vnStart.setValue(e.getContext(), s)),
  34236. r.program.getUniforms().map.pcIndex && (s = c.pcIndex || u.visibleNodes.indexOf(c),
  34237. r.uniforms.pcIndex.value = s,
  34238. r.program.getUniforms().map.pcIndex.setValue(e.getContext(), s)))
  34239. }
  34240. ,
  34241. c.geometryNode = l,
  34242. c.sceneNode = e,
  34243. c.pointcloud = this,
  34244. c.children = [];
  34245. for (var n, i = 0; i < 8; i++)
  34246. c.children[i] = l.children[i];
  34247. t ? (n = parseInt(l.name[l.name.length - 1]),
  34248. t.sceneNode.add(e),
  34249. t.children[n] = c) : (this.root = c,
  34250. this.add(e));
  34251. return l.oneTimeDisposeHandlers.push(function() {
  34252. var e = parseInt(l.name[l.name.length - 1]);
  34253. t.sceneNode.remove(c.sceneNode),
  34254. t.children[e] = l
  34255. }),
  34256. c
  34257. }
  34258. }, {
  34259. key: "buildTexMesh11",
  34260. value: function(D, i) {
  34261. var k = this
  34262. , r = Date.now();
  34263. if (this.splitSprites || ((e = new Si).name = "splitSprites_" + this.name,
  34264. e.matrixAutoUpdate = !1,
  34265. e.matrix.copy(this.matrix),
  34266. e.matrixWorld.copy(this.matrixWorld),
  34267. this.splitSprites = e,
  34268. viewer.scene.scene.add(e),
  34269. this.areaPlanes = []),
  34270. null == this.texMeshUseLevel || D.level == this.texMeshUseLevel) {
  34271. var h, e = function() {
  34272. var M = k.material.spacing / Math.pow(2, D.level);
  34273. if (3 < M)
  34274. return {
  34275. v: void 0
  34276. };
  34277. var A = 1.4 * M;
  34278. null == k.texMeshUseLevel && (k.texMeshUseLevel = D.level,
  34279. console.log("texMeshUseLevel ", D.level));
  34280. var e = D.geometry
  34281. , t = e.attributes.position.count
  34282. , n = Math.min(t, 6e3)
  34283. , t = Math.min(5e3, n);
  34284. console.warn("check points count:", n - t);
  34285. var a = e.attributes.position.array
  34286. , o = e.attributes.normal.array
  34287. , s = (new Cn(0,1,0),
  34288. new Cn,
  34289. [])
  34290. , l = []
  34291. , T = Math.pow(1.8 * M, 2)
  34292. , u = Math.cos(gn.degToRad(5))
  34293. , c = []
  34294. , S = 0
  34295. , C = 0
  34296. , P = new Si;
  34297. P.name = "sub_splitSprites_" + D.name,
  34298. P.position.copy(i.position),
  34299. P.rotation.copy(i.rotation),
  34300. k.splitSprites.add(P);
  34301. for (var d = t; d < n; d++)
  34302. !function() {
  34303. var i = new Cn(a[3 * d],a[3 * d + 1],a[3 * d + 2])
  34304. , r = new Cn(o[3 * d],o[3 * d + 1],o[3 * d + 2]);
  34305. i.nor = r,
  34306. i.index = d,
  34307. s.push(i),
  34308. l.push(r);
  34309. var t, e = c.filter(function(e) {
  34310. if (!(1e3 < e.length))
  34311. return e.some(function(e) {
  34312. var t = e.distanceToSquared(i)
  34313. , n = e.nor.dot(r);
  34314. if (t < T && u < n)
  34315. return t / T - e.nor.dot(r) < 0
  34316. })
  34317. });
  34318. 0 == e.length && (h = [],
  34319. c.push(h),
  34320. e = [h]),
  34321. 1 == e.length ? i.belongTo = e[0] : 1 < e.length && (t = [],
  34322. e.forEach(function(e) {
  34323. t.push.apply(t, Q(e));
  34324. e = c.indexOf(e);
  34325. c.splice(e, 1)
  34326. }),
  34327. c.push(t),
  34328. (i.belongTo = t).forEach(function(e) {
  34329. e.belongTo = t
  34330. })),
  34331. i.belongTo.push(i)
  34332. }();
  34333. c.forEach(function(e, n) {
  34334. if (e.length <= 6)
  34335. S += e.length;
  34336. else {
  34337. C++,
  34338. e.sort(function(e, t) {
  34339. return e.index - t.index
  34340. }),
  34341. console.log("开始解析 ".concat(D.name, " - 第").concat(n, "组,总第").concat(e[0].index, "个点,组内有").concat(e.length, "个点"));
  34342. var i = Om(e, !0);
  34343. e.forEach(function(e, t) {
  34344. t = new Jp({
  34345. text: n + "-" + t + " (" + e.index + ")" + D.name,
  34346. dontFixOrient: !0,
  34347. backgroundColor: {
  34348. r: 255 * i.color.r,
  34349. g: 255 * i.color.g,
  34350. b: 255 * i.color.b,
  34351. a: .6
  34352. }
  34353. });
  34354. t.lookAt(e.nor),
  34355. t.position.copy(e),
  34356. t.scale.set(A / 3, A / 3, A / 3),
  34357. P.add(t)
  34358. });
  34359. for (var t, r = e.reduce(function(e, t) {
  34360. return e.add(t)
  34361. }, new Cn).multiplyScalar(1 / e.length), a = [], o = e.slice(0).sort(function(e, t) {
  34362. return e.distanceToSquared(r) - t.distanceToSquared(r)
  34363. }), s = o.length, l = (t = 7 <= s ? (n = [.02, .15, .4, .55, .7, .86, .99].map(function(e) {
  34364. return Math.round(e * (s - 1))
  34365. })).map(function(e) {
  34366. return o[e]
  34367. }) : o).length, u = 0; u < l; u++)
  34368. for (var c = u + 1; c < l; c++)
  34369. for (var d = c + 1; d < l; d++) {
  34370. var h = t[u]
  34371. , p = t[c]
  34372. , f = t[d]
  34373. , h = (new Cn).subVectors(h, f)
  34374. , f = (new Cn).subVectors(p, f)
  34375. , f = h.cross(f).normalize();
  34376. a[0] && f.dot(a[0]) < 0 && f.negate(),
  34377. console.log("nor", f),
  34378. a.push(f)
  34379. }
  34380. var m = a.reduce(function(e, t) {
  34381. return e.add(t)
  34382. }, new Cn).normalize();
  34383. console.log("aveNor", m, "avePos", r, n);
  34384. var v = (new ki).setFromNormalAndCoplanarPoint(m, r)
  34385. , g = e.map(function(e) {
  34386. return v.projectPoint(e, new Cn)
  34387. })
  34388. , m = g[0].clone()
  34389. , y = Up.getQuaBetween2Vector(v.normal, new Cn(0,0,1), new Cn(0,0,1))
  34390. , w = g.map(function(e) {
  34391. return e.clone().applyQuaternion(y)
  34392. })
  34393. , b = y.clone().invert()
  34394. , x = [];
  34395. w.forEach(function(e, t) {
  34396. e.id = t;
  34397. for (var n = 0; n < t; n++)
  34398. e.distanceToSquared(w[n]) < 1.5 * T && x.push({
  34399. p1: n,
  34400. p2: t
  34401. })
  34402. }),
  34403. console.log("points count:", w.length, "lines:", x);
  34404. var E, _, e = kp({
  34405. points: w,
  34406. lines: x,
  34407. onlyGetOutRing: !0,
  34408. precision: Math.max(M / 10, .01)
  34409. });
  34410. console.log("rings:", e),
  34411. e && ((E = i.clone()).opacity = .5,
  34412. (g = w[0].clone()).z = 0,
  34413. g.applyQuaternion(b),
  34414. _ = m.clone().sub(g),
  34415. e.forEach(function(e) {
  34416. e = new Hr(Cf.getShapeGeo(e.points),E);
  34417. e.quaternion.copy(b),
  34418. e.position.copy(_),
  34419. e.name = "areaPlane_" + n,
  34420. P.add(e),
  34421. k.areaPlanes.push(e)
  34422. }))
  34423. }
  34424. }),
  34425. console.log(D.name, "中:"),
  34426. console.log("removed point count: ", S),
  34427. console.log(c),
  34428. console.log("comebine mesh Len:", C),
  34429. console.log("computeTime: " + (Date.now() - r))
  34430. }();
  34431. if ("object" === X(e))
  34432. return e.v
  34433. }
  34434. }
  34435. }, {
  34436. key: "buildTexMesh",
  34437. value: function(w, b) {
  34438. var x = this;
  34439. w.level <= 0 && function() {
  34440. var e = Date.now()
  34441. , t = new Si;
  34442. t.name = "splitSprites_" + w.name,
  34443. t.matrixAutoUpdate = !1,
  34444. t.matrix.copy(x.matrix),
  34445. t.matrixWorld.copy(x.matrixWorld),
  34446. viewer.scene.scene.add(t);
  34447. var n = new Mr
  34448. , i = x.material.spacing / Math.pow(2, w.level)
  34449. , r = 1.4 * i;
  34450. console.log("spriteWidth:", r);
  34451. var t = w.geometry
  34452. , a = t.attributes.position.count
  34453. , o = t.attributes.position.array
  34454. , s = t.attributes.normal.array
  34455. , l = new Cn(0,1,0)
  34456. , u = new Cn
  34457. , c = []
  34458. , d = []
  34459. , h = []
  34460. , p = []
  34461. , f = [new Cn(-1,1,0), new Cn(1,1,0), new Cn(-1,-1,0), new Cn(1,-1,0)]
  34462. , m = [0, 2, 1, 2, 3, 1];
  34463. f.forEach(function(e) {
  34464. return e.multiplyScalar(r / 2)
  34465. });
  34466. for (var v, g, i = [], t = 0, y = 0; y < a; y++)
  34467. g = v = void 0,
  34468. v = new Cn(o[3 * y],o[3 * y + 1],o[3 * y + 2]),
  34469. g = new Cn(s[3 * y],s[3 * y + 1],s[3 * y + 2]),
  34470. v.nor = g,
  34471. c.push(v),
  34472. d.push(g);
  34473. for (y = 0; y < a; y++)
  34474. (function() {
  34475. var e = c[y]
  34476. , t = d[y];
  34477. if (.2 < Math.abs(t.z))
  34478. return;
  34479. var n = (new ni).lookAt(t, u, l);
  34480. n.elements[12] = e.x,
  34481. n.elements[13] = e.y,
  34482. n.elements[14] = e.z,
  34483. f.forEach(function(e) {
  34484. e = e.clone();
  34485. e.applyMatrix4(n),
  34486. h.push.apply(h, Q(e.toArray()))
  34487. }),
  34488. m.forEach(function(e) {
  34489. p.push(e + 4 * y)
  34490. })
  34491. }
  34492. )();
  34493. console.log("removed count: ", t),
  34494. console.log(i),
  34495. console.log("computeTime: " + (Date.now() - e)),
  34496. n.setAttribute("position", new dr(new Float32Array(h),3)),
  34497. n.setIndex(p);
  34498. e = new Hr(n,Om("use"));
  34499. e.name = w.name,
  34500. e.position.copy(b.position),
  34501. e.rotation.copy(b.rotation),
  34502. (b.sprites = e).pointsNode = b,
  34503. 0 == w.level && ((n = new Si).name = "spriteNodeRoot",
  34504. n.matrixAutoUpdate = !1,
  34505. n.matrix.copy(x.matrix),
  34506. n.matrixWorld.copy(x.matrixWorld),
  34507. viewer.scene.scene.add(n),
  34508. x.spriteNodeRoot = n),
  34509. x.spriteNodeRoot.add(e),
  34510. viewer.setObjectLayers(e, "sceneObjects")
  34511. }()
  34512. }
  34513. }, {
  34514. key: "updateVisibleBounds",
  34515. value: function() {
  34516. for (var e = [], t = 0; t < this.visibleNodes.length; t++) {
  34517. for (var n = this.visibleNodes[t], i = !0, r = 0; r < n.children.length; r++) {
  34518. var a = n.children[r];
  34519. a instanceof Nm ? i = i && !a.sceneNode.visible : a instanceof Dm && (i = !0)
  34520. }
  34521. i && e.push(n)
  34522. }
  34523. this.visibleBounds.min = new Cn(1 / 0,1 / 0,1 / 0),
  34524. this.visibleBounds.max = new Cn(-1 / 0,-1 / 0,-1 / 0);
  34525. for (var o = 0; o < e.length; o++) {
  34526. var s = e[o];
  34527. this.visibleBounds.expandByPoint(s.getBoundingBox().min),
  34528. this.visibleBounds.expandByPoint(s.getBoundingBox().max)
  34529. }
  34530. }
  34531. }, {
  34532. key: "updateMaterial",
  34533. value: function(e, t, n, i, r) {
  34534. e.fov = n.fov * (Math.PI / 180),
  34535. e.resolution = r,
  34536. e.near = n.near,
  34537. e.far = n.far,
  34538. e.uniforms.octreeSize.value = this.pcoGeometry.boundingBox.getSize(new Cn).x
  34539. }
  34540. }, {
  34541. key: "computeVisibilityTextureData",
  34542. value: function(e, t) {
  34543. Potree.measureTimings && performance.mark("computeVisibilityTextureData-start");
  34544. var n = new Uint8Array(4 * e.length)
  34545. , i = new Map;
  34546. (e = e.slice()).sort(function(e, t) {
  34547. e = e.geometryNode.name,
  34548. t = t.geometryNode.name;
  34549. return e.length !== t.length ? e.length - t.length : e < t ? -1 : t < e ? 1 : 0
  34550. });
  34551. new Cn;
  34552. for (var r = new Map, a = new Array(e.length).fill(1 / 0), o = 0; o < e.length; o++) {
  34553. var s, l, u = e[o];
  34554. r.set(u.name, u),
  34555. i.set(u, o),
  34556. 0 < o && (s = parseInt(u.name.slice(-1)),
  34557. l = u.name.slice(0, -1),
  34558. l = r.get(l),
  34559. a[l = i.get(l)] = Math.min(a[l], o - l),
  34560. n[4 * l + 0] = n[4 * l + 0] | 1 << s,
  34561. n[4 * l + 1] = a[l] >> 8,
  34562. n[4 * l + 2] = a[l] % 256);
  34563. var u = u.geometryNode.density;
  34564. "number" == typeof u ? (u = Math.log2(u) / 2 - 1.5,
  34565. n[4 * o + 3] = 10 * (10 + u)) : n[4 * o + 3] = 100
  34566. }
  34567. return Potree.measureTimings && (performance.mark("computeVisibilityTextureData-end"),
  34568. performance.measure("render.computeVisibilityTextureData", "computeVisibilityTextureData-start", "computeVisibilityTextureData-end")),
  34569. {
  34570. data: n,
  34571. offsets: i
  34572. }
  34573. }
  34574. }, {
  34575. key: "nodeIntersectsProfile",
  34576. value: function(e, t) {
  34577. for (var n = e.boundingBox.clone().applyMatrix4(this.matrixWorld).getBoundingSphere(new qn), i = !1, r = 0; r < t.points.length - 1; r++)
  34578. var a = new Cn(t.points[r + 0].x,t.points[r + 0].y,n.center.z)
  34579. , o = new Cn(t.points[r + 1].x,t.points[r + 1].y,n.center.z)
  34580. , o = new vh(a,o).closestPointToPoint(n.center, !0, new Cn).distanceTo(n.center)
  34581. , i = i || o < n.radius + t.width;
  34582. return i
  34583. }
  34584. }, {
  34585. key: "deepestNodeAt",
  34586. value: function(e) {
  34587. for (var t = this.matrixWorld.clone().invert(), n = e.clone().applyMatrix4(t), i = this.root; ; ) {
  34588. var r, a = null, o = ue(i.children);
  34589. try {
  34590. for (o.s(); !(r = o.n()).done; ) {
  34591. var s = r.value;
  34592. void 0 !== s && s.getBoundingBox().containsPoint(n) && (a = s)
  34593. }
  34594. } catch (e) {
  34595. o.e(e)
  34596. } finally {
  34597. o.f()
  34598. }
  34599. if (!(null !== a && a instanceof Nm))
  34600. break;
  34601. i = a
  34602. }
  34603. return i
  34604. }
  34605. }, {
  34606. key: "nodesOnRay",
  34607. value: function(e, t) {
  34608. for (var n = [], i = t.clone(), r = 0; r < e.length; r++) {
  34609. var a = e[r]
  34610. , o = a.getBoundingSphere().clone().applyMatrix4(this.matrixWorld);
  34611. i.intersectsSphere(o) && n.push(a)
  34612. }
  34613. return n
  34614. }
  34615. }, {
  34616. key: "updateMatrixWorld",
  34617. value: function(e) {
  34618. !0 === this.matrixAutoUpdate && this.updateMatrix(),
  34619. !0 !== this.matrixWorldNeedsUpdate && !0 !== e || (this.parent ? this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix) : this.matrixWorld.copy(this.matrix),
  34620. this.matrixWorldNeedsUpdate = !1)
  34621. }
  34622. }, {
  34623. key: "hideDescendants",
  34624. value: function(e) {
  34625. for (var t = [], n = 0; n < e.children.length; n++) {
  34626. var i = e.children[n];
  34627. i.visible && t.push(i)
  34628. }
  34629. for (; 0 < t.length; ) {
  34630. var r = t.shift();
  34631. r.visible = !1;
  34632. for (var a = 0; a < r.children.length; a++) {
  34633. var o = r.children[a];
  34634. o.visible && t.push(o)
  34635. }
  34636. }
  34637. }
  34638. }, {
  34639. key: "moveToOrigin",
  34640. value: function() {
  34641. this.position.set(0, 0, 0),
  34642. this.updateMatrixWorld(!0);
  34643. var e = this.boundingBox
  34644. , t = this.matrixWorld
  34645. , t = Jf.computeTransformedBoundingBox(e, t);
  34646. this.position.set(0, 0, 0).sub(t.getCenter(new Cn))
  34647. }
  34648. }, {
  34649. key: "moveToGroundPlane",
  34650. value: function() {
  34651. this.updateMatrixWorld(!0);
  34652. var e = this.boundingBox
  34653. , t = this.matrixWorld
  34654. , t = Jf.computeTransformedBoundingBox(e, t);
  34655. this.position.y += -t.min.y
  34656. }
  34657. }, {
  34658. key: "getBoundingBoxWorld",
  34659. value: function() {
  34660. this.updateMatrixWorld(!0);
  34661. var e = this.boundingBox
  34662. , t = this.matrixWorld;
  34663. return Jf.computeTransformedBoundingBox(e, t)
  34664. }
  34665. }, {
  34666. key: "getPointsInProfile",
  34667. value: function(e, t, n) {
  34668. if (n) {
  34669. n = new Potree.ProfileRequest(this,e,t,n);
  34670. return this.profileRequests.push(n),
  34671. n
  34672. }
  34673. for (var i = {
  34674. segments: [],
  34675. boundingBox: new kn,
  34676. projectedBoundingBox: new ph
  34677. }, r = 0; r < e.points.length - 1; r++) {
  34678. var a = e.points[r]
  34679. , o = e.points[r + 1]
  34680. , s = this.getProfile(a, o, e.width, t);
  34681. i.segments.push({
  34682. start: a,
  34683. end: o,
  34684. points: s,
  34685. project: null
  34686. }),
  34687. i.boundingBox.expandByPoint(s.boundingBox.min),
  34688. i.boundingBox.expandByPoint(s.boundingBox.max)
  34689. }
  34690. for (var l = new Cn, u = 0; u < i.segments.length; u++) {
  34691. var c = i.segments[u]
  34692. , d = c.start
  34693. , h = c.end
  34694. , p = function(e, t, n, i) {
  34695. var r = e
  34696. , t = t
  34697. , a = n
  34698. , o = i
  34699. , i = new Cn(1,0,0)
  34700. , t = (new Cn).subVectors(t, r);
  34701. t.y = 0,
  34702. t.normalize();
  34703. var s = Math.acos(i.dot(t));
  34704. return 0 < t.z && (s = -s),
  34705. function(e) {
  34706. var t = (new ni).makeTranslation(-r.x, -o.min.y, -r.z)
  34707. , n = (new ni).makeRotationY(-s)
  34708. , i = (new ni).makeTranslation(a.x, 0, 0)
  34709. , e = e.clone();
  34710. return e.applyMatrix4(t),
  34711. e.applyMatrix4(n),
  34712. e.applyMatrix4(i),
  34713. e
  34714. }
  34715. }(d, h, l.clone(), i.boundingBox.clone());
  34716. c.project = p,
  34717. l.x += new Cn(d.x,0,d.z).distanceTo(new Cn(h.x,0,h.z)),
  34718. l.y += h.y - d.y
  34719. }
  34720. return i.projectedBoundingBox.min.x = 0,
  34721. i.projectedBoundingBox.min.y = i.boundingBox.min.y,
  34722. i.projectedBoundingBox.max.x = l.x,
  34723. i.projectedBoundingBox.max.y = i.boundingBox.max.y,
  34724. i
  34725. }
  34726. }, {
  34727. key: "getProfile",
  34728. value: function(e, t, n, i, r) {
  34729. r = new Potree.ProfileRequest(e,t,n,i,r);
  34730. this.profileRequests.push(r)
  34731. }
  34732. }, {
  34733. key: "getVisibleExtent",
  34734. value: function() {
  34735. return this.visibleBounds.applyMatrix4(this.matrixWorld)
  34736. }
  34737. }, {
  34738. key: "intersectsPoint",
  34739. value: function(e) {
  34740. if (!(this.pcoGeometry.root && this.pcoGeometry.root.geometry))
  34741. return !1;
  34742. if (void 0 === this.signedDistanceField) {
  34743. for (var t = new Float32Array(Math.pow(32, 3)).fill(1 / 0), n = this.pcoGeometry.root.geometry.attributes.position, i = this.boundingBox, r = n.count, a = 0; a < r; a += 3) {
  34744. var o = n.array[3 * a + 0]
  34745. , s = n.array[3 * a + 1]
  34746. , l = n.array[3 * a + 2];
  34747. t[parseInt(Math.min(o / i.max.x * 32, 31)) + 32 * parseInt(Math.min(s / i.max.y * 32, 31)) + 32 * parseInt(Math.min(l / i.max.z * 32, 31)) * 32] = 0
  34748. }
  34749. this.signedDistanceField = {
  34750. resolution: 32,
  34751. field: t
  34752. }
  34753. }
  34754. var u = this.signedDistanceField
  34755. , c = this.boundingBox
  34756. , d = this.matrixWorld.clone().invert()
  34757. , h = e.clone().applyMatrix4(d)
  34758. , p = u.resolution
  34759. , e = parseInt(p * (h.x / c.max.x))
  34760. , d = parseInt(p * (h.y / c.max.y))
  34761. , c = parseInt(p * (h.z / c.max.z));
  34762. return !(e < 0 || d < 0 || c < 0) && (!(p <= e || p <= d || p <= c) && 0 === u.field[e + d * p + c * p * p])
  34763. }
  34764. }, {
  34765. key: "pick",
  34766. value: function(e, t, n, i) {
  34767. var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {}
  34768. , a = e.renderer
  34769. , o = e.pRenderer;
  34770. performance.mark("pick-start");
  34771. function s(e, t) {
  34772. return null != e ? e : t
  34773. }
  34774. var l = gn.clamp(Math.round(80 * (1.1 - this.maxLevel / this.nodeMaxLevel)), 5, 100)
  34775. , u = s(r.pickWindowSize, l)
  34776. , c = (s(r.pickOutsideClipRegion, !1),
  34777. t ? t.resolution : a.getSize(new yn))
  34778. , e = Math.ceil(s(r.width, c.width))
  34779. , l = Math.ceil(s(r.height, c.height))
  34780. , t = s(r.pointSizeType, this.material.pointSizeType)
  34781. , c = s(r.pointSize, this.material.size)
  34782. , d = this.nodesOnRay(this.visibleNodes, i);
  34783. if (0 === d.length)
  34784. return null;
  34785. this.pickState || (f = new gs,
  34786. (p = new Potree.PointCloudMaterial).activeAttributeName = "indices",
  34787. h = new An(1,1,{
  34788. minFilter: Oe,
  34789. magFilter: Re,
  34790. format: et
  34791. }),
  34792. this.pickState = {
  34793. renderTarget: h,
  34794. material: p,
  34795. scene: f
  34796. });
  34797. var h = this.pickState
  34798. , p = h.material;
  34799. p.pointSizeType = t,
  34800. p.shape = Potree.PointShape.PARABOLOID,
  34801. p.uniforms.uFilterReturnNumberRange.value = this.material.uniforms.uFilterReturnNumberRange.value,
  34802. p.uniforms.uFilterNumberOfReturnsRange.value = this.material.uniforms.uFilterNumberOfReturnsRange.value,
  34803. p.uniforms.uFilterGPSTimeClipRange.value = this.material.uniforms.uFilterGPSTimeClipRange.value,
  34804. p.uniforms.uFilterPointSourceIDClipRange.value = this.material.uniforms.uFilterPointSourceIDClipRange.value,
  34805. p.activeAttributeName = "indices",
  34806. p.size = c,
  34807. p.uniforms.minSize.value = this.material.uniforms.minSize.value,
  34808. p.uniforms.maxSize.value = this.material.uniforms.maxSize.value,
  34809. p.classification = this.material.classification,
  34810. p.recomputeClassification(),
  34811. r.pickClipped ? (p.clipBoxes = this.material.clipBoxes,
  34812. p.uniforms.clipBoxes = this.material.uniforms.clipBoxes,
  34813. this.material.clipTask === Potree.ClipTask.HIGHLIGHT ? p.clipTask = Potree.ClipTask.NONE : p.clipTask = this.material.clipTask,
  34814. p.clipMethod = this.material.clipMethod) : p.clipBoxes = [],
  34815. this.updateMaterial(p, d, n, a, new yn(e,l)),
  34816. h.renderTarget.setSize(e, l);
  34817. var f = new yn(r.x,r.y)
  34818. , t = a.getContext();
  34819. t.enable(t.SCISSOR_TEST),
  34820. t.scissor(parseInt(f.x - (u - 1) / 2), parseInt(f.y - (u - 1) / 2), parseInt(u), parseInt(u)),
  34821. a.state.buffers.depth.setTest(p.depthTest),
  34822. a.state.buffers.depth.setMask(p.depthWrite),
  34823. a.state.setBlending(Z),
  34824. a.setRenderTarget(h.renderTarget),
  34825. t.clearColor(0, 0, 0, 0),
  34826. a.clear(!0, !0, !0);
  34827. c = this.material;
  34828. this.material = p,
  34829. o.renderOctree(this, d, n, h.renderTarget),
  34830. window.testScreen && (h = Potree.Utils.renderTargetToDataUrl(h.renderTarget, e, l, a),
  34831. Fm.downloadFile(h, "screenshot.jpg"),
  34832. window.testScreen = 0),
  34833. this.material = c;
  34834. function m(e, t, n) {
  34835. return Math.min(Math.max(t, e), n)
  34836. }
  34837. e = parseInt(m(f.x - (u - 1) / 2, 0, e)),
  34838. f = parseInt(m(f.y - (u - 1) / 2, 0, l)),
  34839. l = new Uint8Array(4 * (u * u));
  34840. t.readPixels(e, f, u, u, t.RGBA, t.UNSIGNED_BYTE, l),
  34841. a.setRenderTarget(null),
  34842. a.state.reset(),
  34843. a.setScissorTest(!1),
  34844. t.disable(t.SCISSOR_TEST);
  34845. for (var v = l, g = new Uint32Array(l.buffer), y = (Number.MAX_VALUE,
  34846. []), w = 0; w < u; w++)
  34847. for (var b = 0; b < u; b++) {
  34848. var x = w + b * u
  34849. , E = Math.pow(w - (u - 1) / 2, 2) + Math.pow(b - (u - 1) / 2, 2)
  34850. , _ = v[4 * x + 3];
  34851. v[4 * x + 3] = 0;
  34852. x = g[x];
  34853. 0 === _ && 0 === x || void 0 === _ || void 0 === x || (_ = {
  34854. pIndex: x,
  34855. pcIndex: _,
  34856. distanceToCenter: E
  34857. },
  34858. !r.all && 0 < y.length ? E < y[0].distanceToCenter && (y[0] = _) : y.push(_))
  34859. }
  34860. for (var M = 0, A = y; M < A.length; M++) {
  34861. var T = A[M]
  34862. , S = {};
  34863. if (!d[T.pcIndex])
  34864. return null;
  34865. var C, P = d[T.pcIndex], D = P.sceneNode, k = P.geometryNode.geometry;
  34866. for (C in k.attributes) {
  34867. var B, L, R, F, I = k.attributes[C];
  34868. "position" === C ? (B = I.array[3 * T.pIndex + 0],
  34869. L = I.array[3 * T.pIndex + 1],
  34870. R = I.array[3 * T.pIndex + 2],
  34871. (R = new Cn(B,L,R)).applyMatrix4(D.matrixWorld),
  34872. S[C] = R) : "indices" === C || (F = I.array.slice(I.itemSize * T.pIndex, I.itemSize * (T.pIndex + 1)),
  34873. I.potree && function() {
  34874. var e = I.potree
  34875. , t = e.scale
  34876. , n = e.offset;
  34877. F = F.map(function(e) {
  34878. return e / t + n
  34879. })
  34880. }(),
  34881. S[C] = F)
  34882. }
  34883. T.point = S
  34884. }
  34885. return performance.mark("pick-end"),
  34886. performance.measure("pick", "pick-start", "pick-end"),
  34887. r.all ? y.map(function(e) {
  34888. return e.point
  34889. }) : 0 === y.length ? null : y[0].point
  34890. }
  34891. }, {
  34892. key: "getFittedBoxGen",
  34893. value: regeneratorRuntime.mark(function e(t) {
  34894. var n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y;
  34895. return regeneratorRuntime.wrap(function(e) {
  34896. for (; ; )
  34897. switch (e.prev = e.next) {
  34898. case 0:
  34899. n = performance.now(),
  34900. i = new kn,
  34901. r = t.matrixWorld.clone().invert(),
  34902. a = ue(this.visibleNodes),
  34903. e.prev = 4,
  34904. a.s();
  34905. case 6:
  34906. if ((g = a.n()).done) {
  34907. e.next = 21;
  34908. break
  34909. }
  34910. if ((o = g.value).sceneNode) {
  34911. e.next = 10;
  34912. break
  34913. }
  34914. return e.abrupt("continue", 19);
  34915. case 10:
  34916. for (s = o.geometryNode.buffer,
  34917. l = s.offset("position"),
  34918. u = s.stride,
  34919. c = new DataView(s.data),
  34920. d = (new ni).multiplyMatrices(r, o.sceneNode.matrixWorld),
  34921. h = new Mn,
  34922. p = 0; p < s.numElements; p++)
  34923. f = c.getFloat32(p * u + l + 0, !0),
  34924. m = c.getFloat32(p * u + l + 4, !0),
  34925. v = c.getFloat32(p * u + l + 8, !0),
  34926. h.set(f, m, v, 1),
  34927. h.applyMatrix4(d),
  34928. -.5 < h.x && h.x < .5 && -.5 < h.y && h.y < .5 && -.5 < h.z && h.z < .5 && i.expandByPoint(h);
  34929. return void (e.next = 19);
  34930. case 19:
  34931. e.next = 6;
  34932. break;
  34933. case 21:
  34934. e.next = 26;
  34935. break;
  34936. case 23:
  34937. e.prev = 23,
  34938. e.t0 = e.catch(4),
  34939. a.e(e.t0);
  34940. case 26:
  34941. return e.prev = 26,
  34942. a.f(),
  34943. e.finish(26);
  34944. case 29:
  34945. return y = i.getCenter(new Cn).applyMatrix4(t.matrixWorld),
  34946. (g = new Si).position.copy(y),
  34947. g.scale.copy(t.scale),
  34948. g.rotation.copy(t.rotation),
  34949. y = (new Cn).subVectors(i.max, i.min),
  34950. g.scale.multiply(y),
  34951. y = performance.now() - n,
  34952. console.log("duration: ", y),
  34953. e.next = 40,
  34954. g;
  34955. case 40:
  34956. case "end":
  34957. return e.stop()
  34958. }
  34959. }, e, this, [[4, 23, 26, 29]])
  34960. })
  34961. }, {
  34962. key: "getFittedBox",
  34963. value: function(e) {
  34964. var t, n = performance.now(), i = new kn, r = e.matrixWorld.clone().invert(), a = ue(this.visibleNodes);
  34965. try {
  34966. for (a.s(); !(t = a.n()).done; ) {
  34967. var o = t.value;
  34968. if (o.sceneNode && !(o.getLevel() > 1 / 0))
  34969. for (var s = o.geometryNode.buffer, l = s.offset("position"), u = s.stride, c = new DataView(s.data), d = (new ni).multiplyMatrices(r, o.sceneNode.matrixWorld), h = new Mn, p = 0; p < s.numElements; p++) {
  34970. var f = c.getFloat32(p * u + l + 0, !0)
  34971. , m = c.getFloat32(p * u + l + 4, !0)
  34972. , v = c.getFloat32(p * u + l + 8, !0);
  34973. h.set(f, m, v, 1),
  34974. h.applyMatrix4(d),
  34975. -.5 < h.x && h.x < .5 && -.5 < h.y && h.y < .5 && -.5 < h.z && h.z < .5 && i.expandByPoint(h)
  34976. }
  34977. }
  34978. } catch (e) {
  34979. a.e(e)
  34980. } finally {
  34981. a.f()
  34982. }
  34983. var g = i.getCenter(new Cn).applyMatrix4(e.matrixWorld)
  34984. , y = new Si;
  34985. y.position.copy(g),
  34986. y.scale.copy(e.scale),
  34987. y.rotation.copy(e.rotation);
  34988. e = (new Cn).subVectors(i.max, i.min);
  34989. y.scale.multiply(e);
  34990. n = performance.now() - n;
  34991. return console.log("duration: ", n),
  34992. y
  34993. }
  34994. }, {
  34995. key: "progress",
  34996. get: function() {
  34997. return this.visibleNodes.length / this.visibleGeometry.length
  34998. }
  34999. }, {
  35000. key: "find",
  35001. value: function(e) {
  35002. var t, n = null, i = ue(e);
  35003. try {
  35004. for (i.s(); !(t = i.n()).done; )
  35005. var r = t.value
  35006. , n = "r" === r ? this.root : n.children[r]
  35007. } catch (e) {
  35008. i.e(e)
  35009. } finally {
  35010. i.f()
  35011. }
  35012. return n
  35013. }
  35014. }, {
  35015. key: "visible",
  35016. get: function() {
  35017. return this._visible
  35018. },
  35019. set: function(e) {
  35020. e !== this._visible && (this._visible = e,
  35021. this.dispatchEvent({
  35022. type: "visibility_changed",
  35023. pointcloud: this
  35024. }))
  35025. }
  35026. }, {
  35027. key: "changePointSize",
  35028. value: function(e, t) {
  35029. if (this.material.pointSizeType != am.ATTENUATED)
  35030. return e && (this.material.size = e);
  35031. var n;
  35032. null == e ? e = this.temp.pointSize : this.temp.pointSize = e,
  35033. e /= Potree.config.material.realPointSize / Potree.config.material.pointSize,
  35034. e = 6 * Math.pow(e, 1.05),
  35035. t || Potree.settings.sizeFitToLevel ? (n = this.temp.pointSize + ":" + this.maxLevel + ":" + this.nodeMaxLevel,
  35036. (t = this.temp.sizeFitToLevel[n]) ? this.material.size = t : (t = this.material.spacing / Math.pow(2, this.maxLevel),
  35037. t *= 0 < this.nodeMaxLevel ? Math.max(.1, Math.pow(this.maxLevel / this.nodeMaxLevel, 1.3)) : .1,
  35038. this.material.size = 3 * t * e,
  35039. this.temp.sizeFitToLevel[n] = this.material.size)) : this.material.size = .035 * e
  35040. }
  35041. }, {
  35042. key: "changePointOpacity",
  35043. value: function(e, t) {
  35044. var n, i, r, a;
  35045. null == e ? e = this.temp.pointOpacity : this.temp.pointOpacity = e,
  35046. 1 == e ? this.material.opacity = 1 : (n = (Potree.settings.sizeFitToLevel ? "sizeFit:" : "") + (t ? "canMoreThanOne:" : "") + this.temp.pointOpacity + ":" + this.maxLevel + ":" + this.nodeMaxLevel,
  35047. (i = this.temp.opacity[n]) ? this.material.opacity = i : (Potree.settings.sizeFitToLevel ? (r = this.material.spacing / Math.pow(1.4, this.maxLevel),
  35048. a = this.material.spacing / Math.pow(1.4, this.nodeMaxLevel),
  35049. a = Math.min(1 / r, 1 / a / 3),
  35050. this.material.opacity = r * a * e) : (r = this.material.spacing / Math.pow(1.8, this.maxLevel),
  35051. a = this.material.spacing / Math.pow(1.8, this.nodeMaxLevel),
  35052. a = Math.min(1 / r, 1 / a / 6),
  35053. this.material.opacity = r * a * e),
  35054. t || (this.material.opacity = gn.clamp(this.material.opacity, 0, .999)),
  35055. this.temp.opacity[n] = this.material.opacity))
  35056. }
  35057. }, {
  35058. key: "updateBound",
  35059. value: function() {
  35060. var e = this.pcoGeometry.tightBoundingBox.clone().applyMatrix4(this.matrixWorld);
  35061. this.bound = e
  35062. }
  35063. }, {
  35064. key: "getPanosBound",
  35065. value: function() {
  35066. var e;
  35067. 0 < this.panos.length ? (e = new Cn(1,1,1),
  35068. this.panosBound = Up.getBoundByPoints(this.panos.map(function(e) {
  35069. return e.position
  35070. }), e)) : this.panosBound = null
  35071. }
  35072. }, {
  35073. key: "getUnrotBoundPoint",
  35074. value: function(e) {
  35075. var t = this
  35076. , n = this.pcoGeometry.tightBoundingBox;
  35077. return "all" == e ? [new Cn(n.min.x,n.min.y,n.min.z), new Cn(n.max.x,n.min.y,n.min.z), new Cn(n.max.x,n.max.y,n.min.z), new Cn(n.min.x,n.max.y,n.min.z), new Cn(n.min.x,n.min.y,n.max.z), new Cn(n.max.x,n.min.y,n.max.z), new Cn(n.max.x,n.max.y,n.max.z), new Cn(n.min.x,n.max.y,n.max.z)].map(function(e) {
  35078. return e.applyMatrix4(t.matrixWorld)
  35079. }) : [new Cn(n.min.x,n.min.y,0), new Cn(n.max.x,n.min.y,0), new Cn(n.max.x,n.max.y,0), new Cn(n.min.x,n.max.y,0)].map(function(e) {
  35080. return e.applyMatrix4(t.matrixWorld)
  35081. })
  35082. }
  35083. }, {
  35084. key: "ifContainsPoint",
  35085. value: function(e) {
  35086. if (this.bound && this.bound.containsPoint(e)) {
  35087. var t = this.getUnrotBoundPoint();
  35088. return Up.isPointInArea(t, null, e)
  35089. }
  35090. }
  35091. }, {
  35092. key: "getVolume",
  35093. value: function() {
  35094. var e = this.getUnrotBoundPoint();
  35095. return Math.abs(Up.getArea(e)) * (this.bound.max.z - this.bound.min.z)
  35096. }
  35097. }]),
  35098. u
  35099. }()
  35100. , Gm = function() {
  35101. function e() {
  35102. O(this, e),
  35103. this.boundingBox = new kn,
  35104. this.numPoints = 0,
  35105. this.data = {}
  35106. }
  35107. return h(e, [{
  35108. key: "add",
  35109. value: function(e) {
  35110. var t, n = this.numPoints, i = n + e.numPoints, r = Object.keys(this.data), a = Object.keys(e.data), o = ue(new Set([].concat(Q(r), Q(a))));
  35111. try {
  35112. for (o.s(); !(t = o.n()).done; ) {
  35113. var s, l, u, c, d, h = t.value;
  35114. r.includes(h) && a.includes(h) ? ((s = new this.data[h].constructor(this.data[h].length + e.data[h].length)).set(this.data[h], 0),
  35115. s.set(e.data[h], this.data[h].length),
  35116. this.data[h] = s) : r.includes(h) && !a.includes(h) ? (l = this.data[h].length / this.numPoints,
  35117. (u = new this.data[h].constructor(l * i)).set(this.data[h], 0),
  35118. this.data[h] = u) : !r.includes(h) && a.includes(h) && (c = e.data[h].length / e.numPoints,
  35119. (d = new e.data[h].constructor(c * i)).set(e.data[h], c * n),
  35120. this.data[h] = d)
  35121. }
  35122. } catch (e) {
  35123. o.e(e)
  35124. } finally {
  35125. o.f()
  35126. }
  35127. this.numPoints = i,
  35128. this.boundingBox.union(e.boundingBox)
  35129. }
  35130. }]),
  35131. e
  35132. }()
  35133. , Hm = function() {
  35134. y(a, cl);
  35135. var r = w(a);
  35136. function a(e, t) {
  35137. O(this, a),
  35138. void 0 === t && (t = 16776960);
  35139. var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
  35140. , i = new Float32Array([e.min.x, e.min.y, e.min.z, e.max.x, e.min.y, e.min.z, e.max.x, e.min.y, e.max.z, e.min.x, e.min.y, e.max.z, e.min.x, e.max.y, e.min.z, e.max.x, e.max.y, e.min.z, e.max.x, e.max.y, e.max.z, e.min.x, e.max.y, e.max.z])
  35141. , e = new Mr;
  35142. e.setIndex(new nr(n,1)),
  35143. e.setAttribute("position", new nr(i,3));
  35144. t = new tl({
  35145. color: t
  35146. });
  35147. return r.call(this, e, t)
  35148. }
  35149. return h(a)
  35150. }();
  35151. function Vm(e, t, n) {
  35152. for (var i = [], r = [], a = new BinaryHeap(function(e) {
  35153. return 1 / e.weight
  35154. }
  35155. ), o = 0; o < e.length; o++) {
  35156. var s = e[o];
  35157. if (s.initialized()) {
  35158. s.numVisibleNodes = 0,
  35159. s.numVisiblePoints = 0,
  35160. s.deepestVisibleLevel = 0,
  35161. s.visibleNodes = [],
  35162. s.visibleGeometry = [],
  35163. t.updateMatrixWorld();
  35164. var l = new oa
  35165. , u = t.matrixWorldInverse
  35166. , c = s.matrixWorld
  35167. , d = t.clone();
  35168. d.near = Math.min(t.near, .1),
  35169. d.updateProjectionMatrix();
  35170. d = t.projectionMatrix,
  35171. u = (new ni).multiply(d).multiply(u).multiply(c);
  35172. l.setFromProjectionMatrix(u),
  35173. i.push(l);
  35174. l = t.matrixWorld,
  35175. c = c.clone().invert(),
  35176. l = (new ni).multiply(c).multiply(l),
  35177. l = (new Cn).setFromMatrixPosition(l);
  35178. r.push(l),
  35179. (s.visible || s.unvisibleReasons && 1 == s.unvisibleReasons.length && "displayMode" == s.unvisibleReasons[0].reason && null !== s.root) && a.push({
  35180. pointcloud: o,
  35181. node: s.root,
  35182. weight: Number.MAX_VALUE
  35183. }),
  35184. s.root.isTreeNode() && s.hideDescendants(s.root.sceneNode);
  35185. for (var h = 0; h < s.boundingBoxNodes.length; h++)
  35186. s.boundingBoxNodes[h].visible = !1
  35187. }
  35188. }
  35189. return {
  35190. frustums: i,
  35191. camObjPositions: r,
  35192. priorityQueue: a
  35193. }
  35194. }
  35195. function jm(r, e, t) {
  35196. var n = 0
  35197. , i = new Map(r.map(function(e) {
  35198. return [e, 0]
  35199. }))
  35200. , a = []
  35201. , o = []
  35202. , s = []
  35203. , l = 1 / 0
  35204. , u = Vm(r, e)
  35205. , c = u.frustums
  35206. , d = u.camObjPositions
  35207. , h = u.priorityQueue
  35208. , p = 0
  35209. , f = (t.x,
  35210. t.y);
  35211. Potree._pointcloudTransformVersion || (Potree._pointcloudTransformVersion = new Map);
  35212. var m, v = Potree._pointcloudTransformVersion, g = ue(r);
  35213. try {
  35214. for (g.s(); !(m = g.n()).done; ) {
  35215. var y, w = m.value;
  35216. viewer.getObjVisiByReason(w, "datasetSelection") && (w.updateMatrixWorld(),
  35217. v.has(w) ? (y = v.get(w)).transform.equals(w.matrixWorld) || (y.number++,
  35218. y.transform.copy(w.matrixWorld),
  35219. w.dispatchEvent({
  35220. type: "transformation_changed",
  35221. target: w
  35222. })) : v.set(w, {
  35223. number: 0,
  35224. transform: w.matrixWorld.clone()
  35225. }))
  35226. }
  35227. } catch (e) {
  35228. g.e(e)
  35229. } finally {
  35230. g.f()
  35231. }
  35232. for (; 0 < h.size(); ) {
  35233. var b = h.pop()
  35234. , x = b.node
  35235. , E = b.parent
  35236. , _ = r[b.pointcloud]
  35237. , M = x.getBoundingBox()
  35238. , A = c[b.pointcloud]
  35239. , T = d[b.pointcloud]
  35240. , S = A.intersectsBox(M)
  35241. , C = null == _.maxLevel ? 1 / 0 : _.maxLevel
  35242. , A = x.getLevel()
  35243. , S = S;
  35244. S = (S = (S = S && !(n + x.getNumPoints() > Potree.pointBudget)) && !(i.get(_) + x.getNumPoints() > _.pointBudget)) && A <= C;
  35245. C = _.material.clipBoxes;
  35246. if (0 < C.length) {
  35247. var P, D = 0, k = 0, B = ue(C);
  35248. try {
  35249. for (B.s(); !(P = B.n()).done; ) {
  35250. var L = P.value
  35251. , R = _.matrixWorld.clone().invert()
  35252. , F = (R.multiply(L.box.matrixWorld),
  35253. new Cn(.5,0,0).applyMatrix4(R))
  35254. , I = new Cn(-.5,0,0).applyMatrix4(R)
  35255. , O = new Cn(0,.5,0).applyMatrix4(R)
  35256. , z = new Cn(0,-.5,0).applyMatrix4(R)
  35257. , N = new Cn(0,0,.5).applyMatrix4(R)
  35258. , U = new Cn(0,0,-.5).applyMatrix4(R)
  35259. , G = (new Cn).subVectors(I, F).normalize()
  35260. , H = G.clone().multiplyScalar(-1)
  35261. , V = (new Cn).subVectors(z, O).normalize()
  35262. , j = V.clone().multiplyScalar(-1)
  35263. , W = (new Cn).subVectors(U, N).normalize()
  35264. , X = W.clone().multiplyScalar(-1)
  35265. , q = (new ki).setFromNormalAndCoplanarPoint(G, F)
  35266. , J = (new ki).setFromNormalAndCoplanarPoint(H, I)
  35267. , Y = (new ki).setFromNormalAndCoplanarPoint(V, O)
  35268. , Z = (new ki).setFromNormalAndCoplanarPoint(j, z)
  35269. , Q = (new ki).setFromNormalAndCoplanarPoint(W, N)
  35270. , K = (new ki).setFromNormalAndCoplanarPoint(X, U);
  35271. new oa(q,J,Y,Z,Q,K).intersectsBox(M) && D++,
  35272. k++
  35273. }
  35274. } catch (e) {
  35275. B.e(e)
  35276. } finally {
  35277. B.f()
  35278. }
  35279. _.material.clipTask === tm.SHOW_INSIDE ? _.material.clipMethod === nm.INSIDE_ANY && 0 < D || _.material.clipMethod === nm.INSIDE_ALL && D === k || (S = !1) : (_.material.clipTask,
  35280. tm.SHOW_OUTSIDE)
  35281. }
  35282. if (x.spacing ? l = Math.min(l, x.spacing) : x.geometryNode && x.geometryNode.spacing && (l = Math.min(l, x.geometryNode.spacing)),
  35283. n + x.getNumPoints() > Potree.pointBudget)
  35284. break;
  35285. if (S) {
  35286. n += x.getNumPoints();
  35287. S = i.get(_);
  35288. i.set(_, S + x.getNumPoints()),
  35289. _.numVisibleNodes++,
  35290. _.numVisiblePoints += x.getNumPoints(),
  35291. !x.isGeometryNode() || E && !E.isTreeNode() || (x.isLoaded() && p < 2 ? (x = _.toTreeNode(x, E),
  35292. p++) : (s.push({
  35293. pointcloud: _,
  35294. node: x
  35295. }),
  35296. o.push(x))),
  35297. x.isTreeNode() && (le.lru.touch(x.geometryNode),
  35298. x.sceneNode.visible = !0,
  35299. x.sceneNode.material = _.material,
  35300. a.push(x),
  35301. _.visibleNodes.push(x),
  35302. void 0 === x._transformVersion && (x._transformVersion = -1),
  35303. E = v.get(_),
  35304. x._transformVersion !== E.number && (x.sceneNode.updateMatrix(),
  35305. x.sceneNode.matrixWorld.multiplyMatrices(_.matrixWorld, x.sceneNode.matrix),
  35306. x._transformVersion = E.number),
  35307. _.showBoundingBox && !x.boundingBoxNode && x.getBoundingBox ? ((E = new Hm(x.getBoundingBox())).matrixAutoUpdate = !1,
  35308. _.boundingBoxNodes.push(E),
  35309. x.boundingBoxNode = E,
  35310. x.boundingBoxNode.matrix.copy(_.matrixWorld)) : _.showBoundingBox ? (x.boundingBoxNode.visible = !0,
  35311. x.boundingBoxNode.matrix.copy(_.matrixWorld)) : !_.showBoundingBox && x.boundingBoxNode && (x.boundingBoxNode.visible = !1));
  35312. for (var $ = x.getChildren(), ee = 0; ee < $.length; ee++) {
  35313. var te = $[ee]
  35314. , ne = 0;
  35315. if (e.isPerspectiveCamera) {
  35316. var ie = te.getBoundingSphere()
  35317. , re = ie.center
  35318. , ae = T.x - re.x
  35319. , oe = T.y - re.y
  35320. , re = T.z - re.z
  35321. , oe = Math.sqrt(ae * ae + oe * oe + re * re)
  35322. , re = ie.radius
  35323. , ie = e.fov * Math.PI / 180
  35324. , ie = re * (.5 * f / (Math.tan(ie / 2) * oe));
  35325. if (ie < _.minimumNodePixelSize)
  35326. continue;
  35327. ne = ie,
  35328. oe - re < 0 && (ne = Number.MAX_VALUE)
  35329. } else
  35330. re = te.getBoundingBox(),
  35331. ne = (te.getBoundingSphere().center.distanceTo(T),
  35332. re.max.clone().sub(re.min).length());
  35333. h.push({
  35334. pointcloud: b.pointcloud,
  35335. node: te,
  35336. parent: x,
  35337. weight: ne
  35338. })
  35339. }
  35340. }
  35341. }
  35342. !function() {
  35343. var e, t = ue(r.filter(function(e) {
  35344. return e.generateDEM && e.dem instanceof Potree.DEM
  35345. }));
  35346. try {
  35347. for (t.s(); !(e = t.n()).done; ) {
  35348. var n = e.value
  35349. , i = n.visibleNodes.filter(function(e) {
  35350. return e.getLevel() <= 4
  35351. });
  35352. n.dem.update(i)
  35353. }
  35354. } catch (e) {
  35355. t.e(e)
  35356. } finally {
  35357. t.f()
  35358. }
  35359. }();
  35360. for (var se = 0; se < Math.min(Potree.maxNodesLoading, s.length); se++)
  35361. s[se].node.load(s[se].pointcloud.pcoGeometry);
  35362. return {
  35363. visibleNodes: a,
  35364. numVisiblePoints: n,
  35365. lowestSpacing: l
  35366. }
  35367. }
  35368. function Wm(e, t) {
  35369. var n;
  35370. if (t === ke)
  35371. return e.REPEAT;
  35372. if (t === Be)
  35373. return e.CLAMP_TO_EDGE;
  35374. if (t === Le)
  35375. return e.MIRRORED_REPEAT;
  35376. if (t === Re)
  35377. return e.NEAREST;
  35378. if (1004 === t)
  35379. return e.NEAREST_MIPMAP_NEAREST;
  35380. if (1005 === t)
  35381. return e.NEAREST_MIPMAP_LINEAR;
  35382. if (t === Oe)
  35383. return e.LINEAR;
  35384. if (1007 === t)
  35385. return e.LINEAR_MIPMAP_NEAREST;
  35386. if (t === G)
  35387. return e.LINEAR_MIPMAP_LINEAR;
  35388. if (t === Ue)
  35389. return e.UNSIGNED_BYTE;
  35390. if (t === Je)
  35391. return e.UNSIGNED_SHORT_4_4_4_4;
  35392. if (t === Ye)
  35393. return e.UNSIGNED_SHORT_5_5_5_1;
  35394. if (t === Ze)
  35395. return e.UNSIGNED_SHORT_5_6_5;
  35396. if (t === Ge)
  35397. return e.BYTE;
  35398. if (t === He)
  35399. return e.SHORT;
  35400. if (t === Ve)
  35401. return e.UNSIGNED_SHORT;
  35402. if (t === je)
  35403. return e.INT;
  35404. if (t === We)
  35405. return e.UNSIGNED_INT;
  35406. if (t === Xe)
  35407. return e.FLOAT;
  35408. if (t === qe && null !== (n = extensions.get("OES_texture_half_float")))
  35409. return n.HALF_FLOAT_OES;
  35410. if (t === Ke)
  35411. return e.ALPHA;
  35412. if (t === $e)
  35413. return e.RGB;
  35414. if (t === et)
  35415. return e.RGBA;
  35416. if (t === tt)
  35417. return e.LUMINANCE;
  35418. if (t === nt)
  35419. return e.LUMINANCE_ALPHA;
  35420. if (t === rt)
  35421. return e.DEPTH_COMPONENT;
  35422. if (t === at)
  35423. return e.DEPTH_STENCIL;
  35424. if (t === re)
  35425. return e.FUNC_ADD;
  35426. if (t === ae)
  35427. return e.FUNC_SUBTRACT;
  35428. if (t === oe)
  35429. return e.FUNC_REVERSE_SUBTRACT;
  35430. if (t === de)
  35431. return e.ZERO;
  35432. if (t === he)
  35433. return e.ONE;
  35434. if (t === pe)
  35435. return e.SRC_COLOR;
  35436. if (t === fe)
  35437. return e.ONE_MINUS_SRC_COLOR;
  35438. if (t === me)
  35439. return e.SRC_ALPHA;
  35440. if (t === ve)
  35441. return e.ONE_MINUS_SRC_ALPHA;
  35442. if (t === ge)
  35443. return e.DST_ALPHA;
  35444. if (t === ye)
  35445. return e.ONE_MINUS_DST_ALPHA;
  35446. if (t === we)
  35447. return e.DST_COLOR;
  35448. if (t === be)
  35449. return e.ONE_MINUS_DST_COLOR;
  35450. if (t === xe)
  35451. return e.SRC_ALPHA_SATURATE;
  35452. if ((t === ht || t === RGBA_S3TC_DXT1_Format || t === ft || t === RGBA_S3TC_DXT5_Format) && null !== (n = extensions.get("WEBGL_compressed_texture_s3tc"))) {
  35453. if (t === ht)
  35454. return n.COMPRESSED_RGB_S3TC_DXT1_EXT;
  35455. if (t === pt)
  35456. return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;
  35457. if (t === ft)
  35458. return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;
  35459. if (t === mt)
  35460. return n.COMPRESSED_RGBA_S3TC_DXT5_EXT
  35461. }
  35462. if ((t === vt || t === gt || t === yt || t === wt) && null !== (n = extensions.get("WEBGL_compressed_texture_pvrtc"))) {
  35463. if (t === vt)
  35464. return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
  35465. if (t === gt)
  35466. return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
  35467. if (t === yt)
  35468. return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
  35469. if (t === wt)
  35470. return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
  35471. }
  35472. if (t === bt && null !== (n = extensions.get("WEBGL_compressed_texture_etc1")))
  35473. return n.COMPRESSED_RGB_ETC1_WEBGL;
  35474. if ((t === se || t === ce) && null !== (n = extensions.get("EXT_blend_minmax"))) {
  35475. if (t === se)
  35476. return n.MIN_EXT;
  35477. if (t === ce)
  35478. return n.MAX_EXT
  35479. }
  35480. return t === UnsignedInt248Type && null !== (n = extensions.get("WEBGL_depth_texture")) ? n.UNSIGNED_INT_24_8_WEBGL : 0
  35481. }
  35482. var Xm = {
  35483. position: {
  35484. name: "position",
  35485. location: 0
  35486. },
  35487. color: {
  35488. name: "color",
  35489. location: 1
  35490. },
  35491. rgba: {
  35492. name: "color",
  35493. location: 1
  35494. },
  35495. intensity: {
  35496. name: "intensity",
  35497. location: 2
  35498. },
  35499. classification: {
  35500. name: "classification",
  35501. location: 3
  35502. },
  35503. returnNumber: {
  35504. name: "returnNumber",
  35505. location: 4
  35506. },
  35507. "return number": {
  35508. name: "returnNumber",
  35509. location: 4
  35510. },
  35511. returns: {
  35512. name: "returnNumber",
  35513. location: 4
  35514. },
  35515. numberOfReturns: {
  35516. name: "numberOfReturns",
  35517. location: 5
  35518. },
  35519. "number of returns": {
  35520. name: "numberOfReturns",
  35521. location: 5
  35522. },
  35523. pointSourceID: {
  35524. name: "pointSourceID",
  35525. location: 6
  35526. },
  35527. "source id": {
  35528. name: "pointSourceID",
  35529. location: 6
  35530. },
  35531. "point source id": {
  35532. name: "pointSourceID",
  35533. location: 6
  35534. },
  35535. indices: {
  35536. name: "indices",
  35537. location: 7
  35538. },
  35539. normal: {
  35540. name: "normal",
  35541. location: 8
  35542. },
  35543. spacing: {
  35544. name: "spacing",
  35545. location: 9
  35546. },
  35547. "gps-time": {
  35548. name: "gpsTime",
  35549. location: 10
  35550. },
  35551. aExtra: {
  35552. name: "aExtra",
  35553. location: 11
  35554. }
  35555. }
  35556. , qm = function() {
  35557. function r(e, t, n, i) {
  35558. O(this, r),
  35559. this.gl = e,
  35560. this.name = t,
  35561. this.vsSource = n,
  35562. this.fsSource = i,
  35563. this.cache = new Map,
  35564. this.vs = null,
  35565. this.fs = null,
  35566. this.program = null,
  35567. this.uniformLocations = {},
  35568. this.attributeLocations = {},
  35569. this.uniformBlockIndices = {},
  35570. this.uniformBlocks = {},
  35571. this.uniforms = {},
  35572. this.update(n, i)
  35573. }
  35574. return h(r, [{
  35575. key: "update",
  35576. value: function(e, t) {
  35577. this.vsSource = e,
  35578. this.fsSource = t,
  35579. this.linkProgram()
  35580. }
  35581. }, {
  35582. key: "compileShader",
  35583. value: function(e, t) {
  35584. var n = this.gl;
  35585. if (n.shaderSource(e, t),
  35586. n.compileShader(e),
  35587. !n.getShaderParameter(e, n.COMPILE_STATUS)) {
  35588. e = n.getShaderInfoLog(e),
  35589. t = t.split("\n").map(function(e, t) {
  35590. return "".concat(t + 1).padEnd(5) + e
  35591. }).join("\n");
  35592. throw "could not compile shader ".concat(this.name, ": ").concat(e, ", \n").concat(t)
  35593. }
  35594. }
  35595. }, {
  35596. key: "linkProgram",
  35597. value: function() {
  35598. performance.now();
  35599. var e = this.gl;
  35600. this.uniformLocations = {},
  35601. this.attributeLocations = {},
  35602. this.uniforms = {},
  35603. e.useProgram(null);
  35604. var t = this.cache.get("".concat(this.vsSource, ", ").concat(this.fsSource));
  35605. if (t)
  35606. return this.program = t.program,
  35607. this.vs = t.vs,
  35608. this.fs = t.fs,
  35609. this.attributeLocations = t.attributeLocations,
  35610. this.uniformLocations = t.uniformLocations,
  35611. this.uniformBlocks = t.uniformBlocks,
  35612. void (this.uniforms = t.uniforms);
  35613. if (this.vs = e.createShader(e.VERTEX_SHADER),
  35614. this.fs = e.createShader(e.FRAGMENT_SHADER),
  35615. this.program = e.createProgram(),
  35616. !e.isProgram(this.program))
  35617. return viewer.dispatchEvent("webglError", {
  35618. msg: "potreeRenderer创建program失败"
  35619. }),
  35620. console.log(this.vs),
  35621. void console.log(this.fs);
  35622. for (var n = 0, i = Object.keys(Xm); n < i.length; n++) {
  35623. var r = i[n]
  35624. , a = Xm[r].location
  35625. , r = Xm[r].name;
  35626. e.bindAttribLocation(this.program, a, r)
  35627. }
  35628. this.compileShader(this.vs, this.vsSource),
  35629. this.compileShader(this.fs, this.fsSource);
  35630. var o = this.program;
  35631. if (e.attachShader(o, this.vs),
  35632. e.attachShader(o, this.fs),
  35633. e.linkProgram(o),
  35634. e.detachShader(o, this.vs),
  35635. e.detachShader(o, this.fs),
  35636. !e.getProgramParameter(o, e.LINK_STATUS)) {
  35637. var s = e.getProgramInfoLog(o);
  35638. throw "could not link program ".concat(this.name, ": ").concat(s)
  35639. }
  35640. for (var l = e.getProgramParameter(o, e.ACTIVE_ATTRIBUTES), u = 0; u < l; u++) {
  35641. var c = e.getActiveAttrib(o, u)
  35642. , d = e.getAttribLocation(o, c.name);
  35643. this.attributeLocations[c.name] = d
  35644. }
  35645. for (var h = e.getProgramParameter(o, e.ACTIVE_UNIFORMS), p = 0; p < h; p++) {
  35646. var f = e.getActiveUniform(o, p)
  35647. , m = e.getUniformLocation(o, f.name);
  35648. this.uniformLocations[f.name] = m,
  35649. this.uniforms[f.name] = {
  35650. location: m,
  35651. value: null
  35652. }
  35653. }
  35654. if ("undefined" != typeof WebGL2RenderingContext && e instanceof WebGL2RenderingContext)
  35655. for (var v = e.getProgramParameter(o, e.ACTIVE_UNIFORM_BLOCKS), g = 0; g < v; g++) {
  35656. var y = e.getActiveUniformBlockName(o, g)
  35657. , w = e.getUniformBlockIndex(o, y);
  35658. this.uniformBlockIndices[y] = w,
  35659. e.uniformBlockBinding(o, w, w);
  35660. var b = e.getActiveUniformBlockParameter(o, w, e.UNIFORM_BLOCK_DATA_SIZE)
  35661. , x = e.createBuffer();
  35662. e.bindBuffer(e.UNIFORM_BUFFER, x),
  35663. e.bufferData(e.UNIFORM_BUFFER, b, e.DYNAMIC_READ),
  35664. e.bindBufferBase(e.UNIFORM_BUFFER, w, x),
  35665. e.bindBuffer(e.UNIFORM_BUFFER, null),
  35666. this.uniformBlocks[y] = {
  35667. name: y,
  35668. index: w,
  35669. dataSize: b,
  35670. buffer: x
  35671. }
  35672. }
  35673. s = {
  35674. program: this.program,
  35675. vs: this.vs,
  35676. fs: this.fs,
  35677. attributeLocations: this.attributeLocations,
  35678. uniformLocations: this.uniformLocations,
  35679. uniforms: this.uniforms,
  35680. uniformBlocks: this.uniformBlocks
  35681. };
  35682. this.cache.set("".concat(this.vsSource, ", ").concat(this.fsSource), s);
  35683. performance.now()
  35684. }
  35685. }, {
  35686. key: "setUniformMatrix4",
  35687. value: function(e, t) {
  35688. var n = this.gl
  35689. , e = this.uniformLocations[e];
  35690. null != e && (t = new Float32Array(t.elements),
  35691. n.uniformMatrix4fv(e, !1, t))
  35692. }
  35693. }, {
  35694. key: "setUniform1f",
  35695. value: function(e, t) {
  35696. var n = this.gl
  35697. , e = this.uniforms[e];
  35698. void 0 !== e && e.value !== t && (e.value = t,
  35699. n.uniform1f(e.location, t))
  35700. }
  35701. }, {
  35702. key: "setUniformBoolean",
  35703. value: function(e, t) {
  35704. var n = this.gl
  35705. , e = this.uniforms[e];
  35706. void 0 !== e && e.value !== t && (e.value = t,
  35707. n.uniform1i(e.location, t))
  35708. }
  35709. }, {
  35710. key: "setUniformTexture",
  35711. value: function(e, t) {
  35712. var n = this.gl
  35713. , e = this.uniformLocations[e];
  35714. null != e && n.uniform1i(e, t)
  35715. }
  35716. }, {
  35717. key: "setUniform2f",
  35718. value: function(e, t) {
  35719. var n = this.gl
  35720. , e = this.uniformLocations[e];
  35721. null != e && n.uniform2f(e, t[0], t[1])
  35722. }
  35723. }, {
  35724. key: "setUniform3f",
  35725. value: function(e, t) {
  35726. var n = this.gl
  35727. , e = this.uniformLocations[e];
  35728. null != e && n.uniform3f(e, t[0], t[1], t[2])
  35729. }
  35730. }, {
  35731. key: "setUniform",
  35732. value: function(e, t) {
  35733. t.constructor === ni ? this.setUniformMatrix4(e, t) : "number" == typeof t ? this.setUniform1f(e, t) : "boolean" == typeof t ? this.setUniformBoolean(e, t) : t instanceof Jm ? this.setUniformTexture(e, t) : t instanceof Array ? 2 === t.length ? this.setUniform2f(e, t) : 3 === t.length && this.setUniform3f(e, t) : console.error("unhandled uniform type: ", e, t)
  35734. }
  35735. }, {
  35736. key: "setUniform1i",
  35737. value: function(e, t) {
  35738. var n = this.gl
  35739. , e = this.uniformLocations[e];
  35740. null != e && n.uniform1i(e, t)
  35741. }
  35742. }]),
  35743. r
  35744. }()
  35745. , Jm = function() {
  35746. function n(e, t) {
  35747. O(this, n),
  35748. this.gl = e,
  35749. this.texture = t,
  35750. this.id = e.createTexture(),
  35751. this.target = e.TEXTURE_2D,
  35752. this.version = -1,
  35753. this.update(t)
  35754. }
  35755. return h(n, [{
  35756. key: "update",
  35757. value: function() {
  35758. var e, t, n, i, r, a, o, s;
  35759. this.texture.image ? (e = this.gl,
  35760. t = this.texture,
  35761. this.version !== t.version && (this.target = e.TEXTURE_2D,
  35762. e.bindTexture(this.target, this.id),
  35763. n = Wm(e, t.format),
  35764. i = t.image.width,
  35765. r = t.image.height,
  35766. a = n,
  35767. o = Wm(e, t.type),
  35768. e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t.flipY),
  35769. e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha),
  35770. e.pixelStorei(e.UNPACK_ALIGNMENT, t.unpackAlignment),
  35771. t instanceof ia ? (s = t.image.data,
  35772. e.texParameteri(this.target, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE),
  35773. e.texParameteri(this.target, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE),
  35774. e.texParameteri(this.target, e.TEXTURE_MAG_FILTER, Wm(e, t.magFilter)),
  35775. e.texParameteri(this.target, e.TEXTURE_MIN_FILTER, Wm(e, t.minFilter)),
  35776. e.texImage2D(this.target, 0, n, i, r, 0, a, o, s)) : (t instanceof xl || t instanceof En) && (s = t.image,
  35777. e.texParameteri(this.target, e.TEXTURE_WRAP_S, Wm(e, t.wrapS)),
  35778. e.texParameteri(this.target, e.TEXTURE_WRAP_T, Wm(e, t.wrapT)),
  35779. e.texParameteri(this.target, e.TEXTURE_MAG_FILTER, Wm(e, t.magFilter)),
  35780. e.texParameteri(this.target, e.TEXTURE_MIN_FILTER, Wm(e, t.minFilter)),
  35781. e.texImage2D(this.target, 0, n, n, o, s),
  35782. t instanceof En && e.generateMipmap(e.TEXTURE_2D)),
  35783. e.bindTexture(this.target, null),
  35784. this.version = t.version)) : this.version = this.texture.version
  35785. }
  35786. }]),
  35787. n
  35788. }()
  35789. , Ym = h(function e() {
  35790. O(this, e),
  35791. this.numElements = 0,
  35792. this.vao = null,
  35793. this.vbos = new Map
  35794. })
  35795. , Zm = function() {
  35796. function t(e) {
  35797. O(this, t),
  35798. this.threeRenderer = e,
  35799. this.gl = this.threeRenderer.getContext(),
  35800. this.buffers = new Map,
  35801. this.shaders = new Map,
  35802. this.textures = new Map,
  35803. this.glTypeMapping = new Map,
  35804. this.glTypeMapping.set(Float32Array, this.gl.FLOAT),
  35805. this.glTypeMapping.set(Uint8Array, this.gl.UNSIGNED_BYTE),
  35806. this.glTypeMapping.set(Uint16Array, this.gl.UNSIGNED_SHORT),
  35807. this.toggle = 0
  35808. }
  35809. return h(t, [{
  35810. key: "deleteBuffer",
  35811. value: function(e) {
  35812. var t = this.gl
  35813. , n = this.buffers.get(e);
  35814. if (null != n) {
  35815. for (var i in e.attributes)
  35816. t.deleteBuffer(n.vbos.get(i).handle);
  35817. this.buffers.delete(e)
  35818. }
  35819. }
  35820. }, {
  35821. key: "createBuffer",
  35822. value: function(n) {
  35823. var e, i = this, t = this.gl, r = new Ym;
  35824. for (e in r.vao = t.createVertexArray(),
  35825. r.numElements = n.attributes.position.count,
  35826. t.bindVertexArray(r.vao),
  35827. n.attributes) {
  35828. var a = n.attributes[e]
  35829. , o = t.createBuffer();
  35830. t.bindBuffer(t.ARRAY_BUFFER, o),
  35831. t.bufferData(t.ARRAY_BUFFER, a.array, t.STATIC_DRAW);
  35832. var s, l = a.normalized, u = this.glTypeMapping.get(a.array.constructor);
  35833. void 0 === Xm[e] || (s = Xm[e].location,
  35834. t.vertexAttribPointer(s, a.itemSize, u, l, 0, 0),
  35835. t.enableVertexAttribArray(s)),
  35836. r.vbos.set(e, {
  35837. handle: o,
  35838. name: e,
  35839. count: a.count,
  35840. itemSize: a.itemSize,
  35841. type: n.attributes.position.array.constructor,
  35842. version: 0
  35843. })
  35844. }
  35845. return t.bindBuffer(t.ARRAY_BUFFER, null),
  35846. t.bindVertexArray(null),
  35847. n.addEventListener("dispose", function e(t) {
  35848. i.deleteBuffer(n),
  35849. n.removeEventListener("dispose", e)
  35850. }),
  35851. r
  35852. }
  35853. }, {
  35854. key: "updateBuffer",
  35855. value: function(e) {
  35856. var t, n = this.gl, i = this.buffers.get(e);
  35857. for (t in n.bindVertexArray(i.vao),
  35858. e.attributes) {
  35859. var r = e.attributes[t]
  35860. , a = r.normalized
  35861. , o = this.glTypeMapping.get(r.array.constructor)
  35862. , s = null;
  35863. i.vbos.has(t) ? (s = i.vbos.get(t).handle,
  35864. i.vbos.get(t).version = r.version) : (s = n.createBuffer(),
  35865. i.vbos.set(t, {
  35866. handle: s,
  35867. name: t,
  35868. count: r.count,
  35869. itemSize: r.itemSize,
  35870. type: e.attributes.position.array.constructor,
  35871. version: r.version
  35872. })),
  35873. n.bindBuffer(n.ARRAY_BUFFER, s),
  35874. n.bufferData(n.ARRAY_BUFFER, r.array, n.STATIC_DRAW),
  35875. void 0 === Xm[t] || (s = Xm[t].location,
  35876. n.vertexAttribPointer(s, r.itemSize, o, a, 0, 0),
  35877. n.enableVertexAttribArray(s))
  35878. }
  35879. n.bindBuffer(n.ARRAY_BUFFER, null),
  35880. n.bindVertexArray(null)
  35881. }
  35882. }, {
  35883. key: "traverse",
  35884. value: function(e) {
  35885. for (var t = [], n = [e]; 0 < n.length; ) {
  35886. var i = n.pop();
  35887. i instanceof xm ? t.push(i) : (i = i.children.filter(function(e) {
  35888. return e.visible
  35889. }),
  35890. n.push.apply(n, Q(i)))
  35891. }
  35892. return {
  35893. octrees: t
  35894. }
  35895. }
  35896. }, {
  35897. key: "renderNodes",
  35898. value: function(N, e, U, t, n, G, i) {
  35899. var H = this;
  35900. le.measureTimings && performance.mark("renderNodes-start");
  35901. var V = this.gl
  35902. , j = i.material || N.material
  35903. , W = null == i.shadowMaps ? [] : i.shadowMaps
  35904. , X = t.matrixWorldInverse;
  35905. i.viewOverride && (X = i.viewOverride);
  35906. var q, J = new ni, Y = new Float32Array(16), Z = 0, r = ue(e);
  35907. try {
  35908. for (r.s(); !(q = r.n()).done; )
  35909. (function() {
  35910. var e = q.value;
  35911. if (void 0 !== le.debug.allowedNodes && !le.debug.allowedNodes.includes(e.name))
  35912. return;
  35913. var t = e.sceneNode.matrixWorld;
  35914. J.multiplyMatrices(X, t),
  35915. U && (r = U.offsets.get(e),
  35916. G.setUniform1f("uVNStart", r));
  35917. var n = e.getLevel();
  35918. e.debug ? G.setUniform("uDebug", !0) : G.setUniform("uDebug", !1);
  35919. var i = G.uniformLocations.modelMatrix;
  35920. i && (Y.set(t.elements),
  35921. V.uniformMatrix4fv(i, !1, Y));
  35922. for (var r = G.uniformLocations.modelViewMatrix, a = 0; a < 16; a++)
  35923. Y[a] = J.elements[a];
  35924. if (V.uniformMatrix4fv(r, !1, Y),
  35925. j.clipPolygons && 0 < j.clipPolygons.length) {
  35926. var o, s = [], l = [], u = ue(j.clipPolygons);
  35927. try {
  35928. for (u.s(); !(o = u.n()).done; ) {
  35929. var c = o.value
  35930. , d = c.viewMatrix
  35931. , h = c.projMatrix.clone().multiply(d).multiply(t);
  35932. s.push(c.markers.length),
  35933. l.push(h)
  35934. }
  35935. } catch (e) {
  35936. u.e(e)
  35937. } finally {
  35938. u.f()
  35939. }
  35940. for (var r = (i = []).concat.apply(i, Q(l.map(function(e) {
  35941. return e.elements
  35942. }))), p = new Array(24 * j.clipPolygons.length), f = 0; f < j.clipPolygons.length; f++)
  35943. for (var m = j.clipPolygons[f], v = 0; v < m.markers.length; v++)
  35944. p[24 * f + (3 * v + 0)] = m.markers[v].position.x,
  35945. p[24 * f + (3 * v + 1)] = m.markers[v].position.y,
  35946. p[24 * f + (3 * v + 2)] = m.markers[v].position.z;
  35947. i = G.uniformLocations["uClipPolygonVCount[0]"];
  35948. V.uniform1iv(i, s);
  35949. i = G.uniformLocations["uClipPolygonWVP[0]"];
  35950. V.uniformMatrix4fv(i, !1, r);
  35951. r = G.uniformLocations["uClipPolygonVertices[0]"];
  35952. V.uniform3fv(r, p)
  35953. }
  35954. if (G.setUniform1f("uLevel", n),
  35955. G.setUniform1f("uNodeSpacing", e.geometryNode.estimatedSpacing),
  35956. G.setUniform1f("uPCIndex", Z),
  35957. 0 < W.length) {
  35958. var g = G.uniformLocations["uShadowMap[0]"];
  35959. G.setUniform3f("uShadowColor", j.uniforms.uShadowColor.value);
  35960. var y = new Array(W.length).fill(5).map(function(e, t) {
  35961. return e + t
  35962. });
  35963. V.uniform1iv(g, y);
  35964. for (var w = 0; w < W.length; w++) {
  35965. var b = W[w]
  35966. , x = y[w]
  35967. , b = H.threeRenderer.properties.get(b.target.texture).__webglTexture;
  35968. V.activeTexture(V["TEXTURE".concat(x)]),
  35969. V.bindTexture(V.TEXTURE_2D, b)
  35970. }
  35971. var n = W.map(function(e) {
  35972. return e.camera.matrixWorldInverse
  35973. }).map(function(e) {
  35974. return (new ni).multiplyMatrices(e, t)
  35975. })
  35976. , g = (g = []).concat.apply(g, Q(n.map(function(e) {
  35977. return e.elements
  35978. })))
  35979. , n = G.uniformLocations["uShadowWorldView[0]"];
  35980. V.uniformMatrix4fv(n, !1, g);
  35981. g = (n = []).concat.apply(n, Q(W.map(function(e) {
  35982. return e.camera.projectionMatrix.elements
  35983. }))),
  35984. n = G.uniformLocations["uShadowProj[0]"];
  35985. V.uniformMatrix4fv(n, !1, g)
  35986. }
  35987. var E = e.geometryNode.geometry;
  35988. E.attributes["gps-time"] && (E.attributes["gps-time"],
  35989. g = (A = (e = (g = N.getAttribute("gps-time")).initialRange)[1] - e[0]) / (M = (_ = g.range)[1] - _[0]),
  35990. A = -(_[0] - e[0]) / A,
  35991. g = Number.isNaN(g) ? 1 : g,
  35992. A = Number.isNaN(A) ? 0 : A,
  35993. G.setUniform1f("uGpsScale", g),
  35994. G.setUniform1f("uGpsOffset", A),
  35995. A = [((A = j.uniforms.uFilterGPSTimeClipRange.value)[0] - _[0]) / M, (A[1] - _[0]) / M],
  35996. G.setUniform2f("uFilterGPSTimeClipRange", A));
  35997. var _ = j.uniforms.uFilterReturnNumberRange.value
  35998. , M = j.uniforms.uFilterNumberOfReturnsRange.value
  35999. , A = j.uniforms.uFilterPointSourceIDClipRange.value;
  36000. G.setUniform2f("uFilterReturnNumberRange", _),
  36001. G.setUniform2f("uFilterNumberOfReturnsRange", M),
  36002. G.setUniform2f("uFilterPointSourceIDClipRange", A);
  36003. var T = null;
  36004. if (H.buffers.has(E))
  36005. for (var S in T = H.buffers.get(E),
  36006. E.attributes)
  36007. E.attributes[S].version > T.vbos.get(S).version && H.updateBuffer(E);
  36008. else
  36009. T = H.createBuffer(E),
  36010. H.buffers.set(E, T);
  36011. if (V.bindVertexArray(T.vao),
  36012. void 0 === Xm[j.activeAttributeName] && Object.keys(E.attributes).includes(j.activeAttributeName)) {
  36013. var C, P = Xm.aExtra.location;
  36014. for (C in E.attributes) {
  36015. E.attributes[C];
  36016. var D = T.vbos.get(C);
  36017. V.bindBuffer(V.ARRAY_BUFFER, D.handle),
  36018. V.disableVertexAttribArray(P)
  36019. }
  36020. var k = j.activeAttributeName
  36021. , M = E.attributes[k]
  36022. , A = T.vbos.get(k);
  36023. void 0 !== M && void 0 !== A && (B = H.glTypeMapping.get(M.array.constructor),
  36024. L = M.normalized,
  36025. V.bindBuffer(V.ARRAY_BUFFER, A.handle),
  36026. V.vertexAttribPointer(P, M.itemSize, B, L, 0, 0),
  36027. V.enableVertexAttribArray(P));
  36028. var A = N.pcoGeometry.pointAttributes.attributes.find(function(e) {
  36029. return e.name === k
  36030. })
  36031. , M = (M = j.getRange(k)) || A.range
  36032. , B = A.initialRange
  36033. , L = B[1] - B[0]
  36034. , A = M = M || [0, 1]
  36035. , M = L / (A[1] - A[0])
  36036. , L = -(A[0] - B[0]) / L
  36037. , M = Number.isNaN(M) ? 1 : M
  36038. , L = Number.isNaN(L) ? 0 : L;
  36039. G.setUniform1f("uExtraScale", M),
  36040. G.setUniform1f("uExtraOffset", L)
  36041. } else
  36042. for (var R in E.attributes) {
  36043. var F, I, O = E.attributes[R], z = T.vbos.get(R);
  36044. void 0 !== Xm[R] && (F = Xm[R].location,
  36045. I = H.glTypeMapping.get(O.array.constructor),
  36046. R = O.normalized,
  36047. V.bindBuffer(V.ARRAY_BUFFER, z.handle),
  36048. V.vertexAttribPointer(F, O.itemSize, I, R, 0, 0),
  36049. V.enableVertexAttribArray(F))
  36050. }
  36051. L = T.numElements;
  36052. V.drawArrays(V.POINTS, 0, L),
  36053. Z++
  36054. }
  36055. )()
  36056. } catch (e) {
  36057. r.e(e)
  36058. } finally {
  36059. r.f()
  36060. }
  36061. V.bindVertexArray(null),
  36062. le.measureTimings && (performance.mark("renderNodes-end"),
  36063. performance.measure("render.renderNodes", "renderNodes-start", "renderNodes-end"))
  36064. }
  36065. }, {
  36066. key: "renderOctree",
  36067. value: function(e, t, n, i) {
  36068. var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {}
  36069. , a = this.gl
  36070. , o = r.material || e.material
  36071. , s = null == r.shadowMaps ? [] : r.shadowMaps
  36072. , l = n.matrixWorldInverse
  36073. , u = n.matrixWorld;
  36074. r.viewOverride && (u = (l = r.viewOverride).clone().invert());
  36075. var c = n.projectionMatrix
  36076. , d = c.clone().invert()
  36077. , h = null
  36078. , p = null
  36079. , f = 0;
  36080. 0 <= o.pointSizeType && (o.pointSizeType !== am.ADAPTIVE && "level of detail" !== o.activeAttributeName || (g = null != r.vnTextureNodes ? r.vnTextureNodes : t,
  36081. p = e.computeVisibilityTextureData(g, n),
  36082. (y = o.visibleNodesTexture).image.data.set(p.data),
  36083. y.needsUpdate = !0)),
  36084. this.shaders.has(o) || (w = [o.vertexShader, o.fragmentShader],
  36085. b = new qm(a,"pointcloud",w[0],w[1]),
  36086. this.shaders.set(o, b));
  36087. var h = this.shaders.get(o)
  36088. , m = [o.vertexShader, o.fragmentShader]
  36089. , v = m[0]
  36090. , g = m[1]
  36091. , y = o.snapEnabled ? o.numSnapshots : 0
  36092. , w = o.clipBoxes && o.clipBoxes.length ? o.clipBoxes.length : 0
  36093. , b = r.clipSpheres && r.clipSpheres.length ? r.clipSpheres.length : 0
  36094. , m = o.clipPolygons && o.clipPolygons.length ? o.clipPolygons.length : 0
  36095. , b = ["#define num_shadowmaps ".concat(s.length), "#define num_snapshots ".concat(y), "#define num_clipboxes ".concat(w), "#define num_clipspheres ".concat(b), "#define num_clippolygons ".concat(m)];
  36096. o.usePanoMap && b.push("#define usePanoMap"),
  36097. o.useFilterByNormal && b.push("#define use_filter_by_normal"),
  36098. e.pcoGeometry.root.isLoaded() && ((x = e.pcoGeometry.root.geometry.attributes)["gps-time"] && b.push("#define clip_gps_enabled"),
  36099. x["return number"] && b.push("#define clip_return_number_enabled"),
  36100. x["number of returns"] && b.push("#define clip_number_of_returns_enabled"),
  36101. (x["source id"] || x["point source id"]) && b.push("#define clip_point_source_id_enabled"));
  36102. var m = b.join("\n")
  36103. , x = v.indexOf("#version ")
  36104. , b = g.indexOf("#version ")
  36105. , v = 0 <= x ? v.replace(/(#version .*)/, "$1\n".concat(m)) : "".concat(m, "\n").concat(v)
  36106. , g = 0 <= b ? g.replace(/(#version .*)/, "$1\n".concat(m)) : "".concat(m, "\n").concat(g);
  36107. h.update(v, g),
  36108. o.needsUpdate = !1;
  36109. for (var E = 0, _ = Object.keys(o.uniforms); E < _.length; E++) {
  36110. var M = _[E]
  36111. , A = o.uniforms[M];
  36112. "t" != A.type || (A = A.value) && "pano0Map" != M && "pano1Map" != M && (this.textures.has(A) || (M = new Jm(a,A),
  36113. this.textures.set(A, M)),
  36114. this.textures.get(A).update())
  36115. }
  36116. a.useProgram(h.program);
  36117. if ((void 0 !== r.transparent ? r.transparent && o.opacity < 1 : !o.usePanoMap && (o.useFilterByNormal || o.opacity < 1)) ? (a.enable(a.BLEND),
  36118. a.blendFunc(a.SRC_ALPHA, a.ONE),
  36119. a.depthMask(!1),
  36120. a.disable(a.DEPTH_TEST)) : (a.disable(a.BLEND),
  36121. a.depthMask(!0),
  36122. a.enable(a.DEPTH_TEST)),
  36123. void 0 !== r.blendFunc && (a.enable(a.BLEND),
  36124. a.blendFunc.apply(a, Q(r.blendFunc))),
  36125. void 0 !== r.depthTest && (!0 === r.depthTest ? a.enable(a.DEPTH_TEST) : a.disable(a.DEPTH_TEST)),
  36126. void 0 !== r.depthWrite && (!0 === r.depthWrite ? a.depthMask(!0) : a.depthMask(!1)),
  36127. h.setUniformMatrix4("projectionMatrix", c),
  36128. h.setUniformMatrix4("viewMatrix", l),
  36129. h.setUniformMatrix4("uViewInv", u),
  36130. h.setUniformMatrix4("uProjInv", d),
  36131. h.setUniform2f("resolution", o.resolution.toArray()),
  36132. h.setUniform1f("fov", Math.PI * n.fov / 180),
  36133. h.setUniform1f("near", n.near),
  36134. h.setUniform1f("far", n.far),
  36135. n instanceof ed ? (h.setUniform("uUseOrthographicCamera", !0),
  36136. h.setUniform("uOrthoWidth", n.right - n.left),
  36137. h.setUniform("uOrthoHeight", n.top - n.bottom)) : h.setUniform("uUseOrthographicCamera", !1),
  36138. o.clipBoxes.length + o.clipPolygons.length === 0 ? h.setUniform1i("clipTask", tm.NONE) : h.setUniform1i("clipTask", o.clipTask),
  36139. h.setUniform1i("clipMethod", o.clipMethod),
  36140. o.clipBoxes && 0 < o.clipBoxes.length && (d = h.uniformLocations["clipBoxes[0]"],
  36141. a.uniformMatrix4fv(d, !1, o.uniforms.clipBoxes.value)),
  36142. r.clipSpheres && 0 < r.clipSpheres.length) {
  36143. var T, S = [], C = ue(r.clipSpheres);
  36144. try {
  36145. for (C.s(); !(T = C.n()).done; ) {
  36146. var P = T.value.matrixWorld
  36147. , D = n.matrixWorld
  36148. , k = P.clone().invert()
  36149. , B = (new ni).multiplyMatrices(k, D);
  36150. S.push(B)
  36151. }
  36152. } catch (e) {
  36153. C.e(e)
  36154. } finally {
  36155. C.f()
  36156. }
  36157. var L = (R = []).concat.apply(R, Q(S.map(function(e) {
  36158. return e.elements
  36159. })))
  36160. , R = h.uniformLocations["uClipSpheres[0]"];
  36161. a.uniformMatrix4fv(R, !1, L)
  36162. }
  36163. h.setUniform1f("size", o.usePanoMap ? Potree.config.material.absolutePanoramaSize * Math.min(window.devicePixelRatio, 2) : o.size),
  36164. h.setUniform1f("maxSize", o.uniforms.maxSize.value),
  36165. h.setUniform1f("minSize", o.uniforms.minSize.value),
  36166. h.setUniform1f("uOctreeSpacing", o.spacing),
  36167. h.setUniform("uOctreeSize", o.uniforms.octreeSize.value),
  36168. h.setUniform3f("uColor", o.color.toArray()),
  36169. h.setUniform1f("uOpacity", o.usePanoMap ? 1 : o.opacity),
  36170. h.setUniform2f("elevationRange", o.elevationRange),
  36171. h.setUniform2f("intensityRange", o.intensityRange),
  36172. h.setUniform3f("uIntensity_gbc", [o.intensityGamma, o.intensityBrightness, o.intensityContrast]),
  36173. h.setUniform3f("uRGB_gbc", [o.rgbGamma, o.rgbBrightness, o.rgbContrast]),
  36174. h.setUniform1f("uTransition", o.transition),
  36175. h.setUniform1f("wRGB", o.weightRGB),
  36176. h.setUniform1f("wIntensity", o.weightIntensity),
  36177. h.setUniform1f("wElevation", o.weightElevation),
  36178. h.setUniform1f("wClassification", o.weightClassification),
  36179. h.setUniform1f("wReturnNumber", o.weightReturnNumber),
  36180. h.setUniform1f("wSourceID", o.weightSourceID),
  36181. h.setUniform("backfaceCulling", o.uniforms.backfaceCulling.value);
  36182. R = this.textures.get(o.visibleNodesTexture);
  36183. R && (h.setUniform1i("visibleNodesTexture", f),
  36184. a.activeTexture(a.TEXTURE0 + f),
  36185. a.bindTexture(R.target, R.id),
  36186. f++);
  36187. L = this.textures.get(o.gradientTexture);
  36188. h.setUniform1i("gradient", f),
  36189. a.activeTexture(a.TEXTURE0 + f),
  36190. a.bindTexture(L.target, L.id);
  36191. R = o.elevationGradientRepeat;
  36192. R === im.REPEAT ? (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.REPEAT),
  36193. a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.REPEAT)) : R === im.MIRRORED_REPEAT ? (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.MIRRORED_REPEAT),
  36194. a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.MIRRORED_REPEAT)) : (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE),
  36195. a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE)),
  36196. f++;
  36197. R = this.textures.get(o.classificationTexture);
  36198. h.setUniform1i("classificationLUT", f),
  36199. a.activeTexture(a.TEXTURE0 + f),
  36200. a.bindTexture(R.target, R.id),
  36201. f++;
  36202. L = this.textures.get(o.matcapTexture);
  36203. if (h.setUniform1i("matcapTextureUniform", f),
  36204. a.activeTexture(a.TEXTURE0 + f),
  36205. a.bindTexture(L.target, L.id),
  36206. f++,
  36207. !0 === o.snapEnabled) {
  36208. var R = h.uniformLocations["uSnapshot[0]"]
  36209. , F = h.uniformLocations["uSnapshotDepth[0]"]
  36210. , L = f
  36211. , I = new Array(5).fill(L).map(function(e, t) {
  36212. return e + t
  36213. })
  36214. , O = new Array(5).fill(1 + Math.max.apply(Math, Q(I))).map(function(e, t) {
  36215. return e + t
  36216. })
  36217. , f = 1 + Math.max.apply(Math, Q(O));
  36218. a.uniform1iv(R, I),
  36219. a.uniform1iv(F, O);
  36220. for (var z = 0; z < 5; z++) {
  36221. var N = o.uniforms.uSnapshot.value[z]
  36222. , U = o.uniforms.uSnapshotDepth.value[z];
  36223. if (!N)
  36224. break;
  36225. var G = this.threeRenderer.properties.get(N).__webglTexture
  36226. , H = this.threeRenderer.properties.get(U).__webglTexture
  36227. , N = I[z]
  36228. , U = O[z];
  36229. a.activeTexture(a["TEXTURE".concat(N)]),
  36230. a.bindTexture(a.TEXTURE_2D, G),
  36231. a.activeTexture(a["TEXTURE".concat(U)]),
  36232. a.bindTexture(a.TEXTURE_2D, H)
  36233. }
  36234. var F = (R = []).concat.apply(R, Q(o.uniforms.uSnapView.value.map(function(e) {
  36235. return e.elements
  36236. })))
  36237. , R = h.uniformLocations["uSnapView[0]"];
  36238. a.uniformMatrix4fv(R, !1, F);
  36239. var F = (R = []).concat.apply(R, Q(o.uniforms.uSnapProj.value.map(function(e) {
  36240. return e.elements
  36241. })))
  36242. , R = h.uniformLocations["uSnapProj[0]"];
  36243. a.uniformMatrix4fv(R, !1, F);
  36244. F = (R = []).concat.apply(R, Q(o.uniforms.uSnapProjInv.value.map(function(e) {
  36245. return e.elements
  36246. }))),
  36247. R = h.uniformLocations["uSnapProjInv[0]"];
  36248. a.uniformMatrix4fv(R, !1, F);
  36249. F = (R = []).concat.apply(R, Q(o.uniforms.uSnapViewInv.value.map(function(e) {
  36250. return e.elements
  36251. }))),
  36252. R = h.uniformLocations["uSnapViewInv[0]"];
  36253. a.uniformMatrix4fv(R, !1, F)
  36254. }
  36255. o.usePanoMap && (h.setUniform1f("progress", o.uniforms.progress.value),
  36256. h.setUniform1f("easeInOutRatio", o.uniforms.easeInOutRatio.value),
  36257. h.setUniform3f("pano0Position", o.uniforms.pano0Position.value.toArray()),
  36258. h.setUniform3f("pano1Position", o.uniforms.pano1Position.value.toArray()),
  36259. h.setUniform("pano0Matrix", o.uniforms.pano0Matrix.value),
  36260. h.setUniform("pano1Matrix", o.uniforms.pano1Matrix.value),
  36261. (F = o.uniforms.pano0Map.value) && (this.threeRenderer._textures.safeSetTextureCube(F, ++f),
  36262. h.setUniform1i("pano0Map", f)),
  36263. (F = o.uniforms.pano1Map.value) && (this.threeRenderer._textures.safeSetTextureCube(F, ++f),
  36264. h.setUniform1i("pano1Map", f))),
  36265. this.renderNodes(e, t, p, n, i, h, r),
  36266. a.activeTexture(a.TEXTURE2),
  36267. a.bindTexture(a.TEXTURE_2D, null),
  36268. a.activeTexture(a.TEXTURE0),
  36269. a.disable(a.BLEND),
  36270. a.depthMask(!0),
  36271. a.enable(a.DEPTH_TEST)
  36272. }
  36273. }, {
  36274. key: "render",
  36275. value: function(e, t) {
  36276. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null
  36277. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {}
  36278. , r = this.gl;
  36279. null != n && this.threeRenderer.setRenderTarget(n);
  36280. var a, o = ue(this.traverse(e).octrees);
  36281. try {
  36282. for (o.s(); !(a = o.n()).done; ) {
  36283. var s = a.value
  36284. , l = s.visibleNodes;
  36285. this.renderOctree(s, l, t, n, i)
  36286. }
  36287. } catch (e) {
  36288. o.e(e)
  36289. } finally {
  36290. o.f()
  36291. }
  36292. r.activeTexture(r.TEXTURE1),
  36293. r.bindTexture(r.TEXTURE_2D, null),
  36294. r.bindBuffer(r.ARRAY_BUFFER, null),
  36295. r.bindVertexArray(null),
  36296. this.threeRenderer.resetState()
  36297. }
  36298. }]),
  36299. t
  36300. }()
  36301. , Qm = function() {
  36302. function u(e) {
  36303. O(this, u),
  36304. this.profile = e,
  36305. this.segments = [],
  36306. this.boundingBox = new kn;
  36307. for (var t = 0; t < e.points.length - 1; t++) {
  36308. var n = e.points[t]
  36309. , i = e.points[t + 1]
  36310. , r = new Cn(n.x,n.y,0)
  36311. , a = new Cn(i.x,i.y,0)
  36312. , o = (new Cn).addVectors(a, r).multiplyScalar(.5)
  36313. , s = r.distanceTo(a)
  36314. , l = (new Cn).subVectors(a, r).normalize()
  36315. , a = new Cn(0,0,1)
  36316. , a = (new Cn).crossVectors(l, a).normalize()
  36317. , s = {
  36318. start: n,
  36319. end: i,
  36320. cutPlane: (new ki).setFromNormalAndCoplanarPoint(a, r),
  36321. halfPlane: (new ki).setFromNormalAndCoplanarPoint(l, o),
  36322. length: s,
  36323. points: new Gm
  36324. };
  36325. this.segments.push(s)
  36326. }
  36327. }
  36328. return h(u, [{
  36329. key: "size",
  36330. value: function() {
  36331. var e, t = 0, n = ue(this.segments);
  36332. try {
  36333. for (n.s(); !(e = n.n()).done; )
  36334. t += e.value.points.numPoints
  36335. } catch (e) {
  36336. n.e(e)
  36337. } finally {
  36338. n.f()
  36339. }
  36340. return t
  36341. }
  36342. }]),
  36343. u
  36344. }()
  36345. , _h = function() {
  36346. function r(e, t, n, i) {
  36347. O(this, r),
  36348. this.pointcloud = e,
  36349. this.profile = t,
  36350. this.maxDepth = n || Number.MAX_VALUE,
  36351. this.callback = i,
  36352. this.temporaryResult = new Qm(this.profile),
  36353. this.pointsServed = 0,
  36354. this.highestLevelServed = 0,
  36355. this.priorityQueue = new BinaryHeap(function(e) {
  36356. return 1 / e.weight
  36357. }
  36358. ),
  36359. this.initialize()
  36360. }
  36361. return h(r, [{
  36362. key: "initialize",
  36363. value: function() {
  36364. this.priorityQueue.push({
  36365. node: this.pointcloud.pcoGeometry.root,
  36366. weight: 1 / 0
  36367. })
  36368. }
  36369. }, {
  36370. key: "traverse",
  36371. value: function(e) {
  36372. for (var t = [], n = 0; n < 8; n++) {
  36373. var i = e.children[n];
  36374. i && this.pointcloud.nodeIntersectsProfile(i, this.profile) && t.push(i)
  36375. }
  36376. for (; 0 < t.length; ) {
  36377. var r = t.pop()
  36378. , a = r.boundingSphere.radius;
  36379. if (this.priorityQueue.push({
  36380. node: r,
  36381. weight: a
  36382. }),
  36383. r.level < this.maxDepth)
  36384. for (var o = 0; o < 8; o++) {
  36385. var s = r.children[o];
  36386. s && this.pointcloud.nodeIntersectsProfile(s, this.profile) && t.push(s)
  36387. }
  36388. }
  36389. }
  36390. }, {
  36391. key: "update",
  36392. value: function() {
  36393. this.updateGeneratorInstance || (this.updateGeneratorInstance = this.updateGenerator()),
  36394. this.updateGeneratorInstance.next().done && (this.updateGeneratorInstance = null)
  36395. }
  36396. }, {
  36397. key: "updateGenerator",
  36398. value: regeneratorRuntime.mark(function e() {
  36399. var t, n, i, r, a, o, s, l;
  36400. return regeneratorRuntime.wrap(function(e) {
  36401. for (; ; )
  36402. switch (e.prev = e.next) {
  36403. case 0:
  36404. performance.now(),
  36405. t = 1,
  36406. n = [],
  36407. i = 0;
  36408. case 4:
  36409. if (!(i < Math.min(t, this.priorityQueue.size()))) {
  36410. e.next = 13;
  36411. break
  36412. }
  36413. if (r = this.priorityQueue.pop(),
  36414. (a = r.node).level > this.maxDepth)
  36415. return e.abrupt("continue", 10);
  36416. e.next = 9;
  36417. break;
  36418. case 9:
  36419. a.loaded ? (n.push(a),
  36420. le.lru.touch(a),
  36421. this.highestLevelServed = Math.max(a.getLevel(), this.highestLevelServed),
  36422. o = a.pcoGeometry,
  36423. o = o ? o.hierarchyStepSize : 1,
  36424. (0 === a.getLevel() || a.level % o == 0 && a.hasChildren) && this.traverse(a)) : (a.load(),
  36425. this.priorityQueue.push(r));
  36426. case 10:
  36427. i++,
  36428. e.next = 4;
  36429. break;
  36430. case 13:
  36431. if (!(0 < n.length)) {
  36432. e.next = 33;
  36433. break
  36434. }
  36435. s = ue(this.getPointsInsideProfile(n, this.temporaryResult)),
  36436. e.prev = 15,
  36437. s.s();
  36438. case 17:
  36439. if ((l = s.n()).done) {
  36440. e.next = 24;
  36441. break
  36442. }
  36443. if (l.value) {
  36444. e.next = 22;
  36445. break
  36446. }
  36447. return !(e.next = 22);
  36448. case 22:
  36449. e.next = 17;
  36450. break;
  36451. case 24:
  36452. e.next = 29;
  36453. break;
  36454. case 26:
  36455. e.prev = 26,
  36456. e.t0 = e.catch(15),
  36457. s.e(e.t0);
  36458. case 29:
  36459. return e.prev = 29,
  36460. s.f(),
  36461. e.finish(29);
  36462. case 32:
  36463. 100 < this.temporaryResult.size() && (this.pointsServed += this.temporaryResult.size(),
  36464. this.callback.onProgress({
  36465. request: this,
  36466. points: this.temporaryResult
  36467. }),
  36468. this.temporaryResult = new Qm(this.profile));
  36469. case 33:
  36470. return 0 === this.priorityQueue.size() && (0 < this.temporaryResult.size() && (this.pointsServed += this.temporaryResult.size(),
  36471. this.callback.onProgress({
  36472. request: this,
  36473. points: this.temporaryResult
  36474. }),
  36475. this.temporaryResult = new Qm(this.profile)),
  36476. this.callback.onFinish({
  36477. request: this
  36478. }),
  36479. 0 <= (l = this.pointcloud.profileRequests.indexOf(this)) && this.pointcloud.profileRequests.splice(l, 1)),
  36480. e.next = 36,
  36481. !0;
  36482. case 36:
  36483. case "end":
  36484. return e.stop()
  36485. }
  36486. }, e, this, [[15, 26, 29, 32]])
  36487. })
  36488. }, {
  36489. key: "getAccepted",
  36490. value: regeneratorRuntime.mark(function e(t, n, i, r, a, o, s) {
  36491. var l, u, c, d, h, p, f, m, v, g, y;
  36492. return regeneratorRuntime.wrap(function(e) {
  36493. for (; ; )
  36494. switch (e.prev = e.next) {
  36495. case 0:
  36496. l = performance.now(),
  36497. u = new Uint32Array(t),
  36498. c = new Float64Array(t),
  36499. d = new Float32Array(3 * t),
  36500. h = 0,
  36501. p = new Cn,
  36502. f = new Cn,
  36503. m = new Float32Array(n.geometry.attributes.position.array),
  36504. v = 0;
  36505. case 9:
  36506. if (!(v < t)) {
  36507. e.next = 24;
  36508. break
  36509. }
  36510. if (p.set(m[3 * v + 0], m[3 * v + 1], m[3 * v + 2]),
  36511. p.applyMatrix4(i),
  36512. g = Math.abs(r.cutPlane.distanceToPoint(p)),
  36513. y = Math.abs(r.halfPlane.distanceToPoint(p)),
  36514. g < this.profile.width / 2 && y < r.length / 2 && (f.subVectors(p, r.start),
  36515. y = a.dot(f),
  36516. u[h] = v,
  36517. c[h] = y + s,
  36518. o.boundingBox.expandByPoint(p),
  36519. p.sub(this.pointcloud.position),
  36520. d[3 * h + 0] = p.x,
  36521. d[3 * h + 1] = p.y,
  36522. d[3 * h + 2] = p.z,
  36523. h++),
  36524. v % 1e3 != 0) {
  36525. e.next = 21;
  36526. break
  36527. }
  36528. if (4 < performance.now() - l)
  36529. return !(e.next = 20);
  36530. e.next = 21;
  36531. break;
  36532. case 20:
  36533. l = performance.now();
  36534. case 21:
  36535. v++,
  36536. e.next = 9;
  36537. break;
  36538. case 24:
  36539. return u = u.subarray(0, h),
  36540. c = c.subarray(0, h),
  36541. d = d.subarray(0, 3 * h),
  36542. e.next = 29,
  36543. [u, c, d];
  36544. case 29:
  36545. case "end":
  36546. return e.stop()
  36547. }
  36548. }, e, this)
  36549. })
  36550. }, {
  36551. key: "getPointsInsideProfile",
  36552. value: regeneratorRuntime.mark(function e(t, n) {
  36553. var i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R, F, I, O, z;
  36554. return regeneratorRuntime.wrap(function(e) {
  36555. for (; ; )
  36556. switch (e.prev = e.next) {
  36557. case 0:
  36558. i = performance.now(),
  36559. r = 0,
  36560. a = ue(n.segments),
  36561. e.prev = 4,
  36562. a.s();
  36563. case 6:
  36564. if ((d = a.n()).done) {
  36565. e.next = 86;
  36566. break
  36567. }
  36568. o = d.value,
  36569. s = ue(t),
  36570. e.prev = 9,
  36571. s.s();
  36572. case 11:
  36573. if ((h = s.n()).done) {
  36574. e.next = 75;
  36575. break
  36576. }
  36577. if (l = h.value,
  36578. u = l.numPoints,
  36579. c = l.geometry,
  36580. u) {
  36581. e.next = 17;
  36582. break
  36583. }
  36584. return e.abrupt("continue", 73);
  36585. case 17:
  36586. if (p = l.boundingBox.clone().applyMatrix4(this.pointcloud.matrixWorld),
  36587. d = p.getBoundingSphere(new qn),
  36588. h = new Cn(o.start.x,o.start.y,d.center.z),
  36589. p = new Cn(o.end.x,o.end.y,d.center.z),
  36590. p = new vh(h,p).closestPointToPoint(d.center, !0, new Cn),
  36591. p = p.distanceTo(d.center),
  36592. p < d.radius + n.profile.width) {
  36593. e.next = 26;
  36594. break
  36595. }
  36596. return e.abrupt("continue", 73);
  36597. case 26:
  36598. y = (new Cn).subVectors(o.end, o.start).setZ(0),
  36599. w = y.clone().normalize(),
  36600. f = new Gm,
  36601. g = (v = new ni).makeTranslation.apply(v, Q(l.boundingBox.min.toArray())),
  36602. y = (new ni).multiplyMatrices(this.pointcloud.matrixWorld, g),
  36603. g = v = m = null,
  36604. y = ue(this.getAccepted(u, l, y, o, w, f, r)),
  36605. e.prev = 36,
  36606. y.s();
  36607. case 38:
  36608. if ((w = y.n()).done) {
  36609. e.next = 53;
  36610. break
  36611. }
  36612. if (b = w.value) {
  36613. e.next = 47;
  36614. break
  36615. }
  36616. return performance.now(),
  36617. !(e.next = 44);
  36618. case 44:
  36619. i = performance.now(),
  36620. e.next = 51;
  36621. break;
  36622. case 47:
  36623. x = N(b, 3),
  36624. m = x[0],
  36625. v = x[1],
  36626. g = x[2];
  36627. case 51:
  36628. e.next = 38;
  36629. break;
  36630. case 53:
  36631. e.next = 58;
  36632. break;
  36633. case 55:
  36634. e.prev = 55,
  36635. e.t0 = e.catch(36),
  36636. y.e(e.t0);
  36637. case 58:
  36638. return e.prev = 58,
  36639. y.f(),
  36640. e.finish(58);
  36641. case 61:
  36642. if (4 < performance.now() - i)
  36643. return !(e.next = 65);
  36644. e.next = 66;
  36645. break;
  36646. case 65:
  36647. i = performance.now();
  36648. case 66:
  36649. f.data.position = g,
  36650. x = Object.keys(c.attributes).filter(function(e) {
  36651. return !["position", "indices"].includes(e)
  36652. }),
  36653. E = ue(x);
  36654. try {
  36655. for (E.s(); !(_ = E.n()).done; ) {
  36656. for (M = _.value,
  36657. A = c.attributes[M],
  36658. T = A.array.length / u,
  36659. parseInt(T),
  36660. S = A.array.constructor,
  36661. C = new S(T * m.length),
  36662. P = A.array,
  36663. D = C,
  36664. k = 0; k < m.length; k++)
  36665. B = m[k],
  36666. R = (L = B * T) + T,
  36667. F = P.subarray(L, R),
  36668. D.set(F, k * T);
  36669. f.data[M] = C
  36670. }
  36671. } catch (e) {
  36672. E.e(e)
  36673. } finally {
  36674. E.f()
  36675. }
  36676. f.data.mileage = v,
  36677. f.numPoints = m.length,
  36678. o.points.add(f);
  36679. case 73:
  36680. e.next = 11;
  36681. break;
  36682. case 75:
  36683. e.next = 80;
  36684. break;
  36685. case 77:
  36686. e.prev = 77,
  36687. e.t1 = e.catch(9),
  36688. s.e(e.t1);
  36689. case 80:
  36690. return e.prev = 80,
  36691. s.f(),
  36692. e.finish(80);
  36693. case 83:
  36694. r += o.length;
  36695. case 84:
  36696. e.next = 6;
  36697. break;
  36698. case 86:
  36699. e.next = 91;
  36700. break;
  36701. case 88:
  36702. e.prev = 88,
  36703. e.t2 = e.catch(4),
  36704. a.e(e.t2);
  36705. case 91:
  36706. return e.prev = 91,
  36707. a.f(),
  36708. e.finish(91);
  36709. case 94:
  36710. I = ue(n.segments);
  36711. try {
  36712. for (I.s(); !(O = I.n()).done; )
  36713. z = O.value,
  36714. n.boundingBox.union(z.points.boundingBox)
  36715. } catch (e) {
  36716. I.e(e)
  36717. } finally {
  36718. I.f()
  36719. }
  36720. return e.next = 98,
  36721. !0;
  36722. case 98:
  36723. case "end":
  36724. return e.stop()
  36725. }
  36726. }, e, this, [[4, 88, 91, 94], [9, 77, 80, 83], [36, 55, 58, 61]])
  36727. })
  36728. }, {
  36729. key: "finishLevelThenCancel",
  36730. value: function() {
  36731. this.cancelRequested || (this.maxDepth = this.highestLevelServed,
  36732. this.cancelRequested = !0)
  36733. }
  36734. }, {
  36735. key: "cancel",
  36736. value: function() {
  36737. this.callback.onCancel(),
  36738. this.priorityQueue = new BinaryHeap(function(e) {
  36739. return 1 / e.weight
  36740. }
  36741. );
  36742. var e = this.pointcloud.profileRequests.indexOf(this);
  36743. 0 <= e && this.pointcloud.profileRequests.splice(e, 1)
  36744. }
  36745. }]),
  36746. r
  36747. }()
  36748. , Km = function() {
  36749. function n(e) {
  36750. O(this, n);
  36751. var t = -1 === (this.version = e).indexOf(".") ? e.length : e.indexOf(".");
  36752. this.versionMajor = parseInt(e.substr(0, t)),
  36753. this.versionMinor = parseInt(e.substr(t + 1)),
  36754. 0 === this.versionMinor.length && (this.versionMinor = 0)
  36755. }
  36756. return h(n, [{
  36757. key: "newerThan",
  36758. value: function(e) {
  36759. e = new n(e);
  36760. return this.versionMajor > e.versionMajor || this.versionMajor === e.versionMajor && this.versionMinor > e.versionMinor
  36761. }
  36762. }, {
  36763. key: "equalOrHigher",
  36764. value: function(e) {
  36765. e = new n(e);
  36766. return this.versionMajor > e.versionMajor || this.versionMajor === e.versionMajor && this.versionMinor >= e.versionMinor
  36767. }
  36768. }, {
  36769. key: "upTo",
  36770. value: function(e) {
  36771. return !this.newerThan(e)
  36772. }
  36773. }]),
  36774. n
  36775. }()
  36776. , ch = function() {
  36777. function e() {
  36778. O(this, e),
  36779. this.workers = {}
  36780. }
  36781. return h(e, [{
  36782. key: "getWorker",
  36783. value: function(e) {
  36784. var t;
  36785. return this.workers[e] || (this.workers[e] = []),
  36786. 0 === this.workers[e].length && (t = new Worker(e),
  36787. this.workers[e].push(t)),
  36788. this.workers[e].pop()
  36789. }
  36790. }, {
  36791. key: "returnWorker",
  36792. value: function(e, t) {
  36793. this.workers[e].push(t)
  36794. }
  36795. }]),
  36796. e
  36797. }();
  36798. function $m(e) {
  36799. var t, n = e.material, i = [], r = ue(n.ranges);
  36800. try {
  36801. for (r.s(); !(t = r.n()).done; ) {
  36802. var a = N(t.value, 2)
  36803. , o = a[0]
  36804. , s = a[1];
  36805. i.push({
  36806. name: o,
  36807. value: s
  36808. })
  36809. }
  36810. } catch (e) {
  36811. r.e(e)
  36812. } finally {
  36813. r.f()
  36814. }
  36815. "number" == typeof n.elevationRange[0] && i.push({
  36816. name: "elevationRange",
  36817. value: n.elevationRange
  36818. }),
  36819. "number" == typeof n.intensityRange[0] && i.push({
  36820. name: "intensityRange",
  36821. value: n.intensityRange
  36822. });
  36823. var l = Object.entries(Potree.PointSizeType).find(function(e) {
  36824. return e[1] === n.pointSizeType
  36825. })[0]
  36826. , l = {
  36827. activeAttributeName: n.activeAttributeName,
  36828. ranges: i,
  36829. size: n.size,
  36830. minSize: n.minSize,
  36831. pointSizeType: l,
  36832. matcap: n.matcap
  36833. };
  36834. return {
  36835. name: e.name,
  36836. url: e.pcoGeometry.url,
  36837. position: e.position.toArray(),
  36838. rotation: e.rotation.toArray(),
  36839. scale: e.scale.toArray(),
  36840. material: l
  36841. }
  36842. }
  36843. function ev(e) {
  36844. return {
  36845. uuid: e.uuid,
  36846. name: e.name,
  36847. points: e.points.map(function(e) {
  36848. return e.toArray()
  36849. }),
  36850. height: e.height,
  36851. width: e.width
  36852. }
  36853. }
  36854. function tv(e) {
  36855. return {
  36856. uuid: e.uuid,
  36857. type: e.constructor.name,
  36858. name: e.name,
  36859. position: e.position.toArray(),
  36860. rotation: e.rotation.toArray(),
  36861. scale: e.scale.toArray(),
  36862. visible: e.visible,
  36863. clip: e.clip
  36864. }
  36865. }
  36866. function nv(e) {
  36867. var t = e.controlPoints.map(function(e) {
  36868. return {
  36869. position: e.position.toArray(),
  36870. target: e.target.toArray()
  36871. }
  36872. });
  36873. return {
  36874. uuid: e.uuid,
  36875. name: e.name,
  36876. duration: e.duration,
  36877. t: e.t,
  36878. curveType: e.curveType,
  36879. visible: e.visible,
  36880. controlPoints: t
  36881. }
  36882. }
  36883. function iv(e) {
  36884. return {
  36885. uuid: e.uuid,
  36886. name: e.name,
  36887. measureType: e.measureType,
  36888. points: e.points.map(function(e) {
  36889. return e.toArray()
  36890. })
  36891. }
  36892. }
  36893. function rv(e) {
  36894. return {
  36895. cameraParamsPath: e.cameraParamsPath,
  36896. imageParamsPath: e.imageParamsPath
  36897. }
  36898. }
  36899. function av(e) {
  36900. return {
  36901. path: e.path
  36902. }
  36903. }
  36904. function ov(e) {
  36905. var i = new Map;
  36906. e.scene.annotations.traverseDescendants(function(e) {
  36907. var t, n = (n = {
  36908. uuid: (t = e).uuid,
  36909. title: t.title.toString(),
  36910. description: t.description,
  36911. position: t.position.toArray(),
  36912. offset: t.offset.toArray(),
  36913. children: []
  36914. },
  36915. t.cameraPosition && (n.cameraPosition = t.cameraPosition.toArray()),
  36916. t.cameraTarget && (n.cameraTarget = t.cameraTarget.toArray()),
  36917. void 0 !== t.radius && (n.radius = t.radius),
  36918. n);
  36919. i.set(e, n)
  36920. });
  36921. var t, n = ue(i);
  36922. try {
  36923. for (n.s(); !(t = n.n()).done; ) {
  36924. var r, a = N(t.value, 2), o = a[0], s = a[1], l = ue(o.children);
  36925. try {
  36926. for (l.s(); !(r = l.n()).done; ) {
  36927. var u = r.value
  36928. , c = i.get(u);
  36929. s.children.push(c)
  36930. }
  36931. } catch (e) {
  36932. l.e(e)
  36933. } finally {
  36934. l.f()
  36935. }
  36936. }
  36937. } catch (e) {
  36938. n.e(e)
  36939. } finally {
  36940. n.f()
  36941. }
  36942. return e.scene.annotations.children.map(function(e) {
  36943. return i.get(e)
  36944. })
  36945. }
  36946. function sv(e) {
  36947. return (lv = lv || {
  36948. position: Sf.createFatLineMat({
  36949. color: yv,
  36950. lineWidth: 3
  36951. }),
  36952. target: Sf.createFatLineMat({
  36953. color: wv,
  36954. lineWidth: 3
  36955. }),
  36956. frustum: Sf.createFatLineMat({
  36957. color: yv,
  36958. lineWidth: 2
  36959. }),
  36960. aimAtTarget: new tl({
  36961. color: wv
  36962. })
  36963. })[e]
  36964. }
  36965. var lv, uv = function() {
  36966. y(a, hn);
  36967. var r = w(a);
  36968. function a(e, t) {
  36969. var n;
  36970. O(this, a),
  36971. (n = r.call(this)).position = e,
  36972. n.color = "#" + new Yi(t).getHexString(),
  36973. n.svg = n.create(),
  36974. n.visible_ = !0;
  36975. function i() {
  36976. n.update()
  36977. }
  36978. return viewer.addEventListener("camera_changed", i),
  36979. n.addEventListener("dispose", function() {
  36980. viewer.removeEventListener("camera_changed", i)
  36981. }),
  36982. n
  36983. }
  36984. return h(a, [{
  36985. key: "create",
  36986. value: function() {
  36987. var o = this
  36988. , e = "http://www.w3.org/2000/svg"
  36989. , t = document.createElementNS(e, "svg");
  36990. t.setAttribute("width", "2em"),
  36991. t.setAttribute("height", "2em"),
  36992. t.setAttribute("position", "absolute"),
  36993. t.style.left = "50px",
  36994. t.style.top = "50px",
  36995. t.style.position = "absolute",
  36996. t.style.zIndex = "10000",
  36997. t.style.cursor = "grab",
  36998. t.style.transform = "translate(-50%,-50%)";
  36999. e = document.createElementNS(e, "circle");
  37000. e.setAttributeNS(null, "cx", "1em"),
  37001. e.setAttributeNS(null, "cy", "1em"),
  37002. e.setAttributeNS(null, "r", "0.5em"),
  37003. e.setAttributeNS(null, "style", "fill: " + this.color + "; stroke: black; stroke-width: 0.2em;"),
  37004. t.appendChild(e),
  37005. viewer.renderer.domElement.parentElement.appendChild(t);
  37006. function n(e) {
  37007. o.selectedElement = t,
  37008. document.addEventListener("mousemove", r)
  37009. }
  37010. function i(e) {
  37011. o.selectedElement = null,
  37012. document.removeEventListener("mousemove", r)
  37013. }
  37014. var r = function(e) {
  37015. var t, n, i, r, a;
  37016. o.selectedElement && (e.preventDefault(),
  37017. a = viewer.renderer.domElement.getBoundingClientRect(),
  37018. t = e.clientX - a.x,
  37019. n = e.clientY - a.y,
  37020. i = (r = viewer.renderer.getSize(new yn)).width,
  37021. e = r.height,
  37022. a = viewer.scene.getActiveCamera(),
  37023. (r = o.position.clone().project(a)).x = (t / i - .5) / .5,
  37024. r.y = (-(n - e) / e - .5) / .5,
  37025. a = r.clone().unproject(a),
  37026. o.position.set(a.x, a.y, a.z),
  37027. o.update(),
  37028. o.dispatchEvent({
  37029. type: "dragged",
  37030. position: o.position
  37031. }))
  37032. };
  37033. return t.addEventListener("mousedown", n),
  37034. t.addEventListener("mouseup", i),
  37035. t.style.display = this.visible ? "" : "none",
  37036. this.addEventListener("dispose", function() {
  37037. t.removeEventListener("mousedown", n),
  37038. t.removeEventListener("mouseup", i)
  37039. }),
  37040. t
  37041. }
  37042. }, {
  37043. key: "visible",
  37044. get: function() {
  37045. return this.visible_
  37046. },
  37047. set: function(e) {
  37048. (this.visible_ = e) ? this.update() : this.svg.style.display = "none"
  37049. }
  37050. }, {
  37051. key: "update",
  37052. value: function() {
  37053. if (this.visible) {
  37054. var e = viewer.scene.getActiveCamera()
  37055. , e = Potree.Utils.getPos2d(this.position, e, viewer.renderArea, viewer.mainViewport);
  37056. if (!e.trueSide)
  37057. return this.svg.style.display = "none";
  37058. this.svg.style.left = e.posInViewport.x,
  37059. this.svg.style.top = e.posInViewport.y,
  37060. this.svg.style.display = ""
  37061. }
  37062. }
  37063. }, {
  37064. key: "dispose",
  37065. value: function() {
  37066. this.svg.remove(),
  37067. this.dispatchEvent("dispose")
  37068. }
  37069. }]),
  37070. a
  37071. }(), cv = (new ua(1,1),
  37072. function() {
  37073. y(r, qp);
  37074. var i = w(r);
  37075. function r(e) {
  37076. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
  37077. return O(this, r),
  37078. n.sizeInfo = {
  37079. width2d: 60
  37080. },
  37081. (t = i.call(this, n)).position.copy(e),
  37082. t.dragStyle = n.dragStyle || "default",
  37083. t.bindEvent(),
  37084. t
  37085. }
  37086. return h(r, [{
  37087. key: "bindEvent",
  37088. value: function() {
  37089. var r, a, o = this;
  37090. this.addEventListener("drag", function(e) {
  37091. var t, n, i = viewer.scene.getActiveCamera();
  37092. r ? (t = (new yn).subVectors(e.pointer, a),
  37093. (n = r.clone()).x += t.x,
  37094. n.y += t.y,
  37095. n = n.clone().unproject(i),
  37096. o.position.set(n.x, n.y, n.z)) : (r = o.position.clone().project(i),
  37097. a = e.pointer.clone()),
  37098. o.update(),
  37099. o.dispatchEvent({
  37100. type: "dragged",
  37101. position: o.position
  37102. })
  37103. }),
  37104. this.addEventListener("drop", function(e) {
  37105. a = r = null
  37106. }),
  37107. this.addEventListener("mouseover", function(e) {
  37108. viewer.dispatchEvent({
  37109. type: "CursorChange",
  37110. action: "add",
  37111. name: "markerMove"
  37112. })
  37113. }),
  37114. this.addEventListener("mouseleave", function(e) {
  37115. viewer.dispatchEvent({
  37116. type: "CursorChange",
  37117. action: "remove",
  37118. name: "markerMove"
  37119. })
  37120. })
  37121. }
  37122. }]),
  37123. r
  37124. }()), dv = new Hr(new Tu(.08,.08,3,2),new $i({
  37125. color: "#f88"
  37126. })), hv = function() {
  37127. y(u, Si);
  37128. var l = w(u);
  37129. function u(e, t, n, i) {
  37130. var r, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {};
  37131. O(this, u),
  37132. (r = l.call(this)).curve = new Bc(e,!1,"centripetal"),
  37133. r.name = i || "curveNode",
  37134. r.handleMat = a.handleMat,
  37135. r.lineMat = t,
  37136. r.createPath(),
  37137. r.color = n,
  37138. r.handles = [],
  37139. r.wholeLength = 0,
  37140. r.viewports = a.viewports || [viewer.mainViewport];
  37141. for (var o = 0, s = r.points.length; o < s; o++)
  37142. r.handles.push(r.createHandle(r.points[o]));
  37143. return r.visible_ = !0,
  37144. Potree.settings.isTest && (r.spheres = new Si,
  37145. r.add(r.spheres)),
  37146. r.updatePath(),
  37147. r
  37148. }
  37149. return h(u, [{
  37150. key: "addPoint",
  37151. value: function(e, t, n) {
  37152. var i = this.points.length;
  37153. null == t && (t = i);
  37154. var r = this.createHandle(e);
  37155. this.handles = [].concat(Q(this.handles.slice(0, t)), [r], Q(this.handles.slice(t, i))),
  37156. this.points = [].concat(Q(this.points.slice(0, t)), [e], Q(this.points.slice(t, i))),
  37157. n && (this.updatePath(),
  37158. this.updateHandle(t))
  37159. }
  37160. }, {
  37161. key: "removePoint",
  37162. value: function(e) {
  37163. this.handles[e].dispose(),
  37164. this.handles.splice(e, 1),
  37165. this.points.splice(e, 1),
  37166. this.updatePath()
  37167. }
  37168. }, {
  37169. key: "createPath",
  37170. value: function() {
  37171. var e = Sf.createFatLine([], this.lineMat);
  37172. this.line = e,
  37173. this.add(e)
  37174. }
  37175. }, {
  37176. key: "updatePath",
  37177. value: function() {
  37178. var n = this;
  37179. this.curve.needsUpdate = !0;
  37180. var e = this.points.length;
  37181. if (this.wholeLength = this.points.reduce(function(e, t, n, i) {
  37182. return 0 == n ? 0 : e + t.distanceTo(i[n - 1])
  37183. }, 0),
  37184. 1 < e) {
  37185. var t = gn.clamp(Math.ceil(5 * this.wholeLength), 30, 500)
  37186. , t = this.curve.getSpacedPoints(t);
  37187. if (this.needsPercent) {
  37188. this.pointsPercent = [0];
  37189. for (var i = [0], r = 0, a = t[0], o = 1; o < e; o++) {
  37190. var s = this.points[o];
  37191. r += s.distanceTo(a),
  37192. a = s,
  37193. i.push(r)
  37194. }
  37195. for (var l = 1; l < e; l++)
  37196. this.pointsPercent.push(0 == r ? l / e : i[l] / r)
  37197. }
  37198. Potree.settings.isTest && (this.spheres.children.forEach(function(e) {
  37199. return e.visible = !1
  37200. }),
  37201. t.forEach(function(e, t) {
  37202. t = n.spheres.children[t];
  37203. t || (t = dv.clone(),
  37204. n.spheres.add(t)),
  37205. t.position.copy(e),
  37206. t.visible = !0
  37207. }))
  37208. } else
  37209. t = [];
  37210. Sf.updateLine(this.line, t),
  37211. this.dispatchEvent("updatePath")
  37212. }
  37213. }, {
  37214. key: "createHandle",
  37215. value: function(e) {
  37216. var n, i = this;
  37217. return this.handleMat ? (n = new cv(e,{
  37218. mat: this.handleMat,
  37219. viewports: this.viewports
  37220. }),
  37221. this.add(n)) : n = new uv(e,this.color),
  37222. n.visible = this.visible,
  37223. n.addEventListener("dragged", function(e) {
  37224. var t = i.handles.indexOf(n);
  37225. i.points[t].copy(e.position),
  37226. i.updatePath(),
  37227. i.dispatchEvent({
  37228. type: "dragCurvePoint",
  37229. index: t
  37230. })
  37231. }),
  37232. n
  37233. }
  37234. }, {
  37235. key: "updateHandle",
  37236. value: function(e) {
  37237. this.visible && this.handles[e].update()
  37238. }
  37239. }, {
  37240. key: "updateHandles",
  37241. value: function() {
  37242. var n = this;
  37243. this.handles.forEach(function(e, t) {
  37244. n.updateHandle(t)
  37245. })
  37246. }
  37247. }, {
  37248. key: "update",
  37249. value: function() {
  37250. this.updateHandles(),
  37251. this.updatePath()
  37252. }
  37253. }, {
  37254. key: "visible",
  37255. get: function() {
  37256. return this.visible_
  37257. },
  37258. set: function(t) {
  37259. t != this.visible_ && (this.visible_ = t,
  37260. this.visible = t,
  37261. this.handles && (this.handles.forEach(function(e) {
  37262. return e.visible = t
  37263. }),
  37264. t && this.updateHandles()))
  37265. }
  37266. }, {
  37267. key: "points",
  37268. get: function() {
  37269. return this.curve.points
  37270. },
  37271. set: function(e) {
  37272. this.curve.points = e
  37273. }
  37274. }, {
  37275. key: "getPointAt",
  37276. value: function(e) {
  37277. return this.curve.getPointAt(e)
  37278. }
  37279. }, {
  37280. key: "getSpacedPoints",
  37281. value: function(e) {
  37282. return this.curve.getSpacedPoints(e)
  37283. }
  37284. }, {
  37285. key: "dispose",
  37286. value: function() {
  37287. this.parent && this.parent.remove(this),
  37288. this.handles.forEach(function(e) {
  37289. return e.dispose()
  37290. }),
  37291. this.line.geometry && this.line.geometry.dispose()
  37292. }
  37293. }]),
  37294. u
  37295. }(), pv = {
  37296. getEaseOut: function(r) {
  37297. var e = (r = Math.round(r)) < 2 ? (r = Math.PI / 2,
  37298. pv.easeOutSine) : function(e, t, n, i) {
  37299. return 2 < r && console.log(r),
  37300. -n / Math.pow(-i, r) * Math.pow(e - i, r) + n
  37301. }
  37302. ;
  37303. return {
  37304. k: r,
  37305. easeFun: e
  37306. }
  37307. },
  37308. linearTween: function(e, t, n, i) {
  37309. return n * e / i + t
  37310. },
  37311. easeInQuad: function(e, t, n, i) {
  37312. return n * (e /= i) * e + t
  37313. },
  37314. easeOutQuad: function(e, t, n, i) {
  37315. return -n * (e /= i) * (e - 2) + t
  37316. },
  37317. easeInOutQuad: function(e, t, n, i) {
  37318. return (e /= i / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t
  37319. },
  37320. easeInCubic: function(e, t, n, i) {
  37321. return n * (e /= i) * e * e + t
  37322. },
  37323. easeOutCubic: function(e, t, n, i) {
  37324. return e /= i,
  37325. n * (--e * e * e + 1) + t
  37326. },
  37327. easeInOutCubic: function(e, t, n, i) {
  37328. return (e /= i / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t
  37329. },
  37330. easeInQuart: function(e, t, n, i) {
  37331. return n * (e /= i) * e * e * e + t
  37332. },
  37333. easeOutQuart: function(e, t, n, i) {
  37334. return e /= i,
  37335. -n * (--e * e * e * e - 1) + t
  37336. },
  37337. easeInOutQuart: function(e, t, n, i) {
  37338. return (e /= i / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t
  37339. },
  37340. easeInQuint: function(e, t, n, i) {
  37341. return n * (e /= i) * e * e * e * e + t
  37342. },
  37343. easeOutQuint: function(e, t, n, i) {
  37344. return e /= i,
  37345. n * (--e * e * e * e * e + 1) + t
  37346. },
  37347. easeInOutQuint: function(e, t, n, i) {
  37348. return (e /= i / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t
  37349. },
  37350. easeInSine: function(e, t, n, i) {
  37351. return -n * Math.cos(e / i * (Math.PI / 2)) + n + t
  37352. },
  37353. easeOutSine: function(e, t, n, i) {
  37354. return console.log("easeOutSine"),
  37355. n * Math.sin(e / i * (Math.PI / 2)) + t
  37356. },
  37357. easeInOutSine: function(e, t, n, i) {
  37358. return -n / 2 * (Math.cos(Math.PI * e / i) - 1) + t
  37359. },
  37360. easeInExpo: function(e, t, n, i) {
  37361. return n * Math.pow(2, 10 * (e / i - 1)) + t
  37362. },
  37363. easeOutExpo: function(e, t, n, i) {
  37364. return n * (1 - Math.pow(2, -10 * e / i)) + t
  37365. },
  37366. easeInOutExpo: function(e, t, n, i) {
  37367. return (e /= i / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + t : (e--,
  37368. n / 2 * (2 - Math.pow(2, -10 * e)) + t)
  37369. },
  37370. easeInCirc: function(e, t, n, i) {
  37371. return e /= i,
  37372. -n * (Math.sqrt(1 - e * e) - 1) + t
  37373. },
  37374. easeOutCirc: function(e, t, n, i) {
  37375. return e /= i,
  37376. e--,
  37377. n * Math.sqrt(1 - e * e) + t
  37378. },
  37379. easeInOutCirc: function(e, t, n, i) {
  37380. return (e /= i / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : (e -= 2,
  37381. n / 2 * (Math.sqrt(1 - e * e) + 1) + t)
  37382. },
  37383. easeInElastic: function(e, t, n, i) {
  37384. var r = 1.70158
  37385. , a = 0
  37386. , o = n;
  37387. return 0 === e ? t : 1 == (e /= i) ? t + n : (a = a || .3 * i,
  37388. r = o < Math.abs(n) ? (o = n,
  37389. a / 4) : a / (2 * Math.PI) * Math.asin(n / o),
  37390. -(o * Math.pow(2, 10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a)) + t)
  37391. },
  37392. easeOutElastic: function(e, t, n, i) {
  37393. var r = 1.70158
  37394. , a = 0
  37395. , o = n;
  37396. return 0 === e ? t : 1 == (e /= i) ? t + n : (a = a || .3 * i,
  37397. r = o < Math.abs(n) ? (o = n,
  37398. a / 4) : a / (2 * Math.PI) * Math.asin(n / o),
  37399. o * Math.pow(2, -10 * e) * Math.sin((e * i - r) * (2 * Math.PI) / a) + n + t)
  37400. },
  37401. easeInOutElastic: function(e, t, n, i) {
  37402. var r = 1.70158
  37403. , a = 0
  37404. , o = n;
  37405. return 0 === e ? t : 2 == (e /= i / 2) ? t + n : (a = a || i * (.3 * 1.5),
  37406. r = o < Math.abs(n) ? (o = n,
  37407. a / 4) : a / (2 * Math.PI) * Math.asin(n / o),
  37408. e < 1 ? o * Math.pow(2, 10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a) * -.5 + t : o * Math.pow(2, -10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a) * .5 + n + t)
  37409. },
  37410. easeInBack: function(e, t, n, i, r) {
  37411. return n * (e /= i) * e * (((r = void 0 === r ? 1.70158 : r) + 1) * e - r) + t
  37412. },
  37413. easeOutBack: function(e, t, n, i, r) {
  37414. return n * ((e = e / i - 1) * e * (((r = void 0 === r ? 1.70158 : r) + 1) * e + r) + 1) + t
  37415. },
  37416. easeInOutBack: function(e, t, n, i, r) {
  37417. return void 0 === r && (r = 1.70158),
  37418. (e /= i / 2) < 1 ? n / 2 * (e * e * ((1 + (r *= 1.525)) * e - r)) + t : n / 2 * ((e -= 2) * e * ((1 + (r *= 1.525)) * e + r) + 2) + t
  37419. },
  37420. easeOutBounce: function(e, t, n, i) {
  37421. return (e /= i) < 1 / 2.75 ? n * (7.5625 * e * e) + t : e < 2 / 2.75 ? n * (7.5625 * (e -= 1.5 / 2.75) * e + .75) + t : e < 2.5 / 2.75 ? n * (7.5625 * (e -= 2.25 / 2.75) * e + .9375) + t : n * (7.5625 * (e -= 2.625 / 2.75) * e + .984375) + t
  37422. },
  37423. easeInBounce: function(e, t, n, i) {
  37424. return n - pv.easeOutBounce(i - e, 0, n, i) + t
  37425. },
  37426. easeInOutBounce: function(e, t, n, i) {
  37427. return e < i / 2 ? .5 * pv.easeInBounce(2 * e, 0, n, i) + t : .5 * pv.easeOutBounce(x, 2 * e - i, 0, n, i) + .5 * n + t
  37428. }
  37429. }, fv = function(t, n, i) {
  37430. var r = t.clone();
  37431. return n = n.clone(),
  37432. function(e) {
  37433. t.set(r.x * (1 - e) + n.x * e, r.y * (1 - e) + n.y * e, r.z * (1 - e) + n.z * e),
  37434. i && i(t, e)
  37435. }
  37436. }, mv = function(t, n, i) {
  37437. var r = t.clone();
  37438. return function(e) {
  37439. t.copy(r).slerp(n, e),
  37440. i && i(t, e)
  37441. }
  37442. }, vv = function(t, n, i, r) {
  37443. var a = t[n];
  37444. return function(e) {
  37445. t[n] = a * (1 - e) + i * e,
  37446. r && r(t[n])
  37447. }
  37448. }, gv = {
  37449. globalDone: null,
  37450. funcs: [],
  37451. counter: 0,
  37452. uniqueID: 0,
  37453. start: function(e, t, n, i, r, a, o, s) {
  37454. return this.funcs.push({
  37455. func: e,
  37456. current: -(i = i || 0) * Math.abs(t),
  37457. duration: (1 - Math.max(i, 0)) * Math.abs(t),
  37458. done: n,
  37459. easing: r || pv.linearTween,
  37460. cycling: t < 0,
  37461. running: !0,
  37462. debug: i < 0,
  37463. name: a || "T" + this.counter,
  37464. id: void 0 === o ? this.counter : o,
  37465. paused: !1,
  37466. cancelFun: s
  37467. }),
  37468. e(0, 16),
  37469. this.counter += 1,
  37470. e
  37471. },
  37472. trigger: function(e) {
  37473. var t = void 0 === e.delayRatio ? 0 : e.delayRatio
  37474. , n = e.func || function() {}
  37475. , i = void 0 === e.duration ? 0 : e.duration;
  37476. void 0 !== e.cycling && e.cycling && (i = -Math.abs(i));
  37477. var r = e.done || null
  37478. , a = e.easing || pv.linearTween
  37479. , o = e.name || "R" + this.counter
  37480. , e = void 0 === e.id ? this.counter : e.id;
  37481. return this.start(n, i, r, t, a, o, e)
  37482. },
  37483. setTimeout: function(e, t, n) {
  37484. n = void 0 === n ? this.counter : n;
  37485. return this.trigger({
  37486. done: e,
  37487. duration: void 0 === t ? 0 : t,
  37488. name: "O" + this.counter,
  37489. id: n
  37490. })
  37491. },
  37492. pause: function() {
  37493. this.paused = !0
  37494. },
  37495. resume: function() {
  37496. this.paused = !1
  37497. },
  37498. update: function(n) {
  37499. this.funcs.forEach(function(e) {
  37500. var t;
  37501. e.paused || (e.current += 1e3 * n,
  37502. e.current < 0) || (e.current >= e.duration && !e.cycling ? (t = e.easing(1, 0, 1, 1),
  37503. e.func(t, 1e3 * n),
  37504. e.done && e.done(),
  37505. e.running = !1) : (t = e.easing(e.current % e.duration / e.duration, 0, 1, 1),
  37506. e.func(t, 1e3 * n) && (e.done && e.done(),
  37507. e.running = !1)))
  37508. });
  37509. var e = this.funcs.length;
  37510. this.funcs = this.funcs.filter(function(e) {
  37511. return e.running
  37512. });
  37513. var t = this.funcs.length;
  37514. 0 < e && 0 === t && this.globalDone && (t = this.globalDone,
  37515. this.globalDone = null,
  37516. t())
  37517. },
  37518. adjustSpeed: function(e, t) {
  37519. for (var n = this.getById(e), i = 0; i < n.length; i++) {
  37520. var r = n[i];
  37521. r.duration /= t,
  37522. r.current /= t
  37523. }
  37524. },
  37525. getById: function(t) {
  37526. return this.funcs.filter(function(e) {
  37527. return t === e.id
  37528. })
  37529. },
  37530. get: function(e) {
  37531. for (var t = 0; t < this.funcs.length; t += 1)
  37532. if (this.funcs[t].func === e)
  37533. return this.funcs[t];
  37534. return null
  37535. },
  37536. isRunning: function(e) {
  37537. e = this.get(e);
  37538. return null !== e && e.running
  37539. },
  37540. countActive: function() {
  37541. for (var e = 0, t = 0; t < this.funcs.length; t += 1)
  37542. e += this.funcs[t].running;
  37543. return e
  37544. },
  37545. listActive: function() {
  37546. for (var e = [], t = 0; t < this.funcs.length; t += 1)
  37547. this.funcs[t].running && e.push(this.funcs[t].name);
  37548. return e
  37549. },
  37550. done: function(e) {
  37551. this.globalDone = e
  37552. },
  37553. cancelById: function(e, n) {
  37554. var i = void 0 === e ? 0 : e
  37555. , r = [];
  37556. this.funcs = this.funcs.filter(function(e) {
  37557. var t = e.id == i;
  37558. return t && n && e.cancelFun && r.push(e.cancelFun),
  37559. !t
  37560. }),
  37561. r.forEach(function(e) {
  37562. e()
  37563. })
  37564. },
  37565. cancel: function(t) {
  37566. this.funcs = this.funcs.filter(function(e) {
  37567. return e.func !== t
  37568. })
  37569. },
  37570. getUniqueId: function() {
  37571. return --this.uniqueID,
  37572. this.uniqueID
  37573. }
  37574. }, yv = "red", wv = "blue", bv = function() {
  37575. y(c, hn);
  37576. var n = w(c);
  37577. function c(e) {
  37578. var t;
  37579. return O(this, c),
  37580. (t = n.call(this)).viewer = e,
  37581. t.selectedElement = null,
  37582. t.uuid = gn.generateUUID(),
  37583. t.node = new Si,
  37584. t.node.name = "camera animation",
  37585. t.viewer.scene.scene.add(t.node),
  37586. t.frustum = t.createFrustum(),
  37587. t.node.add(t.frustum),
  37588. t.name = "Camera Animation",
  37589. t.curveType = "centripetal",
  37590. t.visible = !0,
  37591. t.targets = [],
  37592. t.createPath(),
  37593. t.duration = 5,
  37594. t.percent = 0,
  37595. t.currentIndex = 0,
  37596. t.durations = [],
  37597. t.quaternions = [],
  37598. Potree.settings.isTest || t.setVisible(!1),
  37599. t.addEventListener("dispose", function() {
  37600. t.dispose()
  37601. }),
  37602. t.targetLines = new Si,
  37603. t.node.add(t.targetLines),
  37604. t
  37605. }
  37606. return h(c, [{
  37607. key: "createControlPoint",
  37608. value: function(e, t) {
  37609. var n, i = this, r = this.posCurve.points.length, a = new Cn, o = new Cn;
  37610. null == e && (e = r),
  37611. t ? (a.copy(t.position),
  37612. o.copy(t.target)) : 2 <= r && 0 === e ? (n = (new Cn).subVectors(this.posCurve.points[0], this.posCurve.points[1]),
  37613. a.copy(this.posCurve.points[0]).add(n),
  37614. (new Cn).subVectors(this.targets[0].position, this.targets[1].position),
  37615. o.copy(this.targets[0].position).add(n)) : 2 <= r && e === r ? (s = (new Cn).subVectors(this.posCurve.points[r - 1], this.posCurve.points[r - 2]),
  37616. a.copy(this.posCurve.points[r - 2]).add(s),
  37617. (new Cn).subVectors(this.targets[r - 1].position, this.targets[r - 2].position),
  37618. o.copy(this.targets[r - 2].position).add(s)) : 2 <= r && (a.copy(this.posCurve.points[e - 1].clone().add(this.posCurve.points[e]).multiplyScalar(.5)),
  37619. o.copy(this.targets[r - 1].position.clone().add(this.targets[r]).multiplyScalar(.5))),
  37620. this.posCurve.addPoint(a, e);
  37621. var s = new uv(o,wv);
  37622. s.visible = this.visible,
  37623. this.targets = [].concat(Q(this.targets.slice(0, e)), [s], Q(this.targets.slice(e, r))),
  37624. this.useDurSlice && (this.durations = [].concat(Q(this.durations.slice(0, e)), [t.duration], Q(this.durations.slice(e, r)))),
  37625. this.dispatchEvent({
  37626. type: "controlpoint_added",
  37627. index: e
  37628. });
  37629. o = Sf.createLine([a, o], {
  37630. mat: sv("aimAtTarget")
  37631. });
  37632. this.targetLines.children = [].concat(Q(this.targetLines.children.slice(0, e)), [o], Q(this.targetLines.children.slice(e, r))),
  37633. this.targets[e].addEventListener("dragged", function(e) {
  37634. i.updatePathCallback(),
  37635. i.dragPointCallback(e)
  37636. })
  37637. }
  37638. }, {
  37639. key: "dragPointCallback",
  37640. value: function(e) {
  37641. var t = e.index;
  37642. null == e.index && (t = this.targets.indexOf(e.target)),
  37643. Sf.moveLine(this.targetLines.children[t], [this.posCurve.points[t], this.targets[t].position]),
  37644. this.updateFrustum()
  37645. }
  37646. }, {
  37647. key: "updatePathCallback",
  37648. value: function() {
  37649. this.quaternions = [];
  37650. for (var e = this.posCurve.points.length, t = 0; t < e; t++) {
  37651. var n = Up.getQuaFromPosAim(this.posCurve.points[t], this.targets[t].position);
  37652. this.quaternions.push(n)
  37653. }
  37654. this.reMapCurvePercent()
  37655. }
  37656. }, {
  37657. key: "removeControlPoint",
  37658. value: function(e) {
  37659. this.posCurve.removePoint(e),
  37660. this.targets[e].dispose(),
  37661. this.targets.splice(e, 1),
  37662. this.dispatchEvent({
  37663. type: "controlpoint_removed",
  37664. index: e
  37665. }),
  37666. this.targetLines.remove(this.targetLines.children[e]),
  37667. this.useDurSlice && this.durations.splice(e, 1)
  37668. }
  37669. }, {
  37670. key: "createPath",
  37671. value: function() {
  37672. this.posCurve = new hv([],sv("position"),yv,"posCurve"),
  37673. this.posCurve.needsPercent = !0,
  37674. this.node.add(this.posCurve),
  37675. this.posCurve.addEventListener("dragCurvePoint", this.dragPointCallback.bind(this)),
  37676. this.posCurve.addEventListener("updatePath", this.updatePathCallback.bind(this))
  37677. }
  37678. }, {
  37679. key: "createFrustum",
  37680. value: function() {
  37681. var e = [new Cn(0,0,0), new Cn(-.3,-.3,1), new Cn(0,0,0), new Cn(.3,-.3,1), new Cn(0,0,0), new Cn(.3,.3,1), new Cn(0,0,0), new Cn(-.3,.3,1), new Cn(-.3,-.3,1), new Cn(.3,-.3,1), new Cn(.3,-.3,1), new Cn(.3,.3,1), new Cn(.3,.3,1), new Cn(-.3,.3,1), new Cn(-.3,.3,1), new Cn(-.3,-.3,1)];
  37682. e.forEach(function(e) {
  37683. return e.z *= -1
  37684. });
  37685. e = Sf.createFatLine(e, {
  37686. material: sv("frustum")
  37687. });
  37688. return e.visible = !1,
  37689. e
  37690. }
  37691. }, {
  37692. key: "reMapCurvePercent",
  37693. value: function() {
  37694. var e = this.posCurve.points.length;
  37695. if (e < 2)
  37696. return this.newPointsPercents = [];
  37697. var t = [0];
  37698. if (this.useDurSlice) {
  37699. for (var n = [0], i = 0, r = 0; r < e - 1; r++) {
  37700. var a = this.durations[r];
  37701. i += a,
  37702. n.push(i)
  37703. }
  37704. for (var o = 1; o < e; o++)
  37705. t.push(0 == i ? o / e : n[o] / i)
  37706. } else {
  37707. for (var s = this.duration / e, l = Math.min(.8, s), u = gn.clamp(.8 * Math.PI, l, s), c = this.posCurve.pointsPercent, d = 1; d < e; d++) {
  37708. var h, p = (c[d] - c[d - 1]) * this.duration, f = l;
  37709. p < u && (h = this.quaternions[d].angleTo(this.quaternions[d - 1]),
  37710. f = gn.clamp(.8 * h, l, s)),
  37711. p = Math.max(p, f),
  37712. p = t[d - 1] + p / this.duration,
  37713. t.push(p)
  37714. }
  37715. var m, v = t[e - 1];
  37716. Up.closeTo(v, 1) || (m = 1 / v,
  37717. t = t.map(function(e) {
  37718. return e * m
  37719. }))
  37720. }
  37721. this.newPointsPercents = t
  37722. }
  37723. }, {
  37724. key: "at",
  37725. value: function(e, t, n) {
  37726. var i, r = e = gn.clamp(e, 0, 1);
  37727. r < 1 ? (this.currentIndex = this.newPointsPercents.findIndex(function(e) {
  37728. return r < e
  37729. }) - 1,
  37730. e = this.newPointsPercents[this.currentIndex],
  37731. i = this.newPointsPercents[this.currentIndex + 1],
  37732. s = (r - e) / (i - e),
  37733. i = this.posCurve.pointsPercent[this.currentIndex],
  37734. r = i + (this.posCurve.pointsPercent[this.currentIndex + 1] - i) * s,
  37735. e = this.quaternions[this.currentIndex + 1],
  37736. i = this.quaternions[this.currentIndex],
  37737. i = (new Sn).copy(i),
  37738. mv(i, e)(s)) : (this.currentIndex = this.posCurve.points.length - 1,
  37739. i = Up.getQuaFromPosAim(this.posCurve.points[this.currentIndex], this.targets[this.currentIndex].position));
  37740. var a, o, s = this.posCurve.getPointAt(r);
  37741. return null != t ? (o = Potree.settings.tourTestCameraMove ? (a = this.frustum.quaternion.clone(),
  37742. this.frustum.position.clone()) : (a = (o = viewer.scene.getActiveCamera()).quaternion.clone(),
  37743. o.position.clone()),
  37744. n = n || 1 / Potree.settings.cameraAniSmoothRatio,
  37745. n = gn.clamp(n *= 60 * t, 0, 1),
  37746. mv(a, i)(n),
  37747. fv(o, s)(n)) : (a = i,
  37748. o = s),
  37749. {
  37750. position: o,
  37751. rotation: (new ci).setFromQuaternion(a)
  37752. }
  37753. }
  37754. }, {
  37755. key: "set",
  37756. value: function(e) {
  37757. this.percent = e
  37758. }
  37759. }, {
  37760. key: "setVisible",
  37761. value: function(t) {
  37762. this.node.visible = t,
  37763. this.posCurve.visible = t,
  37764. this.targets.forEach(function(e) {
  37765. return e.visible = t
  37766. }),
  37767. this.visible = t
  37768. }
  37769. }, {
  37770. key: "setDuration",
  37771. value: function(e) {
  37772. e != this.duration && (this.duration = e,
  37773. this.quaternions.length == this.posCurve.points.length && this.reMapCurvePercent())
  37774. }
  37775. }, {
  37776. key: "getDuration",
  37777. value: function(e) {
  37778. return this.duration
  37779. }
  37780. }, {
  37781. key: "play",
  37782. value: function() {
  37783. var i = this
  37784. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  37785. if (this.onUpdate)
  37786. return console.error("已经开始播放");
  37787. var r = 0
  37788. , a = 0;
  37789. null != e.percent ? r = e.percent : e.index && (a = index,
  37790. r = this.posCurve.pointsPercent[index]);
  37791. var o = this.duration;
  37792. this.originalyVisible = this.visible,
  37793. Potree.settings.tourTestCameraMove || this.setVisible(!1);
  37794. var s, l = 0, u = Potree.settings.cameraAniSmoothRatio / 60 * 3, c = 0;
  37795. this.onUpdate = function(e) {
  37796. if (i.posCurve.points.length < 2)
  37797. return 1 == i.posCurve.points.length && (viewer.scene.view.position.copy(i.posCurve.points[0]),
  37798. viewer.scene.view.rotation = (new ci).setFromQuaternion(i.quaternions[0])),
  37799. void i.pause();
  37800. var t;
  37801. s ? t = (performance.now() - s) / 1e3 / o + r : (t = 0,
  37802. l += e.delta,
  37803. n = .2,
  37804. console.log("延迟开始"),
  37805. .25 < l && (s = performance.now())),
  37806. i.set(t);
  37807. var n = i.at(t, e.delta, n);
  37808. a != i.currentIndex && (a = i.currentIndex,
  37809. console.log("updateCurrentIndex", a),
  37810. i.dispatchEvent({
  37811. type: "updateCurrentIndex",
  37812. currentIndex: a
  37813. })),
  37814. Potree.settings.tourTestCameraMove || (viewer.scene.view.position.copy(n.position),
  37815. viewer.scene.view.rotation = n.rotation),
  37816. i.updateFrustum(n),
  37817. 1 <= t && (u < c ? i.pause() : (c += e.delta,
  37818. console.log("延迟结束")))
  37819. }
  37820. ,
  37821. this.viewer.addEventListener("update", this.onUpdate)
  37822. }
  37823. }, {
  37824. key: "pause",
  37825. value: function() {
  37826. this.setVisible(this.originalyVisible),
  37827. this.viewer.removeEventListener("update", this.onUpdate),
  37828. this.dispatchEvent("playDone"),
  37829. this.onUpdate = null
  37830. }
  37831. }, {
  37832. key: "updateFrustum",
  37833. value: function(e) {
  37834. var t = this.frustum;
  37835. 1 < this.posCurve.points.length ? (t.visible = !0,
  37836. e = e || this.at(this.percent),
  37837. t.position.copy(e.position),
  37838. t.rotation.copy(e.rotation)) : t.visible = !1
  37839. }
  37840. }, {
  37841. key: "changeCallback",
  37842. value: function() {
  37843. this.posCurve.update(),
  37844. this.targets.forEach(function(e) {
  37845. return e.update()
  37846. }),
  37847. this.updateFrustum()
  37848. }
  37849. }, {
  37850. key: "dispose",
  37851. value: function() {
  37852. this.posCurve.dispose(),
  37853. this.targets.forEach(function(e) {
  37854. return e.dispose()
  37855. }),
  37856. this.durations = [],
  37857. this.node.parent.remove(this.node)
  37858. }
  37859. }], [{
  37860. key: "defaultFromView",
  37861. value: function(e) {
  37862. for (var t = new c(e), n = e.scene.getActiveCamera(), e = e.scene.view.getPivot(), i = new Cn(.3 * n.position.x + .7 * e.x,.3 * n.position.y + .7 * e.y,.3 * n.position.z + .7 * e.z), r = new Cn(.05 * n.position.x + .95 * e.x,.05 * n.position.y + .95 * e.y,.05 * n.position.z + .95 * e.z), a = Jf.computeAzimuth(n.position, e), o = 0; o < 5; o++) {
  37863. var s = 1.5 * Math.PI * (o / 5) + a
  37864. , l = 2 * Math.cos(s)
  37865. , u = 2 * Math.sin(s)
  37866. , s = new Cn(i.x + l,i.y + u,i.z)
  37867. , u = new Cn(r.x + .1 * l,r.y + .1 * u,r.z);
  37868. t.createControlPoint(null, {
  37869. position: s,
  37870. target: u
  37871. })
  37872. }
  37873. return t.changeCallback(),
  37874. t
  37875. }
  37876. }]),
  37877. c
  37878. }();
  37879. function xv(d, e) {
  37880. if (e) {
  37881. var t, n = function e(t, n) {
  37882. var i, r;
  37883. if (!(i = t,
  37884. r = null,
  37885. d.scene.annotations.traverse(function(e) {
  37886. e.uuid === i.uuid && (r = e)
  37887. }),
  37888. r)) {
  37889. var a, o, s, l, u = ((s = new Kf({
  37890. position: (a = t).position,
  37891. title: a.title,
  37892. cameraPosition: a.cameraPosition,
  37893. cameraTarget: a.cameraTarget
  37894. })).description = a.description,
  37895. s.uuid = a.uuid,
  37896. a.offset && (o = s.offset).set.apply(o, Q(a.offset)),
  37897. s), c = ue(t.children);
  37898. try {
  37899. for (c.s(); !(l = c.n()).done; )
  37900. e(l.value, u)
  37901. } catch (e) {
  37902. c.e(e)
  37903. } finally {
  37904. c.f()
  37905. }
  37906. n.add(u)
  37907. }
  37908. }, i = ue(e);
  37909. try {
  37910. for (i.s(); !(t = i.n()).done; )
  37911. n(t.value, d.scene.annotations)
  37912. } catch (e) {
  37913. i.e(e)
  37914. } finally {
  37915. i.f()
  37916. }
  37917. }
  37918. }
  37919. function Ev() {
  37920. return (Ev = r(regeneratorRuntime.mark(function e(r, a, o) {
  37921. var s, l, u, c, d, h, p, f, m, v, g, y, w, b, x;
  37922. return regeneratorRuntime.wrap(function(e) {
  37923. for (; ; )
  37924. switch (e.prev = e.next) {
  37925. case 0:
  37926. if ("Potree" !== a.type)
  37927. return console.error("not a valid Potree project"),
  37928. e.abrupt("return");
  37929. e.next = 3;
  37930. break;
  37931. case 3:
  37932. n = r,
  37933. (i = a.settings) && (n.setPointBudget(i.pointBudget),
  37934. n.setFOV(i.fov),
  37935. n.setEDLEnabled(i.edlEnabled),
  37936. n.setEDLRadius(i.edlRadius),
  37937. n.setEDLStrength(i.edlStrength),
  37938. n.setBackground(i.background),
  37939. n.setMinNodeSize(i.minNodeSize),
  37940. n.setShowBoundingBox(i.showBoundingBoxes)),
  37941. t = r,
  37942. n = a.view,
  37943. i = void 0,
  37944. (i = t.scene.view.position).set.apply(i, Q(n.position)),
  37945. (t = t.scene.view).lookAt.apply(t, Q(n.target)),
  37946. s = ue(a.measurements);
  37947. try {
  37948. for (s.s(); !(l = s.n()).done; )
  37949. u = l.value,
  37950. function(e, t) {
  37951. e.scene.measurements.find(function(e) {
  37952. return e.uuid === t.uuid
  37953. }) || (t.points = t.points.map(function(e) {
  37954. return B(Cn, Q(e))
  37955. }),
  37956. e.measuringTool.createMeasureFromData(t))
  37957. }(r, u)
  37958. } catch (e) {
  37959. s.e(e)
  37960. } finally {
  37961. s.f()
  37962. }
  37963. c = ue(a.volumes);
  37964. try {
  37965. for (c.s(); !(d = c.n()).done; )
  37966. h = d.value,
  37967. function(e, t) {
  37968. var n, i;
  37969. e.scene.volumes.find(function(e) {
  37970. return e.uuid === t.uuid
  37971. }) || ((i = new Potree[t.type]).uuid = t.uuid,
  37972. i.name = t.name,
  37973. (n = i.position).set.apply(n, Q(t.position)),
  37974. (n = i.rotation).set.apply(n, Q(t.rotation)),
  37975. (n = i.scale).set.apply(n, Q(t.scale)),
  37976. i.visible = t.visible,
  37977. i.clip = t.clip,
  37978. e.scene.addVolume(i))
  37979. }(r, h)
  37980. } catch (e) {
  37981. c.e(e)
  37982. } finally {
  37983. c.f()
  37984. }
  37985. p = ue(a.cameraAnimations);
  37986. try {
  37987. for (p.s(); !(f = p.n()).done; )
  37988. m = f.value,
  37989. function(e, t) {
  37990. if (!e.scene.cameraAnimations.find(function(e) {
  37991. return e.uuid === t.uuid
  37992. })) {
  37993. var n = new bv(e);
  37994. n.uuid = t.uuid,
  37995. n.name = t.name,
  37996. n.duration = t.duration,
  37997. n.t = t.t,
  37998. n.curveType = t.curveType,
  37999. n.visible = t.visible,
  38000. n.controlPoints = [];
  38001. var i, r = ue(t.controlPoints);
  38002. try {
  38003. for (r.s(); !(i = r.n()).done; ) {
  38004. var a, o, s = i.value, l = n.createControlPoint();
  38005. (a = l.position).set.apply(a, Q(s.position)),
  38006. (o = l.target).set.apply(o, Q(s.target))
  38007. }
  38008. } catch (e) {
  38009. r.e(e)
  38010. } finally {
  38011. r.f()
  38012. }
  38013. e.scene.addCameraAnimation(n)
  38014. }
  38015. }(r, m)
  38016. } catch (e) {
  38017. p.e(e)
  38018. } finally {
  38019. p.f()
  38020. }
  38021. v = ue(a.profiles);
  38022. try {
  38023. for (v.s(); !(g = v.n()).done; )
  38024. y = g.value,
  38025. function(e, t) {
  38026. var n = t.name
  38027. , i = t.points;
  38028. if (!e.scene.profiles.find(function(e) {
  38029. return e.uuid === t.uuid
  38030. })) {
  38031. var r = new Potree.Profile;
  38032. r.name = n,
  38033. r.uuid = t.uuid,
  38034. r.setWidth(t.width);
  38035. var a, o = ue(i);
  38036. try {
  38037. for (o.s(); !(a = o.n()).done; ) {
  38038. var s = a.value;
  38039. r.addMarker(B(Cn, Q(s)))
  38040. }
  38041. } catch (e) {
  38042. o.e(e)
  38043. } finally {
  38044. o.f()
  38045. }
  38046. e.scene.addProfile(r)
  38047. }
  38048. }(r, y)
  38049. } catch (e) {
  38050. v.e(e)
  38051. } finally {
  38052. v.f()
  38053. }
  38054. if (a.orientedImages) {
  38055. w = ue(a.orientedImages);
  38056. try {
  38057. for (w.s(); !(b = w.n()).done; )
  38058. x = b.value,
  38059. function(t, e) {
  38060. var n = e.cameraParamsPath
  38061. , i = e.imageParamsPath;
  38062. t.scene.orientedImages.find(function(e) {
  38063. return e.imageParamsPath === i
  38064. }) || Potree.OrientedImageLoader.load(n, i, t).then(function(e) {
  38065. t.scene.addOrientedImages(e)
  38066. })
  38067. }(r, x)
  38068. } catch (e) {
  38069. w.e(e)
  38070. } finally {
  38071. w.f()
  38072. }
  38073. }
  38074. xv(r, a.annotations),
  38075. t = r,
  38076. (n = a.classification) && t.setClassifications(n),
  38077. o && o();
  38078. case 17:
  38079. case "end":
  38080. return e.stop()
  38081. }
  38082. var t, n, i
  38083. }, e)
  38084. }))).apply(this, arguments)
  38085. }
  38086. var _v = function() {
  38087. y(i, Gu);
  38088. var n = w(i);
  38089. function i() {
  38090. O(this, i);
  38091. var e = n.call(this)
  38092. , t = {
  38093. resolution: {
  38094. type: "v2",
  38095. value: new yn
  38096. },
  38097. edlStrength: {
  38098. type: "f",
  38099. value: 1
  38100. },
  38101. uNear: {
  38102. type: "f",
  38103. value: 1
  38104. },
  38105. uFar: {
  38106. type: "f",
  38107. value: 1
  38108. },
  38109. radius: {
  38110. type: "f",
  38111. value: 1
  38112. },
  38113. neighbours: {
  38114. type: "2fv",
  38115. value: []
  38116. },
  38117. depthMap: {
  38118. type: "t",
  38119. value: null
  38120. },
  38121. uEDLColor: {
  38122. type: "t",
  38123. value: null
  38124. },
  38125. uEDLDepth: {
  38126. type: "t",
  38127. value: null
  38128. },
  38129. opacity: {
  38130. type: "f",
  38131. value: 1
  38132. },
  38133. uProj: {
  38134. type: "Matrix4fv",
  38135. value: []
  38136. },
  38137. useEDL: {
  38138. type: "i",
  38139. value: 1
  38140. }
  38141. };
  38142. return e.setValues({
  38143. uniforms: t,
  38144. vertexShader: e.getDefines() + Hp["edl.vs"],
  38145. fragmentShader: e.getDefines() + Hp["edl.fs"],
  38146. lights: !1
  38147. }),
  38148. e.neighbourCount = 8,
  38149. e
  38150. }
  38151. return h(i, [{
  38152. key: "getDefines",
  38153. value: function() {
  38154. var e = "";
  38155. return e += "#define NEIGHBOUR_COUNT " + this.neighbourCount + "\n"
  38156. }
  38157. }, {
  38158. key: "updateShaderSource",
  38159. value: function() {
  38160. var e = this.getDefines() + Hp["edl.vs"]
  38161. , t = this.getDefines() + Hp["edl.fs"];
  38162. this.setValues({
  38163. vertexShader: e,
  38164. fragmentShader: t
  38165. }),
  38166. this.uniforms.neighbours.value = this.neighbours,
  38167. this.needsUpdate = !0
  38168. }
  38169. }, {
  38170. key: "neighbourCount",
  38171. get: function() {
  38172. return this._neighbourCount
  38173. },
  38174. set: function(e) {
  38175. if (this._neighbourCount !== e) {
  38176. this._neighbourCount = e,
  38177. this.neighbours = new Float32Array(2 * this._neighbourCount);
  38178. for (var t = 0; t < this._neighbourCount; t++)
  38179. this.neighbours[2 * t + 0] = Math.cos(2 * t * Math.PI / this._neighbourCount),
  38180. this.neighbours[2 * t + 1] = Math.sin(2 * t * Math.PI / this._neighbourCount);
  38181. this.updateShaderSource()
  38182. }
  38183. }
  38184. }]),
  38185. i
  38186. }()
  38187. , Mv = function() {
  38188. y(n, Gu);
  38189. var t = w(n);
  38190. function n() {
  38191. O(this, n);
  38192. var e;
  38193. return (e = t.call(this)).setValues({
  38194. uniforms: {
  38195. screenWidth: {
  38196. type: "f",
  38197. value: 0
  38198. },
  38199. screenHeight: {
  38200. type: "f",
  38201. value: 0
  38202. },
  38203. edlStrength: {
  38204. type: "f",
  38205. value: 1
  38206. },
  38207. radius: {
  38208. type: "f",
  38209. value: 1
  38210. },
  38211. neighbours: {
  38212. type: "2fv",
  38213. value: []
  38214. },
  38215. uEDLMap: {
  38216. type: "t",
  38217. value: null
  38218. },
  38219. uDepthMap: {
  38220. type: "t",
  38221. value: null
  38222. },
  38223. uWeightMap: {
  38224. type: "t",
  38225. value: null
  38226. }
  38227. },
  38228. vertexShader: e.getDefines() + Hp["normalize.vs"],
  38229. fragmentShader: e.getDefines() + Hp["normalize_and_edl.fs"]
  38230. }),
  38231. e.neighbourCount = 8,
  38232. e
  38233. }
  38234. return h(n, [{
  38235. key: "getDefines",
  38236. value: function() {
  38237. var e = "";
  38238. return e += "#define NEIGHBOUR_COUNT " + this.neighbourCount + "\n"
  38239. }
  38240. }, {
  38241. key: "updateShaderSource",
  38242. value: function() {
  38243. var e = this.getDefines() + Hp["normalize.vs"]
  38244. , t = this.getDefines() + Hp["normalize_and_edl.fs"];
  38245. this.setValues({
  38246. vertexShader: e,
  38247. fragmentShader: t
  38248. }),
  38249. this.uniforms.neighbours.value = this.neighbours,
  38250. this.needsUpdate = !0
  38251. }
  38252. }, {
  38253. key: "neighbourCount",
  38254. get: function() {
  38255. return this._neighbourCount
  38256. },
  38257. set: function(e) {
  38258. if (this._neighbourCount !== e) {
  38259. this._neighbourCount = e,
  38260. this.neighbours = new Float32Array(2 * this._neighbourCount);
  38261. for (var t = 0; t < this._neighbourCount; t++)
  38262. this.neighbours[2 * t + 0] = Math.cos(2 * t * Math.PI / this._neighbourCount),
  38263. this.neighbours[2 * t + 1] = Math.sin(2 * t * Math.PI / this._neighbourCount);
  38264. this.updateShaderSource()
  38265. }
  38266. }
  38267. }]),
  38268. n
  38269. }()
  38270. , Av = function() {
  38271. y(n, Gu);
  38272. var t = w(n);
  38273. function n() {
  38274. O(this, n);
  38275. var e;
  38276. return (e = t.call(this)).setValues({
  38277. uniforms: {
  38278. uDepthMap: {
  38279. type: "t",
  38280. value: null
  38281. },
  38282. uWeightMap: {
  38283. type: "t",
  38284. value: null
  38285. }
  38286. },
  38287. vertexShader: e.getDefines() + Hp["normalize.vs"],
  38288. fragmentShader: e.getDefines() + Hp["normalize.fs"]
  38289. }),
  38290. e
  38291. }
  38292. return h(n, [{
  38293. key: "getDefines",
  38294. value: function() {
  38295. return ""
  38296. }
  38297. }, {
  38298. key: "updateShaderSource",
  38299. value: function() {
  38300. var e = this.getDefines() + Hp["normalize.vs"]
  38301. , t = this.getDefines() + Hp["normalize.fs"];
  38302. this.setValues({
  38303. vertexShader: e,
  38304. fragmentShader: t
  38305. }),
  38306. this.needsUpdate = !0
  38307. }
  38308. }]),
  38309. n
  38310. }()
  38311. , Tv = function() {
  38312. function d(e, t) {
  38313. O(this, d),
  38314. this.version = "string" == typeof e ? new Km(e) : e,
  38315. this.extension = t
  38316. }
  38317. var n;
  38318. return h(d, [{
  38319. key: "load",
  38320. value: function(t) {
  38321. var n, i, r = this;
  38322. t.loaded || (n = t.getURL(),
  38323. this.version.equalOrHigher("1.4") && (n += ".".concat(this.extension)),
  38324. (i = Gp.createXMLHttpRequest()).open("GET", n, !0),
  38325. i.responseType = "arraybuffer",
  38326. i.overrideMimeType("text/plain; charset=x-user-defined"),
  38327. i.onreadystatechange = function() {
  38328. var e;
  38329. 4 === i.readyState && (200 === i.status || 0 === i.status ? (e = i.response,
  38330. r.parse(t, e)) : console.log("Failed to load file! HTTP status: " + i.status + ", file: " + n))
  38331. }
  38332. ,
  38333. i.send(null))
  38334. }
  38335. }, {
  38336. key: "parse",
  38337. value: (n = r(regeneratorRuntime.mark(function e(t, n) {
  38338. var i, r, a, o, s, l, u, c;
  38339. return regeneratorRuntime.wrap(function(e) {
  38340. for (; ; )
  38341. switch (e.prev = e.next) {
  38342. case 0:
  38343. return i = new LASFile(n),
  38344. r = new Sv(t),
  38345. e.prev = 2,
  38346. e.next = 5,
  38347. i.open();
  38348. case 5:
  38349. i.isOpen = !0,
  38350. e.next = 12;
  38351. break;
  38352. case 8:
  38353. return e.prev = 8,
  38354. e.t0 = e.catch(2),
  38355. console.log("failed to open file. :("),
  38356. e.abrupt("return");
  38357. case 12:
  38358. return e.next = 14,
  38359. i.getHeader();
  38360. case 14:
  38361. a = e.sent,
  38362. s = 0,
  38363. l = (o = 1) <= 1 ? a.pointsCount : a.pointsCount / o,
  38364. u = !0;
  38365. case 19:
  38366. if (u)
  38367. return e.next = 22,
  38368. i.readData(1e6, 0, o);
  38369. e.next = 29;
  38370. break;
  38371. case 22:
  38372. c = e.sent,
  38373. r.push(new LASDecoder(c.buffer,a.pointsFormatId,a.pointsStructSize,c.count,a.scale,a.offset,a.mins,a.maxs)),
  38374. s += c.count,
  38375. d.progressCB(s / l),
  38376. u = c.hasMoreData,
  38377. e.next = 19;
  38378. break;
  38379. case 29:
  38380. return a.totalRead = s,
  38381. a.versionAsString = i.versionAsString,
  38382. a.isCompressed = i.isCompressed,
  38383. d.progressCB(1),
  38384. e.prev = 33,
  38385. e.next = 36,
  38386. i.close();
  38387. case 36:
  38388. i.isOpen = !1,
  38389. e.next = 43;
  38390. break;
  38391. case 39:
  38392. throw e.prev = 39,
  38393. e.t1 = e.catch(33),
  38394. console.error("failed to close las/laz file!!!"),
  38395. e.t1;
  38396. case 43:
  38397. case "end":
  38398. return e.stop()
  38399. }
  38400. }, e, null, [[2, 8], [33, 39]])
  38401. })),
  38402. function(e, t) {
  38403. return n.apply(this, arguments)
  38404. }
  38405. )
  38406. }, {
  38407. key: "handle",
  38408. value: function(e, t) {}
  38409. }], [{
  38410. key: "progressCB",
  38411. value: function() {}
  38412. }]),
  38413. d
  38414. }()
  38415. , Sv = function() {
  38416. function t(e) {
  38417. O(this, t),
  38418. this.node = e
  38419. }
  38420. return h(t, [{
  38421. key: "push",
  38422. value: function(h) {
  38423. var p = this
  38424. , f = Potree.scriptPath + "/workers/LASDecoderWorker.js"
  38425. , m = Potree.workerPool.getWorker(f)
  38426. , v = this.node.pcoGeometry.pointAttributes;
  38427. m.onmessage = function(i) {
  38428. var e = new Mr
  38429. , t = h.pointsCount
  38430. , n = new Float32Array(i.data.position)
  38431. , r = new Uint8Array(i.data.color)
  38432. , a = new Float32Array(i.data.intensity)
  38433. , o = new Uint8Array(i.data.classification)
  38434. , s = new Uint8Array(i.data.returnNumber)
  38435. , l = new Uint8Array(i.data.numberOfReturns)
  38436. , u = new Uint16Array(i.data.pointSourceID)
  38437. , c = new Uint8Array(i.data.indices);
  38438. e.setAttribute("position", new nr(n,3)),
  38439. e.setAttribute("color", new nr(r,4,!0)),
  38440. e.setAttribute("intensity", new nr(a,1)),
  38441. e.setAttribute("classification", new nr(o,1)),
  38442. e.setAttribute("return number", new nr(s,1)),
  38443. e.setAttribute("number of returns", new nr(l,1)),
  38444. e.setAttribute("source id", new nr(u,1)),
  38445. e.setAttribute("indices", new nr(c,4)),
  38446. e.attributes.indices.normalized = !0;
  38447. for (var d in i.data.ranges)
  38448. !function(t) {
  38449. var e = i.data.ranges[t]
  38450. , n = v.attributes.find(function(e) {
  38451. return e.name === t
  38452. });
  38453. n.range[0] = Math.min(n.range[0], e[0]),
  38454. n.range[1] = Math.max(n.range[1], e[1])
  38455. }(d);
  38456. c = new kn((new Cn).fromArray(i.data.tightBoundingBox.min),(new Cn).fromArray(i.data.tightBoundingBox.max));
  38457. e.boundingBox = p.node.boundingBox,
  38458. p.node.tightBoundingBox = c,
  38459. p.node.geometry = e,
  38460. p.node.numPoints = t,
  38461. p.node.loaded = !0,
  38462. p.node.loading = !1,
  38463. Potree.numNodesLoading--,
  38464. p.node.mean = B(Cn, Q(i.data.mean)),
  38465. Potree.workerPool.returnWorker(f, m)
  38466. }
  38467. ;
  38468. var e = {
  38469. buffer: h.arrayb,
  38470. numPoints: h.pointsCount,
  38471. pointSize: h.pointSize,
  38472. pointFormatID: 2,
  38473. scale: h.scale,
  38474. offset: h.offset,
  38475. mins: h.mins,
  38476. maxs: h.maxs
  38477. };
  38478. m.postMessage(e, [e.buffer])
  38479. }
  38480. }]),
  38481. t
  38482. }()
  38483. , Cv = function() {
  38484. function i(e, t, n) {
  38485. O(this, i),
  38486. this.version = "string" == typeof e ? new Km(e) : e,
  38487. this.boundingBox = t,
  38488. this.scale = n
  38489. }
  38490. return h(i, [{
  38491. key: "load",
  38492. value: function(t) {
  38493. var n = this;
  38494. if (!t.loaded) {
  38495. var i = t.getURL();
  38496. this.version.equalOrHigher("1.4") && (i += ".bin"),
  38497. i += "?m=" + t.pcoGeometry.timeStamp;
  38498. var r = Gp.createXMLHttpRequest();
  38499. r.open("GET", i, !0),
  38500. r.responseType = "arraybuffer",
  38501. r.overrideMimeType("text/plain; charset=x-user-defined"),
  38502. r.onreadystatechange = function() {
  38503. if (4 === r.readyState) {
  38504. if (200 !== r.status && 0 !== r.status || null === r.response)
  38505. throw new Error("Failed to load file! HTTP status: ".concat(r.status, ", file: ").concat(i));
  38506. var e = r.response;
  38507. n.parse(t, e)
  38508. }
  38509. }
  38510. ;
  38511. try {
  38512. r.send(null)
  38513. } catch (e) {
  38514. console.log("fehler beim laden der punktwolke: " + e)
  38515. }
  38516. }
  38517. }
  38518. }, {
  38519. key: "parse",
  38520. value: function(o, e) {
  38521. var s = o.pcoGeometry.pointAttributes
  38522. , t = e.byteLength / o.pcoGeometry.pointAttributes.byteSize;
  38523. this.version.upTo("1.5") && (o.numPoints = t);
  38524. var l = Potree.scriptPath + "/workers/BinaryDecoderWorker.js"
  38525. , u = Potree.workerPool.getWorker(l);
  38526. u.onmessage = function(e) {
  38527. var t = e.data
  38528. , r = t.attributeBuffers
  38529. , n = new kn((new Cn).fromArray(t.tightBoundingBox.min),(new Cn).fromArray(t.tightBoundingBox.max));
  38530. Potree.workerPool.returnWorker(l, u);
  38531. var i, a = new Mr;
  38532. for (i in r)
  38533. !function(e) {
  38534. var t, n = r[e].buffer, i = r[e].attribute;
  38535. "POSITION_CARTESIAN" === e ? a.setAttribute("position", new nr(new Float32Array(n),3)) : "rgba" === e ? a.setAttribute("rgba", new nr(new Uint8Array(n),4,!0)) : "NORMAL_SPHEREMAPPED" === e || "NORMAL_OCT16" === e || "NORMAL" === e ? a.setAttribute("normal", new nr(new Float32Array(n),3)) : "INDICES" === e ? ((t = new nr(new Uint8Array(n),4)).normalized = !0,
  38536. a.setAttribute("indices", t)) : "SPACING" === e ? (t = new nr(new Float32Array(n),1),
  38537. a.setAttribute("spacing", t)) : ((n = new nr(new Float32Array(n),1)).potree = {
  38538. offset: r[e].offset,
  38539. scale: r[e].scale,
  38540. preciseBuffer: r[e].preciseBuffer,
  38541. range: i.range
  38542. },
  38543. a.setAttribute(e, n),
  38544. (n = s.attributes.find(function(e) {
  38545. return e.name === i.name
  38546. })).range[0] = Math.min(n.range[0], i.range[0]),
  38547. n.range[1] = Math.max(n.range[1], i.range[1]),
  38548. 0 === o.getLevel() && (n.initialRange = i.range))
  38549. }(i);
  38550. n.max.sub(n.min),
  38551. n.min.set(0, 0, 0);
  38552. e = e.data.buffer.byteLength / s.byteSize;
  38553. o.numPoints = e,
  38554. o.geometry = a,
  38555. o.mean = B(Cn, Q(t.mean)),
  38556. o.tightBoundingBox = n,
  38557. o.loaded = !0,
  38558. o.loading = !1,
  38559. o.estimatedSpacing = t.estimatedSpacing,
  38560. Potree.numNodesLoading--
  38561. }
  38562. ;
  38563. e = {
  38564. buffer: e,
  38565. pointAttributes: s,
  38566. version: this.version.version,
  38567. min: [o.boundingBox.min.x, o.boundingBox.min.y, o.boundingBox.min.z],
  38568. offset: [o.pcoGeometry.offset.x, o.pcoGeometry.offset.y, o.pcoGeometry.offset.z],
  38569. scale: this.scale,
  38570. spacing: o.spacing,
  38571. hasChildren: o.hasChildren,
  38572. name: o.name
  38573. };
  38574. u.postMessage(e, [e.buffer])
  38575. }
  38576. }]),
  38577. i
  38578. }();
  38579. function Pv(e) {
  38580. var t = new Km(e.version)
  38581. , n = {
  38582. COLOR_PACKED: "rgba",
  38583. RGBA: "rgba",
  38584. INTENSITY: "intensity",
  38585. CLASSIFICATION: "classification",
  38586. GPS_TIME: "gps-time"
  38587. }
  38588. , i = [];
  38589. if (t.upTo("1.7")) {
  38590. var r, a = ue(e.pointAttributes);
  38591. try {
  38592. for (a.s(); !(r = a.n()).done; ) {
  38593. var o = r.value
  38594. , s = Am[o]
  38595. , l = {
  38596. name: s.name,
  38597. size: s.byteSize,
  38598. elements: s.numElements,
  38599. elementSize: s.byteSize / s.numElements,
  38600. type: s.type.name,
  38601. description: ""
  38602. };
  38603. i.push(l)
  38604. }
  38605. } catch (e) {
  38606. a.e(e)
  38607. } finally {
  38608. a.f()
  38609. }
  38610. } else
  38611. i.push.apply(i, Q(e.pointAttributes));
  38612. for (var u = new Sm, c = {
  38613. int8: Em.DATA_TYPE_INT8,
  38614. int16: Em.DATA_TYPE_INT16,
  38615. int32: Em.DATA_TYPE_INT32,
  38616. int64: Em.DATA_TYPE_INT64,
  38617. uint8: Em.DATA_TYPE_UINT8,
  38618. uint16: Em.DATA_TYPE_UINT16,
  38619. uint32: Em.DATA_TYPE_UINT32,
  38620. uint64: Em.DATA_TYPE_UINT64,
  38621. double: Em.DATA_TYPE_DOUBLE,
  38622. float: Em.DATA_TYPE_FLOAT
  38623. }, d = 0, h = i; d < h.length; d++) {
  38624. var p, f, m, v = h[d];
  38625. null != v.name ? (p = (m = v.name,
  38626. n[m] || m),
  38627. f = c[v.type],
  38628. m = v.elements,
  38629. v.description,
  38630. m = new Am(p,f,m),
  38631. u.add(m)) : (v = Am[v],
  38632. u.add(v))
  38633. }
  38634. return void 0 !== i.find(function(e) {
  38635. return "NormalX" === e.name
  38636. }) && void 0 !== i.find(function(e) {
  38637. return "NormalY" === e.name
  38638. }) && void 0 !== i.find(function(e) {
  38639. return "NormalZ" === e.name
  38640. }) && u.addVector({
  38641. name: "NORMAL",
  38642. attributes: ["NormalX", "NormalY", "NormalZ"]
  38643. }),
  38644. u
  38645. }
  38646. function Dv() {
  38647. var e = new Sm;
  38648. return e.add(Am.POSITION_CARTESIAN),
  38649. e.add(new Am("rgba",Em.DATA_TYPE_UINT8,4)),
  38650. e.add(new Am("intensity",Em.DATA_TYPE_UINT16,1)),
  38651. e.add(new Am("classification",Em.DATA_TYPE_UINT8,1)),
  38652. e.add(new Am("gps-time",Em.DATA_TYPE_DOUBLE,1)),
  38653. e.add(new Am("number of returns",Em.DATA_TYPE_UINT8,1)),
  38654. e.add(new Am("return number",Em.DATA_TYPE_UINT8,1)),
  38655. e.add(new Am("source id",Em.DATA_TYPE_UINT16,1)),
  38656. e
  38657. }
  38658. var kv = function() {
  38659. function e() {
  38660. O(this, e)
  38661. }
  38662. return h(e, [{
  38663. key: "loadPointAttributes",
  38664. value: function(e) {
  38665. for (var t = e.pointAttributes, n = new Sm, i = 0; i < t.length; i++) {
  38666. var r = Am[t[i]];
  38667. n.add(r)
  38668. }
  38669. return n
  38670. }
  38671. }, {
  38672. key: "createChildAABB",
  38673. value: function(e, t) {
  38674. var n = e.min.clone()
  38675. , i = e.max.clone()
  38676. , e = (new Cn).subVectors(i, n);
  38677. return 0 < (1 & t) ? n.z += e.z / 2 : i.z -= e.z / 2,
  38678. 0 < (2 & t) ? n.y += e.y / 2 : i.y -= e.y / 2,
  38679. 0 < (4 & t) ? n.x += e.x / 2 : i.x -= e.x / 2,
  38680. new kn(n,i)
  38681. }
  38682. }], [{
  38683. key: "load",
  38684. value: function(h, e, p) {
  38685. try {
  38686. var f = new Pm;
  38687. f.timeStamp = e,
  38688. f.url = h;
  38689. var m = Gp.createXMLHttpRequest();
  38690. m.open("GET", h + "?m=" + e, !0),
  38691. m.onreadystatechange = function() {
  38692. if (4 === m.readyState && (200 === m.status || 0 === m.status)) {
  38693. var e = JSON.parse(m.responseText)
  38694. , t = new Km(e.version);
  38695. 0 === e.octreeDir.indexOf("http") ? f.octreeDir = e.octreeDir : f.octreeDir = h + "/../" + e.octreeDir,
  38696. f.spacing = e.spacing,
  38697. f.hierarchyStepSize = e.hierarchyStepSize,
  38698. f.pointAttributes = e.pointAttributes;
  38699. var n = new Cn(e.boundingBox.lx,e.boundingBox.ly,e.boundingBox.lz)
  38700. , i = new Cn(e.boundingBox.ux,e.boundingBox.uy,e.boundingBox.uz)
  38701. , r = new kn(n,i)
  38702. , i = r.clone();
  38703. e.tightBoundingBox && (i.min.copy(new Cn(e.tightBoundingBox.lx,e.tightBoundingBox.ly,e.tightBoundingBox.lz)),
  38704. i.max.copy(new Cn(e.tightBoundingBox.ux,e.tightBoundingBox.uy,e.tightBoundingBox.uz)));
  38705. n = n.clone();
  38706. r.min.sub(n),
  38707. r.max.sub(n),
  38708. i.min.sub(n),
  38709. i.max.sub(n),
  38710. f.boundingBox = r,
  38711. f.tightBoundingBox = i,
  38712. f.boundingSphere = r.getBoundingSphere(new qn),
  38713. f.tightBoundingSphere = i.getBoundingSphere(new qn),
  38714. f.offset = n,
  38715. "LAS" === e.pointAttributes ? (f.loader = new Tv(e.version,"las"),
  38716. f.pointAttributes = Dv()) : "LAZ" === e.pointAttributes ? (f.loader = new Tv(e.version,"laz"),
  38717. f.pointAttributes = Dv()) : (f.loader = new Cv(e.version,r,e.scale),
  38718. f.pointAttributes = Pv(e));
  38719. var a = {}
  38720. , r = new Dm("r",f,r);
  38721. if (r.level = 0,
  38722. r.hasChildren = !0,
  38723. r.spacing = f.spacing,
  38724. t.upTo("1.5") ? r.numPoints = e.hierarchy[0][1] : r.numPoints = 0,
  38725. f.root = r,
  38726. f.root.load(),
  38727. a.r = r,
  38728. t.upTo("1.4"))
  38729. for (var o = 1; o < e.hierarchy.length; o++) {
  38730. var s = e.hierarchy[o][0]
  38731. , l = e.hierarchy[o][1]
  38732. , u = parseInt(s.charAt(s.length - 1))
  38733. , c = a[s.substring(0, s.length - 1)]
  38734. , d = s.length - 1
  38735. , u = Jf.createChildAABB(c.boundingBox, u)
  38736. , u = new Dm(s,f,u);
  38737. u.level = d,
  38738. u.numPoints = l,
  38739. u.spacing = f.spacing / Math.pow(2, d),
  38740. c.addChild(u),
  38741. a[s] = u
  38742. }
  38743. f.nodes = a,
  38744. p(f)
  38745. }
  38746. }
  38747. ,
  38748. m.send(null)
  38749. } catch (e) {
  38750. console.log("loading failed: '" + h + "'"),
  38751. console.log(e),
  38752. p()
  38753. }
  38754. }
  38755. }]),
  38756. e
  38757. }()
  38758. , Bv = function() {
  38759. function e() {
  38760. O(this, e)
  38761. }
  38762. var n;
  38763. return h(e, null, [{
  38764. key: "load",
  38765. value: (n = r(regeneratorRuntime.mark(function e(t, n) {
  38766. var i, r;
  38767. return regeneratorRuntime.wrap(function(e) {
  38768. for (; ; )
  38769. switch (e.prev = e.next) {
  38770. case 0:
  38771. return e.next = 2,
  38772. fetch(t);
  38773. case 2:
  38774. return i = e.sent,
  38775. e.next = 5,
  38776. i.json();
  38777. case 5:
  38778. r = e.sent,
  38779. i = t.substr(0, t.lastIndexOf("ept.json")),
  38780. i = new Potree.PointCloudEptGeometry(i,r),
  38781. r = new Potree.PointCloudEptGeometryNode(i),
  38782. i.root = r,
  38783. i.root.load(),
  38784. n(i);
  38785. case 12:
  38786. case "end":
  38787. return e.stop()
  38788. }
  38789. }, e)
  38790. })),
  38791. function(e, t) {
  38792. return n.apply(this, arguments)
  38793. }
  38794. )
  38795. }]),
  38796. e
  38797. }()
  38798. , Lv = function() {
  38799. function e() {
  38800. O(this, e)
  38801. }
  38802. return h(e, [{
  38803. key: "extension",
  38804. value: function() {
  38805. return ".bin"
  38806. }
  38807. }, {
  38808. key: "workerPath",
  38809. value: function() {
  38810. return Potree.scriptPath + "/workers/EptBinaryDecoderWorker.js"
  38811. }
  38812. }, {
  38813. key: "load",
  38814. value: function(t) {
  38815. var n = this;
  38816. if (!t.loaded) {
  38817. var i = t.url() + this.extension()
  38818. , r = Gp.createXMLHttpRequest();
  38819. r.open("GET", i, !0),
  38820. r.responseType = "arraybuffer",
  38821. r.overrideMimeType("text/plain; charset=x-user-defined"),
  38822. r.onreadystatechange = function() {
  38823. var e;
  38824. 4 === r.readyState && (200 === r.status ? (e = r.response,
  38825. n.parse(t, e)) : console.log("Failed " + i + ": " + r.status))
  38826. }
  38827. ;
  38828. try {
  38829. r.send(null)
  38830. } catch (e) {
  38831. console.log("Failed request: " + e)
  38832. }
  38833. }
  38834. }
  38835. }, {
  38836. key: "parse",
  38837. value: function(s, e) {
  38838. var l = this.workerPath()
  38839. , u = Potree.workerPool.getWorker(l);
  38840. u.onmessage = function(e) {
  38841. var t = new Mr
  38842. , n = e.data.numPoints
  38843. , i = new Float32Array(e.data.position);
  38844. t.setAttribute("position", new nr(i,3));
  38845. var r, a, i = new Uint8Array(e.data.indices);
  38846. t.setAttribute("indices", new nr(i,4)),
  38847. e.data.color && (i = new Uint8Array(e.data.color),
  38848. t.setAttribute("color", new nr(i,4,!0))),
  38849. e.data.intensity && (r = new Float32Array(e.data.intensity),
  38850. t.setAttribute("intensity", new nr(r,1))),
  38851. e.data.classification && (r = new Uint8Array(e.data.classification),
  38852. t.setAttribute("classification", new nr(r,1))),
  38853. e.data.returnNumber && (a = new Uint8Array(e.data.returnNumber),
  38854. t.setAttribute("return number", new nr(a,1))),
  38855. e.data.numberOfReturns && (a = new Uint8Array(e.data.numberOfReturns),
  38856. t.setAttribute("number of returns", new nr(a,1))),
  38857. e.data.pointSourceId && (o = new Uint16Array(e.data.pointSourceId),
  38858. t.setAttribute("source id", new nr(o,1))),
  38859. t.attributes.indices.normalized = !0;
  38860. var o = new kn((new Cn).fromArray(e.data.tightBoundingBox.min),(new Cn).fromArray(e.data.tightBoundingBox.max));
  38861. s.doneLoading(t, o, n, B(Cn, Q(e.data.mean))),
  38862. Potree.workerPool.returnWorker(l, u)
  38863. }
  38864. ;
  38865. e = {
  38866. buffer: e,
  38867. schema: s.ept.schema,
  38868. scale: s.ept.eptScale,
  38869. offset: s.ept.eptOffset,
  38870. mins: [(e = s.key.b.min).x, e.y, e.z]
  38871. };
  38872. u.postMessage(e, [e.buffer])
  38873. }
  38874. }]),
  38875. e
  38876. }()
  38877. , wh = function() {
  38878. function e() {
  38879. O(this, e)
  38880. }
  38881. var n;
  38882. return h(e, [{
  38883. key: "load",
  38884. value: function(t) {
  38885. var n, i, r = this;
  38886. t.loaded || (n = t.url() + ".laz",
  38887. (i = Gp.createXMLHttpRequest()).open("GET", n, !0),
  38888. i.responseType = "arraybuffer",
  38889. i.overrideMimeType("text/plain; charset=x-user-defined"),
  38890. i.onreadystatechange = function() {
  38891. var e;
  38892. 4 === i.readyState && (200 === i.status ? (e = i.response,
  38893. r.parse(t, e)) : console.log("Failed " + n + ": " + i.status))
  38894. }
  38895. ,
  38896. i.send(null))
  38897. }
  38898. }, {
  38899. key: "parse",
  38900. value: (n = r(regeneratorRuntime.mark(function e(t, n) {
  38901. var i, r, a, o, s, l, u, c, d;
  38902. return regeneratorRuntime.wrap(function(e) {
  38903. for (; ; )
  38904. switch (e.prev = e.next) {
  38905. case 0:
  38906. return i = new LASFile(n),
  38907. r = new Rv(t),
  38908. e.prev = 2,
  38909. e.next = 5,
  38910. i.open();
  38911. case 5:
  38912. return i.isOpen = !0,
  38913. e.next = 8,
  38914. i.getHeader();
  38915. case 8:
  38916. a = e.sent,
  38917. o = 0,
  38918. s = (d = function(e) {
  38919. return [e.x, e.y, e.z]
  38920. }
  38921. )(t.key.b.min),
  38922. l = d(t.key.b.max),
  38923. u = !0;
  38924. case 14:
  38925. if (u)
  38926. return e.next = 17,
  38927. i.readData(1e6, 0, 1);
  38928. e.next = 26;
  38929. break;
  38930. case 17:
  38931. c = e.sent,
  38932. (d = new LASDecoder(c.buffer,a.pointsFormatId,a.pointsStructSize,c.count,a.scale,a.offset,s,l)).extraBytes = a.extraBytes,
  38933. d.pointsFormatId = a.pointsFormatId,
  38934. r.push(d),
  38935. o += c.count,
  38936. u = c.hasMoreData,
  38937. e.next = 14;
  38938. break;
  38939. case 26:
  38940. return a.totalRead = o,
  38941. a.versionAsString = i.versionAsString,
  38942. a.isCompressed = i.isCompressed,
  38943. e.next = 31,
  38944. i.close();
  38945. case 31:
  38946. i.isOpen = !1,
  38947. e.next = 42;
  38948. break;
  38949. case 34:
  38950. if (e.prev = 34,
  38951. e.t0 = e.catch(2),
  38952. console.error("Error reading LAZ:", e.t0),
  38953. i.isOpen)
  38954. return e.next = 40,
  38955. i.close();
  38956. e.next = 41;
  38957. break;
  38958. case 40:
  38959. i.isOpen = !1;
  38960. case 41:
  38961. throw e.t0;
  38962. case 42:
  38963. case "end":
  38964. return e.stop()
  38965. }
  38966. }, e, null, [[2, 34]])
  38967. })),
  38968. function(e, t) {
  38969. return n.apply(this, arguments)
  38970. }
  38971. )
  38972. }]),
  38973. e
  38974. }()
  38975. , Rv = function() {
  38976. function t(e) {
  38977. O(this, t),
  38978. this.node = e
  38979. }
  38980. return h(t, [{
  38981. key: "push",
  38982. value: function(h) {
  38983. var p = this
  38984. , f = Potree.scriptPath + "/workers/EptLaszipDecoderWorker.js"
  38985. , m = Potree.workerPool.getWorker(f);
  38986. m.onmessage = function(e) {
  38987. var t = new Mr
  38988. , n = h.pointsCount
  38989. , i = new Float32Array(e.data.position)
  38990. , r = new Uint8Array(e.data.color)
  38991. , a = new Float32Array(e.data.intensity)
  38992. , o = new Uint8Array(e.data.classification)
  38993. , s = new Uint8Array(e.data.returnNumber)
  38994. , l = new Uint8Array(e.data.numberOfReturns)
  38995. , u = new Uint16Array(e.data.pointSourceID)
  38996. , c = new Uint8Array(e.data.indices)
  38997. , d = new Float32Array(e.data.gpsTime);
  38998. t.setAttribute("position", new nr(i,3)),
  38999. t.setAttribute("rgba", new nr(r,4,!0)),
  39000. t.setAttribute("intensity", new nr(a,1)),
  39001. t.setAttribute("classification", new nr(o,1)),
  39002. t.setAttribute("return number", new nr(s,1)),
  39003. t.setAttribute("number of returns", new nr(l,1)),
  39004. t.setAttribute("source id", new nr(u,1)),
  39005. t.setAttribute("indices", new nr(c,4)),
  39006. t.setAttribute("gpsTime", new nr(d,1)),
  39007. p.node.gpsTime = e.data.gpsMeta,
  39008. t.attributes.indices.normalized = !0;
  39009. d = new kn((new Cn).fromArray(e.data.tightBoundingBox.min),(new Cn).fromArray(e.data.tightBoundingBox.max));
  39010. p.node.doneLoading(t, d, n, B(Cn, Q(e.data.mean))),
  39011. Potree.workerPool.returnWorker(f, m)
  39012. }
  39013. ;
  39014. var e = {
  39015. buffer: h.arrayb,
  39016. numPoints: h.pointsCount,
  39017. pointSize: h.pointSize,
  39018. pointFormatID: h.pointsFormatId,
  39019. scale: h.scale,
  39020. offset: h.offset,
  39021. mins: h.mins,
  39022. maxs: h.maxs
  39023. };
  39024. m.postMessage(e, [e.buffer])
  39025. }
  39026. }]),
  39027. t
  39028. }()
  39029. , Pu = function() {
  39030. y(t, Lv);
  39031. var e = w(t);
  39032. function t() {
  39033. return O(this, t),
  39034. e.apply(this, arguments)
  39035. }
  39036. return h(t, [{
  39037. key: "extension",
  39038. value: function() {
  39039. return ".zst"
  39040. }
  39041. }, {
  39042. key: "workerPath",
  39043. value: function() {
  39044. return Potree.scriptPath + "/workers/EptZstandardDecoderWorker.js"
  39045. }
  39046. }]),
  39047. t
  39048. }()
  39049. , ku = function() {
  39050. function e() {
  39051. O(this, e),
  39052. this.transform = null
  39053. }
  39054. var t, n;
  39055. return h(e, [{
  39056. key: "load",
  39057. value: (n = r(regeneratorRuntime.mark(function e(t) {
  39058. var n, i, r, a, o, s, l;
  39059. return regeneratorRuntime.wrap(function(e) {
  39060. for (; ; )
  39061. switch (e.prev = e.next) {
  39062. case 0:
  39063. return n = new lf({
  39064. color: 16711680,
  39065. lineWidth: 3,
  39066. resolution: new yn(1e3,1e3),
  39067. dashed: !1
  39068. }),
  39069. e.next = 3,
  39070. this.loadShapefileFeatures(t);
  39071. case 3:
  39072. l = e.sent,
  39073. i = new Si,
  39074. r = ue(l);
  39075. try {
  39076. for (r.s(); !(a = r.n()).done; )
  39077. o = a.value,
  39078. s = this.featureToSceneNode(o, n),
  39079. i.add(s)
  39080. } catch (e) {
  39081. r.e(e)
  39082. } finally {
  39083. r.f()
  39084. }
  39085. return l = {
  39086. features: l,
  39087. node: i,
  39088. setResolution: function(e, t) {
  39089. n.resolution.set(e, t)
  39090. }
  39091. },
  39092. e.abrupt("return", l);
  39093. case 10:
  39094. case "end":
  39095. return e.stop()
  39096. }
  39097. }, e, this)
  39098. })),
  39099. function(e) {
  39100. return n.apply(this, arguments)
  39101. }
  39102. )
  39103. }, {
  39104. key: "featureToSceneNode",
  39105. value: function(e, t) {
  39106. var n = e.geometry
  39107. , i = (new Yi(1,1,1),
  39108. this.transform);
  39109. if (null === i && (i = {
  39110. forward: function(e) {
  39111. return e
  39112. }
  39113. }),
  39114. "Point" === e.geometry.type) {
  39115. var r = new Hr(new Su(1,18,18),new Xu)
  39116. , a = N(n.coordinates, 2)
  39117. , o = a[0]
  39118. , a = a[1]
  39119. , o = i.forward([o, a]);
  39120. return (a = r.position).set.apply(a, Q(o).concat([20])),
  39121. r.scale.set(10, 10, 10),
  39122. r
  39123. }
  39124. if ("LineString" === n.type) {
  39125. for (var s = [], l = new Cn(1 / 0,1 / 0,1 / 0), u = 0; u < n.coordinates.length; u++) {
  39126. var c = N(n.coordinates[u], 2)
  39127. , d = c[0]
  39128. , c = c[1]
  39129. , c = i.forward([d, c]);
  39130. l.x = Math.min(l.x, c[0]),
  39131. l.y = Math.min(l.y, c[1]),
  39132. l.z = Math.min(l.z, 20),
  39133. s.push.apply(s, Q(c).concat([20])),
  39134. 0 < u && u < n.coordinates.length - 1 && s.push.apply(s, Q(c).concat([20]))
  39135. }
  39136. for (var h = 0; h < s.length; h += 3)
  39137. s[h + 0] -= l.x,
  39138. s[h + 1] -= l.y,
  39139. s[h + 2] -= l.z;
  39140. r = new Mf;
  39141. r.setPositions(s);
  39142. r = new Af(r,t);
  39143. return r.computeLineDistances(),
  39144. r.scale.set(1, 1, 1),
  39145. r.position.copy(l),
  39146. r
  39147. }
  39148. if ("Polygon" === n.type) {
  39149. var p, f = ue(n.coordinates);
  39150. try {
  39151. for (f.s(); !(p = f.n()).done; ) {
  39152. for (var m = p.value, v = [], g = new Cn(1 / 0,1 / 0,1 / 0), y = 0; y < m.length; y++) {
  39153. var w = N(m[y], 2)
  39154. , b = w[0]
  39155. , x = w[1]
  39156. , E = i.forward([b, x]);
  39157. g.x = Math.min(g.x, E[0]),
  39158. g.y = Math.min(g.y, E[1]),
  39159. g.z = Math.min(g.z, 20),
  39160. v.push.apply(v, Q(E).concat([20])),
  39161. 0 < y && y < m.length - 1 && v.push.apply(v, Q(E).concat([20]))
  39162. }
  39163. for (var _ = 0; _ < v.length; _ += 3)
  39164. v[_ + 0] -= g.x,
  39165. v[_ + 1] -= g.y,
  39166. v[_ + 2] -= g.z;
  39167. var M = new Mf;
  39168. M.setPositions(v);
  39169. var A = new Af(M,t);
  39170. return A.computeLineDistances(),
  39171. A.scale.set(1, 1, 1),
  39172. A.position.copy(g),
  39173. A
  39174. }
  39175. } catch (e) {
  39176. f.e(e)
  39177. } finally {
  39178. f.f()
  39179. }
  39180. } else
  39181. console.log("unhandled feature: ", e)
  39182. }
  39183. }, {
  39184. key: "loadShapefileFeatures",
  39185. value: (t = r(regeneratorRuntime.mark(function e(t) {
  39186. var n, i, r;
  39187. return regeneratorRuntime.wrap(function(e) {
  39188. for (; ; )
  39189. switch (e.prev = e.next) {
  39190. case 0:
  39191. return n = [],
  39192. e.next = 3,
  39193. shapefile.open(t);
  39194. case 3:
  39195. i = e.sent;
  39196. case 4:
  39197. return e.next = 7,
  39198. i.read();
  39199. case 7:
  39200. if ((r = e.sent).done)
  39201. return e.abrupt("break", 13);
  39202. e.next = 10;
  39203. break;
  39204. case 10:
  39205. r.value && "Feature" === r.value.type && void 0 !== r.value.geometry && n.push(r.value),
  39206. e.next = 4;
  39207. break;
  39208. case 13:
  39209. return e.abrupt("return", n);
  39210. case 14:
  39211. case "end":
  39212. return e.stop()
  39213. }
  39214. }, e)
  39215. })),
  39216. function(e) {
  39217. return t.apply(this, arguments)
  39218. }
  39219. )
  39220. }]),
  39221. e
  39222. }()
  39223. , Fv = {
  39224. landuse: [.5, .5, .5],
  39225. natural: [0, 1, 0],
  39226. places: [1, 0, 1],
  39227. points: [0, 1, 1],
  39228. roads: [1, 1, 0],
  39229. waterways: [0, 0, 1],
  39230. default: [.9, .6, .1]
  39231. };
  39232. var Iv, Ov, zv, Nv, Uv, Gv, Hv = h(function e() {
  39233. O(this, e),
  39234. this.path = null,
  39235. this.node = null
  39236. }), Fu = function() {
  39237. function _() {
  39238. O(this, _)
  39239. }
  39240. var n, i;
  39241. return h(_, null, [{
  39242. key: "loadUrl",
  39243. value: (i = r(regeneratorRuntime.mark(function e(t, n) {
  39244. var i;
  39245. return regeneratorRuntime.wrap(function(e) {
  39246. for (; ; )
  39247. switch (e.prev = e.next) {
  39248. case 0:
  39249. return e.next = 2,
  39250. Promise.all([Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/geopackage/geopackage.js")), Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.js"))]);
  39251. case 2:
  39252. return e.next = 4,
  39253. fetch(t);
  39254. case 4:
  39255. return i = e.sent,
  39256. e.next = 7,
  39257. i.arrayBuffer();
  39258. case 7:
  39259. return i = e.sent,
  39260. (n = n || {}).source = t,
  39261. e.abrupt("return", _.loadBuffer(i, n));
  39262. case 11:
  39263. case "end":
  39264. return e.stop()
  39265. }
  39266. }, e)
  39267. })),
  39268. function(e, t) {
  39269. return i.apply(this, arguments)
  39270. }
  39271. )
  39272. }, {
  39273. key: "loadBuffer",
  39274. value: (n = r(regeneratorRuntime.mark(function e(x, E) {
  39275. var t;
  39276. return regeneratorRuntime.wrap(function(e) {
  39277. for (; ; )
  39278. switch (e.prev = e.next) {
  39279. case 0:
  39280. return e.next = 2,
  39281. Promise.all([Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/geopackage/geopackage.js")), Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.js"))]);
  39282. case 2:
  39283. return E = E || {},
  39284. t = function() {
  39285. var t = r(regeneratorRuntime.mark(function e(t) {
  39286. var n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b;
  39287. return regeneratorRuntime.wrap(function(e) {
  39288. for (; ; )
  39289. switch (e.prev = e.next) {
  39290. case 0:
  39291. return n = (n = E.transform) || {
  39292. forward: function(e) {
  39293. return e
  39294. }
  39295. },
  39296. i = "".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.wasm"),
  39297. e.next = 5,
  39298. initSqlJs({
  39299. locateFile: function(e) {
  39300. return i
  39301. }
  39302. });
  39303. case 5:
  39304. return e.sent,
  39305. o = new Uint8Array(x),
  39306. e.next = 9,
  39307. geopackage.open(o);
  39308. case 9:
  39309. r = e.sent,
  39310. window.data = r,
  39311. (o = new Si).name = E.source,
  39312. o.potree = {
  39313. source: E.source
  39314. },
  39315. (a = new Hv).path = E.source,
  39316. a.node = o,
  39317. o = r.getTables(),
  39318. s = ue(o.features);
  39319. try {
  39320. for (s.s(); !(l = s.n()).done; )
  39321. for (c = l.value,
  39322. d = r.getFeatureDao(c),
  39323. h = (h = d.getBoundingBox()).projectBoundingBox(d.projection, "EPSG:4326"),
  39324. p = r.queryForGeoJSONFeaturesInTable(c, h),
  39325. f = new lf({
  39326. color: (u = new Yi).setRGB.apply(u, Q(Fv[c] || Fv.default)),
  39327. lineWidth: 2,
  39328. resolution: new yn(1e3,1e3),
  39329. dashed: !1
  39330. }),
  39331. (m = new Si).name = c,
  39332. a.node.add(m),
  39333. v = 0,
  39334. g = Object.entries(p); v < g.length; v++)
  39335. y = N(g[v], 2),
  39336. y[0],
  39337. w = y[1],
  39338. b = _.featureToSceneNode(w, f, d.projection, n),
  39339. m.add(b)
  39340. } catch (e) {
  39341. s.e(e)
  39342. } finally {
  39343. s.f()
  39344. }
  39345. t(a);
  39346. case 21:
  39347. case "end":
  39348. return e.stop()
  39349. }
  39350. }, e)
  39351. }));
  39352. return function(e) {
  39353. return t.apply(this, arguments)
  39354. }
  39355. }(),
  39356. e.abrupt("return", new Promise(t));
  39357. case 5:
  39358. case "end":
  39359. return e.stop()
  39360. }
  39361. }, e)
  39362. })),
  39363. function(e, t) {
  39364. return n.apply(this, arguments)
  39365. }
  39366. )
  39367. }, {
  39368. key: "featureToSceneNode",
  39369. value: function(e, t, n, i) {
  39370. var r = e.geometry;
  39371. new Yi(1,1,1);
  39372. if ("Point" === e.geometry.type) {
  39373. var a = new Hr(new Su(1,18,18),new Xu)
  39374. , o = N(r.coordinates, 2)
  39375. , s = o[0]
  39376. , o = o[1]
  39377. , s = i.forward(n.forward([s, o]));
  39378. return (o = a.position).set.apply(o, Q(s).concat([20])),
  39379. a.scale.set(10, 10, 10),
  39380. a
  39381. }
  39382. if ("LineString" === r.type) {
  39383. for (var l = [], u = new Cn(1 / 0,1 / 0,1 / 0), c = 0; c < r.coordinates.length; c++) {
  39384. var d = N(r.coordinates[c], 2)
  39385. , h = d[0]
  39386. , d = d[1]
  39387. , d = i.forward(n.forward([h, d]));
  39388. u.x = Math.min(u.x, d[0]),
  39389. u.y = Math.min(u.y, d[1]),
  39390. u.z = Math.min(u.z, 20),
  39391. l.push.apply(l, Q(d).concat([20])),
  39392. 0 < c && c < r.coordinates.length - 1 && l.push.apply(l, Q(d).concat([20]))
  39393. }
  39394. for (var p = 0; p < l.length; p += 3)
  39395. l[p + 0] -= u.x,
  39396. l[p + 1] -= u.y,
  39397. l[p + 2] -= u.z;
  39398. a = new Mf;
  39399. a.setPositions(l);
  39400. a = new Af(a,t);
  39401. return a.computeLineDistances(),
  39402. a.scale.set(1, 1, 1),
  39403. a.position.copy(u),
  39404. a
  39405. }
  39406. if ("Polygon" === r.type) {
  39407. var f, m = ue(r.coordinates);
  39408. try {
  39409. for (m.s(); !(f = m.n()).done; ) {
  39410. for (var v = f.value, g = [], y = new Cn(1 / 0,1 / 0,1 / 0), w = 0; w < v.length; w++) {
  39411. var b = N(v[w], 2)
  39412. , x = b[0]
  39413. , E = b[1]
  39414. , _ = i.forward(n.forward([x, E]));
  39415. y.x = Math.min(y.x, _[0]),
  39416. y.y = Math.min(y.y, _[1]),
  39417. y.z = Math.min(y.z, 20),
  39418. g.push.apply(g, Q(_).concat([20])),
  39419. 0 < w && w < v.length - 1 && g.push.apply(g, Q(_).concat([20]))
  39420. }
  39421. for (var M = 0; M < g.length; M += 3)
  39422. g[M + 0] -= y.x,
  39423. g[M + 1] -= y.y,
  39424. g[M + 2] -= y.z;
  39425. var A = new Mf;
  39426. A.setPositions(g);
  39427. var T = new Af(A,t);
  39428. return T.computeLineDistances(),
  39429. T.scale.set(1, 1, 1),
  39430. T.position.copy(y),
  39431. T
  39432. }
  39433. } catch (e) {
  39434. m.e(e)
  39435. } finally {
  39436. m.f()
  39437. }
  39438. } else
  39439. console.log("unhandled feature: ", e)
  39440. }
  39441. }]),
  39442. _
  39443. }(), Vv = function() {
  39444. y(o, Si);
  39445. var a = w(o);
  39446. function o() {
  39447. var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  39448. O(this, o),
  39449. (n = a.call(this)).constructor.counter = void 0 === n.constructor.counter ? 0 : n.constructor.counter + 1,
  39450. n.name = "clip_volume_" + n.constructor.counter;
  39451. var t = e.alpha || 0
  39452. , i = e.beta || 0
  39453. , e = e.gamma || 0;
  39454. n.rotation.x = t,
  39455. n.rotation.y = i,
  39456. n.rotation.z = e,
  39457. n.clipOffset = .001,
  39458. n.clipRotOffset = 1;
  39459. t = new Cl(1,1,1);
  39460. t.computeBoundingBox();
  39461. i = new Sl;
  39462. i.vertices.push(new Cn(-.5,-.5,.5)),
  39463. i.vertices.push(new Cn(.5,-.5,.5)),
  39464. i.vertices.push(new Cn(.5,-.5,.5)),
  39465. i.vertices.push(new Cn(.5,-.5,-.5)),
  39466. i.vertices.push(new Cn(.5,-.5,-.5)),
  39467. i.vertices.push(new Cn(-.5,-.5,-.5)),
  39468. i.vertices.push(new Cn(-.5,-.5,-.5)),
  39469. i.vertices.push(new Cn(-.5,-.5,.5)),
  39470. i.vertices.push(new Cn(-.5,.5,.5)),
  39471. i.vertices.push(new Cn(.5,.5,.5)),
  39472. i.vertices.push(new Cn(.5,.5,.5)),
  39473. i.vertices.push(new Cn(.5,.5,-.5)),
  39474. i.vertices.push(new Cn(.5,.5,-.5)),
  39475. i.vertices.push(new Cn(-.5,.5,-.5)),
  39476. i.vertices.push(new Cn(-.5,.5,-.5)),
  39477. i.vertices.push(new Cn(-.5,.5,.5)),
  39478. i.vertices.push(new Cn(-.5,-.5,.5)),
  39479. i.vertices.push(new Cn(-.5,.5,.5)),
  39480. i.vertices.push(new Cn(.5,-.5,.5)),
  39481. i.vertices.push(new Cn(.5,.5,.5)),
  39482. i.vertices.push(new Cn(.5,-.5,-.5)),
  39483. i.vertices.push(new Cn(.5,.5,-.5)),
  39484. i.vertices.push(new Cn(-.5,-.5,-.5)),
  39485. i.vertices.push(new Cn(-.5,.5,-.5)),
  39486. i.colors.push(new Cn(1,1,1));
  39487. e = new Sl;
  39488. e.vertices.push(new Cn(-.5,-.5,0)),
  39489. e.vertices.push(new Cn(-.5,.5,0)),
  39490. e.vertices.push(new Cn(.5,.5,0)),
  39491. e.vertices.push(new Cn(.5,-.5,0)),
  39492. e.vertices.push(new Cn(-.5,.5,0)),
  39493. e.vertices.push(new Cn(.5,.5,0)),
  39494. e.vertices.push(new Cn(-.5,-.5,0)),
  39495. e.vertices.push(new Cn(.5,-.5,0)),
  39496. n.dimension = new Cn(1,1,1),
  39497. n.material = new $i({
  39498. color: 65280,
  39499. transparent: !0,
  39500. opacity: .3,
  39501. depthTest: !0,
  39502. depthWrite: !1
  39503. }),
  39504. n.box = new Hr(t,n.material),
  39505. n.box.geometry.computeBoundingBox(),
  39506. n.boundingBox = n.box.geometry.boundingBox,
  39507. n.add(n.box),
  39508. n.frame = new cl(i,new tl({
  39509. color: 0
  39510. })),
  39511. n.add(n.frame),
  39512. n.planeFrame = new cl(e,new tl({
  39513. color: 16711680
  39514. })),
  39515. n.add(n.planeFrame),
  39516. n.setScaleZ(.1);
  39517. function r(e, t, n) {
  39518. var i = new $i({
  39519. color: n,
  39520. depthTest: !1,
  39521. depthWrite: !1
  39522. })
  39523. , r = new Sl;
  39524. return r.vertices.push(new Cn(0,0,0)),
  39525. r.vertices.push(new Cn(0,1,0)),
  39526. (r = new sl(r,new tl({
  39527. color: n,
  39528. depthTest: !1,
  39529. depthWrite: !1,
  39530. transparent: !0
  39531. }))).name = e + "_shaft",
  39532. (n = new Hr(new Bl(0,.04,.1,10,1,!1),i)).name = e + "_head",
  39533. n.position.y = 1,
  39534. (i = new Si).name = e,
  39535. i.add(r),
  39536. i.add(n),
  39537. i
  39538. }
  39539. return n.arrowX = r("arrow_x", new Cn(1,0,0), 16711680),
  39540. n.arrowY = r("arrow_y", new Cn(0,1,0), 65280),
  39541. n.arrowZ = r("arrow_z", new Cn(0,0,1), 255),
  39542. n.arrowX.rotation.z = -Math.PI / 2,
  39543. n.arrowZ.rotation.x = Math.PI / 2,
  39544. n.arrowX.visible = !1,
  39545. n.arrowY.visible = !1,
  39546. n.arrowZ.visible = !1,
  39547. n.add(n.arrowX),
  39548. n.add(n.arrowY),
  39549. n.add(n.arrowZ),
  39550. n.addEventListener("ui_select", function(e) {
  39551. n.arrowX.visible = !0,
  39552. n.arrowY.visible = !0,
  39553. n.arrowZ.visible = !0
  39554. }),
  39555. n.addEventListener("ui_deselect", function(e) {
  39556. n.arrowX.visible = !1,
  39557. n.arrowY.visible = !1,
  39558. n.arrowZ.visible = !1
  39559. }),
  39560. n.addEventListener("select", function(e) {
  39561. var t = $("#" + n.name + " .scene_header");
  39562. t.next().is(":visible") || t.click()
  39563. }),
  39564. n.addEventListener("deselect", function(e) {
  39565. var t = $("#" + n.name + " .scene_header");
  39566. t.next().is(":visible") && t.click()
  39567. }),
  39568. n.update(),
  39569. n
  39570. }
  39571. return h(o, [{
  39572. key: "setClipOffset",
  39573. value: function(e) {
  39574. this.clipOffset = e
  39575. }
  39576. }, {
  39577. key: "setClipRotOffset",
  39578. value: function(e) {
  39579. this.clipRotOffset = e
  39580. }
  39581. }, {
  39582. key: "setScaleX",
  39583. value: function(e) {
  39584. this.box.scale.x = e,
  39585. this.frame.scale.x = e,
  39586. this.planeFrame.scale.x = e
  39587. }
  39588. }, {
  39589. key: "setScaleY",
  39590. value: function(e) {
  39591. this.box.scale.y = e,
  39592. this.frame.scale.y = e,
  39593. this.planeFrame.scale.y = e
  39594. }
  39595. }, {
  39596. key: "setScaleZ",
  39597. value: function(e) {
  39598. this.box.scale.z = e,
  39599. this.frame.scale.z = e,
  39600. this.planeFrame.scale.z = e
  39601. }
  39602. }, {
  39603. key: "offset",
  39604. value: function(e) {
  39605. var t = e.cs || null
  39606. , n = e.axis || null
  39607. , e = e.dir || null;
  39608. t && n && e && ("x" === n ? "local" === t ? this.position.add(this.localX.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.x = this.position.x + e * this.clipOffset) : "y" === n ? "local" === t ? this.position.add(this.localY.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.y = this.position.y + e * this.clipOffset) : "z" === n && ("local" === t ? this.position.add(this.localZ.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.z = this.position.z + e * this.clipOffset)),
  39609. this.dispatchEvent({
  39610. type: "clip_volume_changed",
  39611. viewer: viewer,
  39612. volume: this
  39613. }))
  39614. }
  39615. }, {
  39616. key: "rotate",
  39617. value: function(e) {
  39618. var t = e.cs || null
  39619. , n = e.axis || null
  39620. , e = e.dir || null;
  39621. t && n && e && ("local" === t ? "x" === n ? this.rotateOnAxis(new Cn(1,0,0), e * this.clipRotOffset * Math.PI / 180) : "y" === n ? this.rotateOnAxis(new Cn(0,1,0), e * this.clipRotOffset * Math.PI / 180) : "z" === n && this.rotateOnAxis(new Cn(0,0,1), e * this.clipRotOffset * Math.PI / 180) : "global" === t && (t = new Mn(1,0,0,0),
  39622. "y" === n ? t = new Mn(0,1,0,0) : "z" === n && (t = new Mn(0,0,1,0)),
  39623. this.updateMatrixWorld(),
  39624. n = newthis.matrixWorld.clone().invert(),
  39625. t = t.applyMatrix4(n).normalize(),
  39626. t = new Cn(t.x,t.y,t.z),
  39627. this.rotateOnAxis(t, e * this.clipRotOffset * Math.PI / 180)),
  39628. this.updateLocalSystem(),
  39629. this.dispatchEvent({
  39630. type: "clip_volume_changed",
  39631. viewer: viewer,
  39632. volume: this
  39633. }))
  39634. }
  39635. }, {
  39636. key: "update",
  39637. value: function() {
  39638. this.boundingBox = this.box.geometry.boundingBox,
  39639. this.boundingSphere = this.boundingBox.getBoundingSphere(new qn),
  39640. this.box.visible = !1,
  39641. this.updateLocalSystem()
  39642. }
  39643. }, {
  39644. key: "updateLocalSystem",
  39645. value: function() {
  39646. var e = this.getWorldQuaternion();
  39647. this.localX = new Cn(1,0,0).applyQuaternion(e).normalize(),
  39648. this.localY = new Cn(0,1,0).applyQuaternion(e).normalize(),
  39649. this.localZ = new Cn(0,0,1).applyQuaternion(e).normalize()
  39650. }
  39651. }, {
  39652. key: "raycast",
  39653. value: function(e, t) {
  39654. var n = [];
  39655. this.box.raycast(e, n),
  39656. 0 < n.length && t.push({
  39657. distance: (n = n[0]).distance,
  39658. object: this,
  39659. point: n.point.clone()
  39660. })
  39661. }
  39662. }]),
  39663. o
  39664. }(), jv = function() {
  39665. y(i, hn);
  39666. var n = w(i);
  39667. function i(e) {
  39668. var t;
  39669. return O(this, i),
  39670. (t = n.call(this)).viewer = e,
  39671. t.maxPolygonVertices = 8,
  39672. t.addEventListener("start_inserting_clipping_volume", function(e) {
  39673. t.viewer.dispatchEvent({
  39674. type: "cancel_insertions"
  39675. })
  39676. }),
  39677. t.sceneMarker = new gs,
  39678. t.sceneVolume = new gs,
  39679. t.sceneVolume.name = "scene_clip_volume",
  39680. t.viewer.inputHandler.registerInteractiveScene(t.sceneVolume),
  39681. t.onRemove = function(e) {
  39682. t.sceneVolume.remove(e.volume)
  39683. }
  39684. ,
  39685. t.onAdd = function(e) {
  39686. t.sceneVolume.add(e.volume)
  39687. }
  39688. ,
  39689. t.viewer.inputHandler.addEventListener("delete", function(e) {
  39690. e.selection.filter(function(e) {
  39691. return e instanceof Vv
  39692. }).forEach(function(e) {
  39693. return t.viewer.scene.removeClipVolume(e)
  39694. }),
  39695. e.selection.filter(function(e) {
  39696. return e instanceof qf
  39697. }).forEach(function(e) {
  39698. return t.viewer.scene.removePolygonClipVolume(e)
  39699. })
  39700. }),
  39701. t
  39702. }
  39703. return h(i, [{
  39704. key: "setScene",
  39705. value: function(e) {
  39706. this.scene !== e && (this.scene && (this.scene.removeEventListeners("clip_volume_added", this.onAdd),
  39707. this.scene.removeEventListeners("clip_volume_removed", this.onRemove),
  39708. this.scene.removeEventListeners("polygon_clip_volume_added", this.onAdd),
  39709. this.scene.removeEventListeners("polygon_clip_volume_removed", this.onRemove)),
  39710. this.scene = e,
  39711. this.scene.addEventListener("clip_volume_added", this.onAdd),
  39712. this.scene.addEventListener("clip_volume_removed", this.onRemove),
  39713. this.scene.addEventListener("polygon_clip_volume_added", this.onAdd),
  39714. this.scene.addEventListener("polygon_clip_volume_removed", this.onRemove))
  39715. }
  39716. }, {
  39717. key: "startInsertion",
  39718. value: function() {
  39719. var t = this;
  39720. if (!((0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).type || null))
  39721. return null;
  39722. var e = this.viewer.renderer.domElement
  39723. , n = this.viewer.renderer.getSize(new yn)
  39724. , r = $('\n\t\t<svg height="'.concat(n.height, '" width="').concat(n.width, '" style="position:absolute; pointer-events: none">\n\n\t\t\t<defs>\n\t\t\t\t <marker id="diamond" markerWidth="24" markerHeight="24" refX="12" refY="12"\n\t\t\t\t\t\tmarkerUnits="userSpaceOnUse">\n\t\t\t\t\t<circle cx="12" cy="12" r="6" fill="white" stroke="black" stroke-width="3"/>\n\t\t\t\t</marker>\n\t\t\t</defs>\n\n\t\t\t<polyline fill="none" stroke="black" \n\t\t\t\tstyle="stroke:rgb(0, 0, 0);\n\t\t\t\tstroke-width:6;"\n\t\t\t\tstroke-dasharray="9, 6"\n\t\t\t\tstroke-dashoffset="2"\n\t\t\t\t/>\n\n\t\t\t<polyline fill="none" stroke="black" \n\t\t\t\tstyle="stroke:rgb(255, 255, 255);\n\t\t\t\tstroke-width:2;"\n\t\t\t\tstroke-dasharray="5, 10"\n\t\t\t\tmarker-start="url(#diamond)" \n\t\t\t\tmarker-mid="url(#diamond)" \n\t\t\t\tmarker-end="url(#diamond)" \n\t\t\t\t/>\n\t\t</svg>'));
  39725. $(e.parentElement).append(r);
  39726. var a = new qf(this.viewer.scene.getActiveCamera().clone());
  39727. this.dispatchEvent({
  39728. type: "start_inserting_clipping_volume"
  39729. }),
  39730. this.viewer.scene.addPolygonClipVolume(a),
  39731. this.sceneMarker.add(a);
  39732. function i(i) {
  39733. i.button === C.LEFT ? (a.addMarker(),
  39734. r.find("polyline").each(function(e, t) {
  39735. var n = r[0].createSVGPoint();
  39736. n.x = i.offsetX,
  39737. n.y = i.offsetY;
  39738. t.points.appendItem(n)
  39739. }),
  39740. a.markers.length > t.maxPolygonVertices && o.callback(),
  39741. t.viewer.inputHandler.startDragging(a.markers[a.markers.length - 1])) : i.button === C.RIGHT && o.callback(i)
  39742. }
  39743. var o = {
  39744. callback: null
  39745. };
  39746. return o.callback = function(e) {
  39747. r.remove(),
  39748. 3 < a.markers.length ? (a.removeLastMarker(),
  39749. a.initialized = !0) : t.viewer.scene.removePolygonClipVolume(a),
  39750. t.viewer.renderer.domElement.removeEventListener("mouseup", i, !0),
  39751. t.viewer.removeEventListener("cancel_insertions", o.callback),
  39752. t.viewer.inputHandler.enabled = !0
  39753. }
  39754. ,
  39755. this.viewer.addEventListener("cancel_insertions", o.callback),
  39756. this.viewer.renderer.domElement.addEventListener("mouseup", i, !0),
  39757. this.viewer.inputHandler.enabled = !1,
  39758. a.addMarker(),
  39759. this.viewer.inputHandler.startDragging(a.markers[a.markers.length - 1]),
  39760. a
  39761. }
  39762. }, {
  39763. key: "update",
  39764. value: function() {}
  39765. }]),
  39766. i
  39767. }();
  39768. Ou = {},
  39769. Iv = new Mh({
  39770. LITTLE: "II",
  39771. BIG: "MM"
  39772. }),
  39773. Ov = new Mh({
  39774. BYTE: {
  39775. value: 1,
  39776. bytes: 1
  39777. },
  39778. ASCII: {
  39779. value: 2,
  39780. bytes: 1
  39781. },
  39782. SHORT: {
  39783. value: 3,
  39784. bytes: 2
  39785. },
  39786. LONG: {
  39787. value: 4,
  39788. bytes: 4
  39789. },
  39790. RATIONAL: {
  39791. value: 5,
  39792. bytes: 8
  39793. },
  39794. SBYTE: {
  39795. value: 6,
  39796. bytes: 1
  39797. },
  39798. UNDEFINED: {
  39799. value: 7,
  39800. bytes: 1
  39801. },
  39802. SSHORT: {
  39803. value: 8,
  39804. bytes: 2
  39805. },
  39806. SLONG: {
  39807. value: 9,
  39808. bytes: 4
  39809. },
  39810. SRATIONAL: {
  39811. value: 10,
  39812. bytes: 8
  39813. },
  39814. FLOAT: {
  39815. value: 11,
  39816. bytes: 4
  39817. },
  39818. DOUBLE: {
  39819. value: 12,
  39820. bytes: 8
  39821. }
  39822. }),
  39823. zv = new Mh({
  39824. IMAGE_WIDTH: 256,
  39825. IMAGE_HEIGHT: 257,
  39826. BITS_PER_SAMPLE: 258,
  39827. COMPRESSION: 259,
  39828. PHOTOMETRIC_INTERPRETATION: 262,
  39829. STRIP_OFFSETS: 273,
  39830. ORIENTATION: 274,
  39831. SAMPLES_PER_PIXEL: 277,
  39832. ROWS_PER_STRIP: 278,
  39833. STRIP_BYTE_COUNTS: 279,
  39834. X_RESOLUTION: 282,
  39835. Y_RESOLUTION: 283,
  39836. PLANAR_CONFIGURATION: 284,
  39837. RESOLUTION_UNIT: 296,
  39838. SOFTWARE: 305,
  39839. COLOR_MAP: 320,
  39840. SAMPLE_FORMAT: 339,
  39841. MODEL_PIXEL_SCALE: 33550,
  39842. MODEL_TIEPOINT: 33922,
  39843. GEO_KEY_DIRECTORY: 34735,
  39844. GEO_DOUBLE_PARAMS: 34736,
  39845. GEO_ASCII_PARAMS: 34737
  39846. }),
  39847. Nv = new Map([[Ov.BYTE, Uint8Array], [Ov.ASCII, Uint8Array], [Ov.SHORT, Uint16Array], [Ov.LONG, Uint32Array], [Ov.RATIONAL, Uint32Array], [Ov.SBYTE, Int8Array], [Ov.UNDEFINED, Uint8Array], [Ov.SSHORT, Int16Array], [Ov.SLONG, Int32Array], [Ov.SRATIONAL, Int32Array], [Ov.FLOAT, Float32Array], [Ov.DOUBLE, Float64Array]]),
  39848. Uv = h(function e(t, n, i, r, a) {
  39849. O(this, e),
  39850. this.tag = t,
  39851. this.type = n,
  39852. this.count = i,
  39853. this.offset = r,
  39854. this.value = a
  39855. }),
  39856. Gv = h(function e() {
  39857. O(this, e),
  39858. this.width = 0,
  39859. this.height = 0,
  39860. this.buffer = null,
  39861. this.metadata = []
  39862. }),
  39863. rh = function() {
  39864. function e() {
  39865. O(this, e)
  39866. }
  39867. return h(e, null, [{
  39868. key: "read",
  39869. value: function(e) {
  39870. var t = String.fromCharCode.apply(String, Q(Array.from(e.slice(0, 2))));
  39871. Iv.fromValue(t);
  39872. if (42 !== e.readUInt8(2))
  39873. throw new Error("not a valid tiff file");
  39874. var n = e.readUInt32LE(4);
  39875. console.log("offsetToFirstIFD", n);
  39876. for (var r = [], i = n, a = 0; a < 100; ) {
  39877. console.log("currentIFDOffset", i);
  39878. var o = e.readUInt16LE(i)
  39879. , s = e.readUInt32LE(i + 2 + 12 * o);
  39880. console.log("next offset: ", i + 2 + 12 * o);
  39881. for (var l = e.slice(i + 2, i + 2 + 12 * o), u = 0; u < o; u++) {
  39882. var c, d = zv.fromValue(l.readUInt16LE(12 * u)), h = Ov.fromValue(l.readUInt16LE(12 * u + 2)), p = l.readUInt32LE(12 * u + 4), f = l.readUInt32LE(12 * u + 8), m = h.bytes * p, v = void 0;
  39883. m <= 4 ? v = f : ((c = new Uint8Array(m)).set(e.slice(f, f + m)),
  39884. v = new (Nv.get(h))(c.buffer),
  39885. h === Ov.ASCII && (v = String.fromCharCode.apply(String, Q(v))));
  39886. v = new Uv(d,h,p,f,v);
  39887. r.push(v)
  39888. }
  39889. if (console.log("nextIFDOffset", s),
  39890. 0 === s)
  39891. break;
  39892. i = s,
  39893. a++
  39894. }
  39895. for (var t = function(e) {
  39896. var t, n = ue(r);
  39897. try {
  39898. for (n.s(); !(t = n.n()).done; ) {
  39899. var i = t.value;
  39900. if (i.tag === e)
  39901. return i
  39902. }
  39903. } catch (e) {
  39904. n.e(e)
  39905. } finally {
  39906. n.f()
  39907. }
  39908. return null
  39909. }, g = t(zv.IMAGE_WIDTH).value, n = t(zv.IMAGE_HEIGHT).value, y = (t(zv.COMPRESSION).value,
  39910. t(zv.ROWS_PER_STRIP).value), w = t(zv.STRIP_OFFSETS), b = t(zv.STRIP_BYTE_COUNTS), x = Math.ceil(n / y), E = [], _ = 0; _ < b.count; _++) {
  39911. var M = b.type
  39912. , A = b.offset + _ * M.bytes
  39913. , T = void 0;
  39914. M === Ov.SHORT ? T = e.readUInt16LE(A) : M === Ov.LONG && (T = e.readUInt32LE(A)),
  39915. E.push(T)
  39916. }
  39917. for (var S = [], C = 0; C < w.count; C++) {
  39918. var P = w.type
  39919. , D = w.offset + C * P.bytes
  39920. , k = void 0;
  39921. P === Ov.SHORT ? k = e.readUInt16LE(D) : P === Ov.LONG && (k = e.readUInt32LE(D)),
  39922. S.push(k)
  39923. }
  39924. for (var B = new Uint8Array(g * n * 3), L = 0, R = 0; R < x; R++)
  39925. for (var F = S[R], I = E[R], O = e.slice(F, F + I), z = 3 * g, N = 0; N < y; N++) {
  39926. var U = O.slice(N * z, N * z + z);
  39927. if (B.set(U, L * z),
  39928. U.length !== z)
  39929. break;
  39930. L++
  39931. }
  39932. console.log("width: ".concat(g)),
  39933. console.log("height: ".concat(n)),
  39934. console.log("numStrips: ".concat(x)),
  39935. console.log("stripByteCounts", E.join(", ")),
  39936. console.log("stripOffsets", S.join(", "));
  39937. t = new Gv;
  39938. return t.width = g,
  39939. t.height = n,
  39940. t.buffer = B,
  39941. t.metadata = r,
  39942. t
  39943. }
  39944. }]),
  39945. e
  39946. }(),
  39947. Ch = function() {
  39948. function e() {
  39949. O(this, e)
  39950. }
  39951. return h(e, null, [{
  39952. key: "toTiffBuffer",
  39953. value: function(e) {
  39954. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  39955. , n = new Uint8Array([73, 73, 42, 0, 8, 0, 0, 0])
  39956. , i = [e.width, e.height]
  39957. , r = i[0]
  39958. , a = i[1]
  39959. , i = [new Uv(zv.IMAGE_WIDTH,Ov.SHORT,1,null,r), new Uv(zv.IMAGE_HEIGHT,Ov.SHORT,1,null,a), new Uv(zv.BITS_PER_SAMPLE,Ov.SHORT,4,null,new Uint16Array([8, 8, 8, 8])), new Uv(zv.COMPRESSION,Ov.SHORT,1,null,1), new Uv(zv.PHOTOMETRIC_INTERPRETATION,Ov.SHORT,1,null,2), new Uv(zv.ORIENTATION,Ov.SHORT,1,null,1), new Uv(zv.SAMPLES_PER_PIXEL,Ov.SHORT,1,null,4), new Uv(zv.ROWS_PER_STRIP,Ov.LONG,1,null,a), new Uv(zv.STRIP_BYTE_COUNTS,Ov.LONG,1,null,r * a * 3), new Uv(zv.PLANAR_CONFIGURATION,Ov.SHORT,1,null,1), new Uv(zv.RESOLUTION_UNIT,Ov.SHORT,1,null,1), new Uv(zv.SOFTWARE,Ov.ASCII,6,null,"......"), new Uv(zv.STRIP_OFFSETS,Ov.LONG,1,null,null), new Uv(zv.X_RESOLUTION,Ov.RATIONAL,1,null,new Uint32Array([1, 1])), new Uv(zv.Y_RESOLUTION,Ov.RATIONAL,1,null,new Uint32Array([1, 1]))];
  39960. t.ifdEntries && i.push.apply(i, Q(t.ifdEntries));
  39961. for (var o = 10 + 12 * i.length + 4, s = new Map, l = new Map, u = 0, c = i; u < c.length; u++) {
  39962. var d = c[u]
  39963. , h = new ArrayBuffer(12)
  39964. , p = new DataView(h);
  39965. d.type.bytes,
  39966. d.count;
  39967. p.setUint16(0, d.tag.value, !0),
  39968. p.setUint16(2, d.type.value, !0),
  39969. p.setUint32(4, d.count, !0),
  39970. 1 === d.count && d.type.bytes <= 4 ? p.setUint32(8, d.value, !0) : (p.setUint32(8, o, !0),
  39971. p = new Uint8Array(d.count * d.type.bytes),
  39972. d.type === Ov.ASCII ? p.set(new Uint8Array(d.value.split("").map(function(e) {
  39973. return e.charCodeAt(0)
  39974. }))) : p.set(new Uint8Array(d.value.buffer)),
  39975. l.set(d.tag, p),
  39976. o += p.byteLength),
  39977. s.set(d.tag, h)
  39978. }
  39979. t = o;
  39980. new DataView(s.get(zv.STRIP_OFFSETS)).setUint32(8, t, !0);
  39981. function f(e) {
  39982. var t, n = e.reduce(function(e, t) {
  39983. return e + t.byteLength
  39984. }, 0), i = new Uint8Array(n), r = 0, a = ue(e);
  39985. try {
  39986. for (a.s(); !(t = a.n()).done; ) {
  39987. var o = t.value;
  39988. i.set(new Uint8Array(o), r),
  39989. r += o.byteLength
  39990. }
  39991. } catch (e) {
  39992. a.e(e)
  39993. } finally {
  39994. a.f()
  39995. }
  39996. return i
  39997. }
  39998. return {
  39999. width: r,
  40000. height: a,
  40001. buffer: f([n, f([new Uint16Array([i.length])].concat(Q(s.values()), [new Uint32Array([0])])), f(Q(l.values())), e.buffer])
  40002. }
  40003. }
  40004. }]),
  40005. e
  40006. }(),
  40007. Ou.Tag = zv,
  40008. Ou.Type = Ov,
  40009. Ou.IFDEntry = Uv,
  40010. Ou.Image = Gv,
  40011. Ou.Reader = rh,
  40012. Ou.Exporter = Ch;
  40013. var Wv = function() {
  40014. y(o, hn);
  40015. var a = w(o);
  40016. function o(t) {
  40017. var n;
  40018. O(this, o),
  40019. (n = a.call(this)).viewer = t,
  40020. n.renderer = t.renderer,
  40021. n.viewer.addEventListener("start_inserting_measurement", function(e) {
  40022. n.viewer.dispatchEvent({
  40023. type: "cancel_insertions"
  40024. })
  40025. }),
  40026. n.showLabels = !0,
  40027. n.scene = new gs,
  40028. n.scene.name = "scene_measurement",
  40029. n.viewer.inputHandler.registerInteractiveScene(n.scene),
  40030. n.onRemove = function(e) {
  40031. e.measurement.dispose()
  40032. }
  40033. ,
  40034. n.onAdd = function(e) {
  40035. n.scene.add(e.measurement)
  40036. }
  40037. ;
  40038. var e, i = ue(t.scene.measurements);
  40039. try {
  40040. for (i.s(); !(e = i.n()).done; ) {
  40041. var r = e.value;
  40042. n.onAdd({
  40043. measurement: r
  40044. })
  40045. }
  40046. } catch (e) {
  40047. i.e(e)
  40048. } finally {
  40049. i.f()
  40050. }
  40051. return t.addEventListener("camera_changed", function(e) {
  40052. e.viewport == t.mainViewport && n.update()
  40053. }),
  40054. t.addEventListener("render.pass.perspective_overlay", n.render.bind(g(n))),
  40055. t.addEventListener("scene_changed", n.onSceneChange.bind(g(n))),
  40056. t.scene.addEventListener("measurement_added", n.onAdd),
  40057. t.scene.addEventListener("measurement_removed", n.onRemove),
  40058. t.addEventListener("resize", n.setSize.bind(g(n))),
  40059. n
  40060. }
  40061. return h(o, [{
  40062. key: "onSceneChange",
  40063. value: function(e) {
  40064. e.oldScene && (e.oldScene.removeEventListener("measurement_added", this.onAdd),
  40065. e.oldScene.removeEventListener("measurement_removed", this.onRemove)),
  40066. e.scene.addEventListener("measurement_added", this.onAdd),
  40067. e.scene.addEventListener("measurement_removed", this.onRemove)
  40068. }
  40069. }, {
  40070. key: "createMeasureFromData",
  40071. value: function(e) {
  40072. e = new Wf(e);
  40073. if (!e.failBuilded)
  40074. return viewer.scene.addMeasurement(e),
  40075. e.guideLine && (e.guideLine.visible = !1),
  40076. e
  40077. }
  40078. }, {
  40079. key: "update",
  40080. value: function() {}
  40081. }, {
  40082. key: "setSize",
  40083. value: function(e) {}
  40084. }, {
  40085. key: "updateLabelZIndex",
  40086. value: function(t) {
  40087. t.forEach(function(n, e) {
  40088. n.base = t[e - 1] ? t[e - 1].base + t[e - 1].labels.length : 0,
  40089. n.labels.sort(function(e, t) {
  40090. return t.pos2d.z - e.pos2d.z
  40091. }).forEach(function(e, t) {
  40092. $(e.elem).css("z-index", n.base + t)
  40093. })
  40094. })
  40095. }
  40096. }, {
  40097. key: "editStateChange",
  40098. value: function(e) {
  40099. e.state || viewer.scene.measurements.some(function(e) {
  40100. return e.isEditing
  40101. }) ? viewer.dispatchEvent({
  40102. type: "measureMovePoint"
  40103. }) : viewer.dispatchEvent({
  40104. type: "endMeasureMove"
  40105. })
  40106. }
  40107. }, {
  40108. key: "startInsertion",
  40109. value: function() {
  40110. function e(e, t) {
  40111. return null != e ? e : t
  40112. }
  40113. var i = this
  40114. , r = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  40115. , a = 1 < arguments.length ? arguments[1] : void 0;
  40116. this.viewer.renderer.domElement;
  40117. r.showDistances = null === r.showDistances || r.showDistances,
  40118. r.showArea = e(r.showArea, !1),
  40119. r.showAngles = e(r.showAngles, !1),
  40120. r.showCoordinates = e(r.showCoordinates, !1),
  40121. r.showHeight = e(r.showHeight, !1),
  40122. r.showCircle = e(r.showCircle, !1),
  40123. r.showAzimuth = e(r.showAzimuth, !1),
  40124. r.showEdges = e(r.showEdges, !0),
  40125. r.closed = e(r.closed, !1),
  40126. r.maxMarkers = e(r.maxMarkers, 1 / 0),
  40127. r.direction = r.direction,
  40128. r.type = r.type,
  40129. r.showGuideLine = e(r.showGuideLine, !1),
  40130. r.isRect = e(r.isRect, !1);
  40131. var o, s = new Wf(r);
  40132. this.scene.add(s),
  40133. s.isNew = !0,
  40134. this.viewer.dispatchEvent({
  40135. type: "start_inserting_measurement",
  40136. measure: s
  40137. }),
  40138. s.addEventListener("editStateChange", this.editStateChange.bind(this)),
  40139. s.editStateChange(!0);
  40140. var l = function(e) {
  40141. var t, n = s.points.length;
  40142. e.button == C.LEFT || e.isTouch ? n >= s.maxMarkers ? u({
  40143. finish: !0
  40144. }) : (t = s.addMarker({
  40145. point: s.points[n - 1].clone()
  40146. }),
  40147. r.isRect && 3 == s.markers.length ? s.addMarker({
  40148. point: s.points[0].clone()
  40149. }) : (s.markers[n].visible = !1,
  40150. s.edges[n].visible = !1),
  40151. s.edges[n - 1].visible = !0,
  40152. s.markers[n - 1].visible = !0,
  40153. s.editStateChange(!0),
  40154. t.isDragging = !0,
  40155. s.continueDrag(t, e)) : e.button === C.RIGHT && (e.pressDistance < Potree.config.clickMaxDragDis ? u(e) : s.continueDrag(null, e))
  40156. }
  40157. , u = function e() {
  40158. var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  40159. if (s.isNew) {
  40160. if (null != r.minMarkers && !t.finish && s.markers.length <= r.minMarkers)
  40161. return s.markers[0].removeEventListener("mousedown", e),
  40162. s.reDraw(),
  40163. i.viewer.addEventListener("global_click", p, 10),
  40164. void s.editStateChange(!0);
  40165. !t.finish && 3 < s.markers.length && (s.removeMarker(s.points.length - 1),
  40166. s.markers[0].removeEventListener("mouseover", d),
  40167. s.markers[0].removeEventListener("mouseleave", h),
  40168. s.markers[0].removeEventListener("click", c)),
  40169. s.isNew = !1;
  40170. var n = s.points.length;
  40171. n && (s.markers[n - 1].visible = !0,
  40172. s.edges[n - 1].visible = !0,
  40173. s.markers.forEach(function(e) {
  40174. e.dispatchEvent("addHoverEvent")
  40175. }),
  40176. s.edges.forEach(function(e) {
  40177. e.dispatchEvent("addHoverEvent")
  40178. })),
  40179. clearTimeout(o),
  40180. i.viewer.removeEventListener("cancel_insertions", c),
  40181. i.viewer.removeEventListener("global_click", p),
  40182. i.viewer.removeEventListener("global_mousemove", f),
  40183. viewer.dispatchEvent({
  40184. type: "CursorChange",
  40185. action: "remove",
  40186. name: "polygon_AtWrongPlace"
  40187. }),
  40188. viewer.inputHandler.dispatchEvent({
  40189. type: "isMeasuring",
  40190. v: !1,
  40191. cause: "stopInsertion"
  40192. }),
  40193. t.remove || a && a()
  40194. }
  40195. }
  40196. , c = function(e) {
  40197. e.measure && e.measure != s || (console.log("Exit: " + s.id),
  40198. e.remove && viewer.scene.removeMeasurement(s),
  40199. s.editStateChange(!1),
  40200. i.viewer.inputHandler.drag && !e.remove ? i.viewer.inputHandler.drag.object.dispatchEvent({
  40201. type: "drop",
  40202. drag: i.viewer.inputHandler.drag,
  40203. viewer: i.viewer,
  40204. pressDistance: 0,
  40205. button: C.RIGHT
  40206. }) : u({
  40207. finish: !0,
  40208. remove: e.remove
  40209. }),
  40210. i.viewer.inputHandler.drag = null)
  40211. };
  40212. this.viewer.addEventListener("cancel_insertions", c);
  40213. var d = function(e) {
  40214. s.setMarkerSelected(e.object, "hover", "single")
  40215. }
  40216. , h = function(e) {
  40217. s.setMarkerSelected(e.object, "unhover", "single")
  40218. }
  40219. , p = function e(t) {
  40220. if (!f(t) && t.button !== C.RIGHT) {
  40221. var n = t.intersect && (t.intersect.orthoIntersect || t.intersect.location);
  40222. if (!n)
  40223. return s.dispatchEvent("intersectNoPointcloud");
  40224. "mapViewport" == t.drag.dragViewport.name && (n = n.clone().setZ(viewer.mainViewport.camera.position.z));
  40225. n = s.addMarker({
  40226. point: n
  40227. });
  40228. return n.isDragging = !0,
  40229. i.viewer.inputHandler.startDragging(n, {
  40230. endDragFun: l,
  40231. notPressMouse: !0
  40232. }),
  40233. t.drag = i.viewer.inputHandler.drag,
  40234. t.drag.endDragFun = l,
  40235. t.drag.notPressMouse = !0,
  40236. s.dragMarker(t),
  40237. s.dropMarker(t),
  40238. 1 < s.maxMarkers && (s.markers[1].visible = !1,
  40239. s.edges[1].visible = !1),
  40240. 2 < s.maxMarkers && !s.isRect && (s.markers[0].addEventListener("mouseover", d),
  40241. s.markers[0].addEventListener("mouseleave", h),
  40242. s.markers[0].addEventListener("click", c)),
  40243. i.viewer.removeEventListener("global_click", e),
  40244. {
  40245. stopContinue: !0
  40246. }
  40247. }
  40248. };
  40249. viewer.inputHandler.dispatchEvent({
  40250. type: "isMeasuring",
  40251. v: !0,
  40252. cause: "startInsertion"
  40253. }),
  40254. this.viewer.addEventListener("global_click", p, 10);
  40255. var f = function(e) {
  40256. if (s.unableDragAtMap && "mapViewport" == e.hoverViewport.name)
  40257. return e.isTouch ? viewer.dispatchEvent({
  40258. type: "reticule_forbit",
  40259. v: !0
  40260. }) : viewer.dispatchEvent({
  40261. type: "CursorChange",
  40262. action: "add",
  40263. name: "polygon_AtWrongPlace"
  40264. }),
  40265. !0;
  40266. e.isTouch ? viewer.dispatchEvent({
  40267. type: "reticule_forbit",
  40268. v: !1
  40269. }) : viewer.dispatchEvent({
  40270. type: "CursorChange",
  40271. action: "remove",
  40272. name: "polygon_AtWrongPlace"
  40273. })
  40274. };
  40275. return s.unableDragAtMap && this.viewer.addEventListener("global_mousemove", f),
  40276. this.viewer.scene.addMeasurement(s),
  40277. s
  40278. }
  40279. }, {
  40280. key: "render",
  40281. value: function() {
  40282. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  40283. 0 != this.scene.children.length && (viewer.setCameraLayers(e.camera, ["measure"]),
  40284. e.screenshot ? (this.viewer.ssaaRenderPass.sampleLevel = 4,
  40285. this.viewer.composer.render(this.scene, e.camera)) : this.viewer.renderer.render(this.scene, e.camera))
  40286. }
  40287. }]),
  40288. o
  40289. }()
  40290. , Xv = function() {
  40291. function n(e) {
  40292. O(this, n),
  40293. this.content = e;
  40294. var t = "".concat(le.resourcePath, "/icons/close.svg");
  40295. this.element = $('\n\t\t\t<div class="potree_message">\n\t\t\t\t<span name="content_container" style="flex-grow: 1; padding: 5px"></span>\n\t\t\t\t<img name="close" src="'.concat(t, '" class="button-icon" style="width: 16px; height: 16px;">\n\t\t\t</div>')),
  40296. this.elClose = this.element.find("img[name=close]"),
  40297. this.elContainer = this.element.find("span[name=content_container]"),
  40298. "string" == typeof e ? this.elContainer.append($("<span>".concat(e, "</span>"))) : this.elContainer.append(e)
  40299. }
  40300. return h(n, [{
  40301. key: "setMessage",
  40302. value: function(e) {
  40303. this.elContainer.empty(),
  40304. "string" == typeof e ? this.elContainer.append($("<span>".concat(e, "</span>"))) : this.elContainer.append(e)
  40305. }
  40306. }]),
  40307. n
  40308. }()
  40309. , pu = function() {
  40310. function t(e) {
  40311. O(this, t),
  40312. this.potreeRenderer = e,
  40313. this.threeRenderer = this.potreeRenderer.threeRenderer,
  40314. this.target = new An(2048,2048,{
  40315. minFilter: Oe,
  40316. magFilter: Oe,
  40317. format: et,
  40318. type: Xe
  40319. }),
  40320. this.target.depthTexture = new El,
  40321. this.target.depthTexture.type = We,
  40322. this.threeRenderer.setClearColor(16711680, 1);
  40323. e = this.threeRenderer.getRenderTarget();
  40324. this.threeRenderer.setRenderTarget(this.target),
  40325. this.threeRenderer.setRenderTarget(e)
  40326. }
  40327. return h(t, [{
  40328. key: "setLight",
  40329. value: function(e) {
  40330. var t = 180 * (this.light = e).angle / Math.PI
  40331. , n = e.shadow.mapSize.width / e.shadow.mapSize.height
  40332. , i = 0 === e.distance ? 1e4 : e.distance;
  40333. this.camera = new $r(t,n,.1,i),
  40334. this.camera.up.set(0, 0, 1),
  40335. this.camera.position.copy(e.position);
  40336. e = (new Cn).subVectors(e.position, e.getWorldDirection(new Cn));
  40337. this.camera.lookAt(e),
  40338. this.camera.updateProjectionMatrix(),
  40339. this.camera.updateMatrix(),
  40340. this.camera.updateMatrixWorld(),
  40341. this.camera.matrixWorldInverse.copy(this.camera.matrixWorld).invert()
  40342. }
  40343. }, {
  40344. key: "setSize",
  40345. value: function(e, t) {
  40346. this.target.width === e && this.target.height === t || this.target.dispose(),
  40347. this.target.setSize(e, t)
  40348. }
  40349. }, {
  40350. key: "render",
  40351. value: function(e, t) {
  40352. this.threeRenderer.setClearColor(0, 1);
  40353. var n = this.threeRenderer.getRenderTarget();
  40354. this.threeRenderer.setRenderTarget(this.target),
  40355. this.threeRenderer.clear(!0, !0, !0),
  40356. this.potreeRenderer.render(e, this.camera, this.target, {}),
  40357. this.threeRenderer.setRenderTarget(n)
  40358. }
  40359. }]),
  40360. t
  40361. }()
  40362. , qv = function() {
  40363. y(o, hn);
  40364. var a = w(o);
  40365. function o(e) {
  40366. var t;
  40367. O(this, o),
  40368. (t = a.call(this)).viewer = e,
  40369. t.renderer = e.renderer,
  40370. t.addEventListener("start_inserting_profile", function(e) {
  40371. t.viewer.dispatchEvent({
  40372. type: "cancel_insertions"
  40373. })
  40374. }),
  40375. t.scene = new gs,
  40376. t.scene.name = "scene_profile",
  40377. t.light = new $c(16777215,1),
  40378. t.scene.add(t.light),
  40379. t.viewer.inputHandler.registerInteractiveScene(t.scene),
  40380. t.onRemove = function(e) {
  40381. return t.scene.remove(e.profile)
  40382. }
  40383. ,
  40384. t.onAdd = function(e) {
  40385. return t.scene.add(e.profile)
  40386. }
  40387. ;
  40388. var n, i = ue(e.scene.profiles);
  40389. try {
  40390. for (i.s(); !(n = i.n()).done; ) {
  40391. var r = n.value;
  40392. t.onAdd({
  40393. profile: r
  40394. })
  40395. }
  40396. } catch (e) {
  40397. i.e(e)
  40398. } finally {
  40399. i.f()
  40400. }
  40401. return e.addEventListener("update", t.update.bind(g(t))),
  40402. e.addEventListener("render.pass.perspective_overlay", t.render.bind(g(t))),
  40403. e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))),
  40404. e.scene.addEventListener("profile_added", t.onAdd),
  40405. e.scene.addEventListener("profile_removed", t.onRemove),
  40406. t
  40407. }
  40408. return h(o, [{
  40409. key: "onSceneChange",
  40410. value: function(e) {
  40411. e.oldScene && (e.oldScene.removeEventListeners("profile_added", this.onAdd),
  40412. e.oldScene.removeEventListeners("profile_removed", this.onRemove)),
  40413. e.scene.addEventListener("profile_added", this.onAdd),
  40414. e.scene.addEventListener("profile_removed", this.onRemove)
  40415. }
  40416. }, {
  40417. key: "startInsertion",
  40418. value: function() {
  40419. var r = this
  40420. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  40421. , t = this.viewer.renderer.domElement
  40422. , a = new Kp;
  40423. a.name = e.name || "Profile",
  40424. this.dispatchEvent({
  40425. type: "start_inserting_profile",
  40426. profile: a
  40427. }),
  40428. this.scene.add(a);
  40429. function n(e) {
  40430. var t, n, i;
  40431. e.button === C.LEFT ? (a.points.length <= 1 && (n = (t = r.viewer.scene.getActiveCamera()).position.distanceTo(a.points[0]),
  40432. i = r.viewer.renderer.getSize(new yn),
  40433. i = Jf.projectedRadius(1, t, n, i.width, i.height),
  40434. a.setWidth(10 / i)),
  40435. a.addMarker(a.points[a.points.length - 1].clone()),
  40436. r.viewer.inputHandler.startDragging(a.spheres[a.spheres.length - 1])) : e.button === C.RIGHT && o.callback()
  40437. }
  40438. var o = {
  40439. callback: null
  40440. };
  40441. return o.callback = function(e) {
  40442. a.removeMarker(a.points.length - 1),
  40443. t.removeEventListener("mouseup", n, !1),
  40444. r.viewer.removeEventListener("cancel_insertions", o.callback)
  40445. }
  40446. ,
  40447. this.viewer.addEventListener("cancel_insertions", o.callback),
  40448. t.addEventListener("mouseup", n, !1),
  40449. a.addMarker(new Cn(0,0,0)),
  40450. this.viewer.inputHandler.startDragging(a.spheres[a.spheres.length - 1]),
  40451. this.viewer.scene.addProfile(a),
  40452. a
  40453. }
  40454. }, {
  40455. key: "update",
  40456. value: function() {
  40457. var e = this.viewer.scene.getActiveCamera()
  40458. , t = this.viewer.scene.profiles
  40459. , n = this.viewer.renderer.getSize(new yn)
  40460. , i = n.width
  40461. , r = n.height;
  40462. this.light.position.copy(e.position);
  40463. var a, o = ue(t);
  40464. try {
  40465. for (o.s(); !(a = o.n()).done; ) {
  40466. var s, l = ue(a.value.spheres);
  40467. try {
  40468. for (l.s(); !(s = l.n()).done; ) {
  40469. var u = s.value
  40470. , c = e.position.distanceTo(u.getWorldPosition(new Cn))
  40471. , d = 15 / Jf.projectedRadius(1, e, c, i, r);
  40472. u.scale.set(d, d, d)
  40473. }
  40474. } catch (e) {
  40475. l.e(e)
  40476. } finally {
  40477. l.f()
  40478. }
  40479. }
  40480. } catch (e) {
  40481. o.e(e)
  40482. } finally {
  40483. o.f()
  40484. }
  40485. }
  40486. }, {
  40487. key: "render",
  40488. value: function() {
  40489. this.viewer.renderer.render(this.scene, this.viewer.scene.getActiveCamera())
  40490. }
  40491. }]),
  40492. o
  40493. }()
  40494. , Jv = function() {
  40495. y(i, hn);
  40496. var n = w(i);
  40497. function i(e) {
  40498. var t;
  40499. return O(this, i),
  40500. (t = n.call(this)).viewer = e,
  40501. t.scene = new gs,
  40502. e.addEventListener("update", t.update.bind(g(t))),
  40503. e.addEventListener("render.pass.perspective_overlay", t.render.bind(g(t))),
  40504. e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))),
  40505. t
  40506. }
  40507. return h(i, [{
  40508. key: "onSceneChange",
  40509. value: function(e) {
  40510. console.log("scene changed")
  40511. }
  40512. }, {
  40513. key: "startInsertion",
  40514. value: function() {
  40515. var w = this
  40516. , e = this.viewer.renderer.domElement
  40517. , b = new Zp;
  40518. b.position.set(12345, 12345, 12345),
  40519. b.showVolumeLabel = !1,
  40520. b.visible = !1,
  40521. b.update(),
  40522. this.viewer.scene.addVolume(b),
  40523. this.importance = 10;
  40524. var x = $('<div style="position: absolute; border: 2px solid white; pointer-events: none; border-style:dashed"></div>');
  40525. $(e.parentElement).append(x),
  40526. x.css("right", "10px"),
  40527. x.css("bottom", "10px");
  40528. function E(e) {
  40529. w.importance = 0,
  40530. $(x).remove(),
  40531. w.viewer.inputHandler.deselectAll(),
  40532. w.viewer.inputHandler.toggleSelection(b);
  40533. var t = e.viewer.scene.getActiveCamera()
  40534. , n = e.viewer.renderer.getSize(new yn)
  40535. , i = (new yn).addVectors(e.drag.end, e.drag.start).multiplyScalar(.5)
  40536. , r = new Cn(0,0,.5);
  40537. Jf.convertScreenPositionToNDC(r, i, n.width, n.height);
  40538. var a = Jf.mouseToRay(r, t, n.width, n.height);
  40539. w.removeEventListener("drag", _),
  40540. w.removeEventListener("drop", E);
  40541. var o, s, l, u = [], c = [], d = ue(w.viewer.scene.pointclouds);
  40542. try {
  40543. for (d.s(); !(o = d.n()).done; ) {
  40544. var h, p, f, m, v, g, y = o.value;
  40545. y.visible && ((h = t.clone()).left = -b.scale.x / 2,
  40546. h.right = +b.scale.x / 2,
  40547. h.top = +b.scale.y / 2,
  40548. h.bottom = -b.scale.y / 2,
  40549. h.near = -b.scale.z / 2,
  40550. h.far = +b.scale.z / 2,
  40551. h.rotation.copy(b.rotation),
  40552. h.position.copy(b.position),
  40553. h.updateMatrix(),
  40554. h.updateMatrixWorld(),
  40555. h.updateProjectionMatrix(),
  40556. h.matrixWorldInverse.copy(h.matrixWorld).invert(),
  40557. p = new ti(h.getWorldPosition(new Cn),h.getWorldDirection(new Cn)),
  40558. f = new ti(p.origin.clone().add(p.direction.clone().multiplyScalar(b.scale.z)),p.direction.clone().multiplyScalar(-1)),
  40559. (new yn).subVectors(e.drag.end, e.drag.start),
  40560. m = {
  40561. width: 16,
  40562. height: 16,
  40563. pickWindowSize: 16,
  40564. all: !0,
  40565. pickClipped: !0,
  40566. pointSizeType: am.FIXED,
  40567. pointSize: 1
  40568. },
  40569. v = y.pick(viewer, null, h, p, m),
  40570. h.rotateX(Math.PI),
  40571. h.updateMatrix(),
  40572. h.updateMatrixWorld(),
  40573. h.updateProjectionMatrix(),
  40574. h.matrixWorldInverse.copy(h.matrixWorld).invert(),
  40575. g = y.pick(viewer, null, h, f, m),
  40576. v && u.push.apply(u, Q(v)),
  40577. g && c.push.apply(c, Q(g)))
  40578. }
  40579. } catch (e) {
  40580. d.e(e)
  40581. } finally {
  40582. d.f()
  40583. }
  40584. (0 < u.length || 0 < c.length) && (s = new vh(a.origin,(new Cn).addVectors(a.origin, a.direction)),
  40585. i = u.map(function(e) {
  40586. return s.closestPointToPoint(e.position, !1, new Cn)
  40587. }).sort(function(e, t) {
  40588. return a.origin.distanceTo(e) - a.origin.distanceTo(t)
  40589. }),
  40590. n = c.map(function(e) {
  40591. return s.closestPointToPoint(e.position, !1, new Cn)
  40592. }).sort(function(e, t) {
  40593. return a.origin.distanceTo(t) - a.origin.distanceTo(e)
  40594. }),
  40595. i = 0 == i.length ? (l = n[n.length - 1],
  40596. n[0]) : 0 == n.length ? (l = i[i.length - 1],
  40597. i[0]) : (l = i[0],
  40598. n[0]),
  40599. n = l.distanceTo(i),
  40600. i = (new Cn).addVectors(l, i).multiplyScalar(.5),
  40601. b.scale.z = 1.1 * n,
  40602. i = i.project(t),
  40603. r.setZ(i.z),
  40604. r.unproject(t),
  40605. b.position.copy(r)),
  40606. b.clip = !0
  40607. }
  40608. var _ = function(e) {
  40609. b.visible = !0;
  40610. var t = e.drag.start
  40611. , n = e.drag.end
  40612. , i = new ph;
  40613. i.expandByPoint(t),
  40614. i.expandByPoint(n),
  40615. x.css("left", "".concat(i.min.x, "px")),
  40616. x.css("top", "".concat(i.min.y, "px")),
  40617. x.css("width", "".concat(i.max.x - i.min.x, "px")),
  40618. x.css("height", "".concat(i.max.y - i.min.y, "px"));
  40619. var r = e.viewer.scene.getActiveCamera()
  40620. , a = e.viewer.renderer.getSize(new yn)
  40621. , t = new yn(r.right - r.left,r.top - r.bottom)
  40622. , n = (new yn).addVectors(e.drag.end, e.drag.start).multiplyScalar(.5)
  40623. , i = new Cn(0,0,.5);
  40624. Jf.convertScreenPositionToNDC(i, n, a.width, a.height),
  40625. i.unproject(r);
  40626. n = (new yn).subVectors(e.drag.end, e.drag.start);
  40627. n.divide(a).multiply(t),
  40628. b.position.copy(i),
  40629. b.up.copy(r.up),
  40630. b.rotation.copy(r.rotation),
  40631. b.scale.set(n.x, n.y, 1e5),
  40632. e.consume()
  40633. };
  40634. return this.addEventListener("drag", _),
  40635. this.addEventListener("drop", E),
  40636. viewer.inputHandler.addInputListener(this),
  40637. b
  40638. }
  40639. }, {
  40640. key: "update",
  40641. value: function(e) {}
  40642. }, {
  40643. key: "render",
  40644. value: function() {
  40645. this.viewer.renderer.render(this.scene, this.viewer.scene.getActiveCamera())
  40646. }
  40647. }]),
  40648. i
  40649. }()
  40650. , mu = function() {
  40651. y(r, Si);
  40652. var i = w(r);
  40653. function r(e, t) {
  40654. var n;
  40655. O(this, r),
  40656. (n = i.call(this)).light = e,
  40657. n.color = t,
  40658. n.updateMatrix(),
  40659. n.updateMatrixWorld();
  40660. e = new Su(1,32,32),
  40661. t = new Xu;
  40662. n.sphere = new Hr(e,t),
  40663. n.sphere.scale.set(.5, .5, .5),
  40664. n.add(n.sphere);
  40665. e = new Float32Array([0, 0, 0, 0, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, -1, 0, 0, 0, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1]),
  40666. t = new Mr;
  40667. t.setAttribute("position", new nr(e,3));
  40668. e = new tl;
  40669. return n.frustum = new cl(t,e),
  40670. n.add(n.frustum),
  40671. n.update(),
  40672. n
  40673. }
  40674. return h(r, [{
  40675. key: "update",
  40676. value: function() {
  40677. this.light.updateMatrix(),
  40678. this.light.updateMatrixWorld();
  40679. var e = this.light.position
  40680. , t = (new Cn).addVectors(this.light.position, this.light.getWorldDirection(new Cn).multiplyScalar(-1))
  40681. , t = (new Sn).setFromRotationMatrix((new ni).lookAt(e, t, new Cn(0,0,1)));
  40682. this.setRotationFromQuaternion(t),
  40683. this.position.copy(e);
  40684. t = 0 < this.light.distance ? this.light.distance : 1e3,
  40685. e = t * Math.tan(.5 * this.light.angle);
  40686. this.frustum.scale.set(e, e, t)
  40687. }
  40688. }]),
  40689. r
  40690. }()
  40691. , Yv = 6710886
  40692. , Zv = function() {
  40693. function r(e) {
  40694. var s = this;
  40695. O(this, r),
  40696. this.viewer = e,
  40697. this.scene = new gs,
  40698. this.modesEnabled = {
  40699. scale: !0,
  40700. translation: !0,
  40701. rotation: !0
  40702. },
  40703. this.selection = [],
  40704. this.pivot = new Cn,
  40705. this.dragging = !1,
  40706. this.showPickVolumes = !1,
  40707. this.viewer.inputHandler.registerInteractiveScene(this.scene),
  40708. this.viewer.inputHandler.addEventListener("selection_changed", function(e) {
  40709. var t, n = ue(s.selection);
  40710. try {
  40711. for (n.s(); !(t = n.n()).done; ) {
  40712. var i = t.value;
  40713. s.viewer.inputHandler.blacklist.delete(i)
  40714. }
  40715. } catch (e) {
  40716. n.e(e)
  40717. } finally {
  40718. n.f()
  40719. }
  40720. s.selection = e.selection;
  40721. var r, a = ue(s.selection);
  40722. try {
  40723. for (a.s(); !(r = a.n()).done; ) {
  40724. var o = r.value;
  40725. s.viewer.inputHandler.blacklist.add(o)
  40726. }
  40727. } catch (e) {
  40728. a.e(e)
  40729. } finally {
  40730. a.f()
  40731. }
  40732. }),
  40733. this.viewer.addEventListener("global_touchstart", function(e) {
  40734. s.update()
  40735. });
  40736. var t = Potree.config.axis.x.color
  40737. , n = Potree.config.axis.y.color
  40738. , i = Potree.config.axis.z.color;
  40739. this.activeHandle = null,
  40740. this.scaleHandles = {
  40741. "scale.x+": {
  40742. name: "scale.x+",
  40743. node: new Si,
  40744. color: t,
  40745. alignment: [1, 0, 0]
  40746. },
  40747. "scale.x-": {
  40748. name: "scale.x-",
  40749. node: new Si,
  40750. color: t,
  40751. alignment: [-1, 0, 0]
  40752. },
  40753. "scale.y+": {
  40754. name: "scale.y+",
  40755. node: new Si,
  40756. color: n,
  40757. alignment: [0, 1, 0]
  40758. },
  40759. "scale.y-": {
  40760. name: "scale.y-",
  40761. node: new Si,
  40762. color: n,
  40763. alignment: [0, -1, 0]
  40764. },
  40765. "scale.z+": {
  40766. name: "scale.z+",
  40767. node: new Si,
  40768. color: i,
  40769. alignment: [0, 0, 1]
  40770. },
  40771. "scale.z-": {
  40772. name: "scale.z-",
  40773. node: new Si,
  40774. color: i,
  40775. alignment: [0, 0, -1]
  40776. }
  40777. },
  40778. this.focusHandles = {
  40779. "focus.x+": {
  40780. name: "focus.x+",
  40781. node: new Si,
  40782. color: t,
  40783. alignment: [1, 0, 0]
  40784. },
  40785. "focus.x-": {
  40786. name: "focus.x-",
  40787. node: new Si,
  40788. color: t,
  40789. alignment: [-1, 0, 0]
  40790. },
  40791. "focus.y+": {
  40792. name: "focus.y+",
  40793. node: new Si,
  40794. color: n,
  40795. alignment: [0, 1, 0]
  40796. },
  40797. "focus.y-": {
  40798. name: "focus.y-",
  40799. node: new Si,
  40800. color: n,
  40801. alignment: [0, -1, 0]
  40802. },
  40803. "focus.z+": {
  40804. name: "focus.z+",
  40805. node: new Si,
  40806. color: i,
  40807. alignment: [0, 0, 1]
  40808. },
  40809. "focus.z-": {
  40810. name: "focus.z-",
  40811. node: new Si,
  40812. color: i,
  40813. alignment: [0, 0, -1]
  40814. }
  40815. },
  40816. this.translationHandles = {
  40817. "translation.x": {
  40818. name: "translation.x",
  40819. node: new Si,
  40820. color: t,
  40821. alignment: [1, 0, 0]
  40822. },
  40823. "translation.y": {
  40824. name: "translation.y",
  40825. node: new Si,
  40826. color: n,
  40827. alignment: [0, 1, 0]
  40828. },
  40829. "translation.z": {
  40830. name: "translation.z",
  40831. node: new Si,
  40832. color: i,
  40833. alignment: [0, 0, 1]
  40834. }
  40835. },
  40836. this.rotationHandles = {
  40837. "rotation.x": {
  40838. name: "rotation.x",
  40839. node: new Si,
  40840. color: t,
  40841. alignment: [1, 0, 0]
  40842. },
  40843. "rotation.y": {
  40844. name: "rotation.y",
  40845. node: new Si,
  40846. color: n,
  40847. alignment: [0, 1, 0]
  40848. },
  40849. "rotation.z": {
  40850. name: "rotation.z",
  40851. node: new Si,
  40852. color: i,
  40853. alignment: [0, 0, 1]
  40854. }
  40855. },
  40856. this.handles = Object.assign({}, this.scaleHandles, {}, this.translationHandles, this.rotationHandles),
  40857. this.pickVolumes = [],
  40858. this.initializeScaleHandles(),
  40859. this.initializeFocusHandles(),
  40860. this.initializeTranslationHandles(),
  40861. this.initializeRotationHandles();
  40862. i = new Sl;
  40863. i.vertices.push(new Cn(-.5,-.5,.5)),
  40864. i.vertices.push(new Cn(.5,-.5,.5)),
  40865. i.vertices.push(new Cn(.5,-.5,.5)),
  40866. i.vertices.push(new Cn(.5,-.5,-.5)),
  40867. i.vertices.push(new Cn(.5,-.5,-.5)),
  40868. i.vertices.push(new Cn(-.5,-.5,-.5)),
  40869. i.vertices.push(new Cn(-.5,-.5,-.5)),
  40870. i.vertices.push(new Cn(-.5,-.5,.5)),
  40871. i.vertices.push(new Cn(-.5,.5,.5)),
  40872. i.vertices.push(new Cn(.5,.5,.5)),
  40873. i.vertices.push(new Cn(.5,.5,.5)),
  40874. i.vertices.push(new Cn(.5,.5,-.5)),
  40875. i.vertices.push(new Cn(.5,.5,-.5)),
  40876. i.vertices.push(new Cn(-.5,.5,-.5)),
  40877. i.vertices.push(new Cn(-.5,.5,-.5)),
  40878. i.vertices.push(new Cn(-.5,.5,.5)),
  40879. i.vertices.push(new Cn(-.5,-.5,.5)),
  40880. i.vertices.push(new Cn(-.5,.5,.5)),
  40881. i.vertices.push(new Cn(.5,-.5,.5)),
  40882. i.vertices.push(new Cn(.5,.5,.5)),
  40883. i.vertices.push(new Cn(.5,-.5,-.5)),
  40884. i.vertices.push(new Cn(.5,.5,-.5)),
  40885. i.vertices.push(new Cn(-.5,-.5,-.5)),
  40886. i.vertices.push(new Cn(-.5,.5,-.5)),
  40887. this.frame = new cl(i,new tl({
  40888. color: 16776960
  40889. })),
  40890. this.scene.add(this.frame),
  40891. e.setObjectLayers(this.scene, "transformationTool"),
  40892. this.scene.traverse(function(e) {
  40893. e.pickDontCheckDis = !0
  40894. })
  40895. }
  40896. return h(r, [{
  40897. key: "setModeEnable",
  40898. value: function(e, t) {
  40899. var n = this[e + "Handles"];
  40900. if (n) {
  40901. for (var i in n)
  40902. n[i].node.visible = !!t;
  40903. this.modesEnabled[e] = !!t
  40904. }
  40905. }
  40906. }, {
  40907. key: "initializeScaleHandles",
  40908. value: function() {
  40909. for (var l = this, u = new Su(1,32,32), c = new Su(1,16,16), d = 0, h = Object.keys(this.scaleHandles); d < h.length; d++)
  40910. !function() {
  40911. var e = h[d]
  40912. , t = l.scaleHandles[e]
  40913. , n = t.node;
  40914. l.scene.add(n),
  40915. (a = n.position).set.apply(a, Q(t.alignment)).multiplyScalar(.5);
  40916. var i = new $i({
  40917. color: t.color,
  40918. opacity: .6,
  40919. transparent: !0
  40920. })
  40921. , r = new $i({
  40922. color: Yv,
  40923. side: J,
  40924. opacity: .6,
  40925. transparent: !0
  40926. })
  40927. , a = new Xu({
  40928. opacity: .2,
  40929. transparent: !0,
  40930. visible: l.showPickVolumes
  40931. })
  40932. , o = new Hr(u,i);
  40933. o.scale.set(2, 2, 2),
  40934. o.name = "".concat(e, ".handle"),
  40935. n.add(o);
  40936. t = new Hr(u,r);
  40937. t.scale.set(1.1, 1.1, 1.1),
  40938. t.name = "".concat(e, ".outline"),
  40939. o.add(t);
  40940. var s = new Hr(c,a);
  40941. s.name = "".concat(e, ".pick_volume"),
  40942. s.scale.set(2, 2, 2),
  40943. o.add(s),
  40944. s.handle = e,
  40945. l.pickVolumes.push(s),
  40946. n.setOpacity = function(e) {
  40947. var t = {
  40948. x: i.opacity
  40949. }
  40950. , e = new TWEEN.Tween(t).to({
  40951. x: e
  40952. }, 100);
  40953. e.onUpdate(function() {
  40954. o.visible = 0 < t.x,
  40955. s.visible = 0 < t.x,
  40956. i.opacity = t.x,
  40957. r.opacity = t.x,
  40958. s.material.opacity = .5 * t.x
  40959. }),
  40960. e.start()
  40961. }
  40962. ,
  40963. s.addEventListener("drag", function(e) {
  40964. return l.dragScaleHandle(e)
  40965. }),
  40966. s.addEventListener("drop", function(e) {
  40967. return l.dropScaleHandle(e)
  40968. }),
  40969. s.addEventListener("mouseover", function(e) {}),
  40970. s.addEventListener("click", function(e) {}),
  40971. s.addEventListener("mouseleave", function(e) {})
  40972. }()
  40973. }
  40974. }, {
  40975. key: "initializeFocusHandles",
  40976. value: function() {}
  40977. }, {
  40978. key: "initializeTranslationHandles",
  40979. value: function() {
  40980. for (var l = this, u = new Cl(1,1,1), c = 0, d = Object.keys(this.translationHandles); c < d.length; c++)
  40981. !function() {
  40982. var e = d[c]
  40983. , t = l.handles[e]
  40984. , n = t.node;
  40985. l.scene.add(n);
  40986. var i = new $i({
  40987. color: t.color,
  40988. opacity: .6,
  40989. transparent: !0
  40990. })
  40991. , r = new $i({
  40992. color: Yv,
  40993. side: J,
  40994. opacity: .6,
  40995. transparent: !0
  40996. })
  40997. , a = new Xu({
  40998. opacity: .2,
  40999. transparent: !0,
  41000. visible: l.showPickVolumes
  41001. })
  41002. , o = new Hr(u,i);
  41003. o.name = "".concat(e, ".handle"),
  41004. o.scale.set(1, 1, 72),
  41005. o.lookAt(B(Cn, Q(t.alignment))),
  41006. o.renderOrder = 10,
  41007. n.add(o),
  41008. t.translateNode = o;
  41009. t = new Hr(u,r);
  41010. t.name = "".concat(e, ".outline"),
  41011. t.scale.set(1.3, 1.3, 1.01),
  41012. t.renderOrder = 0,
  41013. o.add(t);
  41014. var s = new Hr(u,a);
  41015. s.name = "".concat(e, ".pick_volume"),
  41016. s.scale.set(4, 4, 1.1),
  41017. s.handle = e,
  41018. o.add(s),
  41019. l.pickVolumes.push(s),
  41020. n.setOpacity = function(e) {
  41021. var t = {
  41022. x: i.opacity
  41023. }
  41024. , e = new TWEEN.Tween(t).to({
  41025. x: e
  41026. }, 100);
  41027. e.onUpdate(function() {
  41028. o.visible = 0 < t.x,
  41029. s.visible = 0 < t.x,
  41030. i.opacity = t.x,
  41031. r.opacity = t.x,
  41032. a.opacity = .5 * t.x
  41033. }),
  41034. e.start()
  41035. }
  41036. ,
  41037. s.addEventListener("drag", function(e) {
  41038. l.dragTranslationHandle(e)
  41039. }),
  41040. s.addEventListener("drop", function(e) {
  41041. l.dropTranslationHandle(e)
  41042. })
  41043. }()
  41044. }
  41045. }, {
  41046. key: "initializeRotationHandles",
  41047. value: function() {
  41048. for (var l = this, u = new Lu(1,.0225,8,64,Math.PI / 2), c = new Lu(1,1.5 * .018,8,64,Math.PI / 2), d = new Lu(1,.06,6,4,Math.PI / 2), h = 0, p = Object.keys(this.rotationHandles); h < p.length; h++)
  41049. !function() {
  41050. var e = p[h]
  41051. , t = l.handles[e]
  41052. , n = t.node;
  41053. l.scene.add(n);
  41054. var i = new $i({
  41055. color: t.color,
  41056. opacity: .6,
  41057. transparent: !0
  41058. })
  41059. , r = new $i({
  41060. color: Yv,
  41061. side: J,
  41062. opacity: .6,
  41063. transparent: !0
  41064. })
  41065. , a = new Xu({
  41066. opacity: .2,
  41067. transparent: !0,
  41068. visible: l.showPickVolumes
  41069. })
  41070. , o = new Hr(u,i);
  41071. o.name = "".concat(e, ".handle"),
  41072. o.scale.set(30, 30, 30),
  41073. o.lookAt(B(Cn, Q(t.alignment))),
  41074. n.add(o),
  41075. t.translateNode = o;
  41076. t = new Hr(c,r);
  41077. t.name = "".concat(e, ".outline"),
  41078. t.scale.set(1, 1, 1),
  41079. t.renderOrder = 0,
  41080. o.add(t);
  41081. var s = new Hr(d,a);
  41082. s.name = "".concat(e, ".pick_volume"),
  41083. s.scale.set(1, 1, 1),
  41084. s.handle = e,
  41085. o.add(s),
  41086. l.pickVolumes.push(s),
  41087. n.setOpacity = function(e) {
  41088. var t = {
  41089. x: i.opacity
  41090. }
  41091. , e = new TWEEN.Tween(t).to({
  41092. x: e
  41093. }, 100);
  41094. e.onUpdate(function() {
  41095. o.visible = 0 < t.x,
  41096. s.visible = 0 < t.x,
  41097. i.opacity = t.x,
  41098. r.opacity = t.x,
  41099. a.opacity = .5 * t.x
  41100. }),
  41101. e.start()
  41102. }
  41103. ,
  41104. s.addEventListener("drag", function(e) {
  41105. l.dragRotationHandle(e)
  41106. }),
  41107. s.addEventListener("drop", function(e) {
  41108. l.dropRotationHandle(e)
  41109. })
  41110. }()
  41111. }
  41112. }, {
  41113. key: "dragRotationHandle",
  41114. value: function(e) {
  41115. var t = e.drag
  41116. , n = this.activeHandle
  41117. , i = this.viewer.scene.getActiveCamera();
  41118. if (n) {
  41119. var r = B(Cn, Q(n.alignment))
  41120. , a = new Cn;
  41121. a.copy(B(Mn, Q(r.toArray()).concat([0])).applyMatrix4(n.node.matrixWorld)),
  41122. a.normalize(),
  41123. t.intersectionStart ? n = t.handle : (t.intersectionStart = t.location,
  41124. t.objectStart = t.object.getWorldPosition(new Cn),
  41125. t.handle = n,
  41126. o = (new ki).setFromNormalAndCoplanarPoint(a, t.intersectionStart),
  41127. t.dragPlane = o,
  41128. t.pivot = t.intersectionStart),
  41129. this.dragging = !0;
  41130. var e = this.viewer.inputHandler.pointer
  41131. , r = this.viewer.renderer.domElement
  41132. , o = Jf.mouseToRay(e, i, r.clientWidth, r.clientHeight).intersectPlane(t.dragPlane, new Cn);
  41133. if (o) {
  41134. var e = this.scene.getWorldPosition(new Cn)
  41135. , i = o
  41136. , r = t.pivot.clone().sub(e).normalize()
  41137. , e = i.clone().sub(e).normalize()
  41138. , s = Math.acos(r.dot(e));
  41139. if (s *= Math.sign(r.cross(e).dot(a)),
  41140. !Number.isNaN(s)) {
  41141. var l, u = B(Cn, Q(n.alignment)), c = ue(this.selection);
  41142. try {
  41143. for (c.s(); !(l = c.n()).done; ) {
  41144. var d = l.value;
  41145. d.rotateOnAxis(u, s),
  41146. d.dispatchEvent({
  41147. type: "orientation_changed",
  41148. object: d
  41149. })
  41150. }
  41151. } catch (e) {
  41152. c.e(e)
  41153. } finally {
  41154. c.f()
  41155. }
  41156. t.pivot = o
  41157. }
  41158. }
  41159. }
  41160. }
  41161. }, {
  41162. key: "dropRotationHandle",
  41163. value: function(e) {
  41164. this.dragging = !1,
  41165. this.setActiveHandle(null)
  41166. }
  41167. }, {
  41168. key: "dragTranslationHandle",
  41169. value: function(e) {
  41170. var t = e.drag
  41171. , n = this.activeHandle
  41172. , i = this.viewer.scene.getActiveCamera();
  41173. !t.intersectionStart && n ? (t.intersectionStart = t.location,
  41174. t.objectStart = t.object.getWorldPosition(new Cn),
  41175. e = t.intersectionStart,
  41176. r = B(Mn, Q(n.alignment).concat([0])).applyMatrix4(this.scene.matrixWorld),
  41177. r = (new Cn).addVectors(e, r),
  41178. r = new vh(e.clone(),r.clone()),
  41179. r = (t.line = r).closestPointToPoint(i.position, !1, new Cn),
  41180. r = (new Cn).subVectors(i.position, r),
  41181. r = (new ki).setFromNormalAndCoplanarPoint(r, t.intersectionStart),
  41182. t.dragPlane = r,
  41183. t.pivot = t.intersectionStart) : n = t.handle,
  41184. this.dragging = !0;
  41185. var r = this.viewer.inputHandler.pointer
  41186. , n = this.viewer.renderer.domElement
  41187. , n = Jf.mouseToRay(r, i, n.clientWidth, n.clientHeight).intersectPlane(t.dragPlane, new Cn);
  41188. if (n) {
  41189. var a, n = t.line.closestPointToPoint(n, !1, new Cn), o = (new Cn).subVectors(n, t.pivot), s = ue(this.selection);
  41190. try {
  41191. for (s.s(); !(a = s.n()).done; ) {
  41192. var l = a.value;
  41193. l.position.add(o),
  41194. l.dispatchEvent({
  41195. type: "position_changed",
  41196. object: l
  41197. })
  41198. }
  41199. } catch (e) {
  41200. s.e(e)
  41201. } finally {
  41202. s.f()
  41203. }
  41204. t.pivot = t.pivot.add(o)
  41205. }
  41206. }
  41207. }, {
  41208. key: "dropTranslationHandle",
  41209. value: function(e) {
  41210. this.dragging = !1,
  41211. this.setActiveHandle(null)
  41212. }
  41213. }, {
  41214. key: "dropScaleHandle",
  41215. value: function(e) {
  41216. this.dragging = !1,
  41217. this.setActiveHandle(null)
  41218. }
  41219. }, {
  41220. key: "dragScaleHandle",
  41221. value: function(e) {
  41222. var t = e.drag
  41223. , n = this.activeHandle
  41224. , e = this.viewer.scene.getActiveCamera();
  41225. t.intersectionStart ? n = t.handle : (t.intersectionStart = t.location,
  41226. t.objectStart = t.object.getWorldPosition(new Cn),
  41227. t.handle = n,
  41228. i = t.intersectionStart,
  41229. a = B(Mn, Q(n.alignment).concat([0])).applyMatrix4(this.scene.matrixWorld),
  41230. r = (new Cn).addVectors(i, a),
  41231. a = new vh(i.clone(),r.clone()),
  41232. i = (t.line = a).closestPointToPoint(e.position, !1, new Cn),
  41233. r = (new Cn).subVectors(e.position, i),
  41234. a = (new ki).setFromNormalAndCoplanarPoint(r, t.intersectionStart),
  41235. t.dragPlane = a,
  41236. t.pivot = t.intersectionStart),
  41237. this.dragging = !0;
  41238. var i = this.viewer.inputHandler.pointer
  41239. , r = this.viewer.renderer.domElement
  41240. , a = Jf.mouseToRay(i, e, r.clientWidth, r.clientHeight).intersectPlane(t.dragPlane, new Cn);
  41241. if (a) {
  41242. i = t.line.closestPointToPoint(a, !1, new Cn),
  41243. e = n.alignment.reduce(function(e, t) {
  41244. return e + t
  41245. }, 0),
  41246. r = this.selection[0].matrixWorld.clone().invert(),
  41247. a = i.clone().applyMatrix4(r),
  41248. r = t.pivot.clone().applyMatrix4(r),
  41249. a = (new Cn).subVectors(a, r).clone().normalize();
  41250. 0 === i.distanceTo(t.pivot) && a.set(0, 0, 0);
  41251. var o, r = a.dot(B(Cn, Q(n.alignment))), a = (new Cn).subVectors(i, t.pivot), s = B(Cn, Q(n.alignment)).multiplyScalar(a.length() * e * r), l = a.clone().multiplyScalar(.5), u = ue(this.selection);
  41252. try {
  41253. for (u.s(); !(o = u.n()).done; ) {
  41254. var c = o.value
  41255. , d = s.clone().divide(c.boundingBox.getSize(new Cn));
  41256. c.scale.add(d),
  41257. c.scale.x = Math.max(.1, c.scale.x),
  41258. c.scale.y = Math.max(.1, c.scale.y),
  41259. c.scale.z = Math.max(.1, c.scale.z),
  41260. c.position.add(l),
  41261. c.dispatchEvent({
  41262. type: "position_changed",
  41263. object: c
  41264. }),
  41265. c.dispatchEvent({
  41266. type: "scale_changed",
  41267. object: c
  41268. })
  41269. }
  41270. } catch (e) {
  41271. u.e(e)
  41272. } finally {
  41273. u.f()
  41274. }
  41275. t.pivot.copy(i)
  41276. }
  41277. }
  41278. }, {
  41279. key: "setActiveHandle",
  41280. value: function(e) {
  41281. if (!this.dragging && this.activeHandle !== e) {
  41282. if (null === (this.activeHandle = e))
  41283. for (var t = 0, n = Object.keys(this.handles); t < n.length; t++) {
  41284. var i = n[t];
  41285. this.handles[i].node.setOpacity(0)
  41286. }
  41287. for (var r = 0, a = Object.keys(this.translationHandles); r < a.length; r++) {
  41288. var o = a[r]
  41289. , o = this.translationHandles[o];
  41290. this.activeHandle === o ? o.node.setOpacity(1) : o.node.setOpacity(.6)
  41291. }
  41292. for (var s = 0, l = Object.keys(this.rotationHandles); s < l.length; s++) {
  41293. var u = l[s];
  41294. this.rotationHandles[u].node.setOpacity(.6)
  41295. }
  41296. for (var c = 0, d = Object.keys(this.scaleHandles); c < d.length; c++) {
  41297. var h = d[c]
  41298. , h = this.scaleHandles[h];
  41299. if (this.activeHandle === h) {
  41300. h.node.setOpacity(1);
  41301. for (var p = 0, f = Object.keys(this.translationHandles); p < f.length; p++) {
  41302. var m = f[p];
  41303. this.translationHandles[m].node.setOpacity(.6)
  41304. }
  41305. } else
  41306. h.node.setOpacity(.6)
  41307. }
  41308. e && e.node.setOpacity(1)
  41309. }
  41310. }
  41311. }, {
  41312. key: "update",
  41313. value: function() {
  41314. var t = this;
  41315. if (1 === this.selection.length) {
  41316. this.scene.visible = !0,
  41317. this.scene.updateMatrix(),
  41318. this.scene.updateMatrixWorld();
  41319. var e, n, i, r, a = this.selection[0], o = (a.matrixWorld,
  41320. this.viewer.scene.getActiveCamera()), s = this.viewer.renderer.domElement, l = this.viewer.inputHandler.pointer, u = a.boundingBox.getCenter(new Cn).clone().applyMatrix4(a.matrixWorld);
  41321. this.scene.scale.copy(a.boundingBox.getSize(new Cn).multiply(a.scale)),
  41322. this.scene.position.copy(u),
  41323. this.scene.rotation.copy(a.rotation),
  41324. this.scene.updateMatrixWorld(),
  41325. this.dragging || (m = this.scene.matrixWorld.clone().invert(),
  41326. e = o.getWorldPosition(new Cn).applyMatrix4(m),
  41327. n = this.rotationHandles["rotation.x"].node.rotation,
  41328. i = this.rotationHandles["rotation.y"].node.rotation,
  41329. r = this.rotationHandles["rotation.z"].node.rotation,
  41330. n.order = "ZYX",
  41331. i.order = "ZYX",
  41332. a = !(u = 0 < e.z),
  41333. m = Math.PI / 2,
  41334. u ? 0 < e.x && 0 < e.y ? (n.x = m,
  41335. i.y = 3 * m,
  41336. r.z = 0 * m) : e.x < 0 && 0 < e.y ? (n.x = m,
  41337. i.y = 2 * m,
  41338. r.z = m) : e.x < 0 && e.y < 0 ? (n.x = 2 * m,
  41339. i.y = 2 * m,
  41340. r.z = 2 * m) : 0 < e.x && e.y < 0 && (n.x = 2 * m,
  41341. i.y = 3 * m,
  41342. r.z = 3 * m) : a && (0 < e.x && 0 < e.y ? (n.x = 0 * m,
  41343. i.y = 0 * m,
  41344. r.z = 0 * m) : e.x < 0 && 0 < e.y ? (n.x = 0 * m,
  41345. i.y = m,
  41346. r.z = m) : e.x < 0 && e.y < 0 ? (n.x = 3 * m,
  41347. i.y = m,
  41348. r.z = 2 * m) : 0 < e.x && e.y < 0 && (n.x = 3 * m,
  41349. i.y = 0 * m,
  41350. r.z = 3 * m)));
  41351. for (var c = 0, d = Object.keys(this.handles); c < d.length; c++) {
  41352. var h = d[c]
  41353. , p = this.handles[h].node
  41354. , f = p.getWorldPosition(new Cn).distanceTo(o.position)
  41355. , h = Jf.projectedRadius(1, o, f, s.clientWidth, s.clientHeight)
  41356. , f = p.parent.getWorldScale(new Cn)
  41357. , h = 8 / h
  41358. , h = new Cn(h,h,h).divide(f)
  41359. , f = (new ni).makeRotationFromEuler(p.rotation).clone().invert();
  41360. h.applyMatrix4(f),
  41361. h.x = Math.abs(h.x),
  41362. h.y = Math.abs(h.y),
  41363. h.z = Math.abs(h.z),
  41364. p.scale.copy(h)
  41365. }
  41366. var m = Jf.mouseToRay(l, o, s.clientWidth, s.clientHeight)
  41367. , l = new sh(m.origin,m.direction);
  41368. l.layers.enableAll();
  41369. var m = this.pickVolumes.filter(function(e) {
  41370. e = e.handle.split(".")[0];
  41371. return t.modesEnabled[e]
  41372. })
  41373. , m = l.intersectObjects(m, !0);
  41374. 0 < m.length ? (m = m[0].object.handle,
  41375. console.log(m),
  41376. this.setActiveHandle(this.handles[m])) : this.setActiveHandle(null);
  41377. for (var v = 0, g = Object.keys(this.scaleHandles); v < g.length; v++) {
  41378. var y = g[v]
  41379. , y = this.handles[y];
  41380. y.node,
  41381. y.alignment
  41382. }
  41383. } else
  41384. this.scene.visible = !1
  41385. }
  41386. }]),
  41387. r
  41388. }()
  41389. , Qv = function() {
  41390. y(o, hn);
  41391. var a = w(o);
  41392. function o(e) {
  41393. var t;
  41394. O(this, o),
  41395. (t = a.call(this)).viewer = e,
  41396. t.renderer = e.renderer,
  41397. t.addEventListener("start_inserting_volume", function(e) {
  41398. t.viewer.dispatchEvent({
  41399. type: "cancel_insertions"
  41400. })
  41401. }),
  41402. t.scene = new gs,
  41403. t.scene.name = "scene_volume",
  41404. t.viewer.inputHandler.registerInteractiveScene(t.scene),
  41405. t.onRemove = function(e) {
  41406. t.scene.remove(e.volume)
  41407. }
  41408. ,
  41409. t.onAdd = function(e) {
  41410. t.scene.add(e.volume)
  41411. }
  41412. ;
  41413. var n, i = ue(e.scene.volumes);
  41414. try {
  41415. for (i.s(); !(n = i.n()).done; ) {
  41416. var r = n.value;
  41417. t.onAdd({
  41418. volume: r
  41419. })
  41420. }
  41421. } catch (e) {
  41422. i.e(e)
  41423. } finally {
  41424. i.f()
  41425. }
  41426. return t.viewer.inputHandler.addEventListener("delete", function(e) {
  41427. e.selection.filter(function(e) {
  41428. return e instanceof Yp
  41429. }).forEach(function(e) {
  41430. return t.viewer.scene.removeVolume(e)
  41431. })
  41432. }),
  41433. e.addEventListener("update", t.update.bind(g(t))),
  41434. e.addEventListener("render.pass.scene", function(e) {
  41435. return t.render(e)
  41436. }),
  41437. e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))),
  41438. e.scene.addEventListener("volume_added", t.onAdd),
  41439. e.scene.addEventListener("volume_removed", t.onRemove),
  41440. t
  41441. }
  41442. return h(o, [{
  41443. key: "onSceneChange",
  41444. value: function(e) {
  41445. e.oldScene && (e.oldScene.removeEventListeners("volume_added", this.onAdd),
  41446. e.oldScene.removeEventListeners("volume_removed", this.onRemove)),
  41447. e.scene.addEventListener("volume_added", this.onAdd),
  41448. e.scene.addEventListener("volume_removed", this.onRemove)
  41449. }
  41450. }, {
  41451. key: "startInsertion",
  41452. value: function() {
  41453. var n = this
  41454. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  41455. , i = new (e.type || Zp);
  41456. i.clip = e.clip || !1,
  41457. i.name = e.name || "Volume",
  41458. this.dispatchEvent({
  41459. type: "start_inserting_volume",
  41460. volume: i
  41461. }),
  41462. this.viewer.scene.addVolume(i);
  41463. function t(e) {
  41464. i.removeEventListener("drag", a),
  41465. i.removeEventListener("drop", t),
  41466. r.callback()
  41467. }
  41468. var r = {
  41469. callback: null
  41470. }
  41471. , a = function(e) {
  41472. var t = n.viewer.scene.getActiveCamera()
  41473. , e = e.intersect;
  41474. e && (i.position.copy(e.location),
  41475. t = i.getWorldPosition(new Cn).applyMatrix4(t.matrixWorldInverse),
  41476. t = Math.abs(t.z / 5),
  41477. i.scale.set(t, t, t))
  41478. };
  41479. return r.callback = function(e) {
  41480. i.removeEventListener("drag", a),
  41481. i.removeEventListener("drop", t),
  41482. n.viewer.removeEventListener("cancel_insertions", r.callback)
  41483. }
  41484. ,
  41485. i.addEventListener("drag", a),
  41486. i.addEventListener("drop", t),
  41487. this.viewer.addEventListener("cancel_insertions", r.callback),
  41488. this.viewer.inputHandler.startDragging(i),
  41489. i
  41490. }
  41491. }, {
  41492. key: "update",
  41493. value: function() {
  41494. if (this.viewer.scene) {
  41495. this.viewer.scene.getActiveCamera();
  41496. var e, t = this.viewer.renderer.getSize(new yn), n = (t.width,
  41497. t.height,
  41498. ue(this.viewer.scene.volumes));
  41499. try {
  41500. for (n.s(); !(e = n.n()).done; )
  41501. e.value
  41502. } catch (e) {
  41503. n.e(e)
  41504. } finally {
  41505. n.f()
  41506. }
  41507. }
  41508. }
  41509. }, {
  41510. key: "render",
  41511. value: function(e) {
  41512. var t = this.viewer.renderer
  41513. , n = t.getRenderTarget();
  41514. e.renderTarget && t.setRenderTarget(e.renderTarget),
  41515. t.render(this.scene, this.viewer.scene.getActiveCamera()),
  41516. t.setRenderTarget(n)
  41517. }
  41518. }]),
  41519. o
  41520. }()
  41521. , Kv = function() {
  41522. function e(i) {
  41523. var r = this;
  41524. O(this, e),
  41525. this.viewer = i,
  41526. this.visible = !1,
  41527. this.dom = this.createElement(),
  41528. i.addEventListener("update", function() {
  41529. var e = i.scene.view.direction.clone();
  41530. e.z = 0,
  41531. e.normalize();
  41532. var t = i.scene.getActiveCamera().getWorldPosition(new Cn)
  41533. , n = t.clone().add(e)
  41534. , e = i.getProjection()
  41535. , e = Jf.computeAzimuth(t, n, e);
  41536. r.dom.css("transform", "rotateZ(".concat(-e, "rad)"))
  41537. }),
  41538. this.dom.click(function() {
  41539. i.setTopView()
  41540. }),
  41541. $(i.renderArea).append(this.dom),
  41542. this.setVisible(this.visible)
  41543. }
  41544. return h(e, [{
  41545. key: "setVisible",
  41546. value: function(e) {
  41547. this.visible = e,
  41548. this.dom.css("display", e ? "" : "none")
  41549. }
  41550. }, {
  41551. key: "isVisible",
  41552. value: function() {
  41553. return this.visible
  41554. }
  41555. }, {
  41556. key: "createElement",
  41557. value: function() {
  41558. return $('<img src="'.concat(Potree.resourcePath, '/images/compas.svg" ').concat('style="position: absolute; top: 10px; right: 10px; z-index: 10000; width: 64px;"', " />"))
  41559. }
  41560. }]),
  41561. e
  41562. }()
  41563. , $v = function() {
  41564. function t(e) {
  41565. O(this, t),
  41566. this.viewer = e,
  41567. this.edlMaterial = null,
  41568. this.rtEDLs = new Map,
  41569. this.gl = e.renderer.getContext(),
  41570. e.addEventListener("resize", this.resize.bind(this)),
  41571. this.initEDL(e)
  41572. }
  41573. return h(t, [{
  41574. key: "initEDL",
  41575. value: function(e) {
  41576. null == this.edlMaterial && (this.edlMaterial = new _v,
  41577. this.edlMaterial.depthTest = !0,
  41578. this.edlMaterial.depthWrite = !0,
  41579. this.edlMaterial.transparent = !0)
  41580. }
  41581. }, {
  41582. key: "resize",
  41583. value: function(e) {
  41584. jp.EXT_DEPTH.isSupported() && (e = e.viewport,
  41585. this.getRtEDL(e).setSize(e.resolution2.x, e.resolution2.y))
  41586. }
  41587. }, {
  41588. key: "clearTargets",
  41589. value: function() {
  41590. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  41591. , t = this.viewer.renderer
  41592. , n = t.getRenderTarget();
  41593. e.target && (t.setRenderTarget(e.target),
  41594. t.clear()),
  41595. jp.EXT_DEPTH.isSupported() && (e.rtEDL ? (t.setRenderTarget(e.rtEDL),
  41596. t.clear()) : (e = this.getRtEDL(e.viewport)) && (t.setRenderTarget(e),
  41597. t.clear(!0, !0, !0))),
  41598. t.setRenderTarget(n)
  41599. }
  41600. }, {
  41601. key: "getRtEDL",
  41602. value: function(e) {
  41603. e || (console.warn("getRtEDL没传viewport!!!! !!!!!!!!!!"),
  41604. e = viewer.mainViewport);
  41605. var t = this.rtEDLs.get(e);
  41606. return t || jp.EXT_DEPTH.isSupported() && (t = new An(e.resolution2.x,e.resolution2.y,{
  41607. minFilter: Re,
  41608. magFilter: Re,
  41609. format: et,
  41610. type: Xe,
  41611. depthTexture: new El(void 0,void 0,We)
  41612. }),
  41613. this.rtEDLs.set(e, t)),
  41614. t
  41615. }
  41616. }, {
  41617. key: "renderShadowMap",
  41618. value: function(e, t, n) {
  41619. var i = this.viewer;
  41620. if (0 < n.length && !n[0].disableShadowUpdates) {
  41621. n = n[0];
  41622. this.shadowMap.setLight(n);
  41623. var r, a = new Map, o = ue(i.scene.pointclouds);
  41624. try {
  41625. for (o.s(); !(r = o.n()).done; ) {
  41626. var s = r.value;
  41627. a.set(s, s.material.activeAttributeName),
  41628. s.material.disableEvents(),
  41629. s.material.activeAttributeName = "depth"
  41630. }
  41631. } catch (e) {
  41632. o.e(e)
  41633. } finally {
  41634. o.f()
  41635. }
  41636. this.shadowMap.render(i.scene.scenePointCloud, t);
  41637. var l, u = ue(e);
  41638. try {
  41639. for (u.s(); !(l = u.n()).done; ) {
  41640. var c = l.value
  41641. , d = a.get(c);
  41642. c.material.activeAttributeName = d,
  41643. c.material.enableEvents()
  41644. }
  41645. } catch (e) {
  41646. u.e(e)
  41647. } finally {
  41648. u.f()
  41649. }
  41650. i.shadowTestCam.updateMatrixWorld(),
  41651. i.shadowTestCam.matrixWorldInverse.copy(i.shadowTestCam.matrixWorld).invert(),
  41652. i.shadowTestCam.updateProjectionMatrix()
  41653. }
  41654. }
  41655. }, {
  41656. key: "render",
  41657. value: function() {
  41658. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  41659. , t = this.viewer
  41660. , n = e.camera || t.scene.getActiveCamera()
  41661. , i = e.viewport ? e.viewport.resolution2 : this.viewer.renderer.getSize(new yn)
  41662. , r = [];
  41663. t.renderer.setRenderTarget(e.target || null);
  41664. var a = e.background || t.background
  41665. , o = (null == e.backgroundOpacity ? t : e).backgroundOpacity;
  41666. if ((0 != o && ("skybox" === a ? (t.skybox.camera.rotation.copy(t.scene.cameraP.rotation),
  41667. t.skybox.camera.fov = t.scene.cameraP.fov,
  41668. t.skybox.camera.aspect = t.scene.cameraP.aspect,
  41669. t.skybox.parent.rotation.x = 0,
  41670. t.skybox.parent.updateMatrixWorld(),
  41671. t.skybox.camera.updateProjectionMatrix(),
  41672. t.renderer.render(t.skybox.scene, t.skybox.camera)) : "gradient" === a ? (t.scene.cameraBG.layers.set(Potree.config.renderLayers.bg),
  41673. t.renderer.render(t.scene.scene, t.scene.cameraBG)) : "overlayColor" === a && (t.scene.bg2.material.color.copy(e.backgroundColor),
  41674. t.scene.bg2.material.opacity = e.backgroundOpacity,
  41675. t.scene.cameraBG.layers.set(Potree.config.renderLayers.bg2),
  41676. t.renderer.render(t.scene.scene, t.scene.cameraBG))),
  41677. !e.magnifier) && (t.setCameraLayers(n, ["skybox"]),
  41678. "showPanos" == Potree.settings.displayMode && t.images360.currentPano.pointcloud.hasDepthTex && jp.EXT_DEPTH.isSupported() && (u = !0,
  41679. t.renderer.setRenderTarget(e.rtEDL || this.getRtEDL(e.viewport)),
  41680. t.renderer.render(t.scene.scene, n),
  41681. t.renderer.setRenderTarget(e.target || null)),
  41682. t.renderer.render(t.scene.scene, n),
  41683. u))
  41684. return;
  41685. var s = t.scene.pointclouds.filter(function(e) {
  41686. return t.getObjVisiByReason(e, "datasetSelection")
  41687. })
  41688. , o = e.magnifier ? 0 < s.length : t.scene.pointclouds.some(function(e) {
  41689. return e.visible
  41690. });
  41691. s.forEach(function(e) {
  41692. e.oldVisi = e.visible,
  41693. e.visible = !0
  41694. }),
  41695. t.setCameraLayers(n, ["pointcloud"]),
  41696. n.layers.set(Potree.config.renderLayers.pointcloud);
  41697. var l, u, c = ue(s);
  41698. try {
  41699. for (c.s(); !(l = c.n()).done; ) {
  41700. var d = l.value
  41701. , h = d.material
  41702. , p = d.pcoGeometry.boundingBox.getSize(new Cn).x;
  41703. h.fov = gn.degToRad(n.fov),
  41704. h.resolution = i,
  41705. h.spacing = d.pcoGeometry.spacing,
  41706. h.near = n.near,
  41707. h.far = n.far,
  41708. h.uniforms.octreeSize.value = p,
  41709. t.useEDL && "showPanos" != Potree.settings.displayMode ? h.useEDL = !0 : h.useEDL = !1
  41710. }
  41711. } catch (e) {
  41712. c.e(e)
  41713. } finally {
  41714. c.f()
  41715. }
  41716. jp.EXT_DEPTH.isSupported() && !e.dontRenderRtEDL && (t.renderer.setRenderTarget(e.rtEDL || this.getRtEDL(e.viewport)),
  41717. 0 < s.length && t.pRenderer.render(t.scene.scenePointCloud, n, e.rtEDL || this.getRtEDL(e.viewport), {
  41718. shadowMaps: 0 < r.length ? [this.shadowMap] : null,
  41719. clipSpheres: t.scene.volumes.filter(function(e) {
  41720. return e instanceof Qp
  41721. }),
  41722. transparent: !1
  41723. }),
  41724. Potree.settings.intersectOnObjs && (n.layers.set(Potree.config.renderLayers.model),
  41725. t.renderer.render(t.scene.scene, n))),
  41726. t.dispatchEvent({
  41727. type: "render.pass.scene",
  41728. viewer: t
  41729. }),
  41730. t.renderer.setRenderTarget(e.target || null),
  41731. e.magnifier || s.forEach(function(e) {
  41732. e.visible = e.oldVisi
  41733. }),
  41734. o && (t.useEDL ? ((a = this.edlMaterial.uniforms).resolution.value.copy(i),
  41735. a.edlStrength.value = t.edlStrength,
  41736. a.radius.value = t.edlRadius,
  41737. a.useEDL.value = 1,
  41738. u = n.projectionMatrix,
  41739. (o = new Float32Array(16)).set(u.elements),
  41740. a.uProj.value = o,
  41741. a.uEDLColor.value = (e.rtEDL || this.getRtEDL(e.viewport)).texture,
  41742. a.opacity.value = t.edlOpacity,
  41743. Jf.screenPass.render(t.renderer, this.edlMaterial, e.target)) : t.pRenderer.render(t.scene.scenePointCloud, n, null, {
  41744. shadowMaps: 0 < r.length ? [this.shadowMap] : null,
  41745. clipSpheres: t.scene.volumes.filter(function(e) {
  41746. return e instanceof Qp
  41747. })
  41748. })),
  41749. s.forEach(function(e) {
  41750. e.visible = e.oldVisi
  41751. })
  41752. }
  41753. }]),
  41754. t
  41755. }()
  41756. , eg = function() {
  41757. function t(e) {
  41758. O(this, t),
  41759. this.viewer = e,
  41760. this.depthMaterials = new Map,
  41761. this.attributeMaterials = new Map,
  41762. this.normalizationMaterial = null,
  41763. this.rtDepth = null,
  41764. this.rtAttribute = null,
  41765. this.gl = e.renderer.getContext(),
  41766. this.initialized = !1,
  41767. e.addEventListener("resize", this.resize.bind(this))
  41768. }
  41769. return h(t, [{
  41770. key: "init",
  41771. value: function() {
  41772. this.initialized || (this.normalizationMaterial = new Av,
  41773. this.normalizationMaterial.depthTest = !0,
  41774. this.normalizationMaterial.depthWrite = !0,
  41775. this.normalizationMaterial.transparent = !0,
  41776. this.normalizationEDLMaterial = new Mv,
  41777. this.normalizationEDLMaterial.depthTest = !0,
  41778. this.normalizationEDLMaterial.depthWrite = !0,
  41779. this.normalizationEDLMaterial.transparent = !0,
  41780. this.rtDepth = new An(1024,1024,{
  41781. minFilter: Re,
  41782. magFilter: Re,
  41783. format: et,
  41784. type: Xe,
  41785. depthTexture: new El(void 0,void 0,We)
  41786. }),
  41787. this.rtAttribute = new An(1024,1024,{
  41788. minFilter: Re,
  41789. magFilter: Re,
  41790. format: et,
  41791. type: Xe,
  41792. depthTexture: this.rtDepth.depthTexture
  41793. }),
  41794. this.initialized = !0)
  41795. }
  41796. }, {
  41797. key: "resize",
  41798. value: function(e) {
  41799. this.rtDepth.setSize(e.canvasWidth, e.canvasHeight),
  41800. this.rtAttribute.setSize(e.canvasWidth, e.canvasHeight)
  41801. }
  41802. }, {
  41803. key: "clearTargets",
  41804. value: function(e) {
  41805. var t = this.viewer.renderer
  41806. , n = t.getRenderTarget();
  41807. e.target && (t.setRenderTarget(e.target),
  41808. t.clear()),
  41809. t.setClearColor(0, 0),
  41810. t.setRenderTarget(this.rtDepth),
  41811. t.clear(!0, !0, !0),
  41812. t.setRenderTarget(this.rtAttribute),
  41813. t.clear(!0, !0, !0),
  41814. t.setRenderTarget(n)
  41815. }
  41816. }, {
  41817. key: "clear",
  41818. value: function() {
  41819. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  41820. this.init();
  41821. var t = this.viewer
  41822. , n = t.renderer
  41823. , t = t.background;
  41824. "skybox" === t || "gradient" === t ? n.setClearColor(0, 0) : "black" === t ? n.setClearColor(0, 1) : "white" === t ? n.setClearColor(16777215, 1) : n.setClearColor(0, 0),
  41825. e.target || n.clear(),
  41826. this.clearTargets(e)
  41827. }
  41828. }, {
  41829. key: "render",
  41830. value: function() {
  41831. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  41832. this.init();
  41833. var t = this.viewer
  41834. , n = e.camera || t.scene.getActiveCamera()
  41835. , i = e.width ? e : this.viewer.renderer.getSize(new yn)
  41836. , r = i.width
  41837. , a = i.height;
  41838. t.renderer.setRenderTarget(e.target || null),
  41839. t.dispatchEvent({
  41840. type: "render.pass.begin",
  41841. viewer: t
  41842. });
  41843. var o, i = t.scene.pointclouds.filter(function(e) {
  41844. return e.visible
  41845. }), s = new Map, l = ue(i);
  41846. try {
  41847. for (l.s(); !(o = l.n()).done; ) {
  41848. var u, c, d = o.value;
  41849. s.set(d, d.material),
  41850. this.attributeMaterials.has(d) || (u = new Rm,
  41851. this.attributeMaterials.set(d, u)),
  41852. this.depthMaterials.has(d) || ((c = new Rm).setDefine("depth_pass", "#define hq_depth_pass"),
  41853. c.setDefine("use_edl", "#define use_edl"),
  41854. this.depthMaterials.set(d, c))
  41855. }
  41856. } catch (e) {
  41857. l.e(e)
  41858. } finally {
  41859. l.f()
  41860. }
  41861. var h, p = ue(i);
  41862. try {
  41863. for (p.s(); !(h = p.n()).done; ) {
  41864. var f = h.value
  41865. , m = f.pcoGeometry.boundingBox.getSize(new Cn).x
  41866. , v = s.get(f)
  41867. , g = this.depthMaterials.get(f);
  41868. g.size = v.size,
  41869. g.minSize = v.minSize,
  41870. g.maxSize = v.maxSize,
  41871. g.pointSizeType = v.pointSizeType,
  41872. g.visibleNodesTexture = v.visibleNodesTexture,
  41873. g.weighted = !1,
  41874. g.screenWidth = r,
  41875. g.shape = om.CIRCLE,
  41876. g.screenHeight = a,
  41877. g.uniforms.visibleNodes.value = v.visibleNodesTexture,
  41878. g.uniforms.octreeSize.value = m,
  41879. g.spacing = f.pcoGeometry.spacing,
  41880. g.classification = v.classification,
  41881. g.uniforms.classificationLUT.value.image.data = v.uniforms.classificationLUT.value.image.data,
  41882. g.classificationTexture.needsUpdate = !0,
  41883. g.uniforms.uFilterReturnNumberRange.value = v.uniforms.uFilterReturnNumberRange.value,
  41884. g.uniforms.uFilterNumberOfReturnsRange.value = v.uniforms.uFilterNumberOfReturnsRange.value,
  41885. g.uniforms.uFilterGPSTimeClipRange.value = v.uniforms.uFilterGPSTimeClipRange.value,
  41886. g.uniforms.uFilterPointSourceIDClipRange.value = v.uniforms.uFilterPointSourceIDClipRange.value,
  41887. g.clipTask = v.clipTask,
  41888. g.clipMethod = v.clipMethod,
  41889. g.setClipBoxes(v.clipBoxes),
  41890. g.setClipPolygons(v.clipPolygons),
  41891. f.material = g
  41892. }
  41893. } catch (e) {
  41894. p.e(e)
  41895. } finally {
  41896. p.f()
  41897. }
  41898. t.pRenderer.render(t.scene.scenePointCloud, n, e.rtEDL || this.rtDepth, {
  41899. clipSpheres: t.scene.volumes.filter(function(e) {
  41900. return e instanceof Qp
  41901. })
  41902. });
  41903. var y, w = ue(i);
  41904. try {
  41905. for (w.s(); !(y = w.n()).done; ) {
  41906. var b = y.value
  41907. , x = b.pcoGeometry.boundingBox.getSize(new Cn).x
  41908. , E = s.get(b)
  41909. , _ = this.attributeMaterials.get(b);
  41910. _.size = E.size,
  41911. _.minSize = E.minSize,
  41912. _.maxSize = E.maxSize,
  41913. _.pointSizeType = E.pointSizeType,
  41914. _.activeAttributeName = E.activeAttributeName,
  41915. _.visibleNodesTexture = E.visibleNodesTexture,
  41916. _.weighted = !0,
  41917. _.screenWidth = r,
  41918. _.screenHeight = a,
  41919. _.shape = om.CIRCLE,
  41920. _.uniforms.visibleNodes.value = E.visibleNodesTexture,
  41921. _.uniforms.octreeSize.value = x,
  41922. _.spacing = b.pcoGeometry.spacing,
  41923. _.classification = E.classification,
  41924. _.uniforms.classificationLUT.value.image.data = E.uniforms.classificationLUT.value.image.data,
  41925. _.classificationTexture.needsUpdate = !0,
  41926. _.uniforms.uFilterReturnNumberRange.value = E.uniforms.uFilterReturnNumberRange.value,
  41927. _.uniforms.uFilterNumberOfReturnsRange.value = E.uniforms.uFilterNumberOfReturnsRange.value,
  41928. _.uniforms.uFilterGPSTimeClipRange.value = E.uniforms.uFilterGPSTimeClipRange.value,
  41929. _.uniforms.uFilterPointSourceIDClipRange.value = E.uniforms.uFilterPointSourceIDClipRange.value,
  41930. _.elevationGradientRepeat = E.elevationGradientRepeat,
  41931. _.elevationRange = E.elevationRange,
  41932. _.gradient = E.gradient,
  41933. _.matcap = E.matcap,
  41934. _.intensityRange = E.intensityRange,
  41935. _.intensityGamma = E.intensityGamma,
  41936. _.intensityContrast = E.intensityContrast,
  41937. _.intensityBrightness = E.intensityBrightness,
  41938. _.rgbGamma = E.rgbGamma,
  41939. _.rgbContrast = E.rgbContrast,
  41940. _.rgbBrightness = E.rgbBrightness,
  41941. _.weightRGB = E.weightRGB,
  41942. _.weightIntensity = E.weightIntensity,
  41943. _.weightElevation = E.weightElevation,
  41944. _.weightRGB = E.weightRGB,
  41945. _.weightClassification = E.weightClassification,
  41946. _.weightReturnNumber = E.weightReturnNumber,
  41947. _.weightSourceID = E.weightSourceID,
  41948. _.color = E.color,
  41949. _.clipTask = E.clipTask,
  41950. _.clipMethod = E.clipMethod,
  41951. _.setClipBoxes(E.clipBoxes),
  41952. _.setClipPolygons(E.clipPolygons),
  41953. b.material = _
  41954. }
  41955. } catch (e) {
  41956. w.e(e)
  41957. } finally {
  41958. w.f()
  41959. }
  41960. i = this.gl;
  41961. t.pRenderer.render(t.scene.scenePointCloud, n, this.rtAttribute, {
  41962. clipSpheres: t.scene.volumes.filter(function(e) {
  41963. return e instanceof Qp
  41964. }),
  41965. blendFunc: [i.SRC_ALPHA, i.ONE],
  41966. depthWrite: !1
  41967. });
  41968. var M, A = ue(s);
  41969. try {
  41970. for (A.s(); !(M = A.n()).done; ) {
  41971. var T = N(M.value, 2)
  41972. , S = T[0]
  41973. , C = T[1];
  41974. S.material = C
  41975. }
  41976. } catch (e) {
  41977. A.e(e)
  41978. } finally {
  41979. A.f()
  41980. }
  41981. "skybox" === t.background ? (t.renderer.setClearColor(0, 0),
  41982. t.renderer.clear(),
  41983. t.skybox.camera.rotation.copy(t.scene.cameraP.rotation),
  41984. t.skybox.camera.fov = t.scene.cameraP.fov,
  41985. t.skybox.camera.aspect = t.scene.cameraP.aspect,
  41986. t.skybox.parent.rotation.x = 0,
  41987. t.skybox.parent.updateMatrixWorld(),
  41988. t.skybox.camera.updateProjectionMatrix(),
  41989. t.renderer.render(t.skybox.scene, t.skybox.camera)) : "gradient" === t.background ? (t.renderer.setClearColor(0, 0),
  41990. t.renderer.clear(),
  41991. t.renderer.render(t.scene.sceneBG, t.scene.cameraBG)) : ("black" === t.background ? t.renderer.setClearColor(0, 1) : "white" === t.background ? t.renderer.setClearColor(16777215, 1) : t.renderer.setClearColor(0, 0),
  41992. t.renderer.clear());
  41993. i = this.useEDL ? this.normalizationEDLMaterial : this.normalizationMaterial;
  41994. this.useEDL && (i.uniforms.edlStrength.value = t.edlStrength,
  41995. i.uniforms.radius.value = t.edlRadius,
  41996. i.uniforms.screenWidth.value = r,
  41997. i.uniforms.screenHeight.value = a,
  41998. i.uniforms.uEDLMap.value = (e.rtEDL || this.rtDepth).texture),
  41999. i.uniforms.uWeightMap.value = this.rtAttribute.texture,
  42000. i.uniforms.uDepthMap.value = this.rtAttribute.depthTexture,
  42001. Jf.screenPass.render(t.renderer, i),
  42002. t.renderer.render(t.scene.scene, n),
  42003. t.dispatchEvent({
  42004. type: "render.pass.scene",
  42005. viewer: t
  42006. }),
  42007. t.renderer.render(t.scene.sceneOverlay, n),
  42008. t.renderer.clearDepth(),
  42009. t.transformationTool.update(),
  42010. e.target || (t.dispatchEvent({
  42011. type: "render.pass.perspective_overlay",
  42012. viewer: t,
  42013. camera: n
  42014. }),
  42015. t.renderer.render(t.overlay, n)),
  42016. t.renderer.render(t.controls.sceneControls, n),
  42017. t.renderer.render(t.clippingTool.sceneVolume, n),
  42018. t.renderer.render(t.transformationTool.scene, n),
  42019. t.renderer.setViewport(r - t.navigationCube.width, a - t.navigationCube.width, t.navigationCube.width, t.navigationCube.width),
  42020. t.renderer.render(t.navigationCube, t.navigationCube.camera),
  42021. t.renderer.setViewport(0, 0, r, a),
  42022. t.dispatchEvent({
  42023. type: "render.pass.end",
  42024. viewer: t
  42025. }),
  42026. t.renderer.setRenderTarget(null)
  42027. }
  42028. }]),
  42029. t
  42030. }()
  42031. , tg = 0
  42032. , ng = function() {
  42033. y(n, hn);
  42034. var t = w(n);
  42035. function n() {
  42036. var e;
  42037. return O(this, n),
  42038. (e = t.call(this)).position = new Cn(0,0,0),
  42039. e.yaw = 0,
  42040. e._pitch = 0,
  42041. e.radius = 1,
  42042. e.maxPitch = Math.PI / 2,
  42043. e.minPitch = -Math.PI / 2,
  42044. e.sid = tg++,
  42045. e.LookTransition = "LookTransition" + e.sid,
  42046. e
  42047. }
  42048. return h(n, [{
  42049. key: "applyToCamera",
  42050. value: function(e) {
  42051. e.position.copy(this.position),
  42052. e.rotation.copy(this.rotation),
  42053. e.updateMatrix(),
  42054. e.updateMatrixWorld()
  42055. }
  42056. }, {
  42057. key: "rotation",
  42058. get: function() {
  42059. var e = new ci;
  42060. return e.order = "ZXY",
  42061. e.x = Math.PI / 2 + this.pitch,
  42062. e.z = this.yaw,
  42063. e
  42064. },
  42065. set: function(e) {
  42066. this.direction = new Cn(0,0,-1).applyEuler(e)
  42067. }
  42068. }, {
  42069. key: "copy",
  42070. value: function(e) {
  42071. Fm.CopyClassObject(this, e)
  42072. }
  42073. }, {
  42074. key: "clone",
  42075. value: function() {
  42076. return Fm.CloneClassObject(this)
  42077. }
  42078. }, {
  42079. key: "pitch",
  42080. get: function() {
  42081. return this._pitch
  42082. },
  42083. set: function(e) {
  42084. this._pitch = Math.max(Math.min(e, this.maxPitch), this.minPitch)
  42085. }
  42086. }, {
  42087. key: "direction",
  42088. get: function() {
  42089. var e = new Cn(0,1,0);
  42090. return e.applyAxisAngle(new Cn(1,0,0), this.pitch),
  42091. e.applyAxisAngle(new Cn(0,0,1), this.yaw),
  42092. e
  42093. },
  42094. set: function(e) {
  42095. var t;
  42096. 0 === e.x && 0 === e.y ? this.pitch = Math.PI / 2 * Math.sign(e.z) : (t = Math.atan2(e.y, e.x) - Math.PI / 2,
  42097. e = Math.atan2(e.z, Math.sqrt(e.x * e.x + e.y * e.y)),
  42098. this.yaw = t,
  42099. this.pitch = e)
  42100. }
  42101. }, {
  42102. key: "lookAt",
  42103. value: function(e) {
  42104. 1 === arguments.length ? t = (new Cn).subVectors(e, this.position) : 3 === arguments.length && (t = (new Cn).subVectors(B(Cn, Array.prototype.slice.call(arguments)), this.position));
  42105. var e = t.length()
  42106. , t = t.normalize();
  42107. this.radius = e,
  42108. this.direction = t
  42109. }
  42110. }, {
  42111. key: "getPivot",
  42112. value: function() {
  42113. return (new Cn).addVectors(this.position, this.direction.multiplyScalar(this.radius))
  42114. }
  42115. }, {
  42116. key: "getSide",
  42117. value: function() {
  42118. var e = new Cn(1,0,0);
  42119. return e.applyAxisAngle(new Cn(0,0,1), this.yaw),
  42120. e
  42121. }
  42122. }, {
  42123. key: "pan",
  42124. value: function(e, t) {
  42125. this.translate(e, 0, t)
  42126. }
  42127. }, {
  42128. key: "translate",
  42129. value: function(e, t, n) {
  42130. var i = new Cn(0,1,0);
  42131. i.applyAxisAngle(new Cn(1,0,0), this.pitch),
  42132. i.applyAxisAngle(new Cn(0,0,1), this.yaw);
  42133. var r = new Cn(1,0,0);
  42134. r.applyAxisAngle(new Cn(0,0,1), this.yaw);
  42135. var a = r.clone().cross(i)
  42136. , n = r.multiplyScalar(e).add(i.multiplyScalar(t)).add(a.multiplyScalar(n));
  42137. this.fixZWhenPan && n.setZ(0),
  42138. this.position = this.position.add(n),
  42139. this.restrictPos()
  42140. }
  42141. }, {
  42142. key: "translateWorld",
  42143. value: function(e, t, n) {
  42144. this.position.x += e,
  42145. this.position.y += t,
  42146. this.position.z += n,
  42147. this.restrictPos()
  42148. }
  42149. }, {
  42150. key: "restrictPos",
  42151. value: function() {
  42152. this.limitBound && this.position.clamp(this.limitBound.min, this.limitBound.max)
  42153. }
  42154. }, {
  42155. key: "setCubeView",
  42156. value: function(e) {
  42157. switch (e) {
  42158. case "front":
  42159. this.yaw = 0,
  42160. this.pitch = 0;
  42161. break;
  42162. case "back":
  42163. this.yaw = Math.PI,
  42164. this.pitch = 0;
  42165. break;
  42166. case "left":
  42167. this.yaw = -Math.PI / 2,
  42168. this.pitch = 0;
  42169. break;
  42170. case "right":
  42171. this.yaw = Math.PI / 2,
  42172. this.pitch = 0;
  42173. break;
  42174. case "top":
  42175. this.yaw = 0,
  42176. this.pitch = -Math.PI / 2;
  42177. break;
  42178. case "bottom":
  42179. this.yaw = -Math.PI,
  42180. this.pitch = Math.PI / 2
  42181. }
  42182. }
  42183. }, {
  42184. key: "isFlying",
  42185. value: function() {
  42186. return 0 < gv.getById(this.LookTransition).length
  42187. }
  42188. }, {
  42189. key: "cancelFlying",
  42190. value: function() {
  42191. gv.cancelById(this.LookTransition, !0)
  42192. }
  42193. }, {
  42194. key: "setView",
  42195. value: function() {
  42196. var r = this
  42197. , a = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  42198. this.cancelFlying();
  42199. function e() {
  42200. function e() {
  42201. a.callback && a.callback(),
  42202. r.dispatchEvent("flyingDone")
  42203. }
  42204. l ? r.lookAt(l) : o && (r.rotation = (new ci).setFromQuaternion(o)),
  42205. a.duration ? setTimeout(e, 1) : e()
  42206. }
  42207. var o, t = (new Cn).copy(a.position), n = this.position.clone(), i = this.getPivot(), s = Up.getQuaFromPosAim(n, i), l = null;
  42208. a.target ? (l = (new Cn).copy(a.target),
  42209. o = Up.getQuaFromPosAim(t, l)) : a.quaternion && (o = a.quaternion.clone()),
  42210. a.duration ? gv.start(fv(this.position, t, function(e, t) {
  42211. var n, i = t;
  42212. o && (n = (new Sn).copy(s),
  42213. mv(n, o)(t),
  42214. r.rotation = (new ci).setFromQuaternion(n)),
  42215. r.restrictPos(),
  42216. a.onUpdate && a.onUpdate(i)
  42217. }), a.duration, e, 0, a.Easing ? pv[a.Easing] : pv.easeInOutSine, null, this.LookTransition, a.cancelFun) : (this.position.copy(t),
  42218. this.restrictPos(),
  42219. a.onUpdate && a.onUpdate(1),
  42220. e())
  42221. }
  42222. }, {
  42223. key: "moveOrthoCamera",
  42224. value: function(i, e, t, n) {
  42225. var r, a = i.camera, o = a.zoom, s = e.endPosition, l = e.boundSize, u = e.endZoom, c = e.margin || {
  42226. x: 0,
  42227. y: 0
  42228. };
  42229. e.bound && (s = s || e.bound.getCenter(new Cn),
  42230. r = (new ni).makeRotationFromEuler(this.rotation).invert(),
  42231. l = e.bound.clone().applyMatrix4(r).getSize(new Cn)),
  42232. l && 0 == l.x && 0 == l.y && l.set(1, 1),
  42233. this.setView({
  42234. position: s,
  42235. duration: t,
  42236. callback: function() {},
  42237. onUpdate: function(e) {
  42238. var t, n;
  42239. (l || u) && (l && (t = l.x / l.y,
  42240. u = a.aspect > t ? (n = l.y,
  42241. (i.resolution.y - c.y) / n) : (n = l.x,
  42242. (i.resolution.x - c.x) / n)),
  42243. a.zoom = u * e + o * (1 - e),
  42244. a.updateProjectionMatrix())
  42245. },
  42246. Easing: n
  42247. })
  42248. }
  42249. }, {
  42250. key: "zoomOrthoCamera",
  42251. value: function(n, i, e, t, r) {
  42252. var a = this
  42253. , o = n.zoom
  42254. , s = new Cn(e.x,e.y,.5);
  42255. gv.start(function(e) {
  42256. var t = s.clone().unproject(n);
  42257. n.zoom = i * e + o * (1 - e),
  42258. n.updateProjectionMatrix();
  42259. e = s.clone().unproject(n),
  42260. t = (new Cn).subVectors(e, t);
  42261. n.position.sub(t),
  42262. a.position.copy(n.position),
  42263. r && r()
  42264. }, t, null, 0, pv.easeInOutSine, null, "zoomInView")
  42265. }
  42266. }]),
  42267. n
  42268. }()
  42269. , ig = function() {
  42270. y(i, Si);
  42271. var n = w(i);
  42272. function i(e) {
  42273. var t;
  42274. return O(this, i),
  42275. (t = n.call(this)).getArrow(),
  42276. t.createArrows(),
  42277. t
  42278. }
  42279. return h(i, [{
  42280. key: "getArrow",
  42281. value: function() {
  42282. var e = new Si
  42283. , t = Sf.createLine([new Cn, new Cn(0,0,2)])
  42284. , n = new Hr(new Cl(.3,.3,4));
  42285. n.position.set(0, 0, 9);
  42286. var i = new Hr(new kl(0,.6,2,12,1,!1));
  42287. i.position.set(0, 0, 12),
  42288. i.rotation.set(Math.PI / 2, 0, 0),
  42289. e.add(n),
  42290. e.add(t),
  42291. e.add(i),
  42292. this.arrowGroup = e
  42293. }
  42294. }, {
  42295. key: "createArrows",
  42296. value: function() {
  42297. var r = this;
  42298. new $i({
  42299. color: "#00d7df",
  42300. side: 2,
  42301. transparent: !0,
  42302. opacity: .8,
  42303. depthWrite: !1
  42304. });
  42305. Object.keys(Potree.config.axis).forEach(function(e) {
  42306. var t = Potree.config.axis[e].color
  42307. , n = r.arrowGroup.clone();
  42308. n.children.forEach(function(e) {
  42309. e.material = e.material.clone(),
  42310. e.material.color.set(t)
  42311. });
  42312. var i = r.createLabel(e, t);
  42313. i.position.set(0, 0, 16),
  42314. n.add(i),
  42315. "y" == e ? n.rotation.x = -Math.PI / 2 : "x" == e && (n.rotation.y = Math.PI / 2),
  42316. r.add(n)
  42317. })
  42318. }
  42319. }, {
  42320. key: "createLabel",
  42321. value: function(e, t) {
  42322. var n = document.createElement("canvas")
  42323. , i = n.getContext("2d");
  42324. n.width = 256,
  42325. n.height = 256;
  42326. i.fillStyle = t,
  42327. i.font = "normal 120px 微软雅黑";
  42328. t = i.measureText(e).width;
  42329. i.clearRect(0, 0, n.width, n.height),
  42330. i.fillText(e, (n.width - t) / 2, (n.height + 120) / 2);
  42331. n = new En(n);
  42332. n.needsUpdate = !0,
  42333. n.minFilter = Re,
  42334. n.magFilter = Re;
  42335. n = new Fs(new Es({
  42336. map: n
  42337. }));
  42338. return n.renderOrder = 1,
  42339. n.scale.set(3, 3, 3),
  42340. n
  42341. }
  42342. }]),
  42343. i
  42344. }()
  42345. , rg = function() {
  42346. y(n, hn);
  42347. var t = w(n);
  42348. function n() {
  42349. var e;
  42350. return O(this, n),
  42351. (e = t.call(this)).annotations = new Kf,
  42352. e.scene = new gs,
  42353. e.scenePointCloud = new gs,
  42354. e.cameraP = new $r(e.fov,1,Potree.config.view.near,Potree.config.view.near),
  42355. e.cameraO = new ed(-1,1,1,-1,Potree.config.view.near,Potree.settings.cameraFar),
  42356. e.cameraP.limitFar = !0,
  42357. e.cameraVR = new $r,
  42358. e.cameraBG = new Kr,
  42359. e.cameraScreenSpace = new ed(-1,1,1,-1,.1,10),
  42360. e.cameraMode = em.PERSPECTIVE,
  42361. e.overrideCamera = null,
  42362. e.pointclouds = [],
  42363. e.measurements = [],
  42364. e.profiles = [],
  42365. e.volumes = [],
  42366. e.polygonClipVolumes = [],
  42367. e.cameraAnimations = [],
  42368. e.orientedImages = [],
  42369. e.images360 = [],
  42370. e.geopackages = [],
  42371. e.fpControls = null,
  42372. e.orbitControls = null,
  42373. e.earthControls = null,
  42374. e.geoControls = null,
  42375. e.deviceControls = null,
  42376. e.inputHandler = null,
  42377. e.view = new ng,
  42378. e.directionalLight = null,
  42379. e.initialize(),
  42380. e.axisArrow = new ig,
  42381. e.scene.add(e.axisArrow),
  42382. Potree.settings.isDebug || (e.axisArrow.visible = !1),
  42383. viewer.setObjectLayers(e.axisArrow, "bothMapAndScene"),
  42384. e.tags = new Si,
  42385. e.scene.add(e.tags),
  42386. e
  42387. }
  42388. return h(n, [{
  42389. key: "estimateHeightAt",
  42390. value: function(e) {
  42391. var t, n = null, i = 1 / 0, r = ue(this.pointclouds);
  42392. try {
  42393. for (r.s(); !(t = r.n()).done; ) {
  42394. var a = t.value;
  42395. if (void 0 !== a.root.geometryNode) {
  42396. var o = null
  42397. , s = 1 / 0
  42398. , l = e.clone().sub(a.position);
  42399. l.z = 0;
  42400. for (var u = new ti(l,new Cn(0,0,1)), c = [a.root]; 0 < c.length; ) {
  42401. var d = c.pop()
  42402. , h = d.getBoundingBox();
  42403. if (u.intersectBox(h)) {
  42404. var p = d.geometryNode.mean.z + a.position.z + d.geometryNode.boundingBox.min.z;
  42405. d.geometryNode.spacing <= s && (o = p,
  42406. s = d.geometryNode.spacing);
  42407. for (var f = 0, m = Object.keys(d.children); f < m.length; f++) {
  42408. var v = m[f];
  42409. d.children[v].geometryNode && c.push(d.children[v])
  42410. }
  42411. }
  42412. }
  42413. (null === n || s < i) && (n = o,
  42414. i = s)
  42415. }
  42416. }
  42417. } catch (e) {
  42418. r.e(e)
  42419. } finally {
  42420. r.f()
  42421. }
  42422. return n
  42423. }
  42424. }, {
  42425. key: "getBoundingBox",
  42426. value: function() {
  42427. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.pointclouds
  42428. , t = new kn;
  42429. this.scenePointCloud.updateMatrixWorld(!0),
  42430. this.referenceFrame.updateMatrixWorld(!0);
  42431. var n, i = ue(e);
  42432. try {
  42433. for (i.s(); !(n = i.n()).done; ) {
  42434. var r = n.value;
  42435. r.updateMatrixWorld(!0);
  42436. var a = r.pcoGeometry.tightBoundingBox || r.boundingBox
  42437. , o = Jf.computeTransformedBoundingBox(a, r.matrixWorld);
  42438. t.union(o)
  42439. }
  42440. } catch (e) {
  42441. i.e(e)
  42442. } finally {
  42443. i.f()
  42444. }
  42445. return t
  42446. }
  42447. }, {
  42448. key: "addPointCloud",
  42449. value: function(e) {
  42450. this.pointclouds.push(e),
  42451. this.scenePointCloud.add(e),
  42452. this.dispatchEvent({
  42453. type: "pointcloud_added",
  42454. pointcloud: e
  42455. })
  42456. }
  42457. }, {
  42458. key: "removePointCloud",
  42459. value: function(e) {
  42460. var t = this.pointclouds.indexOf(e);
  42461. -1 != t && (this.pointclouds.splice(t, 1),
  42462. this.scenePointCloud.remove(e),
  42463. e.panos.forEach(function(e) {
  42464. e.dispose()
  42465. }))
  42466. }
  42467. }, {
  42468. key: "addVolume",
  42469. value: function(e) {
  42470. this.volumes.push(e),
  42471. this.dispatchEvent({
  42472. type: "volume_added",
  42473. scene: this,
  42474. volume: e
  42475. })
  42476. }
  42477. }, {
  42478. key: "addOrientedImages",
  42479. value: function(e) {
  42480. this.orientedImages.push(e),
  42481. this.scene.add(e.node),
  42482. this.dispatchEvent({
  42483. type: "oriented_images_added",
  42484. scene: this,
  42485. images: e
  42486. })
  42487. }
  42488. }, {
  42489. key: "removeOrientedImages",
  42490. value: function(e) {
  42491. var t = this.orientedImages.indexOf(e);
  42492. -1 < t && (this.orientedImages.splice(t, 1),
  42493. this.dispatchEvent({
  42494. type: "oriented_images_removed",
  42495. scene: this,
  42496. images: e
  42497. }))
  42498. }
  42499. }, {
  42500. key: "add360Images",
  42501. value: function(e) {
  42502. this.images360.push(e),
  42503. this.scene.add(e.node),
  42504. this.dispatchEvent({
  42505. type: "360_images_added",
  42506. scene: this,
  42507. images: e
  42508. })
  42509. }
  42510. }, {
  42511. key: "remove360Images",
  42512. value: function(e) {
  42513. var t = this.images360.indexOf(e);
  42514. -1 < t && (this.images360.splice(t, 1),
  42515. this.dispatchEvent({
  42516. type: "360_images_removed",
  42517. scene: this,
  42518. images: e
  42519. }))
  42520. }
  42521. }, {
  42522. key: "addGeopackage",
  42523. value: function(e) {
  42524. this.geopackages.push(e),
  42525. this.scene.add(e.node),
  42526. this.dispatchEvent({
  42527. type: "geopackage_added",
  42528. scene: this,
  42529. geopackage: e
  42530. })
  42531. }
  42532. }, {
  42533. key: "removeGeopackage",
  42534. value: function(e) {
  42535. var t = this.geopackages.indexOf(e);
  42536. -1 < t && (this.geopackages.splice(t, 1),
  42537. this.dispatchEvent({
  42538. type: "geopackage_removed",
  42539. scene: this,
  42540. geopackage: e
  42541. }))
  42542. }
  42543. }, {
  42544. key: "removeVolume",
  42545. value: function(e) {
  42546. var t = this.volumes.indexOf(e);
  42547. -1 < t && (this.volumes.splice(t, 1),
  42548. this.dispatchEvent({
  42549. type: "volume_removed",
  42550. scene: this,
  42551. volume: e
  42552. }))
  42553. }
  42554. }, {
  42555. key: "addCameraAnimation",
  42556. value: function(e) {
  42557. this.cameraAnimations.push(e),
  42558. this.dispatchEvent({
  42559. type: "camera_animation_added",
  42560. scene: this,
  42561. animation: e
  42562. })
  42563. }
  42564. }, {
  42565. key: "removeCameraAnimation",
  42566. value: function(e) {
  42567. var t = this.cameraAnimations.indexOf(e);
  42568. -1 < t && (this.cameraAnimations.splice(t, 1),
  42569. this.dispatchEvent({
  42570. type: "camera_animation_removed",
  42571. scene: this,
  42572. animation: e
  42573. }))
  42574. }
  42575. }, {
  42576. key: "addPolygonClipVolume",
  42577. value: function(e) {
  42578. this.polygonClipVolumes.push(e),
  42579. this.dispatchEvent({
  42580. type: "polygon_clip_volume_added",
  42581. scene: this,
  42582. volume: e
  42583. })
  42584. }
  42585. }, {
  42586. key: "removePolygonClipVolume",
  42587. value: function(e) {
  42588. var t = this.polygonClipVolumes.indexOf(e);
  42589. -1 < t && (this.polygonClipVolumes.splice(t, 1),
  42590. this.dispatchEvent({
  42591. type: "polygon_clip_volume_removed",
  42592. scene: this,
  42593. volume: e
  42594. }))
  42595. }
  42596. }, {
  42597. key: "addMeasurement",
  42598. value: function(e) {
  42599. e.lengthUnit = this.lengthUnit,
  42600. e.lengthUnitDisplay = this.lengthUnitDisplay,
  42601. this.measurements.push(e),
  42602. this.dispatchEvent({
  42603. type: "measurement_added",
  42604. scene: this,
  42605. measurement: e
  42606. })
  42607. }
  42608. }, {
  42609. key: "removeMeasurement",
  42610. value: function(e) {
  42611. var t = this.measurements.indexOf(e);
  42612. -1 < t && (this.measurements.splice(t, 1),
  42613. this.dispatchEvent({
  42614. type: "measurement_removed",
  42615. scene: this,
  42616. measurement: e
  42617. }))
  42618. }
  42619. }, {
  42620. key: "addProfile",
  42621. value: function(e) {
  42622. this.profiles.push(e),
  42623. this.dispatchEvent({
  42624. type: "profile_added",
  42625. scene: this,
  42626. profile: e
  42627. })
  42628. }
  42629. }, {
  42630. key: "removeProfile",
  42631. value: function(e) {
  42632. var t = this.profiles.indexOf(e);
  42633. -1 < t && (this.profiles.splice(t, 1),
  42634. this.dispatchEvent({
  42635. type: "profile_removed",
  42636. scene: this,
  42637. profile: e
  42638. }))
  42639. }
  42640. }, {
  42641. key: "removeAllMeasurements",
  42642. value: function() {
  42643. for (; 0 < this.measurements.length; )
  42644. this.removeMeasurement(this.measurements[0]);
  42645. for (; 0 < this.profiles.length; )
  42646. this.removeProfile(this.profiles[0]);
  42647. for (; 0 < this.volumes.length; )
  42648. this.removeVolume(this.volumes[0])
  42649. }
  42650. }, {
  42651. key: "removeAllClipVolumes",
  42652. value: function() {
  42653. var e, t = ue(this.volumes.filter(function(e) {
  42654. return !0 === e.clip
  42655. }));
  42656. try {
  42657. for (t.s(); !(e = t.n()).done; ) {
  42658. var n = e.value;
  42659. this.removeVolume(n)
  42660. }
  42661. } catch (e) {
  42662. t.e(e)
  42663. } finally {
  42664. t.f()
  42665. }
  42666. for (; 0 < this.polygonClipVolumes.length; )
  42667. this.removePolygonClipVolume(this.polygonClipVolumes[0])
  42668. }
  42669. }, {
  42670. key: "getActiveCamera",
  42671. value: function() {
  42672. return viewer.mainViewport.camera
  42673. }
  42674. }, {
  42675. key: "initialize",
  42676. value: function() {
  42677. this.referenceFrame = new Si,
  42678. this.referenceFrame.matrixAutoUpdate = !1,
  42679. this.scenePointCloud.add(this.referenceFrame),
  42680. window.axisYup || (this.cameraP.up.set(0, 0, 1),
  42681. this.cameraO.up.set(0, 0, 1)),
  42682. this.cameraP.position.set(1e3, 1e3, 1e3),
  42683. this.cameraO.position.set(1e3, 1e3, 1e3),
  42684. this.cameraScreenSpace.lookAt(new Cn(0,0,0), new Cn(0,0,-1), new Cn(0,1,0)),
  42685. this.directionalLight = new nd(16777215,.5),
  42686. this.directionalLight.position.set(10, 10, 10),
  42687. this.directionalLight.lookAt(new Cn(0,0,0)),
  42688. this.scenePointCloud.add(this.directionalLight);
  42689. var e = new id(5592405);
  42690. this.scenePointCloud.add(e);
  42691. e = new id(16777215,1);
  42692. viewer.setObjectLayers(e, "bothMapAndScene"),
  42693. this.scene.add(e);
  42694. e = new nd(16777215,1);
  42695. e.position.set(10, 10, 10),
  42696. e.lookAt(new Cn(0,0,0)),
  42697. viewer.setObjectLayers(e, "bothMapAndScene"),
  42698. this.scene.add(e);
  42699. e = Jf.createBackgroundTexture(512, 512);
  42700. e.minFilter = e.magFilter = Re,
  42701. e.minFilter = e.magFilter = Oe;
  42702. e = new Hr(new ua(2,2,1),new $i({
  42703. map: e
  42704. }));
  42705. e.material.depthTest = !1,
  42706. e.material.depthWrite = !1,
  42707. e.name = "bg",
  42708. this.scene.add(e),
  42709. e.layers.set(Potree.config.renderLayers.bg);
  42710. e = new Hr(new ua(2,2,1),new $i({
  42711. transparent: !0
  42712. }));
  42713. e.material.depthTest = !1,
  42714. e.material.depthWrite = !1,
  42715. e.name = "bg2",
  42716. this.scene.add(e),
  42717. e.layers.set(Potree.config.renderLayers.bg2),
  42718. this.bg2 = e
  42719. }
  42720. }, {
  42721. key: "addAnnotation",
  42722. value: function(e) {
  42723. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
  42724. e instanceof Array ? t.position = (new Cn).fromArray(e) : null != e.x && (t.position = e);
  42725. t = new Kf(t);
  42726. return this.annotations.add(t),
  42727. t
  42728. }
  42729. }, {
  42730. key: "getAnnotations",
  42731. value: function() {
  42732. return this.annotations
  42733. }
  42734. }, {
  42735. key: "removeAnnotation",
  42736. value: function(e) {
  42737. this.annotations.remove(e)
  42738. }
  42739. }]),
  42740. n
  42741. }();
  42742. proj4.defs([["UTM10N", "+proj=utm +zone=10 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"], ["EPSG:6339", "+proj=utm +zone=10 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6340", "+proj=utm +zone=11 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6341", "+proj=utm +zone=12 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6342", "+proj=utm +zone=13 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6343", "+proj=utm +zone=14 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6344", "+proj=utm +zone=15 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6345", "+proj=utm +zone=16 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6346", "+proj=utm +zone=17 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6347", "+proj=utm +zone=18 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6348", "+proj=utm +zone=19 +ellps=GRS80 +units=m +no_defs"], ["EPSG:26910", "+proj=utm +zone=10 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26911", "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26912", "+proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26913", "+proj=utm +zone=13 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26914", "+proj=utm +zone=14 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26915", "+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26916", "+proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26917", "+proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26918", "+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26919", "+proj=utm +zone=19 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "]]);
  42743. var ag = new _c;
  42744. ag.crossOrigin = "anonymous";
  42745. var og = new Cn
  42746. , sg = new Zi(0,1,2)
  42747. , lg = new Zi(2,3,0)
  42748. , ug = ((pd = new $i({
  42749. transparent: !0,
  42750. depthWrite: !1,
  42751. depthTest: !0,
  42752. opacity: 1,
  42753. side: Y
  42754. })).color = new Yi(3355443),
  42755. pd)
  42756. , gu = new yn(0,0)
  42757. , rh = new yn(0,1)
  42758. , Ou = new yn(1,0)
  42759. , Ch = new yn(1,1)
  42760. , cg = [gu, Ou, Ch]
  42761. , dg = [Ch, rh, gu]
  42762. , hg = function() {
  42763. y(r, hn);
  42764. var i = w(r);
  42765. function r(e, t) {
  42766. var n;
  42767. O(this, r),
  42768. (n = i.call(this)).sceneGroup = new Si,
  42769. n.sceneGroup.name = "MapLayer",
  42770. n.loadingInProgress = 0,
  42771. n.maps = [],
  42772. n.frustum = new oa,
  42773. n.frustumMatrix = new ni,
  42774. n.tileColor = new Yi(16777215),
  42775. n.viewport = t,
  42776. n.changeViewer(e);
  42777. e = new gg(g(n),n.tileColor);
  42778. return n.addMap(e),
  42779. n
  42780. }
  42781. return h(r, [{
  42782. key: "addMapEntity",
  42783. value: function(e, t) {
  42784. if (e && e[0]) {
  42785. e = new yg(this,this.tileColor,e[0]);
  42786. return e && (e.name += "_" + t,
  42787. this.addMap(e),
  42788. e.updateProjection(),
  42789. e.updateObjectGroup(),
  42790. (t in Potree.settings.floorplanEnables ? Potree.settings.floorplanEnables[t] : Potree.settings.floorplanEnable) ? this.needUpdate = !0 : e.setEnable(!1),
  42791. this.dispatchEvent({
  42792. type: "floorplanLoaded",
  42793. floorplan: e
  42794. })),
  42795. e
  42796. }
  42797. Potree.Log("平面图无数据", "red")
  42798. }
  42799. }, {
  42800. key: "getFloorplan",
  42801. value: function(t) {
  42802. return this.maps.find(function(e) {
  42803. return e.name == "floorplan_" + t
  42804. })
  42805. }
  42806. }, {
  42807. key: "addMap",
  42808. value: function(e) {
  42809. this.maps.push(e),
  42810. this.needUpdate = !0
  42811. }
  42812. }, {
  42813. key: "removeMap",
  42814. value: function(e) {
  42815. var t = this.maps.indexOf(e);
  42816. 0 <= t && (e.removeFromSceneGroup(this.sceneGroup),
  42817. this.maps.splice(t, 1)),
  42818. this.needUpdate = !0,
  42819. this.viewer.dispatchEvent({
  42820. type: "content_changed"
  42821. })
  42822. }
  42823. }, {
  42824. key: "changeViewer",
  42825. value: function(e) {
  42826. this.viewer = e
  42827. }
  42828. }, {
  42829. key: "initProjection",
  42830. value: function() {
  42831. this.maps.forEach(function(e) {
  42832. e.updateProjection(),
  42833. e.updateObjectGroup()
  42834. })
  42835. }
  42836. }, {
  42837. key: "visibilityChanged",
  42838. value: function() {
  42839. if (!this.visible)
  42840. for (var e = 0, t = this.maps; e < t.length; e++)
  42841. t[e].removeFromSceneGroup(this.sceneGroup)
  42842. }
  42843. }, {
  42844. key: "onAfterRenderViewport",
  42845. value: function(e) {}
  42846. }, {
  42847. key: "update",
  42848. value: function() {
  42849. if (this.needUpdate = !1,
  42850. !this.disabled && this.maps.find(function(e) {
  42851. return !e.disabled
  42852. }) && this.maps.find(function(e) {
  42853. return e.objectGroup.visible
  42854. })) {
  42855. var e, t, n;
  42856. for (this.updateTimer = void 0,
  42857. (t = (e = this.viewport.camera).projectionMatrix.clone()).elements[0] /= 1.5,
  42858. t.elements[5] /= 1.5,
  42859. this.frustumMatrix.multiplyMatrices(t, e.matrixWorldInverse),
  42860. this.frustum.setFromProjectionMatrix(this.frustumMatrix),
  42861. this.frustum.planes[4].setComponents(0, 0, 0, 0),
  42862. this.frustum.planes[5].setComponents(0, 0, 0, 0),
  42863. i = !0,
  42864. n = 0; n < this.maps.length; n++)
  42865. var i = this.maps[n].update(this.frustum, this.sceneGroup) && i;
  42866. return [2, i]
  42867. }
  42868. }
  42869. }, {
  42870. key: "getAttributions",
  42871. value: function() {
  42872. for (var e = {}, t = 0, n = this.maps; t < n.length; t++)
  42873. n[t].fillAttributions(e);
  42874. return e
  42875. }
  42876. }, {
  42877. key: "updateProjection",
  42878. value: function() {
  42879. for (var e = 0, t = this.maps; e < t.length; e++) {
  42880. var n = t[e];
  42881. n.clearProjection(),
  42882. n.updateObjectGroup()
  42883. }
  42884. }
  42885. }]),
  42886. r
  42887. }()
  42888. , pg = function() {
  42889. y(o, hn);
  42890. var a = w(o);
  42891. function o(e, t, n, i) {
  42892. var r;
  42893. return O(this, o),
  42894. (r = a.call(this)).name = e,
  42895. r.mapLayer = t,
  42896. r.tileColor = n,
  42897. r.bias = 0,
  42898. r.zIndex = -1,
  42899. r.objectGroup = new Si,
  42900. r.objectGroup.name = e,
  42901. r.objectGroupAdded = !1,
  42902. r.baseTile = new fg(g(r),r.objectGroup,r.tileColor),
  42903. r.isTileVisibleBox = new kn,
  42904. r.isTileVisibleVec = new Cn,
  42905. r.projection = i,
  42906. r._zoomLevel = 0,
  42907. r
  42908. }
  42909. return h(o, [{
  42910. key: "zoomLevel",
  42911. get: function() {
  42912. return this._zoomLevel
  42913. },
  42914. set: function(e) {
  42915. this._zoomLevel != e && (this._zoomLevel = e)
  42916. }
  42917. }, {
  42918. key: "updateObjectGroup",
  42919. value: function() {
  42920. this.position && this.objectGroup.position.copy(this.position),
  42921. this.quaternion && this.objectGroup.quaternion.copy(this.quaternion),
  42922. this.objectGroup.updateMatrixWorld(!0)
  42923. }
  42924. }, {
  42925. key: "updateProjection",
  42926. value: function() {
  42927. this.transformMapToLocal || proj4.defs("NAVVIS:TMERC") && ("EPSG:4550" == this.projection ? this.transformMapToLocal = {
  42928. forward: function(e) {
  42929. e = viewer.transform.lonlatTo4550.inverse(e);
  42930. return viewer.transform.lonlatToLocal.forward(e)
  42931. }
  42932. } : this.transformMapToLocal = proj4(this.projection, "NAVVIS:TMERC"))
  42933. }
  42934. }, {
  42935. key: "setEnable",
  42936. value: function(e) {
  42937. !this.disabled != e && (e && console.log("setEnable", !0),
  42938. this.disabled = !e,
  42939. viewer.updateVisible(this.objectGroup, "setEnable", e),
  42940. e ? this.mapLayer.needUpdate = !0 : this.baseTile.remove(),
  42941. this.mapLayer.viewer.dispatchEvent({
  42942. type: "content_changed"
  42943. }))
  42944. }
  42945. }, {
  42946. key: "update",
  42947. value: function(e, t) {
  42948. var n = this.disabled || !this.objectGroup.visible;
  42949. if (("map" == this.name || !n) && (this.updateProjection(),
  42950. this.transformMapToLocal)) {
  42951. if (!this.isTileVisible(new Cn(0,0,0), this.mapSizeM, e))
  42952. return this.removeFromSceneGroup(t),
  42953. !0;
  42954. var i = this.mapLayer.viewport
  42955. , r = new Cn(-.5 * this.mapSizeM,0,0);
  42956. r.applyMatrix4(this.objectGroup.matrixWorld),
  42957. r.project(i.camera);
  42958. var a = new Cn(.5 * this.mapSizeM,0,0);
  42959. a.applyMatrix4(this.objectGroup.matrixWorld),
  42960. a.project(i.camera);
  42961. var o = i.resolution.x
  42962. , i = i.resolution.y;
  42963. if (o <= 0 || i <= 0 || isNaN(r.x) || isNaN(a.x))
  42964. return !1;
  42965. r.sub(a),
  42966. r.x *= o / 2,
  42967. r.y *= i / 2;
  42968. r = this.tileSizePx / r.length(),
  42969. r = Math.ceil(-Math.log(r) / Math.log(2) - this.bias),
  42970. r = Math.max(r, 0);
  42971. return r = Math.min(r, void 0 === this.maxDepth ? 1 / 0 : this.maxDepth),
  42972. this.zoomLevel = r,
  42973. n ? void 0 : (this.addToSceneGroup(t),
  42974. this.baseTile.update(this, e, r, this.mapSizeM, 0, 0, ""))
  42975. }
  42976. }
  42977. }, {
  42978. key: "isTileVisible",
  42979. value: function(e, t, n) {
  42980. if (21e6 < t)
  42981. return !0;
  42982. t *= .5;
  42983. return this.transformMapToLocal.forward(e),
  42984. this.isTileVisibleBox.makeEmpty(),
  42985. this.isTileVisibleVec.set(e.x - t, e.y - t, e.z).applyMatrix4(this.objectGroup.matrixWorld),
  42986. this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec),
  42987. this.isTileVisibleVec.set(e.x - t, e.y + t, e.z).applyMatrix4(this.objectGroup.matrixWorld),
  42988. this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec),
  42989. this.isTileVisibleVec.set(e.x + t, e.y - t, e.z).applyMatrix4(this.objectGroup.matrixWorld),
  42990. this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec),
  42991. this.isTileVisibleVec.set(e.x + t, e.y + t, e.z).applyMatrix4(this.objectGroup.matrixWorld),
  42992. this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec),
  42993. n.intersectsBox(this.isTileVisibleBox)
  42994. }
  42995. }, {
  42996. key: "addToSceneGroup",
  42997. value: function(e) {
  42998. this.objectGroupAdded || (e.add(this.objectGroup),
  42999. this.objectGroupAdded = !0)
  43000. }
  43001. }, {
  43002. key: "removeFromSceneGroup",
  43003. value: function(e) {
  43004. this.baseTile.remove(),
  43005. this.objectGroupAdded && (e.remove(this.objectGroup),
  43006. this.objectGroupAdded = !1)
  43007. }
  43008. }]),
  43009. o
  43010. }()
  43011. , fg = function() {
  43012. function f(e, t, n) {
  43013. O(this, f),
  43014. this.map = e,
  43015. this.objectGroup = t,
  43016. this.tileColor = n,
  43017. this.meshAdded = !1,
  43018. this.textureLoaded = !1,
  43019. this.children = []
  43020. }
  43021. return h(f, [{
  43022. key: "update",
  43023. value: function(e, t, n, i, r, a, o) {
  43024. return !!this.doesNotContainTilesToBeDisplayed(e) || (0 === n ? this.updateTile(e, i, r, a) : this.updateSubTiles(e, t, n, i, r, a, o))
  43025. }
  43026. }, {
  43027. key: "doesNotContainTilesToBeDisplayed",
  43028. value: function(e) {
  43029. return e.tilePresenceMap && e.tilePresenceMap.empty
  43030. }
  43031. }, {
  43032. key: "updateTile",
  43033. value: function(e, t, n, i) {
  43034. return this.mesh || this.createTileObject(e, t, n, i),
  43035. this.meshAdded || (this.objectGroup.add(this.mesh),
  43036. this.meshAdded = !0),
  43037. this.textureLoaded && this.removeChildren(),
  43038. this.textureLoaded
  43039. }
  43040. }, {
  43041. key: "updateSubTiles",
  43042. value: function(e, t, n, i, r, a, o) {
  43043. for (var s = !0, l = [-.25 * i, .25 * i, -.25 * i, .25 * i], u = [.25 * i, .25 * i, -.25 * i, -.25 * i], c = 0; c < 4; ++c) {
  43044. var d, h, p = o + c.toString(10);
  43045. e.tilePresenceMap && !e.tilePresenceMap[p] || (og.set(d = r + l[c], h = a + u[c], 0),
  43046. e.isTileVisible(og, .5 * i, t) ? (this.children[c] || (this.children[c] = new f(this.map,this.objectGroup,this.tileColor)),
  43047. s = this.children[c].update(e, t, n - 1, .5 * i, d, h, p) && s) : this.children[c] && (this.children[c].remove(),
  43048. delete this.children[c]))
  43049. }
  43050. return s && this.removeObject3D(),
  43051. s
  43052. }
  43053. }, {
  43054. key: "createTileObject",
  43055. value: function(e, t, n, i) {
  43056. var r = this;
  43057. this.mesh = this.createMesh(e.transformMapToLocal, t, n, i),
  43058. this.textureLoaded = !1;
  43059. var a = e.mapSizeM / t
  43060. , o = Math.log(a) / Math.log(2)
  43061. , n = n / t + .5 * (a - 1)
  43062. , a = -i / t + .5 * (a - 1)
  43063. , a = e.getTileUrl(Math.round(o), Math.round(n), Math.round(a));
  43064. viewer.setObjectLayers(this.mesh, "map"),
  43065. this.mesh.renderOrder = -(1e6 - o - 100 * (e.zIndex || 0));
  43066. function s() {
  43067. r.map.mapLayer.loadingInProgress--,
  43068. 0 == r.map.mapLayer.loadingInProgress && r.map.mapLayer.dispatchEvent("loadDone")
  43069. }
  43070. e = this.mesh.material;
  43071. e.map = ag.load(a, function(e) {
  43072. r.mesh ? (r.textureLoaded = !0,
  43073. r.mesh.material.opacity = 1,
  43074. r.map.mapLayer.viewer.dispatchEvent({
  43075. type: "content_changed"
  43076. }),
  43077. r.map.mapLayer.needUpdate = !0) : e.dispose(),
  43078. s()
  43079. }, void 0, function() {
  43080. r.textureLoaded = !0,
  43081. r.mesh && (r.mesh.material.dispose(),
  43082. r.mesh.material = ug,
  43083. r.map.mapLayer.viewer.dispatchEvent({
  43084. type: "content_changed"
  43085. })),
  43086. s()
  43087. }),
  43088. e.map.anisotropy = 0,
  43089. e.map.generateMipmaps = !1,
  43090. e.map.minFilter = Oe,
  43091. e.map.magFilter = Oe,
  43092. this.map.mapLayer.loadingInProgress++
  43093. }
  43094. }, {
  43095. key: "createMesh",
  43096. value: function(e, t, n, i) {
  43097. var r = new Sl;
  43098. return og.set(n - t / 2, i - t / 2, 0),
  43099. r.vertices.push((new Cn).copy(e.forward(og))),
  43100. og.set(n + t / 2, i - t / 2, 0),
  43101. r.vertices.push((new Cn).copy(e.forward(og))),
  43102. og.set(n + t / 2, i + t / 2, 0),
  43103. r.vertices.push((new Cn).copy(e.forward(og))),
  43104. og.set(n - t / 2, i + t / 2, 0),
  43105. r.vertices.push((new Cn).copy(e.forward(og))),
  43106. r.faces.push(sg),
  43107. r.faces.push(lg),
  43108. r.faceVertexUvs[0].push(cg),
  43109. r.faceVertexUvs[0].push(dg),
  43110. new Hr(r,this.createMaterial())
  43111. }
  43112. }, {
  43113. key: "createMaterial",
  43114. value: function() {
  43115. var e = new $i({
  43116. transparent: !0,
  43117. depthWrite: !1,
  43118. depthTest: !0,
  43119. opacity: 0,
  43120. side: Y
  43121. });
  43122. return e.color = this.tileColor || new Yi(16777215),
  43123. e
  43124. }
  43125. }, {
  43126. key: "remove",
  43127. value: function() {
  43128. this.removeObject3D(),
  43129. this.removeChildren()
  43130. }
  43131. }, {
  43132. key: "removeObject3D",
  43133. value: function() {
  43134. var e;
  43135. this.mesh && (this.objectGroup.remove(this.mesh),
  43136. this.textureLoaded && (e = this.mesh.material.map) && e.dispose(),
  43137. this.mesh.material.dispose(),
  43138. this.mesh.geometry.dispose(),
  43139. this.mesh = void 0),
  43140. this.meshAdded = !1,
  43141. this.textureLoaded = !1
  43142. }
  43143. }, {
  43144. key: "removeChildren",
  43145. value: function() {
  43146. for (var e = 0, t = this.children; e < t.length; e++) {
  43147. var n = t[e];
  43148. n && (n.removeObject3D(),
  43149. n.removeChildren())
  43150. }
  43151. this.children.length = 0
  43152. }
  43153. }]),
  43154. f
  43155. }();
  43156. proj4.defs("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
  43157. var mg, vg, gg = function() {
  43158. y(i, pg);
  43159. var n = w(i);
  43160. function i(e, t) {
  43161. return O(this, i),
  43162. (t = n.call(this, "map", e, t, "EPSG:3857")).baseUrl = "https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&x=${x}&y=${y}&z=${z}",
  43163. t.attribution = "© PopSmart, © 高德地图",
  43164. t.tileSizePx = 256,
  43165. t.mapSizeM = 40075017,
  43166. t.maxDepth = 19,
  43167. t.bias = .5,
  43168. t
  43169. }
  43170. return h(i, [{
  43171. key: "getTileUrl",
  43172. value: function(e, t, n) {
  43173. return this.baseUrl.replace(/\${z}/, e.toString(10)).replace(/\${x}/, t.toString(10)).replace(/\${y}/, n.toString(10))
  43174. }
  43175. }, {
  43176. key: "fillAttributions",
  43177. value: function(e) {
  43178. e[this.attribution] = {
  43179. score: 50
  43180. }
  43181. }
  43182. }]),
  43183. i
  43184. }(), yg = function() {
  43185. y(r, pg);
  43186. var i = w(r);
  43187. function r(e, t, n) {
  43188. O(this, r);
  43189. t = (e = i.call(this, "floorplan", e, t, "NAVVIS:TMERC")).tiledMapEntity = e.fillFromData(n),
  43190. n = t.updateTime || t.createTime;
  43191. return e.tileSizePx = t.tileSizePx,
  43192. e.mapSizeM = t.mapSizeM,
  43193. e.maxDepth = t.maxDepth,
  43194. e.postStamp = n ? n.replace(/[^0-9]/gi, "") : (new Date).getTime(),
  43195. e.zIndex = 0,
  43196. e.tilePresenceMap = e.decodeBitStream(e.tiledMapEntity.quadtree),
  43197. e
  43198. }
  43199. return h(r, [{
  43200. key: "fillFromData",
  43201. value: function(e) {
  43202. var t = {};
  43203. return t.id = e.id,
  43204. t.globalLocation = Potree.Utils.VectorFactory.fromArray3(e.location),
  43205. t.orientation = Potree.Utils.QuaternionFactory.fromArray(e.orientation),
  43206. Potree.fileServer ? t.filePath = "".concat(Potree.settings.urls.prefix).concat(e.file_path) : t.filePath = "".concat(Potree.settings.urls.prefix, "/data/").concat(Potree.settings.number, "/").concat(e.file_path),
  43207. t.fileName = "$DEPTH/$X/$Y.png",
  43208. t.type = e.type,
  43209. t.mapSizeM = e.map_size_m,
  43210. t.tileSizePx = e.tile_size_px,
  43211. t.maxDepth = e.max_depth,
  43212. t.quadtree = e.quadtree,
  43213. t.floorId = e.floor_id,
  43214. t.bundleId = e.bundle_id,
  43215. t
  43216. }
  43217. }, {
  43218. key: "computeLocalCoordinates",
  43219. value: function() {
  43220. proj4.defs("NAVVIS:TMERC") && (this.tiledMapEntity.location = (new Cn).copy(viewer.transform.lonlatToLocal.forward(this.tiledMapEntity.globalLocation)))
  43221. }
  43222. }, {
  43223. key: "updateProjection",
  43224. value: function() {
  43225. b(v(r.prototype), "updateProjection", this).call(this),
  43226. this.position || this.computeLocalCoordinates()
  43227. }
  43228. }, {
  43229. key: "position",
  43230. get: function() {
  43231. return this.tiledMapEntity.location
  43232. }
  43233. }, {
  43234. key: "quaternion",
  43235. get: function() {
  43236. return this.tiledMapEntity.orientation
  43237. }
  43238. }, {
  43239. key: "getTileUrl",
  43240. value: function(e, t, n) {
  43241. return (this.tiledMapEntity.filePath + "/" + this.tiledMapEntity.fileName).replace(/\$DEPTH/g, e.toString(10)).replace(/\$X/g, t.toString(10)).replace(/\$Y/g, n.toString(10)) + ("?t=" + this.postStamp)
  43242. }
  43243. }, {
  43244. key: "fillAttributions",
  43245. value: function(e) {
  43246. e.NavVis = {
  43247. score: 100
  43248. }
  43249. }
  43250. }, {
  43251. key: "decodeBitStream",
  43252. value: function(e) {
  43253. if (!e)
  43254. return {
  43255. empty: !0
  43256. };
  43257. for (var t = {}, n = [t], i = 0; i < e.length; i++) {
  43258. var r, a = n.shift(), o = parseInt(e.substr(i, 1), 16);
  43259. 1 & o && (a[0] = r = {},
  43260. n.push(r)),
  43261. 2 & o && (a[1] = r = {},
  43262. n.push(r)),
  43263. 4 & o && (a[2] = r = {},
  43264. n.push(r)),
  43265. 8 & o && (a[3] = r = {},
  43266. n.push(r))
  43267. }
  43268. var s = {
  43269. empty: !0
  43270. };
  43271. return this.computeHashes(s, t, ""),
  43272. s
  43273. }
  43274. }, {
  43275. key: "computeHashes",
  43276. value: function(e, t, n) {
  43277. for (var i = 0; i < 4; i++)
  43278. t[i] && (e[n + i.toString(10)] = !0,
  43279. e.empty = !1,
  43280. this.computeHashes(e, t[i], n + i.toString(10)))
  43281. }
  43282. }]),
  43283. r
  43284. }(), wg = {};
  43285. wg.RADIANS_PER_DEGREE = Math.PI / 180,
  43286. wg.DEGREES_PER_RADIAN = 180 / Math.PI,
  43287. wg.Vector3 = function(e, t, n) {
  43288. this.x = e || 0,
  43289. this.y = t || 0,
  43290. this.z = n || 0
  43291. }
  43292. ,
  43293. wg.Matrix4 = function() {
  43294. this.elements = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
  43295. 0 < arguments.length && console.error("MathLight.Matrix4: the constructor no longer reads arguments. use .set() instead.")
  43296. }
  43297. ,
  43298. wg.Matrix4.prototype = {
  43299. identity: function() {
  43300. return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
  43301. this
  43302. },
  43303. copy: function(e) {
  43304. return this.elements.set(e.elements),
  43305. this
  43306. },
  43307. applyToVector3: function(e) {
  43308. var t = e.x
  43309. , n = e.y
  43310. , i = e.z
  43311. , r = this.elements;
  43312. return e.x = r[0] * t + r[4] * n + r[8] * i + r[12],
  43313. e.y = r[1] * t + r[5] * n + r[9] * i + r[13],
  43314. e.z = r[2] * t + r[6] * n + r[10] * i + r[14],
  43315. this
  43316. },
  43317. getInverse: function(e, t) {
  43318. var n = this.elements
  43319. , i = e.elements
  43320. , r = i[0]
  43321. , a = i[1]
  43322. , o = i[2]
  43323. , s = i[3]
  43324. , l = i[4]
  43325. , u = i[5]
  43326. , c = i[6]
  43327. , d = i[7]
  43328. , h = i[8]
  43329. , p = i[9]
  43330. , f = i[10]
  43331. , m = i[11]
  43332. , v = i[12]
  43333. , g = i[13]
  43334. , y = i[14]
  43335. , w = i[15]
  43336. , b = p * y * d - g * f * d + g * c * m - u * y * m - p * c * w + u * f * w
  43337. , x = v * f * d - h * y * d - v * c * m + l * y * m + h * c * w - l * f * w
  43338. , E = h * g * d - v * p * d + v * u * m - l * g * m - h * u * w + l * p * w
  43339. , _ = v * p * c - h * g * c - v * u * f + l * g * f + h * u * y - l * p * y
  43340. , e = r * b + a * x + o * E + s * _;
  43341. if (0 == e) {
  43342. i = "MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0";
  43343. if (t)
  43344. throw new Error(i);
  43345. return console.warn(i),
  43346. this.identity()
  43347. }
  43348. e = 1 / e;
  43349. return n[0] = b * e,
  43350. n[1] = (g * f * s - p * y * s - g * o * m + a * y * m + p * o * w - a * f * w) * e,
  43351. n[2] = (u * y * s - g * c * s + g * o * d - a * y * d - u * o * w + a * c * w) * e,
  43352. n[3] = (p * c * s - u * f * s - p * o * d + a * f * d + u * o * m - a * c * m) * e,
  43353. n[4] = x * e,
  43354. n[5] = (h * y * s - v * f * s + v * o * m - r * y * m - h * o * w + r * f * w) * e,
  43355. n[6] = (v * c * s - l * y * s - v * o * d + r * y * d + l * o * w - r * c * w) * e,
  43356. n[7] = (l * f * s - h * c * s + h * o * d - r * f * d - l * o * m + r * c * m) * e,
  43357. n[8] = E * e,
  43358. n[9] = (v * p * s - h * g * s - v * a * m + r * g * m + h * a * w - r * p * w) * e,
  43359. n[10] = (l * g * s - v * u * s + v * a * d - r * g * d - l * a * w + r * u * w) * e,
  43360. n[11] = (h * u * s - l * p * s - h * a * d + r * p * d + l * a * m - r * u * m) * e,
  43361. n[12] = _ * e,
  43362. n[13] = (h * g * o - v * p * o + v * a * f - r * g * f - h * a * y + r * p * y) * e,
  43363. n[14] = (v * u * o - l * g * o - v * a * c + r * g * c + l * a * y - r * u * y) * e,
  43364. n[15] = (l * p * o - h * u * o + h * a * c - r * p * c - l * a * f + r * u * f) * e,
  43365. this
  43366. },
  43367. makeRotationFromQuaternion: function(e) {
  43368. var t = this.elements
  43369. , n = e.x
  43370. , i = e.y
  43371. , r = e.z
  43372. , a = e.w
  43373. , o = n + n
  43374. , s = i + i
  43375. , l = r + r
  43376. , u = n * o
  43377. , c = n * s
  43378. , e = n * l
  43379. , n = i * s
  43380. , i = i * l
  43381. , r = r * l
  43382. , o = a * o
  43383. , s = a * s
  43384. , l = a * l;
  43385. return t[0] = 1 - (n + r),
  43386. t[4] = c - l,
  43387. t[8] = e + s,
  43388. t[1] = c + l,
  43389. t[5] = 1 - (u + r),
  43390. t[9] = i - o,
  43391. t[2] = e - s,
  43392. t[6] = i + o,
  43393. t[10] = 1 - (u + n),
  43394. t[3] = 0,
  43395. t[7] = 0,
  43396. t[11] = 0,
  43397. t[12] = 0,
  43398. t[13] = 0,
  43399. t[14] = 0,
  43400. t[15] = 1,
  43401. this
  43402. }
  43403. },
  43404. wg.Quaternion = function(e, t, n, i) {
  43405. this._x = e || 0,
  43406. this._y = t || 0,
  43407. this._z = n || 0,
  43408. this._w = void 0 !== i ? i : 1
  43409. }
  43410. ,
  43411. wg.Quaternion.prototype = {
  43412. get x() {
  43413. return this._x
  43414. },
  43415. set x(e) {
  43416. this._x = e
  43417. },
  43418. get y() {
  43419. return this._y
  43420. },
  43421. set y(e) {
  43422. this._y = e
  43423. },
  43424. get z() {
  43425. return this._z
  43426. },
  43427. set z(e) {
  43428. this._z = e
  43429. },
  43430. get w() {
  43431. return this._w
  43432. },
  43433. set w(e) {
  43434. this._w = e
  43435. },
  43436. copy: function(e) {
  43437. this._x = e.x,
  43438. this._y = e.y,
  43439. this._z = e.z,
  43440. this._w = e.w
  43441. },
  43442. inverse: function() {
  43443. return this.conjugate().normalize()
  43444. },
  43445. conjugate: function() {
  43446. return this._x *= -1,
  43447. this._y *= -1,
  43448. this._z *= -1,
  43449. this
  43450. },
  43451. length: function() {
  43452. return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
  43453. },
  43454. normalize: function() {
  43455. var e = this.length();
  43456. return 0 === e ? (this._x = 0,
  43457. this._y = 0,
  43458. this._z = 0,
  43459. this._w = 1) : (this._x = this._x * (e = 1 / e),
  43460. this._y = this._y * e,
  43461. this._z = this._z * e,
  43462. this._w = this._w * e),
  43463. this
  43464. },
  43465. setFromAxisAngle: function(e, t) {
  43466. var n = t / 2
  43467. , t = Math.sin(n);
  43468. return this._x = e.x * t,
  43469. this._y = e.y * t,
  43470. this._z = e.z * t,
  43471. this._w = Math.cos(n),
  43472. this
  43473. },
  43474. setFromUnitVectors: function(e, t) {
  43475. return void 0 === mg && (mg = new wg.Vector3),
  43476. (vg = wg.dot(e, t) + 1) < 1e-6 ? (vg = 0,
  43477. Math.abs(e.x) > Math.abs(e.z) ? wg.setVector(mg, -e.y, e.x, 0) : wg.setVector(mg, 0, -e.z, e.y)) : wg.cross(e, t, mg),
  43478. this._x = mg.x,
  43479. this._y = mg.y,
  43480. this._z = mg.z,
  43481. this._w = vg,
  43482. this.normalize()
  43483. },
  43484. multiply: function(e) {
  43485. return this.multiplyQuaternions(this, e)
  43486. },
  43487. premultiply: function(e) {
  43488. return this.multiplyQuaternions(e, this)
  43489. },
  43490. multiplyQuaternions: function(e, t) {
  43491. var n = e._x
  43492. , i = e._y
  43493. , r = e._z
  43494. , a = e._w
  43495. , o = t._x
  43496. , s = t._y
  43497. , e = t._z
  43498. , t = t._w;
  43499. return this._x = n * t + a * o + i * e - r * s,
  43500. this._y = i * t + a * s + r * o - n * e,
  43501. this._z = r * t + a * e + n * s - i * o,
  43502. this._w = a * t - n * o - i * s - r * e,
  43503. this
  43504. }
  43505. },
  43506. wg.convertWorkshopVector = function(e) {
  43507. return new wg.Vector3(-e.x,e.y,e.z)
  43508. }
  43509. ,
  43510. wg.convertWorkshopQuaternion = function(e) {
  43511. return new wg.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new wg.Quaternion(Math.sqrt(2) / 2,Math.sqrt(2) / 2,0,0))
  43512. }
  43513. ,
  43514. wg.convertWorkshopOrthoZoom = function(e) {
  43515. return -1 === e ? -1 : e * ($("#player").width() / $("#player").height())
  43516. }
  43517. ,
  43518. wg.convertWorkshopPanoramaQuaternion = function(e) {
  43519. return new wg.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new wg.Quaternion).setFromAxisAngle(new wg.Vector3(0,1,0), 270 * wg.RADIANS_PER_DEGREE))
  43520. }
  43521. ,
  43522. wg.normalize = function(e) {
  43523. var t = e.x * e.x + e.y * e.y + e.z * e.z
  43524. , t = Math.sqrt(t);
  43525. e.x /= t,
  43526. e.y /= t,
  43527. e.z /= t
  43528. }
  43529. ,
  43530. wg.dot = function(e, t) {
  43531. return e.x * t.x + e.y * t.y + e.z * t.z
  43532. }
  43533. ,
  43534. wg.cross = function(e, t, n) {
  43535. var i = e.x
  43536. , r = e.y
  43537. , e = e.z;
  43538. n.x = r * t.z - e * t.y,
  43539. n.y = e * t.x - i * t.z,
  43540. n.z = i * t.y - r * t.x
  43541. }
  43542. ,
  43543. wg.setVector = function(e, t, n, i) {
  43544. e.x = t,
  43545. e.y = n,
  43546. e.z = i
  43547. }
  43548. ,
  43549. wg.copyVector = function(e, t) {
  43550. t.x = e.x,
  43551. t.y = e.y,
  43552. t.z = e.z
  43553. }
  43554. ,
  43555. wg.addVector = function(e, t) {
  43556. e.x += t.x,
  43557. e.y += t.y,
  43558. e.z += t.z
  43559. }
  43560. ,
  43561. wg.subVector = function(e, t) {
  43562. e.x -= t.x,
  43563. e.y -= t.y,
  43564. e.z -= t.z
  43565. }
  43566. ,
  43567. wg.applyQuaternionToVector = function(e, t) {
  43568. var n = t.x
  43569. , i = t.y
  43570. , r = t.z
  43571. , a = e.x
  43572. , o = e.y
  43573. , s = e.z
  43574. , l = e.w
  43575. , u = l * n + o * r - s * i
  43576. , c = l * i + s * n - a * r
  43577. , e = l * r + a * i - o * n
  43578. , r = -a * n - o * i - s * r;
  43579. t.x = u * l + r * -a + c * -s - e * -o,
  43580. t.y = c * l + r * -o + e * -a - u * -s,
  43581. t.z = e * l + r * -s + u * -o - c * -a
  43582. }
  43583. ,
  43584. wg.angleBetweenVectors = function(e, t) {
  43585. return Math.acos(wg.dot(e, t))
  43586. }
  43587. ;
  43588. var bg, xg, Eg, _g, Mg, Ag, Tg, Sg, Cg, Pg, Dg, kg, Bg, Lg, Rg = {
  43589. clampVFOV: function(e, t, n, i) {
  43590. return t < Rg.getHFOVFromVFOV(e, n, i) ? Rg.getVFOVFromHFOV(t, n, i) : e
  43591. },
  43592. getHFOVForCamera: function(e, t) {
  43593. return Rg.getHFOVByScreenPrecent(e.fov, e.aspect, t)
  43594. },
  43595. getHFOVByScreenPrecent: function(e, t, n) {
  43596. e = 2 * Math.atan(t * Math.tan(e * wg.RADIANS_PER_DEGREE / 2));
  43597. return n ? e : e * wg.DEGREES_PER_RADIAN
  43598. }
  43599. }, Fg = function() {
  43600. y(o, hn);
  43601. var a = w(o);
  43602. function o(f, e) {
  43603. var m;
  43604. O(this, o),
  43605. (m = a.call(this)).viewer = f,
  43606. m.renderer = f.renderer,
  43607. m.scene = f.scene,
  43608. m.rotationSpeed = 200,
  43609. m.moveSpeed = 10,
  43610. m.setCurrentViewport({
  43611. hoverViewport: e,
  43612. force: !0
  43613. }),
  43614. m.keys = {
  43615. FORWARD: ["W".charCodeAt(0), 38],
  43616. BACKWARD: ["S".charCodeAt(0), 40],
  43617. LEFT: ["A".charCodeAt(0), 37],
  43618. RIGHT: ["D".charCodeAt(0), 39],
  43619. UP: ["Q".charCodeAt(0)],
  43620. DOWN: ["E".charCodeAt(0)],
  43621. ALT: [18],
  43622. Rotate_LEFT: ["L".charCodeAt(0)],
  43623. Rotate_RIGHT: ["J".charCodeAt(0)],
  43624. Rotate_UP: ["K".charCodeAt(0)],
  43625. Rotate_DOWN: ["I".charCodeAt(0)]
  43626. },
  43627. m.fadeFactor = 20,
  43628. m.yawDelta = 0,
  43629. m.pitchDelta = 0,
  43630. m.translationDelta = new Cn(0,0,0),
  43631. m.translationWorldDelta = new Cn(0,0,0),
  43632. m.tweens = [],
  43633. m.dollyStart = new yn,
  43634. m.dollyEnd = new yn,
  43635. m.viewer.addEventListener("camera_changed", function(e) {
  43636. m.setFPCMoveSpeed(e.viewport)
  43637. });
  43638. var t = function(e) {
  43639. if (m.enabled) {
  43640. var t = e.dragViewport;
  43641. if (t) {
  43642. var n, i, r = t.camera, a = e.isTouch ? 1 == e.touches.length ? e.dragViewport && "MainView" != e.dragViewport.name ? "pan" : "rotate" : 2 == e.touches.length || e.dragViewport && "MainView" != e.dragViewport.name ? "scale" : "pan" : e.buttons === rm.LEFT && "OrthographicCamera" != r.type ? "rotate" : "pan";
  43643. m.currentViewport.getMoveSpeed();
  43644. if (void 0 === e.drag.startHandled && (e.drag.startHandled = !0,
  43645. m.dispatchEvent({
  43646. type: "start"
  43647. })),
  43648. a.includes("rotate")) {
  43649. if (!m.pointerDragStart)
  43650. return m.pointerDragStart = e.pointer.clone();
  43651. var o, s = m.scene.view;
  43652. Potree.settings.rotAroundPoint && m.intersectStart && m.canMovePos(t) && !f.images360.isAtPano() && !m.viewer.inputHandler.pressedKeys[17] ? (o = r.position.distanceTo(m.intersectStart.location),
  43653. m.yawDelta -= 2.5 * e.drag.pointerDelta.x,
  43654. m.pitchDelta += 2.5 * e.drag.pointerDelta.y,
  43655. m.update(),
  43656. s.applyToCamera(r),
  43657. o = f.inputHandler.getMouseDirection(m.intersectStart.pointer).direction.clone().multiplyScalar(o),
  43658. o = (new Cn).addVectors(r.position, o),
  43659. o = (new Cn).subVectors(o, m.intersectStart.location),
  43660. m.translationWorldDelta.copy(o.negate()),
  43661. m.update(),
  43662. s.applyToCamera(r)) : (p = r.matrixWorld,
  43663. r.matrixWorld = new ni,
  43664. u = new Cn(m.pointerDragStart.x,m.pointerDragStart.y,-1).unproject(r),
  43665. c = new Cn(e.pointer.x,e.pointer.y,-1).unproject(r),
  43666. s = Math.sqrt(u.x * u.x + u.z * u.z),
  43667. d = Math.sqrt(c.x * c.x + c.z * c.z),
  43668. s = Math.atan2(u.y, s),
  43669. d = Math.atan2(c.y, d),
  43670. m.pitchDelta += s - d,
  43671. u.y = 0,
  43672. c.y = 0,
  43673. d = Math.acos(u.dot(c) / u.length() / c.length()),
  43674. isNaN(d) || (h = d,
  43675. m.pointerDragStart.x > e.pointer.x && (h *= -1),
  43676. m.yawDelta += h),
  43677. m.pointerDragStart.copy(e.pointer),
  43678. r.matrixWorld = p)
  43679. }
  43680. if (a.includes("pan")) {
  43681. if (!m.canMovePos(t))
  43682. return;
  43683. if ("OrthographicCamera" == r.type) {
  43684. var l, u = Jf.getOrthoCameraMoveVec(e.drag.pointerDelta, r), c = window.viewer.modules.Alignment, d = window.viewer.modules.MergeEditor, h = c.handleState, p = e.buttons === rm.LEFT && t.alignment && h && t.alignment[h];
  43685. if ("pano" == Potree.settings.editType) {
  43686. c = window.viewer.modules.PanoEditor;
  43687. if (p && c.selectedPano && (c.selectedGroup && c.checkIfAllLinked({
  43688. group: c.selectedGroup
  43689. }) ? (c.dispatchEvent("needToDisConnect"),
  43690. console.warn("选中的漫游点连通了整个数据集,不允许移动")) : ("translate" == h && (e.drag.intersectStart.pointclouds && Fm.getMixedSet(c.selectedClouds, e.drag.intersectStart.pointclouds).length || c.selectedPano.hovered) || "rotate" == h) && (l = c.selectedClouds)),
  43691. !l && e.buttons === rm.LEFT && t.rotateSide)
  43692. return c.rotateSideCamera(-e.drag.pointerDelta.x)
  43693. } else if ("merge" == Potree.settings.editType) {
  43694. if (e.buttons === rm.LEFT && t.rotateSide)
  43695. return d.rotateSideCamera(-e.drag.pointerDelta.x)
  43696. } else
  43697. l = p && e.drag.intersectStart.pointcloud && [e.drag.intersectStart.pointcloud];
  43698. l ? m.dispatchEvent({
  43699. type: "transformPointcloud",
  43700. intersect: e.intersect.orthoIntersect,
  43701. intersectStart: e.drag.intersectStart.orthoIntersect,
  43702. moveVec: u,
  43703. pointclouds: l,
  43704. camera: r
  43705. }) : m.translationWorldDelta.add(u.negate())
  43706. } else
  43707. e.drag.intersectStart ? (null == e.drag.z && (n = e.drag.intersectStart.location.clone().project(r),
  43708. e.drag.z = n.z,
  43709. e.drag.projectionMatrixInverse = r.projectionMatrixInverse.clone(),
  43710. i = new Cn(m.pointerDragStart.x,m.pointerDragStart.y,e.drag.z),
  43711. e.drag.translateStartPos = i.clone().unproject(r)),
  43712. n = r.projectionMatrixInverse,
  43713. r.projectionMatrixInverse = e.drag.projectionMatrixInverse,
  43714. i = new Cn(e.pointer.x,e.pointer.y,e.drag.z).clone().unproject(r).clone().sub(e.drag.translateStartPos),
  43715. r.projectionMatrixInverse = n,
  43716. m.translationWorldDelta.copy(i.negate())) : (i = t.lastIntersect ? t.lastIntersect.location || t.lastIntersect : f.bound.center,
  43717. t = r.position.distanceTo(i),
  43718. i = Rg.getHFOVForCamera(r, !0),
  43719. i = t * Math.tan(i / 2),
  43720. m.translationDelta.x -= e.drag.pointerDelta.x * i,
  43721. m.translationDelta.z -= e.drag.pointerDelta.y * i);
  43722. m.useAttenuation = !1
  43723. }
  43724. a.includes("scale") && (m.dollyEnd.subVectors(e.touches[0].pointer, e.touches[1].pointer),
  43725. a = m.dollyEnd.length() / m.dollyStart.length(),
  43726. e = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5),
  43727. v({
  43728. pointer: e,
  43729. scale: a,
  43730. camera: r
  43731. }),
  43732. m.dollyStart.copy(m.dollyEnd))
  43733. }
  43734. }
  43735. }
  43736. , v = function() {
  43737. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  43738. if ("showPanos" != Potree.settings.displayMode || m.currentViewport != f.mainViewport) {
  43739. var t = e.camera;
  43740. if ("OrthographicCamera" == t.type) {
  43741. if (null != e.delta) {
  43742. if (0 == e.delta)
  43743. return;
  43744. e.delta < 0 ? r = .9 : 0 < e.delta && (r = 1.1)
  43745. } else
  43746. r = e.scale;
  43747. var n = t.zoom * r
  43748. , i = t.zoomLimit;
  43749. i && (n = gn.clamp(n, i.min, i.max));
  43750. var r = new Cn(e.pointer.x,e.pointer.y,.5)
  43751. , i = r.clone().unproject(t);
  43752. t.zoom != n && (t.zoom = n,
  43753. t.updateProjectionMatrix());
  43754. t = r.clone().unproject(t),
  43755. i = (new Cn).subVectors(t, i);
  43756. m.translationWorldDelta.add(i.negate()),
  43757. m.useAttenuation = !1
  43758. } else {
  43759. if (null != e.delta) {
  43760. if (a = 15 * m.currentViewport.getMoveSpeed(),
  43761. o = m.viewer.inputHandler.getMouseDirection().direction,
  43762. 0 == e.delta)
  43763. return;
  43764. e.delta < 0 && (a *= -1)
  43765. } else
  43766. var i = 200 * m.currentViewport.getMoveSpeed()
  43767. , a = (e.scale - 1) * i
  43768. , o = m.viewer.inputHandler.getMouseDirection(e.pointer).direction;
  43769. m.useAttenuation = !0;
  43770. a = o.multiplyScalar(a);
  43771. m.translationWorldDelta.copy(a)
  43772. }
  43773. } else
  43774. m.dispatchEvent({
  43775. type: "dollyStopCauseUnable",
  43776. delta: e.delta,
  43777. scale: e.scale
  43778. })
  43779. };
  43780. m.viewer.addEventListener("global_drag", t),
  43781. m.viewer.addEventListener("global_drop", function(e) {
  43782. m.enabled && m.dispatchEvent({
  43783. type: "end"
  43784. })
  43785. }),
  43786. m.viewer.addEventListener("global_mousewheel", function(e) {
  43787. m.enabled && e.hoverViewport && (m.setCurrentViewport(e),
  43788. e.camera = e.hoverViewport.camera,
  43789. v(e))
  43790. }),
  43791. m.viewer.addEventListener("global_dblclick", function(e) {
  43792. m.enabled && Potree.settings.dblToFocusPoint && "showPointCloud" == Potree.settings.displayMode && m.zoomToLocation(e.mouse)
  43793. });
  43794. function n(e) {
  43795. m.dollyStart.subVectors(e.touches[0].pointer, e.touches[1].pointer)
  43796. }
  43797. function i(e) {
  43798. m.pointerDragStart = e.pointer.clone(),
  43799. m.intersectStart = e.intersect && e.intersect.location && {
  43800. location: e.intersect.location,
  43801. pointer: e.intersect.location.clone().project(e.dragViewport.camera)
  43802. }
  43803. }
  43804. function r(e) {
  43805. m.pointerDragStart = e.pointer.clone(),
  43806. e.drag.z = void 0,
  43807. t(e)
  43808. }
  43809. return m.viewer.addEventListener("global_mousedown", function(e) {
  43810. m.enabled && (m.setCurrentViewport(e),
  43811. i(e))
  43812. }),
  43813. m.viewer.addEventListener("global_touchstart", function(e) {
  43814. m.enabled && (2 == e.touches.length ? n(e) : 3 <= e.touches.length && r(e))
  43815. }),
  43816. m.viewer.addEventListener("global_touchend", function(e) {
  43817. m.enabled && (2 == e.touches.length ? n(e) : 1 == e.touches.length ? i(e) : 3 <= e.touches.length && r(e))
  43818. }),
  43819. m
  43820. }
  43821. return h(o, [{
  43822. key: "canMovePos",
  43823. value: function(e) {
  43824. return e != viewer.mainViewport || "showPanos" != Potree.settings.displayMode && !viewer.images360.bumping && !viewer.images360.latestToPano
  43825. }
  43826. }, {
  43827. key: "setEnable",
  43828. value: function(e) {
  43829. this.enabled = e
  43830. }
  43831. }, {
  43832. key: "setFPCMoveSpeed",
  43833. value: function(e) {
  43834. var t;
  43835. "OrthographicCamera" == e.camera.type ? (t = 1 / e.camera.zoom,
  43836. e.setMoveSpeed(t)) : e == viewer.mainViewport && o.boundPlane && (e = o.boundPlane.distanceToPoint(viewer.mainViewport.view.position),
  43837. e = Math.sqrt(e) / 10,
  43838. e = Math.max(o.standardSpeed, e),
  43839. e *= Potree.config.moveSpeedAdujust,
  43840. viewer.setMoveSpeed(e))
  43841. }
  43842. }, {
  43843. key: "setCurrentViewport",
  43844. value: function() {
  43845. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  43846. (this.enabled || e.force) && (e.hoverViewport && this.currentViewport != e.hoverViewport && (this.currentViewport = e.hoverViewport,
  43847. this.setFPCMoveSpeed(this.currentViewport)),
  43848. "OrthographicCamera" == this.currentViewport.camera.type ? (this.lockElevationOri = !0,
  43849. this.lockRotation = !0) : (this.lockElevationOri = !1,
  43850. this.lockRotation = !1))
  43851. }
  43852. }, {
  43853. key: "setScene",
  43854. value: function(e) {
  43855. this.scene = e
  43856. }
  43857. }, {
  43858. key: "stop",
  43859. value: function() {
  43860. this.yawDelta = 0,
  43861. this.pitchDelta = 0,
  43862. this.translationDelta.set(0, 0, 0)
  43863. }
  43864. }, {
  43865. key: "zoomToLocation",
  43866. value: function(e) {
  43867. var t, n, i, r, a, o, s, l, u, c, d, h, p = this;
  43868. this.enabled && (i = this.scene.getActiveCamera(),
  43869. (t = this.viewer.inputHandler.intersect) && (o = 0,
  43870. this.renderer.domElement,
  43871. a = Jf.mouseToRay(this.viewer.inputHandler.pointer, i),
  43872. n = (r = this.viewer.inputHandler.getMouseDirection()).origin,
  43873. i = r.direction,
  43874. (r = new sh).ray.set(n, i),
  43875. a = t.pointcloud.nodesOnRay(t.pointcloud.visibleNodes, a),
  43876. t.pointcloud.nodesOnRay(t.pointcloud.visibleNodes, r.ray),
  43877. a = a[a.length - 1].getBoundingSphere(new qn).radius,
  43878. o = Math.min(this.scene.view.radius, a),
  43879. o = Math.max(.2, o),
  43880. a = this.scene.view.direction.multiplyScalar(-1),
  43881. a = (new Cn).addVectors(t.location, a.multiplyScalar(o)),
  43882. o = TWEEN.Easing.Quartic.Out,
  43883. s = {
  43884. x: 0
  43885. },
  43886. (l = new TWEEN.Tween(s).to({
  43887. x: 1
  43888. }, 600)).easing(o),
  43889. this.tweens.push(l),
  43890. u = this.scene.view.position.clone(),
  43891. c = a.clone(),
  43892. d = this.scene.view.radius,
  43893. h = a.distanceTo(t.location),
  43894. l.onUpdate(function() {
  43895. var e = s.x;
  43896. p.scene.view.position.x = (1 - e) * u.x + e * c.x,
  43897. p.scene.view.position.y = (1 - e) * u.y + e * c.y,
  43898. p.scene.view.position.z = (1 - e) * u.z + e * c.z,
  43899. p.scene.view.radius = (1 - e) * d + e * h,
  43900. p.viewer.setMoveSpeed(p.scene.view.radius / 2.5)
  43901. }),
  43902. l.onComplete(function() {
  43903. p.tweens = p.tweens.filter(function(e) {
  43904. return e !== l
  43905. })
  43906. }),
  43907. l.start()))
  43908. }
  43909. }, {
  43910. key: "update",
  43911. value: function() {
  43912. var e, t, n, i, r, a, o, s, l, u, c, d, h = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1;
  43913. this.enabled && (e = this.currentViewport.view,
  43914. [this.yawDelta, this.pitchDelta, this.translationDelta.length(), this.translationWorldDelta.length()].some(function(e) {
  43915. return .001 < Math.abs(e)
  43916. }) && 0 < this.tweens.length && (this.tweens.forEach(function(e) {
  43917. return e.stop()
  43918. }),
  43919. this.tweens = []),
  43920. t = this.viewer.inputHandler,
  43921. c = this.keys.FORWARD.some(function(e) {
  43922. return t.pressedKeys[e]
  43923. }),
  43924. d = this.keys.BACKWARD.some(function(e) {
  43925. return t.pressedKeys[e]
  43926. }),
  43927. n = this.keys.LEFT.some(function(e) {
  43928. return t.pressedKeys[e]
  43929. }),
  43930. i = this.keys.RIGHT.some(function(e) {
  43931. return t.pressedKeys[e]
  43932. }),
  43933. r = this.keys.UP.some(function(e) {
  43934. return t.pressedKeys[e]
  43935. }),
  43936. a = this.keys.DOWN.some(function(e) {
  43937. return t.pressedKeys[e]
  43938. }),
  43939. o = this.keys.Rotate_LEFT.some(function(e) {
  43940. return t.pressedKeys[e]
  43941. }),
  43942. s = this.keys.Rotate_RIGHT.some(function(e) {
  43943. return t.pressedKeys[e]
  43944. }),
  43945. l = this.keys.Rotate_UP.some(function(e) {
  43946. return t.pressedKeys[e]
  43947. }),
  43948. u = this.keys.Rotate_DOWN.some(function(e) {
  43949. return t.pressedKeys[e]
  43950. }),
  43951. this.lockElevation = this.lockElevationOri || this.keys.ALT.some(function(e) {
  43952. return t.pressedKeys[e]
  43953. }),
  43954. this.lockRotation || (o ? this.yawDelta -= .01 : s && (this.yawDelta += .01),
  43955. l ? this.pitchDelta -= .01 : u && (this.pitchDelta += .01)),
  43956. this.canMovePos(this.currentViewport) && !this.lockKey && (this.lockElevation ? ((u = e.direction).z = 0,
  43957. u.normalize(),
  43958. c && d ? this.translationWorldDelta.set(0, 0, 0) : c ? this.translationWorldDelta.copy(u.multiplyScalar(this.currentViewport.getMoveSpeed())) : d && this.translationWorldDelta.copy(u.multiplyScalar(-this.currentViewport.getMoveSpeed()))) : c && d ? this.translationDelta.y = 0 : c ? this.translationDelta.y = this.currentViewport.getMoveSpeed() : d && (this.translationDelta.y = -this.currentViewport.getMoveSpeed()),
  43959. n && i ? this.translationDelta.x = 0 : n ? this.translationDelta.x = -this.currentViewport.getMoveSpeed() : i && (this.translationDelta.x = this.currentViewport.getMoveSpeed()),
  43960. r && a ? this.translationWorldDelta.z = 0 : r ? this.translationWorldDelta.z = this.currentViewport.getMoveSpeed() : a && (this.translationWorldDelta.z = -this.currentViewport.getMoveSpeed()),
  43961. (r || a || c || d) && (this.useAttenuation = !1)),
  43962. c = e.yaw,
  43963. d = e.pitch,
  43964. c += this.yawDelta,
  43965. d += this.pitchDelta,
  43966. e.yaw = c,
  43967. e.pitch = d,
  43968. this.yawDelta = 0,
  43969. this.pitchDelta = 0,
  43970. this.translationWorldDelta.length(),
  43971. e.translate(this.translationDelta.x, this.translationDelta.y, this.translationDelta.z),
  43972. this.translationDelta.set(0, 0, 0),
  43973. e.translateWorld(this.translationWorldDelta.x, this.translationWorldDelta.y, this.translationWorldDelta.z),
  43974. this.useAttenuation ? (h = Math.max(0, 1 - this.fadeFactor * h),
  43975. this.translationWorldDelta.multiplyScalar(h)) : this.translationWorldDelta.set(0, 0, 0))
  43976. }
  43977. }]),
  43978. o
  43979. }(), Ig = function() {
  43980. function i(e, t) {
  43981. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};
  43982. O(this, i),
  43983. this.left = n.left,
  43984. this.bottom = n.bottom,
  43985. this.width = n.width,
  43986. this.height = n.height,
  43987. this.name = n.name,
  43988. this.view = e,
  43989. this.camera = t,
  43990. this.active = !0,
  43991. this.unableChangePos = !1,
  43992. this.noPointcloud,
  43993. this.resolution = new yn,
  43994. this.resolution2 = new yn,
  43995. this.offset = new yn,
  43996. this.extraEnableLayers = n.extraEnableLayers || [],
  43997. this.cameraLayers = n.cameraLayers,
  43998. this.pixelRatio = n.pixelRatio
  43999. }
  44000. return h(i, [{
  44001. key: "clone",
  44002. value: function() {
  44003. return Fm.CloneClassObject(this)
  44004. }
  44005. }, {
  44006. key: "getMoveSpeed",
  44007. value: function() {
  44008. return this.moveSpeed
  44009. }
  44010. }, {
  44011. key: "setMoveSpeed",
  44012. value: function(e) {
  44013. this.moveSpeed = e
  44014. }
  44015. }, {
  44016. key: "layersAdd",
  44017. value: function(e) {
  44018. this.extraEnableLayers.includes(e) || this.extraEnableLayers.push(e)
  44019. }
  44020. }, {
  44021. key: "layersRemove",
  44022. value: function(e) {
  44023. e = this.extraEnableLayers.indexOf(e);
  44024. -1 < e && this.extraEnableLayers.splice(e, 1)
  44025. }
  44026. }, {
  44027. key: "cameraChanged",
  44028. value: function() {
  44029. var e = this
  44030. , t = !0
  44031. , n = !0
  44032. , i = !0;
  44033. return this.previousState && (t = !this.camera.projectionMatrix.equals(this.previousState.projectionMatrix),
  44034. n = !this.camera.position.equals(this.previousState.position),
  44035. i = !this.camera.quaternion.equals(this.previousState.quaternion)),
  44036. e.previousState = {
  44037. projectionMatrix: e.camera.projectionMatrix.clone(),
  44038. position: e.camera.position.clone(),
  44039. quaternion: e.camera.quaternion.clone()
  44040. },
  44041. {
  44042. projectionChanged: t,
  44043. positionChanged: n,
  44044. quaternionChanged: i,
  44045. changed: t || n || i
  44046. }
  44047. }
  44048. }, {
  44049. key: "setResolution",
  44050. value: function(e, t) {
  44051. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  44052. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0;
  44053. this.resolution.set(e, t),
  44054. this.resolution2.copy(this.resolution).multiplyScalar(this.pixelRatio || window.devicePixelRatio),
  44055. this.offset.set(n, i).multiply(new yn(this.left,this.bottom)).multiplyScalar(window.devicePixelRatio)
  44056. }
  44057. }]),
  44058. i
  44059. }(), Og = function() {
  44060. y(r, hn);
  44061. var i = w(r);
  44062. function r(e, t) {
  44063. var n;
  44064. return O(this, r),
  44065. (n = i.call(this)).viewer = e,
  44066. n.renderer = e.renderer,
  44067. n.domElement = n.renderer.domElement,
  44068. n.enabled = !0,
  44069. n.scene = t,
  44070. n.interactiveScenes = [],
  44071. n.interactiveObjects = new Set,
  44072. n.inputListeners = [],
  44073. n.blacklist = new Set,
  44074. n.drag = null,
  44075. n.mouse = new yn(0,0),
  44076. n.pointer = new yn(0,0),
  44077. n.mouseDownMouse = new yn(0,0),
  44078. n.selection = [],
  44079. n.hoveredElements = [],
  44080. n.pressedKeys = {},
  44081. n.wheelDelta = 0,
  44082. n.speed = 1,
  44083. n.logMessages = !1,
  44084. -1 === n.domElement.tabIndex && (n.domElement.tabIndex = 2222),
  44085. n.lastPointerUpTime = 0,
  44086. n.touches = [],
  44087. n.hoverViewport = e.viewports[0],
  44088. n.domElement.addEventListener("contextmenu", function(e) {
  44089. e.preventDefault()
  44090. }, !1),
  44091. n.domElement.addEventListener("click", n.onMouseClick.bind(g(n)), !1),
  44092. n.domElement.addEventListener("mousedown", n.onMouseDown.bind(g(n)), !1),
  44093. window.addEventListener("mouseup", n.onMouseUp.bind(g(n)), !1),
  44094. n.domElement.addEventListener("mousemove", n.onMouseMove.bind(g(n)), !1),
  44095. n.domElement.addEventListener("mousewheel", n.onMouseWheel.bind(g(n)), !1),
  44096. n.domElement.addEventListener("DOMMouseScroll", n.onMouseWheel.bind(g(n)), !1),
  44097. n.domElement.addEventListener("keydown", n.onKeyDown.bind(g(n))),
  44098. window.addEventListener("keyup", n.onKeyUp.bind(g(n))),
  44099. window.addEventListener("blur", n.onKeyUp.bind(g(n))),
  44100. n.domElement.addEventListener("touchstart", n.onTouchStart.bind(g(n))),
  44101. n.domElement.addEventListener("touchend", n.onTouchEnd.bind(g(n))),
  44102. n.domElement.addEventListener("touchmove", n.onTouchMove.bind(g(n))),
  44103. n.addEventListener("isMeasuring", function(e) {
  44104. n.isMeasuring = e.v
  44105. }),
  44106. n
  44107. }
  44108. return h(r, [{
  44109. key: "updateTouchesInfo",
  44110. value: function(e) {
  44111. var i, r, a = this, n = this.touches, o = Array.from(e.changedTouches), t = Array.from(e.touches);
  44112. if (this.touches = t.map(function(t) {
  44113. var e = n.find(function(e) {
  44114. return e.touch.identifier == t.identifier
  44115. })
  44116. , e = e && e.pointer;
  44117. return {
  44118. touch: t,
  44119. pointer: e
  44120. }
  44121. }),
  44122. 0 < e.touches.length) {
  44123. var t = t.filter(function(t) {
  44124. return !n.some(function(e) {
  44125. return e.touch.identifier == t.identifier
  44126. }) && !o.some(function(e) {
  44127. return e.identifier == t.identifier
  44128. })
  44129. });
  44130. return 0 < t.length && console.warn("has new", t.map(function(e) {
  44131. return e.identifier
  44132. })),
  44133. t.concat(o).forEach(function(t) {
  44134. var e, n = a.touches.find(function(e) {
  44135. return e.touch.identifier == t.identifier
  44136. });
  44137. n && (e = a.getPointerInViewport(t.pageX, t.pageY, a.dragViewport || i, new yn),
  44138. n.pointer = e.pointer.clone(),
  44139. i = e.viewport,
  44140. r = e.camera)
  44141. }),
  44142. 1 < e.touches.length ? (t = Fm.average(e.touches, "pageX"),
  44143. e = Fm.average(e.touches, "pageY"),
  44144. e = this.getPointerInViewport(t, e, i, new yn),
  44145. this.pointer.copy(e.pointer)) : this.pointer = this.touches[0].pointer.clone(),
  44146. {
  44147. viewport: i,
  44148. camera: r
  44149. }
  44150. }
  44151. }
  44152. }, {
  44153. key: "onTouchStart",
  44154. value: function(e) {
  44155. this.logMessages && console.log(this.constructor.name + ": onTouchStart"),
  44156. e.preventDefault(),
  44157. this.dealPointerDown(e, !0),
  44158. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), {
  44159. type: "global_" + e.type,
  44160. changedTouches: e.changedTouches
  44161. }))
  44162. }
  44163. }, {
  44164. key: "onTouchMove",
  44165. value: function(e) {
  44166. this.logMessages && console.log(this.constructor.name + ": onTouchMove"),
  44167. e.preventDefault(),
  44168. this.dealPointerMove(e, !0),
  44169. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), {
  44170. type: "global_" + e.type,
  44171. changedTouches: e.changedTouches
  44172. }))
  44173. }
  44174. }, {
  44175. key: "onTouchEnd",
  44176. value: function(e) {
  44177. this.logMessages && console.log(this.constructor.name + ": onTouchEnd"),
  44178. e.preventDefault(),
  44179. this.updateTouchesInfo(e),
  44180. this.dealPointerUp(e, !0),
  44181. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), {
  44182. type: "global_" + e.type
  44183. }))
  44184. }
  44185. }, {
  44186. key: "onKeyDown",
  44187. value: function(e) {
  44188. this.logMessages && console.log(this.constructor.name + ": onKeyDown"),
  44189. e.keyCode === ym.DELETE && 0 < this.selection.length && (this.dispatchEvent({
  44190. type: "delete",
  44191. selection: this.selection
  44192. }),
  44193. this.deselectAll()),
  44194. this.dispatchEvent({
  44195. type: "keydown",
  44196. keyCode: e.keyCode,
  44197. event: e
  44198. }),
  44199. this.pressedKeys[e.keyCode] = !0
  44200. }
  44201. }, {
  44202. key: "onKeyUp",
  44203. value: function(e) {
  44204. this.logMessages && console.log(this.constructor.name + ": onKeyUp"),
  44205. null != e.keyCode ? delete this.pressedKeys[e.keyCode] : this.pressedKeys = {},
  44206. e.preventDefault()
  44207. }
  44208. }, {
  44209. key: "onDoubleClick",
  44210. value: function(e) {
  44211. this.logMessages && console.log(this.constructor.name + ": onDoubleClick");
  44212. var t, n = !1, i = ue(this.hoveredElements);
  44213. try {
  44214. for (i.s(); !(t = i.n()).done; ) {
  44215. var r = t.value;
  44216. if (r._listeners && r._listeners.dblclick) {
  44217. r.object.dispatchEvent({
  44218. type: "dblclick",
  44219. mouse: this.mouse,
  44220. object: r.object
  44221. }),
  44222. n = !0;
  44223. break
  44224. }
  44225. }
  44226. } catch (e) {
  44227. i.e(e)
  44228. } finally {
  44229. i.f()
  44230. }
  44231. n || this.viewer.dispatchEvent({
  44232. type: "global_dblclick",
  44233. mouse: this.mouse,
  44234. object: null
  44235. }),
  44236. this.needSingleClick = !1,
  44237. e.preventDefault()
  44238. }
  44239. }, {
  44240. key: "onMouseClick",
  44241. value: function(e) {
  44242. this.logMessages && console.log(this.constructor.name + ": onMouseClick"),
  44243. e.preventDefault()
  44244. }
  44245. }, {
  44246. key: "dealPointerDown",
  44247. value: function(e, t) {
  44248. var n, i;
  44249. if (e.preventDefault(),
  44250. t ? ((n = this.updateTouchesInfo(e)).camera,
  44251. i = n.viewport,
  44252. this.drag && (this.drag.end = this.pointer.clone())) : ((n = this.getPointerInViewport(e.clientX, e.clientY)).camera,
  44253. i = n.viewport),
  44254. this.dragViewport = this.hoverViewport = i,
  44255. !t && Potree.settings.intersectWhenHover || (this.hoveredElements = this.getHoveredElements(),
  44256. this.intersect = this.getIntersect(i)),
  44257. i) {
  44258. if (!t || 1 == e.touches.length) {
  44259. var r = !1
  44260. , a = function() {
  44261. return r = !0
  44262. };
  44263. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44264. type: "global_mousedown"
  44265. }));
  44266. var o, s = ue(this.hoveredElements);
  44267. try {
  44268. for (s.s(); !(o = s.n()).done; )
  44269. if (o.value.object.dispatchEvent({
  44270. type: "mousedown",
  44271. viewer: this.viewer,
  44272. consume: a
  44273. }),
  44274. r)
  44275. break
  44276. } catch (e) {
  44277. s.e(e)
  44278. } finally {
  44279. s.f()
  44280. }
  44281. }
  44282. this.drag || ((e = (t || e.button == C.LEFT) && this.hoveredElements.find(function(e) {
  44283. return e.object._listeners && e.object._listeners.drag && 0 < e.object._listeners.drag.length
  44284. })) ? this.startDragging(e.object, {
  44285. location: e.point
  44286. }) : this.startDragging(null)),
  44287. this.drag.intersectStart = this.intersect,
  44288. this.mouseDownMouse = this.mouse.clone(),
  44289. this.pointerDownTime = Date.now()
  44290. }
  44291. }
  44292. }, {
  44293. key: "onMouseDown",
  44294. value: function(e) {
  44295. this.logMessages && console.log(this.constructor.name + ": onMouseDown"),
  44296. this.dealPointerDown(e)
  44297. }
  44298. }, {
  44299. key: "getEventDesc",
  44300. value: function(e, t) {
  44301. var n = {
  44302. viewer: this.viewer,
  44303. mouse: this.mouse,
  44304. pointer: this.pointer,
  44305. drag: this.drag,
  44306. isTouch: t,
  44307. dragViewport: this.dragViewport,
  44308. hoverViewport: this.hoverViewport,
  44309. hoveredElement: this.hoveredElements[0],
  44310. intersect: this.intersect
  44311. };
  44312. return e && (n.isAtDomElement = e.target == this.domElement),
  44313. t ? n.touches = this.touches : e && (n.button = e.button,
  44314. n.buttons = e.buttons),
  44315. n
  44316. }
  44317. }, {
  44318. key: "dealPointerUp",
  44319. value: function(e, t) {
  44320. var n, i, r, a, o, s, l, u, c, d, h, p = this;
  44321. this.drag && (this.drag.end.copy(this.pointer),
  44322. t && 1 <= e.touches.length || (n = Date.now(),
  44323. this.logMessages && console.log(this.constructor.name + ": onMouseUp"),
  44324. e.preventDefault(),
  44325. i = this.mouseDownMouse.distanceTo(this.mouse),
  44326. r = n - this.pointerDownTime,
  44327. a = 0 == this.drag.pointerDelta.length(),
  44328. o = !1,
  44329. s = function() {
  44330. return o = !0
  44331. }
  44332. ,
  44333. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44334. type: "global_mouseup",
  44335. pressDistance: i,
  44336. consume: s
  44337. })),
  44338. 0 < this.hoveredElements.length && ((l = this.hoveredElements.map(function(e) {
  44339. return e.object
  44340. }).find(function(e) {
  44341. return e._listeners && e._listeners.mouseup
  44342. })) && l.dispatchEvent({
  44343. type: "mouseup",
  44344. viewer: this.viewer,
  44345. consume: s
  44346. })),
  44347. this.drag && (this.drag.object ? (this.logMessages && console.log("".concat(this.constructor.name, ": drop ").concat(this.drag.object.name)),
  44348. this.drag.object.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44349. type: "drop",
  44350. pressDistance: i
  44351. }))) : this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44352. type: "global_drop",
  44353. pressDistance: i
  44354. })),
  44355. i < Potree.config.clickMaxDragDis && r < Potree.config.clickMaxPressTime && (this.hoveredElements && (u = this.hoveredElements.find(function(e) {
  44356. return e.object._listeners.click
  44357. })) && (console.log("clickElement", u),
  44358. this.logMessages && console.log("".concat(this.constructor.name, ": click ").concat(u.name)),
  44359. u.object.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44360. type: "click",
  44361. pressDistance: i
  44362. }))),
  44363. c = !1,
  44364. d = this.getEventDesc(e, t),
  44365. this.viewer.dispatchEvent($.extend(d, {
  44366. type: "global_click",
  44367. pressDistance: i,
  44368. consume: function() {
  44369. return c = !0
  44370. }
  44371. })),
  44372. this.needSingleClick = !0,
  44373. c || setTimeout(function() {
  44374. p.needSingleClick && p.viewer.dispatchEvent($.extend(d, {
  44375. type: "global_single_click",
  44376. pressDistance: i,
  44377. clickElement: u
  44378. }))
  44379. }, Potree.config.doubleClickTime + 1),
  44380. n - this.lastClickTime < Potree.config.doubleClickTime && this.onDoubleClick(e),
  44381. this.lastClickTime = n),
  44382. this.drag = null),
  44383. this.dragViewport = null,
  44384. o || this.fixSelection || (e.button === C.LEFT ? a && ((h = this.hoveredElements.find(function(e) {
  44385. return e.object._listeners && e.object._listeners.select
  44386. })) ? (h = h.object,
  44387. this.isSelected(h) ? this.selection.filter(function(e) {
  44388. return e !== h
  44389. }).forEach(function(e) {
  44390. return p.toggleSelection(e)
  44391. }) : (this.deselectAll(),
  44392. this.toggleSelection(h))) : this.deselectAll()) : e.button === C.RIGHT && a && this.deselectAll())))
  44393. }
  44394. }, {
  44395. key: "onMouseUp",
  44396. value: function(e) {
  44397. this.dealPointerUp(e)
  44398. }
  44399. }, {
  44400. key: "getPointerInViewport",
  44401. value: function(e, t, n, o) {
  44402. var s, l, u = this, i = this.domElement.getBoundingClientRect(), c = e - i.left, d = t - i.top;
  44403. o = o || this.pointer;
  44404. function r(e) {
  44405. var t = Math.ceil(u.domElement.clientWidth * e.left)
  44406. , n = Math.ceil(u.domElement.clientHeight * e.bottom)
  44407. , i = Math.ceil(u.domElement.clientWidth * e.width)
  44408. , e = Math.ceil(u.domElement.clientHeight * e.height);
  44409. return {
  44410. left: t,
  44411. bottom: n,
  44412. width: i,
  44413. height: e,
  44414. top: u.domElement.clientHeight - n - e
  44415. }
  44416. }
  44417. function a(e, t, n, i, r, a) {
  44418. u.mouse.set(c - t, d - a),
  44419. Jf.convertScreenPositionToNDC(o, u.mouse, i, r),
  44420. s = e.camera,
  44421. l = e
  44422. }
  44423. if (n) {
  44424. t = r(n),
  44425. i = t.left;
  44426. t.bottom;
  44427. a(n, i, 0, t.width, t.height, t.top)
  44428. } else
  44429. for (var h = this.viewer.viewports.length, p = 0; p < h; p++) {
  44430. var f = this.viewer.viewports[p];
  44431. if (f.active) {
  44432. var m = r(f)
  44433. , v = m.left
  44434. , g = (m.bottom,
  44435. m.width)
  44436. , y = m.height
  44437. , m = m.top;
  44438. if (v <= c && c <= v + g && m <= d && d <= m + y) {
  44439. a(f, v, 0, g, y, m);
  44440. break
  44441. }
  44442. }
  44443. }
  44444. return {
  44445. camera: s,
  44446. viewport: l,
  44447. pointer: o
  44448. }
  44449. }
  44450. }, {
  44451. key: "ifBlockedByIntersect",
  44452. value: function(e) {
  44453. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  44454. , n = 2 < arguments.length ? arguments[2] : void 0
  44455. , i = 3 < arguments.length ? arguments[3] : void 0
  44456. , r = 4 < arguments.length ? arguments[4] : void 0
  44457. , a = 5 < arguments.length ? arguments[5] : void 0
  44458. , r = this.getIntersect(this.hoverViewport, !0, r, null, n = i ? !0 : n, {
  44459. point: e,
  44460. cameraPos: i,
  44461. pano: a
  44462. })
  44463. , i = !n && a ? a.position : i || this.hoverViewport.view.position;
  44464. if (r && r.distance + t <= e.distanceTo(i))
  44465. return r
  44466. }
  44467. }, {
  44468. key: "getIntersect",
  44469. value: function(e, t, n, i, r) {
  44470. var a, o, s, l, u = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : {}, c = e.camera;
  44471. return "showPanos" != Potree.settings.displayMode || !viewer.images360.currentPano.pointcloud.hasDepthTex || r || this.isMeasuring || e != viewer.mainViewport ? (u.point && (u.cameraPos && c.position.copy(u.cameraPos),
  44472. c.lookAt(u.point),
  44473. c.updateMatrixWorld(),
  44474. u.pointer = this.pointer.clone(),
  44475. u.mouse = this.mouse.clone(),
  44476. this.pointer.set(0, 0),
  44477. this.mouse.set(Math.round(e.resolution.x / 2), Math.round(e.resolution.y / 2))),
  44478. l = e.noPointcloud || i ? null : Jf.getMousePointCloudIntersection(e, this.mouse, this.pointer, c, this.viewer, this.viewer.scene.pointclouds, {
  44479. pickClipped: !0,
  44480. isMeasuring: this.isMeasuring,
  44481. pickWindowSize: n,
  44482. cameraChanged: !!u.point
  44483. }),
  44484. u.point && (e.view.applyToCamera(c),
  44485. this.pointer.copy(u.pointer),
  44486. this.mouse.copy(u.mouse))) : (a = u.point ? (a = (u.pano || c).position,
  44487. {
  44488. dir: (new Cn).subVectors(u.point, a).normalize()
  44489. }) : Jf.getIntersect(c, [viewer.images360.cube], this.pointer, s),
  44490. l = viewer.images360.depthSampler.sample(a, u.pano, !!u.point)),
  44491. Potree.settings.intersectOnObjs && !i && (u.point && (s = new sh,
  44492. u = (new Cn).subVectors(u.point, c.position).normalize(),
  44493. s.set(c.position, u)),
  44494. (s = this.getHoveredElements(viewer.objs.children, !0, s))[0] && (o = {
  44495. hoveredElement: s[0],
  44496. location: s[0].point,
  44497. normal: s[0].face.normal,
  44498. distance: s[0].distance,
  44499. object: s[0].object
  44500. })),
  44501. l = l && o ? l.distance < o.distance ? l : o : o || l,
  44502. "OrthographicCamera" == e.camera.type && (e = new Cn(this.pointer.x,this.pointer.y,-1).unproject(e.camera),
  44503. (l = l || {}).orthoIntersect = e.clone()),
  44504. t || (l && viewer.showCoordType && (t = l.point.position.toArray(),
  44505. "local" == viewer.showCoordType || (t = "lonlat" == viewer.showCoordType ? viewer.transform.lonlatToLocal.inverse(t) : (t = viewer.transform.lonlatToLocal.inverse(t),
  44506. viewer.transform.lonlatTo4550.forward(t))),
  44507. viewer.dispatchEvent({
  44508. type: "coordinateChange",
  44509. pos: t
  44510. })),
  44511. (this.intersect = l) && (this.hoverViewport.lastIntersect = l)),
  44512. l
  44513. }
  44514. }, {
  44515. key: "onMouseMove",
  44516. value: function(e) {
  44517. return this.dealPointerMove(e)
  44518. }
  44519. }, {
  44520. key: "dealPointerMove",
  44521. value: function(e, t) {
  44522. var n;
  44523. if (n = t ? ((n = this.updateTouchesInfo(e)).camera,
  44524. n.viewport) : ((a = this.getPointerInViewport(e.clientX, e.clientY, this.dragViewport)).camera,
  44525. a.viewport),
  44526. this.hoverViewport = n) {
  44527. var i, r, a = this.viewer.viewports.some(function(e) {
  44528. return e.view.isFlying()
  44529. }) || viewer.scene.cameraAnimations.some(function(e) {
  44530. return e.onUpdate
  44531. });
  44532. if ((e.onlyGetIntersect || Potree.settings.intersectWhenHover && (!this.drag || this.drag.object || n.alignment)) && (i = this.drag && n.alignment || a,
  44533. i = this.getIntersect(n, e.onlyGetIntersect, e.pickWindowSize, !!i, e.whichPointcloud)),
  44534. e.onlyGetIntersect)
  44535. return i;
  44536. e.preventDefault(),
  44537. this.drag && (this.drag.mouse = t ? 1 : e.buttons,
  44538. this.drag.pointerDelta.subVectors(this.pointer, this.drag.end),
  44539. this.drag.end.copy(this.pointer),
  44540. !this.drag.object || e.buttons != rm.NONE && this.drag.notPressMouse ? (this.logMessages && console.log(this.constructor.name + ": drag: "),
  44541. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44542. type: "global_drag",
  44543. consume: function() {}
  44544. }))) : (this.logMessages && console.log(this.constructor.name + ": drag: " + this.drag.object.name),
  44545. this.drag.object.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44546. type: "drag"
  44547. })))),
  44548. t && 1 != e.touches.length || ((!this.drag || this.drag.notPressMouse || Potree.settings.intersectOnObjs && this.drag.object) && !a && (0 < (i = this.getHoveredElements()).length && (r = i.map(function(e) {
  44549. return e.object.name
  44550. }).join(", "),
  44551. this.logMessages && console.log("".concat(this.constructor.name, ": onMouseMove; hovered: '").concat(r, "'"))),
  44552. (a = i.map(function(e) {
  44553. return e.object
  44554. }).find(function(e) {
  44555. return !0
  44556. })) !== (r = this.lastMouseoverElement) && (a && (this.logMessages && console.log("".concat(this.constructor.name, ": mouseover: ").concat(a.name)),
  44557. a.dispatchEvent({
  44558. type: "mouseover",
  44559. object: a
  44560. })),
  44561. r && (this.logMessages && console.log("".concat(this.constructor.name, ": mouseleave: ").concat(r.name)),
  44562. r.dispatchEvent({
  44563. type: "mouseleave",
  44564. object: r
  44565. })),
  44566. this.lastMouseoverElement = a),
  44567. 0 < i.length && ((a = i.map(function(e) {
  44568. return e.object
  44569. }).find(function(e) {
  44570. return e._listeners && e._listeners.mousemove
  44571. })) && a.dispatchEvent({
  44572. type: "mousemove",
  44573. object: a
  44574. })),
  44575. this.hoveredElements = i),
  44576. this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), {
  44577. type: "global_mousemove"
  44578. })))
  44579. }
  44580. }
  44581. }, {
  44582. key: "onMouseWheel",
  44583. value: function(e) {
  44584. var t, n;
  44585. this.enabled && (this.logMessages && console.log(this.constructor.name + ": onMouseWheel"),
  44586. e.preventDefault(),
  44587. void (n = 0) !== e.wheelDelta ? n = e.wheelDelta : void 0 !== e.detail && (n = -e.detail),
  44588. t = Math.sign(n),
  44589. this.hoverViewport || (n = this.getPointerInViewport(e.clientX, e.clientY).viewport,
  44590. this.hoverViewport = n),
  44591. this.hoveredElement ? this.hoveredElement.object.dispatchEvent($.extend(this.getEventDesc(e, isTouch), {
  44592. type: "mousewheel",
  44593. delta: t,
  44594. object: this.hoveredElement.object
  44595. })) : this.viewer.dispatchEvent($.extend(this.getEventDesc(e), {
  44596. type: "global_mousewheel",
  44597. delta: t
  44598. })))
  44599. }
  44600. }, {
  44601. key: "startDragging",
  44602. value: function(e) {
  44603. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : null
  44604. , n = e ? e.name : "no name";
  44605. if (this.logMessages && console.log("".concat(this.constructor.name, ": startDragging: '").concat(n, "'")),
  44606. this.drag = {
  44607. start: this.pointer.clone(),
  44608. end: this.pointer.clone(),
  44609. pointerDelta: new yn(0,0),
  44610. object: e,
  44611. hoverViewport: this.hoverViewport,
  44612. dragViewport: this.hoverViewport
  44613. },
  44614. t)
  44615. for (var i = 0, r = Object.keys(t); i < r.length; i++) {
  44616. var a = r[i];
  44617. this.drag[a] = t[a]
  44618. }
  44619. e && e.dispatchEvent($.extend(this.getEventDesc(), {
  44620. type: "startDragging"
  44621. }))
  44622. }
  44623. }, {
  44624. key: "toggleSelection",
  44625. value: function(e) {
  44626. var t = this.selection
  44627. , n = this.selection.indexOf(e);
  44628. -1 === n ? (this.selection.push(e),
  44629. e.dispatchEvent({
  44630. type: "select"
  44631. })) : (this.selection.splice(n, 1),
  44632. e.dispatchEvent({
  44633. type: "deselect"
  44634. })),
  44635. this.dispatchEvent({
  44636. type: "selection_changed",
  44637. oldSelection: t,
  44638. selection: this.selection
  44639. })
  44640. }
  44641. }, {
  44642. key: "deselect",
  44643. value: function(e) {
  44644. var t = this.selection
  44645. , n = this.selection.indexOf(e);
  44646. 0 <= n && (this.selection.splice(n, 1),
  44647. e.dispatchEvent({
  44648. type: "deselect"
  44649. }),
  44650. this.dispatchEvent({
  44651. type: "selection_changed",
  44652. oldSelection: t,
  44653. selection: this.selection
  44654. }))
  44655. }
  44656. }, {
  44657. key: "deselectAll",
  44658. value: function() {
  44659. var e, t = ue(this.selection);
  44660. try {
  44661. for (t.s(); !(e = t.n()).done; )
  44662. e.value.dispatchEvent({
  44663. type: "deselect"
  44664. })
  44665. } catch (e) {
  44666. t.e(e)
  44667. } finally {
  44668. t.f()
  44669. }
  44670. var n = this.selection;
  44671. 0 < this.selection.length && (this.selection = [],
  44672. this.dispatchEvent({
  44673. type: "selection_changed",
  44674. oldSelection: n,
  44675. selection: this.selection
  44676. }))
  44677. }
  44678. }, {
  44679. key: "isSelected",
  44680. value: function(e) {
  44681. return -1 !== this.selection.indexOf(e)
  44682. }
  44683. }, {
  44684. key: "registerInteractiveObject",
  44685. value: function(e) {
  44686. this.interactiveObjects.add(e)
  44687. }
  44688. }, {
  44689. key: "removeInteractiveObject",
  44690. value: function(e) {
  44691. this.interactiveObjects.delete(e)
  44692. }
  44693. }, {
  44694. key: "registerInteractiveScene",
  44695. value: function(e) {
  44696. -1 === this.interactiveScenes.indexOf(e) && this.interactiveScenes.push(e)
  44697. }
  44698. }, {
  44699. key: "unregisterInteractiveScene",
  44700. value: function(e) {
  44701. e = this.interactiveScenes.indexOf(e);
  44702. -1 < e && this.interactiveScenes.splice(e, 1)
  44703. }
  44704. }, {
  44705. key: "getHoveredElement",
  44706. value: function() {
  44707. var e = this.getHoveredElements();
  44708. return 0 < e.length ? e[0] : null
  44709. }
  44710. }, {
  44711. key: "getHoveredElements",
  44712. value: function(r, e, t) {
  44713. var a = this;
  44714. r || function() {
  44715. var e = a.hoverViewport.interactiveScenes || a.interactiveScenes.concat(a.scene)
  44716. , n = ["mouseup", "mousemove", "mouseover", "mouseleave", "drag", "drop", "click", "select", "deselect"];
  44717. r = [];
  44718. var t, i = ue(e);
  44719. try {
  44720. for (i.s(); !(t = i.n()).done; )
  44721. t.value.traverseVisible(function(t) {
  44722. t._listeners && t.visible && !a.blacklist.has(t) && 0 < n.filter(function(e) {
  44723. return void 0 !== t._listeners[e]
  44724. }).length && r.push(t)
  44725. })
  44726. } catch (e) {
  44727. i.e(e)
  44728. } finally {
  44729. i.f()
  44730. }
  44731. }();
  44732. var n, i = this.hoverViewport.camera;
  44733. t || (n = Jf.mouseToRay(this.pointer, i),
  44734. (t = new sh).ray.set(n.origin, n.direction),
  44735. t.camera = i),
  44736. "OrthographicCamera" == i.type ? t.params.Line.threshold = 20 / i.zoom : t.params.Line.threshold = .2,
  44737. t.params.Line2 = {
  44738. threshold: 20
  44739. },
  44740. viewer.setCameraLayers(t, ["sceneObjects", "mapObjects", "measure", "transformationTool", "model"], this.hoverViewport && this.hoverViewport.extraEnableLayers),
  44741. viewer.dispatchEvent({
  44742. type: "raycaster",
  44743. viewport: this.hoverViewport
  44744. });
  44745. t = t.intersectObjects(r.filter(function(e) {
  44746. return e.visible
  44747. }), !0);
  44748. t.slice();
  44749. return t = (t = (t = this.intersect && null != this.intersect.distance && !e ? t.filter(function(e) {
  44750. var t = e.object.material;
  44751. return (e.object.pickDontCheckDis || 0 == t.depthTest || 0 == t.depthWrite) && !t.useDepth || (t.useDepth ? e.distance < a.intersect.distance + t.uniforms.occlusionDistance.value : e.distance < a.intersect.distance)
  44752. }) : t).map(function(e) {
  44753. var t = e.object;
  44754. do {
  44755. if (r.includes(t)) {
  44756. e.oriObject = e.object,
  44757. e.object = t;
  44758. break
  44759. }
  44760. } while (t = t.parent);
  44761. return e
  44762. })).sort(function(e, t) {
  44763. return (t.object.pickOrder || 0) - (e.object.pickOrder || 0)
  44764. })
  44765. }
  44766. }, {
  44767. key: "update",
  44768. value: function(e) {}
  44769. }, {
  44770. key: "getMouseDirection",
  44771. value: function(e) {
  44772. e = e || this.pointer;
  44773. var t = this.hoverViewport.camera
  44774. , n = new Cn(e.x,e.y,-1).unproject(t);
  44775. return {
  44776. origin: n,
  44777. direction: new Cn(e.x,e.y,1).unproject(t).clone().sub(n).normalize()
  44778. }
  44779. }
  44780. }]),
  44781. r
  44782. }(), zg = function() {
  44783. y(r, hn);
  44784. var i = w(r);
  44785. function r(e) {
  44786. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
  44787. return O(this, r),
  44788. (t = i.call(this)).name = n.name,
  44789. t.renderArea = e,
  44790. t.oldResolution = new yn,
  44791. t.screenSizeInfo = {
  44792. W: 0,
  44793. H: 0,
  44794. pixelRatio: 1,
  44795. windowWidth: 0,
  44796. windowHeight: 0
  44797. },
  44798. t.initContext(n),
  44799. t.addEventListener("content_changed", function() {
  44800. t.needRender = !0
  44801. }),
  44802. t
  44803. }
  44804. return h(r, [{
  44805. key: "initContext",
  44806. value: function(e) {
  44807. var t = this
  44808. , n = (this.renderArea.clientWidth,
  44809. this.renderArea.clientHeight,
  44810. document.createElement("canvas"))
  44811. , i = n.getContext("webgl", {
  44812. alpha: !0,
  44813. depth: !0,
  44814. stencil: !1,
  44815. antialias: !0,
  44816. preserveDrawingBuffer: !0,
  44817. powerPreference: "high-performance"
  44818. });
  44819. this.renderer = new ps({
  44820. alpha: !0,
  44821. premultipliedAlpha: !1,
  44822. canvas: n,
  44823. context: i
  44824. }),
  44825. this.renderer.sortObjects = !0,
  44826. this.renderer.autoClear = e.autoClear || !1,
  44827. e.clearColor && this.renderer.setClearColor(e.clearColor),
  44828. this.renderArea.appendChild(this.renderer.domElement),
  44829. this.renderer.domElement.tabIndex = "2222",
  44830. this.renderer.domElement.style.position = "absolute",
  44831. this.renderer.domElement.addEventListener("mousedown", function() {
  44832. t.renderer.domElement.focus()
  44833. });
  44834. i = this.renderer.getContext();
  44835. if (i.getExtension("EXT_frag_depth"),
  44836. i.getExtension("WEBGL_depth_texture"),
  44837. i.getExtension("WEBGL_color_buffer_float"),
  44838. null == i.createVertexArray) {
  44839. e = i.getExtension("OES_vertex_array_object");
  44840. if (!e)
  44841. throw new Error("OES_vertex_array_object extension not supported");
  44842. i.createVertexArray = e.createVertexArrayOES.bind(e),
  44843. i.bindVertexArray = e.bindVertexArrayOES.bind(e)
  44844. }
  44845. }
  44846. }, {
  44847. key: "updateScreenSize",
  44848. value: function() {
  44849. var e, t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = !1;
  44850. null != i.width && null != i.height ? (t = i.width,
  44851. n = i.height,
  44852. r = !0,
  44853. e = 1) : (t = this.renderArea.clientWidth,
  44854. n = this.renderArea.clientHeight,
  44855. t === this.screenSizeInfo.W && n === this.screenSizeInfo.H && !i.forceUpdateSize && this.screenSizeInfo.pixelRatio == window.devicePixelRatio || (this.screenSizeInfo.W = t,
  44856. this.screenSizeInfo.H = n,
  44857. r = !0,
  44858. this.screenSizeInfo.pixelRatio = window.devicePixelRatio,
  44859. e = window.devicePixelRatio)),
  44860. r && this.setSize(t, n, e)
  44861. }
  44862. }, {
  44863. key: "setSize",
  44864. value: function(r, a, e, t) {
  44865. t || this.renderer.setSize(r, a, null, e),
  44866. this.composer && this.composer.setSize(r, a),
  44867. this.viewports && this.viewports.forEach(function(e, t) {
  44868. var n, i;
  44869. e.active && (n = r * e.width,
  44870. 0 != (i = a * e.height) && (e.setResolution(Math.ceil(n), Math.ceil(i), r, a),
  44871. e.camera.aspect = n / i,
  44872. "OrthographicCamera" == e.camera.type && (e.camera.left = -n / 2,
  44873. e.camera.right = n / 2,
  44874. e.camera.bottom = -i / 2,
  44875. e.camera.top = i / 2),
  44876. e.camera.updateProjectionMatrix()))
  44877. }),
  44878. t || this.emitResizeMsg({
  44879. viewport: this.viewports[0],
  44880. deviceRatio: e
  44881. })
  44882. }
  44883. }, {
  44884. key: "emitResizeMsg",
  44885. value: function(e) {
  44886. e.viewport.resolution.equals(this.oldResolution) || (this.dispatchEvent($.extend(e, {
  44887. type: "resize"
  44888. })),
  44889. this.oldResolution.copy(e.viewport.resolution))
  44890. }
  44891. }, {
  44892. key: "cameraChanged",
  44893. value: function() {
  44894. for (var e = !1, t = 0, n = this.viewports.length; t < n; t++) {
  44895. var i = this.viewports[t].cameraChanged();
  44896. i.changed && (e = !0,
  44897. this.dispatchEvent({
  44898. type: "camera_changed",
  44899. camera: this.viewports[t].camera,
  44900. viewport: this.viewports[t],
  44901. changeInfo: i
  44902. }))
  44903. }
  44904. return e
  44905. }
  44906. }, {
  44907. key: "makeScreenshot",
  44908. value: function(e, t, n) {
  44909. var i = e.width
  44910. , r = e.height
  44911. , e = new An(i,r,{
  44912. format: et
  44913. });
  44914. this.setSize(i, r, 1, !0),
  44915. this.render({
  44916. target: e,
  44917. viewports: t || this.viewports,
  44918. screenshot: !0,
  44919. width: i,
  44920. height: r,
  44921. resize: !0
  44922. });
  44923. n = Potree.Utils.renderTargetToDataUrl(e, i, r, this.renderer, n);
  44924. return e.dispose(),
  44925. {
  44926. width: i,
  44927. height: r,
  44928. dataUrl: n
  44929. }
  44930. }
  44931. }]),
  44932. r
  44933. }(), Ng = {
  44934. uniforms: {
  44935. opacity: {
  44936. type: "f",
  44937. value: 1
  44938. },
  44939. progress: {
  44940. type: "f",
  44941. value: 0
  44942. },
  44943. pano0Map: {
  44944. type: "t",
  44945. value: null
  44946. },
  44947. pano1Map: {
  44948. type: "t",
  44949. value: null
  44950. },
  44951. depthMap0: {
  44952. type: "t",
  44953. value: null
  44954. },
  44955. depthMap1: {
  44956. type: "t",
  44957. value: null
  44958. },
  44959. pano0Position: {
  44960. type: "v3",
  44961. value: new Cn
  44962. },
  44963. pano0Matrix: {
  44964. type: "m4",
  44965. value: new ni
  44966. },
  44967. pano1Position: {
  44968. type: "v3",
  44969. value: new Cn
  44970. },
  44971. pano1Matrix: {
  44972. type: "m4",
  44973. value: new ni
  44974. },
  44975. inverseProjectionMatrix: {
  44976. value: new ni
  44977. },
  44978. viewport: {
  44979. value: new Mn
  44980. },
  44981. cameraHeight0: {
  44982. type: "f",
  44983. value: 1
  44984. },
  44985. cameraHeight1: {
  44986. type: "f",
  44987. value: 1
  44988. }
  44989. },
  44990. vertexShader: "precision highp float;\nprecision highp int;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n //uniform mat4 pano1Matrix2;\n\n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n varying vec3 vWorldPosition12;\n \n vec3 transformAxis( vec3 direction ) //navvis->4dkk\n {\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n }\n \n \n void main() {\n \n vUv = uv;\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n \n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /* \n vec3 positionLocalToPanoCenter12 = worldPosition.xyz - pano1Position;\n vWorldPosition12 = (vec4(positionLocalToPanoCenter12, 1.0) * pano1Matrix2).xyz;\n vWorldPosition12.x *= -1.0;\n vWorldPosition12 = transformAxis(vWorldPosition12);\n */\n \n \n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ",
  44991. fragmentShader: "precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n\n \n #define PI 3.141592653 \n \n \n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int blackout;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n \n uniform float cameraHeight0;\n uniform float cameraHeight1;\n\n \n \n /* uniform sampler2D pano0Map;\n uniform sampler2D pano1Map; */ \n uniform samplerCube pano0Map;\n uniform samplerCube pano1Map;\n \n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n //varying vec3 vWorldPosition12;\n \n /* vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n } */\n\n vec2 getSamplerCoord2( vec3 direction ) \n { \n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty); \n }\n \n #extension GL_EXT_frag_depth : enable\n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n uniform sampler2D depthMap0;\n uniform sampler2D depthMap1;\n uniform mat4 inverseProjectionMatrix;\n uniform mat4 projectionMatrix;\n uniform vec4 viewport; \n \n vec2 getDepth(vec3 dir, sampler2D depthMap, float height, vec4 eyePos){\n vec2 depthValue = vec2(0.0, 0.0);\n vec2 uv2 = getSamplerCoord2(/* vWorldPosition12 */dir.xyz); //暂时只用基于目标漫游点的方向\n uv2.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n vec4 depth = texture2D(depthMap, uv2);\n //float distance = depth.r + 256. * (depth.g + 256. * depth.b);\n //distance *= 255. * .001; // distance is now in meters\n \n //更改\n float distance = (depth.g + depth.r / 256.) * 255.; //为什么要乘以255 \n \n if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度 \n if(uv2.y > 0.75)distance = height / dir.y; \n else distance = 100000.0;//给个超级远的值\n } \n depthValue.x = distance;\n \n // return r[1] + r[0] / 256 \n distance += .1; // add a safety margin\n\n vec4 eyePos2 = vec4(normalize(eyePos.xyz) * distance, 1.);\n vec4 clipPos2 = projectionMatrix * eyePos2;\n vec4 ndcPos2 = clipPos2 * 1. / clipPos2.w;\n\n \n depthValue.y = 0.5 * ((gl_DepthRange.far - gl_DepthRange.near) * ndcPos2.z\n + gl_DepthRange.near + gl_DepthRange.far); \n return depthValue; \n }\n //注:未加载好的话,depth为0,导致第一次漫游过去的时候许多mesh会立刻被遮挡,所以要确保加载完\n #endif\n \n void main()\n {\n \n /* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); */\n \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n if(progress < 1.0){//通常是1\n colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n }\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);\n \n \n \n \n //深度图修改深度\n \n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n vec4 ndcPos;\n ndcPos.xy = ((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.;\n ndcPos.z = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) /\n (gl_DepthRange.far - gl_DepthRange.near);\n ndcPos.w = 1.0;\n\n vec4 clipPos = ndcPos / gl_FragCoord.w;\n vec4 eyePos = inverseProjectionMatrix * clipPos;\n vec2 depth0 = vec2(0.0,0.0); \n if(progress < 1.0){\n depth0 = getDepth(vWorldPosition0, depthMap0, cameraHeight0, eyePos);\n }\n vec2 depth1 = getDepth(vWorldPosition1, depthMap1, cameraHeight1, eyePos);\n \n /* if(progress < 1.0 && depth1.x == 0.0 && depth0.x > 0.0){\n gl_FragDepthEXT = depth0.y; \n }else{ */\n gl_FragDepthEXT = mix(depth0.y,depth1.y,progress);\n //}\n \n \n\n #endif\n\n \n }\n "
  44992. }, Ug = function() {
  44993. y(r, Gu);
  44994. var i = w(r);
  44995. function r() {
  44996. O(this, r);
  44997. function t(e) {
  44998. var e = (t = e.viewport).offset || new Vector2
  44999. , t = t.resolution2;
  45000. n.uniforms.viewport.value.set(e.x, e.y, t.x, t.y)
  45001. }
  45002. var n = i.call(this, {
  45003. fragmentShader: Ng.fragmentShader,
  45004. vertexShader: Ng.vertexShader,
  45005. uniforms: Jr.clone(Ng.uniforms),
  45006. side: Y,
  45007. name: "ModelTextureMaterial",
  45008. defines: {}
  45009. })
  45010. , e = viewer.mainViewport;
  45011. return t({
  45012. viewport: e
  45013. }),
  45014. viewer.addEventListener("resize", function(e) {
  45015. t(e)
  45016. }),
  45017. viewer.addEventListener("camera_changed", function(e) {
  45018. n.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse)
  45019. }),
  45020. n
  45021. }
  45022. return h(r, [{
  45023. key: "setProjectedPanos",
  45024. value: function(e, t, n) {
  45025. null != n && (this.uniforms.progress.value = n),
  45026. e && (this.uniforms.pano0Map.value = e.getSkyboxTexture(),
  45027. this.uniforms.pano0Position.value.copy(e.position),
  45028. this.uniforms.pano0Matrix.value.copy(e.panoMatrix),
  45029. this.uniforms.cameraHeight0.value = e.floorPosition.distanceTo(e.position)),
  45030. this.uniforms.pano1Map.value = t.getSkyboxTexture(),
  45031. this.uniforms.pano1Position.value.copy(t.position),
  45032. this.uniforms.pano1Matrix.value.copy(t.panoMatrix),
  45033. this.uniforms.cameraHeight1.value = t.floorPosition.distanceTo(t.position),
  45034. this.pano0 = e,
  45035. this.pano1 = t,
  45036. this.updateDepthTex(e),
  45037. this.updateDepthTex(t),
  45038. this.needsUpdate = !0
  45039. }
  45040. }, {
  45041. key: "updateDepthTex",
  45042. value: function(e) {
  45043. Potree.settings.useDepthTex && e && e.depthTex && (e == this.pano0 || e == this.pano1) && (this.uniforms.depthMap0.value = this.pano0 && this.pano0.depthTex,
  45044. this.uniforms.depthMap1.value = this.pano1 && this.pano1.depthTex,
  45045. this.updateDepthTexEnable())
  45046. }
  45047. }, {
  45048. key: "updateDepthTexEnable",
  45049. value: function() {
  45050. var e = this.pano0 && this.pano1 && this.pano0.pointcloud.hasDepthTex && this.pano1.pointcloud.hasDepthTex;
  45051. Fm.addOrRemoveDefine(this, "hasDepthTex", e ? "add" : "remove")
  45052. }
  45053. }]),
  45054. r
  45055. }(), Gg = {
  45056. TILE_SIZE: 512,
  45057. FACES_PER_PANO: 6,
  45058. LocationOnTile: {
  45059. Center: 0,
  45060. UpperLeft: 1,
  45061. UpperRight: 2,
  45062. LowerRight: 3,
  45063. LowerLeft: 4
  45064. },
  45065. getTileVector: function(e, t, n, i, r, a, o, s) {
  45066. var l = e / t
  45067. , u = 2 * (t / e)
  45068. , c = u / 2
  45069. , d = 2 * (i / l) - 1 + c
  45070. , h = 2 * ((r = l - 1 - r) / l) - 1 + c;
  45071. switch (a = a || Gg.LocationOnTile.Center) {
  45072. case Gg.LocationOnTile.UpperLeft:
  45073. d -= c,
  45074. h += c,
  45075. d += o * u;
  45076. break;
  45077. case Gg.LocationOnTile.UpperRight:
  45078. d += c,
  45079. h += c,
  45080. h -= o * u;
  45081. break;
  45082. case Gg.LocationOnTile.LowerRight:
  45083. d += c,
  45084. h -= c,
  45085. d -= o * u;
  45086. break;
  45087. case Gg.LocationOnTile.LowerLeft:
  45088. d -= c,
  45089. h -= c,
  45090. h += o * u;
  45091. break;
  45092. case Gg.LocationOnTile.Center:
  45093. }
  45094. switch (n) {
  45095. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X:
  45096. wg.setVector(s, -1, h, -d);
  45097. break;
  45098. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
  45099. wg.setVector(s, 1, h, d);
  45100. break;
  45101. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
  45102. wg.setVector(s, -d, 1, -h);
  45103. break;
  45104. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
  45105. wg.setVector(s, -d, -1, h);
  45106. break;
  45107. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
  45108. wg.setVector(s, -d, h, 1);
  45109. break;
  45110. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
  45111. wg.setVector(s, d, h, -1)
  45112. }
  45113. wg.normalize(s)
  45114. },
  45115. getFaceForTile: function(e, t) {
  45116. var n = Gg.TILE_SIZE;
  45117. e < Gg.TILE_SIZE && (n = e);
  45118. n = Math.floor(e / n);
  45119. return Math.floor(t / (n * n))
  45120. },
  45121. getTileLocation: function(e, t, n) {
  45122. var i = Gg.TILE_SIZE;
  45123. e < Gg.TILE_SIZE && (i = e);
  45124. var r = Gg.getFaceForTile(e, t)
  45125. , i = Math.floor(e / i)
  45126. , t = t - r * (i * i);
  45127. return n.tileX = t % i,
  45128. n.tileY = Math.floor(t / i),
  45129. n.face = r,
  45130. n.faceTileIndex = t,
  45131. n
  45132. },
  45133. getTileCountForSize: function(e) {
  45134. if (e <= Gg.TILE_SIZE)
  45135. return Gg.FACES_PER_PANO;
  45136. e = Math.floor(e / Gg.TILE_SIZE);
  45137. return e * e * Gg.FACES_PER_PANO
  45138. }
  45139. };
  45140. Gg.getRelativeDirection = (Bg = new wg.Matrix4,
  45141. Lg = new wg.Quaternion,
  45142. function(e, t) {
  45143. Lg.copy(e),
  45144. Lg.inverse(),
  45145. Bg.makeRotationFromQuaternion(Lg),
  45146. Bg.applyToVector3(t),
  45147. wg.normalize(t)
  45148. }
  45149. ),
  45150. Gg.matchingTilesInDirection = (Cg = new wg.Vector3,
  45151. Pg = new wg.Vector3(0,0,-1),
  45152. Dg = new wg.Quaternion,
  45153. Sg = {
  45154. face: -1,
  45155. faceTileIndex: -1,
  45156. tileX: -1,
  45157. tileY: -1
  45158. },
  45159. kg = function(e, t, n) {
  45160. for (var i = Gg.getTileCountForSize(e), r = 0, a = 0; a < i; a++)
  45161. Gg.getTileLocation(e, a, Sg),
  45162. t && !t(Sg) || (r++,
  45163. n && n.push({
  45164. face: Sg.face,
  45165. faceTileIndex: Sg.faceTileIndex,
  45166. tileX: Sg.tileX,
  45167. tileY: Sg.tileY
  45168. }));
  45169. return r
  45170. }
  45171. ,
  45172. function(e, t, n, i, r, a) {
  45173. var o = t < Gg.TILE_SIZE ? t : Gg.TILE_SIZE;
  45174. if (!i && !r)
  45175. return kg(t, null, a);
  45176. var s = !!r;
  45177. if (r = r || i,
  45178. r = Math.max(0, Math.min(r, 360)),
  45179. i = Math.max(0, Math.min(i, 360)),
  45180. wg.copyVector(n, Cg),
  45181. Gg.getRelativeDirection(e.quaternion4dkk, Cg),
  45182. s) {
  45183. Dg.setFromUnitVectors(Cg, Pg);
  45184. return kg(t, function(e) {
  45185. return Gg.isTileWithinFrustum(t, o, e.face, e.tileX, e.tileY, Dg, i, r)
  45186. }, a)
  45187. }
  45188. return kg(t, function(e) {
  45189. return Gg.isTileWithinFOV(t, o, e.face, e.tileX, e.tileY, Cg, i)
  45190. }, a)
  45191. }
  45192. ),
  45193. Gg.isTileWithinFrustum = (Tg = new wg.Vector3,
  45194. function(e, t, n, i, r, a, o, s) {
  45195. for (var l, u, c = Math.tan(.5 * s * wg.RADIANS_PER_DEGREE), d = -c, h = Math.tan(.5 * o * wg.RADIANS_PER_DEGREE), p = -h, f = Gg.mapFaceToCubemapFace(n), m = 0, v = 0, g = 0, y = 0, w = 0, b = Gg.LocationOnTile.Center; b <= Gg.LocationOnTile.LowerLeft; b++)
  45196. Gg.getTileVector(e, t, f, i, r, b, 0, Tg),
  45197. wg.applyQuaternionToVector(a, Tg),
  45198. -1e-5 <= Tg.z ? 0 : (u = -1 / Tg.z,
  45199. l = Tg.x * u,
  45200. c < (u = Tg.y * u) ? m++ : u < d && v++,
  45201. h < l ? g++ : l < p && y++,
  45202. w++);
  45203. return v !== w && m !== w && g !== w && y !== w
  45204. }
  45205. ),
  45206. Gg.isTileWithinFOV = (_g = new wg.Vector3,
  45207. Mg = new wg.Vector3(0,1,0),
  45208. Ag = new wg.Vector3(1,0,0),
  45209. function(e, t, n, i, r, a, o) {
  45210. var s = Gg.mapFaceToCubemapFace(n);
  45211. if (wg.cross(a, Mg, Ag),
  45212. Gg.getTileVector(e, t, s, i, r, Gg.LocationOnTile.Center, 0, _g),
  45213. Gg.isWithinFOV(_g, a, o, null))
  45214. return !0;
  45215. for (var l = o / 360, u = Math.floor(1 / l), c = 0, d = 0; d < u; d++) {
  45216. for (var h = Gg.LocationOnTile.UpperLeft; h <= Gg.LocationOnTile.LowerLeft; h++)
  45217. if (Gg.getTileVector(e, t, s, i, r, h, c, _g),
  45218. Gg.isWithinFOV(_g, a, o, null))
  45219. return !0;
  45220. c += l
  45221. }
  45222. return !1
  45223. }
  45224. ),
  45225. Gg.isWithinFOV = (xg = new wg.Vector3,
  45226. Eg = new wg.Vector3,
  45227. function(e, t, n, i) {
  45228. wg.copyVector(e, Eg),
  45229. i && (wg.copyVector(i, xg),
  45230. wg.normalize(xg),
  45231. e = wg.dot(xg, e),
  45232. xg.x *= e,
  45233. xg.y *= e,
  45234. xg.z *= e,
  45235. wg.subVector(Eg, xg));
  45236. n = n / 2 * wg.RADIANS_PER_DEGREE;
  45237. return Math.cos(n) <= wg.dot(Eg, t)
  45238. }
  45239. ),
  45240. Gg.mapFaceToCubemapFace = (bg = {
  45241. 0: um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
  45242. 1: um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
  45243. 2: um.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
  45244. 3: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
  45245. 4: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
  45246. 5: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  45247. },
  45248. function(e) {
  45249. return bg[e]
  45250. }
  45251. );
  45252. var Hg, Vg, jg, Wg, Xg = new _c, qg = {
  45253. sizeInfo: {
  45254. minSize: 200,
  45255. maxSize: 250,
  45256. nearBound: .8,
  45257. farBound: 10
  45258. },
  45259. backgroundColor: {
  45260. r: 255,
  45261. g: 255,
  45262. b: 255,
  45263. a: .4
  45264. },
  45265. textColor: {
  45266. r: 0,
  45267. g: 0,
  45268. b: 0,
  45269. a: 1
  45270. },
  45271. borderRadius: 15,
  45272. renderOrder: 10
  45273. }, Jg = new ua(.2,.2), Yg = (new Su(.1,8,8),
  45274. new $i({
  45275. color: 16711680
  45276. }),
  45277. new $i({}),
  45278. (new Sn).setFromAxisAngle(new Cn(0,0,1), Math.PI / 2)), Zg = null, Qg = function() {
  45279. y(a, hn);
  45280. var r = w(a);
  45281. function a(t, e) {
  45282. var n, i;
  45283. return O(this, a),
  45284. (n = r.call(this)).id = t.id,
  45285. n.images360 = e,
  45286. n.visible = !0,
  45287. n.enabled = !0,
  45288. n.addEventListener("isVisible", function(e) {
  45289. viewer.updateVisible(n.marker, "panoVisi", e.visible),
  45290. Potree.settings.showPanoMesh && (n.mesh.visible = e.visible),
  45291. ("screenshot" == e.reason || e.visible) && n.label && (n.label.visible = e.visible),
  45292. viewer.updateVisible(n.label2, "panoVisi", e.visible)
  45293. }),
  45294. "pano" == Potree.settings.editType ? (n.uuid = t.uuid,
  45295. n.index = t.index,
  45296. n.pointcloud = viewer.scene.pointclouds.find(function(e) {
  45297. return e.panoUuid == t.uuid
  45298. }),
  45299. n.pointcloud.panos.push(g(n)),
  45300. n.sid = n.pointcloud.dataset_id + "|" + n.uuid,
  45301. n.panosData = t,
  45302. n.dataPosition = (new Cn).copy(t.pose.translation),
  45303. n.dataQuaternion = (new Sn).copy(t.pose.rotation),
  45304. n.dataRotation = (new ci).setFromQuaternion(n.dataQuaternion),
  45305. n.originPosition = new Cn,
  45306. n.quaternion = new Sn,
  45307. n.visibles = t.visibles,
  45308. n.originFloorPosition = n.originPosition.clone(),
  45309. n.originFloorPosition.z -= 1.4) : (n.originPosition = (new Cn).fromArray(t.dataset_location),
  45310. n.originFloorPosition = (new Cn).fromArray(t.dataset_floor_location),
  45311. n.originID = parseInt(t.file_id),
  45312. n.pointcloud = viewer.scene.pointclouds.find(function(e) {
  45313. return e.dataset_id == t.dataset_id
  45314. }) || viewer.scene.pointclouds[0],
  45315. n.pointcloud.panos.push(g(n)),
  45316. n.sid = n.pointcloud.dataset_id + "|" + n.originID,
  45317. i = [(i = t.dataset_orientation)[1], i[2], i[3], i[0]],
  45318. n.quaternion = (new Sn).fromArray(i),
  45319. n.quaternion4dkk = Up.convertVisionQuaternion(n.quaternion),
  45320. n.quaternion2 = n.quaternion.clone(),
  45321. n.quaternion = (new Sn).multiplyQuaternions(n.quaternion, Yg),
  45322. n.rotation4dkk = (new ci).setFromQuaternion(n.quaternion4dkk),
  45323. n.file = "https://4dkk.4dage.com/images/images".concat(Potree.settings.number, "/pan/high/").concat(n.id, ".jpg")),
  45324. n.rotation = (new ci).setFromQuaternion(n.quaternion),
  45325. n.build(),
  45326. n.transformByPointcloud(),
  45327. n.minimumTiledPanoLoaded = !1,
  45328. n.highestPartialTileRenderOpCompleted = 0,
  45329. n.highestFullTileRenderOpCompleted = 0,
  45330. n.shouldRedrawOnBaseLoaded = !1,
  45331. n.resolutionPromise = {},
  45332. n.tiledPanoRenderTarget = null,
  45333. n.zoomed = !1,
  45334. e.panoRenderer.addEventListener(dm.TileRenderSuccess, n.onTileRendered.bind(g(n))),
  45335. e.panoRenderer.addEventListener(dm.PanoRenderComplete, n.onPanoRendered.bind(g(n))),
  45336. e.panoRenderer.addEventListener(dm.TileRenderFailure, n.onTileRenderFail.bind(g(n))),
  45337. e.panoRenderer.addEventListener(dm.UploadAttemptedForAllTiles, n.onUploadAttemptedForAllTiles.bind(g(n))),
  45338. n.addEventListener("hoverOn", function(e) {
  45339. e.byMainView || n.hoverOn(e)
  45340. }),
  45341. n.addEventListener("hoverOff", function(e) {
  45342. e.byMainView || n.hoverOff(e)
  45343. }),
  45344. n
  45345. }
  45346. return h(a, [{
  45347. key: "setEnable",
  45348. value: function(e) {
  45349. viewer.updateVisible(this, "isEnabled", e),
  45350. this.enabled = e
  45351. }
  45352. }, {
  45353. key: "loadDepthImg",
  45354. value: function() {
  45355. var e, t, n = this;
  45356. !this.pointcloud.hasDepthTex || this.depthTex || this.depthTexLoading || (this.depthTexLoading = !0,
  45357. e = ("SS-t-7DUfWAUZ3V" == Potree.settings.number ? "".concat(Potree.scriptPath, "/data/").concat(Potree.settings.number, "/depthMap/") : "https://laser-oss.4dkankan.com/".concat(Potree.settings.webSite, "/").concat(this.pointcloud.sceneCode, "/data/").concat(this.pointcloud.sceneCode, "/depthmap/")).concat(this.originID, ".png"),
  45358. (t = Xg.load(e, function() {
  45359. n.depthTex = t,
  45360. n.images360.dispatchEvent({
  45361. type: "loadedDepthImg",
  45362. pano: n,
  45363. loaded: !0
  45364. }),
  45365. n.depthTexLoading = !1
  45366. }, function(e) {
  45367. console.error("loadDepthImg失败, 数据集sceneCode" + n.pointcloud.sceneCode, n.id),
  45368. n.pointcloud.hasDepthTex = !1,
  45369. n.images360.dispatchEvent({
  45370. type: "loadedDepthImg",
  45371. pano: n
  45372. })
  45373. })).wrapS = ke,
  45374. t.flipY = !1,
  45375. t.magFilter = Oe,
  45376. t.minFilter = Oe)
  45377. }
  45378. }, {
  45379. key: "build",
  45380. value: function() {
  45381. this.panoMatrix = (new ni).makeRotationFromQuaternion(this.quaternion),
  45382. this.oriPanoMatrix = this.panoMatrix.clone(),
  45383. this.quaternion2 && (this.oriPanoMatrix2 = (new ni).makeRotationFromQuaternion(this.quaternion2));
  45384. var t = new Hr(Jg,(Hg || ((Hg = {
  45385. default: Xg.load(Potree.resourcePath + "/textures/marker.png"),
  45386. ring: Xg.load(Potree.resourcePath + "/textures/marker2.png")
  45387. }).default.anisotropy = 4,
  45388. Hg.ring.anisotropy = 4),
  45389. new Wp({
  45390. opacity: .7,
  45391. side: Y,
  45392. map: Hg.default,
  45393. transparent: !0,
  45394. clipDistance: 2,
  45395. occlusionDistance: 1,
  45396. useDepth: !!Potree.settings.useDepthTex
  45397. })));
  45398. t.up.set(0, 0, 1),
  45399. t.lookAt(t.up),
  45400. t.scale.set(2, 2, 2),
  45401. this.addEventListener("changeMarkerTex", function(e) {
  45402. t.material.map = Hg[e.name]
  45403. }),
  45404. this.marker = t,
  45405. "pano" == Potree.settings.editType && viewer.updateVisible(t, "panoEdit", !1, 4),
  45406. this.images360.node.add(t),
  45407. Potree.settings.isTest && this.createTextLabel(),
  45408. this.createTextLabel2(),
  45409. t.addEventListener("mouseover", this.hoverOn.bind(this)),
  45410. t.addEventListener("mouseleave", this.hoverOff.bind(this))
  45411. }
  45412. }, {
  45413. key: "transformByPointcloud",
  45414. value: function() {
  45415. var e = this.originPosition.clone().applyMatrix4(this.pointcloud.transformMatrix)
  45416. , t = this.originFloorPosition.clone().applyMatrix4(this.pointcloud.transformMatrix);
  45417. this.setPosition(e, t),
  45418. this.panoMatrix = (new ni).multiplyMatrices(this.pointcloud.rotateMatrix, this.oriPanoMatrix),
  45419. this.oriPanoMatrix2 && (this.panoMatrix2 = (new ni).multiplyMatrices(this.pointcloud.rotateMatrix, this.oriPanoMatrix2),
  45420. this.panoMatrix2Inverse = this.panoMatrix2.clone().invert()),
  45421. this.dispatchEvent("rePos")
  45422. }
  45423. }, {
  45424. key: "setPosition",
  45425. value: function(e, t) {
  45426. this.position = e,
  45427. this.floorPosition = t,
  45428. this.marker.position.copy(this.floorPosition),
  45429. this.marker.position.z += .04,
  45430. this.label && ("pano" == Potree.settings.editType ? this.label.position.copy(this.position) : this.label.position.copy(this.floorPosition),
  45431. this.label.position.z += .14,
  45432. this.label.update()),
  45433. this.label2 && ("pano" == Potree.settings.editType ? this.label2.position.copy(this.position) : this.label2.position.copy(this.floorPosition),
  45434. this.label2.position.copy(this.marker.position),
  45435. this.label2.update())
  45436. }
  45437. }, {
  45438. key: "hoverOn",
  45439. value: function() {
  45440. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  45441. gv.start(vv(this.marker.material, "opacity", 1), 250),
  45442. e.byMap || this.dispatchEvent({
  45443. type: "hoverOn",
  45444. byMainView: !0
  45445. }),
  45446. e.byImages360 || this.images360.dispatchEvent({
  45447. type: "markerHover",
  45448. hovered: !0,
  45449. pano: this
  45450. })
  45451. }
  45452. }, {
  45453. key: "hoverOff",
  45454. value: function() {
  45455. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  45456. gv.start(vv(this.marker.material, "opacity", .5), 250),
  45457. e.byMap || this.dispatchEvent({
  45458. type: "hoverOff",
  45459. byMainView: !0
  45460. }),
  45461. e.byImages360 || this.images360.dispatchEvent({
  45462. type: "markerHover",
  45463. hovered: !1,
  45464. pano: this
  45465. })
  45466. }
  45467. }, {
  45468. key: "setZoomed",
  45469. value: function(e) {
  45470. this.zoomed = e,
  45471. "showPanos" == Potree.settings.displayMode && this.updateSkyboxForZoomLevel(),
  45472. viewer.dispatchEvent({
  45473. type: "panoSetZoom",
  45474. zoomed: e
  45475. })
  45476. }
  45477. }, {
  45478. key: "enter",
  45479. value: function() {
  45480. this.setZoomed(!1),
  45481. viewer.dispatchEvent({
  45482. type: gm.Enter,
  45483. oldPano: Zg,
  45484. newPano: this
  45485. }),
  45486. Zg = this
  45487. }
  45488. }, {
  45489. key: "exit",
  45490. value: function() {
  45491. this.clearWaitDeferreds(),
  45492. this.minimumTiledPanoLoaded = !1,
  45493. this.tiledPanoRenderTarget = null,
  45494. this.setZoomed(!1),
  45495. this.images360.panoRenderer.deactivateTiledPano(this),
  45496. this.highestPartialTileRenderOpCompleted = 0,
  45497. this.highestFullTileRenderOpCompleted = 0,
  45498. viewer.dispatchEvent({
  45499. type: gm.Exit,
  45500. pano: this
  45501. })
  45502. }
  45503. }, {
  45504. key: "updateSkyboxForZoomLevel",
  45505. value: function() {
  45506. this.minimumTiledPanoLoaded && this.images360.updateProjectedPanos()
  45507. }
  45508. }, {
  45509. key: "getSkyboxTexture",
  45510. value: function() {
  45511. return this.minimumTiledPanoLoaded ? this.zoomed && this.images360.qualityManager.maxRenderTargetSize > this.images360.qualityManager.maxNavPanoSize ? this.images360.panoRenderer.zoomRenderTarget.texture : (this.tiledPanoRenderTarget.texture.mapping = 300,
  45512. this.tiledPanoRenderTarget.texture) : null
  45513. }
  45514. }, {
  45515. key: "isLoaded",
  45516. value: function(e) {
  45517. return e && "string" == typeof e && console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"),
  45518. !!this.minimumTiledPanoLoaded && (!e || this.highestFullTileRenderOpCompleted >= e)
  45519. }
  45520. }, {
  45521. key: "getWaitDeferred",
  45522. value: function(e) {
  45523. var t = this.resolutionPromise[this.id];
  45524. t || (this.resolutionPromise[this.id] = t = {});
  45525. var n = t[e];
  45526. return n || (n = {
  45527. deferred: $.Deferred(),
  45528. active: !1
  45529. },
  45530. t[e] = n),
  45531. n
  45532. }
  45533. }, {
  45534. key: "clearWaitDeferreds",
  45535. value: function() {
  45536. var e, t, n = this.resolutionPromise[this.id];
  45537. for (e in n || (this.resolutionPromise[this.id] = n = {}),
  45538. n)
  45539. n.hasOwnProperty(e) && ((t = n[e]).active = !1,
  45540. t.deferred = $.Deferred())
  45541. }
  45542. }, {
  45543. key: "resetWaitDeferred",
  45544. value: function(e) {
  45545. e = this.getWaitDeferred(e);
  45546. e.active = !1,
  45547. e.deferred = $.Deferred()
  45548. }
  45549. }, {
  45550. key: "onTileRendered",
  45551. value: function(e) {
  45552. e.id === this.id && this.dispatchEvent({
  45553. type: gm.TileLoaded,
  45554. size: e.panoSize,
  45555. index: e.tileIndex,
  45556. count: e.totalTiles
  45557. })
  45558. }
  45559. }, {
  45560. key: "onPanoRendered",
  45561. value: function(e) {
  45562. e.id === this.id && (this.minimumTiledPanoLoaded = !0,
  45563. this.updateSkyboxForZoomLevel(),
  45564. e.panoSize > this.highestPartialTileRenderOpCompleted && (this.highestPartialTileRenderOpCompleted = e.panoSize),
  45565. e.updateFullComplete && e.panoSize > this.highestFullTileRenderOpCompleted && (this.highestFullTileRenderOpCompleted = e.panoSize),
  45566. viewer.ifAllLoaded(this),
  45567. this.dispatchEvent({
  45568. type: gm.LoadComplete,
  45569. size: e.panoSize,
  45570. count: e.totalTiles
  45571. }))
  45572. }
  45573. }, {
  45574. key: "onTileRenderFail",
  45575. value: function(e) {
  45576. e.id === this.id && this.dispatchEvent({
  45577. type: gm.LoadFailed
  45578. })
  45579. }
  45580. }, {
  45581. key: "onUploadAttemptedForAllTiles",
  45582. value: function(e) {
  45583. var t;
  45584. e.id === this.id && (t = this.images360.qualityManager.getPanoSize(cm.BASE),
  45585. e.panoSize === t && this.shouldRedrawOnBaseLoaded && (this.shouldRedrawOnBaseLoaded = !1,
  45586. this.panoRenderer.resetRenderStatus(this.id, !0, !1),
  45587. this.panoRenderer.renderPanoTiles(this.id, null, !0, !0)))
  45588. }
  45589. }, {
  45590. key: "createTextLabel",
  45591. value: function() {
  45592. this.removeTextLabel(),
  45593. this.label = new Jp(Object.assign({}, qg, {
  45594. text: this.id
  45595. })),
  45596. this.images360.node.add(this.label),
  45597. this.floorPosition && this.label.position.copy(this.floorPosition)
  45598. }
  45599. }, {
  45600. key: "createTextLabel2",
  45601. value: function() {
  45602. this.label2 = new Jp(Object.assign({}, {
  45603. backgroundColor: {
  45604. r: 255,
  45605. g: 255,
  45606. b: 255,
  45607. a: 0
  45608. },
  45609. textColor: {
  45610. r: 255,
  45611. g: 255,
  45612. b: 255,
  45613. a: 1
  45614. },
  45615. textBorderColor: {
  45616. r: 30,
  45617. g: 30,
  45618. b: 30,
  45619. a: 1
  45620. },
  45621. textBorderThick: 3,
  45622. dontFixOrient: !0,
  45623. renderOrder: 10,
  45624. fontsize: 30
  45625. }, {
  45626. text: parseInt(this.id) + 1
  45627. })),
  45628. this.images360.node.add(this.label2),
  45629. this.floorPosition && this.label2.position.copy(this.floorPosition);
  45630. this.label2.scale.set(.4, .4, .4),
  45631. viewer.updateVisible(this.label2, "notDisplay", !1)
  45632. }
  45633. }, {
  45634. key: "removeTextLabel",
  45635. value: function() {
  45636. this.label && this.label.parent.remove(this.label)
  45637. }
  45638. }, {
  45639. key: "dispose",
  45640. value: function() {
  45641. var e = viewer.images360.panos.indexOf(this);
  45642. -1 != e && (this.marker.parent.remove(this.marker),
  45643. this.removeTextLabel(),
  45644. this.depthTex && this.depthTex.dispose(),
  45645. viewer.images360.panos.splice(e, 1),
  45646. this.dispatchEvent("dispose"))
  45647. }
  45648. }]),
  45649. a
  45650. }();
  45651. Qg.prototype.loadTiledPano = (Vg = {},
  45652. jg = {},
  45653. Wg = {},
  45654. function(t, n, i, r, a, o) {
  45655. var s = this
  45656. , l = n.datasetsLocal.find(function(e) {
  45657. return e.datasetId == s.pointcloud.dataset_id
  45658. }).direction;
  45659. null != r || (r = !0),
  45660. null != a || (a = !0);
  45661. var u, c = this.getWaitDeferred(t), d = c.deferred, h = null, p = null;
  45662. return i && ("number" == typeof i ? h = i : (h = i.hFov,
  45663. p = i.vFov)),
  45664. this.isLoaded(t) ? d.resolve(t) : (c.active || (c.active = !0,
  45665. u = this.id + ":" + t,
  45666. Vg[u] = Vg[u] || [],
  45667. Wg[u] = null,
  45668. i && (Gg.matchingTilesInDirection(this, t, l, h, p, i = []),
  45669. Wg[u] = i,
  45670. Vg[u].forEach(function(t) {
  45671. var e = Wg[u].find(function(e) {
  45672. return t.faceTileIndex == e.faceTileIndex && t.face == e.face
  45673. });
  45674. e && (e.loaded = !0)
  45675. }),
  45676. Wg[u].some(function(e) {
  45677. return !e.loaded
  45678. }) || (d.resolve(t),
  45679. this.resetWaitDeferred(t),
  45680. Wg[u] = null)),
  45681. jg[this.id] || (jg[this.id] = !0,
  45682. this.addEventListener(gm.LoadComplete, function(e) {
  45683. var t = this.getWaitDeferred(e.size).deferred;
  45684. t && "pending" === t.state() && this.highestPartialTileRenderOpCompleted >= e.size && (t.resolve(e.size, e.count),
  45685. this.resetWaitDeferred(e.size))
  45686. }
  45687. .bind(this)),
  45688. this.addEventListener(gm.LoadFailed, function(t) {
  45689. var n = this.getWaitDeferred(e).deferred;
  45690. n && "pending" === n.state() && this.highestPartialTileRenderOpCompleted >= t.t && (n.reject(t.t),
  45691. this.resetWaitDeferred(t.t))
  45692. }
  45693. .bind(this)),
  45694. this.addEventListener(gm.TileLoaded, function(e) {
  45695. var t = e.index
  45696. , n = e.count
  45697. , i = e.size
  45698. , r = this.id + ":" + i;
  45699. Vg[r] = Vg[r] || [];
  45700. var e = Gg.getTileLocation(i, t, {})
  45701. , a = e.faceTileIndex
  45702. , o = e.face;
  45703. Vg[r].push({
  45704. faceTileIndex: a,
  45705. face: o
  45706. });
  45707. e = this.getWaitDeferred(i).deferred;
  45708. e && "pending" === e.state() && (e.notify(i, t, n),
  45709. Wg[r] && ((t = Wg[r].find(function(e) {
  45710. return e.faceTileIndex == a && e.face == o
  45711. })) && (t.loaded = !0),
  45712. Wg[r].some(function(e) {
  45713. return !e.loaded
  45714. }) || (this.onPanoRendered(this.id, i, n, !0),
  45715. e.resolve(i, n),
  45716. this.resetWaitDeferred(i),
  45717. Wg[r] = null)))
  45718. }
  45719. .bind(this)))),
  45720. this.images360.tileDownloader.clearForceQueue(),
  45721. this.images360.tileDownloader.forceQueueTilesForPano(this, t, l, h, p, o),
  45722. this.tiledPanoRenderTarget = this.images360.panoRenderer.activateTiledPano(this, this.images360.qualityManager.getMaxNavPanoSize(), r),
  45723. this.images360.panoRenderer.renderPanoTiles(this.id, n, a)),
  45724. d.promise()
  45725. }
  45726. );
  45727. var Kg = function() {
  45728. function i(e, t, n) {
  45729. O(this, i),
  45730. this.maxNavPanoSize = -1,
  45731. this.maxZoomPanoSize = -1,
  45732. this.devicePixelDensity = e,
  45733. this.deviceScreenSize = t,
  45734. this.clientBandwidth = n,
  45735. this.panoSizeClassMap = {},
  45736. this.useHighResolutionPanos = !0,
  45737. this.useUltraHighResolutionPanos = !1,
  45738. this.modelHasUltraHighPanos = !1,
  45739. (this.qualityManager = this).maxRenderTargetSize = A.isMobile() ? 2048 : 4096,
  45740. this.init()
  45741. }
  45742. return h(i, [{
  45743. key: "init",
  45744. value: function(e) {
  45745. this.buildPanoSizeClassMap(this.devicePixelDensity, this.deviceScreenSize, this.clientBandwidth),
  45746. this.ultraHighSize = this.getPanoSize(cm.ULTRAHIGH),
  45747. this.highSize = this.getPanoSize(cm.HIGH),
  45748. this.standardSize = this.getPanoSize(cm.STANDARD),
  45749. this.baseSize = this.getPanoSize(cm.BASE),
  45750. T.tiling.maxZoomPanoQuality && this.ultraHighSize <= T.tiling.maxZoomPanoQuality && (T.tiling.allowUltraHighResolution = !0),
  45751. this.highQualityThreshold = A.valueFromHash("threshold2k", T.windowHeightHighQualityThreshold),
  45752. this.updateMaximums()
  45753. }
  45754. }, {
  45755. key: "updateFromModel",
  45756. value: function(e) {
  45757. this.updateUltraHighResolutionSettings(e)
  45758. }
  45759. }, {
  45760. key: "updateUltraHighResolutionSettings",
  45761. value: function(e) {
  45762. T.tiling.allowUltraHighResolution && this.modelHasUltraHighPanos ? this.useUltraHighResolutionPanos = !0 : this.useUltraHighResolutionPanos = !1,
  45763. this.updateMaximums()
  45764. }
  45765. }, {
  45766. key: "enableUltraHighQualityMode",
  45767. value: function() {
  45768. this.modelHasUltraHighPanos = !0,
  45769. this.updateUltraHighResolutionSettings(null)
  45770. }
  45771. }, {
  45772. key: "ultraHighQualityModeEnabled",
  45773. value: function() {
  45774. return this.modelHasUltraHighPanos
  45775. }
  45776. }, {
  45777. key: "onModelChanged",
  45778. value: function(e) {
  45779. this.updateFromModel(e.model),
  45780. this.updateMaximums()
  45781. }
  45782. }, {
  45783. key: "updateMaximums",
  45784. value: function() {
  45785. this.maxNavPanoSize = T.tiling.maxNavPanoQuality || this.detectMaxNavPanoSize(),
  45786. this.maxZoomPanoSize = T.tiling.maxZoomPanoQuality || this.detectMaxZoomPanoSize(),
  45787. this.maxZoomPanoSize < this.maxNavPanoSize && (this.maxNavPanoSize = this.maxZoomPanoSize)
  45788. }
  45789. }, {
  45790. key: "buildPanoSizeClassMap",
  45791. value: function() {
  45792. this.panoSizeClassMap[cm.BASE] = 512,
  45793. this.panoSizeClassMap[cm.STANDARD] = 1024,
  45794. this.panoSizeClassMap[cm.HIGH] = 2048,
  45795. this.panoSizeClassMap[cm.ULTRAHIGH] = 4096
  45796. }
  45797. }, {
  45798. key: "getPanoSize",
  45799. value: function(e) {
  45800. return this.panoSizeClassMap[e]
  45801. }
  45802. }, {
  45803. key: "getMaxPossiblePanoSize",
  45804. value: function() {
  45805. return this.getPanoSize(cm.ULTRAHIGH)
  45806. }
  45807. }, {
  45808. key: "getMaxPanoSize",
  45809. value: function() {
  45810. return this.maxZoomPanoSize
  45811. }
  45812. }, {
  45813. key: "getMaxNavPanoSize",
  45814. value: function() {
  45815. return this.maxNavPanoSize
  45816. }
  45817. }, {
  45818. key: "getMaxZoomPanoSize",
  45819. value: function() {
  45820. return this.maxZoomPanoSize
  45821. }
  45822. }, {
  45823. key: "detectMaxNavPanoSizeClass",
  45824. value: function() {
  45825. return "1k" !== Potree.settings.navTileClass ? cm.HIGH : cm.STANDARD
  45826. }
  45827. }, {
  45828. key: "detectMaxNavPanoSize",
  45829. value: function() {
  45830. var e = this.detectMaxNavPanoSizeClass();
  45831. return this.getPanoSize(e)
  45832. }
  45833. }, {
  45834. key: "detectMaxZoomPanoSize",
  45835. value: function() {
  45836. return this.zoomLevelResolution ? "4k" == this.zoomLevelResolution && this.useUltraHighResolutionPanos ? this.getPanoSize(cm.ULTRAHIGH) : "1k" != this.zoomLevelResolution && this.useHighResolutionPanos ? this.getPanoSize(cm.HIGH) : this.getPanoSize(cm.STANDARD) : this.useHighResolutionPanos ? this.useUltraHighResolutionPanos ? this.getPanoSize(cm.ULTRAHIGH) : this.getPanoSize(cm.HIGH) : this.getPanoSize(cm.STANDARD)
  45837. }
  45838. }]),
  45839. i
  45840. }()
  45841. , $g = Object.freeze({
  45842. None: 0,
  45843. DirectionalFOV: 1
  45844. })
  45845. , e0 = (t0._panoSpaceDir = new Cn,
  45846. t0._fovThreshold = -1,
  45847. t0._fovThresholdNarrow = -1,
  45848. t0);
  45849. function t0(e, t) {
  45850. var n = t0._panoSpaceDir
  45851. , i = t0._fovThreshold
  45852. , r = t0._fovThresholdNarrow
  45853. , a = Math.max(Math.min(n.dot(e.direction), 1), -1)
  45854. , n = Math.max(Math.min(n.dot(t.direction), 1), -1);
  45855. return e._dot = a,
  45856. t._dot = n,
  45857. i <= a && n < i ? -1 : a < i && i <= n ? 1 : r <= a && n < r ? -1 : a < r && r <= n || e.panoSize > t.panoSize ? 1 : t.panoSize > e.panoSize ? -1 : -(a - n)
  45858. }
  45859. var n0, i0, r0, a0, o0, s0, l0, u0 = function() {
  45860. function u(e, t, n, i, r) {
  45861. O(this, u),
  45862. this.qualityManager = e,
  45863. this.maxNavQuality = this.qualityManager.getMaxNavPanoSize(),
  45864. this.maxZoomQuality = this.qualityManager.getMaxZoomPanoSize(),
  45865. this.baseSize = t,
  45866. this.standardSize = n,
  45867. this.highSize = i,
  45868. this.ultraHighSize = r,
  45869. this.priorityCriteria = new u.PriorityCriteria(null,new Cn(0,0,0),new Cn(0,0,-1),new Cn(0,0,-1))
  45870. }
  45871. return h(u, [{
  45872. key: "updateCriteria",
  45873. value: function(e, t, n, i) {
  45874. this.priorityCriteria.pano = e,
  45875. this.priorityCriteria.cameraPosition.copy(t),
  45876. this.priorityCriteria.cameraDirs = n,
  45877. this.priorityCriteria.upcomingPanos = i,
  45878. this.maxNavQuality = this.qualityManager.getMaxNavPanoSize(),
  45879. this.maxZoomQuality = this.qualityManager.getMaxZoomPanoSize()
  45880. }
  45881. }, {
  45882. key: "canDownloadSize",
  45883. value: function(e) {
  45884. return this.maxNavQuality >= e || this.maxZoomQuality >= e && this.zoomingActive
  45885. }
  45886. }, {
  45887. key: "populateScoredPanos",
  45888. value: function(e, t, n, i, r) {
  45889. (n = n || []).length = 0;
  45890. var a = [ly.filters.inPanoDirection(e.position, i, u.DIRECTION_SCORE_STRICTNESS), ly.filters.not(e)]
  45891. , i = [ly.scoreFunctions.distanceSquared(e), ly.scoreFunctions.direction(e.position, i)]
  45892. , o = Fm.sortByScore(t, a, i);
  45893. if (o)
  45894. for (var s = 0; s < o.length && s < r; s++) {
  45895. var l = o[s].item;
  45896. n.push(l)
  45897. }
  45898. return n
  45899. }
  45900. }, {
  45901. key: "queueTilesForPanos",
  45902. value: function(e, t, n, i, r) {
  45903. for (var a = 0, o = 0; o < t.length; o++) {
  45904. var s = t[o];
  45905. if (a += 0 < this.queueTilesForPano(e, n, s, i) ? 1 : 0,
  45906. r && r <= a)
  45907. break
  45908. }
  45909. return a
  45910. }
  45911. }, {
  45912. key: "canIncludeDescriptor",
  45913. value: function(e) {
  45914. return e.status !== vm.Downloading && e.status !== vm.Downloaded
  45915. }
  45916. }, {
  45917. key: "canIncludePano",
  45918. value: function(e, t) {
  45919. return !e.isLoaded(t)
  45920. }
  45921. }, {
  45922. key: "getFOVDotThreshold",
  45923. value: function(e) {
  45924. return Math.cos(gn.degToRad(e / 2))
  45925. }
  45926. }, {
  45927. key: "setZoomingActive",
  45928. value: function(e) {
  45929. e !== this.zoomingActive && (this.zoomingActive = e)
  45930. }
  45931. }]),
  45932. u
  45933. }();
  45934. u0.PriorityCriteria = function(e, t, n, i, r) {
  45935. this.pano = e,
  45936. this.cameraPosition = (new Cn).copy(t),
  45937. this.cameraDirs = [],
  45938. this.panoSpaceDir = (new Cn).copy(i),
  45939. this.upcomingPanos = r,
  45940. this.copy = function(e) {
  45941. this.pano = e.pano,
  45942. this.cameraPosition.copy(e.cameraPosition),
  45943. this.cameraDirs = e.cameraDirs,
  45944. this.panoSpaceDir.copy(e.panoSpaceDir),
  45945. this.upcomingPanos = r
  45946. }
  45947. ,
  45948. this.zoomingActive = !1
  45949. }
  45950. ,
  45951. u0.DIRECTIONAL_FOV = 180,
  45952. u0.DIRECTIONAL_FOV_NARROW = 120,
  45953. u0.MAX_SCORED_PANOS_TOCONSIDER = 6,
  45954. u0.MAX_SCORED_PANOS_TOADD = 2,
  45955. u0.MAX_UPCOMING_PANOS_TOADD = 3,
  45956. u0.DIRECTION_SCORE_STRICTNESS = .75,
  45957. u0.appendQueue = function(e, t) {
  45958. if (e && t)
  45959. for (var n = 0; n < t.length; n++)
  45960. e.push(t[n])
  45961. }
  45962. ,
  45963. u0.sortPanoTiles = function(e, t, n) {
  45964. n.datasetsLocal && (n = n.datasetsLocal.find(function(e) {
  45965. return e.datasetId == t.pointcloud.dataset_id
  45966. }).direction),
  45967. e0._panoSpaceDir.copy(n),
  45968. Gg.getRelativeDirection(t.quaternion4dkk, e0._panoSpaceDir),
  45969. e0._fovThresholdNarrow = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV_NARROW),
  45970. e0._fovThreshold = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV),
  45971. e.sort(e0)
  45972. }
  45973. ,
  45974. u0.insertSortedPanoTile = function(e, t, n, i) {
  45975. i.datasetsLocal && (i = i.datasetsLocal.find(function(e) {
  45976. return e.datasetId == n.pointcloud.dataset_id
  45977. }).direction),
  45978. e0._panoSpaceDir.copy(i),
  45979. Gg.getRelativeDirection(n.quaternion4dkk, e0._panoSpaceDir),
  45980. e0._fovThresholdNarrow = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV_NARROW),
  45981. e0._fovThreshold = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV);
  45982. for (var r = -1, a = 0; a < e.length; a++)
  45983. if (e0(t, e[a]) <= 0) {
  45984. r = a;
  45985. break
  45986. }
  45987. if (-1 === r)
  45988. e[e.length] = t;
  45989. else {
  45990. for (var o = e.length; r < o; o--)
  45991. e[o] = e[o - 1];
  45992. e[r] = t
  45993. }
  45994. }
  45995. ,
  45996. u0.prototype.filterDepthTex = function(e) {
  45997. var t;
  45998. Potree.settings.useDepthTex && this.priorityCriteria.pano && (t = this.priorityCriteria.cameraDirs.vectorForward,
  45999. this.populateScoredPanos(this.priorityCriteria.pano, e, e = [], t, u0.MAX_SCORED_PANOS_TOCONSIDER),
  46000. e.forEach(function(e) {
  46001. return e.loadDepthImg()
  46002. }))
  46003. }
  46004. ,
  46005. u0.prototype.filterAndPrioritize = (n0 = [],
  46006. i0 = [],
  46007. r0 = [],
  46008. function(e, t, n) {
  46009. var i = this.priorityCriteria.cameraDirs.vectorForward;
  46010. this.populateScoredPanos(this.priorityCriteria.pano, t, i0, i, u0.MAX_SCORED_PANOS_TOCONSIDER),
  46011. i0.forEach(function(e) {
  46012. return e.loadDepthImg()
  46013. });
  46014. var r = this.baseSize
  46015. , a = this.standardSize
  46016. , t = this.highSize
  46017. , i = this.ultraHighSize;
  46018. this.queueTilesForPano(e, n, this.priorityCriteria.pano, r),
  46019. this.priorityCriteria.upcomingPanos && this.queueTilesForPanos(e, this.priorityCriteria.upcomingPanos, n, r, u0.MAX_UPCOMING_PANOS_TOADD),
  46020. r0.length = 0,
  46021. this.canDownloadSize(a) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, a, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW),
  46022. u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs),
  46023. u0.appendQueue(e, r0),
  46024. this.queueTilesForPanos(e, i0, n, r, u0.MAX_SCORED_PANOS_TOADD),
  46025. r0.length = 0,
  46026. this.canDownloadSize(t) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, t, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW),
  46027. this.canDownloadSize(i) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, i, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW),
  46028. u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs),
  46029. u0.appendQueue(e, r0),
  46030. r0.length = 0,
  46031. this.canDownloadSize(a) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, a, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV),
  46032. this.canDownloadSize(t) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, t, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV),
  46033. this.canDownloadSize(i) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, i, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV),
  46034. u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs),
  46035. u0.appendQueue(e, r0),
  46036. this.queueTilesForPanos(e, n0, n, r)
  46037. }
  46038. ),
  46039. u0.prototype.queueTilesInDirectionForPano = (a0 = {
  46040. filter: $g.DirectionalFOV,
  46041. direction: new Cn,
  46042. fov: 60
  46043. },
  46044. o0 = new Cn,
  46045. function(e, t, n, i, r, a, o) {
  46046. a = a.datasetsLocal.find(function(e) {
  46047. return e.datasetId == n.pointcloud.dataset_id
  46048. }).direction;
  46049. return o0.copy(a),
  46050. Gg.getRelativeDirection(n.quaternion4dkk, o0),
  46051. a0.direction.copy(o0),
  46052. a0.fov = o,
  46053. this.filterAndQueueTileDownloadDescriptors(e, t, n, i, a0)
  46054. }
  46055. ),
  46056. u0.prototype.filterAndQueueTileDownloadDescriptors = (s0 = [],
  46057. function(e, t, n, i, r) {
  46058. i = t.getTileDownloadDescriptors(n, i);
  46059. s0.length = 0,
  46060. this.filterTileDownloadDescriptors(n, i, s0, r);
  46061. for (var a = 0, o = 0; o < s0.length; o++) {
  46062. var s = s0[o];
  46063. s && (e.push(s),
  46064. a++)
  46065. }
  46066. return a
  46067. }
  46068. ),
  46069. u0.prototype.filterTileDownloadDescriptors = (new Cn,
  46070. function(e, t, n, i) {
  46071. var r, a;
  46072. if (i.filter === $g.DirectionalFOV)
  46073. for (r = 0; r < t.length; r++)
  46074. a = t[r],
  46075. Gg.isTileWithinFOV(a.panoSize, a.tileSize, a.face, a.tileX, a.tileY, i.direction, i.fov) && n.push(a);
  46076. else
  46077. for (r = 0; r < t.length; r++)
  46078. a = t[r],
  46079. n.push(a);
  46080. for (r = 0; r < n.length; r++)
  46081. a = n[r],
  46082. this.canIncludeDescriptor(a) || (n[r] = null)
  46083. }
  46084. ),
  46085. u0.prototype.queueTilesForPano = (l0 = {
  46086. filter: $g.None
  46087. },
  46088. function(e, t, n, i) {
  46089. return this.filterAndQueueTileDownloadDescriptors(e, t, n, i, l0)
  46090. }
  46091. );
  46092. function c0(e) {
  46093. for (var t = e.split(","), e = t[0].match(/:(.*?);/)[1], n = atob(t[1]), i = n.length, r = new Uint8Array(i); i--; )
  46094. r[i] = n.charCodeAt(i);
  46095. return new Blob([r],{
  46096. type: e
  46097. })
  46098. }
  46099. function d0() {}
  46100. var h0 = []
  46101. , p0 = {
  46102. NEXT: -999,
  46103. SUCCESS: 0,
  46104. EXCEPTION: -1,
  46105. FAILURE_CODE_3001: 3001,
  46106. FAILURE_CODE_3002: 3002,
  46107. FAILURE_CODE_3003: 3003,
  46108. FAILURE_CODE_3004: 3004,
  46109. FAILURE_CODE_3005: 3005,
  46110. FAILURE_CODE_3006: 3006,
  46111. FAILURE_CODE_3007: 3007,
  46112. FAILURE_CODE_3008: 3008,
  46113. FAILURE_CODE_3009: 3009,
  46114. FAILURE_CODE_3010: 3010,
  46115. FAILURE_CODE_3011: 3011,
  46116. FAILURE_CODE_3012: 3012,
  46117. FAILURE_CODE_3013: 3013,
  46118. FAILURE_CODE_3014: 3014,
  46119. FAILURE_CODE_3015: 3015,
  46120. FAILURE_CODE_3016: 3016,
  46121. FAILURE_CODE_3017: 3017,
  46122. FAILURE_CODE_3018: 3018,
  46123. FAILURE_CODE_5010: 5010,
  46124. FAILURE_CODE_5012: 5012,
  46125. FAILURE_CODE_5014: 5014,
  46126. FAILURE_CODE_5005: 5005
  46127. };
  46128. $.ajaxSetup({
  46129. headers: {},
  46130. beforeSend: function(e) {
  46131. var t = ((t = A.urlHasValue("token", !0)) && localStorage.setItem("token", t),
  46132. t || localStorage.getItem("token") || "");
  46133. t ? e.setRequestHeader("token", t) : -1 == this.url.indexOf("isLogin") || showLoginTips()
  46134. },
  46135. error: function(e, t, n) {
  46136. return -1 != this.url.indexOf("/scene.json") && 404 == e.status ? $alert({
  46137. content: i18n.t("tips.scene_notfound")
  46138. }) : "POST" === this.type ? $alert({
  46139. content: i18n.t("tips.network_error")
  46140. }) : void 0
  46141. },
  46142. success: function(e) {},
  46143. complete: function() {
  46144. "POST" === this.type && f0.__loading && $waiting.hide(),
  46145. f0.__loading = !0
  46146. }
  46147. });
  46148. var f0 = {
  46149. statusCode: p0,
  46150. __loading: !0,
  46151. __request: function(e, i, r, a, o, s) {
  46152. return "function" != typeof o && (o = d0),
  46153. "function" != typeof s && (s = d0),
  46154. e.done(function(e) {
  46155. var t, n;
  46156. void 0 !== e.code ? (t = e.code,
  46157. n = function(e) {
  46158. e != p0.FAILURE_CODE_3001 && e != p0.FAILURE_CODE_3002 && e != p0.FAILURE_CODE_3003 && e != p0.FAILURE_CODE_3004 || -1 == r.indexOf("isLogin") && -1 == r.indexOf("openSceneBykey") && h0.push(function() {
  46159. f0[i](r, a, o, s)
  46160. }),
  46161. s()
  46162. }
  46163. ,
  46164. t == p0.EXCEPTION ? $alert({
  46165. content: i18n.t("tips.exception")
  46166. }) : t == p0.FAILURE_CODE_3002 || t == p0.FAILURE_CODE_3003 || t == p0.FAILURE_CODE_3004 ? (n(t),
  46167. showLoginTips()) : t == p0.FAILURE_CODE_3001 ? (n(t),
  46168. $alert({
  46169. content: i18n.t("tips.params_notfound")
  46170. })) : t == p0.FAILURE_CODE_3017 ? (n(t),
  46171. $alert({
  46172. content: i18n.t("tips.file_notfound")
  46173. })) : t == p0.FAILURE_CODE_5005 ? (n(t),
  46174. $alert({
  46175. content: i18n.t("tips.scene_notfound")
  46176. })) : t == p0.FAILURE_CODE_5010 ? (n(t),
  46177. $alert({
  46178. content: i18n.t("tips.camera_notfound")
  46179. })) : t == p0.FAILURE_CODE_5012 ? (n(t),
  46180. $alert({
  46181. content: i18n.t("tips.data_error")
  46182. })) : t == p0.FAILURE_CODE_5014 ? (n(t),
  46183. $alert({
  46184. content: i18n.t("tips.auth_deny")
  46185. })) : p0.NEXT) === p0.NEXT && o(e, 0 == e.code) : o(e)
  46186. }),
  46187. e.fail(s),
  46188. e.always(function() {
  46189. return e = null
  46190. }),
  46191. e
  46192. },
  46193. get: function(e) {
  46194. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46195. , n = 2 < arguments.length ? arguments[2] : void 0
  46196. , i = 3 < arguments.length ? arguments[3] : void 0;
  46197. return /\.json/.test(e) ? this.getJson(e, t, n, i) : this.__request($.get(e, t), "get", e, t, n, i)
  46198. },
  46199. getText: function(e) {
  46200. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46201. , n = 2 < arguments.length ? arguments[2] : void 0
  46202. , i = 3 < arguments.length ? arguments[3] : void 0;
  46203. return this.__request($.ajax({
  46204. url: e,
  46205. dataType: "text"
  46206. }), "getText", e, t, n, i)
  46207. },
  46208. getJson: function(e) {
  46209. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46210. , n = 2 < arguments.length ? arguments[2] : void 0
  46211. , i = 3 < arguments.length ? arguments[3] : void 0;
  46212. return this.__request($.getJSON(e, t), "get", e, t, n, i)
  46213. },
  46214. getBlob: function(e) {
  46215. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46216. , n = 2 < arguments.length ? arguments[2] : void 0
  46217. , i = 3 < arguments.length ? arguments[3] : void 0;
  46218. return this.__request($.ajax({
  46219. url: e,
  46220. dataType: "blob"
  46221. }), "getBlob", e, t, n, i)
  46222. },
  46223. getArraybuffer: function(e) {
  46224. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46225. , n = 2 < arguments.length ? arguments[2] : void 0
  46226. , i = 3 < arguments.length ? arguments[3] : void 0;
  46227. return this.__request($.ajax({
  46228. url: e,
  46229. dataType: "arraybuffer"
  46230. }), "getArraybuffer", e, t, n, i)
  46231. },
  46232. post: function(e) {
  46233. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46234. , n = 2 < arguments.length ? arguments[2] : void 0
  46235. , i = 3 < arguments.length ? arguments[3] : void 0;
  46236. return -1 == e.indexOf("isLogin") && f0.__loading && $waiting.show(),
  46237. this.__request($.post(e, t), "post", e, t, n, i)
  46238. },
  46239. postJson: function(e) {
  46240. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  46241. , n = 2 < arguments.length ? arguments[2] : void 0
  46242. , i = 3 < arguments.length ? arguments[3] : void 0;
  46243. return f0.__loading && $waiting.show(),
  46244. this.__request($.ajax({
  46245. type: "POST",
  46246. url: e,
  46247. contentType: "application/json",
  46248. data: JSON.stringify(t)
  46249. }), "postJson", e, t, n, i)
  46250. },
  46251. postForm: function(e, t, n, i, r) {
  46252. return "function" == typeof r ? this.__request($.ajax({
  46253. type: "POST",
  46254. url: e,
  46255. processData: !1,
  46256. contentType: !1,
  46257. data: t,
  46258. xhr: function() {
  46259. var e;
  46260. return (e = new XMLHttpRequest).upload.addEventListener("progress", function(e) {
  46261. r(e.loaded / e.total * 100 + "%")
  46262. }),
  46263. e
  46264. }
  46265. }), "postForm", e, t, n, i) : (f0.__loading && $waiting.show(),
  46266. this.__request($.ajax({
  46267. type: "POST",
  46268. url: e,
  46269. processData: !1,
  46270. contentType: !1,
  46271. data: t
  46272. }), "postForm", e, t, n, i))
  46273. },
  46274. loadImage: function(e) {
  46275. var t = this
  46276. , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 3
  46277. , i = $.Deferred()
  46278. , r = new Image;
  46279. return r.onerror = function() {
  46280. 0 < n ? setTimeout(function() {
  46281. console.warn("Retrying load image: " + e),
  46282. t.loadImage(e, n - 1).done(i.resolve.bind(i)).progress(i.notify.bind(i)).fail(i.reject.bind(i))
  46283. }, 1e3) : i.reject("[".concat(e, "]加载失败"))
  46284. }
  46285. ,
  46286. r.onload = function() {
  46287. i.resolve(r)
  46288. }
  46289. ,
  46290. r.crossOrigin = "anonymous",
  46291. r.src = e,
  46292. i
  46293. },
  46294. uploadFile: function(e) {
  46295. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, i = 2 < arguments.length ? arguments[2] : void 0, r = 3 < arguments.length ? arguments[3] : void 0, a = 4 < arguments.length ? arguments[4] : void 0, o = new FormData;
  46296. for (t in n)
  46297. "file" == t ? o.append("file", n[t], n.filename || n[t].name) : "filename" != t && o.append(t, n[t]);
  46298. return this.postForm(e, o, i, r, a)
  46299. },
  46300. uploadBlobFile: function(e) {
  46301. var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, i = 2 < arguments.length ? arguments[2] : void 0, r = 3 < arguments.length ? arguments[3] : void 0, a = new FormData;
  46302. for (t in n)
  46303. "file" === t ? a.append("file", c0(n.file), n.filename) : "filename" != t && a.append(t, n[t]);
  46304. return this.postForm(e, a, i, r)
  46305. }
  46306. };
  46307. window.downloaded = {},
  46308. window.startdownloads = [];
  46309. var m0, v0, g0, y0, w0, b0 = function() {
  46310. y(n, hn);
  46311. var e = w(n);
  46312. function n() {
  46313. var t;
  46314. return O(this, n),
  46315. (t = e.call(this)).panos = null,
  46316. t.retryMinimumTime = 1e4,
  46317. t.panoLoadCallbacks = {},
  46318. t.downloadDescriptors = {},
  46319. t.priorityQueue = [],
  46320. t.forceQueue = [],
  46321. t.activeDownloads = [],
  46322. t.tilePrioritizer = null,
  46323. t.refreshInterval = null,
  46324. t.processPriorityQueue = !1,
  46325. t.concurrentDownloads = 6,
  46326. t.downloadTestResults = {},
  46327. t.freeze = Object.freeze({
  46328. Testing: 1,
  46329. Success: 2,
  46330. Fail: 3
  46331. }),
  46332. t.visible = !0,
  46333. viewer.addEventListener("pageVisible", function(e) {
  46334. viewer.updateVisible(g(t), "pageVisible", e.v),
  46335. t.judgeStart()
  46336. }),
  46337. t
  46338. }
  46339. return h(n, [{
  46340. key: "setPanoData",
  46341. value: function(e, t) {
  46342. this.panos = e,
  46343. this.imagePanos = t
  46344. }
  46345. }, {
  46346. key: "start",
  46347. value: function() {
  46348. this.downloadCubeTex = !0,
  46349. Potree.settings.useDepthTex ? this.refreshInterval || this.judgeStart() : (viewer.updateVisible(this, "pano", !0),
  46350. this.judgeStart())
  46351. }
  46352. }, {
  46353. key: "stop",
  46354. value: function() {
  46355. this.downloadCubeTex = !1,
  46356. Potree.settings.useDepthTex || (viewer.updateVisible(this, "pano", !1),
  46357. this.judgeStart())
  46358. }
  46359. }, {
  46360. key: "judgeStart",
  46361. value: function() {
  46362. this.visible ? (this.started = !0,
  46363. this.refreshUpdateInterval(0)) : (this.started = !1,
  46364. window.clearTimeout(this.refreshInterval))
  46365. }
  46366. }, {
  46367. key: "refreshUpdateInterval",
  46368. value: function(e) {
  46369. e = e || 0,
  46370. this.refreshInterval = window.setTimeout(function() {
  46371. this.update() ? this.refreshUpdateInterval(n.ACTIVE_REFRESH_DELAY) : this.refreshUpdateInterval(n.IDLE_REFRESH_DELAY)
  46372. }
  46373. .bind(this), e)
  46374. }
  46375. }, {
  46376. key: "update",
  46377. value: function() {
  46378. if (this.downloadCubeTex) {
  46379. var e = 0 < this.forceQueue.length;
  46380. return this.processQueueForDownloading(this.forceQueue),
  46381. this.processPriorityQueue && (this.queuePrioritizedTilesForPanos(this.panos),
  46382. 0 < this.priorityQueue.length && (e = !0),
  46383. this.processQueueForDownloading(this.priorityQueue)),
  46384. e
  46385. }
  46386. this.tilePrioritizer.filterDepthTex(this.panos)
  46387. }
  46388. }, {
  46389. key: "queuePrioritizedTilesForPanos",
  46390. value: function(e) {
  46391. this.tilePrioritizer && (this.clearQueue(this.priorityQueue),
  46392. this.tilePrioritizer.filterAndPrioritize(this.priorityQueue, e, this),
  46393. this.clearFromQueue(this.priorityQueue, vm.None, !0),
  46394. this.setStatusOrRemoveForAllDescriptors(this.priorityQueue, vm.Queued))
  46395. }
  46396. }, {
  46397. key: "clearQueue",
  46398. value: function(e) {
  46399. this.setStatusForAllDescriptors(e, vm.None),
  46400. e.length = 0
  46401. }
  46402. }, {
  46403. key: "clearForceQueue",
  46404. value: function() {
  46405. this.clearQueue(this.forceQueue)
  46406. }
  46407. }, {
  46408. key: "clearFromQueue",
  46409. value: function(e, t, n) {
  46410. for (var i = 0; i < e.length; i++) {
  46411. var r = e[i];
  46412. r && (t === r.status && !n || t !== r.status && n) && (e[i] = null)
  46413. }
  46414. }
  46415. }, {
  46416. key: "setStatusForAllDescriptors",
  46417. value: function(e, t) {
  46418. for (var n = 0; n < e.length; n++) {
  46419. var i = e[n];
  46420. i && (i.status = t)
  46421. }
  46422. }
  46423. }, {
  46424. key: "setStatusOrRemoveForAllDescriptors",
  46425. value: function(e, t) {
  46426. for (var n = 0; n < e.length; n++) {
  46427. var i = e[n];
  46428. i && (i.status !== t ? i.status = t : e[n] = null)
  46429. }
  46430. }
  46431. }, {
  46432. key: "getTileDownloadDescriptors",
  46433. value: function(e, t) {
  46434. var n = this.getAllTileDownloadDescriptorsForPano(e)
  46435. , i = n[t];
  46436. return i || (i = this.buildDownloadDescriptorArray(t),
  46437. n[t] = i,
  46438. this.initTileDownloadDescriptors(i, e, t)),
  46439. i
  46440. }
  46441. }, {
  46442. key: "getAllTileDownloadDescriptorsForPano",
  46443. value: function(e) {
  46444. var t = this.downloadDescriptors[e.id];
  46445. return t || (this.downloadDescriptors[e.id] = t = {}),
  46446. t
  46447. }
  46448. }, {
  46449. key: "processQueueForDownloading",
  46450. value: function(e, t) {
  46451. if (this.cleanupActiveDownloads(),
  46452. this.activeDownloads.length < this.concurrentDownloads || t)
  46453. for (var n = t ? e.length : this.concurrentDownloads - this.activeDownloads.length, i = 0; i < n && 0 < e.length; 0) {
  46454. var r = e.shift();
  46455. if (r) {
  46456. if (512 < r.panoSize && !this.isPanoDownloaded(r.pano, 512)) {
  46457. e.push(r);
  46458. break
  46459. }
  46460. this.startDownload(r),
  46461. i++
  46462. }
  46463. }
  46464. }
  46465. }, {
  46466. key: "testDownload",
  46467. value: function(t, e, n) {
  46468. var i, r = this.downloadTestResults[t];
  46469. r ? r === this.freeze.Success ? n(!0) : r === this.freeze.Fail && n(!1) : (this.downloadTestResults[t] = this.freeze.Testing,
  46470. i = this.panos[0],
  46471. r = this.getTileUrl({
  46472. pano: i,
  46473. panoSize: t,
  46474. tileSize: e,
  46475. tileIndex: 0
  46476. }),
  46477. i = function(e) {
  46478. this.downloadTestResults[t] = this.freeze.Success,
  46479. n(!0)
  46480. }
  46481. .bind(this),
  46482. e = function() {
  46483. this.downloadTestResults[t] = this.freeze.Fail,
  46484. n(!1)
  46485. }
  46486. .bind(this),
  46487. this.loadImage(r, 0, i, e))
  46488. }
  46489. }, {
  46490. key: "startDownload",
  46491. value: function(e) {
  46492. startdownloads.push(e),
  46493. e.status = vm.Downloading;
  46494. var t = this.getTileUrl(e);
  46495. t && (this.activeDownloads.push(e),
  46496. this.loadImage(t, n.DOWNLOAD_RETRIES, this.downloadComplete.bind(this, e), this.downloadFailed.bind(this, e)))
  46497. }
  46498. }, {
  46499. key: "downloadFailed",
  46500. value: function(e, t) {}
  46501. }, {
  46502. key: "downloadComplete",
  46503. value: function(e, t) {
  46504. var n = this.getPanoLoadCallbacks(e.pano, e.panoSize);
  46505. e.status = vm.Downloaded,
  46506. n && n.onProgress && n.onProgress(e.pano, e.panoSize);
  46507. var i = {
  46508. panoId: e.pano.id,
  46509. image: t,
  46510. tileSize: e.tileSize,
  46511. panoSize: e.panoSize,
  46512. tileIndex: e.tileIndex,
  46513. faceTileIndex: e.faceTileIndex,
  46514. totalTiles: e.totalTiles,
  46515. face: e.face,
  46516. tileX: e.tileX,
  46517. tileY: e.tileY,
  46518. direction: e.direction
  46519. };
  46520. downloaded[e.pano.id] || (downloaded[e.pano.id] = {
  46521. 512: [],
  46522. 1024: [],
  46523. 2048: []
  46524. }),
  46525. downloaded[e.pano.id][e.panoSize] || (downloaded[e.pano.id][e.panoSize] = []),
  46526. downloaded[e.pano.id][e.panoSize].push(e),
  46527. 512 != e.panoSize && downloaded[e.pano.id][512].length < 6 && console.warn("没下完"),
  46528. e.image = t,
  46529. this.dispatchEvent({
  46530. type: hm.TileDownloadSuccess,
  46531. desc: i
  46532. }),
  46533. this.isPanoDownloaded(e.pano, e.panoSize) && (i = {
  46534. panoId: e.pano.id,
  46535. tileSize: e.tileSize,
  46536. panoSize: e.panoSize
  46537. },
  46538. this.dispatchEvent({
  46539. type: hm.PanoDownloadComplete,
  46540. desc: i
  46541. }),
  46542. n && n.onLoad && n.onLoad(e.pano, e.panoSize))
  46543. }
  46544. }, {
  46545. key: "isPanoDownloaded",
  46546. value: function(e, t) {
  46547. var n = this.getTileDownloadDescriptors(e, t);
  46548. if (n.length <= 0)
  46549. return !1;
  46550. for (var i = 0; i < n.length; i++)
  46551. if (n[i].status !== vm.Downloaded)
  46552. return !1;
  46553. return !0
  46554. }
  46555. }, {
  46556. key: "setPanoLoadCallbacks",
  46557. value: function(e, t, n, i, r) {
  46558. t = e.id + ":" + this.qualityManager.getPanoSize(t);
  46559. this.panoLoadCallbacks[t] = {
  46560. onLoad: n,
  46561. onFail: i,
  46562. onProgress: r
  46563. }
  46564. }
  46565. }, {
  46566. key: "getPanoLoadCallbacks",
  46567. value: function(e, t) {
  46568. t = e.id + ":" + t;
  46569. return this.panoLoadCallbacks[t]
  46570. }
  46571. }, {
  46572. key: "buildDownloadDescriptorArray",
  46573. value: function(e) {
  46574. for (var t = Gg.getTileCountForSize(e), n = [], i = 0; i < t; i++) {
  46575. var r = this.buildDownloadDescriptor();
  46576. n.push(r)
  46577. }
  46578. return n
  46579. }
  46580. }, {
  46581. key: "buildDownloadDescriptor",
  46582. value: function() {
  46583. return {
  46584. panoGroupId: null,
  46585. pano: null,
  46586. panoSize: -1,
  46587. tileSize: -1,
  46588. tileIndex: -1,
  46589. totalTiles: -1,
  46590. faceTileIndex: -1,
  46591. status: vm.None,
  46592. url: null,
  46593. image: null,
  46594. direction: new Cn,
  46595. face: -1,
  46596. cubeFace: -1,
  46597. tileX: -1,
  46598. tileY: -1
  46599. }
  46600. }
  46601. }, {
  46602. key: "initTileDownloadDescriptors",
  46603. value: function(e, t, n) {
  46604. for (var i = 0; i < e.length; i++) {
  46605. var r = e[i];
  46606. this.initTileDownloadDescriptor(r, t, n, i)
  46607. }
  46608. }
  46609. }, {
  46610. key: "initTileDownloadDescriptor",
  46611. value: function(e, t, n, i) {
  46612. var r = n >= Gg.TILE_SIZE ? Gg.TILE_SIZE : n;
  46613. e.face = Gg.getFaceForTile(n, i),
  46614. e.cubeFace = Gg.mapFaceToCubemapFace(e.face),
  46615. e.pano = t,
  46616. e.panoSize = n,
  46617. e.tileSize = r,
  46618. e.tileIndex = i,
  46619. e.totalTiles = Gg.getTileCountForSize(n),
  46620. e.status = vm.None,
  46621. e.image = null,
  46622. Gg.getTileLocation(e.panoSize, e.tileIndex, e),
  46623. Gg.getTileVector(e.panoSize, e.tileSize, e.cubeFace, e.tileX, e.tileY, Gg.LocationOnTile.Center, 0, e.direction)
  46624. }
  46625. }, {
  46626. key: "getTiles",
  46627. value: function(e, t) {
  46628. return (Potree.settings.isLocal2 ? "".concat(Potree.settings.urls.prefix3, "/scene_view_data/").concat(t, "/images/") : "".concat(Potree.settings.urls.prefix3, "/images/images").concat(t, "/")).concat(e)
  46629. }
  46630. }, {
  46631. key: "loadImage",
  46632. value: function(e, t, n, i) {
  46633. f0.loadImage(e, t).then(function(e) {
  46634. n(e)
  46635. }).fail(i)
  46636. }
  46637. }]),
  46638. n
  46639. }();
  46640. function x0(e, t) {
  46641. this.tree = e,
  46642. this.parent = t,
  46643. this.children = [],
  46644. this.id = ++M0
  46645. }
  46646. function E0(e) {
  46647. e.root = function e(t, n, i) {
  46648. if (i > t.levels)
  46649. return null;
  46650. var r = new x0(t,n);
  46651. t.allNodes.push(r);
  46652. for (var a = 0; a < _0; a++)
  46653. r.children[a] = e(t, r, i + 1);
  46654. return r
  46655. }(e, null, 0)
  46656. }
  46657. b0.prototype.forceQueueTilesForPano = (m0 = [],
  46658. v0 = [],
  46659. function(e, t, n, i, r, a) {
  46660. m0.length = 0;
  46661. for (var o = this.getTileDownloadDescriptors(e, t), s = 0; s < o.length; s++) {
  46662. var l = o[s];
  46663. l.status !== vm.None && l.status !== vm.Queued || m0.push(l)
  46664. }
  46665. if (n && 0 < m0.length) {
  46666. u0.sortPanoTiles(m0, e, n),
  46667. v0.length = 0,
  46668. Gg.matchingTilesInDirection(e, t, n, i, r, v0);
  46669. for (var u = 0, c = function(e) {
  46670. return e.face === d.face && e.faceTileIndex === d.faceTileIndex
  46671. }; u < m0.length; ) {
  46672. var d = m0[u];
  46673. v0.findIndex(c) < 0 ? m0.splice(u, 1) : u++
  46674. }
  46675. }
  46676. for (var h = 0; h < m0.length; h++)
  46677. this.forceQueue.push(m0[h]);
  46678. this.setStatusForAllDescriptors(this.forceQueue, vm.ForceQueued),
  46679. this.clearFromQueue(this.priorityQueue, vm.ForceQueued, !1),
  46680. a && this.processQueueForDownloading(this.forceQueue, !0)
  46681. }
  46682. ),
  46683. b0.prototype.cleanupActiveDownloads = (g0 = [],
  46684. function() {
  46685. for (var e = g0.length = 0; e < this.activeDownloads.length; e++) {
  46686. var t = this.activeDownloads[e];
  46687. t.status !== vm.Downloaded && t.status !== vm.Failed && g0.push(t)
  46688. }
  46689. this.activeDownloads.length = 0,
  46690. this.activeDownloads.push.apply(this.activeDownloads, g0)
  46691. }
  46692. ),
  46693. b0.prototype.getTileUrl = (y0 = {
  46694. 256: "256",
  46695. 512: "512",
  46696. 1024: "1k",
  46697. 2048: "2k",
  46698. 4096: "4k"
  46699. },
  46700. w0 = {
  46701. face: -1,
  46702. faceTileIndex: -1,
  46703. tileX: -1,
  46704. tileY: -1
  46705. },
  46706. function() {
  46707. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  46708. , t = e.pano.originID
  46709. , n = e.panoSize
  46710. , i = e.tileSize
  46711. , r = e.tileIndex
  46712. , a = e.pano.pointcloud.sceneCode;
  46713. Gg.getTileLocation(n, r, w0);
  46714. var o = Math.floor(n / i)
  46715. , i = Math.floor(r / (o * o))
  46716. , r = ""
  46717. , o = ""
  46718. , o = Potree.settings.isLocal ? (r = this.getTiles(r = "tiles/" + t + "/" + y0[n] + "_face" + i + "_" + w0.tileX + "_" + w0.tileY + ".jpg", a),
  46719. "?") : (r = "tiles/4k/" + t + "_skybox" + i + ".jpg?x-oss-process=",
  46720. "512" == y0[n] ? r += "image/resize,h_512" : ("1k" == y0[n] || "2k" == y0[n] ? r += "image/resize,m_lfit,w_" + n + "/crop,w_512,h_512," : r = "tiles/4k/" + t + "_skybox" + i + ".jpg?x-oss-process=image/crop,w_512,h_512,",
  46721. r += 0 == w0.tileX ? "x_0," : "x_" + (512 * w0.tileX - 1) + ",",
  46722. r += 0 == w0.tileY ? "y_0" : "y_" + (512 * w0.tileY - 1)),
  46723. r = this.getTiles(r, a),
  46724. "&");
  46725. return r += o + "time=" + e.pano.pointcloud.timeStamp
  46726. }
  46727. ),
  46728. b0.tilegen = !0,
  46729. b0.IDLE_REFRESH_DELAY = 500,
  46730. b0.ACTIVE_REFRESH_DELAY = 16,
  46731. b0.DOWNLOAD_RETRIES = 4;
  46732. var _0 = 4
  46733. , M0 = 0
  46734. , A0 = function() {
  46735. function i(e, t) {
  46736. O(this, i),
  46737. this.levels = t,
  46738. this.tileSize = e,
  46739. this.root = null,
  46740. this.allNodes = [],
  46741. E0(this)
  46742. }
  46743. return h(i, [{
  46744. key: "getSubNode",
  46745. value: function(e, t, n) {
  46746. (!t || e < this.tileSize) && (t = 0),
  46747. (!n || e < this.tileSize) && (n = 0),
  46748. e < this.tileSize && (e = this.tileSize);
  46749. e = i.getLevelCountForSize(this.tileSize, e);
  46750. return function e(t, n, i, r, a) {
  46751. if (!t)
  46752. return null;
  46753. if (0 === i)
  46754. return t;
  46755. if (!t.children || 0 === t.children.length)
  46756. return null;
  46757. var o = Math.pow(2, i) / 2
  46758. , s = r % o
  46759. , l = a % o
  46760. , a = Math.floor(a / o)
  46761. , o = Math.floor(r / o);
  46762. return e(t.children[2 * a + o], n + 1, i - 1, s, l)
  46763. }(this.root, 0, e, t, n)
  46764. }
  46765. }, {
  46766. key: "breadthFirst",
  46767. value: function(e) {
  46768. var t = !!(e = e || {}).nullLevelEnd
  46769. , n = e.maxLevel
  46770. , i = e.minLevel
  46771. , r = e.callback
  46772. , a = e.saveVisited
  46773. , o = []
  46774. , s = {}
  46775. , l = 0;
  46776. for (o.push(this.root),
  46777. o.push(s); 0 < o.length && !(n && n < l); ) {
  46778. var u = o.shift();
  46779. if (u === s)
  46780. (!i || i <= l) && (r && t && r(null),
  46781. a && t && a.push(null)),
  46782. 0 < o.length && o.push(s),
  46783. l++,
  46784. 0;
  46785. else {
  46786. if (u.children)
  46787. for (var c = 0; c < u.children.length; c++)
  46788. u.children[c] && o.push(u.children[c]);
  46789. var d = this.getFaceIndexFromNode(u);
  46790. (!i || i <= l) && (r && r(u, l, d),
  46791. a && a.push(u)),
  46792. 0
  46793. }
  46794. }
  46795. }
  46796. }, {
  46797. key: "getFaceIndexFromNode",
  46798. value: function(e) {
  46799. if (!e)
  46800. return -1;
  46801. for (var t = 1, n = e, i = 0, r = 0; ; ) {
  46802. var a = n.parent;
  46803. if (!a)
  46804. break;
  46805. for (var o = -1, s = 0; s < a.children.length; s++)
  46806. a.children[s] === n && (o = s);
  46807. i = o % 2 * t + i,
  46808. r = Math.floor(o / 2) * t + r;
  46809. t *= 2,
  46810. n = a
  46811. }
  46812. return r * t + i
  46813. }
  46814. }, {
  46815. key: "depthFirst",
  46816. value: function(e, t, n) {
  46817. !function e(t, n, i, r, a, o, s, l) {
  46818. if (t) {
  46819. var u = 2 * r + i;
  46820. if ((s = s || A0.TraversalType.PreOrder) === A0.TraversalType.PreOrder && (a && a(t, n, u, i, r),
  46821. o && o.push(t)),
  46822. t.children && 0 !== t.children.length) {
  46823. for (var c = 2 * r, d = 2 * i, h = 0; h < 2; h++)
  46824. for (var p = 0; p < 2; p++)
  46825. e(t.children[2 * p + h], n + 1, d + h, c + p, a, o, s, l);
  46826. s === A0.TraversalType.PostOrder && (a && a(t, n, u, i, r),
  46827. o && o.push(t))
  46828. }
  46829. }
  46830. }(this.root, 0, 0, 0, e, t, n, this.tileSize)
  46831. }
  46832. }]),
  46833. i
  46834. }();
  46835. A0.TraversalType = Object.freeze({
  46836. PreOrder: 0,
  46837. PostOrder: 1
  46838. }),
  46839. A0.getLevelCountForSize = function(e, t) {
  46840. var n = 0;
  46841. for (t < e && (t = e); !((t /= 2) < e); )
  46842. n++;
  46843. return n
  46844. }
  46845. ;
  46846. var T0, S0, C0, P0, D0, k0, B0, L0, R0, F0, I0, O0, z0, N0, U0, G0, H0, V0, j0, W0, X0, q0, J0 = !(A0.getSizeForLevel = function(e, t) {
  46847. return Math.pow(2, t) * e
  46848. }
  46849. ), Y0 = T.tiling.uploadIntervalDelay, Z0 = T.tiling.initialIntervalDelay, Q0 = T.tiling.maxNonBaseUploadsPerFrame, K0 = T.tiling.maxBaseUploadsPerFrame, $0 = 0, ey = 1, ty = function() {
  46850. y(a, hn);
  46851. var r = w(a);
  46852. function a(e, t, n) {
  46853. var i;
  46854. return O(this, a),
  46855. (i = r.call(this)).tileDirectory = {},
  46856. i.activeRenderTargetDescriptors = {},
  46857. i.activePanos = [],
  46858. i.panoLODDescriptors = {},
  46859. i.panoDescriptors = {},
  46860. i.tileTrees = {},
  46861. i.forceQueue = [],
  46862. i.uploadQueues = {},
  46863. i.uploadInterval = null,
  46864. i.uploadIntervalCancelled = !1,
  46865. i.usingTileOverlay = !1,
  46866. i.overlayTilesLoaded = !1,
  46867. i.overlayTileBase = null,
  46868. i.overlayTilesBasic = {},
  46869. i.overlayTilesEnhanced = {},
  46870. i.zoomRenderTarget = null,
  46871. i.zoomPano = null,
  46872. i.zoomingActive = !1,
  46873. i.zoomPanoId = null,
  46874. i.zoomPanoRenderingDisabled = !1,
  46875. i.direction = [],
  46876. i.maxBaseUploadsPerFrame = K0,
  46877. i.maxNonBaseUploadsPerFrame = Q0,
  46878. i.M = [],
  46879. i.viewer = e,
  46880. i.tileDownloader = t,
  46881. i.qualityManager = n,
  46882. i.initTime = performance.now(),
  46883. i.bindEvents(),
  46884. i
  46885. }
  46886. return h(a, [{
  46887. key: "getActivePanoTextures",
  46888. value: function(e) {
  46889. e = e || [];
  46890. for (var t = 0; t < M.length; t++) {
  46891. var n = M[t];
  46892. n.renderTarget && n.renderTarget.texture && e.push(n.renderTarget.texture)
  46893. }
  46894. }
  46895. }, {
  46896. key: "hasQueuedTiles",
  46897. value: function() {
  46898. var e = this.peekNextFromUploadQueue();
  46899. return null != e
  46900. }
  46901. }, {
  46902. key: "getActiveRenderTargetDescriptor",
  46903. value: function(e) {
  46904. return this.activeRenderTargetDescriptors[e]
  46905. }
  46906. }, {
  46907. key: "setActiveRenderTargetDescriptor",
  46908. value: function(e, t) {
  46909. this.activeRenderTargetDescriptors[e] = t
  46910. }
  46911. }, {
  46912. key: "bindEvents",
  46913. value: function() {
  46914. this.tileDownloader.addEventListener(hm.TileDownloadSuccess, this.onTileDownloaded.bind(this))
  46915. }
  46916. }, {
  46917. key: "enableUltraHighQualityMode",
  46918. value: function(t) {
  46919. if ("2k" == T.tileClass || "1k" == T.tileClass)
  46920. return this.enableHighQuality(t);
  46921. var e;
  46922. this.qualityManager.ultraHighQualityModeEnabled() || (e = this.qualityManager.getPanoSize(cm.ULTRAHIGH),
  46923. this.tileDownloader.testDownload(e, Gg.TILE_SIZE, function(e) {
  46924. e && (this.qualityManager.enableUltraHighQualityMode(),
  46925. this.setupZoomRenderTarget(),
  46926. t())
  46927. }
  46928. .bind(this)))
  46929. }
  46930. }, {
  46931. key: "activateTiledPano",
  46932. value: function(e, t, n) {
  46933. n && this.clearAllQueuedUploads();
  46934. for (var i = 0; i < Gg.FACES_PER_PANO; i++)
  46935. this.initTileTree(e.id, i, this.qualityManager.getMaxPossiblePanoSize());
  46936. this.linkAllTilesAndNodes(e);
  46937. var r = this.getActiveRenderTargetDescriptor(e.id)
  46938. , t = t;
  46939. return t > this.qualityManager.getMaxNavPanoSize() && (t = this.qualityManager.getMaxNavPanoSize()),
  46940. r && t === r.size || (r && this.deactiveDescripor(r.renderTarget),
  46941. (r = this.activeDescripor(t)) || (t = this.initTiledPano(t, !1),
  46942. (r = this.initDescriptor(t.width)).renderTarget = t),
  46943. r.pano = e,
  46944. this.resetPanoDescriptor(e.id),
  46945. this.resetPanoLODDescriptors(e.id),
  46946. this.resetRenderStatus(e.id, !0, !0)),
  46947. this.setActiveRenderTargetDescriptor(e.id, r),
  46948. this.updateActivePanos(e, n ? 0 : 1),
  46949. r.renderTarget
  46950. }
  46951. }, {
  46952. key: "deactivateTiledPano",
  46953. value: function(e) {
  46954. var t = this.getActiveRenderTargetDescriptor(e.id);
  46955. this.isRenderTargetDescriptorValid(t) && (this.deactiveDescripor(t.renderTarget),
  46956. this.setActiveRenderTargetDescriptor(e.id, null));
  46957. e = this.getUploadQueueForPano(e.id);
  46958. this.clearUploadQueue(e),
  46959. this.updateActivePanos()
  46960. }
  46961. }, {
  46962. key: "getActivePanoCount",
  46963. value: function() {
  46964. return this.activePanos.length
  46965. }
  46966. }, {
  46967. key: "resetRenderStatus",
  46968. value: function(e, r, a, t) {
  46969. var n = null;
  46970. t && (n = A0.getLevelCountForSize(Gg.TILE_SIZE, t) + 1);
  46971. for (var i = function(e, t, n, i) {
  46972. a && (t.tile.zoomUploaded = !1),
  46973. r && (t.tile.uploaded = !1)
  46974. }, o = 0; o < Gg.FACES_PER_PANO; o++)
  46975. this.getTileTree(e, o).breadthFirst({
  46976. callback: i.bind(this, o),
  46977. minLevel: n
  46978. })
  46979. }
  46980. }, {
  46981. key: "copyBaseRenderStatusToZoomed",
  46982. value: function(e) {
  46983. for (var t = A0.getLevelCountForSize(Gg.TILE_SIZE, this.qualityManager.getMaxNavPanoSize()), n = function(e, t, n, i) {
  46984. t.tile.zoomUploaded = t.tile.uploaded,
  46985. t.zoomCovered = t.covered
  46986. }, i = 0; i < Gg.FACES_PER_PANO; i++)
  46987. this.getTileTree(e, i).breadthFirst({
  46988. callback: n.bind(this, i),
  46989. maxLevel: t
  46990. })
  46991. }
  46992. }, {
  46993. key: "isRenderTargetDescriptorValid",
  46994. value: function(e) {
  46995. return e && e.renderTarget
  46996. }
  46997. }, {
  46998. key: "isPanoActive",
  46999. value: function(e) {
  47000. e = this.getActiveRenderTargetDescriptor(e);
  47001. return this.isRenderTargetDescriptorValid(e)
  47002. }
  47003. }, {
  47004. key: "isPanoZoomed",
  47005. value: function(e) {
  47006. return this.zoomingActive && this.zoomPanoId === e
  47007. }
  47008. }, {
  47009. key: "initTileTree",
  47010. value: function(e, t, n) {
  47011. var i = this.tileTrees[e];
  47012. i || (this.tileTrees[e] = i = []);
  47013. var e = i[t];
  47014. e || (n = A0.getLevelCountForSize(Gg.TILE_SIZE, n),
  47015. e = new A0(Gg.TILE_SIZE,n),
  47016. i[t] = e)
  47017. }
  47018. }, {
  47019. key: "getTileTree",
  47020. value: function(e, t) {
  47021. e = this.tileTrees[e];
  47022. e || console.error("PanoRenderer.getTileTree() -> Tree array not yet initialized!");
  47023. t = e[t];
  47024. return t || console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),
  47025. t
  47026. }
  47027. }, {
  47028. key: "initTiledPano",
  47029. value: function(e, t) {
  47030. var n = this.viewer.renderer
  47031. , i = new na(e,{
  47032. stencilBuffer: !1
  47033. })
  47034. , e = new ta([]);
  47035. e.image = [null, null, null, null, null, null],
  47036. e.flipY = !0,
  47037. e.format = et,
  47038. t ? (e.generateMipmaps = !0,
  47039. e.magFilter = Oe,
  47040. e.minFilter = G) : (e.generateMipmaps = !1,
  47041. e.magFilter = Oe,
  47042. e.minFilter = Oe),
  47043. n.setRenderTarget(i),
  47044. n.setRenderTarget(null);
  47045. e = n.properties.get(e);
  47046. return e.__image__webglTextureCube = e.__webglTexture,
  47047. i
  47048. }
  47049. }, {
  47050. key: "getUploadQueueForPano",
  47051. value: function(e) {
  47052. var t = this.uploadQueues[e];
  47053. return t || (this.uploadQueues[e] = t = []),
  47054. t
  47055. }
  47056. }, {
  47057. key: "isTileUploaded",
  47058. value: function(e) {
  47059. return this.isPanoZoomed(e.panoId) ? e.zoomUploaded : e.uploaded
  47060. }
  47061. }, {
  47062. key: "setUploaded",
  47063. value: function(e, t) {
  47064. this.isPanoZoomed(e.panoId) ? e.zoomUploaded = t : e.uploaded = t
  47065. }
  47066. }, {
  47067. key: "queueTileUpload",
  47068. value: function(e, t, n) {
  47069. var i, r = this.getActiveRenderTargetDescriptor(e.panoId);
  47070. !this.isRenderTargetDescriptorValid(r) || !e.downloaded || this.isTileUploaded(e) || e.uploadQueued && !n || e.panoSize > this.qualityManager.getMaxNavPanoSize() && !this.zoomingActive || (i = this.getUploadQueueForPano(e.panoId),
  47071. n ? this.uploadTile(e, !1) : (this.shoulPushToFrontOfQueue(e) ? this.forceQueue.push(e) : t && this.direction ? u0.insertSortedPanoTile(i, e, r.pano, this.direction) : i.push(e),
  47072. e.uploadQueued = !0,
  47073. this.uploadInterval || this.uploadIntervalCancelled || this.refreshUploadInterval(0)))
  47074. }
  47075. }, {
  47076. key: "shoulPushToFrontOfQueue",
  47077. value: function(e) {
  47078. return 0 === A0.getLevelCountForSize(Gg.TILE_SIZE, e.panoSize)
  47079. }
  47080. }, {
  47081. key: "getTopUploadQueue",
  47082. value: function() {
  47083. for (var e, t, n = $0; n <= ey; n++)
  47084. for (var i = 0; i < this.activePanos.length; i++)
  47085. if (e = this.activePanos[i],
  47086. 0 < (t = this.getUploadQueueForPano(e.id)).length)
  47087. switch (n) {
  47088. case $0:
  47089. if (0 === t[0].level)
  47090. return t;
  47091. break;
  47092. case ey:
  47093. return t
  47094. }
  47095. return null
  47096. }
  47097. }, {
  47098. key: "peekNextFromUploadQueue",
  47099. value: function() {
  47100. if (0 < this.forceQueue.length)
  47101. return this.forceQueue[0];
  47102. var e = this.getTopUploadQueue();
  47103. return e && 0 < e.length ? e[0] : null
  47104. }
  47105. }, {
  47106. key: "clearAllQueuedUploads",
  47107. value: function() {
  47108. this.clearAllUploadQueues(null, 0)
  47109. }
  47110. }, {
  47111. key: "clearAllQueuedUploadsForPano",
  47112. value: function(e) {
  47113. this.clearAllUploadQueues(e, 0)
  47114. }
  47115. }, {
  47116. key: "clearAllUploadQueues",
  47117. value: function(e, t) {
  47118. if (e)
  47119. this.clearUploadQueue(this.getUploadQueueForPano(e), t),
  47120. this.clearUploadQueue(this.forceQueue, t, e);
  47121. else {
  47122. for (var n = 0; n < this.activePanos.length; n++) {
  47123. var i = this.activePanos[n];
  47124. this.clearUploadQueue(this.getUploadQueueForPano(i.id), t)
  47125. }
  47126. this.clearUploadQueue(this.forceQueue, t)
  47127. }
  47128. }
  47129. }, {
  47130. key: "clearUploadQueue",
  47131. value: function(e, t, n) {
  47132. null != t || (t = 0);
  47133. for (var i = 0; i < e.length; ) {
  47134. var r = e[i];
  47135. (!n || n === r.tile.panoId) && r.level >= t ? (r.uploadQueued = !1,
  47136. e.splice(i, 1)) : i++
  47137. }
  47138. }
  47139. }, {
  47140. key: "updateUploadQueue",
  47141. value: function(e, t) {
  47142. e = e || 1;
  47143. for (var n = 0, i = 0; ; ) {
  47144. this.forceQueue.slice(0);
  47145. if (t <= i || e <= n)
  47146. break;
  47147. var r, a = this.getNextFromUploadQueue();
  47148. if (!a)
  47149. break;
  47150. 0 !== a.level ? n++ : i++,
  47151. a.panoSize > this.qualityManager.getMaxNavPanoSize() && !this.zoomingActive || (r = this.getActiveRenderTargetDescriptor(a.panoId),
  47152. this.isRenderTargetDescriptorValid(r) && this.uploadTile(a, a.forceUpload))
  47153. }
  47154. }
  47155. }, {
  47156. key: "updateDirection",
  47157. value: function(e) {
  47158. if (e = e || this.direction) {
  47159. this.direction = e;
  47160. for (var t = 0; t < this.activePanos.length; t++) {
  47161. var n = this.activePanos[t]
  47162. , i = this.getUploadQueueForPano(n.id);
  47163. u0.sortPanoTiles(i, n, this.direction)
  47164. }
  47165. }
  47166. }
  47167. }, {
  47168. key: "anyUploaded",
  47169. value: function(e) {
  47170. if (!e)
  47171. return !1;
  47172. if (e.tile && this.isTileUploaded(e.tile))
  47173. return !0;
  47174. if (e.children)
  47175. for (var t = 0; t < e.children.length; t++) {
  47176. var n = e.children[t];
  47177. if (this.anyUploaded(n))
  47178. return !0
  47179. }
  47180. return !1
  47181. }
  47182. }, {
  47183. key: "setNodeCovered",
  47184. value: function(e, t) {
  47185. this.isPanoZoomed(e.tile.panoId) ? e.zoomCovered = t : e.covered = t
  47186. }
  47187. }, {
  47188. key: "isNodeCovered",
  47189. value: function(e) {
  47190. return !!e && (this.isPanoZoomed(e.tile.panoId) ? e.zoomCovered : e.covered)
  47191. }
  47192. }, {
  47193. key: "addCoverageForNode",
  47194. value: function(e) {
  47195. this.setNodeCovered(e, !0),
  47196. e.parent && e.covered && (e = e.parent,
  47197. this.nodeSubcovered(e) && this.addCoverageForNode(e, !0))
  47198. }
  47199. }, {
  47200. key: "calcFullCoverage",
  47201. value: function(e) {
  47202. var t = !1;
  47203. if (e.children)
  47204. for (var n = 0; n < e.children.length; n++)
  47205. var i = e.children[n]
  47206. , t = t || this.calcFullCoverage(i);
  47207. e.covered = e.tile.uploaded || t
  47208. }
  47209. }, {
  47210. key: "nodeSubcovered",
  47211. value: function(e) {
  47212. if (!e.children)
  47213. return !1;
  47214. for (var t = 0; t < e.children.length; t++)
  47215. if (!e.children[t] || !this.isNodeCovered(e.children[t]))
  47216. return !1;
  47217. return !0
  47218. }
  47219. }, {
  47220. key: "resetPanoDescriptor",
  47221. value: function(e) {
  47222. this.getPanoDescriptor(e)
  47223. }
  47224. }, {
  47225. key: "getPanoDescriptor",
  47226. value: function(e) {
  47227. var t = this.panoDescriptors[e];
  47228. return t || (this.panoDescriptors[e] = t = {}),
  47229. t
  47230. }
  47231. }, {
  47232. key: "resetPanoLODDescriptors",
  47233. value: function(e) {
  47234. var t, n, i = this.getPanoLODDescriptors(e);
  47235. for (t in i)
  47236. i.hasOwnProperty(t) && ((n = i[t]).uploadCount = 0,
  47237. n.uploadAttempts = 0,
  47238. n.uploaded = [])
  47239. }
  47240. }, {
  47241. key: "getPanoLODDescriptor",
  47242. value: function(e, t) {
  47243. var n = this.getPanoLODDescriptors(e)
  47244. , e = n[t];
  47245. return e || (n[t] = e = {
  47246. uploadCount: 0,
  47247. uploadAttempts: 0,
  47248. uploaded: []
  47249. }),
  47250. e
  47251. }
  47252. }, {
  47253. key: "getPanoLODDescriptors",
  47254. value: function(e) {
  47255. var t = this.panoLODDescriptors[e];
  47256. return t || (this.panoLODDescriptors[e] = t = {}),
  47257. t
  47258. }
  47259. }, {
  47260. key: "onTileDownloaded",
  47261. value: function(e) {
  47262. var t = e.desc
  47263. , e = A0.getLevelCountForSize(Gg.TILE_SIZE, t.panoSize)
  47264. , e = this.getTileDirectoryEntry(t.panoId, t.face, e, t.faceTileIndex);
  47265. e.downloaded = !0,
  47266. e.image = t.image,
  47267. e.panoSize = t.panoSize,
  47268. e.tileX = t.tileX,
  47269. e.tileY = t.tileY,
  47270. e.totalTiles = t.totalTiles,
  47271. e.tileIndex = t.tileIndex,
  47272. e.faceTileIndex = t.faceTileIndex,
  47273. e.face = t.face,
  47274. e.cubeFace = Gg.mapFaceToCubemapFace(t.face),
  47275. e.panoId = t.panoId,
  47276. e.tileSize = t.tileSize,
  47277. e.direction = (new Cn).copy(t.direction),
  47278. e.node = null,
  47279. e.level = A0.getLevelCountForSize(Gg.TILE_SIZE, e.panoSize),
  47280. this.isPanoActive(e.panoId) && (t = this.getTileTree(e.panoId, e.face).getSubNode(e.panoSize, e.tileX, e.tileY),
  47281. this.linkTileAndNode(e, t),
  47282. this.queueTileUpload(e, !0))
  47283. }
  47284. }, {
  47285. key: "getTileDirectoryEntry",
  47286. value: function(e, t, n, i) {
  47287. var r = this.tileDirectory[e];
  47288. r || (this.tileDirectory[e] = r = {});
  47289. var a = 16384 * t + 1024 * n + i
  47290. , o = r[a];
  47291. return o || (r[a] = o = {
  47292. downloaded: !1,
  47293. uploaded: !1,
  47294. zoomUploaded: !1
  47295. }),
  47296. o._key = e + ":" + t + ":" + n + ":" + i,
  47297. o._tileKey = a,
  47298. o
  47299. }
  47300. }, {
  47301. key: "setZoomingActive",
  47302. value: function(e, t, n) {
  47303. this.zoomPanoRenderingDisabled || e === this.zoomingActive && this.zoomPanoId === t.id || (this.zoomingActive = e,
  47304. this.zoomPanoId = t.id,
  47305. this.zoomingActive && (this.zoomPanoId !== t.id || n) && this.updateZoomedPanoFromBase(t))
  47306. }
  47307. }, {
  47308. key: "updateZoomedPanoFromBase",
  47309. value: function(e) {
  47310. var t, n, i;
  47311. this.zoomPanoRenderingDisabled || !this.zoomRenderTarget || (i = this.getActiveRenderTargetDescriptor(e.id)) && i.renderTarget && (t = Math.min(this.qualityManager.maxRenderTargetSize, this.qualityManager.getMaxZoomPanoSize()),
  47312. n = i.renderTarget,
  47313. i = i.size,
  47314. this.copyCubeMap(n.texture, this.zoomRenderTarget, i, i, t, t),
  47315. this.copyBaseRenderStatusToZoomed(e.id))
  47316. }
  47317. }, {
  47318. key: "add",
  47319. value: function(e) {
  47320. this.M.push(e)
  47321. }
  47322. }, {
  47323. key: "initDescriptor",
  47324. value: function(e) {
  47325. var t = {
  47326. renderTarget: null,
  47327. inUse: !1,
  47328. size: -1,
  47329. pano: null
  47330. };
  47331. return t.inUse = !0,
  47332. t.size = e,
  47333. this.add(t),
  47334. t
  47335. }
  47336. }, {
  47337. key: "activeDescripor",
  47338. value: function(e) {
  47339. for (var t = 0; t < this.M.length; t++) {
  47340. var n = this.M[t];
  47341. if (!n.inUse && n.size === e)
  47342. return n.inUse = !0,
  47343. n
  47344. }
  47345. return null
  47346. }
  47347. }, {
  47348. key: "deactiveDescripor",
  47349. value: function(e) {
  47350. for (var t = 0; t < this.M.length; t++) {
  47351. var n = this.M[t];
  47352. if (n.renderTarget === e)
  47353. return !(n.inUse = !1)
  47354. }
  47355. return !1
  47356. }
  47357. }, {
  47358. key: "enableHighQuality",
  47359. value: function(e) {
  47360. this.qualityManager.highQualityModeStarted || (this.setupZoomRenderTarget(),
  47361. e(),
  47362. this.qualityManager.highQualityModeStarted = !0)
  47363. }
  47364. }, {
  47365. key: "linkTileAndNode",
  47366. value: function(e, t) {
  47367. (t.tile = e).node = t
  47368. }
  47369. }, {
  47370. key: "linkAllTilesAndNodes",
  47371. value: function(a) {
  47372. for (var e = function(e, t, n, i, r) {
  47373. r = this.getTileDirectoryEntry(a.id, t, i, r);
  47374. this.linkTileAndNode(r, n)
  47375. }, t = 0; t < Gg.FACES_PER_PANO; t++) {
  47376. var n = this.getTileTree(a.id, t);
  47377. n.breadthFirst({
  47378. callback: e.bind(this, n, t)
  47379. })
  47380. }
  47381. }
  47382. }, {
  47383. key: "initSizedTexture2D",
  47384. value: function(e, t, n) {
  47385. var i = this.viewer.renderer
  47386. , r = i.getContext()
  47387. , a = i.state
  47388. , o = new En(null);
  47389. o.flipY = !1,
  47390. o.generateMipmaps = n = !0 !== n ? !1 : n;
  47391. var s = i.paramThreeToGL(o.format)
  47392. , l = i.paramThreeToGL(o.type)
  47393. , u = i.properties.get(o)
  47394. , c = r.createTexture();
  47395. a.bindTexture(r.TEXTURE_2D, c),
  47396. r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, o.flipY),
  47397. r.texImage2D(r.TEXTURE_2D, 0, s, e, e, 0, s, l, null),
  47398. o.wrapS = t,
  47399. o.wrapT = t;
  47400. t = i.paramThreeToGL(t);
  47401. return r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, t),
  47402. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, t),
  47403. n ? (o.magFilter = Oe,
  47404. o.minFilter = G,
  47405. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR),
  47406. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR_MIPMAP_NEAREST),
  47407. r.generateMipmap(r.TEXTURE_2D)) : (o.magFilter = Oe,
  47408. o.minFilter = Oe,
  47409. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR),
  47410. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR)),
  47411. a.bindTexture(r.TEXTURE_2D, null),
  47412. u.__webglTexture = c,
  47413. o
  47414. }
  47415. }, {
  47416. key: "deallocateCubeTexture",
  47417. value: function(e) {
  47418. var t = this.viewer.renderer
  47419. , n = t.getContext()
  47420. , e = t.properties.get(e);
  47421. n.deleteTexture(e.__image__webglTextureCube)
  47422. }
  47423. }, {
  47424. key: "uploadTexture2D",
  47425. value: function(e, t, n, i, r, a) {
  47426. var o = this.viewer.renderer
  47427. , s = o.getContext()
  47428. , l = o.state
  47429. , u = o.properties.get(t);
  47430. l.bindTexture(s.TEXTURE_2D, u.__webglTexture),
  47431. s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, t.flipY),
  47432. s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha),
  47433. s.pixelStorei(s.UNPACK_ALIGNMENT, t.unpackAlignment),
  47434. s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, o.paramThreeToGL(t.wrapS)),
  47435. s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, o.paramThreeToGL(t.wrapT)),
  47436. s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, o.paramThreeToGL(t.magFilter)),
  47437. s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, o.paramThreeToGL(t.minFilter)),
  47438. s.texSubImage2D(s.TEXTURE_2D, 0, n, i, s.RGBA, s.UNSIGNED_BYTE, e),
  47439. t.generateMipmaps && s.generateMipmap(s.TEXTURE_2D),
  47440. l.bindTexture(s.TEXTURE_2D, null)
  47441. }
  47442. }, {
  47443. key: "getCubeOrientationForCubeFace",
  47444. value: function(e, t) {
  47445. switch (e) {
  47446. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X:
  47447. t.set(0, -Math.PI / 2, 0);
  47448. break;
  47449. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
  47450. t.set(0, Math.PI / 2, 0);
  47451. break;
  47452. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
  47453. t.set(Math.PI / 2, Math.PI, 0);
  47454. break;
  47455. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
  47456. t.set(-Math.PI / 2, Math.PI, 0);
  47457. break;
  47458. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
  47459. t.set(0, -Math.PI, 0);
  47460. break;
  47461. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
  47462. t.set(0, 0, 0)
  47463. }
  47464. }
  47465. }]),
  47466. a
  47467. }();
  47468. function ny(e) {
  47469. return (e = e.shift()).uploadQueued = !1,
  47470. e
  47471. }
  47472. ty.prototype.setupZoomRenderTarget = (T0 = {},
  47473. function() {
  47474. var e, t, n;
  47475. "2k" == this.qualityManager.maxRenderTargetSize && "2k" == this.qualityManager.getMaxNavPanoSize() || (this.qualityManager.getMaxZoomPanoSize() >= this.qualityManager.getMaxNavPanoSize() ? this.zoomRenderTarget && this.zoomRenderTarget.width === this.qualityManager.getMaxZoomPanoSize() || (e = this.zoomRenderTarget,
  47476. (n = this.qualityManager.getMaxZoomPanoSize()) > this.qualityManager.maxRenderTargetSize || (T0[n] ? this.zoomRenderTarget = T0[n] : (this.zoomRenderTarget = this.initTiledPano(n, !1),
  47477. T0[n] = this.zoomRenderTarget),
  47478. e && (t = e.width,
  47479. n = this.zoomRenderTarget.width,
  47480. this.copyCubeMap(e.texture, this.zoomRenderTarget, t, t, n, n),
  47481. e.texture.dispose(),
  47482. e.texture.loaded = !1,
  47483. e.texture.version = 0,
  47484. this.deallocateCubeTexture(e.texture),
  47485. e.texture = null),
  47486. this.zoomPanoRenderingDisabled = !1)) : this.zoomPanoRenderingDisabled = !0)
  47487. }
  47488. ),
  47489. ty.prototype.updateActivePanos = (S0 = [],
  47490. function(e, t) {
  47491. for (var n = S0.length = 0; n < this.activePanos.length; n++) {
  47492. e && S0.length === t && S0.push(e);
  47493. var i = this.activePanos[n]
  47494. , r = this.getActiveRenderTargetDescriptor(i.id);
  47495. e && i.id === e.id || !this.isRenderTargetDescriptorValid(r) || S0.push(i)
  47496. }
  47497. e && t >= S0.length && S0.push(e),
  47498. this.activePanos.length = 0,
  47499. this.activePanos.push.apply(this.activePanos, S0)
  47500. }
  47501. ),
  47502. ty.prototype.renderPanoTiles = (C0 = [],
  47503. function(e, t, n, i) {
  47504. this.zoomRenderTarget && this.zoomRenderTarget.width === this.qualityManager.getMaxZoomPanoSize() || this.zoomPanoRenderingDisabled || this.setupZoomRenderTarget(),
  47505. t = t || this.direction || pm.FORWARD;
  47506. var r = this.getActiveRenderTargetDescriptor(e);
  47507. this.isRenderTargetDescriptorValid(r) || console.error("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated.");
  47508. for (var a = 0; a < Gg.FACES_PER_PANO; a++) {
  47509. var o = this.getTileTree(e, a);
  47510. C0.length = 0,
  47511. o.breadthFirst({
  47512. saveVisited: C0
  47513. });
  47514. for (var s = 0; s < C0.length; s++) {
  47515. var l = C0[s];
  47516. this.queueTileUpload(l.tile, !1, i || 0 === s && n)
  47517. }
  47518. }
  47519. this.updateDirection(t)
  47520. }
  47521. ),
  47522. ty.prototype.getNextFromUploadQueue = function() {
  47523. if (0 < this.forceQueue.length)
  47524. return ny(this.forceQueue);
  47525. var e = this.getTopUploadQueue();
  47526. return e && 0 < e.length ? ny(e) : null
  47527. }
  47528. ,
  47529. ty.prototype.refreshUploadInterval = (P0 = null,
  47530. function(e) {
  47531. this.uploadIntervalCancelled || (P0 = P0 || function() {
  47532. this.uploadIntervalCancelled || (this.overlayTilesLoaded || !this.usingTileOverlay ? (J0 = !0,
  47533. this.updateUploadQueue(this.maxNonBaseUploadsPerFrame, this.maxBaseUploadsPerFrame),
  47534. this.peekNextFromUploadQueue() ? this.refreshUploadInterval(Y0) : this.uploadInterval = null) : this.refreshUploadInterval(this.uploadIntervalDelay))
  47535. }
  47536. .bind(this),
  47537. null != e || (e = Y0),
  47538. J0 || (e = Z0),
  47539. this.uploadInterval = window.setTimeout(P0, e),
  47540. this.uploadIntervalDelay = e)
  47541. }
  47542. ),
  47543. ty.prototype.update = (D0 = performance.now(),
  47544. k0 = 0,
  47545. function() {
  47546. this.uploadIntervalCancelled = !0,
  47547. window.clearTimeout(this.uploadInterval),
  47548. this.uploadInterval = null;
  47549. var e = performance.now() - D0;
  47550. !(Y0 < e || 0 === k0) || !this.overlayTilesLoaded && this.usingTileOverlay || (this.updateUploadQueue(this.maxNonBaseUploadsPerFrame, this.maxBaseUploadsPerFrame),
  47551. D0 = performance.now()),
  47552. k0++
  47553. }
  47554. ),
  47555. ty.prototype.uploadTile = (B0 = {},
  47556. L0 = T.tiling.overlayStyle,
  47557. R0 = {},
  47558. function(e, t) {
  47559. var n = this
  47560. , i = e.panoId
  47561. , r = e.image
  47562. , a = e.tileSize
  47563. , o = e.panoSize
  47564. , s = e.tileIndex
  47565. , l = e.totalTiles
  47566. , u = e.tileX
  47567. , c = e.tileY
  47568. , d = !0
  47569. , h = !1
  47570. , p = !1
  47571. , f = (this.getPanoDescriptor(i),
  47572. this.getPanoLODDescriptor(i, o))
  47573. , m = this.getActiveRenderTargetDescriptor(i)
  47574. , v = m.renderTarget
  47575. , g = m.size;
  47576. this.isPanoZoomed(i) && this.zoomRenderTarget && (v = this.zoomRenderTarget,
  47577. g = this.zoomRenderTarget.width);
  47578. function y() {
  47579. f.uploaded.includes(s) || (f.uploaded.push(s),
  47580. f.uploadCount++),
  47581. n.dispatchEvent({
  47582. type: dm.TileRenderSuccess,
  47583. id: i,
  47584. panoSize: o,
  47585. tileIndex: s,
  47586. totalTiles: l
  47587. }),
  47588. f.uploadCount === l && n.dispatchEvent({
  47589. type: dm.PanoRenderComplete,
  47590. id: i,
  47591. panoSize: o,
  47592. totalTiles: l,
  47593. updateFullComplete: !0
  47594. }),
  47595. n.setUploaded(e, !0),
  47596. n.addCoverageForNode(e.node)
  47597. }
  47598. var w, b;
  47599. return this.isRenderTargetDescriptorValid(m) || (h = d = !1),
  47600. t || (this.anyUploaded(e.node) && (p = h = !(d = !1)),
  47601. this.isTileUploaded(e) && (p = !(h = d = !1))),
  47602. d ? (t = a / o * g,
  47603. d = u * a / o * g,
  47604. g = c * a / o * g,
  47605. B0[a] || (B0[a] = this.initSizedTexture2D(a, Be)),
  47606. o > this.qualityManager.maxRenderTargetSize ? (b = this.initSizedTexture2D(a, Be),
  47607. w = this.viewer.images360.isHighMapLoaded(e.cubeFace, u, c)) : b = B0[a],
  47608. this.uploadTexture2D(r, b, 0, 0, a, a),
  47609. o > this.qualityManager.maxRenderTargetSize ? w || this.viewer.images360.updateHighMap(b, e.cubeFace, u, c) : 1 === L0 || 2 === L0 ? (c = 1 === L0 ? this.overlayTilesBasic : this.overlayTilesEnhanced,
  47610. this.renderToCubeMap(b, v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace),
  47611. this.renderToCubeMap(c[o], v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace, K, !0, .5)) : this.renderToCubeMap(b, v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace),
  47612. y()) : p ? y() : (R0[i + ":" + o + ":" + s] = !0,
  47613. this.setUploaded(e, !1)),
  47614. e.uploadAttempted || (f.uploadAttempts++,
  47615. this.dispatchEvent({
  47616. type: dm.TileUploadAttempted,
  47617. id: i,
  47618. panoSize: o,
  47619. tileIndex: s,
  47620. totalTiles: l
  47621. })),
  47622. e.uploadAttempted = !0,
  47623. f.uploadAttempts === l && this.dispatchEvent({
  47624. type: dm.UploadAttemptedForAllTiles,
  47625. id: i,
  47626. panoSize: o,
  47627. totalTiles: l
  47628. }),
  47629. h
  47630. }
  47631. ),
  47632. ty.prototype.renderToCubeMap = (F0 = !1,
  47633. U0 = N0 = z0 = O0 = I0 = null,
  47634. function(e, t, n, i, r, a, o, s, l, u, c, d, h, p, f, m) {
  47635. var v = this.viewer.renderer;
  47636. F0 || ((O0 = new ed(-.5,.5,.5,-.5,-200,200)).position.z = 150,
  47637. (I0 = new gs).add(O0),
  47638. z0 = new Qr({
  47639. uniforms: {
  47640. tDiffuse: {
  47641. type: "scene",
  47642. value: null
  47643. },
  47644. alpha: {
  47645. type: "startYinTile",
  47646. value: 1
  47647. }
  47648. },
  47649. vertexShader: Hp["basicTextured.vs"],
  47650. fragmentShader: Hp["basicTextured.fs"],
  47651. depthWrite: !1,
  47652. depthTest: !1,
  47653. side: Y
  47654. }),
  47655. N0 = new ua(1,1),
  47656. (U0 = new Hr(N0,z0)).position.z = 0,
  47657. I0.add(U0),
  47658. F0 = !0);
  47659. var g = N0.getAttribute("uv");
  47660. g.setDynamic(!0),
  47661. g.needsUpdate = !0;
  47662. g = g.array,
  47663. r /= n,
  47664. a /= i,
  47665. n = o / n,
  47666. i = s / i;
  47667. g[0] = r,
  47668. g[1] = a + i,
  47669. g[2] = r + n,
  47670. g[3] = a + i,
  47671. g[4] = r,
  47672. g[5] = a,
  47673. g[6] = r + n,
  47674. g[7] = a;
  47675. a = N0.getAttribute("position");
  47676. a.setDynamic(!0),
  47677. a.needsUpdate = !0;
  47678. a = a.array,
  47679. l = l / t.width - .5,
  47680. u = u / t.height - .5,
  47681. c /= t.width,
  47682. d /= t.height;
  47683. a[0] = l,
  47684. a[1] = u + d,
  47685. a[3] = l + c,
  47686. a[4] = u + d,
  47687. a[6] = l,
  47688. a[7] = u,
  47689. a[9] = l + c,
  47690. a[10] = u,
  47691. v.properties.get(I0),
  47692. z0.uniforms.tDiffuse.value = e,
  47693. z0.blending = p || Z,
  47694. z0.transparent = !!f,
  47695. z0.uniforms.alpha.value = m = null == m ? 1 : m,
  47696. z0.needUpdate = !0,
  47697. t.viewport.set(0, 0, t.width, t.height);
  47698. f = v.autoClear,
  47699. m = v.getRenderTarget();
  47700. v.autoClear = !1,
  47701. v.setRenderTarget(t, h),
  47702. v.render(I0, O0),
  47703. v.setRenderTarget(m),
  47704. v.autoClear = f
  47705. }
  47706. ),
  47707. ty.prototype.copyCubeMap = (H0 = !1,
  47708. X0 = W0 = j0 = V0 = null,
  47709. q0 = new ci,
  47710. function(e, t, n, i, r, a, o, s, l) {
  47711. if (!(r > this.qualityManager.maxRenderTargetSize)) {
  47712. H0 || ((j0 = new ed(-1,1,1,-1,0,200)).position.set(0, 0, 0),
  47713. (V0 = new gs).add(j0),
  47714. W0 = new Qr({
  47715. uniforms: {
  47716. tDiffuse: {
  47717. type: "t",
  47718. value: null
  47719. },
  47720. alpha: {
  47721. type: "f",
  47722. value: 1
  47723. }
  47724. },
  47725. vertexShader: Hp["copyCubeMap.vs"],
  47726. fragmentShader: Hp["copyCubeMap.fs"],
  47727. depthWrite: !1,
  47728. depthTest: !1,
  47729. side: Y
  47730. }),
  47731. G0 = new Cl(2,2,2),
  47732. X0 = new Hr(G0,W0),
  47733. V0.add(X0),
  47734. H0 = !0);
  47735. var u = this.viewer.renderer.autoClear
  47736. , c = this.viewer.renderer.getRenderTarget();
  47737. this.viewer.renderer.autoClear = !1,
  47738. W0.uniforms.tDiffuse.value = e,
  47739. W0.blending = o || Z,
  47740. W0.transparent = !!s,
  47741. W0.uniforms.alpha.value = l = null == l ? 1 : l,
  47742. W0.needUpdate = !0;
  47743. for (var d = 0; d < 6; d++)
  47744. this.getCubeOrientationForCubeFace(d, q0),
  47745. X0.rotation.copy(q0),
  47746. X0.matrixWorldNeedsUpdate = !0,
  47747. X0.updateMatrixWorld(),
  47748. t.viewport.set(0, 0, r, a),
  47749. this.viewer.renderer.setRenderTarget(t, d),
  47750. this.viewer.renderer.render(V0, j0);
  47751. this.viewer.renderer.autoClear = u,
  47752. this.viewer.renderer.setRenderTarget(c)
  47753. }
  47754. }
  47755. );
  47756. var iy, ry, ay, oy = function() {
  47757. function t() {
  47758. O(this, t);
  47759. var e = document.createElement("canvas");
  47760. this.canvas = e,
  47761. this.context = e.getContext("2d")
  47762. }
  47763. return h(t, [{
  47764. key: "changeImg",
  47765. value: function(e) {
  47766. this.img != e && (this.canvas.width = e.width,
  47767. this.canvas.height = e.height,
  47768. this.context.drawImage(e, 0, 0),
  47769. this.img = e)
  47770. }
  47771. }, {
  47772. key: "getDepth",
  47773. value: function(e, t) {
  47774. e = Math.round(e * (this.canvas.width - 1)),
  47775. t = Math.round(t * (this.canvas.height - 1));
  47776. if (!(e < 0 || t < 0 || e >= this.width || t >= this.height)) {
  47777. t = this.context.getImageData(e, t, 1, 1).data;
  47778. return t[1] + t[0] / 256
  47779. }
  47780. }
  47781. }, {
  47782. key: "sample",
  47783. value: function(e, t, n) {
  47784. if (e) {
  47785. var i = new THREE.Vector3;
  47786. if ((t = t || viewer.images360.currentPano) != this.currentPano) {
  47787. if (!t.depthTex)
  47788. return;
  47789. this.changeImg(t.depthTex.image),
  47790. this.currentPano = t
  47791. }
  47792. var r, a = t.position, o = e.dir || (new THREE.Vector3).subVectors(e.point, a).normalize(), s = o.clone().applyMatrix4(t.panoMatrix2Inverse).normalize(), l = Up.getUVfromDir(s);
  47793. if (u = this.getDepth(l.x, l.y))
  47794. return i.copy(o).multiplyScalar(u).add(a),
  47795. n || (e = this.getNearbyPoint(a, l, -1, 0),
  47796. s = this.getNearbyPoint(a, l, 1, 0),
  47797. n = this.getNearbyPoint(a, l, 0, -1),
  47798. r = this.getNearbyPoint(a, l, 0, 1),
  47799. r = this.planeFit(o, i, e, s, n, r)),
  47800. {
  47801. location: i,
  47802. normal: r,
  47803. distance: u
  47804. };
  47805. if (.75 < l.y) {
  47806. var u = (t.floorPosition.z - a.z - .1) / o.z;
  47807. return i.copy(o).multiplyScalar(u).add(a),
  47808. {
  47809. location: i,
  47810. normal: new THREE.Vector3(0,0,1),
  47811. distance: u
  47812. }
  47813. }
  47814. return !1
  47815. }
  47816. }
  47817. }, {
  47818. key: "getNearbyPoint",
  47819. value: function(e, t, n, i) {
  47820. t = t.clone();
  47821. t.x += n / (this.canvas.width - 1),
  47822. t.x = this.clampUV(t.x),
  47823. t.y += i / (this.canvas.height - 1),
  47824. t.y = this.clampUV(t.y);
  47825. i = Up.getDirFromUV(t);
  47826. i.applyMatrix4(viewer.images360.currentPano.panoMatrix2);
  47827. t = this.getDepth(t.x, t.y);
  47828. return (new THREE.Vector3).copy(i).multiplyScalar(t).add(e)
  47829. }
  47830. }, {
  47831. key: "clampUV",
  47832. value: function(e) {
  47833. return (e + 1) % 1
  47834. }
  47835. }, {
  47836. key: "planeFit",
  47837. value: function(n, i, e, t, r, a) {
  47838. var o = new THREE.Vector3
  47839. , s = new THREE.Plane;
  47840. function l(e, t) {
  47841. e && t && (s.setFromCoplanarPoints(i, e, t),
  47842. o.addScaledVector(s.normal, n.dot(s.normal) < 0 ? 1 : -1))
  47843. }
  47844. if (l(e, r),
  47845. l(e, a),
  47846. l(t, r),
  47847. l(t, a),
  47848. 0 !== o.x || 0 !== o.y || 0 !== o.z)
  47849. return o.normalize(),
  47850. o
  47851. }
  47852. }]),
  47853. t
  47854. }(), sy = ((new Sn).setFromAxisAngle(new Cn(0,0,1), Math.PI / 2),
  47855. new sh,
  47856. new _c,
  47857. new $i({
  47858. side: J
  47859. }),
  47860. []), ly = function() {
  47861. y(c, hn);
  47862. var u = w(c);
  47863. function c(a) {
  47864. var o;
  47865. O(this, c),
  47866. (o = u.call(this)).viewer = a,
  47867. o.selectingEnabled = !0,
  47868. o.panos = [],
  47869. o.neighbourMap = {},
  47870. o.node = new Si,
  47871. o.node.name = "ImagesNode",
  47872. o.cubePanos = [],
  47873. o.cube = new Hr(new Wr(1,1,1,1),new Ug),
  47874. a.updateVisible(o.cube, "showSkybox", !1),
  47875. o.cube.layers.set(Potree.config.renderLayers.skybox),
  47876. o.cube.name = "skyboxCube",
  47877. a.scene.scene.add(o.cube),
  47878. o._visible = !0,
  47879. o.currentPano = null,
  47880. o.mouseLastMoveTime = Date.now(),
  47881. o.scrollZoomSpeed = .06,
  47882. o.zoomLevel = 1,
  47883. o.tileDownloader = new b0,
  47884. o.qualityManager = new Kg,
  47885. o.panoRenderer = new ty(a,o.tileDownloader,o.qualityManager),
  47886. o.basePanoSize = o.qualityManager.getPanoSize(cm.BASE),
  47887. o.standardPanoSize = o.qualityManager.getPanoSize(cm.STANDARD),
  47888. o.highPanoSize = o.qualityManager.getPanoSize(cm.HIGH),
  47889. o.ultraHighPanoSize = o.qualityManager.getPanoSize(cm.ULTRAHIGH),
  47890. o.tileDownloader.processPriorityQueue = !1,
  47891. o.tileDownloader.tilePrioritizer = new u0(o.qualityManager,o.basePanoSize,o.standardPanoSize,o.highPanoSize,o.ultraHighPanoSize),
  47892. o.flying_ = !1,
  47893. o.addHighMapCube(),
  47894. a.addEventListener(gm.Enter, function(e) {
  47895. o.setHighMap(e.newPano)
  47896. }),
  47897. a.addEventListener("panoSetZoom", function(e) {
  47898. "showPanos" == Potree.settings.displayMode && (e.zoomed ? o.showHighMap() : o.hideHighMap())
  47899. }),
  47900. o.depthSampler = new oy,
  47901. o.addEventListener("loadedDepthImg", function(e) {
  47902. e.loaded && o.updateDepthTex(e.pano)
  47903. });
  47904. a.fpControls.addEventListener("dollyStopCauseUnable", function(e) {
  47905. var t;
  47906. Potree.settings.zoom.enabled && (null != e.scale ? o.zoomBy(e.scale, e.pointer) : (t = 0 < e.delta ? 1 + o.scrollZoomSpeed : 1 - o.scrollZoomSpeed,
  47907. 0 != e.delta && o.zoomBy(t)))
  47908. });
  47909. var n, e;
  47910. a.addEventListener("global_click", function(e) {
  47911. if (!(e.clickElement || Potree.settings.unableNavigate || o.flying || !e.isTouch && e.button != C.LEFT || e.drag && e.drag.object || "pano" == Potree.settings.editType && "mainView" != a.modules.PanoEditor.activeViewName || "merge" == Potree.settings.editType && !e.intersectPoint || a.inputHandler.hoveredElements[0] && a.inputHandler.hoveredElements[0].isModel && e.intersectPoint.distance > a.inputHandler.hoveredElements[0].distance)) {
  47912. if ("pano" != Potree.settings.editType && "merge" != Potree.settings.editType) {
  47913. if (e.hoverViewport == a.mapViewer.viewports[0])
  47914. return a.mapViewer.dispatchEvent(e);
  47915. if (e.hoverViewport != a.mainViewport)
  47916. return
  47917. }
  47918. Potree.settings.dblToFocusPoint || o.flyToPanoClosestToMouse()
  47919. }
  47920. }),
  47921. a.addEventListener("global_mousemove", function(e) {
  47922. !Potree.settings.unableNavigate && Potree.settings.ifShowMarker && e.hoverViewport == a.mainViewport && o.updateClosestPano(e.intersect/* Point */)
  47923. }),
  47924. o.addEventListener("markerHover", function(e) {
  47925. o.updateClosestPano(e.pano, e.hovered)
  47926. }),
  47927. Potree.settings.isOfficial || (o.domRoot = a.renderer.domElement.parentElement,
  47928. (e = $("<input type='button' value='unfocus'></input>")).css({
  47929. position: "absolute",
  47930. right: "25%",
  47931. bottom: "20px",
  47932. zIndex: "10000",
  47933. fontSize: "1em",
  47934. color: "black",
  47935. display: "none",
  47936. background: "rgba(255,255,255,0.8)"
  47937. }),
  47938. e.on("click", function() {
  47939. return o.unfocus()
  47940. }),
  47941. o.elUnfocus = e,
  47942. o.domRoot.appendChild(e[0]),
  47943. "merge" != Potree.settings.editType && ((n = $("<input type='button' value='隐藏点云'></input>")).css({
  47944. position: "absolute",
  47945. right: "40%",
  47946. bottom: "20px",
  47947. zIndex: "10000",
  47948. fontSize: "1em",
  47949. color: "black",
  47950. width: "100px",
  47951. background: "rgba(255,255,255,0.8)"
  47952. }),
  47953. o.domRoot.appendChild(n[0]),
  47954. n.on("click", function(e) {
  47955. var t = a.getObjVisiByReason(a.scene.pointclouds[0], "force");
  47956. a.scene.pointclouds.forEach(function(e) {
  47957. a.updateVisible(e, "force", !t)
  47958. }),
  47959. n.val(t ? "显示点云" : "隐藏点云")
  47960. })),
  47961. (e = $("<input type='button' value='>>全景'></input>")).css({
  47962. position: "absolute",
  47963. right: "65%",
  47964. bottom: "20px",
  47965. zIndex: "10000",
  47966. fontSize: "1em",
  47967. color: "black",
  47968. width: "100px",
  47969. background: "rgba(255,255,255,0.8)"
  47970. }),
  47971. o.domRoot.appendChild(e[0]),
  47972. e.on("click", function(e) {
  47973. "showPointCloud" == Potree.settings.displayMode && 0 == o.panos.length || (Potree.settings.displayMode = "showPointCloud" == Potree.settings.displayMode ? "showPanos" : "showPointCloud")
  47974. }),
  47975. o.elDisplayModel = e);
  47976. var s = ""
  47977. , l = "";
  47978. Object.defineProperty(Potree.settings, "displayMode", {
  47979. get: function() {
  47980. return s
  47981. },
  47982. set: function(t) {
  47983. if (l = t,
  47984. console.warn("Request setMode: " + t),
  47985. t != s) {
  47986. var n, e = Potree.config.displayMode[t], i = a.scene.getActiveCamera();
  47987. if ("showPanos" == t && a.mainViewport.view.isFlying())
  47988. a.mainViewport.view.addEventListener("flyingDone", function e() {
  47989. l == t && (Potree.settings.displayMode = t),
  47990. a.mainViewport.view.removeEventListener("flyingDone", e)
  47991. });
  47992. else {
  47993. if (o.isAtPano())
  47994. n = o.flying ? e.transition : e.atPano;
  47995. else if (n = e.atPano,
  47996. "showPanos" == t) {
  47997. if (0 == o.panos.length)
  47998. return;
  47999. var r = function e() {
  48000. o.removeEventListener("flyToPanoDone", e),
  48001. l == t && (Potree.settings.displayMode = t)
  48002. };
  48003. return o.flyToPano({
  48004. pano: o.findNearestPano()
  48005. }),
  48006. void o.addEventListener("flyToPanoDone", r)
  48007. }
  48008. if (n.showSkybox || n.showPoint && n.pointUsePanoTex ? o.tileDownloader.start() : o.tileDownloader.stop(),
  48009. n.showSkybox || n.pointUsePanoTex) {
  48010. r = function e() {
  48011. setTimeout(function() {
  48012. l == t && (Potree.settings.displayMode = t)
  48013. }, 1),
  48014. o.removeEventListener("loadedDepthImg", e)
  48015. }
  48016. ;
  48017. if (!o.currentPano.depthTex && o.currentPano.pointcloud.hasDepthTex)
  48018. return o.addEventListener("loadedDepthImg", r),
  48019. o.currentPano.loadDepthImg();
  48020. if (o.checkAndWaitForPanoLoad(o.currentPano, o.basePanoSize, r))
  48021. return
  48022. }
  48023. a.scene.pointclouds.forEach(function(e) {
  48024. a.updateVisible(e, "displayMode", n.showPoint, 2)
  48025. }),
  48026. n.pointUsePanoTex ? a.scene.pointclouds.forEach(function(e) {
  48027. e.material.setProjectedPanos(o.currentPano, o.currentPano, 1)
  48028. }) : a.scene.pointclouds.forEach(function(e) {
  48029. e.material.stopProjectedPanos()
  48030. }),
  48031. a.updateVisible(o.cube, "showSkybox", n.showSkybox),
  48032. o.cube.visible ? o.setProjectedPanos({
  48033. progress: 1,
  48034. ifSkybox: !0,
  48035. ifPointcloud: !1,
  48036. easeInOutRatio: 0,
  48037. pano0: o.currentPano,
  48038. pano1: o.currentPano
  48039. }) : (o.smoothZoomTo(1),
  48040. o.resetHighMap(),
  48041. o.hideHighMap()),
  48042. "showPanos" == (s = t) ? (i.far = a.farWhenShowPano,
  48043. Potree.settings.pointDensity = "panorama",
  48044. Potree.config.displayMode.showPanos.transition.pointUsePanoTex && a.scene.pointclouds.forEach(function(e) {
  48045. e.material.pointSizeType = "FIXED"
  48046. }),
  48047. o.updateCube(o.currentPano)) : (i.limitFar && (i.far = Potree.settings.cameraFar),
  48048. Potree.settings.pointDensity = Potree.settings.UserPointDensity,
  48049. Potree.config.displayMode.showPanos.transition.pointUsePanoTex && a.scene.pointclouds.forEach(function(e) {
  48050. e.material.pointSizeType = Potree.config.material.pointSizeType
  48051. })),
  48052. i.updateProjectionMatrix(),
  48053. o.elDisplayModel && o.elDisplayModel.val("showPointCloud" == t ? ">>全景" : ">>点云"),
  48054. o.dispatchEvent({
  48055. type: "endChangeMode",
  48056. mode: t
  48057. }),
  48058. console.log("setModeSuccess: " + t)
  48059. }
  48060. }
  48061. }
  48062. }),
  48063. Potree.settings.displayMode = "showPointCloud";
  48064. var t = null;
  48065. Object.defineProperty(g(o), "currentPano", {
  48066. get: function() {
  48067. return t
  48068. },
  48069. set: function(e) {
  48070. e != t && (t && t.exit(),
  48071. e && e.enter(),
  48072. t = e)
  48073. }
  48074. });
  48075. var i = !0;
  48076. Object.defineProperty(Potree.settings, "ifShowMarker", {
  48077. get: function() {
  48078. return i
  48079. },
  48080. set: function(t) {
  48081. (t = !!t) != i && (o.panos.forEach(function(e) {
  48082. a.updateVisible(e, "ifShowMarker", t, 1)
  48083. }),
  48084. i = t)
  48085. }
  48086. }),
  48087. a.addEventListener("update", function() {
  48088. o.update(a)
  48089. });
  48090. var r = {
  48091. FORWARD: ["W".charCodeAt(0), 38],
  48092. BACKWARD: ["S".charCodeAt(0), 40],
  48093. LEFT: ["A".charCodeAt(0), 37],
  48094. RIGHT: ["D".charCodeAt(0), 39]
  48095. };
  48096. return a.inputHandler.addEventListener("keydown", function(t) {
  48097. if ("showPanos" == Potree.settings.displayMode)
  48098. for (var e in r)
  48099. if (r[e].some(function(e) {
  48100. return e == t.keyCode
  48101. })) {
  48102. switch (e) {
  48103. case "FORWARD":
  48104. o.flyLocalDirection(pm.FORWARD.clone());
  48105. break;
  48106. case "BACKWARD":
  48107. o.flyLocalDirection(pm.BACK.clone());
  48108. break;
  48109. case "LEFT":
  48110. o.flyLocalDirection(pm.LEFT.clone());
  48111. break;
  48112. case "RIGHT":
  48113. o.flyLocalDirection(pm.RIGHT.clone())
  48114. }
  48115. break
  48116. }
  48117. }),
  48118. o
  48119. }
  48120. return h(c, [{
  48121. key: "updateDepthTex",
  48122. value: function(e) {
  48123. this.currentPano == e && e.depthTex && this.cube.material.updateDepthTex(e)
  48124. }
  48125. }, {
  48126. key: "findNearestPano",
  48127. value: function(t) {
  48128. t = t ? (new Cn).copy(t) : this.position;
  48129. var e = Fm.sortByScore(this.panos, [c.filters.isEnabled()], [function(e) {
  48130. return -e.position.distanceTo(t)
  48131. }
  48132. ]);
  48133. return e && e[0] && e[0].item
  48134. }
  48135. }, {
  48136. key: "flyLocalDirection",
  48137. value: function(e) {
  48138. var t = this.getDirection(e)
  48139. , n = 1 === e.y ? .4 : .75
  48140. , e = 1 === Math.abs(e.x);
  48141. return this.flyDirection(t, n, e)
  48142. }
  48143. }, {
  48144. key: "getDirection",
  48145. value: function(e) {
  48146. return e ? (e = e || (new Cn).copy(pm.FORWARD)).applyQuaternion(viewer.scene.getActiveCamera().quaternion) : viewer.scene.view.direction
  48147. }
  48148. }, {
  48149. key: "position",
  48150. get: function() {
  48151. return this.viewer.scene.view.position.clone()
  48152. }
  48153. }, {
  48154. key: "visible",
  48155. get: function() {
  48156. return this._visible
  48157. },
  48158. set: function(e) {
  48159. this._visible !== e && (this._visible = e,
  48160. this.dispatchEvent({
  48161. type: "visibility_changed",
  48162. panos: this
  48163. }))
  48164. }
  48165. }, {
  48166. key: "isAtPano",
  48167. value: function() {
  48168. return this.currentPano && viewer.scene.view.position.equals(this.currentPano.position)
  48169. }
  48170. }, {
  48171. key: "updateProjectedPanos",
  48172. value: function() {
  48173. this.projectedPano0 && this.projectedPano1 && this.setProjectedPanos({
  48174. pano0: this.projectedPano0,
  48175. pano1: this.projectedPano1
  48176. })
  48177. }
  48178. }, {
  48179. key: "setProjectedPanos",
  48180. value: function() {
  48181. var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  48182. this.cube.material.setProjectedPanos(t.pano0, t.pano1, t.progress),
  48183. t.ifPointcloud && viewer.scene.pointclouds.forEach(function(e) {
  48184. e.material.setProjectedPanos(t.pano0, t.pano1, t.progress, t.easeInOutRatio)
  48185. }),
  48186. this.projectedPano0 = t.pano0,
  48187. this.projectedPano1 = t.pano1
  48188. }
  48189. }, {
  48190. key: "cancelFlyToPano",
  48191. value: function() {
  48192. viewer.mainViewport.view.isFlying() || (this.nextPano = null,
  48193. this.latestToPano = null)
  48194. }
  48195. }, {
  48196. key: "flyToPano",
  48197. value: function(n) {
  48198. var i = this;
  48199. if (n && (n = n instanceof Qg ? {
  48200. pano: n
  48201. } : n).pano.enabled) {
  48202. var e = function(e, t) {
  48203. e || t ? (n.callback && n.callback(e),
  48204. i.cancelFlyToPano(),
  48205. i.updateClosestPano(i.closestPano, !1)) : console.log("makeit fail"),
  48206. i.dispatchEvent({
  48207. type: "flyToPanoDone",
  48208. makeIt: e
  48209. }),
  48210. n.deferred && n.deferred.resolve(e)
  48211. };
  48212. if (this.currentPano == n.pano && this.isAtPano() && !n.target && !n.quaternion)
  48213. return this.dispatchEvent({
  48214. type: "flyToPano",
  48215. toPano: n
  48216. }),
  48217. e(!0);
  48218. if (this.latestToPano && this.latestToPano != n)
  48219. return e(!1);
  48220. var t = n.target
  48221. , r = n.easeName || "easeInOutQuad"
  48222. , a = Potree.config.displayMode[Potree.settings.displayMode]
  48223. , o = a.atPano.showPoint
  48224. , s = n.pano
  48225. , l = Potree.config.transitionsTime
  48226. , u = this.isAtPano() ? l.panoToPanoMax : l.flyIn
  48227. , c = null == n.duration ? l.flyMinTime + Math.min(l.flytimeDistanceMultiplier * this.position.distanceTo(s.position), u) : n.duration;
  48228. n.duration = c,
  48229. this.nextPano = s,
  48230. this.latestToPano = n;
  48231. var d, u = function e() {
  48232. i.latestToPano == n && (setTimeout(function() {
  48233. i.latestToPano == n && i.flyToPano(n)
  48234. }, 1),
  48235. i.removeEventListener("loadedDepthImg", e))
  48236. };
  48237. if (!s.depthTex && s.pointcloud.hasDepthTex)
  48238. return this.addEventListener("loadedDepthImg", u),
  48239. s.loadDepthImg();
  48240. (a.atPano.showSkybox || a.atPano.pointUsePanoTex) && (this.updateCube(this.currentPano, n.pano),
  48241. this.checkAndWaitForPanoLoad(s, n.basePanoSize || this.basePanoSize, u)) || (viewer.updateVisible(this.cube, "showSkybox", a.atPano.showSkybox),
  48242. a.transition.showPoint && viewer.scene.pointclouds.forEach(function(e) {
  48243. viewer.updateVisible(e, "displayMode", !0)
  48244. }),
  48245. (a.transition.showSkybox || a.transition.pointUsePanoTex) && this.setProjectedPanos({
  48246. progress: 0,
  48247. ifSkybox: this.cube.visible,
  48248. ifPointcloud: a.transition.pointUsePanoTex,
  48249. easeInOutRatio: o ? .3 : 0,
  48250. pano0: this.currentPano,
  48251. pano1: s
  48252. }),
  48253. d = s.position.clone(),
  48254. n.duration = c,
  48255. n.easeName = r,
  48256. this.beforeFlyToPano(n),
  48257. u = function() {
  48258. i.dispatchEvent({
  48259. type: "flyToPano",
  48260. toPano: n
  48261. }),
  48262. viewer.scene.view.setView({
  48263. position: d,
  48264. target: t,
  48265. quaternion: n.quaternion,
  48266. duration: c,
  48267. callback: function() {
  48268. a.atPano.pointUsePanoTex || viewer.scene.pointclouds.forEach(function(e) {
  48269. e.material.stopProjectedPanos()
  48270. }),
  48271. i.currentPano = s,
  48272. i.nextPano = null,
  48273. "showPanos" == Potree.settings.displayMode && viewer.scene.pointclouds.forEach(function(e) {
  48274. viewer.updateVisible(e, "displayMode", o)
  48275. }),
  48276. e(!0),
  48277. i.updateDepthTex(i.currentPano)
  48278. },
  48279. onUpdate: function(t) {
  48280. i.cube.material.uniforms.progress.value = t,
  48281. viewer.scene.pointclouds.forEach(function(e) {
  48282. e.material.uniforms.progress.value = t
  48283. })
  48284. },
  48285. cancelFun: function() {
  48286. e(!1, !0)
  48287. },
  48288. Easing: r
  48289. })
  48290. }
  48291. ,
  48292. "showPanos" == Potree.settings.displayMode ? setTimeout(u, 40) : u())
  48293. }
  48294. }
  48295. }, {
  48296. key: "beforeFlyToPano",
  48297. value: function(e) {
  48298. this.currentPano != e.pano && ("showPanos" == Potree.settings.displayMode && this.resetHighMap(),
  48299. this.smoothZoomTo(1, e.duration / 2))
  48300. }
  48301. }, {
  48302. key: "updateCube",
  48303. value: function(e, t) {
  48304. var n, i, r = this;
  48305. if(Potree.settings.displayMode != 'showPanos')return//add
  48306. if (!viewer.scene.pointclouds.some(function(e) {
  48307. return !e.hasDepthTex
  48308. }))
  48309. return this.updateCube2(e, t);
  48310. "showPanos" == Potree.settings.displayMode && (n = function(e, t) {
  48311. t = t || e.getSize(new Cn);
  48312. e = e.getCenter(new Cn);
  48313. t.max(new Cn(1,1,1)),
  48314. r.cube.scale.copy(t),
  48315. r.cube.position.copy(e)
  48316. }
  48317. ,
  48318. !t || e.pointcloud == t.pointcloud ? n(e.pointcloud.bound) : (i = e.pointcloud.bound.clone().union(t.pointcloud.bound),
  48319. function(e, t) {
  48320. if (e.intersectsBox(t))
  48321. return 0;
  48322. var n = e.getCenter(new Cn)
  48323. , i = t.getCenter(new Cn)
  48324. , r = n.distanceTo(i);
  48325. return e.distanceToPoint(i) + t.distanceToPoint(n) - r
  48326. }(e.pointcloud.bound, t.pointcloud.bound) < 100 ? n(i) : (e = i.getSize(new Cn),
  48327. t = Math.max(e.x, e.y, e.z),
  48328. e.set(t, t, t),
  48329. n(i, e))))
  48330. }
  48331. }, {
  48332. key: "updateCube3",
  48333. value: function(e, t) {
  48334. var h, p, f, m, v, g, y, n, i, a, o, s, l, u, c, d, w, b, r, x = this;
  48335. "showPanos" != Potree.settings.displayMode || e == t || this.cubePanos.includes(e) && this.cubePanos.includes(t) || (this.cubePanos = [e, t],
  48336. this.cube.geometry.dispose(),
  48337. t ? (h = 2 * (e.pointcloud.hasDepthTex && e.pointcloud.hasDepthTex ? A.isMobile() ? 3 : 6 : A.isMobile() ? 2 : 3),
  48338. p = 0,
  48339. f = function(e, t, n) {
  48340. return e && e.pointcloud.hasDepthTex ? x.depthSampler.sample({
  48341. dir: t
  48342. }, e, !0) : (n = n || e.position,
  48343. viewer.inputHandler.getIntersect(viewer.inputHandler.hoverViewport, !0, null, null, !0, {
  48344. point: n.clone().add(t),
  48345. cameraPos: n
  48346. }))
  48347. }
  48348. ,
  48349. m = function(e, t) {
  48350. e = (new ni).makeRotationZ(e);
  48351. return t.clone().applyMatrix4(e)
  48352. }
  48353. ,
  48354. v = function(i, r, a) {
  48355. var e = [i.clone().setZ(Math.tan(gn.degToRad(30))).normalize(), i.clone().setZ(Math.tan(gn.degToRad(7))).normalize(), i.clone(), i.clone().setZ(-Math.tan(gn.degToRad(5))).normalize()]
  48356. , t = e.length
  48357. , e = e.map(function(e, t) {
  48358. var n = f(r, e, a);
  48359. return n && n.distance ? e.dot(i) * n.distance : 50
  48360. });
  48361. return e.sort(function(e, t) {
  48362. return t - e
  48363. }),
  48364. e[Math.floor(t / 2 - .5)]
  48365. }
  48366. ,
  48367. r = function(i, e) {
  48368. function r(e, t) {
  48369. return (2 * h + 2) * (t = null == t ? p : t) + e + 2
  48370. }
  48371. var t, a, o = i.floorPosition.z;
  48372. null != i.ceilZ ? a = i.ceilZ : (d = (new ni).makeRotationX(gn.degToRad(40)),
  48373. t = new Cn(0,0,1).applyMatrix4(d),
  48374. c = (new ni).makeRotationZ(2 * Math.PI / 3),
  48375. d = (new ni).makeRotationZ(2 * -Math.PI / 3),
  48376. c = t.clone().applyMatrix4(c),
  48377. d = t.clone().applyMatrix4(d),
  48378. (c = [t, c, d].map(function(e) {
  48379. e = f(i, e);
  48380. return e ? e.location.z : i.position.z + 50
  48381. })).sort(function(e, t) {
  48382. return t - e
  48383. }),
  48384. a = c[0],
  48385. d = i.position.z + 1,
  48386. a = Math.max(d, a),
  48387. i.ceilZ = a),
  48388. [a, o].forEach(function(e) {
  48389. g.push(i.position.clone().setZ(e))
  48390. });
  48391. for (var n = Math.PI / (h - 1), s = [], l = 0; l < h; l++)
  48392. s.push(m(Math.PI / 2 - l * n, e));
  48393. var u = [];
  48394. s.forEach(function(t, e) {
  48395. var n = v(t, i);
  48396. 0 != e && e != h - 1 || u.push(n),
  48397. t.multiplyScalar(n),
  48398. [a, o].forEach(function(e) {
  48399. g.push(i.position.clone().setZ(e).add(t))
  48400. }),
  48401. 0 != e && (y.push([r(e = 2 * e), r(e - 1), r(e - 2)], [r(e), r(1 + e), r(e - 1)]),
  48402. y.push([r(e), r(e - 2), r(-2)]),
  48403. y.push([r(-1), r(e - 1), r(1 + e)]))
  48404. });
  48405. var c = (p + 1) % 2
  48406. , d = 4 * h + 4;
  48407. return y.push([r(0), r(1), d + 2 * p], [d + 2 * p, r(1), d + 2 * p + 1], [r(2 * h - 2), d + 2 * c + 1, r(2 * h - 1)], [r(2 * h - 2), d + 2 * c, d + 2 * c + 1]),
  48408. y.push([r(0), d + 2 * c, r(2 * h - 2)], [r(0), d + 2 * p, d + 2 * c]),
  48409. y.push([r(2 * h - 1), d + 2 * c + 1, r(1)], [d + 2 * c + 1, d + 2 * p + 1, r(1)]),
  48410. p++,
  48411. u
  48412. }
  48413. ,
  48414. g = [],
  48415. y = [],
  48416. n = (new Cn).subVectors(e.position, t.position).setZ(0).normalize(),
  48417. i = r(e, n),
  48418. r = r(t, n.negate()),
  48419. c = (e.ceilZ + t.ceilZ) / 2,
  48420. d = (e.floorPosition.z + t.floorPosition.z) / 2,
  48421. i[0],
  48422. r[1],
  48423. i[1],
  48424. r[0],
  48425. w = [Math.min(i[0], r[1]), Math.min(i[1], r[0])],
  48426. b = (new Cn).addVectors(e.position, t.position).multiplyScalar(.5),
  48427. r = [m(-Math.PI / 2, n), m(Math.PI / 2, n)],
  48428. e.pointcloud.hasDepthTex && e.pointcloud.hasDepthTex ? (a = [e, t],
  48429. o = [n.negate(), n],
  48430. s = [[-1, 1], [1, -1]],
  48431. l = (new yn).subVectors(e.position, t.position).length(),
  48432. u = [gn.degToRad(45), gn.degToRad(60)],
  48433. r.forEach(function(t, i) {
  48434. var e, r = [];
  48435. a.forEach(function(n, e) {
  48436. [m(s[i][e] * u[0], o[e]), m(s[i][e] * u[1], o[e])].forEach(function(e, t) {
  48437. e = v(e, n);
  48438. e * Math.cos(u[t]) < l && (t = e * Math.sin(u[t]),
  48439. r.push(t))
  48440. })
  48441. }),
  48442. r.length ? (r.sort(function(e, t) {
  48443. return t - e
  48444. }),
  48445. e = r[0],
  48446. console.log("disToSides", i, r)) : e = w[i],
  48447. t.multiplyScalar(e),
  48448. [c, d].forEach(function(e) {
  48449. g.push(b.clone().setZ(e).add(t))
  48450. })
  48451. })) : r.forEach(function(t, e) {
  48452. var n = v(t, null, b);
  48453. t.multiplyScalar(Math.max(n, w[e])),
  48454. [c, d].forEach(function(e) {
  48455. g.push(b.clone().setZ(e).add(t))
  48456. })
  48457. }),
  48458. r = Cf.createGeometry(g, y),
  48459. this.cube.geometry = r,
  48460. this.cube.scale.set(1, 1, 1),
  48461. this.cube.position.set(0, 0, 0)) : (this.cube.geometry = new Wr(1,1,1,1),
  48462. function(e, t) {
  48463. t = t || e.getSize(new Cn);
  48464. e = e.getCenter(new Cn);
  48465. t.max(new Cn(1,1,1)),
  48466. x.cube.scale.copy(t),
  48467. x.cube.position.copy(e)
  48468. }(e.pointcloud.bound)))
  48469. }
  48470. }, {
  48471. key: "updateCube2",
  48472. value: function(n, i) {
  48473. var r = this;
  48474. if (!("showPanos" != Potree.settings.displayMode || n == i || this.cubePanos.includes(n) && this.cubePanos.includes(i))) {
  48475. this.cubePanos = [n, i];
  48476. var s, l, u, c, a, o, d, e = function(e, t) {
  48477. t = t || e.getSize(new Cn);
  48478. e = e.getCenter(new Cn);
  48479. t.max(new Cn(1,1,1)),
  48480. r.cube.geometry = new Wr(1,1,1,1),
  48481. r.cube.scale.copy(t),
  48482. r.cube.position.copy(e)
  48483. };
  48484. //add----------
  48485. let getPanoBound = (pano)=>{//因漫游点可能在点云外部,如室外平地,所以需要union进漫游点
  48486. let panoBound = new THREE.Box3;
  48487. panoBound.expandByPoint(pano.position);
  48488. panoBound.expandByVector(new Cn(10,10,10));//give pano a margin
  48489. return pano.pointcloud.bound.clone().union(panoBound)
  48490. };
  48491. //-------------
  48492. if (this.cube.geometry.dispose(),
  48493. i) {
  48494. if (n.pointcloud != i.pointcloud)
  48495. if (100 < n.position.distanceTo(i.position)) {
  48496. //var t = n.pointcloud.bound.clone().union(i.pointcloud.bound)
  48497. var t = getPanoBound(n).union(getPanoBound(i))
  48498. , h = t.getSize(new Cn)
  48499. , p = Math.max(h.x, h.y, h.z);
  48500. return h.set(p, p, p),
  48501. e(t, h)
  48502. }
  48503. var f = 2 * (n.pointcloud.hasDepthTex && n.pointcloud.hasDepthTex ? 6 : A.isMobile() ? 2 : 3)
  48504. , m = function(e, t, n) {
  48505. return e && e.pointcloud.hasDepthTex ? r.depthSampler.sample({
  48506. dir: t
  48507. }, e, !0) : (n = n || e.position,
  48508. viewer.inputHandler.getIntersect(viewer.inputHandler.hoverViewport, !0, null, null, !0, {
  48509. point: n.clone().add(t),
  48510. cameraPos: n
  48511. }))
  48512. }
  48513. , v = function(e, t) {
  48514. e = (new ni).makeRotationZ(e);
  48515. return t.clone().applyMatrix4(e)
  48516. }
  48517. , g = function(i, r, a) {
  48518. var e = [i.clone().setZ(Math.tan(gn.degToRad(30))).normalize(), i.clone().setZ(Math.tan(gn.degToRad(7))).normalize(), i.clone(), i.clone().setZ(-Math.tan(gn.degToRad(5))).normalize()]
  48519. , t = e.length
  48520. , e = e.map(function(e, t) {
  48521. var n = m(r, e, a);
  48522. return n && n.distance ? e.dot(i) * n.distance : 50
  48523. });
  48524. return e.sort(function(e, t) {
  48525. return t - e
  48526. }),
  48527. e[Math.floor(t / 2 - .5)]
  48528. }
  48529. , y = []
  48530. , t = function(i, e) {
  48531. var t, n, r, a, o = i.floorPosition.z;
  48532. null != i.ceilZ ? r = i.ceilZ : (a = (new ni).makeRotationX(gn.degToRad(40)),
  48533. t = new Cn(0,0,1).applyMatrix4(a),
  48534. n = (new ni).makeRotationZ(2 * Math.PI / 3),
  48535. a = (new ni).makeRotationZ(2 * -Math.PI / 3),
  48536. n = t.clone().applyMatrix4(n),
  48537. a = t.clone().applyMatrix4(a),
  48538. (a = [t, n, a].map(function(e) {
  48539. e = m(i, e);
  48540. return e ? e.location.z : i.position.z + 50
  48541. })).sort(function(e, t) {
  48542. return t - e
  48543. }),
  48544. r = a[0],
  48545. a = i.position.z + 1,
  48546. r = Math.max(a, r),
  48547. i.ceilZ = r),
  48548. [r, o].forEach(function(e) {
  48549. w.push(i.position.clone().setZ(e))
  48550. });
  48551. for (var s = Math.PI / (f - 1), l = [], u = 0; u < f; u++)
  48552. l.push(v(Math.PI / 2 - u * s, e));
  48553. l.forEach(function(t, e) {
  48554. var n = g(t, i);
  48555. t.multiplyScalar(n),
  48556. [r, o].forEach(function(e) {
  48557. w.push(i.position.clone().setZ(e).add(t))
  48558. })
  48559. })
  48560. }
  48561. , w = []
  48562. , b = []
  48563. , h = (new Cn).subVectors(n.position, i.position).setZ(0).normalize();
  48564. t(n, h),
  48565. t(i, h.clone().negate()),
  48566. a = (n.ceilZ + i.ceilZ) / 2,
  48567. o = (n.floorPosition.z + i.floorPosition.z) / 2,
  48568. d = (new Cn).addVectors(n.position, i.position).multiplyScalar(.5),
  48569. n.pointcloud.hasDepthTex && n.pointcloud.hasDepthTex ? (s = [n, i],
  48570. l = [h.clone().negate(), h],
  48571. u = (new yn).subVectors(n.position, i.position).length(),
  48572. c = [gn.degToRad(40), gn.degToRad(70)],
  48573. [[-1, 1], [1, -1]].forEach(function(t, e) {
  48574. var a = []
  48575. , o = 0 == e ? n : i;
  48576. s.forEach(function(r, e) {
  48577. [v(t[e] * c[0], l[e]), v(t[e] * c[1], l[e])].forEach(function(e, t) {
  48578. var n = g(e, r)
  48579. , i = n * Math.cos(c[t]);
  48580. i < u && (t = n * Math.sin(c[t]),
  48581. r != o && (i = u - i),
  48582. e.multiplyScalar(n),
  48583. a.push({
  48584. disToSide: t,
  48585. disToPano2d: i,
  48586. pano: r,
  48587. dir_: e
  48588. }))
  48589. })
  48590. }),
  48591. y[e] = a.length,
  48592. a.length && (a.sort(function(e, t) {
  48593. return e.disToPano2d - t.disToPano2d
  48594. }),
  48595. a.forEach(function(t) {
  48596. var e = t.disToPano2d / u
  48597. , e = o == n ? 1 - e : e;
  48598. [n.ceilZ * e + i.ceilZ * (1 - e), n.floorPosition.z * e + i.floorPosition.z * (1 - e)].forEach(function(e) {
  48599. w.push(t.pano.position.clone().setZ(e).add(t.dir_))
  48600. })
  48601. }))
  48602. })) : (y = [1, 1],
  48603. [v(Math.PI / 2, h), v(-Math.PI / 2, h)].forEach(function(t, e) {
  48604. var n = g(t, null, d);
  48605. t.multiplyScalar(n),
  48606. [a, o].forEach(function(e) {
  48607. w.push(d.clone().setZ(e).add(t))
  48608. })
  48609. })),
  48610. [a, o].forEach(function(e) {
  48611. w.push(d.clone().setZ(e))
  48612. }),
  48613. function() {
  48614. for (var i = function(e, t, n) {
  48615. return 2 + (2 * f + 2) * n + 2 * e + ("top" == t ? 0 : 1)
  48616. }, e = function(e, t, n) {
  48617. return 1 == n && (e += y[0]),
  48618. i(e, t, 2) - 2
  48619. }, t = function(e, t) {
  48620. return i(-1, e, t)
  48621. }, n = w.length - 2, r = w.length - 1, a = 0; a < 2; a++) {
  48622. for (var o = 1; o < f; o++)
  48623. b.push([i(o, "top", a), i(o - 1, "btm", a), i(o - 1, "top", a)], [i(o, "top", a), i(o, "btm", a), i(o - 1, "btm", a)]),
  48624. b.push([i(o, "top", a), i(o - 1, "top", a), t("top", a)]),
  48625. b.push([i(o, "btm", a), i(o - 1, "btm", a), t("btm", a)]);
  48626. for (var s = (a + 1) % 2, l = 0; l <= y[a]; l++) {
  48627. var u = 0 == l ? i(0, "top", a) : e(l - 1, "top", a)
  48628. , c = l == y[a] ? i(f - 1, "top", s) : e(l, "top", a)
  48629. , d = 0 == l ? i(0, "btm", a) : e(l - 1, "btm", a)
  48630. , h = l == y[a] ? i(f - 1, "btm", s) : e(l, "btm", a);
  48631. b.push([u, d, h], [u, h, c]),
  48632. b.push([u, n, c], [d, r, h]),
  48633. 0 == a && (0 == l && b.push([u, i(f - 1, "top", a), n], [d, i(f - 1, "btm", a), r]),
  48634. l == y[a] && b.push([c, i(0, "top", s), n], [h, i(0, "btm", s), r]))
  48635. }
  48636. }
  48637. }();
  48638. h = Cf.createGeometry(w, b);
  48639. this.cube.geometry = h,
  48640. this.cube.scale.set(1, 1, 1),
  48641. this.cube.position.set(0, 0, 0)
  48642. } else
  48643. e(getPanoBound(n))//e(n.pointcloud.bound)
  48644. }
  48645. }
  48646. }, {
  48647. key: "bump",
  48648. value: function(e) {
  48649. var t, n, i = this;
  48650. this.bumping || this.latestToPano || (n = "showPanos" == Potree.settings.displayMode ? .3 : .2,
  48651. t = this.position.clone(),
  48652. n = (new Cn).addVectors(this.position, e.clone().multiplyScalar(n)),
  48653. viewer.scene.view.setView({
  48654. position: n,
  48655. duration: 150,
  48656. callback: function() {
  48657. viewer.scene.view.setView({
  48658. position: t,
  48659. duration: 750,
  48660. callback: function() {
  48661. i.bumping = !1
  48662. },
  48663. Easing: "easeInOutSine",
  48664. cancelFun: function() {
  48665. i.bumping = !1
  48666. }
  48667. }),
  48668. i.bumping = !0
  48669. },
  48670. cancelFun: function() {
  48671. i.bumping = !1
  48672. },
  48673. Easing: "easeInOutSine"
  48674. }),
  48675. this.bumping = !0)
  48676. }
  48677. }, {
  48678. key: "flyToPanoClosestToMouse",
  48679. value: function() {
  48680. if (Potree.settings.ifShowMarker || this.updateClosestPano(viewer.inputHandler.intersectPoint),
  48681. this.closestPano) {
  48682. var e = this.closestPano;
  48683. return this.flyToPano({
  48684. pano: e
  48685. })
  48686. }
  48687. e = this.viewer.inputHandler.getMouseDirection().direction;
  48688. this.flyDirection(e)
  48689. }
  48690. }, {
  48691. key: "flyDirection",
  48692. value: function(e, t, n) {
  48693. var i = $.Deferred()
  48694. , n = this.closestPanoInDirection(e, t, n);
  48695. return n ? this.flyToPano({
  48696. pano: n,
  48697. callback: i.resolve.bind(i, !0)
  48698. }) : (this.bump(e),
  48699. i.resolve(!1)),
  48700. i.promise()
  48701. }
  48702. }, {
  48703. key: "closestPanoInDirection",
  48704. value: function(e, t, n) {
  48705. return this.rankedPanoInDirection(0, e, t, n)
  48706. }
  48707. }, {
  48708. key: "rankedPanoInDirection",
  48709. value: function(e, t, n, i) {
  48710. var r = this
  48711. , a = {
  48712. pano: null,
  48713. candidates: []
  48714. };
  48715. e = e || 0,
  48716. n = void 0 !== n ? n : .75;
  48717. var o, s, i = i ? "angle" : "direction", n = (viewer.modules.SiteModel.currentFloor,
  48718. viewer.modules.SiteModel.inEntity,
  48719. [c.filters.inPanoDirection(this.position, t, n), c.filters.not(this.currentPano), c.filters.isEnabled()]), t = [c.scoreFunctions.distanceSquared(this.position, 1, !0), c.scoreFunctions[i](this.position, t, !0), function(e) {
  48720. return r.isNeighbour(r.currentPano, e) ? 200 : 0
  48721. }
  48722. ];
  48723. return viewer.inputHandler.intersectPoint && this.currentPano && (o = this.currentPano.floorPosition,
  48724. s = (new Cn).subVectors(viewer.inputHandler.intersectPoint.location, o).normalize(),
  48725. t.push(function(e) {
  48726. return 200 * e.floorPosition.clone().sub(o).normalize().dot(s) * 1
  48727. })),
  48728. this.findRankedByScore(e, n, t, a),
  48729. a.pano
  48730. }
  48731. }, {
  48732. key: "findRankedByScore",
  48733. value: function(e, t, n, i) {
  48734. i && (i.candidates = null,
  48735. i.pano = null),
  48736. e = e || 0;
  48737. n = Fm.sortByScore(this.panos, t, n);
  48738. return !n || 0 === n.length || e >= n.length ? null : (i && (i.candidates = n,
  48739. i.pano = n[e].item),
  48740. n[e].item)
  48741. }
  48742. }, {
  48743. key: "isNeighbour",
  48744. value: function(e, t) {
  48745. if (e && t) {
  48746. var n = this.neighbourMap[e.id];
  48747. n || (this.neighbourMap[e.id] = n = {});
  48748. var i = this.neighbourMap[t.id];
  48749. i || (this.neighbourMap[t.id] = i = {});
  48750. var r, a, o, s, l, u = n[t.id];
  48751. return null == u && (u = !0,
  48752. e.depthTex,
  48753. e.depthTex || t.depthTex ? (s = e.depthTex ? e : t,
  48754. a = e.depthTex ? t : e,
  48755. o = (new Cn).subVectors(a.position, s.position).normalize(),
  48756. (l = viewer.images360.depthSampler.sample({
  48757. dir: o
  48758. }, s, !0)) && l.distance + .1 <= e.position.distanceTo(t.position) && (u = !1)) : (u = !viewer.inputHandler.ifBlockedByIntersect(t.position, .1, !0, e.position),
  48759. console.log("使用点云判断"),
  48760. u && (r = (new Cn).subVectors(t.position, e.position).normalize(),
  48761. a = t.position.distanceTo(e.position),
  48762. o = Rg.getHFOVForCamera(viewer.mainViewport.camera, !0),
  48763. s = Math.cos(gn.degToRad(10)),
  48764. l = Math.cos(gn.degToRad(80)),
  48765. this.getDirection().dot(r) < gn.clamp(Math.cos(o / 2) * a / 10, l, s) && (u = void 0))),
  48766. n[t.id] = u,
  48767. i[e.id] = u),
  48768. u
  48769. }
  48770. }
  48771. }, {
  48772. key: "updateClosestPano",
  48773. value: function(e, t) {
  48774. if (e instanceof Qg){
  48775. n = t ? e : null
  48776. }else {
  48777. if(this.isAtPano()){
  48778. return
  48779. }else {
  48780. if(this.flying)return;
  48781. var filterFuncs = [];
  48782. e = e && e.location;
  48783. if(!e)return
  48784. var e = "pano" != Potree.settings.editType ? [c.sortFunctions.floorDisSquaredToPoint(e)] : [c.sortFunctions.disSquaredToPoint(e)]
  48785. , n = Fm.find(this.panos, [], e)
  48786. }
  48787. }
  48788. /* if (this.isAtPano()) {
  48789. if (!(e instanceof Qg))
  48790. return;
  48791. n = t ? e : null
  48792. } else {
  48793. if (this.flying)
  48794. return;
  48795. if (!(e = e && e.location))
  48796. return;
  48797. var e = "pano" != Potree.settings.editType ? [c.sortFunctions.floorDisSquaredToPoint(e)] : [c.sortFunctions.disSquaredToPoint(e)]
  48798. , n = Fm.find(this.panos, [], e)
  48799. } */
  48800. n != this.closestPano ? (n && (this.isPanoHover = !0),
  48801. this.closestPanoChanging(this.closestPano, n),
  48802. this.closestPano = n) : this.isPanoHover = !1
  48803. }
  48804. }, {
  48805. key: "closestPanoChanging",
  48806. value: function(e, t) {
  48807. Potree.settings.ifShowMarker && (e && e.hoverOff({
  48808. byImages360: !0
  48809. }),
  48810. t && t.hoverOn({
  48811. byImages360: !0
  48812. }))
  48813. }
  48814. }, {
  48815. key: "getTileDirection",
  48816. value: function() {
  48817. var n = viewer.scene.view.direction.clone();
  48818. return {
  48819. datasetsLocal: viewer.scene.pointclouds.map(function(e) {
  48820. var t = (new ni).copy(e.rotateMatrix).invert()
  48821. , t = n.clone().applyMatrix4(t);
  48822. return {
  48823. datasetId: e.dataset_id,
  48824. direction: Up.convertVector.ZupToYup(t)
  48825. }
  48826. }),
  48827. vectorForward: n
  48828. }
  48829. }
  48830. }, {
  48831. key: "update",
  48832. value: function() {
  48833. var e;
  48834. this.viewer;
  48835. this.tileDownloader.started && (e = this.getTileDirection(),
  48836. this.updateTileDownloader(sy, e),
  48837. this.updatePanoRenderer(e)),
  48838. this.updateZoomPano()
  48839. }
  48840. }, {
  48841. key: "updateTileDownloader",
  48842. value: function(e, t) {
  48843. var n = this.nextPano || this.currentPano;
  48844. n && (this.tileDownloader.tilePrioritizer.updateCriteria(n, viewer.scene.view.position.clone(), t, 0 < e.length ? e : null),
  48845. this.tileDownloader.processPriorityQueue = !0)
  48846. }
  48847. }, {
  48848. key: "updatePanoRenderer",
  48849. value: function(e) {
  48850. var t = this.nextPano || this.currentPano;
  48851. t && this.panoRenderer.hasQueuedTiles() && t && this.panoRenderer.updateDirection(e)
  48852. }
  48853. }, {
  48854. key: "checkAndWaitForTiledPanoLoad",
  48855. value: function(e, t, n, i, r, a, o, s) {
  48856. e || console.error("Player.checkAndWaitForTiledPanoLoad() -> Cannot load texture for null pano.");
  48857. var l = this.getTileDirection();
  48858. if (!e.isLoaded(t)) {
  48859. a && viewer.waitForLoad(e, function() {
  48860. return e.isLoaded(t)
  48861. });
  48862. return e.loadTiledPano(t, l, null, o, s, null).done(function(e, t) {
  48863. n && n(e, t)
  48864. }
  48865. .bind(this)).fail(function(e) {
  48866. i && i(e)
  48867. }
  48868. .bind(this)).progress(function(e, t, n) {
  48869. r && r(e, t, n)
  48870. }
  48871. .bind(this)),
  48872. !0
  48873. }
  48874. }
  48875. }, {
  48876. key: "fitPanoTowardPoint",
  48877. value: function(t) {
  48878. var i, r = t.point, a = t.target, e = t.require || [], n = t.rank || [], o = (t.force,
  48879. t.getAll), s = t.bestDistance || 0, l = viewer.scene.getActiveCamera();
  48880. a && (i = (new Cn).subVectors(a, r).normalize()),
  48881. t.boundSphere && (s = 1 < l.aspect ? t.boundSphere.radius / gn.degToRad(l.fov / 2) : (l = Rg.getHFOVForCamera(l, !0),
  48882. t.boundSphere.radius / (l / 2)));
  48883. var u = s * s;
  48884. n.push(function(e) {
  48885. var t = Math.abs(e.position.distanceToSquared(r) - u);
  48886. if (a) {
  48887. var n = e.position.distanceToSquared(a)
  48888. , e = (new Cn).subVectors(a, e.position).normalize()
  48889. , e = i.dot(e);
  48890. return (-t - Math.pow(n, 1.5)) / (e + 2)
  48891. }
  48892. return -t
  48893. }, function(e) {
  48894. return e.depthTex && t.checkIntersect && viewer.inputHandler.ifBlockedByIntersect(a, .1, null, null, null, e) ? -1e4 : 0
  48895. });
  48896. n = Fm.sortByScore(this.panos, e, n);
  48897. return o ? n : n && 0 < n.length && n[0].item
  48898. }
  48899. }, {
  48900. key: "zoomBy",
  48901. value: function(e, t) {
  48902. this.zoomTo(this.zoomLevel * e, t)
  48903. }
  48904. }, {
  48905. key: "zoomTo",
  48906. value: function(e, t) {
  48907. var n, i, r, a = Potree.settings.zoom;
  48908. a.enabled && (e = gn.clamp(e, a.min, a.max)) != this.zoomLevel && (this.zoomLevel = e,
  48909. n = viewer.scene.view,
  48910. i = viewer.scene.view.direction,
  48911. r = viewer.inputHandler.getMouseDirection(t).direction,
  48912. viewer.setFOV(Potree.config.view.fov * (1 / this.zoomLevel)),
  48913. a = viewer.inputHandler.getMouseDirection(t).direction,
  48914. n.direction = r,
  48915. e = n.pitch,
  48916. t = n.yaw,
  48917. n.direction = a,
  48918. r = n.pitch,
  48919. a = n.yaw,
  48920. n.direction = i,
  48921. viewer.scene.view.pitch -= r - e,
  48922. viewer.scene.view.yaw -= a - t)
  48923. }
  48924. }, {
  48925. key: "zoomFovTo",
  48926. value: function(e) {
  48927. e = this.baseFov / e;
  48928. this.zoomTo(e)
  48929. }
  48930. }, {
  48931. key: "smoothZoomTo",
  48932. value: function(t) {
  48933. var n = this
  48934. , i = this.zoomLevel;
  48935. i != t && gv.start(function(e) {
  48936. n.zoomTo(i * (1 - e) + t * e, !0)
  48937. }, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, null, null, 0, pv.easeInOutQuad)
  48938. }
  48939. }, {
  48940. key: "updateZoomPano",
  48941. value: function() {
  48942. var e, t, n, i, r = this;
  48943. this.panoRenderer.zoomPanoRenderingDisabled || "showPanos" != Potree.settings.displayMode || (e = this.currentPano) && (i = "2k" == Potree.settings.navTileClass && "4k" == Potree.settings.tileClass ? 1.7 : Potree.settings.zoom.activationThreshold,
  48944. t = this.zoomLevel > i,
  48945. i = !(this.flying && this.nextPano && this.nextPano !== this.currentPano),
  48946. this.tileDownloader.tilePrioritizer.setZoomingActive(i = t && i),
  48947. this.panoRenderer.setZoomingActive(i, e, !0),
  48948. n = function(e, t) {
  48949. r.panoRenderer.resetRenderStatus(e.id, !1, !0, r.qualityManager.getMaxNavPanoSize()),
  48950. r.panoRenderer.clearAllQueuedUploadsForPano(e.id),
  48951. r.panoRenderer.renderPanoTiles(e.id, null, !1, !1),
  48952. e.setZoomed(t)
  48953. }
  48954. ,
  48955. i && (!e.zoomed || this.qualityManager.zoomLevelResolution && "4k" != this.qualityManager.zoomLevelResolution) ? (e.zoomed || n(e, !0),
  48956. "1k" == Potree.settings.navTileClass && "1k" != Potree.settings.tileClass && this.zoomLevel < 2 ? this.panoRenderer.enableHighQuality(function() {
  48957. "4k" != Potree.settings.tileClass && n(e, !0)
  48958. }
  48959. .bind(this)) : this.panoRenderer.enableUltraHighQualityMode(function() {
  48960. this.qualityManager.useUltraHighResolutionPanos && (Potree.settings.zoom.max = Potree.config.ultraHighQualityMaxZoom),
  48961. n(e, !0)
  48962. }
  48963. .bind(this))) : !t && e.zoomed && n(e, !1),
  48964. i && "1k" == Potree.settings.navTileClass && "4k" == Potree.settings.tileClass && (i = function(e) {
  48965. r.qualityManager.updateMaximums(),
  48966. r.panoRenderer.setupZoomRenderTarget()
  48967. }
  48968. ,
  48969. this.qualityManager.zoomLevelResolution = 2 <= this.zoomLevel ? "4k" : 1.1 < this.zoomLevel ? "2k" : "1k",
  48970. this.oldZoomLevel < 2 && 2 <= this.zoomLevel ? (i(),
  48971. n(e, t)) : this.oldZoomLevel <= Potree.settings.zoom.activationThreshold && this.zoomLevel > Potree.settings.zoom.activationThreshold ? i() : 2 < this.oldZoomLevel && this.zoomLevel <= 2 ? (i(),
  48972. n(e, t)) : this.oldZoomLevel > Potree.settings.zoom.activationThreshold && this.zoomLevel <= Potree.settings.zoom.activationThreshold && i(),
  48973. this.oldZoomLevel = this.zoomLevel))
  48974. }
  48975. }, {
  48976. key: "addHighMapCube",
  48977. value: function() {
  48978. if ("4k" == Potree.settings.tileClass && 2048 == this.qualityManager.maxRenderTargetSize) {
  48979. for (var e = new bu(1,1,1,1), t = new Si, n = 0; n < 6; n++) {
  48980. for (var i = new Si, r = 0; r < 8; r++)
  48981. for (var a = 0; a < 8; a++) {
  48982. var o, s = new Hr(e,new $i({}));
  48983. s.position.set(r - 3.5, a - 3.5, -4),
  48984. s.material.opacity = .4,
  48985. s.material.transparent = !0,
  48986. Potree.settings.isTest && (o = Math.random(),
  48987. s.material.color = (new Yi).setHSL(o, .5, .9)),
  48988. s.visible = !1,
  48989. i.add(s)
  48990. }
  48991. switch (n) {
  48992. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X:
  48993. i.rotation.set(0, Math.PI / 2, 0);
  48994. break;
  48995. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
  48996. i.rotation.set(0, -Math.PI / 2, 0);
  48997. break;
  48998. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
  48999. var l = (new Sn).setFromAxisAngle(new Cn(0,1,0), Math.PI)
  49000. , u = (new Sn).setFromAxisAngle(new Cn(1,0,0), Math.PI / 2);
  49001. i.quaternion.copy(l).multiply(u);
  49002. break;
  49003. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
  49004. l = (new Sn).setFromAxisAngle(new Cn(0,1,0), Math.PI),
  49005. u = (new Sn).setFromAxisAngle(new Cn(1,0,0), -Math.PI / 2);
  49006. i.quaternion.copy(l).multiply(u);
  49007. break;
  49008. case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
  49009. i.rotation.set(0, Math.PI, 0);
  49010. break;
  49011. case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
  49012. i.rotation.set(0, 0, 0)
  49013. }
  49014. i.scale.set(1, -1, 1),
  49015. t.add(i)
  49016. }
  49017. t.name = "highMapCube",
  49018. this.highMapCube = t,
  49019. viewer.scene.scene.add(t),
  49020. this.highMapCube.visible = !1,
  49021. viewer.setObjectLayers(this.highMapCube, "sceneObjects")
  49022. }
  49023. }
  49024. }, {
  49025. key: "isHighMapLoaded",
  49026. value: function(e, t, n) {
  49027. return !!this.highMapCube.children[e].children[8 * t + n].material.map
  49028. }
  49029. }, {
  49030. key: "updateHighMap",
  49031. value: function(e, t, n, i) {
  49032. i = this.highMapCube.children[t].children[8 * n + i];
  49033. i.material.map = e,
  49034. i.material.opacity = 1,
  49035. i.material.transparent = !1,
  49036. i.visible = !0,
  49037. i.material.needsUpdate = !0
  49038. }
  49039. }, {
  49040. key: "resetHighMap",
  49041. value: function() {
  49042. this.highMapCube && (this.highMapCube.children.forEach(function(e) {
  49043. return e.children.forEach(function(e) {
  49044. var t;
  49045. e.material.map && (e.material.map.dispose(),
  49046. e.material.map.loaded = !1,
  49047. e.material.map.version = 0,
  49048. t = viewer.renderer.properties.get(e.material.map),
  49049. viewer.renderer.getContext().deleteTexture(t.__webglTexture),
  49050. e.material.map = null,
  49051. e.material.needsUpdate = !0,
  49052. e.visible = !1)
  49053. })
  49054. }),
  49055. this.highMapCube.visible = !1)
  49056. }
  49057. }, {
  49058. key: "setHighMap",
  49059. value: function(e) {
  49060. this.highMapCube && (this.highMapCube.position.copy(e.position),
  49061. this.highMapCube.quaternion.copy(Up.convertQuaternion.YupToZup(e.quaternion4dkk)),
  49062. e = (new Sn).setFromRotationMatrix(e.pointcloud.rotateMatrix),
  49063. this.highMapCube.quaternion.premultiply(e))
  49064. }
  49065. }, {
  49066. key: "showHighMap",
  49067. value: function() {
  49068. this.highMapCube && (this.highMapCube.visible = !0)
  49069. }
  49070. }, {
  49071. key: "hideHighMap",
  49072. value: function() {
  49073. this.highMapCube && (this.highMapCube.visible = !1)
  49074. }
  49075. }, {
  49076. key: "addPanoData",
  49077. value: function(e, n) {
  49078. var i = this;
  49079. 0 == (e = e.data ? e.data : e).length && console.error(n + " 没有漫游点"),
  49080. e.forEach(function(e) {
  49081. e.id = i.panos.length;
  49082. var t = new Qg(e,i);
  49083. t.addEventListener("dispose", function(e) {
  49084. i.closestPano == t && (i.closestPano = null)
  49085. }),
  49086. i.panos.push(t),
  49087. "pano" == Potree.settings.editType && Potree.settings.datasetsPanos[n].panos.push(t)
  49088. })
  49089. }
  49090. }, {
  49091. key: "loadDone",
  49092. value: function() {
  49093. viewer.setObjectLayers(this.node, "sceneObjects"),
  49094. this.panos.forEach(function(e) {
  49095. e.label && viewer.setObjectLayers(e.label, "bothMapAndScene")
  49096. }),
  49097. this.tileDownloader.setPanoData(this.panos, []);
  49098. var e = new Cn(1,1,1);
  49099. this.bound = Up.getBoundByPoints(this.panos.map(function(e) {
  49100. return e.position
  49101. }), e),
  49102. viewer.scene.pointclouds.forEach(function(e) {
  49103. return e.getPanosBound()
  49104. }),
  49105. viewer.scene.pointclouds.some(function(e) {
  49106. return 0 == e.panos.length
  49107. }) && (viewer.hasNoPanoDataset = !0)
  49108. }
  49109. }, {
  49110. key: "getPano",
  49111. value: function(t) {
  49112. var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "id";
  49113. return this.panos.find(function(e) {
  49114. return e[n] == t
  49115. })
  49116. }
  49117. }]),
  49118. c
  49119. }();
  49120. ly.prototype.checkAndWaitForPanoLoad = (iy = {},
  49121. ry = {},
  49122. ay = {},
  49123. function(n, e, t, i, r, a, o, s) {
  49124. if (ay[n.id] = t,
  49125. function() {
  49126. for (var e in iy)
  49127. if (iy.hasOwnProperty(e) && iy[e])
  49128. if (performance.now() - ry[e] < 5e3)
  49129. return !0;
  49130. return !1
  49131. }())
  49132. return !0;
  49133. try {
  49134. return null != a || (a = !0),
  49135. iy[n.id] = this.checkAndWaitForTiledPanoLoad(n, e, function(e, t) {
  49136. setTimeout(function() {
  49137. iy[n.id] = !1,
  49138. ay[n.id] && ay[n.id](e, t)
  49139. }, 1)
  49140. }, function(e) {
  49141. setTimeout(function() {
  49142. iy[n.id] = !1,
  49143. i && i(e)
  49144. }, 1)
  49145. }, r, a, o, s),
  49146. iy[n.id] && (ry[n.id] = performance.now()),
  49147. iy[n.id]
  49148. } catch (e) {
  49149. throw iy[n.id] = !1,
  49150. ry[n.id] = performance.now() - 5e3,
  49151. e
  49152. }
  49153. }
  49154. ),
  49155. ly.filters = {
  49156. inPanoDirection: function(n, i, r) {
  49157. return function(e) {
  49158. var t = e.floorPosition.clone().sub(n).normalize()
  49159. , e = e.position.clone().sub(n).normalize();
  49160. return t.dot(i) > r || e.dot(i) > r
  49161. }
  49162. },
  49163. inFloorDirection: function(t, n, i) {
  49164. return function(e) {
  49165. return e.floorPosition.clone().sub(t).setZ(0).normalize().dot(n) > i
  49166. }
  49167. },
  49168. isNotBehindNormal: function(t, n) {
  49169. var i = new Cn;
  49170. return n = n.clone(),
  49171. function(e) {
  49172. return 0 < i.copy(e.position).sub(t).normalize().dot(n)
  49173. }
  49174. },
  49175. isCloseEnoughTo: function(t, n) {
  49176. return function(e) {
  49177. return t.distanceTo(e.floorPosition) < n
  49178. }
  49179. },
  49180. not: function(t) {
  49181. return function(e) {
  49182. return e !== t
  49183. }
  49184. },
  49185. isEnabled: function() {
  49186. return function(e) {
  49187. return e.enabled
  49188. }
  49189. },
  49190. isVisible: function() {
  49191. return function(e) {
  49192. return e.visible
  49193. }
  49194. }
  49195. },
  49196. ly.scoreFunctions = {
  49197. direction: function(t, n, e) {
  49198. return function(e) {
  49199. return 200 * e.position.clone().sub(t).normalize().dot(n)
  49200. }
  49201. },
  49202. distanceSquared: function(t, n, e) {
  49203. return t.position && (t = t.position),
  49204. function(e) {
  49205. e = e.position.clone();
  49206. return -1 * t.distanceToSquared(e) * n
  49207. }
  49208. },
  49209. angle: function(t, n) {
  49210. return function(e) {
  49211. return e.position.clone().sub(t).normalize().angleTo(n) * Potree.config.navigation.angleFactor
  49212. }
  49213. }
  49214. },
  49215. ly.sortFunctions = {
  49216. floorDisSquaredToPoint: function(n) {
  49217. return function(e, t) {
  49218. return e.floorPosition.distanceToSquared(n) - t.floorPosition.distanceToSquared(n)
  49219. }
  49220. },
  49221. disSquaredToPoint: function(n) {
  49222. return function(e, t) {
  49223. return e.position.distanceToSquared(n) - t.position.distanceToSquared(n)
  49224. }
  49225. }
  49226. };
  49227. var uy, cy = T.map.mapHeight + 100, dy = T.map.mapHeight + 105, hy = new _c, py = new ua(1,1), fy = function() {
  49228. y(a, zg);
  49229. var r = w(a);
  49230. function a(e) {
  49231. var t, n, i;
  49232. return O(this, a),
  49233. (t = r.call(this, e, {
  49234. clearColor: Potree.config.mapBG,
  49235. name: "mapViewer"
  49236. })).visible = !0,
  49237. t.initScene(),
  49238. t.mapLayer = new hg(g(t),t.viewports[0]),
  49239. t.scene.add(t.mapLayer.sceneGroup),
  49240. t.mapLayer.sceneGroup.position.setZ(Potree.config.map.mapHeight),
  49241. t.mapRatio = .5,
  49242. t.splitDir = "leftRight",
  49243. viewer.addEventListener("camera_changed", function(e) {
  49244. e.viewport == viewer.mainViewport ? t.updateCursor() : t.updateWhenAtViewer()
  49245. }),
  49246. viewer.reticule.addEventListener("update", function(e) {
  49247. t.attachedToViewer && (t.needRender = !0)
  49248. }),
  49249. viewer.scene.addEventListener("360_images_added", t.addPanos.bind(g(t))),
  49250. viewer.addEventListener("loadPointCloudDone", t.initProjection.bind(g(t))),
  49251. t.addEventListener("global_click", function(e) {
  49252. !e.isTouch && e.button != C.LEFT || t.updateClosestPano(e.intersect)
  49253. }),
  49254. t.addEventListener("add", function(e) {
  49255. t.scene.add(e.object),
  49256. "route" == e.name && (e.object.position.z = dy),
  49257. viewer.setObjectLayers(e.object, "mapObjects")
  49258. }),
  49259. Potree.settings.isOfficial || (e = viewer.renderer.domElement.parentElement,
  49260. (n = $("<input type='button' value='map绑定'></input>")).css({
  49261. position: "absolute",
  49262. right: "80%",
  49263. bottom: "20px",
  49264. zIndex: "10000",
  49265. fontSize: "1em",
  49266. color: "black",
  49267. background: "rgba(255,255,255,0.8)"
  49268. }),
  49269. i = !1,
  49270. n.on("click", function() {
  49271. i = !i,
  49272. t.attachToMainViewer(i, "measure"),
  49273. n.val(i ? "map分离" : "map绑定")
  49274. }),
  49275. e.appendChild(n[0])),
  49276. t
  49277. }
  49278. return h(a, [{
  49279. key: "waitLoadDone",
  49280. value: function(t) {
  49281. var n = this;
  49282. 0 == this.mapLayer.loadingInProgress ? t() : this.mapLayer.addEventListener("loadDone", function e() {
  49283. t(),
  49284. n.mapLayer.removeEventListener("loadDone", e)
  49285. })
  49286. }
  49287. }, {
  49288. key: "addListener",
  49289. value: function(e) {
  49290. var t = this;
  49291. e.addEventListener("flyToPano", function(e) {
  49292. e = e.toPano;
  49293. e.dontMoveMap || t.moveTo(e.pano.position.clone().setZ(Potree.config.map.cameraHeight), void 0, e.duration, e.easeName)
  49294. })
  49295. }
  49296. }, {
  49297. key: "initProjection",
  49298. value: function() {
  49299. this.started = !0,
  49300. this.mapLayer.initProjection()
  49301. }
  49302. }, {
  49303. key: "initScene",
  49304. value: function() {
  49305. var e = this.renderArea.clientWidth
  49306. , t = this.renderArea.clientHeight;
  49307. this.camera = new ed(-e / 2,e / 2,t / 2,-t / 2,.01,1e4),
  49308. this.camera.zoom = e / 50,
  49309. this.camera.up.set(0, 0, 1),
  49310. this.view = new ng,
  49311. this.view.position.set(0, 0, Potree.config.map.cameraHeight),
  49312. this.view.lookAt(0, 0, 0),
  49313. this.setViewLimit("standard");
  49314. e = new Ig(this.view,this.camera,{
  49315. left: 0,
  49316. bottom: 0,
  49317. width: 1,
  49318. height: 1,
  49319. name: "mapViewport"
  49320. });
  49321. e.axis = ["x", "y"],
  49322. e.axisSign = [1, 1],
  49323. e.noPointcloud = !0,
  49324. e.render = this.render.bind(this),
  49325. this.viewports = [e],
  49326. this.controls = new Fg(this,this.viewports[0]),
  49327. this.controls.setEnable(!0),
  49328. this.scene = new gs,
  49329. this.inputHandler = new Og(this,this.scene),
  49330. this.inputHandler.name = "mapInputHandler",
  49331. this.inputHandler.registerInteractiveScene(this.scene),
  49332. this.viewports[0].interactiveScenes = this.inputHandler.interactiveScenes;
  49333. e = new Hr(py,new $i({
  49334. transparent: !0,
  49335. opacity: .9,
  49336. depthTest: !1,
  49337. map: hy.load(Potree.resourcePath + "/textures/pic_location128.png")
  49338. }));
  49339. e.position.set(0, 0, 0),
  49340. this.cursor = e,
  49341. this.scene.add(e),
  49342. viewer.setObjectLayers(this.scene, "mapObjects")
  49343. }
  49344. }, {
  49345. key: "setViewLimit",
  49346. value: function(e) {
  49347. e = Potree.config.OrthoCameraLimit[e];
  49348. e ? (this.view.limitBound = (new kn).copy(e.posBound),
  49349. this.camera.zoomLimit = $.extend({}, e.zoom)) : (this.view.limitBound = null,
  49350. this.camera.zoomLimit = null)
  49351. }
  49352. }, {
  49353. key: "updateCursor",
  49354. value: function() {
  49355. var e = Up.getScaleForConstantSize({
  49356. minSize: 80,
  49357. maxSize: 200,
  49358. nearBound: 5,
  49359. farBound: 100,
  49360. camera: this.camera,
  49361. position: this.cursor.getWorldPosition(new Cn),
  49362. resolution: this.viewports[0].resolution
  49363. });
  49364. this.cursor.scale.set(e, e, e),
  49365. this.cursor.position.copy(viewer.mainViewport.camera.position).setZ(0),
  49366. this.cursor.rotation.z = viewer.mainViewport.view.yaw,
  49367. this.needRender = !0
  49368. }
  49369. }, {
  49370. key: "addPanos",
  49371. value: function(e) {
  49372. var i = this
  49373. , r = new Si;
  49374. uy = {
  49375. default: new $i({
  49376. transparent: !0,
  49377. opacity: .5,
  49378. map: hy.load(Potree.resourcePath + "/textures/map_marker.png")
  49379. }),
  49380. selected: new $i({
  49381. transparent: !0,
  49382. opacity: 1,
  49383. map: hy.load(Potree.resourcePath + "/textures/map_marker.png")
  49384. })
  49385. },
  49386. e.images.panos.forEach(function(t) {
  49387. t.mapMarker = new Hr(py,uy.default),
  49388. t.mapMarker.position.copy(t.position).setZ(0),
  49389. t.mapMarker.scale.set(1, 1, 1),
  49390. t.mapMarker.name = "mapMarker",
  49391. r.add(t.mapMarker);
  49392. function e(e) {
  49393. e.byMap || (t.mapMarker.material = uy.selected,
  49394. e.byMainView || t.dispatchEvent({
  49395. type: "hoverOn",
  49396. byMap: !0
  49397. }),
  49398. i.needRender = !0)
  49399. }
  49400. function n(e) {
  49401. e.byMap || (t.mapMarker.material = uy.default,
  49402. e.byMainView || t.dispatchEvent({
  49403. type: "hoverOff",
  49404. byMap: !0
  49405. }),
  49406. i.needRender = !0)
  49407. }
  49408. t.mapMarker.addEventListener("mouseover", e),
  49409. t.mapMarker.addEventListener("mouseleave", n),
  49410. t.addEventListener("hoverOn", e),
  49411. t.addEventListener("hoverOff", n);
  49412. t.mapMarker.addEventListener("click", function(e) {
  49413. viewer.images360.flyToPano(t)
  49414. }),
  49415. t.addEventListener("isVisible", function(e) {
  49416. viewer.updateVisible(t.mapMarker, "panoVisible", e.visible),
  49417. i.needRender = !0
  49418. }),
  49419. t.addEventListener("rePos", function(e) {
  49420. t.mapMarker.position.copy(t.position).setZ(0)
  49421. })
  49422. }),
  49423. this.scene.add(r),
  49424. r.position.z = cy,
  49425. this.panosGroup = r,
  49426. viewer.setObjectLayers(r, "mapObjects"),
  49427. this.initFitView()
  49428. }
  49429. }, {
  49430. key: "updateClosestPano",
  49431. value: function(t) {
  49432. var e;
  49433. viewer.images360.flying || (t = t && t.orthoIntersect) && (t = t.clone().setZ(0),
  49434. e = [function(e) {
  49435. return e.position.clone().setZ(0).distanceTo(t) < 20
  49436. }
  49437. , ly.filters.isEnabled(), ly.filters.isVisible()],
  49438. (e = Fm.find(viewer.images360.panos, e, [ly.sortFunctions.floorDisSquaredToPoint(t)])) && e != viewer.images360.currentPano && viewer.images360.flyToPano(e))
  49439. }
  49440. }, {
  49441. key: "fitPanosToViewport",
  49442. value: function() {
  49443. var e = viewer.images360.bound.size.clone().multiplyScalar(1.1);
  49444. e.max(new Cn(4,4,4));
  49445. var t = viewer.images360.bound.center.clone();
  49446. this.moveTo(t, e, 0)
  49447. }
  49448. }, {
  49449. key: "fitToPointcloud",
  49450. value: function(e) {
  49451. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 400
  49452. , n = e.bound.getSize(new Cn);
  49453. n.max(new Cn(4,4,4));
  49454. e = e.bound.getCenter(new Cn);
  49455. this.moveTo(e, n, t)
  49456. }
  49457. }, {
  49458. key: "initFitView",
  49459. value: function() {
  49460. this.camera.zoom = 14,
  49461. this.moveTo(viewer.images360.position),
  49462. this.camera.updateProjectionMatrix()
  49463. }
  49464. }, {
  49465. key: "fitToDatasets",
  49466. value: function(e) {
  49467. var t = new kn;
  49468. e.forEach(function(e) {
  49469. return t.union(e.bound)
  49470. });
  49471. var n = t.getCenter(new Cn)
  49472. , e = t.getSize(new Cn);
  49473. this.moveTo(n, e, 200)
  49474. }
  49475. }, {
  49476. key: "moveTo",
  49477. value: function(e, t) {
  49478. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  49479. , i = 3 < arguments.length ? arguments[3] : void 0;
  49480. e = new Cn(e.x,e.y,Potree.config.map.cameraHeight),
  49481. this.view.moveOrthoCamera(this.viewports[0], {
  49482. endPosition: e,
  49483. boundSize: t
  49484. }, n, i)
  49485. }
  49486. }, {
  49487. key: "updateWhenAtViewer",
  49488. value: function(e) {
  49489. this.attachedToViewer && (this.started && this.mapLayer.update(),
  49490. this.updateCursor(),
  49491. this.needRender = !0)
  49492. }
  49493. }, {
  49494. key: "update",
  49495. value: function(e, t) {
  49496. (this.visible || this.attachedToViewer) && (this.attachedToViewer ? this.mapLayer.needUpdate && this.updateWhenAtViewer() : (this.updateScreenSize(),
  49497. this.controls.update(e),
  49498. this.view.applyToCamera(this.camera),
  49499. e = this.cameraChanged(),
  49500. this.started && (e || this.mapLayer.needUpdate) && this.mapLayer.update(),
  49501. e && (this.dispatchEvent({
  49502. type: "camera_changed",
  49503. camera: this.camera,
  49504. viewport: this.viewports[0]
  49505. }),
  49506. this.needRender = !0,
  49507. this.updateCursor()),
  49508. this.render()))
  49509. }
  49510. }, {
  49511. key: "attachToMainViewer",
  49512. value: function(e, t) {
  49513. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .5
  49514. , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {};
  49515. if (Potree.settings.isOfficial || (this.renderArea.style.display = e ? "none" : "block"),
  49516. e) {
  49517. if (this.enabledOld = this.enabled,
  49518. this.enabled = !0,
  49519. "dontSet" != n) {
  49520. if (this.changeSplitScreenDir(i.dir, n),
  49521. this.attachedToViewer)
  49522. return void viewer.updateScreenSize({
  49523. forceUpdateSize: !0
  49524. });
  49525. viewer.viewports = [viewer.mainViewport, viewer.mapViewer.viewports[0]]
  49526. }
  49527. "measure" == t ? this.inputHandler.registerInteractiveScene(viewer.measuringTool.scene) : "split4Screens" == t && this.inputHandler.registerInteractiveScene(viewer.scene.scene)
  49528. } else {
  49529. if (!this.attachedToViewer)
  49530. return;
  49531. viewer.mainViewport.left = 0,
  49532. viewer.mainViewport.bottom = 0,
  49533. viewer.mainViewport.width = 1,
  49534. viewer.mainViewport.height = 1,
  49535. this.viewports[0].width = 1,
  49536. this.viewports[0].bottom = 0,
  49537. this.viewports[0].height = 1,
  49538. this.viewports[0].left = 0,
  49539. this.inputHandler.unregisterInteractiveScene(viewer.measuringTool.scene),
  49540. this.inputHandler.unregisterInteractiveScene(viewer.scene.scene),
  49541. viewer.viewports = [viewer.mainViewport],
  49542. this.updateScreenSize({
  49543. forceUpdateSize: !0
  49544. })
  49545. }
  49546. this.attachedToViewer = e,
  49547. viewer.updateScreenSize({
  49548. forceUpdateSize: !0
  49549. }),
  49550. i.moveToCurrentPos && (i = new yn(10,10),
  49551. this.moveTo(viewer.images360.position.clone(), i, 1e3)),
  49552. this.needRender = !0
  49553. }
  49554. }, {
  49555. key: "changeSplitScreenDir",
  49556. value: function(e, t) {
  49557. e && (this.splitDir = e),
  49558. this.updateSplitSize(t)
  49559. }
  49560. }, {
  49561. key: "updateSplitSize",
  49562. value: function(e) {
  49563. null != e && (this.mapRatio = e),
  49564. "leftRight" == this.splitDir ? (viewer.mainViewport.left = this.mapRatio,
  49565. viewer.mainViewport.width = 1 - this.mapRatio,
  49566. this.viewports[0].width = this.mapRatio,
  49567. viewer.mainViewport.bottom = this.viewports[0].bottom = 0,
  49568. viewer.mainViewport.height = this.viewports[0].height = 1) : "upDown" == this.splitDir && (viewer.mainViewport.bottom = this.mapRatio,
  49569. viewer.mainViewport.height = 1 - this.mapRatio,
  49570. this.viewports[0].height = this.mapRatio,
  49571. viewer.mainViewport.left = this.viewports[0].left = 0,
  49572. viewer.mainViewport.width = this.viewports[0].width = 1),
  49573. this.attachedToViewer && viewer.updateScreenSize({
  49574. forceUpdateSize: !0
  49575. })
  49576. }
  49577. }, {
  49578. key: "render",
  49579. value: function() {
  49580. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  49581. (this.visible || this.attachedToViewer) && (this.needRender || t.force) && (e = t.renderer || this.renderer,
  49582. t.target && e.setRenderTarget(t.target),
  49583. (t.clear ? t : e).clear(),
  49584. this.attachedToViewer || viewer.dispatchEvent({
  49585. type: "render.begin",
  49586. viewer: this,
  49587. viewport: this.viewports[0],
  49588. params: t
  49589. }),
  49590. viewer.setCameraLayers(this.camera, ["map", "mapObjects", "bothMapAndScene"]),
  49591. this.mapGradientBG && (viewer.scene.cameraBG.layers.set(Potree.config.renderLayers.bg),
  49592. e.render(viewer.scene.scene, viewer.scene.cameraBG)),
  49593. e.render(this.scene, this.camera),
  49594. e.render(viewer.scene.scene, this.camera),
  49595. t.renderOverlay && t.renderOverlay($.extend({}, t, {
  49596. isMap: !0
  49597. })),
  49598. e.setRenderTarget(null),
  49599. this.needRender = !1)
  49600. }
  49601. }]),
  49602. a
  49603. }(), my = function() {
  49604. function e() {
  49605. O(this, e)
  49606. }
  49607. return h(e, null, [{
  49608. key: "toString",
  49609. value: function(e) {
  49610. var t, n = "", i = Object.keys(e.data).filter(function(e) {
  49611. return "normal" !== e
  49612. }).sort(function(e, t) {
  49613. return "position" === e ? -1 : "position" === t ? 1 : "rgba" === e ? -1 : "rgba" === t ? 1 : void 0
  49614. }), r = [], a = ue(i);
  49615. try {
  49616. for (a.s(); !(t = a.n()).done; ) {
  49617. var o = t.value
  49618. , s = e.data[o].length / e.numPoints;
  49619. if ("position" === o)
  49620. r = r.concat(["x", "y", "z"]);
  49621. else if ("rgba" === o)
  49622. r = r.concat(["r", "g", "b", "a"]);
  49623. else if (1 < s)
  49624. for (var l = 0; l < s; l++)
  49625. r.push("".concat(o, "_").concat(l));
  49626. else
  49627. r.push(o)
  49628. }
  49629. } catch (e) {
  49630. a.e(e)
  49631. } finally {
  49632. a.f()
  49633. }
  49634. for (var n = r.join(", ") + "\n", u = 0; u < e.numPoints; u++) {
  49635. var c, d = [], h = ue(i);
  49636. try {
  49637. for (h.s(); !(c = h.n()).done; ) {
  49638. var p = c.value
  49639. , f = e.data[p].length / e.numPoints
  49640. , m = e.data[p].subarray(f * u, f * u + f).join(", ");
  49641. d.push(m)
  49642. }
  49643. } catch (e) {
  49644. h.e(e)
  49645. } finally {
  49646. h.f()
  49647. }
  49648. n += d.join(", ") + "\n"
  49649. }
  49650. return n
  49651. }
  49652. }]),
  49653. e
  49654. }(), vy = function() {
  49655. function e() {
  49656. O(this, e)
  49657. }
  49658. return h(e, null, [{
  49659. key: "toLAS",
  49660. value: function(e) {
  49661. function t(e, t, n) {
  49662. for (var i = new Uint8Array(n), r = 0; r < e.length; r++) {
  49663. var a = e.charCodeAt(r);
  49664. i[t + r] = a
  49665. }
  49666. }
  49667. var n = e.boundingBox
  49668. , i = n.min.clone()
  49669. , r = n.min.distanceTo(n.max)
  49670. , a = new Cn(.001,.001,.001)
  49671. , a = 1e6 < r ? new Cn(.01,.01,.01) : new Cn(.001,.001,.001)
  49672. , o = new ArrayBuffer(227 + 28 * e.numPoints)
  49673. , s = new DataView(o)
  49674. , r = new Uint8Array(o);
  49675. t("LASF", 0, o),
  49676. r[24] = 1,
  49677. r[25] = 2,
  49678. t("Potree 1.7", 58, o),
  49679. s.setUint16(94, 227, !0),
  49680. s.setUint32(96, 227, !0),
  49681. r[104] = 2,
  49682. s.setUint16(105, 28, !0),
  49683. s.setUint32(107, e.numPoints, !0),
  49684. s.setFloat64(131, a.x, !0),
  49685. s.setFloat64(139, a.y, !0),
  49686. s.setFloat64(147, a.z, !0),
  49687. s.setFloat64(155, i.x, !0),
  49688. s.setFloat64(163, i.y, !0),
  49689. s.setFloat64(171, i.z, !0),
  49690. s.setFloat64(179, n.max.x, !0),
  49691. s.setFloat64(187, n.min.x, !0),
  49692. s.setFloat64(195, n.max.y, !0),
  49693. s.setFloat64(203, n.min.y, !0),
  49694. s.setFloat64(211, n.max.z, !0),
  49695. s.setFloat64(219, n.min.z, !0);
  49696. for (var l = 227, u = 0; u < e.numPoints; u++) {
  49697. var c = e.data.position[3 * u + 0]
  49698. , d = e.data.position[3 * u + 1]
  49699. , h = e.data.position[3 * u + 2]
  49700. , c = parseInt((c - i.x) / a.x)
  49701. , d = parseInt((d - i.y) / a.y)
  49702. , h = parseInt((h - i.z) / a.z);
  49703. s.setUint32(l + 0, c, !0),
  49704. s.setUint32(l + 4, d, !0),
  49705. s.setUint32(l + 8, h, !0),
  49706. e.data.intensity && s.setUint16(l + 12, e.data.intensity[u], !0);
  49707. h = 0;
  49708. e.data.returnNumber && (h += e.data.returnNumber[u]),
  49709. e.data.numberOfReturns && (h += e.data.numberOfReturns[u] << 3),
  49710. s.setUint8(l + 14, h),
  49711. e.data.classification && s.setUint8(l + 15, e.data.classification[u]),
  49712. e.data.pointSourceID && s.setUint16(l + 18, e.data.pointSourceID[u]),
  49713. e.data.rgba && (h = e.data.rgba,
  49714. s.setUint16(l + 20, 255 * h[4 * u + 0], !0),
  49715. s.setUint16(l + 22, 255 * h[4 * u + 1], !0),
  49716. s.setUint16(l + 24, 255 * h[4 * u + 2], !0)),
  49717. l += 28
  49718. }
  49719. return o
  49720. }
  49721. }]),
  49722. e
  49723. }();
  49724. function gy(e, t) {
  49725. for (var n = 0, i = Object.keys(t.uniforms); n < i.length; n++) {
  49726. var r = i[n];
  49727. t.uniforms[r].value = e.uniforms[r].value
  49728. }
  49729. t.gradientTexture = e.gradientTexture,
  49730. t.visibleNodesTexture = e.visibleNodesTexture,
  49731. t.classificationTexture = e.classificationTexture,
  49732. t.matcapTexture = e.matcapTexture,
  49733. t.activeAttributeName = e.activeAttributeName,
  49734. t.ranges = e.ranges
  49735. }
  49736. var yy = function() {
  49737. function n(e, t) {
  49738. O(this, n),
  49739. this.geometry = e,
  49740. this.material = t,
  49741. this.sceneNode = new gl(e,t),
  49742. this.geometryNode = {
  49743. estimatedSpacing: 1,
  49744. geometry: e
  49745. }
  49746. }
  49747. return h(n, [{
  49748. key: "getLevel",
  49749. value: function() {
  49750. return 0
  49751. }
  49752. }]),
  49753. n
  49754. }()
  49755. , wy = function() {
  49756. y(i, xm);
  49757. var n = w(i);
  49758. function i(e) {
  49759. var t;
  49760. return O(this, i),
  49761. (t = n.call(this)).trueOctree = e,
  49762. t.pcoGeometry = e.pcoGeometry,
  49763. t.points = [],
  49764. t.visibleNodes = [],
  49765. t.material = new Rm,
  49766. gy(t.trueOctree.material, t.material),
  49767. t.material.pointSizeType = am.FIXED,
  49768. t.batchSize = 1e5,
  49769. t.currentBatch = null,
  49770. t
  49771. }
  49772. return h(i, [{
  49773. key: "getAttribute",
  49774. value: function(e) {
  49775. return this.trueOctree.getAttribute(e)
  49776. }
  49777. }, {
  49778. key: "dispose",
  49779. value: function() {
  49780. var e, t = ue(this.visibleNodes);
  49781. try {
  49782. for (t.s(); !(e = t.n()).done; )
  49783. e.value.geometry.dispose()
  49784. } catch (e) {
  49785. t.e(e)
  49786. } finally {
  49787. t.f()
  49788. }
  49789. this.visibleNodes = [],
  49790. this.currentBatch = null,
  49791. this.points = []
  49792. }
  49793. }, {
  49794. key: "addPoints",
  49795. value: function(e) {
  49796. null === this.currentBatch && (this.currentBatch = this.createNewBatch(e)),
  49797. this.points.push(e);
  49798. for (var t = {
  49799. start: this.currentBatch.geometry.drawRange.count,
  49800. count: 0
  49801. }, n = new kn, i = new Cn, r = 0; r < e.numPoints; r++) {
  49802. if (t.start + t.count >= this.batchSize) {
  49803. for (var a = 0, o = Object.keys(this.currentBatch.geometry.attributes); a < o.length; a++) {
  49804. var s = o[a]
  49805. , s = this.currentBatch.geometry.attributes[s];
  49806. s.updateRange.offset = t.start,
  49807. s.updateRange.count = t.count,
  49808. s.needsUpdate = !0
  49809. }
  49810. this.currentBatch.geometry.computeBoundingBox(),
  49811. this.currentBatch.geometry.computeBoundingSphere(),
  49812. this.currentBatch = this.createNewBatch(e),
  49813. t = {
  49814. start: 0,
  49815. count: 0
  49816. }
  49817. }
  49818. i.set(e.data.position[3 * r + 0] + this.trueOctree.position.x, e.data.position[3 * r + 1] + this.trueOctree.position.y, e.data.position[3 * r + 2] + this.trueOctree.position.z);
  49819. var l = e.data.mileage[r]
  49820. , u = i.z;
  49821. n.expandByPoint(new Cn(l,0,u));
  49822. for (var c = t.start + t.count, d = this.currentBatch.geometry, h = 0, p = Object.keys(e.data); h < p.length; h++)
  49823. for (var f = p[h], m = e.data[f], v = d.attributes[f], g = v.itemSize, y = 0; y < g; y++)
  49824. v.array[g * c + y] = m[g * r + y];
  49825. var w = d.attributes.position;
  49826. w.array[3 * c + 0] = l,
  49827. w.array[3 * c + 1] = 0,
  49828. w.array[3 * c + 2] = u,
  49829. t.count++,
  49830. this.currentBatch.geometry.drawRange.count++
  49831. }
  49832. for (var b = 0, x = Object.keys(this.currentBatch.geometry.attributes); b < x.length; b++) {
  49833. var E = x[b]
  49834. , E = this.currentBatch.geometry.attributes[E];
  49835. E.updateRange.offset = t.start,
  49836. E.updateRange.count = t.count,
  49837. E.needsUpdate = !0
  49838. }
  49839. e.projectedBox = n,
  49840. this.projectedBox = this.points.reduce(function(e, t) {
  49841. return e.union(t.projectedBox)
  49842. }, new kn)
  49843. }
  49844. }, {
  49845. key: "createNewBatch",
  49846. value: function(e) {
  49847. for (var t = new Mr, n = 0, i = Object.keys(e.data); n < i.length; n++) {
  49848. var r = i[n]
  49849. , a = e.data[r]
  49850. , o = a.length / e.numPoints
  49851. , s = a.constructor
  49852. , a = !1;
  49853. this.trueOctree.root.sceneNode && this.trueOctree.root.sceneNode.geometry.attributes[r] && (a = this.trueOctree.root.sceneNode.geometry.attributes[r].normalized);
  49854. a = new nr(new s(o * this.batchSize),o,a);
  49855. a.potree = {
  49856. range: [0, 1]
  49857. },
  49858. t.setAttribute(r, a)
  49859. }
  49860. t.drawRange.start = 0,
  49861. t.drawRange.count = 0;
  49862. var l = new yy(t,this.material);
  49863. return this.visibleNodes.push(l),
  49864. l
  49865. }
  49866. }, {
  49867. key: "computeVisibilityTextureData",
  49868. value: function() {
  49869. for (var e = new Uint8Array(4 * this.visibleNodes.length), t = new Map, n = 0; n < this.visibleNodes.length; n++)
  49870. t[this.visibleNodes[n]] = n;
  49871. return {
  49872. data: e,
  49873. offsets: t
  49874. }
  49875. }
  49876. }]),
  49877. i
  49878. }()
  49879. , by = function() {
  49880. y(i, hn);
  49881. var n = w(i);
  49882. function i(e) {
  49883. var t;
  49884. O(this, i),
  49885. (t = n.call(this)).viewer = e,
  49886. t.elRoot = $("#profile_window"),
  49887. t.renderArea = t.elRoot.find("#profileCanvasContainer"),
  49888. t.svg = d3.select("svg#profileSVG"),
  49889. t.mouseIsDown = !1,
  49890. t.projectedBox = new kn,
  49891. t.pointclouds = new Map,
  49892. t.numPoints = 0,
  49893. t.lastAddPointsTimestamp = void 0,
  49894. t.mouse = new yn(0,0),
  49895. t.scale = new Cn(1,1,1),
  49896. t.autoFitEnabled = !0,
  49897. t.autoFit = !1;
  49898. e = "".concat(le.resourcePath, "/icons/arrow_cw.svg");
  49899. $("#potree_profile_rotate_cw").attr("src", e);
  49900. e = "".concat(le.resourcePath, "/icons/arrow_ccw.svg");
  49901. $("#potree_profile_rotate_ccw").attr("src", e);
  49902. e = "".concat(le.resourcePath, "/icons/arrow_up.svg");
  49903. $("#potree_profile_move_forward").attr("src", e);
  49904. e = "".concat(le.resourcePath, "/icons/arrow_down.svg");
  49905. $("#potree_profile_move_backward").attr("src", e);
  49906. e = "".concat(le.resourcePath, "/icons/file_csv_2d.svg");
  49907. $("#potree_download_csv_icon").attr("src", e);
  49908. e = "".concat(le.resourcePath, "/icons/file_las_3d.svg");
  49909. $("#potree_download_las_icon").attr("src", e);
  49910. e = "".concat(le.resourcePath, "/icons/close.svg");
  49911. return $("#closeProfileContainer").attr("src", e),
  49912. t.initTHREE(),
  49913. t.initSVG(),
  49914. t.initListeners(),
  49915. t.pRenderer = new Zm(t.renderer),
  49916. t.elRoot.i18n(),
  49917. t
  49918. }
  49919. return h(i, [{
  49920. key: "initListeners",
  49921. value: function() {
  49922. var g = this;
  49923. $(window).resize(function() {
  49924. g.enabled && g.render()
  49925. }),
  49926. this.renderArea.mousedown(function(e) {
  49927. g.mouseIsDown = !0
  49928. }),
  49929. this.renderArea.mouseup(function(e) {
  49930. g.mouseIsDown = !1
  49931. });
  49932. function y() {
  49933. var e = g.viewer.scene.getActiveCamera()
  49934. , t = g.viewer.renderer.domElement
  49935. , n = g.viewerPickSphere.position.distanceTo(e.position)
  49936. , t = 10 / Jf.projectedRadius(1, e, n, t.clientWidth, t.clientHeight);
  49937. g.viewerPickSphere.scale.set(t, t, t)
  49938. }
  49939. this.renderArea.mousemove(function(e) {
  49940. if (0 !== g.pointclouds.size) {
  49941. var t = g.renderArea[0].getBoundingClientRect()
  49942. , n = e.clientX - t.left
  49943. , t = e.clientY - t.top
  49944. , n = new yn(n,t);
  49945. if (g.mouseIsDown) {
  49946. g.autoFit = !1,
  49947. g.lastDrag = (new Date).getTime();
  49948. var i = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)]
  49949. , r = [g.scaleX.invert(n.x), g.scaleY.invert(n.y)];
  49950. g.camera.position.x -= r[0] - i[0],
  49951. g.camera.position.z -= r[1] - i[1],
  49952. g.render()
  49953. } else if (0 < g.pointclouds.size) {
  49954. var t = Math.abs(g.scaleX.invert(0) - g.scaleX.invert(40))
  49955. , r = g.scaleX.invert(n.x)
  49956. , i = g.scaleY.invert(n.y)
  49957. , a = g.selectPoint(r, i, t);
  49958. if (a) {
  49959. var o = a.point
  49960. , s = new Float64Array([o.position[0] + a.pointcloud.position.x, o.position[1] + a.pointcloud.position.y, o.position[2] + a.pointcloud.position.z]);
  49961. g.elRoot.find("#profileSelectionProperties").fadeIn(200),
  49962. g.pickSphere.visible = !0,
  49963. g.pickSphere.scale.set(.5 * t, .5 * t, .5 * t),
  49964. g.pickSphere.position.set(o.mileage, 0, s[2]),
  49965. (l = g.viewerPickSphere.position).set.apply(l, Q(s)),
  49966. g.viewer.scene.scene.children.includes(g.viewerPickSphere) || (g.viewer.scene.scene.add(g.viewerPickSphere),
  49967. g.viewer.hasEventListener("update", y) || g.viewer.addEventListener("update", y));
  49968. for (var l = g.elRoot.find("#profileSelectionProperties"), u = "<table>", c = 0, d = Object.keys(o); c < d.length; c++) {
  49969. var h, p = d[c], f = o[p], m = a.pointcloud.getAttribute(p), v = function(e) {
  49970. return e
  49971. };
  49972. m && 4 < m.type.size && function() {
  49973. var e = m.initialRange
  49974. , t = 1 / (e[1] - e[0])
  49975. , n = e[0];
  49976. v = function(e) {
  49977. return e / t + n
  49978. }
  49979. }(),
  49980. "position" === p ? (h = Q(s).map(function(e) {
  49981. return Jf.addCommas(e.toFixed(3))
  49982. }),
  49983. u += "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>x</td>\n\t\t\t\t\t\t\t\t\t<td>".concat(h[0], "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>y</td>\n\t\t\t\t\t\t\t\t\t<td>").concat(h[1], "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>z</td>\n\t\t\t\t\t\t\t\t\t<td>").concat(h[2], "</td>\n\t\t\t\t\t\t\t\t</tr>")) : "rgba" === p ? u += "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>".concat(p, "</td>\n\t\t\t\t\t\t\t\t\t<td>").concat(f.join(", "), "</td>\n\t\t\t\t\t\t\t\t</tr>") : "normal" !== p && (u += "mileage" === p ? "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>".concat(p, "</td>\n\t\t\t\t\t\t\t\t\t<td>").concat(f.toFixed(3), "</td>\n\t\t\t\t\t\t\t\t</tr>") : "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>".concat(p, "</td>\n\t\t\t\t\t\t\t\t\t<td>").concat(v(f), "</td>\n\t\t\t\t\t\t\t\t</tr>"))
  49984. }
  49985. l.html(u += "</table>"),
  49986. g.selectedPoint = o
  49987. } else {
  49988. g.viewer.scene.scene.add(g.viewerPickSphere);
  49989. l = g.viewer.scene.scene.children.indexOf(g.viewerPickSphere);
  49990. 0 <= l && g.viewer.scene.scene.children.splice(l, 1),
  49991. g.viewer.removeEventListener("update", y)
  49992. }
  49993. g.render()
  49994. }
  49995. g.mouse.copy(n)
  49996. }
  49997. });
  49998. function e(e) {
  49999. g.autoFit = !1;
  50000. var t = 0;
  50001. void 0 !== e.wheelDelta ? t = e.wheelDelta : void 0 !== e.detail && (t = -e.detail),
  50002. e = Math.sign(t),
  50003. t = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)],
  50004. 0 < e ? g.scale.multiplyScalar(1.1) : g.scale.multiplyScalar(100 / 110),
  50005. g.updateScales(),
  50006. e = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)],
  50007. g.camera.position.x -= e[0] - t[0],
  50008. g.camera.position.z -= e[1] - t[1],
  50009. g.render(),
  50010. g.updateScales()
  50011. }
  50012. $(this.renderArea)[0].addEventListener("mousewheel", e, !1),
  50013. $(this.renderArea)[0].addEventListener("DOMMouseScroll", e, !1),
  50014. $("#closeProfileContainer").click(function() {
  50015. g.hide()
  50016. });
  50017. function t() {
  50018. var e, t = new Gm, n = ue(g.pointclouds);
  50019. try {
  50020. for (n.s(); !(e = n.n()).done; ) {
  50021. var i, r = N(e.value, 2), a = r[0], o = ue(r[1].points);
  50022. try {
  50023. for (o.s(); !(i = o.n()).done; ) {
  50024. for (var s = i.value, l = s.data.position, u = new Float32Array(l), c = 0; c < s.numPoints; c++)
  50025. u[3 * c + 2] += a.position.z;
  50026. s.data.position = u,
  50027. t.add(s),
  50028. s.data.position = l
  50029. }
  50030. } catch (e) {
  50031. o.e(e)
  50032. } finally {
  50033. o.f()
  50034. }
  50035. }
  50036. } catch (e) {
  50037. n.e(e)
  50038. } finally {
  50039. n.f()
  50040. }
  50041. return t
  50042. }
  50043. $("#potree_download_csv_icon").click(function() {
  50044. var e = t()
  50045. , e = my.toString(e)
  50046. , e = new Blob([e],{
  50047. type: "text/string"
  50048. });
  50049. $("#potree_download_profile_ortho_link").attr("href", URL.createObjectURL(e))
  50050. }),
  50051. $("#potree_download_las_icon").click(function() {
  50052. var e = t()
  50053. , e = vy.toLAS(e)
  50054. , e = new Blob([e],{
  50055. type: "application/octet-binary"
  50056. });
  50057. $("#potree_download_profile_link").attr("href", URL.createObjectURL(e))
  50058. })
  50059. }
  50060. }, {
  50061. key: "selectPoint",
  50062. value: function(e, t, n) {
  50063. var i, r = {
  50064. distance: 1 / 0,
  50065. pointcloud: null,
  50066. points: null,
  50067. index: null
  50068. }, a = new ph(new yn(e - n,t - n),new yn(e + n,t + n)), o = ue(this.pointclouds);
  50069. try {
  50070. for (o.s(); !(i = o.n()).done; ) {
  50071. var s, l = N(i.value, 2), u = l[0], c = ue(l[1].points);
  50072. try {
  50073. for (c.s(); !(s = c.n()).done; ) {
  50074. var d = s.value;
  50075. if (new ph(new yn(d.projectedBox.min.x,d.projectedBox.min.z),new yn(d.projectedBox.max.x,d.projectedBox.max.z)).intersectsBox(a)) {
  50076. d.numPoints;
  50077. for (var h = 0; h < d.numPoints; h++) {
  50078. var p, f = d.data.mileage[h] - e, m = d.data.position[3 * h + 2] - t + u.position.z, v = Math.sqrt(f * f + m * m), g = v < n && v < r.distance, y = !0;
  50079. d.data.classification && (!(p = u.material.classification[d.data.classification[h]]) || p.visible && 0 !== p.color.w || (y = !1)),
  50080. g && y && (r = {
  50081. distance: v,
  50082. pointcloud: u,
  50083. points: d,
  50084. index: h
  50085. })
  50086. }
  50087. } else
  50088. d.numPoints
  50089. }
  50090. } catch (e) {
  50091. c.e(e)
  50092. } finally {
  50093. c.f()
  50094. }
  50095. }
  50096. } catch (e) {
  50097. o.e(e)
  50098. } finally {
  50099. o.f()
  50100. }
  50101. if (r.distance < 1 / 0) {
  50102. for (var w = r.points, b = {}, x = 0, E = Object.keys(w.data); x < E.length; x++) {
  50103. var _ = E[x]
  50104. , M = w.data[_]
  50105. , A = M.length / w.numPoints
  50106. , A = M.subarray(A * r.index, A * r.index + A);
  50107. 1 === A.length ? b[_] = A[0] : b[_] = A
  50108. }
  50109. return r.point = b,
  50110. r
  50111. }
  50112. return null
  50113. }
  50114. }, {
  50115. key: "initTHREE",
  50116. value: function() {
  50117. this.renderer = new ps({
  50118. alpha: !0,
  50119. premultipliedAlpha: !1
  50120. }),
  50121. this.renderer.setClearColor(0, 0),
  50122. this.renderer.setSize(10, 10),
  50123. this.renderer.autoClear = !1,
  50124. this.renderArea.append($(this.renderer.domElement)),
  50125. this.renderer.domElement.tabIndex = "2222",
  50126. $(this.renderer.domElement).css("width", "100%"),
  50127. $(this.renderer.domElement).css("height", "100%");
  50128. var e = this.renderer.getContext();
  50129. if (null == e.createVertexArray) {
  50130. var t = e.getExtension("OES_vertex_array_object");
  50131. if (!t)
  50132. throw new Error("OES_vertex_array_object extension not supported");
  50133. e.createVertexArray = t.createVertexArrayOES.bind(t),
  50134. e.bindVertexArray = t.bindVertexArrayOES.bind(t)
  50135. }
  50136. this.camera = new ed(-1e3,1e3,1e3,-1e3,-1e3,1e3),
  50137. window.axisYup || (this.camera.up.set(0, 0, 1),
  50138. this.camera.rotation.order = "ZXY",
  50139. this.camera.rotation.x = Math.PI / 2),
  50140. this.scene = new gs,
  50141. this.profileScene = new gs;
  50142. e = new Su(1,16,16),
  50143. t = new Xu;
  50144. this.pickSphere = new Hr(e,t),
  50145. this.scene.add(this.pickSphere),
  50146. this.viewerPickSphere = new Hr(e,t)
  50147. }
  50148. }, {
  50149. key: "initSVG",
  50150. value: function() {
  50151. var e = this.renderArea[0].clientWidth
  50152. , t = this.renderArea[0].clientHeight
  50153. , n = this.renderArea[0].offsetLeft;
  50154. this.svg.selectAll("*").remove(),
  50155. this.scaleX = d3.scale.linear().domain([this.camera.left + this.camera.position.x, this.camera.right + this.camera.position.x]).range([0, e]),
  50156. this.scaleY = d3.scale.linear().domain([this.camera.bottom + this.camera.position.z, this.camera.top + this.camera.position.z]).range([t, 0]),
  50157. this.xAxis = d3.svg.axis().scale(this.scaleX).orient("bottom").innerTickSize(-t).outerTickSize(1).tickPadding(10).ticks(e / 50),
  50158. this.yAxis = d3.svg.axis().scale(this.scaleY).orient("left").innerTickSize(-e).outerTickSize(1).tickPadding(10).ticks(t / 20),
  50159. this.elXAxis = this.svg.append("g").attr("class", "x axis").attr("transform", "translate(".concat(n, ", ").concat(t, ")")).call(this.xAxis),
  50160. this.elYAxis = this.svg.append("g").attr("class", "y axis").attr("transform", "translate(".concat(n, ", 0)")).call(this.yAxis)
  50161. }
  50162. }, {
  50163. key: "addPoints",
  50164. value: function(e, t) {
  50165. var n = this;
  50166. if (0 !== t.numPoints) {
  50167. var i, r, a = this.pointclouds.get(e);
  50168. a || (a = new wy(e),
  50169. this.pointclouds.set(e, a),
  50170. this.profileScene.add(a),
  50171. (i = function() {
  50172. n.render()
  50173. }
  50174. )(),
  50175. e.material.addEventListener("material_property_changed", i),
  50176. this.addEventListener("on_reset_once", function() {
  50177. e.material.removeEventListener("material_property_changed", i)
  50178. })),
  50179. a.addPoints(t),
  50180. this.projectedBox.union(a.projectedBox),
  50181. this.autoFit && this.autoFitEnabled && (r = this.renderArea[0].clientWidth,
  50182. t = this.renderArea[0].clientHeight,
  50183. r = r / (a = this.projectedBox.getSize(new Cn)).x,
  50184. a = t / a.z,
  50185. r = Math.min(r, a),
  50186. a = this.projectedBox.getCenter(new Cn),
  50187. this.scale.set(r, r, 1),
  50188. this.camera.position.copy(a)),
  50189. this.render();
  50190. var o, s = 0, l = ue(this.pointclouds.entries());
  50191. try {
  50192. for (l.s(); !(o = l.n()).done; ) {
  50193. var u = N(o.value, 2);
  50194. u[0];
  50195. s += u[1].points.reduce(function(e, t) {
  50196. return e + t.numPoints
  50197. }, 0)
  50198. }
  50199. } catch (e) {
  50200. l.e(e)
  50201. } finally {
  50202. l.f()
  50203. }
  50204. $("#profile_num_points").html(Jf.addCommas(s))
  50205. }
  50206. }
  50207. }, {
  50208. key: "reset",
  50209. value: function() {
  50210. this.lastReset = (new Date).getTime(),
  50211. this.dispatchEvent({
  50212. type: "on_reset_once"
  50213. }),
  50214. this.removeEventListeners("on_reset_once"),
  50215. this.autoFit = !0,
  50216. this.projectedBox = new kn;
  50217. var e, t = ue(this.pointclouds);
  50218. try {
  50219. for (t.s(); !(e = t.n()).done; ) {
  50220. var n = N(e.value, 2);
  50221. n[0];
  50222. n[1].dispose()
  50223. }
  50224. } catch (e) {
  50225. t.e(e)
  50226. } finally {
  50227. t.f()
  50228. }
  50229. this.pointclouds.clear(),
  50230. this.mouseIsDown = !1,
  50231. this.mouse.set(0, 0),
  50232. this.autoFitEnabled && this.scale.set(1, 1, 1),
  50233. this.pickSphere.visible = !1,
  50234. this.elRoot.find("#profileSelectionProperties").hide(),
  50235. this.render()
  50236. }
  50237. }, {
  50238. key: "show",
  50239. value: function() {
  50240. this.elRoot.fadeIn(),
  50241. this.enabled = !0
  50242. }
  50243. }, {
  50244. key: "hide",
  50245. value: function() {
  50246. this.elRoot.fadeOut(),
  50247. this.enabled = !1
  50248. }
  50249. }, {
  50250. key: "updateScales",
  50251. value: function() {
  50252. var e = this.renderArea[0].clientWidth
  50253. , t = this.renderArea[0].clientHeight
  50254. , n = -e / 2 / this.scale.x
  50255. , i = +e / 2 / this.scale.x
  50256. , r = +t / 2 / this.scale.y
  50257. , a = -t / 2 / this.scale.y;
  50258. this.camera.left = n,
  50259. this.camera.right = i,
  50260. this.camera.top = r,
  50261. this.camera.bottom = a,
  50262. this.camera.updateProjectionMatrix(),
  50263. this.scaleX.domain([this.camera.left + this.camera.position.x, this.camera.right + this.camera.position.x]).range([0, e]),
  50264. this.scaleY.domain([this.camera.bottom + this.camera.position.z, this.camera.top + this.camera.position.z]).range([t, 0]);
  50265. a = this.renderArea[0].offsetLeft;
  50266. this.xAxis.scale(this.scaleX).orient("bottom").innerTickSize(-t).outerTickSize(1).tickPadding(10).ticks(e / 50),
  50267. this.yAxis.scale(this.scaleY).orient("left").innerTickSize(-e).outerTickSize(1).tickPadding(10).ticks(t / 20),
  50268. this.elXAxis.attr("transform", "translate(".concat(a, ", ").concat(t, ")")).call(this.xAxis),
  50269. this.elYAxis.attr("transform", "translate(".concat(a, ", 0)")).call(this.yAxis)
  50270. }
  50271. }, {
  50272. key: "requestScaleUpdate",
  50273. value: function() {
  50274. void 0 === this.lastReset || void 0 === this.lastScaleUpdate || 100 < (new Date).getTime() - this.lastReset && 100 < (new Date).getTime() - this.lastScaleUpdate ? (this.updateScales(),
  50275. this.lastScaleUpdate = (new Date).getTime(),
  50276. this.scaleUpdatePending = !1) : this.scaleUpdatePending || (setTimeout(this.requestScaleUpdate.bind(this), 100),
  50277. this.scaleUpdatePending = !0)
  50278. }
  50279. }, {
  50280. key: "render",
  50281. value: function() {
  50282. var e = this.renderArea[0].clientWidth
  50283. , t = this.renderArea[0].clientHeight
  50284. , n = this.renderer
  50285. , i = this.pRenderer
  50286. , r = this.camera
  50287. , a = this.profileScene
  50288. , o = this.scene
  50289. , s = this.scaleX
  50290. , l = this.pickSphere;
  50291. n.setSize(e, t),
  50292. n.setClearColor(0, 0),
  50293. n.clear(!0, !0, !1);
  50294. var u, c = ue(this.pointclouds.keys());
  50295. try {
  50296. for (c.s(); !(u = c.n()).done; ) {
  50297. var d = u.value
  50298. , h = d.material
  50299. , p = this.pointclouds.get(d).material;
  50300. gy(h, p),
  50301. p.size = 2
  50302. }
  50303. } catch (e) {
  50304. c.e(e)
  50305. } finally {
  50306. c.f()
  50307. }
  50308. i.render(a, r, null);
  50309. s = Math.abs(s.invert(0) - s.invert(5));
  50310. 0 === s ? l.visible = !1 : (l.scale.set(s, s, s),
  50311. l.visible = !0),
  50312. n.render(o, r),
  50313. this.requestScaleUpdate()
  50314. }
  50315. }]),
  50316. i
  50317. }()
  50318. , xy = function() {
  50319. function n(e) {
  50320. var l = this;
  50321. O(this, n),
  50322. this.viewer = e,
  50323. this.profileWindow = e.profileWindow,
  50324. this.profile = null,
  50325. this.numPoints = 0,
  50326. this.threshold = 6e4,
  50327. this.rotateAmount = 10,
  50328. this.scheduledRecomputeTime = null,
  50329. this.enabled = !0,
  50330. this.requests = [],
  50331. this._recompute = function() {
  50332. l.recompute()
  50333. }
  50334. ,
  50335. this.viewer.addEventListener("scene_changed", function(e) {
  50336. e.oldScene.removeEventListener("pointcloud_added", l._recompute),
  50337. e.scene.addEventListener("pointcloud_added", l._recompute)
  50338. }),
  50339. this.viewer.scene.addEventListener("pointcloud_added", this._recompute),
  50340. $("#potree_profile_rotate_amount").val(parseInt(this.rotateAmount)),
  50341. $("#potree_profile_rotate_amount").on("input", function(e) {
  50342. var t = $("#potree_profile_rotate_amount").val();
  50343. isNaN(t) ? $("#potree_profile_rotate_amount").css("background-color", "#ff9999") : (t = parseFloat(t),
  50344. l.rotateAmount = t,
  50345. $("#potree_profile_rotate_amount").css("background-color", ""))
  50346. });
  50347. function t(e) {
  50348. var t = l.profile
  50349. , n = t.points
  50350. , i = n[0]
  50351. , r = n[n.length - 1]
  50352. , i = i.clone().add(r).multiplyScalar(.5)
  50353. , r = (new ni).makeTranslation(-i.x, -i.y, -i.z)
  50354. , e = (new ni).makeRotationZ(e)
  50355. , a = (new ni).makeTranslation(i.x, i.y, i.z).multiply(e).multiply(r)
  50356. , o = n.map(function(e) {
  50357. return e.clone().applyMatrix4(a)
  50358. });
  50359. l.profileWindow.autoFitEnabled = !1;
  50360. for (var s = 0; s < n.length; s++)
  50361. t.setPosition(s, o[s])
  50362. }
  50363. $("#potree_profile_rotate_cw").click(function() {
  50364. var e = gn.degToRad(l.rotateAmount);
  50365. t(-e)
  50366. }),
  50367. $("#potree_profile_rotate_ccw").click(function() {
  50368. var e = gn.degToRad(l.rotateAmount);
  50369. t(e)
  50370. }),
  50371. $("#potree_profile_move_forward").click(function() {
  50372. var e = l.profile
  50373. , t = e.points
  50374. , n = t[0]
  50375. , n = t[t.length - 1].clone().sub(n).normalize()
  50376. , i = new Cn(0,0,1).cross(n).clone().multiplyScalar(e.width / 2);
  50377. l.profileWindow.autoFitEnabled = !1;
  50378. for (var r = 0; r < t.length; r++)
  50379. e.setPosition(r, t[r].clone().add(i))
  50380. }),
  50381. $("#potree_profile_move_backward").click(function() {
  50382. var e = l.profile
  50383. , t = e.points
  50384. , n = t[0]
  50385. , n = t[t.length - 1].clone().sub(n).normalize()
  50386. , i = new Cn(0,0,1).cross(n).clone().multiplyScalar(-e.width / 2);
  50387. l.profileWindow.autoFitEnabled = !1;
  50388. for (var r = 0; r < t.length; r++)
  50389. e.setPosition(r, t[r].clone().add(i))
  50390. })
  50391. }
  50392. return h(n, [{
  50393. key: "setProfile",
  50394. value: function(e) {
  50395. null !== this.profile && this.profile !== e && (this.profile.removeEventListener("marker_moved", this._recompute),
  50396. this.profile.removeEventListener("marker_added", this._recompute),
  50397. this.profile.removeEventListener("marker_removed", this._recompute),
  50398. this.profile.removeEventListener("width_changed", this._recompute)),
  50399. this.profile = e,
  50400. this.profile.addEventListener("marker_moved", this._recompute),
  50401. this.profile.addEventListener("marker_added", this._recompute),
  50402. this.profile.addEventListener("marker_removed", this._recompute),
  50403. this.profile.addEventListener("width_changed", this._recompute),
  50404. this.recompute()
  50405. }
  50406. }, {
  50407. key: "reset",
  50408. value: function() {
  50409. if (this.profileWindow.reset(),
  50410. this.numPoints = 0,
  50411. this.profile) {
  50412. var e, t = ue(this.requests);
  50413. try {
  50414. for (t.s(); !(e = t.n()).done; )
  50415. e.value.cancel()
  50416. } catch (e) {
  50417. t.e(e)
  50418. } finally {
  50419. t.f()
  50420. }
  50421. }
  50422. }
  50423. }, {
  50424. key: "progressHandler",
  50425. value: function(e, t) {
  50426. var n, i = ue(t.segments);
  50427. try {
  50428. for (i.s(); !(n = i.n()).done; ) {
  50429. var r = n.value;
  50430. this.profileWindow.addPoints(e, r.points),
  50431. this.numPoints += r.points.numPoints
  50432. }
  50433. } catch (e) {
  50434. i.e(e)
  50435. } finally {
  50436. i.f()
  50437. }
  50438. }
  50439. }, {
  50440. key: "cancel",
  50441. value: function() {
  50442. var e, t = ue(this.requests);
  50443. try {
  50444. for (t.s(); !(e = t.n()).done; )
  50445. e.value.cancel()
  50446. } catch (e) {
  50447. t.e(e)
  50448. } finally {
  50449. t.f()
  50450. }
  50451. this.requests = []
  50452. }
  50453. }, {
  50454. key: "finishLevelThenCancel",
  50455. value: function() {
  50456. var e, t = ue(this.requests);
  50457. try {
  50458. for (t.s(); !(e = t.n()).done; )
  50459. e.value.finishLevelThenCancel()
  50460. } catch (e) {
  50461. t.e(e)
  50462. } finally {
  50463. t.f()
  50464. }
  50465. this.requests = []
  50466. }
  50467. }, {
  50468. key: "recompute",
  50469. value: function() {
  50470. var n = this;
  50471. if (this.profile && !(null !== this.scheduledRecomputeTime && this.scheduledRecomputeTime > (new Date).getTime())) {
  50472. this.scheduledRecomputeTime = (new Date).getTime() + 100,
  50473. this.scheduledRecomputeTime = null,
  50474. this.reset();
  50475. var i, t = ue(this.viewer.scene.pointclouds.filter(function(e) {
  50476. return e.visible
  50477. }));
  50478. try {
  50479. for (t.s(); !(i = t.n()).done; )
  50480. !function() {
  50481. var t = i.value
  50482. , e = t.getPointsInProfile(n.profile, null, {
  50483. onProgress: function(e) {
  50484. n.enabled && (n.progressHandler(t, e.points),
  50485. n.numPoints > n.threshold && n.finishLevelThenCancel())
  50486. },
  50487. onFinish: function(e) {
  50488. n.enabled
  50489. },
  50490. onCancel: function() {
  50491. n.enabled
  50492. }
  50493. });
  50494. n.requests.push(e)
  50495. }()
  50496. } catch (e) {
  50497. t.e(e)
  50498. } finally {
  50499. t.f()
  50500. }
  50501. }
  50502. }
  50503. }]),
  50504. n
  50505. }()
  50506. , Ey = function() {
  50507. function o() {
  50508. O(this, o)
  50509. }
  50510. return h(o, null, [{
  50511. key: "measurementToFeatures",
  50512. value: function(e) {
  50513. var t, n = e.points.map(function(e) {
  50514. return e.position.toArray()
  50515. }), i = [];
  50516. return 1 === n.length ? (t = {
  50517. type: "Feature",
  50518. geometry: {
  50519. type: "Point",
  50520. coordinates: n[0]
  50521. },
  50522. properties: {
  50523. name: e.name
  50524. }
  50525. },
  50526. i.push(t)) : 1 < n.length && !e.closed ? (t = {
  50527. type: "Feature",
  50528. geometry: {
  50529. type: "LineString",
  50530. coordinates: n
  50531. },
  50532. properties: {
  50533. name: e.name
  50534. }
  50535. },
  50536. i.push(t)) : 1 < n.length && e.closed && (n = {
  50537. type: "Feature",
  50538. geometry: {
  50539. type: "Polygon",
  50540. coordinates: [[].concat(Q(n), [n[0]])]
  50541. },
  50542. properties: {
  50543. name: e.name
  50544. }
  50545. },
  50546. i.push(n)),
  50547. e.showDistances && e.edgeLabels.forEach(function(e) {
  50548. e = {
  50549. type: "Feature",
  50550. geometry: {
  50551. type: "Point",
  50552. coordinates: e.position.toArray()
  50553. },
  50554. properties: {
  50555. distance: e.text
  50556. }
  50557. };
  50558. i.push(e)
  50559. }),
  50560. e.showArea && (e = {
  50561. type: "Feature",
  50562. geometry: {
  50563. type: "Point",
  50564. coordinates: e.areaLabel.position.toArray()
  50565. },
  50566. properties: {
  50567. area: e.areaLabel.text
  50568. }
  50569. },
  50570. i.push(e)),
  50571. i
  50572. }
  50573. }, {
  50574. key: "toString",
  50575. value: function(e) {
  50576. var t, n = [], i = ue(e = (e = !(e instanceof Array) ? [e] : e).filter(function(e) {
  50577. return e instanceof Wf
  50578. }));
  50579. try {
  50580. for (i.s(); !(t = i.n()).done; )
  50581. var r = t.value
  50582. , a = o.measurementToFeatures(r)
  50583. , n = n.concat(a)
  50584. } catch (e) {
  50585. i.e(e)
  50586. } finally {
  50587. i.f()
  50588. }
  50589. return JSON.stringify({
  50590. type: "FeatureCollection",
  50591. features: n
  50592. }, null, "\t")
  50593. }
  50594. }]),
  50595. o
  50596. }()
  50597. , _y = function() {
  50598. function d() {
  50599. O(this, d)
  50600. }
  50601. return h(d, null, [{
  50602. key: "measurementPointSection",
  50603. value: function(e) {
  50604. e = e.points[0].position;
  50605. return e ? "0\nCIRCLE\n8\nlayer_point\n10\n".concat(e.x, "\n20\n").concat(e.y, "\n30\n").concat(e.z, "\n40\n1.0\n") : ""
  50606. }
  50607. }, {
  50608. key: "measurementPolylineSection",
  50609. value: function(e) {
  50610. var t = 8;
  50611. e.closed && (t += 1);
  50612. var n, i = "0\nPOLYLINE\n8\nlayer_polyline\n62\n1\n66\n1\n10\n0.0\n20\n0.0\n30\n0.0\n70\n".concat(t, "\n"), r = 0, a = 0, o = 0, s = ue(e.points);
  50613. try {
  50614. for (s.s(); !(n = s.n()).done; ) {
  50615. var l = (l = n.value).position
  50616. , r = Math.max(r, l.x)
  50617. , a = Math.max(a, l.y)
  50618. , o = Math.max(o, l.z);
  50619. i += "0\nVERTEX\n8\n0\n10\n".concat(l.x, "\n20\n").concat(l.y, "\n30\n").concat(l.z, "\n70\n32\n")
  50620. }
  50621. } catch (e) {
  50622. s.e(e)
  50623. } finally {
  50624. s.f()
  50625. }
  50626. return i += "0\nSEQEND\n"
  50627. }
  50628. }, {
  50629. key: "measurementSection",
  50630. value: function(e) {
  50631. return 0 === e.points.length ? "" : 1 === e.points.length ? d.measurementPointSection(e) : 2 <= e.points.length ? d.measurementPolylineSection(e) : void 0
  50632. }
  50633. }, {
  50634. key: "toString",
  50635. value: function(e) {
  50636. var t, n = (e = (e = !(e instanceof Array) ? [e] : e).filter(function(e) {
  50637. return e instanceof Wf
  50638. })).filter(function(e) {
  50639. return e instanceof Wf
  50640. }).map(function(e) {
  50641. return e.points
  50642. }).reduce(function(e, t) {
  50643. return e.concat(t)
  50644. }).map(function(e) {
  50645. return e.position
  50646. }), i = new Cn(1 / 0,1 / 0,1 / 0), r = new Cn(-1 / 0,-1 / 0,-1 / 0), a = ue(n);
  50647. try {
  50648. for (a.s(); !(t = a.n()).done; ) {
  50649. var o = t.value;
  50650. i.min(o),
  50651. r.max(o)
  50652. }
  50653. } catch (e) {
  50654. a.e(e)
  50655. } finally {
  50656. a.f()
  50657. }
  50658. var s, n = "999\nDXF created from potree\n0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1006\n9\n$INSBASE\n10\n0.0\n20\n0.0\n30\n0.0\n9\n$EXTMIN\n10\n".concat(i.x, "\n20\n").concat(i.y, "\n30\n").concat(i.z, "\n9\n$EXTMAX\n10\n").concat(r.x, "\n20\n").concat(r.y, "\n30\n").concat(r.z, "\n0\nENDSEC\n"), l = "0\nSECTION\n2\nENTITIES\n", u = ue(e);
  50659. try {
  50660. for (u.s(); !(s = u.n()).done; ) {
  50661. var c = s.value;
  50662. l += d.measurementSection(c)
  50663. }
  50664. } catch (e) {
  50665. u.e(e)
  50666. } finally {
  50667. u.f()
  50668. }
  50669. return n + (l += "0\nENDSEC\n") + "0\nEOF"
  50670. }
  50671. }]),
  50672. d
  50673. }()
  50674. , My = function() {
  50675. function r(e, t, n) {
  50676. var i = this;
  50677. O(this, r),
  50678. this.viewer = e,
  50679. this.measurement = t,
  50680. this.propertiesPanel = n,
  50681. this._update = function() {
  50682. i.update()
  50683. }
  50684. }
  50685. return h(r, [{
  50686. key: "createCoordinatesTable",
  50687. value: function(e) {
  50688. var r, a = this, o = $('\n\t\t\t<table class="measurement_value_table">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>x</th>\n\t\t\t\t\t<th>y</th>\n\t\t\t\t\t<th>z</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t'), s = Potree.resourcePath + "/icons/copy.svg", t = ue(e);
  50689. try {
  50690. for (t.s(); !(r = t.n()).done; )
  50691. !function() {
  50692. var t = r.value
  50693. , e = Jf.addCommas(t.x.toFixed(3))
  50694. , n = Jf.addCommas(t.y.toFixed(3))
  50695. , i = Jf.addCommas(t.z.toFixed(3))
  50696. , i = $("\n\t\t\t\t<tr>\n\t\t\t\t\t<td><span>".concat(e, "</span></td>\n\t\t\t\t\t<td><span>").concat(n, "</span></td>\n\t\t\t\t\t<td><span>").concat(i, '</span></td>\n\t\t\t\t\t<td align="right" style="width: 25%">\n\t\t\t\t\t\t<img name="copy" title="copy" class="button-icon" src="').concat(s, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t'));
  50697. a.elCopy = i.find("img[name=copy]"),
  50698. a.elCopy.click(function() {
  50699. var e = t.toArray().map(function(e) {
  50700. return e.toFixed(3)
  50701. }).join(", ");
  50702. Jf.clipboardCopy(e),
  50703. a.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  50704. duration: 3e3
  50705. })
  50706. }),
  50707. o.append(i)
  50708. }()
  50709. } catch (e) {
  50710. t.e(e)
  50711. } finally {
  50712. t.f()
  50713. }
  50714. return o
  50715. }
  50716. }, {
  50717. key: "createAttributesTable",
  50718. value: function() {
  50719. var e = $('<table class="measurement_value_table"></table>');
  50720. this.measurement.points[0];
  50721. return e
  50722. }
  50723. }, {
  50724. key: "update",
  50725. value: function() {}
  50726. }]),
  50727. r
  50728. }()
  50729. , Ay = function() {
  50730. y(i, My);
  50731. var n = w(i);
  50732. function i(e, r, t) {
  50733. O(this, i);
  50734. var a = n.call(this, e, r, t)
  50735. , t = Potree.resourcePath + "/icons/remove.svg";
  50736. return a.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<table id="distances_table" class="measurement_value_table"></table>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<input type="button" name="make_profile" value="profile from measure" />\n\t\t\t\t\t</span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(t, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50737. a.elRemove = a.elContent.find("img[name=remove]"),
  50738. a.elRemove.click(function() {
  50739. a.viewer.scene.removeMeasurement(r)
  50740. }),
  50741. a.elMakeProfile = a.elContent.find("input[name=make_profile]"),
  50742. a.elMakeProfile.click(function() {
  50743. var e = new Kp;
  50744. e.name = r.name,
  50745. e.width = r.getTotalDistance() / 50;
  50746. var t, n = ue(r.points);
  50747. try {
  50748. for (n.s(); !(t = n.n()).done; ) {
  50749. var i = t.value;
  50750. e.addMarker(i.position.clone())
  50751. }
  50752. } catch (e) {
  50753. n.e(e)
  50754. } finally {
  50755. n.f()
  50756. }
  50757. a.viewer.scene.addProfile(e)
  50758. }),
  50759. a.propertiesPanel.addVolatileListener(r, "marker_added", a._update),
  50760. a.propertiesPanel.addVolatileListener(r, "marker_removed", a._update),
  50761. a.propertiesPanel.addVolatileListener(r, "marker_moved", a._update),
  50762. a.update(),
  50763. a
  50764. }
  50765. return h(i, [{
  50766. key: "update",
  50767. value: function() {
  50768. var e = this.elContent.find(".coordinates_table_container");
  50769. e.empty(),
  50770. e.append(this.createCoordinatesTable(this.measurement.points));
  50771. for (var t = this.measurement.points, n = [], i = 0; i < t.length - 1; i++) {
  50772. var r = t[i].distanceTo(t[i + 1]);
  50773. n.push(r.toFixed(3))
  50774. }
  50775. var e = this.measurement.getTotalDistance().toFixed(3)
  50776. , a = this.elContent.find("#distances_table");
  50777. a.empty();
  50778. for (var o = 0; o < n.length; o++) {
  50779. var s = n[o]
  50780. , s = $("\n\t\t\t\t<tr>\n\t\t\t\t\t<th>".concat(0 === o ? "Distances: " : "", '</th>\n\t\t\t\t\t<td style="width: 100%; padding-left: 10px">').concat(s, "</td>\n\t\t\t\t</tr>"));
  50781. a.append(s)
  50782. }
  50783. e = $('\n\t\t\t<tr>\n\t\t\t\t<th>Total: </td><td style="width: 100%; padding-left: 10px">'.concat(e, "</th>\n\t\t\t</tr>"));
  50784. a.append(e)
  50785. }
  50786. }]),
  50787. i
  50788. }()
  50789. , Ty = function() {
  50790. y(a, My);
  50791. var r = w(a);
  50792. function a(e, t, n) {
  50793. O(this, a);
  50794. var i = r.call(this, e, t, n)
  50795. , n = Potree.resourcePath + "/icons/remove.svg";
  50796. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<span class="attributes_table_container"></span>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(n, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50797. i.elRemove = i.elContent.find("img[name=remove]"),
  50798. i.elRemove.click(function() {
  50799. i.viewer.scene.removeMeasurement(t)
  50800. }),
  50801. i.propertiesPanel.addVolatileListener(t, "marker_added", i._update),
  50802. i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update),
  50803. i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update),
  50804. i.update(),
  50805. i
  50806. }
  50807. return h(a, [{
  50808. key: "update",
  50809. value: function() {
  50810. var e = this.elContent.find(".coordinates_table_container");
  50811. e.empty(),
  50812. e.append(this.createCoordinatesTable(this.measurement.points));
  50813. e = this.elContent.find(".attributes_table_container");
  50814. e.empty(),
  50815. e.append(this.createAttributesTable())
  50816. }
  50817. }]),
  50818. a
  50819. }()
  50820. , Sy = function() {
  50821. y(a, My);
  50822. var r = w(a);
  50823. function a(e, t, n) {
  50824. O(this, a);
  50825. var i = r.call(this, e, t, n)
  50826. , n = Potree.resourcePath + "/icons/remove.svg";
  50827. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<span style="font-weight: bold">Area: </span>\n\t\t\t\t<span id="measurement_area"></span>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(n, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50828. i.elRemove = i.elContent.find("img[name=remove]"),
  50829. i.elRemove.click(function() {
  50830. i.viewer.scene.removeMeasurement(t)
  50831. }),
  50832. i.propertiesPanel.addVolatileListener(t, "marker_added", i._update),
  50833. i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update),
  50834. i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update),
  50835. i.update(),
  50836. i
  50837. }
  50838. return h(a, [{
  50839. key: "update",
  50840. value: function() {
  50841. var e = this.elContent.find(".coordinates_table_container");
  50842. e.empty(),
  50843. e.append(this.createCoordinatesTable(this.measurement.points)),
  50844. this.elContent.find("#measurement_area").html(this.measurement.area.value.toFixed(3))
  50845. }
  50846. }]),
  50847. a
  50848. }()
  50849. , Cy = function() {
  50850. y(a, My);
  50851. var r = w(a);
  50852. function a(e, t, n) {
  50853. O(this, a);
  50854. var i = r.call(this, e, t, n)
  50855. , n = Potree.resourcePath + "/icons/remove.svg";
  50856. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<table class="measurement_value_table">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>α</th>\n\t\t\t\t\t\t<th>β</th>\n\t\t\t\t\t\t<th>γ</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align="center" id="angle_cell_alpha" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="angle_cell_betta" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="angle_cell_gamma" style="width: 33%"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(n, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50857. i.elRemove = i.elContent.find("img[name=remove]"),
  50858. i.elRemove.click(function() {
  50859. i.viewer.scene.removeMeasurement(t)
  50860. }),
  50861. i.propertiesPanel.addVolatileListener(t, "marker_added", i._update),
  50862. i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update),
  50863. i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update),
  50864. i.update(),
  50865. i
  50866. }
  50867. return h(a, [{
  50868. key: "update",
  50869. value: function() {
  50870. var e = this.elContent.find(".coordinates_table_container");
  50871. e.empty(),
  50872. e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) {
  50873. return e.position
  50874. })));
  50875. for (var t = [], n = 0; n < this.measurement.points.length; n++)
  50876. t.push(this.measurement.getAngle(n) * (180 / Math.PI));
  50877. var t = t.map(function(e) {
  50878. return e.toFixed(1) + "°"
  50879. })
  50880. , i = this.elContent.find("#angle_cell_alpha")
  50881. , r = this.elContent.find("#angle_cell_betta")
  50882. , e = this.elContent.find("#angle_cell_gamma");
  50883. i.html(t[0]),
  50884. r.html(t[1]),
  50885. e.html(t[2])
  50886. }
  50887. }]),
  50888. a
  50889. }()
  50890. , Py = function() {
  50891. y(a, My);
  50892. var r = w(a);
  50893. function a(e, t, n) {
  50894. O(this, a);
  50895. var i = r.call(this, e, t, n)
  50896. , n = Potree.resourcePath + "/icons/remove.svg";
  50897. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<table id="infos_table" class="measurement_value_table"></table>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(n, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50898. i.elRemove = i.elContent.find("img[name=remove]"),
  50899. i.elRemove.click(function() {
  50900. i.viewer.scene.removeMeasurement(t)
  50901. }),
  50902. i.propertiesPanel.addVolatileListener(t, "marker_added", i._update),
  50903. i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update),
  50904. i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update),
  50905. i.update(),
  50906. i
  50907. }
  50908. return h(a, [{
  50909. key: "update",
  50910. value: function() {
  50911. var e = this.elContent.find(".coordinates_table_container");
  50912. e.empty(),
  50913. e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) {
  50914. return e.position
  50915. })));
  50916. var t, n, i, r, a = this.elContent.find("#infos_table");
  50917. 3 === this.measurement.points.length ? (t = this.measurement.points[0].position,
  50918. i = this.measurement.points[1].position,
  50919. r = this.measurement.points[2].position,
  50920. e = (n = Potree.Utils.computeCircleCenter(t, i, r)).distanceTo(t),
  50921. i = 2 * Math.PI * e,
  50922. t = "".concat((r = function(e) {
  50923. return Potree.Utils.addCommas(e.toFixed(3))
  50924. }
  50925. )(n.x), " ").concat(r(n.y), " ").concat(r(n.z)),
  50926. n = r(e),
  50927. e = r(i),
  50928. r = 'style="width: 100%; padding: 5px;"',
  50929. a.html("\n\t\t\t<tr>\n\t\t\t\t<th ".concat(i = 'style="text-align: left"', ">Center: </th>\n\t\t\t\t<td ").concat(r, "></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td ").concat(r, ' colspan="2">\n\t\t\t\t\t').concat(t, "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th ").concat(i, ">Radius: </th>\n\t\t\t\t<td ").concat(r, ">").concat(n, "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th ").concat(i, ">Circumference: </th>\n\t\t\t\t<td ").concat(r, ">").concat(e, "</td>\n\t\t\t</tr>\n\t\t"))) : a.empty()
  50930. }
  50931. }]),
  50932. a
  50933. }()
  50934. , Dy = function() {
  50935. y(a, My);
  50936. var r = w(a);
  50937. function a(e, t, n) {
  50938. O(this, a);
  50939. var i = r.call(this, e, t, n)
  50940. , n = Potree.resourcePath + "/icons/remove.svg";
  50941. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<span id="height_label">Height: </span><br>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(n, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50942. i.elRemove = i.elContent.find("img[name=remove]"),
  50943. i.elRemove.click(function() {
  50944. i.viewer.scene.removeMeasurement(t)
  50945. }),
  50946. i.propertiesPanel.addVolatileListener(t, "marker_added", i._update),
  50947. i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update),
  50948. i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update),
  50949. i.update(),
  50950. i
  50951. }
  50952. return h(a, [{
  50953. key: "update",
  50954. value: function() {
  50955. var e = this.elContent.find(".coordinates_table_container");
  50956. e.empty(),
  50957. e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) {
  50958. return e.position
  50959. })));
  50960. var t = this.measurement.points.slice().sort(function(e, t) {
  50961. return e.position.z - t.position.z
  50962. })
  50963. , e = t[0].position.clone()
  50964. , t = t[t.length - 1].position.clone()
  50965. , e = e.z
  50966. , e = (e = t.z - e).toFixed(3);
  50967. this.elHeightLabel = this.elContent.find("#height_label"),
  50968. this.elHeightLabel.html("<b>Height:</b> ".concat(e))
  50969. }
  50970. }]),
  50971. a
  50972. }()
  50973. , ky = function() {
  50974. y(l, My);
  50975. var e, s = w(l);
  50976. function l(e, t, n) {
  50977. O(this, l);
  50978. var i = s.call(this, e, t, n)
  50979. , r = Potree.resourcePath + "/icons/copy.svg"
  50980. , a = Potree.resourcePath + "/icons/remove.svg"
  50981. , o = new Map([[Zp, "length"], [Qp, "rx"]]).get(t.constructor)
  50982. , e = new Map([[Zp, "width"], [Qp, "ry"]]).get(t.constructor)
  50983. , n = new Map([[Zp, "height"], [Qp, "rz"]]).get(t.constructor);
  50984. return i.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\n\t\t\t\t<table class="measurement_value_table">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>α</th>\n\t\t\t\t\t\t<th>β</th>\n\t\t\t\t\t\t<th>γ</th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align="center" id="angle_cell_alpha" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="angle_cell_betta" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="angle_cell_gamma" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="right" style="width: 25%">\n\t\t\t\t\t\t\t<img name="copyRotation" title="copy" class="button-icon" src="'.concat(r, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\n\t\t\t\t<table class="measurement_value_table">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>').concat(o, "</th>\n\t\t\t\t\t\t<th>").concat(e, "</th>\n\t\t\t\t\t\t<th>").concat(n, '</th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align="center" id="cell_length" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="cell_width" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="center" id="cell_height" style="width: 33%"></td>\n\t\t\t\t\t\t<td align="right" style="width: 25%">\n\t\t\t\t\t\t\t<img name="copyScale" title="copy" class="button-icon" src="').concat(r, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\n\t\t\t\t<br>\n\t\t\t\t<span style="font-weight: bold">Volume: </span>\n\t\t\t\t<span id="measurement_volume"></span>\n\n\t\t\t\t\x3c!--\n\t\t\t\t<li>\n\t\t\t\t\t<label style="whitespace: nowrap">\n\t\t\t\t\t\t<input id="volume_show" type="checkbox"/>\n\t\t\t\t\t\t<span>show volume</span>\n\t\t\t\t\t</label>\n\t\t\t\t</li>--\x3e\n\n\t\t\t\t<li>\n\t\t\t\t\t<label style="whitespace: nowrap">\n\t\t\t\t\t\t<input id="volume_clip" type="checkbox"/>\n\t\t\t\t\t\t<span>make clip volume</span>\n\t\t\t\t\t</label>\n\t\t\t\t</li>\n\n\t\t\t\t<li style="margin-top: 10px">\n\t\t\t\t\t<input name="download_volume" type="button" value="prepare download" style="width: 100%" />\n\t\t\t\t\t<div name="download_message"></div>\n\t\t\t\t</li>\n\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<li style="display: grid; grid-template-columns: auto auto; grid-column-gap: 5px; margin-top: 10px">\n\t\t\t\t\t<input id="volume_reset_orientation" type="button" value="reset orientation"/>\n\t\t\t\t\t<input id="volume_make_uniform" type="button" value="make uniform"/>\n\t\t\t\t</li>\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="').concat(a, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  50985. i.elDownloadButton = i.elContent.find("input[name=download_volume]"),
  50986. i.propertiesPanel.viewer.server ? i.elDownloadButton.click(function() {
  50987. return i.download()
  50988. }) : i.elDownloadButton.hide(),
  50989. i.elCopyRotation = i.elContent.find("img[name=copyRotation]"),
  50990. i.elCopyRotation.click(function() {
  50991. var e = i.measurement.rotation.toArray().slice(0, 3).map(function(e) {
  50992. return e.toFixed(3)
  50993. }).join(", ");
  50994. Jf.clipboardCopy(e),
  50995. i.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  50996. duration: 3e3
  50997. })
  50998. }),
  50999. i.elCopyScale = i.elContent.find("img[name=copyScale]"),
  51000. i.elCopyScale.click(function() {
  51001. var e = i.measurement.scale.toArray().map(function(e) {
  51002. return e.toFixed(3)
  51003. }).join(", ");
  51004. Jf.clipboardCopy(e),
  51005. i.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  51006. duration: 3e3
  51007. })
  51008. }),
  51009. i.elRemove = i.elContent.find("img[name=remove]"),
  51010. i.elRemove.click(function() {
  51011. i.viewer.scene.removeVolume(t)
  51012. }),
  51013. i.elContent.find("#volume_reset_orientation").click(function() {
  51014. t.rotation.set(0, 0, 0)
  51015. }),
  51016. i.elContent.find("#volume_make_uniform").click(function() {
  51017. var e = (t.scale.x + t.scale.y + t.scale.z) / 3;
  51018. t.scale.set(e, e, e)
  51019. }),
  51020. i.elCheckClip = i.elContent.find("#volume_clip"),
  51021. i.elCheckClip.click(function(e) {
  51022. i.measurement.clip = e.target.checked
  51023. }),
  51024. i.elCheckShow = i.elContent.find("#volume_show"),
  51025. i.elCheckShow.click(function(e) {
  51026. i.measurement.visible = e.target.checked
  51027. }),
  51028. i.propertiesPanel.addVolatileListener(t, "position_changed", i._update),
  51029. i.propertiesPanel.addVolatileListener(t, "orientation_changed", i._update),
  51030. i.propertiesPanel.addVolatileListener(t, "scale_changed", i._update),
  51031. i.propertiesPanel.addVolatileListener(t, "clip_changed", i._update),
  51032. i.update(),
  51033. i
  51034. }
  51035. return h(l, [{
  51036. key: "download",
  51037. value: (e = r(regeneratorRuntime.mark(function e() {
  51038. var t, n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R;
  51039. return regeneratorRuntime.wrap(function(e) {
  51040. for (; ; )
  51041. switch (e.prev = e.next) {
  51042. case 0:
  51043. for (u = this.measurement,
  51044. w = [],
  51045. v = u.matrixWorld,
  51046. t = new Cn(.5,0,0).applyMatrix4(v),
  51047. n = new Cn(-.5,0,0).applyMatrix4(v),
  51048. i = new Cn(0,.5,0).applyMatrix4(v),
  51049. r = new Cn(0,-.5,0).applyMatrix4(v),
  51050. m = new Cn(0,0,.5).applyMatrix4(v),
  51051. f = new Cn(0,0,-.5).applyMatrix4(v),
  51052. a = (new Cn).subVectors(n, t).normalize(),
  51053. o = a.clone().multiplyScalar(-1),
  51054. s = (new Cn).subVectors(r, i).normalize(),
  51055. l = s.clone().multiplyScalar(-1),
  51056. u = (new Cn).subVectors(f, m).normalize(),
  51057. v = u.clone().multiplyScalar(-1),
  51058. m = [(new ki).setFromNormalAndCoplanarPoint(a, t), (new ki).setFromNormalAndCoplanarPoint(o, n), (new ki).setFromNormalAndCoplanarPoint(s, i), (new ki).setFromNormalAndCoplanarPoint(l, r), (new ki).setFromNormalAndCoplanarPoint(u, m), (new ki).setFromNormalAndCoplanarPoint(v, f)],
  51059. c = [],
  51060. d = 0,
  51061. h = m; d < h.length; d++)
  51062. p = [(p = h[d]).normal.toArray(), p.constant].join(","),
  51063. p = "[".concat(p, "]"),
  51064. c.push(p);
  51065. v = "[" + c.join(",") + "]",
  51066. w.push(v),
  51067. f = w.join(","),
  51068. m = [],
  51069. v = ue(this.viewer.scene.pointclouds),
  51070. e.prev = 23,
  51071. v.s();
  51072. case 25:
  51073. if ((y = v.n()).done) {
  51074. e.next = 39;
  51075. break
  51076. }
  51077. if ((g = y.value).visible) {
  51078. e.next = 29;
  51079. break
  51080. }
  51081. return e.abrupt("continue", 37);
  51082. case 29:
  51083. w = g.pcoGeometry.offset.clone(),
  51084. y = (y = new ni).makeTranslation.apply(y, Q(w.multiplyScalar(-1).toArray())),
  51085. w = g.matrixWorld,
  51086. w = (new ni).multiplyMatrices(w, y),
  51087. y = "".concat(window.location.pathname, "/../").concat(g.pcoGeometry.url),
  51088. w = {
  51089. path: y,
  51090. transform: w.elements
  51091. },
  51092. w = JSON.stringify(w),
  51093. m.push(w);
  51094. case 37:
  51095. e.next = 25;
  51096. break;
  51097. case 39:
  51098. e.next = 44;
  51099. break;
  51100. case 41:
  51101. e.prev = 41,
  51102. e.t0 = e.catch(23),
  51103. v.e(e.t0);
  51104. case 44:
  51105. return e.prev = 44,
  51106. v.f(),
  51107. e.finish(44);
  51108. case 47:
  51109. return M = m.join(","),
  51110. b = this.elContent.find("div[name=download_message]"),
  51111. x = function(e) {
  51112. b.html('<div style="color: #ff0000">ERROR: '.concat(e, "</div>"))
  51113. }
  51114. ,
  51115. E = function(e) {
  51116. b.html("".concat(e))
  51117. }
  51118. ,
  51119. _ = null,
  51120. M = "".concat(viewer.server, "/create_regions_filter?pointclouds=[").concat(M, "]&regions=[").concat(f, "]"),
  51121. E("estimating results ..."),
  51122. e.next = 56,
  51123. fetch(M);
  51124. case 56:
  51125. return M = e.sent,
  51126. e.next = 59,
  51127. M.json();
  51128. case 59:
  51129. if ((A = e.sent).handle) {
  51130. e.next = 65;
  51131. break
  51132. }
  51133. return x(A.message),
  51134. e.abrupt("return");
  51135. case 65:
  51136. _ = A.handle;
  51137. case 66:
  51138. T = "".concat(viewer.server, "/check_regions_filter?handle=").concat(_),
  51139. S = function(n) {
  51140. return new Promise(function(e, t) {
  51141. setTimeout(function() {
  51142. e()
  51143. }, n)
  51144. }
  51145. )
  51146. }
  51147. ,
  51148. C = function(e) {
  51149. var t = e.progress
  51150. , e = e.estimate
  51151. , e = t["processed points"] / e.points
  51152. , e = parseInt(100 * e);
  51153. E("progress: ".concat(e, "%"))
  51154. }
  51155. ,
  51156. P = function(e) {
  51157. var t = "downloads ready: <br>";
  51158. t += "<ul>";
  51159. for (var n = 0; n < e.pointclouds.length; n++) {
  51160. var i = "".concat(viewer.server, "/download_regions_filter_result?handle=").concat(_, "&index=").concat(n);
  51161. t += '<li><a href="'.concat(i, '">result_').concat(n, ".las</a> </li>\n")
  51162. }
  51163. var r = "".concat(viewer.server, "/download_regions_filter_report?handle=").concat(_);
  51164. t += '<li> <a href="'.concat(r, '">report.json</a> </li>\n'),
  51165. E(t += "</ul>")
  51166. }
  51167. ,
  51168. D = function(e) {
  51169. e = "Unexpected Response. <br>status: ".concat(e.status, " <br>message: ").concat(e.message);
  51170. E(e)
  51171. }
  51172. ,
  51173. k = function(e) {
  51174. e = "ERROR: ".concat(e.message);
  51175. throw x(e),
  51176. new Error(e)
  51177. }
  51178. ,
  51179. B = Date.now();
  51180. case 73:
  51181. return e.next = 76,
  51182. fetch(T);
  51183. case 76:
  51184. return R = e.sent,
  51185. e.next = 79,
  51186. R.json();
  51187. case 79:
  51188. if ("ERROR" !== (L = e.sent).status) {
  51189. e.next = 84;
  51190. break
  51191. }
  51192. k(L),
  51193. e.next = 94;
  51194. break;
  51195. case 84:
  51196. if ("FILTERING" !== L.status) {
  51197. e.next = 88;
  51198. break
  51199. }
  51200. C(L),
  51201. e.next = 94;
  51202. break;
  51203. case 88:
  51204. if ("FINISHED" === L.status)
  51205. return P(L),
  51206. e.abrupt("break", 100);
  51207. e.next = 93;
  51208. break;
  51209. case 93:
  51210. D(L);
  51211. case 94:
  51212. return R = (Date.now() - B) / 1e3,
  51213. R = R < 10 ? 100 : 1e3,
  51214. e.next = 98,
  51215. S(R);
  51216. case 98:
  51217. e.next = 73;
  51218. break;
  51219. case 100:
  51220. case "end":
  51221. return e.stop()
  51222. }
  51223. }, e, this, [[23, 41, 44, 47]])
  51224. })),
  51225. function() {
  51226. return e.apply(this, arguments)
  51227. }
  51228. )
  51229. }, {
  51230. key: "update",
  51231. value: function() {
  51232. var e = this.elContent.find(".coordinates_table_container");
  51233. e.empty(),
  51234. e.append(this.createCoordinatesTable([this.measurement.position]));
  51235. var t = this.measurement.rotation.toVector3();
  51236. t = (t = (t = t.toArray()).map(function(e) {
  51237. return 180 * e / Math.PI
  51238. })).map(function(e) {
  51239. return e.toFixed(1) + "°"
  51240. });
  51241. var n = this.elContent.find("#angle_cell_alpha")
  51242. , i = this.elContent.find("#angle_cell_betta")
  51243. , e = this.elContent.find("#angle_cell_gamma");
  51244. n.html(t[0]),
  51245. i.html(t[1]),
  51246. e.html(t[2]);
  51247. n = (n = this.measurement.scale.toArray()).map(function(e) {
  51248. return Jf.addCommas(e.toFixed(2))
  51249. }),
  51250. i = this.elContent.find("#cell_length"),
  51251. e = this.elContent.find("#cell_width"),
  51252. t = this.elContent.find("#cell_height");
  51253. i.html(n[0]),
  51254. e.html(n[1]),
  51255. t.html(n[2]);
  51256. t = this.elContent.find("#measurement_volume"),
  51257. n = this.measurement.getVolume();
  51258. t.html(Jf.addCommas(n.toFixed(2))),
  51259. this.elCheckClip.prop("checked", this.measurement.clip),
  51260. this.elCheckShow.prop("checked", this.measurement.visible)
  51261. }
  51262. }]),
  51263. l
  51264. }()
  51265. , By = function() {
  51266. y(o, My);
  51267. var e, a = w(o);
  51268. function o(e, i, t) {
  51269. O(this, o);
  51270. var n = a.call(this, e, i, t)
  51271. , t = Potree.resourcePath + "/icons/remove.svg";
  51272. n.elContent = $('\n\t\t\t<div class="measurement_content selectable">\n\t\t\t\t<span class="coordinates_table_container"></span>\n\t\t\t\t<br>\n\t\t\t\t<span style="display:flex">\n\t\t\t\t\t<span style="display:flex; align-items: center; padding-right: 10px">Width: </span>\n\t\t\t\t\t<input id="sldProfileWidth" name="sldProfileWidth" value="5.06" style="flex-grow: 1; width:100%">\n\t\t\t\t</span>\n\t\t\t\t<br>\n\n\t\t\t\t<li style="margin-top: 10px">\n\t\t\t\t\t<input name="download_profile" type="button" value="prepare download" style="width: 100%" />\n\t\t\t\t\t<div name="download_message"></div>\n\t\t\t\t</li>\n\n\t\t\t\t<br>\n\n\t\t\t\t<input type="button" id="show_2d_profile" value="show 2d profile" style="width: 100%"/>\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t<div style="display: flex; margin-top: 12px">\n\t\t\t\t\t<span></span>\n\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t<img name="remove" class="button-icon" src="'.concat(t, '" style="width: 16px; height: 16px"/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t')),
  51273. n.elRemove = n.elContent.find("img[name=remove]"),
  51274. n.elRemove.click(function() {
  51275. n.viewer.scene.removeProfile(i)
  51276. }),
  51277. n.elDownloadButton = n.elContent.find("input[name=download_profile]"),
  51278. n.propertiesPanel.viewer.server ? n.elDownloadButton.click(function() {
  51279. return n.download()
  51280. }) : n.elDownloadButton.hide();
  51281. var r = n.elContent.find("#sldProfileWidth");
  51282. r.spinner({
  51283. min: 0,
  51284. max: 1e7,
  51285. step: .01,
  51286. numberFormat: "n",
  51287. start: function() {},
  51288. spin: function(e, t) {
  51289. var n = r.spinner("value");
  51290. i.setWidth(n)
  51291. },
  51292. change: function(e, t) {
  51293. var n = r.spinner("value");
  51294. i.setWidth(n)
  51295. },
  51296. stop: function(e, t) {
  51297. var n = r.spinner("value");
  51298. i.setWidth(n)
  51299. },
  51300. incremental: function(e) {
  51301. var t = r.spinner("value")
  51302. , n = r.spinner("option", "step");
  51303. return Math.max(1, parseInt(.05 * t / n))
  51304. }
  51305. }),
  51306. r.spinner("value", i.getWidth()),
  51307. r.spinner("widget").css("width", "100%");
  51308. return n.propertiesPanel.addVolatileListener(i, "width_changed", function(e) {
  51309. r.spinner("value") !== i.getWidth() && r.spinner("value", i.getWidth())
  51310. }),
  51311. n.elContent.find("#show_2d_profile").click(function() {
  51312. n.propertiesPanel.viewer.profileWindow.show(),
  51313. n.propertiesPanel.viewer.profileWindowController.setProfile(i)
  51314. }),
  51315. n.propertiesPanel.addVolatileListener(i, "marker_added", n._update),
  51316. n.propertiesPanel.addVolatileListener(i, "marker_removed", n._update),
  51317. n.propertiesPanel.addVolatileListener(i, "marker_moved", n._update),
  51318. n.update(),
  51319. n
  51320. }
  51321. return h(o, [{
  51322. key: "update",
  51323. value: function() {
  51324. var e = this.elContent.find(".coordinates_table_container");
  51325. e.empty(),
  51326. e.append(this.createCoordinatesTable(this.measurement.points))
  51327. }
  51328. }, {
  51329. key: "download",
  51330. value: (e = r(regeneratorRuntime.mark(function e() {
  51331. var t, n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R, F, I, O, z, N, U, G, H, V;
  51332. return regeneratorRuntime.wrap(function(e) {
  51333. for (; ; )
  51334. switch (e.prev = e.next) {
  51335. case 0:
  51336. A = this.measurement,
  51337. t = [],
  51338. C = A.getSegments(),
  51339. n = A.width,
  51340. i = ue(C);
  51341. try {
  51342. for (i.s(); !(r = i.n()).done; ) {
  51343. for (a = r.value,
  51344. o = a.start.clone().multiply(new Cn(1,1,0)),
  51345. s = a.end.clone().multiply(new Cn(1,1,0)),
  51346. l = (new Cn).addVectors(o, s).multiplyScalar(.5),
  51347. u = (new Cn).subVectors(s, o).normalize(),
  51348. c = (new Cn).subVectors(o, s).normalize(),
  51349. d = new Cn(0,0,1),
  51350. h = (new Cn).crossVectors(u, d),
  51351. p = (new Cn).crossVectors(c, d),
  51352. console.log(p),
  51353. f = h.clone().multiplyScalar(.5 * n).add(l),
  51354. m = p.clone().multiplyScalar(.5 * n).add(l),
  51355. v = [(new ki).setFromNormalAndCoplanarPoint(u, o), (new ki).setFromNormalAndCoplanarPoint(c, s), (new ki).setFromNormalAndCoplanarPoint(p, f), (new ki).setFromNormalAndCoplanarPoint(h, m)],
  51356. g = [],
  51357. y = 0,
  51358. w = v; y < w.length; y++)
  51359. x = [(b = w[y]).normal.toArray(), b.constant].join(","),
  51360. x = "[".concat(x, "]"),
  51361. g.push(x);
  51362. E = "[" + g.join(",") + "]",
  51363. t.push(E)
  51364. }
  51365. } catch (e) {
  51366. i.e(e)
  51367. } finally {
  51368. i.f()
  51369. }
  51370. _ = t.join(","),
  51371. M = [],
  51372. A = ue(this.viewer.scene.pointclouds),
  51373. e.prev = 9,
  51374. A.s();
  51375. case 11:
  51376. if ((S = A.n()).done) {
  51377. e.next = 25;
  51378. break
  51379. }
  51380. if ((T = S.value).visible) {
  51381. e.next = 15;
  51382. break
  51383. }
  51384. return e.abrupt("continue", 23);
  51385. case 15:
  51386. C = T.pcoGeometry.offset.clone(),
  51387. S = (S = new ni).makeTranslation.apply(S, Q(C.multiplyScalar(-1).toArray())),
  51388. C = T.matrixWorld,
  51389. C = (new ni).multiplyMatrices(C, S),
  51390. S = "".concat(window.location.pathname, "/../").concat(T.pcoGeometry.url),
  51391. C = {
  51392. path: S,
  51393. transform: C.elements
  51394. },
  51395. C = JSON.stringify(C),
  51396. M.push(C);
  51397. case 23:
  51398. e.next = 11;
  51399. break;
  51400. case 25:
  51401. e.next = 30;
  51402. break;
  51403. case 27:
  51404. e.prev = 27,
  51405. e.t0 = e.catch(9),
  51406. A.e(e.t0);
  51407. case 30:
  51408. return e.prev = 30,
  51409. A.f(),
  51410. e.finish(30);
  51411. case 33:
  51412. return L = M.join(","),
  51413. P = this.elContent.find("div[name=download_message]"),
  51414. D = function(e) {
  51415. P.html('<div style="color: #ff0000">ERROR: '.concat(e, "</div>"))
  51416. }
  51417. ,
  51418. k = function(e) {
  51419. P.html("".concat(e))
  51420. }
  51421. ,
  51422. B = null,
  51423. L = "".concat(viewer.server, "/create_regions_filter?pointclouds=[").concat(L, "]&regions=[").concat(_, "]"),
  51424. k("estimating results ..."),
  51425. e.next = 42,
  51426. fetch(L);
  51427. case 42:
  51428. return L = e.sent,
  51429. e.next = 45,
  51430. L.json();
  51431. case 45:
  51432. if ((R = e.sent).handle) {
  51433. e.next = 51;
  51434. break
  51435. }
  51436. return D(R.message),
  51437. e.abrupt("return");
  51438. case 51:
  51439. B = R.handle;
  51440. case 52:
  51441. F = "".concat(viewer.server, "/check_regions_filter?handle=").concat(B),
  51442. I = function(n) {
  51443. return new Promise(function(e, t) {
  51444. setTimeout(function() {
  51445. e()
  51446. }, n)
  51447. }
  51448. )
  51449. }
  51450. ,
  51451. O = function(e) {
  51452. var t = e.progress
  51453. , e = e.estimate
  51454. , e = t["processed points"] / e.points
  51455. , e = parseInt(100 * e);
  51456. k("progress: ".concat(e, "%"))
  51457. }
  51458. ,
  51459. z = function(e) {
  51460. var t = "downloads ready: <br>";
  51461. t += "<ul>";
  51462. for (var n = 0; n < e.pointclouds.length; n++) {
  51463. var i = "".concat(viewer.server, "/download_regions_filter_result?handle=").concat(B, "&index=").concat(n);
  51464. t += '<li><a href="'.concat(i, '">result_').concat(n, ".las</a> </li>\n")
  51465. }
  51466. var r = "".concat(viewer.server, "/download_regions_filter_report?handle=").concat(B);
  51467. t += '<li> <a href="'.concat(r, '">report.json</a> </li>\n'),
  51468. k(t += "</ul>")
  51469. }
  51470. ,
  51471. N = function(e) {
  51472. e = "Unexpected Response. <br>status: ".concat(e.status, " <br>message: ").concat(e.message);
  51473. k(e)
  51474. }
  51475. ,
  51476. U = function(e) {
  51477. e = "ERROR: ".concat(e.message);
  51478. throw D(e),
  51479. new Error(e)
  51480. }
  51481. ,
  51482. G = Date.now();
  51483. case 59:
  51484. return e.next = 62,
  51485. fetch(F);
  51486. case 62:
  51487. return V = e.sent,
  51488. e.next = 65,
  51489. V.json();
  51490. case 65:
  51491. if ("ERROR" !== (H = e.sent).status) {
  51492. e.next = 70;
  51493. break
  51494. }
  51495. U(H),
  51496. e.next = 80;
  51497. break;
  51498. case 70:
  51499. if ("FILTERING" !== H.status) {
  51500. e.next = 74;
  51501. break
  51502. }
  51503. O(H),
  51504. e.next = 80;
  51505. break;
  51506. case 74:
  51507. if ("FINISHED" === H.status)
  51508. return z(H),
  51509. e.abrupt("break", 86);
  51510. e.next = 79;
  51511. break;
  51512. case 79:
  51513. N(H);
  51514. case 80:
  51515. return V = (Date.now() - G) / 1e3,
  51516. V = V < 10 ? 100 : 1e3,
  51517. e.next = 84,
  51518. I(V);
  51519. case 84:
  51520. e.next = 59;
  51521. break;
  51522. case 86:
  51523. case "end":
  51524. return e.stop()
  51525. }
  51526. }, e, this, [[9, 27, 30, 33]])
  51527. })),
  51528. function() {
  51529. return e.apply(this, arguments)
  51530. }
  51531. )
  51532. }]),
  51533. o
  51534. }()
  51535. , Ly = function() {
  51536. function i(e, t) {
  51537. var n = this;
  51538. O(this, i),
  51539. this.viewer = e,
  51540. this.propertiesPanel = t,
  51541. this._update = function() {
  51542. n.update()
  51543. }
  51544. ;
  51545. t = Potree.resourcePath + "/icons/copy.svg";
  51546. this.elContent = $('\n\t\t<div class="propertypanel_content">\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan="3">position</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align="center" id="camera_position_x" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="camera_position_y" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="camera_position_z" style="width: 25%"></td>\n\t\t\t\t\t<td align="right" id="copy_camera_position" style="width: 25%">\n\t\t\t\t\t\t<img name="copyPosition" title="copy" class="button-icon" src="'.concat(t, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan="3">target</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align="center" id="camera_target_x" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="camera_target_y" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="camera_target_z" style="width: 25%"></td>\n\t\t\t\t\t<td align="right" id="copy_camera_target" style="width: 25%">\n\t\t\t\t\t\t<img name="copyTarget" title="copy" class="button-icon" src="').concat(t, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</div>\n\t\t')),
  51547. this.elCopyPosition = this.elContent.find("img[name=copyPosition]"),
  51548. this.elCopyPosition.click(function() {
  51549. var e = n.viewer.scene.getActiveCamera().position.toArray().map(function(e) {
  51550. return e.toFixed(3)
  51551. }).join(", ");
  51552. Jf.clipboardCopy(e),
  51553. n.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  51554. duration: 3e3
  51555. })
  51556. }),
  51557. this.elCopyTarget = this.elContent.find("img[name=copyTarget]"),
  51558. this.elCopyTarget.click(function() {
  51559. var e = n.viewer.scene.view.getPivot().toArray().map(function(e) {
  51560. return e.toFixed(3)
  51561. }).join(", ");
  51562. Jf.clipboardCopy(e),
  51563. n.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  51564. duration: 3e3
  51565. })
  51566. }),
  51567. this.propertiesPanel.addVolatileListener(e, "camera_changed", this._update),
  51568. this.update()
  51569. }
  51570. return h(i, [{
  51571. key: "update",
  51572. value: function() {
  51573. var e = this.viewer.scene.getActiveCamera()
  51574. , t = this.viewer.scene.view
  51575. , e = e.position.toArray().map(function(e) {
  51576. return Jf.addCommas(e.toFixed(3))
  51577. });
  51578. this.elContent.find("#camera_position_x").html(e[0]),
  51579. this.elContent.find("#camera_position_y").html(e[1]),
  51580. this.elContent.find("#camera_position_z").html(e[2]);
  51581. t = t.getPivot().toArray().map(function(e) {
  51582. return Jf.addCommas(e.toFixed(3))
  51583. });
  51584. this.elContent.find("#camera_target_x").html(t[0]),
  51585. this.elContent.find("#camera_target_y").html(t[1]),
  51586. this.elContent.find("#camera_target_z").html(t[2])
  51587. }
  51588. }]),
  51589. i
  51590. }()
  51591. , Ry = function() {
  51592. function r(e, t, n) {
  51593. var i = this;
  51594. O(this, r),
  51595. this.viewer = e,
  51596. this.propertiesPanel = t,
  51597. this.annotation = n,
  51598. this._update = function() {
  51599. i.update()
  51600. }
  51601. ;
  51602. t = "".concat(Potree.resourcePath, "/icons/copy.svg");
  51603. this.elContent = $('\n\t\t<div class="propertypanel_content">\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan="3">position</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align="center" id="annotation_position_x" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="annotation_position_y" style="width: 25%"></td>\n\t\t\t\t\t<td align="center" id="annotation_position_z" style="width: 25%"></td>\n\t\t\t\t\t<td align="right" id="copy_annotation_position" style="width: 25%">\n\t\t\t\t\t\t<img name="copyPosition" title="copy" class="button-icon" src="'.concat(t, '" style="width: 16px; height: 16px"/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t</table>\n\n\t\t\t<div>\n\n\t\t\t\t<div class="heading">Title</div>\n\t\t\t\t<div id="annotation_title" contenteditable="true">\n\t\t\t\t\tAnnotation Title\n\t\t\t\t</div>\n\n\t\t\t\t<div class="heading">Description</div>\n\t\t\t\t<div id="annotation_description" contenteditable="true">\n\t\t\t\t\tA longer description of this annotation. \n\t\t\t\t\t\tCan be multiple lines long. TODO: the user should be able\n\t\t\t\t\t\tto modify title and description. \n\t\t\t\t</div>\n\n\t\t\t</div>\n\n\t\t</div>\n\t\t')),
  51604. this.elCopyPosition = this.elContent.find("img[name=copyPosition]"),
  51605. this.elCopyPosition.click(function() {
  51606. var e = i.annotation.position.toArray().map(function(e) {
  51607. return e.toFixed(3)
  51608. }).join(", ");
  51609. Jf.clipboardCopy(e),
  51610. i.viewer.postMessage("Copied value to clipboard: <br>'".concat(e, "'"), {
  51611. duration: 3e3
  51612. })
  51613. }),
  51614. this.elTitle = this.elContent.find("#annotation_title").html(n.title),
  51615. this.elDescription = this.elContent.find("#annotation_description").html(n.description),
  51616. this.elTitle[0].addEventListener("input", function() {
  51617. var e = i.elTitle.html();
  51618. n.title = e
  51619. }, !1),
  51620. this.elDescription[0].addEventListener("input", function() {
  51621. var e = i.elDescription.html();
  51622. n.description = e
  51623. }, !1),
  51624. this.update()
  51625. }
  51626. return h(r, [{
  51627. key: "update",
  51628. value: function() {
  51629. var e = this.annotation
  51630. , t = this.elContent
  51631. , n = this.elTitle
  51632. , i = this.elDescription
  51633. , r = e.position.toArray().map(function(e) {
  51634. return Jf.addCommas(e.toFixed(3))
  51635. });
  51636. t.find("#annotation_position_x").html(r[0]),
  51637. t.find("#annotation_position_y").html(r[1]),
  51638. t.find("#annotation_position_z").html(r[2]),
  51639. n.html(e.title),
  51640. i.html(e.description)
  51641. }
  51642. }]),
  51643. r
  51644. }()
  51645. , Fy = function() {
  51646. function n(l, e, u) {
  51647. O(this, n),
  51648. this.viewer = l,
  51649. this.propertiesPanel = e,
  51650. this.animation = u,
  51651. this.elContent = $('\n\t\t\t<div class="propertypanel_content">\n\t\t\t\t<span id="animation_keyframes"></span>\n\n\t\t\t\t<span>\n\n\t\t\t\t\t<span style="display:flex">\n\t\t\t\t\t\t<span style="display:flex; align-items: center; padding-right: 10px">Duration: </span>\n\t\t\t\t\t\t<input name="spnDuration" value="5.0" style="flex-grow: 1; width:100%">\n\t\t\t\t\t</span>\n\n\t\t\t\t\t<span>Time: </span><span id="lblTime"></span> <div id="sldTime"></div>\n\n\t\t\t\t\t<input name="play" type="button" value="play"/>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t'),
  51652. this.elContent.find("input[name=play]").click(function() {
  51653. u.play()
  51654. }),
  51655. this.elContent.find("#sldTime").slider({
  51656. value: 0,
  51657. min: 0,
  51658. max: 1,
  51659. step: .001,
  51660. slide: function(e, t) {
  51661. u.set(t.value),
  51662. u.updateFrustum()
  51663. }
  51664. });
  51665. var i = this.elContent.find("input[name=spnDuration]");
  51666. i.spinner({
  51667. min: 0,
  51668. max: 300,
  51669. step: .01,
  51670. numberFormat: "n",
  51671. start: function() {},
  51672. spin: function(e, t) {
  51673. var n = i.spinner("value");
  51674. u.setDuration(n)
  51675. },
  51676. change: function(e, t) {
  51677. var n = i.spinner("value");
  51678. u.setDuration(n)
  51679. },
  51680. stop: function(e, t) {
  51681. var n = i.spinner("value");
  51682. u.setDuration(n)
  51683. },
  51684. incremental: function(e) {
  51685. var t = i.spinner("value")
  51686. , n = i.spinner("option", "step");
  51687. return Math.max(1, parseInt(.05 * t / n))
  51688. }
  51689. }),
  51690. i.spinner("value", u.getDuration()),
  51691. i.spinner("widget").css("width", "100%");
  51692. function t() {
  51693. function o(e) {
  51694. var t = $('\n\t\t\t\t\t<div style="display: flex; margin: 0.2em 0em">\n\t\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t\t<input type="button" name="add" value="insert control point" />\n\t\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t</div>\n\t\t\t\t');
  51695. t.find("input[name=add]").click(function() {
  51696. u.createControlPoint(e),
  51697. u.changeCallback()
  51698. }),
  51699. c.append(t)
  51700. }
  51701. c.empty();
  51702. var s = 0;
  51703. o(s),
  51704. u.posCurve.points.forEach(function(e) {
  51705. var t, n, i, r, a;
  51706. t = s,
  51707. n = $('\n\t\t\t\t\t<div style="display: flex; margin: 0.2em 0em">\n\t\t\t\t\t\t<span style="flex-grow: 0;">\n\t\t\t\t\t\t\t<img name="assign" src="'.concat(Potree.resourcePath, '/icons/assign.svg" style="width: 1.5em; height: 1.5em"/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span style="flex-grow: 0;">\n\t\t\t\t\t\t\t<img name="move" src="').concat(Potree.resourcePath, '/icons/circled_dot.svg" style="width: 1.5em; height: 1.5em"/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span style="flex-grow: 0; width: 1.5em; height: 1.5em"></span>\n\t\t\t\t\t\t<span style="flex-grow: 0; font-size: 1.5em">keyframe</span>\n\t\t\t\t\t\t<span style="flex-grow: 1"></span>\n\t\t\t\t\t\t<span style="flex-grow: 0;">\n\t\t\t\t\t\t\t<img name="delete" src="').concat(Potree.resourcePath, '/icons/remove.svg" style="width: 1.5em; height: 1.5em"/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t')),
  51708. i = n.find("img[name=assign]"),
  51709. r = n.find("img[name=move]"),
  51710. a = n.find("img[name=delete]"),
  51711. i.click(function() {
  51712. u.posCurve.points[t].copy(l.scene.view.position),
  51713. u.targetCurve.points[t].copy(l.scene.view.getPivot()),
  51714. u.changeCallback()
  51715. }),
  51716. r.click(function() {
  51717. l.scene.view.position.copy(u.posCurve.points[t]),
  51718. l.scene.view.lookAt(u.targetCurve.points[t])
  51719. }),
  51720. a.click(function() {
  51721. u.removeControlPoint(t),
  51722. u.changeCallback()
  51723. }),
  51724. c.append(n),
  51725. o(++s)
  51726. })
  51727. }
  51728. var c = this.elContent.find("#animation_keyframes");
  51729. t(),
  51730. u.addEventListener("controlpoint_added", t),
  51731. u.addEventListener("controlpoint_removed", t)
  51732. }
  51733. return h(n, [{
  51734. key: "update",
  51735. value: function() {}
  51736. }]),
  51737. n
  51738. }()
  51739. , Iy = function() {
  51740. function n(e, t) {
  51741. O(this, n),
  51742. this.container = e,
  51743. this.viewer = t,
  51744. this.object = null,
  51745. this.cleanupTasks = [],
  51746. this.scene = null
  51747. }
  51748. return h(n, [{
  51749. key: "setScene",
  51750. value: function(e) {
  51751. this.scene = e
  51752. }
  51753. }, {
  51754. key: "set",
  51755. value: function(e) {
  51756. if (this.object !== e) {
  51757. this.object = e;
  51758. var t, n = ue(this.cleanupTasks);
  51759. try {
  51760. for (n.s(); !(t = n.n()).done; )
  51761. (0,
  51762. t.value)()
  51763. } catch (e) {
  51764. n.e(e)
  51765. } finally {
  51766. n.f()
  51767. }
  51768. this.cleanupTasks = [],
  51769. this.container.empty(),
  51770. e instanceof xm ? this.setPointCloud(e) : e instanceof Wf || e instanceof Kp || e instanceof Yp ? this.setMeasurement(e) : e instanceof Kr ? this.setCamera(e) : e instanceof Kf ? this.setAnnotation(e) : e instanceof bv && this.setCameraAnimation(e)
  51771. }
  51772. }
  51773. }, {
  51774. key: "addVolatileListener",
  51775. value: function(e, t, n) {
  51776. e.addEventListener(t, n),
  51777. this.cleanupTasks.push(function() {
  51778. e.removeEventListener(t, n)
  51779. })
  51780. }
  51781. }, {
  51782. key: "setPointCloud",
  51783. value: function(f) {
  51784. var t = this
  51785. , m = f.material
  51786. , v = $('\n\t\t\t<div class="scene_content selectable">\n\t\t\t\t<ul class="pv-menu-list">\n\n\t\t\t\t<li>\n\t\t\t\t<span data-i18n="appearance.point_size"></span>:&nbsp;<span id="lblPointSize"></span> <div id="sldPointSize"></div>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t<span data-i18n="appearance.min_point_size"></span>:&nbsp;<span id="lblMinPointSize"></span> <div id="sldMinPointSize"></div>\n\t\t\t\t</li>\n\n\t\t\t\t\x3c!-- SIZE TYPE --\x3e\n\t\t\t\t<li>\n\t\t\t\t\t<label for="optPointSizing" class="pv-select-label" data-i18n="appearance.point_size_type">Point Sizing </label>\n\t\t\t\t\t<select id="optPointSizing" name="optPointSizing">\n\t\t\t\t\t\t<option>FIXED</option>\n\t\t\t\t\t\t<option>ATTENUATED</option>\n\t\t\t\t\t\t<option>ADAPTIVE</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\n\t\t\t\t\x3c!-- SHAPE --\x3e\n\t\t\t\t<li>\n\t\t\t\t\t<label for="optShape" class="pv-select-label" data-i18n="appearance.point_shape"></label><br>\n\t\t\t\t\t<select id="optShape" name="optShape">\n\t\t\t\t\t\t<option>SQUARE</option>\n\t\t\t\t\t\t<option>CIRCLE</option>\n\t\t\t\t\t\t<option>PARABOLOID</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\n\t\t\t\t<li id="materials_backface_container">\n\t\t\t\t<label><input id="set_backface_culling" type="checkbox" /><span data-i18n="appearance.backface_culling"></span></label>\n\t\t\t\t</li>\n\t\t\t\t\n\t\t\t\t\x3c!-- OPACITY --\x3e\n\t\t\t\t<li><span data-i18n="appearance.point_opacity"></span>:<span id="lblOpacity"></span><div id="sldOpacity"></div></li>\n\n\t\t\t\t<div class="divider">\n\t\t\t\t\t<span>Attribute</span>\n\t\t\t\t</div>\n\n\t\t\t\t<li>\n\t\t\t\t\t<select id="optMaterial" name="optMaterial"></select>\n\t\t\t\t</li>\n\n\t\t\t\t<div id="materials.composite_weight_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Attribute Weights</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li>RGB: <span id="lblWeightRGB"></span> <div id="sldWeightRGB"></div>\t</li>\n\t\t\t\t\t<li>Intensity: <span id="lblWeightIntensity"></span> <div id="sldWeightIntensity"></div>\t</li>\n\t\t\t\t\t<li>Elevation: <span id="lblWeightElevation"></span> <div id="sldWeightElevation"></div>\t</li>\n\t\t\t\t\t<li>Classification: <span id="lblWeightClassification"></span> <div id="sldWeightClassification"></div>\t</li>\n\t\t\t\t\t<li>Return Number: <span id="lblWeightReturnNumber"></span> <div id="sldWeightReturnNumber"></div>\t</li>\n\t\t\t\t\t<li>Source ID: <span id="lblWeightSourceID"></span> <div id="sldWeightSourceID"></div>\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.rgb_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>RGB</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li>Gamma: <span id="lblRGBGamma"></span> <div id="sldRGBGamma"></div>\t</li>\n\t\t\t\t\t<li>Brightness: <span id="lblRGBBrightness"></span> <div id="sldRGBBrightness"></div>\t</li>\n\t\t\t\t\t<li>Contrast: <span id="lblRGBContrast"></span> <div id="sldRGBContrast"></div>\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.extra_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Extra Attribute</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li><span data-i18n="appearance.extra_range"></span>: <span id="lblExtraRange"></span> <div id="sldExtraRange"></div></li>\n\n\t\t\t\t\t<li>Gamma: <span id="lblExtraGamma"></span> <div id="sldExtraGamma"></div></li>\n\t\t\t\t\t<li>Brightness: <span id="lblExtraBrightness"></span> <div id="sldExtraBrightness"></div></li>\n\t\t\t\t\t<li>Contrast: <span id="lblExtraContrast"></span> <div id="sldExtraContrast"></div></li>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div id="materials.matcap_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>MATCAP</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<div id="matcap_scheme_selection" style="display: flex; flex-wrap: wrap;"> </div>\n\t\t\t\t\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.color_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Color</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<input id="materials.color.picker" />\n\t\t\t\t</div>\n\n\n\t\t\t\t<div id="materials.elevation_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Elevation</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div>\t</li>\n\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<selectgroup id="gradient_repeat_option">\n\t\t\t\t\t\t\t<option id="gradient_repeat_clamp" value="CLAMP">Clamp</option>\n\t\t\t\t\t\t\t<option id="gradient_repeat_repeat" value="REPEAT">Repeat</option>\n\t\t\t\t\t\t\t<option id="gradient_repeat_mirrored_repeat" value="MIRRORED_REPEAT">Mirrored Repeat</option>\n\t\t\t\t\t\t</selectgroup>\n\t\t\t\t\t</li>\n\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<span>Gradient Scheme:</span>\n\t\t\t\t\t\t<div id="elevation_gradient_scheme_selection" style="display: flex; padding: 1em 0em">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.transition_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Transition</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div>\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.intensity_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Intensity</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<li>Range: <span id="lblIntensityRange"></span> <div id="sldIntensityRange"></div>\t</li>\n\t\t\t\t\t<li>Gamma: <span id="lblIntensityGamma"></span> <div id="sldIntensityGamma"></div>\t</li>\n\t\t\t\t\t<li>Brightness: <span id="lblIntensityBrightness"></span> <div id="sldIntensityBrightness"></div>\t</li>\n\t\t\t\t\t<li>Contrast: <span id="lblIntensityContrast"></span> <div id="sldIntensityContrast"></div>\t</li>\n\t\t\t\t</div>\n\n\t\t\t\t<div id="materials.gpstime_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>GPS Time</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div id="materials.index_container">\n\t\t\t\t\t<div class="divider">\n\t\t\t\t\t\t<span>Indices</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t');
  51787. v.i18n(),
  51788. this.container.append(v);
  51789. var n = v.find("#sldPointSize")
  51790. , i = v.find("#lblPointSize");
  51791. n.slider({
  51792. value: m.size,
  51793. min: 0,
  51794. max: 3,
  51795. step: .01,
  51796. slide: function(e, t) {
  51797. m.size = t.value
  51798. }
  51799. });
  51800. function e(e) {
  51801. i.html(m.size.toFixed(2)),
  51802. n.slider({
  51803. value: m.size
  51804. })
  51805. }
  51806. this.addVolatileListener(m, "point_size_changed", e),
  51807. e();
  51808. var r = v.find("#sldMinPointSize")
  51809. , a = v.find("#lblMinPointSize");
  51810. r.slider({
  51811. value: m.size,
  51812. min: 0,
  51813. max: 3,
  51814. step: .01,
  51815. slide: function(e, t) {
  51816. m.minSize = t.value
  51817. }
  51818. });
  51819. function o(e) {
  51820. a.html(m.minSize.toFixed(2)),
  51821. r.slider({
  51822. value: m.minSize
  51823. })
  51824. }
  51825. this.addVolatileListener(m, "point_size_changed", o),
  51826. o();
  51827. var s = Object.keys(am)[m.pointSizeType]
  51828. , l = v.find("#optPointSizing");
  51829. l.selectmenu(),
  51830. l.val(s).selectmenu("refresh"),
  51831. l.selectmenu({
  51832. change: function(e, t) {
  51833. m.pointSizeType = am[t.item.value]
  51834. }
  51835. });
  51836. var u = v.find("#optShape");
  51837. u.selectmenu({
  51838. change: function(e, t) {
  51839. t = t.item.value;
  51840. m.shape = om[t]
  51841. }
  51842. });
  51843. function c() {
  51844. var e = Object.keys(om)[m.shape];
  51845. u.selectmenu().val(e).selectmenu("refresh")
  51846. }
  51847. this.addVolatileListener(m, "point_shape_changed", c),
  51848. c();
  51849. var d = v.find("#set_backface_culling");
  51850. d.click(function() {
  51851. m.backfaceCulling = d.prop("checked")
  51852. });
  51853. function h() {
  51854. var e = m.backfaceCulling;
  51855. d.prop("checked", e)
  51856. }
  51857. this.addVolatileListener(m, "backface_changed", h),
  51858. h();
  51859. s = $("#materials_backface_container");
  51860. s.css("display", "none");
  51861. l = f.pcoGeometry.pointAttributes;
  51862. !!l.hasNormals && l.hasNormals() && s.css("display", "block");
  51863. var p = v.find("#sldOpacity")
  51864. , g = v.find("#lblOpacity");
  51865. p.slider({
  51866. value: m.opacity,
  51867. min: 0,
  51868. max: 1,
  51869. step: .001,
  51870. slide: function(e, t) {
  51871. m.opacity = t.value
  51872. }
  51873. });
  51874. function y(e) {
  51875. g.html(m.opacity.toFixed(2)),
  51876. p.slider({
  51877. value: m.opacity
  51878. })
  51879. }
  51880. this.addVolatileListener(m, "opacity_changed", y),
  51881. y();
  51882. l = f.pcoGeometry.pointAttributes.attributes;
  51883. (s = []).push.apply(s, Q(l.map(function(e) {
  51884. return e.name
  51885. })));
  51886. l = s.indexOf("intensity");
  51887. 0 <= l && s.splice(l + 1, 0, "intensity gradient"),
  51888. s.push("elevation", "color", "matcap", "indices", "level of detail", "composite");
  51889. var w, b = ["POSITION_CARTESIAN", "position"], s = s.filter(function(e) {
  51890. return !b.includes(e)
  51891. }), x = v.find("#optMaterial"), E = ue(s);
  51892. try {
  51893. for (E.s(); !(w = E.n()).done; ) {
  51894. var _ = w.value
  51895. , M = $("<option>".concat(_, "</option>"));
  51896. x.append(M)
  51897. }
  51898. } catch (e) {
  51899. E.e(e)
  51900. } finally {
  51901. E.f()
  51902. }
  51903. function A(e, t) {
  51904. var n = x.selectmenu().val();
  51905. m.activeAttributeName = n;
  51906. var i = f.getAttribute(n);
  51907. !!(i = "intensity gradient" === n ? f.getAttribute("intensity") : i) && ["intensity", "intensity gradient"].includes(i.name) ? (f.material.intensityRange[0] === 1 / 0 && (f.material.intensityRange = i.range),
  51908. l = (s = N(i.range, 2))[0],
  51909. u = s[1],
  51910. v.find("#sldIntensityRange").slider({
  51911. range: !0,
  51912. min: l,
  51913. max: u,
  51914. step: .01,
  51915. values: [l, u],
  51916. slide: function(e, t) {
  51917. var n = t.values[0]
  51918. , t = t.values[1];
  51919. m.intensityRange = [n, t]
  51920. }
  51921. })) : i && (d = (c = N(i.range, 2))[0],
  51922. h = c[1],
  51923. p = (p = m.getRange(i.name)) || Q(i.range),
  51924. "number" == typeof d && "number" == typeof h && v.find("#sldExtraRange").slider({
  51925. range: !0,
  51926. min: d,
  51927. max: h,
  51928. step: .01,
  51929. values: p,
  51930. slide: function(e, t) {
  51931. var n = N(t.values, 2)
  51932. , t = n[0]
  51933. , n = n[1];
  51934. m.setRange(i.name, [t, n])
  51935. }
  51936. }));
  51937. var r = $("#materials\\.composite_weight_container")
  51938. , a = $("#materials\\.elevation_container")
  51939. , o = $("#materials\\.rgb_container")
  51940. , s = $("#materials\\.extra_container")
  51941. , l = $("#materials\\.color_container")
  51942. , u = $("#materials\\.intensity_container")
  51943. , c = $("#materials\\.index_container")
  51944. , d = $("#materials\\.transition_container")
  51945. , h = $("#materials\\.gpstime_container")
  51946. , p = $("#materials\\.matcap_container");
  51947. c.css("display", "none"),
  51948. u.css("display", "none"),
  51949. a.css("display", "none"),
  51950. o.css("display", "none"),
  51951. s.css("display", "none"),
  51952. l.css("display", "none"),
  51953. r.css("display", "none"),
  51954. d.css("display", "none"),
  51955. p.css("display", "none"),
  51956. h.css("display", "none"),
  51957. "composite" === n ? (r.css("display", "block"),
  51958. a.css("display", "block"),
  51959. o.css("display", "block"),
  51960. u.css("display", "block")) : "elevation" === n ? a.css("display", "block") : "RGB and Elevation" === n ? (o.css("display", "block"),
  51961. a.css("display", "block")) : "rgba" === n ? o.css("display", "block") : "color" === n ? l.css("display", "block") : "intensity" === n || "intensity gradient" === n ? u.css("display", "block") : "indices" === n ? c.css("display", "block") : "matcap" === n ? p.css("display", "block") : "classification" === n || ("gps-time" === n ? h.css("display", "block") : "number of returns" === n || "return number" === n || ["source id", "point source id"].includes(n) || s.css("display", "block"))
  51962. }
  51963. x.selectmenu({
  51964. change: A
  51965. });
  51966. function T() {
  51967. x.val(m.activeAttributeName).selectmenu("refresh")
  51968. }
  51969. this.addVolatileListener(m, "point_color_type_changed", T),
  51970. this.addVolatileListener(m, "active_attribute_changed", T),
  51971. T(),
  51972. A();
  51973. var S, l = Object.keys(Potree.Gradients).map(function(e) {
  51974. return {
  51975. name: e,
  51976. values: km[e]
  51977. }
  51978. }), C = v.find("#elevation_gradient_scheme_selection"), P = ue(l);
  51979. try {
  51980. for (P.s(); !(S = P.n()).done; )
  51981. !function() {
  51982. var e = S.value
  51983. , t = $('\n\t\t\t\t\t<span style="flex-grow: 1;">\n\t\t\t\t\t</span>\n\t\t\t\t')
  51984. , n = Potree.Utils.createSvgGradient(e.values);
  51985. n.setAttributeNS(null, "class", "button-icon"),
  51986. t.append($(n)),
  51987. t.click(function() {
  51988. m.gradient = km[e.name]
  51989. }),
  51990. C.append(t)
  51991. }()
  51992. } catch (e) {
  51993. P.e(e)
  51994. } finally {
  51995. P.f()
  51996. }
  51997. for (var s = [{
  51998. name: "Normals",
  51999. icon: "".concat(Potree.resourcePath, "/icons/matcap/check_normal+y.jpg")
  52000. }, {
  52001. name: "Basic 1",
  52002. icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_1.jpg")
  52003. }, {
  52004. name: "Basic 2",
  52005. icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_2.jpg")
  52006. }, {
  52007. name: "Basic Dark",
  52008. icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_dark.jpg")
  52009. }, {
  52010. name: "Basic Side",
  52011. icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_side.jpg")
  52012. }, {
  52013. name: "Ceramic Dark",
  52014. icon: "".concat(Potree.resourcePath, "/icons/matcap/ceramic_dark.jpg")
  52015. }, {
  52016. name: "Ceramic Lightbulb",
  52017. icon: "".concat(Potree.resourcePath, "/icons/matcap/ceramic_lightbulb.jpg")
  52018. }, {
  52019. name: "Clay Brown",
  52020. icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_brown.jpg")
  52021. }, {
  52022. name: "Clay Muddy",
  52023. icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_muddy.jpg")
  52024. }, {
  52025. name: "Clay Studio",
  52026. icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_studio.jpg")
  52027. }, {
  52028. name: "Resin",
  52029. icon: "".concat(Potree.resourcePath, "/icons/matcap/resin.jpg")
  52030. }, {
  52031. name: "Skin",
  52032. icon: "".concat(Potree.resourcePath, "/icons/matcap/skin.jpg")
  52033. }, {
  52034. name: "Jade",
  52035. icon: "".concat(Potree.resourcePath, "/icons/matcap/jade.jpg")
  52036. }, {
  52037. name: "Metal_ Anisotropic",
  52038. icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_anisotropic.jpg")
  52039. }, {
  52040. name: "Metal Carpaint",
  52041. icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_carpaint.jpg")
  52042. }, {
  52043. name: "Metal Lead",
  52044. icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_lead.jpg")
  52045. }, {
  52046. name: "Metal Shiny",
  52047. icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_shiny.jpg")
  52048. }, {
  52049. name: "Pearl",
  52050. icon: "".concat(Potree.resourcePath, "/icons/matcap/pearl.jpg")
  52051. }, {
  52052. name: "Toon",
  52053. icon: "".concat(Potree.resourcePath, "/icons/matcap/toon.jpg")
  52054. }, {
  52055. name: "Check Rim Light",
  52056. icon: "".concat(Potree.resourcePath, "/icons/matcap/check_rim_light.jpg")
  52057. }, {
  52058. name: "Check Rim Dark",
  52059. icon: "".concat(Potree.resourcePath, "/icons/matcap/check_rim_dark.jpg")
  52060. }, {
  52061. name: "Contours 1",
  52062. icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_1.jpg")
  52063. }, {
  52064. name: "Contours 2",
  52065. icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_2.jpg")
  52066. }, {
  52067. name: "Contours 3",
  52068. icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_3.jpg")
  52069. }, {
  52070. name: "Reflection Check Horizontal",
  52071. icon: "".concat(Potree.resourcePath, "/icons/matcap/reflection_check_horizontal.jpg")
  52072. }, {
  52073. name: "Reflection Check Vertical",
  52074. icon: "".concat(Potree.resourcePath, "/icons/matcap/reflection_check_vertical.jpg")
  52075. }], D = v.find("#matcap_scheme_selection"), k = 0, B = s; k < B.length; k++)
  52076. !function() {
  52077. var e = B[k]
  52078. , t = $('\n\t\t\t\t\t\t<img src="'.concat(e.icon, '" class="button-icon" style="width: 25%;" />\n\t\t\t\t'));
  52079. t.click(function() {
  52080. m.matcap = e.icon.substring(e.icon.lastIndexOf("/"))
  52081. }),
  52082. D.append(t)
  52083. }();
  52084. v.find("#sldRGBGamma").slider({
  52085. value: m.rgbGamma,
  52086. min: 0,
  52087. max: 4,
  52088. step: .01,
  52089. slide: function(e, t) {
  52090. m.rgbGamma = t.value
  52091. }
  52092. }),
  52093. v.find("#sldRGBContrast").slider({
  52094. value: m.rgbContrast,
  52095. min: -1,
  52096. max: 1,
  52097. step: .01,
  52098. slide: function(e, t) {
  52099. m.rgbContrast = t.value
  52100. }
  52101. }),
  52102. v.find("#sldRGBBrightness").slider({
  52103. value: m.rgbBrightness,
  52104. min: -1,
  52105. max: 1,
  52106. step: .01,
  52107. slide: function(e, t) {
  52108. m.rgbBrightness = t.value
  52109. }
  52110. }),
  52111. v.find("#sldExtraGamma").slider({
  52112. value: m.extraGamma,
  52113. min: 0,
  52114. max: 4,
  52115. step: .01,
  52116. slide: function(e, t) {
  52117. m.extraGamma = t.value
  52118. }
  52119. }),
  52120. v.find("#sldExtraBrightness").slider({
  52121. value: m.extraBrightness,
  52122. min: -1,
  52123. max: 1,
  52124. step: .01,
  52125. slide: function(e, t) {
  52126. m.extraBrightness = t.value
  52127. }
  52128. }),
  52129. v.find("#sldExtraContrast").slider({
  52130. value: m.extraContrast,
  52131. min: -1,
  52132. max: 1,
  52133. step: .01,
  52134. slide: function(e, t) {
  52135. m.extraContrast = t.value
  52136. }
  52137. }),
  52138. v.find("#sldHeightRange").slider({
  52139. range: !0,
  52140. min: 0,
  52141. max: 1e3,
  52142. step: .01,
  52143. values: [0, 1e3],
  52144. slide: function(e, t) {
  52145. m.heightMin = t.values[0],
  52146. m.heightMax = t.values[1]
  52147. }
  52148. }),
  52149. v.find("#sldIntensityGamma").slider({
  52150. value: m.intensityGamma,
  52151. min: 0,
  52152. max: 4,
  52153. step: .01,
  52154. slide: function(e, t) {
  52155. m.intensityGamma = t.value
  52156. }
  52157. }),
  52158. v.find("#sldIntensityContrast").slider({
  52159. value: m.intensityContrast,
  52160. min: -1,
  52161. max: 1,
  52162. step: .01,
  52163. slide: function(e, t) {
  52164. m.intensityContrast = t.value
  52165. }
  52166. }),
  52167. v.find("#sldIntensityBrightness").slider({
  52168. value: m.intensityBrightness,
  52169. min: -1,
  52170. max: 1,
  52171. step: .01,
  52172. slide: function(e, t) {
  52173. m.intensityBrightness = t.value
  52174. }
  52175. }),
  52176. v.find("#sldWeightRGB").slider({
  52177. value: m.weightRGB,
  52178. min: 0,
  52179. max: 1,
  52180. step: .01,
  52181. slide: function(e, t) {
  52182. m.weightRGB = t.value
  52183. }
  52184. }),
  52185. v.find("#sldWeightIntensity").slider({
  52186. value: m.weightIntensity,
  52187. min: 0,
  52188. max: 1,
  52189. step: .01,
  52190. slide: function(e, t) {
  52191. m.weightIntensity = t.value
  52192. }
  52193. }),
  52194. v.find("#sldWeightElevation").slider({
  52195. value: m.weightElevation,
  52196. min: 0,
  52197. max: 1,
  52198. step: .01,
  52199. slide: function(e, t) {
  52200. m.weightElevation = t.value
  52201. }
  52202. }),
  52203. v.find("#sldWeightClassification").slider({
  52204. value: m.weightClassification,
  52205. min: 0,
  52206. max: 1,
  52207. step: .01,
  52208. slide: function(e, t) {
  52209. m.weightClassification = t.value
  52210. }
  52211. }),
  52212. v.find("#sldWeightReturnNumber").slider({
  52213. value: m.weightReturnNumber,
  52214. min: 0,
  52215. max: 1,
  52216. step: .01,
  52217. slide: function(e, t) {
  52218. m.weightReturnNumber = t.value
  52219. }
  52220. }),
  52221. v.find("#sldWeightSourceID").slider({
  52222. value: m.weightSourceID,
  52223. min: 0,
  52224. max: 1,
  52225. step: .01,
  52226. slide: function(e, t) {
  52227. m.weightSourceID = t.value
  52228. }
  52229. }),
  52230. v.find("#materials\\.color\\.picker").spectrum({
  52231. flat: !0,
  52232. showInput: !0,
  52233. preferredFormat: "rgb",
  52234. cancelText: "",
  52235. chooseText: "Apply",
  52236. color: "#".concat(m.color.getHexString()),
  52237. move: function(e) {
  52238. e = e.toRgb(),
  52239. e = (new Yi).setRGB(e.r / 255, e.g / 255, e.b / 255);
  52240. m.color = e
  52241. },
  52242. change: function(e) {
  52243. e = e.toRgb(),
  52244. e = (new Yi).setRGB(e.r / 255, e.g / 255, e.b / 255);
  52245. m.color = e
  52246. }
  52247. }),
  52248. this.addVolatileListener(m, "color_changed", function() {
  52249. v.find("#materials\\.color\\.picker").spectrum("set", "#".concat(m.color.getHexString()))
  52250. });
  52251. function L() {
  52252. var e, t, n, i = f.getAttribute("position");
  52253. n = i ? (t = (t = i.range[0][2]) - .2 * (i = (e = i.range[1][2]) - t),
  52254. e + .2 * i) : (n = [f.pcoGeometry.tightBoundingBox, f.getBoundingBoxWorld()].find(function(e) {
  52255. return void 0 !== e
  52256. }),
  52257. f.updateMatrixWorld(!0),
  52258. r = (n = Jf.computeTransformedBoundingBox(n, f.matrixWorld)).max.z - n.min.z,
  52259. t = n.min.z - .2 * r,
  52260. n.max.z + .2 * r);
  52261. var r = m.elevationRange;
  52262. v.find("#lblHeightRange").html("".concat(r[0].toFixed(2), " to ").concat(r[1].toFixed(2))),
  52263. v.find("#sldHeightRange").slider({
  52264. min: t,
  52265. max: n,
  52266. values: r
  52267. })
  52268. }
  52269. function R() {
  52270. var e = m.activeAttributeName
  52271. , t = f.getAttribute(e);
  52272. null == t || "number" == typeof (e = null == (e = m.getRange(e)) ? t.range : e)[0] && "number" == typeof e[1] && (e ? (e = "".concat(e[0].toFixed(2), " to ").concat(e[1].toFixed(2)),
  52273. v.find("#lblExtraRange").html(e)) : v.find("could not deduce range"))
  52274. }
  52275. var F = function() {
  52276. var e = m.intensityRange;
  52277. v.find("#lblIntensityRange").html("".concat(parseInt(e[0]), " to ").concat(parseInt(e[1])))
  52278. };
  52279. L(),
  52280. v.find("#sldHeightRange").slider("option", "min"),
  52281. v.find("#sldHeightRange").slider("option", "max");
  52282. l = v.find("#gradient_repeat_option");
  52283. l.selectgroup({
  52284. title: "Gradient"
  52285. }),
  52286. l.find("input").click(function(e) {
  52287. t.viewer.setElevationGradientRepeat(im[e.target.value])
  52288. });
  52289. s = Object.keys(im).filter(function(e) {
  52290. return im[e] === t.viewer.elevationGradientRepeat
  52291. });
  52292. l.find("input[value=".concat(s, "]")).trigger("click");
  52293. function I() {
  52294. var e = m.intensityGamma
  52295. , t = m.intensityContrast
  52296. , n = m.intensityBrightness;
  52297. F(),
  52298. v.find("#lblIntensityGamma").html(e.toFixed(2)),
  52299. v.find("#lblIntensityContrast").html(t.toFixed(2)),
  52300. v.find("#lblIntensityBrightness").html(n.toFixed(2)),
  52301. v.find("#sldIntensityGamma").slider({
  52302. value: e
  52303. }),
  52304. v.find("#sldIntensityContrast").slider({
  52305. value: t
  52306. }),
  52307. v.find("#sldIntensityBrightness").slider({
  52308. value: n
  52309. })
  52310. }
  52311. function O() {
  52312. var e = m.rgbGamma
  52313. , t = m.rgbContrast
  52314. , n = m.rgbBrightness;
  52315. v.find("#lblRGBGamma").html(e.toFixed(2)),
  52316. v.find("#lblRGBContrast").html(t.toFixed(2)),
  52317. v.find("#lblRGBBrightness").html(n.toFixed(2)),
  52318. v.find("#sldRGBGamma").slider({
  52319. value: e
  52320. }),
  52321. v.find("#sldRGBContrast").slider({
  52322. value: t
  52323. }),
  52324. v.find("#sldRGBBrightness").slider({
  52325. value: n
  52326. })
  52327. }
  52328. this.addVolatileListener(m, "material_property_changed", R),
  52329. this.addVolatileListener(m, "material_property_changed", L),
  52330. this.addVolatileListener(m, "material_property_changed", I),
  52331. this.addVolatileListener(m, "material_property_changed", O),
  52332. R(),
  52333. L(),
  52334. I(),
  52335. O()
  52336. }
  52337. }, {
  52338. key: "setMeasurement",
  52339. value: function(e) {
  52340. var t, n = {
  52341. DISTANCE: {
  52342. panel: Ay
  52343. },
  52344. AREA: {
  52345. panel: Sy
  52346. },
  52347. POINT: {
  52348. panel: Ty
  52349. },
  52350. ANGLE: {
  52351. panel: Cy
  52352. },
  52353. HEIGHT: {
  52354. panel: Dy
  52355. },
  52356. PROFILE: {
  52357. panel: By
  52358. },
  52359. VOLUME: {
  52360. panel: ky
  52361. },
  52362. CIRCLE: {
  52363. panel: Py
  52364. },
  52365. OTHER: {
  52366. panel: Ty
  52367. }
  52368. }, e = new ((t = e)instanceof Wf ? !t.showDistances || t.showArea || t.showAngles ? t.showDistances && t.showArea && !t.showAngles ? n.AREA : 1 === t.maxMarkers ? n.POINT : t.showDistances || t.showArea || !t.showAngles ? t.showHeight ? n.HEIGHT : t.showCircle ? n.CIRCLE : n.OTHER : n.ANGLE : n.DISTANCE : t instanceof Kp ? n.PROFILE : t instanceof Yp ? n.VOLUME : void 0).panel(this.viewer,e,this);
  52369. this.container.append(e.elContent)
  52370. }
  52371. }, {
  52372. key: "setCamera",
  52373. value: function(e) {
  52374. var t = new Ly(this.viewer,this);
  52375. this.container.append(t.elContent)
  52376. }
  52377. }, {
  52378. key: "setAnnotation",
  52379. value: function(e) {
  52380. e = new Ry(this.viewer,this,e);
  52381. this.container.append(e.elContent)
  52382. }
  52383. }, {
  52384. key: "setCameraAnimation",
  52385. value: function(e) {
  52386. e = new Fy(this.viewer,this,e);
  52387. this.container.append(e.elContent)
  52388. }
  52389. }]),
  52390. n
  52391. }();
  52392. function Oy(e) {
  52393. return function(e) {
  52394. for (var t = (e = (e += "").split("."))[0], e = 1 < e.length ? "." + e[1] : "", n = /(\d+)(\d{3})/; n.test(t); )
  52395. t = t.replace(n, "$1,$2");
  52396. return t + e
  52397. }(e.toFixed(3))
  52398. }
  52399. var zy = function() {
  52400. function i() {
  52401. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  52402. O(this, i),
  52403. this.element = document.createElement("div"),
  52404. this.labels = [],
  52405. this.sliders = [],
  52406. this.range = null != e.range ? e.range : [0, 1],
  52407. this.slide = null != e.slide ? e.slide : null,
  52408. this.step = null != e.step ? e.step : 1e-4;
  52409. for (var t = null != e.levels ? e.levels : 1, n = 0; n < t; n++)
  52410. this.addLevel()
  52411. }
  52412. return h(i, [{
  52413. key: "setRange",
  52414. value: function(e) {
  52415. this.range = Q(e);
  52416. var t = this.sliders[0];
  52417. $(t).slider({
  52418. min: e[0],
  52419. max: e[1]
  52420. });
  52421. for (var n = 1; n < this.sliders.length; n++) {
  52422. var i = this.sliders[n - 1]
  52423. , r = this.sliders[n]
  52424. , i = Q($(i).slider("option", "values"));
  52425. $(r).slider({
  52426. min: i[0],
  52427. max: i[1]
  52428. })
  52429. }
  52430. this.updateLabels()
  52431. }
  52432. }, {
  52433. key: "setValues",
  52434. value: function(e) {
  52435. var t, n = ue(this.sliders);
  52436. try {
  52437. for (n.s(); !(t = n.n()).done; ) {
  52438. var i = t.value;
  52439. $(i).slider({
  52440. values: Q(e)
  52441. })
  52442. }
  52443. } catch (e) {
  52444. n.e(e)
  52445. } finally {
  52446. n.f()
  52447. }
  52448. this.updateLabels()
  52449. }
  52450. }, {
  52451. key: "addLevel",
  52452. value: function() {
  52453. var e, o = this, t = document.createElement("li"), n = document.createTextNode("Range: "), i = document.createElement("span"), r = document.createElement("div"), s = this.sliders.length, a = 0, l = 0;
  52454. l = 0 === this.sliders.length ? (a = (e = N(this.range, 2))[0],
  52455. e[1]) : (e = this.sliders[this.sliders.length - 1],
  52456. a = (e = N($(e).slider("option", "values"), 2))[0],
  52457. e[1]),
  52458. $(r).slider({
  52459. range: !0,
  52460. min: a,
  52461. max: l,
  52462. step: this.step,
  52463. values: [a, l],
  52464. slide: function(e, t) {
  52465. for (var n, i = o.sliders.length, r = s + 1; r < i; r++) {
  52466. var a = o.sliders[r];
  52467. $(a).slider({
  52468. range: !0,
  52469. min: t.values[0],
  52470. max: t.values[1],
  52471. values: Q(t.values)
  52472. })
  52473. }
  52474. o.slide && (n = Q(t.values),
  52475. o.slide({
  52476. target: o,
  52477. range: o.range,
  52478. values: n
  52479. })),
  52480. o.updateLabels()
  52481. }
  52482. }),
  52483. t.append(n, i, r),
  52484. this.sliders.push(r),
  52485. this.labels.push(i),
  52486. this.element.append(t),
  52487. this.updateLabels()
  52488. }
  52489. }, {
  52490. key: "removeLevel",
  52491. value: function() {}
  52492. }, {
  52493. key: "updateSliders",
  52494. value: function() {}
  52495. }, {
  52496. key: "updateLabels",
  52497. value: function() {
  52498. for (var e = this.sliders.length, t = 0; t < e; t++) {
  52499. var n = this.sliders[t]
  52500. , i = this.labels[t]
  52501. , r = N($(n).slider("option", "values"), 2)
  52502. , n = r[0]
  52503. , r = r[1]
  52504. , n = Oy(n)
  52505. , r = Oy(r)
  52506. , r = "".concat(n, " to ").concat(r);
  52507. i.innerHTML = r
  52508. }
  52509. }
  52510. }]),
  52511. i
  52512. }()
  52513. , Ny = function() {
  52514. y(i, hn);
  52515. var e = w(i);
  52516. function i(t) {
  52517. var n;
  52518. O(this, i),
  52519. (n = e.call(this)).viewer = t,
  52520. n.renderer = t.renderer,
  52521. n.originalCam = t.scene.getActiveCamera(),
  52522. n.shearCam = t.scene.getActiveCamera().clone(),
  52523. n.shearCam.rotation.set(n.originalCam.rotation.toArray()),
  52524. n.shearCam.updateProjectionMatrix(),
  52525. n.shearCam.updateProjectionMatrix = function() {
  52526. return n.shearCam.projectionMatrix
  52527. }
  52528. ,
  52529. n.image = null,
  52530. n.fadeFactor = 20,
  52531. n.fovDelta = 0,
  52532. n.fovMin = .1,
  52533. n.fovMax = 120,
  52534. n.shear = [0, 0],
  52535. n.elUp = $('<input type="button" value="🡅" style="position: absolute; top: 10px; left: calc(50%); z-index: 1000" />'),
  52536. n.elRight = $('<input type="button" value="🡆" style="position: absolute; top: calc(50%); right: 10px; z-index: 1000" />'),
  52537. n.elDown = $('<input type="button" value="🡇" style="position: absolute; bottom: 10px; left: calc(50%); z-index: 1000" />'),
  52538. n.elLeft = $('<input type="button" value="🡄" style="position: absolute; top: calc(50%); left: 10px; z-index: 1000" />'),
  52539. n.elExit = $('<input type="button" value="Back to 3D view" style="position: absolute; bottom: 10px; right: 10px; z-index: 1000" />'),
  52540. n.elExit.click(function() {
  52541. n.release()
  52542. }),
  52543. n.elUp.click(function() {
  52544. var e = t.getFOV()
  52545. , e = Math.tan(gn.degToRad(e / 2));
  52546. n.shear[1] += .1 * e
  52547. }),
  52548. n.elRight.click(function() {
  52549. var e = t.getFOV()
  52550. , e = Math.tan(gn.degToRad(e / 2));
  52551. n.shear[0] += .1 * e
  52552. }),
  52553. n.elDown.click(function() {
  52554. var e = t.getFOV()
  52555. , e = Math.tan(gn.degToRad(e / 2));
  52556. n.shear[1] -= .1 * e
  52557. }),
  52558. n.elLeft.click(function() {
  52559. var e = t.getFOV()
  52560. , e = Math.tan(gn.degToRad(e / 2));
  52561. n.shear[0] -= .1 * e
  52562. }),
  52563. n.scene = null,
  52564. n.sceneControls = new gs;
  52565. return n.addEventListener("mousewheel", function(e) {
  52566. n.fovDelta += -e.delta
  52567. }),
  52568. n
  52569. }
  52570. return h(i, [{
  52571. key: "hasSomethingCaptured",
  52572. value: function() {
  52573. return null !== this.image
  52574. }
  52575. }, {
  52576. key: "capture",
  52577. value: function(e) {
  52578. this.hasSomethingCaptured() || (this.image = e,
  52579. this.originalFOV = this.viewer.getFOV(),
  52580. this.originalControls = this.viewer.getControls(),
  52581. this.viewer.setControls(this),
  52582. this.viewer.scene.overrideCamera = this.shearCam,
  52583. e = this.viewer.renderer.domElement,
  52584. e = $(e.parentElement),
  52585. this.shear = [0, 0],
  52586. e.append(this.elUp),
  52587. e.append(this.elRight),
  52588. e.append(this.elDown),
  52589. e.append(this.elLeft),
  52590. e.append(this.elExit))
  52591. }
  52592. }, {
  52593. key: "release",
  52594. value: function() {
  52595. this.image = null,
  52596. this.viewer.scene.overrideCamera = null,
  52597. this.elUp.detach(),
  52598. this.elRight.detach(),
  52599. this.elDown.detach(),
  52600. this.elLeft.detach(),
  52601. this.elExit.detach(),
  52602. this.viewer.setFOV(this.originalFOV),
  52603. this.viewer.setControls(this.originalControls)
  52604. }
  52605. }, {
  52606. key: "setScene",
  52607. value: function(e) {
  52608. this.scene = e
  52609. }
  52610. }, {
  52611. key: "update",
  52612. value: function(e) {
  52613. var t = this.viewer.getFOV()
  52614. , n = t * (1 + +this.fovDelta / 10)
  52615. , n = Math.max(this.fovMin, n)
  52616. , i = (n = Math.min(this.fovMax, n)) / t
  52617. , r = this.viewer.inputHandler.mouse
  52618. , a = this.viewer.renderer.getSize(new yn)
  52619. , t = [r.x / a.x, (a.y - r.y) / a.y]
  52620. , r = a.x / a.y
  52621. , a = 2 * Math.tan(gn.degToRad(n / 2))
  52622. , r = r * a
  52623. , r = [this.shear[0] - .5 * r, this.shear[0] + .5 * r]
  52624. , a = [this.shear[1] - .5 * a, this.shear[1] + .5 * a]
  52625. , i = 1 - i
  52626. , t = [(1 - i) * this.shear[0] + i * ((1 - t[0]) * r[0] + t[0] * r[1]), (1 - i) * this.shear[1] + i * ((1 - t[1]) * a[0] + t[1] * a[1])];
  52627. this.shear = t,
  52628. this.viewer.setFOV(n);
  52629. a = this.originalCam,
  52630. t = this.shearCam;
  52631. a.fov = n,
  52632. a.updateMatrixWorld(),
  52633. a.updateProjectionMatrix(),
  52634. t.copy(a),
  52635. (n = t.rotation).set.apply(n, Q(a.rotation.toArray())),
  52636. t.updateMatrixWorld(),
  52637. t.projectionMatrix.copy(a.projectionMatrix);
  52638. n = N(this.shear, 2),
  52639. a = n[0],
  52640. n = n[1],
  52641. a = (new ni).set(1, 0, a, 0, 0, 1, n, 0, 0, 0, 1, 0, 0, 0, 0, 1),
  52642. n = t.projectionMatrix;
  52643. n.multiply(a),
  52644. t.projectionMatrixInverse.copy(n).invert();
  52645. t.projectionMatrix.elements.reduce(function(e, t) {
  52646. return e + t
  52647. }, 0);
  52648. this.fovDelta *= 0
  52649. }
  52650. }]),
  52651. i
  52652. }();
  52653. var Uy = new bu(1,1)
  52654. , Gy = new Sl;
  52655. Gy.vertices.push(new Cn(-.5,-.5,0), new Cn(.5,-.5,0), new Cn(.5,.5,0), new Cn(-.5,.5,0), new Cn(-.5,-.5,0));
  52656. var Hy, Vy, jy, Wy, Xy, qy, Jy, Yy, Zy, Qy, Ky, $y, ew, tw, nw = function() {
  52657. function n(e) {
  52658. O(this, n),
  52659. this.id = e,
  52660. this.fov = 1,
  52661. this.position = new Cn,
  52662. this.rotation = new Cn,
  52663. this.width = 0,
  52664. this.height = 0,
  52665. this.fov = 1;
  52666. var e = ((t = new Qr({
  52667. uniforms: {
  52668. tColor: {
  52669. value: new En
  52670. },
  52671. uNear: {
  52672. value: 0
  52673. },
  52674. uOpacity: {
  52675. value: 1
  52676. }
  52677. },
  52678. vertexShader: "\n\tuniform float uNear;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\t\n\tvoid main(){\n\t\tvDebug = vec4(0.0, 1.0, 0.0, 1.0);\n\t\tvec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n\t\t// make sure that this mesh is at least in front of the near plane\n\t\tmodelViewPosition.xyz += normalize(modelViewPosition.xyz) * uNear;\n\t\tgl_Position = projectionMatrix * modelViewPosition;\n\t\tvUV = uv;\n\t}\n\t",
  52679. fragmentShader: "\n\tuniform sampler2D tColor;\n\tuniform float uOpacity;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\tvoid main(){\n\t\tvec4 color = texture2D(tColor, vUV);\n\t\tgl_FragColor = color;\n\t\tgl_FragColor.a = uOpacity;\n\t}\n\t",
  52680. side: Y
  52681. })).side = Y,
  52682. t)
  52683. , t = new tl({
  52684. color: 65280
  52685. });
  52686. this.mesh = new Hr(Uy,e),
  52687. this.line = new sl(Gy,t),
  52688. this.texture = null,
  52689. this.mesh.orientedImage = this
  52690. }
  52691. return h(n, [{
  52692. key: "set",
  52693. value: function(e, t, n, i) {
  52694. var r = t.map(gn.degToRad);
  52695. (t = this.position).set.apply(t, Q(e)),
  52696. (t = this.mesh.position).set.apply(t, Q(e)),
  52697. (e = this.rotation).set.apply(e, Q(r)),
  52698. (e = this.mesh.rotation).set.apply(e, Q(r));
  52699. n = N(n, 2);
  52700. this.width = n[0],
  52701. this.height = n[1],
  52702. this.mesh.scale.set(this.width / this.height, 1, 1),
  52703. this.fov = i,
  52704. this.updateTransform()
  52705. }
  52706. }, {
  52707. key: "updateTransform",
  52708. value: function() {
  52709. var e = this.mesh
  52710. , t = this.line
  52711. , n = this.fov;
  52712. e.updateMatrixWorld();
  52713. var i = e.getWorldDirection()
  52714. , n = gn.degToRad(n / 2)
  52715. , n = -.5 / Math.tan(n)
  52716. , n = i.clone().multiplyScalar(n);
  52717. e.position.add(n),
  52718. t.position.copy(e.position),
  52719. t.scale.copy(e.scale),
  52720. t.rotation.copy(e.rotation)
  52721. }
  52722. }]),
  52723. n
  52724. }(), iw = function() {
  52725. y(n, hn);
  52726. var t = w(n);
  52727. function n() {
  52728. var e;
  52729. return O(this, n),
  52730. (e = t.call(this)).node = null,
  52731. e.cameraParams = null,
  52732. e.imageParams = null,
  52733. e.images = null,
  52734. e._visible = !0,
  52735. e
  52736. }
  52737. return h(n, [{
  52738. key: "visible",
  52739. get: function() {
  52740. return this._visible
  52741. },
  52742. set: function(e) {
  52743. if (this._visible !== e) {
  52744. var t, n = ue(this.images);
  52745. try {
  52746. for (n.s(); !(t = n.n()).done; ) {
  52747. var i = t.value;
  52748. i.mesh.visible = e,
  52749. i.line.visible = e
  52750. }
  52751. } catch (e) {
  52752. n.e(e)
  52753. } finally {
  52754. n.f()
  52755. }
  52756. this._visible = e,
  52757. this.dispatchEvent({
  52758. type: "visibility_changed",
  52759. images: this
  52760. })
  52761. }
  52762. }
  52763. }]),
  52764. n
  52765. }(), pd = function() {
  52766. function k() {
  52767. O(this, k)
  52768. }
  52769. var i, t, n;
  52770. return h(k, null, [{
  52771. key: "loadCameraParams",
  52772. value: (n = r(regeneratorRuntime.mark(function e(t) {
  52773. var n, i, r, a;
  52774. return regeneratorRuntime.wrap(function(e) {
  52775. for (; ; )
  52776. switch (e.prev = e.next) {
  52777. case 0:
  52778. return e.next = 2,
  52779. fetch(t);
  52780. case 2:
  52781. return n = e.sent,
  52782. e.next = 5,
  52783. n.text();
  52784. case 5:
  52785. return r = e.sent,
  52786. i = new DOMParser,
  52787. a = i.parseFromString(r, "application/xml"),
  52788. n = parseInt(a.getElementsByTagName("width")[0].textContent),
  52789. i = parseInt(a.getElementsByTagName("height")[0].textContent),
  52790. r = parseFloat(a.getElementsByTagName("f")[0].textContent),
  52791. a = i / 2 / r,
  52792. a = 2 * gn.radToDeg(Math.atan(a)),
  52793. a = {
  52794. path: t,
  52795. width: n,
  52796. height: i,
  52797. f: r,
  52798. fov: a
  52799. },
  52800. e.abrupt("return", a);
  52801. case 15:
  52802. case "end":
  52803. return e.stop()
  52804. }
  52805. }, e)
  52806. })),
  52807. function(e) {
  52808. return n.apply(this, arguments)
  52809. }
  52810. )
  52811. }, {
  52812. key: "loadImageParams",
  52813. value: (t = r(regeneratorRuntime.mark(function e(t) {
  52814. var n, i, r, a, o, s, l;
  52815. return regeneratorRuntime.wrap(function(e) {
  52816. for (; ; )
  52817. switch (e.prev = e.next) {
  52818. case 0:
  52819. return e.next = 2,
  52820. fetch(t);
  52821. case 2:
  52822. if ((n = e.sent).ok) {
  52823. e.next = 6;
  52824. break
  52825. }
  52826. return console.error("failed to load ".concat(t)),
  52827. e.abrupt("return");
  52828. case 6:
  52829. return e.next = 8,
  52830. n.text();
  52831. case 8:
  52832. l = e.sent,
  52833. i = l.split(/\r?\n/),
  52834. r = [],
  52835. a = 1;
  52836. case 12:
  52837. if (!(a < i.length)) {
  52838. e.next = 24;
  52839. break
  52840. }
  52841. if ((o = i[a]).startsWith("#"))
  52842. return e.abrupt("continue", 21);
  52843. e.next = 16;
  52844. break;
  52845. case 16:
  52846. if ((s = o.split(/\s+/)).length < 6)
  52847. return e.abrupt("continue", 21);
  52848. e.next = 19;
  52849. break;
  52850. case 19:
  52851. l = {
  52852. id: s[0],
  52853. x: Number.parseFloat(s[1]),
  52854. y: Number.parseFloat(s[2]),
  52855. z: Number.parseFloat(s[3]),
  52856. omega: Number.parseFloat(s[4]),
  52857. phi: Number.parseFloat(s[5]),
  52858. kappa: Number.parseFloat(s[6])
  52859. },
  52860. r.push(l);
  52861. case 21:
  52862. a++,
  52863. e.next = 12;
  52864. break;
  52865. case 24:
  52866. return e.abrupt("return", r);
  52867. case 25:
  52868. case "end":
  52869. return e.stop()
  52870. }
  52871. }, e)
  52872. })),
  52873. function(e) {
  52874. return t.apply(this, arguments)
  52875. }
  52876. )
  52877. }, {
  52878. key: "load",
  52879. value: (i = r(regeneratorRuntime.mark(function e(t, a, u) {
  52880. var n, o, i, s, l, r, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D;
  52881. return regeneratorRuntime.wrap(function(e) {
  52882. for (; ; )
  52883. switch (e.prev = e.next) {
  52884. case 0:
  52885. return n = performance.now(),
  52886. e.next = 3,
  52887. Promise.all([k.loadCameraParams(t), k.loadImageParams(a)]);
  52888. case 3:
  52889. D = e.sent,
  52890. C = N(D, 2),
  52891. o = C[0],
  52892. i = C[1],
  52893. s = new Ny(u),
  52894. l = new sh,
  52895. D = performance.now(),
  52896. console.log(D - n),
  52897. r = o.width,
  52898. c = o.height,
  52899. d = [],
  52900. (h = new Si).name = "oriented_images",
  52901. p = ue(i);
  52902. try {
  52903. for (p.s(); !(f = p.n()).done; )
  52904. m = f.value,
  52905. v = m.x,
  52906. g = m.y,
  52907. y = m.z,
  52908. w = m.omega,
  52909. b = m.phi,
  52910. x = m.kappa,
  52911. E = new nw(m.id),
  52912. _ = [v, g, y],
  52913. M = [w, b, x],
  52914. A = [r, c],
  52915. E.set(_, M, A, o.fov),
  52916. h.add(E.mesh),
  52917. h.add(E.line),
  52918. d.push(E)
  52919. } catch (e) {
  52920. p.e(e)
  52921. } finally {
  52922. p.f()
  52923. }
  52924. return S = T = null,
  52925. C = function(e) {
  52926. performance.now();
  52927. T && T.line.material.color.setRGB(0, 1, 0),
  52928. e.preventDefault();
  52929. var t = u.renderer.domElement.getBoundingClientRect()
  52930. , n = [e.clientX, e.clientY]
  52931. , i = [(n[0] - t.left) / t.width, (n[1] - t.top) / t.height]
  52932. , e = B(yn, i)
  52933. , n = u.scene.getActiveCamera()
  52934. , t = new Cn(2 * e.x - 1,-2 * e.y + 1)
  52935. , i = d.map(function(e) {
  52936. return e.mesh
  52937. });
  52938. l.setFromCamera(t, n);
  52939. e = l.intersectObjects(i),
  52940. t = !1;
  52941. T = 0 < e.length ? ((r = e[0].object.orientedImage).line.material.color.setRGB(1, 0, 0),
  52942. t = T !== r,
  52943. r) : null;
  52944. var r, n = null === S && null !== T;
  52945. null === S || null !== T && !t || (u.scene.removePolygonClipVolume(S),
  52946. S = null),
  52947. (n || t) && (i = T,
  52948. (r = new $r(e = o.fov,o.width / o.height,1,1e6)).rotation.order = u.scene.getActiveCamera().rotation.order,
  52949. r.rotation.copy(i.mesh.rotation),
  52950. t = (n = i.mesh).getWorldDirection(),
  52951. i = n.position,
  52952. n = gn.degToRad(e / 2),
  52953. e = .5 / Math.tan(n),
  52954. n = i.clone().add(t.clone().multiplyScalar(e)),
  52955. t = i.clone().sub(n),
  52956. (new Cn).addVectors(n, t.clone().multiplyScalar(u.getMoveSpeed())),
  52957. r.position.copy(n),
  52958. e = new Potree.PolygonClipVolume(r),
  52959. i = new Hr,
  52960. t = new Hr,
  52961. n = new Hr,
  52962. r = new Hr,
  52963. i.position.set(-1, -1, 0),
  52964. t.position.set(1, -1, 0),
  52965. n.position.set(1, 1, 0),
  52966. r.position.set(-1, 1, 0),
  52967. e.markers.push(i, t, n, r),
  52968. e.initialized = !0,
  52969. u.scene.addPolygonClipVolume(e),
  52970. S = e);
  52971. performance.now()
  52972. }
  52973. ,
  52974. P = function(e) {
  52975. console.log("move to image " + e.id);
  52976. var t, n = e.mesh, i = e.position.clone(), r = n.position.clone();
  52977. u.scene.view.setView(i, r, 500, function() {
  52978. s.capture(e)
  52979. }),
  52980. null === e.texture && (t = e,
  52981. r = "".concat(Potree.resourcePath, "/images/loading.jpg"),
  52982. (new _c).load(r, function(e) {
  52983. null === t.texture && (t.texture = e,
  52984. t.mesh.material.uniforms.tColor.value = e,
  52985. n.material.needsUpdate = !0)
  52986. }),
  52987. r = "".concat(a, "/../").concat(t.id),
  52988. (new _c).load(r, function(e) {
  52989. t.texture = e,
  52990. t.mesh.material.uniforms.tColor.value = e,
  52991. n.material.needsUpdate = !0
  52992. }))
  52993. }
  52994. ,
  52995. D = function(e) {
  52996. s.hasSomethingCaptured() || T && P(T)
  52997. }
  52998. ,
  52999. u.renderer.domElement.addEventListener("mousemove", C, !1),
  53000. u.renderer.domElement.addEventListener("mousedown", D, !1),
  53001. u.addEventListener("update", function() {
  53002. var e, t = ue(d);
  53003. try {
  53004. for (t.s(); !(e = t.n()).done; ) {
  53005. var n = e.value
  53006. , i = (n.mesh.matrixWorld,
  53007. n.width / n.height)
  53008. , r = u.scene.getActiveCamera()
  53009. , a = n.mesh.getWorldPosition(new Cn)
  53010. , o = r.position.distanceTo(a)
  53011. , s = gn.degToRad(1)
  53012. , l = o * Math.tan(s)
  53013. , l = Math.max(l, 1);
  53014. n.mesh.scale.set(l * i, l, 1),
  53015. n.line.scale.set(l * i, l, 1),
  53016. n.mesh.material.uniforms.uNear.value = r.near
  53017. }
  53018. } catch (e) {
  53019. t.e(e)
  53020. } finally {
  53021. t.f()
  53022. }
  53023. }),
  53024. (D = new iw).node = h,
  53025. D.cameraParamsPath = t,
  53026. D.imageParamsPath = a,
  53027. D.cameraParams = o,
  53028. D.imageParams = i,
  53029. D.images = d,
  53030. Potree.debug.moveToImage = P,
  53031. e.abrupt("return", D);
  53032. case 34:
  53033. case "end":
  53034. return e.stop()
  53035. }
  53036. }, e)
  53037. })),
  53038. function(e, t, n) {
  53039. return i.apply(this, arguments)
  53040. }
  53041. )
  53042. }]),
  53043. k
  53044. }(), rw = {
  53045. Space_Separator: /[\u1680\u2000-\u200A\u202F\u205F\u3000]/,
  53046. ID_Start: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,
  53047. ID_Continue: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
  53048. }, aw = {
  53049. isSpaceSeparator: function(e) {
  53050. return "string" == typeof e && rw.Space_Separator.test(e)
  53051. },
  53052. isIdStartChar: function(e) {
  53053. return "string" == typeof e && ("a" <= e && e <= "z" || "A" <= e && e <= "Z" || "$" === e || "_" === e || rw.ID_Start.test(e))
  53054. },
  53055. isIdContinueChar: function(e) {
  53056. return "string" == typeof e && ("a" <= e && e <= "z" || "A" <= e && e <= "Z" || "0" <= e && e <= "9" || "$" === e || "_" === e || "‌" === e || "‍" === e || rw.ID_Continue.test(e))
  53057. },
  53058. isDigit: function(e) {
  53059. return "string" == typeof e && /[0-9]/.test(e)
  53060. },
  53061. isHexDigit: function(e) {
  53062. return "string" == typeof e && /[0-9A-Fa-f]/.test(e)
  53063. }
  53064. };
  53065. function ow() {
  53066. if (Hy[Wy])
  53067. return String.fromCodePoint(Hy.codePointAt(Wy))
  53068. }
  53069. function sw() {
  53070. var e = ow();
  53071. return "\n" === e ? (Xy++,
  53072. qy = 0) : e ? qy += e.length : qy++,
  53073. e && (Wy += e.length),
  53074. e
  53075. }
  53076. var lw = {
  53077. default: function() {
  53078. switch (tw) {
  53079. case "\t":
  53080. case "\v":
  53081. case "\f":
  53082. case " ":
  53083. case " ":
  53084. case "\ufeff":
  53085. case "\n":
  53086. case "\r":
  53087. case "\u2028":
  53088. case "\u2029":
  53089. return void sw();
  53090. case "/":
  53091. return sw(),
  53092. void (Qy = "comment");
  53093. case void 0:
  53094. return sw(),
  53095. uw("eof")
  53096. }
  53097. if (!aw.isSpaceSeparator(tw))
  53098. return lw[Vy]();
  53099. sw()
  53100. },
  53101. comment: function() {
  53102. switch (tw) {
  53103. case "*":
  53104. return sw(),
  53105. void (Qy = "multiLineComment");
  53106. case "/":
  53107. return sw(),
  53108. void (Qy = "singleLineComment")
  53109. }
  53110. throw mw(sw())
  53111. },
  53112. multiLineComment: function() {
  53113. switch (tw) {
  53114. case "*":
  53115. return sw(),
  53116. void (Qy = "multiLineCommentAsterisk");
  53117. case void 0:
  53118. throw mw(sw())
  53119. }
  53120. sw()
  53121. },
  53122. multiLineCommentAsterisk: function() {
  53123. switch (tw) {
  53124. case "*":
  53125. return void sw();
  53126. case "/":
  53127. return sw(),
  53128. void (Qy = "default");
  53129. case void 0:
  53130. throw mw(sw())
  53131. }
  53132. sw(),
  53133. Qy = "multiLineComment"
  53134. },
  53135. singleLineComment: function() {
  53136. switch (tw) {
  53137. case "\n":
  53138. case "\r":
  53139. case "\u2028":
  53140. case "\u2029":
  53141. return sw(),
  53142. void (Qy = "default");
  53143. case void 0:
  53144. return sw(),
  53145. uw("eof")
  53146. }
  53147. sw()
  53148. },
  53149. value: function() {
  53150. switch (tw) {
  53151. case "{":
  53152. case "[":
  53153. return uw("punctuator", sw());
  53154. case "n":
  53155. return sw(),
  53156. cw("ull"),
  53157. uw("null", null);
  53158. case "t":
  53159. return sw(),
  53160. cw("rue"),
  53161. uw("boolean", !0);
  53162. case "f":
  53163. return sw(),
  53164. cw("alse"),
  53165. uw("boolean", !1);
  53166. case "-":
  53167. case "+":
  53168. return "-" === sw() && (ew = -1),
  53169. void (Qy = "sign");
  53170. case ".":
  53171. return Ky = sw(),
  53172. void (Qy = "decimalPointLeading");
  53173. case "0":
  53174. return Ky = sw(),
  53175. void (Qy = "zero");
  53176. case "1":
  53177. case "2":
  53178. case "3":
  53179. case "4":
  53180. case "5":
  53181. case "6":
  53182. case "7":
  53183. case "8":
  53184. case "9":
  53185. return Ky = sw(),
  53186. void (Qy = "decimalInteger");
  53187. case "I":
  53188. return sw(),
  53189. cw("nfinity"),
  53190. uw("numeric", 1 / 0);
  53191. case "N":
  53192. return sw(),
  53193. cw("aN"),
  53194. uw("numeric", NaN);
  53195. case '"':
  53196. case "'":
  53197. return $y = '"' === sw(),
  53198. Ky = "",
  53199. void (Qy = "string")
  53200. }
  53201. throw mw(sw())
  53202. },
  53203. identifierNameStartEscape: function() {
  53204. if ("u" !== tw)
  53205. throw mw(sw());
  53206. sw();
  53207. var e = dw();
  53208. switch (e) {
  53209. case "$":
  53210. case "_":
  53211. break;
  53212. default:
  53213. if (!aw.isIdStartChar(e))
  53214. throw gw()
  53215. }
  53216. Ky += e,
  53217. Qy = "identifierName"
  53218. },
  53219. identifierName: function() {
  53220. switch (tw) {
  53221. case "$":
  53222. case "_":
  53223. case "‌":
  53224. case "‍":
  53225. return void (Ky += sw());
  53226. case "\\":
  53227. return sw(),
  53228. void (Qy = "identifierNameEscape")
  53229. }
  53230. if (!aw.isIdContinueChar(tw))
  53231. return uw("identifier", Ky);
  53232. Ky += sw()
  53233. },
  53234. identifierNameEscape: function() {
  53235. if ("u" !== tw)
  53236. throw mw(sw());
  53237. sw();
  53238. var e = dw();
  53239. switch (e) {
  53240. case "$":
  53241. case "_":
  53242. case "‌":
  53243. case "‍":
  53244. break;
  53245. default:
  53246. if (!aw.isIdContinueChar(e))
  53247. throw gw()
  53248. }
  53249. Ky += e,
  53250. Qy = "identifierName"
  53251. },
  53252. sign: function() {
  53253. switch (tw) {
  53254. case ".":
  53255. return Ky = sw(),
  53256. void (Qy = "decimalPointLeading");
  53257. case "0":
  53258. return Ky = sw(),
  53259. void (Qy = "zero");
  53260. case "1":
  53261. case "2":
  53262. case "3":
  53263. case "4":
  53264. case "5":
  53265. case "6":
  53266. case "7":
  53267. case "8":
  53268. case "9":
  53269. return Ky = sw(),
  53270. void (Qy = "decimalInteger");
  53271. case "I":
  53272. return sw(),
  53273. cw("nfinity"),
  53274. uw("numeric", ew * (1 / 0));
  53275. case "N":
  53276. return sw(),
  53277. cw("aN"),
  53278. uw("numeric", NaN)
  53279. }
  53280. throw mw(sw())
  53281. },
  53282. zero: function() {
  53283. switch (tw) {
  53284. case ".":
  53285. return Ky += sw(),
  53286. void (Qy = "decimalPoint");
  53287. case "e":
  53288. case "E":
  53289. return Ky += sw(),
  53290. void (Qy = "decimalExponent");
  53291. case "x":
  53292. case "X":
  53293. return Ky += sw(),
  53294. void (Qy = "hexadecimal")
  53295. }
  53296. return uw("numeric", 0 * ew)
  53297. },
  53298. decimalInteger: function() {
  53299. switch (tw) {
  53300. case ".":
  53301. return Ky += sw(),
  53302. void (Qy = "decimalPoint");
  53303. case "e":
  53304. case "E":
  53305. return Ky += sw(),
  53306. void (Qy = "decimalExponent")
  53307. }
  53308. if (!aw.isDigit(tw))
  53309. return uw("numeric", ew * Number(Ky));
  53310. Ky += sw()
  53311. },
  53312. decimalPointLeading: function() {
  53313. if (aw.isDigit(tw))
  53314. return Ky += sw(),
  53315. void (Qy = "decimalFraction");
  53316. throw mw(sw())
  53317. },
  53318. decimalPoint: function() {
  53319. switch (tw) {
  53320. case "e":
  53321. case "E":
  53322. return Ky += sw(),
  53323. void (Qy = "decimalExponent")
  53324. }
  53325. return aw.isDigit(tw) ? (Ky += sw(),
  53326. void (Qy = "decimalFraction")) : uw("numeric", ew * Number(Ky))
  53327. },
  53328. decimalFraction: function() {
  53329. switch (tw) {
  53330. case "e":
  53331. case "E":
  53332. return Ky += sw(),
  53333. void (Qy = "decimalExponent")
  53334. }
  53335. if (!aw.isDigit(tw))
  53336. return uw("numeric", ew * Number(Ky));
  53337. Ky += sw()
  53338. },
  53339. decimalExponent: function() {
  53340. switch (tw) {
  53341. case "+":
  53342. case "-":
  53343. return Ky += sw(),
  53344. void (Qy = "decimalExponentSign")
  53345. }
  53346. if (aw.isDigit(tw))
  53347. return Ky += sw(),
  53348. void (Qy = "decimalExponentInteger");
  53349. throw mw(sw())
  53350. },
  53351. decimalExponentSign: function() {
  53352. if (aw.isDigit(tw))
  53353. return Ky += sw(),
  53354. void (Qy = "decimalExponentInteger");
  53355. throw mw(sw())
  53356. },
  53357. decimalExponentInteger: function() {
  53358. if (!aw.isDigit(tw))
  53359. return uw("numeric", ew * Number(Ky));
  53360. Ky += sw()
  53361. },
  53362. hexadecimal: function() {
  53363. if (aw.isHexDigit(tw))
  53364. return Ky += sw(),
  53365. void (Qy = "hexadecimalInteger");
  53366. throw mw(sw())
  53367. },
  53368. hexadecimalInteger: function() {
  53369. if (!aw.isHexDigit(tw))
  53370. return uw("numeric", ew * Number(Ky));
  53371. Ky += sw()
  53372. },
  53373. string: function() {
  53374. switch (tw) {
  53375. case "\\":
  53376. return sw(),
  53377. void (Ky += function() {
  53378. switch (ow()) {
  53379. case "b":
  53380. return sw(),
  53381. "\b";
  53382. case "f":
  53383. return sw(),
  53384. "\f";
  53385. case "n":
  53386. return sw(),
  53387. "\n";
  53388. case "r":
  53389. return sw(),
  53390. "\r";
  53391. case "t":
  53392. return sw(),
  53393. "\t";
  53394. case "v":
  53395. return sw(),
  53396. "\v";
  53397. case "0":
  53398. if (sw(),
  53399. aw.isDigit(ow()))
  53400. throw mw(sw());
  53401. return "\0";
  53402. case "x":
  53403. return sw(),
  53404. function() {
  53405. var e = ""
  53406. , t = ow();
  53407. if (!aw.isHexDigit(t))
  53408. throw mw(sw());
  53409. if (e += sw(),
  53410. t = ow(),
  53411. aw.isHexDigit(t))
  53412. return e += sw(),
  53413. String.fromCodePoint(parseInt(e, 16));
  53414. throw mw(sw())
  53415. }();
  53416. case "u":
  53417. return sw(),
  53418. dw();
  53419. case "\n":
  53420. case "\u2028":
  53421. case "\u2029":
  53422. return sw(),
  53423. "";
  53424. case "\r":
  53425. return sw(),
  53426. "\n" === ow() && sw(),
  53427. "";
  53428. case "1":
  53429. case "2":
  53430. case "3":
  53431. case "4":
  53432. case "5":
  53433. case "6":
  53434. case "7":
  53435. case "8":
  53436. case "9":
  53437. case void 0:
  53438. throw mw(sw())
  53439. }
  53440. return sw()
  53441. }());
  53442. case '"':
  53443. return $y ? (sw(),
  53444. uw("string", Ky)) : void (Ky += sw());
  53445. case "'":
  53446. return $y ? void (Ky += sw()) : (sw(),
  53447. uw("string", Ky));
  53448. case "\n":
  53449. case "\r":
  53450. throw mw(sw());
  53451. case "\u2028":
  53452. case "\u2029":
  53453. e = tw,
  53454. console.warn("JSON5: '".concat(yw(e), "' in strings is not valid ECMAScript; consider escaping"));
  53455. break;
  53456. case void 0:
  53457. throw mw(sw())
  53458. }
  53459. var e;
  53460. Ky += sw()
  53461. },
  53462. start: function() {
  53463. switch (tw) {
  53464. case "{":
  53465. case "[":
  53466. return uw("punctuator", sw())
  53467. }
  53468. Qy = "value"
  53469. },
  53470. beforePropertyName: function() {
  53471. switch (tw) {
  53472. case "$":
  53473. case "_":
  53474. return Ky = sw(),
  53475. void (Qy = "identifierName");
  53476. case "\\":
  53477. return sw(),
  53478. void (Qy = "identifierNameStartEscape");
  53479. case "}":
  53480. return uw("punctuator", sw());
  53481. case '"':
  53482. case "'":
  53483. return $y = '"' === sw(),
  53484. void (Qy = "string")
  53485. }
  53486. if (aw.isIdStartChar(tw))
  53487. return Ky += sw(),
  53488. void (Qy = "identifierName");
  53489. throw mw(sw())
  53490. },
  53491. afterPropertyName: function() {
  53492. if (":" === tw)
  53493. return uw("punctuator", sw());
  53494. throw mw(sw())
  53495. },
  53496. beforePropertyValue: function() {
  53497. Qy = "value"
  53498. },
  53499. afterPropertyValue: function() {
  53500. switch (tw) {
  53501. case ",":
  53502. case "}":
  53503. return uw("punctuator", sw())
  53504. }
  53505. throw mw(sw())
  53506. },
  53507. beforeArrayValue: function() {
  53508. if ("]" === tw)
  53509. return uw("punctuator", sw());
  53510. Qy = "value"
  53511. },
  53512. afterArrayValue: function() {
  53513. switch (tw) {
  53514. case ",":
  53515. case "]":
  53516. return uw("punctuator", sw())
  53517. }
  53518. throw mw(sw())
  53519. },
  53520. end: function() {
  53521. throw mw(sw())
  53522. }
  53523. };
  53524. function uw(e, t) {
  53525. return {
  53526. type: e,
  53527. value: t,
  53528. line: Xy,
  53529. column: qy
  53530. }
  53531. }
  53532. function cw(e) {
  53533. var t, n = ue(e);
  53534. try {
  53535. for (n.s(); !(t = n.n()).done; ) {
  53536. var i = t.value;
  53537. if (ow() !== i)
  53538. throw mw(sw());
  53539. sw()
  53540. }
  53541. } catch (e) {
  53542. n.e(e)
  53543. } finally {
  53544. n.f()
  53545. }
  53546. }
  53547. function dw() {
  53548. for (var e = "", t = 4; 0 < t--; ) {
  53549. var n = ow();
  53550. if (!aw.isHexDigit(n))
  53551. throw mw(sw());
  53552. e += sw()
  53553. }
  53554. return String.fromCodePoint(parseInt(e, 16))
  53555. }
  53556. var hw = {
  53557. start: function() {
  53558. if ("eof" === Jy.type)
  53559. throw vw();
  53560. pw()
  53561. },
  53562. beforePropertyName: function() {
  53563. switch (Jy.type) {
  53564. case "identifier":
  53565. case "string":
  53566. return Yy = Jy.value,
  53567. void (Vy = "afterPropertyName");
  53568. case "punctuator":
  53569. return void fw();
  53570. case "eof":
  53571. throw vw()
  53572. }
  53573. },
  53574. afterPropertyName: function() {
  53575. if ("eof" === Jy.type)
  53576. throw vw();
  53577. Vy = "beforePropertyValue"
  53578. },
  53579. beforePropertyValue: function() {
  53580. if ("eof" === Jy.type)
  53581. throw vw();
  53582. pw()
  53583. },
  53584. beforeArrayValue: function() {
  53585. if ("eof" === Jy.type)
  53586. throw vw();
  53587. ("punctuator" !== Jy.type || "]" !== Jy.value ? pw : fw)()
  53588. },
  53589. afterPropertyValue: function() {
  53590. if ("eof" === Jy.type)
  53591. throw vw();
  53592. switch (Jy.value) {
  53593. case ",":
  53594. return void (Vy = "beforePropertyName");
  53595. case "}":
  53596. fw()
  53597. }
  53598. },
  53599. afterArrayValue: function() {
  53600. if ("eof" === Jy.type)
  53601. throw vw();
  53602. switch (Jy.value) {
  53603. case ",":
  53604. return void (Vy = "beforeArrayValue");
  53605. case "]":
  53606. fw()
  53607. }
  53608. },
  53609. end: function() {}
  53610. };
  53611. function pw() {
  53612. var e, t;
  53613. switch (Jy.type) {
  53614. case "punctuator":
  53615. switch (Jy.value) {
  53616. case "{":
  53617. e = {};
  53618. break;
  53619. case "[":
  53620. e = []
  53621. }
  53622. break;
  53623. case "null":
  53624. case "boolean":
  53625. case "numeric":
  53626. case "string":
  53627. e = Jy.value
  53628. }
  53629. void 0 === Zy ? Zy = e : (t = jy[jy.length - 1],
  53630. Array.isArray(t) ? t.push(e) : t[Yy] = e),
  53631. Vy = null !== e && "object" === X(e) ? (jy.push(e),
  53632. Array.isArray(e) ? "beforeArrayValue" : "beforePropertyName") : null == (t = jy[jy.length - 1]) ? "end" : Array.isArray(t) ? "afterArrayValue" : "afterPropertyValue"
  53633. }
  53634. function fw() {
  53635. jy.pop();
  53636. var e = jy[jy.length - 1];
  53637. Vy = null == e ? "end" : Array.isArray(e) ? "afterArrayValue" : "afterPropertyValue"
  53638. }
  53639. function mw(e) {
  53640. return ww((void 0 === e ? "JSON5: invalid end of input at " : "JSON5: invalid character '".concat(yw(e), "' at ")).concat(Xy, ":").concat(qy))
  53641. }
  53642. function vw() {
  53643. return ww("JSON5: invalid end of input at ".concat(Xy, ":").concat(qy))
  53644. }
  53645. function gw() {
  53646. return qy -= 5,
  53647. ww("JSON5: invalid identifier character at ".concat(Xy, ":").concat(qy))
  53648. }
  53649. function yw(e) {
  53650. var t = {
  53651. "'": "\\'",
  53652. '"': '\\"',
  53653. "\\": "\\\\",
  53654. "\b": "\\b",
  53655. "\f": "\\f",
  53656. "\n": "\\n",
  53657. "\r": "\\r",
  53658. "\t": "\\t",
  53659. "\v": "\\v",
  53660. "\0": "\\0",
  53661. "\u2028": "\\u2028",
  53662. "\u2029": "\\u2029"
  53663. };
  53664. if (t[e])
  53665. return t[e];
  53666. if (e < " ") {
  53667. t = e.charCodeAt(0).toString(16);
  53668. return "\\x" + ("00" + t).substring(t.length)
  53669. }
  53670. return e
  53671. }
  53672. function ww(e) {
  53673. e = new SyntaxError(e);
  53674. return e.lineNumber = Xy,
  53675. e.columnNumber = qy,
  53676. e
  53677. }
  53678. var bw, xw = {
  53679. parse: function(e, t) {
  53680. for (Hy = String(e),
  53681. Vy = "start",
  53682. jy = [],
  53683. Xy = 1,
  53684. Zy = Yy = Jy = void (qy = Wy = 0); Jy = function() {
  53685. for (Qy = "default",
  53686. Ky = "",
  53687. $y = !1,
  53688. ew = 1; ; ) {
  53689. tw = ow();
  53690. var e = lw[Qy]();
  53691. if (e)
  53692. return e
  53693. }
  53694. }(),
  53695. hw[Vy](),
  53696. "eof" !== Jy.type; )
  53697. ;
  53698. return "function" == typeof t ? function e(t, n, i) {
  53699. var r = t[n];
  53700. if (null != r && "object" === X(r))
  53701. for (var a in r) {
  53702. var o = e(r, a, i);
  53703. void 0 === o ? delete r[a] : r[a] = o
  53704. }
  53705. return i.call(t, n, r)
  53706. }({
  53707. "": Zy
  53708. }, "", t) : Zy
  53709. },
  53710. stringify: function(e, t, n) {
  53711. var i, l, c = [], d = "", h = "";
  53712. if (null == t || "object" !== X(t) || Array.isArray(t) || (n = t.space,
  53713. l = t.quote,
  53714. t = t.replacer),
  53715. "function" == typeof t)
  53716. i = t;
  53717. else if (Array.isArray(t)) {
  53718. var r, p = [], a = ue(t);
  53719. try {
  53720. for (a.s(); !(r = a.n()).done; ) {
  53721. var o = r.value
  53722. , s = void 0;
  53723. "string" == typeof o ? s = o : ("number" == typeof o || o instanceof String || o instanceof Number) && (s = String(o)),
  53724. void 0 !== s && p.indexOf(s) < 0 && p.push(s)
  53725. }
  53726. } catch (e) {
  53727. a.e(e)
  53728. } finally {
  53729. a.f()
  53730. }
  53731. }
  53732. return n instanceof Number ? n = Number(n) : n instanceof String && (n = String(n)),
  53733. "number" == typeof n ? 0 < n && (n = Math.min(10, Math.floor(n)),
  53734. h = " ".substr(0, n)) : "string" == typeof n && (h = n.substr(0, 10)),
  53735. f("", {
  53736. "": e
  53737. });
  53738. function f(e, t) {
  53739. var n = t[e];
  53740. switch (null != n && ("function" == typeof n.toJSON5 ? n = n.toJSON5(e) : "function" == typeof n.toJSON && (n = n.toJSON(e))),
  53741. (n = i ? i.call(t, e, n) : n)instanceof Number ? n = Number(n) : n instanceof String ? n = String(n) : n instanceof Boolean && (n = n.valueOf()),
  53742. n) {
  53743. case null:
  53744. return "null";
  53745. case !0:
  53746. return "true";
  53747. case !1:
  53748. return "false"
  53749. }
  53750. return "string" == typeof n ? m(n) : "number" == typeof n ? String(n) : "object" === X(n) ? (Array.isArray(n) ? function(e) {
  53751. if (0 <= c.indexOf(e))
  53752. throw TypeError("Converting circular structure to JSON5");
  53753. c.push(e);
  53754. var t = d;
  53755. d += h;
  53756. for (var n = [], i = 0; i < e.length; i++) {
  53757. var r = f(String(i), e);
  53758. n.push(void 0 !== r ? r : "null")
  53759. }
  53760. {
  53761. var a;
  53762. a = 0 === n.length ? "[]" : "" === h ? "[" + n.join(",") + "]" : (a = ",\n" + d,
  53763. a = n.join(a),
  53764. "[\n" + d + a + ",\n" + t + "]")
  53765. }
  53766. return c.pop(),
  53767. d = t,
  53768. a
  53769. }
  53770. : function(e) {
  53771. if (0 <= c.indexOf(e))
  53772. throw TypeError("Converting circular structure to JSON5");
  53773. c.push(e);
  53774. var t = d;
  53775. d += h;
  53776. var n, i, r = p || Object.keys(e), a = [], o = ue(r);
  53777. try {
  53778. for (o.s(); !(n = o.n()).done; ) {
  53779. var s, l = n.value, u = f(l, e);
  53780. void 0 !== u && (s = function(e) {
  53781. if (0 === e.length)
  53782. return m(e);
  53783. var t = String.fromCodePoint(e.codePointAt(0));
  53784. if (!aw.isIdStartChar(t))
  53785. return m(e);
  53786. for (var n = t.length; n < e.length; n++)
  53787. if (!aw.isIdContinueChar(String.fromCodePoint(e.codePointAt(n))))
  53788. return m(e);
  53789. return e
  53790. }(l) + ":",
  53791. "" !== h && (s += " "),
  53792. s += u,
  53793. a.push(s))
  53794. }
  53795. } catch (e) {
  53796. o.e(e)
  53797. } finally {
  53798. o.f()
  53799. }
  53800. i = 0 === a.length ? "{}" : "" === h ? "{" + (i = a.join(",")) + "}" : (r = ",\n" + d,
  53801. i = a.join(r),
  53802. "{\n" + d + i + ",\n" + t + "}");
  53803. return c.pop(),
  53804. d = t,
  53805. i
  53806. }
  53807. )(n) : void 0
  53808. }
  53809. function m(e) {
  53810. for (var n = {
  53811. "'": .1,
  53812. '"': .2
  53813. }, t = {
  53814. "'": "\\'",
  53815. '"': '\\"',
  53816. "\\": "\\\\",
  53817. "\b": "\\b",
  53818. "\f": "\\f",
  53819. "\n": "\\n",
  53820. "\r": "\\r",
  53821. "\t": "\\t",
  53822. "\v": "\\v",
  53823. "\0": "\\0",
  53824. "\u2028": "\\u2028",
  53825. "\u2029": "\\u2029"
  53826. }, i = "", r = 0; r < e.length; r++) {
  53827. var a, o = e[r];
  53828. switch (o) {
  53829. case "'":
  53830. case '"':
  53831. n[o]++,
  53832. i += o;
  53833. continue;
  53834. case "\0":
  53835. if (aw.isDigit(e[r + 1])) {
  53836. i += "\\x00";
  53837. continue
  53838. }
  53839. }
  53840. t[o] ? i += t[o] : i += o < " " ? "\\x" + ("00" + (a = o.charCodeAt(0).toString(16))).substring(a.length) : o
  53841. }
  53842. var s = l || Object.keys(n).reduce(function(e, t) {
  53843. return n[e] < n[t] ? e : t
  53844. });
  53845. return s + (i = i.replace(new RegExp(s,"g"), t[s])) + s
  53846. }
  53847. }
  53848. }, Ew = function() {
  53849. function t(e) {
  53850. O(this, t),
  53851. this.viewer = e,
  53852. this.measuringTool = e.measuringTool,
  53853. this.profileTool = e.profileTool,
  53854. this.volumeTool = e.volumeTool,
  53855. this.dom = $("#sidebar_root")
  53856. }
  53857. return h(t, [{
  53858. key: "createToolIcon",
  53859. value: function(e, t, n) {
  53860. t = $('\n\t\t\t<img src="'.concat(e, '"\n\t\t\t\tstyle="width: 32px; height: 32px"\n\t\t\t\tclass="button-icon"\n\t\t\t\tdata-i18n="').concat(t, '" />\n\t\t'));
  53861. return t.click(n),
  53862. t
  53863. }
  53864. }, {
  53865. key: "init",
  53866. value: function() {
  53867. "merge" == Potree.settings.editType ? (this.initMergeBar(),
  53868. this.initToolbar(),
  53869. this.initScene(),
  53870. this.initNavigation()) : (this.initAccordion(),
  53871. this.initAppearance(),
  53872. this.initToolbar(),
  53873. this.initScene(),
  53874. this.initNavigation(),
  53875. this.initFilters(),
  53876. this.initClippingTool(),
  53877. this.initSettings(),
  53878. "pano" != Potree.settings.editType ? (this.initAlignment(),
  53879. this.initClipModel(),
  53880. this.initSiteModel(),
  53881. this.initParitcle()) : this.initPanosEdit()),
  53882. $("#potree_version_number").html(Potree.version.major + "." + Potree.version.minor + Potree.version.suffix)
  53883. }
  53884. }, {
  53885. key: "initAlignment",
  53886. value: function() {
  53887. function e(n, i) {
  53888. return function() {
  53889. var e = $('#alignment li[name="selectPointCloud"] input:checked');
  53890. Array.from(e).forEach(function(t) {
  53891. var e = viewer.scene.pointclouds.find(function(e) {
  53892. return e.name == t.name
  53893. });
  53894. n(e, i)
  53895. })
  53896. }
  53897. }
  53898. var t = viewer.modules.Alignment
  53899. , n = $("#alignment")
  53900. , i = n.find('[name="transform"] button');
  53901. i.eq(0).on("click", e(t.rotate, 10)),
  53902. i.eq(1).on("click", e(t.rotate, 1)),
  53903. i.eq(2).on("click", e(t.rotate, .1)),
  53904. i.eq(3).on("click", e(t.rotate, -10)),
  53905. i.eq(4).on("click", e(t.rotate, -1)),
  53906. i.eq(5).on("click", e(t.rotate, -.1)),
  53907. i.eq(6).on("click", e(t.translate, new Cn(-1,0,0))),
  53908. i.eq(7).on("click", e(t.translate, new Cn(1,0,0))),
  53909. i.eq(8).on("click", e(t.translate, new Cn(0,-1,0))),
  53910. i.eq(9).on("click", e(t.translate, new Cn(0,1,0))),
  53911. i.eq(10).on("click", e(t.translate, new Cn(0,0,-1))),
  53912. i.eq(11).on("click", e(t.translate, new Cn(0,0,1))),
  53913. n.find("#startAlignment").on("click", function() {
  53914. t.enter()
  53915. }),
  53916. n.find("#exitAlignment").on("click", function() {
  53917. t.save(),
  53918. t.leave()
  53919. }),
  53920. n.find("#rotTool").on("click", function() {
  53921. t.switchHandle("rotate")
  53922. }),
  53923. n.find("#moveTool").on("click", function() {
  53924. t.switchHandle("translate")
  53925. })
  53926. }
  53927. }, {
  53928. key: "initMergeBar",
  53929. value: function() {
  53930. var e = $("#mergeModel")
  53931. , t = (e.find("button"),
  53932. viewer.modules.MergeEditor)
  53933. , r = !1;
  53934. e.find('ul[name="model"] li button').on("click", function(e) {
  53935. if (r)
  53936. return console.log("还在加载", r);
  53937. var t, n = $(e.target), i = n.parent().attr("name");
  53938. if ("select" == n.attr("name"))
  53939. return Potree.selectModel(i);
  53940. "添加" == n.text() ? (t = Date.now(),
  53941. Potree.addModel(i, function() {
  53942. r = !1,
  53943. n.text("删除");
  53944. var e = Date.now();
  53945. console.log("加载完毕", i, "用时", (e - t) / 1e3, "s")
  53946. }),
  53947. r = i) : (Potree.removeModel(i),
  53948. n.text("添加"))
  53949. }),
  53950. e.find('li button[name="splitScreen"]').on("click", function(e) {
  53951. e = $(e.target);
  53952. "分屏" == e.text() ? (e.text("恢复"),
  53953. t.enterSplit()) : (e.text("分屏"),
  53954. t.leaveSplit())
  53955. });
  53956. e.find('li button[name="tag"]').on("click", function(e) {
  53957. $(e.target);
  53958. viewer.tagTool.startInsertion()
  53959. })
  53960. }
  53961. }, {
  53962. key: "addAlignmentButton",
  53963. value: function(e) {
  53964. var t = $('#alignment li[name="selectPointCloud"]>div')
  53965. , e = $(' <input name="'.concat(e.name, '" class="editCheckbox" type="checkbox" >\n \n <label for="showingLabels">').concat(e.name, "</label>"));
  53966. t.append(e)
  53967. }
  53968. }, {
  53969. key: "initClipModel",
  53970. value: function() {
  53971. var e = viewer.modules.Clip
  53972. , t = $("#clipModel").find("button");
  53973. t.eq(0).on("click", e.enter.bind(e)),
  53974. t.eq(1).on("click", e.download.bind(e)),
  53975. t.eq(2).on("click", e.leave.bind(e))
  53976. }
  53977. }, {
  53978. key: "initSiteModel",
  53979. value: function() {
  53980. var e = viewer.modules.SiteModel
  53981. , t = $("#siteModel");
  53982. t.find('button[name="start"] ').on("click", e.enter.bind(e)),
  53983. t.find('button[name="exit"] ').on("click", e.leave.bind(e)),
  53984. t.find('button[name="building"] ').on("click", e.startInsertion.bind(e, "building")),
  53985. t.find('button[name="floor"] ').on("click", function() {
  53986. e.addFloor(e.buildings[0], "top")
  53987. }),
  53988. t.find('button[name="room"] ').on("click", function() {
  53989. e.startInsertion("room", e.buildings[0].buildChildren[0])
  53990. }),
  53991. t.find('button[name="digHole"] ').on("click", function() {
  53992. e.selected && e.startInsertion("hole", e.selected)
  53993. }),
  53994. t.find('button[name="selectBuilding"] ').on("click", function() {
  53995. e.selectEntity(e.buildings[0])
  53996. }),
  53997. t.find('button[name="selectFloor"] ').on("click", function() {
  53998. e.selectEntity(e.buildings[0].buildChildren[0])
  53999. }),
  54000. t.find('button[name="selectRoom"] ').on("click", function() {
  54001. e.selectEntity(e.buildings[0].buildChildren[0].buildChildren[0])
  54002. }),
  54003. t.find('button[name="removeFirstBuilding"] ').on("click", function() {
  54004. e.removeEntity(e.buildings[0])
  54005. }),
  54006. t.find('button[name="removeFirstFloor"] ').on("click", function() {
  54007. e.removeEntity(e.buildings[0].buildChildren[0])
  54008. }),
  54009. t.find('button[name="removeFirstRoom"] ').on("click", function() {
  54010. e.removeEntity(e.buildings[0].buildChildren[0].buildChildren[0])
  54011. }),
  54012. t.find('button[name="removeFirstHole"] ').on("click", function() {
  54013. e.selected.removeHole(e.selected.holes[0])
  54014. }),
  54015. t.find('button[name="removeFirstMarker"] ').on("click", function() {
  54016. e.selected.removeMarker(0)
  54017. })
  54018. }
  54019. }, {
  54020. key: "initParitcle",
  54021. value: function() {
  54022. var e = viewer.modules.ParticleEditor
  54023. , t = $("#particle");
  54024. t.find('button[name="addFire"] ').on("click", function() {
  54025. e.startInsertion("fire+smoke")
  54026. }),
  54027. t.find('button[name="addExplode"] ').on("click", function() {
  54028. e.startInsertion("explode")
  54029. })
  54030. }
  54031. }, {
  54032. key: "initPanosEdit",
  54033. value: function() {
  54034. var e = viewer.modules.PanoEditor
  54035. , t = viewer.modules.Alignment
  54036. , n = $("#panos");
  54037. n.find('button[name="save"] ').on("click", function() {
  54038. console.log("saveData", e.exportSavingData())
  54039. }),
  54040. n.find('button[name="translate"] ').on("click", function() {
  54041. t.switchHandle("translate")
  54042. }),
  54043. n.find('button[name="rotate"] ').on("click", function() {
  54044. t.switchHandle("rotate")
  54045. }),
  54046. n.find('button[name="topView"] ').on("click", function() {
  54047. e.switchView("top")
  54048. }),
  54049. n.find('button[name="sideView"] ').on("click", function() {
  54050. e.switchView("right")
  54051. }),
  54052. n.find('button[name="3DView"] ').on("click", function() {
  54053. e.switchView("mainView")
  54054. }),
  54055. n.find('button[name="addLink"] ').on("click", function() {
  54056. e.setLinkOperateState("addLink", !0)
  54057. }),
  54058. n.find('button[name="removeLink"] ').on("click", function() {
  54059. e.setLinkOperateState("removeLink", !0)
  54060. }),
  54061. n.find('button[name="getCloser"] ').on("click", function() {
  54062. e.setZoomInState(!0)
  54063. })
  54064. }
  54065. }, {
  54066. key: "initToolbar",
  54067. value: function() {
  54068. var n = this
  54069. , e = $("#tools");
  54070. e.append(this.createToolIcon(Potree.resourcePath + "/icons/angle.png", "[title]tt.angle_measurement", function() {
  54071. $("#menu_measurements").next().slideDown();
  54072. var t = n.measuringTool.startInsertion({
  54073. showDistances: !1,
  54074. showAngles: !0,
  54075. showArea: !1,
  54076. closed: !0,
  54077. maxMarkers: 3,
  54078. minMarkers: 3,
  54079. measureType: "Angle"
  54080. })
  54081. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54082. return e.data.uuid === t.uuid
  54083. });
  54084. $.jstree.reference(e.id).deselect_all(),
  54085. $.jstree.reference(e.id).select_node(e.id)
  54086. })),
  54087. e.append(this.createToolIcon(Potree.resourcePath + "/icons/point.svg", "[title]tt.point_measurement", function() {
  54088. $("#menu_measurements").next().slideDown();
  54089. var t = n.measuringTool.startInsertion({
  54090. showDistances: !1,
  54091. showAngles: !1,
  54092. showCoordinates: !0,
  54093. showEdges: !1,
  54094. showArea: !1,
  54095. closed: !0,
  54096. maxMarkers: 1,
  54097. minMarkers: 1,
  54098. measureType: "Point"
  54099. })
  54100. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54101. return e.data.uuid === t.uuid
  54102. });
  54103. $.jstree.reference(e.id).deselect_all(),
  54104. $.jstree.reference(e.id).select_node(e.id)
  54105. })),
  54106. e.append(this.createToolIcon(Potree.resourcePath + "/icons/distance.svg", "[title]tt.distance_measurement", function() {
  54107. $("#menu_measurements").next().slideDown();
  54108. var t = n.measuringTool.startInsertion({
  54109. showDistances: !0,
  54110. showArea: !1,
  54111. closed: !1,
  54112. minMarkers: 2,
  54113. maxMarkers: 2,
  54114. measureType: "Distance"
  54115. })
  54116. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54117. return e.data.uuid === t.uuid
  54118. });
  54119. $.jstree.reference(e.id).deselect_all(),
  54120. $.jstree.reference(e.id).select_node(e.id)
  54121. })),
  54122. e.append(this.createToolIcon(Potree.resourcePath + "/icons/height.svg", "[title]tt.height_measurement", function() {
  54123. $("#menu_measurements").next().slideDown();
  54124. var t = n.measuringTool.startInsertion({
  54125. showDistances: !0,
  54126. showHeight: !0,
  54127. showArea: !1,
  54128. closed: !1,
  54129. maxMarkers: 2,
  54130. minMarkers: 2,
  54131. measureType: "Ver Distance"
  54132. })
  54133. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54134. return e.data.uuid === t.uuid
  54135. });
  54136. $.jstree.reference(e.id).deselect_all(),
  54137. $.jstree.reference(e.id).select_node(e.id)
  54138. })),
  54139. e.append(this.createToolIcon(Potree.resourcePath + "/icons/circle.svg", "[title]tt.circle_measurement", function() {
  54140. $("#menu_measurements").next().slideDown();
  54141. var t = n.measuringTool.startInsertion({
  54142. showDistances: !1,
  54143. showHeight: !1,
  54144. showArea: !1,
  54145. showCircle: !0,
  54146. showEdges: !1,
  54147. closed: !1,
  54148. maxMarkers: 3,
  54149. minMarkers: 3,
  54150. measureType: "Circle"
  54151. })
  54152. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54153. return e.data.uuid === t.uuid
  54154. });
  54155. $.jstree.reference(e.id).deselect_all(),
  54156. $.jstree.reference(e.id).select_node(e.id)
  54157. })),
  54158. e.append(this.createToolIcon(Potree.resourcePath + "/icons/azimuth.svg", "Azimuth", function() {
  54159. $("#menu_measurements").next().slideDown();
  54160. var t = n.measuringTool.startInsertion({
  54161. showDistances: !1,
  54162. showHeight: !1,
  54163. showArea: !1,
  54164. showCircle: !1,
  54165. showEdges: !1,
  54166. showAzimuth: !0,
  54167. closed: !1,
  54168. maxMarkers: 2,
  54169. minMarkers: 2,
  54170. measureType: "Azimuth"
  54171. })
  54172. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54173. return e.data.uuid === t.uuid
  54174. });
  54175. $.jstree.reference(e.id).deselect_all(),
  54176. $.jstree.reference(e.id).select_node(e.id)
  54177. })),
  54178. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_measurement", function() {
  54179. $("#menu_measurements").next().slideDown();
  54180. var t = n.measuringTool.startInsertion({
  54181. showDistances: !0,
  54182. showArea: !0,
  54183. closed: !0,
  54184. minMarkers: 3,
  54185. measureType: "Area"
  54186. })
  54187. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54188. return e.data.uuid === t.uuid
  54189. });
  54190. $.jstree.reference(e.id).deselect_all(),
  54191. $.jstree.reference(e.id).select_node(e.id)
  54192. })),
  54193. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.Hor Area", function() {
  54194. $("#menu_measurements").next().slideDown();
  54195. var t = n.measuringTool.startInsertion({
  54196. showDistances: !0,
  54197. showArea: !0,
  54198. closed: !0,
  54199. minMarkers: 3,
  54200. measureType: "Hor Area"
  54201. })
  54202. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54203. return e.data.uuid === t.uuid
  54204. });
  54205. $.jstree.reference(e.id).deselect_all(),
  54206. $.jstree.reference(e.id).select_node(e.id)
  54207. })),
  54208. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.Ver Area", function() {
  54209. $("#menu_measurements").next().slideDown();
  54210. var t = n.measuringTool.startInsertion({
  54211. showDistances: !0,
  54212. showArea: !0,
  54213. closed: !0,
  54214. minMarkers: 3,
  54215. measureType: "Ver Area"
  54216. })
  54217. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54218. return e.data.uuid === t.uuid
  54219. });
  54220. $.jstree.reference(e.id).deselect_all(),
  54221. $.jstree.reference(e.id).select_node(e.id)
  54222. })),
  54223. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_freedom_rect", function() {
  54224. $("#menu_measurements").next().slideDown();
  54225. var t = n.measuringTool.startInsertion({
  54226. showDistances: !0,
  54227. showArea: !0,
  54228. closed: !0,
  54229. minMarkers: 4,
  54230. maxMarkers: 4,
  54231. isRect: !0,
  54232. measureType: "Rect Area"
  54233. })
  54234. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54235. return e.data.uuid === t.uuid
  54236. });
  54237. $.jstree.reference(e.id).deselect_all(),
  54238. $.jstree.reference(e.id).select_node(e.id)
  54239. })),
  54240. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_horizontal_rect", function() {
  54241. $("#menu_measurements").next().slideDown();
  54242. var t = n.measuringTool.startInsertion({
  54243. showDistances: !0,
  54244. showArea: !0,
  54245. closed: !0,
  54246. minMarkers: 4,
  54247. maxMarkers: 4,
  54248. isRect: !0,
  54249. faceDirection: "horizontal",
  54250. measureType: "Hor Rect Area"
  54251. })
  54252. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54253. return e.data.uuid === t.uuid
  54254. });
  54255. $.jstree.reference(e.id).deselect_all(),
  54256. $.jstree.reference(e.id).select_node(e.id)
  54257. })),
  54258. e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_vertical_rect", function() {
  54259. $("#menu_measurements").next().slideDown();
  54260. var t = n.measuringTool.startInsertion({
  54261. showDistances: !0,
  54262. showArea: !0,
  54263. closed: !0,
  54264. minMarkers: 4,
  54265. maxMarkers: 4,
  54266. isRect: !0,
  54267. faceDirection: "vertical",
  54268. measureType: "Ver Rect Area"
  54269. })
  54270. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54271. return e.data.uuid === t.uuid
  54272. });
  54273. $.jstree.reference(e.id).deselect_all(),
  54274. $.jstree.reference(e.id).select_node(e.id)
  54275. })),
  54276. e.append(this.createToolIcon(Potree.resourcePath + "/icons/volume.svg", "[title]tt.volume_measurement", function() {
  54277. var t = n.volumeTool.startInsertion()
  54278. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54279. return e.data.uuid === t.uuid
  54280. });
  54281. $.jstree.reference(e.id).deselect_all(),
  54282. $.jstree.reference(e.id).select_node(e.id)
  54283. })),
  54284. e.append(this.createToolIcon(Potree.resourcePath + "/icons/sphere_distances.svg", "[title]tt.volume_measurement", function() {
  54285. var t = n.volumeTool.startInsertion({
  54286. type: Qp
  54287. })
  54288. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54289. return e.data.uuid === t.uuid
  54290. });
  54291. $.jstree.reference(e.id).deselect_all(),
  54292. $.jstree.reference(e.id).select_node(e.id)
  54293. })),
  54294. e.append(this.createToolIcon(Potree.resourcePath + "/icons/profile.svg", "[title]tt.height_profile", function() {
  54295. $("#menu_measurements").next().slideDown();
  54296. var t = n.profileTool.startInsertion()
  54297. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54298. return e.data.uuid === t.uuid
  54299. });
  54300. $.jstree.reference(e.id).deselect_all(),
  54301. $.jstree.reference(e.id).select_node(e.id)
  54302. })),
  54303. e.append(this.createToolIcon(Potree.resourcePath + "/icons/annotation.svg", "[title]tt.annotation", function() {
  54304. $("#menu_measurements").next().slideDown();
  54305. var t = n.viewer.annotationTool.startInsertion()
  54306. , e = $("#jstree_scene").jstree().get_json("annotations").children.find(function(e) {
  54307. return e.data.uuid === t.uuid
  54308. });
  54309. $.jstree.reference(e.id).deselect_all(),
  54310. $.jstree.reference(e.id).select_node(e.id)
  54311. })),
  54312. e.append(this.createToolIcon(Potree.resourcePath + "/icons/reset_tools.svg", "[title]tt.remove_all_measurement", function() {
  54313. n.viewer.scene.removeAllMeasurements()
  54314. }));
  54315. var t = $("#measurement_options_show");
  54316. t.selectgroup({
  54317. title: "Show/Hide labels"
  54318. }),
  54319. t.find("input").click(function(e) {
  54320. e = "SHOW" === e.target.value;
  54321. n.measuringTool.showLabels = e
  54322. });
  54323. e = this.measuringTool.showLabels ? "SHOW" : "HIDE";
  54324. t.find("input[value=".concat(e, "]")).trigger("click")
  54325. }
  54326. }, {
  54327. key: "initScene",
  54328. value: function() {
  54329. var u = this
  54330. , e = $("#menu_scene")
  54331. , t = e.next().find("#scene_objects")
  54332. , n = e.next().find("#scene_object_properties")
  54333. , i = e.next().find("#scene_export")
  54334. , r = "".concat(Potree.resourcePath, "/icons/file_geojson.svg")
  54335. , a = "".concat(Potree.resourcePath, "/icons/file_dxf.svg")
  54336. , e = "".concat(Potree.resourcePath, "/icons/file_potree.svg");
  54337. i.append('\n\t\t\t\tExport: <br>\n\t\t\t\t<a href="#" download="measure.json"><img name="geojson_export_button" src="'.concat(r, '" class="button-icon" style="height: 24px" /></a>\n\t\t\t\t<a href="#" download="measure.dxf"><img name="dxf_export_button" src="').concat(a, '" class="button-icon" style="height: 24px" /></a>\n\t\t\t\t<a href="#" download="potree.json5"><img name="potree_export_button" src="').concat(e, '" class="button-icon" style="height: 24px" /></a>\n\t\t\t'));
  54338. var o = i.find("img[name=geojson_export_button]").parent();
  54339. o.click(function(e) {
  54340. var t = u.viewer.scene
  54341. , t = [].concat(Q(t.measurements), Q(t.profiles), Q(t.volumes));
  54342. 0 < t.length ? (t = Ey.toString(t),
  54343. t = window.URL.createObjectURL(new Blob([t],{
  54344. type: "data:application/octet-stream"
  54345. })),
  54346. o.attr("href", t)) : (u.viewer.postError("nothing to export"),
  54347. e.preventDefault())
  54348. });
  54349. var s = i.find("img[name=dxf_export_button]").parent();
  54350. s.click(function(e) {
  54351. var t = u.viewer.scene
  54352. , t = [].concat(Q(t.measurements), Q(t.profiles), Q(t.volumes));
  54353. 0 < t.length ? (t = _y.toString(t),
  54354. t = window.URL.createObjectURL(new Blob([t],{
  54355. type: "data:application/octet-stream"
  54356. })),
  54357. s.attr("href", t)) : (u.viewer.postError("no measurements to export"),
  54358. e.preventDefault())
  54359. });
  54360. var l = i.find("img[name=potree_export_button]").parent();
  54361. l.click(function(e) {
  54362. var t = Potree.saveProject(u.viewer)
  54363. , t = xw.stringify(t, null, "\t")
  54364. , t = window.URL.createObjectURL(new Blob([t],{
  54365. type: "data:application/octet-stream"
  54366. }));
  54367. l.attr("href", t)
  54368. });
  54369. var c = new Iy(n,this.viewer);
  54370. c.setScene(this.viewer.scene),
  54371. localStorage.removeItem("jstree");
  54372. var d = $('<div id="jstree_scene"></div>');
  54373. t.append(d),
  54374. d.jstree({
  54375. plugins: ["checkbox", "state"],
  54376. core: {
  54377. dblclick_toggle: !1,
  54378. state: {
  54379. checked: !0
  54380. },
  54381. check_callback: !0,
  54382. expand_selected_onload: !0
  54383. },
  54384. checkbox: {
  54385. keep_selected_style: !0,
  54386. three_state: !1,
  54387. whole_node: !1,
  54388. tie_selection: !1
  54389. }
  54390. });
  54391. var h = function(e, t, n, i) {
  54392. n = d.jstree("create_node", e, {
  54393. text: t,
  54394. icon: n,
  54395. data: i
  54396. }, "last", !1, !1);
  54397. return i.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n),
  54398. n
  54399. }
  54400. , p = d.jstree("create_node", "#", {
  54401. text: "<b>Point Clouds</b>",
  54402. id: "pointclouds"
  54403. }, "last", !1, !1)
  54404. , f = d.jstree("create_node", "#", {
  54405. text: "<b>Measurements</b>",
  54406. id: "measurements"
  54407. }, "last", !1, !1)
  54408. , n = d.jstree("create_node", "#", {
  54409. text: "<b>Annotations</b>",
  54410. id: "annotations"
  54411. }, "last", !1, !1)
  54412. , m = d.jstree("create_node", "#", {
  54413. text: "<b>Other</b>",
  54414. id: "other"
  54415. }, "last", !1, !1)
  54416. , t = d.jstree("create_node", "#", {
  54417. text: "<b>Vectors</b>",
  54418. id: "vectors"
  54419. }, "last", !1, !1)
  54420. , v = d.jstree("create_node", "#", {
  54421. text: "<b> Images</b>",
  54422. id: "images"
  54423. }, "last", !1, !1);
  54424. d.jstree("check_node", p),
  54425. d.jstree("check_node", f),
  54426. d.jstree("check_node", n),
  54427. d.jstree("check_node", m),
  54428. d.jstree("check_node", t),
  54429. d.jstree("check_node", v),
  54430. d.on("create_node.jstree", function(e, t) {
  54431. d.jstree("open_all")
  54432. }),
  54433. d.on("select_node.jstree", function(e, t) {
  54434. t = t.node.data;
  54435. c.set(t),
  54436. u.viewer.inputHandler.deselectAll(),
  54437. t instanceof Yp && u.viewer.inputHandler.toggleSelection(t),
  54438. $(u.viewer.renderer.domElement).focus()
  54439. }),
  54440. d.on("deselect_node.jstree", function(e, t) {
  54441. c.set(null)
  54442. }),
  54443. d.on("delete_node.jstree", function(e, t) {
  54444. c.set(null)
  54445. }),
  54446. d.on("dblclick", ".jstree-anchor", function(e) {
  54447. var t, n, i, r, a, o, s, l = $.jstree.reference(e.target).get_node(e.target).data;
  54448. e.target.classList.contains("jstree-checkbox") || (l instanceof xm ? (e = u.viewer.getBoundingBox([l]),
  54449. (t = new Si).boundingBox = e,
  54450. u.viewer.zoomTo(t, 1, 500)) : l instanceof Wf ? (n = l.points.map(function(e) {
  54451. return e.position
  54452. }),
  54453. 0 == (t = (new kn).setFromPoints(n)).getSize(new Cn).length() && (t.min = t.max.clone(),
  54454. t.expandByVector(new Cn(1,1,1))),
  54455. (n = new Si).boundingBox = t,
  54456. u.viewer.zoomTo(n, 2, 500)) : l instanceof Kp ? (n = l.points,
  54457. 0 < (n = (new kn).setFromPoints(n)).getSize(new Cn).length() && ((i = new Si).boundingBox = n,
  54458. u.viewer.zoomTo(i, 1, 500))) : l instanceof Yp ? 0 < (i = l.boundingBox.clone().applyMatrix4(l.matrixWorld)).getSize(new Cn).length() && ((r = new Si).boundingBox = i,
  54459. u.viewer.zoomTo(r, 1, 500)) : l instanceof Kf ? l.moveHere(u.viewer.scene.getActiveCamera()) : l instanceof qf ? (r = l.camera.getWorldDirection(new Cn),
  54460. l.camera instanceof ed ? (r.multiplyScalar(l.camera.right),
  54461. a = (new Cn).addVectors(l.camera.position, r),
  54462. u.viewer.setCameraMode(em.ORTHOGRAPHIC)) : l.camera instanceof $r && (r.multiplyScalar(u.viewer.scene.view.radius),
  54463. a = (new Cn).addVectors(l.camera.position, r),
  54464. u.viewer.setCameraMode(em.PERSPECTIVE)),
  54465. u.viewer.scene.view.position.copy(l.camera.position),
  54466. u.viewer.scene.view.lookAt(a)) : "SpotLight" === l.type ? (o = 0 < l.distance ? l.distance / 4 : 5e3,
  54467. s = l.position,
  54468. s = (new Cn).addVectors(s, l.getWorldDirection(new Cn).multiplyScalar(o)),
  54469. u.viewer.scene.view.position.copy(l.position),
  54470. u.viewer.scene.view.lookAt(s)) : l instanceof Si ? 0 < (o = (new kn).setFromObject(l)).getSize(new Cn).length() && ((s = new Si).boundingBox = o,
  54471. u.viewer.zoomTo(s, 1, 500)) : l instanceof nw || l instanceof ly || Geopackage)
  54472. }),
  54473. d.on("uncheck_node.jstree", function(e, t) {
  54474. t = t.node.data;
  54475. t && (t.visible = !1)
  54476. }),
  54477. d.on("check_node.jstree", function(e, t) {
  54478. t = t.node.data;
  54479. t && (t.visible = !0)
  54480. });
  54481. function g(e) {
  54482. var t = e.pointcloud
  54483. , e = "".concat(Potree.resourcePath, "/icons/cloud.svg")
  54484. , n = h(p, t.name, e, t);
  54485. t.addEventListener("visibility_changed", function() {
  54486. t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n)
  54487. })
  54488. }
  54489. function y(e) {
  54490. var t = e.measurement
  54491. , e = Jf.getMeasurementIcon(t);
  54492. h(f, t.name, e, t)
  54493. }
  54494. function w(e) {
  54495. var t = e.volume
  54496. , e = Jf.getMeasurementIcon(t)
  54497. , n = h(f, t.name, e, t);
  54498. t.addEventListener("visibility_changed", function() {
  54499. t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n)
  54500. })
  54501. }
  54502. function b(e) {
  54503. var t = e.profile
  54504. , e = Jf.getMeasurementIcon(t);
  54505. h(f, t.name, e, t)
  54506. }
  54507. function x(e) {
  54508. var t = e.animation
  54509. , e = "".concat(Potree.resourcePath, "/icons/camera_animation.svg");
  54510. h(m, "animation", e, t)
  54511. }
  54512. function E(e) {
  54513. var t = e.images
  54514. , e = "".concat(Potree.resourcePath, "/icons/picture.svg")
  54515. , n = h(v, "images", e, t);
  54516. t.addEventListener("visibility_changed", function() {
  54517. t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n)
  54518. })
  54519. }
  54520. function _(e) {
  54521. var t = e.images
  54522. , e = "".concat(Potree.resourcePath, "/icons/picture.svg")
  54523. , n = h(v, "360° images", e, t);
  54524. t.addEventListener("visibility_changed", function() {
  54525. t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n)
  54526. })
  54527. }
  54528. function M(e) {
  54529. var t, e = e.geopackage, n = "".concat(Potree.resourcePath, "/icons/triangle.svg"), i = $("#jstree_scene"), r = ue(e.node.children);
  54530. try {
  54531. for (r.s(); !(t = r.n()).done; ) {
  54532. var a = t.value
  54533. , o = a.name
  54534. , s = i.jstree("create_node", "vectors", {
  54535. text: o,
  54536. icon: n,
  54537. object: a,
  54538. data: a
  54539. }, "last", !1, !1);
  54540. i.jstree(a.visible ? "check_node" : "uncheck_node", s)
  54541. }
  54542. } catch (e) {
  54543. r.e(e)
  54544. } finally {
  54545. r.f()
  54546. }
  54547. }
  54548. this.viewer.scene.addEventListener("pointcloud_added", g),
  54549. this.viewer.scene.addEventListener("measurement_added", y),
  54550. this.viewer.scene.addEventListener("profile_added", b),
  54551. this.viewer.scene.addEventListener("volume_added", w),
  54552. this.viewer.scene.addEventListener("camera_animation_added", x),
  54553. this.viewer.scene.addEventListener("oriented_images_added", E),
  54554. this.viewer.scene.addEventListener("360_images_added", _),
  54555. this.viewer.scene.addEventListener("geopackage_added", M),
  54556. this.viewer.scene.addEventListener("polygon_clip_volume_added", w),
  54557. this.viewer.scene.annotations.addEventListener("annotation_added", function(e) {
  54558. var n = e.annotation
  54559. , t = "".concat(Potree.resourcePath, "/icons/annotation.svg")
  54560. , e = u.annotationMapping.get(n.parent)
  54561. , t = h(e, n.title, t, n);
  54562. u.annotationMapping.set(n, t),
  54563. n.addEventListener("annotation_changed", function(e) {
  54564. var t = $("#jstree_scene").jstree().get_json("annotations").children.find(function(e) {
  54565. return e.data.uuid === n.uuid
  54566. });
  54567. $.jstree.reference(t.id).rename_node(t.id, n.title)
  54568. })
  54569. });
  54570. function A(t) {
  54571. var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54572. return e.data.uuid === t.measurement.uuid
  54573. });
  54574. d.jstree("delete_node", e.id)
  54575. }
  54576. this.viewer.scene.addEventListener("measurement_removed", A),
  54577. this.viewer.scene.addEventListener("volume_removed", function(t) {
  54578. var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54579. return e.data.uuid === t.volume.uuid
  54580. });
  54581. d.jstree("delete_node", e.id)
  54582. }),
  54583. this.viewer.scene.addEventListener("polygon_clip_volume_removed", function(t) {
  54584. var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54585. return e.data.uuid === t.volume.uuid
  54586. });
  54587. d.jstree("delete_node", e.id)
  54588. }),
  54589. this.viewer.scene.addEventListener("profile_removed", function(t) {
  54590. var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54591. return e.data.uuid === t.profile.uuid
  54592. });
  54593. d.jstree("delete_node", e.id)
  54594. });
  54595. var T = "".concat(Potree.resourcePath, "/icons/annotation.svg");
  54596. this.annotationMapping = new Map,
  54597. this.annotationMapping.set(this.viewer.scene.annotations, n),
  54598. this.viewer.scene.annotations.traverseDescendants(function(e) {
  54599. var t = u.annotationMapping.get(e.parent)
  54600. , t = h(t, e.title, T, e);
  54601. u.annotationMapping.set(e, t)
  54602. });
  54603. var S, n = this.viewer.scene, C = ue(n.pointclouds);
  54604. try {
  54605. for (C.s(); !(S = C.n()).done; ) {
  54606. var P = S.value;
  54607. g({
  54608. pointcloud: P
  54609. })
  54610. }
  54611. } catch (e) {
  54612. C.e(e)
  54613. } finally {
  54614. C.f()
  54615. }
  54616. var D, k = ue(n.measurements);
  54617. try {
  54618. for (k.s(); !(D = k.n()).done; ) {
  54619. var B = D.value;
  54620. y({
  54621. measurement: B
  54622. })
  54623. }
  54624. } catch (e) {
  54625. k.e(e)
  54626. } finally {
  54627. k.f()
  54628. }
  54629. for (var L = 0, R = [].concat(Q(n.volumes), Q(n.polygonClipVolumes)); L < R.length; L++) {
  54630. var F = R[L];
  54631. w({
  54632. volume: F
  54633. })
  54634. }
  54635. var I, O = ue(n.cameraAnimations);
  54636. try {
  54637. for (O.s(); !(I = O.n()).done; )
  54638. x({
  54639. animation: I.value
  54640. })
  54641. } catch (e) {
  54642. O.e(e)
  54643. } finally {
  54644. O.f()
  54645. }
  54646. var z, N = ue(n.orientedImages);
  54647. try {
  54648. for (N.s(); !(z = N.n()).done; )
  54649. E({
  54650. images: z.value
  54651. })
  54652. } catch (e) {
  54653. N.e(e)
  54654. } finally {
  54655. N.f()
  54656. }
  54657. var U, G = ue(n.images360);
  54658. try {
  54659. for (G.s(); !(U = G.n()).done; )
  54660. _({
  54661. images: U.value
  54662. })
  54663. } catch (e) {
  54664. G.e(e)
  54665. } finally {
  54666. G.f()
  54667. }
  54668. var H, V = ue(n.geopackages);
  54669. try {
  54670. for (V.s(); !(H = V.n()).done; )
  54671. M({
  54672. geopackage: H.value
  54673. })
  54674. } catch (e) {
  54675. V.e(e)
  54676. } finally {
  54677. V.f()
  54678. }
  54679. var j, W = ue(n.profiles);
  54680. try {
  54681. for (W.s(); !(j = W.n()).done; ) {
  54682. var X = j.value;
  54683. b({
  54684. profile: X
  54685. })
  54686. }
  54687. } catch (e) {
  54688. W.e(e)
  54689. } finally {
  54690. W.f()
  54691. }
  54692. h(m, "Camera", null, new Kr),
  54693. this.viewer.addEventListener("scene_changed", function(e) {
  54694. c.setScene(e.scene),
  54695. e.oldScene.removeEventListener("pointcloud_added", g),
  54696. e.oldScene.removeEventListener("measurement_added", y),
  54697. e.oldScene.removeEventListener("profile_added", b),
  54698. e.oldScene.removeEventListener("volume_added", w),
  54699. e.oldScene.removeEventListener("polygon_clip_volume_added", w),
  54700. e.oldScene.removeEventListener("measurement_removed", A),
  54701. e.scene.addEventListener("pointcloud_added", g),
  54702. e.scene.addEventListener("measurement_added", y),
  54703. e.scene.addEventListener("profile_added", b),
  54704. e.scene.addEventListener("volume_added", w),
  54705. e.scene.addEventListener("polygon_clip_volume_added", w),
  54706. e.scene.addEventListener("measurement_removed", A)
  54707. })
  54708. }
  54709. }, {
  54710. key: "initClippingTool",
  54711. value: function() {
  54712. var n = this;
  54713. this.viewer.addEventListener("cliptask_changed", function(e) {
  54714. console.log("TODO")
  54715. }),
  54716. this.viewer.addEventListener("clipmethod_changed", function(e) {
  54717. console.log("TODO")
  54718. });
  54719. var e = $("#cliptask_options");
  54720. e.selectgroup({
  54721. title: "Clip Task"
  54722. }),
  54723. e.find("input").click(function(e) {
  54724. n.viewer.setClipTask(tm[e.target.value])
  54725. });
  54726. var t = Object.keys(tm).filter(function(e) {
  54727. return tm[e] === n.viewer.clipTask
  54728. });
  54729. e.find("input[value=".concat(t, "]")).trigger("click");
  54730. e = $("#clipmethod_options");
  54731. e.selectgroup({
  54732. title: "Clip Method"
  54733. }),
  54734. e.find("input").click(function(e) {
  54735. n.viewer.setClipMethod(nm[e.target.value])
  54736. });
  54737. t = Object.keys(nm).filter(function(e) {
  54738. return nm[e] === n.viewer.clipMethod
  54739. });
  54740. e.find("input[value=".concat(t, "]")).trigger("click");
  54741. t = $("#clipping_tools");
  54742. t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip_volume.svg", "[title]tt.clip_volume", function() {
  54743. var t = n.volumeTool.startInsertion({
  54744. clip: !0
  54745. })
  54746. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54747. return e.data.uuid === t.uuid
  54748. });
  54749. $.jstree.reference(e.id).deselect_all(),
  54750. $.jstree.reference(e.id).select_node(e.id)
  54751. })),
  54752. t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip-polygon.svg", "[title]tt.clip_polygon", function() {
  54753. var t = n.viewer.clippingTool.startInsertion({
  54754. type: "polygon"
  54755. })
  54756. , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54757. return e.data.uuid === t.uuid
  54758. });
  54759. $.jstree.reference(e.id).deselect_all(),
  54760. $.jstree.reference(e.id).select_node(e.id)
  54761. }));
  54762. var i = new Jv(this.viewer);
  54763. t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip-screen.svg", "[title]tt.screen_clip_box", function() {
  54764. var t, e;
  54765. n.viewer.scene.getActiveCamera()instanceof ed ? (t = i.startInsertion(),
  54766. e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) {
  54767. return e.data.uuid === t.uuid
  54768. }),
  54769. $.jstree.reference(e.id).deselect_all(),
  54770. $.jstree.reference(e.id).select_node(e.id)) : n.viewer.postMessage("Switch to Orthographic Camera Mode before using the Screen-Box-Select tool.", {
  54771. duration: 2e3
  54772. })
  54773. })),
  54774. t.append(this.createToolIcon(Potree.resourcePath + "/icons/remove.svg", "[title]tt.remove_all_clipping_volumes", function() {
  54775. n.viewer.scene.removeAllClipVolumes()
  54776. }))
  54777. }
  54778. }, {
  54779. key: "initFilters",
  54780. value: function() {
  54781. this.initClassificationList(),
  54782. this.initReturnFilters(),
  54783. this.initGPSTimeFilters(),
  54784. this.initPointSourceIDFilters()
  54785. }
  54786. }, {
  54787. key: "initReturnFilters",
  54788. value: function() {
  54789. var i = this
  54790. , e = $("#return_filter_panel")
  54791. , r = e.find("#sldReturnNumber")
  54792. , a = e.find("#lblReturnNumber");
  54793. r.slider({
  54794. range: !0,
  54795. min: 0,
  54796. max: 7,
  54797. step: 1,
  54798. values: [0, 7],
  54799. slide: function(e, t) {
  54800. i.viewer.setFilterReturnNumberRange(t.values[0], t.values[1])
  54801. }
  54802. });
  54803. function t(e) {
  54804. var t = (n = N(i.viewer.filterReturnNumberRange, 2))[0]
  54805. , n = n[1];
  54806. a[0].innerHTML = "".concat(t, " to ").concat(n),
  54807. r.slider({
  54808. values: [t, n]
  54809. })
  54810. }
  54811. this.viewer.addEventListener("filter_return_number_range_changed", t),
  54812. t();
  54813. var o = e.find("#sldNumberOfReturns")
  54814. , s = e.find("#lblNumberOfReturns");
  54815. o.slider({
  54816. range: !0,
  54817. min: 0,
  54818. max: 7,
  54819. step: 1,
  54820. values: [0, 7],
  54821. slide: function(e, t) {
  54822. i.viewer.setFilterNumberOfReturnsRange(t.values[0], t.values[1])
  54823. }
  54824. });
  54825. function n(e) {
  54826. var t = (n = N(i.viewer.filterNumberOfReturnsRange, 2))[0]
  54827. , n = n[1];
  54828. s[0].innerHTML = "".concat(t, " to ").concat(n),
  54829. o.slider({
  54830. values: [t, n]
  54831. })
  54832. }
  54833. this.viewer.addEventListener("filter_number_of_returns_range_changed", n),
  54834. n()
  54835. }
  54836. }, {
  54837. key: "initGPSTimeFilters",
  54838. value: function() {
  54839. var i = this
  54840. , e = $("#gpstime_filter_panel")
  54841. , r = new zy({
  54842. levels: 4,
  54843. slide: function(e) {
  54844. var t;
  54845. (t = i.viewer).setFilterGPSTimeRange.apply(t, Q(e.values))
  54846. }
  54847. })
  54848. , a = !1;
  54849. this.viewer.addEventListener("update", function(e) {
  54850. var t = i.viewer.getGpsTimeExtent()
  54851. , n = t[0] !== 1 / 0;
  54852. !a && n && function() {
  54853. $("#gpstime_multilevel_range_container")[0].prepend(r.element);
  54854. var e = i.viewer.getGpsTimeExtent();
  54855. r.setRange(e),
  54856. r.setValues(e),
  54857. a = !0
  54858. }(),
  54859. r.setRange(t)
  54860. });
  54861. var n = e.find("#txtGpsTime")
  54862. , e = e.find("#btnFindGpsTime")
  54863. , o = null;
  54864. n.on("input", function(e) {
  54865. var t = n.val();
  54866. isNaN(t) ? (o = null,
  54867. n.css("background-color", "#ff9999")) : (t = parseFloat(t),
  54868. o = t,
  54869. n.css("background-color", ""))
  54870. }),
  54871. e.click(function() {
  54872. null !== o && viewer.moveToGpsTimeVicinity(o)
  54873. })
  54874. }
  54875. }, {
  54876. key: "initPointSourceIDFilters",
  54877. value: function() {
  54878. var n = this
  54879. , i = $("#pointsourceid_filter_panel")
  54880. , r = new zy({
  54881. levels: 4,
  54882. range: [0, 65535],
  54883. precision: 1,
  54884. slide: function(e) {
  54885. e = e.values;
  54886. n.viewer.setFilterPointSourceIDRange(e[0], e[1])
  54887. }
  54888. })
  54889. , a = !1;
  54890. this.viewer.addEventListener("update", function(e) {
  54891. var t = n.viewer.filterPointSourceIDRange;
  54892. a || (i[0].prepend(r.element),
  54893. a = !0,
  54894. r.setValues(t))
  54895. })
  54896. }
  54897. }, {
  54898. key: "initClassificationList",
  54899. value: function() {
  54900. function e() {
  54901. for (var e in n(),
  54902. c.viewer.classifications)
  54903. t(e, c.viewer.classifications[e].name);
  54904. i()
  54905. }
  54906. var c = this
  54907. , d = $("#classificationList")
  54908. , t = function(t, e) {
  54909. var n = c.viewer.classifications[t]
  54910. , i = "colorPickerClassification_" + t
  54911. , r = n.visible ? "checked" : ""
  54912. , r = $('\n\t\t\t\t<li>\n\t\t\t\t\t<label style="whitespace: nowrap; display: flex">\n\t\t\t\t\t\t<input id="'.concat("chkClassification_" + t, '" type="checkbox" ').concat(r, '/>\n\t\t\t\t\t\t<span style="flex-grow: 1">').concat(e, '</span>\n\t\t\t\t\t\t<input id="').concat(i, '" style="zoom: 0.5" />\n\t\t\t\t\t</label>\n\t\t\t\t</li>\n\t\t\t'))
  54913. , e = r.find("input")
  54914. , i = r.find("#".concat(i));
  54915. e.click(function(e) {
  54916. c.viewer.setClassificationVisibility(t, e.target.checked)
  54917. });
  54918. e = n.color.map(function(e) {
  54919. return 255 * e
  54920. }).join(", "),
  54921. e = "rgb(".concat(e, ")");
  54922. i.spectrum({
  54923. color: e,
  54924. showInput: !0,
  54925. preferredFormat: "rgb",
  54926. cancelText: "",
  54927. chooseText: "Apply",
  54928. move: function(e) {
  54929. e = e.toRgb(),
  54930. e = [e.r / 255, e.g / 255, e.b / 255, 1];
  54931. n.color = e
  54932. },
  54933. change: function(e) {
  54934. e = e.toRgb(),
  54935. e = [e.r / 255, e.g / 255, e.b / 255, 1];
  54936. n.color = e
  54937. }
  54938. }),
  54939. d.append(r)
  54940. }
  54941. , n = function() {
  54942. var e = $('\n\t\t\t\t<li>\n\t\t\t\t\t<label style="whitespace: nowrap">\n\t\t\t\t\t\t<input id="toggleClassificationFilters" type="checkbox" checked/>\n\t\t\t\t\t\t<span>show/hide all</span>\n\t\t\t\t\t</label>\n\t\t\t\t</li>\n\t\t\t');
  54943. e.find("input").click(function(e) {
  54944. c.viewer.toggleAllClassificationsVisibility()
  54945. }),
  54946. d.append(e)
  54947. }
  54948. , i = function() {
  54949. var e = $('\n\t\t\t\t<li>\n\t\t\t\t\t<input type="button" value="invert" />\n\t\t\t\t</li>\n\t\t\t');
  54950. e.find("input").click(function() {
  54951. for (var e = c.viewer.classifications, t = 0, n = Object.keys(e); t < n.length; t++) {
  54952. var i = n[t]
  54953. , r = e[i];
  54954. c.viewer.setClassificationVisibility(i, !r.visible)
  54955. }
  54956. }),
  54957. d.append(e)
  54958. };
  54959. e(),
  54960. this.viewer.addEventListener("classifications_changed", function() {
  54961. d.empty(),
  54962. e()
  54963. }),
  54964. this.viewer.addEventListener("classification_visibility_changed", function() {
  54965. for (var e = 0, t = Object.keys(c.viewer.classifications); e < t.length; e++) {
  54966. var n = t[e]
  54967. , i = c.viewer.classifications[n];
  54968. d.find("#chkClassification_".concat(n)).prop("checked", i.visible)
  54969. }
  54970. for (var r = 0, a = 0, o = 0, s = Object.keys(c.viewer.classifications); o < s.length; o++) {
  54971. var l = s[o];
  54972. c.viewer.classifications[l].visible && r++,
  54973. a++
  54974. }
  54975. var u = r === a;
  54976. d.find("#toggleClassificationFilters").prop("checked", u)
  54977. })
  54978. }
  54979. }, {
  54980. key: "initAccordion",
  54981. value: function() {
  54982. var r = this;
  54983. $(".accordion > h3").each(function() {
  54984. var e = $(this)
  54985. , t = $(this).next();
  54986. t.hide(),
  54987. e.click(function() {
  54988. t.slideToggle()
  54989. })
  54990. });
  54991. for (var a = [["EN", "en"], ["FR", "fr"], ["DE", "de"], ["JP", "jp"], ["ES", "es"], ["SE", "se"], ["ZH", "zh"]], o = $("#potree_languages"), e = 0; e < a.length; e++)
  54992. !function(e) {
  54993. var t = N(a[e], 2)
  54994. , n = t[0]
  54995. , i = t[1]
  54996. , n = $("<a>".concat(n, "</a>"));
  54997. n.click(function() {
  54998. return r.viewer.setLanguage(i)
  54999. }),
  55000. 0 === e && n.css("margin-left", "30px"),
  55001. o.append(n),
  55002. e < a.length - 1 && o.append($(document.createTextNode(" - ")))
  55003. }(e)
  55004. }
  55005. }, {
  55006. key: "initAppearance",
  55007. value: function() {
  55008. var n = this
  55009. , t = this.dom.find("#sldPointBudget");
  55010. t.slider({
  55011. value: this.viewer.getPointBudget(),
  55012. min: 1e5,
  55013. max: 1e7,
  55014. step: 1e3,
  55015. slide: function(e, t) {
  55016. n.viewer.setPointBudget(t.value)
  55017. }
  55018. }),
  55019. this.dom.find("#sldFOV").slider({
  55020. value: this.viewer.getFOV(),
  55021. min: 20,
  55022. max: 100,
  55023. step: 1,
  55024. slide: function(e, t) {
  55025. n.viewer.setFOV(t.value)
  55026. }
  55027. }),
  55028. $("#sldEDLRadius").slider({
  55029. value: this.viewer.getEDLRadius(),
  55030. min: 1,
  55031. max: 4,
  55032. step: .01,
  55033. slide: function(e, t) {
  55034. n.viewer.setEDLRadius(t.value)
  55035. }
  55036. }),
  55037. $("#sldEDLStrength").slider({
  55038. value: this.viewer.getEDLStrength(),
  55039. min: 0,
  55040. max: 5,
  55041. step: .01,
  55042. slide: function(e, t) {
  55043. n.viewer.setEDLStrength(t.value)
  55044. }
  55045. }),
  55046. $("#sldEDLOpacity").slider({
  55047. value: this.viewer.getEDLOpacity(),
  55048. min: 0,
  55049. max: 1,
  55050. step: .01,
  55051. slide: function(e, t) {
  55052. n.viewer.setEDLOpacity(t.value)
  55053. }
  55054. }),
  55055. this.viewer.addEventListener("point_budget_changed", function(e) {
  55056. $("#lblPointBudget")[0].innerHTML = Jf.addCommas(n.viewer.getPointBudget()),
  55057. t.slider({
  55058. value: n.viewer.getPointBudget()
  55059. })
  55060. }),
  55061. this.viewer.addEventListener("fov_changed", function(e) {
  55062. $("#lblFOV")[0].innerHTML = parseInt(n.viewer.getFOV()),
  55063. $("#sldFOV").slider({
  55064. value: n.viewer.getFOV()
  55065. })
  55066. }),
  55067. this.viewer.addEventListener("use_edl_changed", function(e) {
  55068. $("#chkEDLEnabled")[0].checked = n.viewer.getEDLEnabled()
  55069. }),
  55070. this.viewer.addEventListener("edl_radius_changed", function(e) {
  55071. $("#lblEDLRadius")[0].innerHTML = n.viewer.getEDLRadius().toFixed(1),
  55072. $("#sldEDLRadius").slider({
  55073. value: n.viewer.getEDLRadius()
  55074. })
  55075. }),
  55076. this.viewer.addEventListener("edl_strength_changed", function(e) {
  55077. $("#lblEDLStrength")[0].innerHTML = n.viewer.getEDLStrength().toFixed(1),
  55078. $("#sldEDLStrength").slider({
  55079. value: n.viewer.getEDLStrength()
  55080. })
  55081. }),
  55082. this.viewer.addEventListener("background_changed", function(e) {
  55083. $("input[name=background][value='" + n.viewer.getBackground() + "']").prop("checked", !0)
  55084. }),
  55085. $("#lblPointBudget")[0].innerHTML = Jf.addCommas(this.viewer.getPointBudget()),
  55086. $("#lblFOV")[0].innerHTML = parseInt(this.viewer.getFOV()),
  55087. $("#lblEDLRadius")[0].innerHTML = this.viewer.getEDLRadius().toFixed(1),
  55088. $("#lblEDLStrength")[0].innerHTML = this.viewer.getEDLStrength().toFixed(1),
  55089. $("#chkEDLEnabled")[0].checked = this.viewer.getEDLEnabled();
  55090. var e = $("#background_options");
  55091. e.selectgroup(),
  55092. e.find("input").click(function(e) {
  55093. n.viewer.setBackground(e.target.value)
  55094. });
  55095. e = this.viewer.getBackground();
  55096. try {
  55097. $("input[name=background_options][value=".concat(e, "]")).trigger("click")
  55098. } catch (e) {}
  55099. $("#chkEDLEnabled").click(function() {
  55100. n.viewer.setEDLEnabled($("#chkEDLEnabled").prop("checked"))
  55101. })
  55102. }
  55103. }, {
  55104. key: "initNavigation",
  55105. value: function() {
  55106. var n = this
  55107. , e = $("#navigation")
  55108. , t = $("#sldMoveSpeed")
  55109. , i = $("#lblMoveSpeed");
  55110. e.append(this.createToolIcon(Potree.resourcePath + "/icons/earth_controls_1.png", "[title]tt.earth_control", function() {
  55111. n.viewer.setControls(n.viewer.earthControls)
  55112. })),
  55113. e.append(this.createToolIcon(Potree.resourcePath + "/icons/fps_controls.svg", "[title]tt.flight_control", function() {
  55114. n.viewer.setControls(n.viewer.fpControls),
  55115. n.viewer.fpControls.lockElevation = !1
  55116. })),
  55117. e.append(this.createToolIcon(Potree.resourcePath + "/icons/helicopter_controls.svg", "[title]tt.heli_control", function() {
  55118. n.viewer.setControls(n.viewer.fpControls),
  55119. n.viewer.fpControls.lockElevation = !0
  55120. })),
  55121. e.append(this.createToolIcon(Potree.resourcePath + "/icons/orbit_controls.svg", "[title]tt.orbit_control", function() {
  55122. n.viewer.setControls(n.viewer.orbitControls)
  55123. })),
  55124. e.append(this.createToolIcon(Potree.resourcePath + "/icons/focus.svg", "[title]tt.focus_control", function() {
  55125. n.viewer.fitToScreen()
  55126. })),
  55127. e.append(this.createToolIcon(Potree.resourcePath + "/icons/navigation_cube.svg", "[title]tt.navigation_cube_control", function() {
  55128. n.viewer.toggleNavigationCube()
  55129. })),
  55130. e.append(this.createToolIcon(Potree.resourcePath + "/images/compas.svg", "[title]tt.compass", function() {
  55131. var e = !n.viewer.compass.isVisible();
  55132. n.viewer.compass.setVisible(e)
  55133. })),
  55134. e.append(this.createToolIcon(Potree.resourcePath + "/icons/camera_animation.svg", "[title]tt.camera_animation", function() {
  55135. var e = bv.defaultFromView(n.viewer);
  55136. viewer.scene.addCameraAnimation(e)
  55137. })),
  55138. e.append("<br>"),
  55139. e.append(this.createToolIcon(Potree.resourcePath + "/icons/left.svg", "[title]tt.left_view_control", function() {
  55140. n.viewer.setLeftView()
  55141. })),
  55142. e.append(this.createToolIcon(Potree.resourcePath + "/icons/right.svg", "[title]tt.right_view_control", function() {
  55143. n.viewer.setRightView()
  55144. })),
  55145. e.append(this.createToolIcon(Potree.resourcePath + "/icons/front.svg", "[title]tt.front_view_control", function() {
  55146. n.viewer.setFrontView()
  55147. })),
  55148. e.append(this.createToolIcon(Potree.resourcePath + "/icons/back.svg", "[title]tt.back_view_control", function() {
  55149. n.viewer.setBackView()
  55150. })),
  55151. e.append(this.createToolIcon(Potree.resourcePath + "/icons/top.svg", "[title]tt.top_view_control", function() {
  55152. n.viewer.setTopView()
  55153. })),
  55154. e.append(this.createToolIcon(Potree.resourcePath + "/icons/bottom.svg", "[title]tt.bottom_view_control", function() {
  55155. n.viewer.setBottomView()
  55156. }));
  55157. var r = $('\n\t\t\t<selectgroup id="camera_projection_options">\n\t\t\t\t<option id="camera_projection_options_perspective" value="PERSPECTIVE">Perspective</option>\n\t\t\t\t<option id="camera_projection_options_orthigraphic" value="ORTHOGRAPHIC">Orthographic</option>\n\t\t\t</selectgroup>\n\t\t');
  55158. e.append(r),
  55159. r.selectgroup({
  55160. title: "Camera Projection"
  55161. }),
  55162. r.find("input").click(function(e) {
  55163. n.viewer.setCameraMode(em[e.target.value])
  55164. });
  55165. e = Object.keys(em).filter(function(e) {
  55166. return em[e] === n.viewer.scene.cameraMode
  55167. });
  55168. r.find("input[value=".concat(e, "]")).trigger("click");
  55169. function a(e) {
  55170. return Math.pow((e - o.x) / o.y, .25)
  55171. }
  55172. var o = new yn(1,1e4);
  55173. t.slider({
  55174. value: a(this.viewer.getMoveSpeed()),
  55175. min: 0,
  55176. max: 1,
  55177. step: .01,
  55178. slide: function(e, t) {
  55179. n.viewer.setMoveSpeed((t = t.value,
  55180. Math.pow(t, 4) * o.y + o.x))
  55181. }
  55182. }),
  55183. this.viewer.addEventListener("move_speed_changed", function(e) {
  55184. i.html(n.viewer.getMoveSpeed().toFixed(1)),
  55185. t.slider({
  55186. value: a(n.viewer.getMoveSpeed())
  55187. })
  55188. }),
  55189. i.html(this.viewer.getMoveSpeed().toFixed(1))
  55190. }
  55191. }, {
  55192. key: "initSettings",
  55193. value: function() {
  55194. var n = this;
  55195. $("#sldMinNodeSize").slider({
  55196. value: this.viewer.getMinNodeSize(),
  55197. min: 0,
  55198. max: 1e3,
  55199. step: .01,
  55200. slide: function(e, t) {
  55201. n.viewer.setMinNodeSize(t.value)
  55202. }
  55203. }),
  55204. this.viewer.addEventListener("minnodesize_changed", function(e) {
  55205. $("#lblMinNodeSize").html(parseInt(n.viewer.getMinNodeSize())),
  55206. $("#sldMinNodeSize").slider({
  55207. value: n.viewer.getMinNodeSize()
  55208. })
  55209. }),
  55210. $("#lblMinNodeSize").html(parseInt(this.viewer.getMinNodeSize()));
  55211. var e = $("#splat_quality_options");
  55212. e.selectgroup({
  55213. title: "Splat Quality"
  55214. }),
  55215. e.find("input").click(function(e) {
  55216. "standard" === e.target.value ? n.viewer.useHQ = !1 : "hq" === e.target.value && (n.viewer.useHQ = !0)
  55217. });
  55218. var t = this.viewer.useHQ ? "hq" : "standard";
  55219. e.find("input[value=".concat(t, "]")).trigger("click"),
  55220. $("#show_bounding_box").click(function() {
  55221. n.viewer.setShowBoundingBox($("#show_bounding_box").prop("checked"))
  55222. }),
  55223. $("#set_freeze").click(function() {
  55224. n.viewer.setFreeze($("#set_freeze").prop("checked"))
  55225. })
  55226. }
  55227. }]),
  55228. t
  55229. }(), _w = function() {
  55230. y(i, hn);
  55231. var n = w(i);
  55232. function i(e) {
  55233. var t;
  55234. return O(this, i),
  55235. (t = n.call(this)).viewer = e,
  55236. t.renderer = e.renderer,
  55237. t.sg = new Su(.1),
  55238. t.sm = new Xu,
  55239. t.s = new Hr(t.sg,t.sm),
  55240. t
  55241. }
  55242. return h(i, [{
  55243. key: "startInsertion",
  55244. value: function() {
  55245. var n = this
  55246. , t = this.viewer.renderer.domElement
  55247. , i = new Kf({
  55248. position: [589748.27, 231444.54, 753.675],
  55249. title: "Annotation Title",
  55250. description: "Annotation Description",
  55251. radius: 1,
  55252. cameraPosition: [589748.27, 231444.54, 753.675]
  55253. });
  55254. this.dispatchEvent({
  55255. type: "start_inserting_annotation",
  55256. annotation: i
  55257. });
  55258. var r = this.viewer.scene.annotations;
  55259. r.add(i);
  55260. function a(e) {
  55261. e.button === C.LEFT ? o.finish() : e.button === C.RIGHT && o.cancel()
  55262. }
  55263. var o = {
  55264. cancel: null,
  55265. finish: null
  55266. };
  55267. o.cancel = function(e) {
  55268. r.remove(i),
  55269. t.removeEventListener("mouseup", a, !0)
  55270. }
  55271. ,
  55272. o.finish = function(e) {
  55273. t.removeEventListener("mouseup", a, !0)
  55274. }
  55275. ,
  55276. t.addEventListener("mouseup", a, !0);
  55277. function s(e) {
  55278. viewer.scene.scene.remove(n.s),
  55279. n.s.removeEventListener("drag", l),
  55280. n.s.removeEventListener("drop", s)
  55281. }
  55282. var l = function(e) {
  55283. var t = e.viewer.scene.getActiveCamera()
  55284. , e = e.viewer.inputHandler.intersectPoint;
  55285. e && (n.s.position.copy(e.location),
  55286. i.position.copy(e.location),
  55287. i.cameraTarget.copy(e.location),
  55288. i.cameraPosition.copy(t.position))
  55289. };
  55290. return this.s.addEventListener("drag", l),
  55291. this.s.addEventListener("drop", s),
  55292. this.viewer.scene.scene.add(this.s),
  55293. this.viewer.inputHandler.startDragging(this.s),
  55294. i
  55295. }
  55296. }, {
  55297. key: "update",
  55298. value: function() {}
  55299. }, {
  55300. key: "render",
  55301. value: function() {}
  55302. }]),
  55303. i
  55304. }(), Mw = 15, Aw = new bu(1,1), Tw = new _c, Sw = new tl({
  55305. color: "#ffffff"
  55306. }), Cw = function() {
  55307. y(i, Si);
  55308. var n = w(i);
  55309. function i(e) {
  55310. var t;
  55311. return O(this, i),
  55312. (t = n.call(this)).lineLength = null != e.lineLength ? e.lineLength : .6,
  55313. t.position.copy(e.position),
  55314. t.normal = null != e.normal ? e.normal : new Cn(0,0,-1),
  55315. t.root = e.root,
  55316. t.build(),
  55317. t
  55318. }
  55319. return h(i, [{
  55320. key: "build",
  55321. value: function() {
  55322. bw = bw || new $i({
  55323. transparent: !0,
  55324. map: Tw.load(Potree.resourcePath + "/textures/spot_default.png")
  55325. });
  55326. var e = this.normal.clone().multiplyScalar(this.lineLength);
  55327. this.line = Sf.createLine([new Cn(0,0,0), e], {
  55328. mat: Sw
  55329. });
  55330. var t = new Si;
  55331. this.spot = new Hr(Aw,bw),
  55332. this.spot.scale.set(.4, .4, .4),
  55333. this.titleLabel = new Jp({
  55334. root: t,
  55335. text: "1",
  55336. sizeInfo: {
  55337. width2d: 200
  55338. },
  55339. textColor: {
  55340. r: 255,
  55341. g: 255,
  55342. b: 255,
  55343. a: 1
  55344. },
  55345. backgroundColor: {
  55346. r: 0,
  55347. g: 0,
  55348. b: 0,
  55349. a: .8
  55350. },
  55351. borderRadius: 6,
  55352. fontsize: 13,
  55353. fontWeight: "",
  55354. renderOrder: Mw,
  55355. pickOrder: Mw
  55356. }),
  55357. this.spot.renderOrder = Mw,
  55358. this.titleLabel.position.set(0, .4, 0),
  55359. this.titleLabel.sprite.material.depthTest = this.titleLabel.sprite.material.depthWrite = !0,
  55360. t.position.copy(e),
  55361. t.add(this.spot),
  55362. t.add(this.titleLabel),
  55363. this.add(t),
  55364. this.add(this.line),
  55365. viewer.scene.tags.add(this)
  55366. }
  55367. }, {
  55368. key: "updateMatrixWorld",
  55369. value: function(e) {
  55370. this.updateMatrix(),
  55371. this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix);
  55372. for (var t = this.children, n = 0, i = t.length; n < i; n++)
  55373. t[n].updateMatrixWorld(e)
  55374. }
  55375. }, {
  55376. key: "updateWorldMatrix",
  55377. value: function(e, t) {
  55378. if (!0 === e && null !== this.root && this.root.updateWorldMatrix(!0, !1),
  55379. this.matrixAutoUpdate && this.updateMatrix(),
  55380. this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix),
  55381. !0 === t)
  55382. for (var n = this.children, i = 0, r = n.length; i < r; i++)
  55383. n[i].updateWorldMatrix(!1, !0)
  55384. }
  55385. }]),
  55386. i
  55387. }(), Pw = function() {
  55388. y(i, hn);
  55389. var n = w(i);
  55390. function i(e) {
  55391. var t;
  55392. return O(this, i),
  55393. (t = n.call(this)).viewer = e,
  55394. t.viewer.addEventListener("start_inserting_tag", function(e) {
  55395. t.viewer.dispatchEvent({
  55396. type: "cancel_insertions"
  55397. })
  55398. }),
  55399. t
  55400. }
  55401. return h(i, [{
  55402. key: "startInsertion",
  55403. value: function() {
  55404. var e = this
  55405. , n = $.Deferred();
  55406. this.viewer.dispatchEvent({
  55407. type: "start_inserting_tag"
  55408. });
  55409. var i = function() {
  55410. e.viewer.removeEventListener("global_click", t)
  55411. }
  55412. , t = function(e) {
  55413. var t = e.intersect && e.intersect.location;
  55414. if (t) {
  55415. t = Potree.Utils.datasetPosTransform({
  55416. toDataset: !0,
  55417. pointcloud: e.intersect.pointcloud,
  55418. object: e.intersect.object,
  55419. position: t
  55420. }),
  55421. t = new Cw({
  55422. title: "1",
  55423. position: t,
  55424. normal: e.intersect.normal,
  55425. root: e.intersect.pointcloud || e.intersect.object
  55426. });
  55427. return i(),
  55428. e.consume && e.consume(),
  55429. n.resolve(t),
  55430. {
  55431. stopContinue: !0
  55432. }
  55433. }
  55434. };
  55435. return this.viewer.addEventListener("global_click", t, 10),
  55436. n.promise()
  55437. }
  55438. }]),
  55439. i
  55440. }(), Dw = function() {
  55441. y(r, Si);
  55442. var i = w(r);
  55443. function r(n) {
  55444. var a;
  55445. O(this, r),
  55446. (a = i.call(this)).viewer = n;
  55447. function e(e) {
  55448. var t = new $i({
  55449. depthTest: !0,
  55450. depthWrite: !0,
  55451. side: Y
  55452. });
  55453. return (new _c).load(le.resourcePath + "/textures/navigation/" + e, function(e) {
  55454. e.anisotropy = n.renderer.capabilities.getMaxAnisotropy(),
  55455. t.map = e,
  55456. t.needsUpdate = !0
  55457. }),
  55458. t
  55459. }
  55460. var t = new bu(1,1);
  55461. a.front = new Hr(t,e("F.png")),
  55462. a.front.position.y = -.5,
  55463. a.front.rotation.x = Math.PI / 2,
  55464. a.front.updateMatrixWorld(),
  55465. a.front.name = "F",
  55466. a.add(a.front),
  55467. a.back = new Hr(t,e("B.png")),
  55468. a.back.position.y = .5,
  55469. a.back.rotation.x = Math.PI / 2,
  55470. a.back.updateMatrixWorld(),
  55471. a.back.name = "B",
  55472. a.add(a.back),
  55473. a.left = new Hr(t,e("L.png")),
  55474. a.left.position.x = -.5,
  55475. a.left.rotation.y = Math.PI / 2,
  55476. a.left.updateMatrixWorld(),
  55477. a.left.name = "L",
  55478. a.add(a.left),
  55479. a.right = new Hr(t,e("R.png")),
  55480. a.right.position.x = .5,
  55481. a.right.rotation.y = Math.PI / 2,
  55482. a.right.updateMatrixWorld(),
  55483. a.right.name = "R",
  55484. a.add(a.right),
  55485. a.bottom = new Hr(t,e("D.png")),
  55486. a.bottom.position.z = -.5,
  55487. a.bottom.updateMatrixWorld(),
  55488. a.bottom.name = "D",
  55489. a.add(a.bottom),
  55490. a.top = new Hr(t,e("U.png")),
  55491. a.top.position.z = .5,
  55492. a.top.updateMatrixWorld(),
  55493. a.top.name = "U",
  55494. a.add(a.top),
  55495. a.width = 150,
  55496. a.camera = new ed(-1,1,1,-1,-1,1),
  55497. a.camera.position.copy(new Cn(0,0,0)),
  55498. a.camera.lookAt(new Cn(0,1,0)),
  55499. a.camera.updateMatrixWorld(),
  55500. a.camera.rotation.order = "ZXY";
  55501. return a.viewer.renderer.domElement.addEventListener("mousedown", function(e) {
  55502. if (a.visible) {
  55503. a.pickedFace = null;
  55504. var t = new yn;
  55505. if (t.x = e.clientX - (window.innerWidth - a.width),
  55506. t.y = e.clientY,
  55507. !(t.x < 0 || t.y > a.width)) {
  55508. t.x = t.x / a.width * 2 - 1,
  55509. t.y = 2 * -(t.y / a.width) + 1;
  55510. e = new sh;
  55511. e.setFromCamera(t, a.camera),
  55512. e.ray.origin.sub(a.camera.getWorldDirection(new Cn));
  55513. for (var n = e.intersectObjects(a.children), i = 1e3, r = 0; r < n.length; r++)
  55514. n[r].distance < i && (a.pickedFace = n[r].object.name,
  55515. i = n[r].distance);
  55516. a.pickedFace && a.viewer.setView(a.pickedFace)
  55517. }
  55518. }
  55519. }, !1),
  55520. a
  55521. }
  55522. return h(r, [{
  55523. key: "update",
  55524. value: function(e) {
  55525. this.camera.rotation.copy(e),
  55526. this.camera.updateMatrixWorld()
  55527. }
  55528. }]),
  55529. r
  55530. }(), kw = 2, Bw = function() {
  55531. y(i, hn);
  55532. var n = w(i);
  55533. function i(e) {
  55534. var a;
  55535. O(this, i),
  55536. (a = n.call(this)).viewer = e,
  55537. a.renderer = e.renderer,
  55538. a.scene = null,
  55539. a.sceneControls = new gs,
  55540. a.rotationSpeed = 3,
  55541. a.fadeFactor = 100,
  55542. a.yawDelta = 0,
  55543. a.pitchDelta = 0,
  55544. a.panDelta = new yn(0,0),
  55545. a.radiusDelta = 0,
  55546. a.doubleClockZoomEnabled = !0,
  55547. a.tweens = [],
  55548. a.dollyStart = new yn,
  55549. a.dollyEnd = new yn;
  55550. function t(e) {
  55551. var t, n;
  55552. !a.enabled || (t = e.dragViewport) && "OrthographicCamera" != t.camera.type && null === e.drag.object && (n = e.isTouch ? 1 == e.touches.length ? "rotate" : "scale-pan" : e.buttons === rm.LEFT ? "rotate" : "pan",
  55553. void 0 === e.drag.startHandled && (e.drag.startHandled = !0,
  55554. a.dispatchEvent({
  55555. type: "start"
  55556. })),
  55557. (t = e.drag.pointerDelta.clone()).y *= -1,
  55558. "rotate" == n ? (a.yawDelta += t.x * a.rotationSpeed,
  55559. a.pitchDelta += t.y * a.rotationSpeed) : "pan" == n ? (a.panDelta.x += t.x,
  55560. a.panDelta.y += t.y) : "scale-pan" == n && (a.dollyEnd.subVectors(e.touches[0].pointer, e.touches[1].pointer),
  55561. n = a.dollyEnd.length() / a.dollyStart.length(),
  55562. a.dollyStart.copy(a.dollyEnd),
  55563. a.radiusDelta = (1 - n) * a.scene.view.radius,
  55564. n = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5),
  55565. (e = (new yn).subVectors(n, a.lastScalePointer)).y *= -1,
  55566. a.panDelta.add(e),
  55567. a.lastScalePointer = n.clone()),
  55568. a.stopTweens())
  55569. }
  55570. var o = null;
  55571. a.addEventListener("touchstart", function(e) {
  55572. o = e
  55573. }),
  55574. a.addEventListener("touchend", function(e) {
  55575. o = e
  55576. }),
  55577. a.addEventListener("touchmove", function(e) {
  55578. var t, n, i, r;
  55579. a.enabled && (2 === e.touches.length && 2 === o.touches.length ? (i = e,
  55580. t = (r = o).touches[0].pageX - r.touches[1].pageX,
  55581. n = r.touches[0].pageY - r.touches[1].pageY,
  55582. r = Math.sqrt(t * t + n * n),
  55583. t = i.touches[0].pageX - i.touches[1].pageX,
  55584. n = i.touches[0].pageY - i.touches[1].pageY,
  55585. i = Math.sqrt(t * t + n * n),
  55586. t = a.scene.view.radius + a.radiusDelta,
  55587. a.radiusDelta = t / (i / r) - t,
  55588. a.stopTweens()) : 3 === e.touches.length && 3 === o.touches.length && (i = ((n = o).touches[0].pageX + n.touches[1].pageX + n.touches[2].pageX) / 3,
  55589. r = (n.touches[0].pageY + n.touches[1].pageY + n.touches[2].pageY) / 3,
  55590. t = (e.touches[0].pageX + e.touches[1].pageX + e.touches[2].pageX) / 3,
  55591. n = (e.touches[0].pageY + e.touches[1].pageY + e.touches[2].pageY) / 3,
  55592. i = (t - i) / a.renderer.domElement.clientWidth,
  55593. r = (n - r) / a.renderer.domElement.clientHeight,
  55594. a.panDelta.x += i,
  55595. a.panDelta.y += r,
  55596. a.stopTweens()),
  55597. o = e)
  55598. }),
  55599. a.viewer.addEventListener("global_drag", t),
  55600. a.viewer.addEventListener("global_drop", function(e) {
  55601. a.enabled && a.dispatchEvent({
  55602. type: "end"
  55603. })
  55604. }),
  55605. a.viewer.addEventListener("global_mousewheel", function(e) {
  55606. var t;
  55607. a.enabled && ((t = a.scene.view.radius + a.radiusDelta) < .1 && 0 < e.delta || (a.radiusDelta += -e.delta * t * .1,
  55608. a.stopTweens()))
  55609. }),
  55610. a.viewer.addEventListener("global_dblclick", function(e) {
  55611. a.enabled && a.doubleClockZoomEnabled && a.zoomToLocation(e.mouse)
  55612. }),
  55613. a.viewer.addEventListener("global_touchmove", function(e) {
  55614. 1 < e.touches.length && t(e)
  55615. });
  55616. return a.viewer.addEventListener("global_touchstart", function(e) {
  55617. a.enabled && 2 == e.touches.length && (e = e,
  55618. a.dollyStart.subVectors(e.touches[0].pointer, e.touches[1].pointer),
  55619. a.lastScalePointer = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5))
  55620. }),
  55621. a
  55622. }
  55623. return h(i, [{
  55624. key: "setScene",
  55625. value: function(e) {
  55626. this.scene = e
  55627. }
  55628. }, {
  55629. key: "setEnable",
  55630. value: function(e) {
  55631. this.enabled = e
  55632. }
  55633. }, {
  55634. key: "stop",
  55635. value: function() {
  55636. this.yawDelta = 0,
  55637. this.pitchDelta = 0,
  55638. this.radiusDelta = 0,
  55639. this.panDelta.set(0, 0)
  55640. }
  55641. }, {
  55642. key: "zoomToLocation",
  55643. value: function(e) {
  55644. var t, n = (i = viewer.inputHandler.intersect).object || i.pointcloud, i = i && i.location;
  55645. i && n && (t = this.scene.view.position.distanceTo(i),
  55646. n = n.boundingBox.clone().applyMatrix4(n.matrixWorld).getSize(new Cn).length(),
  55647. n = gn.clamp(t, .1, Math.max(.1 * n, 3)),
  55648. kw = n,
  55649. viewer.focusOnObject({
  55650. position: i
  55651. }, "point", null, {
  55652. distance: n
  55653. }))
  55654. }
  55655. }, {
  55656. key: "stopTweens",
  55657. value: function() {
  55658. this.tweens.forEach(function(e) {
  55659. return e.stop()
  55660. }),
  55661. this.tweens = []
  55662. }
  55663. }, {
  55664. key: "update",
  55665. value: function(e) {
  55666. var t, n, i, r;
  55667. this.enabled && (r = this.scene.view,
  55668. t = Math.min(1, this.fadeFactor * e),
  55669. n = r.yaw,
  55670. i = r.pitch,
  55671. e = r.getPivot(),
  55672. n -= t * this.yawDelta,
  55673. i -= t * this.pitchDelta,
  55674. r.yaw = n,
  55675. r.pitch = i,
  55676. i = this.scene.view.direction.multiplyScalar(-r.radius),
  55677. e = (new Cn).addVectors(e, i),
  55678. r.position.copy(e),
  55679. i = this.scene.getActiveCamera(),
  55680. e = 2 * r.radius * Math.tan(gn.degToRad(i.fov / 2)),
  55681. i = -this.panDelta.x * e,
  55682. e = this.panDelta.y * e,
  55683. r.pan(i, e),
  55684. i = r.radius + +this.radiusDelta,
  55685. e = r.direction.multiplyScalar(-i),
  55686. e = (new Cn).addVectors(r.getPivot(), e),
  55687. this.constantlyForward && i < kw && (i = kw),
  55688. r.radius = i,
  55689. r.position.copy(e),
  55690. r = r.radius,
  55691. this.viewer.setMoveSpeed(r),
  55692. this.stop())
  55693. }
  55694. }]),
  55695. i
  55696. }(), Lw = function() {
  55697. y(i, hn);
  55698. var n = w(i);
  55699. function i(e) {
  55700. var u;
  55701. O(this, i),
  55702. (u = n.call(this, e)).viewer = e,
  55703. u.renderer = e.renderer,
  55704. u.scene = null,
  55705. u.sceneControls = new gs,
  55706. u.rotationSpeed = 10,
  55707. u.fadeFactor = 20,
  55708. u.wheelDelta = 0,
  55709. u.zoomDelta = new Cn,
  55710. u.camStart = null,
  55711. u.tweens = [];
  55712. var t = new Su(1,16,16)
  55713. , e = new Xu;
  55714. u.pivotIndicator = new Hr(t,e),
  55715. u.pivotIndicator.visible = !1,
  55716. u.sceneControls.add(u.pivotIndicator);
  55717. return u.addEventListener("drag", function(e) {
  55718. var t, n, i, r, a, o, s, l;
  55719. null === e.drag.object && u.pivot && (void 0 === e.drag.startHandled && (e.drag.startHandled = !0,
  55720. u.dispatchEvent({
  55721. type: "start"
  55722. })),
  55723. t = u.camStart,
  55724. i = u.scene.getActiveCamera(),
  55725. n = u.viewer.scene.view,
  55726. o = e.drag.end,
  55727. r = u.viewer.renderer.domElement,
  55728. e.drag.Buttons === o.LEFT ? (i = Jf.ButtonsToRay(u.viewer.inputHandler.pointer, i, r.clientWidth, r.clientHeight),
  55729. r = (new ki).setFromNormalAndCoplanarPoint(new Cn(0,0,1), u.pivot),
  55730. 0 < (r = i.distanceToPlane(r)) && (l = (new Cn).addVectors(t.position, i.direction.clone().multiplyScalar(r)),
  55731. a = (new Cn).subVectors(l, u.pivot),
  55732. s = t.position.clone().sub(a),
  55733. n.position.copy(s),
  55734. l = s.distanceTo(u.pivot),
  55735. n.radius = l,
  55736. a = n.radius / 2.5,
  55737. u.viewer.setMoveSpeed(a))) : e.drag.Buttons === o.RIGHT && (s = e.drag.ButtonsDelta.x / u.renderer.domElement.clientWidth,
  55738. l = e.drag.ButtonsDelta.y / u.renderer.domElement.clientHeight,
  55739. a = -s * u.rotationSpeed * .5,
  55740. o = -l * u.rotationSpeed * .2,
  55741. e = n.pitch,
  55742. (s = n.clone()).pitch = s.pitch + o,
  55743. o = s.pitch - e,
  55744. l = (new Cn).subVectors(n.position, u.pivot),
  55745. s = (new Cn).subVectors(n.getPivot(), u.pivot),
  55746. e = n.getSide(),
  55747. l.applyAxisAngle(e, o),
  55748. s.applyAxisAngle(e, o),
  55749. l.applyAxisAngle(new Cn(0,0,1), a),
  55750. s.applyAxisAngle(new Cn(0,0,1), a),
  55751. l = (new Cn).addVectors(u.pivot, l),
  55752. n.position.copy(l),
  55753. n.yaw += a,
  55754. n.pitch += o))
  55755. }),
  55756. u.addEventListener("drop", function(e) {
  55757. u.dispatchEvent({
  55758. type: "end"
  55759. })
  55760. }),
  55761. u.addEventListener("Buttonswheel", function(e) {
  55762. u.wheelDelta += e.delta
  55763. }),
  55764. u.addEventListener("Buttonsdown", function(e) {
  55765. e = Jf.getButtonsPointCloudIntersection(e.Buttons, u.scene.getActiveCamera(), u.viewer, u.scene.pointclouds, {
  55766. pickClipped: !1
  55767. });
  55768. e && (u.pivot = e.location,
  55769. u.camStart = u.scene.getActiveCamera().clone(),
  55770. u.pivotIndicator.visible = !0,
  55771. u.pivotIndicator.position.copy(e.location))
  55772. }),
  55773. u.addEventListener("Buttonsup", function(e) {
  55774. u.camStart = null,
  55775. u.pivot = null,
  55776. u.pivotIndicator.visible = !1
  55777. }),
  55778. u.addEventListener("dblclick", function(e) {
  55779. u.zoomToLocation(e.Buttons)
  55780. }),
  55781. u
  55782. }
  55783. return h(i, [{
  55784. key: "setScene",
  55785. value: function(e) {
  55786. this.scene = e
  55787. }
  55788. }, {
  55789. key: "stop",
  55790. value: function() {
  55791. this.wheelDelta = 0,
  55792. this.zoomDelta.set(0, 0, 0)
  55793. }
  55794. }, {
  55795. key: "zoomToLocation",
  55796. value: function(e) {
  55797. var t, n, i, r, a, o, s, l = this, u = this.scene.getActiveCamera(), c = Jf.getButtonsPointCloudIntersection(e, u, this.viewer, this.scene.pointclouds);
  55798. null !== c && (t = 0,
  55799. e = this.renderer.domElement,
  55800. e = Jf.ButtonsToRay(this.viewer.inputHandler.pointer, u, e.clientWidth, e.clientHeight),
  55801. e = (e = c.pointcloud.nodesOnRay(c.pointcloud.visibleNodes, e))[e.length - 1].getBoundingSphere(new qn).radius,
  55802. t = Math.min(this.scene.view.radius, e),
  55803. t = Math.max(.2, t),
  55804. e = this.scene.view.direction.multiplyScalar(-1),
  55805. e = (new Cn).addVectors(c.location, e.multiplyScalar(t)),
  55806. t = TWEEN.Easing.Quartic.Out,
  55807. n = {
  55808. x: 0
  55809. },
  55810. (i = new TWEEN.Tween(n).to({
  55811. x: 1
  55812. }, 600)).easing(t),
  55813. this.tweens.push(i),
  55814. r = this.scene.view.position.clone(),
  55815. a = e.clone(),
  55816. o = this.scene.view.radius,
  55817. s = e.distanceTo(c.location),
  55818. i.onUpdate(function() {
  55819. var e = n.x;
  55820. l.scene.view.position.x = (1 - e) * r.x + e * a.x,
  55821. l.scene.view.position.y = (1 - e) * r.y + e * a.y,
  55822. l.scene.view.position.z = (1 - e) * r.z + e * a.z,
  55823. l.scene.view.radius = (1 - e) * o + e * s,
  55824. l.viewer.setMoveSpeed(l.scene.view.radius / 2.5)
  55825. }),
  55826. i.onComplete(function() {
  55827. l.tweens = l.tweens.filter(function(e) {
  55828. return e !== i
  55829. })
  55830. }),
  55831. i.start())
  55832. }
  55833. }, {
  55834. key: "update",
  55835. value: function(e) {
  55836. var t, n, i, r, a, o = this.scene.view, s = Math.pow(.5, this.fadeFactor * e), l = 1 - s, u = this.scene.getActiveCamera();
  55837. 0 === this.wheelDelta || (i = Jf.getButtonsPointCloudIntersection(this.viewer.inputHandler.Buttons, this.scene.getActiveCamera(), this.viewer, this.scene.pointclouds)) && (t = (new Cn).addVectors(o.position, this.zoomDelta),
  55838. n = .2 * i.location.distanceTo(t) * this.wheelDelta,
  55839. (e = (new Cn).subVectors(i.location, o.position)).normalize(),
  55840. t.add(e.multiplyScalar(n)),
  55841. this.zoomDelta.subVectors(t, o.position),
  55842. i = t.distanceTo(i.location),
  55843. o.radius = i,
  55844. i = o.radius / 2.5,
  55845. this.viewer.setMoveSpeed(i)),
  55846. 0 !== this.zoomDelta.length() && (r = this.zoomDelta.clone().multiplyScalar(l),
  55847. a = (new Cn).addVectors(o.position, r),
  55848. o.position.copy(a)),
  55849. this.pivotIndicator.visible && (r = this.pivotIndicator.position.distanceTo(o.position),
  55850. a = this.renderer.domElement.clientwidth,
  55851. o = this.renderer.domElement.clientHeight,
  55852. o = 10 / Jf.projectedRadius(1, u, r, a, o),
  55853. this.pivotIndicator.scale.set(o, o, o)),
  55854. this.zoomDelta.multiplyScalar(s),
  55855. this.wheelDelta = 0
  55856. }
  55857. }]),
  55858. i
  55859. }(), Rw = function() {
  55860. y(r, hn);
  55861. var i = w(r);
  55862. function r(e) {
  55863. var t;
  55864. O(this, r),
  55865. (t = i.call(this)).viewer = e,
  55866. t.renderer = e.renderer,
  55867. t.scene = null,
  55868. t.sceneControls = new gs,
  55869. t.screenOrientation = window.orientation || 0;
  55870. function n(e) {
  55871. t.deviceOrientation = e
  55872. }
  55873. return "ondeviceorientationabsolute"in window ? window.addEventListener("deviceorientationabsolute", n) : "ondeviceorientation"in window ? window.addEventListener("deviceorientation", n) : console.warn("No device orientation found."),
  55874. window.addEventListener("orientationchange", function(e) {
  55875. t.screenOrientation = window.orientation || 0
  55876. }),
  55877. t
  55878. }
  55879. return h(r, [{
  55880. key: "setScene",
  55881. value: function(e) {
  55882. this.scene = e
  55883. }
  55884. }, {
  55885. key: "update",
  55886. value: function(e) {
  55887. var t, n, i, r, a, o, s, l;
  55888. void 0 !== this.deviceOrientation && (a = this.deviceOrientation.alpha ? gn.degToRad(this.deviceOrientation.alpha) : 0,
  55889. o = this.deviceOrientation.beta ? gn.degToRad(this.deviceOrientation.beta) : 0,
  55890. s = this.deviceOrientation.gamma ? gn.degToRad(this.deviceOrientation.gamma) : 0,
  55891. l = this.screenOrientation ? gn.degToRad(this.screenOrientation) : 0,
  55892. t = a,
  55893. n = o,
  55894. i = s,
  55895. r = l,
  55896. a = new Sn,
  55897. o = new Cn(0,0,1),
  55898. s = new ci,
  55899. l = new Sn,
  55900. s.set(n, i, t, "ZXY"),
  55901. a.setFromEuler(s),
  55902. a.multiply(l.setFromAxisAngle(o, -r)),
  55903. viewer.scene.cameraP.quaternion.set(a.x, a.y, a.z, a.w))
  55904. }
  55905. }]),
  55906. r
  55907. }(), Fw = new WeakMap, Iw = function() {
  55908. y(n, mc);
  55909. var t = w(n);
  55910. function n(e) {
  55911. return O(this, n),
  55912. (e = t.call(this, e)).decoderPath = "",
  55913. e.decoderConfig = {},
  55914. e.decoderBinary = null,
  55915. e.decoderPending = null,
  55916. e.workerLimit = 4,
  55917. e.workerPool = [],
  55918. e.workerNextTaskID = 1,
  55919. e.workerSourceURL = "",
  55920. e.defaultAttributeIDs = {
  55921. position: "POSITION",
  55922. normal: "NORMAL",
  55923. color: "COLOR",
  55924. uv: "TEX_COORD"
  55925. },
  55926. e.defaultAttributeTypes = {
  55927. position: "Float32Array",
  55928. normal: "Float32Array",
  55929. color: "Float32Array",
  55930. uv: "Float32Array"
  55931. },
  55932. e
  55933. }
  55934. return h(n, [{
  55935. key: "setDecoderPath",
  55936. value: function(e) {
  55937. return this.decoderPath = e,
  55938. this
  55939. }
  55940. }, {
  55941. key: "setDecoderConfig",
  55942. value: function(e) {
  55943. return this.decoderConfig = e,
  55944. this
  55945. }
  55946. }, {
  55947. key: "setWorkerLimit",
  55948. value: function(e) {
  55949. return this.workerLimit = e,
  55950. this
  55951. }
  55952. }, {
  55953. key: "load",
  55954. value: function(e, n, t, i) {
  55955. var r = this
  55956. , a = new gc(this.manager);
  55957. a.setPath(this.path),
  55958. a.setResponseType("arraybuffer"),
  55959. a.setRequestHeader(this.requestHeader),
  55960. a.setWithCredentials(this.withCredentials),
  55961. a.load(e, function(e) {
  55962. var t = {
  55963. attributeIDs: r.defaultAttributeIDs,
  55964. attributeTypes: r.defaultAttributeTypes,
  55965. useUniqueIDs: !1
  55966. };
  55967. r.decodeGeometry(e, t).then(n).catch(i)
  55968. }, t, i)
  55969. }
  55970. }, {
  55971. key: "decodeDracoFile",
  55972. value: function(e, t, n, i) {
  55973. n = {
  55974. attributeIDs: n || this.defaultAttributeIDs,
  55975. attributeTypes: i || this.defaultAttributeTypes,
  55976. useUniqueIDs: !!n
  55977. };
  55978. this.decodeGeometry(e, n).then(t)
  55979. }
  55980. }, {
  55981. key: "decodeGeometry",
  55982. value: function(n, i) {
  55983. var e, t = this;
  55984. for (e in i.attributeTypes) {
  55985. var r = i.attributeTypes[e];
  55986. void 0 !== r.BYTES_PER_ELEMENT && (i.attributeTypes[e] = r.name)
  55987. }
  55988. var a, o = JSON.stringify(i);
  55989. if (Fw.has(n)) {
  55990. var s = Fw.get(n);
  55991. if (s.key === o)
  55992. return s.promise;
  55993. if (0 === n.byteLength)
  55994. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")
  55995. }
  55996. var l = this.workerNextTaskID++
  55997. , s = n.byteLength
  55998. , s = this._getWorker(l, s).then(function(e) {
  55999. return a = e,
  56000. new Promise(function(e, t) {
  56001. a._callbacks[l] = {
  56002. resolve: e,
  56003. reject: t
  56004. },
  56005. a.postMessage({
  56006. type: "decode",
  56007. id: l,
  56008. taskConfig: i,
  56009. buffer: n
  56010. }, [n])
  56011. }
  56012. )
  56013. }).then(function(e) {
  56014. return t._createGeometry(e.geometry)
  56015. });
  56016. return s.catch(function() {
  56017. return !0
  56018. }).then(function() {
  56019. a && l && t._releaseTask(a, l)
  56020. }),
  56021. Fw.set(n, {
  56022. key: o,
  56023. promise: s
  56024. }),
  56025. s
  56026. }
  56027. }, {
  56028. key: "_createGeometry",
  56029. value: function(e) {
  56030. var t = new Mr;
  56031. e.index && t.setIndex(new nr(e.index.array,1));
  56032. for (var n = 0; n < e.attributes.length; n++) {
  56033. var i = e.attributes[n]
  56034. , r = i.name
  56035. , a = i.array
  56036. , i = i.itemSize;
  56037. t.setAttribute(r, new nr(a,i))
  56038. }
  56039. return t
  56040. }
  56041. }, {
  56042. key: "_loadLibrary",
  56043. value: function(n, e) {
  56044. var i = new gc(this.manager);
  56045. return i.setPath(this.decoderPath),
  56046. i.setResponseType(e),
  56047. i.setWithCredentials(this.withCredentials),
  56048. new Promise(function(e, t) {
  56049. i.load(n, e, void 0, t)
  56050. }
  56051. )
  56052. }
  56053. }, {
  56054. key: "preload",
  56055. value: function() {
  56056. return this._initDecoder(),
  56057. this
  56058. }
  56059. }, {
  56060. key: "_initDecoder",
  56061. value: function() {
  56062. var n = this;
  56063. if (this.decoderPending)
  56064. return this.decoderPending;
  56065. var i = "object" !== ("undefined" == typeof WebAssembly ? "undefined" : X(WebAssembly)) || "js" === this.decoderConfig.type
  56066. , e = [];
  56067. return i ? e.push(this._loadLibrary("draco_decoder.js", "text")) : (e.push(this._loadLibrary("draco_wasm_wrapper.js", "text")),
  56068. e.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))),
  56069. this.decoderPending = Promise.all(e).then(function(e) {
  56070. var t = e[0];
  56071. i || (n.decoderConfig.wasmBinary = e[1]);
  56072. e = function() {
  56073. var n, t;
  56074. function l(e, t, n, i) {
  56075. var r, a, o = i.attributeIDs, s = i.attributeTypes, l = t.GetEncodedGeometryType(n);
  56076. if (l === e.TRIANGULAR_MESH)
  56077. r = new e.Mesh,
  56078. a = t.DecodeBufferToMesh(n, r);
  56079. else {
  56080. if (l !== e.POINT_CLOUD)
  56081. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  56082. r = new e.PointCloud,
  56083. a = t.DecodeBufferToPointCloud(n, r)
  56084. }
  56085. if (!a.ok() || 0 === r.ptr)
  56086. throw new Error("THREE.DRACOLoader: Decoding failed: " + a.error_msg());
  56087. var u, c = {
  56088. index: null,
  56089. attributes: []
  56090. };
  56091. for (u in o) {
  56092. var d = self[s[u]]
  56093. , h = void 0
  56094. , p = void 0;
  56095. if (i.useUniqueIDs)
  56096. p = o[u],
  56097. h = t.GetAttributeByUniqueId(r, p);
  56098. else {
  56099. if (-1 === (p = t.GetAttributeId(r, e[o[u]])))
  56100. continue;
  56101. h = t.GetAttribute(r, p)
  56102. }
  56103. c.attributes.push(function(e, t, n, i, r, a) {
  56104. var o = a.num_components()
  56105. , s = n.num_points() * o
  56106. , l = s * r.BYTES_PER_ELEMENT
  56107. , u = function(e, t) {
  56108. switch (t) {
  56109. case Float32Array:
  56110. return e.DT_FLOAT32;
  56111. case Int8Array:
  56112. return e.DT_INT8;
  56113. case Int16Array:
  56114. return e.DT_INT16;
  56115. case Int32Array:
  56116. return e.DT_INT32;
  56117. case Uint8Array:
  56118. return e.DT_UINT8;
  56119. case Uint16Array:
  56120. return e.DT_UINT16;
  56121. case Uint32Array:
  56122. return e.DT_UINT32
  56123. }
  56124. }(e, r)
  56125. , c = e._malloc(l);
  56126. t.GetAttributeDataArrayForAllPoints(n, a, u, l, c);
  56127. s = new r(e.HEAPF32.buffer,c,s).slice();
  56128. return e._free(c),
  56129. {
  56130. name: i,
  56131. array: s,
  56132. itemSize: o
  56133. }
  56134. }(e, t, r, u, d, h))
  56135. }
  56136. return l === e.TRIANGULAR_MESH && (c.index = function(e, t, n) {
  56137. var i = 3 * n.num_faces()
  56138. , r = 4 * i
  56139. , a = e._malloc(r);
  56140. t.GetTrianglesUInt32Array(n, r, a);
  56141. i = new Uint32Array(e.HEAPF32.buffer,a,i).slice();
  56142. return e._free(a),
  56143. {
  56144. array: i,
  56145. itemSize: 1
  56146. }
  56147. }(e, t, r)),
  56148. e.destroy(r),
  56149. c
  56150. }
  56151. onmessage = function(e) {
  56152. var a = e.data;
  56153. switch (a.type) {
  56154. case "init":
  56155. n = a.decoderConfig,
  56156. t = new Promise(function(t) {
  56157. n.onModuleLoaded = function(e) {
  56158. t({
  56159. draco: e
  56160. })
  56161. }
  56162. ,
  56163. DracoDecoderModule(n)
  56164. }
  56165. );
  56166. break;
  56167. case "decode":
  56168. var o = a.buffer
  56169. , s = a.taskConfig;
  56170. t.then(function(e) {
  56171. var t = e.draco
  56172. , n = new t.Decoder
  56173. , e = new t.DecoderBuffer;
  56174. e.Init(new Int8Array(o), o.byteLength);
  56175. try {
  56176. var i = l(t, n, e, s)
  56177. , r = i.attributes.map(function(e) {
  56178. return e.array.buffer
  56179. });
  56180. i.index && r.push(i.index.array.buffer),
  56181. self.postMessage({
  56182. type: "decode",
  56183. id: a.id,
  56184. geometry: i
  56185. }, r)
  56186. } catch (e) {
  56187. console.error(e),
  56188. self.postMessage({
  56189. type: "error",
  56190. id: a.id,
  56191. error: e.message
  56192. })
  56193. } finally {
  56194. t.destroy(e),
  56195. t.destroy(n)
  56196. }
  56197. })
  56198. }
  56199. }
  56200. }
  56201. .toString(),
  56202. e = ["/* draco decoder */", t, "", "/* worker */", e.substring(e.indexOf("{") + 1, e.lastIndexOf("}"))].join("\n");
  56203. n.workerSourceURL = URL.createObjectURL(new Blob([e]))
  56204. }),
  56205. this.decoderPending
  56206. }
  56207. }, {
  56208. key: "_getWorker",
  56209. value: function(t, i) {
  56210. var r = this;
  56211. return this._initDecoder().then(function() {
  56212. var n;
  56213. r.workerPool.length < r.workerLimit ? ((n = new Worker(r.workerSourceURL))._callbacks = {},
  56214. n._taskCosts = {},
  56215. n._taskLoad = 0,
  56216. n.postMessage({
  56217. type: "init",
  56218. decoderConfig: r.decoderConfig
  56219. }),
  56220. n.onmessage = function(e) {
  56221. var t = e.data;
  56222. switch (t.type) {
  56223. case "decode":
  56224. n._callbacks[t.id].resolve(t);
  56225. break;
  56226. case "error":
  56227. n._callbacks[t.id].reject(t);
  56228. break;
  56229. default:
  56230. console.error('THREE.DRACOLoader: Unexpected message, "' + t.type + '"')
  56231. }
  56232. }
  56233. ,
  56234. r.workerPool.push(n)) : r.workerPool.sort(function(e, t) {
  56235. return e._taskLoad > t._taskLoad ? -1 : 1
  56236. });
  56237. var e = r.workerPool[r.workerPool.length - 1];
  56238. return e._taskCosts[t] = i,
  56239. e._taskLoad += i,
  56240. e
  56241. })
  56242. }
  56243. }, {
  56244. key: "_releaseTask",
  56245. value: function(e, t) {
  56246. e._taskLoad -= e._taskCosts[t],
  56247. delete e._callbacks[t],
  56248. delete e._taskCosts[t]
  56249. }
  56250. }, {
  56251. key: "debug",
  56252. value: function() {
  56253. console.log("Task load: ", this.workerPool.map(function(e) {
  56254. return e._taskLoad
  56255. }))
  56256. }
  56257. }, {
  56258. key: "dispose",
  56259. value: function() {
  56260. for (var e = 0; e < this.workerPool.length; ++e)
  56261. this.workerPool[e].terminate();
  56262. return this.workerPool.length = 0,
  56263. this
  56264. }
  56265. }]),
  56266. n
  56267. }();
  56268. var Ow = function() {
  56269. function t() {
  56270. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 4;
  56271. O(this, t),
  56272. this.pool = e,
  56273. this.queue = [],
  56274. this.workers = [],
  56275. this.workersResolve = [],
  56276. this.workerStatus = 0
  56277. }
  56278. return h(t, [{
  56279. key: "_initWorker",
  56280. value: function(e) {
  56281. var t;
  56282. this.workers[e] || ((t = this.workerCreator()).addEventListener("message", this._onMessage.bind(this, e)),
  56283. this.workers[e] = t)
  56284. }
  56285. }, {
  56286. key: "_getIdleWorker",
  56287. value: function() {
  56288. for (var e = 0; e < this.pool; e++)
  56289. if (!(this.workerStatus & 1 << e))
  56290. return e;
  56291. return -1
  56292. }
  56293. }, {
  56294. key: "_onMessage",
  56295. value: function(e, t) {
  56296. var n, i = this.workersResolve[e];
  56297. i && i(t),
  56298. this.queue.length ? (i = (n = this.queue.shift()).resolve,
  56299. t = n.msg,
  56300. n = n.transfer,
  56301. this.workersResolve[e] = i,
  56302. this.workers[e].postMessage(t, n)) : this.workerStatus ^= 1 << e
  56303. }
  56304. }, {
  56305. key: "setWorkerCreator",
  56306. value: function(e) {
  56307. this.workerCreator = e
  56308. }
  56309. }, {
  56310. key: "setWorkerLimit",
  56311. value: function(e) {
  56312. this.pool = e
  56313. }
  56314. }, {
  56315. key: "postMessage",
  56316. value: function(n, i) {
  56317. var r = this;
  56318. return new Promise(function(e) {
  56319. var t = r._getIdleWorker();
  56320. -1 !== t ? (r._initWorker(t),
  56321. r.workerStatus |= 1 << t,
  56322. r.workersResolve[t] = e,
  56323. r.workers[t].postMessage(n, i)) : r.queue.push({
  56324. resolve: e,
  56325. msg: n,
  56326. transfer: i
  56327. })
  56328. }
  56329. )
  56330. }
  56331. }, {
  56332. key: "dispose",
  56333. value: function() {
  56334. this.workers.forEach(function(e) {
  56335. return e.terminate()
  56336. }),
  56337. this.workersResolve.length = 0,
  56338. this.workers.length = 0,
  56339. this.queue.length = 0,
  56340. this.workerStatus = 0
  56341. }
  56342. }]),
  56343. t
  56344. }()
  56345. , zw = h(function e() {
  56346. O(this, e),
  56347. this.vkFormat = 0,
  56348. this.typeSize = 1,
  56349. this.pixelWidth = 0,
  56350. this.pixelHeight = 0,
  56351. this.pixelDepth = 0,
  56352. this.layerCount = 0,
  56353. this.faceCount = 1,
  56354. this.supercompressionScheme = 0,
  56355. this.levels = [],
  56356. this.dataFormatDescriptor = [{
  56357. vendorId: 0,
  56358. descriptorType: 0,
  56359. descriptorBlockSize: 0,
  56360. versionNumber: 2,
  56361. colorModel: 0,
  56362. colorPrimaries: 1,
  56363. transferFunction: 2,
  56364. flags: 0,
  56365. texelBlockDimension: [0, 0, 0, 0],
  56366. bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],
  56367. samples: []
  56368. }],
  56369. this.keyValue = {},
  56370. this.globalData = null
  56371. })
  56372. , Nw = function() {
  56373. function r(e, t, n, i) {
  56374. O(this, r),
  56375. this._dataView = new DataView(e.buffer,e.byteOffset + t,n),
  56376. this._littleEndian = i,
  56377. this._offset = 0
  56378. }
  56379. return h(r, [{
  56380. key: "_nextUint8",
  56381. value: function() {
  56382. var e = this._dataView.getUint8(this._offset);
  56383. return this._offset += 1,
  56384. e
  56385. }
  56386. }, {
  56387. key: "_nextUint16",
  56388. value: function() {
  56389. var e = this._dataView.getUint16(this._offset, this._littleEndian);
  56390. return this._offset += 2,
  56391. e
  56392. }
  56393. }, {
  56394. key: "_nextUint32",
  56395. value: function() {
  56396. var e = this._dataView.getUint32(this._offset, this._littleEndian);
  56397. return this._offset += 4,
  56398. e
  56399. }
  56400. }, {
  56401. key: "_nextUint64",
  56402. value: function() {
  56403. var e = this._dataView.getUint32(this._offset, this._littleEndian) + Math.pow(2, 32) * this._dataView.getUint32(this._offset + 4, this._littleEndian);
  56404. return this._offset += 8,
  56405. e
  56406. }
  56407. }, {
  56408. key: "_nextInt32",
  56409. value: function() {
  56410. var e = this._dataView.getInt32(this._offset, this._littleEndian);
  56411. return this._offset += 4,
  56412. e
  56413. }
  56414. }, {
  56415. key: "_skip",
  56416. value: function(e) {
  56417. return this._offset += e,
  56418. this
  56419. }
  56420. }, {
  56421. key: "_scan",
  56422. value: function(e) {
  56423. for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this._offset, i = 0; this._dataView.getUint8(this._offset) !== t && i < e; )
  56424. i++,
  56425. this._offset++;
  56426. return i < e && this._offset++,
  56427. new Uint8Array(this._dataView.buffer,this._dataView.byteOffset + n,i)
  56428. }
  56429. }]),
  56430. r
  56431. }()
  56432. , Uw = (new Uint8Array([0]),
  56433. [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10]);
  56434. function Gw(e) {
  56435. return "undefined" != typeof TextDecoder ? (new TextDecoder).decode(e) : Buffer.from(e).toString("utf8")
  56436. }
  56437. var Hw = function(e) {
  56438. if ((A = new Uint8Array(e.buffer,e.byteOffset,Uw.length))[0] !== Uw[0] || A[1] !== Uw[1] || A[2] !== Uw[2] || A[3] !== Uw[3] || A[4] !== Uw[4] || A[5] !== Uw[5] || A[6] !== Uw[6] || A[7] !== Uw[7] || A[8] !== Uw[8] || A[9] !== Uw[9] || A[10] !== Uw[10] || A[11] !== Uw[11])
  56439. throw new Error("Missing KTX 2.0 identifier.");
  56440. var t = new zw
  56441. , n = 17 * Uint32Array.BYTES_PER_ELEMENT
  56442. , i = new Nw(e,Uw.length,n,!0);
  56443. t.vkFormat = i._nextUint32(),
  56444. t.typeSize = i._nextUint32(),
  56445. t.pixelWidth = i._nextUint32(),
  56446. t.pixelHeight = i._nextUint32(),
  56447. t.pixelDepth = i._nextUint32(),
  56448. t.layerCount = i._nextUint32(),
  56449. t.faceCount = i._nextUint32();
  56450. var r = i._nextUint32();
  56451. t.supercompressionScheme = i._nextUint32();
  56452. for (var a = i._nextUint32(), o = i._nextUint32(), s = i._nextUint32(), l = i._nextUint32(), u = i._nextUint64(), c = i._nextUint64(), d = new Nw(e,Uw.length + n,3 * r * 8,!0), h = 0; h < r; h++)
  56453. t.levels.push({
  56454. levelData: new Uint8Array(e.buffer,e.byteOffset + d._nextUint64(),d._nextUint64()),
  56455. uncompressedByteLength: d._nextUint64()
  56456. });
  56457. for (var p = new Nw(e,a,o,!0), f = {
  56458. vendorId: p._skip(4)._nextUint16(),
  56459. descriptorType: p._nextUint16(),
  56460. versionNumber: p._nextUint16(),
  56461. descriptorBlockSize: p._nextUint16(),
  56462. colorModel: p._nextUint8(),
  56463. colorPrimaries: p._nextUint8(),
  56464. transferFunction: p._nextUint8(),
  56465. flags: p._nextUint8(),
  56466. texelBlockDimension: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()],
  56467. bytesPlane: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()],
  56468. samples: []
  56469. }, m = (f.descriptorBlockSize / 4 - 6) / 4, v = 0; v < m; v++) {
  56470. var g = {
  56471. bitOffset: p._nextUint16(),
  56472. bitLength: p._nextUint8(),
  56473. channelType: p._nextUint8(),
  56474. samplePosition: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()],
  56475. sampleLower: -1 / 0,
  56476. sampleUpper: 1 / 0
  56477. };
  56478. 64 & g.channelType ? (g.sampleLower = p._nextInt32(),
  56479. g.sampleUpper = p._nextInt32()) : (g.sampleLower = p._nextUint32(),
  56480. g.sampleUpper = p._nextUint32()),
  56481. f.samples[v] = g
  56482. }
  56483. t.dataFormatDescriptor.length = 0,
  56484. t.dataFormatDescriptor.push(f);
  56485. for (var y = new Nw(e,s,l,!0); y._offset < l; ) {
  56486. var w = y._nextUint32()
  56487. , b = y._scan(w)
  56488. , x = Gw(b)
  56489. , b = y._scan(w - b.byteLength);
  56490. t.keyValue[x] = x.match(/^ktx/i) ? Gw(b) : b,
  56491. y._offset % 4 && y._skip(4 - y._offset % 4)
  56492. }
  56493. if (c <= 0)
  56494. return t;
  56495. for (var E = new Nw(e,u,c,!0), _ = E._nextUint16(), M = E._nextUint16(), A = E._nextUint32(), i = E._nextUint32(), n = E._nextUint32(), a = E._nextUint32(), T = [], S = 0; S < r; S++)
  56496. T.push({
  56497. imageFlags: E._nextUint32(),
  56498. rgbSliceByteOffset: E._nextUint32(),
  56499. rgbSliceByteLength: E._nextUint32(),
  56500. alphaSliceByteOffset: E._nextUint32(),
  56501. alphaSliceByteLength: E._nextUint32()
  56502. });
  56503. return o = u + E._offset,
  56504. u = (c = (s = o + A) + i) + n,
  56505. A = new Uint8Array(e.buffer,e.byteOffset + o,A),
  56506. i = new Uint8Array(e.buffer,e.byteOffset + s,i),
  56507. n = new Uint8Array(e.buffer,e.byteOffset + c,n),
  56508. a = new Uint8Array(e.buffer,e.byteOffset + u,a),
  56509. t.globalData = {
  56510. endpointCount: _,
  56511. selectorCount: M,
  56512. imageDescs: T,
  56513. endpointsData: A,
  56514. selectorsData: i,
  56515. tablesData: n,
  56516. extendedData: a
  56517. },
  56518. t
  56519. }
  56520. , Vw = new WeakMap
  56521. , jw = 0
  56522. , Ww = function() {
  56523. y(r, mc);
  56524. var t = w(r);
  56525. function r(e) {
  56526. return O(this, r),
  56527. (e = t.call(this, e)).transcoderPath = "",
  56528. e.transcoderBinary = null,
  56529. e.transcoderPending = null,
  56530. e.workerPool = new Ow,
  56531. e.workerSourceURL = "",
  56532. e.workerConfig = null,
  56533. "undefined" != typeof MSC_TRANSCODER && console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),
  56534. e
  56535. }
  56536. return h(r, [{
  56537. key: "setTranscoderPath",
  56538. value: function(e) {
  56539. return this.transcoderPath = e,
  56540. this
  56541. }
  56542. }, {
  56543. key: "setWorkerLimit",
  56544. value: function(e) {
  56545. return this.workerPool.setWorkerLimit(e),
  56546. this
  56547. }
  56548. }, {
  56549. key: "detectSupport",
  56550. value: function(e) {
  56551. return this.workerConfig = {
  56552. astcSupported: e.extensions.has("WEBGL_compressed_texture_astc"),
  56553. etc1Supported: e.extensions.has("WEBGL_compressed_texture_etc1"),
  56554. etc2Supported: e.extensions.has("WEBGL_compressed_texture_etc"),
  56555. dxtSupported: e.extensions.has("WEBGL_compressed_texture_s3tc"),
  56556. bptcSupported: e.extensions.has("EXT_texture_compression_bptc"),
  56557. pvrtcSupported: e.extensions.has("WEBGL_compressed_texture_pvrtc") || e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
  56558. },
  56559. e.capabilities.isWebGL2 && (this.workerConfig.etc1Supported = !1),
  56560. this
  56561. }
  56562. }, {
  56563. key: "init",
  56564. value: function() {
  56565. var e, t, i = this;
  56566. return this.transcoderPending || ((t = new gc(this.manager)).setPath(this.transcoderPath),
  56567. t.setWithCredentials(this.withCredentials),
  56568. e = t.loadAsync("basis_transcoder.js"),
  56569. (t = new gc(this.manager)).setPath(this.transcoderPath),
  56570. t.setResponseType("arraybuffer"),
  56571. t.setWithCredentials(this.withCredentials),
  56572. t = t.loadAsync("basis_transcoder.wasm"),
  56573. this.transcoderPending = Promise.all([e, t]).then(function(e) {
  56574. var t = N(e, 2)
  56575. , n = t[0]
  56576. , e = t[1]
  56577. , t = r.BasisWorker.toString()
  56578. , t = ["/* constants */", "let _EngineFormat = " + JSON.stringify(r.EngineFormat), "let _TranscoderFormat = " + JSON.stringify(r.TranscoderFormat), "let _BasisFormat = " + JSON.stringify(r.BasisFormat), "/* basis_transcoder.js */", n, "/* worker */", t.substring(t.indexOf("{") + 1, t.lastIndexOf("}"))].join("\n");
  56579. i.workerSourceURL = URL.createObjectURL(new Blob([t])),
  56580. i.transcoderBinary = e,
  56581. i.workerPool.setWorkerCreator(function() {
  56582. var e = new Worker(i.workerSourceURL)
  56583. , t = i.transcoderBinary.slice(0);
  56584. return e.postMessage({
  56585. type: "init",
  56586. config: i.workerConfig,
  56587. transcoderBinary: t
  56588. }, [t]),
  56589. e
  56590. })
  56591. }),
  56592. 0 < jw && console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),
  56593. jw++),
  56594. this.transcoderPending
  56595. }
  56596. }, {
  56597. key: "load",
  56598. value: function(e, t, n, i) {
  56599. var r = this;
  56600. if (null === this.workerConfig)
  56601. throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
  56602. var a = new gc(this.manager);
  56603. a.setResponseType("arraybuffer"),
  56604. a.setWithCredentials(this.withCredentials),
  56605. a.load(e, function(e) {
  56606. return Vw.has(e) ? Vw.get(e).promise.then(t).catch(i) : void r._createTexture(e).then(function(e) {
  56607. return t ? t(e) : null
  56608. }).catch(i)
  56609. }, n, i)
  56610. }
  56611. }, {
  56612. key: "_createTextureFrom",
  56613. value: function(e) {
  56614. var t = e.mipmaps
  56615. , n = e.width
  56616. , i = e.height
  56617. , r = e.format
  56618. , a = e.type
  56619. , o = e.error
  56620. , s = e.dfdTransferFn
  56621. , e = e.dfdFlags;
  56622. if ("error" === a)
  56623. return Promise.reject(o);
  56624. r = new bl(t,n,i,r,Ue);
  56625. return r.minFilter = 1 === t.length ? Oe : Ne,
  56626. r.magFilter = Oe,
  56627. r.generateMipmaps = !1,
  56628. r.needsUpdate = !0,
  56629. r.encoding = 2 === s ? an : rn,
  56630. r.premultiplyAlpha = !!(1 & e),
  56631. r
  56632. }
  56633. }, {
  56634. key: "_createTexture",
  56635. value: function(e) {
  56636. var t = this
  56637. , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  56638. , i = Hw(new Uint8Array(e));
  56639. if (0 !== i.vkFormat)
  56640. return function(e) {
  56641. var t = e.vkFormat
  56642. , n = e.pixelWidth
  56643. , i = e.pixelHeight
  56644. , r = e.pixelDepth;
  56645. if (void 0 === Xw[t])
  56646. throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");
  56647. var e = e.levels[0].levelData;
  56648. e = qw[t] === Xe ? new Float32Array(e.buffer,e.byteOffset,e.byteLength / Float32Array.BYTES_PER_ELEMENT) : qw[t] === qe ? new Uint16Array(e.buffer,e.byteOffset,e.byteLength / Uint16Array.BYTES_PER_ELEMENT) : e;
  56649. r = 0 === r ? new ia(e,n,i) : new Data3DTexture(e,n,i,r);
  56650. return r.type = qw[t],
  56651. r.format = Xw[t],
  56652. r.encoding = Jw[t] || rn,
  56653. r.needsUpdate = !0,
  56654. Promise.resolve(r)
  56655. }(i);
  56656. var r = n
  56657. , n = this.init().then(function() {
  56658. return t.workerPool.postMessage({
  56659. type: "transcode",
  56660. buffer: e,
  56661. taskConfig: r
  56662. }, [e])
  56663. }).then(function(e) {
  56664. return t._createTextureFrom(e.data)
  56665. });
  56666. return Vw.set(e, {
  56667. promise: n
  56668. }),
  56669. n
  56670. }
  56671. }, {
  56672. key: "dispose",
  56673. value: function() {
  56674. return this.workerPool.dispose(),
  56675. this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL),
  56676. jw--,
  56677. this
  56678. }
  56679. }]),
  56680. r
  56681. }();
  56682. Ww.BasisFormat = {
  56683. ETC1S: 0,
  56684. UASTC_4x4: 1
  56685. },
  56686. Ww.TranscoderFormat = {
  56687. ETC1: 0,
  56688. ETC2: 1,
  56689. BC1: 2,
  56690. BC3: 3,
  56691. BC4: 4,
  56692. BC5: 5,
  56693. BC7_M6_OPAQUE_ONLY: 6,
  56694. BC7_M5: 7,
  56695. PVRTC1_4_RGB: 8,
  56696. PVRTC1_4_RGBA: 9,
  56697. ASTC_4x4: 10,
  56698. ATC_RGB: 11,
  56699. ATC_RGBA_INTERPOLATED_ALPHA: 12,
  56700. RGBA32: 13,
  56701. RGB565: 14,
  56702. BGR565: 15,
  56703. RGBA4444: 16
  56704. },
  56705. Ww.EngineFormat = {
  56706. RGBAFormat: et,
  56707. RGBA_ASTC_4x4_Format: _t,
  56708. RGBA_BPTC_Format: Ot,
  56709. RGBA_ETC2_EAC_Format: Et,
  56710. RGBA_PVRTC_4BPPV1_Format: yt,
  56711. RGBA_S3TC_DXT5_Format: mt,
  56712. RGB_ETC1_Format: bt,
  56713. RGB_ETC2_Format: xt,
  56714. RGB_PVRTC_4BPPV1_Format: vt,
  56715. RGB_S3TC_DXT1_Format: ht
  56716. },
  56717. Ww.BasisWorker = function() {
  56718. var m, n, v, g = _EngineFormat, y = _TranscoderFormat, w = _BasisFormat;
  56719. self.addEventListener("message", function(e) {
  56720. var t, c = e.data;
  56721. switch (c.type) {
  56722. case "init":
  56723. m = c.config,
  56724. t = c.transcoderBinary,
  56725. n = new Promise(function(e) {
  56726. v = {
  56727. wasmBinary: t,
  56728. onRuntimeInitialized: e
  56729. },
  56730. BASIS(v)
  56731. }
  56732. ).then(function() {
  56733. v.initializeBasis(),
  56734. void 0 === v.KTX2File && console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")
  56735. });
  56736. break;
  56737. case "transcode":
  56738. n.then(function() {
  56739. try {
  56740. for (var e = function(e) {
  56741. var t = new v.KTX2File(new Uint8Array(e));
  56742. function n() {
  56743. t.close(),
  56744. t.delete()
  56745. }
  56746. if (!t.isValid())
  56747. throw n(),
  56748. new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");
  56749. var i = t.isUASTC() ? w.UASTC_4x4 : w.ETC1S
  56750. , r = t.getWidth()
  56751. , a = t.getHeight()
  56752. , o = t.getLevels()
  56753. , s = t.getHasAlpha()
  56754. , l = t.getDFDTransferFunc()
  56755. , e = t.getDFDFlags()
  56756. , i = function(e, t, n, i) {
  56757. for (var r, a, o = e === w.ETC1S ? b : x, s = 0; s < o.length; s++) {
  56758. var l = o[s];
  56759. if (m[l.if] && (l.basisFormat.includes(e) && !(i && l.transcoderFormat.length < 2) && (!l.needsPowerOfTwo || E(t) && E(n))))
  56760. return r = l.transcoderFormat[i ? 1 : 0],
  56761. a = l.engineFormat[i ? 1 : 0],
  56762. {
  56763. transcoderFormat: r,
  56764. engineFormat: a
  56765. }
  56766. }
  56767. return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),
  56768. r = y.RGBA32,
  56769. a = g.RGBAFormat,
  56770. {
  56771. transcoderFormat: r,
  56772. engineFormat: a
  56773. }
  56774. }(i, r, a, s)
  56775. , u = i.transcoderFormat
  56776. , i = i.engineFormat;
  56777. if (!r || !a || !o)
  56778. throw n(),
  56779. new Error("THREE.KTX2Loader:\tInvalid texture");
  56780. if (!t.startTranscoding())
  56781. throw n(),
  56782. new Error("THREE.KTX2Loader: .startTranscoding failed");
  56783. for (var c = [], d = 0; d < o; d++) {
  56784. var h = t.getImageLevelInfo(d, 0, 0)
  56785. , p = h.origWidth
  56786. , f = h.origHeight
  56787. , h = new Uint8Array(t.getImageTranscodedSizeInBytes(d, 0, 0, u));
  56788. if (!t.transcodeImage(h, d, 0, 0, u, 0, -1, -1))
  56789. throw n(),
  56790. new Error("THREE.KTX2Loader: .transcodeImage failed.");
  56791. c.push({
  56792. data: h,
  56793. width: p,
  56794. height: f
  56795. })
  56796. }
  56797. return n(),
  56798. {
  56799. width: r,
  56800. height: a,
  56801. hasAlpha: s,
  56802. mipmaps: c,
  56803. format: i,
  56804. dfdTransferFn: l,
  56805. dfdFlags: e
  56806. }
  56807. }(c.buffer), t = e.width, n = e.height, i = e.hasAlpha, r = e.mipmaps, a = e.format, o = e.dfdTransferFn, s = e.dfdFlags, l = [], u = 0; u < r.length; ++u)
  56808. l.push(r[u].data.buffer);
  56809. self.postMessage({
  56810. type: "transcode",
  56811. id: c.id,
  56812. width: t,
  56813. height: n,
  56814. hasAlpha: i,
  56815. mipmaps: r,
  56816. format: a,
  56817. dfdTransferFn: o,
  56818. dfdFlags: s
  56819. }, l)
  56820. } catch (e) {
  56821. console.error(e),
  56822. self.postMessage({
  56823. type: "error",
  56824. id: c.id,
  56825. error: e.message
  56826. })
  56827. }
  56828. })
  56829. }
  56830. });
  56831. var e = [{
  56832. if: "astcSupported",
  56833. basisFormat: [w.UASTC_4x4],
  56834. transcoderFormat: [y.ASTC_4x4, y.ASTC_4x4],
  56835. engineFormat: [g.RGBA_ASTC_4x4_Format, g.RGBA_ASTC_4x4_Format],
  56836. priorityETC1S: 1 / 0,
  56837. priorityUASTC: 1,
  56838. needsPowerOfTwo: !1
  56839. }, {
  56840. if: "bptcSupported",
  56841. basisFormat: [w.ETC1S, w.UASTC_4x4],
  56842. transcoderFormat: [y.BC7_M5, y.BC7_M5],
  56843. engineFormat: [g.RGBA_BPTC_Format, g.RGBA_BPTC_Format],
  56844. priorityETC1S: 3,
  56845. priorityUASTC: 2,
  56846. needsPowerOfTwo: !1
  56847. }, {
  56848. if: "dxtSupported",
  56849. basisFormat: [w.ETC1S, w.UASTC_4x4],
  56850. transcoderFormat: [y.BC1, y.BC3],
  56851. engineFormat: [g.RGB_S3TC_DXT1_Format, g.RGBA_S3TC_DXT5_Format],
  56852. priorityETC1S: 4,
  56853. priorityUASTC: 5,
  56854. needsPowerOfTwo: !1
  56855. }, {
  56856. if: "etc2Supported",
  56857. basisFormat: [w.ETC1S, w.UASTC_4x4],
  56858. transcoderFormat: [y.ETC1, y.ETC2],
  56859. engineFormat: [g.RGB_ETC2_Format, g.RGBA_ETC2_EAC_Format],
  56860. priorityETC1S: 1,
  56861. priorityUASTC: 3,
  56862. needsPowerOfTwo: !1
  56863. }, {
  56864. if: "etc1Supported",
  56865. basisFormat: [w.ETC1S, w.UASTC_4x4],
  56866. transcoderFormat: [y.ETC1],
  56867. engineFormat: [g.RGB_ETC1_Format],
  56868. priorityETC1S: 2,
  56869. priorityUASTC: 4,
  56870. needsPowerOfTwo: !1
  56871. }, {
  56872. if: "pvrtcSupported",
  56873. basisFormat: [w.ETC1S, w.UASTC_4x4],
  56874. transcoderFormat: [y.PVRTC1_4_RGB, y.PVRTC1_4_RGBA],
  56875. engineFormat: [g.RGB_PVRTC_4BPPV1_Format, g.RGBA_PVRTC_4BPPV1_Format],
  56876. priorityETC1S: 5,
  56877. priorityUASTC: 6,
  56878. needsPowerOfTwo: !0
  56879. }]
  56880. , b = e.sort(function(e, t) {
  56881. return e.priorityETC1S - t.priorityETC1S
  56882. })
  56883. , x = e.sort(function(e, t) {
  56884. return e.priorityUASTC - t.priorityUASTC
  56885. });
  56886. function E(e) {
  56887. return e <= 2 || 0 == (e & e - 1) && 0 !== e
  56888. }
  56889. }
  56890. ;
  56891. var Xw = (H(Ou = {}, 109, et),
  56892. H(Ou, 97, et),
  56893. H(Ou, 37, et),
  56894. H(Ou, 43, et),
  56895. H(Ou, 103, lt),
  56896. H(Ou, 83, lt),
  56897. H(Ou, 16, lt),
  56898. H(Ou, 22, lt),
  56899. H(Ou, 100, ot),
  56900. H(Ou, 76, ot),
  56901. H(Ou, 15, ot),
  56902. H(Ou, 9, ot),
  56903. Ou)
  56904. , qw = (H(Ch = {}, 109, Xe),
  56905. H(Ch, 97, qe),
  56906. H(Ch, 37, Ue),
  56907. H(Ch, 43, Ue),
  56908. H(Ch, 103, Xe),
  56909. H(Ch, 83, qe),
  56910. H(Ch, 16, Ue),
  56911. H(Ch, 22, Ue),
  56912. H(Ch, 100, Xe),
  56913. H(Ch, 76, qe),
  56914. H(Ch, 15, Ue),
  56915. H(Ch, 9, Ue),
  56916. Ch)
  56917. , Jw = (H(rh = {}, 43, an),
  56918. H(rh, 22, an),
  56919. H(rh, 15, an),
  56920. rh);
  56921. function Yw(e) {
  56922. wc.call(this, e)
  56923. }
  56924. var Zw = function() {
  56925. var e = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11])
  56926. , a = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]);
  56927. if ("object" !== ("undefined" == typeof WebAssembly ? "undefined" : X(WebAssembly)))
  56928. return {
  56929. supported: !1
  56930. };
  56931. var d, t = "B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";
  56932. WebAssembly.validate(e) && (t = "B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",
  56933. console.log("Warning: meshopt_decoder is using experimental SIMD support"));
  56934. t = WebAssembly.instantiate(function(e) {
  56935. for (var t = new Uint8Array(e.length), n = 0; n < e.length; ++n) {
  56936. var i = e.charCodeAt(n);
  56937. t[n] = 96 < i ? i - 71 : 64 < i ? i - 65 : 47 < i ? i + 4 : 46 < i ? 63 : 62
  56938. }
  56939. for (var r = 0, n = 0; n < e.length; ++n)
  56940. t[r++] = t[n] < 60 ? a[t[n]] : 64 * (t[n] - 60) + t[++n];
  56941. return t.buffer.slice(0, r)
  56942. }(t), {}).then(function(e) {
  56943. (d = e.instance).exports.__wasm_call_ctors()
  56944. });
  56945. function o(e, t, n, i, r, a) {
  56946. var o = d.exports.sbrk
  56947. , s = n + 3 & -4
  56948. , l = o(s * i)
  56949. , u = o(r.length)
  56950. , c = new Uint8Array(d.exports.memory.buffer);
  56951. c.set(r, u);
  56952. r = e(l, n, i, u, r.length);
  56953. if (0 == r && a && a(l, s, i),
  56954. t.set(c.subarray(l, l + n * i)),
  56955. o(l - o(0)),
  56956. 0 != r)
  56957. throw new Error("Malformed buffer data: " + r)
  56958. }
  56959. var s = {
  56960. 0: "",
  56961. 1: "meshopt_decodeFilterOct",
  56962. 2: "meshopt_decodeFilterQuat",
  56963. 3: "meshopt_decodeFilterExp",
  56964. NONE: "",
  56965. OCTAHEDRAL: "meshopt_decodeFilterOct",
  56966. QUATERNION: "meshopt_decodeFilterQuat",
  56967. EXPONENTIAL: "meshopt_decodeFilterExp"
  56968. }
  56969. , l = {
  56970. 0: "meshopt_decodeVertexBuffer",
  56971. 1: "meshopt_decodeIndexBuffer",
  56972. 2: "meshopt_decodeIndexSequence",
  56973. ATTRIBUTES: "meshopt_decodeVertexBuffer",
  56974. TRIANGLES: "meshopt_decodeIndexBuffer",
  56975. INDICES: "meshopt_decodeIndexSequence"
  56976. };
  56977. return {
  56978. ready: t,
  56979. supported: !0,
  56980. decodeVertexBuffer: function(e, t, n, i, r) {
  56981. o(d.exports.meshopt_decodeVertexBuffer, e, t, n, i, d.exports[s[r]])
  56982. },
  56983. decodeIndexBuffer: function(e, t, n, i) {
  56984. o(d.exports.meshopt_decodeIndexBuffer, e, t, n, i)
  56985. },
  56986. decodeIndexSequence: function(e, t, n, i) {
  56987. o(d.exports.meshopt_decodeIndexSequence, e, t, n, i)
  56988. },
  56989. decodeGltfBuffer: function(e, t, n, i, r, a) {
  56990. o(d.exports[l[r]], e, t, n, i, d.exports[s[a]])
  56991. }
  56992. }
  56993. }();
  56994. Yw.prototype = Object.assign(Object.create(wc.prototype), {
  56995. constructor: Yw,
  56996. parse: function(e, t) {
  56997. var n = {
  56998. mipmaps: [],
  56999. width: 0,
  57000. height: 0,
  57001. format: null,
  57002. mipmapCount: 1
  57003. };
  57004. function i(e) {
  57005. return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24)
  57006. }
  57007. var r, a = i("DXT1"), o = i("DXT3"), s = i("DXT5"), l = i("ETC1"), u = new Int32Array(e,0,31);
  57008. if (542327876 !== u[0])
  57009. return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),
  57010. n;
  57011. if (4 & !u[20])
  57012. return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),
  57013. n;
  57014. var c = u[21]
  57015. , d = !1;
  57016. switch (c) {
  57017. case a:
  57018. r = 8,
  57019. n.format = ht;
  57020. break;
  57021. case o:
  57022. r = 16,
  57023. n.format = ft;
  57024. break;
  57025. case s:
  57026. r = 16,
  57027. n.format = mt;
  57028. break;
  57029. case l:
  57030. r = 8,
  57031. n.format = bt;
  57032. break;
  57033. default:
  57034. if (!(32 === u[22] && 16711680 & u[23] && 65280 & u[24] && 255 & u[25] && 4278190080 & u[26]))
  57035. return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ", String.fromCharCode(255 & c, c >> 8 & 255, c >> 16 & 255, c >> 24 & 255)),
  57036. n;
  57037. d = !0,
  57038. r = 64,
  57039. n.format = et
  57040. }
  57041. n.mipmapCount = 1,
  57042. 131072 & u[2] && !1 !== t && (n.mipmapCount = Math.max(1, u[7]));
  57043. t = u[28];
  57044. if (n.isCubemap = !!(512 & t),
  57045. n.isCubemap && (!(1024 & t) || !(2048 & t) || !(4096 & t) || !(8192 & t) || !(16384 & t) || !(32768 & t)))
  57046. return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),
  57047. n;
  57048. n.width = u[4],
  57049. n.height = u[3];
  57050. for (var h = u[1] + 4, p = n.isCubemap ? 6 : 1, f = 0; f < p; f++)
  57051. for (var m, v, g = n.width, y = n.height, w = 0; w < n.mipmapCount; w++)
  57052. d ? m = (v = function(e, t, n, i) {
  57053. for (var r = n * i * 4, a = new Uint8Array(e,t,r), o = new Uint8Array(r), s = 0, l = 0, u = 0; u < i; u++)
  57054. for (var c = 0; c < n; c++) {
  57055. var d = a[l]
  57056. , h = a[++l]
  57057. , p = a[++l]
  57058. , f = a[++l];
  57059. l++,
  57060. o[s] = p,
  57061. o[++s] = h,
  57062. o[++s] = d,
  57063. o[++s] = f,
  57064. s++
  57065. }
  57066. return o
  57067. }(e, h, g, y)).length : (m = Math.max(4, g) / 4 * Math.max(4, y) / 4 * r,
  57068. v = new Uint8Array(e,h,m)),
  57069. n.mipmaps.push({
  57070. data: v,
  57071. width: g,
  57072. height: y
  57073. }),
  57074. h += m,
  57075. g = Math.max(g >> 1, 1),
  57076. y = Math.max(y >> 1, 1);
  57077. return n
  57078. }
  57079. });
  57080. var Qw = function() {
  57081. function e(e, t, n) {
  57082. mc.call(this, e),
  57083. this.dracoLoader = new Iw,
  57084. this.ktx2Loader = new Ww,
  57085. this.meshoptDecoder = Zw,
  57086. this.ddsLoader = new Yw,
  57087. this.dracoLoader.setDecoderPath(n + "three.js/loaders/draco/"),
  57088. this.ktx2Loader.setTranscoderPath(n + "three.js/loaders/ktx/").detectSupport(t),
  57089. this.pluginCallbacks = [],
  57090. this.register(function(e) {
  57091. return new r(e)
  57092. }),
  57093. this.register(function(e) {
  57094. return new o(e)
  57095. }),
  57096. this.register(function(e) {
  57097. return new s(e)
  57098. }),
  57099. this.register(function(e) {
  57100. return new a(e)
  57101. }),
  57102. this.register(function(e) {
  57103. return new i(e)
  57104. }),
  57105. this.register(function(e) {
  57106. return new l(e)
  57107. })
  57108. }
  57109. function n() {
  57110. var n = {};
  57111. return {
  57112. get: function(e) {
  57113. return n[e]
  57114. },
  57115. add: function(e, t) {
  57116. n[e] = t
  57117. },
  57118. remove: function(e) {
  57119. delete n[e]
  57120. },
  57121. removeAll: function() {
  57122. n = {}
  57123. }
  57124. }
  57125. }
  57126. e.prototype = Object.assign(Object.create(mc.prototype), {
  57127. constructor: e,
  57128. load: function(n, i, e, t) {
  57129. var r = this
  57130. , a = "" !== this.resourcePath ? this.resourcePath : "" !== this.path ? this.path : ld.extractUrlBase(n);
  57131. this.manager.itemStart(n);
  57132. function o(e) {
  57133. t ? t(e) : console.error(e),
  57134. r.manager.itemError(n),
  57135. r.manager.itemEnd(n)
  57136. }
  57137. var s = new gc(this.manager);
  57138. s.setPath(this.path),
  57139. s.setResponseType("arraybuffer"),
  57140. s.setRequestHeader(this.requestHeader),
  57141. s.setWithCredentials(this.withCredentials),
  57142. s.load(n, function(e, t) {
  57143. console.log("数据加载成功", n.split("/").pop(), " ,total: " + t);
  57144. !function() {
  57145. try {
  57146. r.parse(e, a, function(e) {
  57147. i(e, t),
  57148. r.manager.itemEnd(n)
  57149. }, o)
  57150. } catch (e) {
  57151. o(e)
  57152. }
  57153. }()
  57154. }, e, o)
  57155. },
  57156. setDRACOLoader: function(e) {
  57157. return this.dracoLoader = e,
  57158. this
  57159. },
  57160. setDDSLoader: function(e) {
  57161. return this.ddsLoader = e,
  57162. this
  57163. },
  57164. setKTX2Loader: function(e) {
  57165. return this.ktx2Loader = e,
  57166. this
  57167. },
  57168. setMeshoptDecoder: function(e) {
  57169. return this.meshoptDecoder = e,
  57170. this
  57171. },
  57172. register: function(e) {
  57173. return -1 === this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.push(e),
  57174. this
  57175. },
  57176. unregister: function(e) {
  57177. return -1 !== this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1),
  57178. this
  57179. },
  57180. parse: function(e, t, n, i) {
  57181. var r, a = {}, o = {};
  57182. if ("string" == typeof e)
  57183. r = e;
  57184. else if (ld.decodeText(new Uint8Array(e,0,4)) === v) {
  57185. try {
  57186. a[p.KHR_BINARY_GLTF] = new g(e)
  57187. } catch (e) {
  57188. return void (i && i(e))
  57189. }
  57190. r = a[p.KHR_BINARY_GLTF].content
  57191. } else
  57192. r = ld.decodeText(new Uint8Array(e));
  57193. var s = JSON.parse(r);
  57194. if (void 0 === s.asset || s.asset.version[0] < 2)
  57195. i && i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  57196. else {
  57197. var l = new V(s,{
  57198. path: t || this.resourcePath || "",
  57199. crossOrigin: this.crossOrigin,
  57200. manager: this.manager,
  57201. ktx2Loader: this.ktx2Loader,
  57202. meshoptDecoder: this.meshoptDecoder
  57203. });
  57204. l.unlitMat = this.unlitMat,
  57205. l.fileLoader.setRequestHeader(this.requestHeader);
  57206. for (var u = 0; u < this.pluginCallbacks.length; u++) {
  57207. var c = this.pluginCallbacks[u](l);
  57208. a[(o[c.name] = c).name] = !0
  57209. }
  57210. if (s.extensionsUsed)
  57211. for (u = 0; u < s.extensionsUsed.length; ++u) {
  57212. var d = s.extensionsUsed[u]
  57213. , h = s.extensionsRequired || [];
  57214. switch (d) {
  57215. case p.KHR_MATERIALS_UNLIT:
  57216. a[d] = new m;
  57217. break;
  57218. case p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  57219. a[d] = new b;
  57220. break;
  57221. case p.KHR_DRACO_MESH_COMPRESSION:
  57222. a[d] = new y(s,this.dracoLoader);
  57223. break;
  57224. case p.MSFT_TEXTURE_DDS:
  57225. a[d] = new f(this.ddsLoader);
  57226. break;
  57227. case p.KHR_TEXTURE_TRANSFORM:
  57228. a[d] = new w;
  57229. break;
  57230. case p.KHR_MESH_QUANTIZATION:
  57231. a[d] = new x;
  57232. break;
  57233. default:
  57234. 0 <= h.indexOf(d) && void 0 === o[d] && console.warn('THREE.GLTFLoader: Unknown extension "' + d + '".')
  57235. }
  57236. }
  57237. l.setExtensions(a),
  57238. l.setPlugins(o),
  57239. l.parse(n, i)
  57240. }
  57241. }
  57242. });
  57243. var p = {
  57244. KHR_BINARY_GLTF: "KHR_binary_glTF",
  57245. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  57246. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  57247. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  57248. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  57249. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  57250. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  57251. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  57252. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  57253. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  57254. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  57255. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
  57256. MSFT_TEXTURE_DDS: "MSFT_texture_dds"
  57257. };
  57258. function f(e) {
  57259. if (!e)
  57260. throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");
  57261. this.name = p.MSFT_TEXTURE_DDS,
  57262. this.ddsLoader = e
  57263. }
  57264. function i(e) {
  57265. this.parser = e,
  57266. this.name = p.KHR_LIGHTS_PUNCTUAL,
  57267. this.cache = {
  57268. refs: {},
  57269. uses: {}
  57270. }
  57271. }
  57272. function m() {
  57273. this.name = p.KHR_MATERIALS_UNLIT
  57274. }
  57275. function r(e) {
  57276. this.parser = e,
  57277. this.name = p.KHR_MATERIALS_CLEARCOAT
  57278. }
  57279. function a(e) {
  57280. this.parser = e,
  57281. this.name = p.KHR_MATERIALS_TRANSMISSION
  57282. }
  57283. function o(e) {
  57284. this.parser = e,
  57285. this.name = p.KHR_TEXTURE_BASISU
  57286. }
  57287. function s(e) {
  57288. this.parser = e,
  57289. this.name = p.EXT_TEXTURE_WEBP,
  57290. this.isSupported = null
  57291. }
  57292. function l(e) {
  57293. this.name = p.EXT_MESHOPT_COMPRESSION,
  57294. this.parser = e
  57295. }
  57296. i.prototype._markDefs = function() {
  57297. for (var e = this.parser, t = this.parser.json.nodes || [], n = 0, i = t.length; n < i; n++) {
  57298. var r = t[n];
  57299. r.extensions && r.extensions[this.name] && void 0 !== r.extensions[this.name].light && e._addNodeRef(this.cache, r.extensions[this.name].light)
  57300. }
  57301. }
  57302. ,
  57303. i.prototype._loadLight = function(e) {
  57304. var t = this.parser
  57305. , n = "light:" + e
  57306. , i = t.cache.get(n);
  57307. if (i)
  57308. return i;
  57309. var r, a = t.json, o = ((a.extensions && a.extensions[this.name] || {}).lights || [])[e], s = new Yi(16777215);
  57310. void 0 !== o.color && s.fromArray(o.color);
  57311. var l = void 0 !== o.range ? o.range : 0;
  57312. switch (o.type) {
  57313. case "directional":
  57314. (r = new nd(s)).target.position.set(0, 0, -1),
  57315. r.add(r.target);
  57316. break;
  57317. case "point":
  57318. (r = new $c(s)).distance = l;
  57319. break;
  57320. case "spot":
  57321. (r = new Qc(s)).distance = l,
  57322. o.spot = o.spot || {},
  57323. o.spot.innerConeAngle = void 0 !== o.spot.innerConeAngle ? o.spot.innerConeAngle : 0,
  57324. o.spot.outerConeAngle = void 0 !== o.spot.outerConeAngle ? o.spot.outerConeAngle : Math.PI / 4,
  57325. r.angle = o.spot.outerConeAngle,
  57326. r.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle,
  57327. r.target.position.set(0, 0, -1),
  57328. r.add(r.target);
  57329. break;
  57330. default:
  57331. throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type)
  57332. }
  57333. return r.position.set(0, 0, 0),
  57334. r.decay = 2,
  57335. void 0 !== o.intensity && (r.intensity = o.intensity),
  57336. r.name = t.createUniqueName(o.name || "light_" + e),
  57337. i = Promise.resolve(r),
  57338. t.cache.add(n, i),
  57339. i
  57340. }
  57341. ,
  57342. i.prototype.createNodeAttachment = function(e) {
  57343. var t = this
  57344. , n = this.parser
  57345. , e = n.json.nodes[e]
  57346. , i = (e.extensions && e.extensions[this.name] || {}).light;
  57347. return void 0 === i ? null : this._loadLight(i).then(function(e) {
  57348. return n._getNodeRef(t.cache, i, e)
  57349. })
  57350. }
  57351. ,
  57352. m.prototype.getMaterialType = function() {
  57353. return $i
  57354. }
  57355. ,
  57356. m.prototype.extendParams = function(e, t, n) {
  57357. var i = [];
  57358. e.color = new Yi(1,1,1),
  57359. e.opacity = 1;
  57360. var r = t.pbrMetallicRoughness;
  57361. return r && (Array.isArray(r.baseColorFactor) && (t = r.baseColorFactor,
  57362. e.color.fromArray(t),
  57363. e.opacity = t[3]),
  57364. void 0 !== r.baseColorTexture && i.push(n.assignTexture(e, "map", r.baseColorTexture))),
  57365. Promise.all(i)
  57366. }
  57367. ,
  57368. r.prototype.getMaterialType = function(e) {
  57369. e = this.parser.json.materials[e];
  57370. return e.extensions && e.extensions[this.name] ? Vu : null
  57371. }
  57372. ,
  57373. r.prototype.extendMaterialParams = function(e, t) {
  57374. var n = this.parser
  57375. , i = n.json.materials[e];
  57376. if (!i.extensions || !i.extensions[this.name])
  57377. return Promise.resolve();
  57378. var e = []
  57379. , i = i.extensions[this.name];
  57380. return void 0 !== i.clearcoatFactor && (t.clearcoat = i.clearcoatFactor),
  57381. void 0 !== i.clearcoatTexture && e.push(n.assignTexture(t, "clearcoatMap", i.clearcoatTexture)),
  57382. void 0 !== i.clearcoatRoughnessFactor && (t.clearcoatRoughness = i.clearcoatRoughnessFactor),
  57383. void 0 !== i.clearcoatRoughnessTexture && e.push(n.assignTexture(t, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)),
  57384. void 0 !== i.clearcoatNormalTexture && (e.push(n.assignTexture(t, "clearcoatNormalMap", i.clearcoatNormalTexture)),
  57385. void 0 !== i.clearcoatNormalTexture.scale && (i = i.clearcoatNormalTexture.scale,
  57386. t.clearcoatNormalScale = new yn(i,i))),
  57387. Promise.all(e)
  57388. }
  57389. ,
  57390. a.prototype.getMaterialType = function(e) {
  57391. e = this.parser.json.materials[e];
  57392. return e.extensions && e.extensions[this.name] ? Vu : null
  57393. }
  57394. ,
  57395. a.prototype.extendMaterialParams = function(e, t) {
  57396. var n = this.parser
  57397. , i = n.json.materials[e];
  57398. if (!i.extensions || !i.extensions[this.name])
  57399. return Promise.resolve();
  57400. e = [],
  57401. i = i.extensions[this.name];
  57402. return void 0 !== i.transmissionFactor && (t.transmission = i.transmissionFactor),
  57403. void 0 !== i.transmissionTexture && e.push(n.assignTexture(t, "transmissionMap", i.transmissionTexture)),
  57404. Promise.all(e)
  57405. }
  57406. ,
  57407. o.prototype.loadTexture = function(e) {
  57408. var t = this.parser
  57409. , n = t.json
  57410. , i = n.textures[e];
  57411. if (!i.extensions || !i.extensions[this.name])
  57412. return null;
  57413. var r = i.extensions[this.name]
  57414. , i = n.images[r.source]
  57415. , r = t.options.ktx2Loader;
  57416. if (r)
  57417. return t.loadTextureImage(e, i, r);
  57418. if (n.extensionsRequired && 0 <= n.extensionsRequired.indexOf(this.name))
  57419. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  57420. return null
  57421. }
  57422. ,
  57423. s.prototype.loadTexture = function(t) {
  57424. var n = this.name
  57425. , i = this.parser
  57426. , r = i.json
  57427. , e = r.textures[t];
  57428. if (!e.extensions || !e.extensions[n])
  57429. return null;
  57430. var e = e.extensions[n]
  57431. , a = r.images[e.source]
  57432. , o = a.uri ? i.options.manager.getHandler(a.uri) : i.textureLoader;
  57433. return this.detectSupport().then(function(e) {
  57434. if (e)
  57435. return i.loadTextureImage(t, a, o);
  57436. if (r.extensionsRequired && 0 <= r.extensionsRequired.indexOf(n))
  57437. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  57438. return i.loadTexture(t)
  57439. })
  57440. }
  57441. ,
  57442. s.prototype.detectSupport = function() {
  57443. return this.isSupported || (this.isSupported = new Promise(function(e) {
  57444. var t = new Image;
  57445. t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",
  57446. t.onload = t.onerror = function() {
  57447. e(1 === t.height)
  57448. }
  57449. }
  57450. )),
  57451. this.isSupported
  57452. }
  57453. ,
  57454. l.prototype.loadBufferView = function(e) {
  57455. var t = this.parser.json
  57456. , e = t.bufferViews[e];
  57457. if (e.extensions && e.extensions[this.name]) {
  57458. var o = e.extensions[this.name]
  57459. , e = this.parser.getDependency("buffer", o.buffer)
  57460. , s = this.parser.options.meshoptDecoder;
  57461. if (s && s.supported)
  57462. return Promise.all([e, s.ready]).then(function(e) {
  57463. var t = o.byteOffset || 0
  57464. , n = o.byteLength || 0
  57465. , i = o.count
  57466. , r = o.byteStride
  57467. , a = new ArrayBuffer(i * r)
  57468. , n = new Uint8Array(e[0],t,n);
  57469. return s.decodeGltfBuffer(new Uint8Array(a), i, r, n, o.mode, o.filter),
  57470. a
  57471. });
  57472. if (t.extensionsRequired && 0 <= t.extensionsRequired.indexOf(this.name))
  57473. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  57474. return null
  57475. }
  57476. return null
  57477. }
  57478. ;
  57479. var v = "glTF"
  57480. , u = 12
  57481. , c = {
  57482. JSON: 1313821514,
  57483. BIN: 5130562
  57484. };
  57485. function g(e) {
  57486. this.name = p.KHR_BINARY_GLTF,
  57487. this.content = null,
  57488. this.body = null;
  57489. var t = new DataView(e,0,u);
  57490. if (this.header = {
  57491. magic: ld.decodeText(new Uint8Array(e.slice(0, 4))),
  57492. version: t.getUint32(4, !0),
  57493. length: t.getUint32(8, !0)
  57494. },
  57495. this.header.magic !== v)
  57496. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  57497. if (this.header.version < 2)
  57498. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  57499. for (var n = new DataView(e,u), i = 0; i < n.byteLength; ) {
  57500. var r = n.getUint32(i, !0);
  57501. i += 4;
  57502. var a, o = n.getUint32(i, !0);
  57503. i += 4,
  57504. o === c.JSON ? (a = new Uint8Array(e,u + i,r),
  57505. this.content = ld.decodeText(a)) : o === c.BIN && (this.body = e.slice(o = u + i, o + r)),
  57506. i += r
  57507. }
  57508. if (null === this.content)
  57509. throw new Error("THREE.GLTFLoader: JSON content not found.")
  57510. }
  57511. function y(e, t) {
  57512. if (!t)
  57513. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  57514. this.name = p.KHR_DRACO_MESH_COMPRESSION,
  57515. this.json = e,
  57516. this.dracoLoader = t,
  57517. this.dracoLoader.preload()
  57518. }
  57519. function w() {
  57520. this.name = p.KHR_TEXTURE_TRANSFORM
  57521. }
  57522. function d(e) {
  57523. Hu.call(this),
  57524. this.isGLTFSpecularGlossinessMaterial = !0;
  57525. var n = ["#ifdef USE_SPECULARMAP", "\tuniform sampler2D specularMap;", "#endif"].join("\n")
  57526. , i = ["#ifdef USE_GLOSSINESSMAP", "\tuniform sampler2D glossinessMap;", "#endif"].join("\n")
  57527. , r = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", "\tvec4 texelSpecular = texture2D( specularMap, vUv );", "\ttexelSpecular = sRGBToLinear( texelSpecular );", "\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tspecularFactor *= texelSpecular.rgb;", "#endif"].join("\n")
  57528. , a = ["float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", "\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );", "\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tglossinessFactor *= texelGlossiness.a;", "#endif"].join("\n")
  57529. , o = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.specularRoughness += geometryRoughness;", "material.specularRoughness = min( material.specularRoughness, 1.0 );", "material.specularColor = specularFactor;"].join("\n")
  57530. , s = {
  57531. specular: {
  57532. value: (new Yi).setHex(16777215)
  57533. },
  57534. glossiness: {
  57535. value: 1
  57536. },
  57537. specularMap: {
  57538. value: null
  57539. },
  57540. glossinessMap: {
  57541. value: null
  57542. }
  57543. };
  57544. this._extraUniforms = s,
  57545. this.onBeforeCompile = function(e) {
  57546. for (var t in s)
  57547. e.uniforms[t] = s[t];
  57548. e.fragmentShader = e.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", n).replace("#include <metalnessmap_pars_fragment>", i).replace("#include <roughnessmap_fragment>", r).replace("#include <metalnessmap_fragment>", a).replace("#include <lights_physical_fragment>", o)
  57549. }
  57550. ,
  57551. Object.defineProperties(this, {
  57552. specular: {
  57553. get: function() {
  57554. return s.specular.value
  57555. },
  57556. set: function(e) {
  57557. s.specular.value = e
  57558. }
  57559. },
  57560. specularMap: {
  57561. get: function() {
  57562. return s.specularMap.value
  57563. },
  57564. set: function(e) {
  57565. (s.specularMap.value = e) ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP
  57566. }
  57567. },
  57568. glossiness: {
  57569. get: function() {
  57570. return s.glossiness.value
  57571. },
  57572. set: function(e) {
  57573. s.glossiness.value = e
  57574. }
  57575. },
  57576. glossinessMap: {
  57577. get: function() {
  57578. return s.glossinessMap.value
  57579. },
  57580. set: function(e) {
  57581. (s.glossinessMap.value = e) ? (this.defines.USE_GLOSSINESSMAP = "",
  57582. this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP,
  57583. delete this.defines.USE_UV)
  57584. }
  57585. }
  57586. }),
  57587. delete this.metalness,
  57588. delete this.roughness,
  57589. delete this.metalnessMap,
  57590. delete this.roughnessMap,
  57591. this.setValues(e)
  57592. }
  57593. function b() {
  57594. return {
  57595. name: p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
  57596. specularGlossinessParams: ["color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio"],
  57597. getMaterialType: function() {
  57598. return d
  57599. },
  57600. extendParams: function(e, t, n) {
  57601. var i = t.extensions[this.name];
  57602. e.color = new Yi(1,1,1),
  57603. e.opacity = 1;
  57604. var r = [];
  57605. return Array.isArray(i.diffuseFactor) && (t = i.diffuseFactor,
  57606. e.color.fromArray(t),
  57607. e.opacity = t[3]),
  57608. void 0 !== i.diffuseTexture && r.push(n.assignTexture(e, "map", i.diffuseTexture)),
  57609. e.emissive = new Yi(0,0,0),
  57610. e.glossiness = void 0 !== i.glossinessFactor ? i.glossinessFactor : 1,
  57611. e.specular = new Yi(1,1,1),
  57612. Array.isArray(i.specularFactor) && e.specular.fromArray(i.specularFactor),
  57613. void 0 !== i.specularGlossinessTexture && (i = i.specularGlossinessTexture,
  57614. r.push(n.assignTexture(e, "glossinessMap", i)),
  57615. r.push(n.assignTexture(e, "specularMap", i))),
  57616. Promise.all(r)
  57617. },
  57618. createMaterial: function(e) {
  57619. var t = new d(e);
  57620. return t.fog = !0,
  57621. t.color = e.color,
  57622. t.map = void 0 === e.map ? null : e.map,
  57623. t.lightMap = null,
  57624. t.lightMapIntensity = 1,
  57625. t.aoMap = void 0 === e.aoMap ? null : e.aoMap,
  57626. t.aoMapIntensity = 1,
  57627. t.emissive = e.emissive,
  57628. t.emissiveIntensity = 1,
  57629. t.emissiveMap = void 0 === e.emissiveMap ? null : e.emissiveMap,
  57630. t.bumpMap = void 0 === e.bumpMap ? null : e.bumpMap,
  57631. t.bumpScale = 1,
  57632. t.normalMap = void 0 === e.normalMap ? null : e.normalMap,
  57633. t.normalMapType = sn,
  57634. e.normalScale && (t.normalScale = e.normalScale),
  57635. t.displacementMap = null,
  57636. t.displacementScale = 1,
  57637. t.displacementBias = 0,
  57638. t.specularMap = void 0 === e.specularMap ? null : e.specularMap,
  57639. t.specular = e.specular,
  57640. t.glossinessMap = void 0 === e.glossinessMap ? null : e.glossinessMap,
  57641. t.glossiness = e.glossiness,
  57642. t.alphaMap = null,
  57643. t.envMap = void 0 === e.envMap ? null : e.envMap,
  57644. t.envMapIntensity = 1,
  57645. t.refractionRatio = .98,
  57646. t
  57647. }
  57648. }
  57649. }
  57650. function x() {
  57651. this.name = p.KHR_MESH_QUANTIZATION
  57652. }
  57653. function T(e, t, n, i) {
  57654. Ku.call(this, e, t, n, i)
  57655. }
  57656. y.prototype.decodePrimitive = function(e, t) {
  57657. var n, i = this.json, r = this.dracoLoader, a = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, s = {}, l = {}, u = {};
  57658. for (n in o) {
  57659. var c = L[n] || n.toLowerCase();
  57660. s[c] = o[n]
  57661. }
  57662. for (n in e.attributes) {
  57663. var d, h, c = L[n] || n.toLowerCase();
  57664. void 0 !== o[n] && (d = i.accessors[e.attributes[n]],
  57665. h = D[d.componentType],
  57666. u[c] = h,
  57667. l[c] = !0 === d.normalized)
  57668. }
  57669. return t.getDependency("bufferView", a).then(function(e) {
  57670. return new Promise(function(i) {
  57671. r.decodeDracoFile(e, function(e) {
  57672. for (var t in e.attributes) {
  57673. var n = e.attributes[t]
  57674. , t = l[t];
  57675. void 0 !== t && (n.normalized = t)
  57676. }
  57677. i(e)
  57678. }, s, u)
  57679. }
  57680. )
  57681. })
  57682. }
  57683. ,
  57684. w.prototype.extendTexture = function(e, t) {
  57685. return e = e.clone(),
  57686. void 0 !== t.offset && e.offset.fromArray(t.offset),
  57687. void 0 !== t.rotation && (e.rotation = t.rotation),
  57688. void 0 !== t.scale && e.repeat.fromArray(t.scale),
  57689. void 0 !== t.texCoord && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'),
  57690. e.needsUpdate = !0,
  57691. e
  57692. }
  57693. ,
  57694. ((d.prototype = Object.create(Hu.prototype)).constructor = d).prototype.copy = function(e) {
  57695. return Hu.prototype.copy.call(this, e),
  57696. this.specularMap = e.specularMap,
  57697. this.specular.copy(e.specular),
  57698. this.glossinessMap = e.glossinessMap,
  57699. this.glossiness = e.glossiness,
  57700. delete this.metalness,
  57701. delete this.roughness,
  57702. delete this.metalnessMap,
  57703. delete this.roughnessMap,
  57704. this
  57705. }
  57706. ,
  57707. ((T.prototype = Object.create(Ku.prototype)).constructor = T).prototype.beforeStart_ = T.prototype.copySampleValue_ = function(e) {
  57708. for (var t = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = e * i * 3 + i, a = 0; a !== i; a++)
  57709. t[a] = n[r + a];
  57710. return t
  57711. }
  57712. ,
  57713. T.prototype.afterEnd_ = T.prototype.copySampleValue_,
  57714. T.prototype.interpolate_ = function(e, t, n, i) {
  57715. for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = 2 * o, l = 3 * o, u = i - t, i = (n - t) / u, n = i * i, t = n * i, c = e * l, d = c - l, h = -2 * t + 3 * n, p = t - n, f = 1 - h, m = p - n + i, v = 0; v !== o; v++) {
  57716. var g = a[d + v + o]
  57717. , y = a[d + v + s] * u
  57718. , w = a[c + v + o]
  57719. , b = a[c + v] * u;
  57720. r[v] = f * g + m * y + h * w + p * b
  57721. }
  57722. return r
  57723. }
  57724. ;
  57725. var E = 0
  57726. , _ = 1
  57727. , M = 2
  57728. , A = 3
  57729. , S = 4
  57730. , C = 5
  57731. , P = 6
  57732. , D = {
  57733. 5120: Int8Array,
  57734. 5121: Uint8Array,
  57735. 5122: Int16Array,
  57736. 5123: Uint16Array,
  57737. 5125: Uint32Array,
  57738. 5126: Float32Array
  57739. }
  57740. , h = {
  57741. 9728: Re,
  57742. 9729: Oe,
  57743. 9984: Fe,
  57744. 9985: ze,
  57745. 9986: Ie,
  57746. 9987: Ne
  57747. }
  57748. , k = {
  57749. 33071: Be,
  57750. 33648: Le,
  57751. 10497: ke
  57752. }
  57753. , B = {
  57754. SCALAR: 1,
  57755. VEC2: 2,
  57756. VEC3: 3,
  57757. VEC4: 4,
  57758. MAT2: 4,
  57759. MAT3: 9,
  57760. MAT4: 16
  57761. }
  57762. , L = {
  57763. POSITION: "position",
  57764. NORMAL: "normal",
  57765. TANGENT: "tangent",
  57766. TEXCOORD_0: "uv",
  57767. TEXCOORD_1: "uv2",
  57768. COLOR_0: "color",
  57769. WEIGHTS_0: "skinWeight",
  57770. JOINTS_0: "skinIndex"
  57771. }
  57772. , R = {
  57773. scale: "scale",
  57774. translation: "position",
  57775. rotation: "quaternion",
  57776. weights: "morphTargetInfluences"
  57777. }
  57778. , F = {
  57779. CUBICSPLINE: void 0,
  57780. LINEAR: $t,
  57781. STEP: Kt
  57782. }
  57783. , I = "OPAQUE"
  57784. , O = "MASK"
  57785. , z = "BLEND";
  57786. function N(e, t) {
  57787. return "string" != typeof e || "" === e ? "" : (/^https?:\/\//i.test(t) && /^\//.test(e) && (t = t.replace(/(^https?:\/\/[^\/]+).*/i, "$1")),
  57788. /^(https?:)?\/\//i.test(e) || /^data:.*,.*$/i.test(e) || /^blob:.*$/i.test(e) ? e : t + e)
  57789. }
  57790. function U(e, t, n) {
  57791. for (var i in n.extensions)
  57792. void 0 === e[i] && (t.userData.gltfExtensions = t.userData.gltfExtensions || {},
  57793. t.userData.gltfExtensions[i] = n.extensions[i])
  57794. }
  57795. function G(e, t) {
  57796. void 0 !== t.extras && ("object" === X(t.extras) ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras))
  57797. }
  57798. function H(e) {
  57799. for (var t = "", n = Object.keys(e).sort(), i = 0, r = n.length; i < r; i++)
  57800. t += n[i] + ":" + e[n[i]] + ";";
  57801. return t
  57802. }
  57803. function V(e, t) {
  57804. this.json = e || {},
  57805. this.extensions = {},
  57806. this.plugins = {},
  57807. this.options = t || {},
  57808. this.cache = new n,
  57809. this.associations = new Map,
  57810. this.primitiveCache = {},
  57811. this.meshCache = {
  57812. refs: {},
  57813. uses: {}
  57814. },
  57815. this.cameraCache = {
  57816. refs: {},
  57817. uses: {}
  57818. },
  57819. this.lightCache = {
  57820. refs: {},
  57821. uses: {}
  57822. },
  57823. this.nodeNamesUsed = {},
  57824. this.textureLoader = new _c(this.options.manager),
  57825. this.textureLoader.setCrossOrigin(this.options.crossOrigin),
  57826. this.fileLoader = new gc(this.options.manager),
  57827. this.fileLoader.setResponseType("arraybuffer"),
  57828. "use-credentials" === this.options.crossOrigin && this.fileLoader.setWithCredentials(!0)
  57829. }
  57830. function j(n, e, i) {
  57831. var t, r, a = e.attributes, o = [];
  57832. for (t in a) {
  57833. var s = L[t] || t.toLowerCase();
  57834. s in n.attributes || o.push(function(e, t) {
  57835. return i.getDependency("accessor", e).then(function(e) {
  57836. n.setAttribute(t, e)
  57837. })
  57838. }(a[t], s))
  57839. }
  57840. return void 0 === e.indices || n.index || (r = i.getDependency("accessor", e.indices).then(function(e) {
  57841. n.setIndex(e)
  57842. }),
  57843. o.push(r)),
  57844. G(n, e),
  57845. function(e, t, n) {
  57846. var i = t.attributes
  57847. , r = new kn;
  57848. if (void 0 !== i.POSITION) {
  57849. var a = (h = n.json.accessors[i.POSITION]).min
  57850. , o = h.max;
  57851. if (void 0 !== a && void 0 !== o) {
  57852. r.set(new Cn(a[0],a[1],a[2]), new Cn(o[0],o[1],o[2]));
  57853. var s = t.targets;
  57854. if (void 0 !== s) {
  57855. for (var l = new Cn, u = new Cn, c = 0, d = s.length; c < d; c++) {
  57856. var h, p = s[c];
  57857. void 0 !== p.POSITION && (a = (h = n.json.accessors[p.POSITION]).min,
  57858. o = h.max,
  57859. void 0 !== a && void 0 !== o ? (u.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))),
  57860. u.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))),
  57861. u.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))),
  57862. l.max(u)) : console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))
  57863. }
  57864. r.expandByVector(l)
  57865. }
  57866. e.boundingBox = r;
  57867. t = new qn;
  57868. r.getCenter(t.center),
  57869. t.radius = r.min.distanceTo(r.max) / 2,
  57870. e.boundingSphere = t
  57871. } else
  57872. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")
  57873. }
  57874. }(n, e, i),
  57875. Promise.all(o).then(function() {
  57876. return void 0 !== e.targets ? function(n, e, t) {
  57877. for (var i = !1, r = !1, a = 0, o = e.length; a < o; a++)
  57878. if (void 0 !== (c = e[a]).POSITION && (i = !0),
  57879. void 0 !== c.NORMAL && (r = !0),
  57880. i && r)
  57881. break;
  57882. if (!i && !r)
  57883. return Promise.resolve(n);
  57884. for (var s = [], l = [], a = 0, o = e.length; a < o; a++) {
  57885. var u, c = e[a];
  57886. i && (u = void 0 !== c.POSITION ? t.getDependency("accessor", c.POSITION) : n.attributes.position,
  57887. s.push(u)),
  57888. r && (u = void 0 !== c.NORMAL ? t.getDependency("accessor", c.NORMAL) : n.attributes.normal,
  57889. l.push(u))
  57890. }
  57891. return Promise.all([Promise.all(s), Promise.all(l)]).then(function(e) {
  57892. var t = e[0]
  57893. , e = e[1];
  57894. return i && (n.morphAttributes.position = t),
  57895. r && (n.morphAttributes.normal = e),
  57896. n.morphTargetsRelative = !0,
  57897. n
  57898. })
  57899. }(n, e.targets, i) : n
  57900. })
  57901. }
  57902. function W(e, t) {
  57903. var n = e.getIndex();
  57904. if (null === n) {
  57905. var i = []
  57906. , r = e.getAttribute("position");
  57907. if (void 0 === r)
  57908. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),
  57909. e;
  57910. for (var a = 0; a < r.count; a++)
  57911. i.push(a);
  57912. e.setIndex(i),
  57913. n = e.getIndex()
  57914. }
  57915. var o = n.count - 2
  57916. , s = [];
  57917. if (2 === t)
  57918. for (a = 1; a <= o; a++)
  57919. s.push(n.getX(0)),
  57920. s.push(n.getX(a)),
  57921. s.push(n.getX(a + 1));
  57922. else
  57923. for (a = 0; a < o; a++)
  57924. a % 2 == 0 ? (s.push(n.getX(a)),
  57925. s.push(n.getX(a + 1)),
  57926. s.push(n.getX(a + 2))) : (s.push(n.getX(a + 2)),
  57927. s.push(n.getX(a + 1)),
  57928. s.push(n.getX(a)));
  57929. s.length / 3 != o && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  57930. e = e.clone();
  57931. return e.setIndex(s),
  57932. e
  57933. }
  57934. return V.prototype.setExtensions = function(e) {
  57935. this.extensions = e
  57936. }
  57937. ,
  57938. V.prototype.setPlugins = function(e) {
  57939. this.plugins = e
  57940. }
  57941. ,
  57942. V.prototype.parse = function(t, e) {
  57943. var n = this
  57944. , i = this.json
  57945. , r = this.extensions;
  57946. this.cache.removeAll(),
  57947. this._invokeAll(function(e) {
  57948. return e._markDefs && e._markDefs()
  57949. }),
  57950. Promise.all([this.getDependencies("scene"), this.getDependencies("animation"), this.getDependencies("camera")]).then(function(e) {
  57951. e = {
  57952. scene: e[0][i.scene || 0],
  57953. scenes: e[0],
  57954. animations: e[1],
  57955. cameras: e[2],
  57956. asset: i.asset,
  57957. parser: n,
  57958. userData: {}
  57959. };
  57960. U(r, e, i),
  57961. G(e, i),
  57962. t(e)
  57963. }).catch(e)
  57964. }
  57965. ,
  57966. V.prototype._markDefs = function() {
  57967. for (var e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [], i = 0, r = t.length; i < r; i++)
  57968. for (var a = t[i].joints, o = 0, s = a.length; o < s; o++)
  57969. e[a[o]].isBone = !0;
  57970. for (var l = 0, u = e.length; l < u; l++) {
  57971. var c = e[l];
  57972. void 0 !== c.mesh && (this._addNodeRef(this.meshCache, c.mesh),
  57973. void 0 !== c.skin && (n[c.mesh].isSkinnedMesh = !0)),
  57974. void 0 !== c.camera && this._addNodeRef(this.cameraCache, c.camera)
  57975. }
  57976. }
  57977. ,
  57978. V.prototype._addNodeRef = function(e, t) {
  57979. void 0 !== t && (void 0 === e.refs[t] && (e.refs[t] = e.uses[t] = 0),
  57980. e.refs[t]++)
  57981. }
  57982. ,
  57983. V.prototype._getNodeRef = function(e, t, n) {
  57984. if (e.refs[t] <= 1)
  57985. return n;
  57986. n = n.clone();
  57987. return n.name += "_instance_" + e.uses[t]++,
  57988. n
  57989. }
  57990. ,
  57991. V.prototype._invokeOne = function(e) {
  57992. var t = Object.values(this.plugins);
  57993. t.push(this);
  57994. for (var n = 0; n < t.length; n++) {
  57995. var i = e(t[n]);
  57996. if (i)
  57997. return i
  57998. }
  57999. }
  58000. ,
  58001. V.prototype._invokeAll = function(e) {
  58002. var t = Object.values(this.plugins);
  58003. t.unshift(this);
  58004. for (var n = [], i = 0; i < t.length; i++) {
  58005. var r = e(t[i]);
  58006. r && n.push(r)
  58007. }
  58008. return n
  58009. }
  58010. ,
  58011. V.prototype.getDependency = function(e, t) {
  58012. var n = e + ":" + t
  58013. , i = this.cache.get(n);
  58014. if (!i) {
  58015. switch (e) {
  58016. case "scene":
  58017. i = this.loadScene(t);
  58018. break;
  58019. case "node":
  58020. i = this.loadNode(t);
  58021. break;
  58022. case "mesh":
  58023. i = this._invokeOne(function(e) {
  58024. return e.loadMesh && e.loadMesh(t)
  58025. });
  58026. break;
  58027. case "accessor":
  58028. i = this.loadAccessor(t);
  58029. break;
  58030. case "bufferView":
  58031. i = this._invokeOne(function(e) {
  58032. return e.loadBufferView && e.loadBufferView(t)
  58033. });
  58034. break;
  58035. case "buffer":
  58036. i = this.loadBuffer(t);
  58037. break;
  58038. case "material":
  58039. i = this._invokeOne(function(e) {
  58040. return e.loadMaterial && e.loadMaterial(t)
  58041. });
  58042. break;
  58043. case "texture":
  58044. i = this._invokeOne(function(e) {
  58045. return e.loadTexture && e.loadTexture(t)
  58046. });
  58047. break;
  58048. case "skin":
  58049. i = this.loadSkin(t);
  58050. break;
  58051. case "animation":
  58052. i = this.loadAnimation(t);
  58053. break;
  58054. case "camera":
  58055. i = this.loadCamera(t);
  58056. break;
  58057. default:
  58058. throw new Error("Unknown type: " + e)
  58059. }
  58060. this.cache.add(n, i)
  58061. }
  58062. return i
  58063. }
  58064. ,
  58065. V.prototype.getDependencies = function(n) {
  58066. var i, e, t = this.cache.get(n);
  58067. return t || (e = (i = this).json[n + ("mesh" === n ? "es" : "s")] || [],
  58068. t = Promise.all(e.map(function(e, t) {
  58069. return i.getDependency(n, t)
  58070. })),
  58071. this.cache.add(n, t)),
  58072. t
  58073. }
  58074. ,
  58075. V.prototype.loadBuffer = function(e) {
  58076. var n = this.json.buffers[e]
  58077. , i = this.fileLoader;
  58078. if (n.type && "arraybuffer" !== n.type)
  58079. throw new Error("THREE.GLTFLoader: " + n.type + " buffer type is not supported.");
  58080. if (void 0 === n.uri && 0 === e)
  58081. return Promise.resolve(this.extensions[p.KHR_BINARY_GLTF].body);
  58082. var r = this.options;
  58083. return new Promise(function(e, t) {
  58084. i.load(N(n.uri, r.path), e, void 0, function() {
  58085. t(new Error('THREE.GLTFLoader: Failed to load buffer "' + n.uri + '".'))
  58086. })
  58087. }
  58088. )
  58089. }
  58090. ,
  58091. V.prototype.loadBufferView = function(e) {
  58092. var i = this.json.bufferViews[e];
  58093. return this.getDependency("buffer", i.buffer).then(function(e) {
  58094. var t = i.byteLength || 0
  58095. , n = i.byteOffset || 0;
  58096. return e.slice(n, n + t)
  58097. })
  58098. }
  58099. ,
  58100. V.prototype.loadAccessor = function(e) {
  58101. var g = this
  58102. , y = this.json
  58103. , w = this.json.accessors[e];
  58104. if (void 0 === w.bufferView && void 0 === w.sparse)
  58105. return Promise.resolve(null);
  58106. e = [];
  58107. return void 0 !== w.bufferView ? e.push(this.getDependency("bufferView", w.bufferView)) : e.push(null),
  58108. void 0 !== w.sparse && (e.push(this.getDependency("bufferView", w.sparse.indices.bufferView)),
  58109. e.push(this.getDependency("bufferView", w.sparse.values.bufferView))),
  58110. Promise.all(e).then(function(e) {
  58111. var t, n, i, r = e[0], a = B[w.type], o = D[w.componentType], s = o.BYTES_PER_ELEMENT, l = w.byteOffset || 0, u = void 0 !== w.bufferView ? y.bufferViews[w.bufferView].byteStride : void 0, c = !0 === w.normalized, d = u && u !== s * a ? (t = Math.floor(l / u),
  58112. n = "InterleavedBuffer:" + w.bufferView + ":" + w.componentType + ":" + t + ":" + w.count,
  58113. (i = g.cache.get(n)) || (i = new ys(new o(r,t * u,w.count * u / s),u / s),
  58114. g.cache.add(n, i)),
  58115. new xs(i,a,l % u / s,c)) : new nr(null === r ? new o(w.count * a) : new o(r,l,w.count * a),a,c);
  58116. if (void 0 !== w.sparse) {
  58117. var s = D[w.sparse.indices.componentType]
  58118. , l = w.sparse.indices.byteOffset || 0
  58119. , c = w.sparse.values.byteOffset || 0
  58120. , h = new s(e[1],l,w.sparse.count * B.SCALAR)
  58121. , p = new o(e[2],c,w.sparse.count * a);
  58122. null !== r && (d = new nr(d.array.slice(),d.itemSize,d.normalized));
  58123. for (var f = 0, m = h.length; f < m; f++) {
  58124. var v = h[f];
  58125. if (d.setX(v, p[f * a]),
  58126. 2 <= a && d.setY(v, p[f * a + 1]),
  58127. 3 <= a && d.setZ(v, p[f * a + 2]),
  58128. 4 <= a && d.setW(v, p[f * a + 3]),
  58129. 5 <= a)
  58130. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")
  58131. }
  58132. }
  58133. return d
  58134. })
  58135. }
  58136. ,
  58137. V.prototype.loadTexture = function(e) {
  58138. var t = this.json
  58139. , n = this.options
  58140. , i = t.textures[e]
  58141. , r = i.extensions || {}
  58142. , i = r[p.MSFT_TEXTURE_DDS] ? t.images[r[p.MSFT_TEXTURE_DDS].source] : t.images[i.source]
  58143. , a = (a = i.uri ? n.manager.getHandler(i.uri) : a) || (r[p.MSFT_TEXTURE_DDS] ? this.extensions[p.MSFT_TEXTURE_DDS].ddsLoader : this.textureLoader);
  58144. return this.loadTextureImage(e, i, a)
  58145. }
  58146. ,
  58147. V.prototype.loadTextureImage = function(n, i, e) {
  58148. var r = this
  58149. , a = this.json
  58150. , o = (this.options,
  58151. a.textures[n])
  58152. , s = self.URL || self.webkitURL
  58153. , l = i.uri
  58154. , u = !1
  58155. , c = !0;
  58156. return "image/jpeg" === i.mimeType && (c = !1),
  58157. void 0 !== i.bufferView && (l = r.getDependency("bufferView", i.bufferView).then(function(e) {
  58158. var t;
  58159. "image/png" === i.mimeType && (t = new DataView(e,25,1).getUint8(0, !1),
  58160. c = 6 === t || 4 === t || 3 === t),
  58161. u = !0;
  58162. e = new Blob([e],{
  58163. type: i.mimeType
  58164. });
  58165. return l = s.createObjectURL(e)
  58166. })),
  58167. Promise.resolve(l).then(function(n) {
  58168. return new Promise(function(t, e) {
  58169. r.textureLoader.load(n, function(e) {
  58170. e.minFilter = THREE.LinearMipmapLinearFilter,
  58171. t(e)
  58172. })
  58173. }
  58174. )
  58175. }).then(function(e) {
  58176. !0 === u && s.revokeObjectURL(l),
  58177. e.flipY = !1,
  58178. o.name && (e.name = o.name),
  58179. c || (e.format = $e);
  58180. var t = (a.samplers || {})[o.sampler] || {};
  58181. return e.magFilter = h[t.magFilter] || Oe,
  58182. e.minFilter = h[t.minFilter] || Ne,
  58183. e.wrapS = k[t.wrapS] || ke,
  58184. e.wrapT = k[t.wrapT] || ke,
  58185. r.associations.set(e, {
  58186. type: "textures",
  58187. index: n
  58188. }),
  58189. e
  58190. })
  58191. }
  58192. ,
  58193. V.prototype.assignTexture = function(i, r, a) {
  58194. var o = this;
  58195. return this.getDependency("texture", a.index).then(function(e) {
  58196. var t, n;
  58197. void 0 === a.texCoord || 0 == a.texCoord || "aoMap" === r && 1 == a.texCoord || console.warn("THREE.GLTFLoader: Custom UV set " + a.texCoord + " for texture " + r + " not yet supported."),
  58198. !o.extensions[p.KHR_TEXTURE_TRANSFORM] || (t = void 0 !== a.extensions ? a.extensions[p.KHR_TEXTURE_TRANSFORM] : void 0) && (n = o.associations.get(e),
  58199. e = o.extensions[p.KHR_TEXTURE_TRANSFORM].extendTexture(e, t),
  58200. o.associations.set(e, n)),
  58201. i[r] = e
  58202. })
  58203. }
  58204. ,
  58205. V.prototype.assignFinalMaterial = function(e) {
  58206. var t, n, i, r = e.geometry, a = e.material, o = void 0 !== r.attributes.tangent, s = void 0 !== r.attributes.color, l = void 0 === r.attributes.normal, u = !0 === e.isSkinnedMesh, c = 0 < Object.keys(r.morphAttributes).length, d = c && void 0 !== r.morphAttributes.normal;
  58207. e.isPoints ? (n = "PointsMaterial:" + a.uuid,
  58208. (t = this.cache.get(n)) || (t = new hl,
  58209. Ki.prototype.copy.call(t, a),
  58210. t.color.copy(a.color),
  58211. t.map = a.map,
  58212. t.sizeAttenuation = !1,
  58213. this.cache.add(n, t)),
  58214. a = t) : e.isLine && (n = "LineBasicMaterial:" + a.uuid,
  58215. (i = this.cache.get(n)) || (i = new tl,
  58216. Ki.prototype.copy.call(i, a),
  58217. i.color.copy(a.color),
  58218. this.cache.add(n, i)),
  58219. a = i),
  58220. (o || s || l || u || c) && (n = "ClonedMaterial:" + a.uuid + ":",
  58221. a.isGLTFSpecularGlossinessMaterial && (n += "specular-glossiness:"),
  58222. u && (n += "skinning:"),
  58223. o && (n += "vertex-tangents:"),
  58224. s && (n += "vertex-colors:"),
  58225. l && (n += "flat-shading:"),
  58226. c && (n += "morph-targets:"),
  58227. d && (n += "morph-normals:"),
  58228. (i = this.cache.get(n)) || (i = a.clone(),
  58229. u && (i.skinning = !0),
  58230. o && (i.vertexTangents = !0),
  58231. s && (i.vertexColors = !0),
  58232. l && (i.flatShading = !0),
  58233. c && (i.morphTargets = !0),
  58234. d && (i.morphNormals = !0),
  58235. this.cache.add(n, i),
  58236. this.associations.set(i, this.associations.get(a))),
  58237. a = i),
  58238. a.aoMap && void 0 === r.attributes.uv2 && void 0 !== r.attributes.uv && r.setAttribute("uv2", r.attributes.uv),
  58239. a.normalScale && !o && (a.normalScale.y = -a.normalScale.y),
  58240. a.clearcoatNormalScale && !o && (a.clearcoatNormalScale.y = -a.clearcoatNormalScale.y),
  58241. e.material = a
  58242. }
  58243. ,
  58244. V.prototype.getMaterialType = function() {
  58245. return this.unlitMat ? $i : Hu
  58246. }
  58247. ,
  58248. V.prototype.loadMaterial = function(t) {
  58249. var n, e, i = this, r = this.json, a = this.extensions, o = r.materials[t], s = {}, l = o.extensions || {}, u = [];
  58250. l[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS] ? (r = a[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],
  58251. n = r.getMaterialType(),
  58252. u.push(r.extendParams(s, o, i))) : l[p.KHR_MATERIALS_UNLIT] ? (e = a[p.KHR_MATERIALS_UNLIT],
  58253. n = e.getMaterialType(),
  58254. u.push(e.extendParams(s, o, i))) : (c = o.pbrMetallicRoughness || {},
  58255. s.color = new Yi(1,1,1),
  58256. s.opacity = 1,
  58257. Array.isArray(c.baseColorFactor) && (e = c.baseColorFactor,
  58258. s.color.fromArray(e),
  58259. s.opacity = e[3]),
  58260. void 0 !== c.baseColorTexture && u.push(i.assignTexture(s, "map", c.baseColorTexture)),
  58261. s.metalness = void 0 !== c.metallicFactor ? c.metallicFactor : 1,
  58262. s.roughness = void 0 !== c.roughnessFactor ? c.roughnessFactor : 1,
  58263. void 0 !== c.metallicRoughnessTexture && (u.push(i.assignTexture(s, "metalnessMap", c.metallicRoughnessTexture)),
  58264. u.push(i.assignTexture(s, "roughnessMap", c.metallicRoughnessTexture))),
  58265. n = this._invokeOne(function(e) {
  58266. return e.getMaterialType && e.getMaterialType(t)
  58267. }),
  58268. u.push(Promise.all(this._invokeAll(function(e) {
  58269. return e.extendMaterialParams && e.extendMaterialParams(t, s)
  58270. })))),
  58271. !0 === o.doubleSided && (s.side = Y);
  58272. var c = o.alphaMode || I;
  58273. return c === z ? (s.transparent = !0,
  58274. s.depthWrite = !1) : (s.transparent = !1,
  58275. c === O && (s.alphaTest = void 0 !== o.alphaCutoff ? o.alphaCutoff : .5)),
  58276. void 0 !== o.normalTexture && n !== $i && (u.push(i.assignTexture(s, "normalMap", o.normalTexture)),
  58277. s.normalScale = new yn(1,1),
  58278. void 0 !== o.normalTexture.scale && s.normalScale.set(o.normalTexture.scale, o.normalTexture.scale)),
  58279. void 0 !== o.occlusionTexture && n !== $i && (u.push(i.assignTexture(s, "aoMap", o.occlusionTexture)),
  58280. void 0 !== o.occlusionTexture.strength && (s.aoMapIntensity = o.occlusionTexture.strength)),
  58281. void 0 !== o.emissiveFactor && n !== $i && (s.emissive = (new Yi).fromArray(o.emissiveFactor)),
  58282. void 0 !== o.emissiveTexture && n !== $i && u.push(i.assignTexture(s, "emissiveMap", o.emissiveTexture)),
  58283. Promise.all(u).then(function() {
  58284. var e = n === d ? a[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s) : new n(s);
  58285. return o.name && (e.name = o.name),
  58286. e.map && (e.map.encoding = an),
  58287. e.emissiveMap && (e.emissiveMap.encoding = an),
  58288. G(e, o),
  58289. i.associations.set(e, {
  58290. type: "materials",
  58291. index: t
  58292. }),
  58293. o.extensions && U(a, e, o),
  58294. e
  58295. })
  58296. }
  58297. ,
  58298. V.prototype.createUniqueName = function(e) {
  58299. for (var t = eh.sanitizeNodeName(e || ""), n = t, i = 1; this.nodeNamesUsed[n]; ++i)
  58300. n = t + "_" + i;
  58301. return this.nodeNamesUsed[n] = !0,
  58302. n
  58303. }
  58304. ,
  58305. V.prototype.loadGeometries = function(e) {
  58306. var n = this
  58307. , i = this.extensions
  58308. , t = this.primitiveCache;
  58309. for (var r = [], a = 0, o = e.length; a < o; a++) {
  58310. var s = e[a]
  58311. , l = (l = void 0,
  58312. u = (l = (u = s).extensions && u.extensions[p.KHR_DRACO_MESH_COMPRESSION]) ? "draco:" + l.bufferView + ":" + l.indices + ":" + H(l.attributes) : u.indices + ":" + H(u.attributes) + ":" + u.mode)
  58313. , u = t[l];
  58314. u ? r.push(u.promise) : (u = s.extensions && s.extensions[p.KHR_DRACO_MESH_COMPRESSION] ? function(t) {
  58315. return i[p.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t, n).then(function(e) {
  58316. return j(e, t, n)
  58317. })
  58318. }(s) : j(new Mr, s, n),
  58319. t[l] = {
  58320. primitive: s,
  58321. promise: u
  58322. },
  58323. r.push(u))
  58324. }
  58325. return Promise.all(r)
  58326. }
  58327. ,
  58328. V.prototype.loadMesh = function(d) {
  58329. for (var h = this, e = this.json, p = this.extensions, f = e.meshes[d], m = f.primitives, t = [], n = 0, i = m.length; n < i; n++) {
  58330. var r = void 0 === m[n].material ? (void 0 === (r = this.cache).DefaultMaterial && (r.DefaultMaterial = new Hu({
  58331. color: 16777215,
  58332. emissive: 0,
  58333. metalness: 1,
  58334. roughness: 1,
  58335. transparent: !1,
  58336. depthTest: !0,
  58337. side: q
  58338. })),
  58339. r.DefaultMaterial) : this.getDependency("material", m[n].material);
  58340. t.push(r)
  58341. }
  58342. return t.push(h.loadGeometries(m)),
  58343. Promise.all(t).then(function(e) {
  58344. for (var t = e.slice(0, e.length - 1), n = e[e.length - 1], i = [], r = 0, a = n.length; r < a; r++) {
  58345. var o, s = n[r], l = m[r], u = t[r];
  58346. if (l.mode === S || l.mode === C || l.mode === P || void 0 === l.mode)
  58347. !0 !== (o = new (!0 === f.isSkinnedMesh ? Ws : Hr)(s,u)).isSkinnedMesh || o.geometry.attributes.skinWeight.normalized || o.normalizeSkinWeights(),
  58348. l.mode === C ? o.geometry = W(o.geometry, 1) : l.mode === P && (o.geometry = W(o.geometry, 2));
  58349. else if (l.mode === _)
  58350. o = new cl(s,u);
  58351. else if (l.mode === A)
  58352. o = new sl(s,u);
  58353. else if (l.mode === M)
  58354. o = new dl(s,u);
  58355. else {
  58356. if (l.mode !== E)
  58357. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + l.mode);
  58358. o = new gl(s,u)
  58359. }
  58360. 0 < Object.keys(o.geometry.morphAttributes).length && function(e, t) {
  58361. if (e.updateMorphTargets(),
  58362. void 0 !== t.weights)
  58363. for (var n = 0, i = t.weights.length; n < i; n++)
  58364. e.morphTargetInfluences[n] = t.weights[n];
  58365. if (t.extras && Array.isArray(t.extras.targetNames)) {
  58366. var r = t.extras.targetNames;
  58367. if (e.morphTargetInfluences.length === r.length) {
  58368. e.morphTargetDictionary = {};
  58369. for (n = 0,
  58370. i = r.length; n < i; n++)
  58371. e.morphTargetDictionary[r[n]] = n
  58372. } else
  58373. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")
  58374. }
  58375. }(o, f),
  58376. o.name = h.createUniqueName(f.name || "mesh_" + d),
  58377. G(o, f),
  58378. l.extensions && U(p, o, l),
  58379. h.assignFinalMaterial(o),
  58380. i.push(o)
  58381. }
  58382. if (1 === i.length)
  58383. return i[0];
  58384. for (var c = new us, r = 0, a = i.length; r < a; r++)
  58385. c.add(i[r]);
  58386. return c
  58387. })
  58388. }
  58389. ,
  58390. V.prototype.loadCamera = function(e) {
  58391. var t, n = this.json.cameras[e], e = n[n.type];
  58392. if (e)
  58393. return "perspective" === n.type ? t = new $r(gn.radToDeg(e.yfov),e.aspectRatio || 1,e.znear || 1,e.zfar || 2e6) : "orthographic" === n.type && (t = new ed(-e.xmag,e.xmag,e.ymag,-e.ymag,e.znear,e.zfar)),
  58394. n.name && (t.name = this.createUniqueName(n.name)),
  58395. G(t, n),
  58396. Promise.resolve(t);
  58397. console.warn("THREE.GLTFLoader: Missing camera parameters.")
  58398. }
  58399. ,
  58400. V.prototype.loadSkin = function(e) {
  58401. var e = this.json.skins[e]
  58402. , t = {
  58403. joints: e.joints
  58404. };
  58405. return void 0 === e.inverseBindMatrices ? Promise.resolve(t) : this.getDependency("accessor", e.inverseBindMatrices).then(function(e) {
  58406. return t.inverseBindMatrices = e,
  58407. t
  58408. })
  58409. }
  58410. ,
  58411. V.prototype.loadAnimation = function(M) {
  58412. for (var A = this.json.animations[M], e = [], t = [], n = [], i = [], r = [], a = 0, o = A.channels.length; a < o; a++) {
  58413. var s = A.channels[a]
  58414. , l = A.samplers[s.sampler]
  58415. , u = s.target
  58416. , c = void 0 !== u.node ? u.node : u.id
  58417. , d = void 0 !== A.parameters ? A.parameters[l.input] : l.input
  58418. , s = void 0 !== A.parameters ? A.parameters[l.output] : l.output;
  58419. e.push(this.getDependency("node", c)),
  58420. t.push(this.getDependency("accessor", d)),
  58421. n.push(this.getDependency("accessor", s)),
  58422. i.push(l),
  58423. r.push(u)
  58424. }
  58425. return Promise.all([Promise.all(e), Promise.all(t), Promise.all(n), Promise.all(i), Promise.all(r)]).then(function(e) {
  58426. for (var t = e[0], n = e[1], i = e[2], r = e[3], a = e[4], o = [], s = 0, l = t.length; s < l; s++) {
  58427. var u, c = t[s], d = n[s], h = i[s], p = r[s], f = a[s];
  58428. if (void 0 !== c) {
  58429. switch (c.updateMatrix(),
  58430. c.matrixAutoUpdate = !0,
  58431. R[f.path]) {
  58432. case R.weights:
  58433. u = ac;
  58434. break;
  58435. case R.rotation:
  58436. u = sc;
  58437. break;
  58438. default:
  58439. u = uc
  58440. }
  58441. var m = c.name || c.uuid
  58442. , v = void 0 !== p.interpolation ? F[p.interpolation] : $t
  58443. , g = [];
  58444. R[f.path] === R.weights ? c.traverse(function(e) {
  58445. !0 === e.isMesh && e.morphTargetInfluences && g.push(e.name || e.uuid)
  58446. }) : g.push(m);
  58447. var y, w = h.array;
  58448. if (h.normalized) {
  58449. if (w.constructor === Int8Array)
  58450. y = 1 / 127;
  58451. else if (w.constructor === Uint8Array)
  58452. y = 1 / 255;
  58453. else if (w.constructor == Int16Array)
  58454. y = 1 / 32767;
  58455. else {
  58456. if (w.constructor !== Uint16Array)
  58457. throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");
  58458. y = 1 / 65535
  58459. }
  58460. for (var b = new Float32Array(w.length), x = 0, E = w.length; x < E; x++)
  58461. b[x] = w[x] * y;
  58462. w = b
  58463. }
  58464. for (x = 0,
  58465. E = g.length; x < E; x++) {
  58466. var _ = new u(g[x] + "." + R[f.path],d.array,w,v);
  58467. "CUBICSPLINE" === p.interpolation && (_.createInterpolant = function(e) {
  58468. return new T(this.times,this.values,this.getValueSize() / 3,e)
  58469. }
  58470. ,
  58471. _.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0),
  58472. o.push(_)
  58473. }
  58474. }
  58475. }
  58476. return new cc(A.name || "animation_" + M,void 0,o)
  58477. })
  58478. }
  58479. ,
  58480. V.prototype.loadNode = function(a) {
  58481. var t, e = this.json, o = this.extensions, s = this, l = e.nodes[a], u = l.name ? s.createUniqueName(l.name) : "";
  58482. return t = [],
  58483. void 0 !== l.mesh && t.push(s.getDependency("mesh", l.mesh).then(function(e) {
  58484. e = s._getNodeRef(s.meshCache, l.mesh, e);
  58485. return void 0 !== l.weights && e.traverse(function(e) {
  58486. if (e.isMesh)
  58487. for (var t = 0, n = l.weights.length; t < n; t++)
  58488. e.morphTargetInfluences[t] = l.weights[t]
  58489. }),
  58490. e
  58491. })),
  58492. void 0 !== l.camera && t.push(s.getDependency("camera", l.camera).then(function(e) {
  58493. return s._getNodeRef(s.cameraCache, l.camera, e)
  58494. })),
  58495. s._invokeAll(function(e) {
  58496. return e.createNodeAttachment && e.createNodeAttachment(a)
  58497. }).forEach(function(e) {
  58498. t.push(e)
  58499. }),
  58500. Promise.all(t).then(function(e) {
  58501. var t, n = !0 === l.isBone ? new Xs : 1 < e.length ? new us : 1 === e.length ? e[0] : new Si;
  58502. if (n !== e[0])
  58503. for (var i = 0, r = e.length; i < r; i++)
  58504. n.add(e[i]);
  58505. return l.name && (n.userData.name = l.name,
  58506. n.name = u),
  58507. G(n, l),
  58508. l.extensions && U(o, n, l),
  58509. void 0 !== l.matrix ? ((t = new ni).fromArray(l.matrix),
  58510. n.applyMatrix4(t)) : (void 0 !== l.translation && n.position.fromArray(l.translation),
  58511. void 0 !== l.rotation && n.quaternion.fromArray(l.rotation),
  58512. void 0 !== l.scale && n.scale.fromArray(l.scale)),
  58513. s.associations.set(n, {
  58514. type: "nodes",
  58515. index: a
  58516. }),
  58517. n
  58518. })
  58519. }
  58520. ,
  58521. V.prototype.loadScene = function(e) {
  58522. var t = this.json
  58523. , n = this.extensions
  58524. , e = this.json.scenes[e]
  58525. , i = new us;
  58526. e.name && (i.name = this.createUniqueName(e.name)),
  58527. G(i, e),
  58528. e.extensions && U(n, i, e);
  58529. for (var r = e.nodes || [], a = [], o = 0, s = r.length; o < s; o++)
  58530. a.push(function o(e, s, l, u) {
  58531. var c = l.nodes[e];
  58532. return u.getDependency("node", e).then(function(e) {
  58533. return void 0 === c.skin ? e : u.getDependency("skin", c.skin).then(function(e) {
  58534. for (var t = [], n = 0, i = (s = e).joints.length; n < i; n++)
  58535. t.push(u.getDependency("node", s.joints[n]));
  58536. return Promise.all(t)
  58537. }).then(function(o) {
  58538. return e.traverse(function(e) {
  58539. if (e.isMesh) {
  58540. for (var t = [], n = [], i = 0, r = o.length; i < r; i++) {
  58541. var a = o[i];
  58542. a ? (t.push(a),
  58543. a = new ni,
  58544. void 0 !== s.inverseBindMatrices && a.fromArray(s.inverseBindMatrices.array, 16 * i),
  58545. n.push(a)) : console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', s.joints[i])
  58546. }
  58547. e.bind(new Ys(t,n), e.matrixWorld)
  58548. }
  58549. }),
  58550. e
  58551. });
  58552. var s
  58553. }).then(function(e) {
  58554. s.add(e);
  58555. var t = [];
  58556. if (c.children)
  58557. for (var n = c.children, i = 0, r = n.length; i < r; i++) {
  58558. var a = n[i];
  58559. t.push(o(a, e, l, u))
  58560. }
  58561. return Promise.all(t)
  58562. })
  58563. }(r[o], i, t, this));
  58564. return Promise.all(a).then(function() {
  58565. return i
  58566. })
  58567. }
  58568. ,
  58569. e
  58570. }()
  58571. , Kw = {
  58572. Handedness: Object.freeze({
  58573. NONE: "none",
  58574. LEFT: "left",
  58575. RIGHT: "right"
  58576. }),
  58577. ComponentState: Object.freeze({
  58578. DEFAULT: "default",
  58579. TOUCHED: "touched",
  58580. PRESSED: "pressed"
  58581. }),
  58582. ComponentProperty: Object.freeze({
  58583. BUTTON: "button",
  58584. X_AXIS: "xAxis",
  58585. Y_AXIS: "yAxis",
  58586. STATE: "state"
  58587. }),
  58588. ComponentType: Object.freeze({
  58589. TRIGGER: "trigger",
  58590. SQUEEZE: "squeeze",
  58591. TOUCHPAD: "touchpad",
  58592. THUMBSTICK: "thumbstick",
  58593. BUTTON: "button"
  58594. }),
  58595. ButtonTouchThreshold: .05,
  58596. AxisTouchThreshold: .1,
  58597. VisualResponseProperty: Object.freeze({
  58598. TRANSFORM: "transform",
  58599. VISIBILITY: "visibility"
  58600. })
  58601. };
  58602. function $w() {
  58603. return e1.apply(this, arguments)
  58604. }
  58605. function e1() {
  58606. return (e1 = r(regeneratorRuntime.mark(function e(t) {
  58607. var n;
  58608. return regeneratorRuntime.wrap(function(e) {
  58609. for (; ; )
  58610. switch (e.prev = e.next) {
  58611. case 0:
  58612. return e.next = 2,
  58613. fetch(t);
  58614. case 2:
  58615. if ((n = e.sent).ok) {
  58616. e.next = 7;
  58617. break
  58618. }
  58619. throw new Error(n.statusText);
  58620. case 7:
  58621. return e.abrupt("return", n.json());
  58622. case 8:
  58623. case "end":
  58624. return e.stop()
  58625. }
  58626. }, e)
  58627. }))).apply(this, arguments)
  58628. }
  58629. function t1() {
  58630. return (t1 = r(regeneratorRuntime.mark(function e(t) {
  58631. var n;
  58632. return regeneratorRuntime.wrap(function(e) {
  58633. for (; ; )
  58634. switch (e.prev = e.next) {
  58635. case 0:
  58636. if (t) {
  58637. e.next = 2;
  58638. break
  58639. }
  58640. throw new Error("No basePath supplied");
  58641. case 2:
  58642. return e.next = 5,
  58643. $w("".concat(t, "/").concat("profilesList.json"));
  58644. case 5:
  58645. return n = e.sent,
  58646. e.abrupt("return", n);
  58647. case 7:
  58648. case "end":
  58649. return e.stop()
  58650. }
  58651. }, e)
  58652. }))).apply(this, arguments)
  58653. }
  58654. function n1() {
  58655. return (n1 = r(regeneratorRuntime.mark(function e(t, n) {
  58656. var i, r, a, o, s, l, u, c, d = arguments;
  58657. return regeneratorRuntime.wrap(function(e) {
  58658. for (; ; )
  58659. switch (e.prev = e.next) {
  58660. case 0:
  58661. if (i = 2 < d.length && void 0 !== d[2] ? d[2] : null,
  58662. r = !(3 < d.length && void 0 !== d[3]) || d[3],
  58663. t) {
  58664. e.next = 4;
  58665. break
  58666. }
  58667. throw new Error("No xrInputSource supplied");
  58668. case 4:
  58669. if (n) {
  58670. e.next = 6;
  58671. break
  58672. }
  58673. throw new Error("No basePath supplied");
  58674. case 6:
  58675. return e.next = 8,
  58676. function() {
  58677. return t1.apply(this, arguments)
  58678. }(n);
  58679. case 8:
  58680. if (a = e.sent,
  58681. t.profiles.some(function(e) {
  58682. var t = a[e];
  58683. return !!(o = t ? {
  58684. profileId: e,
  58685. profilePath: "".concat(n, "/").concat(t.path),
  58686. deprecated: !!t.deprecated
  58687. } : o)
  58688. }),
  58689. o) {
  58690. e.next = 17;
  58691. break
  58692. }
  58693. if (i) {
  58694. e.next = 13;
  58695. break
  58696. }
  58697. throw new Error("No matching profile name found");
  58698. case 13:
  58699. if (s = a[i]) {
  58700. e.next = 16;
  58701. break
  58702. }
  58703. throw new Error('No matching profile name found and default profile "'.concat(i, '" missing.'));
  58704. case 16:
  58705. o = {
  58706. profileId: i,
  58707. profilePath: "".concat(n, "/").concat(s.path),
  58708. deprecated: !!s.deprecated
  58709. };
  58710. case 17:
  58711. return e.next = 19,
  58712. $w(o.profilePath);
  58713. case 19:
  58714. if (l = e.sent,
  58715. !r) {
  58716. e.next = 25;
  58717. break
  58718. }
  58719. if (c = "any" === t.handedness ? l.layouts[Object.keys(l.layouts)[0]] : l.layouts[t.handedness]) {
  58720. e.next = 24;
  58721. break
  58722. }
  58723. throw new Error("No matching handedness, ".concat(t.handedness, ", in profile ").concat(o.profileId));
  58724. case 24:
  58725. c.assetPath && (u = o.profilePath.replace("profile.json", c.assetPath));
  58726. case 25:
  58727. return e.abrupt("return", {
  58728. profile: l,
  58729. assetPath: u
  58730. });
  58731. case 26:
  58732. case "end":
  58733. return e.stop()
  58734. }
  58735. }, e)
  58736. }))).apply(this, arguments)
  58737. }
  58738. var i1 = {
  58739. xAxis: 0,
  58740. yAxis: 0,
  58741. button: 0,
  58742. state: Kw.ComponentState.DEFAULT
  58743. };
  58744. var r1 = function() {
  58745. function t(e) {
  58746. O(this, t),
  58747. this.componentProperty = e.componentProperty,
  58748. this.states = e.states,
  58749. this.valueNodeName = e.valueNodeName,
  58750. this.valueNodeProperty = e.valueNodeProperty,
  58751. this.valueNodeProperty === Kw.VisualResponseProperty.TRANSFORM && (this.minNodeName = e.minNodeName,
  58752. this.maxNodeName = e.maxNodeName),
  58753. this.value = 0,
  58754. this.updateFromComponent(i1)
  58755. }
  58756. return h(t, [{
  58757. key: "updateFromComponent",
  58758. value: function(e) {
  58759. var t = e.xAxis
  58760. , n = e.yAxis
  58761. , i = e.button
  58762. , r = e.state
  58763. , n = function(e, t) {
  58764. var n = 0 < arguments.length && void 0 !== e ? e : 0
  58765. , i = 1 < arguments.length && void 0 !== t ? t : 0
  58766. , e = n
  58767. , t = i;
  58768. return 1 < Math.sqrt(n * n + i * i) && (n = Math.atan2(i, n),
  58769. e = Math.cos(n),
  58770. t = Math.sin(n)),
  58771. {
  58772. normalizedXAxis: .5 * e + .5,
  58773. normalizedYAxis: .5 * t + .5
  58774. }
  58775. }(t, n)
  58776. , a = n.normalizedXAxis
  58777. , o = n.normalizedYAxis;
  58778. switch (this.componentProperty) {
  58779. case Kw.ComponentProperty.X_AXIS:
  58780. this.value = this.states.includes(r) ? a : .5;
  58781. break;
  58782. case Kw.ComponentProperty.Y_AXIS:
  58783. this.value = this.states.includes(r) ? o : .5;
  58784. break;
  58785. case Kw.ComponentProperty.BUTTON:
  58786. this.value = this.states.includes(r) ? i : 0;
  58787. break;
  58788. case Kw.ComponentProperty.STATE:
  58789. this.valueNodeProperty === Kw.VisualResponseProperty.VISIBILITY ? this.value = this.states.includes(r) : this.value = this.states.includes(r) ? 1 : 0;
  58790. break;
  58791. default:
  58792. throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))
  58793. }
  58794. }
  58795. }]),
  58796. t
  58797. }()
  58798. , a1 = function() {
  58799. function t(e, n) {
  58800. var i = this;
  58801. if (O(this, t),
  58802. !(e && n && n.visualResponses && n.gamepadIndices && 0 !== Object.keys(n.gamepadIndices).length))
  58803. throw new Error("Invalid arguments supplied");
  58804. this.id = e,
  58805. this.type = n.type,
  58806. this.rootNodeName = n.rootNodeName,
  58807. this.touchPointNodeName = n.touchPointNodeName,
  58808. this.visualResponses = {},
  58809. Object.keys(n.visualResponses).forEach(function(e) {
  58810. var t = new r1(n.visualResponses[e]);
  58811. i.visualResponses[e] = t
  58812. }),
  58813. this.gamepadIndices = Object.assign({}, n.gamepadIndices),
  58814. this.values = {
  58815. state: Kw.ComponentState.DEFAULT,
  58816. button: void 0 !== this.gamepadIndices.button ? 0 : void 0,
  58817. xAxis: void 0 !== this.gamepadIndices.xAxis ? 0 : void 0,
  58818. yAxis: void 0 !== this.gamepadIndices.yAxis ? 0 : void 0
  58819. }
  58820. }
  58821. return h(t, [{
  58822. key: "data",
  58823. get: function() {
  58824. return function(t) {
  58825. for (var e = 1; e < arguments.length; e++) {
  58826. var n = null != arguments[e] ? arguments[e] : {};
  58827. e % 2 ? i(Object(n), !0).forEach(function(e) {
  58828. H(t, e, n[e])
  58829. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : i(Object(n)).forEach(function(e) {
  58830. Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
  58831. })
  58832. }
  58833. return t
  58834. }({
  58835. id: this.id
  58836. }, this.values)
  58837. }
  58838. }, {
  58839. key: "updateFromGamepad",
  58840. value: function(e) {
  58841. var t, n = this;
  58842. this.values.state = Kw.ComponentState.DEFAULT,
  58843. void 0 !== this.gamepadIndices.button && e.buttons.length > this.gamepadIndices.button && (t = e.buttons[this.gamepadIndices.button],
  58844. this.values.button = t.value,
  58845. this.values.button = this.values.button < 0 ? 0 : this.values.button,
  58846. this.values.button = 1 < this.values.button ? 1 : this.values.button,
  58847. t.pressed || 1 === this.values.button ? this.values.state = Kw.ComponentState.PRESSED : (t.touched || this.values.button > Kw.ButtonTouchThreshold) && (this.values.state = Kw.ComponentState.TOUCHED)),
  58848. void 0 !== this.gamepadIndices.xAxis && e.axes.length > this.gamepadIndices.xAxis && (this.values.xAxis = e.axes[this.gamepadIndices.xAxis],
  58849. this.values.xAxis = this.values.xAxis < -1 ? -1 : this.values.xAxis,
  58850. this.values.xAxis = 1 < this.values.xAxis ? 1 : this.values.xAxis,
  58851. this.values.state === Kw.ComponentState.DEFAULT && Math.abs(this.values.xAxis) > Kw.AxisTouchThreshold && (this.values.state = Kw.ComponentState.TOUCHED)),
  58852. void 0 !== this.gamepadIndices.yAxis && e.axes.length > this.gamepadIndices.yAxis && (this.values.yAxis = e.axes[this.gamepadIndices.yAxis],
  58853. this.values.yAxis = this.values.yAxis < -1 ? -1 : this.values.yAxis,
  58854. this.values.yAxis = 1 < this.values.yAxis ? 1 : this.values.yAxis,
  58855. this.values.state === Kw.ComponentState.DEFAULT && Math.abs(this.values.yAxis) > Kw.AxisTouchThreshold && (this.values.state = Kw.ComponentState.TOUCHED)),
  58856. Object.values(this.visualResponses).forEach(function(e) {
  58857. e.updateFromComponent(n.values)
  58858. })
  58859. }
  58860. }]),
  58861. t
  58862. }()
  58863. , o1 = function() {
  58864. function r(e, t, n) {
  58865. var i = this;
  58866. if (O(this, r),
  58867. !e)
  58868. throw new Error("No xrInputSource supplied");
  58869. if (!t)
  58870. throw new Error("No profile supplied");
  58871. this.xrInputSource = e,
  58872. this.assetUrl = n,
  58873. this.id = t.profileId,
  58874. this.layoutDescription = t.layouts[e.handedness],
  58875. this.components = {},
  58876. Object.keys(this.layoutDescription.components).forEach(function(e) {
  58877. var t = i.layoutDescription.components[e];
  58878. i.components[e] = new a1(e,t)
  58879. }),
  58880. this.updateFromGamepad()
  58881. }
  58882. return h(r, [{
  58883. key: "gripSpace",
  58884. get: function() {
  58885. return this.xrInputSource.gripSpace
  58886. }
  58887. }, {
  58888. key: "targetRaySpace",
  58889. get: function() {
  58890. return this.xrInputSource.targetRaySpace
  58891. }
  58892. }, {
  58893. key: "data",
  58894. get: function() {
  58895. var t = [];
  58896. return Object.values(this.components).forEach(function(e) {
  58897. t.push(e.data)
  58898. }),
  58899. t
  58900. }
  58901. }, {
  58902. key: "updateFromGamepad",
  58903. value: function() {
  58904. var t = this;
  58905. Object.values(this.components).forEach(function(e) {
  58906. e.updateFromGamepad(t.xrInputSource.gamepad)
  58907. })
  58908. }
  58909. }]),
  58910. r
  58911. }();
  58912. function s1() {
  58913. Si.call(this),
  58914. this.motionController = null,
  58915. this.envMap = null
  58916. }
  58917. function l1(t, e) {
  58918. var n, r;
  58919. n = t.motionController,
  58920. r = e,
  58921. Object.values(n.components).forEach(function(e) {
  58922. var t = e.type
  58923. , n = e.touchPointNodeName
  58924. , i = e.visualResponses;
  58925. t === Kw.ComponentType.TOUCHPAD && (e.touchPointNode = r.getObjectByName(n),
  58926. e.touchPointNode ? (n = new Hr(new Tu(.001),new $i({
  58927. color: 255
  58928. })),
  58929. e.touchPointNode.add(n)) : console.warn("Could not find touch dot, ".concat(e.touchPointNodeName, ", in touchpad component ").concat(e.id))),
  58930. Object.values(i).forEach(function(e) {
  58931. var t = e.valueNodeName
  58932. , n = e.minNodeName
  58933. , i = e.maxNodeName;
  58934. if (e.valueNodeProperty === Kw.VisualResponseProperty.TRANSFORM) {
  58935. if (e.minNode = r.getObjectByName(n),
  58936. e.maxNode = r.getObjectByName(i),
  58937. !e.minNode)
  58938. return void console.warn("Could not find ".concat(n, " in the model"));
  58939. if (!e.maxNode)
  58940. return void console.warn("Could not find ".concat(i, " in the model"))
  58941. }
  58942. e.valueNode = r.getObjectByName(t),
  58943. e.valueNode || console.warn("Could not find ".concat(t, " in the model"))
  58944. })
  58945. }),
  58946. t.envMap && e.traverse(function(e) {
  58947. e.isMesh && (e.material.envMap = t.envMap,
  58948. e.material.needsUpdate = !0)
  58949. }),
  58950. t.add(e)
  58951. }
  58952. s1.prototype = Object.assign(Object.create(Si.prototype), {
  58953. constructor: s1,
  58954. setEnvironmentMap: function(e) {
  58955. var t = this;
  58956. return this.envMap == e || (this.envMap = e,
  58957. this.traverse(function(e) {
  58958. e.isMesh && (e.material.envMap = t.envMap,
  58959. e.material.needsUpdate = !0)
  58960. })),
  58961. this
  58962. },
  58963. updateMatrixWorld: function(e) {
  58964. Si.prototype.updateMatrixWorld.call(this, e),
  58965. this.motionController && (this.motionController.updateFromGamepad(),
  58966. Object.values(this.motionController.components).forEach(function(e) {
  58967. Object.values(e.visualResponses).forEach(function(e) {
  58968. var t = e.valueNode
  58969. , n = e.minNode
  58970. , i = e.maxNode
  58971. , r = e.value
  58972. , e = e.valueNodeProperty;
  58973. t && (e === Kw.VisualResponseProperty.VISIBILITY ? t.visible = r : e === Kw.VisualResponseProperty.TRANSFORM && (Sn.slerp(n.quaternion, i.quaternion, t.quaternion, r),
  58974. t.position.lerpVectors(n.position, i.position, r)))
  58975. })
  58976. }))
  58977. }
  58978. });
  58979. var u1 = (c1.prototype = {
  58980. constructor: c1,
  58981. createControllerModel: function(e) {
  58982. var i = this
  58983. , r = new s1
  58984. , a = null;
  58985. return e.addEventListener("connected", function(e) {
  58986. var n = e.data;
  58987. "tracked-pointer" === n.targetRayMode && n.gamepad && !function() {
  58988. return n1.apply(this, arguments)
  58989. }(n, i.path, "generic-trigger").then(function(e) {
  58990. var t = e.profile
  58991. , e = e.assetPath;
  58992. r.motionController = new o1(n,t,e);
  58993. e = i._assetCache[r.motionController.assetUrl];
  58994. if (e)
  58995. a = e.scene.clone(),
  58996. l1(r, a);
  58997. else {
  58998. if (!i.gltfLoader)
  58999. throw new Error("GLTFLoader not set.");
  59000. i.gltfLoader.setPath(""),
  59001. i.gltfLoader.load(r.motionController.assetUrl, function(e) {
  59002. i._assetCache[r.motionController.assetUrl] = e,
  59003. a = e.scene.clone(),
  59004. l1(r, a)
  59005. }, null, function() {
  59006. throw new Error("Asset ".concat(r.motionController.assetUrl, " missing or malformed."))
  59007. })
  59008. }
  59009. }).catch(function(e) {
  59010. console.warn(e)
  59011. })
  59012. }),
  59013. e.addEventListener("disconnected", function() {
  59014. r.motionController = null,
  59015. r.remove(a),
  59016. a = null
  59017. }),
  59018. r
  59019. }
  59020. },
  59021. c1);
  59022. function c1() {
  59023. this.gltfLoader = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null,
  59024. this.path = "https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",
  59025. this._assetCache = {},
  59026. this.gltfLoader || (this.gltfLoader = new Qw)
  59027. }
  59028. var d1 = new $r;
  59029. function h1(e, t) {
  59030. t = t.clone();
  59031. t.updateMatrix(),
  59032. t.updateMatrixWorld();
  59033. e = e.clone().applyMatrix4(t.matrix);
  59034. return e.z -= .8 * t.scale.x,
  59035. e
  59036. }
  59037. function p1(e, t) {
  59038. if (!t || !t.inputSource || !t.inputSource.gamepad)
  59039. return null;
  59040. var n = t.inputSource.gamepad.axes
  59041. , i = 0;
  59042. 2 === n.length ? i = n[1] : 4 === n.length && (i = n[3]);
  59043. var r, i = Math.sign(i) * Math.pow(2 * i, 2), a = 0, o = ue(viewer.scene.pointclouds);
  59044. try {
  59045. for (o.s(); !(r = o.n()).done; )
  59046. var s = r.value
  59047. , l = s.boundingBox.min.distanceTo(s.boundingBox.max)
  59048. , a = Math.max(a, l)
  59049. } catch (e) {
  59050. o.e(e)
  59051. } finally {
  59052. o.f()
  59053. }
  59054. var u = Math.pow(a, .5) / 2
  59055. , c = e.node.scale.x
  59056. , n = viewer.getMoveSpeed()
  59057. , i = u * i * Math.pow(n, .5) / c
  59058. , n = (new Sn).setFromEuler(t.rotation)
  59059. , c = new Cn(0,0,-1);
  59060. c.applyQuaternion(n);
  59061. c = c.clone().multiplyScalar(i),
  59062. i = e.toScene(t.position);
  59063. return c = e.toScene(t.position.clone().add(c)).clone().sub(i)
  59064. }
  59065. var f1, m1 = function() {
  59066. function t(e) {
  59067. O(this, t),
  59068. this.moveFactor = 1,
  59069. this.dbgLabel = null
  59070. }
  59071. return h(t, [{
  59072. key: "start",
  59073. value: function(e) {
  59074. this.dbgLabel
  59075. }
  59076. }, {
  59077. key: "end",
  59078. value: function() {}
  59079. }, {
  59080. key: "update",
  59081. value: function(e, t) {
  59082. var n = e.cPrimary
  59083. , i = e.cSecondary
  59084. , r = p1(e, n)
  59085. , a = p1(e, i)
  59086. , r = r || new Cn
  59087. , a = a || new Cn
  59088. , i = r.clone().add(a);
  59089. i.multiplyScalar(-t * this.moveFactor),
  59090. e.node.position.add(i);
  59091. r = e.node.scale.x,
  59092. a = e.viewer.renderer.xr.getCamera(d1),
  59093. t = a.getWorldPosition(new Cn),
  59094. i = a.getWorldDirection(new Cn),
  59095. t.clone().add(i.multiplyScalar(r)),
  59096. a = h1(t, e.node),
  59097. i = h1(t.clone().add(i), e.node).sub(a);
  59098. i.normalize().multiplyScalar(r);
  59099. i = a.clone().add(i);
  59100. e.viewer.scene.view.setView(a, i),
  59101. Potree.debug.message && (this.dbgLabel.visible = !0,
  59102. this.dbgLabel.setText(Potree.debug.message),
  59103. this.dbgLabel.scale.set(.1, .1, .1),
  59104. this.dbgLabel.position.copy(n.position))
  59105. }
  59106. }]),
  59107. t
  59108. }(), v1 = function() {
  59109. function e() {
  59110. O(this, e),
  59111. this.controller = null,
  59112. this.startPos = null,
  59113. this.debugLine = null
  59114. }
  59115. return h(e, [{
  59116. key: "start",
  59117. value: function(e) {
  59118. this.controller = e.triggered.values().next().value,
  59119. this.startPos = e.node.position.clone()
  59120. }
  59121. }, {
  59122. key: "end",
  59123. value: function(e) {}
  59124. }, {
  59125. key: "update",
  59126. value: function(e, t) {
  59127. var n = this.controller.start.position
  59128. , i = this.controller.position
  59129. , n = e.toScene(n)
  59130. , n = (i = e.toScene(i)).clone().sub(n);
  59131. n.set(-n.x, -n.y, -n.z);
  59132. n = (new Cn).addVectors(this.startPos, n);
  59133. e.node.position.copy(n)
  59134. }
  59135. }]),
  59136. e
  59137. }(), g1 = function() {
  59138. function e() {
  59139. O(this, e),
  59140. this.line = null,
  59141. this.startState = null
  59142. }
  59143. return h(e, [{
  59144. key: "start",
  59145. value: function(e) {
  59146. this.line || (this.line = Potree.Utils.debugLine(e.viewer.sceneVR, new Cn(0,0,0), new Cn(0,0,0), 16776960),
  59147. this.dbgLabel = new Potree.TextSprite("abc"),
  59148. this.dbgLabel.scale.set(.1, .1, .1),
  59149. e.viewer.sceneVR.add(this.dbgLabel)),
  59150. this.line.node.visible = !0,
  59151. this.startState = e.node.clone()
  59152. }
  59153. }, {
  59154. key: "end",
  59155. value: function(e) {
  59156. this.line.node.visible = !1,
  59157. this.dbgLabel.visible = !1
  59158. }
  59159. }, {
  59160. key: "update",
  59161. value: function(e, t) {
  59162. var n = e.cPrimary.start.position.clone()
  59163. , i = e.cSecondary.start.position.clone()
  59164. , r = n.clone().add(i).multiplyScalar(.5)
  59165. , a = i.clone().sub(n)
  59166. , o = e.cPrimary.position.clone()
  59167. , s = e.cSecondary.position.clone()
  59168. , l = o.clone().add(s).multiplyScalar(.5)
  59169. , u = s.clone().sub(o)
  59170. , c = a.length()
  59171. , i = u.length()
  59172. , n = new yn(a.x,a.z).angle()
  59173. , a = new yn(u.x,u.z).angle() - n
  59174. , u = i / c
  59175. , n = this.startState.clone();
  59176. n.updateMatrix(),
  59177. n.matrixAutoUpdate = !1;
  59178. c = (i = new ni).makeTranslation.apply(i, Q(h1(r, this.startState).multiplyScalar(-1).toArray())),
  59179. i = (i = new ni).makeTranslation.apply(i, Q(h1(r, this.startState).toArray())),
  59180. a = (new ni).makeRotationZ(a),
  59181. u = (new ni).makeScale(1 / u, 1 / u, 1 / u);
  59182. n.applyMatrix4(c),
  59183. n.applyMatrix4(a),
  59184. n.applyMatrix4(u),
  59185. n.applyMatrix4(i);
  59186. u = h1(r, this.startState),
  59187. i = h1(l, n),
  59188. r = u.clone().sub(i),
  59189. i = (u = new ni).makeTranslation.apply(u, Q(r.toArray()));
  59190. n.applyMatrix4(i),
  59191. n.matrix.decompose(n.position, n.quaternion, n.scale),
  59192. e.node.position.copy(n.position),
  59193. e.node.quaternion.copy(n.quaternion),
  59194. e.node.scale.copy(n.scale),
  59195. e.node.updateMatrix();
  59196. u = e.node.scale.x,
  59197. r = e.viewer.renderer.xr.getCamera(d1),
  59198. i = r.getWorldPosition(new Cn),
  59199. n = r.getWorldDirection(new Cn),
  59200. i.clone().add(n.multiplyScalar(u)),
  59201. r = h1(i, this.startState),
  59202. n = h1(i.clone().add(n), this.startState).sub(r);
  59203. n.normalize().multiplyScalar(u);
  59204. n = r.clone().add(n);
  59205. e.viewer.scene.view.setView(r, n),
  59206. e.viewer.setMoveSpeed(u),
  59207. this.line.set(o, s);
  59208. e = e.node.scale.x;
  59209. this.dbgLabel.visible = !0,
  59210. this.dbgLabel.position.copy(l),
  59211. this.dbgLabel.setText("scale: 1 : ".concat(e.toFixed(2))),
  59212. this.dbgLabel.scale.set(.05, .05, .05)
  59213. }
  59214. }]),
  59215. e
  59216. }(), gu = function() {
  59217. y(c, hn);
  59218. var u = w(c);
  59219. function c(e) {
  59220. var t;
  59221. O(this, c),
  59222. ((t = u.call(this, e)).viewer = e).addEventListener("vr_start", t.onStart.bind(g(t))),
  59223. e.addEventListener("vr_end", t.onEnd.bind(g(t))),
  59224. t.node = new Si,
  59225. t.node.up.set(0, 0, 1),
  59226. t.triggered = new Set;
  59227. var n = e.renderer.xr
  59228. , i = new $c(16777215,5,0,1);
  59229. i.position.set(0, 2, 0),
  59230. t.viewer.sceneVR.add(i),
  59231. t.menu = null;
  59232. var r = new u1
  59233. , a = new Su(1,32,32)
  59234. , o = new Xu
  59235. , s = n.getController(0)
  59236. , e = n.getControllerGrip(0);
  59237. e.name = "grip(0)",
  59238. e.add(r.createControllerModel(e)),
  59239. t.viewer.sceneVR.add(e);
  59240. i = new Hr(a,o);
  59241. i.scale.set(.005, .005, .005),
  59242. s.add(i),
  59243. s.visible = !0,
  59244. t.viewer.sceneVR.add(s);
  59245. e = new Mf;
  59246. e.setPositions([0, 0, -.15, 0, 0, .05]);
  59247. i = new lf({
  59248. color: 16711680,
  59249. lineWidth: 2,
  59250. resolution: new yn(1e3,1e3)
  59251. }),
  59252. i = new Af(e,i);
  59253. s.add(i),
  59254. s.addEventListener("connected", function(e) {
  59255. e = e.data;
  59256. s.inputSource = e
  59257. }),
  59258. s.addEventListener("selectstart", function() {
  59259. t.onTriggerStart(s)
  59260. }),
  59261. s.addEventListener("selectend", function() {
  59262. t.onTriggerEnd(s)
  59263. }),
  59264. t.cPrimary = s;
  59265. var l = n.getController(1)
  59266. , n = n.getControllerGrip(1)
  59267. , r = r.createControllerModel(n);
  59268. n.add(r),
  59269. t.viewer.sceneVR.add(n);
  59270. a = new Hr(a,o);
  59271. a.scale.set(.005, .005, .005),
  59272. l.add(a),
  59273. l.visible = !0,
  59274. t.viewer.sceneVR.add(l);
  59275. o = new Mf;
  59276. o.setPositions([0, 0, -.15, 0, 0, .05]);
  59277. a = new lf({
  59278. color: 16711680,
  59279. lineWidth: 2,
  59280. resolution: new yn(1e3,1e3)
  59281. }),
  59282. a = new Af(o,a);
  59283. return l.add(a),
  59284. l.addEventListener("connected", function(e) {
  59285. e = e.data;
  59286. l.inputSource = e,
  59287. t.initMenu(l)
  59288. }),
  59289. l.addEventListener("selectstart", function() {
  59290. t.onTriggerStart(l)
  59291. }),
  59292. l.addEventListener("selectend", function() {
  59293. t.onTriggerEnd(l)
  59294. }),
  59295. t.cSecondary = l,
  59296. t.mode_fly = new m1,
  59297. t.mode_translate = new v1,
  59298. t.mode_rotScale = new g1,
  59299. t.setMode(t.mode_fly),
  59300. t
  59301. }
  59302. return h(c, [{
  59303. key: "createSlider",
  59304. value: function(e, t, n) {
  59305. var i = new Su(1,8,8)
  59306. , r = new Bl(1,1,1,8)
  59307. , a = new $i({
  59308. color: 16711680
  59309. })
  59310. , o = new $i({
  59311. color: 16729156
  59312. })
  59313. , s = new Xu
  59314. , l = new Si
  59315. , u = new Potree.TextSprite("".concat(e, ": 0"))
  59316. , e = new Hr(i,a)
  59317. , a = new Hr(i,a)
  59318. , s = new Hr(i,s)
  59319. , o = new Hr(r,o);
  59320. return u.scale.set(.2, .2, .2),
  59321. u.position.set(0, .35, 0),
  59322. e.scale.set(.02, .02, .02),
  59323. e.position.set(0, .25, 0),
  59324. a.scale.set(.02, .02, .02),
  59325. a.position.set(0, -.25, 0),
  59326. s.scale.set(.02, .02, .02),
  59327. s.position.set(0, 0, 0),
  59328. o.scale.set(.005, .5, .005),
  59329. l.add(u),
  59330. l.add(e),
  59331. l.add(a),
  59332. l.add(s),
  59333. l.add(o),
  59334. l
  59335. }
  59336. }, {
  59337. key: "createInfo",
  59338. value: function() {
  59339. var e = (new _c).load("".concat(Potree.resourcePath, "/images/vr_controller_help.jpg"));
  59340. return new Hr(new ua(1,1,1,1),new $i({
  59341. map: e
  59342. }))
  59343. }
  59344. }, {
  59345. key: "initMenu",
  59346. value: function(e) {
  59347. var t;
  59348. this.menu || (t = new Si,
  59349. this.menu = t,
  59350. window.vrMenu = t)
  59351. }
  59352. }, {
  59353. key: "toScene",
  59354. value: function(e) {
  59355. var t = this.getCamera().matrixWorld;
  59356. return e.clone().applyMatrix4(t)
  59357. }
  59358. }, {
  59359. key: "toVR",
  59360. value: function(e) {
  59361. var t = this.getCamera().matrixWorld.clone();
  59362. return t.invert(),
  59363. e.clone().applyMatrix4(t)
  59364. }
  59365. }, {
  59366. key: "setMode",
  59367. value: function(e) {
  59368. if (this.mode !== e) {
  59369. this.mode && this.mode.end(this);
  59370. for (var t = 0, n = [this.cPrimary, this.cSecondary]; t < n.length; t++) {
  59371. var i = n[t]
  59372. , r = {
  59373. position: i.position.clone(),
  59374. rotation: i.rotation.clone()
  59375. };
  59376. i.start = r
  59377. }
  59378. this.mode = e,
  59379. this.mode.start(this)
  59380. }
  59381. }
  59382. }, {
  59383. key: "onTriggerStart",
  59384. value: function(e) {
  59385. this.triggered.add(e),
  59386. 0 === this.triggered.size ? this.setMode(this.mode_fly) : 1 === this.triggered.size ? this.setMode(this.mode_translate) : 2 === this.triggered.size && this.setMode(this.mode_rotScale)
  59387. }
  59388. }, {
  59389. key: "onTriggerEnd",
  59390. value: function(e) {
  59391. this.triggered.delete(e),
  59392. 0 === this.triggered.size ? this.setMode(this.mode_fly) : 1 === this.triggered.size ? this.setMode(this.mode_translate) : 2 === this.triggered.size && this.setMode(this.mode_rotScale)
  59393. }
  59394. }, {
  59395. key: "onStart",
  59396. value: function() {
  59397. var e = this.viewer.scene.view.position.clone()
  59398. , t = this.viewer.scene.view.direction;
  59399. t.multiplyScalar(-1);
  59400. var n = e.clone().add(t);
  59401. n.z = e.z;
  59402. t = this.viewer.getMoveSpeed();
  59403. this.node.position.copy(e),
  59404. this.node.lookAt(n),
  59405. this.node.scale.set(t, t, t),
  59406. this.node.updateMatrix(),
  59407. this.node.updateMatrixWorld()
  59408. }
  59409. }, {
  59410. key: "onEnd",
  59411. value: function() {}
  59412. }, {
  59413. key: "setScene",
  59414. value: function(e) {
  59415. this.scene = e
  59416. }
  59417. }, {
  59418. key: "getCamera",
  59419. value: function() {
  59420. this.viewer.scene.getActiveCamera();
  59421. var e = new $r
  59422. , t = this.viewer.getMoveSpeed();
  59423. return e.near = .1,
  59424. e.far = 1e3,
  59425. e.up.set(0, 0, 1),
  59426. e.lookAt(new Cn(0,-1,0)),
  59427. e.updateMatrix(),
  59428. e.updateMatrixWorld(),
  59429. e.position.copy(this.node.position),
  59430. e.rotation.copy(this.node.rotation),
  59431. e.scale.set(t, t, t),
  59432. e.updateMatrix(),
  59433. e.updateMatrixWorld(),
  59434. e.matrixAutoUpdate = !1,
  59435. e.parent = e
  59436. }
  59437. }, {
  59438. key: "update",
  59439. value: function(e) {
  59440. this.mode.update(this, e)
  59441. }
  59442. }]),
  59443. c
  59444. }(), y1 = {
  59445. priorityEvent: [{
  59446. zoomInCloud: "zoom-in"
  59447. }, {
  59448. hoverPano: "pointer"
  59449. }, {
  59450. connectPano: "url({Potree.resourcePath}/images/connect.png),auto"
  59451. }, {
  59452. disconnectPano: "url({Potree.resourcePath}/images/connect-dis.png),auto"
  59453. }, {
  59454. hoverLine: "pointer"
  59455. }, {
  59456. movePointcloud: "move"
  59457. }, {
  59458. polygon_isIntersectSelf: "not-allowed"
  59459. }, {
  59460. polygon_AtWrongPlace: "not-allowed"
  59461. }, {
  59462. markerMove: "grab"
  59463. }, {
  59464. mapClipMove: "move"
  59465. }, {
  59466. mapClipRotate: "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
  59467. }, {
  59468. rotatePointcloud: "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
  59469. }, {
  59470. siteModelFloorDrag: "row-resize"
  59471. }, {
  59472. addSth: "cell"
  59473. }],
  59474. list: [],
  59475. currentCursorIndex: null,
  59476. init: function(e, t) {
  59477. var n = this;
  59478. this.priorityEvent.forEach(function(e) {
  59479. for (var t in e)
  59480. e[t] = Fm.replaceAll(e[t], "{Potree.resourcePath}", Potree.resourcePath)
  59481. }),
  59482. this.domElements = t.map(function(e) {
  59483. return e.renderArea
  59484. }),
  59485. e.addEventListener("CursorChange", function(e) {
  59486. "add" == e.action ? n.add(e.name) : n.remove(e.name)
  59487. })
  59488. },
  59489. add: function(t) {
  59490. var e = this.priorityEvent.find(function(e) {
  59491. return e[t]
  59492. });
  59493. e ? this.list.includes(t) || (this.judge({
  59494. addItem: e,
  59495. name: t
  59496. }),
  59497. this.list.push(t)) : console.error("CursorDeal 未定义优先级 name:" + t)
  59498. },
  59499. remove: function(e) {
  59500. e = this.list.indexOf(e);
  59501. -1 < e && (this.list.splice(e, 1),
  59502. this.judge())
  59503. },
  59504. judge: function() {
  59505. var e, i, r = this, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  59506. t.addItem ? ((e = this.priorityEvent.indexOf(t.addItem)) < this.currentCursorIndex || null == this.currentCursorIndex) && (this.domElements.forEach(function(e) {
  59507. return e.style.cursor = t.addItem[t.name]
  59508. }),
  59509. this.currentCursorIndex = e) : (i = {
  59510. index: 1 / 0,
  59511. cursor: null
  59512. },
  59513. this.list.forEach(function(t) {
  59514. var e = r.priorityEvent.find(function(e) {
  59515. return e[t]
  59516. })
  59517. , n = r.priorityEvent.indexOf(e);
  59518. n < i.index && (i.index = n,
  59519. i.cursor = e[t])
  59520. }),
  59521. this.currentCursorIndex = i.index,
  59522. this.domElements.forEach(function(e) {
  59523. return e.style.cursor = i.cursor || ""
  59524. }))
  59525. }
  59526. }, w1 = new _c, b1 = new Yi(T.clip.color), x1 = {
  59527. width2d: 30
  59528. }, E1 = function() {
  59529. y(o, Df);
  59530. var r = w(o);
  59531. function o(e, t) {
  59532. O(this, o);
  59533. var n, i, t = {
  59534. points: _1(e = e.clone().setZ(0), t, 0),
  59535. closed: !0,
  59536. isRect: !0,
  59537. dimension: "2d"
  59538. };
  59539. (i = r.call(this, "mapClipBox", t)).angle = 0,
  59540. i.createRotateBar(),
  59541. i.edgeMarkers = [],
  59542. i.initData(t),
  59543. i.areaPlane.addEventListener("mouseover", function() {
  59544. viewer.dispatchEvent({
  59545. type: "CursorChange",
  59546. action: "add",
  59547. name: "mapClipMove"
  59548. })
  59549. }),
  59550. i.areaPlane.addEventListener("mouseleave", function() {
  59551. viewer.dispatchEvent({
  59552. type: "CursorChange",
  59553. action: "remove",
  59554. name: "mapClipMove"
  59555. })
  59556. });
  59557. return i.areaPlane.addEventListener("drag", function(e) {
  59558. var t = e.intersect.orthoIntersect;
  59559. n && (e = (new Cn).subVectors(t, n).setZ(0),
  59560. i.center.add(e),
  59561. i.updatePoints(),
  59562. i.dispatchEvent({
  59563. type: "repos"
  59564. })),
  59565. n = t.clone()
  59566. }),
  59567. i.areaPlane.addEventListener("drop", function(e) {
  59568. n = null
  59569. }),
  59570. viewer.setObjectLayers(g(i), "mapObjects"),
  59571. i
  59572. }
  59573. return h(o, [{
  59574. key: "getScale",
  59575. value: function() {
  59576. return new Cn(this.points[0].distanceTo(this.points[1]),this.points[1].distanceTo(this.points[2]),1)
  59577. }
  59578. }, {
  59579. key: "addMarker",
  59580. value: function() {
  59581. var t = this
  59582. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  59583. , n = new qp({
  59584. mat: this.getMarkerMaterial("default"),
  59585. sizeInfo: x1,
  59586. dontFixOrient: !0,
  59587. viewports: viewer.mapViewer.viewports,
  59588. name: "mapClipBox_marker"
  59589. });
  59590. n.renderOrder = 3;
  59591. var i = Sf.createLine([new Cn, new Cn], {
  59592. color: b1
  59593. })
  59594. , r = new qp({
  59595. mat: this.getMarkerMaterial("default"),
  59596. sizeInfo: x1,
  59597. dontFixOrient: !0,
  59598. viewports: viewer.mapViewer.viewports,
  59599. name: "mapClipBox_edgePoint"
  59600. });
  59601. r.addEventListener("mouseover", function(e) {
  59602. t.setMarkerSelected(e.object, !0, "single"),
  59603. viewer.dispatchEvent({
  59604. type: "CursorChange",
  59605. action: "add",
  59606. name: "markerMove"
  59607. })
  59608. }),
  59609. r.addEventListener("mouseleave", function(e) {
  59610. t.setMarkerSelected(e.object, !1, "single"),
  59611. viewer.dispatchEvent({
  59612. type: "CursorChange",
  59613. action: "remove",
  59614. name: "markerMove"
  59615. })
  59616. });
  59617. var a = {
  59618. lastPos: null
  59619. };
  59620. r.addEventListener("drag", this.dragEdge.bind(this, a)),
  59621. r.addEventListener("drop", this.dropEdge.bind(this, a)),
  59622. this.edgeMarkers.push(r),
  59623. this.add(r),
  59624. n.dispatchEvent("addHoverEvent"),
  59625. b(v(o.prototype), "addMarker", this).call(this, {
  59626. point: e.point,
  59627. marker: n,
  59628. edge: i
  59629. })
  59630. }
  59631. }, {
  59632. key: "dragEdge",
  59633. value: function(e, t) {
  59634. var n, i = "mapViewport" == t.dragViewport.name, r = t.intersect.orthoIntersect;
  59635. r && e.lastPos && (-1 !== (n = this.edgeMarkers.indexOf(t.drag.object)) && (t = Up.getNormal2d({
  59636. p1: this.points[n],
  59637. p2: this.points[(n + 1) % 4]
  59638. }),
  59639. t = (new Cn).subVectors(r, e.lastPos).setZ(0).projectOnVector(t).setZ(0),
  59640. t = (new Cn).addVectors(this.points[n], t),
  59641. this.dragChange(t, n, i))),
  59642. e.lastPos = r.clone()
  59643. }
  59644. }, {
  59645. key: "dropEdge",
  59646. value: function(e, t) {
  59647. e.lastPos = null,
  59648. this.setMarkerSelected(t.drag.object, !1, "single")
  59649. }
  59650. }, {
  59651. key: "createAreaPlane",
  59652. value: function() {
  59653. var e = new $i({
  59654. color: b1,
  59655. side: Y,
  59656. opacity: .3,
  59657. transparent: !0,
  59658. depthTest: !1
  59659. });
  59660. return b(v(o.prototype), "createAreaPlane", this).call(this, e)
  59661. }
  59662. }, {
  59663. key: "getMarkerMaterial",
  59664. value: function(e) {
  59665. return f1 || (f1 = {
  59666. default: new $i({
  59667. transparent: !0,
  59668. color: b1,
  59669. opacity: .8,
  59670. map: w1.load(Potree.resourcePath + "/textures/whiteCircle.png")
  59671. }),
  59672. select: new $i({
  59673. transparent: !0,
  59674. color: b1,
  59675. opacity: 1,
  59676. map: w1.load(Potree.resourcePath + "/textures/whiteCircle.png")
  59677. })
  59678. },
  59679. o.markerMats = f1),
  59680. f1[e]
  59681. }
  59682. }, {
  59683. key: "setMarkerSelected",
  59684. value: function(e, t, n) {
  59685. e.material = "hover" == t ? this.getMarkerMaterial("select") : this.getMarkerMaterial("default"),
  59686. viewer.mapViewer.dispatchEvent("content_changed")
  59687. }
  59688. }, {
  59689. key: "createRotateBar",
  59690. value: function() {
  59691. var i = this
  59692. , e = .7
  59693. , t = new Si
  59694. , n = new qp({
  59695. mat: new $i({
  59696. side: Y,
  59697. opacity: e,
  59698. transparent: !0,
  59699. depthTest: !1,
  59700. map: w1.load(Potree.resourcePath + "/textures/rotation_circle.png")
  59701. }),
  59702. root: t,
  59703. sizeInfo: x1,
  59704. dontFixOrient: !0,
  59705. viewports: viewer.mapViewer.viewports,
  59706. name: "mapClipRotateBar"
  59707. });
  59708. n.position.set(0, 2.5, 0),
  59709. n.scale.set(2, 2, 2),
  59710. n.addEventListener("mouseover", function() {
  59711. n.material.opacity = 1,
  59712. viewer.dispatchEvent({
  59713. type: "CursorChange",
  59714. action: "add",
  59715. name: "mapClipRotate"
  59716. }),
  59717. viewer.mapViewer.dispatchEvent("content_changed")
  59718. });
  59719. function r() {
  59720. n.material.opacity = e,
  59721. viewer.dispatchEvent({
  59722. type: "CursorChange",
  59723. action: "remove",
  59724. name: "mapClipRotate"
  59725. }),
  59726. viewer.mapViewer.dispatchEvent("content_changed")
  59727. }
  59728. var a;
  59729. n.addEventListener("mouseleave", r),
  59730. this.addEventListener("dispose", r),
  59731. n.addEventListener("drag", function(e) {
  59732. var t, n = e.intersect.orthoIntersect;
  59733. a && (t = (new Cn).subVectors(a, i.center).setZ(0),
  59734. e = (new Cn).subVectors(n, i.center).setZ(0),
  59735. e = Up.getAngle(t, e, "z"),
  59736. i.angle += e,
  59737. i.rotateBar.rotation.z = i.angle,
  59738. i.updatePoints(),
  59739. i.dispatchEvent({
  59740. type: "rotate",
  59741. angle: i.angle
  59742. })),
  59743. a = n.clone()
  59744. }),
  59745. n.addEventListener("drop", function() {
  59746. a = null,
  59747. viewer.dispatchEvent({
  59748. type: "CursorChange",
  59749. action: "remove",
  59750. name: "mapClipRotate"
  59751. })
  59752. });
  59753. var o = Sf.createLine([new Cn, new Cn(0,1.5,0)], {
  59754. color: b1
  59755. });
  59756. t.add(n),
  59757. t.add(o),
  59758. this.add(t),
  59759. this.rotateBar = t,
  59760. this.rotateBar.bar = n
  59761. }
  59762. }, {
  59763. key: "updatePoints",
  59764. value: function(e) {
  59765. this.points = _1(this.center, e || this.getScale(), this.angle),
  59766. this.getPoint2dInfo(this.points),
  59767. this.update({
  59768. ifUpdateMarkers: !0
  59769. })
  59770. }
  59771. }, {
  59772. key: "update",
  59773. value: function() {
  59774. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  59775. b(v(o.prototype), "update", this).call(this, e);
  59776. e = (new Cn).addVectors(this.points[0], this.points[1]).multiplyScalar(.5);
  59777. this.rotateBar.position.copy(e),
  59778. this.rotateBar.bar.update();
  59779. for (var t = 0; t < 4; t++) {
  59780. var n = this.points[t]
  59781. , i = this.points[(t + 1) % 4]
  59782. , i = (new Cn).addVectors(n, i).multiplyScalar(.5);
  59783. this.updateMarker(this.edgeMarkers[t], i)
  59784. }
  59785. }
  59786. }, {
  59787. key: "dispose",
  59788. value: function() {
  59789. b(v(o.prototype), "dispose", this).call(this),
  59790. this.dispatchEvent("dispose")
  59791. }
  59792. }]),
  59793. o
  59794. }();
  59795. function _1(t, e, n) {
  59796. var n = 2 < arguments.length && void 0 !== n ? n : 0
  59797. , e = [new Cn(-e.x / 2,+e.y / 2,0), new Cn(+e.x / 2,+e.y / 2,0), new Cn(+e.x / 2,-e.y / 2,0), new Cn(-e.x / 2,-e.y / 2,0)]
  59798. , i = (new ni).makeRotationAxis(new Cn(0,0,1), n);
  59799. return e.forEach(function(e) {
  59800. e.applyMatrix4(i),
  59801. e.add(t)
  59802. }),
  59803. e
  59804. }
  59805. var M1 = {
  59806. bus: new hn,
  59807. selectedDatasets: [],
  59808. changeCallback: function(t) {
  59809. var n = this;
  59810. Potree.settings.isOfficial && Fm.intervalTool.isWaiting("clipSelectedDatasets", function() {
  59811. var e = n.getIntersectPointcloud();
  59812. if (t || Fm.getDifferenceSet(e, n.selectedDatasets).length)
  59813. return n.selectedDatasets = e,
  59814. n.bus.dispatchEvent({
  59815. type: "updateSelectedDatasets",
  59816. selectedDatasets: e.map(function(e) {
  59817. return e.dataset_id
  59818. })
  59819. }),
  59820. !(t = !1)
  59821. }, 300)
  59822. },
  59823. enter: function() {
  59824. var n = this;
  59825. this.previousView = {
  59826. position: viewer.images360.position,
  59827. target: viewer.scene.view.getPivot(),
  59828. displayMode: Potree.settings.displayMode,
  59829. ifShowMarker: Potree.settings.ifShowMarker
  59830. };
  59831. var e = this.getPointcloud().bound
  59832. , t = e.getSize(new Cn)
  59833. , i = this.getTarget(e.getCenter(new Cn))
  59834. , e = new Cn(6,6,t.z)
  59835. , t = viewer.scene.view.direction.clone().setZ(0).multiplyScalar(-6)
  59836. , r = (new Cn).addVectors(i, t);
  59837. Potree.settings.displayMode = "showPointCloud",
  59838. viewer.setView({
  59839. position: r,
  59840. target: i,
  59841. duration: 300,
  59842. callback: function() {}
  59843. }),
  59844. viewer.setControls(viewer.orbitControls),
  59845. viewer.setLimitFar(!1),
  59846. this.box = new Zp({
  59847. clip: !0
  59848. }),
  59849. this.box.name = "ClipBox",
  59850. this.box.position.copy(i),
  59851. this.box.scale.copy(e),
  59852. this.box.addEventListener("position_changed", function(e) {
  59853. n.mapBox.center.setX(n.box.position.x),
  59854. n.mapBox.center.setY(n.box.position.y),
  59855. n.mapBox.updatePoints(),
  59856. n.changeCallback()
  59857. }),
  59858. this.box.addEventListener("scale_changed", function(e) {
  59859. var t = n.box.scale;
  59860. n.mapBox.updatePoints(t),
  59861. n.changeCallback()
  59862. }),
  59863. this.box.addEventListener("orientation_changed", function(e) {
  59864. n.mapBox.angle = n.box.rotation.z,
  59865. n.mapBox.rotateBar.rotation.z = n.mapBox.angle,
  59866. n.mapBox.updatePoints(),
  59867. n.changeCallback()
  59868. }),
  59869. viewer.scene.addVolume(this.box);
  59870. function a() {
  59871. n.box.rotation.x = 0,
  59872. n.box.rotation.y = 0
  59873. }
  59874. this.mapBox = new E1(i,e),
  59875. viewer.mapViewer.scene.add(this.mapBox),
  59876. this.mapBox.addEventListener("repos", function(e) {
  59877. n.box.position.setX(n.mapBox.center.x),
  59878. n.box.position.setY(n.mapBox.center.y),
  59879. a(),
  59880. n.changeCallback()
  59881. }),
  59882. this.mapBox.addEventListener("dragChange", function(e) {
  59883. var t = n.mapBox.getScale();
  59884. n.box.scale.setX(t.x),
  59885. n.box.scale.setY(t.y),
  59886. n.box.position.setX(n.mapBox.center.x),
  59887. n.box.position.setY(n.mapBox.center.y),
  59888. a(),
  59889. n.changeCallback()
  59890. }),
  59891. this.mapBox.addEventListener("rotate", function(e) {
  59892. n.box.rotation.z = n.mapBox.angle,
  59893. a(),
  59894. n.changeCallback()
  59895. }),
  59896. viewer.setClipTask(tm.SHOW_INSIDE),
  59897. Potree.settings.unableNavigate = !0,
  59898. Potree.settings.ifShowMarker = !1,
  59899. viewer.updateVisible(viewer.measuringTool.scene, "clipModel", !1),
  59900. viewer.inputHandler.toggleSelection(this.box),
  59901. viewer.inputHandler.fixSelection = !0,
  59902. viewer.transformationTool.frame.material.color.set(Potree.config.clip.color),
  59903. viewer.setPointStandardMat(!0),
  59904. this.events = {
  59905. flyToPos: function(e) {
  59906. e.position;
  59907. var t = n.box.position;
  59908. r = e.position;
  59909. viewer.scene.view.setView({
  59910. position: r,
  59911. duration: 1e3,
  59912. target: t
  59913. })
  59914. }
  59915. },
  59916. this.bus.addEventListener("flyToPos", this.events.flyToPos),
  59917. this.editing = !0,
  59918. setTimeout(function() {
  59919. n.changeCallback(!0)
  59920. }, 1)
  59921. },
  59922. leave: function() {
  59923. viewer.inputHandler.fixSelection = !1,
  59924. viewer.scene.removeVolume(this.box),
  59925. this.mapBox.dispose(),
  59926. viewer.setControls(viewer.fpControls),
  59927. Potree.settings.unableNavigate = !1,
  59928. Potree.settings.ifShowMarker = this.previousView.ifShowMarker,
  59929. viewer.updateVisible(viewer.measuringTool.scene, "clipModel", !0),
  59930. viewer.setView(this.previousView),
  59931. viewer.setLimitFar(!0),
  59932. viewer.setPointStandardMat(!1),
  59933. this.bus.removeEventListener("flyToPos", this.events.flyToPos),
  59934. this.events = null,
  59935. this.editing = !1
  59936. },
  59937. getPointcloud: function() {
  59938. var e = viewer.scene.pointclouds.filter(function(e) {
  59939. return 0 < e.panos.length
  59940. });
  59941. return 0 == e.length && (e = viewer.scene.pointclouds),
  59942. Fm.sortByScore(e, [], [function(e) {
  59943. var t = e.bound.getCenter(new Cn);
  59944. return e.bound.getSize(new Cn).length() / 2 / viewer.images360.position.distanceTo(t)
  59945. }
  59946. ])[0].item
  59947. },
  59948. getTarget: function(e) {
  59949. var t = new Cn
  59950. , n = viewer.images360.position
  59951. , n = Fm.find(viewer.images360.panos, [], [ly.sortFunctions.floorDisSquaredToPoint(n)]);
  59952. return n ? (t.copy(n.position),
  59953. t.setZ(e.z)) : t.copy(e),
  59954. t
  59955. },
  59956. download: function() {
  59957. var t = this;
  59958. return 0 == this.getIntersectPointcloud().length ? null : {
  59959. transformation_matrix: viewer.scene.pointclouds.filter(function(e) {
  59960. return viewer.getObjVisiByReason(e, "datasetSelection")
  59961. }).map(function(e) {
  59962. return {
  59963. id: e.dataset_id,
  59964. matrix: t.getTransformationMatrix(e).elements,
  59965. modelMatrix: (new ni).copy(e.transformMatrix).transpose().elements
  59966. }
  59967. }),
  59968. aabb: "b-0.5 -0.5 -0.5 0.5 0.5 0.5"
  59969. }
  59970. },
  59971. downloadNoCrop: function() {
  59972. var e = {
  59973. transformation_matrix: viewer.scene.pointclouds.filter(function(e) {
  59974. return viewer.getObjVisiByReason(e, "datasetSelection")
  59975. }).map(function(e) {
  59976. return {
  59977. id: e.dataset_id,
  59978. matrix: (new ni).elements,
  59979. modelMatrix: (new ni).copy(e.transformMatrix).transpose().elements
  59980. }
  59981. }),
  59982. aabb: "b-12742000 -12742000 -12742000 12742000 12742000 12742000"
  59983. };
  59984. return console.log(e),
  59985. e
  59986. },
  59987. getTransformationMatrix: function(e) {
  59988. var t = (new ni).getInverse(this.box.matrixWorld);
  59989. return (new ni).multiplyMatrices(t, e.transformMatrix).transpose()
  59990. },
  59991. getIntersectPointcloud: function() {
  59992. var t = new kn(new Cn(-.5,-.5,-.5),new Cn(.5,.5,.5)).applyMatrix4(this.box.matrixWorld)
  59993. , n = (new ni).copy(this.box.matrixWorld).invert()
  59994. , i = [new Cn(t.min.x,t.min.y,0), new Cn(t.max.x,t.min.y,0), new Cn(t.max.x,t.max.y,0), new Cn(t.min.x,t.max.y,0)];
  59995. return viewer.scene.pointclouds.filter(function(e) {
  59996. if (!e.bound.intersectsBox(t))
  59997. return !1;
  59998. e = e.getUnrotBoundPoint("all");
  59999. if (1 < Up.getPolygonsMixedRings([e.slice(0, 4), i], !0).length)
  60000. return !1;
  60001. e = Potree.Utils.isInsideBox(e, n);
  60002. return e || console.log("没能经过isInsideBox测试"),
  60003. e
  60004. })
  60005. }
  60006. }
  60007. , A1 = function() {
  60008. y(t, hn);
  60009. var e = w(t);
  60010. function t() {
  60011. return O(this, t),
  60012. e.call(this)
  60013. }
  60014. return h(t, [{
  60015. key: "splitStart",
  60016. value: function(i) {
  60017. var r = this
  60018. , a = []
  60019. , o = [viewer.mainViewport];
  60020. viewer.mapViewer && o.push(viewer.mapViewer.viewports[0]);
  60021. for (var e = i.length, t = 0; t < e; t++)
  60022. !function(e) {
  60023. var t = i[e]
  60024. , n = void 0
  60025. , e = o.find(function(e) {
  60026. return e.name == (t.name2 || t.name)
  60027. });
  60028. e && ((n = e).left = t.left,
  60029. n.bottom = t.bottom,
  60030. n.width = t.width,
  60031. n.height = t.height),
  60032. n || (e = new ng,
  60033. t.limitBound && (e.limitBound = t.limitBound),
  60034. t.direction && (e.direction = t.direction),
  60035. n = new Ig(e,r.getOrthoCamera(),t),
  60036. t.viewContainsPoints && (n.viewContainsPoints = t.viewContainsPoints)),
  60037. "OrthographicCamera" == n.camera.type && (n.targetPlane = new ki,
  60038. n.shiftTarget = new Cn),
  60039. n.fitMargin = t.margin,
  60040. a.push(n)
  60041. }(t);
  60042. return viewer.viewports = a,
  60043. viewer.updateScreenSize({
  60044. forceUpdateSize: !0
  60045. }),
  60046. a.forEach(function(e) {
  60047. "MainView" != e.name && r.viewportFitBound(e, viewer.bound.boundingBox, viewer.bound.center, 0, e.fitMargin)
  60048. }),
  60049. a
  60050. }
  60051. }, {
  60052. key: "unSplit",
  60053. value: function() {
  60054. this.unfocusViewport(),
  60055. viewer.viewports = [viewer.mainViewport],
  60056. viewer.mainViewport.width = 1,
  60057. viewer.mainViewport.height = 1,
  60058. viewer.mainViewport.left = 0,
  60059. viewer.mainViewport.bottom = 0,
  60060. viewer.updateScreenSize({
  60061. forceUpdateSize: !0
  60062. })
  60063. }
  60064. }, {
  60065. key: "viewportFitBound",
  60066. value: function(e, t, n) {
  60067. var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0
  60068. , r = 4 < arguments.length ? arguments[4] : void 0
  60069. , a = e.view
  60070. , o = {
  60071. bound: t
  60072. }
  60073. , s = this.getViewBound(e)
  60074. , t = s.boundSize
  60075. , s = s.boundCenter;
  60076. e.targetPlane.setFromNormalAndCoplanarPoint(a.direction.clone(), s),
  60077. e.targetPlane.projectPoint(n, e.shiftTarget),
  60078. o.endPosition = this.getPosOutOfModel(e, t),
  60079. o.margin = r || {
  60080. x: 30,
  60081. y: 30
  60082. },
  60083. a.moveOrthoCamera(e, o, i)
  60084. }
  60085. }, {
  60086. key: "getViewBound",
  60087. value: function(e) {
  60088. var t, n = viewer.bound, i = n.boundSize, n = n.center;
  60089. return e.viewContainsPoints && (t = viewer.bound.boundingBox.clone(),
  60090. e.viewContainsPoints.forEach(function(e) {
  60091. t.expandByPoint(e)
  60092. }),
  60093. i = t.getSize(new Cn),
  60094. n = t.getCenter(new Cn)),
  60095. {
  60096. boundSize: i,
  60097. boundCenter: n
  60098. }
  60099. }
  60100. }, {
  60101. key: "getPosOutOfModel",
  60102. value: function(e, t) {
  60103. t = (t = t || this.getViewBound(e).boundSize).length();
  60104. return e.shiftTarget.clone().sub(e.view.direction.clone().multiplyScalar(t + 10))
  60105. }
  60106. }, {
  60107. key: "updateCameraOutOfModel",
  60108. value: function() {
  60109. var r = this;
  60110. viewer.viewports.forEach(function(e, t) {
  60111. var n, i;
  60112. e != viewer.mainViewport && (i = (n = r.getViewBound(e)).boundSize,
  60113. n = n.boundCenter,
  60114. e.targetPlane.setFromNormalAndCoplanarPoint(e.view.direction.clone(), n),
  60115. e.targetPlane.projectPoint(e.view.position, e.shiftTarget),
  60116. i = r.getPosOutOfModel(e, i),
  60117. e.view.position.copy(i))
  60118. })
  60119. }
  60120. }, {
  60121. key: "rotateSideCamera",
  60122. value: function(e, t) {
  60123. var n = this.getViewBound(e)
  60124. , i = n.boundSize
  60125. , r = n.boundCenter
  60126. , n = this.focusCenter || r;
  60127. e.targetPlane.setFromNormalAndCoplanarPoint(e.view.direction, n),
  60128. e.targetPlane.projectPoint(e.view.position, e.shiftTarget);
  60129. r = (new Cn).subVectors(n, e.shiftTarget),
  60130. t = (new ni).makeRotationAxis(new Cn(0,0,1), t);
  60131. e.view.direction = e.view.direction.applyMatrix4(t),
  60132. r.applyMatrix4(t),
  60133. e.shiftTarget.subVectors(n, r),
  60134. e.view.position = this.getPosOutOfModel(e, i)
  60135. }
  60136. }, {
  60137. key: "getOrthoCamera",
  60138. value: function() {
  60139. return new ed(-100,100,100,100,.01,1e4)
  60140. }
  60141. }, {
  60142. key: "focusOnViewport",
  60143. value: function(n) {
  60144. var i = this;
  60145. viewer.viewports.forEach(function(e, t) {
  60146. e.name == n ? (i.focusInfo = {
  60147. name: n,
  60148. left: e.left,
  60149. bottom: e.bottom,
  60150. height: e.height,
  60151. width: e.width
  60152. },
  60153. e.left = 0,
  60154. e.bottom = 0,
  60155. e.height = 1,
  60156. e.width = 1) : e.active = !1
  60157. }),
  60158. viewer.updateScreenSize({
  60159. forceUpdateSize: !0
  60160. })
  60161. }
  60162. }, {
  60163. key: "unfocusViewport",
  60164. value: function() {
  60165. var n = this;
  60166. this.focusInfo && (viewer.viewports.forEach(function(e, t) {
  60167. n.focusInfo.name == e.name && (e.left = n.focusInfo.left,
  60168. e.bottom = n.focusInfo.bottom,
  60169. e.height = n.focusInfo.height,
  60170. e.width = n.focusInfo.width),
  60171. e.active = !0
  60172. }),
  60173. viewer.updateScreenSize({
  60174. forceUpdateSize: !0
  60175. }),
  60176. this.focusInfo = null)
  60177. }
  60178. }]),
  60179. t
  60180. }()
  60181. , T1 = [{
  60182. left: .5,
  60183. bottom: .5,
  60184. width: .5,
  60185. height: .5,
  60186. name: "MainView",
  60187. active: !0
  60188. }, {
  60189. left: 0,
  60190. bottom: .5,
  60191. width: .5,
  60192. height: .5,
  60193. name: "top",
  60194. name2: "mapViewport",
  60195. axis: ["x", "y"],
  60196. direction: new Cn(0,0,-1),
  60197. active: !0
  60198. }, {
  60199. left: .5,
  60200. bottom: 0,
  60201. width: .5,
  60202. height: .5,
  60203. name: "right",
  60204. axis: ["y", "z"],
  60205. direction: new Cn(1,0,0),
  60206. active: !0
  60207. }, {
  60208. left: 0,
  60209. bottom: 0,
  60210. width: .5,
  60211. height: .5,
  60212. name: "back",
  60213. axis: ["x", "z"],
  60214. direction: new Cn(0,-1,0),
  60215. active: !0
  60216. }]
  60217. , S1 = new A1;
  60218. S1.split = function() {
  60219. viewer.scene.getActiveCamera();
  60220. var e = viewer.bound;
  60221. e.boundSize,
  60222. e.center;
  60223. viewer.setLimitFar(!1),
  60224. viewer.mapViewer.attachToMainViewer(!0, "split4Screens", "dontSet");
  60225. e = this.splitStart(T1);
  60226. viewer.mapViewer.viewports[0].noPointcloud = !1,
  60227. this.statesBefore = {
  60228. pointDensity: Potree.settings.pointDensity,
  60229. displayMode: Potree.settings.displayMode,
  60230. position: viewer.images360.position,
  60231. target: viewer.scene.view.getPivot()
  60232. },
  60233. viewer.setPointStandardMat(!0, null, !0);
  60234. var n = {
  60235. opacity: new Map
  60236. };
  60237. new Map;
  60238. viewer.scene.pointclouds.forEach(function(e) {
  60239. n.opacity.set(e, e.temp.pointOpacity),
  60240. n.colorType = e.material.activeAttributeName
  60241. });
  60242. function t() {
  60243. var t = this;
  60244. viewer.scene.pointclouds.forEach(function(e) {
  60245. "MainView" == t.name ? (e.material.activeAttributeName = n.colorType,
  60246. e.material.useFilterByNormal = !1,
  60247. e.changePointOpacity(n.opacity.get(e)),
  60248. Potree.settings.pointDensity = "fourViewportsMain") : (e.material.activeAttributeName = "color",
  60249. e.material.useFilterByNormal = !0,
  60250. Potree.settings.pointDensity = "fourViewports",
  60251. e.changePointOpacity(.6))
  60252. })
  60253. }
  60254. e.forEach(function(e) {
  60255. e.beforeRender = t
  60256. }),
  60257. this.enableMap(!1),
  60258. this.enableFloorplan(!1),
  60259. viewer.mapViewer.setViewLimit("expand"),
  60260. Potree.settings.displayMode = "showPointCloud"
  60261. }
  60262. ,
  60263. S1.recover = function() {
  60264. this.unSplit(),
  60265. viewer.setView({
  60266. position: this.statesBefore.position,
  60267. target: this.statesBefore.target,
  60268. duration: 300,
  60269. callback: function() {}
  60270. }),
  60271. viewer.mainViewport.beforeRender = null,
  60272. viewer.setLimitFar(!0);
  60273. var e = viewer.mapViewer.viewports[0];
  60274. viewer.mapViewer.attachToMainViewer(!1),
  60275. e.noPointcloud = !0,
  60276. this.enableMap(Potree.settings.mapEnable),
  60277. this.enableFloorplan(Potree.settings.floorplanEnable),
  60278. this.floorplanListener && (viewer.mapViewer.mapLayer.removeEventListener("floorplanLoaded", this.floorplanListener),
  60279. this.floorplanListener = null),
  60280. Potree.settings.pointDensity = this.statesBefore.pointDensity,
  60281. Potree.settings.isOfficial || (Potree.settings.displayMode = this.statesBefore.displayMode),
  60282. viewer.scene.pointclouds.forEach(function(e) {
  60283. e.material.useFilterByNormal = !1
  60284. }),
  60285. viewer.setPointStandardMat(!1),
  60286. viewer.mapViewer.setViewLimit("standard")
  60287. }
  60288. ,
  60289. S1.updateMapViewerBG = function() {
  60290. var e = viewer.mapViewer.viewports[0];
  60291. this.floorplanEnabled || this.mapEnabled ? (e.background = "overlayColor",
  60292. e.backgroundColor = new Yi(0,0,0),
  60293. e.backgroundOpacity = .5) : (e.background = null,
  60294. e.backgroundColor = null,
  60295. e.backgroundOpacity = null)
  60296. }
  60297. ,
  60298. S1.setFloorplanDisplay = function(e) {
  60299. e.floorplan.setEnable(1 < arguments.length && void 0 !== arguments[1] && arguments[1])
  60300. }
  60301. ,
  60302. S1.enableMap = function(e) {
  60303. viewer.mapViewer.mapLayer.maps.find(function(e) {
  60304. return "map" == e.name
  60305. }).setEnable(!!e),
  60306. this.mapEnabled = e,
  60307. this.updateMapViewerBG()
  60308. }
  60309. ,
  60310. S1.enableFloorplan = function(t) {
  60311. var n = this
  60312. , e = viewer.mapViewer.mapLayer.maps.filter(function(e) {
  60313. return e.name.includes("floorplan")
  60314. });
  60315. this.floorplanListener && viewer.mapViewer.mapLayer.removeEventListener("floorplanLoaded", this.floorplanListener),
  60316. this.floorplanListener = function(e) {
  60317. n.setFloorplanDisplay(e, t)
  60318. }
  60319. ,
  60320. viewer.mapViewer.mapLayer.addEventListener("floorplanLoaded", this.floorplanListener),
  60321. t ? e.forEach(function(e) {
  60322. return n.setFloorplanDisplay({
  60323. floorplan: e
  60324. }, !0)
  60325. }) : e.forEach(function(e) {
  60326. return n.setFloorplanDisplay({
  60327. floorplan: e
  60328. }, !1)
  60329. }),
  60330. t && 0 == e.length && Potree.loadMapEntity("all", !0),
  60331. this.floorplanEnabled = t,
  60332. this.updateMapViewerBG()
  60333. }
  60334. ,
  60335. S1.focusOnPointCloud = function(e) {
  60336. e.bound.getSize(new Cn);
  60337. var t = e.bound.getCenter(new Cn)
  60338. , n = e.panosBound && e.panosBound.center;
  60339. this.focusOnObject(e.bound, t, n),
  60340. viewer.flyToDataset({
  60341. pointcloud: e,
  60342. dontMoveMap: !0,
  60343. duration: 0
  60344. })
  60345. }
  60346. ,
  60347. S1.focusOnObject = function(t, n, e) {
  60348. var i = this;
  60349. viewer.viewports.forEach(function(e) {
  60350. "MainView" == e.name || i.viewportFitBound(e, t, n)
  60351. })
  60352. }
  60353. ;
  60354. var Ou = function() {
  60355. y(i, hn);
  60356. var n = w(i);
  60357. function i(e) {
  60358. var t;
  60359. return O(this, i),
  60360. (t = n.call(this)).list = [],
  60361. t.callback = e.callback,
  60362. t
  60363. }
  60364. return h(i, [{
  60365. key: "undo",
  60366. value: function() {
  60367. var e = this.list.pop();
  60368. e && this.callback && this.callback(e)
  60369. }
  60370. }, {
  60371. key: "redo",
  60372. value: function() {}
  60373. }, {
  60374. key: "writeIn",
  60375. value: function(e) {
  60376. this.list.push(e)
  60377. }
  60378. }, {
  60379. key: "clear",
  60380. value: function() {
  60381. this.list.length = 0
  60382. }
  60383. }]),
  60384. i
  60385. }()
  60386. , C1 = {
  60387. SplitScreen: S1,
  60388. handleState: null,
  60389. bus: new hn,
  60390. prepareRecord: !0,
  60391. writeToHistory: function(e) {
  60392. this.prepareRecord && (this.prepareRecord = !1,
  60393. this.history.writeIn(e))
  60394. },
  60395. applyTemp: function(t) {
  60396. var e = viewer.scene.pointclouds.find(function(e) {
  60397. return e.dataset_id + e.name == t.sid
  60398. });
  60399. e.orientationUser = t.orientationUser,
  60400. e.translateUser = t.translateUser,
  60401. this.setMatrix(e)
  60402. },
  60403. getTemp: function(e) {
  60404. return (e = e || viewer.scene.pointclouds).map(function(e) {
  60405. return {
  60406. sid: e.dataset_id + e.name,
  60407. orientationUser: e.orientationUser,
  60408. translateUser: e.translateUser.clone()
  60409. }
  60410. })
  60411. },
  60412. init: function() {
  60413. var a, o = this;
  60414. viewer.fpControls.addEventListener("transformPointcloud", function(t) {
  60415. if (t.pointclouds[0].dataset_id == Potree.settings.originDatasetId)
  60416. return o.bus.dispatchEvent("forbitMoveOriginDataset");
  60417. if (o.writeToHistory(o.getTemp(t.pointclouds)),
  60418. "translate" == o.handleState)
  60419. t.pointclouds.forEach(function(e) {
  60420. return C1.translate(e, t.moveVec)
  60421. });
  60422. else if ("rotate" == o.handleState)
  60423. if ("pano" == Potree.settings.editType) {
  60424. var n, i = t.intersectStart;
  60425. if (!t.intersect.equals(i)) {
  60426. if (!a)
  60427. return a = {
  60428. orientationUser: t.pointclouds[0].orientationUser,
  60429. pointclouds: t.pointclouds
  60430. },
  60431. void o.bus.dispatchEvent({
  60432. type: "rotateStart",
  60433. startPoint: i
  60434. });
  60435. a.vecStart ? (r = (new Cn).subVectors(t.intersect, i).setZ(0),
  60436. r = Up.getAngle(a.vecStart, r, "z"),
  60437. n = a.orientationUser + r - a.pointclouds[0].orientationUser,
  60438. a.pointclouds.forEach(function(e) {
  60439. C1.rotateAround(i, e, null, n)
  60440. })) : 30 < (e = (new Cn).subVectors(t.intersect, i).setZ(0)).length() * t.camera.zoom && (a.vecStart = e),
  60441. o.bus.dispatchEvent({
  60442. type: "rotate",
  60443. endPoint: t.intersect
  60444. })
  60445. }
  60446. } else {
  60447. var e, r = t.pointclouds[0].translateUser;
  60448. t.intersect.equals(r) || (a ? (e = (new Cn).subVectors(t.intersect, r).setZ(0),
  60449. e = Up.getAngle(a.vecStart, e, "z"),
  60450. e = a.orientationUser + e - a.pointcloud.orientationUser,
  60451. C1.rotate(a.pointcloud, null, e)) : a = {
  60452. orientationUser: t.pointclouds[0].orientationUser,
  60453. vecStart: (new Cn).subVectors(t.intersectStart, r).setZ(0),
  60454. pointcloud: t.pointclouds[0]
  60455. })
  60456. }
  60457. }),
  60458. viewer.fpControls.addEventListener("end", function(e) {
  60459. a = null,
  60460. o.prepareRecord = !0
  60461. }),
  60462. viewer.inputHandler.addEventListener("keydown", function(e) {
  60463. 90 == e.keyCode && e.event.ctrlKey && o.history.undo()
  60464. });
  60465. function e(e) {
  60466. var t;
  60467. !e.drag && o.editing && (t = C1.handleState,
  60468. e.hoverViewport.alignment && t && e.hoverViewport.alignment[t] ? "translate" == t ? e.intersect && e.intersect.location ? viewer.dispatchEvent({
  60469. type: "CursorChange",
  60470. action: "add",
  60471. name: "movePointcloud"
  60472. }) : viewer.dispatchEvent({
  60473. type: "CursorChange",
  60474. action: "remove",
  60475. name: "movePointcloud"
  60476. }) : "rotate" == t && (e.intersect && e.intersect.location ? viewer.dispatchEvent({
  60477. type: "CursorChange",
  60478. action: "add",
  60479. name: "rotatePointcloud"
  60480. }) : viewer.dispatchEvent({
  60481. type: "CursorChange",
  60482. action: "remove",
  60483. name: "rotatePointcloud"
  60484. })) : (viewer.dispatchEvent({
  60485. type: "CursorChange",
  60486. action: "remove",
  60487. name: "movePointcloud"
  60488. }),
  60489. viewer.dispatchEvent({
  60490. type: "CursorChange",
  60491. action: "remove",
  60492. name: "rotatePointcloud"
  60493. })))
  60494. }
  60495. viewer.addEventListener("global_mousemove", e),
  60496. viewer.addEventListener("global_drop", e),
  60497. viewer.addEventListener("updateModelBound", function(e) {
  60498. o.editing && o.SplitScreen.updateCameraOutOfModel()
  60499. })
  60500. },
  60501. setMatrix: function(e) {
  60502. var t = e.position
  60503. , n = e.translateUser
  60504. , i = e.orientationUser
  60505. , t = (new ni).setPosition(t)
  60506. , i = (new ni).makeRotationAxis(new Cn(0,0,1), i)
  60507. , n = (new ni).setPosition(n)
  60508. , n = (new ni).multiplyMatrices(n, i);
  60509. e.transformMatrix = n.clone(),
  60510. e.transformInvMatrix.copy(n).invert(),
  60511. e.rotateMatrix = i,
  60512. e.rotateInvMatrix.copy(i).invert(),
  60513. e.panos.forEach(function(e) {
  60514. return e.transformByPointcloud()
  60515. }),
  60516. n = (new ni).multiplyMatrices(n, t),
  60517. e.matrix = n,
  60518. e.updateMatrixWorld(!0),
  60519. this.editing && C1.changeCallBack && C1.changeCallBack(),
  60520. e.spriteNodeRoot && e.spriteNodeRoot.matrixWorld.copy(e.matrixWorld),
  60521. viewer.updateModelBound(),
  60522. e.getPanosBound()
  60523. },
  60524. rotateAround: function(e, t, n, i) {
  60525. var i = null != i ? i : gn.degToRad(n)
  60526. , r = (new Cn).subVectors(t.translateUser, e)
  60527. , e = (new ni).makeRotationAxis(new Cn(0,0,1), i)
  60528. , e = r.clone().applyMatrix4(e)
  60529. , r = (new Cn).subVectors(e, r);
  60530. this.rotate(t, n, i),
  60531. this.translate(t, r)
  60532. },
  60533. rotate: function(e, t, n) {
  60534. n = null != n ? n : gn.degToRad(t);
  60535. e.orientationUser += n,
  60536. C1.setMatrix(e)
  60537. },
  60538. translate: function(e, t) {
  60539. e.translateUser.add(t),
  60540. C1.setMatrix(e)
  60541. },
  60542. enter: function() {
  60543. this.originData = this.getTemp(),
  60544. this.SplitScreen.split({
  60545. alignment: !0
  60546. }),
  60547. viewer.images360.panos.forEach(function(e) {
  60548. viewer.updateVisible(e.mapMarker, "split4Screens", !1)
  60549. }),
  60550. viewer.viewports.find(function(e) {
  60551. return "mapViewport" == e.name
  60552. }).alignment = {
  60553. rotate: !0,
  60554. translate: !0
  60555. },
  60556. viewer.viewports.find(function(e) {
  60557. return "right" == e.name
  60558. }).alignment = {
  60559. translate: !0
  60560. },
  60561. viewer.viewports.find(function(e) {
  60562. return "back" == e.name
  60563. }).alignment = {
  60564. translate: !0
  60565. },
  60566. this.editing = !0,
  60567. viewer.updateFpVisiDatasets()
  60568. },
  60569. leave: function() {
  60570. var t = this;
  60571. this.switchHandle(null),
  60572. this.originData.forEach(function(e) {
  60573. t.applyTemp(e)
  60574. }),
  60575. this.SplitScreen.recover(),
  60576. viewer.images360.panos.forEach(function(e) {
  60577. viewer.updateVisible(e.mapMarker, "split4Screens", !0)
  60578. }),
  60579. this.editing = !1,
  60580. this.history.clear(),
  60581. viewer.updateFpVisiDatasets(),
  60582. viewer.dispatchEvent({
  60583. type: "CursorChange",
  60584. action: "remove",
  60585. name: "movePointcloud"
  60586. }),
  60587. viewer.dispatchEvent({
  60588. type: "CursorChange",
  60589. action: "remove",
  60590. name: "rotatePointcloud"
  60591. })
  60592. },
  60593. switchHandle: function(e) {
  60594. this.handleState = e,
  60595. viewer.dispatchEvent({
  60596. type: "CursorChange",
  60597. action: "remove",
  60598. name: "movePointcloud"
  60599. }),
  60600. viewer.dispatchEvent({
  60601. type: "CursorChange",
  60602. action: "remove",
  60603. name: "rotatePointcloud"
  60604. }),
  60605. this.bus.dispatchEvent({
  60606. type: "switchHandle",
  60607. state: e
  60608. })
  60609. },
  60610. save: function() {
  60611. function e() {
  60612. t.originData = t.getTemp(),
  60613. viewer.scene.measurements.forEach(function(e) {
  60614. return e.transformByPointcloud()
  60615. }),
  60616. viewer.images360.updateCube(viewer.bound)
  60617. }
  60618. var t = this
  60619. , n = viewer.scene.pointclouds.map(function(e) {
  60620. var t = viewer.transform.lonlatToLocal.inverse(e.translateUser.clone());
  60621. return {
  60622. id: e.dataset_id,
  60623. orientation: e.orientationUser,
  60624. location: [t.x, t.y, t.z]
  60625. }
  60626. });
  60627. return Potree.settings.isOfficial || e(),
  60628. {
  60629. data: n,
  60630. callback: e
  60631. }
  60632. }
  60633. };
  60634. C1.history = new Ou({
  60635. callback: function(e) {
  60636. e.forEach(function(e) {
  60637. C1.applyTemp(e)
  60638. })
  60639. }
  60640. });
  60641. function P1(e) {
  60642. var t;
  60643. return R1 || ((t = F1.load(Potree.resourcePath + "/textures/gridmap.png")).wrapS = t.wrapT = ke,
  60644. R1 = {
  60645. dataset: new Hu({
  60646. color: 812922,
  60647. side: Y,
  60648. opacity: .2,
  60649. transparent: !0,
  60650. depthTest: !1,
  60651. wireframe: !0
  60652. }),
  60653. building: new Hu({
  60654. color: 812922,
  60655. metalness: .2,
  60656. roughness: .8,
  60657. side: Y,
  60658. opacity: .1,
  60659. transparent: !0,
  60660. depthTest: !0
  60661. }),
  60662. buildingSelect: new Hu({
  60663. color: 36582,
  60664. metalness: 0,
  60665. roughness: 1,
  60666. side: Y,
  60667. opacity: .1,
  60668. transparent: !0,
  60669. depthTest: !0
  60670. }),
  60671. floor: new Hu({
  60672. color: 11708469,
  60673. metalness: .1,
  60674. roughness: 1,
  60675. side: Y,
  60676. opacity: .05,
  60677. transparent: !0,
  60678. depthTest: !0
  60679. }),
  60680. floorSelect: new Wp({
  60681. map: t,
  60682. color: 16707151,
  60683. side: Y,
  60684. opacity: 1,
  60685. transparent: !0,
  60686. useDepth: !0,
  60687. clipDistance: 1,
  60688. occlusionDistance: 1,
  60689. maxClipFactor: .4,
  60690. backColor: "#efe"
  60691. }),
  60692. room: new Hu({
  60693. color: "#ff44ee",
  60694. metalness: 0,
  60695. roughness: 1,
  60696. side: Y,
  60697. opacity: .08,
  60698. transparent: !0,
  60699. depthTest: !1
  60700. }),
  60701. roomSelect: new Wp({
  60702. map: t,
  60703. color: "#ff44ee",
  60704. side: Y,
  60705. opacity: 1,
  60706. transparent: !0,
  60707. useDepth: !0,
  60708. clipDistance: 1,
  60709. occlusionDistance: .5,
  60710. maxClipFactor: .6,
  60711. backColor: "#ff88dd"
  60712. })
  60713. }),
  60714. R1[e]
  60715. }
  60716. function D1(e, t, s) {
  60717. var n = this;
  60718. void 0 === t && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),
  60719. t = document),
  60720. Si.call(this),
  60721. this.visible = !1,
  60722. this.domElement = t;
  60723. var i = new k1(s);
  60724. this.add(i);
  60725. var l = new B1;
  60726. this.add(l);
  60727. var r = this;
  60728. this.options = s,
  60729. G("camera", e),
  60730. G("object", void 0),
  60731. G("enabled", !0),
  60732. G("axis", null),
  60733. G("mode", "translate"),
  60734. G("translationSnap", null),
  60735. G("rotationSnap", null),
  60736. G("scaleSnap", null),
  60737. G("space", "world"),
  60738. G("size", 1),
  60739. G("dragging", !1),
  60740. G("showX", !0),
  60741. G("showY", !0),
  60742. G("showZ", !0);
  60743. var u = {
  60744. type: "change"
  60745. }
  60746. , a = {
  60747. type: "mouseDown"
  60748. }
  60749. , o = {
  60750. type: "mouseUp",
  60751. mode: r.mode
  60752. }
  60753. , c = {
  60754. type: "objectChange"
  60755. }
  60756. , d = new sh
  60757. , h = new Cn
  60758. , p = new Cn
  60759. , f = new Sn
  60760. , m = {
  60761. X: new Cn(1,0,0),
  60762. Y: new Cn(0,1,0),
  60763. Z: new Cn(0,0,1)
  60764. }
  60765. , v = new Cn
  60766. , g = new Cn
  60767. , y = new Cn
  60768. , w = new Cn
  60769. , b = new Cn
  60770. , x = new Cn
  60771. , E = 0
  60772. , _ = new Cn
  60773. , M = new Sn
  60774. , A = new Cn
  60775. , T = new Cn
  60776. , S = new Sn
  60777. , C = new Sn
  60778. , P = new Cn
  60779. , D = new Cn
  60780. , k = new Sn
  60781. , B = new Cn
  60782. , L = new Cn
  60783. , R = new Sn
  60784. , F = new Sn
  60785. , I = new Cn
  60786. , O = new Cn
  60787. , z = new Cn
  60788. , N = new Sn
  60789. , U = new Cn;
  60790. function G(t, e) {
  60791. var n = e;
  60792. Object.defineProperty(r, t, {
  60793. get: function() {
  60794. return void 0 !== n ? n : e
  60795. },
  60796. set: function(e) {
  60797. n !== e && (n = e,
  60798. l[t] = e,
  60799. i[t] = e,
  60800. r.dispatchEvent({
  60801. type: t + "-changed",
  60802. value: e
  60803. }),
  60804. r.dispatchEvent(u))
  60805. }
  60806. }),
  60807. r[t] = e,
  60808. l[t] = e,
  60809. i[t] = e
  60810. }
  60811. function H(e) {
  60812. r.enabled && r.pointerHover()
  60813. }
  60814. function V(e) {
  60815. r.enabled && (r.pointerHover(),
  60816. r.pointerDown())
  60817. }
  60818. function j(e) {
  60819. r.enabled && this.dragging && r.pointerMove()
  60820. }
  60821. function W(e) {
  60822. r.enabled && r.pointerUp()
  60823. }
  60824. G("worldPosition", L),
  60825. G("worldPositionStart", D),
  60826. G("worldQuaternion", R),
  60827. G("worldQuaternionStart", k),
  60828. G("cameraPosition", _),
  60829. G("cameraQuaternion", M),
  60830. G("pointStart", v),
  60831. G("pointEnd", g),
  60832. G("rotationAxis", w),
  60833. G("rotationAngle", E),
  60834. G("eye", O),
  60835. t.addEventListener("mousedown", V, !1),
  60836. t.addEventListener("touchstart", V, !1),
  60837. t.addEventListener("mousemove", H, !1),
  60838. t.addEventListener("touchmove", H, !1),
  60839. t.addEventListener("touchmove", j, !1),
  60840. document.addEventListener("mouseup", W, !1),
  60841. t.addEventListener("touchend", W, !1),
  60842. t.addEventListener("touchcancel", W, !1),
  60843. t.addEventListener("touchleave", W, !1),
  60844. viewer.addEventListener("global_drag", function(e) {
  60845. if (n.dragging)
  60846. return n.pointerMove(),
  60847. {
  60848. stopContinue: !0
  60849. }
  60850. }, 10),
  60851. this.dispose = function() {
  60852. t.removeEventListener("mousedown", V),
  60853. t.removeEventListener("touchstart", V),
  60854. t.removeEventListener("mousemove", H),
  60855. t.removeEventListener("mousemove", j),
  60856. t.removeEventListener("touchmove", H),
  60857. t.removeEventListener("touchmove", j),
  60858. document.removeEventListener("mouseup", W),
  60859. t.removeEventListener("touchend", W),
  60860. t.removeEventListener("touchcancel", W),
  60861. t.removeEventListener("touchleave", W),
  60862. this.traverse(function(e) {
  60863. e.geometry && e.geometry.dispose(),
  60864. e.material && e.material.dispose()
  60865. })
  60866. }
  60867. ,
  60868. this.attach = function(e) {
  60869. return this.object = e,
  60870. this.visible = !0,
  60871. this
  60872. }
  60873. ,
  60874. this.detach = function() {
  60875. return this.object = void 0,
  60876. this.visible = !1,
  60877. this.axis = null,
  60878. this
  60879. }
  60880. ,
  60881. this.updateMatrixWorld = function() {
  60882. void 0 !== this.object && (this.object.updateMatrixWorld(),
  60883. this.object.parent.matrixWorld.decompose(T, S, P),
  60884. this.object.matrixWorld.decompose(L, R, I),
  60885. this.object.boundingBox && this.object.boundingBox.getCenter(L).applyMatrix4(this.object.matrixWorld),
  60886. C.copy(S).invert(),
  60887. F.copy(R).invert()),
  60888. this.camera.updateMatrixWorld(),
  60889. this.camera.matrixWorld.decompose(_, M, A),
  60890. O.copy(_).sub(L).normalize(),
  60891. Si.prototype.updateMatrixWorld.call(this)
  60892. }
  60893. ,
  60894. this.pointerHover = function() {
  60895. var e, t;
  60896. viewer.inputHandler.pointer;
  60897. void 0 !== this.object && (this.dragging || (e = (t = viewer.inputHandler.getMouseDirection()).origin,
  60898. t = t.direction,
  60899. d.set(e, t),
  60900. t = d.intersectObjects(i.picker[this.mode].children, !0)[0] || !1,
  60901. this.axis = t ? t.object.name : null))
  60902. }
  60903. ,
  60904. this.pointerDown = function() {
  60905. var e, t;
  60906. viewer.inputHandler.pointer;
  60907. void 0 !== this.object && !0 !== this.dragging && null !== this.axis && (e = (t = viewer.inputHandler.getMouseDirection()).origin,
  60908. t = t.direction,
  60909. d.set(e, t),
  60910. (e = d.intersectObjects([l], !0)[0] || !1) && (t = this.space,
  60911. "scale" === this.mode ? t = "local" : "E" !== this.axis && "XYZE" !== this.axis && "XYZ" !== this.axis || (t = "world"),
  60912. "local" === t && "rotate" === this.mode && (t = this.rotationSnap,
  60913. "X" === this.axis && t && (this.object.rotation.x = Math.round(this.object.rotation.x / t) * t),
  60914. "Y" === this.axis && t && (this.object.rotation.y = Math.round(this.object.rotation.y / t) * t),
  60915. "Z" === this.axis && t && (this.object.rotation.z = Math.round(this.object.rotation.z / t) * t)),
  60916. this.object.updateMatrixWorld(),
  60917. this.object.parent.updateMatrixWorld(),
  60918. z.copy(this.object.position),
  60919. N.copy(this.object.quaternion),
  60920. U.copy(this.object.scale),
  60921. this.object.matrixWorld.decompose(D, k, B),
  60922. this.object.boundingBox && this.object.boundingBox.getCenter(D).applyMatrix4(this.object.matrixWorld),
  60923. v.copy(e.point).sub(D)),
  60924. this.dragging = !0,
  60925. a.mode = this.mode,
  60926. this.dispatchEvent(a))
  60927. }
  60928. ,
  60929. this.pointerMove = function() {
  60930. var e, t, n = viewer.inputHandler.pointer, i = this.axis, r = this.mode, a = this.object, o = this.space;
  60931. "scale" === r ? o = "local" : "E" !== i && "XYZE" !== i && "XYZ" !== i || (o = "world"),
  60932. void 0 === a || null === i || !1 === this.dragging || void 0 !== n.button && 0 !== n.button || (n = (e = viewer.inputHandler.getMouseDirection()).origin,
  60933. e = e.direction,
  60934. d.set(n, e),
  60935. !1 !== (e = d.intersectObjects([l], !0)[0] || !1) && (g.copy(e.point).sub(D),
  60936. "translate" === r ? (y.copy(g).sub(v),
  60937. "local" === o && "XYZ" !== i && y.applyQuaternion(F),
  60938. -1 === i.indexOf("X") && (y.x = 0),
  60939. -1 === i.indexOf("Y") && (y.y = 0),
  60940. -1 === i.indexOf("Z") && (y.z = 0),
  60941. ("local" === o && "XYZ" !== i ? y.applyQuaternion(N) : y.applyQuaternion(C)).divide(P),
  60942. a.position.copy(y).add(z),
  60943. this.translationSnap && ("local" === o && (a.position.applyQuaternion(f.copy(N).invert()),
  60944. -1 !== i.search("X") && (a.position.x = Math.round(a.position.x / this.translationSnap) * this.translationSnap),
  60945. -1 !== i.search("Y") && (a.position.y = Math.round(a.position.y / this.translationSnap) * this.translationSnap),
  60946. -1 !== i.search("Z") && (a.position.z = Math.round(a.position.z / this.translationSnap) * this.translationSnap),
  60947. a.position.applyQuaternion(N)),
  60948. "world" === o && (a.parent && a.position.add(h.setFromMatrixPosition(a.parent.matrixWorld)),
  60949. -1 !== i.search("X") && (a.position.x = Math.round(a.position.x / this.translationSnap) * this.translationSnap),
  60950. -1 !== i.search("Y") && (a.position.y = Math.round(a.position.y / this.translationSnap) * this.translationSnap),
  60951. -1 !== i.search("Z") && (a.position.z = Math.round(a.position.z / this.translationSnap) * this.translationSnap),
  60952. a.parent && a.position.sub(h.setFromMatrixPosition(a.parent.matrixWorld)))),
  60953. a.dispatchEvent({
  60954. type: "position_changed"
  60955. })) : "scale" === r ? (-1 !== i.search("XYZ") ? (t = g.length() / v.length(),
  60956. g.dot(v) < 0 && (t *= -1),
  60957. s.NoScaleZ ? p.set(t, t, 1) : p.set(t, t, t)) : -1 !== i.search("XY") ? (t = g.length() / v.length(),
  60958. g.dot(v) < 0 && (t *= -1),
  60959. p.set(t, t, 1)) : (h.copy(v),
  60960. p.copy(g),
  60961. h.applyQuaternion(F),
  60962. p.applyQuaternion(F),
  60963. p.divide(h),
  60964. -1 === i.search("X") && (p.x = 1),
  60965. -1 === i.search("Y") && (p.y = 1),
  60966. -1 === i.search("Z") && (p.z = 1)),
  60967. a.scale.copy(U).multiply(p),
  60968. this.scaleSnap && (-1 !== i.search("X") && (a.scale.x = Math.round(a.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap),
  60969. -1 !== i.search("Y") && (a.scale.y = Math.round(a.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap),
  60970. -1 !== i.search("Z") && (a.scale.z = Math.round(a.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap)),
  60971. a.dispatchEvent({
  60972. type: "scale_changed"
  60973. })) : "rotate" === r && (y.copy(g).sub(v),
  60974. r = 2 / L.distanceTo(h.setFromMatrixPosition(this.camera.matrixWorld)),
  60975. "E" === i ? (w.copy(O),
  60976. E = g.angleTo(v),
  60977. b.copy(v).normalize(),
  60978. x.copy(g).normalize(),
  60979. E *= x.cross(b).dot(O) < 0 ? 1 : -1) : "XYZE" === i ? (w.copy(y).cross(O).normalize(),
  60980. E = y.dot(h.copy(w).cross(this.eye)) * r) : "X" !== i && "Y" !== i && "Z" !== i || (w.copy(m[i]),
  60981. h.copy(m[i]),
  60982. "local" === o && h.applyQuaternion(R),
  60983. E = y.dot(h.cross(O).normalize()) * r),
  60984. this.rotationSnap && (E = Math.round(E / this.rotationSnap) * this.rotationSnap),
  60985. this.rotationAngle = E,
  60986. "local" === o && "E" !== i && "XYZE" !== i ? (a.quaternion.copy(N),
  60987. a.quaternion.multiply(f.setFromAxisAngle(w, E)).normalize()) : (w.applyQuaternion(C),
  60988. a.quaternion.copy(f.setFromAxisAngle(w, E)),
  60989. a.quaternion.multiply(N).normalize()),
  60990. a.dispatchEvent({
  60991. type: "rotation_changed"
  60992. })),
  60993. this.dispatchEvent(u),
  60994. this.dispatchEvent(c)))
  60995. }
  60996. ,
  60997. this.pointerUp = function(e) {
  60998. this.dragging && null !== this.axis && (o.mode = this.mode,
  60999. this.dispatchEvent(o)),
  61000. this.dragging = !1
  61001. }
  61002. ,
  61003. this.onPointerDown = V,
  61004. this.onPointerMove = j,
  61005. this.onPointerUp = W,
  61006. this.getMode = function() {
  61007. return r.mode
  61008. }
  61009. ,
  61010. this.setMode = function(e) {
  61011. r.mode = e
  61012. }
  61013. ,
  61014. this.setTranslationSnap = function(e) {
  61015. r.translationSnap = e
  61016. }
  61017. ,
  61018. this.setRotationSnap = function(e) {
  61019. r.rotationSnap = e
  61020. }
  61021. ,
  61022. this.setScaleSnap = function(e) {
  61023. r.scaleSnap = e
  61024. }
  61025. ,
  61026. this.setSize = function(e) {
  61027. r.size = e
  61028. }
  61029. ,
  61030. this.setSpace = function(e) {
  61031. r.space = e
  61032. }
  61033. ,
  61034. this.update = function() {
  61035. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")
  61036. }
  61037. }
  61038. function k1(s) {
  61039. Si.call(this);
  61040. var e = new $i({
  61041. depthTest: !(this.type = "TransformControlsGizmo"),
  61042. depthWrite: !1,
  61043. transparent: !0,
  61044. side: Y,
  61045. fog: !1
  61046. })
  61047. , t = new tl({
  61048. depthTest: !1,
  61049. depthWrite: !1,
  61050. transparent: !0,
  61051. fog: !1
  61052. });
  61053. (x = e.clone()).opacity = .15,
  61054. (E = e.clone()).opacity = .33;
  61055. var n = e.clone();
  61056. n.color.set(16711680);
  61057. var i = e.clone();
  61058. i.color.set(65280);
  61059. var r = e.clone();
  61060. r.color.set(255),
  61061. (b = e.clone()).opacity = .35,
  61062. b.color.set(53501);
  61063. var a = b.clone();
  61064. a.color.set(16776960),
  61065. (f = b.clone()).color.set(65535),
  61066. (g = b.clone()).color.set(16711935),
  61067. e.clone().color.set(16776960);
  61068. var o = t.clone();
  61069. o.color.set(16711680);
  61070. var l = t.clone();
  61071. l.color.set(65280);
  61072. var u = t.clone();
  61073. u.color.set(255),
  61074. (m = t.clone()).color.set(65535),
  61075. (v = t.clone()).color.set(16711935);
  61076. var c = t.clone();
  61077. c.color.set(16776960),
  61078. (w = t.clone()).color.set(7895160),
  61079. (y = c.clone()).opacity = .25;
  61080. var d = new kl(0,.05,.2,12,1,!1)
  61081. , e = new Wr(.125,.125,.125);
  61082. function h(e, t) {
  61083. for (var n = new Mr, i = [], r = 0; r <= 64 * t; ++r)
  61084. i.push(0, Math.cos(r / 32 * Math.PI) * e, Math.sin(r / 32 * Math.PI) * e);
  61085. return n.setAttribute("position", new nr(new Float32Array(i),3)),
  61086. n
  61087. }
  61088. function p(e) {
  61089. var t, n = new Si;
  61090. for (t in e)
  61091. for (var i = e[t].length; i--; ) {
  61092. var r = e[t][i][0].clone()
  61093. , a = e[t][i][1]
  61094. , o = e[t][i][2]
  61095. , s = e[t][i][3]
  61096. , l = e[t][i][4];
  61097. r.name = t,
  61098. r.tag = l,
  61099. a && r.position.set(a[0], a[1], a[2]),
  61100. o && r.rotation.set(o[0], o[1], o[2]),
  61101. s && r.scale.set(s[0], s[1], s[2]),
  61102. r.updateMatrix();
  61103. s = r.geometry.clone();
  61104. s.applyMatrix4(r.matrix),
  61105. r.geometry = s,
  61106. r.renderOrder = 1 / 0,
  61107. r.position.set(0, 0, 0),
  61108. r.rotation.set(0, 0, 0),
  61109. r.scale.set(1, 1, 1),
  61110. n.add(r)
  61111. }
  61112. return n
  61113. }
  61114. (t = new Mr).setAttribute("position", new nr(new Float32Array([0, 0, 0, 1, 0, 0]),3));
  61115. var f = {
  61116. X: [[new Hr(d,n), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new sl(t,o)]],
  61117. Y: [[new Hr(d,i), [0, 1, 0], null, null, "fwd"], [new sl(t,l), null, [0, 0, Math.PI / 2]]],
  61118. Z: [[new Hr(d,r), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new sl(t,u), null, [0, -Math.PI / 2, 0]]],
  61119. XY: [[new Hr(new ua(.295,.295),a.clone()), [.15, .15, 0]], [new sl(t,c), [.18, .3, 0], null, [.125, 1, 1]], [new sl(t,c), [.3, .18, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]],
  61120. YZ: [[new Hr(new ua(.295,.295),f.clone()), [0, .15, .15], [0, Math.PI / 2, 0]], [new sl(t,m), [0, .18, .3], [0, 0, Math.PI / 2], [.125, 1, 1]], [new sl(t,m), [0, .3, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]],
  61121. XZ: [[new Hr(new ua(.295,.295),g.clone()), [.15, 0, .15], [-Math.PI / 2, 0, 0]], [new sl(t,v), [.18, 0, .3], null, [.125, 1, 1]], [new sl(t,v), [.3, 0, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]]
  61122. }
  61123. , m = {
  61124. X: [[new Hr(new kl(.2,0,1,4,1,!1),x), [.6, 0, 0], [0, 0, -Math.PI / 2]]],
  61125. Y: [[new Hr(new kl(.2,0,1,4,1,!1),x), [0, .6, 0]]],
  61126. Z: [[new Hr(new kl(.2,0,1,4,1,!1),x), [0, 0, .6], [Math.PI / 2, 0, 0]]],
  61127. XY: [[new Hr(new ua(.4,.4),x), [.2, .2, 0]]],
  61128. YZ: [[new Hr(new ua(.4,.4),x), [0, .2, .2], [0, Math.PI / 2, 0]]],
  61129. XZ: [[new Hr(new ua(.4,.4),x), [.2, 0, .2], [-Math.PI / 2, 0, 0]]]
  61130. }
  61131. , v = {
  61132. START: [[new Hr(new vu(.01,2),E), null, null, null, "helper"]],
  61133. END: [[new Hr(new vu(.01,2),E), null, null, null, "helper"]],
  61134. DELTA: [[new sl(((g = new Mr).setAttribute("position", new nr(new Float32Array([0, 0, 0, 1, 1, 1]),3)),
  61135. g),E), null, null, null, "helper"]],
  61136. X: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  61137. Y: [[new sl(t,E.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  61138. Z: [[new sl(t,E.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  61139. }
  61140. , g = {
  61141. X: [[new sl(h(1, .5),o)], [new Hr(new vu(.04,0),n), [0, 0, .99], null, [1, 3, 1]]],
  61142. Y: [[new sl(h(1, .5),l), null, [0, 0, -Math.PI / 2]], [new Hr(new vu(.04,0),i), [0, 0, .99], null, [3, 1, 1]]],
  61143. Z: [[new sl(h(1, .5),u), null, [0, Math.PI / 2, 0]], [new Hr(new vu(.04,0),r), [.99, 0, 0], null, [1, 3, 1]]],
  61144. E: [[new sl(h(1.25, 1),y), null, [0, Math.PI / 2, 0]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [0, 1.17, 0], [0, 0, 0], [1, 1, .001]]],
  61145. XYZE: [[new sl(h(1, 1),w), null, [0, Math.PI / 2, 0]]]
  61146. }
  61147. , y = {
  61148. AXIS: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  61149. }
  61150. , w = {
  61151. X: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  61152. Y: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  61153. Z: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  61154. E: [[new Hr(new Bu(1.25,.1,2,24),x)]],
  61155. XYZE: [[new Hr(new Tu(.7,10,8),x)]]
  61156. }
  61157. , b = {
  61158. X: [[new Hr(e,n), [.8, 0, 0], [0, 0, -Math.PI / 2]], [new sl(t,o), null, null, [.8, 1, 1]]],
  61159. Y: [[new Hr(e,i), [0, .8, 0]], [new sl(t,l), null, [0, 0, Math.PI / 2], [.8, 1, 1]]],
  61160. Z: [[new Hr(e,r), [0, 0, .8], [Math.PI / 2, 0, 0]], [new sl(t,u), null, [0, -Math.PI / 2, 0], [.8, 1, 1]]],
  61161. XY: [[new Hr(e,a), [.85, .85, 0], null, [2, 2, .2]], [new sl(t,c), [.855, .98, 0], null, [.125, 1, 1]], [new sl(t,c), [.98, .855, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]],
  61162. XYZY: [[new Hr(new Wr(.125,.125,.125),b.clone()), [0, 1.1, 0]]]
  61163. }
  61164. , x = {
  61165. X: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [.5, 0, 0], [0, 0, -Math.PI / 2]]],
  61166. Y: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [0, .5, 0]]],
  61167. Z: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [0, 0, .5], [Math.PI / 2, 0, 0]]],
  61168. XY: [[new Hr(e,x), [.85, .85, 0], null, [3, 3, .2]]],
  61169. XYZY: [[new Hr(new Wr(.2,.2,.2),x), [0, 1.1, 0]]]
  61170. }
  61171. , E = {
  61172. X: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  61173. Y: [[new sl(t,E.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  61174. Z: [[new sl(t,E.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  61175. }
  61176. , _ = new Cn(0,0,0)
  61177. , M = new ci
  61178. , A = new Cn(0,1,0)
  61179. , T = new Cn(0,0,0)
  61180. , S = new ni
  61181. , C = new Sn
  61182. , P = new Sn
  61183. , D = new Sn
  61184. , k = new Cn(1,0,0)
  61185. , B = new Cn(0,1,0)
  61186. , L = new Cn(0,0,1);
  61187. this.gizmo = {},
  61188. this.picker = {},
  61189. this.helper = {},
  61190. this.add(this.gizmo.translate = p(f)),
  61191. this.add(this.gizmo.rotate = p(g)),
  61192. this.add(this.gizmo.scale = p(b)),
  61193. this.add(this.picker.translate = p(m)),
  61194. this.add(this.picker.rotate = p(w)),
  61195. this.add(this.picker.scale = p(x)),
  61196. this.add(this.helper.translate = p(v)),
  61197. this.add(this.helper.rotate = p(y)),
  61198. this.add(this.helper.scale = p(E)),
  61199. this.picker.translate.visible = !1,
  61200. this.picker.rotate.visible = !1,
  61201. this.picker.scale.visible = !1,
  61202. this.updateMatrixWorld = function() {
  61203. var e = this.space
  61204. , t = "local" === (e = "scale" === this.mode ? "local" : e) ? this.worldQuaternion : D;
  61205. this.gizmo.translate.visible = "translate" === this.mode,
  61206. this.gizmo.rotate.visible = "rotate" === this.mode,
  61207. this.gizmo.scale.visible = "scale" === this.mode,
  61208. this.helper.translate.visible = "translate" === this.mode,
  61209. this.helper.rotate.visible = "rotate" === this.mode,
  61210. this.helper.scale.visible = "scale" === this.mode;
  61211. var n = [];
  61212. n = (n = (n = n.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);
  61213. for (var i = 0; i < n.length; i++) {
  61214. var r = n[i]
  61215. , a = !0;
  61216. r.rotation.set(0, 0, 0),
  61217. r.position.copy(this.worldPosition);
  61218. var o = this.worldPosition.distanceTo(this.cameraPosition);
  61219. r.scale.set(1, 1, 1).multiplyScalar(o * this.size / 7),
  61220. "helper" !== r.tag ? (r.quaternion.copy(t),
  61221. "translate" === this.mode || "scale" === this.mode ? (s.dontHideWhenFaceCamera || ("X" !== r.name && "XYZX" !== r.name || .99 < Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10),
  61222. a = !1),
  61223. "Y" !== r.name && "XYZY" !== r.name || .99 < Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10),
  61224. a = !1),
  61225. "Z" !== r.name && "XYZZ" !== r.name || .99 < Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10),
  61226. a = !1),
  61227. "XY" === r.name && Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10),
  61228. a = !1),
  61229. "YZ" === r.name && Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10),
  61230. a = !1),
  61231. "XZ" === r.name && Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10),
  61232. a = !1)),
  61233. -1 !== r.name.search("X") && A.copy(k).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.x *= -1),
  61234. -1 !== r.name.search("Y") && A.copy(B).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.y *= -1),
  61235. -1 !== r.name.search("Z") && A.copy(L).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.z *= -1)) : "rotate" === this.mode && (P.copy(t),
  61236. A.copy(this.eye).applyQuaternion(C.copy(t).invert()),
  61237. -1 !== r.name.search("E") && r.quaternion.setFromRotationMatrix(S.lookAt(this.eye, T, B)),
  61238. "X" === r.name && (C.setFromAxisAngle(k, Math.atan2(-A.y, A.z)),
  61239. C.multiplyQuaternions(P, C),
  61240. r.quaternion.copy(C)),
  61241. "Y" === r.name && (C.setFromAxisAngle(B, Math.atan2(A.x, A.z)),
  61242. C.multiplyQuaternions(P, C),
  61243. r.quaternion.copy(C)),
  61244. "Z" === r.name && (C.setFromAxisAngle(L, Math.atan2(A.y, A.x)),
  61245. C.multiplyQuaternions(P, C),
  61246. r.quaternion.copy(C))),
  61247. a = (a = (a = (a = a && (-1 === r.name.indexOf("X") || this.showX)) && (-1 === r.name.indexOf("Y") || this.showY)) && (-1 === r.name.indexOf("Z") || this.showZ)) && (-1 === r.name.indexOf("E") || this.showX && this.showY && this.showZ),
  61248. viewer.updateVisible(r, "hidden", !!a),
  61249. r.material._opacity = r.material._opacity || r.material.opacity,
  61250. r.material._color = r.material._color || r.material.color.clone(),
  61251. r.material.color.copy(r.material._color),
  61252. r.material.opacity = r.material._opacity,
  61253. this.enabled ? this.axis && (r.name === this.axis || this.axis.split("").some(function(e) {
  61254. return r.name === e
  61255. }) ? r.material.opacity = 1 : r.material.opacity *= .25,
  61256. r.material.color.lerp(new Yi(1,1,1), .5)) : (r.material.opacity *= .5,
  61257. r.material.color.lerp(new Yi(1,1,1), .5))) : (a = !1,
  61258. "AXIS" === r.name ? (r.position.copy(this.worldPositionStart),
  61259. a = !!this.axis,
  61260. "X" === this.axis && (C.setFromEuler(M.set(0, 0, 0)),
  61261. r.quaternion.copy(t).multiply(C),
  61262. .9 < Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) && (a = !1)),
  61263. "Y" === this.axis && (C.setFromEuler(M.set(0, 0, Math.PI / 2)),
  61264. r.quaternion.copy(t).multiply(C),
  61265. .9 < Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) && (a = !1)),
  61266. "Z" === this.axis && (C.setFromEuler(M.set(0, Math.PI / 2, 0)),
  61267. r.quaternion.copy(t).multiply(C),
  61268. .9 < Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) && (a = !1)),
  61269. "XYZE" === this.axis && (C.setFromEuler(M.set(0, Math.PI / 2, 0)),
  61270. A.copy(this.rotationAxis),
  61271. r.quaternion.setFromRotationMatrix(S.lookAt(T, A, B)),
  61272. r.quaternion.multiply(C),
  61273. a = this.dragging),
  61274. "E" === this.axis && (a = !1)) : "START" === r.name ? (r.position.copy(this.worldPositionStart),
  61275. a = this.dragging) : "END" === r.name ? (r.position.copy(this.worldPosition),
  61276. a = this.dragging) : "DELTA" === r.name ? (r.position.copy(this.worldPositionStart),
  61277. r.quaternion.copy(this.worldQuaternionStart),
  61278. _.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),
  61279. _.applyQuaternion(this.worldQuaternionStart.clone().invert()),
  61280. r.scale.copy(_),
  61281. a = this.dragging) : (r.quaternion.copy(t),
  61282. this.dragging ? r.position.copy(this.worldPositionStart) : r.position.copy(this.worldPosition),
  61283. this.axis && (a = -1 !== this.axis.search(r.name))),
  61284. viewer.updateVisible(r, "hidden", !!a))
  61285. }
  61286. Si.prototype.updateMatrixWorld.call(this)
  61287. }
  61288. }
  61289. function B1(e) {
  61290. Hr.call(this, new ua(1e5,1e5,2,2), new $i({
  61291. color: "#ff0000",
  61292. visible: !1,
  61293. wireframe: !1,
  61294. side: Y,
  61295. transparent: !0,
  61296. opacity: .2
  61297. })),
  61298. this.type = "TransformControlsPlane";
  61299. var t = new Cn(1,0,0)
  61300. , n = new Cn(0,1,0)
  61301. , i = new Cn(0,0,1)
  61302. , r = new Cn
  61303. , a = new Cn
  61304. , o = new Cn
  61305. , s = new ni
  61306. , l = new Sn;
  61307. this.updateMatrixWorld = function() {
  61308. var e = this.space;
  61309. switch (this.position.copy(this.worldPosition),
  61310. "scale" === this.mode && (e = "local"),
  61311. t.set(1, 0, 0).applyQuaternion("local" === e ? this.worldQuaternion : l),
  61312. n.set(0, 1, 0).applyQuaternion("local" === e ? this.worldQuaternion : l),
  61313. i.set(0, 0, 1).applyQuaternion("local" === e ? this.worldQuaternion : l),
  61314. o.copy(n),
  61315. this.mode) {
  61316. case "translate":
  61317. case "scale":
  61318. switch (this.axis) {
  61319. case "X":
  61320. o.copy(this.eye).cross(t),
  61321. a.copy(t).cross(o);
  61322. break;
  61323. case "Y":
  61324. o.copy(this.eye).cross(n),
  61325. a.copy(n).cross(o);
  61326. break;
  61327. case "Z":
  61328. o.copy(this.eye).cross(i),
  61329. a.copy(i).cross(o);
  61330. break;
  61331. case "XY":
  61332. a.copy(i);
  61333. break;
  61334. case "YZ":
  61335. a.copy(t);
  61336. break;
  61337. case "XZ":
  61338. o.copy(i),
  61339. a.copy(n);
  61340. break;
  61341. default:
  61342. a.set(0, 0, 0)
  61343. }
  61344. break;
  61345. default:
  61346. a.set(0, 0, 0)
  61347. }
  61348. 0 === a.length() ? this.quaternion.copy(this.cameraQuaternion) : (s.lookAt(r.set(0, 0, 0), a, o),
  61349. this.quaternion.setFromRotationMatrix(s)),
  61350. Si.prototype.updateMatrixWorld.call(this)
  61351. }
  61352. }
  61353. var L1, R1, F1 = new _c, I1 = {
  61354. width2d: 35
  61355. }, O1 = new Yi("#FFF"), z1 = function() {
  61356. y(a, Df);
  61357. var t = w(a);
  61358. function a(e) {
  61359. var n;
  61360. return O(this, a),
  61361. e.dimension = "3d",
  61362. (n = t.call(this, "siteModel_" + e.buildType, e)).midMarkers = [],
  61363. n.buildChildren = [],
  61364. n.holes = [],
  61365. n.parentHoles = [],
  61366. n.mats = {},
  61367. n.panos = n.panos || [],
  61368. n.center,
  61369. "floor" == n.buildType && (n.points = e.points = n.buildParent.points,
  61370. n.buildParent.holes.forEach(function(e) {
  61371. var t = new a({
  61372. buildType: "hole",
  61373. buildParent: g(n),
  61374. originHole: e,
  61375. ifDraw: n.ifDraw || Potree.settings.drawEntityData
  61376. });
  61377. n.parentHoles.push(t),
  61378. n.add(t),
  61379. t.points = e.points
  61380. })),
  61381. "room" != n.buildType && "hole" != n.buildType || (n.restrictArea = n.buildParent),
  61382. n.ifDraw && ("hole" != n.buildType && (n.box = n.createBox(),
  61383. n.add(n.box)),
  61384. n.lineMesh = Sf.createLine([], {
  61385. color: O1
  61386. }),
  61387. n.lineMesh.name = "buildingLines",
  61388. n.lineMesh.visible = !1,
  61389. n.add(n.lineMesh),
  61390. viewer.setObjectLayers(n.lineMesh, "bothMapAndScene"),
  61391. n.addEventListener("dragChange", function(e) {
  61392. n.updateTwoMidMarker(e.index)
  61393. })),
  61394. n.initData(e),
  61395. n
  61396. }
  61397. return h(a, [{
  61398. key: "initData",
  61399. value: function(e) {
  61400. e.ifDraw ? b(v(a.prototype), "initData", this).call(this, e) : e.points && (this.points = e.points)
  61401. }
  61402. }, {
  61403. key: "intersectPointcloudVolume",
  61404. value: function(e) {
  61405. var t = this.getBound()
  61406. , n = e.bound;
  61407. if (!t.intersectsBox(n))
  61408. return 0;
  61409. var i = this.getRealZ()
  61410. , r = i.zMin
  61411. , a = i.zMax
  61412. , o = Math.min(r, n.min.z)
  61413. , t = Math.max(a, n.max.z)
  61414. , i = a - r + (n.max.z - n.min.z) - (t - o)
  61415. , a = e.getUnrotBoundPoint()
  61416. , s = 0
  61417. , r = this.getArea()
  61418. , n = Math.abs(Up.getArea(a));
  61419. Up.getPolygonsMixedRings([this.points, a]).forEach(function(e) {
  61420. s += e.area
  61421. });
  61422. var t = 0
  61423. , o = this.holes.concat(this.parentHoles)
  61424. , e = 0
  61425. , l = 0;
  61426. return 0 < o.length && (e = this.getHolesArea(),
  61427. a = [].concat([a]),
  61428. Up.getPolygonsMixedRings(a).forEach(function(e) {
  61429. l += e.area
  61430. }),
  61431. t = e + n - l),
  61432. (r + n - s - t) * i
  61433. }
  61434. }, {
  61435. key: "addHole",
  61436. value: function() {
  61437. var n = this
  61438. , i = new a({
  61439. buildType: "hole",
  61440. zMin: this.zMin,
  61441. zMax: this.zMax,
  61442. points: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [],
  61443. buildParent: this,
  61444. ifDraw: this.ifDraw || Potree.settings.drawEntityData
  61445. });
  61446. return this.holes.push(i),
  61447. "building" == this.buildType && this.buildChildren.forEach(function(e) {
  61448. var t = new a({
  61449. buildType: "hole",
  61450. zMin: n.zMin,
  61451. zMax: n.zMax,
  61452. buildParent: e,
  61453. originHole: i,
  61454. ifDraw: n.ifDraw || Potree.settings.drawEntityData
  61455. });
  61456. e.parentHoles.push(t),
  61457. e.add(t),
  61458. t.points = i.points
  61459. }),
  61460. this.add(i),
  61461. this.update(),
  61462. i
  61463. }
  61464. }, {
  61465. key: "removeHole",
  61466. value: function(e) {
  61467. var i = this;
  61468. e.dispose(),
  61469. "building" == this.buildType && this.buildChildren.forEach(function(e) {
  61470. var t = e.parentHoles.find(function(e) {
  61471. return e.originHole == i
  61472. })
  61473. , n = e.parentHoles.indexOf(t);
  61474. -1 < n && e.parentHoles.splice(n, 1),
  61475. t.dispose()
  61476. });
  61477. var t = this.holes.indexOf(e);
  61478. -1 < t && this.holes.splice(t, 1),
  61479. this.remove(e),
  61480. this.update()
  61481. }
  61482. }, {
  61483. key: "createBox",
  61484. value: function() {
  61485. var e = new Sl;
  61486. this.mats.boxDefault = P1(this.buildType),
  61487. this.mats.boxSelected = P1(this.buildType + "Select");
  61488. e = new Hr(e,this.mats.boxDefault);
  61489. return e.name = "buildingBox",
  61490. "floor" == this.buildType ? viewer.setObjectLayers(e, "siteModelMapUnvisi") : viewer.setObjectLayers(e, "bothMapAndScene"),
  61491. e
  61492. }
  61493. }, {
  61494. key: "addMarker",
  61495. value: function() {
  61496. var n = this
  61497. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  61498. if ("floor" != this.buildType) {
  61499. var i = new qp({
  61500. mat: this.getMarkerMaterial("default"),
  61501. renderOrder: 3,
  61502. sizeInfo: I1,
  61503. dontFixOrient: !0,
  61504. name: "building_marker"
  61505. });
  61506. return viewer.setObjectLayers(i, "siteModeOnlyMapVisi"),
  61507. e.marker = i,
  61508. b(v(a.prototype), "addMarker", this).call(this, e),
  61509. this.selected || viewer.updateVisible(i, "select", !1),
  61510. i.addEventListener("addHoverEvent", function e(t) {
  61511. i.addEventListener("click", function(e) {
  61512. n.dispatchEvent({
  61513. type: "clickMarker",
  61514. marker: i
  61515. })
  61516. }),
  61517. i.addEventListener("clickSelect", function(e) {
  61518. n.setMarkerSelected(i, e.state ? "select" : "unselect")
  61519. }),
  61520. i.removeEventListener("addHoverEvent", e)
  61521. }),
  61522. this.isNew || i.dispatchEvent("addHoverEvent"),
  61523. i
  61524. }
  61525. }
  61526. }, {
  61527. key: "removeMarker",
  61528. value: function(e) {
  61529. var t = this;
  61530. b(v(a.prototype), "removeMarker", this).call(this, e),
  61531. this.isNew || (this.midMarkers.forEach(function(e) {
  61532. return t.remove(e)
  61533. }),
  61534. this.midMarkers = [],
  61535. this.addMidMarkers()),
  61536. this.update(),
  61537. 2 == this.points.length && this.box && (this.box.geometry = new Sl)
  61538. }
  61539. }, {
  61540. key: "addMidMarker",
  61541. value: function(e, t) {
  61542. var i = this;
  61543. if ("floor" != this.buildType) {
  61544. var r = new qp({
  61545. mat: this.getMarkerMaterial("midPrepare"),
  61546. sizeInfo: I1,
  61547. dontFixOrient: !0,
  61548. name: "building_midMarker"
  61549. });
  61550. this.midMarkers = [].concat(Q(this.midMarkers.slice(0, e)), [r], Q(this.midMarkers.slice(e, this.midMarkers.length))),
  61551. r.renderOrder = 3,
  61552. viewer.setObjectLayers(r, "siteModeOnlyMapVisi");
  61553. return r.addEventListener("drag", function(e) {
  61554. var t = i.midMarkers.indexOf(r)
  61555. , n = i.addMarker({
  61556. index: t + 1,
  61557. point: r.position.clone()
  61558. });
  61559. i.addMidMarker(t + 1, new Cn),
  61560. i.updateTwoMidMarker(t + 1),
  61561. i.setMarkerSelected(r, "unhover"),
  61562. viewer.inputHandler.startDragging(n, {})
  61563. }),
  61564. r.addEventListener("mouseover", function(e) {
  61565. i.setMarkerSelected(e.object, "hover", "single"),
  61566. viewer.dispatchEvent({
  61567. type: "CursorChange",
  61568. action: "add",
  61569. name: "markerMove"
  61570. })
  61571. }),
  61572. r.addEventListener("mouseleave", function(e) {
  61573. i.setMarkerSelected(e.object, "unhover", "single"),
  61574. viewer.dispatchEvent({
  61575. type: "CursorChange",
  61576. action: "remove",
  61577. name: "markerMove"
  61578. })
  61579. }),
  61580. this.add(r),
  61581. this.updateMarker(r, t),
  61582. this.selected || viewer.updateVisible(r, "select", !1),
  61583. r
  61584. }
  61585. }
  61586. }, {
  61587. key: "addMidMarkers",
  61588. value: function() {
  61589. var i = this
  61590. , r = this.points.length;
  61591. this.points.forEach(function(e, t) {
  61592. var n = i.points[(t + 1) % r]
  61593. , n = (new Cn).addVectors(e, n).multiplyScalar(.5);
  61594. i.addMidMarker(t, n)
  61595. })
  61596. }
  61597. }, {
  61598. key: "updateTwoMidMarker",
  61599. value: function(e) {
  61600. var t, n, i, r;
  61601. this.midMarkers.length && (r = this.points.length,
  61602. n = this.points[(e - 1 + r) % r],
  61603. t = this.points[(e + 1) % r],
  61604. i = this.points[e],
  61605. n = (new Cn).addVectors(n, i).multiplyScalar(.5),
  61606. i = (new Cn).addVectors(t, i).multiplyScalar(.5),
  61607. r = this.midMarkers[(e - 1 + r) % r],
  61608. e = this.midMarkers[e],
  61609. this.updateMarker(r, n),
  61610. this.updateMarker(e, i))
  61611. }
  61612. }, {
  61613. key: "dispose",
  61614. value: function() {
  61615. b(v(a.prototype), "dispose", this).call(this),
  61616. this.box && this.box.geometry.dispose(),
  61617. this.lineMesh && this.lineMesh.geometry.dispose(),
  61618. this.holes.forEach(function(e) {
  61619. return e.dispose()
  61620. }),
  61621. this.parentHoles.forEach(function(e) {
  61622. return e.dispose()
  61623. }),
  61624. this.dispatchEvent("dispose")
  61625. }
  61626. }, {
  61627. key: "updateBox",
  61628. value: function() {
  61629. var e, t;
  61630. this.box && (this.box.geometry.dispose(),
  61631. e = "room" == this.buildType ? .11 : "floor" == this.buildType ? .082 : .2,
  61632. 3 <= this.points.length && (t = this.holes.concat(this.parentHoles).filter(function(e) {
  61633. return 2 < e.points.length
  61634. }).map(function(e) {
  61635. return e.points
  61636. }),
  61637. this.box.geometry = Cf.getExtrudeGeo(this.points, t, {
  61638. depth: this.zMax - this.zMin - e,
  61639. UVGenerator: new N1
  61640. }),
  61641. "building" == this.buildType ? this.box.position.z = this.zMin - e / 2 : this.box.position.z = this.zMin + e / 2))
  61642. }
  61643. }, {
  61644. key: "update",
  61645. value: function() {
  61646. var n = this
  61647. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  61648. b(v(a.prototype), "update", this).call(this, "floor" != this.buildType && e.ifUpdateMarkers);
  61649. var i = this.points.length;
  61650. this.originHole && (this.points = this.originHole.points),
  61651. "hole" == this.buildType && (this.zMin = this.buildParent.zMin,
  61652. this.zMax = this.buildParent.zMax),
  61653. e.dontUpdateBox || ("hole" == this.buildType ? ("building" == this.buildParent.buildType && this.buildParent.buildChildren.forEach(function(e) {
  61654. e = e.parentHoles.find(function(e) {
  61655. return e.originHole == n
  61656. });
  61657. e && e.update()
  61658. }),
  61659. this.buildParent) : this).updateBox();
  61660. var r = [];
  61661. this.points.forEach(function(e, t) {
  61662. r.push(e.clone().setZ(n.zMin), e.clone().setZ(n.zMax));
  61663. t = n.points[(t + 1) % i];
  61664. t && (r.push(e.clone().setZ(n.zMax), t.clone().setZ(n.zMax)),
  61665. r.push(e.clone().setZ(n.zMin), t.clone().setZ(n.zMin)))
  61666. }),
  61667. Sf.moveLine(this.lineMesh, r),
  61668. e.dontUpdateChildren || ("building" == this.buildType && this.buildChildren.forEach(function(e) {
  61669. e.points = n.points,
  61670. e.update()
  61671. }),
  61672. this.holes.concat(this.parentHoles).forEach(function(e) {
  61673. e.update({
  61674. dontUpdateBox: !0
  61675. })
  61676. }))
  61677. }
  61678. }, {
  61679. key: "getHolesArea",
  61680. value: function() {
  61681. var e, t = this.holes.concat(this.parentHoles), n = 0;
  61682. return 2 <= t.length ? (e = t.map(function(e) {
  61683. return e.points
  61684. }),
  61685. (e = Up.getPolygonsMixedRings(e, !0)).forEach(function(e) {
  61686. n += e.area
  61687. }),
  61688. e = e.map(function(e) {
  61689. return e.points
  61690. })) : (e = t.map(function(e) {
  61691. return e.points
  61692. })).forEach(function(e) {
  61693. return n += Math.abs(Up.getArea(e))
  61694. }),
  61695. n
  61696. }
  61697. }, {
  61698. key: "getArea",
  61699. value: function(e) {
  61700. return Math.abs(Up.getArea(this.points)) - (e ? this.getHolesArea() : 0)
  61701. }
  61702. }, {
  61703. key: "getVolume",
  61704. value: function(e) {
  61705. var t = this.getRealZ()
  61706. , n = t.zMin
  61707. , n = t.zMax - n;
  61708. return isNaN(n) && (n = 0),
  61709. this.getArea(e) * n
  61710. }
  61711. }, {
  61712. key: "getRealZ",
  61713. value: function() {
  61714. if ("building" == this.buildType)
  61715. var e = this.buildChildren[this.buildChildren.length - 1]
  61716. , t = this.buildChildren[0]
  61717. , t = t ? t.zMin : 0
  61718. , e = e ? e.zMax : 0;
  61719. else {
  61720. if ("hole" == this.buildType)
  61721. return this.buildParent.getRealZ();
  61722. t = this.zMin,
  61723. e = this.zMax
  61724. }
  61725. return {
  61726. zMin: t,
  61727. zMax: e
  61728. }
  61729. }
  61730. }, {
  61731. key: "getBound",
  61732. value: function() {
  61733. var t = new kn
  61734. , e = this.getRealZ()
  61735. , n = e.zMin
  61736. , i = e.zMax;
  61737. return ("floor" == this.buildType ? this.buildParent : this).points.forEach(function(e) {
  61738. t.expandByPoint(e.clone().setZ(n)),
  61739. t.expandByPoint(e.clone().setZ(i))
  61740. }),
  61741. t
  61742. }
  61743. }, {
  61744. key: "getMarkerMaterial",
  61745. value: function(e) {
  61746. return (L1 = L1 || {
  61747. default: new $i({
  61748. transparent: !0,
  61749. color: O1,
  61750. opacity: .8,
  61751. map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"),
  61752. depthTest: !1
  61753. }),
  61754. midPrepare: new $i({
  61755. transparent: !0,
  61756. color: O1,
  61757. opacity: .4,
  61758. map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"),
  61759. depthTest: !1
  61760. }),
  61761. hover: new $i({
  61762. transparent: !0,
  61763. color: O1,
  61764. opacity: 1,
  61765. map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"),
  61766. depthTest: !1
  61767. }),
  61768. select: new $i({
  61769. transparent: !0,
  61770. color: new Yi("#00C8AF"),
  61771. opacity: 1,
  61772. map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"),
  61773. depthTest: !1
  61774. })
  61775. })[e]
  61776. }
  61777. }, {
  61778. key: "setMarkerSelected",
  61779. value: function(e, t, n) {
  61780. "select" == t ? (e.selected = !0,
  61781. e.material = this.getMarkerMaterial("select")) : "unselect" == t ? (e.selected = !1,
  61782. e.material = this.getMarkerMaterial("default")) : e.selected || ("hover" == t ? e.material = this.getMarkerMaterial("hover") : "unhover" == t && (e.name.includes("mid") ? e.material = this.getMarkerMaterial("midPrepare") : e.material = this.getMarkerMaterial("default")))
  61783. }
  61784. }, {
  61785. key: "select",
  61786. value: function() {
  61787. this.selected || (this.box && (this.box.material = this.mats.boxSelected),
  61788. "building" == this.buildType || "floor" == this.buildType ? (this.buildChildren.forEach(function(e) {
  61789. e.lineMesh.visible = !0
  61790. }),
  61791. "floor" == this.buildType && (viewer.setObjectLayers(this.box, "bothMapAndScene"),
  61792. viewer.setObjectLayers(this.buildParent.box, "siteModelMapUnvisi"))) : "room" == this.buildType && (viewer.setObjectLayers(this.buildParent.box, "bothMapAndScene"),
  61793. viewer.setObjectLayers(this.buildParent.buildParent.box, "siteModelMapUnvisi")),
  61794. this.lineMesh.visible = !0,
  61795. this.markers && this.markers.forEach(function(e) {
  61796. return viewer.updateVisible(e, "select", !0)
  61797. }),
  61798. this.midMarkers && this.midMarkers.forEach(function(e) {
  61799. return e.visible = !0
  61800. }),
  61801. this.holes.concat(this.parentHoles).forEach(function(e) {
  61802. return e.select()
  61803. }),
  61804. this.selected = !0,
  61805. this.dispatchEvent({
  61806. type: "select"
  61807. }))
  61808. }
  61809. }, {
  61810. key: "unselect",
  61811. value: function() {
  61812. this.selected && (this.box && (this.box.material = this.mats.boxDefault),
  61813. "building" == this.buildType || "floor" == this.buildType ? (this.buildChildren.forEach(function(e) {
  61814. e.lineMesh.visible = !1
  61815. }),
  61816. "floor" == this.buildType && (viewer.setObjectLayers(this.box, "siteModelMapUnvisi"),
  61817. viewer.setObjectLayers(this.buildParent.box, "bothMapAndScene"))) : "room" == this.buildType && (viewer.setObjectLayers(this.buildParent.box, "siteModelMapUnvisi"),
  61818. viewer.setObjectLayers(this.buildParent.buildParent.box, "bothMapAndScene")),
  61819. this.lineMesh.visible = !1,
  61820. this.markers && this.markers.forEach(function(e) {
  61821. return viewer.updateVisible(e, "select", !1)
  61822. }),
  61823. this.midMarkers && this.midMarkers.forEach(function(e) {
  61824. return e.visible = !1
  61825. }),
  61826. this.holes.concat(this.parentHoles).forEach(function(e) {
  61827. return e.unselect()
  61828. }),
  61829. this.selected = !1,
  61830. this.dispatchEvent({
  61831. type: "unselect"
  61832. }))
  61833. }
  61834. }, {
  61835. key: "ifContainsPoint",
  61836. value: function(e) {
  61837. var t = this
  61838. , n = this.getRealZ()
  61839. , i = n.zMin
  61840. , n = n.zMax;
  61841. if (!(e.z < i || e.z > n)) {
  61842. n = this.holes.concat(this.parentHoles).filter(function(e) {
  61843. return e != t && 2 < e.points.length
  61844. }).map(function(e) {
  61845. return e.points
  61846. });
  61847. return !!Up.isPointInArea(this.points, n, e)
  61848. }
  61849. }
  61850. }]),
  61851. a
  61852. }(), N1 = function() {
  61853. function e() {
  61854. O(this, e),
  61855. this.a = new Cn,
  61856. this.b = new Cn,
  61857. this.c = new Cn,
  61858. this.d = new Cn
  61859. }
  61860. return h(e, [{
  61861. key: "generateTopUV",
  61862. value: function(e, t, n, i, r) {
  61863. return [new yn(t[3 * n],t[3 * n + 1]), new yn(t[3 * i],t[3 * i + 1]), new yn(t[3 * r],t[3 * r + 1])]
  61864. }
  61865. }, {
  61866. key: "generateSideWallUV",
  61867. value: function(e, t, n, i, r, a) {
  61868. this.a.set(t[3 * n], t[3 * n + 1], t[3 * n + 2]),
  61869. this.b.set(t[3 * i], t[3 * i + 1], t[3 * i + 2]),
  61870. this.c.set(t[3 * r], t[3 * r + 1], t[3 * r + 2]),
  61871. this.d.set(t[3 * a], t[3 * a + 1], t[3 * a + 2]);
  61872. r = this.a.x !== this.b.x,
  61873. t = r ? this.b : this.d,
  61874. a = this.a.distanceTo(t),
  61875. t = t.distanceTo(this.c);
  61876. return [new yn(this.a.x,0), r ? new yn(this.a.x + a,0) : new yn(this.a.x,t), new yn(this.a.x + a,t), r ? new yn(this.a.x,t) : new yn(this.a.x + a,0)]
  61877. }
  61878. }]),
  61879. e
  61880. }(), U1 = {
  61881. zMin: -T.map.cameraHeight,
  61882. zMax: T.map.cameraHeight
  61883. }, G1 = {
  61884. bus: new hn,
  61885. entities: [],
  61886. buildings: [],
  61887. meshGroup: new Si,
  61888. inEntity: null,
  61889. lastPos: new Cn(1 / 0,1 / 0,1 / 0),
  61890. init: function() {
  61891. var n = this;
  61892. viewer.scene.scene.add(this.meshGroup),
  61893. this.meshGroup.name = "siteModel",
  61894. this.SplitScreen = S1,
  61895. "pano" != Potree.settings.editType && (this.createHeightPull(),
  61896. Potree.settings.isTest && viewer.addEventListener("allLoaded", function() {
  61897. viewer.scene.pointclouds.forEach(function(e) {
  61898. var t = e.getUnrotBoundPoint()
  61899. , e = new z1({
  61900. name: "数据集tightBound_" + e.dataset_id,
  61901. points: t,
  61902. buildType: "dataset",
  61903. zMax: e.bound.max.z,
  61904. zMin: e.bound.min.z,
  61905. ifDraw: !0
  61906. });
  61907. n.meshGroup.add(e)
  61908. })
  61909. }),
  61910. Potree.settings.isOfficial && viewer.addEventListener("camera_changed", function(e) {
  61911. e.changeInfo.positionChanged && n.updateEntityAt()
  61912. }),
  61913. viewer.inputHandler.addEventListener("keydown", function(e) {
  61914. var t;
  61915. e.keyCode != ym.BACKSPACE && e.keyCode != ym.DELETE || n.selectedMarker && (e = (t = n.selectedMarker.parent).markers.indexOf(n.selectedMarker),
  61916. t.removeMarker(e),
  61917. t.points.length < 2 && n.startInsertion("resume", t))
  61918. }))
  61919. },
  61920. updateEntityAt: function(n) {
  61921. function e() {
  61922. var e = viewer.mainViewport.view.position;
  61923. i.lastPos.copy(e);
  61924. var t = "showPanos" == Potree.settings.displayMode ? viewer.images360.currentPano : e
  61925. , e = i.pointInWhichEntity(t, "room");
  61926. return !n && i.inEntity == e || (i.inEntity,
  61927. i.inEntity = e,
  61928. i.bus.dispatchEvent({
  61929. type: "buildingChange",
  61930. entity: e
  61931. }),
  61932. t = i.currentFloor,
  61933. e = e ? "floor" == e.buildType ? e : "room" == e.buildType ? e.buildParent : null : null,
  61934. !n && e == t || (i.currentFloor = e,
  61935. i.bus.dispatchEvent({
  61936. type: "FloorChange",
  61937. currentFloor: e
  61938. }))),
  61939. !(n = !1)
  61940. }
  61941. var i = this;
  61942. n ? e() : Fm.intervalTool.isWaiting("sitemodelCameraInterval", e, 500)
  61943. },
  61944. enter: function() {
  61945. Potree.Log("sitemodel enter"),
  61946. this.clear(),
  61947. this.editing = !0,
  61948. viewer.updateFpVisiDatasets();
  61949. var e = viewer.mapViewer.viewports[0];
  61950. this.SplitScreen.split({
  61951. siteModel: !0
  61952. }),
  61953. viewer.viewports.forEach(function(e) {
  61954. "mapViewport" != e.name && e.layersAdd("siteModelMapUnvisi"),
  61955. "right" != e.name && "back" != e.name || e.layersAdd("siteModeSideVisi")
  61956. }),
  61957. viewer.images360.panos.forEach(function(e) {
  61958. viewer.setObjectLayers(e.marker, "siteModelMapUnvisi")
  61959. }),
  61960. e.layersAdd("siteModeOnlyMapVisi")
  61961. },
  61962. leave: function() {
  61963. Potree.Log("sitemodel leave");
  61964. var e = viewer.mapViewer.viewports[0];
  61965. this.SplitScreen.recover(),
  61966. viewer.viewports.forEach(function(e) {
  61967. "mapViewport" != e.name && e.layersRemove("siteModelMapUnvisi"),
  61968. "right" != e.name && "back" != e.name || e.layersRemove("siteModeSideVisi")
  61969. }),
  61970. viewer.images360.panos.forEach(function(e) {
  61971. viewer.setObjectLayers(e.marker, "sceneObjects")
  61972. }),
  61973. e.layersRemove("siteModeOnlyMapVisi"),
  61974. this.clear(),
  61975. this.editing = !1,
  61976. this.updateEntityAt(!0),
  61977. viewer.updateFpVisiDatasets()
  61978. },
  61979. addFloor: function(e, t, n, i) {
  61980. var r, a;
  61981. 0 == e.buildChildren.length ? r = (a = e.zMin) + Potree.config.siteModel.floorHeightDefault : "bottom" == t ? a = (r = e.buildChildren[0].zMin) - Potree.config.siteModel.floorHeightDefault : r = (a = e.buildChildren[e.buildChildren.length - 1].zMax) + Potree.config.siteModel.floorHeightDefault;
  61982. i = new z1({
  61983. buildType: "floor",
  61984. zMin: a,
  61985. zMax: r,
  61986. buildParent: e,
  61987. sid: n,
  61988. name: i,
  61989. ifDraw: !0
  61990. });
  61991. return i.update(),
  61992. this.addEntity(i, e),
  61993. this.selected == e && (e.unselect(),
  61994. e.select()),
  61995. i
  61996. },
  61997. startInsertion: function(t, e, n, i, r, a) {
  61998. var o, s, l, u, c, d = this, h = viewer.mapViewer.viewports[0];
  61999. "resume" == t && (l = !0,
  62000. t = (u = e).buildType,
  62001. u.reDraw(0),
  62002. u.isNew = !0),
  62003. l || ("hole" == t || "room" == t ? (o = e.zMin,
  62004. s = e.zMax) : "building" == t && (e = null,
  62005. o = viewer.bound.boundingBox.min.z,
  62006. s = viewer.bound.boundingBox.min.z),
  62007. "hole" == t ? ((u = e.addHole()).isNew = !0,
  62008. this.selectEntity(e),
  62009. u.select(),
  62010. console.log("挖洞 ", u.uuid)) : ((u = new z1({
  62011. buildType: t,
  62012. zMin: o,
  62013. zMax: s,
  62014. buildParent: e,
  62015. sid: n,
  62016. name: i,
  62017. ifDraw: !0
  62018. })).isNew = !0,
  62019. this.selectEntity(u)),
  62020. this.addEntity(u, e));
  62021. var p = function() {
  62022. viewer.removeEventListener("cancel_insertions", m),
  62023. u.removeEventListener("unselect", m),
  62024. clearTimeout(c),
  62025. u.editStateChange(!1),
  62026. r && r(u)
  62027. }
  62028. , f = function() {
  62029. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  62030. return e.remove ? (p(),
  62031. d.removeEntity(u)) : !e.remain && !e.finish && !e.remove && u.markers.length <= 3 ? (u.reDraw(1),
  62032. viewer.updateVisible(u.markers[0], "unMove", !1),
  62033. u.addEventListener("dragChange", function e() {
  62034. viewer.updateVisible(u.markers[0], "unMove", !0),
  62035. u.removeEventListener("dragChange", e)
  62036. }),
  62037. void u.continueDrag(u.markers[0], e)) : (p(),
  62038. e.remain || !e.remove && 3 < u.markers.length ? (u.removeMarker(u.points.length - 1),
  62039. u.markers.forEach(function(e) {
  62040. e.dispatchEvent("addHoverEvent")
  62041. }),
  62042. "room" == t && d.fitPullBox(),
  62043. u.isNew = !1,
  62044. u.addMidMarkers()) : d.removeEntity(u),
  62045. u)
  62046. }
  62047. , m = function e(t) {
  62048. u.removeEventListener("unselect", e),
  62049. viewer.inputHandler.drag ? (viewer.inputHandler.drag.object.dispatchEvent({
  62050. type: "drop",
  62051. drag: viewer.inputHandler.drag,
  62052. viewer: viewer,
  62053. pressDistance: 0,
  62054. button: C.RIGHT
  62055. }),
  62056. viewer.inputHandler.drag = null) : f({
  62057. remain: !0
  62058. }),
  62059. viewer.inputHandler.drag = null
  62060. };
  62061. viewer.dispatchEvent("cancel_insertions"),
  62062. viewer.addEventListener("cancel_insertions", m),
  62063. u.addEventListener("unselect", m);
  62064. var v = u.addMarker({
  62065. point: new Cn(0,0,0)
  62066. });
  62067. return viewer.updateVisible(v, "unMove", !1),
  62068. u.addEventListener("dragChange", function e() {
  62069. viewer.updateVisible(v, "unMove", !0),
  62070. u.removeEventListener("dragChange", e)
  62071. }),
  62072. v.isDragging = !0,
  62073. viewer.inputHandler.startDragging(v, {
  62074. dragViewport: h,
  62075. endDragFun: function(e) {
  62076. var t;
  62077. e.button == C.LEFT ? (t = u.addMarker({
  62078. point: u.points[u.points.length - 1].clone()
  62079. }),
  62080. u.continueDrag(t, e)) : e.button === C.RIGHT && (e.pressDistance < Potree.config.clickMaxDragDis ? f(e) : u.continueDrag(null, e))
  62081. },
  62082. notPressMouse: !0
  62083. }),
  62084. u
  62085. },
  62086. getPreDealData: function(e, t, n, i, r, a) {
  62087. var o = this
  62088. , s = viewer.bound.boundingBox;
  62089. return "building" == r && i ? (console.log("空间模型未编辑过, 初始化了一个"),
  62090. e = [new Cn(s.min.x,s.min.y,0), new Cn(s.max.x,s.min.y,0), new Cn(s.max.x,s.max.y,0), new Cn(s.min.x,s.max.y,0)],
  62091. t = s.min.z,
  62092. n = s.max.z) : (e = e.map(function(e) {
  62093. return o.transform(e, "fromDataset")
  62094. }),
  62095. "floor" == r && i && (t = s.min.z,
  62096. n = s.max.z)),
  62097. {
  62098. points: e,
  62099. zMax: n,
  62100. zMin: t
  62101. }
  62102. },
  62103. resetFromData: function(t) {
  62104. var n = this
  62105. , e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []
  62106. , i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : []
  62107. , r = 3 < arguments.length ? arguments[3] : void 0
  62108. , a = 4 < arguments.length ? arguments[4] : void 0;
  62109. return e = n.getPreDealData(e, r, a, n.autoBuild, t.buildType, t.buildParent),
  62110. r = e.points,
  62111. a = e.zMax,
  62112. e = e.zMin,
  62113. "floor" != t.buildType && (t.points = r),
  62114. "room" == t.buildType ? (t.zMin = e,
  62115. t.zMax = a) : "floor" == t.buildType && (e = t.zMin + (a - e),
  62116. G1.changeZ(t, "zMax", e)),
  62117. t.holes.forEach(function(e) {
  62118. t.removeHole(e)
  62119. }),
  62120. i.forEach(function(e) {
  62121. e = e.map(function(e) {
  62122. return n.transform(e, "fromDataset")
  62123. });
  62124. t.addHole(e).addMidMarkers()
  62125. }),
  62126. t.update(),
  62127. t
  62128. },
  62129. createFromData: function(o, s, l, u) {
  62130. var c = this
  62131. , e = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : []
  62132. , d = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : []
  62133. , t = 6 < arguments.length ? arguments[6] : void 0
  62134. , n = 7 < arguments.length ? arguments[7] : void 0
  62135. , h = 8 < arguments.length ? arguments[8] : void 0
  62136. , p = 9 < arguments.length ? arguments[9] : void 0
  62137. , f = 10 < arguments.length ? arguments[10] : void 0;
  62138. return function(e, t, n) {
  62139. if ("building" == o || "floor" == o || "room" == o) {
  62140. var i = c.getPreDealData(e, t, n, h, o, s)
  62141. , e = i.points
  62142. , n = i.zMax
  62143. , t = i.zMin
  62144. , r = [];
  62145. p && p.forEach(function(e) {
  62146. e = viewer.images360.getPano(e, "sid");
  62147. e && r.push(e)
  62148. }),
  62149. f = null != f ? viewer.images360.getPano(f, "sid") : null,
  62150. c.editing || "floor" != o || f || (r = s.panos,
  62151. f = s.flagPano);
  62152. var n = {
  62153. buildType: o,
  62154. points: e,
  62155. name: u,
  62156. sid: l,
  62157. zMin: t,
  62158. zMax: n,
  62159. buildParent: s,
  62160. ifDraw: c.editing || Potree.settings.drawEntityData,
  62161. panos: r,
  62162. flagPano: f,
  62163. autoBuild: h
  62164. }
  62165. , a = new z1(n);
  62166. return G1.addEntity(a, s),
  62167. c.editing && ("building" != o && "room" != o || a.addMidMarkers()),
  62168. d.forEach(function(e) {
  62169. e = e.map(function(e) {
  62170. return c.transform(e, "fromDataset")
  62171. }),
  62172. e = a.addHole(e);
  62173. c.editing && e.addMidMarkers()
  62174. }),
  62175. a
  62176. }
  62177. }(e, t, n)
  62178. },
  62179. transform: function(e, t) {
  62180. if ("pano" == Potree.settings.editType)
  62181. return (new Cn).copy(e).setZ(0);
  62182. if ("toDataset" == t) {
  62183. t = Potree.Utils.datasetPosTransform({
  62184. toDataset: !0,
  62185. position: e.clone(),
  62186. datasetId: Potree.settings.originDatasetId
  62187. });
  62188. return (new yn).copy(t)
  62189. }
  62190. e = (new Cn).copy(e).setZ(0);
  62191. return Potree.Utils.datasetPosTransform({
  62192. fromDataset: !0,
  62193. position: e,
  62194. datasetId: Potree.settings.originDatasetId
  62195. })
  62196. },
  62197. addEntity: function(t, e) {
  62198. var n = this;
  62199. this.meshGroup.add(t),
  62200. this.entities.push(t),
  62201. ("building" == t.buildType ? this.buildings : e.buildChildren).push(t),
  62202. "room" == t.buildType ? t.addEventListener("marker_dropped", function() {
  62203. n.fitPullBox()
  62204. }) : "floor" == t.buildType && (this.updateBuildingZ(e),
  62205. e.dispatchEvent({
  62206. type: "addFloor"
  62207. })),
  62208. t.addEventListener("clickMarker", function(e) {
  62209. n.selectedMarker == e.marker ? (n.selectedMarker.dispatchEvent({
  62210. type: "clickSelect",
  62211. state: !1
  62212. }),
  62213. n.selectedMarker = null) : (n.selectedMarker && n.selectedMarker.dispatchEvent({
  62214. type: "clickSelect",
  62215. state: !1
  62216. }),
  62217. n.selectedMarker = e.marker,
  62218. n.selectedMarker.dispatchEvent({
  62219. type: "clickSelect",
  62220. state: !0
  62221. }))
  62222. }),
  62223. t.addEventListener("removeMarker", function(e) {
  62224. n.selectedMarker == e.marker && (n.selectedMarker = null)
  62225. });
  62226. function i(e) {
  62227. n.selectedMarker && t.markers.includes(n.selectedMarker) && (n.selectedMarker.dispatchEvent({
  62228. type: "clickSelect",
  62229. state: !1
  62230. }),
  62231. n.selectedMarker = null)
  62232. }
  62233. t.addEventListener("dispose", i),
  62234. t.addEventListener("unselect", i)
  62235. },
  62236. removeEntity: function(e) {
  62237. var t, n = this;
  62238. this.entities.includes(e) && (console.log("删除实体:", e.buildType, e.sid),
  62239. this.selected == e && (this.height_pull_box.visible = !1,
  62240. this.selectEntity(null)),
  62241. "building" == e.buildType ? -1 < (t = this.buildings.indexOf(e)) && this.buildings.splice(t, 1) : -1 < (t = e.buildParent.buildChildren.indexOf(e)) && e.buildParent.buildChildren.splice(t, 1),
  62242. -1 < (t = this.entities.indexOf(e)) && this.entities.splice(t, 1),
  62243. e.dispose(),
  62244. e.buildChildren.slice().forEach(function(e) {
  62245. return n.removeEntity(e)
  62246. }))
  62247. },
  62248. updateBuildingZ: function(e) {
  62249. e.buildChildren = e.buildChildren.sort(function(e, t) {
  62250. return e.zMin - t.zMin
  62251. }),
  62252. e.zMin = e.zMax = e.buildChildren[0].zMin,
  62253. this.editing && e.update({
  62254. dontUpdateChildren: !0
  62255. }),
  62256. e.dispatchEvent("updateBuildingZ")
  62257. },
  62258. selectEntity: function(e) {
  62259. if (!1 === (!(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]))
  62260. return e.unselect(),
  62261. void (this.selected == e && (this.selected = null));
  62262. this.selected == e || e && "hole" == e.buildType || (this.selected && this.selected.unselect(),
  62263. this.height_pull_box.visible = !1,
  62264. e && e.select(),
  62265. !(this.selected = e) || "floor" != e.buildType && "room" != e.buildType || (this.height_pull_box.visible = !0,
  62266. this.fitPullBox()),
  62267. e && !e.isNew && ("building" == e.buildType || "room" == e.buildType) && e.points.length < 2 && this.startInsertion("resume", e))
  62268. },
  62269. fitPullBox: function() {
  62270. var e, t;
  62271. !this.selected || "floor" != this.selected.buildType && "room" != this.selected.buildType || ((t = new kn).expandByObject(this.selected.box),
  62272. e = t.getCenter(new Cn),
  62273. t = t.getSize(new Cn),
  62274. this.height_pull_box.scale.copy(t),
  62275. this.height_pull_box.position.copy(e))
  62276. },
  62277. changeZ: function(e, t, n) {
  62278. var i, r, a, o;
  62279. "floor" == e.buildType ? (o = e.buildParent.buildChildren.indexOf(e),
  62280. "zMax" == t ? (a = e.buildParent.buildChildren[o + 1],
  62281. e.zMax = Math.min(U1.zMax, n),
  62282. r = e.zMin + .5,
  62283. e.zMax < r ? e.zMax = r : a && (i = a.zMax - .5,
  62284. e.zMax > i && (e.zMax = i)),
  62285. a && (a.zMin = e.zMax,
  62286. a.update(),
  62287. a.dispatchEvent({
  62288. type: "changeHeight"
  62289. }))) : (a = e.buildParent.buildChildren[o - 1],
  62290. e.zMin = Math.max(U1.zMin, n),
  62291. i = e.zMax - .5,
  62292. e.zMin > i ? e.zMin = i : a && (r = a.zMin + .5,
  62293. e.zMin < r && (e.zMin = r)),
  62294. a && (a.zMax = e.zMin,
  62295. a.update(),
  62296. a.dispatchEvent({
  62297. type: "changeHeight"
  62298. })),
  62299. 0 == o && this.updateBuildingZ(e.buildParent))) : "room" == e.buildType && (o = e.buildParent.zMax - e.buildParent.zMin,
  62300. "zMax" == t ? (r = e.zMin + .5,
  62301. i = e.zMin + o,
  62302. e.zMax = gn.clamp(n, r, i)) : (r = e.zMax - o,
  62303. i = e.zMax - .5,
  62304. e.zMin = gn.clamp(n, r, i))),
  62305. e.update(),
  62306. e.dispatchEvent({
  62307. type: "changeHeight"
  62308. }),
  62309. this.fitPullBox()
  62310. },
  62311. createHeightPull: function() {
  62312. var i = this
  62313. , e = new Wr(1,1,.25)
  62314. , t = new $i({
  62315. color: "#F00",
  62316. opacity: 0,
  62317. transparent: !0,
  62318. depthTest: !1,
  62319. side: 2
  62320. })
  62321. , r = new Hr(e,t)
  62322. , t = new Hr(e,t);
  62323. r.name = "height_pull_box_up",
  62324. t.name = "height_pull_box_down",
  62325. this.height_pull_box = new Si,
  62326. this.height_pull_box.name = "height_pull_box",
  62327. this.height_pull_box.add(r),
  62328. this.height_pull_box.add(t),
  62329. this.height_pull_box.visible = !1,
  62330. this.meshGroup.add(this.height_pull_box),
  62331. r.position.set(0, 0, .5),
  62332. t.position.set(0, 0, -.5),
  62333. viewer.setObjectLayers(this.height_pull_box, "siteModeSideVisi");
  62334. function n(e) {
  62335. viewer.dispatchEvent({
  62336. type: "CursorChange",
  62337. action: "add",
  62338. name: "siteModelFloorDrag"
  62339. })
  62340. }
  62341. function a(e) {
  62342. viewer.dispatchEvent({
  62343. type: "CursorChange",
  62344. action: "remove",
  62345. name: "siteModelFloorDrag"
  62346. })
  62347. }
  62348. function o(e) {
  62349. var t, n = e.intersect.orthoIntersect;
  62350. null != u ? (t = n.z - u,
  62351. "floor" != i.selected.buildType && "room" != i.selected.buildType || (e.target == r ? (null == l && (l = i.selected.zMax),
  62352. i.changeZ(i.selected, "zMax", l + t)) : (null == l && (l = i.selected.zMin),
  62353. i.changeZ(i.selected, "zMin", l + t)))) : u = n.z
  62354. }
  62355. function s(e) {
  62356. l = u = null
  62357. }
  62358. var l, u;
  62359. r.addEventListener("mousemove", n),
  62360. t.addEventListener("mousemove", n),
  62361. r.addEventListener("mouseleave", a),
  62362. t.addEventListener("mouseleave", a),
  62363. r.addEventListener("drag", o),
  62364. t.addEventListener("drag", o),
  62365. r.addEventListener("drop", s),
  62366. t.addEventListener("drop", s)
  62367. },
  62368. pointInWhichEntity: function(o, e, t) {
  62369. function s(e, t) {
  62370. var n = o instanceof Cn ? e.ifContainsPoint(o) : e.panos.includes(o);
  62371. if (n) {
  62372. if ((!l || u[l.buildType] < u[e.buildType]) && (l = e),
  62373. e.buildType == t)
  62374. return e;
  62375. for (var i = 0, r = e.buildChildren.length; i < r; i++) {
  62376. var a = s(e.buildChildren[i]);
  62377. if (a)
  62378. return a
  62379. }
  62380. }
  62381. }
  62382. var l, u = {
  62383. building: 0,
  62384. floor: 1,
  62385. room: 2
  62386. }, n = Fm.sortByScore(this.buildings, [function(e) {
  62387. return s(e, "building")
  62388. }
  62389. ], [function(e) {
  62390. var t = e.getBound()
  62391. , e = t.getCenter(new Cn)
  62392. , e = (o instanceof Cn ? o : o.position).distanceTo(e);
  62393. return t.getSize(new Cn).length() / 2 / e
  62394. }
  62395. ]), i = n && n[0] && 1 < n[0].score && n[0].item;
  62396. return "building" != e && i ? (n = s(i, e)) || l : i
  62397. },
  62398. findPanos: function() {
  62399. this.entities.forEach(function(t) {
  62400. t.panos = [],
  62401. t.flagPano = null,
  62402. viewer.images360.panos.forEach(function(e) {
  62403. t.ifContainsPoint(e.position) && t.panos.push(e)
  62404. })
  62405. }),
  62406. this.entities.forEach(function(e) {
  62407. var t, n = e.panos;
  62408. 0 != n.length && (t = e.getBound().getCenter(new Cn),
  62409. t = [ly.scoreFunctions.distanceSquared({
  62410. position: t
  62411. })],
  62412. (t = Fm.sortByScore(n, [], t)) && t.length ? e.flagPano = t[0].item : console.error("no flagPano??"))
  62413. })
  62414. },
  62415. findEntityForDataset: function() {
  62416. var r = this;
  62417. viewer.scene.pointclouds.forEach(function(e) {
  62418. for (var t = e.getVolume(), n = r.buildings; ; ) {
  62419. var i = function(r, e, a) {
  62420. var o = [];
  62421. return e.forEach(function(e) {
  62422. var t = e.intersectPointcloudVolume(r)
  62423. , n = e.panos.filter(function(e) {
  62424. return r.panos.includes(e)
  62425. }).length
  62426. , i = t / a;
  62427. 0 < r.panos.length && (i += n / r.panos.length),
  62428. o.push({
  62429. entity: e,
  62430. volume: t,
  62431. panoCount: n,
  62432. score: i
  62433. })
  62434. }),
  62435. o.sort(function(e, t) {
  62436. return t.score - e.score
  62437. }),
  62438. o
  62439. }(e, n, t);
  62440. if (0 == i.length || i[0].volume / t < 1e-4 && i[0].volume < 3) {
  62441. if (i[0] && "room" == i[0].entity.buildType) {
  62442. e.belongToEntity = i[0].entity;
  62443. break
  62444. }
  62445. e.belongToEntity = null;
  62446. break
  62447. }
  62448. if (0 == (n = i[0].entity.buildChildren).length) {
  62449. e.belongToEntity = i[0].entity;
  62450. break
  62451. }
  62452. }
  62453. })
  62454. },
  62455. clear: function() {
  62456. this.selectEntity(null);
  62457. for (var e = this.entities.length, t = 0; t < e; t++)
  62458. this.entities[t].dispose();
  62459. this.entities = [],
  62460. this.buildings = [],
  62461. this.inEntity = null
  62462. },
  62463. gotoEntity: function(t, e) {
  62464. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1e3
  62465. , i = this.entities.find(function(e) {
  62466. return e.sid == t
  62467. });
  62468. if (!i)
  62469. return console.error("没找到entity ");
  62470. if ("showPanos" == Potree.settings.displayMode) {
  62471. if (e && i.panos.length) {
  62472. if (i.panos.includes(viewer.images360.currentPano))
  62473. return "posNoChange";
  62474. var r = viewer.scene.getActiveCamera().position
  62475. , r = [ly.scoreFunctions.distanceSquared({
  62476. position: r
  62477. })]
  62478. , r = Fm.sortByScore(i.panos, [], r)[0].item
  62479. } else {
  62480. if (!i.flagPano)
  62481. return console.log("没有flagPano");
  62482. r = i.flagPano
  62483. }
  62484. if (r == viewer.images360.currentPano)
  62485. return "posNoChange";
  62486. viewer.images360.flyToPano(r)
  62487. } else {
  62488. if (e && i.ifContainsPoint(viewer.images360.position))
  62489. return "posNoChange";
  62490. e = i.getBound(),
  62491. i = e.getCenter(new Cn);
  62492. if (viewer.modules.Clip && viewer.modules.Clip.editing)
  62493. viewer.modules.Clip.bus.dispatchEvent({
  62494. type: "flyToPos",
  62495. position: i
  62496. });
  62497. else {
  62498. if (Up.closeTo(i, viewer.images360.position))
  62499. return "posNoChange";
  62500. e = e.getSize(new Cn);
  62501. viewer.scene.view.setView({
  62502. position: i,
  62503. duration: n
  62504. }),
  62505. viewer.mapViewer.moveTo(i, e, n)
  62506. }
  62507. }
  62508. return !0
  62509. },
  62510. focusEntity: function(t) {
  62511. var e = this.entities.find(function(e) {
  62512. return e.sid == t
  62513. }).getBound()
  62514. , n = e.getCenter(new Cn);
  62515. this.SplitScreen.focusOnObject(e, n),
  62516. this.gotoEntity(t, !1, 0)
  62517. },
  62518. removeIlligalArchi: function() {
  62519. var t = this
  62520. , n = [];
  62521. this.entities.forEach(function(e) {
  62522. e.points.length < 3 && n.push(e)
  62523. }),
  62524. n.forEach(function(e) {
  62525. return t.removeEntity(e)
  62526. })
  62527. }
  62528. }, H1 = function() {
  62529. y(l, Hr);
  62530. var s = w(l);
  62531. function l(e, t, n, i) {
  62532. var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .2
  62533. , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 1;
  62534. O(this, l),
  62535. n = n || new Yi("white"),
  62536. e = e || 10,
  62537. t = t || 100,
  62538. i = i || 8e3;
  62539. var o = new ua(2,2,1,1)
  62540. , i = new Qr({
  62541. side: Y,
  62542. uniforms: {
  62543. uSize1: {
  62544. value: e
  62545. },
  62546. uSize2: {
  62547. value: t
  62548. },
  62549. opacity1: {
  62550. value: r
  62551. },
  62552. opacity2: {
  62553. value: a
  62554. },
  62555. uColor: {
  62556. value: n
  62557. },
  62558. uDistance: {
  62559. value: i
  62560. }
  62561. },
  62562. transparent: !0,
  62563. vertexShader: "\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.xyz * uDistance;\n pos.xy += cameraPosition.xy;\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n ",
  62564. fragmentShader: "\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform float opacity1;\n uniform float opacity2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.xy / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n //为何侧面看不到线,因为mesh的正侧面都看不到?\n\n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.xy, worldPosition.xy) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 3.0));\n //gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n gl_FragColor.a = mix(opacity1 * gl_FragColor.a, opacity2 * gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n ",
  62565. extensions: {
  62566. derivatives: !0
  62567. }
  62568. });
  62569. return (i = s.call(this, o, i)).frustumCulled = !1,
  62570. i
  62571. }
  62572. return h(l)
  62573. }();
  62574. D1.prototype = Object.assign(Object.create(Si.prototype), {
  62575. constructor: D1,
  62576. isTransformControls: !0
  62577. }),
  62578. k1.prototype = Object.assign(Object.create(Si.prototype), {
  62579. constructor: k1,
  62580. isTransformControlsGizmo: !0
  62581. }),
  62582. B1.prototype = Object.assign(Object.create(Hr.prototype), {
  62583. constructor: B1,
  62584. isTransformControlsPlane: !0
  62585. }),
  62586. (new _c).crossOrigin = "anonymous";
  62587. var V1 = [{
  62588. left: 0,
  62589. bottom: 0,
  62590. width: .5,
  62591. height: 1,
  62592. name: "top",
  62593. axis: ["x", "y"],
  62594. direction: new Cn(0,0,-1),
  62595. active: !0,
  62596. limitBound: new kn(new Cn(-1 / 0,-1 / 0,1),new Cn(1 / 0,1 / 0,5e3)),
  62597. margin: {
  62598. x: 50,
  62599. y: 150
  62600. }
  62601. }, {
  62602. left: .5,
  62603. bottom: 0,
  62604. width: .5,
  62605. height: 1,
  62606. name: "right",
  62607. axis: ["y", "z"],
  62608. direction: new Cn(1,0,0),
  62609. active: !0,
  62610. viewContainsPoints: [new Cn(0,0,0)],
  62611. margin: {
  62612. x: 300,
  62613. y: 250
  62614. }
  62615. }]
  62616. , j1 = {
  62617. bus: new hn,
  62618. SplitScreen: new A1,
  62619. init: function() {
  62620. var n = this
  62621. , e = this.ground = new H1(1,1e4,new Yi("#fff"),1e4,.2,.3);
  62622. viewer.scene.scene.add(e);
  62623. var t = Sf.createLine([new Cn(-1e4,0,0), new Cn(1e4,0,0)], {
  62624. color: "#666",
  62625. dontAlwaysSeen: !0
  62626. })
  62627. , i = Sf.createLine([new Cn(0,-1e4,0), new Cn(0,1e4,0)], {
  62628. mat: t.material
  62629. });
  62630. e.renderOrder = t.renderOrder + 1,
  62631. e.add(t),
  62632. e.add(i),
  62633. e.material.polygonOffset = !0,
  62634. e.material.polygonOffsetFactor = 10,
  62635. e.material.polygonOffsetUnits = 10,
  62636. t.material.polygonOffset = !0,
  62637. t.material.polygonOffsetFactor = 20,
  62638. t.material.polygonOffsetUnits = 10,
  62639. this.transformControls = new D1(viewer.mainViewport.camera,viewer.renderArea,{
  62640. dontHideWhenFaceCamera: !0
  62641. }),
  62642. this.transformControls.setSize(1.5),
  62643. viewer.scene.scene.add(this.transformControls),
  62644. viewer.setControls(viewer.orbitControls),
  62645. viewer.orbitControls.constantlyForward = !0,
  62646. viewer.addEventListener("global_single_click", function(e) {
  62647. viewer.scene.cameraAnimations.some(function(e) {
  62648. return e.onUpdate
  62649. }) || e.drag && e.drag.notPressMouse || viewer.mainViewport.view.isFlying() || n.split || (e.intersect ? (e = e.intersect.object || e.intersect.pointcloud,
  62650. n.getAllObjects().includes(e) ? n.selectModel(e) : n.selectModel(null)) : n.selectModel(null))
  62651. }),
  62652. viewer.inputHandler.addEventListener("keydown", function(e) {
  62653. "h" == e.event.key.toLowerCase() && (n.fadeOutlineAuto = !n.fadeOutlineAuto,
  62654. n.showModelOutline(n.selected, !!n.selected))
  62655. }),
  62656. viewer.ssaaRenderPass.enabled = !1,
  62657. viewer.outlinePass.enabled = !0,
  62658. viewer.mainViewport.camera.near = .05,
  62659. viewer.addEventListener("updateModelBound", function(e) {
  62660. n.split && n.SplitScreen.updateCameraOutOfModel()
  62661. });
  62662. function r(e) {
  62663. if (n.split && "top" == e.dragViewport.name && n.selected && n.transformState && ("global_mousedown" == e.type && (e.intersect.object || e.intersect.pointcloud) == n.selected && (a = {}),
  62664. "global_drag" == e.type && a)) {
  62665. if ("translate" == n.transformState) {
  62666. var t = Potree.Utils.getOrthoCameraMoveVec(e.drag.pointerDelta, e.dragViewport.camera);
  62667. n.selected.position.add(t),
  62668. n.selected.dispatchEvent("position_changed")
  62669. } else if ("rotate" == n.transformState) {
  62670. t = (new Cn).subVectors(e.intersect.orthoIntersect || e.intersect.location, n.selected.boundCenter).setZ(0);
  62671. if (null == a.lastVec)
  62672. return void (a.lastVec = t);
  62673. e = Up.getAngle(a.lastVec, t, "z");
  62674. a.lastVec = t;
  62675. e = (new Sn).setFromAxisAngle(new Cn(0,0,1), e);
  62676. n.selected.quaternion.premultiply(e),
  62677. n.selected.dispatchEvent("rotation_changed")
  62678. }
  62679. return {
  62680. stopContinue: !0
  62681. }
  62682. }
  62683. }
  62684. var a;
  62685. viewer.addEventListener("global_mousedown", r),
  62686. viewer.addEventListener("global_drag", r, 10),
  62687. viewer.addEventListener("global_mousemove", function(e) {
  62688. n.split && "top" == e.hoverViewport.name && n.transformState && !e.drag && ((e.intersect.object || e.intersect.pointcloud) == n.selected ? "translate" == n.transformState ? viewer.dispatchEvent({
  62689. type: "CursorChange",
  62690. action: "add",
  62691. name: "movePointcloud"
  62692. }) : viewer.dispatchEvent({
  62693. type: "CursorChange",
  62694. action: "add",
  62695. name: "rotatePointcloud"
  62696. }) : n.clearTranCursor())
  62697. }),
  62698. viewer.addEventListener("global_drop", function(e) {
  62699. a = null,
  62700. n.clearTranCursor()
  62701. })
  62702. },
  62703. clearTranCursor: function() {
  62704. viewer.dispatchEvent({
  62705. type: "CursorChange",
  62706. action: "remove",
  62707. name: "movePointcloud"
  62708. }),
  62709. viewer.dispatchEvent({
  62710. type: "CursorChange",
  62711. action: "remove",
  62712. name: "rotatePointcloud"
  62713. })
  62714. },
  62715. enterSplit: function() {
  62716. this.split = !0,
  62717. this.selected ? this.SplitScreen.focusCenter = this.selected.boundCenter : this.SplitScreen.focusCenter = null,
  62718. this.SplitScreen.splitStart(V1),
  62719. viewer.setControls(viewer.fpControls),
  62720. viewer.viewports.find(function(e) {
  62721. return "right" == e.name
  62722. }).rotateSide = !0,
  62723. viewer.viewports.find(function(e) {
  62724. return "top" == e.name
  62725. }).alignment = !0
  62726. },
  62727. leaveSplit: function() {
  62728. this.split = !1,
  62729. this.SplitScreen.unSplit(),
  62730. viewer.setControls(viewer.orbitControls)
  62731. },
  62732. rotateSideCamera: function(e) {
  62733. this.SplitScreen.rotateSideCamera(viewer.viewports.find(function(e) {
  62734. return "right" == e.name
  62735. }), e)
  62736. },
  62737. setTransformState: function(e) {
  62738. this.transformState = e,
  62739. this.clearTranCursor()
  62740. },
  62741. getAllObjects: function() {
  62742. return viewer.objs.children.concat(viewer.scene.pointclouds)
  62743. },
  62744. getModel: function(t) {
  62745. return this.getAllObjects().find(function(e) {
  62746. return e.dataset_id == t
  62747. })
  62748. },
  62749. removeModel: function(e) {
  62750. this.selected == e && this.selectModel(null),
  62751. e.traverse(function(e) {
  62752. e.geometry && e.geometry.dispose(),
  62753. e.material && e.material.dispose()
  62754. }),
  62755. viewer.objs.remove(e)
  62756. },
  62757. selectModel: function(e) {
  62758. var t = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]
  62759. , n = 2 < arguments.length ? arguments[2] : void 0
  62760. , i = 3 < arguments.length ? arguments[3] : void 0;
  62761. if (e || (e = this.selected,
  62762. t = !1),
  62763. t) {
  62764. if (this.selected) {
  62765. if (this.selected == e)
  62766. return;
  62767. this.selectModel(this.selected, !1, n, i)
  62768. }
  62769. this.selected = e,
  62770. j1.focusOn(e, 500, !!n),
  62771. this.showModelOutline(e),
  62772. e.isPointcloud ? viewer.outlinePass.edgeStrength = 4 : viewer.outlinePass.edgeStrength = 100
  62773. } else
  62774. this.showModelOutline(e, !1),
  62775. this.selected = null,
  62776. this.transformControls.detach();
  62777. !i && e && e.dispatchEvent({
  62778. type: "changeSelect",
  62779. selected: t
  62780. })
  62781. },
  62782. showModelOutline: function(e, t) {
  62783. if (this.fadeOutlineAuto) {
  62784. if (!1 === t)
  62785. return viewer.outlinePass.selectedObjects = [],
  62786. void clearTimeout(this.timer);
  62787. viewer.outlinePass.selectedObjects = [e],
  62788. this.timer && clearTimeout(this.timer),
  62789. this.timer = setTimeout(function() {
  62790. viewer.outlinePass.selectedObjects = []
  62791. }, 1e3)
  62792. } else
  62793. viewer.outlinePass.selectedObjects = !1 === t ? [] : [e]
  62794. },
  62795. focusOn: function(e) {
  62796. var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 400
  62797. , n = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2]
  62798. , i = 3 < arguments.length ? arguments[3] : void 0;
  62799. e instanceof Array || (e = [e]);
  62800. var r = new kn;
  62801. e.forEach(function(e) {
  62802. r.union(e.boundingBox.clone().applyMatrix4(e.matrixWorld))
  62803. }),
  62804. n ? viewer.focusOnObject({
  62805. boundingBox: r
  62806. }, "boundingBox", t, {
  62807. dontLookUp: i
  62808. }) : (i = viewer.inputHandler.intersect ? viewer.inputHandler.intersect.location : r.getCenter(new Cn)) && viewer.focusOnObject({
  62809. position: i
  62810. }, "point", t, {
  62811. dontChangePos: !0
  62812. })
  62813. },
  62814. setModelBtmHeight: function(e, t) {
  62815. null == t ? t = e.btmHeight : e.btmHeight = t,
  62816. e.updateMatrixWorld();
  62817. var n = e.boundingBox.clone().applyMatrix4(e.matrixWorld)
  62818. , i = n.getSize(new Cn)
  62819. , n = n.getCenter(new Cn)
  62820. , i = t + i.z / 2;
  62821. e.position.z += i - n.z
  62822. },
  62823. computeBtmHeight: function(e) {
  62824. e.updateMatrixWorld();
  62825. var t = e.boundingBox.clone().applyMatrix4(e.matrixWorld)
  62826. , n = t.getSize(new Cn)
  62827. , t = t.getCenter(new Cn);
  62828. e.btmHeight = t.z - n.z / 2
  62829. },
  62830. maintainBoundXY: function(e) {
  62831. e.updateMatrixWorld();
  62832. var t = e.boundCenter.clone();
  62833. this.getBoundCenter(e);
  62834. var n = e.boundCenter.clone()
  62835. , n = (new yn).subVectors(t, n);
  62836. e.position.x += n.x,
  62837. e.position.y += n.y,
  62838. e.boundCenter.copy(t)
  62839. },
  62840. moveBoundCenterTo: function(e, t) {
  62841. t = (new Cn).subVectors(t, e.boundCenter);
  62842. e.position.add(t)
  62843. },
  62844. getBoundCenter: function(e) {
  62845. e.boundCenter || (e.boundCenter = new Cn),
  62846. e.boundingBox.getCenter(e.boundCenter).applyMatrix4(e.matrixWorld)
  62847. },
  62848. modelTransformCallback: function(r) {
  62849. r.updateMatrixWorld(),
  62850. r.matrixWorld.equals(r.lastMatrixWorld) || (viewer.scene.measurements.forEach(function(n) {
  62851. var i;
  62852. n.points_datasets.forEach(function(e, t) {
  62853. e == r.dataset_id && (i = !0,
  62854. n.points[t] = Potree.Utils.datasetPosTransform({
  62855. fromDataset: !0,
  62856. datasetId: e,
  62857. position: n.dataset_points[t].clone()
  62858. }),
  62859. n.updateMarker(n.markers[t], n.points[t]))
  62860. }),
  62861. i && (n.getPoint2dInfo(n.points),
  62862. n.update())
  62863. }),
  62864. r.lastMatrixWorld = r.matrixWorld.clone())
  62865. }
  62866. }
  62867. , W1 = new _c
  62868. , X1 = new Dl(1.45,100)
  62869. , q1 = new Tu(.018,10,10)
  62870. , J1 = Math.round(2 <= window.devicePixelRatio ? (1398784 <= window.screen.width * window.screen.height ? window.devicePixelRatio / 1.2 : window.devicePixelRatio / 1.5) * (200 / 1.43) : 200 / 1.43);
  62871. console.log("width2dPX", J1);
  62872. function Y1(e) {
  62873. return (eb = eb || {
  62874. "fire+smoke": Sf.createFatLineMat($.extend(kb, {
  62875. color: Db["fire+smoke"],
  62876. lineWidth: 2
  62877. })),
  62878. smoke: Sf.createFatLineMat($.extend(kb, {
  62879. color: Db.smoke,
  62880. lineWidth: 2
  62881. })),
  62882. explode: Sf.createFatLineMat($.extend(kb, {
  62883. color: Db.explode,
  62884. lineWidth: 2
  62885. }))
  62886. })[e]
  62887. }
  62888. function Z1(e) {
  62889. var t;
  62890. return tb || (t = new _c,
  62891. tb = {
  62892. "fire+smoke": new Wp($.extend(kb, {
  62893. map: t.load(Potree.resourcePath + "/textures/icon-fire.png"),
  62894. color: Db["fire+smoke"]
  62895. })),
  62896. smoke: new Wp($.extend(kb, {
  62897. map: t.load(Potree.resourcePath + "/textures/icon-smoke.png"),
  62898. color: Db.smoke
  62899. })),
  62900. explode: new Wp($.extend(kb, {
  62901. map: t.load(Potree.resourcePath + "/textures/icon-explode.png"),
  62902. color: Db.explode
  62903. }))
  62904. }),
  62905. tb[e]
  62906. }
  62907. var Q1, K1, $1, eb, tb, nb, ib, rb, ab = function() {
  62908. y(l, Si);
  62909. var s = w(l);
  62910. function l(t) {
  62911. var n;
  62912. O(this, l),
  62913. (n = s.call(this)).width = n.height = J1,
  62914. n.camera = new $r(50,1,.01,1e4),
  62915. n.camera.up = new Cn(0,0,1),
  62916. n.viewport = new Ig(null,n.camera,{
  62917. left: 0,
  62918. bottom: 0,
  62919. width: 1,
  62920. height: 1,
  62921. name: "magnifier",
  62922. cameraLayers: ["magnifierContent"],
  62923. pixelRatio: 1
  62924. }),
  62925. n.viewport.setResolution(n.width, n.height, 0, 0);
  62926. var e, i, r, a = new Map;
  62927. n.viewport.beforeRender = function() {
  62928. t.scene.pointclouds.forEach(function(e) {
  62929. a.set(e, e.temp.pointOpacity)
  62930. }),
  62931. e = Potree.settings.pointDensity,
  62932. Potree.settings.pointDensity = "magnifier",
  62933. t.scene.pointclouds.forEach(function(e) {
  62934. i = e.material.pointSizeType,
  62935. e.material.pointSizeType = Potree.config.material.pointSizeType,
  62936. r = e.material.activeAttributeName,
  62937. e.material.activeAttributeName = "rgba",
  62938. e.changePointOpacity(1)
  62939. })
  62940. }
  62941. ,
  62942. n.viewport.afterRender = function() {
  62943. Potree.settings.pointDensity = e,
  62944. t.scene.pointclouds.forEach(function(e) {
  62945. e.material.pointSizeType = i,
  62946. e.material.activeAttributeName = r,
  62947. e.changePointOpacity(a.get(e))
  62948. })
  62949. }
  62950. ,
  62951. n.renderTarget = new An(n.width,n.height,{
  62952. minFilter: Oe,
  62953. magFilter: Oe,
  62954. format: et
  62955. }),
  62956. n.rtEDL = new An(n.width,n.height,{
  62957. minFilter: Re,
  62958. magFilter: Re,
  62959. format: et,
  62960. type: Xe,
  62961. depthTexture: new El(void 0,void 0,We)
  62962. }),
  62963. n.mesh = new Hr(X1,new $i({
  62964. side: Y,
  62965. map: n.renderTarget.texture,
  62966. transparent: !0,
  62967. depthTest: !1
  62968. })),
  62969. n.overlayMesh = new Hr(X1,new $i({
  62970. side: Y,
  62971. map: W1.load(Potree.resourcePath + "/textures/crosshair.png"),
  62972. transparent: !0,
  62973. depthTest: !1
  62974. })),
  62975. n.targetPoint = new Si,
  62976. n.targetPoint.add(new Hr(q1,new $i({
  62977. color: "#ff0000",
  62978. transparent: !0,
  62979. opacity: .5
  62980. }))),
  62981. n.targetPoint.add(new Hr(q1,new $i({
  62982. color: "#ff0000",
  62983. transparent: !0,
  62984. opacity: .2,
  62985. depthTest: !1
  62986. }))),
  62987. n.targetPoint.name = "magnifierPointTarget",
  62988. t.scene.scene.add(n.targetPoint),
  62989. t.setObjectLayers(n.targetPoint, "magnifierContent"),
  62990. n.add(n.mesh),
  62991. n.add(n.overlayMesh),
  62992. n.position.set(-1e3, -1e3, -1e5),
  62993. n.mesh.renderOrder = 10,
  62994. n.overlayMesh.renderOrder = 11,
  62995. n.aimPos,
  62996. t.setObjectLayers(g(n), "magnifier"),
  62997. t.addEventListener("camera_changed", function(e) {
  62998. e.viewport == t.mainViewport && n.update()
  62999. }),
  63000. n.mesh.layers.set(Potree.config.renderLayers.magnifier),
  63001. n.overlayMesh.layers.set(Potree.config.renderLayers.magnifier),
  63002. n.dontRender = !1,
  63003. t.addEventListener("global_drag", function(e) {
  63004. n.dontRender = !0
  63005. }),
  63006. t.addEventListener("global_drop", function(e) {
  63007. n.dontRender = !1
  63008. }),
  63009. t.addEventListener("global_mouseup", function(e) {
  63010. n.dontRender = !1
  63011. });
  63012. function o(e) {
  63013. e.hoverViewport == t.mainViewport ? (t.updateVisible(g(n), "atViewport", !0),
  63014. n.update(e.intersect && e.intersect.location)) : t.updateVisible(g(n), "atViewport", !1)
  63015. }
  63016. return t.addEventListener("global_mousemove", o),
  63017. t.addEventListener("global_touchstart", o),
  63018. n.addEventListener("setEnable", function(e) {
  63019. t.updateVisible(g(n), "enable", e.value)
  63020. }),
  63021. Potree.settings.isOfficial ? t.updateVisible(g(n), "enable", !1) : (t.updateVisible(g(n), "measure", !1),
  63022. t.addEventListener("measureMovePoint", function() {
  63023. t.updateVisible(g(n), "measure", !0)
  63024. }),
  63025. t.addEventListener("endMeasureMove", function() {
  63026. t.updateVisible(g(n), "measure", !1)
  63027. })),
  63028. t.scene.view.addEventListener("flyingDone", function() {
  63029. var e;
  63030. n.visible && (e = t.inputHandler.getIntersect(t.mainViewport, t.mainViewport.camera, !0, 100),
  63031. n.update(e && e.location))
  63032. }),
  63033. n
  63034. }
  63035. return h(l, [{
  63036. key: "update",
  63037. value: function(e) {
  63038. var t, n, i, r, a, o = this.dontRender || !(e instanceof Cn) || "showPanos" == Potree.settings.displayMode && viewer.images360.flying;
  63039. (e = e instanceof Cn ? e : this.aimPos) && this.visible && (a = (n = (t = viewer.scene.getActiveCamera()).position).distanceTo(e),
  63040. i = (new Cn).subVectors(n, e).normalize(),
  63041. r = 1 < a ? 1 : a / 2,
  63042. this.camera.position.copy(e).add(i.multiplyScalar(r)),
  63043. this.camera.lookAt(e),
  63044. this.camera.fov = t.fov / 2,
  63045. this.camera.updateProjectionMatrix(),
  63046. r = (r = Potree.Utils.getPos2d(e, t, viewer.renderArea, viewer.mainViewport).vector).clone().setY(r.y + (.4 < r.y ? -.4 : .4)),
  63047. r = new Cn(r.x,r.y,.8).unproject(t).clone().sub(n).normalize().multiplyScalar(10),
  63048. a = 1 < a ? 1 : +a,
  63049. this.position.copy(n.clone().add(r)),
  63050. this.quaternion.copy(t.quaternion),
  63051. this.targetPoint.position.copy(e),
  63052. this.targetPoint.scale.set(a, a, a),
  63053. this.aimPos = e,
  63054. e = Up.getScaleForConstantSize({
  63055. width2d: J1,
  63056. camera: viewer.scene.getActiveCamera(),
  63057. position: this.getWorldPosition(new Cn),
  63058. resolution: viewer.mainViewport.resolution2
  63059. }),
  63060. this.scale.set(e, e, e),
  63061. o || (this.waitRender = !0))
  63062. }
  63063. }, {
  63064. key: "render",
  63065. value: function() {
  63066. this.waitRender && (viewer.render({
  63067. target: this.renderTarget,
  63068. viewports: [this.viewport],
  63069. camera: this.camera,
  63070. magnifier: !0,
  63071. rtEDL: this.rtEDL
  63072. }),
  63073. this.waitRender = !1)
  63074. }
  63075. }]),
  63076. l
  63077. }(), ob = new _c, sb = function() {
  63078. y(r, Hr);
  63079. var i = w(r);
  63080. function r(e) {
  63081. O(this, r);
  63082. var t, n = ob.load(Potree.resourcePath + "/textures/whiteCircle.png");
  63083. return (t = i.call(this, new ua(.11,.11,1,1), new $i({
  63084. side: Y,
  63085. map: n,
  63086. transparent: !0,
  63087. depthTest: !1,
  63088. opacity: .7
  63089. }))).name = "reticule",
  63090. t.defaultTex = n,
  63091. t.crosshairTex = ob.load(Potree.resourcePath + "/textures/reticule_cross_hair.png"),
  63092. t.forbitTex = ob.load(Potree.resourcePath + "/textures/pic-forbid.png"),
  63093. t.renderOrder = 100,
  63094. t.layers.set(Potree.config.renderLayers.marker),
  63095. t.direction = new Cn,
  63096. t.mouseLastMoveTime = Date.now(),
  63097. t.hoverViewport,
  63098. t.matrixMap = new Map,
  63099. t.matrixAutoUpdate = !1,
  63100. t.hide(0),
  63101. Potree.settings.intersectWhenHover && e.addEventListener("global_mousemove", t.move.bind(g(t))),
  63102. e.addEventListener("global_mousedown", t.move.bind(g(t))),
  63103. t.state = {},
  63104. e.addEventListener("measureMovePoint", function() {
  63105. t.state.cross = !0,
  63106. t.judgeTex()
  63107. }),
  63108. e.addEventListener("endMeasureMove", function() {
  63109. t.state.cross = !1,
  63110. t.judgeTex()
  63111. }),
  63112. e.addEventListener("reticule_forbit", function(e) {
  63113. t.state.forbit != e.v && console.log("change forbit ", e.v),
  63114. t.state.forbit = e.v,
  63115. t.judgeTex()
  63116. }),
  63117. e.setObjectLayers(g(t), "sceneObjects"),
  63118. t
  63119. }
  63120. return h(r, [{
  63121. key: "judgeTex",
  63122. value: function() {
  63123. this.state.forbit ? this.material.map = this.forbitTex : this.state.cross ? this.material.map = this.crosshairTex : this.material.map = this.defaultTex,
  63124. viewer.mapViewer && viewer.mapViewer.dispatchEvent({
  63125. type: "content_changed"
  63126. })
  63127. }
  63128. }, {
  63129. key: "move",
  63130. value: function(e) {
  63131. "global_mousemove" == e.type && (e.isTouch || e.buttons != rm.NONE) && "crosshair" != this.state || (this.mouseLastMoveTime = Date.now(),
  63132. this.updatePosition(e.intersect, e.hoverViewport))
  63133. }
  63134. }, {
  63135. key: "hide",
  63136. value: function() {
  63137. var e = this
  63138. , t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 500;
  63139. this.hidden || (this.hidden = !0,
  63140. gv.start(vv(this.material, "opacity", 0), t),
  63141. this.dispatchEvent({
  63142. type: "update",
  63143. visible: !1
  63144. }),
  63145. setTimeout(function() {
  63146. e.dispatchEvent({
  63147. type: "update",
  63148. visible: !1
  63149. })
  63150. }, t))
  63151. }
  63152. }, {
  63153. key: "show",
  63154. value: function() {
  63155. var e = this
  63156. , t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 300;
  63157. viewer.getObjVisiByReason(this, "force") && (this.hidden = !1,
  63158. this.material.opacity <= 0 && (gv.start(vv(this.material, "opacity", .7), t),
  63159. this.dispatchEvent({
  63160. type: "update",
  63161. visible: !0
  63162. }),
  63163. setTimeout(function() {
  63164. e.dispatchEvent({
  63165. type: "update",
  63166. visible: !1
  63167. })
  63168. }, t)))
  63169. }
  63170. }, {
  63171. key: "updateVisible",
  63172. value: function() {
  63173. 1500 < Date.now() - this.mouseLastMoveTime && !this.hidden && this.hide()
  63174. }
  63175. }, {
  63176. key: "updateScale",
  63177. value: function(e) {
  63178. var t, n = e.camera;
  63179. "OrthographicCamera" == n.type ? (t = this.state.cross ? {
  63180. width2d: 500
  63181. } : {
  63182. minSize: 100,
  63183. maxSize: 400,
  63184. nearBound: 100,
  63185. farBound: 700
  63186. },
  63187. t = Up.getScaleForConstantSize($.extend(t, {
  63188. position: this.position,
  63189. camera: n,
  63190. resolution: e.resolution
  63191. }))) : (t = 1 + .1 * (n = n.position.distanceTo(this.position)),
  63192. n < 1 && (t -= 1 - n)),
  63193. this.scale.set(t, t, t)
  63194. }
  63195. }, {
  63196. key: "updateAtViewports",
  63197. value: function(e) {
  63198. var t;
  63199. "magnifier" != e.name && (this.hoverViewport && "mapViewport" == this.hoverViewport.name && e != this.hoverViewport ? viewer.updateVisible(this, "hoverMap", !1) : (viewer.updateVisible(this, "hoverMap", !0),
  63200. (t = this.matrixMap.get(e)) ? this.matrix.copy(t) : (this.updateScale(e),
  63201. this.updateMatrix(),
  63202. this.matrixMap.set(e, this.matrix.clone()))))
  63203. }
  63204. }, {
  63205. key: "updatePosition",
  63206. value: function(e, t) {
  63207. var n, i, r;
  63208. viewer.getObjVisiByReason(this, "force") && e && (n = !e.location,
  63209. i = e.location || e.orthoIntersect.clone(),
  63210. this.show(n ? 0 : 300),
  63211. n ? (r = new Cn(0,0,1),
  63212. i.setZ(0),
  63213. this.direction = r.clone()) : (r = e.normal) && (this.direction = this.direction.multiplyScalar(.8),
  63214. this.direction.add(r.clone().multiplyScalar(.2))),
  63215. this.position.copy(i),
  63216. this.updateMatrix(),
  63217. this.lookAt(this.position.clone().add(this.direction)),
  63218. this.hoverViewport = t,
  63219. this.updateScale(t),
  63220. this.updateMatrix(),
  63221. this.matrixMap.clear(),
  63222. this.matrixMap.set(t, this.matrix.clone()),
  63223. this.dispatchEvent({
  63224. type: "update"
  63225. }))
  63226. }
  63227. }]),
  63228. r
  63229. }(), lb = ["", "⅛", "¼", "⅜", "½", "⅝", "¾", "⅞"], ub = function() {
  63230. function r(e, t, n, i) {
  63231. O(this, r),
  63232. this.name = e,
  63233. this.symbol = t,
  63234. this.base = n,
  63235. this.factor = i
  63236. }
  63237. return h(r, [{
  63238. key: "toBase",
  63239. value: function(e) {
  63240. return e * this.factor
  63241. }
  63242. }, {
  63243. key: "fromBase",
  63244. value: function(e) {
  63245. return e / this.factor
  63246. }
  63247. }]),
  63248. r
  63249. }(), cb = {
  63250. MILLIMETER: ["Millimeter", "mm"],
  63251. CENTIMETER: ["Centimeter", "cm"],
  63252. METER: ["Meter", "m"],
  63253. KILOMETER: ["Kilometer", "km"],
  63254. INCH: ["Inch", "in"],
  63255. FOOT: ["Foot", "ft"],
  63256. MILE: ["Mile", "mi"],
  63257. SQUAREMETER: ["SquareMeter", "m²"],
  63258. SQUAREFOOT: ["SquareFoot", "ft²"],
  63259. CUBICMETER: ["CubicMeter", "m³"],
  63260. CUBICFOOT: ["CubicFoot", "ft³"],
  63261. BYTE: ["Byte", "B"],
  63262. KILOBYTE: ["Kilobyte", "kB"],
  63263. MEGABYTE: ["Megabyte", "MB"],
  63264. GIGABYTE: ["Gigabyte", "GB"],
  63265. TERABYTE: ["Terabyte", "TB"],
  63266. PETABYTE: ["Petabyte", "PB"],
  63267. init: function() {
  63268. var e, t, n = new ub(cb.METER[0],cb.METER[1],void 0,1), i = new ub(cb.SQUAREMETER[0],cb.SQUAREMETER[1],void 0,1), r = new ub(cb.CUBICMETER[0],cb.CUBICMETER[1],void 0,1), a = new ub(cb.BYTE[0],cb.BYTE[1],void 0,1);
  63269. cb.DISTANCE = ((t = {}).metric = ((e = {})[cb.MILLIMETER[0]] = new ub(cb.MILLIMETER[0],cb.MILLIMETER[1],n,.001),
  63270. e[cb.CENTIMETER[0]] = new ub(cb.CENTIMETER[0],cb.CENTIMETER[1],n,.01),
  63271. e[cb.METER[0]] = n,
  63272. e[cb.KILOMETER[0]] = new ub(cb.KILOMETER[0],cb.KILOMETER[1],n,1e3),
  63273. e),
  63274. t.imperial = ((e = {})[cb.INCH[0]] = new ub(cb.INCH[0],cb.INCH[1],n,.0254),
  63275. e[cb.FOOT[0]] = new ub(cb.FOOT[0],cb.FOOT[1],n,.3048),
  63276. e[cb.MILE[0]] = new ub(cb.MILE[0],cb.MILE[1],n,1609.344),
  63277. e),
  63278. t),
  63279. cb.AREA = ((e = {}).metric = ((t = {})[cb.SQUAREMETER[0]] = i,
  63280. t),
  63281. e.imperial = ((t = {})[cb.SQUAREFOOT[0]] = new ub(cb.SQUAREFOOT[0],cb.SQUAREFOOT[1],i,.092903),
  63282. t),
  63283. e),
  63284. cb.VOLUME = ((t = {}).metric = ((e = {})[cb.CUBICMETER[0]] = r,
  63285. e),
  63286. t.imperial = ((e = {})[cb.CUBICFOOT[0]] = new ub(cb.CUBICFOOT[0],cb.CUBICFOOT[1],r,.0283168),
  63287. e),
  63288. t);
  63289. (t = {})[cb.BYTE[0]] = a,
  63290. t[cb.KILOBYTE[0]] = new ub(cb.KILOBYTE[0],cb.KILOBYTE[1],a,1e3),
  63291. t[cb.MEGABYTE[0]] = new ub(cb.MEGABYTE[0],cb.MEGABYTE[1],a,1e6),
  63292. t[cb.GIGABYTE[0]] = new ub(cb.GIGABYTE[0],cb.GIGABYTE[1],a,1e9),
  63293. t[cb.TERABYTE[0]] = new ub(cb.TERABYTE[0],cb.TERABYTE[1],a,1e12),
  63294. t[cb.PETABYTE[0]] = new ub(cb.PETABYTE[0],cb.PETABYTE[1],a,1e15),
  63295. a = t;
  63296. cb.DATA = ((t = {}).metric = a,
  63297. t.imperial = a,
  63298. t)
  63299. },
  63300. getUnitsOfMeasurementByDomain: function(e) {
  63301. return this[e.toUpperCase()]
  63302. },
  63303. getUnitsOfMeasurementByDomainAndSystem: function(e, t) {
  63304. e = this.getUnitsOfMeasurementByDomain(e);
  63305. if (e.hasOwnProperty(t.toLowerCase()))
  63306. return e[t.toLowerCase()];
  63307. console.error(n + " measurement system is not supported.")
  63308. },
  63309. getDefaultUnitByDomainAndSystem: function(e, t) {
  63310. switch (e.toUpperCase()) {
  63311. case "DISTANCE":
  63312. switch (t.toLowerCase()) {
  63313. case "metric":
  63314. return this.DISTANCE.metric[this.METER[0]];
  63315. case "imperial":
  63316. return this.DISTANCE.imperial[this.FOOT[0]];
  63317. default:
  63318. console.error(t + " measurement system is not supported.")
  63319. }
  63320. case "AREA":
  63321. switch (t.toLowerCase()) {
  63322. case "metric":
  63323. return this.AREA.metric[this.SQUAREMETER[0]];
  63324. case "imperial":
  63325. return this.AREA.imperial[this.SQUAREFOOT[0]];
  63326. default:
  63327. console.error(t + " measurement system is not supported.")
  63328. }
  63329. case "VOLUME":
  63330. switch (t.toLowerCase()) {
  63331. case "metric":
  63332. return this.VOLUME.metric[this.CUBICMETER[0]];
  63333. case "imperial":
  63334. return this.VOLUME.imperial[this.CUBICFOOT[0]];
  63335. default:
  63336. console.error(t + " measurement system is not supported.")
  63337. }
  63338. case "DATA":
  63339. switch (t.toLowerCase()) {
  63340. case "metric":
  63341. return this.DATA.metric[this.BYTE[0]];
  63342. case "imperial":
  63343. return this.DATA.imperial[this.BYTE[0]];
  63344. default:
  63345. console.error(t + " measurement system is not supported.")
  63346. }
  63347. default:
  63348. console.error(e + " measurement domain is not supported.")
  63349. }
  63350. }
  63351. }, db = h(function e() {
  63352. O(this, e),
  63353. this.LOCAL_STORAGE_KEY = "iv_unit_key",
  63354. cb.init(),
  63355. this.unitSystems = ["metric", "imperial"],
  63356. this.defaultSystem = "metric"
  63357. }), hb = function() {
  63358. function e() {
  63359. O(this, e),
  63360. this.UnitService = new db
  63361. }
  63362. return h(e, [{
  63363. key: "scopedConvert",
  63364. value: function(e, t) {
  63365. return this.convert(e, t, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2, 3 < arguments.length ? arguments[3] : void 0, 4 < arguments.length ? arguments[4] : void 0)
  63366. }
  63367. }, {
  63368. key: "convert",
  63369. value: function(e, t) {
  63370. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2
  63371. , i = 3 < arguments.length ? arguments[3] : void 0
  63372. , r = 4 < arguments.length ? arguments[4] : void 0
  63373. , a = 5 < arguments.length && void 0 !== arguments[5] && arguments[5];
  63374. if (!e)
  63375. return "";
  63376. r = this.getMostRelevantMeasurement(t, i || this.UnitService.currentSystem, e, r);
  63377. return this.getFormattedMeasurementString(r[0], r[1], n, a)
  63378. }
  63379. }, {
  63380. key: "convertBack",
  63381. value: function(e, t) {
  63382. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2
  63383. , i = 3 < arguments.length ? arguments[3] : void 0
  63384. , r = 4 < arguments.length ? arguments[4] : void 0;
  63385. if (!e)
  63386. return "";
  63387. var a = cb.getDefaultUnitByDomainAndSystem(t, "metric")
  63388. , r = this.getMostRelevantMeasurement2(t, i, e, r);
  63389. return this.getFormattedMeasurementString(r[0], a, n)
  63390. }
  63391. }, {
  63392. key: "getFormattedMeasurementString",
  63393. value: function(e, t, n, i) {
  63394. t = i && t.name === cb.FOOT[0] ? this.formatImperialDistance(12 * e) : i && t.name === cb.INCH[0] ? this.formatImperialDistance(e) : e.toLocaleString(void 0, {
  63395. minimumFractionDigits: n,
  63396. maximumFractionDigits: n
  63397. }) + " " + t.symbol;
  63398. return t
  63399. }
  63400. }, {
  63401. key: "formatImperialDistance",
  63402. value: function(e) {
  63403. var t = Math.round(8 * e)
  63404. , n = Math.floor(t / 8)
  63405. , e = Math.floor(n / 12)
  63406. , n = n - 12 * e
  63407. , t = lb[t % 8]
  63408. , n = 0 == n && "" !== t ? "" : n;
  63409. return "" !== n && "" !== t && (t = " " + t),
  63410. 0 !== e ? e + "' " + n + t + '"' : "" + n + t + '"'
  63411. }
  63412. }, {
  63413. key: "getMostRelevantMeasurement",
  63414. value: function(e, t, n) {
  63415. var i, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = [], o = cb.getUnitsOfMeasurementByDomainAndSystem(e, t);
  63416. for (i in o)
  63417. a.push(o[i]);
  63418. t = a.filter(function(e) {
  63419. return e.factor >= r
  63420. }).reduce(function(e, t) {
  63421. return t.fromBase(n) < e.fromBase(n) && 1 <= t.fromBase(n) ? t : e
  63422. });
  63423. return t ? [t.fromBase(n), t] : void 0
  63424. }
  63425. }, {
  63426. key: "getMostRelevantMeasurement2",
  63427. value: function(e, t, n) {
  63428. var i, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = [], o = cb.getUnitsOfMeasurementByDomainAndSystem(e, t);
  63429. for (i in o)
  63430. a.push(o[i]);
  63431. t = a.filter(function(e) {
  63432. return e.factor >= r
  63433. }).reduce(function(e, t) {
  63434. return t.toBase(n) < e.toBase(n) && 1 <= t.toBase(n) ? t : e
  63435. });
  63436. return t ? [t.toBase(n), t] : void 0
  63437. }
  63438. }]),
  63439. e
  63440. }(), pb = new _c, fb = new ua(1,1), mb = {
  63441. nearBound: 2,
  63442. scale: .5,
  63443. restricMeshScale: !0
  63444. }, vb = function() {
  63445. y(n, hn);
  63446. var t = w(n);
  63447. function n() {
  63448. var e;
  63449. return O(this, n),
  63450. (e = t.call(this)).route = [],
  63451. e.curve = [],
  63452. e.scenePoints = [],
  63453. e.sceneMeshGroup = new Si,
  63454. e.mapMeshGroup = new Si,
  63455. e.generateDeferred,
  63456. viewer.addEventListener("loadPointCloudDone", e.init.bind(g(e))),
  63457. e.lastResult,
  63458. e.datasetIds = [],
  63459. e
  63460. }
  63461. return h(n, [{
  63462. key: "init",
  63463. value: function() {
  63464. var n, e, i = this;
  63465. this.inited || (viewer.mapViewer.addEventListener("camera_changed", function(e) {
  63466. var t;
  63467. i.routeStart && i.routeEnd && (t = e.viewport.camera,
  63468. Fm.intervalTool.isWaiting("routeCameraInterval", function() {
  63469. if (t.zoom != n)
  63470. return i.updateMapArrows(!0),
  63471. n = t.zoom,
  63472. !0
  63473. }, A.isMobile() ? 500 : 200))
  63474. }),
  63475. viewer.addEventListener("camera_changed", function(e) {
  63476. i.routeStart && i.routeEnd && e.changeInfo.positionChanged && Fm.intervalTool.isWaiting("routeCameraInterval", function() {
  63477. return i.updateArrowDisplay(),
  63478. !0
  63479. }, 1e3)
  63480. }),
  63481. (e = {
  63482. shadowMat: new $i({
  63483. transparent: !0,
  63484. depthTest: !1,
  63485. map: pb.load(Potree.resourcePath + "/textures/pano_instruction_bottomMarker.png")
  63486. }),
  63487. sphereMat: new $i({
  63488. transparent: !0,
  63489. depthTest: !1,
  63490. map: pb.load(Potree.resourcePath + "/textures/whiteCircle.png")
  63491. }),
  63492. hatMats: {
  63493. start: new $i({
  63494. transparent: !0,
  63495. depthTest: !1,
  63496. map: pb.load(Potree.resourcePath + "/textures/pano_instruction_start_route.png")
  63497. }),
  63498. end: new $i({
  63499. transparent: !0,
  63500. depthTest: !1,
  63501. map: pb.load(Potree.resourcePath + "/textures/pano_instruction_target_reached.png")
  63502. })
  63503. }
  63504. }).shadowMat.map.anisotropy = 4,
  63505. this.poleStart = this.createPole(e, "start"),
  63506. this.poleEnd = this.createPole(e, "end"),
  63507. this.sceneMeshGroup.add(this.poleStart),
  63508. this.sceneMeshGroup.add(this.poleEnd),
  63509. (e = pb.load(Potree.resourcePath + "/textures/routePoint_panorama.png")).anisotropy = 4,
  63510. this.arrow = new Hr(fb,new $i({
  63511. transparent: !0,
  63512. depthTest: !1,
  63513. map: e
  63514. })),
  63515. this.arrow.scale.set(.5, .5, .5),
  63516. viewer.setObjectLayers(this.arrow, "sceneObjects"),
  63517. this.arrows = new Si,
  63518. this.sceneMeshGroup.add(this.arrows),
  63519. viewer.setObjectLayers(this.sceneMeshGroup, "sceneObjects"),
  63520. viewer.scene.scene.add(this.sceneMeshGroup),
  63521. this.sceneMeshGroup.visible = !1,
  63522. e = pb.load(Potree.resourcePath + "/textures/routePoint_map_fsna.png"),
  63523. this.mapArrowMats = {
  63524. default: new $i({
  63525. transparent: !0,
  63526. depthTest: !1,
  63527. map: e
  63528. }),
  63529. fade: new $i({
  63530. transparent: !0,
  63531. depthTest: !1,
  63532. map: e,
  63533. opacity: .4
  63534. })
  63535. },
  63536. this.mapArrow = new Hr(fb,this.mapArrowMats.default),
  63537. this.mapArrow.scale.set(.5, .5, .5),
  63538. this.mapArrows = new Si,
  63539. this.mapArrows.name = "mapArrows",
  63540. this.mapMeshGroup.add(this.mapArrows),
  63541. this.mapMeshGroup.name = "mapRouteLayer",
  63542. this.mapMeshGroup.visible = !1,
  63543. viewer.mapViewer.dispatchEvent({
  63544. type: "add",
  63545. object: this.mapMeshGroup,
  63546. name: "route"
  63547. }),
  63548. this.mapArrow.layers.mask = this.mapArrows.layers.mask,
  63549. viewer.modules.SiteModel.bus.addEventListener("FloorChange", function() {
  63550. i.routeStart && i.routeEnd && i.updateOpacityAtMap()
  63551. }),
  63552. this.inited = !0)
  63553. }
  63554. }, {
  63555. key: "updateOpacityAtMap",
  63556. value: function() {
  63557. var n = this
  63558. , i = viewer.modules.SiteModel.currentFloor;
  63559. this.mapArrows.children.forEach(function(e, t) {
  63560. t = n.mapPoints[t].clone();
  63561. t.z += .3;
  63562. t = i && i.ifContainsPoint(t);
  63563. e.material = t ? n.mapArrowMats.default : n.mapArrowMats.fade
  63564. }),
  63565. viewer.mapViewer.dispatchEvent("content_changed")
  63566. }
  63567. }, {
  63568. key: "createPole",
  63569. value: function(e, t) {
  63570. var n = mb.scale
  63571. , i = new Si;
  63572. i.name = "pole_" + t;
  63573. var r = new Hr(fb,e.shadowMat);
  63574. r.scale.set(n, n, n);
  63575. i.add(r);
  63576. for (var a = 0; a < 6; a++) {
  63577. var o = new qp({
  63578. mat: e.sphereMat
  63579. });
  63580. o.position.set(0, 0, 1.5 / 7 * (a + 1)),
  63581. o.scale.set(.04, .04, .04),
  63582. o.visible = !1,
  63583. i.add(o)
  63584. }
  63585. t = new qp({
  63586. mat: e.hatMats[t],
  63587. sizeInfo: mb
  63588. });
  63589. return o.visible = !1,
  63590. t.position.set(0, 0, 1.5),
  63591. t.scale.copy(r.scale),
  63592. i.add(t),
  63593. i
  63594. }
  63595. }, {
  63596. key: "addTestArrow",
  63597. value: function() {}
  63598. }, {
  63599. key: "addArrow",
  63600. value: function(e) {
  63601. var t = this.arrow.clone();
  63602. t.position.copy(e),
  63603. this.arrows.add(t)
  63604. }
  63605. }, {
  63606. key: "addMapArrow",
  63607. value: function(e) {
  63608. var t = this.mapArrow.clone();
  63609. t.position.copy(e).setZ(0),
  63610. this.mapArrows.add(t)
  63611. }
  63612. }, {
  63613. key: "setArrowDir",
  63614. value: function(e, t) {
  63615. var n = e[t]
  63616. , t = e[t + 1]
  63617. , t = t ? t.position : this.endPolePos
  63618. , t = (new Cn).subVectors(n.position, t).setZ(0)
  63619. , t = Math.atan2(t.y, t.x) + Math.PI / 2;
  63620. n.rotation.z = t
  63621. }
  63622. }, {
  63623. key: "setRouteStart",
  63624. value: function(e, t, n) {
  63625. this.routeStart && e && this.routeStart.equals(e) || (this.routeStart = e && (new Cn).copy(e),
  63626. t && this.routeStart && (this.routeStart.setZ(this.getZAtMap()),
  63627. this.bus && this.bus.emit("reposStartMarker", this.routeStart)),
  63628. console.log("setRouteStart", this.routeStart && this.routeStart.toArray()),
  63629. this.datasetIds[0] = n,
  63630. this.generateRoute())
  63631. }
  63632. }, {
  63633. key: "setStartPole",
  63634. value: function(e) {
  63635. this.startPolePos = e,
  63636. this.bus && this.bus.emit("reposStartMarker", e)
  63637. }
  63638. }, {
  63639. key: "setRouteEnd",
  63640. value: function(e, t, n) {
  63641. this.routeEnd && e && this.routeEnd.equals(e) || (this.routeEnd = e && (new Cn).copy(e),
  63642. t && this.routeEnd && (this.routeEnd.setZ(this.getZAtMap()),
  63643. this.bus && this.bus.emit("reposEndMarker", this.routeEnd)),
  63644. console.log("setRouteEnd", this.routeEnd && this.routeEnd.toArray()),
  63645. this.datasetIds[1] = n,
  63646. this.generateRoute())
  63647. }
  63648. }, {
  63649. key: "getZAtMap",
  63650. value: function() {
  63651. var e = Fm.sortByScore(viewer.images360.panos, [], [function(e) {
  63652. return -Math.abs(e.position.z - viewer.images360.position.z)
  63653. }
  63654. ])
  63655. , e = e && e[0] && e[0].item;
  63656. return e ? e.floorPosition.z : viewer.bound.boundingBox.min.z + 1
  63657. }
  63658. }, {
  63659. key: "setEndPole",
  63660. value: function(e) {
  63661. this.endPolePos = e,
  63662. this.bus && this.bus.emit("reposEndMarker", e)
  63663. }
  63664. }, {
  63665. key: "getSourceProjectionIndex",
  63666. value: function(e) {
  63667. e = e.findIndex(function(e) {
  63668. return e.instruction && "source_projection_to_navgraph" === e.instruction.type
  63669. });
  63670. return e < 0 ? 0 : e
  63671. }
  63672. }, {
  63673. key: "getDestinationProjectionIndex",
  63674. value: function(e) {
  63675. var t = e.findIndex(function(e) {
  63676. return e.instruction && "destination_projection_to_navgraph" === e.instruction.type
  63677. });
  63678. return t < 0 ? e.length - 1 : t
  63679. }
  63680. }, {
  63681. key: "generateRoute",
  63682. value: function() {
  63683. var a = this;
  63684. if (this.routeStart && this.routeEnd) {
  63685. var i = function() {
  63686. a.routeLength = a.route.reduce(function(e, t, n, i) {
  63687. return 0 == n ? 0 : e + t.distanceTo(i[n - 1])
  63688. }, 0);
  63689. var e = Math.max(2, Math.round(+a.routeLength))
  63690. , t = new Bc(a.route);
  63691. t.curveType = "chordal";
  63692. var n = (a.curve = t).getSpacedPoints(e);
  63693. n.splice(0, 1),
  63694. n.pop(),
  63695. a.scenePoints = n,
  63696. a.updateMapArrows(),
  63697. a.displayRoute();
  63698. var i = new yn(1,1)
  63699. , r = new ph;
  63700. a.route.forEach(function(e) {
  63701. r.expandByPoint(e)
  63702. });
  63703. t = r.getSize(new yn),
  63704. e = new yn(115,40),
  63705. n = viewer.mapViewer.viewports[0].resolution2,
  63706. n = n.x * n.y;
  63707. 32e4 < n && e.multiplyScalar(n / 32e4);
  63708. e = t.clone().divide(viewer.mapViewer.viewports[0].resolution2).multiply(e);
  63709. t.add(e);
  63710. e = r.getCenter(new yn);
  63711. t.x = Math.max(t.x, i.x),
  63712. t.y = Math.max(t.y, i.y);
  63713. viewer.mapViewer.moveTo(e, t, 1e3),
  63714. a.bus.emit("gotResult", {
  63715. dis: a.routeLength
  63716. })
  63717. };
  63718. if (Potree.fileServer) {
  63719. var t = function(e) {
  63720. if (!e.data)
  63721. return console.log("没有数据"),
  63722. t = e && 4002 == e.code ? e : a.routeStart.distanceTo(a.routeEnd) < 1 ? {
  63723. code: 500,
  63724. msg: "距离太短,无法规划路线"
  63725. } : {
  63726. code: 500,
  63727. msg: "超出数据集范围,无法规划路线"
  63728. },
  63729. a.clearRoute(),
  63730. a.setStartPole(a.routeStart),
  63731. a.setEndPole(a.routeEnd),
  63732. a.displayRoute(),
  63733. void (a.bus && a.bus.emit("gotResult", t));
  63734. e = e.data,
  63735. a.clearRoute();
  63736. var t, n = e.length;
  63737. n < 2 ? (console.log("路径点数为" + n + ",直接取起点和终点连线"),
  63738. a.route = [a.routeStart, a.routeEnd]) : (t = a.getSourceProjectionIndex(e),
  63739. n = a.getDestinationProjectionIndex(e),
  63740. e.slice(t, n + 1).forEach(function(e, t) {
  63741. e = viewer.transform.lonlatToLocal.forward(e.location.slice(0)),
  63742. e = (new Cn).fromArray(e);
  63743. a.route.push(e)
  63744. }),
  63745. console.log(a.route)),
  63746. a.setStartPole(a.route[0]),
  63747. a.setEndPole(a.route[a.route.length - 1]),
  63748. i()
  63749. };
  63750. if (this.lastResult && (this.lastResult.data || 4002 != this.lastResult.data.code)) {
  63751. var e = Fm.CloneObject(this.lastResult.data);
  63752. if (this.lastResult.routeStart.equals(this.routeStart) && this.lastResult.routeEnd.equals(this.routeEnd) ? l = !0 : this.lastResult.routeStart.equals(this.routeEnd) && this.lastResult.routeEnd.equals(this.routeStart) && (l = !0,
  63753. e.data && (e.data = this.lastResult.data.data.slice(0).reverse())),
  63754. l)
  63755. return console.log("直接用上次的结果"),
  63756. setTimeout(function() {
  63757. t(e)
  63758. }, 1)
  63759. }
  63760. var n, r = this.routeStart.clone(), o = this.routeEnd.clone(), s = viewer.transform.lonlatToLocal.inverse(r), l = viewer.transform.lonlatToLocal.inverse(o), u = {
  63761. source_longitude: s.x,
  63762. source_latitude: s.y,
  63763. source_z: r.z,
  63764. destination_longitude: l.x,
  63765. destination_latitude: l.y,
  63766. destination_z: o.z
  63767. }, c = "/laser/route/".concat(Potree.settings.number, "/getRoute/").concat(Potree.settings.originDatasetId, "?");
  63768. for (n in u)
  63769. c += n + "=" + u[n] + "&";
  63770. Potree.fileServer.get(c).then(function(e) {
  63771. console.log(e.data),
  63772. a.routeStart && a.routeEnd && (a.lastResult = {
  63773. routeStart: a.routeStart.clone(),
  63774. routeEnd: a.routeEnd.clone(),
  63775. data: e
  63776. },
  63777. t(e))
  63778. })
  63779. } else
  63780. this.clearRoute(),
  63781. this.route = [this.routeStart, this.routeEnd],
  63782. i()
  63783. }
  63784. }
  63785. }, {
  63786. key: "updateMapArrows",
  63787. value: function(e) {
  63788. var t, n;
  63789. 0 != this.route.length && (n = viewer.mapViewer.camera.zoom,
  63790. (t = Math.max(2, Math.round(this.routeLength * n / 25))) != this.mapPoints.length + 1 && ((t = this.curve.getSpacedPoints(t)).splice(0, 1),
  63791. t.pop(),
  63792. this.mapPoints = t,
  63793. this.mapArrow.scale.set(.6 * (n = 25 / n), .6 * n, .6 * n),
  63794. e && (this.clearRoute({
  63795. resetMap: !0
  63796. }),
  63797. this.displayRoute({
  63798. resetMap: !0
  63799. })),
  63800. this.updateOpacityAtMap()))
  63801. }
  63802. }, {
  63803. key: "updateArrowDisplay",
  63804. value: function() {
  63805. var n;
  63806. 0 != this.scenePoints.length && (n = viewer.scene.getActiveCamera().position,
  63807. this.arrows.children.forEach(function(e, t) {
  63808. e.position.distanceTo(n) < 10 ? e.visible = !0 : e.visible = !1
  63809. }))
  63810. }
  63811. }, {
  63812. key: "displayRoute",
  63813. value: function() {
  63814. var n = this;
  63815. (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).resetMap || (this.poleStart.position.copy(this.startPolePos || this.routeStart),
  63816. this.poleEnd.position.copy(this.endPolePos || this.routeEnd),
  63817. this.scenePoints.forEach(function(e) {
  63818. return n.addArrow(e)
  63819. }),
  63820. this.arrows.children.forEach(function(e, t) {
  63821. return n.setArrowDir(n.arrows.children, t)
  63822. })),
  63823. this.sceneMeshGroup.traverse(function(e) {
  63824. return e.visible = !0
  63825. }),
  63826. this.mapMeshGroup.visible = !0,
  63827. this.mapPoints.forEach(function(e) {
  63828. return n.addMapArrow(e)
  63829. }),
  63830. this.mapArrows.children.forEach(function(e, t) {
  63831. return n.setArrowDir(n.mapArrows.children, t)
  63832. }),
  63833. viewer.mapViewer.dispatchEvent({
  63834. type: "content_changed"
  63835. }),
  63836. this.updateArrowDisplay()
  63837. }
  63838. }, {
  63839. key: "clearRoute",
  63840. value: function() {
  63841. var t = this;
  63842. (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).resetMap || (this.routeLength = 0,
  63843. this.route = [],
  63844. this.scenePoints = [],
  63845. this.mapPoints = [],
  63846. this.arrows.children.slice(0).forEach(function(e) {
  63847. t.arrows.remove(e)
  63848. })),
  63849. this.mapArrows.children.slice(0).forEach(function(e) {
  63850. t.mapArrows.remove(e)
  63851. }),
  63852. this.sceneMeshGroup.traverse(function(e) {
  63853. return e.visible = !1
  63854. }),
  63855. this.mapMeshGroup.visible = !1,
  63856. viewer.mapViewer.dispatchEvent({
  63857. type: "content_changed"
  63858. })
  63859. }
  63860. }, {
  63861. key: "clear",
  63862. value: function() {
  63863. console.log("导航clear"),
  63864. this.routeStart = null,
  63865. this.routeEnd = null,
  63866. this.clearRoute()
  63867. }
  63868. }]),
  63869. n
  63870. }(), gb = (new Wr(1,1,1,1),
  63871. new $i({
  63872. wireframe: !0,
  63873. color: "#ffffff"
  63874. }),
  63875. function() {
  63876. y(o, gl);
  63877. var a = w(o);
  63878. function o(e) {
  63879. var t, n;
  63880. for (n in O(this, o),
  63881. t = a.call(this),
  63882. e)
  63883. t[n] = e[n];
  63884. t.strength = t.strength || 1,
  63885. t.radius = e.radius || 1,
  63886. t.height = e.height || 5,
  63887. t.computeParams(),
  63888. t.geometry = t.createGeometry(t.radius, t.height, t.particleCount),
  63889. null == t.color && (t.color = 16724480),
  63890. t.createMaterial(),
  63891. t.velocity = new Cn,
  63892. t.acceleration = new Cn,
  63893. t.angle = 0,
  63894. t.angleVelocity = 0,
  63895. t.angleAcceleration = 0,
  63896. t.size = 16,
  63897. t.opacity = 1,
  63898. t.age = 0,
  63899. t.alive = 0,
  63900. t.sizeTween = null,
  63901. t.colorTween = null,
  63902. t.opacityTween = null,
  63903. t.setSize({
  63904. viewport: viewer.mainViewport
  63905. }),
  63906. t.setFov(viewer.fov);
  63907. function i(e) {
  63908. "MainView" == e.viewport.name && t.setSize(e)
  63909. }
  63910. function r(e) {
  63911. t.setFov(e.fov)
  63912. }
  63913. return viewer.addEventListener("resize", i),
  63914. viewer.addEventListener("fov_changed", r),
  63915. t.addEventListener("dispose", function() {
  63916. viewer.removeEventListener("resize", i),
  63917. viewer.removeEventListener("fov_changed", r)
  63918. }),
  63919. t
  63920. }
  63921. return h(o, [{
  63922. key: "computeParams",
  63923. value: function() {
  63924. var e = (this.curve ? this.curve.wholeLength : 0) + 2 * this.radius;
  63925. this.size = .3 + 2.7 * gn.smoothstep(this.radius, .3, 10),
  63926. this.particleCount = Math.ceil(e * Math.sqrt(this.strength * this.height) * this.radius / (this.size * this.size) * 25)
  63927. }
  63928. }, {
  63929. key: "getPointsForBound",
  63930. value: function() {
  63931. return this.boundPoints
  63932. }
  63933. }, {
  63934. key: "getBound",
  63935. value: function(e) {
  63936. var n = this;
  63937. this.boundPoints = [];
  63938. var i = new kn
  63939. , t = .13 * this.size + .3;
  63940. e.forEach(function(e) {
  63941. var t = e.clone();
  63942. t.z += n.height,
  63943. i.expandByPoint(e),
  63944. i.expandByPoint(t),
  63945. n.boundPoints.push(e, t)
  63946. });
  63947. e = this.radius + t;
  63948. i.expandByVector(new Cn(e,e,t)),
  63949. this.boundingBox = i
  63950. }
  63951. }, {
  63952. key: "createGeometry",
  63953. value: function(e, t, n) {
  63954. var i, r, a = new Mr;
  63955. 1 < this.positions.length ? (i = Math.ceil(this.curve.wholeLength / .2) + 1,
  63956. i = (r = this.curve.getSpacedPoints(i)).length,
  63957. this.getBound(r)) : this.getBound(this.positions);
  63958. for (var o = new Float32Array(3 * n), s = new Float32Array(n), l = new Float32Array(n), u = new Float32Array(n), c = 0; c < n; c++) {
  63959. var d, h, p = (new Cn).copy(1 < this.positions.length ? r[Math.floor(c / n * i)] : this.positions[0]);
  63960. u[c] = p.z,
  63961. 0 === c ? (o[3 * c + 0] = p.x,
  63962. o[3 * c + 1] = p.y,
  63963. o[3 * c + 2] = p.z) : (d = Math.sqrt(Math.random()) * e,
  63964. h = 2 * Math.random() * Math.PI,
  63965. o[3 * c + 0] = p.x + Math.cos(h) * d,
  63966. o[3 * c + 1] = p.y + Math.sin(h) * d,
  63967. o[3 * c + 2] = p.z + (e - d) / e * t / 2 + t / 2,
  63968. l[c] = .25 * (4 * Math.random() | 0),
  63969. s[c] = Math.random())
  63970. }
  63971. return a.setAttribute("centerHeight", new nr(u,1)),
  63972. a.setAttribute("position", new nr(o,3)),
  63973. a.setAttribute("randam", new nr(s,1)),
  63974. a.setAttribute("sprite", new nr(l,1)),
  63975. a
  63976. }
  63977. }, {
  63978. key: "updateGeometry",
  63979. value: function() {
  63980. this.computeParams(),
  63981. this.geometry.dispose(),
  63982. this.geometry = this.createGeometry(this.radius, this.height, this.particleCount),
  63983. this.material.uniforms.size.value = this.size
  63984. }
  63985. }, {
  63986. key: "createMaterial",
  63987. value: function() {
  63988. var e = new Qr({
  63989. uniforms: {
  63990. color: {
  63991. type: "c",
  63992. value: new Yi(this.color)
  63993. },
  63994. size: {
  63995. type: "f",
  63996. value: this.size
  63997. },
  63998. u_sampler: {
  63999. type: "t",
  64000. value: Q1 = Q1 || (new _c).load(Potree.resourcePath + "/textures/fire.png")
  64001. },
  64002. time: {
  64003. type: "f",
  64004. value: 0
  64005. },
  64006. heightOfNearPlane: {
  64007. type: "f",
  64008. value: 0
  64009. },
  64010. height: {
  64011. type: "f",
  64012. value: this.height
  64013. }
  64014. },
  64015. vertexShader: "\n attribute float randam;\n attribute float sprite;\n attribute float centerHeight; //add\n \n //uniform float fireHeight; //add \n uniform float time;\n uniform float size;\n uniform float heightOfNearPlane;\n \n \n \n \n //varying float heightRatio;\n varying float vSprite;\n varying float vOpacity; \n float PI = 3.14;\n\n float quadraticIn( float t ) \n { \n float tt = t * t;\n return tt * tt; \n //变化曲线 越来越快\n } \n \n void main() {\n float progress = fract( time + ( 2.0 * randam - 1.0 ) );\n float progressNeg = 1.0 - progress;\n float ease = quadraticIn( progress );\n float influence = sin( PI * ease );\n //vec3 newPosition = position * vec3( 1.0, 1.0 , ease);\n vec3 newPosition = position;\n newPosition.z = (newPosition.z - centerHeight) * ease + centerHeight;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );\n gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;\n vOpacity = min( influence * 4.0, 1.0 ) * progressNeg;\n vSprite = sprite;\n \n //heightRatio = (newPosition.z - centerHeight) / fireHeight ;\n \n }\n",
  64016. fragmentShader: "\n uniform vec3 color;\n uniform sampler2D u_sampler;\n\n varying float vSprite;\n varying float vOpacity;\n //varying float heightRatio;\n\n void main() \n {\n \n \n vec2 texCoord = vec2(gl_PointCoord.x * 0.25 + vSprite, gl_PointCoord.y);\n \n gl_FragColor = vec4( texture2D( u_sampler, texCoord ).xyz * color * vOpacity, 1.0 );\n \n \n }\n",
  64017. blending: ee,
  64018. depthTest: !0,
  64019. depthWrite: !1,
  64020. transparent: !0
  64021. });
  64022. this.material = e,
  64023. this.setPerspective(this.fov, this.screenHeight)
  64024. }
  64025. }, {
  64026. key: "setSize",
  64027. value: function(e) {
  64028. e = e.viewport;
  64029. this.screenHeight = e.resolution.y,
  64030. this.setPerspective(this.fov, this.screenHeight)
  64031. }
  64032. }, {
  64033. key: "setFov",
  64034. value: function(e) {
  64035. this.fov = e,
  64036. this.setPerspective(this.fov, this.screenHeight)
  64037. }
  64038. }, {
  64039. key: "setPerspective",
  64040. value: function(e, t) {
  64041. e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e))));
  64042. this.material.uniforms.heightOfNearPlane.value = e
  64043. }
  64044. }, {
  64045. key: "update",
  64046. value: function(e) {
  64047. viewer.getObjVisiByReason(this, "force") && (Potree.Utils.isInsideFrustum(this.boundingBox, viewer.scene.getActiveCamera()) ? (viewer.updateVisible(this, "isInsideFrustum", !0),
  64048. this.material.uniforms.time.value = (this.material.uniforms.time.value + (e *= 1)) % 1) : viewer.updateVisible(this, "isInsideFrustum", !1))
  64049. }
  64050. }, {
  64051. key: "dispose",
  64052. value: function() {
  64053. this.geometry.dispose(),
  64054. this.material.dispose(),
  64055. this.dispatchEvent("dispose")
  64056. }
  64057. }]),
  64058. o
  64059. }()), yb = function() {
  64060. function n(e, t) {
  64061. O(this, n),
  64062. this.times = e || [],
  64063. this.values = t || []
  64064. }
  64065. return h(n, [{
  64066. key: "lerp",
  64067. value: function(e) {
  64068. if (0 != this.times.length) {
  64069. for (var t = 0, n = this.times.length; t < n && e > this.times[t]; )
  64070. t++;
  64071. if (0 == t)
  64072. return this.values[0];
  64073. if (t == n)
  64074. return this.values[n - 1];
  64075. var i = (e - this.times[t - 1]) / (this.times[t] - this.times[t - 1]);
  64076. return this.values[0]instanceof Cn ? this.values[t - 1].clone().lerp(this.values[t], i) : this.values[t - 1] + i * (this.values[t] - this.values[t - 1])
  64077. }
  64078. }
  64079. }, {
  64080. key: "clone",
  64081. value: function() {
  64082. return Fm.CloneClassObject(this)
  64083. }
  64084. }]),
  64085. n
  64086. }(), wb = function() {
  64087. function t() {
  64088. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  64089. O(this, t),
  64090. this.position = new Cn,
  64091. this.velocity = new Cn,
  64092. this.angle = 0,
  64093. this.angleVelocity = 0,
  64094. this.angleAcceleration = 0,
  64095. this.size = 16,
  64096. this.color = new Yi,
  64097. this.opacity = 1,
  64098. this.age = 0,
  64099. this.alive = 0,
  64100. this.lastChangeVage = 0,
  64101. this.sizeTween = e.sizeTween || new yb([0, 1],[32, 128]),
  64102. this.opacityTween = e.opacityTween || new yb([.8, 2],[.5, 0]),
  64103. this.colorTween = e.colorTween || new yb([.4, 1],[new Cn(0,0,.2), new Cn(0,0,.5)])
  64104. }
  64105. return h(t, [{
  64106. key: "update",
  64107. value: function(e) {
  64108. this.position.add(this.velocity.clone().multiplyScalar(e)),
  64109. this.velocity.multiplyScalar(1 + this.acceleration * e),
  64110. this.angle += .01745329251 * this.angleVelocity * e,
  64111. this.angleVelocity += .01745329251 * this.angleAcceleration * e,
  64112. this.age += e,
  64113. 0 < this.sizeTween.times.length && (this.size = this.sizeTween.lerp(this.age / this.deathAge)),
  64114. 0 < this.colorTween.times.length && (e = this.colorTween.lerp(this.age / this.deathAge),
  64115. this.color = (new Yi).setHSL(e.x, e.y, e.z)),
  64116. 0 < this.opacityTween.times.length && (this.opacity = this.opacityTween.lerp(this.age / this.deathAge))
  64117. }
  64118. }]),
  64119. t
  64120. }(), bb = "\n attribute vec3 customColor;\n attribute float customOpacity;\n attribute float customSize;\n attribute float customAngle;\n attribute float customVisible; \n uniform float heightOfNearPlane;\n \n \n varying vec4 vColor;\n varying float vAngle;\n void main()\n {\n if ( customVisible > 0.5 ) \t\t\t\t\n vColor = vec4( customColor, customOpacity ); \n else\t\t\t\t\t\t\t\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\t\t\n \n vAngle = customAngle;\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n //gl_PointSize = customSize * ( 300.0 / length( mvPosition.xyz ) ); \n gl_Position = projectionMatrix * mvPosition;\n gl_PointSize = ( heightOfNearPlane * customSize ) / gl_Position.w;\n \n \n }\n", xb = (Object.freeze({
  64121. CUBE: 1,
  64122. SPHERE: 2
  64123. }),
  64124. new Wr(1,1,1,1),
  64125. new $i({
  64126. wireframe: !0,
  64127. color: "#ffffff"
  64128. }),
  64129. {
  64130. positions: [],
  64131. positionStyle: "sphere",
  64132. positionBase: new Cn(0,0,0),
  64133. positionSpread: new Cn(1,1,0),
  64134. radius: 1,
  64135. velocityStyle: "cube",
  64136. velocityBase: new Cn(0,0,.5),
  64137. velocitySpread: new Cn(1,1,.3),
  64138. accelerationBase: .3,
  64139. accelerationSpread: .6,
  64140. speedBase: .1,
  64141. speedSpread: .5,
  64142. angleBase: 0,
  64143. angleSpread: 360,
  64144. angleVelocityBase: 1,
  64145. angleVelocitySpread: 30,
  64146. angleAccelerationBase: 1,
  64147. angleAccelerationSpread: 5,
  64148. sizeBase: 0,
  64149. sizeSpread: 0,
  64150. sizeTween: [[0, .3, 1], [.3, 1.4, 6]],
  64151. colorBase: new Cn(0,1,.5),
  64152. colorSpread: new Cn(0,0,0),
  64153. colorTween: new yb([.2, 1],[new Cn(0,0,.4), new Cn(0,0,.1)]),
  64154. opacityBase: .1,
  64155. opacitySpread: .2,
  64156. opacityTween: [[0, .1, .9, 1], [.1, .4, .03, 0]],
  64157. strength: 1,
  64158. particleDeathAge: 3,
  64159. height: 3
  64160. }), Eb = (new Hr(new Tu(.03,5,5),new $i({
  64161. color: "white",
  64162. depthTest: !1
  64163. })),
  64164. function() {
  64165. y(s, gl);
  64166. var o = w(s);
  64167. function s() {
  64168. var t, e, n = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  64169. for (e in O(this, s),
  64170. (t = o.call(this)).blendStyle = K,
  64171. t.emitterAge = 0,
  64172. n = $.extend({}, xb, n)) {
  64173. var i = n[e];
  64174. i instanceof Array && i[0]instanceof Array ? t[e] = B(yb, Q(i)) : t[e] = i instanceof Cn || i instanceof Yi ? i.clone() : i
  64175. }
  64176. t.defaultSizeTween = t.sizeTween.clone(),
  64177. t.defaultOpacityTween = t.opacityTween.clone(),
  64178. t.geometry = new Mr,
  64179. t.computeParams(),
  64180. t.createMaterial(),
  64181. t.createGeometry(),
  64182. t.dynamic = !0,
  64183. t.sortParticles = !0,
  64184. t.frustumCulled = !1,
  64185. n.position && t.position.copy(n.position),
  64186. t.setSize({
  64187. viewport: viewer.mainViewport
  64188. }),
  64189. t.setFov(viewer.fov);
  64190. function r(e) {
  64191. "MainView" == e.viewport.name && t.setSize(e)
  64192. }
  64193. function a(e) {
  64194. t.setFov(e.fov)
  64195. }
  64196. return viewer.addEventListener("resize", r),
  64197. viewer.addEventListener("fov_changed", a),
  64198. t.addEventListener("dispose", function() {
  64199. viewer.removeEventListener("resize", r),
  64200. viewer.removeEventListener("fov_changed", a)
  64201. }),
  64202. t
  64203. }
  64204. return h(s, [{
  64205. key: "computeParams",
  64206. value: function() {
  64207. var e = (this.curve ? this.curve.wholeLength : 0) + 2 * this.radius;
  64208. "cube" == this.positionStyle && this.positionSpread.set(this.radius, this.radius, 0),
  64209. this.velocityBase.set(0, 0, (this.height - .5 * this.accelerationBase * this.particleDeathAge * this.particleDeathAge) / this.particleDeathAge),
  64210. this.velocityBase.z = Math.max(0, this.velocityBase.z),
  64211. this.particleCount = Math.ceil(e * Math.sqrt(this.strength * this.height * this.radius)),
  64212. this.particleCount = Math.max(5, this.particleCount);
  64213. var t = +gn.smoothstep(this.strength, .01, 1) + 1;
  64214. this.sizeTween.values = this.defaultSizeTween.values.map(function(e) {
  64215. return e * t
  64216. });
  64217. var n = 1 + .5 * gn.smoothstep(this.strength, .01, 1);
  64218. this.opacityTween.values = this.defaultOpacityTween.values.map(function(e) {
  64219. return e * n
  64220. })
  64221. }
  64222. }, {
  64223. key: "reStart",
  64224. value: function() {
  64225. this.emitterAge = 0,
  64226. this.createGeometry()
  64227. }
  64228. }, {
  64229. key: "updateGeometry",
  64230. value: function() {
  64231. this.computeParams(),
  64232. this.reStart()
  64233. }
  64234. }, {
  64235. key: "createParticle",
  64236. value: function(e) {
  64237. var t, n, i, r = new wb({
  64238. sizeTween: this.sizeTween,
  64239. opacityTween: this.opacityTween,
  64240. colorTween: this.colorTween
  64241. });
  64242. r.deathAge = this.particleDeathAge,
  64243. r.center = e,
  64244. "cube" == this.positionStyle && (r.position = this.randomVector3(this.positionBase, this.positionSpread)),
  64245. "sphere" == this.positionStyle && (t = 2 * Math.random() - 1,
  64246. i = 2 * Math.PI * Math.random(),
  64247. n = Math.sqrt(1 - t * t),
  64248. i = new Cn(n * Math.cos(i),t,.2 * Math.abs(n * Math.sin(i))),
  64249. r.position = (new Cn).addVectors(this.positionBase, i.multiplyScalar(this.radius))),
  64250. r.position.add(e),
  64251. "cube" == this.velocityStyle && (r.velocity = this.randomVector3(this.velocityBase, this.velocitySpread)),
  64252. "sphere" == this.velocityStyle && (e = new Cn(0,0,1),
  64253. a = this.randomValue(this.speedBase, this.speedSpread),
  64254. r.velocity = e.normalize().multiplyScalar(a)),
  64255. r.acceleration = this.randomValue(this.accelerationBase, this.accelerationSpread),
  64256. r.angle = this.randomValue(this.angleBase, this.angleSpread),
  64257. r.angleVelocity = this.randomValue(this.angleVelocityBase, this.angleVelocitySpread),
  64258. r.angleAcceleration = this.randomValue(this.angleAccelerationBase, this.angleAccelerationSpread),
  64259. r.size = this.randomValue(this.sizeBase, this.sizeSpread);
  64260. var a = this.randomVector3(this.colorBase, this.colorSpread);
  64261. return r.color = (new Yi).setHSL(a.x, a.y, a.z),
  64262. r.opacity = this.randomValue(this.opacityBase, this.opacitySpread),
  64263. r.age = 0,
  64264. r.alive = 0,
  64265. r
  64266. }
  64267. }, {
  64268. key: "getPointsForBound",
  64269. value: function() {
  64270. return this.boundPoints
  64271. }
  64272. }, {
  64273. key: "getBound",
  64274. value: function(e) {
  64275. var n = this;
  64276. this.boundPoints = [];
  64277. var i = new kn
  64278. , t = .11 * this.sizeTween.values.slice().sort(function(e, t) {
  64279. return t - e
  64280. })[0]
  64281. , r = .5 + t;
  64282. e.forEach(function(e) {
  64283. var t = e.clone();
  64284. t.z += n.height,
  64285. i.expandByPoint(e),
  64286. i.expandByPoint(t),
  64287. n.boundPoints.push(e, t)
  64288. });
  64289. e = this.radius + r;
  64290. i.expandByVector(new Cn(e,e,0)),
  64291. i.min.z -= t,
  64292. i.max.z += r,
  64293. this.boundingBox = i
  64294. }
  64295. }, {
  64296. key: "createGeometry",
  64297. value: function() {
  64298. this.particleArray = [];
  64299. var e, i, r, t, n = [], a = [], o = [], s = [], l = [], u = [];
  64300. 1 < this.positions.length ? (e = Math.ceil(this.curve.wholeLength / .6) + 1,
  64301. e = (i = this.curve.getSpacedPoints(e)).length,
  64302. r = i.slice(),
  64303. t = function(e) {
  64304. var t = Math.random()
  64305. , n = Math.floor(r.length * t)
  64306. , t = r[n];
  64307. return 1 == r.length ? r = i.slice() : r.splice(n, 1),
  64308. t
  64309. }
  64310. ,
  64311. this.getBound(i)) : this.getBound(this.positions);
  64312. for (var c = 0; c < this.particleCount; c++) {
  64313. var d = (new Cn).copy(1 < this.positions.length ? t(c) : this.positions[0]);
  64314. this.particleArray[c] = this.createParticle(d),
  64315. n[3 * c] = this.particleArray[c].position.x,
  64316. n[3 * c + 1] = this.particleArray[c].position.y,
  64317. n[3 * c + 2] = this.particleArray[c].position.z,
  64318. a[3 * c] = this.particleArray[c].color.r,
  64319. a[3 * c + 1] = this.particleArray[c].color.g,
  64320. a[3 * c + 2] = this.particleArray[c].color.b,
  64321. o[c] = this.particleArray[c].alive,
  64322. s[c] = this.particleArray[c].opacity,
  64323. l[c] = this.particleArray[c].size,
  64324. u[c] = this.particleArray[c].angle
  64325. }
  64326. this.geometry.setAttribute("position", new nr(new Float32Array(n),3)),
  64327. this.geometry.setAttribute("customColor", new nr(new Float32Array(a),3)),
  64328. this.geometry.setAttribute("customVisible", new nr(new Float32Array(o),1)),
  64329. this.geometry.setAttribute("customOpacity", new nr(new Float32Array(s),1)),
  64330. this.geometry.setAttribute("customSize", new nr(new Float32Array(l),1)),
  64331. this.geometry.setAttribute("customAngle", new nr(new Float32Array(u),1))
  64332. }
  64333. }, {
  64334. key: "createMaterial",
  64335. value: function() {
  64336. var e;
  64337. this.material = new Qr((H(e = {
  64338. uniforms: {
  64339. u_sampler: {
  64340. type: "t",
  64341. value: K1 = K1 || (new _c).load(Potree.resourcePath + "/textures/smokeparticle.png")
  64342. },
  64343. heightOfNearPlane: {
  64344. type: "f",
  64345. value: 0
  64346. }
  64347. },
  64348. vertexShader: bb
  64349. }, "vertexShader", bb),
  64350. H(e, "fragmentShader", "\n uniform sampler2D u_sampler;\n varying vec4 vColor;\t\n varying float vAngle; \n void main()\n {\n gl_FragColor = vColor;\n \n float c = cos(vAngle);\n float s = sin(vAngle);\n vec2 rotatedUV = vec2(c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5, c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5); \n vec4 rotatedTexture = texture2D( u_sampler, rotatedUV );\n gl_FragColor = gl_FragColor * rotatedTexture; \n }\n"),
  64351. H(e, "transparent", !0),
  64352. H(e, "alphaTest", .5),
  64353. H(e, "blending", this.blendStyle),
  64354. H(e, "depthTest", this.blendStyle != K),
  64355. e)),
  64356. this.setPerspective(this.fov, this.screenHeight)
  64357. }
  64358. }, {
  64359. key: "update",
  64360. value: function(e) {
  64361. if (viewer.getObjVisiByReason(this, "force"))
  64362. if (Potree.Utils.isInsideFrustum(this.boundingBox, viewer.scene.getActiveCamera())) {
  64363. viewer.updateVisible(this, "isInsideFrustum", !0),
  64364. 1 < e && console.log("update dt>1", e);
  64365. for (var t, n = [], i = [], r = [], a = [], o = [], s = [], l = [], u = [], c = 0; c < this.particleCount; c++)
  64366. this.particleArray[c].alive && ("cube" == this.velocityStyle && (t = Math.random(),
  64367. this.particleArray[c].age - this.particleArray[c].lastChangeVage > this.particleDeathAge * t && (this.particleArray[c].velocity = this.randomVector3(this.velocityBase, this.velocitySpread),
  64368. this.particleArray[c].lastChangeVage = this.particleArray[c].age)),
  64369. this.particleArray[c].update(e),
  64370. this.particleArray[c].age > this.particleDeathAge && (this.particleArray[c].alive = 0,
  64371. n.push(c),
  64372. i.push((this.particleArray[c].age - this.particleDeathAge) % this.particleDeathAge)),
  64373. r[3 * c] = this.particleArray[c].position.x,
  64374. r[3 * c + 1] = this.particleArray[c].position.y,
  64375. r[3 * c + 2] = this.particleArray[c].position.z,
  64376. a[3 * c] = this.particleArray[c].color.r,
  64377. a[3 * c + 1] = this.particleArray[c].color.g,
  64378. a[3 * c + 2] = this.particleArray[c].color.b,
  64379. o[c] = this.particleArray[c].alive,
  64380. s[c] = this.particleArray[c].opacity,
  64381. l[c] = this.particleArray[c].size,
  64382. u[c] = this.particleArray[c].angle);
  64383. if (this.geometry.setAttribute("position", new nr(new Float32Array(r),3)),
  64384. this.geometry.setAttribute("customColor", new nr(new Float32Array(a),3)),
  64385. this.geometry.setAttribute("customVisible", new nr(new Float32Array(o),1)),
  64386. this.geometry.setAttribute("customOpacity", new nr(new Float32Array(s),1)),
  64387. this.geometry.setAttribute("customSize", new nr(new Float32Array(l),1)),
  64388. this.geometry.setAttribute("customAngle", new nr(new Float32Array(u),1)),
  64389. this.geometry.attributes.customColor.needsUpdate = !0,
  64390. this.geometry.attributes.customVisible.needsUpdate = !0,
  64391. this.geometry.attributes.customOpacity.needsUpdate = !0,
  64392. this.geometry.attributes.customSize.needsUpdate = !0,
  64393. this.geometry.attributes.customAngle.needsUpdate = !0,
  64394. this.emitterAge < this.particleDeathAge) {
  64395. var d = this.particleCount / this.particleDeathAge
  64396. , h = Math.round(d * (this.emitterAge + 0))
  64397. , p = Math.round(d * (this.emitterAge + e));
  64398. p > this.particleCount && (p = this.particleCount);
  64399. for (c = h; c < p; c++)
  64400. this.particleArray[c].alive = 1
  64401. }
  64402. for (var f = 0; f < n.length; f++) {
  64403. c = n[f];
  64404. this.particleArray[c] = this.createParticle(this.particleArray[c].center),
  64405. this.particleArray[c].alive = 1,
  64406. this.particleArray[c].age = i[f],
  64407. r[3 * c] = this.particleArray[c].position.x,
  64408. r[3 * c + 1] = this.particleArray[c].position.y,
  64409. r[3 * c + 2] = this.particleArray[c].position.z
  64410. }
  64411. this.geometry.setAttribute("position", new nr(new Float32Array(r),3)),
  64412. this.geometry.attributes.position.needsUpdate = !0,
  64413. this.emitterAge += e
  64414. } else
  64415. viewer.updateVisible(this, "isInsideFrustum", !1)
  64416. }
  64417. }, {
  64418. key: "randomValue",
  64419. value: function(e, t) {
  64420. var n = Math.random();
  64421. return e * n + t * (1 - n)
  64422. }
  64423. }, {
  64424. key: "randomVector3",
  64425. value: function(e, t) {
  64426. var n = new Cn(Math.random() - .5,Math.random() - .5,Math.random() - .5);
  64427. return (new Cn).addVectors(e, (new Cn).multiplyVectors(t, n))
  64428. }
  64429. }, {
  64430. key: "setSize",
  64431. value: function(e) {
  64432. e = e.viewport;
  64433. this.screenHeight = e.resolution.y,
  64434. this.setPerspective(this.fov, this.screenHeight)
  64435. }
  64436. }, {
  64437. key: "setFov",
  64438. value: function(e) {
  64439. this.fov = e,
  64440. this.setPerspective(this.fov, this.screenHeight)
  64441. }
  64442. }, {
  64443. key: "setPerspective",
  64444. value: function(e, t) {
  64445. e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e))));
  64446. this.material.uniforms.heightOfNearPlane.value = e
  64447. }
  64448. }, {
  64449. key: "dispose",
  64450. value: function() {
  64451. this.geometry.dispose(),
  64452. this.material.dispose(),
  64453. this.dispatchEvent("dispose")
  64454. }
  64455. }]),
  64456. s
  64457. }()), _b = Math.PI / 180, Mb = function() {
  64458. function e() {
  64459. O(this, e),
  64460. this.position = new Cn,
  64461. this.velocity = new Cn,
  64462. this.angle = 0,
  64463. this.angleVelocity = 0,
  64464. this.angleAcceleration = 0,
  64465. this.size = 16,
  64466. this.color = new Yi,
  64467. this.opacity = 1,
  64468. this.rebornCount = 0,
  64469. this.age = 0,
  64470. this.alive = 0,
  64471. this.deadAge = 0,
  64472. this.sizeTween = null,
  64473. this.colorTween = null,
  64474. this.opacityTween = null
  64475. }
  64476. return h(e, [{
  64477. key: "update",
  64478. value: function(e) {
  64479. this.position.add(this.velocity.clone().multiplyScalar(e)),
  64480. this.velocity.multiplyScalar(1 + this.acceleration * e),
  64481. this.angle += this.angleVelocity * _b * e,
  64482. this.angleVelocity += this.angleAcceleration * _b * e,
  64483. this.age += e,
  64484. 0 < this.sizeTween.times.length && (this.size = this.sizeTween.lerp(this.age / this.deathAge)),
  64485. 0 < this.colorTween.times.length && (e = this.colorTween.lerp(this.age / this.deathAge),
  64486. this.color = (new Yi).setHSL(e.x, e.y, e.z)),
  64487. 0 < this.opacityTween.times.length && (this.opacity = this.opacityTween.lerp(this.age / this.deathAge))
  64488. }
  64489. }]),
  64490. e
  64491. }(), Ab = new (function() {
  64492. function e() {
  64493. O(this, e)
  64494. }
  64495. return h(e, [{
  64496. key: "randomValue",
  64497. value: function(e, t) {
  64498. var n = Math.random();
  64499. return e * n + t * (1 - n)
  64500. }
  64501. }, {
  64502. key: "randomVector3",
  64503. value: function(e, t) {
  64504. var n = new Cn(Math.random() - .5,Math.random() - .5,Math.random() - .5);
  64505. return (new Cn).addVectors(e, (new Cn).multiplyVectors(t, n))
  64506. }
  64507. }]),
  64508. e
  64509. }()), Tb = 1, Sb = 2, Cb = (new Tu(1,10,4),
  64510. new $i({
  64511. wireframe: !0,
  64512. color: "#ffffff"
  64513. }),
  64514. {
  64515. position: new Cn(0,0,1),
  64516. positionShape: Sb,
  64517. positionRange: new Cn(1,1,1),
  64518. radius: 1.3,
  64519. velocityShape: Sb,
  64520. velocity: new Cn(0,0,2),
  64521. velocityRange: new Cn(0,0,3),
  64522. speed: .4,
  64523. speedRange: 1,
  64524. size: .4,
  64525. sizeRange: 2,
  64526. sizeTween: [[0, .04, .2, 1], [.1, 1, 6, 8]],
  64527. color: new Cn(1,1,1),
  64528. colorRange: new Cn(0,0,0),
  64529. colorTween: new yb,
  64530. opacity: 1,
  64531. opacityRange: 0,
  64532. opacityTween: new yb([0, .06, .3, .8, 1],[0, 1, .3, .05, 0]),
  64533. blendMode: ee,
  64534. acceleration: .5,
  64535. accelerationRange: 0,
  64536. angle: 0,
  64537. angleRange: 0,
  64538. angleVelocity: 0,
  64539. angleVelocityRange: 0,
  64540. angleAcceleration: 0,
  64541. angleAccelerationRange: 0,
  64542. strength: 1,
  64543. particleDeathAge: .7,
  64544. recycleTimes: 3,
  64545. particleSpaceTime: 3
  64546. }), Pb = function() {
  64547. y(a, gl);
  64548. var r = w(a);
  64549. function a(e) {
  64550. var t;
  64551. O(this, a),
  64552. (t = r.call(this)).age = 0,
  64553. t.alive = !0,
  64554. t.loop = !0,
  64555. t.blendMode = K,
  64556. t.setParameters(e),
  64557. t.createParticles(),
  64558. t.frustumCulled = !1,
  64559. t.setSize({
  64560. viewport: viewer.mainViewport
  64561. }),
  64562. t.setFov(viewer.fov);
  64563. function n(e) {
  64564. "MainView" == e.viewport.name && t.setSize(e)
  64565. }
  64566. function i(e) {
  64567. t.setFov(e.fov)
  64568. }
  64569. return viewer.addEventListener("resize", n),
  64570. viewer.addEventListener("fov_changed", i),
  64571. t.addEventListener("dispose", function() {
  64572. viewer.removeEventListener("resize", n),
  64573. viewer.removeEventListener("fov_changed", i)
  64574. }),
  64575. t
  64576. }
  64577. return h(a, [{
  64578. key: "computeParams",
  64579. value: function() {
  64580. this.curve && this.position.copy(this.curve.points[0]);
  64581. var t = .8 + 9.2 * gn.smoothstep(this.radius * this.strength, .2, 20);
  64582. this.sizeTween.values = this.defaultSizeTween.values.map(function(e) {
  64583. return e * t
  64584. }),
  64585. this.particleCount = Math.ceil(this.strength * this.radius * 5),
  64586. this.speed = Cb.speed * this.radius,
  64587. this.speedRange = Cb.speedRange * this.radius,
  64588. console.log(this.particleCount),
  64589. this.boundPoints = [],
  64590. this.boundPoints.push(this.position.clone());
  64591. var e = this.sizeTween.values.slice().sort(function(e, t) {
  64592. return t - e
  64593. })[0]
  64594. , n = this.radius + (.35 * e + .5)
  64595. , e = new qn(this.position,n);
  64596. this.boundingSphere = e,
  64597. this.boundingBox = (new kn).setFromCenterAndSize(this.position, new Cn(2 * n,2 * n,2 * n))
  64598. }
  64599. }, {
  64600. key: "getPointsForBound",
  64601. value: function() {
  64602. return this.boundPoints
  64603. }
  64604. }, {
  64605. key: "reStart",
  64606. value: function() {
  64607. this.age = 0,
  64608. this.createParticles()
  64609. }
  64610. }, {
  64611. key: "setParameters",
  64612. value: function(e) {
  64613. for (var t in e = $.extend({}, Cb, e)) {
  64614. var n = e[t];
  64615. "position" == t ? this.position.copy(n) : n instanceof Array && n[0]instanceof Array ? this[t] = B(yb, Q(n)) : this[t] = n instanceof Cn || n instanceof Yi ? n.clone() : n
  64616. }
  64617. this.defaultSizeTween = this.sizeTween.clone(),
  64618. this.particles = [],
  64619. this.age = 0,
  64620. this.alive = !0,
  64621. this.geometry = new Mr,
  64622. this.computeParams(),
  64623. this.material = new Qr({
  64624. uniforms: {
  64625. u_sampler: {
  64626. value: this.texture || ($1 = $1 || (new _c).load(Potree.resourcePath + "/textures/explode.png"))
  64627. },
  64628. heightOfNearPlane: {
  64629. type: "f",
  64630. value: 0
  64631. }
  64632. },
  64633. vertexShader: "\n attribute vec3 color;\n attribute float size;\n attribute float angle;\n attribute float opacity;\n attribute float visible;\n varying vec4 vColor;\n varying float vAngle;\n uniform float heightOfNearPlane;\n \n void main() {\n if(visible > 0.5) {\n vColor = vec4(color, opacity);\n } else {\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n vAngle = angle;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n \n gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;\n }\n",
  64634. fragmentShader: "\n uniform sampler2D u_sampler;\n varying vec4 vColor;\n varying float vAngle;\n void main() {\n gl_FragColor = vColor;\n float u = cos(vAngle);\n float v = sin(vAngle);\n vec2 uv = vec2(\n u * (gl_PointCoord.x - 0.5) + v * (gl_PointCoord.y - 0.5) + 0.5, \n u * (gl_PointCoord.y - 0.5) - v * (gl_PointCoord.x - 0.5) + 0.5\n );\n vec4 texture = texture2D(u_sampler, uv);\n gl_FragColor = gl_FragColor * texture;\n }\n",
  64635. transparent: !0,
  64636. alphaTest: .5,
  64637. depthTest: this.blendMode == K,
  64638. blending: this.blendMode
  64639. })
  64640. }
  64641. }, {
  64642. key: "createParticles",
  64643. value: function() {
  64644. this.particles = [];
  64645. for (var e = this.particleCount, t = new Float32Array(3 * e), n = new Float32Array(3 * e), i = new Float32Array(e), r = new Float32Array(e), a = new Float32Array(e), o = new Float32Array(e), s = 0; s < e; s++) {
  64646. var l = this.createParticle();
  64647. this.particles[s] = l
  64648. }
  64649. this.geometry.setAttribute("position", new nr(t,3)),
  64650. this.geometry.setAttribute("color", new nr(n,3)),
  64651. this.geometry.setAttribute("angle", new nr(r,1)),
  64652. this.geometry.setAttribute("size", new nr(i,1)),
  64653. this.geometry.setAttribute("visible", new nr(o,1)),
  64654. this.geometry.setAttribute("opacity", new nr(a,1))
  64655. }
  64656. }, {
  64657. key: "createParticle",
  64658. value: function() {
  64659. var e, t, n, i = new Mb;
  64660. i.sizeTween = this.sizeTween,
  64661. i.colorTween = this.colorTween,
  64662. i.opacityTween = this.opacityTween,
  64663. i.deathAge = this.particleDeathAge,
  64664. this.positionShape == Tb && (i.position = Ab.randomVector3(new Cn, this.positionRange)),
  64665. this.positionShape == Sb && (e = 2 * Math.random() - 1,
  64666. n = 2 * Math.PI * Math.random(),
  64667. t = Math.sqrt(1 - e * e),
  64668. n = new Cn(t * Math.cos(n),e,t * Math.sin(n)),
  64669. i.position = n.multiplyScalar(this.radius)),
  64670. this.velocityShape == Tb && (i.velocity = Ab.randomVector3(this.velocity, this.velocityRange)),
  64671. this.velocityShape == Sb && (n = (new Cn).addVectors(i.position, new Cn(0,0,2 * this.radius)),
  64672. r = Ab.randomValue(this.speed, this.speedRange),
  64673. i.velocity = n.normalize().multiplyScalar(r)),
  64674. i.acceleration = Ab.randomValue(this.acceleration, this.accelerationRange),
  64675. i.angle = Ab.randomValue(this.angle, this.angleRange),
  64676. i.angleVelocity = Ab.randomValue(this.angleVelocity, this.angleVelocityRange),
  64677. i.angleAcceleration = Ab.randomValue(this.angleAcceleration, this.angleAccelerationRange),
  64678. i.size = Ab.randomValue(this.size, this.sizeRange);
  64679. var r = Ab.randomVector3(this.color, this.colorRange);
  64680. return i.color = (new Yi).setHSL(r.x, r.y, r.z),
  64681. i.opacity = Ab.randomValue(this.opacity, this.opacityRange),
  64682. i
  64683. }
  64684. }, {
  64685. key: "update",
  64686. value: function(e) {
  64687. if (viewer.getObjVisiByReason(this, "force")) {
  64688. if (0 < this.delayStartTime)
  64689. return this.delayStartTime -= e;
  64690. if (Potree.Utils.isInsideFrustum(this.boundingSphere, viewer.scene.getActiveCamera())) {
  64691. viewer.updateVisible(this, "isInsideFrustum", !0),
  64692. 1 < e && console.log("update dt>1", e);
  64693. for (var t = this.particleDeathAge, n = this.particleSpaceTime, i = [], r = [], a = [], o = this.geometry.attributes.position.array, s = this.geometry.attributes.opacity.array, l = this.geometry.attributes.visible.array, u = this.geometry.attributes.color.array, c = this.geometry.attributes.angle.array, d = this.geometry.attributes.size.array, h = 0; h < this.particleCount; h++) {
  64694. var p, f = this.particles[h];
  64695. f.alive ? (f.update(e),
  64696. f.age > t && (f.alive = 0,
  64697. f.rebornCount >= this.recycleTimes ? f.deadAge = f.age - t : (i.push(h),
  64698. r.push(f.age - t),
  64699. a.push(f.rebornCount + 1))),
  64700. o[3 * h] = f.position.x,
  64701. o[3 * h + 1] = f.position.y,
  64702. o[3 * h + 2] = f.position.z,
  64703. u[3 * h] = f.color.r,
  64704. u[3 * h + 1] = f.color.g,
  64705. u[3 * h + 2] = f.color.b,
  64706. l[h] = f.alive,
  64707. s[h] = f.opacity,
  64708. c[h] = f.angle,
  64709. d[h] = f.size) : f.rebornCount >= this.recycleTimes && f.age > t && (f.deadAge += e),
  64710. f.rebornCount >= this.recycleTimes && f.age > t && f.deadAge >= n && (i.push(h),
  64711. p = t * (this.recycleTimes + 1) + n,
  64712. r.push((f.deadAge - n) % p),
  64713. a.push(0))
  64714. }
  64715. if (this.geometry.attributes.size.needsUpdate = !0,
  64716. this.geometry.attributes.color.needsUpdate = !0,
  64717. this.geometry.attributes.angle.needsUpdate = !0,
  64718. this.geometry.attributes.visible.needsUpdate = !0,
  64719. this.geometry.attributes.opacity.needsUpdate = !0,
  64720. this.geometry.attributes.position.needsUpdate = !0,
  64721. this.alive) {
  64722. if (this.age < t) {
  64723. var m = Math.round(this.particleCount * (this.age + 0) / t)
  64724. , v = Math.round(this.particleCount * (this.age + e) / t);
  64725. v > this.particleCount && (v = this.particleCount);
  64726. for (var g = m; g < v; g++)
  64727. this.particles[g].alive = 1
  64728. }
  64729. for (var y = 0; y < i.length; y++) {
  64730. var w = i[y];
  64731. this.particles[w] = this.createParticle(),
  64732. this.particles[w].alive = 1,
  64733. this.particles[w].age = r[y],
  64734. this.particles[w].rebornCount = a[y]
  64735. }
  64736. this.geometry.attributes.position.needsUpdate = !0,
  64737. this.age += e,
  64738. this.age > this.deathAge && !this.loop && (this.alive = !1)
  64739. }
  64740. } else
  64741. viewer.updateVisible(this, "isInsideFrustum", !1)
  64742. }
  64743. }
  64744. }, {
  64745. key: "setSize",
  64746. value: function(e) {
  64747. e = e.viewport;
  64748. this.screenHeight = e.resolution.y,
  64749. this.setPerspective(this.fov, this.screenHeight)
  64750. }
  64751. }, {
  64752. key: "setFov",
  64753. value: function(e) {
  64754. this.fov = e,
  64755. this.setPerspective(this.fov, this.screenHeight)
  64756. }
  64757. }, {
  64758. key: "setPerspective",
  64759. value: function(e, t) {
  64760. e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e))));
  64761. this.material.uniforms.heightOfNearPlane.value = e
  64762. }
  64763. }, {
  64764. key: "updateGeometry",
  64765. value: function() {
  64766. this.computeParams(),
  64767. this.reStart()
  64768. }
  64769. }, {
  64770. key: "dispose",
  64771. value: function() {
  64772. this.geometry.dispose(),
  64773. this.material.dispose(),
  64774. this.dispatchEvent("dispose")
  64775. }
  64776. }]),
  64777. a
  64778. }(), Db = {
  64779. "fire+smoke": 16777215,
  64780. smoke: 16777215,
  64781. explode: 16777215
  64782. }, kb = {
  64783. clipDistance: 100,
  64784. occlusionDistance: 60,
  64785. maxClipFactor: .5,
  64786. backColor: "#777",
  64787. useDepth: !0,
  64788. transparent: !0
  64789. }, Bb = {
  64790. bus: new Dh,
  64791. particleGroup: new Si,
  64792. curveGroup: new Si,
  64793. init: function() {
  64794. this.particleGroup.name = "particles",
  64795. viewer.scene.scene.add(this.particleGroup),
  64796. this.curveGroup.name = "particles-curves",
  64797. viewer.scene.scene.add(this.curveGroup)
  64798. },
  64799. addParticle: function() {
  64800. var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  64801. return "fire" == t.type ? e = new gb(t) : "smoke" == t.type ? e = new Eb(t) : "explode" == t.type && (e = new Pb(t)),
  64802. this.particleGroup.add(e),
  64803. e
  64804. },
  64805. removeParticle: function(e) {
  64806. e.dispose(),
  64807. this.particleGroup.remove(e),
  64808. e.curve.dispose()
  64809. },
  64810. update: function(t) {
  64811. this.particleGroup.children.forEach(function(e) {
  64812. return e.update(t)
  64813. })
  64814. },
  64815. startInsertion: function() {
  64816. var t = this
  64817. , n = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "fire"
  64818. , i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  64819. , r = $.Deferred()
  64820. , a = []
  64821. , o = function(e) {
  64822. e && r.resolve(a),
  64823. viewer.dispatchEvent({
  64824. type: "CursorChange",
  64825. action: "remove",
  64826. name: "addSth"
  64827. }),
  64828. viewer.removeEventListener("global_click", u),
  64829. t.bus.removeEventListener("cancel_insertions", l)
  64830. }
  64831. , s = new hv([],Y1(n),Db[n],n + "_curve",{
  64832. handleMat: Z1(n)
  64833. });
  64834. this.curveGroup.add(s),
  64835. i.curve = s,
  64836. i.type = n;
  64837. var l = function() {
  64838. console.log("cancel_insertions", s.uuid),
  64839. s.dispose(),
  64840. o(!1)
  64841. };
  64842. this.bus.dispatchEvent("cancel_insertions"),
  64843. this.bus.addEventListener("cancel_insertions", l);
  64844. var u = function(e) {
  64845. if (e.button !== C.RIGHT) {
  64846. e = e.intersect && (e.intersect.orthoIntersect || e.intersect.location);
  64847. if (e)
  64848. return s.addPoint(e, null, !0),
  64849. "explode" == n && (a = t.createFromData(i),
  64850. o(!0)),
  64851. {
  64852. stopContinue: !0
  64853. }
  64854. } else
  64855. 1 <= s.points.length && (a = t.createFromData(i),
  64856. o(!0))
  64857. };
  64858. return viewer.addEventListener("global_click", u, 10),
  64859. viewer.dispatchEvent({
  64860. type: "CursorChange",
  64861. action: "add",
  64862. name: "addSth"
  64863. }),
  64864. r.promise()
  64865. },
  64866. createFromData: function(e) {
  64867. var t, n, i = e.type, r = [], a = e.curve;
  64868. return a || (a = new hv(e.points,Y1(i),Db[i],i + "_curve",{
  64869. handleMat: Z1(i)
  64870. }),
  64871. this.curveGroup.add(a)),
  64872. i.includes("fire") || i.includes("smoke") ? (i.includes("fire") && (t = this.addParticle({
  64873. type: "fire",
  64874. positions: a.points,
  64875. curve: a,
  64876. radius: e.radius,
  64877. height: e.height,
  64878. strength: e.strength
  64879. }),
  64880. r.push(t)),
  64881. i.includes("smoke") && (t = this.addParticle({
  64882. type: "smoke",
  64883. positions: a.points,
  64884. curve: a,
  64885. positionStyle: "sphere",
  64886. strength: e.smokeStrength,
  64887. radius: e.smokeRadius,
  64888. height: e.smokeHeight
  64889. }),
  64890. r.push(t))) : "explode" == i && (e = this.addParticle({
  64891. type: "explode",
  64892. position: a.points[0],
  64893. strength: e.strength,
  64894. radius: e.radius,
  64895. particleSpaceTime: e.particleSpaceTime,
  64896. curve: a,
  64897. delayStartTime: e.delayStartTime
  64898. }),
  64899. r.push(e)),
  64900. a.addEventListener("dragCurvePoint", function() {
  64901. n = !0,
  64902. Fm.intervalTool.isWaiting("particlePointChange", function() {
  64903. if (n)
  64904. return r.forEach(function(e) {
  64905. return e.updateGeometry()
  64906. }),
  64907. n = !1,
  64908. a.dispatchEvent("sendUpdatePoints"),
  64909. !0
  64910. }, 400)
  64911. }),
  64912. r
  64913. }
  64914. }, Lb = {
  64915. createAnimation: function(e) {
  64916. var t = new bv(viewer);
  64917. if (e) {
  64918. t.name = e.name,
  64919. t.duration = e.duration,
  64920. t.useDurSlice = e.useDurSlice;
  64921. var n, i = ue(e.points);
  64922. try {
  64923. for (i.s(); !(n = i.n()).done; ) {
  64924. var r = n.value
  64925. , a = (new Cn).copy(r.position)
  64926. , o = (new Cn).copy(r.target)
  64927. , s = r.time;
  64928. t.createControlPoint(null, {
  64929. position: a,
  64930. target: o,
  64931. duration: s
  64932. })
  64933. }
  64934. } catch (e) {
  64935. i.e(e)
  64936. } finally {
  64937. i.f()
  64938. }
  64939. }
  64940. return t.changeCallback(),
  64941. viewer.scene.addCameraAnimation(t),
  64942. t
  64943. },
  64944. removeAnimation: function(e) {
  64945. e.dispatchEvent("dispose"),
  64946. viewer.scene.removeCameraAnimation(e)
  64947. }
  64948. }, Rb = new _c;
  64949. Rb.crossOrigin = "anonymous";
  64950. var Fb, Ib, Ob, zb, Nb, Ub, Gb, Hb, Vb, jb = {}, Wb = {}, Xb = 3, qb = 2, Jb = 1, Yb = "#c60", Zb = "#17c", Qb = 1.3, Kb = 2, $b = [{
  64951. name: "top",
  64952. axis: ["x", "y"],
  64953. direction: new Cn(0,0,-1),
  64954. openCount: 0
  64955. }, {
  64956. name: "right",
  64957. axis: ["y", "z"],
  64958. direction: new Cn(1,0,0),
  64959. openCount: 0
  64960. }], ex = new (function() {
  64961. y(n, hn);
  64962. var t = w(n);
  64963. function n() {
  64964. var e;
  64965. return O(this, n),
  64966. (e = t.call(this)).panoGroup = [],
  64967. e.viewports = {},
  64968. e.panoLink = {},
  64969. e.panoMeshs = new Si,
  64970. e.lineMeshes = new Si,
  64971. e.views = {},
  64972. e.cameras = {},
  64973. e.orthoCamera = new ed(-100,100,100,100,.01,1e4),
  64974. e.selectedPano,
  64975. e.selectedGroup,
  64976. e.operation,
  64977. e.visiblePanos = [],
  64978. e
  64979. }
  64980. return h(n, [{
  64981. key: "init",
  64982. value: function() {
  64983. var i = this;
  64984. jb.default = Sf.createFatLineMat({
  64985. color: "#eeeeee",
  64986. lineWidth: 2,
  64987. depthTest: !1
  64988. }),
  64989. jb.hovered = Sf.createFatLineMat({
  64990. color: "#00c8af",
  64991. lineWidth: 2,
  64992. depthTest: !1
  64993. }),
  64994. jb.selected = Sf.createFatLineMat({
  64995. color: "#00c8af",
  64996. lineWidth: 3,
  64997. depthTest: !1
  64998. }),
  64999. this.initViews(),
  65000. viewer.addEventListener("allLoaded", function() {
  65001. var t;
  65002. nb = viewer.images360,
  65003. ib = viewer.modules.Alignment,
  65004. rb = viewer.modules.SiteModel,
  65005. i.panoMeshs.name = "panoMeshs",
  65006. viewer.scene.scene.add(i.panoMeshs),
  65007. i.lineMeshes.name = "lineMeshes",
  65008. viewer.scene.scene.add(i.lineMeshes),
  65009. i.initPanoLink(),
  65010. i.addPanoMesh(),
  65011. viewer.scene.pointclouds.forEach(function(e) {
  65012. e.material.color = Zb
  65013. }),
  65014. i.switchView("top"),
  65015. rb.bus.addEventListener("initDataDone", function() {
  65016. var e = rb.entities.find(function(e) {
  65017. return "floor" == e.buildType && e.panos.length
  65018. });
  65019. e || (e = "all",
  65020. console.log("没有一层有漫游点?!")),
  65021. i.gotoFloor(e)
  65022. }),
  65023. ib.bus.addEventListener("switchHandle", i.updateCursor.bind(i)),
  65024. viewer.addEventListener("global_click", function(e) {
  65025. e.button === C.RIGHT ? (console.log("right click", e),
  65026. i.setLinkOperateState("addLink", !1),
  65027. i.setLinkOperateState("removeLink", !1)) : i.clickToZoomInEnabled && (i.zoomIn(e.intersect.orthoIntersect, e.pointer),
  65028. i.setZoomInState(!1))
  65029. }),
  65030. i.rotGuideLine = Sf.createLine([], {
  65031. color: "#aaffee"
  65032. }),
  65033. i.rotGuideLine.visible = !1,
  65034. i.rotGuideLine.name = "rotGuideLine",
  65035. i.rotGuideLine.renderOrder = Jb,
  65036. viewer.scene.scene.add(i.rotGuideLine),
  65037. ib.bus.addEventListener("rotateStart", function(e) {
  65038. t = e.startPoint
  65039. }),
  65040. ib.bus.addEventListener("rotate", function(e) {
  65041. Sf.updateLine(i.rotGuideLine, [t, e.endPoint]),
  65042. i.rotGuideLine.visible = !0
  65043. }),
  65044. viewer.fpControls.addEventListener("end", function(e) {
  65045. t = null,
  65046. i.rotGuideLine.visible = !1
  65047. }),
  65048. i.linkGuideLine = Sf.createLine([], {
  65049. color: "#aaa",
  65050. deshed: !0,
  65051. dashSize: .1,
  65052. gapSize: .1
  65053. }),
  65054. i.linkGuideLine.visible = !1,
  65055. i.linkGuideLine.name = "linkGuideLine",
  65056. viewer.scene.scene.add(i.linkGuideLine),
  65057. i.linkGuideLine.renderOrder = Jb;
  65058. function n(e) {
  65059. if ("addLink" != i.operation || "top" != i.activeViewName || !i.selectedPano)
  65060. return i.linkGuideLine.visible = !1;
  65061. Sf.updateLine(i.linkGuideLine, [i.selectedPano.position, e.intersect.orthoIntersect.clone().setZ(i.selectedPano.position.z)]),
  65062. i.linkGuideLine.visible = !0
  65063. }
  65064. viewer.addEventListener("global_mousemove", function(e) {
  65065. n(e)
  65066. }),
  65067. i.addEventListener("updateLinkGuideLine", n)
  65068. })
  65069. }
  65070. }, {
  65071. key: "initViews",
  65072. value: function() {
  65073. this.splitScreenTool = new A1,
  65074. this.targetPlane = viewer.mainViewport.targetPlane = new ki,
  65075. this.shiftTarget = viewer.mainViewport.shiftTarget = new Cn;
  65076. for (var e = 0; e < 2; e++) {
  65077. var t = $b[e]
  65078. , n = new ng;
  65079. this.views[t.name] = n,
  65080. this.cameras[t.name] = this.orthoCamera,
  65081. n.direction = t.direction
  65082. }
  65083. this.views.mainView = viewer.mainViewport.view,
  65084. this.cameras.mainView = viewer.mainViewport.camera
  65085. }
  65086. }, {
  65087. key: "switchView",
  65088. value: function(t) {
  65089. var n = this
  65090. , i = this.views[t]
  65091. , e = this.cameras[t]
  65092. , r = $b.find(function(e) {
  65093. return e.name == t
  65094. })
  65095. , a = viewer.bound
  65096. , o = a.boundSize
  65097. , s = a.center;
  65098. this.lastViewName = this.activeViewName,
  65099. this.activeViewName = t;
  65100. var l, u = this.views[this.lastViewName], a = this.cameras[this.lastViewName];
  65101. viewer.mainViewport.view = i,
  65102. viewer.mainViewport.camera = e,
  65103. a && (u.zoom = a.zoom),
  65104. this.targetPlane.setFromNormalAndCoplanarPoint(i.direction.clone(), s),
  65105. this.targetPlane.projectPoint(i.position, this.shiftTarget),
  65106. i.position.copy(this.splitScreenTool.getPosOutOfModel(viewer.mainViewport)),
  65107. i.zoom && (e.zoom = i.zoom),
  65108. viewer.updateScreenSize({
  65109. forceUpdateSize: !0
  65110. }),
  65111. this.updateCursor(),
  65112. "mainView" == t ? (viewer.mainViewport.alignment = null,
  65113. viewer.scene.pointclouds.forEach(function(e) {
  65114. e.material.activeAttributeName = "rgba",
  65115. e.material.useFilterByNormal = !1,
  65116. e.changePointOpacity(1, !0)
  65117. }),
  65118. viewer.updateVisible(viewer.reticule, "force", !0),
  65119. u && (i.copy(u),
  65120. l = i.direction,
  65121. u = nb.panos.filter(function(e) {
  65122. return e.circle.visible
  65123. }),
  65124. u = Fm.sortByScore(u, [], [function(e) {
  65125. return -(new Cn).subVectors(e.position, i.position).dot(l)
  65126. }
  65127. ], !0),
  65128. console.log("最近", u),
  65129. u && u[0] && (e = a.top / a.zoom / Math.tan(gn.degToRad(e.fov / 2)),
  65130. i.position.add(l.clone().multiplyScalar(-u[0].score - e)),
  65131. this.lastDisToPano = e)),
  65132. viewer.fpControls.lockKey = !1) : (0 == r.openCount && this.viewportFitBound(t, o, s),
  65133. r.openCount++,
  65134. viewer.scene.pointclouds.forEach(function(e) {
  65135. e.material.activeAttributeName = "color",
  65136. e.material.useFilterByNormal = !0,
  65137. n.selectedPano && n.selectedClouds.includes(e) ? e.changePointOpacity(Kb, !0) : e.changePointOpacity(Qb, !0)
  65138. }),
  65139. viewer.updateVisible(viewer.reticule, "force", !1),
  65140. "top" == t && (viewer.mainViewport.alignment = {
  65141. rotate: !0,
  65142. translate: !0
  65143. }),
  65144. "right" == t ? (viewer.mainViewport.alignment = {
  65145. translate: !0,
  65146. rotateSide: !0
  65147. },
  65148. viewer.mainViewport.rotateSide = !0) : viewer.mainViewport.rotateSide = !1,
  65149. viewer.fpControls.lockKey = !0),
  65150. this.setZoomInState(!1)
  65151. }
  65152. }, {
  65153. key: "viewportFitBound",
  65154. value: function() {
  65155. var e = this;
  65156. if (0 == viewer.mainViewport.resolution.x || 0 == viewer.mainViewport.resolution.y)
  65157. return setTimeout(function() {
  65158. e.viewportFitBound()
  65159. }, 10);
  65160. this.gotoFloor(this.currentFloor, !0, 0, null, !0)
  65161. }
  65162. }, {
  65163. key: "rotateSideCamera",
  65164. value: function(e) {
  65165. this.splitScreenTool.rotateSideCamera(viewer.mainViewport, e)
  65166. }
  65167. }, {
  65168. key: "zoomIn",
  65169. value: function(e, t) {
  65170. var n = viewer.mainViewport.camera;
  65171. 700 <= n.zoom || viewer.mainViewport.view.zoomOrthoCamera(n, 700, t, 300)
  65172. }
  65173. }, {
  65174. key: "moveFit",
  65175. value: function(e, t, n) {
  65176. this.splitScreenTool.viewportFitBound(viewer.mainViewport, t.bound, e, n, {
  65177. x: 200,
  65178. y: 230
  65179. })
  65180. }
  65181. }, {
  65182. key: "setZoomInState",
  65183. value: function(e, t) {
  65184. if (e && "mainView" == this.activeViewName)
  65185. return console.log("3D不可放大");
  65186. this.clickToZoomInEnabled = !!e,
  65187. e ? viewer.dispatchEvent({
  65188. type: "CursorChange",
  65189. action: "add",
  65190. name: "zoomInCloud"
  65191. }) : viewer.dispatchEvent({
  65192. type: "CursorChange",
  65193. action: "remove",
  65194. name: "zoomInCloud"
  65195. }),
  65196. e || t || this.dispatchEvent({
  65197. type: "operationCancel",
  65198. operation: "zoomIn"
  65199. })
  65200. }
  65201. }, {
  65202. key: "gotoFloor",
  65203. value: function(e, t) {
  65204. var n, i, r, a = this, o = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 600, s = 3 < arguments.length ? arguments[3] : void 0, l = 4 < arguments.length ? arguments[4] : void 0;
  65205. this.currentFloor == (e = e || "all") && !t || (n = ("all" == e ? viewer.images360 : e).panos,
  65206. viewer.images360.panos.forEach(function(e) {
  65207. var t = n.includes(e);
  65208. a.switchPanoVisible(e, t)
  65209. }),
  65210. this.updateLinesVisible(),
  65211. this.selectedPano && "all" != e && !e.panos.includes(this.selectedPano) && this.selectedPano.circle.dispatchEvent("click"),
  65212. this.selectedLine && this.selectedLine.dispatchEvent("click"),
  65213. "all" == e ? (i = viewer.images360.bound.bounding,
  65214. r = viewer.images360.bound.center) : (r = (i = this.getPanosBound(e)).getCenter(new Cn),
  65215. 0 == e.panos.length && console.log(e.name, "floor无漫游点")),
  65216. "mainView" != this.activeViewName ? l && this.moveFit(r, {
  65217. bound: i
  65218. }, o) : "mainView" == this.activeViewName && "all" != e && viewer.scene.view.setView({
  65219. position: r,
  65220. duration: o
  65221. }),
  65222. this.currentFloor = e,
  65223. s || this.dispatchEvent({
  65224. type: "changeFloor",
  65225. floor: e
  65226. }))
  65227. }
  65228. }, {
  65229. key: "getPanosBound",
  65230. value: function(e) {
  65231. var t;
  65232. return e.panosBound || (0 == e.panos.length ? e.panosBound = viewer.images360.bound.bounding.clone() : (t = new Cn(5,5,5),
  65233. t = Up.getBoundByPoints(e.panos.map(function(e) {
  65234. return e.position
  65235. }), t),
  65236. e.panosBound = t.bounding)),
  65237. e.panosBound
  65238. }
  65239. }, {
  65240. key: "switchPanoVisible",
  65241. value: function(e, t, n) {
  65242. var i;
  65243. e.circle.visible = t,
  65244. viewer.updateVisible(e, "panoEditor", t),
  65245. viewer.updateVisible(e.pointcloud, "panoEditor", t),
  65246. t ? this.visiblePanos.includes(e) || this.visiblePanos.push(e) : -1 < (i = this.visiblePanos.indexOf(e)) && this.visiblePanos.splice(i, 1),
  65247. n && this.updateLinesVisible(),
  65248. n || this.dispatchEvent({
  65249. type: "switchPanoVisible",
  65250. pano: e,
  65251. v: t
  65252. })
  65253. }
  65254. }, {
  65255. key: "updateLinesVisible",
  65256. value: function() {
  65257. var i = this;
  65258. this.lineMeshes.children.forEach(function(e) {
  65259. var t = e.name.split("-")
  65260. , n = nb.getPano(t[0])
  65261. , t = nb.getPano(t[1]);
  65262. e.visible = i.visiblePanos.includes(n) || i.visiblePanos.includes(t)
  65263. })
  65264. }
  65265. }, {
  65266. key: "updateCursor",
  65267. value: function() {
  65268. var e = "mainView" != this.activeViewName && this.selectedPano ? ib.handleState : null;
  65269. "rotate" == e ? (viewer.dispatchEvent({
  65270. type: "CursorChange",
  65271. action: "add",
  65272. name: "rotatePointcloud"
  65273. }),
  65274. viewer.dispatchEvent({
  65275. type: "CursorChange",
  65276. action: "remove",
  65277. name: "movePointcloud"
  65278. })) : ("translate" == e ? viewer.dispatchEvent({
  65279. type: "CursorChange",
  65280. action: "add",
  65281. name: "movePointcloud"
  65282. }) : viewer.dispatchEvent({
  65283. type: "CursorChange",
  65284. action: "remove",
  65285. name: "movePointcloud"
  65286. }),
  65287. viewer.dispatchEvent({
  65288. type: "CursorChange",
  65289. action: "remove",
  65290. name: "rotatePointcloud"
  65291. }))
  65292. }
  65293. }, {
  65294. key: "setLinkOperateState",
  65295. value: function(e, t, n) {
  65296. var i;
  65297. t && e == this.operation || !t && e != this.operation || (i = this.operation,
  65298. this.operation = t ? e : null,
  65299. "removeLink" == this.operation && (this.selectedLine && this.selectedLine.dispatchEvent("click"),
  65300. this.selectedPano && this.selectedPano.circle.dispatchEvent("click")),
  65301. "addLink" != this.operation && (this.linkGuideLine.visible = !1),
  65302. t || n || this.dispatchEvent({
  65303. type: "operationCancel",
  65304. operation: i
  65305. }),
  65306. "addLink" == this.operation ? viewer.dispatchEvent({
  65307. type: "CursorChange",
  65308. action: "add",
  65309. name: "connectPano"
  65310. }) : viewer.dispatchEvent({
  65311. type: "CursorChange",
  65312. action: "remove",
  65313. name: "connectPano"
  65314. }),
  65315. "removeLink" == this.operation ? viewer.dispatchEvent({
  65316. type: "CursorChange",
  65317. action: "add",
  65318. name: "disconnectPano"
  65319. }) : viewer.dispatchEvent({
  65320. type: "CursorChange",
  65321. action: "remove",
  65322. name: "disconnectPano"
  65323. }))
  65324. }
  65325. }, {
  65326. key: "initPanoLink",
  65327. value: function() {
  65328. var n = this;
  65329. nb.panos.forEach(function(e) {
  65330. n.panoLink[e.id] = {}
  65331. }),
  65332. nb.panos.forEach(function(t) {
  65333. t.visibles.forEach(function(e) {
  65334. n.linkChange(t, nb.getPano(e, "index"), "add")
  65335. })
  65336. }),
  65337. console.log("panoLink", this.panoLink)
  65338. }
  65339. }, {
  65340. key: "groupChange",
  65341. value: function(n, i, e) {
  65342. var r = this;
  65343. "add" == e ? Fm.pushToGroupAuto([n, i], this.panoGroup) : (e = this.panoGroup.find(function(e) {
  65344. return e.includes(n) && (e.includes(i) || !i)
  65345. })) ? (this.panoGroup.splice(this.panoGroup.indexOf(e), 1),
  65346. e.forEach(function(e) {
  65347. if (e != n && e != i)
  65348. for (var t in r.panoLink[e.id])
  65349. r.panoLink[e.id][t] && (t = nb.getPano(t),
  65350. Fm.pushToGroupAuto([e, t], r.panoGroup))
  65351. })) : i ? console.log("这两个pano原本就不在一个组", n.id, i.id) : console.log("pano0不在任何组", n)
  65352. }
  65353. }, {
  65354. key: "linkChange",
  65355. value: function(t, e, n) {
  65356. var i = this
  65357. , r = [];
  65358. if ("add" == n) {
  65359. if (!e)
  65360. return console.error("不支持add时pano1为空");
  65361. this.panoLink[t.id][e.id] = this.panoLink[t.id][e.id] || {},
  65362. this.panoLink[e.id][t.id] = this.panoLink[e.id][t.id] || {}
  65363. } else if (e)
  65364. this.panoLink[t.id][e.id] = !1,
  65365. this.panoLink[e.id][t.id] = !1;
  65366. else {
  65367. for (var a in this.panoLink[t.id])
  65368. this.panoLink[t.id][a] && (this.panoLink[a][t.id] = !1,
  65369. r.push(a));
  65370. this.panoLink[t.id] = {}
  65371. }
  65372. e ? this.lineChange(t, e, n) : r.forEach(function(e) {
  65373. i.lineChange(t, nb.getPano(e), n)
  65374. }),
  65375. this.groupChange(t, e, n),
  65376. this.selectPano(this.selectedPano, !1, !0)
  65377. }
  65378. }, {
  65379. key: "lineChange",
  65380. value: function(t, n, e) {
  65381. var i, r = this;
  65382. "add" == e ? this.panoLink[t.id][n.id].line || ((i = Sf.createFatLine([t.position, n.position], {
  65383. material: jb.default
  65384. })).name = "".concat(t.id, "-").concat(n.id),
  65385. i.renderOrder = i.pickOrder = Jb,
  65386. this.lineMeshes.add(i),
  65387. (this.panoLink[t.id][n.id].line = this.panoLink[n.id][t.id].line = i).addEventListener("mouseover", function() {
  65388. r.clickToZoomInEnabled || "mainView" != r.activeViewName && (r.selectedLine != i && (i.material = jb.hovered),
  65389. viewer.dispatchEvent({
  65390. type: "CursorChange",
  65391. action: "add",
  65392. name: "hoverLine"
  65393. }))
  65394. }),
  65395. i.addEventListener("mouseleave", function() {
  65396. r.clickToZoomInEnabled || (r.selectedLine != i && (i.material = jb.default),
  65397. viewer.dispatchEvent({
  65398. type: "CursorChange",
  65399. action: "remove",
  65400. name: "hoverLine"
  65401. }))
  65402. }),
  65403. i.addEventListener("click", function(e) {
  65404. if (!r.clickToZoomInEnabled && "mainView" != r.activeViewName)
  65405. return "removeLink" == r.operation ? (r.selectedLine == i && r.selectLine(null),
  65406. r.linkChange(t, n, "remove")) : void r.selectLine(i)
  65407. })) : (e = this.lineMeshes.children.find(function(e) {
  65408. return e.name == "".concat(t.id, "-").concat(n.id) || e.name == "".concat(n.id, "-").concat(t.id)
  65409. })) && (this.lineMeshes.remove(e),
  65410. e.geometry.dispose())
  65411. }
  65412. }, {
  65413. key: "selectLine",
  65414. value: function(e) {
  65415. this.selectedLine != e && (this.selectedLine && (this.selectedLine.material = jb.default),
  65416. e && (e.material = jb.selected),
  65417. this.selectedLine = e)
  65418. }
  65419. }, {
  65420. key: "addPanoMesh",
  65421. value: function() {
  65422. var i = this
  65423. , e = Rb.load(Potree.resourcePath + "/textures/correct_n.png");
  65424. Wb.default = new $i({
  65425. map: e,
  65426. color: 16777215,
  65427. transparent: !0,
  65428. depthTest: !1,
  65429. depthWrite: !1
  65430. }),
  65431. Wb.hovered = new $i({
  65432. map: e,
  65433. color: 16776960,
  65434. transparent: !0,
  65435. depthTest: !1,
  65436. depthWrite: !1
  65437. }),
  65438. Wb.selected = new $i({
  65439. map: Rb.load(Potree.resourcePath + "/textures/correct_s.png"),
  65440. color: 16777215,
  65441. transparent: !0,
  65442. depthTest: !1,
  65443. depthWrite: !1
  65444. });
  65445. function n(e) {
  65446. for (var t in e.position.copy(e.pano.position),
  65447. i.panoLink[e.pano.id]) {
  65448. var n = i.panoLink[e.pano.id][t];
  65449. n && Sf.updateLine(n.line, [e.pano.position, nb.getPano(t).position])
  65450. }
  65451. e.update()
  65452. }
  65453. nb.panos.forEach(function(e) {
  65454. var t = new qp({
  65455. mat: Wb.default,
  65456. sizeInfo: {
  65457. minSize: 50,
  65458. maxSize: 120,
  65459. nearBound: 2,
  65460. farBound: 10
  65461. },
  65462. renderOrder: qb,
  65463. pickOrder: qb
  65464. });
  65465. t.name = "panoCircle",
  65466. t.sid = e.id,
  65467. (t.pano = e).circle = t,
  65468. i.panoMeshs.add(t),
  65469. n(t),
  65470. e.addEventListener("rePos", n.bind(i, t));
  65471. t.addEventListener("drag", function() {
  65472. "mainView" != i.activeViewName && (i.selectPano(t.pano),
  65473. viewer.inputHandler.drag.object = null)
  65474. }),
  65475. t.addEventListener("mouseover", function() {
  65476. i.hoverPano(e, !0)
  65477. }),
  65478. t.addEventListener("mouseleave", function() {
  65479. i.hoverPano(e, !1)
  65480. }),
  65481. t.addEventListener("click", function() {
  65482. if (!i.clickToZoomInEnabled) {
  65483. if ("removeLink" == i.operation && i.linkChange(e, null, "remove"),
  65484. i.selectedPano == t.pano)
  65485. return i.selectPano(null);
  65486. "addLink" == i.operation && i.selectedPano ? i.linkChange(i.selectedPano, t.pano, "add") : i.selectPano(t.pano)
  65487. }
  65488. })
  65489. })
  65490. }
  65491. }, {
  65492. key: "hoverPano",
  65493. value: function(e, t) {
  65494. this.clickToZoomInEnabled || (e && t ? this.hoveredPano != e && (this.hoveredPano && this.hoverPano(this.hoveredPano, !1),
  65495. (this.hoveredPano = e).hovered = !0,
  65496. ib.handleState && this.selectedPano && this.selectedPano == e || ("addLink" == this.operation && this.selectedPano && this.selectedPano != e || viewer.dispatchEvent({
  65497. type: "CursorChange",
  65498. action: "add",
  65499. name: "hoverPano"
  65500. }),
  65501. this.selectedPano != e && (e.circle.material = Wb.hovered))) : e && !t ? this.hoveredPano == e && (e.hovered = !1,
  65502. viewer.dispatchEvent({
  65503. type: "CursorChange",
  65504. action: "remove",
  65505. name: "hoverPano"
  65506. }),
  65507. this.selectedPano != e && (e.circle.material = Wb.default),
  65508. this.hoveredPano = null) : this.hoveredPano && this.hoverPano(this.hoveredPano, !1))
  65509. }
  65510. }, {
  65511. key: "selectPano",
  65512. value: function(t, e, n) {
  65513. var i;
  65514. this.selectedPano == t && !n || (i = this.selectedPano,
  65515. this.selectedPano && (this.selectedPano.circle.material = Wb.default,
  65516. this.selectedPano.circle.renderOrder = qb,
  65517. "mainView" != this.activeViewName && this.selectedClouds.forEach(function(e) {
  65518. e.changePointOpacity(Qb, !0),
  65519. e.material.color = Zb
  65520. })),
  65521. this.selectedPano = t || null,
  65522. this.updateSelectGroup(),
  65523. t && (this.selectedPano.circle.material = Wb.selected,
  65524. this.selectedPano.circle.renderOrder = this.selectedPano.circle.pickOrder = Xb,
  65525. "mainView" != this.activeViewName && this.selectedClouds.forEach(function(e) {
  65526. e.changePointOpacity(Kb, !0),
  65527. e.material.color = Yb
  65528. }),
  65529. n = rb.entities.find(function(e) {
  65530. return "floor" == e.buildType && e.panos.includes(t)
  65531. }) || "all",
  65532. this.gotoFloor(n, !1, 600)),
  65533. this.updateCursor(),
  65534. e ? this.selectedPano && ("mainView" == this.activeViewName ? (e = this.lastDisToPano || 5,
  65535. i && (e = viewer.mainViewport.camera.position.distanceTo(i.position)),
  65536. viewer.focusOnObject({
  65537. position: this.selectedPano.position
  65538. }, "point", null, {
  65539. distance: e
  65540. })) : this.moveFit(this.selectedPano.position, {}, 500)) : this.dispatchEvent({
  65541. type: "panoSelect",
  65542. pano: t
  65543. }))
  65544. }
  65545. }, {
  65546. key: "updateSelectGroup",
  65547. value: function() {
  65548. var t = this;
  65549. this.selectedGroup = this.panoGroup.find(function(e) {
  65550. return e.includes(t.selectedPano)
  65551. }),
  65552. this.selectedClouds = this.selectedPano ? (this.selectedGroup || [this.selectedPano]).map(function(e) {
  65553. return e.pointcloud
  65554. }) : []
  65555. }
  65556. }, {
  65557. key: "checkIfCanSave",
  65558. value: function() {
  65559. for (var e in Potree.settings.datasetsPanos)
  65560. if (!this.checkIfAllLinked({
  65561. datasetId: e
  65562. }))
  65563. return void console.log("没有全部连通,不能保存。其中一个:", e);
  65564. return !0
  65565. }
  65566. }, {
  65567. key: "checkIfAllLinked",
  65568. value: function(e) {
  65569. var t;
  65570. if (e.group) {
  65571. var n = e.group
  65572. , i = e.group[0];
  65573. if (!i)
  65574. return;
  65575. t = i.pointcloud.dataset_id
  65576. } else if (e.datasetId && (t = e.datasetId,
  65577. !(n = this.panoGroup.find(function(e) {
  65578. return e[0].pointcloud.dataset_id == t
  65579. }))))
  65580. return;
  65581. return Potree.settings.datasetsPanos[t].panos.length == n.length
  65582. }
  65583. }, {
  65584. key: "exportSavingData",
  65585. value: function() {
  65586. var e, i = this, t = {};
  65587. const rotQua = (new Sn()).setFromAxisAngle(new Cn(0,0,1), Math.PI) //add
  65588. for (e in Potree.settings.datasetsPanos) {
  65589. var n = Potree.settings.datasetsPanos[e].panos.map(function(e) {
  65590. var t, n = [];
  65591. for (t in i.panoLink[e.id])
  65592. i.panoLink[e.id][t] && n.push(viewer.images360.getPano(t).index);
  65593. return Object.assign({}, e.panosData, {
  65594. uuid: e.uuid,
  65595. pose: {
  65596. translation: r(e.position.clone()),
  65597. rotation: r((new Sn).setFromRotationMatrix(e.panoMatrix).premultiply(rotQua))
  65598. },
  65599. visibles: n
  65600. })
  65601. });
  65602. t[e] = {
  65603. sweepLocations: n
  65604. }
  65605. }
  65606. function r(e) {
  65607. e = Up.toPrecision(e, 6);
  65608. return e instanceof Sn ? {
  65609. x: e.x,
  65610. y: e.y,
  65611. z: e.z,
  65612. w: e.w
  65613. } : e instanceof Cn ? {
  65614. x: e.x,
  65615. y: e.y,
  65616. z: e.z
  65617. } : void 0
  65618. }
  65619. return console.log(t),
  65620. t
  65621. }
  65622. }]),
  65623. n
  65624. }()), tx = (Fb = /^[og]\s*(.+)?/,
  65625. Ib = /^mtllib /,
  65626. Ob = /^usemtl /,
  65627. zb = /^usemap /,
  65628. Nb = new Cn,
  65629. Ub = new Cn,
  65630. Gb = new Cn,
  65631. Hb = new Cn,
  65632. Vb = new Cn,
  65633. ix.prototype = Object.assign(Object.create(mc.prototype), {
  65634. constructor: ix,
  65635. load: function(n, i, e, r) {
  65636. var a = this
  65637. , t = new gc(this.manager);
  65638. t.setPath(this.path),
  65639. t.setRequestHeader(this.requestHeader),
  65640. t.setWithCredentials(this.withCredentials),
  65641. t.load(n, function(e, t) {
  65642. try {
  65643. i(a.parse(e), t)
  65644. } catch (e) {
  65645. r ? r(e) : console.error(e),
  65646. a.manager.itemError(n)
  65647. }
  65648. }, e, r)
  65649. },
  65650. setMaterials: function(e) {
  65651. return this.materials = e,
  65652. this
  65653. },
  65654. parse: function(e) {
  65655. for (var t, n, i, r = new nx, a = (e = -1 !== (e = -1 !== e.indexOf("\r\n") ? e.replace(/\r\n/g, "\n") : e).indexOf("\\\n") ? e.replace(/\\\n/g, "") : e).split("\n"), o = "", s = [], l = "function" == typeof "".trimLeft, u = 0, c = a.length; u < c; u++)
  65656. if (o = a[u],
  65657. 0 !== (o = l ? o.trimLeft() : o.trim()).length && "#" !== (t = o.charAt(0)))
  65658. if ("v" === t) {
  65659. var d = o.split(/\s+/);
  65660. switch (d[0]) {
  65661. case "v":
  65662. r.vertices.push(parseFloat(d[1]), parseFloat(d[2]), parseFloat(d[3])),
  65663. 7 <= d.length ? r.colors.push(parseFloat(d[4]), parseFloat(d[5]), parseFloat(d[6])) : r.colors.push(void 0, void 0, void 0);
  65664. break;
  65665. case "vn":
  65666. r.normals.push(parseFloat(d[1]), parseFloat(d[2]), parseFloat(d[3]));
  65667. break;
  65668. case "vt":
  65669. r.uvs.push(parseFloat(d[1]), parseFloat(d[2]))
  65670. }
  65671. } else if ("f" === t) {
  65672. for (var h = o.substr(1).trim().split(/\s+/), p = [], f = 0, m = h.length; f < m; f++) {
  65673. var v = h[f];
  65674. 0 < v.length && (v = v.split("/"),
  65675. p.push(v))
  65676. }
  65677. for (var g = p[0], f = 1, m = p.length - 1; f < m; f++) {
  65678. var y = p[f]
  65679. , w = p[f + 1];
  65680. r.addFace(g[0], y[0], w[0], g[1], y[1], w[1], g[2], y[2], w[2])
  65681. }
  65682. } else if ("l" === t) {
  65683. var b = o.substring(1).trim().split(" ")
  65684. , x = []
  65685. , E = [];
  65686. if (-1 === o.indexOf("/"))
  65687. x = b;
  65688. else
  65689. for (var _ = 0, M = b.length; _ < M; _++) {
  65690. var A = b[_].split("/");
  65691. "" !== A[0] && x.push(A[0]),
  65692. "" !== A[1] && E.push(A[1])
  65693. }
  65694. r.addLineGeometry(x, E)
  65695. } else
  65696. "p" === t ? (n = o.substr(1).trim().split(" "),
  65697. r.addPointGeometry(n)) : null !== (s = Fb.exec(o)) ? (i = (" " + s[0].substr(1).trim()).substr(1),
  65698. r.startObject(i)) : Ob.test(o) ? r.object.startMaterial(o.substring(7).trim(), r.materialLibraries) : Ib.test(o) ? r.materialLibraries.push(o.substring(7).trim()) : zb.test(o) ? console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.') : "s" === t ? (1 < (s = o.split(" ")).length ? (i = s[1].trim().toLowerCase(),
  65699. r.object.smooth = "0" !== i && "off" !== i) : r.object.smooth = !0,
  65700. (U = r.object.currentMaterial()) && (U.smooth = r.object.smooth)) : "\0" !== o && console.warn('THREE.OBJLoader: Unexpected line: "' + o + '"');
  65701. r.finalize();
  65702. var T = new us;
  65703. T.materialLibraries = [].concat(r.materialLibraries);
  65704. var e = !(1 === r.objects.length && 0 === r.objects[0].geometry.vertices.length);
  65705. if (!0 == e)
  65706. for (u = 0,
  65707. c = r.objects.length; u < c; u++) {
  65708. var S, C = r.objects[u], P = C.geometry, D = C.materials, k = "Line" === P.type, B = "Points" === P.type, L = !1;
  65709. if (0 !== P.vertices.length) {
  65710. (S = new Mr).setAttribute("position", new dr(P.vertices,3)),
  65711. 0 < P.normals.length && S.setAttribute("normal", new dr(P.normals,3)),
  65712. 0 < P.colors.length && (L = !0,
  65713. S.setAttribute("color", new dr(P.colors,3))),
  65714. !0 === P.hasUVIndices && S.setAttribute("uv", new dr(P.uvs,2));
  65715. for (var R, F = [], I = 0, O = D.length; I < O; I++) {
  65716. var z, N = (G = D[I]).name + "_" + G.smooth + "_" + L, U = r.materials[N];
  65717. null !== this.materials && (U = this.materials.create(G.name),
  65718. !k || !U || U instanceof tl ? !B || !U || U instanceof hl || (z = new hl({
  65719. size: 10,
  65720. sizeAttenuation: !1
  65721. }),
  65722. Ki.prototype.copy.call(z, U),
  65723. z.color.copy(U.color),
  65724. z.map = U.map,
  65725. U = z) : (z = new tl,
  65726. Ki.prototype.copy.call(z, U),
  65727. z.color.copy(U.color),
  65728. U = z)),
  65729. void 0 === U && ((U = k ? new tl : B ? new hl({
  65730. size: 1,
  65731. sizeAttenuation: !1
  65732. }) : new ju).name = G.name,
  65733. U.flatShading = !G.smooth,
  65734. U.vertexColors = L,
  65735. r.materials[N] = U),
  65736. F.push(U)
  65737. }
  65738. if (1 < F.length) {
  65739. for (I = 0,
  65740. O = D.length; I < O; I++) {
  65741. var G = D[I];
  65742. S.addGroup(G.groupStart, G.groupCount, I)
  65743. }
  65744. R = new (k ? cl : B ? gl : Hr)(S,F)
  65745. } else
  65746. R = new (k ? cl : B ? gl : Hr)(S,F[0]);
  65747. R.name = C.name,
  65748. T.add(R)
  65749. }
  65750. }
  65751. else
  65752. 0 < r.vertices.length && (U = new hl({
  65753. size: 1,
  65754. sizeAttenuation: !1
  65755. }),
  65756. (S = new Mr).setAttribute("position", new dr(r.vertices,3)),
  65757. 0 < r.colors.length && void 0 !== r.colors[0] && (S.setAttribute("color", new dr(r.colors,3)),
  65758. U.vertexColors = !0),
  65759. e = new gl(S,U),
  65760. T.add(e));
  65761. return T
  65762. }
  65763. }),
  65764. ix);
  65765. function nx() {
  65766. var e = {
  65767. objects: [],
  65768. object: {},
  65769. vertices: [],
  65770. normals: [],
  65771. colors: [],
  65772. uvs: [],
  65773. materials: {},
  65774. materialLibraries: [],
  65775. startObject: function(e, t) {
  65776. if (this.object && !1 === this.object.fromDeclaration)
  65777. return this.object.name = e,
  65778. void (this.object.fromDeclaration = !1 !== t);
  65779. var n = this.object && "function" == typeof this.object.currentMaterial ? this.object.currentMaterial() : void 0;
  65780. this.object && "function" == typeof this.object._finalize && this.object._finalize(!0),
  65781. this.object = {
  65782. name: e || "",
  65783. fromDeclaration: !1 !== t,
  65784. geometry: {
  65785. vertices: [],
  65786. normals: [],
  65787. colors: [],
  65788. uvs: [],
  65789. hasUVIndices: !1
  65790. },
  65791. materials: [],
  65792. smooth: !0,
  65793. startMaterial: function(e, t) {
  65794. var n = this._finalize(!1);
  65795. n && (n.inherited || n.groupCount <= 0) && this.materials.splice(n.index, 1);
  65796. n = {
  65797. index: this.materials.length,
  65798. name: e || "",
  65799. mtllib: Array.isArray(t) && 0 < t.length ? t[t.length - 1] : "",
  65800. smooth: (void 0 !== n ? n : this).smooth,
  65801. groupStart: void 0 !== n ? n.groupEnd : 0,
  65802. groupEnd: -1,
  65803. groupCount: -1,
  65804. inherited: !1,
  65805. clone: function(e) {
  65806. e = {
  65807. index: "number" == typeof e ? e : this.index,
  65808. name: this.name,
  65809. mtllib: this.mtllib,
  65810. smooth: this.smooth,
  65811. groupStart: 0,
  65812. groupEnd: -1,
  65813. groupCount: -1,
  65814. inherited: !1
  65815. };
  65816. return e.clone = this.clone.bind(e),
  65817. e
  65818. }
  65819. };
  65820. return this.materials.push(n),
  65821. n
  65822. },
  65823. currentMaterial: function() {
  65824. if (0 < this.materials.length)
  65825. return this.materials[this.materials.length - 1]
  65826. },
  65827. _finalize: function(e) {
  65828. var t = this.currentMaterial();
  65829. if (t && -1 === t.groupEnd && (t.groupEnd = this.geometry.vertices.length / 3,
  65830. t.groupCount = t.groupEnd - t.groupStart,
  65831. t.inherited = !1),
  65832. e && 1 < this.materials.length)
  65833. for (var n = this.materials.length - 1; 0 <= n; n--)
  65834. this.materials[n].groupCount <= 0 && this.materials.splice(n, 1);
  65835. return e && 0 === this.materials.length && this.materials.push({
  65836. name: "",
  65837. smooth: this.smooth
  65838. }),
  65839. t
  65840. }
  65841. },
  65842. n && n.name && "function" == typeof n.clone && ((n = n.clone(0)).inherited = !0,
  65843. this.object.materials.push(n)),
  65844. this.objects.push(this.object)
  65845. },
  65846. finalize: function() {
  65847. this.object && "function" == typeof this.object._finalize && this.object._finalize(!0)
  65848. },
  65849. parseVertexIndex: function(e, t) {
  65850. e = parseInt(e, 10);
  65851. return 3 * (0 <= e ? e - 1 : e + t / 3)
  65852. },
  65853. parseNormalIndex: function(e, t) {
  65854. e = parseInt(e, 10);
  65855. return 3 * (0 <= e ? e - 1 : e + t / 3)
  65856. },
  65857. parseUVIndex: function(e, t) {
  65858. e = parseInt(e, 10);
  65859. return 2 * (0 <= e ? e - 1 : e + t / 2)
  65860. },
  65861. addVertex: function(e, t, n) {
  65862. var i = this.vertices
  65863. , r = this.object.geometry.vertices;
  65864. r.push(i[e + 0], i[e + 1], i[e + 2]),
  65865. r.push(i[t + 0], i[t + 1], i[t + 2]),
  65866. r.push(i[n + 0], i[n + 1], i[n + 2])
  65867. },
  65868. addVertexPoint: function(e) {
  65869. var t = this.vertices;
  65870. this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2])
  65871. },
  65872. addVertexLine: function(e) {
  65873. var t = this.vertices;
  65874. this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2])
  65875. },
  65876. addNormal: function(e, t, n) {
  65877. var i = this.normals
  65878. , r = this.object.geometry.normals;
  65879. r.push(i[e + 0], i[e + 1], i[e + 2]),
  65880. r.push(i[t + 0], i[t + 1], i[t + 2]),
  65881. r.push(i[n + 0], i[n + 1], i[n + 2])
  65882. },
  65883. addFaceNormal: function(e, t, n) {
  65884. var i = this.vertices
  65885. , r = this.object.geometry.normals;
  65886. Nb.fromArray(i, e),
  65887. Ub.fromArray(i, t),
  65888. Gb.fromArray(i, n),
  65889. Vb.subVectors(Gb, Ub),
  65890. Hb.subVectors(Nb, Ub),
  65891. Vb.cross(Hb),
  65892. Vb.normalize(),
  65893. r.push(Vb.x, Vb.y, Vb.z),
  65894. r.push(Vb.x, Vb.y, Vb.z),
  65895. r.push(Vb.x, Vb.y, Vb.z)
  65896. },
  65897. addColor: function(e, t, n) {
  65898. var i = this.colors
  65899. , r = this.object.geometry.colors;
  65900. void 0 !== i[e] && r.push(i[e + 0], i[e + 1], i[e + 2]),
  65901. void 0 !== i[t] && r.push(i[t + 0], i[t + 1], i[t + 2]),
  65902. void 0 !== i[n] && r.push(i[n + 0], i[n + 1], i[n + 2])
  65903. },
  65904. addUV: function(e, t, n) {
  65905. var i = this.uvs
  65906. , r = this.object.geometry.uvs;
  65907. r.push(i[e + 0], i[e + 1]),
  65908. r.push(i[t + 0], i[t + 1]),
  65909. r.push(i[n + 0], i[n + 1])
  65910. },
  65911. addDefaultUV: function() {
  65912. var e = this.object.geometry.uvs;
  65913. e.push(0, 0),
  65914. e.push(0, 0),
  65915. e.push(0, 0)
  65916. },
  65917. addUVLine: function(e) {
  65918. var t = this.uvs;
  65919. this.object.geometry.uvs.push(t[e + 0], t[e + 1])
  65920. },
  65921. addFace: function(e, t, n, i, r, a, o, s, l) {
  65922. var u, c = this.vertices.length, e = this.parseVertexIndex(e, c), t = this.parseVertexIndex(t, c), c = this.parseVertexIndex(n, c);
  65923. this.addVertex(e, t, c),
  65924. this.addColor(e, t, c),
  65925. void 0 !== o && "" !== o ? (u = this.normals.length,
  65926. e = this.parseNormalIndex(o, u),
  65927. t = this.parseNormalIndex(s, u),
  65928. c = this.parseNormalIndex(l, u),
  65929. this.addNormal(e, t, c)) : this.addFaceNormal(e, t, c),
  65930. void 0 !== i && "" !== i ? (u = this.uvs.length,
  65931. e = this.parseUVIndex(i, u),
  65932. t = this.parseUVIndex(r, u),
  65933. c = this.parseUVIndex(a, u),
  65934. this.addUV(e, t, c),
  65935. this.object.geometry.hasUVIndices = !0) : this.addDefaultUV()
  65936. },
  65937. addPointGeometry: function(e) {
  65938. this.object.geometry.type = "Points";
  65939. for (var t = this.vertices.length, n = 0, i = e.length; n < i; n++) {
  65940. var r = this.parseVertexIndex(e[n], t);
  65941. this.addVertexPoint(r),
  65942. this.addColor(r)
  65943. }
  65944. },
  65945. addLineGeometry: function(e, t) {
  65946. this.object.geometry.type = "Line";
  65947. for (var n = this.vertices.length, i = this.uvs.length, r = 0, a = e.length; r < a; r++)
  65948. this.addVertexLine(this.parseVertexIndex(e[r], n));
  65949. for (var o = 0, a = t.length; o < a; o++)
  65950. this.addUVLine(this.parseUVIndex(t[o], i))
  65951. }
  65952. };
  65953. return e.startObject("", !1),
  65954. e
  65955. }
  65956. function ix(e) {
  65957. mc.call(this, e),
  65958. this.materials = null
  65959. }
  65960. function rx(e) {
  65961. mc.call(this, e)
  65962. }
  65963. rx.prototype = Object.assign(Object.create(mc.prototype), {
  65964. constructor: rx,
  65965. load: function(t, n, e, i) {
  65966. var r = this
  65967. , a = "" === this.path ? ld.extractUrlBase(t) : this.path
  65968. , o = new gc(this.manager);
  65969. o.setPath(this.path),
  65970. o.setRequestHeader(this.requestHeader),
  65971. o.setWithCredentials(this.withCredentials),
  65972. o.load(t, function(e) {
  65973. try {
  65974. n(r.parse(e, a))
  65975. } catch (e) {
  65976. i ? i(e) : console.error(e),
  65977. r.manager.itemError(t)
  65978. }
  65979. }, e, i)
  65980. },
  65981. setMaterialOptions: function(e) {
  65982. return this.materialOptions = e,
  65983. this
  65984. },
  65985. parse: function(e, t) {
  65986. for (var n = e.split("\n"), i = {}, r = /\s+/, a = {}, o = 0; o < n.length; o++) {
  65987. var s, l, u = (u = n[o]).trim();
  65988. 0 !== u.length && "#" !== u.charAt(0) && (s = (s = 0 <= (l = u.indexOf(" ")) ? u.substring(0, l) : u).toLowerCase(),
  65989. u = (u = 0 <= l ? u.substring(l + 1) : "").trim(),
  65990. "newmtl" === s ? a[u] = i = {
  65991. name: u
  65992. } : "ka" === s || "kd" === s || "ks" === s || "ke" === s ? (l = u.split(r, 3),
  65993. i[s] = [parseFloat(l[0]), parseFloat(l[1]), parseFloat(l[2])]) : i[s] = u)
  65994. }
  65995. t = new rx.MaterialCreator(this.resourcePath || t,this.materialOptions);
  65996. return t.setCrossOrigin(this.crossOrigin),
  65997. t.setManager(this.manager),
  65998. t.setMaterials(a),
  65999. t
  66000. }
  66001. }),
  66002. (rx.MaterialCreator = function(e, t) {
  66003. this.baseUrl = e || "",
  66004. this.options = t,
  66005. this.materialsInfo = {},
  66006. this.materials = {},
  66007. this.materialsArray = [],
  66008. this.nameLookup = {},
  66009. this.side = this.options && this.options.side ? this.options.side : q,
  66010. this.wrap = this.options && this.options.wrap ? this.options.wrap : ke
  66011. }
  66012. ).prototype = {
  66013. constructor: rx.MaterialCreator,
  66014. crossOrigin: "anonymous",
  66015. setCrossOrigin: function(e) {
  66016. return this.crossOrigin = e,
  66017. this
  66018. },
  66019. setManager: function(e) {
  66020. this.manager = e
  66021. },
  66022. setMaterials: function(e) {
  66023. this.materialsInfo = this.convert(e),
  66024. this.materials = {},
  66025. this.materialsArray = [],
  66026. this.nameLookup = {}
  66027. },
  66028. convert: function(e) {
  66029. if (!this.options)
  66030. return e;
  66031. var t, n = {};
  66032. for (t in e) {
  66033. var i, r = e[t], a = {};
  66034. for (i in n[t] = a,
  66035. r) {
  66036. var o = !0
  66037. , s = r[i]
  66038. , l = i.toLowerCase();
  66039. switch (l) {
  66040. case "kd":
  66041. case "ka":
  66042. case "ks":
  66043. this.options && this.options.normalizeRGB && (s = [s[0] / 255, s[1] / 255, s[2] / 255]),
  66044. this.options && this.options.ignoreZeroRGBs && 0 === s[0] && 0 === s[1] && 0 === s[2] && (o = !1)
  66045. }
  66046. o && (a[l] = s)
  66047. }
  66048. }
  66049. return n
  66050. },
  66051. preload: function() {
  66052. for (var e in this.materialsInfo)
  66053. this.create(e)
  66054. },
  66055. getIndex: function(e) {
  66056. return this.nameLookup[e]
  66057. },
  66058. getAsArray: function() {
  66059. var e, t = 0;
  66060. for (e in this.materialsInfo)
  66061. this.materialsArray[t] = this.create(e),
  66062. this.nameLookup[e] = t,
  66063. t++;
  66064. return this.materialsArray
  66065. },
  66066. create: function(e) {
  66067. return void 0 === this.materials[e] && this.createMaterial_(e),
  66068. this.materials[e]
  66069. },
  66070. createMaterial_: function(e) {
  66071. var t, r = this, n = this.materialsInfo[e], a = {
  66072. name: e,
  66073. side: this.side
  66074. };
  66075. function i(e, t) {
  66076. var n, i;
  66077. a[e] || (n = r.getTextureParams(t, a),
  66078. (t = r.loadTexture((i = r.baseUrl,
  66079. "string" != typeof (t = n.url) || "" === t ? "" : /^https?:\/\//i.test(t) ? t : i + t))).repeat.copy(n.scale),
  66080. t.offset.copy(n.offset),
  66081. t.wrapS = r.wrap,
  66082. t.wrapT = r.wrap,
  66083. a[e] = t)
  66084. }
  66085. for (t in n) {
  66086. var o, s = n[t];
  66087. if ("" !== s)
  66088. switch (t.toLowerCase()) {
  66089. case "kd":
  66090. a.color = (new Yi).fromArray(s);
  66091. break;
  66092. case "ks":
  66093. break;
  66094. case "ke":
  66095. a.emissive = (new Yi).fromArray(s);
  66096. break;
  66097. case "map_kd":
  66098. i("map", s);
  66099. break;
  66100. case "map_ks":
  66101. i("specularMap", s);
  66102. break;
  66103. case "map_ke":
  66104. i("emissiveMap", s);
  66105. break;
  66106. case "norm":
  66107. i("normalMap", s);
  66108. break;
  66109. case "map_bump":
  66110. case "bump":
  66111. i("bumpMap", s);
  66112. break;
  66113. case "map_d":
  66114. i("alphaMap", s),
  66115. a.transparent = !0;
  66116. break;
  66117. case "ns":
  66118. break;
  66119. case "d":
  66120. (o = parseFloat(s)) < 1 && (a.opacity = o,
  66121. a.transparent = !0);
  66122. break;
  66123. case "tr":
  66124. o = parseFloat(s),
  66125. 0 < (o = this.options && this.options.invertTrProperty ? 1 - o : o) && (a.opacity = 1 - o,
  66126. a.transparent = !0)
  66127. }
  66128. }
  66129. return this.materials[e] = new Hu(a),
  66130. this.materials[e]
  66131. },
  66132. getTextureParams: function(e, t) {
  66133. var n = {
  66134. scale: new yn(1,1),
  66135. offset: new yn(0,0)
  66136. }
  66137. , i = e.split(/\s+/)
  66138. , e = i.indexOf("-bm");
  66139. return 0 <= e && (t.bumpScale = parseFloat(i[e + 1]),
  66140. i.splice(e, 2)),
  66141. 0 <= (e = i.indexOf("-s")) && (n.scale.set(parseFloat(i[e + 1]), parseFloat(i[e + 2])),
  66142. i.splice(e, 4)),
  66143. 0 <= (e = i.indexOf("-o")) && (n.offset.set(parseFloat(i[e + 1]), parseFloat(i[e + 2])),
  66144. i.splice(e, 4)),
  66145. n.url = i.join(" ").trim(),
  66146. n
  66147. },
  66148. loadTexture: function(e, t, n, i, r) {
  66149. var a = void 0 !== this.manager ? this.manager : fc
  66150. , o = a.getHandler(e);
  66151. return (o = null === o ? new _c(a) : o).setCrossOrigin && o.setCrossOrigin(this.crossOrigin),
  66152. r = o.load(e, n, i, r),
  66153. void 0 !== t && (r.mapping = t),
  66154. r
  66155. }
  66156. };
  66157. function ax() {
  66158. this.enabled = !0,
  66159. this.needsSwap = !0,
  66160. this.clear = !1,
  66161. this.renderToScreen = !1
  66162. }
  66163. Object.assign(ax.prototype, {
  66164. setSize: function(e, t) {},
  66165. render: function(e, t, n, i, r) {
  66166. console.error("THREE.Pass: .render() must be implemented in derived pass.")
  66167. }
  66168. });
  66169. function ox(e, t) {
  66170. ax.call(this),
  66171. this.textureID = void 0 !== t ? t : "tDiffuse",
  66172. e instanceof Qr ? (this.uniforms = e.uniforms,
  66173. this.material = e) : e && (this.uniforms = Jr.clone(e.uniforms),
  66174. this.material = new Qr({
  66175. defines: Object.assign({}, e.defines),
  66176. uniforms: this.uniforms,
  66177. vertexShader: e.vertexShader,
  66178. fragmentShader: e.fragmentShader,
  66179. transparent: !0
  66180. })),
  66181. this.camera = new ed(-1,1,1,-1,0,1),
  66182. this.scene = new gs,
  66183. this.quad = new Hr(new ua(2,2),null),
  66184. this.quad.frustumCulled = !1,
  66185. this.scene.add(this.quad)
  66186. }
  66187. ox.prototype = Object.assign(Object.create(ax.prototype), {
  66188. constructor: ox,
  66189. render: function(e, t, n, i, r, a, o) {
  66190. var s = n.getRenderTarget();
  66191. this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = r.texture),
  66192. this.quad.material = this.material,
  66193. this.renderToScreen ? n.render(this.scene, this.camera) : (n.setRenderTarget(i),
  66194. this.clear && n.clear(),
  66195. n.render(this.scene, this.camera),
  66196. n.setRenderTarget(s))
  66197. }
  66198. });
  66199. function sx(e, t) {
  66200. ax.call(this),
  66201. this.sampleLevel = 4,
  66202. this.unbiased = !0,
  66203. this.clearColor = void 0 !== e ? e : 0,
  66204. this.clearAlpha = void 0 !== t ? t : 0,
  66205. this.renderUniforms = {
  66206. bgTex: {
  66207. value: null
  66208. },
  66209. outlineTex: {
  66210. value: null
  66211. },
  66212. opacity: {
  66213. value: 1
  66214. }
  66215. },
  66216. this.renderMat = new Qr({
  66217. uniforms: this.renderUniforms,
  66218. vertexShader: lx.vertexShader,
  66219. fragmentShader: " \n uniform sampler2D bgTex; \n uniform sampler2D outlineTex; \n uniform float opacity;\n varying vec2 vUv;\n void main() {\n vec4 color1 = texture2D( bgTex, vUv );\n vec4 color2 = texture2D( outlineTex, vUv ); \n gl_FragColor = opacity * mix(color1, color2, color2.a) ;\n \n \n } \n ",
  66220. premultipliedAlpha: !0,
  66221. blending: ee,
  66222. depthTest: !1,
  66223. depthWrite: !1,
  66224. transparent: !0
  66225. }),
  66226. this.renderMat2 = new Qr({
  66227. uniforms: Jr.clone(lx.uniforms),
  66228. vertexShader: lx.vertexShader,
  66229. fragmentShader: "uniform float opacity; \n uniform sampler2D tDiffuse; \n varying vec2 vUv;\n\n void main() {\n \n vec4 texel = texture2D( tDiffuse, vUv ); \n \n if(texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0){\n discard;\n }else{\n gl_FragColor = opacity * texel;\n }\n } \n ",
  66230. depthTest: !1,
  66231. depthWrite: !1,
  66232. transparent: !0
  66233. }),
  66234. this.camera2 = new ed(-1,1,1,-1,0,1),
  66235. this.scene2 = new gs,
  66236. this.quad2 = new Hr(new ua(2,2),this.renderMat),
  66237. this.quad2.frustumCulled = !1,
  66238. this.scene2.add(this.quad2),
  66239. this.copyPass = new ox(lx),
  66240. this.copyPass.renderToScreen = !0
  66241. }
  66242. var lx = {
  66243. uniforms: {
  66244. tDiffuse: {
  66245. value: null
  66246. },
  66247. opacity: {
  66248. value: 1
  66249. }
  66250. },
  66251. vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
  66252. fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\n")
  66253. };
  66254. sx.prototype = Object.assign(Object.create(ax.prototype), {
  66255. constructor: sx,
  66256. dispose: function() {
  66257. this.sampleRenderTarget && (this.sampleRenderTarget.dispose(),
  66258. this.sampleRenderTarget = null)
  66259. },
  66260. setSize: function(e, t) {
  66261. this.sampleRenderTarget && this.sampleRenderTarget.setSize(e, t),
  66262. this.childPass && this.childPass.setSize(e, t)
  66263. },
  66264. addPass: function(e) {
  66265. this.childPass = e
  66266. },
  66267. render: function(e, t, n, i, r, a, o, s) {
  66268. this.useCopy && (e = this.copyPass.scene,
  66269. t = this.copyPass.camera),
  66270. this.sampleRenderTarget || (this.sampleRenderTarget = new An(a.width,a.height,{
  66271. minFilter: Oe,
  66272. magFilter: Oe,
  66273. format: et
  66274. }),
  66275. this.sampleRenderTarget.texture.name = "SSAARenderPass.sample");
  66276. var l = sx.JitterVectors[Math.max(0, Math.min(this.sampleLevel, 5))]
  66277. , u = i.autoClear;
  66278. i.autoClear = !1;
  66279. var c = i.getClearColor(new Yi).getHex()
  66280. , d = i.getClearAlpha();
  66281. i.setClearColor(this.clearColor, this.clearAlpha);
  66282. var h, p, f = 1 / l.length, m = i.getRenderTarget();
  66283. p = m ? m.scissorTest ? (h = m.scissor.w,
  66284. m.scissor.z) : (h = m.width,
  66285. m.height) : (h = a.width,
  66286. a.height);
  66287. for (var v = 0; v < l.length; v++) {
  66288. var g = l[v];
  66289. t.setViewOffset && t.setViewOffset(h, p, .0625 * g[0], .0625 * g[1], h, p);
  66290. var y = f;
  66291. this.unbiased && (y += 1 / 32 * ((v + .5) / l.length - .5)),
  66292. i.setRenderTarget(this.sampleRenderTarget),
  66293. i.clear(),
  66294. this.useCopy ? this.copyPass.render(e, t, i, r, a) : s ? s({
  66295. target: this.sampleRenderTarget
  66296. }) : i.render(e, t),
  66297. i.setRenderTarget(m);
  66298. g = this.childPass && this.childPass.render(e, t, i, r, a, null, s);
  66299. this.renderUniforms.bgTex.value = this.sampleRenderTarget.texture,
  66300. this.renderUniforms.outlineTex.value = g ? a.texture : null,
  66301. this.renderUniforms.opacity.value = y,
  66302. this.renderToScreen || i.setRenderTarget(r),
  66303. 0 === v && (i.setClearColor(0, 0),
  66304. i.clear()),
  66305. i.render(this.scene2, this.camera2),
  66306. this.renderToScreen || i.setRenderTarget(m)
  66307. }
  66308. t.clearViewOffset && t.clearViewOffset(),
  66309. i.autoClear = u,
  66310. i.setClearColor(c, d)
  66311. }
  66312. }),
  66313. sx.JitterVectors = [[[0, 0]], [[4, 4], [-4, -4]], [[-2, -6], [6, -2], [-6, 2], [2, 6]], [[1, -3], [-1, 3], [5, 1], [-3, -5], [-5, 5], [-7, -1], [3, 7], [7, -7]], [[1, 1], [-1, -3], [-3, 2], [4, -1], [-5, -2], [2, 5], [5, 3], [3, -5], [-2, 6], [0, -7], [-4, -6], [-6, 4], [-8, 0], [7, -4], [6, 7], [-7, -8]], [[-4, -7], [-7, -5], [-3, -5], [-5, -4], [-1, -4], [-2, -2], [-6, -1], [-4, 0], [-7, 1], [-1, 2], [-6, 3], [-3, 3], [-7, 6], [-3, 6], [-5, 7], [-1, 7], [5, -7], [1, -6], [6, -5], [4, -4], [2, -3], [7, -2], [1, -1], [4, -1], [2, 1], [6, 2], [0, 4], [4, 4], [2, 5], [7, 5], [5, 6], [3, 7]]];
  66314. function ux(e, t) {
  66315. var n;
  66316. this.renderer = e,
  66317. void 0 === t && (n = {
  66318. minFilter: Oe,
  66319. magFilter: Oe,
  66320. format: et,
  66321. stencilBuffer: !1
  66322. },
  66323. (t = new An((e = e.getDrawingBufferSize(new yn)).width,e.height,n)).texture.name = "EffectComposer.rt1"),
  66324. this.renderTarget1 = t,
  66325. this.renderTarget2 = t.clone(),
  66326. this.renderTarget2.texture.name = "EffectComposer.rt2",
  66327. this.writeBuffer = this.renderTarget1,
  66328. this.readBuffer = this.renderTarget2,
  66329. this.passes = [],
  66330. this.copyPass = new ox(lx)
  66331. }
  66332. var cx = function() {
  66333. y(r, ax);
  66334. var i = w(r);
  66335. function r(e, t) {
  66336. var n;
  66337. return O(this, r),
  66338. (n = i.call(this)).scene = e,
  66339. n.camera = t,
  66340. n.clear = !0,
  66341. n.needsSwap = !1,
  66342. n.inverse = !1,
  66343. n
  66344. }
  66345. return h(r, [{
  66346. key: "render",
  66347. value: function(e, t, n) {
  66348. var i, r, a = e.getContext(), o = e.state;
  66349. o.buffers.color.setMask(!1),
  66350. o.buffers.depth.setMask(!1),
  66351. o.buffers.color.setLocked(!0),
  66352. o.buffers.depth.setLocked(!0),
  66353. r = this.inverse ? (i = 0,
  66354. 1) : (i = 1,
  66355. 0),
  66356. o.buffers.stencil.setTest(!0),
  66357. o.buffers.stencil.setOp(a.REPLACE, a.REPLACE, a.REPLACE),
  66358. o.buffers.stencil.setFunc(a.ALWAYS, i, 4294967295),
  66359. o.buffers.stencil.setClear(r),
  66360. o.buffers.stencil.setLocked(!0),
  66361. e.setRenderTarget(n),
  66362. this.clear && e.clear(),
  66363. e.render(this.scene, this.camera),
  66364. e.setRenderTarget(t),
  66365. this.clear && e.clear(),
  66366. e.render(this.scene, this.camera),
  66367. o.buffers.color.setLocked(!1),
  66368. o.buffers.depth.setLocked(!1),
  66369. o.buffers.stencil.setLocked(!1),
  66370. o.buffers.stencil.setFunc(a.EQUAL, 1, 4294967295),
  66371. o.buffers.stencil.setOp(a.KEEP, a.KEEP, a.KEEP),
  66372. o.buffers.stencil.setLocked(!0)
  66373. }
  66374. }]),
  66375. r
  66376. }()
  66377. , dx = function() {
  66378. y(n, ax);
  66379. var t = w(n);
  66380. function n() {
  66381. var e;
  66382. return O(this, n),
  66383. (e = t.call(this)).needsSwap = !1,
  66384. e
  66385. }
  66386. return h(n, [{
  66387. key: "render",
  66388. value: function(e) {
  66389. e.state.buffers.stencil.setLocked(!1),
  66390. e.state.buffers.stencil.setTest(!1)
  66391. }
  66392. }]),
  66393. n
  66394. }();
  66395. Object.assign(ux.prototype, {
  66396. swapBuffers: function() {
  66397. var e = this.readBuffer;
  66398. this.readBuffer = this.writeBuffer,
  66399. this.writeBuffer = e
  66400. },
  66401. addPass: function(e) {
  66402. this.passes.push(e);
  66403. var t = this.renderer.getDrawingBufferSize(new yn);
  66404. e.setSize(t.width, t.height)
  66405. },
  66406. removePass: function(e) {
  66407. e = this.passes.indexOf(e);
  66408. -1 < e && this.passes.splice(e, 1)
  66409. },
  66410. insertPass: function(e, t) {
  66411. this.passes.splice(t, 0, e)
  66412. },
  66413. render: function(e, t, n, i) {
  66414. var r, a, o, s = !1, l = this.passes.filter(function(e) {
  66415. return e.enabled
  66416. }), u = l.length;
  66417. for (this.readTarget && this.copyPass.render(e, this.renderer, this.readBuffer, this.renderer.getRenderTarget()),
  66418. r = 0; r < u; r++)
  66419. (o = l[r]).render(e, t, n, this.renderer, this.writeBuffer, this.readBuffer, s, i),
  66420. o.needsSwap && (s && ((a = this.renderer.context).stencilFunc(a.NOTEQUAL, 1, 4294967295),
  66421. this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer),
  66422. a.stencilFunc(a.EQUAL, 1, 4294967295)),
  66423. this.swapBuffers()),
  66424. void 0 !== cx && (o instanceof cx ? s = !0 : o instanceof dx && (s = !1));
  66425. o.renderToScreen || (this.copyPass.renderToScreen = !0,
  66426. this.copyPass.render(null, null, this.renderer, this.writeBuffer, this.readBuffer))
  66427. },
  66428. reset: function(e) {
  66429. var t;
  66430. void 0 === e && (t = this.renderer.getDrawingBufferSize(new yn),
  66431. (e = this.renderTarget1.clone()).setSize(t.width, t.height)),
  66432. this.renderTarget1.dispose(),
  66433. this.renderTarget2.dispose(),
  66434. this.renderTarget1 = e,
  66435. this.renderTarget2 = e.clone(),
  66436. this.writeBuffer = this.renderTarget1,
  66437. this.readBuffer = this.renderTarget2
  66438. },
  66439. setSize: function(e, t, n) {
  66440. this.renderTarget1.setSize(e * (n = n || 1), t * n),
  66441. this.renderTarget2.setSize(e * n, t * n);
  66442. for (var i = 0; i < this.passes.length; i++)
  66443. this.passes[i].setSize(e * n, t * n)
  66444. }
  66445. });
  66446. function hx(e) {
  66447. this.selectedObjects = void 0 !== e ? e : [],
  66448. this.visibleEdgeColor = new Yi(1,1,1),
  66449. this.hiddenEdgeColor = new Yi(.1,.04,.02),
  66450. this.edgeGlow = 0,
  66451. this.usePatternTexture = !1,
  66452. this.edgeStrength = 50,
  66453. this.downSampleRatio = 1,
  66454. this.pulsePeriod = 0,
  66455. ax.call(this),
  66456. this.resolution = new yn(256,256);
  66457. var t = {
  66458. minFilter: Oe,
  66459. magFilter: Oe,
  66460. format: et
  66461. }
  66462. , n = Math.round(this.resolution.x / this.downSampleRatio)
  66463. , e = Math.round(this.resolution.y / this.downSampleRatio);
  66464. this.renderTargetMaskBuffer = new An(this.resolution.x,this.resolution.y,t),
  66465. this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask",
  66466. this.renderTargetMaskBuffer.texture.generateMipmaps = !1,
  66467. this.depthMaterial = new es,
  66468. this.depthMaterial.side = Y,
  66469. this.depthMaterial.depthPacking = on,
  66470. this.depthMaterial.blending = Z,
  66471. this.prepareMaskMaterial = this.getPrepareMaskMaterial(),
  66472. this.prepareMaskMaterial.side = Y,
  66473. this.renderTargetDepthBuffer = new An(this.resolution.x,this.resolution.y,t),
  66474. this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth",
  66475. this.renderTargetDepthBuffer.texture.generateMipmaps = !1,
  66476. this.edgeDetectionMaterial = this.getEdgeDetectionMaterial(this.edgeStrength),
  66477. this.renderTargetEdgeBuffer1 = new An(n,e,t),
  66478. this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1",
  66479. this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1,
  66480. this.overlayMaterial = this.getOverlayMaterial(),
  66481. this.copyUniforms = Jr.clone(lx.uniforms),
  66482. this.copyUniforms.opacity.value = 1,
  66483. this.materialCopy = new Qr({
  66484. uniforms: this.copyUniforms,
  66485. vertexShader: lx.vertexShader,
  66486. fragmentShader: lx.fragmentShader,
  66487. blending: Z,
  66488. depthTest: !1,
  66489. depthWrite: !1,
  66490. transparent: !0
  66491. }),
  66492. this.enabled = !0,
  66493. this.needsSwap = !1,
  66494. this.oldClearColor = new Yi,
  66495. this.oldClearAlpha = 1,
  66496. this.camera = new ed(-1,1,1,-1,0,1),
  66497. this.scene = new gs,
  66498. this.quad = new Hr(new ua(2,2),null),
  66499. this.quad.frustumCulled = !1,
  66500. this.scene.add(this.quad),
  66501. this.textureMatrix = new ni
  66502. }
  66503. new yn(1 / 1024,1 / 512);
  66504. hx.prototype = Object.assign(Object.create(ax.prototype), {
  66505. constructor: hx,
  66506. dispose: function() {
  66507. this.renderTargetMaskBuffer.dispose(),
  66508. this.renderTargetEdgeBuffer1.dispose(),
  66509. this.renderTargetDepthBuffer.dispose()
  66510. },
  66511. replaceDepthToViewZ: function(e) {
  66512. e = e.isPerspectiveCamera ? "perspective" : "orthographic";
  66513. e != this.lastCameraType && (this.lastCameraType = e,
  66514. this.prepareMaskMaterial.fragmentShader = this.prepareMaskMaterial.fragmentShader.replace(/DEPTH_TO_VIEW_Z/g, e + "DepthToViewZ"),
  66515. this.prepareMaskMaterial.needsUpdate = !0)
  66516. },
  66517. setSize: function(e, t) {
  66518. this.renderTargetEdgeBuffer1.setSize(e, t),
  66519. this.renderTargetMaskBuffer.setSize(e, t),
  66520. this.resolution.set(e, t)
  66521. },
  66522. changeVisibilityOfSelectedObjects: function(t) {
  66523. function e(e) {
  66524. (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) && viewer.updateVisible(e, "overlinePass", t)
  66525. }
  66526. for (var n = 0; n < this.selectedObjects.length; n++)
  66527. this.selectedObjects[n].traverse(e)
  66528. },
  66529. changeVisibilityOfNonSelectedObjects: function(r, e) {
  66530. var a = [];
  66531. function t(e) {
  66532. (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) && a.push(e)
  66533. }
  66534. for (var n = 0; n < this.selectedObjects.length; n++)
  66535. this.selectedObjects[n].traverse(t);
  66536. function i(e) {
  66537. if (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) {
  66538. for (var t = !1, n = 0; n < a.length; n++)
  66539. if (a[n].id === e.id) {
  66540. t = !0;
  66541. break
  66542. }
  66543. if (!t) {
  66544. var i = e.visible;
  66545. return viewer.updateVisible(e, "overlinePass", r),
  66546. e.visible = !!r && !!e.bVisible,
  66547. e.bVisible = i,
  66548. {
  66549. stopContinue: !0
  66550. }
  66551. }
  66552. }
  66553. }
  66554. e.forEach(function(e) {
  66555. return e.traverse(i)
  66556. })
  66557. },
  66558. updateTextureMatrix: function(e) {
  66559. this.textureMatrix.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
  66560. this.textureMatrix.multiply(e.projectionMatrix),
  66561. this.textureMatrix.multiply(e.matrixWorldInverse)
  66562. },
  66563. render: function(t, n, e, i, r, a, o, s) {
  66564. var l = this;
  66565. if (t instanceof Array || (t = [t]),
  66566. 0 < this.selectedObjects.length) {
  66567. var u = function(e) {
  66568. s ? s({
  66569. target: e,
  66570. dontRenderRtEDL: !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]
  66571. }) : (i.setRenderTarget(e),
  66572. i.clear(),
  66573. t.forEach(function(e) {
  66574. return i.render(e, n)
  66575. }))
  66576. };
  66577. e.forEach(function(e) {
  66578. return e.beforeRender = function() {
  66579. l.replaceDepthToViewZ(e.camera)
  66580. }
  66581. }),
  66582. this.oldClearColor.copy(i.getClearColor(new Yi)),
  66583. this.oldClearAlpha = i.getClearAlpha();
  66584. var c = i.autoClear
  66585. , d = i.getRenderTarget();
  66586. i.autoClear = !1,
  66587. o && i.context.disable(i.context.STENCIL_TEST),
  66588. i.setClearColor(16777215, 1),
  66589. this.changeVisibilityOfSelectedObjects(!1),
  66590. t.forEach(function(e) {
  66591. e.currentBackground = e.background,
  66592. e.background = null,
  66593. e.overrideMaterial = l.depthMaterial
  66594. }),
  66595. u(this.renderTargetDepthBuffer),
  66596. this.changeVisibilityOfSelectedObjects(!0),
  66597. e.forEach(function(e) {
  66598. return e.beforeRender = function() {
  66599. l.updateTextureMatrix(e.camera),
  66600. l.prepareMaskMaterial.uniforms.cameraNearFar.value = new yn(e.camera.near,e.camera.far)
  66601. }
  66602. }),
  66603. this.changeVisibilityOfNonSelectedObjects(!1, t),
  66604. t.forEach(function(e) {
  66605. e.overrideMaterial = l.prepareMaskMaterial
  66606. }),
  66607. this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture,
  66608. this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix,
  66609. u(this.renderTargetMaskBuffer),
  66610. e.forEach(function(e) {
  66611. e.beforeRender = null
  66612. }),
  66613. this.changeVisibilityOfNonSelectedObjects(!0, t),
  66614. t.forEach(function(e) {
  66615. e.overrideMaterial = null,
  66616. e.background = e.currentBackground
  66617. }),
  66618. this.quad.material = this.edgeDetectionMaterial,
  66619. this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture,
  66620. this.edgeDetectionMaterial.uniforms.texSize.value = new yn(this.resolution.x,this.resolution.y),
  66621. this.edgeDetectionMaterial.uniforms.thickness.value = this.edgeStrength,
  66622. this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.visibleEdgeColor,
  66623. this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.hiddenEdgeColor;
  66624. a = a;
  66625. return this.renderToScreen ? (this.quad.material.transparent = !0,
  66626. a = null,
  66627. i.setClearColor(this.oldClearColor, this.oldClearAlpha),
  66628. u(null, !1),
  66629. u = i.getSize(new yn),
  66630. i.setViewport(0, 0, u.x, u.y),
  66631. i.setScissorTest(!1)) : (i.setClearColor(0, 0),
  66632. i.clear()),
  66633. i.setRenderTarget(a),
  66634. i.render(this.scene, this.camera),
  66635. i.setRenderTarget(d),
  66636. i.setClearColor(this.oldClearColor, this.oldClearAlpha),
  66637. i.autoClear = c,
  66638. !0
  66639. }
  66640. },
  66641. getPrepareMaskMaterial: function() {
  66642. return new Qr({
  66643. uniforms: {
  66644. depthTexture: {
  66645. value: null
  66646. },
  66647. cameraNearFar: {
  66648. value: new yn(.5,.5)
  66649. },
  66650. textureMatrix: {
  66651. value: new ni
  66652. }
  66653. },
  66654. vertexShader: ["varying vec4 projTexCoord;", "varying vec4 vPosition;", "uniform mat4 textureMatrix;", "void main() {", "\tvPosition = modelViewMatrix * vec4( position, 1.0 );", "\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );", "\tprojTexCoord = textureMatrix * worldPosition;", "\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
  66655. fragmentShader: ["#include <packing>", "varying vec4 vPosition;", "varying vec4 projTexCoord;", "uniform sampler2D depthTexture;", "uniform vec2 cameraNearFar;", "void main() {", "\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));", "\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );", "\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;", "\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);", "}"].join("\n")
  66656. })
  66657. },
  66658. getEdgeDetectionMaterial: function(e) {
  66659. return new Qr({
  66660. uniforms: {
  66661. thickness: {
  66662. value: e
  66663. },
  66664. maskTexture: {
  66665. value: null
  66666. },
  66667. texSize: {
  66668. value: new yn(10,10)
  66669. },
  66670. visibleEdgeColor: {
  66671. value: new Cn(1,1,1)
  66672. },
  66673. hiddenEdgeColor: {
  66674. value: new Cn(1,1,1)
  66675. }
  66676. },
  66677. vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
  66678. fragmentShader: "varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture; uniform float thickness;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) ) * thickness;\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}"
  66679. })
  66680. },
  66681. getSeperableBlurMaterial: function(e) {
  66682. return new Qr({
  66683. defines: {
  66684. MAX_RADIUS: e
  66685. },
  66686. uniforms: {
  66687. colorTexture: {
  66688. value: null
  66689. },
  66690. texSize: {
  66691. value: new yn(.5,.5)
  66692. },
  66693. direction: {
  66694. value: new yn(.5,.5)
  66695. },
  66696. kernelRadius: {
  66697. value: 1
  66698. }
  66699. },
  66700. vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
  66701. fragmentShader: "#include <common>\t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\t\t\t\t}"
  66702. })
  66703. },
  66704. getOverlayMaterial: function() {
  66705. return new Qr({
  66706. uniforms: {
  66707. maskTexture: {
  66708. value: null
  66709. },
  66710. edgeTexture1: {
  66711. value: null
  66712. },
  66713. edgeTexture2: {
  66714. value: null
  66715. },
  66716. patternTexture: {
  66717. value: null
  66718. },
  66719. edgeStrength: {
  66720. value: 1
  66721. },
  66722. edgeGlow: {
  66723. value: 1
  66724. },
  66725. usePatternTexture: {
  66726. value: 0
  66727. }
  66728. },
  66729. vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
  66730. fragmentShader: "varying vec2 vUv; \n\t\t\t\tuniform sampler2D edgeTexture1; \n\t\t\t\tuniform float edgeStrength; \n\t\t\t\t \n\t\t\t\tvoid main() { \n\t\t\t\t\tgl_FragColor = edgeStrength * texture2D(edgeTexture1, vUv); \n\t\t\t\t}",
  66731. blending: ee,
  66732. depthTest: !1,
  66733. depthWrite: !1,
  66734. transparent: !0
  66735. })
  66736. }
  66737. }),
  66738. hx.BlurDirectionX = new yn(1,0),
  66739. hx.BlurDirectionY = new yn(0,1);
  66740. var px, fx = function() {
  66741. y(n, Qr);
  66742. var t = w(n);
  66743. function n() {
  66744. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  66745. return O(this, n),
  66746. t.call(this, Object.assign({}, {
  66747. uniforms: {
  66748. tDiffuse: {
  66749. type: "t",
  66750. value: e.map
  66751. },
  66752. alpha: {
  66753. type: "f",
  66754. value: 1
  66755. }
  66756. },
  66757. vertexShader: Hp["basicTextured.vs"],
  66758. fragmentShader: Hp["basicTextured.fs"]
  66759. }, e))
  66760. }
  66761. return h(n, [{
  66762. key: "opacity",
  66763. get: function() {
  66764. return this.uniforms.alpha.value
  66765. },
  66766. set: function(e) {
  66767. this.uniforms && (this.uniforms.alpha.value = e)
  66768. }
  66769. }, {
  66770. key: "map",
  66771. get: function() {
  66772. return this.uniforms.tDiffuse.value
  66773. },
  66774. set: function(e) {
  66775. this.uniforms.tDiffuse.value = e
  66776. }
  66777. }]),
  66778. n
  66779. }(), mx = new pc, vx = {}, gx = new Map, Ch = function() {
  66780. y(v, zg);
  66781. var n, m = w(v);
  66782. function v(e, t) {
  66783. var n, i, r, a, o, s = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};
  66784. O(this, v),
  66785. n = m.call(this, e, $.extend(s, {
  66786. name: "mainViewer"
  66787. })),
  66788. window.viewer = g(n),
  66789. "pano" == Potree.settings.editType || "merge" == Potree.settings.editType ? (n.modules = {
  66790. Alignment: C1,
  66791. SiteModel: G1
  66792. },
  66793. Potree.settings.useDepthTex = !1,
  66794. "pano" == Potree.settings.editType ? n.modules.PanoEditor = ex : "merge" == Potree.settings.editType && (n.modules.MergeEditor = j1,
  66795. n.modules.CamAniEditor = Lb)) : n.modules = {
  66796. Clip: M1,
  66797. Alignment: C1,
  66798. SiteModel: G1,
  66799. RouteGuider: new vb,
  66800. ParticleEditor: Bb,
  66801. CamAniEditor: Lb
  66802. },
  66803. console.log("create viewer"),
  66804. n.navigateMode = "free",
  66805. n.isEdit = !0,
  66806. n.waitQueue = [],
  66807. n.unitConvert = new hb,
  66808. px = t,
  66809. n.visible = !0,
  66810. n.fpVisiDatasets = [],
  66811. n.atDatasets = [],
  66812. n.objs = new Si,
  66813. jp.EXT_DEPTH.isSupported() || console.error("ExtFragDepth unsupported! 边缘增强和测量线遮挡失效"),
  66814. n.guiLoaded = !1,
  66815. n.guiLoadTasks = [],
  66816. n.onVrListeners = [],
  66817. n.messages = [],
  66818. n.elMessages = $('\n\t\t<div id="message_listing" \n\t\t\tstyle="position: absolute; z-index: 1000; left: 10px; bottom: 10px">\n\t\t</div>'),
  66819. $(e).append(n.elMessages),
  66820. n.paused,
  66821. document.addEventListener("visibilitychange", function(e) {
  66822. n.dispatchEvent({
  66823. type: "pageVisible",
  66824. v: !document.hidden
  66825. })
  66826. });
  66827. try {
  66828. Potree.settings.isOfficial || (0 === $(e).find("#potree_map").length && (i = $('\n <div id="potree_map" class="mapBox" style="position: absolute; left: 50px; top: 50px; width: 400px; height: 400px; display: none">\n <div id="potree_map_header" style="position: absolute; width: 100%; height: 25px; top: 0px; background-color: rgba(0,0,0,0.5); z-index: 1000; border-top-left-radius: 3px; border-top-right-radius: 3px;">\n </div>\n <div id="potree_map_content" class="map" style="position: absolute; z-index: 100; top: 25px; width: 100%; height: calc(100% - 25px); border: 2px solid rgba(0,0,0,0.5); box-sizing: border-box;"></div>\n </div>\n '),
  66829. $(e).append(i)),
  66830. 0 === $(e).find("#potree_description").length && (r = $('<div id="potree_description" class="potree_info_text"></div>'),
  66831. $(e).append(r)),
  66832. 0 === $(e).find("#potree_annotations").length && (a = $('\n <div id="potree_annotation_container" \n style="position: absolute; z-index: 100000; width: 100%; height: 100%; pointer-events: none;"></div>'),
  66833. $(e).append(a)),
  66834. 0 === $(e).find("#potree_quick_buttons").length && (o = $('\n <div id="potree_quick_buttons" class="quick_buttons_container" style="">\n </div>\n '),
  66835. $(e).append(o)),
  66836. px || "merge" == Potree.settings.editType || ($(e).append($("<div id='potree_labels'></div>")),
  66837. px = $("<div id='mapGaode'></div>"),
  66838. $(e).append(px),
  66839. px = px[0])),
  66840. n.pointCloudLoadedCallback = s.onPointCloudLoaded || function() {}
  66841. ,
  66842. n.server = null,
  66843. n.fov = 60,
  66844. n.isFlipYZ = !1,
  66845. n.useDEMCollisions = !1,
  66846. n.generateDEM = !1,
  66847. n.minNodeSize = 30,
  66848. n.edlStrength = 1,
  66849. n.edlRadius = 1.4,
  66850. n.edlOpacity = 1,
  66851. n.useEDL = !1,
  66852. n.description = "",
  66853. n.classifications = Bm.DEFAULT,
  66854. n.moveSpeed = 10,
  66855. n.lengthUnit = lm.METER,
  66856. n.lengthUnitDisplay = lm.METER,
  66857. n.showBoundingBox = !1,
  66858. n.showAnnotations = !0,
  66859. n.freeze = !1,
  66860. n.clipTask = tm.HIGHLIGHT,
  66861. n.clipMethod = nm.INSIDE_ANY,
  66862. n.elevationGradientRepeat = im.CLAMP,
  66863. n.filterReturnNumberRange = [0, 7],
  66864. n.filterNumberOfReturnsRange = [0, 7],
  66865. n.filterGPSTimeRange = [-1 / 0, 1 / 0],
  66866. n.filterPointSourceIDRange = [0, 65535],
  66867. n.potreeRenderer = null,
  66868. n.edlRenderer = null,
  66869. n.pRenderer = null,
  66870. n.scene = null,
  66871. n.sceneVR = null,
  66872. n.overlay = null,
  66873. n.overlayCamera = null,
  66874. n.inputHandler = null,
  66875. n.controls = null,
  66876. n.clippingTool = null,
  66877. n.transformationTool = null,
  66878. n.navigationCube = null,
  66879. n.compass = null,
  66880. n.skybox = null,
  66881. n.clock = new Cd,
  66882. n.background = null,
  66883. s.noDragAndDrop || n.initDragAndDrop(),
  66884. "undefined" != typeof Stats && (n.stats = new Stats,
  66885. n.stats.showPanel(0),
  66886. document.body.appendChild(n.stats.dom)),
  66887. n.renderer.domElement.addEventListener("webglcontextlost", function(e) {
  66888. console.log(e),
  66889. n.postMessage("WebGL context lost. ☹");
  66890. e = n.renderer.getContext().getError();
  66891. console.log(e),
  66892. n.dispatchEvent({
  66893. type: "webglError",
  66894. msg: "webglcontextlost"
  66895. })
  66896. }, !1),
  66897. n.overlay = new gs,
  66898. n.overlayCamera = new ed(0,1,1,0,-1e3,1e3),
  66899. n.pRenderer = new Zm(n.renderer);
  66900. n.shadowTestCam = new $r(90,1,2.5,10),
  66901. n.shadowTestCam.position.set(3.5, -2.8, 8.561),
  66902. n.shadowTestCam.lookAt(new Cn(0,0,4.87));
  66903. var l = new rg(n.renderer);
  66904. n.sceneVR = new gs,
  66905. n.setScene(l),
  66906. n.composer = new ux(n.renderer),
  66907. n.ssaaRenderPass = new sx(0,0),
  66908. n.composer.addPass(n.ssaaRenderPass);
  66909. var u = n.outlinePass = new hx;
  66910. u.renderToScreen = !0,
  66911. u.enabled = !1,
  66912. n.composer.addPass(u),
  66913. u.edgeStrength = 10,
  66914. u.edgeGlow = 0,
  66915. u.visibleEdgeColor = new Yi("#09a1b3"),
  66916. u.hiddenEdgeColor = new Yi("#09a1b3"),
  66917. n.mainViewport = new Ig(n.scene.view,n.scene.cameraP,{
  66918. left: 0,
  66919. bottom: 0,
  66920. width: 1,
  66921. height: 1,
  66922. name: "MainView"
  66923. }),
  66924. n.viewports = [n.mainViewport],
  66925. n.compass = new Kv(g(n)),
  66926. n.magnifier = new ab(g(n)),
  66927. n.reticule = new sb(g(n)),
  66928. n.scene.scene.add(n.magnifier),
  66929. n.scene.scene.add(n.reticule),
  66930. "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (n.mapViewer = new fy(px)),
  66931. n.inputHandler = new Og(g(n),n.scene.scene),
  66932. n.clippingTool = new jv(g(n)),
  66933. n.transformationTool = new Zv(g(n)),
  66934. n.navigationCube = new Dw(g(n)),
  66935. n.navigationCube.visible = !1,
  66936. n.createControls(),
  66937. n.clippingTool.setScene(n.scene);
  66938. var c = function(e) {
  66939. 1 === n.scene.pointclouds.length && (e = e.pointcloud.boundingBox.getSize(new Cn).length(),
  66940. n.setMoveSpeed(e /= 2e3))
  66941. }
  66942. , d = function(e) {
  66943. n.inputHandler.deselect(e.volume)
  66944. };
  66945. n.addEventListener("scene_changed", function(e) {
  66946. n.inputHandler.setScene(e.scene),
  66947. n.clippingTool.setScene(n.scene),
  66948. e.scene.hasEventListener("pointcloud_added", c) || e.scene.addEventListener("pointcloud_added", c),
  66949. e.scene.hasEventListener("volume_removed", c) || e.scene.addEventListener("volume_removed", d)
  66950. }),
  66951. n.scene.addEventListener("volume_removed", d),
  66952. n.scene.addEventListener("pointcloud_added", c),
  66953. n.setFOV(60),
  66954. n.setEDLEnabled(!1),
  66955. n.setEDLRadius(1.4),
  66956. n.setEDLStrength(.4),
  66957. n.setEDLOpacity(1),
  66958. n.setClipTask(tm.HIGHLIGHT),
  66959. n.setClipMethod(nm.INSIDE_ANY),
  66960. n.setPointBudget(1e6),
  66961. n.setShowBoundingBox(!1),
  66962. n.setFreeze(!1),
  66963. n.setControls(n.fpControls),
  66964. n.setBackground(new Yi(Potree.config.background), 1),
  66965. n.scaleFactor = 1,
  66966. n.loadSettingsFromURL(),
  66967. n.renderer.setAnimationLoop(n.loop.bind(g(n))),
  66968. n.loadGUI = n.loadGUI.bind(g(n)),
  66969. n.annotationTool = new _w(g(n)),
  66970. n.measuringTool = new Wv(g(n)),
  66971. n.profileTool = new qv(g(n)),
  66972. n.volumeTool = new Qv(g(n)),
  66973. n.tagTool = new Pw(g(n)),
  66974. y1.init(g(n), n.mapViewer ? [g(n), n.mapViewer] : [g(n)]),
  66975. "pano" == Potree.settings.editType ? n.modules.PanoEditor.init() : "merge" == Potree.settings.editType ? n.modules.MergeEditor.init() : (n.modules.SiteModel.init(),
  66976. n.modules.ParticleEditor.init()),
  66977. n.modules.Alignment.init(),
  66978. n.images360 = new ly(g(n)),
  66979. n.scene.scene.add(n.objs),
  66980. vx = {
  66981. objLoader: new tx(mx),
  66982. mtlLoader: new rx(mx),
  66983. glbLoader: new Qw(void 0,n.renderer,Potree.settings.libsUrl)
  66984. }
  66985. } catch (e) {
  66986. n.onCrash(e)
  66987. }
  66988. var h = "";
  66989. Object.defineProperty(Potree.settings, "pointDensity", {
  66990. get: function() {
  66991. return h
  66992. },
  66993. set: function(e) {
  66994. var t;
  66995. e && e != h && (t = Potree.config.pointDensity[e],
  66996. t = (n.magnifier.visible ? Potree.config.pointDensity.magnifier : t).pointBudget,
  66997. viewer.setPointBudget(t),
  66998. h = e,
  66999. n.setPointLevels())
  67000. }
  67001. });
  67002. var p = "";
  67003. Object.defineProperty(Potree.settings, "UserPointDensity", {
  67004. get: function() {
  67005. return p
  67006. },
  67007. set: function(e) {
  67008. p != e && ("showPointCloud" == Potree.settings.displayMode && 4 != n.viewports.length && (Potree.settings.pointDensity = e),
  67009. p = e)
  67010. }
  67011. });
  67012. var f = Potree.settings.cameraFar;
  67013. return Object.defineProperty(Potree.settings, "cameraFar", {
  67014. get: function() {
  67015. return f
  67016. },
  67017. set: function(e) {
  67018. e != f && ("showPanos" != Potree.settings.displayMode && (n.mainViewport.camera.far = e,
  67019. n.mainViewport.camera.updateProjectionMatrix()),
  67020. f = e)
  67021. }
  67022. }),
  67023. n.addEventListener("allLoaded", function() {
  67024. setTimeout(n.testPointcloudsMaxLevel.bind(g(n)), 2e3)
  67025. }),
  67026. "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (n.addEventListener("switchFloorplanSelect", function(e) {
  67027. var t;
  67028. n.selectedFloorplan = e.pointcloud,
  67029. n.updateFpVisiDatasets(),
  67030. e.pointcloud ? t = [e.pointcloud] : n.fpVisiDatasets.length && (t = n.fpVisiDatasets),
  67031. t && n.mapViewer.fitToDatasets(t)
  67032. }),
  67033. n.modules.SiteModel.bus.addEventListener("FloorChange", function() {
  67034. n.updateFpVisiDatasets()
  67035. }),
  67036. n.mapViewer.mapLayer.addEventListener("floorplanLoaded", function() {
  67037. n.updateCadVisibles(n.fpVisiDatasets, !0)
  67038. })),
  67039. n.addEventListener("camera_changed", function(e) {
  67040. e.changeInfo.positionChanged && (gx.clear(),
  67041. n.updateDatasetAt())
  67042. }),
  67043. n
  67044. }
  67045. return h(v, [{
  67046. key: "ifPointBlockedByIntersect",
  67047. value: function(e, t) {
  67048. var n, i = gx.get(t || e);
  67049. return i ? n = i.ifShelter : (n = viewer.inputHandler.ifBlockedByIntersect(e, .3, !0),
  67050. gx.set(t || e, {
  67051. ifShelter: n
  67052. })),
  67053. n
  67054. }
  67055. }, {
  67056. key: "updateDatasetAt",
  67057. value: function(n) {
  67058. function e() {
  67059. var t = viewer.mainViewport.view.position
  67060. , e = i.scene.pointclouds.filter(function(e) {
  67061. return e.ifContainsPoint(t)
  67062. });
  67063. return Fm.getDifferenceSet(e, i.atDatasets).length && (i.atDatasets = e,
  67064. "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && i.updateFpVisiDatasets(),
  67065. i.dispatchEvent({
  67066. type: "pointcloudAtChange",
  67067. pointclouds: e
  67068. })),
  67069. !(n = !1)
  67070. }
  67071. var i = this;
  67072. n ? e() : Fm.intervalTool.isWaiting("atWhichDataset", e, 500)
  67073. }
  67074. }, {
  67075. key: "updatePanosVisibles",
  67076. value: function(n) {
  67077. viewer.images360.panos.forEach(function(e) {
  67078. var t = n && n.panos.includes(e);
  67079. viewer.updateVisible(e, "buildingChange", t, 2)
  67080. })
  67081. }
  67082. }, {
  67083. key: "updateFpVisiDatasets",
  67084. value: function() {
  67085. var e, t, n = this, i = (this.modules.Clip,
  67086. this.modules.SiteModel), r = this.modules.Alignment, a = i.currentFloor;
  67087. this.selectedFloorplan ? (e = [this.selectedFloorplan],
  67088. this.updateCadVisibles(e)) : (i.editing || r.editing ? (t = this.scene.pointclouds.filter(function(e) {
  67089. return n.getObjVisiByReason(e, "datasetSelection")
  67090. }),
  67091. this.updateCadVisibles(t)) : (0 == (t = a ? this.findPointcloudsAtFloor(a) : []).length && (t = this.atDatasets),
  67092. this.updateCadVisibles(t)),
  67093. this.updatePanosVisibles(a))
  67094. }
  67095. }, {
  67096. key: "findPointcloudsAtFloor",
  67097. value: function(i) {
  67098. var r = []
  67099. , e = viewer.scene.pointclouds.filter(function(e) {
  67100. var t = 0;
  67101. if (e.belongToEntity && (e.belongToEntity == i || e.belongToEntity.buildParent == i))
  67102. return !0;
  67103. if (e.panos.length) {
  67104. var n = e.panos.filter(function(e) {
  67105. return i.ifContainsPoint(e.position)
  67106. }).length / e.panos.length;
  67107. if (.5 < n)
  67108. return !0;
  67109. n < .2 && (t += n)
  67110. }
  67111. n = i.intersectPointcloudVolume(e) / i.getVolume(!0);
  67112. if (.95 < n)
  67113. return !0;
  67114. r.push({
  67115. score: t += n,
  67116. pointcloud: e
  67117. })
  67118. });
  67119. return 0 == e.length && (r.sort(function(e, t) {
  67120. return e.score - t.score
  67121. }),
  67122. .4 < r[0].score && (e = [r[0].pointcloud])),
  67123. e
  67124. }
  67125. }, {
  67126. key: "updateCadVisibles",
  67127. value: function(n, e) {
  67128. var t = this.fpVisiDatasets
  67129. , n = this.fpVisiDatasets = n;
  67130. if (!e && 0 == Fm.getDifferenceSet(t, n).length)
  67131. return;
  67132. viewer.scene.pointclouds.forEach(function(e) {
  67133. var t = viewer.mapViewer.mapLayer.getFloorplan(e.dataset_id)
  67134. , e = n.includes(e);
  67135. t && viewer.updateVisible(t.objectGroup, "buildingChange", e)
  67136. }),
  67137. viewer.mapViewer.mapLayer.needUpdate = !0,
  67138. viewer.mapViewer.needRender = !0
  67139. }
  67140. }, {
  67141. key: "testPointcloudsMaxLevel",
  67142. value: function() {
  67143. function e() {
  67144. n = !0,
  67145. Fm.intervalTool.isWaiting("testPointcloudsMaxLevel", function() {
  67146. if (n || !(20 < r)) {
  67147. r++;
  67148. var t = !(n = !1);
  67149. if (viewer.scene.pointclouds.forEach(function(e) {
  67150. e.testMaxNodeLevel() && (t = !1)
  67151. }),
  67152. !t)
  67153. return !0;
  67154. i.removeEventListener("camera_changed", e),
  67155. console.log("testPointcloudsMaxLevel结束")
  67156. }
  67157. }, r < 10 ? 150 : 500)
  67158. }
  67159. var n, i = this, r = 0;
  67160. this.addEventListener("camera_changed", e),
  67161. e()
  67162. }
  67163. }, {
  67164. key: "setPointLevels",
  67165. value: function() {
  67166. this.scene.pointclouds.forEach(function(e) {
  67167. e.setPointLevel()
  67168. })
  67169. }
  67170. }, {
  67171. key: "onCrash",
  67172. value: function(e) {
  67173. var t;
  67174. throw $(this.renderArea).empty(),
  67175. 0 === $(this.renderArea).find("#potree_failpage").length && ((t = $('\n\t\t\t<div id="#potree_failpage" class="potree_failpage"> \n\t\t\t\t\n\t\t\t\t<h1>Potree Encountered An Error </h1>\n\n\t\t\t\t<p>\n\t\t\t\tThis may happen if your browser or graphics card is not supported.\n\t\t\t\t<br>\n\t\t\t\tWe recommend to use \n\t\t\t\t<a href="https://www.google.com/chrome/browser" target="_blank" style="color:initial">Chrome</a>\n\t\t\t\tor \n\t\t\t\t<a href="https://www.mozilla.org/" target="_blank">Firefox</a>.\n\t\t\t\t</p>\n\n\t\t\t\t<p>\n\t\t\t\tPlease also visit <a href="http://webglreport.com/" target="_blank">webglreport.com</a> and \n\t\t\t\tcheck whether your system supports WebGL.\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\tIf you are already using one of the recommended browsers and WebGL is enabled, \n\t\t\t\tconsider filing an issue report at <a href="https://github.com/potree/potree/issues" target="_blank">github</a>,<br>\n\t\t\t\tincluding your operating system, graphics card, browser and browser version, as well as the \n\t\t\t\terror message below.<br>\n\t\t\t\tPlease do not report errors on unsupported browsers.\n\t\t\t\t</p>\n\n\t\t\t\t<pre id="potree_error_console" style="width: 100%; height: 100%"></pre>\n\t\t\t\t\n\t\t\t</div>')).find("#potree_error_console").html(e.stack),
  67176. $(this.renderArea).append(t)),
  67177. e
  67178. }
  67179. }, {
  67180. key: "setScene",
  67181. value: function(e) {
  67182. var t, n = this;
  67183. e !== this.scene && (t = this.scene,
  67184. this.scene = e,
  67185. this.dispatchEvent({
  67186. type: "scene_changed",
  67187. oldScene: t,
  67188. scene: e
  67189. }),
  67190. $(".annotation").detach(),
  67191. this.scene.annotations.traverse(function(e) {
  67192. n.renderArea.appendChild(e.domElement[0])
  67193. }),
  67194. this.onAnnotationAdded || (this.onAnnotationAdded = function(e) {
  67195. e.annotation.traverse(function(e) {
  67196. $("#potree_annotation_container").append(e.domElement),
  67197. e.scene = n.scene
  67198. })
  67199. }
  67200. ),
  67201. t && t.annotations.removeEventListener("annotation_added", this.onAnnotationAdded),
  67202. this.scene.annotations.addEventListener("annotation_added", this.onAnnotationAdded))
  67203. }
  67204. }, {
  67205. key: "setControls",
  67206. value: function(e) {
  67207. e !== this.controls && (this.controls && (this.controls.setEnable(!1),
  67208. this.controls.moveSpeed = this.moveSpeed),
  67209. (this.controls = e).moveSpeed && this.setMoveSpeed(e.moveSpeed),
  67210. this.controls.setEnable(!0))
  67211. }
  67212. }, {
  67213. key: "getControls",
  67214. value: function() {
  67215. return this.renderer.xr.isPresenting ? this.vrControls : this.controls
  67216. }
  67217. }, {
  67218. key: "getMinNodeSize",
  67219. value: function() {
  67220. return this.minNodeSize
  67221. }
  67222. }, {
  67223. key: "setMinNodeSize",
  67224. value: function(e) {
  67225. this.minNodeSize !== e && (this.minNodeSize = e,
  67226. this.dispatchEvent({
  67227. type: "minnodesize_changed",
  67228. viewer: this
  67229. }))
  67230. }
  67231. }, {
  67232. key: "getBackground",
  67233. value: function() {
  67234. return this.background
  67235. }
  67236. }, {
  67237. key: "setBackground",
  67238. value: function(e) {
  67239. this.background !== e && ("skybox" === e && (this.skybox = Jf.loadSkybox(new URL(Potree.resourcePath + "/textures/skybox2/").href)),
  67240. this.background = e,
  67241. this.backgroundOpacity = 1,
  67242. this.dispatchEvent({
  67243. type: "background_changed",
  67244. viewer: this
  67245. }))
  67246. }
  67247. }, {
  67248. key: "setDescription",
  67249. value: function(e) {
  67250. this.description = e,
  67251. $("#potree_description").html(e)
  67252. }
  67253. }, {
  67254. key: "getDescription",
  67255. value: function() {
  67256. return this.description
  67257. }
  67258. }, {
  67259. key: "setShowBoundingBox",
  67260. value: function(e) {
  67261. this.showBoundingBox !== e && (this.showBoundingBox = e,
  67262. this.dispatchEvent({
  67263. type: "show_boundingbox_changed",
  67264. viewer: this
  67265. }))
  67266. }
  67267. }, {
  67268. key: "getShowBoundingBox",
  67269. value: function() {
  67270. return this.showBoundingBox
  67271. }
  67272. }, {
  67273. key: "setMoveSpeed",
  67274. value: function(e) {
  67275. this.getMoveSpeed() !== e && (this.mainViewport.setMoveSpeed(e),
  67276. this.dispatchEvent({
  67277. type: "move_speed_changed",
  67278. viewer: this,
  67279. speed: e
  67280. }))
  67281. }
  67282. }, {
  67283. key: "getMoveSpeed",
  67284. value: function() {
  67285. return this.mainViewport.moveSpeed
  67286. }
  67287. }, {
  67288. key: "setWeightClassification",
  67289. value: function(e) {
  67290. for (var t = 0; t < this.scene.pointclouds.length; t++)
  67291. this.scene.pointclouds[t].material.weightClassification = e,
  67292. this.dispatchEvent({
  67293. type: "attribute_weights_changed" + t,
  67294. viewer: this
  67295. })
  67296. }
  67297. }, {
  67298. key: "setFreeze",
  67299. value: function(e) {
  67300. e = Boolean(e),
  67301. this.freeze !== e && (this.freeze = e,
  67302. this.dispatchEvent({
  67303. type: "freeze_changed",
  67304. viewer: this
  67305. }))
  67306. }
  67307. }, {
  67308. key: "getFreeze",
  67309. value: function() {
  67310. return this.freeze
  67311. }
  67312. }, {
  67313. key: "getClipTask",
  67314. value: function() {
  67315. return this.clipTask
  67316. }
  67317. }, {
  67318. key: "getClipMethod",
  67319. value: function() {
  67320. return this.clipMethod
  67321. }
  67322. }, {
  67323. key: "setClipTask",
  67324. value: function(e) {
  67325. this.clipTask !== e && (this.clipTask = e,
  67326. this.dispatchEvent({
  67327. type: "cliptask_changed",
  67328. viewer: this
  67329. }))
  67330. }
  67331. }, {
  67332. key: "setClipMethod",
  67333. value: function(e) {
  67334. this.clipMethod !== e && (this.clipMethod = e,
  67335. this.dispatchEvent({
  67336. type: "clipmethod_changed",
  67337. viewer: this
  67338. }))
  67339. }
  67340. }, {
  67341. key: "setElevationGradientRepeat",
  67342. value: function(e) {
  67343. this.elevationGradientRepeat !== e && (this.elevationGradientRepeat = e,
  67344. this.dispatchEvent({
  67345. type: "elevation_gradient_repeat_changed",
  67346. viewer: this
  67347. }))
  67348. }
  67349. }, {
  67350. key: "setPointBudget",
  67351. value: function(e) {
  67352. Potree.pointBudget !== e && (Potree.pointBudget = parseInt(e),
  67353. this.dispatchEvent({
  67354. type: "point_budget_changed",
  67355. viewer: this
  67356. }))
  67357. }
  67358. }, {
  67359. key: "getPointBudget",
  67360. value: function() {
  67361. return Potree.pointBudget
  67362. }
  67363. }, {
  67364. key: "setShowAnnotations",
  67365. value: function(e) {
  67366. this.showAnnotations !== e && (this.showAnnotations = e,
  67367. this.dispatchEvent({
  67368. type: "show_annotations_changed",
  67369. viewer: this
  67370. }))
  67371. }
  67372. }, {
  67373. key: "getShowAnnotations",
  67374. value: function() {
  67375. return this.showAnnotations
  67376. }
  67377. }, {
  67378. key: "setDEMCollisionsEnabled",
  67379. value: function(e) {
  67380. this.useDEMCollisions !== e && (this.useDEMCollisions = e,
  67381. this.dispatchEvent({
  67382. type: "use_demcollisions_changed",
  67383. viewer: this
  67384. }))
  67385. }
  67386. }, {
  67387. key: "getDEMCollisionsEnabled",
  67388. value: function() {
  67389. return this.useDEMCollisions
  67390. }
  67391. }, {
  67392. key: "setEDLEnabled",
  67393. value: function(e) {
  67394. e = Boolean(e) && jp.SHADER_EDL.isSupported(),
  67395. this.useEDL !== e && (this.useEDL = e,
  67396. this.dispatchEvent({
  67397. type: "use_edl_changed",
  67398. viewer: this
  67399. }))
  67400. }
  67401. }, {
  67402. key: "getEDLEnabled",
  67403. value: function() {
  67404. return this.useEDL
  67405. }
  67406. }, {
  67407. key: "setEDLRadius",
  67408. value: function(e) {
  67409. this.edlRadius !== e && (this.edlRadius = e,
  67410. this.dispatchEvent({
  67411. type: "edl_radius_changed",
  67412. viewer: this
  67413. }))
  67414. }
  67415. }, {
  67416. key: "getEDLRadius",
  67417. value: function() {
  67418. return this.edlRadius
  67419. }
  67420. }, {
  67421. key: "setEDLStrength",
  67422. value: function(e) {
  67423. this.edlStrength !== e && (this.edlStrength = e,
  67424. this.dispatchEvent({
  67425. type: "edl_strength_changed",
  67426. viewer: this
  67427. }))
  67428. }
  67429. }, {
  67430. key: "getEDLStrength",
  67431. value: function() {
  67432. return this.edlStrength
  67433. }
  67434. }, {
  67435. key: "setEDLOpacity",
  67436. value: function(e) {
  67437. this.edlOpacity !== e && (this.edlOpacity = e,
  67438. this.dispatchEvent({
  67439. type: "edl_opacity_changed",
  67440. viewer: this
  67441. }))
  67442. }
  67443. }, {
  67444. key: "getEDLOpacity",
  67445. value: function() {
  67446. return this.edlOpacity
  67447. }
  67448. }, {
  67449. key: "setFOV",
  67450. value: function(e) {
  67451. var t;
  67452. this.fov !== e && (t = this.fov,
  67453. this.fov = e,
  67454. this.scene.cameraP.fov = this.fov,
  67455. this.scene.cameraP.updateProjectionMatrix(),
  67456. this.dispatchEvent({
  67457. type: "fov_changed",
  67458. viewer: this,
  67459. oldFov: t,
  67460. fov: this.fov
  67461. }))
  67462. }
  67463. }, {
  67464. key: "getFOV",
  67465. value: function() {
  67466. return this.fov
  67467. }
  67468. }, {
  67469. key: "disableAnnotations",
  67470. value: function() {
  67471. this.scene.annotations.traverse(function(e) {
  67472. e.domElement.css("pointer-events", "none")
  67473. })
  67474. }
  67475. }, {
  67476. key: "enableAnnotations",
  67477. value: function() {
  67478. this.scene.annotations.traverse(function(e) {
  67479. e.domElement.css("pointer-events", "auto")
  67480. })
  67481. }
  67482. }, {
  67483. key: "setClassifications",
  67484. value: function(e) {
  67485. this.classifications = e,
  67486. this.dispatchEvent({
  67487. type: "classifications_changed",
  67488. viewer: this
  67489. })
  67490. }
  67491. }, {
  67492. key: "setClassificationVisibility",
  67493. value: function(e, t) {
  67494. this.classifications[e] ? this.classifications[e].visible !== t && (this.classifications[e].visible = t,
  67495. this.dispatchEvent({
  67496. type: "classification_visibility_changed",
  67497. viewer: this
  67498. })) : (this.classifications[e] = {
  67499. visible: t,
  67500. name: "no name"
  67501. },
  67502. this.dispatchEvent({
  67503. type: "classification_visibility_changed",
  67504. viewer: this
  67505. }))
  67506. }
  67507. }, {
  67508. key: "toggleAllClassificationsVisibility",
  67509. value: function() {
  67510. for (var e = 0, t = 0, n = 0, i = Object.keys(this.classifications); n < i.length; n++) {
  67511. var r = i[n];
  67512. this.classifications[r].visible && e++,
  67513. t++
  67514. }
  67515. var a = !0;
  67516. e === t && (a = !1);
  67517. for (var o = !1, s = 0, l = Object.keys(this.classifications); s < l.length; s++) {
  67518. var u = l[s];
  67519. this.classifications[u].visible !== a && (this.classifications[u].visible = a,
  67520. o = !0)
  67521. }
  67522. o && this.dispatchEvent({
  67523. type: "classification_visibility_changed",
  67524. viewer: this
  67525. })
  67526. }
  67527. }, {
  67528. key: "setFilterReturnNumberRange",
  67529. value: function(e, t) {
  67530. this.filterReturnNumberRange = [e, t],
  67531. this.dispatchEvent({
  67532. type: "filter_return_number_range_changed",
  67533. viewer: this
  67534. })
  67535. }
  67536. }, {
  67537. key: "setFilterNumberOfReturnsRange",
  67538. value: function(e, t) {
  67539. this.filterNumberOfReturnsRange = [e, t],
  67540. this.dispatchEvent({
  67541. type: "filter_number_of_returns_range_changed",
  67542. viewer: this
  67543. })
  67544. }
  67545. }, {
  67546. key: "setFilterGPSTimeRange",
  67547. value: function(e, t) {
  67548. this.filterGPSTimeRange = [e, t],
  67549. this.dispatchEvent({
  67550. type: "filter_gps_time_range_changed",
  67551. viewer: this
  67552. })
  67553. }
  67554. }, {
  67555. key: "setFilterPointSourceIDRange",
  67556. value: function(e, t) {
  67557. this.filterPointSourceIDRange = [e, t],
  67558. this.dispatchEvent({
  67559. type: "filter_point_source_id_range_changed",
  67560. viewer: this
  67561. })
  67562. }
  67563. }, {
  67564. key: "setLengthUnit",
  67565. value: function(e) {
  67566. switch (e) {
  67567. case "m":
  67568. this.lengthUnit = lm.METER,
  67569. this.lengthUnitDisplay = lm.METER;
  67570. break;
  67571. case "ft":
  67572. this.lengthUnit = lm.FEET,
  67573. this.lengthUnitDisplay = lm.FEET;
  67574. break;
  67575. case "in":
  67576. this.lengthUnit = lm.INCH,
  67577. this.lengthUnitDisplay = lm.INCH
  67578. }
  67579. this.dispatchEvent({
  67580. type: "length_unit_changed",
  67581. viewer: this,
  67582. value: e
  67583. })
  67584. }
  67585. }, {
  67586. key: "setLengthUnitAndDisplayUnit",
  67587. value: function(e, t) {
  67588. switch (e) {
  67589. case "m":
  67590. this.lengthUnit = lm.METER;
  67591. break;
  67592. case "ft":
  67593. this.lengthUnit = lm.FEET;
  67594. break;
  67595. case "in":
  67596. this.lengthUnit = lm.INCH
  67597. }
  67598. switch (t) {
  67599. case "m":
  67600. this.lengthUnitDisplay = lm.METER;
  67601. break;
  67602. case "ft":
  67603. this.lengthUnitDisplay = lm.FEET;
  67604. break;
  67605. case "in":
  67606. this.lengthUnitDisplay = lm.INCH
  67607. }
  67608. this.dispatchEvent({
  67609. type: "length_unit_changed",
  67610. viewer: this,
  67611. value: e
  67612. })
  67613. }
  67614. }, {
  67615. key: "zoomTo",
  67616. value: function(e, t) {
  67617. var n = this
  67618. , i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0
  67619. , r = this.scene.view
  67620. , a = this.scene.cameraP.clone();
  67621. a.rotation.copy(this.scene.cameraP.rotation),
  67622. a.rotation.order = "ZXY",
  67623. a.rotation.x = Math.PI / 2 + r.pitch,
  67624. a.rotation.z = r.yaw,
  67625. a.updateMatrix(),
  67626. a.updateMatrixWorld(),
  67627. a.zoomTo(e, t);
  67628. var o = (o = e.boundingSphere || (e.geometry && e.geometry.boundingSphere ? e.geometry.boundingSphere : e.boundingBox.getBoundingSphere(new qn))).clone().applyMatrix4(e.matrixWorld)
  67629. , s = r.position.clone()
  67630. , t = a.position.clone()
  67631. , e = r.getPivot()
  67632. , a = o.center
  67633. , o = (r.radius,
  67634. t.distanceTo(a),
  67635. TWEEN.Easing.Quartic.Out)
  67636. , l = s.clone()
  67637. , t = new TWEEN.Tween(l).to(t, i);
  67638. t.easing(o),
  67639. t.onUpdate(function() {
  67640. r.position.copy(l)
  67641. }),
  67642. t.start();
  67643. var u = e.clone()
  67644. , i = new TWEEN.Tween(u).to(a, i);
  67645. i.easing(o),
  67646. i.onUpdate(function() {
  67647. r.lookAt(u)
  67648. }),
  67649. i.onComplete(function() {
  67650. r.lookAt(u),
  67651. n.dispatchEvent({
  67652. type: "focusing_finished",
  67653. target: n
  67654. })
  67655. }),
  67656. this.dispatchEvent({
  67657. type: "focusing_started",
  67658. target: this
  67659. }),
  67660. i.start()
  67661. }
  67662. }, {
  67663. key: "moveToGpsTimeVicinity",
  67664. value: function(e) {
  67665. var t = Potree.Utils.findClosestGpsTime(e, viewer)
  67666. , e = t.node.pointcloud.deepestNodeAt(t.position).getBoundingBox()
  67667. , e = e.min.distanceTo(e.max)
  67668. , e = this.scene.getActiveCamera().getWorldDirection(new Cn).multiplyScalar(e)
  67669. , e = t.position.clone().sub(e);
  67670. this.scene.view.position.copy(e),
  67671. this.scene.view.lookAt(t.position)
  67672. }
  67673. }, {
  67674. key: "showAbout",
  67675. value: function() {
  67676. $(function() {
  67677. $("#about-panel").dialog()
  67678. })
  67679. }
  67680. }, {
  67681. key: "getGpsTimeExtent",
  67682. value: function() {
  67683. var e, t = [1 / 0, -1 / 0], n = ue(this.scene.pointclouds);
  67684. try {
  67685. for (n.s(); !(e = n.n()).done; ) {
  67686. var i = e.value.pcoGeometry.pointAttributes.attributes.find(function(e) {
  67687. return "gps-time" === e.name
  67688. });
  67689. i && (t[0] = Math.min(t[0], i.range[0]),
  67690. t[1] = Math.max(t[1], i.range[1]))
  67691. }
  67692. } catch (e) {
  67693. n.e(e)
  67694. } finally {
  67695. n.f()
  67696. }
  67697. return t
  67698. }
  67699. }, {
  67700. key: "fitToScreen",
  67701. value: function() {
  67702. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1
  67703. , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0
  67704. , n = this.getBoundingBox(this.scene.pointclouds)
  67705. , i = new Si;
  67706. i.boundingBox = n,
  67707. this.zoomTo(i, e, t),
  67708. this.controls.stop()
  67709. }
  67710. }, {
  67711. key: "toggleNavigationCube",
  67712. value: function() {
  67713. this.navigationCube.visible = !this.navigationCube.visible
  67714. }
  67715. }, {
  67716. key: "setTopView",
  67717. value: function(e) {
  67718. (e = e || this.scene.view).setCubeView("top"),
  67719. this.fitToScreen()
  67720. }
  67721. }, {
  67722. key: "setBottomView",
  67723. value: function() {
  67724. this.scene.view.yaw = -Math.PI,
  67725. this.scene.view.pitch = Math.PI / 2,
  67726. this.fitToScreen()
  67727. }
  67728. }, {
  67729. key: "setFrontView",
  67730. value: function(e) {
  67731. (e = e || this.scene.view).yaw = 0,
  67732. e.pitch = 0,
  67733. this.fitToScreen()
  67734. }
  67735. }, {
  67736. key: "setBackView",
  67737. value: function(e) {
  67738. (e = e || this.scene.view).yaw = Math.PI,
  67739. e.pitch = 0,
  67740. this.fitToScreen()
  67741. }
  67742. }, {
  67743. key: "setLeftView",
  67744. value: function() {
  67745. this.scene.view.yaw = -Math.PI / 2,
  67746. this.scene.view.pitch = 0,
  67747. this.fitToScreen()
  67748. }
  67749. }, {
  67750. key: "setRightView",
  67751. value: function() {
  67752. this.scene.view.yaw = Math.PI / 2,
  67753. this.scene.view.pitch = 0,
  67754. this.fitToScreen()
  67755. }
  67756. }, {
  67757. key: "flipYZ",
  67758. value: function() {
  67759. this.isFlipYZ = !this.isFlipYZ,
  67760. console.log("TODO")
  67761. }
  67762. }, {
  67763. key: "setCameraMode",
  67764. value: function(e) {
  67765. this.scene.cameraMode = e;
  67766. var t, n = ue(this.scene.pointclouds);
  67767. try {
  67768. for (n.s(); !(t = n.n()).done; )
  67769. t.value.material.useOrthographicCamera = e == em.ORTHOGRAPHIC
  67770. } catch (e) {
  67771. n.e(e)
  67772. } finally {
  67773. n.f()
  67774. }
  67775. }
  67776. }, {
  67777. key: "getProjection",
  67778. value: function() {
  67779. var e = this.scene.pointclouds[0];
  67780. return e ? e.projection : null
  67781. }
  67782. }, {
  67783. key: "loadProject",
  67784. value: (n = r(regeneratorRuntime.mark(function e(t, n) {
  67785. var i;
  67786. return regeneratorRuntime.wrap(function(e) {
  67787. for (; ; )
  67788. switch (e.prev = e.next) {
  67789. case 0:
  67790. return e.next = 2,
  67791. fetch(t);
  67792. case 2:
  67793. if ((i = e.sent).ok)
  67794. return e.next = 6,
  67795. i.text();
  67796. e.next = 11;
  67797. break;
  67798. case 6:
  67799. i = e.sent,
  67800. "Potree" === (i = xw.parse(i)).type && Potree.loadProject(viewer, i, n),
  67801. e.next = 12;
  67802. break;
  67803. case 11:
  67804. console.warn("未能加载:" + t);
  67805. case 12:
  67806. case "end":
  67807. return e.stop()
  67808. }
  67809. }, e)
  67810. })),
  67811. function(e, t) {
  67812. return n.apply(this, arguments)
  67813. }
  67814. )
  67815. }, {
  67816. key: "saveProject",
  67817. value: function() {
  67818. return Potree.saveProject(this)
  67819. }
  67820. }, {
  67821. key: "loadSettingsFromURL",
  67822. value: function() {
  67823. var e, t, n, i, r, a;
  67824. Jf.getParameterByName("pointSize") && this.setPointSize(parseFloat(Jf.getParameterByName("pointSize"))),
  67825. Jf.getParameterByName("FOV") && this.setFOV(parseFloat(Jf.getParameterByName("FOV"))),
  67826. Jf.getParameterByName("opacity") && this.setOpacity(parseFloat(Jf.getParameterByName("opacity"))),
  67827. Jf.getParameterByName("edlEnabled") && (e = "true" === Jf.getParameterByName("edlEnabled"),
  67828. this.setEDLEnabled(e)),
  67829. Jf.getParameterByName("edlRadius") && this.setEDLRadius(parseFloat(Jf.getParameterByName("edlRadius"))),
  67830. Jf.getParameterByName("edlStrength") && this.setEDLStrength(parseFloat(Jf.getParameterByName("edlStrength"))),
  67831. Jf.getParameterByName("pointBudget") && this.setPointBudget(parseFloat(Jf.getParameterByName("pointBudget"))),
  67832. Jf.getParameterByName("showBoundingBox") && ("true" === Jf.getParameterByName("showBoundingBox") ? this.setShowBoundingBox(!0) : this.setShowBoundingBox(!1)),
  67833. Jf.getParameterByName("material") && (t = Jf.getParameterByName("material"),
  67834. this.setMaterial(t)),
  67835. Jf.getParameterByName("pointSizing") && (t = Jf.getParameterByName("pointSizing"),
  67836. this.setPointSizing(t)),
  67837. Jf.getParameterByName("quality") && (n = Jf.getParameterByName("quality"),
  67838. this.setQuality(n)),
  67839. Jf.getParameterByName("position") && (r = Jf.getParameterByName("position").replace("[", "").replace("]", "").split(";"),
  67840. n = parseFloat(r[0]),
  67841. i = parseFloat(r[1]),
  67842. r = parseFloat(r[2]),
  67843. this.scene.view.position.set(n, i, r)),
  67844. Jf.getParameterByName("target") && (a = Jf.getParameterByName("target").replace("[", "").replace("]", "").split(";"),
  67845. i = parseFloat(a[0]),
  67846. r = parseFloat(a[1]),
  67847. a = parseFloat(a[2]),
  67848. this.scene.view.lookAt(new Cn(i,r,a))),
  67849. Jf.getParameterByName("background") && (a = Jf.getParameterByName("background"),
  67850. this.setBackground(a))
  67851. }
  67852. }, {
  67853. key: "createControls",
  67854. value: function() {
  67855. this.fpControls = new Fg(this,this.mainViewport),
  67856. this.fpControls.enabled = !1,
  67857. this.fpControls.addEventListener("start", this.disableAnnotations.bind(this)),
  67858. this.fpControls.addEventListener("end", this.enableAnnotations.bind(this)),
  67859. this.orbitControls = new Bw(this),
  67860. this.orbitControls.enabled = !1,
  67861. this.orbitControls.addEventListener("start", this.disableAnnotations.bind(this)),
  67862. this.orbitControls.addEventListener("end", this.enableAnnotations.bind(this)),
  67863. this.earthControls = new Lw(this),
  67864. this.earthControls.enabled = !1,
  67865. this.earthControls.addEventListener("start", this.disableAnnotations.bind(this)),
  67866. this.earthControls.addEventListener("end", this.enableAnnotations.bind(this)),
  67867. this.deviceControls = new Rw(this),
  67868. this.deviceControls.enabled = !1,
  67869. this.deviceControls.addEventListener("start", this.disableAnnotations.bind(this)),
  67870. this.deviceControls.addEventListener("end", this.enableAnnotations.bind(this))
  67871. }
  67872. }, {
  67873. key: "toggleSidebar",
  67874. value: function() {
  67875. var e = $("#potree_render_area");
  67876. "0px" !== e.css("left") ? e.css("left", "0px") : e.css("left", "300px")
  67877. }
  67878. }, {
  67879. key: "toggleMap",
  67880. value: function() {
  67881. this.mapView && this.mapView.toggle()
  67882. }
  67883. }, {
  67884. key: "onGUILoaded",
  67885. value: function(e) {
  67886. this.guiLoaded ? e() : this.guiLoadTasks.push(e)
  67887. }
  67888. }, {
  67889. key: "promiseGuiLoaded",
  67890. value: function() {
  67891. var t = this;
  67892. return new Promise(function(e) {
  67893. t.guiLoaded ? e() : t.guiLoadTasks.push(e)
  67894. }
  67895. )
  67896. }
  67897. }, {
  67898. key: "loadGUI",
  67899. value: function(e) {
  67900. var i = this;
  67901. e && this.onGUILoaded(e);
  67902. var r = $("#potree_sidebar_container");
  67903. return r.load(new URL(Potree.scriptPath + "/" + (Potree.settings.sidebar || "sidebar.html")).href, function() {
  67904. r.css("width", "300px"),
  67905. r.css("height", "100%");
  67906. var e = document.createElement("img");
  67907. e.src = new URL(Potree.resourcePath + "/icons/menu_button.svg").href,
  67908. e.onclick = i.toggleSidebar,
  67909. e.classList.add("potree_menu_toggle");
  67910. var t = document.createElement("img");
  67911. t.src = new URL(Potree.resourcePath + "/icons/map_icon.png").href,
  67912. t.style.display = "none",
  67913. t.onclick = function(e) {
  67914. i.toggleMap()
  67915. }
  67916. ,
  67917. t.id = "potree_map_toggle";
  67918. var n = $("#potree_quick_buttons").get(0);
  67919. n.append(e),
  67920. n.append(t),
  67921. i18n.init({
  67922. lng: "en",
  67923. resGetPath: Potree.resourcePath + "/lang/__lng__/__ns__.json",
  67924. preload: ["en", "fr", "de", "jp", "se", "es", "zh"],
  67925. getAsync: !0,
  67926. debug: !1
  67927. }, function(e) {
  67928. $("body").i18n()
  67929. }),
  67930. $(function() {
  67931. var e = new Ew(i);
  67932. e.init(),
  67933. i.sidebar = e;
  67934. var t = $("<div>").load(new URL(Potree.scriptPath + "/profile.html").href, function() {
  67935. $(document.body).append(t.children()),
  67936. i.profileWindow = new by(i),
  67937. i.profileWindowController = new xy(i),
  67938. $("#profile_window").draggable({
  67939. handle: $("#profile_titlebar"),
  67940. containment: $(document.body)
  67941. }),
  67942. $("#profile_window").resizable({
  67943. containment: $(document.body),
  67944. handles: "n, e, s, w"
  67945. }),
  67946. $(function() {
  67947. i.guiLoaded = !0;
  67948. var e, t = ue(i.guiLoadTasks);
  67949. try {
  67950. for (t.s(); !(e = t.n()).done; )
  67951. (0,
  67952. e.value)()
  67953. } catch (e) {
  67954. t.e(e)
  67955. } finally {
  67956. t.f()
  67957. }
  67958. })
  67959. })
  67960. })
  67961. }),
  67962. this.promiseGuiLoaded()
  67963. }
  67964. }, {
  67965. key: "setLanguage",
  67966. value: function(e) {
  67967. i18n.setLng(e),
  67968. $("body").i18n()
  67969. }
  67970. }, {
  67971. key: "setServer",
  67972. value: function(e) {
  67973. this.server = e
  67974. }
  67975. }, {
  67976. key: "initDragAndDrop",
  67977. value: function() {
  67978. var c = this;
  67979. function e(e) {
  67980. e.dataTransfer.dropEffect = "copy",
  67981. e.preventDefault()
  67982. }
  67983. var t = function() {
  67984. var t = r(regeneratorRuntime.mark(function e(t) {
  67985. var n, i, r, a, o, s, l, u;
  67986. return regeneratorRuntime.wrap(function(e) {
  67987. for (; ; )
  67988. switch (e.prev = e.next) {
  67989. case 0:
  67990. console.log(t),
  67991. t.preventDefault(),
  67992. n = ue(t.dataTransfer.items),
  67993. e.prev = 3,
  67994. n.s();
  67995. case 5:
  67996. if ((a = n.n()).done) {
  67997. e.next = 49;
  67998. break
  67999. }
  68000. if (i = a.value,
  68001. console.log(i),
  68002. "file" !== i.kind)
  68003. return e.abrupt("continue", 47);
  68004. e.next = 10;
  68005. break;
  68006. case 10:
  68007. if (r = i.getAsFile(),
  68008. a = r.name.toLowerCase().endsWith(".json"),
  68009. o = r.name.toLowerCase().endsWith(".gpkg"),
  68010. a)
  68011. return e.prev = 14,
  68012. e.next = 17,
  68013. r.text();
  68014. e.next = 28;
  68015. break;
  68016. case 17:
  68017. l = e.sent,
  68018. "Potree" === (l = JSON.parse(l)).type && Potree.loadProject(viewer, l),
  68019. e.next = 26;
  68020. break;
  68021. case 22:
  68022. e.prev = 22,
  68023. e.t0 = e.catch(14),
  68024. console.error("failed to parse the dropped file as JSON"),
  68025. console.error(e.t0);
  68026. case 26:
  68027. e.next = 47;
  68028. break;
  68029. case 28:
  68030. if (!o) {
  68031. e.next = 47;
  68032. break
  68033. }
  68034. if (0 < viewer.scene.pointclouds.length) {
  68035. e.next = 36;
  68036. break
  68037. }
  68038. console.error("At least one point cloud is needed that specifies the coordinate reference system before loading vector data."),
  68039. e.next = 47;
  68040. break;
  68041. case 36:
  68042. return proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
  68043. proj4.defs("pointcloud", c.getProjection()),
  68044. s = proj4("WGS84", "pointcloud"),
  68045. e.next = 41,
  68046. r.arrayBuffer();
  68047. case 41:
  68048. return l = e.sent,
  68049. u = {
  68050. transform: s,
  68051. source: r.name
  68052. },
  68053. e.next = 45,
  68054. Potree.GeoPackageLoader.loadBuffer(l, u);
  68055. case 45:
  68056. u = e.sent,
  68057. viewer.scene.addGeopackage(u);
  68058. case 47:
  68059. e.next = 5;
  68060. break;
  68061. case 49:
  68062. e.next = 54;
  68063. break;
  68064. case 51:
  68065. e.prev = 51,
  68066. e.t1 = e.catch(3),
  68067. n.e(e.t1);
  68068. case 54:
  68069. return e.prev = 54,
  68070. n.f(),
  68071. e.finish(54);
  68072. case 57:
  68073. case "end":
  68074. return e.stop()
  68075. }
  68076. }, e, null, [[3, 51, 54, 57], [14, 22]])
  68077. }));
  68078. return function(e) {
  68079. return t.apply(this, arguments)
  68080. }
  68081. }();
  68082. $("body")[0].addEventListener("dragenter", e),
  68083. $("body")[0].addEventListener("dragover", e),
  68084. $("body")[0].addEventListener("drop", t)
  68085. }
  68086. }, {
  68087. key: "updateAnnotations",
  68088. value: function() {
  68089. var s = this;
  68090. this.visibleAnnotations || (this.visibleAnnotations = new Set),
  68091. this.scene.annotations.updateBounds(),
  68092. this.scene.cameraP.updateMatrixWorld(),
  68093. this.scene.cameraO.updateMatrixWorld();
  68094. var l = this.renderer.getSize(new yn)
  68095. , u = this
  68096. , c = [];
  68097. this.scene.annotations.traverse(function(e) {
  68098. if (e === s.scene.annotations)
  68099. return !0;
  68100. if (!e.visible)
  68101. return !1;
  68102. e.scene = s.scene;
  68103. var t = e.domElement;
  68104. (n = e.position.clone()).add(e.offset);
  68105. var n = n || e.boundingBox.getCenter(new Cn)
  68106. , i = u.scene.cameraP.position.distanceTo(n)
  68107. , r = e.boundingBox.getBoundingSphere(new qn).radius
  68108. , a = new Cn
  68109. , o = 0;
  68110. a.copy(n).project(s.scene.getActiveCamera()),
  68111. a.x = l.x * (a.x + 1) / 2,
  68112. a.y = l.y * (1 - (a.y + 1) / 2),
  68113. o = u.scene.cameraMode == em.PERSPECTIVE ? (n = Math.PI * u.scene.cameraP.fov / 180,
  68114. n = Math.tan(n / 2),
  68115. r * (.5 * l.y / (n * i))) : Jf.projectedRadiusOrtho(r, u.scene.cameraO.projectionMatrix, l.x, l.y),
  68116. t.css("left", a.x + "px"),
  68117. t.css("top", a.y + "px");
  68118. i = 1e7 - i * (1e7 / s.scene.cameraP.far);
  68119. if (e.descriptionVisible && (i += 1e7),
  68120. t.css("z-index", parseInt(i)),
  68121. 0 < e.children.length) {
  68122. o = o > e.collapseThreshold || e.boundingBox.containsPoint(s.scene.getActiveCamera().position);
  68123. return (e.expand = o) || -1 <= a.z && a.z <= 1 && c.push(e),
  68124. o
  68125. }
  68126. -1 <= a.z && a.z <= 1 && c.push(e)
  68127. });
  68128. for (var e = new Set(this.visibleAnnotations), t = 0, n = c; t < n.length; t++) {
  68129. var i = n[t];
  68130. i.display = !0,
  68131. e.delete(i)
  68132. }
  68133. this.visibleAnnotations = c;
  68134. var r, a = ue(e);
  68135. try {
  68136. for (a.s(); !(r = a.n()).done; )
  68137. r.value.display = !1
  68138. } catch (e) {
  68139. a.e(e)
  68140. } finally {
  68141. a.f()
  68142. }
  68143. }
  68144. }, {
  68145. key: "updateMaterialDefaults",
  68146. value: function(e) {
  68147. var t = e.material
  68148. , e = e.getAttribute("intensity");
  68149. null != e && t.intensityRange[0] === 1 / 0 && (t.intensityRange = Q(e.range))
  68150. }
  68151. }, {
  68152. key: "update",
  68153. value: function(e, t) {
  68154. Potree.measureTimings && performance.mark("update-start"),
  68155. this.dispatchEvent({
  68156. type: "update_start",
  68157. delta: e,
  68158. timestamp: t
  68159. }),
  68160. this.updateScreenSize();
  68161. var n = this.scene
  68162. , i = n.getActiveCamera()
  68163. , r = this.scene.pointclouds.filter(function(e) {
  68164. return e.visible
  68165. });
  68166. Potree.pointLoadLimit = 2 * Potree.pointBudget;
  68167. var a = i.position.clone().add(i.getWorldDirection(new Cn).multiplyScalar(1e3));
  68168. this.scene.directionalLight.position.copy(i.position),
  68169. this.scene.directionalLight.lookAt(a);
  68170. var o, s = ue(r);
  68171. try {
  68172. for (s.s(); !(o = s.n()).done; ) {
  68173. var l = o.value;
  68174. l.showBoundingBox = this.showBoundingBox,
  68175. l.generateDEM = this.generateDEM,
  68176. l.minimumNodePixelSize = this.minNodeSize;
  68177. var u = l.material;
  68178. u.uniforms.uFilterReturnNumberRange.value = this.filterReturnNumberRange,
  68179. u.uniforms.uFilterNumberOfReturnsRange.value = this.filterNumberOfReturnsRange,
  68180. u.uniforms.uFilterGPSTimeClipRange.value = this.filterGPSTimeRange,
  68181. u.uniforms.uFilterPointSourceIDClipRange.value = this.filterPointSourceIDRange,
  68182. u.classification = this.classifications,
  68183. u.recomputeClassification(),
  68184. this.updateMaterialDefaults(l)
  68185. }
  68186. } catch (e) {
  68187. s.e(e)
  68188. } finally {
  68189. s.f()
  68190. }
  68191. if (this.showBoundingBox) {
  68192. var c = this.scene.scene.getObjectByName("potree_bounding_box_root");
  68193. c || ((a = new Si).name = "potree_bounding_box_root",
  68194. this.scene.scene.add(a),
  68195. c = a);
  68196. var d, h = [], p = ue(this.scene.pointclouds);
  68197. try {
  68198. for (p.s(); !(d = p.n()).done; ) {
  68199. var f, m = ue(d.value.visibleNodes.filter(function(e) {
  68200. return void 0 !== e.boundingBoxNode
  68201. }));
  68202. try {
  68203. for (m.s(); !(f = m.n()).done; ) {
  68204. var v = f.value.boundingBoxNode;
  68205. h.push(v)
  68206. }
  68207. } catch (e) {
  68208. m.e(e)
  68209. } finally {
  68210. m.f()
  68211. }
  68212. }
  68213. } catch (e) {
  68214. p.e(e)
  68215. } finally {
  68216. p.f()
  68217. }
  68218. c.children = h
  68219. }
  68220. this.freeze,
  68221. this.scene.cameraP.fov = this.fov;
  68222. c = this.getControls();
  68223. c === this.deviceControls ? (this.controls.setScene(n),
  68224. this.controls.update(e),
  68225. this.scene.cameraP.position.copy(n.view.position),
  68226. this.scene.cameraO.position.copy(n.view.position)) : null !== c && (c.setScene(n),
  68227. c.update(e),
  68228. this.viewports.forEach(function(e) {
  68229. e.active && e.view.applyToCamera(e.camera)
  68230. })),
  68231. this.cameraChanged();
  68232. var g = [];
  68233. g.push.apply(g, Q(this.scene.volumes.filter(function(e) {
  68234. return e.clip && e instanceof Zp
  68235. })));
  68236. var y, w = ue(this.scene.profiles);
  68237. try {
  68238. for (w.s(); !(y = w.n()).done; ) {
  68239. var b = y.value;
  68240. g.push.apply(g, Q(b.boxes))
  68241. }
  68242. } catch (e) {
  68243. w.e(e)
  68244. } finally {
  68245. w.f()
  68246. }
  68247. var x, E = g.filter(function(e) {
  68248. return 0 !== e.matrixWorld.determinant()
  68249. }).map(function(e) {
  68250. e.updateMatrixWorld();
  68251. var t = e.matrixWorld.clone().invert()
  68252. , n = e.getWorldPosition(new Cn);
  68253. return {
  68254. box: e,
  68255. inverse: t,
  68256. position: n
  68257. }
  68258. }), _ = this.scene.polygonClipVolumes.filter(function(e) {
  68259. return e.initialized
  68260. }), M = ue(r);
  68261. try {
  68262. for (M.s(); !(x = M.n()).done; ) {
  68263. var A = x.value;
  68264. A.material.setClipBoxes(E),
  68265. A.material.setClipPolygons(_, this.clippingTool.maxPolygonVertices),
  68266. A.material.clipTask = this.clipTask,
  68267. A.material.clipMethod = this.clipMethod
  68268. }
  68269. } catch (e) {
  68270. M.e(e)
  68271. } finally {
  68272. M.f()
  68273. }
  68274. var T, S = ue(r);
  68275. try {
  68276. for (S.s(); !(T = S.n()).done; )
  68277. T.value.material.elevationGradientRepeat = this.elevationGradientRepeat
  68278. } catch (e) {
  68279. S.e(e)
  68280. } finally {
  68281. S.f()
  68282. }
  68283. this.navigationCube.update(i.rotation),
  68284. this.updateAnnotations(),
  68285. this.mapView && (this.mapView.update(e),
  68286. this.mapView.sceneProjection && $("#potree_map_toggle").css("display", "block")),
  68287. TWEEN.update(t),
  68288. gv.update(e),
  68289. this.transformationTool.update(),
  68290. "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (this.modules.ParticleEditor.update(e),
  68291. this.mapViewer.update(e)),
  68292. this.dispatchEvent({
  68293. type: "update",
  68294. delta: e,
  68295. timestamp: t
  68296. }),
  68297. Potree.measureTimings && (performance.mark("update-end"),
  68298. performance.measure("update", "update-start", "update-end")),
  68299. this.reticule.updateVisible()
  68300. }
  68301. }, {
  68302. key: "updateViewPointcloud",
  68303. value: function(e, t, n) {
  68304. var i, r = Potree.updatePointClouds(this.scene.pointclouds, e, t), a = (performance.now(),
  68305. e.position), o = 1 / 0, s = ue(this.scene.orientedImages);
  68306. try {
  68307. for (s.s(); !(i = s.n()).done; ) {
  68308. var l, u = ue(i.value.images);
  68309. try {
  68310. for (u.s(); !(l = u.n()).done; )
  68311. var c = l.value.mesh.position.distanceTo(a)
  68312. , o = Math.min(o, c)
  68313. } catch (e) {
  68314. u.e(e)
  68315. } finally {
  68316. u.f()
  68317. }
  68318. }
  68319. } catch (e) {
  68320. s.e(e)
  68321. } finally {
  68322. s.f()
  68323. }
  68324. performance.now();
  68325. var d = e.near
  68326. , t = e.far;
  68327. e.limitFar || r.lowestSpacing === 1 / 0 || (r = -this.getBoundingBox().applyMatrix4(e.matrixWorldInverse).min.z,
  68328. r = Math.max(1.5 * r, 1e4),
  68329. r = Math.max(r, d + 1e4),
  68330. e.far = r),
  68331. t != e.far && e.updateProjectionMatrix()
  68332. }
  68333. }, {
  68334. key: "getPRenderer",
  68335. value: function() {
  68336. return this.useHQ ? (this.hqRenderer || (this.hqRenderer = new eg(this)),
  68337. this.hqRenderer.useEDL = this.useEDL,
  68338. this.hqRenderer) : (this.edlRenderer || (this.edlRenderer = new $v(this)),
  68339. this.edlRenderer)
  68340. }
  68341. }, {
  68342. key: "renderVR",
  68343. value: function() {
  68344. var e = this.renderer;
  68345. e.setClearColor(5570560, 0),
  68346. e.clear();
  68347. var t = e.xr
  68348. , n = new $r
  68349. , i = t.getCamera(n);
  68350. if (2 === i.cameras.length) {
  68351. t = this.vrControls.getCamera.bind(this.vrControls);
  68352. "skybox" === viewer.background ? e.setClearColor(16711680, 1) : "gradient" === viewer.background ? e.setClearColor(1122867, 1) : "black" === viewer.background ? e.setClearColor(0, 1) : "white" === viewer.background ? e.setClearColor(16777215, 1) : e.setClearColor(0, 0),
  68353. e.clear(),
  68354. "skybox" === this.background ? (r = this.skybox,
  68355. n = t(),
  68356. r.camera.rotation.copy(n.rotation),
  68357. r.camera.fov = n.fov,
  68358. r.camera.aspect = n.aspect,
  68359. (n = r.parent).rotation.x = Math.PI / 2,
  68360. n.updateMatrix(),
  68361. n.updateMatrixWorld(),
  68362. r.camera.updateMatrix(),
  68363. r.camera.updateMatrixWorld(),
  68364. r.camera.updateProjectionMatrix(),
  68365. e.render(r.scene, r.camera)) : this.background,
  68366. this.renderer.xr.getSession().updateRenderState({
  68367. depthNear: .1,
  68368. depthFar: 1e4
  68369. });
  68370. var r = null
  68371. , a = null;
  68372. (r = t()).position.z -= .8 * r.scale.x,
  68373. r.parent = null,
  68374. r.near = viewer.scene.getActiveCamera().near,
  68375. r.far = viewer.scene.getActiveCamera().far,
  68376. r.updateMatrix(),
  68377. r.updateMatrixWorld(),
  68378. this.scene.scene.updateMatrix(),
  68379. this.scene.scene.updateMatrixWorld(),
  68380. this.scene.scene.matrixAutoUpdate = !1;
  68381. a = r.matrixWorld.clone().clone().invert();
  68382. this.scene.scene.matrix.copy(a),
  68383. this.scene.scene.matrixWorld.copy(a),
  68384. r.matrix.identity(),
  68385. r.matrixWorld.identity(),
  68386. r.matrixWorldInverse.identity(),
  68387. e.render(this.scene.scene, r),
  68388. this.scene.scene.matrixWorld.identity();
  68389. var o, s = ue(this.scene.pointclouds);
  68390. try {
  68391. for (s.s(); !(o = s.n()).done; ) {
  68392. var l = o.value
  68393. , u = i.cameras[0].viewport;
  68394. l.material.useEDL = !1,
  68395. l.screenHeight = u.height,
  68396. l.screenWidth = u.width
  68397. }
  68398. } catch (e) {
  68399. s.e(e)
  68400. } finally {
  68401. s.f()
  68402. }
  68403. var c, d = ue(i.cameras);
  68404. try {
  68405. for (d.s(); !(c = d.n()).done; ) {
  68406. var h = c.value
  68407. , p = h.viewport;
  68408. e.setViewport(p.x, p.y, p.width, p.height);
  68409. var f = h.projectionMatrix.clone().invert()
  68410. , m = new Mn(0,1,-1,1).applyMatrix4(f).y / Math.PI * 180;
  68411. h.fov = m;
  68412. var v, g = ue(this.scene.pointclouds);
  68413. try {
  68414. for (g.s(); !(v = g.n()).done; )
  68415. v.value.material.useEDL = !1
  68416. } catch (e) {
  68417. g.e(e)
  68418. } finally {
  68419. g.f()
  68420. }
  68421. var y = a.clone().invert();
  68422. y.multiply(h.matrixWorld);
  68423. var w = y.clone().invert();
  68424. this.pRenderer.render(this.scene.scenePointCloud, h, null, {
  68425. viewOverride: w
  68426. })
  68427. }
  68428. } catch (e) {
  68429. d.e(e)
  68430. } finally {
  68431. d.f()
  68432. }
  68433. t = t();
  68434. t.parent = null,
  68435. e.render(this.sceneVR, t),
  68436. e.resetState()
  68437. }
  68438. }
  68439. }, {
  68440. key: "clear",
  68441. value: function() {
  68442. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  68443. , t = e.background || this.background
  68444. , n = (null == e.backgroundOpacity ? this : e).backgroundOpacity
  68445. , i = this.renderer;
  68446. t instanceof Yi ? i.setClearColor(t, n) : "skybox" === t || "gradient" === t ? i.setClearColor(0, 0) : "black" === t ? i.setClearColor(0, 1) : "white" === t ? i.setClearColor(16777215, 1) : i.setClearColor(t, n),
  68447. e.target || i.clear()
  68448. }
  68449. }, {
  68450. key: "renderDefault",
  68451. value: function() {
  68452. var s, e, l, u, c = this, d = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  68453. this.visible && !this.paused && (s = this.getPRenderer(),
  68454. e = d.viewports || this.viewports,
  68455. l = d.target ? new yn(d.target.width,d.target.height) : this.renderer.getSize(new yn),
  68456. u = 1 < e.filter(function(e) {
  68457. return e.active
  68458. }).length || d.resize,
  68459. e.forEach(function(e) {
  68460. var t, n, i, r, a, o = $.extend({}, d);
  68461. o.viewport = e,
  68462. o.camera = o.camera || e.camera,
  68463. o.extraEnableLayers = e.extraEnableLayers,
  68464. o.cameraLayers = e.cameraLayers,
  68465. e.active && (i = Math.ceil(l.x * e.left),
  68466. r = Math.ceil(l.y * e.bottom),
  68467. a = d.target ? (t = Math.ceil(l.x * e.width),
  68468. Math.ceil(l.y * e.height)) : (t = e.resolution.x,
  68469. e.resolution.y),
  68470. 0 != t && 0 != a && (n = e.width < 1 || e.height < 1,
  68471. d.target ? (d.target.viewport.set(i, r, t, a),
  68472. n && d.target.scissor.set(i, r, t, a),
  68473. d.target.scissorTest = n) : (c.renderer.setViewport(i, r, t, a),
  68474. n && c.renderer.setScissor(i, r, t, a),
  68475. c.renderer.setScissorTest(n)),
  68476. u && c.emitResizeMsg({
  68477. viewport: e
  68478. }),
  68479. viewer.dispatchEvent({
  68480. type: "render.begin",
  68481. viewer: viewer,
  68482. viewport: e,
  68483. params: o
  68484. }),
  68485. e.render && e.render($.extend({}, o, {
  68486. renderer: c.renderer,
  68487. clear: c.clear.bind(c),
  68488. resize: null,
  68489. renderOverlay: c.renderOverlay.bind(c),
  68490. force: !e.noPointcloud
  68491. })),
  68492. e.noPointcloud || (e.render && (o.noBG = !0),
  68493. e.beforeRender && e.beforeRender(),
  68494. c.updateViewPointcloud(o.camera, e.resolution2, !0),
  68495. o.background = e.background,
  68496. o.backgroundColor = e.backgroundColor,
  68497. o.backgroundOpacity = e.backgroundOpacity,
  68498. e.render || c.clear(o),
  68499. s.clearTargets(o),
  68500. s.render(o)),
  68501. e.render || c.renderOverlay(o),
  68502. e.afterRender && e.afterRender(),
  68503. c.dispatchEvent({
  68504. type: "render.end",
  68505. viewer: c,
  68506. viewport: e
  68507. })))
  68508. }),
  68509. this.renderer.setRenderTarget(null))
  68510. }
  68511. }, {
  68512. key: "renderOverlay",
  68513. value: function(e) {
  68514. var t, n = e.camera || this.scene.getActiveCamera();
  68515. this.reticule.updateAtViewports(e.viewport),
  68516. (t = e.cameraLayers || (e.isMap ? ["bothMapAndScene"] : ["sceneObjects", "model", "bothMapAndScene"])).length && (this.setCameraLayers(n, t, e.extraEnableLayers),
  68517. this.renderer.render(this.scene.scene, n)),
  68518. this.dispatchEvent({
  68519. type: "render.pass.scene",
  68520. viewer: viewer
  68521. }),
  68522. this.renderer.clearDepth(),
  68523. e.magnifier || (this.dispatchEvent({
  68524. type: "render.pass.perspective_overlay",
  68525. camera: n,
  68526. screenshot: e.screenshot
  68527. }),
  68528. e.screenshot || e.isMap || (this.setCameraLayers(n, ["magnifier"]),
  68529. this.renderer.render(this.scene.scene, n))),
  68530. e.isMap || (this.setCameraLayers(n, ["volume", "transformationTool"]),
  68531. this.renderer.render(this.clippingTool.sceneVolume, n),
  68532. this.renderer.render(this.transformationTool.scene, n))
  68533. }
  68534. }, {
  68535. key: "setLimitFar",
  68536. value: function(e) {
  68537. viewer.mainViewport.camera.limitFar = !!e,
  68538. e && (viewer.mainViewport.camera.near = .02,
  68539. viewer.mainViewport.camera.far = "showPanos" == Potree.settings.displayMode ? viewer.farWhenShowPano : Potree.settings.cameraFar,
  68540. viewer.mainViewport.camera.updateProjectionMatrix())
  68541. }
  68542. }, {
  68543. key: "setCameraLayers",
  68544. value: function(t, e) {
  68545. var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : [];
  68546. t.layers.disableAll(),
  68547. e.concat(n).forEach(function(e) {
  68548. e = Potree.config.renderLayers[e];
  68549. null != e ? t.layers.enable(e) : console.error("setCameraLayer没找到layer!")
  68550. })
  68551. }
  68552. }, {
  68553. key: "setObjectLayers",
  68554. value: function(e, t) {
  68555. var n = Potree.config.renderLayers[t];
  68556. null != n ? e.traverse(function(e) {
  68557. e.layers.set(n)
  68558. }) : console.error("setCameraLayer没找到layer!")
  68559. }
  68560. }, {
  68561. key: "updateVisible",
  68562. value: function(t, n, e) {
  68563. var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0
  68564. , r = 4 < arguments.length ? arguments[4] : void 0;
  68565. t.unvisibleReasons || (t.unvisibleReasons = []),
  68566. t.visibleReasons || (t.visibleReasons = []);
  68567. var a;
  68568. e ? (-1 < (a = t.unvisibleReasons.findIndex(function(e) {
  68569. return e.reason == n
  68570. })) && (r = "cancel",
  68571. t.unvisibleReasons.splice(a, 1)),
  68572. "add" == r && (t.visibleReasons.some(function(e) {
  68573. return e.reason == n
  68574. }) || t.visibleReasons.push({
  68575. reason: n,
  68576. level: i
  68577. }))) : (-1 < (a = t.visibleReasons.findIndex(function(e) {
  68578. return e.reason == n
  68579. })) && (r = "cancel",
  68580. t.visibleReasons.splice(a, 1)),
  68581. "cancel" != r && (t.unvisibleReasons.some(function(e) {
  68582. return e.reason == n
  68583. }) || t.unvisibleReasons.push({
  68584. reason: n,
  68585. level: i
  68586. }))),
  68587. function() {
  68588. t.unvisibleReasons = t.unvisibleReasons.sort(function(e, t) {
  68589. return t.level - e.level
  68590. }),
  68591. t.visibleReasons = t.visibleReasons.sort(function(e, t) {
  68592. return t.level - e.level
  68593. });
  68594. var e = t.visibleReasons[0] ? t.visibleReasons[0].level : -1
  68595. , e = (t.unvisibleReasons[0] ? t.unvisibleReasons[0].level : -1) <= e;
  68596. t.visible != e && (t.visible = e,
  68597. t.dispatchEvent({
  68598. type: "isVisible",
  68599. visible: e,
  68600. reason: n
  68601. }))
  68602. }()
  68603. }
  68604. }, {
  68605. key: "getObjVisiByReason",
  68606. value: function(e, t) {
  68607. return !!e.visible || (!e.unvisibleReasons || !e.unvisibleReasons.some(function(e) {
  68608. return e.reason == t
  68609. }))
  68610. }
  68611. }, {
  68612. key: "render",
  68613. value: function() {
  68614. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  68615. Potree.measureTimings && performance.mark("render-start"),
  68616. this.outlinePass.selectedObjects.length && !e.screenshot ? this.composer.render(this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud), null, this.viewports, this.renderDefault.bind(this)) : this.renderDefault(e),
  68617. Potree.measureTimings && (performance.mark("render-end"),
  68618. performance.measure("render", "render-start", "render-end"))
  68619. }
  68620. }, {
  68621. key: "startScreenshot",
  68622. value: function() {
  68623. var n = this
  68624. , i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  68625. , r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 800
  68626. , a = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 400
  68627. , o = 3 < arguments.length ? arguments[3] : void 0
  68628. , s = i.deferred || $.Deferred()
  68629. , l = i.map ? this.mapViewer : this
  68630. , u = "measure" == i.type || i.map;
  68631. if (this.images360.flying)
  68632. return i.deferred = s,
  68633. this.images360.addEventListener("cameraMoveDone", function e() {
  68634. n.startScreenshot(i, r, a, o),
  68635. n.images360.removeEventListener("cameraMoveDone", e)
  68636. }),
  68637. s.promise();
  68638. var c = Date.now();
  68639. console.log("startScreenshot: " + c);
  68640. var d, e, h = function() {
  68641. n.viewports.forEach(function(e) {
  68642. e.view.applyToCamera(e.camera),
  68643. n.dispatchEvent({
  68644. type: "camera_changed",
  68645. camera: e.camera,
  68646. viewport: e,
  68647. changeInfo: {
  68648. positionChanged: !0,
  68649. changed: !0
  68650. }
  68651. })
  68652. })
  68653. }, t = function() {
  68654. u && (viewer.mapViewer.needRender = !0);
  68655. var e = l.makeScreenshot(new yn(r,a), null, o).dataUrl;
  68656. Potree.settings.isOfficial || Fm.downloadFile(e, "screenshot.jpg");
  68657. function t() {
  68658. m.viewports.forEach(function(t) {
  68659. var e = f.find(function(e) {
  68660. return e.name == t.name
  68661. });
  68662. e.left = t.left,
  68663. e.width = t.width,
  68664. e.view.copy(t.view),
  68665. e.view.applyToCamera(e.camera)
  68666. }),
  68667. viewer.updateScreenSize({
  68668. forceUpdateSize: !0
  68669. }),
  68670. h(),
  68671. s.resolve(e),
  68672. console.log("screenshot done: " + c)
  68673. }
  68674. "measure" == i.type && (n.scene.measurements.forEach(function(e) {
  68675. return n.updateVisible(e, "screenshot", !0)
  68676. }),
  68677. i.measurement.setSelected(!1, "screenshot")),
  68678. n.images360.panos.forEach(function(e) {
  68679. viewer.updateVisible(e, "screenshot", !0)
  68680. }),
  68681. viewer.updateVisible(n.reticule, "screenshot", !0),
  68682. u && (viewer.updateVisible(n.mapViewer.cursor, "screenshot", !0),
  68683. m.attachedToViewer != n.mapViewer.attachedToViewer && "measure" == i.type && n.mapViewer.attachToMainViewer(!1),
  68684. d.camera.zoom = m.mapZoom,
  68685. d.camera.updateProjectionMatrix()),
  68686. "showPanos" == Potree.settings.displayMode ? viewer.images360.flyToPano({
  68687. pano: m.pano,
  68688. duration: 0,
  68689. callback: function() {
  68690. t()
  68691. }
  68692. }) : t()
  68693. }, p = this.mainViewport, f = [p], m = {
  68694. viewports: [p.clone()],
  68695. pano: "showPanos" == Potree.settings.displayMode ? viewer.images360.currentPano : null
  68696. };
  68697. return u && (d = this.mapViewer.viewports[0],
  68698. f.push(d),
  68699. m.viewports.push(d.clone()),
  68700. m.attachedToViewer = this.mapViewer.attachedToViewer,
  68701. m.mapZoom = d.camera.zoom,
  68702. viewer.updateVisible(this.mapViewer.cursor, "screenshot", !1)),
  68703. i.hideMarkers && this.images360.panos.forEach(function(e) {
  68704. viewer.updateVisible(e, "screenshot", !1)
  68705. }),
  68706. viewer.updateVisible(this.reticule, "screenshot", !1),
  68707. "measure" == i.type ? (this.scene.measurements.forEach(function(e) {
  68708. return n.updateVisible(e, "screenshot", e == i.measurement)
  68709. }),
  68710. i.measurement.setSelected(!0, "screenshot"),
  68711. Potree.settings.floorplanEnable && this.mapViewer.attachToMainViewer(!0, "measure", .5),
  68712. viewer.updateScreenSize({
  68713. forceUpdateSize: !0,
  68714. width: r,
  68715. height: a
  68716. }),
  68717. e = function() {
  68718. u = n.mapViewer.attachedToViewer,
  68719. h();
  68720. var e = "showPointCloud" == Potree.settings.displayMode ? 500 : 0;
  68721. u ? setTimeout(function() {
  68722. n.mapViewer.waitLoadDone(t.bind(n))
  68723. }
  68724. .bind(n), e) : setTimeout(t.bind(n), e)
  68725. }
  68726. ,
  68727. this.focusOnObject(i.measurement, "measure", 0, {
  68728. basePanoSize: 1024
  68729. }).promise.done(function() {
  68730. n.updateDatasetAt(!0),
  68731. n.modules.SiteModel.updateEntityAt(!0),
  68732. !n.mapViewer.mapLayer.maps.some(function(e) {
  68733. return e.name.includes("floorplan") && e.objectGroup.visible
  68734. }) && n.mapViewer.attachedToViewer ? (n.mapViewer.attachToMainViewer(!1),
  68735. viewer.updateScreenSize({
  68736. forceUpdateSize: !0,
  68737. width: r,
  68738. height: a
  68739. }),
  68740. n.focusOnObject(i.measurement, "measure", 0, {
  68741. basePanoSize: 1024
  68742. }).promise.done(function() {
  68743. e()
  68744. })) : e()
  68745. })) : t(),
  68746. s.promise()
  68747. }
  68748. }, {
  68749. key: "focusOnObject",
  68750. value: function(u, t, n) {
  68751. var c = this
  68752. , s = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {}
  68753. , i = s.deferred || $.Deferred()
  68754. , d = new Cn
  68755. , h = new Cn;
  68756. n = null == n ? 1e3 : n;
  68757. function e(e, t, n, i) {
  68758. var r = g.clone();
  68759. r.position.copy(i),
  68760. r.lookAt(n),
  68761. r.updateMatrix(),
  68762. r.updateMatrixWorld();
  68763. var a = r.matrixWorldInverse
  68764. , o = new kn;
  68765. e ? e.forEach(function(e) {
  68766. e = e.clone().applyMatrix4(a);
  68767. o.expandByPoint(e)
  68768. }) : o = t.applyMatrix4(a),
  68769. e = o.getSize(new Cn),
  68770. c.boundBox || (c.boundBox = new Hr(new Cl(1,1,1,1)),
  68771. c.boundBox.material.wireframe = !0,
  68772. c.boundBox.up.set(0, 0, 1),
  68773. viewer.updateVisible(c.boundBox, "hidden", !1),
  68774. c.setObjectLayers(c.boundBox, "sceneObjects"),
  68775. c.scene.scene.add(c.boundBox)),
  68776. c.boundBox.position.copy(n),
  68777. c.boundBox.scale.copy(e),
  68778. c.boundBox.lookAt(i),
  68779. e.x *= 1.1,
  68780. e.y *= 1.1;
  68781. var t = e.x / e.y;
  68782. return E = g.aspect > t ? e.y / 2 / Math.tan(gn.degToRad(g.fov / 2)) + e.z / 2 : (t = Rg.getHFOVForCamera(g, !0),
  68783. e.x / 2 / Math.tan(t / 2) + e.z / 2),
  68784. E = Math.max(.1, E),
  68785. i = (new Cn).subVectors(i, n).normalize(),
  68786. s.dontLookUp && i.z < 0 && i.negate(),
  68787. h.copy(n).add(i.multiplyScalar(E)),
  68788. h
  68789. }
  68790. var r, a, o, l, p, f, m, v, g = viewer.scene.getActiveCamera(), y = g.position.clone();
  68791. if (this.images360.flying)
  68792. return this.images360.addEventListener("cameraMoveDone", function e() {
  68793. c.focusOnObject(u, t, n, $.extend(s, {
  68794. deferred: i
  68795. })),
  68796. c.images360.removeEventListener("cameraMoveDone", e)
  68797. }),
  68798. {
  68799. promise: i.promise()
  68800. };
  68801. if ("measure" == t) {
  68802. if (d.copy(u.getCenter()),
  68803. u.facePlane ? (u.facePlane && (l = u.facePlane.normal.clone()),
  68804. r = this.scene.view.direction.angleTo(l),
  68805. (a = gn.degToRad(60)) < r && r < Math.PI - a && (r < Math.PI / 2 && l.negate(),
  68806. o = (new Cn).subVectors(g.position, d).normalize(),
  68807. p = (new Cn).addVectors(o, l),
  68808. y.copy(d.clone().add(p)))) : 2 == u.points.length ? (o = (new Cn).subVectors(u.points[0], u.points[1]).normalize(),
  68809. ((l = this.scene.view.direction.angleTo(o)) < (p = .25 * Math.PI) || l > Math.PI - p) && (l > Math.PI / 2 && o.negate(),
  68810. v = (new Cn).subVectors(g.position, d).normalize(),
  68811. f = (new Cn).addVectors(o, v).normalize(),
  68812. v = (new Cn).addVectors(v, f),
  68813. y.copy(d.clone().add(v)))) : console.error("measure 没有facePlane points点数还不为2?"),
  68814. h = e(u.points, null, d, y),
  68815. this.mapViewer && (f = new yn(4,4),
  68816. m = new kn,
  68817. u.points.forEach(function(e) {
  68818. m.expandByPoint(e)
  68819. }),
  68820. (v = m.getSize(new Cn).clone().multiplyScalar(2)).x = Math.max(f.x, v.x),
  68821. v.y = Math.max(f.y, v.y),
  68822. this.mapViewer.moveTo(d.clone(), v, n)),
  68823. "showPointCloud" == Potree.settings.displayMode) {
  68824. var w = .3;
  68825. !function() {
  68826. var t = c.inputHandler.ifBlockedByIntersect(h, null, !0, d);
  68827. if (t) {
  68828. for (var e, n = 0, i = 0, r = 0; r < u.points.length; r++) {
  68829. var a = u.points[r];
  68830. if (c.inputHandler.ifBlockedByIntersect(a, .3, !0, h, 4)) {
  68831. if (.5 <= ++n / u.points.length) {
  68832. e = !1;
  68833. break
  68834. }
  68835. } else if (.5 < ++i / u.points.length) {
  68836. e = !0;
  68837. break
  68838. }
  68839. }
  68840. var o, s, l = function() {
  68841. var e = (new Cn).subVectors(h, d).normalize().multiplyScalar(t.distance);
  68842. h.copy(d).add(e),
  68843. console.log("checkIntersect newPos", h.clone())
  68844. };
  68845. (e = null == e ? .5 < i / u.points.length : e) || (t.distance < w ? (console.log("检测到intersect 反向", t.distance),
  68846. o = h.clone(),
  68847. s = (new Cn).subVectors(h, d),
  68848. h.copy(d).sub(s),
  68849. (s = c.inputHandler.ifBlockedByIntersect(h, null, !0, d)) && (s.distance < t.distance && h.copy(o),
  68850. l())) : l())
  68851. }
  68852. }()
  68853. } else if ("showPanos" == Potree.settings.displayMode) {
  68854. var b = viewer.images360.fitPanoTowardPoint({
  68855. target: d,
  68856. point: h,
  68857. bestDistance: 0,
  68858. checkIntersect: s.checkIntersect
  68859. });
  68860. if (b && viewer.images360.flyToPano({
  68861. pano: b,
  68862. target: d,
  68863. duration: n,
  68864. deferred: i,
  68865. dontMoveMap: !0,
  68866. basePanoSize: s.basePanoSize
  68867. }),
  68868. viewer.images360.currentPano != b)
  68869. return {
  68870. promise: i.promise()
  68871. };
  68872. var x = viewer.images360.currentPano.position.distanceTo(d)
  68873. , b = h.distanceTo(d);
  68874. return console.log("dis1 / dis2", x / b, "dis1-dis2", x - b),
  68875. {
  68876. mag: 1.5 < x / b && 10 < x - b ? "tooFar" : "posNoChange",
  68877. promise: i.promise()
  68878. }
  68879. }
  68880. } else if ("tag" == t || "point" == t) {
  68881. d.copy(u.position);
  68882. var E, x = s.distance || 3;
  68883. if (!s.dontMoveMap && this.mapViewer && this.mapViewer.moveTo(d.clone(), null, n),
  68884. "showPointCloud" == Potree.settings.displayMode)
  68885. s.dontChangePos ? h.copy(y) : (E = x,
  68886. b = (s.direction ? s.direction.clone() : this.mainViewport.view.direction).negate(),
  68887. s.dontLookUp && b.z < 0 && (b.z *= -1),
  68888. h.copy(d).add(b.multiplyScalar(E)));
  68889. else if ("showPanos" == Potree.settings.displayMode) {
  68890. x = viewer.images360.fitPanoTowardPoint({
  68891. point: d,
  68892. bestDistance: x
  68893. });
  68894. return x && viewer.images360.flyToPano({
  68895. pano: x,
  68896. target: d,
  68897. duration: n,
  68898. deferred: i,
  68899. dontMoveMap: !0,
  68900. basePanoSize: s.basePanoSize
  68901. }),
  68902. {
  68903. promise: i.promise()
  68904. }
  68905. }
  68906. } else if (u.boundingBox && "boundingBox" == t && (d = u.boundingBox.getCenter(new Cn),
  68907. h = e(u.points, u.boundingBox, d, y),
  68908. "showPanos" == Potree.settings.displayMode)) {
  68909. y = viewer.images360.fitPanoTowardPoint({
  68910. point: h,
  68911. bestDistance: 0
  68912. });
  68913. return y && viewer.images360.flyToPano({
  68914. pano: y,
  68915. target: d,
  68916. duration: n,
  68917. deferred: i,
  68918. dontMoveMap: !0,
  68919. basePanoSize: s.basePanoSize
  68920. }),
  68921. y || console.error("no pano"),
  68922. {
  68923. promise: i.promise()
  68924. }
  68925. }
  68926. return viewer.scene.view.setView({
  68927. position: h,
  68928. target: d,
  68929. duration: n,
  68930. callback: function() {
  68931. i.resolve()
  68932. }
  68933. }),
  68934. {
  68935. promise: i.promise()
  68936. }
  68937. }
  68938. }, {
  68939. key: "flyToDataset",
  68940. value: function() {
  68941. function e() {
  68942. var e = [ly.scoreFunctions.distanceSquared({
  68943. position: o
  68944. })];
  68945. if ((e = Fm.sortByScore(r.panos, [], e)) && e.length)
  68946. return e[0].item
  68947. }
  68948. var t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = i instanceof Si ? i : i.pointcloud || this.scene.pointclouds.find(function(e) {
  68949. return e.dataset_id == i.id
  68950. }), a = null == i.duration ? 1e3 : i.duration, o = r.bound.getCenter(new Cn);
  68951. if ("showPanos" == Potree.settings.displayMode) {
  68952. var s = e();
  68953. if (!s)
  68954. return !1;
  68955. if (s == this.images360.currentPano)
  68956. return "posNoChange";
  68957. this.images360.flyToPano({
  68958. pano: s
  68959. })
  68960. } else if (n = o,
  68961. r.panosBound && (n = r.panosBound.center.clone(),
  68962. (s = e()) && (t = s.position,
  68963. n.z = t.z)),
  68964. this.modules.Clip.editing)
  68965. n.z = o.z,
  68966. this.modules.Clip.bus.dispatchEvent({
  68967. type: "flyToPos",
  68968. position: n
  68969. });
  68970. else {
  68971. if (Up.closeTo(n, this.images360.position))
  68972. return "posNoChange";
  68973. viewer.scene.view.setView({
  68974. position: n,
  68975. target: t,
  68976. duration: a
  68977. }),
  68978. i.dontMoveMap || viewer.mapViewer.moveTo(n.clone(), null, a)
  68979. }
  68980. return !0
  68981. }
  68982. }, {
  68983. key: "resolveTimings",
  68984. value: function(e) {
  68985. if (Potree.measureTimings && (this.toggle || (this.toggle = e),
  68986. 1e3 < e - this.toggle)) {
  68987. var t, n = performance.getEntriesByType("measure"), i = new Set, r = ue(n);
  68988. try {
  68989. for (r.s(); !(t = r.n()).done; ) {
  68990. var a = t.value;
  68991. i.add(a.name)
  68992. }
  68993. } catch (e) {
  68994. r.e(e)
  68995. } finally {
  68996. r.f()
  68997. }
  68998. var o, s = new Map, l = ue(i);
  68999. try {
  69000. for (l.s(); !(o = l.n()).done; ) {
  69001. var u = o.value;
  69002. s.set(u, {
  69003. measures: [],
  69004. sum: 0,
  69005. n: 0,
  69006. min: 1 / 0,
  69007. max: -1 / 0
  69008. })
  69009. }
  69010. } catch (e) {
  69011. l.e(e)
  69012. } finally {
  69013. l.f()
  69014. }
  69015. var c, d = ue(n);
  69016. try {
  69017. for (d.s(); !(c = d.n()).done; ) {
  69018. var h = c.value
  69019. , p = s.get(h.name);
  69020. p.measures.push(h),
  69021. p.sum += h.duration,
  69022. p.n++,
  69023. p.min = Math.min(p.min, h.duration),
  69024. p.max = Math.max(p.max, h.duration)
  69025. }
  69026. } catch (e) {
  69027. d.e(e)
  69028. } finally {
  69029. d.f()
  69030. }
  69031. var f, m = ue(Potree.resolveQueries(this.renderer.getContext()));
  69032. try {
  69033. for (m.s(); !(f = m.n()).done; ) {
  69034. var v = N(f.value, 2)
  69035. , g = v[0]
  69036. , y = v[1]
  69037. , w = {
  69038. measures: y.map(function(e) {
  69039. return {
  69040. duration: e
  69041. }
  69042. }),
  69043. sum: y.reduce(function(e, t) {
  69044. return e + t
  69045. }, 0),
  69046. n: y.length,
  69047. min: Math.min.apply(Math, Q(y)),
  69048. max: Math.max.apply(Math, Q(y))
  69049. }
  69050. , b = "[tq] ".concat(g);
  69051. s.set(b, w),
  69052. i.add(b)
  69053. }
  69054. } catch (e) {
  69055. m.e(e)
  69056. } finally {
  69057. m.f()
  69058. }
  69059. var x, E = ue(s);
  69060. try {
  69061. for (E.s(); !(x = E.n()).done; ) {
  69062. var _ = N(x.value, 2)
  69063. , M = (_[0],
  69064. _[1]);
  69065. M.mean = M.sum / M.n,
  69066. M.measures.sort(function(e, t) {
  69067. return e.duration - t.duration
  69068. }),
  69069. 1 === M.n ? M.median = M.measures[0].duration : 1 < M.n && (M.median = M.measures[parseInt(M.n / 2)].duration)
  69070. }
  69071. } catch (e) {
  69072. E.e(e)
  69073. } finally {
  69074. E.f()
  69075. }
  69076. var A = Array.from(i).reduce(function(e, t) {
  69077. return Math.max(e, t.length)
  69078. }, 0) + 5
  69079. , T = " ".concat("NAME".padEnd(A), " |") + " ".concat("MIN".padStart(10), " |") + " ".concat("MEDIAN".padStart(10), " |") + " ".concat("MAX".padStart(10), " |") + " ".concat("SAMPLES".padStart(6), " \n");
  69080. T += " ".concat("-".repeat(T.length), "\n");
  69081. var S, C = ue(i = Array.from(i).sort());
  69082. try {
  69083. for (C.s(); !(S = C.n()).done; ) {
  69084. var P = S.value
  69085. , D = s.get(P)
  69086. , k = D.min.toFixed(3)
  69087. , B = D.median.toFixed(3)
  69088. , L = D.max.toFixed(3)
  69089. , R = D.n;
  69090. T += " ".concat(P.padEnd(A), " |") + " ".concat(k.padStart(10), " |") + " ".concat(B.padStart(10), " |") + " ".concat(L.padStart(10), " |") + " ".concat(R.toString().padStart(6), "\n")
  69091. }
  69092. } catch (e) {
  69093. C.e(e)
  69094. } finally {
  69095. C.f()
  69096. }
  69097. T += "\n",
  69098. console.log(T),
  69099. performance.clearMarks(),
  69100. performance.clearMeasures(),
  69101. this.toggle = e
  69102. }
  69103. }
  69104. }, {
  69105. key: "loop",
  69106. value: function(e) {
  69107. this.stats && this.stats.begin(),
  69108. Potree.measureTimings && performance.mark("loop-start"),
  69109. this.update(this.clock.getDelta(), e),
  69110. this.magnifier.render(),
  69111. this.render(),
  69112. Potree.measureTimings && (performance.mark("loop-end"),
  69113. performance.measure("loop", "loop-start", "loop-end")),
  69114. this.resolveTimings(e),
  69115. Potree.framenumber++,
  69116. this.stats && this.stats.end()
  69117. }
  69118. }, {
  69119. key: "postError",
  69120. value: function(e) {
  69121. e = this.postMessage(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {});
  69122. return e.element.addClass("potree_message_error"),
  69123. e
  69124. }
  69125. }, {
  69126. key: "postMessage",
  69127. value: function(e) {
  69128. var t = this
  69129. , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}
  69130. , i = new Xv(e);
  69131. return i.element.css("display", "none"),
  69132. i.elClose.click(function() {
  69133. i.element.slideToggle(100);
  69134. var e = t.messages.indexOf(i);
  69135. 0 <= e && t.messages.splice(e, 1)
  69136. }),
  69137. this.elMessages.prepend(i.element),
  69138. i.element.slideToggle(100),
  69139. this.messages.push(i),
  69140. void 0 !== n.duration && setTimeout(function() {
  69141. i.element.animate({
  69142. opacity: 0
  69143. }, 500),
  69144. i.element.slideToggle(200)
  69145. }, n.duration),
  69146. i
  69147. }
  69148. }, {
  69149. key: "getBoundingBox",
  69150. value: function(e) {
  69151. return this.bound || this.updateModelBound(),
  69152. this.bound.boundingBox.clone()
  69153. }
  69154. }, {
  69155. key: "updateModelBound",
  69156. value: function() {
  69157. var t = this;
  69158. this.bound = Jf.computePointcloudsBound(this.scene.pointclouds),
  69159. Potree.settings.boundAddObjs && (this.objs.children.forEach(function(e) {
  69160. t.bound.boundingBox.union(e.boundingBox.clone().applyMatrix4(e.matrixWorld))
  69161. }),
  69162. this.bound.boundingBox.getSize(this.bound.boundSize),
  69163. this.bound.boundingBox.getCenter(this.bound.center)),
  69164. viewer.farWhenShowPano = 10 * this.bound.boundSize.length();
  69165. var e = new kn;
  69166. e.expandByPoint(this.bound.boundingBox.min.clone()),
  69167. e.expandByPoint(this.bound.boundingBox.max.clone().setZ(this.bound.center.z)),
  69168. Fg.boundPlane = e,
  69169. Fg.standardSpeed = gn.clamp(Math.sqrt(this.bound.boundSize.length()) / 100, .02, .5),
  69170. viewer.scene.pointclouds.forEach(function(e) {
  69171. e.material.heightMin = t.bound.boundingBox.min.z,
  69172. e.material.heightMax = t.bound.boundingBox.max.z
  69173. }),
  69174. this.dispatchEvent({
  69175. type: "updateModelBound"
  69176. })
  69177. }
  69178. }, {
  69179. key: "waitForLoad",
  69180. value: function(e, t) {
  69181. this.waitQueue.push({
  69182. object: e,
  69183. isLoadedCallback: t
  69184. }),
  69185. 1 === this.waitQueue.length && this.dispatchEvent({
  69186. type: "loading",
  69187. show: !0
  69188. })
  69189. }
  69190. }, {
  69191. key: "ifAllLoaded",
  69192. value: function(e) {
  69193. 0 < this.waitQueue.length && (this.waitQueue = this.waitQueue.filter(function(e) {
  69194. return !e.isLoadedCallback()
  69195. })),
  69196. 0 === this.waitQueue.length && this.dispatchEvent({
  69197. type: "loading",
  69198. show: !1
  69199. })
  69200. }
  69201. }, {
  69202. key: "setView",
  69203. value: function() {
  69204. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  69205. null != e.pano ? this.images360.flyToPano(e) : this.scene.view.setView($.extend({}, e, {
  69206. callback: function() {
  69207. e.displayMode && (Potree.settings.displayMode = e.displayMode),
  69208. e.callback && e.callback()
  69209. }
  69210. }))
  69211. }
  69212. }, {
  69213. key: "setPointStandardMat",
  69214. value: function(e, t, n) {
  69215. var i = this;
  69216. if (console.log("setPointStandardMat", e),
  69217. e) {
  69218. if (this.pointStatesBefore)
  69219. return console.error("已设置过pointStatesBefore!");
  69220. this.pointStatesBefore = {
  69221. opacity: new Map,
  69222. size: new Map,
  69223. density: Potree.settings.pointDensity,
  69224. useEDL: this.getEDLEnabled(),
  69225. shape: viewer.scene.pointclouds[0].material.shape
  69226. },
  69227. viewer.scene.pointclouds.forEach(function(e) {
  69228. i.pointStatesBefore.opacity.set(e, e.temp.pointOpacity),
  69229. i.pointStatesBefore.colorType = e.material.activeAttributeName,
  69230. n && i.pointStatesBefore.size.set(e, e.temp.pointSize)
  69231. }),
  69232. t && (Potree.settings.pointDensity = t),
  69233. n && (Potree.settings.sizeFitToLevel = !0),
  69234. viewer.scene.pointclouds.forEach(function(e) {
  69235. e.material.activeAttributeName = "rgba",
  69236. e.material.shape = Potree.PointShape.SQUARE,
  69237. n && e.changePointSize(Potree.config.material.realPointSize, !0),
  69238. e.changePointOpacity(1)
  69239. }),
  69240. viewer.setEDLEnabled(!1)
  69241. } else {
  69242. if (!this.pointStatesBefore)
  69243. return console.error("未设置过pointStatesBefore!");
  69244. Potree.settings.sizeFitToLevel = !1,
  69245. t && (Potree.settings.pointDensity = this.pointStatesBefore.pointDensity),
  69246. viewer.scene.pointclouds.forEach(function(e) {
  69247. e.material.activeAttributeName = i.pointStatesBefore.colorType,
  69248. e.changePointOpacity(i.pointStatesBefore.opacity.get(e)),
  69249. e.material.shape = i.pointStatesBefore.shape;
  69250. var t = i.pointStatesBefore.size.get(e);
  69251. t && e.changePointSize(t)
  69252. }),
  69253. viewer.setEDLEnabled(this.pointStatesBefore.useEDL),
  69254. this.pointStatesBefore = null
  69255. }
  69256. }
  69257. }, {
  69258. key: "transformObject",
  69259. value: function(e) {
  69260. var t = viewer.inputHandler.selection[0];
  69261. if (e) {
  69262. if (t && t != e)
  69263. return this.transformObject(null);
  69264. e.boundingBox || (e.boundingBox = new kn),
  69265. viewer.inputHandler.selection.includes(e) || viewer.inputHandler.toggleSelection(e)
  69266. } else
  69267. t && viewer.inputHandler.toggleSelection(t)
  69268. }
  69269. }, {
  69270. key: "pointInWhichPointcloud",
  69271. value: function(n) {
  69272. var e = Fm.sortByScore(this.scene.pointclouds, [], [function(e) {
  69273. var t = e.pcoGeometry.tightBoundingBox.getSize(new Cn)
  69274. , e = e.bound.getCenter(new Cn);
  69275. return t.length() / 2 / n.distanceTo(e)
  69276. }
  69277. ]);
  69278. return 1 < (e && e[0]).score ? e[0].item : null
  69279. }
  69280. }, {
  69281. key: "loadModel",
  69282. value: function(r, a, t, e) {
  69283. var o = this
  69284. , s = new kn;
  69285. Potree.settings.boundAddObjs || (s.min.set(-.5, -.5, -.5),
  69286. s.max.set(.5, .5, .5));
  69287. function n(n, e, t) {
  69288. function i(e) {
  69289. var t = r.transform[e];
  69290. t && (t instanceof Array ? n[e].fromArray(t) : n[e].copy(t))
  69291. }
  69292. n.updateMatrixWorld(),
  69293. e = Math.round(e / 1024 / 1024 * 100) / 100,
  69294. null != r.id && (n.dataset_id = r.id),
  69295. console.log(t.split("/").pop(), "加载完毕, 模型数据量:" + e + "M"),
  69296. o.setObjectLayers(n, "model"),
  69297. n.traverse(function(e) {
  69298. var t;
  69299. e instanceof Hr && (e.renderOrder = 10,
  69300. Potree.settings.boundAddObjs && (e.geometry.computeBoundingBox(),
  69301. s.union(e.geometry.boundingBox.clone().applyMatrix4(e.matrixWorld))),
  69302. Fm.makeTexDontResize(e.material.map),
  69303. !r.unlit || e.material instanceof $i && "glb" != l || (t = new fx({
  69304. map: e.material.map
  69305. }),
  69306. e.material = t),
  69307. e.material instanceof Hu && (e.material.roughness = .6,
  69308. e.material.metalness = .3))
  69309. }),
  69310. n.name = null != r.name ? r.name : "obj",
  69311. o.objs.add(n),
  69312. n.boundingBox = s,
  69313. i("position"),
  69314. i("rotation"),
  69315. i("scale"),
  69316. r.moveWithPointcloud && (n.updateMatrix(),
  69317. n.matrixAutoUpdate = !1,
  69318. n.matrix.premultiply(viewer.scene.pointclouds[0].transformMatrix),
  69319. n.matrixWorldNeedsUpdate = !0),
  69320. a && a(n)
  69321. }
  69322. function i(e) {
  69323. e.lengthComputable && (e = e.loaded / e.total * 100,
  69324. t && t(e))
  69325. }
  69326. var l = r.objurl ? "obj" : "glb";
  69327. "obj" == l ? vx.mtlLoader.load(r.mtlurl, function(e) {
  69328. e.preload(),
  69329. vx.objLoader.setMaterials(e).load(r.objurl, function(e, t) {
  69330. n(e, t, r.objurl)
  69331. })
  69332. }, i, e) : "glb" == l && (vx.glbLoader.unlitMat = !0,
  69333. vx.glbLoader.load(r.glburl, function(e, t) {
  69334. n(e.scene, t, r.glburl)
  69335. }, i, e))
  69336. }
  69337. }, {
  69338. key: "removeObj",
  69339. value: function(e) {
  69340. this.objs.remove(e),
  69341. Potree.settings.boundAddObjs && this.updateModelBound()
  69342. }
  69343. }, {
  69344. key: "loadGLTF",
  69345. value: function() {
  69346. var t = this
  69347. , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "87b3a367bc3e4273832cb4fa398782e5.glb";
  69348. new Qw(void 0,this.renderer).setPath(Potree.resourcePath + "/models/glb/").load(e, function(e) {
  69349. console.log("loadGLTF", e),
  69350. t.objs.add(e.scene)
  69351. })
  69352. }
  69353. }, {
  69354. key: "addFire",
  69355. value: function() {
  69356. var e;
  69357. "t-CwfhfqJ" == Potree.settings.number && (e = Potree.Utils.datasetPosTransform({
  69358. pointcloud: viewer.scene.pointclouds[0],
  69359. position: new Cn(4.4318,-.580291847759,-.78),
  69360. fromDataset: !0
  69361. }),
  69362. viewer.modules.ParticleEditor.addParticle({
  69363. type: "fire",
  69364. positions: [e],
  69365. radius: .42,
  69366. height: 10
  69367. }),
  69368. viewer.modules.ParticleEditor.addParticle({
  69369. type: "smoke",
  69370. positions: [(new Cn).addVectors(e, new Cn(0,0,.3))],
  69371. positionStyle: "sphere",
  69372. positionRadius: .3,
  69373. sizeTween: [[0, .3, .9, 1], [.05, .1, 1, .8]],
  69374. opacityBase: .2,
  69375. opacityTween: [[0, .3, .7, .95, 1], [0, .2, 1, .1, 0]],
  69376. velocityBase: new Cn(0,0,1),
  69377. velocitySpread: new Cn(.2,.2,-.3),
  69378. accelerationBase: .2,
  69379. accelerationSpread: .7,
  69380. radius: 0,
  69381. particleDeathAge: 3
  69382. }),
  69383. viewer.modules.ParticleEditor.addParticle({
  69384. type: "explode",
  69385. name: "fire splash",
  69386. position: (new Cn).addVectors(e, new Cn(0,0,.3)),
  69387. size: .1,
  69388. sizeRange: .3,
  69389. sizeTween: [[0, .05, .3, .45], [0, .02, .1, .05]],
  69390. opacityTween: [[0, .05, .3, .45], [1, 1, .5, 0]],
  69391. speed: 1,
  69392. speedRange: 4,
  69393. radius: .1,
  69394. acceleration: .3,
  69395. accelerationRange: 1,
  69396. particleSpaceTime: 0,
  69397. strength: 4
  69398. }))
  69399. }
  69400. }, {
  69401. key: "addVideo11",
  69402. value: function() {
  69403. var n, e, i, r, t = this;
  69404. "SS-fckI7CClKC" == Potree.settings.number && ((n = $('<video controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>')[0]).setAttribute("crossOrigin", "Anonymous"),
  69405. e = new wl(n),
  69406. (i = this.videoPlane = new Hr(new bu(1,1,1,1),new $i({
  69407. color: "#ffffff",
  69408. transparent: !0,
  69409. depthTest: !1,
  69410. opacity: .7,
  69411. side: 2,
  69412. map: e
  69413. }))).visible = !1,
  69414. i.geometry.computeBoundingBox(),
  69415. i.boundingBox = i.geometry.boundingBox.clone(),
  69416. i.boundingBox.max.z = 1,
  69417. i.boundingBox.max.y = -.4,
  69418. i.boundingBox.max.x = 1,
  69419. n.addEventListener("loadeddata", function(e) {
  69420. n.play(),
  69421. console.log("video loadeddata")
  69422. }),
  69423. i.scale.set(1.08, 1.92, 1),
  69424. this.addEventListener("global_mousedown", function e() {
  69425. n.play(),
  69426. t.removeEventListener("global_mousedown", e)
  69427. }),
  69428. r = {
  69429. 9: {
  69430. rotation: [-1.432978005954197, 1.2296264545169697, 3.0098547630197667],
  69431. position: [6.532456676287381, -9.806373049095631, -.024205281024294284]
  69432. },
  69433. 19: {
  69434. rotation: [1.627167773445286, -1.172425902600188, .04682299709711613],
  69435. position: [-9.558613948539932, -1.042301166581578, .08159683876743667]
  69436. }
  69437. },
  69438. this.images360.addEventListener("flyToPano", function(e) {
  69439. var t;
  69440. "showPanos" == Potree.settings.displayMode && ((t = r[e.toPano.pano.id]) && setTimeout(function() {
  69441. i.visible = !0,
  69442. i.position.fromArray(t.position),
  69443. i.rotation.fromArray(t.rotation),
  69444. n.src = Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(e.toPano.pano.id, ".mp4"),
  69445. n.play(),
  69446. n.currentTime = 0,
  69447. Potree.settings.zoom.enabled = !1,
  69448. gv.start(vv(i.material, "opacity", 1), .4 * e.toPano.duration, function() {}, 0, pv.easeInOutQuad)
  69449. }, .6 * e.toPano.duration),
  69450. gv.start(vv(i.material, "opacity", 0), .4 * e.toPano.duration, function() {
  69451. t || (i.visible = !1,
  69452. n.pause(),
  69453. Potree.settings.zoom.enabled = !0)
  69454. }, 0, pv.easeInOutQuad))
  69455. }),
  69456. this.images360.addEventListener("endChangeMode", function(e) {
  69457. "showPanos" == e.mode ? (e = r[t.images360.currentPano.id]) && (i.visible = !0,
  69458. i.position.fromArray(e.position),
  69459. i.rotation.fromArray(e.rotation),
  69460. i.material.opacity = 0,
  69461. n.src = Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(t.images360.currentPano.id, ".mp4"),
  69462. n.play(),
  69463. n.currentTime = 0,
  69464. Potree.settings.zoom.enabled = !1,
  69465. gv.start(vv(i.material, "opacity", 1, function(e) {
  69466. console.log("fadeIn", e)
  69467. }), 300, function() {}, 0, pv.easeInOutQuad)) : (i.visible = !1,
  69468. Potree.settings.zoom.enabled = !0)
  69469. }),
  69470. this.scene.scene.add(i))
  69471. }
  69472. }, {
  69473. key: "addVideo",
  69474. value: function() {
  69475. var r, e, a = this;
  69476. "SS-t-P6zBR73Gke" == Potree.settings.number && (r = new bu(1,1,1,1),
  69477. e = this.videoInfo = [{
  69478. id: "40-2",
  69479. url: "https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/10/0aabafee-36b8-455d-9c11-0780bf694786.mp4",
  69480. rotation: [-1.494468618954883, -1.4987317433158989, -3.061254983446741],
  69481. position: [19.801820617361624, 2.884673619844108, -.03362305858221648],
  69482. scale: [3.5741423153151763, 2.8738725275578703, 1]
  69483. }, {
  69484. id: 40,
  69485. url: "https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/09/7896d6ef-a2d6-4fd7-949c-768782a5b484.mp4",
  69486. rotation: [-1.5487684197910518, .021848470169552752, -3.1387534893955236],
  69487. position: [17.277316608096, 2.0840432922115846, -.0931149415437065],
  69488. scale: [2.0821757723834047, .6129478480765236, 1],
  69489. visibles: [40]
  69490. }],
  69491. e.forEach(function(e) {
  69492. !function(t) {
  69493. var n = $('<video controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>')[0];
  69494. n.setAttribute("crossOrigin", "Anonymous"),
  69495. n.src = t.url || Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(t.id, ".mp4");
  69496. var e = new wl(n)
  69497. , i = a.videoPlane = new Hr(r,new $i({
  69498. color: "#ffffff",
  69499. transparent: !0,
  69500. depthTest: !1,
  69501. opacity: 0,
  69502. map: e
  69503. }));
  69504. i.position.fromArray(t.position),
  69505. i.rotation.fromArray(t.rotation),
  69506. t.scale && i.scale.fromArray(t.scale),
  69507. a.scene.scene.add(i),
  69508. (t.plane = i).boundingBox = new kn(new Cn(0,-.5,0),new Cn(1,-.4,.2)),
  69509. n.addEventListener("loadeddata", function(e) {
  69510. n.play(),
  69511. t.visibles || (i.material.opacity = 1),
  69512. t.scale || i.scale.set(n.videoWidth / 1e3, n.videoHeight / 1e3, 1),
  69513. console.log("video loadeddata", t.id)
  69514. }),
  69515. t.visibles && a.images360.addEventListener("flyToPano", function(e) {
  69516. t.visibles.includes(e.toPano.pano.id) ? setTimeout(function() {
  69517. i.visible = !0,
  69518. n.currentTime = 0,
  69519. n.play(),
  69520. n.paused && a.addEventListener("global_mousedown", function e() {
  69521. i.visible && n.play(),
  69522. a.removeEventListener("global_mousedown", e)
  69523. }),
  69524. Potree.settings.zoom.enabled = !1,
  69525. gv.start(vv(i.material, "opacity", 1), .4 * e.toPano.duration, function() {}, 0, pv.easeInOutQuad)
  69526. }, .6 * e.toPano.duration) : gv.start(vv(i.material, "opacity", 0), .4 * e.toPano.duration, function() {
  69527. t || (i.visible = !1,
  69528. n.pause(),
  69529. Potree.settings.zoom.enabled = !0)
  69530. }, 0, pv.easeInOutQuad)
  69531. }),
  69532. a.addEventListener("global_mousedown", function e() {
  69533. n.play(),
  69534. a.removeEventListener("global_mousedown", e)
  69535. }),
  69536. Potree.settings.isTest && i.addEventListener("select", function(e) {
  69537. console.log(e)
  69538. })
  69539. }(e)
  69540. }))
  69541. }
  69542. }]),
  69543. v
  69544. }();
  69545. ed.prototype.zoomTo = function(e) {
  69546. (e.geometry || e.boundingBox) && this.updateProjectionMatrix()
  69547. }
  69548. ,
  69549. $r.prototype.zoomTo = function(e, t) {
  69550. var n, i;
  69551. (e.geometry || e.boundingSphere || e.boundingBox) && (e.geometry && null === e.geometry.boundingSphere && e.geometry.computeBoundingSphere(),
  69552. e.updateMatrixWorld(),
  69553. i = t || 1,
  69554. t = (n = (n = e.boundingSphere || (e.geometry && e.geometry.boundingSphere ? e.geometry.boundingSphere : e.boundingBox.getBoundingSphere(new qn))).clone().applyMatrix4(e.matrixWorld)).radius,
  69555. e = this.fov * Math.PI / 180,
  69556. this.aspect < 1 && (e *= this.aspect),
  69557. i = Math.abs(t / Math.sin(e / 2)) * i,
  69558. i = this.getWorldDirection(new Cn).multiplyScalar(-i),
  69559. this.position.copy(n.center.clone().add(i)))
  69560. }
  69561. ,
  69562. ti.prototype.distanceToPlaneWithNegative = function(e) {
  69563. var t = e.normal.dot(this.direction);
  69564. return 0 === t ? 0 === e.distanceToPoint(this.origin) ? 0 : null : -(this.origin.dot(e.normal) + e.constant) / t
  69565. }
  69566. ;
  69567. rh = new ch,
  69568. Ou = new xu;
  69569. le.scriptPath = "",
  69570. document.currentScript && document.currentScript.src ? le.scriptPath = new URL(document.currentScript.src + "/..").href : ("undefined" == typeof document ? new (require("url").URL)("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("potree.js",document.baseURI).href,
  69571. le.scriptPath = new URL(("undefined" == typeof document ? new (require("url").URL)("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("potree.js",document.baseURI).href) + "/..").href),
  69572. "/" === le.scriptPath.slice(-1) && (le.scriptPath = le.scriptPath.slice(0, -1));
  69573. var yx, Dl = le.scriptPath + "/resources";
  69574. function wx(e, t, n) {
  69575. return bx.apply(this, arguments)
  69576. }
  69577. function bx() {
  69578. return (bx = r(regeneratorRuntime.mark(function e(t, n, i) {
  69579. var r;
  69580. return regeneratorRuntime.wrap(function(e) {
  69581. for (; ; )
  69582. switch (e.prev = e.next) {
  69583. case 0:
  69584. if (!Potree.fileServer) {
  69585. e.next = 4;
  69586. break
  69587. }
  69588. Potree.fileServer.get(t).then(function(e) {
  69589. n && n(e)
  69590. }).catch(i),
  69591. e.next = 20;
  69592. break;
  69593. case 4:
  69594. return e.prev = 4,
  69595. e.next = 7,
  69596. fetch(t);
  69597. case 7:
  69598. return r = e.sent,
  69599. e.next = 10,
  69600. r.text();
  69601. case 10:
  69602. return r = e.sent,
  69603. (r = JSON.parse(r)).data && (r = r.data),
  69604. n && n(r),
  69605. e.abrupt("return", r);
  69606. case 17:
  69607. e.prev = 17,
  69608. e.t0 = e.catch(4),
  69609. i && i(e.t0);
  69610. case 20:
  69611. case "end":
  69612. return e.stop()
  69613. }
  69614. }, e, null, [[4, 17]])
  69615. }))).apply(this, arguments)
  69616. }
  69617. function xx() {
  69618. return (xx = r(regeneratorRuntime.mark(function e(t, n, i) {
  69619. var r;
  69620. return regeneratorRuntime.wrap(function(e) {
  69621. for (; ; )
  69622. switch (e.prev = e.next) {
  69623. case 0:
  69624. return n = n || Potree.settings.number,
  69625. r = (Potree.fileServer ? "/laser/dataset/" : "".concat(Potree.settings.urls.prefix4, "laser/dataset/")).concat(n, "/getDataSet"),
  69626. e.abrupt("return", wx(r, t, i));
  69627. case 3:
  69628. case "end":
  69629. return e.stop()
  69630. }
  69631. }, e)
  69632. }))).apply(this, arguments)
  69633. }
  69634. function Ex() {
  69635. return (Ex = r(regeneratorRuntime.mark(function e(t, n) {
  69636. var i, r, a = this;
  69637. return regeneratorRuntime.wrap(function(e) {
  69638. for (; ; )
  69639. switch (e.prev = e.next) {
  69640. case 0:
  69641. if (Potree.settings.floorplanEnable || n || !Potree.fileServer) {
  69642. e.next = 2;
  69643. break
  69644. }
  69645. return e.abrupt("return");
  69646. case 2:
  69647. i = "all" == t ? viewer.scene.pointclouds.map(function(e) {
  69648. return e.dataset_id
  69649. }) : [t],
  69650. r = function(t, e, n) {
  69651. e == Potree.settings.floorplanType[t] && ((e = viewer.mapViewer.mapLayer.maps.find(function(e) {
  69652. return e.name == "floorplan_" + t
  69653. })) && viewer.mapViewer.mapLayer.removeMap(e),
  69654. n = viewer.mapViewer.mapLayer.addMapEntity(n.data || n, t),
  69655. e && (n.visibleReasons = e.visibleReasons,
  69656. n.unvisibleReasons = e.unvisibleReasons),
  69657. 0)
  69658. }
  69659. ,
  69660. i.forEach(function(e) {
  69661. var t = Potree.settings.floorplanType[e];
  69662. if (t) {
  69663. var n = Potree.fileServer ? "/laser/tiledMap/".concat(Potree.settings.number, "/tiledMap/").concat(t, "/").concat(e) : "".concat(Potree.settings.urls.prefix2, "/indoor/").concat(Potree.settings.number, "/api/tiled_maps");
  69664. return Potree.settings.floorplanRequests[e] = !0,
  69665. wx(n, r.bind(a, e, t))
  69666. }
  69667. });
  69668. case 6:
  69669. case "end":
  69670. return e.stop()
  69671. }
  69672. }, e)
  69673. }))).apply(this, arguments)
  69674. }
  69675. function _x() {
  69676. return (_x = r(regeneratorRuntime.mark(function e(t, n) {
  69677. var i;
  69678. return regeneratorRuntime.wrap(function(e) {
  69679. for (; ; )
  69680. switch (e.prev = e.next) {
  69681. case 0:
  69682. return i = "?datasetId=".concat(t),
  69683. i = Potree.fileServer ? "/laser/filter/".concat(Potree.settings.number, "/query") + i : "".concat(Potree.settings.urls.prefix4, "laser/filter/").concat(Potree.settings.number, "/query") + i,
  69684. e.abrupt("return", wx(i, n));
  69685. case 3:
  69686. case "end":
  69687. return e.stop()
  69688. }
  69689. }, e)
  69690. }))).apply(this, arguments)
  69691. }
  69692. function Mx() {
  69693. return (Mx = r(regeneratorRuntime.mark(function e(t) {
  69694. var n;
  69695. return regeneratorRuntime.wrap(function(e) {
  69696. for (; ; )
  69697. switch (e.prev = e.next) {
  69698. case 0:
  69699. return Potree.fileServer || (n = "".concat(Potree.scriptPath, "/data/panoEdit/vision_edit.txt")),
  69700. e.abrupt("return", wx(n, t));
  69701. case 2:
  69702. case "end":
  69703. return e.stop()
  69704. }
  69705. }, e)
  69706. }))).apply(this, arguments)
  69707. }
  69708. (yx = jQuery).fn.extend({
  69709. selectgroup: function() {
  69710. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}
  69711. , o = yx(this)
  69712. , t = o.prop("id")
  69713. , s = "".concat(t)
  69714. , e = void 0 !== e.title ? e.title : ""
  69715. , l = [];
  69716. o.find("option").each(function(e, t) {
  69717. var n = yx(t).prop("id")
  69718. , i = yx(t).html()
  69719. , t = yx(t).prop("value")
  69720. , t = yx('\n\t\t\t\t\t<span style="flex-grow: 1; display: inherit">\n\t\t\t\t\t<label for="'.concat(n, '" class="ui-button" style="width: 100%; padding: .4em .1em">').concat(i, '</label>\n\t\t\t\t\t<input type="radio" name="').concat(s, '" id="').concat(n, '" value="').concat(t, '" style="display: none"/>\n\t\t\t\t\t</span>\n\t\t\t\t'))
  69721. , r = t.find("label")
  69722. , a = t.find("input");
  69723. a.change(function() {
  69724. o.find("label").removeClass("ui-state-active"),
  69725. o.find("label").addClass("ui-state-default"),
  69726. a.is(":checked") && r.addClass("ui-state-active")
  69727. }),
  69728. l.push(t)
  69729. });
  69730. for (var e = yx('\n\t\t\t\t<fieldset style="border: none; margin: 0px; padding: 0px">\n\t\t\t\t\t<legend>'.concat(e, '</legend>\n\t\t\t\t\t<span style="display: flex">\n\n\t\t\t\t\t</span>\n\t\t\t\t</fieldset>\n\t\t\t')), n = e.find("span"), i = 0, r = l; i < r.length; i++) {
  69731. var a = r[i];
  69732. n.append(a)
  69733. }
  69734. n.find("label").each(function(e, t) {
  69735. yx(t).css("margin", "0px"),
  69736. yx(t).css("border-radius", "0px"),
  69737. yx(t).css("border", "1px solid black"),
  69738. yx(t).css("border-left", "none")
  69739. }),
  69740. n.find("label:first").each(function(e, t) {
  69741. yx(t).css("border-radius", "4px 0px 0px 4px")
  69742. }),
  69743. n.find("label:last").each(function(e, t) {
  69744. yx(t).css("border-radius", "0px 4px 4px 0px"),
  69745. yx(t).css("border-left", "none")
  69746. }),
  69747. o.empty(),
  69748. o.append(e)
  69749. }
  69750. }),
  69751. le.Action = Zf,
  69752. le.Alignment = C1,
  69753. le.AnimationPath = Yd,
  69754. le.Annotation = Kf,
  69755. le.Box3Helper = Hm,
  69756. le.BoxVolume = Zp,
  69757. le.Buttons = rm,
  69758. le.CameraAnimation = bv,
  69759. le.CameraMode = em,
  69760. le.ClassificationScheme = Bm,
  69761. le.ClipMethod = nm,
  69762. le.ClipTask = tm,
  69763. le.ClipVolume = Vv,
  69764. le.ClippingTool = jv,
  69765. le.Compass = Kv,
  69766. le.DeviceOrientationControls = Rw,
  69767. le.DownloadStatus = vm,
  69768. le.EarthControls = Lw,
  69769. le.ElevationGradientRepeat = im,
  69770. le.Enum = Mh,
  69771. le.EnumItem = $f,
  69772. le.EptBinaryLoader = Lv,
  69773. le.EptKey = _u,
  69774. le.EptLaszipLoader = wh,
  69775. le.EptLazBatcher = Rv,
  69776. le.EptLoader = Bv,
  69777. le.EptZstandardLoader = Pu,
  69778. le.EventDispatcher = Dh,
  69779. le.EyeDomeLightingMaterial = _v,
  69780. le.Features = jp,
  69781. le.FirstPersonControls = Fg,
  69782. le.GLCubeFaces = um,
  69783. le.GeoPackageLoader = Fu,
  69784. le.Geopackage = Hv,
  69785. le.Gradients = km,
  69786. le.HierarchicalSlider = zy,
  69787. le.Images360 = ly,
  69788. le.KeyCodes = ym,
  69789. le.LRU = xu,
  69790. le.LRUItem = wm,
  69791. le.LengthUnits = lm,
  69792. le.Log = function(e, t, n) {
  69793. t = t || "#13f",
  69794. n = n || 14,
  69795. console.warn("%c".concat(e), "color:".concat(t, ";font-size:").concat(n, "px"))
  69796. }
  69797. ,
  69798. le.Measure = Wf,
  69799. le.MeasuringTool = Wv,
  69800. le.Message = Xv,
  69801. le.ModelManagerEvents = {
  69802. ModelAdded: "model-added",
  69803. ActiveModelChanged: "active-model-changed"
  69804. },
  69805. le.NormalizationEDLMaterial = Mv,
  69806. le.NormalizationMaterial = Av,
  69807. le.OrbitControls = Bw,
  69808. le.OrientedImage = nw,
  69809. le.OrientedImageLoader = pd,
  69810. le.OrientedImages = iw,
  69811. le.POCLoader = kv,
  69812. le.PanoRendererEvents = dm,
  69813. le.PanoSizeClass = cm,
  69814. le.PanoramaEvents = gm,
  69815. le.PathAnimation = Qf,
  69816. le.PointAttribute = Am,
  69817. le.PointAttributeTypes = Em,
  69818. le.PointAttributes = Sm,
  69819. le.PointCloudEptGeometry = Ud,
  69820. le.PointCloudEptGeometryNode = Jd,
  69821. le.PointCloudMaterial = Rm,
  69822. le.PointCloudOctree = Um,
  69823. le.PointCloudOctreeGeometry = Pm,
  69824. le.PointCloudOctreeGeometryNode = Dm,
  69825. le.PointCloudOctreeNode = Nm,
  69826. le.PointCloudSM = pu,
  69827. le.PointCloudTree = xm,
  69828. le.PointCloudTreeNode = bm,
  69829. le.PointShape = om,
  69830. le.PointSizeType = am,
  69831. le.Points = Gm,
  69832. le.PolygonClipVolume = qf,
  69833. le.Profile = Kp,
  69834. le.ProfileData = Qm,
  69835. le.ProfileRequest = _h,
  69836. le.ProfileTool = qv,
  69837. le.Renderer = Zm,
  69838. le.Scene = rg,
  69839. le.SceneRendererEvents = {
  69840. ContextCreated: "scene-renderer-context-created",
  69841. AfterRender: "after-render",
  69842. MemoryUsageUpdated: "scene-renderer-memory-usage-updated"
  69843. },
  69844. le.ScreenBoxSelectTool = Jv,
  69845. le.ShapefileLoader = ku,
  69846. le.SphereVolume = Qp,
  69847. le.SpotLightHelper = mu,
  69848. le.TileDownloaderEvents = hm,
  69849. le.TransformationTool = Zv,
  69850. le.TreeType = sm,
  69851. le.Utils = Jf,
  69852. le.VRControls = gu,
  69853. le.Vectors = pm,
  69854. le.Vectors2 = fm,
  69855. le.Version = Km,
  69856. le.Viewer = Ch,
  69857. le.Volume = Yp,
  69858. le.VolumeTool = Qv,
  69859. le.WorkerPool = ch,
  69860. le.XHRFactory = Gp,
  69861. le.config = T,
  69862. le.debug = {},
  69863. le.framenumber = 0,
  69864. le.loadDatasets = function(e, t, n) {
  69865. return xx.apply(this, arguments)
  69866. }
  69867. ,
  69868. le.loadFile = wx,
  69869. le.loadMapEntity = function(e, t) {
  69870. return Ex.apply(this, arguments)
  69871. }
  69872. ,
  69873. le.loadPanos = function(e, t) {
  69874. return _x.apply(this, arguments)
  69875. }
  69876. ,
  69877. le.loadPanosInfo = function(e) {
  69878. return Mx.apply(this, arguments)
  69879. }
  69880. ,
  69881. le.loadPointCloud = function(n, t, i, e, r, a) {
  69882. var o = new Promise(function(t) {
  69883. n && (0 < n.indexOf("ept.json") ? Bv.load(n, function(e) {
  69884. e ? (e = new Um(e),
  69885. t({
  69886. type: "pointcloud_loaded",
  69887. pointcloud: e
  69888. })) : console.error(new Error("failed to load point cloud from URL: ".concat(n)))
  69889. }) : 0 < n.indexOf("cloud.js") ? kv.load(n, e, function(e) {
  69890. e ? (e = new Um(e),
  69891. t({
  69892. type: "pointcloud_loaded",
  69893. pointcloud: e
  69894. })) : (console.error(new Error("failed to load point cloud from URL: ".concat(n))),
  69895. a && a())
  69896. }) : 0 < n.indexOf(".vpc") ? PointCloudArena4DGeometry.load(n, function(e) {
  69897. e ? (e = new PointCloudArena4D(e),
  69898. t({
  69899. type: "pointcloud_loaded",
  69900. pointcloud: e
  69901. })) : console.error(new Error("failed to load point cloud from URL: ".concat(n)))
  69902. }) : console.error(new Error("failed to load point cloud from URL: ".concat(n))))
  69903. }
  69904. );
  69905. if (!r)
  69906. return o;
  69907. o.then(function(e) {
  69908. (e = e).pointcloud.name = t,
  69909. e.pointcloud.sceneCode = i,
  69910. r(e)
  69911. })
  69912. }
  69913. ,
  69914. le.loadProject = function(e, t, n) {
  69915. return Ev.apply(this, arguments)
  69916. }
  69917. ,
  69918. le.lru = Ou,
  69919. le.maxNodesLoading = 4,
  69920. le.mergeEditStart = function(e) {
  69921. Potree.settings.editType = "merge",
  69922. Potree.settings.intersectOnObjs = !0,
  69923. Potree.settings.boundAddObjs = !0,
  69924. Potree.settings.unableNavigate = !0;
  69925. var s = new Potree.Viewer(e);
  69926. s.modules.Alignment;
  69927. s.setEDLEnabled(!1),
  69928. s.setFOV(T.view.fov),
  69929. s.loadSettingsFromURL(),
  69930. s.mainViewport.view.position.set(30, 30, 30),
  69931. s.mainViewport.view.lookAt(0, 0, 0),
  69932. s.updateModelBound(),
  69933. s.transformationTool.setModeEnable("scale", !1),
  69934. s.ssaaRenderPass.sampleLevel = 1,
  69935. s.inputHandler.fixSelection = !0,
  69936. Potree.settings.sizeFitToLevel = !0,
  69937. Potree.loadPointCloudScene = function(t, o, n) {
  69938. Potree.loadDatasets(function(e) {
  69939. var r = e.find(function(e) {
  69940. return e.sceneCode == t
  69941. })
  69942. , e = "".concat(Potree.settings.urls.prefix, "/").concat(Potree.settings.webSite, "/").concat(t, "/data/").concat(t, "/webcloud/cloud.js")
  69943. , a = r.createTime ? r.createTime.replace(/[^0-9]/gi, "") : "";
  69944. Potree.loadPointCloud(e, r.sceneName, t, a, function(e) {
  69945. var t = s.scene
  69946. , n = e.pointcloud
  69947. , i = Potree.config.material
  69948. , e = n.material;
  69949. e.minSize = i.minSize,
  69950. e.maxSize = i.maxSize,
  69951. e.pointSizeType = i.pointSizeType,
  69952. n.changePointSize(i.realPointSize),
  69953. n.changePointOpacity(1),
  69954. e.shape = Potree.PointShape.SQUARE,
  69955. n.color = n.material.color = r.color,
  69956. n.dataset_id = r.id,
  69957. n.timeStamp = a,
  69958. t.addPointCloud(n),
  69959. s.updateModelBound();
  69960. t = s.bound;
  69961. t.boundSize,
  69962. t.center;
  69963. s.dispatchEvent({
  69964. type: "loadPointCloudDone"
  69965. }),
  69966. Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "high"),
  69967. Potree.Log("loadPointCloudDone 点云加载完毕", null, 10),
  69968. s.dispatchEvent("allLoaded"),
  69969. o(n)
  69970. }, n)
  69971. }, t, n)
  69972. }
  69973. ;
  69974. function o(e) {
  69975. var t = s.mainViewport.camera
  69976. , n = new Cn(e.pointer.x,e.pointer.y,-1).unproject(t)
  69977. , i = new Cn(e.pointer.x,e.pointer.y,1).unproject(t).sub(n)
  69978. , t = (e = (0 - n.z) / i.z) * i.x + n.x
  69979. , n = e * i.y + n.y;
  69980. c.moveBoundCenterTo(u, new Cn(t,n,u.boundCenter.z)),
  69981. u.dispatchEvent("position_changed")
  69982. }
  69983. function l() {
  69984. return c.focusOn(u),
  69985. t(),
  69986. {
  69987. stopContinue: !0
  69988. }
  69989. }
  69990. var u, t = function() {
  69991. u = null,
  69992. s.removeEventListener("global_mousemove", o),
  69993. s.removeEventListener("global_click", l)
  69994. }, c = s.modules.MergeEditor;
  69995. return Potree.addModel = function(i, r, e, t) {
  69996. var n, a = function(e) {
  69997. i.isFirstLoad ? (u = e,
  69998. c.setModelBtmHeight(e, 0),
  69999. s.addEventListener("global_mousemove", o),
  70000. s.addEventListener("global_click", l, 3)) : (c.setModelBtmHeight(e, i.bottom || 0),
  70001. u = null);
  70002. function t() {
  70003. e.updateMatrixWorld(),
  70004. s.updateModelBound()
  70005. }
  70006. function n() {
  70007. c.maintainBoundXY(e),
  70008. c.setModelBtmHeight(e),
  70009. t(),
  70010. e.dispatchEvent("transformChanged")
  70011. }
  70012. e.addEventListener("position_changed", function() {
  70013. t(),
  70014. c.getBoundCenter(e),
  70015. c.computeBtmHeight(e),
  70016. i.bottomRange && (e.btmHeight > i.bottomRange.max || e.btmHeight < i.bottomRange.min) && (e.btmHeight = gn.clamp(e.btmHeight, i.bottomRange.min, i.bottomRange.max),
  70017. c.setModelBtmHeight(e),
  70018. t()),
  70019. e.dispatchEvent("transformChanged")
  70020. }),
  70021. e.addEventListener("rotation_changed", n),
  70022. e.addEventListener("scale_changed", n),
  70023. e.addEventListener("transformChanged", function() {
  70024. c.modelTransformCallback(e)
  70025. }),
  70026. e.updateMatrixWorld(),
  70027. s.updateModelBound(),
  70028. c.getBoundCenter(e),
  70029. e.lastMatrixWorld = e.matrixWorld.clone(),
  70030. r(e)
  70031. };
  70032. "laser" == i.type ? Potree.loadPointCloudScene(i.url, function(e) {
  70033. e.matrixAutoUpdate = !0,
  70034. e.initialPosition = e.position.clone(),
  70035. e.pos1MatrixInvert = (new ni).setPosition(e.initialPosition).invert(),
  70036. a(e)
  70037. }, t) : (n = {
  70038. name: i.type,
  70039. id: i.id,
  70040. unlit: !0,
  70041. transform: {
  70042. position: i.position,
  70043. rotation: (new ci).setFromVector3(i.rotation),
  70044. scale: new Cn(i.scale,i.scale,i.scale)
  70045. }
  70046. },
  70047. "glb" == i.type ? n.glburl = i.url : (n.objurl = i.url,
  70048. n.mtlurl = i.mtlurl),
  70049. s.loadModel(n, function(e) {
  70050. e.isModel = !0,
  70051. e.traverse(function(e) {
  70052. return e.material && (e.material.transparent = !0)
  70053. }),
  70054. a(e)
  70055. }, e, t))
  70056. }
  70057. ,
  70058. {
  70059. THREE: mp
  70060. }
  70061. }
  70062. ,
  70063. le.numNodesLoading = 0,
  70064. le.panoEditStart = function(e, t, n, i) {
  70065. Potree.settings.editType = "pano",
  70066. Potree.settings.number = t,
  70067. Potree.settings.unableNavigate = !0;
  70068. var c = new Potree.Viewer(e)
  70069. , r = c.modules.Alignment;
  70070. c.setEDLEnabled(!1),
  70071. c.setFOV(T.view.fov),
  70072. c.loadSettingsFromURL();
  70073. var d = 0;
  70074. Potree.settings.isOfficial || (c.loadGUI(function() {
  70075. c.setLanguage("en"),
  70076. $("#menu_tools").next().show(),
  70077. $("#panos").show(),
  70078. $("#alignment").show(),
  70079. c.toggleSidebar()
  70080. }),
  70081. Potree.settings.sizeFitToLevel = !0);
  70082. function h(e) {
  70083. c.sidebar && c.sidebar.addAlignmentButton(e);
  70084. var t = e.panos[0].dataRotation.z + Math.PI
  70085. , n = e.panos[0].dataPosition.clone()//.negate();
  70086. r.rotate(e, null, t),
  70087. r.translate(e, n),
  70088. e.updateMatrixWorld()
  70089. }
  70090. var a = Potree.loadPanosDone = function(a, o) {
  70091. Potree.settings.datasetsPanos[a] = {
  70092. panoData: o,
  70093. panos: []
  70094. },
  70095. console.log("panoData", a, o);
  70096. var s = o.length
  70097. , l = 0
  70098. , u = Object.keys(Potree.settings.datasetsPanos).length;
  70099. o.forEach(function(r, e) {
  70100. var t = "https://laser-oss.4dkankan.com/".concat(Potree.settings.webSite, "/").concat(Potree.settings.number, "/data/bundle_").concat(Potree.settings.number, "/building/uuidcloud/").concat(r.uuid, "/cloud.js")
  70101. , n = a + "-" + r.uuid;
  70102. r.index = e,
  70103. Potree.loadPointCloud(t, n, n, 0, function(e) {
  70104. var t = c.scene
  70105. , n = e.pointcloud
  70106. , i = Potree.config.material
  70107. , e = n.material;
  70108. e.minSize = i.minSize,
  70109. e.maxSize = i.maxSize,
  70110. e.pointSizeType = i.pointSizeType,
  70111. n.changePointSize(.2),
  70112. n.changePointOpacity(1),
  70113. e.shape = Potree.PointShape.SQUARE,
  70114. n.color = i.pointColor,
  70115. n.dataset_id = a,
  70116. n.panoUuid = r.uuid,
  70117. n.timeStamp = 0,
  70118. t.addPointCloud(n),
  70119. ++l == s && (d++,
  70120. c.images360.addPanoData(o, a),
  70121. d == u && function() {
  70122. c.scene.pointclouds.forEach(function(e) {
  70123. h(e)
  70124. }),
  70125. c.images360.loadDone(),
  70126. c.scene.add360Images(c.images360),
  70127. c.updateModelBound();
  70128. var e = c.bound
  70129. , t = e.boundSize
  70130. , e = e.center;
  70131. Potree.Log("中心点: ".concat(Up.toPrecision(e.toArray(), 2), ", boundSize: ").concat(Up.toPrecision(t.toArray(), 2), " "), null, 12),
  70132. c.scene.view.setView({
  70133. position: e.clone().add(new Cn(10,5,10)),
  70134. target: e
  70135. }),
  70136. c.dispatchEvent({
  70137. type: "loadPointCloudDone"
  70138. }),
  70139. Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "panoEdit"),
  70140. Potree.Log("loadPointCloudDone 点云加载完毕", null, 10),
  70141. c.dispatchEvent("allLoaded")
  70142. }())
  70143. })
  70144. })
  70145. }
  70146. ;
  70147. Potree.settings.isOfficial || (Potree.settings.datasetsPano = {
  70148. testDataset: null
  70149. },
  70150. Potree.loadPanosInfo(function(e) {
  70151. a("testDataset", e.sweepLocations)
  70152. }))
  70153. }
  70154. ,
  70155. le.pointBudget = 1e6,
  70156. le.resourcePath = Dl,
  70157. le.saveProject = function(e) {
  70158. var t, n = e.scene;
  70159. return {
  70160. type: "Potree",
  70161. version: 1.7,
  70162. settings: {
  70163. pointBudget: (t = e).getPointBudget(),
  70164. fov: t.getFOV(),
  70165. edlEnabled: t.getEDLEnabled(),
  70166. edlRadius: t.getEDLRadius(),
  70167. edlStrength: t.getEDLStrength(),
  70168. background: t.getBackground(),
  70169. minNodeSize: t.getMinNodeSize(),
  70170. showBoundingBoxes: t.getShowBoundingBox()
  70171. },
  70172. view: {
  70173. position: (t = (t = e).scene.view).position.toArray(),
  70174. target: t.getPivot().toArray()
  70175. },
  70176. classification: e.classifications,
  70177. pointclouds: n.pointclouds.map($m),
  70178. measurements: n.measurements.map(iv),
  70179. volumes: n.volumes.map(tv),
  70180. cameraAnimations: n.cameraAnimations.map(nv),
  70181. profiles: n.profiles.map(ev),
  70182. annotations: ov(e),
  70183. orientedImages: n.orientedImages.map(rv),
  70184. geopackages: n.geopackages.map(av)
  70185. }
  70186. }
  70187. ,
  70188. le.settings = S,
  70189. le.start = function(e, t, n, i) {
  70190. Potree.settings.number = n || "t-o5YMR13",
  70191. Potree.fileServer = i;
  70192. var d = new Potree.Viewer(e,t)
  70193. , h = d.modules.Alignment;
  70194. d.setEDLEnabled(!1),
  70195. d.setFOV(T.view.fov),
  70196. d.loadSettingsFromURL(),
  70197. Potree.settings.isOfficial || (d.loadGUI(function() {
  70198. d.setLanguage("en"),
  70199. $("#menu_tools").next().show(),
  70200. $("#menu_scene").next().show(),
  70201. $("#siteModel").show(),
  70202. d.toggleSidebar()
  70203. }),
  70204. Potree.settings.sizeFitToLevel = !0),
  70205. Potree.loadDatasetsCallback = function(e, o) {
  70206. if (!e || 0 == e.length)
  70207. return console.error("getDataSet加载的数据为空");
  70208. Potree.datasetData = e,
  70209. d.transform = null;
  70210. function s(e, t) {
  70211. var n = t.location.slice(0, 2)
  70212. , i = d.transform.lonlatToLocal.forward(n);
  70213. d.sidebar && d.sidebar.addAlignmentButton(e),
  70214. h.rotate(e, null, t.orientation),
  70215. h.translate(e, new Cn(i[0],i[1],t.location[2])),
  70216. e.updateMatrixWorld(),
  70217. Potree.Log("点云".concat(e.dataset_id, "旋转值:").concat(e.orientationUser, ", 位置").concat(Up.toPrecision(e.translateUser.toArray(), 3), ", 经纬度 ").concat(n, ", spacing ").concat(e.material.spacing), null, 17)
  70218. }
  70219. var l = e.length
  70220. , u = 0
  70221. , c = 0;
  70222. Potree.settings.originDatasetId || (Potree.settings.originDatasetId = e[0].id);
  70223. var t = e.find(function(e) {
  70224. return e.id == Potree.settings.originDatasetId
  70225. }).location.slice(0, 2);
  70226. proj4.defs("NAVVIS:TMERC", "+proj=tmerc +ellps=WGS84 +lon_0=" + t[0].toPrecision(15) + " +lat_0=" + t[1].toPrecision(15)),
  70227. proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
  70228. var n = proj4("WGS84", "NAVVIS:TMERC")
  70229. , t = proj4("+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs;");
  70230. d.transform = {
  70231. lonlatToLocal: n,
  70232. lonlatTo4550: t
  70233. },
  70234. d.mapViewer && d.mapViewer.mapLayer.maps[0].updateProjection(),
  70235. e.forEach(function(r, e) {
  70236. var t, n, a;
  70237. o ? ((n = d.scene.pointclouds.find(function(e) {
  70238. return e.dataset_id == r.id
  70239. })) || (Potree.Log("数据集id变了,自动使用第一个", "#500"),
  70240. n = d.scene.pointclouds[0]),
  70241. h.translate(n, n.translateUser.clone().negate()),
  70242. h.rotate(n, null, -n.orientationUser),
  70243. s(n, r)) : (t = r.sceneCode || r.name,
  70244. n = "".concat(Potree.settings.urls.prefix, "/").concat(Potree.settings.webSite, "/").concat(t, "/data/").concat(t, "/webcloud/cloud.js"),
  70245. a = r.createTime ? r.createTime.replace(/[^0-9]/gi, "") : "",
  70246. Potree.loadPointCloud(n, r.name, t, a, function(e) {
  70247. var t = d.scene
  70248. , n = e.pointcloud
  70249. , i = Potree.config.material
  70250. , e = n.material;
  70251. n.hasDepthTex = Potree.settings.useDepthTex && (!!r.has_depth || Potree.settings.isLocalhost && "SS-t-7DUfWAUZ3V" == Potree.settings.number),
  70252. e.minSize = i.minSize,
  70253. e.maxSize = i.maxSize,
  70254. e.pointSizeType = i.pointSizeType,
  70255. n.changePointSize(i.realPointSize),
  70256. n.changePointOpacity(1),
  70257. e.shape = Potree.PointShape.SQUARE,
  70258. n.color = n.material.color = r.color,
  70259. n.dataset_id = r.id,
  70260. n.timeStamp = a,
  70261. s(n, r),
  70262. t.addPointCloud(n),
  70263. ++u == l && function() {
  70264. d.updateModelBound();
  70265. var e = d.bound
  70266. , t = e.boundSize
  70267. , e = e.center;
  70268. Potree.Log("中心点: ".concat(Up.toPrecision(e.toArray(), 2), ", boundSize: ").concat(Up.toPrecision(t.toArray(), 2), " "), null, 12),
  70269. Potree.settings.isOfficial || Potree.loadMapEntity("all"),
  70270. o || (d.scene.view.setView({
  70271. position: e.clone().add(new Cn(10,5,10)),
  70272. target: e
  70273. }),
  70274. d.dispatchEvent({
  70275. type: "loadPointCloudDone"
  70276. }),
  70277. Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "high"),
  70278. Potree.Log("loadPointCloudDone 点云加载完毕", null, 10))
  70279. }(),
  70280. Potree.loadPanos(r.id, function(e) {
  70281. d.images360.addPanoData(e, r.id),
  70282. ++c == l && function() {
  70283. d.images360.loadDone(),
  70284. d.scene.add360Images(d.images360),
  70285. d.mapViewer.addListener(d.images360);
  70286. var e, t = A.urlHasValue("pano", !0);
  70287. "" !== t ? (e = d.images360.panos.find(function(e) {
  70288. return e.id == t
  70289. })) && d.images360.focusPano({
  70290. pano: e,
  70291. duration: 0,
  70292. callback: function() {}
  70293. }) : ((e = d.bound).boundSize,
  70294. e = e.center,
  70295. (e = d.images360.findNearestPano(e)) && d.images360.flyToPano({
  70296. pano: e,
  70297. duration: 0,
  70298. target: d.images360.bound.center
  70299. })),
  70300. d.addVideo(),
  70301. console.log("allLoaded"),
  70302. d.dispatchEvent("allLoaded")
  70303. }()
  70304. })
  70305. }))
  70306. })
  70307. }
  70308. ,
  70309. Potree.loadDatasets(Potree.loadDatasetsCallback),
  70310. window.testTransform = function(e, t, n) {
  70311. proj4.defs("NAVVIS:test", "+proj=tmerc +ellps=WGS84 +lon_0=" + e[0].toPrecision(15) + " +lat_0=" + e[1].toPrecision(15));
  70312. e = proj4("WGS84", "NAVVIS:test");
  70313. return t ? e.forward(t) : e.inverse(n)
  70314. }
  70315. ,
  70316. window.THREE = mp,
  70317. window.buttonFunction = function() {
  70318. d.scene.pointclouds.forEach(function(e) {
  70319. return e.predictNodeMaxLevel()
  70320. })
  70321. }
  70322. ,
  70323. Potree.settings.isLocalhost && d.inputHandler.addEventListener("keydown", function(e) {
  70324. "t" == e.event.key ? (d.images360.cube.visible = !0,
  70325. d.images360.cube.material.wireframe = !0) : "y" == e.event.key && (d.images360.cube.material.wireframe = !1,
  70326. d.images360.cube.visible = "showPanos" == Potree.settings.displayMode)
  70327. })
  70328. }
  70329. ,
  70330. le.updatePointClouds = function(e, t, n) {
  70331. var i, r = ue(e);
  70332. try {
  70333. for (r.s(); !(i = r.n()).done; ) {
  70334. var a, o = i.value, s = performance.now(), l = ue(o.profileRequests);
  70335. try {
  70336. for (l.s(); !(a = l.n()).done; )
  70337. if (a.value.update(),
  70338. 5 < performance.now() - s)
  70339. break
  70340. } catch (e) {
  70341. l.e(e)
  70342. } finally {
  70343. l.f()
  70344. }
  70345. performance.now()
  70346. }
  70347. } catch (e) {
  70348. r.e(e)
  70349. } finally {
  70350. r.f()
  70351. }
  70352. var u, n = jm(e, t, n), c = ue(e);
  70353. try {
  70354. for (c.s(); !(u = c.n()).done; )
  70355. u.value.updateVisibleBounds()
  70356. } catch (e) {
  70357. c.e(e)
  70358. } finally {
  70359. c.f()
  70360. }
  70361. return le.lru.freeMemory(),
  70362. n
  70363. }
  70364. ,
  70365. le.updateVisibility = jm,
  70366. le.updateVisibilityStructures = Vm,
  70367. le.version = {
  70368. major: 1,
  70369. minor: 8,
  70370. suffix: ".0"
  70371. },
  70372. le.workerPool = rh,
  70373. Object.defineProperty(le, "__esModule", {
  70374. value: !0
  70375. })
  70376. });