xr-frame.d.ts 493 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086
  1. /// <reference path="./phys3D.d.ts" />
  2. declare type HTMLCanvasElement = any;
  3. declare type ImageData = any;
  4. declare type HTMLImageElement = any;
  5. declare module 'XrFrame' {
  6. import * as xrFrameSystem from 'XrFrame/xrFrameSystem';
  7. import {IComponentSchema, IEntityComponents} from 'XrFrame/xrFrameSystem';
  8. export {
  9. IComponentSchema,
  10. IEntityComponents,
  11. IEffectAsset,
  12. IRenderStates,
  13. ISubMesh,
  14. IVideoTextureOptions,
  15. IRenderTarget,
  16. IRenderTextureOptions,
  17. IGLTFModelOptions,
  18. IEnvDataOptions,
  19. IKeyframeAnimationData,
  20. IKeyframeAnimationInfo,
  21. IKeyframeAnimationOptions,
  22. IAtlasOptions,
  23. IAtlasCreationOptions,
  24. IPostProcessOptions,
  25. IDataValueHandler,
  26. ITextureWrapper,
  27. ITextureOptions,
  28. IEngineSettings,
  29. IHandle,
  30. IVertexLayoutOptions,
  31. IVertexDataDescriptorOptions,
  32. IUniformDescriptorOptions,
  33. IImage,
  34. IRealDownloader,
  35. IDownloader,
  36. IFontSetting,
  37. IFeatures,
  38. IRect,
  39. IViewAction,
  40. IView,
  41. IAttachment,
  42. IRenderPassDescriptor,
  43. IGlyphInfo,
  44. IEventBridge,
  45. INativeMap,
  46. ILongIntNativeMap,
  47. ITransformData,
  48. IAssetsData,
  49. ICameraData,
  50. IGLTFData,
  51. ILightData,
  52. IAssetMaterialData,
  53. IMeshData,
  54. ITextData,
  55. IAssetRenderTextureData,
  56. IEnvData,
  57. IAnimatorData,
  58. IAnimationPlayOptions,
  59. IAnimatorAutoPlay,
  60. ICameraOrbitControlData,
  61. IARTrackerData,
  62. IARTrackerRawData,
  63. IShapeData,
  64. ISphereShapeData,
  65. IMeshShapeData,
  66. ICapsuleShapeData,
  67. ICubeShapeData,
  68. IShapeGizmosData,
  69. IAssetPostProcessData,
  70. IParticleData,
  71. IAssetsSystemData,
  72. INodeSystemData,
  73. ITickSystemData,
  74. IAnimationSystemData,
  75. IVideoSystemData,
  76. IRenderSystemData,
  77. IPhysicsSystemData,
  78. IShapeDragEvent,
  79. IShapeTouchEvent,
  80. IARSystemData,
  81. IARRawData,
  82. IShareSystemData,
  83. IShareCaptureOptions,
  84. IGizmoSystemData,
  85. ITextureLoaderOptions,
  86. IImageLoaderOptions,
  87. ICubeTextureLoaderOptions,
  88. IVideoTextureLoaderOptions,
  89. IEnvDataLoaderOptions,
  90. IGLTFLoaderOptions,
  91. IKeyframeLoaderOptions,
  92. IRawLoaderOptions,
  93. IAtlasLoaderOptions,
  94. TEventCallback,
  95. TDirection,
  96. Texture,
  97. UniformDescriptor,
  98. UniformBlock,
  99. VertexLayout,
  100. TCameraBackground,
  101. TTrackMode,
  102. EVertexFormat,
  103. EVertexStep,
  104. EIndexType,
  105. ETextureType,
  106. ETextureFormat,
  107. EWrapMode,
  108. EFilterMode,
  109. EUniformType,
  110. ECullMode,
  111. EFaceWinding,
  112. ECompareFunc,
  113. EStencilOp,
  114. EBlendFactor,
  115. EBlendEquation,
  116. EColorMask,
  117. EPixelType,
  118. ELoadAction,
  119. EDataModelType,
  120. EMeshRenderType,
  121. EPrimitiveType,
  122. EShadowMode,
  123. EShadowFitMode,
  124. EVertexLayoutUsage,
  125. EVertexBatchOperator,
  126. EAnimationBlendType,
  127. EUseDefaultAddedAction,
  128. EUseDefaultRetainedAction,
  129. EUseDefaultRemovedAction,
  130. EEventType,
  131. EShapeType,
  132. ECapsuleShapeDirection
  133. } from 'XrFrame/xrFrameSystem';
  134. export type Component<IData> = xrFrameSystem.Component<IData>;
  135. export type Element = xrFrameSystem.Element;
  136. export type EventManager = xrFrameSystem.EventManager;
  137. export type Effect = xrFrameSystem.Effect;
  138. export type Geometry = xrFrameSystem.Geometry;
  139. export type Material = xrFrameSystem.Material;
  140. export type VideoTexture = xrFrameSystem.VideoTexture;
  141. export type RenderTexture = xrFrameSystem.RenderTexture;
  142. export type GLTFModel = xrFrameSystem.GLTFModel;
  143. export type EnvData = xrFrameSystem.EnvData;
  144. export type Animation = xrFrameSystem.Animation;
  145. export type KeyframeAnimation = xrFrameSystem.KeyframeAnimation;
  146. export type Atlas = xrFrameSystem.Atlas;
  147. export type PostProcess = xrFrameSystem.PostProcess;
  148. export type Vector2 = xrFrameSystem.Vector2;
  149. export type Vector3 = xrFrameSystem.Vector3;
  150. export type Vector4 = xrFrameSystem.Vector4;
  151. export type Quaternion = xrFrameSystem.Quaternion;
  152. export type Matrix3 = xrFrameSystem.Matrix3;
  153. export type Matrix4 = xrFrameSystem.Matrix4;
  154. export type Color = xrFrameSystem.Color;
  155. export type OBB = xrFrameSystem.OBB;
  156. export type BoundBall = xrFrameSystem.BoundBall;
  157. export type BoundBox = xrFrameSystem.BoundBox;
  158. export type Spherical = xrFrameSystem.Spherical;
  159. export type Transform = xrFrameSystem.Transform;
  160. export type AssetLoad = xrFrameSystem.AssetLoad;
  161. export type Assets = xrFrameSystem.Assets;
  162. export type Camera = xrFrameSystem.Camera;
  163. export type GLTF = xrFrameSystem.GLTF;
  164. export type Light = xrFrameSystem.Light;
  165. export type AssetMaterial = xrFrameSystem.AssetMaterial;
  166. export type Mesh = xrFrameSystem.Mesh;
  167. export type Text = xrFrameSystem.Text;
  168. export type Particle = xrFrameSystem.Particle;
  169. export type AssetRenderTexture = xrFrameSystem.AssetRenderTexture;
  170. export type Env = xrFrameSystem.Env;
  171. export type Animator = xrFrameSystem.Animator;
  172. export type CameraOrbitControl = xrFrameSystem.CameraOrbitControl;
  173. export type ARTracker = xrFrameSystem.ARTracker;
  174. export type Shape = xrFrameSystem.Shape;
  175. export type SphereShape = xrFrameSystem.SphereShape;
  176. export type MeshShape = xrFrameSystem.MeshShape;
  177. export type CapsuleShape = xrFrameSystem.CapsuleShape;
  178. export type CubeShape = xrFrameSystem.CubeShape;
  179. export type ShapeGizmos = xrFrameSystem.ShapeGizmos;
  180. export type AssetPostProcess = xrFrameSystem.AssetPostProcess;
  181. export type Scene = xrFrameSystem.Scene;
  182. export type XRNode = xrFrameSystem.XRNode;
  183. export type XRShadow = xrFrameSystem.XRShadow;
  184. export type XRCamera = xrFrameSystem.XRCamera;
  185. export type XRMesh = xrFrameSystem.XRMesh;
  186. export type XRLight = xrFrameSystem.XRLight;
  187. export type XRGLTF = xrFrameSystem.XRGLTF;
  188. export type XRMaterial = xrFrameSystem.XRMaterial;
  189. export type XRAssetRenderTexture = xrFrameSystem.XRAssetRenderTexture;
  190. export type XRAssetLoad = xrFrameSystem.XRAssetLoad;
  191. export type XRAssets = xrFrameSystem.XRAssets;
  192. export type XREnv = xrFrameSystem.XREnv;
  193. export type XRARTracker = xrFrameSystem.XRARTracker;
  194. export type XRText = xrFrameSystem.XRText;
  195. export type XRParticle = xrFrameSystem.XRParticle;
  196. export type XRAssetPostProcess = xrFrameSystem.XRAssetPostProcess;
  197. export type AssetsSystem = xrFrameSystem.AssetsSystem;
  198. export type NodeSystem = xrFrameSystem.NodeSystem;
  199. export type TickSystem = xrFrameSystem.TickSystem;
  200. export type AnimationSystem = xrFrameSystem.AnimationSystem;
  201. export type VideoSystem = xrFrameSystem.VideoSystem;
  202. export type RenderSystem = xrFrameSystem.RenderSystem;
  203. export type PhysicsSystem = xrFrameSystem.PhysicsSystem;
  204. export type ARSystem = xrFrameSystem.ARSystem;
  205. export type ShareSystem = xrFrameSystem.ShareSystem;
  206. export type GizmoSystem = xrFrameSystem.GizmoSystem;
  207. export type TextureLoader = xrFrameSystem.TextureLoader;
  208. export type ImageLoader = xrFrameSystem.ImageLoader;
  209. export type CubeTextureLoader = xrFrameSystem.CubeTextureLoader;
  210. export type VideoTextureLoader = xrFrameSystem.VideoTextureLoader;
  211. export type EnvDataLoader = xrFrameSystem.EnvDataLoader;
  212. export type GlTFLoader = xrFrameSystem.GlTFLoader;
  213. export type KeyframeLoader = xrFrameSystem.KeyframeLoader;
  214. export type RawLoader = xrFrameSystem.RawLoader;
  215. export type AtlasLoader = xrFrameSystem.AtlasLoader
  216. export interface IXrFrameSystem {
  217. registerComponent: typeof xrFrameSystem.registerComponent;
  218. registerElement: typeof xrFrameSystem.registerElement;
  219. registerDataValue: typeof xrFrameSystem.registerDataValue;
  220. isTextureWrapper: typeof xrFrameSystem.isTextureWrapper;
  221. registerEffect: typeof xrFrameSystem.registerEffect;
  222. registerGeometry: typeof xrFrameSystem.registerGeometry;
  223. registerTexture: typeof xrFrameSystem.registerTexture;
  224. registerMaterial: typeof xrFrameSystem.registerMaterial;
  225. registerUniformDesc: typeof xrFrameSystem.registerUniformDesc;
  226. registerVertexDataDesc: typeof xrFrameSystem.registerVertexDataDesc;
  227. registerVertexLayout: typeof xrFrameSystem.registerVertexLayout;
  228. Component: typeof xrFrameSystem.Component;
  229. Element: typeof xrFrameSystem.Element;
  230. EventManager: typeof xrFrameSystem.EventManager;
  231. Effect: typeof xrFrameSystem.Effect;
  232. Geometry: typeof xrFrameSystem.Geometry;
  233. Material: typeof xrFrameSystem.Material;
  234. VideoTexture: typeof xrFrameSystem.VideoTexture;
  235. RenderTexture: typeof xrFrameSystem.RenderTexture;
  236. GLTFModel: typeof xrFrameSystem.GLTFModel;
  237. EnvData: typeof xrFrameSystem.EnvData;
  238. Animation: typeof xrFrameSystem.Animation;
  239. KeyframeAnimation: typeof xrFrameSystem.KeyframeAnimation;
  240. Atlas: typeof xrFrameSystem.Atlas;
  241. PostProcess: typeof xrFrameSystem.PostProcess;
  242. Vector2: typeof xrFrameSystem.Vector2;
  243. Vector3: typeof xrFrameSystem.Vector3;
  244. Vector4: typeof xrFrameSystem.Vector4;
  245. Quaternion: typeof xrFrameSystem.Quaternion;
  246. Matrix3: typeof xrFrameSystem.Matrix3;
  247. Matrix4: typeof xrFrameSystem.Matrix4;
  248. Color: typeof xrFrameSystem.Color;
  249. OBB: typeof xrFrameSystem.OBB;
  250. BoundBall: typeof xrFrameSystem.BoundBall;
  251. BoundBox: typeof xrFrameSystem.BoundBox;
  252. Spherical: typeof xrFrameSystem.Spherical;
  253. Transform: typeof xrFrameSystem.Transform;
  254. AssetLoad: typeof xrFrameSystem.AssetLoad;
  255. Assets: typeof xrFrameSystem.Assets;
  256. Camera: typeof xrFrameSystem.Camera;
  257. GLTF: typeof xrFrameSystem.GLTF;
  258. Light: typeof xrFrameSystem.Light;
  259. AssetMaterial: typeof xrFrameSystem.AssetMaterial;
  260. Mesh: typeof xrFrameSystem.Mesh;
  261. Text: typeof xrFrameSystem.Text;
  262. Particle: typeof xrFrameSystem.Particle;
  263. AssetRenderTexture: typeof xrFrameSystem.AssetRenderTexture;
  264. Env: typeof xrFrameSystem.Env;
  265. Animator: typeof xrFrameSystem.Animator;
  266. CameraOrbitControl: typeof xrFrameSystem.CameraOrbitControl;
  267. ARTracker: typeof xrFrameSystem.ARTracker;
  268. Shape: typeof xrFrameSystem.Shape;
  269. SphereShape: typeof xrFrameSystem.SphereShape;
  270. MeshShape: typeof xrFrameSystem.MeshShape;
  271. CapsuleShape: typeof xrFrameSystem.CapsuleShape;
  272. CubeShape: typeof xrFrameSystem.CubeShape;
  273. ShapeGizmos: typeof xrFrameSystem.ShapeGizmos;
  274. AssetPostProcess: typeof xrFrameSystem.AssetPostProcess;
  275. Scene: typeof xrFrameSystem.Scene;
  276. XRNode: typeof xrFrameSystem.XRNode;
  277. XRShadow: typeof xrFrameSystem.XRShadow;
  278. XRCamera: typeof xrFrameSystem.XRCamera;
  279. XRMesh: typeof xrFrameSystem.XRMesh;
  280. XRLight: typeof xrFrameSystem.XRLight;
  281. XRGLTF: typeof xrFrameSystem.XRGLTF;
  282. XRMaterial: typeof xrFrameSystem.XRMaterial;
  283. XRAssetRenderTexture: typeof xrFrameSystem.XRAssetRenderTexture;
  284. XRAssetLoad: typeof xrFrameSystem.XRAssetLoad;
  285. XRAssets: typeof xrFrameSystem.XRAssets;
  286. XREnv: typeof xrFrameSystem.XREnv;
  287. XRARTracker: typeof xrFrameSystem.XRARTracker;
  288. XRText: typeof xrFrameSystem.XRText;
  289. XRParticle: typeof xrFrameSystem.XRParticle;
  290. XRAssetPostProcess: typeof xrFrameSystem.XRAssetPostProcess;
  291. AssetsSystem: typeof xrFrameSystem.AssetsSystem;
  292. NodeSystem: typeof xrFrameSystem.NodeSystem;
  293. TickSystem: typeof xrFrameSystem.TickSystem;
  294. AnimationSystem: typeof xrFrameSystem.AnimationSystem;
  295. VideoSystem: typeof xrFrameSystem.VideoSystem;
  296. RenderSystem: typeof xrFrameSystem.RenderSystem;
  297. PhysicsSystem: typeof xrFrameSystem.PhysicsSystem;
  298. ARSystem: typeof xrFrameSystem.ARSystem;
  299. ShareSystem: typeof xrFrameSystem.ShareSystem;
  300. GizmoSystem: typeof xrFrameSystem.GizmoSystem;
  301. TextureLoader: typeof xrFrameSystem.TextureLoader;
  302. ImageLoader: typeof xrFrameSystem.ImageLoader;
  303. CubeTextureLoader: typeof xrFrameSystem.CubeTextureLoader;
  304. VideoTextureLoader: typeof xrFrameSystem.VideoTextureLoader;
  305. EnvDataLoader: typeof xrFrameSystem.EnvDataLoader;
  306. GlTFLoader: typeof xrFrameSystem.GlTFLoader;
  307. KeyframeLoader: typeof xrFrameSystem.KeyframeLoader;
  308. RawLoader: typeof xrFrameSystem.RawLoader;
  309. AtlasLoader: typeof xrFrameSystem.AtlasLoader;
  310. EVertexFormat: typeof xrFrameSystem.EVertexFormat;
  311. EVertexStep: typeof xrFrameSystem.EVertexStep;
  312. EIndexType: typeof xrFrameSystem.EIndexType;
  313. ETextureType: typeof xrFrameSystem.ETextureType;
  314. ETextureFormat: typeof xrFrameSystem.ETextureFormat;
  315. EWrapMode: typeof xrFrameSystem.EWrapMode;
  316. EFilterMode: typeof xrFrameSystem.EFilterMode;
  317. EUniformType: typeof xrFrameSystem.EUniformType;
  318. ECullMode: typeof xrFrameSystem.ECullMode;
  319. EFaceWinding: typeof xrFrameSystem.EFaceWinding;
  320. ECompareFunc: typeof xrFrameSystem.ECompareFunc;
  321. EStencilOp: typeof xrFrameSystem.EStencilOp;
  322. EBlendFactor: typeof xrFrameSystem.EBlendFactor;
  323. EBlendEquation: typeof xrFrameSystem.EBlendEquation;
  324. EColorMask: typeof xrFrameSystem.EColorMask;
  325. EPixelType: typeof xrFrameSystem.EPixelType;
  326. ELoadAction: typeof xrFrameSystem.ELoadAction;
  327. EDataModelType: typeof xrFrameSystem.EDataModelType;
  328. EMeshRenderType: typeof xrFrameSystem.EMeshRenderType;
  329. EPrimitiveType: typeof xrFrameSystem.EPrimitiveType;
  330. EShadowMode: typeof xrFrameSystem.EShadowMode;
  331. EShadowFitMode: typeof xrFrameSystem.EShadowFitMode;
  332. EVertexLayoutUsage: typeof xrFrameSystem.EVertexLayoutUsage;
  333. EVertexBatchOperator: typeof xrFrameSystem.EVertexBatchOperator;
  334. EAnimationBlendType: typeof xrFrameSystem.EAnimationBlendType;
  335. EUseDefaultAddedAction: typeof xrFrameSystem.EUseDefaultAddedAction;
  336. EUseDefaultRetainedAction: typeof xrFrameSystem.EUseDefaultRetainedAction;
  337. EUseDefaultRemovedAction: typeof xrFrameSystem.EUseDefaultRemovedAction;
  338. EEventType: typeof xrFrameSystem.EEventType;
  339. EShapeType: typeof xrFrameSystem.EShapeType;
  340. ECapsuleShapeDirection: typeof xrFrameSystem.ECapsuleShapeDirection;
  341. useParamsEaseFuncs: typeof xrFrameSystem.useParamsEaseFuncs;
  342. noneParamsEaseFuncs: typeof xrFrameSystem.noneParamsEaseFuncs
  343. TransformSchema: IComponentSchema;
  344. AssetLoadSchema: IComponentSchema;
  345. AssetsSchema: IComponentSchema;
  346. CameraSchema: IComponentSchema;
  347. GLTFSchema: IComponentSchema;
  348. LightSchema: IComponentSchema;
  349. AssetMaterialSchema: IComponentSchema;
  350. MeshSchema: IComponentSchema;
  351. TextSchema: IComponentSchema;
  352. AssetRenderTextureSchema: IComponentSchema;
  353. EnvSchema: IComponentSchema;
  354. AnimatorSchema: IComponentSchema;
  355. CameraOrbitControlSchema: IComponentSchema;
  356. ARTrackSchema: IComponentSchema;
  357. SphereShapeSchema: IComponentSchema;
  358. MeshShapeSchema: IComponentSchema;
  359. CapsuleShapeSchema: IComponentSchema;
  360. CubeShapeSchema: IComponentSchema;
  361. ParticleSchema: IComponentSchema;
  362. RenderSystemSchema: IComponentSchema;
  363. ARSystemSchema: IComponentSchema
  364. BasicDefaultComponents: IEntityComponents;
  365. SceneDefaultComponents: IEntityComponents;
  366. NodeDefaultComponents: IEntityComponents;
  367. ShadowDefaultComponents: IEntityComponents;
  368. CameraDefaultComponents: IEntityComponents;
  369. MeshDefaultComponents: IEntityComponents;
  370. LightDefaultComponents: IEntityComponents;
  371. GLTFDefaultComponents: IEntityComponents;
  372. AssetMaterialDefaultComponents: IEntityComponents;
  373. AssetRenderTextureDefaultComponents: IEntityComponents;
  374. AssetsDefaultComponents: IEntityComponents;
  375. EnvDefaultComponents: IEntityComponents;
  376. ARTrackerDefaultComponents: IEntityComponents;
  377. TextDefaultComponents: IEntityComponents;
  378. ParticleDefaultComponents: IEntityComponents;
  379. AssetPostProcessDefaultComponents: IEntityComponents
  380. BasicDataMapping: {[key: string]: string[]};
  381. SceneDataMapping: {[key: string]: string[]};
  382. NodeDataMapping: {[key: string]: string[]};
  383. ShadowDataMapping: {[key: string]: string[]};
  384. CameraDataMapping: {[key: string]: string[]};
  385. MeshDataMapping: {[key: string]: string[]};
  386. LightDataMapping: {[key: string]: string[]};
  387. GLTFDataMapping: {[key: string]: string[]};
  388. AssetMaterialDataMapping: {[key: string]: string[]};
  389. AssetRenderTextureDataMapping: {[key: string]: string[]};
  390. AssetLoadDataMapping: {[key: string]: string[]};
  391. EnvDataMapping: {[key: string]: string[]};
  392. ARTrackerDataMapping: {[key: string]: string[]};
  393. TextDataMapping: {[key: string]: string[]};
  394. ParticleDataMapping: {[key: string]: string[]};
  395. AssetPostProcessDataMapping: {[key: string]: string[]}
  396. }
  397. }
  398. declare module 'XrFrame/xrFrameSystem' {
  399. /**
  400. * xrFrameSystem.ts
  401. *
  402. * * @Date : 4/28/2022, 5:02:28 PM
  403. */
  404. import { Kanata } from 'XrFrame/ext';
  405. export { default as Component, registerComponent, IComponentSchema } from 'XrFrame/core/Component';
  406. export { default as Element, registerElement, IEntityComponents, BasicDefaultComponents, BasicDataMapping } from 'XrFrame/core/Element';
  407. export { registerDataValue, IDataValueHandler, ITextureWrapper, isTextureWrapper } from 'XrFrame/core/DataValue';
  408. export { default as EventManager, TEventCallback } from 'XrFrame/core/EventManager';
  409. export * from 'XrFrame/components';
  410. export * from 'XrFrame/elements';
  411. export * from 'XrFrame/systems';
  412. export * from 'XrFrame/loader';
  413. export { default as Effect, IEffectAsset, IRenderStates } from 'XrFrame/assets/Effect';
  414. export { default as Geometry, ISubMesh } from 'XrFrame/assets/Geometry';
  415. export { default as Material } from 'XrFrame/assets/Material';
  416. export { default as VideoTexture, IVideoTextureOptions } from 'XrFrame/assets/VideoTexture';
  417. export { default as RenderTexture, IRenderTarget, IRenderTextureOptions } from 'XrFrame/assets/RenderTexture';
  418. export { default as GLTFModel, IGLTFModelOptions } from 'XrFrame/assets/GLTFModel';
  419. export { default as EnvData, IEnvDataOptions } from 'XrFrame/assets/EnvData';
  420. export { default as Animation, TDirection } from 'XrFrame/animation/Animation';
  421. export { default as KeyframeAnimation, IKeyframeAnimationData, IKeyframeAnimationInfo, IKeyframeAnimationOptions } from 'XrFrame/animation/KeyframeAnimation';
  422. export { default as Atlas, IAtlasOptions, IAtlasCreationOptions } from 'XrFrame/assets/Atlas';
  423. export { default as PostProcess, IPostProcessOptions } from 'XrFrame/assets/PostProcess';
  424. export { registerEffect, registerGeometry, registerTexture, registerMaterial, registerUniformDesc, registerVertexDataDesc, registerVertexLayout } from 'XrFrame/assets/factories';
  425. export { useParamsEaseFuncs, noneParamsEaseFuncs } from 'XrFrame/assets/easeFunctions';
  426. export { default as Vector2 } from 'XrFrame/math/vector2';
  427. export { default as Vector3 } from 'XrFrame/math/vector3';
  428. export { default as Vector4 } from 'XrFrame/math/vector4';
  429. export { default as Quaternion } from 'XrFrame/math/quaternion';
  430. export { default as Matrix3 } from 'XrFrame/math/matrix3';
  431. export { default as Matrix4 } from 'XrFrame/math/matrix4';
  432. export { default as Color } from 'XrFrame/math/color';
  433. export { default as OBB } from 'XrFrame/math/OBB';
  434. export { default as BoundBall } from 'XrFrame/math/boundBall';
  435. export { default as BoundBox } from 'XrFrame/math/boundBox';
  436. export { default as Spherical } from 'XrFrame/math/Spherical';
  437. export { ITextureOptions, IEngineSettings, EVertexFormat, EVertexStep, EIndexType, ETextureType, ETextureFormat, EWrapMode, EFilterMode, EUniformType, ECullMode, EFaceWinding, ECompareFunc, EStencilOp, EBlendFactor, EBlendEquation, EColorMask, EPixelType, ELoadAction, EDataModelType, EMeshRenderType, EPrimitiveType, EShadowMode, EShadowFitMode, EVertexLayoutUsage, EVertexBatchOperator, EAnimationBlendType, EUseDefaultAddedAction, EUseDefaultRetainedAction, EUseDefaultRemovedAction, IHandle, IVertexLayoutOptions, IVertexDataDescriptorOptions, IUniformDescriptorOptions, IImage, IRealDownloader, IDownloader, IFontSetting, IFeatures, IRect, IViewAction, IView, IAttachment, IRenderPassDescriptor, EEventType, IGlyphInfo, IEventBridge, INativeMap, ILongIntNativeMap } from 'XrFrame/kanata/lib/kanata';
  438. export type Texture = Kanata.Texture;
  439. export type UniformDescriptor = Kanata.UniformDescriptor;
  440. export type UniformBlock = Kanata.UniformBlock;
  441. export type VertexLayout = Kanata.VertexLayout;
  442. }
  443. declare module 'XrFrame/ext' {
  444. /**
  445. * ext.ts
  446. *
  447. * * @Date : 2022/3/17下午1:43:48
  448. */
  449. import * as Kanata from 'XrFrame/kanata/lib/kanata';
  450. const exparser: any;
  451. type Scene = import('XrFrame/core/Scene').default;
  452. const _wx: any;
  453. const Phys3D: any;
  454. function addKanata(scene: Scene, kanata: Kanata.IKanataInstance): void;
  455. function removeKanata(scene: Scene): void;
  456. function getKanata(scene: Scene): Kanata.IKanataInstance;
  457. function __getKanataSuperHackDontUseIt(): Kanata.IKanataInstance;
  458. export { Kanata, exparser, Phys3D, _wx, addKanata, removeKanata, getKanata, __getKanataSuperHackDontUseIt };
  459. }
  460. declare module 'XrFrame/core/Component' {
  461. type Element = import('XrFrame/core/Element').default;
  462. /**
  463. * `Component`属性的注解接口。
  464. *
  465. * `key`是可以写在组件对应于`xml`中的属性的名字。
  466. * `type`是属性的类型,由{@link registerDataValue}注册。
  467. * 可选的`defaultValue`可以定义默认值。
  468. */
  469. export interface IComponentSchema {
  470. [key: string]: {
  471. type: string;
  472. defaultValue?: any;
  473. };
  474. }
  475. /**
  476. * 组件,系统核心之一。
  477. *
  478. * 组件就是`wxml`的标签上写的那些`attribute`,比如`<xr-element transform="position: 1 1 1" />`中,`transform`就是一个组件,`position`是它的一个属性。
  479. * 这些属性可以在`schema`中被定义,变化时会触发对应的生命周期。
  480. * 自定义组件最后使用{@link registerComponent},组件的属性可以使用代理规则来简化,比如以上的标签可以简化为`<xr-element position="1 1 1" />`,详见{@link Element}。
  481. *
  482. * @template IData 组件数据的类型,应当和`schema`中一致,用于TS类型推断。
  483. */
  484. export default class Component<IData> {
  485. /**
  486. * @internal
  487. */
  488. static TYPE: string;
  489. /**
  490. * @internal
  491. */
  492. static SPLIT_DATA(dataStr: string): {
  493. [key: string]: string;
  494. };
  495. /**
  496. * 自定义组件的`schema`。
  497. */
  498. readonly schema: IComponentSchema;
  499. /**
  500. * 自定义组件的更新优先级。
  501. */
  502. readonly priority: number;
  503. __DATA_TYPE: IData;
  504. protected _version: number;
  505. protected _currentData: IData;
  506. /**
  507. * 挂载的元素。
  508. */
  509. get el(): import('XrFrame/core/Element').default;
  510. /**
  511. * 当前场景。
  512. */
  513. get scene(): import('XrFrame/core/Scene').default;
  514. /**
  515. * 当前版本,每次有数据更新都会增加,可以用作和其他组件合作的依据。
  516. */
  517. get version(): number;
  518. /**
  519. * 不通过`xml`而是直接设置`data`,注意值的类型需要和`schema`中一致。
  520. */
  521. setData(data: Partial<IData>): void;
  522. /**
  523. * 设置一个数据。
  524. */
  525. setDataOne<T extends keyof IData>(key: T, value: IData[T]): void;
  526. /**
  527. * 获取一个当前值。
  528. */
  529. getData<T extends keyof IData>(key: T): IData[T];
  530. /**
  531. * @internal
  532. */
  533. /**
  534. * @internal
  535. */
  536. /**
  537. * @internal
  538. */
  539. /**
  540. * @internal
  541. */
  542. /**
  543. * @internal
  544. */
  545. /**
  546. * @internal
  547. */
  548. /**
  549. * @internal
  550. */
  551. /**
  552. * @internal
  553. */
  554. /**
  555. * @internal
  556. */
  557. /**
  558. * 所挂载的`element`被挂载到场景时触发的回调。
  559. */
  560. onAdd(parent: Element, data: IData): void;
  561. /**
  562. * 数据更新时触发的回调。
  563. */
  564. onUpdate(data: IData, preData: IData): void;
  565. /**
  566. * 渲染每帧触发的回调。
  567. */
  568. onTick(deltaTime: number, data: IData): void;
  569. /**
  570. * 所挂载的`element`从父节点`parent`被移除时,或者自己从`element`上呗移除时,触发的回调。
  571. * 一般用于消除功能的运作。
  572. */
  573. onRemove(parent: Element, data: IData): void;
  574. /**
  575. * 从被挂载的`element`上被移除,或是`element`被销毁时,触发的回调。
  576. * 一般用于释放持有的资源。
  577. */
  578. onRelease(data: IData): void;
  579. }
  580. /**
  581. * @internal
  582. */
  583. export function getComponent(type: string): new () => Component<any>;
  584. /**
  585. * 向系统中注册一个组件,然后可以在`xml`中使用。
  586. */
  587. export function registerComponent(type: string, clz: new () => Component<any>): void;
  588. export {};
  589. }
  590. declare module 'XrFrame/core/Element' {
  591. /**
  592. * Element.ts
  593. *
  594. * * @Date : 2022/4/1上午10:34:06
  595. */
  596. import Component from 'XrFrame/core/Component';
  597. import EventManager, { TFrameworkEventTrigger } from 'XrFrame/core/EventManager';
  598. /**
  599. * `Element`的默认组件集接口。
  600. *
  601. * `name`是组件注册时的名字,`key`是要默认设置的组件的属性名字,值是默认值,但应当和`xml`中一致,为**字符串**。
  602. */
  603. export interface IEntityComponents {
  604. [name: string]: {
  605. [key: string]: string;
  606. };
  607. }
  608. /**
  609. * 空的默认组件集。
  610. */
  611. export const BasicDefaultComponents: IEntityComponents;
  612. /**
  613. * 空的默认组件映射。
  614. */
  615. export const BasicDataMapping: {
  616. [key: string]: string[];
  617. };
  618. /**
  619. * 元素,系统核心之一。
  620. *
  621. * 本质上就是对应于`xml`中标签,所有的标签的实现都是继承自`Element`的,其一般不包含逻辑,仅仅是通过`defaultComponents`和`dataMapping`定义组件的集合与映射。
  622. * 自定义元素最后使用{#@link registerElement}。
  623. */
  624. export default class Element {
  625. static TYPE: string;
  626. /**
  627. * `Element`的默认组件集合,详见{@link IEntityComponents}。
  628. */
  629. readonly defaultComponents: IEntityComponents;
  630. /**
  631. * `Element`的数据映射。它是为了给组件的属性提供一个方便的用法,比如:
  632. * ```ts
  633. * {
  634. * position: [transform, position]
  635. * }
  636. * ```
  637. * 就是将`xml`中写在这个`Element`的`position`直接映射到了`transform`组件的`position`属性上。
  638. *
  639. * **通常来讲,所有的驼峰如`nodeId`都会被映射为小写加中划线`node-id`**。
  640. */
  641. readonly dataMapping: {
  642. [key: string]: string[];
  643. };
  644. /**
  645. * @internal
  646. */
  647. readonly neverTick: boolean;
  648. /**
  649. * 名字,写在`xml`上的那个`name`,不唯一。
  650. */
  651. get name(): string;
  652. set name(value: string);
  653. /**
  654. * @internal
  655. */
  656. /**
  657. * 元素是否在`xml`中,若是`xr-shadow`下的节点,则为`false`。
  658. */
  659. get inXML(): boolean;
  660. /**
  661. * 场景实例。
  662. */
  663. get scene(): import('XrFrame/core/Scene').default;
  664. /**
  665. * 父元素。
  666. */
  667. get parent(): Element;
  668. /**
  669. * 事件管理器。
  670. */
  671. get event(): EventManager;
  672. constructor(_type: string, triggerEvent: TFrameworkEventTrigger);
  673. /**
  674. * 获取第`index`个子元素。
  675. */
  676. getChildAtIndex<T extends Element = Element>(index: number): T;
  677. /**
  678. * 通过`filter`获取子元素。
  679. */
  680. getChildByFilter<T extends Element = Element>(filter: (child: Element) => boolean): T;
  681. /**
  682. * 通过`filter`获取子元素列表。
  683. */
  684. getChildrenByFilter(filter: (child: Element) => boolean): Element[];
  685. /**
  686. * 通过元素的类获取子元素。
  687. */
  688. getChildByClass<T extends Element = Element>(clz: new (...args: any[]) => T): T;
  689. /**
  690. * 通过元素的名字`name`获取子元素。
  691. */
  692. getChildByName<T extends Element = Element>(name: string): T;
  693. /**
  694. * 通过元素的名字`name`获取子元素们。
  695. */
  696. getChildrenByName(name: string): Element[];
  697. /**
  698. * 递归遍历元素的所有子孙节点。
  699. */
  700. dfs<T extends any>(callback: (element: Element, params?: T) => T, defaultParams?: T, excludeRoot?: boolean, stop?: (element: Element, params?: T) => boolean): void;
  701. /**
  702. * 手动添加一个`Component`。
  703. */
  704. addComponent<T extends Component<any>>(clz: new () => T, options?: T['__DATA_TYPE']): T;
  705. /**
  706. * 获取一个`Component`,可以使用类或者名字获取。
  707. */
  708. getComponent<T extends Component<any>>(clzName: string): T;
  709. getComponent<T extends Component<any>>(clz: new () => T): T;
  710. /**
  711. * 手动移除一个`Component`,注意保证其不在`xml`上。
  712. */
  713. removeComponent(clz: new () => Component<any>): void;
  714. /**
  715. * 设置一个属性,对应于`xml`标签中的那些属性,值为字符串。
  716. * **一般建议使用`component`的`setData`方法**!!!
  717. */
  718. setAttribute(name: string, value: string): void;
  719. /**
  720. * @internal
  721. */
  722. /**
  723. * @internal
  724. */
  725. /**
  726. * @internal
  727. */
  728. /**
  729. * @internal
  730. */
  731. _associateValue(_v: any): void;
  732. /**
  733. * 手动添加一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。
  734. */
  735. addChild(child: Element): void;
  736. /**
  737. * 手动移除一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。
  738. */
  739. removeChild(child: Element): void;
  740. /**
  741. * 仅限自己创建的节点使用,否则后果自负。
  742. */
  743. setId(id: string): void;
  744. /**
  745. * 仅限自己创建的节点使用,否则后果自负。
  746. */
  747. release(): void;
  748. /**
  749. * @internal
  750. */
  751. _appendChild(_child: Element, custom?: boolean): void;
  752. /**
  753. * @internal
  754. */
  755. _removeChild(_child: Element, _index?: number, custom?: boolean): void;
  756. /**
  757. * @internal
  758. */
  759. _insertBefore(_child: Element, _before?: Element, _index?: number): void;
  760. /**
  761. * @internal
  762. */
  763. _replaceChild(_child: Element, _oldChild?: Element, _index?: number): void;
  764. /**
  765. * @internal
  766. */
  767. _spliceBefore(_before: number | Element, _deleteCount: number, _list: Element): void;
  768. /**
  769. * @internal
  770. */
  771. _spliceAppend(_list: Element): void;
  772. /**
  773. * @internal
  774. */
  775. _spliceRemove(_before: Element, _deleteCount: number): void;
  776. /**
  777. * @internal
  778. */
  779. _setId(_id: string): void;
  780. /**
  781. * @internal
  782. */
  783. _setStyleScope(_styleScope: number): void;
  784. /**
  785. * @internal
  786. */
  787. _setStyle(_styleText: string): void;
  788. /**
  789. * @internal
  790. */
  791. _addClass(_elementClass: string, _styleScope?: number): void;
  792. /**
  793. * @internal
  794. */
  795. _removeClass(_elementClass: string, _styleScope?: number): void;
  796. /**
  797. * @internal
  798. */
  799. /**
  800. * @internal
  801. */
  802. _setAttribute(_name: string, _value: string): void;
  803. _removeAttribute(_name: string): void;
  804. _setText(_content: string): void;
  805. }
  806. export function getElement(type: string): typeof Element;
  807. /**
  808. * 注册一个自定义元素。
  809. * 注意注册的`type`在`xml`中使用时需要加上`xr-`前缀,比如注册`custom`类型的元素,使用时需要时`xr-custom`。
  810. */
  811. export function registerElement(type: string, clz: typeof Element): void;
  812. }
  813. declare module 'XrFrame/core/DataValue' {
  814. /**
  815. * DataValue.ts
  816. *
  817. * * @Date : 2022/3/17下午2:22:19
  818. */
  819. import { Kanata } from 'XrFrame/ext';
  820. import Scene from 'XrFrame/core/Scene';
  821. /**
  822. * 详见{@link registerDataValue}。
  823. */
  824. export interface IDataValueHandler<TDataValue> {
  825. create(value: string, defaultValue: any, scene: Scene): TDataValue;
  826. }
  827. export interface ITextureWrapper {
  828. texture: Kanata.Texture;
  829. }
  830. export function isTextureWrapper(value: any): value is ITextureWrapper;
  831. export function isDataValueHandlerExisted(type: string): boolean;
  832. /**
  833. * 为组件在`xml`中写的属性值按类型注册解析器,由于`xml`传入的值全部都是字符串,所以需要解析,比如:
  834. * ```ts
  835. * registerDataValue('number', {create: (value: string, defaultValue: any, scene: Scene) => {
  836. * return value === undefined ? defaultValue : parseFloat(value));
  837. * }});
  838. * ```
  839. * 就是注册了`number`类型,后续在组件的`schema`中写的`number`类型数据,就会走这个解析器。
  840. * **注意最后一个参数`scene`可以用于获取资源等,比如`scene.assets.getAssetWithState(type, value, defaultValue)`。**
  841. * **如果是被资源加载器加载的资源,则会在资源加载器注册时自动注册数据类型,详见{@link AssetLoader}**。
  842. *
  843. * 已经注册的类型可见[组件数据解析](../../../component/xr-frame/core/data-values)。
  844. */
  845. export function registerDataValue<TDataValue>(type: string, handler: IDataValueHandler<TDataValue>): void;
  846. export function parseDataValue<TDataValue>(type: string, value: string, defaultValue: any, scene: Scene): TDataValue;
  847. }
  848. declare module 'XrFrame/core/EventManager' {
  849. /**
  850. * EventManager.ts
  851. *
  852. * * @Date : 2022/3/17下午3:54:03
  853. */
  854. import Observable from 'XrFrame/core/Observable';
  855. type Element = import('XrFrame/core/Element').default;
  856. /**
  857. * 事件管理器的回调。
  858. */
  859. export type TEventCallback<TParams> = (params: TParams, sender: Element) => void;
  860. export type TFrameworkEventTrigger = (name: string, details: any, options: {
  861. bubbles?: boolean;
  862. composed?: boolean;
  863. capturePhase?: boolean;
  864. }) => void;
  865. /**
  866. * 事件管理器。
  867. *
  868. * 每个`Element`都有自己的事件管理器,通过参数可以触发到`xml`。
  869. */
  870. export default class EventManager {
  871. isEventManager: boolean;
  872. protected _observables: {
  873. [type: string]: Observable;
  874. };
  875. protected _caches: {
  876. [type: string]: {
  877. value: any;
  878. toXML: boolean;
  879. bubbles: boolean;
  880. };
  881. };
  882. constructor(_el: Element, _triggerElementEvent: TFrameworkEventTrigger);
  883. /**
  884. * 添加一个事件监听器。
  885. */
  886. add<TEvent = any>(type: string, callback: TEventCallback<TEvent>, priority?: number): this;
  887. /**
  888. * 添加一个事件监听器,触发一次后自动移除。
  889. */
  890. addOnce<TEvent = any>(type: string, callback: TEventCallback<TEvent>, priority?: number): this;
  891. /**
  892. * 移除一个事件监听器。
  893. */
  894. remove<TEvent = any>(type: string, callback: TEventCallback<TEvent>): this;
  895. /**
  896. * 判断一个事件是否被注册。
  897. */
  898. has(type: string): boolean;
  899. /**
  900. * 获取一个事件监听者数量。
  901. * @internal
  902. */
  903. getCount(type: string): number;
  904. /**
  905. * 清空某事件的所有监听器。
  906. */
  907. clear(type: string): this;
  908. /**
  909. * 触发一个事件。
  910. *
  911. * @param type 要触发的事件类型。
  912. * @param event 事件的值。
  913. * @param immediately 是否要将事件立即分发,如果不则会先缓存,之后在每一帧更新前统一分发,避免不必要的分发。
  914. * @param toXML 是否要派发到`xml`绑定的事件中。
  915. * @param bubbles 是否要进行事件冒泡。
  916. */
  917. trigger<TEvent = any>(type: string, event?: TEvent, immediately?: boolean, toXML?: boolean, bubbles?: boolean): this;
  918. /**
  919. * 分发某个缓存的事件,一般不需要自行触发。
  920. */
  921. flush(type: string): this;
  922. /**
  923. * 分发所有缓存的事件,一般不需要自行触发。
  924. */
  925. flushAll(): this;
  926. }
  927. export {};
  928. }
  929. declare module 'XrFrame/components' {
  930. export { default as Transform, ITransformData, TransformSchema } from 'XrFrame/components/Transform';
  931. export { default as AssetLoad, AssetLoadSchema } from 'XrFrame/components/AssetLoad';
  932. export { default as Assets, IAssetsData, AssetsSchema } from 'XrFrame/components/Assets';
  933. export { default as Camera, ICameraData, CameraSchema, TCameraBackground } from 'XrFrame/components/Camera';
  934. export { default as GLTF, IGLTFData, GLTFSchema } from 'XrFrame/components/GLTF';
  935. export { default as Light, ILightData, LightSchema } from 'XrFrame/components/Light';
  936. export { default as AssetMaterial, IAssetMaterialData, AssetMaterialSchema } from 'XrFrame/components/AssetMaterial';
  937. export { default as Mesh, IMeshData, MeshSchema } from 'XrFrame/components/Mesh';
  938. export { default as Text, ITextData, TextSchema } from 'XrFrame/components/Text';
  939. export { default as Particle } from 'XrFrame/components/particle/Particle';
  940. export { IParticleData, ParticleSchema } from 'XrFrame/components/particle/BasicParticle';
  941. export { default as AssetRenderTexture, IAssetRenderTextureData, AssetRenderTextureSchema } from 'XrFrame/components/AssetRenderTexture';
  942. export { default as Env, IEnvData, EnvSchema } from 'XrFrame/components/Env';
  943. export { default as Animator, IAnimatorData, AnimatorSchema, IAnimationPlayOptions, IAnimatorAutoPlay } from 'XrFrame/components/Animator';
  944. export { default as CameraOrbitControl, ICameraOrbitControlData, CameraOrbitControlSchema } from 'XrFrame/components/CameraOrbitControl';
  945. export { default as ARTracker, IARTrackerData, ARTrackSchema, TTrackMode, IARTrackerRawData } from 'XrFrame/components/ARTracker';
  946. export { default as Shape, IShapeData, EShapeType } from 'XrFrame/components/physics/Shape';
  947. export { default as SphereShape, ISphereShapeData, SphereShapeSchema } from 'XrFrame/components/physics/SphereShape';
  948. export { default as MeshShape, IMeshShapeData, MeshShapeSchema } from 'XrFrame/components/physics/MeshShape';
  949. export { default as CapsuleShape, ICapsuleShapeData, CapsuleShapeSchema, ECapsuleShapeDirection } from 'XrFrame/components/physics/CapsuleShape';
  950. export { default as CubeShape, ICubeShapeData, CubeShapeSchema } from 'XrFrame/components/physics/CubeShape';
  951. export { default as ShapeGizmos, IShapeGizmosData } from 'XrFrame/components/gizmo/ShapeGizmos';
  952. export { default as AssetPostProcess, IAssetPostProcessData } from 'XrFrame/components/AssetPostProcess';
  953. }
  954. declare module 'XrFrame/elements' {
  955. export { default as Scene, SceneDataMapping, SceneDefaultComponents } from 'XrFrame/core/Scene';
  956. export { default as XRNode, NodeDataMapping, NodeDefaultComponents } from 'XrFrame/elements/xr-node';
  957. export { default as XRShadow, ShadowDataMapping, ShadowDefaultComponents } from 'XrFrame/elements/xr-shadow';
  958. export { default as XRCamera, CameraDataMapping, CameraDefaultComponents } from 'XrFrame/elements/xr-camera';
  959. export { default as XRMesh, MeshDataMapping, MeshDefaultComponents } from 'XrFrame/elements/xr-mesh';
  960. export { default as XRLight, LightDataMapping, LightDefaultComponents } from 'XrFrame/elements/xr-light';
  961. export { default as XRGLTF, GLTFDataMapping, GLTFDefaultComponents } from 'XrFrame/elements/xr-gltf';
  962. export { default as XRMaterial, AssetMaterialDataMapping, AssetMaterialDefaultComponents } from 'XrFrame/elements/xr-asset-material';
  963. export { default as XRAssetRenderTexture, AssetRenderTextureDataMapping, AssetRenderTextureDefaultComponents } from 'XrFrame/elements/xr-asset-render-texture';
  964. export { default as XRAssetLoad, AssetLoadDataMapping } from 'XrFrame/elements/xr-asset-load';
  965. export { default as XRAssets, AssetsDefaultComponents } from 'XrFrame/elements/xr-assets';
  966. export { default as XREnv, EnvDataMapping, EnvDefaultComponents } from 'XrFrame/elements/xr-env';
  967. export { default as XRARTracker, ARTrackerDataMapping, ARTrackerDefaultComponents } from 'XrFrame/elements/xr-ar-tracker';
  968. export { default as XRText, TextDataMapping, TextDefaultComponents } from 'XrFrame/elements/xr-text';
  969. export { default as XRParticle, ParticleDataMapping, ParticleDefaultComponents } from 'XrFrame/elements/xr-particle';
  970. export { default as XRAssetPostProcess, AssetPostProcessDataMapping, AssetPostProcessDefaultComponents } from 'XrFrame/elements/xr-asset-post-process';
  971. }
  972. declare module 'XrFrame/systems' {
  973. export { default as AssetsSystem, IAssetsSystemData } from 'XrFrame/systems/AssetsSystem';
  974. export { default as NodeSystem, INodeSystemData } from 'XrFrame/systems/NodeSystem';
  975. export { default as TickSystem, ITickSystemData } from 'XrFrame/systems/TickSystem';
  976. export { default as AnimationSystem, IAnimationSystemData } from 'XrFrame/systems/AnimationSystem';
  977. export { default as VideoSystem, IVideoSystemData } from 'XrFrame/systems/VideoSystem';
  978. export { default as RenderSystem, IRenderSystemData, RenderSystemSchema } from 'XrFrame/systems/RenderSystem';
  979. export { default as PhysicsSystem, IPhysicsSystemData, IShapeDragEvent, IShapeTouchEvent } from 'XrFrame/systems/PhysicsSystem';
  980. export { default as ARSystem, IARSystemData, ARSystemSchema, IARRawData } from 'XrFrame/systems/ARSystem';
  981. export { default as ShareSystem, IShareSystemData, IShareCaptureOptions } from 'XrFrame/systems/ShareSystem';
  982. export { default as GizmoSystem, IGizmoSystemData } from 'XrFrame/systems/GizmoSystem';
  983. }
  984. declare module 'XrFrame/loader' {
  985. export { default as TextureLoader, ITextureLoaderOptions } from 'XrFrame/loader/TextureLoader';
  986. export { default as ImageLoader, IImageLoaderOptions } from 'XrFrame/loader/ImageLoader';
  987. export { default as CubeTextureLoader, ICubeTextureLoaderOptions } from 'XrFrame/loader/CubeTextureLoader';
  988. export { default as VideoTextureLoader, IVideoTextureLoaderOptions } from 'XrFrame/loader/VideoTextureLoader';
  989. export { default as EnvDataLoader, IEnvDataLoaderOptions } from 'XrFrame/loader/EnvDataLoader';
  990. export { default as GlTFLoader, IGLTFLoaderOptions } from 'XrFrame/loader/GlTFLoader';
  991. export { default as KeyframeLoader, IKeyframeLoaderOptions } from 'XrFrame/loader/KeyframeLoader';
  992. export { default as RawLoader, IRawLoaderOptions } from 'XrFrame/loader/RawLoader';
  993. export { default as AtlasLoader, IAtlasLoaderOptions } from 'XrFrame/loader/AtlasLoader';
  994. }
  995. declare module 'XrFrame/assets/Effect' {
  996. /**
  997. * Effect.ts
  998. *
  999. * * @Date : 2022/3/16下午4:44:48
  1000. */
  1001. import { ITextureWrapper } from 'XrFrame/core/DataValue';
  1002. import { Kanata } from 'XrFrame/ext';
  1003. import { IAssetWithState } from 'XrFrame/loader/types';
  1004. type Scene = import('XrFrame/core/Scene').default;
  1005. /**
  1006. * 支持定制的渲染状态。
  1007. *
  1008. * 大部分状态会定制的开发者应该看名字就懂,就不详细说明了。
  1009. */
  1010. export interface IRenderStates {
  1011. /**
  1012. * 渲染队列,大于等于`2500`为透明物体,否则为非透明物体。
  1013. */
  1014. renderQueue?: number;
  1015. blendOn?: boolean;
  1016. blendSrc?: Kanata.EBlendFactor;
  1017. blendSrcAlpha?: Kanata.EBlendFactor;
  1018. blendDst?: Kanata.EBlendFactor;
  1019. blendDstAlpha?: Kanata.EBlendFactor;
  1020. blendFunc?: Kanata.EBlendEquation;
  1021. cullOn?: boolean;
  1022. cullFace?: Kanata.ECullMode;
  1023. depthWrite?: boolean;
  1024. depthTestOn?: boolean;
  1025. depthTestComp?: Kanata.ECompareFunc;
  1026. stencilWriteMask?: number;
  1027. stencilTestOn?: boolean;
  1028. stencilRef?: number;
  1029. stencilReadMask?: number;
  1030. stencilComp?: Kanata.ECompareFunc;
  1031. stencilPass?: Kanata.EStencilOp;
  1032. stencilFail?: Kanata.EStencilOp;
  1033. stencilZFail?: Kanata.EStencilOp;
  1034. primitiveType?: Kanata.EPrimitiveType;
  1035. }
  1036. /**
  1037. * `Effect`资源的参数接口。
  1038. */
  1039. export interface IEffectAsset {
  1040. /**
  1041. * 名字,应当和`registerEffect`时的名字一致。
  1042. */
  1043. name: string;
  1044. /**
  1045. * 属性,传给UniformBlock的一部分。
  1046. */
  1047. properties?: Array<{
  1048. /**
  1049. * 属性名字。
  1050. */
  1051. key: string;
  1052. /**
  1053. * 属性类型。
  1054. */
  1055. type: Kanata.EUniformType;
  1056. /**
  1057. * 如果属性是一个数组,比如`FLOAT4`数组,可以指定数组大小。
  1058. */
  1059. num?: number;
  1060. /**
  1061. * 属性默认值,需要和类型匹配。
  1062. */
  1063. default: number[];
  1064. /**
  1065. * 属性对应的宏,当默认值被覆盖时,此宏开关会被开启,注意一定要有`WX_`前缀!
  1066. */
  1067. macro?: string;
  1068. }>;
  1069. /**
  1070. * 纹理资源,传给UniformBlock的另一部分。
  1071. */
  1072. images?: Array<{
  1073. /**
  1074. * 属性名字。
  1075. */
  1076. key: string;
  1077. /**
  1078. * 属性默认值,是`Texture`类型资源的`asset-id`。
  1079. */
  1080. default: string;
  1081. /**
  1082. * 属性对应的宏,当默认值被覆盖时,此宏开关会被开启,注意一定要有`WX_`前缀!
  1083. */
  1084. macro?: string;
  1085. }>;
  1086. /**
  1087. * 使用该`Effect`的`Material`的默认渲染队列。
  1088. * 透明物体需要大于`2500`!
  1089. */
  1090. defaultRenderQueue: number;
  1091. /**
  1092. * 渲染时的`passes`,渲染时指定的`lightMode`的每个`pass`都会被按顺序绘制。
  1093. */
  1094. passes: Array<{
  1095. /**
  1096. * 渲染的光照模式。
  1097. */
  1098. lightMode: 'ForwardBase' | 'ForwardAdd' | 'ShadowCaster' | 'PostProcess' | 'Skybox' | string;
  1099. /**
  1100. * 这个pass的渲染状态是否可以被`Material`覆盖。
  1101. */
  1102. useMaterialRenderStates: boolean;
  1103. /**
  1104. * 这个pass的默认渲染状态。
  1105. */
  1106. renderStates?: IRenderStates;
  1107. /**
  1108. * 这个pass的使用的`shader`在`shaders`中的索引,第一个是顶点着色器,第二个是片段着色器。
  1109. */
  1110. shaders: [number, number];
  1111. }>;
  1112. /**
  1113. * 所有的`shader`列表。
  1114. */
  1115. shaders: string[];
  1116. }
  1117. /**
  1118. * 特效资源,定义了渲染所需的大部分参数,被{@link Material}所引用。
  1119. */
  1120. export default class Effect {
  1121. protected _scene: Scene;
  1122. readonly description: IEffectAsset;
  1123. /**
  1124. * 获取名称。
  1125. */
  1126. get name(): string;
  1127. /**
  1128. * 获取场景实例。
  1129. */
  1130. get scene(): import('XrFrame/core/Scene').default;
  1131. /**
  1132. * Backend对应的对象。
  1133. * @internal
  1134. */
  1135. get kanataEffect(): import('XrFrame/kanata/lib/index').Effect;
  1136. /**
  1137. * 有几个Pass。
  1138. */
  1139. get passCount(): number;
  1140. /**
  1141. * 正在加载中的纹理。
  1142. * @internal
  1143. */
  1144. get loadingTextures(): {
  1145. [key: string]: IAssetWithState<import('XrFrame/kanata/lib/index').Texture | ITextureWrapper>;
  1146. };
  1147. /**
  1148. * 用于UniformBlock构建时传入
  1149. * @internal
  1150. */
  1151. _shaderUniformBlockDesc?: Kanata.UniformDescriptor;
  1152. /**
  1153. * 是否没有properties。
  1154. * @internal
  1155. */
  1156. _isNoProperties: boolean;
  1157. /**
  1158. * 是否没有images。
  1159. * @internal
  1160. */
  1161. _isNoImages: boolean;
  1162. /**
  1163. * 根据特效配置生成特效资源。
  1164. * **注意,不建议自己创建,请使用`scene.createEffect`。**
  1165. *
  1166. * @param description 配置。
  1167. */
  1168. constructor(_scene: Scene, description: IEffectAsset);
  1169. /**
  1170. * 材质调用方法,拷贝默认UniformBlock。
  1171. * @internal
  1172. */
  1173. /**
  1174. * @internal
  1175. */
  1176. /**
  1177. * 预编译
  1178. */
  1179. warmUp(): boolean;
  1180. }
  1181. export {};
  1182. }
  1183. declare module 'XrFrame/assets/Geometry' {
  1184. import { Kanata } from 'XrFrame/ext';
  1185. import BoundBall from 'XrFrame/math/boundBall';
  1186. import BoundBox from 'XrFrame/math/boundBox';
  1187. import Vector3 from 'XrFrame/math/vector3';
  1188. type Scene = import('XrFrame/core/Scene').default;
  1189. /**
  1190. * `Geometry`中的Submesh定义。
  1191. */
  1192. export interface ISubMesh {
  1193. /**
  1194. * 子mesh的顶点偏移。
  1195. */
  1196. offset: number;
  1197. /**
  1198. * 子mesh的顶点数量。
  1199. */
  1200. length: number;
  1201. /**
  1202. * 子mesh的材质索引。
  1203. */
  1204. materialIndex: number;
  1205. }
  1206. /**
  1207. * 几何资源,用于定义渲染中的图元数据。
  1208. */
  1209. export default class Geometry {
  1210. protected _scene: Scene;
  1211. /**
  1212. * @internal
  1213. */
  1214. static readonly RAWLENGTH = 10;
  1215. /**
  1216. * @internal
  1217. */
  1218. static readonly MAX_BONECOUNT = 96;
  1219. /**
  1220. * @internal
  1221. */
  1222. /**
  1223. * 获取IndexBuffer。
  1224. */
  1225. get indexBuffer(): import('XrFrame/kanata/lib/index').IndexBuffer;
  1226. /**
  1227. * 获取VertexBuffer。
  1228. */
  1229. get vertexBuffer(): import('XrFrame/kanata/lib/index').VertexBuffer;
  1230. /**
  1231. * 获取IndexData。
  1232. * 这种类型的索引数据用于合批,只对于开启了`dynamicBatch`的Renderer有效。
  1233. * 注意如果已经获取过`indexBuffer`,将无效。
  1234. */
  1235. get indexData(): import('XrFrame/kanata/lib/index').IndexData;
  1236. /**
  1237. * 获取VertexData。
  1238. * 这种类型的顶点数据用于合批,只对于开启了`dynamicBatch`的Renderer有效。
  1239. * 注意如果已经获取过`vertexBuffer`,将无效。
  1240. */
  1241. get vertexData(): import('XrFrame/kanata/lib/index').VertexData;
  1242. /**
  1243. * 该mesh是否有效,有些情况可能会造成这种现象,例如vertexLayout和buffer数量不匹配
  1244. * 渲染时应该对该值做检查以防护
  1245. * @internal
  1246. */
  1247. get valid(): boolean;
  1248. /**
  1249. * 包围球,只读。
  1250. */
  1251. get boundBall(): BoundBall;
  1252. /**
  1253. * 包围盒,只读。
  1254. */
  1255. get boundBox(): BoundBox;
  1256. /**
  1257. * 获取所有的SubMesh,不要修改。
  1258. * @internal
  1259. */
  1260. get subMeshes(): ISubMesh[];
  1261. /**
  1262. * 构造一个Mesh。
  1263. * 请不要直接使用,而是使用`Mesh.createFromDynamicArrayBuffer`。
  1264. */
  1265. constructor(_scene: Scene, vertexLayout: Kanata.VertexLayout, vBuffer: ArrayBufferView, iBuffer: ArrayBufferView, indexType?: Kanata.EIndexType);
  1266. /**
  1267. * 更新VertexBuffer和IndexBuffer。
  1268. * @internal
  1269. */
  1270. uploadBufferData(vBufferOffset: number, vBufferLength: number, iBufferOffset: number, iBufferLength: number): void;
  1271. /**
  1272. * 更新VertexBuffer。
  1273. * 仅在获取了`vertexBuffer`后有效。
  1274. */
  1275. uploadVertexBuffer(offset: number, buffer: ArrayBufferView): void;
  1276. /**
  1277. * 更新IndexBuffer。
  1278. * 仅在获取了`indexBuffer`后有效。
  1279. */
  1280. uploadIndexBuffer(offset: number, buffer: ArrayBufferView): void;
  1281. /**
  1282. * 获取当前mesh有多少subMesh
  1283. */
  1284. getSubMeshCount(): number;
  1285. /**
  1286. * 获取指定序号的subMesh的索引起始点
  1287. *
  1288. * @returns {number} 索引起始点,返回-1代表SubMesh不存在
  1289. */
  1290. getIndiceStart(subMeshIndex: number): number;
  1291. /**
  1292. * 获取指定序号的subMesh的索引长度
  1293. *
  1294. * @returns {number} 索引长度,返回-1代表SubMesh不存在
  1295. */
  1296. getIndiceLength(subMeshIndex: number): number;
  1297. /**
  1298. * 获取指定序号的subMesh的材质序号
  1299. *
  1300. * @returns {number} 材质序号,返回-1代表subMesh不存在
  1301. */
  1302. getMaterialIndex(subMeshIndex: number): number;
  1303. /**
  1304. * 获取VertexLayout。
  1305. */
  1306. getVertexLayout(): Kanata.VertexLayout;
  1307. /**
  1308. * 修改subMesh。
  1309. *
  1310. * @param length 索引长度
  1311. * @param offset 索引起始偏移
  1312. */
  1313. modifySubMesh(subMeshIndex: number, length: number, offset: number): boolean;
  1314. /**
  1315. * 增加subMesh。
  1316. *
  1317. * @param length 索引长度
  1318. * @param offset 索引起始偏移
  1319. */
  1320. addSubMesh(length: number, offset: number, materialIndex?: number): void;
  1321. /**
  1322. * 动态更新包围盒,默认会自动计算包围球。
  1323. */
  1324. setBoundBox(center: Vector3, size: Vector3, autoUpdateBall?: boolean): void;
  1325. /**
  1326. * 动态更新包围球。
  1327. */
  1328. setBoundBall(center: Vector3, radius: number): void;
  1329. /**
  1330. * 获取第一个顶点Buffer原始数据,可能没有值。
  1331. * @internal
  1332. */
  1333. /**
  1334. * 获取索引Buffer原始数据。
  1335. * @internal
  1336. */
  1337. }
  1338. export {};
  1339. }
  1340. declare module 'XrFrame/assets/Material' {
  1341. /**
  1342. * Material.ts
  1343. *
  1344. * * @Date : 2022/3/24上午11:21:54
  1345. */
  1346. import { Kanata } from 'XrFrame/ext';
  1347. import Effect from 'XrFrame/assets/Effect';
  1348. import Vector2 from 'XrFrame/math/vector2';
  1349. import Vector3 from 'XrFrame/math/vector3';
  1350. import Vector4 from 'XrFrame/math/vector4';
  1351. import Matrix3 from 'XrFrame/math/matrix3';
  1352. import Matrix4 from 'XrFrame/math/matrix4';
  1353. type Scene = import('XrFrame/core/Scene').default;
  1354. /**
  1355. * 材质资源,一般被代理到{@link XRMaterial}元素。
  1356. */
  1357. export default class Material {
  1358. /**
  1359. * @internal
  1360. */
  1361. get kanataMaterial(): import('XrFrame/kanata/lib/index').Material;
  1362. /**
  1363. * @internal
  1364. */
  1365. get uniforms(): import('XrFrame/kanata/lib/index').UniformBlock;
  1366. set alphaMode(value: 'OPAQUE' | 'BLEND' | 'MASK');
  1367. set alphaCutOff(value: number);
  1368. /**
  1369. * 透明物体需要大于`2500`!
  1370. */
  1371. get renderQueue(): number;
  1372. set renderQueue(value: number);
  1373. constructor(_scene: Scene);
  1374. /**
  1375. * 通过效果初始化材质。
  1376. */
  1377. initByEffect(effect: Effect, defaultUniforms?: {
  1378. [key: string]: ArrayLike<number> | number | Kanata.Texture;
  1379. }): void;
  1380. /**
  1381. * 获取一个Float
  1382. */
  1383. getFloat(key: string): number;
  1384. /**
  1385. * 设置一个Float
  1386. *
  1387. * @returns 是否设置成功
  1388. */
  1389. setFloat(key: string, value: number): boolean;
  1390. /**
  1391. * 设置一个Vector。
  1392. *
  1393. * @returns 是否设置成功。
  1394. */
  1395. setVector(key: string, value: Vector2 | Vector3 | Vector4): boolean;
  1396. /**
  1397. * 获取一个Vector值的拷贝。
  1398. */
  1399. getVector(key: string): Vector2 | Vector3 | Vector4;
  1400. /**
  1401. * 设置一个Matrix
  1402. *
  1403. * @returns 是否设置成功
  1404. */
  1405. setMatrix(key: string, value: Matrix3 | Matrix4): boolean;
  1406. /**
  1407. * 获取一个Vector值的拷贝。
  1408. */
  1409. getMatrix(key: string): Matrix3 | Matrix4;
  1410. /**
  1411. * 设置一张贴图。
  1412. *
  1413. * @returns 是否设置成功。
  1414. */
  1415. setTexture(key: string, value: Kanata.Texture): boolean;
  1416. /**
  1417. * 设置一张贴图。
  1418. *
  1419. * @returns 是否设置成功。
  1420. */
  1421. setTextureAsset(key: string, assetId: string): boolean;
  1422. resetTexture(key: string): import('XrFrame/kanata/lib/index').Texture;
  1423. /**
  1424. * 直接通过Backend纹理ID设置纹理,注意需要自己持有纹理引用。
  1425. * @internal
  1426. *
  1427. * @returns 是否设置成功。
  1428. */
  1429. setFontTexture(key: string, id: number): boolean;
  1430. /**
  1431. * 获取材质中已设置的贴图。
  1432. */
  1433. getTexture(key: string): Kanata.Texture;
  1434. /**
  1435. * 设置渲染状态。
  1436. * 只有标记了`useMaterialRenderStates`的Pass会受到影响
  1437. */
  1438. setRenderState(key: string, value: number | boolean): boolean;
  1439. /**
  1440. * 批量设置渲染状态。
  1441. * 只有标记了`useMaterialRenderStates`的Pass会受到影响。
  1442. */
  1443. setRenderStates(states: {
  1444. [key: string]: number | boolean;
  1445. }): boolean;
  1446. /**
  1447. * 清除渲染状态。
  1448. * 清除材质的渲染状态,转而从effect中使用默认值。
  1449. */
  1450. clearRenderState(key: string): boolean;
  1451. /**
  1452. * 批量清除渲染状态。
  1453. * 清除材质的渲染状态,转而从effect中使用默认值。
  1454. */
  1455. clearRenderStates(states: {
  1456. [key: string]: any;
  1457. }): boolean;
  1458. /**
  1459. * 获取渲染状态。
  1460. */
  1461. getRenderState(key: string): number | boolean;
  1462. /**
  1463. * 设置宏。
  1464. */
  1465. setMacro(key: string, value: boolean | number): void;
  1466. /**
  1467. * 批量设置宏。
  1468. */
  1469. setMacros(marcos: {
  1470. [key: string]: number | boolean;
  1471. }): void;
  1472. /**
  1473. * 获取宏。
  1474. */
  1475. getMacro(key: string): boolean;
  1476. /**
  1477. * 拷贝自身,生成一份新的材质数据。
  1478. */
  1479. clone(): Material;
  1480. /**
  1481. * @internal
  1482. */
  1483. /**
  1484. * @internal
  1485. */
  1486. }
  1487. export {};
  1488. }
  1489. declare module 'XrFrame/assets/VideoTexture' {
  1490. import { Kanata } from 'XrFrame/ext';
  1491. type Scene = import('XrFrame/core/Scene').default;
  1492. /**
  1493. * 视频纹理{@link VideoTexture}的创建参数。
  1494. */
  1495. export interface IVideoTextureOptions {
  1496. /**
  1497. * 视频地址。
  1498. */
  1499. src: string;
  1500. /**
  1501. * 视频未加载成功时,可选的首帧图片地址。
  1502. */
  1503. placeHolder?: Kanata.IImage;
  1504. /**
  1505. * 是否要在加载完毕后自动播放。
  1506. */
  1507. autoPlay?: boolean;
  1508. /**
  1509. * 是否要循环播放。
  1510. */
  1511. loop?: boolean;
  1512. /**
  1513. * 是否禁止音频,默认禁止。
  1514. */
  1515. abortAudio?: boolean;
  1516. }
  1517. export enum EVideoState {
  1518. Idle = 0,
  1519. WaitPlay = 1,
  1520. Playing = 2,
  1521. Released = 3
  1522. }
  1523. /**
  1524. * 视频纹理。
  1525. */
  1526. export default class VideoTexture {
  1527. onEnd?: () => void;
  1528. get texture(): import('XrFrame/kanata/lib/index').Texture;
  1529. get width(): number;
  1530. get height(): number;
  1531. /**
  1532. * @param onReady 创建成功时的回调。
  1533. * @param onEnd 播放结束时的回调。
  1534. */
  1535. constructor(scene: Scene, options: IVideoTextureOptions, onReady: (vt: VideoTexture, error?: Error) => void, onEnd?: () => void);
  1536. /**
  1537. * @internal
  1538. */
  1539. /**
  1540. * 播放视频。
  1541. */
  1542. play(first?: boolean): Promise<{
  1543. width: number;
  1544. height: number;
  1545. }>;
  1546. /**
  1547. * 从某处开始播放。
  1548. *
  1549. * @param pos 事件,单位为s
  1550. */
  1551. seek(pos: number): Promise<any>;
  1552. /**
  1553. * 停止播放视频。
  1554. */
  1555. stop(): void;
  1556. /**
  1557. * 释放视频。
  1558. */
  1559. release(): void;
  1560. }
  1561. export {};
  1562. }
  1563. declare module 'XrFrame/assets/RenderTexture' {
  1564. import { Kanata } from 'XrFrame/ext';
  1565. type Scene = import('XrFrame/core/Scene').default;
  1566. export interface IRenderTarget {
  1567. width: number;
  1568. height: number;
  1569. renderPass: Kanata.RenderPass;
  1570. }
  1571. /**
  1572. * `RenderTexture`资源参数接口。
  1573. */
  1574. export interface IRenderTextureOptions {
  1575. width: number;
  1576. height: number;
  1577. isHDR?: boolean;
  1578. }
  1579. /**
  1580. * 渲染纹理组件,可作为{@link Camera.renderTarget}。
  1581. */
  1582. export default class RenderTexture {
  1583. static IS(obj: any): obj is RenderTexture;
  1584. readonly isRenderTexture: boolean;
  1585. /**
  1586. * 获取深度模板纹理。
  1587. * @internal
  1588. */
  1589. get depthStencil(): import('XrFrame/kanata/lib/index').Texture;
  1590. /**
  1591. * 获取第一个色彩纹理。
  1592. * @internal
  1593. */
  1594. get texture(): import('XrFrame/kanata/lib/index').Texture;
  1595. /**
  1596. * 获取深度纹理。
  1597. * @internal
  1598. */
  1599. get depthTexture(): import('XrFrame/kanata/lib/index').Texture;
  1600. /**
  1601. * 获取Backend实例。
  1602. * @internal
  1603. */
  1604. get renderPass(): import('XrFrame/kanata/lib/index').RenderPass;
  1605. /**
  1606. * 贴图高。
  1607. */
  1608. get height(): number;
  1609. /**
  1610. * 贴图宽。
  1611. */
  1612. get width(): number;
  1613. get id(): number;
  1614. constructor(_scene: Scene, options: IRenderTextureOptions);
  1615. }
  1616. export {};
  1617. }
  1618. declare module 'XrFrame/assets/GLTFModel' {
  1619. /**
  1620. * GlTF.ts
  1621. *
  1622. * * @Date : 2022/4/1下午3:34:15
  1623. */
  1624. import NativeAnimation from 'XrFrame/animation/NativeAnimation';
  1625. import Mesh from 'XrFrame/components/Mesh';
  1626. import Element from 'XrFrame/core/Element';
  1627. import { Kanata } from 'XrFrame/ext';
  1628. import { GLTFRootLoaded } from 'XrFrame/loader/glTF/GLTFRootNode';
  1629. import { GLTFTreeNode } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode';
  1630. type Scene = import('XrFrame/core/Scene').default;
  1631. /**
  1632. * 收集glTF实例化过程中创建的对象,避免其GC。
  1633. * @deprecated
  1634. */
  1635. export class GLTFInstanceResourceCollector {
  1636. add(res: Kanata.IHandle): void;
  1637. release(): void;
  1638. }
  1639. /**
  1640. * 在{@link GLTFModel.instantiate}中传入的设置项。
  1641. */
  1642. export interface IGLTFModelOptions {
  1643. /**
  1644. * 是否投射阴影。
  1645. */
  1646. castShadow: boolean;
  1647. /**
  1648. * 是否接受阴影。
  1649. */
  1650. receiveShadow: boolean;
  1651. /**
  1652. * 是否**不**参与剔除。
  1653. */
  1654. neverCull: boolean;
  1655. }
  1656. /**
  1657. * 加载完毕的GLTF模型,可以在节点下创建{@link GLTF | GLTF组件}来将其实例化。
  1658. */
  1659. export default class GLTFModel {
  1660. constructor(_scene: Scene, model: GLTFRootLoaded);
  1661. /**
  1662. * 使用GLB文件加载而成的buffer,来生成GLTF模型。
  1663. */
  1664. static createFromBuffer(scene: Scene, buffer: ArrayBuffer): Promise<GLTFModel>;
  1665. /**
  1666. * 实例化一个GLTF模型,将其加入到指定节点下,并返回一系列得到的物件。
  1667. * @internal
  1668. *
  1669. * @returns subRoots GLTF场景的根节点对应的元素,因为一个GLTF可能有多个场景,所以可能有多个根节点。
  1670. * @returns treeNodeMap GLTF节点对应到元素的映射表。
  1671. * @returns animations 实例化产生的动画片段,需要手动将其加入{@link Animator}组件。
  1672. * @returns meshes 实例化产生的所有{@link Mesh}组件。
  1673. */
  1674. instantiate(parent: Element, options: IGLTFModelOptions): [
  1675. subRoots: Array<Element>,
  1676. treeNodeMap: Map<GLTFTreeNode, Element>,
  1677. animations: Array<NativeAnimation>,
  1678. meshes: Array<Mesh>
  1679. ];
  1680. }
  1681. export {};
  1682. }
  1683. declare module 'XrFrame/assets/EnvData' {
  1684. /**
  1685. * EnvData.ts
  1686. *
  1687. * * @Date : 5/11/2022, 4:07:41 PM
  1688. */
  1689. import { Kanata } from 'XrFrame/ext';
  1690. /**
  1691. * `EnvData`的参数接口。
  1692. */
  1693. export interface IEnvDataOptions {
  1694. /**
  1695. * 天空盒。
  1696. */
  1697. skybox?: {
  1698. /**
  1699. * 是否只使用贴图的上半部分,一般在和`specular`共用贴图的时候为`true`。
  1700. */
  1701. half: boolean;
  1702. /**
  1703. * 贴图。
  1704. */
  1705. map: Kanata.Texture;
  1706. };
  1707. /**
  1708. * 环境漫反射部分。
  1709. */
  1710. diffuse?: {
  1711. /**
  1712. * 球谐系数SH9。
  1713. */
  1714. coefficients: Float32Array;
  1715. };
  1716. /**
  1717. * 环境高光反射部分。
  1718. */
  1719. specular?: {
  1720. /**
  1721. * 贴图类型,目前只支持2D。
  1722. */
  1723. type: '2D';
  1724. /**
  1725. * 是否使用`rgbd`编码来。
  1726. */
  1727. rgbd: boolean;
  1728. /**
  1729. * 是否使用mipmap。
  1730. */
  1731. mipmaps: boolean;
  1732. /**
  1733. * 使用的mipmap级数。
  1734. */
  1735. mipmapCount?: number;
  1736. /**
  1737. * 贴图。
  1738. */
  1739. map: Kanata.Texture;
  1740. };
  1741. }
  1742. /**
  1743. * 环境数据资源,一般用[xr-frame-cli](https://github.com/wechat-miniprogram/xr-frame-cli)生成。
  1744. */
  1745. export default class EnvData {
  1746. get useHalfSkyMap(): boolean;
  1747. get skyboxMap(): import('XrFrame/kanata/lib/index').Texture;
  1748. get hasDiffuse(): boolean;
  1749. get diffuseSH(): Float32Array;
  1750. get hasSpecular(): boolean;
  1751. get specularRGBD(): boolean;
  1752. get specularMipmaps(): boolean;
  1753. get specularMipmapCount(): number;
  1754. get specularMap(): import('XrFrame/kanata/lib/index').Texture;
  1755. constructor(options: IEnvDataOptions);
  1756. destroy(): void;
  1757. }
  1758. }
  1759. declare module 'XrFrame/animation/Animation' {
  1760. /**
  1761. * Animation.ts
  1762. *
  1763. * * @Date : 6/17/2022, 3:17:12 PM
  1764. */
  1765. type Scene = import('XrFrame/core/Scene').default;
  1766. type Element = import('XrFrame/core/Element').default;
  1767. /**
  1768. * 动画播放的方向,如果是`both`,则会在`loop`开启时的每次循环中自动反转。
  1769. */
  1770. export type TDirection = 'forwards' | 'backwards' | 'both';
  1771. /**
  1772. * 动画资源基类,被{@link Animator}使用,可以继承它来实现具体的动画。
  1773. *
  1774. * @template IData 动画初始化接受的数据。
  1775. * @template IOptions 动画播放时接受的额外追加选项。
  1776. */
  1777. export default class Animation<IData = any, IOptions = any> {
  1778. __DATA_TYPE: IData;
  1779. __OPTIONS_TYPE: IOptions;
  1780. /**
  1781. * 动画所有的片段名字,必须在`onInit`中被初始化。
  1782. */
  1783. clipNames: string[];
  1784. /**
  1785. * 场景实例。
  1786. */
  1787. get scene(): import('XrFrame/core/Scene').default;
  1788. /**
  1789. * @param _scene 场景实例。
  1790. * @param data 初始化动画数据。
  1791. */
  1792. constructor(_scene: Scene, data: IData);
  1793. /**
  1794. * 动画初始化时执行的生命周期,只会执行一次。
  1795. *
  1796. * @param data 初始化动画数据。
  1797. */
  1798. onInit(data: IData): void;
  1799. /**
  1800. * 动画开始播放时执行的生命周期。
  1801. *
  1802. * @param el 本次播放作用于的`element`,一个动画可能作用于多个`element`,可以在这里区分。
  1803. * @param clipName 本次播放的片段名字。
  1804. * @param options 本次播放时的附加选项。
  1805. *
  1806. * @returns 返回本次播放片段的参数,必须包括时长`duration`(s),可选循环次数`loop`、延迟`delay`和方向`direction`。
  1807. */
  1808. onPlay(el: Element, clipName: string, options: IOptions): {
  1809. duration: number;
  1810. loop?: number;
  1811. delay?: number;
  1812. direction?: TDirection;
  1813. };
  1814. /**
  1815. * 在动画更新时执行的回调。
  1816. *
  1817. * @param el 本次播放作用于的`element`。
  1818. * @param progress 播放进度,范围为线性的`0~1`。
  1819. * @param reverse 本次播放是否反向。
  1820. */
  1821. onUpdate(el: Element, progress: number, reverse: boolean): void;
  1822. /**
  1823. * 在动画暂停时执行的回调。
  1824. *
  1825. * @param el 本次播放作用于的`element`。
  1826. */
  1827. onPause(el: Element): void;
  1828. /**
  1829. * 在动画从暂停状态唤醒时执行的回调。
  1830. *
  1831. * @param el 本次播放作用于的`element`。
  1832. */
  1833. onResume(el: Element): void;
  1834. /**
  1835. * 在动画停止时执行的回调。
  1836. *
  1837. * @param el 本次播放作用于的`element`。
  1838. */
  1839. onStop(el: Element): void;
  1840. }
  1841. export {};
  1842. }
  1843. declare module 'XrFrame/animation/KeyframeAnimation' {
  1844. import Animation, { TDirection } from "XrFrame/animation/Animation";
  1845. type Element = import('XrFrame/core/Element').default;
  1846. /**
  1847. * `Keyframe`动画数据的动画部分。
  1848. */
  1849. export interface IKeyframeAnimationInfo {
  1850. /**
  1851. * 指定动画使用的Keyframe。
  1852. */
  1853. keyframe: string;
  1854. /**
  1855. * 动画长度(s)。
  1856. */
  1857. duration: number;
  1858. /**
  1859. * 动画插值方式,详见{@link noneParamsEaseFuncs}和{@link useParamsEaseFuncs}。
  1860. */
  1861. ease: string;
  1862. /**
  1863. * 如果是可以接受参数的插值方式,指定参数。
  1864. */
  1865. easeParams?: number[];
  1866. /**
  1867. * 循环次数,`0`为不循环,`-1`为永远循环。
  1868. */
  1869. loop?: number;
  1870. /**
  1871. * 播放延迟。
  1872. */
  1873. delay?: number;
  1874. /**
  1875. * 播放方向。
  1876. */
  1877. direction?: TDirection;
  1878. }
  1879. /**
  1880. * `Keyframe`动画数据的动画部分。
  1881. */
  1882. export interface IKeyframeAnimationData {
  1883. /**
  1884. * 关键帧定义部分,可以参考[basic-animation](https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/doc/basic-animation.json)。
  1885. *
  1886. * `name`为关键帧名字。
  1887. * `key`为`0~100`的进度。
  1888. * `prop`为属性序列,其规则为`[componentName].[prop1].[prop2].[prop3]...`,但是有一些特殊的缩写:
  1889. * `position`、`scale`、`rotation`是`transform`组件下对应的属性,`material.u_xxx`则是设置材质的uniform。
  1890. * `prop`的值,可以是数字或者数字数组。
  1891. */
  1892. keyframe: {
  1893. [name: string]: {
  1894. [key: string]: {
  1895. [prop: string]: number | number[];
  1896. };
  1897. };
  1898. };
  1899. /**
  1900. * 动画部分。
  1901. */
  1902. animation: {
  1903. [name: string]: IKeyframeAnimationInfo;
  1904. };
  1905. }
  1906. export enum EKeyframeAnimationPropType {
  1907. Default = 0,
  1908. Math = 1,
  1909. Uniform = 2,
  1910. ComponentData = 3
  1911. }
  1912. /**
  1913. * `Keyframe`动画的追加播放参数。
  1914. */
  1915. export interface IKeyframeAnimationOptions {
  1916. /**
  1917. * 改变插值方式。
  1918. */
  1919. ease?: string;
  1920. /**
  1921. * 改变插值系数。
  1922. */
  1923. easeParams?: number[];
  1924. }
  1925. /**
  1926. * 解析完的`Keyframe`部分实例,准备好数据以备正式播放。
  1927. *
  1928. * 开发者不需要关心,内部使用。
  1929. */
  1930. export class Keyframe {
  1931. /**
  1932. * @internal
  1933. */
  1934. get times(): number[];
  1935. constructor(options: IKeyframeAnimationData['keyframe']['name']);
  1936. start(el: Element): (p: number) => void;
  1937. }
  1938. /**
  1939. * `Keyframe`动画。
  1940. */
  1941. export default class KeyframeAnimation extends Animation<IKeyframeAnimationData, IKeyframeAnimationOptions> {
  1942. onInit(data: IKeyframeAnimationData): void;
  1943. onPlay(el: Element, clipName: string, options: IKeyframeAnimationOptions): IKeyframeAnimationInfo;
  1944. onUpdate(el: Element, progress: number, reverse: boolean): void;
  1945. onPause(el: Element): void;
  1946. onResume(el: Element): void;
  1947. onStop(el: Element): void;
  1948. }
  1949. export {};
  1950. }
  1951. declare module 'XrFrame/assets/Atlas' {
  1952. /**
  1953. * Atlas.ts
  1954. *
  1955. * * @Date : 10/12/2022, 5:23:59 PM
  1956. */
  1957. import { Kanata } from 'XrFrame/ext';
  1958. import Matrix3 from 'XrFrame/math/matrix3';
  1959. import Vector4 from 'XrFrame/math/vector4';
  1960. type Scene = import('XrFrame/core/Scene').default;
  1961. /**
  1962. * `Atlas`的初始化参数类型。
  1963. */
  1964. export interface IAtlasOptions {
  1965. /**
  1966. * 图片。
  1967. */
  1968. image?: Kanata.IImage;
  1969. /**
  1970. * 也可以直接传入一张纹理。
  1971. */
  1972. texture?: Kanata.Texture;
  1973. /**
  1974. * 帧定义,若不指定`uv`则会自动按比例计算。
  1975. */
  1976. frames: {
  1977. [key: string]: {
  1978. /**
  1979. * 帧的区块信息。
  1980. */
  1981. frame: {
  1982. x: number;
  1983. y: number;
  1984. w: number;
  1985. h: number;
  1986. };
  1987. /**
  1988. * 会自动生成,开发者无需关心。
  1989. *
  1990. * @hidden
  1991. */
  1992. uvMatrix?: Matrix3;
  1993. /**
  1994. * 会自动生成,开发者无需关心。
  1995. *
  1996. * @hidden
  1997. */
  1998. uvST?: Vector4;
  1999. };
  2000. };
  2001. /**
  2002. * 原信息,主要定义图片尺寸。
  2003. */
  2004. meta: {
  2005. size: {
  2006. w: number;
  2007. h: number;
  2008. };
  2009. };
  2010. }
  2011. /**
  2012. * 图集资源创建参数。
  2013. */
  2014. export interface IAtlasCreationOptions {
  2015. /**
  2016. * 单元宽度。
  2017. */
  2018. cellWidth?: number;
  2019. /**
  2020. * 单元高度。
  2021. */
  2022. cellHeight?: number;
  2023. /**
  2024. * 单元间的间隙。
  2025. */
  2026. space?: number;
  2027. /**
  2028. * 每行有多少帧(单元)。
  2029. */
  2030. framesPerLine: number;
  2031. /**
  2032. * 需要从哪一帧开始。
  2033. */
  2034. frameStart?: number;
  2035. /**
  2036. * 需要几帧。
  2037. */
  2038. frameCount?: number;
  2039. }
  2040. /**
  2041. * 图集资源。
  2042. * @version 2.27.1
  2043. *
  2044. * 一般通过{@link AtlasLoader}加载自动生成。
  2045. * 推荐使用[Shoebox](https://www.renderhjs.net/shoebox/)等工具生成。
  2046. */
  2047. export default class Atlas {
  2048. isAtlas: boolean;
  2049. protected _AUTO_ID: number;
  2050. protected _image: Kanata.IImage;
  2051. protected _texture: Kanata.Texture;
  2052. protected _frames: IAtlasOptions['frames'];
  2053. protected _meta: IAtlasOptions['meta'];
  2054. protected _updatable: boolean;
  2055. protected _root: string;
  2056. protected _area: number;
  2057. protected _needReBuild: boolean;
  2058. /**
  2059. * 根据宽高和行数、列数来创建一个空的图集。
  2060. * 这个图集将被行列分成若干个格子帧,开发者可以根据实际状况去使用`updateFrame`更新这些格子。
  2061. * 自动生成的帧的名字为`${row}${col}`,比如第一行第一列为`'11'`。
  2062. *
  2063. * @param onUpdate 初始化时的回调,可以用于一开始绘制图像
  2064. */
  2065. static CREATE_FROM_GRIDS(scene: Scene, options: {
  2066. width: number;
  2067. height: number;
  2068. rows: number;
  2069. cols: number;
  2070. space?: number;
  2071. }, onUpdate?: (texture: Kanata.Texture, region: {
  2072. col: number;
  2073. row: number;
  2074. x: number;
  2075. y: number;
  2076. w: number;
  2077. h: number;
  2078. }, frameName: string) => void): Atlas;
  2079. /**
  2080. * 根据纹理和配置,来通过纹理创建一个不可修改的图集。通常用于精灵动画。
  2081. * 这个图集将被行列分成若干个格子帧,每一帧的名字为`0`、`1`、`2`......
  2082. */
  2083. static CREATE_FROM_TEXTURE(scene: Scene, texture: Kanata.Texture, options: IAtlasCreationOptions): Atlas;
  2084. /**
  2085. * 获取元信息。
  2086. */
  2087. get meta(): {
  2088. size: {
  2089. w: number;
  2090. h: number;
  2091. };
  2092. };
  2093. /**
  2094. * 获取帧集合。
  2095. */
  2096. get frames(): {
  2097. [key: string]: {
  2098. /**
  2099. * 帧的区块信息。
  2100. */
  2101. frame: {
  2102. x: number;
  2103. y: number;
  2104. w: number;
  2105. h: number;
  2106. };
  2107. /**
  2108. * 会自动生成,开发者无需关心。
  2109. *
  2110. * @hidden
  2111. */
  2112. uvMatrix?: Matrix3;
  2113. /**
  2114. * 会自动生成,开发者无需关心。
  2115. *
  2116. * @hidden
  2117. */
  2118. uvST?: Vector4;
  2119. };
  2120. };
  2121. /**
  2122. * 获取整体的纹理。
  2123. */
  2124. get texture(): import('XrFrame/kanata/lib/index').Texture;
  2125. /**
  2126. * 构建一个图集。
  2127. *
  2128. * @param options 初始化参数。
  2129. */
  2130. constructor(_scene: Scene, options: IAtlasOptions);
  2131. /**
  2132. * 获取某一帧的数据。
  2133. */
  2134. getFrame(frameName: string): {
  2135. x: number;
  2136. y: number;
  2137. w: number;
  2138. h: number;
  2139. };
  2140. /**
  2141. * 获取某一帧的uv变换矩阵。
  2142. */
  2143. getUVMatrix(frameName: string): Matrix3;
  2144. protected _buildUVMatrix(frame: {
  2145. x: number;
  2146. y: number;
  2147. w: number;
  2148. h: number;
  2149. }): Matrix3;
  2150. /**
  2151. * 获取某一帧的uvST。
  2152. * [sx, sy, tx, ty]。
  2153. */
  2154. getUVST(frameName: string): Vector4;
  2155. protected _buildUVST(frame: {
  2156. x: number;
  2157. y: number;
  2158. w: number;
  2159. h: number;
  2160. }): Vector4;
  2161. /**
  2162. * 更新某一frame,通过`onUpdate`方法参数中的`texture`和`region`来更新上此帧所占据区域内的图像。
  2163. */
  2164. updateFrame(frameName: string, onUpdate: (texture: Kanata.Texture, region: {
  2165. x: number;
  2166. y: number;
  2167. w: number;
  2168. h: number;
  2169. }, frameName: string) => void): void;
  2170. }
  2171. export {};
  2172. }
  2173. declare module 'XrFrame/assets/PostProcess' {
  2174. /**
  2175. * PostProcess.ts
  2176. *
  2177. * * @Date : 10/14/2022, 4:34:55 PM
  2178. */
  2179. type Scene = import('XrFrame/core/Scene').default;
  2180. /**
  2181. * 后处理资源初始化参数。
  2182. */
  2183. export interface IPostProcessOptions {
  2184. /**
  2185. * 类型,目前支持的类型请见[内置后处理资源](https://developers.weixin.qq.com/miniprogram/dev/component/xr-frame/builtin/post-process)。
  2186. */
  2187. type: string;
  2188. /**
  2189. * 是否开启HDR。
  2190. */
  2191. isHDR?: boolean;
  2192. /**
  2193. * 对应类型的数据。
  2194. */
  2195. data?: {
  2196. [key: string]: any;
  2197. };
  2198. }
  2199. /**
  2200. * 后处理资源。
  2201. *
  2202. * 一般由{@link AssetPostProcess}加载。
  2203. */
  2204. export default class PostProcess {
  2205. /**
  2206. * 类型。
  2207. */
  2208. get type(): string;
  2209. /**
  2210. * 是否开启了HDR。
  2211. */
  2212. get isHDR(): boolean;
  2213. /**
  2214. * 数据,可以修改。
  2215. */
  2216. get data(): {
  2217. [key: string]: any;
  2218. };
  2219. constructor(_scene: Scene, options: IPostProcessOptions);
  2220. }
  2221. export {};
  2222. }
  2223. declare module 'XrFrame/assets/factories' {
  2224. /**
  2225. * factories.ts
  2226. *
  2227. * * @Date : 2022/3/23下午4:04:18
  2228. */
  2229. import Scene from 'XrFrame/core/Scene';
  2230. import Effect from 'XrFrame/assets/Effect';
  2231. import Geometry from 'XrFrame/assets/Geometry';
  2232. import Material from 'XrFrame/assets/Material';
  2233. /**
  2234. * @internal
  2235. */
  2236. export function getAssetFactory<T = any>(type: string, id: string): (scene: Scene) => T;
  2237. /**
  2238. * 注册`Geometry`资源。
  2239. */
  2240. export const registerGeometry: (id: string, factory: (scene: Scene) => Geometry) => void;
  2241. /**
  2242. * 注册`Effect`资源。
  2243. */
  2244. export const registerEffect: (id: string, factory: (scene: Scene) => Effect) => void;
  2245. /**
  2246. * 注册`Texture`资源。
  2247. */
  2248. export const registerTexture: (id: string, factory: (scene: Scene) => import('XrFrame/kanata/lib/index').Texture) => void;
  2249. /**
  2250. * 注册`TextureCube`资源。
  2251. */
  2252. export const registerTextureCube: (id: string, factory: (scene: Scene) => import('XrFrame/kanata/lib/index').Texture) => void;
  2253. /**
  2254. * 注册`VertexDataDescriptor`资源。
  2255. */
  2256. export const registerVertexDataDesc: (id: string, factory: (scene: Scene) => import('XrFrame/kanata/lib/index').VertexDataDescriptor) => void;
  2257. /**
  2258. * 注册`UniformDescriptor`资源。
  2259. */
  2260. export const registerUniformDesc: (id: string, factory: (scene: Scene) => import('XrFrame/kanata/lib/index').UniformDescriptor) => void;
  2261. /**
  2262. * 注册`VertexLayout`资源。
  2263. */
  2264. export const registerVertexLayout: (id: string, factory: (scene: Scene) => import('XrFrame/kanata/lib/index').VertexLayout) => void;
  2265. /**
  2266. * 注册`Material`资源。
  2267. */
  2268. export const registerMaterial: (id: string, factory: (scene: Scene) => Material) => void;
  2269. }
  2270. declare module 'XrFrame/assets/easeFunctions' {
  2271. /**
  2272. * easeFunctions.ts
  2273. *
  2274. * * @Date : 6/21/2022, 11:24:27 AM
  2275. */
  2276. type TEaseFunction = (progress: number) => number;
  2277. /**
  2278. * 可以自定义参数的插值函数。
  2279. */
  2280. export const useParamsEaseFuncs: {
  2281. /**
  2282. * 二次贝塞尔曲线。
  2283. *
  2284. * @param params p1x, p1y, p2x, p2y。
  2285. * @returns 最终的插值函数。
  2286. */
  2287. 'cubic-bezier': (times: number[], params: number[]) => (x: number) => number;
  2288. /**
  2289. * 步进插值曲线。
  2290. *
  2291. * @param params 一个参数,总步数。
  2292. * @returns 最终的插值函数。
  2293. */
  2294. steps: (times: number[], params: number[]) => (x: number) => number;
  2295. };
  2296. /**
  2297. * 不需要自定义参数的一些内置插值曲线。
  2298. */
  2299. export const noneParamsEaseFuncs: {
  2300. linear: (x: any) => any;
  2301. 'ease-in': (x: number) => number;
  2302. 'ease-out': (x: number) => number;
  2303. 'ease-in-out': (x: number) => number;
  2304. 'ease-in-quad': (x: any) => number;
  2305. 'ease-out-quad': (x: any) => number;
  2306. 'ease-in-out-quad': (x: any) => number;
  2307. 'ease-in-cubic': (x: any) => number;
  2308. 'ease-out-cubic': (x: any) => number;
  2309. 'ease-in-out-cubic': (x: any) => number;
  2310. 'ease-in-quart': (x: any) => number;
  2311. 'ease-out-quart': (x: any) => number;
  2312. 'ease-in-out-quart': (x: any) => number;
  2313. 'ease-in-quint': (x: any) => number;
  2314. 'ease-out-quint': (x: any) => number;
  2315. 'ease-in-out-quint': (x: any) => number;
  2316. 'ease-in-sine': (x: any) => number;
  2317. 'ease-out-sine': (x: any) => number;
  2318. 'ease-in-out-sine': (x: any) => number;
  2319. 'ease-in-expo': (x: any) => number;
  2320. 'ease-out-expo': (x: any) => number;
  2321. 'ease-in-out-expo': (x: any) => number;
  2322. 'ease-in-circ': (x: any) => number;
  2323. 'ease-out-circ': (x: any) => number;
  2324. 'ease-in-out-circ': (x: any) => number;
  2325. 'ease-in-back': (x: any) => number;
  2326. 'ease-out-back': (x: any) => number;
  2327. 'ease-in-out-back': (x: any) => number;
  2328. 'ease-in-elastic': (x: any) => number;
  2329. 'ease-out-elastic': (x: any) => number;
  2330. 'ease-in-out-elastic': (x: any) => number;
  2331. 'ease-in-bounce': (x: any) => number;
  2332. 'ease-out-bounce': TEaseFunction;
  2333. 'ease-in-out-bounce': (x: any) => number;
  2334. };
  2335. export {};
  2336. }
  2337. declare module 'XrFrame/math/vector2' {
  2338. export default class Vector2 {
  2339. /**
  2340. * x值
  2341. *
  2342. * @type {number}
  2343. * @memberof Vector2
  2344. */
  2345. get x(): number;
  2346. set x(val: number);
  2347. /**
  2348. * y值
  2349. *
  2350. * @type {number}
  2351. * @memberof Vector2
  2352. */
  2353. get y(): number;
  2354. set y(val: number);
  2355. /**
  2356. * 零向量,不要对该对象进行修改
  2357. *
  2358. * @readonly
  2359. * @static
  2360. * @type {V3ReadOnly}
  2361. * @memberof Vector3
  2362. */
  2363. static readonly ZERO: Vector2;
  2364. /**
  2365. * 一向量,不要对该对象进行修改
  2366. *
  2367. * @readonly
  2368. * @static
  2369. * @type {V3ReadOnly}
  2370. * @memberof Vector3
  2371. */
  2372. static readonly ONE: Vector2;
  2373. _raw: Float32Array;
  2374. /**
  2375. * 使用一个数组创建
  2376. * 此操作会拷贝一份数组
  2377. *
  2378. * @static
  2379. * @param {number[]} array 数据源,长度必须为2,否则会抛出异常
  2380. * @returns {Vector2} 创建出来的向量
  2381. * @memberof Vector2
  2382. */
  2383. static createFromArray(array: number[]): Vector2;
  2384. /**
  2385. * 使用某个已有的typedArray创建
  2386. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  2387. *
  2388. * @static
  2389. * @param {Float32Array} array 数据源
  2390. * @param {number} [offset=0] 数据源中的偏移
  2391. * @returns {Vector2} 创建出来的向量
  2392. * @memberof Vector2
  2393. */
  2394. static createFromTypedArray(array: Float32Array, offset?: number): Vector2;
  2395. /**
  2396. * 返回向量数据
  2397. *
  2398. * @returns {number[]} 矩阵数据,以JSArray返回
  2399. * @memberof Vector2
  2400. */
  2401. toArray(): number[];
  2402. /**
  2403. * 判断与目标向量的值是否相等
  2404. *
  2405. * @param {V2ReadOnly} v 目标向量
  2406. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  2407. * @memberof Vector2
  2408. */
  2409. equal(v: Vector2): boolean;
  2410. /**
  2411. * 拷贝目标向量的值到该向量
  2412. *
  2413. * @param {V2ReadOnly} val 目标向量
  2414. * @returns {Vector2} 自身
  2415. * @memberof Vector2
  2416. */
  2417. set(val: Vector2): Vector2;
  2418. /**
  2419. * 设置向量的值
  2420. *
  2421. * @param {number} x x值
  2422. * @param {number} y y值
  2423. * @returns {Vector2} 自身
  2424. * @memberof Vector2
  2425. */
  2426. setValue(x: number, y: number): Vector2;
  2427. /**
  2428. * 向量加法
  2429. *
  2430. * @param {V2ReadOnly} v 目标向量
  2431. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2432. * @returns {Vector2} 计算结果
  2433. * @memberof Vector2
  2434. */
  2435. add(v: Vector2, dst?: Vector2): Vector2;
  2436. /**
  2437. * 向量减法
  2438. *
  2439. * @param {V2ReadOnly} v 目标向量
  2440. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2441. * @returns {Vector2} 计算结果
  2442. * @memberof Vector2
  2443. */
  2444. sub(v: Vector2, dst?: Vector2): Vector2;
  2445. /**
  2446. * 向量归一化,如该向量为零向量,则结果依然为零向量
  2447. *
  2448. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2449. * @returns {Vector2} 计算结果
  2450. * @memberof Vector2
  2451. */
  2452. normalize(dst?: Vector2): Vector2;
  2453. /**
  2454. * 向量缩放
  2455. *
  2456. * @param {number} f 缩放比
  2457. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2458. * @returns {Vector2} 计算结果
  2459. * @memberof Vector2
  2460. */
  2461. scale(f: number, dst?: Vector2): Vector2;
  2462. /**
  2463. * 在该向量与目标向量之间计算插值
  2464. *
  2465. * @param {V2ReadOnly} v 目标向量
  2466. * @param {number} f 插值系数
  2467. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2468. * @returns {Vector2} 计算结果
  2469. * @memberof Vector2
  2470. */
  2471. lerp(v: Vector2, f: number, dst?: Vector2): Vector2;
  2472. /**
  2473. * 取反
  2474. * @returns
  2475. */
  2476. negate(): this;
  2477. /**
  2478. * 向量点乘
  2479. *
  2480. * @param {V2ReadOnly} v 目标向量
  2481. * @returns {number} 计算结果
  2482. * @memberof Vector2
  2483. */
  2484. dot(v: Vector2): number;
  2485. /**
  2486. * 向量的模
  2487. *
  2488. * @returns {number} 计算结果
  2489. * @memberof Vector2
  2490. */
  2491. length(): number;
  2492. /**
  2493. * 拷贝该向量
  2494. *
  2495. * @returns {Vector2} 拷贝出来的对象
  2496. * @memberof Vector2
  2497. */
  2498. clone(): Vector2;
  2499. /**
  2500. * 是否为零向量
  2501. *
  2502. * @returns {boolean}
  2503. * @memberof Vector2
  2504. */
  2505. isZero(): boolean;
  2506. /**
  2507. * 获取向量旋转角,以角度表示
  2508. *
  2509. * @returns {number} 旋转角,以角度表示
  2510. * @memberof Vector2
  2511. */
  2512. getAngle(): number;
  2513. setArray(value: ArrayLike<number>, offset?: number): Vector2;
  2514. }
  2515. }
  2516. declare module 'XrFrame/math/vector3' {
  2517. import QuatReadOnly from "XrFrame/math/quaternion";
  2518. import M4ReadOnly from "XrFrame/math/matrix4";
  2519. export default class Vector3 {
  2520. /**
  2521. * x值
  2522. *
  2523. * @type {number}
  2524. * @memberof Vector3
  2525. */
  2526. get x(): number;
  2527. set x(val: number);
  2528. /**
  2529. * y值
  2530. *
  2531. * @type {number}
  2532. * @memberof Vector3
  2533. */
  2534. get y(): number;
  2535. set y(val: number);
  2536. /**
  2537. * z值
  2538. *
  2539. * @type {number}
  2540. * @memberof Vector3
  2541. */
  2542. get z(): number;
  2543. set z(val: number);
  2544. /**
  2545. * 零向量,不要对该对象进行修改
  2546. *
  2547. * @readonly
  2548. * @static
  2549. * @type {Vector3}
  2550. * @memberof Vector3
  2551. */
  2552. static readonly ZERO: Vector3;
  2553. /**
  2554. * 一向量,不要对该对象进行修改
  2555. *
  2556. * @readonly
  2557. * @static
  2558. * @type {Vector3}
  2559. * @memberof Vector3
  2560. */
  2561. static readonly ONE: Vector3;
  2562. /**
  2563. * 上方向,不要对该对象进行修改
  2564. *
  2565. * @static
  2566. * @type {Vector3}
  2567. * @memberof Vector3
  2568. */
  2569. static readonly Up: Vector3;
  2570. /**
  2571. * 前方向,基于左手坐标系,不要对该对象进行修改
  2572. *
  2573. * @static
  2574. * @type {Vector3}
  2575. * @memberof Vector3
  2576. */
  2577. static readonly ForwardLH: Vector3;
  2578. _raw: Float32Array;
  2579. /**
  2580. * 使用一个数组创建
  2581. * 此操作会拷贝一份数组
  2582. *
  2583. * @static
  2584. * @param {number[]} array 数据源,长度必须为3,否则会抛出异常
  2585. * @returns {Vector3} 创建出来的向量
  2586. * @memberof Vector3
  2587. */
  2588. static createFromArray(array: number[]): Vector3;
  2589. /**
  2590. * 使用某个已有的typedArray创建
  2591. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  2592. *
  2593. * @static
  2594. * @param {Float32Array} array 数据源
  2595. * @param {number} [offset=0] 数据源中的偏移
  2596. * @returns {Vector3}
  2597. * @memberof Vector3
  2598. */
  2599. static createFromTypedArray(array: Float32Array, offset?: number): Vector3;
  2600. /**
  2601. * 使用四元数进行向量旋转
  2602. *
  2603. * @static
  2604. * @param {Vector3} source 源向量
  2605. * @param {QuatReadOnly} rotation 用于旋转的四元数
  2606. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2607. * @returns {Vector3} 计算结果
  2608. * @memberof Vector3
  2609. */
  2610. static transformQuat(source: Vector3, rotation: QuatReadOnly, dst?: Vector3): Vector3;
  2611. static transformCoordinate(coordinate: Vector3, transform: M4ReadOnly, dst?: Vector3): Vector3;
  2612. /**
  2613. * 返回向量数据
  2614. *
  2615. * @returns {number[]} 矩阵数据,以JSArray返回
  2616. * @memberof Vector3
  2617. */
  2618. toArray(): [number, number, number];
  2619. /**
  2620. * 判断与目标向量的值是否相等
  2621. *
  2622. * @param {Vector3} v 目标向量
  2623. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  2624. * @memberof Vector3
  2625. */
  2626. equal(v: Vector3): boolean;
  2627. /**
  2628. * 拷贝目标向量的值到该向量
  2629. *
  2630. * @param {Vector3} val 目标向量
  2631. * @returns {Vector3} 自身
  2632. * @memberof Vector3
  2633. */
  2634. set(v: Vector3): Vector3;
  2635. /**
  2636. * 设置向量的值
  2637. *
  2638. * @param {number} x x
  2639. * @param {number} y y
  2640. * @param {number} z z
  2641. * @returns {Vector3} 自身
  2642. * @memberof Vector3
  2643. */
  2644. setValue(x: number, y: number, z: number): Vector3;
  2645. setFromArray(xyz: number[]): Vector3;
  2646. /**
  2647. * 向量加法
  2648. *
  2649. * @param {Vector3} v 目标向量
  2650. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2651. * @returns {Vector3} 计算结果
  2652. * @memberof Vector3
  2653. */
  2654. add(v: Vector3, dst?: Vector3): Vector3;
  2655. /**
  2656. * 向量减法
  2657. *
  2658. * @param {Vector3} v 目标向量
  2659. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2660. * @returns {Vector3} 计算结果
  2661. * @memberof Vector3
  2662. */
  2663. sub(v: Vector3, dst?: Vector3): Vector3;
  2664. /**
  2665. * 向量叉乘
  2666. *
  2667. * @param {Vector3} v 目标向量
  2668. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2669. * @returns {Vector3} 计算结果
  2670. * @memberof Vector3
  2671. */
  2672. cross(v: Vector3, dst?: Vector3): Vector3;
  2673. /**
  2674. * 向量归一化
  2675. *
  2676. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2677. * @returns {Vector3} 计算结果
  2678. * @memberof Vector3
  2679. */
  2680. normalize(dst?: Vector3): Vector3;
  2681. /**
  2682. * 向量缩放
  2683. *
  2684. * @param {number} f 缩放比
  2685. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2686. * @returns {Vector3} 计算结果
  2687. * @memberof Vector3
  2688. */
  2689. scale(f: number, dst?: Vector3): Vector3;
  2690. /**
  2691. * 向量缩放
  2692. *
  2693. * @param {number} x x缩放比
  2694. * @param {number} y y缩放比
  2695. * @param {number} z z缩放比
  2696. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2697. * @returns {Vector3} 计算结果
  2698. * @memberof Vector3
  2699. */
  2700. scaleXYZ(x: number, y: number, z: number, dst?: Vector3): Vector3;
  2701. /**
  2702. * 在该向量与目标向量之间计算插值
  2703. *
  2704. * @param {Vector3} v 目标向量
  2705. * @param {number} f 插值系数
  2706. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2707. * @returns {Vector3} 计算结果
  2708. * @memberof Vector3
  2709. */
  2710. lerp(v: Vector3, f: number, dst?: Vector3): Vector3;
  2711. /**
  2712. * 取反
  2713. * @returns
  2714. */
  2715. negate(): this;
  2716. /**
  2717. * 向量点乘
  2718. *
  2719. * @param {Vector3} v 目标向量
  2720. * @returns {number} 计算结果
  2721. * @memberof Vector3
  2722. */
  2723. dot(v: Vector3): number;
  2724. /**
  2725. * 向量的模
  2726. *
  2727. * @returns {number} 计算结果
  2728. * @memberof Vector3
  2729. */
  2730. length(): number;
  2731. /**
  2732. * 拷贝该向量
  2733. *
  2734. * @returns {Vector3} 拷贝出来的对象
  2735. * @memberof Vector3
  2736. */
  2737. clone(): Vector3;
  2738. /**
  2739. * 是否为零向量
  2740. *
  2741. * @returns {boolean}
  2742. * @memberof Vector3
  2743. */
  2744. isZero(): boolean;
  2745. /**
  2746. * 获取到目标点的距离
  2747. *
  2748. * @param {Vector3} p 目标点
  2749. * @returns {number} 计算结果
  2750. * @memberof Vector3
  2751. */
  2752. distanceTo(p: Vector3): number;
  2753. /**
  2754. * 获取到目标点的角度
  2755. *
  2756. * @param {Vector3} location 目标点
  2757. * @returns {number} 计算结果
  2758. * @memberof Vector3
  2759. */
  2760. angleTo(location: Vector3, dst?: Vector3): Vector3;
  2761. setFromMatrixColumn(m: M4ReadOnly, index: number): Vector3;
  2762. fromArray(array: Float32Array, offset: number): Vector3;
  2763. setFromMatrixScale(m: M4ReadOnly): Vector3;
  2764. /**
  2765. * create by janzen
  2766. * Sets this vector to the position elements of the transformation matrix
  2767. */
  2768. setFromMatrixPosition(worldMatrix: M4ReadOnly): Vector3;
  2769. /**
  2770. * create by janzen
  2771. * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
  2772. */
  2773. applyMatrix4(m: M4ReadOnly): Vector3;
  2774. /**
  2775. * create by roamye
  2776. * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
  2777. */
  2778. applyMatrix4Raw(m: Float32Array): this;
  2779. applyQuaternion(q: QuatReadOnly): this;
  2780. /**
  2781. * create by janzen
  2782. * Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.
  2783. */
  2784. transformDirection(m: M4ReadOnly): Vector3;
  2785. /**
  2786. * create by roamye
  2787. * Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.
  2788. */
  2789. transformDirectionRaw(raw: Float32Array): Vector3;
  2790. /**
  2791. * created by shanexyzhou
  2792. * 从物理引擎内的RawVec3f生成Vector3
  2793. */
  2794. static fromPhysics(v: any): Vector3;
  2795. fromPhysics(v: any): Vector3;
  2796. static Phys3D?: typeof phys3D;
  2797. static clearPhysicsPool(): void;
  2798. /**
  2799. * created by shanexyzhou
  2800. * 生成物理引擎内的RawVec3f
  2801. */
  2802. toPhysics(): any;
  2803. setArray(value: ArrayLike<number>, offset?: number): Vector3;
  2804. print(): void;
  2805. }
  2806. export class Vector3_READONLY extends Vector3 {
  2807. get x(): number;
  2808. set x(v: number);
  2809. get y(): number;
  2810. set y(v: number);
  2811. get z(): number;
  2812. set z(v: number);
  2813. constructor(array?: Float32Array, offset?: number);
  2814. set(): this;
  2815. setValue(): this;
  2816. }
  2817. }
  2818. declare module 'XrFrame/math/vector4' {
  2819. export default class Vector4 {
  2820. /**
  2821. * x值
  2822. *
  2823. * @type {number}
  2824. * @memberof Vector4
  2825. */
  2826. get x(): number;
  2827. set x(val: number);
  2828. /**
  2829. * y值
  2830. *
  2831. * @type {number}
  2832. * @memberof Vector4
  2833. */
  2834. get y(): number;
  2835. set y(val: number);
  2836. /**
  2837. * z值
  2838. *
  2839. * @type {number}
  2840. * @memberof Vector4
  2841. */
  2842. get z(): number;
  2843. set z(val: number);
  2844. /**
  2845. * w值
  2846. *
  2847. * @type {number}
  2848. * @memberof Vector4
  2849. */
  2850. get w(): number;
  2851. set w(val: number);
  2852. /**
  2853. * 零向量,不要对该对象进行修改
  2854. *
  2855. * @static
  2856. * @readonly
  2857. * @type {Vector4}
  2858. * @memberof Vector4
  2859. */
  2860. static readonly ZERO: Vector4;
  2861. /**
  2862. * 一向量,不要对该对象进行修改
  2863. *
  2864. * @readonly
  2865. * @static
  2866. * @type {V3ReadOnly}
  2867. * @memberof Vector3
  2868. */
  2869. static readonly ONE: Vector4;
  2870. _raw: Float32Array;
  2871. /**
  2872. * 使用一个数组创建
  2873. * 此操作会拷贝一份数组
  2874. *
  2875. * @static
  2876. * @param {number[]} array 数据源,长度必须为4,否则会抛出异常
  2877. * @returns {Vector4} 创建出来的向量
  2878. * @memberof Vector4
  2879. */
  2880. static createFromArray(array: number[]): Vector4;
  2881. /**
  2882. * 使用某个已有的typedArray创建
  2883. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  2884. *
  2885. * @static
  2886. * @param {Float32Array} array 数据源
  2887. * @param {number} [offset=0] 数据源中的偏移
  2888. * @returns {Vector4}
  2889. * @memberof Vector4
  2890. */
  2891. static createFromTypedArray(array: Float32Array, offset?: number): Vector4;
  2892. /**
  2893. * 返回向量数据
  2894. *
  2895. * @returns {number[]} 矩阵数据,以JSArray返回
  2896. * @memberof Vector4
  2897. */
  2898. toArray(): number[];
  2899. /**
  2900. * 判断与目标向量的值是否相等
  2901. *
  2902. * @param {Vector4} v 目标向量
  2903. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  2904. * @memberof Vector4
  2905. */
  2906. equal(v: Vector4): boolean;
  2907. /**
  2908. * 拷贝目标向量的值到该向量
  2909. *
  2910. * @param {Vector4} val 目标向量
  2911. * @returns {Vector4} 自身
  2912. * @memberof Vector4
  2913. */
  2914. set(v: Vector4): Vector4;
  2915. /**
  2916. * 设置向量的值
  2917. *
  2918. * @param {number} x x值
  2919. * @param {number} y y值
  2920. * @param {number} z z值
  2921. * @param {number} w w值
  2922. * @returns {Vector4} 自身
  2923. * @memberof Vector4
  2924. */
  2925. setValue(x: number, y: number, z: number, w: number): Vector4;
  2926. /**
  2927. * 向量加法
  2928. *
  2929. * @param {Vector4} v 目标向量
  2930. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2931. * @returns {Vector4} 计算结果
  2932. * @memberof Vector4
  2933. */
  2934. add(v: Vector4, dst?: Vector4): Vector4;
  2935. /**
  2936. * 向量减法
  2937. *
  2938. * @param {Vector4} v 目标向量
  2939. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2940. * @returns {Vector4} 计算结果
  2941. * @memberof Vector4
  2942. */
  2943. sub(v: Vector4, dst?: Vector4): Vector4;
  2944. /**
  2945. * 向量缩放
  2946. *
  2947. * @param {number} f 缩放比
  2948. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2949. * @returns {Vector4} 计算结果
  2950. * @memberof Vector4
  2951. */
  2952. scale(f: number, dst?: Vector4): Vector4;
  2953. /**
  2954. * 在该向量与目标向量之间计算插值
  2955. *
  2956. * @param {Vector4} v 目标向量
  2957. * @param {number} f 插值系数
  2958. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  2959. * @returns {Vector4} 计算结果
  2960. * @memberof Vector4
  2961. */
  2962. lerp(v: Vector4, f: number, dst?: Vector4): Vector4;
  2963. /**
  2964. * 取反
  2965. * @returns
  2966. */
  2967. negate(): this;
  2968. /**
  2969. * 向量点乘
  2970. *
  2971. * @param {Vector4} v 目标向量
  2972. * @returns {number} 计算结果
  2973. * @memberof Vector4
  2974. */
  2975. dot(v: Vector4): number;
  2976. /**
  2977. * 是否为零向量
  2978. *
  2979. * @returns {boolean}
  2980. * @memberof Vector4
  2981. */
  2982. isZero(): boolean;
  2983. /**
  2984. * 拷贝该向量
  2985. *
  2986. * @returns {Vector4} 拷贝出来的对象
  2987. * @memberof Vector4
  2988. */
  2989. clone(): Vector4;
  2990. setArray(value: ArrayLike<number>, offset?: number): Vector4;
  2991. }
  2992. }
  2993. declare module 'XrFrame/math/quaternion' {
  2994. import Vector3 from "XrFrame/math/vector3";
  2995. import V3ReadOnly from "XrFrame/math/vector3";
  2996. import QuatReadOnly from "XrFrame/math/quaternion";
  2997. import M4ReadOnly from "XrFrame/math/matrix4";
  2998. /**
  2999. * @public
  3000. */
  3001. export default class Quaternion {
  3002. set x(val: number);
  3003. /**
  3004. * y值
  3005. *
  3006. * @type {number}
  3007. * @memberof Quaternion
  3008. */
  3009. get y(): number;
  3010. set y(val: number);
  3011. /**
  3012. * z值
  3013. *
  3014. * @type {number}
  3015. * @memberof Quaternion
  3016. */
  3017. get z(): number;
  3018. set z(val: number);
  3019. /**
  3020. * w值
  3021. *
  3022. * @type {number}
  3023. * @memberof Quaternion
  3024. */
  3025. get w(): number;
  3026. set w(val: number);
  3027. /**
  3028. * 默认四元数,不要对该对象进行修改
  3029. *
  3030. * @readonly
  3031. * @static
  3032. * @type {QuatReadOnly}
  3033. * @memberof Quaternion
  3034. */
  3035. static readonly DEFAULT: QuatReadOnly;
  3036. _raw: Float32Array;
  3037. /**
  3038. * 从旋转矩阵创建
  3039. *
  3040. * @static
  3041. * @param {Matrix4} mat
  3042. * @param {Quaternion} [dst]
  3043. * @returns {Quaternion}
  3044. * @memberof Quaternion
  3045. */
  3046. static createFromMatrix4(mat: M4ReadOnly, dst?: Quaternion): Quaternion;
  3047. /**
  3048. * 从轴向旋转创建
  3049. *
  3050. * @static
  3051. * @param {V3ReadOnly} axis 旋转轴
  3052. * @param {number} rad 旋转幅度
  3053. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3054. * @returns {Quaternion} 计算结果
  3055. * @memberof Quaternion
  3056. */
  3057. static createFromAxisAngle(axis: V3ReadOnly, rad: number, dst?: Quaternion): Quaternion;
  3058. /**
  3059. * 由视角方向创建四元数
  3060. *
  3061. * @static
  3062. * @param {V3ReadOnly} forward 前方向
  3063. * @param {V3ReadOnly} up 上方向
  3064. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3065. * @returns {Quaternion} 计算结果
  3066. * @memberof Quaternion
  3067. */
  3068. static lookRotation(forward: V3ReadOnly, up: V3ReadOnly, dst?: Quaternion): Quaternion;
  3069. /**
  3070. * 使用数值创建
  3071. *
  3072. * @static
  3073. * @param {number} x x
  3074. * @param {number} y y
  3075. * @param {number} z z
  3076. * @param {number} w w
  3077. * @returns {Quaternion} 创建出来的四元数
  3078. * @memberof Quaternion
  3079. */
  3080. static createFromNumber(x: number, y: number, z: number, w: number): Quaternion;
  3081. /**
  3082. * 使用一个数组创建
  3083. * 此操作会拷贝一份数组
  3084. *
  3085. * @static
  3086. * @param {number[]} array 数据源,长度必须为4,否则会抛出异常
  3087. * @returns {Quaternion}
  3088. * @memberof Quaternion
  3089. */
  3090. static createFromArray(array: number[]): Quaternion;
  3091. /**
  3092. * 使用某个已有的typedArray创建
  3093. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3094. *
  3095. * @static
  3096. * @param {Float32Array} array 数据源
  3097. * @param {number} [offset=0] 数据源中的偏移
  3098. * @returns {Quaternion}
  3099. * @memberof Quaternion
  3100. */
  3101. static createFromTypedArray(array: Float32Array, offset?: number): Quaternion;
  3102. /**
  3103. * 通过俩个向量创建四元数
  3104. * @param vFrom
  3105. * @param vTo
  3106. * @returns
  3107. */
  3108. static createFromUnitVectors(vFrom: Vector3, vTo: Vector3): QuatReadOnly;
  3109. /**
  3110. * 拷贝目标四元数的值到自身
  3111. *
  3112. * @param {Quaternion} quat 目标四元数
  3113. * @returns {Quaternion} 自身
  3114. * @memberof Quaternion
  3115. */
  3116. set(quat: Quaternion): Quaternion;
  3117. /**
  3118. * 设置四元数的值
  3119. *
  3120. * @param {number} x
  3121. * @param {number} y
  3122. * @param {number} z
  3123. * @param {number} w
  3124. * @returns {Quaternion} 自身
  3125. * @memberof Quaternion
  3126. */
  3127. setValue(x: number, y: number, z: number, w: number): Quaternion;
  3128. /**
  3129. * 球面插值
  3130. *
  3131. * @param {Quaternion} right 目标四元数
  3132. * @param {number} t 插值系数,越接近 1 则结果越接近目标
  3133. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3134. * @returns {Quaternion} 计算结果
  3135. * @memberof Quaternion
  3136. */
  3137. slerp(right: QuatReadOnly, t: number, dst?: Quaternion): Quaternion;
  3138. /**
  3139. * 四元数反转
  3140. *
  3141. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3142. * @returns {Quaternion} 计算结果
  3143. * @memberof Quaternion
  3144. */
  3145. invert(dst?: Quaternion): Quaternion;
  3146. /**
  3147. * 四元数相加
  3148. *
  3149. * @param {Quaternion} quat 目标四元数
  3150. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3151. * @returns {Quaternion} 计算结果
  3152. * @memberof Quaternion
  3153. */
  3154. add(quat: QuatReadOnly, dst?: Quaternion): Quaternion;
  3155. /**
  3156. * 四元数相减
  3157. *
  3158. * @param {Quaternion} quat 目标四元数
  3159. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3160. * @returns {Quaternion} 计算结果
  3161. * @memberof Quaternion
  3162. */
  3163. sub(quat: QuatReadOnly, dst?: Quaternion): Quaternion;
  3164. /**
  3165. * 四元数相乘
  3166. *
  3167. * @param {Quaternion} quat 目标四元数
  3168. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3169. * @returns {Quaternion} 计算结果
  3170. * @memberof Quaternion
  3171. */
  3172. multiply(quat: QuatReadOnly, dst?: Quaternion): Quaternion;
  3173. premultiply(q: QuatReadOnly): QuatReadOnly;
  3174. /**
  3175. * 点乘
  3176. * @param q
  3177. */
  3178. dot(q: QuatReadOnly): number;
  3179. length(): number;
  3180. normalize(): this;
  3181. setFromUnitVectors(vFrom: any, vTo: any): this;
  3182. setFromYawRollPitch(yaw: number, roll: number, pitch: number): void;
  3183. setFromEulerAngles(euler: Vector3): void;
  3184. /**
  3185. * 相对角度
  3186. * @param q
  3187. */
  3188. angleTo(q: QuatReadOnly): number;
  3189. /**
  3190. * 转向对应的角度
  3191. * @param q
  3192. * @param step
  3193. */
  3194. rotateTowards(q: any, step: any): QuatReadOnly;
  3195. /**
  3196. * 拷贝四元数
  3197. *
  3198. * @returns {Quaternion} 拷贝后的对象
  3199. * @memberof Quaternion
  3200. */
  3201. clone(): Quaternion;
  3202. /**
  3203. * 四元数是否为默认四元数(表示零旋转)
  3204. *
  3205. * @returns {boolean}
  3206. * @memberof Quaternion
  3207. */
  3208. isDefault(): boolean;
  3209. /**
  3210. * 将该四元数转换成欧拉角,x代表Pitch,y代表Yaw,z代表Roll
  3211. * 旋转的顺序为YXZ
  3212. *
  3213. * @notation 2022.6.1 by shanexyzhou
  3214. * 这个函数有bug:
  3215. * 正确转换:[ -0.7, 0, 0, 0.7 ] → [ x: -1.5707963, y: 0, z: 0 ]
  3216. * 目前结果:[ x: -1.5707963, y: -1.5707963, z: 1.5707963 ] (错误)
  3217. * 待修复,目前先别用这个函数。
  3218. *
  3219. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3220. * @returns {Vector3} 计算结果
  3221. * @memberof Quaternion
  3222. */
  3223. toEulerAngles(dst?: Vector3): Vector3;
  3224. /**
  3225. * 判断与目标四元数的值是否相等
  3226. *
  3227. * @param {QuatReadOnly} quat 目标四元数
  3228. * @returns {boolean}
  3229. * @memberof Quaternion
  3230. */
  3231. equal(quat: QuatReadOnly): boolean;
  3232. /**
  3233. * created by shanexyzhou
  3234. * 从物理引擎内的RawQuaternion生成Quaternion
  3235. */
  3236. static fromPhysics(v: phys3D.RawQuaternion): Quaternion;
  3237. fromPhysics(v: phys3D.RawQuaternion): Quaternion;
  3238. static Phys3D?: typeof phys3D;
  3239. static clearPhysicsPool(): void;
  3240. /**
  3241. * created by shanexyzhou
  3242. * 生成物理引擎内的RawQuaternion
  3243. */
  3244. toPhysics(): phys3D.RawQuaternion;
  3245. setArray(value: ArrayLike<number>, offset?: number): Quaternion;
  3246. }
  3247. }
  3248. declare module 'XrFrame/math/matrix3' {
  3249. import Vector2 from "XrFrame/math/vector2";
  3250. import V2ReadOnly from "XrFrame/math/vector2";
  3251. export default class Matrix3 {
  3252. get raw(): Float32Array;
  3253. _raw: Float32Array;
  3254. /**
  3255. * 使用一个数组创建
  3256. * 此操作会拷贝一份数组
  3257. *
  3258. * @static
  3259. * @param {number[]} array 数据源,长度必须为9,否则会抛出异常
  3260. * @returns {Matrix3} 创建出来的矩阵
  3261. * @memberof Matrix3
  3262. */
  3263. static createFromArray(array: number[]): Matrix3;
  3264. /**
  3265. * 使用某个已有的typedArray创建
  3266. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3267. *
  3268. * @static
  3269. * @param {Float32Array} array 数据源
  3270. * @param {number} [offset=0] 数据源中的偏移
  3271. * @returns {Matrix3} 创建出来的矩阵
  3272. * @memberof Matrix3
  3273. */
  3274. static createFromTypedArray(array: Float32Array, offset?: number): Matrix3;
  3275. /**
  3276. * 返回矩阵数据
  3277. *
  3278. * @returns {number[]} 矩阵数据,以JSArray返回
  3279. * @memberof Matrix3
  3280. */
  3281. toArray(): number[];
  3282. /**
  3283. * 将该矩阵进行位移变换
  3284. *
  3285. * @param {number} tx x轴位移
  3286. * @param {number} ty y轴位移
  3287. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3288. * @returns {Matrix3} 计算结果
  3289. * @memberof Matrix3
  3290. */
  3291. translate(tx: number, ty: number, dst?: Matrix3): Matrix3;
  3292. /**
  3293. * 将该矩阵进行缩放变换
  3294. *
  3295. * @param {number} sx x轴缩放
  3296. * @param {number} sy y轴缩放
  3297. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3298. * @returns {Matrix3} 计算结果
  3299. * @memberof Matrix3
  3300. */
  3301. scale(sx: number, sy: number, dst?: Matrix3): Matrix3;
  3302. /**
  3303. * 将该矩阵进行旋转变换
  3304. *
  3305. * @param {number} radians 旋转幅度,用弧度表示
  3306. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3307. * @returns {Matrix3} 计算结果
  3308. * @memberof Matrix3
  3309. */
  3310. rotate(radians: number, dst?: Matrix3): Matrix3;
  3311. /**
  3312. * 求该矩阵的逆
  3313. *
  3314. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3315. * @returns {Matrix3} 计算结果
  3316. * @memberof Matrix3
  3317. */
  3318. inverse(dst?: Matrix3): Matrix3;
  3319. /**
  3320. * 将该矩阵与另一个矩阵相乘
  3321. *
  3322. * @param {Matrix3} m 右乘矩阵
  3323. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3324. * @returns {Matrix3} 计算结果
  3325. * @memberof Matrix3
  3326. */
  3327. multiply(m: Matrix3, dst?: Matrix3): Matrix3;
  3328. /**
  3329. * 矩阵变换作用于点
  3330. *
  3331. * @param {Vector2} v 点
  3332. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3333. * @returns {Vector2} 计算结果
  3334. * @memberof Matrix3
  3335. */
  3336. transformPoint(v: V2ReadOnly, dst?: Vector2): Vector2;
  3337. setArray(value: ArrayLike<number>, offset?: number): Matrix3;
  3338. }
  3339. }
  3340. declare module 'XrFrame/math/matrix4' {
  3341. import Vector3 from "XrFrame/math/vector3";
  3342. import Vector4 from "XrFrame/math/vector4";
  3343. import V3ReadOnly from "XrFrame/math/vector3";
  3344. import V4ReadOnly from "XrFrame/math/vector4";
  3345. import QuatReadOnly from "XrFrame/math/quaternion";
  3346. import M3ReadOnly from "XrFrame/math/matrix3";
  3347. /**
  3348. * @public
  3349. */
  3350. export default class Matrix4 {
  3351. _raw: Float32Array;
  3352. /**
  3353. * 构造相机矩阵
  3354. *
  3355. * @static
  3356. * @param {Vector3} position 相机位置
  3357. * @param {Vector3} target 相机目标位置
  3358. * @param {Vector3} up 上方向
  3359. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3360. * @returns {Matrix4} 计算结果
  3361. * @memberof Matrix4
  3362. */
  3363. static lookAt(position: V3ReadOnly, target: V3ReadOnly, up: V3ReadOnly, dst?: Matrix4): Matrix4;
  3364. /**
  3365. * 构造透视投影矩阵
  3366. *
  3367. * @static
  3368. * @param {number} fieldOfViewRadians 视野大小,用弧度表示
  3369. * @param {number} aspect 宽高比
  3370. * @param {number} near 近平面
  3371. * @param {number} far 远平面
  3372. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3373. * @returns {Matrix4} 计算结果
  3374. * @memberof Matrix4
  3375. */
  3376. static perspective(fieldOfViewRadians: number, aspect: number, near: number, far: number, dst?: Matrix4): Matrix4;
  3377. /**
  3378. * 构造正交投影矩阵
  3379. *
  3380. * @static
  3381. * @param {number} left 左平面
  3382. * @param {number} right 右平面
  3383. * @param {number} bottom 上平面
  3384. * @param {number} top 下平面
  3385. * @param {number} near 近平面
  3386. * @param {number} far 远平面
  3387. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3388. * @returns {Matrix4} 计算结果
  3389. * @memberof Matrix4
  3390. */
  3391. static orthographic(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Matrix4): Matrix4;
  3392. /**
  3393. * 将四元数转换为旋转矩阵
  3394. *
  3395. * @static
  3396. * @param {Quaternion} quat 四元数
  3397. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3398. * @returns {Matrix4} 计算结果
  3399. * @memberof Matrix4
  3400. */
  3401. static fromQuaternion(quat: QuatReadOnly, dst?: Matrix4): Matrix4;
  3402. /**
  3403. * 使用一个数组创建
  3404. * 此操作会拷贝一份数组
  3405. *
  3406. * @static
  3407. * @param {number[]} array 数据源,长度必须为16,否则会抛出异常
  3408. * @returns {Matrix4} 创建出来的矩阵
  3409. * @memberof Matrix4
  3410. */
  3411. static createFromArray(array: number[]): Matrix4;
  3412. /**
  3413. * 使用某个已有的typedArray创建
  3414. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3415. *
  3416. * @static
  3417. * @param {Float32Array} array 数据源
  3418. * @param {number} [offset=0] 数据源中的偏移
  3419. * @returns {Matrix4} 创建出来的矩阵
  3420. * @memberof Matrix4
  3421. */
  3422. static createFromTypedArray(array: Float32Array, offset?: number): Matrix4;
  3423. /**
  3424. * 创建绕X轴旋转的矩阵
  3425. *
  3426. * @static
  3427. * @param {number} rad 旋转幅度,用弧度表示
  3428. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3429. * @returns {Matrix4} 计算结果
  3430. * @memberof Matrix4
  3431. */
  3432. static createRotationX(rad: number, dst?: Matrix4): Matrix4;
  3433. /**
  3434. * 创建绕Y轴旋转的矩阵
  3435. *
  3436. * @static
  3437. * @param {number} rad 旋转幅度,用弧度表示
  3438. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3439. * @returns {Matrix4} 计算结果
  3440. * @memberof Matrix4
  3441. */
  3442. static createRotationY(rad: number, dst?: Matrix4): Matrix4;
  3443. /**
  3444. * 创建绕Z轴旋转的矩阵
  3445. *
  3446. * @static
  3447. * @param {number} rad 旋转轴
  3448. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3449. * @returns {Matrix4} 计算结果
  3450. * @memberof Matrix4
  3451. */
  3452. static createRotationZ(rad: number, dst?: Matrix4): Matrix4;
  3453. /**
  3454. * 创建绕指定轴旋转的矩阵
  3455. *
  3456. * @static
  3457. * @param {Vector3} axis 旋转轴
  3458. * @param {number} angleInRadians 旋转幅度,用弧度表示
  3459. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3460. * @returns {Matrix4} 计算结果
  3461. * @memberof Matrix4
  3462. */
  3463. static createRotationAxis(axis: V3ReadOnly, angleInRadians: number, dst?: Matrix4): Matrix4;
  3464. /**
  3465. * 将位移旋转缩放合成一个RST矩阵,旋转用矩阵表示
  3466. *
  3467. * @static
  3468. * @param {V3ReadOnly} translation 位移向量
  3469. * @param {M4ReadOnly} rotation 旋转矩阵
  3470. * @param {V3ReadOnly} scale 缩放向量
  3471. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3472. * @returns {Matrix4} 计算结果
  3473. * @memberof Matrix4
  3474. */
  3475. static composeTRS(translation: V3ReadOnly, rotation: Matrix4, scale: V3ReadOnly, dst?: Matrix4): Matrix4;
  3476. /**
  3477. * 将位移旋转缩放合成一个RST矩阵,旋转用四元数表示
  3478. *
  3479. * @static
  3480. * @param {V3ReadOnly} translation 位移向量
  3481. * @param {QuatReadOnly} rotation 旋转四元数
  3482. * @param {V3ReadOnly} scale 缩放向量
  3483. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3484. * @returns {Matrix4} 计算结果
  3485. * @memberof Matrix4
  3486. */
  3487. static composeTQS(translation: V3ReadOnly, rotation: QuatReadOnly, scale: V3ReadOnly, dst?: Matrix4): Matrix4;
  3488. /**
  3489. * 从二维RST矩阵扩展到三维RST矩阵
  3490. *
  3491. * @static
  3492. * @param {Matrix3} m3 二维RST矩阵
  3493. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3494. * @returns {Matrix4} 计算结果
  3495. * @memberof Matrix4
  3496. */
  3497. static composeFromRST3(m3: M3ReadOnly, dst?: Matrix4): Matrix4;
  3498. /**
  3499. * 返回矩阵数据
  3500. *
  3501. * @returns {number[]} 矩阵数据,以JSArray返回
  3502. * @memberof Matrix4
  3503. */
  3504. toArray(): number[];
  3505. /**
  3506. * 将该矩阵进行位移变换
  3507. *
  3508. * @param {number} tx x轴位移
  3509. * @param {number} ty y轴位移
  3510. * @param {number} tz z轴位移
  3511. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3512. * @returns {Matrix4} 计算结果
  3513. * @memberof Matrix4
  3514. */
  3515. translate(tx: number, ty: number, tz: number, dst?: Matrix4): Matrix4;
  3516. /**
  3517. * 将该矩阵进行缩放变换
  3518. *
  3519. * @param {number} sx x轴缩放
  3520. * @param {number} sy y轴缩放
  3521. * @param {number} sz z轴缩放
  3522. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3523. * @returns {Matrix4} 计算结果
  3524. * @memberof Matrix4
  3525. */
  3526. scale(sx: number, sy: number, sz: number, dst?: Matrix4): Matrix4;
  3527. /**
  3528. * 将该矩阵绕x轴旋转
  3529. *
  3530. * @param {number} rx 旋转幅度,用弧度表示
  3531. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3532. * @returns {Matrix4} 计算结果
  3533. * @memberof Matrix4
  3534. */
  3535. xRotate(rx: number, dst?: Matrix4): Matrix4;
  3536. /**
  3537. * 将该矩阵绕y轴旋转
  3538. *
  3539. * @param {number} ry 旋转幅度,用弧度表示
  3540. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3541. * @returns {Matrix4} 计算结果
  3542. * @memberof Matrix4
  3543. */
  3544. yRotate(ry: number, dst?: Matrix4): Matrix4;
  3545. /**
  3546. * 将该矩阵绕z轴旋转
  3547. *
  3548. * @param {number} rz 旋转幅度,用弧度表示
  3549. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3550. * @returns {Matrix4} 计算结果
  3551. * @memberof Matrix4
  3552. */
  3553. zRotate(rz: number, dst?: Matrix4): Matrix4;
  3554. /**
  3555. * 将该矩阵绕指定轴旋转
  3556. *
  3557. * @param {Vector3} axis 轴向量
  3558. * @param {number} angleInRadians 旋转幅度,用弧度表示
  3559. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3560. * @returns {Matrix4} 计算结果
  3561. * @memberof Matrix4
  3562. */
  3563. axisRotate(axis: V3ReadOnly, angleInRadians: number, dst?: Matrix4): Matrix4;
  3564. /**
  3565. * 将该矩阵使用指定四元数旋转
  3566. *
  3567. * @param {Quaternion} quaternion 四元数
  3568. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3569. * @returns {Matrix4} 计算结果
  3570. * @memberof Matrix4
  3571. */
  3572. rotateByQuaternion(quaternion: QuatReadOnly, dst?: Matrix4): Matrix4;
  3573. /**
  3574. * 求该矩阵的逆
  3575. *
  3576. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3577. * @returns {Matrix4} 计算结果
  3578. * @memberof Matrix4
  3579. */
  3580. inverse(dst?: Matrix4): Matrix4;
  3581. /**
  3582. * 求该矩阵的转置
  3583. *
  3584. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3585. * @returns {Matrix4} 计算结果
  3586. * @memberof Matrix4
  3587. */
  3588. transpose(dst?: Matrix4): Matrix4;
  3589. /**
  3590. * 将该矩阵与另一个矩阵相乘
  3591. *
  3592. * @param {Matrix4} m 右乘矩阵
  3593. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3594. * @returns {Matrix4} 计算结果
  3595. * @memberof Matrix4
  3596. */
  3597. multiply(m: Matrix4, dst?: Matrix4): Matrix4;
  3598. /**
  3599. * 矩阵变换作用于向量
  3600. *
  3601. * @param {Vector4} v 向量
  3602. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3603. * @returns {Vector4} 计算结果
  3604. * @memberof Matrix4
  3605. */
  3606. transformVector(v: V4ReadOnly, dst?: Vector4): Vector4;
  3607. /**
  3608. * 矩阵变换作用于方向
  3609. *
  3610. * @param {Vector3} dir 方向
  3611. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3612. * @returns {Vector3} 计算结果
  3613. * @memberof Matrix4
  3614. */
  3615. transformDirection(dir: V3ReadOnly, dst?: Vector3): Vector3;
  3616. /**
  3617. * 矩阵变换作用于点
  3618. *
  3619. * @param {Vector3} p 点
  3620. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3621. * @returns {Vector3} 计算结果
  3622. * @memberof Matrix4
  3623. */
  3624. transformPoint(p: V3ReadOnly, dst?: Vector3): Vector3;
  3625. /**
  3626. * 拷贝目标矩阵的值到该矩阵
  3627. *
  3628. * @param {M4ReadOnly} val 目标
  3629. * @returns {Matrix4} 自身
  3630. * @memberof Matrix4
  3631. */
  3632. set(val: Matrix4): Matrix4;
  3633. /**
  3634. * 拷贝该矩阵
  3635. *
  3636. * @returns {Matrix4} 拷贝出来的对象
  3637. * @memberof Matrix4
  3638. */
  3639. clone(): Matrix4;
  3640. /**
  3641. * 分解RTS矩阵为位移、旋转、缩放向量,返回是否成功
  3642. *
  3643. * @param {Vector3} dstTranslation 目标位移向量
  3644. * @param {Matrix4} dstRotationMatrix 目标旋转矩阵
  3645. * @param {Vector3} dstScale 目标缩放分量
  3646. * @returns {boolean} 分解是否成功,如不成功,可能是缩放分量为0
  3647. * @memberof Matrix4
  3648. */
  3649. decomposeTransRotMatScale(dstTranslation: Vector3, dstRotationMatrix: Matrix4, dstScale: Vector3): boolean;
  3650. /**
  3651. * 设置该矩阵某行某列的值
  3652. *
  3653. * @param {number} value 值
  3654. * @param {number} column 列数
  3655. * @param {number} row 行数
  3656. * @returns {Matrix4} 自身
  3657. * @memberof Matrix4
  3658. */
  3659. setValue(value: number, column: number, row: number): Matrix4;
  3660. /**
  3661. * 获取矩阵某行某列的值
  3662. *
  3663. *
  3664. * @param {number} column 列数
  3665. * @param {number} row 行数
  3666. * @returns {number} 自身
  3667. * @memberof Matrix4
  3668. */
  3669. getValue(column: number, row: number): number;
  3670. /**
  3671. * 设置矩阵某列
  3672. *
  3673. * @param {V4ReadOnly} vec 列向量
  3674. * @param {number} column 列数
  3675. * @returns {Matrix4} 自身
  3676. * @memberof Matrix4
  3677. */
  3678. setColumn(vec: V4ReadOnly, column: number): Matrix4;
  3679. /**
  3680. * 获取矩阵某列
  3681. *
  3682. * @param {number} column 列数
  3683. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3684. * @returns {Vector4} 该列数据
  3685. * @memberof Matrix4
  3686. */
  3687. getColumn(column: number, dst?: Vector4): Vector4;
  3688. /**
  3689. * 设置矩阵某行
  3690. *
  3691. * @param {V4ReadOnly} vec 行向量
  3692. * @param {number} row 行数
  3693. * @returns {Matrix4} 自身
  3694. * @memberof Matrix4
  3695. */
  3696. setRow(vec: V4ReadOnly, row: number): Matrix4;
  3697. /**
  3698. * 获取矩阵某行
  3699. *
  3700. * @param {number} row 行数
  3701. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3702. * @returns {Vector4} 该行数据
  3703. * @memberof Matrix4
  3704. */
  3705. getRow(row: number, dst?: Vector4): Vector4;
  3706. setArray(value: ArrayLike<number>, offset?: number): Matrix4;
  3707. print(): void;
  3708. }
  3709. }
  3710. declare module 'XrFrame/math/color' {
  3711. import Vector3 from "XrFrame/math/vector3";
  3712. export enum BlendType {
  3713. Alpha = 0,
  3714. RGB = 1,
  3715. RGBA = 2,
  3716. None = 3
  3717. }
  3718. export const GetColorFromHex: (str: any) => number;
  3719. /**
  3720. * @public
  3721. */
  3722. export default class Color {
  3723. get r(): number;
  3724. set r(val: number);
  3725. get g(): number;
  3726. set g(val: number);
  3727. get b(): number;
  3728. set b(val: number);
  3729. get a(): number;
  3730. set a(val: number);
  3731. static get WHITE(): Color;
  3732. static get BLACK(): Color;
  3733. static get TRANSPARENT(): Color;
  3734. static BlendType: typeof BlendType;
  3735. static blendColorHex(colorHexA: number, colorHexB: number, type?: BlendType): number;
  3736. static multiplyColorHex(colorHexA: number, colorHexB: number, type?: BlendType): number;
  3737. static getValue32FromRGBA(r: number, g: number, b: number, a: number): number;
  3738. static getValue32FromHSVA(): void;
  3739. static percentRoundFn(num: number): number;
  3740. static diffc(v: number, c: number, diff: number): number;
  3741. static rgb2hsv(r: number, g: number, b: number, dst?: Vector3): Vector3;
  3742. static hsvV2rgb(h: number, s: number, v: number, dst?: Vector3): Vector3;
  3743. static randomMix(colorHexA: number, colorHexB: number, randomSeed?: number): number;
  3744. static fromHex(hex: number): Color;
  3745. static fromHexString(hexString: string): Color;
  3746. static fromFloatArray(arr: number[]): Color;
  3747. equals(target: Color): boolean;
  3748. set(val: Color): void;
  3749. setRGBA(r: number, g: number, b: number, a: number): void;
  3750. setValue32(v32: number): void;
  3751. toNormalizedArray(): [number, number, number, number];
  3752. toRGBAString(): string;
  3753. mix(color: Color, dst?: Color): Color;
  3754. }
  3755. }
  3756. declare module 'XrFrame/math/OBB' {
  3757. import Vector3 from "XrFrame/math/vector3";
  3758. export default class OBB {
  3759. constructor();
  3760. setValues(cenX: number, cenY: number, cenZ: number, forward: Vector3, w: number, h: number, d: number): void;
  3761. get center(): Vector3;
  3762. set center(pos: Vector3);
  3763. get width(): number;
  3764. set width(w: number);
  3765. get height(): number;
  3766. set height(h: number);
  3767. get depth(): number;
  3768. set depth(d: number);
  3769. setForward(forward: Vector3): void;
  3770. get AxisX(): Vector3;
  3771. get AxisY(): Vector3;
  3772. get AxisZ(): Vector3;
  3773. }
  3774. }
  3775. declare module 'XrFrame/math/boundBall' {
  3776. import Vector3 from "XrFrame/math/vector3";
  3777. import V3ReadOnly from "XrFrame/math/vector3";
  3778. export default class BoundBall {
  3779. static readonly OFFSETS: Readonly<{
  3780. center: number;
  3781. radius: number;
  3782. }>;
  3783. /**
  3784. * 包围球中心
  3785. *
  3786. * @type {V3ReadOnly}
  3787. * @memberof BoundBall
  3788. */
  3789. get center(): V3ReadOnly;
  3790. set center(val: V3ReadOnly);
  3791. /**
  3792. * 包围球半径
  3793. *
  3794. * @type {number}
  3795. * @memberof BoundBall
  3796. */
  3797. get radius(): number;
  3798. set radius(val: number);
  3799. _raw: Float32Array;
  3800. _offset: number;
  3801. protected _center?: Vector3;
  3802. constructor(raw?: Float32Array, offset?: number);
  3803. /**
  3804. * 使用中心和半径创建包围球
  3805. *
  3806. * @static
  3807. * @param {V3ReadOnly} center
  3808. * @param {number} radius
  3809. * @returns {BoundBall}
  3810. * @memberof BoundBall
  3811. */
  3812. static createFromCenterAndRadius(center: V3ReadOnly, radius: number): BoundBall;
  3813. /**
  3814. * 设置值
  3815. *
  3816. * @param {V3ReadOnly} center
  3817. * @param {number} radius
  3818. * @returns {BoundBall}
  3819. * @memberof BoundBall
  3820. */
  3821. setValue(center: V3ReadOnly, radius: number): BoundBall;
  3822. /**
  3823. * 使用一系列点初始化
  3824. *
  3825. * @param {V3ReadOnly[]} points
  3826. * @returns {BoundBall} 自身
  3827. * @memberof BoundBall
  3828. */
  3829. initByPoints(points: V3ReadOnly[]): BoundBall;
  3830. initByPointRadius(center: V3ReadOnly, radius: number): void;
  3831. }
  3832. }
  3833. declare module 'XrFrame/math/boundBox' {
  3834. import Vector3 from "XrFrame/math/vector3";
  3835. import V3ReadOnly from "XrFrame/math/vector3";
  3836. export default class BoundBox {
  3837. static readonly OFFSETS: Readonly<{
  3838. center: number;
  3839. size: number;
  3840. }>;
  3841. /**
  3842. * 包围盒中心
  3843. *
  3844. * @type {Vector3}
  3845. * @memberof BoundBox
  3846. */
  3847. get center(): V3ReadOnly;
  3848. set center(val: V3ReadOnly);
  3849. /**
  3850. * 包围盒尺寸
  3851. *
  3852. * @memberof BoundBox
  3853. */
  3854. get size(): V3ReadOnly;
  3855. set size(val: V3ReadOnly);
  3856. _raw: Float32Array;
  3857. _offset: number;
  3858. protected _center?: Vector3;
  3859. protected _size?: Vector3;
  3860. constructor(raw?: Float32Array, offset?: number);
  3861. /**
  3862. * 使用中心和尺寸创建包围球
  3863. *
  3864. * @static
  3865. * @param {V3ReadOnly} center 中心
  3866. * @param {V3ReadOnly} size 尺寸
  3867. * @returns {BoundBall}
  3868. * @memberof BoundBall
  3869. */
  3870. static createFromCenterAndSize(center: V3ReadOnly, size: V3ReadOnly): BoundBox;
  3871. /**
  3872. * 设置值
  3873. *
  3874. * @param {V3ReadOnly} center
  3875. * @param {V3ReadOnly} size
  3876. * @returns {BoundBox}
  3877. * @memberof BoundBox
  3878. */
  3879. setValue(center: V3ReadOnly, size: V3ReadOnly): BoundBox;
  3880. initByPoints(points: Vector3[], length?: number): void;
  3881. startInitByPoints(): void;
  3882. addPoint(corner: Vector3): void;
  3883. endInitByPoints(): void;
  3884. }
  3885. }
  3886. declare module 'XrFrame/math/Spherical' {
  3887. /**
  3888. * Spherical.ts
  3889. *
  3890. * * @Date : 2022/1/14下午4:49:50
  3891. */
  3892. import Vector3 from 'XrFrame/math/vector3';
  3893. /**
  3894. * 球面坐标系。
  3895. */
  3896. export default class Spherical {
  3897. static EPS: number;
  3898. isSpherical: boolean;
  3899. /**
  3900. * 球面半径。
  3901. */
  3902. radius: number;
  3903. /**
  3904. * 点在球面上的横向旋转角度。
  3905. */
  3906. phi: number;
  3907. /**
  3908. * 点在球面上的纵向旋转角度。
  3909. */
  3910. theta: number;
  3911. /**
  3912. * 球面球心。
  3913. */
  3914. center: Vector3;
  3915. constructor(radius?: number, phi?: number, theta?: number);
  3916. set(radius: number, phi: number, theta: number): this;
  3917. clone(): Spherical;
  3918. copy(other: Spherical): this;
  3919. /**
  3920. * restrict phi to be between EPS and PI-EPS。
  3921. */
  3922. makeSafe(): this;
  3923. /**
  3924. * 从笛卡尔坐标系的Vector3转换。
  3925. */
  3926. setFromVector3(vector: Vector3): this;
  3927. /**
  3928. * 从笛卡尔坐标系的x、y、z转换。
  3929. */
  3930. setFromCartesianCoords(x: number, y: number, z: number): this;
  3931. /**
  3932. * 转换到笛卡尔坐标系的Vector3。
  3933. */
  3934. toVector3(vector?: Vector3): Vector3;
  3935. }
  3936. }
  3937. declare module 'XrFrame/kanata/lib/kanata' {
  3938. import * as IKanata from 'XrFrame/kanata/lib/frontend';
  3939. import {IEngineSettings} from 'XrFrame/kanata/lib/backend/interface';
  3940. export * from 'XrFrame/kanata/lib/backend/interface';
  3941. export {ITextureOptions, IRenderPassDescriptor} from 'XrFrame/kanata/lib/index';
  3942. export type AnimatorComponent = IKanata.AnimatorComponent;
  3943. export type CameraComponent = IKanata.CameraComponent;
  3944. export type LightCameraComponent = IKanata.LightCameraComponent;
  3945. export type CullingComponent = IKanata.CullingComponent;
  3946. export type MeshRendererComponent = IKanata.MeshRendererComponent;
  3947. export type SkinnedSkeletonComponent = IKanata.SkinnedSkeletonComponent;
  3948. export type DynamicBonesComponent = IKanata.DynamicBonesComponent;
  3949. export type Entity2D = IKanata.Entity2D;
  3950. export type Entity3D = IKanata.Entity3D;
  3951. export type AnimationClipModel = IKanata.AnimationClipModel;
  3952. export type AnimationClipBinding = IKanata.AnimationClipBinding;
  3953. export type AnimatorControllerModel = IKanata.AnimatorControllerModel;
  3954. export type AnimatorControllerStateModel = IKanata.AnimatorControllerStateModel;
  3955. export type DataBuffer = IKanata.DataBuffer;
  3956. export type DataModel = IKanata.DataModel;
  3957. export type Effect = IKanata.Effect;
  3958. export type Material = IKanata.Material;
  3959. export type SkeletonBoneInverseModel = IKanata.SkeletonBoneInverseModel;
  3960. export type UniformBlock = IKanata.UniformBlock;
  3961. export type UniformDescriptor = IKanata.UniformDescriptor;
  3962. export type IndexBuffer = IKanata.IndexBuffer;
  3963. export type IndexData = IKanata.IndexData;
  3964. export type VertexBuffer = IKanata.VertexBuffer;
  3965. export type VertexData = IKanata.VertexData;
  3966. export type VertexLayout = IKanata.VertexLayout;
  3967. export type VertexDataDescriptor = IKanata.VertexDataDescriptor;
  3968. export type View = IKanata.View;
  3969. export type ScalableList = IKanata.ScalableList;
  3970. export type RenderPass = IKanata.RenderPass;
  3971. export type Texture = IKanata.Texture;
  3972. export type RenderEnv = IKanata.RenderEnv
  3973. export interface IKanataInstance {
  3974. Image: typeof IKanata.Image;
  3975. Downloader: typeof IKanata.Downloader;
  3976. IS_VALID: typeof IKanata.IS_VALID;
  3977. GET_MAIN_CANVAS: typeof IKanata.GET_MAIN_CANVAS;
  3978. Phys3D: typeof IKanata.Phys3D;
  3979. AnimatorComponent: typeof IKanata.AnimatorComponent;
  3980. CameraComponent: typeof IKanata.CameraComponent;
  3981. LightCameraComponent: typeof IKanata.LightCameraComponent;
  3982. CullingComponent: typeof IKanata.CullingComponent;
  3983. MeshRendererComponent: typeof IKanata.MeshRendererComponent;
  3984. SkinnedSkeletonComponent: typeof IKanata.SkinnedSkeletonComponent;
  3985. DynamicBonesComponent: typeof IKanata.DynamicBonesComponent;
  3986. Entity2D: typeof IKanata.Entity2D;
  3987. Entity3D: typeof IKanata.Entity3D;
  3988. AnimationClipModel: typeof IKanata.AnimationClipModel;
  3989. AnimationClipBinding: typeof IKanata.AnimationClipBinding;
  3990. AnimatorControllerModel: typeof IKanata.AnimatorControllerModel;
  3991. AnimatorControllerStateModel: typeof IKanata.AnimatorControllerStateModel;
  3992. DataBuffer: typeof IKanata.DataBuffer;
  3993. DataModel: typeof IKanata.DataModel;
  3994. Effect: typeof IKanata.Effect;
  3995. Material: typeof IKanata.Material;
  3996. SkeletonBoneInverseModel: typeof IKanata.SkeletonBoneInverseModel;
  3997. UniformBlock: typeof IKanata.UniformBlock;
  3998. UniformDescriptor: typeof IKanata.UniformDescriptor;
  3999. IndexBuffer: typeof IKanata.IndexBuffer;
  4000. IndexData: typeof IKanata.IndexData;
  4001. VertexBuffer: typeof IKanata.VertexBuffer;
  4002. VertexData: typeof IKanata.VertexData;
  4003. VertexLayout: typeof IKanata.VertexLayout;
  4004. VertexDataDescriptor: typeof IKanata.VertexDataDescriptor;
  4005. View: typeof IKanata.View;
  4006. ScalableList: typeof IKanata.ScalableList;
  4007. crossContext: typeof IKanata.crossContext;
  4008. RenderPass: typeof IKanata.RenderPass;
  4009. Texture: typeof IKanata.Texture;
  4010. RenderEnv: typeof IKanata.RenderEnv;
  4011. renderEnv: typeof IKanata.renderEnv;
  4012. createWeakRef: typeof IKanata.createWeakRef;
  4013. createWeakRefSentry: typeof IKanata.createWeakRefSentry;
  4014. createNativeUUMap: typeof IKanata.createNativeUUMap;
  4015. createNativeSUMap: typeof IKanata.createNativeSUMap;
  4016. createNativeULUMap: typeof IKanata.createNativeULUMap;
  4017. loadTTFFont: typeof IKanata.loadTTFFont;
  4018. getGlyphInfo: typeof IKanata.getGlyphInfo;
  4019. refreshNodesWorldTransform: typeof IKanata.refreshNodesWorldTransform;
  4020. setGlobalPhysicSystem: typeof IKanata.setGlobalPhysicSystem;
  4021. bindRigidBodyToNode: typeof IKanata.bindRigidBodyToNode;
  4022. bindCCTToNode: typeof IKanata.bindCCTToNode;
  4023. unbindRigidBody: typeof IKanata.unbindRigidBody;
  4024. unbindCCT: typeof IKanata.unbindCCT;
  4025. decodeBase64: typeof IKanata.decodeBase64;
  4026. setNodeName: typeof IKanata.setNodeName;
  4027. setRenderComponentName: typeof IKanata.setRenderComponentName;
  4028. debugPrint: typeof IKanata.debugPrint;
  4029. eventBridge: typeof IKanata.eventBridge;
  4030. destroy: typeof IKanata.destroy;
  4031. update: typeof IKanata.update
  4032. }
  4033. export function CREATE_INSTANCE(MAIN_CANVAS: HTMLCanvasElement, ENGINE_SETTINGS: IEngineSettings, ENGINE_MODE: 'Game' | 'Editor', IS_SUB_CONTEXT: boolean, HOST: string, FIX_INSTANCE: boolean): IKanataInstance;
  4034. export function RELEASE_INSTANCE(MAIN_CANVAS: HTMLCanvasElement): void;
  4035. }
  4036. declare module 'XrFrame/core/Scene' {
  4037. /**
  4038. * Scene.ts
  4039. *
  4040. * * @Date : 2022/3/16下午3:32:57
  4041. */
  4042. import Transform from 'XrFrame/components/Transform';
  4043. import { Kanata } from 'XrFrame/ext';
  4044. import AssetsSystem from 'XrFrame/systems/AssetsSystem';
  4045. import RenderSystem from 'XrFrame/systems/RenderSystem';
  4046. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  4047. import Material from 'XrFrame/assets/Material';
  4048. import RenderTexture, { IRenderTextureOptions } from 'XrFrame/assets/RenderTexture';
  4049. import Effect, { IEffectAsset } from 'XrFrame/assets/Effect';
  4050. import Geometry from 'XrFrame/assets/Geometry';
  4051. import AnimationSystem from 'XrFrame/systems/AnimationSystem';
  4052. import PhysicsSystem from 'XrFrame/systems/PhysicsSystem';
  4053. import ARSystem from 'XrFrame/systems/ARSystem';
  4054. import { XRShadow } from 'XrFrame/elements';
  4055. import { GizmoSystem, ShareSystem, VideoSystem } from 'XrFrame/systems';
  4056. import VideoTexture, { IVideoTextureOptions } from 'XrFrame/assets/VideoTexture';
  4057. import PostProcess, { IPostProcessOptions } from 'XrFrame/assets/PostProcess';
  4058. /**
  4059. * 场景的默认组件,均为系统。
  4060. */
  4061. export const SceneDefaultComponents: IEntityComponents;
  4062. /**
  4063. * 场景的默认映射。
  4064. */
  4065. export const SceneDataMapping: {
  4066. [key: string]: string[];
  4067. };
  4068. export interface TDict<T> {
  4069. [key: string]: T;
  4070. }
  4071. /**
  4072. * 场景,系统核心之一。
  4073. *
  4074. * `Scene`是元素的一种,对应于`xr-scene`标签。
  4075. * 作为整个`xr-frame`组件的根节点,它提供了整个组件运作的一些基本能力,挂在了各大系统,驱动生命周期循环。
  4076. */
  4077. export default class Scene extends Element {
  4078. readonly defaultComponents: IEntityComponents;
  4079. readonly isScene: boolean;
  4080. /**
  4081. * 场景是否已经就绪。
  4082. */
  4083. get ready(): boolean;
  4084. /**
  4085. * 自身。
  4086. */
  4087. get scene(): this;
  4088. /**
  4089. * 一个可以用于快速挂载自己创建的`Element`的`shadow`节点。
  4090. */
  4091. get rootShadow(): XRShadow;
  4092. /**
  4093. * 资源系统。
  4094. */
  4095. get assets(): AssetsSystem;
  4096. /**
  4097. * 渲染系统。
  4098. */
  4099. get render(): RenderSystem;
  4100. /**
  4101. * 动画系统。
  4102. */
  4103. get animation(): AnimationSystem;
  4104. /**
  4105. * 视频系统。
  4106. */
  4107. get video(): VideoSystem;
  4108. /**
  4109. * 物理系统。
  4110. */
  4111. get physics(): PhysicsSystem;
  4112. /**
  4113. * AR系统。
  4114. */
  4115. get ar(): ARSystem;
  4116. /**
  4117. * Gizmo系统。
  4118. */
  4119. get gizmo(): GizmoSystem;
  4120. /**
  4121. * 分享系统。
  4122. */
  4123. get share(): ShareSystem;
  4124. /**
  4125. * 渲染分辨率宽,一般物理点击事件之类的都是参考这个。
  4126. */
  4127. get width(): number;
  4128. /**
  4129. * 渲染分辨率高,一般物理点击事件之类的都是参考这个。
  4130. */
  4131. get height(): number;
  4132. /**
  4133. * 显示分辨率宽。
  4134. */
  4135. get frameWidth(): number;
  4136. /**
  4137. * 显示分辨率高。
  4138. */
  4139. get frameHeight(): number;
  4140. /**
  4141. * 当前时间戳(ms)。
  4142. */
  4143. get timestamp(): number;
  4144. /**
  4145. * @internal
  4146. */
  4147. get renderPass(): Kanata.RenderPass;
  4148. /**
  4149. * @internal
  4150. */
  4151. get rootNode(): import('XrFrame/kanata/lib/index').Entity3D;
  4152. /**
  4153. * @internal
  4154. */
  4155. get canvas(): HTMLCanvasElement;
  4156. /**
  4157. * @internal
  4158. */
  4159. get backendVersion(): number[];
  4160. /**
  4161. * @internal
  4162. */
  4163. versionBefore(major: number, minor: number): boolean;
  4164. /**
  4165. * @internal
  4166. */
  4167. get backendCommit(): string;
  4168. /**
  4169. * @internal
  4170. */
  4171. get backendUsePuppetSokol(): boolean;
  4172. /**
  4173. * @internal
  4174. */
  4175. /**
  4176. * @internal
  4177. */
  4178. /**
  4179. * @internal
  4180. */
  4181. /**
  4182. * 创建一个`Element`,但注意**其只能作为`xr-shadow`的子孙节点**,否则可能会出错!
  4183. *
  4184. * @param attributes 初始化的属性,同于`xml`中对应的标签属性。
  4185. */
  4186. createElement<T extends Element>(clz: new (...args: any) => T, attributes?: {
  4187. [name: string]: string;
  4188. }): T;
  4189. /**
  4190. * @internal
  4191. */
  4192. /**
  4193. * @internal
  4194. */
  4195. /**
  4196. * @internal
  4197. */
  4198. /**
  4199. * @internal
  4200. */
  4201. /**
  4202. * @internal
  4203. */
  4204. /**
  4205. * @internal
  4206. */
  4207. getElementById(id: string): Element;
  4208. /**
  4209. * @internal
  4210. */
  4211. getNodeById(nodeId: string): Transform;
  4212. /**
  4213. * @internal
  4214. */
  4215. /**
  4216. * 手动创建一个`Image`资源。
  4217. *
  4218. * @param autoRelease 此图片在第一次时候后是否释放原始数据,默认释放。
  4219. */
  4220. createImage(autoRelease?: boolean): Kanata.IImage;
  4221. /**
  4222. * 手动创建一个`Texture`资源。
  4223. */
  4224. createTexture(options: Kanata.ITextureOptions): Kanata.Texture;
  4225. /**
  4226. * 手动创建一个`Effect`资源。
  4227. */
  4228. createEffect(description: IEffectAsset): Effect;
  4229. /**
  4230. * 手动创建一个`UniformBlockDescriptor`资源。
  4231. */
  4232. createUniformBlockDesc(options: Kanata.IUniformDescriptorOptions): Kanata.UniformDescriptor;
  4233. /**
  4234. * 手动创建一个`UniformBlock`资源。
  4235. */
  4236. createUniformBlock(descriptor: Kanata.UniformDescriptor): Kanata.UniformBlock;
  4237. /**
  4238. * 手动创建一个`Material`资源。
  4239. */
  4240. createMaterial(effect: Effect, defaultUniforms?: {
  4241. [key: string]: number | ArrayLike<number> | Kanata.Texture;
  4242. }): Material;
  4243. /**
  4244. * 手动创建一个`VertexLayout`资源。
  4245. */
  4246. createVertexLayout(options: Kanata.IVertexLayoutOptions): Kanata.VertexLayout;
  4247. /**
  4248. * 手动创建一个`Geometry`资源。
  4249. */
  4250. createGeometry(vertexLayout: Kanata.VertexLayout, vBuffer: ArrayBufferView, iBuffer: ArrayBufferView, indexType?: Kanata.EIndexType): Geometry;
  4251. /**
  4252. * 手动创建一个`RenderTexture`资源。
  4253. */
  4254. createRenderTexture(options?: IRenderTextureOptions): RenderTexture;
  4255. /**
  4256. * 手动创建一个`VideoTexture`资源。
  4257. */
  4258. createVideoTexture(options?: IVideoTextureOptions): Promise<VideoTexture>;
  4259. /**
  4260. * 手动创建一个`PostProcess`资源。
  4261. */
  4262. createPostProcess(options: IPostProcessOptions): PostProcess;
  4263. }
  4264. }
  4265. declare module 'XrFrame/core/Observable' {
  4266. export default class Observable<TParams = any, TSender = any> {
  4267. isObservable: boolean;
  4268. /**
  4269. * 拥有的监听者数量。
  4270. */
  4271. get count(): number;
  4272. /**
  4273. * 添加一个回调到队列中。
  4274. */
  4275. add(callback: (params: TParams, sender?: TSender) => void | boolean, priority?: number, isOnce?: boolean): this;
  4276. /**
  4277. * 添加一个回调到队列中,并再被触发执行一次后自动移除。
  4278. */
  4279. addOnce(callback: (params: TParams, sender?: TSender) => void | boolean, priority?: number): this;
  4280. /**
  4281. * 清空队列。
  4282. */
  4283. clear(): this;
  4284. /**
  4285. * 从队列中移除一个回调。
  4286. */
  4287. remove(callback: (params: TParams, sender?: TSender) => void | boolean): this;
  4288. /**
  4289. * 通过一个参数触发一次广播,调用所有回调。
  4290. */
  4291. notify(params: TParams, sender?: TSender): this;
  4292. }
  4293. }
  4294. declare module 'XrFrame/components/Transform' {
  4295. /**
  4296. * Transform.ts
  4297. *
  4298. * * @Date : 2022/3/16下午3:48:05
  4299. */
  4300. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4301. import Element from 'XrFrame/core/Element';
  4302. import Matrix4 from 'XrFrame/math/matrix4';
  4303. import Quaternion from 'XrFrame/math/quaternion';
  4304. import Vector3 from 'XrFrame/math/vector3';
  4305. /**
  4306. * {@link Transform}组件数据接口。
  4307. */
  4308. export interface ITransformData {
  4309. /**
  4310. * 设置一个唯一的节点Id,区别于`xml`上的那个`id`。
  4311. * `xml`中的数据类型为`string`。
  4312. */
  4313. nodeId: string;
  4314. /**
  4315. * 节点的位移。
  4316. * `xml`中的数据类型为`number-array`,默认为`0 0 0`。
  4317. */
  4318. position: number[];
  4319. /**
  4320. * 节点的旋转,注意此处为**角度**。
  4321. * `xml`中的数据类型为`number-array`,默认为`0 0 0`。
  4322. */
  4323. rotation: number[];
  4324. /**
  4325. * 节点的位缩放。
  4326. * `xml`中的数据类型为`number-array`,默认为`1 1 1`。
  4327. */
  4328. scale: number[];
  4329. /**
  4330. * 节点的可见性,可以控制该节点以及所有子节点是否可见。
  4331. * `xml`中的数据类型为`boolean`,默认为`true`。
  4332. */
  4333. visible?: boolean;
  4334. /**
  4335. * 节点的层级,作为控制节点以及子节点是否可见的一部分,配合{@link Camera.cullMask}使用。
  4336. * 判定规则为自顶层节点向下,只有全部通过了判定才能显示。
  4337. * `xml`中的数据类型为`number`,默认为`0`。
  4338. */
  4339. layer?: number;
  4340. }
  4341. /**
  4342. * {@link Transform}的`schema`,详见{@link ITransformData}。
  4343. */
  4344. export const TransformSchema: IComponentSchema;
  4345. /**
  4346. * 3D变换组件,作为场景中3D节点的根基,一般被代理到{@link XRNode}元素。
  4347. */
  4348. export default class Transform extends Component<ITransformData> {
  4349. /**
  4350. * 详见{@link TransformSchema}。
  4351. */
  4352. readonly schema: IComponentSchema;
  4353. readonly priority: number;
  4354. get node(): import('XrFrame/kanata/lib/index').Entity3D;
  4355. /**
  4356. * 获取世界矩阵,**注意不可修改**。
  4357. */
  4358. get worldMatrix(): Matrix4;
  4359. /**
  4360. * 获取世界绝对位移,**注意不可修改**。
  4361. */
  4362. get worldPosition(): Vector3;
  4363. /**
  4364. * 获取世界绝对旋转,**注意不可修改**。
  4365. */
  4366. get worldQuaternion(): Quaternion;
  4367. /**
  4368. * 获取世界绝对缩放,**注意不可修改**。
  4369. */
  4370. get worldScale(): Vector3;
  4371. /**
  4372. * 获取世界前向向量,**注意不可修改**。
  4373. */
  4374. get worldForward(): Vector3;
  4375. /**
  4376. * 获取世界上向向量,**注意不可修改**。
  4377. */
  4378. get worldUp(): Vector3;
  4379. /**
  4380. * 获取世界右向向量,**注意不可修改**。
  4381. */
  4382. get worldRight(): Vector3;
  4383. get position(): Vector3;
  4384. /**
  4385. * 注意如果这里直接修改,使用**弧度**。
  4386. */
  4387. get rotation(): Vector3;
  4388. get quaternion(): Quaternion;
  4389. get scale(): Vector3;
  4390. get visible(): boolean;
  4391. set visible(value: boolean);
  4392. get layer(): number;
  4393. set layer(value: number);
  4394. /**
  4395. * @internal
  4396. */
  4397. /**
  4398. * 直接设置本地矩阵。
  4399. */
  4400. setLocalMatrix(mat: Matrix4): void;
  4401. onAdd(parent: Element, data: ITransformData): void;
  4402. onUpdate(data: ITransformData, preData: ITransformData): void;
  4403. onTick(deltaTime: number, data: ITransformData): void;
  4404. onRemove(parent: Element, data: ITransformData): void;
  4405. onRelease(data: ITransformData): void;
  4406. }
  4407. }
  4408. declare module 'XrFrame/components/AssetLoad' {
  4409. /**
  4410. * AssetLoad.ts
  4411. *
  4412. * * @Date : 2022/3/31下午4:56:14
  4413. */
  4414. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4415. import Element from 'XrFrame/core/Element';
  4416. import { IAssetLoadData } from 'XrFrame/loader/types';
  4417. /**
  4418. * {@link AssetLoad}的`schema`,详见{@link IAssetLoadData}。
  4419. */
  4420. export const AssetLoadSchema: IComponentSchema;
  4421. /**
  4422. * 用于加载资源的组件,一般被代理到{@link XRAssetLoad}元素。
  4423. */
  4424. export default class AssetLoad extends Component<IAssetLoadData> {
  4425. /**
  4426. * 详见{@link AssetLoadSchema}。
  4427. */
  4428. readonly schema: IComponentSchema;
  4429. /**
  4430. * @internal
  4431. */
  4432. get loadParams(): IAssetLoadData<any>;
  4433. onAdd(parent: Element, data: IAssetLoadData): void;
  4434. onUpdate(data: IAssetLoadData, preData: IAssetLoadData): void;
  4435. onRemove(parent: Element, data: IAssetLoadData<any>): void;
  4436. }
  4437. }
  4438. declare module 'XrFrame/components/Assets' {
  4439. /**
  4440. * Assets.ts
  4441. *
  4442. * * @Date : 2022/3/24下午3:18:14
  4443. */
  4444. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4445. import { IAssetLoadData } from 'XrFrame/loader/types';
  4446. export interface IAssetsData {
  4447. }
  4448. export const AssetsSchema: IComponentSchema;
  4449. /**
  4450. * 资源加载组组件,会统计作为其子节点的{@link AssetLoad}组件的加载状态,派发事件。
  4451. * 一般被代理到{@link XRAssets}元素。
  4452. *
  4453. * 事件`progress`会在资源加载进度更新时触发,值为`{progress: number, asset: IAssetLoadData}`。
  4454. * 事件`loaded`会在所有资源加载完成是触发,值为`{assets: {[key: string]: IAssetLoadData}, errors: {[key: string]: Error}}`。
  4455. * 详见{@link IAssetLoadData}。
  4456. */
  4457. export default class Assets extends Component<IAssetsData> {
  4458. readonly schema: IComponentSchema;
  4459. }
  4460. }
  4461. declare module 'XrFrame/components/Camera' {
  4462. /**
  4463. * Camera.ts
  4464. *
  4465. * * @Date : 2022/3/17下午5:25:34
  4466. */
  4467. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4468. import Element from 'XrFrame/core/Element';
  4469. import { Kanata } from 'XrFrame/ext';
  4470. import Vector3 from 'XrFrame/math/vector3';
  4471. import Matrix4 from 'XrFrame/math/matrix4';
  4472. import RenderTexture, { IRenderTarget } from 'XrFrame/assets/RenderTexture';
  4473. import Transform from 'XrFrame/components/Transform';
  4474. import Light from 'XrFrame/components/Light';
  4475. import PostProcess from 'XrFrame/assets/PostProcess';
  4476. /**
  4477. * 相机背景渲染模式。
  4478. *
  4479. * `default`模式只执行默认清屏。
  4480. * `skybox`模式配合{@link Env}组件使用。
  4481. * `ar`模式配合{@link ARSystem}使用。
  4482. */
  4483. export type TCameraBackground = 'default' | 'skybox' | 'ar';
  4484. /**
  4485. * {@link Camera}组件数据接口。
  4486. */
  4487. export interface ICameraData {
  4488. /**
  4489. * 相机对准的目标节点,如果不设置则为自由模式。
  4490. * `xml`中的数据类型为节点对应的`nodeId`。
  4491. */
  4492. target?: Transform;
  4493. /**
  4494. * 相机的渲染目标,如果不设置则渲染到屏幕。
  4495. * `xml`中的数据类型为`render-texture`资源。
  4496. */
  4497. renderTarget?: RenderTexture;
  4498. /**
  4499. * 深度,决定在多相机时的渲染顺序。
  4500. * `xml`中的数据类型为`number`。
  4501. */
  4502. depth: number;
  4503. /**
  4504. * 掩码,一般和{@link Transform.layer}一起使用,决定那些节点要被渲染。
  4505. * `xml`中的数据类型为`number`。
  4506. */
  4507. cullMask: number;
  4508. /**
  4509. * 是否为透视相机。
  4510. * `xml`中的数据类型为`boolean`,默认为`true`。
  4511. */
  4512. isPerspective: boolean;
  4513. /**
  4514. * 视场角。
  4515. * `xml`中的数据类型为`number`,默认为`60`。
  4516. */
  4517. fov: number;
  4518. /**
  4519. * 近平面。
  4520. * `xml`中的数据类型为`number`,默认为`0.1`。
  4521. */
  4522. near: number;
  4523. /**
  4524. * 远平面。
  4525. * `xml`中的数据类型为`number`,默认为`100`。
  4526. */
  4527. far: number;
  4528. /**
  4529. * 非透视模式,即正交模式时,可视范围大小。
  4530. * `xml`中的数据类型为`number`,默认为`4`。
  4531. */
  4532. orthSize: number;
  4533. /**
  4534. * 背景清屏模式。
  4535. * `xml`中的数据类型为`string`,默认为`default`。
  4536. */
  4537. background: TCameraBackground;
  4538. /**
  4539. * 是否为AR相机,配合{@link ARSystem}使用。
  4540. * `xml`中的数据类型为`boolean`,默认为`false`。
  4541. * **非常需要注意当设置为`true`时不能同时设置`target`数据!**
  4542. */
  4543. isARCamera: boolean;
  4544. /**
  4545. * 清屏是否要清深度。
  4546. * `xml`中的数据类型为`boolean`,默认为`true`。
  4547. */
  4548. isClearDepth: boolean;
  4549. /**
  4550. * 清屏是否要清模板值。
  4551. * `xml`中的数据类型为`boolean`,默认为`true`。
  4552. */
  4553. isClearStencil: boolean;
  4554. /**
  4555. * 清屏是否要清颜色。
  4556. * `xml`中的数据类型为`boolean`,默认为`true`。
  4557. */
  4558. isClearColor: boolean;
  4559. /**
  4560. * 清屏深度。
  4561. * `xml`中的数据类型为`number`,默认为`1`。
  4562. */
  4563. clearDepth: number;
  4564. /**
  4565. * 清屏模板值。
  4566. * `xml`中的数据类型为`number`,默认为`0`。
  4567. */
  4568. clearStencil: number;
  4569. /**
  4570. * 清屏颜色。
  4571. * `xml`中的数据类型为`color`,默认为`0 0 0 1`。
  4572. */
  4573. clearColor: number[];
  4574. /**
  4575. * 后处理,一个后处理资源id的数组。
  4576. * `xml`中的数据类型为`array`,默认为空。
  4577. */
  4578. postProcess: string[];
  4579. }
  4580. /**
  4581. * {@link Camera}的`schema`,详见{@link ICameraData}。
  4582. */
  4583. export const CameraSchema: IComponentSchema;
  4584. /**
  4585. * 相机组件,一般被代理到{@link XRCamera}元素。
  4586. */
  4587. export default class Camera extends Component<ICameraData> {
  4588. /**
  4589. * 详见{@link CameraSchema}。
  4590. */
  4591. readonly schema: IComponentSchema;
  4592. readonly priority: number;
  4593. /**
  4594. * 相机深度。
  4595. */
  4596. get depth(): number;
  4597. /**
  4598. * @internal
  4599. */
  4600. get renderTarget(): IRenderTarget;
  4601. /**
  4602. * @internal
  4603. */
  4604. get view(): import('XrFrame/kanata/lib/index').View;
  4605. /**
  4606. * @internal
  4607. */
  4608. get id(): number;
  4609. /**
  4610. * @internal。
  4611. */
  4612. get bgStates(): {
  4613. [key: string]: any;
  4614. };
  4615. /**
  4616. * @internal。
  4617. */
  4618. get bgStatesClear(): boolean;
  4619. get background(): TCameraBackground;
  4620. get target(): Transform;
  4621. get near(): number;
  4622. get far(): number;
  4623. get cullMask(): number;
  4624. get postProcess(): PostProcess[];
  4625. get hdr(): boolean;
  4626. /**
  4627. * @internal
  4628. */
  4629. cull(cullResult: Kanata.ScalableList, lightMode: string): void;
  4630. /**
  4631. * @internal
  4632. */
  4633. clear(): void;
  4634. /**
  4635. * @internal
  4636. */
  4637. draw(renderList: Kanata.ScalableList, lightMode: string): void;
  4638. /**
  4639. * @internal
  4640. */
  4641. drawLight(light: Light, renderList: Kanata.ScalableList, lightMode: string): void;
  4642. /**
  4643. * 将世界坐标系位置转换到齐次裁剪空间。
  4644. */
  4645. convertWorldPositionToClip(worldPos: Vector3, dst?: Vector3): Vector3;
  4646. /**
  4647. * 将齐次裁剪空间转换到世界坐标系位置。
  4648. */
  4649. convertClipPositionToWorld(clipPos: Vector3, dst?: Vector3): Vector3;
  4650. /**
  4651. * 修改viewMatrix的设置类型。
  4652. *
  4653. * @param manual 是否要设置为手动模式。
  4654. * @param mat4 手动模式下,要设置的值。
  4655. */
  4656. changeViewMatrix(manual: boolean, mat4?: Matrix4 | Float32Array): void;
  4657. /**
  4658. * 修改projectMatrix的设置类型。
  4659. *
  4660. * @param manual 是否要设置为手动模式。
  4661. * @param mat4 手动模式下,要设置的值。
  4662. */
  4663. changeProjectMatrix(manual: boolean, mat4?: Matrix4 | Float32Array): void;
  4664. /**
  4665. * 修改相机背景的渲染状态。
  4666. *
  4667. * @param states 同{@link Material.setRenderStates}
  4668. */
  4669. setBackgroundRenderStates(states: {
  4670. [key: string]: any;
  4671. }): void;
  4672. clearBackgroundRenderStates(): void;
  4673. onAdd(parent: Element, data: ICameraData): void;
  4674. onUpdate(data: ICameraData, preData: ICameraData): void;
  4675. onRemove(parent: Element, data: ICameraData): void;
  4676. onRelease(data: ICameraData): void;
  4677. protected _processData(data: ICameraData, preData: ICameraData): void;
  4678. }
  4679. }
  4680. declare module 'XrFrame/components/GLTF' {
  4681. import GLTFModel from 'XrFrame/assets/GLTFModel';
  4682. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4683. import Element from 'XrFrame/core/Element';
  4684. import BoundBox from 'XrFrame/math/boundBox';
  4685. import Mesh from 'XrFrame/components/Mesh';
  4686. /**
  4687. * @see {@link GLTF}
  4688. */
  4689. export interface IGLTFData {
  4690. /**
  4691. * 已加载完毕的GLTF模型。
  4692. */
  4693. model: GLTFModel;
  4694. /**
  4695. * 是否投射阴影,默认false。
  4696. */
  4697. castShadow?: boolean;
  4698. /**
  4699. * 是否接受阴影,默认false。
  4700. */
  4701. receiveShadow?: boolean;
  4702. /**
  4703. * 是否不参与剔除,默认false(即参与剔除)。
  4704. */
  4705. neverCull?: boolean;
  4706. /**
  4707. * 修改GLTF的默认renderStates。
  4708. */
  4709. states?: [string, string][];
  4710. }
  4711. export const GLTFSchema: IComponentSchema;
  4712. interface ElementGLTFInfo {
  4713. el: Element;
  4714. hasMesh: boolean;
  4715. meshName?: string;
  4716. meshes?: Array<Mesh>;
  4717. }
  4718. /**
  4719. * 将一个{@link GLTFModel | GLTF模型}实例化并渲染出来。
  4720. * {@link XRGLTF | xr-gltf}标签会自动生成该组件。
  4721. *
  4722. * > 会在当前元素下新建一系列子元素,作为GLTF模型的每个场景的根节点。
  4723. * > 会在当前元素上新建{@link Animator}组件,并向其添加实例化生成的动画片段。
  4724. *
  4725. * @see {@link IGLTFData}
  4726. */
  4727. export default class GLTFComponent extends Component<IGLTFData> {
  4728. readonly schema: IComponentSchema;
  4729. readonly priority: number;
  4730. _subRoots: Array<Element>;
  4731. onUpdate(data: IGLTFData, preData: IGLTFData): void;
  4732. onRemove(parent: Element, data: IGLTFData): void;
  4733. onRelease(data: IGLTFData): void;
  4734. /**
  4735. * 根据GLTF模型中节点的`name`字段来获取内部元素。
  4736. */
  4737. getInternalNodeByName(name: string): Element | undefined;
  4738. /**
  4739. * @internal
  4740. */
  4741. /**
  4742. * 获取GLTF模型实例化过程中生成的所有{@link Mesh}组件。
  4743. */
  4744. get meshes(): Mesh[];
  4745. /**
  4746. * 计算GLTF模型整体的包围盒,返回**模型空间**内的计算结果。
  4747. * 每次调用都会重新计算。
  4748. */
  4749. calcTotalBoundBox(): BoundBox;
  4750. /**
  4751. * 根据GLTF模型中**引用**了Mesh的**Node节点**的`name`字段,来获取对应Mesh下的所有Primitive。
  4752. * 一个GLTF模型中的Primitive节点对应返回中的一个`xr-frame Mesh组件`实例。
  4753. * **如果没有该名字的节点,或者节点未引用Mesh,会返回空数组。*
  4754. * @param name Node节点的`name`(而非Mesh节点)
  4755. */
  4756. getPrimitivesByNodeName(name: string): Array<Mesh>;
  4757. /**
  4758. * 根据GLTF模型中Mesh节点的`name`字段,来获取引用了该Mesh的**所有**Node节点下的所有Primitive。
  4759. * 在xr-frame实现中,每个引用了该Mesh的GLTFNode节点拥有**独立**的一份Primitives副本,**每个**Node节点下的**每个**Primitive对应一个`xr-frame Mesh组件`。
  4760. * **如果没有引用了该Mesh的Node节点,会返回空数组。*
  4761. * @param name Mesh节点的`name`
  4762. * @returns 一个数组,数组中的一个元素对应一个引用了该Mesh的GLTFNode节点,元素中nodeName为GLTFNode节点的`name`字段。
  4763. */
  4764. getPrimitivesByMeshName(name: string): Array<{
  4765. nodeName: string;
  4766. primitives: Array<Mesh>;
  4767. }>;
  4768. }
  4769. export {};
  4770. }
  4771. declare module 'XrFrame/components/Light' {
  4772. /**
  4773. * Light.ts
  4774. *
  4775. * * @Date : 2022/3/16下午4:45:56
  4776. */
  4777. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4778. import Element from 'XrFrame/core/Element';
  4779. import { Kanata } from 'XrFrame/ext';
  4780. /**
  4781. * 光照类型枚举。
  4782. */
  4783. export enum ELightType {
  4784. /**
  4785. * 环境光,默认只有一个生效。
  4786. */
  4787. Ambient = "ambient",
  4788. /**
  4789. * 平行光,默认第一个会成为主平行光。
  4790. */
  4791. Directional = "directional",
  4792. /**
  4793. * 点光。
  4794. */
  4795. Point = "point",
  4796. /**
  4797. * 聚光。
  4798. */
  4799. Spot = "spot"
  4800. }
  4801. /**
  4802. * {@link Light}组件数据接口。
  4803. */
  4804. export interface ILightData {
  4805. /**
  4806. * 类型。
  4807. * `xml`中的数据类型`string`,默认为`directional`。
  4808. */
  4809. type: ELightType;
  4810. /**
  4811. * 颜色。
  4812. * `xml`中的数据类型`color`,默认为`[1, 1, 1, 1]`。
  4813. */
  4814. color: number[];
  4815. /**
  4816. * 强度。
  4817. * `xml`中的数据类型`number`,默认为`1`。
  4818. */
  4819. intensity: number;
  4820. /**
  4821. * 范围,仅在电光和聚光有效。
  4822. * `xml`中的数据类型`number`,默认为`1`。
  4823. */
  4824. range: number;
  4825. /**
  4826. * 仅在聚光有效。
  4827. * `xml`中的数据类型`number`,默认为`1`。
  4828. */
  4829. innerConeAngle: number;
  4830. /**
  4831. * 仅在聚光有效。
  4832. * `xml`中的数据类型`number`,默认为`1`。
  4833. */
  4834. outerConeAngle: number;
  4835. /**
  4836. * 是否要产生阴影,仅对平行光有效。
  4837. * `xml`中的数据类型`boolean`,默认为`false`。
  4838. */
  4839. castShadow?: boolean;
  4840. /**
  4841. * 产生阴影的最大距离,仅对平行光有效。
  4842. * `xml`中的数据类型`number`,默认为`10`。
  4843. */
  4844. shadowDistance?: number;
  4845. /**
  4846. * 阴影采样时的容许偏移,仅对平行光有效。
  4847. * `xml`中的数据类型`number`,默认为`0.002`。
  4848. */
  4849. shadowBias?: number;
  4850. }
  4851. /**
  4852. * {@link Light}的`schema`,详见{@link ILightData}。
  4853. */
  4854. export const LightSchema: IComponentSchema;
  4855. /**
  4856. * 灯光组件,一般被代理到{@link XRLight}元素。
  4857. *
  4858. * 注意整个场景只能存在一个`ambient`光源,第一个`directional`光源将会成为主光源,也只有这个光源能够产生阴影。
  4859. * 目前最多支持四个追加光源。
  4860. */
  4861. export default class Light extends Component<ILightData> {
  4862. /**
  4863. * 详见{@link LightSchema}。
  4864. */
  4865. readonly schema: IComponentSchema;
  4866. readonly priority: number;
  4867. get type(): ELightType;
  4868. get color(): number[];
  4869. get intensity(): number;
  4870. get range(): number;
  4871. get innerConeAngle(): number;
  4872. get outerConeAngle(): number;
  4873. get castShadow(): boolean;
  4874. get shadowDistance(): number;
  4875. get shadowBias(): number;
  4876. /**
  4877. * @internal
  4878. */
  4879. get lightCamera(): import('XrFrame/kanata/lib/index').LightCameraComponent;
  4880. /**
  4881. * @internal
  4882. */
  4883. onAdd(parent: Element, data: ILightData): void;
  4884. onUpdate(data: ILightData, preData: ILightData): void;
  4885. onTick(deltaTime: number, data: ILightData): void;
  4886. onRemove(parent: Element, data: ILightData): void;
  4887. onRelease(data: ILightData): void;
  4888. /**
  4889. * @internal
  4890. */
  4891. }
  4892. }
  4893. declare module 'XrFrame/components/AssetMaterial' {
  4894. import Effect from 'XrFrame/assets/Effect';
  4895. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4896. import Element from 'XrFrame/core/Element';
  4897. /**
  4898. * `AssetMaterial`数据接口。
  4899. */
  4900. export interface IAssetMaterialData {
  4901. /**
  4902. * 被引用时的资源Id。
  4903. * `xml`中的数据类型为`string`。
  4904. */
  4905. assetId: string;
  4906. /**
  4907. * 基于的效果。
  4908. * `xml`中的数据类型为`effect`资源,默认为`simple`。
  4909. */
  4910. effect: Effect;
  4911. /**
  4912. * 初始要写入的`uniforms`,类型根据`effect`中的定义决定。
  4913. * `xml`中的数据类型为`map`。
  4914. */
  4915. uniforms: [string, string][];
  4916. /**
  4917. * 初始要写入的渲染状态`states`。
  4918. * `xml`中的数据类型为`map`。
  4919. * 目前支持`renderQueue`、`cullOn`、`depthTestOn`、`depthTestWrite`、`alphaMode`、`alphaCutOff`。
  4920. * `alphaMode`和`alphaCutOff`遵循glTF标准。
  4921. */
  4922. states: [string, string][];
  4923. /**
  4924. * 要覆盖的渲染顺序。
  4925. * `xml`中的数据类型为`number`,无默认值。
  4926. * 大于等于`2500`视为透明物体。
  4927. */
  4928. renderQueue: number;
  4929. }
  4930. /**
  4931. * {@link AssetMaterial}的`schema`,详见{@link IAssetMaterialData}。
  4932. */
  4933. export const AssetMaterialSchema: IComponentSchema;
  4934. /**
  4935. * 材质资源创建组件,为了在`xml`中创建{@link Material}资源,一般被代理到{@link XRAssetMaterial}元素。
  4936. */
  4937. export default class AssetMaterial extends Component<IAssetMaterialData> {
  4938. /**
  4939. * 详见{@link AssetMaterialSchema}。
  4940. */
  4941. readonly schema: IComponentSchema;
  4942. onAdd(parent: Element, data: IAssetMaterialData): void;
  4943. onUpdate(data: IAssetMaterialData, preData: IAssetMaterialData): void;
  4944. onRemove(parent: Element, data: IAssetMaterialData): void;
  4945. }
  4946. }
  4947. declare module 'XrFrame/components/Mesh' {
  4948. /**
  4949. * Model.ts
  4950. *
  4951. * * @Date : 2022/3/16下午4:48:09
  4952. */
  4953. import Geometry from 'XrFrame/assets/Geometry';
  4954. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  4955. import Element from 'XrFrame/core/Element';
  4956. import { Kanata } from 'XrFrame/ext';
  4957. import Material from 'XrFrame/assets/Material';
  4958. import Transform from 'XrFrame/components/Transform';
  4959. /**
  4960. * `Mesh`数据接口。
  4961. */
  4962. export interface IMeshData {
  4963. /**
  4964. * 是否强制不被剔除。
  4965. * `xml`中的数据类型为`boolean`,默认为`false`。
  4966. */
  4967. neverCull?: boolean;
  4968. /**
  4969. * 在主光源产生阴影开启阴影时,是否要产生阴影。
  4970. * `xml`中的数据类型为`boolean`,默认为`false`。
  4971. */
  4972. castShadow?: boolean;
  4973. /**
  4974. * 在主光源产生阴影开启阴影时,是否要接受阴影。
  4975. * `xml`中的数据类型为`boolean`,默认为`false`。
  4976. */
  4977. receiveShadow?: boolean;
  4978. /**
  4979. * 渲染使用的几何数据。
  4980. * `xml`中的数据类型为`geometry`资源。
  4981. */
  4982. geometry: Geometry;
  4983. /**
  4984. * 渲染使用的材质数据。
  4985. * `xml`中的数据类型为`material`资源。
  4986. */
  4987. material?: Material;
  4988. /**
  4989. * 覆盖`material`中的默认`uniforms`,如果覆盖了,则会先创建一个材质副本。
  4990. * `xml`中同{@link IMaterialData.uniforms}。
  4991. */
  4992. uniforms?: [string, string][];
  4993. /**
  4994. * 覆盖`material`中的默认`states`,如果覆盖了,则会先创建一个材质副本。
  4995. * `xml`中同{@link IMaterialData.states}。
  4996. */
  4997. states?: [string, string][];
  4998. }
  4999. /**
  5000. * {@link Mesh}的`schema`,详见{@link IMeshData}。
  5001. */
  5002. export const MeshSchema: IComponentSchema;
  5003. /**
  5004. * Mesh组件,整合{@link Geometry}和{@link Material}进行渲染,一般被代理到{@link XRMesh}元素。
  5005. */
  5006. export default class Mesh extends Component<IMeshData> {
  5007. /**
  5008. * 详见{@link MeshSchema}。
  5009. */
  5010. readonly schema: IComponentSchema;
  5011. readonly priority: number;
  5012. protected _cull: Kanata.CullingComponent;
  5013. protected _mesh: Kanata.MeshRendererComponent;
  5014. protected _sourceMaterial: Material;
  5015. protected _geometry: Geometry;
  5016. protected _material: Material;
  5017. protected _trs: Transform;
  5018. /**
  5019. * 几何数据。
  5020. */
  5021. get geometry(): Geometry;
  5022. /**
  5023. * 材质。
  5024. */
  5025. get material(): Material;
  5026. set material(value: Material);
  5027. /**
  5028. * MorphTargets的权重,最多32个,可以获取后直接修改。
  5029. */
  5030. get morphWeights(): Float32Array;
  5031. /**
  5032. * @internal
  5033. */
  5034. get id(): number;
  5035. /**
  5036. * @internal
  5037. */
  5038. onAdd(parent: Element, data: IMeshData): void;
  5039. onTick(deltaTime: number, data: IMeshData): void;
  5040. onUpdate(data: IMeshData, preData: IMeshData): void;
  5041. onRemove(parent: Element, data: IMeshData): void;
  5042. onRelease(data: IMeshData): void;
  5043. /**
  5044. * @internal
  5045. */
  5046. protected _getMarcos(geometry: Geometry): {};
  5047. /**
  5048. * @internal
  5049. */
  5050. protected _getUniformDesc(): Kanata.UniformDescriptor;
  5051. /**
  5052. * @internal
  5053. */
  5054. protected _getMeshType(): Kanata.EMeshRenderType;
  5055. }
  5056. }
  5057. declare module 'XrFrame/components/Text' {
  5058. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  5059. import Element from 'XrFrame/core/Element';
  5060. import { Kanata } from 'XrFrame/ext';
  5061. import Material from 'XrFrame/assets/Material';
  5062. import Transform from 'XrFrame/components/Transform';
  5063. import { IGlyph } from 'XrFrame/glyph';
  5064. export interface ITextData {
  5065. neverCull?: boolean;
  5066. material?: Material;
  5067. uniforms?: [string, string][];
  5068. states?: [string, string][];
  5069. value?: string;
  5070. }
  5071. export interface ICharacterData {
  5072. x: number;
  5073. y: number;
  5074. width: number;
  5075. height: number;
  5076. batchIndex: number;
  5077. character: string;
  5078. glyph: IGlyph;
  5079. }
  5080. export interface IRenderData {
  5081. vertexBuffer?: Kanata.VertexBuffer;
  5082. indexBuffer?: Kanata.IndexBuffer;
  5083. vertexNum?: number;
  5084. indiceNum?: number;
  5085. texture?: number;
  5086. }
  5087. export const TextSchema: IComponentSchema;
  5088. export default class Text extends Component<ITextData> {
  5089. readonly schema: IComponentSchema;
  5090. readonly priority: number;
  5091. protected _cull: Kanata.CullingComponent;
  5092. protected _mesh: Kanata.MeshRendererComponent;
  5093. protected _sourceMaterial: Material;
  5094. protected _material: Material;
  5095. protected _trs: Transform;
  5096. protected _value: string;
  5097. protected _glyphs: Array<IGlyph>;
  5098. protected _renderDatas: Array<IRenderData>;
  5099. get value(): string;
  5100. get material(): Material;
  5101. set material(value: Material);
  5102. get id(): number;
  5103. onAdd(parent: Element, data: ITextData): void;
  5104. onTick(deltaTime: number, data: ITextData): void;
  5105. onUpdate(data: ITextData, preData: ITextData): void;
  5106. onRemove(parent: Element, data: ITextData): void;
  5107. onRelease(data: ITextData): void;
  5108. protected _getUniformDesc(): Kanata.UniformDescriptor;
  5109. protected _getMeshType(): Kanata.EMeshRenderType;
  5110. protected _getVertexLayout(): Kanata.VertexLayout;
  5111. }
  5112. }
  5113. declare module 'XrFrame/components/particle/Particle' {
  5114. import Element from 'XrFrame/core/Element';
  5115. import Material from 'XrFrame/assets/Material';
  5116. import BasicParticle, { IParticleData } from 'XrFrame/components/particle/BasicParticle';
  5117. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance';
  5118. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  5119. export default class Particle extends BasicParticle {
  5120. readonly priority: number;
  5121. subEmitters: any;
  5122. get material(): Material;
  5123. set material(value: Material);
  5124. get id(): number;
  5125. get data(): IParticleData;
  5126. get particleEmitter(): BasicShapeEmitter;
  5127. set data(value: IParticleData);
  5128. /**
  5129. * 粒子系统开始播放。
  5130. *
  5131. * @param delay 设定粒子延时几秒后再播放。
  5132. */
  5133. start(delay: any): void;
  5134. /**
  5135. * 停止粒子系统与其子发射器的播放。
  5136. */
  5137. stop(): void;
  5138. /**
  5139. * @internal
  5140. */
  5141. onAdd(parent: Element, data: IParticleData): void;
  5142. /**
  5143. * 设置粒子系统的内置粒子effect。
  5144. */
  5145. protected createMaterial(): Material;
  5146. /**
  5147. * 初始化粒子系统的状态。
  5148. */
  5149. initParticle(data: IParticleData): void;
  5150. /**
  5151. * 重置粒子系统的状态。
  5152. */
  5153. resetParticle(): void;
  5154. /**
  5155. * @internal
  5156. */
  5157. protected _prepareSubEmitterArray(): void;
  5158. /**
  5159. * 停止所有粒子子系统的发射状态。
  5160. */
  5161. protected stopSubEmitters(): void;
  5162. /**
  5163. * 粒子子发射系统从依附的粒子系统中剥离。
  5164. */
  5165. protected removeFromRoot(): void;
  5166. /**
  5167. * @internal
  5168. */
  5169. onTick(deltaTime: number, data: IParticleData): void;
  5170. /**
  5171. * @internal
  5172. */
  5173. onUpdate(data: IParticleData, preData: IParticleData): void;
  5174. /**
  5175. * @internal
  5176. */
  5177. onRemove(parent: Element, data: IParticleData): void;
  5178. /**
  5179. * @internal
  5180. */
  5181. onRelease(data: IParticleData): void;
  5182. /**
  5183. * @internal
  5184. */
  5185. protected _updateRenderData(deltaTime: number, isPreWarm?: boolean): void;
  5186. /**
  5187. * 创建一个粒子实例。
  5188. */
  5189. protected createParticle(): ParticleInstance;
  5190. /**
  5191. * 启动处于END状态的粒子子发射器。
  5192. * @param {ParticleInstance} instance 粒子实例
  5193. */
  5194. protected particleSubEmitter(instance: ParticleInstance): void;
  5195. /**
  5196. * 回收当前粒子实例,并放入储备粒子队列。
  5197. * @param {ParticleInstance} particle 粒子实例
  5198. */
  5199. protected recycleParticle(particle: ParticleInstance): void;
  5200. /**
  5201. * 更新每一个粒子的状态。
  5202. * @param {number} instancesSum 新生成的粒子数
  5203. */
  5204. protected update(instancesSum: number): void;
  5205. /**
  5206. * 初始化粒子实例。
  5207. * @param {ParticleInstance} instance 需要初始化的粒子实例
  5208. */
  5209. protected initInstanceProperty(instance: ParticleInstance): void;
  5210. /**
  5211. * 更新运动过程中粒子实例的各项属性以及子发射器状态。
  5212. * @param {Array} instances 粒子实例数组
  5213. */
  5214. protected updateInstanceProperty(instances: any): void;
  5215. /**
  5216. * 更新粒子实例的各项属性。
  5217. * @param {ParticleInstance} instance 待更新的粒子实例
  5218. */
  5219. protected processInstance(instance: ParticleInstance): void;
  5220. }
  5221. }
  5222. declare module 'XrFrame/components/particle/BasicParticle' {
  5223. import Material from 'XrFrame/assets/Material';
  5224. import Component from 'XrFrame/core/Component';
  5225. import { IComponentSchema } from 'XrFrame/core/Component';
  5226. import { BoxShapeEmitter, PointShapeEmitter, SphereShapeEmitter } from 'XrFrame/components/emitter';
  5227. import { Kanata } from 'XrFrame/ext';
  5228. import Transform from 'XrFrame/components/Transform';
  5229. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  5230. import Vector3 from 'XrFrame/math/vector3';
  5231. import Particle from 'XrFrame/components/particle/Particle';
  5232. import { Scene } from 'XrFrame/elements';
  5233. import { SubEmitter } from 'XrFrame/components/emitter/SubEmitter';
  5234. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance';
  5235. import Atlas from 'XrFrame/assets/Atlas';
  5236. import Vector4 from 'XrFrame/math/vector4';
  5237. import Geometry from 'XrFrame/assets/Geometry';
  5238. /**
  5239. * {@link Particle}组件数据接口。
  5240. */
  5241. export interface IParticleData {
  5242. neverCull?: boolean;
  5243. /**
  5244. * 渲染模式。
  5245. */
  5246. renderMode?: string;
  5247. uniforms?: [string, string][];
  5248. states?: [string, string][];
  5249. /**
  5250. * 纹理信息。
  5251. */
  5252. texture?: Kanata.Texture;
  5253. /**
  5254. * 最大粒子数目。
  5255. */
  5256. capacity?: number;
  5257. /**
  5258. * 每秒粒子发射数。
  5259. */
  5260. emitRate?: number;
  5261. /**
  5262. * 初始角度。
  5263. */
  5264. angle?: number[];
  5265. /**
  5266. * 粒子系统启动延时秒数。
  5267. */
  5268. delay?: number;
  5269. /**
  5270. * y轴方向上的每秒位移。
  5271. */
  5272. gravity?: number;
  5273. /**
  5274. * 初始大小。
  5275. */
  5276. size?: number[];
  5277. /**
  5278. * 粒子在x轴方向上的大小尺度。
  5279. */
  5280. scaleX?: number[];
  5281. /**
  5282. * 粒子在y轴方向上的大小尺度。
  5283. */
  5284. scaleY?: number[];
  5285. /**
  5286. * 速度。
  5287. */
  5288. speed?: number[];
  5289. /**
  5290. * 生命周期时长。
  5291. */
  5292. lifeTime?: number[];
  5293. /**
  5294. * 粒子初始颜色左区间。
  5295. */
  5296. startColor?: number[];
  5297. /**
  5298. * 粒子初始颜色右区间。
  5299. */
  5300. startColor2?: number[];
  5301. /**
  5302. * 粒子结束时颜色。
  5303. */
  5304. endColor?: number[];
  5305. /**
  5306. * 角速度。
  5307. */
  5308. angularSpeed?: number[];
  5309. /**
  5310. * 发射器类型。
  5311. */
  5312. emitterType?: string;
  5313. /**
  5314. * 发射器属性配置。
  5315. */
  5316. emitterProps?: [string, string][];
  5317. /**
  5318. * 粒子系统生命周期时长。
  5319. */
  5320. stopDuration?: number;
  5321. /**
  5322. * 粒子预渲染周期数。
  5323. */
  5324. prewarmCycles?: number;
  5325. /**
  5326. * 速度阻尼系数。
  5327. */
  5328. speedDampen?: number;
  5329. /**
  5330. * 动画图集信息。
  5331. */
  5332. atlas?: Atlas;
  5333. /**
  5334. * 图集切换速度。
  5335. */
  5336. atlasSpeed?: number;
  5337. /**
  5338. * 是否随机播放图集。
  5339. */
  5340. atlasRandom?: boolean;
  5341. /**
  5342. * 是否循环播放图集。
  5343. */
  5344. atlasLoop?: boolean;
  5345. /**
  5346. * 指定图集帧名。
  5347. */
  5348. atlasFrames?: string[];
  5349. /**
  5350. * 网格信息。
  5351. */
  5352. mesh?: Geometry;
  5353. sizeChange?: [string, string][];
  5354. colorChange?: [string, string][];
  5355. speedChange?: [string, string][];
  5356. burstCount?: number;
  5357. burstTime?: number;
  5358. burstCycle?: number;
  5359. burstInterval?: number;
  5360. }
  5361. /**
  5362. * {@link Particle}的`schema`定义。
  5363. * @see 解析后的接口详见 {@link IParticleData}
  5364. */
  5365. export const ParticleSchema: IComponentSchema;
  5366. /**
  5367. * BillBoard渲染模式。
  5368. */
  5369. export const enum BillBoardMode {
  5370. BILLBOARDMODE_DEFAULT = 0,
  5371. BILLBOARDMODE_Y = 1,
  5372. BILLBOARDMODE_STRETCHED = 2
  5373. }
  5374. export default class BasicParticle extends Component<IParticleData> {
  5375. /**
  5376. * 详见{@link ParticleSchema}。
  5377. */
  5378. readonly schema: IComponentSchema;
  5379. protected static count: number;
  5380. protected _systemId: number;
  5381. protected _data: IParticleData;
  5382. protected particleScene: Scene;
  5383. protected particleEl: any;
  5384. protected _instances: ParticleInstance[];
  5385. protected _stockInstances: ParticleInstance[];
  5386. protected _capacity: number;
  5387. protected _delay: number;
  5388. protected _updateSpeed: number;
  5389. protected _stopDuration: number;
  5390. protected _emitRate: number;
  5391. protected _gravity: number;
  5392. protected _preWarmCycles: number;
  5393. protected _preWarmStepOffset: number;
  5394. protected _particleEmitterType: string;
  5395. protected _particleEmitter: BasicShapeEmitter;
  5396. protected _particleEmitterProperties: any;
  5397. protected particleStride: number;
  5398. protected particleVertexSize: number;
  5399. protected byteStride: number;
  5400. protected ParticleAttributes: any;
  5401. protected _burstCount: number;
  5402. protected _burstTime: number;
  5403. protected _burstCycle: number;
  5404. protected _burstInterval: number;
  5405. protected _burstCountTime: number;
  5406. protected _burstCountCycle: number;
  5407. protected _burstCountInterval: number;
  5408. protected _minLifeTime: number;
  5409. protected _maxLifeTime: number;
  5410. protected _minScaleX: number;
  5411. protected _maxScaleX: number;
  5412. protected _minScaleY: number;
  5413. protected _maxScaleY: number;
  5414. protected _minSize: number;
  5415. protected _maxSize: number;
  5416. protected _minSpeed: number;
  5417. protected _maxSpeed: number;
  5418. protected _particleLengthScale: number;
  5419. protected _startColor: number[];
  5420. protected _startColor2: number[];
  5421. protected _endColor: number[];
  5422. protected _sizeGradients: any;
  5423. protected _alphaGradients: any;
  5424. protected _colorRemapGradients: any;
  5425. protected _speedScaleGradients: any;
  5426. protected _limitSpeedGradients: any;
  5427. protected _speedDampenFactor: number;
  5428. protected _dragGradients: any;
  5429. protected _useSpriteSheet: boolean;
  5430. protected _startSpriteCellIndex: number;
  5431. protected _endSpriteCellIndex: number;
  5432. protected _useRandomSpriteCellIndex: boolean;
  5433. protected _useSpriteCellLoop: boolean;
  5434. protected _spriteChangeSpeed: number;
  5435. protected _spriteFrameInfo: Vector4[];
  5436. protected _spriteNameToCellIndex: Map<string, number>;
  5437. protected _textureData: Kanata.Texture;
  5438. protected _atlasObj: Atlas;
  5439. protected _atlasTexture: Kanata.Texture;
  5440. protected _cull: Kanata.CullingComponent;
  5441. protected _mesh: Kanata.MeshRendererComponent;
  5442. protected _sourceMaterial: Material;
  5443. protected _material: Material;
  5444. protected _trs: Transform;
  5445. protected _vertexBuffer: Kanata.VertexBuffer;
  5446. protected _indexBuffer: Kanata.IndexBuffer;
  5447. protected _renderMesh: Geometry;
  5448. protected _vertexCount: number;
  5449. protected _vertexData: Float32Array;
  5450. protected _eachIndexSize: number;
  5451. protected _indexSize: number;
  5452. protected _vertexSize: number;
  5453. protected _useBillboard: boolean;
  5454. protected _useRenderMesh: boolean;
  5455. protected _billboardMode: number;
  5456. protected _useRampGradients: boolean;
  5457. protected _rampGradients: any;
  5458. protected _rampGradientsTexture: Kanata.Texture;
  5459. protected _colorGradients: any;
  5460. protected _vertexLayoutDirty: boolean;
  5461. protected _startAngle: number;
  5462. protected _startAngle2: number;
  5463. protected _minAngularSpeed: number;
  5464. protected _maxAngularSpeed: number;
  5465. protected _subEmitters: any[];
  5466. protected _emitterPosition: Vector3;
  5467. get material(): Material;
  5468. /**
  5469. * @internal
  5470. */
  5471. get useBillboard(): boolean;
  5472. set useBillboard(value: boolean);
  5473. get useRampGradients(): boolean;
  5474. set useRampGradients(value: boolean);
  5475. get billboardMode(): number;
  5476. set billboardMode(value: number);
  5477. get useSpriteSheet(): boolean;
  5478. set useSpriteSheet(value: boolean);
  5479. get useRandomSpriteCellIndex(): boolean;
  5480. get useSpriteCellLoop(): boolean;
  5481. get spriteChangeSpeed(): number;
  5482. get emitterPosition(): Vector3;
  5483. set emitterPosition(value: Vector3);
  5484. /**
  5485. * @internal
  5486. */
  5487. protected _parseAttribute(): void;
  5488. /**
  5489. * 获取一个拷贝的粒子系统。
  5490. */
  5491. clone(): Particle;
  5492. /**
  5493. * 获取一个粒子子发射器。
  5494. */
  5495. createSubEmitter(data: IParticleData): SubEmitter;
  5496. /**
  5497. * 创建一个点发射器。
  5498. * @param {Vector3} direction1 粒子运动方向左区间
  5499. * @param {Vector3} direction2 粒子运动方向右区间
  5500. * @return {PointShapeEmitter} 点发射器
  5501. */
  5502. createPointEmitter(direction1: Vector3, direction2: Vector3): PointShapeEmitter;
  5503. /**
  5504. * 创建一个箱形发射器。
  5505. * @param {Vector3} direction1 粒子运动方向左区间
  5506. * @param {Vector3} direction2 粒子运动方向右区间
  5507. * @param {Vector3} minEmitBox 粒子生成位置最小允许坐标
  5508. * @param {Vector3} maxEmitBox 粒子生成位置最大允许坐标
  5509. * @return {BoxShapeEmitter} 箱形发射器
  5510. */
  5511. createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxShapeEmitter;
  5512. /**
  5513. * 创建一个球形发射器。
  5514. * @param {number} radius 球形半径
  5515. * @param {number} radiusRange 球形区域内的覆盖范围[0-1]
  5516. * @param {number} arc 粒子在球形内生成的角度区间[0-360]
  5517. * @param {number} randomizeDirection 粒子运动方向偏离程度[0-1]
  5518. * @return {SphereShapeEmitter} 球形发射器
  5519. */
  5520. createSphereEmitter(radius: number, radiusRange: number, arc: number, randomizeDirection: number): SphereShapeEmitter;
  5521. protected _parseProperties(data: IParticleData): void;
  5522. protected _chooseEmitterProcess(): void;
  5523. protected _createVertexBuffers(): void;
  5524. protected _createIndexBuffer(): void;
  5525. protected _appendParticleVertices(offset: any, instance?: ParticleInstance): void;
  5526. protected _appendParticleVertex(index: any, instance: ParticleInstance, offsetX: any, offsetY: any, offsetZ: any, u: any, v: any): void;
  5527. protected _rebuildMesh(neverCull: boolean): void;
  5528. protected _getUniformDesc(): Kanata.UniformDescriptor;
  5529. protected _getMeshType(): Kanata.EMeshRenderType;
  5530. protected _getVertexLayout(attributes: any, stride: any): Kanata.VertexLayout;
  5531. protected _setMeshData(material: Material, uniforms?: [string, string][], states?: [string, string][]): void;
  5532. /**
  5533. * 添加粒子运动过程中的颜色变化规则。
  5534. * @param {number} gradient 指定所处粒子生命周期的阶段
  5535. * @param {Vector4} color1 指定粒子颜色的左区间
  5536. * @param {Vector4} color2 指定粒子颜色的右区间
  5537. */
  5538. addColorGradient(gradient: number, color1: Vector4, color2?: Vector4): void;
  5539. /**
  5540. * 添加粒子运动过程中的速度变化规则。
  5541. * @param {number} gradient 指定所处粒子生命周期的阶段
  5542. * @param {Vector4} speed 指定粒子速度的左区间
  5543. * @param {Vector4} speed2 指定粒子速度的右区间
  5544. */
  5545. addSpeedScaleGradient(gradient: number, speed: number, speed2?: number): void;
  5546. /**
  5547. * 添加粒子运动过程中的速度限制规则。
  5548. * @param {number} gradient 指定所处粒子生命周期的阶段
  5549. * @param {number} limitSpeed 指定粒子限制速度的左区间
  5550. * @param {number} limitSpeed2 指定粒子限制速度的右区间
  5551. */
  5552. addLimitSpeedGradient(gradient: number, limitSpeed: number, limitSpeed2?: number): void;
  5553. /**
  5554. * 添加粒子运动过程中的阻力规则。
  5555. * @param {number} gradient 指定所处粒子生命周期的阶段
  5556. * @param {number} speed 指定粒子受到的阻力大小的左区间[0-1]
  5557. * @param {number} speed2 指定粒子受到的阻力大小的右区间[0-1]
  5558. */
  5559. addDragGradient(gradient: number, drag: number, drag2?: number): void;
  5560. /**
  5561. * 添加粒子运动过程中的透明度变化规则。
  5562. * @param {number} gradient 指定所处粒子生命周期的阶段
  5563. * @param {number} alpha 指定粒子颜色透明度的左区间[0-1]
  5564. * @param {number} alpha2 指定粒子颜色透明度的右区间[0-1]
  5565. */
  5566. addAlphaGradient(gradient: number, alpha: number, alpha2?: number): void;
  5567. /**
  5568. * 添加粒子运动过程中的尺寸变化规则。
  5569. * @param {number} gradient 指定所处粒子生命周期的阶段
  5570. * @param {number} size 指定粒子尺寸的左区间
  5571. * @param {number} size2 指定粒子尺寸的右区间
  5572. */
  5573. addSizeGradient(gradient: number, size: number, size2?: number): void;
  5574. /**
  5575. * 添加粒子运动过程中的透明度变化范围。
  5576. * @param {number} gradient 指定所处粒子生命周期的阶段
  5577. * @param {number} min 指定粒子透明度值的左区间
  5578. * @param {number} max 指定粒子透明度值的右区间
  5579. */
  5580. addColorRemapGradient(gradient: number, min: number, max?: number): void;
  5581. /**
  5582. * 将存储不同时间段相关属性系数的数组按时间点从小到大进行排序。
  5583. * @param {Array} factorGradients 存储不同时间段相关属性系数的数组
  5584. * @param {number} gradient 一般代表粒子所处生命周期的阶段
  5585. * @param {number} factor 左区间值
  5586. * @param {number} factor2 右区间值
  5587. */
  5588. protected addFactorGradient(factorGradients: any, gradient: any, factor: any, factor2: any): void;
  5589. /**
  5590. * 添加粒子运动过程中的根据透明度影响的颜色变化规则,将通过颜色变化图纹理进行采样。
  5591. * @param {number} gradient 指定粒子颜色变化图的具体位置,对应具体值应为(1-alpha)
  5592. * @param {number} color 指定该位置的颜色
  5593. */
  5594. addRampGradient(gradient: any, color: any): void;
  5595. /**
  5596. * 根据颜色变化数组,生成对应的颜色变化纹理
  5597. */
  5598. protected createRampGradientTexture(): void;
  5599. /**
  5600. * @internal
  5601. */
  5602. protected lerpNumberArrayToVector(vector: any, numberArray1: any, numberArray2: any, step: any, length?: number): void;
  5603. }
  5604. }
  5605. declare module 'XrFrame/components/AssetRenderTexture' {
  5606. /**
  5607. * AssetRenderTexture.ts
  5608. *
  5609. * * @Date : 8/29/2022, 11:27:00 AM
  5610. */
  5611. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  5612. import Element from 'XrFrame/core/Element';
  5613. /**
  5614. * `AssetRenderTexture`资源数据接口。
  5615. */
  5616. export interface IAssetRenderTextureData {
  5617. assetId?: string;
  5618. width: number;
  5619. height: number;
  5620. isHDR?: boolean;
  5621. }
  5622. /**
  5623. * {@link AssetRenderTexture}的`schema`,详见{@link IAssetRenderTextureData}。
  5624. */
  5625. export const AssetRenderTextureSchema: IComponentSchema;
  5626. /**
  5627. * 渲染纹理创建组件,用于在`xml`中创建{@link RenderTexture}资源,一般被代理到{@link XRAssetRenderTexture}元素。
  5628. */
  5629. export default class AssetRenderTexture extends Component<IAssetRenderTextureData> {
  5630. /**
  5631. * 详见{@link AssetRenderTextureSchema}。
  5632. */
  5633. readonly schema: IComponentSchema;
  5634. readonly isAssetRenderTexture: boolean;
  5635. onAdd(parent: Element, data: IAssetRenderTextureData): void;
  5636. /**
  5637. * 移除AssetRenderTexture。
  5638. */
  5639. onRemove(parent: Element, data: IAssetRenderTextureData): void;
  5640. }
  5641. }
  5642. declare module 'XrFrame/components/Env' {
  5643. /**
  5644. * Env.ts
  5645. *
  5646. * * @Date : 5/11/2022, 5:21:48 PM
  5647. */
  5648. import { Kanata } from 'XrFrame/ext';
  5649. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  5650. import EnvData from 'XrFrame/assets/EnvData';
  5651. import Element from 'XrFrame/core/Element';
  5652. import { ITextureWrapper } from 'XrFrame/core/DataValue';
  5653. /**
  5654. * {@link Env}组件数据接口。
  5655. */
  5656. export interface IEnvData {
  5657. /**
  5658. * 要使用的环境数据资源。
  5659. * `xml`中的数据类型为`env-data`资源。
  5660. */
  5661. envData?: EnvData;
  5662. /**
  5663. * 可以用于覆盖`envData`中的`skybox`。
  5664. * `xml`中的数据类型为`texture`资源。
  5665. */
  5666. skyMap?: Kanata.Texture | ITextureWrapper;
  5667. /**
  5668. * 是否用2D模式渲染天空盒,此时必须为`skyMap`必须**不**为`CubeTexture`。
  5669. */
  5670. isSky2D?: boolean;
  5671. /**
  5672. * 环境旋转角度。
  5673. * `xml`中的数据类型为`number`,默认为`0`。
  5674. */
  5675. rotation: number;
  5676. /**
  5677. * 漫反射部分曝光。
  5678. * `xml`中的数据类型为`number`,默认为`1`。
  5679. */
  5680. diffuseExp: number;
  5681. /**
  5682. * 镜面反射部分曝光。
  5683. * `xml`中的数据类型为`number`,默认为`1`。
  5684. */
  5685. specularExp: number;
  5686. }
  5687. /**
  5688. * {@link Env}的`schema`,详见{@link IEnvData}。
  5689. */
  5690. export const EnvSchema: IComponentSchema;
  5691. /**
  5692. * 一般被代理到{@link XRARTracker}元素。
  5693. */
  5694. export default class Env extends Component<IEnvData> {
  5695. /**
  5696. * 详见{@link EnvSchema}。
  5697. */
  5698. readonly schema: IComponentSchema;
  5699. get useHalfSkyMap(): boolean;
  5700. get skyMap(): import('XrFrame/kanata/lib/index').Texture;
  5701. get isSky2D(): boolean;
  5702. get isSkyRT(): boolean;
  5703. get rotation(): number;
  5704. get hasDiffuse(): boolean;
  5705. get diffuseSH(): Float32Array;
  5706. get diffuseExp(): number;
  5707. get hasSpecular(): boolean;
  5708. get specularRGBD(): boolean;
  5709. get specularMipmaps(): boolean;
  5710. get specularMipmapCount(): number;
  5711. get specularMap(): import('XrFrame/kanata/lib/index').Texture;
  5712. get specularExp(): number;
  5713. onAdd(parent: Element, data: IEnvData): void;
  5714. onUpdate(data: IEnvData, preData: IEnvData): void;
  5715. onRemove(parent: Element, data: IEnvData): void;
  5716. }
  5717. }
  5718. declare module 'XrFrame/components/Animator' {
  5719. /**
  5720. * Animator.ts
  5721. *
  5722. * * @Date : 6/17/2022, 2:52:44 PM
  5723. */
  5724. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  5725. import Animation from 'XrFrame/animation/Animation';
  5726. import Element from 'XrFrame/core/Element';
  5727. type Scene = import('XrFrame/core/Scene').default;
  5728. /**
  5729. * 使用`Animator`播放动画时可以传入的默认选项。
  5730. */
  5731. export interface IAnimationPlayOptions {
  5732. /**
  5733. * 播放速度,默认为`1`。
  5734. */
  5735. speed?: number;
  5736. /**
  5737. * 循环次数,默认为`0`。
  5738. */
  5739. loop?: number;
  5740. /**
  5741. * 播放延迟,默认为`0`。
  5742. */
  5743. delay?: number;
  5744. /**
  5745. * 播放方向,默认为`forwards`。
  5746. */
  5747. direction?: 'forwards' | 'backwards' | 'both';
  5748. }
  5749. export enum EAnimationPlayState {
  5750. Playing = 0,
  5751. Paused = 1,
  5752. Stopt = 2
  5753. }
  5754. /**
  5755. * 自动播放配置。
  5756. */
  5757. export interface IAnimatorAutoPlay {
  5758. /**
  5759. * 片段名称。
  5760. */
  5761. clip?: string;
  5762. /**
  5763. * 速度。
  5764. */
  5765. speed?: string;
  5766. /**
  5767. * 循环次数。
  5768. */
  5769. loop?: string;
  5770. /**
  5771. * 延迟。
  5772. */
  5773. delay?: string;
  5774. /**
  5775. * 方向。
  5776. */
  5777. direction?: 'forwards' | 'backwards' | 'both';
  5778. /**
  5779. * 其他追加配置。
  5780. */
  5781. [key: string]: string | undefined;
  5782. }
  5783. /**
  5784. * {@link Animator}组件数据接口。
  5785. */
  5786. export interface IAnimatorData {
  5787. /**
  5788. * 默认的`Keyframe`动画资源。
  5789. * `xml`中为资源id。
  5790. */
  5791. keyframe: Animation;
  5792. /**
  5793. * 默认的片段名字映射,由于一个动画可以有多个片段,所以能通过映射由`Animator`中播放的名字 -> 动画资源中片段的名字。
  5794. * `xml`中为`dict`数据。
  5795. */
  5796. clipMap?: {
  5797. [key: string]: string;
  5798. };
  5799. /**
  5800. * 默认自动播放的参数,详见{@Link IAnimatorAutoPlay}。
  5801. * `xml`中为`dict`数据。
  5802. */
  5803. autoPlay?: IAnimatorAutoPlay;
  5804. }
  5805. /**
  5806. * {@link Animator}的`schema`定义。
  5807. * @see 解析后的接口详见 {@link IAnimatorData}
  5808. */
  5809. export const AnimatorSchema: {
  5810. keyframe: {
  5811. type: string;
  5812. };
  5813. clipMap: {
  5814. type: string;
  5815. };
  5816. autoPlay: {
  5817. type: string;
  5818. };
  5819. };
  5820. export default class Animator extends Component<IAnimatorData> {
  5821. /**
  5822. * 详见{@link AnimatorSchema}。
  5823. */
  5824. readonly schema: IComponentSchema;
  5825. readonly priority: number;
  5826. onAdd(parent: Element, data: IAnimatorData): void;
  5827. onUpdate(data: IAnimatorData, preData: IAnimatorData): void;
  5828. onRemove(parent: Element, data: IAnimatorData): void;
  5829. onRelease(data: IAnimatorData): void;
  5830. /**
  5831. * 手动添加一个动画。
  5832. *
  5833. * @param clipMap 可选的动画片段名字映射。
  5834. */
  5835. addAnimation<T extends Animation>(anim: T, clipMap?: {
  5836. [name: string]: string;
  5837. }): T;
  5838. /**
  5839. * 直接通过类`clz`和初始化数据`data`创建一个动画并添加到自身内。
  5840. */
  5841. createAnimation<T extends Animation>(clz: new (scene: Scene, data: T['__DATA_TYPE']) => T, data: T['__DATA_TYPE'], clipMap?: {
  5842. [name: string]: string;
  5843. }): T;
  5844. /**
  5845. * 移除一个动画
  5846. */
  5847. removeAnimation(anim: Animation): void;
  5848. /**
  5849. * @internal
  5850. */
  5851. /**
  5852. * 播放一个动画片段,**可以同时播放多个片段**。
  5853. *
  5854. * @param name 动画片段名称。
  5855. * @param options 播放选项。
  5856. */
  5857. play(name: string, options?: IAnimationPlayOptions & {
  5858. [key: string]: any;
  5859. }): void;
  5860. /**
  5861. * 播放动画片段到某一进度并停下。
  5862. *
  5863. * @param name 片段名称。
  5864. * @param progress 停到的某个进度,0~1。
  5865. */
  5866. pauseToFrame(name: string, progress: number): void;
  5867. /**
  5868. * 暂停播放。
  5869. *
  5870. * @param name 需要暂停的片段,如果不填则暂停所有正在播放的片段。
  5871. */
  5872. pause(name?: string): void;
  5873. /**
  5874. * 唤醒暂停的动画。
  5875. *
  5876. * @param name 需要唤醒的片段,如果不填则唤醒所有暂停的片段。
  5877. */
  5878. resume(name?: string): void;
  5879. /**
  5880. * 停止播放。
  5881. *
  5882. * @param name 需要停止的片段,如果不填则停止所有正在播放的片段。
  5883. */
  5884. stop(name?: string): void;
  5885. }
  5886. export {};
  5887. }
  5888. declare module 'XrFrame/components/CameraOrbitControl' {
  5889. /**
  5890. * CameraOrbitControl.ts
  5891. *
  5892. * * @Date : 5/19/2022, 1:22:59 PM
  5893. */
  5894. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  5895. import Element from 'XrFrame/core/Element';
  5896. import Vector3 from 'XrFrame/math/vector3';
  5897. /**
  5898. * {@link CameraOrbitControl}组件数据接口。
  5899. */
  5900. export interface ICameraOrbitControlData {
  5901. /**
  5902. * 是否锁定横向旋转。
  5903. */
  5904. isLockX: boolean;
  5905. /**
  5906. * 是否锁定纵向旋转。
  5907. */
  5908. isLockY: boolean;
  5909. /**
  5910. * 是否锁定缩放。
  5911. */
  5912. isLockZoom: boolean;
  5913. /**
  5914. * 是否锁定旋转。
  5915. */
  5916. isLockRotate: boolean;
  5917. /**
  5918. * 是否锁定移动。
  5919. */
  5920. isLockMove: boolean;
  5921. /**
  5922. * 允许的最大缩放值。
  5923. */
  5924. zoomMax: number;
  5925. /**
  5926. * 允许的最小缩放值。
  5927. */
  5928. zoomMin: number;
  5929. /**
  5930. * 平移速度。
  5931. */
  5932. panSpeed: number;
  5933. /**
  5934. * 旋转速度。
  5935. */
  5936. rotateSpeed: number;
  5937. /**
  5938. * 缩放速度。
  5939. */
  5940. zoomSpeed: number;
  5941. /**
  5942. * 开启阻尼缓动。
  5943. */
  5944. enableDamping: boolean;
  5945. /**
  5946. * 阻尼系数。
  5947. */
  5948. dampingFactor: number;
  5949. }
  5950. /**
  5951. * {@link CameraOrbitControl}的`schema`,详见{@link ICameraOrbitControlData}。
  5952. */
  5953. export const CameraOrbitControlSchema: IComponentSchema;
  5954. export default class CameraOrbitControl extends Component<ICameraOrbitControlData> {
  5955. /**
  5956. * 详见{@link CameraOrbitControlSchema}。
  5957. */
  5958. readonly schema: IComponentSchema;
  5959. /**
  5960. * 是否锁定横向旋转。
  5961. */
  5962. isLockX: boolean;
  5963. /**
  5964. * 是否锁定纵向旋转。
  5965. */
  5966. isLockY: boolean;
  5967. /**
  5968. * 是否锁定缩放。
  5969. */
  5970. isLockZoom: boolean;
  5971. /**
  5972. * 是否锁定旋转。
  5973. */
  5974. isLockRotate: boolean;
  5975. /**
  5976. * 是否锁定移动。
  5977. */
  5978. isLockMove: boolean;
  5979. /**
  5980. * 是否已经开启。
  5981. */
  5982. isEnabled: boolean;
  5983. /**
  5984. * 允许的最大缩放值。
  5985. */
  5986. zoomMax: number;
  5987. /**
  5988. * 允许的最小缩放值。
  5989. */
  5990. zoomMin: number;
  5991. /**
  5992. * 允许的最大平移边界。
  5993. */
  5994. panMax: Vector3;
  5995. /**
  5996. * 允许的最小平移边界。
  5997. */
  5998. panMin: Vector3;
  5999. /**
  6000. * 平移速度。
  6001. */
  6002. panSpeed: number;
  6003. /**
  6004. * 旋转速度。
  6005. */
  6006. rotateSpeed: number;
  6007. /**
  6008. * 缩放速度。
  6009. */
  6010. zoomSpeed: number;
  6011. /**
  6012. * 开启阻尼缓动。
  6013. */
  6014. enableDamping: boolean;
  6015. /**
  6016. * 阻尼系数。
  6017. */
  6018. dampingFactor: number;
  6019. /**
  6020. * 当前是否正在缓动。
  6021. */
  6022. get damping(): boolean;
  6023. /**
  6024. * 获取当前目标。
  6025. */
  6026. get target(): Vector3;
  6027. /**
  6028. * 添加到世界,继承请先`super.onAdd()`。
  6029. */
  6030. onAdd(parent: Element, data: ICameraOrbitControlData): void;
  6031. /**
  6032. * 每一帧更新,继承请先`super.onUpdate()`。
  6033. */
  6034. onUpdate(data: ICameraOrbitControlData): void;
  6035. onTick(deltaTime: number, data: ICameraOrbitControlData): void;
  6036. /**
  6037. * 销毁,继承请先`super.onUpdate()`。
  6038. */
  6039. onRemove(): void;
  6040. /**
  6041. * 启动控制器。
  6042. */
  6043. enable(): void;
  6044. /**
  6045. * 关闭控制器。
  6046. */
  6047. disable(): void;
  6048. }
  6049. }
  6050. declare module 'XrFrame/components/ARTracker' {
  6051. /**
  6052. * ARTracker.ts
  6053. *
  6054. * * @Date : 6/24/2022, 11:35:30 AM
  6055. */
  6056. import { Kanata } from 'XrFrame/ext';
  6057. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  6058. import Element from 'XrFrame/core/Element';
  6059. import Vector3 from 'XrFrame/math/vector3';
  6060. /**
  6061. * Tracker的跟踪模式。
  6062. */
  6063. export type TTrackMode = 'Plane' | 'Marker' | 'OSD' | 'Face' | 'Hand' | 'Body';
  6064. /**
  6065. * `Face`/`Body`/`Hand`模式下,`ARTracker`存储的原始数据类型。
  6066. */
  6067. export interface IARTrackerRawData {
  6068. /**
  6069. * 原点,屏幕空间。
  6070. */
  6071. origin: {
  6072. x: number;
  6073. y: number;
  6074. };
  6075. /**
  6076. * 尺寸,屏幕空间。
  6077. */
  6078. size: {
  6079. width: number;
  6080. height: number;
  6081. };
  6082. /**
  6083. * 置信度。
  6084. */
  6085. score: number;
  6086. /**
  6087. * 在`Hand`模式下,手势分类,正常`0~18`,无效为`-1`。
  6088. */
  6089. gesture?: number;
  6090. /**
  6091. * 在`Face`模式下,人脸旋转角度。
  6092. */
  6093. angle?: {
  6094. pitch: number;
  6095. roll: number;
  6096. yaw: number;
  6097. z_score: number;
  6098. };
  6099. /**
  6100. * 关键点置信度。
  6101. */
  6102. confidence: number[];
  6103. /**
  6104. * 106个关键点,屏幕空间。
  6105. */
  6106. points: {
  6107. x: number;
  6108. y: number;
  6109. }[];
  6110. }
  6111. /**
  6112. * {@link ARTracker}组件数据接口。
  6113. */
  6114. export interface IARTrackerData {
  6115. /**
  6116. * 跟踪模式,必须在{@link ARSystem}已开启的模式列表中。
  6117. * `xml`中数据为`string`类型。
  6118. */
  6119. mode: TTrackMode;
  6120. /**
  6121. * 要追踪的图片资源,优先使用。
  6122. * `xml`中数据为`image`类型。
  6123. */
  6124. image?: Kanata.IImage;
  6125. /**
  6126. * 要追踪的图片地址,如果`image`没有定义,则使用这个。
  6127. * `xml`中数据为`string`类型。
  6128. */
  6129. src?: string;
  6130. /**
  6131. * 在`Face`模式下,给定一个**特征点索引**列表,详见官网对应文档。
  6132. * 系统会自动同步位置和缩放到`ARTracker`下对应的顺序的子节点。
  6133. * `-1`代表不同步位置,只同步缩放。
  6134. */
  6135. autoSync?: number[];
  6136. }
  6137. /**
  6138. * {@link ARTracker}的`schema`,详见{@link IARTrackerData}。
  6139. */
  6140. export const ARTrackSchema: {
  6141. mode: {
  6142. type: string;
  6143. };
  6144. image: {
  6145. type: string;
  6146. };
  6147. src: {
  6148. type: string;
  6149. };
  6150. autoSync: {
  6151. type: string;
  6152. };
  6153. };
  6154. /**
  6155. * AR追踪组件,配合{@link ARSystem}和{@link Camera}的`isARCamera`属性一起使用。
  6156. * 一般被代理到{@link XRARTracker}元素。
  6157. *
  6158. * 其提供了追踪的能力,节点将会自动同步识别到的追踪目标的位置和旋转,
  6159. */
  6160. export default class ARTracker extends Component<IARTrackerData> {
  6161. /**
  6162. * 详见{@link ARTrackSchema}。
  6163. */
  6164. readonly schema: IComponentSchema;
  6165. /**
  6166. * 跟踪模式。
  6167. */
  6168. get mode(): TTrackMode;
  6169. /**
  6170. * 是否出于启动状态。
  6171. */
  6172. get arActive(): boolean;
  6173. /**
  6174. * `Body`/`Hand`模式下,获取当前的置信度。
  6175. * 一般为`0~1`。
  6176. */
  6177. get score(): number;
  6178. /**
  6179. * 在`Hand`模式下,手势分类,正常`0~18`,无效为`-1`。
  6180. */
  6181. get gesture(): number;
  6182. /**
  6183. * @internal
  6184. */
  6185. get filePath(): string;
  6186. /**
  6187. * @internal
  6188. */
  6189. get trackId(): number;
  6190. onAdd(parent: Element, data: IARTrackerData): void;
  6191. onUpdate(data: IARTrackerData, preData: IARTrackerData): void;
  6192. onRemove(parent: Element, data: IARTrackerData): void;
  6193. /**
  6194. * 在`Face`/`Body`/`Hand`模式下,获取某个特征点的位置。
  6195. *
  6196. * @param point 特征点索引,需要在`0~105`,否则返回`undefined`。
  6197. * @param relativeToTracker 是否相对于`ARTracker`本身,默认为`true`,否则返回世界空间坐标。
  6198. * @returns 只有在`arActive`时才有值,否则返回`undefined`。
  6199. */
  6200. getPosition(point: number, output?: Vector3, relativeToTracker?: boolean): Vector3;
  6201. /**
  6202. * @internal
  6203. */
  6204. /**
  6205. * @internal
  6206. */
  6207. }
  6208. }
  6209. declare module 'XrFrame/components/physics/Shape' {
  6210. import Component from "XrFrame/core/Component";
  6211. import Element from "XrFrame/core/Element";
  6212. import Vector3 from "XrFrame/math/vector3";
  6213. import { Kanata } from "XrFrame/ext";
  6214. import Rigidbody from "XrFrame/components/physics/Rigidbody";
  6215. import Mesh from "XrFrame/components/Mesh";
  6216. import GLTFComponent from "XrFrame/components/GLTF";
  6217. export const shapeMap: Map<phys3D.Collider, Shape>;
  6218. export enum EShapeType {
  6219. /**
  6220. * @internal
  6221. */
  6222. None = 0,
  6223. /**
  6224. * @see {@link CubeShape}
  6225. */
  6226. Cube = 1,
  6227. /**
  6228. * @internal
  6229. */
  6230. CharacterController = 2,
  6231. /**
  6232. * @see {@link CapsuleShape}
  6233. */
  6234. Capsule = 3,
  6235. /**
  6236. * @see {@link MeshShape}
  6237. */
  6238. Mesh = 4,
  6239. /**
  6240. * @see {@link SphereShape}
  6241. */
  6242. Sphere = 5
  6243. }
  6244. export enum ShapeImplType {
  6245. None = 0,
  6246. Basic = 1,
  6247. AttachedToMesh = 2,
  6248. GLTFMultiple = 3
  6249. }
  6250. export interface IShapeData {
  6251. /**
  6252. * 轮廓中心相对元素{@link Transform}中心的偏移量。
  6253. * @default [0, 0, 0]
  6254. */
  6255. center?: [number, number, number];
  6256. /**
  6257. * 轮廓是否自动贴合{@link Mesh | Mesh组件}或{@link GLTF | GLTF组件}的大小。
  6258. * 如果当前元素下不存在Mesh组件和GLTF组件则不生效。
  6259. *
  6260. * > {@link MeshShape}永远会开启这项。
  6261. *
  6262. * @default false
  6263. */
  6264. autoFit?: boolean;
  6265. }
  6266. export const ShapeSchema: {
  6267. center: {
  6268. type: string;
  6269. };
  6270. autoFit: {
  6271. type: string;
  6272. };
  6273. };
  6274. /**
  6275. * 轮廓组件的基类。
  6276. * 为元素添加*该组件的子类*可以创建一个可用于交互的轮廓。
  6277. *
  6278. * > 💡 只要创建了轮廓,在点击该物体时就可以触发事件:
  6279. * > + touch-shape: 点击物体事件,回调参数为{@link IShapeTouchEvent};
  6280. * > + drag-shape: 拖拽物体事件,回调参数为{@link IShapeDragEvent};
  6281. * > + untouch-shape: 松开物体事件,回调参数为{@link IShapeTouchEvent};
  6282. * >
  6283. * > 绑定事件的方法可参考以下代码:
  6284. * >
  6285. * > ``` <xr-node sphere-shape bind:touch-shape="handleTouchShape"></xr-node> ```
  6286. *
  6287. * > 💡 如果想要将轮廓可视化来确认轮廓大小,可以在同一个元素下添加{@link ShapeGizmos}组件,或在标签上添加`shape-gizmo`属性(对MeshShape不起作用)。
  6288. *
  6289. * @abstract
  6290. */
  6291. export default abstract class Shape extends Component<IShapeData> {
  6292. readonly priority: number;
  6293. _nativeStaticRigidbody: phys3D.Rigidbody | null;
  6294. _nativeColliders: Array<phys3D.Collider>;
  6295. protected _rigidbodyComp: Rigidbody | null;
  6296. protected _type: EShapeType;
  6297. protected _shadowShapes: Array<Shape>;
  6298. /**
  6299. * @internal
  6300. */
  6301. get shadowShapes(): ReadonlyArray<Shape>;
  6302. onAdd(parent: Element, data: IShapeData): void;
  6303. onUpdate(data: IShapeData, preData: IShapeData): void;
  6304. onTick(dateTime: number, data: IShapeData): void;
  6305. protected abstract _createBasic(data: IShapeData): void;
  6306. protected abstract _createAttachedToMesh(data: IShapeData, mesh: Mesh): void;
  6307. protected abstract _createGLTFMultiple(data: IShapeData, gltf: GLTFComponent): void;
  6308. /**
  6309. * 无状态函数。
  6310. */
  6311. /**
  6312. * 如果需要重建,那就重建。
  6313. */
  6314. onRemove(parent: Element, data: IShapeData): void;
  6315. onRelease(): void;
  6316. /**
  6317. * @internal
  6318. */
  6319. get entity(): Kanata.Entity3D;
  6320. /**
  6321. * 轮廓类型。
  6322. */
  6323. get type(): EShapeType;
  6324. set type(v: EShapeType);
  6325. /**
  6326. * @internal
  6327. * 碰撞体是否是Trigger,开启后不参与碰撞,但是能触发Trigger系列的事件:
  6328. * {@link onTriggerEnter}, {@link onTriggerStay}, {@link onTriggerExit}。
  6329. * @default false
  6330. */
  6331. get isTrigger(): boolean;
  6332. set isTrigger(v: boolean);
  6333. /**
  6334. * @internal
  6335. */
  6336. get scale(): Vector3;
  6337. set scale(v: Vector3);
  6338. /**
  6339. * @internal
  6340. * 获取碰撞体附着的刚体组件。
  6341. * 目前不支持刚体,必定返回null。
  6342. */
  6343. get attachedRigidbody(): any;
  6344. /**
  6345. * @internal
  6346. * 设置碰撞体的contactOffset,必须为正数。
  6347. * *一对*碰撞体,如果他们之间的最近距离小于他们的contactOffset之和,那么物理系统在一次*物理模拟*后就会产生一次碰撞。
  6348. */
  6349. get contactOffset(): number;
  6350. set contactOffset(v: number);
  6351. /** @internal */
  6352. constructor();
  6353. /**
  6354. * @internal
  6355. */
  6356. enable(): void;
  6357. /**
  6358. * @internal
  6359. */
  6360. disable(): void;
  6361. /**
  6362. * 交给子类重载实现
  6363. * @deprecated
  6364. */
  6365. protected _create(data: IShapeData): void;
  6366. /** @internal */
  6367. onAddRigidbody(rigidbody: Rigidbody): void;
  6368. /** @internal */
  6369. onRemoveRigidbody(): void;
  6370. /**
  6371. * @virtual 子类调用该方法之前必须确保_nativeCollider已经创建
  6372. */
  6373. protected _baseInit(): void;
  6374. }
  6375. }
  6376. declare module 'XrFrame/components/physics/SphereShape' {
  6377. import Shape, { EShapeType, IShapeData } from "XrFrame/components/physics/Shape";
  6378. import Vector3 from "XrFrame/math/vector3";
  6379. import { IComponentSchema } from "XrFrame/core/Component";
  6380. import Mesh from "XrFrame/components/Mesh";
  6381. import GLTFComponent from "XrFrame/components/GLTF";
  6382. /**
  6383. * @see {@link SphereShapes}
  6384. */
  6385. export interface ISphereShapeData extends IShapeData {
  6386. /**
  6387. * 球形轮廓的半径。
  6388. * @default 1
  6389. */
  6390. radius?: number;
  6391. }
  6392. export const SphereShapeSchema: IComponentSchema;
  6393. /**
  6394. * 为当前元素创建一个可交互的球状轮廓。
  6395. * 可通过在标签上添加`sphere-shape`属性来为元素添加该组件。
  6396. *
  6397. * @see {@link ISphereShapeData}
  6398. */
  6399. export default class SphereShape extends Shape {
  6400. readonly schema: IComponentSchema;
  6401. protected _type: EShapeType;
  6402. /**
  6403. * 轮廓相对于元素中心点的偏移量。
  6404. */
  6405. get center(): Vector3;
  6406. set center(v: Vector3);
  6407. static defaultRadius: number;
  6408. /**
  6409. * 球形轮廓的半径。
  6410. */
  6411. get radius(): number;
  6412. set radius(v: number);
  6413. protected _createBasic(data: ISphereShapeData): void;
  6414. protected _createAttachedToMesh(data: ISphereShapeData, mesh: Mesh): void;
  6415. protected _createGLTFMultiple(data: ISphereShapeData, gltf: GLTFComponent): void;
  6416. }
  6417. }
  6418. declare module 'XrFrame/components/physics/MeshShape' {
  6419. import Shape, { IShapeData, EShapeType } from "XrFrame/components/physics/Shape";
  6420. import { IComponentSchema } from "XrFrame/xrFrameSystem";
  6421. import GLTFComponent from "XrFrame/components/GLTF";
  6422. /**
  6423. * @see {@link MeshShape}
  6424. */
  6425. export interface IMeshShapeData extends IShapeData {
  6426. }
  6427. export const MeshShapeSchema: IComponentSchema;
  6428. /**
  6429. * 利用当前元素下的{@link Mesh | Mesh组件}或{@link GLTF | GLTF组件},创建一个完全贴合的轮廓。如果当前元素下不存在Mesh组件或GLTF组件,则不生效。
  6430. * 可通过在标签上添加`mesh-shape`属性来为元素添加该组件。
  6431. *
  6432. * > ⚠️ 如果Mesh或GLTF内部结构非常复杂,创建和维持该组件可能会占用较多的资源。如果发现该组件会导致小程序性能下降,可以考虑改用其他轮廓类型,并开启{@link IShapeData.autoFit | autoFit}属性。
  6433. *
  6434. * > ⚠️ MeshShape使用的Mesh的顶点数量不能超过65535个。如果超过了,推荐使用CubeShape+autoFit来代替。
  6435. *
  6436. * @see {@link IMeshShapeData}
  6437. */
  6438. export default class MeshShape extends Shape {
  6439. readonly schema: IComponentSchema;
  6440. readonly priority: number;
  6441. _nativeColliders: Array<phys3D.MeshCollider>;
  6442. _shadowShapes: Array<MeshShape>;
  6443. protected _type: EShapeType;
  6444. protected _createBasic(data: IMeshShapeData): void;
  6445. protected _createAttachedToMesh(data: IMeshShapeData): void;
  6446. protected _createGLTFMultiple(data: IMeshShapeData, gltf: GLTFComponent): void;
  6447. }
  6448. }
  6449. declare module 'XrFrame/components/physics/CapsuleShape' {
  6450. import Shape, { EShapeType, IShapeData } from "XrFrame/components/physics/Shape";
  6451. import Vector3 from "XrFrame/math/vector3";
  6452. import { IComponentSchema } from "XrFrame/xrFrameSystem";
  6453. import Mesh from "XrFrame/components/Mesh";
  6454. import GLTFComponent from "XrFrame/components/GLTF";
  6455. /**
  6456. * @see {@link CapsuleShape}
  6457. */
  6458. export interface ICapsuleShapeData extends IShapeData {
  6459. /**
  6460. * 胶囊体两端球体的半径。
  6461. * @default 0.5
  6462. */
  6463. radius?: number;
  6464. /**
  6465. * 胶囊体的长度。
  6466. * @default 2
  6467. */
  6468. height?: number;
  6469. /**
  6470. * 胶囊体的朝向。
  6471. * @default ECapsuleShapeDirection["Y-Axis"]
  6472. */
  6473. direction?: ECapsuleShapeDirection;
  6474. }
  6475. export const CapsuleShapeSchema: IComponentSchema;
  6476. /**
  6477. * 胶囊体轮廓的朝向。
  6478. *
  6479. * @category Physics
  6480. */
  6481. export enum ECapsuleShapeDirection {
  6482. "X-Axis" = 0,
  6483. "Y-Axis" = 1,
  6484. "Z-Axis" = 2
  6485. }
  6486. /**
  6487. * 为当前元素创建一个可交互的胶囊体轮廓。
  6488. * 可通过在标签上添加`capsule-shape`属性来为元素添加该组件。
  6489. *
  6490. * @see {@link ICapsuleShapeData}
  6491. */
  6492. export default class CapsuleShape extends Shape {
  6493. readonly schema: IComponentSchema;
  6494. protected _type: EShapeType;
  6495. set center(v: Vector3);
  6496. static defaultRadius: number;
  6497. /**
  6498. * 胶囊体两端球体的半径。
  6499. */
  6500. get radius(): number;
  6501. set radius(v: number);
  6502. static defaultHeight: number;
  6503. /**
  6504. * 胶囊体的长度。
  6505. */
  6506. get height(): number;
  6507. set height(v: number);
  6508. /**
  6509. * 胶囊体的朝向。
  6510. */
  6511. get direction(): ECapsuleShapeDirection;
  6512. set direction(v: ECapsuleShapeDirection);
  6513. protected _createBasic(data: ICapsuleShapeData): void;
  6514. protected _createAttachedToMesh(data: ICapsuleShapeData, mesh: Mesh): void;
  6515. protected _createGLTFMultiple(data: ICapsuleShapeData, gltf: GLTFComponent): void;
  6516. }
  6517. }
  6518. declare module 'XrFrame/components/physics/CubeShape' {
  6519. import Shape, { EShapeType, IShapeData } from "XrFrame/components/physics/Shape";
  6520. import Vector3 from "XrFrame/math/vector3";
  6521. import { IComponentSchema } from "XrFrame/xrFrameSystem";
  6522. import Mesh from "XrFrame/components/Mesh";
  6523. import GLTFComponent from "XrFrame/components/GLTF";
  6524. /**
  6525. * @see {@link CubeShape}
  6526. */
  6527. export interface ICubeShapeData extends IShapeData {
  6528. /**
  6529. * 长方体沿x,y,z轴的长度。
  6530. * @default [1, 1, 1]
  6531. */
  6532. size?: [number, number, number];
  6533. }
  6534. export const CubeShapeSchema: IComponentSchema;
  6535. /**
  6536. * 为当前元素创建一个可交互的长方体轮廓。
  6537. * 可通过在标签上添加`cube-shape`属性来为元素添加该组件。
  6538. *
  6539. * @see {@link ICubeShapeData}
  6540. */
  6541. export default class CubeShape extends Shape {
  6542. readonly schema: IComponentSchema;
  6543. protected _type: EShapeType;
  6544. /**
  6545. * 轮廓相对于元素中心点的偏移量。
  6546. */
  6547. get center(): Vector3;
  6548. set center(v: Vector3);
  6549. /**
  6550. * 长方体沿x,y,z轴的长度。
  6551. */
  6552. get size(): Vector3;
  6553. set size(v: Vector3);
  6554. protected _createBasic(data: ICubeShapeData): void;
  6555. protected _createAttachedToMesh(data: ICubeShapeData, mesh: Mesh): void;
  6556. protected _createGLTFMultiple(data: ICubeShapeData, gltf: GLTFComponent): void;
  6557. }
  6558. }
  6559. declare module 'XrFrame/components/gizmo/ShapeGizmos' {
  6560. import Component from "XrFrame/core/Component";
  6561. import Element from "XrFrame/core/Element";
  6562. import CapsuleGizmo from "XrFrame/components/gizmo/CapsuleGizmo";
  6563. import Shape, { ShapeImplType } from "XrFrame/components/physics/Shape";
  6564. import CubeGizmo from "XrFrame/components/gizmo/CubeGizmo";
  6565. /**
  6566. * @see {@link ShapeGizmos}
  6567. */
  6568. export interface IShapeGizmosData {
  6569. }
  6570. export const ShapeGizmosSchema: {};
  6571. interface GizmoInfo {
  6572. shape: Shape;
  6573. gizmoCtor: null | typeof CubeGizmo | typeof CapsuleGizmo;
  6574. shadowGizmos: Array<ShapeGizmos>;
  6575. type: ShapeImplType;
  6576. version: number;
  6577. }
  6578. /**
  6579. * 将当前元素下的所有{@link Shape | 轮廓}都显示出来。
  6580. * 在标签上添加`shape-gizmo`属性来创建该组件。
  6581. *
  6582. * @see {@link IShapeGizmosData}
  6583. */
  6584. export default class ShapeGizmos extends Component<IShapeGizmosData> {
  6585. onAdd(parent: Element, data: IShapeGizmosData): void;
  6586. onUpdate(data: IShapeGizmosData, preData: IShapeGizmosData): void;
  6587. onTick(deltaTime: number, data: IShapeGizmosData): void;
  6588. onRemove(parent: Element, data: IShapeGizmosData): void;
  6589. onRelease(data: IShapeGizmosData): void;
  6590. /**
  6591. * @internal
  6592. */
  6593. buildGizmo(info: GizmoInfo): void;
  6594. }
  6595. export {};
  6596. }
  6597. declare module 'XrFrame/components/AssetPostProcess' {
  6598. /**
  6599. * AssetPostProcess.ts
  6600. *
  6601. * * @Date : 10/14/2022, 4:35:12 PM
  6602. */
  6603. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  6604. import Element from 'XrFrame/core/Element';
  6605. /**
  6606. * `AssetPostProcess`资源数据接口。
  6607. */
  6608. export interface IAssetPostProcessData {
  6609. /**
  6610. * 资源`id`。
  6611. */
  6612. assetId: string;
  6613. /**
  6614. * 同{@link IPostProcessOptions.type}。
  6615. */
  6616. type: string;
  6617. /**
  6618. * 同{@link IPostProcessOptions.isHDR}。
  6619. */
  6620. isHDR?: boolean;
  6621. /**
  6622. * 同{@link IPostProcessOptions.data}。
  6623. */
  6624. data?: {
  6625. [key: string]: string;
  6626. };
  6627. }
  6628. /**
  6629. * {@link AssetPostProcess}的`schema`,详见{@link IAssetPostProcessData}。
  6630. */
  6631. export const AssetPostProcessSchema: IComponentSchema;
  6632. /**
  6633. * 渲染纹理创建组件,用于在`xml`中创建{@link PostProcess}资源,一般被代理到{@link XRAssetPostProcess}元素。
  6634. */
  6635. export default class AssetPostProcess extends Component<IAssetPostProcessData> {
  6636. /**
  6637. * 详见{@link AssetPostProcessSchema}。
  6638. */
  6639. readonly schema: IComponentSchema;
  6640. /**
  6641. * 对应后处理资源的数据,可用于修改。
  6642. */
  6643. get assetData(): {
  6644. [key: string]: any;
  6645. };
  6646. onAdd(parent: Element, data: IAssetPostProcessData): void;
  6647. onUpdate(data: IAssetPostProcessData, preData: IAssetPostProcessData): void;
  6648. /**
  6649. * 移除AssetPostProcess。
  6650. */
  6651. onRemove(parent: Element, data: IAssetPostProcessData): void;
  6652. }
  6653. }
  6654. declare module 'XrFrame/elements/xr-node' {
  6655. /**
  6656. * xr-node.ts
  6657. *
  6658. * * @Date : 2022/3/18下午2:15:02
  6659. */
  6660. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6661. /**
  6662. * 默认包含{@link Transform}组件。
  6663. */
  6664. export const NodeDefaultComponents: IEntityComponents;
  6665. /**
  6666. * 默认将{@link Transform}组件的属性进行映射。
  6667. */
  6668. export const NodeDataMapping: {
  6669. 'node-id': string[];
  6670. visible: string[];
  6671. layer: string[];
  6672. position: string[];
  6673. rotation: string[];
  6674. scale: string[];
  6675. } & {
  6676. [key: string]: string[];
  6677. };
  6678. /**
  6679. * 标签为`xr-node`,场景中所有3D节点的基础。
  6680. *
  6681. * 默认组件见{@link NodeDefaultComponents},属性映射见{@link NodeDataMapping}。
  6682. */
  6683. export default class XRNode extends Element {
  6684. static IS(element: Element): element is XRNode;
  6685. readonly defaultComponents: IEntityComponents;
  6686. readonly dataMapping: {
  6687. [key: string]: string[];
  6688. };
  6689. readonly isXRNode: boolean;
  6690. }
  6691. }
  6692. declare module 'XrFrame/elements/xr-shadow' {
  6693. /**
  6694. * xr-shadow.ts
  6695. *
  6696. * * @Date : 6/14/2022, 3:59:17 PM
  6697. */
  6698. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6699. /**
  6700. * 默认包含{@link XRNode}的所有默认组件。
  6701. */
  6702. export const ShadowDefaultComponents: IEntityComponents;
  6703. /**
  6704. * 默认包含{@link XRNode}的所有属性映射。
  6705. */
  6706. export const ShadowDataMapping: {
  6707. 'node-id': string[];
  6708. visible: string[];
  6709. layer: string[];
  6710. position: string[];
  6711. rotation: string[];
  6712. scale: string[];
  6713. } & {
  6714. [key: string]: string[];
  6715. };
  6716. /**
  6717. * 标签为`xr-shadow`。
  6718. * 是一种特殊的节点,开发者**仅可在其下以及子孙挂载自己创建的节点**!
  6719. *
  6720. * 默认组件见{@link ShadowDefaultComponents},属性映射见{@link ShadowDataMapping}。
  6721. */
  6722. export default class XRShadow extends Element {
  6723. readonly defaultComponents: IEntityComponents;
  6724. readonly dataMapping: {
  6725. [key: string]: string[];
  6726. };
  6727. _appendChild(_child: Element, custom?: boolean): void;
  6728. _removeChild(_child: Element, _index?: number, custom?: boolean): void;
  6729. _insertBefore(_child: Element, _before?: Element, _index?: number): void;
  6730. _replaceChild(_child: Element, _oldChild?: Element, _index?: number): void;
  6731. _spliceBefore(_before: number | Element, _deleteCount: number, _list: Element): void;
  6732. _spliceAppend(_list: Element): void;
  6733. _spliceRemove(_before: Element, _deleteCount: number): void;
  6734. }
  6735. }
  6736. declare module 'XrFrame/elements/xr-camera' {
  6737. /**
  6738. * xr-camera.ts
  6739. *
  6740. * * @Date : 2022/3/29下午5:03:57
  6741. */
  6742. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6743. /**
  6744. * 默认包含{@link XRNode}的所有默认组件,以及{@link Camera}组件。
  6745. */
  6746. export const CameraDefaultComponents: IEntityComponents;
  6747. /**
  6748. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Camera}组件的属性进行映射。
  6749. */
  6750. export const CameraDataMapping: {
  6751. target: string[];
  6752. 'render-target': string[];
  6753. 'is-perspective': string[];
  6754. 'cull-mask': string[];
  6755. depth: string[];
  6756. fov: string[];
  6757. near: string[];
  6758. far: string[];
  6759. 'orth-size': string[];
  6760. background: string[];
  6761. 'is-ar-camera': string[];
  6762. 'is-clear-depth': string[];
  6763. 'is-clear-stencil': string[];
  6764. 'is-clear-color': string[];
  6765. 'clear-depth': string[];
  6766. 'clear-stencil': string[];
  6767. 'clear-color': string[];
  6768. 'post-process': string[];
  6769. } & {
  6770. 'node-id': string[];
  6771. visible: string[];
  6772. layer: string[];
  6773. position: string[];
  6774. rotation: string[];
  6775. scale: string[];
  6776. } & {
  6777. [key: string]: string[];
  6778. };
  6779. /**
  6780. * 标签为`xr-camera`。
  6781. *
  6782. * 默认组件见{@link CameraDefaultComponents},属性映射见{@link CameraDataMapping}。
  6783. */
  6784. export default class XRCamera extends Element {
  6785. readonly defaultComponents: IEntityComponents;
  6786. readonly dataMapping: {
  6787. [key: string]: string[];
  6788. };
  6789. }
  6790. }
  6791. declare module 'XrFrame/elements/xr-mesh' {
  6792. /**
  6793. * xr-mesh.ts
  6794. *
  6795. * * @Date : 2022/3/29下午5:05:49
  6796. */
  6797. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6798. /**
  6799. * 默认包含{@link XRNode}的所有默认组件,以及{@link Mesh}组件。
  6800. */
  6801. export const MeshDefaultComponents: IEntityComponents;
  6802. /**
  6803. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Mesh}组件的属性进行映射。
  6804. */
  6805. export const MeshDataMapping: {
  6806. 'never-cull': string[];
  6807. 'cast-shadow': string[];
  6808. 'receive-shadow': string[];
  6809. geometry: string[];
  6810. material: string[];
  6811. uniforms: string[];
  6812. states: string[];
  6813. } & {
  6814. 'node-id': string[];
  6815. visible: string[];
  6816. layer: string[];
  6817. position: string[];
  6818. rotation: string[];
  6819. scale: string[];
  6820. } & {
  6821. [key: string]: string[];
  6822. };
  6823. /**
  6824. * 标签为`xr-mesh`。
  6825. *
  6826. * 默认组件见{@link MeshDefaultComponents},属性映射见{@link MeshDataMapping}。
  6827. */
  6828. export default class XRMesh extends Element {
  6829. readonly defaultComponents: IEntityComponents;
  6830. readonly dataMapping: {
  6831. [key: string]: string[];
  6832. };
  6833. }
  6834. }
  6835. declare module 'XrFrame/elements/xr-light' {
  6836. /**
  6837. * xr-light.ts
  6838. *
  6839. * * @Date : 4/12/2022, 10:37:57 AM
  6840. */
  6841. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6842. /**
  6843. * 默认包含{@link XRNode}的所有默认组件,以及{@link Light}组件。
  6844. */
  6845. export const LightDefaultComponents: IEntityComponents;
  6846. /**
  6847. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Light}组件的属性进行映射。
  6848. */
  6849. export const LightDataMapping: {
  6850. type: string[];
  6851. 'cast-shadow': string[];
  6852. 'shadow-distance': string[];
  6853. 'shadow-strength': string[];
  6854. 'shadow-bias': string[];
  6855. color: string[];
  6856. intensity: string[];
  6857. range: string[];
  6858. 'inner-cone-angle': string[];
  6859. 'outer-cone-angle': string[];
  6860. } & {
  6861. 'node-id': string[];
  6862. visible: string[];
  6863. layer: string[];
  6864. position: string[];
  6865. rotation: string[];
  6866. scale: string[];
  6867. } & {
  6868. [key: string]: string[];
  6869. };
  6870. /**
  6871. * 标签为`xr-ar-tracker`。
  6872. *
  6873. * 默认组件见{@link LightDefaultComponents},属性映射见{@link LightDataMapping}。
  6874. */
  6875. export default class XRLight extends Element {
  6876. readonly defaultComponents: IEntityComponents;
  6877. readonly dataMapping: {
  6878. [key: string]: string[];
  6879. };
  6880. }
  6881. }
  6882. declare module 'XrFrame/elements/xr-gltf' {
  6883. import { IEntityComponents } from 'XrFrame/core/Element';
  6884. import XRShadow from 'XrFrame/elements/xr-shadow';
  6885. /**
  6886. * 默认包含{@link XRNode}的所有默认组件,以及{@link GLTF}组件。
  6887. */
  6888. export const GLTFDefaultComponents: IEntityComponents;
  6889. /**
  6890. * 默认包含{@link XRNode}的所有属性映射,以及将{@link GLTF}组件的属性进行映射。
  6891. *
  6892. * + model → {@link IGLTFComponentData.model}
  6893. * + cast-shadow → {@link IGLTFComponentData.castShadow}
  6894. * + receive-shadow → {@link IGLTFComponentData.receiveShadow}
  6895. *
  6896. */
  6897. export const GLTFDataMapping: {
  6898. model: string[];
  6899. "cast-shadow": string[];
  6900. "receive-shadow": string[];
  6901. "never-cull": string[];
  6902. states: string[];
  6903. } & {
  6904. 'node-id': string[];
  6905. visible: string[];
  6906. layer: string[];
  6907. position: string[];
  6908. rotation: string[];
  6909. scale: string[];
  6910. } & {
  6911. [key: string]: string[];
  6912. };
  6913. /**
  6914. * 标签为`xr-gltf`。
  6915. *
  6916. * 默认组件见{@link GLTFDefaultComponents},属性映射见{@link GLTFDataMapping}。
  6917. */
  6918. export default class XRGLTF extends XRShadow {
  6919. readonly defaultComponents: IEntityComponents;
  6920. readonly dataMapping: {
  6921. [key: string]: string[];
  6922. };
  6923. }
  6924. }
  6925. declare module 'XrFrame/elements/xr-asset-material' {
  6926. /**
  6927. * xr-asset-material.ts
  6928. *
  6929. * * @Date : 2022/3/18下午5:27:37
  6930. */
  6931. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6932. export const AssetMaterialDefaultComponents: IEntityComponents;
  6933. /**
  6934. * 将{@link AssetMaterial}的属性进行映射。
  6935. */
  6936. export const AssetMaterialDataMapping: {
  6937. 'asset-id': string[];
  6938. effect: string[];
  6939. marcos: string[];
  6940. uniforms: string[];
  6941. states: string[];
  6942. 'render-queue': string[];
  6943. } & {
  6944. [key: string]: string[];
  6945. };
  6946. /**
  6947. * 标签为`xr-asset-material`。
  6948. *
  6949. * 默认组件见{@link AssetMaterialDefaultComponents},属性映射见{@link AssetMaterialDataMapping}。
  6950. */
  6951. export default class XRAssetMaterial extends Element {
  6952. readonly defaultComponents: IEntityComponents;
  6953. readonly dataMapping: {
  6954. [key: string]: string[];
  6955. };
  6956. }
  6957. }
  6958. declare module 'XrFrame/elements/xr-asset-render-texture' {
  6959. /**
  6960. * xr-asset-render-texture.ts
  6961. *
  6962. * * @Date : 8/29/2022, 12:51:29 PM
  6963. */
  6964. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  6965. export const AssetRenderTextureDefaultComponents: IEntityComponents;
  6966. /**
  6967. * 将{@link AssetRenderTexture}的属性进行映射。
  6968. */
  6969. export const AssetRenderTextureDataMapping: {
  6970. 'asset-id': string[];
  6971. width: string[];
  6972. height: string[];
  6973. 'is-hdr': string[];
  6974. } & {
  6975. [key: string]: string[];
  6976. };
  6977. /**
  6978. * 标签为`xr-asset-render-texture`。
  6979. *
  6980. * 默认组件见{@link AssetRenderTextureDefaultComponents},属性映射见{@link AssetRenderTextureDataMapping}。
  6981. */
  6982. export default class XRAssetRenderTexture extends Element {
  6983. readonly defaultComponents: IEntityComponents;
  6984. readonly dataMapping: {
  6985. [key: string]: string[];
  6986. };
  6987. }
  6988. }
  6989. declare module 'XrFrame/elements/xr-asset-load' {
  6990. /**
  6991. * xr-asset-load.ts
  6992. *
  6993. * * @Date : 2022/3/16下午5:29:40
  6994. */
  6995. import Element from 'XrFrame/core/Element';
  6996. /**
  6997. * 将{@link AssetLoad}组件的属性进行映射。
  6998. */
  6999. export const AssetLoadDataMapping: {
  7000. type: string[];
  7001. 'asset-id': string[];
  7002. src: string[];
  7003. defer: string[];
  7004. options: string[];
  7005. } & {
  7006. [key: string]: string[];
  7007. };
  7008. /**
  7009. * 标签为`xr-asset-load`。
  7010. *
  7011. * 属性映射见{@link AssetLoadDataMapping}。
  7012. */
  7013. export default class XRAssetLoad extends Element {
  7014. readonly dataMapping: {
  7015. [key: string]: string[];
  7016. };
  7017. readonly neverTick: boolean;
  7018. }
  7019. }
  7020. declare module 'XrFrame/elements/xr-assets' {
  7021. /**
  7022. * xr-assets.ts
  7023. *
  7024. * * @Date : 2022/3/16下午5:28:52
  7025. */
  7026. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7027. /**
  7028. * 默认包含{@link Assets}组件。
  7029. */
  7030. export const AssetsDefaultComponents: IEntityComponents;
  7031. /**
  7032. * 标签为`xr-assets`。
  7033. *
  7034. * 默认组件见{@link AssetsDefaultComponents}。
  7035. */
  7036. export default class XRAssets extends Element {
  7037. readonly defaultComponents: IEntityComponents;
  7038. readonly neverTick: boolean;
  7039. }
  7040. }
  7041. declare module 'XrFrame/elements/xr-env' {
  7042. /**
  7043. * xr-env.ts
  7044. *
  7045. * * @Date : 5/12/2022, 12:56:19 PM
  7046. */
  7047. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7048. /**
  7049. * 默认包含{@link Env}组件。
  7050. */
  7051. export const EnvDefaultComponents: IEntityComponents;
  7052. /**
  7053. * 默认将{@link Env}组件的属性进行映射。
  7054. */
  7055. export const EnvDataMapping: {
  7056. 'env-data': string[];
  7057. 'sky-map': string[];
  7058. 'is-sky2d': string[];
  7059. rotation: string[];
  7060. 'diffuse-exp': string[];
  7061. 'specular-exp': string[];
  7062. } & {
  7063. [key: string]: string[];
  7064. };
  7065. /**
  7066. * 标签为`xr-env`。
  7067. *
  7068. * 默认组件见{@link EnvDefaultComponents},属性映射见{@link EnvDataMapping}。
  7069. */
  7070. export default class XREnv extends Element {
  7071. readonly defaultComponents: IEntityComponents;
  7072. readonly dataMapping: {
  7073. [key: string]: string[];
  7074. };
  7075. readonly neverTick: boolean;
  7076. }
  7077. }
  7078. declare module 'XrFrame/elements/xr-ar-tracker' {
  7079. /**
  7080. * xr-ar-tracker.ts
  7081. *
  7082. * * @Date : 6/27/2022, 3:42:45 PM
  7083. */
  7084. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7085. /**
  7086. * 默认包含{@link XRNode}的所有默认组件,以及{@link ARTracker}组件。
  7087. */
  7088. export const ARTrackerDefaultComponents: IEntityComponents;
  7089. /**
  7090. * 默认包含{@link XRNode}的所有属性映射,以及将{@link ARTracker}组件的属性进行映射。
  7091. */
  7092. export const ARTrackerDataMapping: {
  7093. mode: string[];
  7094. 'hit-id': string[];
  7095. image: string[];
  7096. src: string[];
  7097. 'auto-sync': string[];
  7098. } & {
  7099. 'node-id': string[];
  7100. visible: string[];
  7101. layer: string[];
  7102. position: string[];
  7103. rotation: string[];
  7104. scale: string[];
  7105. } & {
  7106. [key: string]: string[];
  7107. };
  7108. /**
  7109. * 标签为`xr-ar-tracker`。
  7110. *
  7111. * 默认组件见{@link ARTrackerDefaultComponents},属性映射见{@link ARTrackerDataMapping}。
  7112. */
  7113. export default class XRARTracker extends Element {
  7114. readonly defaultComponents: IEntityComponents;
  7115. readonly dataMapping: {
  7116. [key: string]: string[];
  7117. };
  7118. }
  7119. }
  7120. declare module 'XrFrame/elements/xr-text' {
  7121. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7122. export const TextDefaultComponents: IEntityComponents;
  7123. export const TextDataMapping: {
  7124. [key: string]: string[];
  7125. };
  7126. export default class XRText extends Element {
  7127. readonly defaultComponents: IEntityComponents;
  7128. readonly dataMapping: {
  7129. [key: string]: string[];
  7130. };
  7131. }
  7132. }
  7133. declare module 'XrFrame/elements/xr-particle' {
  7134. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7135. export const ParticleDefaultComponents: IEntityComponents;
  7136. export const ParticleDataMapping: {
  7137. [key: string]: string[];
  7138. };
  7139. export default class XRParticle extends Element {
  7140. readonly defaultComponents: IEntityComponents;
  7141. readonly dataMapping: {
  7142. [key: string]: string[];
  7143. };
  7144. }
  7145. }
  7146. declare module 'XrFrame/elements/xr-asset-post-process' {
  7147. /**
  7148. * xr-asset-post-process.ts
  7149. *
  7150. * * @Date : 10/14/2022, 5:18:21 PM
  7151. */
  7152. import Element, { IEntityComponents } from 'XrFrame/core/Element';
  7153. export const AssetPostProcessDefaultComponents: IEntityComponents;
  7154. /**
  7155. * 将{@link AssetPostProcess}的属性进行映射。
  7156. */
  7157. export const AssetPostProcessDataMapping: {
  7158. 'asset-id': string[];
  7159. type: string[];
  7160. 'is-hdr': string[];
  7161. data: string[];
  7162. } & {
  7163. [key: string]: string[];
  7164. };
  7165. /**
  7166. * 标签为`xr-asset-render-texture`。
  7167. *
  7168. * 默认组件见{@link AssetPostProcessDefaultComponents},属性映射见{@link AssetPostProcessDataMapping}。
  7169. */
  7170. export default class XRAssetPostProcess extends Element {
  7171. readonly defaultComponents: IEntityComponents;
  7172. readonly dataMapping: {
  7173. [key: string]: string[];
  7174. };
  7175. }
  7176. }
  7177. declare module 'XrFrame/systems/AssetsSystem' {
  7178. import Component from 'XrFrame/core/Component';
  7179. import Element from 'XrFrame/core/Element';
  7180. import { IAssetLoadData, IAssetWithState } from 'XrFrame/loader/types';
  7181. export interface IAssetsSystemData {
  7182. }
  7183. /**
  7184. * 资源系统,负责整个场景的资源管理。
  7185. *
  7186. * 一般不需要手动管理,而是利用{@link AssetLoad}、{@link registerGeometry}之类的使用。
  7187. */
  7188. export default class AssetsSystem extends Component<IAssetsSystemData> {
  7189. readonly priority: number;
  7190. /**
  7191. * 手动添加一个资源。
  7192. */
  7193. addAsset<T>(type: string, id: string, asset: T): void;
  7194. /**
  7195. * 手动加载一个资源。
  7196. */
  7197. loadAsset(params: IAssetLoadData, parent?: Element): Promise<IAssetWithState<any>>;
  7198. /**
  7199. * 手动释放一个资源。
  7200. *
  7201. * 注意在`xml`里加载的资源不要手动释放。
  7202. */
  7203. releaseAsset(type: string, id: string): void;
  7204. /**
  7205. * 获取一个资源,如果尚未加载完成,也会返回`undefined`。
  7206. */
  7207. getAsset<T>(type: string, id: string, fallback?: string): T;
  7208. /**
  7209. * 获取一个资源以及加载状态。
  7210. */
  7211. getAssetWithState<T>(type: string, id: string, fallback?: string): IAssetWithState<T>;
  7212. /**
  7213. * 取消加载一个资源。
  7214. */
  7215. cancelAsset(type: string, id: string): void;
  7216. /**
  7217. * @internal
  7218. */
  7219. /**
  7220. * @internal
  7221. */
  7222. onRelease(data: IAssetsSystemData): void;
  7223. }
  7224. }
  7225. declare module 'XrFrame/systems/NodeSystem' {
  7226. import Component from 'XrFrame/core/Component';
  7227. export interface INodeSystemData {
  7228. }
  7229. /**
  7230. * 节点系统,负责整个场景节点的管理。
  7231. */
  7232. export default class NodeSystem extends Component<INodeSystemData> {
  7233. readonly priority: number;
  7234. onTick(deltaTime: number, data: INodeSystemData): void;
  7235. }
  7236. }
  7237. declare module 'XrFrame/systems/TickSystem' {
  7238. /**
  7239. * TickSystem.ts
  7240. *
  7241. * * @Date : 2022/3/29上午10:50:57
  7242. */
  7243. import Component from 'XrFrame/core/Component';
  7244. export interface ITickSystemData {
  7245. }
  7246. /**
  7247. * Tick系统,负责整个场景生命周期的驱动。
  7248. */
  7249. export default class TickSystem extends Component<ITickSystemData> {
  7250. readonly priority: number;
  7251. onTick(deltaTime: number, data: ITickSystemData): void;
  7252. }
  7253. }
  7254. declare module 'XrFrame/systems/AnimationSystem' {
  7255. /**
  7256. * AnimationSystem.ts
  7257. *
  7258. * * @Date : 6/17/2022, 2:35:17 PM
  7259. */
  7260. import Animator from 'XrFrame/components/Animator';
  7261. import Component from 'XrFrame/core/Component';
  7262. export interface IAnimationSystemData {
  7263. }
  7264. /**
  7265. * 动画系统,负责整个场景动画的管理。
  7266. */
  7267. export default class AnimationSystem extends Component<IAnimationSystemData> {
  7268. readonly priority: number;
  7269. onTick(deltaTime: number, data: IAnimationSystemData): void;
  7270. /**
  7271. * @internal
  7272. */
  7273. /**
  7274. * @internal
  7275. */
  7276. }
  7277. }
  7278. declare module 'XrFrame/systems/VideoSystem' {
  7279. /**
  7280. * VideoSystem.ts
  7281. *
  7282. * * @Date : 8/26/2022, 8:02:21 PM
  7283. */
  7284. import VideoTexture from 'XrFrame/assets/VideoTexture';
  7285. import Component from 'XrFrame/core/Component';
  7286. export interface IVideoSystemData {
  7287. }
  7288. /**
  7289. * 视频系统,负责整个场景视频的管理。
  7290. */
  7291. export default class VideoSystem extends Component<IVideoSystemData> {
  7292. readonly priority: number;
  7293. onTick(deltaTime: number, data: IVideoSystemData): void;
  7294. /**
  7295. * @internal
  7296. */
  7297. /**
  7298. * @internal
  7299. */
  7300. }
  7301. }
  7302. declare module 'XrFrame/systems/RenderSystem' {
  7303. /**
  7304. * RenderSystem.ts
  7305. *
  7306. * * @Date : 2022/3/16下午4:20:58
  7307. */
  7308. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  7309. import Element from 'XrFrame/core/Element';
  7310. import Camera from 'XrFrame/components/Camera';
  7311. import Env from 'XrFrame/components/Env';
  7312. import RenderGraph from 'XrFrame/render-graph/RenderGraph';
  7313. import LightManager from 'XrFrame/systems/LightManager';
  7314. import Observable from 'XrFrame/core/Observable';
  7315. /**
  7316. * `RenderSystem`系统数据接口。
  7317. */
  7318. export interface IRenderSystemData {
  7319. /**
  7320. * 场景中阴影的颜色。
  7321. * `xml`中数据类型为`color`。
  7322. */
  7323. shadowColor: number[];
  7324. }
  7325. /**
  7326. * {@link RenderSystem}的`schema`,详见{@link IRenderSystemData}。
  7327. */
  7328. export const RenderSystemSchema: IComponentSchema;
  7329. /**
  7330. * 渲染系统,负责整个场景渲染的管理。
  7331. */
  7332. export default class RenderSystem extends Component<IRenderSystemData> {
  7333. readonly priority: number;
  7334. /**
  7335. * 详见{@link RenderSystemSchema}。
  7336. */
  7337. readonly schema: IComponentSchema;
  7338. protected _lights: LightManager;
  7339. protected _renderGraph?: RenderGraph;
  7340. protected _sortedCameras: Camera[];
  7341. protected _dirtyCameras: Camera[];
  7342. protected _camerasChangeEvent: Observable<this>;
  7343. protected _env: Env;
  7344. /**
  7345. * @internal
  7346. */
  7347. get lights(): LightManager;
  7348. /**
  7349. * @internal
  7350. */
  7351. get env(): Env;
  7352. /**
  7353. * @internal
  7354. */
  7355. get camerasChangeEvent(): Observable<this, any>;
  7356. /**
  7357. * 获取场景中的所有相机,已按照深度排序。
  7358. *
  7359. * @internal
  7360. */
  7361. get cameras(): Camera[];
  7362. /**
  7363. * 获取场景中的所有当帧修改过的相机,已按照深度排序。
  7364. *
  7365. * @internal
  7366. */
  7367. get changedCameras(): Camera[];
  7368. /**
  7369. * 当前正在使用的RenderGraph。
  7370. */
  7371. get renderGraph(): RenderGraph<any>;
  7372. get shadowColor(): number[];
  7373. /**
  7374. * 修改全局宏信息。
  7375. */
  7376. changeMacros(macros: {
  7377. [name: string]: string | number | boolean;
  7378. }): void;
  7379. /**
  7380. * 获取全局宏信息。
  7381. */
  7382. getMacro(key: string): string | number | boolean;
  7383. onAdd(parent: Element, data: IRenderSystemData): void;
  7384. onTick(): void;
  7385. onRelease(data: IRenderSystemData): void;
  7386. /**
  7387. * 使用某个RenderGraph,默认会使用内置的`ForwardBaseRG`。
  7388. */
  7389. useRenderGraph(rg: RenderGraph): void;
  7390. /**
  7391. * 开启全局GPU实例化。
  7392. */
  7393. enableInstance(): void;
  7394. /**
  7395. * 关闭全局GPU实例化。
  7396. */
  7397. disableInstance(): void;
  7398. /**
  7399. * @internal
  7400. */
  7401. /**
  7402. * @internal
  7403. */
  7404. /**
  7405. * @internal
  7406. */
  7407. protected _sortCameras(): void;
  7408. }
  7409. }
  7410. declare module 'XrFrame/systems/PhysicsSystem' {
  7411. import { Camera } from 'XrFrame/components';
  7412. import Component from 'XrFrame/core/Component';
  7413. import { Kanata } from 'XrFrame/ext';
  7414. import { RaycastDesc } from 'XrFrame/physics/raycast';
  7415. import Element from "XrFrame/core/Element";
  7416. import Shape from 'XrFrame/components/physics/Shape';
  7417. /**
  7418. * `touch-shape`和`untouch-shape`事件的回调参数。
  7419. */
  7420. export interface IShapeTouchEvent {
  7421. /**
  7422. * 渲染*被选中的{@link Shape | 轮廓}*的相机。
  7423. */
  7424. camera: Camera;
  7425. /**
  7426. * *被选中的{@link Shape | 轮廓}*所在的元素。
  7427. */
  7428. target: Element;
  7429. /**
  7430. * 被选中的{@link Shape | 轮廓}。
  7431. */
  7432. shape: Shape;
  7433. /**
  7434. * 点击位置在二维canvas中的x坐标。
  7435. */
  7436. x: number;
  7437. /**
  7438. * 点击位置在二维canvas中的y坐标。
  7439. */
  7440. y: number;
  7441. /**
  7442. * {@link camera}在三维场景中的位置。
  7443. */
  7444. origin: [number, number, number];
  7445. /**
  7446. * 从{@link camera}投射出的射线的单位向量。
  7447. */
  7448. dir: [number, number, number];
  7449. /**
  7450. * @unimplemented
  7451. */
  7452. force: number;
  7453. }
  7454. /**
  7455. * `drag-shape`事件的回调参数。
  7456. */
  7457. export interface IShapeDragEvent extends IShapeTouchEvent {
  7458. /**
  7459. * 点击位置在二维canvas中的x坐标的变化量。
  7460. */
  7461. deltaX: number;
  7462. /**
  7463. * 点击位置在二维canvas中的y坐标的变化量。
  7464. */
  7465. deltaY: number;
  7466. }
  7467. /**
  7468. * @see {@link PhysicsSystem}
  7469. */
  7470. export interface IPhysicsSystemData {
  7471. }
  7472. /**
  7473. * 物理系统,管理着场景中的所有{@link Shape | 轮廓}。
  7474. */
  7475. export default class PhysicsSystem extends Component<IPhysicsSystemData> {
  7476. /**
  7477. * @internal
  7478. */
  7479. nativeSystem: phys3D.PhysSystem;
  7480. constructor();
  7481. /** @internal */
  7482. addShape(shape: Shape): void;
  7483. /** @internal */
  7484. removeShape(shape: Shape): void;
  7485. onAdd(): void;
  7486. onTick(deltaTime: number, data: IPhysicsSystemData): void;
  7487. /**
  7488. * @internal
  7489. */
  7490. bindRigidbodyWithEntity(rigidbody: phys3D.Rigidbody, entity: Kanata.Entity3D): void;
  7491. /**
  7492. * @internal
  7493. * 射线检测,判断给定射线是否与至少一个碰撞体相交,并返回与**最近**的那个碰撞体相交的信息。
  7494. */
  7495. raycast(desc: RaycastDesc): boolean;
  7496. }
  7497. }
  7498. declare module 'XrFrame/systems/ARSystem' {
  7499. import { Camera, Mesh } from 'XrFrame/components';
  7500. import ARTracker, { TTrackMode } from 'XrFrame/components/ARTracker';
  7501. import Component, { IComponentSchema } from 'XrFrame/core/Component';
  7502. import Matrix4 from 'XrFrame/math/matrix4';
  7503. import Vector3 from 'XrFrame/math/vector3';
  7504. type Element = import('XrFrame/core/Element').default;
  7505. /**
  7506. * AR追踪原始数据。
  7507. */
  7508. export interface IARRawData {
  7509. /**
  7510. * 当前相机帧画面宽度。
  7511. */
  7512. width: number;
  7513. /**
  7514. * 当前相机帧画面高度。
  7515. */
  7516. height: number;
  7517. /**
  7518. * 当前相机帧画面`y`通道,yuv420。
  7519. */
  7520. yBuffer: ArrayBuffer;
  7521. /**
  7522. * 当前相机帧画面`uv`通道,yuv420。
  7523. */
  7524. uvBuffer: ArrayBuffer;
  7525. /**
  7526. * 当前相机帧内参矩阵。
  7527. */
  7528. intrinsics: Float32Array;
  7529. /**
  7530. * 当前相机帧视图矩阵。
  7531. */
  7532. viewMatrix: Float32Array;
  7533. }
  7534. /**
  7535. * `ARSystem`系统数据接口。
  7536. */
  7537. export interface IARSystemData {
  7538. /**
  7539. * 系统支持的追踪模式,目前仅支持一个!
  7540. * `xml`中数据类型为`array`,默认值为`Plane`。
  7541. */
  7542. modes: TTrackMode[];
  7543. /**
  7544. * 使用前置还是后置相机,默认后置`Back`。
  7545. */
  7546. camera?: 'Front' | 'Back';
  7547. }
  7548. /**
  7549. * {@link ARSystem}的`schema`,详见{@link IARSystemData}。
  7550. */
  7551. export const ARSystemSchema: IComponentSchema;
  7552. /**
  7553. * AR系统,负责整个场景AR相关对象的管理。
  7554. *
  7555. * 代理自小程序的`VKSession`。
  7556. */
  7557. export default class ARSystem extends Component<IARSystemData> {
  7558. /**
  7559. * 详见{@link ARSystemSchema}。
  7560. */
  7561. readonly schema: IComponentSchema;
  7562. readonly priority: number;
  7563. /**
  7564. * 当前设备是否启动成功。
  7565. */
  7566. get supported(): boolean;
  7567. /**
  7568. * 当前启动的追踪模式。
  7569. */
  7570. get arModes(): TTrackMode[];
  7571. /**
  7572. * 当前启动的AR系统版本。
  7573. */
  7574. get arVersion(): number;
  7575. /**
  7576. * 当前是否已经可用。
  7577. */
  7578. get ready(): boolean;
  7579. /**
  7580. * 在`Face`/`Body`/`Hand`模式下,当前识别到的姿态数量。
  7581. */
  7582. get posCount(): number;
  7583. onAdd(parent: Element, data: IARSystemData): void;
  7584. onTick(deltaTime: number, data: IARSystemData): void;
  7585. onRemove(parent: Element, data: IARSystemData): void;
  7586. onRelease(data: IARSystemData): void;
  7587. /**
  7588. * 在`Plane`模式下,同步某个节点到当前追踪到的和平面的交点。
  7589. *
  7590. * @param nodeIdOrElement 节点的`nodeId`或是`element`引用。
  7591. * @param switchVisible 是否要自动切换显示或隐藏。
  7592. * @returns 是否放置成功
  7593. */
  7594. placeHere(nodeIdOrElement: string | Element, switchVisible?: boolean): boolean;
  7595. /**
  7596. * 在`Plane`模式下,重置平面。
  7597. */
  7598. resetPlane(): void;
  7599. /**
  7600. * 获取AR的追踪的原始数据。
  7601. */
  7602. getARRawData(): IARRawData;
  7603. /**
  7604. * 提供一个修改某个设置为`isARCamera`的相机的试图矩阵的手段。
  7605. */
  7606. forceSetViewMatrix(camera: Camera, mat: Matrix4 | null): void;
  7607. /**
  7608. * @internal
  7609. */
  7610. /**
  7611. * @internal
  7612. */
  7613. /**
  7614. * @internal
  7615. */
  7616. /**
  7617. * @internal
  7618. */
  7619. /**
  7620. * @internal
  7621. */
  7622. /**
  7623. * @internal
  7624. */
  7625. /**
  7626. * @internal
  7627. */
  7628. }
  7629. export {};
  7630. }
  7631. declare module 'XrFrame/systems/ShareSystem' {
  7632. /**
  7633. * ShareSystem.ts
  7634. *
  7635. * * @Date : 9/19/2022, 5:04:24 PM
  7636. */
  7637. import Component from 'XrFrame/core/Component';
  7638. export interface IShareSystemData {
  7639. }
  7640. /**
  7641. * 分享到临时文件的配置。
  7642. */
  7643. export interface IShareCaptureOptions {
  7644. /**
  7645. * 输出图片编码。
  7646. * @default 'jpg'
  7647. */
  7648. fileType?: 'jpg' | 'png';
  7649. /**
  7650. * 输出图片jpg时的品质,0~1。
  7651. * @default 0.8
  7652. */
  7653. quality?: number;
  7654. }
  7655. /**
  7656. * 分享系统,负责分享相关功能。
  7657. */
  7658. export default class ShareSystem extends Component<IShareSystemData> {
  7659. readonly priority: number;
  7660. /**
  7661. * 当前是否支持分享系统。
  7662. */
  7663. get supported(): boolean;
  7664. /**
  7665. * 截屏输出为`base64`。
  7666. */
  7667. captureToDataURL(options?: IShareCaptureOptions): string;
  7668. /**
  7669. * 截屏输出为`ArrayBuffer`。
  7670. */
  7671. captureToArrayBuffer(options?: IShareCaptureOptions): ArrayBuffer;
  7672. /**
  7673. * 截屏输出为本地路径,回调完成后会自动释放。
  7674. *
  7675. * @params callback 接受结果的回调,处理完后会释放文件。在v2.27.1前是异步,之后兼容同步和异步。
  7676. */
  7677. captureToLocalPath(options: IShareCaptureOptions, callback: (fp: string) => Promise<void> | void): void;
  7678. /**
  7679. * 直接截屏分享给好友。
  7680. */
  7681. captureToFriends(options?: IShareCaptureOptions): void;
  7682. }
  7683. }
  7684. declare module 'XrFrame/systems/GizmoSystem' {
  7685. /**
  7686. * @author shanexyzhou@tencent.com
  7687. */
  7688. import CapsuleGizmo from 'XrFrame/components/gizmo/CapsuleGizmo';
  7689. import CubeGizmo from 'XrFrame/components/gizmo/CubeGizmo';
  7690. import Component from 'XrFrame/core/Component';
  7691. import Element from "XrFrame/core/Element";
  7692. export interface IGizmoSystemData {
  7693. }
  7694. type GizmoComponent = CubeGizmo | CapsuleGizmo;
  7695. /**
  7696. * 动画系统,负责为Gizmo组件创建管理相对应的GizmoMesh元素。
  7697. */
  7698. export default class GizmoSystem extends Component<IGizmoSystemData> {
  7699. readonly priority: number;
  7700. onTick(deltaTime: number, data: IGizmoSystemData): void;
  7701. /**
  7702. * @internal
  7703. * 因为exparser的原因,不能通过脚本为普通xml节点添加子节点,
  7704. * 只能给XRShadow添加子节点,所以把需要添加gizmo的节点复制一份放在shadowRoot下,
  7705. * 每帧去同步transform。
  7706. */
  7707. addGizmo(gizmo: GizmoComponent): Element;
  7708. /**
  7709. * @internal
  7710. */
  7711. removeGizmo(gizmo: GizmoComponent): void;
  7712. }
  7713. export {};
  7714. }
  7715. declare module 'XrFrame/loader/TextureLoader' {
  7716. /**
  7717. * TextureLoader.ts
  7718. *
  7719. * * @Date : 2022/4/1下午5:19:36
  7720. */
  7721. import { Kanata } from 'XrFrame/ext';
  7722. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7723. import { IAssetLoadData } from 'XrFrame/loader/types';
  7724. export function isPOT(img: Kanata.IImage): boolean;
  7725. /**
  7726. * {@link TextureLoader}可接受的自定义参数`schema`。
  7727. */
  7728. export interface ITextureLoaderOptions {
  7729. /**
  7730. * 各向异性系数。
  7731. * @default 1
  7732. */
  7733. anisoLevel?: number;
  7734. /**
  7735. * wrapU,值为数字,见{@link EWrapMode}。
  7736. * @default 2
  7737. */
  7738. wrapU?: number;
  7739. /**
  7740. * wrapV,值为数字,见{@link EWrapMode}。
  7741. * @default 2
  7742. */
  7743. wrapV?: number;
  7744. /**
  7745. * magFilter,值为数字,见{@link EFilterMode}。
  7746. * 默认值依据纹理是否POT而定。
  7747. */
  7748. magFilter?: number;
  7749. /**
  7750. * minFilter,值为数字,见{@link EFilterMode}。
  7751. * 默认值依据纹理是否POT而定。
  7752. */
  7753. minFilter?: number;
  7754. /**
  7755. * 是否要生成mipmaps。
  7756. * @default false
  7757. */
  7758. generateMipmaps?: boolean;
  7759. }
  7760. type ITextureLoadData = IAssetLoadData<ITextureLoaderOptions>;
  7761. /**
  7762. * 纹理资源{@link Texture}的加载器。
  7763. *
  7764. * 内置资源可以通过{@link registerTexture}注册,拥有内置资源`brdf-lut`、`white`、`transparent`、`black`、`red`、`green`、`blue`、`yellow`、`babyblue`、`babygreen`、`babyred`。
  7765. */
  7766. export default class TextureLoader extends AssetLoader<Kanata.Texture, ITextureLoaderOptions> {
  7767. readonly schema: ILoaderOptionsSchema;
  7768. load(params: ITextureLoadData, callbacks: {
  7769. onLoading(progress: number): void;
  7770. onLoaded(value: Kanata.Texture): void;
  7771. onError(error: Error): void;
  7772. }): void;
  7773. getBuiltin(): {
  7774. assetId: string;
  7775. src: string;
  7776. options: {};
  7777. }[];
  7778. release(params: ITextureLoadData, value: Kanata.Texture): void;
  7779. }
  7780. export {};
  7781. }
  7782. declare module 'XrFrame/loader/ImageLoader' {
  7783. /**
  7784. * ImageLoader.ts
  7785. *
  7786. * * @Date : 6/13/2022, 12:40:11 PM
  7787. */
  7788. import { Kanata } from 'XrFrame/ext';
  7789. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7790. import { IAssetLoadData } from 'XrFrame/loader/types';
  7791. export interface IImageLoaderOptions {
  7792. }
  7793. type IImageLoadData = IAssetLoadData<IImageLoaderOptions>;
  7794. /**
  7795. * 图片数据资源{@link IImage}的加载器。
  7796. *
  7797. * 图片数据不同于纹理资源{@link Texture},请自行按照场景使用。
  7798. */
  7799. export default class ImageLoader extends AssetLoader<Kanata.IImage, IImageLoaderOptions> {
  7800. readonly schema: ILoaderOptionsSchema;
  7801. load(params: IImageLoadData, callbacks: {
  7802. onLoading(progress: number): void;
  7803. onLoaded(value: Kanata.IImage): void;
  7804. onError(error: Error): void;
  7805. }): void;
  7806. release(params: IImageLoadData, value: Kanata.IImage): void;
  7807. }
  7808. export {};
  7809. }
  7810. declare module 'XrFrame/loader/CubeTextureLoader' {
  7811. /**
  7812. * CubeCubeTextureLoader.ts
  7813. *
  7814. * * @Date : 5/10/2022, 11:24:51 AM
  7815. */
  7816. import { Kanata } from 'XrFrame/ext';
  7817. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7818. import { IAssetLoadData } from 'XrFrame/loader/types';
  7819. /**
  7820. * {@link CubeTextureLoader}可接受的自定义参数`schema`。
  7821. */
  7822. export interface ICubeTextureLoaderOptions {
  7823. /**
  7824. * 顺序为 left right top bottom front back。
  7825. */
  7826. faces: string[];
  7827. /**
  7828. * 各向异性系数。
  7829. * @default 1
  7830. */
  7831. anisoLevel: number;
  7832. /**
  7833. * wrapU,值为数字,见{@link EWrapMode}。
  7834. * @default 2
  7835. */
  7836. wrapU?: number;
  7837. /**
  7838. * wrapV,值为数字,见{@link EWrapMode}。
  7839. * @default 2
  7840. */
  7841. wrapV?: number;
  7842. /**
  7843. * wrapW,值为数字,见{@link EWrapMode}。
  7844. * @default 2
  7845. */
  7846. wrapW?: number;
  7847. /**
  7848. * magFilter,值为数字,见{@link EFilterMode}。
  7849. * 默认值依据纹理是否POT而定。
  7850. */
  7851. magFilter?: number;
  7852. /**
  7853. * minFilter,值为数字,见{@link EFilterMode}。
  7854. * 默认值依据纹理是否POT而定。
  7855. */
  7856. minFilter?: number;
  7857. /**
  7858. * 是否要生成mipmaps。
  7859. * @default false
  7860. */
  7861. generateMipmaps?: boolean;
  7862. }
  7863. type ICubeTextureLoadData = IAssetLoadData<ICubeTextureLoaderOptions>;
  7864. /**
  7865. * 立方体资源{@link CubeTexture}的加载器。
  7866. *
  7867. * 内置资源可以通过{@link registerTextureCube}注册,拥有内置资源`brdf-lut`、`white`、`transparent`、`black`、`red`、`green`、`blue`、`yellow`。
  7868. */
  7869. export default class CubeTextureLoader extends AssetLoader<Kanata.Texture, ICubeTextureLoaderOptions> {
  7870. /**
  7871. * 详见{@link ICubeTextureLoaderOptions}。
  7872. */
  7873. readonly schema: ILoaderOptionsSchema;
  7874. load(params: ICubeTextureLoadData, callbacks: {
  7875. onLoading(progress: number): void;
  7876. onLoaded(value: Kanata.Texture): void;
  7877. onError(error: Error): void;
  7878. }): void;
  7879. release(params: ICubeTextureLoadData, value: Kanata.Texture): void;
  7880. }
  7881. export {};
  7882. }
  7883. declare module 'XrFrame/loader/VideoTextureLoader' {
  7884. /**
  7885. * VideoTextureLoader.ts
  7886. *
  7887. * * @Date : 8/26/2022, 8:02:51 PM
  7888. */
  7889. import VideoTexture from 'XrFrame/assets/VideoTexture';
  7890. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7891. import { IAssetLoadData } from 'XrFrame/loader/types';
  7892. /**
  7893. * {@link VideoTextureLoader}可接受的自定义参数`schema`。
  7894. *
  7895. * 基本同{@link IVideoTextureOptions}。
  7896. */
  7897. export interface IVideoTextureLoaderOptions {
  7898. anisoLevel: number;
  7899. placeHolder?: string;
  7900. autoPlay?: boolean;
  7901. loop?: boolean;
  7902. abortAudio?: boolean;
  7903. }
  7904. type IVideoTextureLoadData = IAssetLoadData<IVideoTextureLoaderOptions>;
  7905. /**
  7906. * 视频纹理资源{@link VideoTexture}的加载器。
  7907. */
  7908. export default class VideoTextureLoader extends AssetLoader<VideoTexture, IVideoTextureLoaderOptions> {
  7909. /**
  7910. * 详见{@link IVideoTextureLoaderOptions}。
  7911. */
  7912. readonly schema: ILoaderOptionsSchema;
  7913. load(params: IVideoTextureLoadData, callbacks: {
  7914. onLoading(progress: number): void;
  7915. onLoaded(value: VideoTexture): void;
  7916. onError(error: Error): void;
  7917. }): Promise<void>;
  7918. release(params: IVideoTextureLoadData, value: VideoTexture): void;
  7919. }
  7920. export {};
  7921. }
  7922. declare module 'XrFrame/loader/EnvDataLoader' {
  7923. /**
  7924. * EnvDataLoader.ts
  7925. *
  7926. * * @Date : 5/10/2022, 11:27:49 AM
  7927. */
  7928. import EnvData from 'XrFrame/assets/EnvData';
  7929. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7930. import { IAssetLoadData } from 'XrFrame/loader/types';
  7931. interface IBufferSlice {
  7932. offset: number;
  7933. length: number;
  7934. type: string;
  7935. }
  7936. export interface IEnvDataSource {
  7937. skybox?: {
  7938. type: '2D' | 'Cube';
  7939. half: boolean;
  7940. map: (string | string[]) | IBufferSlice;
  7941. };
  7942. diffuse?: {
  7943. coefficients: number[][];
  7944. };
  7945. specular?: {
  7946. type: '2D';
  7947. rgbd: boolean;
  7948. mipmaps: boolean;
  7949. mipmapCount?: number;
  7950. map: string | IBufferSlice;
  7951. };
  7952. }
  7953. export interface IEnvDataLoaderOptions {
  7954. }
  7955. type IEnvDataLoadData = IAssetLoadData<IEnvDataLoaderOptions>;
  7956. /**
  7957. * 环境数据资源{@link EnvData}的加载器。
  7958. *
  7959. * 拥有内置资源`xr-frame-team-workspace-day`、`xr-frame-team-workspace-night`以及`xr-frame-team-workspace-day2`。
  7960. * 加载的资源一般由[xr-frame-cli](https://github.com/wechat-miniprogram/xr-frame-cli)生成。
  7961. */
  7962. export default class EnvDataLoader extends AssetLoader<EnvData, IEnvDataLoaderOptions> {
  7963. readonly schema: ILoaderOptionsSchema;
  7964. load(params: IEnvDataLoadData, callbacks: {
  7965. onLoading(progress: number): void;
  7966. onLoaded(value: EnvData): void;
  7967. onError(error: Error): void;
  7968. }): Promise<void>;
  7969. getBuiltin(): {
  7970. assetId: string;
  7971. src: string;
  7972. options: IEnvDataLoaderOptions;
  7973. }[];
  7974. release(params: IEnvDataLoadData, value: EnvData): void;
  7975. }
  7976. export {};
  7977. }
  7978. declare module 'XrFrame/loader/GlTFLoader' {
  7979. /**
  7980. * GLTFLoader.ts
  7981. *
  7982. * * @Date : 2022/3/16下午3:47:56
  7983. */
  7984. import GLTFModel from 'XrFrame/assets/GLTFModel';
  7985. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  7986. import { IAssetLoadData } from 'XrFrame/loader/types';
  7987. import { Scene } from 'XrFrame/elements';
  7988. export enum GLBChunkType {
  7989. JSON = 1313821514,
  7990. BIN = 5130562
  7991. }
  7992. export interface IGLTFLoaderOptions {
  7993. ignoreTextureError?: boolean;
  7994. }
  7995. type IGLTFLoadData = IAssetLoadData<IGLTFLoaderOptions>;
  7996. /**
  7997. * GLTF资源加载器,加载完毕后返回一个{@link GLTFModel}。
  7998. */
  7999. export default class GLTFLoader extends AssetLoader<GLTFModel, IGLTFLoaderOptions> {
  8000. readonly schema: ILoaderOptionsSchema;
  8001. load(params: IGLTFLoadData, callbacks: {
  8002. onLoading(progress: number): void;
  8003. onLoaded(value: GLTFModel): void;
  8004. onError(error: Error): void;
  8005. }): Promise<void>;
  8006. cancel(params: IGLTFLoadData): void;
  8007. release(params: IGLTFLoadData, value: GLTFModel): void;
  8008. /**
  8009. * @internal
  8010. */
  8011. static createGLTFModel(scene: Scene, buffer: ArrayBuffer, src?: string, onLoading?: (progress: number) => void): Promise<GLTFModel>;
  8012. }
  8013. export {};
  8014. }
  8015. declare module 'XrFrame/loader/KeyframeLoader' {
  8016. /**
  8017. * KeyframeLoader.ts
  8018. *
  8019. * * @Date : 6/21/2022, 6:48:33 PM
  8020. */
  8021. import KeyframeAnimation from 'XrFrame/animation/KeyframeAnimation';
  8022. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  8023. import { IAssetLoadData } from 'XrFrame/loader/types';
  8024. export interface IKeyframeLoaderOptions {
  8025. }
  8026. type IKeyframeLoadData = IAssetLoadData<IKeyframeLoaderOptions>;
  8027. /**
  8028. * 帧动画资源{@link KeyframeAnimation}的加载器。
  8029. */
  8030. export default class KeyframeLoader extends AssetLoader<KeyframeAnimation, IKeyframeLoaderOptions> {
  8031. readonly schema: ILoaderOptionsSchema;
  8032. load(params: IKeyframeLoadData, callbacks: {
  8033. onLoading(progress: number): void;
  8034. onLoaded(value: KeyframeAnimation): void;
  8035. onError(error: Error): void;
  8036. }): Promise<void>;
  8037. }
  8038. export {};
  8039. }
  8040. declare module 'XrFrame/loader/RawLoader' {
  8041. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  8042. import { IAssetLoadData } from 'XrFrame/loader/types';
  8043. /**
  8044. * 原始数据加载器的参数。
  8045. */
  8046. export interface IRawLoaderOptions {
  8047. /**
  8048. * 编码,默认为`binary`。
  8049. */
  8050. encoding?: 'binary' | 'utf-8';
  8051. }
  8052. type IRawLoadData = IAssetLoadData<IRawLoaderOptions>;
  8053. /**
  8054. * 原始数据的加载器。
  8055. */
  8056. export default class RawLoader extends AssetLoader<string | ArrayBuffer, IRawLoaderOptions> {
  8057. readonly schema: ILoaderOptionsSchema;
  8058. load(params: IRawLoadData, callbacks: {
  8059. onLoading(progress: number): void;
  8060. onLoaded(value: string | ArrayBuffer): void;
  8061. onError(error: Error): void;
  8062. }): Promise<void>;
  8063. }
  8064. export {};
  8065. }
  8066. declare module 'XrFrame/loader/AtlasLoader' {
  8067. /**
  8068. * AtlasLoader.ts
  8069. *
  8070. * * @Date : 10/13/2022, 5:35:00 PM
  8071. */
  8072. import Atlas from 'XrFrame/assets/Atlas';
  8073. import AssetLoader, { ILoaderOptionsSchema } from 'XrFrame/loader/AssetLoader';
  8074. import { IAssetLoadData } from 'XrFrame/loader/types';
  8075. export interface IAtlasSource {
  8076. meta: {
  8077. image: string;
  8078. size: {
  8079. w: number;
  8080. h: number;
  8081. };
  8082. };
  8083. frames: {
  8084. [key: string]: {
  8085. frame: {
  8086. x: number;
  8087. y: number;
  8088. w: number;
  8089. h: number;
  8090. };
  8091. spriteSourceSize: {
  8092. x: number;
  8093. y: number;
  8094. w: number;
  8095. h: number;
  8096. };
  8097. sourceSize: {
  8098. w: number;
  8099. h: number;
  8100. };
  8101. };
  8102. };
  8103. }
  8104. export interface IAtlasLoaderOptions {
  8105. }
  8106. type IAtlasLoadData = IAssetLoadData<IAtlasLoaderOptions>;
  8107. /**
  8108. * 图集资源{@link Atlas}的加载器。
  8109. * @version 2.27.1
  8110. *
  8111. * 推荐使用[Shoebox](https://www.renderhjs.net/shoebox/)生成。
  8112. */
  8113. export default class AtlasLoader extends AssetLoader<Atlas, IAtlasLoaderOptions> {
  8114. readonly schema: ILoaderOptionsSchema;
  8115. load(params: IAtlasLoadData, callbacks: {
  8116. onLoading(progress: number): void;
  8117. onLoaded(value: Atlas): void;
  8118. onError(error: Error): void;
  8119. }): Promise<void>;
  8120. getBuiltin(): {
  8121. assetId: string;
  8122. src: string;
  8123. options: IAtlasLoaderOptions;
  8124. }[];
  8125. }
  8126. export {};
  8127. }
  8128. declare module 'XrFrame/loader/types' {
  8129. /**
  8130. * types.ts
  8131. *
  8132. * * @Date : 2022/4/1下午2:19:33
  8133. */
  8134. type Assets = import('XrFrame/components/Assets').default;
  8135. export function isAsset(value: any): value is IAssetWithState<any>;
  8136. export enum EAssetState {
  8137. Undefined = 0,
  8138. Defer = 1,
  8139. Loading = 2,
  8140. Existed = 3
  8141. }
  8142. export interface IAssetWithState<T> {
  8143. __isAsset: boolean;
  8144. __params?: IAssetLoadData;
  8145. __group?: Assets;
  8146. value?: T;
  8147. state: EAssetState;
  8148. promise?: Promise<IAssetWithState<T>>;
  8149. }
  8150. /**
  8151. * {@link AssetLoad}组件数据接口。
  8152. */
  8153. export interface IAssetLoadData<T = any> {
  8154. /**
  8155. * 资源类型,必须是使用{@link registerAssetLoader}中注册过的类型。
  8156. * `xml`中数据为`string`类型。
  8157. */
  8158. type: string;
  8159. /**
  8160. * 资源Id。
  8161. * `xml`中数据为`string`类型。
  8162. */
  8163. assetId: string;
  8164. /**
  8165. * 资源地址。
  8166. * `xml`中数据为`string`类型。
  8167. */
  8168. src: string;
  8169. /**
  8170. * 资源权重,用于在同一批加载的资源的`progress`事件中计算进度,详见{@link Assets}。
  8171. * `xml`中数据为`number`类型。
  8172. */
  8173. weight?: number;
  8174. /**
  8175. * 资源追加配置,视资源类型而定。
  8176. * `xml`中数据为`dict`类型。
  8177. */
  8178. options: T;
  8179. /**
  8180. * 是否要按需延迟加载,如果开启,则只有在资源被实际引用时才会被加载。
  8181. * `xml`中数据为`boolean`类型。
  8182. */
  8183. defer?: boolean;
  8184. /**
  8185. * @internal
  8186. */
  8187. canceled?: boolean;
  8188. /**
  8189. * @internal
  8190. */
  8191. startTs?: number;
  8192. /**
  8193. * 加载时长(s),仅用于统计。
  8194. */
  8195. duration?: number;
  8196. /**
  8197. * 当前加载进度。
  8198. */
  8199. progress?: number;
  8200. }
  8201. export {};
  8202. }
  8203. declare module 'XrFrame/animation/NativeAnimation' {
  8204. import { Kanata } from "XrFrame/ext";
  8205. import Animation, { TDirection } from "XrFrame/animation/Animation";
  8206. import Element from "XrFrame/core/Element";
  8207. export enum ENativeAnimationSimulatorType {
  8208. None = 0,
  8209. Morph = 1
  8210. }
  8211. export interface INativeAnimationData {
  8212. clip: Kanata.AnimationClipModel;
  8213. bindings: Array<Kanata.Entity3D>;
  8214. frameCount: number;
  8215. names: string[];
  8216. simulators?: Array<{
  8217. type: ENativeAnimationSimulatorType;
  8218. target: Element;
  8219. subElements: Array<Element>;
  8220. }>;
  8221. }
  8222. export const DefaultNativeAnimationFPS = 60;
  8223. /**
  8224. * 使用客户端加速的动画片段,通常由gltf实例化而来,仅供内部使用。
  8225. */
  8226. export default class NativeAnimation extends Animation<INativeAnimationData> {
  8227. onInit(data: INativeAnimationData): void;
  8228. onPlay(el: Element, clipName: string, options: any): {
  8229. duration: number;
  8230. loop?: number;
  8231. delay?: number;
  8232. direction?: TDirection;
  8233. };
  8234. onUpdate(el: Element, progress: number, reverse: boolean): void;
  8235. }
  8236. }
  8237. declare module 'XrFrame/loader/glTF/GLTFRootNode' {
  8238. import { GLTFAnimationsLoaded, GLTFAnimationsNodeRaw } from "XrFrame/loader/glTF/animations/GLTFAnimationsNode";
  8239. import { GLTFAccessorsNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  8240. import { GLTFBuffersNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFBuffersNode";
  8241. import { GLTFBufferViewsNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFBufferViewsNode";
  8242. import { GLTFExtensionsProfiles } from "XrFrame/loader/glTF/extensions/GLTFExtensions";
  8243. import { GLTFMeshesLoaded, GLTFMeshesNodeRaw } from "XrFrame/loader/glTF/geometry/GLTFMeshesNode";
  8244. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  8245. import { GLTFMaterialsLoaded, GLTFMaterialsNodeRaw } from "XrFrame/loader/glTF/materials/GLTFMaterialsNode";
  8246. import GLTFNodesNode, { GLTFNodesLoaded, GLTFNodesNodeRaw } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  8247. import { GLTFSceneLoaded } from "XrFrame/loader/glTF/scenes/GLTFSceneNode";
  8248. import { GLTFScenesLoaded, GLTFScenesNodeRaw } from "XrFrame/loader/glTF/scenes/GLTFScenesNode";
  8249. import { GLTFSkinsLoaded, GLTFSkinsNodeRaw } from "XrFrame/loader/glTF/skins/GLTFSkinsNode";
  8250. import { GLTFImagesNodeRaw } from "XrFrame/loader/glTF/textures/GLTFImagesNode";
  8251. import { GLTFSamplersLoaded, GLTFSamplersNodeRaw } from "XrFrame/loader/glTF/textures/GLTFSamplersNode";
  8252. import { GLTFTexturesLoaded, GLTFTexturesNodeRaw } from "XrFrame/loader/glTF/textures/GLTFTexturesNode";
  8253. type Scene = import('XrFrame/core/Scene').default;
  8254. export interface GLTFRootNodeRaw {
  8255. buffers?: GLTFBuffersNodeRaw;
  8256. bufferViews?: GLTFBufferViewsNodeRaw;
  8257. accessors?: GLTFAccessorsNodeRaw;
  8258. images?: GLTFImagesNodeRaw;
  8259. samplers?: GLTFSamplersNodeRaw;
  8260. textures?: GLTFTexturesNodeRaw;
  8261. materials?: GLTFMaterialsNodeRaw;
  8262. meshes?: GLTFMeshesNodeRaw;
  8263. nodes?: GLTFNodesNodeRaw;
  8264. scenes?: GLTFScenesNodeRaw;
  8265. skins?: GLTFSkinsNodeRaw;
  8266. animations?: GLTFAnimationsNodeRaw;
  8267. scene?: number;
  8268. extensions?: object;
  8269. extensionsRequired?: Array<string>;
  8270. extensionsUsed?: Array<string>;
  8271. }
  8272. export interface GLTFRootLoaded {
  8273. samplers: GLTFSamplersLoaded;
  8274. textures: GLTFTexturesLoaded;
  8275. materials: GLTFMaterialsLoaded;
  8276. meshes: GLTFMeshesLoaded;
  8277. nodes: GLTFNodesLoaded;
  8278. scenes: GLTFScenesLoaded;
  8279. scene: GLTFSceneLoaded;
  8280. skins: GLTFSkinsLoaded;
  8281. animations: GLTFAnimationsLoaded;
  8282. }
  8283. export interface GLTFDesc {
  8284. raw: object;
  8285. scene: Scene;
  8286. uri?: string;
  8287. extensionProfiles?: GLTFExtensionsProfiles;
  8288. defaultBinary?: ArrayBuffer;
  8289. }
  8290. export default class GLTFRootNode extends GLTFBaseNode {
  8291. get nodeName(): string;
  8292. readonly raw: GLTFRootNodeRaw;
  8293. readonly uri: string;
  8294. readonly defaultBinary: ArrayBuffer | null;
  8295. nodesNode: GLTFNodesNode | undefined;
  8296. constructor(desc: GLTFDesc);
  8297. build(): void;
  8298. preload(reportProgress?: (progress: number) => void): Promise<GLTFRootLoaded>;
  8299. getLoadedResource(): GLTFRootLoaded;
  8300. getNodesByPath(path: string): Array<GLTFBaseNode>;
  8301. getRootExtensionRaw(extName: string): object | undefined;
  8302. /**
  8303. * 在preload完之后可以调用这个函数,会把原始buffer的引用都释放掉。
  8304. * 每个子节点的raw也会释放掉(以防数据是dataURI的形式)。
  8305. */
  8306. releaseRawBuffer(): void;
  8307. }
  8308. export {};
  8309. }
  8310. declare module 'XrFrame/loader/glTF/scenes/GLTFNodesNode' {
  8311. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  8312. import GLTFNodeNode, { GLTFNodeLoaded, GLTFNodeNodeRaw, GLTFNodePrerequisites } from "XrFrame/loader/glTF/scenes/GLTFNodeNode";
  8313. type ChildNode = GLTFNodeNode;
  8314. export type GLTFNodesNodeRaw = Array<GLTFNodesNodeRaw>;
  8315. export type GLTFTreeNode = {
  8316. data: GLTFNodeLoaded;
  8317. children: Array<GLTFTreeNode>;
  8318. parent: GLTFTreeNode | null;
  8319. index: number;
  8320. extension?: object;
  8321. };
  8322. export type GLTFNodesLoaded = Array<GLTFTreeNode>;
  8323. export default class GLTFNodesNode extends GLTFArrayNode<ChildNode> {
  8324. ChildCtor(childRaw: GLTFNodeNodeRaw): GLTFNodeNode;
  8325. readonly raw: GLTFNodesNodeRaw;
  8326. get nodeName(): string;
  8327. res: GLTFNodesLoaded;
  8328. preload(prerequisites: GLTFNodePrerequisites): Promise<GLTFNodesLoaded>;
  8329. getLoadedResource(): GLTFNodesLoaded;
  8330. }
  8331. export {};
  8332. }
  8333. declare module 'XrFrame/kanata/lib/frontend' {
  8334. import MeshRendererComponent from 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent';
  8335. import renderEnv from 'XrFrame/kanata/lib/frontend/resource/renderEnv';
  8336. export { RenderEnv } from 'XrFrame/kanata/lib/frontend/resource/renderEnv';
  8337. export { default as AnimatorComponent } from 'XrFrame/kanata/lib/frontend/component/AnimatorComponent';
  8338. export { default as CameraComponent } from 'XrFrame/kanata/lib/frontend/component/CameraComponent';
  8339. export { default as LightCameraComponent } from 'XrFrame/kanata/lib/frontend/component/LightCameraComponent';
  8340. export { default as CullingComponent } from 'XrFrame/kanata/lib/frontend/component/CullingComponent';
  8341. export { default as MeshRendererComponent } from 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent';
  8342. export { default as SkinnedSkeletonComponent } from 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent';
  8343. export { default as DynamicBonesComponent } from 'XrFrame/kanata/lib/frontend/component/DynamicBonesComponent';
  8344. export { default as Entity2D } from 'XrFrame/kanata/lib/frontend/entity/Entity2D';
  8345. export { default as Entity3D } from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  8346. export { default as AnimationClipModel } from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel';
  8347. export { default as AnimationClipBinding } from 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding';
  8348. export { default as AnimatorControllerModel } from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerModel';
  8349. export { default as AnimatorControllerStateModel } from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel';
  8350. export { default as DataBuffer } from 'XrFrame/kanata/lib/frontend/resource/DataBuffer';
  8351. export { default as DataModel } from 'XrFrame/kanata/lib/frontend/resource/DataModel';
  8352. export { default as Effect } from 'XrFrame/kanata/lib/frontend/resource/Effect';
  8353. export { default as Material } from 'XrFrame/kanata/lib/frontend/resource/Material';
  8354. export { default as RenderPass, IRenderPassOptions } from 'XrFrame/kanata/lib/frontend/resource/RenderPass';
  8355. export { default as SkeletonBoneInverseModel } from 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel';
  8356. export { default as Texture, ITextureOptions } from 'XrFrame/kanata/lib/frontend/resource/Texture';
  8357. export { default as UniformBlock } from 'XrFrame/kanata/lib/frontend/resource/UniformBlock';
  8358. export { default as UniformDescriptor } from 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor';
  8359. export { default as IndexBuffer } from 'XrFrame/kanata/lib/frontend/resource/IndexBuffer';
  8360. export { default as IndexData } from 'XrFrame/kanata/lib/frontend/resource/IndexData';
  8361. export { default as VertexBuffer } from 'XrFrame/kanata/lib/frontend/resource/VertexBuffer';
  8362. export { default as VertexData } from 'XrFrame/kanata/lib/frontend/resource/VertexData';
  8363. export { default as VertexLayout } from 'XrFrame/kanata/lib/frontend/resource/VertexLayout';
  8364. export { default as VertexDataDescriptor } from 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor';
  8365. export { default as View } from 'XrFrame/kanata/lib/frontend/resource/View';
  8366. export { default as ScalableList } from 'XrFrame/kanata/lib/frontend/resource/ScalableList';
  8367. export { default as crossContext } from 'XrFrame/kanata/lib/frontend/shared/crossContext';
  8368. const IS_VALID: () => boolean, GET_MAIN_CANVAS: () => HTMLCanvasElement, Image: {
  8369. new (): import('XrFrame/kanata/lib/backend').IImage;
  8370. IS(obj: any): obj is import('XrFrame/kanata/lib/backend').IImage;
  8371. }, Phys3D: any;
  8372. const downloader: import('XrFrame/kanata/lib/backend').IDownloader;
  8373. export { renderEnv };
  8374. export { Image, downloader as Downloader, IS_VALID, GET_MAIN_CANVAS, Phys3D };
  8375. export const createWeakRef: <T>(wrapper: T) => {
  8376. deref: () => T;
  8377. };
  8378. export const createWeakRefSentry: () => any;
  8379. export const createNativeUUMap: () => import('XrFrame/kanata/lib/backend').INativeMap<number>;
  8380. export const createNativeSUMap: () => import('XrFrame/kanata/lib/backend').INativeMap<string>;
  8381. export const createNativeULUMap: () => import('XrFrame/kanata/lib/backend').ILongIntNativeMap;
  8382. export const loadTTFFont: (url: string, callback: (font: string) => void) => void;
  8383. export const getGlyphInfo: (fontSetting: import('XrFrame/kanata/lib/backend').IFontSetting, charCode: number) => import('XrFrame/kanata/lib/backend').IGlyphInfo;
  8384. export const refreshNodesWorldTransform: () => void;
  8385. export const setGlobalPhysicSystem: (system: any) => void;
  8386. export const bindRigidBodyToNode: (rigidBody: any, nodeId: number) => void;
  8387. export const bindCCTToNode: (cc: any, nodeId: number) => void;
  8388. export const unbindRigidBody: (rigidBody: any) => void;
  8389. export const unbindCCT: (cc: any) => void;
  8390. export const decodeBase64: (base64: string) => ArrayBuffer;
  8391. export function destroy(): void;
  8392. export function update(delta: number): void;
  8393. export const setNodeName: (id: number, name: string) => void;
  8394. export const setRenderComponentName: (comp: MeshRendererComponent, name: string) => void;
  8395. export const debugPrint: (msg: string) => void;
  8396. export const eventBridge: {
  8397. bindEntityToBone: any;
  8398. unbindEntityFromBone: any;
  8399. bindEntitiesToBones: any;
  8400. unbindEntitiesFromBones: any;
  8401. };
  8402. }
  8403. declare module 'XrFrame/kanata/lib/backend/interface' {
  8404. /**
  8405. * index.ts
  8406. *
  8407. * * @Date : 2020/8/18 下午4:48:36
  8408. */
  8409. export interface IEngineSettings {
  8410. /** log过滤器 */
  8411. logFilter: boolean;
  8412. /** log等级 */
  8413. logLevel: string;
  8414. /** 最大缓存极限 */
  8415. cacheSizeLimit: number;
  8416. /** 是否开启MSAA */
  8417. realSizeLimit: number;
  8418. /** 设计分辨率宽 */
  8419. designWidth: number;
  8420. /** 设计分辨率高 */
  8421. designHeight: number;
  8422. /** 渲染分辨率宽 */
  8423. renderWidth: number;
  8424. /** 渲染分辨率高 */
  8425. renderHeight: number;
  8426. /** 是否开启MSAA */
  8427. mainScreenMSAA: boolean;
  8428. /** loader下载文件的默认根路径 */
  8429. baseURL: string;
  8430. /** 如果baseURL找不到并且重试次数`globalHTTPRetry`大于0,则会依次尝试使用 */
  8431. backupURLs: string[];
  8432. /** 全局loader下载文件重试次数 */
  8433. globalHTTPRetry: string;
  8434. /** 物理引擎的重力 */
  8435. gravity: number;
  8436. /** 物理引擎的模拟步进固定间隔 */
  8437. fixedDeltaTime: number;
  8438. useEngineSubcontext: boolean;
  8439. /** 物理碰撞矩阵,以十六进制字符串表示 */
  8440. physics3DLayerCollisionMatrix: string;
  8441. /** 拼缓存的文件名的 */
  8442. cacheDelimiter: string;
  8443. /** 自动生成的worker文件入口路径 */
  8444. workerPath: string;
  8445. /** worker执行任务超时时间 */
  8446. workerTimeout: number;
  8447. gfxIgnoreAssert: boolean;
  8448. profileGfx: string;
  8449. /** 全局Uniform定义 */
  8450. shaderGlobalProperties: {
  8451. key: string;
  8452. type: 'Float' | 'Vector2' | 'Vector3' | 'Vector4' | 'Matrix4' | 'Texture';
  8453. default: number | number[] | string;
  8454. }[];
  8455. /** 音频全局定义 */
  8456. audio?: {
  8457. /** 全局音量 */
  8458. globalVolume?: number;
  8459. /** 真实音频数量上限 */
  8460. maxRealVoices?: number;
  8461. };
  8462. }
  8463. /**
  8464. * 顶点数据格式枚举。
  8465. */
  8466. export enum EVertexFormat {
  8467. FLOAT = 0,
  8468. FLOAT2 = 1,
  8469. FLOAT3 = 2,
  8470. FLOAT4 = 3,
  8471. BYTE4 = 4,
  8472. BYTE4N = 5,
  8473. UBYTE4 = 6,
  8474. UBYTE4N = 7,
  8475. SHORT2 = 8,
  8476. SHORT2N = 9,
  8477. SHORT4 = 10,
  8478. SHORT4N = 11,
  8479. UINT10_N2 = 12
  8480. }
  8481. /**
  8482. * 顶点数据步进类型枚举。
  8483. */
  8484. export enum EVertexStep {
  8485. /**
  8486. * 逐顶点。
  8487. */
  8488. PER_VERTEX = 0,
  8489. /**
  8490. * 在使用Instance的情况下,逐实例。
  8491. */
  8492. PER_INSTANCE = 1
  8493. }
  8494. /**
  8495. * 索引数据类型。
  8496. */
  8497. export enum EIndexType {
  8498. /**
  8499. * 无效值。
  8500. */
  8501. NONE = 1,
  8502. /**
  8503. * 16位索引。
  8504. */
  8505. UINT16 = 2,
  8506. /**
  8507. * 32位索引,注意在某些设备上不支持。
  8508. */
  8509. UINT32 = 3
  8510. }
  8511. /**
  8512. * 压缩纹理类型。
  8513. */
  8514. export type TCompressTexture = 'etc1' | 'etc2' | 'astc' | 'pvrtc' | 's3tc';
  8515. /**
  8516. * 纹理类型雷剧。
  8517. */
  8518. export enum ETextureType {
  8519. /**
  8520. * 2D纹理。
  8521. */
  8522. D2 = 0,
  8523. /**
  8524. * 立方体纹理。
  8525. */
  8526. Cube = 1,
  8527. /**
  8528. * 2D纹理数组。
  8529. */
  8530. D2Array = 2,
  8531. /**
  8532. * 3D纹理。
  8533. */
  8534. D3 = 3
  8535. }
  8536. /**
  8537. * 纹理格式枚举。
  8538. */
  8539. export enum ETextureFormat {
  8540. /** Inputs or Render Target Formats. */
  8541. RGBA8 = 0,
  8542. SRGBA8 = 1,
  8543. RGB10A2 = 2,
  8544. RG8 = 3,
  8545. R8 = 4,
  8546. RGBA32F = 5,
  8547. RGBA16F = 6,
  8548. RG11B10F = 7,
  8549. /** Render Target Only. */
  8550. Depth_Low = 20,
  8551. Depth_High = 21,
  8552. Depth_Stencil = 22,
  8553. RGBA4 = 23,
  8554. RGB565 = 24,
  8555. RGB5A1 = 25,
  8556. /** Compresseds */
  8557. ETC1RGB8 = 100,
  8558. ETC2RGB8 = 110,
  8559. ETC2RGBA8 = 111,
  8560. PVRTC2RGBV1 = 120,
  8561. PVRTC4RGBV1 = 121,
  8562. PVRTC2RGBAV1 = 122,
  8563. PVRTC4RGBAV1 = 123,
  8564. ASTC4x4 = 140,
  8565. ASTC5x5 = 141,
  8566. ASTC6x6 = 142,
  8567. ASTC8x6 = 143,
  8568. ASTC8x8 = 144,
  8569. DXT1 = 150,
  8570. DXT3 = 151,
  8571. DXT5 = 152
  8572. }
  8573. /**
  8574. * 纹理寻址模式枚举。
  8575. */
  8576. export enum EWrapMode {
  8577. REPEAT = 1,
  8578. CLAMP_TO_EDGE = 2,
  8579. MIRRORED_REPEAT = 3
  8580. }
  8581. /**
  8582. * 纹理过滤模式枚举。
  8583. */
  8584. export enum EFilterMode {
  8585. NEAREST = 1,
  8586. LINEAR = 2,
  8587. NEAREST_MIPMAP_NEAREST = 3,
  8588. NEAREST_MIPMAP_LINEAR = 4,
  8589. LINEAR_MIPMAP_NEAREST = 5,
  8590. LINEAR_MIPMAP_LINEAR = 6
  8591. }
  8592. /**
  8593. * Uniform值得类型枚举。
  8594. */
  8595. export enum EUniformType {
  8596. FLOAT = 0,
  8597. FLOAT2 = 1,
  8598. FLOAT3 = 2,
  8599. FLOAT4 = 3,
  8600. MAT2 = 4,
  8601. MAT3 = 5,
  8602. MAT4 = 6,
  8603. SAMPLER = 7
  8604. }
  8605. /**
  8606. * 背面剔除类型枚举。
  8607. */
  8608. export enum ECullMode {
  8609. NONE = 0,
  8610. FRONT = 1,
  8611. BACK = 2
  8612. }
  8613. /**
  8614. * 正面顶点绕序枚举。
  8615. */
  8616. export enum EFaceWinding {
  8617. CCW = 1,
  8618. CW = 2
  8619. }
  8620. /**
  8621. * 各种测试的比较函数枚举。
  8622. */
  8623. export enum ECompareFunc {
  8624. LESS = 1,
  8625. LEQUAL = 2,
  8626. EQUAL = 3,
  8627. GEQUAL = 4,
  8628. GREATER = 5,
  8629. NOTEQUAL = 6,
  8630. NEVER = 7,
  8631. ALWAYS = 8
  8632. }
  8633. /**
  8634. * 模板测试操作枚举。
  8635. */
  8636. export enum EStencilOp {
  8637. ZERO = 0,
  8638. KEEP = 1,
  8639. REPLACE = 2,
  8640. INCR_WRAP = 3,
  8641. INCR = 4,
  8642. DECR_WRAP = 5,
  8643. DECR = 6,
  8644. INVERT = 7
  8645. }
  8646. /**
  8647. * 混合因子枚举。
  8648. */
  8649. export enum EBlendFactor {
  8650. ZERO = 0,
  8651. ONE = 1,
  8652. SRC_COLOR = 2,
  8653. ONE_MINUS_SRC_COLOR = 3,
  8654. SRC_ALPHA = 4,
  8655. ONE_MINUS_SRC_ALPHA = 5,
  8656. DST_ALPHA = 6,
  8657. ONE_MINUS_DST_ALPHA = 7,
  8658. DST_COLOR = 8,
  8659. ONE_MINUS_DST_COLOR = 9,
  8660. SRC_ALPHA_SATURATE = 10,
  8661. CONSTANT_COLOR = 11,
  8662. ONE_MINUS_CONSTANT_COLOR = 12
  8663. }
  8664. /**
  8665. * 混合方式枚举。
  8666. */
  8667. export enum EBlendEquation {
  8668. FUNC_ADD = 0,
  8669. FUNC_SUBTRACT = 1,
  8670. FUNC_REVERSE_SUBTRACT = 2,
  8671. MIN = 3,
  8672. MAX = 4
  8673. }
  8674. /**
  8675. * 颜色通道掩码枚举。
  8676. */
  8677. export enum EColorMask {
  8678. /**
  8679. * 将会禁掉所有通道的输出。
  8680. */
  8681. NONE = 16,
  8682. R = 1,
  8683. G = 2,
  8684. B = 4,
  8685. A = 8,
  8686. RGB = 7,
  8687. RGBA = 15
  8688. }
  8689. /**
  8690. * 像素数据类型枚举。
  8691. */
  8692. export enum EPixelType {
  8693. UNSIGNED_BYTE = 5121,
  8694. FLOAT = 5126,
  8695. UNSIGNED_SHORT_5_6_5 = 33635,
  8696. UNSIGNED_SHORT_4_4_4_4 = 32819,
  8697. UNSIGNED_SHORT_5_5_5_1 = 32820
  8698. }
  8699. /**
  8700. * 清屏操作枚举。
  8701. */
  8702. export enum ELoadAction {
  8703. /**
  8704. * 清除屏幕颜色。
  8705. */
  8706. CLEAR = 0,
  8707. /**
  8708. * 不清屏,但依赖前面渲染的结果。
  8709. */
  8710. LOAD = 1,
  8711. /**
  8712. * 完全不关心是否清屏。
  8713. */
  8714. DONTCARE = 2
  8715. }
  8716. export enum EDataModelType {
  8717. AnimationClip = 1,
  8718. SkeletonBoneInverse = 2
  8719. }
  8720. /**
  8721. * 渲染组件类型枚举。
  8722. */
  8723. export enum EMeshRenderType {
  8724. /**
  8725. * 未知类型。
  8726. */
  8727. UnKnown = 0,
  8728. /**
  8729. * 静态3D类型。
  8730. */
  8731. Static3D = 1,
  8732. /**
  8733. * 蒙皮3D类型。
  8734. */
  8735. Skinned3D = 2,
  8736. /**
  8737. * UI类型。
  8738. */
  8739. UI = 3
  8740. }
  8741. /**
  8742. * 图元渲染类型枚举。
  8743. */
  8744. export enum EPrimitiveType {
  8745. TRIANGLES = 0,
  8746. TRIANGLE_STRIP = 1,
  8747. LINES = 2,
  8748. LINE_STRIP = 3,
  8749. POINTS = 4,
  8750. ZERO = 5
  8751. }
  8752. /**
  8753. * 阴影类型枚举。
  8754. */
  8755. export enum EShadowMode {
  8756. /**
  8757. * 关闭阴影。
  8758. */
  8759. None = 0,
  8760. /**
  8761. * 开启单级联阴影,并开启PCF。
  8762. */
  8763. OneCascade_PCF = 1,
  8764. /**
  8765. * 开启二级联阴影,并开启PCF。
  8766. */
  8767. TwoCascade_PCF = 2,
  8768. /**
  8769. * 开启四级联阴影,并开启PCF。
  8770. */
  8771. FourCascade_PCF = 4,
  8772. /**
  8773. * 开启单级联阴影,并开启PCSS。
  8774. */
  8775. PCSS = 5
  8776. }
  8777. /**
  8778. * 阴影匹配类型枚举。
  8779. */
  8780. export enum EShadowFitMode {
  8781. /**
  8782. * 阴影范围适配视锥体。
  8783. * 更稳定,可能降低阴影精度。
  8784. */
  8785. FitFrustum = 0,
  8786. /**
  8787. * 阴影范围适配物体。
  8788. * 能提高阴影精度,但可能会导致阴影不稳定。
  8789. */
  8790. FitObjects = 1
  8791. }
  8792. /**
  8793. * 顶点数据布局用途枚举。
  8794. */
  8795. export enum EVertexLayoutUsage {
  8796. CUSTOM = 0,
  8797. POSITION = 1,
  8798. NORMAL = 2,
  8799. TANGENT = 3,
  8800. UV0 = 4,
  8801. UV1 = 5,
  8802. UV2 = 6,
  8803. COLOR = 7,
  8804. BONEINDEX = 8,
  8805. BONEWEIGHT = 9
  8806. }
  8807. /**
  8808. * 动态合批操作符枚举。
  8809. */
  8810. export enum EVertexBatchOperator {
  8811. /**
  8812. * 矩阵乘法。
  8813. */
  8814. MatrixMultiple = 0,
  8815. /**
  8816. * Scale offset。
  8817. */
  8818. UVST = 1
  8819. }
  8820. export enum EAnimationBlendType {
  8821. Override = 0,
  8822. Additive = 1
  8823. }
  8824. export enum EUseDefaultAddedAction {
  8825. Ignore = 0,
  8826. Refresh = 1
  8827. }
  8828. export enum EUseDefaultRetainedAction {
  8829. Keep = 0,
  8830. Refresh = 1,
  8831. WriteBack = 2
  8832. }
  8833. export enum EUseDefaultRemovedAction {
  8834. Keep = 0,
  8835. Clear = 1,
  8836. WriteBack = 2
  8837. }
  8838. export enum ESkinnedSkeletonFlag {
  8839. Use3x4Matrix = 1,
  8840. UseTextureMatrix = 2
  8841. }
  8842. export const RENDER_ENV_OFFSETS: {
  8843. size: number;
  8844. resetFlag: number;
  8845. renderPass: number;
  8846. canvasWidth: number;
  8847. canvasHeight: number;
  8848. uniforms: number;
  8849. useInstanceOrNeverTranspose: number;
  8850. };
  8851. export const POOL_SUB_ID_MASK = 65472;
  8852. export const POOL_SUB_ID_SHIT = 6;
  8853. export const ENTITY2D_OFFSETS: {
  8854. size: number;
  8855. rotation: number;
  8856. position: number;
  8857. scale: number;
  8858. worldMatrix: number;
  8859. };
  8860. export const ENTITY3D_OFFSETS: {
  8861. size: number;
  8862. dfRotationType: number;
  8863. rotationType: number;
  8864. rotation: number;
  8865. position: number;
  8866. scale: number;
  8867. worldOffset: number;
  8868. worldMatrix: number;
  8869. };
  8870. export const ENTITY3D_EXT_OFFSETS: {
  8871. size: number;
  8872. layer: number;
  8873. mixedLayerMask: number;
  8874. };
  8875. export const CULLING_OFFSETS: {
  8876. size: number;
  8877. active: number;
  8878. dfActive: number;
  8879. layer: number;
  8880. boundingBallCenter: number;
  8881. boundingBallRadius: number;
  8882. entityId: number;
  8883. };
  8884. export const CAMERA_OFFSETS: {
  8885. size: number;
  8886. view: number;
  8887. depth: number;
  8888. active: number;
  8889. fov: number;
  8890. aspect: number;
  8891. near: number;
  8892. far: number;
  8893. up: number;
  8894. eye: number;
  8895. orthoSize: number;
  8896. isProjection: number;
  8897. cullingMask: number;
  8898. canvasSizeY: number;
  8899. targetTransform: number;
  8900. viewMatrix: number;
  8901. projectionMatrix: number;
  8902. viewMatrixInverse: number;
  8903. viewMatrix2D: number;
  8904. projectionMatrix2D: number;
  8905. viewMatrixInverse2D: number;
  8906. manualMatrix: number;
  8907. layerCullDistances: number;
  8908. };
  8909. export const LIGHT_OFFSETS: {
  8910. size: number;
  8911. view: number;
  8912. depth: number;
  8913. active: number;
  8914. shadowDistance: number;
  8915. shadowMode: number;
  8916. shadowFilterMode: number;
  8917. lightDir: number;
  8918. bounds: number;
  8919. lightSpaceMatrices: number;
  8920. };
  8921. export const MESH_OFFSETS: {
  8922. dynamicBatch: number;
  8923. skinHandle: number;
  8924. castShadow: number;
  8925. bindTarget: number;
  8926. start: number;
  8927. size: number;
  8928. materialId: number;
  8929. vertexBufferId: number;
  8930. indexBufferId: number;
  8931. startIndex: number;
  8932. numIndices: number;
  8933. };
  8934. export const EFFECT_OFFSETS: {
  8935. size: number;
  8936. useMaterialStates: number;
  8937. fstencil: number;
  8938. bstencil: number;
  8939. blendRGBA: number;
  8940. colorDepth: number;
  8941. state: number;
  8942. };
  8943. export const MATERIAL_OFFSETS: {
  8944. size: number;
  8945. renderQueue: number;
  8946. effect: number;
  8947. uniformBlock: number;
  8948. fstencilMask: number;
  8949. bstencilMask: number;
  8950. blendRGBAMask: number;
  8951. colorDepthMask: number;
  8952. stateMask: number;
  8953. fstencil: number;
  8954. bstencil: number;
  8955. blendRGBA: number;
  8956. colorDepth: number;
  8957. state: number;
  8958. useInstance: number;
  8959. };
  8960. export const SKINNED_SKELETON_OFFSETS: {
  8961. boneInverseModelId: number;
  8962. boneIndices: number;
  8963. perBoneIndices: number;
  8964. perBoneEntityId: number;
  8965. perBoneMatrixOld: number;
  8966. perBoneMatrixNew: number;
  8967. };
  8968. export const DYNAMIC_BONES_OFFSETS: {
  8969. stiffness: number;
  8970. elasticity: number;
  8971. damping: number;
  8972. };
  8973. export interface IHandle {
  8974. id: number;
  8975. data?: ArrayBuffer;
  8976. destroy?: Function;
  8977. __feObj?: any;
  8978. }
  8979. /**
  8980. * 顶点布局解构初始化参数。
  8981. */
  8982. export interface IVertexLayoutOptions {
  8983. /**
  8984. * 顶点属性列表。
  8985. */
  8986. attributes: {
  8987. /**
  8988. * 属性名字。
  8989. */
  8990. name: string;
  8991. /**
  8992. * 属性名格式。
  8993. */
  8994. format: EVertexFormat;
  8995. /**
  8996. * 属性在Buffer中的偏移量(字节)。
  8997. */
  8998. offset: number;
  8999. /**
  9000. * 属性的用途。
  9001. */
  9002. usage: EVertexLayoutUsage;
  9003. }[];
  9004. /**
  9005. * 步进类型。
  9006. *
  9007. * @default EVertexStep.PER_VERTEX
  9008. */
  9009. step?: EVertexStep;
  9010. /**
  9011. * 步长,不设定会自动计算。
  9012. */
  9013. stride?: number;
  9014. /**
  9015. * 步进单位。
  9016. *
  9017. * @default 1
  9018. */
  9019. stepRate?: number;
  9020. }
  9021. /**
  9022. * 动态合批描述符创建参数。
  9023. */
  9024. export interface IVertexDataDescriptorOptions {
  9025. vuMap: [string, string, EVertexBatchOperator?][];
  9026. ignored?: string[];
  9027. ubIndex?: number;
  9028. }
  9029. /**
  9030. * UniformBlock描述符创建参数。
  9031. */
  9032. export interface IUniformDescriptorOptions {
  9033. /**
  9034. * 名字。
  9035. */
  9036. name?: string;
  9037. /**
  9038. * Uniform描述列表。
  9039. */
  9040. uniforms: {
  9041. /**
  9042. * 名字。
  9043. */
  9044. name: string;
  9045. /**
  9046. * 类型。
  9047. */
  9048. type: EUniformType;
  9049. /**
  9050. * 长度。
  9051. */
  9052. num?: number;
  9053. /**
  9054. * @deprecated
  9055. */
  9056. needTranspose?: boolean;
  9057. }[];
  9058. }
  9059. /**
  9060. * 引擎原生图片接口。
  9061. */
  9062. export interface IImage {
  9063. /**
  9064. * 是否要预乘Alpha。
  9065. */
  9066. premultiplyAlpha: boolean;
  9067. /**
  9068. * 加载完成的回调。
  9069. */
  9070. onload: (() => void) | null;
  9071. /**
  9072. * 出错的回调。
  9073. */
  9074. onerror: ((error: Error) => void) | null;
  9075. /**
  9076. * @internal
  9077. */
  9078. buffer?: ArrayBuffer;
  9079. /**
  9080. * 对于`ArrayBuffer`创建的图片,第一次使用后是否要自动释放内存,在`xr-frame`中,默认自动释放。
  9081. */
  9082. autoRelease?: boolean;
  9083. /**
  9084. * 图片地址或者待解码的ArrayBuffer。
  9085. */
  9086. src: string | ArrayBuffer | ArrayBufferView;
  9087. /**
  9088. * 图片源于ArrayBuffer时,传入的mimetype。
  9089. */
  9090. type?: string;
  9091. /**
  9092. * 图片本地缓存地址,仅在微信内有用。
  9093. */
  9094. localPath?: string;
  9095. /**
  9096. * 图片宽度。
  9097. */
  9098. width: number;
  9099. /**
  9100. * 图片高度。
  9101. */
  9102. height: number;
  9103. /**
  9104. * 解码数据,视不同Backend而定。
  9105. */
  9106. readonly data?: ArrayBuffer | HTMLImageElement;
  9107. }
  9108. /**
  9109. * 可用于纹理的资源。
  9110. */
  9111. export type TTextureSource = ArrayBuffer | ArrayBufferView | IImage;
  9112. /**
  9113. * 外部需要注入的下载器接口。
  9114. */
  9115. export interface IRealDownloader {
  9116. load: (options: {
  9117. src: string;
  9118. encoding: 'binary' | 'utf-8' | undefined;
  9119. onLoad: (res: {
  9120. data: ArrayBuffer;
  9121. filePath: string;
  9122. }) => void;
  9123. onError: (error: Error) => void;
  9124. }) => void;
  9125. }
  9126. /**
  9127. * 下载器。
  9128. */
  9129. export interface IDownloader {
  9130. inWX: boolean;
  9131. REAL_DOWNLOADER: IRealDownloader;
  9132. LOAD(options: Parameters<IRealDownloader['load']>[0]): void;
  9133. }
  9134. /**
  9135. * 字体配置。
  9136. */
  9137. export interface IFontSetting {
  9138. fontFamily: string;
  9139. bold?: string;
  9140. italic?: string;
  9141. size?: number;
  9142. }
  9143. /**
  9144. * 渲染层提供的特性列表。
  9145. */
  9146. export interface IFeatures {
  9147. /**
  9148. * 是否支持GPU实例化。
  9149. */
  9150. gpuInstance: boolean;
  9151. /**
  9152. * 是否支持3D动态合批。
  9153. */
  9154. dynamicBatch3D: boolean;
  9155. /**
  9156. * 是否支持硬件SRGB解码。
  9157. */
  9158. srgb: boolean;
  9159. /**
  9160. * 是否支持各向异性滤波。
  9161. */
  9162. textureAnisotropic: boolean;
  9163. /**
  9164. * 是否支持浮点纹理。
  9165. */
  9166. textureFloat: boolean;
  9167. /**
  9168. * 是否支持半精度浮点纹理。
  9169. */
  9170. textureHalfFloat: boolean;
  9171. /**
  9172. * 是否支持浮点类型的颜色缓冲。
  9173. */
  9174. colorBufferFloat: boolean;
  9175. /**
  9176. * 是否支持深度纹理。
  9177. */
  9178. depthTexture: boolean;
  9179. /**
  9180. * 是否支持在片段着色器采样深度。
  9181. */
  9182. fragDepth: boolean;
  9183. }
  9184. export interface IRect {
  9185. x: number;
  9186. y: number;
  9187. w: number;
  9188. h: number;
  9189. }
  9190. /**
  9191. * 对一个View进行清屏的操作。
  9192. */
  9193. export interface IViewAction {
  9194. /**
  9195. * 颜色操作。
  9196. */
  9197. colorAction?: ELoadAction;
  9198. /**
  9199. * 深度操作。
  9200. */
  9201. depthAction?: ELoadAction;
  9202. /**
  9203. * 模板操作。
  9204. */
  9205. stencilAction?: ELoadAction;
  9206. /**
  9207. * 用于清屏的颜色值。
  9208. *
  9209. * @default [0,0,0,0]
  9210. */
  9211. clearColor?: [number, number, number, number];
  9212. /**
  9213. * 用于清屏的深度值。
  9214. *
  9215. * @default 1
  9216. */
  9217. clearDepth?: number;
  9218. /**
  9219. * 用于清屏的模板值。
  9220. *
  9221. * @default 0
  9222. */
  9223. clearStencil?: number;
  9224. }
  9225. /**
  9226. * 视图接口。
  9227. */
  9228. export interface IView {
  9229. /**
  9230. * 视图清屏操作。
  9231. */
  9232. passAction: IViewAction;
  9233. /**
  9234. * 视图区域。
  9235. */
  9236. viewport: IRect;
  9237. /**
  9238. * 裁剪区域。
  9239. */
  9240. scissor: IRect;
  9241. }
  9242. /**
  9243. * 附件接口。
  9244. */
  9245. export interface IAttachment {
  9246. texture: IHandle;
  9247. level?: number;
  9248. slice?: number;
  9249. }
  9250. /**
  9251. * 渲染通道描述符。
  9252. */
  9253. export interface IRenderPassDescriptor {
  9254. colors: IAttachment[];
  9255. depth: IAttachment;
  9256. stencil: IAttachment;
  9257. }
  9258. export enum EEventType {
  9259. SetRootEntity = 1,
  9260. AddChild = 2,
  9261. AddChildAtIndex = 3,
  9262. RemoveFromParent = 4,
  9263. DisperseSubTree = 5,
  9264. BindToBone = 6,
  9265. BindToBones = 7,
  9266. UnBindFromBone = 8,
  9267. UnBindFromBones = 9,
  9268. EntityCommandActive = 10,
  9269. EntityCommandInActive = 11
  9270. }
  9271. export interface IGlyphInfo {
  9272. code: number;
  9273. tex: number;
  9274. uv_x: number;
  9275. uv_y: number;
  9276. uv_w: number;
  9277. uv_h: number;
  9278. advance: number;
  9279. bearing_x: number;
  9280. bearing_y: number;
  9281. width: number;
  9282. height: number;
  9283. }
  9284. export interface IEventBridge {
  9285. entityAddChild(entity: number, child: number): void;
  9286. entityAddChildAtIndex(entity: number, child: number, index: number): void;
  9287. entityRemoveFromParent(entity: number): void;
  9288. entityClear(entity: number): void;
  9289. entitySetActive(entity: number, active: boolean): void;
  9290. entitySetLocalMatrixDirty(entity: number): void;
  9291. setRootEntity(entity: number): void;
  9292. refreshWorldTransform(): void;
  9293. bindEntityToBone(entity: {
  9294. id: number;
  9295. }, boneEntity: {
  9296. id: number;
  9297. }): void;
  9298. unbindEntityFromBone(entity: {
  9299. id: number;
  9300. }): void;
  9301. bindEntitiesToBones(entities: Array<{
  9302. id: number;
  9303. }>, boneEntities: Array<{
  9304. id: number;
  9305. }>): void;
  9306. unbindEntitiesFromBones(entities: Array<{
  9307. id: number;
  9308. }>): void;
  9309. }
  9310. export interface IRenderEnv extends IHandle {
  9311. version?: string;
  9312. backendType: string;
  9313. registerFallbackEffect(lightMode: string, handle?: IHandle): void;
  9314. changeMacros(macros: {
  9315. [name: string]: string | number | boolean;
  9316. }): void;
  9317. changeVirtualMacros(macros: {
  9318. [name: string]: boolean;
  9319. }): void;
  9320. setInternalInstanceInfo(type: EMeshRenderType, info: {
  9321. uniformKey: string;
  9322. attributeName: string;
  9323. type: EUniformType;
  9324. }[], ignored: string[]): void;
  9325. getErrors(): string[];
  9326. supportCompressTextures: TCompressTexture[];
  9327. features: IFeatures;
  9328. commit_version: string;
  9329. use_puppet_sokol: boolean;
  9330. }
  9331. export interface INativeMap<T> {
  9332. set(key: T, value: number): void;
  9333. get(key: T): number | undefined;
  9334. del(key: T): void;
  9335. }
  9336. export interface ILongIntNativeMap {
  9337. set(key1: number, key2: number, value: number): void;
  9338. get(key1: number, key2: number): number | undefined;
  9339. del(key1: number, key2: number): void;
  9340. }
  9341. export type WeakRef = any;
  9342. }
  9343. declare module 'XrFrame/kanata/lib/index' {
  9344. /**
  9345. * index.ts
  9346. *
  9347. * * @Date : 2020/8/18 下午4:48:36
  9348. */
  9349. export * from 'XrFrame/kanata/lib/frontend';
  9350. export * from 'XrFrame/kanata/lib/backend/interface';
  9351. export const VERSION = "1.0.4";
  9352. const Puppet: any;
  9353. export { Puppet };
  9354. /**
  9355. * 根据数据,返回二维节点对应结构的Float32array
  9356. */
  9357. export function composeRawBufferEntity2D(rotation: number, position: ArrayLike<number>, scale: ArrayLike<number>): Float32Array;
  9358. /**
  9359. * 根据数据,返回三维节点对应结构的Float32array,除WorldMatrix。
  9360. */
  9361. export function composeRawBufferEntity3D(useEuler: boolean, rotation: ArrayLike<number>, position: ArrayLike<number>, scale: ArrayLike<number>): Float32Array;
  9362. /**
  9363. * 根据数据,返回三维节点对应结构的Float32array
  9364. */
  9365. export function composeRawBufferEntity3DWhole(useEuler: boolean, rotation: ArrayLike<number>, position: ArrayLike<number>, scale: ArrayLike<number>): Float32Array;
  9366. }
  9367. declare module 'XrFrame/glyph' {
  9368. export interface IGlyph {
  9369. character?: string;
  9370. offsetX: number;
  9371. offsetY: number;
  9372. bearingX: number;
  9373. bearingY: number;
  9374. advance: number;
  9375. width: number;
  9376. height: number;
  9377. uvs: number[];
  9378. texture: number;
  9379. }
  9380. }
  9381. declare module 'XrFrame/components/particle/ParticleInstance' {
  9382. import { FactorGradient, ColorGradient } from "XrFrame/components/particle/gradient";
  9383. import Particle from "XrFrame/components/particle/Particle";
  9384. import Vector2 from 'XrFrame/math/vector2';
  9385. import Vector3 from 'XrFrame/math/vector3';
  9386. import Vector4 from 'XrFrame/math/vector4';
  9387. export default class ParticleInstance {
  9388. static count: number;
  9389. id: number;
  9390. position: Vector3;
  9391. direction: Vector3;
  9392. speed: number;
  9393. color: Vector4;
  9394. colorStep: Vector4;
  9395. rampPos: Vector4;
  9396. lifeTime: number;
  9397. age: number;
  9398. drag: number;
  9399. size: number;
  9400. startSize: number;
  9401. sizeGradientFactor: number;
  9402. scale: Vector2;
  9403. angle: number;
  9404. angularSpeed: number;
  9405. particleSystem: Particle;
  9406. currentSize: number;
  9407. currentSize2: number;
  9408. currentSizeGradient: FactorGradient;
  9409. currentColor: Vector4;
  9410. currentColor2: Vector4;
  9411. currentColorGradient: ColorGradient;
  9412. currentAlpha: number;
  9413. currentAlpha2: number;
  9414. currentAlphaGradient: FactorGradient;
  9415. currentSpeedScale: number;
  9416. currentSpeedScale2: number;
  9417. currentSpeedScaleGradient: FactorGradient;
  9418. currentLimitSpeed: number;
  9419. currentLimitSpeed2: number;
  9420. currentLimitSpeedGradient: FactorGradient;
  9421. currentDrag: number;
  9422. currentDrag2: number;
  9423. currentDragGradient: FactorGradient;
  9424. subEmitterMuster: any;
  9425. startSpriteCellIndex: number;
  9426. endSpriteCellIndex: number;
  9427. cellIndex: number;
  9428. randomCellOffset: any;
  9429. constructor(particle: Particle);
  9430. /**
  9431. * 重置粒子实例的状态。
  9432. */
  9433. reset(): void;
  9434. /**
  9435. * 将当前粒子实例的状态拷贝到目标实例。
  9436. * @param {ParticleInstance} other 目标粒子实例
  9437. */
  9438. copyTo(other: ParticleInstance): void;
  9439. /**
  9440. * 更新从动画图集采样的帧序号
  9441. */
  9442. updateCellIndex(): void;
  9443. clamp(num: any, left?: number, right?: number): any;
  9444. }
  9445. }
  9446. declare module 'XrFrame/components/emitter/BasicShapeEmitter' {
  9447. import Vector3 from 'XrFrame/math/vector3';
  9448. import ParticleInstance from "XrFrame/components/particle/ParticleInstance";
  9449. import Matrix4 from 'XrFrame/math/matrix4';
  9450. export abstract class BasicShapeEmitter {
  9451. /**
  9452. * keep normalized length
  9453. */
  9454. direction?: Vector3;
  9455. /**
  9456. * keep normalized length
  9457. */
  9458. direction2?: Vector3;
  9459. abstract startDirection(worldMatrix: Matrix4, direction: Vector3, ...args: any[]): void;
  9460. abstract startPosition(worldMatrix: Matrix4, position: Vector3, ...args: any[]): void;
  9461. processInstance?(instance: ParticleInstance, deltaTime: number): void;
  9462. setProperty(properties: any): void;
  9463. }
  9464. }
  9465. declare module 'XrFrame/components/emitter' {
  9466. import BoxShapeEmitter from 'XrFrame/components/emitter/BoxShapeEmitter';
  9467. import PointShapeEmitter from 'XrFrame/components/emitter/PointShapeEmitter';
  9468. import DrawShapeEmitter from 'XrFrame/components/emitter/DrawShapeEmitter';
  9469. import SphereShapeEmitter from 'XrFrame/components/emitter/SphereShapeEmitter';
  9470. import ConeShapeEmitter from 'XrFrame/components/emitter/ConeShapeEmitter';
  9471. import CircleShapeEmitter from 'XrFrame/components/emitter/CircleShapeEmitter';
  9472. export { BoxShapeEmitter, PointShapeEmitter, DrawShapeEmitter, SphereShapeEmitter, ConeShapeEmitter, CircleShapeEmitter };
  9473. }
  9474. declare module 'XrFrame/components/emitter/SubEmitter' {
  9475. import Particle from "XrFrame/components/particle/Particle";
  9476. /**
  9477. * 粒子子发射器的依附状态。
  9478. */
  9479. export const enum SubEmitterState {
  9480. /**
  9481. * 依附于粒子整个生命周期
  9482. */
  9483. ATTACH = 0,
  9484. /**
  9485. * 在粒子生命周期末出现
  9486. */
  9487. END = 1
  9488. }
  9489. export class SubEmitter {
  9490. particleSystem: Particle;
  9491. state: SubEmitterState;
  9492. constructor(particleSystem: any);
  9493. /**
  9494. * 通过克隆,获取指定的粒子子发射器实例
  9495. * @return {SubEmitter} 克隆后的子发射器实例
  9496. */
  9497. clone(): SubEmitter;
  9498. }
  9499. }
  9500. declare module 'XrFrame/components/physics/Rigidbody' {
  9501. export default class Rigidbody {
  9502. nativeComp: phys3D.Rigidbody;
  9503. }
  9504. }
  9505. declare module 'XrFrame/components/gizmo/CapsuleGizmo' {
  9506. import Component from "XrFrame/core/Component";
  9507. import Element from "XrFrame/core/Element";
  9508. export interface ICapsuleGizmoData {
  9509. radius: number;
  9510. height: number;
  9511. direction: number;
  9512. center: [number, number, number];
  9513. }
  9514. export const CapsuleGizmoSchema: {};
  9515. export default class CapsuleGizmo extends Component<ICapsuleGizmoData> {
  9516. static pieces: number;
  9517. onAdd(parent: Element, data: ICapsuleGizmoData): void;
  9518. onUpdate(data: ICapsuleGizmoData, preData: ICapsuleGizmoData): void;
  9519. onTick(deltaTime: number, data: ICapsuleGizmoData): void;
  9520. onRemove(parent: Element, data: ICapsuleGizmoData): void;
  9521. onRelease(data: ICapsuleGizmoData): void;
  9522. }
  9523. }
  9524. declare module 'XrFrame/components/gizmo/CubeGizmo' {
  9525. import Component from "XrFrame/core/Component";
  9526. import Element from "XrFrame/core/Element";
  9527. export interface ICubeGizmoData {
  9528. size: [number, number, number];
  9529. center: [number, number, number];
  9530. }
  9531. export const CubeGizmoSchema: {};
  9532. export default class CubeGizmo extends Component<ICubeGizmoData> {
  9533. onAdd(parent: Element, data: ICubeGizmoData): void;
  9534. onUpdate(data: ICubeGizmoData, preData: ICubeGizmoData): void;
  9535. onTick(deltaTime: number, data: ICubeGizmoData): void;
  9536. onRemove(parent: Element, data: ICubeGizmoData): void;
  9537. onRelease(data: ICubeGizmoData): void;
  9538. }
  9539. }
  9540. declare module 'XrFrame/render-graph/RenderGraph' {
  9541. import RGNode, { TRGNodeAny } from 'XrFrame/render-graph/RGNode';
  9542. import Camera from 'XrFrame/components/Camera';
  9543. type RenderSystem = import('XrFrame/systems/RenderSystem').default;
  9544. type Scene = import('XrFrame/core/Scene').default;
  9545. interface IDigraphNode {
  9546. node: TRGNodeAny;
  9547. ins: number;
  9548. dist: number[];
  9549. }
  9550. /**
  9551. * 渲染图。
  9552. *
  9553. * @category Render
  9554. */
  9555. export default class RenderGraph<IOptions = any> {
  9556. protected _name: string;
  9557. protected _options: IOptions;
  9558. protected _scene?: Scene;
  9559. protected _isActive: boolean;
  9560. protected _isDirty: boolean;
  9561. protected _unusedIds: number[];
  9562. protected _digraph: (IDigraphNode | undefined)[];
  9563. protected _sorted: TRGNodeAny[];
  9564. /**
  9565. * 图名字。
  9566. */
  9567. get name(): string;
  9568. /**
  9569. * 当前正在运行的Game实例。
  9570. */
  9571. get scene(): import('XrFrame/core/Scene').default;
  9572. /**
  9573. * 当前的渲染上下文。
  9574. */
  9575. get context(): import('XrFrame/systems/RenderSystem').default;
  9576. constructor(_name: string, _options: IOptions);
  9577. /**
  9578. * 创建一个节点。
  9579. */
  9580. createNode<TRGNode extends TRGNodeAny>(name: string, clz: new (...args: any) => TRGNode, options: TRGNode['options']): TRGNode;
  9581. /**
  9582. * 销毁一个节点。
  9583. */
  9584. destroyNode(rgNode: TRGNodeAny): void;
  9585. /**
  9586. * 连接两个节点。
  9587. *
  9588. * @param inputKey 需要将`from`节点的输出连接到哪个`to`节点的输入。
  9589. */
  9590. connect<TToNode extends TRGNodeAny>(from: TRGNodeAny, to: TToNode, inputKey?: keyof TToNode['inputTypes']): void;
  9591. /**
  9592. * 断开两个节点的连接。
  9593. */
  9594. disconnect(from: TRGNodeAny, to: TRGNodeAny): void;
  9595. /**
  9596. * @internal
  9597. */
  9598. /**
  9599. * @internal
  9600. */
  9601. /**
  9602. * @internal
  9603. */
  9604. /**
  9605. * 清空整个图,一般用于图的重新构建。
  9606. *
  9607. * @param filter 过滤出需要保留、不被销毁的缓存节点,这些节点只会被重置状态。
  9608. */
  9609. protected _clear(filter?: (node: RGNode<any, any, any>) => boolean): void;
  9610. protected _handleCamerasChange: (context: RenderSystem) => void;
  9611. /**
  9612. * 图在被第一次真正使用时的回调。
  9613. */
  9614. onActive(context: RenderSystem, options: IOptions): void;
  9615. /**
  9616. * 在渲染上下文中的相机改变时调用,一般用于重新构建图。
  9617. */
  9618. onCamerasChange(cameras: Camera[], changeCameras: Camera[]): void;
  9619. /**
  9620. * 在图每帧执行前调用。
  9621. */
  9622. onExecuteBegin(context: RenderSystem, options: IOptions): void;
  9623. /**
  9624. * 在图每帧执行后调用。
  9625. */
  9626. onExecuteDone(context: RenderSystem, options: IOptions): void;
  9627. /**
  9628. * 在图不再使用时调用。
  9629. */
  9630. onDisable(context: RenderSystem, options: IOptions): void;
  9631. /**
  9632. * @internal
  9633. *
  9634. * 编译整张图。
  9635. */
  9636. showDebugInfo(callback?: (digraph: (IDigraphNode | undefined)[], sorted: TRGNodeAny[]) => void): string;
  9637. }
  9638. export {};
  9639. }
  9640. declare module 'XrFrame/systems/LightManager' {
  9641. /**
  9642. * LightManager.ts
  9643. *
  9644. * * @Date : 4/11/2022, 2:29:36 PM
  9645. */
  9646. import Camera from 'XrFrame/components/Camera';
  9647. import Light from 'XrFrame/components/Light';
  9648. export interface IMainLightsInfo {
  9649. hasAmbient: boolean;
  9650. hasMainDir: boolean;
  9651. ambientColorIns: Float32Array;
  9652. mainDir: Float32Array;
  9653. mainColorIns: Float32Array;
  9654. }
  9655. export interface IAddLightsInfo {
  9656. count: number;
  9657. info: Float32Array;
  9658. dir: Float32Array;
  9659. pos: Float32Array;
  9660. colorIns: Float32Array;
  9661. }
  9662. export default class LightManager {
  9663. }
  9664. }
  9665. declare module 'XrFrame/physics/raycast' {
  9666. import Vector3 from "XrFrame/math/vector3";
  9667. import RaycastHit from "XrFrame/physics/RaycastHit";
  9668. /**
  9669. * raycast函数的参数。
  9670. * @field origin 射线起点。
  9671. * @field unitDir 射线方向(单位向量)。
  9672. * @field distance 射线的最大长度。
  9673. * @field hit 用来接收碰撞信息的容器。
  9674. * @field layerMask 可以用来屏蔽一些碰撞体。
  9675. * @field (未实现)queryTriggerInteraction,是否能与Trigger相交(默认能)。
  9676. */
  9677. export type RaycastDesc = {
  9678. origin: Vector3;
  9679. unitDir: Vector3;
  9680. distance?: number;
  9681. hit?: RaycastHit;
  9682. layerMask?: number;
  9683. };
  9684. /**
  9685. * 射线检测,判断给定射线是否与至少一个碰撞体相交,并返回与**最近**的那个碰撞体相交的信息。
  9686. */
  9687. export function raycast(Phys3D: typeof phys3D, system: phys3D.PhysSystem, desc: RaycastDesc): boolean;
  9688. }
  9689. declare module 'XrFrame/loader/AssetLoader' {
  9690. import { IAssetLoadData } from 'XrFrame/loader/types';
  9691. type Scene = import('XrFrame/core/Scene').default;
  9692. /**
  9693. * 指定继承自{@link AssetLoader}的自定义资源加载器,可以接受的的额外配置的`schema`。
  9694. *
  9695. * 比如使用{@link CubeTextureLoader}加载资源时:
  9696. *
  9697. * ```xml
  9698. * <xr-asset-load
  9699. * type="cube-texture" asset-id="sky-cube" src="/assets/textures/skybox/"
  9700. * options="faces: right.jpg left.jpg top.jpg bottom.jpg front.jpg back.jpg"
  9701. * />
  9702. * ```
  9703. *
  9704. * 对应的`schema`接口为:
  9705. * ```ts
  9706. * export interface ICubeTextureLoaderOptions {
  9707. * // left right top bottom front back
  9708. * faces: string[];
  9709. * }
  9710. * ```ts
  9711. *
  9712. * 对应的`schema`为:
  9713. * ```ts
  9714. * schema = {
  9715. * faces: {type: 'array'}
  9716. * };
  9717. * ```
  9718. */
  9719. export interface ILoaderOptionsSchema {
  9720. [key: string]: {
  9721. type: string;
  9722. defaultValue?: any;
  9723. };
  9724. }
  9725. /**
  9726. * 资源加载器的基类,配合{@link AssetsSystem}使用。
  9727. *
  9728. * @template T 加载资源的类型。
  9729. * @template ILoadOptions 可接受额外配置的类型。
  9730. */
  9731. export default class AssetLoader<T, ILoadOptions> {
  9732. /**
  9733. * 和{@link Component.schema}类似,指定解析Options的实际`schema`,对应于`ILoadOptions`。
  9734. */
  9735. readonly schema: ILoaderOptionsSchema;
  9736. /**
  9737. * 当前资源所属场景的实例。
  9738. */
  9739. get scene(): import('XrFrame/core/Scene').default;
  9740. constructor(_scene: Scene, type: string);
  9741. /**
  9742. * @internal
  9743. */
  9744. /**
  9745. * 加载一个资源,并根据情况执行`callbacks`中的回调。
  9746. * **理论上必须要实现!**
  9747. *
  9748. * @param callbacks 开发者需要在加载进度更新时执行`onLoading`,在加载完成时执行`onLoaded`,在加载出错是执行`onError`
  9749. */
  9750. load(data: IAssetLoadData<ILoadOptions>, callbacks: {
  9751. onLoading(progress: number): void;
  9752. onLoaded(result: T, localPath?: string): void;
  9753. onError(error: Error): void;
  9754. }): void;
  9755. /**
  9756. * 取消加载特定资源。一般不需要自己编写逻辑,而是使用`entity.canceled`在加载终点丢弃。
  9757. * 注意`entity.canceled`是在这里赋值的,所以一般继承请务必先执行`super.cancel()`!
  9758. */
  9759. cancel(params: IAssetLoadData<ILoadOptions>): void;
  9760. /**
  9761. * 释放资源时将会调用,用于自定义释放逻辑。
  9762. */
  9763. release(params: IAssetLoadData<ILoadOptions>, value: T): void;
  9764. /**
  9765. * 返回默认资源列表。
  9766. * 所有默认资源都是惰性加载的。
  9767. */
  9768. getBuiltin(): {
  9769. assetId: string;
  9770. src: string;
  9771. options: ILoadOptions;
  9772. }[];
  9773. }
  9774. export function getAssetLoaderTypes(): string[];
  9775. export function getAssetLoader(type: string): new (scene: import('XrFrame/core/Scene').default, type: string) => AssetLoader<any, any>;
  9776. /**
  9777. * 注册一个资源加载器。注意注册后该`type`会被自动注册到DataValue中:{@link registerDataValue}。
  9778. *
  9779. * @param type 类型,也是写在{@link AssetLoad}上的那个`type`。
  9780. * @param clz 继承自{@link AssetLoader}的自定义资源加载器类。
  9781. */
  9782. export function registerAssetLoader(type: string, clz: new (scene: Scene, type: string) => AssetLoader<any, any>): void;
  9783. export {};
  9784. }
  9785. declare module 'XrFrame/loader/glTF/animations/GLTFAnimationsNode' {
  9786. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9787. import { GLTFNodesLoaded } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  9788. import GLTFAnimationNode, { GLTFAnimationLoaded, GLTFAnimationNodeRaw } from "XrFrame/loader/glTF/animations/GLTFAnimationNode";
  9789. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  9790. type ChildNode = GLTFAnimationNode;
  9791. export type GLTFAnimationsNodeRaw = Array<GLTFAnimationsNodeRaw>;
  9792. export type GLTFAnimationsLoaded = Array<GLTFAnimationLoaded>;
  9793. export default class GLTFAnimationsNode extends GLTFArrayNode<ChildNode> {
  9794. ChildCtor(childRaw: GLTFAnimationNodeRaw): GLTFAnimationNode;
  9795. readonly raw: GLTFAnimationsNodeRaw;
  9796. get nodeName(): string;
  9797. preload: (prerequisites: [accessors: GLTFAccessorsLoaded, nodes: GLTFNodesLoaded]) => Promise<GLTFAnimationsLoaded>;
  9798. getLoadedResource(): GLTFAnimationsLoaded;
  9799. }
  9800. export {};
  9801. }
  9802. declare module 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode' {
  9803. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9804. import GLTFAccessorNode, { GLTFAccessorLoaded, GLTFAccessorNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFAccessorNode";
  9805. import { GLTFBufferViewsLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferViewsNode";
  9806. type ChildNode = GLTFAccessorNode;
  9807. export type GLTFAccessorsNodeRaw = Array<GLTFAccessorsNodeRaw>;
  9808. export type GLTFAccessorsLoaded = Array<GLTFAccessorLoaded>;
  9809. export default class GLTFAccessorsNode extends GLTFArrayNode<ChildNode> {
  9810. ChildCtor(childRaw: GLTFAccessorNodeRaw): GLTFAccessorNode;
  9811. readonly raw: GLTFAccessorsNodeRaw;
  9812. get nodeName(): string;
  9813. preload: (prerequisites: GLTFBufferViewsLoaded) => Promise<GLTFAccessorsLoaded>;
  9814. getLoadedResource(): GLTFAccessorsLoaded;
  9815. }
  9816. export {};
  9817. }
  9818. declare module 'XrFrame/loader/glTF/buffers/GLTFBuffersNode' {
  9819. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9820. import GLTFBufferNode, { GLTFBufferNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFBufferNode";
  9821. type ChildNode = GLTFBufferNode;
  9822. export type GLTFBuffersNodeRaw = Array<GLTFBufferNodeRaw>;
  9823. export type GLTFBuffersLoaded = Array<ArrayBuffer>;
  9824. export default class GLTFBuffersNode extends GLTFArrayNode<ChildNode> {
  9825. ChildCtor(childRaw: GLTFBufferNodeRaw): GLTFBufferNode;
  9826. readonly raw: GLTFBuffersNodeRaw;
  9827. get nodeName(): string;
  9828. getLoadedResource(): GLTFBuffersLoaded;
  9829. }
  9830. export {};
  9831. }
  9832. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode' {
  9833. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9834. import { GLTFBufferLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferNode";
  9835. import GLTFBufferViewNode, { GLTFBufferViewLoaded, GLTFBufferViewNodeRaw } from "XrFrame/loader/glTF/buffers/GLTFBufferViewNode";
  9836. type ChildNode = GLTFBufferViewNode;
  9837. export type GLTFBufferViewsNodeRaw = Array<GLTFBufferViewsNodeRaw>;
  9838. export type GLTFBufferViewsLoaded = Array<GLTFBufferViewLoaded>;
  9839. export default class GLTFBufferViewsNode extends GLTFArrayNode<ChildNode> {
  9840. ChildCtor(childRaw: GLTFBufferViewNodeRaw): GLTFBufferViewNode;
  9841. readonly raw: GLTFBufferViewsNodeRaw;
  9842. get nodeName(): string;
  9843. preload: (prerequisites: [GLTFBufferLoaded]) => Promise<GLTFBufferViewsLoaded>;
  9844. getLoadedResource(): GLTFBufferViewsLoaded;
  9845. }
  9846. export {};
  9847. }
  9848. declare module 'XrFrame/loader/glTF/extensions/GLTFExtensions' {
  9849. /**
  9850. * 创建GLTFExtensionProfileBuilder实例来定义一种extension,
  9851. * 类内提供了三种方法来操作gltf树:
  9852. * + 一种是substitutePreload,替换gltf节点的preload函数;
  9853. * + 一种是postBuild,在gltf树preload全部完成之后,再对其进行自定义操作;
  9854. * + 一种是registerRunInSlot,需要先在gltf节点内部使用extensionSlot定义一个槽位,然后往这个槽位里填写代码。
  9855. *
  9856. * 具体要使用哪些extension请看GLTFLoader.ts。
  9857. */
  9858. type SlotCode = (raw: object, extensionGlobal: object, prerequisites: any, args: any) => Promise<void>;
  9859. type ForceSlotCode = (extensionGlobal: object, prerequisites: any, args: any) => Promise<void>;
  9860. export class GLTFExtensionProfileBuilder {
  9861. constructor(extName: string);
  9862. registerRootInit(init: (raw: object, extensionGlobal: object) => void): void;
  9863. registerSubstitutePreload(path: string, preload: (raw: object, extensionGlobal: object, prerequisites?: object) => Promise<any>): void;
  9864. registerPostBuild(execute: (root: any, extensionGlobal: object) => Promise<void>): void;
  9865. registerRunInSlot(slotId: string, code: SlotCode): void;
  9866. /**
  9867. * 不管当前节点有没有extension,都运行,但是运行的时候不会给extRaw(因为可能没有)。
  9868. */
  9869. registerForceRunInSlot(slotId: string, code: ForceSlotCode): void;
  9870. }
  9871. export interface GLTFExtensionProfile {
  9872. readonly name: string;
  9873. readonly preloads: {
  9874. [path: string]: (raw: string, extensionGlobal: object, prerequisites?: object) => Promise<any>;
  9875. };
  9876. readonly postBuild?: (root: any, extensionGlobal: object) => void;
  9877. readonly slotCodeMap: Map<string, SlotCode>;
  9878. readonly forceSlotCodeMap: Map<string, ForceSlotCode>;
  9879. readonly rootInit: (raw: object, extensionGlobal: object) => void;
  9880. }
  9881. export type GLTFExtensionsProfiles = {
  9882. [name: string]: GLTFExtensionProfile;
  9883. };
  9884. export {};
  9885. }
  9886. declare module 'XrFrame/loader/glTF/geometry/GLTFMeshesNode' {
  9887. import { Kanata } from "XrFrame/ext";
  9888. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  9889. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9890. import { GLTFMaterialsLoaded } from "XrFrame/loader/glTF/materials/GLTFMaterialsNode";
  9891. import GLTFMeshNode, { GLTFMeshLoaded, GLTFMeshNodeRaw } from "XrFrame/loader/glTF/geometry/GLTFMeshNode";
  9892. type ChildNode = GLTFMeshNode;
  9893. export type GLTFMeshesNodeRaw = Array<GLTFMeshesNodeRaw>;
  9894. export type GLTFMeshesLoaded = Array<GLTFMeshLoaded>;
  9895. export default class GLTFMeshesNode extends GLTFArrayNode<ChildNode> {
  9896. ChildCtor(childRaw: GLTFMeshNodeRaw): GLTFMeshNode;
  9897. readonly raw: GLTFMeshesNodeRaw;
  9898. get nodeName(): string;
  9899. preload: (prerequisites: [materials: GLTFMaterialsLoaded, accessors: GLTFAccessorsLoaded, vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>]) => Promise<GLTFMeshesLoaded>;
  9900. getLoadedResource(): GLTFMeshesLoaded;
  9901. }
  9902. export {};
  9903. }
  9904. declare module 'XrFrame/loader/glTF/GLTFBaseNode' {
  9905. type Scene = import('XrFrame/core/Scene').default;
  9906. function _empty(): {
  9907. and: typeof _empty;
  9908. };
  9909. export abstract class GLTFBaseNode {
  9910. readonly raw: any;
  9911. abstract get nodeName(): string;
  9912. parent: GLTFBaseNode;
  9913. scene: Scene;
  9914. isValid: boolean;
  9915. constructor(raw: object, parent?: GLTFBaseNode);
  9916. /**
  9917. * 对raw进行校验。
  9918. * @deprecated 校验的事情还是交给官方的工具来做吧,规则太多了。
  9919. */
  9920. validate(): void;
  9921. /**
  9922. * 利用raw生成子节点
  9923. */
  9924. abstract build(): void;
  9925. /**
  9926. * @param msg 需要带句号
  9927. */
  9928. protected assert(pred: any, msg?: string): this | {
  9929. and: typeof _empty;
  9930. };
  9931. /** @internal */
  9932. and: (pred: any, msg?: string) => this | {
  9933. and: typeof _empty;
  9934. };
  9935. /**
  9936. * 加载静态资源,buffer/image等。
  9937. * 所有错误在这个方法抛出,包括格式错误,加载错误等。
  9938. */
  9939. abstract preload(prerequisites?: object): Promise<object>;
  9940. /**
  9941. * 获取加载后的资源。
  9942. * 无报错 throws nothing。
  9943. */
  9944. abstract getLoadedResource(): object;
  9945. protected findRoot(withPath?: boolean): any;
  9946. getExtensionRaw(extName: string): object | undefined;
  9947. /**
  9948. * 调用这个函数可以放置一个**允许extension代码插入**的位置。
  9949. */
  9950. protected extensionSlot(id: string, args: object): Promise<void>;
  9951. releaseLoadedResource(): void;
  9952. }
  9953. export abstract class GLTFArrayNode<T extends GLTFBaseNode> extends GLTFBaseNode {
  9954. abstract readonly raw: Array<object>;
  9955. abstract ChildCtor(childRaw: object): T;
  9956. children: Array<T>;
  9957. protected resources: Array<any>;
  9958. validate(): void;
  9959. preload(prerequisites?: any): Promise<any>;
  9960. build(): void;
  9961. releaseLoadedResource(): void;
  9962. }
  9963. export {};
  9964. }
  9965. declare module 'XrFrame/loader/glTF/materials/GLTFMaterialsNode' {
  9966. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9967. import { GLTFTexturesLoaded } from "XrFrame/loader/glTF/textures/GLTFTexturesNode";
  9968. import GLTFMaterialNode, { GLTFMaterialLoaded, GLTFMaterialNodeRaw } from "XrFrame/loader/glTF/materials/GLTFMaterialNode";
  9969. type ChildNode = GLTFMaterialNode;
  9970. export type GLTFMaterialsNodeRaw = Array<GLTFMaterialsNodeRaw>;
  9971. export type GLTFMaterialsLoaded = Array<GLTFMaterialLoaded>;
  9972. export default class GLTFMaterialsNode extends GLTFArrayNode<ChildNode> {
  9973. ChildCtor(childRaw: GLTFMaterialNodeRaw): GLTFMaterialNode;
  9974. readonly raw: GLTFMaterialsNodeRaw;
  9975. get nodeName(): string;
  9976. preload: (prerequisites: [textrues: GLTFTexturesLoaded]) => Promise<GLTFMaterialsLoaded>;
  9977. getLoadedResource(): GLTFMaterialsLoaded;
  9978. }
  9979. export {};
  9980. }
  9981. declare module 'XrFrame/loader/glTF/scenes/GLTFSceneNode' {
  9982. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9983. import { GLTFNodesLoaded, GLTFTreeNode } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  9984. export interface GLTFSceneNodeRaw {
  9985. nodes?: Array<number>;
  9986. name?: string;
  9987. }
  9988. export type GLTFSceneLoaded = Array<GLTFTreeNode>;
  9989. export default class GLTFSceneNode extends GLTFBaseNode {
  9990. get nodeName(): string;
  9991. readonly raw: GLTFSceneNodeRaw;
  9992. build(): void;
  9993. preload(prerequisites: [nodes: GLTFNodesLoaded]): Promise<GLTFSceneLoaded>;
  9994. getLoadedResource(): GLTFSceneLoaded;
  9995. }
  9996. }
  9997. declare module 'XrFrame/loader/glTF/scenes/GLTFScenesNode' {
  9998. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  9999. import { GLTFNodesLoaded } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  10000. import GLTFSceneNode, { GLTFSceneLoaded, GLTFSceneNodeRaw } from "XrFrame/loader/glTF/scenes/GLTFSceneNode";
  10001. type ChildNode = GLTFSceneNode;
  10002. export type GLTFScenesNodeRaw = Array<GLTFScenesNodeRaw>;
  10003. export type GLTFScenesLoaded = Array<GLTFSceneLoaded>;
  10004. export default class GLTFScenesNode extends GLTFArrayNode<ChildNode> {
  10005. ChildCtor(childRaw: GLTFSceneNodeRaw): GLTFSceneNode;
  10006. readonly raw: GLTFScenesNodeRaw;
  10007. get nodeName(): string;
  10008. preload: (prerequisites: [nodes: GLTFNodesLoaded]) => Promise<GLTFScenesLoaded>;
  10009. getLoadedResource(): GLTFScenesLoaded;
  10010. }
  10011. export {};
  10012. }
  10013. declare module 'XrFrame/loader/glTF/skins/GLTFSkinsNode' {
  10014. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  10015. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  10016. import GLTFSkinNode, { GLTFSkinLoaded, GLTFSkinNodeRaw } from "XrFrame/loader/glTF/skins/GLTFSkinNode";
  10017. type ChildNode = GLTFSkinNode;
  10018. export type GLTFSkinsNodeRaw = Array<GLTFSkinsNodeRaw>;
  10019. export type GLTFSkinsLoaded = Array<GLTFSkinLoaded>;
  10020. export default class GLTFSkinsNode extends GLTFArrayNode<ChildNode> {
  10021. ChildCtor(childRaw: GLTFSkinNodeRaw): GLTFSkinNode;
  10022. readonly raw: GLTFSkinsNodeRaw;
  10023. get nodeName(): string;
  10024. preload: (prerequisites: [accessors: GLTFAccessorsLoaded]) => Promise<GLTFSkinsLoaded>;
  10025. getLoadedResource(): GLTFSkinsLoaded;
  10026. }
  10027. export {};
  10028. }
  10029. declare module 'XrFrame/loader/glTF/textures/GLTFImagesNode' {
  10030. import { GLTFBufferViewsLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferViewsNode";
  10031. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  10032. import GLTFImageNode, { GLTFImageLoaded, GLTFImageNodeRaw } from "XrFrame/loader/glTF/textures/GLTFImageNode";
  10033. type ChildNode = GLTFImageNode;
  10034. export type GLTFImagesNodeRaw = Array<GLTFImagesNodeRaw>;
  10035. export type GLTFImagesLoaded = Array<GLTFImageLoaded>;
  10036. export default class GLTFImagesNode extends GLTFArrayNode<ChildNode> {
  10037. ChildCtor(childRaw: GLTFImageNodeRaw): GLTFImageNode;
  10038. readonly raw: GLTFImagesNodeRaw;
  10039. get nodeName(): string;
  10040. preload: (prerequisites: [bufferViews: GLTFBufferViewsLoaded]) => Promise<GLTFImagesLoaded>;
  10041. getLoadedResource(): GLTFImagesLoaded;
  10042. }
  10043. export {};
  10044. }
  10045. declare module 'XrFrame/loader/glTF/textures/GLTFSamplersNode' {
  10046. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  10047. import GLTFSamplerNode, { GLTFSamplerLoaded, GLTFSamplerNodeRaw } from "XrFrame/loader/glTF/textures/GLTFSamplerNode";
  10048. type ChildNode = GLTFSamplerNode;
  10049. export type GLTFSamplersNodeRaw = Array<GLTFSamplersNodeRaw>;
  10050. export type GLTFSamplersLoaded = Array<GLTFSamplerLoaded>;
  10051. export default class GLTFSamplersNode extends GLTFArrayNode<ChildNode> {
  10052. ChildCtor(childRaw: GLTFSamplerNodeRaw): GLTFSamplerNode;
  10053. readonly raw: GLTFSamplersNodeRaw;
  10054. get nodeName(): string;
  10055. preload: () => Promise<GLTFSamplersLoaded>;
  10056. getLoadedResource(): GLTFSamplersLoaded;
  10057. }
  10058. export {};
  10059. }
  10060. declare module 'XrFrame/loader/glTF/textures/GLTFTexturesNode' {
  10061. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  10062. import { GLTFImagesLoaded } from "XrFrame/loader/glTF/textures/GLTFImagesNode";
  10063. import { GLTFSamplersLoaded } from "XrFrame/loader/glTF/textures/GLTFSamplersNode";
  10064. import GLTFTextureNode, { GLTFTextureLoaded, GLTFTextureNodeRaw } from "XrFrame/loader/glTF/textures/GLTFTextureNode";
  10065. type ChildNode = GLTFTextureNode;
  10066. export type GLTFTexturesNodeRaw = Array<GLTFTexturesNodeRaw>;
  10067. export type GLTFTexturesLoaded = Array<GLTFTextureLoaded>;
  10068. export default class GLTFTexturesNode extends GLTFArrayNode<ChildNode> {
  10069. ChildCtor(childRaw: GLTFTextureNodeRaw): GLTFTextureNode;
  10070. readonly raw: GLTFTexturesNodeRaw;
  10071. get nodeName(): string;
  10072. preload: (prerequisites: [images: GLTFImagesLoaded, samplers: GLTFSamplersLoaded]) => Promise<GLTFTexturesLoaded>;
  10073. getLoadedResource(): GLTFTexturesLoaded;
  10074. }
  10075. export {};
  10076. }
  10077. declare module 'XrFrame/loader/glTF/scenes/GLTFNodeNode' {
  10078. import { GLTFMeshesLoaded } from "XrFrame/loader/glTF/geometry/GLTFMeshesNode";
  10079. import { GLTFMeshLoaded } from "XrFrame/loader/glTF/geometry/GLTFMeshNode";
  10080. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  10081. import { GLTFSkinLoaded } from "XrFrame/loader/glTF/skins/GLTFSkinNode";
  10082. import { GLTFSkinsLoaded } from "XrFrame/loader/glTF/skins/GLTFSkinsNode";
  10083. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  10084. export interface GLTFNodeNodeRaw {
  10085. children?: Array<number>;
  10086. mesh?: number;
  10087. matrix?: Array<number>;
  10088. rotation?: [number, number, number, number];
  10089. scale?: [number, number, number];
  10090. translation?: [number, number, number];
  10091. weights?: number;
  10092. skin?: number;
  10093. name?: string;
  10094. extension?: object;
  10095. }
  10096. export interface GLTFNodeLoaded {
  10097. children: Array<number>;
  10098. transform: GLTF.Transform;
  10099. mesh?: GLTFMeshLoaded;
  10100. skin?: GLTFSkinLoaded;
  10101. name: string;
  10102. }
  10103. export type GLTFNodePrerequisites = [meshes: GLTFMeshesLoaded, skins: GLTFSkinsLoaded];
  10104. export default class GLTFNodeNode extends GLTFBaseNode {
  10105. get nodeName(): string;
  10106. readonly raw: GLTFNodeNodeRaw;
  10107. build(): void;
  10108. preload(prerequisites: GLTFNodePrerequisites): Promise<GLTFNodeLoaded>;
  10109. getLoadedResource(): GLTFNodeLoaded;
  10110. }
  10111. }
  10112. declare module 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent' {
  10113. /**
  10114. * MeshRendererComponent.ts
  10115. *
  10116. * * @Date : 9/3/2020, 7:54:23 PM
  10117. */
  10118. import { EMeshRenderType } from 'XrFrame/kanata/lib/backend';
  10119. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10120. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10121. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D';
  10122. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock';
  10123. import VertexBuffer from 'XrFrame/kanata/lib/frontend/resource/VertexBuffer';
  10124. import IndexBuffer from 'XrFrame/kanata/lib/frontend/resource/IndexBuffer';
  10125. import VertexData from 'XrFrame/kanata/lib/frontend/resource/VertexData';
  10126. import IndexData from 'XrFrame/kanata/lib/frontend/resource/IndexData';
  10127. import Material from 'XrFrame/kanata/lib/frontend/resource/Material';
  10128. import SkinnedSkeletonComponent from 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent';
  10129. import CullingComponent from 'XrFrame/kanata/lib/frontend/component/CullingComponent';
  10130. export default class MeshRendererComponent extends NativeObject {
  10131. static OFFSETS: {
  10132. dynamicBatch: number;
  10133. skinHandle: number;
  10134. castShadow: number;
  10135. bindTarget: number;
  10136. start: number;
  10137. size: number;
  10138. materialId: number;
  10139. vertexBufferId: number;
  10140. indexBufferId: number;
  10141. startIndex: number;
  10142. numIndices: number;
  10143. };
  10144. static CREATE_FAKE(entity: Entity3D | Entity2D, options: {
  10145. meshCount: number;
  10146. uniformBlock?: UniformBlock;
  10147. }): FakeMeshRenderComponent;
  10148. protected _uniforms: UniformBlock;
  10149. get uniforms(): UniformBlock;
  10150. get meshCount(): number;
  10151. get castShadow(): boolean;
  10152. set castShadow(value: boolean);
  10153. get dynamicBatch(): boolean;
  10154. set dynamicBatch(value: boolean);
  10155. set skinSkeleton(sk: SkinnedSkeletonComponent);
  10156. set bindTarget(target: Entity3D | Entity2D | null);
  10157. get macros(): {
  10158. [name: string]: string | number | boolean;
  10159. };
  10160. constructor(entity: Entity3D | Entity2D, options: {
  10161. meshCount: number;
  10162. uniformBlock: UniformBlock;
  10163. renderType: EMeshRenderType;
  10164. culling?: CullingComponent;
  10165. macros?: {
  10166. [name: string]: string | number | boolean;
  10167. };
  10168. });
  10169. protected _createNativeObj(entity: Entity3D | Entity2D, options: {
  10170. meshCount: number;
  10171. uniformBlock: UniformBlock;
  10172. renderType: EMeshRenderType;
  10173. culling?: CullingComponent;
  10174. macros?: {
  10175. [name: string]: string | number | boolean;
  10176. };
  10177. }): import('XrFrame/kanata/lib/backend').IHandle & {
  10178. setSharedDirty(): void;
  10179. };
  10180. changeMacros(macros?: {
  10181. [name: string]: string | number | boolean;
  10182. }): void;
  10183. getStartIndex(index: number): number;
  10184. setStartIndex(index: number, value: number): void;
  10185. getNumIndices(index: number): number;
  10186. setNumIndices(index: number, value: number): void;
  10187. getVertexBuffer(index: number): VertexBuffer;
  10188. setVertexBuffer(index: number, buffer: VertexBuffer): void;
  10189. getIndexBuffer(index: number): IndexBuffer;
  10190. setIndexBuffer(index: number, buffer: IndexBuffer): void;
  10191. getVertexData(index: number): VertexData;
  10192. setVertexData(index: number, buffer: VertexData): void;
  10193. getIndexData(index: number): IndexData;
  10194. setIndexData(index: number, buffer: IndexData): void;
  10195. getMaterial(index: number): Material;
  10196. setMaterial(index: number, material: Material | null): void;
  10197. fastSet(vertexes: (VertexBuffer | VertexData)[], indexes: (VertexData | IndexBuffer)[], materials: Material[], startIndexes: number[], numIndices: number[]): void;
  10198. setDirty(): void;
  10199. copyStates(comp: MeshRendererComponent): void;
  10200. }
  10201. class FakeMeshRenderComponent extends MeshRendererComponent {
  10202. protected _createNativeObj(entity: Entity3D | Entity2D, options: {
  10203. meshCount: number;
  10204. uniformBlock: UniformBlock;
  10205. renderType: EMeshRenderType;
  10206. culling: CullingComponent;
  10207. }): {
  10208. id: number;
  10209. data: ArrayBuffer;
  10210. setSharedDirty: () => void;
  10211. };
  10212. get uniforms(): UniformBlock;
  10213. set uniforms(uniforms: UniformBlock);
  10214. }
  10215. export {};
  10216. }
  10217. declare module 'XrFrame/kanata/lib/frontend/resource/renderEnv' {
  10218. /**
  10219. * renderEnv.ts
  10220. *
  10221. * * @Date : 1/18/2021, 3:53:26 PM
  10222. */
  10223. import { EMeshRenderType, EUniformType, IFeatures, IRenderEnv, TCompressTexture } from 'XrFrame/kanata/lib/backend';
  10224. import View from 'XrFrame/kanata/lib/frontend/resource/View';
  10225. import Effect from 'XrFrame/kanata/lib/frontend/resource/Effect';
  10226. import RenderPass from 'XrFrame/kanata/lib/frontend/resource/RenderPass';
  10227. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock';
  10228. export class RenderEnv {
  10229. id: number;
  10230. __handle: IRenderEnv;
  10231. useExtendedMemory: boolean;
  10232. get version(): number[];
  10233. get backendType(): string;
  10234. get canvasWidth(): number;
  10235. set canvasWidth(value: number);
  10236. get canvasHeight(): number;
  10237. set canvasHeight(value: number);
  10238. get supportCompressTextures(): TCompressTexture[];
  10239. get features(): IFeatures;
  10240. get commitVersion(): string;
  10241. get usePuppetSokol(): boolean;
  10242. get useInstance(): boolean;
  10243. set useInstance(value: boolean);
  10244. get neverTranspose(): boolean;
  10245. set neverTranspose(value: boolean);
  10246. get isWrongWrapMapping(): boolean;
  10247. get isNotWrongEffectSort(): boolean;
  10248. get isGoodInstance(): boolean;
  10249. get isGoodPhysAndScalableList(): boolean;
  10250. constructor();
  10251. supportCompressTexture(type: TCompressTexture): boolean;
  10252. registerFallbackEffect(lightMode: string, effect?: Effect): void;
  10253. beginFrame(): void;
  10254. endFrame(): void;
  10255. clearView(view: View): void;
  10256. setEnvUniform(index: number, uniforms: UniformBlock): void;
  10257. setRenderPass(renderPass: RenderPass): void;
  10258. changeMacros(macros: {
  10259. [name: string]: string | number | boolean;
  10260. }): void;
  10261. getMacro(key: string): string | number | boolean;
  10262. changeVirtualMacros(macros: {
  10263. [name: string]: boolean;
  10264. }): void;
  10265. getVirtualMacro(key: string): boolean;
  10266. setInternalInstanceInfo(type: EMeshRenderType, info: {
  10267. uniformKey: string;
  10268. attributeName: string;
  10269. type: EUniformType;
  10270. }[], ignored: string[]): void;
  10271. getErrors(): string[];
  10272. }
  10273. const renderEnv: RenderEnv;
  10274. export default renderEnv;
  10275. }
  10276. declare module 'XrFrame/kanata/lib/frontend/component/AnimatorComponent' {
  10277. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10278. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10279. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel';
  10280. export default class AnimatorComponent extends NativeObject {
  10281. static UPDATE_ANIMATORS(animators: AnimatorComponent[], size: number): void;
  10282. animationClipModels: AnimationClipModel[];
  10283. constructor();
  10284. bindAnimations(animationClipModels: AnimationClipModel[], entities: (Entity3D | null)[][], rootEntity?: Entity3D): void;
  10285. setClipParams(index: number, frameIndex: number, blendWeight: number): void;
  10286. getAnimationClipCount(): number;
  10287. getNodeCount(): number;
  10288. getAnimationParameter(index: number): {
  10289. animationClipId: number;
  10290. frameIndex: number;
  10291. percentage: number;
  10292. };
  10293. getEntity(index: number): number;
  10294. }
  10295. }
  10296. declare module 'XrFrame/kanata/lib/frontend/component/CameraComponent' {
  10297. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10298. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10299. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D';
  10300. import View from 'XrFrame/kanata/lib/frontend/resource/View';
  10301. import ScalableList from 'XrFrame/kanata/lib/frontend/resource/ScalableList';
  10302. export default class CameraComponent extends NativeObject {
  10303. static OFFSETS: {
  10304. size: number;
  10305. view: number;
  10306. depth: number;
  10307. active: number;
  10308. fov: number;
  10309. aspect: number;
  10310. near: number;
  10311. far: number;
  10312. up: number;
  10313. eye: number;
  10314. orthoSize: number;
  10315. isProjection: number;
  10316. cullingMask: number;
  10317. canvasSizeY: number;
  10318. targetTransform: number;
  10319. viewMatrix: number;
  10320. projectionMatrix: number;
  10321. viewMatrixInverse: number;
  10322. viewMatrix2D: number;
  10323. projectionMatrix2D: number;
  10324. viewMatrixInverse2D: number;
  10325. manualMatrix: number;
  10326. layerCullDistances: number;
  10327. };
  10328. get active(): boolean;
  10329. set active(value: boolean);
  10330. get depth(): number;
  10331. set depth(value: number);
  10332. get isProjection(): boolean;
  10333. set isProjection(value: boolean);
  10334. get view(): View;
  10335. set view(value: View);
  10336. get fov(): number;
  10337. set fov(value: number);
  10338. get aspect(): number;
  10339. set aspect(value: number);
  10340. get near(): number;
  10341. set near(value: number);
  10342. get far(): number;
  10343. set far(value: number);
  10344. get orthoSize(): number;
  10345. set orthoSize(value: number);
  10346. get cullingMask(): number;
  10347. set cullingMask(value: number);
  10348. get layerCullDistances(): Float32Array | number[];
  10349. set layerCullDistances(value: Float32Array | number[]);
  10350. get canvasSizeY(): number;
  10351. set canvasSizeY(value: number);
  10352. set targetTransform(entityId: number);
  10353. get targetTransform(): number;
  10354. set up(vec3: Float32Array);
  10355. constructor(entity: Entity2D | Entity3D, isUI?: boolean);
  10356. cull(cullResult: ScalableList, lightMode: string): void;
  10357. draw(renderList: ScalableList, lightMode: string): void;
  10358. changeProjectionMatrix(manual: boolean, mat4?: Float32Array): void;
  10359. changeViewMatrix(manual: boolean, mat4?: Float32Array): void;
  10360. updateMatrix(): void;
  10361. }
  10362. }
  10363. declare module 'XrFrame/kanata/lib/frontend/component/LightCameraComponent' {
  10364. /**
  10365. * CameraLightComponent.ts
  10366. *
  10367. * * @Date : 9/3/2020, 7:54:13 PM
  10368. */
  10369. import { EShadowMode } from 'XrFrame/kanata/lib/backend';
  10370. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10371. import View from 'XrFrame/kanata/lib/frontend/resource/View';
  10372. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock';
  10373. import ScalableList from 'XrFrame/kanata/lib/frontend/resource/ScalableList';
  10374. import CameraComponent from 'XrFrame/kanata/lib/frontend/component/CameraComponent';
  10375. export default class LightCameraComponent extends NativeObject {
  10376. static OFFSETS: {
  10377. size: number;
  10378. view: number;
  10379. depth: number;
  10380. active: number;
  10381. shadowDistance: number;
  10382. shadowMode: number;
  10383. shadowFilterMode: number;
  10384. lightDir: number;
  10385. bounds: number;
  10386. lightSpaceMatrices: number;
  10387. };
  10388. get view(): View;
  10389. set view(value: View);
  10390. get active(): boolean;
  10391. set active(value: boolean);
  10392. get depth(): number;
  10393. set depth(value: number);
  10394. get shadowDistance(): number;
  10395. set shadowDistance(value: number);
  10396. get shadowFilterMode(): number;
  10397. set shadowFilterMode(value: number);
  10398. get shadowMode(): EShadowMode;
  10399. set shadowMode(value: EShadowMode);
  10400. get lightSpaceMatrices(): Float32Array;
  10401. constructor();
  10402. draw(camera: CameraComponent, renderList: ScalableList, lightMode: string): void;
  10403. prepareUniforms(uniforms: UniformBlock): void;
  10404. setLightDir(x: number, y: number, z: number): void;
  10405. setCascadedSplits(s0: number, s1: number, s2: number): void;
  10406. protected _updateBounds(auto: boolean): void;
  10407. protected _adjustSplitPercents(index: number, percent: number): number;
  10408. protected _setSplitPercents(index: number, percent: number): number;
  10409. }
  10410. }
  10411. declare module 'XrFrame/kanata/lib/frontend/component/CullingComponent' {
  10412. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10413. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D';
  10414. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject';
  10415. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager';
  10416. export default class CullingComponent extends PoolObject {
  10417. static POLL_MANAGER: PoolManager;
  10418. constructor(entity: Entity2D | Entity3D);
  10419. getActive(): boolean;
  10420. setActive(val: boolean): void;
  10421. getLayer(): number;
  10422. setLayer(val: number): void;
  10423. getBoundingBallCenter(): Float32Array;
  10424. setBoundingBallCenter(val: Float32Array, offset?: number): void;
  10425. getBoundingBallRadius(): number;
  10426. setBoundingBallRadius(val: number): void;
  10427. bindEntity(entity: Entity2D | Entity3D): void;
  10428. destroy(): void;
  10429. }
  10430. }
  10431. declare module 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent' {
  10432. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10433. import SkeletonBoneInverseModel from 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel';
  10434. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10435. export default class SkinnedSkeletonComponent extends NativeObject {
  10436. static UPDATE_MATS(comps: SkinnedSkeletonComponent[], size: number): void;
  10437. get boneNum(): number;
  10438. get boneInverseModel(): SkeletonBoneInverseModel;
  10439. get boneOffsetMatrices(): Float32Array;
  10440. constructor(boneNum: number, flag: number);
  10441. setBoneMatrix(boneInverseModel: SkeletonBoneInverseModel, boneIndices: number[], boneEntities: Entity3D[]): void;
  10442. getBoneNum(): number;
  10443. getBoneOffsetMatrices(): Float32Array;
  10444. }
  10445. }
  10446. declare module 'XrFrame/kanata/lib/frontend/component/DynamicBonesComponent' {
  10447. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10448. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10449. export default class DynamicBonesComponent extends NativeObject {
  10450. static OFFSETS: {
  10451. stiffness: number;
  10452. elasticity: number;
  10453. damping: number;
  10454. };
  10455. get stiffness(): number;
  10456. set stiffness(v: number);
  10457. get damping(): number;
  10458. set damping(v: number);
  10459. get elasticity(): number;
  10460. set elasticity(v: number);
  10461. constructor(rootNode?: Entity3D);
  10462. preUpdate(): void;
  10463. update(dt: number, rootMotion?: {
  10464. x: number;
  10465. y: number;
  10466. z: number;
  10467. }): void;
  10468. rebuild(): void;
  10469. resetRoot(root?: Entity3D): void;
  10470. }
  10471. }
  10472. declare module 'XrFrame/kanata/lib/frontend/entity/Entity2D' {
  10473. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject';
  10474. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager';
  10475. export default class Entity2D extends PoolObject {
  10476. static POLL_MANAGER: PoolManager;
  10477. static OFFSETS: {
  10478. size: number;
  10479. rotation: number;
  10480. position: number;
  10481. scale: number;
  10482. worldMatrix: number;
  10483. };
  10484. localPositionOffset: number;
  10485. localRotationOffset: number;
  10486. localScaleOffset: number;
  10487. worldMatrixOffset: number;
  10488. constructor();
  10489. addChild(child: Entity2D): void;
  10490. addChildAtIndex(child: Entity2D, index: number): void;
  10491. removeFromParent(): void;
  10492. setAsRoot(): void;
  10493. destroy(): void;
  10494. clear(): void;
  10495. setLocalMatrixDirty(): void;
  10496. set active(val: boolean);
  10497. }
  10498. }
  10499. declare module 'XrFrame/kanata/lib/frontend/entity/Entity3D' {
  10500. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject';
  10501. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager';
  10502. export default class Entity3D extends PoolObject {
  10503. static POLL_MANAGER: PoolManager;
  10504. static OFFSETS: {
  10505. size: number;
  10506. dfRotationType: number;
  10507. rotationType: number;
  10508. rotation: number;
  10509. position: number;
  10510. scale: number;
  10511. worldOffset: number;
  10512. worldMatrix: number;
  10513. };
  10514. static CREATE_TREE(length: number, buffer: ArrayBuffer, out: Array<any>, calculateWordMatrix?: boolean): boolean;
  10515. localRotationTypeOffset: number;
  10516. localQuaternionOffset: number;
  10517. localPositionOffset: number;
  10518. localScaleOffset: number;
  10519. worldMatrixOffset: number;
  10520. extOffset: number;
  10521. layerOffset: number;
  10522. mixedLayerMaskOffset: number;
  10523. constructor();
  10524. setUsingEuler(on: boolean): void;
  10525. isUsingEuler(): boolean;
  10526. setLayer(layer: number): void;
  10527. getLayer(): number;
  10528. getMixedLayerMask(): number;
  10529. addChild(child: Entity3D): void;
  10530. addChildAtIndex(child: Entity3D, index: number): void;
  10531. removeFromParent(): void;
  10532. setAsRoot(): void;
  10533. destroy(): void;
  10534. /**
  10535. * 如果只调用entityClear指令,那么Kanata就无法回收根节点下面的子节点了。
  10536. * 目前Kanata的frontend没有父子关系信息只能这么做了。
  10537. * 这个方法目前只能减少eventBridge的指令量,避免在大规模节点销毁的时候频繁触发eventBridge的溢出提交。
  10538. * @param entities
  10539. * @param length
  10540. */
  10541. clear(entities: Entity3D[], length: number): void;
  10542. setLocalMatrixDirty(): void;
  10543. set active(val: boolean);
  10544. }
  10545. }
  10546. declare module 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel' {
  10547. import DataModel from 'XrFrame/kanata/lib/frontend/resource/DataModel';
  10548. export default class AnimationClipModel extends DataModel {
  10549. setAnimationClip(ab: ArrayBuffer): void;
  10550. }
  10551. }
  10552. declare module 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding' {
  10553. /**
  10554. * AnimationClipBinding.ts
  10555. *
  10556. * */
  10557. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D';
  10558. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel';
  10559. import { EUseDefaultAddedAction } from 'XrFrame/kanata/lib/backend';
  10560. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10561. import { INativeWorker } from 'XrFrame/kanata/lib/backend/native/worker';
  10562. export default class AnimationClipBinding extends PureResource {
  10563. __handle: INativeWorker.IAnimationClipBinding;
  10564. constructor(clipArray: AnimationClipModel[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | Entity3D | null>, entityArrayOffset: number, entityArrayLength: number, useDefaultAddedNodesAction: EUseDefaultAddedAction, rootEntity: Entity3D);
  10565. rebind(clipArray: AnimationClipModel[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | Entity3D | null>, entityArrayOffset: number, entityArrayLength: number, removeAction: number, retainedAction: number, addedAction: number, rootEntity: Entity3D): boolean;
  10566. update(clipArray: AnimationClipModel[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | Entity3D | null>, entityArrayOffset: number, entityArrayLength: number, removeAction: number, retainedAction: number, addedAction: number): boolean;
  10567. writeDefaultValues(): void;
  10568. }
  10569. }
  10570. declare module 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerModel' {
  10571. /**
  10572. * AnimatorControllerModel.ts
  10573. *
  10574. * */
  10575. import AnimatorControllerStateModel from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel';
  10576. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10577. import AnimationClipBinding from 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding';
  10578. export default class AnimatorControllerModel extends PureResource {
  10579. layerCount: number;
  10580. static UPDATE_ANIMATOR_CONTROLLERS(animatorControllers: AnimatorControllerModel[], size: number): void;
  10581. constructor(layerCount: number);
  10582. setAnimationClipBinding(binding: null | AnimationClipBinding): void;
  10583. setLayerBlendType(layerIndex: number, blendType: number): void;
  10584. setLayerWeight(layerIndex: number, weight: number): void;
  10585. setLayerBlend(layerIndex: number, blend: null | AnimatorControllerStateModel): void;
  10586. setLayerMask(layerIndex: number, mask: {
  10587. buffer: null | ArrayBuffer;
  10588. offset: number;
  10589. length: number;
  10590. }): void;
  10591. update(): void;
  10592. destroy(): void;
  10593. }
  10594. }
  10595. declare module 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel' {
  10596. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10597. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel';
  10598. export default class AnimatorControllerStateModel extends PureResource {
  10599. readonly count: number;
  10600. get weight(): number;
  10601. set weight(weight: number);
  10602. get useDefault(): number;
  10603. set useDefault(useDefault: number);
  10604. constructor(count: number);
  10605. resetBlendInfo(): void;
  10606. setNextState(state: AnimatorControllerStateModel | null): void;
  10607. setBlendInfo(clip: AnimationClipModel, frameIndex: number, blendWeight: number, additiveReferenceClip: null | AnimationClipModel, additiveFrameIndex: number): boolean;
  10608. }
  10609. }
  10610. declare module 'XrFrame/kanata/lib/frontend/resource/DataBuffer' {
  10611. /**
  10612. * DataBuffer.ts
  10613. *
  10614. * * @Date : 9/4/2020, 1:21:59 PM
  10615. */
  10616. import { IHandle } from 'XrFrame/kanata/lib/backend';
  10617. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10618. export default class DataBuffer extends NativeObject {
  10619. constructor(nativeObj: IHandle);
  10620. get dataLength(): number;
  10621. get byteOffset(): number;
  10622. get arrayBuffer(): ArrayBuffer;
  10623. }
  10624. }
  10625. declare module 'XrFrame/kanata/lib/frontend/resource/DataModel' {
  10626. /**
  10627. * DataModel.ts
  10628. *
  10629. * * @Date : 9/4/2020, 1:18:13 PM
  10630. */
  10631. import { EDataModelType } from 'XrFrame/kanata/lib/backend';
  10632. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10633. export default class DataModel extends PureResource {
  10634. protected _createNativeModel(type: EDataModelType, buffer: ArrayBuffer): void;
  10635. }
  10636. }
  10637. declare module 'XrFrame/kanata/lib/frontend/resource/Effect' {
  10638. /**
  10639. * Effect.ts
  10640. *
  10641. * * @Date : 9/9/2020, 5:49:54 PM
  10642. */
  10643. import { EBlendFactor, EBlendEquation, ECullMode, ECompareFunc, EPrimitiveType, EStencilOp } from 'XrFrame/kanata/lib/backend';
  10644. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10645. export default class Effect extends NativeObject {
  10646. static OFFSETS: {
  10647. size: number;
  10648. useMaterialStates: number;
  10649. fstencil: number;
  10650. bstencil: number;
  10651. blendRGBA: number;
  10652. colorDepth: number;
  10653. state: number;
  10654. };
  10655. get passCount(): number;
  10656. constructor(name: string, passCount: number, keyIndexMap: string[], passes: {
  10657. lightMode: string;
  10658. variants?: {
  10659. [key: number]: number;
  10660. };
  10661. macros?: {
  10662. [key: string]: number;
  10663. };
  10664. shaders?: number[];
  10665. }[], shaders: string[], variants: number[][], useRuntimeMacros?: boolean);
  10666. warmUp(): any;
  10667. getBlendOn(pass: number): boolean;
  10668. setBlendOn(pass: number, value: boolean): void;
  10669. getBlendSrc(pass: number): EBlendFactor;
  10670. setBlendSrc(pass: number, value: EBlendFactor): void;
  10671. getBlendDst(pass: number): EBlendFactor;
  10672. setBlendDst(pass: number, value: EBlendFactor): void;
  10673. getBlendSrcRGB(pass: number): EBlendFactor;
  10674. setBlendSrcRGB(pass: number, value: EBlendFactor): void;
  10675. getBlendSrcAlpha(pass: number): EBlendFactor;
  10676. setBlendSrcAlpha(pass: number, value: EBlendFactor): void;
  10677. getBlendDstRGB(pass: number): EBlendFactor;
  10678. setBlendDstRGB(pass: number, value: EBlendFactor): void;
  10679. getBlendDstAlpha(pass: number): EBlendFactor;
  10680. setBlendDstAlpha(pass: number, value: EBlendFactor): void;
  10681. getBlendFunc(pass: number): EBlendEquation;
  10682. setBlendFunc(pass: number, value: EBlendEquation): void;
  10683. getDepthTestOn(pass: number): boolean;
  10684. setDepthTestOn(pass: number, value: boolean): void;
  10685. getDepthTestComp(pass: number): ECompareFunc;
  10686. setDepthTestComp(pass: number, value: ECompareFunc): void;
  10687. getDepthWrite(pass: number): boolean;
  10688. setDepthWrite(pass: number, value: boolean): void;
  10689. getCullFace(pass: number): ECullMode;
  10690. setCullFace(pass: number, value: ECullMode): void;
  10691. getCullOn(pass: number): boolean;
  10692. setCullOn(pass: number, value: boolean): void;
  10693. getPrimitiveType(pass: number): EPrimitiveType;
  10694. setPrimitiveType(pass: number, value: EPrimitiveType): void;
  10695. getStencilTestOn(pass: number): boolean;
  10696. setStencilTestOn(pass: number, value: boolean): void;
  10697. getStencilComp(pass: number): ECompareFunc;
  10698. setStencilComp(pass: number, value: ECompareFunc): void;
  10699. getStencilPass(pass: number): EStencilOp;
  10700. setStencilPass(pass: number, value: EStencilOp): void;
  10701. getStencilFail(pass: number): EStencilOp;
  10702. setStencilFail(pass: number, value: EStencilOp): void;
  10703. getStencilZFail(pass: number): EStencilOp;
  10704. setStencilZFail(pass: number, value: EStencilOp): void;
  10705. getStencilWriteMask(pass: number): number;
  10706. setStencilWriteMask(pass: number, value: number): void;
  10707. getStencilReadMask(pass: number): number;
  10708. setStencilReadMask(pass: number, value: number): void;
  10709. getStencilRef(pass: number): number;
  10710. setStencilRef(pass: number, value: number): void;
  10711. getUseMaterialStates(pass: number): boolean;
  10712. setUseMaterialStates(pass: number, value: boolean): void;
  10713. getUseMaterialStateBlendOn(pass: number): boolean;
  10714. setUseMaterialStateBlendOn(pass: number, value: boolean): void;
  10715. getUseMaterialStateBlendSrcRGB(pass: number): boolean;
  10716. setUseMaterialStateBlendSrcRGB(pass: number, value: boolean): void;
  10717. getUseMaterialStateBlendSrcAlpha(pass: number): boolean;
  10718. setUseMaterialStateBlendSrcAlpha(pass: number, value: boolean): void;
  10719. getUseMaterialStateBlendDstRGB(pass: number): boolean;
  10720. setUseMaterialStateBlendDstRGB(pass: number, value: boolean): void;
  10721. getUseMaterialStateBlendDstAlpha(pass: number): boolean;
  10722. setUseMaterialStateBlendDstAlpha(pass: number, value: boolean): void;
  10723. getUseMaterialStateBlendFunc(pass: number): boolean;
  10724. setUseMaterialStateBlendFunc(pass: number, value: boolean): void;
  10725. getUseMaterialStateDepthTestOn(pass: number): boolean;
  10726. setUseMaterialStateDepthTestOn(pass: number, value: boolean): void;
  10727. getUseMaterialStateDepthTestComp(pass: number): boolean;
  10728. setUseMaterialStateDepthTestComp(pass: number, value: boolean): void;
  10729. getUseMaterialStateDepthWrite(pass: number): boolean;
  10730. setUseMaterialStateDepthWrite(pass: number, value: boolean): void;
  10731. getUseMaterialStateCullOn(pass: number): boolean;
  10732. setUseMaterialStateCullOn(pass: number, value: boolean): void;
  10733. getUseMaterialStateCullFace(pass: number): boolean;
  10734. setUseMaterialStateCullFace(pass: number, value: boolean): void;
  10735. getUseMaterialStatePrimitiveType(pass: number): boolean;
  10736. setUseMaterialStatePrimitiveType(pass: number, value: boolean): void;
  10737. getUseMaterialStateStencilTestOn(pass: number): boolean;
  10738. setUseMaterialStateStencilTestOn(pass: number, value: boolean): void;
  10739. getUseMaterialStateStencilTestComp(pass: number): boolean;
  10740. setUseMaterialStateStencilTestComp(pass: number, value: boolean): void;
  10741. getUseMaterialStateStencilTestPass(pass: number): boolean;
  10742. setUseMaterialStateStencilTestPass(pass: number, value: boolean): void;
  10743. getUseMaterialStateStencilTestFail(pass: number): boolean;
  10744. setUseMaterialStateStencilTestFail(pass: number, value: boolean): void;
  10745. getUseMaterialStateStencilTestZFail(pass: number): boolean;
  10746. setUseMaterialStateStencilTestZFail(pass: number, value: boolean): void;
  10747. showDebugInfo(): string;
  10748. }
  10749. }
  10750. declare module 'XrFrame/kanata/lib/frontend/resource/Material' {
  10751. /**
  10752. * Material.ts
  10753. *
  10754. * * @Date : 9/4/2020, 6:41:13 PM
  10755. */
  10756. import { EBlendFactor, EBlendEquation, ECompareFunc, ECullMode, EStencilOp, EPrimitiveType } from 'XrFrame/kanata/lib/backend';
  10757. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock';
  10758. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  10759. import Effect from 'XrFrame/kanata/lib/frontend/resource/Effect';
  10760. export default class Material extends NativeObject {
  10761. static OFFSETS: {
  10762. size: number;
  10763. renderQueue: number;
  10764. effect: number;
  10765. uniformBlock: number;
  10766. fstencilMask: number;
  10767. bstencilMask: number;
  10768. blendRGBAMask: number;
  10769. colorDepthMask: number;
  10770. stateMask: number;
  10771. fstencil: number;
  10772. bstencil: number;
  10773. blendRGBA: number;
  10774. colorDepth: number;
  10775. state: number;
  10776. useInstance: number;
  10777. };
  10778. protected _uniforms: UniformBlock;
  10779. protected _effect: Effect;
  10780. protected _macros: {
  10781. [name: string]: string | number | boolean;
  10782. };
  10783. get effect(): Effect;
  10784. set effect(value: Effect);
  10785. get uniforms(): UniformBlock;
  10786. set uniforms(value: UniformBlock);
  10787. get renderQueue(): number;
  10788. set renderQueue(value: number);
  10789. get useInstance(): boolean;
  10790. set useInstance(value: boolean);
  10791. get blendOn(): boolean;
  10792. set blendOn(value: boolean);
  10793. get blendSrcRGB(): EBlendFactor;
  10794. set blendSrcRGB(value: EBlendFactor);
  10795. get blendSrcRGBChanged(): boolean;
  10796. get blendSrcAlpha(): EBlendFactor;
  10797. set blendSrcAlpha(value: EBlendFactor);
  10798. set blendSrc(value: EBlendFactor);
  10799. get blendDstRGB(): EBlendFactor;
  10800. set blendDstRGB(value: EBlendFactor);
  10801. get blendDstRGBChanged(): boolean;
  10802. get blendDstAlpha(): EBlendFactor;
  10803. set blendDstAlpha(value: EBlendFactor);
  10804. set blendDst(value: EBlendFactor);
  10805. get blendFunc(): EBlendEquation;
  10806. set blendFunc(value: EBlendEquation);
  10807. get depthTestOn(): boolean;
  10808. set depthTestOn(value: boolean);
  10809. get depthTestComp(): ECompareFunc;
  10810. set depthTestComp(value: ECompareFunc);
  10811. get depthWrite(): boolean;
  10812. set depthWrite(value: boolean);
  10813. get cullFace(): ECullMode;
  10814. set cullFace(value: ECullMode);
  10815. get cullOn(): boolean;
  10816. set cullOn(value: boolean);
  10817. get primitiveType(): EPrimitiveType;
  10818. set primitiveType(value: EPrimitiveType);
  10819. get stencilTestOn(): boolean;
  10820. set stencilTestOn(value: boolean);
  10821. get stencilComp(): ECompareFunc;
  10822. set stencilComp(value: ECompareFunc);
  10823. get stencilPass(): EStencilOp;
  10824. set stencilPass(value: EStencilOp);
  10825. get stencilFail(): EStencilOp;
  10826. set stencilFail(value: EStencilOp);
  10827. get stencilZFail(): EStencilOp;
  10828. set stencilZFail(value: EStencilOp);
  10829. get stencilWriteMask(): number;
  10830. set stencilWriteMask(value: number);
  10831. get stencilReadMask(): number;
  10832. set stencilReadMask(value: number);
  10833. get stencilRef(): number;
  10834. set stencilRef(value: number);
  10835. get blendOnMask(): boolean;
  10836. set blendOnMask(value: boolean);
  10837. get blendSrcRGBMask(): boolean;
  10838. set blendSrcRGBMask(value: boolean);
  10839. get blendSrcAlphaMask(): boolean;
  10840. set blendSrcAlphaMask(value: boolean);
  10841. set blendSrcMask(value: boolean);
  10842. get blendDstRGBMask(): boolean;
  10843. set blendDstRGBMask(value: boolean);
  10844. get blendDstAlphaMask(): boolean;
  10845. set blendDstAlphaMask(value: boolean);
  10846. set blendDstMask(value: boolean);
  10847. get blendFuncMask(): boolean;
  10848. set blendFuncMask(value: boolean);
  10849. get depthTestOnMask(): boolean;
  10850. set depthTestOnMask(value: boolean);
  10851. get depthTestCompMask(): boolean;
  10852. set depthTestCompMask(value: boolean);
  10853. get depthWriteMask(): boolean;
  10854. set depthWriteMask(value: boolean);
  10855. get cullFaceMask(): boolean;
  10856. set cullFaceMask(value: boolean);
  10857. get cullOnMask(): boolean;
  10858. set cullOnMask(value: boolean);
  10859. get primitiveTypeMask(): boolean;
  10860. set primitiveTypeMask(value: boolean);
  10861. get stencilTestOnMask(): boolean;
  10862. set stencilTestOnMask(value: boolean);
  10863. get stencilCompMask(): boolean;
  10864. set stencilCompMask(value: boolean);
  10865. get stencilPassMask(): boolean;
  10866. set stencilPassMask(value: boolean);
  10867. get stencilFailMask(): boolean;
  10868. set stencilFailMask(value: boolean);
  10869. get stencilZFailMask(): boolean;
  10870. set stencilZFailMask(value: boolean);
  10871. get stencilWriteMaskMask(): boolean;
  10872. set stencilWriteMaskMask(value: boolean);
  10873. get stencilReadMaskMask(): boolean;
  10874. set stencilReadMaskMask(value: boolean);
  10875. get stencilRefMask(): boolean;
  10876. set stencilRefMask(value: boolean);
  10877. constructor(macros?: {
  10878. [name: string]: string | number | boolean;
  10879. }, effect?: Effect, uniformBlock?: UniformBlock);
  10880. protected _createNativeMat(macros?: {
  10881. [name: string]: string | number | boolean;
  10882. }, effect?: Effect, uniformBlock?: UniformBlock): void;
  10883. changeMacros(macros?: {
  10884. [name: string]: string | number | boolean;
  10885. }): void;
  10886. getMacro(key: string): string | number | boolean;
  10887. clone(uniforms?: UniformBlock): Material;
  10888. showDebugInfo(): string;
  10889. }
  10890. }
  10891. declare module 'XrFrame/kanata/lib/frontend/resource/RenderPass' {
  10892. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10893. import Texture from 'XrFrame/kanata/lib/frontend/resource/Texture';
  10894. export interface IRenderPassOptions {
  10895. colors: {
  10896. texture: Texture;
  10897. slice?: number;
  10898. level?: number;
  10899. }[];
  10900. depth: {
  10901. texture: Texture;
  10902. slice?: number;
  10903. level?: number;
  10904. };
  10905. stencil?: {
  10906. texture: Texture;
  10907. slice?: number;
  10908. level?: number;
  10909. };
  10910. }
  10911. export default class RenderPass extends PureResource {
  10912. static SCREEN_RENDER_PASS: RenderPass;
  10913. constructor(options: IRenderPassOptions);
  10914. }
  10915. }
  10916. declare module 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel' {
  10917. import DataModel from 'XrFrame/kanata/lib/frontend/resource/DataModel';
  10918. export default class SkeletonBoneInverseModel extends DataModel {
  10919. boneNum: number;
  10920. setBoneInverseMatrix(matrices: Float32Array): void;
  10921. }
  10922. }
  10923. declare module 'XrFrame/kanata/lib/frontend/resource/Texture' {
  10924. /**
  10925. * Texture.ts
  10926. *
  10927. * * @Date : 9/4/2020, 2:35:42 PM
  10928. */
  10929. import { ETextureFormat, ETextureType, EWrapMode, EFilterMode, TTextureSource } from 'XrFrame/kanata/lib/backend';
  10930. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  10931. /**
  10932. * 纹理资源{@link Texture}的创建参数。
  10933. */
  10934. export interface ITextureOptions {
  10935. /**
  10936. * 纹理宽,如果`source`是`IImage`可以不传。
  10937. */
  10938. width?: number;
  10939. /**
  10940. * 纹理高,如果`source`是`IImage`可以不传。
  10941. */
  10942. height?: number;
  10943. /**
  10944. * @internal
  10945. */
  10946. isWriteOnly?: boolean;
  10947. /**
  10948. * @internal
  10949. */
  10950. isRenderTarget?: boolean;
  10951. /**
  10952. * @internal
  10953. */
  10954. canvas?: HTMLCanvasElement;
  10955. /**
  10956. * 纹理数据源,如果是2D纹理,一般只能有一个元素。如果是`Buffer`类型数据,比如压缩纹理,则需要和`offsets`配合使用,一般用于`mipmaps`的场合。
  10957. * 如果是立方体纹理,则有六个元素。
  10958. */
  10959. source?: TTextureSource[];
  10960. /**
  10961. * 当`source`为`Buffer`纹理并且拥有`mipmaps`之类的时,标记如何切割数据。
  10962. * 规则是: off1, size1, off2, size2......
  10963. */
  10964. offsets?: Uint32Array;
  10965. /**
  10966. * 纹理类型。
  10967. */
  10968. type?: ETextureType;
  10969. /**
  10970. * 纹理有多少切片,比如立方体纹理就为`6`。
  10971. */
  10972. slices?: number;
  10973. /**
  10974. * 纹理有多少级`mipmap`。
  10975. */
  10976. mips?: number;
  10977. /**
  10978. * 纹理的像素格式。
  10979. */
  10980. pixelFormat?: ETextureFormat;
  10981. minFilter?: EFilterMode;
  10982. magFilter?: EFilterMode;
  10983. /**
  10984. * 是否要自动生成`mipmaps`,仅对非压缩纹理有效。
  10985. */
  10986. generateMipmaps?: boolean;
  10987. wrapU?: EWrapMode;
  10988. wrapV?: EWrapMode;
  10989. wrapW?: EWrapMode;
  10990. /**
  10991. * 各向异性等级。
  10992. */
  10993. anisoLevel?: number;
  10994. /**
  10995. * @internal
  10996. */
  10997. sampleCount?: number;
  10998. }
  10999. /**
  11000. * 纹理资源。
  11001. */
  11002. export default class Texture extends PureResource {
  11003. get type(): ETextureType;
  11004. get width(): number;
  11005. get height(): number;
  11006. get slice(): number;
  11007. get mips(): number;
  11008. get pixelFormat(): ETextureFormat;
  11009. get wrapU(): EWrapMode;
  11010. set wrapU(value: EWrapMode);
  11011. get wrapV(): EWrapMode;
  11012. set wrapV(value: EWrapMode);
  11013. get wrapW(): EWrapMode;
  11014. set wrapW(value: EWrapMode);
  11015. get magFilter(): EFilterMode;
  11016. set magFilter(value: EFilterMode);
  11017. get minFilter(): EFilterMode;
  11018. set minFilter(value: EFilterMode);
  11019. get anisoLevel(): number;
  11020. set anisoLevel(value: number);
  11021. get sampleCount(): number;
  11022. set sampleCount(value: number);
  11023. get generateMipmaps(): boolean;
  11024. set generateMipmaps(value: boolean);
  11025. get isRenderTarget(): boolean;
  11026. set isRenderTarget(value: boolean);
  11027. constructor(options: ITextureOptions);
  11028. /**
  11029. * 在创建了纹理后,可以用此方法来更新。
  11030. */
  11031. update(options: {
  11032. /**
  11033. * `mipmap`等级。
  11034. */
  11035. level?: number;
  11036. /**
  11037. * 切片。
  11038. */
  11039. slice?: number;
  11040. /**
  11041. * x向偏移。
  11042. */
  11043. xoffset?: number;
  11044. /**
  11045. * x向偏移。
  11046. */
  11047. yoffset?: number;
  11048. /**
  11049. * @internal。
  11050. */
  11051. zoffset?: number;
  11052. /**
  11053. * 宽,相对于x偏移。
  11054. */
  11055. width?: number;
  11056. /**
  11057. * 高,相对于y偏移。
  11058. */
  11059. height?: number;
  11060. /**
  11061. * 数据。
  11062. */
  11063. buffer: TTextureSource;
  11064. }): void;
  11065. showDebugInfo(): string;
  11066. }
  11067. }
  11068. declare module 'XrFrame/kanata/lib/frontend/resource/UniformBlock' {
  11069. /**
  11070. * UniformBlock.ts
  11071. *
  11072. * * @Date : 9/4/2020, 2:34:36 PM
  11073. */
  11074. import { IHandle } from 'XrFrame/kanata/lib/backend';
  11075. import UniformDescriptor from 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor';
  11076. import Texture from 'XrFrame/kanata/lib/frontend/resource/Texture';
  11077. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11078. /**
  11079. * 存储Uniform的一个区块。
  11080. */
  11081. export default class UniformBlock extends PureResource {
  11082. /**
  11083. * @internal
  11084. */
  11085. static CREATE_FAKE(descriptor: UniformDescriptor): FakeUniformBlock;
  11086. /**
  11087. * @internal
  11088. */
  11089. /**
  11090. * 描述符。
  11091. */
  11092. get descriptor(): UniformDescriptor;
  11093. /**
  11094. * @internal
  11095. */
  11096. get textures(): {
  11097. [name: string]: Texture;
  11098. };
  11099. /**
  11100. * @param descriptor 描述符。
  11101. */
  11102. constructor(descriptor: UniformDescriptor);
  11103. protected _createNativeObj(descriptor: UniformDescriptor): IHandle;
  11104. /**
  11105. * 是否包含某个成员uniform。
  11106. */
  11107. hasKey(key: string): boolean;
  11108. /**
  11109. * 设置某个成员uniform。
  11110. */
  11111. setUniform(key: string, value: ArrayLike<number> | Texture | number): boolean;
  11112. /**
  11113. * 获取某个成员uniform。
  11114. * 如果是返回`number`,则是纹理的id。
  11115. */
  11116. getUniform(key: string): Float32Array | number;
  11117. /**
  11118. * 获取某个成员uniform的texture实例。
  11119. */
  11120. getTexture(key: string): Texture;
  11121. /**
  11122. * @internal
  11123. */
  11124. /**
  11125. * @internal
  11126. */
  11127. setAllData(data: Float32Array): void;
  11128. /**
  11129. * 科隆某个uniform。
  11130. */
  11131. clone(): UniformBlock;
  11132. /**
  11133. * 复制某个uniform。
  11134. */
  11135. copy(ub: UniformBlock): void;
  11136. showDebugInfo(): string;
  11137. }
  11138. class FakeUniformBlock extends UniformBlock {
  11139. protected _createNativeObj(descriptor: UniformDescriptor): {
  11140. id: number;
  11141. data: ArrayBuffer;
  11142. };
  11143. }
  11144. export {};
  11145. }
  11146. declare module 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor' {
  11147. /**
  11148. * UniformDescriptor.ts
  11149. *
  11150. * * @Date : 9/4/2020, 2:34:50 PM
  11151. */
  11152. import { EUniformType, IUniformDescriptorOptions } from 'XrFrame/kanata/lib/backend';
  11153. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11154. /**
  11155. * UniformBlock描述符。
  11156. */
  11157. export default class UniformDescriptor extends PureResource {
  11158. /**
  11159. * @internal
  11160. */
  11161. get layout(): {
  11162. [key: string]: [EUniformType, number, number, number, EUniformType, boolean];
  11163. };
  11164. /**
  11165. * 以Float计的长度。
  11166. */
  11167. get size(): number;
  11168. constructor(options: IUniformDescriptorOptions);
  11169. /**
  11170. * @internal
  11171. */
  11172. hasKey(key: string): boolean;
  11173. /**
  11174. * @internal
  11175. */
  11176. setUniform(key: string, value: ArrayLike<number> | number, f32: Float32Array, u32: Uint32Array): void;
  11177. /**
  11178. * @internal
  11179. */
  11180. getUniform(key: string, f32: Float32Array, u32: Uint32Array): Float32Array | number;
  11181. /**
  11182. * @internal
  11183. */
  11184. }
  11185. }
  11186. declare module 'XrFrame/kanata/lib/frontend/resource/IndexBuffer' {
  11187. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11188. export default class IndexBuffer extends PureResource {
  11189. get byteSize(): number;
  11190. constructor(buffer: ArrayBuffer | ArrayBufferView, is32bits?: boolean);
  11191. update(buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  11192. }
  11193. }
  11194. declare module 'XrFrame/kanata/lib/frontend/resource/IndexData' {
  11195. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11196. export default class IndexData extends PureResource {
  11197. get data(): ArrayBuffer;
  11198. constructor(size: number);
  11199. }
  11200. }
  11201. declare module 'XrFrame/kanata/lib/frontend/resource/VertexBuffer' {
  11202. import VertexLayout from 'XrFrame/kanata/lib/frontend/resource/VertexLayout';
  11203. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11204. /**
  11205. * 顶点数据。
  11206. */
  11207. export default class VertexBuffer extends PureResource {
  11208. get byteSize(): number;
  11209. get layout(): VertexLayout;
  11210. constructor(buffer: ArrayBuffer | ArrayBufferView, layout: VertexLayout);
  11211. update(buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  11212. }
  11213. }
  11214. declare module 'XrFrame/kanata/lib/frontend/resource/VertexData' {
  11215. /**
  11216. * VertexData.ts
  11217. *
  11218. * * @Date : 9/11/2020, 4:43:52 PM
  11219. */
  11220. import VertexDataDescriptor from 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor';
  11221. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11222. import VertexLayout from 'XrFrame/kanata/lib/frontend/resource/VertexLayout';
  11223. /**
  11224. * 用于合批的顶点数据。
  11225. */
  11226. export default class VertexData extends PureResource {
  11227. get layout(): VertexLayout;
  11228. get data(): ArrayBuffer;
  11229. constructor(layout: VertexLayout, size: number, batchDesc: VertexDataDescriptor);
  11230. }
  11231. }
  11232. declare module 'XrFrame/kanata/lib/frontend/resource/VertexLayout' {
  11233. /**
  11234. * VertexLayout.ts
  11235. *
  11236. * * @Date : 9/4/2020, 5:01:51 PM
  11237. */
  11238. import { IVertexLayoutOptions, EVertexLayoutUsage } from 'XrFrame/kanata/lib/backend';
  11239. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11240. /**
  11241. * 顶点布局描述。
  11242. */
  11243. export default class VertexLayout extends PureResource {
  11244. /**
  11245. * 顶点数据单位步长。
  11246. */
  11247. get stride(): number;
  11248. constructor(options: IVertexLayoutOptions);
  11249. /**
  11250. * 获取某个属性的配置。
  11251. */
  11252. getConfigByName(name: string): {
  11253. name: string;
  11254. format: import('XrFrame/kanata/lib/backend').EVertexFormat;
  11255. offset: number;
  11256. usage: EVertexLayoutUsage;
  11257. };
  11258. /**
  11259. * 获取某个用途的属性的配置。
  11260. */
  11261. getConfigByUsage(usage: EVertexLayoutUsage): {
  11262. name: string;
  11263. format: import('XrFrame/kanata/lib/backend').EVertexFormat;
  11264. offset: number;
  11265. usage: EVertexLayoutUsage;
  11266. };
  11267. }
  11268. }
  11269. declare module 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor' {
  11270. /**
  11271. * VertexDataDescriptor.ts
  11272. *
  11273. * * @Date : 4/28/2021, 4:38:37 PM
  11274. */
  11275. import { IVertexDataDescriptorOptions } from 'XrFrame/kanata/lib/backend';
  11276. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11277. /**
  11278. * 用于合批的顶点数据的描述符。
  11279. */
  11280. export default class VertexDataDescriptor extends PureResource {
  11281. constructor(options: IVertexDataDescriptorOptions);
  11282. }
  11283. }
  11284. declare module 'XrFrame/kanata/lib/frontend/resource/View' {
  11285. /**
  11286. * View.ts
  11287. *
  11288. * * @Date : 9/4/2020, 6:43:18 PM
  11289. */
  11290. import { IRect, IViewAction } from 'XrFrame/kanata/lib/backend';
  11291. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11292. /**
  11293. * 视图,用于控制清屏、视图区域等配置。
  11294. */
  11295. export default class View extends PureResource {
  11296. constructor(options: {
  11297. passAction: IViewAction;
  11298. viewport: IRect;
  11299. scissor: IRect;
  11300. });
  11301. }
  11302. }
  11303. declare module 'XrFrame/kanata/lib/frontend/resource/ScalableList' {
  11304. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource';
  11305. export const SL_MAP: Set<ScalableList>;
  11306. export function CHECK_SLS_RESIZE(): void;
  11307. export function CLEAR_SLS(): void;
  11308. /**
  11309. * 可扩容列表,用于存储Mesh的剔除结果以及绘制数据的id。
  11310. */
  11311. export default class ScalableList extends PureResource {
  11312. /**
  11313. * 当前全部可用的大小。
  11314. */
  11315. get size(): number;
  11316. /**
  11317. * 存储的id集合。
  11318. */
  11319. get dataView(): Uint32Array;
  11320. /**
  11321. * 当前已用的大小,一般不需要自己设置。
  11322. */
  11323. get usedSize(): number;
  11324. set usedSize(value: number);
  11325. constructor(initSize: number);
  11326. /**
  11327. * 扩容,将会扩大两倍,一般不需要自己调用。
  11328. *
  11329. * @param deprecatedSize will always be current size, don't use it!
  11330. */
  11331. enlarge(deprecatedSize?: number): void;
  11332. /**
  11333. * 初始化到准备`add`的阶段。
  11334. */
  11335. begin(): void;
  11336. /**
  11337. * 添加一个数据。
  11338. *
  11339. * @param deprecatedEnlargeSize will always be current size, don't use it!
  11340. */
  11341. add(id: number, deprecatedEnlargeSize?: number): void;
  11342. /**
  11343. * 结束此次所有`add`的流程。
  11344. */
  11345. end(): void;
  11346. /**
  11347. * 清空整个列表。
  11348. */
  11349. reset(): void;
  11350. }
  11351. }
  11352. declare module 'XrFrame/kanata/lib/frontend/shared/crossContext' {
  11353. /**
  11354. * 跨域信息通道,用于主域和子域之间的通信。
  11355. */
  11356. class CrossContext {
  11357. constructor();
  11358. postMessage(data: any): void;
  11359. onMessage(callback: (data: any) => void): void;
  11360. flush(): void;
  11361. }
  11362. let crossContext: CrossContext;
  11363. export default crossContext;
  11364. }
  11365. declare module 'XrFrame/components/particle/gradient' {
  11366. import Vector3 from "XrFrame/math/vector3";
  11367. import Vector4 from "XrFrame/math/vector4";
  11368. export class ColorGradient {
  11369. gradient: number;
  11370. color: Vector4;
  11371. color2: Vector4;
  11372. constructor(gradient: any, color: any, color2: any);
  11373. /**
  11374. * 获取具体颜色属性值
  11375. * @param {Vector4} 用于存储结果的临时变量
  11376. */
  11377. getColor(colorTemp: Vector4): void;
  11378. }
  11379. export class Color3Gradient {
  11380. gradient: number;
  11381. color: Vector3;
  11382. constructor(gradient: any, color: any);
  11383. }
  11384. export class FactorGradient {
  11385. gradient: number;
  11386. factor: number;
  11387. factor2: number;
  11388. constructor(gradient: any, factor: any, factor2: any);
  11389. /**
  11390. * 获取具体属性值
  11391. * @return {number} 插值后的属性大小
  11392. */
  11393. getFactor(): number;
  11394. }
  11395. export class BasicGradientMethod {
  11396. /**
  11397. * 从获取具体时刻的属性大小
  11398. * @param {number} ratio 粒子所处生命周期的阶段
  11399. * @param {Array} gradients 存储不同时刻指定属性变化的数组
  11400. * @param {Callback} updateFunc 回调函数
  11401. */
  11402. static GetCurrentGradient(ratio: any, gradients: any, updateFunc: any): void;
  11403. }
  11404. }
  11405. declare module 'XrFrame/components/emitter/BoxShapeEmitter' {
  11406. import Vector3 from 'XrFrame/math/vector3';
  11407. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11408. export default class BoxShapeEmitter extends BasicShapeEmitter {
  11409. direction: Vector3;
  11410. direction2: Vector3;
  11411. minEmitBox: Vector3;
  11412. maxEmitBox: Vector3;
  11413. constructor();
  11414. startDirection(worldMatrix: any, direction: any): void;
  11415. startPosition(worldMatrix: any, position: Vector3): void;
  11416. }
  11417. }
  11418. declare module 'XrFrame/components/emitter/PointShapeEmitter' {
  11419. import Vector3 from 'XrFrame/math/vector3';
  11420. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11421. export default class PointShapeEmitter extends BasicShapeEmitter {
  11422. /**
  11423. * 粒子运动方向左区间。
  11424. */
  11425. direction: Vector3;
  11426. /**
  11427. * 粒子运动方向右区间。
  11428. */
  11429. direction2: Vector3;
  11430. constructor();
  11431. startDirection(worldMatrix: any, direction: any): void;
  11432. startPosition(worldMatrix: any, position: Vector3): void;
  11433. }
  11434. }
  11435. declare module 'XrFrame/components/emitter/DrawShapeEmitter' {
  11436. import Vector3 from "XrFrame/math/vector3";
  11437. import ParticleInstance from "XrFrame/components/particle/ParticleInstance";
  11438. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11439. export default class DrawShapeEmitter extends BasicShapeEmitter {
  11440. direction: Vector3;
  11441. constructor();
  11442. setContent(content: any, step?: number): void;
  11443. translateBase64ToArrayBuffer(base64: any): ArrayBufferLike;
  11444. startDirection(worldMatrix: any, direction: any): void;
  11445. startPosition(worldMatrix: any, position: Vector3): void;
  11446. processInstance(instance: ParticleInstance, deltaTime: number): void;
  11447. lerpNumberArrayToVector(vector: any, numberArray1: any, numberArray2: any, step: any, length?: number): void;
  11448. }
  11449. }
  11450. declare module 'XrFrame/components/emitter/SphereShapeEmitter' {
  11451. import Vector3 from 'XrFrame/math/vector3';
  11452. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11453. import Matrix4 from 'XrFrame/math/matrix4';
  11454. export default class SphereShapeEmitter extends BasicShapeEmitter {
  11455. /**
  11456. * 球形半径
  11457. */
  11458. radius: number;
  11459. /**
  11460. * 球形区域覆盖范围[0-1]
  11461. */
  11462. radiusRange: number;
  11463. /**
  11464. * 粒子在球形内生成的角度区间[0-360]
  11465. */
  11466. arc: number;
  11467. /**
  11468. * 粒子运动方向偏离程度[0-1]
  11469. */
  11470. randomizeDirection: number;
  11471. constructor();
  11472. startDirection(worldMatrix: Matrix4, direction: Vector3, position: Vector3): void;
  11473. startPosition(worldMatrix: Matrix4, position: Vector3): void;
  11474. }
  11475. }
  11476. declare module 'XrFrame/components/emitter/ConeShapeEmitter' {
  11477. import Vector3 from 'XrFrame/math/vector3';
  11478. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11479. export default class ConeShapeEmitter extends BasicShapeEmitter {
  11480. /**
  11481. * [0-1]
  11482. */
  11483. radiusRange: number;
  11484. heightRange: number;
  11485. /**
  11486. * [0-360]
  11487. */
  11488. arc: number;
  11489. /**
  11490. * randomize the particle direction [0-1]
  11491. */
  11492. randomizeDirection: number;
  11493. get radius(): number;
  11494. set radius(value: number);
  11495. get angle(): number;
  11496. set angle(value: number);
  11497. updateHeight(): void;
  11498. constructor();
  11499. startDirection(worldMatrix: any, direction: any, position: Vector3): void;
  11500. startPosition(worldMatrix: any, position: Vector3): void;
  11501. }
  11502. }
  11503. declare module 'XrFrame/components/emitter/CircleShapeEmitter' {
  11504. import Vector3 from 'XrFrame/math/vector3';
  11505. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter';
  11506. import Matrix4 from 'XrFrame/math/matrix4';
  11507. export default class CircleShapeEmitter extends BasicShapeEmitter {
  11508. radius: number;
  11509. radiusRange: number;
  11510. direction: Vector3;
  11511. direction2: Vector3;
  11512. arc: number;
  11513. angle: number;
  11514. constructor();
  11515. startDirection(worldMatrix: Matrix4, direction: Vector3, position: Vector3): void;
  11516. startPosition(worldMatrix: any, position: Vector3): void;
  11517. }
  11518. }
  11519. declare module 'XrFrame/render-graph/RGNode' {
  11520. /**
  11521. * RGNode.ts
  11522. *
  11523. * * @Date : 1/13/2021, 8:29:55 PM
  11524. */
  11525. import { Kanata } from 'XrFrame/ext';
  11526. import Camera from 'XrFrame/components/Camera';
  11527. import { IRenderTarget } from 'XrFrame/assets/RenderTexture';
  11528. type RenderGraph = import('XrFrame/render-graph/RenderGraph').default;
  11529. type RenderSystem = import('XrFrame/systems/RenderSystem').default;
  11530. type Scene = import('XrFrame/core/Scene').default;
  11531. export type TRGNodeAny = RGNode<any, any, any>;
  11532. /**
  11533. * RGNode支持传输的数据类型。
  11534. * 可扩展。
  11535. *
  11536. * @category Render
  11537. */
  11538. export interface IRGData {
  11539. /**
  11540. * 空数据类型。
  11541. */
  11542. None: void;
  11543. /**
  11544. * 相机类型。
  11545. */
  11546. Camera: Camera;
  11547. /**
  11548. * 渲染目标类型。
  11549. */
  11550. RenderTarget: IRenderTarget;
  11551. /**
  11552. * Mesh列表,一般作为剔除节点的输出,作为渲染节点的输入。
  11553. */
  11554. MeshList: Kanata.ScalableList;
  11555. }
  11556. /**
  11557. * RGNode支持的节点类型。
  11558. */
  11559. export enum ERGNodeType {
  11560. Camera = "Camera",
  11561. Clear = "Clear",
  11562. Cull = "Cull",
  11563. Render = "Render",
  11564. Script = "Script"
  11565. }
  11566. /**
  11567. * 渲染节点基类。
  11568. */
  11569. export default abstract class RGNode<TInputs extends {
  11570. [key: string]: keyof IRGData;
  11571. }, TOutput extends keyof IRGData, IOptions> {
  11572. protected _parent: RenderGraph;
  11573. protected _id: number;
  11574. protected _name: string;
  11575. protected _options: IOptions;
  11576. /**
  11577. * 节点类型。
  11578. *
  11579. * @internal
  11580. */
  11581. type: ERGNodeType;
  11582. /**
  11583. * 节点输入的数据类型。
  11584. */
  11585. abstract inputTypes: TInputs;
  11586. /**
  11587. * 节点输出的数据类型。
  11588. */
  11589. abstract outputType: TOutput;
  11590. protected _output?: IRGData[TOutput];
  11591. protected _inputs: {
  11592. [key: string]: TRGNodeAny;
  11593. };
  11594. protected _outputs: {
  11595. [id: number]: string;
  11596. };
  11597. /**
  11598. * 节点的初始化配置参数。
  11599. */
  11600. get options(): IOptions;
  11601. /**
  11602. * 节点名字。
  11603. */
  11604. get name(): string;
  11605. /**
  11606. * 节点id。
  11607. */
  11608. get id(): number;
  11609. /**
  11610. * 获取当前游戏实例。
  11611. */
  11612. get scene(): Scene;
  11613. /**
  11614. * 获取当前节点输出。
  11615. */
  11616. get output(): IRGData[TOutput];
  11617. /**
  11618. * 不要直接调用,请使用`renderGraph.createNode`方法。
  11619. */
  11620. constructor(_parent: RenderGraph, _id: number, _name: string, _options: IOptions);
  11621. /**
  11622. * 节点初始化后的回调。
  11623. */
  11624. onInit(options: IOptions): void;
  11625. /**
  11626. * 获取某个节点的输入。
  11627. */
  11628. getInput<TKey extends keyof TInputs>(key: TKey): IRGData[TInputs[TKey]];
  11629. /**
  11630. * @internal
  11631. */
  11632. /**
  11633. * @internal
  11634. */
  11635. /**
  11636. * @internal
  11637. */
  11638. /**
  11639. * @internal
  11640. */
  11641. /**
  11642. * 重置节点状态,清空输入,一般用于可缓存的节点优化。
  11643. */
  11644. reset(): void;
  11645. /**
  11646. * 节点在真正被第一次使用时的回调。
  11647. */
  11648. onActive(context: RenderSystem, options: IOptions): void;
  11649. /**
  11650. * 节点在每帧执行时的回调。
  11651. */
  11652. onExecute(context: RenderSystem, options: IOptions): void;
  11653. /**
  11654. * 节点在被图中移除时的回调。
  11655. */
  11656. onDisable(context: RenderSystem, options: IOptions): void;
  11657. }
  11658. export {};
  11659. }
  11660. declare module 'XrFrame/physics/RaycastHit' {
  11661. import { Scene } from "XrFrame/elements";
  11662. import Vector3 from "XrFrame/math/vector3";
  11663. import Shape from "XrFrame/components/physics/Shape";
  11664. export default class RaycastHit {
  11665. constructor(scene: Scene, nativeComp?: phys3D.RaycastHit);
  11666. /**
  11667. * native层真正的raycastHit对象,业务侧无需关心
  11668. */
  11669. get nativeRaycastHit(): phys3D.RaycastHit;
  11670. /**
  11671. * 被射线射中的collider所附的Rigidbody,如果collider没有附着在一个Rigidbody上,则为null
  11672. */
  11673. get rigidbody(): any;
  11674. /**
  11675. * 被射线射中的collider
  11676. */
  11677. get collider(): Shape;
  11678. /**
  11679. * 从光线的原点到碰撞点的距离
  11680. */
  11681. get distance(): number;
  11682. set distance(v: number);
  11683. /**
  11684. * 射线锁碰到的表面的法线
  11685. */
  11686. get normal(): Vector3;
  11687. set normal(v: Vector3);
  11688. /**
  11689. * 在世界空间中,射线碰到collider的碰撞点
  11690. */
  11691. get point(): Vector3;
  11692. set point(v: Vector3);
  11693. }
  11694. }
  11695. declare module 'XrFrame/loader/glTF/animations/GLTFAnimationNode' {
  11696. import { Kanata } from "XrFrame/ext";
  11697. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  11698. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11699. import { GLTFNodesLoaded } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  11700. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  11701. import { GLTFChannelsLoaded, GLTFChannelsNodeRaw } from "XrFrame/loader/glTF/animations/channels/GLTFChannelsNode";
  11702. import { GLTFSamplersNodeRaw } from "XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode";
  11703. /**
  11704. * 二进制格式
  11705. * | contentoffset | fps(float) | totalFrame | totalSampleGroup |
  11706. * | Array<PuppetAnimationSampleGroup> |
  11707. *
  11708. * @see PuppetAnimationSampleGroup at GLTFChannelNode.ts
  11709. */
  11710. export type PuppetAnimationClipModel = ArrayBuffer | GLTF.BufferView;
  11711. export interface GLTFAnimationNodeRaw {
  11712. channels: GLTFChannelsNodeRaw;
  11713. samplers: GLTFSamplersNodeRaw;
  11714. name?: string;
  11715. }
  11716. export interface GLTFAnimationLoaded {
  11717. clip: Kanata.AnimationClipModel;
  11718. channels: GLTFChannelsLoaded;
  11719. frameCount: number;
  11720. name?: string;
  11721. }
  11722. export default class GLTFAnimationNode extends GLTFBaseNode {
  11723. get nodeName(): string;
  11724. readonly raw: GLTFAnimationNodeRaw;
  11725. resource: GLTFAnimationLoaded | null;
  11726. build(): void;
  11727. preload(prerequisites: [accessors: GLTFAccessorsLoaded, nodes: GLTFNodesLoaded]): Promise<GLTFAnimationLoaded>;
  11728. getLoadedResource(): GLTFAnimationLoaded;
  11729. }
  11730. }
  11731. declare module 'XrFrame/loader/glTF/buffers/GLTFAccessorNode' {
  11732. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  11733. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11734. import { GLTFBufferViewLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferViewNode";
  11735. import { GLTFBufferViewsLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferViewsNode";
  11736. export enum EnumGLTFAccessorComponentType {
  11737. BYTE = 5120,
  11738. UNSIGNED_BYTE = 5121,
  11739. SHORT = 5122,
  11740. UNSIGNED_SHORT = 5123,
  11741. UNSIGNED_INT = 5125,
  11742. FLOAT = 5126
  11743. }
  11744. export const GLTFAccessorComponentTypeToViewClass: {
  11745. 5120: Int8ArrayConstructor;
  11746. 5121: Uint8ArrayConstructor;
  11747. 5122: Int16ArrayConstructor;
  11748. 5123: Uint16ArrayConstructor;
  11749. 5125: Uint32ArrayConstructor;
  11750. 5126: Float32ArrayConstructor;
  11751. };
  11752. export const GLTFAccessorTypeToNumberOfElements: {
  11753. SCALAR: number;
  11754. VEC2: number;
  11755. VEC3: number;
  11756. VEC4: number;
  11757. MAT2: number;
  11758. MAT3: number;
  11759. MAT4: number;
  11760. };
  11761. export interface GLTFAccessorNodeRaw {
  11762. bufferView?: number;
  11763. byteOffset?: number;
  11764. componentType: number;
  11765. count: number;
  11766. min?: Array<number>;
  11767. max?: Array<number>;
  11768. type: string;
  11769. normalized?: boolean;
  11770. sparse?: boolean;
  11771. name?: string;
  11772. }
  11773. /**
  11774. * 以FloatVec3为例:
  11775. * 一个component指一个float,
  11776. * 一个element指三个float。
  11777. */
  11778. export interface GLTFAccessorLoaded {
  11779. bufferView: GLTFBufferViewLoaded;
  11780. bufferViewIndex: number;
  11781. view: GLTF.BufferView;
  11782. elementLength: number;
  11783. bytesPerComponent: number;
  11784. count: number;
  11785. stride: number;
  11786. byteStride: number;
  11787. componentType: EnumGLTFAccessorComponentType;
  11788. max?: Array<number>;
  11789. min?: Array<number>;
  11790. compact: boolean;
  11791. getCompAt(element: number, comp: number): any;
  11792. }
  11793. export default class GLTFAccessorNode extends GLTFBaseNode {
  11794. get nodeName(): string;
  11795. readonly raw: GLTFAccessorNodeRaw;
  11796. build(): void;
  11797. preload(prerequisites: [GLTFBufferViewsLoaded]): Promise<GLTFAccessorLoaded>;
  11798. getLoadedResource(): GLTFAccessorLoaded;
  11799. }
  11800. }
  11801. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferNode' {
  11802. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11803. export interface GLTFBufferNodeRaw {
  11804. uri?: string;
  11805. byteLength: number;
  11806. name?: string;
  11807. }
  11808. export type GLTFBufferLoaded = ArrayBuffer;
  11809. export default class GLTFBufferNode extends GLTFBaseNode {
  11810. get nodeName(): string;
  11811. readonly raw: GLTFBufferNodeRaw;
  11812. build(): void;
  11813. preload(): Promise<GLTFBufferLoaded>;
  11814. getLoadedResource(): GLTFBufferLoaded;
  11815. }
  11816. }
  11817. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferViewNode' {
  11818. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11819. import { GLTFBufferLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferNode";
  11820. export interface GLTFBufferViewNodeRaw {
  11821. buffer: number;
  11822. byteLength: number;
  11823. byteOffset?: number;
  11824. byteStride?: number;
  11825. target?: EnumGLTFBufferViewTarget;
  11826. name?: string;
  11827. }
  11828. export interface GLTFBufferViewLoaded {
  11829. data: ArrayBuffer;
  11830. byteOffset: number;
  11831. byteStride: number;
  11832. byteLength: number;
  11833. target: EnumGLTFBufferViewTarget;
  11834. getSlicedData(): ArrayBuffer;
  11835. getUint8View(): Uint8Array;
  11836. _sliced: ArrayBuffer;
  11837. }
  11838. export enum EnumGLTFBufferViewTarget {
  11839. ARRAY_BUFFER = 34962,
  11840. ELEMENT_ARRAY_BUFFER = 34963
  11841. }
  11842. export default class GLTFBufferViewNode extends GLTFBaseNode {
  11843. get nodeName(): string;
  11844. readonly raw: GLTFBufferViewNodeRaw;
  11845. build(): void;
  11846. preload(prerequisites: [GLTFBufferLoaded]): Promise<GLTFBufferViewLoaded>;
  11847. getLoadedResource(): GLTFBufferViewLoaded;
  11848. }
  11849. }
  11850. declare module 'XrFrame/loader/glTF/geometry/GLTFMeshNode' {
  11851. import { Kanata } from "XrFrame/ext";
  11852. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  11853. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11854. import { GLTFMaterialsLoaded } from "XrFrame/loader/glTF/materials/GLTFMaterialsNode";
  11855. import { GLTFPrimitivesLoaded, GLTFPrimitivesNodeRaw } from "XrFrame/loader/glTF/geometry/primitives/GLTFPrimitivesNode";
  11856. export interface GLTFMeshNodeRaw {
  11857. primitives: GLTFPrimitivesNodeRaw;
  11858. weights?: Array<number>;
  11859. name?: string;
  11860. }
  11861. export interface GLTFMeshLoaded {
  11862. subMeshes: GLTFPrimitivesLoaded;
  11863. weights: Array<number>;
  11864. name?: string;
  11865. }
  11866. export default class GLTFMeshNode extends GLTFBaseNode {
  11867. get nodeName(): string;
  11868. readonly raw: GLTFMeshNodeRaw;
  11869. build(): void;
  11870. preload(prerequisites: [materials: GLTFMaterialsLoaded, accessors: GLTFAccessorsLoaded, vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>]): Promise<GLTFMeshLoaded>;
  11871. getLoadedResource(): GLTFMeshLoaded;
  11872. }
  11873. }
  11874. declare module 'XrFrame/loader/glTF/materials/GLTFMaterialNode' {
  11875. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11876. import GLTFTextureInfoNode, { GLTFTextureInfoNodeRaw } from "XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode";
  11877. import GLTFPBRMetallicRoughnessNode, { GLTFPBRMetallicRoughnessNodeRaw } from "XrFrame/loader/glTF/materials/pbr/GLTFPBRMetallicRoughnessNode";
  11878. import GLTFNormalTextureInfoNode, { GLTFNormalTextureInfoNodeRaw } from "XrFrame/loader/glTF/materials/texture/GLTFNormalTextureInfoNode";
  11879. import GLTFOcclusionTextureInfoNode, { GLTFOcclusionTextureInfoNodeRaw } from "XrFrame/loader/glTF/materials/texture/GLTFOcclusionTextureInfoNode";
  11880. import Material from "XrFrame/assets/Material";
  11881. import { IRenderStates } from "XrFrame/assets/Effect";
  11882. import { GLTFTexturesLoaded } from "XrFrame/loader/glTF/textures/GLTFTexturesNode";
  11883. export interface GLTFMaterialExtArgs {
  11884. uniform: object;
  11885. renderStates: IRenderStates;
  11886. macros: object;
  11887. }
  11888. export enum EnumGLTFMaterialAlphaMode {
  11889. OPAQUE = 0,
  11890. MASK = 1,
  11891. BLEND = 2
  11892. }
  11893. export interface GLTFMaterialNodeRaw {
  11894. name?: string;
  11895. pbrMetallicRoughness?: GLTFPBRMetallicRoughnessNodeRaw;
  11896. normalTexture?: GLTFNormalTextureInfoNodeRaw;
  11897. occlusionTexture?: GLTFOcclusionTextureInfoNodeRaw;
  11898. emissiveTexture?: GLTFTextureInfoNodeRaw;
  11899. emissiveFactor?: [number, number, number];
  11900. alphaMode?: string;
  11901. alphaCutoff?: number;
  11902. doubleSided?: boolean;
  11903. }
  11904. export type GLTFMaterialPrerequisites = [textrues: GLTFTexturesLoaded];
  11905. export type GLTFMaterialLoaded = Material;
  11906. export default class GLTFMaterialNode extends GLTFBaseNode {
  11907. get nodeName(): string;
  11908. readonly raw: GLTFMaterialNodeRaw;
  11909. resource: GLTFMaterialLoaded | null;
  11910. pbrMetallicRoughness: GLTFPBRMetallicRoughnessNode | undefined;
  11911. normalTexture: GLTFNormalTextureInfoNode | undefined;
  11912. occlusionTexture: GLTFOcclusionTextureInfoNode | undefined;
  11913. emissiveTexture: GLTFTextureInfoNode | undefined;
  11914. build(): void;
  11915. /**
  11916. * @internal
  11917. */
  11918. preloadWithoutPBR(prerequisites: GLTFMaterialPrerequisites): Promise<GLTFMaterialExtArgs>;
  11919. /**
  11920. * 实际上不一定会走到这里,mesh没有material也是合法的,这时候会去取emptyMaterial。
  11921. */
  11922. preload(prerequisites: [textrues: GLTFTexturesLoaded]): Promise<GLTFMaterialLoaded>;
  11923. getLoadedResource(): GLTFMaterialLoaded;
  11924. }
  11925. }
  11926. declare module 'XrFrame/loader/glTF/skins/GLTFSkinNode' {
  11927. import { Kanata } from "XrFrame/ext";
  11928. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  11929. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11930. export interface GLTFSkinNodeRaw {
  11931. inverseBindMatrices?: number;
  11932. skeleton?: number;
  11933. joints: Array<number>;
  11934. }
  11935. export interface GLTFSkinLoaded {
  11936. inverseBindMatrices: Kanata.SkeletonBoneInverseModel;
  11937. skeleton?: number;
  11938. joints: Array<number>;
  11939. }
  11940. export default class GLTFSkinNode extends GLTFBaseNode {
  11941. get nodeName(): string;
  11942. readonly raw: GLTFSkinNodeRaw;
  11943. resource: GLTFSkinLoaded | null;
  11944. build(): void;
  11945. preload(prerequisites: [accessors: GLTFAccessorsLoaded]): Promise<GLTFSkinLoaded>;
  11946. getLoadedResource(): GLTFSkinLoaded;
  11947. }
  11948. }
  11949. declare module 'XrFrame/loader/glTF/textures/GLTFImageNode' {
  11950. import { Kanata } from "XrFrame/ext";
  11951. import { GLTFBufferViewsLoaded } from "XrFrame/loader/glTF/buffers/GLTFBufferViewsNode";
  11952. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11953. export interface GLTFImageNodeRaw {
  11954. uri?: string;
  11955. mimeType?: string;
  11956. bufferView?: number;
  11957. name?: string;
  11958. }
  11959. export interface GLTFImageLoaded {
  11960. kanataImage?: Kanata.IImage;
  11961. type?: string;
  11962. }
  11963. export default class GLTFImageNode extends GLTFBaseNode {
  11964. get nodeName(): string;
  11965. readonly raw: GLTFImageNodeRaw;
  11966. build(): void;
  11967. preload(prerequisites: [bufferViews: GLTFBufferViewsLoaded]): Promise<GLTFImageLoaded>;
  11968. getLoadedResource(): GLTFImageLoaded;
  11969. }
  11970. }
  11971. declare module 'XrFrame/loader/glTF/textures/GLTFSamplerNode' {
  11972. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  11973. export enum EnumGLTFSamplerFilter {
  11974. NEAREST = 9728,
  11975. LINEAR = 9729,
  11976. NEAREST_MIPMAP_NEAREST = 9984,
  11977. LINEAR_MIPMAP_NEAREST = 9985,
  11978. NEAREST_MIPMAP_LINEAR = 9986,
  11979. LINEAR_MIPMAP_LINEAR = 9987
  11980. }
  11981. export function NeedMipmap(sampler: EnumGLTFSamplerFilter): boolean;
  11982. export enum EnumGLTFSamplerWrap {
  11983. CLAMP_TO_EDGE = 33071,
  11984. MIRRORED_REPEAT = 33648,
  11985. REPEAT = 10497
  11986. }
  11987. export interface GLTFSamplerNodeRaw {
  11988. magFilter?: number;
  11989. minFilter?: number;
  11990. wrapS?: number;
  11991. wrapT?: number;
  11992. name?: string;
  11993. }
  11994. export interface GLTFSamplerLoaded {
  11995. magFilter: EnumGLTFSamplerFilter;
  11996. minFilter: EnumGLTFSamplerFilter;
  11997. wrapS: EnumGLTFSamplerWrap;
  11998. wrapT: EnumGLTFSamplerWrap;
  11999. }
  12000. export default class GLTFSamplerNode extends GLTFBaseNode {
  12001. get nodeName(): string;
  12002. readonly raw: GLTFSamplerNodeRaw;
  12003. build(): void;
  12004. preload(): Promise<GLTFSamplerLoaded>;
  12005. getLoadedResource(): GLTFSamplerLoaded;
  12006. }
  12007. }
  12008. declare module 'XrFrame/loader/glTF/textures/GLTFTextureNode' {
  12009. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12010. import { GLTFImagesLoaded } from "XrFrame/loader/glTF/textures/GLTFImagesNode";
  12011. import { GLTFSamplersLoaded } from "XrFrame/loader/glTF/textures/GLTFSamplersNode";
  12012. import { Kanata } from "XrFrame/ext";
  12013. export interface GLTFTextureNodeRaw {
  12014. sampler?: number;
  12015. source?: number;
  12016. name?: string;
  12017. }
  12018. export type GLTFTextureLoaded = Kanata.Texture;
  12019. export default class GLTFTextureNode extends GLTFBaseNode {
  12020. get nodeName(): string;
  12021. readonly raw: GLTFTextureNodeRaw;
  12022. build(): void;
  12023. preload(prerequisites: [images: GLTFImagesLoaded, samplers: GLTFSamplersLoaded]): Promise<GLTFTextureLoaded>;
  12024. getLoadedResource(): GLTFTextureLoaded;
  12025. }
  12026. }
  12027. declare module 'XrFrame/loader/glTF/utils/types' {
  12028. import { ITransformData } from "XrFrame/components";
  12029. import { Kanata } from "XrFrame/ext";
  12030. import Quaternion from "XrFrame/math/quaternion";
  12031. import Vector3, { Vector3_READONLY } from "XrFrame/math/vector3";
  12032. export namespace GLTF {
  12033. type BufferView = Int8Array | Uint8Array | Uint16Array | Uint32Array | Float32Array;
  12034. type IndexBufferView = Uint16Array | Uint32Array | Uint8Array;
  12035. class BoundingBox {
  12036. min: Vector3;
  12037. max: Vector3;
  12038. adoptMin: (newMin: Vector3) => void;
  12039. adoptMax: (newMax: Vector3) => void;
  12040. }
  12041. interface BoundingBox_READONLY {
  12042. min: Vector3_READONLY;
  12043. max: Vector3_READONLY;
  12044. }
  12045. namespace BoundingBox {
  12046. function createZero(): BoundingBox;
  12047. function createInfinite(): BoundingBox;
  12048. }
  12049. interface VertexLayoutDesc extends Kanata.IVertexLayoutOptions {
  12050. stride: number;
  12051. }
  12052. interface VertexProperties {
  12053. buffer: Float32Array;
  12054. layoutDesc: VertexLayoutDesc;
  12055. layout: Kanata.VertexLayout;
  12056. macros: object;
  12057. boundingBox: BoundingBox;
  12058. /**
  12059. * 是否需要自行生成normal和tangent的顶点数据。
  12060. */
  12061. lackNormal: boolean;
  12062. lackTangent: boolean;
  12063. /**
  12064. * 如果需要生成的话,生成在layoutDesc的哪个attribute里。
  12065. */
  12066. normalSlot: number;
  12067. tangentSlot: number;
  12068. }
  12069. interface Transform extends ITransformData {
  12070. /**
  12071. * 同时有quat和rotation的情况下,quat优先;
  12072. * 目前只会填写quat,不会填写rotation。
  12073. */
  12074. quat?: Quaternion;
  12075. }
  12076. }
  12077. }
  12078. declare module 'XrFrame/kanata/lib/backend' {
  12079. /**
  12080. * index.ts
  12081. *
  12082. * * @Date : 9/3/2020, 8:45:18 PM
  12083. */
  12084. export * from 'XrFrame/kanata/lib/backend/interface';
  12085. import { IImage } from 'XrFrame/kanata/lib/backend/interface';
  12086. import { IWorker } from 'XrFrame/kanata/lib/backend/interface/IWorker';
  12087. export interface IBackend {
  12088. IS_VALID: () => boolean;
  12089. GET_MAIN_CANVAS(): HTMLCanvasElement;
  12090. worker: IWorker;
  12091. Image: {
  12092. new (): IImage;
  12093. IS(obj: any): obj is IImage;
  12094. };
  12095. Phys3D: any;
  12096. }
  12097. const backend: IBackend;
  12098. export default backend;
  12099. }
  12100. declare module 'XrFrame/kanata/lib/frontend/shared/NativeObject' {
  12101. /**
  12102. * NativeObject.ts
  12103. *
  12104. * * @Date : 9/3/2020, 9:17:03 PM
  12105. */
  12106. import { IHandle } from 'XrFrame/kanata/lib/backend';
  12107. export default class NativeObject {
  12108. _bufferName: string;
  12109. _byteOffset: number;
  12110. _bufferLength: number;
  12111. id: number;
  12112. _buffer: ArrayBuffer;
  12113. _f32view: Float32Array;
  12114. _u32view: Uint32Array;
  12115. protected _handle: IHandle;
  12116. protected _init(info: IHandle): void;
  12117. protected _fastInit(info: IHandle): void;
  12118. protected _initU32View(): void;
  12119. protected _initPropertyView(offset: number, length: number): Float32Array;
  12120. setRawBuffer(data: Float32Array): void;
  12121. destroy(): void;
  12122. }
  12123. }
  12124. declare module 'XrFrame/kanata/lib/frontend/pool/PoolObject' {
  12125. import Pool from 'XrFrame/kanata/lib/frontend/pool/Pool';
  12126. export interface INativePools {
  12127. [poolId: number]: Pool;
  12128. }
  12129. export default class PoolObject {
  12130. protected _nativePool: Pool;
  12131. protected _nativeId: number;
  12132. protected _poolId: number;
  12133. protected _poolIndex: number;
  12134. protected _using: boolean;
  12135. entityOffset: number;
  12136. get float32View(): Float32Array;
  12137. get uint32View(): Uint32Array;
  12138. get id(): number;
  12139. get poolId(): number;
  12140. get poolIndex(): number;
  12141. get poll(): any;
  12142. get isUsing(): boolean;
  12143. set isUsing(value: boolean);
  12144. protected _init(nativeObjId: number, nativePools: INativePools): void;
  12145. setRawBuffer(data: Float32Array): void;
  12146. }
  12147. }
  12148. declare module 'XrFrame/kanata/lib/frontend/pool/PoolManager' {
  12149. /**
  12150. * PoolManager.ts
  12151. *
  12152. * * @Date : 9/3/2020, 9:19:34 PM
  12153. */
  12154. import { IHandle } from 'XrFrame/kanata/lib/backend';
  12155. import PoolObject, { INativePools } from 'XrFrame/kanata/lib/frontend/pool/PoolObject';
  12156. export default class PoolManager {
  12157. pools: INativePools;
  12158. constructor(template: ArrayBuffer, templateView: Float32Array, allocateFunc: (size: number) => IHandle, extendedMemSize?: number);
  12159. allocateOne(): number;
  12160. dispose(obj: PoolObject): void;
  12161. }
  12162. }
  12163. declare module 'XrFrame/kanata/lib/frontend/shared/PureResource' {
  12164. /**
  12165. * PureResource.ts
  12166. *
  12167. * * @Date : 9/8/2020, 9:04:32 PM
  12168. */
  12169. import { IHandle } from 'XrFrame/kanata/lib/backend';
  12170. export default class PureResource {
  12171. id: number;
  12172. __handle: IHandle;
  12173. protected get _handle(): IHandle;
  12174. protected set _handle(value: IHandle);
  12175. destroy(): void;
  12176. }
  12177. }
  12178. declare module 'XrFrame/kanata/lib/backend/native/worker' {
  12179. import { IHandle, ETextureType, ETextureFormat, IRect, EMeshRenderType, INativeMap, ILongIntNativeMap, IGlyphInfo, IRenderEnv } from 'XrFrame/kanata/lib/backend/interface';
  12180. export interface INativeWorker {
  12181. createVertexLayout(options: string): IHandle;
  12182. createVertexDataDescriptor(options: string): IHandle;
  12183. createVertexBuffer(buffer: ArrayBuffer | ArrayBufferView, layout: number): IHandle;
  12184. updateVertexBuffer(bufferId: number, buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  12185. createIndexBuffer(buffer: ArrayBuffer | ArrayBufferView, is32bits?: boolean): IHandle;
  12186. updateIndexBuffer(bufferId: number, buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  12187. createVertexData(layout: number, size: number, batchDesc: number): IHandle;
  12188. createIndexData(size: number): IHandle;
  12189. createTexture(type: ETextureType, width: number, height: number, slice: number, mips: number, format: ETextureFormat, flags: number, buffer: (ArrayBuffer | ArrayBufferView)[], offsets: Uint32Array): IHandle;
  12190. createTexture(canvas: HTMLCanvasElement): IHandle;
  12191. updateTexture(id: number, level: number, slice: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, buffer: ArrayBuffer | ArrayBufferView): void;
  12192. updateTextureFlags(textureId: number, flags: number): void;
  12193. createShader(vs: string, fs: string): IHandle;
  12194. createUniformBlockDescriptor(descriptor: string): IHandle;
  12195. createUniformBlock(descriptor: number): IHandle;
  12196. createEffect(name: string, passCount: number, keyIndexMap: string, passes: string, shaders: string[], variants: string, flags: number): IHandle & {
  12197. warmUp(): void;
  12198. };
  12199. createMaterial(macros: string): IHandle;
  12200. changeMaterialMacros(material: number, macros: string, reset?: boolean): void;
  12201. createScalableList(initSize: number, onBackendEnlarge: () => void): IHandle & {
  12202. enlarge(size: number): void;
  12203. };
  12204. }
  12205. export interface INativeWorker {
  12206. createView(view: string): IHandle;
  12207. updateViewRect(view: number, rect: IRect): void;
  12208. updateViewScissor(view: number, rect: IRect): void;
  12209. }
  12210. export interface INativeWorker {
  12211. createRenderPass(descriptor: string): IHandle;
  12212. }
  12213. export interface INativeWorker {
  12214. createNodePool(count: number, is3d: boolean): IHandle;
  12215. createNodeTree(length: number, ids: ArrayBuffer, buffer: ArrayBuffer, calculateWordMatrix: boolean, is3d?: boolean): boolean;
  12216. }
  12217. export namespace INativeWorker {
  12218. interface IAnimationClipBinding extends IHandle {
  12219. id: number;
  12220. rebind(buffer: ArrayBuffer, offset: number, cLength: number, eLength: number, removeAction: number, retainedAction: number, addedAction: number, rootEntity: number): boolean;
  12221. update(buffer: ArrayBuffer, offset: number, cLength: number, eLength: number, removeAction: number, retainedAction: number, addedAction: number): boolean;
  12222. writeDefaultValues(): void;
  12223. }
  12224. }
  12225. export interface INativeWorker {
  12226. createCullingComponentPool(count: number): IHandle;
  12227. createRenderComponent(meshCount: number, uniformBlock: number, attachedNode: number, cullingId: number, meshRenderType: EMeshRenderType, macros?: string): IHandle & {
  12228. setSharedDirty(): void;
  12229. };
  12230. changeMeshMacros(mesh: number, macros: string): void;
  12231. createAnimator(clipCount: number, nodeCount: number): IHandle;
  12232. updateAnimators(data: Uint32Array): void;
  12233. createAnimationClipBinding(buffer: ArrayBuffer, offset: number, cLength: number, eLength: number, useDefaultAddedNodesAction: number, rootEntity: number): INativeWorker.IAnimationClipBinding;
  12234. createAnimatorControllerModel(layerCount: number): {
  12235. id: number;
  12236. buffer: ArrayBuffer;
  12237. setMaskAtIndex(index: number, mask: null | ArrayBuffer, offset: number, length: number): void;
  12238. update(): void;
  12239. };
  12240. createAnimatorControllerStateModel(clipCount: number): {
  12241. id: number;
  12242. buffer: ArrayBuffer;
  12243. };
  12244. updateAnimatorControllers(data: Uint32Array): void;
  12245. createSkinning(boneCount: number, flag: number): IHandle;
  12246. updateSkinnings(data: Uint32Array): void;
  12247. createDynamicBones(rootNodeId: number): IHandle & {
  12248. preUpdate(): void;
  12249. update(dt: number, rootMotionX?: number, rootMotionY?: number, rootMotionZ?: number): void;
  12250. rebuild(): void;
  12251. resetRoot(rootId: number): void;
  12252. };
  12253. }
  12254. export interface INativeWorker {
  12255. createRenderCamera(attachedNode: number, isUI?: boolean): IHandle & {
  12256. setSharedDirty(): void;
  12257. updateMatrices(): void;
  12258. };
  12259. createLightCamera(): IHandle;
  12260. }
  12261. export interface INativeWorker {
  12262. createAnimationClipModel(buffer: ArrayBuffer): IHandle;
  12263. createBoneInverseModel(buffer: ArrayBuffer): IHandle;
  12264. }
  12265. export interface INativeWorker {
  12266. eventBusSM: ArrayBuffer;
  12267. dirtyNodesSM: ArrayBuffer;
  12268. uiRenderList: ArrayBuffer;
  12269. enlargeUIRenderList(): void;
  12270. refreshNodesWorldTransform(): void;
  12271. }
  12272. export interface INativeWorker {
  12273. loadTTFFont(buffer: ArrayBuffer, filaPath: string): string;
  12274. getGlyphInfo(name: string, charCode: number): IGlyphInfo;
  12275. }
  12276. export interface INativeWorker {
  12277. decodeImage(buffer: ArrayBuffer, callback: (data: ArrayBuffer | undefined, width: number, height: number) => void, premultiplyAlpha: boolean): void;
  12278. getRenderEnv(): IRenderEnv;
  12279. clearView(view: number): void;
  12280. cullCamera(camera: number, cullResult: number, lightMode: string): void;
  12281. drawCamera(camera: number, renderList: number, lightMode: string): void;
  12282. drawLight(light: number, camera: number, renderList: number, lightMode: string): void;
  12283. submit(): void;
  12284. destroy(): void;
  12285. createWeakRef<T>(wrapper: T): {
  12286. deref: () => T;
  12287. };
  12288. createWeakRefSentry(): any;
  12289. createNativeUUMap(): INativeMap<number>;
  12290. createNativeSUMap(): INativeMap<string>;
  12291. createNativeULUMap(): ILongIntNativeMap;
  12292. decodeBase64(base64: string): ArrayBuffer;
  12293. setNodeName(id: number, name: string): void;
  12294. setRenderComponentName(id: number, name: string): void;
  12295. debugPrint(msg: string): void;
  12296. }
  12297. let Phys3D: any;
  12298. export const native: {
  12299. worker: INativeWorker;
  12300. };
  12301. export function destroy(): void;
  12302. export function GET_MAIN_CANVAS(): HTMLCanvasElement;
  12303. export function IS_VALID(): boolean;
  12304. export { Phys3D };
  12305. }
  12306. declare module 'XrFrame/loader/glTF/animations/channels/GLTFChannelsNode' {
  12307. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12308. import { GLTFNodesLoaded } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  12309. import { GLTFSamplersLoaded } from "XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode";
  12310. import GLTFChannelNode, { GLTFChannelLoaded, GLTFChannelNodeRaw } from "XrFrame/loader/glTF/animations/channels/GLTFChannelNode";
  12311. type ChildNode = GLTFChannelNode;
  12312. export type GLTFChannelsNodeRaw = Array<GLTFChannelsNodeRaw>;
  12313. export type GLTFChannelsLoaded = Array<GLTFChannelLoaded>;
  12314. export default class GLTFChannelsNode extends GLTFArrayNode<ChildNode> {
  12315. ChildCtor(childRaw: GLTFChannelNodeRaw): GLTFChannelNode;
  12316. readonly raw: GLTFChannelsNodeRaw;
  12317. get nodeName(): string;
  12318. preload: (prerequisites: [nodes: GLTFNodesLoaded, samplers: GLTFSamplersLoaded]) => Promise<GLTFChannelsLoaded>;
  12319. getLoadedResource(): GLTFChannelsLoaded;
  12320. }
  12321. export {};
  12322. }
  12323. declare module 'XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode' {
  12324. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  12325. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12326. import GLTFSamplerNode, { GLTFSamplerLoaded, GLTFSamplerNodeRaw } from "XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode";
  12327. type ChildNode = GLTFSamplerNode;
  12328. export type GLTFSamplersNodeRaw = Array<GLTFSamplersNodeRaw>;
  12329. export type GLTFSamplersLoaded = Array<GLTFSamplerLoaded>;
  12330. export default class GLTFSamplersNode extends GLTFArrayNode<ChildNode> {
  12331. ChildCtor(childRaw: GLTFSamplerNodeRaw): GLTFSamplerNode;
  12332. readonly raw: GLTFSamplersNodeRaw;
  12333. get nodeName(): string;
  12334. preload: (prerequisites: [accessors: GLTFAccessorsLoaded]) => Promise<GLTFSamplersLoaded>;
  12335. getLoadedResource(): GLTFSamplersLoaded;
  12336. }
  12337. export {};
  12338. }
  12339. declare module 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitivesNode' {
  12340. import { Kanata } from "XrFrame/ext";
  12341. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  12342. import { GLTFArrayNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12343. import { GLTFMaterialsLoaded } from "XrFrame/loader/glTF/materials/GLTFMaterialsNode";
  12344. import GLTFPrimitiveNode, { GLTFPrimitiveLoaded, GLTFPrimitiveNodeRaw } from "XrFrame/loader/glTF/geometry/primitives/GLTFPrimitiveNode";
  12345. type ChildNode = GLTFPrimitiveNode;
  12346. export type GLTFPrimitivesNodeRaw = Array<GLTFPrimitivesNodeRaw>;
  12347. export type GLTFPrimitivesLoaded = Array<GLTFPrimitiveLoaded>;
  12348. export default class GLTFPrimitivesNode extends GLTFArrayNode<ChildNode> {
  12349. ChildCtor(childRaw: GLTFPrimitiveNodeRaw): GLTFPrimitiveNode;
  12350. readonly raw: GLTFPrimitivesNodeRaw;
  12351. get nodeName(): string;
  12352. preload: (prerequisites: [materials: GLTFMaterialsLoaded, accessors: GLTFAccessorsLoaded, vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>]) => Promise<GLTFPrimitivesLoaded>;
  12353. getLoadedResource(): GLTFPrimitivesLoaded;
  12354. }
  12355. export {};
  12356. }
  12357. declare module 'XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode' {
  12358. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12359. export interface GLTFTextureInfoNodeRaw {
  12360. index: number;
  12361. texCoord?: number;
  12362. }
  12363. export interface GLTFTextureInfoLoaded {
  12364. index: number;
  12365. texCoord: number;
  12366. }
  12367. export default class GLTFTextureInfoNode extends GLTFBaseNode {
  12368. get nodeName(): string;
  12369. readonly raw: GLTFTextureInfoNodeRaw;
  12370. build(): void;
  12371. preload(): Promise<GLTFTextureInfoLoaded>;
  12372. getLoadedResource(): GLTFTextureInfoLoaded;
  12373. }
  12374. }
  12375. declare module 'XrFrame/loader/glTF/materials/pbr/GLTFPBRMetallicRoughnessNode' {
  12376. import { Kanata } from "XrFrame/ext";
  12377. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12378. import { GLTFTexturesLoaded } from "XrFrame/loader/glTF/textures/GLTFTexturesNode";
  12379. import { GLTFTextureInfoNodeRaw } from "XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode";
  12380. export interface GLTFPBRMetallicRoughnessNodeRaw {
  12381. baseColorFactor?: [number, number, number, number];
  12382. baseColorTexture?: GLTFTextureInfoNodeRaw;
  12383. metallicFactor?: number;
  12384. roughnessFactor?: number;
  12385. metallicRoughnessTexture?: GLTFTextureInfoNodeRaw;
  12386. }
  12387. export interface GLTFPBRMetallicRoughnessLoaded {
  12388. uniform: {
  12389. [key: string]: ArrayLike<number> | number | Kanata.Texture;
  12390. };
  12391. renderStates: object;
  12392. macros: {
  12393. [key: string]: boolean | number;
  12394. };
  12395. }
  12396. export default class GLTFPBRMetallicRoughnessNode extends GLTFBaseNode {
  12397. get nodeName(): string;
  12398. readonly raw: GLTFPBRMetallicRoughnessNodeRaw;
  12399. build(): void;
  12400. preload(prerequisites: [textrues: GLTFTexturesLoaded]): Promise<GLTFPBRMetallicRoughnessLoaded>;
  12401. getLoadedResource(): GLTFPBRMetallicRoughnessLoaded;
  12402. }
  12403. }
  12404. declare module 'XrFrame/loader/glTF/materials/texture/GLTFNormalTextureInfoNode' {
  12405. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12406. export interface GLTFNormalTextureInfoNodeRaw {
  12407. index: number;
  12408. texCoord?: number;
  12409. scale?: number;
  12410. }
  12411. export interface GLTFNormalTextureInfoLoaded {
  12412. index: number;
  12413. texCoord: number;
  12414. scale: number;
  12415. }
  12416. export default class GLTFNormalTextureInfoNode extends GLTFBaseNode {
  12417. get nodeName(): string;
  12418. readonly raw: GLTFNormalTextureInfoNodeRaw;
  12419. build(): void;
  12420. preload(): Promise<GLTFNormalTextureInfoLoaded>;
  12421. getLoadedResource(): GLTFNormalTextureInfoLoaded;
  12422. }
  12423. }
  12424. declare module 'XrFrame/loader/glTF/materials/texture/GLTFOcclusionTextureInfoNode' {
  12425. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12426. export interface GLTFOcclusionTextureInfoNodeRaw {
  12427. index: number;
  12428. texCoord?: number;
  12429. strength?: number;
  12430. }
  12431. export interface GLTFOcclusionTextureInfoLoaded {
  12432. index: number;
  12433. texCoord: number;
  12434. strength: number;
  12435. }
  12436. export default class GLTFOcclusionTextureInfoNode extends GLTFBaseNode {
  12437. get nodeName(): string;
  12438. readonly raw: GLTFOcclusionTextureInfoNodeRaw;
  12439. build(): void;
  12440. preload(): Promise<GLTFOcclusionTextureInfoLoaded>;
  12441. getLoadedResource(): GLTFOcclusionTextureInfoLoaded;
  12442. }
  12443. }
  12444. declare module 'XrFrame/kanata/lib/backend/interface/IWorker' {
  12445. /**
  12446. * IWorker.ts
  12447. *
  12448. * * @Date : 12/3/2020, 4:45:58 PM
  12449. */
  12450. import { IHandle, ETextureType, ETextureFormat, IRect, EMeshRenderType, INativeMap, ILongIntNativeMap, IGlyphInfo, IVertexLayoutOptions, IView, IRenderPassDescriptor, IEventBridge, IDownloader, IUniformDescriptorOptions, IFontSetting, TTextureSource, IImage, IVertexDataDescriptorOptions, IRenderEnv, IEngineSettings } from 'XrFrame/kanata/lib/backend/interface';
  12451. global {
  12452. const MAIN_CANVAS: HTMLCanvasElement;
  12453. const ENGINE_SETTINGS: IEngineSettings;
  12454. const ENGINE_MODE: 'Game' | 'Editor';
  12455. const IS_SUB_CONTEXT: boolean;
  12456. const HOST: string;
  12457. }
  12458. export interface IWorker {
  12459. createVertexLayout(options: IVertexLayoutOptions): IHandle;
  12460. createVertexDataDescriptor(options: IVertexDataDescriptorOptions): IHandle;
  12461. createVertexBuffer(buffer: ArrayBuffer | ArrayBufferView, layout: IHandle): IHandle;
  12462. updateVertexBuffer(bufferHandle: IHandle, buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  12463. createIndexBuffer(buffer: ArrayBuffer | ArrayBufferView, is32bits?: boolean): IHandle;
  12464. updateIndexBuffer(bufferHandle: IHandle, buffer: ArrayBuffer | ArrayBufferView, offset: number): void;
  12465. createVertexData(layout: IHandle, size: number, batchDesc: IHandle): IHandle;
  12466. createIndexData(size: number): IHandle;
  12467. createTexture(type: ETextureType, width: number, height: number, slice: number, mips: number, format: ETextureFormat, flags: number, source: TTextureSource[], offsets: Uint32Array): IHandle;
  12468. createAutoUpdateTextureFromCanvas(canvas: HTMLCanvasElement): IHandle;
  12469. updateTexture(handle: IHandle, level: number, slice: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, buffer: ArrayBuffer | ArrayBufferView | IImage | HTMLCanvasElement | ImageData): void;
  12470. updateTextureFlags(texture: IHandle, flags: number): void;
  12471. createUniformBlockDescriptor(descriptor: IUniformDescriptorOptions): IHandle;
  12472. createUniformBlock(descriptor: IHandle): IHandle;
  12473. createEffect(name: string, passCount: number, keyIndexMap: string[], passes: {
  12474. lightMode: string;
  12475. variants?: {
  12476. [key: number]: number;
  12477. };
  12478. macros?: {
  12479. [key: string]: number;
  12480. };
  12481. shaders?: number[];
  12482. }[], shaders: string[], variants: number[][], useRuntimeMacros: boolean): IHandle & {
  12483. warmUp(): void;
  12484. };
  12485. createMaterial(macros?: {
  12486. [name: string]: string | number | boolean;
  12487. }, uniformBlock?: IHandle): IHandle;
  12488. changeMaterialMacros(material: IHandle, macros: {
  12489. [name: string]: string | number | boolean;
  12490. }, reset?: boolean): void;
  12491. }
  12492. export interface IWorker {
  12493. createView(view: IView): IHandle;
  12494. updateViewRect(view: IHandle, rect: IRect): void;
  12495. updateViewScissor(view: IHandle, rect: IRect): void;
  12496. }
  12497. export interface IWorker {
  12498. createRenderPass(descriptor: IRenderPassDescriptor): IHandle;
  12499. }
  12500. export interface IWorker {
  12501. createNodePool(count: number, is3d: boolean): IHandle;
  12502. createNodeTree(length: number, ids: ArrayBuffer, buffer: ArrayBuffer, calculateWordMatrix: boolean, is3d: boolean): boolean;
  12503. }
  12504. export interface IWorker {
  12505. createCullingComponentPool(count: number): IHandle;
  12506. createRenderComponent(meshCount: number, uniformBlock: IHandle, attachedNodeId: number, cullingCompId: number, meshRenderType: EMeshRenderType, macros?: {
  12507. [name: string]: string | number | boolean;
  12508. }): IHandle & {
  12509. setSharedDirty(): void;
  12510. };
  12511. changeMeshMacros(mesh: IHandle, macros: {
  12512. [name: string]: string | number | boolean;
  12513. }, reset?: boolean): void;
  12514. createAnimator(clipCount: number, nodeCount: number): IHandle;
  12515. updateAnimators(feObjects: {
  12516. __handle: IHandle;
  12517. id: number;
  12518. }[], size: number): void;
  12519. createAnimationClipBinding(clipArray: {
  12520. __handle: IHandle;
  12521. id: number;
  12522. }[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | {
  12523. id: number;
  12524. } | null>, entityArrayOffset: number, entityArrayLength: number, useDefaultAddedNodesAction: number, rootEntity: {
  12525. id: number;
  12526. }): IHandle;
  12527. rebindAnimationClipBinding(binding: IHandle, clipArray: {
  12528. __handle: IHandle;
  12529. id: number;
  12530. }[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | {
  12531. id: number;
  12532. } | null>, entityArrayOffset: number, entityArrayLength: number, removeAction: number, retainedAction: number, addedAction: number, rootEntity: {
  12533. id: number;
  12534. }): boolean;
  12535. updateAnimationClipBinding(binding: IHandle, clipArray: {
  12536. __handle: IHandle;
  12537. id: number;
  12538. }[], clipArrayOffset: number, clipArrayLength: number, entityArray: Array<number | {
  12539. id: number;
  12540. } | null>, entityArrayOffset: number, entityArrayLength: number, removeAction: number, retainedAction: number, addedAction: number): boolean;
  12541. writeAnimationClipBindingDefaultValues(binding: IHandle): void;
  12542. createAnimatorControllerModel(layerCount: number): IHandle;
  12543. setAnimatorControllerModelMaskAtIndex(model: IHandle, index: number, mask: {
  12544. buffer: null | ArrayBuffer;
  12545. offset: number;
  12546. length: number;
  12547. }): void;
  12548. updateAnimatorControllerModel(model: IHandle): void;
  12549. createAnimatorControllerStateModel(clipCount: number): IHandle;
  12550. updateAnimatorControllers(// for performance
  12551. feObjects: {
  12552. __handle: IHandle;
  12553. id: number;
  12554. }[], size: number): void;
  12555. createSkinning(boneCount: number, flag: number): IHandle;
  12556. updateSkinnings(feObjects: {
  12557. __handle: IHandle;
  12558. id: number;
  12559. }[], size: number): void;
  12560. createDynamicBones(rootNodeId: number): IHandle & {
  12561. preUpdate(): void;
  12562. update(dt: number, rootMotionX?: number, rootMotionY?: number, rootMotionZ?: number): void;
  12563. rebuild(): void;
  12564. resetRoot(rootId: number): void;
  12565. };
  12566. }
  12567. export interface IWorker {
  12568. createRenderCamera(attachedNodeId: number, isUI?: boolean): IHandle & {
  12569. setSharedDirty(): void;
  12570. updateMatrices(): void;
  12571. };
  12572. createLightCamera(): IHandle;
  12573. }
  12574. export interface IWorker {
  12575. createAnimationClipModel(buffer: ArrayBuffer): IHandle;
  12576. createBoneInverseModel(buffer: ArrayBuffer): IHandle;
  12577. createScalableList(initSize: number, onBackendEnlarge?: () => void): IHandle & {
  12578. enlarge(size: number): void;
  12579. };
  12580. }
  12581. export interface IWorker {
  12582. eventBridge: IEventBridge;
  12583. }
  12584. export interface IWorker {
  12585. loadTTFFont(url: string, callback: (font: string) => void): void;
  12586. getGlyphInfo(fontSetting: IFontSetting, charCode: number): IGlyphInfo;
  12587. }
  12588. export interface IWorker {
  12589. setGlobalPhysicSystem(system: any): void;
  12590. bindRigidBodyToNode(rigidBody: any, nodeId: number): void;
  12591. unbindRigidBody(rigidBody: any): void;
  12592. bindCCTToNode(cc: any, nodeId: number): void;
  12593. unbindCCT(cc: any): void;
  12594. }
  12595. export interface IWorker {
  12596. downloader: IDownloader;
  12597. update(delta: number): void;
  12598. destroy(): void;
  12599. refreshNodesWorldTransform(): void;
  12600. getRenderEnv(): IRenderEnv;
  12601. clearView(view: IHandle): void;
  12602. cullCamera(camera: IHandle, cullResult: IHandle, lightMode: string): void;
  12603. drawCamera(camera: IHandle, renderList: IHandle, lightMode: string): void;
  12604. drawLight(light: IHandle, camera: IHandle, renderList: IHandle, lightMode: string): void;
  12605. submit(): void;
  12606. createWeakRef<T>(wrapper: T): {
  12607. deref: () => T;
  12608. };
  12609. createWeakRefSentry(): any;
  12610. createNativeUUMap(): INativeMap<number>;
  12611. createNativeSUMap(): INativeMap<string>;
  12612. createNativeULUMap(): ILongIntNativeMap;
  12613. decodeBase64(base64: string): ArrayBuffer;
  12614. setNodeName(id: number, name: string): void;
  12615. setRenderComponentName(handle: IHandle, name: string): void;
  12616. debugPrint(msg: string): void;
  12617. }
  12618. }
  12619. declare module 'XrFrame/kanata/lib/frontend/pool/Pool' {
  12620. import { IHandle } from 'XrFrame/kanata/lib/backend';
  12621. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject';
  12622. export default class Pool extends NativeObject {
  12623. u32viewExt: Uint32Array;
  12624. constructor(nativeObj: IHandle);
  12625. supplyExtendedMemory(buffer: ArrayBuffer): void;
  12626. }
  12627. }
  12628. declare module 'XrFrame/loader/glTF/animations/channels/GLTFChannelNode' {
  12629. import { StreamReader } from "XrFrame/core/utils";
  12630. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12631. import { GLTFNodesLoaded } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  12632. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  12633. import { GLTFSamplerLoaded } from "XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode";
  12634. import { GLTFSamplersLoaded } from "XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode";
  12635. import { GLTFTargetLoaded, GLTFTargetNodeRaw } from "XrFrame/loader/glTF/animations/channels/GLTFTargetNode";
  12636. export enum EnumPuppetAnimationSampleGroupType {
  12637. tx = 1,
  12638. ty = 2,
  12639. tz = 3,
  12640. sx = 4,
  12641. sy = 5,
  12642. sz = 6,
  12643. qx = 7,
  12644. qy = 8,
  12645. qz = 9,
  12646. qw = 10,
  12647. ex = 11,
  12648. ey = 12,
  12649. ez = 13
  12650. }
  12651. /**
  12652. * 二进制格式, byteLength = 12 + 16 * samples.len
  12653. * | Array<| nodeid | type | count |> |
  12654. * | Array<PuppetAnimationClipSample> |
  12655. */
  12656. export type PuppetAnimationSampleGroup = ArrayBuffer | GLTF.BufferView;
  12657. /**
  12658. * 二进制格式, byteLength = 16
  12659. * uint32_t index;
  12660. * float value;
  12661. * float in_tangent;
  12662. * float out_tangent;
  12663. *
  12664. * @remind out_tangent的值决定了插值的类型!很hack!
  12665. * out_tangent = Infinity: STEP
  12666. * out_tangent = NaN: Spherical Linear Interpolation (for quaternion)
  12667. * out_tangent为正常值: Cubic Spline Interpolation (or Linear)
  12668. */
  12669. export type PuppetAnimationClipSample = ArrayBuffer | GLTF.BufferView;
  12670. export interface GLTFChannelNodeRaw {
  12671. sampler: number;
  12672. target: GLTFTargetNodeRaw;
  12673. }
  12674. export interface GLTFChannelLoaded {
  12675. sampler: GLTFSamplerLoaded;
  12676. target: GLTFTargetLoaded;
  12677. vectorGroups: number;
  12678. headerBytesNeeded: number;
  12679. bodyBytesNeeded: number;
  12680. serializeHeaderOnBuffer(stream: StreamReader, channelIndex: number): void;
  12681. serializeBodyOnBuffer(stream: StreamReader): number;
  12682. morphNodeCount: number;
  12683. }
  12684. export default class GLTFChannelNode extends GLTFBaseNode {
  12685. get nodeName(): string;
  12686. readonly raw: GLTFChannelNodeRaw;
  12687. build(): void;
  12688. preload(prerequisites: [nodes: GLTFNodesLoaded, samplers: GLTFSamplersLoaded]): Promise<GLTFChannelLoaded>;
  12689. getLoadedResource(): GLTFChannelLoaded;
  12690. }
  12691. }
  12692. declare module 'XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode' {
  12693. import { GLTFAccessorLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorNode";
  12694. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  12695. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12696. export enum EnumGLTFSamplerInterpolation {
  12697. STEP = 0,
  12698. LINEAR = 1,
  12699. CUBICSPLINE = 2
  12700. }
  12701. export interface GLTFSamplerNodeRaw {
  12702. input: number;
  12703. output: number;
  12704. interpolation?: "STEP" | "LINEAR" | "CUBICSPLINE";
  12705. }
  12706. export interface GLTFSamplerLoaded {
  12707. input: GLTFAccessorLoaded;
  12708. output: GLTFAccessorLoaded;
  12709. interpolation: EnumGLTFSamplerInterpolation;
  12710. sampleCount: number;
  12711. }
  12712. export default class GLTFSamplerNode extends GLTFBaseNode {
  12713. get nodeName(): string;
  12714. readonly raw: GLTFSamplerNodeRaw;
  12715. build(): void;
  12716. preload(prerequisites: [accessors: GLTFAccessorsLoaded]): Promise<GLTFSamplerLoaded>;
  12717. getLoadedResource(): GLTFSamplerLoaded;
  12718. }
  12719. }
  12720. declare module 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitiveNode' {
  12721. import Geometry from "XrFrame/assets/Geometry";
  12722. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  12723. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12724. import { GLTFAttributesNodeRaw } from "XrFrame/loader/glTF/geometry/primitives/attributes/GLTFAttributesNode";
  12725. import { GLTFMaterialsLoaded } from "XrFrame/loader/glTF/materials/GLTFMaterialsNode";
  12726. import Material from "XrFrame/assets/Material";
  12727. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  12728. import { GLTFTargetsNodeRaw } from "XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode";
  12729. export enum EnumGLTFPrimitiveMode {
  12730. POINTS = 0,
  12731. LINES = 1,
  12732. LINE_LOOP = 2,
  12733. LINE_STRIP = 3,
  12734. TRIANGLES = 4,
  12735. TRIANGLE_STRIP = 5,
  12736. TRIANGLE_FAN = 6
  12737. }
  12738. export interface GLTFPrimitiveNodeRaw {
  12739. attributes: GLTFAttributesNodeRaw;
  12740. indices?: number;
  12741. material?: number;
  12742. mode?: number;
  12743. targets?: GLTFTargetsNodeRaw;
  12744. }
  12745. export interface GLTFPrimitiveLoaded {
  12746. geometry: Geometry;
  12747. material: Material;
  12748. }
  12749. export default class GLTFPrimitiveNode extends GLTFBaseNode {
  12750. get nodeName(): string;
  12751. readonly raw: GLTFPrimitiveNodeRaw;
  12752. build(): void;
  12753. preload(prerequisites: [materials: GLTFMaterialsLoaded, accessors: GLTFAccessorsLoaded, vbMap: Map<string, GLTF.VertexProperties>]): Promise<GLTFPrimitiveLoaded>;
  12754. getLoadedResource(): GLTFPrimitiveLoaded;
  12755. }
  12756. }
  12757. declare module 'XrFrame/core/utils' {
  12758. export function assert(pred: boolean, msg: string): void;
  12759. export function decode(data: ArrayBuffer, format: "utf-8" | "gbk"): string;
  12760. export function wxPromiseWrapper<T = any>(executor: any, args: any): Promise<T>;
  12761. export class StreamReader {
  12762. constructor(buffer: ArrayBuffer, byteOffset?: number);
  12763. get size(): number;
  12764. read<T>(type: StreamReader.Type): T;
  12765. write<T>(type: StreamReader.Type, value: T): void;
  12766. /**
  12767. * 跳过一个位置,以后再填写。
  12768. */
  12769. reserve<T>(type: StreamReader.Type): {
  12770. write(value: T): void;
  12771. };
  12772. readChunk(length: number): ArrayBuffer;
  12773. align(alignment: number): void;
  12774. end(): boolean;
  12775. pos(): number;
  12776. }
  12777. export namespace StreamReader {
  12778. enum Type {
  12779. Float = 0,
  12780. UInt32 = 1,
  12781. UInt16 = 2
  12782. }
  12783. const TypeAlignment: {
  12784. 0: number;
  12785. 1: number;
  12786. 2: number;
  12787. };
  12788. const TypeSize: {
  12789. 0: number;
  12790. 1: number;
  12791. 2: number;
  12792. };
  12793. }
  12794. }
  12795. declare module 'XrFrame/loader/glTF/animations/channels/GLTFTargetNode' {
  12796. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12797. import { GLTFNodesLoaded, GLTFTreeNode } from "XrFrame/loader/glTF/scenes/GLTFNodesNode";
  12798. export enum GLTFEnumAnimationTargetPath {
  12799. TRANSLATION = 0,
  12800. ROTATION = 1,
  12801. SCALE = 2,
  12802. WEIGHTS = 3
  12803. }
  12804. export interface GLTFTargetNodeRaw {
  12805. node?: number;
  12806. path: "translation" | "rotation" | "scale" | "weights";
  12807. }
  12808. export interface GLTFTargetLoaded {
  12809. node: GLTFTreeNode | null;
  12810. path: GLTFEnumAnimationTargetPath;
  12811. }
  12812. export default class GLTFTargetNode extends GLTFBaseNode {
  12813. get nodeName(): string;
  12814. readonly raw: GLTFTargetNodeRaw;
  12815. build(): void;
  12816. preload(prerequisites: [nodes: GLTFNodesLoaded]): Promise<GLTFTargetLoaded>;
  12817. getLoadedResource(): GLTFTargetLoaded;
  12818. }
  12819. }
  12820. declare module 'XrFrame/loader/glTF/geometry/primitives/attributes/GLTFAttributesNode' {
  12821. import { GLTFAccessorsLoaded } from "XrFrame/loader/glTF/buffers/GLTFAccessorsNode";
  12822. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12823. import { GLTF } from "XrFrame/loader/glTF/utils/types";
  12824. import { GLTFTargetsLoaded } from "XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode";
  12825. /**
  12826. * GLTF.Attributes.Name -> Kanata.Layout.Name
  12827. */
  12828. export function convertAttributeName(name: string): string;
  12829. /**
  12830. * GLTF.Attributes.Name -> Kanata.Layout.Format
  12831. * 在shader里不同用途的attribute的长度是固定的,无论他用的accessor实际元素的长度是多少
  12832. */
  12833. export function getComponentCountFromAttributeName(name: string): number;
  12834. /**
  12835. * GLTF.Attributes.Name -> Shader Macros
  12836. */
  12837. export function genMacrosByAttrib(name: string, macros: object): void;
  12838. export interface GLTFAttributesExtArgs {
  12839. trust?: boolean;
  12840. check?: boolean;
  12841. }
  12842. export type GLTFAttributesNodeRaw = {
  12843. [attribName: string]: number;
  12844. };
  12845. export type GLTFAttributesLoaded = GLTF.VertexProperties;
  12846. export default class GLTFAttributesNode extends GLTFBaseNode {
  12847. get nodeName(): string;
  12848. readonly raw: GLTFAttributesNodeRaw;
  12849. build(): void;
  12850. preload(prerequisites: [targets: GLTFTargetsLoaded, materials: any, accessors: GLTFAccessorsLoaded, vbMap: Map<string, GLTF.VertexProperties>]): Promise<GLTFAttributesLoaded>;
  12851. getLoadedResource(): GLTFAttributesLoaded;
  12852. }
  12853. }
  12854. declare module 'XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode' {
  12855. import { GLTFBaseNode } from "XrFrame/loader/glTF/GLTFBaseNode";
  12856. export type GLTFTargetsNodeRaw = Array<{
  12857. [targetAttribName: string]: number;
  12858. }>;
  12859. export interface GLTFTargetsLoaded {
  12860. attributes: {
  12861. [targetAttribName: string]: number;
  12862. };
  12863. }
  12864. export const validMorphAttribs: string[];
  12865. export default class GLTFTargetsNode extends GLTFBaseNode {
  12866. get nodeName(): string;
  12867. readonly raw: GLTFTargetsNodeRaw;
  12868. build(): void;
  12869. preload(): Promise<GLTFTargetsLoaded>;
  12870. getLoadedResource(): GLTFTargetsLoaded;
  12871. }
  12872. }