lib.wx.xr-frame.d.ts 517 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375
  1. /*! *****************************************************************************
  2. Copyright (c) 2024 Tencent, Inc. All rights reserved.
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. this software and associated documentation files (the "Software"), to deal in
  5. the Software without restriction, including without limitation the rights to
  6. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  7. of the Software, and to permit persons to whom the Software is furnished to do
  8. so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all
  10. copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. SOFTWARE.
  18. ***************************************************************************** */
  19. /// <reference path="./lib.wx.phys3D.d.ts" />
  20. declare type HTMLCanvasElement = any
  21. declare type ImageData = any
  22. declare type HTMLImageElement = any
  23. declare module 'XrFrame' {
  24. import * as xrFrameSystem from 'XrFrame/xrFrameSystem'
  25. import { IComponentSchema, IEntityComponents } from 'XrFrame/xrFrameSystem'
  26. export {
  27. IComponentSchema,
  28. IEntityComponents,
  29. IEffectAsset,
  30. IRenderStates,
  31. ISubMesh,
  32. IVideoTextureOptions,
  33. IRenderTarget,
  34. IRenderTextureOptions,
  35. IGLTFModelOptions,
  36. IEnvDataOptions,
  37. IKeyframeAnimationData,
  38. IKeyframeAnimationInfo,
  39. IKeyframeAnimationOptions,
  40. IAtlasOptions,
  41. IAtlasCreationOptions,
  42. IPostProcessOptions,
  43. IDataValueHandler,
  44. ITextureWrapper,
  45. ITextureOptions,
  46. IEngineSettings,
  47. IHandle,
  48. IVertexLayoutOptions,
  49. IVertexDataDescriptorOptions,
  50. IUniformDescriptorOptions,
  51. IImage,
  52. IRealDownloader,
  53. IDownloader,
  54. IFontSetting,
  55. IFeatures,
  56. IRect,
  57. IViewAction,
  58. IView,
  59. IAttachment,
  60. IRenderPassDescriptor,
  61. IGlyphInfo,
  62. IEventBridge,
  63. INativeMap,
  64. ILongIntNativeMap,
  65. ITransformData,
  66. IAssetsData,
  67. ICameraData,
  68. IGLTFData,
  69. ILightData,
  70. IAssetMaterialData,
  71. IMeshData,
  72. ITextData,
  73. IAssetRenderTextureData,
  74. IEnvData,
  75. IAnimatorData,
  76. IAnimationPlayOptions,
  77. IAnimatorAutoPlay,
  78. ICameraOrbitControlData,
  79. IARTrackerData,
  80. IARTrackerRawData,
  81. IShapeData,
  82. ISphereShapeData,
  83. IMeshShapeData,
  84. ICapsuleShapeData,
  85. ICubeShapeData,
  86. IRigidbodyData,
  87. IShapeInteractData,
  88. IShapeGizmosData,
  89. IAssetPostProcessData,
  90. IParticleData,
  91. IAssetsSystemData,
  92. INodeSystemData,
  93. ITickSystemData,
  94. IAnimationSystemData,
  95. IVideoSystemData,
  96. IRenderSystemData,
  97. IPhysicsSystemData,
  98. IShapeDragEvent,
  99. IShapeTouchEvent,
  100. IARSystemData,
  101. IARRawData,
  102. IShareSystemData,
  103. IShareCaptureOptions,
  104. IShareRecordOptions,
  105. IGizmoSystemData,
  106. ILoaderOptionsSchema,
  107. ITextureLoaderOptions,
  108. IImageLoaderOptions,
  109. ICubeTextureLoaderOptions,
  110. IVideoTextureLoaderOptions,
  111. IEnvDataLoaderOptions,
  112. IGLTFLoaderOptions,
  113. IKeyframeLoaderOptions,
  114. IRawLoaderOptions,
  115. IAtlasLoaderOptions,
  116. TEventCallback,
  117. TDirection,
  118. Texture,
  119. UniformDescriptor,
  120. UniformBlock,
  121. VertexLayout,
  122. TCameraBackground,
  123. TTrackMode,
  124. EVideoState,
  125. EVertexFormat,
  126. EVertexStep,
  127. EIndexType,
  128. ETextureType,
  129. ETextureFormat,
  130. EWrapMode,
  131. EFilterMode,
  132. EUniformType,
  133. ECullMode,
  134. EFaceWinding,
  135. ECompareFunc,
  136. EStencilOp,
  137. EBlendFactor,
  138. EBlendEquation,
  139. EColorMask,
  140. EPixelType,
  141. ELoadAction,
  142. EDataModelType,
  143. EMeshRenderType,
  144. EPrimitiveType,
  145. EShadowMode,
  146. EShadowFitMode,
  147. EVertexLayoutUsage,
  148. EVertexBatchOperator,
  149. EAnimationBlendType,
  150. EUseDefaultAddedAction,
  151. EUseDefaultRetainedAction,
  152. EUseDefaultRemovedAction,
  153. EEventType,
  154. EARTrackerState,
  155. EShapeType,
  156. ECapsuleShapeDirection,
  157. EShareRecordState
  158. } from 'XrFrame/xrFrameSystem'
  159. export type Component<IData> = xrFrameSystem.Component<IData>
  160. export type Element = xrFrameSystem.Element
  161. export type EventManager = xrFrameSystem.EventManager
  162. export type Effect = xrFrameSystem.Effect
  163. export type Geometry = xrFrameSystem.Geometry
  164. export type Material = xrFrameSystem.Material
  165. export type VideoTexture = xrFrameSystem.VideoTexture
  166. export type RenderTexture = xrFrameSystem.RenderTexture
  167. export type GLTFModel = xrFrameSystem.GLTFModel
  168. export type EnvData = xrFrameSystem.EnvData
  169. export type Animation = xrFrameSystem.Animation
  170. export type KeyframeAnimation = xrFrameSystem.KeyframeAnimation
  171. export type Atlas = xrFrameSystem.Atlas
  172. export type PostProcess = xrFrameSystem.PostProcess
  173. export type Vector2 = xrFrameSystem.Vector2
  174. export type Vector3 = xrFrameSystem.Vector3
  175. export type Vector4 = xrFrameSystem.Vector4
  176. export type Quaternion = xrFrameSystem.Quaternion
  177. export type Matrix3 = xrFrameSystem.Matrix3
  178. export type Matrix4 = xrFrameSystem.Matrix4
  179. export type Color = xrFrameSystem.Color
  180. export type OBB = xrFrameSystem.OBB
  181. export type BoundBall = xrFrameSystem.BoundBall
  182. export type BoundBox = xrFrameSystem.BoundBox
  183. export type Spherical = xrFrameSystem.Spherical
  184. export type Transform = xrFrameSystem.Transform
  185. export type AssetLoad = xrFrameSystem.AssetLoad
  186. export type Assets = xrFrameSystem.Assets
  187. export type Camera = xrFrameSystem.Camera
  188. export type GLTF = xrFrameSystem.GLTF
  189. export type Light = xrFrameSystem.Light
  190. export type AssetMaterial = xrFrameSystem.AssetMaterial
  191. export type Mesh = xrFrameSystem.Mesh
  192. export type Text = xrFrameSystem.Text
  193. export type Particle = xrFrameSystem.Particle
  194. export type AssetRenderTexture = xrFrameSystem.AssetRenderTexture
  195. export type Env = xrFrameSystem.Env
  196. export type Animator = xrFrameSystem.Animator
  197. export type CameraOrbitControl = xrFrameSystem.CameraOrbitControl
  198. export type ARTracker = xrFrameSystem.ARTracker
  199. export type Shape = xrFrameSystem.Shape
  200. export type SphereShape = xrFrameSystem.SphereShape
  201. export type MeshShape = xrFrameSystem.MeshShape
  202. export type CapsuleShape = xrFrameSystem.CapsuleShape
  203. export type CubeShape = xrFrameSystem.CubeShape
  204. export type Rigidbody = xrFrameSystem.Rigidbody
  205. export type ShapeInteract = xrFrameSystem.ShapeInteract
  206. export type ShapeGizmos = xrFrameSystem.ShapeGizmos
  207. export type AssetPostProcess = xrFrameSystem.AssetPostProcess
  208. export type Scene = xrFrameSystem.Scene
  209. export type XRNode = xrFrameSystem.XRNode
  210. export type XRShadow = xrFrameSystem.XRShadow
  211. export type XRCamera = xrFrameSystem.XRCamera
  212. export type XRMesh = xrFrameSystem.XRMesh
  213. export type XRLight = xrFrameSystem.XRLight
  214. export type XRGLTF = xrFrameSystem.XRGLTF
  215. export type XRMaterial = xrFrameSystem.XRMaterial
  216. export type XRAssetRenderTexture = xrFrameSystem.XRAssetRenderTexture
  217. export type XRAssetLoad = xrFrameSystem.XRAssetLoad
  218. export type XRAssets = xrFrameSystem.XRAssets
  219. export type XREnv = xrFrameSystem.XREnv
  220. export type XRARTracker = xrFrameSystem.XRARTracker
  221. export type XRText = xrFrameSystem.XRText
  222. export type XRParticle = xrFrameSystem.XRParticle
  223. export type XRAssetPostProcess = xrFrameSystem.XRAssetPostProcess
  224. export type AssetsSystem = xrFrameSystem.AssetsSystem
  225. export type NodeSystem = xrFrameSystem.NodeSystem
  226. export type TickSystem = xrFrameSystem.TickSystem
  227. export type AnimationSystem = xrFrameSystem.AnimationSystem
  228. export type VideoSystem = xrFrameSystem.VideoSystem
  229. export type RenderSystem = xrFrameSystem.RenderSystem
  230. export type PhysicsSystem = xrFrameSystem.PhysicsSystem
  231. export type ARSystem = xrFrameSystem.ARSystem
  232. export type ShareSystem = xrFrameSystem.ShareSystem
  233. export type GizmoSystem = xrFrameSystem.GizmoSystem
  234. export type AssetLoader<T, ILoadOptions> = xrFrameSystem.AssetLoader<
  235. T,
  236. ILoadOptions
  237. >
  238. export type TextureLoader = xrFrameSystem.TextureLoader
  239. export type ImageLoader = xrFrameSystem.ImageLoader
  240. export type CubeTextureLoader = xrFrameSystem.CubeTextureLoader
  241. export type VideoTextureLoader = xrFrameSystem.VideoTextureLoader
  242. export type EnvDataLoader = xrFrameSystem.EnvDataLoader
  243. export type GLTFLoader = xrFrameSystem.GLTFLoader
  244. export type KeyframeLoader = xrFrameSystem.KeyframeLoader
  245. export type RawLoader = xrFrameSystem.RawLoader
  246. export type AtlasLoader = xrFrameSystem.AtlasLoader
  247. export interface IXrFrameSystem {
  248. registerComponent: typeof xrFrameSystem.registerComponent
  249. registerElement: typeof xrFrameSystem.registerElement
  250. registerDataValue: typeof xrFrameSystem.registerDataValue
  251. isTextureWrapper: typeof xrFrameSystem.isTextureWrapper
  252. genLspMeta: typeof xrFrameSystem.genLspMeta
  253. registerEffect: typeof xrFrameSystem.registerEffect
  254. registerGeometry: typeof xrFrameSystem.registerGeometry
  255. registerTexture: typeof xrFrameSystem.registerTexture
  256. registerMaterial: typeof xrFrameSystem.registerMaterial
  257. registerUniformDesc: typeof xrFrameSystem.registerUniformDesc
  258. registerVertexDataDesc: typeof xrFrameSystem.registerVertexDataDesc
  259. registerVertexLayout: typeof xrFrameSystem.registerVertexLayout
  260. registerAssetLoader: typeof xrFrameSystem.registerAssetLoader
  261. Component: typeof xrFrameSystem.Component
  262. Element: typeof xrFrameSystem.Element
  263. EventManager: typeof xrFrameSystem.EventManager
  264. Effect: typeof xrFrameSystem.Effect
  265. Geometry: typeof xrFrameSystem.Geometry
  266. Material: typeof xrFrameSystem.Material
  267. VideoTexture: typeof xrFrameSystem.VideoTexture
  268. RenderTexture: typeof xrFrameSystem.RenderTexture
  269. GLTFModel: typeof xrFrameSystem.GLTFModel
  270. EnvData: typeof xrFrameSystem.EnvData
  271. Animation: typeof xrFrameSystem.Animation
  272. KeyframeAnimation: typeof xrFrameSystem.KeyframeAnimation
  273. Atlas: typeof xrFrameSystem.Atlas
  274. PostProcess: typeof xrFrameSystem.PostProcess
  275. Vector2: typeof xrFrameSystem.Vector2
  276. Vector3: typeof xrFrameSystem.Vector3
  277. Vector4: typeof xrFrameSystem.Vector4
  278. Quaternion: typeof xrFrameSystem.Quaternion
  279. Matrix3: typeof xrFrameSystem.Matrix3
  280. Matrix4: typeof xrFrameSystem.Matrix4
  281. Color: typeof xrFrameSystem.Color
  282. OBB: typeof xrFrameSystem.OBB
  283. BoundBall: typeof xrFrameSystem.BoundBall
  284. BoundBox: typeof xrFrameSystem.BoundBox
  285. Spherical: typeof xrFrameSystem.Spherical
  286. RaycastHit: typeof xrFrameSystem.RaycastHit
  287. Transform: typeof xrFrameSystem.Transform
  288. AssetLoad: typeof xrFrameSystem.AssetLoad
  289. Assets: typeof xrFrameSystem.Assets
  290. Camera: typeof xrFrameSystem.Camera
  291. GLTF: typeof xrFrameSystem.GLTF
  292. Light: typeof xrFrameSystem.Light
  293. AssetMaterial: typeof xrFrameSystem.AssetMaterial
  294. Mesh: typeof xrFrameSystem.Mesh
  295. Text: typeof xrFrameSystem.Text
  296. Particle: typeof xrFrameSystem.Particle
  297. AssetRenderTexture: typeof xrFrameSystem.AssetRenderTexture
  298. Env: typeof xrFrameSystem.Env
  299. Animator: typeof xrFrameSystem.Animator
  300. CameraOrbitControl: typeof xrFrameSystem.CameraOrbitControl
  301. ARTracker: typeof xrFrameSystem.ARTracker
  302. Shape: typeof xrFrameSystem.Shape
  303. SphereShape: typeof xrFrameSystem.SphereShape
  304. MeshShape: typeof xrFrameSystem.MeshShape
  305. CapsuleShape: typeof xrFrameSystem.CapsuleShape
  306. CubeShape: typeof xrFrameSystem.CubeShape
  307. Rigidbody: typeof xrFrameSystem.Rigidbody
  308. ShapeInteract: typeof xrFrameSystem.ShapeInteract
  309. ShapeGizmos: typeof xrFrameSystem.ShapeGizmos
  310. AssetPostProcess: typeof xrFrameSystem.AssetPostProcess
  311. Scene: typeof xrFrameSystem.Scene
  312. XRNode: typeof xrFrameSystem.XRNode
  313. XRShadow: typeof xrFrameSystem.XRShadow
  314. XRCamera: typeof xrFrameSystem.XRCamera
  315. XRMesh: typeof xrFrameSystem.XRMesh
  316. XRLight: typeof xrFrameSystem.XRLight
  317. XRGLTF: typeof xrFrameSystem.XRGLTF
  318. XRMaterial: typeof xrFrameSystem.XRMaterial
  319. XRAssetRenderTexture: typeof xrFrameSystem.XRAssetRenderTexture
  320. XRAssetLoad: typeof xrFrameSystem.XRAssetLoad
  321. XRAssets: typeof xrFrameSystem.XRAssets
  322. XREnv: typeof xrFrameSystem.XREnv
  323. XRARTracker: typeof xrFrameSystem.XRARTracker
  324. XRText: typeof xrFrameSystem.XRText
  325. XRParticle: typeof xrFrameSystem.XRParticle
  326. XRAssetPostProcess: typeof xrFrameSystem.XRAssetPostProcess
  327. AssetsSystem: typeof xrFrameSystem.AssetsSystem
  328. NodeSystem: typeof xrFrameSystem.NodeSystem
  329. TickSystem: typeof xrFrameSystem.TickSystem
  330. AnimationSystem: typeof xrFrameSystem.AnimationSystem
  331. VideoSystem: typeof xrFrameSystem.VideoSystem
  332. RenderSystem: typeof xrFrameSystem.RenderSystem
  333. PhysicsSystem: typeof xrFrameSystem.PhysicsSystem
  334. ARSystem: typeof xrFrameSystem.ARSystem
  335. ShareSystem: typeof xrFrameSystem.ShareSystem
  336. GizmoSystem: typeof xrFrameSystem.GizmoSystem
  337. AssetLoader: typeof xrFrameSystem.AssetLoader
  338. TextureLoader: typeof xrFrameSystem.TextureLoader
  339. ImageLoader: typeof xrFrameSystem.ImageLoader
  340. CubeTextureLoader: typeof xrFrameSystem.CubeTextureLoader
  341. VideoTextureLoader: typeof xrFrameSystem.VideoTextureLoader
  342. EnvDataLoader: typeof xrFrameSystem.EnvDataLoader
  343. GLTFLoader: typeof xrFrameSystem.GLTFLoader
  344. KeyframeLoader: typeof xrFrameSystem.KeyframeLoader
  345. RawLoader: typeof xrFrameSystem.RawLoader
  346. AtlasLoader: typeof xrFrameSystem.AtlasLoader
  347. EVideoState: typeof xrFrameSystem.EVideoState
  348. EVertexFormat: typeof xrFrameSystem.EVertexFormat
  349. EVertexStep: typeof xrFrameSystem.EVertexStep
  350. EIndexType: typeof xrFrameSystem.EIndexType
  351. ETextureType: typeof xrFrameSystem.ETextureType
  352. ETextureFormat: typeof xrFrameSystem.ETextureFormat
  353. EWrapMode: typeof xrFrameSystem.EWrapMode
  354. EFilterMode: typeof xrFrameSystem.EFilterMode
  355. EUniformType: typeof xrFrameSystem.EUniformType
  356. ECullMode: typeof xrFrameSystem.ECullMode
  357. EFaceWinding: typeof xrFrameSystem.EFaceWinding
  358. ECompareFunc: typeof xrFrameSystem.ECompareFunc
  359. EStencilOp: typeof xrFrameSystem.EStencilOp
  360. EBlendFactor: typeof xrFrameSystem.EBlendFactor
  361. EBlendEquation: typeof xrFrameSystem.EBlendEquation
  362. EColorMask: typeof xrFrameSystem.EColorMask
  363. EPixelType: typeof xrFrameSystem.EPixelType
  364. ELoadAction: typeof xrFrameSystem.ELoadAction
  365. EDataModelType: typeof xrFrameSystem.EDataModelType
  366. EMeshRenderType: typeof xrFrameSystem.EMeshRenderType
  367. EPrimitiveType: typeof xrFrameSystem.EPrimitiveType
  368. EShadowMode: typeof xrFrameSystem.EShadowMode
  369. EShadowFitMode: typeof xrFrameSystem.EShadowFitMode
  370. EVertexLayoutUsage: typeof xrFrameSystem.EVertexLayoutUsage
  371. EVertexBatchOperator: typeof xrFrameSystem.EVertexBatchOperator
  372. EAnimationBlendType: typeof xrFrameSystem.EAnimationBlendType
  373. EUseDefaultAddedAction: typeof xrFrameSystem.EUseDefaultAddedAction
  374. EUseDefaultRetainedAction: typeof xrFrameSystem.EUseDefaultRetainedAction
  375. EUseDefaultRemovedAction: typeof xrFrameSystem.EUseDefaultRemovedAction
  376. EEventType: typeof xrFrameSystem.EEventType
  377. EARTrackerState: typeof xrFrameSystem.EARTrackerState
  378. EShapeType: typeof xrFrameSystem.EShapeType
  379. ECapsuleShapeDirection: typeof xrFrameSystem.ECapsuleShapeDirection
  380. EShareRecordState: typeof xrFrameSystem.EShareRecordState
  381. useParamsEaseFuncs: typeof xrFrameSystem.useParamsEaseFuncs
  382. noneParamsEaseFuncs: typeof xrFrameSystem.noneParamsEaseFuncs
  383. TransformSchema: IComponentSchema
  384. AssetLoadSchema: IComponentSchema
  385. AssetsSchema: IComponentSchema
  386. CameraSchema: IComponentSchema
  387. GLTFSchema: IComponentSchema
  388. LightSchema: IComponentSchema
  389. AssetMaterialSchema: IComponentSchema
  390. MeshSchema: IComponentSchema
  391. TextSchema: IComponentSchema
  392. AssetRenderTextureSchema: IComponentSchema
  393. EnvSchema: IComponentSchema
  394. AnimatorSchema: IComponentSchema
  395. CameraOrbitControlSchema: IComponentSchema
  396. ARTrackSchema: IComponentSchema
  397. SphereShapeSchema: IComponentSchema
  398. MeshShapeSchema: IComponentSchema
  399. CapsuleShapeSchema: IComponentSchema
  400. CubeShapeSchema: IComponentSchema
  401. RigidbodySchema: IComponentSchema
  402. ShapeInteractSchema: IComponentSchema
  403. ParticleSchema: IComponentSchema
  404. RenderSystemSchema: IComponentSchema
  405. ARSystemSchema: IComponentSchema
  406. BasicDefaultComponents: IEntityComponents
  407. SceneDefaultComponents: IEntityComponents
  408. NodeDefaultComponents: IEntityComponents
  409. ShadowDefaultComponents: IEntityComponents
  410. CameraDefaultComponents: IEntityComponents
  411. MeshDefaultComponents: IEntityComponents
  412. LightDefaultComponents: IEntityComponents
  413. GLTFDefaultComponents: IEntityComponents
  414. AssetMaterialDefaultComponents: IEntityComponents
  415. AssetRenderTextureDefaultComponents: IEntityComponents
  416. AssetsDefaultComponents: IEntityComponents
  417. EnvDefaultComponents: IEntityComponents
  418. ARTrackerDefaultComponents: IEntityComponents
  419. TextDefaultComponents: IEntityComponents
  420. ParticleDefaultComponents: IEntityComponents
  421. AssetPostProcessDefaultComponents: IEntityComponents
  422. BasicDataMapping: { [key: string]: string[] }
  423. SceneDataMapping: { [key: string]: string[] }
  424. NodeDataMapping: { [key: string]: string[] }
  425. ShadowDataMapping: { [key: string]: string[] }
  426. CameraDataMapping: { [key: string]: string[] }
  427. MeshDataMapping: { [key: string]: string[] }
  428. LightDataMapping: { [key: string]: string[] }
  429. GLTFDataMapping: { [key: string]: string[] }
  430. AssetMaterialDataMapping: { [key: string]: string[] }
  431. AssetRenderTextureDataMapping: { [key: string]: string[] }
  432. AssetLoadDataMapping: { [key: string]: string[] }
  433. EnvDataMapping: { [key: string]: string[] }
  434. ARTrackerDataMapping: { [key: string]: string[] }
  435. TextDataMapping: { [key: string]: string[] }
  436. ParticleDataMapping: { [key: string]: string[] }
  437. AssetPostProcessDataMapping: { [key: string]: string[] }
  438. }
  439. }
  440. declare module 'XrFrame/xrFrameSystem' {
  441. /**
  442. * xrFrameSystem.ts
  443. *
  444. * * @Date : 4/28/2022, 5:02:28 PM
  445. */
  446. import { Kanata } from 'XrFrame/ext'
  447. export {
  448. default as Component,
  449. registerComponent,
  450. IComponentSchema
  451. } from 'XrFrame/core/Component'
  452. export {
  453. default as Element,
  454. registerElement,
  455. IEntityComponents,
  456. BasicDefaultComponents,
  457. BasicDataMapping
  458. } from 'XrFrame/core/Element'
  459. export {
  460. registerDataValue,
  461. IDataValueHandler,
  462. ITextureWrapper,
  463. isTextureWrapper
  464. } from 'XrFrame/core/DataValue'
  465. export {
  466. default as EventManager,
  467. TEventCallback
  468. } from 'XrFrame/core/EventManager'
  469. export { genLspMeta } from 'XrFrame/genLspMeta'
  470. export * from 'XrFrame/components'
  471. export * from 'XrFrame/elements'
  472. export * from 'XrFrame/systems'
  473. export * from 'XrFrame/loader'
  474. export {
  475. default as Effect,
  476. IEffectAsset,
  477. IRenderStates
  478. } from 'XrFrame/assets/Effect'
  479. export { default as Geometry, ISubMesh } from 'XrFrame/assets/Geometry'
  480. export { default as Material } from 'XrFrame/assets/Material'
  481. export {
  482. default as VideoTexture,
  483. IVideoTextureOptions,
  484. EVideoState
  485. } from 'XrFrame/assets/VideoTexture'
  486. export {
  487. default as RenderTexture,
  488. IRenderTarget,
  489. IRenderTextureOptions
  490. } from 'XrFrame/assets/RenderTexture'
  491. export {
  492. default as GLTFModel,
  493. IGLTFModelOptions
  494. } from 'XrFrame/assets/GLTFModel'
  495. export { default as EnvData, IEnvDataOptions } from 'XrFrame/assets/EnvData'
  496. export {
  497. default as Animation,
  498. TDirection
  499. } from 'XrFrame/animation/Animation'
  500. export {
  501. default as KeyframeAnimation,
  502. IKeyframeAnimationData,
  503. IKeyframeAnimationInfo,
  504. IKeyframeAnimationOptions
  505. } from 'XrFrame/animation/KeyframeAnimation'
  506. export {
  507. default as Atlas,
  508. IAtlasOptions,
  509. IAtlasCreationOptions
  510. } from 'XrFrame/assets/Atlas'
  511. export {
  512. default as PostProcess,
  513. IPostProcessOptions
  514. } from 'XrFrame/assets/PostProcess'
  515. export {
  516. registerEffect,
  517. registerGeometry,
  518. registerTexture,
  519. registerMaterial,
  520. registerUniformDesc,
  521. registerVertexDataDesc,
  522. registerVertexLayout
  523. } from 'XrFrame/assets/factories'
  524. export {
  525. useParamsEaseFuncs,
  526. noneParamsEaseFuncs
  527. } from 'XrFrame/assets/easeFunctions'
  528. export * from 'XrFrame/physics/exports'
  529. export { default as Vector2 } from 'XrFrame/math/vector2'
  530. export { default as Vector3 } from 'XrFrame/math/vector3'
  531. export { default as Vector4 } from 'XrFrame/math/vector4'
  532. export { default as Quaternion } from 'XrFrame/math/quaternion'
  533. export { default as Matrix3 } from 'XrFrame/math/matrix3'
  534. export { default as Matrix4 } from 'XrFrame/math/matrix4'
  535. export { default as Color } from 'XrFrame/math/color'
  536. export { default as OBB } from 'XrFrame/math/OBB'
  537. export { default as BoundBall } from 'XrFrame/math/boundBall'
  538. export { default as BoundBox } from 'XrFrame/math/boundBox'
  539. export { default as Spherical } from 'XrFrame/math/Spherical'
  540. export {
  541. ITextureOptions,
  542. IEngineSettings,
  543. EVertexFormat,
  544. EVertexStep,
  545. EIndexType,
  546. ETextureType,
  547. ETextureFormat,
  548. EWrapMode,
  549. EFilterMode,
  550. EUniformType,
  551. ECullMode,
  552. EFaceWinding,
  553. ECompareFunc,
  554. EStencilOp,
  555. EBlendFactor,
  556. EBlendEquation,
  557. EColorMask,
  558. EPixelType,
  559. ELoadAction,
  560. EDataModelType,
  561. EMeshRenderType,
  562. EPrimitiveType,
  563. EShadowMode,
  564. EShadowFitMode,
  565. EVertexLayoutUsage,
  566. EVertexBatchOperator,
  567. EAnimationBlendType,
  568. EUseDefaultAddedAction,
  569. EUseDefaultRetainedAction,
  570. EUseDefaultRemovedAction,
  571. IHandle,
  572. IVertexLayoutOptions,
  573. IVertexDataDescriptorOptions,
  574. IUniformDescriptorOptions,
  575. IImage,
  576. IRealDownloader,
  577. IDownloader,
  578. IFontSetting,
  579. IFeatures,
  580. IRect,
  581. IViewAction,
  582. IView,
  583. IAttachment,
  584. IRenderPassDescriptor,
  585. EEventType,
  586. IGlyphInfo,
  587. IEventBridge,
  588. INativeMap,
  589. ILongIntNativeMap
  590. } from 'XrFrame/kanata/lib/kanata'
  591. export type Texture = Kanata.Texture
  592. export type UniformDescriptor = Kanata.UniformDescriptor
  593. export type UniformBlock = Kanata.UniformBlock
  594. export type VertexLayout = Kanata.VertexLayout
  595. }
  596. declare module 'XrFrame/ext' {
  597. /**
  598. * ext.ts
  599. *
  600. * * @Date : 2022/3/17下午1:43:48
  601. */
  602. import * as Kanata from 'XrFrame/kanata/lib/kanata'
  603. const exparser: any
  604. type Scene = import('XrFrame/core/Scene').default
  605. const _wx: any
  606. const Phys3D: any
  607. function addKanata(scene: Scene, kanata: Kanata.IKanataInstance): void
  608. function removeKanata(scene: Scene): void
  609. function getKanata(scene: Scene): Kanata.IKanataInstance
  610. function __getKanataSuperHackDontUseIt(): Kanata.IKanataInstance
  611. export {
  612. Kanata,
  613. exparser,
  614. Phys3D,
  615. _wx,
  616. addKanata,
  617. removeKanata,
  618. getKanata,
  619. __getKanataSuperHackDontUseIt
  620. }
  621. }
  622. declare module 'XrFrame/core/Component' {
  623. type Element = import('XrFrame/core/Element').default
  624. /**
  625. * `Component`属性的注解接口。
  626. *
  627. * `key`是可以写在组件对应于`xml`中的属性的名字。
  628. * `type`是属性的类型,由{@link registerDataValue}注册。
  629. * 可选的`defaultValue`可以定义默认值。
  630. */
  631. export interface IComponentSchema {
  632. [key: string]: {
  633. type: string
  634. defaultValue?: any
  635. }
  636. }
  637. /**
  638. * 组件,系统核心之一。
  639. *
  640. * 组件就是`wxml`的标签上写的那些`attribute`,比如`<xr-element transform="position: 1 1 1" />`中,`transform`就是一个组件,`position`是它的一个属性。
  641. * 这些属性可以在`schema`中被定义,变化时会触发对应的生命周期。
  642. * 自定义组件最后使用{@link registerComponent},组件的属性可以使用代理规则来简化,比如以上的标签可以简化为`<xr-element position="1 1 1" />`,详见{@link Element}。
  643. *
  644. * @template IData 组件数据的类型,应当和`schema`中一致,用于TS类型推断。
  645. */
  646. export default class Component<IData> {
  647. /**
  648. * @internal
  649. */
  650. static TYPE: string
  651. static EVENTS: string[]
  652. /**
  653. * @internal
  654. */
  655. static SPLIT_DATA(dataStr: string): {
  656. [key: string]: string
  657. }
  658. /**
  659. * 自定义组件的`schema`。
  660. */
  661. readonly schema: IComponentSchema
  662. /**
  663. * 自定义组件的更新优先级。
  664. */
  665. readonly priority: number
  666. __DATA_TYPE: IData
  667. protected _version: number
  668. protected _currentData: IData
  669. /**
  670. * 挂载的元素。
  671. */
  672. get el(): import('XrFrame/core/Element').default
  673. /**
  674. * 当前场景。
  675. */
  676. get scene(): import('XrFrame/core/Scene').default
  677. /**
  678. * 当前版本,每次有数据更新都会增加,可以用作和其他组件合作的依据。
  679. */
  680. get version(): number
  681. /**
  682. * 不通过`xml`而是直接设置`data`,注意值的类型需要和`schema`中一致。
  683. */
  684. setData(data: Partial<IData>): void
  685. /**
  686. * 设置一个数据。
  687. */
  688. setDataOne<T extends keyof IData>(key: T, value: IData[T]): void
  689. /**
  690. * 获取一个当前值。
  691. */
  692. getData<T extends keyof IData>(key: T): IData[T]
  693. /**
  694. * @internal
  695. */
  696. /**
  697. * @internal
  698. */
  699. /**
  700. * @internal
  701. */
  702. /**
  703. * @internal
  704. * 仅针对某些hack情况!
  705. */
  706. /**
  707. * @internal
  708. */
  709. /**
  710. * @internal
  711. */
  712. /**
  713. * @internal
  714. */
  715. /**
  716. * @internal
  717. */
  718. /**
  719. * @internal
  720. */
  721. /**
  722. * @internal
  723. */
  724. /**
  725. * 所挂载的`element`被挂载到场景时触发的回调。
  726. */
  727. onAdd(parent: Element, data: IData): void
  728. /**
  729. * 数据更新时触发的回调。
  730. */
  731. onUpdate(data: IData, preData: IData): void
  732. /**
  733. * 渲染每帧触发的回调。
  734. * @param deltaTime 单位为毫秒(ms)。
  735. */
  736. onTick(deltaTime: number, data: IData): void
  737. /**
  738. * 所挂载的`element`从父节点`parent`被移除时,或者自己从`element`上被移除时,触发的回调。
  739. * 一般用于消除功能的运作。
  740. * **如果一个组件的元素直接被销毁了,那这个组件就不会经历onRemove而是直接进入onRelease。**
  741. */
  742. onRemove(parent: Element, data: IData): void
  743. /**
  744. * 从被挂载的`element`上被移除,或是`element`被销毁时,触发的回调。
  745. * 一般用于释放持有的资源。
  746. */
  747. onRelease(data: IData): void
  748. }
  749. export const TABLE: {
  750. [type: string]: new () => Component<any>
  751. }
  752. /**
  753. * @internal
  754. */
  755. export function getComponent(type: string): new () => Component<any>
  756. /**
  757. * 向系统中注册一个组件,然后可以在`xml`中使用。
  758. */
  759. export function registerComponent(
  760. type: string,
  761. clz: new () => Component<any>
  762. ): void
  763. export {}
  764. }
  765. declare module 'XrFrame/core/Element' {
  766. /**
  767. * Element.ts
  768. *
  769. * * @Date : 2022/4/1上午10:34:06
  770. */
  771. import Component from 'XrFrame/core/Component'
  772. import EventManager, {
  773. TFrameworkEventTrigger
  774. } from 'XrFrame/core/EventManager'
  775. /**
  776. * `Element`的默认组件集接口。
  777. *
  778. * `name`是组件注册时的名字,`key`是要默认设置的组件的属性名字,值是默认值,但应当和`xml`中一致,为**字符串**。
  779. */
  780. export interface IEntityComponents {
  781. [name: string]: {
  782. [key: string]: string
  783. }
  784. }
  785. /**
  786. * 空的默认组件集。
  787. */
  788. export const BasicDefaultComponents: IEntityComponents
  789. /**
  790. * 空的默认组件映射。
  791. */
  792. export const BasicDataMapping: {
  793. [key: string]: string[]
  794. }
  795. /**
  796. * 元素,系统核心之一。
  797. *
  798. * 本质上就是对应于`xml`中标签,所有的标签的实现都是继承自`Element`的,其一般不包含逻辑,仅仅是通过`defaultComponents`和`dataMapping`定义组件的集合与映射。
  799. * 自定义元素最后使用{#@link registerElement}。
  800. */
  801. export default class Element {
  802. static TYPE: string
  803. /**
  804. * `Element`的默认组件集合,详见{@link IEntityComponents}。
  805. */
  806. readonly defaultComponents: IEntityComponents
  807. /**
  808. * `Element`的数据映射。它是为了给组件的属性提供一个方便的用法,比如:
  809. * ```ts
  810. * {
  811. * position: [transform, position]
  812. * }
  813. * ```
  814. * 就是将`xml`中写在这个`Element`的`position`直接映射到了`transform`组件的`position`属性上。
  815. *
  816. * **通常来讲,所有的驼峰如`nodeId`都会被映射为小写加中划线`node-id`**。
  817. */
  818. readonly dataMapping: {
  819. [key: string]: string[]
  820. }
  821. /**
  822. * @internal
  823. */
  824. readonly neverTick: boolean
  825. /**
  826. * 名字,写在`xml`上的那个`name`,不唯一。
  827. */
  828. get name(): string
  829. set name(value: string)
  830. /**
  831. * @internal
  832. */
  833. /**
  834. * 元素是否在`xml`中,若是`xr-shadow`下的节点,则为`false`。
  835. */
  836. get inXML(): boolean
  837. /**
  838. * 场景实例。
  839. */
  840. get scene(): import('XrFrame/core/Scene').default
  841. /**
  842. * 父元素。
  843. */
  844. get parent(): Element
  845. /**
  846. * 事件管理器。
  847. */
  848. get event(): EventManager
  849. constructor(_type: string, triggerEvent: TFrameworkEventTrigger)
  850. /**
  851. * 获取第`index`个子元素。
  852. */
  853. getChildAtIndex<T extends Element = Element>(index: number): T
  854. /**
  855. * 通过`filter`获取子元素。
  856. */
  857. getChildByFilter<T extends Element = Element>(
  858. filter: (child: Element) => boolean
  859. ): T
  860. /**
  861. * 通过`filter`获取子元素列表。
  862. */
  863. getChildrenByFilter(filter: (child: Element) => boolean): Element[]
  864. /**
  865. * 通过元素的类获取子元素。
  866. */
  867. getChildByClass<T extends Element = Element>(
  868. clz: new (...args: any[]) => T
  869. ): T
  870. /**
  871. * 通过元素的名字`name`获取子元素。
  872. */
  873. getChildByName<T extends Element = Element>(name: string): T
  874. /**
  875. * 通过元素的名字`name`获取子元素们。
  876. */
  877. getChildrenByName(name: string): Element[]
  878. /**
  879. * 递归遍历元素的所有子孙节点。
  880. */
  881. dfs<T extends any>(
  882. callback: (element: Element, params?: T) => T,
  883. defaultParams?: T,
  884. excludeRoot?: boolean,
  885. stop?: (element: Element, params?: T) => boolean
  886. ): void
  887. /**
  888. * 手动添加一个`Component`。
  889. */
  890. addComponent<T extends Component<any>>(
  891. clz: new () => T,
  892. options?: T['__DATA_TYPE']
  893. ): T
  894. /**
  895. * 获取一个`Component`,可以使用类或者名字获取。
  896. */
  897. getComponent<T extends Component<any>>(clzName: string): T
  898. getComponent<T extends Component<any>>(clz: new () => T): T
  899. /**
  900. * 手动移除一个`Component`,注意保证其不在`xml`上。
  901. */
  902. removeComponent(clz: new () => Component<any>): void
  903. /**
  904. * 设置一个属性,对应于`xml`标签中的那些属性,值为字符串。
  905. * **一般建议使用`component`的`setData`方法**!!!
  906. */
  907. setAttribute(name: string, value: string): void
  908. /**
  909. * @internal
  910. */
  911. /**
  912. * @internal
  913. */
  914. /**
  915. * @internal
  916. */
  917. /**
  918. * @internal
  919. */
  920. _associateValue(_v: any): void
  921. /**
  922. * 手动添加一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。
  923. */
  924. addChild(child: Element): void
  925. /**
  926. * 手动移除一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。
  927. * **只调用removeChild没有办法走进子节点的onRelease里**,需要手动调用子节点的release才行。
  928. */
  929. removeChild(child: Element): void
  930. /**
  931. * 仅限自己创建的节点使用,否则后果自负。
  932. */
  933. setId(id: string): void
  934. /**
  935. * 仅限自己创建的节点使用,否则后果自负。
  936. */
  937. release(): void
  938. /**
  939. * @internal
  940. */
  941. _appendChild(_child: Element, custom?: boolean): void
  942. /**
  943. * @internal
  944. */
  945. _removeChild(_child: Element, _index?: number, custom?: boolean): void
  946. /**
  947. * @internal
  948. */
  949. _insertBefore(_child: Element, _before?: Element, _index?: number): void
  950. /**
  951. * @internal
  952. */
  953. _replaceChild(
  954. _child: Element,
  955. _oldChild?: Element,
  956. _index?: number
  957. ): void
  958. /**
  959. * @internal
  960. */
  961. _spliceBefore(
  962. _before: number | Element,
  963. _deleteCount: number,
  964. _list: Element
  965. ): void
  966. /**
  967. * @internal
  968. */
  969. _spliceAppend(_list: Element): void
  970. /**
  971. * @internal
  972. */
  973. _spliceRemove(_before: Element, _deleteCount: number): void
  974. /**
  975. * @internal
  976. */
  977. _setId(_id: string): void
  978. /**
  979. * @internal
  980. */
  981. _setStyleScope(_styleScope: number): void
  982. /**
  983. * @internal
  984. */
  985. _setStyle(_styleText: string): void
  986. /**
  987. * @internal
  988. */
  989. _addClass(_elementClass: string, _styleScope?: number): void
  990. /**
  991. * @internal
  992. */
  993. _removeClass(_elementClass: string, _styleScope?: number): void
  994. /**
  995. * @internal
  996. */
  997. /**
  998. * @internal
  999. */
  1000. _setAttribute(_name: string, _value: string): void
  1001. _removeAttribute(_name: string): void
  1002. _setText(_content: string): void
  1003. }
  1004. export const TABLE: {
  1005. [type: string]: typeof Element
  1006. }
  1007. export function getElement(type: string): typeof Element
  1008. /**
  1009. * 注册一个自定义元素。
  1010. * 注意注册的`type`在`xml`中使用时需要加上`xr-`前缀,比如注册`custom`类型的元素,使用时需要时`xr-custom`。
  1011. */
  1012. export function registerElement(type: string, clz: typeof Element): void
  1013. }
  1014. declare module 'XrFrame/core/DataValue' {
  1015. /**
  1016. * DataValue.ts
  1017. *
  1018. * * @Date : 2022/3/17下午2:22:19
  1019. */
  1020. import { Kanata } from 'XrFrame/ext'
  1021. import Scene from 'XrFrame/core/Scene'
  1022. /**
  1023. * 详见{@link registerDataValue}。
  1024. */
  1025. export interface IDataValueHandler<TDataValue> {
  1026. create(value: string, defaultValue: any, scene: Scene): TDataValue
  1027. }
  1028. export interface ITextureWrapper {
  1029. texture: Kanata.Texture
  1030. }
  1031. export function isTextureWrapper(value: any): value is ITextureWrapper
  1032. export function isDataValueHandlerExisted(type: string): boolean
  1033. /**
  1034. * 为组件在`xml`中写的属性值按类型注册解析器,由于`xml`传入的值全部都是字符串,所以需要解析,比如:
  1035. * ```ts
  1036. * registerDataValue('number', {create: (value: string, defaultValue: any, scene: Scene) => {
  1037. * return value === undefined ? defaultValue : parseFloat(value));
  1038. * }});
  1039. * ```
  1040. * 就是注册了`number`类型,后续在组件的`schema`中写的`number`类型数据,就会走这个解析器。
  1041. * **注意最后一个参数`scene`可以用于获取资源等,比如`scene.assets.getAssetWithState(type, value, defaultValue)`。**
  1042. * **如果是被资源加载器加载的资源,则会在资源加载器注册时自动注册数据类型,详见{@link AssetLoader}**。
  1043. *
  1044. * 已经注册的类型可见[组件数据解析](../../../component/xr-frame/core/data-values)。
  1045. */
  1046. export function registerDataValue<TDataValue>(
  1047. type: string,
  1048. handler: IDataValueHandler<TDataValue>
  1049. ): void
  1050. export function parseDataValue<TDataValue>(
  1051. type: string,
  1052. value: string,
  1053. defaultValue: any,
  1054. scene: Scene
  1055. ): TDataValue
  1056. }
  1057. declare module 'XrFrame/core/EventManager' {
  1058. /**
  1059. * EventManager.ts
  1060. *
  1061. * * @Date : 2022/3/17下午3:54:03
  1062. */
  1063. import Observable from 'XrFrame/core/Observable'
  1064. type Element = import('XrFrame/core/Element').default
  1065. /**
  1066. * 事件管理器的回调。
  1067. */
  1068. export type TEventCallback<TParams> = (
  1069. params: TParams,
  1070. sender: Element
  1071. ) => void
  1072. export type TFrameworkEventTrigger = (
  1073. name: string,
  1074. details: any,
  1075. options: {
  1076. bubbles?: boolean
  1077. composed?: boolean
  1078. capturePhase?: boolean
  1079. }
  1080. ) => void
  1081. /**
  1082. * 事件管理器。
  1083. *
  1084. * 每个`Element`都有自己的事件管理器,通过参数可以触发到`xml`。
  1085. */
  1086. export default class EventManager {
  1087. isEventManager: boolean
  1088. protected _observables: {
  1089. [type: string]: Observable
  1090. }
  1091. protected _caches: {
  1092. [type: string]: {
  1093. value: any
  1094. toXML: boolean
  1095. bubbles: boolean
  1096. }
  1097. }
  1098. protected _wxmlBind: {
  1099. [type: string]: boolean
  1100. }
  1101. constructor(_el: Element, _triggerElementEvent: TFrameworkEventTrigger)
  1102. /**
  1103. * 添加一个事件监听器。
  1104. */
  1105. add<TEvent = any>(
  1106. type: string,
  1107. callback: TEventCallback<TEvent>,
  1108. priority?: number
  1109. ): this
  1110. /**
  1111. * 添加一个事件监听器,触发一次后自动移除。
  1112. */
  1113. addOnce<TEvent = any>(
  1114. type: string,
  1115. callback: TEventCallback<TEvent>,
  1116. priority?: number
  1117. ): this
  1118. /**
  1119. * 移除一个事件监听器。
  1120. */
  1121. remove<TEvent = any>(
  1122. type: string,
  1123. callback: TEventCallback<TEvent>
  1124. ): this
  1125. /**
  1126. * 判断一个事件是否被注册。
  1127. * 注册是指用户绑定过了至少一个事件处理器,无论是来自于wxml还是JS。
  1128. */
  1129. has(type: string): boolean
  1130. /**
  1131. * 获取一个事件监听者数量。
  1132. * @internal
  1133. */
  1134. getCount(type: string): number
  1135. /**
  1136. * 清空某事件的所有监听器。
  1137. */
  1138. clear(type: string): this
  1139. /**
  1140. * 触发一个事件。
  1141. *
  1142. * @param type 要触发的事件类型。
  1143. * @param event 事件的值。
  1144. * @param immediately 是否要将事件立即分发,如果不则会先缓存,之后在每一帧更新前统一分发,避免不必要的分发。
  1145. * @param toXML 是否要派发到`xml`绑定的事件中。
  1146. * @param bubbles 是否要进行事件冒泡。
  1147. */
  1148. trigger<TEvent = any>(
  1149. type: string,
  1150. event?: TEvent,
  1151. immediately?: boolean,
  1152. toXML?: boolean,
  1153. bubbles?: boolean
  1154. ): this
  1155. /**
  1156. * 分发某个缓存的事件,一般不需要自行触发。
  1157. */
  1158. flush(type: string): this
  1159. /**
  1160. * 分发所有缓存的事件,一般不需要自行触发。
  1161. */
  1162. flushAll(): this
  1163. }
  1164. export {}
  1165. }
  1166. declare module 'XrFrame/genLspMeta' {
  1167. import { Scene } from 'XrFrame/elements'
  1168. export interface IXRFrameMeta {
  1169. elements: {
  1170. name: string[]
  1171. meta: {
  1172. [name: string]: IXRFrameElement
  1173. }
  1174. }
  1175. components: {
  1176. name: string[]
  1177. meta: {
  1178. [name: string]: IXRFrameComponent
  1179. }
  1180. }
  1181. }
  1182. export interface IXRFrameElement {
  1183. defaultComps: string[]
  1184. mappings: {
  1185. name: string[]
  1186. meta: {
  1187. [name: string]: string[]
  1188. }
  1189. }
  1190. events: string[]
  1191. limitComps?: string[]
  1192. }
  1193. export interface IXRFrameComponent {
  1194. keys: string[]
  1195. meta: {
  1196. [key: string]: IXRFrameData
  1197. }
  1198. events: string[]
  1199. }
  1200. export interface IXRFrameData {
  1201. type: string
  1202. defaultValue: any
  1203. map?: IXRFrameMap
  1204. enum?: IXRFrameEnum
  1205. }
  1206. export interface IXRFrameMap {
  1207. keys: string[]
  1208. meta: {
  1209. [key: string]: {
  1210. type: string
  1211. defaultValue?: string | number
  1212. enum?: IXRFrameEnum
  1213. }
  1214. }
  1215. }
  1216. export interface IXRFrameEnum {
  1217. values: Array<{
  1218. value: string | number
  1219. desc?: string
  1220. }>
  1221. }
  1222. export function genLspMeta(scene: Scene): IXRFrameMeta
  1223. }
  1224. declare module 'XrFrame/components' {
  1225. export {
  1226. default as Transform,
  1227. ITransformData,
  1228. TransformSchema
  1229. } from 'XrFrame/components/Transform'
  1230. export {
  1231. default as AssetLoad,
  1232. AssetLoadSchema
  1233. } from 'XrFrame/components/AssetLoad'
  1234. export {
  1235. default as Assets,
  1236. IAssetsData,
  1237. AssetsSchema
  1238. } from 'XrFrame/components/Assets'
  1239. export {
  1240. default as Camera,
  1241. ICameraData,
  1242. CameraSchema,
  1243. TCameraBackground
  1244. } from 'XrFrame/components/Camera'
  1245. export {
  1246. default as GLTF,
  1247. IGLTFData,
  1248. GLTFSchema
  1249. } from 'XrFrame/components/GLTF'
  1250. export {
  1251. default as Light,
  1252. ILightData,
  1253. LightSchema
  1254. } from 'XrFrame/components/Light'
  1255. export {
  1256. default as AssetMaterial,
  1257. IAssetMaterialData,
  1258. AssetMaterialSchema
  1259. } from 'XrFrame/components/AssetMaterial'
  1260. export {
  1261. default as Mesh,
  1262. IMeshData,
  1263. MeshSchema
  1264. } from 'XrFrame/components/Mesh'
  1265. export {
  1266. default as Text,
  1267. ITextData,
  1268. TextSchema
  1269. } from 'XrFrame/components/text/Text'
  1270. export { default as Particle } from 'XrFrame/components/particle/Particle'
  1271. export {
  1272. IParticleData,
  1273. ParticleSchema
  1274. } from 'XrFrame/components/particle/BasicParticle'
  1275. export {
  1276. default as AssetRenderTexture,
  1277. IAssetRenderTextureData,
  1278. AssetRenderTextureSchema
  1279. } from 'XrFrame/components/AssetRenderTexture'
  1280. export { default as Env, IEnvData, EnvSchema } from 'XrFrame/components/Env'
  1281. export {
  1282. default as Animator,
  1283. IAnimatorData,
  1284. AnimatorSchema,
  1285. IAnimationPlayOptions,
  1286. IAnimatorAutoPlay
  1287. } from 'XrFrame/components/Animator'
  1288. export {
  1289. default as CameraOrbitControl,
  1290. ICameraOrbitControlData,
  1291. CameraOrbitControlSchema
  1292. } from 'XrFrame/components/CameraOrbitControl'
  1293. export {
  1294. default as ARTracker,
  1295. IARTrackerData,
  1296. ARTrackSchema,
  1297. TTrackMode,
  1298. EARTrackerState,
  1299. IARTrackerRawData
  1300. } from 'XrFrame/components/ARTracker'
  1301. export {
  1302. default as Shape,
  1303. IShapeData,
  1304. EShapeType
  1305. } from 'XrFrame/components/physics/Shape'
  1306. export {
  1307. default as SphereShape,
  1308. ISphereShapeData,
  1309. SphereShapeSchema
  1310. } from 'XrFrame/components/physics/SphereShape'
  1311. export {
  1312. default as MeshShape,
  1313. IMeshShapeData,
  1314. MeshShapeSchema
  1315. } from 'XrFrame/components/physics/MeshShape'
  1316. export {
  1317. default as CapsuleShape,
  1318. ICapsuleShapeData,
  1319. CapsuleShapeSchema,
  1320. ECapsuleShapeDirection
  1321. } from 'XrFrame/components/physics/CapsuleShape'
  1322. export {
  1323. default as CubeShape,
  1324. ICubeShapeData,
  1325. CubeShapeSchema
  1326. } from 'XrFrame/components/physics/CubeShape'
  1327. export {
  1328. default as Rigidbody,
  1329. IRigidbodyData,
  1330. RigidbodySchema
  1331. } from 'XrFrame/components/physics/Rigidbody'
  1332. export {
  1333. default as ShapeInteract,
  1334. IShapeInteractData,
  1335. ShapeInteractSchema
  1336. } from 'XrFrame/components/physics/ShapeInteract'
  1337. export {
  1338. default as ShapeGizmos,
  1339. IShapeGizmosData
  1340. } from 'XrFrame/components/gizmo/ShapeGizmos'
  1341. export {
  1342. default as AssetPostProcess,
  1343. IAssetPostProcessData
  1344. } from 'XrFrame/components/AssetPostProcess'
  1345. }
  1346. declare module 'XrFrame/elements' {
  1347. export {
  1348. default as Scene,
  1349. SceneDataMapping,
  1350. SceneDefaultComponents
  1351. } from 'XrFrame/core/Scene'
  1352. export {
  1353. default as XRNode,
  1354. NodeDataMapping,
  1355. NodeDefaultComponents
  1356. } from 'XrFrame/elements/xr-node'
  1357. export {
  1358. default as XRShadow,
  1359. ShadowDataMapping,
  1360. ShadowDefaultComponents
  1361. } from 'XrFrame/elements/xr-shadow'
  1362. export {
  1363. default as XRCamera,
  1364. CameraDataMapping,
  1365. CameraDefaultComponents
  1366. } from 'XrFrame/elements/xr-camera'
  1367. export {
  1368. default as XRMesh,
  1369. MeshDataMapping,
  1370. MeshDefaultComponents
  1371. } from 'XrFrame/elements/xr-mesh'
  1372. export {
  1373. default as XRLight,
  1374. LightDataMapping,
  1375. LightDefaultComponents
  1376. } from 'XrFrame/elements/xr-light'
  1377. export {
  1378. default as XRGLTF,
  1379. GLTFDataMapping,
  1380. GLTFDefaultComponents
  1381. } from 'XrFrame/elements/xr-gltf'
  1382. export {
  1383. default as XRMaterial,
  1384. AssetMaterialDataMapping,
  1385. AssetMaterialDefaultComponents
  1386. } from 'XrFrame/elements/xr-asset-material'
  1387. export {
  1388. default as XRAssetRenderTexture,
  1389. AssetRenderTextureDataMapping,
  1390. AssetRenderTextureDefaultComponents
  1391. } from 'XrFrame/elements/xr-asset-render-texture'
  1392. export {
  1393. default as XRAssetLoad,
  1394. AssetLoadDataMapping
  1395. } from 'XrFrame/elements/xr-asset-load'
  1396. export {
  1397. default as XRAssets,
  1398. AssetsDefaultComponents
  1399. } from 'XrFrame/elements/xr-assets'
  1400. export {
  1401. default as XREnv,
  1402. EnvDataMapping,
  1403. EnvDefaultComponents
  1404. } from 'XrFrame/elements/xr-env'
  1405. export {
  1406. default as XRARTracker,
  1407. ARTrackerDataMapping,
  1408. ARTrackerDefaultComponents
  1409. } from 'XrFrame/elements/xr-ar-tracker'
  1410. export {
  1411. default as XRText,
  1412. TextDataMapping,
  1413. TextDefaultComponents
  1414. } from 'XrFrame/elements/xr-text'
  1415. export {
  1416. default as XRParticle,
  1417. ParticleDataMapping,
  1418. ParticleDefaultComponents
  1419. } from 'XrFrame/elements/xr-particle'
  1420. export {
  1421. default as XRAssetPostProcess,
  1422. AssetPostProcessDataMapping,
  1423. AssetPostProcessDefaultComponents
  1424. } from 'XrFrame/elements/xr-asset-post-process'
  1425. }
  1426. declare module 'XrFrame/systems' {
  1427. export {
  1428. default as AssetsSystem,
  1429. IAssetsSystemData
  1430. } from 'XrFrame/systems/AssetsSystem'
  1431. export {
  1432. default as NodeSystem,
  1433. INodeSystemData
  1434. } from 'XrFrame/systems/NodeSystem'
  1435. export {
  1436. default as TickSystem,
  1437. ITickSystemData
  1438. } from 'XrFrame/systems/TickSystem'
  1439. export {
  1440. default as AnimationSystem,
  1441. IAnimationSystemData
  1442. } from 'XrFrame/systems/AnimationSystem'
  1443. export {
  1444. default as VideoSystem,
  1445. IVideoSystemData
  1446. } from 'XrFrame/systems/VideoSystem'
  1447. export {
  1448. default as RenderSystem,
  1449. IRenderSystemData,
  1450. RenderSystemSchema
  1451. } from 'XrFrame/systems/RenderSystem'
  1452. export {
  1453. default as PhysicsSystem,
  1454. IPhysicsSystemData,
  1455. IShapeDragEvent,
  1456. IShapeTouchEvent
  1457. } from 'XrFrame/systems/PhysicsSystem'
  1458. export {
  1459. default as ARSystem,
  1460. IARSystemData,
  1461. ARSystemSchema,
  1462. IARRawData
  1463. } from 'XrFrame/systems/ARSystem'
  1464. export {
  1465. default as ShareSystem,
  1466. IShareSystemData,
  1467. IShareCaptureOptions,
  1468. IShareRecordOptions,
  1469. EShareRecordState
  1470. } from 'XrFrame/systems/ShareSystem'
  1471. export {
  1472. default as GizmoSystem,
  1473. IGizmoSystemData
  1474. } from 'XrFrame/systems/GizmoSystem'
  1475. }
  1476. declare module 'XrFrame/loader' {
  1477. export {
  1478. default as AssetLoader,
  1479. ILoaderOptionsSchema,
  1480. registerAssetLoader
  1481. } from 'XrFrame/loader/AssetLoader'
  1482. export {
  1483. default as TextureLoader,
  1484. ITextureLoaderOptions
  1485. } from 'XrFrame/loader/TextureLoader'
  1486. export {
  1487. default as ImageLoader,
  1488. IImageLoaderOptions
  1489. } from 'XrFrame/loader/ImageLoader'
  1490. export {
  1491. default as CubeTextureLoader,
  1492. ICubeTextureLoaderOptions
  1493. } from 'XrFrame/loader/CubeTextureLoader'
  1494. export {
  1495. default as VideoTextureLoader,
  1496. IVideoTextureLoaderOptions
  1497. } from 'XrFrame/loader/VideoTextureLoader'
  1498. export {
  1499. default as EnvDataLoader,
  1500. IEnvDataLoaderOptions
  1501. } from 'XrFrame/loader/EnvDataLoader'
  1502. export {
  1503. default as GLTFLoader,
  1504. IGLTFLoaderOptions
  1505. } from 'XrFrame/loader/GlTFLoader'
  1506. export {
  1507. default as KeyframeLoader,
  1508. IKeyframeLoaderOptions
  1509. } from 'XrFrame/loader/KeyframeLoader'
  1510. export {
  1511. default as RawLoader,
  1512. IRawLoaderOptions
  1513. } from 'XrFrame/loader/RawLoader'
  1514. export {
  1515. default as AtlasLoader,
  1516. IAtlasLoaderOptions
  1517. } from 'XrFrame/loader/AtlasLoader'
  1518. }
  1519. declare module 'XrFrame/assets/Effect' {
  1520. /**
  1521. * Effect.ts
  1522. *
  1523. * * @Date : 2022/3/16下午4:44:48
  1524. */
  1525. import { ITextureWrapper } from 'XrFrame/core/DataValue'
  1526. import { Kanata } from 'XrFrame/ext'
  1527. import { IAssetWithState } from 'XrFrame/loader/types'
  1528. type Scene = import('XrFrame/core/Scene').default
  1529. /**
  1530. * 支持定制的渲染状态。
  1531. *
  1532. * 大部分状态会定制的开发者应该看名字就懂,就不详细说明了。
  1533. */
  1534. export interface IRenderStates {
  1535. /**
  1536. * 渲染队列,大于等于`2500`为透明物体,否则为非透明物体。
  1537. */
  1538. renderQueue?: number
  1539. blendOn?: boolean
  1540. /**
  1541. * 不要使用,使用`blendSrcRGB`。
  1542. */
  1543. blendSrc?: Kanata.EBlendFactor
  1544. blendSrcRGB?: Kanata.EBlendFactor
  1545. blendSrcAlpha?: Kanata.EBlendFactor
  1546. /**
  1547. * 不要使用,使用`blendDstRGB`。
  1548. */
  1549. blendDst?: Kanata.EBlendFactor
  1550. blendDstRGB?: Kanata.EBlendFactor
  1551. blendDstAlpha?: Kanata.EBlendFactor
  1552. blendFunc?: Kanata.EBlendEquation
  1553. cullOn?: boolean
  1554. cullFace?: Kanata.ECullMode
  1555. depthWrite?: boolean
  1556. depthTestOn?: boolean
  1557. depthTestComp?: Kanata.ECompareFunc
  1558. /**
  1559. * 在基础库版本`v2.31.1`以上支持。
  1560. */
  1561. colorWrite?: number
  1562. stencilWriteMask?: number
  1563. stencilTestOn?: boolean
  1564. stencilRef?: number
  1565. stencilReadMask?: number
  1566. stencilComp?: Kanata.ECompareFunc
  1567. stencilPass?: Kanata.EStencilOp
  1568. stencilFail?: Kanata.EStencilOp
  1569. stencilZFail?: Kanata.EStencilOp
  1570. primitiveType?: Kanata.EPrimitiveType
  1571. }
  1572. /**
  1573. * `Effect`资源的参数接口。
  1574. */
  1575. export interface IEffectAsset {
  1576. /**
  1577. * 名字,应当和`registerEffect`时的名字一致。
  1578. */
  1579. name: string
  1580. /**
  1581. * 属性,传给UniformBlock的一部分。
  1582. */
  1583. properties?: Array<{
  1584. /**
  1585. * 属性名字。
  1586. */
  1587. key: string
  1588. /**
  1589. * 属性类型。
  1590. */
  1591. type: Kanata.EUniformType
  1592. /**
  1593. * 如果属性是一个数组,比如`FLOAT4`数组,可以指定数组大小。
  1594. */
  1595. num?: number
  1596. /**
  1597. * 属性默认值,需要和类型匹配。
  1598. */
  1599. default: number[]
  1600. /**
  1601. * 属性对应的宏,当默认值被覆盖时,此宏开关会被开启,注意一定要有`WX_`前缀!
  1602. */
  1603. macro?: string
  1604. }>
  1605. /**
  1606. * 纹理资源,传给UniformBlock的另一部分。
  1607. */
  1608. images?: Array<{
  1609. /**
  1610. * 属性名字。
  1611. */
  1612. key: string
  1613. /**
  1614. * 属性默认值,是`Texture`类型资源的`asset-id`。
  1615. */
  1616. default: string
  1617. /**
  1618. * 属性对应的宏,当默认值被覆盖时,此宏开关会被开启,注意一定要有`WX_`前缀!
  1619. */
  1620. macro?: string
  1621. }>
  1622. /**
  1623. * 使用该`Effect`的`Material`的默认渲染队列。
  1624. * 透明物体需要大于`2500`!
  1625. */
  1626. defaultRenderQueue: number
  1627. /**
  1628. * 渲染时的`passes`,渲染时指定的`lightMode`的每个`pass`都会被按顺序绘制。
  1629. */
  1630. passes: Array<{
  1631. /**
  1632. * 渲染的光照模式。
  1633. */
  1634. lightMode:
  1635. | 'ForwardBase'
  1636. | 'ForwardAdd'
  1637. | 'ShadowCaster'
  1638. | 'PostProcess'
  1639. | 'Skybox'
  1640. | string
  1641. /**
  1642. * 这个pass的渲染状态是否可以被`Material`覆盖。
  1643. */
  1644. useMaterialRenderStates: boolean
  1645. /**
  1646. * 这个pass的默认渲染状态。
  1647. */
  1648. renderStates?: IRenderStates
  1649. /**
  1650. * 这个pass的使用的`shader`在`shaders`中的索引,第一个是顶点着色器,第二个是片段着色器。
  1651. */
  1652. shaders: [number, number]
  1653. }>
  1654. /**
  1655. * 所有的`shader`列表。
  1656. */
  1657. shaders: string[]
  1658. }
  1659. /**
  1660. * 特效资源,定义了渲染所需的大部分参数,被{@link Material}所引用。
  1661. */
  1662. export default class Effect {
  1663. protected _scene: Scene
  1664. readonly description: IEffectAsset
  1665. /**
  1666. * 获取名称。
  1667. */
  1668. get name(): string
  1669. /**
  1670. * 获取场景实例。
  1671. */
  1672. get scene(): import('XrFrame/core/Scene').default
  1673. /**
  1674. * Backend对应的对象。
  1675. * @internal
  1676. */
  1677. get kanataEffect(): import('XrFrame/kanata/lib/index').Effect
  1678. /**
  1679. * 有几个Pass。
  1680. */
  1681. get passCount(): number
  1682. /**
  1683. * 正在加载中的纹理。
  1684. * @internal
  1685. */
  1686. get loadingTextures(): {
  1687. [key: string]: IAssetWithState<
  1688. import('XrFrame/kanata/lib/index').Texture | ITextureWrapper
  1689. >
  1690. }
  1691. /**
  1692. * 用于UniformBlock构建时传入
  1693. * @internal
  1694. */
  1695. _shaderUniformBlockDesc?: Kanata.UniformDescriptor
  1696. /**
  1697. * 是否没有properties。
  1698. * @internal
  1699. */
  1700. _isNoProperties: boolean
  1701. /**
  1702. * 是否没有images。
  1703. * @internal
  1704. */
  1705. _isNoImages: boolean
  1706. /**
  1707. * 根据特效配置生成特效资源。
  1708. * **注意,不建议自己创建,请使用`scene.createEffect`。**
  1709. *
  1710. * @param description 配置。
  1711. */
  1712. constructor(_scene: Scene, description: IEffectAsset)
  1713. /**
  1714. * 材质调用方法,拷贝默认UniformBlock。
  1715. * @internal
  1716. */
  1717. /**
  1718. * @internal
  1719. */
  1720. /**
  1721. * 预编译
  1722. */
  1723. warmUp(): boolean
  1724. }
  1725. export {}
  1726. }
  1727. declare module 'XrFrame/assets/Geometry' {
  1728. import { Kanata } from 'XrFrame/ext'
  1729. import BoundBall from 'XrFrame/math/boundBall'
  1730. import BoundBox from 'XrFrame/math/boundBox'
  1731. import Vector3 from 'XrFrame/math/vector3'
  1732. type Scene = import('XrFrame/core/Scene').default
  1733. /**
  1734. * `Geometry`中的Submesh定义。
  1735. */
  1736. export interface ISubMesh {
  1737. /**
  1738. * 子mesh的顶点偏移。
  1739. */
  1740. offset: number
  1741. /**
  1742. * 子mesh的顶点数量。
  1743. */
  1744. length: number
  1745. /**
  1746. * 子mesh的材质索引。
  1747. */
  1748. materialIndex: number
  1749. }
  1750. /**
  1751. * 几何资源,用于定义渲染中的图元数据。
  1752. */
  1753. export default class Geometry {
  1754. protected _scene: Scene
  1755. /**
  1756. * @internal
  1757. */
  1758. static readonly RAWLENGTH = 10
  1759. /**
  1760. * @internal
  1761. * 从 96 切换到 76 个,换取多余的 uniform 上限
  1762. */
  1763. static readonly MAX_BONECOUNT = 76
  1764. /**
  1765. * @internal
  1766. */
  1767. /**
  1768. * 获取IndexBuffer。
  1769. */
  1770. get indexBuffer(): import('XrFrame/kanata/lib/index').IndexBuffer
  1771. /**
  1772. * 获取VertexBuffer。
  1773. */
  1774. get vertexBuffer(): import('XrFrame/kanata/lib/index').VertexBuffer
  1775. /**
  1776. * 获取IndexData。
  1777. * 这种类型的索引数据用于合批,只对于开启了`dynamicBatch`的Renderer有效。
  1778. * 注意如果已经获取过`indexBuffer`,将无效。
  1779. */
  1780. get indexData(): import('XrFrame/kanata/lib/index').IndexData
  1781. /**
  1782. * 获取VertexData。
  1783. * 这种类型的顶点数据用于合批,只对于开启了`dynamicBatch`的Renderer有效。
  1784. * 注意如果已经获取过`vertexBuffer`,将无效。
  1785. */
  1786. get vertexData(): import('XrFrame/kanata/lib/index').VertexData
  1787. /**
  1788. * 该mesh是否有效,有些情况可能会造成这种现象,例如vertexLayout和buffer数量不匹配
  1789. * 渲染时应该对该值做检查以防护
  1790. * @internal
  1791. */
  1792. get valid(): boolean
  1793. /**
  1794. * 包围球,只读。
  1795. */
  1796. get boundBall(): BoundBall
  1797. /**
  1798. * 包围盒,只读。
  1799. */
  1800. get boundBox(): BoundBox
  1801. /**
  1802. * 获取所有的SubMesh,不要修改。
  1803. * @internal
  1804. */
  1805. get subMeshes(): ISubMesh[]
  1806. /**
  1807. * 构造一个`Geometry`。
  1808. */
  1809. constructor(
  1810. _scene: Scene,
  1811. vertexLayout: Kanata.VertexLayout,
  1812. vBuffer: ArrayBufferView,
  1813. iBuffer: ArrayBufferView,
  1814. indexType?: Kanata.EIndexType
  1815. )
  1816. /**
  1817. * 更新VertexBuffer和IndexBuffer。
  1818. * @internal
  1819. */
  1820. uploadBufferData(
  1821. vBufferOffset: number,
  1822. vBufferLength: number,
  1823. iBufferOffset: number,
  1824. iBufferLength: number
  1825. ): void
  1826. /**
  1827. * 更新VertexBuffer。
  1828. * 仅在获取了`vertexBuffer`后有效。
  1829. */
  1830. uploadVertexBuffer(offset: number, buffer: ArrayBufferView): void
  1831. /**
  1832. * 更新IndexBuffer。
  1833. * 仅在获取了`indexBuffer`后有效。
  1834. */
  1835. uploadIndexBuffer(
  1836. offset: number,
  1837. buffer: Uint16Array | Uint32Array
  1838. ): void
  1839. /**
  1840. * 获取当前mesh有多少subMesh
  1841. */
  1842. getSubMeshCount(): number
  1843. /**
  1844. * 获取指定序号的subMesh的索引起始点
  1845. *
  1846. * @returns {number} 索引起始点,返回-1代表SubMesh不存在
  1847. */
  1848. getIndiceStart(subMeshIndex: number): number
  1849. /**
  1850. * 获取指定序号的subMesh的索引长度
  1851. *
  1852. * @returns {number} 索引长度,返回-1代表SubMesh不存在
  1853. */
  1854. getIndiceLength(subMeshIndex: number): number
  1855. /**
  1856. * 获取指定序号的subMesh的材质序号
  1857. *
  1858. * @returns {number} 材质序号,返回-1代表subMesh不存在
  1859. */
  1860. getMaterialIndex(subMeshIndex: number): number
  1861. /**
  1862. * 获取VertexLayout。
  1863. */
  1864. getVertexLayout(): Kanata.VertexLayout
  1865. /**
  1866. * 修改subMesh。
  1867. *
  1868. * @param length 索引长度
  1869. * @param offset 索引起始偏移
  1870. */
  1871. modifySubMesh(
  1872. subMeshIndex: number,
  1873. length: number,
  1874. offset: number
  1875. ): boolean
  1876. /**
  1877. * 增加subMesh。
  1878. *
  1879. * @param length 索引长度
  1880. * @param offset 索引起始偏移
  1881. */
  1882. addSubMesh(length: number, offset: number, materialIndex?: number): void
  1883. /**
  1884. * 动态更新包围盒,默认会自动计算包围球。
  1885. */
  1886. setBoundBox(
  1887. center: Vector3,
  1888. size: Vector3,
  1889. autoUpdateBall?: boolean
  1890. ): void
  1891. /**
  1892. * 动态更新包围球。
  1893. */
  1894. setBoundBall(center: Vector3, radius: number): void
  1895. /**
  1896. * 获取第一个顶点Buffer原始数据,可能没有值。
  1897. * @internal
  1898. */
  1899. /**
  1900. * 获取索引Buffer原始数据。
  1901. * @internal
  1902. */
  1903. }
  1904. export {}
  1905. }
  1906. declare module 'XrFrame/assets/Material' {
  1907. /**
  1908. * Material.ts
  1909. *
  1910. * * @Date : 2022/3/24上午11:21:54
  1911. */
  1912. import { Kanata } from 'XrFrame/ext'
  1913. import Effect, { IRenderStates } from 'XrFrame/assets/Effect'
  1914. import Vector2 from 'XrFrame/math/vector2'
  1915. import Vector3 from 'XrFrame/math/vector3'
  1916. import Vector4 from 'XrFrame/math/vector4'
  1917. import Matrix3 from 'XrFrame/math/matrix3'
  1918. import Matrix4 from 'XrFrame/math/matrix4'
  1919. import EnvData from 'XrFrame/assets/EnvData'
  1920. type Scene = import('XrFrame/core/Scene').default
  1921. /**
  1922. * 材质资源,一般被代理到{@link XRMaterial}元素。
  1923. */
  1924. export default class Material {
  1925. /**
  1926. * @internal
  1927. */
  1928. get kanataMaterial(): import('XrFrame/kanata/lib/index').Material
  1929. /**
  1930. * @internal
  1931. */
  1932. get uniforms(): import('XrFrame/kanata/lib/index').UniformBlock
  1933. set alphaMode(value: 'OPAQUE' | 'BLEND' | 'MASK')
  1934. set alphaCutOff(value: number)
  1935. /**
  1936. * 透明物体需要大于`2500`!
  1937. */
  1938. get renderQueue(): number
  1939. set renderQueue(value: number)
  1940. constructor(_scene: Scene)
  1941. /**
  1942. * 通过效果初始化材质。
  1943. */
  1944. initByEffect(
  1945. effect: Effect,
  1946. defaultUniforms?: {
  1947. [key: string]: ArrayLike<number> | number | Kanata.Texture
  1948. }
  1949. ): void
  1950. /**
  1951. * 获取一个Float
  1952. */
  1953. getFloat(key: string): number
  1954. /**
  1955. * 设置一个Float
  1956. *
  1957. * @returns 是否设置成功
  1958. */
  1959. setFloat(key: string, value: number): boolean
  1960. /**
  1961. * 设置一个Vector。
  1962. *
  1963. * @returns 是否设置成功。
  1964. */
  1965. setVector(key: string, value: Vector2 | Vector3 | Vector4): boolean
  1966. /**
  1967. * 获取一个Vector值的拷贝。
  1968. */
  1969. getVector(key: string): Vector2 | Vector3 | Vector4
  1970. /**
  1971. * 设置一个Matrix
  1972. *
  1973. * @returns 是否设置成功
  1974. */
  1975. setMatrix(key: string, value: Matrix3 | Matrix4): boolean
  1976. /**
  1977. * 获取一个Vector值的拷贝。
  1978. */
  1979. getMatrix(key: string): Matrix3 | Matrix4
  1980. /**
  1981. * 设置一张贴图。
  1982. *
  1983. * @returns 是否设置成功。
  1984. */
  1985. setTexture(key: string, value: Kanata.Texture): boolean
  1986. /**
  1987. * 设置一张贴图。
  1988. *
  1989. * @returns 是否设置成功。
  1990. */
  1991. setTextureAsset(key: string, assetId: string): boolean
  1992. resetTexture(key: string): import('XrFrame/kanata/lib/index').Texture
  1993. /**
  1994. * 直接通过Backend纹理ID设置纹理,注意需要自己持有纹理引用。
  1995. * @internal
  1996. *
  1997. * @returns 是否设置成功。
  1998. */
  1999. setFontTexture(key: string, id: number): boolean
  2000. /**
  2001. * 获取材质中已设置的贴图。
  2002. */
  2003. getTexture(key: string): Kanata.Texture
  2004. /**
  2005. * 设置渲染状态。
  2006. * 只有标记了`useMaterialRenderStates`的Pass会受到影响
  2007. */
  2008. setRenderState<TKey extends keyof IRenderStates>(
  2009. key: TKey,
  2010. value: IRenderStates[TKey]
  2011. ): boolean
  2012. /**
  2013. * 批量设置渲染状态。
  2014. * 只有标记了`useMaterialRenderStates`的Pass会受到影响。
  2015. */
  2016. setRenderStates(states: IRenderStates): boolean
  2017. /**
  2018. * 清除渲染状态。
  2019. * 清除材质的渲染状态,转而从effect中使用默认值。
  2020. */
  2021. clearRenderState<TKey extends keyof IRenderStates>(key: TKey): boolean
  2022. /**
  2023. * 批量清除渲染状态。
  2024. * 清除材质的渲染状态,转而从effect中使用默认值。
  2025. */
  2026. clearRenderStates(states: { [key: string]: any }): boolean
  2027. /**
  2028. * 获取渲染状态。
  2029. */
  2030. getRenderState(key: string): number | boolean
  2031. /**
  2032. * 设置宏。
  2033. */
  2034. setMacro(key: string, value: boolean | number): void
  2035. /**
  2036. * 批量设置宏。
  2037. */
  2038. setMacros(marcos: { [key: string]: number | boolean }): void
  2039. /**
  2040. * 获取宏。
  2041. */
  2042. getMacro(key: string): boolean
  2043. /**
  2044. * 拷贝自身,生成一份新的材质数据。
  2045. */
  2046. clone(): Material
  2047. /**
  2048. * @internal
  2049. */
  2050. /**
  2051. * @internal
  2052. */
  2053. /**
  2054. * @internal
  2055. */
  2056. }
  2057. export {}
  2058. }
  2059. declare module 'XrFrame/assets/VideoTexture' {
  2060. import { Kanata } from 'XrFrame/ext'
  2061. type Scene = import('XrFrame/core/Scene').default
  2062. /**
  2063. * 视频纹理{@link VideoTexture}的创建参数。
  2064. */
  2065. export interface IVideoTextureOptions {
  2066. /**
  2067. * 视频地址。
  2068. */
  2069. src: string
  2070. /**
  2071. * 视频未加载成功时,可选的首帧图片地址。
  2072. */
  2073. placeHolder?: Kanata.IImage
  2074. /**
  2075. * 是否要在加载完毕后自动播放。
  2076. */
  2077. autoPlay?: boolean
  2078. /**
  2079. * 是否要循环播放。
  2080. */
  2081. loop?: boolean
  2082. /**
  2083. * 是否禁止音频,默认禁止。
  2084. */
  2085. abortAudio?: boolean
  2086. /**
  2087. * 是否在小程序压后台时自动暂停,默认暂停。
  2088. */
  2089. autoPause?: boolean
  2090. }
  2091. export enum EVideoState {
  2092. Idle = 0,
  2093. WaitPlay = 1,
  2094. Playing = 2,
  2095. Paused = 3,
  2096. Released = 4
  2097. }
  2098. /**
  2099. * 视频纹理。
  2100. */
  2101. export default class VideoTexture {
  2102. onEnd?: () => void
  2103. get texture(): import('XrFrame/kanata/lib/index').Texture
  2104. get width(): number
  2105. get height(): number
  2106. get autoPause(): boolean
  2107. /**
  2108. * 当前视频纹理播放状态。
  2109. */
  2110. get state(): EVideoState
  2111. /**
  2112. * @param onReady 创建成功时的回调。
  2113. * @param onEnd 播放结束时的回调。
  2114. */
  2115. constructor(
  2116. scene: Scene,
  2117. options: IVideoTextureOptions,
  2118. onReady: (vt: VideoTexture, error?: Error) => void,
  2119. onEnd?: () => void
  2120. )
  2121. /**
  2122. * @internal
  2123. */
  2124. /**
  2125. * 播放视频。
  2126. */
  2127. play(): Promise<void>
  2128. /**
  2129. * 从某处开始播放。
  2130. *
  2131. * @param pos 事件,单位为s
  2132. */
  2133. seek(pos: number): Promise<any>
  2134. /**
  2135. * 暂停当前播放的视频。
  2136. * 需要在基础库`v2.33.0`及以上支持。
  2137. */
  2138. pause(): Promise<void>
  2139. /**
  2140. * 唤醒已暂停的视频。
  2141. * 需要在基础库`v2.33.0`及以上支持。
  2142. */
  2143. resume(): Promise<void>
  2144. /**
  2145. * 停止播放视频。
  2146. */
  2147. stop(): void
  2148. /**
  2149. * 释放视频。
  2150. */
  2151. release(): void
  2152. }
  2153. export {}
  2154. }
  2155. declare module 'XrFrame/assets/RenderTexture' {
  2156. import { Kanata } from 'XrFrame/ext'
  2157. type Scene = import('XrFrame/core/Scene').default
  2158. export interface IRenderTarget {
  2159. width: number
  2160. height: number
  2161. renderPass: Kanata.RenderPass
  2162. }
  2163. /**
  2164. * `RenderTexture`资源参数接口。
  2165. */
  2166. export interface IRenderTextureOptions {
  2167. width: number
  2168. height: number
  2169. isHDR?: boolean
  2170. }
  2171. /**
  2172. * 渲染纹理组件,可作为{@link Camera.renderTarget}。
  2173. */
  2174. export default class RenderTexture {
  2175. static IS(obj: any): obj is RenderTexture
  2176. readonly isRenderTexture: boolean
  2177. /**
  2178. * 获取深度模板纹理。
  2179. * @internal
  2180. */
  2181. get depthStencil(): import('XrFrame/kanata/lib/index').Texture
  2182. /**
  2183. * 获取第一个色彩纹理。
  2184. * @internal
  2185. */
  2186. get texture(): import('XrFrame/kanata/lib/index').Texture
  2187. /**
  2188. * 获取深度纹理。
  2189. * @internal
  2190. */
  2191. get depthTexture(): import('XrFrame/kanata/lib/index').Texture
  2192. /**
  2193. * 获取Backend实例。
  2194. * @internal
  2195. */
  2196. get renderPass(): import('XrFrame/kanata/lib/index').RenderPass
  2197. /**
  2198. * 贴图高。
  2199. */
  2200. get height(): number
  2201. /**
  2202. * 贴图宽。
  2203. */
  2204. get width(): number
  2205. get id(): number
  2206. constructor(_scene: Scene, options: IRenderTextureOptions)
  2207. }
  2208. export {}
  2209. }
  2210. declare module 'XrFrame/assets/GLTFModel' {
  2211. /**
  2212. * GlTF.ts
  2213. *
  2214. * * @Date : 2022/4/1下午3:34:15
  2215. */
  2216. import NativeAnimation from 'XrFrame/animation/NativeAnimation'
  2217. import Mesh from 'XrFrame/components/Mesh'
  2218. import Element from 'XrFrame/core/Element'
  2219. import { Kanata } from 'XrFrame/ext'
  2220. import { GLTFRootLoaded } from 'XrFrame/loader/glTF/GLTFRootNode'
  2221. import { GLTFTreeNode } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  2222. import { IGLTFLoaderOptions } from 'XrFrame/loader/GlTFLoader'
  2223. import Vector3 from 'XrFrame/math/vector3'
  2224. import Quaternion from 'XrFrame/math/quaternion'
  2225. type Scene = import('XrFrame/core/Scene').default
  2226. /**
  2227. * 收集glTF实例化过程中创建的对象,避免其GC。
  2228. * @deprecated
  2229. */
  2230. export class GLTFInstanceResourceCollector {
  2231. add(res: Kanata.IHandle): void
  2232. release(): void
  2233. }
  2234. /**
  2235. * 在{@link GLTFModel.instantiate}中传入的设置项。
  2236. */
  2237. export interface IGLTFModelOptions {
  2238. /**
  2239. * 是否投射阴影。
  2240. */
  2241. castShadow: boolean
  2242. /**
  2243. * 是否接受阴影。
  2244. */
  2245. receiveShadow: boolean
  2246. /**
  2247. * 是否**不**参与剔除。
  2248. */
  2249. neverCull: boolean
  2250. }
  2251. export type TQS = [pos: Vector3, quat: Quaternion, scale: Vector3]
  2252. /**
  2253. * 加载完毕的GLTF模型,可以在节点下创建{@link GLTF | GLTF组件}来将其实例化。
  2254. */
  2255. export default class GLTFModel {
  2256. /**
  2257. * 如果IGLTFLoaderOptions里开启了preserveRaw,则会将原始json保存下来。
  2258. */
  2259. readonly jsonRaw: object | undefined
  2260. constructor(_scene: Scene, model: GLTFRootLoaded)
  2261. /**
  2262. * 使用GLB文件加载而成的buffer,来生成GLTF模型。
  2263. */
  2264. static createFromBuffer(
  2265. scene: Scene,
  2266. buffer: ArrayBuffer,
  2267. options: IGLTFLoaderOptions
  2268. ): Promise<GLTFModel>
  2269. /**
  2270. * 实例化一个GLTF模型,将其加入到指定节点下,并返回一系列得到的物件。
  2271. * @internal
  2272. *
  2273. * @returns subRoots GLTF场景的根节点对应的元素,因为一个GLTF可能有多个场景,所以可能有多个根节点。
  2274. * @returns treeNodeMap GLTF节点对应到元素的映射表。
  2275. * @returns animations 实例化产生的动画片段,需要手动将其加入{@link Animator}组件。
  2276. * @returns meshes 实例化产生的所有{@link Mesh}组件。
  2277. */
  2278. instantiate(
  2279. parent: Element,
  2280. options: IGLTFModelOptions
  2281. ): [
  2282. subRoots: Element[],
  2283. treeNodeMap: Map<GLTFTreeNode, Element>,
  2284. animations: NativeAnimation[],
  2285. meshes: Array<[mesh: Mesh, transform: TQS]>
  2286. ]
  2287. }
  2288. export {}
  2289. }
  2290. declare module 'XrFrame/assets/EnvData' {
  2291. /**
  2292. * EnvData.ts
  2293. *
  2294. * * @Date : 5/11/2022, 4:07:41 PM
  2295. */
  2296. import { Kanata } from 'XrFrame/ext'
  2297. /**
  2298. * `EnvData`的参数接口。
  2299. */
  2300. export interface IEnvDataOptions {
  2301. /**
  2302. * 天空盒。
  2303. */
  2304. skybox?: {
  2305. /**
  2306. * 是否只使用贴图的上半部分,一般在和`specular`共用贴图的时候为`true`。
  2307. */
  2308. half: boolean
  2309. /**
  2310. * 贴图。
  2311. */
  2312. map: Kanata.Texture
  2313. }
  2314. /**
  2315. * 环境漫反射部分。
  2316. */
  2317. diffuse?: {
  2318. /**
  2319. * 球谐系数SH9。
  2320. */
  2321. coefficients: Float32Array
  2322. }
  2323. /**
  2324. * 环境高光反射部分。
  2325. */
  2326. specular?: {
  2327. /**
  2328. * 贴图类型,目前只支持2D。
  2329. */
  2330. type: '2D'
  2331. /**
  2332. * 是否使用`rgbd`编码来。
  2333. */
  2334. rgbd: boolean
  2335. /**
  2336. * 是否使用mipmap。
  2337. */
  2338. mipmaps: boolean
  2339. /**
  2340. * 使用的mipmap级数。
  2341. */
  2342. mipmapCount?: number
  2343. /**
  2344. * 贴图。
  2345. */
  2346. map: Kanata.Texture
  2347. }
  2348. }
  2349. /**
  2350. * 环境数据资源,一般用[xr-frame-cli](https://github.com/wechat-miniprogram/xr-frame-cli)生成。
  2351. */
  2352. export default class EnvData {
  2353. get useHalfSkyMap(): boolean
  2354. get skyboxMap(): import('XrFrame/kanata/lib/index').Texture
  2355. get hasDiffuse(): boolean
  2356. get diffuseSH(): Float32Array
  2357. get hasSpecular(): boolean
  2358. get specularRGBD(): boolean
  2359. get specularMipmaps(): boolean
  2360. get specularMipmapCount(): number
  2361. get specularMap(): import('XrFrame/kanata/lib/index').Texture
  2362. constructor(options: IEnvDataOptions)
  2363. destroy(): void
  2364. }
  2365. }
  2366. declare module 'XrFrame/animation/Animation' {
  2367. /**
  2368. * Animation.ts
  2369. *
  2370. * * @Date : 6/17/2022, 3:17:12 PM
  2371. */
  2372. type Scene = import('XrFrame/core/Scene').default
  2373. type Element = import('XrFrame/core/Element').default
  2374. /**
  2375. * 动画播放的方向,如果是`both`,则会在`loop`开启时的每次循环中自动反转。
  2376. */
  2377. export type TDirection = 'forwards' | 'backwards' | 'both'
  2378. /**
  2379. * 动画资源基类,被{@link Animator}使用,可以继承它来实现具体的动画。
  2380. *
  2381. * @template IData 动画初始化接受的数据。
  2382. * @template IOptions 动画播放时接受的额外追加选项。
  2383. */
  2384. export default class Animation<IData = any, IOptions = any> {
  2385. __DATA_TYPE: IData
  2386. __OPTIONS_TYPE: IOptions
  2387. /**
  2388. * 动画所有的片段名字,必须在`onInit`中被初始化。
  2389. */
  2390. clipNames: string[]
  2391. /**
  2392. * 场景实例。
  2393. */
  2394. get scene(): import('XrFrame/core/Scene').default
  2395. /**
  2396. * @param _scene 场景实例。
  2397. * @param data 初始化动画数据。
  2398. */
  2399. constructor(_scene: Scene, data: IData)
  2400. /**
  2401. * 动画初始化时执行的生命周期,只会执行一次。
  2402. *
  2403. * @param data 初始化动画数据。
  2404. */
  2405. onInit(data: IData): void
  2406. /**
  2407. * 动画开始播放时执行的生命周期。
  2408. *
  2409. * @param el 本次播放作用于的`element`,一个动画可能作用于多个`element`,可以在这里区分。
  2410. * @param clipName 本次播放的片段名字。
  2411. * @param options 本次播放时的附加选项。
  2412. *
  2413. * @returns 返回本次播放片段的参数,必须包括时长`duration`(s),可选循环次数`loop`、延迟`delay`和方向`direction`。
  2414. */
  2415. onPlay(
  2416. el: Element,
  2417. clipName: string,
  2418. options: IOptions
  2419. ): {
  2420. duration: number
  2421. loop?: number
  2422. delay?: number
  2423. direction?: TDirection
  2424. }
  2425. /**
  2426. * 在动画更新时执行的回调。
  2427. *
  2428. * @param el 本次播放作用于的`element`。
  2429. * @param progress 播放进度,范围为线性的`0~1`。
  2430. * @param reverse 本次播放是否反向。
  2431. */
  2432. onUpdate(el: Element, progress: number, reverse: boolean): void
  2433. /**
  2434. * 在动画暂停时执行的回调。
  2435. *
  2436. * @param el 本次播放作用于的`element`。
  2437. */
  2438. onPause(el: Element): void
  2439. /**
  2440. * 在动画从暂停状态唤醒时执行的回调。
  2441. *
  2442. * @param el 本次播放作用于的`element`。
  2443. */
  2444. onResume(el: Element): void
  2445. /**
  2446. * 在动画停止时执行的回调。
  2447. *
  2448. * @param el 本次播放作用于的`element`。
  2449. */
  2450. onStop(el: Element): void
  2451. }
  2452. export {}
  2453. }
  2454. declare module 'XrFrame/animation/KeyframeAnimation' {
  2455. import Animation, { TDirection } from 'XrFrame/animation/Animation'
  2456. type Element = import('XrFrame/core/Element').default
  2457. /**
  2458. * `Keyframe`动画数据的动画部分。
  2459. */
  2460. export interface IKeyframeAnimationInfo {
  2461. /**
  2462. * 指定动画使用的Keyframe。
  2463. */
  2464. keyframe: string
  2465. /**
  2466. * 动画长度(s)。
  2467. */
  2468. duration: number
  2469. /**
  2470. * 动画插值方式,详见{@link noneParamsEaseFuncs}和{@link useParamsEaseFuncs}。
  2471. */
  2472. ease: string
  2473. /**
  2474. * 如果是可以接受参数的插值方式,指定参数。
  2475. */
  2476. easeParams?: number[]
  2477. /**
  2478. * 循环次数,`0`为不循环,`-1`为永远循环。
  2479. */
  2480. loop?: number
  2481. /**
  2482. * 播放延迟。
  2483. */
  2484. delay?: number
  2485. /**
  2486. * 播放方向。
  2487. */
  2488. direction?: TDirection
  2489. }
  2490. /**
  2491. * `Keyframe`动画数据的动画部分。
  2492. */
  2493. export interface IKeyframeAnimationData {
  2494. /**
  2495. * 关键帧定义部分,可以参考[basic-animation](https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/doc/basic-animation.json)。
  2496. *
  2497. * `name`为关键帧名字。
  2498. * `key`为`0~100`的进度。
  2499. * `prop`为属性序列,其规则为`[componentName].[prop1].[prop2].[prop3]...`,但是有一些特殊的缩写:
  2500. * `position`、`scale`、`rotation`是`transform`组件下对应的属性,`material.u_xxx`则是设置材质的uniform。
  2501. * `prop`的值,可以是数字或者数字数组。
  2502. */
  2503. keyframe: {
  2504. [name: string]: {
  2505. [key: string]: {
  2506. [prop: string]: number | number[]
  2507. }
  2508. }
  2509. }
  2510. /**
  2511. * 动画部分。
  2512. */
  2513. animation: {
  2514. [name: string]: IKeyframeAnimationInfo
  2515. }
  2516. }
  2517. export enum EKeyframeAnimationPropType {
  2518. Default = 0,
  2519. Math = 1,
  2520. Uniform = 2,
  2521. ComponentData = 3
  2522. }
  2523. /**
  2524. * `Keyframe`动画的追加播放参数。
  2525. */
  2526. export interface IKeyframeAnimationOptions {
  2527. /**
  2528. * 改变插值方式。
  2529. */
  2530. ease?: string
  2531. /**
  2532. * 改变插值系数。
  2533. */
  2534. easeParams?: number[]
  2535. }
  2536. /**
  2537. * 解析完的`Keyframe`部分实例,准备好数据以备正式播放。
  2538. *
  2539. * 开发者不需要关心,内部使用。
  2540. */
  2541. export class Keyframe {
  2542. /**
  2543. * @internal
  2544. */
  2545. get times(): number[]
  2546. constructor(options: IKeyframeAnimationData['keyframe']['name'])
  2547. start(el: Element): (p: number) => void
  2548. }
  2549. /**
  2550. * `Keyframe`动画。
  2551. */
  2552. export default class KeyframeAnimation extends Animation<
  2553. IKeyframeAnimationData,
  2554. IKeyframeAnimationOptions
  2555. > {
  2556. onInit(data: IKeyframeAnimationData): void
  2557. onPlay(
  2558. el: Element,
  2559. clipName: string,
  2560. options: IKeyframeAnimationOptions
  2561. ): IKeyframeAnimationInfo
  2562. onUpdate(el: Element, progress: number, reverse: boolean): void
  2563. onPause(el: Element): void
  2564. onResume(el: Element): void
  2565. onStop(el: Element): void
  2566. }
  2567. export {}
  2568. }
  2569. declare module 'XrFrame/assets/Atlas' {
  2570. /**
  2571. * Atlas.ts
  2572. *
  2573. * * @Date : 10/12/2022, 5:23:59 PM
  2574. */
  2575. import { Kanata } from 'XrFrame/ext'
  2576. import Matrix3 from 'XrFrame/math/matrix3'
  2577. import Vector4 from 'XrFrame/math/vector4'
  2578. type Scene = import('XrFrame/core/Scene').default
  2579. /**
  2580. * `Atlas`的初始化参数类型。
  2581. */
  2582. export interface IAtlasOptions {
  2583. /**
  2584. * 图片。
  2585. */
  2586. image?: Kanata.IImage
  2587. /**
  2588. * 也可以直接传入一张纹理。
  2589. */
  2590. texture?: Kanata.Texture
  2591. /**
  2592. * 帧定义,若不指定`uv`则会自动按比例计算。
  2593. */
  2594. frames: {
  2595. [key: string]: {
  2596. /**
  2597. * 帧的区块信息。
  2598. */
  2599. frame: {
  2600. x: number
  2601. y: number
  2602. w: number
  2603. h: number
  2604. }
  2605. /**
  2606. * 会自动生成,开发者无需关心。
  2607. *
  2608. * @hidden
  2609. */
  2610. uvMatrix?: Matrix3
  2611. /**
  2612. * 会自动生成,开发者无需关心。
  2613. *
  2614. * @hidden
  2615. */
  2616. uvST?: Vector4
  2617. }
  2618. }
  2619. /**
  2620. * 原信息,主要定义图片尺寸。
  2621. */
  2622. meta: {
  2623. size: {
  2624. w: number
  2625. h: number
  2626. }
  2627. }
  2628. }
  2629. /**
  2630. * 图集资源创建参数。
  2631. */
  2632. export interface IAtlasCreationOptions {
  2633. /**
  2634. * 单元宽度。
  2635. */
  2636. cellWidth?: number
  2637. /**
  2638. * 单元高度。
  2639. */
  2640. cellHeight?: number
  2641. /**
  2642. * 单元间的间隙。
  2643. */
  2644. space?: number
  2645. /**
  2646. * 每行有多少帧(单元)。
  2647. */
  2648. framesPerLine: number
  2649. /**
  2650. * 需要从哪一帧开始。
  2651. */
  2652. frameStart?: number
  2653. /**
  2654. * 需要几帧。
  2655. */
  2656. frameCount?: number
  2657. }
  2658. /**
  2659. * 图集资源。
  2660. * @version 2.27.1
  2661. *
  2662. * 一般通过{@link AtlasLoader}加载自动生成。
  2663. * 推荐使用[Shoebox](https://www.renderhjs.net/shoebox/)等工具生成。
  2664. */
  2665. export default class Atlas {
  2666. isAtlas: boolean
  2667. protected _AUTO_ID: number
  2668. protected _image: Kanata.IImage
  2669. protected _texture: Kanata.Texture
  2670. protected _frames: IAtlasOptions['frames']
  2671. protected _meta: IAtlasOptions['meta']
  2672. protected _updatable: boolean
  2673. protected _root: string
  2674. protected _area: number
  2675. protected _needReBuild: boolean
  2676. /**
  2677. * 根据宽高和行数、列数来创建一个空的图集。
  2678. * 这个图集将被行列分成若干个格子帧,开发者可以根据实际状况去使用`updateFrame`更新这些格子。
  2679. * 自动生成的帧的名字为`${row}${col}`,比如第一行第一列为`'11'`。
  2680. *
  2681. * @param onUpdate 初始化时的回调,可以用于一开始绘制图像
  2682. */
  2683. static CREATE_FROM_GRIDS(
  2684. scene: Scene,
  2685. options: {
  2686. width: number
  2687. height: number
  2688. rows: number
  2689. cols: number
  2690. space?: number
  2691. },
  2692. onUpdate?: (
  2693. texture: Kanata.Texture,
  2694. region: {
  2695. col: number
  2696. row: number
  2697. x: number
  2698. y: number
  2699. w: number
  2700. h: number
  2701. },
  2702. frameName: string
  2703. ) => void
  2704. ): Atlas
  2705. /**
  2706. * 根据纹理和配置,来通过纹理创建一个不可修改的图集。通常用于精灵动画。
  2707. * 这个图集将被行列分成若干个格子帧,每一帧的名字为`0`、`1`、`2`......
  2708. */
  2709. static CREATE_FROM_TEXTURE(
  2710. scene: Scene,
  2711. texture: Kanata.Texture,
  2712. options: IAtlasCreationOptions
  2713. ): Atlas
  2714. /**
  2715. * 获取元信息。
  2716. */
  2717. get meta(): {
  2718. size: {
  2719. w: number
  2720. h: number
  2721. }
  2722. }
  2723. /**
  2724. * 获取帧集合。
  2725. */
  2726. get frames(): {
  2727. [key: string]: {
  2728. /**
  2729. * 帧的区块信息。
  2730. */
  2731. frame: {
  2732. x: number
  2733. y: number
  2734. w: number
  2735. h: number
  2736. }
  2737. /**
  2738. * 会自动生成,开发者无需关心。
  2739. *
  2740. * @hidden
  2741. */
  2742. uvMatrix?: Matrix3
  2743. /**
  2744. * 会自动生成,开发者无需关心。
  2745. *
  2746. * @hidden
  2747. */
  2748. uvST?: Vector4
  2749. }
  2750. }
  2751. /**
  2752. * 获取整体的纹理。
  2753. */
  2754. get texture(): import('XrFrame/kanata/lib/index').Texture
  2755. /**
  2756. * 构建一个图集。
  2757. *
  2758. * @param options 初始化参数。
  2759. */
  2760. constructor(_scene: Scene, options: IAtlasOptions)
  2761. /**
  2762. * 获取某一帧的数据。
  2763. */
  2764. getFrame(frameName: string): {
  2765. x: number
  2766. y: number
  2767. w: number
  2768. h: number
  2769. }
  2770. /**
  2771. * 获取某一帧的uv变换矩阵。
  2772. */
  2773. getUVMatrix(frameName: string): Matrix3
  2774. protected _buildUVMatrix(frame: {
  2775. x: number
  2776. y: number
  2777. w: number
  2778. h: number
  2779. }): Matrix3
  2780. /**
  2781. * 获取某一帧的uvST。
  2782. * [sx, sy, tx, ty]。
  2783. */
  2784. getUVST(frameName: string): Vector4
  2785. protected _buildUVST(frame: {
  2786. x: number
  2787. y: number
  2788. w: number
  2789. h: number
  2790. }): Vector4
  2791. /**
  2792. * 更新某一frame,通过`onUpdate`方法参数中的`texture`和`region`来更新上此帧所占据区域内的图像。
  2793. */
  2794. updateFrame(
  2795. frameName: string,
  2796. onUpdate: (
  2797. texture: Kanata.Texture,
  2798. region: {
  2799. x: number
  2800. y: number
  2801. w: number
  2802. h: number
  2803. },
  2804. frameName: string
  2805. ) => void
  2806. ): void
  2807. }
  2808. export {}
  2809. }
  2810. declare module 'XrFrame/assets/PostProcess' {
  2811. /**
  2812. * PostProcess.ts
  2813. *
  2814. * * @Date : 10/14/2022, 4:34:55 PM
  2815. */
  2816. type Scene = import('XrFrame/core/Scene').default
  2817. /**
  2818. * 后处理资源初始化参数。
  2819. */
  2820. export interface IPostProcessOptions {
  2821. /**
  2822. * 类型,目前支持的类型请见[内置后处理资源](https://developers.weixin.qq.com/miniprogram/dev/component/xr-frame/builtin/post-process)。
  2823. */
  2824. type: string
  2825. /**
  2826. * 是否开启HDR。
  2827. */
  2828. isHDR?: boolean
  2829. /**
  2830. * 对应类型的数据。
  2831. */
  2832. data?: {
  2833. [key: string]: any
  2834. }
  2835. }
  2836. /**
  2837. * 后处理资源。
  2838. *
  2839. * 一般由{@link AssetPostProcess}加载。
  2840. */
  2841. export default class PostProcess {
  2842. /**
  2843. * 类型。
  2844. */
  2845. get type(): string
  2846. /**
  2847. * 是否开启了HDR。
  2848. */
  2849. get isHDR(): boolean
  2850. /**
  2851. * 数据,可以修改。
  2852. */
  2853. get data(): {
  2854. [key: string]: any
  2855. }
  2856. constructor(_scene: Scene, options: IPostProcessOptions)
  2857. }
  2858. export {}
  2859. }
  2860. declare module 'XrFrame/assets/factories' {
  2861. /**
  2862. * factories.ts
  2863. *
  2864. * * @Date : 2022/3/23下午4:04:18
  2865. */
  2866. import Scene from 'XrFrame/core/Scene'
  2867. import Effect from 'XrFrame/assets/Effect'
  2868. import Geometry from 'XrFrame/assets/Geometry'
  2869. import Material from 'XrFrame/assets/Material'
  2870. export const TABLE: {
  2871. [type: string]: {
  2872. [id: string]: (scene: Scene) => any
  2873. }
  2874. }
  2875. /**
  2876. * @internal
  2877. */
  2878. export function getAssetFactory<T = any>(
  2879. type: string,
  2880. id: string
  2881. ): (scene: Scene) => T
  2882. /**
  2883. * 注册`Geometry`资源。
  2884. */
  2885. export const registerGeometry: (
  2886. id: string,
  2887. factory: (scene: Scene) => Geometry
  2888. ) => void
  2889. /**
  2890. * 注册`Effect`资源。
  2891. */
  2892. export const registerEffect: (
  2893. id: string,
  2894. factory: (scene: Scene) => Effect
  2895. ) => void
  2896. /**
  2897. * 注册`Texture`资源。
  2898. */
  2899. export const registerTexture: (
  2900. id: string,
  2901. factory: (scene: Scene) => import('XrFrame/kanata/lib/index').Texture
  2902. ) => void
  2903. /**
  2904. * 注册`TextureCube`资源。
  2905. */
  2906. export const registerTextureCube: (
  2907. id: string,
  2908. factory: (scene: Scene) => import('XrFrame/kanata/lib/index').Texture
  2909. ) => void
  2910. /**
  2911. * 注册`VertexDataDescriptor`资源。
  2912. */
  2913. export const registerVertexDataDesc: (
  2914. id: string,
  2915. factory: (
  2916. scene: Scene
  2917. ) => import('XrFrame/kanata/lib/index').VertexDataDescriptor
  2918. ) => void
  2919. /**
  2920. * 注册`UniformDescriptor`资源。
  2921. */
  2922. export const registerUniformDesc: (
  2923. id: string,
  2924. factory: (
  2925. scene: Scene
  2926. ) => import('XrFrame/kanata/lib/index').UniformDescriptor
  2927. ) => void
  2928. /**
  2929. * 注册`VertexLayout`资源。
  2930. */
  2931. export const registerVertexLayout: (
  2932. id: string,
  2933. factory: (
  2934. scene: Scene
  2935. ) => import('XrFrame/kanata/lib/index').VertexLayout
  2936. ) => void
  2937. /**
  2938. * 注册`Material`资源。
  2939. */
  2940. export const registerMaterial: (
  2941. id: string,
  2942. factory: (scene: Scene) => Material
  2943. ) => void
  2944. }
  2945. declare module 'XrFrame/assets/easeFunctions' {
  2946. /**
  2947. * easeFunctions.ts
  2948. *
  2949. * * @Date : 6/21/2022, 11:24:27 AM
  2950. */
  2951. type TEaseFunction = (progress: number) => number
  2952. /**
  2953. * 可以自定义参数的插值函数。
  2954. */
  2955. export const useParamsEaseFuncs: {
  2956. /**
  2957. * 二次贝塞尔曲线。
  2958. *
  2959. * @param params p1x, p1y, p2x, p2y。
  2960. * @returns 最终的插值函数。
  2961. */
  2962. 'cubic-bezier': (
  2963. times: number[],
  2964. params: number[]
  2965. ) => (x: number) => number
  2966. /**
  2967. * 步进插值曲线。
  2968. *
  2969. * @param params 一个参数,总步数。
  2970. * @returns 最终的插值函数。
  2971. */
  2972. steps: (times: number[], params: number[]) => (x: number) => number
  2973. }
  2974. /**
  2975. * 不需要自定义参数的一些内置插值曲线。
  2976. */
  2977. export const noneParamsEaseFuncs: {
  2978. linear: (x: any) => any
  2979. 'ease-in': (x: number) => number
  2980. 'ease-out': (x: number) => number
  2981. 'ease-in-out': (x: number) => number
  2982. 'ease-in-quad': (x: any) => number
  2983. 'ease-out-quad': (x: any) => number
  2984. 'ease-in-out-quad': (x: any) => number
  2985. 'ease-in-cubic': (x: any) => number
  2986. 'ease-out-cubic': (x: any) => number
  2987. 'ease-in-out-cubic': (x: any) => number
  2988. 'ease-in-quart': (x: any) => number
  2989. 'ease-out-quart': (x: any) => number
  2990. 'ease-in-out-quart': (x: any) => number
  2991. 'ease-in-quint': (x: any) => number
  2992. 'ease-out-quint': (x: any) => number
  2993. 'ease-in-out-quint': (x: any) => number
  2994. 'ease-in-sine': (x: any) => number
  2995. 'ease-out-sine': (x: any) => number
  2996. 'ease-in-out-sine': (x: any) => number
  2997. 'ease-in-expo': (x: any) => number
  2998. 'ease-out-expo': (x: any) => number
  2999. 'ease-in-out-expo': (x: any) => number
  3000. 'ease-in-circ': (x: any) => number
  3001. 'ease-out-circ': (x: any) => number
  3002. 'ease-in-out-circ': (x: any) => number
  3003. 'ease-in-back': (x: any) => number
  3004. 'ease-out-back': (x: any) => number
  3005. 'ease-in-out-back': (x: any) => number
  3006. 'ease-in-elastic': (x: any) => number
  3007. 'ease-out-elastic': (x: any) => number
  3008. 'ease-in-out-elastic': (x: any) => number
  3009. 'ease-in-bounce': (x: any) => number
  3010. 'ease-out-bounce': TEaseFunction
  3011. 'ease-in-out-bounce': (x: any) => number
  3012. }
  3013. export {}
  3014. }
  3015. declare module 'XrFrame/physics/exports' {
  3016. export { default as RaycastHit } from 'XrFrame/physics/RaycastHit'
  3017. export { ICollideEvent, IOverlapEvent } from 'XrFrame/physics/Collision'
  3018. export { IContactPoint } from 'XrFrame/physics/ContactPoint'
  3019. export { RaycastDesc } from 'XrFrame/physics/raycast'
  3020. }
  3021. declare module 'XrFrame/math/vector2' {
  3022. export default class Vector2 {
  3023. /**
  3024. * x值
  3025. *
  3026. * @type {number}
  3027. * @memberof Vector2
  3028. */
  3029. get x(): number
  3030. set x(val: number)
  3031. /**
  3032. * y值
  3033. *
  3034. * @type {number}
  3035. * @memberof Vector2
  3036. */
  3037. get y(): number
  3038. set y(val: number)
  3039. /**
  3040. * 零向量,不要对该对象进行修改
  3041. *
  3042. * @readonly
  3043. * @static
  3044. * @type {V3ReadOnly}
  3045. * @memberof Vector3
  3046. */
  3047. static readonly ZERO: Vector2
  3048. /**
  3049. * 一向量,不要对该对象进行修改
  3050. *
  3051. * @readonly
  3052. * @static
  3053. * @type {V3ReadOnly}
  3054. * @memberof Vector3
  3055. */
  3056. static readonly ONE: Vector2
  3057. _raw: Float32Array
  3058. /**
  3059. * 使用一个数组创建
  3060. * 此操作会拷贝一份数组
  3061. *
  3062. * @static
  3063. * @param {number[]} array 数据源,长度必须为2,否则会抛出异常
  3064. * @returns {Vector2} 创建出来的向量
  3065. * @memberof Vector2
  3066. */
  3067. static createFromArray(array: number[]): Vector2
  3068. /**
  3069. * 使用某个已有的typedArray创建
  3070. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3071. *
  3072. * @static
  3073. * @param {Float32Array} array 数据源
  3074. * @param {number} [offset=0] 数据源中的偏移
  3075. * @returns {Vector2} 创建出来的向量
  3076. * @memberof Vector2
  3077. */
  3078. static createFromTypedArray(
  3079. array: Float32Array,
  3080. offset?: number
  3081. ): Vector2
  3082. /**
  3083. * 返回向量数据
  3084. *
  3085. * @returns {number[]} 矩阵数据,以JSArray返回
  3086. * @memberof Vector2
  3087. */
  3088. toArray(): number[]
  3089. /**
  3090. * 判断与目标向量的值是否相等
  3091. *
  3092. * @param {V2ReadOnly} v 目标向量
  3093. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  3094. * @memberof Vector2
  3095. */
  3096. equal(v: Vector2): boolean
  3097. /**
  3098. * 拷贝目标向量的值到该向量
  3099. *
  3100. * @param {V2ReadOnly} val 目标向量
  3101. * @returns {Vector2} 自身
  3102. * @memberof Vector2
  3103. */
  3104. set(val: Vector2): Vector2
  3105. /**
  3106. * 设置向量的值
  3107. *
  3108. * @param {number} x x值
  3109. * @param {number} y y值
  3110. * @returns {Vector2} 自身
  3111. * @memberof Vector2
  3112. */
  3113. setValue(x: number, y: number): Vector2
  3114. /**
  3115. * 向量加法
  3116. *
  3117. * @param {V2ReadOnly} v 目标向量
  3118. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3119. * @returns {Vector2} 计算结果
  3120. * @memberof Vector2
  3121. */
  3122. add(v: Vector2, dst?: Vector2): Vector2
  3123. /**
  3124. * 向量减法
  3125. *
  3126. * @param {V2ReadOnly} v 目标向量
  3127. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3128. * @returns {Vector2} 计算结果
  3129. * @memberof Vector2
  3130. */
  3131. sub(v: Vector2, dst?: Vector2): Vector2
  3132. /**
  3133. * 向量归一化,如该向量为零向量,则结果依然为零向量
  3134. *
  3135. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3136. * @returns {Vector2} 计算结果
  3137. * @memberof Vector2
  3138. */
  3139. normalize(dst?: Vector2): Vector2
  3140. /**
  3141. * 向量缩放
  3142. *
  3143. * @param {number} f 缩放比
  3144. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3145. * @returns {Vector2} 计算结果
  3146. * @memberof Vector2
  3147. */
  3148. scale(f: number, dst?: Vector2): Vector2
  3149. /**
  3150. * 在该向量与目标向量之间计算插值
  3151. *
  3152. * @param {V2ReadOnly} v 目标向量
  3153. * @param {number} f 插值系数
  3154. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3155. * @returns {Vector2} 计算结果
  3156. * @memberof Vector2
  3157. */
  3158. lerp(v: Vector2, f: number, dst?: Vector2): Vector2
  3159. /**
  3160. * 取反
  3161. * @returns
  3162. */
  3163. negate(): this
  3164. /**
  3165. * 向量点乘
  3166. *
  3167. * @param {V2ReadOnly} v 目标向量
  3168. * @returns {number} 计算结果
  3169. * @memberof Vector2
  3170. */
  3171. dot(v: Vector2): number
  3172. /**
  3173. * 向量的模
  3174. *
  3175. * @returns {number} 计算结果
  3176. * @memberof Vector2
  3177. */
  3178. length(): number
  3179. /**
  3180. * 拷贝该向量
  3181. *
  3182. * @returns {Vector2} 拷贝出来的对象
  3183. * @memberof Vector2
  3184. */
  3185. clone(): Vector2
  3186. /**
  3187. * 是否为零向量
  3188. *
  3189. * @returns {boolean}
  3190. * @memberof Vector2
  3191. */
  3192. isZero(): boolean
  3193. /**
  3194. * 获取向量旋转角,以角度表示
  3195. *
  3196. * @returns {number} 旋转角,以角度表示
  3197. * @memberof Vector2
  3198. */
  3199. getAngle(): number
  3200. setArray(value: ArrayLike<number>, offset?: number): Vector2
  3201. }
  3202. }
  3203. declare module 'XrFrame/math/vector3' {
  3204. import QuatReadOnly from 'XrFrame/math/quaternion'
  3205. import M4ReadOnly from 'XrFrame/math/matrix4'
  3206. export default class Vector3 {
  3207. /**
  3208. * x值
  3209. *
  3210. * @type {number}
  3211. * @memberof Vector3
  3212. */
  3213. get x(): number
  3214. set x(val: number)
  3215. /**
  3216. * y值
  3217. *
  3218. * @type {number}
  3219. * @memberof Vector3
  3220. */
  3221. get y(): number
  3222. set y(val: number)
  3223. /**
  3224. * z值
  3225. *
  3226. * @type {number}
  3227. * @memberof Vector3
  3228. */
  3229. get z(): number
  3230. set z(val: number)
  3231. /**
  3232. * 零向量,不要对该对象进行修改
  3233. *
  3234. * @readonly
  3235. * @static
  3236. * @type {Vector3}
  3237. * @memberof Vector3
  3238. */
  3239. static readonly ZERO: Vector3
  3240. /**
  3241. * 一向量,不要对该对象进行修改
  3242. *
  3243. * @readonly
  3244. * @static
  3245. * @type {Vector3}
  3246. * @memberof Vector3
  3247. */
  3248. static readonly ONE: Vector3
  3249. /**
  3250. * 上方向,不要对该对象进行修改
  3251. *
  3252. * @static
  3253. * @type {Vector3}
  3254. * @memberof Vector3
  3255. */
  3256. static readonly Up: Vector3
  3257. /**
  3258. * 前方向,基于左手坐标系,不要对该对象进行修改
  3259. *
  3260. * @static
  3261. * @type {Vector3}
  3262. * @memberof Vector3
  3263. */
  3264. static readonly ForwardLH: Vector3
  3265. _raw: Float32Array
  3266. /**
  3267. * 使用一个数组创建
  3268. * 此操作会拷贝一份数组
  3269. *
  3270. * @static
  3271. * @param {number[]} array 数据源,长度必须为3,否则会抛出异常
  3272. * @returns {Vector3} 创建出来的向量
  3273. * @memberof Vector3
  3274. */
  3275. static createFromArray(array: number[]): Vector3
  3276. /**
  3277. * 使用某个已有的typedArray创建
  3278. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3279. *
  3280. * @static
  3281. * @param {Float32Array} array 数据源
  3282. * @param {number} [offset=0] 数据源中的偏移
  3283. * @returns {Vector3}
  3284. * @memberof Vector3
  3285. */
  3286. static createFromTypedArray(
  3287. array: Float32Array,
  3288. offset?: number
  3289. ): Vector3
  3290. /**
  3291. * 使用四元数进行向量旋转
  3292. *
  3293. * @static
  3294. * @param {Vector3} source 源向量
  3295. * @param {QuatReadOnly} rotation 用于旋转的四元数
  3296. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3297. * @returns {Vector3} 计算结果
  3298. * @memberof Vector3
  3299. */
  3300. static transformQuat(
  3301. source: Vector3,
  3302. rotation: QuatReadOnly,
  3303. dst?: Vector3
  3304. ): Vector3
  3305. static transformCoordinate(
  3306. coordinate: Vector3,
  3307. transform: M4ReadOnly,
  3308. dst?: Vector3
  3309. ): Vector3
  3310. /**
  3311. * 返回向量数据
  3312. *
  3313. * @returns {number[]} 矩阵数据,以JSArray返回
  3314. * @memberof Vector3
  3315. */
  3316. toArray(): [number, number, number]
  3317. /**
  3318. * 判断与目标向量的值是否相等
  3319. *
  3320. * @param {Vector3} v 目标向量
  3321. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  3322. * @memberof Vector3
  3323. */
  3324. equal(v: Vector3): boolean
  3325. /**
  3326. * 拷贝目标向量的值到该向量
  3327. *
  3328. * @param {Vector3} val 目标向量
  3329. * @returns {Vector3} 自身
  3330. * @memberof Vector3
  3331. */
  3332. set(v: Vector3): Vector3
  3333. /**
  3334. * 设置向量的值
  3335. *
  3336. * @param {number} x x
  3337. * @param {number} y y
  3338. * @param {number} z z
  3339. * @returns {Vector3} 自身
  3340. * @memberof Vector3
  3341. */
  3342. setValue(x: number, y: number, z: number): Vector3
  3343. setFromArray(xyz: number[]): Vector3
  3344. /**
  3345. * 向量加法
  3346. *
  3347. * @param {Vector3} v 目标向量
  3348. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3349. * @returns {Vector3} 计算结果
  3350. * @memberof Vector3
  3351. */
  3352. add(v: Vector3, dst?: Vector3): Vector3
  3353. /**
  3354. * 向量减法
  3355. *
  3356. * @param {Vector3} v 目标向量
  3357. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3358. * @returns {Vector3} 计算结果
  3359. * @memberof Vector3
  3360. */
  3361. sub(v: Vector3, dst?: Vector3): Vector3
  3362. /**
  3363. * 向量叉乘
  3364. *
  3365. * @param {Vector3} v 目标向量
  3366. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3367. * @returns {Vector3} 计算结果
  3368. * @memberof Vector3
  3369. */
  3370. cross(v: Vector3, dst?: Vector3): Vector3
  3371. /**
  3372. * 向量归一化
  3373. *
  3374. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3375. * @returns {Vector3} 计算结果
  3376. * @memberof Vector3
  3377. */
  3378. normalize(dst?: Vector3): Vector3
  3379. /**
  3380. * 向量缩放
  3381. *
  3382. * @param {number} f 缩放比
  3383. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3384. * @returns {Vector3} 计算结果
  3385. * @memberof Vector3
  3386. */
  3387. scale(f: number, dst?: Vector3): Vector3
  3388. /**
  3389. * 向量缩放
  3390. *
  3391. * @param {number} x x缩放比
  3392. * @param {number} y y缩放比
  3393. * @param {number} z z缩放比
  3394. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3395. * @returns {Vector3} 计算结果
  3396. * @memberof Vector3
  3397. */
  3398. scaleXYZ(x: number, y: number, z: number, dst?: Vector3): Vector3
  3399. /**
  3400. * 在该向量与目标向量之间计算插值
  3401. *
  3402. * @param {Vector3} v 目标向量
  3403. * @param {number} f 插值系数
  3404. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3405. * @returns {Vector3} 计算结果
  3406. * @memberof Vector3
  3407. */
  3408. lerp(v: Vector3, f: number, dst?: Vector3): Vector3
  3409. /**
  3410. * 取反
  3411. * @returns
  3412. */
  3413. negate(): this
  3414. abs(): this
  3415. /**
  3416. * 向量点乘
  3417. *
  3418. * @param {Vector3} v 目标向量
  3419. * @returns {number} 计算结果
  3420. * @memberof Vector3
  3421. */
  3422. dot(v: Vector3): number
  3423. /**
  3424. * 向量的模
  3425. *
  3426. * @returns {number} 计算结果
  3427. * @memberof Vector3
  3428. */
  3429. length(): number
  3430. /**
  3431. * 拷贝该向量
  3432. *
  3433. * @returns {Vector3} 拷贝出来的对象
  3434. * @memberof Vector3
  3435. */
  3436. clone(): Vector3
  3437. /**
  3438. * 是否为零向量
  3439. *
  3440. * @returns {boolean}
  3441. * @memberof Vector3
  3442. */
  3443. isZero(): boolean
  3444. /**
  3445. * 获取到目标点的距离
  3446. *
  3447. * @param {Vector3} p 目标点
  3448. * @returns {number} 计算结果
  3449. * @memberof Vector3
  3450. */
  3451. distanceTo(p: Vector3): number
  3452. /**
  3453. * 获取到目标点的角度
  3454. *
  3455. * @param {Vector3} location 目标点
  3456. * @returns {number} 计算结果
  3457. * @memberof Vector3
  3458. */
  3459. angleTo(location: Vector3, dst?: Vector3): Vector3
  3460. setFromMatrixColumn(m: M4ReadOnly, index: number): Vector3
  3461. fromArray(array: Float32Array, offset: number): Vector3
  3462. setFromMatrixScale(m: M4ReadOnly): Vector3
  3463. /**
  3464. * create by janzen
  3465. * Sets this vector to the position elements of the transformation matrix
  3466. */
  3467. setFromMatrixPosition(worldMatrix: M4ReadOnly): Vector3
  3468. /**
  3469. * create by janzen
  3470. * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
  3471. */
  3472. applyMatrix4(m: M4ReadOnly): Vector3
  3473. /**
  3474. * create by roamye
  3475. * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
  3476. */
  3477. applyMatrix4Raw(m: Float32Array): this
  3478. applyQuaternion(q: QuatReadOnly): this
  3479. /**
  3480. * create by janzen
  3481. * Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.
  3482. */
  3483. transformDirection(m: M4ReadOnly): Vector3
  3484. /**
  3485. * create by roamye
  3486. * Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.
  3487. */
  3488. transformDirectionRaw(raw: Float32Array): Vector3
  3489. /**
  3490. * created by shanexyzhou
  3491. * 从物理引擎内的RawVec3f生成Vector3
  3492. */
  3493. static fromPhysics(v: any): Vector3
  3494. fromPhysics(v: any): Vector3
  3495. static Phys3D?: typeof phys3D
  3496. static clearPhysicsPool(): void
  3497. /**
  3498. * created by shanexyzhou
  3499. * 生成物理引擎内的RawVec3f
  3500. */
  3501. toPhysics(): any
  3502. setArray(value: ArrayLike<number>, offset?: number): Vector3
  3503. print(): void
  3504. }
  3505. export class Vector3ReadOnly extends Vector3 {
  3506. get x(): number
  3507. set x(v: number)
  3508. get y(): number
  3509. set y(v: number)
  3510. get z(): number
  3511. set z(v: number)
  3512. constructor(array?: Float32Array, offset?: number)
  3513. set(): this
  3514. setValue(): this
  3515. }
  3516. }
  3517. declare module 'XrFrame/math/vector4' {
  3518. export default class Vector4 {
  3519. /**
  3520. * x值
  3521. *
  3522. * @type {number}
  3523. * @memberof Vector4
  3524. */
  3525. get x(): number
  3526. set x(val: number)
  3527. /**
  3528. * y值
  3529. *
  3530. * @type {number}
  3531. * @memberof Vector4
  3532. */
  3533. get y(): number
  3534. set y(val: number)
  3535. /**
  3536. * z值
  3537. *
  3538. * @type {number}
  3539. * @memberof Vector4
  3540. */
  3541. get z(): number
  3542. set z(val: number)
  3543. /**
  3544. * w值
  3545. *
  3546. * @type {number}
  3547. * @memberof Vector4
  3548. */
  3549. get w(): number
  3550. set w(val: number)
  3551. /**
  3552. * 零向量,不要对该对象进行修改
  3553. *
  3554. * @static
  3555. * @readonly
  3556. * @type {Vector4}
  3557. * @memberof Vector4
  3558. */
  3559. static readonly ZERO: Vector4
  3560. /**
  3561. * 一向量,不要对该对象进行修改
  3562. *
  3563. * @readonly
  3564. * @static
  3565. * @type {V3ReadOnly}
  3566. * @memberof Vector3
  3567. */
  3568. static readonly ONE: Vector4
  3569. _raw: Float32Array
  3570. /**
  3571. * 使用一个数组创建
  3572. * 此操作会拷贝一份数组
  3573. *
  3574. * @static
  3575. * @param {number[]} array 数据源,长度必须为4,否则会抛出异常
  3576. * @returns {Vector4} 创建出来的向量
  3577. * @memberof Vector4
  3578. */
  3579. static createFromArray(array: number[]): Vector4
  3580. /**
  3581. * 使用某个已有的typedArray创建
  3582. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3583. *
  3584. * @static
  3585. * @param {Float32Array} array 数据源
  3586. * @param {number} [offset=0] 数据源中的偏移
  3587. * @returns {Vector4}
  3588. * @memberof Vector4
  3589. */
  3590. static createFromTypedArray(
  3591. array: Float32Array,
  3592. offset?: number
  3593. ): Vector4
  3594. /**
  3595. * 返回向量数据
  3596. *
  3597. * @returns {number[]} 矩阵数据,以JSArray返回
  3598. * @memberof Vector4
  3599. */
  3600. toArray(): number[]
  3601. /**
  3602. * 判断与目标向量的值是否相等
  3603. *
  3604. * @param {Vector4} v 目标向量
  3605. * @returns {boolean} 是否相等,这里误差小于10^-6视为相等
  3606. * @memberof Vector4
  3607. */
  3608. equal(v: Vector4): boolean
  3609. /**
  3610. * 拷贝目标向量的值到该向量
  3611. *
  3612. * @param {Vector4} val 目标向量
  3613. * @returns {Vector4} 自身
  3614. * @memberof Vector4
  3615. */
  3616. set(v: Vector4): Vector4
  3617. /**
  3618. * 设置向量的值
  3619. *
  3620. * @param {number} x x值
  3621. * @param {number} y y值
  3622. * @param {number} z z值
  3623. * @param {number} w w值
  3624. * @returns {Vector4} 自身
  3625. * @memberof Vector4
  3626. */
  3627. setValue(x: number, y: number, z: number, w: number): Vector4
  3628. /**
  3629. * 向量加法
  3630. *
  3631. * @param {Vector4} v 目标向量
  3632. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3633. * @returns {Vector4} 计算结果
  3634. * @memberof Vector4
  3635. */
  3636. add(v: Vector4, dst?: Vector4): Vector4
  3637. /**
  3638. * 向量减法
  3639. *
  3640. * @param {Vector4} v 目标向量
  3641. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3642. * @returns {Vector4} 计算结果
  3643. * @memberof Vector4
  3644. */
  3645. sub(v: Vector4, dst?: Vector4): Vector4
  3646. /**
  3647. * 向量缩放
  3648. *
  3649. * @param {number} f 缩放比
  3650. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3651. * @returns {Vector4} 计算结果
  3652. * @memberof Vector4
  3653. */
  3654. scale(f: number, dst?: Vector4): Vector4
  3655. /**
  3656. * 在该向量与目标向量之间计算插值
  3657. *
  3658. * @param {Vector4} v 目标向量
  3659. * @param {number} f 插值系数
  3660. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3661. * @returns {Vector4} 计算结果
  3662. * @memberof Vector4
  3663. */
  3664. lerp(v: Vector4, f: number, dst?: Vector4): Vector4
  3665. /**
  3666. * 取反
  3667. * @returns
  3668. */
  3669. negate(): this
  3670. /**
  3671. * 向量点乘
  3672. *
  3673. * @param {Vector4} v 目标向量
  3674. * @returns {number} 计算结果
  3675. * @memberof Vector4
  3676. */
  3677. dot(v: Vector4): number
  3678. /**
  3679. * 是否为零向量
  3680. *
  3681. * @returns {boolean}
  3682. * @memberof Vector4
  3683. */
  3684. isZero(): boolean
  3685. /**
  3686. * 拷贝该向量
  3687. *
  3688. * @returns {Vector4} 拷贝出来的对象
  3689. * @memberof Vector4
  3690. */
  3691. clone(): Vector4
  3692. setArray(value: ArrayLike<number>, offset?: number): Vector4
  3693. }
  3694. }
  3695. declare module 'XrFrame/math/quaternion' {
  3696. import Vector3 from 'XrFrame/math/vector3'
  3697. import V3ReadOnly from 'XrFrame/math/vector3'
  3698. import QuatReadOnly from 'XrFrame/math/quaternion'
  3699. import M4ReadOnly from 'XrFrame/math/matrix4'
  3700. /**
  3701. * @public
  3702. */
  3703. export default class Quaternion {
  3704. set x(val: number)
  3705. /**
  3706. * y值
  3707. *
  3708. * @type {number}
  3709. * @memberof Quaternion
  3710. */
  3711. get y(): number
  3712. set y(val: number)
  3713. /**
  3714. * z值
  3715. *
  3716. * @type {number}
  3717. * @memberof Quaternion
  3718. */
  3719. get z(): number
  3720. set z(val: number)
  3721. /**
  3722. * w值
  3723. *
  3724. * @type {number}
  3725. * @memberof Quaternion
  3726. */
  3727. get w(): number
  3728. set w(val: number)
  3729. /**
  3730. * 默认四元数,不要对该对象进行修改
  3731. *
  3732. * @readonly
  3733. * @static
  3734. * @type {QuatReadOnly}
  3735. * @memberof Quaternion
  3736. */
  3737. static readonly DEFAULT: QuatReadOnly
  3738. _raw: Float32Array
  3739. /**
  3740. * 从旋转矩阵创建
  3741. *
  3742. * @static
  3743. * @param {Matrix4} mat
  3744. * @param {Quaternion} [dst]
  3745. * @returns {Quaternion}
  3746. * @memberof Quaternion
  3747. */
  3748. static createFromMatrix4(mat: M4ReadOnly, dst?: Quaternion): Quaternion
  3749. /**
  3750. * 从轴向旋转创建
  3751. *
  3752. * @static
  3753. * @param {V3ReadOnly} axis 旋转轴
  3754. * @param {number} rad 旋转幅度
  3755. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3756. * @returns {Quaternion} 计算结果
  3757. * @memberof Quaternion
  3758. */
  3759. static createFromAxisAngle(
  3760. axis: V3ReadOnly,
  3761. rad: number,
  3762. dst?: Quaternion
  3763. ): Quaternion
  3764. /**
  3765. * 由视角方向创建四元数
  3766. *
  3767. * @static
  3768. * @param {V3ReadOnly} forward 前方向
  3769. * @param {V3ReadOnly} up 上方向
  3770. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3771. * @returns {Quaternion} 计算结果
  3772. * @memberof Quaternion
  3773. */
  3774. static lookRotation(
  3775. forward: V3ReadOnly,
  3776. up: V3ReadOnly,
  3777. dst?: Quaternion
  3778. ): Quaternion
  3779. /**
  3780. * 使用数值创建
  3781. *
  3782. * @static
  3783. * @param {number} x x
  3784. * @param {number} y y
  3785. * @param {number} z z
  3786. * @param {number} w w
  3787. * @returns {Quaternion} 创建出来的四元数
  3788. * @memberof Quaternion
  3789. */
  3790. static createFromNumber(
  3791. x: number,
  3792. y: number,
  3793. z: number,
  3794. w: number
  3795. ): Quaternion
  3796. /**
  3797. * 使用一个数组创建
  3798. * 此操作会拷贝一份数组
  3799. *
  3800. * @static
  3801. * @param {number[]} array 数据源,长度必须为4,否则会抛出异常
  3802. * @returns {Quaternion}
  3803. * @memberof Quaternion
  3804. */
  3805. static createFromArray(array: number[]): Quaternion
  3806. /**
  3807. * 使用某个已有的typedArray创建
  3808. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3809. *
  3810. * @static
  3811. * @param {Float32Array} array 数据源
  3812. * @param {number} [offset=0] 数据源中的偏移
  3813. * @returns {Quaternion}
  3814. * @memberof Quaternion
  3815. */
  3816. static createFromTypedArray(
  3817. array: Float32Array,
  3818. offset?: number
  3819. ): Quaternion
  3820. /**
  3821. * 通过俩个向量创建四元数
  3822. * @param vFrom
  3823. * @param vTo
  3824. * @returns
  3825. */
  3826. static createFromUnitVectors(vFrom: Vector3, vTo: Vector3): QuatReadOnly
  3827. /**
  3828. * 拷贝目标四元数的值到自身
  3829. *
  3830. * @param {Quaternion} quat 目标四元数
  3831. * @returns {Quaternion} 自身
  3832. * @memberof Quaternion
  3833. */
  3834. set(quat: Quaternion): Quaternion
  3835. /**
  3836. * 设置四元数的值
  3837. *
  3838. * @param {number} x
  3839. * @param {number} y
  3840. * @param {number} z
  3841. * @param {number} w
  3842. * @returns {Quaternion} 自身
  3843. * @memberof Quaternion
  3844. */
  3845. setValue(x: number, y: number, z: number, w: number): Quaternion
  3846. /**
  3847. * 球面插值
  3848. *
  3849. * @param {Quaternion} right 目标四元数
  3850. * @param {number} t 插值系数,越接近 1 则结果越接近目标
  3851. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3852. * @returns {Quaternion} 计算结果
  3853. * @memberof Quaternion
  3854. */
  3855. slerp(right: QuatReadOnly, t: number, dst?: Quaternion): Quaternion
  3856. /**
  3857. * 四元数反转
  3858. *
  3859. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3860. * @returns {Quaternion} 计算结果
  3861. * @memberof Quaternion
  3862. */
  3863. invert(dst?: Quaternion): Quaternion
  3864. /**
  3865. * 四元数相加
  3866. *
  3867. * @param {Quaternion} quat 目标四元数
  3868. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3869. * @returns {Quaternion} 计算结果
  3870. * @memberof Quaternion
  3871. */
  3872. add(quat: QuatReadOnly, dst?: Quaternion): Quaternion
  3873. /**
  3874. * 四元数相减
  3875. *
  3876. * @param {Quaternion} quat 目标四元数
  3877. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3878. * @returns {Quaternion} 计算结果
  3879. * @memberof Quaternion
  3880. */
  3881. sub(quat: QuatReadOnly, dst?: Quaternion): Quaternion
  3882. /**
  3883. * 四元数相乘
  3884. *
  3885. * @param {Quaternion} quat 目标四元数
  3886. * @param {Quaternion} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3887. * @returns {Quaternion} 计算结果
  3888. * @memberof Quaternion
  3889. */
  3890. multiply(quat: QuatReadOnly, dst?: Quaternion): Quaternion
  3891. premultiply(q: QuatReadOnly): QuatReadOnly
  3892. /**
  3893. * 点乘
  3894. * @param q
  3895. */
  3896. dot(q: QuatReadOnly): number
  3897. length(): number
  3898. normalize(): this
  3899. setFromUnitVectors(vFrom: any, vTo: any): this
  3900. setFromYawRollPitch(yaw: number, roll: number, pitch: number): void
  3901. setFromEulerAngles(euler: Vector3): void
  3902. /**
  3903. * 相对角度
  3904. * @param q
  3905. */
  3906. angleTo(q: QuatReadOnly): number
  3907. /**
  3908. * 转向对应的角度
  3909. * @param q
  3910. * @param step
  3911. */
  3912. rotateTowards(q: any, step: any): QuatReadOnly
  3913. /**
  3914. * 拷贝四元数
  3915. *
  3916. * @returns {Quaternion} 拷贝后的对象
  3917. * @memberof Quaternion
  3918. */
  3919. clone(): Quaternion
  3920. /**
  3921. * 四元数是否为默认四元数(表示零旋转)
  3922. *
  3923. * @returns {boolean}
  3924. * @memberof Quaternion
  3925. */
  3926. isDefault(): boolean
  3927. /**
  3928. * 将该四元数转换成欧拉角,x代表Pitch,y代表Yaw,z代表Roll
  3929. * 旋转的顺序为YXZ
  3930. *
  3931. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  3932. * @returns {Vector3} 计算结果
  3933. * @memberof Quaternion
  3934. */
  3935. toEulerAngles(dst?: Vector3): Vector3
  3936. /**
  3937. * 判断与目标四元数的值是否相等
  3938. *
  3939. * @param {QuatReadOnly} quat 目标四元数
  3940. * @returns {boolean}
  3941. * @memberof Quaternion
  3942. */
  3943. equal(quat: QuatReadOnly): boolean
  3944. /**
  3945. * created by shanexyzhou
  3946. * 从物理引擎内的RawQuaternion生成Quaternion
  3947. */
  3948. static fromPhysics(v: phys3D.RawQuaternion): Quaternion
  3949. fromPhysics(v: phys3D.RawQuaternion): Quaternion
  3950. static Phys3D?: typeof phys3D
  3951. static clearPhysicsPool(): void
  3952. /**
  3953. * created by shanexyzhou
  3954. * 生成物理引擎内的RawQuaternion
  3955. */
  3956. toPhysics(): phys3D.RawQuaternion
  3957. setArray(value: ArrayLike<number>, offset?: number): Quaternion
  3958. transformVector3(vec: Vector3): Vector3
  3959. /**
  3960. * 对[1,1,1]向量进行转换。
  3961. */
  3962. toAxisUnit(): Vector3
  3963. }
  3964. }
  3965. declare module 'XrFrame/math/matrix3' {
  3966. import Vector2 from 'XrFrame/math/vector2'
  3967. import V2ReadOnly from 'XrFrame/math/vector2'
  3968. export default class Matrix3 {
  3969. get raw(): Float32Array
  3970. _raw: Float32Array
  3971. /**
  3972. * 使用一个数组创建
  3973. * 此操作会拷贝一份数组
  3974. *
  3975. * @static
  3976. * @param {number[]} array 数据源,长度必须为9,否则会抛出异常
  3977. * @returns {Matrix3} 创建出来的矩阵
  3978. * @memberof Matrix3
  3979. */
  3980. static createFromArray(array: number[]): Matrix3
  3981. /**
  3982. * 使用某个已有的typedArray创建
  3983. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  3984. *
  3985. * @static
  3986. * @param {Float32Array} array 数据源
  3987. * @param {number} [offset=0] 数据源中的偏移
  3988. * @returns {Matrix3} 创建出来的矩阵
  3989. * @memberof Matrix3
  3990. */
  3991. static createFromTypedArray(
  3992. array: Float32Array,
  3993. offset?: number
  3994. ): Matrix3
  3995. /**
  3996. * 返回矩阵数据
  3997. *
  3998. * @returns {number[]} 矩阵数据,以JSArray返回
  3999. * @memberof Matrix3
  4000. */
  4001. toArray(): number[]
  4002. /**
  4003. * 将该矩阵进行位移变换
  4004. *
  4005. * @param {number} tx x轴位移
  4006. * @param {number} ty y轴位移
  4007. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4008. * @returns {Matrix3} 计算结果
  4009. * @memberof Matrix3
  4010. */
  4011. translate(tx: number, ty: number, dst?: Matrix3): Matrix3
  4012. /**
  4013. * 将该矩阵进行缩放变换
  4014. *
  4015. * @param {number} sx x轴缩放
  4016. * @param {number} sy y轴缩放
  4017. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4018. * @returns {Matrix3} 计算结果
  4019. * @memberof Matrix3
  4020. */
  4021. scale(sx: number, sy: number, dst?: Matrix3): Matrix3
  4022. /**
  4023. * 将该矩阵进行旋转变换
  4024. *
  4025. * @param {number} radians 旋转幅度,用弧度表示
  4026. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4027. * @returns {Matrix3} 计算结果
  4028. * @memberof Matrix3
  4029. */
  4030. rotate(radians: number, dst?: Matrix3): Matrix3
  4031. /**
  4032. * 求该矩阵的逆
  4033. *
  4034. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4035. * @returns {Matrix3} 计算结果
  4036. * @memberof Matrix3
  4037. */
  4038. inverse(dst?: Matrix3): Matrix3
  4039. /**
  4040. * 将该矩阵与另一个矩阵相乘
  4041. *
  4042. * @param {Matrix3} m 右乘矩阵
  4043. * @param {Matrix3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4044. * @returns {Matrix3} 计算结果
  4045. * @memberof Matrix3
  4046. */
  4047. multiply(m: Matrix3, dst?: Matrix3): Matrix3
  4048. /**
  4049. * 矩阵变换作用于点
  4050. *
  4051. * @param {Vector2} v 点
  4052. * @param {Vector2} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4053. * @returns {Vector2} 计算结果
  4054. * @memberof Matrix3
  4055. */
  4056. transformPoint(v: V2ReadOnly, dst?: Vector2): Vector2
  4057. setArray(value: ArrayLike<number>, offset?: number): Matrix3
  4058. }
  4059. }
  4060. declare module 'XrFrame/math/matrix4' {
  4061. import Vector3 from 'XrFrame/math/vector3'
  4062. import Vector4 from 'XrFrame/math/vector4'
  4063. import V3ReadOnly from 'XrFrame/math/vector3'
  4064. import V4ReadOnly from 'XrFrame/math/vector4'
  4065. import QuatReadOnly from 'XrFrame/math/quaternion'
  4066. import M3ReadOnly from 'XrFrame/math/matrix3'
  4067. /**
  4068. * @public
  4069. */
  4070. export default class Matrix4 {
  4071. _raw: Float32Array
  4072. /**
  4073. * 构造相机矩阵
  4074. *
  4075. * @static
  4076. * @param {Vector3} position 相机位置
  4077. * @param {Vector3} target 相机目标位置
  4078. * @param {Vector3} up 上方向
  4079. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4080. * @returns {Matrix4} 计算结果
  4081. * @memberof Matrix4
  4082. */
  4083. static lookAt(
  4084. position: V3ReadOnly,
  4085. target: V3ReadOnly,
  4086. up: V3ReadOnly,
  4087. dst?: Matrix4
  4088. ): Matrix4
  4089. /**
  4090. * 构造透视投影矩阵
  4091. *
  4092. * @static
  4093. * @param {number} fieldOfViewRadians 视野大小,用弧度表示
  4094. * @param {number} aspect 宽高比
  4095. * @param {number} near 近平面
  4096. * @param {number} far 远平面
  4097. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4098. * @returns {Matrix4} 计算结果
  4099. * @memberof Matrix4
  4100. */
  4101. static perspective(
  4102. fieldOfViewRadians: number,
  4103. aspect: number,
  4104. near: number,
  4105. far: number,
  4106. dst?: Matrix4
  4107. ): Matrix4
  4108. /**
  4109. * 构造正交投影矩阵
  4110. *
  4111. * @static
  4112. * @param {number} left 左平面
  4113. * @param {number} right 右平面
  4114. * @param {number} bottom 上平面
  4115. * @param {number} top 下平面
  4116. * @param {number} near 近平面
  4117. * @param {number} far 远平面
  4118. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4119. * @returns {Matrix4} 计算结果
  4120. * @memberof Matrix4
  4121. */
  4122. static orthographic(
  4123. left: number,
  4124. right: number,
  4125. bottom: number,
  4126. top: number,
  4127. near: number,
  4128. far: number,
  4129. dst?: Matrix4
  4130. ): Matrix4
  4131. /**
  4132. * 将四元数转换为旋转矩阵
  4133. *
  4134. * @static
  4135. * @param {Quaternion} quat 四元数
  4136. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4137. * @returns {Matrix4} 计算结果
  4138. * @memberof Matrix4
  4139. */
  4140. static fromQuaternion(quat: QuatReadOnly, dst?: Matrix4): Matrix4
  4141. /**
  4142. * 使用一个数组创建
  4143. * 此操作会拷贝一份数组
  4144. *
  4145. * @static
  4146. * @param {number[]} array 数据源,长度必须为16,否则会抛出异常
  4147. * @returns {Matrix4} 创建出来的矩阵
  4148. * @memberof Matrix4
  4149. */
  4150. static createFromArray(array: number[]): Matrix4
  4151. /**
  4152. * 使用某个已有的typedArray创建
  4153. * 此操作不会拷贝数据,而是在原来的内存区域上操作
  4154. *
  4155. * @static
  4156. * @param {Float32Array} array 数据源
  4157. * @param {number} [offset=0] 数据源中的偏移
  4158. * @returns {Matrix4} 创建出来的矩阵
  4159. * @memberof Matrix4
  4160. */
  4161. static createFromTypedArray(
  4162. array: Float32Array,
  4163. offset?: number
  4164. ): Matrix4
  4165. /**
  4166. * 创建绕X轴旋转的矩阵
  4167. *
  4168. * @static
  4169. * @param {number} rad 旋转幅度,用弧度表示
  4170. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4171. * @returns {Matrix4} 计算结果
  4172. * @memberof Matrix4
  4173. */
  4174. static createRotationX(rad: number, dst?: Matrix4): Matrix4
  4175. /**
  4176. * 创建绕Y轴旋转的矩阵
  4177. *
  4178. * @static
  4179. * @param {number} rad 旋转幅度,用弧度表示
  4180. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4181. * @returns {Matrix4} 计算结果
  4182. * @memberof Matrix4
  4183. */
  4184. static createRotationY(rad: number, dst?: Matrix4): Matrix4
  4185. /**
  4186. * 创建绕Z轴旋转的矩阵
  4187. *
  4188. * @static
  4189. * @param {number} rad 旋转轴
  4190. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4191. * @returns {Matrix4} 计算结果
  4192. * @memberof Matrix4
  4193. */
  4194. static createRotationZ(rad: number, dst?: Matrix4): Matrix4
  4195. /**
  4196. * 创建绕指定轴旋转的矩阵
  4197. *
  4198. * @static
  4199. * @param {Vector3} axis 旋转轴
  4200. * @param {number} angleInRadians 旋转幅度,用弧度表示
  4201. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4202. * @returns {Matrix4} 计算结果
  4203. * @memberof Matrix4
  4204. */
  4205. static createRotationAxis(
  4206. axis: V3ReadOnly,
  4207. angleInRadians: number,
  4208. dst?: Matrix4
  4209. ): Matrix4
  4210. /**
  4211. * 将位移旋转缩放合成一个RST矩阵,旋转用矩阵表示
  4212. *
  4213. * @static
  4214. * @param {V3ReadOnly} translation 位移向量
  4215. * @param {M4ReadOnly} rotation 旋转矩阵
  4216. * @param {V3ReadOnly} scale 缩放向量
  4217. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4218. * @returns {Matrix4} 计算结果
  4219. * @memberof Matrix4
  4220. */
  4221. static composeTRS(
  4222. translation: V3ReadOnly,
  4223. rotation: Matrix4,
  4224. scale: V3ReadOnly,
  4225. dst?: Matrix4
  4226. ): Matrix4
  4227. /**
  4228. * 将位移旋转缩放合成一个RST矩阵,旋转用四元数表示
  4229. *
  4230. * @static
  4231. * @param {V3ReadOnly} translation 位移向量
  4232. * @param {QuatReadOnly} rotation 旋转四元数
  4233. * @param {V3ReadOnly} scale 缩放向量
  4234. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4235. * @returns {Matrix4} 计算结果
  4236. * @memberof Matrix4
  4237. */
  4238. static composeTQS(
  4239. translation: V3ReadOnly,
  4240. rotation: QuatReadOnly,
  4241. scale: V3ReadOnly,
  4242. dst?: Matrix4
  4243. ): Matrix4
  4244. /**
  4245. * 从二维RST矩阵扩展到三维RST矩阵
  4246. *
  4247. * @static
  4248. * @param {Matrix3} m3 二维RST矩阵
  4249. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4250. * @returns {Matrix4} 计算结果
  4251. * @memberof Matrix4
  4252. */
  4253. static composeFromRST3(m3: M3ReadOnly, dst?: Matrix4): Matrix4
  4254. /**
  4255. * 返回矩阵数据
  4256. *
  4257. * @returns {number[]} 矩阵数据,以JSArray返回
  4258. * @memberof Matrix4
  4259. */
  4260. toArray(): number[]
  4261. /**
  4262. * 将该矩阵进行位移变换
  4263. *
  4264. * @param {number} tx x轴位移
  4265. * @param {number} ty y轴位移
  4266. * @param {number} tz z轴位移
  4267. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4268. * @returns {Matrix4} 计算结果
  4269. * @memberof Matrix4
  4270. */
  4271. translate(tx: number, ty: number, tz: number, dst?: Matrix4): Matrix4
  4272. /**
  4273. * 将该矩阵进行缩放变换
  4274. *
  4275. * @param {number} sx x轴缩放
  4276. * @param {number} sy y轴缩放
  4277. * @param {number} sz z轴缩放
  4278. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4279. * @returns {Matrix4} 计算结果
  4280. * @memberof Matrix4
  4281. */
  4282. scale(sx: number, sy: number, sz: number, dst?: Matrix4): Matrix4
  4283. /**
  4284. * 将该矩阵绕x轴旋转
  4285. *
  4286. * @param {number} rx 旋转幅度,用弧度表示
  4287. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4288. * @returns {Matrix4} 计算结果
  4289. * @memberof Matrix4
  4290. */
  4291. xRotate(rx: number, dst?: Matrix4): Matrix4
  4292. /**
  4293. * 将该矩阵绕y轴旋转
  4294. *
  4295. * @param {number} ry 旋转幅度,用弧度表示
  4296. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4297. * @returns {Matrix4} 计算结果
  4298. * @memberof Matrix4
  4299. */
  4300. yRotate(ry: number, dst?: Matrix4): Matrix4
  4301. /**
  4302. * 将该矩阵绕z轴旋转
  4303. *
  4304. * @param {number} rz 旋转幅度,用弧度表示
  4305. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4306. * @returns {Matrix4} 计算结果
  4307. * @memberof Matrix4
  4308. */
  4309. zRotate(rz: number, dst?: Matrix4): Matrix4
  4310. /**
  4311. * 将该矩阵绕指定轴旋转
  4312. *
  4313. * @param {Vector3} axis 轴向量
  4314. * @param {number} angleInRadians 旋转幅度,用弧度表示
  4315. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4316. * @returns {Matrix4} 计算结果
  4317. * @memberof Matrix4
  4318. */
  4319. axisRotate(
  4320. axis: V3ReadOnly,
  4321. angleInRadians: number,
  4322. dst?: Matrix4
  4323. ): Matrix4
  4324. /**
  4325. * 将该矩阵使用指定四元数旋转
  4326. *
  4327. * @param {Quaternion} quaternion 四元数
  4328. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4329. * @returns {Matrix4} 计算结果
  4330. * @memberof Matrix4
  4331. */
  4332. rotateByQuaternion(quaternion: QuatReadOnly, dst?: Matrix4): Matrix4
  4333. /**
  4334. * 求该矩阵的逆
  4335. *
  4336. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4337. * @returns {Matrix4} 计算结果
  4338. * @memberof Matrix4
  4339. */
  4340. inverse(dst?: Matrix4): Matrix4
  4341. /**
  4342. * 求该矩阵的转置
  4343. *
  4344. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4345. * @returns {Matrix4} 计算结果
  4346. * @memberof Matrix4
  4347. */
  4348. transpose(dst?: Matrix4): Matrix4
  4349. /**
  4350. * 将该矩阵与另一个矩阵相乘
  4351. *
  4352. * @param {Matrix4} m 右乘矩阵
  4353. * @param {Matrix4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4354. * @returns {Matrix4} 计算结果
  4355. * @memberof Matrix4
  4356. */
  4357. multiply(m: Matrix4, dst?: Matrix4): Matrix4
  4358. /**
  4359. * 矩阵变换作用于向量
  4360. *
  4361. * @param {Vector4} v 向量
  4362. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4363. * @returns {Vector4} 计算结果
  4364. * @memberof Matrix4
  4365. */
  4366. transformVector(v: V4ReadOnly, dst?: Vector4): Vector4
  4367. /**
  4368. * 矩阵变换作用于方向
  4369. *
  4370. * @param {Vector3} dir 方向
  4371. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4372. * @returns {Vector3} 计算结果
  4373. * @memberof Matrix4
  4374. */
  4375. transformDirection(dir: V3ReadOnly, dst?: Vector3): Vector3
  4376. /**
  4377. * 矩阵变换作用于点
  4378. *
  4379. * @param {Vector3} p 点
  4380. * @param {Vector3} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4381. * @returns {Vector3} 计算结果
  4382. * @memberof Matrix4
  4383. */
  4384. transformPoint(p: V3ReadOnly, dst?: Vector3): Vector3
  4385. /**
  4386. * 拷贝目标矩阵的值到该矩阵
  4387. *
  4388. * @param {M4ReadOnly} val 目标
  4389. * @returns {Matrix4} 自身
  4390. * @memberof Matrix4
  4391. */
  4392. set(val: Matrix4): Matrix4
  4393. /**
  4394. * 拷贝该矩阵
  4395. *
  4396. * @returns {Matrix4} 拷贝出来的对象
  4397. * @memberof Matrix4
  4398. */
  4399. clone(): Matrix4
  4400. /**
  4401. * 分解RTS矩阵为位移、旋转、缩放向量,返回是否成功
  4402. *
  4403. * @param {Vector3} dstTranslation 目标位移向量
  4404. * @param {Matrix4} dstRotationMatrix 目标旋转矩阵
  4405. * @param {Vector3} dstScale 目标缩放分量
  4406. * @returns {boolean} 分解是否成功,如不成功,可能是缩放分量为0
  4407. * @memberof Matrix4
  4408. */
  4409. decomposeTransRotMatScale(
  4410. dstTranslation: Vector3,
  4411. dstRotationMatrix: Matrix4,
  4412. dstScale: Vector3
  4413. ): boolean
  4414. /**
  4415. * 设置该矩阵某行某列的值
  4416. *
  4417. * @param {number} value 值
  4418. * @param {number} column 列数
  4419. * @param {number} row 行数
  4420. * @returns {Matrix4} 自身
  4421. * @memberof Matrix4
  4422. */
  4423. setValue(value: number, column: number, row: number): Matrix4
  4424. /**
  4425. * 获取矩阵某行某列的值
  4426. *
  4427. *
  4428. * @param {number} column 列数
  4429. * @param {number} row 行数
  4430. * @returns {number} 自身
  4431. * @memberof Matrix4
  4432. */
  4433. getValue(column: number, row: number): number
  4434. /**
  4435. * 设置矩阵某列
  4436. *
  4437. * @param {V4ReadOnly} vec 列向量
  4438. * @param {number} column 列数
  4439. * @returns {Matrix4} 自身
  4440. * @memberof Matrix4
  4441. */
  4442. setColumn(vec: V4ReadOnly, column: number): Matrix4
  4443. /**
  4444. * 获取矩阵某列
  4445. *
  4446. * @param {number} column 列数
  4447. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4448. * @returns {Vector4} 该列数据
  4449. * @memberof Matrix4
  4450. */
  4451. getColumn(column: number, dst?: Vector4): Vector4
  4452. /**
  4453. * 设置矩阵某行
  4454. *
  4455. * @param {V4ReadOnly} vec 行向量
  4456. * @param {number} row 行数
  4457. * @returns {Matrix4} 自身
  4458. * @memberof Matrix4
  4459. */
  4460. setRow(vec: V4ReadOnly, row: number): Matrix4
  4461. /**
  4462. * 获取矩阵某行
  4463. *
  4464. * @param {number} row 行数
  4465. * @param {Vector4} [dst] 计算结果输出到的目标对象,如不传则新建一个
  4466. * @returns {Vector4} 该行数据
  4467. * @memberof Matrix4
  4468. */
  4469. getRow(row: number, dst?: Vector4): Vector4
  4470. setArray(value: ArrayLike<number>, offset?: number): Matrix4
  4471. print(): void
  4472. }
  4473. }
  4474. declare module 'XrFrame/math/color' {
  4475. import Vector3 from 'XrFrame/math/vector3'
  4476. export enum BlendType {
  4477. Alpha = 0,
  4478. RGB = 1,
  4479. RGBA = 2,
  4480. None = 3
  4481. }
  4482. export const GetColorFromHex: (str: any) => number
  4483. /**
  4484. * @public
  4485. */
  4486. export default class Color {
  4487. get r(): number
  4488. set r(val: number)
  4489. get g(): number
  4490. set g(val: number)
  4491. get b(): number
  4492. set b(val: number)
  4493. get a(): number
  4494. set a(val: number)
  4495. static get WHITE(): Color
  4496. static get BLACK(): Color
  4497. static get TRANSPARENT(): Color
  4498. static BlendType: typeof BlendType
  4499. static blendColorHex(
  4500. colorHexA: number,
  4501. colorHexB: number,
  4502. type?: BlendType
  4503. ): number
  4504. static multiplyColorHex(
  4505. colorHexA: number,
  4506. colorHexB: number,
  4507. type?: BlendType
  4508. ): number
  4509. static getValue32FromRGBA(
  4510. r: number,
  4511. g: number,
  4512. b: number,
  4513. a: number
  4514. ): number
  4515. static getValue32FromHSVA(): void
  4516. static percentRoundFn(num: number): number
  4517. static diffc(v: number, c: number, diff: number): number
  4518. static rgb2hsv(r: number, g: number, b: number, dst?: Vector3): Vector3
  4519. static hsvV2rgb(h: number, s: number, v: number, dst?: Vector3): Vector3
  4520. static randomMix(
  4521. colorHexA: number,
  4522. colorHexB: number,
  4523. randomSeed?: number
  4524. ): number
  4525. static fromHex(hex: number): Color
  4526. static fromHexString(hexString: string): Color
  4527. static fromFloatArray(arr: number[]): Color
  4528. equals(target: Color): boolean
  4529. set(val: Color): void
  4530. setRGBA(r: number, g: number, b: number, a: number): void
  4531. setValue32(v32: number): void
  4532. toNormalizedArray(): [number, number, number, number]
  4533. toRGBAString(): string
  4534. mix(color: Color, dst?: Color): Color
  4535. }
  4536. }
  4537. declare module 'XrFrame/math/OBB' {
  4538. import Vector3 from 'XrFrame/math/vector3'
  4539. export default class OBB {
  4540. constructor()
  4541. setValues(
  4542. cenX: number,
  4543. cenY: number,
  4544. cenZ: number,
  4545. forward: Vector3,
  4546. w: number,
  4547. h: number,
  4548. d: number
  4549. ): void
  4550. get center(): Vector3
  4551. set center(pos: Vector3)
  4552. get width(): number
  4553. set width(w: number)
  4554. get height(): number
  4555. set height(h: number)
  4556. get depth(): number
  4557. set depth(d: number)
  4558. setForward(forward: Vector3): void
  4559. get AxisX(): Vector3
  4560. get AxisY(): Vector3
  4561. get AxisZ(): Vector3
  4562. }
  4563. }
  4564. declare module 'XrFrame/math/boundBall' {
  4565. import Vector3 from 'XrFrame/math/vector3'
  4566. import V3ReadOnly from 'XrFrame/math/vector3'
  4567. export default class BoundBall {
  4568. static readonly OFFSETS: Readonly<{
  4569. center: number
  4570. radius: number
  4571. }>
  4572. /**
  4573. * 包围球中心
  4574. *
  4575. * @type {V3ReadOnly}
  4576. * @memberof BoundBall
  4577. */
  4578. get center(): V3ReadOnly
  4579. set center(val: V3ReadOnly)
  4580. /**
  4581. * 包围球半径
  4582. *
  4583. * @type {number}
  4584. * @memberof BoundBall
  4585. */
  4586. get radius(): number
  4587. set radius(val: number)
  4588. _raw: Float32Array
  4589. _offset: number
  4590. protected _center?: Vector3
  4591. constructor(raw?: Float32Array, offset?: number)
  4592. /**
  4593. * 使用中心和半径创建包围球
  4594. *
  4595. * @static
  4596. * @param {V3ReadOnly} center
  4597. * @param {number} radius
  4598. * @returns {BoundBall}
  4599. * @memberof BoundBall
  4600. */
  4601. static createFromCenterAndRadius(
  4602. center: V3ReadOnly,
  4603. radius: number
  4604. ): BoundBall
  4605. /**
  4606. * 设置值
  4607. *
  4608. * @param {V3ReadOnly} center
  4609. * @param {number} radius
  4610. * @returns {BoundBall}
  4611. * @memberof BoundBall
  4612. */
  4613. setValue(center: V3ReadOnly, radius: number): BoundBall
  4614. /**
  4615. * 使用一系列点初始化
  4616. *
  4617. * @param {V3ReadOnly[]} points
  4618. * @returns {BoundBall} 自身
  4619. * @memberof BoundBall
  4620. */
  4621. initByPoints(points: V3ReadOnly[]): BoundBall
  4622. initByPointRadius(center: V3ReadOnly, radius: number): void
  4623. }
  4624. }
  4625. declare module 'XrFrame/math/boundBox' {
  4626. import Vector3 from 'XrFrame/math/vector3'
  4627. import V3ReadOnly from 'XrFrame/math/vector3'
  4628. export default class BoundBox {
  4629. static readonly OFFSETS: Readonly<{
  4630. center: number
  4631. size: number
  4632. }>
  4633. /**
  4634. * 包围盒中心
  4635. *
  4636. * @type {Vector3}
  4637. * @memberof BoundBox
  4638. */
  4639. get center(): V3ReadOnly
  4640. set center(val: V3ReadOnly)
  4641. /**
  4642. * 包围盒尺寸
  4643. *
  4644. * @memberof BoundBox
  4645. */
  4646. get size(): V3ReadOnly
  4647. set size(val: V3ReadOnly)
  4648. _raw: Float32Array
  4649. _offset: number
  4650. protected _center?: Vector3
  4651. protected _size?: Vector3
  4652. constructor(raw?: Float32Array, offset?: number)
  4653. /**
  4654. * 使用中心和尺寸创建包围球
  4655. *
  4656. * @static
  4657. * @param {V3ReadOnly} center 中心
  4658. * @param {V3ReadOnly} size 尺寸
  4659. * @returns {BoundBall}
  4660. * @memberof BoundBall
  4661. */
  4662. static createFromCenterAndSize(
  4663. center: V3ReadOnly,
  4664. size: V3ReadOnly
  4665. ): BoundBox
  4666. /**
  4667. * 设置值
  4668. *
  4669. * @param {V3ReadOnly} center
  4670. * @param {V3ReadOnly} size
  4671. * @returns {BoundBox}
  4672. * @memberof BoundBox
  4673. */
  4674. setValue(center: V3ReadOnly, size: V3ReadOnly): BoundBox
  4675. initByPoints(points: Vector3[], length?: number): void
  4676. startInitByPoints(): void
  4677. addPoint(corner: Vector3): void
  4678. endInitByPoints(): void
  4679. }
  4680. }
  4681. declare module 'XrFrame/math/Spherical' {
  4682. /**
  4683. * Spherical.ts
  4684. *
  4685. * * @Date : 2022/1/14下午4:49:50
  4686. */
  4687. import Vector3 from 'XrFrame/math/vector3'
  4688. /**
  4689. * 球面坐标系。
  4690. */
  4691. export default class Spherical {
  4692. static EPS: number
  4693. isSpherical: boolean
  4694. /**
  4695. * 球面半径。
  4696. */
  4697. radius: number
  4698. /**
  4699. * 点在球面上的横向旋转角度。
  4700. */
  4701. phi: number
  4702. /**
  4703. * 点在球面上的纵向旋转角度。
  4704. */
  4705. theta: number
  4706. /**
  4707. * 球面球心。
  4708. */
  4709. center: Vector3
  4710. constructor(radius?: number, phi?: number, theta?: number)
  4711. set(radius: number, phi: number, theta: number): this
  4712. clone(): Spherical
  4713. copy(other: Spherical): this
  4714. /**
  4715. * restrict phi to be between EPS and PI-EPS。
  4716. */
  4717. makeSafe(): this
  4718. /**
  4719. * 从笛卡尔坐标系的Vector3转换。
  4720. */
  4721. setFromVector3(vector: Vector3): this
  4722. /**
  4723. * 从笛卡尔坐标系的x、y、z转换。
  4724. */
  4725. setFromCartesianCoords(x: number, y: number, z: number): this
  4726. /**
  4727. * 转换到笛卡尔坐标系的Vector3。
  4728. */
  4729. toVector3(vector?: Vector3): Vector3
  4730. }
  4731. }
  4732. declare module 'XrFrame/kanata/lib/kanata' {
  4733. import * as IKanata from 'XrFrame/kanata/lib/frontend'
  4734. import { IEngineSettings } from 'XrFrame/kanata/lib/backend/interface'
  4735. export * from 'XrFrame/kanata/lib/backend/interface'
  4736. export {
  4737. ITextureOptions,
  4738. IRenderPassDescriptor
  4739. } from 'XrFrame/kanata/lib/index'
  4740. export type AnimatorComponent = IKanata.AnimatorComponent
  4741. export type CameraComponent = IKanata.CameraComponent
  4742. export type LightCameraComponent = IKanata.LightCameraComponent
  4743. export type CullingComponent = IKanata.CullingComponent
  4744. export type MeshRendererComponent = IKanata.MeshRendererComponent
  4745. export type SkinnedSkeletonComponent = IKanata.SkinnedSkeletonComponent
  4746. export type DynamicBonesComponent = IKanata.DynamicBonesComponent
  4747. export type Entity2D = IKanata.Entity2D
  4748. export type Entity3D = IKanata.Entity3D
  4749. export type AnimationClipModel = IKanata.AnimationClipModel
  4750. export type AnimationClipBinding = IKanata.AnimationClipBinding
  4751. export type AnimatorControllerModel = IKanata.AnimatorControllerModel
  4752. export type AnimatorControllerStateModel =
  4753. IKanata.AnimatorControllerStateModel
  4754. export type DataBuffer = IKanata.DataBuffer
  4755. export type DataModel = IKanata.DataModel
  4756. export type Effect = IKanata.Effect
  4757. export type Material = IKanata.Material
  4758. export type SkeletonBoneInverseModel = IKanata.SkeletonBoneInverseModel
  4759. export type UniformBlock = IKanata.UniformBlock
  4760. export type UniformDescriptor = IKanata.UniformDescriptor
  4761. export type IndexBuffer = IKanata.IndexBuffer
  4762. export type IndexData = IKanata.IndexData
  4763. export type VertexBuffer = IKanata.VertexBuffer
  4764. export type VertexData = IKanata.VertexData
  4765. export type VertexLayout = IKanata.VertexLayout
  4766. export type VertexDataDescriptor = IKanata.VertexDataDescriptor
  4767. export type View = IKanata.View
  4768. export type ScalableList = IKanata.ScalableList
  4769. export type RenderPass = IKanata.RenderPass
  4770. export type Texture = IKanata.Texture
  4771. export type RenderEnv = IKanata.RenderEnv
  4772. export interface IKanataInstance {
  4773. Image: typeof IKanata.Image
  4774. Downloader: typeof IKanata.Downloader
  4775. IS_VALID: typeof IKanata.IS_VALID
  4776. GET_MAIN_CANVAS: typeof IKanata.GET_MAIN_CANVAS
  4777. Phys3D: typeof IKanata.Phys3D
  4778. AnimatorComponent: typeof IKanata.AnimatorComponent
  4779. CameraComponent: typeof IKanata.CameraComponent
  4780. LightCameraComponent: typeof IKanata.LightCameraComponent
  4781. CullingComponent: typeof IKanata.CullingComponent
  4782. MeshRendererComponent: typeof IKanata.MeshRendererComponent
  4783. SkinnedSkeletonComponent: typeof IKanata.SkinnedSkeletonComponent
  4784. DynamicBonesComponent: typeof IKanata.DynamicBonesComponent
  4785. Entity2D: typeof IKanata.Entity2D
  4786. Entity3D: typeof IKanata.Entity3D
  4787. AnimationClipModel: typeof IKanata.AnimationClipModel
  4788. AnimationClipBinding: typeof IKanata.AnimationClipBinding
  4789. AnimatorControllerModel: typeof IKanata.AnimatorControllerModel
  4790. AnimatorControllerStateModel: typeof IKanata.AnimatorControllerStateModel
  4791. DataBuffer: typeof IKanata.DataBuffer
  4792. DataModel: typeof IKanata.DataModel
  4793. Effect: typeof IKanata.Effect
  4794. Material: typeof IKanata.Material
  4795. SkeletonBoneInverseModel: typeof IKanata.SkeletonBoneInverseModel
  4796. UniformBlock: typeof IKanata.UniformBlock
  4797. UniformDescriptor: typeof IKanata.UniformDescriptor
  4798. IndexBuffer: typeof IKanata.IndexBuffer
  4799. IndexData: typeof IKanata.IndexData
  4800. VertexBuffer: typeof IKanata.VertexBuffer
  4801. VertexData: typeof IKanata.VertexData
  4802. VertexLayout: typeof IKanata.VertexLayout
  4803. VertexDataDescriptor: typeof IKanata.VertexDataDescriptor
  4804. View: typeof IKanata.View
  4805. ScalableList: typeof IKanata.ScalableList
  4806. crossContext: typeof IKanata.crossContext
  4807. RenderPass: typeof IKanata.RenderPass
  4808. Texture: typeof IKanata.Texture
  4809. RenderEnv: typeof IKanata.RenderEnv
  4810. renderEnv: typeof IKanata.renderEnv
  4811. createWeakRef: typeof IKanata.createWeakRef
  4812. createWeakRefSentry: typeof IKanata.createWeakRefSentry
  4813. createNativeUUMap: typeof IKanata.createNativeUUMap
  4814. createNativeSUMap: typeof IKanata.createNativeSUMap
  4815. createNativeULUMap: typeof IKanata.createNativeULUMap
  4816. loadTTFFont: typeof IKanata.loadTTFFont
  4817. getGlyphInfo: typeof IKanata.getGlyphInfo
  4818. refreshNodesWorldTransform: typeof IKanata.refreshNodesWorldTransform
  4819. setGlobalPhysicSystem: typeof IKanata.setGlobalPhysicSystem
  4820. bindRigidBodyToNode: typeof IKanata.bindRigidBodyToNode
  4821. bindCCTToNode: typeof IKanata.bindCCTToNode
  4822. unbindRigidBody: typeof IKanata.unbindRigidBody
  4823. unbindCCT: typeof IKanata.unbindCCT
  4824. decodeBase64: typeof IKanata.decodeBase64
  4825. initDraco: typeof IKanata.initDraco
  4826. decodeDraco: typeof IKanata.decodeDraco
  4827. setNodeName: typeof IKanata.setNodeName
  4828. setRenderComponentName: typeof IKanata.setRenderComponentName
  4829. debugPrint: typeof IKanata.debugPrint
  4830. eventBridge: typeof IKanata.eventBridge
  4831. destroy: typeof IKanata.destroy
  4832. update: typeof IKanata.update
  4833. }
  4834. export function CREATE_INSTANCE(
  4835. MAIN_CANVAS: HTMLCanvasElement,
  4836. ENGINE_SETTINGS: IEngineSettings,
  4837. ENGINE_MODE: 'Game' | 'Editor',
  4838. IS_SUB_CONTEXT: boolean,
  4839. HOST: string,
  4840. FIX_INSTANCE: boolean
  4841. ): IKanataInstance
  4842. export function RELEASE_INSTANCE(MAIN_CANVAS: HTMLCanvasElement): void
  4843. }
  4844. declare module 'XrFrame/core/Scene' {
  4845. /**
  4846. * Scene.ts
  4847. *
  4848. * * @Date : 2022/3/16下午3:32:57
  4849. */
  4850. import Transform from 'XrFrame/components/Transform'
  4851. import { Kanata } from 'XrFrame/ext'
  4852. import AssetsSystem from 'XrFrame/systems/AssetsSystem'
  4853. import RenderSystem from 'XrFrame/systems/RenderSystem'
  4854. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  4855. import Material from 'XrFrame/assets/Material'
  4856. import RenderTexture, {
  4857. IRenderTextureOptions
  4858. } from 'XrFrame/assets/RenderTexture'
  4859. import Effect, { IEffectAsset } from 'XrFrame/assets/Effect'
  4860. import Geometry from 'XrFrame/assets/Geometry'
  4861. import AnimationSystem from 'XrFrame/systems/AnimationSystem'
  4862. import PhysicsSystem from 'XrFrame/systems/PhysicsSystem'
  4863. import ARSystem from 'XrFrame/systems/ARSystem'
  4864. import { XRShadow } from 'XrFrame/elements'
  4865. import { GizmoSystem, ShareSystem, VideoSystem } from 'XrFrame/systems'
  4866. import VideoTexture, {
  4867. IVideoTextureOptions
  4868. } from 'XrFrame/assets/VideoTexture'
  4869. import PostProcess, {
  4870. IPostProcessOptions
  4871. } from 'XrFrame/assets/PostProcess'
  4872. /**
  4873. * 场景的默认组件,均为系统。
  4874. */
  4875. export const SceneDefaultComponents: IEntityComponents
  4876. /**
  4877. * 场景的默认映射。
  4878. */
  4879. export const SceneDataMapping: {
  4880. [key: string]: string[]
  4881. }
  4882. export interface TDict<T> {
  4883. [key: string]: T
  4884. }
  4885. /**
  4886. * 场景,系统核心之一。
  4887. *
  4888. * `Scene`是元素的一种,对应于`xr-scene`标签。
  4889. * 作为整个`xr-frame`组件的根节点,它提供了整个组件运作的一些基本能力,挂在了各大系统,驱动生命周期循环。
  4890. */
  4891. export default class Scene extends Element {
  4892. readonly defaultComponents: IEntityComponents
  4893. readonly isScene: boolean
  4894. /**
  4895. * 场景是否已经就绪。
  4896. */
  4897. get ready(): boolean
  4898. /**
  4899. * 自身。
  4900. */
  4901. get scene(): this
  4902. /**
  4903. * 一个可以用于快速挂载自己创建的`Element`的`shadow`节点。
  4904. */
  4905. get rootShadow(): XRShadow
  4906. /**
  4907. * 资源系统。
  4908. */
  4909. get assets(): AssetsSystem
  4910. /**
  4911. * 渲染系统。
  4912. */
  4913. get render(): RenderSystem
  4914. /**
  4915. * 动画系统。
  4916. */
  4917. get animation(): AnimationSystem
  4918. /**
  4919. * 视频系统。
  4920. */
  4921. get video(): VideoSystem
  4922. /**
  4923. * 物理系统。
  4924. */
  4925. get physics(): PhysicsSystem
  4926. /**
  4927. * AR系统。
  4928. */
  4929. get ar(): ARSystem
  4930. /**
  4931. * Gizmo系统。
  4932. */
  4933. get gizmo(): GizmoSystem
  4934. /**
  4935. * 分享系统。
  4936. */
  4937. get share(): ShareSystem
  4938. /**
  4939. * 渲染分辨率宽,一般物理点击事件之类的都是参考这个。
  4940. */
  4941. get width(): number
  4942. /**
  4943. * 渲染分辨率高,一般物理点击事件之类的都是参考这个。
  4944. */
  4945. get height(): number
  4946. /**
  4947. * 显示分辨率宽。
  4948. */
  4949. get frameWidth(): number
  4950. /**
  4951. * 显示分辨率高。
  4952. */
  4953. get frameHeight(): number
  4954. /**
  4955. * 当前时间戳(ms)。
  4956. */
  4957. get timestamp(): number
  4958. /**
  4959. * @internal
  4960. */
  4961. get renderPass(): Kanata.RenderPass
  4962. /**
  4963. * @internal
  4964. */
  4965. get rootNode(): import('XrFrame/kanata/lib/index').Entity3D
  4966. /**
  4967. * @internal
  4968. */
  4969. get backendVersion(): number[]
  4970. /**
  4971. * @internal
  4972. */
  4973. versionBefore(major: number, minor: number): boolean
  4974. /**
  4975. * @internal
  4976. */
  4977. get backendCommit(): string
  4978. /**
  4979. * @internal
  4980. */
  4981. get backendUsePuppetSokol(): boolean
  4982. /**
  4983. * @internal
  4984. */
  4985. /**
  4986. * @internal
  4987. */
  4988. /**
  4989. * @internal
  4990. */
  4991. /**
  4992. * 创建一个`Element`,但注意**其只能作为`xr-shadow`的子孙节点**,否则可能会出错!
  4993. *
  4994. * @param attributes 初始化的属性,同于`xml`中对应的标签属性。
  4995. */
  4996. createElement<T extends Element>(
  4997. clz: new (...args: any) => T,
  4998. attributes?: {
  4999. [name: string]: string
  5000. }
  5001. ): T
  5002. /**
  5003. * @internal
  5004. */
  5005. /**
  5006. * @internal
  5007. */
  5008. /**
  5009. * @internal
  5010. */
  5011. /**
  5012. * @internal
  5013. */
  5014. /**
  5015. * @internal
  5016. */
  5017. /**
  5018. * 通过在`wxml`的元素上设置的`id`索引一个元素,`id`是唯一的。
  5019. */
  5020. getElementById(id: string): Element
  5021. /**
  5022. * 通过在`wxml`的元素上设置的`node-id`索引一个`Transform`组件,`node-id`是唯一的。
  5023. */
  5024. getNodeById(nodeId: string): Transform
  5025. /**
  5026. * @internal
  5027. */
  5028. /**
  5029. * 手动创建一个`Image`资源。
  5030. *
  5031. * @param autoRelease 此图片在第一次时候后是否释放原始数据,默认释放。
  5032. */
  5033. createImage(autoRelease?: boolean): Kanata.IImage
  5034. /**
  5035. * 手动创建一个`Texture`资源。
  5036. */
  5037. createTexture(options: Kanata.ITextureOptions): Kanata.Texture
  5038. /**
  5039. * 手动创建一个`Effect`资源。
  5040. */
  5041. createEffect(description: IEffectAsset): Effect
  5042. /**
  5043. * 手动创建一个`UniformBlockDescriptor`资源。
  5044. */
  5045. createUniformBlockDesc(
  5046. options: Kanata.IUniformDescriptorOptions
  5047. ): Kanata.UniformDescriptor
  5048. /**
  5049. * 手动创建一个`UniformBlock`资源。
  5050. */
  5051. createUniformBlock(
  5052. descriptor: Kanata.UniformDescriptor
  5053. ): Kanata.UniformBlock
  5054. /**
  5055. * 手动创建一个`Material`资源。
  5056. */
  5057. createMaterial(
  5058. effect: Effect,
  5059. defaultUniforms?: {
  5060. [key: string]: number | ArrayLike<number> | Kanata.Texture
  5061. }
  5062. ): Material
  5063. /**
  5064. * 手动创建一个`VertexLayout`资源。
  5065. */
  5066. createVertexLayout(
  5067. options: Kanata.IVertexLayoutOptions
  5068. ): Kanata.VertexLayout
  5069. /**
  5070. * 手动创建一个`Geometry`资源。
  5071. */
  5072. createGeometry(
  5073. vertexLayout: Kanata.VertexLayout,
  5074. vBuffer: ArrayBufferView,
  5075. iBuffer: ArrayBufferView,
  5076. indexType?: Kanata.EIndexType
  5077. ): Geometry
  5078. /**
  5079. * 手动创建一个`RenderTexture`资源。
  5080. */
  5081. createRenderTexture(options?: IRenderTextureOptions): RenderTexture
  5082. /**
  5083. * 手动创建一个`VideoTexture`资源。
  5084. */
  5085. createVideoTexture(
  5086. options?: IVideoTextureOptions
  5087. ): Promise<VideoTexture>
  5088. /**
  5089. * 手动创建一个`PostProcess`资源。
  5090. */
  5091. createPostProcess(options: IPostProcessOptions): PostProcess
  5092. }
  5093. }
  5094. declare module 'XrFrame/core/Observable' {
  5095. export default class Observable<TParams = any, TSender = any> {
  5096. isObservable: boolean
  5097. /**
  5098. * 拥有的监听者数量。
  5099. */
  5100. get count(): number
  5101. /**
  5102. * 添加一个回调到队列中。
  5103. */
  5104. add(
  5105. callback: (params: TParams, sender?: TSender) => void | boolean,
  5106. priority?: number,
  5107. isOnce?: boolean
  5108. ): this
  5109. /**
  5110. * 添加一个回调到队列中,并再被触发执行一次后自动移除。
  5111. */
  5112. addOnce(
  5113. callback: (params: TParams, sender?: TSender) => void | boolean,
  5114. priority?: number
  5115. ): this
  5116. /**
  5117. * 清空队列。
  5118. */
  5119. clear(): this
  5120. /**
  5121. * 从队列中移除一个回调。
  5122. */
  5123. remove(
  5124. callback: (params: TParams, sender?: TSender) => void | boolean
  5125. ): this
  5126. /**
  5127. * 通过一个参数触发一次广播,调用所有回调。
  5128. */
  5129. notify(params: TParams, sender?: TSender): this
  5130. }
  5131. }
  5132. declare module 'XrFrame/components/Transform' {
  5133. /**
  5134. * Transform.ts
  5135. *
  5136. * * @Date : 2022/3/16下午3:48:05
  5137. */
  5138. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5139. import Element from 'XrFrame/core/Element'
  5140. import Matrix4 from 'XrFrame/math/matrix4'
  5141. import Quaternion from 'XrFrame/math/quaternion'
  5142. import Vector3 from 'XrFrame/math/vector3'
  5143. /**
  5144. * {@link Transform}组件数据接口。
  5145. */
  5146. export interface ITransformData {
  5147. /**
  5148. * 设置一个唯一的节点Id,区别于`xml`上的那个`id`。
  5149. * `xml`中的数据类型为`string`。
  5150. */
  5151. nodeId: string
  5152. /**
  5153. * 节点的位移。
  5154. * `xml`中的数据类型为`number-array`,默认为`0 0 0`。
  5155. */
  5156. position: number[]
  5157. /**
  5158. * 节点的旋转,注意此处为**角度**。
  5159. * `xml`中的数据类型为`number-array`,默认为`0 0 0`。
  5160. */
  5161. rotation: number[]
  5162. /**
  5163. * 节点的位缩放。
  5164. * `xml`中的数据类型为`number-array`,默认为`1 1 1`。
  5165. */
  5166. scale: number[]
  5167. /**
  5168. * 节点的可见性,可以控制该节点以及所有子节点是否可见。
  5169. * `xml`中的数据类型为`boolean`,默认为`true`。
  5170. */
  5171. visible?: boolean
  5172. /**
  5173. * 节点的层级,作为控制节点以及子节点是否可见的一部分,配合{@link Camera.cullMask}使用。
  5174. * 判定规则为自顶层节点向下,只有全部通过了判定才能显示。
  5175. * `xml`中的数据类型为`number`,默认为`0`。
  5176. */
  5177. layer?: number
  5178. }
  5179. /**
  5180. * {@link Transform}的`schema`,详见{@link ITransformData}。
  5181. */
  5182. export const TransformSchema: IComponentSchema
  5183. /**
  5184. * 3D变换组件,作为场景中3D节点的根基,一般被代理到{@link XRNode}元素。
  5185. */
  5186. export default class Transform extends Component<ITransformData> {
  5187. /**
  5188. * 详见{@link TransformSchema}。
  5189. */
  5190. readonly schema: IComponentSchema
  5191. readonly priority: number
  5192. get node(): import('XrFrame/kanata/lib/index').Entity3D
  5193. /**
  5194. * 获取世界矩阵,**注意不可修改**。
  5195. */
  5196. get worldMatrix(): Matrix4
  5197. /**
  5198. * 获取世界绝对位移,**注意不可修改**。
  5199. */
  5200. get worldPosition(): Vector3
  5201. /**
  5202. * 获取世界绝对旋转,**注意不可修改**。
  5203. */
  5204. get worldQuaternion(): Quaternion
  5205. /**
  5206. * 获取世界绝对缩放,**注意不可修改**。
  5207. */
  5208. get worldScale(): Vector3
  5209. /**
  5210. * 获取世界前向向量,**注意不可修改**。
  5211. */
  5212. get worldForward(): Vector3
  5213. /**
  5214. * 获取世界上向向量,**注意不可修改**。
  5215. */
  5216. get worldUp(): Vector3
  5217. /**
  5218. * 获取世界右向向量,**注意不可修改**。
  5219. */
  5220. get worldRight(): Vector3
  5221. get position(): Vector3
  5222. /**
  5223. * 注意如果这里直接修改,使用**弧度**。
  5224. */
  5225. get rotation(): Vector3
  5226. get quaternion(): Quaternion
  5227. get scale(): Vector3
  5228. get visible(): boolean
  5229. set visible(value: boolean)
  5230. get layer(): number
  5231. set layer(value: number)
  5232. /**
  5233. * @internal
  5234. */
  5235. /**
  5236. * 直接设置本地矩阵。
  5237. */
  5238. setLocalMatrix(mat: Matrix4): void
  5239. onAdd(parent: Element, data: ITransformData): void
  5240. onUpdate(data: ITransformData, preData: ITransformData): void
  5241. onRemove(parent: Element, data: ITransformData): void
  5242. onRelease(data: ITransformData): void
  5243. }
  5244. }
  5245. declare module 'XrFrame/components/AssetLoad' {
  5246. /**
  5247. * AssetLoad.ts
  5248. *
  5249. * * @Date : 2022/3/31下午4:56:14
  5250. */
  5251. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5252. import Element from 'XrFrame/core/Element'
  5253. import { IAssetLoadData } from 'XrFrame/loader/types'
  5254. /**
  5255. * {@link AssetLoad}的`schema`,详见{@link IAssetLoadData}。
  5256. */
  5257. export const AssetLoadSchema: IComponentSchema
  5258. /**
  5259. * 用于加载资源的组件,一般被代理到{@link XRAssetLoad}元素。
  5260. */
  5261. export default class AssetLoad extends Component<IAssetLoadData> {
  5262. /**
  5263. * 详见{@link AssetLoadSchema}。
  5264. */
  5265. readonly schema: IComponentSchema
  5266. /**
  5267. * @internal
  5268. */
  5269. get loadParams(): IAssetLoadData<any>
  5270. onAdd(parent: Element, data: IAssetLoadData): void
  5271. onUpdate(data: IAssetLoadData, preData: IAssetLoadData): void
  5272. onRemove(parent: Element, data: IAssetLoadData<any>): void
  5273. }
  5274. }
  5275. declare module 'XrFrame/components/Assets' {
  5276. /**
  5277. * Assets.ts
  5278. *
  5279. * * @Date : 2022/3/24下午3:18:14
  5280. */
  5281. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5282. import { IAssetLoadData } from 'XrFrame/loader/types'
  5283. export interface IAssetsData {}
  5284. export const AssetsSchema: IComponentSchema
  5285. /**
  5286. * 资源加载组组件,会统计作为其子节点的{@link AssetLoad}组件的加载状态,派发事件。
  5287. * 一般被代理到{@link XRAssets}元素。
  5288. *
  5289. * 事件`progress`会在资源加载进度更新时触发,值为`{progress: number, asset: IAssetLoadData}`。
  5290. * 事件`loaded`会在所有资源加载完成是触发,值为`{assets: {[key: string]: IAssetLoadData}, errors: {[key: string]: Error}}`。
  5291. * 详见{@link IAssetLoadData}。
  5292. */
  5293. export default class Assets extends Component<IAssetsData> {
  5294. static EVENTS: string[]
  5295. readonly schema: IComponentSchema
  5296. }
  5297. }
  5298. declare module 'XrFrame/components/Camera' {
  5299. /**
  5300. * Camera.ts
  5301. *
  5302. * * @Date : 2022/3/17下午5:25:34
  5303. */
  5304. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5305. import Element from 'XrFrame/core/Element'
  5306. import { Kanata } from 'XrFrame/ext'
  5307. import Vector3 from 'XrFrame/math/vector3'
  5308. import Matrix4 from 'XrFrame/math/matrix4'
  5309. import RenderTexture, { IRenderTarget } from 'XrFrame/assets/RenderTexture'
  5310. import Transform from 'XrFrame/components/Transform'
  5311. import Light from 'XrFrame/components/Light'
  5312. import PostProcess from 'XrFrame/assets/PostProcess'
  5313. /**
  5314. * 相机背景渲染模式。
  5315. *
  5316. * `default`模式只执行默认清屏。
  5317. * `skybox`模式配合{@link Env}组件使用。
  5318. * `ar`模式配合{@link ARSystem}使用。
  5319. */
  5320. export type TCameraBackground = 'default' | 'skybox' | 'ar'
  5321. /**
  5322. * {@link Camera}组件数据接口。
  5323. */
  5324. export interface ICameraData {
  5325. /**
  5326. * 相机对准的目标节点,如果不设置则为自由模式。
  5327. * `xml`中的数据类型为节点对应的`nodeId`。
  5328. */
  5329. target?: Transform
  5330. /**
  5331. * 相机的渲染目标,如果不设置则渲染到屏幕。
  5332. * `xml`中的数据类型为`render-texture`资源。
  5333. */
  5334. renderTarget?: RenderTexture
  5335. /**
  5336. * 深度,决定在多相机时的渲染顺序。
  5337. * `xml`中的数据类型为`number`。
  5338. */
  5339. depth: number
  5340. /**
  5341. * 掩码,一般和{@link Transform.layer}一起使用,决定那些节点要被渲染。
  5342. * `xml`中的数据类型为`number`。
  5343. */
  5344. cullMask: number
  5345. /**
  5346. * 是否为透视相机。
  5347. * `xml`中的数据类型为`boolean`,默认为`true`。
  5348. */
  5349. isPerspective: boolean
  5350. /**
  5351. * 视场角。
  5352. * `xml`中的数据类型为`number`,默认为`60`。
  5353. */
  5354. fov: number
  5355. /**
  5356. * 近平面。
  5357. * `xml`中的数据类型为`number`,默认为`0.1`。
  5358. */
  5359. near: number
  5360. /**
  5361. * 远平面。
  5362. * `xml`中的数据类型为`number`,默认为`100`。
  5363. */
  5364. far: number
  5365. /**
  5366. * 非透视模式,即正交模式时,可视范围大小。
  5367. * `xml`中的数据类型为`number`,默认为`4`。
  5368. */
  5369. orthSize: number
  5370. /**
  5371. * 背景清屏模式。
  5372. * `xml`中的数据类型为`string`,默认为`default`。
  5373. */
  5374. background: TCameraBackground
  5375. /**
  5376. * 是否为AR相机,配合{@link ARSystem}使用。
  5377. * `xml`中的数据类型为`boolean`,默认为`false`。
  5378. * **非常需要注意当设置为`true`时不能同时设置`target`数据!**
  5379. */
  5380. isARCamera: boolean
  5381. /**
  5382. * 清屏是否要清深度。
  5383. * `xml`中的数据类型为`boolean`,默认为`true`。
  5384. */
  5385. isClearDepth: boolean
  5386. /**
  5387. * 清屏是否要清模板值。
  5388. * `xml`中的数据类型为`boolean`,默认为`true`。
  5389. */
  5390. isClearStencil: boolean
  5391. /**
  5392. * 清屏是否要清颜色。
  5393. * `xml`中的数据类型为`boolean`,默认为`true`。
  5394. */
  5395. isClearColor: boolean
  5396. /**
  5397. * 清屏深度。
  5398. * `xml`中的数据类型为`number`,默认为`1`。
  5399. */
  5400. clearDepth: number
  5401. /**
  5402. * 清屏模板值。
  5403. * `xml`中的数据类型为`number`,默认为`0`。
  5404. */
  5405. clearStencil: number
  5406. /**
  5407. * 清屏颜色。
  5408. * `xml`中的数据类型为`color`,默认为`0 0 0 1`。
  5409. */
  5410. clearColor: number[]
  5411. /**
  5412. * 后处理,一个后处理资源id的数组。
  5413. * `xml`中的数据类型为`array`,默认为空。
  5414. */
  5415. postProcess: string[]
  5416. /**
  5417. * 允许的渲染标记,配合{@link RenderSystem}的`changeFeatures`一起使用。
  5418. * `xml`中的数据类型为`array`,默认为空。
  5419. */
  5420. allowFeatures: string[]
  5421. }
  5422. /**
  5423. * {@link Camera}的`schema`,详见{@link ICameraData}。
  5424. */
  5425. export const CameraSchema: IComponentSchema
  5426. /**
  5427. * 相机组件,一般被代理到{@link XRCamera}元素。
  5428. */
  5429. export default class Camera extends Component<ICameraData> {
  5430. /**
  5431. * 详见{@link CameraSchema}。
  5432. */
  5433. readonly schema: IComponentSchema
  5434. readonly priority: number
  5435. /**
  5436. * 相机深度。
  5437. */
  5438. get depth(): number
  5439. /**
  5440. * @internal
  5441. */
  5442. get renderTarget(): IRenderTarget
  5443. /**
  5444. * @internal
  5445. */
  5446. get view(): import('XrFrame/kanata/lib/index').View
  5447. /**
  5448. * @internal
  5449. */
  5450. get id(): number
  5451. /**
  5452. * @internal。
  5453. */
  5454. get bgStates(): {
  5455. [key: string]: any
  5456. }
  5457. /**
  5458. * @internal。
  5459. */
  5460. get bgStatesClear(): boolean
  5461. get background(): TCameraBackground
  5462. get target(): Transform
  5463. get near(): number
  5464. get far(): number
  5465. get cullMask(): number
  5466. get postProcess(): PostProcess[]
  5467. get hdr(): boolean
  5468. get allowFeatures(): string[]
  5469. /**
  5470. * 当前渲染特性集合。
  5471. */
  5472. get features(): {
  5473. [key: string]: string | number | boolean
  5474. }
  5475. /**
  5476. * @internal
  5477. */
  5478. cull(cullResult: Kanata.ScalableList, lightMode: string): void
  5479. /**
  5480. * @internal
  5481. */
  5482. clear(): void
  5483. /**
  5484. * @internal
  5485. */
  5486. draw(renderList: Kanata.ScalableList, lightMode: string): void
  5487. /**
  5488. * @internal
  5489. */
  5490. drawLight(
  5491. light: Light,
  5492. renderList: Kanata.ScalableList,
  5493. lightMode: string
  5494. ): void
  5495. /**
  5496. * 将世界坐标系位置转换到齐次裁剪空间。
  5497. */
  5498. convertWorldPositionToClip(worldPos: Vector3, dst?: Vector3): Vector3
  5499. /**
  5500. * 将齐次裁剪空间转换到世界坐标系位置。
  5501. */
  5502. convertClipPositionToWorld(clipPos: Vector3, dst?: Vector3): Vector3
  5503. /**
  5504. * 修改viewMatrix的设置类型。
  5505. *
  5506. * @param manual 是否要设置为手动模式。
  5507. * @param mat4 手动模式下,要设置的值。
  5508. */
  5509. changeViewMatrix(manual: boolean, mat4?: Matrix4 | Float32Array): void
  5510. /**
  5511. * 修改projectMatrix的设置类型。
  5512. *
  5513. * @param manual 是否要设置为手动模式。
  5514. * @param mat4 手动模式下,要设置的值。
  5515. */
  5516. changeProjectMatrix(
  5517. manual: boolean,
  5518. mat4?: Matrix4 | Float32Array
  5519. ): void
  5520. /**
  5521. * 修改相机背景的渲染状态。
  5522. *
  5523. * @param states 同{@link Material.setRenderStates}
  5524. */
  5525. setBackgroundRenderStates(states: { [key: string]: any }): void
  5526. /**
  5527. * 清空相机背景渲染状态。
  5528. */
  5529. clearBackgroundRenderStates(): void
  5530. onAdd(parent: Element, data: ICameraData): void
  5531. onUpdate(data: ICameraData, preData: ICameraData): void
  5532. onTick(deltaTime: number, data: ICameraData): void
  5533. onRemove(parent: Element, data: ICameraData): void
  5534. onRelease(data: ICameraData): void
  5535. protected _processData(data: ICameraData, preData: ICameraData): void
  5536. }
  5537. }
  5538. declare module 'XrFrame/components/GLTF' {
  5539. import GLTFModel, { TQS } from 'XrFrame/assets/GLTFModel'
  5540. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5541. import Element from 'XrFrame/core/Element'
  5542. import BoundBox from 'XrFrame/math/boundBox'
  5543. import Mesh from 'XrFrame/components/Mesh'
  5544. /**
  5545. * @see {@link GLTF}
  5546. */
  5547. export interface IGLTFData {
  5548. /**
  5549. * 已加载完毕的GLTF模型。
  5550. */
  5551. model: GLTFModel
  5552. /**
  5553. * 是否投射阴影,默认false。
  5554. */
  5555. castShadow?: boolean
  5556. /**
  5557. * 是否接受阴影,默认false。
  5558. */
  5559. receiveShadow?: boolean
  5560. /**
  5561. * 是否不参与剔除,默认false(即参与剔除)。
  5562. */
  5563. neverCull?: boolean
  5564. /**
  5565. * 修改GLTF的默认renderStates。
  5566. */
  5567. states?: Array<[string, string]>
  5568. }
  5569. export const GLTFSchema: IComponentSchema
  5570. interface ElementGLTFInfo {
  5571. el: Element
  5572. hasMesh: boolean
  5573. meshName?: string
  5574. meshes?: Mesh[]
  5575. }
  5576. /**
  5577. * 将一个{@link GLTFModel | GLTF模型}实例化并渲染出来。
  5578. * {@link XRGLTF | xr-gltf}标签会自动生成该组件。
  5579. *
  5580. * > 会在当前元素下新建一系列子元素,作为GLTF模型的每个场景的根节点。
  5581. * > 会在当前元素上新建{@link Animator}组件,并向其添加实例化生成的动画片段。
  5582. *
  5583. * @see {@link IGLTFData}
  5584. */
  5585. export default class GLTFComponent extends Component<IGLTFData> {
  5586. static EVENTS: string[]
  5587. readonly schema: IComponentSchema
  5588. readonly priority: number
  5589. _subRoots: Element[]
  5590. _nodeMap: Map<string, ElementGLTFInfo>
  5591. onUpdate(data: IGLTFData, preData: IGLTFData): void
  5592. onRemove(parent: Element, data: IGLTFData): void
  5593. onRelease(data: IGLTFData): void
  5594. /**
  5595. * 根据GLTF模型中节点的`name`字段来获取内部元素。
  5596. */
  5597. getInternalNodeByName(name: string): Element | undefined
  5598. /**
  5599. * @internal
  5600. */
  5601. /**
  5602. * 获取GLTF模型实例化过程中生成的所有{@link Mesh}组件。
  5603. */
  5604. get meshes(): Mesh[]
  5605. /**
  5606. * 计算GLTF模型整体的包围盒,返回**模型空间**内的计算结果。
  5607. * 每次调用都会重新计算。
  5608. */
  5609. calcTotalBoundBox(): BoundBox
  5610. /**
  5611. * 根据GLTF模型中**引用**了Mesh的**Node节点**的`name`字段,来获取对应Mesh下的所有Primitive。
  5612. * 一个GLTF模型中的Primitive节点对应返回中的一个`xr-frame Mesh组件`实例。
  5613. * **如果没有该名字的节点,或者节点未引用Mesh,会返回空数组。*
  5614. * @param name Node节点的`name`(而非Mesh节点)
  5615. */
  5616. getPrimitivesByNodeName(name: string): Mesh[]
  5617. /**
  5618. * 根据GLTF模型中Mesh节点的`name`字段,来获取引用了该Mesh的**所有**Node节点下的所有Primitive。
  5619. * 在xr-frame实现中,每个引用了该Mesh的GLTFNode节点拥有**独立**的一份Primitives副本,**每个**Node节点下的**每个**Primitive对应一个`xr-frame Mesh组件`。
  5620. * **如果没有引用了该Mesh的Node节点,会返回空数组。*
  5621. * @param name Mesh节点的`name`
  5622. * @returns 一个数组,数组中的一个元素对应一个引用了该Mesh的GLTFNode节点,元素中nodeName为GLTFNode节点的`name`字段。
  5623. */
  5624. getPrimitivesByMeshName(name: string): Array<{
  5625. nodeName: string
  5626. primitives: Mesh[]
  5627. }>
  5628. }
  5629. export {}
  5630. }
  5631. declare module 'XrFrame/components/Light' {
  5632. /**
  5633. * Light.ts
  5634. *
  5635. * * @Date : 2022/3/16下午4:45:56
  5636. */
  5637. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5638. import Element from 'XrFrame/core/Element'
  5639. import { Kanata } from 'XrFrame/ext'
  5640. /**
  5641. * 光照类型枚举。
  5642. */
  5643. export enum ELightType {
  5644. /**
  5645. * 环境光,默认只有一个生效。
  5646. */
  5647. Ambient = 'ambient',
  5648. /**
  5649. * 平行光,默认第一个会成为主平行光。
  5650. */
  5651. Directional = 'directional',
  5652. /**
  5653. * 点光。
  5654. */
  5655. Point = 'point',
  5656. /**
  5657. * 聚光。
  5658. */
  5659. Spot = 'spot'
  5660. }
  5661. /**
  5662. * {@link Light}组件数据接口。
  5663. */
  5664. export interface ILightData {
  5665. /**
  5666. * 类型。
  5667. * `xml`中的数据类型`string`,默认为`directional`。
  5668. */
  5669. type: ELightType
  5670. /**
  5671. * 颜色。
  5672. * `xml`中的数据类型`color`,默认为`[1, 1, 1, 1]`。
  5673. */
  5674. color: number[]
  5675. /**
  5676. * 强度。
  5677. * `xml`中的数据类型`number`,默认为`1`。
  5678. */
  5679. intensity: number
  5680. /**
  5681. * 范围,仅在点光和聚光有效。
  5682. * `xml`中的数据类型`number`,默认为`1`。
  5683. */
  5684. range: number
  5685. /**
  5686. * 仅在聚光有效。
  5687. * `xml`中的数据类型`number`,默认为`1`。
  5688. */
  5689. innerConeAngle: number
  5690. /**
  5691. * 仅在聚光有效。
  5692. * `xml`中的数据类型`number`,默认为`1`。
  5693. */
  5694. outerConeAngle: number
  5695. /**
  5696. * 是否要产生阴影,仅对平行光有效。
  5697. * `xml`中的数据类型`boolean`,默认为`false`。
  5698. */
  5699. castShadow?: boolean
  5700. /**
  5701. * 产生阴影的最大距离,仅对平行光有效。
  5702. * `xml`中的数据类型`number`,默认为`10`。
  5703. */
  5704. shadowDistance?: number
  5705. /**
  5706. * 阴影采样时的容许偏移,仅对平行光有效。
  5707. * `xml`中的数据类型`number`,默认为`0.002`。
  5708. */
  5709. shadowBias?: number
  5710. }
  5711. /**
  5712. * {@link Light}的`schema`,详见{@link ILightData}。
  5713. */
  5714. export const LightSchema: IComponentSchema
  5715. /**
  5716. * 灯光组件,一般被代理到{@link XRLight}元素。
  5717. *
  5718. * 注意整个场景只能存在一个`ambient`光源,第一个`directional`光源将会成为主光源,也只有这个光源能够产生阴影。
  5719. * 目前最多支持四个追加光源。
  5720. */
  5721. export default class Light extends Component<ILightData> {
  5722. /**
  5723. * 详见{@link LightSchema}。
  5724. */
  5725. readonly schema: IComponentSchema
  5726. readonly priority: number
  5727. get type(): ELightType
  5728. get color(): number[]
  5729. get intensity(): number
  5730. get range(): number
  5731. get innerConeAngle(): number
  5732. get outerConeAngle(): number
  5733. get castShadow(): boolean
  5734. get shadowDistance(): number
  5735. get shadowBias(): number
  5736. /**
  5737. * @internal
  5738. */
  5739. get lightCamera(): import('XrFrame/kanata/lib/index').LightCameraComponent
  5740. /**
  5741. * @internal
  5742. */
  5743. onAdd(parent: Element, data: ILightData): void
  5744. onUpdate(data: ILightData, preData: ILightData): void
  5745. onTick(deltaTime: number, data: ILightData): void
  5746. onRemove(parent: Element, data: ILightData): void
  5747. onRelease(data: ILightData): void
  5748. /**
  5749. * @internal
  5750. */
  5751. }
  5752. }
  5753. declare module 'XrFrame/components/AssetMaterial' {
  5754. import Effect from 'XrFrame/assets/Effect'
  5755. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5756. import Element from 'XrFrame/core/Element'
  5757. import EnvData from 'XrFrame/assets/EnvData'
  5758. /**
  5759. * `AssetMaterial`数据接口。
  5760. */
  5761. export interface IAssetMaterialData {
  5762. /**
  5763. * 被引用时的资源Id。
  5764. * `xml`中的数据类型为`string`。
  5765. */
  5766. assetId: string
  5767. /**
  5768. * 基于的效果。
  5769. * `xml`中的数据类型为`effect`资源,默认为`simple`。
  5770. */
  5771. effect: Effect
  5772. /**
  5773. * 初始要写入的`uniforms`,类型根据`effect`中的定义决定。
  5774. * `xml`中的数据类型为`map`。
  5775. */
  5776. uniforms: Array<[string, string]>
  5777. /**
  5778. * 初始要写入的渲染状态`states`。
  5779. * `xml`中的数据类型为`map`。
  5780. * 目前支持`renderQueue`、`cullOn`、`depthTestOn`、`depthTestWrite`、`alphaMode`、`alphaCutOff`。
  5781. * `alphaMode`和`alphaCutOff`遵循glTF标准。
  5782. */
  5783. states: Array<[string, string]>
  5784. /**
  5785. * 要覆盖的渲染顺序。
  5786. * `xml`中的数据类型为`number`,无默认值。
  5787. * 大于等于`2500`视为透明物体。
  5788. */
  5789. renderQueue: number
  5790. /**
  5791. * 用于覆盖全局的、材质维度的环境数据。
  5792. */
  5793. envData?: EnvData
  5794. }
  5795. /**
  5796. * {@link AssetMaterial}的`schema`,详见{@link IAssetMaterialData}。
  5797. */
  5798. export const AssetMaterialSchema: IComponentSchema
  5799. /**
  5800. * 材质资源创建组件,为了在`xml`中创建{@link Material}资源,一般被代理到{@link XRAssetMaterial}元素。
  5801. */
  5802. export default class AssetMaterial extends Component<IAssetMaterialData> {
  5803. /**
  5804. * 详见{@link AssetMaterialSchema}。
  5805. */
  5806. readonly schema: IComponentSchema
  5807. onAdd(parent: Element, data: IAssetMaterialData): void
  5808. onUpdate(data: IAssetMaterialData, preData: IAssetMaterialData): void
  5809. onRemove(parent: Element, data: IAssetMaterialData): void
  5810. }
  5811. }
  5812. declare module 'XrFrame/components/Mesh' {
  5813. /**
  5814. * Model.ts
  5815. *
  5816. * * @Date : 2022/3/16下午4:48:09
  5817. */
  5818. import Geometry from 'XrFrame/assets/Geometry'
  5819. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5820. import Element from 'XrFrame/core/Element'
  5821. import { Kanata } from 'XrFrame/ext'
  5822. import Material from 'XrFrame/assets/Material'
  5823. import Transform from 'XrFrame/components/Transform'
  5824. import EnvData from 'XrFrame/assets/EnvData'
  5825. /**
  5826. * `Mesh`数据接口。
  5827. */
  5828. export interface IMeshData {
  5829. /**
  5830. * 是否强制不被剔除。
  5831. * `xml`中的数据类型为`boolean`,默认为`false`。
  5832. */
  5833. neverCull?: boolean
  5834. /**
  5835. * 在主光源产生阴影开启阴影时,是否要产生阴影。
  5836. * `xml`中的数据类型为`boolean`,默认为`false`。
  5837. */
  5838. castShadow?: boolean
  5839. /**
  5840. * 在主光源产生阴影开启阴影时,是否要接受阴影。
  5841. * `xml`中的数据类型为`boolean`,默认为`false`。
  5842. */
  5843. receiveShadow?: boolean
  5844. /**
  5845. * 渲染使用的几何数据。
  5846. * `xml`中的数据类型为`geometry`资源。
  5847. */
  5848. geometry: Geometry
  5849. /**
  5850. * 渲染使用的材质数据。
  5851. * `xml`中的数据类型为`material`资源。
  5852. */
  5853. material?: Material
  5854. /**
  5855. * 覆盖`material`中的默认`uniforms`,如果覆盖了,则会先创建一个材质副本。
  5856. * `xml`中同{@link IAssetMaterialData.uniforms}。
  5857. */
  5858. uniforms?: Array<[string, string]>
  5859. /**
  5860. * 覆盖`material`中的默认`states`,如果覆盖了,则会先创建一个材质副本。
  5861. * `xml`中同{@link IAssetMaterialData.states}。
  5862. */
  5863. states?: Array<[string, string]>
  5864. /**
  5865. * 用于覆盖`material`中的,全局的、材质维度的环境数据。
  5866. * * `xml`中同{@link IAssetMaterialData.envData}。
  5867. */
  5868. envData?: EnvData
  5869. }
  5870. /**
  5871. * {@link Mesh}的`schema`,详见{@link IMeshData}。
  5872. */
  5873. export const MeshSchema: IComponentSchema
  5874. /**
  5875. * Mesh组件,整合{@link Geometry}和{@link Material}进行渲染,一般被代理到{@link XRMesh}元素。
  5876. */
  5877. export default class Mesh extends Component<IMeshData> {
  5878. /**
  5879. * 详见{@link MeshSchema}。
  5880. */
  5881. readonly schema: IComponentSchema
  5882. readonly priority: number
  5883. protected _cull: Kanata.CullingComponent
  5884. protected _mesh: Kanata.MeshRendererComponent
  5885. protected _sourceMaterial: Material
  5886. protected _geometry: Geometry
  5887. protected _material: Material
  5888. protected _trs: Transform
  5889. /**
  5890. * 几何数据。
  5891. */
  5892. get geometry(): Geometry
  5893. /**
  5894. * 材质。
  5895. */
  5896. get material(): Material
  5897. set material(value: Material)
  5898. /**
  5899. * MorphTargets的权重,最多32个,可以获取后直接修改。
  5900. */
  5901. get morphWeights(): Float32Array
  5902. /**
  5903. * @internal
  5904. */
  5905. get id(): number
  5906. /**
  5907. * @internal
  5908. */
  5909. onAdd(parent: Element, data: IMeshData): void
  5910. onTick(deltaTime: number, data: IMeshData): void
  5911. onUpdate(data: IMeshData, preData: IMeshData): void
  5912. onRemove(parent: Element, data: IMeshData): void
  5913. onRelease(data: IMeshData): void
  5914. /**
  5915. * @internal
  5916. */
  5917. protected _getMarcos(geometry: Geometry): {}
  5918. /**
  5919. * @internal
  5920. */
  5921. protected _getUniformDesc(): Kanata.UniformDescriptor
  5922. /**
  5923. * @internal
  5924. */
  5925. protected _getMeshType(): Kanata.EMeshRenderType
  5926. }
  5927. }
  5928. declare module 'XrFrame/components/text/Text' {
  5929. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  5930. import Element from 'XrFrame/core/Element'
  5931. import { Kanata } from 'XrFrame/ext'
  5932. import Material from 'XrFrame/assets/Material'
  5933. import Transform from 'XrFrame/components/Transform'
  5934. import {
  5935. IRenderData,
  5936. EHorzAlignment,
  5937. EVertAlignment
  5938. } from 'XrFrame/components/text/types'
  5939. import { IGlyph } from 'XrFrame/glyph'
  5940. import { Typesetting } from 'XrFrame/components/text/typesetting'
  5941. import { FillRenderData } from 'XrFrame/components/text/fillRenderData'
  5942. /**
  5943. * `Text`数据接口。
  5944. */
  5945. export interface ITextData {
  5946. /**
  5947. * 文本内容
  5948. * `xml`中的数据类型为`string`
  5949. */
  5950. value?: string
  5951. /**
  5952. * 文本大小
  5953. * `xml`中的数据类型为`number`
  5954. */
  5955. size?: number
  5956. /**
  5957. * 文本颜色
  5958. * `xml`中的数据类型为`number-array`,默认为`0 0 0 1`。
  5959. */
  5960. color?: number[]
  5961. /**
  5962. * 文本轴点
  5963. * `xml`中的数据类型为`number-array`,默认为`0 1`。
  5964. */
  5965. anchor?: number[]
  5966. /**
  5967. * 文本框宽度
  5968. * `xml`中的数据类型为`number`
  5969. */
  5970. width?: number
  5971. /**
  5972. * 文本框高度
  5973. * `xml`中的数据类型为`number`
  5974. */
  5975. height?: number
  5976. /**
  5977. * 文本框行高,为比例
  5978. * `xml`中的数据类型为`number`
  5979. */
  5980. lineHeight?: number
  5981. /**
  5982. * 文本内边距
  5983. * `xml`中的数据类型为`number-array`,默认为`0 0 0`。
  5984. */
  5985. padding?: number[]
  5986. /**
  5987. * 文本水平定位
  5988. * `xml`中的数据类型为`string`,默认为`left`。
  5989. */
  5990. horzAlign?: string
  5991. /**
  5992. * 文本垂直定位
  5993. * `xml`中的数据类型为`string`,默认为`top`。
  5994. */
  5995. vertAlign?: string
  5996. /**
  5997. * 是否不参与剔除,默认false(即参与剔除)。
  5998. */
  5999. neverCull?: boolean
  6000. /**
  6001. * 覆盖`material`中的默认`uniforms`,如果覆盖了,则会先创建一个材质副本。
  6002. * `xml`中同{@link IMaterialData.uniforms}。
  6003. */
  6004. uniforms?: Array<[string, string]>
  6005. /**
  6006. * 覆盖`material`中的默认`states`,如果覆盖了,则会先创建一个材质副本。
  6007. * `xml`中同{@link IMaterialData.states}。
  6008. */
  6009. states?: Array<[string, string]>
  6010. }
  6011. export const TextSchema: IComponentSchema
  6012. export const textAttributes: Array<{
  6013. name: string
  6014. format: number
  6015. offset: number
  6016. usage: number
  6017. }>
  6018. export const textStride = 32
  6019. export const textVertexSize = 8
  6020. export default class Text extends Component<ITextData> {
  6021. readonly schema: IComponentSchema
  6022. readonly priority: number
  6023. protected _cull: Kanata.CullingComponent
  6024. protected _mesh: Kanata.MeshRendererComponent
  6025. protected _sourceMaterial: Material
  6026. protected _material: Material
  6027. protected _trs: Transform
  6028. protected _value: string
  6029. protected _size: number
  6030. protected _color: number[]
  6031. protected _anchor: number[]
  6032. protected _width: number | undefined
  6033. protected _height: number | undefined
  6034. protected _lineHeight: number
  6035. protected _padding: number[]
  6036. protected _horzAlign: EHorzAlignment
  6037. protected _vertAlign: EVertAlignment
  6038. protected _glyphs: IGlyph[]
  6039. protected _renderDatas: IRenderData[]
  6040. static QueryGlyphs: (
  6041. scene: import('XrFrame/core/Scene').default,
  6042. characters: string,
  6043. italic: boolean,
  6044. bold: boolean,
  6045. fontSize: number,
  6046. fontFamily: string
  6047. ) => IGlyph[]
  6048. static Typesetting: typeof Typesetting
  6049. static FillRenderData: typeof FillRenderData
  6050. get id(): number
  6051. onAdd(parent: Element, data: ITextData): void
  6052. onTick(deltaTime: number, data: ITextData): void
  6053. onUpdate(data: ITextData, preData: ITextData): void
  6054. onRemove(parent: Element, data: ITextData): void
  6055. onRelease(data: ITextData): void
  6056. protected _getUniformDesc(): Kanata.UniformDescriptor
  6057. protected _getMeshType(): Kanata.EMeshRenderType
  6058. protected _getVertexLayout(): Kanata.VertexLayout
  6059. }
  6060. }
  6061. declare module 'XrFrame/components/particle/Particle' {
  6062. import Element from 'XrFrame/core/Element'
  6063. import Material from 'XrFrame/assets/Material'
  6064. import BasicParticle, {
  6065. IParticleData
  6066. } from 'XrFrame/components/particle/BasicParticle'
  6067. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance'
  6068. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  6069. export default class Particle extends BasicParticle {
  6070. static EVENTS: string[]
  6071. readonly priority: number
  6072. subEmitters: any
  6073. get material(): Material
  6074. set material(value: Material)
  6075. get id(): number
  6076. get data(): IParticleData
  6077. set data(value: IParticleData)
  6078. get particleEmitter(): BasicShapeEmitter
  6079. /**
  6080. * 粒子系统开始播放。
  6081. *
  6082. * @param delay 设定粒子延时几秒后再播放。
  6083. */
  6084. start(delay?: number): void
  6085. /**
  6086. * 停止粒子系统与其子发射器的播放。
  6087. */
  6088. stop(): void
  6089. /**
  6090. * @internal
  6091. */
  6092. onAdd(parent: Element, data: IParticleData): void
  6093. /**
  6094. * 设置粒子系统的内置粒子effect。
  6095. */
  6096. protected createMaterial(): Material
  6097. /**
  6098. * 初始化粒子系统的状态。
  6099. */
  6100. initParticle(data: IParticleData): void
  6101. /**
  6102. * 重置粒子系统的状态。
  6103. */
  6104. resetParticle(): void
  6105. /**
  6106. * @internal
  6107. */
  6108. protected _prepareSubEmitterArray(): void
  6109. /**
  6110. * 停止所有粒子子系统的发射状态。
  6111. */
  6112. protected stopSubEmitters(): void
  6113. /**
  6114. * 粒子子发射系统从依附的粒子系统中剥离。
  6115. */
  6116. protected removeFromRoot(): void
  6117. /**
  6118. * @internal
  6119. */
  6120. onTick(deltaTime: number, data: IParticleData): void
  6121. /**
  6122. * @internal
  6123. */
  6124. onUpdate(data: IParticleData, preData: IParticleData): void
  6125. /**
  6126. * @internal
  6127. */
  6128. onRemove(parent: Element, data: IParticleData): void
  6129. /**
  6130. * @internal
  6131. */
  6132. onRelease(data: IParticleData): void
  6133. /**
  6134. * @internal
  6135. */
  6136. protected _updateRenderData(
  6137. deltaTime: number,
  6138. isPreWarm?: boolean
  6139. ): void
  6140. /**
  6141. * 创建一个粒子实例。
  6142. */
  6143. protected createParticle(): ParticleInstance
  6144. /**
  6145. * 启动处于END状态的粒子子发射器。
  6146. * @param {ParticleInstance} instance 粒子实例
  6147. */
  6148. protected particleSubEmitter(instance: ParticleInstance): void
  6149. /**
  6150. * 回收当前粒子实例,并放入储备粒子队列。
  6151. * @param {ParticleInstance} particle 粒子实例
  6152. */
  6153. protected recycleParticle(particle: ParticleInstance): void
  6154. /**
  6155. * 更新每一个粒子的状态。
  6156. * @param {number} instancesSum 新生成的粒子数
  6157. */
  6158. protected update(instancesSum: number): void
  6159. /**
  6160. * 初始化粒子实例。
  6161. * @param {ParticleInstance} instance 需要初始化的粒子实例
  6162. */
  6163. protected initInstanceProperty(instance: ParticleInstance): void
  6164. /**
  6165. * 更新运动过程中粒子实例的各项属性以及子发射器状态。
  6166. * @param {Array} instances 粒子实例数组
  6167. */
  6168. protected updateInstanceProperty(instances: any): void
  6169. /**
  6170. * 更新粒子实例的各项属性。
  6171. * @param {ParticleInstance} instance 待更新的粒子实例
  6172. */
  6173. protected processInstance(instance: ParticleInstance): void
  6174. }
  6175. }
  6176. declare module 'XrFrame/components/particle/BasicParticle' {
  6177. import Material from 'XrFrame/assets/Material'
  6178. import Component from 'XrFrame/core/Component'
  6179. import { IComponentSchema } from 'XrFrame/core/Component'
  6180. import {
  6181. BoxShapeEmitter,
  6182. PointShapeEmitter,
  6183. SphereShapeEmitter
  6184. } from 'XrFrame/components/emitter'
  6185. import { Kanata } from 'XrFrame/ext'
  6186. import Transform from 'XrFrame/components/Transform'
  6187. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  6188. import Vector3 from 'XrFrame/math/vector3'
  6189. import Particle from 'XrFrame/components/particle/Particle'
  6190. import { Scene } from 'XrFrame/elements'
  6191. import { SubEmitter } from 'XrFrame/components/emitter/SubEmitter'
  6192. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance'
  6193. import Atlas from 'XrFrame/assets/Atlas'
  6194. import Vector4 from 'XrFrame/math/vector4'
  6195. import Geometry from 'XrFrame/assets/Geometry'
  6196. /**
  6197. * {@link Particle}组件数据接口。
  6198. */
  6199. export interface IParticleData {
  6200. neverCull?: boolean
  6201. /**
  6202. * 渲染模式。
  6203. */
  6204. renderMode?: string
  6205. uniforms?: Array<[string, string]>
  6206. states?: Array<[string, string]>
  6207. /**
  6208. * 纹理信息。
  6209. */
  6210. texture?: Kanata.Texture
  6211. /**
  6212. * 最大粒子数目。
  6213. */
  6214. capacity?: number
  6215. /**
  6216. * 每秒粒子发射数。
  6217. */
  6218. emitRate?: number
  6219. /**
  6220. * 初始角度。
  6221. */
  6222. angle?: number[]
  6223. /**
  6224. * 粒子系统启动延时秒数。
  6225. */
  6226. delay?: number
  6227. /**
  6228. * y轴方向上的每秒位移。
  6229. */
  6230. gravity?: number
  6231. /**
  6232. * 初始大小。
  6233. */
  6234. size?: number[]
  6235. /**
  6236. * 粒子在x轴方向上的大小尺度。
  6237. */
  6238. scaleX?: number[]
  6239. /**
  6240. * 粒子在y轴方向上的大小尺度。
  6241. */
  6242. scaleY?: number[]
  6243. /**
  6244. * 速度。
  6245. */
  6246. speed?: number[]
  6247. /**
  6248. * 生命周期时长。
  6249. */
  6250. lifeTime?: number[]
  6251. /**
  6252. * 粒子初始颜色左区间。
  6253. */
  6254. startColor?: number[]
  6255. /**
  6256. * 粒子初始颜色右区间。
  6257. */
  6258. startColor2?: number[]
  6259. /**
  6260. * 粒子结束时颜色。
  6261. */
  6262. endColor?: number[]
  6263. /**
  6264. * 角速度。
  6265. */
  6266. angularSpeed?: number[]
  6267. /**
  6268. * 发射器类型。
  6269. */
  6270. emitterType?: string
  6271. /**
  6272. * 发射器属性配置。
  6273. */
  6274. emitterProps?: Array<[string, string]>
  6275. /**
  6276. * 粒子系统生命周期时长。
  6277. */
  6278. stopDuration?: number
  6279. /**
  6280. * 粒子预渲染周期数。
  6281. */
  6282. prewarmCycles?: number
  6283. /**
  6284. * 速度阻尼系数。
  6285. */
  6286. speedDampen?: number
  6287. /**
  6288. * 动画图集信息。
  6289. */
  6290. atlas?: Atlas
  6291. /**
  6292. * 图集切换速度。
  6293. */
  6294. atlasSpeed?: number
  6295. /**
  6296. * 是否随机播放图集。
  6297. */
  6298. atlasRandom?: boolean
  6299. /**
  6300. * 是否循环播放图集。
  6301. */
  6302. atlasLoop?: boolean
  6303. /**
  6304. * 指定图集帧名。
  6305. */
  6306. atlasFrames?: string[]
  6307. /**
  6308. * 网格信息。
  6309. */
  6310. mesh?: Geometry
  6311. sizeChange?: Array<[string, string]>
  6312. colorChange?: Array<[string, string]>
  6313. speedChange?: Array<[string, string]>
  6314. burstCount?: number
  6315. burstTime?: number
  6316. burstCycle?: number
  6317. burstInterval?: number
  6318. }
  6319. /**
  6320. * {@link Particle}的`schema`定义。
  6321. * @see 解析后的接口详见 {@link IParticleData}
  6322. */
  6323. export const ParticleSchema: IComponentSchema
  6324. /**
  6325. * BillBoard渲染模式。
  6326. */
  6327. export const enum BillBoardMode {
  6328. BILLBOARDMODE_DEFAULT = 0,
  6329. BILLBOARDMODE_Y = 1,
  6330. BILLBOARDMODE_STRETCHED = 2
  6331. }
  6332. export default class BasicParticle extends Component<IParticleData> {
  6333. /**
  6334. * 详见{@link ParticleSchema}。
  6335. */
  6336. readonly schema: IComponentSchema
  6337. protected static count: number
  6338. protected _systemId: number
  6339. protected _data: IParticleData
  6340. protected particleScene: Scene
  6341. protected particleEl: any
  6342. protected _instances: ParticleInstance[]
  6343. protected _stockInstances: ParticleInstance[]
  6344. protected _capacity: number
  6345. protected _delay: number
  6346. protected _updateSpeed: number
  6347. protected _stopDuration: number
  6348. protected _emitRate: number
  6349. protected _gravity: number
  6350. protected _preWarmCycles: number
  6351. protected _preWarmStepOffset: number
  6352. protected _particleEmitterType: string
  6353. protected _particleEmitter: BasicShapeEmitter
  6354. protected _particleEmitterProperties: any
  6355. protected particleStride: number
  6356. protected particleVertexSize: number
  6357. protected byteStride: number
  6358. protected ParticleAttributes: any
  6359. protected _burstCount: number
  6360. protected _burstTime: number
  6361. protected _burstCycle: number
  6362. protected _burstInterval: number
  6363. protected _burstCountTime: number
  6364. protected _burstCountCycle: number
  6365. protected _burstCountInterval: number
  6366. protected _minLifeTime: number
  6367. protected _maxLifeTime: number
  6368. protected _minScaleX: number
  6369. protected _maxScaleX: number
  6370. protected _minScaleY: number
  6371. protected _maxScaleY: number
  6372. protected _minSize: number
  6373. protected _maxSize: number
  6374. protected _minSpeed: number
  6375. protected _maxSpeed: number
  6376. protected _particleLengthScale: number
  6377. protected _startColor: number[]
  6378. protected _startColor2: number[]
  6379. protected _endColor: number[]
  6380. protected _sizeGradients: any
  6381. protected _alphaGradients: any
  6382. protected _colorRemapGradients: any
  6383. protected _speedScaleGradients: any
  6384. protected _limitSpeedGradients: any
  6385. protected _speedDampenFactor: number
  6386. protected _dragGradients: any
  6387. protected _useSpriteSheet: boolean
  6388. protected _startSpriteCellIndex: number
  6389. protected _endSpriteCellIndex: number
  6390. protected _useRandomSpriteCellIndex: boolean
  6391. protected _useSpriteCellLoop: boolean
  6392. protected _spriteChangeSpeed: number
  6393. protected _spriteFrameInfo: Vector4[]
  6394. protected _spriteNameToCellIndex: Map<string, number>
  6395. protected _textureData: Kanata.Texture
  6396. protected _atlasObj: Atlas
  6397. protected _atlasTexture: Kanata.Texture
  6398. protected _cull: Kanata.CullingComponent
  6399. protected _mesh: Kanata.MeshRendererComponent
  6400. protected _sourceMaterial: Material
  6401. protected _material: Material
  6402. protected _trs: Transform
  6403. protected _vertexBuffer: Kanata.VertexBuffer
  6404. protected _indexBuffer: Kanata.IndexBuffer
  6405. protected _renderMesh: Geometry
  6406. protected _vertexCount: number
  6407. protected _vertexData: Float32Array
  6408. protected _eachIndexSize: number
  6409. protected _indexSize: number
  6410. protected _vertexSize: number
  6411. protected _useBillboard: boolean
  6412. protected _useRenderMesh: boolean
  6413. protected _billboardMode: number
  6414. protected _useRampGradients: boolean
  6415. protected _rampGradients: any
  6416. protected _rampGradientsTexture: Kanata.Texture
  6417. protected _colorGradients: any
  6418. protected _vertexLayoutDirty: boolean
  6419. protected _startAngle: number
  6420. protected _startAngle2: number
  6421. protected _minAngularSpeed: number
  6422. protected _maxAngularSpeed: number
  6423. protected _subEmitters: any[]
  6424. protected _emitterPosition: Vector3
  6425. get material(): Material
  6426. /**
  6427. * @internal
  6428. */
  6429. get useBillboard(): boolean
  6430. set useBillboard(value: boolean)
  6431. get useRampGradients(): boolean
  6432. set useRampGradients(value: boolean)
  6433. get billboardMode(): number
  6434. set billboardMode(value: number)
  6435. get useSpriteSheet(): boolean
  6436. set useSpriteSheet(value: boolean)
  6437. get useRandomSpriteCellIndex(): boolean
  6438. get useSpriteCellLoop(): boolean
  6439. get spriteChangeSpeed(): number
  6440. get emitterPosition(): Vector3
  6441. set emitterPosition(value: Vector3)
  6442. /**
  6443. * @internal
  6444. */
  6445. protected _parseAttribute(): void
  6446. /**
  6447. * 获取一个拷贝的粒子系统。
  6448. */
  6449. clone(): Particle
  6450. /**
  6451. * 获取一个粒子子发射器。
  6452. */
  6453. createSubEmitter(data: IParticleData): SubEmitter
  6454. /**
  6455. * 创建一个点发射器。
  6456. * @param {Vector3} direction1 粒子运动方向左区间
  6457. * @param {Vector3} direction2 粒子运动方向右区间
  6458. * @return {PointShapeEmitter} 点发射器
  6459. */
  6460. createPointEmitter(
  6461. direction1: Vector3,
  6462. direction2: Vector3
  6463. ): PointShapeEmitter
  6464. /**
  6465. * 创建一个箱形发射器。
  6466. * @param {Vector3} direction1 粒子运动方向左区间
  6467. * @param {Vector3} direction2 粒子运动方向右区间
  6468. * @param {Vector3} minEmitBox 粒子生成位置最小允许坐标
  6469. * @param {Vector3} maxEmitBox 粒子生成位置最大允许坐标
  6470. * @return {BoxShapeEmitter} 箱形发射器
  6471. */
  6472. createBoxEmitter(
  6473. direction1: Vector3,
  6474. direction2: Vector3,
  6475. minEmitBox: Vector3,
  6476. maxEmitBox: Vector3
  6477. ): BoxShapeEmitter
  6478. /**
  6479. * 创建一个球形发射器。
  6480. * @param {number} radius 球形半径
  6481. * @param {number} radiusRange 球形区域内的覆盖范围[0-1]
  6482. * @param {number} arc 粒子在球形内生成的角度区间[0-360]
  6483. * @param {number} randomizeDirection 粒子运动方向偏离程度[0-1]
  6484. * @return {SphereShapeEmitter} 球形发射器
  6485. */
  6486. createSphereEmitter(
  6487. radius: number,
  6488. radiusRange: number,
  6489. arc: number,
  6490. randomizeDirection: number
  6491. ): SphereShapeEmitter
  6492. protected _parseProperties(data: IParticleData): void
  6493. protected _chooseEmitterProcess(): void
  6494. protected _createVertexBuffers(): void
  6495. protected _createIndexBuffer(): void
  6496. protected _appendParticleVertices(
  6497. offset: any,
  6498. instance?: ParticleInstance
  6499. ): void
  6500. protected _appendParticleVertex(
  6501. index: any,
  6502. instance: ParticleInstance,
  6503. offsetX: any,
  6504. offsetY: any,
  6505. offsetZ: any,
  6506. u: any,
  6507. v: any
  6508. ): void
  6509. protected _rebuildMesh(neverCull: boolean): void
  6510. protected _getUniformDesc(): Kanata.UniformDescriptor
  6511. protected _getMeshType(): Kanata.EMeshRenderType
  6512. protected _getVertexLayout(
  6513. attributes: any,
  6514. stride: any
  6515. ): Kanata.VertexLayout
  6516. protected _setMeshData(
  6517. material: Material,
  6518. uniforms?: Array<[string, string]>,
  6519. states?: Array<[string, string]>
  6520. ): void
  6521. /**
  6522. * 添加粒子运动过程中的颜色变化规则。
  6523. * @param {number} gradient 指定所处粒子生命周期的阶段
  6524. * @param {Vector4} color1 指定粒子颜色的左区间
  6525. * @param {Vector4} color2 指定粒子颜色的右区间
  6526. */
  6527. addColorGradient(
  6528. gradient: number,
  6529. color1: Vector4,
  6530. color2?: Vector4
  6531. ): void
  6532. /**
  6533. * 添加粒子运动过程中的速度变化规则。
  6534. * @param {number} gradient 指定所处粒子生命周期的阶段
  6535. * @param {Vector4} speed 指定粒子速度的左区间
  6536. * @param {Vector4} speed2 指定粒子速度的右区间
  6537. */
  6538. addSpeedScaleGradient(
  6539. gradient: number,
  6540. speed: number,
  6541. speed2?: number
  6542. ): void
  6543. /**
  6544. * 添加粒子运动过程中的速度限制规则。
  6545. * @param {number} gradient 指定所处粒子生命周期的阶段
  6546. * @param {number} limitSpeed 指定粒子限制速度的左区间
  6547. * @param {number} limitSpeed2 指定粒子限制速度的右区间
  6548. */
  6549. addLimitSpeedGradient(
  6550. gradient: number,
  6551. limitSpeed: number,
  6552. limitSpeed2?: number
  6553. ): void
  6554. /**
  6555. * 添加粒子运动过程中的阻力规则。
  6556. * @param {number} gradient 指定所处粒子生命周期的阶段
  6557. * @param {number} speed 指定粒子受到的阻力大小的左区间[0-1]
  6558. * @param {number} speed2 指定粒子受到的阻力大小的右区间[0-1]
  6559. */
  6560. addDragGradient(gradient: number, drag: number, drag2?: number): void
  6561. /**
  6562. * 添加粒子运动过程中的透明度变化规则。
  6563. * @param {number} gradient 指定所处粒子生命周期的阶段
  6564. * @param {number} alpha 指定粒子颜色透明度的左区间[0-1]
  6565. * @param {number} alpha2 指定粒子颜色透明度的右区间[0-1]
  6566. */
  6567. addAlphaGradient(gradient: number, alpha: number, alpha2?: number): void
  6568. /**
  6569. * 添加粒子运动过程中的尺寸变化规则。
  6570. * @param {number} gradient 指定所处粒子生命周期的阶段
  6571. * @param {number} size 指定粒子尺寸的左区间
  6572. * @param {number} size2 指定粒子尺寸的右区间
  6573. */
  6574. addSizeGradient(gradient: number, size: number, size2?: number): void
  6575. /**
  6576. * 添加粒子运动过程中的透明度变化范围。
  6577. * @param {number} gradient 指定所处粒子生命周期的阶段
  6578. * @param {number} min 指定粒子透明度值的左区间
  6579. * @param {number} max 指定粒子透明度值的右区间
  6580. */
  6581. addColorRemapGradient(gradient: number, min: number, max?: number): void
  6582. /**
  6583. * 将存储不同时间段相关属性系数的数组按时间点从小到大进行排序。
  6584. * @param {Array} factorGradients 存储不同时间段相关属性系数的数组
  6585. * @param {number} gradient 一般代表粒子所处生命周期的阶段
  6586. * @param {number} factor 左区间值
  6587. * @param {number} factor2 右区间值
  6588. */
  6589. protected addFactorGradient(
  6590. factorGradients: any,
  6591. gradient: any,
  6592. factor: any,
  6593. factor2: any
  6594. ): void
  6595. /**
  6596. * 添加粒子运动过程中的根据透明度影响的颜色变化规则,将通过颜色变化图纹理进行采样。
  6597. * @param {number} gradient 指定粒子颜色变化图的具体位置,对应具体值应为(1-alpha)
  6598. * @param {number} color 指定该位置的颜色
  6599. */
  6600. addRampGradient(gradient: any, color: any): void
  6601. /**
  6602. * 根据颜色变化数组,生成对应的颜色变化纹理
  6603. */
  6604. protected createRampGradientTexture(): void
  6605. /**
  6606. * @internal
  6607. */
  6608. protected lerpNumberArrayToVector(
  6609. vector: any,
  6610. numberArray1: any,
  6611. numberArray2: any,
  6612. step: any,
  6613. length?: number
  6614. ): void
  6615. }
  6616. }
  6617. declare module 'XrFrame/components/AssetRenderTexture' {
  6618. /**
  6619. * AssetRenderTexture.ts
  6620. *
  6621. * * @Date : 8/29/2022, 11:27:00 AM
  6622. */
  6623. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  6624. import Element from 'XrFrame/core/Element'
  6625. /**
  6626. * `AssetRenderTexture`资源数据接口。
  6627. */
  6628. export interface IAssetRenderTextureData {
  6629. assetId?: string
  6630. width: number
  6631. height: number
  6632. isHDR?: boolean
  6633. }
  6634. /**
  6635. * {@link AssetRenderTexture}的`schema`,详见{@link IAssetRenderTextureData}。
  6636. */
  6637. export const AssetRenderTextureSchema: IComponentSchema
  6638. /**
  6639. * 渲染纹理创建组件,用于在`xml`中创建{@link RenderTexture}资源,一般被代理到{@link XRAssetRenderTexture}元素。
  6640. */
  6641. export default class AssetRenderTexture extends Component<IAssetRenderTextureData> {
  6642. /**
  6643. * 详见{@link AssetRenderTextureSchema}。
  6644. */
  6645. readonly schema: IComponentSchema
  6646. readonly isAssetRenderTexture: boolean
  6647. onAdd(parent: Element, data: IAssetRenderTextureData): void
  6648. /**
  6649. * 移除AssetRenderTexture。
  6650. */
  6651. onRemove(parent: Element, data: IAssetRenderTextureData): void
  6652. }
  6653. }
  6654. declare module 'XrFrame/components/Env' {
  6655. /**
  6656. * Env.ts
  6657. *
  6658. * * @Date : 5/11/2022, 5:21:48 PM
  6659. */
  6660. import { Kanata } from 'XrFrame/ext'
  6661. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  6662. import EnvData from 'XrFrame/assets/EnvData'
  6663. import Element from 'XrFrame/core/Element'
  6664. import { ITextureWrapper } from 'XrFrame/core/DataValue'
  6665. /**
  6666. * {@link Env}组件数据接口。
  6667. */
  6668. export interface IEnvData {
  6669. /**
  6670. * 要使用的环境数据资源。
  6671. * `xml`中的数据类型为`env-data`资源。
  6672. */
  6673. envData?: EnvData
  6674. /**
  6675. * 可以用于覆盖`envData`中的`skybox`。
  6676. * `xml`中的数据类型为`texture`资源。
  6677. */
  6678. skyMap?: Kanata.Texture | ITextureWrapper
  6679. /**
  6680. * 是否用2D模式渲染天空盒,此时必须为`skyMap`必须**不**为`CubeTexture`。
  6681. */
  6682. isSky2D?: boolean
  6683. /**
  6684. * 环境旋转角度。
  6685. * `xml`中的数据类型为`number`,默认为`0`。
  6686. */
  6687. rotation: number
  6688. /**
  6689. * 漫反射部分曝光。
  6690. * `xml`中的数据类型为`number`,默认为`1`。
  6691. */
  6692. diffuseExp: number
  6693. /**
  6694. * 镜面反射部分曝光。
  6695. * `xml`中的数据类型为`number`,默认为`1`。
  6696. */
  6697. specularExp: number
  6698. }
  6699. /**
  6700. * {@link Env}的`schema`,详见{@link IEnvData}。
  6701. */
  6702. export const EnvSchema: IComponentSchema
  6703. /**
  6704. * 一般被代理到{@link XRARTracker}元素。
  6705. */
  6706. export default class Env extends Component<IEnvData> {
  6707. /**
  6708. * 详见{@link EnvSchema}。
  6709. */
  6710. readonly schema: IComponentSchema
  6711. get useHalfSkyMap(): boolean
  6712. get skyMap(): import('XrFrame/kanata/lib/index').Texture
  6713. get isSky2D(): boolean
  6714. get isSkyRT(): boolean
  6715. get rotation(): number
  6716. get hasDiffuse(): boolean
  6717. get diffuseSH(): Float32Array
  6718. get diffuseExp(): number
  6719. get hasSpecular(): boolean
  6720. get specularRGBD(): boolean
  6721. get specularMipmaps(): boolean
  6722. get specularMipmapCount(): number
  6723. get specularMap(): import('XrFrame/kanata/lib/index').Texture
  6724. get specularExp(): number
  6725. onAdd(parent: Element, data: IEnvData): void
  6726. onUpdate(data: IEnvData, preData: IEnvData): void
  6727. onRemove(parent: Element, data: IEnvData): void
  6728. }
  6729. }
  6730. declare module 'XrFrame/components/Animator' {
  6731. /**
  6732. * Animator.ts
  6733. *
  6734. * * @Date : 6/17/2022, 2:52:44 PM
  6735. */
  6736. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  6737. import Animation from 'XrFrame/animation/Animation'
  6738. import Element from 'XrFrame/core/Element'
  6739. type Scene = import('XrFrame/core/Scene').default
  6740. /**
  6741. * 使用`Animator`播放动画时可以传入的默认选项。
  6742. */
  6743. export interface IAnimationPlayOptions {
  6744. /**
  6745. * 播放速度,默认为`1`。
  6746. */
  6747. speed?: number
  6748. /**
  6749. * 循环次数,默认为`0`。
  6750. */
  6751. loop?: number
  6752. /**
  6753. * 播放延迟,默认为`0`。
  6754. */
  6755. delay?: number
  6756. /**
  6757. * 播放方向,默认为`forwards`。
  6758. */
  6759. direction?: 'forwards' | 'backwards' | 'both'
  6760. }
  6761. export enum EAnimationPlayState {
  6762. Playing = 0,
  6763. Paused = 1,
  6764. Stopt = 2
  6765. }
  6766. /**
  6767. * 自动播放配置。
  6768. */
  6769. export interface IAnimatorAutoPlay {
  6770. /**
  6771. * 片段名称。
  6772. */
  6773. clip?: string
  6774. /**
  6775. * 速度。
  6776. */
  6777. speed?: string
  6778. /**
  6779. * 循环次数。
  6780. */
  6781. loop?: string
  6782. /**
  6783. * 延迟。
  6784. */
  6785. delay?: string
  6786. /**
  6787. * 方向。
  6788. */
  6789. direction?: 'forwards' | 'backwards' | 'both'
  6790. /**
  6791. * 其他追加配置。
  6792. */
  6793. [key: string]: string | undefined
  6794. }
  6795. /**
  6796. * {@link Animator}组件数据接口。
  6797. */
  6798. export interface IAnimatorData {
  6799. /**
  6800. * 默认的`Keyframe`动画资源。
  6801. * `xml`中为资源id。
  6802. */
  6803. keyframe: Animation
  6804. /**
  6805. * 默认的片段名字映射,由于一个动画可以有多个片段,所以能通过映射由`Animator`中播放的名字 -> 动画资源中片段的名字。
  6806. * `xml`中为`dict`数据。
  6807. */
  6808. clipMap?: {
  6809. [key: string]: string
  6810. }
  6811. /**
  6812. * 默认自动播放的参数,详见{@Link IAnimatorAutoPlay}。
  6813. * `xml`中为`dict`数据。
  6814. */
  6815. autoPlay?: IAnimatorAutoPlay
  6816. }
  6817. /**
  6818. * {@link Animator}的`schema`定义。
  6819. * @see 解析后的接口详见 {@link IAnimatorData}
  6820. */
  6821. export const AnimatorSchema: {
  6822. keyframe: {
  6823. type: string
  6824. }
  6825. clipMap: {
  6826. type: string
  6827. }
  6828. autoPlay: {
  6829. type: string
  6830. }
  6831. }
  6832. export default class Animator extends Component<IAnimatorData> {
  6833. static EVENTS: string[]
  6834. /**
  6835. * 详见{@link AnimatorSchema}。
  6836. */
  6837. readonly schema: IComponentSchema
  6838. readonly priority: number
  6839. onAdd(parent: Element, data: IAnimatorData): void
  6840. onUpdate(data: IAnimatorData, preData: IAnimatorData): void
  6841. onRemove(parent: Element, data: IAnimatorData): void
  6842. onRelease(data: IAnimatorData): void
  6843. /**
  6844. * 手动添加一个动画。
  6845. *
  6846. * @param clipMap 可选的动画片段名字映射。
  6847. */
  6848. addAnimation<T extends Animation>(
  6849. anim: T,
  6850. clipMap?: {
  6851. [name: string]: string
  6852. }
  6853. ): T
  6854. /**
  6855. * 直接通过类`clz`和初始化数据`data`创建一个动画并添加到自身内。
  6856. */
  6857. createAnimation<T extends Animation>(
  6858. clz: new (scene: Scene, data: T['__DATA_TYPE']) => T,
  6859. data: T['__DATA_TYPE'],
  6860. clipMap?: {
  6861. [name: string]: string
  6862. }
  6863. ): T
  6864. /**
  6865. * 移除一个动画
  6866. */
  6867. removeAnimation(anim: Animation): void
  6868. /**
  6869. * @internal
  6870. */
  6871. /**
  6872. * 播放一个动画片段,**可以同时播放多个片段**。
  6873. *
  6874. * @param name 动画片段名称。
  6875. * @param options 播放选项。
  6876. */
  6877. play(
  6878. name: string,
  6879. options?: IAnimationPlayOptions & {
  6880. [key: string]: any
  6881. }
  6882. ): void
  6883. /**
  6884. * 播放动画片段到某一进度并停下。
  6885. *
  6886. * @param name 片段名称。
  6887. * @param progress 停到的某个进度,0~1。
  6888. */
  6889. pauseToFrame(name: string, progress: number): void
  6890. /**
  6891. * 暂停播放。
  6892. *
  6893. * @param name 需要暂停的片段,如果不填则暂停所有正在播放的片段。
  6894. */
  6895. pause(name?: string): void
  6896. /**
  6897. * 唤醒暂停的动画。
  6898. *
  6899. * @param name 需要唤醒的片段,如果不填则唤醒所有暂停的片段。
  6900. */
  6901. resume(name?: string): void
  6902. /**
  6903. * 停止播放。
  6904. *
  6905. * @param name 需要停止的片段,如果不填则停止所有正在播放的片段。
  6906. */
  6907. stop(name?: string): void
  6908. }
  6909. export {}
  6910. }
  6911. declare module 'XrFrame/components/CameraOrbitControl' {
  6912. /**
  6913. * CameraOrbitControl.ts
  6914. *
  6915. * * @Date : 5/19/2022, 1:22:59 PM
  6916. */
  6917. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  6918. import Element from 'XrFrame/core/Element'
  6919. import Vector3 from 'XrFrame/math/vector3'
  6920. /**
  6921. * {@link CameraOrbitControl}组件数据接口。
  6922. */
  6923. export interface ICameraOrbitControlData {
  6924. /**
  6925. * 是否锁定横向旋转。
  6926. */
  6927. isLockX: boolean
  6928. /**
  6929. * 是否锁定纵向旋转。
  6930. */
  6931. isLockY: boolean
  6932. /**
  6933. * 是否锁定缩放。
  6934. */
  6935. isLockZoom: boolean
  6936. /**
  6937. * 是否锁定旋转。
  6938. */
  6939. isLockRotate: boolean
  6940. /**
  6941. * 是否锁定移动。
  6942. */
  6943. isLockMove: boolean
  6944. /**
  6945. * 允许的最大缩放值。
  6946. */
  6947. zoomMax: number
  6948. /**
  6949. * 允许的最小缩放值。
  6950. */
  6951. zoomMin: number
  6952. /**
  6953. * 平移速度。
  6954. */
  6955. panSpeed: number
  6956. /**
  6957. * 旋转速度。
  6958. */
  6959. rotateSpeed: number
  6960. /**
  6961. * 缩放速度。
  6962. */
  6963. zoomSpeed: number
  6964. /**
  6965. * 开启阻尼缓动。
  6966. */
  6967. enableDamping: boolean
  6968. /**
  6969. * 阻尼系数。
  6970. */
  6971. dampingFactor: number
  6972. }
  6973. /**
  6974. * {@link CameraOrbitControl}的`schema`,详见{@link ICameraOrbitControlData}。
  6975. */
  6976. export const CameraOrbitControlSchema: IComponentSchema
  6977. export default class CameraOrbitControl extends Component<ICameraOrbitControlData> {
  6978. /**
  6979. * 详见{@link CameraOrbitControlSchema}。
  6980. */
  6981. readonly schema: IComponentSchema
  6982. /**
  6983. * 是否锁定横向旋转。
  6984. */
  6985. isLockX: boolean
  6986. /**
  6987. * 是否锁定纵向旋转。
  6988. */
  6989. isLockY: boolean
  6990. /**
  6991. * 是否锁定缩放。
  6992. */
  6993. isLockZoom: boolean
  6994. /**
  6995. * 是否锁定旋转。
  6996. */
  6997. isLockRotate: boolean
  6998. /**
  6999. * 是否锁定移动。
  7000. */
  7001. isLockMove: boolean
  7002. /**
  7003. * 是否已经开启。
  7004. */
  7005. isEnabled: boolean
  7006. /**
  7007. * 允许的最大缩放值。
  7008. */
  7009. zoomMax: number
  7010. /**
  7011. * 允许的最小缩放值。
  7012. */
  7013. zoomMin: number
  7014. /**
  7015. * 允许的最大平移边界。
  7016. */
  7017. panMax: Vector3
  7018. /**
  7019. * 允许的最小平移边界。
  7020. */
  7021. panMin: Vector3
  7022. /**
  7023. * 平移速度。
  7024. */
  7025. panSpeed: number
  7026. /**
  7027. * 旋转速度。
  7028. */
  7029. rotateSpeed: number
  7030. /**
  7031. * 缩放速度。
  7032. */
  7033. zoomSpeed: number
  7034. /**
  7035. * 开启阻尼缓动。
  7036. */
  7037. enableDamping: boolean
  7038. /**
  7039. * 阻尼系数。
  7040. */
  7041. dampingFactor: number
  7042. /**
  7043. * 当前是否正在缓动。
  7044. */
  7045. get damping(): boolean
  7046. /**
  7047. * 获取当前目标。
  7048. */
  7049. get target(): Vector3
  7050. /**
  7051. * 添加到世界,继承请先`super.onAdd()`。
  7052. */
  7053. onAdd(parent: Element, data: ICameraOrbitControlData): void
  7054. /**
  7055. * 每一帧更新,继承请先`super.onUpdate()`。
  7056. */
  7057. onUpdate(data: ICameraOrbitControlData): void
  7058. onTick(deltaTime: number, data: ICameraOrbitControlData): void
  7059. /**
  7060. * 销毁,继承请先`super.onUpdate()`。
  7061. */
  7062. onRemove(): void
  7063. /**
  7064. * 启动控制器。
  7065. */
  7066. enable(): void
  7067. /**
  7068. * 关闭控制器。
  7069. */
  7070. disable(): void
  7071. }
  7072. }
  7073. declare module 'XrFrame/components/ARTracker' {
  7074. /**
  7075. * ARTracker.ts
  7076. *
  7077. * * @Date : 6/24/2022, 11:35:30 AM
  7078. */
  7079. import { Kanata } from 'XrFrame/ext'
  7080. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  7081. import Element from 'XrFrame/core/Element'
  7082. import Vector3 from 'XrFrame/math/vector3'
  7083. /**
  7084. * {@link ARSystem}和{@link ARTracker}的跟踪模式。
  7085. * 其中`threeDof`需要基础库`2.30.4`以上支持。
  7086. */
  7087. export type TTrackMode =
  7088. | 'Plane'
  7089. | 'Marker'
  7090. | 'OSD'
  7091. | 'Face'
  7092. | 'Hand'
  7093. | 'Body'
  7094. | 'threeDof'
  7095. /**
  7096. * {@link ARTracker}的识别状态。
  7097. * @version v2.29.1
  7098. */
  7099. export enum EARTrackerState {
  7100. Init = 0,
  7101. Detecting = 1,
  7102. Detected = 2,
  7103. Error = 3
  7104. }
  7105. /**
  7106. * `Face`/`Body`/`Hand`模式下,{@link ARTracker}存储的原始数据类型。
  7107. */
  7108. export interface IARTrackerRawData {
  7109. /**
  7110. * 原点,屏幕空间。
  7111. */
  7112. origin: {
  7113. x: number
  7114. y: number
  7115. }
  7116. /**
  7117. * 尺寸,屏幕空间。
  7118. */
  7119. size: {
  7120. width: number
  7121. height: number
  7122. }
  7123. /**
  7124. * 置信度。
  7125. */
  7126. score: number
  7127. /**
  7128. * 在`Hand`模式下,手势分类,正常`0~18`,无效为`-1`。
  7129. */
  7130. gesture?: number
  7131. /**
  7132. * 在`Face`模式下,人脸旋转角度。
  7133. */
  7134. angle?: {
  7135. pitch: number
  7136. roll: number
  7137. yaw: number
  7138. z_score: number
  7139. }
  7140. /**
  7141. * 关键点置信度。
  7142. */
  7143. confidence: number[]
  7144. /**
  7145. * 关键点,屏幕空间。
  7146. */
  7147. points: Array<{
  7148. x: number
  7149. y: number
  7150. }>
  7151. /**
  7152. * 支持3D时,3D关键点,世界空间。
  7153. */
  7154. points3d: Array<{
  7155. x: number
  7156. y: number
  7157. z: number
  7158. }>
  7159. }
  7160. /**
  7161. * {@link ARTracker}组件数据接口。
  7162. */
  7163. export interface IARTrackerData {
  7164. /**
  7165. * 跟踪模式,必须在{@link ARSystem}已开启的模式列表中。
  7166. * `xml`中数据为`string`类型。
  7167. */
  7168. mode: TTrackMode
  7169. /**
  7170. * 要追踪的图片资源,优先使用。
  7171. * `xml`中数据为`image`类型。
  7172. */
  7173. image?: Kanata.IImage
  7174. /**
  7175. * 要追踪的图片地址,如果`image`没有定义,则使用这个。
  7176. * `xml`中数据为`string`类型。
  7177. */
  7178. src?: string
  7179. /**
  7180. * 在`Face`模式下,给定一个**特征点索引**列表,详见官网对应文档。
  7181. * 系统会自动同步位置和缩放到`ARTracker`下对应的顺序的子节点。
  7182. * `-1`代表不同步位置,只同步缩放。
  7183. */
  7184. autoSync?: number[]
  7185. }
  7186. /**
  7187. * {@link ARTracker}的`schema`,详见{@link IARTrackerData}。
  7188. */
  7189. export const ARTrackSchema: {
  7190. mode: {
  7191. type: string
  7192. }
  7193. image: {
  7194. type: string
  7195. }
  7196. src: {
  7197. type: string
  7198. }
  7199. autoSync: {
  7200. type: string
  7201. }
  7202. }
  7203. /**
  7204. * AR追踪组件,配合{@link ARSystem}和{@link Camera}的`isARCamera`属性一起使用。
  7205. * 一般被代理到{@link XRARTracker}元素。
  7206. *
  7207. * 其提供了追踪的能力,节点将会自动同步识别到的追踪目标的位置和旋转,
  7208. */
  7209. export default class ARTracker extends Component<IARTrackerData> {
  7210. static EVENTS: string[]
  7211. /**
  7212. * 详见{@link ARTrackSchema}。
  7213. */
  7214. readonly schema: IComponentSchema
  7215. /**
  7216. * 跟踪模式。
  7217. */
  7218. get mode(): TTrackMode
  7219. /**
  7220. * 当前识别状态。
  7221. *
  7222. * @version v2.29.1
  7223. */
  7224. get state(): EARTrackerState
  7225. /**
  7226. * 如果为错误状态,错误信息。
  7227. *
  7228. * @version v2.29.1
  7229. */
  7230. get errorMessage(): string
  7231. /**
  7232. * 是否已经检测到了目标。
  7233. */
  7234. get arActive(): boolean
  7235. /**
  7236. * `Body`/`Hand`模式下,获取当前的置信度。
  7237. * 一般为`0~1`。
  7238. */
  7239. get score(): number
  7240. /**
  7241. * 在`Hand`模式下,手势分类,正常`0~18`,无效为`-1`。
  7242. */
  7243. get gesture(): number
  7244. /**
  7245. * @internal
  7246. */
  7247. get filePath(): string
  7248. /**
  7249. * @internal
  7250. */
  7251. get trackId(): number
  7252. onAdd(parent: Element, data: IARTrackerData): void
  7253. onUpdate(data: IARTrackerData, preData: IARTrackerData): void
  7254. onRemove(parent: Element, data: IARTrackerData): void
  7255. /**
  7256. * 在`Face`/`Body`/`Hand`模式下,获取某个特征点的位置。
  7257. *
  7258. * @param point 特征点索引,需要在`0~105`,否则返回`undefined`。
  7259. * @param relativeToTracker 仅在`ar-system`的`pose3d`属性为`false`时生效。是否相对于`ARTracker`本身,默认为`true`,否则返回世界空间坐标。
  7260. * @returns 只有在`arActive`时才有值,否则返回`undefined`。
  7261. */
  7262. getPosition(
  7263. point: number,
  7264. output?: Vector3,
  7265. relativeToTracker?: boolean
  7266. ): Vector3
  7267. /**
  7268. * @internal
  7269. */
  7270. /**
  7271. * @internal
  7272. */
  7273. }
  7274. }
  7275. declare module 'XrFrame/components/physics/Shape' {
  7276. import Component from 'XrFrame/core/Component'
  7277. import Element from 'XrFrame/core/Element'
  7278. import Vector3 from 'XrFrame/math/vector3'
  7279. import { Kanata } from 'XrFrame/ext'
  7280. import type Rigidbody from 'XrFrame/components/physics/Rigidbody'
  7281. import type GLTFComponent from 'XrFrame/components/GLTF'
  7282. import Quaternion from 'XrFrame/math/quaternion'
  7283. import { Delegate } from 'XrFrame/physics/event'
  7284. import { ICollideEvent, IOverlapEvent } from 'XrFrame/physics/Collision'
  7285. import { TQS } from 'XrFrame/assets/GLTFModel'
  7286. export const shapeMap: Map<phys3D.Collider, Shape<any>>
  7287. export enum EShapeType {
  7288. /**
  7289. * @internal
  7290. */
  7291. None = 0,
  7292. /**
  7293. * @see {@link CubeShape}
  7294. */
  7295. Cube = 1,
  7296. /**
  7297. * @internal
  7298. */
  7299. CharacterController = 2,
  7300. /**
  7301. * @see {@link CapsuleShape}
  7302. */
  7303. Capsule = 3,
  7304. /**
  7305. * @see {@link MeshShape}
  7306. */
  7307. Mesh = 4,
  7308. /**
  7309. * @see {@link SphereShape}
  7310. */
  7311. Sphere = 5
  7312. }
  7313. export interface IShapeData {
  7314. /**
  7315. * 轮廓中心相对元素{@link Transform}中心的偏移量。
  7316. * @default [0, 0, 0]
  7317. */
  7318. center?: [number, number, number]
  7319. /**
  7320. * 轮廓是否自动贴合{@link Mesh | Mesh组件}或{@link GLTF | GLTF组件}的大小。
  7321. * 如果当前元素下不存在Mesh组件和GLTF组件则不生效。
  7322. *
  7323. * > {@link MeshShape}永远会开启这项。
  7324. *
  7325. * @default false
  7326. */
  7327. autoFit?: boolean
  7328. /**
  7329. * 是否禁用shape。
  7330. *
  7331. * @default false
  7332. */
  7333. disabled?: boolean
  7334. }
  7335. export const ShapeSchema: {
  7336. center: {
  7337. type: string
  7338. }
  7339. autoFit: {
  7340. type: string
  7341. }
  7342. disabled: {
  7343. type: string
  7344. }
  7345. }
  7346. export enum ShapeImplType {
  7347. None = 0,
  7348. Basic = 1,
  7349. GLTFAbstract = 2
  7350. }
  7351. /**
  7352. * 轮廓组件的基类。
  7353. * 为元素添加*该组件的子类*可以创建一个可用于交互的轮廓。
  7354. *
  7355. * > 💡 只要创建了轮廓,在点击该物体时就可以触发事件:
  7356. * > + touch-shape: 点击物体事件,回调参数为{@link IShapeTouchEvent};
  7357. * > + drag-shape: 拖拽物体事件,回调参数为{@link IShapeDragEvent};
  7358. * > + untouch-shape: 松开物体事件,回调参数为{@link IShapeTouchEvent};
  7359. * >
  7360. * > 绑定事件的方法可参考以下代码:
  7361. * >
  7362. * > ``` <xr-node sphere-shape bind:touch-shape="handleTouchShape"></xr-node> ```
  7363. *
  7364. * > 💡 如果想要将轮廓可视化来确认轮廓大小,可以在同一个元素下添加{@link ShapeGizmos}组件,或在标签上添加`shape-gizmo`属性(对MeshShape不起作用)。
  7365. *
  7366. * @abstract
  7367. */
  7368. export default abstract class Shape<
  7369. T extends IShapeData = any
  7370. > extends Component<IShapeData> {
  7371. static EVENTS: string[]
  7372. readonly priority: number
  7373. implType: ShapeImplType
  7374. protected _type: EShapeType
  7375. protected _onCollisionEnterDelegate?: Delegate<ICollideEvent>
  7376. protected _onCollisionExitDelegate?: Delegate<ICollideEvent>
  7377. protected _onCollisionStayDelegate?: Delegate<ICollideEvent>
  7378. protected _onTriggerEnterDelegate?: Delegate<IOverlapEvent>
  7379. protected _onTriggerExitDelegate?: Delegate<IOverlapEvent>
  7380. protected _onTriggerStayDelegate?: Delegate<IOverlapEvent>
  7381. get type(): EShapeType
  7382. onAdd(parent: Element, data: T): void
  7383. onUpdate(data: T, preData: T): void
  7384. onTick(dateTime: number, data: T): void
  7385. protected abstract getImplClass(
  7386. implType: ShapeImplType
  7387. ): new () => ShapeImpl | null
  7388. onRemove(parent: Element, data: IShapeData): void
  7389. onRelease(data: IShapeData): void
  7390. shadowRoot?: GLTFAbstractShape<T>
  7391. setAsShadow(root: GLTFAbstractShape<T>, transform: TQS): void
  7392. getGLTFRootShape(): Shape<T> | undefined
  7393. getBasicImpl(): BasicShape<T> | undefined
  7394. getShadowShapes(): Array<Shape<T>>
  7395. initDelegates(el: Element): void
  7396. resetListeners(): void
  7397. }
  7398. export interface ShapeImpl {
  7399. el: Element
  7400. onElementAdd?(parent: Element): void
  7401. update(data: IShapeData, preData: IShapeData): void
  7402. onElementRemove(parent: Element): void
  7403. onTick(dateTime: number, data: IShapeData): any
  7404. create?(el: Element, shape: Shape<any>, data: IShapeData): any
  7405. cleanUp(): any
  7406. enable(): any
  7407. disable(): any
  7408. }
  7409. export abstract class BasicShape<T extends IShapeData>
  7410. implements ShapeImpl
  7411. {
  7412. el: Element
  7413. shapeComp: Shape<T>
  7414. nativeComp: phys3D.Collider
  7415. rigidbodyComp?: Rigidbody
  7416. _isShadow: boolean
  7417. _root: GLTFAbstractShape<T>
  7418. _positionInGLTF: Vector3
  7419. _quatInGLTF: Quaternion
  7420. protected afterCreateNativeComp(): void
  7421. protected destroyNativeComp(): void
  7422. onElementAdd(parent: Element): void
  7423. protected abstract autoFit(data: T): void
  7424. protected abstract applyData(data: T): void
  7425. update(data: T, preData: T): void
  7426. onElementRemove(parent: Element): void
  7427. onRelease(data: T): void
  7428. onTick(dateTime: number, data: IShapeData): void
  7429. cleanUp(): void
  7430. /**
  7431. * @internal
  7432. */
  7433. get entity(): Kanata.Entity3D
  7434. enable(): void
  7435. disable(): void
  7436. }
  7437. export abstract class GLTFAbstractShape<T extends IShapeData>
  7438. implements ShapeImpl
  7439. {
  7440. el: Element
  7441. shapeComp: Shape<T>
  7442. protected gltf: GLTFComponent
  7443. shadowShapes: Array<Shape<T>>
  7444. update(data: T, preData: T): void
  7445. onElementRemove(parent: Element): void
  7446. onTick(dateTime: number, data: T): void
  7447. create(el: Element, shape: Shape<T>, data: T): void
  7448. protected abstract getShapeClass(): new () => Shape<T>
  7449. cleanUp(): void
  7450. protected abstract createShadowShape(el: Element, data: T): Shape<T>
  7451. enable(): void
  7452. disable(): void
  7453. }
  7454. }
  7455. declare module 'XrFrame/components/physics/SphereShape' {
  7456. import Shape, {
  7457. BasicShape,
  7458. EShapeType,
  7459. IShapeData,
  7460. ShapeImpl,
  7461. ShapeImplType
  7462. } from 'XrFrame/components/physics/Shape'
  7463. import Vector3 from 'XrFrame/math/vector3'
  7464. import Element from 'XrFrame/core/Element'
  7465. import { IComponentSchema } from 'XrFrame/core/Component'
  7466. /**
  7467. * @see {@link SphereShapes}
  7468. */
  7469. export interface ISphereShapeData extends IShapeData {
  7470. /**
  7471. * 球形轮廓的半径。
  7472. * @default 1
  7473. */
  7474. radius?: number
  7475. }
  7476. export const SphereShapeSchema: IComponentSchema
  7477. /**
  7478. * 为当前元素创建一个可交互的球状轮廓。
  7479. * 可通过在标签上添加`sphere-shape`属性来为元素添加该组件。
  7480. *
  7481. * @see {@link ISphereShapeData}
  7482. */
  7483. export default class SphereShape extends Shape<ISphereShapeData> {
  7484. static EVENTS: string[]
  7485. readonly schema: IComponentSchema
  7486. protected _type: EShapeType
  7487. protected getImplClass(implType: ShapeImplType): new () => ShapeImpl
  7488. }
  7489. export class BasicSphereShape extends BasicShape<ISphereShapeData> {
  7490. nativeComp: phys3D.SphereCollider
  7491. /**
  7492. * 轮廓相对于元素中心点的偏移量。
  7493. */
  7494. get center(): Vector3
  7495. set center(v: Vector3)
  7496. /**
  7497. * 球形轮廓的半径。
  7498. */
  7499. get radius(): number
  7500. set radius(v: number)
  7501. create(el: Element, shape: SphereShape, data: ISphereShapeData): void
  7502. protected autoFit(data: ISphereShapeData): void
  7503. protected applyData(data: ISphereShapeData): void
  7504. }
  7505. }
  7506. declare module 'XrFrame/components/physics/MeshShape' {
  7507. import Shape, {
  7508. IShapeData,
  7509. EShapeType,
  7510. ShapeImplType,
  7511. ShapeImpl,
  7512. BasicShape
  7513. } from 'XrFrame/components/physics/Shape'
  7514. import Element from 'XrFrame/core/Element'
  7515. import { IComponentSchema } from 'XrFrame/core/Component'
  7516. /**
  7517. * @see {@link MeshShape}
  7518. */
  7519. export interface IMeshShapeData extends IShapeData {
  7520. /**
  7521. * 是否使用凸多边形来包围Mesh。
  7522. * *如果元素有`shape-interact`属性,则会强制开启。*
  7523. * @default false
  7524. */
  7525. convex?: boolean
  7526. }
  7527. export const MeshShapeSchema: IComponentSchema
  7528. /**
  7529. * 利用当前元素下的{@link Mesh | Mesh组件}或{@link GLTF | GLTF组件},创建一个完全贴合的轮廓。如果当前元素下不存在Mesh组件或GLTF组件,则不生效。
  7530. * 可通过在标签上添加`mesh-shape`属性来为元素添加该组件。
  7531. *
  7532. * > ⚠️ 如果Mesh或GLTF内部结构非常复杂,创建和维持该组件可能会占用较多的资源。如果发现该组件会导致小程序性能下降,可以考虑改用其他轮廓类型,并开启{@link IShapeData.autoFit | autoFit}属性。
  7533. *
  7534. * > ⚠️ MeshShape使用的Mesh的顶点数量不能超过65535个。如果超过了,推荐使用CubeShape+autoFit来代替。
  7535. *
  7536. * @see {@link IMeshShapeData}
  7537. */
  7538. export default class MeshShape extends Shape<IMeshShapeData> {
  7539. static EVENTS: string[]
  7540. readonly schema: IComponentSchema
  7541. protected _type: EShapeType
  7542. protected getImplClass(implType: ShapeImplType): new () => ShapeImpl
  7543. }
  7544. export class BasicMeshShape extends BasicShape<IMeshShapeData> {
  7545. nativeComp: phys3D.MeshCollider
  7546. create(el: Element, shape: MeshShape, data: IMeshShapeData): void
  7547. onTick(dateTime: number, data: IShapeData): void
  7548. protected autoFit(data: IMeshShapeData): void
  7549. protected applyData(data: IMeshShapeData): void
  7550. }
  7551. }
  7552. declare module 'XrFrame/components/physics/CapsuleShape' {
  7553. import Shape, {
  7554. BasicShape,
  7555. EShapeType,
  7556. IShapeData,
  7557. ShapeImpl,
  7558. ShapeImplType
  7559. } from 'XrFrame/components/physics/Shape'
  7560. import Vector3 from 'XrFrame/math/vector3'
  7561. import Element from 'XrFrame/core/Element'
  7562. import { IComponentSchema } from 'XrFrame/core/Component'
  7563. /**
  7564. * @see {@link CapsuleShape}
  7565. */
  7566. export interface ICapsuleShapeData extends IShapeData {
  7567. /**
  7568. * 胶囊体两端球体的半径。
  7569. * @default 0.5
  7570. */
  7571. radius?: number
  7572. /**
  7573. * 胶囊体的长度。
  7574. * @default 2
  7575. */
  7576. height?: number
  7577. /**
  7578. * 胶囊体的朝向。
  7579. * @default ECapsuleShapeDirection["Y-Axis"]
  7580. */
  7581. direction?: ECapsuleShapeDirection
  7582. }
  7583. export const CapsuleShapeSchema: IComponentSchema
  7584. /**
  7585. * 胶囊体轮廓的朝向。
  7586. *
  7587. * @category Physics
  7588. */
  7589. export enum ECapsuleShapeDirection {
  7590. 'X-Axis' = 0,
  7591. 'Y-Axis' = 1,
  7592. 'Z-Axis' = 2
  7593. }
  7594. /**
  7595. * 为当前元素创建一个可交互的胶囊体轮廓。
  7596. * 可通过在标签上添加`capsule-shape`属性来为元素添加该组件。
  7597. *
  7598. * @see {@link ICapsuleShapeData}
  7599. */
  7600. export default class CapsuleShape extends Shape<ICapsuleShapeData> {
  7601. static EVENTS: string[]
  7602. readonly schema: IComponentSchema
  7603. protected _type: EShapeType
  7604. protected getImplClass(implType: ShapeImplType): new () => ShapeImpl
  7605. }
  7606. export class BasicCapsuleShape extends BasicShape<ICapsuleShapeData> {
  7607. nativeComp: phys3D.CapsuleCollider
  7608. /**
  7609. * 轮廓相对于元素中心点的偏移量。
  7610. */
  7611. get center(): Vector3
  7612. set center(v: Vector3)
  7613. /**
  7614. * 胶囊体两端球体的半径。
  7615. */
  7616. get radius(): number
  7617. set radius(v: number)
  7618. static defaultHeight: number
  7619. /**
  7620. * 胶囊体的长度。
  7621. */
  7622. get height(): number
  7623. set height(v: number)
  7624. /**
  7625. * 胶囊体的朝向。
  7626. */
  7627. get direction(): ECapsuleShapeDirection
  7628. set direction(v: ECapsuleShapeDirection)
  7629. create(el: Element, shape: CapsuleShape, data: ICapsuleShapeData): void
  7630. protected autoFit(data: ICapsuleShapeData): void
  7631. protected applyData(data: ICapsuleShapeData): void
  7632. }
  7633. }
  7634. declare module 'XrFrame/components/physics/CubeShape' {
  7635. import Shape, {
  7636. BasicShape,
  7637. EShapeType,
  7638. IShapeData,
  7639. ShapeImpl,
  7640. ShapeImplType
  7641. } from 'XrFrame/components/physics/Shape'
  7642. import Vector3 from 'XrFrame/math/vector3'
  7643. import Element from 'XrFrame/core/Element'
  7644. import { IComponentSchema } from 'XrFrame/core/Component'
  7645. /**
  7646. * @see {@link CubeShape}
  7647. */
  7648. export interface ICubeShapeData extends IShapeData {
  7649. /**
  7650. * 长方体沿x,y,z轴的长度。
  7651. * @default [1, 1, 1]
  7652. */
  7653. size?: [number, number, number]
  7654. }
  7655. export const CubeShapeSchema: IComponentSchema
  7656. /**
  7657. * 为当前元素创建一个可交互的长方体轮廓。
  7658. * 可通过在标签上添加`cube-shape`属性来为元素添加该组件。
  7659. *
  7660. * @see {@link ICubeShapeData}
  7661. */
  7662. export default class CubeShape extends Shape<ICubeShapeData> {
  7663. static EVENTS: string[]
  7664. readonly schema: IComponentSchema
  7665. protected _type: EShapeType
  7666. protected getImplClass(implType: ShapeImplType): new () => ShapeImpl
  7667. }
  7668. export class BasicCubeShape extends BasicShape<ICubeShapeData> {
  7669. nativeComp: phys3D.BoxCollider
  7670. /**
  7671. * 轮廓相对于元素中心点的偏移量。
  7672. */
  7673. get center(): Vector3
  7674. set center(v: Vector3)
  7675. /**
  7676. * 长方体沿x,y,z轴的长度。
  7677. */
  7678. get size(): Vector3
  7679. set size(v: Vector3)
  7680. create(el: Element, shape: CubeShape, data: ICubeShapeData): void
  7681. protected autoFit(data: ICubeShapeData): void
  7682. protected applyData(data: ICubeShapeData): void
  7683. }
  7684. }
  7685. declare module 'XrFrame/components/physics/Rigidbody' {
  7686. import Vector3 from 'XrFrame/math/vector3'
  7687. import Quaternion from 'XrFrame/math/quaternion'
  7688. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  7689. import {
  7690. CollisionDetectionMode,
  7691. ForceMode
  7692. } from 'XrFrame/components/physics/types'
  7693. import Element from 'XrFrame/core/Element'
  7694. export interface IRigidbodyData {
  7695. /**
  7696. * 是否禁用刚体。
  7697. * @default false
  7698. */
  7699. disabled?: boolean
  7700. /**
  7701. * 物体的质量。
  7702. * @limit mass > 0
  7703. * @default 1
  7704. */
  7705. mass?: number
  7706. /**
  7707. * 刚体是否受重力影响。
  7708. * @default true
  7709. */
  7710. useGravity?: boolean
  7711. /**
  7712. * 限制刚体在某个轴上的位移和旋转。
  7713. * 具体值参考{@link RigidbodyConstraints}
  7714. */
  7715. constraintsMask?: number
  7716. /**
  7717. * 是否为*运动学(Kinematic)* 刚体。
  7718. * 设置为*运动学*刚体后,除非手动调用{@link movePosition},否则物体不会在*物理模拟*阶段发生位移或旋转。可以理解为,刚体的行为完全在用户的控制之下。
  7719. * @default false
  7720. */
  7721. kinematic?: boolean
  7722. }
  7723. export const RigidbodySchema: {
  7724. mass: {
  7725. type: string
  7726. }
  7727. useGravity: {
  7728. type: string
  7729. }
  7730. constraintsMask: {
  7731. type: string
  7732. }
  7733. disabled: {
  7734. type: string
  7735. }
  7736. kinematic: {
  7737. type: string
  7738. }
  7739. }
  7740. /**
  7741. * 刚体组件。
  7742. *
  7743. * 让物体在物理系统中成为一个有质量的刚体。只有添加了这个组件之后,物体才有可能在物理系统的*物理模拟*阶段发生位移和旋转。
  7744. * @category Physics
  7745. */
  7746. export default class Rigidbody extends Component<IRigidbodyData> {
  7747. readonly schema: IComponentSchema
  7748. readonly priority: number
  7749. /**
  7750. * 刚体的质量。
  7751. * @limit mass > 0
  7752. * @default 1
  7753. */
  7754. get mass(): number
  7755. set mass(v: number)
  7756. /**
  7757. * 线性阻尼。
  7758. * 影响物体的{@link velocity | 线性速度}。
  7759. * @limit linearDamping >= 0
  7760. * @default 0
  7761. */
  7762. get linearDamping(): number
  7763. set linearDamping(v: number)
  7764. /**
  7765. * 角速度阻尼。
  7766. * 影响物体的{@link angularVelocity | 角速度}。
  7767. * @limit angularDamping >= 0
  7768. * @default 0.05
  7769. */
  7770. get angularDamping(): number
  7771. set angularDamping(v: number)
  7772. /**
  7773. * 刚体是否受重力影响。
  7774. * @default true
  7775. */
  7776. get useGravity(): boolean
  7777. set useGravity(v: boolean)
  7778. /**
  7779. * 是否为*运动学(Kinematic)* 刚体。
  7780. * 设置为*运动学*刚体后,除非手动调用{@link movePosition},否则物体不会在*物理模拟*阶段发生位移或旋转。可以理解为,刚体的行为完全在用户的控制之下。
  7781. * @default false
  7782. */
  7783. get isKinematic(): boolean
  7784. set isKinematic(v: boolean)
  7785. /**
  7786. * @unimplemented
  7787. * @default true
  7788. */
  7789. get detectCollisions(): boolean
  7790. set detectCollisions(v: boolean)
  7791. /**
  7792. * 设置刚体的碰撞检测模式。
  7793. * 详见{@link CollisionDetectionMode}。
  7794. * @default {@link CollisionDetectionMode.Discrete}
  7795. */
  7796. get collisionDetectionMode(): CollisionDetectionMode
  7797. set collisionDetectionMode(v: CollisionDetectionMode)
  7798. /**
  7799. * 限制物体的旋转(X轴,Y轴,Z轴)。
  7800. * @default [false, false, false]
  7801. */
  7802. get rotationConstraints(): boolean[]
  7803. set rotationConstraints(v: boolean[])
  7804. /**
  7805. * 限制物体的位移(X轴,Y轴,Z轴)。
  7806. * @default [false, false, false]
  7807. */
  7808. get positionConstraints(): boolean[]
  7809. set positionConstraints(v: boolean[])
  7810. /**
  7811. * 直接获取或修改刚体在*物理系统*中的位置。
  7812. * 物理系统中的位置是独立于Transform组件的。
  7813. *
  7814. * \**如果你不清楚修改这一项的后果,请不要手动修改它。修改{@link Transform.position}来代替。*
  7815. */
  7816. get position(): Vector3
  7817. set position(v: Vector3)
  7818. /**
  7819. * 直接获取或修改刚体在*物理系统*中的旋转(以四元数表示)。
  7820. * 物理系统中的旋转是独立于节点系统中的Transform的,详见{@link //TODO}。
  7821. *
  7822. * \**如果你不清楚修改这一项的后果,请不要手动修改它。修改{@link Transform3D.euler}或{@link Transform3D.quaternion}来代替。*
  7823. */
  7824. get rotation(): Quaternion
  7825. set rotation(v: Quaternion)
  7826. /**
  7827. * 刚体的角速度。
  7828. */
  7829. get angularVelocity(): Vector3
  7830. set angularVelocity(v: Vector3)
  7831. /**
  7832. * 刚体的质心相对于LocalTransform的偏移量。
  7833. * 如果不手动设置这一项,会自动根据刚体附着的轮廓来计算质心。
  7834. * @see {@link resetCenterOfMass}
  7835. */
  7836. get centerOfMass(): Vector3
  7837. set centerOfMass(v: Vector3)
  7838. /**
  7839. * 是否允许*物理模拟*过程中对刚体进行旋转。
  7840. * @default true
  7841. */
  7842. get freezeRotation(): boolean
  7843. set freezeRotation(v: boolean)
  7844. /**
  7845. * 刚体的转动惯量。
  7846. * 如果不手动设置的话,会自动根据刚体上附着的轮廓计算得出。
  7847. * @see {@link resetInertiaTensor}
  7848. */
  7849. get inertiaTensor(): number
  7850. set inertiaTensor(v: number)
  7851. /**
  7852. * 最大角速度(弧度)。
  7853. * @default 7
  7854. */
  7855. get maxAngularVelocity(): number
  7856. set maxAngularVelocity(v: number)
  7857. /**
  7858. * 最大分离速度。
  7859. * *物理模拟*解决碰撞(相交)的过程中,最大能允许的分离速度。
  7860. * @default Infinity
  7861. */
  7862. get maxDepenetrationVelocity(): number
  7863. set maxDepenetrationVelocity(v: number)
  7864. /**
  7865. * 设置刚体进入休眠的动能阈值。
  7866. * @default 0.005
  7867. */
  7868. get sleepThreshold(): number
  7869. set sleepThreshold(v: number)
  7870. /**
  7871. * 设置*物理模拟*过程中解决碰撞的迭代次数。
  7872. * 更高的迭代次数,会消耗更多性能,产生更自然的物理碰撞效果。
  7873. * 如果发现静息状态的刚体(比如说放在地面上),会发生抖动,可以考虑提高这项数值。
  7874. *
  7875. * @limit solverIterations > 0
  7876. * @default 6
  7877. */
  7878. get solverIterations(): number
  7879. set solverIterations(v: number)
  7880. /**
  7881. * 设置*物理模拟*过程中计算碰撞后速度的迭代次数。
  7882. * 更高的迭代次数,会消耗更多性能,产生更准确的分离速度。
  7883. *
  7884. * @limit solverVelocityIterations > 0
  7885. * @default 1
  7886. */
  7887. get solverVelocityIterations(): number
  7888. set solverVelocityIterations(v: number)
  7889. /**
  7890. * 刚体的线性速度。
  7891. *
  7892. * \**修改这一项会造成速度突变,一般情况下可以使用{@link addForce}来代替。*
  7893. */
  7894. get velocity(): Vector3
  7895. set velocity(v: Vector3)
  7896. /**
  7897. * @internal
  7898. */
  7899. constructor()
  7900. applyData(data: IRigidbodyData): void
  7901. onTick(dateTime: number, data: IRigidbodyData): void
  7902. onAdd(parent: Element, data: IRigidbodyData): void
  7903. onUpdate(data: IRigidbodyData, preData: IRigidbodyData): void
  7904. onRemove(parent: Element, data: IRigidbodyData): void
  7905. onRelease(data: IRigidbodyData): void
  7906. enable(): void
  7907. disable(): void
  7908. /** @internal */
  7909. get nativeComp(): phys3D.DynamicRigidbody
  7910. /**
  7911. * @returns 刚体质心在世界坐标中的位置。
  7912. */
  7913. getWorldCenterOfMass(): Vector3
  7914. /**
  7915. * 为刚体施加力,会影响刚体的{@link velocity | 线性速度}。
  7916. * @param force 世界坐标下矢量形式的力,作用在物体质心上。
  7917. * @param mode 力的类型。
  7918. */
  7919. addForce(force: Vector3, mode: ForceMode): void
  7920. /**
  7921. * 为刚体施加力矩,会影响刚体的{@link angularVelocity | 角速度}。
  7922. * @param torque 世界坐标下矢量形式的力矩。
  7923. * @param mode 力矩的类型。
  7924. */
  7925. addTorque(torque: Vector3, mode: ForceMode): void
  7926. /**
  7927. * @returns 刚体是否处于休眠状态。
  7928. * @see {@link sleep}
  7929. */
  7930. isSleeping(): boolean
  7931. /**
  7932. * 强迫刚体进入休眠状态(至少一帧),休眠状态详见{@link //todo}。
  7933. * \**如果下一帧发生碰撞则会立刻醒来。*
  7934. */
  7935. sleep(): void
  7936. /**
  7937. * 强制唤醒刚体(离开休眠状态)。
  7938. * @see {@link sleep}
  7939. */
  7940. wakeUp(): void
  7941. /**
  7942. * 生成一次模拟爆炸的力。
  7943. * 爆炸范围可以视作一个球状物体,如果球体和刚体产生*相交*,则会在刚体上产生推力。
  7944. * 推力的大小和*相交点*与球心的距离有关,推力的方向从球心指向相交点,推力作用位于*相交点*。
  7945. *
  7946. * 视刚体有无附着的轮廓,分为两种情况:
  7947. * + 无轮廓(或爆炸球心在刚体轮廓内)
  7948. * 相交的判定使用刚体的质心;相交点也取刚体的质心。
  7949. * + 有轮廓
  7950. * 相交的判定使用刚体的所有轮廓;相交点取轮廓距离球心最近的那一点。
  7951. * @param explosionForce 爆炸力的大小。
  7952. * @param explosionPosition 爆炸球体的球心位置。
  7953. * @param explosionRadius 爆炸球体的半径。
  7954. * @param upwardsModifier 使用相对数值来修改推力的*作用位置*的y坐标。
  7955. * @param mode 力的类型。
  7956. * @limit explosionForce > 0
  7957. */
  7958. AddExplosionForce(
  7959. explosionForce: number,
  7960. explosionPosition: Vector3,
  7961. explosionRadius: number,
  7962. upwardsModifier: number,
  7963. mode: ForceMode
  7964. ): void
  7965. /**
  7966. * 为刚体施加力,会影响刚体的{@link velocity | 线性速度}和{@link angularVelocity | 角速度}。
  7967. * @param force 世界坐标下矢量形式的力,作用在position位置上。
  7968. * @param position 力的作用位置。
  7969. * @param mode 力的类型。
  7970. */
  7971. AddForceAtPosition(
  7972. force: Vector3,
  7973. position: Vector3,
  7974. mode: ForceMode
  7975. ): void
  7976. /**
  7977. * 为刚体施加力,会影响刚体的{@link velocity | 线性速度}。
  7978. * @param force **局部**坐标下矢量形式的力,作用在物体质心上。
  7979. * @param mode 力的类型。
  7980. */
  7981. addRelativeForce(force: Vector3, mode: ForceMode): void
  7982. /**
  7983. * 为刚体施加力矩,会影响刚体的{@link angularVelocity | 角速度}。
  7984. * @param torque **局部**坐标下矢量形式的力矩。
  7985. * @param mode 力矩的类型。
  7986. */
  7987. addRelativeTorque(torque: Vector3, mode: ForceMode): void
  7988. /**
  7989. * 测试刚体**表面上**距离某点最近的位置。
  7990. * 如果给予的position在刚体内部,会返回position。
  7991. * 如果刚体无附着的轮廓,会返回[Infinity, Infinity, Infinity]。
  7992. */
  7993. closestPointOnBounds(position: Vector3): Vector3
  7994. /**
  7995. * 获取刚体内某一点在世界坐标下的速度。
  7996. * @param worldPoint 世界坐标下的位置(其实在刚体外也可以)。
  7997. */
  7998. getPointVelocity(worldPoint: Vector3): Vector3
  7999. /**
  8000. * 获取刚体内某一点在**局部**坐标下的速度。
  8001. * @param relativePoint **局部**坐标下的位置(其实在刚体外也可以)。
  8002. */
  8003. getRelativePointVelocity(relativePoint: Vector3): Vector3
  8004. /**
  8005. * 对于***非**运动学刚体*来说,等于直接修改{@link position};
  8006. * 对于*运动学刚体*来说,位置变化会在下一帧生效。可以视作物体在这一帧的*物理模拟*中沿直线路径**移动**到了目的地。
  8007. * @param position 位移的终点
  8008. * @see {@link isKinematic}
  8009. */
  8010. movePosition(position: Vector3): void
  8011. /**
  8012. * @unimplemented 暂未支持,请使用{@link rotation}属性或{@link Transform3D.quaternion}代替。
  8013. */
  8014. moveRotation(rotation: Quaternion): void
  8015. /**
  8016. * 手动触发,根据刚体附着的轮廓重新计算刚体的质心。
  8017. * @see {@link centerOfMass}
  8018. */
  8019. resetCenterOfMass(): void
  8020. /**
  8021. * 手动触发,根据刚体附着的轮廓重新计算刚体的转动惯量。
  8022. * @see {@link inertiaTensor}
  8023. */
  8024. resetInertiaTensor(): void
  8025. /**
  8026. * 根据给定的密度和刚体附着的轮廓,来计算刚体的质量。
  8027. * @see {@link mass}
  8028. */
  8029. setDensity(density: number): void
  8030. }
  8031. }
  8032. declare module 'XrFrame/components/physics/ShapeInteract' {
  8033. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  8034. import Element from 'XrFrame/core/Element'
  8035. import { CombineMode } from 'XrFrame/components/physics/types'
  8036. export enum EShapeInteractType {
  8037. None = 0,
  8038. Overlap = 1,
  8039. Collide = 2
  8040. }
  8041. export interface IShapeInteractData {
  8042. /**
  8043. * 是否禁用Shape间交互。
  8044. *
  8045. * @default false
  8046. */
  8047. disabled?: boolean
  8048. /**
  8049. * 是否能与其他Shape发生物理碰撞。
  8050. *
  8051. * @default false
  8052. */
  8053. collide?: boolean
  8054. /**
  8055. * 弹性系数,决定碰撞时的能量损失比例。
  8056. *
  8057. * 弹性系数 = 1时,碰撞无能量损失。
  8058. * @limit 0 <= bounciness <= 1
  8059. * @default 0
  8060. */
  8061. bounciness?: number
  8062. /**
  8063. * 静摩擦系数
  8064. * @limit 0 <= staticFriction <= 1
  8065. * @default 0.6
  8066. */
  8067. staticFriction?: number
  8068. /**
  8069. * 动摩擦系数。
  8070. * @limit 0 <= dynamicFriction <= 1
  8071. * @default 0.6
  8072. */
  8073. dynamicFriction?: number
  8074. }
  8075. export const ShapeInteractSchema: {
  8076. disabled: {
  8077. type: string
  8078. }
  8079. collide: {
  8080. type: string
  8081. }
  8082. bounciness: {
  8083. type: string
  8084. }
  8085. staticFriction: {
  8086. type: string
  8087. }
  8088. dynamicFriction: {
  8089. type: string
  8090. }
  8091. }
  8092. /**
  8093. * 拥有ShapeInterace组件的Shape才能与其他Shape发生交互。
  8094. * 将`collide`属性设置为true来与其他Shape进行物理碰撞,仅当两个Shape的collide属性**都为true**时它们才能发生碰撞。
  8095. */
  8096. export default class ShapeInteract extends Component<IShapeInteractData> {
  8097. readonly schema: IComponentSchema
  8098. _disabled: boolean
  8099. _collide: boolean
  8100. get dynamicFriction(): number
  8101. set dynamicFriction(value)
  8102. /**
  8103. * 静摩擦系数
  8104. * @limit 0 <= staticFriction <= 1
  8105. * @default 0.6
  8106. */
  8107. get staticFriction(): number
  8108. set staticFriction(value)
  8109. /**
  8110. * 弹性系数,决定碰撞时的能量损失比例。
  8111. *
  8112. * 弹性系数 = 1时,碰撞无能量损失。
  8113. * @limit 0 <= bounciness <= 1
  8114. * @default 0
  8115. */
  8116. get bounciness(): number
  8117. set bounciness(value)
  8118. /**
  8119. * 如何结合发生碰撞的两个物体的摩擦系数。
  8120. * @default {@link CombineMode.Average}
  8121. */
  8122. get frictionCombine(): CombineMode
  8123. set frictionCombine(v: CombineMode)
  8124. /**
  8125. * 如何结合发生碰撞的两个物体的弹性系数。
  8126. * @default {@link CombineMode.Average}
  8127. */
  8128. get bounceCombine(): CombineMode
  8129. set bounceCombine(v: CombineMode)
  8130. constructor()
  8131. /**
  8132. * @internal
  8133. */
  8134. get material(): phys3D.Material
  8135. onAdd(parent: Element, data: IShapeInteractData): void
  8136. onUpdate(data: IShapeInteractData, preData: IShapeInteractData): void
  8137. getInteractType(): EShapeInteractType
  8138. }
  8139. }
  8140. declare module 'XrFrame/components/gizmo/ShapeGizmos' {
  8141. import Component from 'XrFrame/core/Component'
  8142. import Element from 'XrFrame/core/Element'
  8143. import CapsuleGizmo from 'XrFrame/components/gizmo/CapsuleGizmo'
  8144. import Shape, { ShapeImplType } from 'XrFrame/components/physics/Shape'
  8145. import CubeGizmo from 'XrFrame/components/gizmo/CubeGizmo'
  8146. /**
  8147. * @see {@link ShapeGizmos}
  8148. */
  8149. export interface IShapeGizmosData {}
  8150. export const ShapeGizmosSchema: {}
  8151. interface GizmoInfo {
  8152. shape: Shape<any>
  8153. gizmoCtor: null | typeof CubeGizmo | typeof CapsuleGizmo
  8154. shadowGizmos: ShapeGizmos[]
  8155. type: ShapeImplType
  8156. version: number
  8157. }
  8158. /**
  8159. * 将当前元素下的所有{@link Shape | 轮廓}都显示出来。
  8160. * 在标签上添加`shape-gizmo`属性来创建该组件。
  8161. *
  8162. * @see {@link IShapeGizmosData}
  8163. */
  8164. export default class ShapeGizmos extends Component<IShapeGizmosData> {
  8165. onAdd(parent: Element, data: IShapeGizmosData): void
  8166. onUpdate(data: IShapeGizmosData, preData: IShapeGizmosData): void
  8167. onTick(deltaTime: number, data: IShapeGizmosData): void
  8168. onRemove(parent: Element, data: IShapeGizmosData): void
  8169. onRelease(data: IShapeGizmosData): void
  8170. /**
  8171. * @internal
  8172. */
  8173. buildGizmo(info: GizmoInfo): void
  8174. }
  8175. export {}
  8176. }
  8177. declare module 'XrFrame/components/AssetPostProcess' {
  8178. /**
  8179. * AssetPostProcess.ts
  8180. *
  8181. * * @Date : 10/14/2022, 4:35:12 PM
  8182. */
  8183. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  8184. import Element from 'XrFrame/core/Element'
  8185. /**
  8186. * `AssetPostProcess`资源数据接口。
  8187. */
  8188. export interface IAssetPostProcessData {
  8189. /**
  8190. * 资源`id`。
  8191. */
  8192. assetId: string
  8193. /**
  8194. * 同{@link IPostProcessOptions.type}。
  8195. */
  8196. type: string
  8197. /**
  8198. * 同{@link IPostProcessOptions.isHDR}。
  8199. */
  8200. isHDR?: boolean
  8201. /**
  8202. * 同{@link IPostProcessOptions.data}。
  8203. */
  8204. data?: {
  8205. [key: string]: string
  8206. }
  8207. }
  8208. /**
  8209. * {@link AssetPostProcess}的`schema`,详见{@link IAssetPostProcessData}。
  8210. */
  8211. export const AssetPostProcessSchema: IComponentSchema
  8212. /**
  8213. * 渲染纹理创建组件,用于在`xml`中创建{@link PostProcess}资源,一般被代理到{@link XRAssetPostProcess}元素。
  8214. */
  8215. export default class AssetPostProcess extends Component<IAssetPostProcessData> {
  8216. /**
  8217. * 详见{@link AssetPostProcessSchema}。
  8218. */
  8219. readonly schema: IComponentSchema
  8220. /**
  8221. * 对应后处理资源的数据,可用于修改。
  8222. */
  8223. get assetData(): {
  8224. [key: string]: any
  8225. }
  8226. onAdd(parent: Element, data: IAssetPostProcessData): void
  8227. onUpdate(
  8228. data: IAssetPostProcessData,
  8229. preData: IAssetPostProcessData
  8230. ): void
  8231. /**
  8232. * 移除AssetPostProcess。
  8233. */
  8234. onRemove(parent: Element, data: IAssetPostProcessData): void
  8235. }
  8236. }
  8237. declare module 'XrFrame/elements/xr-node' {
  8238. /**
  8239. * xr-node.ts
  8240. *
  8241. * * @Date : 2022/3/18下午2:15:02
  8242. */
  8243. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8244. /**
  8245. * 默认包含{@link Transform}组件。
  8246. */
  8247. export const NodeDefaultComponents: IEntityComponents
  8248. /**
  8249. * 默认将{@link Transform}组件的属性进行映射。
  8250. */
  8251. export const NodeDataMapping: {
  8252. 'node-id': string[]
  8253. visible: string[]
  8254. layer: string[]
  8255. position: string[]
  8256. rotation: string[]
  8257. scale: string[]
  8258. } & {
  8259. [key: string]: string[]
  8260. }
  8261. /**
  8262. * 标签为`xr-node`,场景中所有3D节点的基础。
  8263. *
  8264. * 默认组件见{@link NodeDefaultComponents},属性映射见{@link NodeDataMapping}。
  8265. */
  8266. export default class XRNode extends Element {
  8267. static IS(element: Element): element is XRNode
  8268. readonly defaultComponents: IEntityComponents
  8269. readonly dataMapping: {
  8270. [key: string]: string[]
  8271. }
  8272. readonly isXRNode: boolean
  8273. }
  8274. }
  8275. declare module 'XrFrame/elements/xr-shadow' {
  8276. /**
  8277. * xr-shadow.ts
  8278. *
  8279. * * @Date : 6/14/2022, 3:59:17 PM
  8280. */
  8281. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8282. /**
  8283. * 默认包含{@link XRNode}的所有默认组件。
  8284. */
  8285. export const ShadowDefaultComponents: IEntityComponents
  8286. /**
  8287. * 默认包含{@link XRNode}的所有属性映射。
  8288. */
  8289. export const ShadowDataMapping: {
  8290. 'node-id': string[]
  8291. visible: string[]
  8292. layer: string[]
  8293. position: string[]
  8294. rotation: string[]
  8295. scale: string[]
  8296. } & {
  8297. [key: string]: string[]
  8298. }
  8299. /**
  8300. * 标签为`xr-shadow`。
  8301. * 是一种特殊的节点,开发者**仅可在其下以及子孙挂载自己创建的节点**!
  8302. *
  8303. * 默认组件见{@link ShadowDefaultComponents},属性映射见{@link ShadowDataMapping}。
  8304. */
  8305. export default class XRShadow extends Element {
  8306. readonly defaultComponents: IEntityComponents
  8307. readonly dataMapping: {
  8308. [key: string]: string[]
  8309. }
  8310. _appendChild(_child: Element, custom?: boolean): void
  8311. _removeChild(_child: Element, _index?: number, custom?: boolean): void
  8312. _insertBefore(_child: Element, _before?: Element, _index?: number): void
  8313. _replaceChild(
  8314. _child: Element,
  8315. _oldChild?: Element,
  8316. _index?: number
  8317. ): void
  8318. _spliceBefore(
  8319. _before: number | Element,
  8320. _deleteCount: number,
  8321. _list: Element
  8322. ): void
  8323. _spliceAppend(_list: Element): void
  8324. _spliceRemove(_before: Element, _deleteCount: number): void
  8325. }
  8326. }
  8327. declare module 'XrFrame/elements/xr-camera' {
  8328. /**
  8329. * xr-camera.ts
  8330. *
  8331. * * @Date : 2022/3/29下午5:03:57
  8332. */
  8333. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8334. /**
  8335. * 默认包含{@link XRNode}的所有默认组件,以及{@link Camera}组件。
  8336. */
  8337. export const CameraDefaultComponents: IEntityComponents
  8338. /**
  8339. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Camera}组件的属性进行映射。
  8340. */
  8341. export const CameraDataMapping: {
  8342. target: string[]
  8343. 'render-target': string[]
  8344. 'is-perspective': string[]
  8345. 'cull-mask': string[]
  8346. depth: string[]
  8347. fov: string[]
  8348. near: string[]
  8349. far: string[]
  8350. 'orth-size': string[]
  8351. background: string[]
  8352. 'is-ar-camera': string[]
  8353. 'is-clear-depth': string[]
  8354. 'is-clear-stencil': string[]
  8355. 'is-clear-color': string[]
  8356. 'clear-depth': string[]
  8357. 'clear-stencil': string[]
  8358. 'clear-color': string[]
  8359. 'post-process': string[]
  8360. 'allow-features': string[]
  8361. } & {
  8362. 'node-id': string[]
  8363. visible: string[]
  8364. layer: string[]
  8365. position: string[]
  8366. rotation: string[]
  8367. scale: string[]
  8368. } & {
  8369. [key: string]: string[]
  8370. }
  8371. /**
  8372. * 标签为`xr-camera`。
  8373. *
  8374. * 默认组件见{@link CameraDefaultComponents},属性映射见{@link CameraDataMapping}。
  8375. */
  8376. export default class XRCamera extends Element {
  8377. readonly defaultComponents: IEntityComponents
  8378. readonly dataMapping: {
  8379. [key: string]: string[]
  8380. }
  8381. }
  8382. }
  8383. declare module 'XrFrame/elements/xr-mesh' {
  8384. /**
  8385. * xr-mesh.ts
  8386. *
  8387. * * @Date : 2022/3/29下午5:05:49
  8388. */
  8389. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8390. /**
  8391. * 默认包含{@link XRNode}的所有默认组件,以及{@link Mesh}组件。
  8392. */
  8393. export const MeshDefaultComponents: IEntityComponents
  8394. /**
  8395. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Mesh}组件的属性进行映射。
  8396. */
  8397. export const MeshDataMapping: {
  8398. 'never-cull': string[]
  8399. 'cast-shadow': string[]
  8400. 'receive-shadow': string[]
  8401. geometry: string[]
  8402. material: string[]
  8403. uniforms: string[]
  8404. states: string[]
  8405. 'env-data': string[]
  8406. } & {
  8407. 'node-id': string[]
  8408. visible: string[]
  8409. layer: string[]
  8410. position: string[]
  8411. rotation: string[]
  8412. scale: string[]
  8413. } & {
  8414. [key: string]: string[]
  8415. }
  8416. /**
  8417. * 标签为`xr-mesh`。
  8418. *
  8419. * 默认组件见{@link MeshDefaultComponents},属性映射见{@link MeshDataMapping}。
  8420. */
  8421. export default class XRMesh extends Element {
  8422. readonly defaultComponents: IEntityComponents
  8423. readonly dataMapping: {
  8424. [key: string]: string[]
  8425. }
  8426. }
  8427. }
  8428. declare module 'XrFrame/elements/xr-light' {
  8429. /**
  8430. * xr-light.ts
  8431. *
  8432. * * @Date : 4/12/2022, 10:37:57 AM
  8433. */
  8434. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8435. /**
  8436. * 默认包含{@link XRNode}的所有默认组件,以及{@link Light}组件。
  8437. */
  8438. export const LightDefaultComponents: IEntityComponents
  8439. /**
  8440. * 默认包含{@link XRNode}的所有属性映射,以及将{@link Light}组件的属性进行映射。
  8441. */
  8442. export const LightDataMapping: {
  8443. type: string[]
  8444. 'cast-shadow': string[]
  8445. 'shadow-distance': string[]
  8446. 'shadow-strength': string[]
  8447. 'shadow-bias': string[]
  8448. color: string[]
  8449. intensity: string[]
  8450. range: string[]
  8451. 'inner-cone-angle': string[]
  8452. 'outer-cone-angle': string[]
  8453. } & {
  8454. 'node-id': string[]
  8455. visible: string[]
  8456. layer: string[]
  8457. position: string[]
  8458. rotation: string[]
  8459. scale: string[]
  8460. } & {
  8461. [key: string]: string[]
  8462. }
  8463. /**
  8464. * 标签为`xr-ar-tracker`。
  8465. *
  8466. * 默认组件见{@link LightDefaultComponents},属性映射见{@link LightDataMapping}。
  8467. */
  8468. export default class XRLight extends Element {
  8469. readonly defaultComponents: IEntityComponents
  8470. readonly dataMapping: {
  8471. [key: string]: string[]
  8472. }
  8473. }
  8474. }
  8475. declare module 'XrFrame/elements/xr-gltf' {
  8476. import { IEntityComponents } from 'XrFrame/core/Element'
  8477. import XRShadow from 'XrFrame/elements/xr-shadow'
  8478. /**
  8479. * 默认包含{@link XRNode}的所有默认组件,以及{@link GLTF}组件。
  8480. */
  8481. export const GLTFDefaultComponents: IEntityComponents
  8482. /**
  8483. * 默认包含{@link XRNode}的所有属性映射,以及将{@link GLTF}组件的属性进行映射。
  8484. *
  8485. * + model → {@link IGLTFComponentData.model}
  8486. * + cast-shadow → {@link IGLTFComponentData.castShadow}
  8487. * + receive-shadow → {@link IGLTFComponentData.receiveShadow}
  8488. *
  8489. */
  8490. export const GLTFDataMapping: {
  8491. model: string[]
  8492. 'cast-shadow': string[]
  8493. 'receive-shadow': string[]
  8494. 'never-cull': string[]
  8495. states: string[]
  8496. } & {
  8497. 'node-id': string[]
  8498. visible: string[]
  8499. layer: string[]
  8500. position: string[]
  8501. rotation: string[]
  8502. scale: string[]
  8503. } & {
  8504. [key: string]: string[]
  8505. }
  8506. /**
  8507. * 标签为`xr-gltf`。
  8508. * 不能在这个标签内放置子标签。
  8509. *
  8510. * 默认组件见{@link GLTFDefaultComponents},属性映射见{@link GLTFDataMapping}。
  8511. */
  8512. export default class XRGLTF extends XRShadow {
  8513. readonly defaultComponents: IEntityComponents
  8514. readonly dataMapping: {
  8515. [key: string]: string[]
  8516. }
  8517. }
  8518. }
  8519. declare module 'XrFrame/elements/xr-asset-material' {
  8520. /**
  8521. * xr-asset-material.ts
  8522. *
  8523. * * @Date : 2022/3/18下午5:27:37
  8524. */
  8525. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8526. export const AssetMaterialDefaultComponents: IEntityComponents
  8527. /**
  8528. * 将{@link AssetMaterial}的属性进行映射。
  8529. */
  8530. export const AssetMaterialDataMapping: {
  8531. 'asset-id': string[]
  8532. effect: string[]
  8533. marcos: string[]
  8534. uniforms: string[]
  8535. states: string[]
  8536. 'render-queue': string[]
  8537. 'env-data': string[]
  8538. } & {
  8539. [key: string]: string[]
  8540. }
  8541. /**
  8542. * 标签为`xr-asset-material`。
  8543. *
  8544. * 默认组件见{@link AssetMaterialDefaultComponents},属性映射见{@link AssetMaterialDataMapping}。
  8545. */
  8546. export default class XRAssetMaterial extends Element {
  8547. readonly defaultComponents: IEntityComponents
  8548. readonly dataMapping: {
  8549. [key: string]: string[]
  8550. }
  8551. }
  8552. }
  8553. declare module 'XrFrame/elements/xr-asset-render-texture' {
  8554. /**
  8555. * xr-asset-render-texture.ts
  8556. *
  8557. * * @Date : 8/29/2022, 12:51:29 PM
  8558. */
  8559. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8560. export const AssetRenderTextureDefaultComponents: IEntityComponents
  8561. /**
  8562. * 将{@link AssetRenderTexture}的属性进行映射。
  8563. */
  8564. export const AssetRenderTextureDataMapping: {
  8565. 'asset-id': string[]
  8566. width: string[]
  8567. height: string[]
  8568. 'is-hdr': string[]
  8569. } & {
  8570. [key: string]: string[]
  8571. }
  8572. /**
  8573. * 标签为`xr-asset-render-texture`。
  8574. *
  8575. * 默认组件见{@link AssetRenderTextureDefaultComponents},属性映射见{@link AssetRenderTextureDataMapping}。
  8576. */
  8577. export default class XRAssetRenderTexture extends Element {
  8578. readonly defaultComponents: IEntityComponents
  8579. readonly dataMapping: {
  8580. [key: string]: string[]
  8581. }
  8582. }
  8583. }
  8584. declare module 'XrFrame/elements/xr-asset-load' {
  8585. /**
  8586. * xr-asset-load.ts
  8587. *
  8588. * * @Date : 2022/3/16下午5:29:40
  8589. */
  8590. import Element from 'XrFrame/core/Element'
  8591. /**
  8592. * 将{@link AssetLoad}组件的属性进行映射。
  8593. */
  8594. export const AssetLoadDataMapping: {
  8595. type: string[]
  8596. 'asset-id': string[]
  8597. src: string[]
  8598. defer: string[]
  8599. options: string[]
  8600. } & {
  8601. [key: string]: string[]
  8602. }
  8603. /**
  8604. * 标签为`xr-asset-load`。
  8605. *
  8606. * 属性映射见{@link AssetLoadDataMapping}。
  8607. */
  8608. export default class XRAssetLoad extends Element {
  8609. readonly dataMapping: {
  8610. [key: string]: string[]
  8611. }
  8612. readonly neverTick: boolean
  8613. }
  8614. }
  8615. declare module 'XrFrame/elements/xr-assets' {
  8616. /**
  8617. * xr-assets.ts
  8618. *
  8619. * * @Date : 2022/3/16下午5:28:52
  8620. */
  8621. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8622. /**
  8623. * 默认包含{@link Assets}组件。
  8624. */
  8625. export const AssetsDefaultComponents: IEntityComponents
  8626. /**
  8627. * 标签为`xr-assets`。
  8628. *
  8629. * 默认组件见{@link AssetsDefaultComponents}。
  8630. */
  8631. export default class XRAssets extends Element {
  8632. readonly defaultComponents: IEntityComponents
  8633. readonly neverTick: boolean
  8634. }
  8635. }
  8636. declare module 'XrFrame/elements/xr-env' {
  8637. /**
  8638. * xr-env.ts
  8639. *
  8640. * * @Date : 5/12/2022, 12:56:19 PM
  8641. */
  8642. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8643. /**
  8644. * 默认包含{@link Env}组件。
  8645. */
  8646. export const EnvDefaultComponents: IEntityComponents
  8647. /**
  8648. * 默认将{@link Env}组件的属性进行映射。
  8649. */
  8650. export const EnvDataMapping: {
  8651. 'env-data': string[]
  8652. 'sky-map': string[]
  8653. 'is-sky2d': string[]
  8654. rotation: string[]
  8655. 'diffuse-exp': string[]
  8656. 'specular-exp': string[]
  8657. } & {
  8658. [key: string]: string[]
  8659. }
  8660. /**
  8661. * 标签为`xr-env`。
  8662. *
  8663. * 默认组件见{@link EnvDefaultComponents},属性映射见{@link EnvDataMapping}。
  8664. */
  8665. export default class XREnv extends Element {
  8666. readonly defaultComponents: IEntityComponents
  8667. readonly dataMapping: {
  8668. [key: string]: string[]
  8669. }
  8670. readonly neverTick: boolean
  8671. }
  8672. }
  8673. declare module 'XrFrame/elements/xr-ar-tracker' {
  8674. /**
  8675. * xr-ar-tracker.ts
  8676. *
  8677. * * @Date : 6/27/2022, 3:42:45 PM
  8678. */
  8679. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8680. /**
  8681. * 默认包含{@link XRNode}的所有默认组件,以及{@link ARTracker}组件。
  8682. */
  8683. export const ARTrackerDefaultComponents: IEntityComponents
  8684. /**
  8685. * 默认包含{@link XRNode}的所有属性映射,以及将{@link ARTracker}组件的属性进行映射。
  8686. */
  8687. export const ARTrackerDataMapping: {
  8688. mode: string[]
  8689. 'hit-id': string[]
  8690. image: string[]
  8691. src: string[]
  8692. 'auto-sync': string[]
  8693. } & {
  8694. 'node-id': string[]
  8695. visible: string[]
  8696. layer: string[]
  8697. position: string[]
  8698. rotation: string[]
  8699. scale: string[]
  8700. } & {
  8701. [key: string]: string[]
  8702. }
  8703. /**
  8704. * 标签为`xr-ar-tracker`。
  8705. *
  8706. * 默认组件见{@link ARTrackerDefaultComponents},属性映射见{@link ARTrackerDataMapping}。
  8707. */
  8708. export default class XRARTracker extends Element {
  8709. readonly defaultComponents: IEntityComponents
  8710. readonly dataMapping: {
  8711. [key: string]: string[]
  8712. }
  8713. }
  8714. }
  8715. declare module 'XrFrame/elements/xr-text' {
  8716. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8717. export const TextDefaultComponents: IEntityComponents
  8718. export const TextDataMapping: {
  8719. [key: string]: string[]
  8720. }
  8721. export default class XRText extends Element {
  8722. readonly defaultComponents: IEntityComponents
  8723. readonly dataMapping: {
  8724. [key: string]: string[]
  8725. }
  8726. }
  8727. }
  8728. declare module 'XrFrame/elements/xr-particle' {
  8729. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8730. export const ParticleDefaultComponents: IEntityComponents
  8731. export const ParticleDataMapping: {
  8732. [key: string]: string[]
  8733. }
  8734. export default class XRParticle extends Element {
  8735. readonly defaultComponents: IEntityComponents
  8736. readonly dataMapping: {
  8737. [key: string]: string[]
  8738. }
  8739. }
  8740. }
  8741. declare module 'XrFrame/elements/xr-asset-post-process' {
  8742. /**
  8743. * xr-asset-post-process.ts
  8744. *
  8745. * * @Date : 10/14/2022, 5:18:21 PM
  8746. */
  8747. import Element, { IEntityComponents } from 'XrFrame/core/Element'
  8748. export const AssetPostProcessDefaultComponents: IEntityComponents
  8749. /**
  8750. * 将{@link AssetPostProcess}的属性进行映射。
  8751. */
  8752. export const AssetPostProcessDataMapping: {
  8753. 'asset-id': string[]
  8754. type: string[]
  8755. 'is-hdr': string[]
  8756. data: string[]
  8757. } & {
  8758. [key: string]: string[]
  8759. }
  8760. /**
  8761. * 标签为`xr-asset-render-texture`。
  8762. *
  8763. * 默认组件见{@link AssetPostProcessDefaultComponents},属性映射见{@link AssetPostProcessDataMapping}。
  8764. */
  8765. export default class XRAssetPostProcess extends Element {
  8766. readonly defaultComponents: IEntityComponents
  8767. readonly dataMapping: {
  8768. [key: string]: string[]
  8769. }
  8770. }
  8771. }
  8772. declare module 'XrFrame/systems/AssetsSystem' {
  8773. import Component from 'XrFrame/core/Component'
  8774. import Element from 'XrFrame/core/Element'
  8775. import { IAssetLoadData, IAssetWithState } from 'XrFrame/loader/types'
  8776. export interface IAssetsSystemData {}
  8777. /**
  8778. * 资源系统,负责整个场景的资源管理。
  8779. *
  8780. * 一般不需要手动管理,而是利用{@link AssetLoad}、{@link registerGeometry}之类的使用。
  8781. */
  8782. export default class AssetsSystem extends Component<IAssetsSystemData> {
  8783. readonly priority: number
  8784. /**
  8785. * 手动添加一个资源。
  8786. */
  8787. addAsset<T>(type: string, id: string, asset: T): void
  8788. /**
  8789. * 手动加载一个资源。
  8790. */
  8791. loadAsset(
  8792. params: IAssetLoadData,
  8793. parent?: Element
  8794. ): Promise<IAssetWithState<any>>
  8795. /**
  8796. * 手动释放一个资源。
  8797. *
  8798. * 注意在`xml`里加载的资源不要手动释放。
  8799. */
  8800. releaseAsset(type: string, id: string): void
  8801. /**
  8802. * 获取一个资源,如果尚未加载完成,也会返回`undefined`。
  8803. */
  8804. getAsset<T>(type: string, id: string, fallback?: string): T
  8805. /**
  8806. * 获取一个资源以及加载状态。
  8807. */
  8808. getAssetWithState<T>(
  8809. type: string,
  8810. id: string,
  8811. fallback?: string
  8812. ): IAssetWithState<T>
  8813. /**
  8814. * 取消加载一个资源。
  8815. */
  8816. cancelAsset(type: string, id: string): void
  8817. /**
  8818. * @internal
  8819. */
  8820. /**
  8821. * @internal
  8822. */
  8823. onRelease(data: IAssetsSystemData): void
  8824. }
  8825. }
  8826. declare module 'XrFrame/systems/NodeSystem' {
  8827. import Component from 'XrFrame/core/Component'
  8828. export interface INodeSystemData {}
  8829. /**
  8830. * 节点系统,负责整个场景节点的管理。
  8831. */
  8832. export default class NodeSystem extends Component<INodeSystemData> {
  8833. readonly priority: number
  8834. onTick(deltaTime: number, data: INodeSystemData): void
  8835. }
  8836. }
  8837. declare module 'XrFrame/systems/TickSystem' {
  8838. /**
  8839. * TickSystem.ts
  8840. *
  8841. * * @Date : 2022/3/29上午10:50:57
  8842. */
  8843. import Component from 'XrFrame/core/Component'
  8844. export interface ITickSystemData {}
  8845. /**
  8846. * Tick系统,负责整个场景生命周期的驱动。
  8847. */
  8848. export default class TickSystem extends Component<ITickSystemData> {
  8849. readonly priority: number
  8850. onTick(deltaTime: number, data: ITickSystemData): void
  8851. }
  8852. }
  8853. declare module 'XrFrame/systems/AnimationSystem' {
  8854. /**
  8855. * AnimationSystem.ts
  8856. *
  8857. * * @Date : 6/17/2022, 2:35:17 PM
  8858. */
  8859. import Animator from 'XrFrame/components/Animator'
  8860. import Component from 'XrFrame/core/Component'
  8861. export interface IAnimationSystemData {}
  8862. /**
  8863. * 动画系统,负责整个场景动画的管理。
  8864. */
  8865. export default class AnimationSystem extends Component<IAnimationSystemData> {
  8866. readonly priority: number
  8867. onTick(deltaTime: number, data: IAnimationSystemData): void
  8868. /**
  8869. * @internal
  8870. */
  8871. /**
  8872. * @internal
  8873. */
  8874. }
  8875. }
  8876. declare module 'XrFrame/systems/VideoSystem' {
  8877. /**
  8878. * VideoSystem.ts
  8879. *
  8880. * * @Date : 8/26/2022, 8:02:21 PM
  8881. */
  8882. import VideoTexture from 'XrFrame/assets/VideoTexture'
  8883. import Component from 'XrFrame/core/Component'
  8884. import { Element } from 'XrFrame/xrFrameSystem'
  8885. export interface IVideoSystemData {}
  8886. /**
  8887. * 视频系统,负责整个场景视频的管理。
  8888. */
  8889. export default class VideoSystem extends Component<IVideoSystemData> {
  8890. readonly priority: number
  8891. onAdd(parent: Element, data: IVideoSystemData): void
  8892. onTick(deltaTime: number, data: IVideoSystemData): void
  8893. onRelease(data: IVideoSystemData): void
  8894. /**
  8895. * @internal
  8896. */
  8897. /**
  8898. * @internal
  8899. */
  8900. }
  8901. }
  8902. declare module 'XrFrame/systems/RenderSystem' {
  8903. /**
  8904. * RenderSystem.ts
  8905. *
  8906. * * @Date : 2022/3/16下午4:20:58
  8907. */
  8908. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  8909. import Element from 'XrFrame/core/Element'
  8910. import Camera from 'XrFrame/components/Camera'
  8911. import Env from 'XrFrame/components/Env'
  8912. import RenderGraph from 'XrFrame/render-graph/RenderGraph'
  8913. import LightManager from 'XrFrame/systems/LightManager'
  8914. import Observable from 'XrFrame/core/Observable'
  8915. /**
  8916. * `RenderSystem`系统数据接口。
  8917. */
  8918. export interface IRenderSystemData {
  8919. /**
  8920. * 是否支持画布输出透明通道,并且能够和背景混合。
  8921. * `xml`中数据类型为`boolean`。
  8922. */
  8923. alpha: boolean
  8924. /**
  8925. * 场景中阴影的颜色。
  8926. * `xml`中数据类型为`color`。
  8927. */
  8928. shadowColor: number[]
  8929. }
  8930. /**
  8931. * {@link RenderSystem}的`schema`,详见{@link IRenderSystemData}。
  8932. */
  8933. export const RenderSystemSchema: IComponentSchema
  8934. /**
  8935. * 渲染系统,负责整个场景渲染的管理。
  8936. */
  8937. export default class RenderSystem extends Component<IRenderSystemData> {
  8938. readonly priority: number
  8939. /**
  8940. * 详见{@link RenderSystemSchema}。
  8941. */
  8942. readonly schema: IComponentSchema
  8943. protected _lights: LightManager
  8944. protected _renderGraph?: RenderGraph
  8945. protected _sortedCameras: Camera[]
  8946. protected _dirtyCameras: Camera[]
  8947. protected _features: {
  8948. [key: string]: boolean | number | string
  8949. }
  8950. protected _dirtyFeatures: {
  8951. [key: string]: boolean | number | string
  8952. }
  8953. protected _camerasChangeEvent: Observable<this>
  8954. protected _env: Env
  8955. /**
  8956. * @internal
  8957. */
  8958. get lights(): LightManager
  8959. /**
  8960. * @internal
  8961. */
  8962. get env(): Env
  8963. /**
  8964. * @internal
  8965. */
  8966. get camerasChangeEvent(): Observable<this, any>
  8967. /**
  8968. * 获取场景中的所有相机,已按照深度排序。
  8969. *
  8970. * @internal
  8971. */
  8972. get cameras(): Camera[]
  8973. /**
  8974. * 获取场景中的所有当帧修改过的相机,已按照深度排序。
  8975. *
  8976. * @internal
  8977. */
  8978. get changedCameras(): Camera[]
  8979. /**
  8980. * 当前正在使用的RenderGraph。
  8981. */
  8982. get renderGraph(): RenderGraph<any>
  8983. get shadowColor(): number[]
  8984. /**
  8985. * 修改全局宏信息。
  8986. */
  8987. changeMacros(macros: {
  8988. [name: string]: string | number | boolean
  8989. }): void
  8990. /**
  8991. * 获取全局宏信息。
  8992. */
  8993. getMacro(key: string): string | number | boolean
  8994. /**
  8995. * 修改全局渲染特性。
  8996. */
  8997. changeFeatures(features: {
  8998. [key: string]: string | number | boolean
  8999. }): void
  9000. /**
  9001. * 获取全局渲染特性。
  9002. */
  9003. getFeature(key: string): boolean | number | string
  9004. onAdd(parent: Element, data: IRenderSystemData): void
  9005. onTick(): void
  9006. onRelease(data: IRenderSystemData): void
  9007. /**
  9008. * 使用某个RenderGraph,默认会使用内置的`ForwardBaseRG`。
  9009. */
  9010. useRenderGraph(rg: RenderGraph): void
  9011. /**
  9012. * 开启全局GPU实例化。
  9013. */
  9014. enableInstance(): void
  9015. /**
  9016. * 关闭全局GPU实例化。
  9017. */
  9018. disableInstance(): void
  9019. /**
  9020. * @internal
  9021. */
  9022. /**
  9023. * @internal
  9024. */
  9025. /**
  9026. * @internal
  9027. */
  9028. protected _sortCameras(): void
  9029. }
  9030. }
  9031. declare module 'XrFrame/systems/PhysicsSystem' {
  9032. import { Camera } from 'XrFrame/components'
  9033. import Component from 'XrFrame/core/Component'
  9034. import { Kanata } from 'XrFrame/ext'
  9035. import Vector3 from 'XrFrame/math/vector3'
  9036. import { RaycastDesc } from 'XrFrame/physics/raycast'
  9037. import Element from 'XrFrame/core/Element'
  9038. import Shape from 'XrFrame/components/physics/Shape'
  9039. /**
  9040. * `touch-shape`和`untouch-shape`事件的回调参数。
  9041. */
  9042. export interface IShapeTouchEvent {
  9043. /**
  9044. * 渲染*被选中的{@link Shape | 轮廓}*的相机。
  9045. */
  9046. camera: Camera
  9047. /**
  9048. * *被选中的{@link Shape | 轮廓}*所在的元素。
  9049. */
  9050. target: Element
  9051. /**
  9052. * 被选中的{@link Shape | 轮廓}。
  9053. */
  9054. shape: Shape
  9055. /**
  9056. * 点击位置在二维canvas中的x坐标。
  9057. */
  9058. x: number
  9059. /**
  9060. * 点击位置在二维canvas中的y坐标。
  9061. */
  9062. y: number
  9063. /**
  9064. * {@link camera}在三维场景中的位置。
  9065. */
  9066. origin: [number, number, number]
  9067. /**
  9068. * 从{@link camera}投射出的射线的单位向量。
  9069. */
  9070. dir: [number, number, number]
  9071. /**
  9072. * @unimplemented
  9073. */
  9074. force: number
  9075. }
  9076. /**
  9077. * `drag-shape`事件的回调参数。
  9078. */
  9079. export interface IShapeDragEvent extends IShapeTouchEvent {
  9080. /**
  9081. * 点击位置在二维canvas中的x坐标的变化量。
  9082. */
  9083. deltaX: number
  9084. /**
  9085. * 点击位置在二维canvas中的y坐标的变化量。
  9086. */
  9087. deltaY: number
  9088. }
  9089. /**
  9090. * @see {@link PhysicsSystem}
  9091. */
  9092. export interface IPhysicsSystemData {}
  9093. /**
  9094. * 物理系统,管理着场景中的所有{@link Shape | 轮廓}和{@link Rigidbody | 刚体}。
  9095. */
  9096. export default class PhysicsSystem extends Component<IPhysicsSystemData> {
  9097. /**
  9098. * @internal
  9099. */
  9100. nativeSystem: phys3D.PhysSystem
  9101. /**
  9102. * 是否进行物理模拟。
  9103. */
  9104. enableSimulation: boolean
  9105. constructor()
  9106. /** @internal */
  9107. addShape(shape: Shape): void
  9108. /** @internal */
  9109. removeShape(shape: Shape): void
  9110. onAdd(): void
  9111. maxPhysicsDeltaTime: number
  9112. fixedDeltaTime: number
  9113. /**
  9114. * @internal
  9115. */
  9116. onTick(dt: number, data: IPhysicsSystemData): void
  9117. /**
  9118. * @internal
  9119. */
  9120. bindRigidbodyWithEntity(
  9121. rigidbody: phys3D.Rigidbody,
  9122. entity: Kanata.Entity3D
  9123. ): void
  9124. /**
  9125. * @internal
  9126. */
  9127. unbindRigidbody(rigidbody: phys3D.Rigidbody): void
  9128. /**
  9129. * 射线检测,判断给定射线是否与至少一个轮廓相交,并返回与**最近**的那个轮廓相交的信息。
  9130. * 返回的信息记录在desc.hit里,需要事先创建一个RaycastHit对象来负责接收。
  9131. */
  9132. raycast(desc: RaycastDesc): boolean
  9133. /**
  9134. * 全局重力。
  9135. * @default [0, -9.8, 0]
  9136. */
  9137. get gravity(): Vector3
  9138. set gravity(v: Vector3)
  9139. /**
  9140. * 设置碰撞矩阵。
  9141. * @param str 用于表达碰撞矩阵的字符串
  9142. * @internal
  9143. */
  9144. setCollisionMatrix(str: string): void
  9145. /**
  9146. * 设定某一对layer之间是否会发生碰撞。
  9147. * @param ignore `true`表示**不**碰撞。
  9148. */
  9149. ignoreLayerCollision(
  9150. layer1: number,
  9151. layer2: number,
  9152. ignore?: boolean
  9153. ): void
  9154. }
  9155. }
  9156. declare module 'XrFrame/systems/ARSystem' {
  9157. import { Camera, Mesh } from 'XrFrame/components'
  9158. import ARTracker, { TTrackMode } from 'XrFrame/components/ARTracker'
  9159. import Component, { IComponentSchema } from 'XrFrame/core/Component'
  9160. import Matrix4 from 'XrFrame/math/matrix4'
  9161. import Vector3 from 'XrFrame/math/vector3'
  9162. type Element = import('XrFrame/core/Element').default
  9163. /**
  9164. * AR追踪原始数据。
  9165. */
  9166. export interface IARRawData {
  9167. /**
  9168. * 该帧生成时间,单位是纳秒(ns)。
  9169. * 在版本`v2.30.1`之后支持。
  9170. */
  9171. timestamp: number
  9172. /**
  9173. * 当前相机帧画面宽度。
  9174. */
  9175. width: number
  9176. /**
  9177. * 当前相机帧画面高度。
  9178. */
  9179. height: number
  9180. /**
  9181. * 当前相机帧画面`y`通道,yuv420。
  9182. */
  9183. yBuffer: ArrayBuffer
  9184. /**
  9185. * 当前相机帧画面`uv`通道,yuv420。
  9186. */
  9187. uvBuffer: ArrayBuffer
  9188. /**
  9189. * 当前相机帧内参矩阵。
  9190. */
  9191. intrinsics: Float32Array
  9192. /**
  9193. * 当前相机帧视图矩阵。
  9194. */
  9195. viewMatrix: Float32Array
  9196. }
  9197. /**
  9198. * `ARSystem`系统数据接口。
  9199. */
  9200. export interface IARSystemData {
  9201. /**
  9202. * 系统支持的追踪模式,目前仅支持一个!
  9203. * `xml`中数据类型为`array`,默认值为`Plane`。
  9204. */
  9205. modes: TTrackMode[]
  9206. /**
  9207. * 使用前置还是后置相机,默认后置`Back`。
  9208. */
  9209. camera?: 'Front' | 'Back'
  9210. /**
  9211. * 在支持的情况下,是否开启实时深度遮挡。
  9212. * **目前暂时不可用!**
  9213. */
  9214. depthMask?: boolean
  9215. /**
  9216. * 开启实时深度遮挡时,遮挡的近处阈值。
  9217. * 值是空间实际尺度(m),默认为`0.02`。
  9218. */
  9219. depthNear?: number
  9220. /**
  9221. * 开启实时深度遮挡时,遮挡的远处阈值。
  9222. * 值是空间实际尺度(m),默认为`20`。
  9223. */
  9224. depthFar?: number
  9225. /**
  9226. * 开启实时深度遮挡时,显示一个用于Debug的图层。
  9227. * **目前暂时不可用!**
  9228. */
  9229. depthDebug?: boolean
  9230. /**
  9231. * 在`v2`平面模式下,平面检测模式。
  9232. * `1`为水平面,`2`为垂直平面,`3`为两个都支持。
  9233. * 默认为`3`。
  9234. */
  9235. planeMode?: number
  9236. /**
  9237. * 在`Face`/`Body`/`Hand`模式下,使用原生的AI3D推理估计。
  9238. * 默认为`false`。
  9239. * **目前暂时不可用!**
  9240. */
  9241. pose3d?: boolean
  9242. }
  9243. /**
  9244. * {@link ARSystem}的`schema`,详见{@link IARSystemData}。
  9245. */
  9246. export const ARSystemSchema: IComponentSchema
  9247. /**
  9248. * AR系统,负责整个场景AR相关对象的管理。
  9249. *
  9250. * 代理自小程序的`VKSession`。
  9251. */
  9252. export default class ARSystem extends Component<IARSystemData> {
  9253. static EVENTS: string[]
  9254. /**
  9255. * 详见{@link ARSystemSchema}。
  9256. */
  9257. readonly schema: IComponentSchema
  9258. readonly priority: number
  9259. /**
  9260. * 当前设备是否启动成功。
  9261. */
  9262. get supported(): boolean
  9263. /**
  9264. * 当前启动的追踪模式。
  9265. */
  9266. get arModes(): TTrackMode[]
  9267. /**
  9268. * 当前启动的AR系统版本。
  9269. */
  9270. get arVersion(): number
  9271. /**
  9272. * 当前是否已经可用。
  9273. */
  9274. get ready(): boolean
  9275. /**
  9276. * 在`Face`/`Body`/`Hand`模式下,当前识别到的姿态数量。
  9277. */
  9278. get posCount(): number
  9279. onAdd(parent: Element, data: IARSystemData): void
  9280. onTick(deltaTime: number, data: IARSystemData): void
  9281. onUpdate(data: IARSystemData, preData: IARSystemData): void
  9282. onRemove(parent: Element, data: IARSystemData): void
  9283. onRelease(data: IARSystemData): void
  9284. /**
  9285. * 在`Plane`模式下,同步某个节点到当前追踪到的和平面的交点。
  9286. *
  9287. * @param nodeIdOrElement 节点的`nodeId`或是`element`引用。
  9288. * @param switchVisible 是否要自动切换显示或隐藏。
  9289. * @returns 是否放置成功
  9290. */
  9291. placeHere(
  9292. nodeIdOrElement: string | Element,
  9293. switchVisible?: boolean
  9294. ): boolean
  9295. /**
  9296. * 在`Plane`模式下,重置平面。
  9297. */
  9298. resetPlane(): void
  9299. /**
  9300. * 获取AR的追踪的原始数据。
  9301. */
  9302. getARRawData(): IARRawData
  9303. /**
  9304. * 提供一个修改某个设置为`isARCamera`的相机的试图矩阵的手段。
  9305. */
  9306. forceSetViewMatrix(camera: Camera, mat: Matrix4 | null): void
  9307. /**
  9308. * @internal
  9309. */
  9310. /**
  9311. * @internal
  9312. */
  9313. /**
  9314. * @internal
  9315. */
  9316. /**
  9317. * @internal
  9318. */
  9319. /**
  9320. * @internal
  9321. */
  9322. /**
  9323. * @internal
  9324. */
  9325. /**
  9326. * @internal
  9327. */
  9328. }
  9329. export {}
  9330. }
  9331. declare module 'XrFrame/systems/ShareSystem' {
  9332. /**
  9333. * ShareSystem.ts
  9334. *
  9335. * * @Date : 9/19/2022, 5:04:24 PM
  9336. */
  9337. import Component from 'XrFrame/core/Component'
  9338. export interface IShareSystemData {}
  9339. /**
  9340. * 分享到临时文件的配置。
  9341. */
  9342. export interface IShareCaptureOptions {
  9343. /**
  9344. * 输出图片编码。
  9345. * @default 'jpg'
  9346. */
  9347. fileType?: 'jpg' | 'png'
  9348. /**
  9349. * 输出图片jpg时的品质,0~1。
  9350. * @default 0.8
  9351. */
  9352. quality?: number
  9353. }
  9354. /**
  9355. * 分享录屏的配置。
  9356. */
  9357. export interface IShareRecordOptions {
  9358. /**
  9359. * 输出帧率。
  9360. * @default 30
  9361. */
  9362. fps?: number
  9363. /**
  9364. * 视频比特率。
  9365. * @default 1000
  9366. */
  9367. videoBitsPerSecond?: number
  9368. /**
  9369. * 录制视频宽度,不传的话使用Canvas宽度。
  9370. */
  9371. width?: number
  9372. /**
  9373. * 录制视频高度,不传的话使用Canvas高度。
  9374. */
  9375. height?: number
  9376. }
  9377. /**
  9378. * 录屏状态枚举。
  9379. */
  9380. export enum EShareRecordState {
  9381. Idle = 0,
  9382. Waiting = 1,
  9383. Recording = 2,
  9384. Paused = 3
  9385. }
  9386. /**
  9387. * 分享系统,负责分享相关功能。
  9388. */
  9389. export default class ShareSystem extends Component<IShareSystemData> {
  9390. readonly priority: number
  9391. /**
  9392. * 当前是否支持分享系统。
  9393. */
  9394. get supported(): boolean
  9395. /**
  9396. * 当前录屏状态。
  9397. */
  9398. get recordState(): EShareRecordState
  9399. onTick(deltaTime: number, data: IShareSystemData): void
  9400. /**
  9401. * @deprecated 请在`v3.0.2`后使用异步版本,同步版本不再维护,请使用`captureToDataURLAsync`。
  9402. * 截屏输出为`base64`。
  9403. */
  9404. captureToDataURL(options?: IShareCaptureOptions): string
  9405. /**
  9406. * @deprecated 请在`v3.0.2`后使用异步版本,同步版本不再维护,请使用`captureToArrayBufferAsync`。
  9407. * 截屏输出为`ArrayBuffer`。
  9408. */
  9409. captureToArrayBuffer(options?: IShareCaptureOptions): ArrayBuffer
  9410. /**
  9411. * 截屏输出为`base64`。
  9412. * 基础库`v3.0.2`以上版本支持。
  9413. */
  9414. captureToDataURLAsync(options?: IShareCaptureOptions): Promise<string>
  9415. /**
  9416. * 截屏输出为`ArrayBuffer`。
  9417. * 基础库`v3.0.2`以上版本支持。
  9418. */
  9419. captureToArrayBufferAsync(
  9420. options?: IShareCaptureOptions
  9421. ): Promise<ArrayBuffer>
  9422. /**
  9423. * 截屏输出为本地路径,回调完成后会自动释放。
  9424. *
  9425. * @params callback 接受结果的回调,处理完后会释放文件。在v2.27.1前是异步,之后兼容同步和异步。
  9426. */
  9427. captureToLocalPath(
  9428. options: IShareCaptureOptions,
  9429. callback: (fp: string) => Promise<void> | void
  9430. ): Promise<void>
  9431. /**
  9432. * 直接截屏分享给好友。
  9433. */
  9434. captureToFriends(options?: IShareCaptureOptions): Promise<void>
  9435. /**
  9436. * 启动录屏。
  9437. * 基础库`v3.1.1`以上版本支持。
  9438. */
  9439. recordStart(options?: IShareRecordOptions): Promise<void>
  9440. /**
  9441. * 暂停本次录屏。
  9442. * 基础库`v3.1.1`以上版本支持。
  9443. */
  9444. recordPause(): Promise<void>
  9445. /**
  9446. * 唤醒本次录屏。
  9447. */
  9448. recordResume(): Promise<void>
  9449. /**
  9450. * 录屏完成,输出到临时文件。
  9451. * 基础库`v3.1.1`以上版本支持。
  9452. *
  9453. * @returns 临时文件地址
  9454. */
  9455. recordFinishToTempFile(): Promise<string>
  9456. /**
  9457. * 录屏完成,直接保存到用户相册。
  9458. * 基础库`v3.1.1`以上版本支持。
  9459. */
  9460. recordFinishToAlbum(): Promise<void>
  9461. }
  9462. }
  9463. declare module 'XrFrame/systems/GizmoSystem' {
  9464. /**
  9465. * @author shanexyzhou@tencent.com
  9466. */
  9467. import CapsuleGizmo from 'XrFrame/components/gizmo/CapsuleGizmo'
  9468. import CubeGizmo from 'XrFrame/components/gizmo/CubeGizmo'
  9469. import Component from 'XrFrame/core/Component'
  9470. import Element from 'XrFrame/core/Element'
  9471. export interface IGizmoSystemData {}
  9472. type GizmoComponent = CubeGizmo | CapsuleGizmo
  9473. /**
  9474. * 动画系统,负责为Gizmo组件创建管理相对应的GizmoMesh元素。
  9475. */
  9476. export default class GizmoSystem extends Component<IGizmoSystemData> {
  9477. readonly priority: number
  9478. onTick(deltaTime: number, data: IGizmoSystemData): void
  9479. /**
  9480. * @internal
  9481. * 因为exparser的原因,不能通过脚本为普通xml节点添加子节点,
  9482. * 只能给XRShadow添加子节点,所以把需要添加gizmo的节点复制一份放在shadowRoot下,
  9483. * 每帧去同步transform。
  9484. */
  9485. addGizmo(gizmo: GizmoComponent): Element
  9486. /**
  9487. * @internal
  9488. */
  9489. removeGizmo(gizmo: GizmoComponent): void
  9490. }
  9491. export {}
  9492. }
  9493. declare module 'XrFrame/loader/AssetLoader' {
  9494. import { IAssetLoadData } from 'XrFrame/loader/types'
  9495. type Scene = import('XrFrame/core/Scene').default
  9496. /**
  9497. * 指定继承自{@link AssetLoader}的自定义资源加载器,可以接受的的额外配置的`schema`。
  9498. * 在基础库版本**v2.29.2**以上导出。
  9499. *
  9500. * 比如使用{@link CubeTextureLoader}加载资源时:
  9501. *
  9502. * ```xml
  9503. * <xr-asset-load
  9504. * type="cube-texture" asset-id="sky-cube" src="/assets/textures/skybox/"
  9505. * options="faces: right.jpg left.jpg top.jpg bottom.jpg front.jpg back.jpg"
  9506. * />
  9507. * ```
  9508. *
  9509. * 对应的`schema`接口为:
  9510. * ```ts
  9511. * export interface ICubeTextureLoaderOptions {
  9512. * // left right top bottom front back
  9513. * faces: string[];
  9514. * }
  9515. * ```ts
  9516. *
  9517. * 对应的`schema`为:
  9518. * ```ts
  9519. * schema = {
  9520. * faces: {type: 'array'}
  9521. * };
  9522. * ```
  9523. */
  9524. export interface ILoaderOptionsSchema {
  9525. [key: string]: {
  9526. type: string
  9527. defaultValue?: any
  9528. }
  9529. }
  9530. /**
  9531. * 资源加载器的基类,配合{@link AssetsSystem}使用。
  9532. * 在基础库版本**v2.29.2**以上导出。
  9533. *
  9534. * @template T 加载资源的类型。
  9535. * @template ILoadOptions 可接受额外配置的类型。
  9536. */
  9537. export default class AssetLoader<T, ILoadOptions> {
  9538. /**
  9539. * 和{@link Component.schema}类似,指定解析Options的实际`schema`,对应于`ILoadOptions`。
  9540. */
  9541. readonly schema: ILoaderOptionsSchema
  9542. /**
  9543. * 当前资源所属场景的实例。
  9544. */
  9545. get scene(): import('XrFrame/core/Scene').default
  9546. constructor(_scene: Scene, type: string)
  9547. /**
  9548. * @internal
  9549. */
  9550. /**
  9551. * 加载一个资源,并根据情况执行`callbacks`中的回调。
  9552. * **理论上必须要实现!**
  9553. *
  9554. * @param callbacks 开发者需要在加载进度更新时执行`onLoading`,在加载完成时执行`onLoaded`,在加载出错是执行`onError`
  9555. */
  9556. load(
  9557. data: IAssetLoadData<ILoadOptions>,
  9558. callbacks: {
  9559. onLoading(progress: number): void
  9560. onLoaded(result: T, localPath?: string): void
  9561. onError(error: Error): void
  9562. }
  9563. ): void
  9564. /**
  9565. * 取消加载特定资源。一般不需要自己编写逻辑,而是使用`entity.canceled`在加载终点丢弃。
  9566. * 注意`entity.canceled`是在这里赋值的,所以一般继承请务必先执行`super.cancel()`!
  9567. */
  9568. cancel(params: IAssetLoadData<ILoadOptions>): void
  9569. /**
  9570. * 释放资源时将会调用,用于自定义释放逻辑。
  9571. */
  9572. release(params: IAssetLoadData<ILoadOptions>, value: T): void
  9573. /**
  9574. * 返回默认资源列表。
  9575. * 所有默认资源都是惰性加载的。
  9576. */
  9577. getBuiltin(): Array<{
  9578. assetId: string
  9579. src: string
  9580. options: ILoadOptions
  9581. }>
  9582. }
  9583. export function getAssetLoaderTypes(): string[]
  9584. export function getAssetLoader(
  9585. type: string
  9586. ): new (
  9587. scene: import('XrFrame/core/Scene').default,
  9588. type: string
  9589. ) => AssetLoader<any, any>
  9590. /**
  9591. * 注册一个资源加载器。注意注册后该`type`会被自动注册到DataValue中:{@link registerDataValue}。
  9592. * 在基础库版本**v2.29.2**以上导出。
  9593. *
  9594. * @param type 类型,也是写在{@link AssetLoad}上的那个`type`。
  9595. * @param clz 继承自{@link AssetLoader}的自定义资源加载器类。
  9596. */
  9597. export function registerAssetLoader(
  9598. type: string,
  9599. clz: new (scene: Scene, type: string) => AssetLoader<any, any>
  9600. ): void
  9601. export {}
  9602. }
  9603. declare module 'XrFrame/loader/TextureLoader' {
  9604. /**
  9605. * TextureLoader.ts
  9606. *
  9607. * * @Date : 2022/4/1下午5:19:36
  9608. */
  9609. import { Kanata } from 'XrFrame/ext'
  9610. import AssetLoader, {
  9611. ILoaderOptionsSchema
  9612. } from 'XrFrame/loader/AssetLoader'
  9613. import { IAssetLoadData } from 'XrFrame/loader/types'
  9614. export function isPOT(img: Kanata.IImage): boolean
  9615. /**
  9616. * {@link TextureLoader}可接受的自定义参数`schema`。
  9617. */
  9618. export interface ITextureLoaderOptions {
  9619. /**
  9620. * 各向异性系数。
  9621. * @default 1
  9622. */
  9623. anisoLevel?: number
  9624. /**
  9625. * wrapU,值为数字,见{@link EWrapMode}。
  9626. * @default 2
  9627. */
  9628. wrapU?: number
  9629. /**
  9630. * wrapV,值为数字,见{@link EWrapMode}。
  9631. * @default 2
  9632. */
  9633. wrapV?: number
  9634. /**
  9635. * magFilter,值为数字,见{@link EFilterMode}。
  9636. * 默认值依据纹理是否POT而定。
  9637. */
  9638. magFilter?: number
  9639. /**
  9640. * minFilter,值为数字,见{@link EFilterMode}。
  9641. * 默认值依据纹理是否POT而定。
  9642. */
  9643. minFilter?: number
  9644. /**
  9645. * 是否要生成mipmaps。
  9646. * @default false
  9647. */
  9648. generateMipmaps?: boolean
  9649. }
  9650. type ITextureLoadData = IAssetLoadData<ITextureLoaderOptions>
  9651. /**
  9652. * 纹理资源{@link Texture}的加载器。
  9653. *
  9654. * 内置资源可以通过{@link registerTexture}注册,拥有内置资源`brdf-lut`、`white`、`transparent`、`black`、`red`、`green`、`blue`、`yellow`、`babyblue`、`babygreen`、`babyred`。
  9655. */
  9656. export default class TextureLoader extends AssetLoader<
  9657. Kanata.Texture,
  9658. ITextureLoaderOptions
  9659. > {
  9660. readonly schema: ILoaderOptionsSchema
  9661. load(
  9662. params: ITextureLoadData,
  9663. callbacks: {
  9664. onLoading(progress: number): void
  9665. onLoaded(value: Kanata.Texture): void
  9666. onError(error: Error): void
  9667. }
  9668. ): void
  9669. getBuiltin(): Array<{
  9670. assetId: string
  9671. src: string
  9672. options: {}
  9673. }>
  9674. release(params: ITextureLoadData, value: Kanata.Texture): void
  9675. }
  9676. export {}
  9677. }
  9678. declare module 'XrFrame/loader/ImageLoader' {
  9679. /**
  9680. * ImageLoader.ts
  9681. *
  9682. * * @Date : 6/13/2022, 12:40:11 PM
  9683. */
  9684. import { Kanata } from 'XrFrame/ext'
  9685. import AssetLoader, {
  9686. ILoaderOptionsSchema
  9687. } from 'XrFrame/loader/AssetLoader'
  9688. import { IAssetLoadData } from 'XrFrame/loader/types'
  9689. export interface IImageLoaderOptions {}
  9690. type IImageLoadData = IAssetLoadData<IImageLoaderOptions>
  9691. /**
  9692. * 图片数据资源{@link IImage}的加载器。
  9693. *
  9694. * 图片数据不同于纹理资源{@link Texture},请自行按照场景使用。
  9695. */
  9696. export default class ImageLoader extends AssetLoader<
  9697. Kanata.IImage,
  9698. IImageLoaderOptions
  9699. > {
  9700. readonly schema: ILoaderOptionsSchema
  9701. load(
  9702. params: IImageLoadData,
  9703. callbacks: {
  9704. onLoading(progress: number): void
  9705. onLoaded(value: Kanata.IImage): void
  9706. onError(error: Error): void
  9707. }
  9708. ): void
  9709. release(params: IImageLoadData, value: Kanata.IImage): void
  9710. }
  9711. export {}
  9712. }
  9713. declare module 'XrFrame/loader/CubeTextureLoader' {
  9714. /**
  9715. * CubeCubeTextureLoader.ts
  9716. *
  9717. * * @Date : 5/10/2022, 11:24:51 AM
  9718. */
  9719. import { Kanata } from 'XrFrame/ext'
  9720. import AssetLoader, {
  9721. ILoaderOptionsSchema
  9722. } from 'XrFrame/loader/AssetLoader'
  9723. import { IAssetLoadData } from 'XrFrame/loader/types'
  9724. /**
  9725. * {@link CubeTextureLoader}可接受的自定义参数`schema`。
  9726. */
  9727. export interface ICubeTextureLoaderOptions {
  9728. /**
  9729. * 顺序为 left right top bottom front back。
  9730. */
  9731. faces: string[]
  9732. /**
  9733. * 各向异性系数。
  9734. * @default 1
  9735. */
  9736. anisoLevel: number
  9737. /**
  9738. * wrapU,值为数字,见{@link EWrapMode}。
  9739. * @default 2
  9740. */
  9741. wrapU?: number
  9742. /**
  9743. * wrapV,值为数字,见{@link EWrapMode}。
  9744. * @default 2
  9745. */
  9746. wrapV?: number
  9747. /**
  9748. * wrapW,值为数字,见{@link EWrapMode}。
  9749. * @default 2
  9750. */
  9751. wrapW?: number
  9752. /**
  9753. * magFilter,值为数字,见{@link EFilterMode}。
  9754. * 默认值依据纹理是否POT而定。
  9755. */
  9756. magFilter?: number
  9757. /**
  9758. * minFilter,值为数字,见{@link EFilterMode}。
  9759. * 默认值依据纹理是否POT而定。
  9760. */
  9761. minFilter?: number
  9762. /**
  9763. * 是否要生成mipmaps。
  9764. * @default false
  9765. */
  9766. generateMipmaps?: boolean
  9767. }
  9768. type ICubeTextureLoadData = IAssetLoadData<ICubeTextureLoaderOptions>
  9769. /**
  9770. * 立方体资源{@link CubeTexture}的加载器。
  9771. *
  9772. * 内置资源可以通过{@link registerTextureCube}注册,拥有内置资源`brdf-lut`、`white`、`transparent`、`black`、`red`、`green`、`blue`、`yellow`。
  9773. */
  9774. export default class CubeTextureLoader extends AssetLoader<
  9775. Kanata.Texture,
  9776. ICubeTextureLoaderOptions
  9777. > {
  9778. /**
  9779. * 详见{@link ICubeTextureLoaderOptions}。
  9780. */
  9781. readonly schema: ILoaderOptionsSchema
  9782. load(
  9783. params: ICubeTextureLoadData,
  9784. callbacks: {
  9785. onLoading(progress: number): void
  9786. onLoaded(value: Kanata.Texture): void
  9787. onError(error: Error): void
  9788. }
  9789. ): void
  9790. release(params: ICubeTextureLoadData, value: Kanata.Texture): void
  9791. }
  9792. export {}
  9793. }
  9794. declare module 'XrFrame/loader/VideoTextureLoader' {
  9795. /**
  9796. * VideoTextureLoader.ts
  9797. *
  9798. * * @Date : 8/26/2022, 8:02:51 PM
  9799. */
  9800. import VideoTexture from 'XrFrame/assets/VideoTexture'
  9801. import AssetLoader, {
  9802. ILoaderOptionsSchema
  9803. } from 'XrFrame/loader/AssetLoader'
  9804. import { IAssetLoadData } from 'XrFrame/loader/types'
  9805. /**
  9806. * {@link VideoTextureLoader}可接受的自定义参数`schema`。
  9807. *
  9808. * 基本同{@link IVideoTextureOptions}。
  9809. */
  9810. export interface IVideoTextureLoaderOptions {
  9811. anisoLevel: number
  9812. placeHolder?: string
  9813. autoPlay?: boolean
  9814. loop?: boolean
  9815. abortAudio?: boolean
  9816. }
  9817. type IVideoTextureLoadData = IAssetLoadData<IVideoTextureLoaderOptions>
  9818. /**
  9819. * 视频纹理资源{@link VideoTexture}的加载器。
  9820. */
  9821. export default class VideoTextureLoader extends AssetLoader<
  9822. VideoTexture,
  9823. IVideoTextureLoaderOptions
  9824. > {
  9825. /**
  9826. * 详见{@link IVideoTextureLoaderOptions}。
  9827. */
  9828. readonly schema: ILoaderOptionsSchema
  9829. load(
  9830. params: IVideoTextureLoadData,
  9831. callbacks: {
  9832. onLoading(progress: number): void
  9833. onLoaded(value: VideoTexture): void
  9834. onError(error: Error): void
  9835. }
  9836. ): Promise<void>
  9837. release(params: IVideoTextureLoadData, value: VideoTexture): void
  9838. }
  9839. export {}
  9840. }
  9841. declare module 'XrFrame/loader/EnvDataLoader' {
  9842. /**
  9843. * EnvDataLoader.ts
  9844. *
  9845. * * @Date : 5/10/2022, 11:27:49 AM
  9846. */
  9847. import EnvData from 'XrFrame/assets/EnvData'
  9848. import AssetLoader, {
  9849. ILoaderOptionsSchema
  9850. } from 'XrFrame/loader/AssetLoader'
  9851. import { IAssetLoadData } from 'XrFrame/loader/types'
  9852. interface IBufferSlice {
  9853. offset: number
  9854. length: number
  9855. type: string
  9856. }
  9857. export interface IEnvDataSource {
  9858. skybox?: {
  9859. type: '2D' | 'Cube'
  9860. half: boolean
  9861. map: (string | string[]) | IBufferSlice
  9862. }
  9863. diffuse?: {
  9864. coefficients: number[][]
  9865. }
  9866. specular?: {
  9867. type: '2D'
  9868. rgbd: boolean
  9869. mipmaps: boolean
  9870. mipmapCount?: number
  9871. map: string | IBufferSlice
  9872. }
  9873. }
  9874. export interface IEnvDataLoaderOptions {}
  9875. type IEnvDataLoadData = IAssetLoadData<IEnvDataLoaderOptions>
  9876. /**
  9877. * 环境数据资源{@link EnvData}的加载器。
  9878. *
  9879. * 拥有内置资源`xr-frame-team-workspace-day`、`xr-frame-team-workspace-night`以及`xr-frame-team-workspace-day2`。
  9880. * 加载的资源一般由[xr-frame-cli](https://github.com/wechat-miniprogram/xr-frame-cli)生成。
  9881. */
  9882. export default class EnvDataLoader extends AssetLoader<
  9883. EnvData,
  9884. IEnvDataLoaderOptions
  9885. > {
  9886. readonly schema: ILoaderOptionsSchema
  9887. load(
  9888. params: IEnvDataLoadData,
  9889. callbacks: {
  9890. onLoading(progress: number): void
  9891. onLoaded(value: EnvData): void
  9892. onError(error: Error): void
  9893. }
  9894. ): Promise<void>
  9895. getBuiltin(): Array<{
  9896. assetId: string
  9897. src: string
  9898. options: IEnvDataLoaderOptions
  9899. }>
  9900. release(params: IEnvDataLoadData, value: EnvData): void
  9901. }
  9902. export {}
  9903. }
  9904. declare module 'XrFrame/loader/GlTFLoader' {
  9905. /**
  9906. * GLTFLoader.ts
  9907. *
  9908. * * @Date : 2022/3/16下午3:47:56
  9909. */
  9910. import GLTFModel from 'XrFrame/assets/GLTFModel'
  9911. import AssetLoader, {
  9912. ILoaderOptionsSchema
  9913. } from 'XrFrame/loader/AssetLoader'
  9914. import { IAssetLoadData } from 'XrFrame/loader/types'
  9915. import { Scene } from 'XrFrame/elements'
  9916. export enum GLBChunkType {
  9917. JSON = 1313821514,
  9918. BIN = 5130562
  9919. }
  9920. export interface IGLTFLoaderOptions {
  9921. /**
  9922. * *(基础库2.31.1及之后)*
  9923. * 可以忽略xr-frame对GLTF模型的某一些限制,来强行渲染有问题的GLTF模型。
  9924. * ErrorCode会在渲染模型失败后,由console报出。
  9925. * 填写-1则忽略所有限制。
  9926. */
  9927. ignoreError: number[]
  9928. /**
  9929. * *(基础库2.32.1及之后)*
  9930. * 开启了之后会在GLTFModel中保留原始json。
  9931. */
  9932. preserveRaw: boolean
  9933. }
  9934. type IGLTFLoadData = IAssetLoadData<IGLTFLoaderOptions>
  9935. /**
  9936. * GLTF资源加载器,加载完毕后返回一个{@link GLTFModel}。
  9937. */
  9938. export default class GLTFLoader extends AssetLoader<
  9939. GLTFModel,
  9940. IGLTFLoaderOptions
  9941. > {
  9942. readonly schema: ILoaderOptionsSchema
  9943. load(
  9944. param: IGLTFLoadData,
  9945. callbacks: {
  9946. onLoading(progress: number): void
  9947. onLoaded(value: GLTFModel): void
  9948. onError(error: Error): void
  9949. }
  9950. ): Promise<void>
  9951. cancel(params: IGLTFLoadData): void
  9952. release(params: IGLTFLoadData, value: GLTFModel): void
  9953. /**
  9954. * @internal
  9955. */
  9956. static createGLTFModel(
  9957. scene: Scene,
  9958. buffer: ArrayBuffer,
  9959. param: IGLTFLoadData,
  9960. onLoading?: (progress: number) => void
  9961. ): Promise<GLTFModel>
  9962. }
  9963. export {}
  9964. }
  9965. declare module 'XrFrame/loader/KeyframeLoader' {
  9966. /**
  9967. * KeyframeLoader.ts
  9968. *
  9969. * * @Date : 6/21/2022, 6:48:33 PM
  9970. */
  9971. import KeyframeAnimation from 'XrFrame/animation/KeyframeAnimation'
  9972. import AssetLoader, {
  9973. ILoaderOptionsSchema
  9974. } from 'XrFrame/loader/AssetLoader'
  9975. import { IAssetLoadData } from 'XrFrame/loader/types'
  9976. export interface IKeyframeLoaderOptions {}
  9977. type IKeyframeLoadData = IAssetLoadData<IKeyframeLoaderOptions>
  9978. /**
  9979. * 帧动画资源{@link KeyframeAnimation}的加载器。
  9980. */
  9981. export default class KeyframeLoader extends AssetLoader<
  9982. KeyframeAnimation,
  9983. IKeyframeLoaderOptions
  9984. > {
  9985. readonly schema: ILoaderOptionsSchema
  9986. load(
  9987. params: IKeyframeLoadData,
  9988. callbacks: {
  9989. onLoading(progress: number): void
  9990. onLoaded(value: KeyframeAnimation): void
  9991. onError(error: Error): void
  9992. }
  9993. ): Promise<void>
  9994. }
  9995. export {}
  9996. }
  9997. declare module 'XrFrame/loader/RawLoader' {
  9998. import AssetLoader, {
  9999. ILoaderOptionsSchema
  10000. } from 'XrFrame/loader/AssetLoader'
  10001. import { IAssetLoadData } from 'XrFrame/loader/types'
  10002. /**
  10003. * 原始数据加载器的参数。
  10004. */
  10005. export interface IRawLoaderOptions {
  10006. /**
  10007. * 编码,默认为`binary`。
  10008. */
  10009. encoding?: 'binary' | 'utf-8'
  10010. }
  10011. type IRawLoadData = IAssetLoadData<IRawLoaderOptions>
  10012. /**
  10013. * 原始数据的加载器。
  10014. */
  10015. export default class RawLoader extends AssetLoader<
  10016. string | ArrayBuffer,
  10017. IRawLoaderOptions
  10018. > {
  10019. readonly schema: ILoaderOptionsSchema
  10020. load(
  10021. params: IRawLoadData,
  10022. callbacks: {
  10023. onLoading(progress: number): void
  10024. onLoaded(value: string | ArrayBuffer): void
  10025. onError(error: Error): void
  10026. }
  10027. ): Promise<void>
  10028. }
  10029. export {}
  10030. }
  10031. declare module 'XrFrame/loader/AtlasLoader' {
  10032. /**
  10033. * AtlasLoader.ts
  10034. *
  10035. * * @Date : 10/13/2022, 5:35:00 PM
  10036. */
  10037. import Atlas from 'XrFrame/assets/Atlas'
  10038. import AssetLoader, {
  10039. ILoaderOptionsSchema
  10040. } from 'XrFrame/loader/AssetLoader'
  10041. import { IAssetLoadData } from 'XrFrame/loader/types'
  10042. export interface IAtlasSource {
  10043. meta: {
  10044. image: string
  10045. size: {
  10046. w: number
  10047. h: number
  10048. }
  10049. }
  10050. frames: {
  10051. [key: string]: {
  10052. frame: {
  10053. x: number
  10054. y: number
  10055. w: number
  10056. h: number
  10057. }
  10058. spriteSourceSize: {
  10059. x: number
  10060. y: number
  10061. w: number
  10062. h: number
  10063. }
  10064. sourceSize: {
  10065. w: number
  10066. h: number
  10067. }
  10068. }
  10069. }
  10070. }
  10071. export interface IAtlasLoaderOptions {}
  10072. type IAtlasLoadData = IAssetLoadData<IAtlasLoaderOptions>
  10073. /**
  10074. * 图集资源{@link Atlas}的加载器。
  10075. * @version 2.27.1
  10076. *
  10077. * 推荐使用[Shoebox](https://www.renderhjs.net/shoebox/)生成。
  10078. */
  10079. export default class AtlasLoader extends AssetLoader<
  10080. Atlas,
  10081. IAtlasLoaderOptions
  10082. > {
  10083. readonly schema: ILoaderOptionsSchema
  10084. load(
  10085. params: IAtlasLoadData,
  10086. callbacks: {
  10087. onLoading(progress: number): void
  10088. onLoaded(value: Atlas): void
  10089. onError(error: Error): void
  10090. }
  10091. ): Promise<void>
  10092. getBuiltin(): Array<{
  10093. assetId: string
  10094. src: string
  10095. options: IAtlasLoaderOptions
  10096. }>
  10097. }
  10098. export {}
  10099. }
  10100. declare module 'XrFrame/loader/types' {
  10101. /**
  10102. * types.ts
  10103. *
  10104. * * @Date : 2022/4/1下午2:19:33
  10105. */
  10106. type Assets = import('XrFrame/components/Assets').default
  10107. export function isAsset(value: any): value is IAssetWithState<any>
  10108. export enum EAssetState {
  10109. Undefined = 0,
  10110. Defer = 1,
  10111. Loading = 2,
  10112. Existed = 3
  10113. }
  10114. export interface IAssetWithState<T> {
  10115. __isAsset: boolean
  10116. __params?: IAssetLoadData
  10117. __group?: Assets
  10118. value?: T
  10119. state: EAssetState
  10120. promise?: Promise<IAssetWithState<T>>
  10121. }
  10122. /**
  10123. * {@link AssetLoad}组件数据接口。
  10124. */
  10125. export interface IAssetLoadData<T = any> {
  10126. /**
  10127. * 资源类型,必须是使用{@link registerAssetLoader}中注册过的类型。
  10128. * `xml`中数据为`string`类型。
  10129. */
  10130. type: string
  10131. /**
  10132. * 资源Id。
  10133. * `xml`中数据为`string`类型。
  10134. */
  10135. assetId: string
  10136. /**
  10137. * 资源地址。
  10138. * `xml`中数据为`string`类型。
  10139. */
  10140. src: string
  10141. /**
  10142. * 资源权重,用于在同一批加载的资源的`progress`事件中计算进度,详见{@link Assets}。
  10143. * `xml`中数据为`number`类型。
  10144. */
  10145. weight?: number
  10146. /**
  10147. * 资源追加配置,视资源类型而定。
  10148. * `xml`中数据为`dict`类型。
  10149. */
  10150. options: T
  10151. /**
  10152. * 是否要按需延迟加载,如果开启,则只有在资源被实际引用时才会被加载。
  10153. * `xml`中数据为`boolean`类型。
  10154. */
  10155. defer?: boolean
  10156. /**
  10157. * @internal
  10158. */
  10159. canceled?: boolean
  10160. /**
  10161. * @internal
  10162. */
  10163. startTs?: number
  10164. /**
  10165. * 加载时长(s),仅用于统计。
  10166. */
  10167. duration?: number
  10168. /**
  10169. * 当前加载进度。
  10170. */
  10171. progress?: number
  10172. }
  10173. export {}
  10174. }
  10175. declare module 'XrFrame/animation/NativeAnimation' {
  10176. import { Kanata } from 'XrFrame/ext'
  10177. import Animation, { TDirection } from 'XrFrame/animation/Animation'
  10178. import Element from 'XrFrame/core/Element'
  10179. export enum ENativeAnimationSimulatorType {
  10180. None = 0,
  10181. Morph = 1
  10182. }
  10183. export interface INativeAnimationData {
  10184. clip: Kanata.AnimationClipModel
  10185. bindings: Kanata.Entity3D[]
  10186. frameCount: number
  10187. names: string[]
  10188. simulators?: Array<{
  10189. type: ENativeAnimationSimulatorType
  10190. target: Element
  10191. subElements: Element[]
  10192. }>
  10193. }
  10194. export const DefaultNativeAnimationFPS = 60
  10195. /**
  10196. * 使用客户端加速的动画片段,通常由gltf实例化而来,仅供内部使用。
  10197. */
  10198. export default class NativeAnimation extends Animation<INativeAnimationData> {
  10199. onInit(data: INativeAnimationData): void
  10200. onPlay(
  10201. el: Element,
  10202. clipName: string,
  10203. options: any
  10204. ): {
  10205. duration: number
  10206. loop?: number
  10207. delay?: number
  10208. direction?: TDirection
  10209. }
  10210. onUpdate(el: Element, progress: number, reverse: boolean): void
  10211. }
  10212. }
  10213. declare module 'XrFrame/loader/glTF/GLTFRootNode' {
  10214. import GLTFAnimationsNode, {
  10215. GLTFAnimationsLoaded,
  10216. GLTFAnimationsNodeRaw
  10217. } from 'XrFrame/loader/glTF/animations/GLTFAnimationsNode'
  10218. import GLTFAccessorsNode, {
  10219. GLTFAccessorsNodeRaw
  10220. } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  10221. import GLTFBuffersNode, {
  10222. GLTFBuffersNodeRaw
  10223. } from 'XrFrame/loader/glTF/buffers/GLTFBuffersNode'
  10224. import GLTFBufferViewsNode, {
  10225. GLTFBufferViewsNodeRaw
  10226. } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode'
  10227. import { GLTFExtensionsProfiles } from 'XrFrame/loader/glTF/extensions/GLTFExtensions'
  10228. import GLTFMeshesNode, {
  10229. GLTFMeshesLoaded,
  10230. GLTFMeshesNodeRaw
  10231. } from 'XrFrame/loader/glTF/geometry/GLTFMeshesNode'
  10232. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  10233. import GLTFMaterialsNode, {
  10234. GLTFMaterialsLoaded,
  10235. GLTFMaterialsNodeRaw
  10236. } from 'XrFrame/loader/glTF/materials/GLTFMaterialsNode'
  10237. import GLTFNodesNode, {
  10238. GLTFNodesLoaded,
  10239. GLTFNodesNodeRaw
  10240. } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  10241. import { GLTFSceneLoaded } from 'XrFrame/loader/glTF/scenes/GLTFSceneNode'
  10242. import GLTFScenesNode, {
  10243. GLTFScenesLoaded,
  10244. GLTFScenesNodeRaw
  10245. } from 'XrFrame/loader/glTF/scenes/GLTFScenesNode'
  10246. import GLTFSkinsNode, {
  10247. GLTFSkinsLoaded,
  10248. GLTFSkinsNodeRaw
  10249. } from 'XrFrame/loader/glTF/skins/GLTFSkinsNode'
  10250. import GLTFImagesNode, {
  10251. GLTFImagesNodeRaw
  10252. } from 'XrFrame/loader/glTF/textures/GLTFImagesNode'
  10253. import GLTFSamplersNode, {
  10254. GLTFSamplersLoaded,
  10255. GLTFSamplersNodeRaw
  10256. } from 'XrFrame/loader/glTF/textures/GLTFSamplersNode'
  10257. import GLTFTexturesNode, {
  10258. GLTFTexturesLoaded,
  10259. GLTFTexturesNodeRaw
  10260. } from 'XrFrame/loader/glTF/textures/GLTFTexturesNode'
  10261. import { EValidation } from 'XrFrame/loader/glTF/utils/exceptions'
  10262. type Scene = import('XrFrame/core/Scene').default
  10263. export interface GLTFRootNodeRaw {
  10264. buffers?: GLTFBuffersNodeRaw
  10265. bufferViews?: GLTFBufferViewsNodeRaw
  10266. accessors?: GLTFAccessorsNodeRaw
  10267. images?: GLTFImagesNodeRaw
  10268. samplers?: GLTFSamplersNodeRaw
  10269. textures?: GLTFTexturesNodeRaw
  10270. materials?: GLTFMaterialsNodeRaw
  10271. meshes?: GLTFMeshesNodeRaw
  10272. nodes?: GLTFNodesNodeRaw
  10273. scenes?: GLTFScenesNodeRaw
  10274. skins?: GLTFSkinsNodeRaw
  10275. animations?: GLTFAnimationsNodeRaw
  10276. scene?: number
  10277. extensions?: object
  10278. extensionsRequired?: string[]
  10279. extensionsUsed?: string[]
  10280. }
  10281. export interface GLTFRootLoaded {
  10282. samplers: GLTFSamplersLoaded
  10283. textures: GLTFTexturesLoaded
  10284. materials: GLTFMaterialsLoaded
  10285. meshes: GLTFMeshesLoaded
  10286. nodes: GLTFNodesLoaded
  10287. scenes: GLTFScenesLoaded
  10288. scene: GLTFSceneLoaded
  10289. skins: GLTFSkinsLoaded
  10290. animations: GLTFAnimationsLoaded
  10291. }
  10292. export interface GLTFDesc {
  10293. raw: object
  10294. scene: Scene
  10295. uri?: string
  10296. ignoreError?: number[]
  10297. extensionProfiles?: GLTFExtensionsProfiles
  10298. defaultBinary?: ArrayBuffer
  10299. }
  10300. export default class GLTFRootNode extends GLTFBaseNode {
  10301. get nodeName(): string
  10302. readonly raw: GLTFRootNodeRaw
  10303. readonly uri: string
  10304. readonly defaultBinary: ArrayBuffer | null
  10305. nodesCollector: {
  10306. [path: string]: GLTFBaseNode[]
  10307. }
  10308. extensionProfiles: GLTFExtensionsProfiles
  10309. extensionGlobals: {
  10310. [name: string]: object
  10311. }
  10312. resource: GLTFRootLoaded | null
  10313. buffersNode: GLTFBuffersNode | undefined
  10314. bufferViewsNode: GLTFBufferViewsNode | undefined
  10315. accessorsNode: GLTFAccessorsNode | undefined
  10316. imagesNode: GLTFImagesNode | undefined
  10317. samplersNode: GLTFSamplersNode | undefined
  10318. texturesNode: GLTFTexturesNode | undefined
  10319. materialsNode: GLTFMaterialsNode | undefined
  10320. meshesNode: GLTFMeshesNode | undefined
  10321. nodesNode: GLTFNodesNode | undefined
  10322. scenesNode: GLTFScenesNode | undefined
  10323. skinsNode: GLTFSkinsNode | undefined
  10324. animationsNode: GLTFAnimationsNode | undefined
  10325. ignoreError: {
  10326. [errorType in EValidation]?: true
  10327. }
  10328. constructor(desc: GLTFDesc)
  10329. build(): void
  10330. preload(
  10331. reportProgress?: (progress: number) => void
  10332. ): Promise<GLTFRootLoaded>
  10333. getLoadedResource(): GLTFRootLoaded
  10334. getNodesByPath(path: string): GLTFBaseNode[]
  10335. getRootExtensionRaw(extName: string): object | undefined
  10336. /**
  10337. * 在preload完之后可以调用这个函数,会把原始buffer的引用都释放掉。
  10338. * 每个子节点的raw也会释放掉(以防数据是dataURI的形式)。
  10339. */
  10340. releaseRawBuffer(): void
  10341. }
  10342. export {}
  10343. }
  10344. declare module 'XrFrame/loader/glTF/scenes/GLTFNodesNode' {
  10345. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  10346. import GLTFNodeNode, {
  10347. GLTFNodeLoaded,
  10348. GLTFNodeNodeRaw,
  10349. GLTFNodePrerequisites
  10350. } from 'XrFrame/loader/glTF/scenes/GLTFNodeNode'
  10351. type ChildNode = GLTFNodeNode
  10352. export type GLTFNodesNodeRaw = GLTFNodesNodeRaw[]
  10353. export type GLTFTreeNode = {
  10354. data: GLTFNodeLoaded
  10355. children: GLTFTreeNode[]
  10356. parent: GLTFTreeNode | null
  10357. index: number
  10358. extensions?: object
  10359. }
  10360. export type GLTFNodesLoaded = GLTFTreeNode[]
  10361. export default class GLTFNodesNode extends GLTFArrayNode<ChildNode> {
  10362. ChildCtor(childRaw: GLTFNodeNodeRaw): GLTFNodeNode
  10363. readonly raw: GLTFNodesNodeRaw
  10364. get nodeName(): string
  10365. res: GLTFNodesLoaded
  10366. preload(prerequisites: GLTFNodePrerequisites): Promise<GLTFNodesLoaded>
  10367. getLoadedResource(): GLTFNodesLoaded
  10368. }
  10369. export {}
  10370. }
  10371. declare module 'XrFrame/physics/RaycastHit' {
  10372. import Shape from 'XrFrame/components/physics/Shape'
  10373. import { Scene } from 'XrFrame/elements'
  10374. import Vector3 from 'XrFrame/math/vector3'
  10375. export default class RaycastHit {
  10376. constructor(scene: Scene, nativeComp?: phys3D.RaycastHit)
  10377. /**
  10378. * @internal
  10379. * native层真正的raycastHit对象,业务侧无需关心
  10380. */
  10381. get nativeRaycastHit(): phys3D.RaycastHit
  10382. /**
  10383. * 与射线相交的Shape。
  10384. */
  10385. get shape(): Shape<any>
  10386. /**
  10387. * 从射线的原点到碰撞点的距离。
  10388. */
  10389. get distance(): number
  10390. set distance(v: number)
  10391. /**
  10392. * 射线与轮廓的交点表面的法线。
  10393. */
  10394. get normal(): Vector3
  10395. set normal(v: Vector3)
  10396. /**
  10397. * 在世界空间中,射线与轮廓的交点。
  10398. */
  10399. get point(): Vector3
  10400. set point(v: Vector3)
  10401. }
  10402. }
  10403. declare module 'XrFrame/physics/Collision' {
  10404. import Shape from 'XrFrame/components/physics/Shape'
  10405. import ContactPoint, { IContactPoint } from 'XrFrame/physics/ContactPoint'
  10406. import { Vector3ReadOnly } from 'XrFrame/math/vector3'
  10407. const collisionMap: WeakMap<phys3D.Collision, Collision>
  10408. export { collisionMap }
  10409. /**
  10410. * 物理碰撞事件(collide-begin等)的信息。
  10411. * @category Physics
  10412. * @readonly
  10413. */
  10414. export interface ICollideEvent {
  10415. /**
  10416. * 从碰撞到分离所用的冲量之和。
  10417. */
  10418. readonly impulse: Vector3ReadOnly
  10419. /**
  10420. * 两个刚体的相对线性碰撞速度。
  10421. */
  10422. readonly relativeVelocity: Vector3ReadOnly
  10423. /**
  10424. * 发生碰撞的另一个轮廓。
  10425. */
  10426. readonly shape: Shape
  10427. /**
  10428. * 本次碰撞的接触点。
  10429. */
  10430. readonly contacts: IContactPoint[]
  10431. }
  10432. /**
  10433. * 物理重叠事件(overlap-begin等)的信息。
  10434. * @category Physics
  10435. * @readonly
  10436. */
  10437. export interface IOverlapEvent {
  10438. /**
  10439. * 重叠的另一个轮廓。
  10440. */
  10441. readonly shape: Shape
  10442. }
  10443. export default class Collision implements ICollideEvent {
  10444. constructor(native: phys3D.Collision)
  10445. get impulse(): Vector3ReadOnly
  10446. get relativeVelocity(): Vector3ReadOnly
  10447. get shape(): Shape<any>
  10448. get contacts(): ContactPoint[]
  10449. }
  10450. }
  10451. declare module 'XrFrame/physics/ContactPoint' {
  10452. import Shape from 'XrFrame/components/physics/Shape'
  10453. import { Vector3ReadOnly } from 'XrFrame/math/vector3'
  10454. const contactPointMap: WeakMap<phys3D.ContactPoint, ContactPoint>
  10455. export { contactPointMap }
  10456. /**
  10457. * 物理事件返回的{@link ICollideEvent | 碰撞信息}中的碰撞点。
  10458. * @category Physics
  10459. */
  10460. export interface IContactPoint {
  10461. /**
  10462. * 在该碰撞点处,两个物体的距离。
  10463. *
  10464. * 不一定是0或小于0,因为只要两个物体的距离小于{@link Collider.contactOffset}之和,就会判定为碰撞。
  10465. */
  10466. readonly separation: number
  10467. /**
  10468. * 碰撞平面的法线。
  10469. */
  10470. readonly normal: Vector3ReadOnly
  10471. /**
  10472. * 碰撞点的位置。
  10473. */
  10474. readonly point: Vector3ReadOnly
  10475. /**
  10476. * 接收碰撞事件的轮廓。
  10477. */
  10478. readonly thisShape: Shape
  10479. /**
  10480. * 另一个轮廓。
  10481. */
  10482. readonly otherShape: Shape
  10483. }
  10484. export default class ContactPoint implements IContactPoint {
  10485. get separation(): number
  10486. get normal(): Vector3ReadOnly
  10487. get point(): Vector3ReadOnly
  10488. get thisShape(): Shape<any>
  10489. get otherShape(): Shape<any>
  10490. constructor(native: phys3D.ContactPoint)
  10491. }
  10492. }
  10493. declare module 'XrFrame/physics/raycast' {
  10494. import Vector3 from 'XrFrame/math/vector3'
  10495. import RaycastHit from 'XrFrame/physics/RaycastHit'
  10496. /**
  10497. * raycast函数的参数。
  10498. * @field origin 射线起点。
  10499. * @field unitDir 射线方向(单位向量)。
  10500. * @field distance 射线的最大长度。
  10501. * @field hit 用来接收碰撞信息的容器。
  10502. * @field layerMask 可以用来屏蔽一些物体。
  10503. * @field (未实现)queryTriggerInteraction,是否能与Trigger相交(默认能)。
  10504. */
  10505. export type RaycastDesc = {
  10506. origin: Vector3
  10507. unitDir: Vector3
  10508. distance?: number
  10509. hit?: RaycastHit
  10510. layerMask?: number
  10511. }
  10512. /**
  10513. * 射线检测,判断给定射线是否与至少一个碰撞体相交,并返回与**最近**的那个碰撞体相交的信息。
  10514. */
  10515. export function raycast(
  10516. Phys3D: typeof phys3D,
  10517. system: phys3D.PhysSystem,
  10518. desc: RaycastDesc
  10519. ): boolean
  10520. }
  10521. declare module 'XrFrame/kanata/lib/frontend' {
  10522. import MeshRendererComponent from 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent'
  10523. import renderEnv from 'XrFrame/kanata/lib/frontend/resource/renderEnv'
  10524. export { RenderEnv } from 'XrFrame/kanata/lib/frontend/resource/renderEnv'
  10525. export { default as AnimatorComponent } from 'XrFrame/kanata/lib/frontend/component/AnimatorComponent'
  10526. export { default as CameraComponent } from 'XrFrame/kanata/lib/frontend/component/CameraComponent'
  10527. export { default as LightCameraComponent } from 'XrFrame/kanata/lib/frontend/component/LightCameraComponent'
  10528. export { default as CullingComponent } from 'XrFrame/kanata/lib/frontend/component/CullingComponent'
  10529. export { default as MeshRendererComponent } from 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent'
  10530. export { default as SkinnedSkeletonComponent } from 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent'
  10531. export { default as DynamicBonesComponent } from 'XrFrame/kanata/lib/frontend/component/DynamicBonesComponent'
  10532. export { default as Entity2D } from 'XrFrame/kanata/lib/frontend/entity/Entity2D'
  10533. export { default as Entity3D } from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  10534. export { default as AnimationClipModel } from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel'
  10535. export { default as AnimationClipBinding } from 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding'
  10536. export { default as AnimatorControllerModel } from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerModel'
  10537. export { default as AnimatorControllerStateModel } from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel'
  10538. export { default as DataBuffer } from 'XrFrame/kanata/lib/frontend/resource/DataBuffer'
  10539. export { default as DataModel } from 'XrFrame/kanata/lib/frontend/resource/DataModel'
  10540. export { default as Effect } from 'XrFrame/kanata/lib/frontend/resource/Effect'
  10541. export { default as Material } from 'XrFrame/kanata/lib/frontend/resource/Material'
  10542. export {
  10543. default as RenderPass,
  10544. IRenderPassOptions
  10545. } from 'XrFrame/kanata/lib/frontend/resource/RenderPass'
  10546. export { default as SkeletonBoneInverseModel } from 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel'
  10547. export {
  10548. default as Texture,
  10549. ITextureOptions
  10550. } from 'XrFrame/kanata/lib/frontend/resource/Texture'
  10551. export { default as UniformBlock } from 'XrFrame/kanata/lib/frontend/resource/UniformBlock'
  10552. export { default as UniformDescriptor } from 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor'
  10553. export { default as IndexBuffer } from 'XrFrame/kanata/lib/frontend/resource/IndexBuffer'
  10554. export { default as IndexData } from 'XrFrame/kanata/lib/frontend/resource/IndexData'
  10555. export { default as VertexBuffer } from 'XrFrame/kanata/lib/frontend/resource/VertexBuffer'
  10556. export { default as VertexData } from 'XrFrame/kanata/lib/frontend/resource/VertexData'
  10557. export { default as VertexLayout } from 'XrFrame/kanata/lib/frontend/resource/VertexLayout'
  10558. export { default as VertexDataDescriptor } from 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor'
  10559. export { default as View } from 'XrFrame/kanata/lib/frontend/resource/View'
  10560. export { default as ScalableList } from 'XrFrame/kanata/lib/frontend/resource/ScalableList'
  10561. export { default as crossContext } from 'XrFrame/kanata/lib/frontend/shared/crossContext'
  10562. const IS_VALID: () => boolean,
  10563. GET_MAIN_CANVAS: () => HTMLCanvasElement,
  10564. Image: {
  10565. new (): import('XrFrame/kanata/lib/backend').IImage
  10566. IS(obj: any): obj is import('XrFrame/kanata/lib/backend').IImage
  10567. },
  10568. Phys3D: any
  10569. const downloader: import('XrFrame/kanata/lib/backend').IDownloader
  10570. export { renderEnv }
  10571. export {
  10572. Image,
  10573. downloader as Downloader,
  10574. IS_VALID,
  10575. GET_MAIN_CANVAS,
  10576. Phys3D
  10577. }
  10578. export const createWeakRef: <T>(wrapper: T) => {
  10579. deref: () => T
  10580. }
  10581. export const createWeakRefSentry: () => any
  10582. export const createNativeUUMap: () => import('XrFrame/kanata/lib/backend').INativeMap<number>
  10583. export const createNativeSUMap: () => import('XrFrame/kanata/lib/backend').INativeMap<string>
  10584. export const createNativeULUMap: () => import('XrFrame/kanata/lib/backend').ILongIntNativeMap
  10585. export const loadTTFFont: (
  10586. url: string,
  10587. callback: (font: string) => void
  10588. ) => void
  10589. export const getGlyphInfo: (
  10590. fontSetting: import('XrFrame/kanata/lib/backend').IFontSetting,
  10591. charCode: number
  10592. ) => import('XrFrame/kanata/lib/backend').IGlyphInfo
  10593. export const refreshNodesWorldTransform: () => void
  10594. export const setGlobalPhysicSystem: (system: any) => void
  10595. export const bindRigidBodyToNode: (rigidBody: any, nodeId: number) => void
  10596. export const bindCCTToNode: (cc: any, nodeId: number) => void
  10597. export const unbindRigidBody: (rigidBody: any) => void
  10598. export const unbindCCT: (cc: any) => void
  10599. export const decodeBase64: (base64: string) => ArrayBuffer
  10600. export const initDraco: () => Promise<void>
  10601. export const decodeDraco: (
  10602. buffer: ArrayBuffer | ArrayBufferView,
  10603. decodeType: import('XrFrame/kanata/lib/backend').EDracoDecodeType
  10604. ) => import('XrFrame/kanata/lib/backend').DracoDecoded
  10605. export function destroy(): void
  10606. export function update(delta: number): void
  10607. export const setNodeName: (id: number, name: string) => void
  10608. export const setRenderComponentName: (
  10609. comp: MeshRendererComponent,
  10610. name: string
  10611. ) => void
  10612. export const debugPrint: (msg: string) => void
  10613. export const eventBridge: {
  10614. bindEntityToBone: any
  10615. unbindEntityFromBone: any
  10616. bindEntitiesToBones: any
  10617. unbindEntitiesFromBones: any
  10618. }
  10619. }
  10620. declare module 'XrFrame/kanata/lib/backend/interface' {
  10621. /**
  10622. * index.ts
  10623. *
  10624. * * @Date : 2020/8/18 下午4:48:36
  10625. */
  10626. export interface IEngineSettings {
  10627. /** log过滤器 */
  10628. logFilter: boolean
  10629. /** log等级 */
  10630. logLevel: string
  10631. /** 最大缓存极限 */
  10632. cacheSizeLimit: number
  10633. /** 是否开启MSAA */
  10634. realSizeLimit: number
  10635. /** 设计分辨率宽 */
  10636. designWidth: number
  10637. /** 设计分辨率高 */
  10638. designHeight: number
  10639. /** 渲染分辨率宽 */
  10640. renderWidth: number
  10641. /** 渲染分辨率高 */
  10642. renderHeight: number
  10643. /** 是否开启MSAA */
  10644. mainScreenMSAA: boolean
  10645. /** 是否开启透明通道输出 */
  10646. alpha?: boolean
  10647. /** loader下载文件的默认根路径 */
  10648. baseURL: string
  10649. /** 如果baseURL找不到并且重试次数`globalHTTPRetry`大于0,则会依次尝试使用 */
  10650. backupURLs: string[]
  10651. /** 全局loader下载文件重试次数 */
  10652. globalHTTPRetry: string
  10653. /** 物理引擎的重力 */
  10654. gravity: number
  10655. /** 物理引擎的模拟步进固定间隔 */
  10656. fixedDeltaTime: number
  10657. useEngineSubcontext: boolean
  10658. /** 物理碰撞矩阵,以十六进制字符串表示 */
  10659. physics3DLayerCollisionMatrix: string
  10660. /** 拼缓存的文件名的 */
  10661. cacheDelimiter: string
  10662. /** 自动生成的worker文件入口路径 */
  10663. workerPath: string
  10664. /** worker执行任务超时时间 */
  10665. workerTimeout: number
  10666. gfxIgnoreAssert: boolean
  10667. profileGfx: string
  10668. /** 全局Uniform定义 */
  10669. shaderGlobalProperties: Array<{
  10670. key: string
  10671. type:
  10672. | 'Float'
  10673. | 'Vector2'
  10674. | 'Vector3'
  10675. | 'Vector4'
  10676. | 'Matrix4'
  10677. | 'Texture'
  10678. default: number | number[] | string
  10679. }>
  10680. /** 音频全局定义 */
  10681. audio?: {
  10682. /** 全局音量 */
  10683. globalVolume?: number
  10684. /** 真实音频数量上限 */
  10685. maxRealVoices?: number
  10686. }
  10687. }
  10688. /**
  10689. * 顶点数据格式枚举。
  10690. */
  10691. export enum EVertexFormat {
  10692. FLOAT = 0,
  10693. FLOAT2 = 1,
  10694. FLOAT3 = 2,
  10695. FLOAT4 = 3,
  10696. BYTE4 = 4,
  10697. BYTE4N = 5,
  10698. UBYTE4 = 6,
  10699. UBYTE4N = 7,
  10700. SHORT2 = 8,
  10701. SHORT2N = 9,
  10702. SHORT4 = 10,
  10703. SHORT4N = 11,
  10704. UINT10_N2 = 12
  10705. }
  10706. /**
  10707. * 顶点数据步进类型枚举。
  10708. */
  10709. export enum EVertexStep {
  10710. /**
  10711. * 逐顶点。
  10712. */
  10713. PER_VERTEX = 0,
  10714. /**
  10715. * 在使用Instance的情况下,逐实例。
  10716. */
  10717. PER_INSTANCE = 1
  10718. }
  10719. /**
  10720. * 索引数据类型。
  10721. */
  10722. export enum EIndexType {
  10723. /**
  10724. * 无效值。
  10725. */
  10726. NONE = 1,
  10727. /**
  10728. * 16位索引。
  10729. */
  10730. UINT16 = 2,
  10731. /**
  10732. * 32位索引,注意在某些设备上不支持。
  10733. */
  10734. UINT32 = 3
  10735. }
  10736. /**
  10737. * 压缩纹理类型。
  10738. */
  10739. export type TCompressTexture = 'etc1' | 'etc2' | 'astc' | 'pvrtc' | 's3tc'
  10740. /**
  10741. * 纹理类型雷剧。
  10742. */
  10743. export enum ETextureType {
  10744. /**
  10745. * 2D纹理。
  10746. */
  10747. D2 = 0,
  10748. /**
  10749. * 立方体纹理。
  10750. */
  10751. Cube = 1,
  10752. /**
  10753. * 2D纹理数组。
  10754. */
  10755. D2Array = 2,
  10756. /**
  10757. * 3D纹理。
  10758. */
  10759. D3 = 3
  10760. }
  10761. /**
  10762. * 纹理格式枚举。
  10763. */
  10764. export enum ETextureFormat {
  10765. /** Inputs or Render Target Formats. */
  10766. RGBA8 = 0,
  10767. SRGBA8 = 1,
  10768. RGB10A2 = 2,
  10769. RG8 = 3,
  10770. R8 = 4,
  10771. RGBA32F = 5,
  10772. RGBA16F = 6,
  10773. RG11B10F = 7,
  10774. RGB8 = 8,
  10775. RGB16F = 9,
  10776. RGB32F = 10,
  10777. /** Render Target Only. */
  10778. Depth_Low = 20,
  10779. Depth_High = 21,
  10780. Depth_Stencil = 22,
  10781. RGBA4 = 23,
  10782. RGB565 = 24,
  10783. RGB5A1 = 25,
  10784. /** Compresseds */
  10785. ETC1RGB8 = 100,
  10786. ETC2RGB8 = 110,
  10787. ETC2RGBA8 = 111,
  10788. PVRTC2RGBV1 = 120,
  10789. PVRTC4RGBV1 = 121,
  10790. PVRTC2RGBAV1 = 122,
  10791. PVRTC4RGBAV1 = 123,
  10792. ASTC4x4 = 140,
  10793. ASTC5x5 = 141,
  10794. ASTC6x6 = 142,
  10795. ASTC8x6 = 143,
  10796. ASTC8x8 = 144,
  10797. DXT1 = 150,
  10798. DXT3 = 151,
  10799. DXT5 = 152
  10800. }
  10801. /**
  10802. * 纹理寻址模式枚举。
  10803. */
  10804. export enum EWrapMode {
  10805. REPEAT = 1,
  10806. CLAMP_TO_EDGE = 2,
  10807. MIRRORED_REPEAT = 3
  10808. }
  10809. /**
  10810. * 纹理过滤模式枚举。
  10811. */
  10812. export enum EFilterMode {
  10813. NEAREST = 1,
  10814. LINEAR = 2,
  10815. NEAREST_MIPMAP_NEAREST = 3,
  10816. NEAREST_MIPMAP_LINEAR = 4,
  10817. LINEAR_MIPMAP_NEAREST = 5,
  10818. LINEAR_MIPMAP_LINEAR = 6
  10819. }
  10820. /**
  10821. * Uniform值得类型枚举。
  10822. */
  10823. export enum EUniformType {
  10824. FLOAT = 0,
  10825. FLOAT2 = 1,
  10826. FLOAT3 = 2,
  10827. FLOAT4 = 3,
  10828. MAT2 = 4,
  10829. MAT3 = 5,
  10830. MAT4 = 6,
  10831. SAMPLER = 7
  10832. }
  10833. /**
  10834. * 背面剔除类型枚举。
  10835. */
  10836. export enum ECullMode {
  10837. NONE = 0,
  10838. FRONT = 1,
  10839. BACK = 2
  10840. }
  10841. /**
  10842. * 正面顶点绕序枚举。
  10843. */
  10844. export enum EFaceWinding {
  10845. CCW = 1,
  10846. CW = 2
  10847. }
  10848. /**
  10849. * 各种测试的比较函数枚举。
  10850. */
  10851. export enum ECompareFunc {
  10852. LESS = 1,
  10853. LEQUAL = 2,
  10854. EQUAL = 3,
  10855. GEQUAL = 4,
  10856. GREATER = 5,
  10857. NOTEQUAL = 6,
  10858. NEVER = 7,
  10859. ALWAYS = 8
  10860. }
  10861. /**
  10862. * 模板测试操作枚举。
  10863. */
  10864. export enum EStencilOp {
  10865. ZERO = 0,
  10866. KEEP = 1,
  10867. REPLACE = 2,
  10868. INCR_WRAP = 3,
  10869. INCR = 4,
  10870. DECR_WRAP = 5,
  10871. DECR = 6,
  10872. INVERT = 7
  10873. }
  10874. /**
  10875. * 混合因子枚举。
  10876. */
  10877. export enum EBlendFactor {
  10878. ZERO = 0,
  10879. ONE = 1,
  10880. SRC_COLOR = 2,
  10881. ONE_MINUS_SRC_COLOR = 3,
  10882. SRC_ALPHA = 4,
  10883. ONE_MINUS_SRC_ALPHA = 5,
  10884. DST_ALPHA = 6,
  10885. ONE_MINUS_DST_ALPHA = 7,
  10886. DST_COLOR = 8,
  10887. ONE_MINUS_DST_COLOR = 9,
  10888. SRC_ALPHA_SATURATE = 10,
  10889. CONSTANT_COLOR = 11,
  10890. ONE_MINUS_CONSTANT_COLOR = 12
  10891. }
  10892. /**
  10893. * 混合方式枚举。
  10894. */
  10895. export enum EBlendEquation {
  10896. FUNC_ADD = 0,
  10897. FUNC_SUBTRACT = 1,
  10898. FUNC_REVERSE_SUBTRACT = 2,
  10899. MIN = 3,
  10900. MAX = 4
  10901. }
  10902. /**
  10903. * 颜色通道掩码枚举。
  10904. */
  10905. export enum EColorMask {
  10906. /**
  10907. * 将会禁掉所有通道的输出。
  10908. */
  10909. NONE = 16,
  10910. R = 1,
  10911. G = 2,
  10912. B = 4,
  10913. A = 8,
  10914. RGB = 7,
  10915. RGBA = 15
  10916. }
  10917. /**
  10918. * 像素数据类型枚举。
  10919. */
  10920. export enum EPixelType {
  10921. UNSIGNED_BYTE = 5121,
  10922. FLOAT = 5126,
  10923. UNSIGNED_SHORT_5_6_5 = 33635,
  10924. UNSIGNED_SHORT_4_4_4_4 = 32819,
  10925. UNSIGNED_SHORT_5_5_5_1 = 32820
  10926. }
  10927. /**
  10928. * 清屏操作枚举。
  10929. */
  10930. export enum ELoadAction {
  10931. /**
  10932. * 清除屏幕颜色。
  10933. */
  10934. CLEAR = 0,
  10935. /**
  10936. * 不清屏,但依赖前面渲染的结果。
  10937. */
  10938. LOAD = 1,
  10939. /**
  10940. * 完全不关心是否清屏。
  10941. */
  10942. DONTCARE = 2
  10943. }
  10944. export enum EDataModelType {
  10945. AnimationClip = 1,
  10946. SkeletonBoneInverse = 2
  10947. }
  10948. /**
  10949. * 渲染组件类型枚举。
  10950. */
  10951. export enum EMeshRenderType {
  10952. /**
  10953. * 未知类型。
  10954. */
  10955. UnKnown = 0,
  10956. /**
  10957. * 静态3D类型。
  10958. */
  10959. Static3D = 1,
  10960. /**
  10961. * 蒙皮3D类型。
  10962. */
  10963. Skinned3D = 2,
  10964. /**
  10965. * UI类型。
  10966. */
  10967. UI = 3
  10968. }
  10969. /**
  10970. * 图元渲染类型枚举。
  10971. */
  10972. export enum EPrimitiveType {
  10973. TRIANGLES = 0,
  10974. TRIANGLE_STRIP = 1,
  10975. LINES = 2,
  10976. LINE_STRIP = 3,
  10977. POINTS = 4,
  10978. ZERO = 5
  10979. }
  10980. /**
  10981. * 阴影类型枚举。
  10982. */
  10983. export enum EShadowMode {
  10984. /**
  10985. * 关闭阴影。
  10986. */
  10987. None = 0,
  10988. /**
  10989. * 开启单级联阴影,并开启PCF。
  10990. */
  10991. OneCascade_PCF = 1,
  10992. /**
  10993. * 开启二级联阴影,并开启PCF。
  10994. */
  10995. TwoCascade_PCF = 2,
  10996. /**
  10997. * 开启四级联阴影,并开启PCF。
  10998. */
  10999. FourCascade_PCF = 4,
  11000. /**
  11001. * 开启单级联阴影,并开启PCSS。
  11002. */
  11003. PCSS = 5
  11004. }
  11005. /**
  11006. * 阴影匹配类型枚举。
  11007. */
  11008. export enum EShadowFitMode {
  11009. /**
  11010. * 阴影范围适配视锥体。
  11011. * 更稳定,可能降低阴影精度。
  11012. */
  11013. FitFrustum = 0,
  11014. /**
  11015. * 阴影范围适配物体。
  11016. * 能提高阴影精度,但可能会导致阴影不稳定。
  11017. */
  11018. FitObjects = 1
  11019. }
  11020. /**
  11021. * 顶点数据布局用途枚举。
  11022. */
  11023. export enum EVertexLayoutUsage {
  11024. CUSTOM = 0,
  11025. POSITION = 1,
  11026. NORMAL = 2,
  11027. TANGENT = 3,
  11028. UV0 = 4,
  11029. UV1 = 5,
  11030. UV2 = 6,
  11031. UV3 = 7,
  11032. COLOR = 8,
  11033. BONEINDEX = 9,
  11034. BONEWEIGHT = 10
  11035. }
  11036. /**
  11037. * 动态合批操作符枚举。
  11038. */
  11039. export enum EVertexBatchOperator {
  11040. /**
  11041. * 矩阵乘法。
  11042. */
  11043. MatrixMultiple = 0,
  11044. /**
  11045. * Scale offset。
  11046. */
  11047. UVST = 1
  11048. }
  11049. export enum EAnimationBlendType {
  11050. Override = 0,
  11051. Additive = 1
  11052. }
  11053. export enum EUseDefaultAddedAction {
  11054. Ignore = 0,
  11055. Refresh = 1
  11056. }
  11057. export enum EUseDefaultRetainedAction {
  11058. Keep = 0,
  11059. Refresh = 1,
  11060. WriteBack = 2
  11061. }
  11062. export enum EUseDefaultRemovedAction {
  11063. Keep = 0,
  11064. Clear = 1,
  11065. WriteBack = 2
  11066. }
  11067. export enum ESkinnedSkeletonFlag {
  11068. Use3x4Matrix = 1,
  11069. UseTextureMatrix = 2
  11070. }
  11071. export const RENDER_ENV_OFFSETS: {
  11072. size: number
  11073. resetFlag: number
  11074. renderPass: number
  11075. canvasWidth: number
  11076. canvasHeight: number
  11077. uniforms: number
  11078. useInstanceOrNeverTranspose: number
  11079. }
  11080. export const POOL_SUB_ID_MASK = 65472
  11081. export const POOL_SUB_ID_SHIT = 6
  11082. export const ENTITY2D_OFFSETS: {
  11083. size: number
  11084. rotation: number
  11085. position: number
  11086. scale: number
  11087. worldMatrix: number
  11088. }
  11089. export const ENTITY3D_OFFSETS: {
  11090. size: number
  11091. dfRotationType: number
  11092. rotationType: number
  11093. rotation: number
  11094. position: number
  11095. scale: number
  11096. worldOffset: number
  11097. worldMatrix: number
  11098. }
  11099. export const ENTITY3D_EXT_OFFSETS: {
  11100. size: number
  11101. layer: number
  11102. mixedLayerMask: number
  11103. }
  11104. export const CULLING_OFFSETS: {
  11105. size: number
  11106. active: number
  11107. dfActive: number
  11108. layer: number
  11109. boundingBallCenter: number
  11110. boundingBallRadius: number
  11111. entityId: number
  11112. }
  11113. export const CAMERA_OFFSETS: {
  11114. size: number
  11115. view: number
  11116. depth: number
  11117. active: number
  11118. fov: number
  11119. aspect: number
  11120. near: number
  11121. far: number
  11122. up: number
  11123. eye: number
  11124. orthoSize: number
  11125. isProjection: number
  11126. cullingMask: number
  11127. canvasSizeY: number
  11128. targetTransform: number
  11129. viewMatrix: number
  11130. projectionMatrix: number
  11131. viewMatrixInverse: number
  11132. viewMatrix2D: number
  11133. projectionMatrix2D: number
  11134. viewMatrixInverse2D: number
  11135. manualMatrix: number
  11136. layerCullDistances: number
  11137. }
  11138. export const LIGHT_OFFSETS: {
  11139. size: number
  11140. view: number
  11141. depth: number
  11142. active: number
  11143. shadowDistance: number
  11144. shadowMode: number
  11145. shadowFilterMode: number
  11146. lightDir: number
  11147. bounds: number
  11148. lightSpaceMatrices: number
  11149. }
  11150. export const MESH_OFFSETS: {
  11151. dynamicBatch: number
  11152. skinHandle: number
  11153. castShadow: number
  11154. bindTarget: number
  11155. start: number
  11156. size: number
  11157. materialId: number
  11158. vertexBufferId: number
  11159. indexBufferId: number
  11160. startIndex: number
  11161. numIndices: number
  11162. }
  11163. export const EFFECT_OFFSETS: {
  11164. size: number
  11165. useMaterialStates: number
  11166. fstencil: number
  11167. bstencil: number
  11168. blendRGBA: number
  11169. colorDepth: number
  11170. state: number
  11171. }
  11172. export const MATERIAL_OFFSETS: {
  11173. size: number
  11174. renderQueue: number
  11175. effect: number
  11176. uniformBlock: number
  11177. fstencilMask: number
  11178. bstencilMask: number
  11179. blendRGBAMask: number
  11180. colorDepthMask: number
  11181. stateMask: number
  11182. fstencil: number
  11183. bstencil: number
  11184. blendRGBA: number
  11185. colorDepth: number
  11186. state: number
  11187. useInstance: number
  11188. }
  11189. export const SKINNED_SKELETON_OFFSETS: {
  11190. boneInverseModelId: number
  11191. boneIndices: number
  11192. perBoneIndices: number
  11193. perBoneEntityId: number
  11194. perBoneMatrixOld: number
  11195. perBoneMatrixNew: number
  11196. }
  11197. export const DYNAMIC_BONES_OFFSETS: {
  11198. stiffness: number
  11199. elasticity: number
  11200. damping: number
  11201. }
  11202. export interface IHandle {
  11203. id: number
  11204. data?: ArrayBuffer
  11205. destroy?: Function
  11206. __feObj?: any
  11207. }
  11208. /**
  11209. * 顶点布局解构初始化参数。
  11210. */
  11211. export interface IVertexLayoutOptions {
  11212. /**
  11213. * 顶点属性列表。
  11214. */
  11215. attributes: Array<{
  11216. /**
  11217. * 属性名字。
  11218. */
  11219. name: string
  11220. /**
  11221. * 属性名格式。
  11222. */
  11223. format: EVertexFormat
  11224. /**
  11225. * 属性在Buffer中的偏移量(字节)。
  11226. */
  11227. offset: number
  11228. /**
  11229. * 属性的用途。
  11230. */
  11231. usage: EVertexLayoutUsage
  11232. }>
  11233. /**
  11234. * 步进类型。
  11235. *
  11236. * @default EVertexStep.PER_VERTEX
  11237. */
  11238. step?: EVertexStep
  11239. /**
  11240. * 步长,不设定会自动计算。
  11241. */
  11242. stride?: number
  11243. /**
  11244. * 步进单位。
  11245. *
  11246. * @default 1
  11247. */
  11248. stepRate?: number
  11249. }
  11250. /**
  11251. * 动态合批描述符创建参数。
  11252. */
  11253. export interface IVertexDataDescriptorOptions {
  11254. vuMap: Array<[string, string, EVertexBatchOperator?]>
  11255. ignored?: string[]
  11256. ubIndex?: number
  11257. }
  11258. /**
  11259. * UniformBlock描述符创建参数。
  11260. */
  11261. export interface IUniformDescriptorOptions {
  11262. /**
  11263. * 名字。
  11264. */
  11265. name?: string
  11266. /**
  11267. * Uniform描述列表。
  11268. */
  11269. uniforms: Array<{
  11270. /**
  11271. * 名字。
  11272. */
  11273. name: string
  11274. /**
  11275. * 类型。
  11276. */
  11277. type: EUniformType
  11278. /**
  11279. * 长度。
  11280. */
  11281. num?: number
  11282. /**
  11283. * @deprecated
  11284. */
  11285. needTranspose?: boolean
  11286. }>
  11287. }
  11288. /**
  11289. * 引擎原生图片接口。
  11290. */
  11291. export interface IImage {
  11292. /**
  11293. * 是否要预乘Alpha。
  11294. */
  11295. premultiplyAlpha: boolean
  11296. /**
  11297. * 加载完成的回调。
  11298. */
  11299. onload: (() => void) | null
  11300. /**
  11301. * 出错的回调。
  11302. */
  11303. onerror: ((error: Error) => void) | null
  11304. /**
  11305. * @internal
  11306. */
  11307. buffer?: ArrayBuffer
  11308. /**
  11309. * 对于`ArrayBuffer`创建的图片,第一次使用后是否要自动释放内存,在`xr-frame`中,默认自动释放。
  11310. */
  11311. autoRelease?: boolean
  11312. /**
  11313. * 图片地址或者待解码的ArrayBuffer。
  11314. */
  11315. src: string | ArrayBuffer | ArrayBufferView
  11316. /**
  11317. * 图片源于ArrayBuffer时,传入的mimetype。
  11318. */
  11319. type?: string
  11320. /**
  11321. * 图片本地缓存地址,仅在微信内有用。
  11322. */
  11323. localPath?: string
  11324. /**
  11325. * 图片宽度。
  11326. */
  11327. width: number
  11328. /**
  11329. * 图片高度。
  11330. */
  11331. height: number
  11332. /**
  11333. * 解码数据,视不同Backend而定。
  11334. */
  11335. readonly data?: ArrayBuffer | HTMLImageElement
  11336. }
  11337. /**
  11338. * 可用于纹理的资源。
  11339. */
  11340. export type TTextureSource = ArrayBuffer | ArrayBufferView | IImage
  11341. /**
  11342. * 外部需要注入的下载器接口。
  11343. */
  11344. export interface IRealDownloader {
  11345. load: (options: {
  11346. src: string
  11347. encoding: 'binary' | 'utf-8' | undefined
  11348. onLoad: (res: { data: ArrayBuffer, filePath: string }) => void
  11349. onError: (error: Error) => void
  11350. }) => void
  11351. }
  11352. /**
  11353. * 下载器。
  11354. */
  11355. export interface IDownloader {
  11356. inWX: boolean
  11357. REAL_DOWNLOADER: IRealDownloader
  11358. LOAD(options: Parameters<IRealDownloader['load']>[0]): void
  11359. }
  11360. /**
  11361. * 字体配置。
  11362. */
  11363. export interface IFontSetting {
  11364. fontFamily: string
  11365. bold?: string
  11366. italic?: string
  11367. size?: number
  11368. }
  11369. /**
  11370. * 渲染层提供的特性列表。
  11371. */
  11372. export interface IFeatures {
  11373. /**
  11374. * 是否支持GPU实例化。
  11375. */
  11376. gpuInstance: boolean
  11377. /**
  11378. * 是否支持3D动态合批。
  11379. */
  11380. dynamicBatch3D: boolean
  11381. /**
  11382. * 是否支持硬件SRGB解码。
  11383. */
  11384. srgb: boolean
  11385. /**
  11386. * 是否支持各向异性滤波。
  11387. */
  11388. textureAnisotropic: boolean
  11389. /**
  11390. * 是否支持浮点纹理。
  11391. */
  11392. textureFloat: boolean
  11393. /**
  11394. * 是否支持半精度浮点纹理。
  11395. */
  11396. textureHalfFloat: boolean
  11397. /**
  11398. * 是否支持浮点类型的颜色缓冲。
  11399. */
  11400. colorBufferFloat: boolean
  11401. /**
  11402. * 是否支持深度纹理。
  11403. */
  11404. depthTexture: boolean
  11405. /**
  11406. * 是否支持在片段着色器采样深度。
  11407. */
  11408. fragDepth: boolean
  11409. }
  11410. export interface IRect {
  11411. x: number
  11412. y: number
  11413. w: number
  11414. h: number
  11415. }
  11416. /**
  11417. * 对一个View进行清屏的操作。
  11418. */
  11419. export interface IViewAction {
  11420. /**
  11421. * 颜色操作。
  11422. */
  11423. colorAction?: ELoadAction
  11424. /**
  11425. * 深度操作。
  11426. */
  11427. depthAction?: ELoadAction
  11428. /**
  11429. * 模板操作。
  11430. */
  11431. stencilAction?: ELoadAction
  11432. /**
  11433. * 用于清屏的颜色值。
  11434. *
  11435. * @default [0,0,0,0]
  11436. */
  11437. clearColor?: [number, number, number, number]
  11438. /**
  11439. * 用于清屏的深度值。
  11440. *
  11441. * @default 1
  11442. */
  11443. clearDepth?: number
  11444. /**
  11445. * 用于清屏的模板值。
  11446. *
  11447. * @default 0
  11448. */
  11449. clearStencil?: number
  11450. }
  11451. /**
  11452. * 视图接口。
  11453. */
  11454. export interface IView {
  11455. /**
  11456. * 视图清屏操作。
  11457. */
  11458. passAction: IViewAction
  11459. /**
  11460. * 视图区域。
  11461. */
  11462. viewport: IRect
  11463. /**
  11464. * 裁剪区域。
  11465. */
  11466. scissor: IRect
  11467. }
  11468. /**
  11469. * 附件接口。
  11470. */
  11471. export interface IAttachment {
  11472. texture: IHandle
  11473. level?: number
  11474. slice?: number
  11475. }
  11476. /**
  11477. * 渲染通道描述符。
  11478. */
  11479. export interface IRenderPassDescriptor {
  11480. colors: IAttachment[]
  11481. depth: IAttachment
  11482. stencil: IAttachment
  11483. }
  11484. export enum EEventType {
  11485. SetRootEntity = 1,
  11486. AddChild = 2,
  11487. AddChildAtIndex = 3,
  11488. RemoveFromParent = 4,
  11489. DisperseSubTree = 5,
  11490. BindToBone = 6,
  11491. BindToBones = 7,
  11492. UnBindFromBone = 8,
  11493. UnBindFromBones = 9,
  11494. EntityCommandActive = 10,
  11495. EntityCommandInActive = 11
  11496. }
  11497. export interface IGlyphInfo {
  11498. code: number
  11499. tex: number
  11500. uv_x: number
  11501. uv_y: number
  11502. uv_w: number
  11503. uv_h: number
  11504. advance: number
  11505. bearing_x: number
  11506. bearing_y: number
  11507. width: number
  11508. height: number
  11509. }
  11510. export interface IEventBridge {
  11511. entityAddChild(entity: number, child: number): void
  11512. entityAddChildAtIndex(
  11513. entity: number,
  11514. child: number,
  11515. index: number
  11516. ): void
  11517. entityRemoveFromParent(entity: number): void
  11518. entityClear(entity: number): void
  11519. entitySetActive(entity: number, active: boolean): void
  11520. entitySetLocalMatrixDirty(entity: number): void
  11521. setRootEntity(entity: number): void
  11522. refreshWorldTransform(): void
  11523. bindEntityToBone(
  11524. entity: {
  11525. id: number
  11526. },
  11527. boneEntity: {
  11528. id: number
  11529. }
  11530. ): void
  11531. unbindEntityFromBone(entity: { id: number }): void
  11532. bindEntitiesToBones(
  11533. entities: Array<{
  11534. id: number
  11535. }>,
  11536. boneEntities: Array<{
  11537. id: number
  11538. }>
  11539. ): void
  11540. unbindEntitiesFromBones(
  11541. entities: Array<{
  11542. id: number
  11543. }>
  11544. ): void
  11545. }
  11546. export interface IRenderEnv extends IHandle {
  11547. version?: string
  11548. backendType: string
  11549. registerFallbackEffect(lightMode: string, handle?: IHandle): void
  11550. changeMacros(macros: {
  11551. [name: string]: string | number | boolean
  11552. }): void
  11553. changeVirtualMacros(macros: { [name: string]: boolean }): void
  11554. setInternalInstanceInfo(
  11555. type: EMeshRenderType,
  11556. info: Array<{
  11557. uniformKey: string
  11558. attributeName: string
  11559. type: EUniformType
  11560. }>,
  11561. ignored: string[]
  11562. ): void
  11563. getErrors(): string[]
  11564. supportCompressTextures: TCompressTexture[]
  11565. features: IFeatures
  11566. commit_version: string
  11567. use_puppet_sokol: boolean
  11568. }
  11569. export interface INativeMap<T> {
  11570. set(key: T, value: number): void
  11571. get(key: T): number | undefined
  11572. del(key: T): void
  11573. }
  11574. export interface ILongIntNativeMap {
  11575. set(key1: number, key2: number, value: number): void
  11576. get(key1: number, key2: number): number | undefined
  11577. del(key1: number, key2: number): void
  11578. }
  11579. export type WeakRef = any
  11580. export enum EDracoErrorCode {
  11581. kDecodeErrorNone = 0,
  11582. kDecodeErrorDecodeGeometryType = 1,
  11583. kDecodeErrorDracoDecode = 2,
  11584. kDecodeErrorAttributeEmpty = 3,
  11585. kDecodeErrorAttributeSizeNotEqual = 4,
  11586. kDecodeErrorDecodeTypeError = 5
  11587. }
  11588. export enum EDracoGeometryType {
  11589. kGeometryTypeInvalid = -1,
  11590. kGeometryTypeTriangleMesh = 0,
  11591. kGeometryTypePointCloud = 1
  11592. }
  11593. export enum EDracoDecodeType {
  11594. kDecodeTypeCross = 0
  11595. }
  11596. export enum EDracoDataType {
  11597. DT_INVALID = 0,
  11598. DT_INT8 = 1,
  11599. DT_UINT8 = 2,
  11600. DT_INT16 = 3,
  11601. DT_UINT16 = 4,
  11602. DT_INT32 = 5,
  11603. DT_UINT32 = 6,
  11604. DT_INT64 = 7,
  11605. DT_UINT64 = 8,
  11606. DT_FLOAT32 = 9,
  11607. DT_FLOAT64 = 10,
  11608. DT_BOOL = 11,
  11609. DT_TYPES_COUNT = 12
  11610. }
  11611. export interface DracoDecoded {
  11612. errCode: EDracoErrorCode
  11613. buffer: ArrayBuffer
  11614. geoType: EDracoGeometryType
  11615. stride: number
  11616. count: number
  11617. numIndices: number
  11618. attrs: Array<{
  11619. numComponents: number
  11620. dataType: EDracoDataType
  11621. offset: number
  11622. numBytes: number
  11623. }>
  11624. }
  11625. }
  11626. declare module 'XrFrame/kanata/lib/index' {
  11627. /**
  11628. * index.ts
  11629. *
  11630. * * @Date : 2020/8/18 下午4:48:36
  11631. */
  11632. export * from 'XrFrame/kanata/lib/frontend'
  11633. export * from 'XrFrame/kanata/lib/backend/interface'
  11634. export const VERSION = '1.0.4'
  11635. const Puppet: any
  11636. export { Puppet }
  11637. /**
  11638. * 根据数据,返回二维节点对应结构的Float32array
  11639. */
  11640. export function composeRawBufferEntity2D(
  11641. rotation: number,
  11642. position: ArrayLike<number>,
  11643. scale: ArrayLike<number>
  11644. ): Float32Array
  11645. /**
  11646. * 根据数据,返回三维节点对应结构的Float32array,除WorldMatrix。
  11647. */
  11648. export function composeRawBufferEntity3D(
  11649. useEuler: boolean,
  11650. rotation: ArrayLike<number>,
  11651. position: ArrayLike<number>,
  11652. scale: ArrayLike<number>
  11653. ): Float32Array
  11654. /**
  11655. * 根据数据,返回三维节点对应结构的Float32array
  11656. */
  11657. export function composeRawBufferEntity3DWhole(
  11658. useEuler: boolean,
  11659. rotation: ArrayLike<number>,
  11660. position: ArrayLike<number>,
  11661. scale: ArrayLike<number>
  11662. ): Float32Array
  11663. }
  11664. declare module 'XrFrame/components/text/types' {
  11665. import { Kanata } from 'XrFrame/ext'
  11666. import { IGlyph } from 'XrFrame/glyph'
  11667. export interface IRenderData {
  11668. vertexBuffer?: Kanata.VertexBuffer
  11669. indexBuffer?: Kanata.IndexBuffer
  11670. vertexNum?: number
  11671. indiceNum?: number
  11672. texture?: number
  11673. }
  11674. export interface ICharacterData {
  11675. x: number
  11676. y: number
  11677. width: number
  11678. height: number
  11679. batchIndex: number
  11680. character: string
  11681. glyph: IGlyph
  11682. }
  11683. export enum EHorzAlignment {
  11684. Left = 0,
  11685. Center = 1,
  11686. Right = 2
  11687. }
  11688. export enum EVertAlignment {
  11689. Top = 0,
  11690. Middle = 1,
  11691. Bottom = 2
  11692. }
  11693. }
  11694. declare module 'XrFrame/glyph' {
  11695. export interface IGlyph {
  11696. character?: string
  11697. offsetX: number
  11698. offsetY: number
  11699. bearingX: number
  11700. bearingY: number
  11701. advance: number
  11702. width: number
  11703. height: number
  11704. uvs: number[]
  11705. texture: number
  11706. }
  11707. }
  11708. declare module 'XrFrame/components/text/typesetting' {
  11709. import {
  11710. EHorzAlignment,
  11711. EVertAlignment,
  11712. ICharacterData
  11713. } from 'XrFrame/components/text/types'
  11714. import { IGlyph } from 'XrFrame/glyph'
  11715. export function Typesetting(
  11716. glyphs: IGlyph[],
  11717. batchArrays: ICharacterData[][],
  11718. batchIndexs: number[],
  11719. wrapWidth: number,
  11720. wrapHeight: number,
  11721. lineHeight: number,
  11722. anchor: number[],
  11723. padding: number[],
  11724. vertAlign: EVertAlignment,
  11725. horzAlign: EHorzAlignment
  11726. ): void
  11727. }
  11728. declare module 'XrFrame/components/text/fillRenderData' {
  11729. import { ICharacterData } from 'XrFrame/components/text/types'
  11730. export function FillRenderData(
  11731. vertexF32: Float32Array,
  11732. indexU16: Uint16Array,
  11733. batchArray: ICharacterData[]
  11734. ): void
  11735. }
  11736. declare module 'XrFrame/components/particle/ParticleInstance' {
  11737. import {
  11738. FactorGradient,
  11739. ColorGradient
  11740. } from 'XrFrame/components/particle/gradient'
  11741. import Particle from 'XrFrame/components/particle/Particle'
  11742. import Vector2 from 'XrFrame/math/vector2'
  11743. import Vector3 from 'XrFrame/math/vector3'
  11744. import Vector4 from 'XrFrame/math/vector4'
  11745. export default class ParticleInstance {
  11746. static count: number
  11747. id: number
  11748. position: Vector3
  11749. direction: Vector3
  11750. speed: number
  11751. color: Vector4
  11752. colorStep: Vector4
  11753. rampPos: Vector4
  11754. lifeTime: number
  11755. age: number
  11756. drag: number
  11757. size: number
  11758. startSize: number
  11759. sizeGradientFactor: number
  11760. scale: Vector2
  11761. angle: number
  11762. angularSpeed: number
  11763. particleSystem: Particle
  11764. currentSize: number
  11765. currentSize2: number
  11766. currentSizeGradient: FactorGradient
  11767. currentColor: Vector4
  11768. currentColor2: Vector4
  11769. currentColorGradient: ColorGradient
  11770. currentAlpha: number
  11771. currentAlpha2: number
  11772. currentAlphaGradient: FactorGradient
  11773. currentSpeedScale: number
  11774. currentSpeedScale2: number
  11775. currentSpeedScaleGradient: FactorGradient
  11776. currentLimitSpeed: number
  11777. currentLimitSpeed2: number
  11778. currentLimitSpeedGradient: FactorGradient
  11779. currentDrag: number
  11780. currentDrag2: number
  11781. currentDragGradient: FactorGradient
  11782. subEmitterMuster: any
  11783. startSpriteCellIndex: number
  11784. endSpriteCellIndex: number
  11785. cellIndex: number
  11786. randomCellOffset: any
  11787. constructor(particle: Particle)
  11788. /**
  11789. * 重置粒子实例的状态。
  11790. */
  11791. reset(): void
  11792. /**
  11793. * 将当前粒子实例的状态拷贝到目标实例。
  11794. * @param {ParticleInstance} other 目标粒子实例
  11795. */
  11796. copyTo(other: ParticleInstance): void
  11797. /**
  11798. * 更新从动画图集采样的帧序号
  11799. */
  11800. updateCellIndex(): void
  11801. clamp(num: any, left?: number, right?: number): any
  11802. }
  11803. }
  11804. declare module 'XrFrame/components/emitter/BasicShapeEmitter' {
  11805. import Vector3 from 'XrFrame/math/vector3'
  11806. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance'
  11807. import Matrix4 from 'XrFrame/math/matrix4'
  11808. export abstract class BasicShapeEmitter {
  11809. /**
  11810. * keep normalized length
  11811. */
  11812. direction?: Vector3
  11813. /**
  11814. * keep normalized length
  11815. */
  11816. direction2?: Vector3
  11817. abstract startDirection(
  11818. worldMatrix: Matrix4,
  11819. direction: Vector3,
  11820. ...args: any[]
  11821. ): void
  11822. abstract startPosition(
  11823. worldMatrix: Matrix4,
  11824. position: Vector3,
  11825. ...args: any[]
  11826. ): void
  11827. processInstance?(instance: ParticleInstance, deltaTime: number): void
  11828. setProperty(properties: any): void
  11829. }
  11830. }
  11831. declare module 'XrFrame/components/emitter' {
  11832. import BoxShapeEmitter from 'XrFrame/components/emitter/BoxShapeEmitter'
  11833. import PointShapeEmitter from 'XrFrame/components/emitter/PointShapeEmitter'
  11834. import DrawShapeEmitter from 'XrFrame/components/emitter/DrawShapeEmitter'
  11835. import SphereShapeEmitter from 'XrFrame/components/emitter/SphereShapeEmitter'
  11836. import ConeShapeEmitter from 'XrFrame/components/emitter/ConeShapeEmitter'
  11837. import CircleShapeEmitter from 'XrFrame/components/emitter/CircleShapeEmitter'
  11838. export {
  11839. BoxShapeEmitter,
  11840. PointShapeEmitter,
  11841. DrawShapeEmitter,
  11842. SphereShapeEmitter,
  11843. ConeShapeEmitter,
  11844. CircleShapeEmitter
  11845. }
  11846. }
  11847. declare module 'XrFrame/components/emitter/SubEmitter' {
  11848. import Particle from 'XrFrame/components/particle/Particle'
  11849. /**
  11850. * 粒子子发射器的依附状态。
  11851. */
  11852. export const enum SubEmitterState {
  11853. /**
  11854. * 依附于粒子整个生命周期
  11855. */
  11856. ATTACH = 0,
  11857. /**
  11858. * 在粒子生命周期末出现
  11859. */
  11860. END = 1
  11861. }
  11862. export class SubEmitter {
  11863. particleSystem: Particle
  11864. state: SubEmitterState
  11865. constructor(particleSystem: any)
  11866. /**
  11867. * 通过克隆,获取指定的粒子子发射器实例
  11868. * @return {SubEmitter} 克隆后的子发射器实例
  11869. */
  11870. clone(): SubEmitter
  11871. }
  11872. }
  11873. declare module 'XrFrame/physics/event' {
  11874. import type Element from 'XrFrame/core/Element'
  11875. /**
  11876. * 物理{@link PhysicsDelegate | Delegate}注册的事件回调类型。
  11877. * @category Physics
  11878. * @template E 事件回调接收的参数类型。
  11879. */
  11880. export type DelegateHandler<E> = (e: E) => void
  11881. /**
  11882. * 挂在entity上的delegate, 不持有native comp,
  11883. * 而是持有多个subDelegate, 通过这些subDelegate来invoke.
  11884. * 主要作用是让script里可以直接写个onCollisionEnter()的函数来接收该节点下所有物理组件的事件.
  11885. */
  11886. export class SharedDelegate<E extends object> {
  11887. add(handler: DelegateHandler<E>, context?: any): void
  11888. remove(handler: DelegateHandler<E>): void
  11889. invoke(e: E): void
  11890. dispose(): void
  11891. }
  11892. /**
  11893. * 用来注册回调并接收某个**特定**物理事件的Delegate。
  11894. * @category Physics
  11895. * @template E 事件回调接收的参数类型。
  11896. * @see {@link Collider} {@link CharacterController}
  11897. */
  11898. export class Delegate<E extends object> {
  11899. /**
  11900. * @class 挂在物理组件上的Delegate, 内部持有native comp, 由native comp来invoke.
  11901. */
  11902. protected nativeMethod: string
  11903. _shared?: SharedDelegate<E>
  11904. /** @internal */
  11905. isPhysicsDelegate: true
  11906. protected xmlEvent: string
  11907. protected _el: Element
  11908. /** @internal */
  11909. protected _handlers: Map<DelegateHandler<E>, any>
  11910. /** @internal */
  11911. constructor(
  11912. nativeCollider: phys3D.Collider | undefined,
  11913. nativeMethod: string,
  11914. el: Element,
  11915. xmlEvent: string
  11916. )
  11917. get nativeCollider(): phys3D.Collider | undefined
  11918. set nativeCollider(v: phys3D.Collider | undefined)
  11919. clearNativeHandler(): void
  11920. /**
  11921. * 注册事件回调。
  11922. */
  11923. add(
  11924. handler: DelegateHandler<E>,
  11925. context?: any
  11926. ): DelegateHandler<E> | void
  11927. /**
  11928. * 移除已注册的事件回调。
  11929. */
  11930. remove(handler: DelegateHandler<E>): void
  11931. /**
  11932. * @internal
  11933. */
  11934. invoke(native: phys3D.ControllerColliderHit | phys3D.Collision): void
  11935. /**
  11936. * 移除所有事件回调。
  11937. */
  11938. clear(): void
  11939. /**
  11940. * @internal
  11941. */
  11942. dispose(): void
  11943. set el(v: Element)
  11944. xmlInvoker?: DelegateHandler<E>
  11945. addXMLInvoker(): void
  11946. removeXMLInvoker(): void
  11947. }
  11948. }
  11949. declare module 'XrFrame/components/physics/types' {
  11950. export const allShapeNames: string[]
  11951. /**
  11952. * 对刚体(在某个轴上的)位移和旋转的限制。
  11953. *
  11954. * @category Physics
  11955. * @see {@link IRigidbodyData.constraintsMask}
  11956. */
  11957. export enum RigidbodyConstraints {
  11958. None = 0,
  11959. FreezePositionX = 1,
  11960. FreezePositionY = 2,
  11961. FreezePositionZ = 4,
  11962. FreezeRotationX = 8,
  11963. FreezeRotationY = 16,
  11964. FreezeRotationZ = 32,
  11965. FreezePosition = 7,
  11966. FreezeRotation = 56,
  11967. FreezeAll = 63
  11968. }
  11969. /**
  11970. * @category Physics
  11971. */
  11972. export enum CollisionDetectionMode {
  11973. Discrete = 0,
  11974. Continuous = 1,
  11975. ContinuousDynamic = 2,
  11976. ContinuousSpeculative = 3
  11977. }
  11978. /**
  11979. * 力(或力矩)的类型,物理组件中某些接口会用到。
  11980. * @category Physics
  11981. * @see {@link Rigidbody.addForce} {@link Rigidbody.addTorque}
  11982. */
  11983. export enum ForceMode {
  11984. /**
  11985. * 持续性的力。
  11986. */
  11987. Force = 0,
  11988. /**
  11989. * 只持续一帧的力。
  11990. */
  11991. Impulse = 1,
  11992. /**
  11993. * 只持续一帧的力,无视物体的{@link Rigidbody.mass | 质量}(mass=1)。
  11994. *
  11995. * \**其实就是在下一帧修改物体速度。*
  11996. */
  11997. VelocityChange = 2,
  11998. /**
  11999. * 持续性的力,无视物体的{@link Rigidbody.mass | 质量}(mass=1)。
  12000. *
  12001. * \**其实就是每帧修改物体速度。*
  12002. */
  12003. Acceleration = 4
  12004. }
  12005. /**
  12006. * 发生碰撞时摩擦系数和弹性系数的结合方式。
  12007. * @see {@link Collider.frictionCombine} {@link Collider.bounceCombine}
  12008. */
  12009. export enum CombineMode {
  12010. Average = 0,
  12011. Mininum = 1,
  12012. Multiply = 2,
  12013. Maximum = 3
  12014. }
  12015. }
  12016. declare module 'XrFrame/components/gizmo/CapsuleGizmo' {
  12017. import Component from 'XrFrame/core/Component'
  12018. import Element from 'XrFrame/core/Element'
  12019. export interface ICapsuleGizmoData {
  12020. radius: number
  12021. height: number
  12022. direction: number
  12023. center: [number, number, number]
  12024. }
  12025. export const CapsuleGizmoSchema: {}
  12026. export default class CapsuleGizmo extends Component<ICapsuleGizmoData> {
  12027. static pieces: number
  12028. onAdd(parent: Element, data: ICapsuleGizmoData): void
  12029. onUpdate(data: ICapsuleGizmoData, preData: ICapsuleGizmoData): void
  12030. onTick(deltaTime: number, data: ICapsuleGizmoData): void
  12031. onRemove(parent: Element, data: ICapsuleGizmoData): void
  12032. onRelease(data: ICapsuleGizmoData): void
  12033. }
  12034. }
  12035. declare module 'XrFrame/components/gizmo/CubeGizmo' {
  12036. import Component from 'XrFrame/core/Component'
  12037. import Element from 'XrFrame/core/Element'
  12038. export interface ICubeGizmoData {
  12039. size: [number, number, number]
  12040. center: [number, number, number]
  12041. }
  12042. export const CubeGizmoSchema: {}
  12043. export default class CubeGizmo extends Component<ICubeGizmoData> {
  12044. onAdd(parent: Element, data: ICubeGizmoData): void
  12045. onUpdate(data: ICubeGizmoData, preData: ICubeGizmoData): void
  12046. onTick(deltaTime: number, data: ICubeGizmoData): void
  12047. onRemove(parent: Element, data: ICubeGizmoData): void
  12048. onRelease(data: ICubeGizmoData): void
  12049. }
  12050. }
  12051. declare module 'XrFrame/render-graph/RenderGraph' {
  12052. import RGNode, { TRGNodeAny } from 'XrFrame/render-graph/RGNode'
  12053. import Camera from 'XrFrame/components/Camera'
  12054. type RenderSystem = import('XrFrame/systems/RenderSystem').default
  12055. type Scene = import('XrFrame/core/Scene').default
  12056. interface IDigraphNode {
  12057. node: TRGNodeAny
  12058. ins: number
  12059. dist: number[]
  12060. }
  12061. /**
  12062. * 渲染图。
  12063. *
  12064. * @category Render
  12065. */
  12066. export default class RenderGraph<IOptions = any> {
  12067. protected _name: string
  12068. protected _options: IOptions
  12069. protected _scene?: Scene
  12070. protected _isActive: boolean
  12071. protected _isDirty: boolean
  12072. protected _unusedIds: number[]
  12073. protected _digraph: Array<IDigraphNode | undefined>
  12074. protected _sorted: TRGNodeAny[]
  12075. /**
  12076. * 图名字。
  12077. */
  12078. get name(): string
  12079. /**
  12080. * 当前正在运行的Game实例。
  12081. */
  12082. get scene(): import('XrFrame/core/Scene').default
  12083. /**
  12084. * 当前的渲染上下文。
  12085. */
  12086. get context(): import('XrFrame/systems/RenderSystem').default
  12087. constructor(_name: string, _options: IOptions)
  12088. /**
  12089. * 创建一个节点。
  12090. */
  12091. createNode<TRGNode extends TRGNodeAny>(
  12092. name: string,
  12093. clz: new (...args: any) => TRGNode,
  12094. options: TRGNode['options']
  12095. ): TRGNode
  12096. /**
  12097. * 销毁一个节点。
  12098. */
  12099. destroyNode(rgNode: TRGNodeAny): void
  12100. /**
  12101. * 连接两个节点。
  12102. *
  12103. * @param inputKey 需要将`from`节点的输出连接到哪个`to`节点的输入。
  12104. */
  12105. connect<TToNode extends TRGNodeAny>(
  12106. from: TRGNodeAny,
  12107. to: TToNode,
  12108. inputKey?: keyof TToNode['inputTypes']
  12109. ): void
  12110. /**
  12111. * 断开两个节点的连接。
  12112. */
  12113. disconnect(from: TRGNodeAny, to: TRGNodeAny): void
  12114. /**
  12115. * @internal
  12116. */
  12117. /**
  12118. * @internal
  12119. */
  12120. /**
  12121. * @internal
  12122. */
  12123. /**
  12124. * 清空整个图,一般用于图的重新构建。
  12125. *
  12126. * @param filter 过滤出需要保留、不被销毁的缓存节点,这些节点只会被重置状态。
  12127. */
  12128. protected _clear(
  12129. filter?: (node: RGNode<any, any, any>) => boolean
  12130. ): void
  12131. protected _handleCamerasChange: (context: RenderSystem) => void
  12132. /**
  12133. * 图在被第一次真正使用时的回调。
  12134. */
  12135. onActive(context: RenderSystem, options: IOptions): void
  12136. /**
  12137. * 在渲染上下文中的相机改变时调用,一般用于重新构建图。
  12138. */
  12139. onCamerasChange(cameras: Camera[], changeCameras: Camera[]): void
  12140. /**
  12141. * 在图每帧执行前调用。
  12142. */
  12143. onExecuteBegin(context: RenderSystem, options: IOptions): void
  12144. /**
  12145. * 在图每帧执行后调用。
  12146. */
  12147. onExecuteDone(context: RenderSystem, options: IOptions): void
  12148. /**
  12149. * 在图不再使用时调用。
  12150. */
  12151. onDisable(context: RenderSystem, options: IOptions): void
  12152. /**
  12153. * @internal
  12154. *
  12155. * 编译整张图。
  12156. */
  12157. showDebugInfo(
  12158. callback?: (
  12159. digraph: Array<IDigraphNode | undefined>,
  12160. sorted: TRGNodeAny[]
  12161. ) => void
  12162. ): string
  12163. }
  12164. export {}
  12165. }
  12166. declare module 'XrFrame/systems/LightManager' {
  12167. /**
  12168. * LightManager.ts
  12169. *
  12170. * * @Date : 4/11/2022, 2:29:36 PM
  12171. */
  12172. import Camera from 'XrFrame/components/Camera'
  12173. import Light from 'XrFrame/components/Light'
  12174. export interface IMainLightsInfo {
  12175. hasAmbient: boolean
  12176. hasMainDir: boolean
  12177. ambientColorIns: Float32Array
  12178. mainDir: Float32Array
  12179. mainColorIns: Float32Array
  12180. }
  12181. export interface IAddLightsInfo {
  12182. count: number
  12183. info: Float32Array
  12184. dir: Float32Array
  12185. pos: Float32Array
  12186. colorIns: Float32Array
  12187. }
  12188. export default class LightManager {}
  12189. }
  12190. declare module 'XrFrame/loader/glTF/animations/GLTFAnimationsNode' {
  12191. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12192. import { GLTFNodesLoaded } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  12193. import GLTFAnimationNode, {
  12194. GLTFAnimationLoaded,
  12195. GLTFAnimationNodeRaw
  12196. } from 'XrFrame/loader/glTF/animations/GLTFAnimationNode'
  12197. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  12198. type ChildNode = GLTFAnimationNode
  12199. export type GLTFAnimationsNodeRaw = GLTFAnimationsNodeRaw[]
  12200. export type GLTFAnimationsLoaded = GLTFAnimationLoaded[]
  12201. export default class GLTFAnimationsNode extends GLTFArrayNode<ChildNode> {
  12202. ChildCtor(childRaw: GLTFAnimationNodeRaw): GLTFAnimationNode
  12203. readonly raw: GLTFAnimationsNodeRaw
  12204. get nodeName(): string
  12205. preload: (
  12206. prerequisites: [
  12207. accessors: GLTFAccessorsLoaded,
  12208. nodes: GLTFNodesLoaded
  12209. ]
  12210. ) => Promise<GLTFAnimationsLoaded>
  12211. getLoadedResource(): GLTFAnimationsLoaded
  12212. }
  12213. export {}
  12214. }
  12215. declare module 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode' {
  12216. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12217. import GLTFAccessorNode, {
  12218. GLTFAccessorLoaded,
  12219. GLTFAccessorNodeRaw
  12220. } from 'XrFrame/loader/glTF/buffers/GLTFAccessorNode'
  12221. import { GLTFBufferViewsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode'
  12222. type ChildNode = GLTFAccessorNode
  12223. export type GLTFAccessorsNodeRaw = GLTFAccessorsNodeRaw[]
  12224. export type GLTFAccessorsLoaded = GLTFAccessorLoaded[]
  12225. export default class GLTFAccessorsNode extends GLTFArrayNode<ChildNode> {
  12226. ChildCtor(childRaw: GLTFAccessorNodeRaw): GLTFAccessorNode
  12227. readonly raw: GLTFAccessorsNodeRaw
  12228. get nodeName(): string
  12229. preload: (
  12230. prerequisites: GLTFBufferViewsLoaded
  12231. ) => Promise<GLTFAccessorsLoaded>
  12232. getLoadedResource(): GLTFAccessorsLoaded
  12233. }
  12234. export {}
  12235. }
  12236. declare module 'XrFrame/loader/glTF/buffers/GLTFBuffersNode' {
  12237. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12238. import GLTFBufferNode, {
  12239. GLTFBufferLoaded,
  12240. GLTFBufferNodeRaw
  12241. } from 'XrFrame/loader/glTF/buffers/GLTFBufferNode'
  12242. type ChildNode = GLTFBufferNode
  12243. export type GLTFBuffersNodeRaw = GLTFBufferNodeRaw[]
  12244. export type GLTFBuffersLoaded = GLTFBufferLoaded[]
  12245. export default class GLTFBuffersNode extends GLTFArrayNode<ChildNode> {
  12246. ChildCtor(childRaw: GLTFBufferNodeRaw): GLTFBufferNode
  12247. readonly raw: GLTFBuffersNodeRaw
  12248. get nodeName(): string
  12249. getLoadedResource(): GLTFBuffersLoaded
  12250. }
  12251. export {}
  12252. }
  12253. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode' {
  12254. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12255. import { GLTFBufferLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferNode'
  12256. import GLTFBufferViewNode, {
  12257. GLTFBufferViewLoaded,
  12258. GLTFBufferViewNodeRaw
  12259. } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewNode'
  12260. type ChildNode = GLTFBufferViewNode
  12261. export type GLTFBufferViewsNodeRaw = GLTFBufferViewsNodeRaw[]
  12262. export type GLTFBufferViewsLoaded = GLTFBufferViewLoaded[]
  12263. export default class GLTFBufferViewsNode extends GLTFArrayNode<ChildNode> {
  12264. ChildCtor(childRaw: GLTFBufferViewNodeRaw): GLTFBufferViewNode
  12265. readonly raw: GLTFBufferViewsNodeRaw
  12266. get nodeName(): string
  12267. preload: (
  12268. prerequisites: [GLTFBufferLoaded]
  12269. ) => Promise<GLTFBufferViewsLoaded>
  12270. getLoadedResource(): GLTFBufferViewsLoaded
  12271. }
  12272. export {}
  12273. }
  12274. declare module 'XrFrame/loader/glTF/extensions/GLTFExtensions' {
  12275. /**
  12276. * 创建GLTFExtensionProfileBuilder实例来定义一种extension,
  12277. * 类内提供了三种方法来操作gltf树:
  12278. * + 一种是substitutePreload,替换gltf节点的preload函数;
  12279. * + 一种是postBuild,在gltf树preload全部完成之后,再对其进行自定义操作;
  12280. * + 一种是registerRunInSlot,需要先在gltf节点内部使用extensionSlot定义一个槽位,然后往这个槽位里填写代码。
  12281. *
  12282. * 具体要使用哪些extension请看GLTFLoader.ts。
  12283. */
  12284. type SlotCode = (
  12285. raw: object,
  12286. extensionGlobal: object,
  12287. prerequisites: any,
  12288. args: any
  12289. ) => Promise<void>
  12290. type ForceSlotCode = (
  12291. extensionGlobal: object,
  12292. prerequisites: any,
  12293. args: any
  12294. ) => Promise<void>
  12295. export class GLTFExtensionProfileBuilder {
  12296. constructor(extName: string)
  12297. registerRootInit(
  12298. init: (raw: object, extensionGlobal: object) => void
  12299. ): void
  12300. registerSubstitutePreload(
  12301. path: string,
  12302. preload: (
  12303. raw: object,
  12304. extensionGlobal: object,
  12305. prerequisites?: object
  12306. ) => Promise<any>
  12307. ): void
  12308. registerPostBuild(
  12309. execute: (root: any, extensionGlobal: object) => Promise<void>
  12310. ): void
  12311. registerRunInSlot(slotId: string, code: SlotCode): void
  12312. /**
  12313. * 不管当前节点有没有extension,都运行,但是运行的时候不会给extRaw(因为可能没有)。
  12314. */
  12315. registerForceRunInSlot(slotId: string, code: ForceSlotCode): void
  12316. }
  12317. export interface GLTFExtensionProfile {
  12318. readonly name: string
  12319. readonly preloads: {
  12320. [path: string]: (
  12321. raw: string,
  12322. extensionGlobal: object,
  12323. prerequisites?: object
  12324. ) => Promise<any>
  12325. }
  12326. readonly postBuild?: (root: any, extensionGlobal: object) => void
  12327. readonly slotCodeMap: Map<string, SlotCode>
  12328. readonly forceSlotCodeMap: Map<string, ForceSlotCode>
  12329. readonly rootInit: (raw: object, extensionGlobal: object) => void
  12330. }
  12331. export type GLTFExtensionsProfiles = {
  12332. [name: string]: GLTFExtensionProfile
  12333. }
  12334. export {}
  12335. }
  12336. declare module 'XrFrame/loader/glTF/geometry/GLTFMeshesNode' {
  12337. import { Kanata } from 'XrFrame/ext'
  12338. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  12339. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12340. import { GLTFMaterialsLoaded } from 'XrFrame/loader/glTF/materials/GLTFMaterialsNode'
  12341. import GLTFMeshNode, {
  12342. GLTFMeshLoaded,
  12343. GLTFMeshNodeRaw
  12344. } from 'XrFrame/loader/glTF/geometry/GLTFMeshNode'
  12345. type ChildNode = GLTFMeshNode
  12346. export type GLTFMeshesNodeRaw = GLTFMeshesNodeRaw[]
  12347. export type GLTFMeshesLoaded = GLTFMeshLoaded[]
  12348. export default class GLTFMeshesNode extends GLTFArrayNode<ChildNode> {
  12349. ChildCtor(childRaw: GLTFMeshNodeRaw): GLTFMeshNode
  12350. readonly raw: GLTFMeshesNodeRaw
  12351. get nodeName(): string
  12352. preload: (
  12353. prerequisites: [
  12354. materials: GLTFMaterialsLoaded,
  12355. accessors: GLTFAccessorsLoaded,
  12356. vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>
  12357. ]
  12358. ) => Promise<GLTFMeshesLoaded>
  12359. getLoadedResource(): GLTFMeshesLoaded
  12360. }
  12361. export {}
  12362. }
  12363. declare module 'XrFrame/loader/glTF/GLTFBaseNode' {
  12364. import { GLTFValidation } from 'XrFrame/loader/glTF/utils/exceptions'
  12365. type Scene = import('XrFrame/core/Scene').default
  12366. function _empty(): {
  12367. and: typeof _empty
  12368. }
  12369. export abstract class GLTFBaseNode {
  12370. readonly raw: any
  12371. abstract get nodeName(): string
  12372. parent: GLTFBaseNode
  12373. scene: Scene
  12374. isValid: boolean
  12375. constructor(raw: object, parent?: GLTFBaseNode)
  12376. /**
  12377. * 利用raw生成子节点
  12378. */
  12379. abstract build(): void
  12380. /**
  12381. * @param msg 需要带句号
  12382. */
  12383. protected assert(
  12384. pred: any,
  12385. msg?: string
  12386. ):
  12387. | this
  12388. | {
  12389. and: typeof _empty
  12390. }
  12391. protected validate(
  12392. use: GLTFValidation<any>,
  12393. pred?: boolean | string,
  12394. ...args: string[]
  12395. ):
  12396. | this
  12397. | {
  12398. and: typeof _empty
  12399. }
  12400. /**
  12401. * 加载静态资源,buffer/image等。
  12402. * 所有错误在这个方法抛出,包括格式错误,加载错误等。
  12403. */
  12404. abstract preload(prerequisites?: object): Promise<object>
  12405. /**
  12406. * 给extension内部使用的,在extension替换preload的时候,用来储存原preload。
  12407. */
  12408. protected _preload: (prerequisites?: object) => Promise<object>
  12409. /**
  12410. * 获取加载后的资源。
  12411. * 无报错 throws nothing。
  12412. */
  12413. abstract getLoadedResource(): object
  12414. protected findRoot(withPath?: boolean): any
  12415. getExtensionRaw(extName: string): object | undefined
  12416. /**
  12417. * 调用这个函数可以放置一个**允许extension代码插入**的位置。
  12418. */
  12419. protected extensionSlot(id: string, args: object): Promise<void>
  12420. releaseLoadedResource(): void
  12421. }
  12422. export abstract class GLTFArrayNode<
  12423. T extends GLTFBaseNode
  12424. > extends GLTFBaseNode {
  12425. abstract readonly raw: object[]
  12426. abstract ChildCtor(childRaw: object): T
  12427. children: T[]
  12428. protected resources: any[]
  12429. preload(prerequisites?: any): Promise<any>
  12430. build(): void
  12431. releaseLoadedResource(): void
  12432. }
  12433. export {}
  12434. }
  12435. declare module 'XrFrame/loader/glTF/materials/GLTFMaterialsNode' {
  12436. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12437. import { GLTFTexturesLoaded } from 'XrFrame/loader/glTF/textures/GLTFTexturesNode'
  12438. import GLTFMaterialNode, {
  12439. GLTFMaterialLoaded,
  12440. GLTFMaterialNodeRaw
  12441. } from 'XrFrame/loader/glTF/materials/GLTFMaterialNode'
  12442. type ChildNode = GLTFMaterialNode
  12443. export type GLTFMaterialsNodeRaw = GLTFMaterialsNodeRaw[]
  12444. export type GLTFMaterialsLoaded = GLTFMaterialLoaded[]
  12445. export default class GLTFMaterialsNode extends GLTFArrayNode<ChildNode> {
  12446. ChildCtor(childRaw: GLTFMaterialNodeRaw): GLTFMaterialNode
  12447. readonly raw: GLTFMaterialsNodeRaw
  12448. get nodeName(): string
  12449. preload: (
  12450. prerequisites: [textrues: GLTFTexturesLoaded]
  12451. ) => Promise<GLTFMaterialsLoaded>
  12452. getLoadedResource(): GLTFMaterialsLoaded
  12453. }
  12454. export {}
  12455. }
  12456. declare module 'XrFrame/loader/glTF/scenes/GLTFSceneNode' {
  12457. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12458. import {
  12459. GLTFNodesLoaded,
  12460. GLTFTreeNode
  12461. } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  12462. export interface GLTFSceneNodeRaw {
  12463. nodes?: number[]
  12464. name?: string
  12465. }
  12466. export type GLTFSceneLoaded = GLTFTreeNode[]
  12467. export default class GLTFSceneNode extends GLTFBaseNode {
  12468. get nodeName(): string
  12469. readonly raw: GLTFSceneNodeRaw
  12470. build(): void
  12471. preload(
  12472. prerequisites: [nodes: GLTFNodesLoaded]
  12473. ): Promise<GLTFSceneLoaded>
  12474. getLoadedResource(): GLTFSceneLoaded
  12475. }
  12476. }
  12477. declare module 'XrFrame/loader/glTF/scenes/GLTFScenesNode' {
  12478. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12479. import { GLTFNodesLoaded } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  12480. import GLTFSceneNode, {
  12481. GLTFSceneLoaded,
  12482. GLTFSceneNodeRaw
  12483. } from 'XrFrame/loader/glTF/scenes/GLTFSceneNode'
  12484. type ChildNode = GLTFSceneNode
  12485. export type GLTFScenesNodeRaw = GLTFScenesNodeRaw[]
  12486. export type GLTFScenesLoaded = GLTFSceneLoaded[]
  12487. export default class GLTFScenesNode extends GLTFArrayNode<ChildNode> {
  12488. ChildCtor(childRaw: GLTFSceneNodeRaw): GLTFSceneNode
  12489. readonly raw: GLTFScenesNodeRaw
  12490. get nodeName(): string
  12491. preload: (
  12492. prerequisites: [nodes: GLTFNodesLoaded]
  12493. ) => Promise<GLTFScenesLoaded>
  12494. getLoadedResource(): GLTFScenesLoaded
  12495. }
  12496. export {}
  12497. }
  12498. declare module 'XrFrame/loader/glTF/skins/GLTFSkinsNode' {
  12499. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  12500. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12501. import GLTFSkinNode, {
  12502. GLTFSkinLoaded,
  12503. GLTFSkinNodeRaw
  12504. } from 'XrFrame/loader/glTF/skins/GLTFSkinNode'
  12505. type ChildNode = GLTFSkinNode
  12506. export type GLTFSkinsNodeRaw = GLTFSkinsNodeRaw[]
  12507. export type GLTFSkinsLoaded = GLTFSkinLoaded[]
  12508. export default class GLTFSkinsNode extends GLTFArrayNode<ChildNode> {
  12509. ChildCtor(childRaw: GLTFSkinNodeRaw): GLTFSkinNode
  12510. readonly raw: GLTFSkinsNodeRaw
  12511. get nodeName(): string
  12512. preload: (
  12513. prerequisites: [accessors: GLTFAccessorsLoaded]
  12514. ) => Promise<GLTFSkinsLoaded>
  12515. getLoadedResource(): GLTFSkinsLoaded
  12516. }
  12517. export {}
  12518. }
  12519. declare module 'XrFrame/loader/glTF/textures/GLTFImagesNode' {
  12520. import { GLTFBufferViewsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode'
  12521. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12522. import GLTFImageNode, {
  12523. GLTFImageLoaded,
  12524. GLTFImageNodeRaw
  12525. } from 'XrFrame/loader/glTF/textures/GLTFImageNode'
  12526. type ChildNode = GLTFImageNode
  12527. export type GLTFImagesNodeRaw = GLTFImagesNodeRaw[]
  12528. export type GLTFImagesLoaded = GLTFImageLoaded[]
  12529. export default class GLTFImagesNode extends GLTFArrayNode<ChildNode> {
  12530. ChildCtor(childRaw: GLTFImageNodeRaw): GLTFImageNode
  12531. readonly raw: GLTFImagesNodeRaw
  12532. get nodeName(): string
  12533. preload: (
  12534. prerequisites: [bufferViews: GLTFBufferViewsLoaded]
  12535. ) => Promise<GLTFImagesLoaded>
  12536. getLoadedResource(): GLTFImagesLoaded
  12537. }
  12538. export {}
  12539. }
  12540. declare module 'XrFrame/loader/glTF/textures/GLTFSamplersNode' {
  12541. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12542. import GLTFSamplerNode, {
  12543. GLTFSamplerLoaded,
  12544. GLTFSamplerNodeRaw
  12545. } from 'XrFrame/loader/glTF/textures/GLTFSamplerNode'
  12546. type ChildNode = GLTFSamplerNode
  12547. export type GLTFSamplersNodeRaw = GLTFSamplersNodeRaw[]
  12548. export type GLTFSamplersLoaded = GLTFSamplerLoaded[]
  12549. export default class GLTFSamplersNode extends GLTFArrayNode<ChildNode> {
  12550. ChildCtor(childRaw: GLTFSamplerNodeRaw): GLTFSamplerNode
  12551. readonly raw: GLTFSamplersNodeRaw
  12552. get nodeName(): string
  12553. preload: () => Promise<GLTFSamplersLoaded>
  12554. getLoadedResource(): GLTFSamplersLoaded
  12555. }
  12556. export {}
  12557. }
  12558. declare module 'XrFrame/loader/glTF/textures/GLTFTexturesNode' {
  12559. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12560. import { GLTFImagesLoaded } from 'XrFrame/loader/glTF/textures/GLTFImagesNode'
  12561. import { GLTFSamplersLoaded } from 'XrFrame/loader/glTF/textures/GLTFSamplersNode'
  12562. import GLTFTextureNode, {
  12563. GLTFTextureLoaded,
  12564. GLTFTextureNodeRaw
  12565. } from 'XrFrame/loader/glTF/textures/GLTFTextureNode'
  12566. type ChildNode = GLTFTextureNode
  12567. export type GLTFTexturesNodeRaw = GLTFTexturesNodeRaw[]
  12568. export type GLTFTexturesLoaded = GLTFTextureLoaded[]
  12569. export default class GLTFTexturesNode extends GLTFArrayNode<ChildNode> {
  12570. ChildCtor(childRaw: GLTFTextureNodeRaw): GLTFTextureNode
  12571. readonly raw: GLTFTexturesNodeRaw
  12572. get nodeName(): string
  12573. preload: (
  12574. prerequisites: [
  12575. images: GLTFImagesLoaded,
  12576. samplers: GLTFSamplersLoaded
  12577. ]
  12578. ) => Promise<GLTFTexturesLoaded>
  12579. getLoadedResource(): GLTFTexturesLoaded
  12580. }
  12581. export {}
  12582. }
  12583. declare module 'XrFrame/loader/glTF/utils/exceptions' {
  12584. import type { GLTFTargetNodeRaw } from 'XrFrame/loader/glTF/animations/channels/GLTFTargetNode'
  12585. import type { GLTFAccessorNodeRaw } from 'XrFrame/loader/glTF/buffers/GLTFAccessorNode'
  12586. import type { GLTFAttributesNodeRaw } from 'XrFrame/loader/glTF/geometry/primitives/attributes/GLTFAttributesNode'
  12587. import type { GLTFPrimitiveNodeRaw } from 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitiveNode'
  12588. import type { GLTFNodeNodeRaw } from 'XrFrame/loader/glTF/scenes/GLTFNodeNode'
  12589. import type { GLTFTextureNodeRaw } from 'XrFrame/loader/glTF/textures/GLTFTextureNode'
  12590. export enum EValidation {
  12591. TextureSource = 10001,
  12592. SkinAccessor = 10101,
  12593. NodeWeights = 10201,
  12594. MorphAttrib = 10301,
  12595. UVSlot = 10401,
  12596. JointSlot = 10402,
  12597. WeightSlot = 10403,
  12598. MorphTargetsCount = 10501,
  12599. PrimitiveType = 10502,
  12600. IndexBufferLength = 10503,
  12601. SparseAccessor = 10601,
  12602. NormalizedAccessor = 10602
  12603. }
  12604. interface Validation<T> {
  12605. id: EValidation
  12606. msg: string
  12607. validate?(raw: T): boolean
  12608. fatal?: boolean
  12609. }
  12610. export namespace GLTFValidations {
  12611. const UndefinedTextureSource: Validation<GLTFTextureNodeRaw>
  12612. const SkinAccessorNotCompact: Validation<void>
  12613. const UnsupportedNodeWeights: Validation<GLTFNodeNodeRaw>
  12614. const UnsupportedMorphAttrib: Validation<GLTFTargetNodeRaw>
  12615. const UnsupportedUVSlot: Validation<GLTFAttributesNodeRaw>
  12616. const UnsupportedJointSlot: Validation<GLTFAttributesNodeRaw>
  12617. const UnsupportedWeightSlot: Validation<GLTFAttributesNodeRaw>
  12618. const MorphTargetsCountExceeded: Validation<GLTFPrimitiveNodeRaw>
  12619. const UnsupportedPrimitiveType: Validation<GLTFPrimitiveNodeRaw>
  12620. const InvalidIndexBufferLength: Validation<GLTFPrimitiveNodeRaw>
  12621. const UnsupportedSparseAccessor: Validation<GLTFAccessorNodeRaw>
  12622. const UnsupportedNormalizedAccessor: Validation<GLTFAccessorNodeRaw>
  12623. }
  12624. export { Validation as GLTFValidation }
  12625. export const GLTFValidationMap: {
  12626. 10001: Validation<GLTFTextureNodeRaw>
  12627. 10101: Validation<void>
  12628. 10201: Validation<GLTFNodeNodeRaw>
  12629. 10301: Validation<GLTFTargetNodeRaw>
  12630. 10401: Validation<GLTFAttributesNodeRaw>
  12631. 10402: Validation<GLTFAttributesNodeRaw>
  12632. 10403: Validation<GLTFAttributesNodeRaw>
  12633. 10501: Validation<GLTFPrimitiveNodeRaw>
  12634. 10502: Validation<GLTFPrimitiveNodeRaw>
  12635. 10503: Validation<GLTFPrimitiveNodeRaw>
  12636. 10601: Validation<GLTFAccessorNodeRaw>
  12637. 10602: Validation<GLTFAccessorNodeRaw>
  12638. }
  12639. }
  12640. declare module 'XrFrame/loader/glTF/scenes/GLTFNodeNode' {
  12641. import { GLTFMeshesLoaded } from 'XrFrame/loader/glTF/geometry/GLTFMeshesNode'
  12642. import { GLTFMeshLoaded } from 'XrFrame/loader/glTF/geometry/GLTFMeshNode'
  12643. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  12644. import { GLTFSkinLoaded } from 'XrFrame/loader/glTF/skins/GLTFSkinNode'
  12645. import { GLTFSkinsLoaded } from 'XrFrame/loader/glTF/skins/GLTFSkinsNode'
  12646. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  12647. export interface GLTFNodeNodeRaw {
  12648. children?: number[]
  12649. mesh?: number
  12650. matrix?: number[]
  12651. rotation?: [number, number, number, number]
  12652. scale?: [number, number, number]
  12653. translation?: [number, number, number]
  12654. weights?: number
  12655. skin?: number
  12656. name?: string
  12657. extensions?: object
  12658. extras?: any
  12659. }
  12660. export interface GLTFNodeLoaded {
  12661. children: number[]
  12662. transform: GLTF.Transform
  12663. mesh?: GLTFMeshLoaded
  12664. skin?: GLTFSkinLoaded
  12665. name: string
  12666. extras?: any
  12667. }
  12668. export type GLTFNodePrerequisites = [
  12669. meshes: GLTFMeshesLoaded,
  12670. skins: GLTFSkinsLoaded
  12671. ]
  12672. export default class GLTFNodeNode extends GLTFBaseNode {
  12673. get nodeName(): string
  12674. readonly raw: GLTFNodeNodeRaw
  12675. build(): void
  12676. preload(prerequisites: GLTFNodePrerequisites): Promise<GLTFNodeLoaded>
  12677. getLoadedResource(): GLTFNodeLoaded
  12678. }
  12679. }
  12680. declare module 'XrFrame/kanata/lib/frontend/component/MeshRendererComponent' {
  12681. /**
  12682. * MeshRendererComponent.ts
  12683. *
  12684. * * @Date : 9/3/2020, 7:54:23 PM
  12685. */
  12686. import { EMeshRenderType } from 'XrFrame/kanata/lib/backend'
  12687. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  12688. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  12689. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D'
  12690. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock'
  12691. import VertexBuffer from 'XrFrame/kanata/lib/frontend/resource/VertexBuffer'
  12692. import IndexBuffer from 'XrFrame/kanata/lib/frontend/resource/IndexBuffer'
  12693. import VertexData from 'XrFrame/kanata/lib/frontend/resource/VertexData'
  12694. import IndexData from 'XrFrame/kanata/lib/frontend/resource/IndexData'
  12695. import Material from 'XrFrame/kanata/lib/frontend/resource/Material'
  12696. import SkinnedSkeletonComponent from 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent'
  12697. import CullingComponent from 'XrFrame/kanata/lib/frontend/component/CullingComponent'
  12698. export default class MeshRendererComponent extends NativeObject {
  12699. static OFFSETS: {
  12700. dynamicBatch: number
  12701. skinHandle: number
  12702. castShadow: number
  12703. bindTarget: number
  12704. start: number
  12705. size: number
  12706. materialId: number
  12707. vertexBufferId: number
  12708. indexBufferId: number
  12709. startIndex: number
  12710. numIndices: number
  12711. }
  12712. static CREATE_FAKE(
  12713. entity: Entity3D | Entity2D,
  12714. options: {
  12715. meshCount: number
  12716. uniformBlock?: UniformBlock
  12717. }
  12718. ): FakeMeshRenderComponent
  12719. protected _uniforms: UniformBlock
  12720. get uniforms(): UniformBlock
  12721. get meshCount(): number
  12722. get castShadow(): boolean
  12723. set castShadow(value: boolean)
  12724. get dynamicBatch(): boolean
  12725. set dynamicBatch(value: boolean)
  12726. set skinSkeleton(sk: SkinnedSkeletonComponent)
  12727. set bindTarget(target: Entity3D | Entity2D | null)
  12728. get macros(): {
  12729. [name: string]: string | number | boolean
  12730. }
  12731. constructor(
  12732. entity: Entity3D | Entity2D,
  12733. options: {
  12734. meshCount: number
  12735. uniformBlock: UniformBlock
  12736. renderType: EMeshRenderType
  12737. culling?: CullingComponent
  12738. macros?: {
  12739. [name: string]: string | number | boolean
  12740. }
  12741. }
  12742. )
  12743. protected _createNativeObj(
  12744. entity: Entity3D | Entity2D,
  12745. options: {
  12746. meshCount: number
  12747. uniformBlock: UniformBlock
  12748. renderType: EMeshRenderType
  12749. culling?: CullingComponent
  12750. macros?: {
  12751. [name: string]: string | number | boolean
  12752. }
  12753. }
  12754. ): import('XrFrame/kanata/lib/backend').IHandle & {
  12755. setSharedDirty(): void
  12756. }
  12757. changeMacros(macros?: {
  12758. [name: string]: string | number | boolean
  12759. }): void
  12760. getStartIndex(index: number): number
  12761. setStartIndex(index: number, value: number): void
  12762. getNumIndices(index: number): number
  12763. setNumIndices(index: number, value: number): void
  12764. getVertexBuffer(index: number): VertexBuffer
  12765. setVertexBuffer(index: number, buffer: VertexBuffer): void
  12766. getIndexBuffer(index: number): IndexBuffer
  12767. setIndexBuffer(index: number, buffer: IndexBuffer): void
  12768. getVertexData(index: number): VertexData
  12769. setVertexData(index: number, buffer: VertexData): void
  12770. getIndexData(index: number): IndexData
  12771. setIndexData(index: number, buffer: IndexData): void
  12772. getMaterial(index: number): Material
  12773. setMaterial(index: number, material: Material | null): void
  12774. fastSet(
  12775. vertexes: Array<VertexBuffer | VertexData>,
  12776. indexes: Array<VertexData | IndexBuffer>,
  12777. materials: Material[],
  12778. startIndexes: number[],
  12779. numIndices: number[]
  12780. ): void
  12781. setDirty(): void
  12782. copyStates(comp: MeshRendererComponent): void
  12783. }
  12784. class FakeMeshRenderComponent extends MeshRendererComponent {
  12785. protected _createNativeObj(
  12786. entity: Entity3D | Entity2D,
  12787. options: {
  12788. meshCount: number
  12789. uniformBlock: UniformBlock
  12790. renderType: EMeshRenderType
  12791. culling: CullingComponent
  12792. }
  12793. ): {
  12794. id: number
  12795. data: ArrayBuffer
  12796. setSharedDirty: () => void
  12797. }
  12798. get uniforms(): UniformBlock
  12799. set uniforms(uniforms: UniformBlock)
  12800. }
  12801. export {}
  12802. }
  12803. declare module 'XrFrame/kanata/lib/frontend/resource/renderEnv' {
  12804. /**
  12805. * renderEnv.ts
  12806. *
  12807. * * @Date : 1/18/2021, 3:53:26 PM
  12808. */
  12809. import {
  12810. EMeshRenderType,
  12811. EUniformType,
  12812. IFeatures,
  12813. IRenderEnv,
  12814. TCompressTexture
  12815. } from 'XrFrame/kanata/lib/backend'
  12816. import View from 'XrFrame/kanata/lib/frontend/resource/View'
  12817. import Effect from 'XrFrame/kanata/lib/frontend/resource/Effect'
  12818. import RenderPass from 'XrFrame/kanata/lib/frontend/resource/RenderPass'
  12819. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock'
  12820. export class RenderEnv {
  12821. id: number
  12822. __handle: IRenderEnv
  12823. useExtendedMemory: boolean
  12824. get version(): number[]
  12825. get backendType(): string
  12826. get canvasWidth(): number
  12827. set canvasWidth(value: number)
  12828. get canvasHeight(): number
  12829. set canvasHeight(value: number)
  12830. get supportCompressTextures(): TCompressTexture[]
  12831. get features(): IFeatures
  12832. get commitVersion(): string
  12833. get usePuppetSokol(): boolean
  12834. get useInstance(): boolean
  12835. set useInstance(value: boolean)
  12836. get neverTranspose(): boolean
  12837. set neverTranspose(value: boolean)
  12838. get isWrongWrapMapping(): boolean
  12839. get isNotWrongEffectSort(): boolean
  12840. get isGoodInstance(): boolean
  12841. get isGoodPhysAndScalableList(): boolean
  12842. constructor()
  12843. supportCompressTexture(type: TCompressTexture): boolean
  12844. registerFallbackEffect(lightMode: string, effect?: Effect): void
  12845. beginFrame(): void
  12846. endFrame(): void
  12847. clearView(view: View): void
  12848. setEnvUniform(index: number, uniforms: UniformBlock): void
  12849. setRenderPass(renderPass: RenderPass): void
  12850. changeMacros(macros: {
  12851. [name: string]: string | number | boolean
  12852. }): void
  12853. getMacro(key: string): string | number | boolean
  12854. changeVirtualMacros(macros: { [name: string]: boolean }): void
  12855. getVirtualMacro(key: string): boolean
  12856. setInternalInstanceInfo(
  12857. type: EMeshRenderType,
  12858. info: Array<{
  12859. uniformKey: string
  12860. attributeName: string
  12861. type: EUniformType
  12862. }>,
  12863. ignored: string[]
  12864. ): void
  12865. getErrors(): string[]
  12866. }
  12867. const renderEnv: RenderEnv
  12868. export default renderEnv
  12869. }
  12870. declare module 'XrFrame/kanata/lib/frontend/component/AnimatorComponent' {
  12871. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  12872. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  12873. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel'
  12874. export default class AnimatorComponent extends NativeObject {
  12875. static UPDATE_ANIMATORS(
  12876. animators: AnimatorComponent[],
  12877. size: number
  12878. ): void
  12879. animationClipModels: AnimationClipModel[]
  12880. constructor()
  12881. bindAnimations(
  12882. animationClipModels: AnimationClipModel[],
  12883. entities: Array<Array<Entity3D | null>>,
  12884. rootEntity?: Entity3D
  12885. ): void
  12886. setClipParams(
  12887. index: number,
  12888. frameIndex: number,
  12889. blendWeight: number
  12890. ): void
  12891. getAnimationClipCount(): number
  12892. getNodeCount(): number
  12893. getAnimationParameter(index: number): {
  12894. animationClipId: number
  12895. frameIndex: number
  12896. percentage: number
  12897. }
  12898. getEntity(index: number): number
  12899. }
  12900. }
  12901. declare module 'XrFrame/kanata/lib/frontend/component/CameraComponent' {
  12902. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  12903. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  12904. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D'
  12905. import View from 'XrFrame/kanata/lib/frontend/resource/View'
  12906. import ScalableList from 'XrFrame/kanata/lib/frontend/resource/ScalableList'
  12907. export default class CameraComponent extends NativeObject {
  12908. static OFFSETS: {
  12909. size: number
  12910. view: number
  12911. depth: number
  12912. active: number
  12913. fov: number
  12914. aspect: number
  12915. near: number
  12916. far: number
  12917. up: number
  12918. eye: number
  12919. orthoSize: number
  12920. isProjection: number
  12921. cullingMask: number
  12922. canvasSizeY: number
  12923. targetTransform: number
  12924. viewMatrix: number
  12925. projectionMatrix: number
  12926. viewMatrixInverse: number
  12927. viewMatrix2D: number
  12928. projectionMatrix2D: number
  12929. viewMatrixInverse2D: number
  12930. manualMatrix: number
  12931. layerCullDistances: number
  12932. }
  12933. get active(): boolean
  12934. set active(value: boolean)
  12935. get depth(): number
  12936. set depth(value: number)
  12937. get isProjection(): boolean
  12938. set isProjection(value: boolean)
  12939. get view(): View
  12940. set view(value: View)
  12941. get fov(): number
  12942. set fov(value: number)
  12943. get aspect(): number
  12944. set aspect(value: number)
  12945. get near(): number
  12946. set near(value: number)
  12947. get far(): number
  12948. set far(value: number)
  12949. get orthoSize(): number
  12950. set orthoSize(value: number)
  12951. get cullingMask(): number
  12952. set cullingMask(value: number)
  12953. get layerCullDistances(): Float32Array | number[]
  12954. set layerCullDistances(value: Float32Array | number[])
  12955. get canvasSizeY(): number
  12956. set canvasSizeY(value: number)
  12957. set targetTransform(entityId: number)
  12958. get targetTransform(): number
  12959. set up(vec3: Float32Array)
  12960. constructor(entity: Entity2D | Entity3D, isUI?: boolean)
  12961. cull(cullResult: ScalableList, lightMode: string): void
  12962. draw(renderList: ScalableList, lightMode: string): void
  12963. changeProjectionMatrix(manual: boolean, mat4?: Float32Array): void
  12964. changeViewMatrix(manual: boolean, mat4?: Float32Array): void
  12965. updateMatrix(): void
  12966. }
  12967. }
  12968. declare module 'XrFrame/kanata/lib/frontend/component/LightCameraComponent' {
  12969. /**
  12970. * CameraLightComponent.ts
  12971. *
  12972. * * @Date : 9/3/2020, 7:54:13 PM
  12973. */
  12974. import { EShadowMode } from 'XrFrame/kanata/lib/backend'
  12975. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  12976. import View from 'XrFrame/kanata/lib/frontend/resource/View'
  12977. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock'
  12978. import ScalableList from 'XrFrame/kanata/lib/frontend/resource/ScalableList'
  12979. import CameraComponent from 'XrFrame/kanata/lib/frontend/component/CameraComponent'
  12980. export default class LightCameraComponent extends NativeObject {
  12981. static OFFSETS: {
  12982. size: number
  12983. view: number
  12984. depth: number
  12985. active: number
  12986. shadowDistance: number
  12987. shadowMode: number
  12988. shadowFilterMode: number
  12989. lightDir: number
  12990. bounds: number
  12991. lightSpaceMatrices: number
  12992. }
  12993. get view(): View
  12994. set view(value: View)
  12995. get active(): boolean
  12996. set active(value: boolean)
  12997. get depth(): number
  12998. set depth(value: number)
  12999. get shadowDistance(): number
  13000. set shadowDistance(value: number)
  13001. get shadowFilterMode(): number
  13002. set shadowFilterMode(value: number)
  13003. get shadowMode(): EShadowMode
  13004. set shadowMode(value: EShadowMode)
  13005. get lightSpaceMatrices(): Float32Array
  13006. constructor()
  13007. draw(
  13008. camera: CameraComponent,
  13009. renderList: ScalableList,
  13010. lightMode: string
  13011. ): void
  13012. prepareUniforms(uniforms: UniformBlock): void
  13013. setLightDir(x: number, y: number, z: number): void
  13014. setCascadedSplits(s0: number, s1: number, s2: number): void
  13015. protected _updateBounds(auto: boolean): void
  13016. protected _adjustSplitPercents(index: number, percent: number): number
  13017. protected _setSplitPercents(index: number, percent: number): number
  13018. }
  13019. }
  13020. declare module 'XrFrame/kanata/lib/frontend/component/CullingComponent' {
  13021. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  13022. import Entity2D from 'XrFrame/kanata/lib/frontend/entity/Entity2D'
  13023. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject'
  13024. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager'
  13025. export default class CullingComponent extends PoolObject {
  13026. static POLL_MANAGER: PoolManager
  13027. constructor(entity: Entity2D | Entity3D)
  13028. getActive(): boolean
  13029. setActive(val: boolean): void
  13030. getLayer(): number
  13031. setLayer(val: number): void
  13032. getBoundingBallCenter(): Float32Array
  13033. setBoundingBallCenter(val: Float32Array, offset?: number): void
  13034. getBoundingBallRadius(): number
  13035. setBoundingBallRadius(val: number): void
  13036. bindEntity(entity: Entity2D | Entity3D): void
  13037. destroy(): void
  13038. }
  13039. }
  13040. declare module 'XrFrame/kanata/lib/frontend/component/SkinnedSkeletonComponent' {
  13041. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  13042. import SkeletonBoneInverseModel from 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel'
  13043. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  13044. export default class SkinnedSkeletonComponent extends NativeObject {
  13045. static UPDATE_MATS(
  13046. comps: SkinnedSkeletonComponent[],
  13047. size: number
  13048. ): void
  13049. get boneNum(): number
  13050. get boneInverseModel(): SkeletonBoneInverseModel
  13051. get boneOffsetMatrices(): Float32Array
  13052. constructor(boneNum: number, flag: number)
  13053. setBoneMatrix(
  13054. boneInverseModel: SkeletonBoneInverseModel,
  13055. boneIndices: number[],
  13056. boneEntities: Entity3D[]
  13057. ): void
  13058. getBoneNum(): number
  13059. getBoneOffsetMatrices(): Float32Array
  13060. }
  13061. }
  13062. declare module 'XrFrame/kanata/lib/frontend/component/DynamicBonesComponent' {
  13063. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  13064. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  13065. export default class DynamicBonesComponent extends NativeObject {
  13066. static OFFSETS: {
  13067. stiffness: number
  13068. elasticity: number
  13069. damping: number
  13070. }
  13071. get stiffness(): number
  13072. set stiffness(v: number)
  13073. get damping(): number
  13074. set damping(v: number)
  13075. get elasticity(): number
  13076. set elasticity(v: number)
  13077. constructor(rootNode?: Entity3D)
  13078. preUpdate(): void
  13079. update(
  13080. dt: number,
  13081. rootMotion?: {
  13082. x: number
  13083. y: number
  13084. z: number
  13085. }
  13086. ): void
  13087. rebuild(): void
  13088. resetRoot(root?: Entity3D): void
  13089. }
  13090. }
  13091. declare module 'XrFrame/kanata/lib/frontend/entity/Entity2D' {
  13092. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject'
  13093. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager'
  13094. export default class Entity2D extends PoolObject {
  13095. static POLL_MANAGER: PoolManager
  13096. static OFFSETS: {
  13097. size: number
  13098. rotation: number
  13099. position: number
  13100. scale: number
  13101. worldMatrix: number
  13102. }
  13103. localPositionOffset: number
  13104. localRotationOffset: number
  13105. localScaleOffset: number
  13106. worldMatrixOffset: number
  13107. constructor()
  13108. addChild(child: Entity2D): void
  13109. addChildAtIndex(child: Entity2D, index: number): void
  13110. removeFromParent(): void
  13111. setAsRoot(): void
  13112. destroy(): void
  13113. clear(): void
  13114. setLocalMatrixDirty(): void
  13115. set active(val: boolean)
  13116. }
  13117. }
  13118. declare module 'XrFrame/kanata/lib/frontend/entity/Entity3D' {
  13119. import PoolObject from 'XrFrame/kanata/lib/frontend/pool/PoolObject'
  13120. import PoolManager from 'XrFrame/kanata/lib/frontend/pool/PoolManager'
  13121. export default class Entity3D extends PoolObject {
  13122. static POLL_MANAGER: PoolManager
  13123. static OFFSETS: {
  13124. size: number
  13125. dfRotationType: number
  13126. rotationType: number
  13127. rotation: number
  13128. position: number
  13129. scale: number
  13130. worldOffset: number
  13131. worldMatrix: number
  13132. }
  13133. static CREATE_TREE(
  13134. length: number,
  13135. buffer: ArrayBuffer,
  13136. out: any[],
  13137. calculateWordMatrix?: boolean
  13138. ): boolean
  13139. localRotationTypeOffset: number
  13140. localQuaternionOffset: number
  13141. localPositionOffset: number
  13142. localScaleOffset: number
  13143. worldMatrixOffset: number
  13144. extOffset: number
  13145. layerOffset: number
  13146. mixedLayerMaskOffset: number
  13147. constructor()
  13148. setUsingEuler(on: boolean): void
  13149. isUsingEuler(): boolean
  13150. setLayer(layer: number): void
  13151. getLayer(): number
  13152. getMixedLayerMask(): number
  13153. addChild(child: Entity3D): void
  13154. addChildAtIndex(child: Entity3D, index: number): void
  13155. removeFromParent(): void
  13156. setAsRoot(): void
  13157. destroy(): void
  13158. /**
  13159. * 如果只调用entityClear指令,那么Kanata就无法回收根节点下面的子节点了。
  13160. * 目前Kanata的frontend没有父子关系信息只能这么做了。
  13161. * 这个方法目前只能减少eventBridge的指令量,避免在大规模节点销毁的时候频繁触发eventBridge的溢出提交。
  13162. * @param entities
  13163. * @param length
  13164. */
  13165. clear(entities: Entity3D[], length: number): void
  13166. setLocalMatrixDirty(): void
  13167. set active(val: boolean)
  13168. }
  13169. }
  13170. declare module 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel' {
  13171. import DataModel from 'XrFrame/kanata/lib/frontend/resource/DataModel'
  13172. export default class AnimationClipModel extends DataModel {
  13173. setAnimationClip(ab: ArrayBuffer): void
  13174. }
  13175. }
  13176. declare module 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding' {
  13177. /**
  13178. * AnimationClipBinding.ts
  13179. *
  13180. * */
  13181. import Entity3D from 'XrFrame/kanata/lib/frontend/entity/Entity3D'
  13182. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel'
  13183. import { EUseDefaultAddedAction } from 'XrFrame/kanata/lib/backend'
  13184. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13185. import { INativeWorker } from 'XrFrame/kanata/lib/backend/native/worker'
  13186. export default class AnimationClipBinding extends PureResource {
  13187. __handle: INativeWorker.IAnimationClipBinding
  13188. constructor(
  13189. clipArray: AnimationClipModel[],
  13190. clipArrayOffset: number,
  13191. clipArrayLength: number,
  13192. entityArray: Array<number | Entity3D | null>,
  13193. entityArrayOffset: number,
  13194. entityArrayLength: number,
  13195. useDefaultAddedNodesAction: EUseDefaultAddedAction,
  13196. rootEntity: Entity3D
  13197. )
  13198. rebind(
  13199. clipArray: AnimationClipModel[],
  13200. clipArrayOffset: number,
  13201. clipArrayLength: number,
  13202. entityArray: Array<number | Entity3D | null>,
  13203. entityArrayOffset: number,
  13204. entityArrayLength: number,
  13205. removeAction: number,
  13206. retainedAction: number,
  13207. addedAction: number,
  13208. rootEntity: Entity3D
  13209. ): boolean
  13210. update(
  13211. clipArray: AnimationClipModel[],
  13212. clipArrayOffset: number,
  13213. clipArrayLength: number,
  13214. entityArray: Array<number | Entity3D | null>,
  13215. entityArrayOffset: number,
  13216. entityArrayLength: number,
  13217. removeAction: number,
  13218. retainedAction: number,
  13219. addedAction: number
  13220. ): boolean
  13221. writeDefaultValues(): void
  13222. }
  13223. }
  13224. declare module 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerModel' {
  13225. /**
  13226. * AnimatorControllerModel.ts
  13227. *
  13228. * */
  13229. import AnimatorControllerStateModel from 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel'
  13230. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13231. import AnimationClipBinding from 'XrFrame/kanata/lib/frontend/resource/AnimationClipBinding'
  13232. export default class AnimatorControllerModel extends PureResource {
  13233. layerCount: number
  13234. static UPDATE_ANIMATOR_CONTROLLERS(
  13235. animatorControllers: AnimatorControllerModel[],
  13236. size: number
  13237. ): void
  13238. constructor(layerCount: number)
  13239. setAnimationClipBinding(binding: null | AnimationClipBinding): void
  13240. setLayerBlendType(layerIndex: number, blendType: number): void
  13241. setLayerWeight(layerIndex: number, weight: number): void
  13242. setLayerBlend(
  13243. layerIndex: number,
  13244. blend: null | AnimatorControllerStateModel
  13245. ): void
  13246. setLayerMask(
  13247. layerIndex: number,
  13248. mask: {
  13249. buffer: null | ArrayBuffer
  13250. offset: number
  13251. length: number
  13252. }
  13253. ): void
  13254. update(): void
  13255. destroy(): void
  13256. }
  13257. }
  13258. declare module 'XrFrame/kanata/lib/frontend/resource/AnimatorControllerStateModel' {
  13259. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13260. import AnimationClipModel from 'XrFrame/kanata/lib/frontend/resource/AnimationClipModel'
  13261. export default class AnimatorControllerStateModel extends PureResource {
  13262. readonly count: number
  13263. get weight(): number
  13264. set weight(weight: number)
  13265. get useDefault(): number
  13266. set useDefault(useDefault: number)
  13267. constructor(count: number)
  13268. resetBlendInfo(): void
  13269. setNextState(state: AnimatorControllerStateModel | null): void
  13270. setBlendInfo(
  13271. clip: AnimationClipModel,
  13272. frameIndex: number,
  13273. blendWeight: number,
  13274. additiveReferenceClip: null | AnimationClipModel,
  13275. additiveFrameIndex: number
  13276. ): boolean
  13277. }
  13278. }
  13279. declare module 'XrFrame/kanata/lib/frontend/resource/DataBuffer' {
  13280. /**
  13281. * DataBuffer.ts
  13282. *
  13283. * * @Date : 9/4/2020, 1:21:59 PM
  13284. */
  13285. import { IHandle } from 'XrFrame/kanata/lib/backend'
  13286. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  13287. export default class DataBuffer extends NativeObject {
  13288. constructor(nativeObj: IHandle)
  13289. get dataLength(): number
  13290. get byteOffset(): number
  13291. get arrayBuffer(): ArrayBuffer
  13292. }
  13293. }
  13294. declare module 'XrFrame/kanata/lib/frontend/resource/DataModel' {
  13295. /**
  13296. * DataModel.ts
  13297. *
  13298. * * @Date : 9/4/2020, 1:18:13 PM
  13299. */
  13300. import { EDataModelType } from 'XrFrame/kanata/lib/backend'
  13301. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13302. export default class DataModel extends PureResource {
  13303. protected _createNativeModel(
  13304. type: EDataModelType,
  13305. buffer: ArrayBuffer
  13306. ): void
  13307. }
  13308. }
  13309. declare module 'XrFrame/kanata/lib/frontend/resource/Effect' {
  13310. /**
  13311. * Effect.ts
  13312. *
  13313. * * @Date : 9/9/2020, 5:49:54 PM
  13314. */
  13315. import {
  13316. EBlendFactor,
  13317. EBlendEquation,
  13318. ECullMode,
  13319. ECompareFunc,
  13320. EPrimitiveType,
  13321. EStencilOp
  13322. } from 'XrFrame/kanata/lib/backend'
  13323. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  13324. export default class Effect extends NativeObject {
  13325. static OFFSETS: {
  13326. size: number
  13327. useMaterialStates: number
  13328. fstencil: number
  13329. bstencil: number
  13330. blendRGBA: number
  13331. colorDepth: number
  13332. state: number
  13333. }
  13334. get passCount(): number
  13335. constructor(
  13336. name: string,
  13337. passCount: number,
  13338. keyIndexMap: string[],
  13339. passes: Array<{
  13340. lightMode: string
  13341. variants?: {
  13342. [key: number]: number
  13343. }
  13344. macros?: {
  13345. [key: string]: number
  13346. }
  13347. shaders?: number[]
  13348. }>,
  13349. shaders: string[],
  13350. variants: number[][],
  13351. useRuntimeMacros?: boolean
  13352. )
  13353. warmUp(): any
  13354. getBlendOn(pass: number): boolean
  13355. setBlendOn(pass: number, value: boolean): void
  13356. getBlendSrc(pass: number): EBlendFactor
  13357. setBlendSrc(pass: number, value: EBlendFactor): void
  13358. getBlendDst(pass: number): EBlendFactor
  13359. setBlendDst(pass: number, value: EBlendFactor): void
  13360. getBlendSrcRGB(pass: number): EBlendFactor
  13361. setBlendSrcRGB(pass: number, value: EBlendFactor): void
  13362. getBlendSrcAlpha(pass: number): EBlendFactor
  13363. setBlendSrcAlpha(pass: number, value: EBlendFactor): void
  13364. getBlendDstRGB(pass: number): EBlendFactor
  13365. setBlendDstRGB(pass: number, value: EBlendFactor): void
  13366. getBlendDstAlpha(pass: number): EBlendFactor
  13367. setBlendDstAlpha(pass: number, value: EBlendFactor): void
  13368. getBlendFunc(pass: number): EBlendEquation
  13369. setBlendFunc(pass: number, value: EBlendEquation): void
  13370. getDepthTestOn(pass: number): boolean
  13371. setDepthTestOn(pass: number, value: boolean): void
  13372. getDepthTestComp(pass: number): ECompareFunc
  13373. setDepthTestComp(pass: number, value: ECompareFunc): void
  13374. getDepthWrite(pass: number): boolean
  13375. setDepthWrite(pass: number, value: boolean): void
  13376. getColorWrite(pass: number): number
  13377. setColorWrite(pass: number, value: number): void
  13378. getCullFace(pass: number): ECullMode
  13379. setCullFace(pass: number, value: ECullMode): void
  13380. getCullOn(pass: number): boolean
  13381. setCullOn(pass: number, value: boolean): void
  13382. getPrimitiveType(pass: number): EPrimitiveType
  13383. setPrimitiveType(pass: number, value: EPrimitiveType): void
  13384. getStencilTestOn(pass: number): boolean
  13385. setStencilTestOn(pass: number, value: boolean): void
  13386. getStencilComp(pass: number): ECompareFunc
  13387. setStencilComp(pass: number, value: ECompareFunc): void
  13388. getStencilPass(pass: number): EStencilOp
  13389. setStencilPass(pass: number, value: EStencilOp): void
  13390. getStencilFail(pass: number): EStencilOp
  13391. setStencilFail(pass: number, value: EStencilOp): void
  13392. getStencilZFail(pass: number): EStencilOp
  13393. setStencilZFail(pass: number, value: EStencilOp): void
  13394. getStencilWriteMask(pass: number): number
  13395. setStencilWriteMask(pass: number, value: number): void
  13396. getStencilReadMask(pass: number): number
  13397. setStencilReadMask(pass: number, value: number): void
  13398. getStencilRef(pass: number): number
  13399. setStencilRef(pass: number, value: number): void
  13400. getUseMaterialStates(pass: number): boolean
  13401. setUseMaterialStates(pass: number, value: boolean): void
  13402. getUseMaterialStateBlendOn(pass: number): boolean
  13403. setUseMaterialStateBlendOn(pass: number, value: boolean): void
  13404. getUseMaterialStateBlendSrcRGB(pass: number): boolean
  13405. setUseMaterialStateBlendSrcRGB(pass: number, value: boolean): void
  13406. getUseMaterialStateBlendSrcAlpha(pass: number): boolean
  13407. setUseMaterialStateBlendSrcAlpha(pass: number, value: boolean): void
  13408. getUseMaterialStateBlendDstRGB(pass: number): boolean
  13409. setUseMaterialStateBlendDstRGB(pass: number, value: boolean): void
  13410. getUseMaterialStateBlendDstAlpha(pass: number): boolean
  13411. setUseMaterialStateBlendDstAlpha(pass: number, value: boolean): void
  13412. getUseMaterialStateBlendFunc(pass: number): boolean
  13413. setUseMaterialStateBlendFunc(pass: number, value: boolean): void
  13414. getUseMaterialStateDepthTestOn(pass: number): boolean
  13415. setUseMaterialStateDepthTestOn(pass: number, value: boolean): void
  13416. getUseMaterialStateDepthTestComp(pass: number): boolean
  13417. setUseMaterialStateDepthTestComp(pass: number, value: boolean): void
  13418. getUseMaterialStateDepthWrite(pass: number): boolean
  13419. setUseMaterialStateDepthWrite(pass: number, value: boolean): void
  13420. getUseMaterialStateCullOn(pass: number): boolean
  13421. setUseMaterialStateCullOn(pass: number, value: boolean): void
  13422. getUseMaterialStateCullFace(pass: number): boolean
  13423. setUseMaterialStateCullFace(pass: number, value: boolean): void
  13424. getUseMaterialStatePrimitiveType(pass: number): boolean
  13425. setUseMaterialStatePrimitiveType(pass: number, value: boolean): void
  13426. getUseMaterialStateStencilTestOn(pass: number): boolean
  13427. setUseMaterialStateStencilTestOn(pass: number, value: boolean): void
  13428. getUseMaterialStateStencilTestComp(pass: number): boolean
  13429. setUseMaterialStateStencilTestComp(pass: number, value: boolean): void
  13430. getUseMaterialStateStencilTestPass(pass: number): boolean
  13431. setUseMaterialStateStencilTestPass(pass: number, value: boolean): void
  13432. getUseMaterialStateStencilTestFail(pass: number): boolean
  13433. setUseMaterialStateStencilTestFail(pass: number, value: boolean): void
  13434. getUseMaterialStateStencilTestZFail(pass: number): boolean
  13435. setUseMaterialStateStencilTestZFail(pass: number, value: boolean): void
  13436. getUseMaterialStateColorWrite(pass: number): boolean
  13437. setUseMaterialStateColorWrite(pass: number, value: boolean): void
  13438. showDebugInfo(): string
  13439. }
  13440. }
  13441. declare module 'XrFrame/kanata/lib/frontend/resource/Material' {
  13442. /**
  13443. * Material.ts
  13444. *
  13445. * * @Date : 9/4/2020, 6:41:13 PM
  13446. */
  13447. import {
  13448. EBlendFactor,
  13449. EBlendEquation,
  13450. ECompareFunc,
  13451. ECullMode,
  13452. EStencilOp,
  13453. EPrimitiveType
  13454. } from 'XrFrame/kanata/lib/backend'
  13455. import UniformBlock from 'XrFrame/kanata/lib/frontend/resource/UniformBlock'
  13456. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  13457. import Effect from 'XrFrame/kanata/lib/frontend/resource/Effect'
  13458. export default class Material extends NativeObject {
  13459. static OFFSETS: {
  13460. size: number
  13461. renderQueue: number
  13462. effect: number
  13463. uniformBlock: number
  13464. fstencilMask: number
  13465. bstencilMask: number
  13466. blendRGBAMask: number
  13467. colorDepthMask: number
  13468. stateMask: number
  13469. fstencil: number
  13470. bstencil: number
  13471. blendRGBA: number
  13472. colorDepth: number
  13473. state: number
  13474. useInstance: number
  13475. }
  13476. protected _uniforms: UniformBlock
  13477. protected _effect: Effect
  13478. protected _macros: {
  13479. [name: string]: string | number | boolean
  13480. }
  13481. get effect(): Effect
  13482. set effect(value: Effect)
  13483. get uniforms(): UniformBlock
  13484. set uniforms(value: UniformBlock)
  13485. get renderQueue(): number
  13486. set renderQueue(value: number)
  13487. get useInstance(): boolean
  13488. set useInstance(value: boolean)
  13489. get blendOn(): boolean
  13490. set blendOn(value: boolean)
  13491. get blendSrcRGB(): EBlendFactor
  13492. set blendSrcRGB(value: EBlendFactor)
  13493. get blendSrcRGBChanged(): boolean
  13494. get blendSrcAlpha(): EBlendFactor
  13495. set blendSrcAlpha(value: EBlendFactor)
  13496. set blendSrc(value: EBlendFactor)
  13497. get blendDstRGB(): EBlendFactor
  13498. set blendDstRGB(value: EBlendFactor)
  13499. get blendDstRGBChanged(): boolean
  13500. get blendDstAlpha(): EBlendFactor
  13501. set blendDstAlpha(value: EBlendFactor)
  13502. set blendDst(value: EBlendFactor)
  13503. get blendFunc(): EBlendEquation
  13504. set blendFunc(value: EBlendEquation)
  13505. get depthTestOn(): boolean
  13506. set depthTestOn(value: boolean)
  13507. get depthTestComp(): ECompareFunc
  13508. set depthTestComp(value: ECompareFunc)
  13509. get depthWrite(): boolean
  13510. set depthWrite(value: boolean)
  13511. get colorWrite(): number
  13512. set colorWrite(value: number)
  13513. get cullFace(): ECullMode
  13514. set cullFace(value: ECullMode)
  13515. get cullOn(): boolean
  13516. set cullOn(value: boolean)
  13517. get primitiveType(): EPrimitiveType
  13518. set primitiveType(value: EPrimitiveType)
  13519. get stencilTestOn(): boolean
  13520. set stencilTestOn(value: boolean)
  13521. get stencilComp(): ECompareFunc
  13522. set stencilComp(value: ECompareFunc)
  13523. get stencilPass(): EStencilOp
  13524. set stencilPass(value: EStencilOp)
  13525. get stencilFail(): EStencilOp
  13526. set stencilFail(value: EStencilOp)
  13527. get stencilZFail(): EStencilOp
  13528. set stencilZFail(value: EStencilOp)
  13529. get stencilWriteMask(): number
  13530. set stencilWriteMask(value: number)
  13531. get stencilReadMask(): number
  13532. set stencilReadMask(value: number)
  13533. get stencilRef(): number
  13534. set stencilRef(value: number)
  13535. get blendOnMask(): boolean
  13536. set blendOnMask(value: boolean)
  13537. get blendSrcRGBMask(): boolean
  13538. set blendSrcRGBMask(value: boolean)
  13539. get blendSrcAlphaMask(): boolean
  13540. set blendSrcAlphaMask(value: boolean)
  13541. set blendSrcMask(value: boolean)
  13542. get blendDstRGBMask(): boolean
  13543. set blendDstRGBMask(value: boolean)
  13544. get blendDstAlphaMask(): boolean
  13545. set blendDstAlphaMask(value: boolean)
  13546. set blendDstMask(value: boolean)
  13547. get blendFuncMask(): boolean
  13548. set blendFuncMask(value: boolean)
  13549. get depthTestOnMask(): boolean
  13550. set depthTestOnMask(value: boolean)
  13551. get depthTestCompMask(): boolean
  13552. set depthTestCompMask(value: boolean)
  13553. get depthWriteMask(): boolean
  13554. set depthWriteMask(value: boolean)
  13555. get colorWriteMask(): boolean
  13556. set colorWriteMask(value: boolean)
  13557. get cullFaceMask(): boolean
  13558. set cullFaceMask(value: boolean)
  13559. get cullOnMask(): boolean
  13560. set cullOnMask(value: boolean)
  13561. get primitiveTypeMask(): boolean
  13562. set primitiveTypeMask(value: boolean)
  13563. get stencilTestOnMask(): boolean
  13564. set stencilTestOnMask(value: boolean)
  13565. get stencilCompMask(): boolean
  13566. set stencilCompMask(value: boolean)
  13567. get stencilPassMask(): boolean
  13568. set stencilPassMask(value: boolean)
  13569. get stencilFailMask(): boolean
  13570. set stencilFailMask(value: boolean)
  13571. get stencilZFailMask(): boolean
  13572. set stencilZFailMask(value: boolean)
  13573. get stencilWriteMaskMask(): boolean
  13574. set stencilWriteMaskMask(value: boolean)
  13575. get stencilReadMaskMask(): boolean
  13576. set stencilReadMaskMask(value: boolean)
  13577. get stencilRefMask(): boolean
  13578. set stencilRefMask(value: boolean)
  13579. constructor(
  13580. macros?: {
  13581. [name: string]: string | number | boolean
  13582. },
  13583. effect?: Effect,
  13584. uniformBlock?: UniformBlock
  13585. )
  13586. protected _createNativeMat(
  13587. macros?: {
  13588. [name: string]: string | number | boolean
  13589. },
  13590. effect?: Effect,
  13591. uniformBlock?: UniformBlock
  13592. ): void
  13593. changeMacros(macros?: {
  13594. [name: string]: string | number | boolean
  13595. }): void
  13596. getMacro(key: string): string | number | boolean
  13597. clone(uniforms?: UniformBlock): Material
  13598. showDebugInfo(): string
  13599. }
  13600. }
  13601. declare module 'XrFrame/kanata/lib/frontend/resource/RenderPass' {
  13602. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13603. import Texture from 'XrFrame/kanata/lib/frontend/resource/Texture'
  13604. export interface IRenderPassOptions {
  13605. colors: Array<{
  13606. texture: Texture
  13607. slice?: number
  13608. level?: number
  13609. }>
  13610. depth: {
  13611. texture: Texture
  13612. slice?: number
  13613. level?: number
  13614. }
  13615. stencil?: {
  13616. texture: Texture
  13617. slice?: number
  13618. level?: number
  13619. }
  13620. }
  13621. export default class RenderPass extends PureResource {
  13622. static SCREEN_RENDER_PASS: RenderPass
  13623. constructor(options: IRenderPassOptions)
  13624. }
  13625. }
  13626. declare module 'XrFrame/kanata/lib/frontend/resource/SkeletonBoneInverseModel' {
  13627. import DataModel from 'XrFrame/kanata/lib/frontend/resource/DataModel'
  13628. export default class SkeletonBoneInverseModel extends DataModel {
  13629. boneNum: number
  13630. setBoneInverseMatrix(matrices: Float32Array): void
  13631. }
  13632. }
  13633. declare module 'XrFrame/kanata/lib/frontend/resource/Texture' {
  13634. /**
  13635. * Texture.ts
  13636. *
  13637. * * @Date : 9/4/2020, 2:35:42 PM
  13638. */
  13639. import {
  13640. ETextureFormat,
  13641. ETextureType,
  13642. EWrapMode,
  13643. EFilterMode,
  13644. TTextureSource
  13645. } from 'XrFrame/kanata/lib/backend'
  13646. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13647. /**
  13648. * 纹理资源{@link Texture}的创建参数。
  13649. */
  13650. export interface ITextureOptions {
  13651. /**
  13652. * 纹理宽,如果`source`是`IImage`可以不传。
  13653. */
  13654. width?: number
  13655. /**
  13656. * 纹理高,如果`source`是`IImage`可以不传。
  13657. */
  13658. height?: number
  13659. /**
  13660. * @internal
  13661. */
  13662. isWriteOnly?: boolean
  13663. /**
  13664. * @internal
  13665. */
  13666. isRenderTarget?: boolean
  13667. /**
  13668. * @internal
  13669. */
  13670. canvas?: HTMLCanvasElement
  13671. /**
  13672. * 纹理数据源,如果是2D纹理,一般只能有一个元素。如果是`Buffer`类型数据,比如压缩纹理,则需要和`offsets`配合使用,一般用于`mipmaps`的场合。
  13673. * 如果是立方体纹理,则有六个元素。
  13674. */
  13675. source?: TTextureSource[]
  13676. /**
  13677. * 当`source`为`Buffer`纹理并且拥有`mipmaps`之类的时,标记如何切割数据。
  13678. * 规则是: off1, size1, off2, size2......
  13679. */
  13680. offsets?: Uint32Array
  13681. /**
  13682. * 纹理类型。
  13683. */
  13684. type?: ETextureType
  13685. /**
  13686. * 纹理有多少切片,比如立方体纹理就为`6`。
  13687. */
  13688. slices?: number
  13689. /**
  13690. * 纹理有多少级`mipmap`。
  13691. */
  13692. mips?: number
  13693. /**
  13694. * 纹理的像素格式。
  13695. */
  13696. pixelFormat?: ETextureFormat
  13697. minFilter?: EFilterMode
  13698. magFilter?: EFilterMode
  13699. /**
  13700. * 是否要自动生成`mipmaps`,仅对非压缩纹理有效。
  13701. */
  13702. generateMipmaps?: boolean
  13703. wrapU?: EWrapMode
  13704. wrapV?: EWrapMode
  13705. wrapW?: EWrapMode
  13706. /**
  13707. * 各向异性等级。
  13708. */
  13709. anisoLevel?: number
  13710. /**
  13711. * @internal
  13712. */
  13713. sampleCount?: number
  13714. }
  13715. /**
  13716. * 纹理资源。
  13717. */
  13718. export default class Texture extends PureResource {
  13719. get type(): ETextureType
  13720. get width(): number
  13721. get height(): number
  13722. get slice(): number
  13723. get mips(): number
  13724. get pixelFormat(): ETextureFormat
  13725. get wrapU(): EWrapMode
  13726. set wrapU(value: EWrapMode)
  13727. get wrapV(): EWrapMode
  13728. set wrapV(value: EWrapMode)
  13729. get wrapW(): EWrapMode
  13730. set wrapW(value: EWrapMode)
  13731. get magFilter(): EFilterMode
  13732. set magFilter(value: EFilterMode)
  13733. get minFilter(): EFilterMode
  13734. set minFilter(value: EFilterMode)
  13735. get anisoLevel(): number
  13736. set anisoLevel(value: number)
  13737. get sampleCount(): number
  13738. set sampleCount(value: number)
  13739. get generateMipmaps(): boolean
  13740. set generateMipmaps(value: boolean)
  13741. get isRenderTarget(): boolean
  13742. set isRenderTarget(value: boolean)
  13743. constructor(options: ITextureOptions)
  13744. /**
  13745. * 在创建了纹理后,可以用此方法来更新。
  13746. */
  13747. update(options: {
  13748. /**
  13749. * `mipmap`等级。
  13750. */
  13751. level?: number
  13752. /**
  13753. * 切片。
  13754. */
  13755. slice?: number
  13756. /**
  13757. * x向偏移。
  13758. */
  13759. xoffset?: number
  13760. /**
  13761. * x向偏移。
  13762. */
  13763. yoffset?: number
  13764. /**
  13765. * @internal。
  13766. */
  13767. zoffset?: number
  13768. /**
  13769. * 宽,相对于x偏移。
  13770. */
  13771. width?: number
  13772. /**
  13773. * 高,相对于y偏移。
  13774. */
  13775. height?: number
  13776. /**
  13777. * 数据。
  13778. */
  13779. buffer: TTextureSource
  13780. }): void
  13781. showDebugInfo(): string
  13782. }
  13783. }
  13784. declare module 'XrFrame/kanata/lib/frontend/resource/UniformBlock' {
  13785. /**
  13786. * UniformBlock.ts
  13787. *
  13788. * * @Date : 9/4/2020, 2:34:36 PM
  13789. */
  13790. import { IHandle } from 'XrFrame/kanata/lib/backend'
  13791. import UniformDescriptor from 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor'
  13792. import Texture from 'XrFrame/kanata/lib/frontend/resource/Texture'
  13793. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13794. /**
  13795. * 存储Uniform的一个区块。
  13796. */
  13797. export default class UniformBlock extends PureResource {
  13798. /**
  13799. * @internal
  13800. */
  13801. static CREATE_FAKE(descriptor: UniformDescriptor): FakeUniformBlock
  13802. /**
  13803. * @internal
  13804. */
  13805. /**
  13806. * 描述符。
  13807. */
  13808. get descriptor(): UniformDescriptor
  13809. /**
  13810. * @internal
  13811. */
  13812. get textures(): {
  13813. [name: string]: Texture
  13814. }
  13815. /**
  13816. * @param descriptor 描述符。
  13817. */
  13818. constructor(descriptor: UniformDescriptor)
  13819. protected _createNativeObj(descriptor: UniformDescriptor): IHandle
  13820. /**
  13821. * 是否包含某个成员uniform。
  13822. */
  13823. hasKey(key: string): boolean
  13824. /**
  13825. * 设置某个成员uniform。
  13826. */
  13827. setUniform(
  13828. key: string,
  13829. value: ArrayLike<number> | Texture | number
  13830. ): boolean
  13831. /**
  13832. * 获取某个成员uniform。
  13833. * 如果是返回`number`,则是纹理的id。
  13834. */
  13835. getUniform(key: string): Float32Array | number
  13836. /**
  13837. * 获取某个成员uniform的texture实例。
  13838. */
  13839. getTexture(key: string): Texture
  13840. /**
  13841. * @internal
  13842. */
  13843. /**
  13844. * @internal
  13845. */
  13846. setAllData(data: Float32Array): void
  13847. /**
  13848. * 科隆某个uniform。
  13849. */
  13850. clone(): UniformBlock
  13851. /**
  13852. * 复制某个uniform。
  13853. */
  13854. copy(ub: UniformBlock): void
  13855. showDebugInfo(): string
  13856. }
  13857. class FakeUniformBlock extends UniformBlock {
  13858. protected _createNativeObj(descriptor: UniformDescriptor): {
  13859. id: number
  13860. data: ArrayBuffer
  13861. }
  13862. }
  13863. export {}
  13864. }
  13865. declare module 'XrFrame/kanata/lib/frontend/resource/UniformDescriptor' {
  13866. /**
  13867. * UniformDescriptor.ts
  13868. *
  13869. * * @Date : 9/4/2020, 2:34:50 PM
  13870. */
  13871. import {
  13872. EUniformType,
  13873. IUniformDescriptorOptions
  13874. } from 'XrFrame/kanata/lib/backend'
  13875. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13876. /**
  13877. * UniformBlock描述符。
  13878. */
  13879. export default class UniformDescriptor extends PureResource {
  13880. /**
  13881. * @internal
  13882. */
  13883. get layout(): {
  13884. [key: string]: [
  13885. EUniformType,
  13886. number,
  13887. number,
  13888. number,
  13889. EUniformType,
  13890. boolean
  13891. ]
  13892. }
  13893. /**
  13894. * 以Float计的长度。
  13895. */
  13896. get size(): number
  13897. constructor(options: IUniformDescriptorOptions)
  13898. /**
  13899. * @internal
  13900. */
  13901. hasKey(key: string): boolean
  13902. /**
  13903. * @internal
  13904. */
  13905. setUniform(
  13906. key: string,
  13907. value: ArrayLike<number> | number,
  13908. f32: Float32Array,
  13909. u32: Uint32Array
  13910. ): void
  13911. /**
  13912. * @internal
  13913. */
  13914. getUniform(
  13915. key: string,
  13916. f32: Float32Array,
  13917. u32: Uint32Array
  13918. ): Float32Array | number
  13919. /**
  13920. * @internal
  13921. */
  13922. }
  13923. }
  13924. declare module 'XrFrame/kanata/lib/frontend/resource/IndexBuffer' {
  13925. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13926. export default class IndexBuffer extends PureResource {
  13927. get byteSize(): number
  13928. constructor(buffer: ArrayBuffer | ArrayBufferView, is32bits?: boolean)
  13929. update(buffer: ArrayBuffer | ArrayBufferView, offset: number): void
  13930. }
  13931. }
  13932. declare module 'XrFrame/kanata/lib/frontend/resource/IndexData' {
  13933. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13934. export default class IndexData extends PureResource {
  13935. get data(): ArrayBuffer
  13936. constructor(size: number)
  13937. }
  13938. }
  13939. declare module 'XrFrame/kanata/lib/frontend/resource/VertexBuffer' {
  13940. import VertexLayout from 'XrFrame/kanata/lib/frontend/resource/VertexLayout'
  13941. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13942. /**
  13943. * 顶点数据。
  13944. */
  13945. export default class VertexBuffer extends PureResource {
  13946. get byteSize(): number
  13947. get layout(): VertexLayout
  13948. constructor(buffer: ArrayBuffer | ArrayBufferView, layout: VertexLayout)
  13949. update(buffer: ArrayBuffer | ArrayBufferView, offset: number): void
  13950. }
  13951. }
  13952. declare module 'XrFrame/kanata/lib/frontend/resource/VertexData' {
  13953. /**
  13954. * VertexData.ts
  13955. *
  13956. * * @Date : 9/11/2020, 4:43:52 PM
  13957. */
  13958. import VertexDataDescriptor from 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor'
  13959. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13960. import VertexLayout from 'XrFrame/kanata/lib/frontend/resource/VertexLayout'
  13961. /**
  13962. * 用于合批的顶点数据。
  13963. */
  13964. export default class VertexData extends PureResource {
  13965. get layout(): VertexLayout
  13966. get data(): ArrayBuffer
  13967. constructor(
  13968. layout: VertexLayout,
  13969. size: number,
  13970. batchDesc: VertexDataDescriptor
  13971. )
  13972. }
  13973. }
  13974. declare module 'XrFrame/kanata/lib/frontend/resource/VertexLayout' {
  13975. /**
  13976. * VertexLayout.ts
  13977. *
  13978. * * @Date : 9/4/2020, 5:01:51 PM
  13979. */
  13980. import {
  13981. IVertexLayoutOptions,
  13982. EVertexLayoutUsage
  13983. } from 'XrFrame/kanata/lib/backend'
  13984. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  13985. /**
  13986. * 顶点布局描述。
  13987. */
  13988. export default class VertexLayout extends PureResource {
  13989. /**
  13990. * 顶点数据单位步长。
  13991. */
  13992. get stride(): number
  13993. constructor(options: IVertexLayoutOptions)
  13994. /**
  13995. * 获取某个属性的配置。
  13996. */
  13997. getConfigByName(name: string): {
  13998. name: string
  13999. format: import('XrFrame/kanata/lib/backend').EVertexFormat
  14000. offset: number
  14001. usage: EVertexLayoutUsage
  14002. }
  14003. /**
  14004. * 获取某个用途的属性的配置。
  14005. */
  14006. getConfigByUsage(usage: EVertexLayoutUsage): {
  14007. name: string
  14008. format: import('XrFrame/kanata/lib/backend').EVertexFormat
  14009. offset: number
  14010. usage: EVertexLayoutUsage
  14011. }
  14012. }
  14013. }
  14014. declare module 'XrFrame/kanata/lib/frontend/resource/VertexDataDescriptor' {
  14015. /**
  14016. * VertexDataDescriptor.ts
  14017. *
  14018. * * @Date : 4/28/2021, 4:38:37 PM
  14019. */
  14020. import { IVertexDataDescriptorOptions } from 'XrFrame/kanata/lib/backend'
  14021. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  14022. /**
  14023. * 用于合批的顶点数据的描述符。
  14024. */
  14025. export default class VertexDataDescriptor extends PureResource {
  14026. constructor(options: IVertexDataDescriptorOptions)
  14027. }
  14028. }
  14029. declare module 'XrFrame/kanata/lib/frontend/resource/View' {
  14030. /**
  14031. * View.ts
  14032. *
  14033. * * @Date : 9/4/2020, 6:43:18 PM
  14034. */
  14035. import { IRect, IViewAction } from 'XrFrame/kanata/lib/backend'
  14036. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  14037. /**
  14038. * 视图,用于控制清屏、视图区域等配置。
  14039. */
  14040. export default class View extends PureResource {
  14041. constructor(options: {
  14042. passAction: IViewAction
  14043. viewport: IRect
  14044. scissor: IRect
  14045. })
  14046. }
  14047. }
  14048. declare module 'XrFrame/kanata/lib/frontend/resource/ScalableList' {
  14049. import PureResource from 'XrFrame/kanata/lib/frontend/shared/PureResource'
  14050. export const SL_MAP: Set<ScalableList>
  14051. export function CHECK_SLS_RESIZE(): void
  14052. export function CLEAR_SLS(): void
  14053. /**
  14054. * 可扩容列表,用于存储Mesh的剔除结果以及绘制数据的id。
  14055. */
  14056. export default class ScalableList extends PureResource {
  14057. /**
  14058. * 当前全部可用的大小。
  14059. */
  14060. get size(): number
  14061. /**
  14062. * 存储的id集合。
  14063. */
  14064. get dataView(): Uint32Array
  14065. /**
  14066. * 当前已用的大小,一般不需要自己设置。
  14067. */
  14068. get usedSize(): number
  14069. set usedSize(value: number)
  14070. constructor(initSize: number)
  14071. /**
  14072. * 扩容,将会扩大两倍,一般不需要自己调用。
  14073. *
  14074. * @param deprecatedSize will always be current size, don't use it!
  14075. */
  14076. enlarge(deprecatedSize?: number): void
  14077. /**
  14078. * 初始化到准备`add`的阶段。
  14079. */
  14080. begin(): void
  14081. /**
  14082. * 添加一个数据。
  14083. *
  14084. * @param deprecatedEnlargeSize will always be current size, don't use it!
  14085. */
  14086. add(id: number, deprecatedEnlargeSize?: number): void
  14087. /**
  14088. * 结束此次所有`add`的流程。
  14089. */
  14090. end(): void
  14091. /**
  14092. * 清空整个列表。
  14093. */
  14094. reset(): void
  14095. }
  14096. }
  14097. declare module 'XrFrame/kanata/lib/frontend/shared/crossContext' {
  14098. /**
  14099. * 跨域信息通道,用于主域和子域之间的通信。
  14100. */
  14101. class CrossContext {
  14102. constructor()
  14103. postMessage(data: any): void
  14104. onMessage(callback: (data: any) => void): void
  14105. flush(): void
  14106. }
  14107. let crossContext: CrossContext
  14108. export default crossContext
  14109. }
  14110. declare module 'XrFrame/components/particle/gradient' {
  14111. import Vector3 from 'XrFrame/math/vector3'
  14112. import Vector4 from 'XrFrame/math/vector4'
  14113. export class ColorGradient {
  14114. gradient: number
  14115. color: Vector4
  14116. color2: Vector4
  14117. constructor(gradient: any, color: any, color2: any)
  14118. /**
  14119. * 获取具体颜色属性值
  14120. * @param {Vector4} 用于存储结果的临时变量
  14121. */
  14122. getColor(colorTemp: Vector4): void
  14123. }
  14124. export class Color3Gradient {
  14125. gradient: number
  14126. color: Vector3
  14127. constructor(gradient: any, color: any)
  14128. }
  14129. export class FactorGradient {
  14130. gradient: number
  14131. factor: number
  14132. factor2: number
  14133. constructor(gradient: any, factor: any, factor2: any)
  14134. /**
  14135. * 获取具体属性值
  14136. * @return {number} 插值后的属性大小
  14137. */
  14138. getFactor(): number
  14139. }
  14140. export class BasicGradientMethod {
  14141. /**
  14142. * 从获取具体时刻的属性大小
  14143. * @param {number} ratio 粒子所处生命周期的阶段
  14144. * @param {Array} gradients 存储不同时刻指定属性变化的数组
  14145. * @param {Callback} updateFunc 回调函数
  14146. */
  14147. static GetCurrentGradient(
  14148. ratio: any,
  14149. gradients: any,
  14150. updateFunc: any
  14151. ): void
  14152. }
  14153. }
  14154. declare module 'XrFrame/components/emitter/BoxShapeEmitter' {
  14155. import Vector3 from 'XrFrame/math/vector3'
  14156. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14157. export default class BoxShapeEmitter extends BasicShapeEmitter {
  14158. direction: Vector3
  14159. direction2: Vector3
  14160. minEmitBox: Vector3
  14161. maxEmitBox: Vector3
  14162. constructor()
  14163. startDirection(worldMatrix: any, direction: any): void
  14164. startPosition(worldMatrix: any, position: Vector3): void
  14165. }
  14166. }
  14167. declare module 'XrFrame/components/emitter/PointShapeEmitter' {
  14168. import Vector3 from 'XrFrame/math/vector3'
  14169. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14170. export default class PointShapeEmitter extends BasicShapeEmitter {
  14171. /**
  14172. * 粒子运动方向左区间。
  14173. */
  14174. direction: Vector3
  14175. /**
  14176. * 粒子运动方向右区间。
  14177. */
  14178. direction2: Vector3
  14179. constructor()
  14180. startDirection(worldMatrix: any, direction: any): void
  14181. startPosition(worldMatrix: any, position: Vector3): void
  14182. }
  14183. }
  14184. declare module 'XrFrame/components/emitter/DrawShapeEmitter' {
  14185. import Vector3 from 'XrFrame/math/vector3'
  14186. import ParticleInstance from 'XrFrame/components/particle/ParticleInstance'
  14187. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14188. export default class DrawShapeEmitter extends BasicShapeEmitter {
  14189. direction: Vector3
  14190. constructor()
  14191. setContent(content: any, step?: number): void
  14192. translateBase64ToArrayBuffer(base64: any): ArrayBufferLike
  14193. startDirection(worldMatrix: any, direction: any): void
  14194. startPosition(worldMatrix: any, position: Vector3): void
  14195. processInstance(instance: ParticleInstance, deltaTime: number): void
  14196. lerpNumberArrayToVector(
  14197. vector: any,
  14198. numberArray1: any,
  14199. numberArray2: any,
  14200. step: any,
  14201. length?: number
  14202. ): void
  14203. }
  14204. }
  14205. declare module 'XrFrame/components/emitter/SphereShapeEmitter' {
  14206. import Vector3 from 'XrFrame/math/vector3'
  14207. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14208. import Matrix4 from 'XrFrame/math/matrix4'
  14209. export default class SphereShapeEmitter extends BasicShapeEmitter {
  14210. /**
  14211. * 球形半径
  14212. */
  14213. radius: number
  14214. /**
  14215. * 球形区域覆盖范围[0-1]
  14216. */
  14217. radiusRange: number
  14218. /**
  14219. * 粒子在球形内生成的角度区间[0-360]
  14220. */
  14221. arc: number
  14222. /**
  14223. * 粒子运动方向偏离程度[0-1]
  14224. */
  14225. randomizeDirection: number
  14226. constructor()
  14227. startDirection(
  14228. worldMatrix: Matrix4,
  14229. direction: Vector3,
  14230. position: Vector3
  14231. ): void
  14232. startPosition(worldMatrix: Matrix4, position: Vector3): void
  14233. }
  14234. }
  14235. declare module 'XrFrame/components/emitter/ConeShapeEmitter' {
  14236. import Vector3 from 'XrFrame/math/vector3'
  14237. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14238. export default class ConeShapeEmitter extends BasicShapeEmitter {
  14239. /**
  14240. * [0-1]
  14241. */
  14242. radiusRange: number
  14243. heightRange: number
  14244. /**
  14245. * [0-360]
  14246. */
  14247. arc: number
  14248. /**
  14249. * randomize the particle direction [0-1]
  14250. */
  14251. randomizeDirection: number
  14252. get radius(): number
  14253. set radius(value: number)
  14254. get angle(): number
  14255. set angle(value: number)
  14256. updateHeight(): void
  14257. constructor()
  14258. startDirection(
  14259. worldMatrix: any,
  14260. direction: any,
  14261. position: Vector3
  14262. ): void
  14263. startPosition(worldMatrix: any, position: Vector3): void
  14264. }
  14265. }
  14266. declare module 'XrFrame/components/emitter/CircleShapeEmitter' {
  14267. import Vector3 from 'XrFrame/math/vector3'
  14268. import { BasicShapeEmitter } from 'XrFrame/components/emitter/BasicShapeEmitter'
  14269. import Matrix4 from 'XrFrame/math/matrix4'
  14270. export default class CircleShapeEmitter extends BasicShapeEmitter {
  14271. radius: number
  14272. radiusRange: number
  14273. direction: Vector3
  14274. direction2: Vector3
  14275. arc: number
  14276. angle: number
  14277. constructor()
  14278. startDirection(
  14279. worldMatrix: Matrix4,
  14280. direction: Vector3,
  14281. position: Vector3
  14282. ): void
  14283. startPosition(worldMatrix: any, position: Vector3): void
  14284. }
  14285. }
  14286. declare module 'XrFrame/render-graph/RGNode' {
  14287. /**
  14288. * RGNode.ts
  14289. *
  14290. * * @Date : 1/13/2021, 8:29:55 PM
  14291. */
  14292. import { Kanata } from 'XrFrame/ext'
  14293. import Camera from 'XrFrame/components/Camera'
  14294. import { IRenderTarget } from 'XrFrame/assets/RenderTexture'
  14295. type RenderGraph = import('XrFrame/render-graph/RenderGraph').default
  14296. type RenderSystem = import('XrFrame/systems/RenderSystem').default
  14297. type Scene = import('XrFrame/core/Scene').default
  14298. export type TRGNodeAny = RGNode<any, any, any>
  14299. /**
  14300. * RGNode支持传输的数据类型。
  14301. * 可扩展。
  14302. *
  14303. * @category Render
  14304. */
  14305. export interface IRGData {
  14306. /**
  14307. * 空数据类型。
  14308. */
  14309. None: void
  14310. /**
  14311. * 相机类型。
  14312. */
  14313. Camera: Camera
  14314. /**
  14315. * 渲染目标类型。
  14316. */
  14317. RenderTarget: IRenderTarget
  14318. /**
  14319. * Mesh列表,一般作为剔除节点的输出,作为渲染节点的输入。
  14320. */
  14321. MeshList: Kanata.ScalableList
  14322. }
  14323. /**
  14324. * RGNode支持的节点类型。
  14325. */
  14326. export enum ERGNodeType {
  14327. Camera = 'Camera',
  14328. Clear = 'Clear',
  14329. Cull = 'Cull',
  14330. Render = 'Render',
  14331. Script = 'Script'
  14332. }
  14333. /**
  14334. * 渲染节点基类。
  14335. */
  14336. export default abstract class RGNode<
  14337. TInputs extends {
  14338. [key: string]: keyof IRGData
  14339. },
  14340. TOutput extends keyof IRGData,
  14341. IOptions
  14342. > {
  14343. protected _parent: RenderGraph
  14344. protected _id: number
  14345. protected _name: string
  14346. protected _options: IOptions
  14347. /**
  14348. * 节点类型。
  14349. *
  14350. * @internal
  14351. */
  14352. type: ERGNodeType
  14353. /**
  14354. * 节点输入的数据类型。
  14355. */
  14356. abstract inputTypes: TInputs
  14357. /**
  14358. * 节点输出的数据类型。
  14359. */
  14360. abstract outputType: TOutput
  14361. protected _output?: IRGData[TOutput]
  14362. protected _inputs: {
  14363. [key: string]: TRGNodeAny
  14364. }
  14365. protected _outputs: {
  14366. [id: number]: string
  14367. }
  14368. /**
  14369. * 节点的初始化配置参数。
  14370. */
  14371. get options(): IOptions
  14372. /**
  14373. * 节点名字。
  14374. */
  14375. get name(): string
  14376. /**
  14377. * 节点id。
  14378. */
  14379. get id(): number
  14380. /**
  14381. * 获取当前游戏实例。
  14382. */
  14383. get scene(): Scene
  14384. /**
  14385. * 获取当前节点输出。
  14386. */
  14387. get output(): IRGData[TOutput]
  14388. /**
  14389. * 不要直接调用,请使用`renderGraph.createNode`方法。
  14390. */
  14391. constructor(
  14392. _parent: RenderGraph,
  14393. _id: number,
  14394. _name: string,
  14395. _options: IOptions
  14396. )
  14397. /**
  14398. * 节点初始化后的回调。
  14399. */
  14400. onInit(options: IOptions): void
  14401. /**
  14402. * 获取某个节点的输入。
  14403. */
  14404. getInput<TKey extends keyof TInputs>(key: TKey): IRGData[TInputs[TKey]]
  14405. /**
  14406. * @internal
  14407. */
  14408. /**
  14409. * @internal
  14410. */
  14411. /**
  14412. * @internal
  14413. */
  14414. /**
  14415. * @internal
  14416. */
  14417. /**
  14418. * 重置节点状态,清空输入,一般用于可缓存的节点优化。
  14419. */
  14420. reset(): void
  14421. /**
  14422. * 节点在真正被第一次使用时的回调。
  14423. */
  14424. onActive(context: RenderSystem, options: IOptions): void
  14425. /**
  14426. * 节点在每帧执行时的回调。
  14427. */
  14428. onExecute(context: RenderSystem, options: IOptions): void
  14429. /**
  14430. * 节点在被图中移除时的回调。
  14431. */
  14432. onDisable(context: RenderSystem, options: IOptions): void
  14433. }
  14434. export {}
  14435. }
  14436. declare module 'XrFrame/loader/glTF/animations/GLTFAnimationNode' {
  14437. import { Kanata } from 'XrFrame/ext'
  14438. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  14439. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14440. import { GLTFNodesLoaded } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  14441. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  14442. import {
  14443. GLTFChannelsLoaded,
  14444. GLTFChannelsNodeRaw
  14445. } from 'XrFrame/loader/glTF/animations/channels/GLTFChannelsNode'
  14446. import { GLTFSamplersNodeRaw } from 'XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode'
  14447. /**
  14448. * 二进制格式
  14449. * | contentoffset | fps(float) | totalFrame | totalSampleGroup |
  14450. * | Array<PuppetAnimationSampleGroup> |
  14451. *
  14452. * @see PuppetAnimationSampleGroup at GLTFChannelNode.ts
  14453. */
  14454. export type PuppetAnimationClipModel = ArrayBuffer | GLTF.BufferView
  14455. export interface GLTFAnimationNodeRaw {
  14456. channels: GLTFChannelsNodeRaw
  14457. samplers: GLTFSamplersNodeRaw
  14458. name?: string
  14459. extras?: any
  14460. }
  14461. export interface GLTFAnimationLoaded {
  14462. clip: Kanata.AnimationClipModel
  14463. channels: GLTFChannelsLoaded
  14464. frameCount: number
  14465. name?: string
  14466. extras?: any
  14467. }
  14468. export default class GLTFAnimationNode extends GLTFBaseNode {
  14469. get nodeName(): string
  14470. readonly raw: GLTFAnimationNodeRaw
  14471. resource: GLTFAnimationLoaded | null
  14472. build(): void
  14473. preload(
  14474. prerequisites: [
  14475. accessors: GLTFAccessorsLoaded,
  14476. nodes: GLTFNodesLoaded
  14477. ]
  14478. ): Promise<GLTFAnimationLoaded>
  14479. getLoadedResource(): GLTFAnimationLoaded
  14480. }
  14481. }
  14482. declare module 'XrFrame/loader/glTF/buffers/GLTFAccessorNode' {
  14483. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  14484. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14485. import { GLTFBufferViewLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewNode'
  14486. import { GLTFBufferViewsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode'
  14487. export enum EnumGLTFAccessorComponentType {
  14488. BYTE = 5120,
  14489. UNSIGNED_BYTE = 5121,
  14490. SHORT = 5122,
  14491. UNSIGNED_SHORT = 5123,
  14492. UNSIGNED_INT = 5125,
  14493. FLOAT = 5126
  14494. }
  14495. export const GLTFAccessorComponentTypeToViewClass: {
  14496. 5120: Int8ArrayConstructor
  14497. 5121: Uint8ArrayConstructor
  14498. 5122: Int16ArrayConstructor
  14499. 5123: Uint16ArrayConstructor
  14500. 5125: Uint32ArrayConstructor
  14501. 5126: Float32ArrayConstructor
  14502. }
  14503. export const GLTFAccessorTypeToNumberOfElements: {
  14504. SCALAR: number
  14505. VEC2: number
  14506. VEC3: number
  14507. VEC4: number
  14508. MAT2: number
  14509. MAT3: number
  14510. MAT4: number
  14511. }
  14512. export interface GLTFAccessorNodeRaw {
  14513. bufferView?: number
  14514. byteOffset?: number
  14515. componentType: number
  14516. count: number
  14517. min?: number[]
  14518. max?: number[]
  14519. type: string
  14520. normalized?: boolean
  14521. sparse?: boolean
  14522. name?: string
  14523. extras?: any
  14524. }
  14525. /**
  14526. * 以FloatVec3为例:
  14527. * 一个component指一个float,
  14528. * 一个element指三个float。
  14529. */
  14530. export interface GLTFAccessorLoaded {
  14531. bufferView: GLTFBufferViewLoaded
  14532. bufferViewIndex: number
  14533. view: GLTF.BufferView
  14534. elementLength: number
  14535. bytesPerComponent: number
  14536. count: number
  14537. stride: number
  14538. byteStride: number
  14539. componentType: EnumGLTFAccessorComponentType
  14540. max?: number[]
  14541. min?: number[]
  14542. compact: boolean
  14543. extras?: any
  14544. getCompAt(element: number, comp: number): any
  14545. }
  14546. export default class GLTFAccessorNode extends GLTFBaseNode {
  14547. get nodeName(): string
  14548. readonly raw: GLTFAccessorNodeRaw
  14549. build(): void
  14550. preload(
  14551. prerequisites: [GLTFBufferViewsLoaded]
  14552. ): Promise<GLTFAccessorLoaded>
  14553. getLoadedResource(): GLTFAccessorLoaded
  14554. }
  14555. }
  14556. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferNode' {
  14557. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14558. export interface GLTFBufferNodeRaw {
  14559. uri?: string
  14560. byteLength: number
  14561. name?: string
  14562. extras?: any
  14563. }
  14564. export interface GLTFBufferLoaded {
  14565. buffer: ArrayBuffer
  14566. extras?: any
  14567. }
  14568. export default class GLTFBufferNode extends GLTFBaseNode {
  14569. get nodeName(): string
  14570. readonly raw: GLTFBufferNodeRaw
  14571. protected resource: GLTFBufferLoaded | null
  14572. build(): void
  14573. preload(): Promise<GLTFBufferLoaded>
  14574. getLoadedResource(): GLTFBufferLoaded
  14575. }
  14576. }
  14577. declare module 'XrFrame/loader/glTF/buffers/GLTFBufferViewNode' {
  14578. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14579. import { GLTFBuffersLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBuffersNode'
  14580. export interface GLTFBufferViewNodeRaw {
  14581. buffer: number
  14582. byteLength: number
  14583. byteOffset?: number
  14584. byteStride?: number
  14585. target?: EnumGLTFBufferViewTarget
  14586. name?: string
  14587. extras?: any
  14588. }
  14589. export interface GLTFBufferViewLoaded {
  14590. data: ArrayBuffer
  14591. byteOffset: number
  14592. byteStride: number
  14593. byteLength: number
  14594. target: EnumGLTFBufferViewTarget
  14595. extras?: any
  14596. getSlicedData(): ArrayBuffer
  14597. getUint8View(): Uint8Array
  14598. _sliced: ArrayBuffer
  14599. }
  14600. export enum EnumGLTFBufferViewTarget {
  14601. ARRAY_BUFFER = 34962,
  14602. ELEMENT_ARRAY_BUFFER = 34963
  14603. }
  14604. export default class GLTFBufferViewNode extends GLTFBaseNode {
  14605. get nodeName(): string
  14606. readonly raw: GLTFBufferViewNodeRaw
  14607. build(): void
  14608. preload(
  14609. prerequisites: [GLTFBuffersLoaded]
  14610. ): Promise<GLTFBufferViewLoaded>
  14611. getLoadedResource(): GLTFBufferViewLoaded
  14612. }
  14613. }
  14614. declare module 'XrFrame/loader/glTF/geometry/GLTFMeshNode' {
  14615. import { Kanata } from 'XrFrame/ext'
  14616. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  14617. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14618. import { GLTFMaterialsLoaded } from 'XrFrame/loader/glTF/materials/GLTFMaterialsNode'
  14619. import {
  14620. GLTFPrimitivesLoaded,
  14621. GLTFPrimitivesNodeRaw
  14622. } from 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitivesNode'
  14623. export interface GLTFMeshNodeRaw {
  14624. primitives: GLTFPrimitivesNodeRaw
  14625. weights?: number[]
  14626. name?: string
  14627. extras?: any
  14628. }
  14629. export interface GLTFMeshLoaded {
  14630. subMeshes: GLTFPrimitivesLoaded
  14631. weights: number[]
  14632. name?: string
  14633. extras?: any
  14634. }
  14635. export default class GLTFMeshNode extends GLTFBaseNode {
  14636. get nodeName(): string
  14637. readonly raw: GLTFMeshNodeRaw
  14638. build(): void
  14639. preload(
  14640. prerequisites: [
  14641. materials: GLTFMaterialsLoaded,
  14642. accessors: GLTFAccessorsLoaded,
  14643. vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>
  14644. ]
  14645. ): Promise<GLTFMeshLoaded>
  14646. getLoadedResource(): GLTFMeshLoaded
  14647. }
  14648. }
  14649. declare module 'XrFrame/loader/glTF/materials/GLTFMaterialNode' {
  14650. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14651. import GLTFTextureInfoNode, {
  14652. GLTFTextureInfoNodeRaw
  14653. } from 'XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode'
  14654. import GLTFPBRMetallicRoughnessNode, {
  14655. GLTFPBRMetallicRoughnessNodeRaw
  14656. } from 'XrFrame/loader/glTF/materials/pbr/GLTFPBRMetallicRoughnessNode'
  14657. import GLTFNormalTextureInfoNode, {
  14658. GLTFNormalTextureInfoNodeRaw
  14659. } from 'XrFrame/loader/glTF/materials/texture/GLTFNormalTextureInfoNode'
  14660. import GLTFOcclusionTextureInfoNode, {
  14661. GLTFOcclusionTextureInfoNodeRaw
  14662. } from 'XrFrame/loader/glTF/materials/texture/GLTFOcclusionTextureInfoNode'
  14663. import Material from 'XrFrame/assets/Material'
  14664. import { IRenderStates } from 'XrFrame/assets/Effect'
  14665. import { GLTFTexturesLoaded } from 'XrFrame/loader/glTF/textures/GLTFTexturesNode'
  14666. export interface GLTFMaterialExtArgs {
  14667. uniform: object
  14668. renderStates: IRenderStates
  14669. macros: object
  14670. }
  14671. export enum EnumGLTFMaterialAlphaMode {
  14672. OPAQUE = 0,
  14673. MASK = 1,
  14674. BLEND = 2
  14675. }
  14676. export interface GLTFMaterialNodeRaw {
  14677. name?: string
  14678. pbrMetallicRoughness?: GLTFPBRMetallicRoughnessNodeRaw
  14679. normalTexture?: GLTFNormalTextureInfoNodeRaw
  14680. occlusionTexture?: GLTFOcclusionTextureInfoNodeRaw
  14681. emissiveTexture?: GLTFTextureInfoNodeRaw
  14682. emissiveFactor?: [number, number, number]
  14683. alphaMode?: string
  14684. alphaCutoff?: number
  14685. doubleSided?: boolean
  14686. extras?: any
  14687. }
  14688. export type GLTFMaterialPrerequisites = [textrues: GLTFTexturesLoaded]
  14689. export interface GLTFMaterialLoaded {
  14690. material: Material
  14691. extras?: any
  14692. }
  14693. export default class GLTFMaterialNode extends GLTFBaseNode {
  14694. get nodeName(): string
  14695. readonly raw: GLTFMaterialNodeRaw
  14696. resource: GLTFMaterialLoaded | null
  14697. pbrMetallicRoughness: GLTFPBRMetallicRoughnessNode | undefined
  14698. normalTexture: GLTFNormalTextureInfoNode | undefined
  14699. occlusionTexture: GLTFOcclusionTextureInfoNode | undefined
  14700. emissiveTexture: GLTFTextureInfoNode | undefined
  14701. build(): void
  14702. /**
  14703. * @internal
  14704. */
  14705. preloadWithoutPBR(
  14706. prerequisites: GLTFMaterialPrerequisites
  14707. ): Promise<GLTFMaterialExtArgs>
  14708. /**
  14709. * 实际上不一定会走到这里,mesh没有material也是合法的,这时候会去取emptyMaterial。
  14710. */
  14711. preload(
  14712. prerequisites: [textrues: GLTFTexturesLoaded]
  14713. ): Promise<GLTFMaterialLoaded>
  14714. getLoadedResource(): GLTFMaterialLoaded
  14715. }
  14716. }
  14717. declare module 'XrFrame/loader/glTF/skins/GLTFSkinNode' {
  14718. import { Kanata } from 'XrFrame/ext'
  14719. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  14720. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14721. export interface GLTFSkinNodeRaw {
  14722. inverseBindMatrices?: number
  14723. skeleton?: number
  14724. joints: number[]
  14725. extras?: any
  14726. }
  14727. export interface GLTFSkinLoaded {
  14728. inverseBindMatrices: Kanata.SkeletonBoneInverseModel
  14729. skeleton?: number
  14730. joints: number[]
  14731. extras?: any
  14732. }
  14733. export default class GLTFSkinNode extends GLTFBaseNode {
  14734. get nodeName(): string
  14735. readonly raw: GLTFSkinNodeRaw
  14736. resource: GLTFSkinLoaded | null
  14737. build(): void
  14738. preload(
  14739. prerequisites: [accessors: GLTFAccessorsLoaded]
  14740. ): Promise<GLTFSkinLoaded>
  14741. getLoadedResource(): GLTFSkinLoaded
  14742. }
  14743. }
  14744. declare module 'XrFrame/loader/glTF/textures/GLTFImageNode' {
  14745. import { Kanata } from 'XrFrame/ext'
  14746. import { GLTFBufferViewsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFBufferViewsNode'
  14747. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14748. export interface GLTFImageNodeRaw {
  14749. uri?: string
  14750. mimeType?: string
  14751. bufferView?: number
  14752. name?: string
  14753. extras?: any
  14754. }
  14755. export interface GLTFImageLoaded {
  14756. kanataImage?: Kanata.IImage
  14757. type?: string
  14758. extras?: any
  14759. }
  14760. export type GLTFImageNodePrerequisites = [
  14761. bufferViews: GLTFBufferViewsLoaded
  14762. ]
  14763. export default class GLTFImageNode extends GLTFBaseNode {
  14764. get nodeName(): string
  14765. readonly raw: GLTFImageNodeRaw
  14766. protected resource: GLTFImageLoaded | null
  14767. build(): void
  14768. preload(
  14769. prerequisites: GLTFImageNodePrerequisites
  14770. ): Promise<GLTFImageLoaded>
  14771. getLoadedResource(): GLTFImageLoaded
  14772. }
  14773. }
  14774. declare module 'XrFrame/loader/glTF/textures/GLTFSamplerNode' {
  14775. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14776. export enum EnumGLTFSamplerFilter {
  14777. NEAREST = 9728,
  14778. LINEAR = 9729,
  14779. NEAREST_MIPMAP_NEAREST = 9984,
  14780. LINEAR_MIPMAP_NEAREST = 9985,
  14781. NEAREST_MIPMAP_LINEAR = 9986,
  14782. LINEAR_MIPMAP_LINEAR = 9987
  14783. }
  14784. export function NeedMipmap(sampler: EnumGLTFSamplerFilter): boolean
  14785. export enum EnumGLTFSamplerWrap {
  14786. CLAMP_TO_EDGE = 33071,
  14787. MIRRORED_REPEAT = 33648,
  14788. REPEAT = 10497
  14789. }
  14790. export interface GLTFSamplerNodeRaw {
  14791. magFilter?: number
  14792. minFilter?: number
  14793. wrapS?: number
  14794. wrapT?: number
  14795. name?: string
  14796. extras?: any
  14797. }
  14798. export interface GLTFSamplerLoaded {
  14799. magFilter: EnumGLTFSamplerFilter
  14800. minFilter: EnumGLTFSamplerFilter
  14801. wrapS: EnumGLTFSamplerWrap
  14802. wrapT: EnumGLTFSamplerWrap
  14803. extras?: any
  14804. }
  14805. export default class GLTFSamplerNode extends GLTFBaseNode {
  14806. get nodeName(): string
  14807. readonly raw: GLTFSamplerNodeRaw
  14808. build(): void
  14809. preload(): Promise<GLTFSamplerLoaded>
  14810. getLoadedResource(): GLTFSamplerLoaded
  14811. }
  14812. }
  14813. declare module 'XrFrame/loader/glTF/textures/GLTFTextureNode' {
  14814. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14815. import { GLTFImagesLoaded } from 'XrFrame/loader/glTF/textures/GLTFImagesNode'
  14816. import { GLTFSamplersLoaded } from 'XrFrame/loader/glTF/textures/GLTFSamplersNode'
  14817. import { Kanata } from 'XrFrame/ext'
  14818. export interface GLTFTextureNodeRaw {
  14819. sampler?: number
  14820. source?: number
  14821. name?: string
  14822. extras?: any
  14823. }
  14824. export interface GLTFTextureLoaded {
  14825. texture: Kanata.Texture
  14826. extras?: any
  14827. }
  14828. export default class GLTFTextureNode extends GLTFBaseNode {
  14829. get nodeName(): string
  14830. readonly raw: GLTFTextureNodeRaw
  14831. build(): void
  14832. preload(
  14833. prerequisites: [
  14834. images: GLTFImagesLoaded,
  14835. samplers: GLTFSamplersLoaded
  14836. ]
  14837. ): Promise<GLTFTextureLoaded>
  14838. getLoadedResource(): GLTFTextureLoaded
  14839. }
  14840. }
  14841. declare module 'XrFrame/loader/glTF/animations/channels/GLTFTargetNode' {
  14842. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14843. import {
  14844. GLTFNodesLoaded,
  14845. GLTFTreeNode
  14846. } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  14847. export enum GLTFEnumAnimationTargetPath {
  14848. TRANSLATION = 0,
  14849. ROTATION = 1,
  14850. SCALE = 2,
  14851. WEIGHTS = 3
  14852. }
  14853. export interface GLTFTargetNodeRaw {
  14854. node?: number
  14855. path: 'translation' | 'rotation' | 'scale' | 'weights'
  14856. extras?: any
  14857. }
  14858. export interface GLTFTargetLoaded {
  14859. node: GLTFTreeNode | null
  14860. path: GLTFEnumAnimationTargetPath
  14861. extras?: any
  14862. }
  14863. export default class GLTFTargetNode extends GLTFBaseNode {
  14864. get nodeName(): string
  14865. readonly raw: GLTFTargetNodeRaw
  14866. build(): void
  14867. preload(
  14868. prerequisites: [nodes: GLTFNodesLoaded]
  14869. ): Promise<GLTFTargetLoaded>
  14870. getLoadedResource(): GLTFTargetLoaded
  14871. }
  14872. }
  14873. declare module 'XrFrame/loader/glTF/geometry/primitives/attributes/GLTFAttributesNode' {
  14874. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  14875. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14876. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  14877. import { GLTFTargetsLoaded } from 'XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode'
  14878. /**
  14879. * GLTF.Attributes.Name -> Kanata.Layout.Name
  14880. */
  14881. export function convertAttributeName(name: string): string
  14882. /**
  14883. * GLTF.Attributes.Name -> Kanata.Layout.Format
  14884. * 在shader里不同用途的attribute的长度是固定的,无论他用的accessor实际元素的长度是多少
  14885. */
  14886. export function getComponentCountFromAttributeName(name: string): number
  14887. /**
  14888. * GLTF.Attributes.Name -> Shader Macros
  14889. */
  14890. export function genMacrosByAttrib(name: string, macros: object): void
  14891. export interface GLTFAttributesExtArgs {
  14892. trust?: boolean
  14893. check?: boolean
  14894. }
  14895. export type GLTFAttributesNodeRaw = {
  14896. [attribName: string]: number
  14897. }
  14898. export type GLTFAttributesLoaded = GLTF.VertexProperties
  14899. export default class GLTFAttributesNode extends GLTFBaseNode {
  14900. get nodeName(): string
  14901. readonly raw: GLTFAttributesNodeRaw
  14902. build(): void
  14903. preload(
  14904. prerequisites: [
  14905. targets: GLTFTargetsLoaded,
  14906. materials: any,
  14907. accessors: GLTFAccessorsLoaded,
  14908. vbMap: Map<string, GLTF.VertexProperties>
  14909. ]
  14910. ): Promise<GLTFAttributesLoaded>
  14911. getLoadedResource(): GLTFAttributesLoaded
  14912. }
  14913. }
  14914. declare module 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitiveNode' {
  14915. import Geometry from 'XrFrame/assets/Geometry'
  14916. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  14917. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  14918. import { GLTFAttributesNodeRaw } from 'XrFrame/loader/glTF/geometry/primitives/attributes/GLTFAttributesNode'
  14919. import { GLTFMaterialsLoaded } from 'XrFrame/loader/glTF/materials/GLTFMaterialsNode'
  14920. import Material from 'XrFrame/assets/Material'
  14921. import { GLTFAccessorLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorNode'
  14922. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  14923. import { GLTFTargetsNodeRaw } from 'XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode'
  14924. export enum EnumGLTFPrimitiveMode {
  14925. POINTS = 0,
  14926. LINES = 1,
  14927. LINE_LOOP = 2,
  14928. LINE_STRIP = 3,
  14929. TRIANGLES = 4,
  14930. TRIANGLE_STRIP = 5,
  14931. TRIANGLE_FAN = 6
  14932. }
  14933. export interface GLTFPrimitiveNodeRaw {
  14934. attributes: GLTFAttributesNodeRaw
  14935. indices?: number
  14936. material?: number
  14937. mode?: number
  14938. targets?: GLTFTargetsNodeRaw
  14939. extras?: any
  14940. }
  14941. export interface GLTFPrimitiveLoaded {
  14942. geometry: Geometry
  14943. material: Material
  14944. extras?: any
  14945. }
  14946. export type GLTFPrimitivePrerequisites = [
  14947. materials: GLTFMaterialsLoaded,
  14948. accessors: GLTFAccessorsLoaded,
  14949. vbMap: Map<string, GLTF.VertexProperties>
  14950. ]
  14951. export interface GLTFPrimitiveVertexExtArgs {
  14952. vbInfo: GLTF.VertexProperties
  14953. }
  14954. export interface GLTFPrimitiveIndexExtArgs {
  14955. accessor: GLTFAccessorLoaded
  14956. }
  14957. export default class GLTFPrimitiveNode extends GLTFBaseNode {
  14958. get nodeName(): string
  14959. readonly raw: GLTFPrimitiveNodeRaw
  14960. build(): void
  14961. preload(
  14962. prerequisites: GLTFPrimitivePrerequisites
  14963. ): Promise<GLTFPrimitiveLoaded>
  14964. getLoadedResource(): GLTFPrimitiveLoaded
  14965. }
  14966. }
  14967. declare module 'XrFrame/loader/glTF/utils/types' {
  14968. import { ITransformData } from 'XrFrame/components'
  14969. import { Kanata } from 'XrFrame/ext'
  14970. import Quaternion from 'XrFrame/math/quaternion'
  14971. import Vector3, { Vector3ReadOnly } from 'XrFrame/math/vector3'
  14972. export namespace GLTF {
  14973. type BufferView =
  14974. | Int8Array
  14975. | Uint8Array
  14976. | Uint16Array
  14977. | Uint32Array
  14978. | Float32Array
  14979. type IndexBufferView = Uint16Array | Uint32Array | Uint8Array
  14980. class BoundingBox {
  14981. min: Vector3
  14982. max: Vector3
  14983. adoptMin: (newMin: Vector3) => void
  14984. adoptMax: (newMax: Vector3) => void
  14985. adopt: (newPoint: Vector3) => void
  14986. }
  14987. interface BoundingBoxReadOnly {
  14988. min: Vector3ReadOnly
  14989. max: Vector3ReadOnly
  14990. }
  14991. namespace BoundingBox {
  14992. function createZero(): BoundingBox
  14993. function createInfinite(): BoundingBox
  14994. }
  14995. interface VertexLayoutDesc extends Kanata.IVertexLayoutOptions {
  14996. stride: number
  14997. }
  14998. interface VertexProperties {
  14999. buffer: Float32Array
  15000. layoutDesc: VertexLayoutDesc
  15001. layout: Kanata.VertexLayout
  15002. macros: object
  15003. boundingBox: BoundingBox
  15004. /**
  15005. * 是否需要自行生成normal和tangent的顶点数据。
  15006. */
  15007. lackNormal: boolean
  15008. lackTangent: boolean
  15009. /**
  15010. * 如果需要生成的话,生成在layoutDesc的哪个attribute里。
  15011. */
  15012. normalSlot: number
  15013. tangentSlot: number
  15014. }
  15015. interface Transform extends ITransformData {
  15016. /**
  15017. * 同时有quat和rotation的情况下,quat优先;
  15018. * 目前只会填写quat,不会填写rotation。
  15019. */
  15020. quat?: Quaternion
  15021. }
  15022. }
  15023. }
  15024. declare module 'XrFrame/kanata/lib/backend' {
  15025. /**
  15026. * index.ts
  15027. *
  15028. * * @Date : 9/3/2020, 8:45:18 PM
  15029. */
  15030. export * from 'XrFrame/kanata/lib/backend/interface'
  15031. import { IImage } from 'XrFrame/kanata/lib/backend/interface'
  15032. import { IWorker } from 'XrFrame/kanata/lib/backend/interface/IWorker'
  15033. export interface IBackend {
  15034. IS_VALID: () => boolean
  15035. GET_MAIN_CANVAS(): HTMLCanvasElement
  15036. worker: IWorker
  15037. Image: {
  15038. new (): IImage
  15039. IS(obj: any): obj is IImage
  15040. }
  15041. Phys3D: any
  15042. }
  15043. const backend: IBackend
  15044. export default backend
  15045. }
  15046. declare module 'XrFrame/kanata/lib/frontend/shared/NativeObject' {
  15047. /**
  15048. * NativeObject.ts
  15049. *
  15050. * * @Date : 9/3/2020, 9:17:03 PM
  15051. */
  15052. import { IHandle } from 'XrFrame/kanata/lib/backend'
  15053. export default class NativeObject {
  15054. _bufferName: string
  15055. _byteOffset: number
  15056. _bufferLength: number
  15057. id: number
  15058. _buffer: ArrayBuffer
  15059. _f32view: Float32Array
  15060. _u32view: Uint32Array
  15061. protected _handle: IHandle
  15062. protected _init(info: IHandle): void
  15063. protected _fastInit(info: IHandle): void
  15064. protected _initU32View(): void
  15065. protected _initPropertyView(
  15066. offset: number,
  15067. length: number
  15068. ): Float32Array
  15069. setRawBuffer(data: Float32Array): void
  15070. destroy(): void
  15071. }
  15072. }
  15073. declare module 'XrFrame/kanata/lib/frontend/pool/PoolObject' {
  15074. import Pool from 'XrFrame/kanata/lib/frontend/pool/Pool'
  15075. export interface INativePools {
  15076. [poolId: number]: Pool
  15077. }
  15078. export default class PoolObject {
  15079. protected _nativePool: Pool
  15080. protected _nativeId: number
  15081. protected _poolId: number
  15082. protected _poolIndex: number
  15083. protected _using: boolean
  15084. entityOffset: number
  15085. get float32View(): Float32Array
  15086. get uint32View(): Uint32Array
  15087. get id(): number
  15088. get poolId(): number
  15089. get poolIndex(): number
  15090. get poll(): any
  15091. get isUsing(): boolean
  15092. set isUsing(value: boolean)
  15093. protected _init(nativeObjId: number, nativePools: INativePools): void
  15094. setRawBuffer(data: Float32Array): void
  15095. }
  15096. }
  15097. declare module 'XrFrame/kanata/lib/frontend/pool/PoolManager' {
  15098. /**
  15099. * PoolManager.ts
  15100. *
  15101. * * @Date : 9/3/2020, 9:19:34 PM
  15102. */
  15103. import { IHandle } from 'XrFrame/kanata/lib/backend'
  15104. import PoolObject, {
  15105. INativePools
  15106. } from 'XrFrame/kanata/lib/frontend/pool/PoolObject'
  15107. export default class PoolManager {
  15108. pools: INativePools
  15109. constructor(
  15110. template: ArrayBuffer,
  15111. templateView: Float32Array,
  15112. allocateFunc: (size: number) => IHandle,
  15113. extendedMemSize?: number
  15114. )
  15115. allocateOne(): number
  15116. dispose(obj: PoolObject): void
  15117. }
  15118. }
  15119. declare module 'XrFrame/kanata/lib/frontend/shared/PureResource' {
  15120. /**
  15121. * PureResource.ts
  15122. *
  15123. * * @Date : 9/8/2020, 9:04:32 PM
  15124. */
  15125. import { IHandle } from 'XrFrame/kanata/lib/backend'
  15126. export default class PureResource {
  15127. id: number
  15128. __handle: IHandle
  15129. protected get _handle(): IHandle
  15130. protected set _handle(value: IHandle)
  15131. destroy(): void
  15132. }
  15133. }
  15134. declare module 'XrFrame/kanata/lib/backend/native/worker' {
  15135. import {
  15136. IHandle,
  15137. ETextureType,
  15138. ETextureFormat,
  15139. IRect,
  15140. EMeshRenderType,
  15141. INativeMap,
  15142. ILongIntNativeMap,
  15143. IGlyphInfo,
  15144. IRenderEnv,
  15145. EDracoDecodeType,
  15146. DracoDecoded
  15147. } from 'XrFrame/kanata/lib/backend/interface'
  15148. export interface INativeWorker {
  15149. createVertexLayout(options: string): IHandle
  15150. createVertexDataDescriptor(options: string): IHandle
  15151. createVertexBuffer(
  15152. buffer: ArrayBuffer | ArrayBufferView,
  15153. layout: number
  15154. ): IHandle
  15155. updateVertexBuffer(
  15156. bufferId: number,
  15157. buffer: ArrayBuffer | ArrayBufferView,
  15158. offset: number
  15159. ): void
  15160. createIndexBuffer(
  15161. buffer: ArrayBuffer | ArrayBufferView,
  15162. is32bits?: boolean
  15163. ): IHandle
  15164. updateIndexBuffer(
  15165. bufferId: number,
  15166. buffer: ArrayBuffer | ArrayBufferView,
  15167. offset: number
  15168. ): void
  15169. createVertexData(
  15170. layout: number,
  15171. size: number,
  15172. batchDesc: number
  15173. ): IHandle
  15174. createIndexData(size: number): IHandle
  15175. createTexture(
  15176. type: ETextureType,
  15177. width: number,
  15178. height: number,
  15179. slice: number,
  15180. mips: number,
  15181. format: ETextureFormat,
  15182. flags: number,
  15183. buffer: Array<ArrayBuffer | ArrayBufferView>,
  15184. offsets: Uint32Array
  15185. ): IHandle
  15186. createTexture(canvas: HTMLCanvasElement): IHandle
  15187. updateTexture(
  15188. id: number,
  15189. level: number,
  15190. slice: number,
  15191. xoffset: number,
  15192. yoffset: number,
  15193. zoffset: number,
  15194. width: number,
  15195. height: number,
  15196. buffer: ArrayBuffer | ArrayBufferView
  15197. ): void
  15198. updateTextureFlags(textureId: number, flags: number): void
  15199. createShader(vs: string, fs: string): IHandle
  15200. createUniformBlockDescriptor(descriptor: string): IHandle
  15201. createUniformBlock(descriptor: number): IHandle
  15202. createEffect(
  15203. name: string,
  15204. passCount: number,
  15205. keyIndexMap: string,
  15206. passes: string,
  15207. shaders: string[],
  15208. variants: string,
  15209. flags: number
  15210. ): IHandle & {
  15211. warmUp(): void
  15212. }
  15213. createMaterial(macros: string): IHandle
  15214. changeMaterialMacros(
  15215. material: number,
  15216. macros: string,
  15217. reset?: boolean
  15218. ): void
  15219. createScalableList(
  15220. initSize: number,
  15221. onBackendEnlarge: () => void
  15222. ): IHandle & {
  15223. enlarge(size: number): void
  15224. }
  15225. }
  15226. export interface INativeWorker {
  15227. createView(view: string): IHandle
  15228. updateViewRect(view: number, rect: IRect): void
  15229. updateViewScissor(view: number, rect: IRect): void
  15230. }
  15231. export interface INativeWorker {
  15232. createRenderPass(descriptor: string): IHandle
  15233. }
  15234. export interface INativeWorker {
  15235. createNodePool(count: number, is3d: boolean): IHandle
  15236. createNodeTree(
  15237. length: number,
  15238. ids: ArrayBuffer,
  15239. buffer: ArrayBuffer,
  15240. calculateWordMatrix: boolean,
  15241. is3d?: boolean
  15242. ): boolean
  15243. }
  15244. export namespace INativeWorker {
  15245. interface IAnimationClipBinding extends IHandle {
  15246. id: number
  15247. rebind(
  15248. buffer: ArrayBuffer,
  15249. offset: number,
  15250. cLength: number,
  15251. eLength: number,
  15252. removeAction: number,
  15253. retainedAction: number,
  15254. addedAction: number,
  15255. rootEntity: number
  15256. ): boolean
  15257. update(
  15258. buffer: ArrayBuffer,
  15259. offset: number,
  15260. cLength: number,
  15261. eLength: number,
  15262. removeAction: number,
  15263. retainedAction: number,
  15264. addedAction: number
  15265. ): boolean
  15266. writeDefaultValues(): void
  15267. }
  15268. }
  15269. export interface INativeWorker {
  15270. createCullingComponentPool(count: number): IHandle
  15271. createRenderComponent(
  15272. meshCount: number,
  15273. uniformBlock: number,
  15274. attachedNode: number,
  15275. cullingId: number,
  15276. meshRenderType: EMeshRenderType,
  15277. macros?: string
  15278. ): IHandle & {
  15279. setSharedDirty(): void
  15280. }
  15281. changeMeshMacros(mesh: number, macros: string): void
  15282. createAnimator(clipCount: number, nodeCount: number): IHandle
  15283. updateAnimators(data: Uint32Array): void
  15284. createAnimationClipBinding(
  15285. buffer: ArrayBuffer,
  15286. offset: number,
  15287. cLength: number,
  15288. eLength: number,
  15289. useDefaultAddedNodesAction: number,
  15290. rootEntity: number
  15291. ): INativeWorker.IAnimationClipBinding
  15292. createAnimatorControllerModel(layerCount: number): {
  15293. id: number
  15294. buffer: ArrayBuffer
  15295. setMaskAtIndex(
  15296. index: number,
  15297. mask: null | ArrayBuffer,
  15298. offset: number,
  15299. length: number
  15300. ): void
  15301. update(): void
  15302. }
  15303. createAnimatorControllerStateModel(clipCount: number): {
  15304. id: number
  15305. buffer: ArrayBuffer
  15306. }
  15307. updateAnimatorControllers(data: Uint32Array): void
  15308. createSkinning(boneCount: number, flag: number): IHandle
  15309. updateSkinnings(data: Uint32Array): void
  15310. createDynamicBones(rootNodeId: number): IHandle & {
  15311. preUpdate(): void
  15312. update(
  15313. dt: number,
  15314. rootMotionX?: number,
  15315. rootMotionY?: number,
  15316. rootMotionZ?: number
  15317. ): void
  15318. rebuild(): void
  15319. resetRoot(rootId: number): void
  15320. }
  15321. }
  15322. export interface INativeWorker {
  15323. createRenderCamera(
  15324. attachedNode: number,
  15325. isUI?: boolean
  15326. ): IHandle & {
  15327. setSharedDirty(): void
  15328. updateMatrices(): void
  15329. }
  15330. createLightCamera(): IHandle
  15331. }
  15332. export interface INativeWorker {
  15333. createAnimationClipModel(buffer: ArrayBuffer): IHandle
  15334. createBoneInverseModel(buffer: ArrayBuffer): IHandle
  15335. }
  15336. export interface INativeWorker {
  15337. eventBusSM: ArrayBuffer
  15338. dirtyNodesSM: ArrayBuffer
  15339. uiRenderList: ArrayBuffer
  15340. enlargeUIRenderList(): void
  15341. refreshNodesWorldTransform(): void
  15342. }
  15343. export interface INativeWorker {
  15344. loadTTFFont(buffer: ArrayBuffer, filaPath: string): string
  15345. getGlyphInfo(name: string, charCode: number): IGlyphInfo
  15346. }
  15347. export interface INativeWorker {
  15348. decodeImage(
  15349. buffer: ArrayBuffer,
  15350. callback: (
  15351. data: ArrayBuffer | undefined,
  15352. width: number,
  15353. height: number
  15354. ) => void,
  15355. premultiplyAlpha: boolean
  15356. ): void
  15357. getRenderEnv(): IRenderEnv
  15358. clearView(view: number): void
  15359. cullCamera(camera: number, cullResult: number, lightMode: string): void
  15360. drawCamera(camera: number, renderList: number, lightMode: string): void
  15361. drawLight(
  15362. light: number,
  15363. camera: number,
  15364. renderList: number,
  15365. lightMode: string
  15366. ): void
  15367. submit(): void
  15368. destroy(): void
  15369. createWeakRef<T>(wrapper: T): {
  15370. deref: () => T
  15371. }
  15372. createWeakRefSentry(): any
  15373. createNativeUUMap(): INativeMap<number>
  15374. createNativeSUMap(): INativeMap<string>
  15375. createNativeULUMap(): ILongIntNativeMap
  15376. decodeBase64(base64: string): ArrayBuffer
  15377. decodeDraco(
  15378. buffer: ArrayBuffer | ArrayBufferView,
  15379. decodeType: EDracoDecodeType
  15380. ): DracoDecoded
  15381. setNodeName(id: number, name: string): void
  15382. setRenderComponentName(id: number, name: string): void
  15383. debugPrint(msg: string): void
  15384. }
  15385. let Phys3D: any
  15386. export const native: {
  15387. worker: INativeWorker
  15388. }
  15389. export function destroy(): void
  15390. export function GET_MAIN_CANVAS(): HTMLCanvasElement
  15391. export function IS_VALID(): boolean
  15392. export { Phys3D }
  15393. }
  15394. declare module 'XrFrame/loader/glTF/animations/channels/GLTFChannelsNode' {
  15395. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15396. import { GLTFNodesLoaded } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  15397. import { GLTFSamplersLoaded } from 'XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode'
  15398. import GLTFChannelNode, {
  15399. GLTFChannelLoaded,
  15400. GLTFChannelNodeRaw
  15401. } from 'XrFrame/loader/glTF/animations/channels/GLTFChannelNode'
  15402. type ChildNode = GLTFChannelNode
  15403. export type GLTFChannelsNodeRaw = GLTFChannelsNodeRaw[]
  15404. export type GLTFChannelsLoaded = GLTFChannelLoaded[]
  15405. export default class GLTFChannelsNode extends GLTFArrayNode<ChildNode> {
  15406. ChildCtor(childRaw: GLTFChannelNodeRaw): GLTFChannelNode
  15407. readonly raw: GLTFChannelsNodeRaw
  15408. get nodeName(): string
  15409. preload: (
  15410. prerequisites: [
  15411. nodes: GLTFNodesLoaded,
  15412. samplers: GLTFSamplersLoaded
  15413. ]
  15414. ) => Promise<GLTFChannelsLoaded>
  15415. getLoadedResource(): GLTFChannelsLoaded
  15416. }
  15417. export {}
  15418. }
  15419. declare module 'XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode' {
  15420. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  15421. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15422. import GLTFSamplerNode, {
  15423. GLTFSamplerLoaded,
  15424. GLTFSamplerNodeRaw
  15425. } from 'XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode'
  15426. type ChildNode = GLTFSamplerNode
  15427. export type GLTFSamplersNodeRaw = GLTFSamplersNodeRaw[]
  15428. export type GLTFSamplersLoaded = GLTFSamplerLoaded[]
  15429. export default class GLTFSamplersNode extends GLTFArrayNode<ChildNode> {
  15430. ChildCtor(childRaw: GLTFSamplerNodeRaw): GLTFSamplerNode
  15431. readonly raw: GLTFSamplersNodeRaw
  15432. get nodeName(): string
  15433. preload: (
  15434. prerequisites: [accessors: GLTFAccessorsLoaded]
  15435. ) => Promise<GLTFSamplersLoaded>
  15436. getLoadedResource(): GLTFSamplersLoaded
  15437. }
  15438. export {}
  15439. }
  15440. declare module 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitivesNode' {
  15441. import { Kanata } from 'XrFrame/ext'
  15442. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  15443. import { GLTFArrayNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15444. import { GLTFMaterialsLoaded } from 'XrFrame/loader/glTF/materials/GLTFMaterialsNode'
  15445. import GLTFPrimitiveNode, {
  15446. GLTFPrimitiveLoaded,
  15447. GLTFPrimitiveNodeRaw
  15448. } from 'XrFrame/loader/glTF/geometry/primitives/GLTFPrimitiveNode'
  15449. type ChildNode = GLTFPrimitiveNode
  15450. export type GLTFPrimitivesNodeRaw = GLTFPrimitivesNodeRaw[]
  15451. export type GLTFPrimitivesLoaded = GLTFPrimitiveLoaded[]
  15452. export default class GLTFPrimitivesNode extends GLTFArrayNode<ChildNode> {
  15453. ChildCtor(childRaw: GLTFPrimitiveNodeRaw): GLTFPrimitiveNode
  15454. readonly raw: GLTFPrimitivesNodeRaw
  15455. get nodeName(): string
  15456. preload: (
  15457. prerequisites: [
  15458. materials: GLTFMaterialsLoaded,
  15459. accessors: GLTFAccessorsLoaded,
  15460. vbMap: Map<string, [ArrayBuffer, Kanata.VertexLayout, object]>
  15461. ]
  15462. ) => Promise<GLTFPrimitivesLoaded>
  15463. getLoadedResource(): GLTFPrimitivesLoaded
  15464. }
  15465. export {}
  15466. }
  15467. declare module 'XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode' {
  15468. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15469. import GLTFTextureTransformInfo from 'XrFrame/loader/glTF/materials/texture/GLTFTextureTransformInfo'
  15470. export interface GLTFTextureInfoNodeRaw {
  15471. index: number
  15472. texCoord?: number
  15473. extras?: any
  15474. extensions?: any
  15475. }
  15476. export interface GLTFTextureInfoLoaded {
  15477. index: number
  15478. texCoord: number
  15479. extras?: any
  15480. transformInfo?: GLTFTextureTransformInfo
  15481. }
  15482. export default class GLTFTextureInfoNode extends GLTFBaseNode {
  15483. get nodeName(): string
  15484. readonly raw: GLTFTextureInfoNodeRaw
  15485. build(): void
  15486. preload(): Promise<GLTFTextureInfoLoaded>
  15487. getLoadedResource(): GLTFTextureInfoLoaded
  15488. }
  15489. }
  15490. declare module 'XrFrame/loader/glTF/materials/pbr/GLTFPBRMetallicRoughnessNode' {
  15491. import { Kanata } from 'XrFrame/ext'
  15492. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15493. import { GLTFTexturesLoaded } from 'XrFrame/loader/glTF/textures/GLTFTexturesNode'
  15494. import { GLTFTextureInfoNodeRaw } from 'XrFrame/loader/glTF/materials/texture/GLTFTextureInfoNode'
  15495. export interface GLTFPBRMetallicRoughnessNodeRaw {
  15496. baseColorFactor?: [number, number, number, number]
  15497. baseColorTexture?: GLTFTextureInfoNodeRaw
  15498. metallicFactor?: number
  15499. roughnessFactor?: number
  15500. metallicRoughnessTexture?: GLTFTextureInfoNodeRaw
  15501. extras?: any
  15502. }
  15503. export interface GLTFPBRMetallicRoughnessLoaded {
  15504. uniform: {
  15505. [key: string]: ArrayLike<number> | number | Kanata.Texture
  15506. }
  15507. renderStates: object
  15508. macros: {
  15509. [key: string]: boolean | number
  15510. }
  15511. extras?: any
  15512. }
  15513. export default class GLTFPBRMetallicRoughnessNode extends GLTFBaseNode {
  15514. get nodeName(): string
  15515. readonly raw: GLTFPBRMetallicRoughnessNodeRaw
  15516. build(): void
  15517. preload(
  15518. prerequisites: [textrues: GLTFTexturesLoaded]
  15519. ): Promise<GLTFPBRMetallicRoughnessLoaded>
  15520. getLoadedResource(): GLTFPBRMetallicRoughnessLoaded
  15521. }
  15522. }
  15523. declare module 'XrFrame/loader/glTF/materials/texture/GLTFNormalTextureInfoNode' {
  15524. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15525. import GLTFTextureTransformInfo from 'XrFrame/loader/glTF/materials/texture/GLTFTextureTransformInfo'
  15526. export interface GLTFNormalTextureInfoNodeRaw {
  15527. index: number
  15528. texCoord?: number
  15529. scale?: number
  15530. extras?: any
  15531. extensions?: any
  15532. }
  15533. export interface GLTFNormalTextureInfoLoaded {
  15534. index: number
  15535. texCoord: number
  15536. scale: number
  15537. extras?: any
  15538. transformInfo?: GLTFTextureTransformInfo
  15539. }
  15540. export default class GLTFNormalTextureInfoNode extends GLTFBaseNode {
  15541. get nodeName(): string
  15542. readonly raw: GLTFNormalTextureInfoNodeRaw
  15543. build(): void
  15544. preload(): Promise<GLTFNormalTextureInfoLoaded>
  15545. getLoadedResource(): GLTFNormalTextureInfoLoaded
  15546. }
  15547. }
  15548. declare module 'XrFrame/loader/glTF/materials/texture/GLTFOcclusionTextureInfoNode' {
  15549. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15550. import GLTFTextureTransformInfo from 'XrFrame/loader/glTF/materials/texture/GLTFTextureTransformInfo'
  15551. export interface GLTFOcclusionTextureInfoNodeRaw {
  15552. index: number
  15553. texCoord?: number
  15554. strength?: number
  15555. extras?: any
  15556. extensions?: any
  15557. }
  15558. export interface GLTFOcclusionTextureInfoLoaded {
  15559. index: number
  15560. texCoord: number
  15561. strength: number
  15562. extras?: any
  15563. transformInfo?: GLTFTextureTransformInfo
  15564. }
  15565. export default class GLTFOcclusionTextureInfoNode extends GLTFBaseNode {
  15566. get nodeName(): string
  15567. readonly raw: GLTFOcclusionTextureInfoNodeRaw
  15568. build(): void
  15569. preload(): Promise<GLTFOcclusionTextureInfoLoaded>
  15570. getLoadedResource(): GLTFOcclusionTextureInfoLoaded
  15571. }
  15572. }
  15573. declare module 'XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode' {
  15574. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15575. export type GLTFTargetsNodeRaw = Array<{
  15576. [targetAttribName: string]: number
  15577. }>
  15578. export interface GLTFTargetsLoaded {
  15579. attributes: {
  15580. [targetAttribName: string]: number
  15581. }
  15582. }
  15583. export const validMorphAttribs: string[]
  15584. export default class GLTFTargetsNode extends GLTFBaseNode {
  15585. get nodeName(): string
  15586. readonly raw: GLTFTargetsNodeRaw
  15587. build(): void
  15588. preload(): Promise<GLTFTargetsLoaded>
  15589. getLoadedResource(): GLTFTargetsLoaded
  15590. }
  15591. }
  15592. declare module 'XrFrame/kanata/lib/backend/interface/IWorker' {
  15593. /**
  15594. * IWorker.ts
  15595. *
  15596. * * @Date : 12/3/2020, 4:45:58 PM
  15597. */
  15598. import {
  15599. IHandle,
  15600. ETextureType,
  15601. ETextureFormat,
  15602. IRect,
  15603. EMeshRenderType,
  15604. INativeMap,
  15605. ILongIntNativeMap,
  15606. IGlyphInfo,
  15607. IVertexLayoutOptions,
  15608. IView,
  15609. IRenderPassDescriptor,
  15610. IEventBridge,
  15611. IDownloader,
  15612. IUniformDescriptorOptions,
  15613. IFontSetting,
  15614. TTextureSource,
  15615. IImage,
  15616. IVertexDataDescriptorOptions,
  15617. IRenderEnv,
  15618. IEngineSettings,
  15619. EDracoDecodeType,
  15620. DracoDecoded
  15621. } from 'XrFrame/kanata/lib/backend/interface'
  15622. global {
  15623. const MAIN_CANVAS: HTMLCanvasElement
  15624. const ENGINE_SETTINGS: IEngineSettings
  15625. const ENGINE_MODE: 'Game' | 'Editor'
  15626. const IS_SUB_CONTEXT: boolean
  15627. const HOST: string
  15628. }
  15629. export interface IWorker {
  15630. createVertexLayout(options: IVertexLayoutOptions): IHandle
  15631. createVertexDataDescriptor(
  15632. options: IVertexDataDescriptorOptions
  15633. ): IHandle
  15634. createVertexBuffer(
  15635. buffer: ArrayBuffer | ArrayBufferView,
  15636. layout: IHandle
  15637. ): IHandle
  15638. updateVertexBuffer(
  15639. bufferHandle: IHandle,
  15640. buffer: ArrayBuffer | ArrayBufferView,
  15641. offset: number
  15642. ): void
  15643. createIndexBuffer(
  15644. buffer: ArrayBuffer | ArrayBufferView,
  15645. is32bits?: boolean
  15646. ): IHandle
  15647. updateIndexBuffer(
  15648. bufferHandle: IHandle,
  15649. buffer: ArrayBuffer | ArrayBufferView,
  15650. offset: number
  15651. ): void
  15652. createVertexData(
  15653. layout: IHandle,
  15654. size: number,
  15655. batchDesc: IHandle
  15656. ): IHandle
  15657. createIndexData(size: number): IHandle
  15658. createTexture(
  15659. type: ETextureType,
  15660. width: number,
  15661. height: number,
  15662. slice: number,
  15663. mips: number,
  15664. format: ETextureFormat,
  15665. flags: number,
  15666. source: TTextureSource[],
  15667. offsets: Uint32Array
  15668. ): IHandle
  15669. createAutoUpdateTextureFromCanvas(canvas: HTMLCanvasElement): IHandle
  15670. updateTexture(
  15671. handle: IHandle,
  15672. level: number,
  15673. slice: number,
  15674. xoffset: number,
  15675. yoffset: number,
  15676. zoffset: number,
  15677. width: number,
  15678. height: number,
  15679. buffer:
  15680. | ArrayBuffer
  15681. | ArrayBufferView
  15682. | IImage
  15683. | HTMLCanvasElement
  15684. | ImageData
  15685. ): void
  15686. updateTextureFlags(texture: IHandle, flags: number): void
  15687. createUniformBlockDescriptor(
  15688. descriptor: IUniformDescriptorOptions
  15689. ): IHandle
  15690. createUniformBlock(descriptor: IHandle): IHandle
  15691. createEffect(
  15692. name: string,
  15693. passCount: number,
  15694. keyIndexMap: string[],
  15695. passes: Array<{
  15696. lightMode: string
  15697. variants?: {
  15698. [key: number]: number
  15699. }
  15700. macros?: {
  15701. [key: string]: number
  15702. }
  15703. shaders?: number[]
  15704. }>,
  15705. shaders: string[],
  15706. variants: number[][],
  15707. useRuntimeMacros: boolean
  15708. ): IHandle & {
  15709. warmUp(): void
  15710. }
  15711. createMaterial(
  15712. macros?: {
  15713. [name: string]: string | number | boolean
  15714. },
  15715. uniformBlock?: IHandle
  15716. ): IHandle
  15717. changeMaterialMacros(
  15718. material: IHandle,
  15719. macros: {
  15720. [name: string]: string | number | boolean
  15721. },
  15722. reset?: boolean
  15723. ): void
  15724. }
  15725. export interface IWorker {
  15726. createView(view: IView): IHandle
  15727. updateViewRect(view: IHandle, rect: IRect): void
  15728. updateViewScissor(view: IHandle, rect: IRect): void
  15729. }
  15730. export interface IWorker {
  15731. createRenderPass(descriptor: IRenderPassDescriptor): IHandle
  15732. }
  15733. export interface IWorker {
  15734. createNodePool(count: number, is3d: boolean): IHandle
  15735. createNodeTree(
  15736. length: number,
  15737. ids: ArrayBuffer,
  15738. buffer: ArrayBuffer,
  15739. calculateWordMatrix: boolean,
  15740. is3d: boolean
  15741. ): boolean
  15742. }
  15743. export interface IWorker {
  15744. createCullingComponentPool(count: number): IHandle
  15745. createRenderComponent(
  15746. meshCount: number,
  15747. uniformBlock: IHandle,
  15748. attachedNodeId: number,
  15749. cullingCompId: number,
  15750. meshRenderType: EMeshRenderType,
  15751. macros?: {
  15752. [name: string]: string | number | boolean
  15753. }
  15754. ): IHandle & {
  15755. setSharedDirty(): void
  15756. }
  15757. changeMeshMacros(
  15758. mesh: IHandle,
  15759. macros: {
  15760. [name: string]: string | number | boolean
  15761. },
  15762. reset?: boolean
  15763. ): void
  15764. createAnimator(clipCount: number, nodeCount: number): IHandle
  15765. updateAnimators(
  15766. feObjects: Array<{
  15767. __handle: IHandle
  15768. id: number
  15769. }>,
  15770. size: number
  15771. ): void
  15772. createAnimationClipBinding(
  15773. clipArray: Array<{
  15774. __handle: IHandle
  15775. id: number
  15776. }>,
  15777. clipArrayOffset: number,
  15778. clipArrayLength: number,
  15779. entityArray: Array<
  15780. | number
  15781. | {
  15782. id: number
  15783. }
  15784. | null
  15785. >,
  15786. entityArrayOffset: number,
  15787. entityArrayLength: number,
  15788. useDefaultAddedNodesAction: number,
  15789. rootEntity: {
  15790. id: number
  15791. }
  15792. ): IHandle
  15793. rebindAnimationClipBinding(
  15794. binding: IHandle,
  15795. clipArray: Array<{
  15796. __handle: IHandle
  15797. id: number
  15798. }>,
  15799. clipArrayOffset: number,
  15800. clipArrayLength: number,
  15801. entityArray: Array<
  15802. | number
  15803. | {
  15804. id: number
  15805. }
  15806. | null
  15807. >,
  15808. entityArrayOffset: number,
  15809. entityArrayLength: number,
  15810. removeAction: number,
  15811. retainedAction: number,
  15812. addedAction: number,
  15813. rootEntity: {
  15814. id: number
  15815. }
  15816. ): boolean
  15817. updateAnimationClipBinding(
  15818. binding: IHandle,
  15819. clipArray: Array<{
  15820. __handle: IHandle
  15821. id: number
  15822. }>,
  15823. clipArrayOffset: number,
  15824. clipArrayLength: number,
  15825. entityArray: Array<
  15826. | number
  15827. | {
  15828. id: number
  15829. }
  15830. | null
  15831. >,
  15832. entityArrayOffset: number,
  15833. entityArrayLength: number,
  15834. removeAction: number,
  15835. retainedAction: number,
  15836. addedAction: number
  15837. ): boolean
  15838. writeAnimationClipBindingDefaultValues(binding: IHandle): void
  15839. createAnimatorControllerModel(layerCount: number): IHandle
  15840. setAnimatorControllerModelMaskAtIndex(
  15841. model: IHandle,
  15842. index: number,
  15843. mask: {
  15844. buffer: null | ArrayBuffer
  15845. offset: number
  15846. length: number
  15847. }
  15848. ): void
  15849. updateAnimatorControllerModel(model: IHandle): void
  15850. createAnimatorControllerStateModel(clipCount: number): IHandle
  15851. updateAnimatorControllers( // for performance
  15852. feObjects: Array<{
  15853. __handle: IHandle
  15854. id: number
  15855. }>,
  15856. size: number
  15857. ): void
  15858. createSkinning(boneCount: number, flag: number): IHandle
  15859. updateSkinnings(
  15860. feObjects: Array<{
  15861. __handle: IHandle
  15862. id: number
  15863. }>,
  15864. size: number
  15865. ): void
  15866. createDynamicBones(rootNodeId: number): IHandle & {
  15867. preUpdate(): void
  15868. update(
  15869. dt: number,
  15870. rootMotionX?: number,
  15871. rootMotionY?: number,
  15872. rootMotionZ?: number
  15873. ): void
  15874. rebuild(): void
  15875. resetRoot(rootId: number): void
  15876. }
  15877. }
  15878. export interface IWorker {
  15879. createRenderCamera(
  15880. attachedNodeId: number,
  15881. isUI?: boolean
  15882. ): IHandle & {
  15883. setSharedDirty(): void
  15884. updateMatrices(): void
  15885. }
  15886. createLightCamera(): IHandle
  15887. }
  15888. export interface IWorker {
  15889. createAnimationClipModel(buffer: ArrayBuffer): IHandle
  15890. createBoneInverseModel(buffer: ArrayBuffer): IHandle
  15891. createScalableList(
  15892. initSize: number,
  15893. onBackendEnlarge?: () => void
  15894. ): IHandle & {
  15895. enlarge(size: number): void
  15896. }
  15897. }
  15898. export interface IWorker {
  15899. eventBridge: IEventBridge
  15900. }
  15901. export interface IWorker {
  15902. loadTTFFont(url: string, callback: (font: string) => void): void
  15903. getGlyphInfo(fontSetting: IFontSetting, charCode: number): IGlyphInfo
  15904. }
  15905. export interface IWorker {
  15906. setGlobalPhysicSystem(system: any): void
  15907. bindRigidBodyToNode(rigidBody: any, nodeId: number): void
  15908. unbindRigidBody(rigidBody: any): void
  15909. bindCCTToNode(cc: any, nodeId: number): void
  15910. unbindCCT(cc: any): void
  15911. }
  15912. export interface IWorker {
  15913. downloader: IDownloader
  15914. update(delta: number): void
  15915. destroy(): void
  15916. refreshNodesWorldTransform(): void
  15917. getRenderEnv(): IRenderEnv
  15918. clearView(view: IHandle): void
  15919. cullCamera(
  15920. camera: IHandle,
  15921. cullResult: IHandle,
  15922. lightMode: string
  15923. ): void
  15924. drawCamera(
  15925. camera: IHandle,
  15926. renderList: IHandle,
  15927. lightMode: string
  15928. ): void
  15929. drawLight(
  15930. light: IHandle,
  15931. camera: IHandle,
  15932. renderList: IHandle,
  15933. lightMode: string
  15934. ): void
  15935. submit(): void
  15936. createWeakRef<T>(wrapper: T): {
  15937. deref: () => T
  15938. }
  15939. createWeakRefSentry(): any
  15940. createNativeUUMap(): INativeMap<number>
  15941. createNativeSUMap(): INativeMap<string>
  15942. createNativeULUMap(): ILongIntNativeMap
  15943. decodeBase64(base64: string): ArrayBuffer
  15944. initDraco?(): Promise<void>
  15945. decodeDraco(
  15946. buffer: ArrayBuffer | ArrayBufferView,
  15947. decodeType: EDracoDecodeType
  15948. ): DracoDecoded
  15949. setNodeName(id: number, name: string): void
  15950. setRenderComponentName(handle: IHandle, name: string): void
  15951. debugPrint(msg: string): void
  15952. }
  15953. }
  15954. declare module 'XrFrame/kanata/lib/frontend/pool/Pool' {
  15955. import { IHandle } from 'XrFrame/kanata/lib/backend'
  15956. import NativeObject from 'XrFrame/kanata/lib/frontend/shared/NativeObject'
  15957. export default class Pool extends NativeObject {
  15958. u32viewExt: Uint32Array
  15959. constructor(nativeObj: IHandle)
  15960. supplyExtendedMemory(buffer: ArrayBuffer): void
  15961. }
  15962. }
  15963. declare module 'XrFrame/loader/glTF/animations/channels/GLTFChannelNode' {
  15964. import { StreamReader } from 'XrFrame/core/utils'
  15965. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  15966. import { GLTFNodesLoaded } from 'XrFrame/loader/glTF/scenes/GLTFNodesNode'
  15967. import { GLTF } from 'XrFrame/loader/glTF/utils/types'
  15968. import { GLTFSamplerLoaded } from 'XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode'
  15969. import { GLTFSamplersLoaded } from 'XrFrame/loader/glTF/animations/samplers/GLTFSamplersNode'
  15970. import {
  15971. GLTFTargetLoaded,
  15972. GLTFTargetNodeRaw
  15973. } from 'XrFrame/loader/glTF/animations/channels/GLTFTargetNode'
  15974. export enum EnumPuppetAnimationSampleGroupType {
  15975. tx = 1,
  15976. ty = 2,
  15977. tz = 3,
  15978. sx = 4,
  15979. sy = 5,
  15980. sz = 6,
  15981. qx = 7,
  15982. qy = 8,
  15983. qz = 9,
  15984. qw = 10,
  15985. ex = 11,
  15986. ey = 12,
  15987. ez = 13
  15988. }
  15989. /**
  15990. * 二进制格式, byteLength = 12 + 16 * samples.len
  15991. * | Array<| nodeid | type | count |> |
  15992. * | Array<PuppetAnimationClipSample> |
  15993. */
  15994. export type PuppetAnimationSampleGroup = ArrayBuffer | GLTF.BufferView
  15995. /**
  15996. * 二进制格式, byteLength = 16
  15997. * uint32_t index;
  15998. * float value;
  15999. * float in_tangent;
  16000. * float out_tangent;
  16001. *
  16002. * @remind out_tangent的值决定了插值的类型!很hack!
  16003. * out_tangent = Infinity: STEP
  16004. * out_tangent = NaN: Spherical Linear Interpolation (for quaternion)
  16005. * out_tangent为正常值: Cubic Spline Interpolation (or Linear)
  16006. */
  16007. export type PuppetAnimationClipSample = ArrayBuffer | GLTF.BufferView
  16008. export interface GLTFChannelNodeRaw {
  16009. sampler: number
  16010. target: GLTFTargetNodeRaw
  16011. extras?: any
  16012. }
  16013. export interface GLTFChannelLoaded {
  16014. sampler: GLTFSamplerLoaded
  16015. target: GLTFTargetLoaded
  16016. vectorGroups: number
  16017. headerBytesNeeded: number
  16018. bodyBytesNeeded: number
  16019. serializeHeaderOnBuffer(
  16020. stream: StreamReader,
  16021. channelIndex: number
  16022. ): void
  16023. serializeBodyOnBuffer(stream: StreamReader): number
  16024. extraMorphNodeCount: number
  16025. extras?: any
  16026. }
  16027. export default class GLTFChannelNode extends GLTFBaseNode {
  16028. get nodeName(): string
  16029. readonly raw: GLTFChannelNodeRaw
  16030. build(): void
  16031. preload(
  16032. prerequisites: [
  16033. nodes: GLTFNodesLoaded,
  16034. samplers: GLTFSamplersLoaded
  16035. ]
  16036. ): Promise<GLTFChannelLoaded>
  16037. getLoadedResource(): GLTFChannelLoaded
  16038. }
  16039. }
  16040. declare module 'XrFrame/loader/glTF/animations/samplers/GLTFSamplerNode' {
  16041. import { GLTFAccessorLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorNode'
  16042. import { GLTFAccessorsLoaded } from 'XrFrame/loader/glTF/buffers/GLTFAccessorsNode'
  16043. import { GLTFBaseNode } from 'XrFrame/loader/glTF/GLTFBaseNode'
  16044. export enum EnumGLTFSamplerInterpolation {
  16045. STEP = 0,
  16046. LINEAR = 1,
  16047. CUBICSPLINE = 2
  16048. }
  16049. export interface GLTFSamplerNodeRaw {
  16050. input: number
  16051. output: number
  16052. interpolation?: 'STEP' | 'LINEAR' | 'CUBICSPLINE'
  16053. extras?: any
  16054. }
  16055. export interface GLTFSamplerLoaded {
  16056. input: GLTFAccessorLoaded
  16057. output: GLTFAccessorLoaded
  16058. interpolation: EnumGLTFSamplerInterpolation
  16059. sampleCount: number
  16060. extras?: any
  16061. }
  16062. export default class GLTFSamplerNode extends GLTFBaseNode {
  16063. get nodeName(): string
  16064. readonly raw: GLTFSamplerNodeRaw
  16065. build(): void
  16066. preload(
  16067. prerequisites: [accessors: GLTFAccessorsLoaded]
  16068. ): Promise<GLTFSamplerLoaded>
  16069. getLoadedResource(): GLTFSamplerLoaded
  16070. }
  16071. }
  16072. declare module 'XrFrame/loader/glTF/materials/texture/GLTFTextureTransformInfo' {
  16073. import Vector2 from 'XrFrame/math/vector2'
  16074. export interface ITransformInfo {
  16075. offset?: number[]
  16076. rotation?: number
  16077. scale?: number[]
  16078. }
  16079. export default class GLTFTextureTransformInfo {
  16080. offset: Vector2
  16081. rotation: number
  16082. scale: Vector2
  16083. get uvMatrixArray(): number[]
  16084. constructor(textureTransform: ITransformInfo)
  16085. /**
  16086. * 设置UV变化矩阵,列主序
  16087. *
  16088. * @param {number} tx x轴偏移
  16089. * @param {number} ty y轴偏移
  16090. * @param {number} sx x轴缩放
  16091. * @param {number} sy y轴缩放
  16092. * @param {number} rotation 旋转
  16093. */
  16094. setUvTransform(
  16095. tx: number,
  16096. ty: number,
  16097. sx: number,
  16098. sy: number,
  16099. rotation: number
  16100. ): void
  16101. /**
  16102. * 更新UV矩阵
  16103. *
  16104. * @memberof GLTFTextureTransformInfo
  16105. */
  16106. updateUVMatrixArray(): void
  16107. }
  16108. }
  16109. declare module 'XrFrame/core/utils' {
  16110. export function assert(pred: boolean, msg: string): void
  16111. export function decode(data: ArrayBuffer, format: 'utf-8' | 'gbk'): string
  16112. export function wxPromiseWrapper<T = any>(
  16113. executor: any,
  16114. args: any
  16115. ): Promise<T>
  16116. export class StreamReader {
  16117. constructor(buffer: ArrayBuffer, byteOffset?: number)
  16118. get size(): number
  16119. read<T>(type: StreamReader.Type): T
  16120. write<T>(type: StreamReader.Type, value: T): void
  16121. /**
  16122. * 跳过一个位置,以后再填写。
  16123. */
  16124. reserve<T>(type: StreamReader.Type): {
  16125. write(value: T): void
  16126. }
  16127. readChunk(length: number): ArrayBuffer
  16128. align(alignment: number): void
  16129. end(): boolean
  16130. pos(): number
  16131. }
  16132. export namespace StreamReader {
  16133. enum Type {
  16134. Float = 0,
  16135. UInt32 = 1,
  16136. UInt16 = 2
  16137. }
  16138. const TypeAlignment: {
  16139. 0: number
  16140. 1: number
  16141. 2: number
  16142. }
  16143. const TypeSize: {
  16144. 0: number
  16145. 1: number
  16146. 2: number
  16147. }
  16148. }
  16149. }