cc.d.ts 2.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078
  1. declare module "cc" {
  2. /**
  3. * @en
  4. * Predefined constants, see [[Macro]] for detailed contents.
  5. * @zh
  6. * 预定义常量,具体内容参考 [[Macro]] 文档。
  7. */
  8. export const macro: Macro;
  9. /**
  10. * @en
  11. * Predefined constants, see [[Macro]] for detailed contents.
  12. * @zh
  13. * 预定义常量,具体内容参考 [[Macro]] 文档。
  14. */
  15. /**
  16. * @en Interface declaration for predefined constants, for usage you should be importing [[macro]] directly.
  17. * @zh 预定义常量的接口声明,实际使用应该直接导入 [[macro]]。
  18. */
  19. export interface Macro {
  20. /**
  21. * @en
  22. * The image format supported by the engine, the actual supported formats may differ in different build platforms and device types.
  23. * Currently contains ['.astc', '.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png'].
  24. * @zh
  25. * 引擎默认支持的图片格式,实际运行时支持的格式可能在不同的构建平台和设备类型上有所差别。
  26. * 目前包含的格式有 ['.astc', '.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png']。
  27. */
  28. SUPPORT_TEXTURE_FORMATS: string[];
  29. /**
  30. * @en Key map for keyboard event
  31. * @zh 键盘事件的按键值。
  32. * @example {@link cocos/core/platform/CCCommon/KEY.js}
  33. * @deprecated since v3.3 please use [[KeyCode]] instead
  34. */
  35. KEY: typeof __private._cocos_core_platform_macro__KEY;
  36. /**
  37. * @en One angle in radian, equals to PI / 180
  38. * @zh 弧度制中的单位角度,等同于 PI / 180
  39. */
  40. RAD: number;
  41. /**
  42. * @en One radian in angle, equals to 180 / PI
  43. * @zh 角度制中的单位弧度,等同于 180 / PI
  44. */
  45. DEG: number;
  46. /**
  47. * @en A maximum value of number representing infinity repeat times
  48. * @zh 重复执行的最大值,实际取值为数字的最大值
  49. */
  50. REPEAT_FOREVER: number;
  51. /**
  52. * @en A float value for representing a minimum error in comparison
  53. * @zh 用于比较时可忽略的浮点误差值
  54. */
  55. FLT_EPSILON: number;
  56. /**
  57. * @en Oriented vertically
  58. * @zh 竖屏朝向
  59. */
  60. ORIENTATION_PORTRAIT: number;
  61. /**
  62. * @en Inverted portrait orientation, with the device bottom facing upward.
  63. * @zh 倒置竖屏,设备底部朝上
  64. */
  65. ORIENTATION_PORTRAIT_UPSIDE_DOWN: number;
  66. /**
  67. * @en Oriented horizontally. Users cannot directly listen to this value; they need to listen for ORIENTATION_LANDSCAPE_LEFT or ORIENTATION_LANDSCAPE_RIGHT.
  68. * @zh 横屏朝向, 外部不能直接监听该值,需要监听 ORIENTATION_LANDSCAPE_LEFT 或 ORIENTATION_LANDSCAPE_RIGHT
  69. */
  70. ORIENTATION_LANDSCAPE: number;
  71. /**
  72. * @en Oriented horizontally, top side facing to the left. Supported only on mobile devices.
  73. * @zh 水平方向,顶部朝向左侧;仅移动端支持
  74. */
  75. ORIENTATION_LANDSCAPE_LEFT: number;
  76. /**
  77. * @en Oriented horizontally, top side facing to the right. Supported only on mobile devices.
  78. * @zh 水平方向,顶部朝向右侧;仅移动端支持
  79. */
  80. ORIENTATION_LANDSCAPE_RIGHT: number;
  81. /**
  82. * @en Oriented automatically
  83. * @zh 自动适配朝向
  84. */
  85. ORIENTATION_AUTO: number;
  86. /**
  87. * @en
  88. * Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation,
  89. * then need to manually disable this, otherwise, the rendering will be wrong.
  90. * Currently not used in 3D engine
  91. * @zh
  92. * 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 的话,需要手动关闭,否则渲染会出错。
  93. * 在 3D 引擎中暂时无效。
  94. * @default true
  95. * @deprecated since v3.0
  96. */
  97. ENABLE_TILEDMAP_CULLING: boolean;
  98. /**
  99. * @en
  100. * The timeout to determine whether a touch is no longer active and should be removed.
  101. * The reason to add this timeout is due to an issue in X5 browser core,
  102. * when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  103. * no touch cancel event is triggered, and the touch will be considered active forever.
  104. * After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  105. * So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  106. * Though it might remove a real touch if it's just not moving for the last 5 seconds,
  107. * which is not easy with the sensibility of mobile touch screen.
  108. * You can modify this value to have a better behavior if you find it's not enough.
  109. * @zh
  110. * 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  111. * 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  112. * 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  113. * 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  114. * 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  115. * 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  116. * 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。
  117. * @default 5000
  118. */
  119. TOUCH_TIMEOUT: number;
  120. /**
  121. * @en
  122. * Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  123. * Though if you want to make your canvas background transparent and show other dom elements at the background,
  124. * you can set it to true before [[game.init]].
  125. * Web only.
  126. * @zh
  127. * 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  128. * 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 [[game.init]] 之前将这个值设为 true。
  129. * 仅支持 Web
  130. * @default false
  131. */
  132. ENABLE_TRANSPARENT_CANVAS: boolean;
  133. /**
  134. * @en
  135. * Boolean that indicates if the GL context is created with `antialias` option turned on, default value is false.
  136. * Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  137. * Whether to use this really depend on your game design and targeted platform,
  138. * device with retina display usually have good detail on graphics with or without this option,
  139. * you probably don't want antialias if your game style is pixel art based.
  140. * Also, it could have great performance impact with some browser / device using software MSAA.
  141. * You can set it to true before [[game.init]].
  142. * Only affect OpenGL ES and WebGL backend
  143. * @zh
  144. * 用于设置在创建 GL Context 时是否开启抗锯齿选项,默认值是 false。
  145. * 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  146. * 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  147. * 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  148. * 你可以在 [[game.init]] 之前设置这个值,否则它不会生效。
  149. * 仅影响 WebGL 后端
  150. * @default true
  151. */
  152. ENABLE_WEBGL_ANTIALIAS: boolean;
  153. /**
  154. * @en
  155. * Used to set float output render target, more accurate multiple light sources, fog, and translucent effects, custom pipeline only, the default value is false.
  156. * @zh
  157. * 用于开启浮点格式的RT输出, 更精确的多光源、雾化和半透明效果, 仅用于自定义管线, 默认值为 false。
  158. * @default false
  159. */
  160. ENABLE_FLOAT_OUTPUT: boolean;
  161. /**
  162. * @en
  163. * Whether to clear the original image cache after uploaded a texture to GPU.
  164. * If cleared, [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) will not be supported.
  165. * Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory.
  166. * But on Wechat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  167. * So we enabled this option by default on Wechat, so that we can release Image cache immediately after uploaded to GPU.
  168. * Currently not useful in 3D engine
  169. * @zh
  170. * 是否在将贴图上传至 GPU 之后删除原始图片缓存,删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
  171. * 在 Web 平台,你通常不需要开启这个选项,因为在 Web 平台 Image 对象所占用的内存很小。
  172. * 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  173. * 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。
  174. * 在 3D 引擎中暂时无效。
  175. * @default false
  176. */
  177. CLEANUP_IMAGE_CACHE: boolean;
  178. /**
  179. * @en
  180. * Whether to enable multi-touch.
  181. * @zh
  182. * 是否开启多点触摸
  183. * @default true
  184. */
  185. ENABLE_MULTI_TOUCH: boolean;
  186. /**
  187. * @en
  188. * The maximum size of the canvas pool used by Label, please adjust according to the number of label component in the same scene of the project
  189. * @zh
  190. * Label 使用的 canvas pool 的最大大小,请根据项目同场景的 label 数量进行调整
  191. * @default 20
  192. */
  193. MAX_LABEL_CANVAS_POOL_SIZE: number;
  194. /**
  195. * @en
  196. * Boolean that indicates if enable highp precision data in structure with fragment shader.
  197. * Enable this option will make the variables defined by the HIGHP_VALUE_STRUCT_DEFINE macro in the shader more accurate, such as position.
  198. * Enable this option can avoid some distorted lighting effects. That depends on whether your game has abnormal lighting effects on this platform.
  199. * There will be a slight performance loss if enable this option, but the impact is not significant.
  200. * Only affect WebGL backend
  201. * @zh
  202. * 用于设置是否在片元着色器中使用结构体的时候,允许其中的数据使用highp精度
  203. * 将这个选项设置为 true 会让shader中使用HIGHP_VALUE_STRUCT_DEFINE宏定义的变量精度更高,比如位置信息等,避免出现一些失真的光照效果。是否开启这个选项很大程度上取决于你的游戏在此平台上是否出现了异常的表现。
  204. * 开启后会有轻微的性能损失,但影响不大。
  205. * 仅影响 WebGL 后端
  206. * @default false
  207. */
  208. ENABLE_WEBGL_HIGHP_STRUCT_VALUES: boolean;
  209. /**
  210. * @zh Batcher2D 中内存增量的大小(KB)
  211. * 这个值决定了当场景中存在的 2d 渲染组件的顶点数量超过当前 batcher2D 中可容纳的顶点数量时,内存扩充的增加量
  212. * 这个值越大,共用同一个 meshBuffer 的 2d 渲染组件数量会更多,但每次扩充所占用的内存也会更大
  213. * 默认值在标准格式([[VertexFormat.vfmtPosUvColor]])下可容纳 4096 个顶点(4096*9*4/1024),你可以增加容量来提升每个批次可容纳的元素数量
  214. * @en The MeshBuffer chunk size in Batcher2D (KB)
  215. * This value determines the increase in memory expansion,
  216. * when the number of vertices of 2d rendering components present in the scene exceeds the number of vertices,
  217. * that can be accommodated in the current batcher2D.
  218. * The larger this value is, the more 2d rendering components will share the same meshBuffer, but the more memory will be used for each expansion
  219. * The default size can contain 4096 standard vertex ([[VertexFormat.vfmtPosUvColor]]) in one buffer,
  220. * you can user larger buffer size to increase the elements count per 2d draw batch.
  221. * @default 144 KB
  222. */
  223. BATCHER2D_MEM_INCREMENT: number;
  224. /**
  225. * @zh 自定义渲染管线的名字(实验性)
  226. * 引擎会根据名字创建对应的渲染管线(仅限Web平台)。如果名字为空,则不启用自定义渲染管线。
  227. * 目前仅支持'Forward', 'Deferred'两种。
  228. * @en The name of custom rendering pipeline (experimental)
  229. * Engine will use the name to create the custom pipeline (Web only). If the name is empty, custom pipeline will be disabled.
  230. * Currently only 'Forward' and 'Deferred' are supported.
  231. */
  232. CUSTOM_PIPELINE_NAME: string;
  233. /**
  234. * @internal
  235. */
  236. init(): void;
  237. }
  238. /**
  239. * @en JS Implementation of MurmurHash2. Original implementation is http://github.com/garycourt/murmurhash-js.
  240. * @zh MurmurHash2 的 JS 实现。原始实现是 http://github.com/garycourt/murmurhash-js 。
  241. * @param input @en ASCII string or a Uint8Array to be hashed. @zh 希望被哈希的 ASCII 字符串或者 Uint8Array.
  242. * @param seed @en Hash seed. Should be a positive integer. @zh 哈希种子。必须是个正整数。
  243. * @returns @en 32-bit positive integer hash. @zh 32位正整数哈希值。
  244. */
  245. export function murmurhash2_32_gc(input: string | Uint8Array, seed: number): number;
  246. export class ReflectionProbeManager {
  247. static probeManager: ReflectionProbeManager;
  248. /**
  249. * @en Set and get whether to detect objects leaving or entering the reflection probe's bounding box at runtime.
  250. * @zh 设置和获取是否在运行时检测物体离开或者进入反射探针的包围盒。
  251. */
  252. set updateForRuntime(val: boolean);
  253. get updateForRuntime(): boolean;
  254. /**
  255. * @en Refresh all reflection probe.
  256. * @zh 刷新所有反射探针。
  257. */
  258. onUpdateProbes(): void;
  259. /**
  260. * @en filter models that use planar reflection.
  261. * @zh 筛选使用平面反射的模型
  262. */
  263. filterModelsForPlanarReflection(): void;
  264. /**
  265. * @en Get all reflection probes in the scene.
  266. * @zh 获取场景中所有的反射探针
  267. */
  268. getProbes(): renderer.scene.ReflectionProbe[];
  269. /**
  270. * @en Get reflection probe by id.
  271. * @zh 根据id获取反射探针
  272. */
  273. getProbeById(probeId: number): renderer.scene.ReflectionProbe | null;
  274. /**
  275. * @en Update the cubemap captured by the reflection probe.
  276. * @zh 更新反射探针捕获的cubemap
  277. * @param probe update the texture for this probe
  278. */
  279. updateBakedCubemap(probe: renderer.scene.ReflectionProbe): void;
  280. /**
  281. * @en Update the plane reflection map for reflection probe render.
  282. * @zh 更新反射探针渲染的平面反射贴图
  283. * @param probe update the texture for this probe
  284. */
  285. updatePlanarMap(probe: renderer.scene.ReflectionProbe, texture: gfx.Texture | null): void;
  286. /**
  287. * @en Selecting the appropriate reflection probe for the model, it will use the closest one based on distance.
  288. * @zh 为模型选择适用的反射探针,会使用距离最近的。
  289. * @param model select for this model
  290. */
  291. selectReflectionProbe(model: renderer.scene.Model): void;
  292. /**
  293. * @en Update the preview sphere of the Reflection Probe cube mode.
  294. * @zh 更新反射探针cube模式的预览球
  295. */
  296. updatePreviewSphere(probe: renderer.scene.ReflectionProbe): void;
  297. /**
  298. * @en Update the preview plane of the Reflection Probe planar mode.
  299. * @zh 更新反射探针预览平面
  300. */
  301. updatePreviewPlane(probe: renderer.scene.ReflectionProbe): void;
  302. /**
  303. * @en Update reflection probe data of model bind.
  304. * @zh 更新模型绑定的反射探针数据。
  305. */
  306. updateProbeData(): void;
  307. /**
  308. * @en get max value of probe id.
  309. * @zh 获取反射探针id的最大值。
  310. */
  311. getMaxProbeId(): number;
  312. /**
  313. * @en Get the reflection probe used by the model.
  314. * @zh 获取模型使用的反射探针。
  315. */
  316. getUsedReflectionProbe(model: renderer.scene.Model, planarReflection: boolean): renderer.scene.ReflectionProbe | null | undefined;
  317. /**
  318. * @en Set reflection probe used by the model.
  319. * @zh 手动设置模型使用的反射探针。
  320. * @param model set the probe for this model
  321. * @param probe reflection probe to be set
  322. * @param blendProbe reflection probe for blend
  323. */
  324. setReflectionProbe(model: renderer.scene.Model, probe: renderer.scene.ReflectionProbe, blendProbe?: renderer.scene.ReflectionProbe | null): void;
  325. }
  326. /**
  327. * @en Mesh buffer used for 2d rendering, used internally and not of concern to the user.
  328. * @zh 2d 渲染使用的网格缓冲数据,内部使用,用户不须关心。
  329. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  330. */
  331. export class MeshBuffer {
  332. /**
  333. * @en The vertex attributes of the buffer.
  334. * @zh buffer 的顶点属性。
  335. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  336. */
  337. get attributes(): gfx.Attribute[];
  338. /**
  339. * @en Number of bytes in vertex format.
  340. * @zh 顶点格式的字节数。
  341. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  342. */
  343. get vertexFormatBytes(): number;
  344. protected _byteOffset: number;
  345. /**
  346. * @en byte offset.
  347. * @zh 字节偏移量。
  348. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  349. */
  350. get byteOffset(): number;
  351. set byteOffset(val: number);
  352. protected _vertexOffset: number;
  353. /**
  354. * @en Vertexes offset.
  355. * @zh 顶点数偏移。
  356. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  357. */
  358. get vertexOffset(): number;
  359. set vertexOffset(val: number);
  360. protected _indexOffset: number;
  361. /**
  362. * @en Indices offset.
  363. * @zh 索引偏移。
  364. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  365. */
  366. get indexOffset(): number;
  367. set indexOffset(val: number);
  368. protected _dirty: boolean;
  369. /**
  370. * @en Dirty flag.
  371. * @zh 脏标记。
  372. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  373. */
  374. get dirty(): boolean;
  375. set dirty(val: boolean);
  376. protected _floatsPerVertex: number;
  377. /**
  378. * @en Float numbers per vertex.
  379. * @zh 每顶点的浮点数长度。
  380. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  381. */
  382. get floatsPerVertex(): number;
  383. set floatsPerVertex(val: number);
  384. protected _vData: Float32Array;
  385. /**
  386. * @en Vertexes data.
  387. * @zh 顶点数据。
  388. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  389. */
  390. get vData(): Float32Array;
  391. set vData(val: Float32Array);
  392. protected _iData: Uint16Array;
  393. /**
  394. * @en Indices data.
  395. * @zh 索引数据。
  396. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  397. */
  398. get iData(): Uint16Array;
  399. set iData(val: Uint16Array);
  400. protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeUIMeshBuffer;
  401. /**
  402. * @en Native object.
  403. * @zh 原生对象。
  404. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  405. */
  406. get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeUIMeshBuffer;
  407. protected _sharedBuffer: Uint32Array;
  408. /**
  409. * @en Native shared buffer.
  410. * @zh 原生共享缓冲。
  411. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  412. */
  413. get sharedBuffer(): Uint32Array;
  414. /**
  415. * @en Initial native shared buffer.
  416. * @zh 初始化原生共享缓冲。
  417. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  418. */
  419. initSharedBuffer(): void;
  420. /**
  421. * @en Synchronized native shared buffer.
  422. * @zh 同步原生共享缓冲。
  423. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  424. */
  425. syncSharedBufferToNative(): void;
  426. constructor();
  427. /**
  428. * @en Initialize mesh buffer.
  429. * @zh 初始化对象。
  430. * @param device @en The GFX device. @zh GFX设备。
  431. * @param attrs @en The vertex attributes of the buffer. @zh 缓冲区的顶点属性。
  432. * @param vFloatCount @en The vertexes float count. @zh 每顶点所需的 float 数量。
  433. * @param iCount @en The indices count. @zh 索引数量。
  434. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  435. */
  436. initialize(device: gfx.Device, attrs: gfx.Attribute[], vFloatCount: number, iCount: number): void;
  437. /**
  438. * @en Reset state.
  439. * @zh 重置状态。
  440. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  441. */
  442. reset(): void;
  443. destroy(): void;
  444. /**
  445. * @en Set dirty flag.
  446. * @zh 设置脏标签。
  447. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  448. */
  449. setDirty(): void;
  450. /**
  451. * @deprecated since v3.4.0, please use BufferAccessor's request
  452. * @see [[BufferAccessor.request]]
  453. */
  454. request(vertexCount: number, indexCount: number): boolean;
  455. /**
  456. * @en require Free input assembler.
  457. * @zh 请求可用的输入汇集器。
  458. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  459. */
  460. requireFreeIA(device: gfx.Device): gfx.InputAssembler;
  461. /**
  462. * @en recycle input assembler.
  463. * @zh 回收输入汇集器。
  464. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  465. */
  466. recycleIA(ia: gfx.InputAssembler): void;
  467. /**
  468. * @en check capacity.
  469. * @zh 检查可分配余量。
  470. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  471. */
  472. checkCapacity(vertexCount: number, indexCount: number): boolean;
  473. /**
  474. * @en Upload and update buffers data.
  475. * @zh 上传更新缓冲内容。
  476. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  477. */
  478. uploadBuffers(): void;
  479. }
  480. /**
  481. * @en Stencil state manager.
  482. * @zh 模板状态管理器。
  483. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  484. */
  485. export class StencilManager {
  486. static sharedManager: StencilManager | null;
  487. /**
  488. * @en Stencil stage.
  489. * @zh 模板缓冲阶段。
  490. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  491. */
  492. get stage(): __private._cocos_2d_renderer_stencil_manager__Stage;
  493. set stage(val: __private._cocos_2d_renderer_stencil_manager__Stage);
  494. /**
  495. * @en Stencil pattern.
  496. * @zh 模板缓冲样式。
  497. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  498. */
  499. get pattern(): {
  500. stencilTest: boolean;
  501. func: gfx.ComparisonFunc;
  502. stencilMask: number;
  503. writeMask: number;
  504. failOp: gfx.StencilOp;
  505. zFailOp: gfx.StencilOp;
  506. passOp: gfx.StencilOp;
  507. ref: number;
  508. };
  509. /**
  510. * @en Add mask nesting.
  511. * @zh 添加mask嵌套。
  512. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  513. */
  514. pushMask(mask: any): void;
  515. /**
  516. * @en clear stencil stage.
  517. * @zh 清空模板状态。
  518. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  519. */
  520. clear(comp: UIRenderer | UIMeshRenderer): __private._cocos_2d_renderer_stencil_manager__Stage;
  521. /**
  522. * @en Open stencil stage to enabled.
  523. * @zh 开启模板状态。
  524. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  525. */
  526. enableMask(): void;
  527. /**
  528. * @en exit stencil.
  529. * @zh 退出模板状态。
  530. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  531. */
  532. exitMask(): void;
  533. /**
  534. * @en Get write mask count.
  535. * @zh 获取写入模板缓冲的位数。
  536. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  537. */
  538. getWriteMask(): number;
  539. /**
  540. * @en Get write mask count when exit.
  541. * @zh 获取退出时模板缓冲的位数。
  542. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  543. */
  544. getExitWriteMask(): number;
  545. /**
  546. * @en Get mask nesting count.
  547. * @zh 获取mask嵌套数量。
  548. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  549. */
  550. getMaskStackSize(): number;
  551. /**
  552. * @en Reset stencil stage.
  553. * @zh 重置模板状态。
  554. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  555. */
  556. reset(): void;
  557. destroy(): void;
  558. /**
  559. * @en Get stencil stage.
  560. * @zh 获取模板状态。
  561. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  562. */
  563. getStencilStage(stage: __private._cocos_2d_renderer_stencil_manager__Stage, mat?: Material): gfx.DepthStencilState;
  564. /**
  565. * @en Get stencil hash.
  566. * @zh 获取模板状态的哈希值。
  567. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  568. */
  569. getStencilHash(stage: __private._cocos_2d_renderer_stencil_manager__Stage): number;
  570. }
  571. export const spriteAssembler: IAssemblerManager;
  572. export const labelAssembler: IAssemblerManager;
  573. export const graphicsAssembler: IAssemblerManager;
  574. /**
  575. * @en
  576. * Class for sprite atlas handling.
  577. * @zh
  578. * 精灵图集资源类。
  579. */
  580. export class SpriteAtlas extends Asset {
  581. /**
  582. * @en All sprite frames in the sprite atlas.
  583. * @zh 精灵图集中的所有精灵。
  584. */
  585. spriteFrames: __private._cocos_2d_assets_sprite_atlas__ISpriteFrameList;
  586. /**
  587. * @en Get the [[Texture2D]] asset of the atlas.
  588. * @zh 获取精灵图集的贴图。
  589. * @returns @en The texture2d asset. @zh 二维贴图资源。
  590. */
  591. getTexture(): __private._cocos_asset_assets_texture_base__TextureBase | null;
  592. /**
  593. * @en Gets the [[SpriteFrame]] correspond to the given key in sprite atlas.
  594. * @zh 根据键值获取精灵。
  595. *
  596. * @param key @en The SpriteFrame name. @zh 精灵名字。
  597. * @returns @en The SpriteFrame asset. @zh 精灵资源。
  598. */
  599. getSpriteFrame(key: string): SpriteFrame | null;
  600. /**
  601. * @en Returns all sprite frames in the sprite atlas.
  602. * @zh 获取精灵图集所有精灵。
  603. * @returns @en All sprite frames. @zh 所有的精灵资源。
  604. */
  605. getSpriteFrames(): (SpriteFrame | null)[];
  606. /**
  607. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  608. */
  609. _serialize(ctxForExporting: any): any;
  610. /**
  611. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  612. */
  613. _deserialize(serializeData: any, handle: any): void;
  614. }
  615. /**
  616. * @en Class for TTFFont asset.
  617. * @zh TTF 字体资源类。
  618. */
  619. export class TTFFont extends Font {
  620. /**
  621. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  622. */
  623. _fontFamily: string | null;
  624. /**
  625. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  626. */
  627. get _nativeAsset(): string | null;
  628. set _nativeAsset(value: string | null);
  629. /**
  630. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  631. */
  632. get _nativeDep(): {
  633. uuid: string;
  634. __nativeName__: string;
  635. ext: string;
  636. __isNative__: boolean;
  637. };
  638. /**
  639. * @en default init.
  640. * @zh 默认初始化。
  641. * @param uuid @en Asset uuid. @zh 资源 uuid。
  642. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  643. */
  644. initDefault(uuid?: string): void;
  645. }
  646. /**
  647. * @en Class for LabelAtlas handling.
  648. * @zh 艺术数字字体资源类。
  649. *
  650. */
  651. export class LabelAtlas extends BitmapFont {
  652. }
  653. /**
  654. * @en Class for BitmapFont handling.
  655. * @zh 位图字体资源类。
  656. */
  657. export class BitmapFont extends Font {
  658. /**
  659. * @deprecated since v3.7.0, Useless Code.
  660. */
  661. fntDataStr: string;
  662. /**
  663. * @en [[SpriteFrame]] of the bitmap font.
  664. * @zh 位图字体所使用的精灵。
  665. */
  666. spriteFrame: SpriteFrame | null;
  667. /**
  668. * @en The font size.
  669. * @zh 文字尺寸。
  670. */
  671. fontSize: number;
  672. /**
  673. * @en Font configuration.
  674. * @zh 字体配置。
  675. */
  676. fntConfig: __private._cocos_2d_assets_bitmap_font__IConfig | null;
  677. /**
  678. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  679. */
  680. fontDefDictionary: __private._cocos_2d_assets_bitmap_font__FontAtlas;
  681. onLoaded(): void;
  682. }
  683. /**
  684. * @en Class for Font handling.
  685. * @zh 字体资源类。
  686. */
  687. export class Font extends Asset {
  688. }
  689. /**
  690. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  691. */
  692. export interface IUV {
  693. u: number;
  694. v: number;
  695. }
  696. /**
  697. * @en Information object interface for initialize a [[SpriteFrame]] asset.
  698. * @zh 用于初始化 [[SpriteFrame]] 资源的对象接口描述。
  699. */
  700. export interface ISpriteFrameInitInfo {
  701. /**
  702. * @en The texture of the sprite frame, could be `TextureBase`.
  703. * @zh 贴图对象资源,可以是 `TextureBase` 类型。
  704. */
  705. texture?: __private._cocos_asset_assets_texture_base__TextureBase;
  706. /**
  707. * @en The original size of the sprite frame.
  708. * @zh 精灵帧原始尺寸。
  709. */
  710. originalSize?: math.Size;
  711. /**
  712. * @en The rect of the sprite frame in atlas texture.
  713. * @zh 精灵帧裁切矩形。
  714. */
  715. rect?: math.Rect;
  716. /**
  717. * @en The offset of the sprite frame center from the original center of the original rect.
  718. * Sprite frame in an atlas texture could be trimmed for clipping the transparent pixels, so the trimmed rect is smaller than the original one,
  719. * the offset defines the distance from the original center to the trimmed center.
  720. * @zh 精灵帧偏移量。
  721. * 在图集中的精灵帧可能会被剔除透明像素以获得更高的空间利用李,剔除后的矩形尺寸比剪裁前更小,偏移量指的是从原始矩形的中心到剪裁后的矩形中心的距离。
  722. */
  723. offset?: math.Vec2;
  724. /**
  725. * @en Top side border for sliced 9 frame.
  726. * @zh 九宫格精灵帧的上边界。
  727. * @default 0
  728. */
  729. borderTop?: number;
  730. /**
  731. * @en Bottom side border for sliced 9 frame.
  732. * @zh 九宫格精灵帧的下边界。
  733. * @default 0
  734. */
  735. borderBottom?: number;
  736. /**
  737. * @en Left side border for sliced 9 frame.
  738. * @zh 九宫格精灵帧的左边界。
  739. * @default 0
  740. */
  741. borderLeft?: number;
  742. /**
  743. * @en Right side border for sliced 9 frame.
  744. * @zh 九宫格精灵帧的右边界。
  745. * @default 0
  746. */
  747. borderRight?: number;
  748. /**
  749. * @en Whether the content of sprite frame is rotated.
  750. * @zh 是否旋转。
  751. */
  752. isRotate?: boolean;
  753. /**
  754. * @en Whether the uv is flipped.
  755. * @zh 是否转置 UV。
  756. */
  757. isFlipUv?: boolean;
  758. }
  759. /**
  760. * @en
  761. * A `SpriteFrame` support several types.
  762. * 1. Rectangle sprite frame
  763. * 2. Sliced 9 sprite frame
  764. * 3. Mesh sprite frame
  765. * It mainly contains:<br/>
  766. * - texture: A `TextureBase` that will be used by render process.<br/>
  767. * - rectangle: A rectangle of the texture.
  768. * - Sliced 9 border insets: The distance of each side from the internal rect to the sprite frame rect.
  769. * - vertices: Vertex list for the mesh type sprite frame.
  770. * - uv: The quad uv.
  771. * - uvSliced: The sliced 9 uv.
  772. *
  773. * @zh
  774. * 精灵帧资源。
  775. * 一个 SpriteFrame 支持多种类型
  776. * 1. 矩形精灵帧
  777. * 2. 九宫格精灵帧
  778. * 3. 网格精灵帧
  779. * 它主要包含下列数据:<br/>
  780. * - 纹理:会被渲染流程使用的 `TextureBase` 资源。<br/>
  781. * - 矩形:在纹理中的矩形区域。
  782. * - 九宫格信息:九宫格的内部矩形四个边距离 SpriteFrame 外部矩形的距离。
  783. * - 网格信息:网格类型精灵帧的所有顶点列表。
  784. * - uv: 四边形 UV。
  785. * - uvSliced: 九宫格 UV。
  786. * 可通过 `SpriteFrame` 获取该组件。
  787. *
  788. * @example
  789. * ```ts
  790. * import { resources } from 'cc';
  791. * // First way to use a SpriteFrame
  792. * const url = "assets/PurpleMonster/icon/spriteFrame";
  793. * resources.load(url, (err, spriteFrame) => {
  794. * const node = new Node("New Sprite");
  795. * const sprite = node.addComponent(Sprite);
  796. * sprite.spriteFrame = spriteFrame;
  797. * node.parent = self.node;
  798. * });
  799. *
  800. * // Second way to use a SpriteFrame
  801. * const self = this;
  802. * const url = "test_assets/PurpleMonster";
  803. * resources.load(url, (err, imageAsset) => {
  804. * if(err){
  805. * return;
  806. * }
  807. *
  808. * const node = new Node("New Sprite");
  809. * const sprite = node.addComponent(Sprite);
  810. * const spriteFrame = new SpriteFrame();
  811. * const tex = imageAsset._texture;
  812. * spriteFrame.texture = tex;
  813. * sprite.spriteFrame = spriteFrame;
  814. * node.parent = self.node;
  815. * });
  816. *
  817. * // Third way to use a SpriteFrame
  818. * const self = this;
  819. * const cameraComp = this.getComponent(Camera);
  820. * const renderTexture = new RenderTexture();
  821. * renderTexture.reset({
  822. * width: 512,
  823. * height: 512,
  824. * depthStencilFormat: RenderTexture.DepthStencilFormat.DEPTH_24_STENCIL_8
  825. * });
  826. *
  827. * cameraComp.targetTexture = renderTexture;
  828. * const spriteFrame = new SpriteFrame();
  829. * spriteFrame.texture = renderTexture;
  830. * ```
  831. */
  832. export class SpriteFrame extends Asset {
  833. /**
  834. * @en Create a SpriteFrame object by an image asset or an native image asset.
  835. * @zh 通过 Image 资源或者平台相关 Image 对象创建一个 SpriteFrame 资源。
  836. * @param imageSourceOrImageAsset @en ImageAsset or ImageSource, ImageSource could be HTMLCanvasElement, HTMLImageElement, IMemoryImageSource.
  837. * @zh 图像资源或图像原始图像源,图像原始图像源支持 HTMLCanvasElement HTMLImageElement IMemoryImageSource 三种资源。
  838. * @returns @en SpriteFrame asset. @zh 精灵资源。
  839. */
  840. static createWithImage(imageSourceOrImageAsset: __private._cocos_asset_assets_image_asset__ImageSource | ImageAsset): SpriteFrame;
  841. /**
  842. * @en uv update event.
  843. * @zh uv 更新事件。
  844. */
  845. static EVENT_UV_UPDATED: string;
  846. static MeshType: typeof __private._cocos_2d_assets_sprite_frame__MeshType;
  847. /**
  848. * @en Top border distance of sliced 9 rect.
  849. * @zh 九宫格内部矩形顶部边框距离 SpriteFrame 矩形的距离。
  850. */
  851. get insetTop(): number;
  852. set insetTop(value: number);
  853. /**
  854. * @en Bottom border distance of sliced 9 rect.
  855. * @zh 九宫格内部矩形底部边框距离 SpriteFrame 矩形的距离。
  856. */
  857. get insetBottom(): number;
  858. set insetBottom(value: number);
  859. /**
  860. * @en Left border distance of sliced 9 rect.
  861. * @zh 九宫格内部矩形左边框距离 SpriteFrame 矩形的距离。
  862. */
  863. get insetLeft(): number;
  864. set insetLeft(value: number);
  865. /**
  866. * @en Right border distance of sliced 9 rect.
  867. * @zh 九宫格内部矩形右边框距离 SpriteFrame 矩形的距离。
  868. */
  869. get insetRight(): number;
  870. set insetRight(value: number);
  871. /**
  872. * @en Returns the rect of the sprite frame in the texture.
  873. * If it's an atlas texture, a transparent pixel area is proposed for the actual mapping of the current texture.
  874. * @zh 获取 SpriteFrame 的纹理矩形区域。
  875. * 如果是一个 atlas 的贴图,则为当前贴图的实际剔除透明像素区域。
  876. */
  877. get rect(): math.Rect;
  878. set rect(value: math.Rect);
  879. /**
  880. * @en The original size before trimmed.
  881. * @zh 修剪前的原始大小。
  882. */
  883. get originalSize(): math.Size;
  884. set originalSize(value: math.Size);
  885. /**
  886. * @en The offset of the sprite frame center.
  887. * Sprite frame in an atlas texture could be trimmed for clipping the transparent pixels, so the trimmed rect is smaller than the original one,
  888. * the offset defines the distance from the original center to the trimmed center.
  889. * @zh 精灵帧偏移量。
  890. * 在图集中的精灵帧可能会被剔除透明像素以获得更高的空间利用李,剔除后的矩形尺寸比剪裁前更小,偏移量指的是从原始矩形的中心到剪裁后的矩形中心的距离。
  891. */
  892. get offset(): math.Vec2;
  893. set offset(value: math.Vec2);
  894. /**
  895. * @en Whether the content of sprite frame is rotated.
  896. * @zh 是否旋转。
  897. */
  898. get rotated(): boolean;
  899. set rotated(rotated: boolean);
  900. /**
  901. * @en The texture of the sprite frame, could be `TextureBase`.
  902. * @zh 贴图对象资源,可以是 `TextureBase` 类型。
  903. */
  904. get texture(): __private._cocos_asset_assets_texture_base__TextureBase;
  905. set texture(value: __private._cocos_asset_assets_texture_base__TextureBase);
  906. /**
  907. * @en The uuid of the atlas asset, if exists.
  908. * @zh 图集资源的 uuid。
  909. */
  910. get atlasUuid(): string;
  911. set atlasUuid(value: string);
  912. /**
  913. * @en The pixel width of the sprite frame.
  914. * @zh 精灵帧的像素宽度。
  915. */
  916. get width(): number;
  917. /**
  918. * @en The pixel height of the sprite frame.
  919. * @zh 精灵帧的像素高度。
  920. */
  921. get height(): number;
  922. /**
  923. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  924. */
  925. set _textureSource(value: __private._cocos_asset_assets_texture_base__TextureBase);
  926. /**
  927. * @en Whether flip the uv in X direction.
  928. * @zh 沿 X 轴方向, 翻转 UV。
  929. */
  930. get flipUVX(): boolean;
  931. set flipUVX(value: boolean);
  932. /**
  933. * @en Whether flip the uv in Y direction.
  934. * @zh 沿 Y 轴方向, 翻转 UV。
  935. */
  936. get flipUVY(): boolean;
  937. set flipUVY(value: boolean);
  938. /**
  939. * @en Sets whether sprite can be packed into dynamic atlas.
  940. * @zh 设置精灵是否允许参与自动合图。
  941. */
  942. get packable(): boolean;
  943. set packable(value: boolean);
  944. /**
  945. * @en Original information before packed to dynamic atlas, includes texture, width, height. It's null before being packed to dynamic atlas.
  946. * @zh 精灵自动合图之前的原始 texture 和宽高信息。在参与自动合图之前此值为 null。
  947. */
  948. get original(): {
  949. _texture: __private._cocos_asset_assets_texture_base__TextureBase;
  950. _x: number;
  951. _y: number;
  952. } | null;
  953. /**
  954. * @en Number of pixels corresponding to unit size in world space (pixels per unit).
  955. * @zh 世界空间中的单位大小对应的像素数量(像素每单位)。
  956. */
  957. get pixelsToUnit(): number;
  958. /**
  959. * @en Local origin position when generating the mesh.
  960. * @zh 生成 mesh 时本地坐标原点位置。
  961. */
  962. get pivot(): math.Vec2;
  963. /**
  964. * @en mesh information, you should call the [[ensureMeshData]] function before using it.
  965. * @zh mesh 信息,你应该在使用它之前调用 [[ensureMeshData]] 函数来确保其可用。
  966. */
  967. get mesh(): Mesh | null;
  968. /**
  969. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  970. */
  971. get trimmedBorder(): math.Vec4;
  972. /**
  973. * @en Vertex list for the mesh type sprite frame.
  974. * @zh 网格类型精灵帧的所有顶点列表。
  975. */
  976. vertices: __private._cocos_2d_assets_sprite_frame__IVertices | null;
  977. /**
  978. * @en UV for quad vertices.
  979. * @zh 矩形的顶点 UV。
  980. */
  981. uv: number[];
  982. /**
  983. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  984. */
  985. unbiasUV: number[];
  986. /**
  987. * @en UV for sliced 9 vertices.
  988. * @zh 九宫格的顶点 UV。
  989. */
  990. uvSliced: IUV[];
  991. protected _rect: math.Rect;
  992. protected _trimmedBorder: math.Vec4;
  993. protected _offset: math.Vec2;
  994. protected _originalSize: math.Size;
  995. protected _rotated: boolean;
  996. protected _capInsets: number[];
  997. protected _atlasUuid: string;
  998. protected _texture: __private._cocos_asset_assets_texture_base__TextureBase;
  999. protected _isFlipUVY: boolean;
  1000. protected _isFlipUVX: boolean;
  1001. protected _original: {
  1002. _texture: __private._cocos_asset_assets_texture_base__TextureBase;
  1003. _x: number;
  1004. _y: number;
  1005. } | null;
  1006. protected _packable: boolean;
  1007. protected _pixelsToUnit: number;
  1008. protected _pivot: math.Vec2;
  1009. protected _meshType: __private._cocos_2d_assets_sprite_frame__MeshType;
  1010. protected _extrude: number;
  1011. protected _customOutLine: never[];
  1012. protected _mesh: Mesh | null;
  1013. protected _minPos: math.Vec3;
  1014. protected _maxPos: math.Vec3;
  1015. constructor();
  1016. /**
  1017. * @en
  1018. * Returns whether the texture have been loaded.
  1019. * @zh
  1020. * 返回是否已加载精灵帧。
  1021. *
  1022. * @deprecated since v3.3, Useless Code.
  1023. */
  1024. textureLoaded(): boolean;
  1025. /**
  1026. * @en
  1027. * Returns whether the sprite frame is rotated in the texture.
  1028. * @zh
  1029. * 获取 SpriteFrame 是否旋转。
  1030. * @deprecated since v1.2, please use [[rotated]] instead.
  1031. */
  1032. isRotated(): boolean;
  1033. /**
  1034. * @en
  1035. * Set whether the sprite frame is rotated in the texture.
  1036. * @zh
  1037. * 设置 SpriteFrame 是否旋转。
  1038. * @param rotated @en rotated. @zh 是否旋转。
  1039. * @deprecated since v1.2, please use [[rotated]] instead.
  1040. */
  1041. setRotated(rotated: boolean): void;
  1042. /**
  1043. * @en Returns the rect of the sprite frame in the texture.
  1044. * If it's an atlas texture, a transparent pixel area is proposed for the actual mapping of the current texture.
  1045. * @zh 获取 SpriteFrame 的纹理矩形区域。
  1046. * 如果是一个 atlas 的贴图,则为当前贴图的实际剔除透明像素区域。
  1047. * @param out @en The output rect. @zh 输出的矩形区域。
  1048. * @returns @en The rect. @zh 矩形区域。
  1049. * @deprecated since v1.2, please use [[rect]].
  1050. */
  1051. getRect(out?: math.Rect): math.Rect;
  1052. /**
  1053. * @en Sets the rect of the sprite frame in the texture.
  1054. * @zh 设置 SpriteFrame 的纹理矩形区域。
  1055. * @param rect @en The new rect. @zh 想要设置的 rect。
  1056. * @deprecated since v1.2, please use [[rect]].
  1057. */
  1058. setRect(rect: math.Rect): void;
  1059. /**
  1060. * @en Returns the original size before trimmed.
  1061. * @zh 获取修剪前的原始大小。
  1062. * @param out @en The output original size. @zh 输出的原始大小。
  1063. * @returns @en The original size. @zh 原始大小。
  1064. * @deprecated since v1.2, please use [[originalSize]].
  1065. */
  1066. getOriginalSize(out?: math.Size): math.Size;
  1067. /**
  1068. * @en Sets the original size before trimmed.
  1069. * @zh 设置修剪前的原始大小。
  1070. * @param size @en The new original size. @zh 新设置的原始大小。
  1071. * @deprecated since v1.2, please use [[originalSize]].
  1072. */
  1073. setOriginalSize(size: math.Size): void;
  1074. /**
  1075. * @en Gets the offset of the frame.
  1076. * @zh 获取偏移量。
  1077. * @param out @en The output offset object. @zh 输出的偏移量。
  1078. * @returns @en The offset object. @zh 偏移量。
  1079. * @deprecated since v1.2, please use [[offset]]
  1080. */
  1081. getOffset(out?: math.Vec2): math.Vec2;
  1082. /**
  1083. * @en Sets the offset of the frame.
  1084. * @zh 设置偏移量。
  1085. * @param offset @en The new offset. @zh 新设置的偏移量。
  1086. * @deprecated since v1.2, please use [[offset]]
  1087. */
  1088. setOffset(offset: math.Vec2): void;
  1089. /**
  1090. * @en Gets the related GFX [[gfx.Texture]] resource.
  1091. * @zh 获取渲染贴图的 GFX 资源。
  1092. * @returns @en Gfx Texture resource. @zh GFX 贴图资源。
  1093. */
  1094. getGFXTexture(): gfx.Texture | null;
  1095. /**
  1096. * @en Gets the GFX sampler of its texture.
  1097. * @zh 贴图资源的采样器。
  1098. * @returns @en The GFX sampler resource. @zh GFX贴图采样器。
  1099. */
  1100. getGFXSampler(): gfx.Sampler;
  1101. /**
  1102. * @en Gets the hash of its texture.
  1103. * @zh 贴图资源的哈希值。
  1104. * @returns @en Texture`s hash. @zh 贴图哈希值。
  1105. */
  1106. getHash(): number;
  1107. /**
  1108. * @en Gets the sampler hash of its texture.
  1109. * @zh 贴图资源的采样器哈希值。
  1110. * @returns @en Sampler`s hash. @zh 采样器哈希值。
  1111. */
  1112. getSamplerInfo(): Readonly<gfx.SamplerInfo>;
  1113. /**
  1114. * @en Resets the sprite frame data.
  1115. * @zh 重置 SpriteFrame 数据。
  1116. * @param info @en SpriteFrame initialization information. @zh SpriteFrame 初始化信息。
  1117. * @param clearData @en Clear Data before initialization. @zh 是否在初始化前清空原有数据。
  1118. */
  1119. reset(info?: ISpriteFrameInitInfo, clearData?: boolean): void;
  1120. /**
  1121. * @en Check whether the rect of the sprite frame is out of the texture boundary.
  1122. * @zh 判断精灵计算的矩形区域是否越界。
  1123. * @param texture @en Texture resources for sprite frame. @zh SpriteFrame 的贴图资源。
  1124. * @returns @en Out of the texture boundary or not. @zh 矩形区域是否越界。
  1125. */
  1126. checkRect(texture: __private._cocos_asset_assets_texture_base__TextureBase): boolean;
  1127. /**
  1128. * @en Make sure the mesh is available, you should call it before using the mesh.
  1129. * @zh 确保 mesh 可用,你应该在使用 mesh 之前调用它。
  1130. */
  1131. ensureMeshData(): void;
  1132. destroy(): boolean;
  1133. /**
  1134. * Calculate UV for sliced
  1135. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1136. */
  1137. _calculateSlicedUV(): void;
  1138. /**
  1139. * Calculate UV
  1140. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1141. */
  1142. _calculateUV(): void;
  1143. /**
  1144. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1145. */
  1146. _setDynamicAtlasFrame(frame: any): void;
  1147. /**
  1148. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1149. */
  1150. _resetDynamicAtlasFrame(): void;
  1151. /**
  1152. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1153. */
  1154. _checkPackable(): void;
  1155. /**
  1156. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1157. */
  1158. _serialize(ctxForExporting: any): any;
  1159. /**
  1160. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1161. */
  1162. _deserialize(serializeData: any, handle: any): void;
  1163. /**
  1164. * @en clone a sprite frame.
  1165. * @zh 克隆当前 sprite frame。
  1166. */
  1167. clone(): SpriteFrame;
  1168. protected _refreshTexture(texture: __private._cocos_asset_assets_texture_base__TextureBase): void;
  1169. /**
  1170. * @en complete loading callback.
  1171. * @zh 加载完成回调。
  1172. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  1173. */
  1174. onLoaded(): void;
  1175. /**
  1176. * @en default init.
  1177. * @zh 默认初始化。
  1178. * @param uuid @en Asset uuid. @zh 资源 uuid。
  1179. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  1180. */
  1181. initDefault(uuid?: string): void;
  1182. /**
  1183. * @en Check whether the sprite frame is validate.
  1184. * @zh 检查当前 sprite frame 对象是否是有效的。
  1185. * @returns @en validate or not. @zh 是否有效。
  1186. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  1187. */
  1188. validate(): boolean;
  1189. protected _initVertices(): void;
  1190. protected _updateMeshVertices(): void;
  1191. protected _createMesh(): void;
  1192. protected _updateMesh(): void;
  1193. }
  1194. /**
  1195. * @en
  1196. * The root node of UI.
  1197. * Provide an aligned window for all child nodes, also provides ease of setting screen adaptation policy interfaces from the editor.
  1198. * Line-of-sight range is -999 to 1000.
  1199. *
  1200. * @zh
  1201. * 作为 UI 根节点,为所有子节点提供对齐视窗,另外提供屏幕适配策略接口,方便从编辑器设置。
  1202. * 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。
  1203. * UI 的视距范围是 -999 ~ 1000.
  1204. */
  1205. export class Canvas extends RenderRoot2D {
  1206. /**
  1207. * @en
  1208. * The render mode of Canvas.
  1209. * When you choose the mode of INTERSPERSE, You can specify the rendering order of the Canvas with the camera in the scene.
  1210. * When you choose the mode of OVERLAY, the builtin camera of Canvas will render after all scene cameras are rendered.
  1211. * NOTE: The cameras in the scene (including the Canvas built-in camera) must have a ClearFlag selection of SOLID_COLOR,
  1212. * otherwise a splash screen may appear on the mobile device.
  1213. *
  1214. * @zh
  1215. * Canvas 渲染模式。
  1216. * intersperse 下可以指定 Canvas 与场景中的相机的渲染顺序,overlay 下 Canvas 会在所有场景相机渲染完成后渲染。
  1217. * 注意:场景里的相机(包括 Canvas 内置的相机)必须有一个的 ClearFlag 选择 SOLID_COLOR,否则在移动端可能会出现闪屏。
  1218. *
  1219. * @deprecated since v3.0, please use [[Camera.priority]] to control overlapping between cameras.
  1220. */
  1221. get renderMode(): number;
  1222. set renderMode(val: number);
  1223. /**
  1224. * @en The camera component that will be aligned with this canvas
  1225. * @zh 将与此 canvas 对齐的相机组件
  1226. */
  1227. get cameraComponent(): Camera | null;
  1228. set cameraComponent(value: Camera | null);
  1229. /**
  1230. * @en Align canvas with screen
  1231. * @zh 是否使用屏幕对齐画布
  1232. */
  1233. get alignCanvasWithScreen(): boolean;
  1234. set alignCanvasWithScreen(value: boolean);
  1235. protected _cameraComponent: Camera | null;
  1236. protected _alignCanvasWithScreen: boolean;
  1237. protected _thisOnCameraResized: () => void;
  1238. protected fitDesignResolution_EDITOR: (() => void) | undefined;
  1239. constructor();
  1240. __preload(): void;
  1241. onEnable(): void;
  1242. onDisable(): void;
  1243. onDestroy(): void;
  1244. protected _onResizeCamera(): void;
  1245. }
  1246. /**
  1247. * @en Legacy 2D base class for rendering component, please use [[UIRenderer]] instead.
  1248. * This component will setup NodeUIProperties.uiComp in its owner [[Node]].
  1249. * @zh 旧的 2D 渲染组件基类,请使用 [[UIRenderer]] 替代。
  1250. * 这个组件会设置 [[Node]] 上的 NodeUIProperties.uiComp。
  1251. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1252. */
  1253. export class UIComponent extends Component {
  1254. protected _lastParent: Node | null;
  1255. __preload(): void;
  1256. onEnable(): void;
  1257. onDisable(): void;
  1258. onDestroy(): void;
  1259. /**
  1260. * @en Post render data submission procedure, it's executed after assembler updated for all children.
  1261. * It may assemble some extra render data to the geometry buffers, or it may only change some render states.
  1262. * Don't call it unless you know what you are doing.
  1263. * @zh 后置渲染数据组装程序,它会在所有子节点的渲染数据组装完成后被调用。
  1264. * 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
  1265. * 注意:不要手动调用该函数,除非你理解整个流程。
  1266. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1267. */
  1268. postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  1269. /**
  1270. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1271. */
  1272. markForUpdateRenderData(enable?: boolean): void;
  1273. /**
  1274. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1275. */
  1276. stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
  1277. /**
  1278. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1279. */
  1280. setNodeDirty(): void;
  1281. /**
  1282. * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
  1283. */
  1284. setTextureDirty(): void;
  1285. }
  1286. /**
  1287. * @en
  1288. * The shader property type of the material after instantiation.
  1289. *
  1290. * @zh
  1291. * 实例后的材质的着色器属性类型。
  1292. */
  1293. export enum InstanceMaterialType {
  1294. /**
  1295. * @en
  1296. * The shader only has color properties.
  1297. *
  1298. * @zh
  1299. * 着色器只带颜色属性。
  1300. */
  1301. ADD_COLOR = 0,
  1302. /**
  1303. * @en
  1304. * The shader has color and texture properties.
  1305. *
  1306. * @zh
  1307. * 着色器带颜色和贴图属性。
  1308. */
  1309. ADD_COLOR_AND_TEXTURE = 1,
  1310. /**
  1311. * @en
  1312. * The shader has color and texture properties and uses grayscale mode.
  1313. *
  1314. * @zh
  1315. * 着色器带颜色和贴图属性,并使用灰度模式。
  1316. */
  1317. GRAYSCALE = 2,
  1318. /**
  1319. * @en
  1320. * The shader has color and texture properties and uses embedded alpha mode.
  1321. *
  1322. * @zh
  1323. * 着色器带颜色和贴图属性,并使用透明通道分离贴图。
  1324. */
  1325. USE_ALPHA_SEPARATED = 3,
  1326. /**
  1327. * @en
  1328. * The shader has color and texture properties and uses embedded alpha and grayscale mode.
  1329. *
  1330. * @zh
  1331. * 着色器带颜色和贴图属性,并使用灰度模式。
  1332. */
  1333. USE_ALPHA_SEPARATED_AND_GRAY = 4
  1334. }
  1335. /**
  1336. * @en Base class for UI components which supports rendering features.
  1337. * This component will setup NodeUIProperties.uiComp in its owner [[Node]]
  1338. *
  1339. * @zh 所有支持渲染的 UI 组件的基类。
  1340. * 这个组件会设置 [[Node]] 上的 NodeUIProperties.uiComp。
  1341. */
  1342. export class UIRenderer extends Renderer {
  1343. /**
  1344. * @en The blend factor enums
  1345. * @zh 混合模式枚举类型
  1346. * @see [[gfx.BlendFactor]]
  1347. * @internal
  1348. */
  1349. static BlendState: typeof gfx.BlendFactor;
  1350. /**
  1351. * @en The render data assembler
  1352. * @zh 渲染数据组装器
  1353. * @internal
  1354. */
  1355. static Assembler: IAssemblerManager;
  1356. /**
  1357. * @en The post render data assembler
  1358. * @zh 后置渲染数据组装器
  1359. * @internal
  1360. */
  1361. static PostAssembler: IAssemblerManager | null;
  1362. constructor();
  1363. get sharedMaterials(): (Material | null)[];
  1364. set sharedMaterials(val: (Material | null)[]);
  1365. /**
  1366. * @en The customMaterial
  1367. * @zh 用户自定材质
  1368. */
  1369. get customMaterial(): Material | null;
  1370. set customMaterial(val: Material | null);
  1371. /**
  1372. * @en Main color for rendering, it normally multiplies with texture color.
  1373. * @zh 渲染颜色,一般情况下会和贴图颜色相乘。
  1374. */
  1375. get color(): Readonly<math.Color>;
  1376. set color(value: Readonly<math.Color>);
  1377. protected _renderData: RenderData | null;
  1378. /**
  1379. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1380. */
  1381. get renderData(): RenderData | null;
  1382. /**
  1383. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1384. */
  1385. get useVertexOpacity(): boolean;
  1386. /**
  1387. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1388. * @en The component stencil stage (please do not any modification directly on this object)
  1389. * @zh 组件模板缓冲状态 (注意:请不要直接修改它的值)
  1390. */
  1391. get stencilStage(): __private._cocos_2d_renderer_stencil_manager__Stage;
  1392. set stencilStage(val: __private._cocos_2d_renderer_stencil_manager__Stage);
  1393. protected _materials: (Material | null)[];
  1394. protected _customMaterial: Material | null;
  1395. protected _srcBlendFactor: gfx.BlendFactor;
  1396. protected _dstBlendFactor: gfx.BlendFactor;
  1397. protected _color: math.Color;
  1398. protected _stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
  1399. protected _assembler: IAssembler | null;
  1400. protected _postAssembler: IAssembler | null;
  1401. protected _renderDataFlag: boolean;
  1402. protected _renderFlag: boolean;
  1403. protected _renderEntity: __private._cocos_2d_renderer_render_entity__RenderEntity;
  1404. protected _instanceMaterialType: number;
  1405. protected _srcBlendFactorCache: gfx.BlendFactor;
  1406. protected _dstBlendFactorCache: gfx.BlendFactor;
  1407. /**
  1408. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1409. */
  1410. _dirtyVersion: number;
  1411. /**
  1412. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1413. */
  1414. _internalId: number;
  1415. /**
  1416. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1417. */
  1418. get batcher(): UI;
  1419. /**
  1420. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1421. */
  1422. get renderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  1423. /**
  1424. * @en Marks for calculating opacity per vertex
  1425. * @zh 标记组件是否逐顶点计算透明度
  1426. */
  1427. protected _useVertexOpacity: boolean;
  1428. protected _lastParent: Node | null;
  1429. onLoad(): void;
  1430. __preload(): void;
  1431. onEnable(): void;
  1432. onRestore(): void;
  1433. onDisable(): void;
  1434. onDestroy(): void;
  1435. /**
  1436. * @en Marks the render data of the current component as modified so that the render data is recalculated.
  1437. * @zh 标记当前组件的渲染数据为已修改状态,这样渲染数据才会重新计算。
  1438. * @param enable Marked necessary to update or not
  1439. */
  1440. markForUpdateRenderData(enable?: boolean): void;
  1441. /**
  1442. * @en Request new render data object.
  1443. * @zh 请求新的渲染数据对象。
  1444. * @return @en The new render data. @zh 新的渲染数据。
  1445. */
  1446. requestRenderData(drawInfoType?: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType): RenderData;
  1447. /**
  1448. * @en Destroy current render data.
  1449. * @zh 销毁当前渲染数据。
  1450. */
  1451. destroyRenderData(): void;
  1452. /**
  1453. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1454. */
  1455. updateRenderer(): void;
  1456. /**
  1457. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1458. */
  1459. fillBuffers(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  1460. /**
  1461. * @en Post render data submission procedure, it's executed after assembler updated for all children.
  1462. * It may assemble some extra render data to the geometry buffers, or it may only change some render states.
  1463. * Don't call it unless you know what you are doing.
  1464. * @zh 后置渲染数据组装程序,它会在所有子节点的渲染数据组装完成后被调用。
  1465. * 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
  1466. * 注意:不要手动调用该函数,除非你理解整个流程。
  1467. */
  1468. postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  1469. protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  1470. protected _postRender(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  1471. protected _canRender(): boolean;
  1472. protected _postCanRender(): void;
  1473. protected _updateColor(): void;
  1474. /**
  1475. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1476. */
  1477. static setEntityColorDirtyRecursively(node: Node, dirty: boolean): void;
  1478. /**
  1479. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1480. */
  1481. setEntityColor(color: math.Color): void;
  1482. /**
  1483. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1484. */
  1485. setEntityOpacity(opacity: number): void;
  1486. /**
  1487. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1488. */
  1489. setEntityEnabled(enabled: boolean): void;
  1490. /**
  1491. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  1492. */
  1493. _updateBlendFunc(): void;
  1494. protected _nodeStateChange(transformType: TransformBit): void;
  1495. protected _colorDirty(): void;
  1496. protected _onMaterialModified(idx: number, material: Material | null): void;
  1497. protected _updateBuiltinMaterial(): Material;
  1498. protected _flushAssembler?(): void;
  1499. /**
  1500. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1501. */
  1502. setNodeDirty(): void;
  1503. /**
  1504. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  1505. */
  1506. setTextureDirty(): void;
  1507. protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  1508. }
  1509. /**
  1510. * @en
  1511. * The component of transform in UI.
  1512. *
  1513. * @zh
  1514. * UI 变换组件。
  1515. */
  1516. export class UITransform extends Component {
  1517. /**
  1518. * @en
  1519. * Size of the UI node.
  1520. *
  1521. * @zh
  1522. * 内容尺寸。
  1523. */
  1524. get contentSize(): Readonly<math.Size>;
  1525. set contentSize(value: Readonly<math.Size>);
  1526. /**
  1527. * @en
  1528. * component width.
  1529. * @zh
  1530. * 组件宽度。
  1531. */
  1532. get width(): number;
  1533. set width(value: number);
  1534. /**
  1535. * @en
  1536. * component height.
  1537. * @zh
  1538. * 组件高度。
  1539. */
  1540. get height(): number;
  1541. set height(value: number);
  1542. /**
  1543. * @en
  1544. * Anchor point of the UI node.
  1545. *
  1546. * @zh
  1547. * 锚点位置。
  1548. */
  1549. get anchorPoint(): Readonly<math.Vec2>;
  1550. set anchorPoint(value: Readonly<math.Vec2>);
  1551. /**
  1552. * @en
  1553. * The x-axis anchor of the node.
  1554. *
  1555. * @zh
  1556. * 锚点位置的 X 坐标。
  1557. */
  1558. get anchorX(): number;
  1559. set anchorX(value: number);
  1560. /**
  1561. * @en
  1562. * The y-axis anchor of the node.
  1563. *
  1564. * @zh
  1565. * 锚点位置的 Y 坐标。
  1566. */
  1567. get anchorY(): number;
  1568. set anchorY(value: number);
  1569. /**
  1570. * @en
  1571. * Render sequence.
  1572. * Note: UI rendering is only about priority.
  1573. *
  1574. * @zh
  1575. * 渲染先后顺序,按照广度渲染排列,按同级节点下进行一次排列。
  1576. * @deprecated Since v3.1
  1577. */
  1578. get priority(): number;
  1579. set priority(value: number);
  1580. protected _priority: number;
  1581. /**
  1582. * @en Get the visibility bit-mask of the rendering camera
  1583. * @zh 查找被渲染相机的可见性掩码。
  1584. * @deprecated since v3.0
  1585. */
  1586. get visibility(): number;
  1587. /**
  1588. * @en Get the priority of the rendering camera
  1589. * @zh 查找被渲染相机的渲染优先级。
  1590. */
  1591. get cameraPriority(): number;
  1592. static EventType: typeof NodeEventType;
  1593. protected _contentSize: math.Size;
  1594. protected _anchorPoint: math.Vec2;
  1595. __preload(): void;
  1596. onLoad(): void;
  1597. onEnable(): void;
  1598. onDisable(): void;
  1599. onDestroy(): void;
  1600. /**
  1601. * @en
  1602. * Sets the untransformed size of the ui transform.<br/>
  1603. * The contentSize remains the same no matter if the node is scaled or rotated.<br/>
  1604. * @zh
  1605. * 设置节点 UI Transform 的原始大小,不受该节点是否被缩放或者旋转的影响。
  1606. *
  1607. * @param size @en The size of the UI transform. @zh UI Transform 的 Size 大小。
  1608. * @example
  1609. * ```ts
  1610. * import { Size } from 'cc';
  1611. * node.setContentSize(new Size(100, 100));
  1612. * ```
  1613. */
  1614. setContentSize(size: math.Size): void;
  1615. /**
  1616. * @en
  1617. * Sets the untransformed size of the ui transform.<br/>
  1618. * The contentSize remains the same no matter if the node is scaled or rotated.<br/>
  1619. * @zh
  1620. * 设置节点 UI Transform 的原始大小,不受该节点是否被缩放或者旋转的影响。
  1621. *
  1622. * @param width @en The width of the UI transform. @zh UI Transform 的宽。
  1623. * @param height @en The height of the UI transform. @zh UI Transform 的高。
  1624. * @example
  1625. * ```ts
  1626. * import { Size } from 'cc';
  1627. * node.setContentSize(100, 100);
  1628. * ```
  1629. */
  1630. setContentSize(width: number, height: number): void;
  1631. /**
  1632. * @en
  1633. * Sets the anchor point in percent. <br/>
  1634. * anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  1635. * It's like a pin in the node where it is "attached" to its parent. <br/>
  1636. * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  1637. * But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  1638. * The default anchor point is (0.5,0.5), so it starts at the center of the node.
  1639. *
  1640. * @zh
  1641. * 设置锚点的百分比。<br>
  1642. * 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br>
  1643. * 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br>
  1644. * 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br>
  1645. * 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br>
  1646. * 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  1647. *
  1648. * @param point @en Node anchor point or node x-axis anchor.
  1649. * @zh 节点锚点或节点 x 轴锚。
  1650. * @param y @en The y-axis anchor of the node.
  1651. * @zh 节点 y 轴锚。
  1652. * @example
  1653. * ```ts
  1654. * import { Vec2 } from 'cc';
  1655. * node.setAnchorPoint(new Vec2(1, 1));
  1656. * node.setAnchorPoint(1, 1);
  1657. * ```
  1658. */
  1659. setAnchorPoint(point: math.Vec2 | Readonly<math.Vec2> | number, y?: number): void;
  1660. /**
  1661. * @zh UI 空间中的点击测试。
  1662. * @en Hit test with point in UI Space.
  1663. *
  1664. * @param uiPoint point in UI Space.
  1665. * @deprecated since v3.5.0, please use `uiTransform.hitTest(screenPoint: Vec2)` instead.
  1666. */
  1667. isHit(uiPoint: math.Vec2): boolean;
  1668. /**
  1669. * @zh 屏幕空间中的点击测试。
  1670. * @en Hit test with point in Screen Space.
  1671. *
  1672. * @param screenPoint @en point in Screen Space. @zh 屏幕坐标中的点。
  1673. */
  1674. hitTest(screenPoint: math.Vec2, windowId?: number): boolean;
  1675. /**
  1676. * @en
  1677. * Converts a Point to node (local) space coordinates.
  1678. *
  1679. * @zh
  1680. * 将一个 UI 节点世界坐标系下点转换到另一个 UI 节点 (局部) 空间坐标系,这个坐标系以锚点为原点。
  1681. * 非 UI 节点转换到 UI 节点(局部) 空间坐标系,请走 Camera 的 `convertToUINode`。
  1682. *
  1683. * @param worldPoint @en Point in world space.
  1684. * @zh 世界坐标点。
  1685. * @param out @en Point in local space.
  1686. * @zh 转换后坐标。
  1687. * @returns @en Return the relative position to the target node.
  1688. * @zh 返回与目标节点的相对位置。
  1689. * @example
  1690. * ```ts
  1691. * const newVec3 = uiTransform.convertToNodeSpaceAR(cc.v3(100, 100, 0));
  1692. * ```
  1693. */
  1694. convertToNodeSpaceAR(worldPoint: math.Vec3, out?: math.Vec3): math.Vec3;
  1695. /**
  1696. * @en
  1697. * Converts a Point in node coordinates to world space coordinates.
  1698. *
  1699. * @zh
  1700. * 将距当前节点坐标系下的一个点转换到世界坐标系。
  1701. *
  1702. * @param nodePoint @en Point in local space.
  1703. * @zh 节点坐标。
  1704. * @param out @en Point in world space.
  1705. * @zh 转换后坐标。
  1706. * @returns @en Returns the coordinates in the UI world coordinate system.
  1707. * @zh 返回 UI 世界坐标系。
  1708. * @example
  1709. * ```ts
  1710. * const newVec3 = uiTransform.convertToWorldSpaceAR(3(100, 100, 0));
  1711. * ```
  1712. */
  1713. convertToWorldSpaceAR(nodePoint: math.Vec3, out?: math.Vec3): math.Vec3;
  1714. /**
  1715. * @en
  1716. * Returns an axis aligned bounding box of this node in local space coordinate.
  1717. * The returned box is relative only to its parent, and it doesn't contain any child nodes.
  1718. * The behavior is slightly different with [[getBoundingBoxToWorld]] and [[getBoundingBoxTo]].
  1719. *
  1720. * @zh
  1721. * 返回父节坐标系下的轴向对齐的包围盒。
  1722. * 返回的包围盒仅仅只包含当前节点的轴向对齐包围盒,不包含子节点。
  1723. * 这个 API 的行为和 [[getBoundingBoxToWorld]] 和 [[getBoundingBoxTo]] 略有不同。
  1724. *
  1725. * @returns @en An axis aligned bounding box of this node in local space coordinate. @zh 本地坐标系下的包围盒。
  1726. * @example
  1727. * ```ts
  1728. * const boundingBox = uiTransform.getBoundingBox();
  1729. * ```
  1730. */
  1731. getBoundingBox(): math.Rect;
  1732. /**
  1733. * @en
  1734. * Returns an axis aligned bounding box of this node in world space coordinate.
  1735. * The bounding box contains self and active children's world bounding box, and it will eliminate all zero sized nodes.
  1736. * @zh
  1737. * 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。
  1738. * 该边框包含自身和已激活的子节点的世界边框,但会剔除所有零大小的节点。
  1739. * @returns @en An axis aligned bounding box of this node in world space coordinate. @zh 世界坐标系下包围盒。
  1740. * @example
  1741. * ```ts
  1742. * const newRect = uiTransform.getBoundingBoxToWorld();
  1743. * ```
  1744. */
  1745. getBoundingBoxToWorld(): math.Rect;
  1746. /**
  1747. * @en
  1748. * Returns the minimum bounding box in the coordinate system of the target node.
  1749. * The result contains the current node and its child node tree, and it will eliminates all zero size nodes.
  1750. * E.g. passing an identical matrix will return the world bounding box of the current node tree.
  1751. * @zh
  1752. * 返回在目标节点坐标系下包含当前包围盒及其子节点包围盒的最小总包围盒,但会剔除所有零大小的节点。
  1753. * 如果传入单位矩阵,将得到世界坐标系下的包围盒。
  1754. *
  1755. * @param targetMat @en The target node's world matrix representing its coordinate system.
  1756. * @zh 表示目标节点坐标系的世界矩阵。
  1757. * @returns @en The minimum bounding box containing the current bounding box and its child nodes.
  1758. * @zh 包含当前节点包围盒及其子节点包围盒的最小包围盒。
  1759. */
  1760. getBoundingBoxTo(targetMat: math.Mat4): math.Rect;
  1761. /**
  1762. * @en
  1763. * Compute the corresponding aabb in world space for raycast.
  1764. * @zh
  1765. * 计算出此 UI_2D 节点在世界空间下的 aabb 包围盒。
  1766. * @param out @en The out object of aabb bounding box of the node in world space. @zh 输出节点在世界空间下的 aabb 包围盒。
  1767. * @returns @en The aabb bounding box of the node in world space. @zh 节点在世界空间下的 aabb 包围盒。
  1768. */
  1769. getComputeAABB(out?: geometry.AABB): geometry.AABB;
  1770. protected _selfBoundingBox(out: math.Rect): math.Rect;
  1771. protected _parentChanged(node: Node): void;
  1772. }
  1773. /**
  1774. * @en The entry node for 2D object data collection, all 2D rendering objects need to be rendered under the RenderRoot node.
  1775. * @zh 2D 对象数据收集的入口节点,所有的 2D渲染对象需在 RenderRoot 节点下才可以被渲染。
  1776. */
  1777. export class RenderRoot2D extends Component {
  1778. onEnable(): void;
  1779. onDisable(): void;
  1780. onDestroy(): void;
  1781. }
  1782. /**
  1783. * @en 2D rendering component that provides the ability to render sprite in 3D space.
  1784. * @zh 2D 渲染基础组件,提供精灵渲染在 3D 空间中的能力。
  1785. */
  1786. export class SpriteRenderer extends ModelRenderer {
  1787. /**
  1788. * @en The spriteFrame that the component should render.
  1789. * @zh 该组件应渲染的 spriteFrame。
  1790. */
  1791. get spriteFrame(): SpriteFrame | null;
  1792. set spriteFrame(value: SpriteFrame | null);
  1793. /**
  1794. * @en Rendering model of the component.
  1795. * @zh 该组件的渲染模型。
  1796. */
  1797. get model(): renderer.scene.Model | null;
  1798. protected _spriteFrame: SpriteFrame | null;
  1799. protected _mode: __private._cocos_2d_framework_sprite_renderer__SpriteMode;
  1800. protected _color: math.Color;
  1801. protected _flipX: boolean;
  1802. protected _flipY: boolean;
  1803. protected _size: math.Vec2;
  1804. onLoad(): void;
  1805. onRestore(): void;
  1806. onEnable(): void;
  1807. onDisable(): void;
  1808. onDestroy(): void;
  1809. protected _updateModels(): void;
  1810. protected _createModel(): void;
  1811. protected _updateModelParams(): void;
  1812. protected _getBuiltinMaterial(): Material;
  1813. protected _onMaterialModified(idx: number, material: Material | null): void;
  1814. protected _onUpdateLocalDescriptorSet(): void;
  1815. protected _attachToScene(): void;
  1816. }
  1817. /**
  1818. * @en
  1819. * The Mask Component.
  1820. *
  1821. * @zh
  1822. * 遮罩组件。
  1823. */
  1824. export class Mask extends Component {
  1825. /**
  1826. * @en The type for mask.
  1827. *
  1828. * @zh 遮罩组件类型。
  1829. */
  1830. static Type: typeof __private._cocos_2d_components_mask__MaskType;
  1831. /**
  1832. * @en
  1833. * The mask type.
  1834. *
  1835. * @zh
  1836. * 遮罩类型。
  1837. */
  1838. get type(): __private._cocos_2d_components_mask__MaskType;
  1839. set type(value: __private._cocos_2d_components_mask__MaskType);
  1840. /**
  1841. * @en
  1842. * Reverse mask.
  1843. * @zh
  1844. * 反向遮罩。
  1845. */
  1846. get inverted(): boolean;
  1847. set inverted(value: boolean);
  1848. /**
  1849. * @en
  1850. * The segments for ellipse mask.
  1851. *
  1852. * TODO: remove segments, not supported by graphics
  1853. * @zh
  1854. * 椭圆遮罩的曲线细分数。
  1855. */
  1856. get segments(): number;
  1857. set segments(value: number);
  1858. /**
  1859. * @en
  1860. * The mask image.
  1861. *
  1862. * @zh
  1863. * 遮罩所需要的贴图。
  1864. * @deprecated since v3.6.1
  1865. */
  1866. get spriteFrame(): SpriteFrame | null;
  1867. set spriteFrame(value: SpriteFrame | null);
  1868. /**
  1869. * @en
  1870. * The alpha threshold.(Not supported Canvas Mode) <br/>
  1871. * The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  1872. * Should be a float between 0 and 1. <br/>
  1873. * This default to 0.1.
  1874. * When it's set to 1, the stencil will discard all pixels, nothing will be shown.
  1875. * @zh
  1876. * Alpha 阈值(不支持 Canvas 模式)<br/>
  1877. * 只有当模板的像素的 alpha 大于等于 alphaThreshold 时,才会绘制内容。<br/>
  1878. * 该数值 0 ~ 1 之间的浮点数,默认值为 0.1
  1879. * 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容
  1880. */
  1881. get alphaThreshold(): number;
  1882. set alphaThreshold(value: number);
  1883. /**
  1884. * @en Rendering component for providing stencil buffer information.
  1885. * @zh 用于提供 stencil buffer 信息的渲染组件。
  1886. */
  1887. get subComp(): Sprite | Graphics | null;
  1888. protected _type: __private._cocos_2d_components_mask__MaskType;
  1889. protected _inverted: boolean;
  1890. protected _segments: number;
  1891. protected _alphaThreshold: number;
  1892. protected _sprite: Sprite | null;
  1893. protected _graphics: Graphics | null;
  1894. protected _stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
  1895. onLoad(): void;
  1896. onEnable(): void;
  1897. onRestore(): void;
  1898. onDisable(): void;
  1899. onDestroy(): void;
  1900. /**
  1901. * @en Hit test with point in World Space.
  1902. * @zh 世界空间中的点击测试。
  1903. * @param worldPt @en point in World Space. @zh 世界空间中的点击点。
  1904. */
  1905. isHit(worldPt: math.Vec2): boolean;
  1906. protected _nodeStateChange(type: TransformBit): void;
  1907. protected _createSprite(): void;
  1908. protected _createGraphics(): void;
  1909. protected _updateGraphics(): void;
  1910. protected _enableRender(): void;
  1911. protected _disableRender(): void;
  1912. protected _removeMaskNode(): void;
  1913. /**
  1914. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1915. * you can directly manipulate the rendering components under the same node to complete the operation
  1916. */
  1917. get customMaterial(): Material | null;
  1918. set customMaterial(val: Material | null);
  1919. /**
  1920. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1921. * you can directly manipulate the rendering components under the same node to complete the operation
  1922. */
  1923. get color(): math.Color | null;
  1924. set color(value: math.Color | null);
  1925. /**
  1926. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1927. * you can directly manipulate the rendering components under the same node to complete the operation
  1928. */
  1929. markForUpdateRenderData(enable?: boolean): void;
  1930. /**
  1931. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1932. * you can directly manipulate the rendering components under the same node to complete the operation
  1933. */
  1934. requestRenderData(any: any): void;
  1935. /**
  1936. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1937. * you can directly manipulate the rendering components under the same node to complete the operation
  1938. */
  1939. destroyRenderData(): void;
  1940. /**
  1941. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1942. * you can directly manipulate the rendering components under the same node to complete the operation
  1943. */
  1944. updateRenderer(): void;
  1945. /**
  1946. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1947. * you can directly manipulate the rendering components under the same node to complete the operation
  1948. */
  1949. fillBuffers(render: any): void;
  1950. /**
  1951. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1952. * you can directly manipulate the rendering components under the same node to complete the operation
  1953. */
  1954. postUpdateAssembler(render: any): void;
  1955. /**
  1956. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1957. * you can directly manipulate the rendering components under the same node to complete the operation
  1958. */
  1959. setNodeDirty(): void;
  1960. /**
  1961. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1962. * you can directly manipulate the rendering components under the same node to complete the operation
  1963. */
  1964. setTextureDirty(): void;
  1965. /**
  1966. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1967. * you can directly manipulate the rendering components under the same node to complete the operation
  1968. */
  1969. get sharedMaterial(): Material | null;
  1970. /**
  1971. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1972. * you can directly manipulate the rendering components under the same node to complete the operation
  1973. */
  1974. get sharedMaterials(): (Material | null)[] | null;
  1975. set sharedMaterials(val: (Material | null)[] | null);
  1976. /**
  1977. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1978. * you can directly manipulate the rendering components under the same node to complete the operation
  1979. */
  1980. get material(): any;
  1981. set material(val: any);
  1982. /**
  1983. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1984. * you can directly manipulate the rendering components under the same node to complete the operation
  1985. */
  1986. get materials(): (any)[];
  1987. set materials(val: (any)[]);
  1988. /**
  1989. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1990. * you can directly manipulate the rendering components under the same node to complete the operation
  1991. */
  1992. getMaterial(idx: number): any;
  1993. /**
  1994. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  1995. * you can directly manipulate the rendering components under the same node to complete the operation
  1996. */
  1997. setMaterial(material: Material | renderer.MaterialInstance | null, index: number): void;
  1998. /**
  1999. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  2000. * you can directly manipulate the rendering components under the same node to complete the operation
  2001. */
  2002. getMaterialInstance(idx: number): any;
  2003. /**
  2004. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  2005. * you can directly manipulate the rendering components under the same node to complete the operation
  2006. */
  2007. setMaterialInstance(matInst: Material | renderer.MaterialInstance | null, index: number): void;
  2008. /**
  2009. * @deprecated Since v3.6, Because mask changes the inheritance relationship,
  2010. * you can directly manipulate the rendering components under the same node to complete the operation
  2011. */
  2012. getRenderMaterial(index: number): any;
  2013. }
  2014. /**
  2015. * @en
  2016. * The RichText Component.
  2017. *
  2018. * @zh
  2019. * 富文本组件。
  2020. */
  2021. export class RichText extends Component {
  2022. /**
  2023. * @en
  2024. * Content string of RichText.
  2025. *
  2026. * @zh
  2027. * 富文本显示的文本内容。
  2028. */
  2029. get string(): string;
  2030. set string(value: string);
  2031. /**
  2032. * @en
  2033. * Horizontal Alignment of each line in RichText.
  2034. *
  2035. * @zh
  2036. * 文本内容的水平对齐方式。
  2037. */
  2038. get horizontalAlign(): HorizontalTextAlignment;
  2039. set horizontalAlign(value: HorizontalTextAlignment);
  2040. /**
  2041. * @en
  2042. * Vertical Alignment of each line in RichText.
  2043. *
  2044. * @zh
  2045. * 文本内容的竖直对齐方式。
  2046. */
  2047. get verticalAlign(): VerticalTextAlignment;
  2048. set verticalAlign(value: VerticalTextAlignment);
  2049. /**
  2050. * @en
  2051. * Font size of RichText.
  2052. *
  2053. * @zh
  2054. * 富文本字体大小。
  2055. */
  2056. get fontSize(): number;
  2057. set fontSize(value: number);
  2058. /**
  2059. * @en
  2060. * Font color of RichText. Works when the text content does not have a color parameter set. Transparency cascade is not supported.
  2061. *
  2062. * @zh
  2063. * 富文本默认文字颜色。在文本内容没有设置颜色参数时生效。暂不支持颜色级联。
  2064. */
  2065. get fontColor(): math.Color;
  2066. set fontColor(value: math.Color);
  2067. /**
  2068. * @en
  2069. * Custom System font of RichText.
  2070. *
  2071. * @zh
  2072. * 富文本定制系统字体。
  2073. */
  2074. get fontFamily(): string;
  2075. set fontFamily(value: string);
  2076. /**
  2077. * @en
  2078. * Custom System font of RichText.
  2079. *
  2080. * @zh
  2081. * 富文本定制字体。
  2082. */
  2083. get font(): TTFFont | null;
  2084. set font(value: TTFFont | null);
  2085. /**
  2086. * @en
  2087. * Whether use system font name or not.
  2088. *
  2089. * @zh
  2090. * 是否使用系统字体。
  2091. */
  2092. get useSystemFont(): boolean;
  2093. set useSystemFont(value: boolean);
  2094. /**
  2095. * @en
  2096. * The cache mode of label. This mode only supports system fonts.
  2097. *
  2098. * @zh
  2099. * 文本缓存模式, 该模式只支持系统字体。
  2100. */
  2101. get cacheMode(): CacheMode;
  2102. set cacheMode(value: CacheMode);
  2103. /**
  2104. * @en
  2105. * The maximize width of the RichText.
  2106. *
  2107. * @zh
  2108. * 富文本的最大宽度。
  2109. */
  2110. get maxWidth(): number;
  2111. set maxWidth(value: number);
  2112. /**
  2113. * @en
  2114. * Line Height of RichText.
  2115. *
  2116. * @zh
  2117. * 富文本行高。
  2118. */
  2119. get lineHeight(): number;
  2120. set lineHeight(value: number);
  2121. /**
  2122. * @en
  2123. * The image atlas for the img tag. For each src value in the img tag, there should be a valid spriteFrame in the image atlas.
  2124. *
  2125. * @zh
  2126. * 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。
  2127. */
  2128. get imageAtlas(): SpriteAtlas | null;
  2129. set imageAtlas(value: SpriteAtlas | null);
  2130. /**
  2131. * @en
  2132. * Once checked, the RichText will block all input events (mouse and touch) within
  2133. * the bounding box of the node, preventing the input from penetrating into the underlying node.
  2134. *
  2135. * @zh
  2136. * 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。
  2137. */
  2138. get handleTouchEvent(): boolean;
  2139. set handleTouchEvent(value: boolean);
  2140. /**
  2141. * @en Enum for horizontal text alignment.
  2142. *
  2143. * @zh 文本横向对齐类型。
  2144. */
  2145. static HorizontalAlign: typeof HorizontalTextAlignment;
  2146. /**
  2147. * @en Enum for vertical text alignment.
  2148. *
  2149. * @zh 文本垂直对齐类型。
  2150. */
  2151. static VerticalAlign: typeof VerticalTextAlignment;
  2152. protected _lineHeight: number;
  2153. protected _string: string;
  2154. protected _horizontalAlign: HorizontalTextAlignment;
  2155. protected _verticalAlign: VerticalTextAlignment;
  2156. protected _fontSize: number;
  2157. protected _fontColor: math.Color;
  2158. protected _maxWidth: number;
  2159. protected _fontFamily: string;
  2160. protected _font: TTFFont | null;
  2161. protected _isSystemFontUsed: boolean;
  2162. protected _userDefinedFont: TTFFont | null;
  2163. protected _cacheMode: CacheMode;
  2164. protected _imageAtlas: SpriteAtlas | null;
  2165. protected _handleTouchEvent: boolean;
  2166. protected _textArray: IHtmlTextParserResultObj[];
  2167. protected _segments: __private._cocos_2d_components_rich_text__ISegment[];
  2168. protected _labelSegmentsCache: __private._cocos_2d_components_rich_text__ISegment[];
  2169. protected _linesWidth: number[];
  2170. protected _lineCount: number;
  2171. protected _labelWidth: number;
  2172. protected _labelHeight: number;
  2173. protected _layoutDirty: boolean;
  2174. protected _lineOffsetX: number;
  2175. protected _updateRichTextStatus: () => void;
  2176. protected _labelChildrenNum: number;
  2177. constructor();
  2178. onLoad(): void;
  2179. onEnable(): void;
  2180. onDisable(): void;
  2181. onRestore(): void;
  2182. onDestroy(): void;
  2183. protected _addEventListeners(): void;
  2184. protected _removeEventListeners(): void;
  2185. protected _updateLabelSegmentTextAttributes(): void;
  2186. protected _createFontLabel(str: string): __private._cocos_2d_components_rich_text__ISegment;
  2187. protected _createImage(spriteFrame: SpriteFrame): __private._cocos_2d_components_rich_text__ISegment;
  2188. protected _onTTFLoaded(): void;
  2189. protected _measureText(styleIndex: number, string?: string): number | ((s: string) => number);
  2190. protected _onTouchEnded(event: EventTouch): void;
  2191. protected _containsTouchLocation(label: __private._cocos_2d_components_rich_text__ISegment, point: math.Vec2): boolean;
  2192. protected _resetState(): void;
  2193. protected _activateChildren(active: any): void;
  2194. protected _addLabelSegment(stringToken: string, styleIndex: number): __private._cocos_2d_components_rich_text__ISegment;
  2195. protected _updateRichTextWithMaxWidth(labelString: string, labelWidth: number, styleIndex: number): void;
  2196. protected _isLastComponentCR(stringToken: any): boolean;
  2197. protected _updateLineInfo(): void;
  2198. protected _needsUpdateTextLayout(newTextArray: IHtmlTextParserResultObj[]): boolean;
  2199. protected _addRichTextImageElement(richTextElement: IHtmlTextParserResultObj): void;
  2200. protected _updateTextDefaultColor(): void;
  2201. protected _updateRichText(): void;
  2202. protected _getFirstWordLen(text: string, startIndex: number, textLen: number): number;
  2203. protected _updateRichTextPosition(): void;
  2204. protected _convertLiteralColorValue(color: string): math.Color;
  2205. protected _applyTextAttribute(labelSeg: __private._cocos_2d_components_rich_text__ISegment): void;
  2206. protected _applyLayer(): void;
  2207. protected _resetLabelState(label: Label): void;
  2208. }
  2209. /**
  2210. * @en
  2211. * Renders a sprite in the scene.
  2212. *
  2213. * @zh
  2214. * 渲染精灵组件。
  2215. */
  2216. export class Sprite extends UIRenderer {
  2217. /**
  2218. * @en
  2219. * The sprite atlas where the sprite is.
  2220. *
  2221. * @zh
  2222. * 精灵的图集。
  2223. */
  2224. get spriteAtlas(): SpriteAtlas | null;
  2225. set spriteAtlas(value: SpriteAtlas | null);
  2226. /**
  2227. * @en
  2228. * The sprite frame of the sprite.
  2229. *
  2230. * @zh
  2231. * 精灵的精灵帧。
  2232. */
  2233. get spriteFrame(): SpriteFrame | null;
  2234. set spriteFrame(value: SpriteFrame | null);
  2235. /**
  2236. * @en
  2237. * The sprite render type.
  2238. *
  2239. * @zh
  2240. * 精灵渲染类型。
  2241. *
  2242. * @example
  2243. * ```ts
  2244. * import { Sprite } from 'cc';
  2245. * sprite.type = Sprite.Type.SIMPLE;
  2246. * ```
  2247. */
  2248. get type(): __private._cocos_2d_components_sprite__SpriteType;
  2249. set type(value: __private._cocos_2d_components_sprite__SpriteType);
  2250. /**
  2251. * @en
  2252. * The fill type, This will only have any effect if the "type" is set to “Sprite.Type.FILLED”.
  2253. *
  2254. * @zh
  2255. * 精灵填充类型,仅渲染类型设置为 Sprite.Type.FILLED 时有效。
  2256. *
  2257. * @example
  2258. * ```ts
  2259. * import { Sprite } from 'cc';
  2260. * sprite.fillType = Sprite.FillType.HORIZONTAL;
  2261. * ```
  2262. */
  2263. get fillType(): __private._cocos_2d_components_sprite__FillType;
  2264. set fillType(value: __private._cocos_2d_components_sprite__FillType);
  2265. /**
  2266. * @en
  2267. * The fill Center, This will only have any effect if the "type" is set to “Sprite.Type.FILLED”.
  2268. *
  2269. * @zh
  2270. * 填充中心点,仅渲染类型设置为 Sprite.Type.FILLED 时有效。
  2271. *
  2272. * @example
  2273. * ```ts
  2274. * import { Vec2 } from 'cc';
  2275. * sprite.fillCenter = new Vec2(0, 0);
  2276. * ```
  2277. */
  2278. get fillCenter(): math.Vec2;
  2279. set fillCenter(value: math.Vec2);
  2280. /**
  2281. * @en
  2282. * The fill Start, This will only have any effect if the "type" is set to “Sprite.Type.FILLED”.
  2283. *
  2284. * @zh
  2285. * 填充起始点,仅渲染类型设置为 Sprite.Type.FILLED 时有效。
  2286. *
  2287. * @example
  2288. * ```ts
  2289. * // -1 To 1 between the numbers
  2290. * sprite.fillStart = 0.5;
  2291. * ```
  2292. */
  2293. get fillStart(): number;
  2294. set fillStart(value: number);
  2295. /**
  2296. * @en
  2297. * The fill Range, This will only have any effect if the "type" is set to “Sprite.Type.FILLED”.
  2298. *
  2299. * @zh
  2300. * 填充范围,仅渲染类型设置为 Sprite.Type.FILLED 时有效。
  2301. *
  2302. * @example
  2303. * ```ts
  2304. * // -1 To 1 between the numbers
  2305. * sprite.fillRange = 1;
  2306. * ```
  2307. */
  2308. get fillRange(): number;
  2309. set fillRange(value: number);
  2310. /**
  2311. * @en
  2312. * specify the frame is trimmed or not.
  2313. *
  2314. * @zh
  2315. * 是否使用裁剪模式。
  2316. *
  2317. * @example
  2318. * ```ts
  2319. * sprite.trim = true;
  2320. * ```
  2321. */
  2322. get trim(): boolean;
  2323. set trim(value: boolean);
  2324. /**
  2325. * @en Grayscale mode.
  2326. * @zh 是否以灰度模式渲染。
  2327. */
  2328. get grayscale(): boolean;
  2329. set grayscale(value: boolean);
  2330. /**
  2331. * @en
  2332. * Specify the size tracing mode.
  2333. *
  2334. * @zh
  2335. * 精灵尺寸调整模式。
  2336. *
  2337. * @example
  2338. * ```ts
  2339. * import { Sprite } from 'cc';
  2340. * sprite.sizeMode = Sprite.SizeMode.CUSTOM;
  2341. * ```
  2342. */
  2343. get sizeMode(): __private._cocos_2d_components_sprite__SizeMode;
  2344. set sizeMode(value: __private._cocos_2d_components_sprite__SizeMode);
  2345. /**
  2346. * @en Enum for fill type.
  2347. * @zh 填充类型。
  2348. */
  2349. static FillType: typeof __private._cocos_2d_components_sprite__FillType;
  2350. /**
  2351. * @en Enum for sprite type.
  2352. * @zh Sprite 类型。
  2353. */
  2354. static Type: typeof __private._cocos_2d_components_sprite__SpriteType;
  2355. /**
  2356. * @en Sprite's size mode, including trimmed size, raw size, and none.
  2357. * @zh 精灵尺寸调整模式。
  2358. */
  2359. static SizeMode: typeof __private._cocos_2d_components_sprite__SizeMode;
  2360. /**
  2361. * @en Event types for sprite.
  2362. * @zh sprite 的事件类型。
  2363. */
  2364. static EventType: typeof __private._cocos_2d_components_sprite__EventType;
  2365. protected _spriteFrame: SpriteFrame | null;
  2366. protected _type: __private._cocos_2d_components_sprite__SpriteType;
  2367. protected _fillType: __private._cocos_2d_components_sprite__FillType;
  2368. protected _sizeMode: __private._cocos_2d_components_sprite__SizeMode;
  2369. protected _fillCenter: math.Vec2;
  2370. protected _fillStart: number;
  2371. protected _fillRange: number;
  2372. protected _isTrimmedMode: boolean;
  2373. protected _useGrayscale: boolean;
  2374. protected _atlas: SpriteAtlas | null;
  2375. __preload(): void;
  2376. onEnable(): void;
  2377. onDisable(): void;
  2378. onDestroy(): void;
  2379. /**
  2380. * @en
  2381. * Quickly switch to other sprite frame in the sprite atlas.
  2382. * If there is no atlas, the switch fails.
  2383. *
  2384. * @zh
  2385. * 选取使用精灵图集中的其他精灵。
  2386. * @param name @en Name of the spriteFrame to switch. @zh 要切换的 spriteFrame 名字。
  2387. */
  2388. changeSpriteFrameFromAtlas(name: string): void;
  2389. /**
  2390. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2391. */
  2392. changeMaterialForDefine(): void;
  2393. protected _updateBuiltinMaterial(): Material;
  2394. protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  2395. protected _canRender(): boolean;
  2396. protected _flushAssembler(): void;
  2397. public loadSpriteFrame(bundleName: string, path: string): void;
  2398. }
  2399. /**
  2400. * @en
  2401. * The component of model.
  2402. * When you place particles or models in the UI, you must add this component to render.
  2403. * The component must be placed on a node with the [[MeshRenderer]] or the [[ParticleSystem]].
  2404. *
  2405. * @zh
  2406. * UI 模型基础组件。
  2407. * 当你在 UI 中放置模型或者粒子的时候,必须添加该组件才能渲染。该组件必须放置在带有 [[MeshRenderer]] 或者 [[ParticleSystem]] 组件的节点上。
  2408. * @deprecated This component is not recommended to be used, please use Render Texture instead.
  2409. * See [UIMeshRenderer Reference](https://docs.cocos.com/creator/manual/en/ui-system/components/editor/ui-model.html)
  2410. */
  2411. export class UIMeshRenderer extends Component {
  2412. constructor();
  2413. /**
  2414. * @en Get the model component on this node
  2415. * @zh 获取同节点的 model 组件
  2416. */
  2417. get modelComponent(): ModelRenderer | null;
  2418. protected _renderEntity: __private._cocos_2d_renderer_render_entity__RenderEntity;
  2419. _dirtyVersion: number;
  2420. _internalId: number;
  2421. __preload(): void;
  2422. onEnable(): void;
  2423. onDisable(): void;
  2424. onLoad(): void;
  2425. onDestroy(): void;
  2426. /**
  2427. * @en Render data submission procedure, it update and assemble the render data to 2D data buffers before all children submission process.
  2428. * Usually called each frame when the ui flow assemble all render data to geometry buffers.
  2429. * Don't call it unless you know what you are doing.
  2430. * @zh 渲染数据组装程序,这个方法会在所有子节点数据组装之前更新并组装当前组件的渲染数据到 UI 的顶点数据缓冲区中。
  2431. * 一般在 UI 渲染流程中调用,用于组装所有的渲染数据到顶点数据缓冲区。
  2432. * 注意:不要手动调用该函数,除非你理解整个流程。
  2433. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2434. */
  2435. _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): boolean;
  2436. /**
  2437. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2438. */
  2439. fillBuffers(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  2440. /**
  2441. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2442. */
  2443. updateRenderer(): void;
  2444. /**
  2445. * @en Post render data submission procedure, it's executed after assembler updated for all children.
  2446. * It may assemble some extra render data to the geometry buffers, or it may only change some render states.
  2447. * Don't call it unless you know what you are doing.
  2448. * @zh 后置渲染数据组装程序,它会在所有子节点的渲染数据组装完成后被调用。
  2449. * 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
  2450. * 注意:不要手动调用该函数,除非你理解整个流程。
  2451. */
  2452. postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  2453. update(): void;
  2454. /**
  2455. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2456. */
  2457. markForUpdateRenderData(enable?: boolean): void;
  2458. /**
  2459. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2460. */
  2461. stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
  2462. /**
  2463. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2464. */
  2465. setNodeDirty(): void;
  2466. /**
  2467. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2468. */
  2469. setTextureDirty(): void;
  2470. protected _canRender(): boolean;
  2471. /**
  2472. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2473. */
  2474. get renderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  2475. protected _renderData: RenderData | null;
  2476. /**
  2477. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  2478. */
  2479. get renderData(): RenderData | null;
  2480. }
  2481. /**
  2482. * @en
  2483. * Outline effect used to change the display, only for system fonts or TTF fonts.
  2484. *
  2485. * @zh
  2486. * 描边效果组件,用于字体描边,只能用于系统字体。
  2487. *
  2488. * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
  2489. */
  2490. export class LabelOutline extends Component {
  2491. /**
  2492. * @en
  2493. * Outline color.
  2494. *
  2495. * @zh
  2496. * 改变描边的颜色。
  2497. *
  2498. * @deprecated since v3.8.2, please use [[Label.outlineColor]] instead.
  2499. */
  2500. get color(): Readonly<math.Color>;
  2501. set color(value: Readonly<math.Color>);
  2502. /**
  2503. * @en
  2504. * Change the outline width.
  2505. *
  2506. * @zh
  2507. * 改变描边的宽度。
  2508. *
  2509. * @deprecated since v3.8.2, please use [[Label.outlineWidth]] instead.
  2510. */
  2511. get width(): number;
  2512. set width(value: number);
  2513. /**
  2514. * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
  2515. */
  2516. onEnable(): void;
  2517. /**
  2518. * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
  2519. */
  2520. onDisable(): void;
  2521. }
  2522. /**
  2523. * @en
  2524. * Graphics component.
  2525. *
  2526. * @zh
  2527. * 自定义图形类。
  2528. */
  2529. export class Graphics extends UIRenderer {
  2530. /**
  2531. * @en
  2532. * Current line width.
  2533. *
  2534. * @zh
  2535. * 当前线条宽度。
  2536. */
  2537. get lineWidth(): number;
  2538. set lineWidth(value: number);
  2539. /**
  2540. * @en
  2541. * Determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  2542. *
  2543. * @zh
  2544. * 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。
  2545. */
  2546. get lineJoin(): __private._cocos_2d_assembler_graphics_types__LineJoin;
  2547. set lineJoin(value: __private._cocos_2d_assembler_graphics_types__LineJoin);
  2548. /**
  2549. * @en
  2550. * Determines how the end points of every line are drawn.
  2551. *
  2552. * @zh
  2553. * 指定如何绘制每一条线段末端。
  2554. */
  2555. get lineCap(): __private._cocos_2d_assembler_graphics_types__LineCap;
  2556. set lineCap(value: __private._cocos_2d_assembler_graphics_types__LineCap);
  2557. /**
  2558. * @en
  2559. * Brush stroke color.
  2560. *
  2561. * @zh
  2562. * 笔触的颜色。
  2563. */
  2564. get strokeColor(): Readonly<math.Color>;
  2565. set strokeColor(value: Readonly<math.Color>);
  2566. /**
  2567. * @en
  2568. * Fill paint color.
  2569. *
  2570. * @zh
  2571. * 填充绘画的颜色。
  2572. */
  2573. get fillColor(): Readonly<math.Color>;
  2574. set fillColor(value: Readonly<math.Color>);
  2575. /**
  2576. * @en
  2577. * Set the miter limit ratio.
  2578. *
  2579. * @zh
  2580. * 设置斜接面限制比例。
  2581. */
  2582. get miterLimit(): number;
  2583. set miterLimit(value: number);
  2584. get color(): math.Color;
  2585. set color(value: math.Color);
  2586. static LineJoin: typeof __private._cocos_2d_assembler_graphics_types__LineJoin;
  2587. static LineCap: typeof __private._cocos_2d_assembler_graphics_types__LineCap;
  2588. impl: __private._cocos_2d_assembler_graphics_webgl_impl__Impl | null;
  2589. /**
  2590. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  2591. */
  2592. model: renderer.scene.Model | null;
  2593. protected _lineWidth: number;
  2594. protected _strokeColor: math.Color;
  2595. protected _lineJoin: __private._cocos_2d_assembler_graphics_types__LineJoin;
  2596. protected _lineCap: __private._cocos_2d_assembler_graphics_types__LineCap;
  2597. protected _fillColor: math.Color;
  2598. protected _miterLimit: number;
  2599. protected _isDrawing: boolean;
  2600. protected _isNeedUploadData: boolean;
  2601. protected _graphicsNativeProxy: __private._cocos_2d_renderer_native_2d__NativeUIModelProxy;
  2602. /**
  2603. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  2604. */
  2605. get graphicsNativeProxy(): __private._cocos_2d_renderer_native_2d__NativeUIModelProxy;
  2606. constructor();
  2607. onRestore(): void;
  2608. onLoad(): void;
  2609. onEnable(): void;
  2610. onDestroy(): void;
  2611. /**
  2612. * @en
  2613. * Move path start point to (x,y).
  2614. *
  2615. * @zh
  2616. * 移动路径起点到坐标(x, y)。
  2617. *
  2618. * @param x @en The x-axis coordinate of the target position.
  2619. * @zh 目标位置的 X 轴坐标。
  2620. * @param y @en The y-axis coordinate of the target position.
  2621. * @zh 目标位置的 y 轴坐标。
  2622. */
  2623. moveTo(x: number, y: number): void;
  2624. /**
  2625. * @en
  2626. * Adds a straight line to the path.
  2627. *
  2628. * @zh
  2629. * 绘制直线路径。
  2630. *
  2631. * @param x @en The x-axis coordinate of the target position.
  2632. * @zh 目标位置的 x 轴坐标。
  2633. * @param y @en The x-axis coordinate of the target position.
  2634. * @zh 目标位置的 y 轴坐标。
  2635. */
  2636. lineTo(x: number, y: number): void;
  2637. /**
  2638. * @en
  2639. * Adds a cubic Bézier curve to the path.
  2640. *
  2641. * @zh
  2642. * 绘制三次贝赛尔曲线路径。
  2643. *
  2644. * @param c1x @en The x-axis coordinate of the first control point.
  2645. * @zh 第一个控制点的 x 轴坐标。
  2646. * @param c1y @en The y-axis coordinate of the first control point.
  2647. * @zh 第一个控制点的 y 轴坐标。
  2648. * @param c2x @en The x-axis coordinate of the second control point.
  2649. * @zh 第二个控制点的 x 轴坐标。
  2650. * @param c2y @en The y-axis coordinate of the second control point.
  2651. * @zh 第二个控制点的 y 轴坐标。
  2652. * @param x @en The x-axis coordinate of the last control point.
  2653. * @zh 最后一个控制点的 x 轴坐标。
  2654. * @param y @en The y-axis coordinate of the last control point.
  2655. * @zh 最后一个控制点的 y 轴坐标。
  2656. */
  2657. bezierCurveTo(c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number): void;
  2658. /**
  2659. * @en
  2660. * Adds a quadratic Bézier curve to the path.
  2661. *
  2662. * @zh
  2663. * 绘制二次贝赛尔曲线路径。
  2664. *
  2665. * @param cx @en The x-axis coordinate of the starting control point.
  2666. * @zh 起始控制点的 x 轴坐标。
  2667. * @param cy @en The y-axis coordinate of the starting control point.
  2668. * @zh 起始控制点的 y 轴坐标。
  2669. * @param x @en The x-axis coordinates of the endpoint control point.
  2670. * @zh 终点控制点的 x 轴坐标。
  2671. * @param y @en The y-axis coordinates of the endpoint control point.
  2672. * @zh 终点控制点的 x 轴坐标。
  2673. */
  2674. quadraticCurveTo(cx: number, cy: number, x: number, y: number): void;
  2675. /**
  2676. * @en
  2677. * Adds an arc to the path which is centered at (cx, cy) position with radius r starting at startAngle
  2678. * and ending at endAngle going in the given direction by counterclockwise (defaulting to false).
  2679. *
  2680. * @zh
  2681. * 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  2682. *
  2683. * @param cx @en The coordinate x-axis of the central control point.
  2684. * @zh 中心控制点的坐标 x 轴。
  2685. * @param cy @en The coordinate y-axis of the central control point.
  2686. * @zh 中心控制点的坐标 y 轴。
  2687. * @param r @en Angle in Radian.
  2688. * @zh 圆弧弧度。
  2689. * @param startAngle @en The starting angle in radian, measured clockwise from the positive x-axis.
  2690. * @zh 弧度起点,从正 x 轴顺时针方向测量。
  2691. * @param endAngle @en The ending angle in radian, measured clockwise from the positive x-axis.
  2692. * @zh 弧度终点,从正 x 轴顺时针方向测量。
  2693. * @param counterclockwise @en If true, draws counterclockwise between the two angles. Default is clockwise.
  2694. * @zh 如果为真,在两个角度之间逆时针绘制。默认顺时针。
  2695. */
  2696. arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise: boolean): void;
  2697. /**
  2698. * @en
  2699. * Adds an ellipse to the path.
  2700. *
  2701. * @zh
  2702. * 绘制椭圆路径。
  2703. *
  2704. * @param cx @en The x-axis coordinates of the center point.
  2705. * @zh 中心点的 x 轴坐标。
  2706. * @param cy @en The y-axis coordinates of the center point.
  2707. * @zh 中心点的 y 轴坐标。
  2708. * @param rx @en The radius of the x-axis of the ellipse.
  2709. * @zh 椭圆 x 轴半径。
  2710. * @param ry @en The radius of the y-axis of the ellipse.
  2711. * @zh 椭圆 y 轴半径。
  2712. */
  2713. ellipse(cx: number, cy: number, rx: number, ry: number): void;
  2714. /**
  2715. * @en
  2716. * Adds a circle to the path.
  2717. *
  2718. * @zh
  2719. * 绘制圆形路径。
  2720. *
  2721. * @param cx @en The x-axis coordinates of the center point.
  2722. * @zh 中心点的 x 轴坐标。
  2723. * @param cy @en The y-axis coordinates of the center point.
  2724. * @zh 中心点的 y 轴坐标。
  2725. * @param r @en Radius.
  2726. * @zh 圆半径。
  2727. */
  2728. circle(cx: number, cy: number, r: number): void;
  2729. /**
  2730. * @en
  2731. * Adds a rectangle to the path.
  2732. *
  2733. * @zh
  2734. * 绘制矩形路径。
  2735. *
  2736. * @param x @en The x-axis coordinate of the top left point of the rectangle.
  2737. * @zh 矩形起始 x 轴坐标。
  2738. * @param y @en The y-axis coordinate of the top left point of the rectangle.
  2739. * @zh 矩形起始 y 轴坐标。
  2740. * @param w @en The width of the rectangle.
  2741. * @zh 矩形宽度。
  2742. * @param h @en The height of the rectangle.
  2743. * @zh 矩形高度。
  2744. */
  2745. rect(x: number, y: number, w: number, h: number): void;
  2746. /**
  2747. * @en
  2748. * Adds a round corner rectangle to the path.
  2749. *
  2750. * @zh
  2751. * 绘制圆角矩形路径。
  2752. *
  2753. * @param x @en The x-axis coordinate of the top left point of the rectangle.
  2754. * @zh 矩形起始 x 轴坐标。
  2755. * @param y @en The y-axis coordinate of the top left point of the rectangle.
  2756. * @zh 矩形起始 y 轴坐标。
  2757. * @param w @en The width of the rectangle.
  2758. * @zh 矩形宽度。
  2759. * @param h @en The height of the rectangle.
  2760. * @zh 矩形高度。
  2761. * @param r @en Radius of rectangular rounded corners.
  2762. * @zh 矩形圆角半径。
  2763. */
  2764. roundRect(x: number, y: number, w: number, h: number, r: number): void;
  2765. /**
  2766. * @en
  2767. * Draws a filled rectangle.
  2768. *
  2769. * @zh
  2770. * 绘制填充矩形。
  2771. *
  2772. * @param x @en The x-axis coordinate of the top left point of the rectangle.
  2773. * @zh 矩形起始 x 轴坐标。
  2774. * @param y @en The y-axis coordinate of the top left point of the rectangle.
  2775. * @zh 矩形起始 y 轴坐标。
  2776. * @param w @en The width of the rectangle.
  2777. * @zh 矩形宽度。
  2778. * @param h @en The height of the rectangle.
  2779. * @zh 矩形高度。
  2780. */
  2781. fillRect(x: number, y: number, w: number, h: number): void;
  2782. /**
  2783. * @en
  2784. * Erasing any previously drawn content.
  2785. *
  2786. * @zh
  2787. * 擦除之前绘制的所有内容的方法。
  2788. */
  2789. clear(): void;
  2790. /**
  2791. * @en
  2792. * Causes the point of the pen to move back to the start of the current path.
  2793. * It tries to add a straight line from the current point to the start.
  2794. *
  2795. * @zh
  2796. * 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  2797. */
  2798. close(): void;
  2799. /**
  2800. * @en
  2801. * Strokes the current or given path with the current stroke style.
  2802. *
  2803. * @zh
  2804. * 根据当前的画线样式,绘制当前或已经存在的路径。
  2805. */
  2806. stroke(): void;
  2807. /**
  2808. * @en
  2809. * Fills the current or given path with the current fill style.
  2810. *
  2811. * @zh
  2812. * 根据当前的画线样式,填充当前或已经存在的路径。
  2813. */
  2814. fill(): void;
  2815. /**
  2816. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  2817. */
  2818. activeSubModel(idx: number): void;
  2819. protected _uploadData(): void;
  2820. protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  2821. protected _flushAssembler(): void;
  2822. protected _canRender(): boolean;
  2823. /**
  2824. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  2825. */
  2826. updateRenderer(): void;
  2827. protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  2828. }
  2829. /**
  2830. * @en
  2831. * Static batch component of UI.
  2832. * This component is placed on the root node of all node objects that need to be batch.
  2833. * Only sprites and label participate in the batch.
  2834. * Static batch must be enabled manually, otherwise dynamic batch is still used.
  2835. * Note: Do not place mask, Graphics, and objects such as UI models or particles under child nodes,
  2836. * otherwise rendering will be skipped after static batching is enabled.
  2837. *
  2838. * @zh
  2839. * UI 静态合批组件。
  2840. * 该组件放在所有需要被静态合批的节点对象的根节点上,子节点放置对象必须是精灵和文本,其余对象不参与静态合批。
  2841. * 用户必须通过手动方式启用收集静态合批数据[[markAsDirty]],否则合批方式仍然采用动态合批(采集数据的流程相同)。此后渲染的内容是采用收集到的合批渲染数据,子节点的任何修改将不再有效。
  2842. * 注意:子节点下不要放置 Mask,Graphics,以及 UI 模型或者粒子之类对象,否则会在启用完静态合批后跳过渲染。
  2843. *
  2844. * @deprecated Since v3.4.1, We have adopted a new rendering batching policy in v3.4.1,
  2845. * which will result in an effective performance improvement for normal dynamic batching components,
  2846. * so manual management with the UIStaticBatch component is no longer recommended and will be removed in the future
  2847. */
  2848. export class UIStaticBatch extends UIRenderer {
  2849. get color(): Readonly<math.Color>;
  2850. set color(value: Readonly<math.Color>);
  2851. get drawBatchList(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D[];
  2852. protected _init: boolean;
  2853. protected _bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null;
  2854. protected _dirty: boolean;
  2855. postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  2856. /**
  2857. * @en
  2858. * Recollect data tags.
  2859. * The render data will be recollected during the render phase of the current frame, and the next frame will be rendered using fixed data.
  2860. * Note: 尽量不要频繁调用此接口, 会有一定内存损耗.
  2861. *
  2862. * @zh
  2863. * 重新采集数据标记,会在当前帧的渲染阶段重新采集渲染数据,下一帧开始将会使用固定数据进行渲染。
  2864. * 注意:尽量不要频繁调用此接口,因为会清空原先存储的 ia 数据重新采集,会有一定内存损耗。
  2865. */
  2866. markAsDirty(): void;
  2867. /**
  2868. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  2869. */
  2870. _requireDrawBatch(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D;
  2871. protected _clearData(): void;
  2872. protected _getBatcher(): UI | null;
  2873. }
  2874. /**
  2875. * @en Shadow effect for Label component, only for system fonts or TTF fonts.
  2876. * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。
  2877. *
  2878. * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
  2879. */
  2880. export class LabelShadow extends Component {
  2881. /**
  2882. * @en
  2883. * Shadow color.
  2884. *
  2885. * @zh
  2886. * 阴影的颜色。
  2887. *
  2888. * @deprecated since v3.8.2, please use [[Label.shadowColor]] instead.
  2889. */
  2890. get color(): Readonly<math.Color>;
  2891. set color(value: Readonly<math.Color>);
  2892. /**
  2893. * @en
  2894. * Offset between font and shadow.
  2895. *
  2896. * @zh
  2897. * 字体与阴影的偏移。
  2898. *
  2899. * @deprecated since v3.8.2, please use [[Label.shadowOffset]] instead.
  2900. */
  2901. get offset(): math.Vec2;
  2902. set offset(value: math.Vec2);
  2903. /**
  2904. * @en
  2905. * A non-negative float specifying the level of shadow blur.
  2906. *
  2907. * @zh
  2908. * 阴影的模糊程度。
  2909. *
  2910. * @deprecated since v3.8.2, please use [[Label.shadowBlur]] instead.
  2911. */
  2912. get blur(): number;
  2913. set blur(value: number);
  2914. /**
  2915. * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
  2916. */
  2917. onEnable(): void;
  2918. /**
  2919. * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
  2920. */
  2921. onDisable(): void;
  2922. }
  2923. /**
  2924. * @en
  2925. * Set the UI transparency component.
  2926. * This component can be used to influence subsequent render nodes.
  2927. * Nodes that already have a rendering component can modify the alpha channel of color directly.
  2928. *
  2929. * @zh
  2930. * UI 透明度设置组件。可以通过该组件设置透明度来影响后续的渲染节点。已经带有渲染组件的节点可以直接修改 color 的 alpha 通道。
  2931. */
  2932. export class UIOpacity extends Component {
  2933. /**
  2934. * @en
  2935. * The transparency value of the impact.
  2936. *
  2937. * @zh
  2938. * 透明度。
  2939. */
  2940. get opacity(): number;
  2941. set opacity(value: number);
  2942. static setEntityLocalOpacityDirtyRecursively(node: Node, dirty: boolean, interruptParentOpacity: number, setByParent: boolean): void;
  2943. protected _opacity: number;
  2944. onEnable(): void;
  2945. onDisable(): void;
  2946. }
  2947. /**
  2948. * @en Enum for horizontal text alignment.
  2949. *
  2950. * @zh 文本横向对齐类型。
  2951. */
  2952. export enum HorizontalTextAlignment {
  2953. /**
  2954. * @en Alignment left for text.
  2955. *
  2956. * @zh 左对齐。
  2957. */
  2958. LEFT = 0,
  2959. /**
  2960. * @en Alignment center for text.
  2961. *
  2962. * @zh 中心对齐。
  2963. */
  2964. CENTER = 1,
  2965. /**
  2966. * @en Alignment right for text.
  2967. *
  2968. * @zh 右对齐。
  2969. */
  2970. RIGHT = 2
  2971. }
  2972. /**
  2973. * @en Enum for vertical text alignment.
  2974. *
  2975. * @zh 文本垂直对齐类型。
  2976. */
  2977. export enum VerticalTextAlignment {
  2978. /**
  2979. * @en Alignment top for text.
  2980. *
  2981. * @zh 上对齐。
  2982. */
  2983. TOP = 0,
  2984. /**
  2985. * @en Alignment center for text.
  2986. *
  2987. * @zh 中心对齐。
  2988. */
  2989. CENTER = 1,
  2990. /**
  2991. * @en Alignment bottom for text.
  2992. *
  2993. * @zh 下对齐。
  2994. */
  2995. BOTTOM = 2
  2996. }
  2997. /**
  2998. * @en Enum for Overflow.
  2999. *
  3000. * @zh 文本溢出行为类型。
  3001. */
  3002. export enum Overflow {
  3003. /**
  3004. * @en None.
  3005. *
  3006. * @zh 不做任何限制。
  3007. */
  3008. NONE = 0,
  3009. /**
  3010. * @en In CLAMP mode, when label content goes out of the bounding box, it will be clipped.
  3011. *
  3012. * @zh CLAMP 模式中,当文本内容超出边界框时,多余的会被截断。
  3013. */
  3014. CLAMP = 1,
  3015. /**
  3016. * @en In SHRINK mode, the font size will change dynamically to adapt the content size.
  3017. * This mode may takes up more CPU resources when the label is refreshed.
  3018. *
  3019. * @zh SHRINK 模式,字体大小会动态变化,以适应内容大小。这个模式在文本刷新的时候可能会占用较多 CPU 资源。
  3020. */
  3021. SHRINK = 2,
  3022. /**
  3023. * @en In RESIZE_HEIGHT mode, you can only change the width of label and the height is changed automatically.
  3024. *
  3025. * @zh 在 RESIZE_HEIGHT 模式下,只能更改文本的宽度,高度是自动改变的。
  3026. */
  3027. RESIZE_HEIGHT = 3
  3028. }
  3029. /**
  3030. * @en Enum for cache mode.
  3031. *
  3032. * @zh 文本图集缓存类型。
  3033. */
  3034. export enum CacheMode {
  3035. /**
  3036. * @en Do not do any caching.
  3037. *
  3038. * @zh 不做任何缓存。
  3039. */
  3040. NONE = 0,
  3041. /**
  3042. * @en In BITMAP mode, cache the label as a static image and add it to the dynamic atlas for batch rendering,
  3043. * and can batching with Sprites using broken images.
  3044. *
  3045. * @zh BITMAP 模式,将 label 缓存成静态图像并加入到动态图集,以便进行批次合并,可与使用碎图的 Sprite 进行合批。
  3046. * (注:动态图集在 Chrome 以及微信小游戏暂时关闭,该功能无效)。
  3047. */
  3048. BITMAP = 1,
  3049. /**
  3050. * @en In CHAR mode, split text into characters and cache characters into a dynamic atlas which the size of 1024 * 1024.
  3051. *
  3052. * @zh CHAR 模式,将文本拆分为字符,并将字符缓存到一张单独的大小为 1024 * 1024 的图集中进行重复使用,不再使用动态图集。
  3053. * (注:当图集满时将不再进行缓存,暂时不支持 SHRINK 自适应文本尺寸(后续完善))。
  3054. */
  3055. CHAR = 2
  3056. }
  3057. /**
  3058. * @en
  3059. * The Label Component.
  3060. *
  3061. * @zh
  3062. * 文字标签组件。
  3063. */
  3064. export class Label extends UIRenderer {
  3065. /**
  3066. * @en Enum for horizontal text alignment.
  3067. *
  3068. * @zh 文本横向对齐类型。
  3069. */
  3070. static HorizontalAlign: typeof HorizontalTextAlignment;
  3071. /**
  3072. * @en Enum for vertical text alignment.
  3073. *
  3074. * @zh 文本垂直对齐类型。
  3075. */
  3076. static VerticalAlign: typeof VerticalTextAlignment;
  3077. /**
  3078. * @en Enum for label overflow mode.
  3079. *
  3080. * @zh 文本溢出行为类型。
  3081. */
  3082. static Overflow: typeof Overflow;
  3083. /**
  3084. * @en Enum for cache mode.
  3085. *
  3086. * @zh 文本图集缓存类型。
  3087. */
  3088. static CacheMode: typeof CacheMode;
  3089. /**
  3090. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3091. */
  3092. static _canvasPool: __private._cocos_2d_assembler_label_font_utils__CanvasPool;
  3093. /**
  3094. * @en
  3095. * Content string of label.
  3096. *
  3097. * @zh
  3098. * 标签显示的文本内容。
  3099. */
  3100. get string(): string;
  3101. set string(value: string);
  3102. /**
  3103. * @en
  3104. * Horizontal Alignment of label.
  3105. *
  3106. * @zh
  3107. * 文本内容的水平对齐方式。
  3108. */
  3109. get horizontalAlign(): HorizontalTextAlignment;
  3110. set horizontalAlign(value: HorizontalTextAlignment);
  3111. /**
  3112. * @en
  3113. * Vertical Alignment of label.
  3114. *
  3115. * @zh
  3116. * 文本内容的垂直对齐方式。
  3117. */
  3118. get verticalAlign(): VerticalTextAlignment;
  3119. set verticalAlign(value: VerticalTextAlignment);
  3120. /**
  3121. * @en
  3122. * The actual rendering font size in shrink mode.
  3123. *
  3124. * @zh
  3125. * SHRINK 模式下面文本实际渲染的字体大小。
  3126. */
  3127. get actualFontSize(): number;
  3128. set actualFontSize(value: number);
  3129. /**
  3130. * @en
  3131. * Font size of label.
  3132. *
  3133. * @zh
  3134. * 文本字体大小。
  3135. */
  3136. get fontSize(): number;
  3137. set fontSize(value: number);
  3138. /**
  3139. * @en
  3140. * Line Height of label.
  3141. *
  3142. * @zh
  3143. * 文本行高。
  3144. */
  3145. get lineHeight(): number;
  3146. set lineHeight(value: number);
  3147. /**
  3148. * @en
  3149. * The spacing between text characters, only available in BMFont.
  3150. *
  3151. * @zh
  3152. * 文本字符之间的间距。仅在使用 BMFont 位图字体时生效。
  3153. */
  3154. get spacingX(): number;
  3155. set spacingX(value: number);
  3156. /**
  3157. * @en
  3158. * Overflow of label.
  3159. *
  3160. * @zh
  3161. * 文字显示超出范围时的处理方式。
  3162. */
  3163. get overflow(): Overflow;
  3164. set overflow(value: Overflow);
  3165. /**
  3166. * @en
  3167. * Whether auto wrap label when string width is large than label width.
  3168. *
  3169. * @zh
  3170. * 是否自动换行。
  3171. */
  3172. get enableWrapText(): boolean;
  3173. set enableWrapText(value: boolean);
  3174. /**
  3175. * @en
  3176. * Whether use system font name or not.
  3177. *
  3178. * @zh
  3179. * 是否使用系统字体。
  3180. */
  3181. get useSystemFont(): boolean;
  3182. set useSystemFont(value: boolean);
  3183. /**
  3184. * @en
  3185. * Font family of label, only take effect when useSystemFont property is true.
  3186. *
  3187. * @zh
  3188. * 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。
  3189. */
  3190. get fontFamily(): string;
  3191. set fontFamily(value: string);
  3192. /**
  3193. * @en
  3194. * The font of label.
  3195. *
  3196. * @zh
  3197. * 文本字体。
  3198. */
  3199. get font(): Font | null;
  3200. set font(value: Font | null);
  3201. /**
  3202. * @en
  3203. * The cache mode of label. This mode only supports system fonts.
  3204. *
  3205. * @zh
  3206. * 文本缓存模式, 该模式只支持系统字体。
  3207. */
  3208. get cacheMode(): CacheMode;
  3209. set cacheMode(value: CacheMode);
  3210. /**
  3211. * @en
  3212. * Whether the font is bold.
  3213. *
  3214. * @zh
  3215. * 字体是否加粗。
  3216. */
  3217. get isBold(): boolean;
  3218. set isBold(value: boolean);
  3219. /**
  3220. * @en
  3221. * Whether the font is italic.
  3222. *
  3223. * @zh
  3224. * 字体是否倾斜。
  3225. */
  3226. get isItalic(): boolean;
  3227. set isItalic(value: boolean);
  3228. /**
  3229. * @en
  3230. * Whether the font is underline.
  3231. *
  3232. * @zh
  3233. * 字体是否加下划线。
  3234. */
  3235. get isUnderline(): boolean;
  3236. set isUnderline(value: boolean);
  3237. /**
  3238. * @en The height of underline.
  3239. * @zh 下划线高度。
  3240. */
  3241. get underlineHeight(): number;
  3242. set underlineHeight(value: number);
  3243. /**
  3244. ** @en
  3245. ** Outline effect used to change the display, only for system fonts or TTF fonts.
  3246. **
  3247. ** @zh
  3248. ** 描边效果组件,用于字体描边,只能用于系统字体或 ttf 字体。
  3249. **/
  3250. get enableOutline(): boolean;
  3251. set enableOutline(value: boolean);
  3252. /**
  3253. * @en
  3254. * Outline color.
  3255. *
  3256. * @zh
  3257. * 改变描边的颜色。
  3258. */
  3259. get outlineColor(): math.Color;
  3260. set outlineColor(value: math.Color);
  3261. /**
  3262. * @en
  3263. * Change the outline width.
  3264. *
  3265. * @zh
  3266. * 改变描边的宽度。
  3267. */
  3268. get outlineWidth(): number;
  3269. set outlineWidth(value: number);
  3270. /**
  3271. * @en Shadow effect for Label component, only for system fonts or TTF fonts. Disabled when cache mode is char.
  3272. * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。在缓存模式为 char 时不可用。
  3273. */
  3274. get enableShadow(): boolean;
  3275. set enableShadow(value: boolean);
  3276. /**
  3277. * @en
  3278. * Shadow color.
  3279. *
  3280. * @zh
  3281. * 阴影的颜色。
  3282. */
  3283. get shadowColor(): math.Color;
  3284. set shadowColor(value: math.Color);
  3285. /**
  3286. * @en
  3287. * Offset between font and shadow.
  3288. *
  3289. * @zh
  3290. * 字体与阴影的偏移。
  3291. */
  3292. get shadowOffset(): math.Vec2;
  3293. set shadowOffset(value: math.Vec2);
  3294. /**
  3295. * @en
  3296. * A non-negative float specifying the level of shadow blur.
  3297. *
  3298. * @zh
  3299. * 阴影的模糊程度。
  3300. */
  3301. get shadowBlur(): number;
  3302. set shadowBlur(value: number);
  3303. /**
  3304. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3305. */
  3306. get spriteFrame(): SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
  3307. /**
  3308. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3309. */
  3310. get ttfSpriteFrame(): SpriteFrame | null;
  3311. /**
  3312. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3313. */
  3314. get assemblerData(): __private._cocos_2d_assembler_label_font_utils__ISharedLabelData | null;
  3315. /**
  3316. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3317. */
  3318. get fontAtlas(): __private._cocos_2d_assets_bitmap_font__FontAtlas | null;
  3319. set fontAtlas(value: __private._cocos_2d_assets_bitmap_font__FontAtlas | null);
  3320. /**
  3321. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3322. */
  3323. get _bmFontOriginalSize(): number;
  3324. protected _string: string;
  3325. protected _horizontalAlign: HorizontalTextAlignment;
  3326. protected _verticalAlign: VerticalTextAlignment;
  3327. protected _actualFontSize: number;
  3328. protected _fontSize: number;
  3329. protected _fontFamily: string;
  3330. protected _lineHeight: number;
  3331. protected _overflow: Overflow;
  3332. protected _enableWrapText: boolean;
  3333. protected _font: Font | null;
  3334. protected _isSystemFontUsed: boolean;
  3335. protected _spacingX: number;
  3336. protected _isItalic: boolean;
  3337. protected _isBold: boolean;
  3338. protected _isUnderline: boolean;
  3339. protected _underlineHeight: number;
  3340. protected _cacheMode: CacheMode;
  3341. protected _enableOutline: boolean;
  3342. protected _outlineColor: math.Color;
  3343. protected _outlineWidth: number;
  3344. protected _enableShadow: boolean;
  3345. protected _shadowColor: math.Color;
  3346. protected _shadowOffset: math.Vec2;
  3347. protected _shadowBlur: number;
  3348. protected _N$file: Font | null;
  3349. protected _texture: SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
  3350. protected _ttfSpriteFrame: SpriteFrame | null;
  3351. protected _userDefinedFont: Font | null;
  3352. protected _assemblerData: __private._cocos_2d_assembler_label_font_utils__ISharedLabelData | null;
  3353. protected _fontAtlas: __private._cocos_2d_assets_bitmap_font__FontAtlas | null;
  3354. protected _letterTexture: __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
  3355. protected _contentWidth: number;
  3356. protected _textStyle: __private._cocos_2d_assembler_label_text_style__TextStyle | null;
  3357. protected _textLayout: __private._cocos_2d_assembler_label_text_layout__TextLayout | null;
  3358. protected _textRenderData: __private._cocos_2d_assembler_label_text_output_data__TextOutputRenderData | null;
  3359. protected _textLayoutData: __private._cocos_2d_assembler_label_text_output_data__TextOutputLayoutData | null;
  3360. constructor();
  3361. onEnable(): void;
  3362. _onPreDestroy(): void;
  3363. onDestroy(): void;
  3364. /**
  3365. * @en update render data.
  3366. * @zh 更新渲染相关数据。
  3367. * @param force @en Whether to force an immediate update. @zh 是否立马强制更新渲染数据。
  3368. */
  3369. updateRenderData(force?: boolean): void;
  3370. protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  3371. protected _updateColor(): void;
  3372. /**
  3373. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  3374. */
  3375. setEntityColor(color: math.Color): void;
  3376. protected _canRender(): boolean;
  3377. protected _flushAssembler(): void;
  3378. protected _applyFontTexture(): void;
  3379. protected changeMaterialForDefine(): void;
  3380. }
  3381. /**
  3382. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3383. */
  3384. export interface IRenderData {
  3385. x: number;
  3386. y: number;
  3387. z: number;
  3388. u: number;
  3389. v: number;
  3390. color: math.Color;
  3391. }
  3392. /**
  3393. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3394. */
  3395. export class BaseRenderData {
  3396. get vertexCount(): number;
  3397. get indexCount(): number;
  3398. get stride(): number;
  3399. get floatStride(): number;
  3400. get vertexFormat(): gfx.Attribute[];
  3401. get drawInfoType(): __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
  3402. set drawInfoType(type: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType);
  3403. chunk: __private._cocos_2d_renderer_static_vb_accessor__StaticVBChunk;
  3404. protected _renderDrawInfo: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo;
  3405. get renderDrawInfo(): __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo;
  3406. protected _material: Material | null;
  3407. get material(): Material | null;
  3408. set material(val: Material | null);
  3409. protected _dataHash: number;
  3410. get dataHash(): number;
  3411. set dataHash(val: number);
  3412. _isMeshBuffer: boolean;
  3413. protected _vc: number;
  3414. protected _ic: number;
  3415. protected _floatStride: number;
  3416. protected _vertexFormat: gfx.Attribute[];
  3417. protected _drawInfoType: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
  3418. protected _multiOwner: boolean;
  3419. get multiOwner(): boolean;
  3420. set multiOwner(val: boolean);
  3421. protected _batcher: UI | null;
  3422. get batcher(): UI;
  3423. constructor(vertexFormat?: gfx.Attribute[]);
  3424. isValid(): false | __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3425. initRenderDrawInfo(comp: UIRenderer, drawInfoType?: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType): void;
  3426. removeRenderDrawInfo(comp: UIRenderer): void;
  3427. protected setRenderDrawInfoAttributes(): void;
  3428. }
  3429. /**
  3430. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3431. */
  3432. export class RenderData extends BaseRenderData {
  3433. static add(vertexFormat?: gfx.Attribute[], accessor?: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): RenderData;
  3434. static remove(data: RenderData): void;
  3435. get dataLength(): number;
  3436. set dataLength(length: number);
  3437. get data(): IRenderData[];
  3438. _vertDirty: boolean;
  3439. get vertDirty(): boolean;
  3440. set vertDirty(val: boolean);
  3441. protected _textureHash: number;
  3442. get textureHash(): number;
  3443. set textureHash(val: number);
  3444. indices: Uint16Array | null;
  3445. set frame(val: SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase | null);
  3446. get frame(): SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase | null;
  3447. layer: number;
  3448. nodeDirty: boolean;
  3449. passDirty: boolean;
  3450. textureDirty: boolean;
  3451. hashDirty: boolean;
  3452. protected _accessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3453. get accessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3454. vertexRow: number;
  3455. vertexCol: number;
  3456. constructor(vertexFormat?: gfx.Attribute[], accessor?: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor);
  3457. resize(vertexCount: number, indexCount: number): void;
  3458. protected setRenderDrawInfoAttributes(): void;
  3459. /**
  3460. * @internal
  3461. */
  3462. fillDrawInfoAttributes(drawInfo: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo): void;
  3463. protected syncRender2dBuffer(): void;
  3464. resizeAndCopy(vertexCount: number, indexCount: number): void;
  3465. getMeshBuffer(): MeshBuffer | null;
  3466. updateNode(comp: UIRenderer): void;
  3467. updatePass(comp: UIRenderer): void;
  3468. updateTexture(frame: SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase): void;
  3469. updateHash(): void;
  3470. updateRenderData(comp: UIRenderer, frame: SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase): void;
  3471. clear(): void;
  3472. static createStaticVBAccessor(attributes: gfx.Attribute[], vCount?: number, iCount?: number): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3473. }
  3474. /**
  3475. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3476. */
  3477. export class MeshRenderData extends BaseRenderData {
  3478. static add(vertexFormat?: gfx.Attribute[]): MeshRenderData;
  3479. static remove(data: MeshRenderData): void;
  3480. /**
  3481. * @deprecated
  3482. */
  3483. set formatByte(value: number);
  3484. get formatByte(): number;
  3485. get floatStride(): number;
  3486. /**
  3487. * Index of Float32Array: vData
  3488. */
  3489. get vDataOffset(): number;
  3490. _isMeshBuffer: boolean;
  3491. vData: Float32Array;
  3492. iData: Uint16Array;
  3493. /**
  3494. * First vertex used in the current IA
  3495. */
  3496. vertexStart: number;
  3497. /**
  3498. * Vertex count used in the current IA
  3499. */
  3500. vertexRange: number;
  3501. /**
  3502. * First index used in the current IA
  3503. */
  3504. indexStart: number;
  3505. /**
  3506. * Index count used in the current IA
  3507. */
  3508. indexRange: number;
  3509. lastFilledIndex: number;
  3510. lastFilledVertex: number;
  3511. frame: any;
  3512. constructor(vertexFormat?: gfx.Attribute[]);
  3513. request(vertexCount: number, indexCount: number): boolean;
  3514. reserve(vertexCount: number, indexCount: number): boolean;
  3515. resize(vertexCount: number, indexCount: number): void;
  3516. updateRange(vertOffset: number, vertexCount: number, indexOffset: number, indexCount: number): void;
  3517. requestIA(device: gfx.Device): gfx.InputAssembler;
  3518. uploadBuffers(): void;
  3519. freeIAPool(): void;
  3520. reset(): void;
  3521. clear(): void;
  3522. protected _initIAInfo(device: gfx.Device): void;
  3523. protected _reallocBuffer(vCount: any, iCount: any): void;
  3524. setRenderDrawInfoAttributes(): void;
  3525. particleInitRenderDrawInfo(entity: __private._cocos_2d_renderer_render_entity__RenderEntity): void;
  3526. }
  3527. /**
  3528. * @internal
  3529. */
  3530. export interface IAssembler {
  3531. [key: string]: any;
  3532. }
  3533. /**
  3534. * @internal
  3535. */
  3536. export interface IAssemblerManager {
  3537. getAssembler(component: UIRenderer): IAssembler;
  3538. }
  3539. export namespace UIVertexFormat {
  3540. /**
  3541. * @en Get total components count for all attributes per vertex.
  3542. * @zh 获取每个顶点上所有属性的分量数总和
  3543. * @param attrs All attributes of the vertex format
  3544. * @returns Total components count
  3545. */
  3546. export function getComponentPerVertex(attrs: gfx.Attribute[]): number;
  3547. /**
  3548. * @en Get total stride for all attributes per vertex.
  3549. * @zh 获取每个顶点上所有属性的总步进
  3550. * @param attrs All attributes of the vertex format
  3551. * @returns Total stride
  3552. */
  3553. export function getAttributeStride(attrs: gfx.Attribute[]): number;
  3554. /**
  3555. * @en Vertex format with vector 3 position attribute
  3556. * @zh 包含三维位置属性的顶点格式
  3557. */
  3558. export const vfmt: gfx.Attribute[];
  3559. /**
  3560. * @en Vertex format with the following layout.
  3561. * 1. Vector 3 position attribute (Float32)
  3562. * 2. Vector 4 color attribute (Float32)
  3563. * @zh 包含以下数据的顶点格式
  3564. * 1. 三维位置属性(Float32)
  3565. * 2. RGBA 颜色属性(Float32)
  3566. */
  3567. export const vfmtPosColor: gfx.Attribute[];
  3568. /**
  3569. * @en Vertex format with the following layout
  3570. * 1. Vector 3 position attribute (Float32)
  3571. * 2. Vector 2 uv attribute (Float32)
  3572. * 3. Vector 4 color attribute (Float32)
  3573. * @zh 包含以下数据的顶点格式
  3574. * 1. 三维位置属性(Float32)
  3575. * 2. 二维贴图 UV 属性(Float32)
  3576. * 3. RGBA 颜色属性(Float32)
  3577. */
  3578. export const vfmtPosUvColor: gfx.Attribute[];
  3579. /**
  3580. * @en Vertex format with the following layout
  3581. * 1. Vector 3 position attribute (Float32)
  3582. * 2. Vector 2 uv attribute (Float32)
  3583. * 3. Byte 4 color attribute (Byte)
  3584. * @zh 包含以下数据的顶点格式
  3585. * 1. 三维位置属性(Float32)
  3586. * 2. 二维贴图 UV 属性(Float32)
  3587. * 3. RGBA 颜色属性(Byte)
  3588. */
  3589. export const vfmtPosUvColor4B: gfx.Attribute[];
  3590. /**
  3591. * @en Vertex format with the following layout
  3592. * 1. Vector 3 position attribute (Float32)
  3593. * 2. Vector 2 uv attribute (Float32)
  3594. * 3. First vector 4 color attribute (Float32)
  3595. * 4. Second vector 4 color attribute (Float32)
  3596. * @zh 包含以下数据的顶点格式
  3597. * 1. 三维位置属性(Float32)
  3598. * 2. 二维贴图 UV 属性(Float32)
  3599. * 3. 第一套 RGBA 颜色属性(Float32)
  3600. * 4. 第二套 RGBA 颜色属性(Float32)
  3601. */
  3602. export const vfmtPosUvTwoColor: gfx.Attribute[];
  3603. /**
  3604. * @en Vertex format with the following layout
  3605. * 1. Vector 3 position attribute (Float32)
  3606. * 2. Vector 2 uv attribute (Float32)
  3607. * 3. First byte 4 color attribute (Byte)
  3608. * 4. Second byte 4 color attribute (Byte)
  3609. * @zh 包含以下数据的顶点格式
  3610. * 1. 三维位置属性(Float32)
  3611. * 2. 二维贴图 UV 属性(Float32)
  3612. * 3. 第一套 RGBA 颜色属性(Byte)
  3613. * 4. 第二套 RGBA 颜色属性(Byte)
  3614. */
  3615. export const vfmtPosUvTwoColor4B: gfx.Attribute[];
  3616. }
  3617. /**
  3618. * @en UI rendering process
  3619. * @zh UI 渲染流程
  3620. */
  3621. export class UI implements __private._cocos_2d_renderer_i_batcher__IBatcher {
  3622. protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
  3623. get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
  3624. get currBufferAccessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3625. get batches(): memop.CachedArray<__private._cocos_2d_renderer_draw_batch__DrawBatch2D>;
  3626. set currStaticRoot(value: UIStaticBatch | null);
  3627. set currIsStatic(value: boolean);
  3628. device: gfx.Device;
  3629. constructor(_root: Root);
  3630. initialize(): boolean;
  3631. destroy(): void;
  3632. /**
  3633. * @en
  3634. * Add the managed Canvas.
  3635. *
  3636. * @zh
  3637. * 添加屏幕组件管理。
  3638. *
  3639. * @param comp @en The render root of 2d.
  3640. * @zh 2d 渲染入口组件。
  3641. */
  3642. addScreen(comp: RenderRoot2D): void;
  3643. /**
  3644. * @zh
  3645. * Removes the Canvas from the list.
  3646. *
  3647. * @param comp @en The target to removed.
  3648. * @zh 被移除的屏幕。
  3649. */
  3650. removeScreen(comp: RenderRoot2D): void;
  3651. sortScreens(): void;
  3652. getFirstRenderCamera(node: Node): renderer.scene.Camera | null;
  3653. update(): void;
  3654. uploadBuffers(): void;
  3655. reset(): void;
  3656. /**
  3657. * @zh 如果有必要,为相应的顶点布局切换网格缓冲区。
  3658. * @en Switch the mesh buffer for corresponding vertex layout if necessary.
  3659. * @param attributes use VertexFormat.vfmtPosUvColor by default
  3660. */
  3661. switchBufferAccessor(attributes?: gfx.Attribute[]): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  3662. registerBufferAccessor(key: number, accessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
  3663. updateBuffer(attributes: gfx.Attribute[], bid: number): void;
  3664. /**
  3665. * @en
  3666. * Render component data submission process of UI.
  3667. * The submitted vertex data is the UI for world coordinates.
  3668. * For example: The UI components except Graphics and UIModel.
  3669. *
  3670. * @zh
  3671. * UI 渲染组件数据提交流程(针对提交的顶点数据是世界坐标的提交流程,例如:除 Graphics 和 UIModel 的大部分 ui 组件)。
  3672. * 此处的数据最终会生成需要提交渲染的 model 数据。
  3673. *
  3674. * @param comp - The committed renderable component
  3675. * @param renderData - The render data being committed
  3676. * @param frame - Texture or sprite frame related to the draw batch, could be null
  3677. * @param assembler - The assembler for the current component, could be null
  3678. * @param transform - Node type transform, if passed, then batcher will consider it's using model matrix, could be null
  3679. */
  3680. commitComp(comp: UIRenderer, renderData: BaseRenderData | null, frame: __private._cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, assembler: any, transform: Node | null): void;
  3681. /**
  3682. * @en
  3683. * Render component data submission process for individual [[gfx.InputAssembler]]
  3684. * @zh
  3685. * 渲染组件中针对独立 [[gfx.InputAssembler]] 的提交流程
  3686. * 例如:Spine 和 DragonBones 等包含动态数据和材质的组件在内部管理 IA 并提交批次
  3687. * @param comp - The committed renderable component
  3688. * @param ia - The committed [[gfx.InputAssembler]]
  3689. * @param tex - The texture used
  3690. * @param mat - The material used
  3691. * @param [transform] - The related node transform if the render data is based on node's local coordinates
  3692. * @deprecated since v3.6.2, please use [[commitMiddleware]] instead
  3693. */
  3694. commitIA(renderComp: UIRenderer, ia: gfx.InputAssembler, tex?: __private._cocos_asset_assets_texture_base__TextureBase, mat?: Material, transform?: Node): void;
  3695. /**
  3696. * @en
  3697. * Render component data submission process for middleware2d components
  3698. * @zh
  3699. * 渲染组件中针对2D中间件组件渲染数据的提交流程
  3700. * 例如:Spine 和 DragonBones 包含动态数据和材质的组件
  3701. * @param comp - The committed renderable component
  3702. * @param meshBuffer - The MeshBuffer used
  3703. * @param indexOffset - indices offset
  3704. * @param indexCount - indices count
  3705. * @param tex - The texture used
  3706. * @param mat - The material used
  3707. * @param enableBatch - component support multi draw batch or not
  3708. */
  3709. commitMiddleware(comp: UIRenderer, meshBuffer: MeshBuffer, indexOffset: number, indexCount: number, tex: __private._cocos_asset_assets_texture_base__TextureBase, mat: Material, enableBatch: boolean): void;
  3710. /**
  3711. * @en
  3712. * Render component data submission process of UI.
  3713. * The submitted vertex data is the UI for local coordinates.
  3714. * For example: The UI components of Graphics and UIModel.
  3715. *
  3716. * @zh
  3717. * UI 渲染组件数据提交流程(针对例如: Graphics 和 UIModel 等数据量较为庞大的 ui 组件)。
  3718. *
  3719. * @param comp - The committed renderable component
  3720. * @param model - The committed model
  3721. * @param mat - The material used, could be null
  3722. */
  3723. commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): void;
  3724. setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
  3725. endStaticBatch(): void;
  3726. /**
  3727. * @en
  3728. * Submit separate render data.
  3729. * This data does not participate in the batch.
  3730. *
  3731. * @zh
  3732. * 提交独立渲染数据.
  3733. * @param comp @en The UIStaticBatch component.
  3734. * @zh 静态组件
  3735. */
  3736. commitStaticBatch(comp: UIStaticBatch): void;
  3737. /**
  3738. * @en
  3739. * End a section of render data and submit according to the batch condition.
  3740. *
  3741. * @zh
  3742. * 根据合批条件,结束一段渲染数据并提交。
  3743. */
  3744. autoMergeBatches(renderComp?: UIRenderer): void;
  3745. /**
  3746. * @en
  3747. * Force changes to current batch data and merge
  3748. *
  3749. * @zh
  3750. * 强行修改当前批次数据并合并。
  3751. *
  3752. * @param material @en The material of the current batch.
  3753. * @zh 当前批次的材质。
  3754. * @param sprite @en Sprite frame of current batch.
  3755. * @zh 当前批次的精灵帧。
  3756. */
  3757. forceMergeBatches(material: Material, frame: __private._cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): void;
  3758. resetRenderStates(): void;
  3759. /**
  3760. * @en
  3761. * Forced to merge the data of the previous batch to start a new batch.
  3762. *
  3763. * @zh
  3764. * 强制合并上一个批次的数据,开启新一轮合批。
  3765. */
  3766. finishMergeBatches(): void;
  3767. /**
  3768. * @en
  3769. * Force to change the current material.
  3770. *
  3771. * @zh
  3772. * 强制刷新材质。
  3773. */
  3774. flushMaterial(mat: Material): void;
  3775. walk(node: Node, level?: number): void;
  3776. syncMeshBuffersToNative(accId: number, buffers: MeshBuffer[]): void;
  3777. }
  3778. /**
  3779. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  3780. * @internal
  3781. */
  3782. export class UIDrawBatch extends __private._cocos_2d_renderer_draw_batch__DrawBatch2D {
  3783. }
  3784. export class QuadRenderData extends MeshRenderData {
  3785. constructor(vertexFormat: any);
  3786. }
  3787. /**
  3788. * @en A utils class for parsing HTML texts. The parsed results will be an object array.
  3789. * @zh 一个用于解析HTML文本的工具类。解析后的结果将是一个对象数组。
  3790. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3791. */
  3792. export interface IHtmlTextParserResultObj {
  3793. text?: string;
  3794. style?: IHtmlTextParserStack;
  3795. }
  3796. /**
  3797. * @en Html Text Parser Stack interface
  3798. * @zh Html 文本解析器接口
  3799. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3800. */
  3801. export interface IHtmlTextParserStack {
  3802. color?: string;
  3803. size?: number;
  3804. event?: {
  3805. [k: string]: string;
  3806. };
  3807. isNewLine?: boolean;
  3808. isImage?: boolean;
  3809. src?: string;
  3810. imageWidth?: number;
  3811. imageHeight?: number;
  3812. imageOffset?: string;
  3813. imageAlign?: string;
  3814. underline?: boolean;
  3815. italic?: boolean;
  3816. bold?: boolean;
  3817. outline?: {
  3818. color: string;
  3819. width: number;
  3820. };
  3821. }
  3822. /**
  3823. * @en Html Text Parser Stack
  3824. * @zh Html 文本解析器
  3825. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  3826. */
  3827. export class HtmlTextParser {
  3828. constructor();
  3829. parse(htmlString: string): IHtmlTextParserResultObj[];
  3830. }
  3831. export function getBaselineOffset(): number;
  3832. /**
  3833. * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future.
  3834. */
  3835. export function isUnicodeCJK(ch: string): boolean;
  3836. /**
  3837. * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future.
  3838. */
  3839. export function isUnicodeSpace(ch: string): boolean;
  3840. /**
  3841. * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future.
  3842. */
  3843. export function safeMeasureText(ctx: CanvasRenderingContext2D, string: string, desc?: string): number;
  3844. export function getSymbolLength(str: string): number;
  3845. export function getSymbolAt(str: string, index: number): string;
  3846. export function getSymbolCodeAt(str: string, index: number): string;
  3847. /**
  3848. * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future.
  3849. */
  3850. export function fragmentText(stringToken: string, allWidth: number, maxWidth: number, measureText: (string: string) => number): string[];
  3851. export const BASELINE_RATIO = 0.26;
  3852. export const MIDDLE_RATIO: number;
  3853. export class LRUCache {
  3854. constructor(size: any);
  3855. moveToHead(node: any): void;
  3856. put(key: any, value: any): void;
  3857. remove(node: any): void;
  3858. get(key: any): number | null;
  3859. clear(): void;
  3860. has(key: any): boolean;
  3861. delete(key: any): void;
  3862. }
  3863. /**
  3864. * @en The dynamic atlas manager which manages all runtime dynamic packed atlas texture for UI rendering.
  3865. * It generates a maximum of [[maxAtlasCount]] atlas texture, all atlas texture have the size of [[textureSize]].
  3866. * Normally the [[Root.batcher2D]] is in charge of submitting sprite frames to the dynamic atlas manager, the process is transparent to user.
  3867. * Note that the first committed sprite frame will define the filter settings of the atlas textures,
  3868. * only sprite frame with the same setting will be accepted afterward.
  3869. * @zh 动态合图的管理器,管理所有运行时动态合成的图集,主要用于 UI 渲染。
  3870. * 该管理器支持生成 [[maxAtlasCount]] 张动态合图,并且所有合图都有同样的 [[textureSize]] 像素尺寸。
  3871. * 一般来说 [[Root.batcher2D]] 负责提交 [[SpriteFrame]] 到动态合图管理器中,这个过程对于开发者是透明的。
  3872. * 需要注意的是,第一个提交的 [[SpriteFrame]] 会决定图集的过滤器参数,在此之后只有同样参数的贴图才会被管理器接受。
  3873. */
  3874. export class DynamicAtlasManager extends System {
  3875. static instance: DynamicAtlasManager;
  3876. /**
  3877. * @en
  3878. * Enable or disable the dynamic atlas.
  3879. *
  3880. * @zh
  3881. * 开启或关闭动态图集。
  3882. */
  3883. get enabled(): boolean;
  3884. set enabled(value: boolean);
  3885. /**
  3886. * @en
  3887. * The maximum number of atlases that can be created.
  3888. *
  3889. * @zh
  3890. * 可以创建的最大图集数量。
  3891. */
  3892. get maxAtlasCount(): number;
  3893. set maxAtlasCount(value: number);
  3894. /**
  3895. * @en
  3896. * Get the current created atlas count.
  3897. *
  3898. * @zh
  3899. * 获取当前已经创建的图集数量。
  3900. */
  3901. get atlasCount(): number;
  3902. /**
  3903. * @en
  3904. * Whether to enable textureBleeding.
  3905. *
  3906. * @zh
  3907. * 是否开启 textureBleeding。
  3908. */
  3909. get textureBleeding(): boolean;
  3910. set textureBleeding(enable: boolean);
  3911. /**
  3912. * @en
  3913. * The size of the created atlas.
  3914. *
  3915. * @zh
  3916. * 创建的图集的宽高。
  3917. */
  3918. get textureSize(): number;
  3919. set textureSize(value: number);
  3920. /**
  3921. * @en
  3922. * The maximum size of the picture that can be added to the atlas.
  3923. *
  3924. * @zh
  3925. * 可以添加进图集的图片的最大尺寸。
  3926. */
  3927. get maxFrameSize(): number;
  3928. set maxFrameSize(value: number);
  3929. /**
  3930. * @internal
  3931. */
  3932. init(): void;
  3933. /**
  3934. * @en
  3935. * Append a sprite frame into the dynamic atlas.
  3936. *
  3937. * @zh
  3938. * 添加碎图进入动态图集。
  3939. *
  3940. * @method insertSpriteFrame
  3941. * @param spriteFrame the sprite frame that will be inserted in the atlas.
  3942. */
  3943. insertSpriteFrame(spriteFrame: any): {
  3944. x: number;
  3945. y: number;
  3946. texture: __private._cocos_2d_utils_dynamic_atlas_atlas__DynamicAtlasTexture;
  3947. } | null;
  3948. /**
  3949. * @en
  3950. * Reset all dynamic atlases, and all existing ones will be destroyed.
  3951. *
  3952. * @zh
  3953. * 重置所有动态图集,已有的动态图集会被销毁。
  3954. *
  3955. * @method reset
  3956. */
  3957. reset(): void;
  3958. /**
  3959. * @en
  3960. * Delete a sprite from the atlas.
  3961. *
  3962. * @zh
  3963. * 从动态图集中删除某张碎图。
  3964. *
  3965. * @method deleteAtlasSpriteFrame
  3966. * @param spriteFrame the sprite frame that will be removed from the atlas.
  3967. */
  3968. deleteAtlasSpriteFrame(spriteFrame: any): void;
  3969. /**
  3970. * @en
  3971. * Delete a texture from the atlas.
  3972. *
  3973. * @zh
  3974. * 从动态图集中删除某张纹理。
  3975. *
  3976. * @method deleteAtlasTexture
  3977. * @param texture the texture that will be removed from the atlas.
  3978. */
  3979. deleteAtlasTexture(texture: any): void;
  3980. /**
  3981. * @en
  3982. * Pack the sprite in the dynamic atlas and update the atlas information of the sprite frame.
  3983. *
  3984. * @zh
  3985. * 将图片打入动态图集,并更新该图片的图集信息。
  3986. *
  3987. * @method packToDynamicAtlas
  3988. * @param frame the sprite frame that will be packed in the dynamic atlas.
  3989. */
  3990. packToDynamicAtlas(comp: any, frame: any): void;
  3991. }
  3992. /**
  3993. * @en The singleton instance of [[DynamicAtlasManager]], please use [[DynamicAtlasManager.instance]] instead.
  3994. * @zh [[DynamicAtlasManager]] 的单例对象,请直接使用 [[DynamicAtlasManager.instance]]。
  3995. * @deprecated since v3.7
  3996. */
  3997. export const dynamicAtlasManager: DynamicAtlasManager;
  3998. export namespace utils {
  3999. /**
  4000. * @en Finds a node by hierarchy path, the path is case-sensitive.
  4001. * It will traverse the hierarchy by splitting the path using '/' character.
  4002. * This function will still returns the node even if it is inactive.
  4003. * It is recommended to not use this function every frame instead cache the result at startup.
  4004. * @zh 通过路径从节点树中查找节点的方法,路径是大小写敏感的,并且通过 `/` 来分隔节点层级。
  4005. * 即使节点的状态是未启用的也可以找到,建议将结果缓存,而不是每次需要都去查找。
  4006. * @param path The path of the target node
  4007. * @param referenceNode If given, the search will be limited in the sub node tree of the reference node
  4008. */
  4009. export function find(path: string, referenceNode?: Node): Node | null;
  4010. /**
  4011. * @en
  4012. * save a color buffer to a PPM file
  4013. * @zh
  4014. * 保存一个颜色缓冲到 PPM 文件中
  4015. * @param buffer color buffer
  4016. * @param w width
  4017. * @param h height
  4018. */
  4019. export function toPPM(buffer: Uint8Array, w: number, h: number): string;
  4020. export function readMesh(mesh: Mesh, iPrimitive?: number): primitives.IGeometry;
  4021. /**
  4022. * @deprecated
  4023. */
  4024. export function createMesh(geometry: primitives.IGeometry, out?: Mesh, options?: primitives.ICreateMeshOptions): Mesh;
  4025. export namespace createMesh {
  4026. /**
  4027. * @deprecated
  4028. */
  4029. export interface IOptions {
  4030. /**
  4031. * @en calculate mesh's aabb or not
  4032. * @zh 是否计算模型的包围盒。
  4033. */
  4034. calculateBounds?: boolean;
  4035. }
  4036. }
  4037. /**
  4038. * @en mesh utility class, use to create mesh.
  4039. * @zh 网格工具类,用于创建网格。
  4040. */
  4041. export class MeshUtils {
  4042. /**
  4043. * @en create a static mesh.
  4044. * @zh 创建一个静态网格。
  4045. * @param geometry @en geometry data use for creating @zh 用于创建的几何数据
  4046. * @param out @en output static mesh @zh 输出的静态网格
  4047. * @param options @en options of creating @zh 创建选项
  4048. * @return @en The created static mesh, which is same as out @zh 新创建的静态网格,同 out 参数
  4049. */
  4050. static createMesh(geometry: primitives.IGeometry, out?: Mesh, options?: primitives.ICreateMeshOptions): Mesh;
  4051. /**
  4052. * @en create a dynamic mesh.
  4053. * @zh 创建一个动态网格。
  4054. * @param primitiveIndex @en sub mesh index @zh 子网格索引
  4055. * @param geometry @en geometry data use for creating @zh 用于创建的几何数据
  4056. * @param out @en output dynamic mesh @zh 输出的动态网格
  4057. * @param options @en options of creating @zh 创建选项
  4058. * @return @en The created dynamic mesh, which is same as out @zh 新创建的动态网格,同 out 参数
  4059. */
  4060. static createDynamicMesh(primitiveIndex: number, geometry: primitives.IDynamicGeometry, out?: Mesh, options?: primitives.ICreateDynamicMeshOptions): Mesh;
  4061. }
  4062. export function readBuffer(target: DataView, format?: gfx.Format, offset?: number, length?: number, stride?: number, out?: number[]): number[];
  4063. export function writeBuffer(target: DataView, data: number[], format?: gfx.Format, offset?: number, stride?: number): void;
  4064. export function mapBuffer(target: DataView, callback: (cur: number, idx: number, view: DataView) => number, format?: gfx.Format, offset?: number, length?: number, stride?: number, out?: DataView): DataView;
  4065. }
  4066. /**
  4067. * @en Utility for 3d model static batching
  4068. * @zh 服务于 3D 模型静态合批的工具类
  4069. */
  4070. export class BatchingUtility {
  4071. /**
  4072. * @en
  4073. * Collect the Models under `staticModelRoot`,
  4074. * merge all the meshes statically into one (while disabling each component),
  4075. * and attach it to a new Model on `batchedRoot`.
  4076. * The world transform of each model is guaranteed to be preserved.
  4077. *
  4078. * For a more fine-grained control over the process, use `Mesh.merge` directly.
  4079. * @zh
  4080. * 在`staticModelRoot`下收集模型。
  4081. * 将所有的网格静态地合并成一个(同时禁用每个组件)。
  4082. * 并将其附加到 `batchedRoot` 上的一个新模型。
  4083. * 每个模型的世界变换都被保证保留下来。
  4084. * 如果要对这个过程进行更精细的控制,可以直接使用 `Mesh.merge`。
  4085. * @param staticModelRoot root of all the static models to be batched
  4086. * @param batchedRoot the target output node
  4087. */
  4088. static batchStaticModel(staticModelRoot: Node, batchedRoot: Node): boolean;
  4089. /**
  4090. * @en
  4091. * Undoes everything `batchStaticModel` did.
  4092. * @zh
  4093. * 回退 `batchStaticModel` 做的工作
  4094. *
  4095. * @param staticModelRoot root of all the static models to be batched
  4096. * @param batchedRoot the target output node
  4097. */
  4098. static unbatchStaticModel(staticModelRoot: Node, batchedRoot: Node): boolean;
  4099. }
  4100. /**
  4101. * @en A representation of a mesh asset
  4102. * A mesh can contain multiple sub-mesh resources. The mesh mainly provides data such as vertices and indices for model instances.
  4103. * @zh 代表一个网格资源
  4104. * 一个网格可包含多个子网格资源,网格主要为模型实例提供顶点,索引等数据
  4105. */
  4106. export class Mesh extends Asset {
  4107. /**
  4108. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  4109. */
  4110. get _nativeAsset(): ArrayBuffer;
  4111. set _nativeAsset(value: ArrayBuffer);
  4112. /**
  4113. * @en The sub meshes count of the mesh.
  4114. * @zh 此网格的子网格数量。
  4115. * @deprecated Please use [[renderingSubMeshes.length]] instead
  4116. */
  4117. get subMeshCount(): number;
  4118. /**
  4119. * @en The minimum position of all vertices in the mesh
  4120. * @zh (各分量都)小于等于此网格任何顶点位置的最大位置。
  4121. * @deprecated Please use [[struct.minPosition]] instead
  4122. */
  4123. get minPosition(): Readonly<math.Vec3> | undefined;
  4124. /**
  4125. * @en The maximum position of all vertices in the mesh
  4126. * @zh (各分量都)大于等于此网格任何顶点位置的最大位置。
  4127. * @deprecated Please use [[struct.maxPosition]] instead
  4128. */
  4129. get maxPosition(): Readonly<math.Vec3> | undefined;
  4130. /**
  4131. * @en The struct of the mesh
  4132. * @zh 此网格的结构。
  4133. */
  4134. get struct(): Mesh.IStruct;
  4135. /**
  4136. * @en The actual data of the mesh
  4137. * @zh 此网格的数据。
  4138. */
  4139. get data(): Uint8Array;
  4140. /**
  4141. * @en The hash of the mesh
  4142. * @zh 此网格的哈希值。
  4143. */
  4144. get hash(): number;
  4145. /**
  4146. * @en The index of the joint buffer of all sub meshes in the joint map buffers
  4147. * @zh 所有子网格的关节索引集合
  4148. */
  4149. get jointBufferIndices(): number[];
  4150. /**
  4151. * @en The sub meshes for rendering. Mesh could be split into different sub meshes for rendering.
  4152. * @zh 此网格创建的渲染网格。
  4153. */
  4154. get renderingSubMeshes(): RenderingSubMesh[];
  4155. /**
  4156. * @en morph rendering data
  4157. * @zh 变形渲染数据
  4158. */
  4159. morphRendering: __private._cocos_3d_assets_morph_rendering__MorphRendering | null;
  4160. constructor();
  4161. /**
  4162. * @en complete loading callback
  4163. * @zh 加载完成回调
  4164. */
  4165. onLoaded(): void;
  4166. /**
  4167. * @en mesh init
  4168. * @zh 网格初始化函数
  4169. */
  4170. initialize(): void;
  4171. /**
  4172. * @en update dynamic sub mesh geometry
  4173. * @zh 更新动态子网格的几何数据
  4174. * @param primitiveIndex @en sub mesh index @zh 子网格索引
  4175. * @param dynamicGeometry @en sub mesh geometry data @zh 子网格几何数据
  4176. */
  4177. updateSubMesh(primitiveIndex: number, dynamicGeometry: primitives.IDynamicGeometry): void;
  4178. /**
  4179. * @en Destroy the mesh and release all related GPU resources
  4180. * @zh 销毁此网格,并释放它占有的所有 GPU 资源。
  4181. */
  4182. destroy(): boolean;
  4183. /**
  4184. * @en Release all related GPU resources
  4185. * @zh 释放此网格占有的所有 GPU 资源。
  4186. */
  4187. destroyRenderingMesh(): void;
  4188. /**
  4189. * @en Reset the struct and data of the mesh
  4190. * @zh 重置此网格的结构和数据。
  4191. * @param struct @en The new struct @zh 新结构
  4192. * @param data @en The new data @zh 新数据
  4193. * @deprecated Will be removed in v3.0.0, please use [[reset]] instead
  4194. */
  4195. assign(struct: Mesh.IStruct, data: Uint8Array): void;
  4196. /**
  4197. * @en Reset the mesh with mesh creation information
  4198. * @zh 重置此网格。
  4199. * @param info @en Mesh creation information including struct and data @zh 网格创建信息,包含结构及数据
  4200. */
  4201. reset(info: Mesh.ICreateInfo): void;
  4202. /**
  4203. * @en Get [[geometry.AABB]] bounds in the skeleton's bone space
  4204. * @zh 获取骨骼变换空间内下的 [[geometry.AABB]] 包围盒
  4205. * @param skeleton @en skeleton data @zh 骨骼信息
  4206. * @param skeleton @en skeleton data @zh 骨骼信息
  4207. */
  4208. getBoneSpaceBounds(skeleton: Skeleton): (geometry.AABB | null)[];
  4209. /**
  4210. * @en Merge the given mesh into the current mesh
  4211. * @zh 合并指定的网格到此网格中。
  4212. * @param mesh @en The mesh to be merged @zh 要合并的网格
  4213. * @param worldMatrix @en The world matrix of the given mesh @zh 给定网格的模型变换矩阵
  4214. * @param validate @en Whether to validate the mesh @zh 是否验证网格顶点布局
  4215. * @returns @en whether the merging was successful or not @zh 返回合并成功与否
  4216. */
  4217. merge(mesh: Mesh, worldMatrix?: math.Mat4, validate?: boolean): boolean;
  4218. /**
  4219. * @en Validation for whether the given mesh can be merged into the current mesh.
  4220. * To pass the validation, it must satisfy either of these two requirements:
  4221. * - When the current mesh have no data
  4222. * - When the two mesh have the same vertex bundle count, the same sub meshes count, and the same sub mesh layout.
  4223. *
  4224. * Same mesh layout means:
  4225. * - They have the same primitive type and reference to the same amount vertex bundle with the same indices.
  4226. * - And they all have or don't have index view
  4227. * @zh 验证指定网格是否可以合并至当前网格。
  4228. *
  4229. * 当满足以下条件之一时,指定网格可以合并至当前网格:
  4230. * - 当前网格无数据而待合并网格有数据;
  4231. * - 它们的顶点块数目相同且对应顶点块的布局一致,并且它们的子网格数目相同且对应子网格的布局一致。
  4232. *
  4233. * 两个顶点块布局一致当且仅当:
  4234. * - 它们具有相同数量的顶点属性且对应的顶点属性具有相同的属性格式。
  4235. *
  4236. * 两个子网格布局一致,当且仅当:
  4237. * - 它们具有相同的图元类型并且引用相同数量、相同索引的顶点块;并且,
  4238. * - 要么都需要索引绘制,要么都不需要索引绘制。
  4239. * @param mesh @en The other mesh to be validated @zh 待验证的网格
  4240. */
  4241. validateMergingMesh(mesh: Mesh): boolean;
  4242. /**
  4243. * @en Read the requested attribute of the given sub mesh
  4244. * @zh 读取子网格的指定属性。
  4245. * @param primitiveIndex @en Sub mesh index @zh 子网格索引
  4246. * @param attributeName @en Attribute name @zh 属性名称
  4247. * @returns @en Return null if not found or can't read, otherwise, will create a large enough typed array to contain all data of the attribute,
  4248. * the array type will match the data type of the attribute. @zh 读取失败返回 null, 否则返回对应的类型数组
  4249. */
  4250. readAttribute(primitiveIndex: number, attributeName: gfx.AttributeName): __private.__types_globals__TypedArray | null;
  4251. /**
  4252. * @en Read the requested attribute of the given sub mesh and fill into the given buffer.
  4253. * @zh 读取子网格的指定属性到目标缓冲区中。
  4254. * @param primitiveIndex @en Sub mesh index @zh 子网格索引
  4255. * @param attributeName @en Attribute name @zh 属性名称
  4256. * @param buffer @en The target array buffer @zh 目标缓冲区
  4257. * @param stride @en attribute stride @zh 属性跨距
  4258. * @param offset @en The offset of the first attribute in the target buffer @zh 第一个属性在目标缓冲区的偏移
  4259. * @returns @en false if failed to access attribute, true otherwise @zh 是否成功拷贝
  4260. */
  4261. copyAttribute(primitiveIndex: number, attributeName: gfx.AttributeName, buffer: ArrayBuffer, stride: number, offset: number): boolean;
  4262. /**
  4263. * @en Read the indices data of the given sub mesh
  4264. * @zh 读取子网格的索引数据。
  4265. * @param primitiveIndex @en Sub mesh index @zh 子网格索引
  4266. * @returns @en Return null if not found or can't read, otherwise, will create a large enough typed array to contain all indices data,
  4267. * the array type will use the corresponding stride size. @zh 读取失败返回 null,否则返回索引数据
  4268. */
  4269. readIndices(primitiveIndex: number): Uint8Array | Uint16Array | Uint32Array | null;
  4270. /**
  4271. * @en Read the indices data of the given sub mesh and fill into the given array
  4272. * @zh 读取子网格的索引数据到目标数组中。
  4273. * @param primitiveIndex @en Sub mesh index @zh 子网格索引
  4274. * @param outputArray @en The target output array @zh 目标索引数组
  4275. * @returns @en Return false if failed to access the indices data, return true otherwise. @zh 拷贝失败返回 false, 否则返回 true
  4276. */
  4277. copyIndices(primitiveIndex: number, outputArray: number[] | ArrayBufferView): boolean;
  4278. /**
  4279. * @en Read the format by attributeName of submesh
  4280. * @zh 根据属性名读取子网格的属性信息。
  4281. * @param primitiveIndex @en Sub mesh index @zh 子网格索引
  4282. * @param attributeName @en Attribute name @zh 属性名称
  4283. * @returns @en Return null if failed to read format, return the format otherwise. @zh 读取失败返回 null, 否则返回 format
  4284. */
  4285. readAttributeFormat(primitiveIndex: number, attributeName: gfx.AttributeName): gfx.FormatInfo | null;
  4286. /**
  4287. * @en default init
  4288. * @zh 默认初始化
  4289. * @param uuid @en asset uuid @zh 资源 uuid
  4290. */
  4291. initDefault(uuid?: string): void;
  4292. /**
  4293. * @en Set whether the data of this mesh could be accessed (read or wrote), it could be used only for static mesh
  4294. * @zh 设置此网格的数据是否可被存取,此接口只针对静态网格资源生效
  4295. * @param allowDataAccess @en Indicate whether the data of this mesh could be accessed (read or wrote) @zh 是否允许存取网格数据
  4296. */
  4297. set allowDataAccess(allowDataAccess: boolean);
  4298. /**
  4299. * @en Get whether the data of this mesh could be read or wrote
  4300. * @zh 获取此网格的数据是否可被存取
  4301. * @return @en whether the data of this mesh could be accessed (read or wrote) @zh 此网格的数据是否可被存取
  4302. */
  4303. get allowDataAccess(): boolean;
  4304. }
  4305. export namespace Mesh {
  4306. export interface IBufferView {
  4307. offset: number;
  4308. length: number;
  4309. count: number;
  4310. stride: number;
  4311. }
  4312. /**
  4313. * @en Vertex bundle, it describes a set of interleaved vertex attributes and their values.
  4314. * @zh 顶点块。顶点块描述了一组**交错排列**(interleaved)的顶点属性并存储了顶点属性的实际数据。<br>
  4315. * 交错排列是指在实际数据的缓冲区中,每个顶点的所有属性总是依次排列,并总是出现在下一个顶点的所有属性之前。
  4316. */
  4317. export interface IVertexBundle {
  4318. /**
  4319. * @en The actual value for all vertex attributes.
  4320. * You must use DataView to access the data.
  4321. * Because there is no guarantee that the starting offsets of all properties are byte aligned as required by TypedArray.
  4322. * @zh 所有顶点属性的实际数据块。
  4323. * 你必须使用 DataView 来读取数据。
  4324. * 因为不能保证所有属性的起始偏移都按 TypedArray 要求的字节对齐。
  4325. */
  4326. view: IBufferView;
  4327. /**
  4328. * @en All attributes included in the bundle
  4329. * @zh 包含的所有顶点属性。
  4330. */
  4331. attributes: gfx.Attribute[];
  4332. }
  4333. export interface IMeshCluster {
  4334. clusterView: IBufferView;
  4335. triangleView: IBufferView;
  4336. vertexView: IBufferView;
  4337. coneView?: IBufferView;
  4338. }
  4339. /**
  4340. * @en Sub mesh contains a list of primitives with the same type (Point, Line or Triangle)
  4341. * @zh 子网格。子网格由一系列相同类型的图元组成(例如点、线、面等)。
  4342. */
  4343. export interface ISubMesh {
  4344. /**
  4345. * @en The vertex bundle references used by the sub mesh.
  4346. * @zh 此子网格引用的顶点块,索引至网格的顶点块数组。
  4347. */
  4348. vertexBundelIndices: number[];
  4349. /**
  4350. * @en The primitive mode of the sub mesh
  4351. * @zh 此子网格的图元类型。
  4352. */
  4353. primitiveMode: gfx.PrimitiveMode;
  4354. /**
  4355. * @en The index data of the sub mesh
  4356. * @zh 此子网格使用的索引数据。
  4357. */
  4358. indexView?: IBufferView;
  4359. /**
  4360. * @en The joint map index in [[IStruct.jointMaps]]. Could be absent
  4361. * @zh 此子网格使用的关节索引映射表在 [[IStruct.jointMaps]] 中的索引。
  4362. * 如未定义或指向的映射表不存在,则默认 VB 内所有关节索引数据直接对应骨骼资源数据。
  4363. */
  4364. jointMapIndex?: number;
  4365. /**
  4366. * @en The cluster data of the sub mesh
  4367. */
  4368. cluster?: IMeshCluster;
  4369. }
  4370. /**
  4371. * @en dynamic info used to create dyanmic mesh
  4372. * @zh 动态信息,用于创建动态网格
  4373. */
  4374. export interface IDynamicInfo {
  4375. /**
  4376. * @en max submesh count
  4377. * @zh 最大子模型个数。
  4378. */
  4379. maxSubMeshes: number;
  4380. /**
  4381. * @en max submesh vertex count
  4382. * @zh 子模型最大顶点个数。
  4383. */
  4384. maxSubMeshVertices: number;
  4385. /**
  4386. * @en max submesh index count
  4387. * @zh 子模型最大索引个数。
  4388. */
  4389. maxSubMeshIndices: number;
  4390. }
  4391. /**
  4392. * @en dynamic struct
  4393. * @zh 动态结构体
  4394. */
  4395. export interface IDynamicStruct {
  4396. /**
  4397. * @en dynamic mesh info
  4398. * @zh 动态模型信息。
  4399. */
  4400. info: IDynamicInfo;
  4401. /**
  4402. * @en dynamic submesh bounds
  4403. * @zh 动态子模型包围盒。
  4404. */
  4405. bounds: geometry.AABB[];
  4406. }
  4407. /**
  4408. * @en The structure of the mesh
  4409. * @zh 描述了网格的结构。
  4410. */
  4411. export interface IStruct {
  4412. /**
  4413. * @en All vertex bundles of the mesh
  4414. * @zh 此网格所有的顶点块。
  4415. */
  4416. vertexBundles: IVertexBundle[];
  4417. /**
  4418. * @en All sub meshes
  4419. * @zh 此网格的所有子网格。
  4420. */
  4421. primitives: ISubMesh[];
  4422. /**
  4423. * @en The minimum position of all vertices in the mesh
  4424. * @zh (各分量都)小于等于此网格任何顶点位置的最大位置。
  4425. */
  4426. minPosition?: math.Vec3;
  4427. /**
  4428. * @en The maximum position of all vertices in the mesh
  4429. * @zh (各分量都)大于等于此网格任何顶点位置的最小位置。
  4430. */
  4431. maxPosition?: math.Vec3;
  4432. /**
  4433. * @en The joint index map list.
  4434. * @zh 此网格使用的关节索引映射关系列表,数组长度应为子模型中实际使用到的所有关节,
  4435. * 每个元素都对应一个原骨骼资源里的索引,按子模型 VB 内的实际索引排列。
  4436. */
  4437. jointMaps?: number[][];
  4438. /**
  4439. * @en The morph information of the mesh
  4440. * @zh 网格的形变数据
  4441. */
  4442. morph?: Morph;
  4443. /**
  4444. * @en The specific data of the dynamic mesh
  4445. * @zh 动态网格特有数据
  4446. */
  4447. dynamic?: IDynamicStruct;
  4448. /**
  4449. * @en Whether the mesh data is quantized to reduce memory usage
  4450. * @zh 此网格数据是否经过量化以减少内存占用。
  4451. */
  4452. quantized?: boolean;
  4453. /**
  4454. * @en Whether the mesh data is encoded to reduce memory usage
  4455. * @zh
  4456. */
  4457. encoded?: boolean;
  4458. /**
  4459. * @en Whether the mesh data is compressed to reduce memory usage
  4460. * @zh 此网格数据是否经过压缩以减少内存占用。
  4461. */
  4462. compressed?: boolean;
  4463. /**
  4464. * @en Whether the mesh contains cluster data
  4465. * @zh 此网格是否包含 cluster 数据。
  4466. */
  4467. cluster?: boolean;
  4468. }
  4469. /**
  4470. * @en The create info of the mesh
  4471. * @zh 网格创建信息
  4472. */
  4473. export interface ICreateInfo {
  4474. /**
  4475. * @en Mesh structure
  4476. * @zh 网格结构。
  4477. */
  4478. struct: Mesh.IStruct;
  4479. /**
  4480. * @en Mesh binary data
  4481. * @zh 网格二进制数据。
  4482. */
  4483. data: Uint8Array;
  4484. }
  4485. }
  4486. /**
  4487. * @en The skeleton asset. It stores the path related to [[SkinnedMeshRenderer.skinningRoot]] of all bones and its bind pose matrix.
  4488. * @zh 骨骼资源。骨骼资源记录了每个关节(相对于 [[SkinnedMeshRenderer.skinningRoot]])的路径以及它的绑定姿势矩阵。
  4489. */
  4490. export class Skeleton extends Asset {
  4491. /**
  4492. * @en The path of all bones, the length always equals the length of [[bindposes]]
  4493. * @zh 所有关节的路径。该数组的长度始终与 [[bindposes]] 的长度相同。
  4494. */
  4495. get joints(): string[];
  4496. set joints(value: string[]);
  4497. /**
  4498. * @en The bind poses matrix of all bones, the length always equals the length of [[joints]]
  4499. * @zh 所有关节的绑定姿势矩阵。该数组的长度始终与 [[joints]] 的长度相同。
  4500. */
  4501. get bindposes(): math.Mat4[];
  4502. set bindposes(value: math.Mat4[]);
  4503. /**
  4504. * @en Gets the inverse bind poses matrix
  4505. * @zh 获取反向绑定姿势矩阵
  4506. */
  4507. get inverseBindposes(): math.Mat4[];
  4508. /**
  4509. * @en Gets the hash of the skeleton asset
  4510. * @zh 获取骨骼资源的哈希值
  4511. */
  4512. get hash(): number;
  4513. destroy(): boolean;
  4514. /**
  4515. * @en Check whether the skeleton is validate which means it has both joints and bindposes data.
  4516. * @zh 检查当前骨骼对象是否是有效的,取决于它是否包含关节路径和绑定姿势数据。
  4517. * @returns @en Whether the skeleton is valid or not @zh 此骨骼是否有效
  4518. */
  4519. validate(): boolean;
  4520. }
  4521. /**
  4522. * @en Mesh morph data structure to describe the sub meshes data of all sub meshes,
  4523. * it also contains all sub mesh morphs, global weights configuration and target names.
  4524. * Normally the global weights configuration should be identical to the sub mesh morph weights,
  4525. * but if not, the global weights in morph is less prioritized.
  4526. * @zh 网格的形变数据结构,包含所有子网格形变数据,全局的权重配置和所有形变目标名称。
  4527. * 一般来说,全局权重配置和子网格形变数据中保持一致,但如果有差异,以子网格形变数据中的权重配置为准。
  4528. */
  4529. export interface Morph {
  4530. /**
  4531. * Morph data of each sub-mesh.
  4532. */
  4533. subMeshMorphs: (SubMeshMorph | null)[];
  4534. /**
  4535. * Common initial weights of each sub-mesh.
  4536. */
  4537. weights?: number[];
  4538. /**
  4539. * Name of each target of each sub-mesh morph.
  4540. * This field is only meaningful if every sub-mesh has the same number of targets.
  4541. */
  4542. targetNames?: string[];
  4543. }
  4544. /**
  4545. * @en Morph target contains all displacements data of each vertex attribute like position and normal.
  4546. * @zh 形变目标数据包含网格顶点属性在形变下的变化值,可能包含位移、法线等属性
  4547. */
  4548. export interface MorphTarget {
  4549. /**
  4550. * Displacement of each target attribute.
  4551. */
  4552. displacements: Mesh.IBufferView[];
  4553. }
  4554. /**
  4555. * @en Sub mesh morph data describes all morph targets for one sub mesh,
  4556. * including attributes in each morph target, morph targets data and weights corresponding each targets.
  4557. * @zh 子网格形变数据描述一个子网格下所有的形变目标数据,包含顶点形变属性,形变目标数据和对应每个形变目标的权重。
  4558. */
  4559. export interface SubMeshMorph {
  4560. /**
  4561. * Attributes to morph.
  4562. */
  4563. attributes: gfx.AttributeName[];
  4564. /**
  4565. * Targets.
  4566. */
  4567. targets: MorphTarget[];
  4568. /**
  4569. * Initial weights of each target.
  4570. */
  4571. weights?: number[];
  4572. }
  4573. /**
  4574. * @en Mesh renderer component for general 3d model rendering, it generates and link to a Model in the render scene.
  4575. * It supports real time lighting and shadow, baked light map, and morph rendering.
  4576. * @zh 用于通用模型渲染的网格渲染器组件,会创建并关联一个渲染场景中的模型对象。
  4577. * 该组件支持实时光照和阴影,预烘焙光照贴图和形变网格渲染。
  4578. */
  4579. export class MeshRenderer extends ModelRenderer {
  4580. /**
  4581. * @en Shadow projection mode enumeration.
  4582. * @zh 阴影投射方式枚举。
  4583. */
  4584. static ShadowCastingMode: {
  4585. /**
  4586. * @en Disable shadow projection.
  4587. * @zh 不投射阴影。
  4588. */
  4589. OFF: number;
  4590. /**
  4591. * @en Enable shadow projection.
  4592. * @zh 开启阴影投射。
  4593. */
  4594. ON: number;
  4595. };
  4596. /**
  4597. * @en Shadow receive mode enumeration.
  4598. * @zh 阴影接收方式枚举。
  4599. */
  4600. static ShadowReceivingMode: {
  4601. /**
  4602. * @en Disable shadow receiving.
  4603. * @zh 不接收阴影。
  4604. */
  4605. OFF: number;
  4606. /**
  4607. * @en Enable shadow receiving.
  4608. * @zh 开启阴影投射。
  4609. */
  4610. ON: number;
  4611. };
  4612. /**
  4613. * @en The settings for GI baking, it was called lightmapSettings before
  4614. * @zh 全局光照烘焙的配置,以前名称为lightmapSettings
  4615. */
  4616. bakeSettings: __private._cocos_3d_framework_mesh_renderer__ModelBakeSettings;
  4617. protected _mesh: Mesh | null;
  4618. protected _shadowCastingMode: number;
  4619. protected _shadowReceivingMode: number;
  4620. protected _shadowBias: number;
  4621. protected _shadowNormalBias: number;
  4622. protected _reflectionProbeId: number;
  4623. protected _reflectionProbeBlendId: number;
  4624. protected _reflectionProbeBlendWeight: number;
  4625. protected _enabledGlobalStandardSkinObject: boolean;
  4626. protected _reflectionProbeDataMap: Texture2D | null;
  4627. /**
  4628. * @en Local shadow bias for real time lighting.
  4629. * @zh 实时光照下模型局部的阴影偏移。
  4630. */
  4631. get shadowBias(): number;
  4632. set shadowBias(val: number);
  4633. /**
  4634. * @en local shadow normal bias for real time lighting.
  4635. * @zh 实时光照下模型局部的阴影法线偏移。
  4636. */
  4637. get shadowNormalBias(): number;
  4638. set shadowNormalBias(val: number);
  4639. /**
  4640. * @en Shadow projection mode.
  4641. * @zh 实时光照下阴影投射方式。
  4642. */
  4643. get shadowCastingMode(): number;
  4644. set shadowCastingMode(val: number);
  4645. get shadowCastingModeForInspector(): boolean;
  4646. set shadowCastingModeForInspector(val: boolean);
  4647. /**
  4648. * @en Is received direction Light.
  4649. * @zh 是否接收平行光光照。
  4650. * @param visibility @en direction light visibility. @zh 方向光的可见性。
  4651. */
  4652. onUpdateReceiveDirLight(visibility: number, forceClose?: boolean): void;
  4653. /**
  4654. * @en receive shadow.
  4655. * @zh 实时光照下是否接受阴影。
  4656. */
  4657. get receiveShadow(): number;
  4658. set receiveShadow(val: number);
  4659. get receiveShadowForInspector(): boolean;
  4660. set receiveShadowForInspector(val: boolean);
  4661. /**
  4662. * @en Gets or sets the mesh of the model.
  4663. * Note, when set, all morph targets' weights would be reset to zero.
  4664. * @zh 获取或设置模型的网格数据。
  4665. * 注意,设置时,所有形变目标的权重都将归零。
  4666. */
  4667. get mesh(): Mesh | null;
  4668. set mesh(val: Mesh | null);
  4669. /**
  4670. * @en Gets the model in [[RenderScene]].
  4671. * @zh 获取渲染场景 [[RenderScene]] 中对应的模型。
  4672. */
  4673. get model(): renderer.scene.Model | null;
  4674. /**
  4675. * @en Whether to enable morph rendering.
  4676. * @zh 是否启用形变网格渲染。
  4677. */
  4678. get enableMorph(): boolean;
  4679. set enableMorph(value: boolean);
  4680. /**
  4681. * @en Set the Separable-SSS skin standard model component.
  4682. * @zh 设置是否是全局的4s标准模型组件
  4683. */
  4684. get isGlobalStandardSkinObject(): boolean;
  4685. set isGlobalStandardSkinObject(val: boolean);
  4686. protected _modelType: typeof renderer.scene.Model;
  4687. protected _model: renderer.scene.Model | null;
  4688. constructor();
  4689. onLoad(): void;
  4690. onRestore(): void;
  4691. onEnable(): void;
  4692. onDisable(): void;
  4693. onDestroy(): void;
  4694. onGeometryChanged(): void;
  4695. /**
  4696. * @zh 获取子网格指定形变目标的权重。
  4697. * @en Gets the weight at specified morph target of the specified sub mesh.
  4698. * @param subMeshIndex Index to the sub mesh.
  4699. * @param shapeIndex Index to the morph target of the sub mesh.
  4700. * @returns The weight.
  4701. */
  4702. getWeight(subMeshIndex: number, shapeIndex: number): number;
  4703. /**
  4704. * @zh
  4705. * 设置子网格所有形变目标的权重。
  4706. * `subMeshIndex` 是无效索引或 `weights` 的长度不匹配子网格的形变目标数量时,此方法不会生效。
  4707. * @en
  4708. * Sets weights of each morph target of the specified sub mesh.
  4709. * If takes no effect if `subMeshIndex` is out of bounds or if `weights` has a different length with morph targets count of the sub mesh.
  4710. * @param weights The weights.
  4711. * @param subMeshIndex Index to the sub mesh.
  4712. */
  4713. setWeights(weights: number[], subMeshIndex: number): void;
  4714. /**
  4715. * @zh
  4716. * 设置子网格指定外形的权重。
  4717. * `subMeshIndex` 或 `shapeIndex` 是无效索引时,此方法不会生效。
  4718. * @en
  4719. * Sets the weight at specified shape of specified sub mesh.
  4720. * If takes no effect if
  4721. * `subMeshIndex` or `shapeIndex` out of bounds.
  4722. * @param weight The weight.
  4723. * @param subMeshIndex Index to the sub mesh.
  4724. * @param shapeIndex Index to the shape of the sub mesh.
  4725. */
  4726. setWeight(weight: number, subMeshIndex: number, shapeIndex: number): void;
  4727. setInstancedAttribute(name: string, value: ArrayLike<number>): void;
  4728. /**
  4729. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  4730. */
  4731. _updateLightmap(lightmap: Texture2D | null, uOff: number, vOff: number, scale: number, lum: number): void;
  4732. /**
  4733. * @zh
  4734. * 更新反射探针烘焙的cubemap。
  4735. * @en
  4736. * Updat cubemap baked with reflection probes.
  4737. * @param cubeMap baked cubemap.
  4738. * @param useDefaultTexture if the reflection probe has not been baked, is the skybox used instead.
  4739. */
  4740. updateProbeCubemap(cubeMap: TextureCube | null): void;
  4741. /**
  4742. * @zh
  4743. * 更新用于混合的反射探针烘焙的cubemap。
  4744. * @en
  4745. * Updat cubemap baked with reflection probes for blending.
  4746. * @param cubeMap baked cubemap.
  4747. */
  4748. updateProbeBlendCubemap(cubeMap: TextureCube | null): void;
  4749. /**
  4750. * @zh
  4751. * 更新平面反射渲染纹理。
  4752. * @en
  4753. * Update the reflection rendering texture.
  4754. * @param planarMap render texture.
  4755. */
  4756. updateProbePlanarMap(planarMap: gfx.Texture | null): void;
  4757. /**
  4758. * @zh
  4759. * 更新反射探针的数据贴图。
  4760. * @en
  4761. * Update the data mapping of the reflection probe.
  4762. * @param dataMap data mapping with data saved all reflection probe data.
  4763. */
  4764. updateReflectionProbeDataMap(dataMap: Texture2D | null): void;
  4765. /**
  4766. * @zh
  4767. * 更新反射探针的id。
  4768. * @en
  4769. * Update the id of the reflection probe.
  4770. * @param probeId probe id.
  4771. */
  4772. updateReflectionProbeId(probeId: number): void;
  4773. /**
  4774. * @zh
  4775. * 更新用于混合的反射探针的id。
  4776. * @en
  4777. * Update the id of the reflection probe used for blending.
  4778. * @param blendProbeId probe id of blend.
  4779. */
  4780. updateReflectionProbeBlendId(blendProbeId: number): void;
  4781. /**
  4782. * @zh
  4783. * 更新混合权重。
  4784. * @en
  4785. * Update blending weight.
  4786. * @param weight blending weight.
  4787. */
  4788. updateReflectionProbeBlendWeight(weight: number): void;
  4789. protected _updateReflectionProbeTexture(): void;
  4790. protected _updateModels(): void;
  4791. protected _updateReceiveDirLight(): void;
  4792. protected _createModel(): void;
  4793. protected _attachToScene(): void;
  4794. protected _updateModelParams(): void;
  4795. protected _onUpdateLightingmap(): void;
  4796. protected _onUpdateLocalShadowBiasAndProbeId(): void;
  4797. protected _onUpdateLocalReflectionProbeData(): void;
  4798. protected _onUpdateReflectionProbeDataMap(): void;
  4799. protected _onMaterialModified(idx: number, material: Material | null): void;
  4800. protected _onMeshChanged(old: Mesh | null): void;
  4801. protected _clearMaterials(): void;
  4802. protected _getBuiltinMaterial(): Material;
  4803. protected _onVisibilityChange(val: number): void;
  4804. protected _updateShadowBias(): void;
  4805. protected _updateShadowNormalBias(): void;
  4806. protected _updateCastShadow(): void;
  4807. protected _updateReceiveShadow(): void;
  4808. protected onMobilityChanged(): void;
  4809. protected onLightProbeBakingChanged(): void;
  4810. protected onUseLightProbeChanged(): void;
  4811. protected onReflectionProbeChanged(): void;
  4812. protected onBakeToReflectionProbeChanged(): void;
  4813. protected _updateUseLightProbe(): void;
  4814. protected _isBatchingEnabled(): boolean;
  4815. protected _updateUseReflectionProbe(): void;
  4816. protected _updateUseReflectionProbeType(): void;
  4817. protected _updateBakeToReflectionProbe(): void;
  4818. }
  4819. export namespace MeshRenderer {
  4820. /**
  4821. * @en Shadow projection mode.
  4822. * @zh 阴影投射方式。
  4823. */
  4824. export type ShadowCastingMode = __private.__types_globals__EnumAlias<typeof __private._cocos_3d_framework_mesh_renderer__ModelShadowCastingMode>;
  4825. /**
  4826. * @en Shadow receive mode.
  4827. * @zh 阴影接收方式。
  4828. */
  4829. export type ShadowReceivingMode = __private.__types_globals__EnumAlias<typeof __private._cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode>;
  4830. }
  4831. /**
  4832. * @en The directional light component, only one real time directional light is permitted in one scene, it act as the main light of the scene.
  4833. * @zh 平行光源组件,一个场景只允许存在一个实时的平行光源,作为场景的主光源存在。
  4834. */
  4835. export class DirectionalLight extends Light {
  4836. /**
  4837. * @en The light source intensity.
  4838. * @zh 光源强度。
  4839. */
  4840. get illuminance(): number;
  4841. set illuminance(val: number);
  4842. /**
  4843. * @en Whether activate real time shadow.
  4844. * @zh 是否启用实时阴影?
  4845. */
  4846. get shadowEnabled(): boolean;
  4847. set shadowEnabled(val: boolean);
  4848. /**
  4849. * @en The shadow pcf for real time shadow.
  4850. * @zh 实时阴影计算中的阴影 pcf 等级。
  4851. */
  4852. get shadowPcf(): number;
  4853. set shadowPcf(val: number);
  4854. /**
  4855. * @en The shadow map sampler offset for real time shadow.
  4856. * @zh 实时阴影计算中的阴影纹理偏移值。
  4857. */
  4858. get shadowBias(): number;
  4859. set shadowBias(val: number);
  4860. /**
  4861. * @en The global normal bias for real time shadow.
  4862. * @zh 实时阴影计算中的法线偏移。
  4863. */
  4864. get shadowNormalBias(): number;
  4865. set shadowNormalBias(val: number);
  4866. /**
  4867. * @en The shadow color saturation for real time shadow.
  4868. * @zh 实时阴影计算中的阴影颜色饱和度。
  4869. */
  4870. get shadowSaturation(): number;
  4871. set shadowSaturation(val: number);
  4872. /**
  4873. * @en The potential shadow distance from the camera for real time shadow.
  4874. * @zh 实时阴影计算中潜在阴影产生的范围
  4875. */
  4876. get shadowDistance(): number;
  4877. set shadowDistance(val: number);
  4878. /**
  4879. * @en The occlusion range for real time shadow.
  4880. * @zh 实时阴影计算中剔除阴影的范围
  4881. */
  4882. get shadowInvisibleOcclusionRange(): number;
  4883. set shadowInvisibleOcclusionRange(val: number);
  4884. /**
  4885. * @en get or set shadow CSM level
  4886. * @zh 获取或者设置阴影层级
  4887. */
  4888. get csmLevel(): number;
  4889. set csmLevel(val: number);
  4890. /**
  4891. * @en enable csm
  4892. * @zh 开启或关闭 csm 模式
  4893. */
  4894. get enableCSM(): boolean;
  4895. set enableCSM(val: boolean);
  4896. /**
  4897. * @en get or set shadow CSM level ratio
  4898. * @zh 获取或者设置阴影层级系数
  4899. */
  4900. get csmLayerLambda(): number;
  4901. set csmLayerLambda(val: number);
  4902. /**
  4903. * @en get or set shadow CSM performance optimization mode
  4904. * @zh 获取或者设置级联阴影性能优化模式
  4905. * @internal
  4906. */
  4907. get csmOptimizationMode(): number;
  4908. set csmOptimizationMode(val: number);
  4909. /**
  4910. * @en Whether to use fixed area shadow in real time shadow.
  4911. * @zh 实时阴影计算中是否使用固定区域阴影。
  4912. */
  4913. get shadowFixedArea(): boolean;
  4914. set shadowFixedArea(val: boolean);
  4915. /**
  4916. * @en The near clip plane of the shadow camera for fixed area shadow
  4917. * @zh 固定区域阴影设置中阴影相机近裁剪面
  4918. */
  4919. get shadowNear(): number;
  4920. set shadowNear(val: number);
  4921. /**
  4922. * @en The far clip plane of the shadow camera for fixed area shadow.
  4923. * @zh 固定区域阴影设置中阴影相机远裁剪面。
  4924. */
  4925. get shadowFar(): number;
  4926. set shadowFar(val: number);
  4927. /**
  4928. * @en The orthogonal size of the shadow camera for fixed area shadow.
  4929. * @zh 固定区域阴影设置中阴影相机的正交尺寸
  4930. */
  4931. get shadowOrthoSize(): number;
  4932. set shadowOrthoSize(val: number);
  4933. /**
  4934. * @en Enabled shadow advanced options
  4935. * @zh 是否启用高级选项?
  4936. */
  4937. get csmAdvancedOptions(): boolean;
  4938. set csmAdvancedOptions(val: boolean);
  4939. /**
  4940. * @en Enabled csm layers transition
  4941. * @zh 是否启用级联阴影层级过渡?
  4942. */
  4943. get csmLayersTransition(): boolean;
  4944. set csmLayersTransition(val: boolean);
  4945. /**
  4946. * @en get or set csm layers transition range
  4947. * @zh 获取或者设置级联阴影层级过渡范围?
  4948. */
  4949. get csmTransitionRange(): number;
  4950. set csmTransitionRange(val: number);
  4951. constructor();
  4952. protected _createLight(): void;
  4953. protected _onUpdateReceiveDirLight(): void;
  4954. }
  4955. /**
  4956. * @en The base class of all light components, contains basic light settings for both real time light and baked light.
  4957. * @zh 光源组件基类,包含实时光源和烘焙光源的基本配置信息。
  4958. */
  4959. export class Light extends Component {
  4960. /**
  4961. * @en The light type enumeration.
  4962. * @zh 光源类型枚举。
  4963. */
  4964. static Type: typeof renderer.scene.LightType;
  4965. /**
  4966. * @en The physical term used for light.
  4967. * @zh 光源所使用的物理计量单位。
  4968. */
  4969. static PhotometricTerm: {
  4970. LUMINOUS_FLUX: number;
  4971. LUMINANCE: number;
  4972. };
  4973. protected _color: math.Color;
  4974. protected _useColorTemperature: boolean;
  4975. protected _colorTemperature: number;
  4976. protected _staticSettings: __private._cocos_3d_lights_light_component__StaticLightSettings;
  4977. protected _visibility: number;
  4978. protected _type: renderer.scene.LightType;
  4979. protected _lightType: typeof renderer.scene.Light;
  4980. protected _light: renderer.scene.Light | null;
  4981. /**
  4982. * @en The color of the light.
  4983. * @zh 光源颜色。
  4984. */
  4985. get color(): Readonly<math.Color>;
  4986. set color(val: Readonly<math.Color>);
  4987. /**
  4988. * @en
  4989. * Whether to enable light color temperature.
  4990. * @zh
  4991. * 是否启用光源色温。
  4992. */
  4993. get useColorTemperature(): boolean;
  4994. set useColorTemperature(enable: boolean);
  4995. /**
  4996. * @en
  4997. * The light color temperature.
  4998. * @zh
  4999. * 光源色温。
  5000. */
  5001. get colorTemperature(): number;
  5002. set colorTemperature(val: number);
  5003. /**
  5004. * @en
  5005. * static light settings.
  5006. * @zh
  5007. * 静态灯光设置。
  5008. */
  5009. get staticSettings(): __private._cocos_3d_lights_light_component__StaticLightSettings;
  5010. set staticSettings(val: __private._cocos_3d_lights_light_component__StaticLightSettings);
  5011. /**
  5012. * @en The light type.
  5013. * @zh 光源类型。
  5014. */
  5015. get type(): renderer.scene.LightType;
  5016. /**
  5017. * @en Whether the light is baked
  5018. * @zh 光源是否被烘焙
  5019. */
  5020. get baked(): boolean;
  5021. set baked(val: boolean);
  5022. /**
  5023. * @en Visibility mask of the light, declaring a set of node layers that will be visible to this light.
  5024. * @zh 光照的可见性掩码,声明在当前光照中可见的节点层级集合。
  5025. */
  5026. set visibility(vis: number);
  5027. get visibility(): number;
  5028. constructor();
  5029. onLoad(): void;
  5030. onEnable(): void;
  5031. onDisable(): void;
  5032. onDestroy(): void;
  5033. protected _createLight(): void;
  5034. protected _destroyLight(): void;
  5035. protected _attachToScene(): void;
  5036. protected _detachFromScene(): void;
  5037. protected _onUpdateReceiveDirLight(): void;
  5038. }
  5039. export namespace Light {
  5040. export type Type = __private.__types_globals__EnumAlias<typeof renderer.scene.LightType>;
  5041. export type PhotometricTerm = __private.__types_globals__EnumAlias<typeof __private._cocos_3d_lights_light_component__PhotometricTerm>;
  5042. }
  5043. /**
  5044. * @en The sphere light component, multiple sphere lights can be added to one scene.
  5045. * @zh 球面光源组件,场景中可以添加多个球面光源。
  5046. */
  5047. export class SphereLight extends Light {
  5048. /**
  5049. * @en Luminous flux of the light.
  5050. * @zh 光通量。
  5051. */
  5052. get luminousFlux(): number;
  5053. set luminousFlux(val: number);
  5054. /**
  5055. * @en Luminance of the light.
  5056. * @zh 光亮度。
  5057. */
  5058. get luminance(): number;
  5059. set luminance(val: number);
  5060. /**
  5061. * @en The photometric term currently being used.
  5062. * @zh 当前使用的光度学计量单位。
  5063. */
  5064. get term(): number;
  5065. set term(val: number);
  5066. /**
  5067. * @en
  5068. * Size of the light.
  5069. * @zh
  5070. * 光源大小。
  5071. */
  5072. get size(): number;
  5073. set size(val: number);
  5074. /**
  5075. * @en
  5076. * Range of the light.
  5077. * @zh
  5078. * 光源范围。
  5079. */
  5080. get range(): number;
  5081. set range(val: number);
  5082. constructor();
  5083. protected _createLight(): void;
  5084. }
  5085. /**
  5086. * @en The spot light component, multiple spot lights can be added to one scene.
  5087. * @zh 聚光灯光源组件,场景中可以添加多个聚光灯光源。
  5088. */
  5089. export class SpotLight extends Light {
  5090. /**
  5091. * @en Luminous flux of the light.
  5092. * @zh 光通量。
  5093. */
  5094. get luminousFlux(): number;
  5095. set luminousFlux(val: number);
  5096. /**
  5097. * @en Luminance of the light.
  5098. * @zh 光亮度。
  5099. */
  5100. get luminance(): number;
  5101. set luminance(val: number);
  5102. /**
  5103. * @en The photometric term currently being used.
  5104. * @zh 当前使用的光度学计量单位。
  5105. */
  5106. get term(): number;
  5107. set term(val: number);
  5108. /**
  5109. * @en
  5110. * Size of the light.
  5111. * @zh
  5112. * 光源大小。
  5113. */
  5114. get size(): number;
  5115. set size(val: number);
  5116. /**
  5117. * @en
  5118. * Range of the light.
  5119. * @zh
  5120. * 光源范围。
  5121. */
  5122. get range(): number;
  5123. set range(val: number);
  5124. /**
  5125. * @en
  5126. * The spot light cone angle.
  5127. * @zh
  5128. * 聚光灯锥角。
  5129. */
  5130. get spotAngle(): number;
  5131. set spotAngle(val: number);
  5132. /**
  5133. * @en The angle attenuation strength of the spot light.
  5134. * The larger the value, the softer the edge, and the smaller the value, the harder the edge.
  5135. * @zh 聚光灯角度衰减强度。值越大,边缘越柔和,值越小,边缘越硬。
  5136. */
  5137. get angleAttenuationStrength(): number;
  5138. set angleAttenuationStrength(val: number);
  5139. /**
  5140. * @en Whether activate shadow
  5141. * @zh 是否启用阴影?
  5142. */
  5143. get shadowEnabled(): boolean;
  5144. set shadowEnabled(val: boolean);
  5145. /**
  5146. * @en The pcf level of the shadow generation.
  5147. * @zh 获取或者设置阴影 pcf 等级。
  5148. */
  5149. get shadowPcf(): number;
  5150. set shadowPcf(val: number);
  5151. /**
  5152. * @en The depth offset of shadow to avoid moire pattern artifacts
  5153. * @zh 阴影的深度偏移, 可以减弱跨像素导致的条纹状失真
  5154. */
  5155. get shadowBias(): number;
  5156. set shadowBias(val: number);
  5157. /**
  5158. * @en The normal bias of the shadow map.
  5159. * @zh 设置或者获取法线偏移。
  5160. */
  5161. get shadowNormalBias(): number;
  5162. set shadowNormalBias(val: number);
  5163. constructor();
  5164. protected _createLight(): void;
  5165. }
  5166. /**
  5167. * @en The point light component, multiple point lights can be added to one scene.
  5168. * @zh 点光源组件,场景中可以添加多个点光源。
  5169. */
  5170. export class PointLight extends Light {
  5171. /**
  5172. * @en Luminous flux of the light.
  5173. * @zh 光通量。
  5174. */
  5175. get luminousFlux(): number;
  5176. set luminousFlux(val: number);
  5177. /**
  5178. * @en Luminance of the light.
  5179. * @zh 光亮度。
  5180. */
  5181. get luminance(): number;
  5182. set luminance(val: number);
  5183. /**
  5184. * @en The photometric term currently being used.
  5185. * @zh 当前使用的光度学计量单位。
  5186. */
  5187. get term(): number;
  5188. set term(val: number);
  5189. /**
  5190. * @en Range of the light.
  5191. * @zh 光源范围。
  5192. */
  5193. get range(): number;
  5194. set range(val: number);
  5195. constructor();
  5196. protected _createLight(): void;
  5197. }
  5198. /**
  5199. * @en The ranged directional light component, Multiple ranged directional light sources are allowed in a scene.
  5200. * @zh 范围平行光光源组件,一个场景允许存在多个范围平行光光源。
  5201. */
  5202. export class RangedDirectionalLight extends Light {
  5203. /**
  5204. * @en The light source intensity.
  5205. * @zh 光源强度。
  5206. */
  5207. get illuminance(): number;
  5208. set illuminance(val: number);
  5209. constructor();
  5210. protected _createLight(): void;
  5211. }
  5212. /**
  5213. * @en The skinned mesh renderer component.
  5214. * @zh 蒙皮网格渲染器组件。
  5215. */
  5216. export class SkinnedMeshRenderer extends MeshRenderer {
  5217. protected _skeleton: Skeleton | null;
  5218. protected _skinningRoot: Node | null;
  5219. protected _clip: AnimationClip | null;
  5220. /**
  5221. * @en The skeleton asset.
  5222. * @zh 骨骼资源。
  5223. */
  5224. get skeleton(): Skeleton | null;
  5225. set skeleton(val: Skeleton | null);
  5226. /**
  5227. * @en The skinning root. (The node where the controlling Animation is located)
  5228. * @zh 骨骼根节点的引用,对应控制此模型的动画组件所在节点。
  5229. */
  5230. get skinningRoot(): Node | null;
  5231. set skinningRoot(value: Node | null);
  5232. get model(): __private._cocos_3d_models_skinning_model__SkinningModel | __private._cocos_3d_models_baked_skinning_model__BakedSkinningModel | null;
  5233. /**
  5234. * Set associated animation.
  5235. * @internal This method only friends to skeletal animation component.
  5236. */
  5237. associatedAnimation: SkeletalAnimation | null;
  5238. constructor();
  5239. onLoad(): void;
  5240. onDestroy(): void;
  5241. uploadAnimation(clip: AnimationClip | null): void;
  5242. /**
  5243. * Set if bake mode should be used.
  5244. * @internal This method only friends to skeletal animation component.
  5245. */
  5246. setUseBakedAnimation(val?: boolean, force?: boolean): void;
  5247. setSharedMaterial(material: Material | null, index: number): void;
  5248. protected _updateModelParams(): void;
  5249. }
  5250. /**
  5251. * @en The skinned mesh batch renderer component, batches multiple skeleton-sharing [[SkinnedMeshRenderer]].
  5252. * @zh 蒙皮模型合批组件,用于合并绘制共享同一骨骼资源的所有蒙皮网格。
  5253. */
  5254. export class SkinnedMeshBatchRenderer extends SkinnedMeshRenderer {
  5255. /**
  5256. * @en Size of the generated texture atlas.
  5257. * @zh 合图生成的最终图集的边长。
  5258. */
  5259. atlasSize: number;
  5260. /**
  5261. * @en
  5262. * Texture properties that will be actually using the generated atlas.<br>
  5263. * The first unit's texture will be used if not specified.
  5264. * @zh
  5265. * 材质中真正参与合图的贴图属性,不参与的属性统一使用第一个 unit 的贴图。
  5266. */
  5267. batchableTextureNames: string[];
  5268. /**
  5269. * @en Source skinning model components, containing all the data to be batched.
  5270. * @zh 合批前的子蒙皮模型数组,最主要的数据来源。
  5271. */
  5272. units: SkinnedMeshUnit[];
  5273. get mesh(): Mesh | null;
  5274. set mesh(val: Mesh | null);
  5275. get skeleton(): Skeleton | null;
  5276. set skeleton(val: Skeleton | null);
  5277. onLoad(): void;
  5278. onDestroy(): void;
  5279. /**
  5280. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  5281. */
  5282. _onMaterialModified(idx: number, material: Material | null): void;
  5283. cook(): void;
  5284. cookMaterials(): void;
  5285. cookSkeletons(): void;
  5286. cookMeshes(): void;
  5287. protected cookTextures(target: Texture2D, prop: string, passIdx: number): void;
  5288. protected createTexture(prop: string): Texture2D;
  5289. protected resizeAtlases(): void;
  5290. }
  5291. export class SkinnedMeshUnit {
  5292. /**
  5293. * @en Skinned mesh of this unit.
  5294. * @zh 子蒙皮模型的网格模型。
  5295. */
  5296. mesh: Mesh | null;
  5297. /**
  5298. * @en Skeleton of this unit.
  5299. * @zh 子蒙皮模型的骨骼。
  5300. */
  5301. skeleton: Skeleton | null;
  5302. /**
  5303. * @en Skinning material of this unit.
  5304. * @zh 子蒙皮模型使用的材质。
  5305. */
  5306. material: Material | null;
  5307. /**
  5308. * @en Local transform matrix
  5309. * @zh 本地变换矩阵
  5310. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  5311. */
  5312. _localTransform: math.Mat4;
  5313. /**
  5314. * @en UV offset on texture atlas.
  5315. * @zh 在图集中的 uv 坐标偏移。
  5316. */
  5317. set offset(offset: math.Vec2);
  5318. get offset(): math.Vec2;
  5319. /**
  5320. * @en UV extent on texture atlas.
  5321. * @zh 在图集中占的 UV 尺寸。
  5322. */
  5323. set size(size: math.Vec2);
  5324. get size(): math.Vec2;
  5325. /**
  5326. * @en Convenient setter, copying all necessary information from target [[SkinnedMeshRenderer]] component.
  5327. * @zh 复制目标 [[SkinnedMeshRenderer]] 的所有属性到本单元,方便快速配置。
  5328. */
  5329. set copyFrom(comp: SkinnedMeshRenderer | null);
  5330. get copyFrom(): SkinnedMeshRenderer | null;
  5331. }
  5332. export class LOD {
  5333. protected _screenUsagePercentage: number;
  5334. protected _renderers: MeshRenderer[];
  5335. constructor();
  5336. /**
  5337. * @en Minimum percentage of screen usage for the current lod in effect, range in [0, 1]
  5338. * @zh 本层级生效时,占用屏幕的最小百分比, 取值范围[0, 1]
  5339. */
  5340. get screenUsagePercentage(): number;
  5341. set screenUsagePercentage(val: number);
  5342. /**
  5343. * @en Get the list of [[MeshRenderer]] used by the current lod.
  5344. * @zh 获取当前lod使用的 [[MeshRenderer]] 列表
  5345. */
  5346. get renderers(): readonly MeshRenderer[];
  5347. /**
  5348. * @en reset _renderers to meshList or [], LODData's model will be reset too.
  5349. * @zh 重置 _renderers 为 meshList或空数组, LODData上的model也会被重置
  5350. */
  5351. set renderers(meshList: readonly MeshRenderer[]);
  5352. /**
  5353. * @en Get the number of LOD.
  5354. * @zh 获取LOD的数量
  5355. */
  5356. get rendererCount(): number;
  5357. /**
  5358. * @en Insert a [[MeshRenderer]] before specific index position.
  5359. * @zh 在指定的数组索引处插入一个[[MeshRenderer]]
  5360. * @param index @en The rendering array is indexed from 0. If - 1 is passed, it will be added to the end of the list.
  5361. * @zh renderers数组从0开始索引,若传递-1将会被添加到列表末尾。
  5362. * @param renderer @en The mesh-renderer object. @zh [[MeshRenderer]] 对象
  5363. * @returns @en The inserted [[MeshRenderer]] @zh 返回被插入的 [[MeshRenderer]] 对象
  5364. */
  5365. insertRenderer(index: number, renderer: MeshRenderer): MeshRenderer;
  5366. /**
  5367. * @en Delete the [[MeshRenderer]] at specific index position.
  5368. * @zh 删除指定索引处的[[MeshRenderer]]
  5369. * @param index @en 0 indexed position in renderer array, when -1 is specified, the last element will be deleted.
  5370. * @zh _renderers从0开始索引,传递-1则最后一个元素会被删除。
  5371. * @returns @en The deleted [[MeshRenderer]], or null if the specified index does not exist. @zh 如果指定索引处的对象存在,返回被删除对象否则返回null。
  5372. */
  5373. deleteRenderer(index: number): MeshRenderer | null;
  5374. /**
  5375. * @en Get the [[MeshRenderer]] at specific index position.
  5376. * @zh 获取指定索引处的[[MeshRenderer]]
  5377. * @param index @en Value range from 0 to _renderers's length. @zh 取值范围是[0, _renderers长度]
  5378. * @return @en Returns the [[MeshRenderer]] at the specified index, or null if the specified index does not exist. @zh 返回指定索引处的对象,若不存在则返回null。
  5379. */
  5380. getRenderer(index: number): MeshRenderer | null;
  5381. /**
  5382. * @en Update the [[MeshRenderer]] at specific index position.
  5383. * @zh 更新指定索引处的 [[MeshRenderer]]
  5384. * @param index @en Value range from 0 to _renderers's length @zh 取值范围是 [0, _renderers数组长度]
  5385. */
  5386. setRenderer(index: number, renderer: MeshRenderer): void;
  5387. }
  5388. export class LODGroup extends Component {
  5389. /**
  5390. * @en Object reference point in local space, e.g. center of the bound volume for all LODs
  5391. */
  5392. protected _localBoundaryCenter: math.Vec3;
  5393. /**
  5394. * @en Object Size in local space, may be auto-calculated value from object bounding box or value from user input.
  5395. */
  5396. protected _objectSize: number;
  5397. /**
  5398. *@en The array of LODs
  5399. */
  5400. protected _LODs: LOD[];
  5401. constructor();
  5402. /**
  5403. * @en Obtain LOD level numbers.
  5404. * @zh 获取LOD层级数
  5405. */
  5406. get lodCount(): number;
  5407. /**
  5408. * @en Set current AABB's size.
  5409. * @zh 设置当前包围盒的大小
  5410. */
  5411. set objectSize(val: number);
  5412. /**
  5413. * @en Get current AABB's size.
  5414. * @zh 获取当前包围盒的大小
  5415. */
  5416. get objectSize(): number;
  5417. /**
  5418. * @en Get LOD array config.
  5419. * @zh 获取 LOD 数组
  5420. */
  5421. get LODs(): readonly LOD[];
  5422. /**
  5423. * @en Reset current LODs to new value.
  5424. * @ 重置 LODs 为当前新设置的值。
  5425. */
  5426. set LODs(valArray: readonly LOD[]);
  5427. /**
  5428. * @en Insert the [[LOD]] at specific index position, [[LOD]] will be inserted to the last position if index less than 0 or greater than lodCount.
  5429. * @zh 在指定索引处插入 [[LOD]], 若索引为负或超过lodCount,则在末尾添加
  5430. * @param index @en location where lod is added. @zh lod被插入的位置
  5431. * @param screenUsagePercentage @en The minimum screen usage percentage that the currently set lod starts to use, range in[0, 1].
  5432. * @zh lod生效时的最低屏幕显示百分比要求,取值范围[0, 1]
  5433. * @param lod @en If this parameter is not set, it will be created by default. @zh 如果参数没传,则内部创建
  5434. * @returns @en The new lod added. @zh 返回被添加的lod
  5435. */
  5436. insertLOD(index: number, screenUsagePercentage?: number, lod?: LOD): LOD;
  5437. /**
  5438. * @en Erase the [[LOD]] at specific index position.
  5439. * @zh 删除指定索引处的 [[LOD]]
  5440. * @param index @en Index of the erased lod, range in [0, lodCount]. @zh 被删除对象索引, 取值范围[0, lodCount]
  5441. * @returns @en Erased lod. @zh 被删除的对象
  5442. */
  5443. eraseLOD(index: number): LOD | null;
  5444. /**
  5445. * @en Get [[LOD]] at specific index position.
  5446. * @zh 获取指定索引处的 [[LOD]]
  5447. * @param index @en Range in [0, lodCount]. @zh 取值范围[0, lodCount]
  5448. * @returns @en Lod at specified index, or null. @zh 返回指定索引的lod或null
  5449. */
  5450. getLOD(index: number): LOD | null;
  5451. /**
  5452. * @en Update the [[LOD]] at specific index position.
  5453. * @zh 更新指定索引处的 [[LOD]]
  5454. * @param index, update lod at specified index.
  5455. * @param lod, the updated lod.
  5456. */
  5457. setLOD(index: number, lod: LOD): void;
  5458. /**
  5459. * @en Recalculate the bounding box, and the interface will recalculate the localBoundaryCenter and objectSize
  5460. * @zh 重新计算包围盒,该接口会更新 localBoundaryCenter 和 objectSize
  5461. */
  5462. recalculateBounds(): void;
  5463. /**
  5464. * @en reset current objectSize to 1, and recalculate screenUsagePercentage.
  5465. * @zh 重置 objectSize 的大小为1,该接口会重新计算 screenUsagePercentage
  5466. */
  5467. resetObjectSize(): void;
  5468. /**
  5469. * @zh 强制使用某一级的LOD
  5470. * @en Force LOD level to use.
  5471. * lodLevel @en The LOD level to use. Passing lodLevel < 0 will return to standard LOD processing. @zh 要使用的LOD层级,为负数时使用标准的处理流程
  5472. */
  5473. forceLOD(lodLevel: number): void;
  5474. /**
  5475. * @en Force multi LOD level to use, This function is only called in editor.<br/>
  5476. * @zh 强制使用某几级的LOD,该接口只会在编辑器下调用。
  5477. * lodIndexArray @en The LOD level array. Passing [] will return to standard LOD processing. @zh 要使用的LOD层级数组,传[]时将使用标准的处理流程。
  5478. */
  5479. forceLODs(lodIndexArray: number[]): void;
  5480. onLoad(): void;
  5481. _onRemove(comp: Component): void;
  5482. onRestore(): void;
  5483. onEnable(): void;
  5484. onDisable(): void;
  5485. }
  5486. export class ReflectionProbe extends Component {
  5487. protected static readonly DEFAULT_CUBE_SIZE: Readonly<math.Vec3>;
  5488. protected static readonly DEFAULT_PLANER_SIZE: Readonly<math.Vec3>;
  5489. protected readonly _lastSize: math.Vec3;
  5490. protected _resolution: number;
  5491. protected _clearFlag: renderer.scene.ProbeClearFlag;
  5492. protected _backgroundColor: math.Color;
  5493. protected _visibility: number;
  5494. protected _probeType: renderer.scene.ProbeType;
  5495. protected _cubemap: TextureCube | null;
  5496. protected readonly _size: math.Vec3;
  5497. protected _sourceCamera: Camera | null;
  5498. protected _probe: renderer.scene.ReflectionProbe | null;
  5499. protected _previewSphere: Node | null;
  5500. protected _previewPlane: Node | null;
  5501. /**
  5502. * @en
  5503. * Gets or sets the size of the box
  5504. * @zh
  5505. * 获取或设置包围盒的大小。
  5506. */
  5507. set size(value: math.Vec3);
  5508. get size(): math.Vec3;
  5509. /**
  5510. * @en Environment reflection or plane reflection.
  5511. * @zh 设置探针类型,环境反射或者平面反射
  5512. */
  5513. set probeType(value: renderer.scene.ProbeType);
  5514. get probeType(): renderer.scene.ProbeType;
  5515. /**
  5516. * @en set render texture size
  5517. * @zh 设置渲染纹理大小
  5518. */
  5519. set resolution(value: number);
  5520. get resolution(): number;
  5521. /**
  5522. * @en Clearing flags of the camera, specifies which part of the framebuffer will be actually cleared every frame.
  5523. * @zh 相机的缓冲清除标志位,指定帧缓冲的哪部分要每帧清除。
  5524. */
  5525. set clearFlag(value: number);
  5526. get clearFlag(): number;
  5527. /**
  5528. * @en Clearing color of the camera.
  5529. * @zh 相机的颜色缓冲默认值。
  5530. */
  5531. set backgroundColor(val: math.Color);
  5532. get backgroundColor(): math.Color;
  5533. /**
  5534. * @en Visibility mask, declaring a set of node layers that will be visible to this camera.
  5535. * @zh 可见性掩码,声明在当前相机中可见的节点层级集合。
  5536. */
  5537. get visibility(): number;
  5538. set visibility(val: number);
  5539. /**
  5540. * @en The camera to render planar reflections, specified by the user
  5541. * @zh 需要渲染平面反射的相机,由用户指定
  5542. */
  5543. set sourceCamera(camera: Camera);
  5544. get sourceCamera(): Camera;
  5545. /**
  5546. * @en fast bake no convolution.
  5547. * @zh 快速烘焙不会进行卷积。
  5548. */
  5549. get fastBake(): boolean;
  5550. set fastBake(val: boolean);
  5551. set cubemap(val: TextureCube | null);
  5552. get cubemap(): TextureCube | null;
  5553. get probe(): renderer.scene.ReflectionProbe;
  5554. /**
  5555. * @en Reflection probe cube mode preview sphere
  5556. * @zh 反射探针cube模式的预览小球
  5557. */
  5558. set previewSphere(val: Node | null);
  5559. get previewSphere(): Node | null;
  5560. /**
  5561. * @en Reflection probe planar mode preview plane
  5562. * @zh 反射探针Planar模式的预览平面
  5563. */
  5564. set previewPlane(val: Node);
  5565. get previewPlane(): Node;
  5566. onLoad(): void;
  5567. onEnable(): void;
  5568. onDisable(): void;
  5569. start(): void;
  5570. onDestroy(): void;
  5571. update(dt: number): void;
  5572. /**
  5573. * @en Clear the baked cubemap.
  5574. * @zh 清除烘焙的cubemap
  5575. */
  5576. clearBakedCubemap(): void;
  5577. }
  5578. /**
  5579. * @en Use Reflection probe
  5580. * @zh 使用反射探针。
  5581. */
  5582. export enum ReflectionProbeType {
  5583. /**
  5584. * @en Use the default skybox.
  5585. * @zh 使用默认天空盒。
  5586. */
  5587. NONE = 0,
  5588. /**
  5589. * @en Cubemap generate by probe.
  5590. * @zh Probe烘焙的cubemap。
  5591. */
  5592. BAKED_CUBEMAP = 1,
  5593. /**
  5594. * @en Realtime planar reflection.
  5595. * @zh 实时平面反射。
  5596. */
  5597. PLANAR_REFLECTION = 2,
  5598. /**
  5599. * @en Mixing between reflection probe.
  5600. * @zh 反射探针之间进行混合。
  5601. */
  5602. BLEND_PROBES = 3,
  5603. /**
  5604. * @en Mixing between reflection probe and skybox.
  5605. * @zh 反射探针之间混合或反射探针和天空盒之间混合。
  5606. */
  5607. BLEND_PROBES_AND_SKYBOX = 4
  5608. }
  5609. /**
  5610. * @zh 动画剪辑表示一段使用动画编辑器编辑的关键帧动画或是外部美术工具生产的骨骼动画。
  5611. * 它的数据主要被分为几层:轨道、关键帧和曲线。
  5612. * @en The animation clip represents a sequence of key frame animation created with the animation editor or skeletal animation other DCC tools.
  5613. * The data is divided in different levels: tracks, key frames, curves.
  5614. */
  5615. export class AnimationClip extends Asset {
  5616. static WrapMode: typeof __private._cocos_animation_types__WrapMode;
  5617. /**
  5618. * @en Crate clip with a set of sprite frames
  5619. * @zh 使用一组序列帧图片来创建动画剪辑
  5620. * @example
  5621. * ```
  5622. * import { AnimationClip } from 'cc';
  5623. * const clip = AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  5624. * ```
  5625. */
  5626. static createWithSpriteFrames(spriteFrames: SpriteFrame[], sample: number): AnimationClip;
  5627. /**
  5628. * @zh 动画帧率,单位为帧/秒。注意此属性仅用于编辑器动画编辑。
  5629. * @en Animation frame rate: frames per second.
  5630. * Note this property is only used for animation editing in Editor.
  5631. */
  5632. sample: number;
  5633. /**
  5634. * @zh 动画的播放速度。
  5635. * @en Animation playback speed.
  5636. */
  5637. speed: number;
  5638. /**
  5639. * @zh 动画的循环模式。
  5640. * @en Animation loop mode.
  5641. */
  5642. wrapMode: __private._cocos_animation_types__WrapMode;
  5643. /**
  5644. * Sets if node TRS curves in this animation can be blended.
  5645. * Normally this flag is enabled for model animation and disabled for other case.
  5646. * @internal This is an internal slot. Never use it in your code.
  5647. */
  5648. enableTrsBlending: boolean;
  5649. /**
  5650. * @zh 动画的周期。
  5651. * @en Animation duration.
  5652. */
  5653. get duration(): number;
  5654. set duration(value: number);
  5655. /**
  5656. * @en
  5657. * Gets the count of tracks this animation owns.
  5658. * @zh
  5659. * 获取此动画中的轨道数量。
  5660. */
  5661. get tracksCount(): number;
  5662. /**
  5663. * @en
  5664. * Gets an iterable to tracks.
  5665. * @zh
  5666. * 获取可用于迭代轨道的对象。
  5667. */
  5668. get tracks(): Iterable<animation.Track>;
  5669. get hash(): number;
  5670. /**
  5671. * @zh 动画包含的事件数据。
  5672. * @en Associated event data.
  5673. */
  5674. get events(): AnimationClip.IEvent[];
  5675. set events(value: AnimationClip.IEvent[]);
  5676. get [exoticAnimationTag](): ExoticAnimation | null;
  5677. set [exoticAnimationTag](value: ExoticAnimation | null);
  5678. /**
  5679. * Gets if this animation clip contains additive animation.
  5680. * @experimental
  5681. */
  5682. get isAdditive_experimental(): boolean;
  5683. /**
  5684. * Accesses the additive animation settings.
  5685. * @internal
  5686. */
  5687. get [additiveSettingsTag](): AnimationClipAdditiveSettings;
  5688. onLoaded(): void;
  5689. /**
  5690. * @en
  5691. * Counts the time range that the tracks within this animation span.
  5692. * @zh
  5693. * 获取此动画所有轨道占据的时间范围。
  5694. * @returns The time range.
  5695. */
  5696. range(): __private._cocos_animation_tracks_utils__Range;
  5697. /**
  5698. * @en
  5699. * Gets the specified track.
  5700. * @zh
  5701. * 获取指定的轨道。
  5702. * @param index Index to the track.
  5703. * @returns The track.
  5704. */
  5705. getTrack(index: number): animation.Track;
  5706. /**
  5707. * @en
  5708. * Adds a track into this animation.
  5709. * @zh
  5710. * 添加一个轨道到此动画中。
  5711. * @param track The track.
  5712. * @returns Index to the track.
  5713. */
  5714. addTrack(track: animation.Track): number;
  5715. /**
  5716. * @en
  5717. * Removes a track from this animation.
  5718. * @zh
  5719. * 移除此动画中的指定轨道。
  5720. * @param index Index to the track.
  5721. */
  5722. removeTrack(index: number): void;
  5723. /**
  5724. * @en
  5725. * Removes all tracks from this animation.
  5726. * @zh
  5727. * 移除此动画的所有轨道。
  5728. */
  5729. clearTracks(): void;
  5730. /**
  5731. * Returns if this clip has any event.
  5732. * @internal Do not use this in your code.
  5733. */
  5734. containsAnyEvent(): boolean;
  5735. /**
  5736. * Creates an event evaluator for this animation.
  5737. * @param targetNode Target node used to fire events.
  5738. * @internal Do not use this in your code.
  5739. */
  5740. createEventEvaluator(targetNode: Node): __private._cocos_animation_animation_clip__EventEvaluator;
  5741. /**
  5742. * Returns if this clip has any embedded player.
  5743. * @internal Do not use this in your code.
  5744. */
  5745. containsAnyEmbeddedPlayer(): boolean;
  5746. /**
  5747. * Creates an embedded player evaluator for this animation.
  5748. * @param targetNode Target node.
  5749. * @internal Do not use this in your code.
  5750. */
  5751. createEmbeddedPlayerEvaluator(targetNode: Node): __private._cocos_animation_animation_clip__EmbeddedPlayerEvaluation;
  5752. /**
  5753. * Creates an evaluator for this animation.
  5754. * @param context The context.
  5755. * @returns The evaluator.
  5756. * @internal Do not use this in your code.
  5757. */
  5758. createEvaluator(context: __private._cocos_animation_animation_clip__AnimationClipEvalContext): __private._cocos_animation_animation_clip__AnimationClipEvaluation;
  5759. destroy(): boolean;
  5760. [__private._cocos_animation_internal_symbols__BAKE_SKELETON_CURVE_SYMBOL](start: number, samples: number, frames: number): __private._cocos_animation_animation_clip__SkeletonAnimationBakeInfo;
  5761. /**
  5762. * Convert all untyped tracks into typed ones and delete the original.
  5763. * @param refine How to decide the type on specified path.
  5764. * @internal DO NOT USE THIS IN YOUR CODE.
  5765. */
  5766. upgradeUntypedTracks(refine: __private._cocos_animation_tracks_untyped_track__UntypedTrackRefine): void;
  5767. /**
  5768. * @internal Export for test.
  5769. */
  5770. [__private._cocos_animation_animation_clip__searchForRootBonePathSymbol](): string;
  5771. /**
  5772. * @zh 曲线可引用的所有时间轴。
  5773. * @en Frame keys referenced by curves.
  5774. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5775. */
  5776. get keys(): number[][];
  5777. set keys(value: number[][]);
  5778. /**
  5779. * @zh 此动画包含的所有曲线。
  5780. * @en Curves this animation contains.
  5781. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5782. */
  5783. get curves(): AnimationClip._legacy.LegacyClipCurve[];
  5784. set curves(value: AnimationClip._legacy.LegacyClipCurve[]);
  5785. /**
  5786. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5787. */
  5788. get commonTargets(): AnimationClip._legacy.LegacyCommonTarget[];
  5789. set commonTargets(value: AnimationClip._legacy.LegacyCommonTarget[]);
  5790. /**
  5791. * @en
  5792. * The animation's data.
  5793. * @zh
  5794. * 此动画的数据。
  5795. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5796. */
  5797. get data(): Uint8Array | null;
  5798. /**
  5799. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5800. */
  5801. getPropertyCurves(): readonly AnimationClip._legacy.LegacyRuntimeCurve[];
  5802. /**
  5803. * @deprecated Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5804. */
  5805. get eventGroups(): readonly __private._cocos_animation_animation_clip__IAnimationEventGroup[];
  5806. /**
  5807. * @zh 提交事件数据的修改。
  5808. * 当你修改了 `this.events` 时,必须调用 `this.updateEventDatas()` 使修改生效。
  5809. * @en
  5810. * Commit event data update.
  5811. * You should call this function after you changed the `events` data to take effect.
  5812. * @deprecated Since V3.3. Please Assign to `this.events`.
  5813. */
  5814. updateEventDatas(): void;
  5815. /**
  5816. * @zh 返回本动画是否包含事件数据。
  5817. * @en Returns if this animation contains event data.
  5818. * @protected
  5819. */
  5820. hasEvents(): boolean;
  5821. /**
  5822. * Migrates legacy data into tracks.
  5823. * NOTE: This method tend to be used as internal purpose or patch.
  5824. * DO NOT use it in your code since it might be removed for the future at any time.
  5825. * @internal Since V3.3. Please reference to the track/channel/curve mechanism introduced in V3.3.
  5826. */
  5827. syncLegacyData(): void;
  5828. /**
  5829. * @internal
  5830. */
  5831. get [embeddedPlayerCountTag](): number;
  5832. /**
  5833. * @internal
  5834. */
  5835. [getEmbeddedPlayersTag](): Iterable<EmbeddedPlayer>;
  5836. /**
  5837. * @internal
  5838. */
  5839. [addEmbeddedPlayerTag](embeddedPlayer: EmbeddedPlayer): void;
  5840. /**
  5841. * @internal
  5842. */
  5843. [removeEmbeddedPlayerTag](embeddedPlayer: EmbeddedPlayer): void;
  5844. /**
  5845. * @internal
  5846. */
  5847. [clearEmbeddedPlayersTag](): void;
  5848. /**
  5849. * @zh 获取此动画剪辑中的辅助曲线数量。
  5850. * @en Gets the count of auxiliary curves within this animation clip.
  5851. */
  5852. get auxiliaryCurveCount_experimental(): number;
  5853. /**
  5854. * @zh 返回此动画剪辑中所有辅助曲线的名称。
  5855. * @en Returns names of all auxiliary curves within this animation clip.
  5856. */
  5857. getAuxiliaryCurveNames_experimental(): readonly string[];
  5858. /**
  5859. * @zh 返回此动画剪辑中是否存在指定的辅助曲线。
  5860. * @en Returns if the specified auxiliary curve exists in this animation clip.
  5861. */
  5862. hasAuxiliaryCurve_experimental(name: string): boolean;
  5863. /**
  5864. * @zh 添加一条辅助曲线。如果已存在同名的辅助曲线,则直接返回。
  5865. * @en Adds an auxiliary curve. Directly return if there is already such named auxiliary curve.
  5866. * @param name @zh 辅助曲线的名称。@en The auxiliary curve's name.
  5867. * @returns @zh 新增或已存在的辅助曲线。 @en The newly created or existing auxiliary curve.
  5868. * @experimental
  5869. */
  5870. addAuxiliaryCurve_experimental(name: string): RealCurve;
  5871. /**
  5872. * @zh 获取指定的辅助曲线。
  5873. * @en Gets the specified auxiliary curve.
  5874. * @param name @zh 辅助曲线的名称。@en The auxiliary curve's name.
  5875. * @returns @zh 指定的辅助曲线。@en The specified auxiliary curve.
  5876. * @experimental
  5877. */
  5878. getAuxiliaryCurve_experimental(name: string): RealCurve;
  5879. /**
  5880. * @zh 重命名指定的辅助曲线。
  5881. * @en Renames the specified auxiliary curve.
  5882. * @param name @zh 要重命名的辅助曲线的名称。@en Name of the auxiliary curve to rename.
  5883. * @param newName @zh 新名称。@en New name.
  5884. */
  5885. renameAuxiliaryCurve_experimental(name: string, newName: string): void;
  5886. /**
  5887. * @zh 移除指定的辅助曲线。
  5888. * @en Removes the specified auxiliary curve.
  5889. * @param name @zh 辅助曲线的名称。@en The auxiliary curve's name.
  5890. * @experimental
  5891. */
  5892. removeAuxiliaryCurve_experimental(name: string): void;
  5893. /**
  5894. * @internal
  5895. */
  5896. _trySyncLegacyData(): void;
  5897. }
  5898. export namespace AnimationClip {
  5899. export interface IEvent {
  5900. frame: number;
  5901. func: string;
  5902. params: string[];
  5903. }
  5904. export namespace _legacy {
  5905. export class AnimationClipLegacyData {
  5906. constructor(duration: number);
  5907. get keys(): number[][];
  5908. set keys(value: number[][]);
  5909. get curves(): LegacyClipCurve[];
  5910. set curves(value: LegacyClipCurve[]);
  5911. get commonTargets(): LegacyCommonTarget[];
  5912. set commonTargets(value: LegacyCommonTarget[]);
  5913. /**
  5914. * 此动画的数据。
  5915. */
  5916. get data(): Uint8Array | null;
  5917. getPropertyCurves(): readonly LegacyRuntimeCurve[];
  5918. toTracks(): animation.Track[];
  5919. protected _createPropertyCurves(): void;
  5920. }
  5921. /**
  5922. * Legacy curve uses time based bezier curve interpolation.
  5923. * That's, interpolate time 'x'(time ratio between two frames, eg.[0, 1])
  5924. * and then use the interpolated time to sample curve.
  5925. * Now we need to compute the the end tangent of previous frame and the start tangent of the next frame.
  5926. * @param timeBezierPoints Bezier points used for legacy time interpolation.
  5927. * @param previousTime Time of the previous keyframe.
  5928. * @param previousValue Value of the previous keyframe.
  5929. * @param nextTime Time of the next keyframe.
  5930. * @param nextValue Value of the next keyframe.
  5931. */
  5932. export function timeBezierToTangents(timeBezierPoints: BezierControlPoints, previousTime: number, previousKeyframe: RealKeyframeValue, nextTime: number, nextKeyframe: RealKeyframeValue): void;
  5933. /**
  5934. * 表示曲线值,曲线值可以是任意类型,但必须符合插值方式的要求。
  5935. */
  5936. export type LegacyCurveValue = any;
  5937. /**
  5938. * 表示曲线的目标对象。
  5939. */
  5940. export type LegacyCurveTarget = Record<string, any>;
  5941. /**
  5942. * 内置帧时间渐变方式名称。
  5943. */
  5944. export type LegacyEasingMethodName = keyof (typeof easing);
  5945. /**
  5946. * 帧时间渐变方式。可能为内置帧时间渐变方式的名称或贝塞尔控制点。
  5947. */
  5948. export type LegacyEasingMethod = LegacyEasingMethodName | BezierControlPoints;
  5949. export type LegacyCompressedEasingMethods = Record<number, LegacyEasingMethod>;
  5950. export type LegacyLerpFunction<T = any> = (from: T, to: T, t: number, dt: number) => T;
  5951. export interface LegacyClipCurveData {
  5952. /**
  5953. * 曲线使用的时间轴。
  5954. * @see {AnimationClip.keys}
  5955. */
  5956. keys: number;
  5957. /**
  5958. * 曲线值。曲线值的数量应和 `keys` 所引用时间轴的帧数相同。
  5959. */
  5960. values: LegacyCurveValue[];
  5961. /**
  5962. * 曲线任意两帧时间的渐变方式。仅当 `easingMethods === undefined` 时本字段才生效。
  5963. */
  5964. easingMethod?: LegacyEasingMethod;
  5965. /**
  5966. * 描述了每一帧时间到下一帧时间之间的渐变方式。
  5967. */
  5968. easingMethods?: LegacyEasingMethod[] | LegacyCompressedEasingMethods;
  5969. /**
  5970. * 是否进行插值。
  5971. * @default true
  5972. */
  5973. interpolate?: boolean;
  5974. /**
  5975. * For internal usage only.
  5976. */
  5977. _arrayLength?: number;
  5978. }
  5979. export interface LegacyClipCurve {
  5980. commonTarget?: number;
  5981. modifiers: animation.TargetPath[];
  5982. valueAdapter?: animation.IValueProxyFactory;
  5983. data: LegacyClipCurveData;
  5984. }
  5985. export interface LegacyCommonTarget {
  5986. modifiers: animation.TargetPath[];
  5987. valueAdapter?: animation.IValueProxyFactory;
  5988. }
  5989. export type LegacyMaybeCompactCurve = Omit<LegacyClipCurve, "data"> & {
  5990. data: Omit<LegacyClipCurveData, "values"> & {
  5991. values: any[] | CompactValueTypeArray;
  5992. };
  5993. };
  5994. export type LegacyMaybeCompactKeys = Array<number[] | CompactValueTypeArray>;
  5995. export type LegacyRuntimeCurve = Pick<LegacyClipCurve, "modifiers" | "valueAdapter" | "commonTarget"> & {
  5996. /**
  5997. * 属性曲线。
  5998. */
  5999. curve: AnimCurve;
  6000. /**
  6001. * 曲线采样器。
  6002. */
  6003. sampler: RatioSampler | null;
  6004. };
  6005. export interface LegacyObjectCurveData {
  6006. [propertyName: string]: LegacyClipCurveData;
  6007. }
  6008. export interface LegacyComponentsCurveData {
  6009. [componentName: string]: LegacyObjectCurveData;
  6010. }
  6011. export interface LegacyNodeCurveData {
  6012. props?: LegacyObjectCurveData;
  6013. comps?: LegacyComponentsCurveData;
  6014. }
  6015. }
  6016. export type WrapMode = __private._cocos_animation_animation_clip__WrapMode_;
  6017. }
  6018. /**
  6019. * @en
  6020. * The AnimationState gives full control over animation playback process.
  6021. * In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  6022. * @zh
  6023. * AnimationState 完全控制动画播放过程。<br/>
  6024. * 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。
  6025. *
  6026. */
  6027. export class AnimationState extends __private._cocos_animation_playable__Playable {
  6028. /**
  6029. * @en The clip that is being played by this animation state.
  6030. * @zh 此动画状态正在播放的剪辑。
  6031. */
  6032. get clip(): AnimationClip;
  6033. /**
  6034. * @en The name of the playing animation.
  6035. * @zh 动画的名字。
  6036. */
  6037. get name(): string;
  6038. get length(): number;
  6039. /**
  6040. * @en
  6041. * Wrapping mode of the playing animation.
  6042. * Notice : dynamic change wrapMode will reset time and repeatCount property
  6043. * @zh
  6044. * 动画循环方式。
  6045. * 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount。
  6046. * @default: WrapMode.Normal
  6047. */
  6048. get wrapMode(): __private._cocos_animation_types__WrapMode;
  6049. set wrapMode(value: __private._cocos_animation_types__WrapMode);
  6050. /**
  6051. * @en The animation's iteration count property.
  6052. *
  6053. * A real number greater than or equal to zero (including positive infinity) representing the number of times
  6054. * to repeat the animation node.
  6055. *
  6056. * Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  6057. * calculations.
  6058. *
  6059. * @zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半)。
  6060. *
  6061. * @default 1
  6062. */
  6063. get repeatCount(): number;
  6064. set repeatCount(value: number);
  6065. /**
  6066. * @en The start delay which represents the number of seconds from an animation's start time to the start of
  6067. * the active interval.
  6068. * @zh 延迟多少秒播放。
  6069. * @default 0
  6070. */
  6071. get delay(): number;
  6072. set delay(value: number);
  6073. /**
  6074. * @en The iteration duration of this animation in seconds. (length)
  6075. * @zh 单次动画的持续时间,秒。(动画长度)
  6076. * @readOnly
  6077. */
  6078. duration: number;
  6079. /**
  6080. * @en
  6081. * Gets or sets the playback range.
  6082. * The `min` and `max` field of the range are measured in seconds.
  6083. * While setting, the range object should be a valid range.
  6084. * The actual playback range would be the inclusion of this field and [0, duration].
  6085. * Set this field would reset the accumulated play time.
  6086. * If `min === max`, the animation always play at `min`.
  6087. * @zh
  6088. * 获取或设置播放范围。
  6089. * 范围的 `min`、`max` 字段都是以秒为单位的。
  6090. * 设置时,应当指定一个有效的范围;实际的播放范围是该字段和 [0, 周期] 之间的交集。
  6091. * 设置播放范围时将重置累计播放时间。
  6092. * 如果 `min === max`,该动画将一直在 `min` 处播放。
  6093. */
  6094. get playbackRange(): Readonly<{
  6095. min: number;
  6096. max: number;
  6097. }>;
  6098. set playbackRange(value: Readonly<{
  6099. min: number;
  6100. max: number;
  6101. }>);
  6102. /**
  6103. * @en The animation's playback speed. 1 is normal playback speed.
  6104. * @zh 播放速率。
  6105. * @default: 1.0
  6106. */
  6107. get speed(): number;
  6108. set speed(value: number);
  6109. /**
  6110. * @en The current accumulated time of this animation in seconds.
  6111. * @zh 动画当前**累计播放**的时间,单位为秒。
  6112. * @default 0
  6113. */
  6114. time: number;
  6115. /**
  6116. * @en Gets the time progress, in seconds.
  6117. * @zh 获取动画的时间进度,单位为秒。
  6118. */
  6119. get current(): number;
  6120. /**
  6121. * @en Gets the playback ratio.
  6122. * @zh 获取动画播放的比例时间。
  6123. */
  6124. get ratio(): number;
  6125. /**
  6126. * @en
  6127. * The weight of this animation state.
  6128. * @zh
  6129. * 此动画状态的权重。
  6130. */
  6131. get weight(): number;
  6132. set weight(value: number);
  6133. frameRate: number;
  6134. /**
  6135. * @internal This field is only visible from within internal.
  6136. */
  6137. protected _targetNode: Node | null;
  6138. /**
  6139. * @internal This field is only visible from within internal.
  6140. */
  6141. protected _curveLoaded: boolean;
  6142. /**
  6143. * @internal For internal usage. Really hack...
  6144. */
  6145. protected _doNotCreateEval: boolean;
  6146. constructor(clip: AnimationClip, name?: string);
  6147. /**
  6148. * This method is used for internal purpose only.
  6149. */
  6150. get curveLoaded(): boolean;
  6151. initialize(root: Node, blendStateBuffer?: __private._cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateBuffer, mask?: AnimationMask): void;
  6152. destroy(): void;
  6153. /**
  6154. * @deprecated Since V1.1.1, animation states were no longer defined as event targets.
  6155. * To process animation events, use `Animation` instead.
  6156. */
  6157. emit(...args: any[]): void;
  6158. /**
  6159. * @deprecated Since V1.1.1, animation states were no longer defined as event targets.
  6160. * To process animation events, use `Animation` instead.
  6161. */
  6162. on(type: string, callback: Function, target?: any): void | null;
  6163. /**
  6164. * @deprecated Since V1.1.1, animation states were no longer defined as event targets.
  6165. * To process animation events, use `Animation` instead.
  6166. */
  6167. once(type: string, callback: Function, target?: any): void | null;
  6168. /**
  6169. * @deprecated Since V1.1.1, animation states were no longer defined as event targets.
  6170. * To process animation events, use `Animation` instead.
  6171. */
  6172. off(type: string, callback: Function, target?: any): void;
  6173. /**
  6174. * @zh
  6175. * 是否允许触发 `LastFrame` 事件。
  6176. * 该方法仅用作内部用途。
  6177. * @en
  6178. * Whether `LastFrame` should be triggered.
  6179. * @param allowed True if the last frame events may be triggered.
  6180. * This method is only used for internal purpose only.
  6181. */
  6182. allowLastFrameEvent(allowed: boolean): void;
  6183. /**
  6184. * This method is used for internal purpose only.
  6185. * @internal
  6186. */
  6187. _setEventTarget(target: any): void;
  6188. setTime(time: number): void;
  6189. update(delta: number): void;
  6190. sample(): __private._cocos_animation_types__WrappedInfo;
  6191. protected onPlay(): void;
  6192. protected onStop(): void;
  6193. protected onResume(): void;
  6194. protected onPause(): void;
  6195. /**
  6196. * @internal
  6197. */
  6198. protected _sampleCurves(time: number): void;
  6199. }
  6200. /**
  6201. * @en
  6202. * Animation component governs a group of animation states to control playback of the states.
  6203. * For convenient, it stores a group of animation clips.
  6204. * Each of those clips would have an associated animation state uniquely created.
  6205. * Animation component is eventful, it dispatch a serials playback status events.
  6206. * See [[EventType]].
  6207. * @zh
  6208. * 动画组件管理一组动画状态,控制它们的播放。
  6209. * 为了方便,动画组件还存储了一组动画剪辑。
  6210. * 每个剪辑都会独自创建一个关联的动画状态对象。
  6211. * 动画组件具有事件特性,它会派发一系列播放状态相关的事件。
  6212. * 参考 [[EventType]]
  6213. */
  6214. export class Animation extends __private._cocos_animation_animation_component__Animation_base {
  6215. /**
  6216. * @en
  6217. * Gets or sets clips this component governs.
  6218. * When set, associated animation state of each existing clip will be stopped.
  6219. * If the existing default clip is not in the set of new clips, default clip will be reset to null.
  6220. * @zh
  6221. * 获取或设置此组件管理的剪辑。
  6222. * 设置时,已有剪辑关联的动画状态将被停止;若默认剪辑不在新的动画剪辑中,将被重置为空。
  6223. */
  6224. get clips(): (AnimationClip | null)[];
  6225. set clips(value: (AnimationClip | null)[]);
  6226. /**
  6227. * @en
  6228. * Gets or sets the default clip.
  6229. * Two clips that both have same non-empty UUID are treat as equivalent.
  6230. * @zh
  6231. * 获取或设置默认剪辑。
  6232. * 设置时,若指定的剪辑不在 `this.clips` 中则会被自动添加至 `this.clips`。
  6233. * 具有相同的非空 UUID 的两个动画剪辑将被视为是相同的。
  6234. * @see [[playOnLoad]]
  6235. */
  6236. get defaultClip(): AnimationClip | null;
  6237. set defaultClip(value: AnimationClip | null);
  6238. static EventType: typeof __private._cocos_animation_animation_state__EventType;
  6239. /**
  6240. * @en
  6241. * Whether the default clip should get into playing when this components starts.
  6242. * Note, this field takes no effect if `crossFade()` or `play()` has been called before this component starts.
  6243. * @zh
  6244. * 是否在组件开始运行时自动播放默认剪辑。
  6245. * 注意,若在组件开始运行前调用了 `crossFade` 或 `play()`,此字段将不会生效。
  6246. */
  6247. playOnLoad: boolean;
  6248. /**
  6249. * @internal
  6250. */
  6251. protected _crossFade: __private._cocos_animation_cross_fade__CrossFade;
  6252. /**
  6253. * @internal
  6254. */
  6255. protected _nameToState: Record<string, AnimationState>;
  6256. /**
  6257. * @internal
  6258. */
  6259. protected _clips: (AnimationClip | null)[];
  6260. /**
  6261. * @internal
  6262. */
  6263. protected _defaultClip: AnimationClip | null;
  6264. onLoad(): void;
  6265. start(): void;
  6266. onEnable(): void;
  6267. onDisable(): void;
  6268. onDestroy(): void;
  6269. /**
  6270. * @en
  6271. * Switch to play specified animation state, without fading.
  6272. * @zh
  6273. * 立即切换到指定动画状态。
  6274. * @param name The name of the animation to be played, if absent, the default clip will be played
  6275. */
  6276. play(name?: string): void;
  6277. /**
  6278. * @en
  6279. * Smoothly switch to play specified animation state.
  6280. * @zh
  6281. * 平滑地切换到指定动画状态。
  6282. * @param name The name of the animation to switch to
  6283. * @param duration The duration of the cross fade, default value is 0.3s
  6284. */
  6285. crossFade(name: string, duration?: number): void;
  6286. /**
  6287. * @en
  6288. * Pause all animation states and all switching.
  6289. * @zh
  6290. * 暂停所有动画状态,并暂停所有切换。
  6291. */
  6292. pause(): void;
  6293. /**
  6294. * @en
  6295. * Resume all animation states and all switching.
  6296. * @zh
  6297. * 恢复所有动画状态,并恢复所有切换。
  6298. */
  6299. resume(): void;
  6300. /**
  6301. * @en
  6302. * Stop all animation states and all switching.
  6303. * @zh
  6304. * 停止所有动画状态,并停止所有切换。
  6305. */
  6306. stop(): void;
  6307. /**
  6308. * @en
  6309. * Get specified animation state.
  6310. * @zh
  6311. * 获取指定的动画状态。
  6312. * @param name The name of the animation
  6313. * @returns If no animation found, return null, otherwise the correspond animation state is returned
  6314. */
  6315. getState(name: string): AnimationState;
  6316. /**
  6317. * @en
  6318. * Creates a state for specified clip.
  6319. * If there is already a clip with same name, the existing animation state will be stopped and overridden.
  6320. * @zh
  6321. * 使用指定的动画剪辑创建一个动画状态。
  6322. * 若指定名称的动画状态已存在,已存在的动画状态将先被设为停止并被覆盖。
  6323. * @param clip The animation clip
  6324. * @param name The animation state name, if absent, the default clip's name will be used
  6325. * @returns The animation state created
  6326. */
  6327. createState(clip: AnimationClip, name?: string): AnimationState;
  6328. /**
  6329. * @en
  6330. * Stops and removes specified clip.
  6331. * @zh
  6332. * 停止并移除指定的动画状态。
  6333. * @param name The name of the animation state
  6334. */
  6335. removeState(name: string): void;
  6336. /**
  6337. * @zh
  6338. * 添加一个动画剪辑到 `this.clips`中并以此剪辑创建动画状态。
  6339. * @en
  6340. * Adds an animation clip into this component and creates a animation state for this clip.
  6341. * @param clip The animation clip
  6342. * @param name The animation state name, if absent, the default clip's name will be used
  6343. * @returns The created animation state
  6344. */
  6345. addClip(clip: AnimationClip, name?: string): AnimationState;
  6346. /**
  6347. * @en
  6348. * Remove clip from the animation list. This will remove the clip and any animation states based on it.<br>
  6349. * If there are animation states depend on the clip are playing or clip is defaultClip, it will not delete the clip.<br>
  6350. * But if force is true, then will always remove the clip and any animation states based on it. If clip is defaultClip,
  6351. * defaultClip will be reset to null
  6352. * @zh
  6353. * 从动画列表中移除指定的动画剪辑,<br/>
  6354. * 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。<br/>
  6355. * 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。<br/>
  6356. * @param force - If force is true, then will always remove the clip and any animation states based on it.
  6357. */
  6358. removeClip(clip: AnimationClip, force?: boolean): void;
  6359. /**
  6360. * @en
  6361. * Register animation event callback.<bg>
  6362. * The event arguments will provide the AnimationState which emit the event.<bg>
  6363. * When play an animation, will auto register the event callback to the AnimationState,<bg>
  6364. * and unregister the event callback from the AnimationState when animation stopped.
  6365. * @zh
  6366. * 注册动画事件回调。<bg>
  6367. * 回调的事件里将会附上发送事件的 AnimationState。<bg>
  6368. * 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  6369. * @param type The event type to listen to
  6370. * @param callback The callback when event triggered
  6371. * @param target The callee when invoke the callback, could be absent
  6372. * @return The registered callback
  6373. * @example
  6374. * ```ts
  6375. * onPlay: function (type, state) {
  6376. * // callback
  6377. * }
  6378. *
  6379. * // register event to all animation
  6380. * animation.on('play', this.onPlay, this);
  6381. * ```
  6382. */
  6383. on<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__EventType, callback: TFunction, thisArg?: any, once?: boolean): TFunction;
  6384. once<TFunction extends (...any: any[]) => void>(type: __private._cocos_animation_animation_state__EventType, callback: TFunction, thisArg?: any): TFunction;
  6385. /**
  6386. * @en
  6387. * Unregister animation event callback.
  6388. * @zh
  6389. * 取消注册动画事件回调。
  6390. * @param {String} type The event type to unregister
  6391. * @param {Function} callback The callback to unregister
  6392. * @param {Object} target The callee of the callback, could be absent
  6393. * @example
  6394. * ```ts
  6395. * // unregister event to all animation
  6396. * animation.off('play', this.onPlay, this);
  6397. * ```
  6398. */
  6399. off(type: __private._cocos_animation_animation_state__EventType, callback?: (...any: any[]) => void, thisArg?: any): void;
  6400. /**
  6401. * @internal
  6402. */
  6403. protected _createState(clip: AnimationClip, name?: string): AnimationState;
  6404. /**
  6405. * @internal
  6406. */
  6407. protected _doCreateState(clip: AnimationClip, name: string): AnimationState;
  6408. /**
  6409. * @internal This method only friends to skeletal animation component.
  6410. */
  6411. protected doPlayOrCrossFade(state: AnimationState, duration: number): void;
  6412. }
  6413. export namespace Animation {
  6414. export type EventType = __private._cocos_animation_animation_component__EventType_;
  6415. }
  6416. export namespace animation {
  6417. /**
  6418. * @en
  6419. * Represents variable's value.
  6420. * @zh
  6421. * 表示变量的值。
  6422. */
  6423. export type Value_experimental = Value | Readonly<math.Vec3> | Readonly<math.Quat>;
  6424. /**
  6425. * @en
  6426. * Represents animation graph variable types.
  6427. * @zh
  6428. * 表示动画图变量的类型。
  6429. */
  6430. export enum VariableType {
  6431. /**
  6432. * @en
  6433. * A floating.
  6434. * @zh
  6435. * 浮点数。
  6436. */
  6437. FLOAT = 0,
  6438. /**
  6439. * @en
  6440. * A boolean.
  6441. * @zh
  6442. * 布尔值。
  6443. */
  6444. BOOLEAN = 1,
  6445. /**
  6446. * @en
  6447. * A trigger.
  6448. * @zh
  6449. * 触发器。
  6450. */
  6451. TRIGGER = 2,
  6452. /**
  6453. * @en
  6454. * An integer.
  6455. * @zh
  6456. * 整数。
  6457. */
  6458. INTEGER = 3,
  6459. /**
  6460. * @zh
  6461. * 三维向量。
  6462. * @en
  6463. * Vector 3d.
  6464. */
  6465. VEC3_experimental = 4,
  6466. /**
  6467. * @zh
  6468. * 四元数。
  6469. * @en
  6470. * Quaternion.
  6471. */
  6472. QUAT_experimental = 5
  6473. }
  6474. /**
  6475. * @en
  6476. * Value proxy factory for setting uniform on material target.
  6477. * @zh
  6478. * 用于设置材质目标上指定 Uniform 的曲线值代理工厂。
  6479. */
  6480. export class UniformProxyFactory implements IValueProxyFactory {
  6481. /**
  6482. * @en Pass index.
  6483. * @zh Pass 索引。
  6484. */
  6485. passIndex: number;
  6486. /**
  6487. * @en Uniform name.
  6488. * @zh Uniform 名称。
  6489. */
  6490. uniformName: string;
  6491. /**
  6492. * @en
  6493. * Specify the aimed channel of the uniform.
  6494. * Use this when you're aiming at a single channel of the uniform instead of who uniform.
  6495. * For example, only green(1) channel of a color uniform.
  6496. * @zh
  6497. * 指定目标 Uniform 的通道。
  6498. * 当你希望设置 Uniform 单独的通道而非整个 Uniform 时应该当使用此字段。
  6499. * 例如,仅设置颜色 Uniform 的红色通道。
  6500. */
  6501. channelIndex: number | undefined;
  6502. constructor(uniformName?: string, passIndex?: number);
  6503. forTarget(target: unknown): IValueProxy | undefined;
  6504. }
  6505. /**
  6506. * @en
  6507. * Value proxy factory for setting morph weights of specified sub-mesh on model component target.
  6508. * @zh
  6509. * 用于设置模型组件目标上指定子网格的指定形状的形变权重的曲线值代理工厂。
  6510. */
  6511. export class MorphWeightValueProxy implements IValueProxyFactory {
  6512. /**
  6513. * @en Sub mesh index.
  6514. * @zh 子网格索引。
  6515. */
  6516. subMeshIndex: number;
  6517. /**
  6518. * @en Shape Index.
  6519. * @zh 形状索引。
  6520. */
  6521. shapeIndex: number;
  6522. forTarget(target: MeshRenderer): {
  6523. set: (value: number) => void;
  6524. };
  6525. }
  6526. /**
  6527. * @en
  6528. * Value proxy factory for setting morph weights of specified sub-mesh on model component target.
  6529. * @zh
  6530. * 用于设置模型组件目标上指定子网格形变权重的曲线值代理工厂。
  6531. */
  6532. export class MorphWeightsValueProxy implements IValueProxyFactory {
  6533. /**
  6534. * @en Sub-mesh index.
  6535. * @zh 子网格索引。
  6536. */
  6537. subMeshIndex: number;
  6538. forTarget(target: MeshRenderer): {
  6539. set: (value: number[]) => void;
  6540. };
  6541. }
  6542. /**
  6543. * @en
  6544. * Value proxy factory for setting morph weights of each sub-mesh on model component target.
  6545. * @zh
  6546. * 用于设置模型组件目标上所有子网格形变权重的曲线值代理工厂。
  6547. */
  6548. export class MorphWeightsAllValueProxy implements IValueProxyFactory {
  6549. forTarget(target: MeshRenderer): {
  6550. set: (value: number[]) => void;
  6551. };
  6552. }
  6553. /**
  6554. * @en
  6555. * A track describes how to trace the target and how to animate it.
  6556. * It's the basic unit of animation clip.
  6557. * @zh
  6558. * 轨道描述了动画目标的路径和动画的方式。它是动画剪辑的基础单元。
  6559. */
  6560. export abstract class Track {
  6561. /**
  6562. * @en Track path.
  6563. * @zh 轨道路径。
  6564. */
  6565. get path(): Readonly<TrackPath>;
  6566. set path(value: Readonly<TrackPath>);
  6567. /**
  6568. * @en Value proxy for the target.
  6569. * @zh 目标的值代理。
  6570. */
  6571. get proxy(): IValueProxyFactory | undefined;
  6572. set proxy(value: IValueProxyFactory | undefined);
  6573. /**
  6574. * @internal
  6575. */
  6576. get [__private._cocos_animation_tracks_track__trackBindingTag](): __private._cocos_animation_tracks_track__TrackBinding;
  6577. /**
  6578. * @en Channels on this track.
  6579. * @zh 此轨道上的通道。
  6580. * @returns Iterator to the channels.
  6581. */
  6582. channels(): Iterable<__private._cocos_animation_tracks_track__Channel>;
  6583. /**
  6584. * @en Time range of this track.
  6585. * @zh 此轨道的时间范围。
  6586. * @returns The time range.
  6587. */
  6588. range(): __private._cocos_animation_tracks_utils__Range;
  6589. /**
  6590. * @internal
  6591. */
  6592. abstract [__private._cocos_animation_define__createEvalSymbol](): __private._cocos_animation_tracks_track__TrackEval<any>;
  6593. }
  6594. /**
  6595. * @en Describes how to find the animation target.
  6596. * @zh 描述怎样寻址动画目标。
  6597. */
  6598. export class TrackPath {
  6599. /**
  6600. * @en The length of the path.
  6601. * @zh 此路径的段数。
  6602. */
  6603. get length(): number;
  6604. /**
  6605. * @en Appends a property path.
  6606. * @zh 附加一段属性路径。
  6607. * @param name The property's name.
  6608. * @returns `this`
  6609. */
  6610. toProperty(name: string): TrackPath;
  6611. /**
  6612. * @en Appends an array element path.
  6613. * @zh 附加一段数组元素路径。
  6614. * @param index The element's index.
  6615. * @returns `this`
  6616. */
  6617. toElement(index: number): TrackPath;
  6618. /**
  6619. * @en Appends a hierarchy path.
  6620. * @zh 附加一段层级路径。
  6621. * @param nodePath Path to the children.
  6622. * @returns `this`
  6623. */
  6624. toHierarchy(nodePath: string): TrackPath;
  6625. /**
  6626. * @en Appends a component path.
  6627. * @zh 附加一段组件路径。
  6628. * @param constructor @en The constructor of the component. @zh 组件的构造函数。
  6629. * @returns `this`
  6630. */
  6631. toComponent<T extends Component>(constructor: __private.__types_globals__Constructor<T> | string): TrackPath;
  6632. /**
  6633. * @internal Reserved for backward compatibility. DO NOT USE IT IN YOUR CODE.
  6634. */
  6635. toCustomized(resolver: __private._cocos_animation_tracks_track__CustomizedTrackPathResolver): TrackPath;
  6636. /**
  6637. * @en Appends paths to this path.
  6638. * @zh 附加指定路径到此路径后。
  6639. * @param trackPaths Paths to append.
  6640. * @returns `this`.
  6641. */
  6642. append(...trackPaths: TrackPath[]): TrackPath;
  6643. /**
  6644. * @zh 判断指定路径段是否是属性路径。
  6645. * @en Decides if the specific path segment is property path.
  6646. * @param index Index to the segment。
  6647. * @returns The judgement result.
  6648. */
  6649. isPropertyAt(index: number): boolean;
  6650. /**
  6651. * @zh 将指定路径段视为属性路径,获取其描述的属性。
  6652. * @en Treats the path segment as a property path. Obtains the property it describes.
  6653. * @param index Index to the segment。
  6654. * @returns The property.
  6655. */
  6656. parsePropertyAt(index: number): string;
  6657. /**
  6658. * @zh 判断指定路径段是否是数组元素路径。
  6659. * @en Decides if the specific path segment is an array element path.
  6660. * @param index Index to the segment。
  6661. * @returns The judgement result.
  6662. */
  6663. isElementAt(index: number): boolean;
  6664. /**
  6665. * @zh 将指定路径段视为数组元素路径,获取其描述的数组元素。
  6666. * @en Treats the path segment as an array element path. Obtains the element index it describes.
  6667. * @param index Index to the segment。
  6668. * @returns The element index.
  6669. */
  6670. parseElementAt(index: number): number;
  6671. /**
  6672. * @zh 判断指定路径段是否是层级路径。
  6673. * @en Decides if the specific path segment is a hierarchy path.
  6674. * @param index Index to the segment。
  6675. * @returns The judgement result.
  6676. */
  6677. isHierarchyAt(index: number): boolean;
  6678. /**
  6679. * @zh 将指定路径段视为层级路径,获取其描述的层级路径。
  6680. * @en Treats the path segment as a hierarchy path. Obtains the hierarchy path it describes.
  6681. * @param index Index to the segment。
  6682. * @returns The hierarchy path.
  6683. */
  6684. parseHierarchyAt(index: number): string;
  6685. /**
  6686. * @zh 判断指定路径段是否是组件路径。
  6687. * @en Decides if the specific path segment is a component path.
  6688. * @param index Index to the segment。
  6689. * @returns The judgement result.
  6690. */
  6691. isComponentAt(index: number): boolean;
  6692. /**
  6693. * @zh 将指定路径段视为组件路径,获取其描述的组件路径。
  6694. * @en Treats the path segment as a hierarchy path. Obtains the component path it describes.
  6695. * @param index Index to the segment。
  6696. * @returns The component path.
  6697. */
  6698. parseComponentAt(index: number): string;
  6699. /**
  6700. * @en Slices a interval of the path.
  6701. * @zh 分割指定区段上的路径。
  6702. * @param beginIndex Begin index to the segment. Default to 0.
  6703. * @param endIndex End index to the segment. Default to the last segment.
  6704. * @returns The new path.
  6705. */
  6706. slice(beginIndex?: number, endIndex?: number): TrackPath;
  6707. /**
  6708. * @internal
  6709. */
  6710. trace(object: unknown, beginIndex?: number, endIndex?: number): unknown;
  6711. /**
  6712. * @internal
  6713. */
  6714. [__private._cocos_animation_tracks_track__parseTrsPathTag](): {
  6715. node: string;
  6716. property: "position" | "scale" | "rotation" | "eulerAngles";
  6717. } | null;
  6718. /**
  6719. * @internal
  6720. */
  6721. [__private._cocos_animation_tracks_track__normalizedFollowTag](root: unknown, beginIndex: number, endIndex: number): unknown;
  6722. }
  6723. /**
  6724. * @en
  6725. * A real track animates a scalar attribute of target.
  6726. * @zh
  6727. * 实数轨道描述目标上某个标量属性的动画。
  6728. */
  6729. export class RealTrack extends __private._cocos_animation_tracks_track__SingleChannelTrack<RealCurve> {
  6730. /**
  6731. * @internal
  6732. */
  6733. protected createCurve(): RealCurve;
  6734. }
  6735. /**
  6736. * @en
  6737. * A vector track animates a vector(in 2, 3, 4 dimension) attribute of target.
  6738. * @zh
  6739. * 向量轨道描述目标上某个(二、三、四维)向量属性的动画。
  6740. */
  6741. export class VectorTrack extends Track {
  6742. constructor();
  6743. /**
  6744. * @en Gets or sets the count of components(dimension) available while evaluating of this track.
  6745. * @zh 获取或设置此轨道在求值时有效的分量数(维度)。
  6746. */
  6747. get componentsCount(): number;
  6748. set componentsCount(value: number);
  6749. /**
  6750. * @en The four channel of the track.
  6751. * @zh 返回此轨道的四条通道。
  6752. * @returns An readonly four length array in which
  6753. * the element at n denotes the channel of n-th vector component.
  6754. */
  6755. channels(): [
  6756. __private._cocos_animation_tracks_track__RealChannel,
  6757. __private._cocos_animation_tracks_track__RealChannel,
  6758. __private._cocos_animation_tracks_track__RealChannel,
  6759. __private._cocos_animation_tracks_track__RealChannel
  6760. ];
  6761. /**
  6762. * @internal
  6763. */
  6764. [__private._cocos_animation_define__createEvalSymbol](): __private._cocos_animation_tracks_vector_track__Vec2TrackEval | __private._cocos_animation_tracks_vector_track__Vec3TrackEval | __private._cocos_animation_tracks_vector_track__Vec4TrackEval;
  6765. }
  6766. /**
  6767. * @en
  6768. * A quaternion track animates a quaternion(rotation) attribute of target.
  6769. * @zh
  6770. * 四元数轨道描述目标上某个四元数(旋转)属性的动画。
  6771. */
  6772. export class QuatTrack extends __private._cocos_animation_tracks_track__SingleChannelTrack<QuatCurve> {
  6773. /**
  6774. * @internal
  6775. */
  6776. protected createCurve(): QuatCurve;
  6777. /**
  6778. * @internal
  6779. */
  6780. [__private._cocos_animation_define__createEvalSymbol](): __private._cocos_animation_tracks_quat_track__QuatTrackEval;
  6781. }
  6782. /**
  6783. * @en
  6784. * A color track animates a color attribute of target.
  6785. * @zh
  6786. * 颜色轨道描述目标上某个颜色属性的动画。
  6787. */
  6788. export class ColorTrack extends Track {
  6789. constructor();
  6790. /**
  6791. * @en The four channel of the track.
  6792. * @zh 返回此轨道的四条通道。
  6793. * @returns An readonly four length array in which
  6794. * the element at n denotes the channel of n-th(in order of RGBA) color component(in form of integer within 0-255).
  6795. */
  6796. channels(): [
  6797. __private._cocos_animation_tracks_track__RealChannel,
  6798. __private._cocos_animation_tracks_track__RealChannel,
  6799. __private._cocos_animation_tracks_track__RealChannel,
  6800. __private._cocos_animation_tracks_track__RealChannel
  6801. ];
  6802. /**
  6803. * @internal
  6804. */
  6805. [__private._cocos_animation_define__createEvalSymbol](): __private._cocos_animation_tracks_color_track__ColorTrackEval;
  6806. }
  6807. /**
  6808. * @en
  6809. * A size track animates a size attribute of target.
  6810. * @zh
  6811. * 尺寸轨道描述目标上某个尺寸属性的动画。
  6812. */
  6813. export class SizeTrack extends Track {
  6814. constructor();
  6815. /**
  6816. * @en The width channel and the height channel of the track.
  6817. * @zh 返回此轨道的宽度通道和高度通道。
  6818. * @returns An readonly array in which
  6819. * the first element is the width channel and the second element is the height channel.
  6820. */
  6821. channels(): [
  6822. __private._cocos_animation_tracks_track__RealChannel,
  6823. __private._cocos_animation_tracks_track__RealChannel
  6824. ];
  6825. /**
  6826. * @internal
  6827. */
  6828. [__private._cocos_animation_define__createEvalSymbol](): __private._cocos_animation_tracks_size_track__SizeTrackEval;
  6829. }
  6830. /**
  6831. * @en
  6832. * An object track animates an object of attribute of target.
  6833. * @zh
  6834. * 对象轨道描述目标上某个对象类型的属性的动画。
  6835. */
  6836. export class ObjectTrack<T> extends __private._cocos_animation_tracks_track__SingleChannelTrack<ObjectCurve<T>> {
  6837. /**
  6838. * @internal
  6839. */
  6840. protected createCurve(): ObjectCurve<T>;
  6841. }
  6842. /**
  6843. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6844. */
  6845. export function isPropertyPath(path: TargetPath): path is PropertyPath;
  6846. /**
  6847. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6848. */
  6849. export function isCustomPath<T extends ICustomTargetPath>(path: TargetPath, constructor: __private.__types_globals__Constructor<T>): path is T;
  6850. /**
  6851. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6852. */
  6853. export type PropertyPath = string | number;
  6854. /**
  6855. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6856. */
  6857. export interface ICustomTargetPath {
  6858. /**
  6859. * @en
  6860. * Gets next target from current target.
  6861. * If errors are encountered, `null` should be returned.
  6862. * @zh
  6863. * 从当前目标中获取下一个目标。
  6864. * 若错误发生,应返回 `null`。
  6865. * @param target
  6866. */
  6867. get(target: any): any;
  6868. }
  6869. /**
  6870. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6871. */
  6872. export type TargetPath = PropertyPath | ICustomTargetPath;
  6873. /**
  6874. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6875. */
  6876. export class HierarchyPath implements ICustomTargetPath {
  6877. path: string;
  6878. constructor(path?: string);
  6879. get(target: Node): Node | null;
  6880. }
  6881. /**
  6882. * @deprecated Since V3.3, use [[TrackPath]] instead.
  6883. */
  6884. export class ComponentPath implements ICustomTargetPath {
  6885. component: string;
  6886. constructor(component?: string);
  6887. get(target: Node): Component | null;
  6888. }
  6889. /**
  6890. * @en
  6891. * Value proxies are used to set curve value to target. They are "generalized assignment".
  6892. * Every value proxy associates with a target object.
  6893. * @zh
  6894. * 曲线值代理用来设置曲线值到目标,是广义的赋值。
  6895. * 每个曲线值代理都关联着一个目标对象。
  6896. */
  6897. export interface IValueProxy {
  6898. /**
  6899. * @en
  6900. * Gets the value from the target.
  6901. * This method is used for implementing component-wise animation in certain circumstance.
  6902. * @zh
  6903. * 从目标中获取值。某些情况下可能需要这个接口来实现分量动画。
  6904. */
  6905. get?: () => any;
  6906. /**
  6907. * @en
  6908. * Sets a value.
  6909. * @zh
  6910. * 设置曲线值到目标对象上。
  6911. */
  6912. set: (value: any) => void;
  6913. }
  6914. export interface IValueProxyFactory {
  6915. /**
  6916. * @en
  6917. * Returns a value proxy for specific target.
  6918. * @zh
  6919. * 返回指定目标的曲线值代理。
  6920. * @param target The target acquiring the value proxy.
  6921. * @returns The value proxy, or undefined if the proxy could not be created.
  6922. * In later case, a warn should be given before returning.
  6923. */
  6924. forTarget(target: any): IValueProxy | undefined;
  6925. }
  6926. /**
  6927. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6928. */
  6929. export const CubicSplineVec2Value: __private._cocos_animation_cubic_spline_value__CubicSplineValueConstructor<math.Vec2>;
  6930. /**
  6931. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6932. */
  6933. export type CubicSplineVec2Value = __private._cocos_animation_cubic_spline_value__ICubicSplineValue<math.Vec2>;
  6934. /**
  6935. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6936. */
  6937. export const CubicSplineVec3Value: __private._cocos_animation_cubic_spline_value__CubicSplineValueConstructor<math.Vec3>;
  6938. /**
  6939. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6940. */
  6941. export type CubicSplineVec3Value = __private._cocos_animation_cubic_spline_value__ICubicSplineValue<math.Vec3>;
  6942. /**
  6943. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6944. */
  6945. export const CubicSplineVec4Value: __private._cocos_animation_cubic_spline_value__CubicSplineValueConstructor<math.Vec4>;
  6946. /**
  6947. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6948. */
  6949. export type CubicSplineVec4Value = __private._cocos_animation_cubic_spline_value__ICubicSplineValue<math.Vec4>;
  6950. /**
  6951. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6952. */
  6953. export const CubicSplineQuatValue: __private._cocos_animation_cubic_spline_value__CubicSplineValueConstructor<math.Quat>;
  6954. /**
  6955. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  6956. */
  6957. export class CubicSplineNumberValue implements __private._cocos_animation_cubic_spline_value__ICubicSplineValue<number> {
  6958. dataPoint: number;
  6959. inTangent: number;
  6960. outTangent: number;
  6961. constructor(dataPoint: number, inTangent: number, outTangent: number);
  6962. lerp(to: CubicSplineNumberValue, t: number, dt: number): number;
  6963. getNoLerp(): number;
  6964. }
  6965. /**
  6966. * @en
  6967. * An opacity type which denotes what the animation graph seems like outside the engine.
  6968. * @zh
  6969. * 一个非透明的类型,它是动画图在引擎外部的表示。
  6970. */
  6971. export interface AnimationGraphRunTime {
  6972. /**
  6973. * @internal
  6974. */
  6975. readonly __brand: "AnimationGraph";
  6976. }
  6977. /**
  6978. * @en
  6979. * An opacity type which denotes what the animation graph variant seems like outside the engine.
  6980. * @zh
  6981. * 一个非透明的类型,它是动画图变体在引擎外部的表示。
  6982. */
  6983. export interface AnimationGraphVariantRunTime {
  6984. /**
  6985. * @internal
  6986. */
  6987. readonly __brand: "AnimationGraphVariant";
  6988. }
  6989. /**
  6990. * @en
  6991. * The animation controller component applies an animation graph
  6992. * to the node which it's attached to.
  6993. * When the controller starts, the animation graph is instantiated.
  6994. * Then you may set variables or query the running statuses of the animation graph instance.
  6995. * @zh
  6996. * 将动画图应用到动画控制器组件所挂载的节点上。
  6997. * 当动画控制器开始运行时,动画图会被实例化。然后便可以设置动画图实例中的变量或者查询动画图的运行状况。
  6998. */
  6999. export class AnimationController extends Component {
  7000. /**
  7001. * @zh
  7002. * 动画控制器所关联的动画图。
  7003. * @en
  7004. * The animation graph associated with the animation controller.
  7005. */
  7006. get graph(): AnimationGraphRunTime | AnimationGraphVariantRunTime | null;
  7007. set graph(value: AnimationGraphRunTime | AnimationGraphVariantRunTime | null);
  7008. /**
  7009. * @zh 获取动画图的层级数量。如果控制器没有指定动画图,则返回 0。
  7010. * @en Gets the count of layers in the animation graph.
  7011. * If no animation graph is specified, 0 is returned.
  7012. */
  7013. get layerCount(): number;
  7014. __preload(): void;
  7015. onDestroy(): void;
  7016. update(deltaTime: number): void;
  7017. /**
  7018. * @zh 获取动画图中的所有变量。
  7019. * @en Gets all the variables in the animation graph.
  7020. * @returns The iterator to the variables.
  7021. * @example
  7022. * ```ts
  7023. * for (const [name, { type }] of animationController.getVariables()) {
  7024. * log(`Name: ${name}, Type: ${type}`);
  7025. * }
  7026. * ```
  7027. */
  7028. getVariables(): Iterable<readonly [
  7029. string,
  7030. Readonly<{
  7031. type: VariableType;
  7032. }>
  7033. ]>;
  7034. /**
  7035. * @zh 设置动画图实例中变量的值。
  7036. * @en Sets the value of the variable in the animation graph instance.
  7037. * @param name @en Variable's name. @zh 变量的名称。
  7038. * @param value @en Variable's value. @zh 变量的值。
  7039. * @example
  7040. * ```ts
  7041. * animationController.setValue('speed', 3.14);
  7042. * animationController.setValue('crouching', true);
  7043. * animationController.setValue('attack', true);
  7044. * ```
  7045. */
  7046. setValue(name: string, value: Value): void;
  7047. /**
  7048. * @zh 设置动画图实例中变量的值。
  7049. * @en Sets the value of the variable in the animation graph instance.
  7050. * @param name @en Variable's name. @zh 变量的名称。
  7051. * @param value @en Variable's value. @zh 变量的值。
  7052. * @example
  7053. * ```ts
  7054. * animationController.setValue('speed', 3.14);
  7055. * animationController.setValue('crouching', true);
  7056. * animationController.setValue('attack', true);
  7057. * ```
  7058. * @experimental
  7059. */
  7060. setValue_experimental(name: string, value: Value_experimental): void;
  7061. /**
  7062. * @zh 获取动画图实例中变量的值。
  7063. * @en Gets the value of the variable in the animation graph instance.
  7064. * @param name @en Variable's name. @zh 变量的名称。
  7065. * @returns @en Variable's value. @zh 变量的值。
  7066. */
  7067. getValue(name: string): Value | undefined;
  7068. /**
  7069. * @zh 获取动画图实例中变量的值。
  7070. * @en Gets the value of the variable in the animation graph instance.
  7071. * @param name @en Variable's name. @zh 变量的名称。
  7072. * @returns @en Variable's value. @zh 变量的值。
  7073. */
  7074. getValue_experimental(name: string): Value_experimental | undefined;
  7075. /**
  7076. * @zh 获取动画图实例中当前状态的运行状况。
  7077. * @en Gets the running status of the current state in the animation graph instance.
  7078. * @param layer @en Index of the layer. @zh 层级索引。
  7079. * @returns @en The running status of the current state. `null` is returned if current state is not a motion state.
  7080. * @zh 当前的状态运作状态对象。如果当前的状态不是动作状态,则返回 `null`。
  7081. */
  7082. getCurrentStateStatus(layer: number): Readonly<MotionStateStatus> | null;
  7083. /**
  7084. * @zh 获取动画图实例中当前状态上包含的所有动画剪辑的运行状况。
  7085. * @en Gets the running status of all the animation clips added on the current state in the animation graph instance.
  7086. * @param layer @en Index of the layer. @zh 层级索引。
  7087. * @returns @en Iterable to the animation clip statuses on current state.
  7088. * An empty iterable is returned if current state is not a motion state.
  7089. * @zh 到动画剪辑运作状态的迭代器。若当前状态不是动画状态,则返回一个空的迭代器。
  7090. */
  7091. getCurrentClipStatuses(layer: number): Iterable<Readonly<ClipStatus>>;
  7092. /**
  7093. * @zh 获取动画图实例中当前正在进行的过渡的运行状况。
  7094. * @en Gets the running status of the transition currently in progress in the animation graph instance.
  7095. * @param layer @en Index of the layer. @zh 层级索引。
  7096. * @returns @en Current transition status. `null` is returned in case of no transition.
  7097. * @zh 当前正在进行的过渡,若没有进行任何过渡,则返回 `null`。
  7098. */
  7099. getCurrentTransition(layer: number): Readonly<TransitionStatus> | null;
  7100. /**
  7101. * @zh 获取动画图实例中下一个状态的运行状况。
  7102. * @en Gets the running status of the next state in the animation graph instance.
  7103. * @param layer @en Index of the layer. @zh 层级索引。
  7104. * @returns @en The running status of the next state. `null` is returned in case of no transition or if next state is not a motion state.
  7105. * @zh 下一状态运作状态对象,若未在进行过渡或下一状态不是动画状态,则返回 `null`。
  7106. */
  7107. getNextStateStatus(layer: number): Readonly<MotionStateStatus> | null;
  7108. /**
  7109. * @zh 获取动画图实例中下一个状态上添加的所有动画剪辑的运行状况。
  7110. * @en Gets the running status of all the animation clips added on the next state in the animation graph instance.
  7111. * @param layer @en Index of the layer. @zh 层级索引。
  7112. * @returns @en Iterable to the animation clip statuses on next state.
  7113. * An empty iterable is returned in case of no transition or next state is not a motion state.
  7114. * @zh 到下一状态上包含的动画剪辑运作状态的迭代器,若未在进行过渡或下一状态不是动画状态,则返回一个空的迭代器。
  7115. */
  7116. getNextClipStatuses(layer: number): Iterable<Readonly<ClipStatus>>;
  7117. /**
  7118. * @zh 获取层级权重。
  7119. * @en Gets the weight of specified layer.
  7120. * @param layer @en Index of the layer. @zh 层级索引。
  7121. */
  7122. getLayerWeight(layer: number): number;
  7123. /**
  7124. * @zh 设置层级权重。
  7125. * @en Sets the weight of specified layer.
  7126. * @param layer @en Index of the layer. @zh 层级索引。
  7127. */
  7128. setLayerWeight(layer: number, weight: number): void;
  7129. /**
  7130. * @zh 覆盖动画图实例中的动画剪辑。
  7131. * 对于每一对源剪辑、目标剪辑,
  7132. * 动画图(实例)中的出现的所有源剪辑都会被替换为目标剪辑,就好像动画图中一开始就使用的是目标剪辑。
  7133. * 不过,动画图当前的运转状态会依然保持不变,例如:
  7134. *
  7135. * - 若动作状态涉及的动画剪辑被替换,动作状态的播放进度百分比依然保持不变。
  7136. *
  7137. * - 若过渡的周期是相对的,即使在某一刻动画过渡的源头被替换,那么过渡的进度百分比也依然保持不变。
  7138. *
  7139. * 不管进行多少次覆盖,源剪辑应该一直指定为原始动画图中的动画剪辑。例如:
  7140. *
  7141. * ```ts
  7142. * // `originalClip` 是原始动画图中的剪辑对象,第一次希望将原剪辑覆盖为 `newClip1`,第二次希望将原剪辑覆盖为 `newClip2`
  7143. * animationController.overrideClips_experimental(new Map([ [originalClip, newClip1] ])); // 第一次覆盖
  7144. * animationController.overrideClips_experimental(new Map([ [newClip1, newClip2] ])); // 错误:第二次覆盖
  7145. * animationController.overrideClips_experimental(new Map([ [originalClip, newClip2] ])); // 正确:第二次覆盖
  7146. * ```
  7147. * @en Overrides the animation clips in animation graph instance.
  7148. * TODO
  7149. * @experimental
  7150. */
  7151. overrideClips_experimental(overrides: ___private._cocos_animation_marionette_clip_overriding__ReadonlyClipOverrideMap): void;
  7152. /**
  7153. * @zh 获取指定辅助曲线的当前值。
  7154. * @en Gets the current value of specified auxiliary curve.
  7155. * @param curveName @en Name of the auxiliary curve. @zh 辅助曲线的名字。
  7156. * @returns @zh 指定辅助曲线的当前值,如果指定辅助曲线不存在或动画图为空则返回 0。
  7157. * @en The current value of specified auxiliary curve,
  7158. * or 0 if specified adjoint curve does not exist or if the animation graph is null.
  7159. * @experimental
  7160. */
  7161. getAuxiliaryCurveValue_experimental(curveName: string): number;
  7162. }
  7163. /**
  7164. * @en
  7165. * Runtime clip status of a motion state.
  7166. * @zh
  7167. * 动作状态中包含的剪辑的运行状态。
  7168. */
  7169. export interface ClipStatus {
  7170. /**
  7171. * @en
  7172. * The clip object.
  7173. * @zh
  7174. * 剪辑对象。
  7175. */
  7176. clip: AnimationClip;
  7177. /**
  7178. * @en
  7179. * The clip's weight.
  7180. * @zh
  7181. * 剪辑的权重。
  7182. */
  7183. weight: number;
  7184. }
  7185. /**
  7186. * @en
  7187. * Runtime status of a transition.
  7188. * @zh
  7189. * 过渡的运行状态。
  7190. */
  7191. export interface TransitionStatus {
  7192. /**
  7193. * @en
  7194. * The duration of the transition.
  7195. * @zh
  7196. * 过渡的周期。
  7197. */
  7198. duration: number;
  7199. /**
  7200. * @en
  7201. * The progress of the transition.
  7202. * @zh
  7203. * 过渡的进度。
  7204. */
  7205. time: number;
  7206. }
  7207. /**
  7208. * @en
  7209. * Runtime status of a motion state.
  7210. * @zh
  7211. * 动作状态的运行状态。
  7212. */
  7213. export interface MotionStateStatus {
  7214. /**
  7215. * For testing.
  7216. * TODO: remove it.
  7217. * @internal
  7218. */
  7219. __DEBUG_ID__?: string;
  7220. /**
  7221. * @en
  7222. * The normalized time of the state.
  7223. * It would be the fraction part of `elapsed-time / duration` if elapsed time is non-negative,
  7224. * and would be 1 plus the fraction part of `(elapsed-time / duration)` otherwise.
  7225. * This is **NOT** the clip's progress if the state is not a clip motion or its wrap mode isn't loop.
  7226. * @zh
  7227. * 状态的规范化时间。
  7228. * 如果流逝的时间是非负的,它就是 `流逝时间 / 周期` 的小数部分;否则,它是 `(流逝时间 / 周期)` 的小数部分加 1。
  7229. * 它并不一定代表剪辑的进度,因为该状态可能并不是一个剪辑动作,或者它的循环模式并非循环。
  7230. */
  7231. progress: number;
  7232. }
  7233. /**
  7234. * @en State machine component.
  7235. * @zh 状态机组件。
  7236. */
  7237. export class StateMachineComponent {
  7238. /**
  7239. * @en
  7240. * Called when a motion state right after it entered.
  7241. * @zh
  7242. * 在刚刚进入动作状态时调用。
  7243. * @param controller The animation controller it within.
  7244. * @param motionStateStatus The status of the motion.
  7245. */
  7246. onMotionStateEnter(controller: AnimationController, motionStateStatus: Readonly<MotionStateStatus>): void;
  7247. /**
  7248. * @en
  7249. * Called when a motion state is going to be exited.
  7250. * @zh
  7251. * 在即将退出动作状态时调用。
  7252. * @param controller The animation controller it within.
  7253. * @param motionStateStatus The status of the motion.
  7254. */
  7255. onMotionStateExit(controller: AnimationController, motionStateStatus: Readonly<MotionStateStatus>): void;
  7256. /**
  7257. * @en
  7258. * Called when a motion state updated except for the first and last frame.
  7259. * @zh
  7260. * 在动作状态更新时调用,但不会在第一次和最后一次时调用。
  7261. * @param controller The animation controller it within.
  7262. * @param motionStateStatus The status of the motion.
  7263. */
  7264. onMotionStateUpdate(controller: AnimationController, motionStateStatus: Readonly<MotionStateStatus>): void;
  7265. /**
  7266. * @en
  7267. * Called when a state machine right after it entered.
  7268. * @zh
  7269. * 在刚刚进入状态机时调用。
  7270. * @param controller The animation controller it within.
  7271. */
  7272. onStateMachineEnter(controller: AnimationController): void;
  7273. /**
  7274. * @en
  7275. * Called when a state machine is going to be exited.
  7276. * @zh
  7277. * 在即将退出状态机时调用。
  7278. * @param controller The animation controller it within.
  7279. */
  7280. onStateMachineExit(controller: AnimationController): void;
  7281. }
  7282. export type Value = number | string | boolean;
  7283. }
  7284. export interface ILerpable {
  7285. /**
  7286. * 在当前曲线值与目标曲线值之间插值。
  7287. * @param to 目标曲线值。
  7288. * @param t 插值比率。
  7289. * @param dt 当前曲线值与目标曲线值的时间间隔,单位为秒。
  7290. * @returns 插值结果。
  7291. */
  7292. lerp(to: any, t: number, dt: number): any;
  7293. /**
  7294. * 当直接使用曲线值作为采样结果时的结果值,它应该等同于插值比率为 0 时的插值结果。
  7295. * @returns 插值比率为 0 时的插值结果。
  7296. */
  7297. getNoLerp?(): any;
  7298. }
  7299. /**
  7300. * @zh
  7301. * 采样动画曲线。
  7302. * @en
  7303. * Samples an animation curve.
  7304. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7305. * @param curve @zh 动画曲线。@en The curve.
  7306. * @param sampler @zh 采样器。@en The sampler.
  7307. * @param ratio @zh 采样比率。@en Sample ratio([0, 1]).
  7308. */
  7309. export function sampleAnimationCurve(curve: AnimCurve, sampler: RatioSampler, ratio: number): any;
  7310. /**
  7311. * @en
  7312. * Compute a new ratio by curve type.
  7313. * @zh
  7314. * 根据曲线类型计算新的比例。
  7315. * @param ratio - The origin ratio
  7316. * @param type - If it's Array, then ratio will be computed with bezierByTime.
  7317. * If it's string, then ratio will be computed with cc.easing function
  7318. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7319. */
  7320. export function computeRatioByType(ratio: number, type: AnimationClip._legacy.LegacyEasingMethod): number;
  7321. /**
  7322. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7323. */
  7324. export class RatioSampler {
  7325. ratios: number[];
  7326. constructor(ratios: number[]);
  7327. sample(ratio: number): number;
  7328. }
  7329. /**
  7330. * @en
  7331. * Animation curve.
  7332. * @zh
  7333. * 动画曲线。
  7334. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7335. */
  7336. export class AnimCurve {
  7337. static Linear: null;
  7338. static Bezier(controlPoints: number[]): BezierControlPoints;
  7339. types?: Array<(AnimationClip._legacy.LegacyEasingMethod | null)>;
  7340. type?: AnimationClip._legacy.LegacyEasingMethod | null;
  7341. constructor(propertyCurveData: Omit<AnimationClip._legacy.LegacyClipCurveData, "keys">, duration: number);
  7342. hasLerp(): boolean;
  7343. valueAt(index: number): any;
  7344. valueBetween(ratio: number, from: number, fromRatio: number, to: number, toRatio: number): any;
  7345. empty(): boolean;
  7346. /**
  7347. * Returns if this curve only yields constants.
  7348. */
  7349. constant(): boolean;
  7350. }
  7351. export class EventInfo {
  7352. events: any[];
  7353. /**
  7354. * @param func event function
  7355. * @param params event params
  7356. */
  7357. add(func: string, params: any[]): void;
  7358. }
  7359. export class AnimationManager extends System {
  7360. get blendState(): __private._cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyBlendStateBuffer;
  7361. static ID: string;
  7362. addCrossFade(crossFade: __private._cocos_animation_cross_fade__CrossFade): void;
  7363. removeCrossFade(crossFade: __private._cocos_animation_cross_fade__CrossFade): void;
  7364. update(dt: number): void;
  7365. destruct(): void;
  7366. addAnimation(anim: AnimationState): void;
  7367. removeAnimation(anim: AnimationState): void;
  7368. pushDelayEvent(fn: (...args: any[]) => void, thisArg: any, args: any[]): void;
  7369. addSockets(root: Node, sockets: Socket[]): void;
  7370. removeSockets(root: Node, sockets: Socket[]): void;
  7371. }
  7372. /**
  7373. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7374. */
  7375. export function getPathFromRoot(target: Node | null, root: Node): string;
  7376. /**
  7377. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7378. */
  7379. export function getWorldTransformUntilRoot(target: Node, root: Node, outMatrix: math.Mat4): math.Mat4;
  7380. /**
  7381. * @en
  7382. * The audio clip asset.
  7383. * @zh
  7384. * 音频片段资源。
  7385. */
  7386. export class AudioClip extends Asset {
  7387. static AudioType: typeof __private._pal_audio_type__AudioType;
  7388. protected _duration: number;
  7389. protected _loadMode: __private._pal_audio_type__AudioType;
  7390. protected _meta: __private._cocos_audio_audio_clip__AudioMeta | null;
  7391. destroy(): boolean;
  7392. /**
  7393. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7394. */
  7395. set _nativeAsset(meta: __private._cocos_audio_audio_clip__AudioMeta | null);
  7396. get _nativeAsset(): __private._cocos_audio_audio_clip__AudioMeta | null;
  7397. /**
  7398. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7399. */
  7400. get _nativeDep(): {
  7401. uuid: string;
  7402. audioLoadMode: __private._pal_audio_type__AudioType;
  7403. ext: string;
  7404. __isNative__: boolean;
  7405. };
  7406. get loadMode(): __private._pal_audio_type__AudioType;
  7407. validate(): boolean;
  7408. getDuration(): number;
  7409. /**
  7410. * @deprecated since v3.1.0, please use AudioSource.prototype.state instead.
  7411. */
  7412. get state(): __private._pal_audio_type__AudioState;
  7413. /**
  7414. * @deprecated since v3.1.0, please use AudioSource.prototype.getCurrentTime() instead.
  7415. */
  7416. getCurrentTime(): number;
  7417. /**
  7418. * @deprecated since v3.1.0, please use AudioSource.prototype.getVolume() instead.
  7419. */
  7420. getVolume(): number;
  7421. /**
  7422. * @deprecated since v3.1.0, please use AudioSource.prototype.getLoop() instead.
  7423. */
  7424. getLoop(): boolean;
  7425. /**
  7426. * @deprecated since v3.1.0, please use AudioSource.prototype.setCurrentTime() instead.
  7427. */
  7428. setCurrentTime(time: number): void;
  7429. /**
  7430. * @deprecated since v3.1.0, please use AudioSource.prototype.setVolume() instead.
  7431. */
  7432. setVolume(volume: number): void;
  7433. /**
  7434. * @deprecated since v3.1.0, please use AudioSource.prototype.setLoop() instead.
  7435. */
  7436. setLoop(loop: boolean): void;
  7437. /**
  7438. * @deprecated since v3.1.0, please use AudioSource.prototype.play() instead.
  7439. */
  7440. play(): void;
  7441. /**
  7442. * @deprecated since v3.1.0, please use AudioSource.prototype.pause() instead.
  7443. */
  7444. pause(): void;
  7445. /**
  7446. * @deprecated since v3.1.0, please use AudioSource.prototype.stop() instead.
  7447. */
  7448. stop(): void;
  7449. /**
  7450. * @deprecated since v3.1.0, please use AudioSource.prototype.playOneShot() instead.
  7451. */
  7452. playOneShot(volume?: number): void;
  7453. }
  7454. /**
  7455. * @en
  7456. * A representation of a single audio source, <br>
  7457. * contains basic functionalities like play, pause and stop.
  7458. * @zh
  7459. * 音频组件,代表单个音源,提供播放、暂停、停止等基本功能。
  7460. */
  7461. export class AudioSource extends Component {
  7462. static get maxAudioChannel(): number;
  7463. static AudioState: typeof __private._pal_audio_type__AudioState;
  7464. static EventType: typeof __private._cocos_audio_audio_source__AudioSourceEventType;
  7465. protected _clip: AudioClip | null;
  7466. protected _player: __private._pal_audio__AudioPlayer | null;
  7467. protected _loop: boolean;
  7468. protected _playOnAwake: boolean;
  7469. protected _volume: number;
  7470. /**
  7471. * @en
  7472. * The default AudioClip to be played for this audio source.
  7473. * @zh
  7474. * 设定要播放的音频。
  7475. */
  7476. set clip(val: AudioClip | null);
  7477. get clip(): AudioClip | null;
  7478. /**
  7479. * @en
  7480. * Is looping enabled for this audio source?
  7481. * @zh
  7482. * 是否循环播放音频?
  7483. */
  7484. set loop(val: boolean);
  7485. get loop(): boolean;
  7486. /**
  7487. * @en
  7488. * Is the autoplay enabled? <br>
  7489. * Note that for most platform autoplay will only start <br>
  7490. * after a user gesture is received, according to the latest autoplay policy: <br>
  7491. * https://www.chromium.org/audio-video/autoplay
  7492. * @zh
  7493. * 是否启用自动播放。 <br>
  7494. * 请注意,根据最新的自动播放策略,现在对大多数平台,自动播放只会在第一次收到用户输入后生效。 <br>
  7495. * 参考:https://www.chromium.org/audio-video/autoplay
  7496. */
  7497. set playOnAwake(val: boolean);
  7498. get playOnAwake(): boolean;
  7499. /**
  7500. * @en
  7501. * The volume of this audio source (0.0 to 1.0).<br>
  7502. * Note: Volume control may be ineffective on some platforms.
  7503. * @zh
  7504. * 音频的音量(大小范围为 0.0 到 1.0)。<br>
  7505. * 请注意,在某些平台上,音量控制可能不起效。<br>
  7506. */
  7507. set volume(val: number);
  7508. get volume(): number;
  7509. onLoad(): void;
  7510. onEnable(): void;
  7511. onDisable(): void;
  7512. onDestroy(): void;
  7513. /**
  7514. * @en
  7515. * Get PCM data from specified channel.
  7516. * Currently it is only available in Native platform and Web Audio (including Web and ByteDance platforms).
  7517. *
  7518. * @zh
  7519. * 通过指定的通道获取音频的 PCM data。
  7520. * 目前仅在原生平台和 Web Audio(包括 Web 和 字节平台)中可用。
  7521. *
  7522. * @param channelIndex The channel index. 0 is left channel, 1 is right channel.
  7523. * @returns A Promise to get the PCM data after audio is loaded.
  7524. *
  7525. * @example
  7526. * ```ts
  7527. * audioSource.getPCMData(0).then(dataView => {
  7528. * if (!dataView) return;
  7529. * for (let i = 0; i < dataView.length; ++i) {
  7530. * console.log('data: ' + dataView.getData(i));
  7531. * }
  7532. * });
  7533. * ```
  7534. */
  7535. getPCMData(channelIndex: number): Promise<AudioPCMDataView | undefined>;
  7536. /**
  7537. * @en
  7538. * Get the sample rate of audio.
  7539. * Currently it is only available in Native platform and Web Audio (including Web and ByteDance platforms).
  7540. *
  7541. * @zh
  7542. * 获取音频的采样率。
  7543. * 目前仅在原生平台和 Web Audio(包括 Web 和 字节平台)中可用。
  7544. *
  7545. * @returns A Promise to get the sample rate after audio is loaded.
  7546. */
  7547. getSampleRate(): Promise<number>;
  7548. /**
  7549. * @en
  7550. * Play the clip.<br>
  7551. * Restart if already playing.<br>
  7552. * Resume if paused.
  7553. *
  7554. * NOTE: On Web platforms, the Auto Play Policy bans auto playing audios at the first time, because the user gesture is required.
  7555. * there are 2 ways to play audios at the first time:
  7556. * - play audios in the callback of TOUCH_END or MOUSE_UP event
  7557. * - play audios straightly, the engine will auto play audios at the next user gesture.
  7558. *
  7559. * @zh
  7560. * 开始播放。<br>
  7561. * 如果音频处于正在播放状态,将会重新开始播放音频。<br>
  7562. * 如果音频处于暂停状态,则会继续播放音频。
  7563. *
  7564. * 注意:在 Web 平台,Auto Play Policy 禁止首次自动播放音频,因为需要发生用户交互之后才能播放音频。
  7565. * 有两种方式实现音频首次自动播放:
  7566. * - 在 TOUCH_END 或者 MOUSE_UP 的事件回调里播放音频。
  7567. * - 直接播放音频,引擎会在下一次发生用户交互时自动播放。
  7568. */
  7569. play(): void;
  7570. /**
  7571. * @en
  7572. * Pause the clip.
  7573. * @zh
  7574. * 暂停播放。
  7575. */
  7576. pause(): void;
  7577. /**
  7578. * @en
  7579. * Stop the clip.
  7580. * @zh
  7581. * 停止播放。
  7582. */
  7583. stop(): void;
  7584. /**
  7585. * @en
  7586. * Plays an AudioClip, and scales volume by volumeScale. The result volume is `audioSource.volume * volumeScale`. <br>
  7587. * @zh
  7588. * 以指定音量倍数播放一个音频一次。最终播放的音量为 `audioSource.volume * volumeScale`。 <br>
  7589. * @param clip The audio clip to be played.
  7590. * @param volumeScale volume scaling factor wrt. current value.
  7591. */
  7592. playOneShot(clip: AudioClip, volumeScale?: number): void;
  7593. protected _syncStates(): void;
  7594. /**
  7595. * @en
  7596. * Set current playback time, in seconds.
  7597. * @zh
  7598. * 以秒为单位设置当前播放时间。
  7599. * @param num playback time to jump to.
  7600. */
  7601. set currentTime(num: number);
  7602. /**
  7603. * @en
  7604. * Get the current playback time, in seconds.
  7605. * @zh
  7606. * 以秒为单位获取当前播放时间。
  7607. */
  7608. get currentTime(): number;
  7609. /**
  7610. * @en
  7611. * Get the audio duration, in seconds.
  7612. * @zh
  7613. * 获取以秒为单位的音频总时长。
  7614. */
  7615. get duration(): number;
  7616. /**
  7617. * @en
  7618. * Get current audio state.
  7619. * @zh
  7620. * 获取当前音频状态。
  7621. */
  7622. get state(): __private._pal_audio_type__AudioState;
  7623. /**
  7624. * @en
  7625. * Is the audio currently playing?
  7626. * @zh
  7627. * 当前音频是否正在播放?
  7628. */
  7629. get playing(): boolean;
  7630. }
  7631. export class AudioPCMDataView {
  7632. constructor(arrayBufferView: __private._pal_audio_type__AudioBufferView, normalizeFactor: number);
  7633. constructor(arrayBuffer: ArrayBuffer, Ctor: __private.__types_globals__Constructor<__private._pal_audio_type__AudioBufferView>, normalizeFactor: number);
  7634. get length(): number;
  7635. getData(offset: number): number;
  7636. }
  7637. /**
  7638. * @en The root manager of the renderer which manages all device resources and the render pipeline.
  7639. * @zh 基础渲染器管理类,管理所有设备相关的资源创建以及渲染管线。
  7640. */
  7641. export class Root {
  7642. /**
  7643. * @en The GFX device
  7644. * @zh GFX 设备
  7645. */
  7646. get device(): gfx.Device;
  7647. /**
  7648. * @en The main window
  7649. * @zh 主窗口
  7650. */
  7651. get mainWindow(): __private._cocos_render_scene_core_render_window__RenderWindow | null;
  7652. /**
  7653. * @en The current active window
  7654. * @zh 当前激活的窗口
  7655. */
  7656. set curWindow(window: __private._cocos_render_scene_core_render_window__RenderWindow | null);
  7657. get curWindow(): __private._cocos_render_scene_core_render_window__RenderWindow | null;
  7658. /**
  7659. * @e The temporary window for data transmission
  7660. * @zh 临时窗口(用于数据传输)
  7661. * @internal
  7662. */
  7663. set tempWindow(window: __private._cocos_render_scene_core_render_window__RenderWindow | null);
  7664. get tempWindow(): __private._cocos_render_scene_core_render_window__RenderWindow | null;
  7665. /**
  7666. * @en The windows list
  7667. * @zh 窗口列表
  7668. */
  7669. get windows(): __private._cocos_render_scene_core_render_window__RenderWindow[];
  7670. /**
  7671. * @zh
  7672. * 启用自定义渲染管线
  7673. */
  7674. get usesCustomPipeline(): boolean;
  7675. /**
  7676. * @en The render pipeline
  7677. * @zh 渲染管线
  7678. */
  7679. get pipeline(): __private._cocos_rendering_custom_pipeline__PipelineRuntime;
  7680. /**
  7681. * @en The custom render pipeline
  7682. * @zh 自定义渲染管线
  7683. */
  7684. get customPipeline(): rendering.BasicPipeline;
  7685. /**
  7686. * @en The pipeline events
  7687. * @zh 渲染管线事件
  7688. */
  7689. get pipelineEvent(): __private._cocos_rendering_pipeline_event__IPipelineEvent;
  7690. /**
  7691. * @en The draw batch manager for 2D UI, for engine internal usage, user do not need to use this.
  7692. * @zh 2D UI 渲染合批管理器,引擎内部使用,用户无需使用此接口
  7693. */
  7694. get batcher2D(): UI;
  7695. /**
  7696. * @en Render scenes list
  7697. * @zh 渲染场景列表
  7698. */
  7699. get scenes(): renderer.RenderScene[];
  7700. /**
  7701. * @en The debug view manager for rendering
  7702. * @zh 渲染调试管理器
  7703. */
  7704. get debugView(): DebugView;
  7705. /**
  7706. * @en The time cumulated in seconds since the game began running.
  7707. * @zh 累计时间(秒)。
  7708. */
  7709. get cumulativeTime(): number;
  7710. /**
  7711. * @en The current frame time in seconds.
  7712. * @zh 帧时间(秒)。
  7713. */
  7714. get frameTime(): number;
  7715. /**
  7716. * @en The frame count during the last second
  7717. * @zh 一秒内的累计帧数
  7718. */
  7719. get frameCount(): number;
  7720. /**
  7721. * @en The recent frame rate for the last second
  7722. * @zh 当前每秒帧率
  7723. */
  7724. get fps(): number;
  7725. /**
  7726. * @en The wanted frame rate set by user
  7727. * @zh 每秒设定帧率
  7728. */
  7729. set fixedFPS(fps: number);
  7730. get fixedFPS(): number;
  7731. /**
  7732. * @internal
  7733. */
  7734. get dataPoolManager(): __private._cocos_3d_skeletal_animation_data_pool_manager__DataPoolManager;
  7735. /**
  7736. * @en Whether the built-in deferred pipeline is used.
  7737. * @zh 是否启用内置延迟渲染管线
  7738. */
  7739. get useDeferredPipeline(): boolean;
  7740. get cameraList(): renderer.scene.Camera[];
  7741. /**
  7742. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7743. */
  7744. _createSceneFun: (root: Root) => renderer.RenderScene;
  7745. /**
  7746. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  7747. */
  7748. _createWindowFun: (root: Root) => __private._cocos_render_scene_core_render_window__RenderWindow;
  7749. /**
  7750. * @en The constructor of the root, user shouldn't create the root instance, it's managed by the [[Director]].
  7751. * @zh 构造函数,用户不应该自己创建任何 Root 对象,它是由 [[Director]] 管理的。
  7752. * @param device GFX device
  7753. */
  7754. constructor(device: gfx.Device);
  7755. /**
  7756. * @en The initialization function, user shouldn't initialize the root, it's managed by the [[Director]].
  7757. * @zh 初始化函数,用户不应该自己初始化 Root,它是由 [[Director]] 管理的。
  7758. * @param info Root initialization information
  7759. */
  7760. initialize(info: __private._cocos_root__IRootInfo): void;
  7761. /**
  7762. * @en Destroy the root, user shouldn't invoke this function, it will cause undefined behavior.
  7763. * @zh 销毁 Root,用户不应该调用此方法,会造成未知行为。
  7764. */
  7765. destroy(): void;
  7766. /**
  7767. * @en Resize the on-screen render windows.
  7768. * @zh 重置在屏窗口的大小。
  7769. * @param width The new width of the window.
  7770. * @param height The new height of the window.
  7771. * @param windowId The system window ID, optional for now.
  7772. */
  7773. resize(width: number, height: number, windowId?: number): void;
  7774. /**
  7775. * @en Setup the render pipeline
  7776. * @zh 设置渲染管线
  7777. * @param rppl The render pipeline
  7778. * @returns The setup is successful or not
  7779. */
  7780. setRenderPipeline(rppl?: RenderPipeline): boolean;
  7781. /**
  7782. * @en Notify the pipeline and all scenes that the global pipeline state have been updated so that they can update their render data and states.
  7783. * @zh 通知渲染管线和所有场景全局管线状态已更新,需要更新自身状态。
  7784. */
  7785. onGlobalPipelineStateChanged(): void;
  7786. /**
  7787. * @en Active the render window as the [[curWindow]]
  7788. * @zh 激活指定窗口为当前窗口 [[curWindow]]
  7789. * @param window The render window to be activated
  7790. */
  7791. activeWindow(window: __private._cocos_render_scene_core_render_window__RenderWindow): void;
  7792. /**
  7793. * @en Reset the time cumulated
  7794. * @zh 重置累计时间
  7795. */
  7796. resetCumulativeTime(): void;
  7797. /**
  7798. * @en The entry function of the render process for every frame.
  7799. * @zh 用于每帧执行渲染流程的入口函数
  7800. * @param deltaTime @en The delta time since last update. @zh 距离上一帧间隔时间
  7801. */
  7802. frameMove(deltaTime: number): void;
  7803. /**
  7804. * @en Create a render window
  7805. * @zh 创建一个新的窗口
  7806. * @param info @en The window creation information @zh 窗口描述信息
  7807. */
  7808. createWindow(info: __private._cocos_render_scene_core_render_window__IRenderWindowInfo): __private._cocos_render_scene_core_render_window__RenderWindow | null;
  7809. /**
  7810. * @en Destroy a render window
  7811. * @zh 销毁指定的窗口
  7812. * @param window The render window to be destroyed
  7813. */
  7814. destroyWindow(window: __private._cocos_render_scene_core_render_window__RenderWindow): void;
  7815. /**
  7816. * @en Destroy all render windows
  7817. * @zh 销毁全部窗口
  7818. */
  7819. destroyWindows(): void;
  7820. /**
  7821. * @en Create a render scene
  7822. * @zh 创建渲染场景
  7823. * @param info @en The creation information for render scene @zh 渲染场景描述信息
  7824. */
  7825. createScene(info: renderer.IRenderSceneInfo): renderer.RenderScene;
  7826. /**
  7827. * @en Destroy the given render scene
  7828. * @zh 销毁指定的渲染场景
  7829. * @param scene @en The render scene to be destroyed. @zh 要销毁的渲染场景
  7830. */
  7831. destroyScene(scene: renderer.RenderScene): void;
  7832. /**
  7833. * @en Destroy all render scenes.
  7834. * @zh 销毁全部场景。
  7835. */
  7836. destroyScenes(): void;
  7837. /**
  7838. * @en Create a model
  7839. * @zh 创建模型
  7840. * @param ModelCtor @en The class of the model @zh 模型的类
  7841. * @returns The model created
  7842. */
  7843. createModel<T extends renderer.scene.Model>(ModelCtor: typeof renderer.scene.Model): T;
  7844. /**
  7845. * @en Destroy the given model
  7846. * @zh 销毁指定的模型
  7847. * @param m @en The model to be destroyed @zh 要销毁的模型
  7848. */
  7849. destroyModel(m: renderer.scene.Model): void;
  7850. /**
  7851. * @en Create a camera
  7852. * @zh 创建一个相机
  7853. * @returns The camera created.
  7854. */
  7855. createCamera(): renderer.scene.Camera;
  7856. /**
  7857. * @en Create a light source
  7858. * @zh 创建光源
  7859. * @param LightCtor @en The class of the light @zh 光源的类
  7860. * @returns The light created
  7861. */
  7862. createLight<T extends renderer.scene.Light>(LightCtor: new () => T): T;
  7863. /**
  7864. * @en Destroy the given light
  7865. * @zh 销毁指定的光源
  7866. * @param l @en The light to be destroyed @zh 要销毁的光源
  7867. */
  7868. destroyLight(l: renderer.scene.Light): void;
  7869. /**
  7870. * @en recycle the given light to light object pool
  7871. * @zh 回收指定的光源到对象池
  7872. * @param l @en The light to be recycled @zh 要回收的光源
  7873. */
  7874. recycleLight(l: renderer.scene.Light): void;
  7875. }
  7876. export namespace gfx {
  7877. /**
  7878. * @en GFX sampler.
  7879. * @zh GFX 采样器。
  7880. */
  7881. export class Sampler extends GFXObject {
  7882. get info(): Readonly<SamplerInfo>;
  7883. get hash(): number;
  7884. protected _info: SamplerInfo;
  7885. protected _hash: number;
  7886. constructor(info: Readonly<SamplerInfo>, hash: number);
  7887. static computeHash(info: Readonly<SamplerInfo>): Filter;
  7888. static unpackFromHash(hash: number): SamplerInfo;
  7889. }
  7890. export class SamplerInfo {
  7891. minFilter: Filter;
  7892. magFilter: Filter;
  7893. mipFilter: Filter;
  7894. addressU: Address;
  7895. addressV: Address;
  7896. addressW: Address;
  7897. maxAnisotropy: number;
  7898. cmpFunc: ComparisonFunc;
  7899. constructor(minFilter?: Filter, magFilter?: Filter, mipFilter?: Filter, addressU?: Address, addressV?: Address, addressW?: Address, maxAnisotropy?: number, cmpFunc?: ComparisonFunc);
  7900. copy(info: Readonly<SamplerInfo>): SamplerInfo;
  7901. }
  7902. /**
  7903. * @en Get the memory size of the specified type.
  7904. * @zh 得到 GFX 数据类型的大小。
  7905. * @param type The target type.
  7906. */
  7907. export function GetTypeSize(type: Type): number;
  7908. /**
  7909. * @en GFX descriptor sets.
  7910. * @zh GFX 描述符集组。
  7911. */
  7912. export abstract class DescriptorSet extends GFXObject {
  7913. get layout(): DescriptorSetLayout;
  7914. protected _layout: DescriptorSetLayout | null;
  7915. protected _buffers: Buffer[];
  7916. protected _textures: Texture[];
  7917. protected _samplers: Sampler[];
  7918. protected _isDirty: boolean;
  7919. constructor();
  7920. abstract initialize(info: Readonly<DescriptorSetInfo>): void;
  7921. abstract destroy(): void;
  7922. abstract update(): void;
  7923. /**
  7924. * @en Bind buffer to the specified descriptor.
  7925. * @zh 在指定的描述符位置上绑定缓冲。
  7926. * @param binding The target binding.
  7927. * @param buffer The buffer to be bound.
  7928. */
  7929. bindBuffer(binding: number, buffer: Buffer, index?: number): void;
  7930. /**
  7931. * @en Bind sampler to the specified descriptor.
  7932. * @zh 在指定的描述符位置上绑定采样器。
  7933. * @param binding The target binding.
  7934. * @param sampler The sampler to be bound.
  7935. */
  7936. bindSampler(binding: number, sampler: Sampler, index?: number): void;
  7937. /**
  7938. * @en Bind texture to the specified descriptor.
  7939. * @zh 在指定的描述符位置上绑定纹理。
  7940. * @param binding The target binding.
  7941. * @param texture The texture to be bound.
  7942. */
  7943. bindTexture(binding: number, texture: Texture, index?: number, flags?: AccessFlags): void;
  7944. /**
  7945. * @en Get buffer from the specified binding location.
  7946. * @zh 获取当前指定绑定位置上的缓冲。
  7947. * @param binding The target binding.
  7948. */
  7949. getBuffer(binding: number, index?: number): Buffer;
  7950. /**
  7951. * @en Get sampler from the specified binding location.
  7952. * @zh 获取当前指定绑定位置上的采样器。
  7953. * @param binding The target binding.
  7954. */
  7955. getSampler(binding: number, index?: number): Sampler;
  7956. /**
  7957. * @en Get texture from the specified binding location.
  7958. * @zh 获取当前指定绑定位置上的贴图。
  7959. * @param binding The target binding.
  7960. */
  7961. getTexture(binding: number, index?: number): Texture;
  7962. }
  7963. /**
  7964. * @en GFX buffer.
  7965. * @zh GFX 缓冲。
  7966. */
  7967. export abstract class Buffer extends GFXObject {
  7968. /**
  7969. * @en Usage type of the buffer.
  7970. * @zh 缓冲使用方式。
  7971. */
  7972. get usage(): BufferUsage;
  7973. /**
  7974. * @en Memory usage of the buffer.
  7975. * @zh 缓冲的内存使用方式。
  7976. */
  7977. get memUsage(): MemoryUsage;
  7978. /**
  7979. * @en Size of the buffer.
  7980. * @zh 缓冲大小。
  7981. */
  7982. get size(): number;
  7983. /**
  7984. * @en Stride of the buffer.
  7985. * @zh 缓冲步长。
  7986. */
  7987. get stride(): number;
  7988. /**
  7989. * @en Count of the buffer wrt. stride.
  7990. * @zh 缓冲条目数量。
  7991. */
  7992. get count(): number;
  7993. get flags(): BufferFlags;
  7994. protected _usage: BufferUsage;
  7995. protected _memUsage: MemoryUsage;
  7996. protected _size: number;
  7997. protected _stride: number;
  7998. protected _count: number;
  7999. protected _flags: BufferFlags;
  8000. protected _isBufferView: boolean;
  8001. constructor();
  8002. abstract initialize(info: Readonly<BufferInfo> | Readonly<BufferViewInfo>): void;
  8003. abstract destroy(): void;
  8004. /**
  8005. * @en Resize the buffer.
  8006. * @zh 重置缓冲大小。
  8007. * @param size The new buffer size.
  8008. */
  8009. abstract resize(size: number): void;
  8010. /**
  8011. * @en Update the buffer data.
  8012. * @zh 更新缓冲内容。
  8013. * @param buffer The new buffer data.
  8014. * @param size Size in bytes to be updated.
  8015. */
  8016. abstract update(buffer: Readonly<BufferSource>, size?: number): void;
  8017. }
  8018. /**
  8019. * @en GFX command buffer.
  8020. * @zh GFX 命令缓冲。
  8021. */
  8022. export abstract class CommandBuffer extends GFXObject {
  8023. /**
  8024. * @en Type of the command buffer.
  8025. * @zh 命令缓冲类型。
  8026. */
  8027. get type(): CommandBufferType;
  8028. /**
  8029. * @en Type of the command buffer.
  8030. * @zh 命令缓冲类型。
  8031. */
  8032. get queue(): Queue;
  8033. /**
  8034. * @en Number of draw calls currently recorded.
  8035. * @zh 绘制调用次数。
  8036. */
  8037. get numDrawCalls(): number;
  8038. /**
  8039. * @en Number of instances currently recorded.
  8040. * @zh 绘制 Instance 数量。
  8041. */
  8042. get numInstances(): number;
  8043. /**
  8044. * @en Number of triangles currently recorded.
  8045. * @zh 绘制三角形数量。
  8046. */
  8047. get numTris(): number;
  8048. protected _queue: Queue | null;
  8049. protected _type: CommandBufferType;
  8050. protected _numDrawCalls: number;
  8051. protected _numInstances: number;
  8052. protected _numTris: number;
  8053. constructor();
  8054. abstract initialize(info: Readonly<CommandBufferInfo>): void;
  8055. abstract destroy(): void;
  8056. /**
  8057. * @en Begin recording commands.
  8058. * @zh 开始记录命令。
  8059. * @param renderPass [Secondary Command Buffer Only] The render pass the subsequent commands will be executed in
  8060. * @param subpass [Secondary Command Buffer Only] The subpass the subsequent commands will be executed in
  8061. * @param frameBuffer [Secondary Command Buffer Only, Optional] The framebuffer to be used in the subpass
  8062. */
  8063. abstract begin(renderPass?: RenderPass, subpass?: number, frameBuffer?: Framebuffer): void;
  8064. /**
  8065. * @en End recording commands.
  8066. * @zh 结束记录命令。
  8067. */
  8068. abstract end(): void;
  8069. /**
  8070. * @en Begin render pass.
  8071. * @zh 开始 RenderPass。
  8072. * @param framebuffer The frame buffer used.
  8073. * @param renderArea The target render area.
  8074. * @param clearFlag The clear flags.
  8075. * @param clearColors The clearing colors.
  8076. * @param clearDepth The clearing depth.
  8077. * @param clearStencil The clearing stencil.
  8078. */
  8079. abstract beginRenderPass(renderPass: RenderPass, framebuffer: Framebuffer, renderArea: Readonly<Rect>, clearColors: Readonly<Color[]>, clearDepth: number, clearStencil: number): void;
  8080. /**
  8081. * @en End render pass.
  8082. * @zh 结束 RenderPass。
  8083. */
  8084. abstract endRenderPass(): void;
  8085. /**
  8086. * @en Bind pipeline state.
  8087. * @zh 绑定 GFX 管线状态。
  8088. * @param pipelineState The pipeline state to be bound.
  8089. */
  8090. abstract bindPipelineState(pipelineState: PipelineState): void;
  8091. /**
  8092. * @en Bind a descriptor set. Note that the corresponding PiplieneState has to be bound first
  8093. * before calling this function, or the dynamic offset specified may be invalidated.
  8094. * @zh 绑定 GFX 描述符集。注意在调用此函数前,必须先绑定对应的 PipelineState,否则 dynamic offset 可能无效。
  8095. * @param set The target descriptor set index.
  8096. * @param descriptorSet The descriptor set to be bound.
  8097. * @param dynamicOffsets The offset numbers for dynamic bindings.
  8098. */
  8099. abstract bindDescriptorSet(set: number, descriptorSet: DescriptorSet, dynamicOffsets?: Readonly<number[]>): void;
  8100. /**
  8101. * @en Bind input assembler.
  8102. * @zh 绑定 GFX 输入汇集器。
  8103. * @param inputAssembler The input assembler to be bound.
  8104. */
  8105. abstract bindInputAssembler(inputAssembler: InputAssembler): void;
  8106. /**
  8107. * @en Set viewport.
  8108. * @zh 设置视口。
  8109. * @param viewport The new viewport.
  8110. */
  8111. abstract setViewport(viewport: Readonly<Viewport>): void;
  8112. /**
  8113. * @en Set scissor range.
  8114. * @zh 设置剪裁区域。
  8115. * @param scissor The new scissor range.
  8116. */
  8117. abstract setScissor(scissor: Readonly<Rect>): void;
  8118. /**
  8119. * @en Set line width.
  8120. * @zh 设置线宽。
  8121. * @param lineWidth The new line width.
  8122. */
  8123. abstract setLineWidth(lineWidth: number): void;
  8124. /**
  8125. * @en Set depth bias.
  8126. * @zh 设置深度偏移。
  8127. * @param depthBiasConstantFactor The new depth bias factor.
  8128. * @param depthBiasClamp The new depth bias clamp threshold.
  8129. * @param depthBiasSlopeFactor The new depth bias slope factor.
  8130. */
  8131. abstract setDepthBias(depthBiasConstantFactor: number, depthBiasClamp: number, depthBiasSlopeFactor: number): void;
  8132. /**
  8133. * @en Set blend constants.
  8134. * @zh 设置混合因子。
  8135. * @param blendConstants The new blend constants.
  8136. */
  8137. abstract setBlendConstants(blendConstants: Readonly<Color>): void;
  8138. /**
  8139. * @en Set depth bound.
  8140. * @zh 设置深度边界。
  8141. * @param minDepthBounds The new minimum depth bound.
  8142. * @param maxDepthBounds The new maximum depth bound.
  8143. */
  8144. abstract setDepthBound(minDepthBounds: number, maxDepthBounds: number): void;
  8145. /**
  8146. * @en Set stencil write mask.
  8147. * @zh 设置模板写掩码。
  8148. * @param face The effective triangle face.
  8149. * @param writeMask The new stencil write mask.
  8150. */
  8151. abstract setStencilWriteMask(face: StencilFace, writeMask: number): void;
  8152. /**
  8153. * @en Set stencil compare mask.
  8154. * @zh 设置模板比较掩码。
  8155. * @param face The effective triangle face.
  8156. * @param reference The new stencil reference constant.
  8157. * @param compareMask The new stencil read mask.
  8158. */
  8159. abstract setStencilCompareMask(face: StencilFace, reference: number, compareMask: number): void;
  8160. /**
  8161. * @en Draw the specified primitives.
  8162. * @zh 绘制。
  8163. * @param infoOrAssembler The draw call information.
  8164. */
  8165. abstract draw(infoOrAssembler: Readonly<DrawInfo> | Readonly<InputAssembler>): void;
  8166. /**
  8167. * @en Update buffer.
  8168. * @zh 更新缓冲。
  8169. * @param buffer The buffer to be updated.
  8170. * @param data The source data.
  8171. * @param size Size in bytes to be updated.
  8172. */
  8173. abstract updateBuffer(buffer: Buffer, data: Readonly<ArrayBuffer>, size?: number): void;
  8174. /**
  8175. * @en Copy buffer to texture.
  8176. * @zh 拷贝缓冲到纹理。
  8177. * @param srcBuff The buffer to be copied.
  8178. * @param dstTex The texture to copy to.
  8179. * @param dstLayout The target texture layout.
  8180. * @param regions The region descriptions.
  8181. */
  8182. abstract copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: Texture, regions: Readonly<BufferTextureCopy[]>): void;
  8183. /**
  8184. * @en Execute specified command buffers.
  8185. * @zh 执行一组命令缓冲。
  8186. * @param cmdBuffs The command buffers to be executed.
  8187. * @param count The number of command buffers to be executed.
  8188. */
  8189. abstract execute(cmdBuffs: Readonly<CommandBuffer[]>, count: number): void;
  8190. /**
  8191. * @en Insert pipeline memory barriers.
  8192. * @zh 插入管线内存屏障。
  8193. * @param barrier The global memory barrier to apply.
  8194. * @param textureBarriers The texture memory barriers to apply.
  8195. */
  8196. abstract pipelineBarrier(barrier: Readonly<GeneralBarrier> | null, bufferBarriers?: Readonly<__private._cocos_gfx_base_states_buffer_barrier__BufferBarrier[]>, buffers?: Readonly<Buffer[]>, textureBarriers?: Readonly<TextureBarrier[]>, textures?: Readonly<Texture[]>): void;
  8197. /**
  8198. * @en blit data from regions of source texture to regions of destination texture.
  8199. * @zh 将数据从源纹理的区域拷贝到目标纹理的区域。
  8200. *
  8201. * @param srcTexture The source texture.
  8202. * @param dstTexture The destination texture.
  8203. * @param regions The region descriptions.
  8204. * @param filter The filter to use.
  8205. */
  8206. abstract blitTexture(srcTexture: Readonly<Texture>, dstTexture: Texture, regions: Readonly<TextureBlit[]>, filter: Filter): void;
  8207. }
  8208. export function IsPowerOf2(x: number): boolean;
  8209. /**
  8210. * @en Get memory size of the specified fomat.
  8211. * @zh 获取指定格式对应的内存大小。
  8212. * @param format The target format.
  8213. * @param width The target width.
  8214. * @param height The target height.
  8215. * @param depth The target depth.
  8216. */
  8217. export function FormatSize(format: Format, width: number, height: number, depth: number): number;
  8218. /**
  8219. * @en Get memory size of the specified surface.
  8220. * @zh GFX 格式表面内存大小。
  8221. * @param format The target format.
  8222. * @param width The target width.
  8223. * @param height The target height.
  8224. * @param depth The target depth.
  8225. * @param mips The target mip levels.
  8226. */
  8227. export function FormatSurfaceSize(format: Format, width: number, height: number, depth: number, mips: number): number;
  8228. export function getTypedArrayConstructor(info: FormatInfo): __private.__types_globals__TypedArrayConstructor;
  8229. export function formatAlignment(format: Format): FormatAlignment;
  8230. export function alignTo(size: number, alignment: number): number;
  8231. /**
  8232. * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
  8233. * The following section is auto-generated from native/cocos/renderer/core/gfx/GFXDef-common.h
  8234. * by the script native/tools/gfx-define-generator/generate.js.
  8235. * Changes to these public interfaces should be made there first and synced back.
  8236. * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
  8237. */
  8238. /**
  8239. * @en Graphics object type
  8240. * @zh 图形API对象的类型
  8241. */
  8242. export enum ObjectType {
  8243. UNKNOWN = 0,
  8244. SWAPCHAIN = 1,
  8245. BUFFER = 2,
  8246. TEXTURE = 3,
  8247. RENDER_PASS = 4,
  8248. FRAMEBUFFER = 5,
  8249. SAMPLER = 6,
  8250. SHADER = 7,
  8251. DESCRIPTOR_SET_LAYOUT = 8,
  8252. PIPELINE_LAYOUT = 9,
  8253. PIPELINE_STATE = 10,
  8254. DESCRIPTOR_SET = 11,
  8255. INPUT_ASSEMBLER = 12,
  8256. COMMAND_BUFFER = 13,
  8257. QUEUE = 14,
  8258. QUERY_POOL = 15,
  8259. GLOBAL_BARRIER = 16,
  8260. TEXTURE_BARRIER = 17,
  8261. BUFFER_BARRIER = 18,
  8262. COUNT = 19
  8263. }
  8264. export enum Status {
  8265. UNREADY = 0,
  8266. FAILED = 1,
  8267. SUCCESS = 2
  8268. }
  8269. export enum API {
  8270. UNKNOWN = 0,
  8271. GLES2 = 1,
  8272. GLES3 = 2,
  8273. METAL = 3,
  8274. VULKAN = 4,
  8275. NVN = 5,
  8276. WEBGL = 6,
  8277. WEBGL2 = 7,
  8278. WEBGPU = 8
  8279. }
  8280. export enum SurfaceTransform {
  8281. IDENTITY = 0,
  8282. ROTATE_90 = 1,
  8283. ROTATE_180 = 2,
  8284. ROTATE_270 = 3
  8285. }
  8286. export enum Feature {
  8287. ELEMENT_INDEX_UINT = 0,
  8288. INSTANCED_ARRAYS = 1,
  8289. MULTIPLE_RENDER_TARGETS = 2,
  8290. BLEND_MINMAX = 3,
  8291. COMPUTE_SHADER = 4,
  8292. INPUT_ATTACHMENT_BENEFIT = 5,
  8293. SUBPASS_COLOR_INPUT = 6,
  8294. SUBPASS_DEPTH_STENCIL_INPUT = 7,
  8295. RASTERIZATION_ORDER_COHERENT = 8,
  8296. MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL = 9,
  8297. COUNT = 10
  8298. }
  8299. export enum Format {
  8300. UNKNOWN = 0,
  8301. A8 = 1,
  8302. L8 = 2,
  8303. LA8 = 3,
  8304. R8 = 4,
  8305. R8SN = 5,
  8306. R8UI = 6,
  8307. R8I = 7,
  8308. R16F = 8,
  8309. R16UI = 9,
  8310. R16I = 10,
  8311. R32F = 11,
  8312. R32UI = 12,
  8313. R32I = 13,
  8314. RG8 = 14,
  8315. RG8SN = 15,
  8316. RG8UI = 16,
  8317. RG8I = 17,
  8318. RG16F = 18,
  8319. RG16UI = 19,
  8320. RG16I = 20,
  8321. RG32F = 21,
  8322. RG32UI = 22,
  8323. RG32I = 23,
  8324. RGB8 = 24,
  8325. SRGB8 = 25,
  8326. RGB8SN = 26,
  8327. RGB8UI = 27,
  8328. RGB8I = 28,
  8329. RGB16F = 29,
  8330. RGB16UI = 30,
  8331. RGB16I = 31,
  8332. RGB32F = 32,
  8333. RGB32UI = 33,
  8334. RGB32I = 34,
  8335. RGBA8 = 35,
  8336. BGRA8 = 36,
  8337. SRGB8_A8 = 37,
  8338. RGBA8SN = 38,
  8339. RGBA8UI = 39,
  8340. RGBA8I = 40,
  8341. RGBA16F = 41,
  8342. RGBA16UI = 42,
  8343. RGBA16I = 43,
  8344. RGBA32F = 44,
  8345. RGBA32UI = 45,
  8346. RGBA32I = 46,
  8347. R5G6B5 = 47,
  8348. R11G11B10F = 48,
  8349. RGB5A1 = 49,
  8350. RGBA4 = 50,
  8351. RGB10A2 = 51,
  8352. RGB10A2UI = 52,
  8353. RGB9E5 = 53,
  8354. DEPTH = 54,
  8355. DEPTH_STENCIL = 55,
  8356. BC1 = 56,
  8357. BC1_ALPHA = 57,
  8358. BC1_SRGB = 58,
  8359. BC1_SRGB_ALPHA = 59,
  8360. BC2 = 60,
  8361. BC2_SRGB = 61,
  8362. BC3 = 62,
  8363. BC3_SRGB = 63,
  8364. BC4 = 64,
  8365. BC4_SNORM = 65,
  8366. BC5 = 66,
  8367. BC5_SNORM = 67,
  8368. BC6H_UF16 = 68,
  8369. BC6H_SF16 = 69,
  8370. BC7 = 70,
  8371. BC7_SRGB = 71,
  8372. ETC_RGB8 = 72,
  8373. ETC2_RGB8 = 73,
  8374. ETC2_SRGB8 = 74,
  8375. ETC2_RGB8_A1 = 75,
  8376. ETC2_SRGB8_A1 = 76,
  8377. ETC2_RGBA8 = 77,
  8378. ETC2_SRGB8_A8 = 78,
  8379. EAC_R11 = 79,
  8380. EAC_R11SN = 80,
  8381. EAC_RG11 = 81,
  8382. EAC_RG11SN = 82,
  8383. PVRTC_RGB2 = 83,
  8384. PVRTC_RGBA2 = 84,
  8385. PVRTC_RGB4 = 85,
  8386. PVRTC_RGBA4 = 86,
  8387. PVRTC2_2BPP = 87,
  8388. PVRTC2_4BPP = 88,
  8389. ASTC_RGBA_4X4 = 89,
  8390. ASTC_RGBA_5X4 = 90,
  8391. ASTC_RGBA_5X5 = 91,
  8392. ASTC_RGBA_6X5 = 92,
  8393. ASTC_RGBA_6X6 = 93,
  8394. ASTC_RGBA_8X5 = 94,
  8395. ASTC_RGBA_8X6 = 95,
  8396. ASTC_RGBA_8X8 = 96,
  8397. ASTC_RGBA_10X5 = 97,
  8398. ASTC_RGBA_10X6 = 98,
  8399. ASTC_RGBA_10X8 = 99,
  8400. ASTC_RGBA_10X10 = 100,
  8401. ASTC_RGBA_12X10 = 101,
  8402. ASTC_RGBA_12X12 = 102,
  8403. ASTC_SRGBA_4X4 = 103,
  8404. ASTC_SRGBA_5X4 = 104,
  8405. ASTC_SRGBA_5X5 = 105,
  8406. ASTC_SRGBA_6X5 = 106,
  8407. ASTC_SRGBA_6X6 = 107,
  8408. ASTC_SRGBA_8X5 = 108,
  8409. ASTC_SRGBA_8X6 = 109,
  8410. ASTC_SRGBA_8X8 = 110,
  8411. ASTC_SRGBA_10X5 = 111,
  8412. ASTC_SRGBA_10X6 = 112,
  8413. ASTC_SRGBA_10X8 = 113,
  8414. ASTC_SRGBA_10X10 = 114,
  8415. ASTC_SRGBA_12X10 = 115,
  8416. ASTC_SRGBA_12X12 = 116,
  8417. COUNT = 117
  8418. }
  8419. export enum FormatType {
  8420. NONE = 0,
  8421. UNORM = 1,
  8422. SNORM = 2,
  8423. UINT = 3,
  8424. INT = 4,
  8425. UFLOAT = 5,
  8426. FLOAT = 6
  8427. }
  8428. export enum Type {
  8429. UNKNOWN = 0,
  8430. BOOL = 1,
  8431. BOOL2 = 2,
  8432. BOOL3 = 3,
  8433. BOOL4 = 4,
  8434. INT = 5,
  8435. INT2 = 6,
  8436. INT3 = 7,
  8437. INT4 = 8,
  8438. UINT = 9,
  8439. UINT2 = 10,
  8440. UINT3 = 11,
  8441. UINT4 = 12,
  8442. FLOAT = 13,
  8443. FLOAT2 = 14,
  8444. FLOAT3 = 15,
  8445. FLOAT4 = 16,
  8446. MAT2 = 17,
  8447. MAT2X3 = 18,
  8448. MAT2X4 = 19,
  8449. MAT3X2 = 20,
  8450. MAT3 = 21,
  8451. MAT3X4 = 22,
  8452. MAT4X2 = 23,
  8453. MAT4X3 = 24,
  8454. MAT4 = 25,
  8455. SAMPLER1D = 26,
  8456. SAMPLER1D_ARRAY = 27,
  8457. SAMPLER2D = 28,
  8458. SAMPLER2D_ARRAY = 29,
  8459. SAMPLER3D = 30,
  8460. SAMPLER_CUBE = 31,
  8461. SAMPLER = 32,
  8462. TEXTURE1D = 33,
  8463. TEXTURE1D_ARRAY = 34,
  8464. TEXTURE2D = 35,
  8465. TEXTURE2D_ARRAY = 36,
  8466. TEXTURE3D = 37,
  8467. TEXTURE_CUBE = 38,
  8468. IMAGE1D = 39,
  8469. IMAGE1D_ARRAY = 40,
  8470. IMAGE2D = 41,
  8471. IMAGE2D_ARRAY = 42,
  8472. IMAGE3D = 43,
  8473. IMAGE_CUBE = 44,
  8474. SUBPASS_INPUT = 45,
  8475. COUNT = 46
  8476. }
  8477. export enum BufferUsageBit {
  8478. NONE = 0,
  8479. TRANSFER_SRC = 1,
  8480. TRANSFER_DST = 2,
  8481. INDEX = 4,
  8482. VERTEX = 8,
  8483. UNIFORM = 16,
  8484. STORAGE = 32,
  8485. INDIRECT = 64
  8486. }
  8487. export enum BufferFlagBit {
  8488. NONE = 0
  8489. }
  8490. export enum MemoryAccessBit {
  8491. NONE = 0,
  8492. READ_ONLY = 1,
  8493. WRITE_ONLY = 2,
  8494. READ_WRITE = 3
  8495. }
  8496. export enum MemoryUsageBit {
  8497. NONE = 0,
  8498. DEVICE = 1,
  8499. HOST = 2
  8500. }
  8501. export enum TextureType {
  8502. TEX1D = 0,
  8503. TEX2D = 1,
  8504. TEX3D = 2,
  8505. CUBE = 3,
  8506. TEX1D_ARRAY = 4,
  8507. TEX2D_ARRAY = 5
  8508. }
  8509. export enum TextureUsageBit {
  8510. NONE = 0,
  8511. TRANSFER_SRC = 1,
  8512. TRANSFER_DST = 2,
  8513. SAMPLED = 4,
  8514. STORAGE = 8,
  8515. COLOR_ATTACHMENT = 16,
  8516. DEPTH_STENCIL_ATTACHMENT = 32,
  8517. INPUT_ATTACHMENT = 64
  8518. }
  8519. export enum TextureFlagBit {
  8520. NONE = 0,
  8521. GEN_MIPMAP = 1,
  8522. GENERAL_LAYOUT = 2,
  8523. EXTERNAL_OES = 4,
  8524. EXTERNAL_NORMAL = 8,
  8525. LAZILY_ALLOCATED = 16,
  8526. MUTABLE_VIEW_FORMAT = 64,
  8527. MUTABLE_STORAGE = 128
  8528. }
  8529. export enum FormatFeatureBit {
  8530. NONE = 0,
  8531. RENDER_TARGET = 1,
  8532. SAMPLED_TEXTURE = 2,
  8533. LINEAR_FILTER = 4,
  8534. STORAGE_TEXTURE = 8,
  8535. VERTEX_ATTRIBUTE = 16
  8536. }
  8537. export enum SampleCount {
  8538. X1 = 1,
  8539. X2 = 2,
  8540. X4 = 4,
  8541. X8 = 8,
  8542. X16 = 16,
  8543. X32 = 32,
  8544. X64 = 64
  8545. }
  8546. export enum VsyncMode {
  8547. OFF = 0,
  8548. ON = 1,
  8549. RELAXED = 2,
  8550. MAILBOX = 3,
  8551. HALF = 4
  8552. }
  8553. export enum Filter {
  8554. NONE = 0,
  8555. POINT = 1,
  8556. LINEAR = 2,
  8557. ANISOTROPIC = 3
  8558. }
  8559. export enum Address {
  8560. WRAP = 0,
  8561. MIRROR = 1,
  8562. CLAMP = 2,
  8563. BORDER = 3
  8564. }
  8565. export enum ComparisonFunc {
  8566. NEVER = 0,
  8567. LESS = 1,
  8568. EQUAL = 2,
  8569. LESS_EQUAL = 3,
  8570. GREATER = 4,
  8571. NOT_EQUAL = 5,
  8572. GREATER_EQUAL = 6,
  8573. ALWAYS = 7
  8574. }
  8575. export enum StencilOp {
  8576. ZERO = 0,
  8577. KEEP = 1,
  8578. REPLACE = 2,
  8579. INCR = 3,
  8580. DECR = 4,
  8581. INVERT = 5,
  8582. INCR_WRAP = 6,
  8583. DECR_WRAP = 7
  8584. }
  8585. export enum BlendFactor {
  8586. ZERO = 0,
  8587. ONE = 1,
  8588. SRC_ALPHA = 2,
  8589. DST_ALPHA = 3,
  8590. ONE_MINUS_SRC_ALPHA = 4,
  8591. ONE_MINUS_DST_ALPHA = 5,
  8592. SRC_COLOR = 6,
  8593. DST_COLOR = 7,
  8594. ONE_MINUS_SRC_COLOR = 8,
  8595. ONE_MINUS_DST_COLOR = 9,
  8596. SRC_ALPHA_SATURATE = 10,
  8597. CONSTANT_COLOR = 11,
  8598. ONE_MINUS_CONSTANT_COLOR = 12,
  8599. CONSTANT_ALPHA = 13,
  8600. ONE_MINUS_CONSTANT_ALPHA = 14
  8601. }
  8602. export enum BlendOp {
  8603. ADD = 0,
  8604. SUB = 1,
  8605. REV_SUB = 2,
  8606. MIN = 3,
  8607. MAX = 4
  8608. }
  8609. export enum ColorMask {
  8610. NONE = 0,
  8611. R = 1,
  8612. G = 2,
  8613. B = 4,
  8614. A = 8,
  8615. ALL = 15
  8616. }
  8617. export enum ShaderStageFlagBit {
  8618. NONE = 0,
  8619. VERTEX = 1,
  8620. CONTROL = 2,
  8621. EVALUATION = 4,
  8622. GEOMETRY = 8,
  8623. FRAGMENT = 16,
  8624. COMPUTE = 32,
  8625. ALL = 63
  8626. }
  8627. export enum LoadOp {
  8628. LOAD = 0,
  8629. CLEAR = 1,
  8630. DISCARD = 2
  8631. }
  8632. export enum StoreOp {
  8633. STORE = 0,
  8634. DISCARD = 1
  8635. }
  8636. export enum AccessFlagBit {
  8637. NONE = 0,
  8638. INDIRECT_BUFFER = 1,
  8639. INDEX_BUFFER = 2,
  8640. VERTEX_BUFFER = 4,
  8641. VERTEX_SHADER_READ_UNIFORM_BUFFER = 8,
  8642. VERTEX_SHADER_READ_TEXTURE = 16,
  8643. VERTEX_SHADER_READ_OTHER = 32,
  8644. FRAGMENT_SHADER_READ_UNIFORM_BUFFER = 64,
  8645. FRAGMENT_SHADER_READ_TEXTURE = 128,
  8646. FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT = 256,
  8647. FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT = 512,
  8648. FRAGMENT_SHADER_READ_OTHER = 1024,
  8649. COLOR_ATTACHMENT_READ = 2048,
  8650. DEPTH_STENCIL_ATTACHMENT_READ = 4096,
  8651. COMPUTE_SHADER_READ_UNIFORM_BUFFER = 8192,
  8652. COMPUTE_SHADER_READ_TEXTURE = 16384,
  8653. COMPUTE_SHADER_READ_OTHER = 32768,
  8654. TRANSFER_READ = 65536,
  8655. HOST_READ = 131072,
  8656. PRESENT = 262144,
  8657. VERTEX_SHADER_WRITE = 524288,
  8658. FRAGMENT_SHADER_WRITE = 1048576,
  8659. COLOR_ATTACHMENT_WRITE = 2097152,
  8660. DEPTH_STENCIL_ATTACHMENT_WRITE = 4194304,
  8661. COMPUTE_SHADER_WRITE = 8388608,
  8662. TRANSFER_WRITE = 16777216,
  8663. HOST_PREINITIALIZED = 33554432,
  8664. HOST_WRITE = 67108864
  8665. }
  8666. export enum ResolveMode {
  8667. NONE = 0,
  8668. SAMPLE_ZERO = 1,
  8669. AVERAGE = 2,
  8670. MIN = 3,
  8671. MAX = 4
  8672. }
  8673. export enum PipelineBindPoint {
  8674. GRAPHICS = 0,
  8675. COMPUTE = 1,
  8676. RAY_TRACING = 2
  8677. }
  8678. export enum PrimitiveMode {
  8679. POINT_LIST = 0,
  8680. LINE_LIST = 1,
  8681. LINE_STRIP = 2,
  8682. LINE_LOOP = 3,
  8683. LINE_LIST_ADJACENCY = 4,
  8684. LINE_STRIP_ADJACENCY = 5,
  8685. ISO_LINE_LIST = 6,
  8686. TRIANGLE_LIST = 7,
  8687. TRIANGLE_STRIP = 8,
  8688. TRIANGLE_FAN = 9,
  8689. TRIANGLE_LIST_ADJACENCY = 10,
  8690. TRIANGLE_STRIP_ADJACENCY = 11,
  8691. TRIANGLE_PATCH_ADJACENCY = 12,
  8692. QUAD_PATCH_LIST = 13
  8693. }
  8694. export enum PolygonMode {
  8695. FILL = 0,
  8696. POINT = 1,
  8697. LINE = 2
  8698. }
  8699. export enum ShadeModel {
  8700. GOURAND = 0,
  8701. FLAT = 1
  8702. }
  8703. export enum CullMode {
  8704. NONE = 0,
  8705. FRONT = 1,
  8706. BACK = 2
  8707. }
  8708. export enum DynamicStateFlagBit {
  8709. NONE = 0,
  8710. LINE_WIDTH = 1,
  8711. DEPTH_BIAS = 2,
  8712. BLEND_CONSTANTS = 4,
  8713. DEPTH_BOUNDS = 8,
  8714. STENCIL_WRITE_MASK = 16,
  8715. STENCIL_COMPARE_MASK = 32
  8716. }
  8717. export enum StencilFace {
  8718. FRONT = 1,
  8719. BACK = 2,
  8720. ALL = 3
  8721. }
  8722. export enum DescriptorType {
  8723. UNKNOWN = 0,
  8724. UNIFORM_BUFFER = 1,
  8725. DYNAMIC_UNIFORM_BUFFER = 2,
  8726. STORAGE_BUFFER = 4,
  8727. DYNAMIC_STORAGE_BUFFER = 8,
  8728. SAMPLER_TEXTURE = 16,
  8729. SAMPLER = 32,
  8730. TEXTURE = 64,
  8731. STORAGE_IMAGE = 128,
  8732. INPUT_ATTACHMENT = 256
  8733. }
  8734. export enum QueueType {
  8735. GRAPHICS = 0,
  8736. COMPUTE = 1,
  8737. TRANSFER = 2
  8738. }
  8739. export enum QueryType {
  8740. OCCLUSION = 0,
  8741. PIPELINE_STATISTICS = 1,
  8742. TIMESTAMP = 2
  8743. }
  8744. export enum CommandBufferType {
  8745. PRIMARY = 0,
  8746. SECONDARY = 1
  8747. }
  8748. export enum ClearFlagBit {
  8749. NONE = 0,
  8750. COLOR = 1,
  8751. DEPTH = 2,
  8752. STENCIL = 4,
  8753. DEPTH_STENCIL = 6,
  8754. ALL = 7
  8755. }
  8756. export enum BarrierType {
  8757. FULL = 0,
  8758. SPLIT_BEGIN = 1,
  8759. SPLIT_END = 2
  8760. }
  8761. export enum PassType {
  8762. RASTER = 0,
  8763. COMPUTE = 1,
  8764. COPY = 2,
  8765. MOVE = 3,
  8766. RAYTRACE = 4,
  8767. PRESENT = 5
  8768. }
  8769. export type BufferUsage = BufferUsageBit;
  8770. export type BufferFlags = BufferFlagBit;
  8771. export type MemoryAccess = MemoryAccessBit;
  8772. export type MemoryUsage = MemoryUsageBit;
  8773. export type TextureUsage = TextureUsageBit;
  8774. export type TextureFlags = TextureFlagBit;
  8775. export type FormatFeature = FormatFeatureBit;
  8776. export type ShaderStageFlags = ShaderStageFlagBit;
  8777. export type AccessFlags = AccessFlagBit;
  8778. export type DynamicStateFlags = DynamicStateFlagBit;
  8779. export type ClearFlags = ClearFlagBit;
  8780. export class Size {
  8781. x: number;
  8782. y: number;
  8783. z: number;
  8784. constructor(x?: number, y?: number, z?: number);
  8785. copy(info: Readonly<Size>): Size;
  8786. }
  8787. export class DeviceCaps {
  8788. maxVertexAttributes: number;
  8789. maxVertexUniformVectors: number;
  8790. maxFragmentUniformVectors: number;
  8791. maxTextureUnits: number;
  8792. maxImageUnits: number;
  8793. maxVertexTextureUnits: number;
  8794. maxColorRenderTargets: number;
  8795. maxShaderStorageBufferBindings: number;
  8796. maxShaderStorageBlockSize: number;
  8797. maxUniformBufferBindings: number;
  8798. maxUniformBlockSize: number;
  8799. maxTextureSize: number;
  8800. maxCubeMapTextureSize: number;
  8801. maxArrayTextureLayers: number;
  8802. max3DTextureSize: number;
  8803. uboOffsetAlignment: number;
  8804. maxComputeSharedMemorySize: number;
  8805. maxComputeWorkGroupInvocations: number;
  8806. maxComputeWorkGroupSize: Size;
  8807. maxComputeWorkGroupCount: Size;
  8808. supportQuery: boolean;
  8809. clipSpaceMinZ: number;
  8810. screenSpaceSignY: number;
  8811. clipSpaceSignY: number;
  8812. constructor(maxVertexAttributes?: number, maxVertexUniformVectors?: number, maxFragmentUniformVectors?: number, maxTextureUnits?: number, maxImageUnits?: number, maxVertexTextureUnits?: number, maxColorRenderTargets?: number, maxShaderStorageBufferBindings?: number, maxShaderStorageBlockSize?: number, maxUniformBufferBindings?: number, maxUniformBlockSize?: number, maxTextureSize?: number, maxCubeMapTextureSize?: number, maxArrayTextureLayers?: number, max3DTextureSize?: number, uboOffsetAlignment?: number, maxComputeSharedMemorySize?: number, maxComputeWorkGroupInvocations?: number, maxComputeWorkGroupSize?: Size, maxComputeWorkGroupCount?: Size, supportQuery?: boolean, clipSpaceMinZ?: number, screenSpaceSignY?: number, clipSpaceSignY?: number);
  8813. copy(info: Readonly<DeviceCaps>): DeviceCaps;
  8814. }
  8815. export class DeviceOptions {
  8816. enableBarrierDeduce: boolean;
  8817. constructor(enableBarrierDeduce?: boolean);
  8818. copy(info: Readonly<DeviceOptions>): DeviceOptions;
  8819. }
  8820. export class Offset {
  8821. x: number;
  8822. y: number;
  8823. z: number;
  8824. constructor(x?: number, y?: number, z?: number);
  8825. copy(info: Readonly<Offset>): Offset;
  8826. }
  8827. export class Rect {
  8828. x: number;
  8829. y: number;
  8830. width: number;
  8831. height: number;
  8832. constructor(x?: number, y?: number, width?: number, height?: number);
  8833. copy(info: Readonly<Rect>): Rect;
  8834. }
  8835. export class Extent {
  8836. width: number;
  8837. height: number;
  8838. depth: number;
  8839. constructor(width?: number, height?: number, depth?: number);
  8840. copy(info: Readonly<Extent>): Extent;
  8841. }
  8842. export class TextureSubresLayers {
  8843. mipLevel: number;
  8844. baseArrayLayer: number;
  8845. layerCount: number;
  8846. constructor(mipLevel?: number, baseArrayLayer?: number, layerCount?: number);
  8847. copy(info: Readonly<TextureSubresLayers>): TextureSubresLayers;
  8848. }
  8849. export class TextureSubresRange {
  8850. baseMipLevel: number;
  8851. levelCount: number;
  8852. baseArrayLayer: number;
  8853. layerCount: number;
  8854. constructor(baseMipLevel?: number, levelCount?: number, baseArrayLayer?: number, layerCount?: number);
  8855. copy(info: Readonly<TextureSubresRange>): TextureSubresRange;
  8856. }
  8857. export class TextureCopy {
  8858. srcSubres: TextureSubresLayers;
  8859. srcOffset: Offset;
  8860. dstSubres: TextureSubresLayers;
  8861. dstOffset: Offset;
  8862. extent: Extent;
  8863. constructor(srcSubres?: TextureSubresLayers, srcOffset?: Offset, dstSubres?: TextureSubresLayers, dstOffset?: Offset, extent?: Extent);
  8864. copy(info: Readonly<TextureCopy>): TextureCopy;
  8865. }
  8866. export class TextureBlit {
  8867. srcSubres: TextureSubresLayers;
  8868. srcOffset: Offset;
  8869. srcExtent: Extent;
  8870. dstSubres: TextureSubresLayers;
  8871. dstOffset: Offset;
  8872. dstExtent: Extent;
  8873. constructor(srcSubres?: TextureSubresLayers, srcOffset?: Offset, srcExtent?: Extent, dstSubres?: TextureSubresLayers, dstOffset?: Offset, dstExtent?: Extent);
  8874. copy(info: Readonly<TextureBlit>): TextureBlit;
  8875. }
  8876. export class BufferTextureCopy {
  8877. buffOffset: number;
  8878. buffStride: number;
  8879. buffTexHeight: number;
  8880. texOffset: Offset;
  8881. texExtent: Extent;
  8882. texSubres: TextureSubresLayers;
  8883. constructor(buffOffset?: number, buffStride?: number, buffTexHeight?: number, texOffset?: Offset, texExtent?: Extent, texSubres?: TextureSubresLayers);
  8884. copy(info: Readonly<BufferTextureCopy>): BufferTextureCopy;
  8885. }
  8886. export class Viewport {
  8887. left: number;
  8888. top: number;
  8889. width: number;
  8890. height: number;
  8891. minDepth: number;
  8892. maxDepth: number;
  8893. constructor(left?: number, top?: number, width?: number, height?: number, minDepth?: number, maxDepth?: number);
  8894. copy(info: Readonly<Viewport>): Viewport;
  8895. reset(): void;
  8896. }
  8897. export class Color {
  8898. x: number;
  8899. y: number;
  8900. z: number;
  8901. w: number;
  8902. constructor(x?: number, y?: number, z?: number, w?: number);
  8903. copy(info: Readonly<Color>): Color;
  8904. set(x: number, y: number, z: number, w: number): Color;
  8905. reset(): void;
  8906. }
  8907. export class BindingMappingInfo {
  8908. maxBlockCounts: number[];
  8909. maxSamplerTextureCounts: number[];
  8910. maxSamplerCounts: number[];
  8911. maxTextureCounts: number[];
  8912. maxBufferCounts: number[];
  8913. maxImageCounts: number[];
  8914. maxSubpassInputCounts: number[];
  8915. setIndices: number[];
  8916. constructor(maxBlockCounts?: number[], maxSamplerTextureCounts?: number[], maxSamplerCounts?: number[], maxTextureCounts?: number[], maxBufferCounts?: number[], maxImageCounts?: number[], maxSubpassInputCounts?: number[], setIndices?: number[]);
  8917. copy(info: Readonly<BindingMappingInfo>): BindingMappingInfo;
  8918. }
  8919. export class SwapchainInfo {
  8920. windowId: number;
  8921. windowHandle: HTMLCanvasElement;
  8922. vsyncMode: VsyncMode;
  8923. width: number;
  8924. height: number;
  8925. constructor(windowId?: number, windowHandle?: HTMLCanvasElement, vsyncMode?: VsyncMode, width?: number, height?: number);
  8926. copy(info: Readonly<SwapchainInfo>): SwapchainInfo;
  8927. }
  8928. export class DeviceInfo {
  8929. bindingMappingInfo: BindingMappingInfo;
  8930. constructor(bindingMappingInfo?: BindingMappingInfo);
  8931. copy(info: Readonly<DeviceInfo>): DeviceInfo;
  8932. }
  8933. export class BufferInfo {
  8934. usage: BufferUsage;
  8935. memUsage: MemoryUsage;
  8936. size: number;
  8937. stride: number;
  8938. flags: BufferFlags;
  8939. constructor(usage?: BufferUsage, memUsage?: MemoryUsage, size?: number, stride?: number, flags?: BufferFlags);
  8940. copy(info: Readonly<BufferInfo>): BufferInfo;
  8941. }
  8942. export class BufferViewInfo {
  8943. buffer: Buffer;
  8944. offset: number;
  8945. range: number;
  8946. constructor(buffer?: Buffer, offset?: number, range?: number);
  8947. copy(info: Readonly<BufferViewInfo>): BufferViewInfo;
  8948. }
  8949. export class DrawInfo {
  8950. vertexCount: number;
  8951. firstVertex: number;
  8952. indexCount: number;
  8953. firstIndex: number;
  8954. vertexOffset: number;
  8955. instanceCount: number;
  8956. firstInstance: number;
  8957. constructor(vertexCount?: number, firstVertex?: number, indexCount?: number, firstIndex?: number, vertexOffset?: number, instanceCount?: number, firstInstance?: number);
  8958. copy(info: Readonly<DrawInfo>): DrawInfo;
  8959. }
  8960. export class DispatchInfo {
  8961. groupCountX: number;
  8962. groupCountY: number;
  8963. groupCountZ: number;
  8964. indirectBuffer: Buffer | null;
  8965. indirectOffset: number;
  8966. constructor(groupCountX?: number, groupCountY?: number, groupCountZ?: number, indirectBuffer?: Buffer | null, indirectOffset?: number);
  8967. copy(info: Readonly<DispatchInfo>): DispatchInfo;
  8968. }
  8969. export class IndirectBuffer {
  8970. drawInfos: DrawInfo[];
  8971. constructor(drawInfos?: DrawInfo[]);
  8972. copy(info: Readonly<IndirectBuffer>): IndirectBuffer;
  8973. }
  8974. export class TextureInfo {
  8975. type: TextureType;
  8976. usage: TextureUsage;
  8977. format: Format;
  8978. width: number;
  8979. height: number;
  8980. flags: TextureFlags;
  8981. layerCount: number;
  8982. levelCount: number;
  8983. samples: SampleCount;
  8984. depth: number;
  8985. externalRes: number;
  8986. constructor(type?: TextureType, usage?: TextureUsage, format?: Format, width?: number, height?: number, flags?: TextureFlags, layerCount?: number, levelCount?: number, samples?: SampleCount, depth?: number, externalRes?: number);
  8987. copy(info: Readonly<TextureInfo>): TextureInfo;
  8988. }
  8989. export class TextureViewInfo {
  8990. texture: Texture;
  8991. type: TextureType;
  8992. format: Format;
  8993. baseLevel: number;
  8994. levelCount: number;
  8995. baseLayer: number;
  8996. layerCount: number;
  8997. constructor(texture?: Texture, type?: TextureType, format?: Format, baseLevel?: number, levelCount?: number, baseLayer?: number, layerCount?: number);
  8998. copy(info: Readonly<TextureViewInfo>): TextureViewInfo;
  8999. }
  9000. export class Uniform {
  9001. name: string;
  9002. type: Type;
  9003. count: number;
  9004. constructor(name?: string, type?: Type, count?: number);
  9005. copy(info: Readonly<Uniform>): Uniform;
  9006. }
  9007. export class UniformBlock {
  9008. set: number;
  9009. binding: number;
  9010. name: string;
  9011. members: Uniform[];
  9012. count: number;
  9013. flattened: number;
  9014. constructor(set?: number, binding?: number, name?: string, members?: Uniform[], count?: number, flattened?: number);
  9015. copy(info: Readonly<UniformBlock>): UniformBlock;
  9016. }
  9017. export class UniformSamplerTexture {
  9018. set: number;
  9019. binding: number;
  9020. name: string;
  9021. type: Type;
  9022. count: number;
  9023. flattened: number;
  9024. constructor(set?: number, binding?: number, name?: string, type?: Type, count?: number, flattened?: number);
  9025. copy(info: Readonly<UniformSamplerTexture>): UniformSamplerTexture;
  9026. }
  9027. export class UniformSampler {
  9028. set: number;
  9029. binding: number;
  9030. name: string;
  9031. count: number;
  9032. flattened: number;
  9033. constructor(set?: number, binding?: number, name?: string, count?: number, flattened?: number);
  9034. copy(info: Readonly<UniformSampler>): UniformSampler;
  9035. }
  9036. export class UniformTexture {
  9037. set: number;
  9038. binding: number;
  9039. name: string;
  9040. type: Type;
  9041. count: number;
  9042. flattened: number;
  9043. constructor(set?: number, binding?: number, name?: string, type?: Type, count?: number, flattened?: number);
  9044. copy(info: Readonly<UniformTexture>): UniformTexture;
  9045. }
  9046. export class UniformStorageImage {
  9047. set: number;
  9048. binding: number;
  9049. name: string;
  9050. type: Type;
  9051. count: number;
  9052. memoryAccess: MemoryAccess;
  9053. flattened: number;
  9054. constructor(set?: number, binding?: number, name?: string, type?: Type, count?: number, memoryAccess?: MemoryAccess, flattened?: number);
  9055. copy(info: Readonly<UniformStorageImage>): UniformStorageImage;
  9056. }
  9057. export class UniformStorageBuffer {
  9058. set: number;
  9059. binding: number;
  9060. name: string;
  9061. count: number;
  9062. memoryAccess: MemoryAccess;
  9063. flattened: number;
  9064. constructor(set?: number, binding?: number, name?: string, count?: number, memoryAccess?: MemoryAccess, flattened?: number);
  9065. copy(info: Readonly<UniformStorageBuffer>): UniformStorageBuffer;
  9066. }
  9067. export class UniformInputAttachment {
  9068. set: number;
  9069. binding: number;
  9070. name: string;
  9071. count: number;
  9072. flattened: number;
  9073. constructor(set?: number, binding?: number, name?: string, count?: number, flattened?: number);
  9074. copy(info: Readonly<UniformInputAttachment>): UniformInputAttachment;
  9075. }
  9076. export class ShaderStage {
  9077. stage: ShaderStageFlagBit;
  9078. source: string;
  9079. constructor(stage?: ShaderStageFlagBit, source?: string);
  9080. copy(info: Readonly<ShaderStage>): ShaderStage;
  9081. }
  9082. export class Attribute {
  9083. name: string;
  9084. format: Format;
  9085. isNormalized: boolean;
  9086. stream: number;
  9087. isInstanced: boolean;
  9088. location: number;
  9089. constructor(name?: string, format?: Format, isNormalized?: boolean, stream?: number, isInstanced?: boolean, location?: number);
  9090. copy(info: Readonly<Attribute>): Attribute;
  9091. }
  9092. export class ShaderInfo {
  9093. name: string;
  9094. stages: ShaderStage[];
  9095. attributes: Attribute[];
  9096. blocks: UniformBlock[];
  9097. buffers: UniformStorageBuffer[];
  9098. samplerTextures: UniformSamplerTexture[];
  9099. samplers: UniformSampler[];
  9100. textures: UniformTexture[];
  9101. images: UniformStorageImage[];
  9102. subpassInputs: UniformInputAttachment[];
  9103. constructor(name?: string, stages?: ShaderStage[], attributes?: Attribute[], blocks?: UniformBlock[], buffers?: UniformStorageBuffer[], samplerTextures?: UniformSamplerTexture[], samplers?: UniformSampler[], textures?: UniformTexture[], images?: UniformStorageImage[], subpassInputs?: UniformInputAttachment[]);
  9104. copy(info: Readonly<ShaderInfo>): ShaderInfo;
  9105. }
  9106. export class InputAssemblerInfo {
  9107. attributes: Attribute[];
  9108. vertexBuffers: Buffer[];
  9109. indexBuffer: Buffer | null;
  9110. indirectBuffer: Buffer | null;
  9111. constructor(attributes?: Attribute[], vertexBuffers?: Buffer[], indexBuffer?: Buffer | null, indirectBuffer?: Buffer | null);
  9112. copy(info: Readonly<InputAssemblerInfo>): InputAssemblerInfo;
  9113. }
  9114. export class ColorAttachment {
  9115. format: Format;
  9116. sampleCount: SampleCount;
  9117. loadOp: LoadOp;
  9118. storeOp: StoreOp;
  9119. barrier: GeneralBarrier;
  9120. constructor(format?: Format, sampleCount?: SampleCount, loadOp?: LoadOp, storeOp?: StoreOp, barrier?: GeneralBarrier);
  9121. copy(info: Readonly<ColorAttachment>): ColorAttachment;
  9122. }
  9123. export class DepthStencilAttachment {
  9124. format: Format;
  9125. sampleCount: SampleCount;
  9126. depthLoadOp: LoadOp;
  9127. depthStoreOp: StoreOp;
  9128. stencilLoadOp: LoadOp;
  9129. stencilStoreOp: StoreOp;
  9130. barrier: GeneralBarrier;
  9131. constructor(format?: Format, sampleCount?: SampleCount, depthLoadOp?: LoadOp, depthStoreOp?: StoreOp, stencilLoadOp?: LoadOp, stencilStoreOp?: StoreOp, barrier?: GeneralBarrier);
  9132. copy(info: Readonly<DepthStencilAttachment>): DepthStencilAttachment;
  9133. }
  9134. export class SubpassInfo {
  9135. inputs: number[];
  9136. colors: number[];
  9137. resolves: number[];
  9138. preserves: number[];
  9139. depthStencil: number;
  9140. depthStencilResolve: number;
  9141. depthResolveMode: ResolveMode;
  9142. stencilResolveMode: ResolveMode;
  9143. constructor(inputs?: number[], colors?: number[], resolves?: number[], preserves?: number[], depthStencil?: number, depthStencilResolve?: number, depthResolveMode?: ResolveMode, stencilResolveMode?: ResolveMode);
  9144. copy(info: Readonly<SubpassInfo>): SubpassInfo;
  9145. }
  9146. export class SubpassDependency {
  9147. srcSubpass: number;
  9148. dstSubpass: number;
  9149. generalBarrier: GeneralBarrier;
  9150. prevAccesses: AccessFlags[];
  9151. nextAccesses: AccessFlags[];
  9152. constructor(srcSubpass?: number, dstSubpass?: number, generalBarrier?: GeneralBarrier, prevAccesses?: AccessFlags[], nextAccesses?: AccessFlags[]);
  9153. copy(info: Readonly<SubpassDependency>): SubpassDependency;
  9154. }
  9155. export class RenderPassInfo {
  9156. colorAttachments: ColorAttachment[];
  9157. depthStencilAttachment: DepthStencilAttachment;
  9158. depthStencilResolveAttachment: DepthStencilAttachment;
  9159. subpasses: SubpassInfo[];
  9160. dependencies: SubpassDependency[];
  9161. constructor(colorAttachments?: ColorAttachment[], depthStencilAttachment?: DepthStencilAttachment, depthStencilResolveAttachment?: DepthStencilAttachment, subpasses?: SubpassInfo[], dependencies?: SubpassDependency[]);
  9162. copy(info: Readonly<RenderPassInfo>): RenderPassInfo;
  9163. }
  9164. export class GeneralBarrierInfo {
  9165. prevAccesses: AccessFlags;
  9166. nextAccesses: AccessFlags;
  9167. type: BarrierType;
  9168. constructor(prevAccesses?: AccessFlags, nextAccesses?: AccessFlags, type?: BarrierType);
  9169. copy(info: Readonly<GeneralBarrierInfo>): GeneralBarrierInfo;
  9170. }
  9171. export class TextureBarrierInfo {
  9172. prevAccesses: AccessFlags;
  9173. nextAccesses: AccessFlags;
  9174. type: BarrierType;
  9175. baseMipLevel: number;
  9176. levelCount: number;
  9177. baseSlice: number;
  9178. sliceCount: number;
  9179. discardContents: boolean;
  9180. srcQueue: Queue | null;
  9181. dstQueue: Queue | null;
  9182. constructor(prevAccesses?: AccessFlags, nextAccesses?: AccessFlags, type?: BarrierType, baseMipLevel?: number, levelCount?: number, baseSlice?: number, sliceCount?: number, discardContents?: boolean, srcQueue?: Queue | null, dstQueue?: Queue | null);
  9183. copy(info: Readonly<TextureBarrierInfo>): TextureBarrierInfo;
  9184. }
  9185. export class BufferBarrierInfo {
  9186. prevAccesses: AccessFlags;
  9187. nextAccesses: AccessFlags;
  9188. type: BarrierType;
  9189. offset: number;
  9190. size: number;
  9191. discardContents: boolean;
  9192. srcQueue: Queue | null;
  9193. dstQueue: Queue | null;
  9194. constructor(prevAccesses?: AccessFlags, nextAccesses?: AccessFlags, type?: BarrierType, offset?: number, size?: number, discardContents?: boolean, srcQueue?: Queue | null, dstQueue?: Queue | null);
  9195. copy(info: Readonly<BufferBarrierInfo>): BufferBarrierInfo;
  9196. }
  9197. export class FramebufferInfo {
  9198. renderPass: RenderPass;
  9199. colorTextures: Texture[];
  9200. depthStencilTexture: Texture | null;
  9201. depthStencilResolveTexture: Texture | null;
  9202. constructor(renderPass?: RenderPass, colorTextures?: Texture[], depthStencilTexture?: Texture | null, depthStencilResolveTexture?: Texture | null);
  9203. copy(info: Readonly<FramebufferInfo>): FramebufferInfo;
  9204. }
  9205. export class DescriptorSetLayoutBinding {
  9206. binding: number;
  9207. descriptorType: DescriptorType;
  9208. count: number;
  9209. stageFlags: ShaderStageFlags;
  9210. immutableSamplers: Sampler[];
  9211. constructor(binding?: number, descriptorType?: DescriptorType, count?: number, stageFlags?: ShaderStageFlags, immutableSamplers?: Sampler[]);
  9212. copy(info: Readonly<DescriptorSetLayoutBinding>): DescriptorSetLayoutBinding;
  9213. }
  9214. export class DescriptorSetLayoutInfo {
  9215. bindings: DescriptorSetLayoutBinding[];
  9216. constructor(bindings?: DescriptorSetLayoutBinding[]);
  9217. copy(info: Readonly<DescriptorSetLayoutInfo>): DescriptorSetLayoutInfo;
  9218. reset(): void;
  9219. }
  9220. export class DescriptorSetInfo {
  9221. layout: DescriptorSetLayout;
  9222. constructor(layout?: DescriptorSetLayout);
  9223. copy(info: Readonly<DescriptorSetInfo>): DescriptorSetInfo;
  9224. }
  9225. export class PipelineLayoutInfo {
  9226. setLayouts: DescriptorSetLayout[];
  9227. constructor(setLayouts?: DescriptorSetLayout[]);
  9228. copy(info: Readonly<PipelineLayoutInfo>): PipelineLayoutInfo;
  9229. }
  9230. export class InputState {
  9231. attributes: Attribute[];
  9232. constructor(attributes?: Attribute[]);
  9233. copy(info: Readonly<InputState>): InputState;
  9234. }
  9235. export class CommandBufferInfo {
  9236. queue: Queue;
  9237. type: CommandBufferType;
  9238. constructor(queue?: Queue, type?: CommandBufferType);
  9239. copy(info: Readonly<CommandBufferInfo>): CommandBufferInfo;
  9240. }
  9241. export class QueueInfo {
  9242. type: QueueType;
  9243. constructor(type?: QueueType);
  9244. copy(info: Readonly<QueueInfo>): QueueInfo;
  9245. }
  9246. export class QueryPoolInfo {
  9247. type: QueryType;
  9248. maxQueryObjects: number;
  9249. forceWait: boolean;
  9250. constructor(type?: QueryType, maxQueryObjects?: number, forceWait?: boolean);
  9251. copy(info: Readonly<QueryPoolInfo>): QueryPoolInfo;
  9252. }
  9253. export class FormatInfo {
  9254. readonly name: string;
  9255. readonly size: number;
  9256. readonly count: number;
  9257. readonly type: FormatType;
  9258. readonly hasAlpha: boolean;
  9259. readonly hasDepth: boolean;
  9260. readonly hasStencil: boolean;
  9261. readonly isCompressed: boolean;
  9262. constructor(name?: string, size?: number, count?: number, type?: FormatType, hasAlpha?: boolean, hasDepth?: boolean, hasStencil?: boolean, isCompressed?: boolean);
  9263. }
  9264. export class MemoryStatus {
  9265. bufferSize: number;
  9266. textureSize: number;
  9267. constructor(bufferSize?: number, textureSize?: number);
  9268. copy(info: Readonly<MemoryStatus>): MemoryStatus;
  9269. }
  9270. export class DynamicStencilStates {
  9271. writeMask: number;
  9272. compareMask: number;
  9273. reference: number;
  9274. constructor(writeMask?: number, compareMask?: number, reference?: number);
  9275. copy(info: Readonly<DynamicStencilStates>): DynamicStencilStates;
  9276. }
  9277. export class DynamicStates {
  9278. viewport: Viewport;
  9279. scissor: Rect;
  9280. blendConstant: Color;
  9281. lineWidth: number;
  9282. depthBiasConstant: number;
  9283. depthBiasClamp: number;
  9284. depthBiasSlope: number;
  9285. depthMinBounds: number;
  9286. depthMaxBounds: number;
  9287. stencilStatesFront: DynamicStencilStates;
  9288. stencilStatesBack: DynamicStencilStates;
  9289. constructor(viewport?: Viewport, scissor?: Rect, blendConstant?: Color, lineWidth?: number, depthBiasConstant?: number, depthBiasClamp?: number, depthBiasSlope?: number, depthMinBounds?: number, depthMaxBounds?: number, stencilStatesFront?: DynamicStencilStates, stencilStatesBack?: DynamicStencilStates);
  9290. copy(info: Readonly<DynamicStates>): DynamicStates;
  9291. }
  9292. /**
  9293. * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! =========================
  9294. * The above section is auto-generated from native/cocos/renderer/core/gfx/GFXDef-common.h
  9295. * by the script native/tools/gfx-define-generator/generate.js.
  9296. * Changes to these public interfaces should be made there first and synced back.
  9297. * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! =========================
  9298. */
  9299. /**
  9300. * @en GFX base object.
  9301. * @zh GFX 基类对象。
  9302. */
  9303. export class GFXObject extends __private._cocos_core_data_gc_object__GCObject {
  9304. get objectType(): ObjectType;
  9305. get objectID(): number;
  9306. get typedID(): number;
  9307. protected _objectType: ObjectType;
  9308. protected _objectID: number;
  9309. protected _typedID: number;
  9310. constructor(objectType: ObjectType);
  9311. }
  9312. export interface ISwapchainTextureInfo {
  9313. swapchain: Swapchain;
  9314. format: Format;
  9315. width: number;
  9316. height: number;
  9317. }
  9318. export enum AttributeName {
  9319. ATTR_POSITION = "a_position",
  9320. ATTR_NORMAL = "a_normal",
  9321. ATTR_TANGENT = "a_tangent",
  9322. ATTR_BITANGENT = "a_bitangent",
  9323. ATTR_WEIGHTS = "a_weights",
  9324. ATTR_JOINTS = "a_joints",
  9325. ATTR_COLOR = "a_color",
  9326. ATTR_COLOR1 = "a_color1",
  9327. ATTR_COLOR2 = "a_color2",
  9328. ATTR_TEX_COORD = "a_texCoord",
  9329. ATTR_TEX_COORD1 = "a_texCoord1",
  9330. ATTR_TEX_COORD2 = "a_texCoord2",
  9331. ATTR_TEX_COORD3 = "a_texCoord3",
  9332. ATTR_TEX_COORD4 = "a_texCoord4",
  9333. ATTR_TEX_COORD5 = "a_texCoord5",
  9334. ATTR_TEX_COORD6 = "a_texCoord6",
  9335. ATTR_TEX_COORD7 = "a_texCoord7",
  9336. ATTR_TEX_COORD8 = "a_texCoord8",
  9337. ATTR_BATCH_ID = "a_batch_id",
  9338. ATTR_BATCH_UV = "a_batch_uv"
  9339. }
  9340. export const FormatInfos: readonly FormatInfo[];
  9341. export const DESCRIPTOR_BUFFER_TYPE: number;
  9342. export const DESCRIPTOR_SAMPLER_TYPE: number;
  9343. export const DESCRIPTOR_DYNAMIC_TYPE: number;
  9344. export const DRAW_INFO_SIZE = 28;
  9345. export type BufferSource = ArrayBuffer | IndirectBuffer;
  9346. export interface FormatAlignment {
  9347. width: number;
  9348. height: number;
  9349. }
  9350. /**
  9351. * @en GFX Device.
  9352. * @zh GFX 设备。
  9353. */
  9354. export abstract class Device {
  9355. /**
  9356. * @en Current rendering API.
  9357. * @zh 当前 GFX 使用的渲染 API。
  9358. */
  9359. get gfxAPI(): API;
  9360. /**
  9361. * @en GFX default queue.
  9362. * @zh GFX 默认队列。
  9363. */
  9364. get queue(): Queue;
  9365. /**
  9366. * @en GFX default command buffer.
  9367. * @zh GFX 默认命令缓冲。
  9368. */
  9369. get commandBuffer(): CommandBuffer;
  9370. /**
  9371. * @en Renderer description.
  9372. * @zh 渲染器描述。
  9373. */
  9374. get renderer(): string;
  9375. /**
  9376. * @en Vendor description.
  9377. * @zh 厂商描述。
  9378. */
  9379. get vendor(): string;
  9380. /**
  9381. * @en Number of draw calls currently recorded.
  9382. * @zh 绘制调用次数。
  9383. */
  9384. get numDrawCalls(): number;
  9385. /**
  9386. * @en Number of instances currently recorded.
  9387. * @zh 绘制 Instance 数量。
  9388. */
  9389. get numInstances(): number;
  9390. /**
  9391. * @en Number of triangles currently recorded.
  9392. * @zh 渲染三角形数量。
  9393. */
  9394. get numTris(): number;
  9395. /**
  9396. * @en Total memory size currently allocated.
  9397. * @zh 内存状态。
  9398. */
  9399. get memoryStatus(): MemoryStatus;
  9400. /**
  9401. * @en Current device capabilities.
  9402. * @zh 当前设备能力数据。
  9403. */
  9404. get capabilities(): DeviceCaps;
  9405. /**
  9406. * @en Current device binding mappings.
  9407. * @zh 当前设备的绑定槽位映射关系。
  9408. */
  9409. get bindingMappingInfo(): BindingMappingInfo;
  9410. protected _gfxAPI: API;
  9411. protected _renderer: string;
  9412. protected _vendor: string;
  9413. protected _features: boolean[];
  9414. protected _formatFeatures: FormatFeatureBit[];
  9415. protected _queue: Queue | null;
  9416. protected _cmdBuff: CommandBuffer | null;
  9417. protected _numDrawCalls: number;
  9418. protected _numInstances: number;
  9419. protected _numTris: number;
  9420. protected _memoryStatus: MemoryStatus;
  9421. protected _caps: DeviceCaps;
  9422. protected _bindingMappingInfo: BindingMappingInfo;
  9423. protected _samplers: Map<number, Sampler>;
  9424. protected _generalBarrierss: Map<number, GeneralBarrier>;
  9425. protected _textureBarriers: Map<number, TextureBarrier>;
  9426. protected _bufferBarriers: Map<number, __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier>;
  9427. static canvas: HTMLCanvasElement;
  9428. abstract initialize(info: Readonly<DeviceInfo>): boolean;
  9429. abstract destroy(): void;
  9430. /**
  9431. * @en Acquire next swapchain image.
  9432. * @zh 获取下一个交换链缓冲。
  9433. */
  9434. abstract acquire(swapchains: Readonly<Swapchain[]>): void;
  9435. /**
  9436. * @en Present current swapchain image.
  9437. * @zh 上屏当前交换链缓冲。
  9438. */
  9439. abstract present(): void;
  9440. /**
  9441. * @en Flush the specified command buffers.
  9442. * @zh 实际录制指定的命令缓冲。
  9443. */
  9444. abstract flushCommands(cmdBuffs: Readonly<CommandBuffer[]>): void;
  9445. /**
  9446. * @en Create command buffer.
  9447. * @zh 创建命令缓冲。
  9448. * @param info GFX command buffer description info.
  9449. */
  9450. abstract createCommandBuffer(info: Readonly<CommandBufferInfo>): CommandBuffer;
  9451. /**
  9452. * @en Create swapchain.
  9453. * @zh 创建交换链。
  9454. * @param info GFX swapchain description info.
  9455. */
  9456. abstract createSwapchain(info: Readonly<SwapchainInfo>): Swapchain;
  9457. /**
  9458. * @en Create buffer.
  9459. * @zh 创建缓冲。
  9460. * @param info GFX buffer description info.
  9461. */
  9462. abstract createBuffer(info: Readonly<BufferInfo> | BufferViewInfo): Buffer;
  9463. /**
  9464. * @en Create texture.
  9465. * @zh 创建纹理。
  9466. * @param info GFX texture description info.
  9467. */
  9468. abstract createTexture(info: Readonly<TextureInfo> | TextureViewInfo): Texture;
  9469. /**
  9470. * @en Create descriptor sets.
  9471. * @zh 创建描述符集组。
  9472. * @param info GFX descriptor sets description info.
  9473. */
  9474. abstract createDescriptorSet(info: Readonly<DescriptorSetInfo>): DescriptorSet;
  9475. /**
  9476. * @en Create shader.
  9477. * @zh 创建着色器。
  9478. * @param info GFX shader description info.
  9479. */
  9480. abstract createShader(info: Readonly<ShaderInfo>): Shader;
  9481. /**
  9482. * @en Create input assembler.
  9483. * @zh 创建纹理。
  9484. * @param info GFX input assembler description info.
  9485. */
  9486. abstract createInputAssembler(info: Readonly<InputAssemblerInfo>): InputAssembler;
  9487. /**
  9488. * @en Create render pass.
  9489. * @zh 创建渲染过程。
  9490. * @param info GFX render pass description info.
  9491. */
  9492. abstract createRenderPass(info: Readonly<RenderPassInfo>): RenderPass;
  9493. /**
  9494. * @en Create frame buffer.
  9495. * @zh 创建帧缓冲。
  9496. * @param info GFX frame buffer description info.
  9497. */
  9498. abstract createFramebuffer(info: Readonly<FramebufferInfo>): Framebuffer;
  9499. /**
  9500. * @en Create descriptor set layout.
  9501. * @zh 创建描述符集布局。
  9502. * @param info GFX descriptor set layout description info.
  9503. */
  9504. abstract createDescriptorSetLayout(info: Readonly<DescriptorSetLayoutInfo>): DescriptorSetLayout;
  9505. /**
  9506. * @en Create pipeline layout.
  9507. * @zh 创建管线布局。
  9508. * @param info GFX pipeline layout description info.
  9509. */
  9510. abstract createPipelineLayout(info: Readonly<PipelineLayoutInfo>): PipelineLayout;
  9511. /**
  9512. * @en Create pipeline state.
  9513. * @zh 创建管线状态。
  9514. * @param info GFX pipeline state description info.
  9515. */
  9516. abstract createPipelineState(info: Readonly<PipelineStateInfo>): PipelineState;
  9517. /**
  9518. * @en Create queue.
  9519. * @zh 创建队列。
  9520. * @param info GFX queue description info.
  9521. */
  9522. abstract createQueue(info: Readonly<QueueInfo>): Queue;
  9523. /**
  9524. * @en Create sampler.
  9525. * @zh 创建采样器。
  9526. * @param info GFX sampler description info.
  9527. */
  9528. abstract getSampler(info: Readonly<SamplerInfo>): Sampler;
  9529. /**
  9530. * @en Get swapchains.
  9531. * @zh 获取交换链列表。
  9532. */
  9533. abstract getSwapchains(): Readonly<Swapchain[]>;
  9534. /**
  9535. * @en Create global barrier.
  9536. * @zh 创建全局内存屏障。
  9537. * @param info GFX global barrier description info.
  9538. */
  9539. abstract getGeneralBarrier(info: Readonly<GeneralBarrierInfo>): GeneralBarrier;
  9540. /**
  9541. * @en Create texture barrier.
  9542. * @zh 创建贴图内存屏障。
  9543. * @param info GFX texture barrier description info.
  9544. */
  9545. abstract getTextureBarrier(info: Readonly<TextureBarrierInfo>): TextureBarrier;
  9546. /**
  9547. * @en Create buffer barrier.
  9548. * @zh 创建buffer内存屏障。
  9549. * @param info GFX buffer barrier description info.
  9550. */
  9551. abstract getBufferBarrier(info: Readonly<BufferBarrierInfo>): __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier;
  9552. /**
  9553. * @en Copy buffers to texture.
  9554. * @zh 拷贝缓冲到纹理。
  9555. * @param buffers The buffers to be copied.
  9556. * @param texture The texture to copy to.
  9557. * @param regions The region descriptions.
  9558. */
  9559. abstract copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: Texture, regions: Readonly<BufferTextureCopy[]>): void;
  9560. /**
  9561. * @en Copy texture to buffers
  9562. * @zh 拷贝纹理到缓冲
  9563. * @param texture The texture to be copied.
  9564. * @param buffers The buffer to copy to.
  9565. * @param regions The region descriptions
  9566. */
  9567. abstract copyTextureToBuffers(texture: Readonly<Texture>, buffers: ArrayBufferView[], regions: Readonly<BufferTextureCopy[]>): void;
  9568. /**
  9569. * @en Copy texture images to texture.
  9570. * @zh 拷贝图像到纹理。
  9571. * @param texImages The texture to be copied.
  9572. * @param texture The texture to copy to.
  9573. * @param regions The region descriptions.
  9574. */
  9575. abstract copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: Texture, regions: Readonly<BufferTextureCopy[]>): void;
  9576. /**
  9577. * @en Whether the device has specific feature.
  9578. * @zh 是否具备特性。
  9579. * @param feature The GFX feature to be queried.
  9580. */
  9581. hasFeature(feature: Feature): boolean;
  9582. /**
  9583. * @en The extent a specific format is supported by the backend.
  9584. * @zh 后端对特定格式的支持程度。
  9585. * @param format The GFX format to be queried.
  9586. */
  9587. getFormatFeatures(format: Format): FormatFeature;
  9588. /**
  9589. * @en Enable automatically barrier deduction GFX inside, no effect on web.
  9590. * @zh 是否开启自动GFX内部barrier推导,web无影响。
  9591. * @param format The GFX format to be queried.
  9592. */
  9593. enableAutoBarrier(en: boolean): void;
  9594. /**
  9595. * @en Get maximum supported sample count.
  9596. * @zh 获取最大可支持的 Samples 参数
  9597. * @param format The GFX texture format.
  9598. * @param usage The GFX texture usage.
  9599. * @param flags The GFX texture create flags.
  9600. */
  9601. getMaxSampleCount(format: Format, usage: TextureUsage, flags: TextureFlags): SampleCount;
  9602. }
  9603. export class DefaultResource {
  9604. constructor(device: Device);
  9605. getTexture(type: TextureType): Texture | null;
  9606. }
  9607. /**
  9608. * @en GFX Swapchain.
  9609. * @zh GFX 交换链。
  9610. */
  9611. export abstract class Swapchain extends GFXObject {
  9612. /**
  9613. * @en The color texture of this swapchain.
  9614. * @zh 当前交换链的颜色缓冲。
  9615. */
  9616. get colorTexture(): Texture;
  9617. /**
  9618. * @en The depth stencil texture of this swapchain.
  9619. * @zh 当前交换链的深度模板缓冲。
  9620. */
  9621. get depthStencilTexture(): Texture;
  9622. /**
  9623. * @en The surface transform to be applied in projection matrices.
  9624. * @zh 需要在投影矩阵中应用的表面变换。
  9625. */
  9626. get surfaceTransform(): SurfaceTransform;
  9627. get width(): number;
  9628. get height(): number;
  9629. protected _transform: SurfaceTransform;
  9630. protected _colorTexture: Texture;
  9631. protected _depthStencilTexture: Texture;
  9632. constructor();
  9633. abstract initialize(info: Readonly<SwapchainInfo>): void;
  9634. abstract resize(width: number, height: number, surfaceTransform: SurfaceTransform): void;
  9635. abstract destroy(): void;
  9636. }
  9637. /**
  9638. * @en GFX frame buffer.
  9639. * @zh GFX 帧缓冲。
  9640. */
  9641. export abstract class Framebuffer extends GFXObject {
  9642. /**
  9643. * @en Get current render pass.
  9644. * @zh GFX 渲染过程。
  9645. */
  9646. get renderPass(): RenderPass;
  9647. /**
  9648. * @en Get current color views.
  9649. * @zh 颜色纹理视图数组。
  9650. */
  9651. get colorTextures(): (Texture | null)[];
  9652. /**
  9653. * @en Get current depth stencil views.
  9654. * @zh 深度模板纹理视图。
  9655. */
  9656. get depthStencilTexture(): Texture | null;
  9657. get width(): number;
  9658. get height(): number;
  9659. protected _renderPass: RenderPass | null;
  9660. protected _colorTextures: (Texture | null)[];
  9661. protected _depthStencilTexture: Texture | null;
  9662. protected _width: number;
  9663. protected _height: number;
  9664. constructor();
  9665. abstract initialize(info: Readonly<FramebufferInfo>): void;
  9666. abstract destroy(): void;
  9667. }
  9668. /**
  9669. * @en GFX input assembler.
  9670. * @zh GFX 输入汇集器。
  9671. */
  9672. export abstract class InputAssembler extends GFXObject {
  9673. /**
  9674. * @en Get current attributes.
  9675. * @zh 顶点属性数组。
  9676. */
  9677. get attributes(): Attribute[];
  9678. /**
  9679. * @en Get current vertex buffers.
  9680. * @zh 顶点缓冲数组。
  9681. */
  9682. get vertexBuffers(): Buffer[];
  9683. /**
  9684. * @en Get current index buffer.
  9685. * @zh 索引缓冲。
  9686. */
  9687. get indexBuffer(): Buffer | null;
  9688. /**
  9689. * @en Get the indirect buffer, if present.
  9690. * @zh 间接绘制缓冲。
  9691. */
  9692. get indirectBuffer(): Buffer | null;
  9693. /**
  9694. * @en Get hash of current attributes.
  9695. * @zh 获取顶点属性数组的哈希值。
  9696. */
  9697. get attributesHash(): number;
  9698. /**
  9699. * @en Get current vertex count.
  9700. * @zh 顶点数量。
  9701. */
  9702. set vertexCount(count: number);
  9703. get vertexCount(): number;
  9704. /**
  9705. * @en Get starting vertex.
  9706. * @zh 起始顶点。
  9707. */
  9708. set firstVertex(first: number);
  9709. get firstVertex(): number;
  9710. /**
  9711. * @en Get current index count.
  9712. * @zh 索引数量。
  9713. */
  9714. set indexCount(count: number);
  9715. get indexCount(): number;
  9716. /**
  9717. * @en Get starting index.
  9718. * @zh 起始索引。
  9719. */
  9720. set firstIndex(first: number);
  9721. get firstIndex(): number;
  9722. /**
  9723. * @en Get current vertex offset.
  9724. * @zh 顶点偏移量。
  9725. */
  9726. set vertexOffset(offset: number);
  9727. get vertexOffset(): number;
  9728. /**
  9729. * @en Get current instance count.
  9730. * @zh 实例数量。
  9731. */
  9732. set instanceCount(count: number);
  9733. get instanceCount(): number;
  9734. /**
  9735. * @en Get starting instance.
  9736. * @zh 起始实例。
  9737. */
  9738. set firstInstance(first: number);
  9739. get firstInstance(): number;
  9740. /**
  9741. * @en set the draw range
  9742. * @zh 设置渲染范围
  9743. */
  9744. set drawInfo(info: DrawInfo);
  9745. /**
  9746. * @en get the draw range
  9747. * @zh 获取渲染范围
  9748. */
  9749. get drawInfo(): DrawInfo;
  9750. protected _attributes: Attribute[];
  9751. protected _attributesHash: number;
  9752. protected _vertexBuffers: Buffer[];
  9753. protected _indexBuffer: Buffer | null;
  9754. protected _indirectBuffer: Buffer | null;
  9755. protected _drawInfo: DrawInfo;
  9756. constructor();
  9757. /**
  9758. * @en Get the specified vertex buffer.
  9759. * @zh 获取顶点缓冲。
  9760. * @param stream The stream index of the vertex buffer.
  9761. */
  9762. getVertexBuffer(stream?: number): Buffer | null;
  9763. protected computeAttributesHash(): number;
  9764. abstract initialize(info: Readonly<InputAssemblerInfo>): void;
  9765. abstract destroy(): void;
  9766. }
  9767. /**
  9768. * @en GFX descriptor sets layout.
  9769. * @zh GFX 描述符集布局。
  9770. */
  9771. export abstract class DescriptorSetLayout extends GFXObject {
  9772. get bindings(): DescriptorSetLayoutBinding[];
  9773. get bindingIndices(): number[];
  9774. get descriptorIndices(): number[];
  9775. protected _bindings: DescriptorSetLayoutBinding[];
  9776. protected _bindingIndices: number[];
  9777. protected _descriptorIndices: number[];
  9778. constructor();
  9779. abstract initialize(info: Readonly<DescriptorSetLayoutInfo>): void;
  9780. abstract destroy(): void;
  9781. }
  9782. /**
  9783. * @en GFX pipeline layout.
  9784. * @zh GFX 管线布局。
  9785. */
  9786. export abstract class PipelineLayout extends GFXObject {
  9787. get setLayouts(): DescriptorSetLayout[];
  9788. protected _setLayouts: DescriptorSetLayout[];
  9789. constructor();
  9790. abstract initialize(info: Readonly<PipelineLayoutInfo>): void;
  9791. abstract destroy(): void;
  9792. }
  9793. /**
  9794. * @en GFX blend state.
  9795. * @zh GFX 混合状态。
  9796. */
  9797. export class BlendState {
  9798. isA2C: boolean;
  9799. isIndepend: boolean;
  9800. blendColor: Color;
  9801. targets: BlendTarget[];
  9802. get native(): BlendState;
  9803. constructor(isA2C?: boolean, isIndepend?: boolean, blendColor?: Color, targets?: BlendTarget[]);
  9804. /**
  9805. * @en Should use this function to set target, or it will not work
  9806. * on native platforms, as native can not support this feature,
  9807. * such as `blendState[i] = target;`.
  9808. *
  9809. * @param index The index to set target.
  9810. * @param target The target to be set.
  9811. */
  9812. setTarget(index: number, target: BlendTarget): void;
  9813. reset(): void;
  9814. destroy(): void;
  9815. }
  9816. /**
  9817. * @en GFX blend target.
  9818. * @zh GFX 混合目标。
  9819. */
  9820. export class BlendTarget {
  9821. blend: boolean;
  9822. blendSrc: BlendFactor;
  9823. blendDst: BlendFactor;
  9824. blendEq: BlendOp;
  9825. blendSrcAlpha: BlendFactor;
  9826. blendDstAlpha: BlendFactor;
  9827. blendAlphaEq: BlendOp;
  9828. blendColorMask: ColorMask;
  9829. constructor(blend?: boolean, blendSrc?: BlendFactor, blendDst?: BlendFactor, blendEq?: BlendOp, blendSrcAlpha?: BlendFactor, blendDstAlpha?: BlendFactor, blendAlphaEq?: BlendOp, blendColorMask?: ColorMask);
  9830. reset(): void;
  9831. assign(target: BlendTarget): void;
  9832. destroy(): void;
  9833. }
  9834. /**
  9835. * @en GFX rasterizer state.
  9836. * @zh GFX 光栅化状态。
  9837. */
  9838. export class RasterizerState {
  9839. isDiscard: boolean;
  9840. polygonMode: PolygonMode;
  9841. shadeModel: ShadeModel;
  9842. cullMode: CullMode;
  9843. isFrontFaceCCW: boolean;
  9844. depthBiasEnabled: boolean;
  9845. depthBias: number;
  9846. depthBiasClamp: number;
  9847. depthBiasSlop: number;
  9848. isDepthClip: boolean;
  9849. isMultisample: boolean;
  9850. lineWidth: number;
  9851. get native(): RasterizerState;
  9852. constructor(isDiscard?: boolean, polygonMode?: PolygonMode, shadeModel?: ShadeModel, cullMode?: CullMode, isFrontFaceCCW?: boolean, depthBiasEnabled?: boolean, depthBias?: number, depthBiasClamp?: number, depthBiasSlop?: number, isDepthClip?: boolean, isMultisample?: boolean, lineWidth?: number);
  9853. reset(): void;
  9854. assign(rs: RasterizerState): void;
  9855. destroy(): void;
  9856. }
  9857. /**
  9858. * @en GFX depth stencil state.
  9859. * @zh GFX 深度模板状态。
  9860. */
  9861. export class DepthStencilState {
  9862. depthTest: boolean;
  9863. depthWrite: boolean;
  9864. depthFunc: ComparisonFunc;
  9865. stencilTestFront: boolean;
  9866. stencilFuncFront: ComparisonFunc;
  9867. stencilReadMaskFront: number;
  9868. stencilWriteMaskFront: number;
  9869. stencilFailOpFront: StencilOp;
  9870. stencilZFailOpFront: StencilOp;
  9871. stencilPassOpFront: StencilOp;
  9872. stencilRefFront: number;
  9873. stencilTestBack: boolean;
  9874. stencilFuncBack: ComparisonFunc;
  9875. stencilReadMaskBack: number;
  9876. stencilWriteMaskBack: number;
  9877. stencilFailOpBack: StencilOp;
  9878. stencilZFailOpBack: StencilOp;
  9879. stencilPassOpBack: StencilOp;
  9880. stencilRefBack: number;
  9881. get native(): DepthStencilState;
  9882. constructor(depthTest?: boolean, depthWrite?: boolean, depthFunc?: ComparisonFunc, stencilTestFront?: boolean, stencilFuncFront?: ComparisonFunc, stencilReadMaskFront?: number, stencilWriteMaskFront?: number, stencilFailOpFront?: StencilOp, stencilZFailOpFront?: StencilOp, stencilPassOpFront?: StencilOp, stencilRefFront?: number, stencilTestBack?: boolean, stencilFuncBack?: ComparisonFunc, stencilReadMaskBack?: number, stencilWriteMaskBack?: number, stencilFailOpBack?: StencilOp, stencilZFailOpBack?: StencilOp, stencilPassOpBack?: StencilOp, stencilRefBack?: number);
  9883. reset(): void;
  9884. assign(dss: DepthStencilState): void;
  9885. destroy(): void;
  9886. }
  9887. export class PipelineStateInfo {
  9888. shader: Shader;
  9889. pipelineLayout: PipelineLayout;
  9890. renderPass: RenderPass;
  9891. inputState: InputState;
  9892. rasterizerState: RasterizerState;
  9893. depthStencilState: DepthStencilState;
  9894. blendState: BlendState;
  9895. primitive: PrimitiveMode;
  9896. dynamicStates: DynamicStateFlags;
  9897. bindPoint: PipelineBindPoint;
  9898. constructor(shader?: Shader, pipelineLayout?: PipelineLayout, renderPass?: RenderPass, inputState?: InputState, rasterizerState?: RasterizerState, depthStencilState?: DepthStencilState, blendState?: BlendState, primitive?: PrimitiveMode, dynamicStates?: DynamicStateFlags, bindPoint?: PipelineBindPoint);
  9899. }
  9900. /**
  9901. * @en GFX pipeline state.
  9902. * @zh GFX 管线状态。
  9903. */
  9904. export abstract class PipelineState extends GFXObject {
  9905. /**
  9906. * @en Get current shader.
  9907. * @zh GFX 着色器。
  9908. */
  9909. get shader(): Shader;
  9910. /**
  9911. * @en Get current pipeline layout.
  9912. * @zh GFX 管线布局。
  9913. */
  9914. get pipelineLayout(): PipelineLayout;
  9915. /**
  9916. * @en Get current primitve mode.
  9917. * @zh GFX 图元模式。
  9918. */
  9919. get primitive(): PrimitiveMode;
  9920. /**
  9921. * @en Get current rasterizer state.
  9922. * @zh GFX 光栅化状态。
  9923. */
  9924. get rasterizerState(): RasterizerState;
  9925. /**
  9926. * @en Get current depth stencil state.
  9927. * @zh GFX 深度模板状态。
  9928. */
  9929. get depthStencilState(): DepthStencilState;
  9930. /**
  9931. * @en Get current blend state.
  9932. * @zh GFX 混合状态。
  9933. */
  9934. get blendState(): BlendState;
  9935. /**
  9936. * @en Get current input state.
  9937. * @zh GFX 输入状态。
  9938. */
  9939. get inputState(): InputState;
  9940. /**
  9941. * @en Get current dynamic states.
  9942. * @zh GFX 动态状态数组。
  9943. */
  9944. get dynamicStates(): DynamicStateFlags;
  9945. /**
  9946. * @en Get current render pass.
  9947. * @zh GFX 渲染过程。
  9948. */
  9949. get renderPass(): RenderPass;
  9950. protected _shader: Shader | null;
  9951. protected _pipelineLayout: PipelineLayout | null;
  9952. protected _primitive: PrimitiveMode;
  9953. protected _is: InputState | null;
  9954. protected _rs: RasterizerState;
  9955. protected _dss: DepthStencilState;
  9956. protected _bs: BlendState;
  9957. protected _dynamicStates: DynamicStateFlags;
  9958. protected _renderPass: RenderPass | null;
  9959. constructor();
  9960. abstract initialize(info: Readonly<PipelineStateInfo>): void;
  9961. abstract destroy(): void;
  9962. }
  9963. /**
  9964. * @en GFX Queue.
  9965. * @zh GFX 队列。
  9966. */
  9967. export abstract class Queue extends GFXObject {
  9968. /**
  9969. * @en Get current type.
  9970. * @zh 队列类型。
  9971. */
  9972. get type(): number;
  9973. protected _type: QueueType;
  9974. constructor();
  9975. abstract initialize(info: Readonly<QueueInfo>): void;
  9976. abstract destroy(): void;
  9977. /**
  9978. * @en Submit command buffers.
  9979. * @zh 提交命令缓冲数组。
  9980. * @param cmdBuffs The command buffers to be submitted.
  9981. * @param fence The syncing fence.
  9982. */
  9983. abstract submit(cmdBuffs: Readonly<CommandBuffer[]>): void;
  9984. }
  9985. /**
  9986. * @en GFX render pass.
  9987. * @zh GFX 渲染过程。
  9988. */
  9989. export abstract class RenderPass extends GFXObject {
  9990. protected _colorInfos: ColorAttachment[];
  9991. protected _depthStencilInfo: DepthStencilAttachment | null;
  9992. protected _subpasses: SubpassInfo[];
  9993. protected _hash: number;
  9994. get colorAttachments(): Readonly<ColorAttachment[]>;
  9995. get depthStencilAttachment(): Readonly<DepthStencilAttachment> | null;
  9996. get subPasses(): Readonly<SubpassInfo[]>;
  9997. get hash(): number;
  9998. constructor();
  9999. protected computeHash(): number;
  10000. abstract initialize(info: Readonly<RenderPassInfo>): void;
  10001. abstract destroy(): void;
  10002. }
  10003. /**
  10004. * @en GFX shader.
  10005. * @zh GFX 着色器。
  10006. */
  10007. export abstract class Shader extends GFXObject {
  10008. get name(): string;
  10009. get attributes(): Attribute[];
  10010. get blocks(): UniformBlock[];
  10011. get samplers(): UniformSampler[];
  10012. get stages(): ShaderStage[];
  10013. protected _name: string;
  10014. protected _stages: ShaderStage[];
  10015. protected _attributes: Attribute[];
  10016. protected _blocks: UniformBlock[];
  10017. protected _samplers: UniformSampler[];
  10018. constructor();
  10019. abstract initialize(info: Readonly<ShaderInfo>): void;
  10020. abstract destroy(): void;
  10021. }
  10022. /**
  10023. * @en GFX texture.
  10024. * @zh GFX 纹理。
  10025. */
  10026. export abstract class Texture extends GFXObject {
  10027. /**
  10028. * @en Get texture type.
  10029. * @zh 纹理类型。
  10030. */
  10031. get type(): TextureType;
  10032. /**
  10033. * @en Get texture usage.
  10034. * @zh 纹理使用方式。
  10035. */
  10036. get usage(): TextureUsage;
  10037. /**
  10038. * @en Get texture format.
  10039. * @zh 纹理格式。
  10040. */
  10041. get format(): Format;
  10042. /**
  10043. * @en Get texture width.
  10044. * @zh 纹理宽度。
  10045. */
  10046. get width(): number;
  10047. /**
  10048. * @en Get texture height.
  10049. * @zh 纹理高度。
  10050. */
  10051. get height(): number;
  10052. /**
  10053. * @en Get texture depth.
  10054. * @zh 纹理深度。
  10055. */
  10056. get depth(): number;
  10057. /**
  10058. * @en Get texture array layer.
  10059. * @zh 纹理数组层数。
  10060. */
  10061. get layerCount(): number;
  10062. /**
  10063. * @en Get texture mip level.
  10064. * @zh 纹理 mip 层级数。
  10065. */
  10066. get levelCount(): number;
  10067. /**
  10068. * @en Get texture samples.
  10069. * @zh 纹理采样数。
  10070. */
  10071. get samples(): SampleCount;
  10072. /**
  10073. * @en Get texture flags.
  10074. * @zh 纹理标识位。
  10075. */
  10076. get flags(): TextureFlags;
  10077. /**
  10078. * @en Get texture size.
  10079. * @zh 纹理大小。
  10080. */
  10081. get size(): number;
  10082. /**
  10083. * @en Get texture info.
  10084. * @zh 纹理信息。
  10085. */
  10086. get info(): Readonly<TextureInfo>;
  10087. /**
  10088. * @en Get view info.
  10089. * @zh 纹理视图信息。
  10090. */
  10091. get viewInfo(): Readonly<TextureViewInfo>;
  10092. /**
  10093. * @en Get texture type.
  10094. * @zh 是否为纹理视图。
  10095. */
  10096. get isTextureView(): boolean;
  10097. protected _info: TextureInfo;
  10098. protected _viewInfo: TextureViewInfo;
  10099. protected _isPowerOf2: boolean;
  10100. protected _isTextureView: boolean;
  10101. protected _size: number;
  10102. constructor();
  10103. abstract initialize(info: Readonly<TextureInfo> | Readonly<TextureViewInfo>): void;
  10104. abstract destroy(): void;
  10105. abstract getGLTextureHandle(): number;
  10106. /**
  10107. * @en Resize texture.
  10108. * @zh 重置纹理大小。
  10109. * @param width The new width.
  10110. * @param height The new height.
  10111. */
  10112. abstract resize(width: number, height: number): void;
  10113. static getLevelCount(width: number, height: number): number;
  10114. }
  10115. /**
  10116. * @en GFX global barrier.
  10117. * @zh GFX 全局内存屏障。
  10118. */
  10119. export class GeneralBarrier extends GFXObject {
  10120. get info(): Readonly<GeneralBarrierInfo>;
  10121. get hash(): number;
  10122. protected _info: GeneralBarrierInfo;
  10123. protected _hash: number;
  10124. constructor(info: Readonly<GeneralBarrierInfo>, hash: number);
  10125. static computeHash(info: Readonly<GeneralBarrierInfo>): number;
  10126. }
  10127. /**
  10128. * @en GFX texture barrier.
  10129. * @zh GFX 贴图内存屏障。
  10130. */
  10131. export class TextureBarrier extends GFXObject {
  10132. get info(): Readonly<TextureBarrierInfo>;
  10133. get hash(): number;
  10134. protected _info: TextureBarrierInfo;
  10135. protected _hash: number;
  10136. constructor(info: Readonly<TextureBarrierInfo>, hash: number);
  10137. static computeHash(info: Readonly<TextureBarrierInfo>): number;
  10138. }
  10139. /**
  10140. * @en
  10141. * Sets the renderer type, only useful on web
  10142. *
  10143. * @zh
  10144. * 渲染模式。
  10145. * 设置渲染器类型,仅适用于 web 端
  10146. * @internal
  10147. */
  10148. export enum LegacyRenderMode {
  10149. /**
  10150. * @en
  10151. * Automatically chosen by engine.
  10152. * @zh
  10153. * 通过引擎自动选择。
  10154. */
  10155. AUTO = 0,
  10156. /**
  10157. * @en
  10158. * Forced to use canvas renderer.
  10159. * @zh
  10160. * 强制使用 canvas 渲染。
  10161. */
  10162. CANVAS = 1,
  10163. /**
  10164. * @en
  10165. * Forced to use WebGL renderer, but this will be ignored on mobile browsers.
  10166. * @zh
  10167. * 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。
  10168. */
  10169. WEBGL = 2,
  10170. /**
  10171. * @en
  10172. * Use Headless Renderer, which is useful in test or server env, only for internal use by cocos team for now
  10173. * @zh
  10174. * 使用空渲染器,可以用于测试和服务器端环境,目前暂时用于 Cocos 内部测试使用。
  10175. */
  10176. HEADLESS = 3
  10177. }
  10178. /**
  10179. * @internal
  10180. */
  10181. export enum RenderType {
  10182. UNKNOWN = "Bad expression <-1>",
  10183. CANVAS = 0,
  10184. WEBGL = 1,
  10185. OPENGL = 2,
  10186. HEADLESS = 3
  10187. }
  10188. /**
  10189. * @internal
  10190. */
  10191. export class DeviceManager {
  10192. get gfxDevice(): Device;
  10193. get swapchain(): Swapchain;
  10194. init(canvas: HTMLCanvasElement | null, bindingMappingInfo: BindingMappingInfo): void;
  10195. }
  10196. /**
  10197. * @internal
  10198. */
  10199. export const deviceManager: DeviceManager;
  10200. }
  10201. export namespace renderer {
  10202. export function createIA(device: gfx.Device, data: primitives.IGeometry): gfx.InputAssembler | null;
  10203. export const addStage: (name: any) => void;
  10204. export interface IProgramInfo extends EffectAsset.IShaderInfo {
  10205. effectName: string;
  10206. defines: __private._cocos_render_scene_core_program_lib__IDefineRecord[];
  10207. constantMacros: string;
  10208. uber: boolean;
  10209. }
  10210. export interface ITemplateInfo {
  10211. gfxAttributes: gfx.Attribute[];
  10212. shaderInfo: gfx.ShaderInfo;
  10213. blockSizes: number[];
  10214. setLayouts: gfx.DescriptorSetLayout[];
  10215. pipelineLayout: gfx.PipelineLayout;
  10216. handleMap: Record<string, number>;
  10217. bindings: gfx.DescriptorSetLayoutBinding[];
  10218. samplerStartBinding: number;
  10219. }
  10220. export const programLib: __private._cocos_render_scene_core_program_lib__ProgramLib;
  10221. export function getDeviceShaderVersion(device: gfx.Device): string;
  10222. export namespace scene {
  10223. /**
  10224. * @en The enumeration type for the fixed axis of the camera.
  10225. * The field of view along the corresponding axis would be fixed regardless of screen aspect changes.
  10226. * @zh 相机视角的锁定轴向枚举,在对应轴上不会跟随屏幕长宽比例变化。
  10227. */
  10228. export enum CameraFOVAxis {
  10229. /**
  10230. * @en Vertically fixed camera
  10231. * @zh 在垂直轴向上锁定的相机
  10232. */
  10233. VERTICAL = 0,
  10234. /**
  10235. * @en Horizontally fixed camera
  10236. * @zh 在水平轴向上锁定的相机
  10237. */
  10238. HORIZONTAL = 1
  10239. }
  10240. /**
  10241. * @en The projection type enumeration of the camera.
  10242. * @zh 相机的投影类型枚举。
  10243. */
  10244. export enum CameraProjection {
  10245. /**
  10246. * @en Orthogonal projection type
  10247. * @zh 正交投影类型
  10248. */
  10249. ORTHO = 0,
  10250. /**
  10251. * @en Perspective projection type
  10252. * @zh 透视投影类型
  10253. */
  10254. PERSPECTIVE = 1
  10255. }
  10256. /**
  10257. * @en The aperture enumeration of the camera, represent in f-number.
  10258. * The smaller the value is, the bigger the aperture is, and more light it can capture, but less depth it supports.
  10259. * @zh 相机的快门枚举,使用 f 值来表示。f 值越小,光圈就越大,进光量也越大,景深越浅。
  10260. */
  10261. export enum CameraAperture {
  10262. /**
  10263. * f/1.8
  10264. */
  10265. F1_8 = 0,
  10266. /**
  10267. * f/2.0
  10268. */
  10269. F2_0 = 1,
  10270. /**
  10271. * f/2.2
  10272. */
  10273. F2_2 = 2,
  10274. /**
  10275. * f/2.5
  10276. */
  10277. F2_5 = 3,
  10278. /**
  10279. * f/2.8
  10280. */
  10281. F2_8 = 4,
  10282. /**
  10283. * f/3.2
  10284. */
  10285. F3_2 = 5,
  10286. /**
  10287. * f/3.5
  10288. */
  10289. F3_5 = 6,
  10290. /**
  10291. * f/4.0
  10292. */
  10293. F4_0 = 7,
  10294. /**
  10295. * f/4.5
  10296. */
  10297. F4_5 = 8,
  10298. /**
  10299. * f/5.0
  10300. */
  10301. F5_0 = 9,
  10302. /**
  10303. * f/5.6
  10304. */
  10305. F5_6 = 10,
  10306. /**
  10307. * f/6.3
  10308. */
  10309. F6_3 = 11,
  10310. /**
  10311. * f/7.1
  10312. */
  10313. F7_1 = 12,
  10314. /**
  10315. * f/8
  10316. */
  10317. F8_0 = 13,
  10318. /**
  10319. * f/9
  10320. */
  10321. F9_0 = 14,
  10322. /**
  10323. * f/10
  10324. */
  10325. F10_0 = 15,
  10326. /**
  10327. * f/11
  10328. */
  10329. F11_0 = 16,
  10330. /**
  10331. * f/13
  10332. */
  10333. F13_0 = 17,
  10334. /**
  10335. * f/14
  10336. */
  10337. F14_0 = 18,
  10338. /**
  10339. * f/16
  10340. */
  10341. F16_0 = 19,
  10342. /**
  10343. * f/18
  10344. */
  10345. F18_0 = 20,
  10346. /**
  10347. * f/20
  10348. */
  10349. F20_0 = 21,
  10350. /**
  10351. * f/22
  10352. */
  10353. F22_0 = 22
  10354. }
  10355. /**
  10356. * @en The ISO enumeration of the camera, lower ISO means the camera is less sensitive to light.
  10357. * @zh 相机感光度枚举,越低的 ISO 数值表示相机对光更加不敏感。
  10358. */
  10359. export enum CameraISO {
  10360. ISO100 = 0,
  10361. ISO200 = 1,
  10362. ISO400 = 2,
  10363. ISO800 = 3
  10364. }
  10365. /**
  10366. * @en Camera shutter enumeration, the value represents the speed of the shutter.
  10367. * @zh 相机快门枚举,枚举值表示快门速度。
  10368. */
  10369. export enum CameraShutter {
  10370. /**
  10371. * 1 second
  10372. */
  10373. D1 = 0,
  10374. /**
  10375. * 1/2 second
  10376. */
  10377. D2 = 1,
  10378. /**
  10379. * 1/4 second
  10380. */
  10381. D4 = 2,
  10382. /**
  10383. * 1/8 second
  10384. */
  10385. D8 = 3,
  10386. /**
  10387. * 1/15 second
  10388. */
  10389. D15 = 4,
  10390. /**
  10391. * 1/30 second
  10392. */
  10393. D30 = 5,
  10394. /**
  10395. * 1/60 second
  10396. */
  10397. D60 = 6,
  10398. /**
  10399. * 1/125 second
  10400. */
  10401. D125 = 7,
  10402. /**
  10403. * 1/250 second
  10404. */
  10405. D250 = 8,
  10406. /**
  10407. * 1/500 second
  10408. */
  10409. D500 = 9,
  10410. /**
  10411. * 1/1000 second
  10412. */
  10413. D1000 = 10,
  10414. /**
  10415. * 1/2000 second
  10416. */
  10417. D2000 = 11,
  10418. /**
  10419. * 1/4000 second
  10420. */
  10421. D4000 = 12
  10422. }
  10423. /**
  10424. * @en The type of the camera, mainly for marking different camera usage in XR, it determines the camera's viewport and parameters.
  10425. * @zh 相机类型,主要服务于标记 XR 中的不同相机用途,影响渲染的视口和对应的参数。
  10426. */
  10427. export enum CameraType {
  10428. /**
  10429. * @en Default camera type
  10430. * @zh 默认相机类型
  10431. */
  10432. DEFAULT = "Bad expression <-1>",
  10433. /**
  10434. * @en If a camera is set to be left eye, it will be used to render the left eye screen,
  10435. * otherwise, the left eye screen will be rendered using adjusted parameters based on XR main camera.
  10436. * @zh 如果设置了左眼相机,则在绘制左眼屏幕时使用,否则,就根据 XR 主相机的参数来计算左眼参数。
  10437. */
  10438. LEFT_EYE = 0,
  10439. /**
  10440. * @en If a camera is set to be right eye, it will be used to render the right eye screen,
  10441. * otherwise, the right eye screen will be rendered using adjusted parameters based on XR main camera.
  10442. * @zh 如果设置了右眼相机,则在绘制右眼屏幕时使用,否则,就根据 XR 主相机的参数来计算左眼参数。
  10443. */
  10444. RIGHT_EYE = 1,
  10445. /**
  10446. * @en The main camera, it could be used to calculate the parameters for both left eye and the right eye cameras.
  10447. * It could be converted from the default 3d camera.
  10448. * @zh XR 主相机,可以通过默认相机转换,也可以手动创建新的 XR 相机,可以计算出左右两个相机的相对参数。
  10449. */
  10450. MAIN = 2
  10451. }
  10452. /**
  10453. * @en The spatial tracking signal type used by the camera in XR.
  10454. * @zh 相机使用的 XR 空间定位追踪信号类型。
  10455. */
  10456. export enum TrackingType {
  10457. /**
  10458. * @en Camera without signal tracking in XR device.
  10459. * @zh 无追踪相机,不对 XR 设备的信号进行追踪。
  10460. */
  10461. NO_TRACKING = 0,
  10462. /**
  10463. * @en Camera tracking position and rotation signals from XR device.
  10464. * @zh 相机追踪 XR 设备移动位置和旋转角度信号。
  10465. */
  10466. POSITION_AND_ROTATION = 1,
  10467. /**
  10468. * @en Camera only tracking position signals from XR device.
  10469. * @zh 相机只追踪 XR 设备位置信号。
  10470. */
  10471. POSITION = 2,
  10472. /**
  10473. * @en Camera only tracking rotation signals from XR device.
  10474. * @zh 相机只追踪 XR 设备旋转角度信号。
  10475. */
  10476. ROTATION = 3
  10477. }
  10478. /**
  10479. * @en The usage of the camera, it's an engine internal marker enumeration.
  10480. * @zh 相机的用途枚举,这是引擎内部使用的标记枚举。
  10481. */
  10482. export enum CameraUsage {
  10483. /**
  10484. * @en Camera used in editor
  10485. * @zh 编辑器下使用的相机
  10486. */
  10487. EDITOR = 0,
  10488. /**
  10489. * @en Camera used in editor's game view.
  10490. * @zh 编辑器 GameView 视图下使用的相机。
  10491. */
  10492. GAME_VIEW = 1,
  10493. /**
  10494. * @en Camera used in editor's scene view.
  10495. * @zh 编辑器场景编辑器视图下使用的相机。
  10496. */
  10497. SCENE_VIEW = 2,
  10498. /**
  10499. * @en Camera used in editor's camera preview window.
  10500. * @zh 编辑器预览小窗视图下使用的相机。
  10501. */
  10502. PREVIEW = 3,
  10503. /**
  10504. * @en Camera used in game, normally user created cameras are all GAME type.
  10505. * @zh 游戏视图下使用的相机,一般情况下用户创建的相机都是 GAME 类型。
  10506. */
  10507. GAME = 100
  10508. }
  10509. /**
  10510. * @en The camera creation information struct
  10511. * @zh 用来创建相机的结构体
  10512. */
  10513. export interface ICameraInfo {
  10514. /**
  10515. * @en The name of the camera.
  10516. * @zh 相机命名。
  10517. */
  10518. name: string;
  10519. /**
  10520. * @en The node which the camera is attached to.
  10521. * @zh 相机挂载的节点。
  10522. */
  10523. node: Node;
  10524. /**
  10525. * @en The projection type of the camera.
  10526. * @zh 相机的投影类型。
  10527. */
  10528. projection: CameraProjection;
  10529. /**
  10530. * @en The id of the target display, if absent, it will be rendered on the default one.
  10531. * @zh 相机的目标屏幕,如果缺省,将会使用默认屏幕。
  10532. */
  10533. targetDisplay?: number;
  10534. /**
  10535. * @en The target render window of the camera, is absent, the camera won't be rendered.
  10536. * @zh 相机的目标渲染窗口,如果缺省,该相机不会执行渲染流程。
  10537. */
  10538. window?: __private._cocos_render_scene_core_render_window__RenderWindow | null;
  10539. /**
  10540. * @en Render priority of the camera. Cameras with higher depth are rendered after cameras with lower depth.
  10541. * @zh 相机的渲染优先级,值越小越优先渲染。
  10542. */
  10543. priority: number;
  10544. /**
  10545. * @internal
  10546. */
  10547. pipeline?: string;
  10548. /**
  10549. * @en The type of the camera, mainly for marking different camera usage in XR, it determines the camera's viewport and parameters.
  10550. * @zh 相机类型,主要服务于标记 XR 中的不同相机用途,影响渲染的视口和对应的参数。
  10551. */
  10552. cameraType?: CameraType;
  10553. /**
  10554. * @en The spatial tracking signal type used by the camera in XR.
  10555. * @zh 相机使用的 XR 空间定位追踪信号类型。
  10556. */
  10557. trackingType?: TrackingType;
  10558. /**
  10559. * @internal
  10560. */
  10561. usage?: CameraUsage;
  10562. }
  10563. export const SKYBOX_FLAG: number;
  10564. /**
  10565. * @en The render camera representation in the render scene, it's managed by [[Camera]]
  10566. * @zh 渲染场景中的相机对象,由项目层的 [[Camera]] 管理。
  10567. */
  10568. export class Camera {
  10569. /**
  10570. * @en This exposure value corresponding to default standard camera exposure parameters.
  10571. * @zh 默认相机的曝光值。
  10572. */
  10573. static get standardExposureValue(): number;
  10574. /**
  10575. * @en The luminance unit scale used by area lights.
  10576. * @zh 默认局部光源使用的亮度单位缩放。
  10577. */
  10578. static get standardLightMeterScale(): number;
  10579. /**
  10580. * @en The name of the camera
  10581. * @zh 相机的名称
  10582. */
  10583. get name(): string | null;
  10584. /**
  10585. * @en The render scene to which the camera is attached
  10586. * @zh 相机所挂载的场景
  10587. */
  10588. get scene(): RenderScene | null;
  10589. /**
  10590. * @en The node of the camera which determines its transform in world space.
  10591. * @zh 相机绑定的节点,决定了它在世界空间的变换矩阵
  10592. */
  10593. set node(val: Node);
  10594. get node(): Node;
  10595. /**
  10596. * @en The unique ID of system window which the camera will render to.
  10597. * @zh 相机关联的渲染窗口ID
  10598. */
  10599. get systemWindowId(): number;
  10600. /**
  10601. * @en The render window of the camera
  10602. * @zh 相机关联的渲染窗口
  10603. */
  10604. set window(val: __private._cocos_render_scene_core_render_window__RenderWindow);
  10605. get window(): __private._cocos_render_scene_core_render_window__RenderWindow;
  10606. /**
  10607. * @en Whether the camera is enabled, a disabled camera won't be processed in the render pipeline.
  10608. * @zh 相机是否启用,未启用的相机不会被渲染
  10609. */
  10610. set enabled(val: boolean);
  10611. get enabled(): boolean;
  10612. /**
  10613. * @en Visibility mask of the camera, declaring a set of node layers that will be visible to this camera.
  10614. * @zh 相机的可见性掩码,声明在当前相机中可见的节点层级集合。
  10615. */
  10616. set visibility(vis: number);
  10617. get visibility(): number;
  10618. /**
  10619. * @en Render priority of the camera. Cameras with higher depth are rendered after cameras with lower depth.
  10620. * @zh 相机的渲染优先级,值越小越优先渲染。
  10621. */
  10622. get priority(): number;
  10623. set priority(val: number);
  10624. /**
  10625. * @en The width of the camera's view size
  10626. * @zh 相机的视图宽度
  10627. */
  10628. get width(): number;
  10629. /**
  10630. * @en The height of the camera's view size
  10631. * @zh 相机的视图高度
  10632. */
  10633. get height(): number;
  10634. /**
  10635. * @en The world position of the camera
  10636. * @zh 相机的世界坐标
  10637. */
  10638. set position(val: math.Vec3);
  10639. get position(): math.Vec3;
  10640. /**
  10641. * @en The forward vector of the camera's look direction
  10642. * @zh 指向相机观察方向的向量
  10643. */
  10644. set forward(val: math.Vec3);
  10645. get forward(): math.Vec3;
  10646. /**
  10647. * @en Camera aperture, controls the exposure parameter.
  10648. * @zh 相机光圈,影响相机的曝光参数。
  10649. */
  10650. set aperture(val: CameraAperture);
  10651. get aperture(): CameraAperture;
  10652. /**
  10653. * @en Camera aperture value.
  10654. * @zh 相机光圈值。
  10655. */
  10656. get apertureValue(): number;
  10657. /**
  10658. * @en Camera shutter, controls the exposure parameter.
  10659. * @zh 相机快门,影响相机的曝光参数。
  10660. */
  10661. set shutter(val: CameraShutter);
  10662. get shutter(): CameraShutter;
  10663. /**
  10664. * @en Camera shutter value.
  10665. * @zh 相机快门值。
  10666. */
  10667. get shutterValue(): number;
  10668. /**
  10669. * @en Camera ISO, controls the exposure parameter.
  10670. * @zh 相机感光度,影响相机的曝光参数。
  10671. */
  10672. set iso(val: CameraISO);
  10673. get iso(): CameraISO;
  10674. /**
  10675. * @en Camera ISO value.
  10676. * @zh 相机感光度值。
  10677. */
  10678. get isoValue(): number;
  10679. /**
  10680. * @en The calculated exposure of the camera
  10681. * @zh 相机的曝光参数
  10682. */
  10683. get exposure(): number;
  10684. /**
  10685. * @en Clearing flags of the camera, specifies which part of the framebuffer will be actually cleared every frame.
  10686. * @zh 相机的缓冲清除标志位,指定帧缓冲的哪部分要每帧清除。
  10687. */
  10688. get clearFlag(): gfx.ClearFlags;
  10689. set clearFlag(flag: gfx.ClearFlags);
  10690. /**
  10691. * @en Clearing color of the camera.
  10692. * @zh 相机的颜色缓冲默认值。
  10693. */
  10694. set clearColor(val: math.IVec4Like);
  10695. get clearColor(): math.IVec4Like;
  10696. /**
  10697. * @en Clearing depth of the camera.
  10698. * @zh 相机的深度缓冲默认值。
  10699. */
  10700. get clearDepth(): number;
  10701. set clearDepth(depth: number);
  10702. /**
  10703. * @en Clearing stencil of the camera.
  10704. * @zh 相机的模板缓冲默认值。
  10705. */
  10706. get clearStencil(): number;
  10707. set clearStencil(stencil: number);
  10708. /**
  10709. * @en The projection type of the camera.
  10710. * @zh 相机的投影类型。
  10711. */
  10712. set projectionType(val: CameraProjection);
  10713. get projectionType(): CameraProjection;
  10714. /**
  10715. * @en The aspect ratio of the camera
  10716. * @zh 相机视图的长宽比
  10717. */
  10718. get aspect(): number;
  10719. /**
  10720. * @en The viewport height of the orthogonal type camera.
  10721. * @zh 正交相机的视角高度。
  10722. */
  10723. set orthoHeight(val: number);
  10724. get orthoHeight(): number;
  10725. /**
  10726. * @en The axis on which the FOV would be fixed regardless of screen aspect changes.
  10727. * @zh 指定视角的固定轴向,在此轴上不会跟随屏幕长宽比例变化。
  10728. */
  10729. set fovAxis(axis: CameraFOVAxis);
  10730. get fovAxis(): CameraFOVAxis;
  10731. /**
  10732. * @en Field of view of the camera.
  10733. * @zh 相机的视角大小。
  10734. */
  10735. set fov(fov: number);
  10736. get fov(): number;
  10737. /**
  10738. * @en Near clipping distance of the camera, should be as large as possible within acceptable range.
  10739. * @zh 相机的近裁剪距离,应在可接受范围内尽量取最大。
  10740. */
  10741. set nearClip(nearClip: number);
  10742. get nearClip(): number;
  10743. /**
  10744. * @en Far clipping distance of the camera, should be as small as possible within acceptable range.
  10745. * @zh 相机的远裁剪距离,应在可接受范围内尽量取最小。
  10746. */
  10747. set farClip(farClip: number);
  10748. get farClip(): number;
  10749. /**
  10750. * @en The viewport rect of the camera, pre-rotated (i.e. always in identity/portrait mode) if possible.
  10751. * @zh 相机的视口矩形,如果设备允许的话,这个视口会永远保持竖屏状态,由渲染流程保障旋转的正确。
  10752. */
  10753. get viewport(): math.Rect;
  10754. set viewport(val: math.Rect);
  10755. /**
  10756. * @en The view frustum of the camera
  10757. * @zh 相机的视锥体
  10758. */
  10759. set frustum(val: geometry.Frustum);
  10760. get frustum(): geometry.Frustum;
  10761. /**
  10762. * @en The view matrix of the camera
  10763. * @zh 相机的视图矩阵
  10764. */
  10765. get matView(): math.Mat4;
  10766. /**
  10767. * @en The projection matrix of the camera
  10768. * @zh 相机的投影矩阵
  10769. */
  10770. get matProj(): math.Mat4;
  10771. /**
  10772. * @en The inverse of the projection matrix of the camera
  10773. * @zh 相机的逆投影矩阵
  10774. */
  10775. get matProjInv(): math.Mat4;
  10776. /**
  10777. * @en The view projection matrix of the camera
  10778. * @zh 相机的视图投影矩阵
  10779. */
  10780. get matViewProj(): math.Mat4;
  10781. /**
  10782. * @en The inverse of the view projection matrix of the camera
  10783. * @zh 相机的逆视图投影矩阵
  10784. */
  10785. get matViewProjInv(): math.Mat4;
  10786. /**
  10787. * @en Whether the camera is fixed size or matching the window size.
  10788. * @zh 相机是固定尺寸还是跟随屏幕尺寸
  10789. */
  10790. isWindowSize: boolean;
  10791. /**
  10792. * @en Scale of the internal buffer size,
  10793. * set to 1 to keep the same with the canvas size.
  10794. * @zh 相机内部缓冲尺寸的缩放值, 1 为与 canvas 尺寸相同。
  10795. */
  10796. screenScale: number;
  10797. postProcess: postProcess.PostProcess | null;
  10798. usePostProcess: boolean;
  10799. pipeline: string;
  10800. constructor(device: gfx.Device);
  10801. /**
  10802. * @en Initialize the camera, normally you shouldn't invoke this function, it's managed automatically.
  10803. * @zh 初始化相机,开发者通常不应该使用这个方法,初始化流程是自动管理的。
  10804. */
  10805. initialize(info: ICameraInfo): void;
  10806. /**
  10807. * @en Destroy the camera, you shouldn't invoke this function, it's managed by the render scene.
  10808. * @zh 销毁相机,开发者不应该使用这个方法,销毁流程是由 RenderScene 管理的。
  10809. */
  10810. destroy(): void;
  10811. /**
  10812. * @en Attach the camera to the given render scene so that it will be rendered in it.
  10813. * @zh 将相机添加到相关的渲染场景中,以便可以被渲染器渲染。
  10814. * @param scene @en The render scene @zh 渲染场景
  10815. */
  10816. attachToScene(scene: RenderScene): void;
  10817. /**
  10818. * @en Detach the camera from previously attached render scene. It will no longer be rendered.
  10819. * @zh 将相机从之前设置的渲染场景移除,之后将不会再被渲染。
  10820. */
  10821. detachFromScene(): void;
  10822. /**
  10823. * @en Resize the view size of the camera.
  10824. * @zh 重置相机视图尺寸
  10825. * @param width The width of the view size
  10826. * @param height The height of the view size
  10827. */
  10828. resize(width: number, height: number): void;
  10829. /**
  10830. * @en Set a fixed size for the camera view.
  10831. * @zh 设置固定相机视图尺寸
  10832. * @param width The width of the view size
  10833. * @param height The height of the view size
  10834. */
  10835. setFixedSize(width: number, height: number): void;
  10836. /**
  10837. * Editor specific gizmo camera logic
  10838. * @internal
  10839. */
  10840. syncCameraEditor(camera: any): void;
  10841. /**
  10842. * @en Update the camera's builtin matrixes
  10843. * @zh 更新相机的视图、投影等矩阵
  10844. * @param forceUpdate If force update, then dirty flag will be ignored
  10845. */
  10846. update(forceUpdate?: boolean): void;
  10847. get surfaceTransform(): gfx.SurfaceTransform;
  10848. /**
  10849. * @en Set the viewport in oriented space (equal to the actual screen rotation)
  10850. * @zh 在目标朝向空间(实际屏幕朝向)内设置相机视口
  10851. */
  10852. setViewportInOrientedSpace(val: math.Rect): void;
  10853. /**
  10854. * @en create geometry renderer for this camera
  10855. * @zh 创建这个摄像机的几何体渲染器
  10856. */
  10857. initGeometryRenderer(): void;
  10858. /**
  10859. * @en get geometry renderer of this camera
  10860. * @zh 获取这个摄像机的几何体渲染器
  10861. * @returns @en return the geometry renderer @zh 返回几何体渲染器
  10862. */
  10863. get geometryRenderer(): GeometryRenderer | null;
  10864. get cameraType(): CameraType;
  10865. set cameraType(type: CameraType);
  10866. get trackingType(): TrackingType;
  10867. set trackingType(type: TrackingType);
  10868. get cameraUsage(): CameraUsage;
  10869. set cameraUsage(usage: CameraUsage);
  10870. /**
  10871. * @en Change the target render window to another one
  10872. * @zh 修改相机的目标渲染窗口
  10873. * @param window The target render window, could be null
  10874. */
  10875. changeTargetWindow(window?: __private._cocos_render_scene_core_render_window__RenderWindow | null): void;
  10876. /**
  10877. * @en Detach camera from the render window
  10878. * @zh 将 camera 从渲染窗口移除
  10879. */
  10880. detachCamera(): void;
  10881. /**
  10882. * @en Transform a screen position (in oriented space) to a world space ray
  10883. * @zh 将一个屏幕空间(在实际朝向下)点转换到世界空间的射线
  10884. * @param out the resulting ray
  10885. * @param x the screen x of the position
  10886. * @param y the screen y of the position
  10887. * @returns the resulting ray
  10888. */
  10889. screenPointToRay(out: geometry.Ray, x: number, y: number): geometry.Ray;
  10890. /**
  10891. * @en Transform a screen position (in oriented space) to world space
  10892. * @zh 将一个屏幕空间(在实际朝向下)位置转换到世界空间
  10893. * @param out the resulting vector
  10894. * @param screenPos the screen position to be transformed
  10895. * @returns the resulting vector
  10896. */
  10897. screenToWorld(out: math.Vec3, screenPos: math.Vec3): math.Vec3;
  10898. /**
  10899. * @en Transform a world space position to screen space rendered by the camera
  10900. * @zh 将一个世界空间位置转换到相机渲染后的屏幕空间
  10901. * @param out the resulting vector
  10902. * @param worldPos the world position to be transformed
  10903. * @returns the resulting vector
  10904. */
  10905. worldToScreen(out: math.Vec3, worldPos: math.Vec3 | Readonly<math.Vec3>): math.Vec3;
  10906. /**
  10907. * @en Transform a world space matrix to screen space rendered by the camera
  10908. * @zh 将一个世界空间矩阵转换到相机渲染后的屏幕空间
  10909. * @param out the resulting matrix
  10910. * @param worldMatrix the world space matrix to be transformed
  10911. * @param width framebuffer width
  10912. * @param height framebuffer height
  10913. * @returns the resulting matrix
  10914. */
  10915. worldMatrixToScreen(out: math.Mat4, worldMatrix: math.Mat4, width: number, height: number): math.Mat4;
  10916. /**
  10917. * @en Calculate and set oblique view frustum projection matrix.
  10918. * @zh 计算并设置斜视锥体投影矩阵
  10919. * @param clipPlane clip plane in camera space
  10920. */
  10921. calculateObliqueMat(viewSpacePlane: math.Vec4): void;
  10922. getClipSpaceMinz(): number;
  10923. /**
  10924. * @en Set exposure with actual value.
  10925. * @zh 设置相机的曝光值
  10926. * @param ev100
  10927. */
  10928. protected setExposure(ev100: any): void;
  10929. }
  10930. export enum ModelType {
  10931. DEFAULT = 0,
  10932. SKINNING = 1,
  10933. BAKED_SKINNING = 2,
  10934. BATCH_2D = 3,
  10935. PARTICLE_BATCH = 4,
  10936. LINE = 5
  10937. }
  10938. /**
  10939. * @en A representation of a model instance
  10940. * The base model class, which is the core component of [[MeshRenderer]],
  10941. * adds its own Model to the rendered scene for rendering submissions when [[MeshRenderer]] is enabled.
  10942. * This type of object represents a rendering instance in a scene, and it can contain multiple sub models,
  10943. * each of which corresponds to a material. These sub models share the same location and form a complete object.
  10944. * Each sub model references a sub mesh resource, which provides vertex and index buffers for rendering.
  10945. * @zh 代表一个模型实例
  10946. * 基础模型类,它是 [[MeshRenderer]] 的核心组成部分,在 [[MeshRenderer]] 启用时会将自己的 Model 添加到渲染场景中用于提交渲染。
  10947. * 此类型对象代表一个场景中的渲染实例,它可以包含多个子模型,每个子模型对应一个材质。这些子模型共享同样的位置,组成一个完整的物体。
  10948. * 每个子模型引用一个子网格资源,后者提供渲染所用的顶点与索引缓冲。
  10949. */
  10950. export class Model {
  10951. /**
  10952. * @en Sub models of the current model
  10953. * @zh 获取所有子模型
  10954. */
  10955. get subModels(): SubModel[];
  10956. /**
  10957. * @en Whether the model is initialized
  10958. * @zh 是否初始化
  10959. */
  10960. get inited(): boolean;
  10961. /**
  10962. * @en The axis-aligned bounding box of the model in the world space
  10963. * @zh 获取世界空间包围盒
  10964. */
  10965. get worldBounds(): geometry.AABB | null;
  10966. /**
  10967. * @en The axis-aligned bounding box of the model in the model space
  10968. * @zh 获取模型空间包围盒
  10969. */
  10970. get modelBounds(): geometry.AABB | null;
  10971. /**
  10972. * @en The ubo buffer of the model
  10973. * @zh 获取模型的 ubo 缓冲
  10974. */
  10975. get localBuffer(): gfx.Buffer | null;
  10976. /**
  10977. * @en The SH ubo buffer of the model
  10978. * @zh 获取模型的球谐 ubo 缓冲
  10979. */
  10980. get localSHBuffer(): gfx.Buffer | null;
  10981. /**
  10982. * @en The world bound ubo buffer
  10983. * @zh 获取世界包围盒 ubo 缓冲
  10984. */
  10985. get worldBoundBuffer(): gfx.Buffer | null;
  10986. /**
  10987. * @en The time stamp of last update
  10988. * @zh 获取上次更新时间戳
  10989. */
  10990. get updateStamp(): number;
  10991. /**
  10992. * @en Use LightProbe or not
  10993. * @zh 光照探针开关
  10994. */
  10995. get useLightProbe(): boolean;
  10996. set useLightProbe(val: boolean);
  10997. /**
  10998. * @en located tetrahedron index
  10999. * @zh 模型所处的四面体索引
  11000. */
  11001. get tetrahedronIndex(): number;
  11002. set tetrahedronIndex(index: number);
  11003. /**
  11004. * @en Model level shadow bias
  11005. * @zh 阴影偏移值
  11006. */
  11007. get shadowBias(): number;
  11008. set shadowBias(val: number);
  11009. /**
  11010. * @en Model level shadow normal bias
  11011. * @zh 阴影法线偏移值
  11012. */
  11013. get shadowNormalBias(): number;
  11014. set shadowNormalBias(val: number);
  11015. /**
  11016. * @en Whether the model should receive shadow
  11017. * @zh 是否接收阴影
  11018. */
  11019. get receiveShadow(): boolean;
  11020. set receiveShadow(val: boolean);
  11021. /**
  11022. * @en Whether the model should cast shadow
  11023. * @zh 是否投射阴影
  11024. */
  11025. get castShadow(): boolean;
  11026. set castShadow(val: boolean);
  11027. /**
  11028. * @en Gets or sets receive direction Light.
  11029. * @zh 获取或者设置接收平行光光照。
  11030. */
  11031. get receiveDirLight(): boolean;
  11032. set receiveDirLight(val: boolean);
  11033. /**
  11034. * @en The node to which the model belongs
  11035. * @zh 模型所在的节点
  11036. */
  11037. get node(): Node;
  11038. set node(n: Node);
  11039. /**
  11040. * @en Model's transform
  11041. * @zh 模型的变换
  11042. */
  11043. get transform(): Node;
  11044. set transform(n: Node);
  11045. /**
  11046. * @en Model's visibility tag
  11047. * Model's visibility flags, it's different from [[Node.layer]],
  11048. * but it will also be compared with [[Camera.visibility]] during culling process.
  11049. * @zh 模型的可见性标志
  11050. * 模型的可见性标志与 [[Node.layer]] 不同,它会在剔除阶段与 [[Camera.visibility]] 进行比较
  11051. */
  11052. get visFlags(): number;
  11053. set visFlags(val: number);
  11054. /**
  11055. * @en Whether the model is enabled in the render scene so that it will be rendered
  11056. * @zh 模型是否在渲染场景中启用并被渲染
  11057. */
  11058. get enabled(): boolean;
  11059. set enabled(val: boolean);
  11060. /**
  11061. * @en Rendering priority in the transparent queue of model.
  11062. * @zh Model 在透明队列中的渲染排序优先级
  11063. */
  11064. get priority(): number;
  11065. set priority(val: number);
  11066. /**
  11067. * @en Whether the model can be render by the reflection probe
  11068. * @zh 模型是否能被反射探针渲染
  11069. */
  11070. get bakeToReflectionProbe(): boolean;
  11071. set bakeToReflectionProbe(val: boolean);
  11072. /**
  11073. * @en Reflection probe type
  11074. * @zh 反射探针类型。
  11075. */
  11076. get reflectionProbeType(): ReflectionProbeType;
  11077. set reflectionProbeType(val: ReflectionProbeType);
  11078. /**
  11079. * @en sets or gets reflection probe id
  11080. * @zh 设置或获取反射探针id。
  11081. */
  11082. get reflectionProbeId(): number;
  11083. set reflectionProbeId(val: number);
  11084. /**
  11085. * @en Sets or gets the reflection probe id for blend.
  11086. * @zh 设置或获取用于混合的反射探针id。
  11087. */
  11088. get reflectionProbeBlendId(): number;
  11089. set reflectionProbeBlendId(val: number);
  11090. /**
  11091. * @en Sets or gets the reflection probe blend weight.
  11092. * @zh 设置或获取反射探针混合权重。
  11093. */
  11094. get reflectionProbeBlendWeight(): number;
  11095. set reflectionProbeBlendWeight(val: number);
  11096. /**
  11097. * @en The type of the model
  11098. * @zh 模型类型
  11099. */
  11100. type: ModelType;
  11101. /**
  11102. * @en The render scene to which the model belongs
  11103. * @zh 模型所在的场景
  11104. */
  11105. scene: RenderScene | null;
  11106. /**
  11107. * @en Whether dynamic batching is enabled for model
  11108. * @zh 是否动态合批
  11109. */
  11110. isDynamicBatching: boolean;
  11111. /**
  11112. * @en The world axis-aligned bounding box
  11113. * @zh 世界空间包围盒
  11114. */
  11115. protected _worldBounds: geometry.AABB | null;
  11116. /**
  11117. * @en The model axis-aligned bounding box
  11118. * @zh 模型空间包围盒
  11119. */
  11120. protected _modelBounds: geometry.AABB | null;
  11121. /**
  11122. * @en Sub models
  11123. * @zh 子模型
  11124. */
  11125. protected _subModels: SubModel[];
  11126. /**
  11127. * @en The node to which the model belongs
  11128. * @zh 模型所在的节点
  11129. */
  11130. protected _node: Node;
  11131. /**
  11132. * @en Model's transform
  11133. * @zh 子模型的变换
  11134. */
  11135. protected _transform: Node;
  11136. /**
  11137. * @en Current gfx device
  11138. * @zh 当前 GFX 设备
  11139. */
  11140. protected _device: gfx.Device;
  11141. /**
  11142. * @en Whether the model is initialized
  11143. * @zh 是否初始化过
  11144. */
  11145. protected _inited: boolean;
  11146. /**
  11147. * @en Descriptor set count
  11148. * @zh 描述符集合个数
  11149. */
  11150. protected _descriptorSetCount: number;
  11151. /**
  11152. * @en Time stamp for last update
  11153. * @zh 更新时间戳
  11154. */
  11155. protected _updateStamp: number;
  11156. /**
  11157. * @en Local ubo data dirty flag
  11158. * @zh 本地 ubo 数据是否修改过
  11159. */
  11160. protected _localDataUpdated: boolean;
  11161. /**
  11162. * @en Local ubo data
  11163. * @zh 本地 ubo 数据
  11164. */
  11165. protected _localData: Float32Array;
  11166. /**
  11167. * @en Local ubo buffer
  11168. * @zh 本地 ubo 缓冲
  11169. */
  11170. protected _localBuffer: gfx.Buffer | null;
  11171. /**
  11172. * @en Local SH ubo data
  11173. * @zh 本地球谐 ubo 数据
  11174. */
  11175. protected _localSHData: Float32Array | null;
  11176. /**
  11177. * @en Local SH ubo buffer
  11178. * @zh 本地球谐 ubo 缓冲
  11179. */
  11180. protected _localSHBuffer: gfx.Buffer | null;
  11181. /**
  11182. * @en World AABB buffer
  11183. * @zh 世界空间包围盒缓冲
  11184. */
  11185. protected _worldBoundBuffer: gfx.Buffer | null;
  11186. /**
  11187. * @en Whether the model should receive shadow
  11188. * @zh 是否接收阴影
  11189. */
  11190. protected _receiveShadow: boolean;
  11191. /**
  11192. * @en Whether the model should cast shadow
  11193. * @zh 是否投射阴影
  11194. */
  11195. protected _castShadow: boolean;
  11196. /**
  11197. * @en Is received direction Light.
  11198. * @zh 是否接收平行光光照。
  11199. */
  11200. protected _receiveDirLight: boolean;
  11201. /**
  11202. * @en Shadow bias
  11203. * @zh 阴影偏移
  11204. */
  11205. protected _shadowBias: number;
  11206. /**
  11207. * @en Shadow normal bias
  11208. * @zh 阴影法线偏移
  11209. */
  11210. protected _shadowNormalBias: number;
  11211. /**
  11212. * @en Reflect probe Id
  11213. * @zh 使用第几个反射探针
  11214. */
  11215. protected _reflectionProbeId: number;
  11216. /**
  11217. * @en Use which probe to blend
  11218. * @zh 使用第几个反射探针进行混合
  11219. */
  11220. protected _reflectionProbeBlendId: number;
  11221. /**
  11222. * @en Reflection probe blend weight
  11223. * @zh 反射探针混合权重
  11224. */
  11225. protected _reflectionProbeBlendWeight: number;
  11226. /**
  11227. * @en Whether the model is enabled in the render scene so that it will be rendered
  11228. * @zh 模型是否在渲染场景中启用并被渲染
  11229. */
  11230. protected _enabled: boolean;
  11231. /**
  11232. * @en The visibility flags
  11233. * @zh 可见性标志位
  11234. */
  11235. protected _visFlags: number;
  11236. protected _priority: number;
  11237. /**
  11238. * @en Whether the model can be render by the reflection probe
  11239. * @zh 模型是否能被反射探针渲染
  11240. */
  11241. protected _bakeToReflectionProbe: boolean;
  11242. /**
  11243. * @en Reflection probe type.
  11244. * @zh 反射探针类型。
  11245. */
  11246. protected _reflectionProbeType: ReflectionProbeType;
  11247. /**
  11248. * @internal
  11249. * @en native object
  11250. * @zh 原生对象
  11251. */
  11252. /**
  11253. * @internal
  11254. * @en return native object
  11255. * @zh 返回原生对象
  11256. */
  11257. /**
  11258. * @en Constructor to create an empty model
  11259. * @zh 创建一个空模型
  11260. */
  11261. constructor();
  11262. /**
  11263. * @en Initialize the model
  11264. * @zh 初始化模型
  11265. */
  11266. initialize(): void;
  11267. /**
  11268. * @en Destroy the model
  11269. * @zh 销毁模型
  11270. */
  11271. destroy(): void;
  11272. /**
  11273. * @en Attach the model to a [[renderer.RenderScene]]
  11274. * @zh 添加模型到渲染场景 [[renderer.RenderScene]] 中
  11275. * @param scene destination scene
  11276. */
  11277. attachToScene(scene: RenderScene): void;
  11278. /**
  11279. * @en Detach the model from its render scene
  11280. * @zh 移除场景中的模型
  11281. */
  11282. detachFromScene(): void;
  11283. /**
  11284. * @en Update the model's transform
  11285. * @zh 更新模型的变换
  11286. * @param stamp time stamp
  11287. */
  11288. updateTransform(stamp: number): void;
  11289. /**
  11290. * @en Update the model's world AABB
  11291. * @zh 更新模型的世界空间包围盒
  11292. */
  11293. updateWorldBound(): void;
  11294. /**
  11295. * @en Update the model's ubo
  11296. * @zh 更新模型的 ubo
  11297. * @param stamp time stamp
  11298. */
  11299. updateUBOs(stamp: number): void;
  11300. showTetrahedron(): boolean;
  11301. /**
  11302. * @en Clear the model's SH ubo
  11303. * @zh 清除模型的球谐 ubo
  11304. */
  11305. clearSHUBOs(): void;
  11306. /**
  11307. * @en Update the model's SH ubo
  11308. * @zh 更新模型的球谐 ubo
  11309. */
  11310. updateSHUBOs(): void;
  11311. /**
  11312. * @en Create the model's AABB
  11313. * @zh 创建模型的包围盒
  11314. * @param minPos min position of the AABB
  11315. * @param maxPos max position of the AABB
  11316. */
  11317. createBoundingShape(minPos?: math.Vec3, maxPos?: math.Vec3): void;
  11318. /**
  11319. * @en Initialize a sub model with the sub mesh data and the material.
  11320. * @zh 用子网格数据和材质初始化一个子模型。
  11321. * @param idx sub model's index
  11322. * @param subMeshData sub mesh
  11323. * @param mat sub material
  11324. */
  11325. initSubModel(idx: number, subMeshData: RenderingSubMesh, mat: Material): void;
  11326. /**
  11327. * @en Set material for a given sub model
  11328. * @zh 为指定的子模型设置材质
  11329. * @param idx sub model's index
  11330. * @param subMesh sub mesh
  11331. */
  11332. setSubModelMesh(idx: number, subMesh: RenderingSubMesh): void;
  11333. /**
  11334. * @en Set a sub material
  11335. * @zh 设置一个子材质
  11336. * @param idx sub model's index
  11337. * @param mat sub material
  11338. */
  11339. setSubModelMaterial(idx: number, mat: Material): void;
  11340. /**
  11341. * @en Pipeline changed callback
  11342. * @zh 管线更新回调
  11343. */
  11344. onGlobalPipelineStateChanged(): void;
  11345. /**
  11346. * @en Shader macro changed callback
  11347. * @zh Shader 宏更新回调
  11348. */
  11349. onMacroPatchesStateChanged(): void;
  11350. onGeometryChanged(): void;
  11351. /**
  11352. * @internal
  11353. * If the model has lighting map
  11354. * initialize lighting map info before model initializing
  11355. * because the lighting map will influence the shader
  11356. */
  11357. initLightingmap(texture: Texture2D | null, uvParam: math.Vec4): void;
  11358. /**
  11359. * @en Update the light map info
  11360. * @zh 更新光照贴图信息
  11361. * @param texture light map
  11362. * @param uvParam uv coordinate
  11363. */
  11364. updateLightingmap(texture: Texture2D | null, uvParam: math.Vec4): void;
  11365. /**
  11366. * @en Update the cube map of the reflection probe
  11367. * @zh 更新反射探针的立方体贴图
  11368. * @param texture probe cubemap
  11369. */
  11370. updateReflectionProbeCubemap(texture: TextureCube | null): void;
  11371. /**
  11372. * @en Update the cube map of the reflection probe for blend
  11373. * @zh 更新用于blend的反射探针立方体贴图
  11374. * @param texture probe cubemap
  11375. */
  11376. updateReflectionProbeBlendCubemap(texture: TextureCube | null): void;
  11377. /**
  11378. * @en Update the planar relflection map of the reflection probe
  11379. * @zh 更新反射探针的平面反射贴图
  11380. * @param texture planar relflection map
  11381. */
  11382. updateReflectionProbePlanarMap(texture: gfx.Texture | null): void;
  11383. /**
  11384. * @en Update the data map of the reflection probe
  11385. * @zh 更新反射探针的数据贴图
  11386. * @param texture data map
  11387. */
  11388. updateReflectionProbeDataMap(texture: Texture2D | null): void;
  11389. /**
  11390. * @en Update the shadow bias
  11391. * @zh 更新阴影偏移
  11392. */
  11393. updateLocalShadowBias(): void;
  11394. /**
  11395. * @en Update the id of reflection probe
  11396. * @zh 更新物体使用哪个反射探针
  11397. */
  11398. updateReflectionProbeId(): void;
  11399. /**
  11400. * @en Return shader's macro patches
  11401. * @zh 获取 shader 宏
  11402. * @param subModelIndex sub model's index
  11403. */
  11404. getMacroPatches(subModelIndex: number): IMacroPatch[] | null;
  11405. protected _updateAttributesAndBinding(subModelIndex: number): void;
  11406. protected _updateInstancedAttributes(attributes: gfx.Attribute[], subModel: SubModel): void;
  11407. protected _initLocalDescriptors(subModelIndex: number): void;
  11408. protected _initLocalSHDescriptors(subModelIndex: number): void;
  11409. protected _initWorldBoundDescriptors(subModelIndex: number): void;
  11410. protected _updateLocalDescriptors(subModelIndex: number, descriptorSet: gfx.DescriptorSet): void;
  11411. protected _updateLocalSHDescriptors(subModelIndex: number, descriptorSet: gfx.DescriptorSet): void;
  11412. protected _updateWorldBoundDescriptors(subModelIndex: number, descriptorSet: gfx.DescriptorSet): void;
  11413. }
  11414. export interface IInstancedAttributeBlock {
  11415. buffer: Uint8Array;
  11416. views: __private.__types_globals__TypedArray[];
  11417. attributes: gfx.Attribute[];
  11418. }
  11419. /**
  11420. * @en A sub part of the model, it describes how to render a specific sub mesh.
  11421. * It contains geometry information in [[RenderingSubMesh]] and all sort of rendering configuration like shaders, macro patches, passes etc.
  11422. * @zh 组成模型对象的子模型,它用来描述如何渲染模型的一个子网格。
  11423. * 它包含 [[RenderingSubMesh]] 代表的几何网格信息和所有渲染需要的数据,比如着色器程序,着色器宏定义,渲染 pass,等。
  11424. */
  11425. export class SubModel {
  11426. protected _device: gfx.Device | null;
  11427. protected _passes: Pass[] | null;
  11428. protected _shaders: gfx.Shader[] | null;
  11429. protected _subMesh: RenderingSubMesh | null;
  11430. protected _patches: IMacroPatch[] | null;
  11431. protected _priority: pipeline.RenderPriority;
  11432. protected _inputAssembler: gfx.InputAssembler | null;
  11433. protected _descriptorSet: gfx.DescriptorSet | null;
  11434. protected _worldBoundDescriptorSet: gfx.DescriptorSet | null;
  11435. protected _reflectionTex: gfx.Texture | null;
  11436. protected _reflectionSampler: gfx.Sampler | null;
  11437. protected _instancedAttributeBlock: IInstancedAttributeBlock;
  11438. protected _instancedWorldMatrixIndex: number;
  11439. protected _instancedSHIndex: number;
  11440. protected _useReflectionProbeType: number;
  11441. /**
  11442. * @en
  11443. * sub model's passes
  11444. * @zh
  11445. * 子模型的 passes
  11446. * @param passes @en The passes @zh 设置的 passes
  11447. */
  11448. /**
  11449. * @en Render passes for the sub-model
  11450. * @zh 子模型的渲染 pass
  11451. */
  11452. set passes(passes: Pass[]);
  11453. get passes(): Pass[];
  11454. /**
  11455. * @en Shaders for the sub-model, each shader corresponds to one of the [[passes]]
  11456. * @zh 子模型的着色器程序列表,每个着色器程序对应其中一个渲染 [[passes]]
  11457. */
  11458. get shaders(): gfx.Shader[];
  11459. /**
  11460. * @en The rendering sub mesh for the sub-model, each sub-model can only have one sub mesh.
  11461. * @zh 用于渲染的子网格对象,每个子模型只能包含一个子网格。
  11462. */
  11463. set subMesh(subMesh: RenderingSubMesh);
  11464. get subMesh(): RenderingSubMesh;
  11465. /**
  11466. * @en The rendering priority of the sub-model
  11467. * @zh 子模型的渲染优先级
  11468. */
  11469. set priority(val: pipeline.RenderPriority);
  11470. get priority(): pipeline.RenderPriority;
  11471. /**
  11472. * @en The low level input assembler which contains geometry data
  11473. * @zh 底层渲染用的输入汇集器,包含几何信息
  11474. */
  11475. get inputAssembler(): gfx.InputAssembler;
  11476. /**
  11477. * @en The descriptor set used for sub-model rendering
  11478. * @zh 底层渲染子模型用的描述符集组
  11479. */
  11480. get descriptorSet(): gfx.DescriptorSet;
  11481. /**
  11482. * @en The descriptor set for world bound
  11483. * @zh 用于存储世界包围盒的描述符集组
  11484. */
  11485. get worldBoundDescriptorSet(): gfx.DescriptorSet | null;
  11486. /**
  11487. * @en The macro patches for the shaders
  11488. * @zh 着色器程序所用的宏定义组合
  11489. */
  11490. get patches(): Readonly<IMacroPatch[] | null>;
  11491. /**
  11492. * @en The instance attribute block, access by sub model
  11493. * @zh 硬件实例化属性,通过子模型访问
  11494. */
  11495. get instancedAttributeBlock(): IInstancedAttributeBlock;
  11496. /**
  11497. * @en Get or set instance matrix id, access by sub model
  11498. * @zh 获取或者设置硬件实例化中的矩阵索引,通过子模型访问
  11499. */
  11500. set instancedWorldMatrixIndex(val: number);
  11501. get instancedWorldMatrixIndex(): number;
  11502. /**
  11503. * @en Get or set instance SH id, access by sub model
  11504. * @zh 获取或者设置硬件实例化中的球谐索引,通过子模型访问
  11505. */
  11506. set instancedSHIndex(val: number);
  11507. get instancedSHIndex(): number;
  11508. /**
  11509. * @en Gets or sets the type of reflection probe, Used to process instance
  11510. * @zh 获取或设置使用反射探针的类型,用于处理instance
  11511. */
  11512. set useReflectionProbeType(val: number);
  11513. get useReflectionProbeType(): number;
  11514. /**
  11515. * @en
  11516. * init sub model
  11517. * @zh
  11518. * 子模型初始化
  11519. * @param subMesh @en The sub mesh @zh 子网格资源
  11520. * @param passes @en The passes @zh 渲染的 passes
  11521. * @param patches @en The shader's macro @zh 着色器的宏定义
  11522. */
  11523. initialize(subMesh: RenderingSubMesh, passes: Pass[], patches?: IMacroPatch[] | null): void;
  11524. /**
  11525. * @en
  11526. * destroy sub model
  11527. * @zh
  11528. * 销毁子模型
  11529. */
  11530. destroy(): void;
  11531. /**
  11532. * @en
  11533. * update sub model
  11534. * @zh
  11535. * 更新子模型
  11536. */
  11537. update(): void;
  11538. /**
  11539. * @en Pipeline changed callback
  11540. * @zh 管线更新回调
  11541. */
  11542. onPipelineStateChanged(): void;
  11543. /**
  11544. * @en Shader macro changed callback
  11545. * @zh Shader 宏更新回调
  11546. */
  11547. onMacroPatchesStateChanged(patches: IMacroPatch[] | null): void;
  11548. /**
  11549. * @en
  11550. * geometry changed callback
  11551. * @zh
  11552. * 几何数据改变后的回调
  11553. */
  11554. onGeometryChanged(): void;
  11555. /**
  11556. * @en
  11557. * get instanced attribute index
  11558. * @zh
  11559. * 获取硬件实例化相关索引
  11560. */
  11561. /**
  11562. * @internal
  11563. */
  11564. getInstancedAttributeIndex(name: string): number;
  11565. /**
  11566. * @en
  11567. * update instancing related data, invoked by model
  11568. * @zh
  11569. * 更新硬件实例化相关数据,一般由model调用
  11570. */
  11571. /**
  11572. * @internal
  11573. */
  11574. updateInstancedWorldMatrix(mat: math.Mat4, idx: number): void;
  11575. /**
  11576. * @en
  11577. * update instancing SH data, invoked by model
  11578. * @zh
  11579. * 更新硬件实例化球谐数据,一般由model调用
  11580. */
  11581. /**
  11582. * @internal
  11583. */
  11584. updateInstancedSH(data: Float32Array, idx: number): void;
  11585. /**
  11586. * @en
  11587. * update instancing related data, invoked by model
  11588. * @zh
  11589. * 更新硬件实例化相关数据,一般由model调用
  11590. */
  11591. /**
  11592. * @internal
  11593. */
  11594. UpdateInstancedAttributes(attributes: gfx.Attribute[]): void;
  11595. protected _flushPassInfo(): void;
  11596. }
  11597. /**
  11598. * @en Ambient lighting representation in the render scene.
  11599. * The initial data is setup in [[SceneGlobals.ambient]].
  11600. * @zh 渲染场景中的环境光照设置。
  11601. * 初始值是由 [[SceneGlobals.ambient]] 设置的。
  11602. */
  11603. export class Ambient {
  11604. /**
  11605. * @en Default sun illuminance
  11606. * @zh 默认太阳亮度
  11607. */
  11608. static SUN_ILLUM: number;
  11609. /**
  11610. * @en Default sky illuminance
  11611. * @zh 默认天空亮度
  11612. */
  11613. static SKY_ILLUM: number;
  11614. /**
  11615. * @en Enable ambient
  11616. * @zh 是否开启环境光
  11617. */
  11618. set enabled(val: boolean);
  11619. get enabled(): boolean;
  11620. /**
  11621. * @en Sky color
  11622. * @zh 天空颜色
  11623. */
  11624. get skyColor(): math.Vec4;
  11625. set skyColor(color: math.Vec4);
  11626. /**
  11627. * @en Sky illuminance
  11628. * @zh 天空亮度
  11629. */
  11630. get skyIllum(): number;
  11631. set skyIllum(illum: number);
  11632. /**
  11633. * @en Ground color
  11634. * @zh 地面颜色
  11635. */
  11636. get groundAlbedo(): math.Vec4;
  11637. set groundAlbedo(color: math.Vec4);
  11638. protected _groundAlbedoHDR: math.Vec4;
  11639. protected _skyColorHDR: math.Vec4;
  11640. protected _skyIllumHDR: number;
  11641. protected _groundAlbedoLDR: math.Vec4;
  11642. protected _skyColorLDR: math.Vec4;
  11643. protected _skyIllumLDR: number;
  11644. protected _mipmapCount: number;
  11645. protected _enabled: boolean;
  11646. initialize(ambientInfo: AmbientInfo): void;
  11647. }
  11648. export const EnvironmentLightingType: {
  11649. /**
  11650. * @zh
  11651. * 半球漫反射
  11652. * @en
  11653. * hemisphere diffuse
  11654. * @readonly
  11655. */
  11656. HEMISPHERE_DIFFUSE: number;
  11657. /**
  11658. * @zh
  11659. * 半球漫反射和环境反射
  11660. * @en
  11661. * hemisphere diffuse and Environment reflection
  11662. * @readonly
  11663. */
  11664. AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION: number;
  11665. /**
  11666. * @zh
  11667. * 漫反射卷积图和环境反射
  11668. * @en
  11669. * diffuse convolution map and environment reflection
  11670. * @readonly
  11671. */
  11672. DIFFUSEMAP_WITH_REFLECTION: number;
  11673. };
  11674. /**
  11675. * @en The skybox configuration of the render scene,
  11676. * currently some rendering options like hdr and ibl lighting configuration is also here.
  11677. * @zh 渲染场景的天空盒配置,目前一些渲染配置,比如 HDR 模式和环境光照配置也在 Skybox 中。
  11678. */
  11679. export class Skybox {
  11680. /**
  11681. * @en The Model object of the skybox
  11682. * @zh 天空盒的 Model 对象
  11683. */
  11684. get model(): Model | null;
  11685. /**
  11686. * @en Whether activate skybox in the scene
  11687. * @zh 是否启用天空盒?
  11688. */
  11689. get enabled(): boolean;
  11690. set enabled(val: boolean);
  11691. /**
  11692. * @en Whether HDR mode is enabled
  11693. * @zh 是否启用HDR?
  11694. */
  11695. get useHDR(): boolean;
  11696. set useHDR(val: boolean);
  11697. /**
  11698. * @en Whether use image based lighting for PBR materials
  11699. * @zh 是否启用IBL?
  11700. */
  11701. get useIBL(): boolean;
  11702. set useIBL(val: boolean);
  11703. /**
  11704. * @en Whether use diffuse convolution map lighting
  11705. * @zh 是否为IBL启用漫反射卷积图?
  11706. */
  11707. get useDiffuseMap(): boolean;
  11708. set useDiffuseMap(val: boolean);
  11709. /**
  11710. * @en Whether enable RGBE data support in skybox shader
  11711. * @zh 是否需要开启 shader 内的 RGBE 数据支持?
  11712. */
  11713. get isRGBE(): boolean;
  11714. /**
  11715. * @en Whether to use offline baked convolutional maps
  11716. * @zh 是否使用离线烘焙的卷积图?
  11717. */
  11718. get useConvolutionMap(): boolean;
  11719. /**
  11720. * @en The texture cube used for the skybox
  11721. * @zh 使用的立方体贴图
  11722. */
  11723. get envmap(): TextureCube | null;
  11724. set envmap(val: TextureCube | null);
  11725. /**
  11726. * @en The texture cube used diffuse convolution map
  11727. * @zh 使用的漫反射卷积图
  11728. */
  11729. get diffuseMap(): TextureCube | null;
  11730. set diffuseMap(val: TextureCube | null);
  11731. get reflectionMap(): TextureCube | null;
  11732. get editableMaterial(): MaterialInstance | null;
  11733. protected _envmapLDR: TextureCube | null;
  11734. protected _envmapHDR: TextureCube | null;
  11735. protected _diffuseMapLDR: TextureCube | null;
  11736. protected _diffuseMapHDR: TextureCube | null;
  11737. protected _globalDSManager: __private._cocos_rendering_global_descriptor_set_manager__GlobalDSManager | null;
  11738. protected _model: Model | null;
  11739. protected _default: TextureCube | null;
  11740. protected _enabled: boolean;
  11741. protected _useIBL: boolean;
  11742. protected _useHDR: boolean;
  11743. protected _useDiffuseMap: boolean;
  11744. protected _editableMaterial: MaterialInstance | null;
  11745. protected _activated: boolean;
  11746. protected _reflectionHDR: TextureCube | null;
  11747. protected _reflectionLDR: TextureCube | null;
  11748. protected _rotationAngle: number;
  11749. initialize(skyboxInfo: SkyboxInfo): void;
  11750. /**
  11751. * @en Set the environment maps for HDR and LDR mode
  11752. * @zh 为 HDR 和 LDR 模式设置环境贴图
  11753. * @param envmapHDR @en Environment map for HDR mode @zh HDR 模式下的环境贴图
  11754. * @param envmapLDR @en Environment map for LDR mode @zh LDR 模式下的环境贴图
  11755. */
  11756. setEnvMaps(envmapHDR: TextureCube | null, envmapLDR: TextureCube | null): void;
  11757. /**
  11758. * @en Set the diffuse maps
  11759. * @zh 设置环境光漫反射贴图
  11760. * @param diffuseMapHDR @en Diffuse map for HDR mode @zh HDR 模式下的漫反射贴图
  11761. * @param diffuseMapLDR @en Diffuse map for LDR mode @zh LDR 模式下的漫反射贴图
  11762. */
  11763. setDiffuseMaps(diffuseMapHDR: TextureCube | null, diffuseMapLDR: TextureCube | null): void;
  11764. /**
  11765. * @en Set custom skybox material
  11766. * @zh 设置自定义的天空盒材质
  11767. * @param skyboxMat @en Skybox material @zh 天空盒材质
  11768. */
  11769. setSkyboxMaterial(skyboxMat: Material | null): void;
  11770. /**
  11771. * @en Set the environment reflection convolution map
  11772. * @zh 设置环境反射卷积图
  11773. * @param reflectionHDR @en Reflection convolution map for HDR mode @zh HDR 模式下的反射卷积图
  11774. * @param reflectionLDR @en Reflection convolution map for LDR mode @zh LDR 模式下的反射卷积图
  11775. */
  11776. setReflectionMaps(reflectionHDR: TextureCube | null, reflectionLDR: TextureCube | null): void;
  11777. /**
  11778. * @en Set skybox rotation angle
  11779. * @zh 设置天空盒旋转角度
  11780. * @param angle @en rotation angle @zh 旋转角度
  11781. */
  11782. setRotationAngle(angle: number): void;
  11783. getRotationAngle(): number;
  11784. updateMaterialRenderInfo(): void;
  11785. activate(): void;
  11786. protected _updatePipeline(): void;
  11787. protected _updateGlobalBinding(): void;
  11788. protected _updateSubModes(): void;
  11789. }
  11790. /**
  11791. * @zh 阴影贴图分辨率。
  11792. * @en The shadow map size.
  11793. * @static
  11794. * @enum Shadows.ShadowSize
  11795. */
  11796. export const ShadowSize: {
  11797. /**
  11798. * @zh 分辨率 256 * 256。
  11799. * @en shadow resolution 256 * 256.
  11800. * @readonly
  11801. */
  11802. Low_256x256: number;
  11803. /**
  11804. * @zh 分辨率 512 * 512。
  11805. * @en shadow resolution 512 * 512.
  11806. * @readonly
  11807. */
  11808. Medium_512x512: number;
  11809. /**
  11810. * @zh 分辨率 1024 * 1024。
  11811. * @en shadow resolution 1024 * 1024.
  11812. * @readonly
  11813. */
  11814. High_1024x1024: number;
  11815. /**
  11816. * @zh 分辨率 2048 * 2048。
  11817. * @en shadow resolution 2048 * 2048.
  11818. * @readonly
  11819. */
  11820. Ultra_2048x2048: number;
  11821. };
  11822. /**
  11823. * @zh 阴影类型。
  11824. * @en The shadow type
  11825. * @enum Shadows.ShadowType
  11826. */
  11827. export const ShadowType: {
  11828. /**
  11829. * @zh 平面阴影。
  11830. * @en Planar shadow
  11831. * @property Planar
  11832. * @readonly
  11833. */
  11834. Planar: number;
  11835. /**
  11836. * @zh 阴影贴图。
  11837. * @en Shadow type
  11838. * @property ShadowMap
  11839. * @readonly
  11840. */
  11841. ShadowMap: number;
  11842. };
  11843. /**
  11844. * @zh pcf阴影等级。
  11845. * @en The pcf type
  11846. * @static
  11847. * @enum Shadows.PCFType
  11848. */
  11849. export const PCFType: {
  11850. /**
  11851. * @zh x1 次采样
  11852. * @en x1 times
  11853. * @readonly
  11854. */
  11855. HARD: number;
  11856. /**
  11857. * @zh x4 次采样
  11858. * @en x4 times
  11859. * @readonly
  11860. */
  11861. SOFT: number;
  11862. /**
  11863. * @zh x9 次采样
  11864. * @en x9 times
  11865. * @readonly
  11866. */
  11867. SOFT_2X: number;
  11868. /**
  11869. * @zh x16 次采样
  11870. * @en x16 times
  11871. * @readonly
  11872. */
  11873. SOFT_4X: number;
  11874. };
  11875. /**
  11876. * @zh 级联阴影贴图层级。
  11877. * @en The CSM shadow level
  11878. * @enum Shadows.CSMLevel
  11879. */
  11880. export const CSMLevel: {
  11881. /**
  11882. * @zh 1 个层级
  11883. * @en level 1
  11884. * @readonly
  11885. */
  11886. LEVEL_1: number;
  11887. /**
  11888. * @zh 2 个层级
  11889. * @en level 2
  11890. * @readonly
  11891. */
  11892. LEVEL_2: number;
  11893. /**
  11894. * @zh 3 个层级
  11895. * @en level 3
  11896. * @readonly
  11897. */
  11898. LEVEL_3: number;
  11899. /**
  11900. * @zh 4 个层级
  11901. * @en level 4
  11902. * @readonly
  11903. */
  11904. LEVEL_4: number;
  11905. };
  11906. /**
  11907. * @zh 级联阴影性能优化模式。
  11908. * @en The CSM performance optimization mode
  11909. * @enum Shadows.CSMOptimizationMode
  11910. */
  11911. export const CSMOptimizationMode: {
  11912. /**
  11913. * @zh 没有性能优化
  11914. * @en has no performance optimization
  11915. * @readonly
  11916. */
  11917. NONE: number;
  11918. /**
  11919. * @zh 剔除层与层之间重复物体
  11920. * @en Eliminate duplicate objects between layers
  11921. * @readonly
  11922. */
  11923. RemoveDuplicates: number;
  11924. /**
  11925. * @zh 取消稳抖
  11926. * @en Disable rotation fix
  11927. * @readonly
  11928. */
  11929. DisableRotationFix: number;
  11930. };
  11931. /**
  11932. * @en The global shadow's configuration of the render scene
  11933. * @zh 渲染场景的全局阴影配置
  11934. */
  11935. export class Shadows {
  11936. /**
  11937. * @en MAX_FAR. This is shadow camera max far.
  11938. * @zh 阴影相机的最远视距。
  11939. */
  11940. static readonly MAX_FAR: number;
  11941. /**
  11942. * @en EXPANSION_RATIO. This is shadow boundingBox Coefficient of expansion.
  11943. * @zh 阴影包围盒扩大系数。
  11944. */
  11945. static readonly COEFFICIENT_OF_EXPANSION: number;
  11946. /**
  11947. * @en Whether activate planar shadow.
  11948. * @zh 是否启用平面阴影?
  11949. */
  11950. get enabled(): boolean;
  11951. set enabled(val: boolean);
  11952. /**
  11953. * @en Shadow type.
  11954. * @zh 阴影类型。
  11955. */
  11956. get type(): number;
  11957. set type(val: number);
  11958. /**
  11959. * @en The normal of the plane which receives shadow.
  11960. * @zh 阴影接收平面的法线。
  11961. */
  11962. get normal(): math.Vec3;
  11963. set normal(val: math.Vec3);
  11964. /**
  11965. * @en The distance from coordinate origin to the receiving plane.
  11966. * @zh 阴影接收平面与原点的距离。
  11967. */
  11968. get distance(): number;
  11969. set distance(val: number);
  11970. /**
  11971. * @en Positional offset values in planar shading calculations.
  11972. * @zh 平面阴影计算中的位置偏移值。
  11973. */
  11974. get planeBias(): number;
  11975. set planeBias(val: number);
  11976. /**
  11977. * @en Shadow color.
  11978. * @zh 阴影颜色。
  11979. */
  11980. get shadowColor(): math.Color;
  11981. set shadowColor(color: math.Color);
  11982. /**
  11983. * @en get or set shadow camera orthoSize.
  11984. * @zh 获取或者设置阴影纹理大小。
  11985. */
  11986. get size(): math.Vec2;
  11987. set size(val: math.Vec2);
  11988. /**
  11989. * @en shadow Map size has been modified.
  11990. * @zh 阴影贴图大小是否被修改。
  11991. */
  11992. get shadowMapDirty(): boolean;
  11993. set shadowMapDirty(val: boolean);
  11994. /**
  11995. * @en The transform matrix of the light source
  11996. * @zh 光源的变换矩阵
  11997. */
  11998. get matLight(): math.Mat4;
  11999. get material(): Material;
  12000. get instancingMaterial(): Material;
  12001. /**
  12002. * @en The bounding sphere of the shadow map.
  12003. * @zh 用于计算固定区域阴影 Shadow map 的场景包围球.
  12004. */
  12005. fixedSphere: geometry.Sphere;
  12006. /**
  12007. * @en get or set shadow max received.
  12008. * @zh 阴影接收的最大灯光数量。
  12009. */
  12010. maxReceived: number;
  12011. protected _matLight: math.Mat4;
  12012. protected _material: Material | null;
  12013. protected _instancingMaterial: Material | null;
  12014. protected _enabled: boolean;
  12015. protected _type: number;
  12016. protected _distance: number;
  12017. protected _planeBias: number;
  12018. protected _normal: math.Vec3;
  12019. protected _shadowColor: math.Color;
  12020. protected _size: math.Vec2;
  12021. protected _shadowMapDirty: boolean;
  12022. /**
  12023. * @en Get the shader for the planar shadow with macro patches
  12024. * @zh 通过指定宏获取平面阴影的 Shader 对象
  12025. * @param patches The macro patches for the shader
  12026. * @returns The shader for the planar shadow
  12027. */
  12028. getPlanarShader(patches: Readonly<IMacroPatch[] | null>): gfx.Shader | null;
  12029. initialize(shadowsInfo: ShadowsInfo): void;
  12030. activate(): void;
  12031. protected _updatePlanarInfo(): void;
  12032. destroy(): void;
  12033. }
  12034. /**
  12035. * @zh
  12036. * 全局雾类型。
  12037. * @en
  12038. * The global fog type
  12039. * @static
  12040. * @enum FogInfo.FogType
  12041. */
  12042. export const FogType: {
  12043. /**
  12044. * @zh
  12045. * 线性雾。
  12046. * @en
  12047. * Linear fog
  12048. * @readonly
  12049. */
  12050. LINEAR: number;
  12051. /**
  12052. * @zh
  12053. * 指数雾。
  12054. * @en
  12055. * Exponential fog
  12056. * @readonly
  12057. */
  12058. EXP: number;
  12059. /**
  12060. * @zh
  12061. * 指数平方雾。
  12062. * @en
  12063. * Exponential square fog
  12064. * @readonly
  12065. */
  12066. EXP_SQUARED: number;
  12067. /**
  12068. * @zh
  12069. * 层叠雾。
  12070. * @en
  12071. * Layered fog
  12072. * @readonly
  12073. */
  12074. LAYERED: number;
  12075. };
  12076. export const FOG_TYPE_NONE: number;
  12077. /**
  12078. * @en The fog representation in the render scene.
  12079. * @zh 渲染场景中的全局雾效配置
  12080. */
  12081. export class Fog {
  12082. /**
  12083. * @zh 是否启用全局雾效
  12084. * @en Enable global fog
  12085. */
  12086. set enabled(val: boolean);
  12087. get enabled(): boolean;
  12088. /**
  12089. * @zh 是否启用精确雾效(像素雾)计算
  12090. * @en Enable accurate fog (pixel fog)
  12091. */
  12092. set accurate(val: boolean);
  12093. get accurate(): boolean;
  12094. /**
  12095. * @zh 全局雾颜色
  12096. * @en Global fog color
  12097. */
  12098. set fogColor(val: math.Color);
  12099. get fogColor(): math.Color;
  12100. /**
  12101. * @zh 当前雾化类型。
  12102. * @en The current global fog type.
  12103. * @returns {FogType}
  12104. * Returns the current global fog type
  12105. * - -1:Disable global Fog
  12106. * - 0:Linear fog
  12107. * - 1:Exponential fog
  12108. * - 2:Exponential square fog
  12109. * - 3:Layered fog
  12110. */
  12111. get type(): number;
  12112. set type(val: number);
  12113. /**
  12114. * @zh 全局雾浓度
  12115. * @en Global fog density
  12116. */
  12117. get fogDensity(): number;
  12118. set fogDensity(val: number);
  12119. /**
  12120. * @zh 雾效起始位置,只适用于线性雾
  12121. * @en Global fog start position, only for linear fog
  12122. */
  12123. get fogStart(): number;
  12124. set fogStart(val: number);
  12125. /**
  12126. * @zh 雾效结束位置,只适用于线性雾
  12127. * @en Global fog end position, only for linear fog
  12128. */
  12129. get fogEnd(): number;
  12130. set fogEnd(val: number);
  12131. /**
  12132. * @zh 雾效衰减
  12133. * @en Global fog attenuation
  12134. */
  12135. get fogAtten(): number;
  12136. set fogAtten(val: number);
  12137. /**
  12138. * @zh 雾效顶部范围,只适用于层级雾
  12139. * @en Global fog top range, only for layered fog
  12140. */
  12141. get fogTop(): number;
  12142. set fogTop(val: number);
  12143. /**
  12144. * @zh 雾效范围,只适用于层级雾
  12145. * @en Global fog range, only for layered fog
  12146. */
  12147. get fogRange(): number;
  12148. set fogRange(val: number);
  12149. get colorArray(): Readonly<math.Vec4>;
  12150. protected _fogColor: math.Color;
  12151. protected _colorArray: math.Vec4;
  12152. protected _enabled: boolean;
  12153. protected _accurate: boolean;
  12154. protected _type: number;
  12155. protected _fogDensity: number;
  12156. protected _fogStart: number;
  12157. protected _fogEnd: number;
  12158. protected _fogAtten: number;
  12159. protected _fogTop: number;
  12160. protected _fogRange: number;
  12161. protected _activated: boolean;
  12162. initialize(fogInfo: FogInfo): void;
  12163. activate(): void;
  12164. protected _updatePipeline(): void;
  12165. }
  12166. /**
  12167. * @en The octree culling configuration of the render scene
  12168. * @zh 渲染场景的八叉树剔除配置
  12169. */
  12170. export class Octree {
  12171. /**
  12172. * @en Whether octree culling is enabled in the render scene
  12173. * @zh 是否开启八叉树加速剔除
  12174. */
  12175. set enabled(val: boolean);
  12176. get enabled(): boolean;
  12177. /**
  12178. * @en Minimum position of the scene's bounding box
  12179. * @zh 场景包围盒最小值
  12180. */
  12181. get minPos(): math.Vec3;
  12182. set minPos(val: math.Vec3);
  12183. /**
  12184. * @en Maximum position of the scene's bounding box
  12185. * @zh 场景包围盒最大值
  12186. */
  12187. get maxPos(): math.Vec3;
  12188. set maxPos(val: math.Vec3);
  12189. /**
  12190. * @en The depth of the octree
  12191. * @zh 八叉树深度
  12192. */
  12193. get depth(): number;
  12194. set depth(val: number);
  12195. protected _enabled: boolean;
  12196. protected _minPos: math.Vec3;
  12197. protected _maxPos: math.Vec3;
  12198. protected _depth: number;
  12199. initialize(octreeInfo: OctreeInfo): void;
  12200. }
  12201. /**
  12202. * @en Global skin in the render scene.
  12203. * The initial data is setup in [[SceneGlobals.skip]].
  12204. * @zh 渲染场景中的全局皮肤后处理设置。
  12205. * 初始值是由 [[SceneGlobals.skin]] 设置的。
  12206. */
  12207. export class Skin {
  12208. /**
  12209. * @en Enable skip.
  12210. * @zh 是否开启皮肤后效。
  12211. */
  12212. set enabled(val: boolean);
  12213. get enabled(): boolean;
  12214. /**
  12215. * @en Getter/Setter sampler width.
  12216. * @zh 设置或者获取采样宽度。
  12217. */
  12218. set blurRadius(val: number);
  12219. get blurRadius(): number;
  12220. /**
  12221. * @en Getter/Setter depth unit scale.
  12222. * @zh 设置或者获取深度单位比例。
  12223. */
  12224. set sssIntensity(val: number);
  12225. get sssIntensity(): number;
  12226. protected _enabled: boolean;
  12227. protected _blurRadius: number;
  12228. protected _sssIntensity: number;
  12229. initialize(skinInfo: SkinInfo): void;
  12230. }
  12231. export function ColorTemperatureToRGB(rgb: math.Vec3, kelvin: number): void;
  12232. /**
  12233. * @en The light type enumeration.
  12234. * @zh 光源类型枚举。
  12235. */
  12236. export enum LightType {
  12237. DIRECTIONAL = 0,
  12238. SPHERE = 1,
  12239. SPOT = 2,
  12240. POINT = 3,
  12241. RANGED_DIRECTIONAL = 4,
  12242. UNKNOWN = 5
  12243. }
  12244. export const nt2lm: (size: number) => number;
  12245. /**
  12246. * @en The abstract light class of the render scene
  12247. * @zh 渲染场景中的光源基类
  12248. */
  12249. export class Light {
  12250. /**
  12251. * @en Whether it's a baked light source, baked light will be ignored in real time lighting pass
  12252. * @zh 是否是烘焙光源,烘焙光源会在实时光照计算中被忽略
  12253. */
  12254. get baked(): boolean;
  12255. set baked(val: boolean);
  12256. /**
  12257. * @en The color of the light
  12258. * @zh 光源的颜色
  12259. */
  12260. set color(color: math.Vec3);
  12261. get color(): math.Vec3;
  12262. /**
  12263. * @en Whether to use color temperature
  12264. * @zh 是否使用光源的色温
  12265. */
  12266. set useColorTemperature(enable: boolean);
  12267. get useColorTemperature(): boolean;
  12268. /**
  12269. * @en The color temperature of the light
  12270. * @zh 光源的色温
  12271. */
  12272. set colorTemperature(val: number);
  12273. get colorTemperature(): number;
  12274. /**
  12275. * @en The float RGB value of the color temperature, each channel is from 0 to 1
  12276. * @zh 色温的浮点数颜色值,每个通道都是从 0 到 1
  12277. */
  12278. get colorTemperatureRGB(): math.Vec3;
  12279. get finalColor(): Readonly<math.Vec3>;
  12280. set node(n: Node | null);
  12281. /**
  12282. * @en The node which owns the light source
  12283. * @zh 光源归属的节点
  12284. */
  12285. get node(): Node | null;
  12286. /**
  12287. * @en The type of the light source, e.g. directional light, spot light, etc
  12288. * @zh 光源的类型,比如方向光、聚光灯等
  12289. */
  12290. get type(): LightType;
  12291. /**
  12292. * @en The name of the light source
  12293. * @zh 光源的名字
  12294. */
  12295. get name(): string | null;
  12296. set name(n: string | null);
  12297. /**
  12298. * @en The render scene which owns the current light
  12299. * @zh 光源所属的渲染场景
  12300. */
  12301. get scene(): RenderScene | null;
  12302. protected _baked: boolean;
  12303. protected _color: math.Vec3;
  12304. protected _colorTemp: number;
  12305. protected _colorTempRGB: math.Vec3;
  12306. protected _scene: RenderScene | null;
  12307. protected _node: Node | null;
  12308. protected _name: string | null;
  12309. protected _useColorTemperature: boolean;
  12310. protected _type: LightType;
  12311. protected _visibility: number;
  12312. initialize(): void;
  12313. /**
  12314. * @en Attach the light to a render scene
  12315. * @zh 将光源挂载到渲染场景上
  12316. * @param scene @en The render scene @zh 渲染场景
  12317. */
  12318. attachToScene(scene: RenderScene): void;
  12319. /**
  12320. * @en Detach the light from the render scene
  12321. * @zh 将光源从渲染场景上移除
  12322. */
  12323. detachFromScene(): void;
  12324. destroy(): void;
  12325. update(): void;
  12326. }
  12327. /**
  12328. * @en The directional light representation in the render scene, it acts as the main light source in a scene.
  12329. * As main light, only one directional light can be created in a scene, it can generate realtime shadows with configuration.
  12330. * @zh 渲染场景中的方向光抽象,这是场景中的主光源。作为主光源,每个场景只能有一个方向光,它也包含阴影配置,用来生成实时阴影。
  12331. */
  12332. export class DirectionalLight extends Light {
  12333. protected _dir: math.Vec3;
  12334. protected _illuminanceHDR: number;
  12335. protected _illuminanceLDR: number;
  12336. protected _shadowEnabled: boolean;
  12337. protected _shadowPcf: number;
  12338. protected _shadowBias: number;
  12339. protected _shadowNormalBias: number;
  12340. protected _shadowSaturation: number;
  12341. protected _shadowDistance: number;
  12342. protected _shadowInvisibleOcclusionRange: number;
  12343. protected _csmLevel: number;
  12344. protected _csmNeedUpdate: boolean;
  12345. protected _csmLayerLambda: number;
  12346. protected _csmOptimizationMode: number;
  12347. protected _csmLayersTransition: boolean;
  12348. protected _csmTransitionRange: number;
  12349. protected _shadowFixedArea: boolean;
  12350. protected _shadowNear: number;
  12351. protected _shadowFar: number;
  12352. protected _shadowOrthoSize: number;
  12353. /**
  12354. * @en The direction vector of the light
  12355. * @zh 光源的方向
  12356. */
  12357. set direction(dir: math.Vec3);
  12358. get direction(): math.Vec3;
  12359. /**
  12360. * @en The illuminance of the light in Lux(lx)
  12361. * @zh 光源的辐照度,单位是 Lux(lx)
  12362. */
  12363. get illuminance(): number;
  12364. set illuminance(value: number);
  12365. /**
  12366. * @en The illuminance of the light in HDR mode
  12367. * @zh HDR 模式下光源的辐照度
  12368. */
  12369. get illuminanceHDR(): number;
  12370. set illuminanceHDR(value: number);
  12371. /**
  12372. * @en The illuminance of the light in LDR mode
  12373. * @zh LDR 模式下光源的辐照度
  12374. */
  12375. get illuminanceLDR(): number;
  12376. set illuminanceLDR(value: number);
  12377. /**
  12378. * @en Whether activate shadow
  12379. * @zh 是否启用阴影?
  12380. */
  12381. get shadowEnabled(): boolean;
  12382. set shadowEnabled(val: boolean);
  12383. /**
  12384. * @en get or set shadow pcf.
  12385. * @zh 获取或者设置阴影pcf等级。
  12386. */
  12387. get shadowPcf(): number;
  12388. set shadowPcf(val: number);
  12389. /**
  12390. * @en get or set shadow map sampler offset
  12391. * @zh 获取或者设置阴影纹理偏移值
  12392. */
  12393. get shadowBias(): number;
  12394. set shadowBias(val: number);
  12395. /**
  12396. * @en get or set normal bias.
  12397. * @zh 设置或者获取法线偏移。
  12398. */
  12399. get shadowNormalBias(): number;
  12400. set shadowNormalBias(val: number);
  12401. /**
  12402. * @en Shadow color saturation
  12403. * @zh 阴影颜色饱和度
  12404. */
  12405. get shadowSaturation(): number;
  12406. set shadowSaturation(val: number);
  12407. /**
  12408. * @en get or set shadow camera far
  12409. * @zh 获取或者设置潜在阴影产生的范围
  12410. */
  12411. get shadowDistance(): number;
  12412. set shadowDistance(val: number);
  12413. /**
  12414. * @en get or set shadow camera far
  12415. * @zh 获取或者设置潜在阴影产生的范围
  12416. */
  12417. get shadowInvisibleOcclusionRange(): number;
  12418. set shadowInvisibleOcclusionRange(val: number);
  12419. /**
  12420. * @en get or set shadow CSM level
  12421. * @zh 获取或者设置级联阴影层数
  12422. */
  12423. get csmLevel(): number;
  12424. set csmLevel(val: number);
  12425. /**
  12426. * @en is CSM need update
  12427. * @zh 获取或者设置级联阴影是否需要更新
  12428. */
  12429. get csmNeedUpdate(): boolean;
  12430. set csmNeedUpdate(val: boolean);
  12431. /**
  12432. * @en get or set shadow CSM level ratio
  12433. * @zh 获取或者设置级联阴影层数系数
  12434. */
  12435. get csmLayerLambda(): number;
  12436. set csmLayerLambda(val: number);
  12437. /**
  12438. * @en get or set shadow CSM performance optimization mode
  12439. * @zh 获取或者设置级联阴影性能优化模式
  12440. */
  12441. get csmOptimizationMode(): number;
  12442. set csmOptimizationMode(val: number);
  12443. /**
  12444. * @en get or set fixed area shadow
  12445. * @zh 是否是固定区域阴影
  12446. */
  12447. get shadowFixedArea(): boolean;
  12448. set shadowFixedArea(val: boolean);
  12449. /**
  12450. * @en The near clip plane of the shadow camera
  12451. * @zh 获取或者设置阴影相机近裁剪面
  12452. */
  12453. get shadowNear(): number;
  12454. set shadowNear(val: number);
  12455. /**
  12456. * @en The far clip plane of the shadow camera
  12457. * @zh 获取或者设置阴影相机远裁剪面
  12458. */
  12459. get shadowFar(): number;
  12460. set shadowFar(val: number);
  12461. /**
  12462. * @en get or set shadow camera orthoSize
  12463. * @zh 获取或者设置阴影相机正交大小
  12464. */
  12465. get shadowOrthoSize(): number;
  12466. set shadowOrthoSize(val: number);
  12467. /**
  12468. * @en Enabled csm layers transition
  12469. * @zh 是否启用级联阴影层级过渡?
  12470. */
  12471. get csmLayersTransition(): boolean;
  12472. set csmLayersTransition(val: boolean);
  12473. /**
  12474. * @en get or set csm layers transition range
  12475. * @zh 获取或者设置级联阴影层级过渡范围?
  12476. */
  12477. get csmTransitionRange(): number;
  12478. set csmTransitionRange(val: number);
  12479. constructor();
  12480. initialize(): void;
  12481. /**
  12482. * @en Update the direction
  12483. * @zh 更新方向
  12484. */
  12485. update(): void;
  12486. }
  12487. /**
  12488. * @en The sphere light representation in the render scene, it will light up a spherical area in the scene.
  12489. * It doesn't support shadow generation currently.
  12490. * @zh 渲染场景中的球面光抽象,可以照亮场景中的一个球形区域,目前还不支持生成阴影。
  12491. */
  12492. export class SphereLight extends Light {
  12493. /**
  12494. * @en The world position of the light source
  12495. * @zh 光源中心点的世界坐标
  12496. */
  12497. get position(): math.Vec3;
  12498. /**
  12499. * @en The size of the light source
  12500. * @zh 球面光源的尺寸
  12501. */
  12502. set size(size: number);
  12503. get size(): number;
  12504. /**
  12505. * @en The lighting range of the light source
  12506. * @zh 球面光源的光照范围
  12507. */
  12508. set range(range: number);
  12509. get range(): number;
  12510. /**
  12511. * @en The luminance of the light source
  12512. * @zh 光源的亮度
  12513. */
  12514. get luminance(): number;
  12515. set luminance(value: number);
  12516. /**
  12517. * @en The luminance of the light source in HDR mode
  12518. * @zh HDR 模式下光源的亮度
  12519. */
  12520. get luminanceHDR(): number;
  12521. set luminanceHDR(value: number);
  12522. /**
  12523. * @en The luminance of the light source in LDR mode
  12524. * @zh LDR 模式下光源的亮度
  12525. */
  12526. set luminanceLDR(value: number);
  12527. /**
  12528. * @en The AABB bounding box of the lighting area
  12529. * @zh 受光源影响范围的 AABB 包围盒
  12530. */
  12531. get aabb(): geometry.AABB;
  12532. protected _needUpdate: boolean;
  12533. protected _size: number;
  12534. protected _range: number;
  12535. protected _luminanceHDR: number;
  12536. protected _luminanceLDR: number;
  12537. protected _pos: math.Vec3;
  12538. protected _aabb: geometry.AABB;
  12539. constructor();
  12540. initialize(): void;
  12541. /**
  12542. * @en Update the lighting area
  12543. * @zh 更新光源影响范围
  12544. */
  12545. update(): void;
  12546. }
  12547. /**
  12548. * @en The spot light representation in the render scene, it will light up a cone area in the direction of the light, it supports shadow generation.
  12549. * @zh 渲染场景中的聚光灯抽象,可以照亮光源方向上的一个锥形区域,支持生成阴影。
  12550. */
  12551. export class SpotLight extends Light {
  12552. protected _dir: math.Vec3;
  12553. protected _range: number;
  12554. protected _spotAngle: number;
  12555. protected _angleAttenuationStrength: number;
  12556. protected _pos: math.Vec3;
  12557. protected _aabb: geometry.AABB;
  12558. protected _frustum: geometry.Frustum;
  12559. /**
  12560. * @en User-specified full-angle radians.
  12561. * @zh 用户指定的全角弧度。
  12562. */
  12563. protected _angle: number;
  12564. protected _needUpdate: boolean;
  12565. protected _size: number;
  12566. protected _luminanceHDR: number;
  12567. protected _luminanceLDR: number;
  12568. protected _shadowEnabled: boolean;
  12569. protected _shadowPcf: number;
  12570. protected _shadowBias: number;
  12571. protected _shadowNormalBias: number;
  12572. /**
  12573. * @en The world position of the light source
  12574. * @zh 光源的世界坐标
  12575. */
  12576. get position(): math.Vec3;
  12577. /**
  12578. * @en The size of the spot light source
  12579. * @zh 聚光灯的光源尺寸
  12580. */
  12581. set size(size: number);
  12582. get size(): number;
  12583. /**
  12584. * @en The lighting range of the spot light
  12585. * @zh 聚光灯的光照范围
  12586. */
  12587. set range(range: number);
  12588. get range(): number;
  12589. /**
  12590. * @en The luminance of the light source
  12591. * @zh 光源的亮度
  12592. */
  12593. get luminance(): number;
  12594. set luminance(value: number);
  12595. /**
  12596. * @en The luminance of the light source in HDR mode
  12597. * @zh HDR 模式下光源的亮度
  12598. */
  12599. get luminanceHDR(): number;
  12600. set luminanceHDR(value: number);
  12601. /**
  12602. * @en The luminance of the light source in LDR mode
  12603. * @zh LDR 模式下光源的亮度
  12604. */
  12605. get luminanceLDR(): number;
  12606. set luminanceLDR(value: number);
  12607. /**
  12608. * @en The direction of the spot light
  12609. * @zh 聚光灯的照明方向
  12610. */
  12611. get direction(): math.Vec3;
  12612. /**
  12613. * @en The setter will take the value as the cone angle,
  12614. * but the getter will give you the cosine value of the half cone angle: `cos(angle / 2)`.
  12615. * As the in-consistence is not acceptable for a property, please do not use it.
  12616. * @zh 赋值时这个属性会把输入值当做聚光灯光照区域的锥角,但是获取时返回的是 cos(angle / 2)。
  12617. * 由于这种不一致性,请不要使用这个属性。
  12618. * @internal
  12619. */
  12620. get spotAngle(): number;
  12621. set spotAngle(val: number);
  12622. /**
  12623. * @en The angle attenuation strength of the spot light.
  12624. * The larger the value, the softer the edge, and the smaller the value, the harder the edge.
  12625. * @zh 聚光灯角度衰减强度。值越大,边缘越柔和,值越小,边缘越硬。
  12626. */
  12627. get angleAttenuationStrength(): number;
  12628. set angleAttenuationStrength(val: number);
  12629. /**
  12630. * @en The cone angle of the lighting area
  12631. * @zh 聚光灯锥角
  12632. */
  12633. get angle(): number;
  12634. get aabb(): geometry.AABB;
  12635. /**
  12636. * @en The frustum of the lighting area
  12637. * @zh 受光源影响范围的截椎体
  12638. */
  12639. get frustum(): geometry.Frustum;
  12640. /**
  12641. * @en Whether shadow casting is enabled
  12642. * @zh 是否启用阴影?
  12643. */
  12644. get shadowEnabled(): boolean;
  12645. set shadowEnabled(val: boolean);
  12646. /**
  12647. * @en The pcf level of the shadow generation.
  12648. * @zh 获取或者设置阴影 pcf 等级。
  12649. */
  12650. get shadowPcf(): number;
  12651. set shadowPcf(val: number);
  12652. /**
  12653. * @en The depth offset of shadow to avoid moire pattern artifacts
  12654. * @zh 阴影的深度偏移, 可以减弱跨像素导致的条纹状失真
  12655. */
  12656. get shadowBias(): number;
  12657. set shadowBias(val: number);
  12658. /**
  12659. * @en The normal bias of the shadow map.
  12660. * @zh 设置或者获取法线偏移。
  12661. */
  12662. get shadowNormalBias(): number;
  12663. set shadowNormalBias(val: number);
  12664. constructor();
  12665. initialize(): void;
  12666. update(): void;
  12667. }
  12668. /**
  12669. * @en The point light representation in the render scene, it will light up a spherical area in the scene.
  12670. * It doesn't support shadow generation currently.
  12671. * @zh 渲染场景中的点光抽象,可以照亮场景中的一个球形区域,目前还不支持生成阴影。
  12672. */
  12673. export class PointLight extends Light {
  12674. /**
  12675. * @en The world position of the light source.
  12676. * @zh 光源中心点的世界坐标。
  12677. */
  12678. get position(): Readonly<math.Vec3>;
  12679. /**
  12680. * @en The lighting range of the light source.
  12681. * @zh 点光源的光照范围。
  12682. */
  12683. set range(range: number);
  12684. get range(): number;
  12685. /**
  12686. * @en The luminance of the light source.
  12687. * @zh 光源的亮度。
  12688. */
  12689. get luminance(): number;
  12690. set luminance(value: number);
  12691. /**
  12692. * @en The luminance of the light source in HDR mode.
  12693. * @zh HDR 模式下光源的亮度。
  12694. */
  12695. get luminanceHDR(): number;
  12696. set luminanceHDR(value: number);
  12697. /**
  12698. * @en The luminance of the light source in LDR mode.
  12699. * @zh LDR 模式下光源的亮度。
  12700. */
  12701. set luminanceLDR(value: number);
  12702. /**
  12703. * @en The AABB bounding box of the lighting area.
  12704. * @zh 受光源影响范围的 AABB 包围盒。
  12705. */
  12706. get aabb(): geometry.AABB;
  12707. constructor();
  12708. initialize(): void;
  12709. /**
  12710. * @en Update the lighting area.
  12711. * @zh 更新光源影响范围。
  12712. */
  12713. update(): void;
  12714. }
  12715. /**
  12716. * @en Render the abstraction of light in the scene, which is a ranged directional light source in the scene. Non main light source,
  12717. * each scene is allowed to have multiple ranged directional light sources without shadows.
  12718. * @zh 渲染场景中的光的抽象,这是场景中的范围平行光光源。非主光源,每个场景允许有多个范围平行光光源,不包含阴影。
  12719. */
  12720. export class RangedDirectionalLight extends Light {
  12721. /**
  12722. * @en The direction vector of the light
  12723. * @zh 光源的方向
  12724. */
  12725. get direction(): Readonly<math.Vec3>;
  12726. /**
  12727. * @en The right vector of the light
  12728. * @zh 光源的右方向
  12729. */
  12730. get right(): Readonly<math.Vec3>;
  12731. /**
  12732. * @en The world position of the light source
  12733. * @zh 光源的世界坐标
  12734. */
  12735. get position(): Readonly<math.Vec3>;
  12736. /**
  12737. * @en The world scale of the light source
  12738. * @zh 光源的世界缩放
  12739. */
  12740. get scale(): Readonly<math.Vec3>;
  12741. /**
  12742. * @en The illuminance of the light in Lux(lx)
  12743. * @zh 光源的辐照度,单位是 Lux(lx)
  12744. */
  12745. get illuminance(): number;
  12746. set illuminance(value: number);
  12747. /**
  12748. * @en The illuminance of the light in HDR mode
  12749. * @zh HDR 模式下光源的辐照度
  12750. */
  12751. get illuminanceHDR(): number;
  12752. set illuminanceHDR(value: number);
  12753. /**
  12754. * @en The illuminance of the light in LDR mode
  12755. * @zh LDR 模式下光源的辐照度
  12756. */
  12757. get illuminanceLDR(): number;
  12758. set illuminanceLDR(value: number);
  12759. constructor();
  12760. initialize(): void;
  12761. /**
  12762. * @en Update
  12763. * @zh 更新
  12764. */
  12765. update(): void;
  12766. }
  12767. export enum ProbeClearFlag {
  12768. SKYBOX,
  12769. SOLID_COLOR = 7
  12770. }
  12771. export enum ProbeType {
  12772. CUBE = 0,
  12773. PLANAR = 1
  12774. }
  12775. export class ReflectionProbe {
  12776. bakedCubeTextures: RenderTexture[];
  12777. realtimePlanarTexture: RenderTexture | null;
  12778. protected _resolution: number;
  12779. protected _clearFlag: number;
  12780. protected _backgroundColor: math.Color;
  12781. protected _visibility: number;
  12782. protected _probeType: ProbeType;
  12783. protected _cubemap: TextureCube | null;
  12784. protected readonly _size: math.Vec3;
  12785. /**
  12786. * @en Reflection probe cube pattern preview sphere
  12787. * @zh 反射探针cube模式的预览小球
  12788. */
  12789. protected _previewSphere: Node | null;
  12790. protected _previewPlane: Node | null;
  12791. /**
  12792. * @en Set probe type,cube or planar.
  12793. * @zh 设置探针类型,cube或者planar
  12794. */
  12795. set probeType(value: ProbeType);
  12796. get probeType(): ProbeType;
  12797. get resolution(): number;
  12798. /**
  12799. * @en set render texture size
  12800. * @zh 设置渲染纹理大小
  12801. */
  12802. set resolution(value: number);
  12803. /**
  12804. * @en Clearing flags of the camera, specifies which part of the framebuffer will be actually cleared every frame.
  12805. * @zh 相机的缓冲清除标志位,指定帧缓冲的哪部分要每帧清除。
  12806. */
  12807. set clearFlag(value: number);
  12808. get clearFlag(): number;
  12809. /**
  12810. * @en Clearing color of the camera.
  12811. * @zh 相机的颜色缓冲默认值。
  12812. */
  12813. set backgroundColor(val: math.Color);
  12814. get backgroundColor(): math.Color;
  12815. /**
  12816. * @en Visibility mask, declaring a set of node layers that will be visible to this camera.
  12817. * @zh 可见性掩码,声明在当前相机中可见的节点层级集合。
  12818. */
  12819. get visibility(): number;
  12820. set visibility(val: number);
  12821. /**
  12822. * @en Gets or sets the size of the box, in local space.
  12823. * @zh 获取或设置盒的大小。
  12824. */
  12825. set size(value: math.Vec3);
  12826. get size(): math.Vec3;
  12827. set cubemap(val: TextureCube | null);
  12828. get cubemap(): TextureCube | null;
  12829. /**
  12830. * @en The node of the probe.
  12831. * @zh probe绑定的节点
  12832. */
  12833. get node(): Node;
  12834. get camera(): Camera;
  12835. /**
  12836. * @en Refresh the objects that use this probe.
  12837. * @zh 刷新使用该probe的物体
  12838. */
  12839. set needRefresh(value: boolean);
  12840. get needRefresh(): boolean;
  12841. set needRender(value: boolean);
  12842. get needRender(): boolean;
  12843. get boundingBox(): geometry.AABB | null;
  12844. set cameraNode(node: Node);
  12845. get cameraNode(): Node;
  12846. /**
  12847. * @en Reflection probe planar mode preview plane
  12848. * @zh 反射探针Planar模式的预览平面
  12849. */
  12850. set previewPlane(val: Node);
  12851. get previewPlane(): Node;
  12852. constructor(id: number);
  12853. initialize(node: Node, cameraNode: Node): void;
  12854. initBakedTextures(): void;
  12855. captureCubemap(): void;
  12856. /**
  12857. * @en Render real-time planar reflection textures
  12858. * @zh 渲染实时平面反射贴图
  12859. * @param sourceCamera render planar reflection for this camera
  12860. */
  12861. renderPlanarReflection(sourceCamera: Camera): void;
  12862. switchProbeType(type: ProbeType, sourceCamera: Camera | null): void;
  12863. getProbeId(): number;
  12864. updateProbeId(id: any): void;
  12865. renderArea(): math.Vec2;
  12866. isFinishedRendering(): boolean;
  12867. validate(): boolean;
  12868. destroy(): void;
  12869. enable(): void;
  12870. disable(): void;
  12871. updateCameraDir(faceIdx: number): void;
  12872. updateBoundingBox(): void;
  12873. hasFrameBuffer(framebuffer: gfx.Framebuffer): boolean;
  12874. isRGBE(): boolean;
  12875. }
  12876. export const ToneMappingType: {
  12877. DEFAULT: number;
  12878. LINEAR: number;
  12879. };
  12880. export class PostSettings {
  12881. protected _toneMappingType: number;
  12882. protected _activated: boolean;
  12883. set toneMappingType(val: number);
  12884. get toneMappingType(): number;
  12885. initialize(postSettingsInfo: PostSettingsInfo): void;
  12886. activate(): void;
  12887. protected _updatePipeline(): void;
  12888. }
  12889. }
  12890. export enum RenderQueue {
  12891. OPAQUE = 0,
  12892. TRANSPARENT = 1,
  12893. OVERLAY = 2
  12894. }
  12895. export enum PassStage {
  12896. DEFAULT = 1,
  12897. FORWARD = 2,
  12898. SHADOWCAST = 4
  12899. }
  12900. /**
  12901. * @en Gets the default values for the given type of uniform
  12902. * @zh 根据指定的 Uniform 类型来获取默认值
  12903. * @param type The type of the uniform
  12904. */
  12905. export function getDefaultFromType(type: gfx.Type): readonly number[] | string;
  12906. export function getStringFromType(type: gfx.Type): string;
  12907. /**
  12908. * @en Override the preprocess macros
  12909. * @zh 覆写预处理宏
  12910. * @param target Target preprocess macros to be overridden
  12911. * @param source Preprocess macros used for override
  12912. */
  12913. export function overrideMacros(target: MacroRecord, source: MacroRecord): boolean;
  12914. export const genHandle: (binding: number, type: gfx.Type, count: number, offset?: number) => number;
  12915. export const getTypeFromHandle: (handle: number) => number;
  12916. export const getBindingFromHandle: (handle: number) => number;
  12917. export const getCountFromHandle: (handle: number) => number;
  12918. export const getOffsetFromHandle: (handle: number) => number;
  12919. export const customizeType: (handle: number, type: gfx.Type) => number;
  12920. /**
  12921. * @en Vector type uniforms
  12922. * @zh 向量类型 uniform
  12923. */
  12924. export type MaterialProperty = number | math.Vec2 | math.Vec3 | math.Vec4 | math.Color | math.Mat3 | math.Mat4 | math.Quat;
  12925. export const type2reader: {
  12926. 0: (a: Float32Array, v: number, idx?: number) => void;
  12927. 5: (a: Int32Array, v: number, idx?: number) => number;
  12928. 6: (a: Int32Array, v: math.IVec2Like, idx?: number) => math.IVec2Like;
  12929. 7: (a: Int32Array, v: math.IVec3Like, idx?: number) => math.IVec3Like;
  12930. 8: (a: Int32Array, v: math.IVec4Like, idx?: number) => math.IVec4Like;
  12931. 13: (a: Float32Array, v: number, idx?: number) => number;
  12932. 14: (a: Float32Array, v: math.IVec2Like, idx?: number) => math.IVec2Like;
  12933. 15: (a: Float32Array, v: math.IVec3Like, idx?: number) => math.IVec3Like;
  12934. 16: (a: Float32Array, v: math.IVec4Like, idx?: number) => math.IVec4Like;
  12935. 21: (a: Float32Array, v: math.IMat3Like, idx?: number) => math.IMat3Like;
  12936. 25: (a: Float32Array, v: math.IMat4Like, idx?: number) => math.IMat4Like;
  12937. };
  12938. export const type2writer: {
  12939. 0: (a: Float32Array, v: number, idx?: number) => void;
  12940. 5: (a: Int32Array, v: number, idx?: number) => number;
  12941. 6: (a: Int32Array, v: math.Vec2, idx?: number) => Int32Array;
  12942. 7: (a: Int32Array, v: math.Vec3, idx?: number) => Int32Array;
  12943. 8: (a: Int32Array, v: math.Vec4, idx?: number) => Int32Array;
  12944. 13: (a: Float32Array, v: number, idx?: number) => number;
  12945. 14: (a: Float32Array, v: math.Vec2, idx?: number) => Float32Array;
  12946. 15: (a: Float32Array, v: math.Vec3, idx?: number) => Float32Array;
  12947. 16: (a: Float32Array, v: math.Vec4, idx?: number) => Float32Array;
  12948. 21: (a: Float32Array, v: math.Mat3, idx?: number) => Float32Array;
  12949. 25: (a: Float32Array, v: math.Mat4, idx?: number) => Float32Array;
  12950. };
  12951. export const type2validator: {
  12952. 5: (v: number) => boolean;
  12953. 13: (v: number) => boolean;
  12954. 6: (v: math.Vec2) => boolean;
  12955. 14: (v: math.Vec2) => boolean;
  12956. 7: (v: math.Vec3) => boolean;
  12957. 15: (v: math.Vec3) => boolean;
  12958. 8: (v: math.Vec4) => boolean;
  12959. 16: (v: math.Vec4 | math.Color | math.Quat) => boolean;
  12960. 21: (v: math.Mat3) => boolean;
  12961. 25: (v: math.Mat4) => boolean;
  12962. };
  12963. /**
  12964. * @en Combination of preprocess macros
  12965. * @zh 预处理宏组合
  12966. */
  12967. export type MacroRecord = Record<string, number | boolean | string>;
  12968. export interface IPassInfoFull extends EffectAsset.IPassInfo {
  12969. passIndex: number;
  12970. defines: MacroRecord;
  12971. stateOverrides?: PassOverrides;
  12972. }
  12973. export type PassOverrides = __private.__types_globals__RecursivePartial<EffectAsset.IPassStates>;
  12974. export interface IMacroPatch {
  12975. name: string;
  12976. value: boolean | number | string;
  12977. }
  12978. export enum BatchingSchemes {
  12979. NONE = 0,
  12980. INSTANCING = 1
  12981. }
  12982. /**
  12983. * @en Render pass, store actual resources for the rendering process
  12984. * @zh 渲染 pass,储存实际描述绘制过程的各项资源。
  12985. */
  12986. export class Pass {
  12987. /**
  12988. * @en Get the type of member in uniform buffer object with the handle
  12989. * @zh 根据 handle 获取 uniform 的具体类型。
  12990. */
  12991. static getTypeFromHandle: (handle: number) => number;
  12992. /**
  12993. * @en Get the binding with handle
  12994. * @zh 根据 handle 获取 binding。
  12995. */
  12996. static getBindingFromHandle: (handle: number) => number;
  12997. /**
  12998. * @en Get the array length with handle
  12999. * @zh 根据 handle 获取数组长度。
  13000. */
  13001. static getCountFromHandle: (handle: number) => number;
  13002. protected static getOffsetFromHandle: (handle: number) => number;
  13003. /**
  13004. * @en Fill a pass represented by the given pass handle with the given override info
  13005. * @param hPass The pass handle point to the pass
  13006. * @param info The pass override info
  13007. */
  13008. static fillPipelineInfo(pass: Pass, info: PassOverrides): void;
  13009. /**
  13010. * @en Get pass hash value by [[renderer.Pass]] hash information.
  13011. * @zh 根据 [[renderer.Pass]] 的哈希信息获取哈希值。
  13012. *
  13013. * @param hPass Handle of the pass info used to compute hash value.
  13014. */
  13015. static getPassHash(pass: Pass): number;
  13016. protected _rootBuffer: gfx.Buffer | null;
  13017. protected _buffers: gfx.Buffer[];
  13018. protected _descriptorSet: gfx.DescriptorSet;
  13019. protected _pipelineLayout: gfx.PipelineLayout;
  13020. protected _passIndex: number;
  13021. protected _propertyIndex: number;
  13022. protected _programName: string;
  13023. protected _dynamics: __private._cocos_render_scene_core_pass__IPassDynamics;
  13024. protected _propertyHandleMap: Record<string, number>;
  13025. protected _rootBlock: ArrayBuffer | null;
  13026. protected _blocksInt: Int32Array[];
  13027. protected _blocks: Float32Array[];
  13028. protected _shaderInfo: IProgramInfo;
  13029. protected _defines: MacroRecord;
  13030. protected _properties: Record<string, EffectAsset.IPropertyInfo>;
  13031. protected _shader: gfx.Shader | null;
  13032. protected _bs: gfx.BlendState;
  13033. protected _dss: gfx.DepthStencilState;
  13034. protected _rs: gfx.RasterizerState;
  13035. protected _priority: pipeline.RenderPriority;
  13036. protected _stage: pipeline.RenderPassStage;
  13037. protected _phase: number;
  13038. protected _passID: number;
  13039. protected _subpassID: number;
  13040. protected _phaseID: number;
  13041. protected _primitive: gfx.PrimitiveMode;
  13042. protected _batchingScheme: BatchingSchemes;
  13043. protected _dynamicStates: gfx.DynamicStateFlagBit;
  13044. protected _instancedBuffers: Record<number, InstancedBuffer>;
  13045. protected _hash: number;
  13046. protected _root: Root;
  13047. protected _device: gfx.Device;
  13048. protected _rootBufferDirty: boolean;
  13049. constructor(root: Root);
  13050. /**
  13051. * @en Initialize the pass with given pass info, shader will be compiled in the init process
  13052. * @zh 根据指定参数初始化当前 pass,shader 会在这一阶段就尝试编译。
  13053. */
  13054. initialize(info: IPassInfoFull): void;
  13055. /**
  13056. * @en Get the handle of a UBO member, or specific channels of it.
  13057. * @zh 获取指定 UBO 成员,或其更具体分量的读写句柄。默认以成员自身的类型为目标读写类型(即读写时必须传入与成员类型相同的变量)。
  13058. * @param name Name of the target UBO member.
  13059. * @param offset Channel offset into the member.
  13060. * @param targetType Target type of the handle, i.e. the type of data when read/write to it.
  13061. * @example
  13062. * ```
  13063. * import { Vec3, gfx } from 'cc';
  13064. * // say 'pbrParams' is a uniform vec4
  13065. * const hParams = pass.getHandle('pbrParams'); // get the default handle
  13066. * pass.setUniform(hAlbedo, new Vec3(1, 0, 0)); // wrong! pbrParams.w is NaN now
  13067. *
  13068. * // say 'albedoScale' is a uniform vec4, and we only want to modify the w component in the form of a single float
  13069. * const hThreshold = pass.getHandle('albedoScale', 3, gfx.Type.FLOAT);
  13070. * pass.setUniform(hThreshold, 0.5); // now, albedoScale.w = 0.5
  13071. * ```
  13072. */
  13073. getHandle(name: string, offset?: number, targetType?: gfx.Type): number;
  13074. /**
  13075. * @en Gets the uniform binding with its name
  13076. * @zh 获取指定 uniform 的 binding。
  13077. * @param name The name of target uniform
  13078. */
  13079. getBinding(name: string): number;
  13080. /**
  13081. * @en Sets a vector type uniform value, if a uniform requires frequent update, please use this method.
  13082. * @zh 设置指定普通向量类 uniform 的值,如果需要频繁更新请尽量使用此接口。
  13083. * @param handle The handle for the target uniform
  13084. * @param value New value
  13085. */
  13086. setUniform(handle: number, value: MaterialProperty): void;
  13087. /**
  13088. * @en Gets a uniform's value.
  13089. * @zh 获取指定普通向量类 uniform 的值。
  13090. * @param handle The handle for the target uniform
  13091. * @param out The output property to store the result
  13092. */
  13093. getUniform<T extends MaterialProperty>(handle: number, out: T): T;
  13094. /**
  13095. * @en Sets an array type uniform value, if a uniform requires frequent update, please use this method.
  13096. * @zh 设置指定数组类 uniform 的值,如果需要频繁更新请尽量使用此接口。
  13097. * @param handle The handle for the target uniform
  13098. * @param value New value
  13099. */
  13100. setUniformArray(handle: number, value: MaterialProperty[]): void;
  13101. /**
  13102. * @en Bind a GFX [[gfx.Texture]] the the given uniform binding
  13103. * @zh 绑定实际 GFX [[gfx.Texture]] 到指定 binding。
  13104. * @param binding The binding for target uniform of texture type
  13105. * @param value Target texture
  13106. */
  13107. bindTexture(binding: number, value: gfx.Texture, index?: number): void;
  13108. /**
  13109. * @en Bind a GFX [[gfx.Sampler]] the the given uniform binding
  13110. * @zh 绑定实际 GFX [[gfx.Sampler]] 到指定 binding。
  13111. * @param binding The binding for target uniform of sampler type
  13112. * @param value Target sampler
  13113. */
  13114. bindSampler(binding: number, value: gfx.Sampler, index?: number): void;
  13115. /**
  13116. * @en Sets the dynamic pipeline state property at runtime
  13117. * @zh 设置运行时 pass 内可动态更新的管线状态属性。
  13118. * @param state Target dynamic state
  13119. * @param value Target value
  13120. */
  13121. setDynamicState(state: gfx.DynamicStateFlagBit, value: number): void;
  13122. /**
  13123. * @en Override all pipeline states with the given pass override info.
  13124. * @zh 重载当前所有管线状态。
  13125. * @param original The original pass info
  13126. * @param value The override pipeline state info
  13127. */
  13128. overridePipelineStates(original: EffectAsset.IPassInfo, overrides: PassOverrides): void;
  13129. /**
  13130. * @en Update the current uniforms data.
  13131. * @zh 更新当前 Uniform 数据。
  13132. */
  13133. update(): void;
  13134. getInstancedBuffer(extraKey?: number): InstancedBuffer;
  13135. /**
  13136. * @en Destroy the current pass.
  13137. * @zh 销毁当前 pass。
  13138. */
  13139. destroy(): void;
  13140. /**
  13141. * @en Resets the value of the given uniform by name to the default value in [[EffectAsset]].
  13142. * This method does not support array type uniform.
  13143. * @zh 重置指定(非数组) Uniform 为 [[EffectAsset]] 默认值。
  13144. */
  13145. resetUniform(name: string): void;
  13146. /**
  13147. * @en Resets the value of the given texture by name to the default value in [[EffectAsset]].
  13148. * @zh 重置指定贴图为 [[EffectAsset]] 默认值。
  13149. */
  13150. resetTexture(name: string, index?: number): void;
  13151. /**
  13152. * @en Resets all uniform buffer objects to the default values in [[EffectAsset]]
  13153. * @zh 重置所有 UBO 为默认值。
  13154. */
  13155. resetUBOs(): void;
  13156. /**
  13157. * @en Resets all textures and samplers to the default values in [[EffectAsset]]
  13158. * @zh 重置所有 texture 和 sampler 为初始默认值。
  13159. */
  13160. resetTextures(): void;
  13161. /**
  13162. * @en Try to compile the shader and retrieve related resources references.
  13163. * @zh 尝试编译 shader 并获取相关资源引用。
  13164. */
  13165. tryCompile(): boolean;
  13166. /**
  13167. * @en Gets the shader variant of the current pass and given macro patches
  13168. * @zh 结合指定的编译宏组合获取当前 Pass 的 Shader Variant
  13169. * @param patches The macro patches
  13170. */
  13171. getShaderVariant(patches?: Readonly<IMacroPatch[] | null>): gfx.Shader | null;
  13172. protected get _isBlend(): boolean;
  13173. /**
  13174. * @private
  13175. */
  13176. beginChangeStatesSilently(): void;
  13177. /**
  13178. * @private
  13179. */
  13180. endChangeStatesSilently(): void;
  13181. protected _doInit(info: IPassInfoFull, copyDefines?: boolean): void;
  13182. protected _syncBatchingScheme(): void;
  13183. get root(): Root;
  13184. get device(): gfx.Device;
  13185. get shaderInfo(): IProgramInfo;
  13186. get localSetLayout(): gfx.DescriptorSetLayout;
  13187. get program(): string;
  13188. get properties(): Record<string, EffectAsset.IPropertyInfo>;
  13189. get defines(): Record<string, string | number | boolean>;
  13190. get passIndex(): number;
  13191. get propertyIndex(): number;
  13192. get dynamics(): __private._cocos_render_scene_core_pass__IPassDynamics;
  13193. get blocks(): Float32Array[];
  13194. get blocksInt(): Int32Array[];
  13195. get rootBufferDirty(): boolean;
  13196. get priority(): pipeline.RenderPriority;
  13197. get primitive(): gfx.PrimitiveMode;
  13198. get stage(): pipeline.RenderPassStage;
  13199. get phase(): number;
  13200. get passID(): number;
  13201. get phaseID(): number;
  13202. get rasterizerState(): gfx.RasterizerState;
  13203. get depthStencilState(): gfx.DepthStencilState;
  13204. get blendState(): gfx.BlendState;
  13205. get dynamicStates(): gfx.DynamicStateFlags;
  13206. get batchingScheme(): BatchingSchemes;
  13207. get descriptorSet(): gfx.DescriptorSet;
  13208. get hash(): number;
  13209. get pipelineLayout(): gfx.PipelineLayout;
  13210. }
  13211. export namespace Pass {
  13212. export type getTypeFromHandle = typeof Pass.getTypeFromHandle;
  13213. export type getBindingFromHandle = typeof Pass.getBindingFromHandle;
  13214. export type fillPipelineInfo = typeof Pass.fillPipelineInfo;
  13215. export type getPassHash = typeof Pass.getPassHash;
  13216. export type getCountFromHandle = typeof Pass.getCountFromHandle;
  13217. }
  13218. export function nearestPOT(num: number): number;
  13219. export interface ITextureBuffer {
  13220. texture: gfx.Texture;
  13221. size: number;
  13222. start: number;
  13223. end: number;
  13224. }
  13225. export interface ITextureBufferHandle {
  13226. chunkIdx: number;
  13227. start: number;
  13228. end: number;
  13229. texture: gfx.Texture;
  13230. }
  13231. export interface ITextureBufferPoolInfo {
  13232. format: gfx.Format;
  13233. inOrderFree?: boolean;
  13234. alignment?: number;
  13235. roundUpFn?: (size: number, formatSize: number) => number;
  13236. }
  13237. export class TextureBufferPool {
  13238. constructor(device: gfx.Device);
  13239. initialize(info: ITextureBufferPoolInfo): void;
  13240. destroy(): void;
  13241. alloc(size: number, chunkIdx?: number): ITextureBufferHandle;
  13242. free(handle: ITextureBufferHandle): void;
  13243. createChunk(length: number): number;
  13244. update(handle: ITextureBufferHandle, buffer: ArrayBuffer): void;
  13245. }
  13246. export interface IMaterialInstanceInfo {
  13247. parent: Material;
  13248. owner?: Renderer;
  13249. subModelIdx?: number;
  13250. }
  13251. /**
  13252. * @zh
  13253. * 材质实例,当有材质修改需求时,根据材质资源创建的,可任意定制的实例。
  13254. */
  13255. export class MaterialInstance extends Material {
  13256. get parent(): Material;
  13257. get owner(): Renderer | null;
  13258. protected _passes: PassInstance[];
  13259. constructor(info: IMaterialInstanceInfo);
  13260. recompileShaders(overrides: MacroRecord, passIdx?: number): void;
  13261. overridePipelineStates(overrides: PassOverrides, passIdx?: number): void;
  13262. destroy(): boolean;
  13263. onPassStateChange(dontNotify: boolean): void;
  13264. protected _createPasses(): PassInstance[];
  13265. }
  13266. /**
  13267. * @en A pass instance defines an variant version of the [[renderer.Pass]]
  13268. * @zh 表示 [[renderer.Pass]] 的一种特殊实例
  13269. */
  13270. export class PassInstance extends Pass {
  13271. /**
  13272. * @en The parent pass
  13273. * @zh 相关联的原始 Pass
  13274. */
  13275. get parent(): Pass;
  13276. constructor(parent: Pass, owner: MaterialInstance);
  13277. /**
  13278. * @en Override pipeline states with the given pass override info.
  13279. * This won't affect the original pass
  13280. * @zh 重载当前 Pass 的管线状态。这不会影响原始 Pass
  13281. * @param original The original pass info
  13282. * @param value The override pipeline state info
  13283. */
  13284. overridePipelineStates(original: EffectAsset.IPassInfo, overrides: PassOverrides): void;
  13285. tryCompile(defineOverrides?: MacroRecord): boolean;
  13286. /**
  13287. * @en Prepare to change states of the pass and do not notify the material to rebuild the pipeline state object
  13288. * @zh 开始静默修改 Pass 相关状态,不会通知材质去重新构建管线状态对象。
  13289. */
  13290. beginChangeStatesSilently(): void;
  13291. /**
  13292. * @en End the silent states changing process, all state changes will be notified.
  13293. * @zh 结束静默状态修改,所有修改将会开始通知材质。
  13294. */
  13295. endChangeStatesSilently(): void;
  13296. protected _syncBatchingScheme(): void;
  13297. protected _onStateChange(): void;
  13298. }
  13299. export enum PoolType {
  13300. NODE = 0,
  13301. PASS = 1,
  13302. AABB = 2,
  13303. RENDER2D = 3
  13304. }
  13305. export const NULL_HANDLE: __private._cocos_render_scene_core_memory_pools__IHandle<any>;
  13306. export type Render2dHandle = __private._cocos_render_scene_core_memory_pools__IHandle<PoolType.RENDER2D>;
  13307. export enum Render2dView {
  13308. POSITION = 0,
  13309. UV = 3,
  13310. COLOR = 5,
  13311. COUNT = 9
  13312. }
  13313. export const Render2dPool: __private._cocos_render_scene_core_memory_pools__BufferPool<PoolType.RENDER2D, typeof Render2dView>;
  13314. export type NodeHandle = __private._cocos_render_scene_core_memory_pools__IHandle<PoolType.NODE>;
  13315. export enum NodeView {
  13316. DIRTY_FLAG = 0,
  13317. LAYER = 1,
  13318. WORLD_SCALE = 2,
  13319. WORLD_POSITION = 5,
  13320. WORLD_ROTATION = 8,
  13321. WORLD_MATRIX = 12,
  13322. LOCAL_SCALE = 28,
  13323. LOCAL_POSITION = 31,
  13324. LOCAL_ROTATION = 34,
  13325. COUNT = 38
  13326. }
  13327. export const NodePool: __private._cocos_render_scene_core_memory_pools__BufferPool<PoolType.NODE, typeof NodeView>;
  13328. export type PassHandle = __private._cocos_render_scene_core_memory_pools__IHandle<PoolType.PASS>;
  13329. export enum PassView {
  13330. PRIORITY = 0,
  13331. STAGE = 1,
  13332. PHASE = 2,
  13333. PRIMITIVE = 3,
  13334. BATCHING_SCHEME = 4,
  13335. DYNAMIC_STATE = 5,
  13336. HASH = 6,
  13337. COUNT = 7
  13338. }
  13339. export const PassPool: __private._cocos_render_scene_core_memory_pools__BufferPool<PoolType.PASS, typeof PassView>;
  13340. export type AABBHandle = __private._cocos_render_scene_core_memory_pools__IHandle<PoolType.AABB>;
  13341. export enum AABBView {
  13342. CENTER = 0,
  13343. HALFEXTENTS = 3,
  13344. COUNT = 6
  13345. }
  13346. export const AABBPool: __private._cocos_render_scene_core_memory_pools__BufferPool<PoolType.AABB, typeof AABBView>;
  13347. export interface IRenderSceneInfo {
  13348. name: string;
  13349. }
  13350. export interface ISceneNodeInfo {
  13351. name: string;
  13352. isStatic?: boolean;
  13353. }
  13354. /**
  13355. * @en The result of one raycast operation
  13356. * @zh 一次射线检测的结果
  13357. */
  13358. export interface IRaycastResult {
  13359. node: Node;
  13360. distance: number;
  13361. }
  13362. /**
  13363. * @en The render scene which is created by the [[Root]] and provides all basic render scene elements for the render process.
  13364. * It manages:
  13365. * 1. [[Camera]]s
  13366. * 2. [[Light]]s
  13367. * 3. Renderable objects: [[renderer.Model]]s and `DrawBatchs`
  13368. * @zh 渲染场景,由 [[Root]] 创建,并提供用于渲染流程的所有场景基础元素。它管理:
  13369. * 1. [[Camera]]s:相机
  13370. * 2. [[Light]]s:光源
  13371. * 3. 渲染元素:[[renderer.Model]]s 和 `DrawBatchs`
  13372. */
  13373. export class RenderScene {
  13374. /**
  13375. * @en The root manager of the renderer.
  13376. * @zh 基础渲染管理器。
  13377. */
  13378. get root(): Root;
  13379. /**
  13380. * @en The name of the render scene.
  13381. * @zh 渲染场景的名称。
  13382. */
  13383. get name(): string;
  13384. /**
  13385. * @en All cameras of the render scene.
  13386. * @zh 渲染场景管理的所有相机。
  13387. */
  13388. get cameras(): scene.Camera[];
  13389. /**
  13390. * @en The main directional light source of the render scene.
  13391. * @zh 渲染场景管理的主方向光源。
  13392. */
  13393. get mainLight(): scene.DirectionalLight | null;
  13394. /**
  13395. * @en All sphere light sources of the render scene.
  13396. * @zh 渲染场景管理的所有球面光源。
  13397. */
  13398. get sphereLights(): Readonly<scene.SphereLight[]>;
  13399. /**
  13400. * @en All spot light sources of the render scene.
  13401. * @zh 渲染场景管理的所有聚光灯光源。
  13402. */
  13403. get spotLights(): Readonly<scene.SpotLight[]>;
  13404. /**
  13405. * @en All point light sources of the render scene.
  13406. * @zh 渲染场景管理的所有点光源。
  13407. */
  13408. get pointLights(): Readonly<scene.PointLight[]>;
  13409. /**
  13410. * @en All ranged directional light sources of the render scene.
  13411. * @zh 渲染场景管理的所有范围平行光光源。
  13412. */
  13413. get rangedDirLights(): Readonly<scene.RangedDirectionalLight[]>;
  13414. /**
  13415. * @en All active models of the render scene.
  13416. * @zh 渲染场景管理的所有模型。
  13417. */
  13418. get models(): scene.Model[];
  13419. /**
  13420. * @en All active 2d draw batches of the render scene.
  13421. * @zh 渲染场景管理的所有 2D 渲染批次对象。
  13422. */
  13423. get batches(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D[];
  13424. /**
  13425. * Register the creation function of the render scene to root.
  13426. * @internal
  13427. */
  13428. static registerCreateFunc(root: Root): void;
  13429. constructor(root: Root);
  13430. /**
  13431. * @en Initialize the render scene
  13432. * @zh 初始化渲染场景
  13433. * @returns Successful
  13434. */
  13435. initialize(info: IRenderSceneInfo): boolean;
  13436. /**
  13437. * @en The update process of the render scene, it updates all rendering related data for the lights and the models.
  13438. * @zh 渲染场景的更新流程,会更新所有光源和模型的渲染相关数据。
  13439. * @param stamp The update time stamp
  13440. * @returns void
  13441. */
  13442. update(stamp: number): void;
  13443. /**
  13444. * @en Destroy the render scene, dangerous, please do not invoke manually.
  13445. * @zh 销毁渲染场景,请不要手动销毁,会造成未知行为。
  13446. */
  13447. destroy(): void;
  13448. isCulledByLod(camera: scene.Camera, model: scene.Model): boolean;
  13449. /**
  13450. * @en Attach a camera to the render scene
  13451. * @zh 向渲染场景挂载一个相机
  13452. */
  13453. addCamera(cam: scene.Camera): void;
  13454. /**
  13455. * @en Detach a camera to the render scene
  13456. * @zh 从渲染场景移除一个相机
  13457. */
  13458. removeCamera(camera: scene.Camera): void;
  13459. /**
  13460. * @en Detach all cameras to the render scene
  13461. * @zh 从渲染场景移除所有相机
  13462. */
  13463. removeCameras(): void;
  13464. /**
  13465. * @en Sets the main light source for the render scene
  13466. * @zh 给渲染场景设置主光源
  13467. * @param dl The main directional light source
  13468. */
  13469. setMainLight(dl: scene.DirectionalLight | null): void;
  13470. /**
  13471. * @en Remove the main light source from the render scene
  13472. * @zh 从渲染场景移除主光源
  13473. * @param dl The main directional light source, if it's not the actual main light, nothing happens.
  13474. */
  13475. unsetMainLight(dl: scene.DirectionalLight): void;
  13476. /**
  13477. * @en Add a directional light source, only one directional light is active and act as the main light source.
  13478. * @zh 增加一个方向光源,场景中只会有一个方向光是起效的,并且会作为主光源。
  13479. * @param dl The directional light.
  13480. */
  13481. addDirectionalLight(dl: scene.DirectionalLight): void;
  13482. /**
  13483. * @en Remove a directional light source.
  13484. * @zh 删除一个方向光源。
  13485. * @param dl The directional light.
  13486. */
  13487. removeDirectionalLight(dl: scene.DirectionalLight): void;
  13488. /**
  13489. * @en Add a sphere light source.
  13490. * @zh 增加一个球面光源。
  13491. * @param pl The sphere light.
  13492. */
  13493. addSphereLight(pl: scene.SphereLight): void;
  13494. /**
  13495. * @en Remove a sphere light source.
  13496. * @zh 删除一个球面光源。
  13497. * @param pl The sphere light.
  13498. */
  13499. removeSphereLight(pl: scene.SphereLight): void;
  13500. /**
  13501. * @en Add a spot light source.
  13502. * @zh 增加一个聚光灯光源。
  13503. * @param sl The spot light.
  13504. */
  13505. addSpotLight(sl: scene.SpotLight): void;
  13506. /**
  13507. * @en Remove a spot light source.
  13508. * @zh 删除一个聚光灯光源。
  13509. * @param sl The spot light.
  13510. */
  13511. removeSpotLight(sl: scene.SpotLight): void;
  13512. /**
  13513. * @en Remove all sphere light sources.
  13514. * @zh 删除所有球面光源。
  13515. */
  13516. removeSphereLights(): void;
  13517. /**
  13518. * @en Remove all spot light sources.
  13519. * @zh 删除所有聚光灯光源。
  13520. */
  13521. removeSpotLights(): void;
  13522. /**
  13523. * @en Add a point light source.
  13524. * @zh 增加一个点光源。
  13525. * @param pl @en The point light. @zh 点光源。
  13526. */
  13527. addPointLight(pl: scene.PointLight): void;
  13528. /**
  13529. * @en Remove a sphere light source.
  13530. * @zh 删除一个点光源。
  13531. * @param pl @en The point light. @zh 点光源。
  13532. */
  13533. removePointLight(pl: scene.PointLight): void;
  13534. /**
  13535. * @en Remove all point light sources.
  13536. * @zh 删除所有点光源。
  13537. */
  13538. removePointLights(): void;
  13539. /**
  13540. * @en Add a ranged directional light source.
  13541. * @zh 增加一个范围平行光源。
  13542. * @param l @en The ranged directional light. @zh 范围平行光。
  13543. */
  13544. addRangedDirLight(l: scene.RangedDirectionalLight): void;
  13545. /**
  13546. * @en Remove a ranged directional light source.
  13547. * @zh 删除一个范围平行光源。
  13548. * @param l @en The ranged directional light. @zh 范围平行光。
  13549. */
  13550. removeRangedDirLight(l: scene.RangedDirectionalLight): void;
  13551. /**
  13552. * @en Remove all ranged directional light sources.
  13553. * @zh 删除所有范围平行光源。
  13554. */
  13555. removeRangedDirLights(): void;
  13556. /**
  13557. * @en Add a model, all models attached to the render scene will be submitted for rendering.
  13558. * @zh 增加一个模型,渲染场景上挂载的所有模型都会被提交渲染。
  13559. * @param m The model.
  13560. */
  13561. addModel(m: scene.Model): void;
  13562. /**
  13563. * @en Remove a model, model removed will no longer be submitted for rendering.
  13564. * @zh 删除一个模型,移除的模型将不再被提交渲染。
  13565. * @param m The model.
  13566. */
  13567. removeModel(model: scene.Model): void;
  13568. /**
  13569. * @en Remove all models.
  13570. * @zh 删除所有模型。
  13571. */
  13572. removeModels(): void;
  13573. /**
  13574. * @en Add a draw batch of 2d objects, all draw batches attached to the render scene will be submitted for rendering.
  13575. * @zh 增加一个 2D 渲染批次,渲染场景上挂载的所有 2D 渲染批次都会被提交渲染。
  13576. * @param batch The draw batch.
  13577. * @internal
  13578. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  13579. */
  13580. addBatch(batch: __private._cocos_2d_renderer_draw_batch__DrawBatch2D): void;
  13581. /**
  13582. * @en Remove a draw batch of 2d objects, draw batch removed will no longer be submitted for rendering.
  13583. * @zh 删除一个 2D 渲染批次,移除的 2D 渲染批次将不再被提交渲染。
  13584. * @param batch The draw batch.
  13585. * @internal
  13586. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  13587. */
  13588. removeBatch(batch: __private._cocos_2d_renderer_draw_batch__DrawBatch2D): void;
  13589. /**
  13590. * @en Remove all 2d draw batches.
  13591. * @zh 删除所有 2D 渲染批次。
  13592. * @internal
  13593. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  13594. */
  13595. removeBatches(): void;
  13596. /**
  13597. * @en Notify all models that the global pipeline state have been updated so that they can update their render data and states.
  13598. * @zh 通知所有模型全局管线状态已更新,需要更新自身状态。
  13599. */
  13600. onGlobalPipelineStateChanged(): void;
  13601. /**
  13602. * @en Generate a new model id.
  13603. * @zh 生成一个新的模型 ID
  13604. * @returns The model id
  13605. */
  13606. generateModelId(): number;
  13607. }
  13608. export const CameraVisFlags: {};
  13609. export const VisibilityFlags: {};
  13610. }
  13611. export type Constructor<T = unknown> = __private.__types_globals__Constructor<T>;
  13612. export namespace math {
  13613. export namespace bits {
  13614. /**
  13615. * @en Returns -1, 0, +1 depending on sign of x.
  13616. * @zh 根据x的符号返回 -1,0,+1。
  13617. */
  13618. export function sign(v: number): number;
  13619. /**
  13620. * @en Computes absolute value of integer.
  13621. * @zh 计算整数的绝对值。
  13622. */
  13623. export function abs(v: number): number;
  13624. /**
  13625. * @en Computes minimum of integers x and y.
  13626. * @zh 计算整数x和y中的最小值。
  13627. */
  13628. export function min(x: number, y: number): number;
  13629. /**
  13630. * @en Computes maximum of integers x and y.
  13631. * @zh 计算整数x和y中的最大值。
  13632. */
  13633. export function max(x: number, y: number): number;
  13634. /**
  13635. * @en Checks if a number is a power of two.
  13636. * @zh 检查一个数字是否是2的幂。
  13637. */
  13638. export function isPow2(v: number): boolean;
  13639. /**
  13640. * @en Computes log base 2 of v.
  13641. * @zh 计算以 2 为底的 v 的对数。
  13642. */
  13643. export function log2(v: number): number;
  13644. /**
  13645. * @en Computes log base 10 of v.
  13646. * @zh 计算以 10 为底的 v 的对数。
  13647. */
  13648. export function log10(v: number): number;
  13649. /**
  13650. * @en Counts number of bits.
  13651. * @zh 计算传入数字二进制表示中 1 的数量。
  13652. */
  13653. export function popCount(v: number): number;
  13654. /**
  13655. * @en Counts number of trailing zeros.
  13656. * @zh 计算传入数字二进制表示尾随零的数量。
  13657. */
  13658. export function countTrailingZeros(v: number): number;
  13659. /**
  13660. * @en Rounds to next power of 2.
  13661. * @zh 计算大于等于v的最小的二的整数次幂的数字。
  13662. */
  13663. export function nextPow2(v: number): number;
  13664. /**
  13665. * @en Rounds down to previous power of 2.
  13666. * @zh 计算小于等于v的最小的二的整数次幂的数字。
  13667. */
  13668. export function prevPow2(v: number): number;
  13669. /**
  13670. * @en Computes parity of word.
  13671. * @zh 奇偶校验。
  13672. */
  13673. export function parity(v: number): number;
  13674. /**
  13675. * @en Reverse bits in a 32 bit word.
  13676. * @zh 翻转 32 位二进制数字。
  13677. */
  13678. export function reverse(v: number): number;
  13679. /**
  13680. * @en Interleave bits of 2 coordinates with 16 bits. Useful for fast quadtree codes.
  13681. * @zh 将两个 16 位数字按位交错编码。有利于在快速四叉树中使用。
  13682. */
  13683. export function interleave2(x: number, y: number): number;
  13684. /**
  13685. * @en Extracts the nth interleaved component.
  13686. * @zh 提取第 n 个交错分量。
  13687. */
  13688. export function deinterleave2(v: number, n: number): number;
  13689. /**
  13690. * @en Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes.
  13691. * @zh 将三个数字按位交错编码,每个数字占十位。有利于在八叉树中使用。
  13692. */
  13693. export function interleave3(x: number, y: number, z: number): number;
  13694. /**
  13695. * @en Extracts nth interleaved component of a 3-tuple.
  13696. * @zh 提取三个数字中的第n个交错分量。
  13697. */
  13698. export function deinterleave3(v: number, n: number): number;
  13699. /**
  13700. * @en Compute the lexicographically next bit permutation
  13701. * @zh 计算下一组字典序的比特排列
  13702. */
  13703. export function nextCombination(v: number): number;
  13704. /**
  13705. * Bit twiddling hacks for JavaScript.
  13706. *
  13707. * Author: Mikola Lysenko
  13708. *
  13709. * Ported from Stanford bit twiddling hack library:
  13710. * http://graphics.stanford.edu/~seander/bithacks.html
  13711. */
  13712. /**
  13713. * @en
  13714. * Number of bits in an integer
  13715. * @zh
  13716. * 整型类型的 bit 数
  13717. */
  13718. export const INT_BITS = 32;
  13719. /**
  13720. * @en
  13721. * The maximal signed integer number
  13722. * @zh
  13723. * 最大有符号整型数
  13724. */
  13725. export const INT_MAX = 2147483647;
  13726. /**
  13727. * @en
  13728. * The minimal signed integer number
  13729. * @zh
  13730. * 最小有符号整型数
  13731. */
  13732. export const INT_MIN: number;
  13733. }
  13734. /**
  13735. * @en Representation of 2D vectors and points.
  13736. * @zh 二维向量。
  13737. */
  13738. export class Vec2 extends ValueType {
  13739. static ZERO: Readonly<Vec2>;
  13740. static ONE: Readonly<Vec2>;
  13741. static NEG_ONE: Readonly<Vec2>;
  13742. static UNIT_X: Readonly<Vec2>;
  13743. static UNIT_Y: Readonly<Vec2>;
  13744. /**
  13745. * @en Obtains a clone of the given vector object
  13746. * @zh 获得指定向量的拷贝
  13747. */
  13748. static clone<Out extends IVec2Like>(a: Out): Vec2;
  13749. /**
  13750. * @en Copy the target vector and save the results to out vector object
  13751. * @zh 复制目标向量
  13752. */
  13753. static copy<Out extends IVec2Like>(out: Out, a: Out): Out;
  13754. /**
  13755. * @en Sets the out vector with the given x and y values
  13756. * @zh 设置向量值
  13757. */
  13758. static set<Out extends IVec2Like>(out: Out, x: number, y: number): Out;
  13759. /**
  13760. * @en Element-wise vector addition and save the results to out vector object
  13761. * @zh 逐元素向量加法
  13762. */
  13763. static add<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13764. /**
  13765. * @en Element-wise vector subtraction and save the results to out vector object
  13766. * @zh 逐元素向量减法
  13767. */
  13768. static subtract<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13769. /**
  13770. * @en Element-wise vector multiplication and save the results to out vector object
  13771. * @zh 逐元素向量乘法
  13772. */
  13773. static multiply<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13774. /**
  13775. * @en Element-wise vector division and save the results to out vector object
  13776. * @zh 逐元素向量除法
  13777. */
  13778. static divide<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13779. /**
  13780. * @en Rounds up by elements of the vector and save the results to out vector object
  13781. * @zh 逐元素向量向上取整
  13782. */
  13783. static ceil<Out extends IVec2Like>(out: Out, a: Out): Out;
  13784. /**
  13785. * @en Element-wise rounds down of the current vector and save the results to the out vector
  13786. * @zh 逐元素向量向下取整
  13787. */
  13788. static floor<Out extends IVec2Like>(out: Out, a: Out): Out;
  13789. /**
  13790. * @en Calculates element-wise minimum values and save to the out vector
  13791. * @zh 逐元素向量最小值
  13792. */
  13793. static min<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13794. /**
  13795. * @en Calculates element-wise maximum values and save to the out vector
  13796. * @zh 逐元素向量最大值
  13797. */
  13798. static max<Out extends IVec2Like>(out: Out, a: Out, b: Out): Out;
  13799. /**
  13800. * @en Calculates element-wise round results and save to the out vector
  13801. * @zh 逐元素向量四舍五入取整
  13802. */
  13803. static round<Out extends IVec2Like>(out: Out, a: Out): Out;
  13804. /**
  13805. * @en Vector scalar multiplication and save the results to out vector object
  13806. * @zh 向量标量乘法
  13807. */
  13808. static multiplyScalar<Out extends IVec2Like>(out: Out, a: Out, b: number): Out;
  13809. /**
  13810. * @en Element-wise multiplication and addition with the equation: a + b * scale
  13811. * @zh 逐元素向量乘加: A + B * scale
  13812. */
  13813. static scaleAndAdd<Out extends IVec2Like>(out: Out, a: Out, b: Out, scale: number): Out;
  13814. /**
  13815. * @en Calculates the euclidean distance of two vectors
  13816. * @zh 求两向量的欧氏距离
  13817. */
  13818. static distance<Out extends IVec2Like>(a: Out, b: Out): number;
  13819. /**
  13820. * @en Calculates the squared euclidean distance of two vectors
  13821. * @zh 求两向量的欧氏距离平方
  13822. */
  13823. static squaredDistance<Out extends IVec2Like>(a: Out, b: Out): number;
  13824. /**
  13825. * @en Calculates the length of the vector
  13826. * @zh 求向量长度
  13827. */
  13828. static len<Out extends IVec2Like>(a: Out): number;
  13829. /**
  13830. * @en Calculates the squared length of the vector
  13831. * @zh 求向量长度平方
  13832. */
  13833. static lengthSqr<Out extends IVec2Like>(a: Out): number;
  13834. /**
  13835. * @en Sets each element to its negative value
  13836. * @zh 逐元素向量取负
  13837. */
  13838. static negate<Out extends IVec2Like>(out: Out, a: Out): Out;
  13839. /**
  13840. * @en Sets each element to its inverse value, zero value will become Infinity
  13841. * @zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13842. */
  13843. static inverse<Out extends IVec2Like>(out: Out, a: Out): Out;
  13844. /**
  13845. * @en Sets each element to its inverse value, zero value will remain zero
  13846. * @zh 逐元素向量取倒数,接近 0 时返回 0
  13847. */
  13848. static inverseSafe<Out extends IVec2Like>(out: Out, a: Out): Out;
  13849. /**
  13850. * @en Sets the normalized vector to the out vector, returns a zero vector if input is a zero vector.
  13851. * @zh 归一化向量,输入零向量将会返回零向量。
  13852. */
  13853. static normalize<Out extends IVec2Like, Vec2Like extends IVec2Like>(out: Out, a: Vec2Like): Out;
  13854. /**
  13855. * @en Calculates the dot product of the vector
  13856. * @zh 向量点积(数量积)
  13857. */
  13858. static dot<Out extends IVec2Like>(a: Out, b: Out): number;
  13859. /**
  13860. * @en Calculates the cross product of the vector
  13861. * @zh 向量叉积(向量积),注意二维向量的叉积为与 Z 轴平行的三维向量
  13862. * @override (a:Vec2, b:Vec2) => number
  13863. * @override [deprecated] (out:Vec3, a:Vec2, b:Vec2) => Vec3
  13864. */
  13865. static cross(a: IVec2Like, b: IVec2Like): number;
  13866. /**
  13867. * @deprecated Consider use another overrides please.
  13868. */
  13869. static cross<Out extends IVec2Like>(out: Vec3, a: Out, b: Out): Vec3;
  13870. /**
  13871. * @en Calculates the linear interpolation between two vectors with a given ratio: A + t * (B - A)
  13872. * @zh 逐元素向量线性插值: A + t * (B - A)
  13873. */
  13874. static lerp<Out extends IVec2Like>(out: Out, a: Out, b: Out, t: number): Out;
  13875. /**
  13876. * @en Generates a uniformly distributed random vector points from center to the surface of the unit sphere
  13877. * @zh 生成一个在单位圆上均匀分布的随机向量
  13878. * @param scale vector length
  13879. */
  13880. static random<Out extends IVec2Like>(out: Out, scale?: number): Out;
  13881. /**
  13882. * @en Vector and third order matrix multiplication, will complete the vector with a third value as one
  13883. * @zh 向量与三维矩阵乘法,默认向量第三位为 1。
  13884. */
  13885. static transformMat3<Out extends IVec2Like, MatLike extends IMat3Like>(out: Out, a: Out, m: IMat3Like): Out;
  13886. /**
  13887. * @en Vector and third order matrix multiplication, will complete the vector with a third and a fourth element as one
  13888. * @zh 向量与四维矩阵乘法,默认向量第三位为 0,第四位为 1。
  13889. */
  13890. static transformMat4<Out extends IVec2Like, MatLike extends IMat4Like>(out: Out, a: Out, m: IMat4Like): Out;
  13891. /**
  13892. * @en Gets the string representation of the given vector
  13893. * @zh 返回向量的字符串表示
  13894. */
  13895. static str<Out extends IVec2Like>(a: Out): string;
  13896. /**
  13897. * @en Converts the given vector to an array
  13898. * @zh 向量转数组
  13899. * @param ofs Array Start Offset
  13900. */
  13901. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, v: IVec2Like, ofs?: number): Out;
  13902. /**
  13903. * @en Converts the given array to a vector
  13904. * @zh 数组转向量
  13905. * @param ofs Array Start Offset
  13906. */
  13907. static fromArray<Out extends IVec2Like>(out: Out, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): Out;
  13908. /**
  13909. * @en Check the equality of the two given vectors
  13910. * @zh 向量等价判断
  13911. */
  13912. static strictEquals<Out extends IVec2Like>(a: Out, b: Out): boolean;
  13913. /**
  13914. * @en Check whether the two given vectors are approximately equivalent
  13915. * @zh 排除浮点数误差的向量近似等价判断
  13916. */
  13917. static equals<Out extends IVec2Like>(a: Out, b: Out, epsilon?: number): boolean;
  13918. /**
  13919. * @en Calculates the radian angle between two vectors, returns zero if either vector is a zero vector.
  13920. * @zh 求两向量夹角弧度,任意一个向量是零向量则返回零。
  13921. */
  13922. static angle<Out extends IVec2Like>(a: Out, b: Out): number;
  13923. /**
  13924. * @en x component.
  13925. * @zh x 分量。
  13926. */
  13927. x: number;
  13928. /**
  13929. * @en y component.
  13930. * @zh y 分量。
  13931. */
  13932. y: number;
  13933. constructor(other: Vec2);
  13934. constructor(x?: number, y?: number);
  13935. /**
  13936. * @en clone a Vec2 value
  13937. * @zh 克隆当前向量。
  13938. */
  13939. clone(): Vec2;
  13940. /**
  13941. * @en Set the current vector value with the given vector.
  13942. * @zh 设置当前向量使其与指定向量相等。
  13943. * @param other Specified vector
  13944. * @return `this`
  13945. */
  13946. set(other: Vec2): Vec2;
  13947. /**
  13948. * @en Set the value of each component of the current vector.
  13949. * @zh 设置当前向量的具体分量值。
  13950. * @param x x value
  13951. * @param y y value
  13952. * @return `this`
  13953. */
  13954. set(x?: number, y?: number): Vec2;
  13955. /**
  13956. * @en Check whether the vector approximately equals another one.
  13957. * @zh 判断当前向量是否在误差范围内与指定向量相等。
  13958. * @param other Specified vector
  13959. * @param epsilon The error allowed. It`s should be a non-negative number.
  13960. * @return Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  13961. */
  13962. equals(other: Vec2, epsilon?: number): boolean;
  13963. /**
  13964. * @en Check whether the vector approximately equals another one.
  13965. * @zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  13966. * @param x The x value of specified vector
  13967. * @param y The y value of specified vector
  13968. * @param epsilon The error allowed. It`s should be a non-negative number.
  13969. * @return Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  13970. */
  13971. equals2f(x: number, y: number, epsilon?: number): boolean;
  13972. /**
  13973. * @en Check whether the current vector strictly equals another Vec2.
  13974. * @zh 判断当前向量是否与指定向量相等。
  13975. * @param other specified vector
  13976. * @return Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  13977. */
  13978. strictEquals(other: Vec2): boolean;
  13979. /**
  13980. * @en Check whether the current vector strictly equals another Vec2.
  13981. * @zh 判断当前向量是否与指定分量的向量相等。
  13982. * @param x The x value of specified vector
  13983. * @param y The y value of specified vector
  13984. * @return Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  13985. */
  13986. strictEquals2f(x: number, y: number): boolean;
  13987. /**
  13988. * @en Transform to string with vector information.
  13989. * @zh 返回当前向量的字符串表示。
  13990. * @returns The string with vector information
  13991. */
  13992. toString(): string;
  13993. /**
  13994. * @en Calculate linear interpolation result between this vector and another one with given ratio.
  13995. * @zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  13996. * @param to Target vector
  13997. * @param ratio The interpolation coefficient.The range is [0,1].
  13998. */
  13999. lerp(to: Vec2, ratio: number): Vec2;
  14000. /**
  14001. * @en Clamp the vector between minInclusive and maxInclusive.
  14002. * @zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  14003. * @param minInclusive Minimum value allowed
  14004. * @param maxInclusive Maximum value allowed
  14005. * @return `this`
  14006. */
  14007. clampf(minInclusive: Vec2, maxInclusive: Vec2): Vec2;
  14008. /**
  14009. * @en Adds the current vector with another one and return this
  14010. * @zh 向量加法。将当前向量与指定向量的相加
  14011. * @param other specified vector
  14012. */
  14013. add(other: Vec2): Vec2;
  14014. /**
  14015. * @en Adds the current vector with another one and return this
  14016. * @zh 向量加法。将当前向量与指定分量的向量相加
  14017. * @param x The x value of specified vector
  14018. * @param y The y value of specified vector
  14019. */
  14020. add2f(x: number, y: number): Vec2;
  14021. /**
  14022. * @en Subtracts one vector from this, and returns this.
  14023. * @zh 向量减法。将当前向量减去指定向量
  14024. * @param other specified vector
  14025. */
  14026. subtract(other: Vec2): Vec2;
  14027. /**
  14028. * @en Subtracts one vector from this, and returns this.
  14029. * @zh 向量减法。将当前向量减去指定分量的向量
  14030. * @param x The x value of specified vector
  14031. * @param y The y value of specified vector
  14032. */
  14033. subtract2f(x: number, y: number): Vec2;
  14034. /**
  14035. * @en Multiplies the current vector with a number, and returns this.
  14036. * @zh 向量数乘。将当前向量数乘指定标量
  14037. * @param scalar scalar number
  14038. */
  14039. multiplyScalar(scalar: number): Vec2;
  14040. /**
  14041. * @en Multiplies the current vector with another one and return this
  14042. * @zh 向量乘法。将当前向量乘以与指定向量的结果赋值给当前向量。
  14043. * @param other specified vector
  14044. */
  14045. multiply(other: Vec2): Vec2;
  14046. /**
  14047. * @en Multiplies the current vector with another one and return this
  14048. * @zh 向量乘法。将当前向量与指定分量的向量相乘的结果赋值给当前向量。
  14049. * @param x The x value of specified vector
  14050. * @param y The y value of specified vector
  14051. */
  14052. multiply2f(x: number, y: number): Vec2;
  14053. /**
  14054. * @en Element-wisely divides this vector with another one, and return this.
  14055. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  14056. * @param other specified vector
  14057. */
  14058. divide(other: Vec2): Vec2;
  14059. /**
  14060. * @en Element-wisely divides this vector with another one, and return this.
  14061. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  14062. * @param x The x value of specified vector
  14063. * @param y The y value of specified vector
  14064. */
  14065. divide2f(x: number, y: number): Vec2;
  14066. /**
  14067. * @en Sets each component of this vector with its negative value
  14068. * @zh 将当前向量的各个分量取反
  14069. */
  14070. negative(): Vec2;
  14071. /**
  14072. * @en Calculates the dot product with another vector
  14073. * @zh 向量点乘。
  14074. * @param other specified vector
  14075. * @return The result of calculates the dot product with another vector
  14076. */
  14077. dot(other: Vec2): number;
  14078. /**
  14079. * @en Calculates the cross product with another vector.
  14080. * @zh 向量叉乘。
  14081. * @param other specified vector
  14082. * @return `out`
  14083. */
  14084. cross(other: Vec2): number;
  14085. /**
  14086. * @en Returns the length of this vector.
  14087. * @zh 计算向量的长度(模)。
  14088. * @return Length of vector
  14089. */
  14090. length(): number;
  14091. /**
  14092. * @en Returns the squared length of this vector.
  14093. * @zh 计算向量长度(模)的平方。
  14094. * @return the squared length of this vector
  14095. */
  14096. lengthSqr(): number;
  14097. /**
  14098. * @en Normalize the current vector.
  14099. * @zh 将当前向量归一化。
  14100. */
  14101. normalize(): Vec2;
  14102. /**
  14103. * @en Calculates radian angle between two vectors, returns zero if either vector is a zero vector.
  14104. * @zh 获取当前向量和指定向量之间的弧度,任意一个向量是零向量则返回零。
  14105. * @param other specified vector.
  14106. * @return The angle between the current vector and the specified vector.
  14107. */
  14108. angle(other: Vec2): number;
  14109. /**
  14110. * @en Get angle in radian between this and vector with direction.
  14111. * @zh 获取当前向量和指定向量之间的有符号弧度。<br/>
  14112. * 有符号弧度的取值范围为 (-PI, PI],当前向量可以通过逆时针旋转有符号角度与指定向量同向。<br/>
  14113. * @param other specified vector
  14114. * @return The signed angle between the current vector and the specified vector (in radians);
  14115. * if there is a zero vector in the current vector and the specified vector, 0 is returned.
  14116. */
  14117. signAngle(other: Vec2): number;
  14118. /**
  14119. * @en Rotates the current vector by an angle in radian value. Counterclockwise is the positive direction.
  14120. * @zh 将当前向量进行旋转,逆时针为正方向。
  14121. * @param radians radians of rotation.
  14122. */
  14123. rotate(radians: number): Vec2;
  14124. /**
  14125. * @en Projects the current vector on another one
  14126. * @zh 计算当前向量在指定向量上的投影向量。
  14127. * @param other specified vector
  14128. */
  14129. project(other: Vec2): Vec2;
  14130. /**
  14131. * @en Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  14132. * @zh 将当前向量视为 z 分量为 0、w 分量为 1 的四维向量,<br/>
  14133. * 应用四维矩阵变换到当前矩阵<br/>
  14134. * @param matrix matrix to transform with
  14135. */
  14136. transformMat4(matrix: Mat4): Vec2;
  14137. }
  14138. export function v2(other: Vec2): Vec2;
  14139. export function v2(x?: number, y?: number): Vec2;
  14140. /**
  14141. * @en Representation of 3D vectors and points.
  14142. * @zh 三维向量。
  14143. */
  14144. export class Vec3 extends ValueType {
  14145. static UNIT_X: Readonly<Vec3>;
  14146. static UNIT_Y: Readonly<Vec3>;
  14147. static UNIT_Z: Readonly<Vec3>;
  14148. static RIGHT: Readonly<Vec3>;
  14149. static UP: Readonly<Vec3>;
  14150. static FORWARD: Readonly<Vec3>;
  14151. static ZERO: Readonly<Vec3>;
  14152. static ONE: Readonly<Vec3>;
  14153. static NEG_ONE: Readonly<Vec3>;
  14154. /**
  14155. * @en return a Vec3 object with x = 0, y = 0, z = 0.
  14156. * @zh 将目标赋值为零向量
  14157. */
  14158. static zero<Out extends IVec3Like>(out: Out): Out;
  14159. /**
  14160. * @en Obtains a clone of the given vector object
  14161. * @zh 获得指定向量的拷贝
  14162. */
  14163. static clone<Out extends IVec3Like>(a: Out): Vec3;
  14164. /**
  14165. * @en Copy the target vector and save the results to out vector object
  14166. * @zh 复制目标向量
  14167. */
  14168. static copy<Out extends IVec3Like, Vec3Like extends IVec3Like>(out: Out, a: Vec3Like): Out;
  14169. /**
  14170. * @en Sets the out vector with the given x, y and z values
  14171. * @zh 设置向量值
  14172. */
  14173. static set<Out extends IVec3Like>(out: Out, x: number, y: number, z: number): Out;
  14174. /**
  14175. * @en Element-wise vector addition and save the results to out vector object
  14176. * @zh 逐元素向量加法
  14177. */
  14178. static add<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14179. /**
  14180. * @en Element-wise vector subtraction and save the results to out vector object
  14181. * @zh 逐元素向量减法
  14182. */
  14183. static subtract<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14184. /**
  14185. * @en Element-wise vector multiplication and save the results to out vector object
  14186. * @zh 逐元素向量乘法 (分量积)
  14187. */
  14188. static multiply<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14189. /**
  14190. * @en Element-wise vector division and save the results to out vector object
  14191. * @zh 逐元素向量除法
  14192. */
  14193. static divide<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14194. /**
  14195. * @en Rounds up by elements of the vector and save the results to out vector object
  14196. * @zh 逐元素向量向上取整
  14197. */
  14198. static ceil<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14199. /**
  14200. * @en Element-wise rounds down of the current vector and save the results to the out vector
  14201. * @zh 逐元素向量向下取整
  14202. */
  14203. static floor<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14204. /**
  14205. * @en Calculates element-wise minimum values and save to the out vector
  14206. * @zh 逐元素向量最小值
  14207. */
  14208. static min<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14209. /**
  14210. * @en Calculates element-wise maximum values and save to the out vector
  14211. * @zh 逐元素向量最大值
  14212. */
  14213. static max<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14214. /**
  14215. * @en Calculates element-wise round results and save to the out vector
  14216. * @zh 逐元素向量四舍五入取整
  14217. */
  14218. static round<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14219. /**
  14220. * @en Vector scalar multiplication and save the results to out vector object
  14221. * @zh 向量标量乘法
  14222. */
  14223. static multiplyScalar<Out extends IVec3Like, Vec3Like extends IVec3Like>(out: Out, a: Vec3Like, b: number): Out;
  14224. /**
  14225. * @en Element-wise multiplication and addition with the equation: a + b * scale
  14226. * @zh 逐元素向量乘加: A + B * scale
  14227. */
  14228. static scaleAndAdd<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like, scale: number): Out;
  14229. /**
  14230. * @en Calculates the euclidean distance of two vectors
  14231. * @zh 求两向量的欧氏距离
  14232. */
  14233. static distance(a: IVec3Like, b: IVec3Like): number;
  14234. /**
  14235. * @en Calculates the squared euclidean distance of two vectors
  14236. * @zh 求两向量的欧氏距离平方
  14237. */
  14238. static squaredDistance(a: IVec3Like, b: IVec3Like): number;
  14239. /**
  14240. * @en Calculates the length of the vector
  14241. * @zh 求向量长度
  14242. */
  14243. static len(a: IVec3Like): number;
  14244. /**
  14245. * @en Calculates the squared length of the vector
  14246. * @zh 求向量长度平方
  14247. */
  14248. static lengthSqr(a: IVec3Like): number;
  14249. /**
  14250. * @en Sets each element to its negative value
  14251. * @zh 逐元素向量取负
  14252. */
  14253. static negate<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14254. /**
  14255. * @en Sets each element to its inverse value, zero value will become Infinity
  14256. * @zh 逐元素向量取倒数,接近 0 时返回 Infinity
  14257. */
  14258. static invert<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14259. /**
  14260. * @en Sets each element to its inverse value, zero value will remain zero
  14261. * @zh 逐元素向量取倒数,接近 0 时返回 0
  14262. */
  14263. static invertSafe<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14264. /**
  14265. * @en Sets the normalized vector to the out vector, returns a zero vector if input is a zero vector.
  14266. * @zh 归一化向量,输入零向量将会返回零向量。
  14267. */
  14268. static normalize<Out extends IVec3Like>(out: Out, a: IVec3Like): Out;
  14269. /**
  14270. * @en Calculates the dot product of the vector
  14271. * @zh 向量点积(数量积)
  14272. */
  14273. static dot<Out extends IVec3Like>(a: Out, b: IVec3Like): number;
  14274. /**
  14275. * @en Calculates the cross product of the vector
  14276. * @zh 向量叉积(向量积)
  14277. */
  14278. static cross<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14279. /**
  14280. * @en Calculates the linear interpolation between two vectors with a given ratio: A + t * (B - A)
  14281. * @zh 逐元素向量线性插值: A + t * (B - A)
  14282. */
  14283. static lerp<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like, t: number): Out;
  14284. /**
  14285. * @zh 球面线性插值。多用于插值两个方向向量。
  14286. * @en Spherical linear interpolation. Commonly used in interpolation between directional vectors.
  14287. * @param out @zh 输出向量。 @en Output vector.
  14288. * @param from @zh 起点向量。 @en Start vector.
  14289. * @param to @zh 终点向量。 @en Destination vector.
  14290. * @param t @zh 插值参数。@en Interpolation parameter.
  14291. * @returns `out`
  14292. * @description
  14293. * @zh
  14294. * - 如果 `from`、`to` 中任何一个接近零向量,则结果就是 `from` 到 `to` 线性插值的结果;
  14295. *
  14296. * - 否则,如果 `from`、`to` 方向刚好接近相反,
  14297. * 则结果向量是满足以下条件的一个向量:结果向量和两个输入向量的夹角之比是 `t`,其长度是 `from` 到 `to` 的长度线性插值的结果;
  14298. *
  14299. * - 否则,结果是从标准化后的 `from` 到 标准化后的 `to`
  14300. * 进行球面线性插值的结果乘以 `from` 到 `to` 的长度线性插值后的长度。
  14301. * @en
  14302. * - If either `from` or `to` is close to zero vector,
  14303. * the result would be the (non-spherical) linear interpolation result from `from` to `to`.
  14304. *
  14305. * - Otherwise, if `from` and `to` have almost opposite directions,
  14306. * the result would be such a vector so that:
  14307. * The angle ratio between result vector and input vectors is `t`,
  14308. * the length of result vector is the linear interpolation of lengths from `from` to `to`.
  14309. *
  14310. * - Otherwise, the result would be the spherical linear interpolation result
  14311. * from normalized `from` to normalized `to`,
  14312. * then scaled by linear interpolation of lengths from `from` to `to`.
  14313. */
  14314. static slerp: <Out extends IVec3Like>(out: Out, from: Readonly<IVec3Like>, to: Readonly<IVec3Like>, t: number) => Out;
  14315. /**
  14316. * @en Generates a uniformly distributed random vector points from center to the surface of the unit sphere
  14317. * @zh 生成一个在单位球体上均匀分布的随机向量
  14318. * @param scale vector length
  14319. */
  14320. static random<Out extends IVec3Like>(out: Out, scale?: number): Out;
  14321. /**
  14322. * @en Vector and fourth order matrix multiplication, will complete the vector with a fourth value as one
  14323. * @zh 向量与四维矩阵乘法,默认向量第四位为 1。
  14324. */
  14325. static transformMat4<Out extends IVec3Like>(out: Out, a: IVec3Like, m: IMat4Like): Out;
  14326. /**
  14327. * @en Vector and fourth order matrix multiplication, will complete the vector with a fourth element as one
  14328. * @zh 向量与四维矩阵乘法,默认向量第四位为 0。
  14329. */
  14330. static transformMat4Normal<Out extends IVec3Like>(out: Out, a: IVec3Like, m: IMat4Like): Out;
  14331. /**
  14332. * @en Vector and third order matrix multiplication
  14333. * @zh 向量与三维矩阵乘法
  14334. */
  14335. static transformMat3<Out extends IVec3Like>(out: Out, a: IVec3Like, m: IMat3Like): Out;
  14336. /**
  14337. * @en Affine transformation vector
  14338. * @zh 向量仿射变换
  14339. */
  14340. static transformAffine<Out extends IVec3Like>(out: Out, v: IVec3Like, m: IMat4Like): Out;
  14341. /**
  14342. * @en Vector quaternion multiplication: q*a*q^{-1}.
  14343. * @zh 向量四元数乘法:q*a*q^{-1}。
  14344. */
  14345. static transformQuat<Out extends IVec3Like>(out: Out, a: IVec3Like, q: IQuatLike): Out;
  14346. /**
  14347. * @en Transforms the current vector with given scale, rotation and translation in order
  14348. * @zh 以缩放 -> 旋转 -> 平移顺序变换向量
  14349. */
  14350. static transformRTS<Out extends IVec3Like>(out: Out, a: IVec3Like, r: IQuatLike, t: IVec3Like, s: IVec3Like): Out;
  14351. /**
  14352. * @en Transforms the current vector with given scale, rotation and translation in reverse order
  14353. * @zh 以平移 -> 旋转 -> 缩放顺序逆变换向量
  14354. */
  14355. static transformInverseRTS<Out extends IVec3Like>(out: Out, a: IVec3Like, r: IQuatLike, t: IVec3Like, s: IVec3Like): Out;
  14356. /**
  14357. * @en Rotates the vector with specified angle around X axis
  14358. * @zh 绕 X 轴旋转向量指定弧度
  14359. * @param v rotation vector
  14360. * @param o center of rotation
  14361. * @param a radiance of rotation
  14362. */
  14363. static rotateX<Out extends IVec3Like>(out: Out, v: IVec3Like, o: IVec3Like, a: number): Out;
  14364. /**
  14365. * @en Rotates the vector with specified angle around Y axis
  14366. * @zh 绕 Y 轴旋转向量指定弧度
  14367. * @param v rotation vector
  14368. * @param o center of rotation
  14369. * @param a radiance of rotation
  14370. */
  14371. static rotateY<Out extends IVec3Like>(out: Out, v: IVec3Like, o: IVec3Like, a: number): Out;
  14372. /**
  14373. * @en Rotates the vector with specified angle around Z axis
  14374. * @zh 绕 Z 轴旋转向量指定弧度
  14375. * @param v rotation vector
  14376. * @param o center of rotation
  14377. * @param a radiance of rotation
  14378. */
  14379. static rotateZ<Out extends IVec3Like>(out: Out, v: IVec3Like, o: IVec3Like, a: number): Out;
  14380. /**
  14381. * @en Rotates the vector with specified angle around any n axis
  14382. * @zh 绕任意 n 轴旋转向量指定弧度
  14383. * @param v rotation vector
  14384. * @param o center of rotation
  14385. * @param n axis of rotation
  14386. * @param a radiance of rotation
  14387. */
  14388. static rotateN<Out extends IVec3Like>(out: Out, v: IVec3Like, o: IVec3Like, n: IVec3Like, a: number): Out;
  14389. /**
  14390. * @en Converts the given vector to an array
  14391. * @zh 向量转数组
  14392. * @param ofs Array Start Offset
  14393. */
  14394. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, v: IVec3Like, ofs?: number): Out;
  14395. /**
  14396. * @en Converts the given array to a vector
  14397. * @zh 数组转向量
  14398. * @param ofs Array Start Offset
  14399. */
  14400. static fromArray<Out extends IVec3Like>(out: Out, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): Out;
  14401. /**
  14402. * @en Check the equality of the two given vectors
  14403. * @zh 向量等价判断
  14404. */
  14405. static strictEquals(a: IVec3Like, b: IVec3Like): boolean;
  14406. /**
  14407. * @en Check whether the two given vectors are approximately equivalent
  14408. * @zh 排除浮点数误差的向量近似等价判断
  14409. */
  14410. static equals(a: IVec3Like, b: IVec3Like, epsilon?: number): boolean;
  14411. /**
  14412. * @en Calculates the radian angle between two vectors
  14413. * @zh 求两向量夹角弧度
  14414. */
  14415. static angle(a: IVec3Like, b: IVec3Like): number;
  14416. /**
  14417. * @zh 计算 `a`、`b` 两向量之间的有符号夹角。
  14418. *
  14419. * 不妨假设 `a`、`b` 是钟表上的两根指针,其中 `a` 指向 12 点整,`normal` 是任何从钟表正面指出的向量。
  14420. * 当 `b` **逆时针** 从 12 点走到 6 点的过程中,它们的角度变化范围为 (0°, 180°);
  14421. * 当 `b` **顺时针** 从 12 点走到 6 点的过程中,它们的角度变化范围为 (0°, -180°)。
  14422. *
  14423. * 反之,如果 `normal` 是任何从钟表反面指出的向量,两种范围将对调。
  14424. *
  14425. * @en Calculates the signed angle between the two vectors `a`, `b`.
  14426. *
  14427. * Suppose that `a` and `b` are two hands on a clock, where pointing at 12 o'clock,
  14428. * and `normal` is arbitrary vector pointing out from the dial side of the clock.
  14429. * As `b` goes counterclockwise from 12 o'clock to 6 o'clock, their angle varies in the range (0°, 180°);
  14430. * As `b` goes clockwise from 12 o'clock to 6 o'clock, their angle varies in the range (0°, -180°).
  14431. *
  14432. * Instead, if `normal` is arbitrary vector pointing out from the opposite side of the clock,
  14433. * the two ranges would swap.
  14434. *
  14435. * @param a @zh 向量 `a`。 @en The vector `a`.
  14436. * @param b @zh 向量 `b`。 @en The vector `b`.
  14437. * @param normal @zh 参考向量。 @en The reference vector.
  14438. * @returns @zh 向量 `a` 和 `b` 之间的有符号夹角。 @en The signed angle between `a`, `b`.
  14439. */
  14440. static signedAngle: (a: Readonly<IVec3Like>, b: Readonly<IVec3Like>, normal: Readonly<IVec3Like>) => number;
  14441. /**
  14442. * @en Calculates the projection vector on the specified plane
  14443. * @zh 计算向量在指定平面上的投影
  14444. * @param a projection vector
  14445. * @param n the normal line of specified plane
  14446. */
  14447. static projectOnPlane<Out extends IVec3Like>(out: Out, a: IVec3Like, n: IVec3Like): Out;
  14448. /**
  14449. * @en Calculates the projection on the specified vector
  14450. * @zh 计算向量在指定向量上的投影
  14451. * @param a projection vector
  14452. * @param b target vector
  14453. */
  14454. static project<Out extends IVec3Like>(out: Out, a: IVec3Like, b: IVec3Like): Out;
  14455. /**
  14456. * @en Calculates a new position from current to target no more than `maxStep` distance.
  14457. * @zh 计算一个新位置从当前位置移动不超过 `maxStep` 距离到目标位置。
  14458. * @param current current position
  14459. * @param target target position
  14460. * @param maxStep maximum moving distance
  14461. */
  14462. static moveTowards<Out extends IVec3Like>(out: Out, current: IVec3Like, target: IVec3Like, maxStep: number): Out;
  14463. /**
  14464. * @zh 生成指定向量的一个正交单位向量。如果指定的向量 **精确地** 是零向量,则返回 **精确的** 零向量。
  14465. * @en Generates an unit vector orthogonal to specified vector.
  14466. * If the specified vector is **strictly** zero vector, the result is **strict** zero vector.
  14467. * @param out @zh 生成的向量。@en The generated vector.
  14468. * @param n @zh 输入向量。该向量 **不必** 是标准化的。 @en The input vector. **Need not** to be normalized.
  14469. * @returns `out`
  14470. */
  14471. static generateOrthogonal<Out extends IVec3Like>(out: Out, n: Readonly<IVec3Like>): Out;
  14472. /**
  14473. * @en x component.
  14474. * @zh x 分量。
  14475. */
  14476. x: number;
  14477. /**
  14478. * @en y component.
  14479. * @zh y 分量。
  14480. */
  14481. y: number;
  14482. /**
  14483. * @en z component.
  14484. * @zh z 分量。
  14485. */
  14486. z: number;
  14487. constructor(v: Vec3);
  14488. constructor(x?: number, y?: number, z?: number);
  14489. /**
  14490. * @en clone a Vec3 value
  14491. * @zh 克隆当前向量。
  14492. */
  14493. clone(): Vec3;
  14494. /**
  14495. * @en Set the current vector value with the given vector.
  14496. * @zh 设置当前向量使其与指定向量相等。
  14497. * @param other Specified vector
  14498. * @returns `this`
  14499. */
  14500. set(other: Vec3): Vec3;
  14501. /**
  14502. * @en Set the value of each component of the current vector.
  14503. * @zh 设置当前向量的具体分量值。
  14504. * @param x x value
  14505. * @param y y value
  14506. * @param z z value
  14507. * @returns `this`
  14508. */
  14509. set(x?: number, y?: number, z?: number): Vec3;
  14510. /**
  14511. * @en Check whether the vector approximately equals another one.
  14512. * @zh 判断当前向量是否在误差范围内与指定向量相等。
  14513. * @param other Specified vector
  14514. * @param epsilon The error allowed. It`s should be a non-negative number.
  14515. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14516. */
  14517. equals(other: Vec3, epsilon?: number): boolean;
  14518. /**
  14519. * @en Check whether the vector approximately equals another one.
  14520. * @zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  14521. * @param x The x value of specified vector
  14522. * @param y The y value of specified vector
  14523. * @param z The z value of specified vector
  14524. * @param epsilon The error allowed. It`s should be a non-negative number.
  14525. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14526. */
  14527. equals3f(x: number, y: number, z: number, epsilon?: number): boolean;
  14528. /**
  14529. * @en Check whether the current vector strictly equals another Vec3.
  14530. * @zh 判断当前向量是否与指定向量相等。
  14531. * @param other specified vector
  14532. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14533. */
  14534. strictEquals(other: Vec3): boolean;
  14535. /**
  14536. * @en Check whether the current vector strictly equals another Vec3.
  14537. * @zh 判断当前向量是否与指定分量的向量相等。
  14538. * @param x The x value of specified vector
  14539. * @param y The y value of specified vector
  14540. * @param z The z value of specified vector
  14541. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14542. */
  14543. strictEquals3f(x: number, y: number, z: number): boolean;
  14544. /**
  14545. * @en Transform to string with vector information.
  14546. * @zh 返回当前向量的字符串表示。
  14547. * @returns The string with vector information
  14548. */
  14549. toString(): string;
  14550. /**
  14551. * @en Calculate linear interpolation result between this vector and another one with given ratio.
  14552. * @zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  14553. * @param to Target vector
  14554. * @param ratio The interpolation coefficient.The range is [0,1].
  14555. */
  14556. lerp(to: Vec3, ratio: number): Vec3;
  14557. /**
  14558. * @en Adds the current vector with another one and return this
  14559. * @zh 向量加法。将当前向量与指定向量的相加
  14560. * @param other specified vector
  14561. */
  14562. add(other: Vec3): Vec3;
  14563. /**
  14564. * @en Adds the current vector with another one and return this
  14565. * @zh 向量加法。将当前向量与指定分量的向量相加
  14566. * @param x The x value of specified vector
  14567. * @param y The y value of specified vector
  14568. * @param z The z value of specified vector
  14569. */
  14570. add3f(x: number, y: number, z: number): Vec3;
  14571. /**
  14572. * @en Subtracts one vector from this, and returns this.
  14573. * @zh 向量减法。将当前向量减去指定向量的结果。
  14574. * @param other specified vector
  14575. */
  14576. subtract(other: Vec3): Vec3;
  14577. /**
  14578. * @en Subtracts one vector from this, and returns this.
  14579. * @zh 向量减法。将当前向量减去指定分量的向量
  14580. * @param x The x value of specified vector
  14581. * @param y The y value of specified vector
  14582. * @param z The z value of specified vector
  14583. */
  14584. subtract3f(x: number, y: number, z: number): Vec3;
  14585. /**
  14586. * @en Multiplies the current vector with a number, and returns this.
  14587. * @zh 向量数乘。将当前向量数乘指定标量
  14588. * @param scalar scalar number
  14589. */
  14590. multiplyScalar(scalar: number): Vec3;
  14591. /**
  14592. * @en Multiplies the current vector with another one and return this
  14593. * @zh 向量乘法。将当前向量乘以与指定向量的结果赋值给当前向量。
  14594. * @param other specified vector
  14595. */
  14596. multiply(other: Vec3): Vec3;
  14597. /**
  14598. * @en Multiplies the current vector with another one and return this
  14599. * @zh 向量乘法。将当前向量与指定分量的向量相乘的结果赋值给当前向量。
  14600. * @param x The x value of specified vector
  14601. * @param y The y value of specified vector
  14602. * @param z The z value of specified vector
  14603. */
  14604. multiply3f(x: number, y: number, z: number): Vec3;
  14605. /**
  14606. * @en Element-wisely divides this vector with another one, and return this.
  14607. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  14608. * @param other specified vector
  14609. */
  14610. divide(other: Vec3): Vec3;
  14611. /**
  14612. * @en Element-wisely divides this vector with another one, and return this.
  14613. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  14614. * @param x The x value of specified vector
  14615. * @param y The y value of specified vector
  14616. * @param z The z value of specified vector
  14617. */
  14618. divide3f(x: number, y: number, z: number): Vec3;
  14619. /**
  14620. * @en Sets each component of this vector with its negative value
  14621. * @zh 将当前向量的各个分量取反
  14622. */
  14623. negative(): Vec3;
  14624. /**
  14625. * @en Clamp the vector between minInclusive and maxInclusive.
  14626. * @zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  14627. * @param minInclusive Minimum value allowed
  14628. * @param maxInclusive Maximum value allowed
  14629. * @returns `this`
  14630. */
  14631. clampf(minInclusive: Vec3, maxInclusive: Vec3): Vec3;
  14632. /**
  14633. * @en Calculates the dot product with another vector
  14634. * @zh 向量点乘。
  14635. * @param other specified vector
  14636. * @returns The result of calculates the dot product with another vector
  14637. */
  14638. dot(other: Vec3): number;
  14639. /**
  14640. * @en Calculates the cross product with another vector.
  14641. * @zh 向量叉乘。将当前向量左叉乘指定向量
  14642. * @param other specified vector
  14643. */
  14644. cross(other: Vec3): Vec3;
  14645. /**
  14646. * @en Returns the length of this vector.
  14647. * @zh 计算向量的长度(模)。
  14648. * @returns Length of vector
  14649. */
  14650. length(): number;
  14651. /**
  14652. * @en Returns the squared length of this vector.
  14653. * @zh 计算向量长度(模)的平方。
  14654. * @returns the squared length of this vector
  14655. */
  14656. lengthSqr(): number;
  14657. /**
  14658. * @en Normalize the current vector.
  14659. * @zh 将当前向量归一化
  14660. */
  14661. normalize(): Vec3;
  14662. /**
  14663. * @en Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  14664. * @zh 将当前向量视为 w 分量为 1 的四维向量,应用四维矩阵变换到当前矩阵
  14665. * @param matrix matrix to transform with
  14666. */
  14667. transformMat4(matrix: Mat4): Vec3;
  14668. }
  14669. export function v3(other: Vec3): Vec3;
  14670. export function v3(x?: number, y?: number, z?: number): Vec3;
  14671. /**
  14672. * @en Representation of four-dimensional vectors.
  14673. * @zh 四维向量。
  14674. */
  14675. export class Vec4 extends ValueType {
  14676. static ZERO: Readonly<Vec4>;
  14677. static ONE: Readonly<Vec4>;
  14678. static NEG_ONE: Readonly<Vec4>;
  14679. static UNIT_X: Readonly<Vec4>;
  14680. static UNIT_Y: Readonly<Vec4>;
  14681. static UNIT_Z: Readonly<Vec4>;
  14682. static UNIT_W: Readonly<Vec4>;
  14683. /**
  14684. * @en Obtains a clone of the given vector object
  14685. * @zh 获得指定向量的拷贝
  14686. */
  14687. static clone<Out extends IVec4Like>(a: Out): Vec4;
  14688. /**
  14689. * @en Copy the target vector and save the results to out vector object
  14690. * @zh 复制目标向量
  14691. */
  14692. static copy<Out extends IVec4Like>(out: Out, a: Out): Out;
  14693. /**
  14694. * @en Sets the out vector with the given x, y, z and w values
  14695. * @zh 设置向量值
  14696. */
  14697. static set<Out extends IVec4Like>(out: Out, x: number, y: number, z: number, w: number): Out;
  14698. /**
  14699. * @en set value from color
  14700. * @zh 从颜色值设置向量
  14701. * @param out
  14702. * @param color
  14703. */
  14704. static fromColor<Out extends IVec4Like>(out: Out, color: IColorLike): Out;
  14705. /**
  14706. * @en The angle between two vectors
  14707. * @zh 两个向量之间的夹角
  14708. */
  14709. static angle<Out extends IVec4Like>(a: Out, b: Out): number;
  14710. /**
  14711. * @en Element-wise vector addition and save the results to out vector object
  14712. * @zh 逐元素向量加法
  14713. */
  14714. static add<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14715. /**
  14716. * @en Element-wise vector subtraction and save the results to out vector object
  14717. * @zh 逐元素向量减法
  14718. */
  14719. static subtract<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14720. /**
  14721. * @en Element-wise vector multiplication and save the results to out vector object
  14722. * @zh 逐元素向量乘法
  14723. */
  14724. static multiply<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14725. /**
  14726. * @en Element-wise vector division and save the results to out vector object
  14727. * @zh 逐元素向量除法
  14728. */
  14729. static divide<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14730. /**
  14731. * @en Rounds up by elements of the vector and save the results to out vector object
  14732. * @zh 逐元素向量向上取整
  14733. */
  14734. static ceil<Out extends IVec4Like>(out: Out, a: Out): Out;
  14735. /**
  14736. * @en Element-wise rounds down of the current vector and save the results to the out vector
  14737. * @zh 逐元素向量向下取整
  14738. */
  14739. static floor<Out extends IVec4Like>(out: Out, a: Out): Out;
  14740. /**
  14741. * @en Calculates the minimum values by elements of the vector and save the results to the out vector
  14742. * @zh 逐元素向量最小值
  14743. */
  14744. static min<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14745. /**
  14746. * @en Calculates the maximum values by elements of the vector and save the results to the out vector
  14747. * @zh 逐元素向量最大值
  14748. */
  14749. static max<Out extends IVec4Like>(out: Out, a: Out, b: Out): Out;
  14750. /**
  14751. * @en Calculates element-wise round results and save to the out vector
  14752. * @zh 逐元素向量四舍五入取整
  14753. */
  14754. static round<Out extends IVec4Like>(out: Out, a: Out): Out;
  14755. /**
  14756. * @en Vector scalar multiplication and save the results to out vector object
  14757. * @zh 向量标量乘法
  14758. */
  14759. static multiplyScalar<Out extends IVec4Like>(out: Out, a: Out, b: number): Out;
  14760. /**
  14761. * @en Element-wise multiplication and addition with the equation: a + b * scale
  14762. * @zh 逐元素向量乘加: A + B * scale
  14763. */
  14764. static scaleAndAdd<Out extends IVec4Like>(out: Out, a: Out, b: Out, scale: number): Out;
  14765. /**
  14766. * @en Calculates the euclidean distance of two vectors
  14767. * @zh 求两向量的欧氏距离
  14768. */
  14769. static distance<Out extends IVec4Like>(a: Out, b: Out): number;
  14770. /**
  14771. * @en Calculates the squared euclidean distance of two vectors
  14772. * @zh 求两向量的欧氏距离平方
  14773. */
  14774. static squaredDistance<Out extends IVec4Like>(a: Out, b: Out): number;
  14775. /**
  14776. * @en Calculates the length of the vector
  14777. * @zh 求向量长度
  14778. */
  14779. static len<Out extends IVec4Like>(a: Out): number;
  14780. /**
  14781. * @en Calculates the squared length of the vector
  14782. * @zh 求向量长度平方
  14783. */
  14784. static lengthSqr<Out extends IVec4Like>(a: Out): number;
  14785. /**
  14786. * @en Sets each element to its negative value
  14787. * @zh 逐元素向量取负
  14788. */
  14789. static negate<Out extends IVec4Like>(out: Out, a: Out): Out;
  14790. /**
  14791. * @en Sets each element to its inverse value, zero value will become Infinity
  14792. * @zh 逐元素向量取倒数,接近 0 时返回 Infinity
  14793. */
  14794. static inverse<Out extends IVec4Like>(out: Out, a: Out): Out;
  14795. /**
  14796. * @en Sets each element to its inverse value, zero value will remain zero
  14797. * @zh 逐元素向量取倒数,接近 0 时返回 0
  14798. */
  14799. static inverseSafe<Out extends IVec4Like>(out: Out, a: Out): Out;
  14800. /**
  14801. * @en Sets the normalized vector to the out vector, returns a zero vector if input is a zero vector.
  14802. * @zh 归一化向量,输入零向量将会返回零向量。
  14803. */
  14804. static normalize<Out extends IVec4Like>(out: Out, a: Out): Out;
  14805. /**
  14806. * @en Calculates the dot product of the vector
  14807. * @zh 向量点积(数量积)
  14808. */
  14809. static dot<Out extends IVec4Like>(a: Out, b: Out): number;
  14810. /**
  14811. * @en Calculates the linear interpolation between two vectors with a given ratio
  14812. * @zh 逐元素向量线性插值: A + t * (B - A)
  14813. */
  14814. static lerp<Out extends IVec4Like>(out: Out, a: Out, b: Out, t: number): Out;
  14815. /**
  14816. * @en Scales all ell elements of this vector by the specified scalar value
  14817. * @zh 逐元素向量缩放
  14818. */
  14819. static scale<Out extends IVec4Like>(out: Out, a: Out, b: number): Out;
  14820. /**
  14821. * @en Generates a uniformly distributed random vector points from center to the surface of the unit sphere
  14822. * @zh 生成一个在单位球体上均匀分布的随机向量
  14823. * @param scale vector length
  14824. */
  14825. static random<Out extends IVec4Like>(out: Out, scale?: number): Out;
  14826. /**
  14827. * @en Vector and fourth order matrix multiplication
  14828. * @zh 向量与四维矩阵乘法
  14829. */
  14830. static transformMat4<Out extends IVec4Like, MatLike extends IMat4Like>(out: Out, a: Out, m: MatLike): Out;
  14831. /**
  14832. * @en Transform the vector with the given affine transformation
  14833. * @zh 向量仿射变换
  14834. */
  14835. static transformAffine<Out extends IVec4Like, VecLike extends IVec4Like, MatLike extends IMat4Like>(out: Out, v: VecLike, m: MatLike): Out;
  14836. /**
  14837. * @en Vector quaternion multiplication
  14838. * @zh 向量四元数乘法
  14839. */
  14840. static transformQuat<Out extends IVec4Like, QuatLike extends IQuatLike>(out: Out, a: Out, q: QuatLike): Out;
  14841. /**
  14842. * @en Converts the given vector to an array
  14843. * @zh 向量转数组
  14844. * @param ofs Array Start Offset
  14845. */
  14846. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, v: IVec4Like, ofs?: number): Out;
  14847. /**
  14848. * @en Converts the given array to a vector
  14849. * @zh 数组转向量
  14850. * @param ofs Array Start Offset
  14851. */
  14852. static fromArray<Out extends IVec4Like>(out: Out, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): Out;
  14853. /**
  14854. * @en Check the equality of the two given vectors
  14855. * @zh 向量等价判断
  14856. */
  14857. static strictEquals<Out extends IVec4Like>(a: Out, b: Out): boolean;
  14858. /**
  14859. * @en Check whether the two given vectors are approximately equivalent
  14860. * @zh 排除浮点数误差的向量近似等价判断
  14861. */
  14862. static equals<Out extends IVec4Like>(a: Out, b: Out, epsilon?: number): boolean;
  14863. /**
  14864. * @en x component.
  14865. * @zh x 分量。
  14866. */
  14867. x: number;
  14868. /**
  14869. * @en y component.
  14870. * @zh y 分量。
  14871. */
  14872. y: number;
  14873. /**
  14874. * @en z component.
  14875. * @zh z 分量。
  14876. */
  14877. z: number;
  14878. /**
  14879. * @en w component.
  14880. * @zh w 分量。
  14881. */
  14882. w: number;
  14883. constructor(other: Vec4);
  14884. constructor(x?: number, y?: number, z?: number, w?: number);
  14885. /**
  14886. * @en clone the current Vec4 value.
  14887. * @zh 克隆当前向量。
  14888. */
  14889. clone(): Vec4;
  14890. /**
  14891. * @en Set the current vector value with the given vector.
  14892. * @zh 设置当前向量使其与指定向量相等。
  14893. * @param other Specified vector
  14894. * @returns `this`
  14895. */
  14896. set(other: Vec4): Vec4;
  14897. /**
  14898. * @en Set the value of each component of the current vector.
  14899. * @zh 设置当前向量的具体分量值。
  14900. * @param x x value
  14901. * @param y y value
  14902. * @param z z value
  14903. * @param w w value
  14904. * @returns `this`
  14905. */
  14906. set(x?: number, y?: number, z?: number, w?: number): Vec4;
  14907. /**
  14908. * @en Check whether the vector approximately equals another one.
  14909. * @zh 判断当前向量是否在误差范围内与指定向量相等。
  14910. * @param other Specified vector
  14911. * @param epsilon The error allowed. It`s should be a non-negative number.
  14912. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14913. */
  14914. equals(other: Vec4, epsilon?: number): boolean;
  14915. /**
  14916. * @en Check whether the vector approximately equals another one.
  14917. * @zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  14918. * @param x The x value of specified vector
  14919. * @param y The y value of specified vector
  14920. * @param z The z value of specified vector
  14921. * @param w The w value of specified vector
  14922. * @param epsilon The error allowed. It`s should be a non-negative number.
  14923. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14924. */
  14925. equals4f(x: number, y: number, z: number, w: number, epsilon?: number): boolean;
  14926. /**
  14927. * @en Check whether the current vector strictly equals another Vec4.
  14928. * @zh 判断当前向量是否与指定向量相等。
  14929. * @param other specified vector
  14930. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14931. */
  14932. strictEquals(other: Vec4): boolean;
  14933. /**
  14934. * @en Check whether the current vector strictly equals another Vec4.
  14935. * @zh 判断当前向量是否与指定分量的向量相等。
  14936. * @param x The x value of specified vector
  14937. * @param y The y value of specified vector
  14938. * @param z The z value of specified vector
  14939. * @param w The w value of specified vector
  14940. * @returns Returns `true` when the components of both vectors are equal within the specified range of error; otherwise it returns `false`.
  14941. */
  14942. strictEquals4f(x: number, y: number, z: number, w: number): boolean;
  14943. /**
  14944. * @en Calculate linear interpolation result between this vector and another one with given ratio.
  14945. * @zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  14946. * @param to Target vector
  14947. * @param ratio The interpolation coefficient.The range is [0,1].
  14948. */
  14949. lerp(to: Vec4, ratio: number): Vec4;
  14950. /**
  14951. * @en Return the information of the vector in string
  14952. * @zh 返回当前向量的字符串表示。
  14953. * @returns The string with vector information
  14954. */
  14955. toString(): string;
  14956. /**
  14957. * @en Clamp the vector between minInclusive and maxInclusive.
  14958. * @zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  14959. * @param minInclusive Minimum value allowed
  14960. * @param maxInclusive Maximum value allowed
  14961. * @returns `this`
  14962. */
  14963. clampf(minInclusive: Vec4, maxInclusive: Vec4): Vec4;
  14964. /**
  14965. * @en Adds the current vector with another one and return this
  14966. * @zh 向量加法。将当前向量与指定向量的相加
  14967. * @param other specified vector
  14968. */
  14969. add(other: Vec4): Vec4;
  14970. /**
  14971. * @en Adds the current vector with another one and return this
  14972. * @zh 向量加法。将当前向量与指定分量的向量相加
  14973. * @param x The x value of specified vector
  14974. * @param y The y value of specified vector
  14975. * @param z The z value of specified vector
  14976. * @param w The w value of specified vector
  14977. */
  14978. add4f(x: number, y: number, z: number, w: number): Vec4;
  14979. /**
  14980. * @en Subtracts one vector from this, and returns this.
  14981. * @zh 向量减法。将当前向量减去指定向量
  14982. * @param other specified vector
  14983. */
  14984. subtract(other: Vec4): Vec4;
  14985. /**
  14986. * @en Subtracts one vector from this, and returns this.
  14987. * @zh 向量减法。将当前向量减去指定分量的向量
  14988. * @param x The x value of specified vector
  14989. * @param y The y value of specified vector
  14990. * @param z The z value of specified vector
  14991. * @param w The w value of specified vector
  14992. */
  14993. subtract4f(x: number, y: number, z: number, w: number): Vec4;
  14994. /**
  14995. * @en Multiplies the current vector with a number, and returns this.
  14996. * @zh 向量数乘。将当前向量数乘指定标量
  14997. * @param scalar scalar number
  14998. */
  14999. multiplyScalar(scalar: number): Vec4;
  15000. /**
  15001. * @en Multiplies the current vector with another one and return this
  15002. * @zh 向量乘法。将当前向量乘以指定向量
  15003. * @param other specified vector
  15004. */
  15005. multiply(other: Vec4): Vec4;
  15006. /**
  15007. * @en Multiplies the current vector with another one and return this
  15008. * @zh 向量乘法。将当前向量与指定分量的向量相乘的结果赋值给当前向量。
  15009. * @param x The x value of specified vector
  15010. * @param y The y value of specified vector
  15011. * @param z The z value of specified vector
  15012. * @param w The w value of specified vector
  15013. */
  15014. multiply4f(x: number, y: number, z: number, w: number): Vec4;
  15015. /**
  15016. * @en Element-wisely divides this vector with another one, and return this.
  15017. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  15018. * @param other specified vector
  15019. */
  15020. divide(other: Vec4): Vec4;
  15021. /**
  15022. * @en Element-wisely divides this vector with another one, and return this.
  15023. * @zh 向量逐元素相除。将当前向量与指定分量的向量相除的结果赋值给当前向量。
  15024. * @param x The x value of specified vector
  15025. * @param y The y value of specified vector
  15026. * @param z The z value of specified vector
  15027. * @param w The w value of specified vector
  15028. */
  15029. divide4f(x: number, y: number, z: number, w: number): Vec4;
  15030. /**
  15031. * @en Sets each component of this vector with its negative value
  15032. * @zh 将当前向量的各个分量取反
  15033. */
  15034. negative(): Vec4;
  15035. /**
  15036. * @en Calculates the dot product with another vector
  15037. * @zh 向量点乘。
  15038. * @param other specified vector
  15039. * @returns 当前向量与指定向量点乘的结果。
  15040. */
  15041. dot(vector: Vec4): number;
  15042. /**
  15043. * @en Calculates the cross product with another vector.
  15044. * @zh 向量叉乘。视当前向量和指定向量为三维向量(舍弃 w 分量),将当前向量左叉乘指定向量
  15045. * @param other specified vector
  15046. *
  15047. * @deprecated since v3.8 cross product only defined in 3D space, use [[Vec3.cross]] instead.
  15048. */
  15049. cross(vector: Vec4): Vec4;
  15050. /**
  15051. * @en Returns the length of this vector.
  15052. * @zh 计算向量的长度(模)。
  15053. * @returns Length of vector
  15054. */
  15055. length(): number;
  15056. /**
  15057. * @en Returns the squared length of this vector.
  15058. * @zh 计算向量长度(模)的平方。
  15059. * @returns the squared length of this vector
  15060. */
  15061. lengthSqr(): number;
  15062. /**
  15063. * @en Normalize the current vector.
  15064. * @zh 将当前向量归一化
  15065. */
  15066. normalize(): Vec4;
  15067. /**
  15068. * @en Scales the current vector by a scalar number.
  15069. * @zh 向量数乘。
  15070. */
  15071. scale(scalar: number): Vec4;
  15072. /**
  15073. * @en Transforms the vec4 with a mat4
  15074. * @zh 应用四维矩阵变换到当前矩阵
  15075. * @param matrix matrix to transform with
  15076. */
  15077. transformMat4(matrix: Mat4): Vec4;
  15078. }
  15079. export function v4(other: Vec4): Vec4;
  15080. export function v4(x?: number, y?: number, z?: number, w?: number): Vec4;
  15081. /**
  15082. * @en quaternion
  15083. * @zh 四元数
  15084. */
  15085. export class Quat extends ValueType {
  15086. static IDENTITY: Readonly<Quat>;
  15087. /**
  15088. * @en Obtain a copy of the given quaternion
  15089. * @zh 获得指定四元数的拷贝
  15090. */
  15091. static clone<Out extends IQuatLike>(a: Out): Quat;
  15092. /**
  15093. * @en Copy the given quaternion to the out quaternion
  15094. * @zh 复制目标四元数
  15095. */
  15096. static copy<Out extends IQuatLike, QuatLike extends IQuatLike>(out: Out, a: QuatLike): Out;
  15097. /**
  15098. * @en Sets the out quaternion with values of each component
  15099. * @zh 设置四元数值
  15100. */
  15101. static set<Out extends IQuatLike>(out: Out, x: number, y: number, z: number, w: number): Out;
  15102. /**
  15103. * @en Sets the out quaternion to an identity quaternion
  15104. * @zh 将目标赋值为单位四元数
  15105. */
  15106. static identity<Out extends IQuatLike>(out: Out): Out;
  15107. /**
  15108. * @en Sets the out quaternion with the shortest path orientation between two vectors, considering both vectors normalized
  15109. * @zh 设置四元数为两向量间的最短路径旋转,默认两向量都已归一化
  15110. */
  15111. static rotationTo<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, a: VecLike, b: VecLike): Out;
  15112. /**
  15113. * @en Gets the rotation axis and the arc of rotation from the quaternion
  15114. * @zh 获取四元数的旋转轴和旋转弧度
  15115. * @param outAxis output axis
  15116. * @param q input quaternion
  15117. * @return radian of rotation
  15118. */
  15119. static getAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like>(outAxis: VecLike, q: Out): number;
  15120. /**
  15121. * @en Quaternion multiplication and save the results to out quaternion, that is a * b.
  15122. * @zh 四元数乘法,即a * b。
  15123. */
  15124. static multiply<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike>(out: Out, a: QuatLike_1, b: QuatLike_2): Out;
  15125. /**
  15126. * @en Quaternion scalar multiplication and save the results to out quaternion
  15127. * @zh 四元数标量乘法
  15128. */
  15129. static multiplyScalar<Out extends IQuatLike>(out: Out, a: Out, b: number): Out;
  15130. /**
  15131. * @en Quaternion multiplication and addition: A + B * scale
  15132. * @zh 四元数乘加:A + B * scale
  15133. */
  15134. static scaleAndAdd<Out extends IQuatLike>(out: Out, a: Out, b: Out, scale: number): Out;
  15135. /**
  15136. * @en Sets the out quaternion to represent a radian rotation around x axis
  15137. * @zh 绕 X 轴旋转指定四元数
  15138. * @param rad radian of rotation
  15139. */
  15140. static rotateX<Out extends IQuatLike>(out: Out, a: Out, rad: number): Out;
  15141. /**
  15142. * @en Sets the out quaternion to represent a radian rotation around y axis
  15143. * @zh 绕 Y 轴旋转指定四元数
  15144. * @param rad radian of rotation
  15145. */
  15146. static rotateY<Out extends IQuatLike>(out: Out, a: Out, rad: number): Out;
  15147. /**
  15148. * @en Sets the out quaternion to represent a radian rotation around z axis
  15149. * @zh 绕 Z 轴旋转指定四元数
  15150. * @param rad radian of rotation
  15151. */
  15152. static rotateZ<Out extends IQuatLike>(out: Out, a: Out, rad: number): Out;
  15153. /**
  15154. * @en Sets the out quaternion to represent a radian rotation around a given rotation axis in world space
  15155. * @zh 绕世界空间下指定轴旋转四元数
  15156. * @param axis axis of rotation, normalized by default
  15157. * @param rad radian of rotation
  15158. */
  15159. static rotateAround<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, rot: Out, axis: VecLike, rad: number): Out;
  15160. /**
  15161. * @en Sets the out quaternion to represent a radian rotation around a given rotation axis in local space
  15162. * @zh 绕本地空间下指定轴旋转四元数
  15163. * @param axis axis of rotation
  15164. * @param rad radian of rotation
  15165. */
  15166. static rotateAroundLocal<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, rot: Out, axis: VecLike, rad: number): Out;
  15167. /**
  15168. * @en Calculates the w component with xyz components, considering the given quaternion normalized
  15169. * @zh 根据 xyz 分量计算 w 分量,默认已归一化
  15170. */
  15171. static calculateW<Out extends IQuatLike>(out: Out, a: Out): Out;
  15172. /**
  15173. * @en Quaternion dot product (scalar product)
  15174. * @zh 四元数点积(数量积)
  15175. */
  15176. static dot<Out extends IQuatLike>(a: Out, b: Out): number;
  15177. /**
  15178. * @en Element by element linear interpolation: A + t * (B - A)
  15179. * @zh 逐元素线性插值: A + t * (B - A)
  15180. */
  15181. static lerp<Out extends IQuatLike>(out: Out, a: Out, b: Out, t: number): Out;
  15182. /**
  15183. * @en Spherical quaternion interpolation
  15184. * @zh 四元数球面插值
  15185. */
  15186. static slerp<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike>(out: Out, a: QuatLike_1, b: QuatLike_2, t: number): Out;
  15187. /**
  15188. * @en Spherical quaternion interpolation with two control points
  15189. * @zh 带两个控制点的四元数球面插值
  15190. * @param out the receiving quaternion
  15191. * @param a the first operand
  15192. * @param b the second operand
  15193. * @param c the third operand
  15194. * @param d the fourth operand
  15195. * @param t interpolation amount, in the range [0-1], between the two inputs
  15196. * @returns out
  15197. */
  15198. static sqlerp<Out extends IQuatLike>(out: Out, a: Out, b: Out, c: Out, d: Out, t: number): Out;
  15199. /**
  15200. * @en Sets the inverse of the given quaternion to out quaternion
  15201. * @zh 四元数求逆
  15202. */
  15203. static invert<Out extends IQuatLike, QuatLike extends IQuatLike>(out: Out, a: QuatLike): Out;
  15204. /**
  15205. * @en Conjugating a quaternion, it's equivalent to the inverse of the unit quaternion, but more efficient
  15206. * @zh 求共轭四元数,对单位四元数与求逆等价,但更高效
  15207. */
  15208. static conjugate<Out extends IQuatLike>(out: Out, a: Out): Out;
  15209. /**
  15210. * @en Calculates the length of the quaternion
  15211. * @zh 求四元数长度
  15212. */
  15213. static len<Out extends IQuatLike>(a: Out): number;
  15214. /**
  15215. * @en Calculates the squared length of the quaternion
  15216. * @zh 求四元数长度平方
  15217. */
  15218. static lengthSqr<Out extends IQuatLike>(a: Out): number;
  15219. /**
  15220. * @en Normalize the given quaternion, returns a zero quaternion if input is a zero quaternion.
  15221. * @zh 归一化四元数,输入零四元数将会返回零四元数。
  15222. */
  15223. static normalize<Out extends IQuatLike>(out: Out, a: Out): Out;
  15224. /**
  15225. * @en Calculated the quaternion represents the given coordinates, considering all given vectors are normalized and mutually perpendicular
  15226. * @zh 根据本地坐标轴朝向计算四元数,默认三向量都已归一化且相互垂直
  15227. */
  15228. static fromAxes<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, xAxis: VecLike, yAxis: VecLike, zAxis: VecLike): Out;
  15229. /**
  15230. * @en Calculates the quaternion with the up direction and the direction of the viewport
  15231. * @zh 根据视口的前方向和上方向计算四元数
  15232. * @param view The view direction, it`s must be normalized.
  15233. * @param up The view up direction, it`s must be normalized, default value is (0, 1, 0).
  15234. */
  15235. static fromViewUp<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, view: VecLike, up?: Vec3): Out;
  15236. /**
  15237. * @en Calculates the quaternion from a given rotary shaft and a radian rotation around it.
  15238. * @zh 根据旋转轴和旋转弧度计算四元数
  15239. */
  15240. static fromAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like>(out: Out, axis: VecLike, rad: number): Out;
  15241. /**
  15242. * @en Calculates the quaternion with the three-dimensional transform matrix, considering no scale included in the matrix
  15243. * @zh 根据三维矩阵信息计算四元数,默认输入矩阵不含有缩放信息
  15244. */
  15245. static fromMat3<Out extends IQuatLike>(out: Out, m: Mat3): Out;
  15246. /**
  15247. * @en Calculates the quaternion with Euler angles, the rotation order is YZX, first rotate around Y, then around Z, and finally around X.
  15248. * @zh 根据欧拉角信息计算四元数,旋转顺序为 YZX,即先绕Y旋转,再绕Z,最后绕X旋转。
  15249. */
  15250. static fromEuler<Out extends IQuatLike>(out: Out, x: number, y: number, z: number): Out;
  15251. /**
  15252. * @en Calculates the quaternion with given 2D angle (0, 0, z).
  15253. * @zh 根据 2D 角度(0, 0, z)计算四元数
  15254. *
  15255. * @param out Output quaternion
  15256. * @param z Angle to rotate around Z axis in degrees.
  15257. */
  15258. static fromAngleZ<Out extends IQuatLike>(out: Out, z: number): Out;
  15259. /**
  15260. * @en This returns the X-axis vector of the quaternion
  15261. * @zh 返回定义此四元数的坐标系 X 轴向量
  15262. */
  15263. static toAxisX(out: IVec3Like, q: IQuatLike): IVec3Like;
  15264. /**
  15265. * @en This returns the Y-axis vector of the quaternion
  15266. * @zh 返回定义此四元数的坐标系 Y 轴向量
  15267. */
  15268. static toAxisY(out: IVec3Like, q: IQuatLike): IVec3Like;
  15269. /**
  15270. * @en This returns the Z-axis vector of the quaternion
  15271. * @zh 返回定义此四元数的坐标系 Z 轴向量
  15272. */
  15273. static toAxisZ(out: IVec3Like, q: IQuatLike): IVec3Like;
  15274. /**
  15275. * @en Converts the quaternion to angles, result angle x, y in the range of [-180, 180], z in the range of [-90, 90] interval,
  15276. * the rotation order is YZX, first rotate around Y, then around Z, and finally around X
  15277. * @zh 根据四元数计算欧拉角,返回角度 x, y 在 [-180, 180] 区间内, z 默认在 [-90, 90] 区间内,旋转顺序为 YZX,即先绕Y旋转,再绕Z,最后绕X旋转。
  15278. * @param outerZ change z value range to [-180, -90] U [90, 180]
  15279. */
  15280. static toEuler(out: IVec3Like, q: IQuatLike, outerZ?: boolean): IVec3Like;
  15281. /**
  15282. * @en Converts the quaternion to euler angles, result angle y, z in the range of [-180, 180], x in the range of [-90, 90],
  15283. * the rotation order is YXZ, first rotate around Y, then around X, and finally around Z.
  15284. * @zh 根据四元数计算欧拉角,返回角度 yz 在 [-180, 180], x 在 [-90, 90],旋转顺序为 YXZ,即先绕Y旋转,再绕X,最后绕Z旋转。
  15285. */
  15286. static toEulerInYXZOrder(out: Vec3, q: IQuatLike): void;
  15287. /**
  15288. * @en Converts quaternion to an array
  15289. * @zh 四元数转数组
  15290. * @param ofs Array Start Offset
  15291. */
  15292. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, q: IQuatLike, ofs?: number): Out;
  15293. /**
  15294. * @en Array to a quaternion
  15295. * @zh 数组转四元数
  15296. * @param ofs Array Start Offset
  15297. */
  15298. static fromArray(out: IQuatLike, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): IQuatLike;
  15299. /**
  15300. * @en Check whether two quaternions are equal
  15301. * @zh 四元数等价判断
  15302. */
  15303. static strictEquals(a: IQuatLike, b: IQuatLike): boolean;
  15304. /**
  15305. * @en Check whether two quaternions are approximately equal
  15306. * @zh 排除浮点数误差的四元数近似等价判断
  15307. */
  15308. static equals(a: IQuatLike, b: IQuatLike, epsilon?: number): boolean;
  15309. /**
  15310. * @en Gets the angular distance between two unit quaternions
  15311. * @zh 获取两个单位四元数的夹角
  15312. * @param a The first unit quaternion
  15313. * @param b The second unit quaternion
  15314. * @returns Angle between the two quaternions in radians
  15315. */
  15316. static angle(a: IQuatLike, b: IQuatLike): number;
  15317. /**
  15318. * @en Rotate a `from` unit quaternion towards `to` unit quaternion
  15319. * @zh 将一个起始单位四元数旋转到一个目标单位四元数
  15320. * @param from The first unit quaternion
  15321. * @param to The second unit quaternion
  15322. * @param maxStep The maximum angle of rotation in degrees
  15323. * @returns new unit quaternion generated during rotation
  15324. */
  15325. static rotateTowards(out: IQuatLike, from: IQuatLike, to: IQuatLike, maxStep: number): IQuatLike;
  15326. /**
  15327. * @en x component.
  15328. * @zh x 分量。
  15329. */
  15330. x: number;
  15331. /**
  15332. * @en y component.
  15333. * @zh y 分量。
  15334. */
  15335. y: number;
  15336. /**
  15337. * @en z component.
  15338. * @zh z 分量。
  15339. */
  15340. z: number;
  15341. /**
  15342. * @en w component.
  15343. * @zh w 分量。
  15344. */
  15345. w: number;
  15346. constructor(other: Quat);
  15347. constructor(x?: number, y?: number, z?: number, w?: number);
  15348. /**
  15349. * @en clone the current Quat
  15350. * @zh 克隆当前四元数。
  15351. */
  15352. clone(): Quat;
  15353. /**
  15354. * @en Set values with another quaternion
  15355. * @zh 设置当前四元数使其与指定四元数相等。
  15356. * @param other Specified quaternion
  15357. * @returns `this`
  15358. */
  15359. set(other: Quat): Quat;
  15360. /**
  15361. * @en Set the value of each component of the current quaternion
  15362. * @zh 设置当前四元数指定元素值。
  15363. * @returns `this`
  15364. */
  15365. set(x?: number, y?: number, z?: number, w?: number): Quat;
  15366. /**
  15367. * @en Check whether the quaternion approximately equals another one
  15368. * @zh 判断当前四元数是否在误差范围内与指定向量相等。
  15369. * @param other Comparative quaternion
  15370. * @param epsilon The error allowed. It`s should be a non-negative number.
  15371. * @returns Returns `true' when the components of the two quaternions are equal within the specified error range; otherwise, returns `false'.
  15372. */
  15373. equals(other: Quat, epsilon?: number): boolean;
  15374. /**
  15375. * @en Check whether the current quaternion strictly equals other quaternion
  15376. * @zh 判断当前四元数是否与指定四元数相等。
  15377. * @param other Comparative quaternion
  15378. * @returns Returns `true' when the components of the two quaternions are equal within the specified error range; otherwise, returns `false'.
  15379. */
  15380. strictEquals(other: Quat): boolean;
  15381. /**
  15382. * @en Convert quaternion to Euler angles
  15383. * @zh 将当前四元数转化为欧拉角(x-y-z)并赋值给输出向量。
  15384. * @param out the output vector
  15385. */
  15386. getEulerAngles(out: Vec3): IVec3Like;
  15387. /**
  15388. * @en Calculate the linear interpolation result between this quaternion and another one with given ratio
  15389. * @zh 根据指定的插值比率,从当前四元数到目标四元数之间做线性插值。
  15390. * @param to The target quaternion
  15391. * @param ratio The interpolation coefficient. The range is [0,1].
  15392. */
  15393. lerp(to: Quat, ratio: number): Quat;
  15394. /**
  15395. * @en Calculates the spherical interpolation result between this quaternion and another one with the given ratio
  15396. * @zh 根据指定的插值比率,从当前四元数到目标四元数之间做球面插值。
  15397. * @param to The target quaternion
  15398. * @param ratio The interpolation coefficient. The range is [0,1].
  15399. */
  15400. slerp(to: Quat, ratio: number): Quat;
  15401. /**
  15402. * @en Calculates the length of the quaternion
  15403. * @zh 求四元数长度
  15404. */
  15405. length(): number;
  15406. /**
  15407. * @en Calculates the squared length of the quaternion
  15408. * @zh 求四元数长度平方
  15409. */
  15410. lengthSqr(): number;
  15411. }
  15412. export function quat(other: Quat): Quat;
  15413. export function quat(x?: number, y?: number, z?: number, w?: number): Quat;
  15414. /**
  15415. * @en Mathematical 3x3 matrix.
  15416. * @zh 表示三维(3x3)矩阵。
  15417. */
  15418. export class Mat3 extends ValueType {
  15419. static IDENTITY: Readonly<Mat3>;
  15420. /**
  15421. * @en Clone a matrix and save the results to out matrix
  15422. * @zh 获得指定矩阵的拷贝
  15423. */
  15424. static clone<Out extends IMat3Like>(a: Out): Mat3;
  15425. /**
  15426. * @en Copy content of a matrix into another and save the results to out matrix
  15427. * @zh 复制目标矩阵
  15428. */
  15429. static copy<Out extends IMat3Like>(out: Out, a: Out): Out;
  15430. /**
  15431. * @en Sets the elements of a matrix with the given values and save the results to out matrix
  15432. * @zh 设置矩阵值
  15433. */
  15434. static set<Out extends IMat3Like>(out: Out, m00: number, m01: number, m02: number, m03: number, m04: number, m05: number, m06: number, m07: number, m08: number): Out;
  15435. /**
  15436. * @en Reset the out matrix to an identity matrix
  15437. * @zh 将目标赋值为单位矩阵
  15438. */
  15439. static identity<Out extends IMat3Like>(out: Out): Out;
  15440. /**
  15441. * @en Transposes a matrix and save the results to out matrix
  15442. * @zh 转置矩阵
  15443. */
  15444. static transpose<Out extends IMat3Like>(out: Out, a: Out): Out;
  15445. /**
  15446. * @en Inverts a matrix. When matrix is not invertible the matrix will be set to zeros.
  15447. * @zh 矩阵求逆,注意,在矩阵不可逆时,会返回一个全为 0 的矩阵。
  15448. */
  15449. static invert<Out extends IMat3Like>(out: Out, a: Out): Out;
  15450. /**
  15451. * @en Calculates the determinant of a matrix
  15452. * @zh 矩阵行列式
  15453. */
  15454. static determinant<Out extends IMat3Like>(a: Out): number;
  15455. /**
  15456. * @en Multiply two matrices explicitly and save the results to out matrix: a * b
  15457. * @zh 矩阵乘法:a * b
  15458. */
  15459. static multiply<Out extends IMat3Like>(out: Out, a: Out, b: Out): Out;
  15460. /**
  15461. * @en Take the first third order of the fourth order matrix and multiply by the third order matrix: a * b
  15462. * @zh 取四阶矩阵的前三阶,与三阶矩阵相乘:a * b
  15463. */
  15464. static multiplyMat4<Out extends IMat3Like>(out: Out, a: Out, b: IMat4Like): Out;
  15465. /**
  15466. * @en Multiply a matrix with a translation vector given by a translation offset, first translate, then transform:a * T(v).
  15467. * @zh 在给定矩阵变换基础上加入位移变换,先位移,再变换,即a * T(v)。
  15468. */
  15469. /**
  15470. * @deprecated since v3.8.0, the function name is misleading, please use translate instead.
  15471. */
  15472. static transform<Out extends IMat3Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): void;
  15473. /**
  15474. * @en Multiply a matrix with a translation vector given by a translation offset, first translate, then transform:a * T(v).
  15475. * @zh 在给定矩阵变换基础上加入位移变换,先位移,再变换,即a * T(v)。
  15476. */
  15477. static translate<Out extends IMat3Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): Out;
  15478. /**
  15479. * @en Multiply a matrix with a scale matrix given by a scale vector and save the results to out matrix, first scale, then transform:a * S(v).
  15480. * @zh 在给定矩阵变换基础上加入新缩放变换,先缩放,再变换,即a * S(v)。
  15481. */
  15482. static scale<Out extends IMat3Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): Out;
  15483. /**
  15484. * @en Rotates the transform by the given angle and save the results into the out matrix, first rotate, then transform:a * R(rad).
  15485. * @zh 在给定矩阵变换基础上加入新旋转变换,先旋转,再变换,即a * R(rad)。
  15486. * @param rad radian of rotation
  15487. */
  15488. static rotate<Out extends IMat3Like>(out: Out, a: Out, rad: number): Out;
  15489. /**
  15490. * @en Copies the first third order matrix of a fourth order matrix to the out third order matrix
  15491. * @zh 取四阶矩阵的前三阶
  15492. */
  15493. static fromMat4<Out extends IMat3Like>(out: Out, a: IMat4Like): Out;
  15494. /**
  15495. * @en Sets a third order matrix with view direction and up direction. Then save the results to out matrix
  15496. * @zh 根据视口前方向和上方向计算矩阵
  15497. * @param view The view direction, it`s must be normalized.
  15498. * @param up The view up direction, it`s must be normalized, default value is (0, 1, 0).
  15499. */
  15500. static fromViewUp<Out extends IMat3Like, VecLike extends IVec3Like>(out: Out, view: VecLike, up?: Vec3): Out;
  15501. /**
  15502. * @en Sets the given matrix with a translation vector and save the results to out matrix
  15503. * @zh 计算位移矩阵
  15504. */
  15505. static fromTranslation<Out extends IMat3Like, VecLike extends IVec2Like>(out: Out, v: VecLike): Out;
  15506. /**
  15507. * @en Sets the given matrix with a scale vector and save the results to out matrix
  15508. * @zh 计算缩放矩阵
  15509. */
  15510. static fromScaling<Out extends IMat3Like, VecLike extends IVec2Like>(out: Out, v: VecLike): Out;
  15511. /**
  15512. * @en Sets the given matrix with a given angle and save the results to out matrix
  15513. * @zh 计算旋转矩阵
  15514. */
  15515. static fromRotation<Out extends IMat3Like>(out: Out, rad: number): Out;
  15516. /**
  15517. * @en Sets the given matrix with the given quaternion and save the results to out matrix
  15518. * @zh 根据四元数旋转信息计算矩阵
  15519. */
  15520. static fromQuat<Out extends IMat3Like>(out: Out, q: IQuatLike): Out;
  15521. /**
  15522. * @deprecated since v3.8.0, this function is too complicated, and should be split into several functions.
  15523. */
  15524. /**
  15525. * @en Calculates the upper-left 3x3 matrix of a 4x4 matrix's inverse transpose
  15526. * @zh 计算指定四维矩阵的逆转置三维矩阵
  15527. */
  15528. static inverseTransposeMat4<Out extends IMat3Like>(out: Out, a: IMat4Like): Out | null;
  15529. /**
  15530. * @en Transform a matrix object to a flat array
  15531. * @zh 矩阵转数组
  15532. * @param ofs Array Start Offset
  15533. */
  15534. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, m: IMat3Like, ofs?: number): Out;
  15535. /**
  15536. * @en Generates or sets a matrix with a flat array
  15537. * @zh 数组转矩阵
  15538. * @param ofs Array Start Offset
  15539. */
  15540. static fromArray<Out extends IMat3Like>(out: Out, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): Out;
  15541. /**
  15542. * @en Adds two matrices and save the results to out matrix
  15543. * @zh 逐元素矩阵加法
  15544. */
  15545. static add<Out extends IMat3Like>(out: Out, a: Out, b: Out): Out;
  15546. /**
  15547. * @en Subtracts matrix b from matrix a and save the results to out matrix
  15548. * @zh 逐元素矩阵减法
  15549. */
  15550. static subtract<Out extends IMat3Like>(out: Out, a: Out, b: Out): Out;
  15551. /**
  15552. * @en Multiply each element of a matrix by a scalar number and save the results to out matrix
  15553. * @zh 矩阵标量乘法
  15554. */
  15555. static multiplyScalar<Out extends IMat3Like>(out: Out, a: Out, b: number): Out;
  15556. /**
  15557. * @en Adds two matrices after multiplying each element of the second operand by a scalar number. And save the results to out matrix.
  15558. * @zh 逐元素矩阵标量乘加: A + B * scale
  15559. */
  15560. static multiplyScalarAndAdd<Out extends IMat3Like>(out: Out, a: Out, b: Out, scale: number): Out;
  15561. /**
  15562. * @en Returns whether the specified matrices are equal.
  15563. * @zh 矩阵等价判断
  15564. */
  15565. static strictEquals<Out extends IMat3Like>(a: Out, b: Out): boolean;
  15566. /**
  15567. * @en Returns whether the specified matrices are approximately equal.
  15568. * @zh 排除浮点数误差的矩阵近似等价判断
  15569. */
  15570. static equals<Out extends IMat3Like>(a: Out, b: Out, epsilon?: number): boolean;
  15571. /**
  15572. * @en Convert Matrix to euler angle, resulting angle y, z in the range of [-PI, PI],
  15573. * x in the range of [-PI/2, PI/2], the rotation order is YXZ, first rotate around Y, then around X, and finally around Z.
  15574. * @zh 将矩阵转换成欧拉角, 返回角度 y,z 在 [-PI, PI] 区间内, x 在 [-PI/2, PI/2] 区间内,旋转顺序为 YXZ,即先绕Y旋转,再绕X,最后绕Z旋转。
  15575. */
  15576. static toEuler<InType extends IMat3Like, VecLike extends IVec3Like>(matrix: InType, v: VecLike): boolean;
  15577. /**
  15578. * matrix layout
  15579. * |m00 m03 m06|
  15580. * |m01 m04 m07|
  15581. * |m02 m05 m08|
  15582. */
  15583. /**
  15584. * @en Value at column 0 row 0 of the matrix.
  15585. * @zh 矩阵第 0 列第 0 行的元素。
  15586. */
  15587. m00: number;
  15588. /**
  15589. * @en Value at column 0 row 1 of the matrix.
  15590. * @zh 矩阵第 0 列第 1 行的元素。
  15591. */
  15592. m01: number;
  15593. /**
  15594. * @en Value at column 0 row 2 of the matrix.
  15595. * @zh 矩阵第 0 列第 2 行的元素。
  15596. */
  15597. m02: number;
  15598. /**
  15599. * @en Value at column 1 row 0 of the matrix.
  15600. * @zh 矩阵第 1 列第 0 行的元素。
  15601. */
  15602. m03: number;
  15603. /**
  15604. * @en Value at column 1 row 1 of the matrix.
  15605. * @zh 矩阵第 1 列第 1 行的元素。
  15606. */
  15607. m04: number;
  15608. /**
  15609. * @en Value at column 1 row 2 of the matrix.
  15610. * @zh 矩阵第 1 列第 2 行的元素。
  15611. */
  15612. m05: number;
  15613. /**
  15614. * @en Value at column 2 row 0 of the matrix.
  15615. * @zh 矩阵第 2 列第 0 行的元素。
  15616. */
  15617. m06: number;
  15618. /**
  15619. * @en Value at column 2 row 1 of the matrix.
  15620. * @zh 矩阵第 2 列第 1 行的元素。
  15621. */
  15622. m07: number;
  15623. /**
  15624. * @en Value at column 2 row 2 of the matrix.
  15625. * @zh 矩阵第 2 列第 2 行的元素。
  15626. */
  15627. m08: number;
  15628. constructor(other: Mat3);
  15629. constructor(m00?: number, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number);
  15630. /**
  15631. * @en Clone a new matrix from the current matrix.
  15632. * @zh 克隆当前矩阵。
  15633. */
  15634. clone(): Mat3;
  15635. /**
  15636. * @en Sets the matrix with another one's value.
  15637. * @zh 设置当前矩阵使其与指定矩阵相等。
  15638. * @param other Specified matrix
  15639. * @return this
  15640. */
  15641. set(other: Mat3): Mat3;
  15642. /**
  15643. * @en Set the matrix with values of all elements
  15644. * @zh 设置当前矩阵指定元素值。
  15645. * @return this
  15646. */
  15647. set(m00?: number, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number): Mat3;
  15648. /**
  15649. * @en Returns whether the specified matrices are approximately equal.
  15650. * @zh 判断当前矩阵是否在误差范围内与指定矩阵相等。
  15651. * @param other Comparative matrix
  15652. * @param epsilon The error allowed. It`s should be a non-negative number.
  15653. * @return Returns `true' when the elements of both matrices are equal; otherwise returns `false'.
  15654. */
  15655. equals(other: Mat3, epsilon?: number): boolean;
  15656. /**
  15657. * @en Returns whether the specified matrices are equal.
  15658. * @zh 判断当前矩阵是否与指定矩阵相等。
  15659. * @param other Comparative matrix
  15660. * @return Returns `true' when the elements of both matrices are equal; otherwise returns `false'.
  15661. */
  15662. strictEquals(other: Mat3): boolean;
  15663. /**
  15664. * @en Returns a string representation of a matrix.
  15665. * @zh 返回当前矩阵的字符串表示。
  15666. * @return The string representation of this matrix
  15667. */
  15668. toString(): string;
  15669. /**
  15670. * @en set the current matrix to an identity matrix.
  15671. * @zh 将当前矩阵设为单位矩阵。
  15672. * @return `this`
  15673. */
  15674. identity(): Mat3;
  15675. /**
  15676. * @en Transposes the current matrix.
  15677. * @zh 计算当前矩阵的转置矩阵。
  15678. */
  15679. transpose(): Mat3;
  15680. /**
  15681. * @en Inverts the current matrix. When matrix is not invertible the matrix will be set to zeros.
  15682. * @zh 计算当前矩阵的逆矩阵。注意,在矩阵不可逆时,会返回一个全为 0 的矩阵。
  15683. */
  15684. invert(): Mat3;
  15685. /**
  15686. * @en Calculates the determinant of the current matrix.
  15687. * @zh 计算当前矩阵的行列式。
  15688. * @return 当前矩阵的行列式。
  15689. */
  15690. determinant(): number;
  15691. /**
  15692. * @en Adds the current matrix and another matrix to the current matrix.
  15693. * @zh 矩阵加法。将当前矩阵与指定矩阵的相加,结果返回给当前矩阵。
  15694. * @param mat the second operand
  15695. */
  15696. add(mat: Mat3): Mat3;
  15697. /**
  15698. * @en Subtracts another matrix from the current matrix.
  15699. * @zh 计算矩阵减法。将当前矩阵减去指定矩阵的结果赋值给当前矩阵。
  15700. * @param mat the second operand
  15701. */
  15702. subtract(mat: Mat3): Mat3;
  15703. /**
  15704. * @en Multiply the current matrix with another matrix.
  15705. * @zh 矩阵乘法。将当前矩阵左乘指定矩阵的结果赋值给当前矩阵。
  15706. * @param mat the second operand
  15707. */
  15708. multiply(mat: Mat3): Mat3;
  15709. /**
  15710. * @en Multiply each element of the current matrix by a scalar number.
  15711. * @zh 矩阵数乘。将当前矩阵与指定标量的数乘结果赋值给当前矩阵。
  15712. * @param scalar amount to scale the matrix's elements by
  15713. */
  15714. multiplyScalar(scalar: number): Mat3;
  15715. /**
  15716. * @en Multiply the current matrix with a scale matrix given by a scale vector, that is M * S(vec).
  15717. * @zh 将当前矩阵左乘缩放矩阵的结果赋值给当前矩阵,缩放矩阵由各个轴的缩放给出,即M * S(vec)。
  15718. * @param vec vector to scale by
  15719. */
  15720. scale(vec: Vec3): Mat3;
  15721. /**
  15722. * @en Rotates the current matrix by the given angle, that is M * R(rad).
  15723. * @zh 将当前矩阵左乘旋转矩阵的结果赋值给当前矩阵,旋转矩阵由旋转轴和旋转角度给出,即M * R(rad)。
  15724. * @param rad radian of rotation
  15725. */
  15726. rotate(rad: number): Mat3;
  15727. /**
  15728. * @en Resets the current matrix from the given quaternion.
  15729. * @zh 重置当前矩阵的值,使其表示指定四元数表示的旋转变换。
  15730. * @param q The quaternion.
  15731. * @returns this
  15732. */
  15733. fromQuat(q: Quat): Mat3;
  15734. }
  15735. /**
  15736. * @en Mathematical 4x4 matrix.
  15737. * @zh 表示四维(4x4)矩阵。
  15738. */
  15739. export class Mat4 extends ValueType {
  15740. static IDENTITY: Readonly<Mat4>;
  15741. /**
  15742. * @en Clone a matrix and save the results to out matrix
  15743. * @zh 获得指定矩阵的拷贝
  15744. */
  15745. static clone(a: IMat4Like): Mat4;
  15746. /**
  15747. * @en Copy a matrix into the out matrix
  15748. * @zh 复制目标矩阵
  15749. */
  15750. static copy<Out extends IMat4Like>(out: Out, a: Out): Out;
  15751. /**
  15752. * @en Sets a matrix with the given values and save the results to out matrix
  15753. * @zh 设置矩阵值
  15754. *
  15755. * @param out The receive matrix
  15756. * @param m00 Component in column 0, row 0 position (index 0)
  15757. * @param m01 Component in column 0, row 1 position (index 1)
  15758. * @param m02 Component in column 0, row 2 position (index 2)
  15759. * @param m03 Component in column 0, row 3 position (index 3)
  15760. * @param m10 Component in column 1, row 0 position (index 4)
  15761. * @param m11 Component in column 1, row 1 position (index 5)
  15762. * @param m12 Component in column 1, row 2 position (index 6)
  15763. * @param m13 Component in column 1, row 3 position (index 7)
  15764. * @param m20 Component in column 2, row 0 position (index 8)
  15765. * @param m21 Component in column 2, row 1 position (index 9)
  15766. * @param m22 Component in column 2, row 2 position (index 10)
  15767. * @param m23 Component in column 2, row 3 position (index 11)
  15768. * @param m30 Component in column 3, row 0 position (index 12)
  15769. * @param m31 Component in column 3, row 1 position (index 13)
  15770. * @param m32 Component in column 3, row 2 position (index 14)
  15771. * @param m33 Component in column 3, row 3 position (index 15)
  15772. * @returns The receive matrix
  15773. */
  15774. static set<Out extends IMat4Like>(out: Out, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Out;
  15775. /**
  15776. * @en return an identity matrix.
  15777. * @zh 将目标赋值为单位矩阵
  15778. */
  15779. static identity<Out extends IMat4Like>(out: Out): Out;
  15780. /**
  15781. * @en Transposes a matrix and save the results to out matrix
  15782. * @zh 转置矩阵
  15783. */
  15784. static transpose<Out extends IMat4Like>(out: Out, a: Out): Out;
  15785. /**
  15786. * @en Inverts a matrix. When matrix is not invertible the matrix will be set to zeros.
  15787. * @zh 矩阵求逆,注意,在矩阵不可逆时,会返回一个全为 0 的矩阵。
  15788. */
  15789. static invert<Out extends IMat4Like>(out: Out, a: Out): Out;
  15790. /**
  15791. * @en Calculates the determinant of a matrix
  15792. * @zh 矩阵行列式
  15793. */
  15794. static determinant<InType extends IMat4Like>(a: InType): number;
  15795. /**
  15796. * @en Multiply two matrices and save the results to out matrix, (out = a * b)
  15797. * @zh 矩阵乘法 (out = a * b)
  15798. *
  15799. * @param out The out matrix
  15800. * @param a The first operand
  15801. * @param b The second operand
  15802. * @returns out matrix
  15803. */
  15804. static multiply<Out extends IMat4Like>(out: Out, a: Out, b: Out): Out;
  15805. /**
  15806. * @en Translate a matrix with the given vector and save results to the out matrix, the translate is applied before the matrix, i.e. (out = a * T)
  15807. * @zh 在给定矩阵变换基础上加入平移变换,并将结果保存到 out 矩阵中,平移变换将应用在矩阵变换之前,即 (out = a * T)
  15808. *
  15809. * @param out The out matrix
  15810. * @param a The matrix to translate
  15811. * @param v The vector to translate with
  15812. */
  15813. static transform<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): Out;
  15814. /**
  15815. * @en Transform a matrix with the given translation vector and save results to the out matrix,
  15816. * the translate is applied after the transformation, i.e. (out = T * a)
  15817. * @zh 在给定矩阵变换基础上加入新位移变换,平移变换在变换之后应用,即 (out = T * a)
  15818. *
  15819. * @param out The out matrix
  15820. * @param a The matrix to translate
  15821. * @param v The vector to translate with
  15822. * @deprecated Since 3.8.0, please use [[transform]] instead
  15823. */
  15824. static translate<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): Out;
  15825. /**
  15826. * @en Multiply a matrix with a scale matrix given by a scale vector and save the results into the out matrix,
  15827. * the scale is applied before the matrix, i.e. (out = a * S)
  15828. * @zh 在给定矩阵变换基础上加入新缩放变换,并将结果保存到 out 矩阵中,缩放变换将应用在矩阵变换之前,即 (out = a * S)
  15829. */
  15830. static scale<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, a: Out, v: VecLike): Out;
  15831. /**
  15832. * @en Rotates the transform by the given angle and save the results into the out matrix, the rotate is applied before
  15833. * the matrix, i.e. (out = a * R)
  15834. * @zh 在给定矩阵变换基础上加入新旋转变换, 并将结果保存到 out 矩阵中,旋转变换将应用在矩阵变换之前,即 (out = a * R)
  15835. * @param rad Angle of rotation (in radians)
  15836. * @param axis axis of rotation
  15837. */
  15838. static rotate<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, a: Out, rad: number, axis: VecLike): Out | null;
  15839. /**
  15840. * @en Transform a matrix with a given angle around X axis and save the results to the out matrix, the rotate is applied
  15841. * before the matrix, i.e. (out = a * R)
  15842. * @zh 在给定矩阵变换基础上加入绕 X 轴的旋转变换, 并将结果保存到 out 矩阵中,旋转变换将应用在矩阵变换之前,即 (out = a * R)
  15843. * @param rad Angle of rotation (in radians)
  15844. */
  15845. static rotateX<Out extends IMat4Like>(out: Out, a: Out, rad: number): Out;
  15846. /**
  15847. * @en Transform a matrix with a given angle around Y axis and save the results to the out matrix
  15848. * @zh 在给定矩阵变换基础上加入绕 Y 轴的旋转变换
  15849. * @param rad Angle of rotation (in radians)
  15850. */
  15851. static rotateY<Out extends IMat4Like>(out: Out, a: Out, rad: number): Out;
  15852. /**
  15853. * @en Transform a matrix with a given angle around Z axis and save the results to the out matrix
  15854. * @zh 在给定矩阵变换基础上加入绕 Z 轴的旋转变换
  15855. * @param rad Angle of rotation (in radians)
  15856. */
  15857. static rotateZ<Out extends IMat4Like>(out: Out, a: Out, rad: number): Out;
  15858. /**
  15859. * @en Sets the out matrix with a translation vector
  15860. * @zh 计算位移矩阵
  15861. */
  15862. static fromTranslation<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, v: VecLike): Out;
  15863. /**
  15864. * @en Sets the out matrix with a scale vector
  15865. * @zh 计算缩放矩阵
  15866. */
  15867. static fromScaling<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, v: VecLike): Out;
  15868. /**
  15869. * @en Sets the out matrix with rotation angle
  15870. * @zh 计算旋转矩阵
  15871. */
  15872. static fromRotation<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, rad: number, axis: VecLike): Out | null;
  15873. /**
  15874. * @en Calculates the matrix representing a rotation around the X axis
  15875. * @zh 计算绕 X 轴的旋转矩阵
  15876. */
  15877. static fromXRotation<Out extends IMat4Like>(out: Out, rad: number): Out;
  15878. /**
  15879. * @en Calculates the matrix representing a rotation around the Y axis
  15880. * @zh 计算绕 Y 轴的旋转矩阵
  15881. */
  15882. static fromYRotation<Out extends IMat4Like>(out: Out, rad: number): Out;
  15883. /**
  15884. * @en Calculates the matrix representing a rotation around the Z axis
  15885. * @zh 计算绕 Z 轴的旋转矩阵
  15886. */
  15887. static fromZRotation<Out extends IMat4Like>(out: Out, rad: number): Out;
  15888. /**
  15889. * @en Calculates the transform representing the combination of a rotation and a translation, and stores the result in out.
  15890. * The order is rotation then translation.
  15891. * @zh 根据旋转和位移信息计算矩阵
  15892. */
  15893. static fromRT<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, q: Quat, v: VecLike): Out;
  15894. /**
  15895. * @en Extracts the translation from the matrix, assuming it's composed in order of scale, rotation, translation
  15896. * @zh 提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  15897. */
  15898. static getTranslation<InType extends IMat4Like, VecLike extends IVec3Like>(out: VecLike, mat: InType): VecLike;
  15899. /**
  15900. * @en Extracts the scale vector from the matrix, assuming it's composed in order of scale, rotation, translation
  15901. * @zh 提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  15902. */
  15903. static getScaling<InType extends IMat4Like, VecLike extends IVec3Like>(out: VecLike, mat: InType): VecLike;
  15904. /**
  15905. * @en Extracts the rotation from the matrix, assuming it's composed in order of scale, rotation, translation
  15906. * @zh 提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用 `toRTS` 函数。
  15907. */
  15908. static getRotation<InType extends IMat4Like>(out: Quat, mat: InType): Quat;
  15909. /**
  15910. * @en Extracts the scale, rotation and translation from the matrix, assuming it's composed in order of scale, rotation, translation
  15911. * @zh 提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  15912. *
  15913. * @param m The input transform matrix
  15914. * @param q The corresponding rotation quat
  15915. * @param v The corresponding translate vector
  15916. * @param s The corresponding scaling vector
  15917. *
  15918. * @deprecated Since 3.8.0, please use toSRT instead
  15919. */
  15920. static toRTS<InType extends IMat4Like, VecLike extends IVec3Like>(m: InType, q: Quat | null, v: VecLike | null, s: VecLike | null): void;
  15921. /**
  15922. * @en Extracts the scale, rotation and translation from the matrix, assuming it's composed in order of scale, rotation, translation
  15923. * @zh 提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  15924. *
  15925. * @param m The input transform matrix
  15926. * @param q The corresponding rotation quat
  15927. * @param v The corresponding translate vector
  15928. * @param s The corresponding scaling vector
  15929. */
  15930. static toSRT<InType extends IMat4Like, VecLike extends IVec3Like>(m: InType, q: Quat | null, v: VecLike | null, s: VecLike | null): void;
  15931. /**
  15932. * @en Convert Matrix to euler angle, resulting angle y, z in the range of [-PI, PI],
  15933. * x in the range of [-PI/2, PI/2], the rotation order is YXZ.
  15934. * @zh 将矩阵转换为欧拉角,结果角度 y, z 在 [-PI, PI] 范围内,x 在 [-PI/2, PI/2] 区间内,旋转顺序为 YXZ.
  15935. */
  15936. static toEuler<InType extends IMat4Like, VecLike extends IVec3Like>(m: InType, v: VecLike): boolean;
  15937. /**
  15938. * @en Compose a matrix from scale, rotation and translation, applied in order.
  15939. * @zh 根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
  15940. * @deprecated Since 3.8.0, please use [[fromSRT]] instead.
  15941. */
  15942. static fromRTS<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, q: Quat, v: VecLike, s: VecLike): Out;
  15943. /**
  15944. * @en Compose a matrix from scale, rotation and translation, applied in order.
  15945. * @zh 根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
  15946. * @param out The receiving matrix
  15947. * @param q Rotation quaternion
  15948. * @param v Translation vector
  15949. * @param s Scaling vector
  15950. * @returns The receiving matrix
  15951. */
  15952. static fromSRT<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, q: Quat, v: VecLike, s: VecLike): Out;
  15953. /**
  15954. * @en Compose a matrix from scale, rotation and translation, applied in order, from a given origin
  15955. * @zh 根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用
  15956. * @param q Rotation quaternion
  15957. * @param v Translation vector
  15958. * @param s Scaling vector
  15959. * @param o transformation Center
  15960. * @deprecated Please use [[fromSRTOrigin]] instead.
  15961. */
  15962. static fromRTSOrigin<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike): Out;
  15963. /**
  15964. * @en Compose a matrix from scale, rotation and translation, applied in order, from a given origin
  15965. * @zh 根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 O^{-1}->S->R->O->T 的顺序应用
  15966. * @param out The receiving matrix
  15967. * @param q Rotation quaternion
  15968. * @param v Translation vector
  15969. * @param s Scaling vector
  15970. * @param o transformation Center
  15971. * @returns The receiving matrix
  15972. */
  15973. static fromSRTOrigin<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike): Out;
  15974. /**
  15975. * @en Sets the out matrix with the given quaternion
  15976. * @zh 根据指定的旋转信息计算矩阵
  15977. */
  15978. static fromQuat<Out extends IMat4Like>(out: Out, q: Quat): Out;
  15979. /**
  15980. * @en Calculates the matrix representing the given frustum
  15981. * @zh 根据指定的视锥体信息计算矩阵
  15982. * @param out The receiving matrix.
  15983. * @param left The X coordinate of the left side of the near projection plane in view space.
  15984. * @param right The X coordinate of the right side of the near projection plane in view space.
  15985. * @param bottom The Y coordinate of the bottom side of the near projection plane in view space.
  15986. * @param top The Y coordinate of the top side of the near projection plane in view space.
  15987. * @param near Z distance to the near plane from the origin in view space.
  15988. * @param far Z distance to the far plane from the origin in view space.
  15989. *
  15990. * @return The receiving matrix.
  15991. */
  15992. static frustum<Out extends IMat4Like>(out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out;
  15993. /**
  15994. * @en Calculates perspective projection matrix
  15995. * @zh 计算透视投影矩阵
  15996. * @param out The receiving matrix.
  15997. * @param fovy Vertical field-of-view in degrees.
  15998. * @param aspect Aspect ratio
  15999. * @param near Near depth clipping plane value.
  16000. * @param far Far depth clipping plane value.
  16001. * @param isFOVY Whether the fovy is based on the vertical field-of-view.
  16002. * @param minClipZ The minimum value of the near clipping plane, e.g. -1 for OpenGL, 0 for Vulkan and Metal.
  16003. * @param projectionSignY The sign of the Y axis of the projection matrix, which is used to flip the Y axis.
  16004. * @param orientation The orientation of the projection matrix, which is used to rotate the projection matrix.
  16005. *
  16006. * @return The receiving matrix.
  16007. */
  16008. static perspective<Out extends IMat4Like>(out: Out, fov: number, aspect: number, near: number, far: number, isFOVY?: boolean, minClipZ?: number, projectionSignY?: number, orientation?: number): Out;
  16009. /**
  16010. * @en Calculates orthogonal projection matrix
  16011. * @zh 计算正交投影矩阵
  16012. * @param out The receiving matrix.
  16013. * @param left Left-side x-coordinate.
  16014. * @param right Right-side x-coordinate.
  16015. * @param bottom Bottom y-coordinate.
  16016. * @param top Top y-coordinate.
  16017. * @param near Near depth clipping plane value.
  16018. * @param far Far depth clipping plane value.
  16019. * @param minClipZ The minimum value of the near clipping plane, e.g. -1 for OpenGL, 0 for Vulkan and Metal.
  16020. * @param projectionSignY The sign of the Y axis of the projection matrix, which is used to flip the Y axis.
  16021. * @param orientation The orientation of the projection matrix, which is used to rotate the projection matrix.
  16022. *
  16023. * @return The receiving matrix.
  16024. */
  16025. static ortho<Out extends IMat4Like>(out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number, minClipZ?: number, projectionSignY?: number, orientation?: number): Out;
  16026. /**
  16027. * @en
  16028. * Calculates the matrix with the view point information, given by eye position, target center and the up vector.
  16029. * Note that center to eye vector can't be zero or parallel to the up vector
  16030. * @zh
  16031. * 计算视图矩阵,给定眼睛位置、目标中心和上向量。注意,中心到眼睛向量不能为零或与上向量平行。
  16032. * @out The receiving matrix.
  16033. * @param eye The source point.
  16034. * @param center The target point.
  16035. * @param up The vector describing the up direction.
  16036. * @return The receiving matrix.
  16037. */
  16038. static lookAt<Out extends IMat4Like, VecLike extends IVec3Like>(out: Out, eye: VecLike, center: VecLike, up: VecLike): Out;
  16039. /**
  16040. * @en Calculates the inverse transpose of a matrix and save the results to out matrix
  16041. * @zh 计算逆转置矩阵
  16042. *
  16043. * @deprecated This function is too complicated, and should be split into several functions.
  16044. */
  16045. static inverseTranspose<Out extends IMat4Like>(out: Out, a: Out): Out | null;
  16046. /**
  16047. * @en Transform a matrix object to a flat array
  16048. * @zh 矩阵转数组
  16049. * @param ofs Array Start Offset
  16050. */
  16051. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, m: IMat4Like, ofs?: number): Out;
  16052. /**
  16053. * @en Generates or sets a matrix with a flat array
  16054. * @zh 数组转矩阵
  16055. * @param ofs Array Start Offset
  16056. */
  16057. static fromArray<Out extends IMat4Like>(out: Out, arr: __private.__types_globals__IWritableArrayLike<number>, ofs?: number): Out;
  16058. /**
  16059. * @en Adds two matrices and save the results to out matrix
  16060. * @zh 逐元素矩阵加法
  16061. */
  16062. static add<Out extends IMat4Like>(out: Out, a: Out, b: Out): Out;
  16063. /**
  16064. * @en Subtracts matrix b from matrix a and save the results to out matrix
  16065. * @zh 逐元素矩阵减法
  16066. */
  16067. static subtract<Out extends IMat4Like>(out: Out, a: Out, b: Out): Out;
  16068. /**
  16069. * @en Multiply each element of a matrix by a scalar number and save the results to out matrix
  16070. * @zh 矩阵标量乘法
  16071. */
  16072. static multiplyScalar<Out extends IMat4Like>(out: Out, a: Out, b: number): Out;
  16073. /**
  16074. * @en Adds two matrices after multiplying each element of the second operand by a scalar number. And save the results to out matrix.
  16075. * @zh 逐元素矩阵标量乘加: A + B * scale
  16076. */
  16077. static multiplyScalarAndAdd<Out extends IMat4Like>(out: Out, a: Out, b: Out, scale: number): Out;
  16078. /**
  16079. * @en Returns whether the specified matrices are equal.
  16080. * @zh 矩阵等价判断
  16081. */
  16082. static strictEquals<InType extends IMat4Like>(a: InType, b: InType): boolean;
  16083. /**
  16084. * @en Returns whether the specified matrices are approximately equal.
  16085. * @zh 排除浮点数误差的矩阵近似等价判断
  16086. *
  16087. * @param a The first matrix to be compared.
  16088. * @param b The second matrix to be compared.
  16089. * @param epsilon The tolerance value.
  16090. * @return
  16091. */
  16092. static equals<InType extends IMat4Like>(a: InType, b: InType, epsilon?: number): boolean;
  16093. /**
  16094. * matrix layout
  16095. * |m00 m04 m08 m12|
  16096. * |m01 m05 m09 m13|
  16097. * |m02 m06 m10 m14|
  16098. * |m03 m07 m11 m15|
  16099. */
  16100. /**
  16101. * @en Value at column 0 row 0 of the matrix.
  16102. * @zh 矩阵第 0 列第 0 行的元素。
  16103. */
  16104. m00: number;
  16105. /**
  16106. * @en Value at column 0 row 1 of the matrix.
  16107. * @zh 矩阵第 0 列第 1 行的元素。
  16108. */
  16109. m01: number;
  16110. /**
  16111. * @en Value at column 0 row 2 of the matrix.
  16112. * @zh 矩阵第 0 列第 2 行的元素。
  16113. */
  16114. m02: number;
  16115. /**
  16116. * @en Value at column 0 row 3 of the matrix.
  16117. * @zh 矩阵第 0 列第 3 行的元素。
  16118. */
  16119. m03: number;
  16120. /**
  16121. * @en Value at column 1 row 0 of the matrix.
  16122. * @zh 矩阵第 1 列第 0 行的元素。
  16123. */
  16124. m04: number;
  16125. /**
  16126. * @en Value at column 1 row 1 of the matrix.
  16127. * @zh 矩阵第 1 列第 1 行的元素。
  16128. */
  16129. m05: number;
  16130. /**
  16131. * @en Value at column 1 row 2 of the matrix.
  16132. * @zh 矩阵第 1 列第 2 行的元素。
  16133. */
  16134. m06: number;
  16135. /**
  16136. * @en Value at column 1 row 3 of the matrix.
  16137. * @zh 矩阵第 1 列第 3 行的元素。
  16138. */
  16139. m07: number;
  16140. /**
  16141. * @en Value at column 2 row 0 of the matrix.
  16142. * @zh 矩阵第 2 列第 0 行的元素。
  16143. */
  16144. m08: number;
  16145. /**
  16146. * @en Value at column 2 row 1 of the matrix.
  16147. * @zh 矩阵第 2 列第 1 行的元素。
  16148. */
  16149. m09: number;
  16150. /**
  16151. * @en Value at column 2 row 2 of the matrix.
  16152. * @zh 矩阵第 2 列第 2 行的元素。
  16153. */
  16154. m10: number;
  16155. /**
  16156. * @en Value at column 2 row 3 of the matrix.
  16157. * @zh 矩阵第 2 列第 3 行的元素。
  16158. */
  16159. m11: number;
  16160. /**
  16161. * @en Value at column 3 row 0 of the matrix.
  16162. * @zh 矩阵第 3 列第 0 行的元素。
  16163. */
  16164. m12: number;
  16165. /**
  16166. * @en Value at column 3 row 1 of the matrix.
  16167. * @zh 矩阵第 3 列第 1 行的元素。
  16168. */
  16169. m13: number;
  16170. /**
  16171. * @en Value at column 3 row 2 of the matrix.
  16172. * @zh 矩阵第 3 列第 2 行的元素。
  16173. */
  16174. m14: number;
  16175. /**
  16176. * @en Value at column 3 row 3 of the matrix.
  16177. * @zh 矩阵第 3 列第 3 行的元素。
  16178. */
  16179. m15: number;
  16180. constructor(other: Mat4);
  16181. constructor(m00?: number, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number, m09?: number, m10?: number, m11?: number, m12?: number, m13?: number, m14?: number, m15?: number);
  16182. /**
  16183. * @en Clone a new matrix from the current matrix.
  16184. * @zh 克隆当前矩阵。
  16185. */
  16186. clone(): Mat4;
  16187. /**
  16188. * @en Sets the matrix with another one's value.
  16189. * @zh 设置当前矩阵使其与指定矩阵相等。
  16190. * @param other Specified matrix.
  16191. * @return this
  16192. */
  16193. set(other: Mat4): Mat4;
  16194. /**
  16195. * @en Set the matrix with values of all elements
  16196. * @zh 设置当前矩阵指定元素值。
  16197. *
  16198. * @return this
  16199. */
  16200. set(m00?: number, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number, m09?: number, m10?: number, m11?: number, m12?: number, m13?: number, m14?: number, m15?: number): Mat4;
  16201. /**
  16202. * @en Returns whether the specified matrices are approximately equal.
  16203. * @zh 判断当前矩阵是否在误差范围内与指定矩阵相等。
  16204. * @param other Comparative matrix
  16205. * @param epsilon The error allowed. It`s should be a non-negative number.
  16206. * @return Returns `true' when the elements of both matrices are equal; otherwise returns `false'.
  16207. */
  16208. equals(other: Mat4, epsilon?: number): boolean;
  16209. /**
  16210. * @en Returns whether the specified matrices are equal.
  16211. * @zh 判断当前矩阵是否与指定矩阵相等。
  16212. * @param other Comparative matrix
  16213. * @return Returns `true' when the elements of both matrices are equal; otherwise returns `false'.
  16214. */
  16215. strictEquals(other: Mat4): boolean;
  16216. /**
  16217. * @en Returns a string representation of a matrix.
  16218. * @zh 返回当前矩阵的字符串表示。
  16219. * @return 当前矩阵的字符串表示。
  16220. */
  16221. toString(): string;
  16222. /**
  16223. * @en set the current matrix to an identity matrix.
  16224. * @zh 将当前矩阵设为单位矩阵。
  16225. * @return `this`
  16226. */
  16227. identity(): Mat4;
  16228. /**
  16229. * @en set the current matrix to an zero matrix.
  16230. * @zh 将当前矩阵设为 0矩阵。
  16231. * @return `this`
  16232. */
  16233. zero(): Mat4;
  16234. /**
  16235. * @en Transposes the current matrix.
  16236. * @zh 计算当前矩阵的转置矩阵。
  16237. */
  16238. transpose(): Mat4;
  16239. /**
  16240. * @en Inverts the current matrix. When matrix is not invertible the matrix will be set to zeros.
  16241. * @zh 计算当前矩阵的逆矩阵。注意,在矩阵不可逆时,会返回一个全为 0 的矩阵。
  16242. */
  16243. invert(): Mat4;
  16244. /**
  16245. * @en Calculates the determinant of the current matrix.
  16246. * @zh 计算当前矩阵的行列式。
  16247. * @return 当前矩阵的行列式。
  16248. */
  16249. determinant(): number;
  16250. /**
  16251. * @en Adds the current matrix and another matrix to the current matrix.
  16252. * @zh 矩阵加法。将当前矩阵与指定矩阵的相加,结果返回给当前矩阵。
  16253. * @param mat the second operand
  16254. */
  16255. add(mat: Mat4): Mat4;
  16256. /**
  16257. * @en Subtracts another matrix from the current matrix.
  16258. * @zh 计算矩阵减法。将当前矩阵减去指定矩阵的结果赋值给当前矩阵。
  16259. * @param mat the second operand
  16260. */
  16261. subtract(mat: Mat4): Mat4;
  16262. /**
  16263. * @en Multiply the current matrix with another matrix.
  16264. * @zh 矩阵乘法。将当前矩阵左乘指定矩阵的结果赋值给当前矩阵。
  16265. * @param mat the second operand
  16266. */
  16267. multiply(mat: Mat4): Mat4;
  16268. /**
  16269. * @en Multiply each element of the current matrix by a scalar number.
  16270. * @zh 矩阵数乘。将当前矩阵与指定标量的数乘结果赋值给当前矩阵。
  16271. * @param scalar amount to scale the matrix's elements by
  16272. */
  16273. multiplyScalar(scalar: number): Mat4;
  16274. /**
  16275. * @en Translate the current matrix by the given vector
  16276. * @zh 将当前矩阵左乘位移矩阵的结果赋值给当前矩阵,位移矩阵由各个轴的位移给出。
  16277. * @param vec vector to translate by
  16278. *
  16279. * @deprecated since v3.0, please use [[transform]] instead
  16280. */
  16281. translate(vec: Vec3): Mat4;
  16282. /**
  16283. * @en Translate the current matrix by the given vector
  16284. * @zh 将当前矩阵左乘位移矩阵的结果赋值给当前矩阵,位移矩阵由各个轴的位移给出。
  16285. * @param vec vector to translate by
  16286. */
  16287. transform(vec: Vec3): Mat4;
  16288. /**
  16289. * @en Multiply the current matrix with a scale vector.
  16290. * @zh 将当前矩阵左乘缩放矩阵的结果赋值给当前矩阵,缩放矩阵由各个轴的缩放给出。
  16291. * @param vec vector to scale by
  16292. */
  16293. scale(vec: Vec3): Mat4;
  16294. /**
  16295. * @en Rotates the current matrix by the given angle around the given axis
  16296. * @zh 将当前矩阵左乘旋转矩阵的结果赋值给当前矩阵,旋转矩阵由旋转轴和旋转角度给出。
  16297. * @param rad Angle of rotation (in radians)
  16298. * @param axis Axis of rotation
  16299. */
  16300. rotate(rad: number, axis: Vec3): Mat4 | null;
  16301. /**
  16302. * @en Returns the translation vector component of a transformation matrix.
  16303. * @zh 从当前矩阵中计算出位移变换的部分,并以各个轴上位移的形式赋值给输出向量。
  16304. * @param out Vector to receive translation component.
  16305. */
  16306. getTranslation(out: Vec3): Vec3;
  16307. /**
  16308. * @en Returns the scale factor component of a transformation matrix
  16309. * @zh 从当前矩阵中计算出缩放变换的部分,并以各个轴上缩放的形式赋值给输出向量。
  16310. * @param out Vector to receive scale component
  16311. */
  16312. getScale(out: Vec3): Vec3;
  16313. /**
  16314. * @en Returns the rotation factor component of a transformation matrix
  16315. * @zh 从当前矩阵中计算出旋转变换的部分,并以四元数的形式赋值给输出四元数。
  16316. * @param out Vector to receive rotation component
  16317. */
  16318. getRotation(out: Quat): Quat;
  16319. /**
  16320. * @en Resets the matrix values by the given rotation quaternion, translation vector and scale vector
  16321. * @zh 重置当前矩阵的值,使其表示指定的旋转、缩放、位移依次组合的变换。
  16322. * @param q Rotation quaternion
  16323. * @param v Translation vector
  16324. * @param s Scaling vector
  16325. * @return `this`
  16326. *
  16327. * @deprecated Since 3.8.0, please use [[fromSRT]] instead
  16328. */
  16329. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  16330. /**
  16331. * @en Resets the matrix values by the given rotation quaternion, translation vector and scale vector
  16332. * @zh 重置当前矩阵的值,使其表示指定的旋转、缩放、位移依次组合的变换。
  16333. * @param q Rotation quaternion
  16334. * @param v Translation vector
  16335. * @param s Scaling vector
  16336. * @return `this`
  16337. */
  16338. fromSRT(q: Quat, v: Vec3, s: Vec3): Mat4;
  16339. /**
  16340. * @en Resets the current matrix from the given quaternion.
  16341. * @zh 重置当前矩阵的值,使其表示指定四元数表示的旋转变换。
  16342. * @param q Rotation quaternion
  16343. * @return `this`
  16344. */
  16345. fromQuat(q: Quat): Mat4;
  16346. }
  16347. export function mat4(other: Mat4): Mat4;
  16348. export function mat4(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number): Mat4;
  16349. /**
  16350. * @en `AffineTransform` class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.
  16351. * @zh 二维仿射变换矩阵,描述了平移、旋转和缩放。
  16352. */
  16353. export class AffineTransform {
  16354. /**
  16355. * @en Create an identity transformation matrix.
  16356. * @zh 创建单位二维仿射变换矩阵,它不进行任何变换。
  16357. */
  16358. static identity(): AffineTransform;
  16359. /**
  16360. * @en Clone an `AffineTransform` object from the specified transform.
  16361. * @zh 克隆指定的二维仿射变换矩阵。
  16362. * @param affineTransform Specified `AffineTransform` objects
  16363. */
  16364. static clone(affineTransform: AffineTransform): AffineTransform;
  16365. /**
  16366. * @en Concatenate a transform matrix to another. The results are reflected in the out `AffineTransform`.
  16367. * First apply t1, then t2: out * v = t2 * (t1 * v).
  16368. * @zh 将两个矩阵相乘的结果赋值给输出矩阵,先应用t1再应用t2: out * v = t2 * (t1 * v)。
  16369. * @param out Out object to store the concat result
  16370. * @param t1 The first transform object.
  16371. * @param t2 The transform object to concatenate.
  16372. */
  16373. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): void;
  16374. /**
  16375. * @en Get the invert transform of an `AffineTransform` object.
  16376. * @zh 将矩阵求逆的结果赋值给输出矩阵。
  16377. * @param out Out object to store the invert result
  16378. * @param t the input `AffineTransform` object
  16379. */
  16380. static invert(out: AffineTransform, t: AffineTransform): void;
  16381. /**
  16382. * @en Get an `AffineTransform` object from a given matrix 4x4.
  16383. * @zh 将四维矩阵转换为二维仿射变换矩阵并赋值给输出矩阵。
  16384. * @param out The output matrix to store the result
  16385. * @param mat transform matrix.
  16386. */
  16387. static fromMat4(out: AffineTransform, mat: Mat4): void;
  16388. /**
  16389. * @en Apply the `AffineTransform` on a 2D vector.
  16390. * @zh 应用二维仿射变换矩阵到二维向量上,并将结果赋值给输出向量。
  16391. * @param out The output vector to store the result
  16392. * @param point Vector to apply transform.
  16393. * @param t transform matrix.
  16394. */
  16395. static transformVec2(out: Vec2, point: Vec2, t: AffineTransform): any;
  16396. /**
  16397. * @en Apply the `AffineTransform` on a 2D vector.
  16398. * @zh 应用二维仿射变换矩阵到二维向量上,并将结果赋值给输出向量。
  16399. * @param out The output vector to store the result
  16400. * @param x x to apply transform.
  16401. * @param y y to apply transform.
  16402. * @param t transform matrix.
  16403. */
  16404. static transformVec2(out: Vec2, x: number, y: number, t: AffineTransform): any;
  16405. /**
  16406. * @en Apply the `AffineTransform` on a size.
  16407. * @zh 应用二维仿射变换矩阵到二维尺寸上,并将结果赋值给输出尺寸。
  16408. * @param out The output size to store the result
  16409. * @param size The size to apply transform.
  16410. * @param t transform matrix.
  16411. */
  16412. static transformSize(out: Size, size: Size, t: AffineTransform): void;
  16413. /**
  16414. * @en Apply the `AffineTransform` on a rect.
  16415. * @zh 应用二维仿射变换矩阵到矩形上,并将结果赋值给输出矩形。
  16416. * @param out The output rect object to store the result
  16417. * @param rect The rect object to apply transform.
  16418. * @param t transform matrix.
  16419. */
  16420. static transformRect(out: Rect, rect: Rect, t: AffineTransform): void;
  16421. /**
  16422. * @en Apply the `AffineTransform` on a rect, and turns to an Oriented Bounding Box.
  16423. * This function does not allocate any memory, you should create the output vectors by yourself and manage their memory.
  16424. * @zh 应用二维仿射变换矩阵到矩形上, 并转换为有向包围盒。
  16425. * 这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  16426. * @param out_bl Output vector for storing the bottom left corner coordinates of the Obb object
  16427. * @param out_tl Output vector for storing the top left corner coordinates of the Obb object
  16428. * @param out_tr Output vector for storing the top right corner coordinates of the Obb object
  16429. * @param out_br Output vector for storing the bottom right corner coordinates of the Obb object
  16430. * @param rect The rect object to apply transform.
  16431. * @param anAffineTransform transform matrix.
  16432. */
  16433. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform, flipY?: boolean): void;
  16434. /**
  16435. * matrix layout
  16436. * |a c tx|
  16437. * |b d ty|
  16438. * |0 0 1 |
  16439. */
  16440. a: number;
  16441. b: number;
  16442. c: number;
  16443. d: number;
  16444. tx: number;
  16445. ty: number;
  16446. /**
  16447. * @en constructor an `AffineTransform` object.
  16448. * @zh 构造二维放射变换矩阵。
  16449. * @param a a
  16450. * @param b b
  16451. * @param c c
  16452. * @param d d
  16453. * @param tx tx
  16454. * @param ty ty
  16455. */
  16456. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  16457. }
  16458. /**
  16459. * @en Two dimensional size type representing the width and height.
  16460. * @zh 二维尺寸。
  16461. */
  16462. export class Size extends ValueType {
  16463. static ZERO: Readonly<Size>;
  16464. static ONE: Readonly<Size>;
  16465. /**
  16466. * @en Calculate the interpolation result between this size and another one with given ratio
  16467. * @zh 根据指定的插值比率,从当前尺寸到目标尺寸之间做插值。
  16468. * @param out Output Size.
  16469. * @param from Original Size.
  16470. * @param to Target Size.
  16471. * @param ratio The interpolation coefficient.The range is [0,1].
  16472. * @returns A vector consisting of linear interpolation of the width and height of the current size to the width and height of the target size at a specified interpolation ratio, respectively.
  16473. */
  16474. static lerp<Out extends ISizeLike>(out: Out, from: Out, to: Out, ratio: number): Out;
  16475. /**
  16476. * @en Check whether `Size` a is equal to `Size` b.
  16477. * @zh 判断两个尺寸是否相等。
  16478. * @param a Size a.
  16479. * @param b Size b.
  16480. * @returns Returns `true' when both dimensions are equal in width and height; otherwise returns `false'.
  16481. */
  16482. static equals<InType extends ISizeLike>(a: InType, b: InType): boolean;
  16483. set x(val: number);
  16484. get x(): number;
  16485. set y(val: number);
  16486. get y(): number;
  16487. width: number;
  16488. height: number;
  16489. /**
  16490. * @en Constructor a size from another one.
  16491. * @zh 构造与指定尺寸相等的尺寸。
  16492. * @param other Specified Size.
  16493. */
  16494. constructor(other: Size);
  16495. /**
  16496. * @en Constructor a size with specified values.
  16497. * @zh 构造具有指定宽度和高度的尺寸。
  16498. * @param width width of the Size, default value is 0.
  16499. * @param height height of the Size, default value is 0.
  16500. */
  16501. constructor(width?: number, height?: number);
  16502. /**
  16503. * @en clone the current `Size`.
  16504. * @zh 克隆当前尺寸。
  16505. */
  16506. clone(): Size;
  16507. /**
  16508. * @en Set values with another `Size`.
  16509. * @zh 设置当前尺寸使其与指定的尺寸相等。
  16510. * @param other Specified Size.
  16511. * @returns `this`
  16512. */
  16513. set(other: Size): any;
  16514. /**
  16515. * @en Set the value of each component of the current `Size`.
  16516. * @zh 设置当前尺寸的具体参数。
  16517. * @param width Specified width
  16518. * @param height Specified height
  16519. * @returns `this`
  16520. */
  16521. set(width?: number, height?: number): any;
  16522. /**
  16523. * @en Check whether the current `Size` equals another one.
  16524. * @zh 判断当前尺寸是否与指定尺寸的相等。
  16525. * @param other Specified Size
  16526. * @returns Returns `true' when both dimensions are equal in width and height; otherwise returns `false'.
  16527. */
  16528. equals(other: Size): boolean;
  16529. /**
  16530. * @en Calculate the interpolation result between this size and another one with given ratio
  16531. * @zh 根据指定的插值比率,从当前尺寸到目标尺寸之间做插值。
  16532. * @param to Target Size.
  16533. * @param ratio The interpolation coefficient.The range is [0,1].
  16534. */
  16535. lerp(to: Size, ratio: number): Size;
  16536. /**
  16537. * @en Return the information of the current size in string
  16538. * @zh 返回当前尺寸的字符串表示。
  16539. * @returns The information of the current size in string
  16540. */
  16541. toString(): string;
  16542. }
  16543. /**
  16544. * @en Constructs a `Size` object.
  16545. * @zh 等价于 `new Size(other)`。
  16546. * @param other Specified Size.
  16547. * @returns `new Size(other)`
  16548. */
  16549. export function size(other: Size): Size;
  16550. /**
  16551. * @en Constructs a `Size` object.
  16552. * @zh 等价于 `new Size(x, y)`。
  16553. * @param width Specified width
  16554. * @param height Specified height
  16555. * @returns `new Size(w, h)`
  16556. */
  16557. export function size(width?: number, height?: number): Size;
  16558. /**
  16559. * @en
  16560. * A 2D rectangle defined by x, y position at the bottom-left corner and width, height.
  16561. * All points inside the rectangle are greater than or equal to the minimum point and less than or equal to the maximum point.
  16562. * The width is defined as xMax - xMin and the height is defined as yMax - yMin.
  16563. * @zh
  16564. * 该类表示一个二维矩形,由其左下角的 x、y 坐标以及宽度和高度组成。
  16565. * 矩形内的所有点都大于等于矩形的最小点 (xMin, yMin) 并且小于等于矩形的最大点 (xMax, yMax)。
  16566. * 矩形的宽度定义为 xMax - xMin;高度定义为 yMax - yMin。
  16567. */
  16568. export class Rect extends ValueType {
  16569. /**
  16570. * @en Creates a rectangle from two coordinate values.
  16571. * @zh 由任意两个点创建一个矩形,目标矩形即是这两个点各向 x、y 轴作线所得到的矩形。
  16572. * @param v1 Specified point 1.
  16573. * @param v2 Specified point 2.
  16574. * @returns Target rectangle.
  16575. */
  16576. static fromMinMax<Out extends IRectLike, VecLike extends IVec2Like>(out: Out, v1: VecLike, v2: VecLike): Out;
  16577. /**
  16578. * @en Calculate the interpolation result between this rect and another one with given ratio
  16579. * @zh 根据指定的插值比率,从当前矩形到目标矩形之间做插值。
  16580. * @param out Output rect.
  16581. * @param from Original rect.
  16582. * @param to Target rect.
  16583. * @param ratio The interpolation coefficient.The range is [0,1].
  16584. */
  16585. static lerp<Out extends IRectLike>(out: Out, from: Out, to: Out, ratio: number): Out;
  16586. /**
  16587. * @en Returns the overlapping portion of 2 rectangles.
  16588. * @zh 计算当前矩形与指定矩形重叠部分的矩形,将其赋值给输出矩形。
  16589. * @param out Output Rect.
  16590. * @param one One of the specify Rect.
  16591. * @param other Another of the specify Rect.
  16592. */
  16593. static intersection<Out extends IRectLike>(out: Out, one: Out, other: Out): Out;
  16594. /**
  16595. * @en Returns the smallest rectangle that contains the current rect and the given rect.
  16596. * @zh 创建同时包含当前矩形和指定矩形的最小矩形,将其赋值给输出矩形。
  16597. * @param out Output Rect.
  16598. * @param one One of the specify Rect.
  16599. * @param other Another of the specify Rect.
  16600. */
  16601. static union<Out extends IRectLike>(out: Out, one: Out, other: Out): Out;
  16602. /**
  16603. * @en Returns whether rect a is equal to rect b.
  16604. * @zh 判断两个矩形是否相等。
  16605. * @param a The first rect to be compared.
  16606. * @param b The second rect to be compared.
  16607. * @returns Returns `true' when the minimum and maximum values of both rectangles are equal, respectively; otherwise, returns `false'.
  16608. */
  16609. static equals<InType extends IRectLike>(a: InType, b: InType): boolean;
  16610. /**
  16611. * @en The minimum x value.
  16612. * @zh 获取或设置矩形在 x 轴上的最小值。
  16613. */
  16614. get xMin(): number;
  16615. set xMin(value: number);
  16616. /**
  16617. * @en The minimum y value.
  16618. * @zh 获取或设置矩形在 y 轴上的最小值。
  16619. */
  16620. get yMin(): number;
  16621. set yMin(value: number);
  16622. /**
  16623. * @en The maximum x value.
  16624. * @zh 获取或设置矩形在 x 轴上的最大值。
  16625. */
  16626. get xMax(): number;
  16627. set xMax(value: number);
  16628. /**
  16629. * @en The maximum y value.
  16630. * @zh 获取或设置矩形在 y 轴上的最大值。
  16631. */
  16632. get yMax(): number;
  16633. set yMax(value: number);
  16634. /**
  16635. * @en The position of the center of the rectangle.
  16636. * @zh 获取或设置矩形中心点的坐标。
  16637. */
  16638. get center(): Vec2;
  16639. set center(value: Vec2);
  16640. /**
  16641. * @en Returns a new [[Vec2]] object representing the position of the rectangle
  16642. * @zh 获取或设置矩形的 x 和 y 坐标。
  16643. */
  16644. get origin(): Vec2;
  16645. set origin(value: Vec2);
  16646. /**
  16647. * @en Returns a new [[Size]] object represents the width and height of the rectangle
  16648. * @zh 获取或设置矩形的尺寸。
  16649. */
  16650. get size(): Size;
  16651. set size(value: Size);
  16652. set z(val: number);
  16653. get z(): number;
  16654. set w(val: number);
  16655. get w(): number;
  16656. /**
  16657. * @en The minimum x value.
  16658. * @zh 矩形最小点的 x 坐标。
  16659. */
  16660. x: number;
  16661. /**
  16662. * @en The minimum y value.
  16663. * @zh 矩形最小点的 y 坐标。
  16664. */
  16665. y: number;
  16666. /**
  16667. * @en The width of the Rect.
  16668. * @zh 矩形的宽度。
  16669. */
  16670. width: number;
  16671. /**
  16672. * @en The height of the Rect.
  16673. * @zh 矩形的高度。
  16674. */
  16675. height: number;
  16676. /**
  16677. * @en Constructs a Rect from another one.
  16678. * @zh 构造与指定矩形相等的矩形。
  16679. * @param other Specified Rect.
  16680. */
  16681. constructor(other: Rect);
  16682. /**
  16683. * @en Constructs a Rect with specified values.
  16684. * @zh 构造具有指定的最小值和尺寸的矩形。
  16685. * @param x The minimum X coordinate of the rectangle.
  16686. * @param y The minimum Y coordinate of the rectangle.
  16687. * @param width The width of the rectangle, measured from the X position.
  16688. * @param height The height of the rectangle, measured from the Y position.
  16689. */
  16690. constructor(x?: number, y?: number, width?: number, height?: number);
  16691. /**
  16692. * @en clone the current Rect.
  16693. * @zh 克隆当前矩形。
  16694. */
  16695. clone(): Rect;
  16696. /**
  16697. * @en Set values with another Rect.
  16698. * @zh 设置当前矩形使其与指定矩形相等。
  16699. * @param other Specified Rect.
  16700. * @returns `this`
  16701. */
  16702. set(other: Rect): any;
  16703. /**
  16704. * @en Set the value of each component of the current Rect.
  16705. * @zh 设置当前矩形使其与指定参数的矩形相等。
  16706. * @param x The x parameter of the specified rectangle
  16707. * @param y The y parameter of the specified rectangle
  16708. * @param width The width parameter of the specified rectangle
  16709. * @param height The height parameter of the specified rectangle
  16710. * @returns `this`
  16711. */
  16712. set(x?: number, y?: number, width?: number, height?: number): any;
  16713. /**
  16714. * @en Check whether the current Rect equals another one.
  16715. * @zh 判断当前矩形是否与指定矩形相等。
  16716. * @param other Specified rectangles.
  16717. * @returns Returns `true' when the minimum and maximum values of both rectangles are equal, respectively; otherwise, returns `false'.
  16718. */
  16719. equals(other: Rect): boolean;
  16720. /**
  16721. * @en Calculate the interpolation result between this Rect and another one with given ratio.
  16722. * @zh 根据指定的插值比率,从当前矩形到目标矩形之间做插值。
  16723. * @param to Target Rect.
  16724. * @param ratio The interpolation coefficient.The range is [0,1].
  16725. */
  16726. lerp(to: Rect, ratio: number): Rect;
  16727. /**
  16728. * @en Return the information of the current rect in string
  16729. * @zh 返回当前矩形的字符串表示。
  16730. * @returns The information of the current rect in string
  16731. */
  16732. toString(): string;
  16733. /**
  16734. * @en Check whether the current rectangle intersects with the given one.
  16735. * @zh 判断当前矩形是否与指定矩形相交。
  16736. * @param other Specified rectangles.
  16737. * @returns If intersected, return `true', otherwise return `false'.
  16738. */
  16739. intersects(other: Rect): boolean;
  16740. /**
  16741. * @en Check whether the current rect contains the given point.
  16742. * @zh 判断当前矩形是否包含指定的点。
  16743. * @param point Specified point.
  16744. * @returns The specified point is included in the rectangle and returns `true', otherwise it returns `false'.
  16745. */
  16746. contains(point: Vec2): boolean;
  16747. /**
  16748. * @en Returns true if the other rect entirely inside this rectangle.
  16749. * @zh 判断当前矩形是否包含指定矩形。
  16750. * @param other Specified rectangles.
  16751. * @returns Returns `true' if all the points of the specified rectangle are included in the current rectangle, `false' otherwise.
  16752. */
  16753. containsRect(other: Rect): boolean;
  16754. /**
  16755. * @en Apply matrix4 to the rect.
  16756. * @zh
  16757. * 应用矩阵变换到当前矩形:
  16758. * 应用矩阵变换到当前矩形的最小点得到新的最小点,
  16759. * 将当前矩形的尺寸视为二维向量应用矩阵变换得到新的尺寸;
  16760. * 并将如此构成的新矩形。
  16761. * @param matrix The matrix4
  16762. */
  16763. transformMat4(mat: Mat4): Rect;
  16764. /**
  16765. * @en
  16766. * Applies a matrix transformation to the current rectangle and outputs the result to the four vertices.
  16767. * @zh
  16768. * 应用矩阵变换到当前矩形,并将结果输出到四个顶点上。
  16769. *
  16770. * @param mat The mat4 to apply
  16771. * @param out_lb The left bottom point
  16772. * @param out_lt The left top point
  16773. * @param out_rb The right bottom point
  16774. * @param out_rt The right top point
  16775. */
  16776. transformMat4ToPoints(mat: Mat4, out_lb: Vec2, out_lt: Vec2, out_rt: Vec2, out_rb: Vec2): void;
  16777. }
  16778. /**
  16779. * @en The convenient method to create a new Rect.
  16780. * @zh 构造与指定矩形相等的矩形。等价于 `new Rect(rect)`。
  16781. * @param rect Specified Rect.
  16782. * @returns `new Rect(rect)`
  16783. */
  16784. export function rect(rect: Rect): Rect;
  16785. /**
  16786. * @en The convenient method to create a new Rect.
  16787. * @zh 构造具有指定的最小值和尺寸的矩形,等价于`new Rect(x, y, width, height)`。
  16788. * @param x The minimum X coordinate of the rectangle.
  16789. * @param y The minimum Y coordinate of the rectangle.
  16790. * @param width The width of the rectangle, measured from the X position.
  16791. * @param height The height of the rectangle, measured from the Y position.
  16792. * @returns `new Rect(x, y, width, height)`
  16793. */
  16794. export function rect(x?: number, y?: number, width?: number, height?: number): Rect;
  16795. /**
  16796. * @en Representation of RGBA colors.<br/>
  16797. * Each color component is an integer value with a range from 0 to 255.<br/>
  16798. * @zh 通过 Red、Green、Blue 颜色通道表示颜色,并通过 Alpha 通道表示不透明度。<br/>
  16799. * 每个通道都为取值范围 [0, 255] 的整数。<br/>
  16800. */
  16801. export class Color extends ValueType {
  16802. static WHITE: Readonly<Color>;
  16803. static GRAY: Readonly<Color>;
  16804. static BLACK: Readonly<Color>;
  16805. static TRANSPARENT: Readonly<Color>;
  16806. static RED: Readonly<Color>;
  16807. static GREEN: Readonly<Color>;
  16808. static BLUE: Readonly<Color>;
  16809. static CYAN: Readonly<Color>;
  16810. static MAGENTA: Readonly<Color>;
  16811. static YELLOW: Readonly<Color>;
  16812. /**
  16813. * @en Copy content of a color into another and save the results to out color.
  16814. * @zh 获得指定颜色的拷贝
  16815. */
  16816. static clone<Out extends IColorLike>(a: Out): Color;
  16817. /**
  16818. * @en Clone a color and save the results to out color.
  16819. * @zh 复制目标颜色
  16820. */
  16821. static copy<Out extends IColorLike>(out: Out, a: Out): Out;
  16822. /**
  16823. * @en Set the components of a color to the given values and save the results to out color.
  16824. * @zh 设置颜色值
  16825. */
  16826. static set<Out extends IColorLike>(out: Out, r: number, g: number, b: number, a: number): Out;
  16827. /**
  16828. * @en Convert linear color from rgb8 0~255 to Vec4 0~1
  16829. * @zh 将当前颜色转换为到 Vec4
  16830. * @returns Vec4 as float color value
  16831. * @example
  16832. * ```
  16833. * const color = Color.YELLOW;
  16834. * color.toVec4();
  16835. * ```
  16836. */
  16837. static toVec4(color: Color, out?: Vec4): Vec4;
  16838. /**
  16839. * @en Convert 8bit linear color from Vec4
  16840. * @zh 使用 Vec4 设置 8 bit 颜色
  16841. * @returns 8 Bit srgb value
  16842. * @example
  16843. * ```
  16844. * color.fromVec4(new Vec4(1,1,1,1));
  16845. * ```
  16846. */
  16847. static fromVec4(value: Vec4, out?: Color): Color;
  16848. /**
  16849. * @en Converts the hexadecimal formal color into rgb formal and save the results to out color.
  16850. * the argument `hex` could be hex-string or hex-number (8-digit or 6-digit).
  16851. * the hex-string should be like : '#12345678' '#123456', '123456', '12345678'.
  16852. * the hex-number should be like : 0x12345678, 0x123456 .
  16853. * @zh 从十六进制颜色字符串中读入颜色到 out 中
  16854. * 参数 hex 支持 16进制字符串 或者 16进制数值 (8位数字 或者 6位数字).
  16855. * 16进制字符串的格式应该类似: '#12345678' '#123456', '123456', '12345678'.
  16856. * 16进制数值的格式应该类似: 0x12345678, 0x123456 .
  16857. */
  16858. static fromHEX<Out extends IColorLike>(out: Out, hex: string | number): Out;
  16859. /**
  16860. * @en Add two colors by components. And save the results to out color.
  16861. * @zh 逐通道颜色加法
  16862. */
  16863. static add<Out extends IColorLike>(out: Out, a: Out, b: Out): Out;
  16864. /**
  16865. * @en Subtract each components of color b from each components of color a. And save the results to out color.
  16866. * @zh 逐通道颜色减法
  16867. */
  16868. static subtract<Out extends IColorLike>(out: Out, a: Out, b: Out): Out;
  16869. /**
  16870. * @en Multiply each components of two colors. And save the results to out color.
  16871. * @zh 逐通道颜色乘法
  16872. */
  16873. static multiply<Out extends IColorLike>(out: Out, a: Out, b: Out): Out;
  16874. /**
  16875. * @en Divide each components of color a by each components of color b. And save the results to out color.
  16876. * @zh 逐通道颜色除法
  16877. */
  16878. static divide<Out extends IColorLike>(out: Out, a: Out, b: Out): Out;
  16879. /**
  16880. * @en Multiply all channels in a color with the given scale factor, and save the results to out color.
  16881. * @zh 全通道统一缩放颜色
  16882. */
  16883. static scale<Out extends IColorLike>(out: Out, a: Out, b: number): Out;
  16884. /**
  16885. * @en Performs a linear interpolation between two colors.
  16886. * @zh 逐通道颜色线性插值:A + t * (B - A)
  16887. */
  16888. static lerp<Out extends IColorLike>(out: Out, from: Out, to: Out, ratio: number): Out;
  16889. /**
  16890. * @en Convert a color object to a RGBA array, and save the results to out color.
  16891. * @zh 颜色转数组
  16892. * @param ofs Array Start Offset
  16893. */
  16894. static toArray<Out extends __private.__types_globals__IWritableArrayLike<number>>(out: Out, a: IColorLike, ofs?: number): Out;
  16895. /**
  16896. * @en Sets the given color with RGBA values in an array, and save the results to out color.
  16897. * @zh 数组转颜色
  16898. * @param ofs Array Start Offset
  16899. */
  16900. static fromArray<Out extends IColorLike>(arr: __private.__types_globals__IWritableArrayLike<number>, out: Out, ofs?: number): Out;
  16901. /**
  16902. * @zh 从无符号 32 位整数构造颜色,高 8 位为 alpha 通道,次高 8 位为蓝色通道,次低 8 位为绿色通道,低 8 位为红色通道。
  16903. * @en Construct color from a unsigned 32 bit integer, the highest 8 bits is for alpha channel, the second highest 8 bits is for blue channel,
  16904. * the second lowest 8 bits is for green channel, and the lowest 8 bits if for red channel.
  16905. *
  16906. * @param out @en Output color object. @zh 输出的颜色对象。
  16907. * @param uint32 @en The unsigned 32 bit integer @zh 32 位无符号整数
  16908. * @returns @en The `out` object @zh `out` 对象
  16909. */
  16910. static fromUint32<Out extends IColorLike>(out: Out, uint32: number): Out;
  16911. /**
  16912. * @zh 转换当前颜色为无符号 32 位整数, 高 8 位为 alpha 通道,次高 8 位为蓝色通道,次低 8 位为绿色通道,低 8 位为红色通道。
  16913. * @en Convert the current color to a unsigned 32 bit integer, the highest 8 bits is for alpha channel,
  16914. * the second highest 8 bits is for blue channel, the second lowest 8 bits is for green channel, and the lowest 8 bits if for red channel.
  16915. *
  16916. * @param color @en The color. @zh 颜色。
  16917. * @returns @en The converted unsigned 32 bit integer. @zh 32 位无符号整数。
  16918. */
  16919. static toUint32(color: IColorLike): number;
  16920. /**
  16921. * @en Check whether the two given colors are identical
  16922. * @zh 颜色等价判断
  16923. */
  16924. static strictEquals<Out extends IColorLike>(a: Out, b: Out): boolean;
  16925. /**
  16926. * @en Check whether the two given colors are approximately equivalent. Difference of each channel is smaller that the epsilon.
  16927. * @zh 排除浮点数误差的颜色近似等价判断
  16928. */
  16929. static equals<Out extends IColorLike>(a: Out, b: Out, epsilon?: number): boolean;
  16930. /**
  16931. * @en Convert the given color to a hex color value. And save the results to out color.
  16932. * @zh 获取指定颜色的整型数据表示
  16933. */
  16934. static hex<Out extends IColorLike>(a: Out): number;
  16935. /**
  16936. * @en Get or set red channel value.
  16937. * @zh 获取或设置当前颜色的 Red 通道。
  16938. */
  16939. get r(): number;
  16940. set r(red: number);
  16941. /**
  16942. * @en Get or set green channel value.
  16943. * @zh 获取或设置当前颜色的 Green 通道。
  16944. */
  16945. get g(): number;
  16946. set g(green: number);
  16947. /**
  16948. * @en Get or set blue channel value.
  16949. * @zh 获取或设置当前颜色的 Blue 通道。
  16950. */
  16951. get b(): number;
  16952. set b(blue: number);
  16953. /** @en Get or set alpha channel value.
  16954. * @zh 获取或设置当前颜色的透明度通道。
  16955. */
  16956. get a(): number;
  16957. set a(alpha: number);
  16958. get x(): number;
  16959. set x(value: number);
  16960. get y(): number;
  16961. set y(value: number);
  16962. get z(): number;
  16963. set z(value: number);
  16964. get w(): number;
  16965. set w(value: number);
  16966. /**
  16967. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  16968. */
  16969. _val: number;
  16970. /**
  16971. * @en Construct a same color from the given color
  16972. * @zh 构造与指定颜色相等的颜色。
  16973. * @param other Specified color
  16974. */
  16975. constructor(other: Color);
  16976. /**
  16977. * @en Construct a color form the hex color string
  16978. * @zh 用十六进制颜色字符串中构造颜色。
  16979. * @param hexString Hexadecimal color string.
  16980. */
  16981. constructor(hexString: string);
  16982. /**
  16983. * @en Construct a color
  16984. * @zh 构造具有指定通道的颜色。
  16985. * @param r red component of the color, default value is 0.
  16986. * @param g green component of the color, default value is 0.
  16987. * @param b blue component of the color, default value is 0.
  16988. * @param a alpha component of the color, default value is 255.
  16989. */
  16990. constructor(r?: number, g?: number, b?: number, a?: number);
  16991. /**
  16992. * @en Clone a new color from the current color.
  16993. * @zh 克隆当前颜色。
  16994. */
  16995. clone(): Color;
  16996. /**
  16997. * @en Check whether the current color is identical with the given color
  16998. * @zh 判断当前颜色是否与指定颜色相等。
  16999. * @param other Specified color
  17000. * @returns Returns `true` when all channels of both colours are equal; otherwise returns `false`.
  17001. */
  17002. equals(other: Color): boolean;
  17003. /**
  17004. * @en Calculate linear interpolation result between this color and another one with given ratio。
  17005. * @zh 根据指定的插值比率,从当前颜色到目标颜色之间做插值。
  17006. * @param to Target color
  17007. * @param ratio The interpolation coefficient.The range is [0,1].
  17008. */
  17009. lerp(to: Color, ratio: number): Color;
  17010. /**
  17011. * @en Convert to string with color informations
  17012. * @zh 返回当前颜色的字符串表示。
  17013. * @returns A string representation of the current color.
  17014. */
  17015. toString(): string;
  17016. /**
  17017. * @en Convert color to css format.
  17018. * @zh 将当前颜色转换为 CSS 格式。
  17019. * @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  17020. * @returns CSS format for the current color.
  17021. * @example
  17022. * ```ts
  17023. * let color = cc.Color.BLACK;
  17024. * color.toCSS(); // "rgba(0,0,0,1.00)";
  17025. * color.toCSS("rgba"); // "rgba(0,0,0,1.00)";
  17026. * color.toCSS("rgb"); // "rgba(0,0,0)";
  17027. * color.toCSS("#rgb"); // "#000";
  17028. * color.toCSS("#rrggbb"); // "#000000";
  17029. * ```
  17030. */
  17031. toCSS(opt?: ("rgba" | "rgb" | "#rrggbb" | "#rrggbbaa")): string;
  17032. /**
  17033. * @en Converts the hexadecimal formal color into rgb formal and save the results to current color object.
  17034. * the argument `hex` could be hex-string or hex-number (8-digit or 6-digit).
  17035. * the hex-string should be like : '#12345678' '#123456', '123456', '12345678'.
  17036. * the hex-number should be like : 0x12345678, 0x123456 .
  17037. * @zh 从十六进制颜色字符串中读入颜色到 当前color对象中
  17038. * 参数 hex 支持 16进制字符串 或者 16进制数值 (8位数字 或者 6位数字).
  17039. * 16进制字符串的格式应该类似: '#12345678' '#123456', '123456', '12345678'.
  17040. * 16进制数值的格式应该类似: 0x12345678, 0x123456 .
  17041. * @param hex the hex-string or hex-number
  17042. * @returns `this`
  17043. */
  17044. fromHEX(hex: string | number): Color;
  17045. /**
  17046. * @en convert Color to HEX color string.
  17047. * @zh 转换当前颜色为十六进制颜色字符串。
  17048. * @param fmt "#rrggbb" or "#rrggbbaa".
  17049. * - `'#rrggbbaa'` obtains the hexadecimal value of the Red, Green, Blue, Alpha channels (**two**, high complement 0) and connects them sequentially.
  17050. * - `'#rrggbb'` is similar to `'#rrggbbaa'` but does not include the Alpha channel.
  17051. * @returns the Hex color string
  17052. * @example
  17053. * ```
  17054. * const color = new Color(255, 14, 0, 255);
  17055. * color.toHEX("#rgb"); // "f00";
  17056. * color.toHEX("#rrggbbaa"); // "ff0e00ff"
  17057. * color.toHEX("#rrggbb"); // "ff0e00"
  17058. * ```
  17059. */
  17060. toHEX(fmt?: "#rgb" | "#rrggbb" | "#rrggbbaa"): string;
  17061. /**
  17062. * @en Convert to rgb value.
  17063. * @zh 将当前颜色转换为 RGB 整数值。
  17064. * @returns RGB integer value. Starting from the lowest valid bit, each 8 bits is the value of the Red, Green, and Blue channels respectively.
  17065. * @example
  17066. * ```
  17067. * const color = Color.YELLOW;
  17068. * color.toRGBValue();
  17069. * ```
  17070. */
  17071. toRGBValue(): number;
  17072. /**
  17073. * @en Read HSV model color and convert to RGB color.
  17074. * @zh 从 HSV 颜色中读入当前颜色。
  17075. * @param h H value。
  17076. * @param s S value。
  17077. * @param v V value。
  17078. * @returns `this`
  17079. * @example
  17080. * ```
  17081. * const color = Color.YELLOW;
  17082. * color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  17083. * ```
  17084. */
  17085. fromHSV(h: number, s: number, v: number): Color;
  17086. /**
  17087. * @en Transform to HSV model color.
  17088. * @zh 转换当前颜色为 HSV 颜色。
  17089. * @returns HSV format color
  17090. * @example
  17091. * ```
  17092. * import { Color } from 'cc';
  17093. * const color = Color.YELLOW;
  17094. * color.toHSV(); // {h: 0.1533864541832669, s: 0.9843137254901961, v: 1}
  17095. * ```
  17096. */
  17097. toHSV(): {
  17098. h: number;
  17099. s: number;
  17100. v: number;
  17101. };
  17102. /**
  17103. * @en Set the color.
  17104. * @zh 设置当前颜色使其与指定颜色相等。
  17105. * @param other The specified color.
  17106. * @overload
  17107. * @param [r=0] red component of the color, the range is [0-255]
  17108. * @param [g=0] green component of the color
  17109. * @param [b=0] blue component of the color
  17110. * @param [a=255] alpha component of the color
  17111. * @returns Current color.
  17112. */
  17113. set(other: Color): Color;
  17114. set(r?: number, g?: number, b?: number, a?: number): Color;
  17115. /**
  17116. * @en Multiplies the current color by the specified color.
  17117. * @zh 将当前颜色乘以与指定颜色
  17118. * @param other The specified color.
  17119. */
  17120. multiply(other: Color): Color;
  17121. /**
  17122. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  17123. */
  17124. _set_r_unsafe(red: number): Color;
  17125. /**
  17126. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  17127. */
  17128. _set_g_unsafe(green: number): Color;
  17129. /**
  17130. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  17131. */
  17132. _set_b_unsafe(blue: number): Color;
  17133. /**
  17134. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  17135. */
  17136. _set_a_unsafe(alpha: number): Color;
  17137. }
  17138. export function color(other: Color | string): Color;
  17139. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  17140. /**
  17141. * @en Tests whether or not the arguments have approximately the same value, within an absolute<br/>
  17142. * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less<br/>
  17143. * than or equal to 1.0, and a relative tolerance is used for larger values)
  17144. * @zh 在glMatrix的绝对或相对容差范围内,测试参数是否具有近似相同的值。<br/>
  17145. * EPSILON(小于等于1.0的值采用绝对公差,大于1.0的值采用相对公差)
  17146. * @param a The first number to test.
  17147. * @param b The second number to test.
  17148. * @return True if the numbers are approximately equal, false otherwise.
  17149. */
  17150. export function equals(a: number, b: number): boolean;
  17151. /**
  17152. * @en Tests whether or not the arguments have approximately the same value by given maxDiff<br/>
  17153. * @zh 通过给定的最大差异,测试参数是否具有近似相同的值。
  17154. * @param a The first number to test.
  17155. * @param b The second number to test.
  17156. * @param maxDiff Maximum difference.
  17157. * @return True if the numbers are approximately equal, false otherwise.
  17158. */
  17159. export function approx(a: number, b: number, maxDiff?: number): boolean;
  17160. /**
  17161. * @en Clamps a value between a minimum float and maximum float value.<br/>
  17162. * @zh 返回最小浮点数和最大浮点数之间的一个数值。可以使用 clamp 函数将不断变化的数值限制在范围内。
  17163. * @param val
  17164. * @param min
  17165. * @param max
  17166. */
  17167. export function clamp(val: number, min: number, max: number): number;
  17168. /**
  17169. * @en Clamps a value between 0 and 1.<br/>
  17170. * @zh 将值限制在0和1之间。
  17171. * @param val
  17172. */
  17173. export function clamp01(val: number): number;
  17174. /**
  17175. * @en Linear interpolation between two numbers
  17176. * @zh 两个数之间的线性插值。
  17177. * @param from - The starting number.
  17178. * @param to - The ending number.
  17179. * @param ratio - The interpolation coefficient, t should be in the range [0, 1].
  17180. */
  17181. export function lerp(from: number, to: number, ratio: number): number;
  17182. /**
  17183. * @en Convert Degree To Radian<br/>
  17184. * @zh 把角度换算成弧度。
  17185. * @param {Number} a Angle in Degrees
  17186. */
  17187. export function toRadian(a: number): number;
  17188. /**
  17189. * @en Convert Radian To Degree<br/>
  17190. * @zh 把弧度换算成角度。
  17191. * @param {Number} a Angle in Radian
  17192. */
  17193. export function toDegree(a: number): number;
  17194. /**
  17195. * @method random
  17196. */
  17197. export function random(): number;
  17198. /**
  17199. * @en Set a custom random number generator, default to Math.random
  17200. * @zh 设置自定义随机数生成器,默认为 Math.random
  17201. * @param func custom random number generator
  17202. */
  17203. export function setRandGenerator<TFunction extends (...any: any[]) => number>(func: TFunction): void;
  17204. /**
  17205. * @en Returns a floating-point random number between min (inclusive) and max (exclusive).<br/>
  17206. * @zh 返回最小(包含)和最大(不包含)之间的浮点随机数。
  17207. * @method randomRange
  17208. * @param min
  17209. * @param max
  17210. * @return {Number} The random number.
  17211. */
  17212. export function randomRange(min: number, max: number): number;
  17213. /**
  17214. * @en Returns a random integer between min (inclusive) and max (exclusive).<br/>
  17215. * @zh 返回最小(包含)和最大(不包含)之间的随机整数。
  17216. * @param min
  17217. * @param max
  17218. * @return The random integer.
  17219. */
  17220. export function randomRangeInt(min: number, max: number): number;
  17221. /**
  17222. * @en
  17223. * Linear congruence generator using Hull-Dobell Theorem.
  17224. * @zh
  17225. * 使用 Hull-Dobell 算法的线性同余生成器构造伪随机数
  17226. *
  17227. * @param seed The random seed.
  17228. * @return The pseudo random.
  17229. */
  17230. export function pseudoRandom(seed: number): number;
  17231. /**
  17232. * @en
  17233. * Returns a floating-point pseudo-random number between min (inclusive) and max (exclusive).
  17234. * @zh
  17235. * 返回一个在范围内的浮点伪随机数,注意,不包含边界值
  17236. *
  17237. * @param seed
  17238. * @param min
  17239. * @param max
  17240. * @return The random number.
  17241. */
  17242. export function pseudoRandomRange(seed: number, min: number, max: number): number;
  17243. /**
  17244. * @en Returns a pseudo-random integer between min (inclusive) and max (exclusive).<br/>
  17245. * @zh 返回最小(包含)和最大(不包含)之间的浮点伪随机数。
  17246. * @param seed
  17247. * @param min
  17248. * @param max
  17249. * @return The random integer.
  17250. */
  17251. export function pseudoRandomRangeInt(seed: number, min: number, max: number): number;
  17252. /**
  17253. * @en
  17254. * Returns the next power of two for the value.<br/>
  17255. * @zh
  17256. * 返回下一个最接近的 2 的幂
  17257. *
  17258. * @param val
  17259. * @return The the next power of two.
  17260. */
  17261. export function nextPow2(val: number): number;
  17262. /**
  17263. * @en Returns float remainder for t / length.<br/>
  17264. * @zh 返回t / length的浮点余数。
  17265. * @param t Time start at 0.
  17266. * @param length Time of one cycle.
  17267. * @return The Time wrapped in the first cycle.
  17268. */
  17269. export function repeat(t: number, length: number): number;
  17270. /**
  17271. * @en
  17272. * Returns time wrapped in ping-pong mode.
  17273. * @zh
  17274. * 返回乒乓模式下的相对时间
  17275. *
  17276. * @param t Time start at 0.
  17277. * @param length Time of one cycle.
  17278. * @return The time wrapped in the first cycle.
  17279. */
  17280. export function pingPong(t: number, length: number): number;
  17281. /**
  17282. * @en Returns ratio of a value within a given range.<br/>
  17283. * @zh 返回给定范围内的值的比率。
  17284. * @param from Start value.
  17285. * @param to End value.
  17286. * @param value Given value.
  17287. * @return The ratio between [from, to].
  17288. */
  17289. export function inverseLerp(from: number, to: number, value: number): number;
  17290. /**
  17291. * @en Compare the absolute values of all components and the component with the largest absolute value will be returned.
  17292. * @zh 对所有分量的绝对值进行比较大小,返回绝对值最大的分量。
  17293. * @param v vec3 like value
  17294. * @returns max absolute component
  17295. */
  17296. export function absMaxComponent(v: IVec3Like): number;
  17297. /**
  17298. * @en Compare the absolute value of two values and return the value with the largest absolute value
  17299. * @zh 对 a b 的绝对值进行比较大小,返回绝对值最大的值。
  17300. * @param a number
  17301. * @param b number
  17302. */
  17303. export function absMax(a: number, b: number): number;
  17304. /**
  17305. * @en
  17306. * Make the attributes of the specified class available to be enumerated
  17307. * @zh
  17308. * 使指定类的特定属性可被枚举
  17309. * @param prototype Inherit the prototype chain of the ValueType class
  17310. * @param attrs List of attributes that need to be enumerated
  17311. */
  17312. export function enumerableProps(prototype: ValueType, attrs: string[]): void;
  17313. export function floatToHalf(val: number): number;
  17314. export function halfToFloat(val: number): number;
  17315. export const HALF_PI: number;
  17316. export const TWO_PI: number;
  17317. export const EPSILON = 0.000001;
  17318. export interface IColorLike {
  17319. r: number;
  17320. g: number;
  17321. b: number;
  17322. a: number;
  17323. _val: number;
  17324. }
  17325. export interface IMat3Like {
  17326. m00: number;
  17327. m01: number;
  17328. m02: number;
  17329. m03: number;
  17330. m04: number;
  17331. m05: number;
  17332. m06: number;
  17333. m07: number;
  17334. m08: number;
  17335. }
  17336. export interface IMat4Like {
  17337. m00: number;
  17338. m01: number;
  17339. m02: number;
  17340. m03: number;
  17341. m04: number;
  17342. m05: number;
  17343. m06: number;
  17344. m07: number;
  17345. m08: number;
  17346. m09: number;
  17347. m10: number;
  17348. m11: number;
  17349. m12: number;
  17350. m13: number;
  17351. m14: number;
  17352. m15: number;
  17353. }
  17354. export interface IQuatLike {
  17355. x: number;
  17356. y: number;
  17357. z: number;
  17358. w: number;
  17359. }
  17360. export interface IRectLike {
  17361. x: number;
  17362. y: number;
  17363. width: number;
  17364. height: number;
  17365. }
  17366. export interface ISizeLike {
  17367. width: number;
  17368. height: number;
  17369. }
  17370. export interface IVec2Like {
  17371. x: number;
  17372. y: number;
  17373. }
  17374. export interface IVec3Like {
  17375. x: number;
  17376. y: number;
  17377. z: number;
  17378. }
  17379. export interface IVec4Like {
  17380. x: number;
  17381. y: number;
  17382. z: number;
  17383. w: number;
  17384. }
  17385. export type FloatArray = Float64Array | Float32Array;
  17386. export type IVec2 = IVec2Like | Readonly<IVec2Like>;
  17387. export type IVec3 = IVec3Like | Readonly<IVec3Like>;
  17388. export type IVec4 = IVec4Like | Readonly<IVec4Like>;
  17389. export type IMat3 = IMat3Like | Readonly<IMat3Like>;
  17390. export type IMat4 = IMat4Like | Readonly<IMat4Like>;
  17391. export type IRect = IRectLike | Readonly<IRectLike>;
  17392. export type IQuat = IQuatLike | Readonly<IQuatLike>;
  17393. export type IColor = IColorLike | Readonly<IColorLike>;
  17394. export const MATH_FLOAT_ARRAY: Float32ArrayConstructor | Float64ArrayConstructor;
  17395. export class MathBase extends ValueType {
  17396. static createFloatArray(size: number): Float64Array | Float32Array;
  17397. /**
  17398. * @en Get the internal array data.
  17399. * @zh 获取内部 array 数据。
  17400. */
  17401. get array(): FloatArray;
  17402. protected _array: FloatArray;
  17403. }
  17404. }
  17405. export namespace memop {
  17406. /**
  17407. * @en Typed object pool.
  17408. * It's a traditional design, you can get elements out of the pool or recycle elements by putting back into the pool.
  17409. * @zh 支持类型的对象池。这是一个传统设计的对象池,你可以从对象池中取出对象或是放回不再需要对象来复用。
  17410. * @see [[RecyclePool]]
  17411. */
  17412. export class Pool<T> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
  17413. /**
  17414. * @en Constructor with the allocator of elements and initial pool size.
  17415. * @zh 使用元素的构造器和初始大小的构造函数。
  17416. * @param ctor @en The allocator of elements in pool, it's invoked directly without `new` in Pool.
  17417. * @zh 元素的构造器,Pool 内部使用该构造器直接创建实例。
  17418. * @param elementsPerBatch @en Initial pool size, this size will also be the incremental size when
  17419. * the pool is overloaded.
  17420. * @zh 对象池的初始大小。当对象池扩容时,也会使用该值。
  17421. * @param dtor @en The finalizer of element, it's invoked when this Pool is destroyed or shrunk if
  17422. * it is valid.
  17423. * @zh 元素的析构器。如果存在的话,当对象池销毁或者缩容时,会使用该析构器。
  17424. */
  17425. constructor(ctor: () => T, elementsPerBatch: number, dtor?: (obj: T) => void);
  17426. /**
  17427. * @en Take an object out of the object pool.
  17428. * @zh 从对象池中取出一个对象。
  17429. * @returns @en An object ready for use. This function always returns an object.
  17430. * @zh 该函数总是返回一个可用的对象。
  17431. */
  17432. alloc(): T;
  17433. /**
  17434. * @en Put an object back into the object pool.
  17435. * @zh 将一个对象放回对象池中。
  17436. * @param obj @en The object to be put back into the pool.
  17437. * @zh 放回对象池中的对象。
  17438. */
  17439. free(obj: T): void;
  17440. /**
  17441. * @en Put multiple objects back into the object pool.
  17442. * @zh 将一组对象放回对象池中。
  17443. * @param objs @en An array of objects to be put back into the pool.
  17444. * @zh 放回对象池中的一组对象。
  17445. */
  17446. freeArray(objs: T[]): void;
  17447. /**
  17448. * @en Try to shrink the object pool to reduce memory usage.
  17449. * @zh 尝试缩容对象池,以释放内存。
  17450. */
  17451. tryShrink(): void;
  17452. /**
  17453. * @en Destroy all elements and clear the pool.
  17454. * @zh 释放对象池中所有资源并清空缓存池。
  17455. */
  17456. destroy(): void;
  17457. }
  17458. /**
  17459. * @en Recyclable object pool. It's designed to be entirely reused each time.
  17460. * There is no put and get method, each time you get the [[data]], you can use all elements as new.
  17461. * You shouldn't simultaneously use the same RecyclePool in more than two overlapped logic.
  17462. * Its size can be automatically incremented or manually resized.
  17463. * @zh 循环对象池。这种池子被设计为每次使用都完整复用。
  17464. * 它没有回收和提取的函数,通过获取 [[data]] 可以获取池子中所有元素,全部都应该被当做新对象来使用。
  17465. * 开发者不应该在相互交叉的不同逻辑中同时使用同一个循环对象池。
  17466. * 池子尺寸可以在池子满时自动扩充,也可以手动调整。
  17467. * @see [[Pool]]
  17468. */
  17469. export class RecyclePool<T = any> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
  17470. /**
  17471. * @en Constructor with the allocator of elements and initial pool size, all elements will be pre-allocated.
  17472. * @zh 使用元素的构造器和初始大小的构造函数,所有元素都会被预创建。
  17473. * @param fn The allocator of elements in pool, it's invoked directly without `new`
  17474. * @param size Initial pool size
  17475. * @param dtor The finalizer of element, it's invoked when this container is destroyed or shrunk
  17476. */
  17477. constructor(fn: () => T, size: number, dtor?: (obj: T) => void);
  17478. /**
  17479. * @en The length of the object pool.
  17480. * @zh 对象池大小。
  17481. */
  17482. get length(): number;
  17483. /**
  17484. * @en The underlying array of all pool elements.
  17485. * @zh 实际对象池数组。
  17486. */
  17487. get data(): T[];
  17488. /**
  17489. * @en Resets the object pool. Only changes the length to 0.
  17490. * @zh 清空对象池。目前仅仅会设置尺寸为 0。
  17491. */
  17492. reset(): void;
  17493. /**
  17494. * @en Resize the object poo, and fills with new created elements.
  17495. * @zh 设置对象池大小,并填充新的元素。
  17496. * @param size @en The new size of the pool. @zh 新的对象池大小。
  17497. */
  17498. resize(size: number): void;
  17499. /**
  17500. * @en Expand the array size to 2 times the original size, and fills with new created elements.
  17501. * @zh 扩充对象池容量,会自动扩充尺寸到原来的 2 倍,并填充新的元素。
  17502. */
  17503. add(): T;
  17504. /**
  17505. * @en Destroy the object pool. Please don't use it any more after it is destroyed.
  17506. * @zh 销毁对象池。销毁后不能继续使用。
  17507. */
  17508. destroy(): void;
  17509. /**
  17510. * @en Try to shrink the object pool to free memory.
  17511. * @zh 尝试回收没用的对象,释放内存。
  17512. */
  17513. tryShrink(): void;
  17514. /**
  17515. * @en Remove the element with the specified index from the object pool. This will decrease pool size.
  17516. * @zh 移除对象池中指定索引的元素,会减小池子尺寸。
  17517. * @param idx @en The index of the element to remove. @zh 被移除的元素的索引。
  17518. */
  17519. removeAt(idx: number): void;
  17520. }
  17521. /**
  17522. * @en
  17523. * Cached array is a data structure for objects cache, it's designed for persistent data.
  17524. * Its content array length will keep grow.
  17525. * @zh
  17526. * 适用于对象缓存的数组类型封装,一般用于不易被移除的常驻数据。
  17527. * 它的内部数组长度会持续增长,不会减少。
  17528. */
  17529. export class CachedArray<T> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
  17530. /**
  17531. * @en
  17532. * The array which stores actual content.
  17533. * @zh
  17534. * 实际存储数据内容的数组。
  17535. */
  17536. array: T[];
  17537. /**
  17538. * @en
  17539. * The actual count of data object.
  17540. * @zh
  17541. * 实际存储的元素数量。
  17542. */
  17543. length: number;
  17544. /**
  17545. * @en Constructor. @zh 构造函数。
  17546. * @param length @en Initial length of the CachedArray. @zh CachedArray 的初始长度。
  17547. * @param compareFn @en Function used to determine the order of the elements. It is expected to return
  17548. * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
  17549. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  17550. * @zh 用来确定元素顺序的函数。如果第一个参数小于第二个参数,它应该返回一个负值,如果它们相等,则返回0,否则返回一个正值。
  17551. * 如果省略,元素将按 ASCII 字符升序排序。
  17552. */
  17553. constructor(length: number, compareFn?: (a: T, b: T) => number);
  17554. /**
  17555. * @en
  17556. * Push an element to the end of the array.
  17557. * @zh
  17558. * 向数组末尾添加一个元素。
  17559. * @param item @en The item to be added. @zh 被添加到数组的元素。
  17560. */
  17561. push(item: T): void;
  17562. /**
  17563. * @en
  17564. * Pop the last element in the array. The [[length]] will reduce, but the internal array will keep its size.
  17565. * @zh
  17566. * 弹出数组最后一个元素,CachedArray 的 [[length]] 会减少,但是内部数组的实际长度不变。
  17567. * @returns @en The last element of this CachedArray. If CachedArray is empty, will return undefined.
  17568. * @zh 数组的最后一个元素。如果数组为空,将返回 undefined。
  17569. */
  17570. pop(): T | undefined;
  17571. /**
  17572. * @en
  17573. * Get the element at the specified index of the array.
  17574. * @zh
  17575. * 获取数组中指定位置的元素。
  17576. * @param idx @en The index of the requested element. @zh 用于获取数组元素的索引。
  17577. * @returns @en The element at given index. If idx not in [0, [[length]]) or array is empty, will return undefined.
  17578. * @zh 数组下标对应的元素。如果 idx 超出 [0, [[length]]),或者数组是空的,将返回 undefined。
  17579. */
  17580. get(idx: number): T | undefined;
  17581. /**
  17582. * @en
  17583. * Clear the cache. The [[length]] will be set to 0, but the internal array will keep its size.
  17584. * @zh
  17585. * 清空数组所有元素。[[length]] 会被设为 0,但内部数组的实际长度不变
  17586. */
  17587. clear(): void;
  17588. /**
  17589. * @en
  17590. * Destroy the array. The [[length]] will be set to 0, and clear the internal array.
  17591. * @zh
  17592. * 销毁数组。[[length]] 会被设为 0,并且清空内部数组。
  17593. */
  17594. destroy(): void;
  17595. /**
  17596. * @en Requests the removal of unused capacity.
  17597. * @zh 尝试释放多余的内存。
  17598. */
  17599. tryShrink(): void;
  17600. /**
  17601. * @en
  17602. * Sort the existing elements in cache by [[compareFn]] passed in constructor.
  17603. * If [[compareFn]] is not passed in, the elements are sorted in ascending, ASCII character order.
  17604. * @zh
  17605. * 使用构造函数传入的 [[compareFn]] 排序所有现有元素。如果没有传入比较函数,将按照 ASCII 升序排序。
  17606. */
  17607. sort(): void;
  17608. /**
  17609. * @en
  17610. * Add all elements of a given array to the end of the current array.
  17611. * @zh
  17612. * 添加一个指定数组中的所有元素到当前数组末尾。
  17613. * @param array @en The given array to be appended. @zh 被添加的数组。
  17614. */
  17615. concat(array: T[]): void;
  17616. /**
  17617. * @en Delete the element at the specified location and move the last element to that location.
  17618. * @zh 删除指定位置的元素并将最后一个元素移动至该位置。
  17619. * @param idx @en The index of the element to be deleted. If idx out of range [0, length), there is
  17620. * not effect.
  17621. * @zh 希望被删除的索引。如果索引超出 [0, length),将没有效果。
  17622. */
  17623. fastRemove(idx: number): void;
  17624. /**
  17625. * @en Returns the first index that compares equal to val.
  17626. * @zh 返回在数组中找到的第一个和 val 相等的元素的索引。
  17627. * @param val @en Value to search for. @zh 搜索的值。
  17628. * @returns The index to the first element that compares equal to val. If no elements match, returns -1.
  17629. * @zh 第一个和 val 相等的元素的索引。如果没找到,将返回 -1。
  17630. */
  17631. indexOf(val: T): number;
  17632. }
  17633. }
  17634. export namespace geometry {
  17635. /**
  17636. * 几何工具模块
  17637. * @module geometry
  17638. */
  17639. /**
  17640. * @en
  17641. * The enum type of basic geometry.
  17642. * @zh
  17643. * 形状的类型值。
  17644. */
  17645. export const enums: {
  17646. SHAPE_RAY: number;
  17647. SHAPE_LINE: number;
  17648. SHAPE_SPHERE: number;
  17649. SHAPE_AABB: number;
  17650. SHAPE_OBB: number;
  17651. SHAPE_PLANE: number;
  17652. SHAPE_TRIANGLE: number;
  17653. SHAPE_FRUSTUM: number;
  17654. SHAPE_FRUSTUM_ACCURATE: number;
  17655. SHAPE_CAPSULE: number;
  17656. SHAPE_SPLINE: number;
  17657. };
  17658. export namespace distance {
  17659. /**
  17660. * @en
  17661. * Calculates the distance between a point and a plane.
  17662. * @zh
  17663. * 计算点和平面之间的距离。
  17664. * @param point @en The target point. @zh 目标点。
  17665. * @param plane @en The target plane. @zh 目标平面。
  17666. * @returns @en The distance between the point and the plane. @zh 点和平面之间的距离。
  17667. */
  17668. export function point_plane(point: math.Vec3, plane_: Plane): number;
  17669. /**
  17670. * @en
  17671. * Calculates the closest point on a plane to a given point.
  17672. * @zh
  17673. * 计算平面上最接近给定点的点。
  17674. * @param out @en The closest point. @zh 最近点。
  17675. * @param point @en The given point. @zh 给定点。
  17676. * @param plane @en The target plane. @zh 平面。
  17677. * @returns @en The result of the closest point, same as the `out` parameter. @zh 存储最近点的向量,与 `out` 参数为同一个对象。
  17678. */
  17679. export function pt_point_plane(out: math.Vec3, point: math.Vec3, plane_: Plane): math.Vec3;
  17680. /**
  17681. * @en
  17682. * Calculates the closest point on an AABB to a given point.
  17683. * @zh
  17684. * 计算 AABB 上最接近给定点的点。
  17685. * @param out @en The closest point. @zh 最近点。
  17686. * @param point @en The given point @zh 给定点。
  17687. * @param aabb @en The target AABB to calculate. @zh 参与计算的 AABB 实例。
  17688. * @returns @en The result of the closest point, same as the `out` parameter. @zh 存储最近点的向量,与 `out` 参数为同一个对象。
  17689. */
  17690. export function pt_point_aabb(out: math.Vec3, point: math.Vec3, aabb_: AABB): math.Vec3;
  17691. /**
  17692. * @en
  17693. * Calculates the closest point on an OBB to a given point.
  17694. * @zh
  17695. * 计算 OBB 上最接近给定点的点。
  17696. * @param out @en The closest point. @zh 最近点。
  17697. * @param point @en The given point. @zh 给定点。
  17698. * @param obb @en The target OBB to calculate. @zh 参与计算的 OBB 实例。
  17699. * @returns @en The result of the closest point, same as the `out` parameter. @zh 存储最近点的向量,与 `out` 参数为同一个对象。
  17700. */
  17701. export function pt_point_obb(out: math.Vec3, point: math.Vec3, obb_: OBB): math.Vec3;
  17702. /**
  17703. * @en
  17704. * Calculates the closest point on the line, which is from A to B, to the given point.
  17705. * @zh
  17706. * 计算给定点距离线段 AB 上最近的一点。
  17707. * @param out @en The closest point. @zh 最近点。
  17708. * @param point @en The given point. @zh 给定点
  17709. * @param linePointA @en Point A on the line. @zh 线上的某点 A。
  17710. * @param linePointB @en Point B on the line. @zh 线上的某点 B。
  17711. */
  17712. export function pt_point_line(out: math.Vec3, point: math.Vec3, linePointA: math.Vec3, linePointB: math.Vec3): void;
  17713. }
  17714. /**
  17715. * @en
  17716. * Algorithm of intersect detect for basic geometry.
  17717. * @zh
  17718. * 基础几何的相交性检测算法。
  17719. */
  17720. export const intersect: {
  17721. raySphere: (ray: Ray, sphere: Sphere) => number;
  17722. rayAABB: (ray: Ray, aabb: AABB) => number;
  17723. rayOBB: (ray: Ray, obb: OBB) => number;
  17724. rayPlane: (ray: Ray, plane: Plane) => number;
  17725. rayTriangle: (ray: Ray, triangle: Triangle, doubleSided?: boolean) => number;
  17726. rayCapsule: (ray: Ray, capsule: Capsule) => number;
  17727. raySubMesh: (ray: Ray, submesh: RenderingSubMesh, options?: IRaySubMeshOptions) => number;
  17728. rayMesh: (ray: Ray, mesh: Mesh, options?: IRayMeshOptions) => number;
  17729. rayModel: (r: Ray, model: renderer.scene.Model, options?: IRayModelOptions) => number;
  17730. lineSphere: typeof __private._cocos_core_geometry_intersect__lineSphere;
  17731. lineAABB: typeof __private._cocos_core_geometry_intersect__lineAABB;
  17732. lineOBB: typeof __private._cocos_core_geometry_intersect__lineOBB;
  17733. linePlane: (line: Line, plane: Plane) => number;
  17734. lineTriangle: (line: Line, triangle: Triangle, outPt?: math.Vec3) => number;
  17735. sphereWithSphere: (sphere0: Sphere, sphere1: Sphere) => boolean;
  17736. sphereAABB: (sphere: Sphere, aabb: AABB) => boolean;
  17737. sphereOBB: (sphere: Sphere, obb: OBB) => boolean;
  17738. spherePlane: (sphere: Sphere, plane: Plane) => number;
  17739. sphereFrustum: (sphere: Sphere, frustum: Frustum) => number;
  17740. sphereFrustumAccurate: (sphere: Sphere, frustum: Frustum) => number;
  17741. sphereCapsule: (sphere: Sphere, capsule: Capsule) => boolean;
  17742. aabbWithAABB: (aabb1: AABB, aabb2: AABB) => boolean;
  17743. aabbWithOBB: (aabb: AABB, obb: OBB) => number;
  17744. aabbPlane: (aabb: AABB, plane: Plane) => number;
  17745. aabbFrustum: (aabb: AABB, frustum: Readonly<Frustum>) => number;
  17746. aabbFrustumAccurate: (aabb: AABB, frustum: Frustum) => number;
  17747. obbWithOBB: (obb1: OBB, obb2: OBB) => number;
  17748. obbPlane: (obb: OBB, plane: Plane) => number;
  17749. obbFrustum: (obb: OBB, frustum: Frustum) => number;
  17750. obbFrustumAccurate: (obb: OBB, frustum: Frustum) => number;
  17751. obbPoint: (obb: OBB, point: math.Vec3) => boolean;
  17752. obbCapsule: (obb: OBB, capsule: Capsule) => boolean | 1 | 0;
  17753. aabbFrustumCompletelyInside: (aabb: AABB, frustum: Readonly<Frustum>) => number;
  17754. capsuleWithCapsule: (capsuleA: Capsule, capsuleB: Capsule) => boolean;
  17755. /**
  17756. * @en Check intersection between two geometries, it accept all basic geometry types in [[geometry]] module.
  17757. * @zh 两个几何体的相交性检测,可填入 [[geometry]] 模块中的基础几何形状。
  17758. * @param g1 @en The first geometry. @zh 第一个几何体。
  17759. * @param g2 @en The second geometry. @zh 第二个几何体。
  17760. * @param outPt @en A 3d point to store the intersection point result, only part of the geometries support this.
  17761. * @zh 可选,用于保存相交点的输出对象。(注:仅部分形状的检测带有这个返回值)
  17762. */
  17763. resolve(g1: any, g2: any, outPt?: null): number;
  17764. };
  17765. /**
  17766. * @en
  17767. * Basic Geometry: Line.
  17768. * @zh
  17769. * 基础几何:直线。
  17770. */
  17771. export class Line {
  17772. /**
  17773. * @en
  17774. * Creates a new line.
  17775. * @zh
  17776. * 创建一条新的直线。
  17777. * @param sx @en The x coordinate of the start position. @zh 起点的 x 坐标。
  17778. * @param sy @en The y coordinate of the start position. @zh 起点的 y 坐标。
  17779. * @param sz @en The z coordinate of the start position. @zh 起点的 z 坐标。
  17780. * @param ex @en The x coordinate of the end position. @zh 终点的 x 坐标。
  17781. * @param ey @en The y coordinate of the end position. @zh 终点的 y 坐标。
  17782. * @param ez @en the z coordinate of the end position. @zh 终点的 z 坐标。
  17783. * @returns @en The created line. @zh 创建的直线。
  17784. */
  17785. static create(sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  17786. /**
  17787. * @en
  17788. * Creates a new Line initialized with values from an existing Line.
  17789. * @zh
  17790. * 克隆一条新的直线。
  17791. * @param a @en The line to clone from. @zh 克隆的来源 Line 对象。
  17792. * @returns @en The cloned line. @zh 克隆出的新 Line 对象。
  17793. */
  17794. static clone(a: Line): Line;
  17795. /**
  17796. * @en
  17797. * Copies the values from one Line to another.
  17798. * @zh
  17799. * 复制一条直线的值到另一条直线中。
  17800. * @param out @en The output line to store the copied data. @zh 用来存储拷贝数据的 Line 对象。
  17801. * @param a @en The line to copy from. @zh 从这个 Line 对象拷贝信息。
  17802. * @returns @en The `out` parameter. @zh 传入的 `out` 对象。
  17803. */
  17804. static copy(out: Line, a: Line): Line;
  17805. /**
  17806. * @en
  17807. * Creates a line from two points.
  17808. * @zh
  17809. * 用两个点创建一条直线。
  17810. * @param out @en The output line. @zh 接受新数据的 Line 对象。
  17811. * @param start @en The start point. @zh 起点。
  17812. * @param end @en The end point. @zh 终点。
  17813. * @returns @en The `out` parameter. @zh 传入的 out 对象。
  17814. */
  17815. static fromPoints(out: Line, start: math.Vec3, end: math.Vec3): Line;
  17816. /**
  17817. * @en
  17818. * Sets the start point and the end point of a line with the given values.
  17819. * @zh
  17820. * 将给定线段的起点和终点设置为给定值。
  17821. * @param out @en The output line to set properties. to @zh 接受新数据的 Line 对象。
  17822. * @param sx @en The x coordinate of the start position. @zh 起点的 x 坐标。
  17823. * @param sy @en The y coordinate of the start position. @zh 起点的 y 坐标。
  17824. * @param sz @en The z coordinate of the start position. @zh 起点的 z 坐标。
  17825. * @param ex @en The x coordinate of the end position. @zh 终点的 x 坐标。
  17826. * @param ey @en The y coordinate of the end position. @zh 终点的 y 坐标。
  17827. * @param ez @en the z coordinate of the end position. @zh 终点的 z 坐标。
  17828. * @returns @en The `out` parameter. @zh 传入的 `out` 对象。
  17829. */
  17830. static set(out: Line, sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  17831. /**
  17832. * @en Calculates the length of the given line.
  17833. * @zh 计算线的长度。
  17834. * @param a @en The line to calculate length. @zh 用于计算长度的线段。
  17835. * @returns @en The length of the given line. @zh 线段的长度。
  17836. */
  17837. static len(a: Line): number;
  17838. /**
  17839. * @en The start point.
  17840. * @zh 起点。
  17841. */
  17842. s: math.Vec3;
  17843. /**
  17844. * @en The end point.
  17845. * @zh 终点。
  17846. */
  17847. e: math.Vec3;
  17848. /**
  17849. * @en Gets the type of the shape. Always returns `enums.SHAPE_LINE`.
  17850. * @zh 获取形状的类型,总是返回 `enums.SHAPE_LINE`。
  17851. */
  17852. get type(): number;
  17853. /**
  17854. * @en Constructs a line.
  17855. * @zh 构造一条线。
  17856. * @param sx @en The x coordinate of the start position. @zh 起点的 x 坐标。
  17857. * @param sy @en The y coordinate of the start position. @zh 起点的 y 坐标。
  17858. * @param sz @en The z coordinate of the start position. @zh 起点的 z 坐标。
  17859. * @param ex @en The x coordinate of the end position. @zh 终点的 x 坐标。
  17860. * @param ey @en The y coordinate of the end position. @zh 终点的 y 坐标。
  17861. * @param ez @en the z coordinate of the end position. @zh 终点的 z 坐标。
  17862. */
  17863. constructor(sx?: number, sy?: number, sz?: number, ex?: number, ey?: number, ez?: number);
  17864. /**
  17865. * @en Calculates the length of the line.
  17866. * @zh 计算线段的长度。
  17867. * @returns @en The length of the line. @zh 线段的长度。
  17868. */
  17869. length(): number;
  17870. }
  17871. /**
  17872. * @en
  17873. * Basic Geometry: Plane.
  17874. * Plane Equation: a*x + b*y + c*z - d = 0.
  17875. * @zh
  17876. * 基础几何:平面。
  17877. * 平面方程: a*x + b*y + c*z - d = 0。
  17878. */
  17879. export class Plane {
  17880. /**
  17881. * @en
  17882. * Creates a new plane.
  17883. * @zh
  17884. * 创建一个新的平面。
  17885. * @param nx @en The x component of normal vector. @zh 法向量的 x 部分。
  17886. * @param ny @en The y component of normal vector. @zh 法向量的 y 部分。
  17887. * @param nz @en The z component of normal vector. @zh 法向量的 z 部分。
  17888. * @param d @en The distance between normal vector and the origin. @zh 与原点的距离。
  17889. * @returns @en The created plane object. @zh 新创建的平面。
  17890. */
  17891. static create(nx: number, ny: number, nz: number, d: number): Plane;
  17892. /**
  17893. * @en
  17894. * Clones a new plane.
  17895. * @zh
  17896. * 克隆一个新的平面。
  17897. * @param p @en The Plane object to be cloned from. @zh 克隆的来源平面对象。
  17898. * @returns @en The cloned Plane object @zh 克隆出的平面对象。
  17899. */
  17900. static clone(p: Plane): Plane;
  17901. /**
  17902. * @en
  17903. * Copies the values from one plane to another.
  17904. * @zh
  17905. * 复制一个平面的值到另一个。
  17906. * @param out @en The object to be operated on. @zh 接受操作的对象。
  17907. * @param p @en The source of replication. @zh 复制的来源。
  17908. * @returns @en The object to be operated on. @zh 接受操作的对象。
  17909. */
  17910. static copy(out: Plane, p: Plane): Plane;
  17911. /**
  17912. * @en
  17913. * Creates a plane from three points
  17914. * @zh
  17915. * 用三个点创建一个平面。
  17916. * @param out @en The Plane object to be operated on. @zh 接受操作的对象。
  17917. * @param a @en The point a. @zh 点 a。
  17918. * @param b @en The point b. @zh 点 b。
  17919. * @param c @en The point c. @zh 点 c。
  17920. * @returns @en The Plane object to be operated on, same as `out` parameter. @zh 接受操作的对象,与 `out` 相同。
  17921. */
  17922. static fromPoints(out: Plane, a: math.Vec3, b: math.Vec3, c: math.Vec3): Plane;
  17923. /**
  17924. * @en
  17925. * Sets the components of a plane to the given values.
  17926. * @zh
  17927. * 将给定平面的属性设置为给定值。
  17928. * @param out @en The Plane object to be operated on. @zh 接受操作的对象。
  17929. * @param nx @en The x component of normal vector. @zh 法向量量的 x 部分。
  17930. * @param ny @en The y component of normal vector. @zh 法向量的 y 部分。
  17931. * @param nz @en The z component of normal vector. @zh 法向量的 z 部分。
  17932. * @param d @en The distance between normal vector and the origin. @zh 与原点的距离。
  17933. * @returns @en The object to be operated on, same as the `out` parameter. @zh 接受操作的对象,与 `out` 参数相同。
  17934. */
  17935. static set(out: Plane, nx: number, ny: number, nz: number, d: number): Plane;
  17936. /**
  17937. * @en
  17938. * Creates plane from normal and point.
  17939. * @zh
  17940. * 用一条法线和一个点创建平面。
  17941. * @param out @en The object to be operated on. @zh 接受操作的对象。
  17942. * @param normal @en The normal of the plane. @zh 平面的法线。
  17943. * @param point @en A point in the plane. @zh 平面上的一点。
  17944. * @returns @en The object to be operated on, same as the `out` parameter. @zh 接受操作的对象,与 `out` 参数相同。
  17945. */
  17946. static fromNormalAndPoint(out: Plane, normal: math.Vec3, point: math.Vec3): Plane;
  17947. /**
  17948. * @en
  17949. * Normalizes a plane.
  17950. * @zh
  17951. * 归一化一个平面。
  17952. * @param out @en The object to be operated on. @zh 接受操作的对象。
  17953. * @param a @en Source data for the operation. @zh 操作的源数据。
  17954. * @returns @en The object to be operated on, sames as the `out` parameter. @zh 接受操作的对象,与 `out` 相同。
  17955. */
  17956. static normalize(out: Plane, a: Plane): Plane;
  17957. /**
  17958. * @en
  17959. * The normal of the plane.
  17960. * @zh
  17961. * 法线向量。
  17962. */
  17963. n: math.Vec3;
  17964. /**
  17965. * @en
  17966. * The distance from the origin to the plane.
  17967. * @zh
  17968. * 原点到平面的距离。
  17969. */
  17970. d: number;
  17971. /**
  17972. * @en
  17973. * Gets the type of the Plane, its value is `enums.SHAPE_PLANE`.
  17974. * @zh
  17975. * 获取形状的类型,值为 `enums.SHAPE_PLANE`。
  17976. */
  17977. get type(): number;
  17978. set x(val: number);
  17979. get x(): number;
  17980. set y(val: number);
  17981. get y(): number;
  17982. set z(val: number);
  17983. get z(): number;
  17984. set w(val: number);
  17985. get w(): number;
  17986. protected readonly _type: number;
  17987. /**
  17988. * @en
  17989. * Constructs a plane.
  17990. * @zh
  17991. * 构造一个平面。
  17992. * @param nx @en The x component of normal vector. @zh 法向量的 x 部分。
  17993. * @param ny @en The y component of normal vector. @zh 法向量的 y 部分。
  17994. * @param nz @en The z component of normal vector. @zh 法向量的 z 部分。
  17995. * @param d @en The distance between normal vector and the origin. @zh 与原点的距离。
  17996. */
  17997. constructor(nx?: number, ny?: number, nz?: number, d?: number);
  17998. /**
  17999. * @en
  18000. * Transforms this plane by a 4x4 matrix.
  18001. * @zh
  18002. * 使用一个 4x4 矩阵变换此平面。
  18003. * @param mat @en The 4x4 matrix for transformation @zh 用于变换的 4x4 矩阵。
  18004. */
  18005. transform(mat: math.Mat4): void;
  18006. }
  18007. /**
  18008. * @en
  18009. * Basic Geometry: Ray.
  18010. * @zh
  18011. * 基础几何:射线。
  18012. */
  18013. export class Ray {
  18014. /**
  18015. * @en
  18016. * Creates a new ray.
  18017. * @zh
  18018. * 创建一条射线。
  18019. * @param {number} ox @en The x component of start point. @zh 起点的 x 部分。
  18020. * @param {number} oy @en The y component of start point. @zh 起点的 y 部分。
  18021. * @param {number} oz @en The z component of start point. @zh 起点的 z 部分。
  18022. * @param {number} dx @en The x component of direction point. @zh 方向的 x 部分。
  18023. * @param {number} dy @en The y component of direction point. @zh 方向的 y 部分。
  18024. * @param {number} dz @en The z component of direction point. @zh 方向的 z 部分。
  18025. * @returns {Ray} @en The created ray object. @zh 新创建的射线。
  18026. */
  18027. static create(ox?: number, oy?: number, oz?: number, dx?: number, dy?: number, dz?: number): Ray;
  18028. /**
  18029. * @en
  18030. * Creates a new ray initialized with the values from an existing ray.
  18031. * @zh
  18032. * 从一条射线克隆出一条新的射线。
  18033. * @param a @en The Ray object to be cloned from. @zh 克隆的目标。
  18034. * @returns @en The cloned Ray object. @zh 克隆出的新对象。
  18035. */
  18036. static clone(a: Ray): Ray;
  18037. /**
  18038. * @en
  18039. * Copies the values from one ray to another.
  18040. * @zh
  18041. * 复制一个 Ray 的值到另一个 Ray 中。
  18042. * @param out @en The Ray object to copy to. @zh 接受操作的射线。
  18043. * @param a @en The Ray object to copy from. @zh 被复制的射线。
  18044. * @returns @en The Ray object to copy to, same as the `out` parameter. @zh 接受操作的射线,与 `out` 参数相同。
  18045. */
  18046. static copy(out: Ray, a: Ray): Ray;
  18047. /**
  18048. * @en
  18049. * Creates a ray from two points.
  18050. * @zh
  18051. * 用两个点创建一条射线。
  18052. * @param out @en The Ray object. @zh 接受操作的射线。
  18053. * @param origin @en The start point of the ray. @zh 射线的起点。
  18054. * @param target @en The target point on the ray. @zh 射线上的一点。
  18055. * @returns @en The Ray object, same as the `out` parameter. @zh 接受操作的射线,与 `out` 参数相同。
  18056. */
  18057. static fromPoints(out: Ray, origin: math.Vec3, target: math.Vec3): Ray;
  18058. /**
  18059. * @en
  18060. * Sets the components of a ray to the given values.
  18061. * @zh
  18062. * 将给定射线的属性设置为给定的值。
  18063. * @param out @en The Ray object to be modified @zh 接受操作的射线。
  18064. * @param ox @en The x component of start point. @zh 起点的 x 部分。
  18065. * @param oy @en The y component of start point. @zh 起点的 y 部分。
  18066. * @param oz @en The z component of start point. @zh 起点的 z 部分。
  18067. * @param dx @en The x component of direction point. @zh 方向的 x 部分。
  18068. * @param dy @en The y component of direction point. @zh 方向的 y 部分。
  18069. * @param dz @en The z component of direction point. @zh 方向的 z 部分。
  18070. * @returns @en The Ray object, same as the `out` parameter. @zh 接受操作的射线,与 `out` 相同。
  18071. */
  18072. static set(out: Ray, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18073. /**
  18074. * @en
  18075. * The origin of the ray.
  18076. * @zh
  18077. * 起点。
  18078. */
  18079. o: math.Vec3;
  18080. /**
  18081. * @en
  18082. * The direction of the ray.
  18083. * @zh
  18084. * 方向。
  18085. */
  18086. d: math.Vec3;
  18087. /**
  18088. * @en
  18089. * Gets the type of the ray, its value is `enums.SHAPE_RAY`.
  18090. * @zh
  18091. * 获取形状的类型,其值为`enums.SHAPE_RAY`。
  18092. */
  18093. get type(): number;
  18094. protected readonly _type: number;
  18095. /**
  18096. * @en
  18097. * Constructs a ray.
  18098. * @zh
  18099. * 构造一条射线。
  18100. * @param ox @en The x component of start point. @zh 起点的 x 部分。
  18101. * @param oy @en The y component of start point. @zh 起点的 y 部分。
  18102. * @param oz @en The z component of start point. @zh 起点的 z 部分。
  18103. * @param dx @en The x component of direction point. @zh 方向的 x 部分。
  18104. * @param dy @en The y component of direction point. @zh 方向的 y 部分。
  18105. * @param dz @en The z component of direction point. @zh 方向的 z 部分。
  18106. */
  18107. constructor(ox?: number, oy?: number, oz?: number, dx?: number, dy?: number, dz?: number);
  18108. /**
  18109. * @en
  18110. * Calculates a point on the ray with the specific distance from the origin point.
  18111. * @zh
  18112. * 根据给定的距离计算出射线上的一点。
  18113. * @param out @en Another point on the ray. @zh 射线上的另一点。
  18114. * @param distance @en The given distance. @zh 给定的距离。
  18115. */
  18116. computeHit(out: math.IVec3Like, distance: number): void;
  18117. }
  18118. /**
  18119. * @en
  18120. * Basic Geometry: Triangle.
  18121. * @zh
  18122. * 基础几何:三角形。
  18123. */
  18124. export class Triangle {
  18125. /**
  18126. * @en
  18127. * Creates a new triangle instance.
  18128. * @zh
  18129. * 创建一个新的三角形。
  18130. * @param {number} ax @en The x component of point a @zh a 点的 x 部分。
  18131. * @param {number} ay @en The y component of point a @zh a 点的 y 部分。
  18132. * @param {number} az @en The z component of point a @zh a 点的 z 部分。
  18133. * @param {number} bx @en The x component of point b @zh b 点的 x 部分。
  18134. * @param {number} by @en The y component of point b @zh b 点的 y 部分。
  18135. * @param {number} bz @en The z component of point b @zh b 点的 z 部分。
  18136. * @param {number} cx @en The x component of point c @zh c 点的 x 部分。
  18137. * @param {number} cy @en The y component of point c @zh c 点的 y 部分。
  18138. * @param {number} cz @en The z component of point c @zh c 点的 z 部分。
  18139. * @returns {Triangle} @en The created Triangle instance. @zh 创建出的三角形实例。
  18140. */
  18141. static create(ax?: number, ay?: number, az?: number, bx?: number, by?: number, bz?: number, cx?: number, cy?: number, cz?: number): Triangle;
  18142. /**
  18143. * @en
  18144. * Clones a triangle instance.
  18145. * @zh
  18146. * 克隆一个新的三角形。
  18147. * @param t @en The Triangle object to be cloned from. @zh 克隆的目标。
  18148. * @returns @en The cloned triangle instance. @zh 克隆出的新对象。
  18149. */
  18150. static clone(t: Triangle): Triangle;
  18151. /**
  18152. * @en
  18153. * Copies the values from one triangle to another.
  18154. * @zh
  18155. * 复制一个三角形的值到另一个三角形中。
  18156. * @param out @en The target Triangle object to be copied to. @zh 接受操作的三角形。
  18157. * @param t @en A Triangle object to be copied from. @zh 被复制的三角形。
  18158. * @returns @en The target Triangle object to be copied to, same as the `out` parameter. @zh 接受操作的三角形,与 `out` 参数相同。
  18159. */
  18160. static copy(out: Triangle, t: Triangle): Triangle;
  18161. /**
  18162. * @en
  18163. * Creates a triangle instance from three points.
  18164. * @zh
  18165. * 用三个点创建一个三角形。
  18166. * @param out @en The Triangle object to be modified. @zh 接受操作的三角形。
  18167. * @param a @en The point value to set out.a. @zh a 点。
  18168. * @param b @en The point value to set out.b. @zh b 点。
  18169. * @param c @en The point value to set out.c. @zh c 点。
  18170. * @returns @en The Triangle object to be modified, same as the `out` parameter. @zh 接受操作的三角形,与 `out` 参数相同。
  18171. */
  18172. static fromPoints(out: Triangle, a: math.Vec3, b: math.Vec3, c: math.Vec3): Triangle;
  18173. /**
  18174. * @en
  18175. * Sets the components of a triangle to the given values.
  18176. * @zh
  18177. * 将给定三角形的属性设置为给定值。
  18178. * @param out @en The Triangle object to be set. @zh 接受操作的三角形。
  18179. * @param ax @en The value to set out.a.x. @zh a 点的 x 部分。
  18180. * @param ay @en The value to set out.a.y. @zh a 点的 y 部分。
  18181. * @param az @en The value to set out.a.z. @zh a 点的 z 部分。
  18182. * @param bx @en The value to set out.b.x. @zh b 点的 x 部分。
  18183. * @param by @en The value to set out.b.y. @zh b 点的 y 部分。
  18184. * @param bz @en The value to set out.b.z. @zh b 点的 z 部分。
  18185. * @param cx @en The value to set out.c.x. @zh c 点的 x 部分。
  18186. * @param cy @en The value to set out.c.y. @zh c 点的 y 部分。
  18187. * @param cz @en The value to set out.c.z. @zh c 点的 z 部分。
  18188. * @returns @en The Triangle object to be set, same as the `out` parameter. @zh 接受操作的三角形,与 `out` 参数相同。
  18189. */
  18190. static set(out: Triangle, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Triangle;
  18191. /**
  18192. * @en
  18193. * Point a.
  18194. * @zh
  18195. * 点 a。
  18196. */
  18197. a: math.Vec3;
  18198. /**
  18199. * @en
  18200. * Point b.
  18201. * @zh
  18202. * 点 b。
  18203. */
  18204. b: math.Vec3;
  18205. /**
  18206. * @en
  18207. * Point c.
  18208. * @zh
  18209. * 点 c。
  18210. */
  18211. c: math.Vec3;
  18212. /**
  18213. * @en
  18214. * Gets the type of the triangle, always returns `enums.SHAPE_TRIANGLE`.
  18215. * @zh
  18216. * 获取此三角形的类型,固定返回 `enums.SHAPE_TRIANGLE`。
  18217. */
  18218. get type(): number;
  18219. protected readonly _type: number;
  18220. /**
  18221. * @en
  18222. * Constructs a triangle.
  18223. * @zh
  18224. * 构造一个三角形。
  18225. * @param {number} ax @en x component of point a. @zh a 点的 x 部分。
  18226. * @param {number} ay @en y component of point a. @zh a 点的 y 部分。
  18227. * @param {number} az @en z component of point a. @zh a 点的 z 部分。
  18228. * @param {number} bx @en x component of point b. @zh b 点的 x 部分。
  18229. * @param {number} by @en y component of point b. @zh b 点的 y 部分。
  18230. * @param {number} bz @en z component of point b. @zh b 点的 z 部分。
  18231. * @param {number} cx @en x component of point c. @zh c 点的 x 部分。
  18232. * @param {number} cy @en y component of point c. @zh c 点的 y 部分。
  18233. * @param {number} cz @en z component of point c. @zh c 点的 z 部分。
  18234. */
  18235. constructor(ax?: number, ay?: number, az?: number, bx?: number, by?: number, bz?: number, cx?: number, cy?: number, cz?: number);
  18236. }
  18237. /**
  18238. * @en
  18239. * Basic Geometry: Sphere.
  18240. * @zh
  18241. * 基础几何:球。
  18242. */
  18243. export class Sphere {
  18244. /**
  18245. * @en
  18246. * Creates a new sphere instance.
  18247. * @zh
  18248. * 创建一个新的球实例。
  18249. * @param cx @en The X-Coordinate of the center point relative to the origin. @zh 相对于原点的中心点的 X 坐标。
  18250. * @param cy @en The Y-Coordinate of the center point relative to the origin. @zh 相对于原点的中心点的 Y 坐标。
  18251. * @param cz @en The Z-Coordinate of the center point relative to the origin. @zh 相对于原点的中心点的 Z 坐标。
  18252. * @param r @en The radius of the sphere. @zh 球体的半径
  18253. * @returns @en A new sphere instance. @zh 一个新的球实例。
  18254. */
  18255. static create(cx: number, cy: number, cz: number, r: number): Sphere;
  18256. /**
  18257. * @en
  18258. * Clones a sphere instance.
  18259. * @zh
  18260. * 克隆一个新的球实例。
  18261. * @param p @en The sphere object to clone from. @zh 克隆的目标。
  18262. * @returns @en The sphere object to clone to. @zh 克隆出的实例。
  18263. */
  18264. static clone(p: Sphere): Sphere;
  18265. /**
  18266. * @en
  18267. * Copies the values from one sphere to another.
  18268. * @zh
  18269. * 复制一个球的值到另一个球中。
  18270. * @param out @en The sphere object to copy to. @zh 接受操作的球实例。
  18271. * @param a @en The sphere object to copy from. @zh 被复制的球实例。
  18272. * @returns @en The sphere object to copy to. @zh 接受操作的球实例。
  18273. */
  18274. static copy(out: Sphere, p: Sphere): Sphere;
  18275. /**
  18276. * @en
  18277. * Creates a new sphere instance from two points.
  18278. * @zh
  18279. * 从两个点创建一个新的球实例。
  18280. * @param out - @en The sphere created from the two points. @zh 接受操作的球实例。
  18281. * @param minPos - @en The lower point of the sphere. @zh 球的较小点。
  18282. * @param maxPos - @en The upper point of the sphere. @zh 球的较大点。
  18283. * @returns @en The created sphere, same as the `out` parameter. @zh 接受操作的球实例,与 `out` 参数相同。
  18284. */
  18285. static fromPoints(out: Sphere, minPos: math.Vec3, maxPos: math.Vec3): Sphere;
  18286. /**
  18287. * @en
  18288. * Sets the components of a sphere to the given values
  18289. * @zh
  18290. * 将球体的属性设置为给定的值。
  18291. * @param out @en The sphere to set values to. @zh 接受操作的球实例。
  18292. * @param cx @en The X-Coordinate of the center point which relative to the origin. @zh 相对于原点的中心点的 X 坐标。
  18293. * @param cy @en The Y-Coordinate of the center point which relative to the origin. @zh 相对于原点的中心点的 Y 坐标。
  18294. * @param cz @en The Z-Coordinate of the center point which relative to the origin. @zh 相对于原点的中心点的 Z 坐标。
  18295. * @param r @en The radius of the sphere. @zh 要设置的球的半径。
  18296. * @returns @en The sphere to set values to, same as the `out` parameter. @zh 接受操作的实例,与 `out` 相同。
  18297. * @function
  18298. */
  18299. static set(out: Sphere, cx: number, cy: number, cz: number, r: number): Sphere;
  18300. /**
  18301. * @en
  18302. * The center of this sphere.
  18303. * @zh
  18304. * 当前球在本地坐标中的中心点。
  18305. */
  18306. protected _center: math.Vec3;
  18307. get center(): math.Vec3;
  18308. set center(val: math.Vec3);
  18309. /**
  18310. * @en
  18311. * The radius of this sphere.
  18312. * @zh
  18313. * 当前球的半径。
  18314. */
  18315. get radius(): number;
  18316. set radius(val: number);
  18317. /**
  18318. * @en
  18319. * Gets the type of the shape, always returns `enums.SHAPE_SPHERE`.
  18320. * @zh
  18321. * 获取球的类型,固定返回 `enums.SHAPE_SPHERE`。
  18322. */
  18323. get type(): number;
  18324. protected readonly _type: number;
  18325. /**
  18326. * @en
  18327. * Constructs a sphere instance.
  18328. * @zh
  18329. * 构造一个球。
  18330. * @param cx @en The X-Coordinate of the sphere. @zh 该球的世界坐标的 X 坐标。
  18331. * @param cy @en The Y-Coordinate of the sphere. @zh 该球的世界坐标的 Y 坐标。
  18332. * @param cz @en The Z-Coordinate of the sphere. @zh 该球的世界坐标的 Z 坐标。
  18333. * @param r @en The radius of the sphere. @zh 球的半径。
  18334. */
  18335. constructor(cx?: number, cy?: number, cz?: number, r?: number);
  18336. destroy(): void;
  18337. /**
  18338. * @en
  18339. * Clones a sphere instance.
  18340. * @zh
  18341. * 克隆一个球实例。
  18342. * @returns @en The cloned sphere instance. @zh 克隆的球实例。
  18343. */
  18344. clone(): Sphere;
  18345. /**
  18346. * @en
  18347. * Copies the values from a sphere to the current sphere.
  18348. * @zh
  18349. * 复制一个球的值到当前球实例中。
  18350. * @param a @en The sphere to copy from. @zh 拷贝的目标。
  18351. */
  18352. copy(a: Sphere): Sphere;
  18353. /**
  18354. * @en
  18355. * Gets the bounding points of this sphere.
  18356. * @zh
  18357. * 获取此球体的边界点。
  18358. * @param minPos @en The point with maximum coordinates of the sphere. @zh 当前球实例的最小点。
  18359. * @param maxPos @en The point with minimum coordinates of the sphere. @zh 当前球实例的最大点。
  18360. */
  18361. getBoundary(minPos: math.Vec3, maxPos: math.Vec3): void;
  18362. /**
  18363. * @en
  18364. * Transforms this sphere by a 4x4 matrix and RTS and stores to the `out` parameter.
  18365. * @zh
  18366. * 用一个 4x4 矩阵和一组 RTS 变换此球体,并将结果存储在 `out` 参数中。
  18367. * @param m @en The 4x4 transform matrix. @zh 4x4 变换矩阵。
  18368. * @param pos @en The position part of the transform. @zh 变换的位置部分。
  18369. * @param rot @en The rotation part of the transform. @zh 变换的旋转部分。
  18370. * @param scale @en The scale part of the transform. @zh 变换的缩放部分。
  18371. * @param out @en The sphere which the transform will be applied to. @zh 变换的目标。
  18372. */
  18373. transform(m: math.Mat4, pos: math.Vec3, rot: math.Quat, scale: math.Vec3, out: Sphere): void;
  18374. /**
  18375. * @en
  18376. * Transforms this sphere by a 4x4 matrix and a quaternion, stores the result to the `out` parameter.
  18377. * @zh
  18378. * 使用一个 4x4 矩阵和一个四元数变换此球体,并将结果存储在 `out` 参数中。
  18379. * @param m @en The 4x4 transform matrix. @zh 4x4 变换矩阵。
  18380. * @param rot @en The rotation part of the transform. @zh 变换的旋转部分。
  18381. * @param out @en The sphere which the transform will be applied to. @zh 变换的目标。
  18382. */
  18383. translateAndRotate(m: math.Mat4, rot: math.Quat, out: Sphere): void;
  18384. /**
  18385. * @en
  18386. * Scales this sphere and stores the result to the `out` parameter.
  18387. * @zh
  18388. * 对当前球实例进行缩放处理,并将结果存储在 `out` 参数中。
  18389. * @param scale @en The scale value. @zh 缩放值。
  18390. * @param out @en The sphere which the scale will be applied to. @zh 缩放的目标。
  18391. */
  18392. setScale(scale: math.Vec3, out: Sphere): void;
  18393. /**
  18394. * @en Merges a point to this sphere.
  18395. * @zh 合并一个点到当前球实例中。
  18396. * @param point @en The point to be merged to this sphere. @zh 要合并到当前球实例的点。
  18397. */
  18398. mergePoint(point: math.Vec3): void;
  18399. /**
  18400. * @en Merges some points to this sphere.
  18401. * @zh 合并一些点到当前球实例中。
  18402. * @param points @en The points to be merged to this sphere. @zh 要合并到当前球实例的点列表。
  18403. */
  18404. mergePoints(points: math.Vec3[]): void;
  18405. /**
  18406. * @en Merges a AABB to this sphere.
  18407. * @zh 合并一个 AABB 到当前球实例中。
  18408. * @param a @en The AABB instance to be merged to this sphere. @zh 要合并到当前球实例的 AABB 实例。
  18409. */
  18410. mergeAABB(a: AABB): void;
  18411. }
  18412. /**
  18413. * @en
  18414. * Basic Geometry: Axis-aligned bounding box, using center and half extents structure.
  18415. * It's a fairly computationally and memory efficient way of checking whether two 3D objects might be touching.
  18416. * @zh
  18417. * 基础几何:轴对齐包围盒,使用中心点和半长宽高的结构。
  18418. * 这是检查两个 3D 对象是否相交的一种在计算和内存上效率都相当高的方法。
  18419. */
  18420. export class AABB {
  18421. /**
  18422. * @en
  18423. * Creates a new AABB instance.
  18424. * @zh
  18425. * 创建一个新的 AABB 实例。
  18426. * @param px @zh AABB 原点的 X 坐标。 @en The x coordinate of the origin of the AABB.
  18427. * @param py @zh AABB 原点的 Y 坐标。 @en The y coordinate of the origin of the AABB.
  18428. * @param pz @zh AABB 原点的 Z 坐标。 @en The z coordinate of the origin of the AABB.
  18429. * @param hw @zh AABB 宽度的一半。 @en Half the width of the AABB.
  18430. * @param hh @zh AABB 高度的一半。 @en Half the height of the AABB.
  18431. * @param hl @zh AABB 长度的一半。 @en Half the length of the AABB.
  18432. * @returns @zh 返回新创建的 AABB 实例。 @en A new instance of AABB.
  18433. */
  18434. static create(px?: number, py?: number, pz?: number, hw?: number, hh?: number, hl?: number): AABB;
  18435. /**
  18436. * @en
  18437. * Clones an AABB, which will create a new AABB instance with the same value as the input parameter `a`. Note that each time `clone` is invoked, a new AABB object will be created, so use `copy` method whenever it could to reduce GC pressure.
  18438. * @zh
  18439. * 克隆一个 AABB,其会创建出一个值跟输入参数`a`一样的 AABB 实例。注意,每次调用 `clone` 都会创建出新实例,尽可能使用 `copy` 方法以减小 GC 压力。
  18440. * @param a @zh 克隆的目标。 @en The target object to be cloned.
  18441. * @returns @zh 克隆出的 AABB 实例。@en The cloned AABB instance.
  18442. */
  18443. static clone(a: AABB | Readonly<AABB>): AABB;
  18444. /**
  18445. * @en
  18446. * Copies the values from one AABB to another, the process will not generate temporary objects.
  18447. * @zh
  18448. * 将一个 AABB 的值复制到另一个 AABB 中,此过程将不会产生临时对象。
  18449. * @param out @zh 接受操作的 AABB。 @en The output AABB which is the copy destination.
  18450. * @param a @zh 被复制的 AABB,此为只读参数。 @en The source object of the copy operation, it's readonly.
  18451. * @returns @zh 接受操作的 AABB `out` 的引用。 @en The reference to the first parameter `out`.
  18452. */
  18453. static copy(out: AABB, a: AABB | Readonly<AABB>): AABB;
  18454. /**
  18455. * @en
  18456. * Constructs a new AABB from two corner points.
  18457. * @zh
  18458. * 从两个点创建一个新的 AABB。
  18459. * @param out @zh 接受操作的 AABB。 @en The output AABB.
  18460. * @param minPos @zh AABB 的最小点。 @en Minimum point of the AABB.
  18461. * @param maxPos @zh AABB 的最大点。 @en Maximum point of the AABB.
  18462. * @returns @zh 接受操作的 AABB `out` 的引用。 @en The reference to the first parameter `out`.
  18463. */
  18464. static fromPoints(out: AABB, minPos: math.IVec3, maxPos: math.IVec3): AABB;
  18465. /**
  18466. * @en
  18467. * Sets the components of a AABB to the given values.
  18468. * @zh
  18469. * 将 AABB 的属性设置为给定的值。
  18470. * @param @zh out 接受操作的 AABB。 @en The output AABB to set.
  18471. * @param px @zh - AABB 原点的 X 坐标。 @en The x coordinate of the origin of the AABB.
  18472. * @param py @zh - AABB 原点的 Y 坐标。 @en The y coordinate of the origin of the AABB.
  18473. * @param pz @zh - AABB 原点的 Z 坐标。 @en The z coordinate of the origin of the AABB.
  18474. * @param hw @zh - AABB 宽度的一半。 @en Half the width of the AABB.
  18475. * @param hh @zh - AABB 高度的一半。 @en Half the height of the AABB.
  18476. * @param hl @zh - AABB 长度的一半。 @en Half the length of the AABB.
  18477. * @returns @zh 接受操作的 AABB `out` 的引用。 @en The reference fo the first parameter `out`.
  18478. */
  18479. static set(out: AABB, px: number, py: number, pz: number, hw: number, hh: number, hl: number): AABB;
  18480. /**
  18481. * @en
  18482. * Merges two AABB instances into one.
  18483. * @zh
  18484. * 合并两个 AABB 到一个目标 AABB 中。
  18485. * @param out @zh 接受操作的目标 AABB。 @en The output AABB to storge the merge result.
  18486. * @param a @zh 第一个输入的 AABB,当其与 out 参数不同的时候,此函数内部不会修改其值。 @en The first AABB to be merged, its value will not be modified if `a` is not equal to the `out` paramater.
  18487. * @param b @zh 第二个输入的 AABB,当其与 out 参数不同的时候,此函数内部不会修改其值。 @en The second AABB to be merged, its value will not be modified if `b` is not equal to the `out` paramater.
  18488. * @returns @zh 接受操作的 AABB `out` 的引用。 @en The reference to the first parameter `out`.
  18489. */
  18490. static merge(out: AABB, a: AABB | Readonly<AABB>, b: AABB | Readonly<AABB>): AABB;
  18491. /**
  18492. * @en
  18493. * Converts an AABB to a bounding sphere.
  18494. * @zh
  18495. * 包围盒转包围球
  18496. * @param out @zh 接受操作的包围球。 @en The output bounding sphere.
  18497. * @param a @zh 输入的 AABB,只读参数。 @en The input AABB,it's readonly.
  18498. * @returns @zh 接受操作的包围球 `out` 的引用. @en The reference to the first parameter `out`.
  18499. */
  18500. static toBoundingSphere(out: Sphere, a: AABB | Readonly<AABB>): Sphere;
  18501. /**
  18502. * @en
  18503. * Transforms an AABB by a 4x4 matrix and stores the result to the `out` parameter.
  18504. * @zh
  18505. * 使用一个 4 乘 4 矩阵变换一个 AABB 并将结果存储于 out 参数中。
  18506. * @param out @zh 接受操作的 AABB。 @en The output AABB to store the result.
  18507. * @param a @zh 输入的源 AABB,如果其与 out 参数不是同一个对象,那么 a 将不会被此函数修改。 @en The input AABB, if it's different with the `out` parameter, then `a` will not be changed by this function.
  18508. * @param matrix @zh 矩阵。 @en The transformation matrix.
  18509. * @returns @zh 接受操作的 AABB `out` 的引用。 @en The reference of the first parameter `out`.
  18510. */
  18511. static transform(out: AABB, a: AABB | Readonly<AABB>, matrix: math.Mat4 | Readonly<math.Mat4>): AABB;
  18512. /**
  18513. * @en
  18514. * The center point of this AABB.
  18515. * @zh
  18516. * 本地坐标的中心点。
  18517. */
  18518. center: math.Vec3;
  18519. /**
  18520. * @en
  18521. * Half the size of this AABB.
  18522. * @zh
  18523. * 长宽高的一半。
  18524. */
  18525. halfExtents: math.Vec3;
  18526. /**
  18527. * @en
  18528. * Gets the type of this shape.
  18529. * @zh
  18530. * 获取此形状的类型。
  18531. */
  18532. get type(): number;
  18533. protected readonly _type: number;
  18534. constructor(px?: number, py?: number, pz?: number, hw?: number, hh?: number, hl?: number);
  18535. /**
  18536. * @en
  18537. * Gets the bounding points of this AABB.
  18538. * @zh
  18539. * 获取此 AABB 的最小点和最大点。
  18540. * @param minPos @zh 存放此 AABB 最小点的向量。 @en The minimum position of the AABB to be stored to.
  18541. * @param maxPos @zh 存放此 AABB 最大点的向量。 @en The maximum position of the AABB to be stored to.
  18542. */
  18543. getBoundary(minPos: math.IVec3Like, maxPos: math.IVec3Like): void;
  18544. /**
  18545. * @en
  18546. * Transforms this AABB by a 4x4 matrix and stores the result to `out` parameter
  18547. * @zh
  18548. * 使用 4 乘 4 矩阵变换此 AABB 并将结果存储于 `out` 参数中。
  18549. * @param m @zh 变换的矩阵。 @en The transform matrix.
  18550. * @param pos @zh 变换的位置部分。 @en 3d-vector translation.
  18551. * @param rot @zh 变换的旋转部分。 @en Quaternion rotation.
  18552. * @param scale @zh 变换的缩放部分。 @en 3d-vector scale.
  18553. * @param out @zh 存储结果的 AABB。 @en The output AABB.
  18554. */
  18555. transform(m: math.Mat4, pos: math.Vec3 | null, rot: math.Quat | null, scale: math.Vec3 | null, out: AABB): void;
  18556. /**
  18557. * @en
  18558. * Clones this AABB, which will create a new AABB instance with the same value as this AABB. Note that each time `clone` is invoked, a new AABB object will be created, so use `copy` method whenever it could to reduce GC pressure.
  18559. * @zh
  18560. * 克隆一个 AABB,其会创建出一个值跟当前 AABB 一样的实例。注意,每次调用 `clone` 都会创建出新实例,尽可能使用 `copy` 方法以减小 GC 压力。
  18561. * @returns @zh 克隆出的 AABB 实例 @en The cloned AABB instance.
  18562. */
  18563. clone(): AABB;
  18564. /**
  18565. * @en
  18566. * Copies the values from one AABB to this AABB, the process will not generate temporary objects.
  18567. * @zh
  18568. * 将一个 AABB 的值复制到当前 AABB 中,此过程将不会产生临时对象。
  18569. * @param a @zh 被复制的 AABB,此为只读参数。 @en The source object of the copy operation, it's readonly.
  18570. * @returns @zh 当前 AABB 的引用。 @en The reference of this AABB.
  18571. */
  18572. copy(a: AABB | Readonly<AABB>): AABB;
  18573. /**
  18574. * @en Merges a point to this AABB.
  18575. * @zh 合并一个顶点到当前 AABB 中。
  18576. * @param point @zh 3D 世界中某一个位置的顶点。 @en A point in 3D space.
  18577. */
  18578. mergePoint(point: math.IVec3): void;
  18579. /**
  18580. * @en Merges some points to this AABB.
  18581. * @zh 合并一系列顶点到当前 AABB 中。
  18582. * @param points @zh 3D 世界中的顶点列表。 @en A list of points in 3D space.
  18583. */
  18584. mergePoints(points: math.IVec3[]): void;
  18585. /**
  18586. * @en Merges all points in a frustum to this AABB.
  18587. * @zh 合并一个截头锥体的所有顶点到此 AABB 中。
  18588. * @param frustum @zh 输入的截头锥体 @en The frustum object.
  18589. */
  18590. mergeFrustum(frustum: Frustum | Readonly<Frustum>): void;
  18591. }
  18592. /**
  18593. * @en
  18594. * Basic Geometry: Oriented bounding box.
  18595. * @zh
  18596. * 基础几何:方向包围盒。
  18597. */
  18598. export class OBB {
  18599. /**
  18600. * @en
  18601. * Creates a new OBB instance
  18602. * @zh
  18603. * 创建一个新的 OBB 实例。
  18604. * @param cx @zh 形状的相对于原点的 X 坐标。 @en The x coordinate of origin.
  18605. * @param cy @zh 形状的相对于原点的 Y 坐标。 @en The y coordinate of origin.
  18606. * @param cz @zh 形状的相对于原点的 Z 坐标。 @en The z coordinate of origin.
  18607. * @param hw @zh - OBB 宽度的一半。 @en Half the width of the OBB.
  18608. * @param hh @zh - OBB 高度的一半。 @en Half the height of the OBB.
  18609. * @param hl @zh - OBB 长度的一半。 @en Half the length of the OBB.
  18610. * @param ox_1 @zh 方向矩阵参数,第 1 条轴的 x 分量。 @en The x component of the first axis of the OBB.
  18611. * @param ox_2 @zh 方向矩阵参数,第 2 条轴的 x 分量。 @en The x component of the second axis of the OBB.
  18612. * @param ox_3 @zh 方向矩阵参数,第 3 条轴的 x 分量。 @en The x component of the third axis of the OBB.
  18613. * @param oy_1 @zh 方向矩阵参数,第 1 条轴的 y 分量。 @en The y component of the first axis of the OBB.
  18614. * @param oy_2 @zh 方向矩阵参数,第 2 条轴的 y 分量。 @en The y component of the second axis of the OBB.
  18615. * @param oy_3 @zh 方向矩阵参数,第 3 条轴的 y 分量。 @en The y component of the third axis of the OBB.
  18616. * @param oz_1 @zh 方向矩阵参数,第 1 条轴的 z 分量。 @en The z component of the first axis of the OBB.
  18617. * @param oz_2 @zh 方向矩阵参数,第 2 条轴的 z 分量。 @en The z component of the second axis of the OBB.
  18618. * @param oz_3 @zh 方向矩阵参数,第 3 条轴的 z 分量。 @en The z component of the third axis of the OBB.
  18619. * @returns @zh 返回新创建的 OBB 实例。 @en A new OBB instance.
  18620. */
  18621. static create(cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): OBB;
  18622. /**
  18623. * @en
  18624. * Clones a new OBB instance.
  18625. * @zh
  18626. * 克隆一个 OBB 实例。
  18627. * @param a @zh 克隆的目标。 @en The input OBB.
  18628. * @returns @zh The cloned OBB instance. @en 克隆出的新对象。
  18629. */
  18630. static clone(a: OBB): OBB;
  18631. /**
  18632. * @en
  18633. * Copies the values from one OBB to another.
  18634. * @zh
  18635. * 复制一个 OBB 的值到另一个 OBB 中。
  18636. * @param out @zh 接受操作的 OBB。 @en The output OBB.
  18637. * @param a @zh 被复制的 OBB。 @en The input OBB.
  18638. * @returns @zh 接受操作的 OBB,与 `out` 参数相同。 @en The output OBB, same as the `out` parameter.
  18639. */
  18640. static copy(out: OBB, a: OBB): OBB;
  18641. /**
  18642. * @en
  18643. * Creates a new OBB from two corner points.
  18644. * @zh
  18645. * 用两个点创建一个新的 OBB。
  18646. * @param out @zh - 接受操作的 OBB。 @en The output OBB.
  18647. * @param minPos @zh - OBB 的最小点。 @en The minimum position of the AABB.
  18648. * @param maxPos @zh - OBB 的最大点。 @en The maximum position of the AABB.
  18649. * @returns @zh 接受操作的 OBB,与 `out` 参数相同。 @en The output OBB, same as the `out` parameter.
  18650. */
  18651. static fromPoints(out: OBB, minPos: math.Vec3, maxPos: math.Vec3): OBB;
  18652. /**
  18653. * @en
  18654. * Sets the components of an OBB to the given values.
  18655. * @zh
  18656. * 将给定 OBB 的属性设置为给定的值。
  18657. * @param out @zh 目标 OBB @en The output OBB instance.
  18658. * @param cx @zh 形状的相对于原点的 X 坐标。 @en The x coordinate of origin.
  18659. * @param cy @zh 形状的相对于原点的 Y 坐标。 @en The y coordinate of origin.
  18660. * @param cz @zh 形状的相对于原点的 Z 坐标。 @en The z coordinate of origin.
  18661. * @param hw @zh - obb 宽度的一半。 @en Half the width of the OBB.
  18662. * @param hh @zh - obb 高度的一半。 @en Half the height of the OBB.
  18663. * @param hl @zh - obb 长度的一半。 @en Half the length of the OBB.
  18664. * @param ox_1 @zh 方向矩阵参数,第 1 条轴的 x 分量。 @en The x component of the first axis of the OBB.
  18665. * @param ox_2 @zh 方向矩阵参数,第 2 条轴的 x 分量。 @en The x component of the second axis of the OBB.
  18666. * @param ox_3 @zh 方向矩阵参数,第 3 条轴的 x 分量。 @en The x component of the third axis of the OBB.
  18667. * @param oy_1 @zh 方向矩阵参数,第 1 条轴的 y 分量。 @en The y component of the first axis of the OBB.
  18668. * @param oy_2 @zh 方向矩阵参数,第 2 条轴的 y 分量。 @en The y component of the second axis of the OBB.
  18669. * @param oy_3 @zh 方向矩阵参数,第 3 条轴的 y 分量。 @en The y component of the third axis of the OBB.
  18670. * @param oz_1 @zh 方向矩阵参数,第 1 条轴的 z 分量。 @en The z component of the first axis of the OBB.
  18671. * @param oz_2 @zh 方向矩阵参数,第 2 条轴的 z 分量。 @en The z component of the second axis of the OBB.
  18672. * @param oz_3 @zh 方向矩阵参数,第 3 条轴的 z 分量。 @en The z component of the third axis of the OBB.
  18673. * @returns @zh 接受操作的 OBB,与 `out` 参数相同。 @en The output OBB, same as the `out` parameter.
  18674. */
  18675. static set(out: OBB, cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): OBB;
  18676. /**
  18677. * @en
  18678. * The center point of an OBB in local coordinate.
  18679. * @zh
  18680. * 本地坐标的中心点。
  18681. */
  18682. center: math.Vec3;
  18683. /**
  18684. * @en
  18685. * Half the distance across the OBB in each local axis.
  18686. * @zh
  18687. * 长宽高的一半。
  18688. */
  18689. halfExtents: math.Vec3;
  18690. /**
  18691. * @en
  18692. * Orientation matrix.
  18693. * @zh
  18694. * 方向矩阵。
  18695. */
  18696. orientation: math.Mat3;
  18697. /**
  18698. * @en
  18699. * Gets the type of the OBB. Always returns `enums.SHAPE_OBB`.
  18700. * @zh
  18701. * 获取形状的类型,固定返回 `enums.SHAPE_OBB`。
  18702. */
  18703. get type(): number;
  18704. protected readonly _type: number;
  18705. /**
  18706. * @param cx @zh 形状的相对于原点的 X 坐标。 @en The x coordinate of origin.
  18707. * @param cy @zh 形状的相对于原点的 Y 坐标。 @en The y coordinate of origin.
  18708. * @param cz @zh 形状的相对于原点的 Z 坐标。 @en The z coordinate of origin.
  18709. * @param hw @zh - OBB 宽度的一半。 @en Half the width of the OBB.
  18710. * @param hh @zh - OBB 高度的一半。 @en Half the height of the OBB.
  18711. * @param hl @zh - OBB 长度的一半。 @en Half the length of the OBB.
  18712. * @param ox_1 @zh 方向矩阵参数,第 1 条轴的 x 分量。 @en The x component of the first axis of the OBB.
  18713. * @param ox_2 @zh 方向矩阵参数,第 2 条轴的 x 分量。 @en The x component of the second axis of the OBB.
  18714. * @param ox_3 @zh 方向矩阵参数,第 3 条轴的 x 分量。 @en The x component of the third axis of the OBB.
  18715. * @param oy_1 @zh 方向矩阵参数,第 1 条轴的 y 分量。 @en The y component of the first axis of the OBB.
  18716. * @param oy_2 @zh 方向矩阵参数,第 2 条轴的 y 分量。 @en The y component of the second axis of the OBB.
  18717. * @param oy_3 @zh 方向矩阵参数,第 3 条轴的 y 分量。 @en The y component of the third axis of the OBB.
  18718. * @param oz_1 @zh 方向矩阵参数,第 1 条轴的 z 分量。 @en The z component of the first axis of the OBB.
  18719. * @param oz_2 @zh 方向矩阵参数,第 2 条轴的 z 分量。 @en The z component of the second axis of the OBB.
  18720. * @param oz_3 @zh 方向矩阵参数,第 3 条轴的 z 分量。 @en The z component of the third axis of the OBB.
  18721. */
  18722. constructor(cx?: number, cy?: number, cz?: number, hw?: number, hh?: number, hl?: number, ox_1?: number, ox_2?: number, ox_3?: number, oy_1?: number, oy_2?: number, oy_3?: number, oz_1?: number, oz_2?: number, oz_3?: number);
  18723. /**
  18724. * @en
  18725. * Gets the bounding points of this OBB instance.
  18726. * @zh
  18727. * 获取此 OBB 的最小点和最大点。
  18728. * @param minPos @zh 此 OBB 的最小点。 @en The out minimum position of the OBB.
  18729. * @param maxPos @zh 此 OBB 的最大点。 @en The out maximum position of the OBB.
  18730. */
  18731. getBoundary(minPos: math.Vec3, maxPos: math.Vec3): void;
  18732. /**
  18733. * @en
  18734. * Transforms this OBB and store the result to the `out` parameter.
  18735. * @zh
  18736. * 对当前 OBB 的数据进行变换,并存储结果到 `out` 参数中。
  18737. * @param m @zh 变换的矩阵。 @en The transform matrix
  18738. * @param pos @zh 变换的位置部分。 @en 3d-vector translation.
  18739. * @param rot @zh 变换的旋转部分。 @en Quaternion rotation.
  18740. * @param scale @zh 变换的缩放部分。 @en 3d-vector scale.
  18741. * @param out @zh 变换结果的目标 OBB。 @en The output OBB.
  18742. * @note @zh 此方法不会修改当前 OBB 的数据。 @en This method will not modify the data of current OBB.
  18743. */
  18744. transform(m: math.Mat4, pos: math.Vec3, rot: math.Quat, scale: math.Vec3, out: OBB): void;
  18745. /**
  18746. * @en
  18747. * Transforms this OBB by a 4x4 matrix and a quaternion.
  18748. * @zh
  18749. * 根据一个 4x4 矩阵和一个四元数变换此 OBB。
  18750. * @param m @zh 变换的矩阵。 @en The transform matrix.
  18751. * @param rot @zh 变换的旋转部分。 @en The quaternion for rotation.
  18752. * @param out @zh 变换的目标。 @en The output OBB.
  18753. * @note @zh 此方法不会修改当前 OBB 的数据。 @en This method will not modify the data of current OBB.
  18754. */
  18755. translateAndRotate(m: math.Mat4, rot: math.Quat, out: OBB): void;
  18756. /**
  18757. * @en
  18758. * Scales this OBB by a 3d-vector and store the result to the `out` parameter.
  18759. * @zh
  18760. * 根据 3D 向量对此 OBB 的数据进行缩放并将结果存储在 out 参数中。
  18761. * @param scale @zh 缩放值。 @en 3d-vector scale.
  18762. * @param out @zh 缩放的目标。 @en The output OBB.
  18763. * @note @zh 此方法不会修改当前 OBB 的数据。 @en This method will not modify the data of current OBB.
  18764. */
  18765. setScale(scale: math.Vec3, out: OBB): void;
  18766. }
  18767. /**
  18768. * @en
  18769. * Basic Geometry: capsule.
  18770. * @zh
  18771. * 基础几何,胶囊体。
  18772. */
  18773. export class Capsule {
  18774. /**
  18775. * @en
  18776. * Gets the type of this Capsule, always returns `enums.SHAPE_CAPSULE`.
  18777. * @zh
  18778. * 获取此形状的类型,值固定为 `enums.SHAPE_CAPSULE`。
  18779. */
  18780. get type(): number;
  18781. protected readonly _type: number;
  18782. /**
  18783. * @en
  18784. * The radius of the sphere in this capsule.
  18785. * @zh
  18786. * 胶囊体球部的半径。
  18787. */
  18788. radius: number;
  18789. /**
  18790. * @en
  18791. * The distance between the center point of the capsule and the center of the sphere.
  18792. * @zh
  18793. * 胶囊体中心点和球部圆心的距离。
  18794. */
  18795. halfHeight: number;
  18796. /**
  18797. * @en
  18798. * The local orientation of this capsule [0,1,2] => [x,y,z].
  18799. * @zh
  18800. * 胶囊体的本地朝向,映射关系 [0,1,2] => [x,y,z]。
  18801. */
  18802. axis: number;
  18803. /**
  18804. * @en
  18805. * The origin of the capsule.
  18806. * @zh
  18807. * 胶囊体的原点。
  18808. */
  18809. readonly center: math.Vec3;
  18810. /**
  18811. * @en
  18812. * The rotation of the capsule.
  18813. * @zh
  18814. * 胶囊体的旋转。
  18815. */
  18816. readonly rotation: math.Quat;
  18817. /**
  18818. * @internal
  18819. * cache, local center of ellipse
  18820. **/
  18821. readonly ellipseCenter0: math.Vec3;
  18822. /**
  18823. * @internal
  18824. */
  18825. readonly ellipseCenter1: math.Vec3;
  18826. /**
  18827. * @en
  18828. * Constructs a Capsule instance.
  18829. * @zh
  18830. * 构造一个胶囊体实例。
  18831. * @param radius @en The radius of the sphere in this capsule. @zh 胶囊体球部的半径。
  18832. * @param halfHeight @en The distance between the center point of the capsule and the center of the sphere. @zh 胶囊体中心点和球部圆心的距离。
  18833. * @param axis @en The local orientation of this capsule [0,1,2] => [x,y,z]. @zh 胶囊体的本地朝向,映射关系 [0,1,2] => [x,y,z]。
  18834. */
  18835. constructor(radius?: number, halfHeight?: number, axis?: number);
  18836. /**
  18837. * @en
  18838. * Transforms this capsule by a 4x4 matrix and RTS.
  18839. * @zh
  18840. * 使用 4x4 矩阵和 RTS 变换此胶囊体。
  18841. */
  18842. transform(m: math.Mat4, pos: math.IVec3Like, rot: math.IQuatLike, scale: math.IVec3Like, out: Capsule): void;
  18843. /**
  18844. * @en
  18845. * Updates the cache.
  18846. * @zh
  18847. * 更新缓存。
  18848. */
  18849. updateCache(): void;
  18850. /**
  18851. * @en
  18852. * Updates the center points.
  18853. * @zh
  18854. * 更新中心点信息。
  18855. */
  18856. updateLocalCenter(): void;
  18857. }
  18858. /**
  18859. * @en
  18860. * Basic Geometry: frustum.
  18861. * @zh
  18862. * 基础几何:视锥体。
  18863. */
  18864. export class Frustum {
  18865. /**
  18866. * @en Creates an orthographic frustum.
  18867. * @zh 创建一个正交视锥体。
  18868. * @param out @en The result orthographic frustum. @zh 输出的正交视锥体。
  18869. * @param width @en The width of the frustum. @zh 正交视锥体的宽度。
  18870. * @param height @en The height of the frustum. @zh 正交视锥体的高度。
  18871. * @param near @en The near plane of the frustum. @zh 正交视锥体的近平面值。
  18872. * @param far @en The far plane of the frustum. @zh 正交视锥体的远平面值。
  18873. * @param transform @en The transform matrix of the frustum. @zh 正交视锥体的变换矩阵。
  18874. * @returns @en The result frustum, same as the `out` parameter. @zh 存储结果的视锥体,与 `out` 参数为同一个对象。
  18875. */
  18876. static createOrthographic(out: Frustum, width: number, height: number, near: number, far: number, transform: math.Mat4): void;
  18877. /**
  18878. * @en Creates an orthographic frustum.
  18879. * @zh 创建一个正交视锥体。
  18880. * @param out @en The result orthographic frustum. @zh 输出的正交视锥体。
  18881. * @param width @en The width of the frustum. @zh 正交视锥体的宽度。
  18882. * @param height @en The height of the frustum. @zh 正交视锥体的高度。
  18883. * @param near @en The near plane of the frustum. @zh 正交视锥体的近平面值。
  18884. * @param far @en The far plane of the frustum. @zh 正交视锥体的远平面值。
  18885. * @param transform @en The transform matrix of the frustum. @zh 正交视锥体的变换矩阵。
  18886. * @returns @en The result frustum, same as the `out` parameter. @zh 存储结果的视锥体,与 `out` 参数为同一个对象。
  18887. *
  18888. * @deprecated since v3.8.0, please use [[createOrthographic]] instead.
  18889. */
  18890. static createOrtho(out: Frustum, width: number, height: number, near: number, far: number, transform: math.Mat4): void;
  18891. /**
  18892. * @en Creates a perspective frustum.
  18893. * @zh 创建一个透视视锥体。
  18894. * @param aspect @en The aspect ratio of the camera. @zh 相机视图的长宽比。
  18895. * @param fov @en The field of view of the camera. @zh 相机的视角大小。
  18896. * @param near @en The near plane of the frustum. @zh 视锥体的近平面值。
  18897. * @param far @en The far plane of the frustum. @zh 视锥体的远平面值。
  18898. * @param transform @en The transform matrix. @zh 变换矩阵。
  18899. * @returns @en The result frustum, same as the `out` parameter. @zh 存储结果的视锥体,与 `out` 参数为同一个对象。
  18900. */
  18901. static createPerspective(out: Frustum, aspect: number, fov: number, near: number, far: number, transform: math.Mat4): void;
  18902. /**
  18903. * @en Creates a frustum from an AABB instance.
  18904. * @zh 根据一个 AABB 实例创建一个视锥体。
  18905. * @param out @en The result frustum. @zh 输出的视锥体对象。
  18906. * @param aabb @en The AABB to create the result frustum. @zh 用于创建视锥体 AABB。
  18907. * @returns @en The result frustum, same as the `out` parameter. @zh 存储结果的视锥体,与 `out` 参数为同一个对象。
  18908. *
  18909. * @deprecated since v3.8.0, please use [[createOrthographic]] instead.
  18910. */
  18911. static createFromAABB(out: Frustum, aabb: AABB | Readonly<AABB>): Frustum;
  18912. /**
  18913. * @en Calculates a split frustum.
  18914. * @zh 计算出一个分割的视锥体。
  18915. * @param start @en The split start position. @zh 分割开始位置。
  18916. * @param end @en The split end position. @zh 分割末尾位置。
  18917. * @param aspect @en The aspect ratio of the camera. @zh 相机视图的长宽比。
  18918. * @param fov @en The field of view of the camera. @zh 相机的视角大小。
  18919. * @param m @en The transform matrix. @zh 变换矩阵。
  18920. *
  18921. * @deprecated since v3.8.0, please use [[createPerspective]] instead.
  18922. */
  18923. split(start: number, end: number, aspect: number, fov: number, m: math.Mat4): void;
  18924. /**
  18925. * @en
  18926. * Creates a new frustum.
  18927. * @zh
  18928. * 创建一个新的视椎体。
  18929. * @returns @en An empty frustum. @zh 一个空视椎体。
  18930. */
  18931. static create(): Frustum;
  18932. /**
  18933. * @en
  18934. * Clones a frustum.
  18935. * @zh
  18936. * 克隆一个视椎体。
  18937. * @param f @en The frustum to clone from. @zh 用于克隆的视椎体。
  18938. * @return @en The cloned frustum. @zh 克隆出的新视椎体。
  18939. */
  18940. static clone(f: Frustum): Frustum;
  18941. /**
  18942. * @en
  18943. * Copies the values from one frustum to another.
  18944. * @zh
  18945. * 从一个视锥体拷贝到另一个视锥体。
  18946. * @param out @en The result frustum @zh 用于存储拷贝数据的截锥体
  18947. * @param f @en The frustum to copy from @zh 用于克隆的截锥体
  18948. * @returns @en The result frustum, same as the `out` parameter. @zh 存储结果的视锥体,与 `out` 参数为同一个对象。
  18949. */
  18950. static copy(out: Frustum, f: Readonly<Frustum>): Frustum;
  18951. /**
  18952. * @en
  18953. * Sets whether to use accurate intersection testing function on this frustum.
  18954. * @zh
  18955. * 设置是否在此截锥体上使用精确的相交测试函数。
  18956. *
  18957. * @deprecated since v3.8.0 no need to set accurate flag since it doesn't affect the calculation at all.
  18958. */
  18959. set accurate(b: boolean);
  18960. /**
  18961. * @en
  18962. * Gets the type of the shape. The value may be `enums.SHAPE_FRUSTUM_ACCURATE` or `enums.SHAPE_FRUSTUM`.
  18963. * @zh
  18964. * 获取形状的类型。值可能为 `enums.SHAPE_FRUSTUM_ACCURATE` 或 `enums.SHAPE_FRUSTUM`。
  18965. * @readonly
  18966. */
  18967. get type(): number;
  18968. /**
  18969. * @en
  18970. * The 6 planes of the frustum.
  18971. * @zh
  18972. * 视椎体的 6 个面。
  18973. */
  18974. planes: Plane[];
  18975. /**
  18976. * @en
  18977. * The 8 vertices of the frustum.
  18978. * @zh
  18979. * 视椎体的 8 个顶点。
  18980. */
  18981. vertices: math.Vec3[];
  18982. protected _type: number;
  18983. constructor();
  18984. /**
  18985. * @en
  18986. * Updates the frustum information according to the given transform matrix.
  18987. * Note that the resulting planes are not normalized under normal mode.
  18988. * @zh
  18989. * 根据给定的变换矩阵更新截锥体信息,注意得到的平面不是在标准模式下归一化的。
  18990. * @param m @en The view-projection matrix. @zh 视图投影矩阵。
  18991. * @param inv @en The inverse view-projection matrix. @zh 视图投影逆矩阵。
  18992. */
  18993. update(m: math.Mat4, inv: math.Mat4): void;
  18994. /**
  18995. * @en
  18996. * Transforms this frustum.
  18997. * @zh
  18998. * 变换此视锥体。
  18999. * @param mat @en The transform matrix. @zh 变换矩阵。
  19000. */
  19001. transform(mat: math.Mat4): void;
  19002. /**
  19003. * @en Makes the frustum empty, all vertices will be zero values.
  19004. * @zh 置空此视锥体,所有顶点将被赋值为 0。
  19005. */
  19006. zero(): void;
  19007. /**
  19008. * @en Updates all six planes of the frustum.
  19009. * @zh 更新视锥体的所有面数据。
  19010. */
  19011. updatePlanes(): void;
  19012. }
  19013. /**
  19014. * @en
  19015. * A key frame in the curve.
  19016. * @zh
  19017. * 曲线中的一个关键帧。
  19018. */
  19019. export class Keyframe {
  19020. /**
  19021. * @en Current frame time.
  19022. * @zh 当前帧时间。
  19023. */
  19024. time: number;
  19025. /**
  19026. * @en Current frame value.
  19027. * @zh 当前帧的值。
  19028. */
  19029. value: number;
  19030. /**
  19031. * @en In tangent value.
  19032. * @zh 左切线。
  19033. */
  19034. inTangent: number;
  19035. /**
  19036. * @en Out tangent value.
  19037. * @zh 右切线。
  19038. */
  19039. outTangent: number;
  19040. }
  19041. /**
  19042. * @en
  19043. * Describe a curve in which three times Hermite interpolation is used for each adjacent key frame.
  19044. * @zh
  19045. * 描述一条曲线,其中每个相邻关键帧采用三次hermite插值计算。
  19046. */
  19047. export class AnimationCurve {
  19048. /**
  19049. * For internal usage only.
  19050. * @internal
  19051. */
  19052. get _internalCurve(): RealCurve;
  19053. /**
  19054. * @en
  19055. * The key frame of the curve.
  19056. * @zh
  19057. * 曲线的关键帧。
  19058. */
  19059. get keyFrames(): Keyframe[];
  19060. set keyFrames(value: Keyframe[]);
  19061. /**
  19062. * @en
  19063. * Loop mode [[AnimationClip.WrapMode]] when the sampling time exceeds the left end.
  19064. * @zh
  19065. * 当采样时间超出左端时采用的循环模式[[AnimationClip.WrapMode]]。
  19066. */
  19067. get preWrapMode(): __private._cocos_core_geometry_curve__WrapModeMask;
  19068. set preWrapMode(value: __private._cocos_core_geometry_curve__WrapModeMask);
  19069. /**
  19070. * @en
  19071. * Cycle mode [[AnimationClip.WrapMode]] when the sampling time exceeds the right end.
  19072. * @zh
  19073. * 当采样时间超出右端时采用的循环模式[[AnimationClip.WrapMode]]。
  19074. */
  19075. get postWrapMode(): __private._cocos_core_geometry_curve__WrapModeMask;
  19076. set postWrapMode(value: __private._cocos_core_geometry_curve__WrapModeMask);
  19077. /**
  19078. * @en Construct a curve with key frames
  19079. * @zh 通过关键帧构造一条曲线。
  19080. * @param keyFrames @zh 关键帧 @en Key frames
  19081. */
  19082. constructor(keyFrames?: Keyframe[] | null | RealCurve);
  19083. /**
  19084. * @en
  19085. * Add a keyframe.
  19086. * @zh
  19087. * 添加一个关键帧。
  19088. * @param keyFrame @en A keyframe. @zh 关键帧。
  19089. */
  19090. addKey(keyFrame: Keyframe | null): void;
  19091. /**
  19092. * @ignore
  19093. * @param time
  19094. */
  19095. evaluate_slow(time: number): number;
  19096. /**
  19097. * @en
  19098. * Calculate the curve interpolation at a given point in time.
  19099. * @zh
  19100. * 计算给定时间点的曲线插值。
  19101. * @param time @en The time. @zh 时间。
  19102. */
  19103. evaluate(time: number): number;
  19104. /**
  19105. * @ignore
  19106. * @param optKey
  19107. * @param leftIndex
  19108. * @param rightIndex
  19109. */
  19110. calcOptimizedKey(optKey: __private._cocos_core_geometry_curve__OptimizedKey, leftIndex: number, rightIndex: number): void;
  19111. }
  19112. export enum SplineMode {
  19113. /**
  19114. * @en
  19115. * Broken line:
  19116. * Each knot is connected with a straight line from the beginning to the end to form a curve. At least two knots.
  19117. * @zh
  19118. * 每个结从头到尾用一条直线相连,形成一条曲线。 至少存在两个结点。
  19119. */
  19120. LINEAR = 0,
  19121. /**
  19122. * @en
  19123. * Piecewise Bezier curve:
  19124. * Every four knots form a curve. Total knots number must be a multiple of 4.
  19125. * Each curve passes only the first and fourth knots, and does not pass through the middle two control knots.
  19126. *
  19127. * If you need a whole continuous curve:
  19128. * (1) Suppose the four knots of the previous curve are A, B, C, D
  19129. * (2) The four knots of the next curve must be D, E, F, G
  19130. * (3) C and E need to be symmetrical about D
  19131. *
  19132. * @zh
  19133. * 分段贝塞尔曲线:
  19134. * 每四个结形成一条曲线。 总节数必须是 4 的倍数。
  19135. * 每条曲线只通过第一个和第四个结点,不通过中间两个控制结点。
  19136. *
  19137. * 如果你需要一条完整的连续曲线:
  19138. * (1) 假设前面曲线的四个结点分别是 A, B, C, D
  19139. * (2) 下一条曲线的四个结点必须是 D, E, F, G
  19140. * (3) C 和 E 需要关于 D 对称
  19141. */
  19142. BEZIER = 1,
  19143. /**
  19144. * @en
  19145. * Catmull Rom curve:
  19146. * All knots(including start & end knots) form a whole continuous curve. At least two knots.
  19147. * The whole curve passes through all knots.
  19148. *
  19149. * @zh
  19150. * Catmull Rom 曲线:
  19151. * 所有结点(包括起始结点和结束结点)形成一条完整的连续曲线。 至少存在两个结点。
  19152. * 整条曲线穿过所有结点。
  19153. */
  19154. CATMULL_ROM = 2
  19155. }
  19156. /**
  19157. * @en
  19158. * Basic Geometry: Spline.
  19159. * @zh
  19160. * 基础几何:Spline。
  19161. */
  19162. export class Spline {
  19163. /**
  19164. * @en
  19165. * Creates a spline instance.
  19166. * @zh
  19167. * 创建一个 Spline 实例。
  19168. * @param mode @en The mode to create the Spline instance. @zh 用于创建 Spline 实例的模式。
  19169. * @param knots @en The knots to create the Spline instance. @zh 用于创建 Spline 实例的结点列表。
  19170. * @returns @en The created Spline instance. @zh 创建出的 Spline 实例。
  19171. */
  19172. static create(mode: SplineMode, knots?: math.Vec3[]): Spline;
  19173. /**
  19174. * @en
  19175. * Clones a Spline instance.
  19176. * @zh
  19177. * 克隆一个 Spline 实例。
  19178. * @param s @en The Spline instance to be cloned. @zh 用于克隆的 Spline 实例。
  19179. * @returns @en The cloned Spline instance. @zh 克隆出的 Spline 实例。
  19180. */
  19181. static clone(s: Spline): Spline;
  19182. /**
  19183. * @en
  19184. * Copies the values of a Spline instance to another.
  19185. * @zh
  19186. * 拷贝一个 Spline 实例的值到另一个中。
  19187. * @param out @en The target Spline instance to copy to. @zh 拷贝目标 Spline 实例。
  19188. * @param s @en The source Spline instance to copy from. @zh 拷贝源 Spline 实例。
  19189. * @returns @en The target Spline instance to copy to, same as the `out` parameter. @zh 拷贝目标 Spline 实例,值与 `out` 参数相同。
  19190. */
  19191. static copy(out: Spline, s: Spline): Spline;
  19192. /**
  19193. * @en
  19194. * Gets the type of this Spline instance, always returns `enums.SHAPE_SPLINE`.
  19195. * @zh
  19196. * 获取此 Spline 的类型,固定返回 `enums.SHAPE_SPLINE`
  19197. */
  19198. get type(): number;
  19199. /**
  19200. * @en
  19201. * Gets the mode of this Spline instance.
  19202. * @zh
  19203. * 获取当前 Spline 实例的模式。
  19204. */
  19205. get mode(): SplineMode;
  19206. /**
  19207. * @en
  19208. * Gets all knots of this Spline instance.
  19209. * @zh
  19210. * 获取当前 Spline 实例的所有结点。
  19211. */
  19212. get knots(): Readonly<math.Vec3[]>;
  19213. /**
  19214. * @en
  19215. * Sets the mode and knots to this Spline instance.
  19216. * @zh
  19217. * 给当前 Spline 实例设置模式和结点。
  19218. * @param mode @en The mode to be set to this Spline instance. @zh 要设置到当前 Spline 实例的模式。
  19219. * @param knots @en The knots to be set to this spline instance. @zh 要设置到当前 Spline 实例的结点列表。
  19220. */
  19221. setModeAndKnots(mode: SplineMode, knots: math.Vec3[]): void;
  19222. /**
  19223. * @en
  19224. * Clears all knots of this Spline instance.
  19225. * @zh
  19226. * 清空当前 Spline 实例的所有结点。
  19227. */
  19228. clearKnots(): void;
  19229. /**
  19230. * @en
  19231. * Gets the knot count of this Spline instance.
  19232. * @zh
  19233. * 获取当前 Spline 实例的结点数量。
  19234. * @returns @en The knot count of this Spline instance. @zh 当前 Spline 实例的结点数量。
  19235. */
  19236. getKnotCount(): number;
  19237. /**
  19238. * @en
  19239. * Adds a knot to this Spline instance.
  19240. * @zh
  19241. * 给当前 Spline 实例添加一个结点。
  19242. * @param knot @en The knot to add to this Spline instance. @zh 要添加到当前 Spline 实例的结点。
  19243. */
  19244. addKnot(knot: math.Vec3): void;
  19245. /**
  19246. * @en
  19247. * Inserts a knot to the specified position of this Spline instance.
  19248. * @zh
  19249. * 插入一个结点到当前 Spline 实例的指定位置。
  19250. * @param index @en The position of this Spline instance to be inserted. @zh 要插入到此 Spline 实例的位置。
  19251. * @param knot @en The knot to be inserted. @zh 要插入的结点。
  19252. */
  19253. insertKnot(index: number, knot: math.Vec3): void;
  19254. /**
  19255. * @en
  19256. * Removes a knot at the specified position of this Spline instance.
  19257. * @zh
  19258. * 移除当前 Spline 实例的指定位置的一个结点。
  19259. * @param index
  19260. */
  19261. removeKnot(index: number): void;
  19262. /**
  19263. * @en
  19264. * Sets a knot to the specified position of this Spline instance.
  19265. * @zh
  19266. * 为当前 Spline 实例的指定位置设置结点信息。
  19267. * @param index @en The specified position of this Spline instance. @zh 要设置结点的指定位置。
  19268. * @param knot @en The knot to be set to the specified position. @zh 要设置的结点。
  19269. */
  19270. setKnot(index: number, knot: math.Vec3): void;
  19271. /**
  19272. * @en
  19273. * Gets the knot of the specified position of this Spline instance.
  19274. * @zh
  19275. * 获取当前 Spline 实例指定位置的结点。
  19276. * @param index @en The specified position of this Spline instance. @zh 要设置结点的指定位置。
  19277. * @returns @en The knot of the specified position of this Spline instance. @zh 当前 Spline 实例指定位置的结点。
  19278. */
  19279. getKnot(index: number): Readonly<math.Vec3>;
  19280. /**
  19281. * @en
  19282. * Gets a point at t with repect to the `index` segment of curve or the whole curve.
  19283. * @zh
  19284. * 获取 t 处相对于某段或整条曲线的点。
  19285. * @param t @en The factor with a range of [0.0, 1.0]. @zh 0.0 到 1.0 的因子。
  19286. * @param index @en The knot index of this Spline instance, default value is the whole curve. @zh 当前 Spline 实例的某个结点索引,默认值为整条曲线。
  19287. * @returns @en The point matches the input `t` factor and `index`. @zh 满足输入 `t` 参数和 `index` 参数的点。
  19288. */
  19289. getPoint(t: number, index?: number): math.Vec3;
  19290. /**
  19291. * @en
  19292. * Gets points from 0 to 1 uniformly with repect to the `index` segment of curve or the whole curve.
  19293. * @zh
  19294. * 获取相对与某段或整条曲线上的 n 个数量的点信息。
  19295. * @param num @en The count of points needed. @zh 需要的点的数量。
  19296. * @param index @en The knot index of this Spline instance, default value is the whole curve. @zh 当前 Spline 实例的某个结点索引,默认值为整条曲线。
  19297. * @returns @en The points with `num` size at the `index` segment or the whole curve. @zh 曲线某段或者整条曲线上的 `num` 个点。
  19298. */
  19299. getPoints(num: number, index?: number): math.Vec3[];
  19300. }
  19301. /**
  19302. * @en
  19303. * The raycast mode.
  19304. * @zh
  19305. * 射线检测模式。
  19306. */
  19307. export enum ERaycastMode {
  19308. /**
  19309. * @en
  19310. * Detects and records all data.
  19311. * @zh
  19312. * 检测并记录所有的数据。
  19313. */
  19314. ALL = 0,
  19315. /**
  19316. * @en
  19317. * Detects all data, but records only the most recent data.
  19318. * @zh
  19319. * 检测所有,但只记录最近的数据。
  19320. */
  19321. CLOSEST = 1,
  19322. /**
  19323. * @en
  19324. * Once the test is successful, the test is stopped and the data is recorded only once.
  19325. * @zh
  19326. * 一旦检测成功就停止检测,只会记录一次数据。
  19327. */
  19328. ANY = 2
  19329. }
  19330. /**
  19331. * @en
  19332. * The storage structure of the raycast results.
  19333. * @zh
  19334. * 射线检测结果的存储结构。
  19335. */
  19336. export interface IRaySubMeshResult {
  19337. /**
  19338. * @en
  19339. * The distance between the hit point and the ray.
  19340. * @zh
  19341. * 击中点和射线的距离。
  19342. */
  19343. distance: number;
  19344. /**
  19345. * @en
  19346. * The index of the triangle vertex 0。
  19347. * @zh
  19348. * 三角形顶点0的索引。
  19349. */
  19350. vertexIndex0: number;
  19351. /**
  19352. * @en
  19353. * The index of the triangle vertex 1。
  19354. * @zh
  19355. * 三角形顶点1的索引
  19356. */
  19357. vertexIndex1: number;
  19358. /**
  19359. * @en
  19360. * The index of the triangle vertex 2。
  19361. * @zh
  19362. * 三角形顶点2的索引
  19363. */
  19364. vertexIndex2: number;
  19365. }
  19366. /**
  19367. * @en
  19368. * The optional param structure of the `raySubMesh`.
  19369. * @zh
  19370. * `raySubMesh`的可选参数结构。
  19371. */
  19372. export interface IRaySubMeshOptions {
  19373. /**
  19374. * @en
  19375. * The raycast mode,`ANY` by default.
  19376. * @zh
  19377. * 射线检测模式:[0, 1, 2]=>[`ALL`, `CLOSEST`, `ANY`]
  19378. */
  19379. mode: ERaycastMode;
  19380. /**
  19381. * @en
  19382. * The maximum distance of the raycast, `Infinity` by default.
  19383. * @zh
  19384. * 射线检测的最大距离,默认为`Infinity`。
  19385. */
  19386. distance: number;
  19387. /**
  19388. * @en
  19389. * An array used to store the results of a ray detection.
  19390. * @zh
  19391. * 用于存储射线检测结果的数组。
  19392. */
  19393. result?: IRaySubMeshResult[];
  19394. /**
  19395. * @en
  19396. * Whether to detect the double-sided or not,`false` by default.
  19397. * @zh
  19398. * 是否检测双面,默认为`false`。
  19399. */
  19400. doubleSided?: boolean;
  19401. }
  19402. /**
  19403. * @en
  19404. * The optional param structure of the `rayMesh`.
  19405. * @zh
  19406. * `rayMesh`的可选参数结构。
  19407. */
  19408. export interface IRayMeshOptions extends IRaySubMeshOptions {
  19409. /**
  19410. * @en
  19411. * The index of the sub mesh.
  19412. * @zh
  19413. * 子网格的索引。
  19414. */
  19415. subIndices?: number[];
  19416. }
  19417. /**
  19418. * @en
  19419. * The optional parameter structure of the `rayModel`.
  19420. * @zh
  19421. * `rayModel`的可选参数结构。
  19422. */
  19423. export type IRayModelOptions = IRayMeshOptions;
  19424. /**
  19425. * @en
  19426. * Alias of [[geometry.Line]]
  19427. * @zh
  19428. * [[geometry.Line]] 别名类
  19429. *
  19430. * @deprecated Since v3.0, please use Line instead
  19431. */
  19432. export class line extends Line {
  19433. constructor();
  19434. }
  19435. /**
  19436. * @en
  19437. * Alias of [[geometry.Plane]]
  19438. *
  19439. * @zh
  19440. * [[geometry.Plane]] 别名类
  19441. *
  19442. * @deprecated Since v3.0, please use Plane instead
  19443. */
  19444. export class plane extends Plane {
  19445. constructor();
  19446. }
  19447. /**
  19448. * @en
  19449. * Alias of [[geometry.Ray]]
  19450. * @zh
  19451. * [[geometry.Ray]] 别名类
  19452. * @deprecated Since v3.0, please use Ray instead
  19453. */
  19454. export class ray extends Ray {
  19455. constructor();
  19456. }
  19457. /**
  19458. * @en
  19459. * Alias of [[geometry.Triangle]]
  19460. *
  19461. * @zh
  19462. * [[geometry.Triangle]] 别名类
  19463. * @deprecated Since v3.0, please use Triangle instead
  19464. */
  19465. export class triangle extends Triangle {
  19466. constructor();
  19467. }
  19468. /**
  19469. * @en
  19470. * Alias of [[geometry.Sphere]]
  19471. *
  19472. * @zh
  19473. * [[geometry.Sphere]] 别名类
  19474. * @deprecated Since v3.0, please use Sphere instead
  19475. */
  19476. export class sphere extends Sphere {
  19477. constructor();
  19478. }
  19479. /**
  19480. * @en
  19481. * Alias of [[geometry.AABB]]
  19482. *
  19483. * @zh
  19484. * [[geometry.AABB]] 别名类
  19485. * @deprecated Since v3.0, please use AABB instead
  19486. */
  19487. export class aabb extends AABB {
  19488. constructor();
  19489. }
  19490. /**
  19491. * @en
  19492. * Alias of [[geometry.OBB]]
  19493. *
  19494. * @zh
  19495. * [[geometry.OBB]] 别名类
  19496. * @deprecated Since v3.0, please use OBB instead
  19497. */
  19498. export class obb extends OBB {
  19499. constructor();
  19500. }
  19501. /**
  19502. * @en
  19503. * Alias of [[geometry.Capsule]]
  19504. *
  19505. * @zh
  19506. * [[geometry.Capsule]] 别名类
  19507. * @deprecated Since v3.0, please use Capsule instead
  19508. */
  19509. export class capsule extends Capsule {
  19510. constructor();
  19511. }
  19512. /**
  19513. * @en
  19514. * Alias of [[geometry.Frustum]]
  19515. *
  19516. * @zh
  19517. * [[geometry.Frustum]] 别名类
  19518. * @deprecated Since v3.0, please use Frustum instead
  19519. */
  19520. export class frustum extends Frustum {
  19521. constructor();
  19522. }
  19523. }
  19524. export const VERSION = "3.8.3";
  19525. /**
  19526. * @en
  19527. * The main namespace of Cocos engine, all engine core classes, functions, properties and constants are defined in this namespace.
  19528. * @zh
  19529. * Cocos引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。
  19530. * @deprecated
  19531. */
  19532. export const cclegacy: Record<string, any> & {
  19533. _global: typeof globalThis;
  19534. };
  19535. /**
  19536. * @en
  19537. * Defines a BitMask type. The editor will display different inspector depending on this data type. It may define some properties to the object.
  19538. * The keys of new properties are the integer type values, and the values are corresponding keys. See the example below.
  19539. * keys.
  19540. * @zh
  19541. * 定义一个位掩码类型。编辑器会根据这个数据类型显示不同的显示界面。它可能会在对象添加新属性。新属性的 key 是原来的整型 value,value 是对应的 key。参考下面的例子。
  19542. * @param obj
  19543. * @en A JavaScript literal object containing BitMask names and values.
  19544. * @zh 包含 BitMask 名称和值的 JavaScript 文字对象。
  19545. * @returns @en The defined BitMask type @zh 定义的位掩码类型。
  19546. * @example
  19547. * ```ts
  19548. * // `type1` and `type2` are single-selected.
  19549. * let obj = {
  19550. * type1: 0,
  19551. * type2: 1 << 2,
  19552. * }
  19553. *
  19554. * // `type1` and `type2` are multiple-selected.
  19555. * // New properties are added to obj, obj now is
  19556. * // {
  19557. * // type1: 0,
  19558. * // type2: 1<< 2,
  19559. * // 0: type1,
  19560. * // 4: type2
  19561. * // }
  19562. * BitMask(obj);
  19563. * ```
  19564. */
  19565. export function BitMask<T>(obj: T): T;
  19566. export namespace BitMask {
  19567. export var isBitMask: (BitMaskType: any) => any;
  19568. export var getList: (BitMaskDef: any) => any;
  19569. export var update: (BitMaskDef: any) => any;
  19570. }
  19571. /**
  19572. * @en
  19573. * Define an enum type. <br/>
  19574. * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
  19575. * Otherwise it will use the value specified by user who writes the enum definition.
  19576. *
  19577. * @zh
  19578. * 定义一个枚举类型。<br/>
  19579. * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  19580. *
  19581. * @param obj
  19582. * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
  19583. * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
  19584. * @return @en The defined enum type. @zh 定义的枚举类型。
  19585. */
  19586. export function Enum<T>(obj: T): T;
  19587. export namespace Enum {
  19588. export var update: <T>(obj: T) => T;
  19589. export var isEnum: <EnumT extends {}>(enumType: EnumT) => boolean;
  19590. export var getList: <EnumT extends {}>(enumType: EnumT) => readonly __private._cocos_core_value_types_enum__Enum.Enumerator<EnumT>[];
  19591. export var sortList: <EnumT extends {}>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
  19592. }
  19593. /**
  19594. * Make the enum type `enumType` as enumeration so that Creator may identify, operate on it.
  19595. * Formally, as a result of invocation on this function with enum type `enumType`:
  19596. * - `Enum.isEnum(enumType)` returns `true`;
  19597. * - `Enum.getList(enumType)` returns the enumerators of `enumType`.
  19598. * @param
  19599. * @en enumType An enum type, eg, a kind of type with similar semantic defined by TypeScript.
  19600. * @zh 枚举类型,例如 TypeScript 中定义的类型。
  19601. */
  19602. export function ccenum<EnumT extends {}>(enumType: EnumT): void;
  19603. /**
  19604. * @en The base class of all value types.
  19605. * @zh 所有值类型的基类。
  19606. */
  19607. export class ValueType {
  19608. /**
  19609. * @en
  19610. * Clone the current object. The clone result of the object should be equal to the current object,
  19611. * i.e. satisfy `this.equals(this, value.clone())`.
  19612. * The base version of this method do nothing and returns `this'.
  19613. * The derived class **must** rewrite this method and the returned object should not be `this`, i.e. satisfy `this !== this.clone()`.
  19614. * @zh
  19615. * 克隆当前值。克隆的结果值应与当前值相等,即满足 `this.equals(this, value.clone())`。
  19616. * 本方法的基类版本简单地返回 `this`;
  19617. * 派生类**必须**重写本方法,并且返回的对象不应当为 `this`,即满足 `this !== this.clone()`。
  19618. * @returns @en The cloned object. @zh 克隆的对象。
  19619. */
  19620. clone(): ValueType;
  19621. /**
  19622. * @en
  19623. * Check whether the current object is equal to the specified object.
  19624. * This check should be interchangeable, i.e. satisfy `this.equals(other) === other.equals(this)`.
  19625. * The base version of this method will returns `false'.
  19626. * @zh
  19627. * 判断当前值是否与指定值相等。此判断应当具有交换性,即满足 `this.equals(other) === other.equals(this)`。
  19628. * 本方法的基类版本简单地返回 `false`。
  19629. * @param other @en The other object @zh 指定值。
  19630. * @returns @en `true` if equal, otherwise returns `false` @zh 如果相等,则返回 `true`,否则返回 `false`。
  19631. */
  19632. equals(other: this): boolean;
  19633. /**
  19634. * @en
  19635. * Set the property values of the current object with the given object.
  19636. * The base version of this method will returns `this' and the derived class **must** rewrite this method.
  19637. * @zh
  19638. * 赋值当前值使其与指定值相等。
  19639. * 本方法的基类版本简单地返回 `this`,派生类**必须**重写本方法。
  19640. * @param other @en The other object. @zh 指定值。
  19641. */
  19642. set(other: this): void;
  19643. /**
  19644. * @en
  19645. * Convert the current object to a string.
  19646. * The base version of this method will returns an empty string.
  19647. * @zh
  19648. * 返回当前值的字符串表示。
  19649. * 本方法的基类版本返回空字符串。
  19650. * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
  19651. */
  19652. toString(): string;
  19653. }
  19654. export namespace js {
  19655. /**
  19656. * @en
  19657. * ID generator for runtime.
  19658. *
  19659. * @zh
  19660. * 运行时 ID 生成器。
  19661. */
  19662. export class IDGenerator {
  19663. /**
  19664. * @en
  19665. * The global id generator might have a conflict problem once every 365 days,
  19666. * if the game runs at 60 FPS and each frame 4760273 counts of new id are requested.
  19667. *
  19668. * @zh
  19669. * 全局的 id 生成器,如果游戏以 60 FPS 运行,每帧获取 4760273 个新 id, 则可能在 365 天后发生冲突。
  19670. */
  19671. static global: IDGenerator;
  19672. /**
  19673. * @en A number to record current id. It may increase when invoke `getNewId()`. Should use
  19674. * `getNewId()` to get a unique id.
  19675. * @zh 记录当前 id 值。调用 `getNewId()` 时,它可能被加1。应该使用 `getNewId()` 获取唯一的 id。
  19676. */
  19677. id: number;
  19678. /**
  19679. * @en A string value indicates the category this IDGenerator belongs to. It will be an empty
  19680. * string if not be assigned by passed parameter in constructor.
  19681. * @zh 用于标识该 IDGenerator 所属的类别。如果构造函数没有传参数对它赋值的话,它将是一个空字符串。
  19682. */
  19683. prefix: string;
  19684. /**
  19685. * @en Construct a new id generator.
  19686. * @zh 构造一个新的 id 生成器。
  19687. *
  19688. * @param category @en You can specify a unique category to avoid id collision with other instance of IdGenerator.
  19689. * @zh 你能指定一个唯一的标识用于避免与其他 id 生成器冲突。
  19690. */
  19691. constructor(category?: string);
  19692. /**
  19693. * @en Gets a unique id. @zh 获取唯一的 id。
  19694. * @returns @en The unique id. It has the form `prefix+id`, for example `scene55`, `scene` is `prefix`, `55` is `id`.
  19695. * @zh 唯一的 id。它的形式是 `prefix+id`,比如 `scene55`,`scene` 是 prefix,`55` 是 `id`。
  19696. */
  19697. getNewId(): string;
  19698. }
  19699. /**
  19700. * @en
  19701. * A fixed-length object pool designed for general type.<br>
  19702. * The implementation of this object pool is very simple.
  19703. * It can help you to improve your game performance for objects which need frequent release and recreate operations.<br/>
  19704. * @zh
  19705. * 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  19706. * 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。
  19707. * @class js.Pool
  19708. * @example
  19709. * ```
  19710. *
  19711. * Example 1:
  19712. *
  19713. * function Details () {
  19714. * this.uuidList = [];
  19715. * };
  19716. * Details.prototype.reset = function () {
  19717. * this.uuidList.length = 0;
  19718. * };
  19719. * Details.pool = new js.Pool(function (obj) {
  19720. * obj.reset();
  19721. * }, 5);
  19722. * Details.pool.get = function () {
  19723. * return this._get() || new Details();
  19724. * };
  19725. *
  19726. * var detail = Details.pool.get();
  19727. * ...
  19728. * Details.pool.put(detail);
  19729. *
  19730. * Example 2:
  19731. *
  19732. * function Details (buffer) {
  19733. * this.uuidList = buffer;
  19734. * };
  19735. * ...
  19736. * Details.pool.get = function (buffer) {
  19737. * var cached = this._get();
  19738. * if (cached) {
  19739. * cached.uuidList = buffer;
  19740. * return cached;
  19741. * }
  19742. * else {
  19743. * return new Details(buffer);
  19744. * }
  19745. * };
  19746. *
  19747. * var detail = Details.pool.get( [] );
  19748. * ...
  19749. * ```
  19750. */
  19751. export class Pool<T> {
  19752. /**
  19753. * @en
  19754. * The current number of available objects, the default is 0. It will gradually increase with the recycle of the object,
  19755. * the maximum will not exceed the size specified when the constructor is called.
  19756. * @zh
  19757. * 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。
  19758. * @default 0
  19759. */
  19760. count: number;
  19761. /**
  19762. * @en
  19763. * Gets an object from pool.
  19764. * @zh 从对象池中获取一个对象。
  19765. * @returns @en An object or null if this pool doesn't contain any object.
  19766. * @zh 获取的对象。如果对象池中没有对象,返回 null。
  19767. */
  19768. get(): T | null;
  19769. /**
  19770. * @en Constructor. @zh 构造函数。
  19771. * @param cleanupFunc @en Callback method used to process the cleanup logic when the object is recycled.
  19772. * @zh 当对象放入对象池时,用来执行清理逻辑的回调函数。
  19773. * @param size @en Pool size. @zh 对象池大小。
  19774. */
  19775. constructor(cleanup: __private._cocos_core_utils_pool__CleanUpFunction<T>, size: number);
  19776. /**
  19777. * @en Constructor. @zh 构造函数。
  19778. * @param size @en Pool size. @zh 对象池大小。
  19779. */
  19780. constructor(size: number);
  19781. /**
  19782. * @en
  19783. * Gets an object from pool.
  19784. * @zh 从对象池中获取一个对象。
  19785. * @returns @en An object or null if this pool doesn't contain any object.
  19786. * @zh 获取的对象。如果对象池中没有对象,返回 null。
  19787. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19788. */
  19789. _get(): T | null;
  19790. /**
  19791. * @en Put an object into the pool.
  19792. * @zh 向对象池返还一个不再需要的对象。
  19793. */
  19794. put(obj: T): void;
  19795. /**
  19796. * @en Resize the pool.
  19797. * @zh 设置对象池容量。
  19798. * @param length @en New pool size.
  19799. * @zh 新对象池大小。
  19800. */
  19801. resize(length: number): void;
  19802. }
  19803. export namespace array {
  19804. /**
  19805. * @zh
  19806. * 移除指定索引的数组元素。
  19807. * @en
  19808. * Removes the array item at the specified index.
  19809. * @param array @zh 被操作的数组。@en The array to be operated.
  19810. * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
  19811. */
  19812. export function removeAt<T>(array: T[], index: number): void;
  19813. /**
  19814. * @zh
  19815. * 移除指定索引的数组元素。
  19816. * 此函数十分高效,但会改变数组的元素次序。
  19817. * @en
  19818. * Removes the array item at the specified index.
  19819. * It's faster but the order of the array will be changed.
  19820. * @param array @zh 被操作的数组。@en The array to be operated.
  19821. * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
  19822. */
  19823. export function fastRemoveAt<T>(array: T[], index: number): void;
  19824. /**
  19825. * @zh
  19826. * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
  19827. * @en
  19828. * Removes the first occurrence of a specific object from the array.
  19829. * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
  19830. * @param array @zh 被操作的数组。@en The array to be operated.
  19831. * @param value @zh 待移除元素。@en The value to be removed.
  19832. */
  19833. export function remove<T>(array: T[], value: T): boolean;
  19834. /**
  19835. * @zh
  19836. * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
  19837. * 此函数十分高效,但会改变数组的元素次序。
  19838. * @en
  19839. * Removes the first occurrence of a specific object from the array.
  19840. * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
  19841. * It's faster but the order of the array will be changed.
  19842. * @param array @zh 被操作的数组。@en The array to be operated.
  19843. * @param value @zh 待移除元素。@en The value to be removed.
  19844. */
  19845. export function fastRemove<T>(array: T[], value: T): void;
  19846. /**
  19847. * @zh
  19848. * 移除首个使谓词满足的数组元素。
  19849. * @en
  19850. * Removes the first occurrence of a specific object from the array where `predicate` is `true`.
  19851. * @param array @zh 被操作的数组。@en The array to be operated.
  19852. * @param predicate @zh 一元谓词,如果要元素的话,需要返回 true。@en unary predicate which returns true if the element should be removed.
  19853. */
  19854. export function removeIf<T>(array: T[], predicate: (value: T) => boolean): T | undefined;
  19855. /**
  19856. * @zh
  19857. * 验证数组的类型。
  19858. * 此函数将用 `instanceof` 操作符验证每一个元素。
  19859. * @en
  19860. * Verify array's Type.
  19861. * This function tests each element using `instanceof` operator.
  19862. * @param array @zh 待验证的数组。@en The array to be verified.
  19863. * @param type @zh 用来判断数组元素的数据类型。@en The type used to verify the element type.
  19864. * @returns @zh 当每一个元素都是指定类型时返回 `true`,否则返回 `false`。@en Return true if all elements of the array is the same type, false others.
  19865. */
  19866. export function verifyType<T extends Function>(array: any[], type: T): array is T[];
  19867. /**
  19868. * @zh
  19869. * 移除多个数组元素。
  19870. * @en
  19871. * Removes multiple array elements.
  19872. * @param array @zh 被操作的数组。@en The array to be operated.
  19873. * @param removals @zh 所有待移除的元素。此数组的每个元素所对应的首个源数组的元素都会被移除。
  19874. * @en The values to be removed. If a value appears multiple times in the array, only the first math element will be removed.
  19875. */
  19876. export function removeArray<T>(array: T[], removals: T[]): void;
  19877. /**
  19878. * @zh
  19879. * 在数组的指定索引上插入对象。
  19880. * @en
  19881. * Inserts some objects at specified index.
  19882. * @param array @zh 被操作的数组。@en The array to be operated.
  19883. * @param objects @zh 插入的所有对象。@en The objects to be inserted.
  19884. * @param index @zh 插入的索引。@en The index to insert at.
  19885. * @returns @zh 传入的 `array`。@en The passed in `array`.
  19886. */
  19887. export function appendObjectsAt<T>(array: T[], objects: T[], index: number): T[];
  19888. /**
  19889. * @zh
  19890. * 返回数组是否包含指定的元素。
  19891. * @en
  19892. * Determines whether the array contains a specific element.
  19893. * @param array @zh 被查询的数组 @en The array to be checked.
  19894. * @param value @zh 用来查询的值 @en The value used to check for.
  19895. * @returns @zh true 如果包含该元素,否则返回 false。@en true if contains the value, false else.
  19896. */
  19897. export function contains<T>(array: T[], value: T): boolean;
  19898. /**
  19899. * @zh
  19900. * 拷贝数组。
  19901. * @en
  19902. * Copy an array.
  19903. * @param array @zh 用来拷贝的数组。@en The array to be copied from.
  19904. * @returns @zh 数组的副本。@en A new array has the same values as `array`.
  19905. */
  19906. export function copy<T>(array: T[]): T[];
  19907. }
  19908. /**
  19909. * @deprecated since v3.7.0, `js.js` is deprecated, please access `js` directly instead.
  19910. */
  19911. export const js: {
  19912. IDGenerator: typeof IDGenerator;
  19913. Pool: typeof Pool;
  19914. array: typeof array;
  19915. isNumber: typeof isNumber;
  19916. isString: typeof isString;
  19917. isEmptyObject: typeof isEmptyObject;
  19918. getPropertyDescriptor: typeof getPropertyDescriptor;
  19919. addon: typeof addon;
  19920. mixin: typeof mixin;
  19921. extend: typeof extend;
  19922. getSuper: typeof getSuper;
  19923. isChildClassOf: typeof isChildClassOf;
  19924. clear: typeof clear;
  19925. value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean | undefined, enumerable?: boolean | undefined) => void;
  19926. getset: (object: Record<string | number, any>, propertyName: string, getter: __private.__types_globals__Getter, setter?: boolean | __private.__types_globals__Setter | undefined, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
  19927. get: (object: Record<string | number, any>, propertyName: string, getter: __private.__types_globals__Getter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
  19928. set: (object: Record<string | number, any>, propertyName: string, setter: __private.__types_globals__Setter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
  19929. unregisterClass: typeof unregisterClass;
  19930. getClassName: typeof getClassName;
  19931. setClassName: typeof setClassName;
  19932. setClassAlias: typeof setClassAlias;
  19933. getClassByName: typeof getClassByName;
  19934. getClassById: typeof getClassById;
  19935. /**
  19936. * @en All classes registered in the engine, indexed by name.
  19937. * @zh 引擎中已注册的所有类型,通过名称进行索引。
  19938. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19939. * @example
  19940. * ```
  19941. * import { js } from 'cc';
  19942. * // save all registered classes before loading scripts
  19943. * let builtinClassIds = js._registeredClassIds;
  19944. * let builtinClassNames = js._registeredClassNames;
  19945. * // load some scripts that contain CCClass
  19946. * ...
  19947. * // clear all loaded classes
  19948. * js._registeredClassIds = builtinClassIds;
  19949. * js._registeredClassNames = builtinClassNames;
  19950. * ```
  19951. *
  19952. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19953. */
  19954. _registeredClassNames: Record<string, __private.__types_globals__Constructor<unknown>>;
  19955. /**
  19956. * @en All classes registered in the engine, indexed by ID.
  19957. * @zh 引擎中已注册的所有类型,通过 ID 进行索引。
  19958. * @example
  19959. * ```
  19960. * import { js } from 'cc';
  19961. * // save all registered classes before loading scripts
  19962. * let builtinClassIds = js._registeredClassIds;
  19963. * let builtinClassNames = js._registeredClassNames;
  19964. * // load some scripts that contain CCClass
  19965. * ...
  19966. * // clear all loaded classes
  19967. * js._registeredClassIds = builtinClassIds;
  19968. * js._registeredClassNames = builtinClassNames;
  19969. * ```
  19970. *
  19971. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19972. */
  19973. _registeredClassIds: Record<string, __private.__types_globals__Constructor<unknown>>;
  19974. /**
  19975. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19976. */
  19977. _getClassId: typeof _getClassId;
  19978. getClassId: typeof getClassId;
  19979. /**
  19980. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19981. */
  19982. _setClassId: (id: string, constructor: __private.__types_globals__Constructor<unknown>) => void;
  19983. /**
  19984. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  19985. */
  19986. _getClassById: typeof _getClassById;
  19987. obsolete: typeof obsolete;
  19988. obsoletes: typeof obsoletes;
  19989. formatStr: typeof formatStr;
  19990. shiftArguments: typeof shiftArguments;
  19991. createMap: typeof createMap;
  19992. };
  19993. /**
  19994. * @en
  19995. * Checks if an object is `number`.
  19996. * @zh
  19997. * 检查对象是否是 number 类型。
  19998. * @param object @en The object to check. @zh 要检查的对象。
  19999. * @returns @en True if it is a number primitive or a `Number` instance, false else.
  20000. * @zh 如果该对象是基础数字类型或者是 `Number` 实例,返回 `true`;否则返回 `false`。
  20001. * @example
  20002. * ```ts
  20003. * var obj = 10;
  20004. * isNumber(obj); // returns true
  20005. *
  20006. * obj = new Number(10);
  20007. * isNumber(obj); // returns true
  20008. * ```
  20009. */
  20010. export function isNumber(object: any): boolean;
  20011. /**
  20012. * @en
  20013. * Checks if an object is `string`.
  20014. * @zh
  20015. * 检查对象是否是 string 类型。
  20016. * @param object @en The object to check. @zh 要检查的对象。
  20017. * @returns @en True if it is a string primitive or a `String` instance, false else.
  20018. * @zh 如果该对象是基础字符串类型或者是 `String` 实例,返回 `true`;否则返回 `false`。
  20019. * @example
  20020. * ```ts
  20021. * var obj = "it is a string";
  20022. * isString(obj); // returns true
  20023. *
  20024. * obj = new String("it is a string");
  20025. * isString(obj); // returns true
  20026. * ```
  20027. */
  20028. export function isString(object: any): boolean;
  20029. /**
  20030. * @en
  20031. * Checks if an object is empty object. If an object does not have any enumerable property
  20032. * (including properties inherits from prototype chains), then it is an empty object.
  20033. * @zh
  20034. * 检查对象是否为空对象。空对象的定义是:没有任何可被枚举的属性(包括从原型链继承的属性)的对象。
  20035. * @param obj @en The object to check. @zh 要检查的对象。
  20036. * @returns @en True if it is not an empty object or not an object, false else.
  20037. * @zh 如果不是空对象或者不是一个对象,返回 `true`;否则返回 `false`。
  20038. */
  20039. export function isEmptyObject(obj: any): boolean;
  20040. /**
  20041. * @en
  20042. * A simple wrapper of `Object.create(null)` which ensures the return object have no prototype (and thus no inherited members).
  20043. * This eliminates the need to make `hasOwnProperty` judgments when we look for values by key on the object,
  20044. * which is helpful for performance in this case.
  20045. * @zh
  20046. * 该方法是对 `Object.create(null)` 的简单封装。
  20047. * `Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。
  20048. * 这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断,此时对性能提升有帮助。
  20049. *
  20050. * @param forceDictMode @en Apply the delete operator to newly created map object. This will let V8 put the object in
  20051. * "dictionary mode" and disables creation of hidden classes. This will improve the performance of objects that are
  20052. * constantly changing shape.
  20053. * @zh 对新创建的地图对象应用删除操作。这将让V8将对象置于 "字典模式",并禁止创建隐藏类。这将提高那些不断变化形状对象的性能。
  20054. * @returns @en A newly map object. @zh 一个新的 map 对象。
  20055. */
  20056. export function createMap(forceDictMode?: boolean): any;
  20057. /**
  20058. * @en
  20059. * Gets class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  20060. * (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code of stackoverflow post</a>)
  20061. * @zh
  20062. * 获取对象的类型名称,如果对象是 {} 字面量,将会返回 ""。参考了 stackoverflow 的代码实现:
  20063. * <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">stackoverflow 的实现</a>
  20064. * @param objOrCtor @en An object instance or constructor. @zh 类实例或者构造函数。
  20065. * @returns @en The class name. @zh 类名。
  20066. */
  20067. export function getClassName(objOrCtor: any): string;
  20068. /**
  20069. * @en Deprecates a property. It will print waring message if the deprecated property is accessed.
  20070. * The warning message includes new property name to use.
  20071. * @zh 废弃一个属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
  20072. * @param object @en The object or class of the property to deprecate.
  20073. * @zh 被废弃属性的对象或者类。
  20074. * @param obsoleted @en The property name to deprecate. It could be a property name or `className.propertyName`.
  20075. * @zh 要废弃的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
  20076. * @param newExpr @en New property name to use. It could be a property name or `className.propertyName`.
  20077. * @zh 新的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
  20078. * @param writable @en Whether the property is writable. Default is false. @zh 该属性是否可写。默认不可写。
  20079. */
  20080. export function obsolete(object: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  20081. /**
  20082. * @en Deprecates some properties. It will print waring message if any deprecated property is accessed.
  20083. * The warning message includes new property name to use.
  20084. * @zh 废弃一组属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
  20085. * @param obj @en The object or class of these properties to deprecate.
  20086. * @zh 被废弃属性的对象或者类。
  20087. * @param objName @en The object name or class name of these properties to deprecate.
  20088. * @zh 被废弃属性的对象名或者类名。
  20089. * @param props @en The property names to deprecate. @zh 被废弃的一组属性名。
  20090. * @param writable @en Whether these properties are writable. @zh 被废弃的属性是否可写。
  20091. */
  20092. export function obsoletes(obj: any, objName: any, props: any, writable: any): void;
  20093. /**
  20094. * @en
  20095. * A string tool to construct a string with format string.
  20096. * @zh
  20097. * 根据格式字符串构造一个字符串。
  20098. * @param msg @en A JavaScript string containing zero or more substitution strings (%s).
  20099. * @zh 包含有 0 个或者多个格式符的字符串。
  20100. * @param subst @en JavaScript objects with which to replace substitution strings within msg.
  20101. * @zh 替换 `msg` 里格式符的表达式。
  20102. * @returns @en A new formatted string. @zh 格式化后的新字符串。
  20103. * @example
  20104. * ```
  20105. * import { js } from 'cc';
  20106. * js.formatStr("a: %s, b: %s", a, b);
  20107. * js.formatStr(a, b, c);
  20108. * ```
  20109. */
  20110. export function formatStr(msg: string, ...subst: __private._cocos_core_platform_debug__StringSubstitution[]): string;
  20111. /**
  20112. * @en
  20113. * A string tool to constructs a string from an arbitrary sequence of js object arguments.
  20114. * @zh
  20115. * 根据任意 js 对象参数序列构造一个字符串。
  20116. * @returns @en A new formatted string. @zh 格式化后的新字符串。
  20117. * @example
  20118. * ```
  20119. * import { js } from 'cc';
  20120. * js.formatStr({}, null, undefined); // [object Object] null undefined
  20121. * ```
  20122. */
  20123. export function formatStr(...data: unknown[]): string;
  20124. /**
  20125. * @en Removes the first argument. @zh 移除第一个参数。
  20126. * @returns @en An Array that contains all arguments except the first one.
  20127. * @zh 新的参数数组,该数组不包含第一个参数。
  20128. */
  20129. export function shiftArguments(): any[];
  20130. /**
  20131. * @en Gets a property descriptor by property name of an object or its prototypes.
  20132. * @zh 根据属性名从一个对象或者它的原型链中获取属性描述符。
  20133. * @param object @en The object to get property descriptor. @zh 获取描述符的对象。
  20134. * @param propertyName @en The property name to get property descriptor.
  20135. * @zh 获取属性描述符的属性名。
  20136. * @returns @en A `PropertyDescriptor` instance or null if not found.
  20137. * @zh 属性描述符对象。如果没找到的话,返回 null。
  20138. */
  20139. export function getPropertyDescriptor(object: any, propertyName: string): PropertyDescriptor | null;
  20140. /**
  20141. * @en Copies all properties except those in `excepts` from `source` to `target`.
  20142. * @zh 把 `source` 的所有属性,除了那些定义在 `excepts`的属性,拷贝到 `target`。
  20143. * @param source @en Source object to copy from. @zh 拷贝的源对象。
  20144. * @param target @en Target object to copy to. @zh 拷贝到目标对象。
  20145. * @param excepts @en Properties are not copied. @zh 不拷贝到属性。
  20146. */
  20147. export function copyAllProperties(source: any, target: any, excepts: Array<string>): void;
  20148. /**
  20149. * @en Copies all the properties in "sources" that are not defined in object from "sources" to "object".
  20150. * @zh 将 "sources" 中的所有没在 object 定义的属性从 "sources" 复制到 "object"。
  20151. * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
  20152. * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
  20153. * @return @en The passing `object` or a new object if passing object is not valid.
  20154. * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
  20155. */
  20156. export function addon(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
  20157. /**
  20158. * @en Copies all the properties in "sources" from "sources" to "object".
  20159. * @zh 将 "sources" 中的所有属性从 "sources" 复制到 "object"。
  20160. * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
  20161. * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
  20162. * @return @en The passing `object` or a new object if passing object is not valid.
  20163. * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
  20164. */
  20165. export function mixin(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
  20166. /**
  20167. * @en
  20168. * Makes a class inherit from the supplied base class.
  20169. * @zh
  20170. * 将一个类型继承另一个类型。
  20171. * @param cls @en The class to inherit. @zh 要继承的类。
  20172. * @param base @en The class to inherit from. @zh 被继承的类。
  20173. * @returns @en Passed in `cls`. @zh 传入的 `cls`。
  20174. */
  20175. export function extend(cls: Function, base: Function): Function | undefined;
  20176. /**
  20177. * @en Get super class.
  20178. * @zh 获取父类。
  20179. * @param constructor @en The constructor to get super class.
  20180. * @zh 要获取父类的构造函数。
  20181. * @returns @en Super class. @zh 父类。
  20182. */
  20183. export function getSuper(constructor: Function): any;
  20184. /**
  20185. * @en
  20186. * Checks whether a class is child of another class, or is the same type as another class.
  20187. * @zh 判断一类型是否是另一类型的子类或本身。
  20188. * @param subclass @en Sub class to check. @zh 子类类型。
  20189. * @param superclass @en Super class to check. @zh 父类类型。
  20190. * @return @en True if sub class is child of super class, or they are the same type. False else.
  20191. * @zh 如果子类类型是父类类型的子类,或者二者是相同类型,那么返回 true,否则返回 false。
  20192. */
  20193. export function isChildClassOf<T extends __private.__types_globals__Constructor>(subclass: unknown, superclass: T): subclass is T;
  20194. export function isChildClassOf(subclass: unknown, superclass: unknown): boolean;
  20195. /**
  20196. * @en Removes all enumerable properties from a object.
  20197. * @zh 移除对象中所有可枚举属性.
  20198. * @param object @en The object to remove enumerable properties from.
  20199. * @zh 要删除可枚举属性的对象。
  20200. */
  20201. export function clear(object: Record<string | number, any>): void;
  20202. /**
  20203. * @en Registers a class by specified name manually.
  20204. * @zh 通过指定的名称手动注册类型
  20205. * @param className @en Class name to register. @zh 注册的类名。
  20206. * @param constructor @en Constructor to register. @zh 注册的构造函数。
  20207. */
  20208. export function setClassName(className: string, constructor: __private.__types_globals__Constructor): void;
  20209. /**
  20210. * @en Sets an alias for a class.
  20211. * After executing `setClassAlias(target, alias)`, `alias` will be a single way short cut for class `target`.
  20212. * `js.getClassByName(alias)` and `getClassById(alias)` will return `target`. But `js.getClassName(target)`
  20213. * will return the original class name of `target`, not the alias.
  20214. * @zh 为类设置别名。执行 `setClassAlias(target, alias)` 后,`alias` 将作为类 `target` 的 “单向 ID” 和 “单向名称”。
  20215. * 因此,`getClassById(alias)` 和 `getClassByName(alias)` 都会得到 `target`。这种映射是单向的,这意味着 `getClassName(target)`
  20216. * 和 `getClassId(target)` 将不会返回 `alias`。
  20217. * @param target @en Constructor of a class to set an alias. @zh 设置别名的类的构造函数。
  20218. * @param alias @en Alias to set. The name shall not have been set as class name or alias of another class.
  20219. * @zh 类的别名。别名不能重复,也不能是已有类的名字。
  20220. */
  20221. export function setClassAlias(target: __private.__types_globals__Constructor, alias: string): void;
  20222. /**
  20223. * @en
  20224. * Unregister some classes from engine.
  20225. * If you don't need a registered class anymore, you should unregister the class or engine will keep its reference.
  20226. * Please note that it‘s your responsibility to remove other references to the class.
  20227. * @zh
  20228. * 取消注册类型。如果你不再需要一个注册的类,你应该取消注册这个类,否则引擎会还有对它的引用。
  20229. * 请注意,你仍然有责任释放其他地方对该类的引用。
  20230. *
  20231. * @param ...constructor @en The classes to unregister. @zh 取消注册的类型列表。
  20232. */
  20233. export function unregisterClass(...constructors: Function[]): void;
  20234. /**
  20235. * @en Gets a registered class by id.
  20236. * @zh 通过 id 获取已注册的类型。
  20237. * @param classId @en An id to get class.
  20238. * @return constructor
  20239. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20240. * Please use `getClassById()` instead.
  20241. */
  20242. export function _getClassById(classId: any): __private.__types_globals__Constructor<unknown>;
  20243. /**
  20244. * @en Gets the registered class by id.
  20245. * @zh 通过 id 获取已注册的类型。
  20246. * @param classId @en The class id used to get class. @zh 获取类的 id。
  20247. * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
  20248. */
  20249. export function getClassById(classId: any): __private.__types_globals__Constructor<unknown>;
  20250. /**
  20251. * @en
  20252. * Gets the registered class by class name.
  20253. * @zh
  20254. * 通过类名获取已注册的类型。
  20255. * @param classname @en The class name used to get class. @zh 获取类的类名。
  20256. * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
  20257. */
  20258. export function getClassByName(classname: any): __private.__types_globals__Constructor<unknown>;
  20259. /**
  20260. * @en
  20261. * Get class id of the object
  20262. * @zh
  20263. * 获取对象的 class id
  20264. * @param obj - instance or constructor
  20265. * @param [allowTempId = true] - can return temp id in editor
  20266. * @return
  20267. * @deprecated since v3.5.0. this is an engine private interface that will be removed in the future.
  20268. * Please use `getClassId()` instead.
  20269. */
  20270. export function _getClassId(obj: any, allowTempId?: boolean): string;
  20271. /**
  20272. * @en
  20273. * Gets class id of an object
  20274. * @zh
  20275. * 获取对象的 class id。
  20276. * @param obj @en An object instance to get class id. @zh 获取类标识的对象。
  20277. * @param allowTempId @en Whether allow to return a temple class id in editor.
  20278. * @zh 在编辑器时,是否允许返回一个临时的类标识。
  20279. * @returns @en Class id if found, empty string else.
  20280. * @zh 找到的类标识。如果没找到的话,返回空字符串。
  20281. */
  20282. export function getClassId(obj: any, allowTempId?: boolean): string;
  20283. /**
  20284. * @en A helper function to add a property to an object, or modifies attributes
  20285. * of an existing property. The property is configurable.
  20286. * @zh 为对象添加属性或者修改已有属性的辅助函数。该属性是可配置的。
  20287. * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
  20288. * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
  20289. * @param value_ @en The property value to add or new value to replace a existing attribute.
  20290. * @zh 要添加的属性值,或者取代现有属性的新值。
  20291. * @param writable @en If the property is writable. @zh 属性是否可写。
  20292. * @param enumerable @en If the property is enumerable. @zh 属性是否可枚举。
  20293. */
  20294. export const value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean, enumerable?: boolean) => void;
  20295. /**
  20296. * @en A helper function to add or modify `get`, `set`, `enumerable` or `configurable` of a property.
  20297. * @zh 添加或修改属性的 `get`, `set`, `enumerable` 或者 `configurable`。
  20298. * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
  20299. * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
  20300. * @param getter @en The getter of a property. @zh 属性的获取函数。
  20301. * @param setter @en The setter of a property. @zh 属性的设置函数。
  20302. * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
  20303. * @param configurable @en If the property is configurable. @zh 属性是否可配置。
  20304. */
  20305. export const getset: (object: Record<string | number, any>, propertyName: string, getter: __private.__types_globals__Getter, setter?: __private.__types_globals__Setter | boolean, enumerable?: boolean, configurable?: boolean) => void;
  20306. /**
  20307. * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
  20308. * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
  20309. * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
  20310. * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
  20311. * @param getter @en The getter of a property. @zh 属性的获取函数。
  20312. * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
  20313. * @param configurable @en If the property is configurable. @zh 属性是否可配置。
  20314. */
  20315. export const get: (object: Record<string | number, any>, propertyName: string, getter: __private.__types_globals__Getter, enumerable?: boolean, configurable?: boolean) => void;
  20316. /**
  20317. * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
  20318. * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
  20319. * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
  20320. * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
  20321. * @param setter @en The setter of a property. @zh 属性的设置函数。
  20322. * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
  20323. * @param configurable @en If the property is configurable. @zh 属性是否可配置。
  20324. */
  20325. export const set: (object: Record<string | number, any>, propertyName: string, setter: __private.__types_globals__Setter, enumerable?: boolean, configurable?: boolean) => void;
  20326. /**
  20327. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20328. */
  20329. export const _idToClass: Record<string, __private.__types_globals__Constructor>;
  20330. /**
  20331. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20332. */
  20333. export const _nameToClass: Record<string, __private.__types_globals__Constructor>;
  20334. /**
  20335. * @en
  20336. * Register the class by specified id, if its classname is not defined, the class name will also be set.
  20337. * @zh
  20338. * 通过 id 注册类型
  20339. * @method _setClassId
  20340. * @param classId
  20341. * @param constructor
  20342. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20343. */
  20344. export const _setClassId: (id: string, constructor: __private.__types_globals__Constructor) => void;
  20345. }
  20346. export namespace misc {
  20347. /**
  20348. * @en Inserts a new element into a map. All values corresponding to the same key are stored in an array.
  20349. * @zh 往 map 插入一个元素。同一个关键字对应的所有值存储在一个数组里。
  20350. * @param map @en The map to insert element. @zh 插入元素的 map。
  20351. * @param key @en The key of new element. @zh 新插入元素的关键字。
  20352. * @param value @en The value of new element. @zh 新插入元素的值。
  20353. * @param pushFront @en Whether to put new value in front of the vector if key exists.
  20354. * @zh 如果关键字已经存在,是否把新插入的值放到数组第一个位置。
  20355. */
  20356. export function pushToMap(map: any, key: any, value: any, pushFront: any): void;
  20357. /**
  20358. * @en Checks whether a node is a descendant of a given node, that is the node itself, one of its direct
  20359. * children (childNodes), one of the children's direct children, and so on.
  20360. * @zh 检查节点是否是一个给定的节点的后代,即节点本身、它的一个直接子节点(childNodes)、该子节点的一个直接子节点,依此类推。
  20361. * @param refNode @en The node to check. @zh 检查的节点。
  20362. * @param otherNode @en The node to test with. @zh 用来测试的节点。
  20363. * @returns @en True if otherNode is contained in refNode, false if not.
  20364. * @zh 如果 refNode 包含 otherNode,返回 true;否则返回 false。
  20365. */
  20366. export function contains(refNode: any, otherNode: any): boolean;
  20367. /**
  20368. * @en Checks whether a node is a DOM node. @zh 检查一个节点是否是一个 DOM 节点。
  20369. * @param node @en The node the check. @zh 被检查节点。
  20370. * @returns @en True if node is a DOM node, false else.
  20371. * @zh 如果 DOM 节点,返回 true;否则返回 false。
  20372. */
  20373. export function isDomNode(node: any): boolean;
  20374. /**
  20375. * @en Invoke a function in next frame. @zh 在下一帧执行传入的函数。
  20376. * @param callback @en The function to be invoked next frame. @zh 下一帧要执行的函数。
  20377. * @param p1 @en The first parameter passed to `callback`. @zh 传给回调函数的第一个参数。
  20378. * @param p2 @en The seconde parameter passed to `callback`. @zh 传给回调函数的第二个参数。
  20379. */
  20380. export function callInNextTick(callback: any, p1?: any, p2?: any): void;
  20381. /**
  20382. * @en Create a new function that will invoke `functionName` with try catch.
  20383. * @zh 创建一个新函数,该函数会使用 try catch 机制调用 `functionName`.
  20384. * @param funcName @en The function name to be invoked with try catch.
  20385. * @zh 被 try catch 包裹的函数名。
  20386. * @returns @en A new function that will invoke `functionName` with try catch.
  20387. * @zh 使用 try catch 机制调用 `functionName` 的新函数.
  20388. */
  20389. export function tryCatchFunctor_EDITOR(funcName: string): (comp: Component) => void;
  20390. /**
  20391. * @en Checks whether an object is an empty object.
  20392. * @zh 检查一个对象是否为空对象。
  20393. * @param obj @en The object to check. @zh 要检查的对象。
  20394. * @returns @en True if it is an empty object. False if it is not an empty object, not Object type, null or undefined.
  20395. * @ 如果是空对象,返回 true。如果不是空对象,不是Object类型,空或未定义,则为假。
  20396. */
  20397. export function isPlainEmptyObj_DEV(obj: any): boolean;
  20398. /**
  20399. * @en Clamps a value between a min and a max value. </br>
  20400. * If the original value is greater than max_inclusive, returns max_inclusive. </br>
  20401. * If the original value is less than min_inclusive, returns min_inclusive. </br>
  20402. * Else returns the original value.
  20403. * @zh 限定浮点数的最大最小值。<br/>
  20404. * 如果数值大于 max_inclusive 则返回 max_inclusive。<br/>
  20405. * 如果数值小于 min_inclusive 则返回 min_inclusive。<br/>
  20406. * 否则返回自身。
  20407. * @param value @en Original value. @zh 初始值。
  20408. * @param min_inclusive @en Minimum value in range. @zh 最小值。
  20409. * @param max_inclusive @en Maximum value in range. @zh 最大值。
  20410. * @returns @en The clamped value. @zh 目标值。
  20411. * @example
  20412. * var v1 = clampf(20, 0, 20); // 20;
  20413. * var v2 = clampf(-1, 0, 20); // 0;
  20414. * var v3 = clampf(10, 0, 20); // 10;
  20415. */
  20416. export function clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  20417. /**
  20418. * @en Converts degree to radian.
  20419. * @zh 将度数转换为弧度。
  20420. * @param angle @en The degree to convert. @zh 角度。
  20421. * @returns @en The radian. @zh 弧度。
  20422. */
  20423. export function degreesToRadians(angle: number): number;
  20424. /**
  20425. * @en Converts radian to degree.
  20426. * @zh 将弧度转换为角度。
  20427. * @param angle @en The radian to convert. @zh 弧度。
  20428. * @returns @en The degree. @zh 角度。
  20429. */
  20430. export function radiansToDegrees(angle: any): number;
  20431. export const BUILTIN_CLASSID_RE: RegExp;
  20432. export const BASE64_VALUES: number[];
  20433. }
  20434. export namespace path {
  20435. /**
  20436. * @en Joins strings to be a path.
  20437. * @zh 拼接字符串为路径。
  20438. * @param segments @en Strings to be joined. @zh 被拼接的字符串数组。
  20439. * @returns @en The final path. @zh 拼接后的路径。
  20440. * @example {@link cocos/core/utils/CCPath/join.js}
  20441. */
  20442. export function join(...segments: string[]): string;
  20443. /**
  20444. * @en Gets the extension name of a path including '.', like '.png'.
  20445. * @zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  20446. * @param path @en A file path. @zh 文件路径。
  20447. * @returns @en The extension name. @zh 扩展名。
  20448. * @example {@link cocos/core/utils/CCPath/extname.js}
  20449. */
  20450. export function extname(path: string): string;
  20451. /**
  20452. * @en Gets the main name of a file name, exclude extension name.
  20453. * @zh 获取文件名的主名称。
  20454. * @deprecated
  20455. */
  20456. export function mainFileName(fileName: string): string;
  20457. /**
  20458. * @en Gets the file name of a file path, exclude extension name and directory name.
  20459. * @zh 获取文件路径的文件名,不包含扩展名和目录名。
  20460. * @param path @en A file path. @zh 文件路径。
  20461. * @param extName @en File extension name. @zh 文件扩展名。
  20462. * @returns @en The file name. @zh 文件名。
  20463. * @example {@link cocos/core/utils/CCPath/basename.js}
  20464. */
  20465. export function basename(path: string, extName?: string): string;
  20466. /**
  20467. * @en Gets directory name of a file path.
  20468. * @zh 获取文件路径的目录名。
  20469. * @param path @en A file path. @zh 文件路径。
  20470. * @returns @en Directory name. @zh 文件目录名。
  20471. * @example {@link cocos/core/utils/CCPath/dirname.js}
  20472. */
  20473. export function dirname(path: string): string;
  20474. /**
  20475. * @en Changes file extension name.
  20476. * @zh 更改文件的扩展名。
  20477. * @param path @en A file path. @zh 文件路径。
  20478. * @param extName @en New file extension name. @zh 新文件扩展名。
  20479. * @returns @en New file path. @zh 新的文件路径。
  20480. * @example {@link cocos/core/utils/CCPath/changeExtname.js}
  20481. */
  20482. export function changeExtname(path: string, extName?: string): string;
  20483. /**
  20484. * @en Changes file name of a file path.
  20485. * @zh 更改文件路径的文件名。
  20486. * @param path @en A file path. @zh 文件路径。
  20487. * @param newBaseName @en New file name. @zh 新文件名。
  20488. * @param keepExt @en Whether to keep extension name. @zh 是否保留扩展名。
  20489. * @returns @en New file path. @zh 新文件路径。
  20490. * @example {@link cocos/core/utils/CCPath/changeBasename.js}
  20491. */
  20492. export function changeBasename(path: string, newBaseName: string, keepExt?: boolean): string;
  20493. export function _normalize(url: any): any;
  20494. /**
  20495. * @en Removes the last path separator('/' or '\') of a path if exist.
  20496. * @zh 如果存在的话,删除文件路径的最后一个分隔符('/' 或者 '\')。
  20497. * @param path @en A file path to modify. @zh 要修改的文件路径。
  20498. * @returns @en A new file path without last file separator.
  20499. * @zh 路径最后分隔符的新路径。
  20500. */
  20501. export function stripSep(path: string): string;
  20502. /**
  20503. * @en Gets file separator for different platforms. It is `/` on unix like platforms,
  20504. * and `\` on windows.
  20505. * @zh 获取不同平台的文件分割符。类 unix 系统是 `/`,windows 系统是 `\`。
  20506. * @returns @en File separator. @zh 文件分割符。
  20507. */
  20508. export function getSeperator(): string;
  20509. }
  20510. /**
  20511. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  20512. */
  20513. export function setDefaultLogTimes(times: number): void;
  20514. /**
  20515. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  20516. */
  20517. export let replaceProperty: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IReplacement[]) => void;
  20518. /**
  20519. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  20520. */
  20521. export let removeProperty: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IRemoveItem[]) => void;
  20522. /**
  20523. * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
  20524. */
  20525. export let markAsWarning: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IMarkItem[]) => void;
  20526. /**
  20527. * @en
  20528. * Conversion of non-UI nodes to UI Node (Local) Space coordinate system.
  20529. * @zh
  20530. * 非 UI 节点转换到 UI 节点(局部) 空间坐标系。
  20531. * @deprecated since Cocos Creator 3D v1.2, please use [[Camera.convertToUINode]]
  20532. * @param mainCamera @en The main camera @zh 主相机
  20533. * @param wpos @en The world space location. @zh 世界空间位置。
  20534. * @param uiNode @en The UI node. @zh UI 节点。
  20535. * @param out @en The output local position in UI @zh 返回 UI 节点局部坐标。
  20536. */
  20537. export function WorldNode3DToLocalNodeUI(mainCamera: Camera, wpos: math.Vec3, uiNode: Node, out?: math.Vec3): math.Vec3;
  20538. /**
  20539. * @en
  20540. * Conversion of non-UI nodes to UI Node (World) Space coordinate system.
  20541. * @zh
  20542. * 非 UI 节点转换到 UI 节点(世界)空间坐标系。
  20543. * @deprecated since Cocos Creator 3D v1.2, please use [[Camera.convertToUINode]]
  20544. * @param mainCamera @en The main camera @zh 主相机
  20545. * @param wpos @en The world space location. @zh 世界空间位置。
  20546. * @param out @en The output world position in UI @zh 返回 UI 空间世界坐标。
  20547. */
  20548. export function WorldNode3DToWorldNodeUI(mainCamera: Camera, wpos: math.Vec3, out?: math.Vec3): math.Vec3;
  20549. /**
  20550. * @en It will be removed in v1.2. Please use [[Camera.convertToUINode]]。
  20551. * @zh 将在 v1.2 移除,请使用 Camera 的 `convertToUINode`。
  20552. * @deprecated since Cocos Creator 3D v1.2
  20553. */
  20554. export const convertUtils: {
  20555. WorldNode3DToLocalNodeUI: typeof WorldNode3DToLocalNodeUI;
  20556. WorldNode3DToWorldNodeUI: typeof WorldNode3DToWorldNodeUI;
  20557. };
  20558. export namespace _decorator {
  20559. /**
  20560. * @en
  20561. * Marks the target class as "uniquely referenced" which means, in the aspect of serialization,
  20562. * no more than one object should reference the same instance of that class.
  20563. * When serializing references to objects of such class,
  20564. * they're treated as different objects even if they point to actually the same.
  20565. * While deserializing, these two references would point two distinct objects.
  20566. * For example:
  20567. * ```ts
  20568. * import { _decorator } from 'cc';
  20569. * @_decorator.ccclass
  20570. * @_decorator.uniquelyReferenced
  20571. * class Foo { }
  20572. *
  20573. * @_decorator.ccclass
  20574. * class Bar {
  20575. * @_decorator.property
  20576. * public foo = new Foo();
  20577. * }
  20578. *
  20579. * const bar1 = new Bar();
  20580. * const bar2 = new Bar();
  20581. * bar2.foo = bar1.foo; // Programmatically let them reference to the same
  20582. * ```
  20583. * `bar1` and `bar2` reference to the same `Foo` object.
  20584. * However, after deserializing, `bar1.foo === bar2.foo` always evaluates to `false`.
  20585. * @zh
  20586. * 将目标类标记为“被唯一引用”的,其意味着就序列化而言,不会有多个对象引用该类的同一实例。
  20587. * 当序列化到该类的对象引用时,即使它们明面上指向同一对象,也会被当作是不同对象;
  20588. * 而当反序列化后,这两个引用将指向截然不同的两个对象。
  20589. * 例如:
  20590. * ```ts
  20591. * import { _decorator } from 'cc';
  20592. * @_decorator.ccclass
  20593. * @_decorator.uniquelyReferenced
  20594. * class Foo { }
  20595. *
  20596. * @_decorator.ccclass
  20597. * class Bar {
  20598. * @_decorator.property
  20599. * public foo = new Foo();
  20600. * }
  20601. *
  20602. * const bar1 = new Bar();
  20603. * const bar2 = new Bar();
  20604. * bar2.foo = bar1.foo; // 由程序逻辑让它们引用同一个对象
  20605. * ```
  20606. * `bar1` 和 `bar2` 引用同一个 `Foo` 对象。
  20607. * 但在反序列化之后,`bar1.foo === bar2.foo` 永不成立。
  20608. */
  20609. export const uniquelyReferenced: ClassDecorator;
  20610. /**
  20611. * @en Declare a standard class as a CCClass, please refer to the [document](https://docs.cocos.com/creator3d/manual/en/scripting/ccclass.html)
  20612. * @zh 将标准写法的类声明为 CC 类,具体用法请参阅[类型定义](https://docs.cocos.com/creator3d/manual/zh/scripting/ccclass.html)。
  20613. * @param name - The class name used for serialization.
  20614. * @example
  20615. * ```ts
  20616. * import { _decorator, Component } from 'cc';
  20617. * const {ccclass} = _decorator;
  20618. *
  20619. * // define a CCClass, omit the name
  20620. * @ccclass
  20621. * class NewScript extends Component {
  20622. * // ...
  20623. * }
  20624. *
  20625. * // define a CCClass with a name
  20626. * @ccclass('LoginData')
  20627. * class LoginData {
  20628. * // ...
  20629. * }
  20630. * ```
  20631. */
  20632. export const ccclass: ((name?: string) => ClassDecorator) & ClassDecorator;
  20633. /**
  20634. * @en Declare as a CCClass property with options
  20635. * @zh 声明属性为 CCClass 属性。
  20636. * @param options property options
  20637. */
  20638. export function property(options?: __private._cocos_core_data_decorators_property__IPropertyOptions): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20639. /**
  20640. * @en Declare as a CCClass property with the property type
  20641. * @zh 标注属性为 cc 属性。<br/>
  20642. * 等价于`@property({type})`。
  20643. * @param type A [[ccclass]] type or a [[ValueType]]
  20644. */
  20645. export function property(type: __private._cocos_core_data_decorators_property__PropertyType): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20646. /**
  20647. * @en Declare as a CCClass property
  20648. * @zh 标注属性为 cc 属性。<br/>
  20649. * 等价于`@property()`。
  20650. */
  20651. export function property(...args: Parameters<__private._cocos_core_data_decorators_utils__LegacyPropertyDecorator>): void;
  20652. /**
  20653. * @en Declare that the current component relies on another type of component.
  20654. * If the required component doesn't exist, the engine will create a new empty instance of the required component and add it to the node.
  20655. * @zh 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  20656. * @param requiredComponent The required component type
  20657. * @example
  20658. * ```ts
  20659. * import {_decorator, Sprite, Component} from cc;
  20660. * import {ccclass, requireComponent} from _decorator;
  20661. *
  20662. * @ccclass
  20663. * @requireComponent(Sprite)
  20664. * class SpriteCtrl extends Component {
  20665. * // ...
  20666. * }
  20667. * ```
  20668. */
  20669. export const requireComponent: (requiredComponent: Function | Function[]) => ClassDecorator;
  20670. /**
  20671. * @en Set the component priority, it decides at which order the life cycle functions of components will be invoked. Smaller priority gets invoked before larger priority.
  20672. * This will affect `onLoad`, `onEnable`, `start`, `update` and `lateUpdate`, but `onDisable` and `onDestroy` won't be affected.
  20673. * @zh 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  20674. * @param priority - The execution order of life cycle methods for Component. Smaller priority gets invoked before larger priority.
  20675. * @example
  20676. * ```ts
  20677. * import { _decorator, Component } from 'cc';
  20678. * const {ccclass, executionOrder} = _decorator;
  20679. *
  20680. * @ccclass
  20681. * @executionOrder(1)
  20682. * class CameraCtrl extends Component {
  20683. * // ...
  20684. * }
  20685. * ```
  20686. */
  20687. export const executionOrder: (priority: number) => ClassDecorator;
  20688. /**
  20689. * @en Forbid adds multiple instances of the component to the same node.
  20690. * @zh 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  20691. * @example
  20692. * ```ts
  20693. * import { _decorator, Component } from 'cc';
  20694. * const {ccclass, disallowMultiple} = _decorator;
  20695. *
  20696. * @ccclass
  20697. * @disallowMultiple
  20698. * class CameraCtrl extends Component {
  20699. * // ...
  20700. * }
  20701. * ```
  20702. */
  20703. export const disallowMultiple: ClassDecorator & ((yes?: boolean) => ClassDecorator);
  20704. /**
  20705. * @en Makes a CCClass that inherits from component execute in edit mode.<br/>
  20706. * By default, all components are only executed in play mode,<br/>
  20707. * which means they will not have their callback functions executed while the Editor is in edit mode.<br/>
  20708. * @zh 允许继承自 Component 的 CCClass 在编辑器里执行。<br/>
  20709. * 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  20710. * @example
  20711. * ```ts
  20712. * import { _decorator, Component } from 'cc';
  20713. * const {ccclass, executeInEditMode} = _decorator;
  20714. *
  20715. * @ccclass
  20716. * @executeInEditMode
  20717. * class NewScript extends Component {
  20718. * // ...
  20719. * }
  20720. * ```
  20721. */
  20722. export const executeInEditMode: ClassDecorator & ((yes?: boolean) => ClassDecorator);
  20723. /**
  20724. * @en Add the current component to the specific menu path in `Add Component` selector of the inspector panel
  20725. * @zh 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  20726. * @param path - The path is the menu represented like a pathname. For example, the menu could be "Rendering/CameraCtrl".
  20727. * @example
  20728. * ```ts
  20729. * import { _decorator, Component } from 'cc';
  20730. * const {ccclass, menu} = _decorator;
  20731. *
  20732. * @ccclass
  20733. * @menu("Rendering/CameraCtrl")
  20734. * class NewScript extends Component {
  20735. * // ...
  20736. * }
  20737. * ```
  20738. */
  20739. export const menu: (path: string) => ClassDecorator;
  20740. /**
  20741. * @en When [[_decorator.executeInEditMode]] is set,
  20742. * This decorator will make the editor run in high FPS mode when a node with the component is focused
  20743. * @zh 当指定了 [[_decorator.executeInEditMode]] 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  20744. * @example
  20745. * ```ts
  20746. * import { _decorator, Component } from 'cc';
  20747. * const {ccclass, playOnFocus, executeInEditMode} = _decorator;
  20748. *
  20749. * @ccclass
  20750. * @executeInEditMode
  20751. * @playOnFocus
  20752. * class CameraCtrl extends Component {
  20753. * // ...
  20754. * }
  20755. * ```
  20756. */
  20757. export const playOnFocus: ClassDecorator & ((yes?: boolean) => ClassDecorator);
  20758. /**
  20759. * @en Use a customized inspector page in the **inspector**
  20760. * @zh 自定义当前组件在 **属性检查器** 中渲染时所用的 UI 页面描述。
  20761. * @param url The URL of the page definition in js
  20762. * @example
  20763. * ```ts
  20764. * import { _decorator, Component } from 'cc';
  20765. * const {ccclass, inspector} = _decorator;
  20766. *
  20767. * @ccclass
  20768. * @inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  20769. * class NewScript extends Component {
  20770. * // ...
  20771. * }
  20772. * ```
  20773. */
  20774. export const inspector: (url: string) => ClassDecorator;
  20775. /**
  20776. * @en Define the icon of the component.
  20777. * @zh 自定义当前组件在编辑器中显示的图标 url。
  20778. * @param url
  20779. * @private
  20780. * @example
  20781. * ```ts
  20782. * import { _decorator, Component } from 'cc';
  20783. * const {ccclass, icon} = _decorator;
  20784. *
  20785. * @ccclass
  20786. * @icon("xxxx.png")
  20787. * class NewScript extends Component {
  20788. * // ...
  20789. * }
  20790. * ```
  20791. */
  20792. export const icon: (url: string) => ClassDecorator;
  20793. /**
  20794. * @en Define the help documentation URL,
  20795. * if given, the component section in the **Inspector** will have a help documentation icon refers to the web page given.
  20796. * @zh 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  20797. * @param url The URL of the help documentation
  20798. * @example
  20799. * ```ts
  20800. * import { _decorator, Component } from 'cc';
  20801. * const {ccclass, help} = _decorator;
  20802. *
  20803. * @ccclass
  20804. * @help("app://docs/html/components/spine.html")
  20805. * class NewScript extends Component {
  20806. * // ...
  20807. * }
  20808. * ```
  20809. */
  20810. export const help: (url: string) => ClassDecorator;
  20811. /**
  20812. * @en Declare the property as the given type
  20813. * @zh 标记该属性的类型。
  20814. * @param type
  20815. */
  20816. export function type(type: Function | [
  20817. Function
  20818. ] | any): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20819. export function type<T>(type: __private._cocos_core_data_utils_attribute__PrimitiveType<T> | [
  20820. __private._cocos_core_data_utils_attribute__PrimitiveType<T>
  20821. ]): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20822. /**
  20823. * @en Declare the property as integer
  20824. * @zh 将该属性标记为整数。
  20825. */
  20826. export const integer: __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20827. /**
  20828. * @en Declare the property as float
  20829. * @zh 将该属性标记为浮点数。
  20830. */
  20831. export const float: __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20832. /**
  20833. * @en Declare the property as boolean
  20834. * @zh 将该属性标记为布尔值。
  20835. */
  20836. export const boolean: __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20837. /**
  20838. * @en Declare the property as string
  20839. * @zh 将该属性标记为字符串。
  20840. */
  20841. export const string: __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
  20842. }
  20843. export function CCClass<TFunction>(options: {
  20844. name?: string;
  20845. extends: null | (Function & {
  20846. __props__?: any;
  20847. _sealed?: boolean;
  20848. });
  20849. ctor: TFunction;
  20850. properties?: any;
  20851. editor?: any;
  20852. }): any;
  20853. export namespace CCClass {
  20854. export var _isCCClass: (constructor: any) => boolean;
  20855. export var fastDefine: (className: any, constructor: any, serializableFields: any) => void;
  20856. export var Attr: typeof __private._cocos_core_data_utils_attribute;
  20857. export var attr: typeof __private._cocos_core_data_utils_attribute.attr;
  20858. export var isCCClassOrFastDefined: typeof __private._cocos_core_data_class__isCCClassOrFastDefined;
  20859. export var getInheritanceChain: (constructor: any) => any[];
  20860. export var isArray: (defaultVal: any) => boolean;
  20861. export var getDefault: (defaultVal: any) => any;
  20862. export var escapeForJS: (s: any) => string;
  20863. export var IDENTIFIER_RE: RegExp;
  20864. export var getNewValueTypeCode: any;
  20865. }
  20866. /**
  20867. * @en
  20868. * The base class of most of all the objects in Fireball.
  20869. * @zh
  20870. * 大部分对象的基类。
  20871. * @private
  20872. */
  20873. export class CCObject implements __private._cocos_core_data_editor_extras_tag__EditorExtendableObject {
  20874. static _deferredDestroy(): void;
  20875. /**
  20876. * @internal
  20877. */
  20878. [editorExtrasTag]: unknown;
  20879. /**
  20880. * @internal
  20881. */
  20882. _objFlags: number;
  20883. protected _name: string;
  20884. constructor(name?: string);
  20885. /**
  20886. * @en The name of the object.
  20887. * @zh 该对象的名称。
  20888. * @default ""
  20889. * @example
  20890. * ```
  20891. * obj.name = "New Obj";
  20892. * ```
  20893. */
  20894. get name(): string;
  20895. set name(value: string);
  20896. /**
  20897. * @en After inheriting CCObject objects, control whether you need to hide, lock, serialize, and other functions.
  20898. * @zh 在继承 CCObject 对象后,控制是否需要隐藏,锁定,序列化等功能。
  20899. */
  20900. set hideFlags(hideFlags: CCObject.Flags);
  20901. get hideFlags(): CCObject.Flags;
  20902. /**
  20903. * @en
  20904. * Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  20905. * When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  20906. * So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  20907. * If you want to determine whether the current frame has called `destroy`, use `isValid(obj, true)`,
  20908. * but this is often caused by a particular logical requirements, which is not normally required.
  20909. *
  20910. * @zh
  20911. * 表示该对象是否可用(被 destroy 后将不可用)。<br>
  20912. * 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。<br>
  20913. * 因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。<br>
  20914. * 如果希望判断当前帧是否调用过 `destroy`,请使用 `isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
  20915. * @default true
  20916. * @readOnly
  20917. * @example
  20918. * ```ts
  20919. * import { Node, log } from 'cc';
  20920. * const node = new Node();
  20921. * log(node.isValid); // true
  20922. * node.destroy();
  20923. * log(node.isValid); // true, still valid in this frame
  20924. * // after a frame...
  20925. * log(node.isValid); // false, destroyed in the end of last frame
  20926. * ```
  20927. */
  20928. get isValid(): boolean;
  20929. /**
  20930. * @en
  20931. * Destroy this Object, and release all its own references to other objects.<br/>
  20932. * Actual object destruction will delayed until before rendering.
  20933. * From the next frame, this object is not usable any more.
  20934. * You can use `isValid(obj)` to check whether the object is destroyed before accessing it.
  20935. * @zh
  20936. * 销毁该对象,并释放所有它对其它对象的引用。<br/>
  20937. * 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  20938. * 您可以在访问对象之前使用 `isValid(obj)` 来检查对象是否已被销毁。
  20939. * @return whether it is the first time the destroy being called
  20940. * @example
  20941. * ```
  20942. * obj.destroy();
  20943. * ```
  20944. */
  20945. destroy(): boolean;
  20946. /**
  20947. * @en
  20948. * Clear all references in the instance.
  20949. *
  20950. * NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject.
  20951. *
  20952. * @zh
  20953. * 清理实例的所有引用
  20954. * 注意:此方法不会清理实例上的 getter 与 setter 方法。
  20955. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20956. * @example
  20957. * ```
  20958. * // You can override the _destruct method if you need, for example:
  20959. * _destruct: function () {
  20960. * for (var key in this) {
  20961. * if (this.hasOwnProperty(key)) {
  20962. * switch (typeof this[key]) {
  20963. * case 'string':
  20964. * this[key] = '';
  20965. * break;
  20966. * case 'object':
  20967. * case 'function':
  20968. * this[key] = null;
  20969. * break;
  20970. * }
  20971. * }
  20972. * }
  20973. * ```
  20974. */
  20975. _destruct(): void;
  20976. /**
  20977. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  20978. */
  20979. _destroyImmediate(): void;
  20980. }
  20981. export namespace CCObject {
  20982. export enum Flags {
  20983. Destroyed,
  20984. /**
  20985. * @en The object will not be saved.
  20986. * @zh 该对象将不会被保存。
  20987. */
  20988. DontSave,
  20989. /**
  20990. * @en The object will not be saved when building a player.
  20991. * @zh 构建项目时,该对象将不会被保存。
  20992. */
  20993. EditorOnly,
  20994. Dirty,
  20995. /**
  20996. * @en Dont destroy automatically when loading a new scene.
  20997. * @zh 加载一个新场景时,不自动删除该对象。
  20998. * @private
  20999. */
  21000. DontDestroy,
  21001. /**
  21002. * @en
  21003. * @zh
  21004. * @private
  21005. */
  21006. PersistentMask,
  21007. /**
  21008. * @en
  21009. * @zh
  21010. * @private
  21011. */
  21012. Destroying,
  21013. /**
  21014. * @en The node is deactivating.
  21015. * @zh 节点正在反激活的过程中。
  21016. * @private
  21017. */
  21018. Deactivating,
  21019. /**
  21020. * @en
  21021. * Hide in game and hierarchy.
  21022. * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
  21023. * @zh
  21024. * 在游戏和层级中隐藏该对象。<br/>
  21025. * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
  21026. */
  21027. /**
  21028. * @en The lock node, when the node is locked, cannot be clicked in the scene.
  21029. * @zh 锁定节点,锁定后场景内不能点击。
  21030. * @private
  21031. */
  21032. LockedInEditor,
  21033. /**
  21034. * @en Hide the object in editor.
  21035. * @zh 在编辑器中隐藏该对象。
  21036. */
  21037. HideInHierarchy,
  21038. /**
  21039. * @en The object will not be saved and hide the object in editor,and lock node, when the node is locked,
  21040. * cannot be clicked in the scene,and The object will not be saved when building a player.
  21041. * @zh 该对象将不会被保存,构建项目时,该对象将不会被保存, 锁定节点,锁定后场景内不能点击, 在编辑器中隐藏该对象。
  21042. */
  21043. AllHideMasks,
  21044. /**
  21045. * @en
  21046. * Hide in game view, hierarchy, and scene view... etc.
  21047. * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
  21048. * @zh
  21049. * 在游戏视图,层级,场景视图等等...中隐藏该对象。
  21050. * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
  21051. */
  21052. IsPreloadStarted,
  21053. IsOnLoadStarted,
  21054. IsOnLoadCalled,
  21055. IsOnEnableCalled,
  21056. IsStartCalled,
  21057. IsEditorOnEnableCalled,
  21058. IsPositionLocked,
  21059. IsRotationLocked,
  21060. IsScaleLocked,
  21061. IsAnchorLocked,
  21062. IsSizeLocked
  21063. }
  21064. export let __props__: string[];
  21065. export let __values__: string[];
  21066. }
  21067. /**
  21068. * @en
  21069. * Indicates that the editor should treat this property or array element as an Integer value.
  21070. * @zh
  21071. * 指定编辑器以整数形式对待该属性或数组元素。
  21072. * @example
  21073. * ```ts
  21074. * import { CCInteger, _decorator } from "cc";
  21075. *
  21076. * // in the class definition:
  21077. *
  21078. * @_decorator.property({type: CCInteger})
  21079. * count = 0;
  21080. *
  21081. * @_decorator.property({type: [CCInteger]})
  21082. * array = [];
  21083. * ```
  21084. */
  21085. export const CCInteger: __private._cocos_core_data_utils_attribute__PrimitiveType<number>;
  21086. /**
  21087. * @en
  21088. * Indicates that the editor should treat this property or array element as a Float value.
  21089. * @zh
  21090. * 指定编辑器以浮点数形式对待该属性或数组元素。
  21091. * @example
  21092. * ```ts
  21093. * import { CCFloat, _decorator } from "cc";
  21094. *
  21095. * // in the class definition:
  21096. *
  21097. * @_decorator.property({type: CCFloat})
  21098. * x = 0;
  21099. *
  21100. * @_decorator.property({type: [CCFloat]})
  21101. * array = [];
  21102. * ```
  21103. */
  21104. export const CCFloat: __private._cocos_core_data_utils_attribute__PrimitiveType<number>;
  21105. /**
  21106. * @en
  21107. * Indicates that the editor should treat this property or array element as a Boolean value.
  21108. * @zh
  21109. * 指定编辑器以布尔值形式对待该属性或数组元素。
  21110. *
  21111. * @example
  21112. * ```ts
  21113. * import { CCBoolean, _decorator } from "cc";
  21114. * // in the class definition
  21115. * @_decorator.property({type: CCBoolean})
  21116. * isTrue = false;
  21117. *
  21118. * @_decorator.property({type: [CCBoolean]})
  21119. * array = [];
  21120. * ```
  21121. */
  21122. export const CCBoolean: __private._cocos_core_data_utils_attribute__PrimitiveType<boolean>;
  21123. /**
  21124. * @en
  21125. * Indicates that the editor should treat this property or array element as a String value.
  21126. * @zh
  21127. * 指定编辑器以字符串形式对待该属性或数组元素。
  21128. * @example
  21129. * ```ts
  21130. * import { CCString, _decorator } from "cc";
  21131. *
  21132. * // in the class definition
  21133. *
  21134. * @_decorator.property({type: CCString})
  21135. * name = '';
  21136. *
  21137. * @_decorator.property({type: [CCString]})
  21138. * array = [];
  21139. * ```
  21140. */
  21141. export const CCString: __private._cocos_core_data_utils_attribute__PrimitiveType<string>;
  21142. /**
  21143. * @deprecated Since V3.5.0.
  21144. */
  21145. export class CompactValueTypeArray {
  21146. static StorageUnit: typeof __private._cocos_core_data_utils_compact_value_type_array__StorageUnit;
  21147. static ElementType: typeof __private._cocos_core_data_utils_compact_value_type_array__ElementType;
  21148. /**
  21149. * Returns the length in bytes that a buffer needs to encode the specified value array in form of CVTA.
  21150. * @param values The value array.
  21151. * @param unit Target element type.
  21152. */
  21153. static lengthFor(values: any[], elementType: __private._cocos_core_data_utils_compact_value_type_array__ElementType, unit: __private._cocos_core_data_utils_compact_value_type_array__StorageUnit): number;
  21154. /**
  21155. * Compresses the specified value array in form of CVTA into target buffer.
  21156. * @param values The value array.
  21157. * @param unit Target element type.
  21158. * @param arrayBuffer Target buffer.
  21159. * @param byteOffset Offset into target buffer.
  21160. */
  21161. static compress(values: any[], elementType: __private._cocos_core_data_utils_compact_value_type_array__ElementType, unit: __private._cocos_core_data_utils_compact_value_type_array__StorageUnit, arrayBuffer: ArrayBuffer, byteOffset: number, presumedByteOffset: number): CompactValueTypeArray;
  21162. /**
  21163. * Decompresses this CVTA.
  21164. * @param arrayBuffer The buffer this CVTA stored in.
  21165. */
  21166. decompress<T>(arrayBuffer: ArrayBuffer): T[];
  21167. }
  21168. /**
  21169. * Tag to visit editor extras of an object. Never be concerned about its value, please.
  21170. */
  21171. export const editorExtrasTag = "__editorExtras__";
  21172. /**
  21173. * Tag to define the custom deserialization method.
  21174. * @internal
  21175. */
  21176. export const deserializeTag: unique symbol;
  21177. /**
  21178. * Tag to define the custom serialization method.
  21179. * @internal
  21180. */
  21181. export const serializeTag: unique symbol;
  21182. export interface SerializationInput {
  21183. /**
  21184. * Reads a property from the input.
  21185. * @param name Property name.
  21186. * @returns The property's value, after deserialized.
  21187. */
  21188. readProperty(name: string): unknown;
  21189. /**
  21190. * Deserializes this object according to the original procedure.
  21191. */
  21192. readThis(): void;
  21193. /**
  21194. * Deserializes super according to the original procedure.
  21195. */
  21196. readSuper(): void;
  21197. }
  21198. export interface SerializationOutput {
  21199. /**
  21200. * Writes a property into output.
  21201. * @param name Property name.
  21202. * @param value Property value.
  21203. */
  21204. writeProperty(name: string, value: unknown): void;
  21205. /**
  21206. * Serialize this object according to the original procedure.
  21207. */
  21208. writeThis(): void;
  21209. /**
  21210. * Serialize super according to the original procedure.
  21211. */
  21212. writeSuper(): void;
  21213. }
  21214. export type SerializationContext = {
  21215. /**
  21216. * The main serializing asset or root node in the scene/prefab passed to the serialization procedure.
  21217. */
  21218. root: unknown;
  21219. /**
  21220. * True if the serialization procedure is targeting CCON.
  21221. */
  21222. toCCON: boolean;
  21223. /**
  21224. * Customized arguments passed to serialization procedure.
  21225. */
  21226. customArguments: Record<PropertyKey, unknown>;
  21227. };
  21228. export interface CustomSerializable {
  21229. [serializeTag](output: SerializationOutput, context: SerializationContext): void;
  21230. [deserializeTag]?(input: SerializationInput, context: __private._cocos_core_data_custom_serializable__DeserializationContext): void;
  21231. }
  21232. /**
  21233. * @internal DO NOT USE IT IN YOUR CODES.
  21234. * @param constructor
  21235. * @returns
  21236. */
  21237. export function getSerializationMetadata(constructor: Function): SerializationMetadata | undefined;
  21238. /**
  21239. * @internal For internal usage only. DO NOT USE IT IN YOUR CODES.
  21240. */
  21241. export interface SerializationMetadata {
  21242. uniquelyReferenced?: boolean;
  21243. }
  21244. /**
  21245. * @en
  21246. * EventTarget is an object to which an event is dispatched when something has occurred.
  21247. * [[Node]]s are the most common event targets, but other objects can be event targets too.
  21248. * If a class cannot extend from EventTarget, it can consider using [[Eventify]].
  21249. *
  21250. * @zh
  21251. * 事件目标是具有注册监听器、派发事件能力的类,[[Node]] 是最常见的事件目标,
  21252. * 但是其他类也可以继承自事件目标以获得管理监听器和派发事件的能力。
  21253. * 如果无法继承自 EventTarget,也可以使用 [[Eventify]]
  21254. */
  21255. export const EventTarget: new (...args: any[]) => __private._cocos_core_event_event_target__Empty & __private._cocos_core_event_eventify__IEventified;
  21256. export type EventTarget = InstanceType<typeof EventTarget>;
  21257. /**
  21258. * @en Generate a new class from the given base class, after polyfill all functionalities in [[IEventified]] as if it's extended from [[EventTarget]]
  21259. * @zh 生成一个类,该类继承自指定的基类,并以和 [[EventTarget]] 等同的方式实现了 [[IEventified]] 的所有接口。
  21260. * @param base The base class
  21261. * @example
  21262. * ```ts
  21263. * class Base { say() { console.log('Hello!'); } }
  21264. * class MyClass extends Eventify(Base) { }
  21265. * function (o: MyClass) {
  21266. * o.say(); // Ok: Extend from `Base`
  21267. * o.emit('sing', 'The ghost'); // Ok: `MyClass` implements IEventified
  21268. * }
  21269. * ```
  21270. */
  21271. export function Eventify<TBase>(base: __private._cocos_core_event_eventify__Constructor<TBase>): __private._cocos_core_event_eventify__Constructor<TBase & __private._cocos_core_event_eventify__IEventified>;
  21272. /**
  21273. * @zh
  21274. * Async Delegate 用于支持异步回调的代理,你可以新建一个异步代理,并注册异步回调,等到对应的时机触发代理事件。
  21275. *
  21276. * @en
  21277. * Async Delegate is a delegate that supports asynchronous callbacks.
  21278. * You can create a new AsyncDelegate, register the asynchronous callback, and wait until the corresponding time to dispatch the event.
  21279. *
  21280. * @example
  21281. * ```ts
  21282. * const ad = new AsyncDelegate();
  21283. * ad.add(() => {
  21284. * return new Promise((resolve, reject) => {
  21285. * setTimeout(() => {
  21286. * console.log('hello world');
  21287. * resolve();
  21288. * }, 1000);
  21289. * })
  21290. * });
  21291. * await ad.dispatch();
  21292. * ```
  21293. */
  21294. export class AsyncDelegate<T extends (...args: any) => (Promise<void> | void) = () => (Promise<void> | void)> {
  21295. /**
  21296. * @en
  21297. * Add an async callback or sync callback.
  21298. *
  21299. * @zh
  21300. * 添加一个异步回调或同步回调。
  21301. *
  21302. * @param callback
  21303. * @en The callback to add, and will be invoked when this delegate is dispatching.
  21304. * @zh 要添加的回调,并将在该委托调度时被调用。
  21305. */
  21306. add(callback: T): void;
  21307. /**
  21308. * @zh
  21309. * 查询是否已注册某个回调。
  21310. * @en
  21311. * Queries if a callback has been registered.
  21312. *
  21313. * @param callback @en The callback to query. @zh 要查询的回调函数。
  21314. * @returns @en Whether the callback has been added. @zh 是否已经添加了回调。
  21315. */
  21316. hasListener(callback: T): boolean;
  21317. /**
  21318. * @en
  21319. * Remove the specific callback of this delegate.
  21320. *
  21321. * @zh
  21322. * 移除此代理中某个具体的回调。
  21323. *
  21324. * @param callback @en The callback to remove. @zh 要移除的某个回调。
  21325. */
  21326. remove(callback: T): void;
  21327. /**
  21328. * @en
  21329. * Dispatching the delegate event. This function will trigger all previously registered callbacks and does not guarantee execution order.
  21330. *
  21331. * @zh
  21332. * 派发代理事件。此函数会触发所有之前注册的回调,并且不保证执行顺序。
  21333. *
  21334. * @param args @en The parameters to be transferred to callback. @zh 传递给回调函数的参数。
  21335. * @returns @en The promise awaiting all async callback resolved. @zh 等待所有异步回调结束的 Promise 对象。
  21336. */
  21337. dispatch(...args: Parameters<T>): Promise<void[]>;
  21338. }
  21339. /**
  21340. * @en Outputs a message at the "debug" log level.
  21341. * @zh 输出一条“调试”日志等级的消息。
  21342. * @param data @zh 输出的消息对象。 @en The output message object.
  21343. */
  21344. export function debug(...data: unknown[]): void;
  21345. /**
  21346. * @en Outputs a log message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
  21347. * @zh 向控制台输出一条日志信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
  21348. */
  21349. export function log(...data: unknown[]): void;
  21350. /**
  21351. * @en
  21352. * Outputs an error message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
  21353. * - In Cocos Creator, error is red.<br/>
  21354. * - In Chrome, error have a red icon along with red message text.<br/>
  21355. * @zh
  21356. * 向控制台输出一条错误信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
  21357. * - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
  21358. * - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
  21359. */
  21360. export function error(...data: unknown[]): void;
  21361. /**
  21362. * @en
  21363. * Outputs a warning message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
  21364. * - In Cocos Creator, warning is yellow.
  21365. * - In Chrome, warning have a yellow warning icon with the message text.
  21366. * @zh
  21367. * 向控制台输出一条警告信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
  21368. * - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
  21369. * - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
  21370. */
  21371. export function warn(...data: unknown[]): void;
  21372. /**
  21373. * @en
  21374. * Assert the condition and output error messages if the condition is not true.
  21375. * @zh
  21376. * 对检查测试条件进行检查,如果条件不为 true 则输出错误消息
  21377. * @param condition @zh 需要检查的条件。 @en The condition to check on.
  21378. * @param message @zh 包含零个或多个需要替换的JavaScript字符串。@en JavaScript objects to replace substitution strings in msg.
  21379. * @param optionalParams @zh 用来替换在message中需要替换的JavaScript对象。@en JavaScript objects with which to replace substitution strings within msg.
  21380. * This gives you additional control over the format of the output.
  21381. */
  21382. export function assert(condition: boolean, message?: string, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): asserts condition;
  21383. export function logID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
  21384. export function errorID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
  21385. export function warnID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
  21386. export function assertID(condition: boolean, id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
  21387. /**
  21388. * @en Returns whether or not to display the FPS and debug information.
  21389. * @zh 是否显示 FPS 信息和部分调试信息。
  21390. * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.isShowingStates。@en Since v3.6, Please use profiler.isShowingStates instead.
  21391. */
  21392. export function isDisplayStats(): boolean;
  21393. /**
  21394. * @en Sets whether display the FPS and debug informations on the bottom-left corner.
  21395. * @zh 设置是否在左下角显示 FPS 和部分调试。
  21396. * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.showStats。@en Since v3.6, Please use profiler.showStats instead.
  21397. */
  21398. export function setDisplayStats(displayStats: boolean): void;
  21399. /**
  21400. * @en Gets error message with the error id and possible parameters.
  21401. * @zh 通过 error id 和必要的参数来获取错误信息。
  21402. * @param errorId @zh 错误的ID。@en Error id.
  21403. * @param param @zh 输出日志。@en Output log.
  21404. */
  21405. export function getError(errorId: number, ...param: __private._cocos_core_platform_debug__StringSubstitution[]): string;
  21406. /**
  21407. * @en Enum for debug modes.
  21408. * @zh 调试模式。
  21409. */
  21410. export enum DebugMode {
  21411. /**
  21412. * @en The debug mode none.
  21413. * @zh 禁止模式,禁止显示任何日志消息。
  21414. */
  21415. NONE = 0,
  21416. /**
  21417. * @en The debug mode none.
  21418. * @zh 调试模式,显示所有日志消息。
  21419. */
  21420. VERBOSE = 1,
  21421. /**
  21422. * @en Information mode, which display messages with level higher than "information" level.
  21423. * @zh 信息模式,显示“信息”级别以上的日志消息。
  21424. */
  21425. INFO = 2,
  21426. /**
  21427. * @en Information mode, which display messages with level higher than "warning" level.
  21428. * @zh 警告模式,显示“警告”级别以上的日志消息。
  21429. */
  21430. WARN = 3,
  21431. /**
  21432. * @en Information mode, which display only messages with "error" level.
  21433. * @zh 错误模式,仅显示“错误”级别的日志消息。
  21434. */
  21435. ERROR = 4,
  21436. /**
  21437. * @en The debug mode info for web page.
  21438. * @zh 信息模式(仅 WEB 端有效),在画面上输出所有信息。
  21439. */
  21440. INFO_FOR_WEB_PAGE = 5,
  21441. /**
  21442. * @en The debug mode warn for web page.
  21443. * @zh 警告模式(仅 WEB 端有效),在画面上输出 warn 级别以上的(包含 error)信息。
  21444. */
  21445. WARN_FOR_WEB_PAGE = 6,
  21446. /**
  21447. * @en The debug mode error for web page.
  21448. * @zh 错误模式(仅 WEB 端有效),在画面上输出 error 信息。
  21449. */
  21450. ERROR_FOR_WEB_PAGE = 7
  21451. }
  21452. export const screen: Screen;
  21453. /**
  21454. * @en The screen API provides an easy way to do some screen managing stuff.
  21455. * @zh screen 单例对象提供简单的方法来做屏幕管理相关的工作。
  21456. */
  21457. export class Screen {
  21458. /**
  21459. * @internal
  21460. */
  21461. init(): void;
  21462. /**
  21463. * @en the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device
  21464. * NOTE: For performance reasons, the engine will limit the maximum value of DPR on some platforms.
  21465. * This property returns the DPR after the engine limit.
  21466. * @zh 当前显示设备的物理像素分辨率与 CSS 像素分辨率之比。
  21467. * 注意:出于性能考虑,引擎在一些平台会限制 DPR 的最高值,这个属性返回的是引擎限制后的 DPR。
  21468. */
  21469. get devicePixelRatio(): number;
  21470. /**
  21471. * @en Get and set the size of current window in physical pixels.
  21472. * NOTE:
  21473. * - Setting window size is only supported on Web platform for now.
  21474. * - On Web platform, if the ContainerStrategy is PROPORTIONAL_TO_FRAME, we set windowSize on game frame,
  21475. * and get windowSize from the game container after adaptation.
  21476. * @zh 获取和设置当前窗口的物理像素尺寸。
  21477. * 注意
  21478. * - 设置窗口尺寸目前只在 Web 平台上支持。
  21479. * - Web 平台上,如果 ContainerStrategy 为 PROPORTIONAL_TO_FRAME, 则设置 windowSize 作用于 game frame, 而从适配之后 game container 尺寸获取 windowSize.
  21480. */
  21481. get windowSize(): math.Size;
  21482. set windowSize(size: math.Size);
  21483. /**
  21484. * @en Get the current resolution of game.
  21485. * This is a readonly property.
  21486. * @zh 获取当前游戏的分辨率。
  21487. * 这是一个只读属性。
  21488. *
  21489. * @readonly
  21490. */
  21491. get resolution(): math.Size;
  21492. /**
  21493. * @en Whether it supports full screen.
  21494. * @zh 是否支持全屏。
  21495. * @returns {Boolean}
  21496. */
  21497. get supportsFullScreen(): boolean;
  21498. /**
  21499. * @en Return true if it's in full screen state now.
  21500. * @zh 当前是否处在全屏状态下。
  21501. * @returns {boolean}
  21502. */
  21503. fullScreen(): boolean;
  21504. /**
  21505. * @en Request to enter full screen mode with the given element.
  21506. * Many browsers forbid to enter full screen mode without an user intended interaction.
  21507. * If failed to request fullscreen, another attempt will be made to request fullscreen the next time a user interaction occurs.
  21508. * @zh 尝试使当前节点进入全屏模式,很多浏览器不允许程序触发这样的行为,必须在一个用户交互回调中才会生效。
  21509. * 如果进入全屏失败,会在下一次用户发生交互时,再次尝试进入全屏。
  21510. * @param element @zh 请求全屏状态的html元素。 @en The element to request full screen state.
  21511. * @param onFullScreenChange @zh 全屏状态改变的回调函数。 @en callback function when full screen state changed.
  21512. * @param onFullScreenError @zh 全屏错误的回调函数。 @en callback function when full screen error.
  21513. * @return {Promise|undefined}
  21514. * @deprecated since v3.3, please use `screen.requestFullScreen(): Promise<void>` instead.
  21515. */
  21516. requestFullScreen(element: HTMLElement, onFullScreenChange?: (this: Document, ev: any) => any, onFullScreenError?: (this: Document, ev: any) => any): Promise<any> | undefined;
  21517. /**
  21518. * @en Request to enter full screen mode.
  21519. * Many browsers forbid to enter full screen mode without an user intended interaction.
  21520. * If failed to request fullscreen, another attempt will be made to request fullscreen the next time a user interaction occurs.
  21521. * @zh 尝试使当前屏幕进入全屏模式,很多浏览器不允许程序触发这样的行为,必须在一个用户交互回调中才会生效。
  21522. * 如果进入全屏失败,会在下一次用户发生交互时,再次尝试进入全屏。
  21523. * @param element @zh 请求全屏状态的html元素。 @en The element to request full screen state.
  21524. * @param onFullScreenChange @zh 全屏状态改变的回调函数。 @en callback function when full screen state changed.
  21525. * @param onFullScreenError @zh 全屏错误的回调函数。 @en callback function when full screen error.
  21526. * @return {Promise}
  21527. */
  21528. requestFullScreen(): Promise<void>;
  21529. /**
  21530. * @en Exit the full mode.
  21531. * @zh 退出全屏模式。
  21532. * @return {Promise}
  21533. */
  21534. exitFullScreen(): Promise<any>;
  21535. /**
  21536. * @en Automatically request full screen during the next touch/click event.
  21537. * @zh 自动监听触摸、鼠标事件并在下一次事件触发时尝试进入全屏模式。
  21538. * @param element @zh 请求全屏状态的html元素。 @en The element to request full screen state.
  21539. * @param onFullScreenChange @zh 全屏状态改变的回调函数。 @en callback function when full screen state changed.
  21540. *
  21541. * @deprecated since v3.3, please use screen.requestFullScreen() instead.
  21542. */
  21543. autoFullScreen(element: HTMLElement, onFullScreenChange: (this: Document, ev: any) => any): void;
  21544. /**
  21545. * @param element
  21546. * @deprecated since v3.3
  21547. */
  21548. disableAutoFullScreen(element: any): void;
  21549. /**
  21550. * @en
  21551. * Register screen event callback.
  21552. * @zh
  21553. * 注册screen事件回调。
  21554. */
  21555. on(type: __private._pal_screen_adapter_enum_type_screen_event__PalScreenEvent, callback: (...args: any) => void, target?: any): void;
  21556. /**
  21557. * @en
  21558. * Register a callback of a specific screen event type once.
  21559. * @zh
  21560. * 注册单次的screen事件回调。
  21561. */
  21562. once(type: __private._pal_screen_adapter_enum_type_screen_event__PalScreenEvent, callback: (...args: any) => void, target?: any): void;
  21563. /**
  21564. * @en
  21565. * Unregister screen event callback.
  21566. * @zh
  21567. * 取消注册screen事件回调。
  21568. */
  21569. off(type: __private._pal_screen_adapter_enum_type_screen_event__PalScreenEvent, callback?: (...args: any) => void, target?: any): void;
  21570. }
  21571. /**
  21572. * @en A set of system related variables.
  21573. * @zh 一系列系统相关环境变量。
  21574. */
  21575. export const sys: {
  21576. Feature: typeof __private._pal_system_info_enum_type_feature__Feature;
  21577. /**
  21578. * @en
  21579. * Returns if the specified platform related feature is supported.
  21580. * @zh
  21581. * 返回指定的平台相关的特性是否支持。
  21582. * @param feature @zh 系统的特性。 @en Feature of the system.
  21583. */
  21584. hasFeature(feature: sys.Feature): boolean;
  21585. /**
  21586. * @en
  21587. * Network type enumeration.
  21588. * @zh
  21589. * 网络类型枚举。
  21590. */
  21591. NetworkType: typeof __private._pal_system_info_enum_type_network_type__NetworkType;
  21592. /**
  21593. * @en
  21594. * LanguageCode type enumeration.
  21595. * @zh
  21596. * 语言码类型枚举。
  21597. */
  21598. Language: typeof __private._pal_system_info_enum_type_language__Language;
  21599. /**
  21600. * @en
  21601. * OS type enumeration.
  21602. * @zh
  21603. * 操作系统类型枚举。
  21604. */
  21605. OS: typeof __private._pal_system_info_enum_type_operating_system__OS;
  21606. /**
  21607. * @en
  21608. * Platform type enumeration.
  21609. * @zh
  21610. * 平台类型枚举。
  21611. */
  21612. Platform: typeof __private._pal_system_info_enum_type_platform__Platform;
  21613. /**
  21614. * @en
  21615. * Browser type enumeration.
  21616. * @zh
  21617. * 浏览器类型枚举。
  21618. */
  21619. BrowserType: typeof __private._pal_system_info_enum_type_browser_type__BrowserType;
  21620. /**
  21621. * @en Whether the running platform is native app.
  21622. * @zh 指示运行平台是否是原生平台。
  21623. */
  21624. isNative: boolean;
  21625. /**
  21626. * @en Whether the running platform is browser.
  21627. * @zh 指示运行平台是否是浏览器。
  21628. */
  21629. isBrowser: boolean;
  21630. /**
  21631. * @en Indicate whether the current running context is a mobile system.
  21632. * @zh 指示当前运行平台是否是移动端平台。
  21633. */
  21634. isMobile: boolean;
  21635. /**
  21636. * @en Whether the endianness of current platform is little endian.
  21637. * @zh 当前平台字节顺序是否是小端序。
  21638. */
  21639. isLittleEndian: boolean;
  21640. /**
  21641. * @en The running platform.
  21642. * @zh 当前运行平台或环境。
  21643. */
  21644. platform: __private._pal_system_info_enum_type_platform__Platform;
  21645. /**
  21646. * @en Indicate the current language of the running system.
  21647. * @zh 指示当前运行环境的语言。
  21648. */
  21649. language: __private._pal_system_info_enum_type_language__Language;
  21650. /**
  21651. * @en
  21652. * Get current language iso 639-1 code.
  21653. * Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc.
  21654. * The actual value totally depends on results provided by destination platform.
  21655. * @zh
  21656. * 指示当前运行环境的语言
  21657. * 获取当前的语言iso 639-1代码。
  21658. * 有效的语言代码包括 "zh-tw"、"en"、"en-us"、"fr"、"fr-fr"、"es-es "等。
  21659. * 实际值完全取决于目的地平台提供的结果。
  21660. */
  21661. languageCode: string;
  21662. /**
  21663. * @en Indicate the running os name.
  21664. * @zh 指示当前运行系统。
  21665. */
  21666. os: __private._pal_system_info_enum_type_operating_system__OS;
  21667. /**
  21668. * @en Indicate the running os version string.
  21669. * @zh 指示当前运行系统版本字符串。
  21670. */
  21671. osVersion: string;
  21672. /**
  21673. * @en Indicate the running os main version.
  21674. * @zh 指示当前系统主版本。
  21675. */
  21676. osMainVersion: number;
  21677. /**
  21678. * @en Indicate the running browser type.
  21679. * @zh 指示当前运行的浏览器类型。
  21680. */
  21681. browserType: __private._pal_system_info_enum_type_browser_type__BrowserType;
  21682. /**
  21683. * @en Indicate the running browser version.
  21684. * @zh 指示当前运行的浏览器版本。
  21685. */
  21686. browserVersion: string;
  21687. /**
  21688. * @en Whether the running platform is xr app.
  21689. * @zh 指示运行平台是否是XR平台。
  21690. */
  21691. isXR: boolean;
  21692. /**
  21693. * @en Indicate the real pixel resolution of the whole game window.
  21694. * @zh 指示游戏窗口的像素分辨率。
  21695. *
  21696. * @deprecated since v3.4.0, please use screen.windowSize instead.
  21697. */
  21698. windowPixelResolution: math.Size;
  21699. /**
  21700. * @en The capabilities of the current platform.
  21701. * @zh 当前平台的功能可用性。
  21702. *
  21703. * @deprecated since v3.4.0, please use sys.hasFeature() instead.
  21704. */
  21705. capabilities: {
  21706. canvas: boolean;
  21707. opengl: boolean;
  21708. webp: boolean;
  21709. imageBitmap: boolean;
  21710. touches: boolean;
  21711. mouse: boolean;
  21712. keyboard: boolean;
  21713. accelerometer: boolean;
  21714. };
  21715. /**
  21716. * @en It is a local storage component based on HTML5 localStorage API, on web platform, it's equal to window.localStorage.
  21717. * @zh HTML5 标准中的 localStorage 的本地存储功能,在 Web 端等价于 window.localStorage。
  21718. */
  21719. localStorage: any;
  21720. /**
  21721. * @en Get the network type of current device, return `sys.NetworkType.LAN` if failure.
  21722. * @zh 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 `sys.NetworkType.LAN`。
  21723. * @return @zh 返回 LAN 或 WWAN。 @en LAN or WWAN.
  21724. */
  21725. getNetworkType(): __private._pal_system_info_enum_type_network_type__NetworkType;
  21726. /**
  21727. * @en Get the battery level of current device, return 1.0 if failure.
  21728. * @zh 获取当前设备的电池电量,如果电量无法获取,默认将返回 1。
  21729. * @return - 0.0 ~ 1.0
  21730. */
  21731. getBatteryLevel(): number;
  21732. /**
  21733. * @en Forces the garbage collection, only available in native platforms.
  21734. * @zh 强制进行 JS 内存垃圾回收,尽在原生平台有效。
  21735. */
  21736. garbageCollect(): void;
  21737. /**
  21738. * @en Check whether an object is valid,
  21739. * In web engine, it will return true if the object exist
  21740. * In native engine, it will return true if the JS object and the correspond native object are both valid
  21741. * @zh 检查一个对象是否非空或在原生平台有效,
  21742. * 在 Web 平台,只要对象非空或非 Undefined 就会返回 true,在原生平台,我们会检查当前 JS 对象和其绑定的原生对象是否都有效。
  21743. * @param obj @zh 校验的对象。@en The object to be checked.
  21744. */
  21745. isObjectValid(obj: any): boolean;
  21746. /**
  21747. * @en Dump systemInfo informations.
  21748. * @zh 在控制台打印当前的主要系统信息。
  21749. */
  21750. dump(): void;
  21751. /**
  21752. * @en Try to open a url in browser, may not work in some platforms.
  21753. * @zh 尝试打开一个 web 页面,并非在所有平台都有效。
  21754. * @param url @zh 访问的链接。 @en Visited links.
  21755. */
  21756. openURL(url: string): void;
  21757. /**
  21758. * @en Get the current time in milliseconds.
  21759. * @zh 获取当前时间(毫秒为单位)。
  21760. */
  21761. now(): number;
  21762. /**
  21763. * @en Restart the JS VM, only available in native platforms.
  21764. * @zh 重启JS虚拟机,仅仅在原生平台有效。
  21765. * @private
  21766. */
  21767. restartVM(): void;
  21768. /**
  21769. * @en
  21770. * Returns the safe area of the screen (in design resolution) based on the game view coordinate system.
  21771. * If the screen is not notched, this method returns a Rect of the same size as visibleSize by default.
  21772. * Currently supports Android, iOS and WeChat, ByteDance Mini Game platform.
  21773. * @zh
  21774. * 返回基于游戏视图坐标系的手机屏幕安全区域(设计分辨率为单位),如果不是异形屏将默认返回一个和 visibleSize 一样大的 Rect。
  21775. * 目前支持安卓、iOS 原生平台和微信、字节小游戏平台。
  21776. * @method getSafeAreaRect
  21777. * @return {Rect}
  21778. */
  21779. getSafeAreaRect(): math.Rect;
  21780. };
  21781. export namespace sys {
  21782. /**
  21783. * @en
  21784. * Platform related feature enum type.
  21785. * @zh
  21786. * 平台相关的特性枚举类型。
  21787. */
  21788. export type Feature = __private.__types_globals__EnumAlias<typeof __private._pal_system_info_enum_type_feature__Feature>;
  21789. }
  21790. export interface ISchedulable {
  21791. id?: string;
  21792. uuid?: string;
  21793. update?(dt: number): void;
  21794. }
  21795. /**
  21796. * @en
  21797. * Scheduler is responsible of triggering the scheduled callbacks.<br>
  21798. * You should not use NSTimer. Instead use this class.<br>
  21799. * <br>
  21800. * There are 2 different types of callbacks (selectors):<br>
  21801. * - update callback: the 'update' callback will be called every frame. You can customize the priority.<br>
  21802. * - custom callback: A custom callback will be called every frame, or with a custom interval of time.<br>
  21803. * <br>
  21804. * The 'custom selectors' should be avoided when possible. It is faster,<br>
  21805. * and consumes less memory to use the 'update callback'. *
  21806. * @zh
  21807. * Scheduler 是负责触发回调函数的类。<br>
  21808. * 通常情况下,建议使用 `director.getScheduler()` 来获取系统定时器。<br>
  21809. * 有两种不同类型的定时器:<br>
  21810. * - update 定时器:每一帧都会触发。您可以自定义优先级。<br>
  21811. * - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br>
  21812. * 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。
  21813. */
  21814. export class Scheduler extends System {
  21815. static ID: string;
  21816. /**
  21817. * @en This method should be called for any target which needs to schedule tasks, and this method should be called before any scheduler API usage.
  21818. * This method will add a `id` property if it doesn't exist.
  21819. * @zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  21820. * 这个方法会给对象添加一个 `id` 属性,如果这个属性不存在的话。
  21821. * @param target
  21822. * @en The target to enable, which type is ISchedulable.
  21823. * @zh 所作用的对象。类型为ISchedulable。
  21824. */
  21825. static enableForTarget(target: ISchedulable): void;
  21826. constructor();
  21827. /**
  21828. * @en
  21829. * Modifies the time of all scheduled callbacks.<br>
  21830. * You can use this property to create a 'slow motion' or 'fast forward' effect.<br>
  21831. * Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br>
  21832. * To create a 'fast forward' effect, use values higher than 1.0.<br>
  21833. * Note:It will affect EVERY scheduled selector / action.
  21834. * @zh
  21835. * 设置时间间隔的缩放比例。<br>
  21836. * 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br>
  21837. * 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br>
  21838. * 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br>
  21839. * 注意:它影响该 Scheduler 下管理的所有定时器。
  21840. * @param timeScale
  21841. */
  21842. setTimeScale(timeScale: number): void;
  21843. /**
  21844. * @en Returns time scale of scheduler.
  21845. * @zh 获取时间间隔的缩放比例。
  21846. */
  21847. getTimeScale(): number;
  21848. /**
  21849. * @en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  21850. * @zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  21851. * @param dt
  21852. * @en delta time. The unit is seconds.
  21853. * @zh 更新间隔时间, 单位是秒。
  21854. */
  21855. update(dt: number): void;
  21856. /**
  21857. * @en Specify the callback to schedule a new timer.
  21858. * If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
  21859. * @zh 指定回调函数来规划一个新的定时器。
  21860. * 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。
  21861. * @param callback
  21862. * @en The specified target.
  21863. * @zh 所指定的调用对象。
  21864. * @param target
  21865. * @en The scheduled method will be called every 'interval' seconds.
  21866. * If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.
  21867. * @zh 当时间间隔达到指定值时,设置的回调函数将会被调用。
  21868. * 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,建议使用 scheduleUpdateForTarget 代替。
  21869. * @param interval
  21870. * @en repeat let the action be repeated repeat + 1 times, use `macro.REPEAT_FOREVER` to let the action run continuously.
  21871. * @zh repeat 值可以让定时器触发 repeat + 1 次,使用 `macro.REPEAT_FOREVER` 可以让定时器一直循环触发。
  21872. * @param repeat
  21873. * @en delay is the amount of time the action will wait before it'll start. Unit: s.
  21874. * @zh delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时,单位: 秒。
  21875. * @param delay
  21876. * @en If paused is YES, then it won't be called until it is resumed.
  21877. * @zh 如果 paused 值为 true,那么直到 resume 被调用才开始计时。
  21878. * @param paused
  21879. */
  21880. schedule(callback: __private._cocos_core_scheduler__CallbackType, target: ISchedulable, interval: number, repeat?: number, delay?: number, paused?: boolean): void;
  21881. /**
  21882. * @en The specified target.
  21883. * @zh 所指定的调用对象。
  21884. * @param target
  21885. * @en Specify the callback to schedule a new timer.
  21886. * If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
  21887. * @zh 指定回调函数来规划一个新的定时器。
  21888. * 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。
  21889. * @param callback
  21890. * @en The scheduled method will be called every 'interval' seconds.
  21891. * If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.
  21892. * @zh 当时间间隔达到指定值时,设置的回调函数将会被调用。
  21893. * 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,建议使用 scheduleUpdateForTarget 代替。
  21894. * @param interval
  21895. * @en repeat let the action be repeated repeat + 1 times, use `macro.REPEAT_FOREVER` to let the action run continuously.
  21896. * @zh repeat 值可以让定时器触发 repeat + 1 次,使用 `macro.REPEAT_FOREVER` 可以让定时器一直循环触发。
  21897. * @param repeat
  21898. * @en delay is the amount of time the action will wait before it'll start. Unit: s.
  21899. * @zh delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时,单位: 秒。
  21900. * @param delay
  21901. * @en If paused is YES, then it won't be called until it is resumed.
  21902. * @zh 如果 paused 值为 true,那么直到 resume 被调用才开始计时。
  21903. * @param paused
  21904. *
  21905. * @deprecated since v3.8.0, please use `Scheduler.schedule(callback, target, interval)` instead.
  21906. */
  21907. schedule(target: ISchedulable, callback: __private._cocos_core_scheduler__CallbackType, interval: number, repeat?: number, delay?: number, paused?: boolean): void;
  21908. /**
  21909. * @en
  21910. * Schedules the update callback for a given target,
  21911. * During every frame after schedule started, the "update" function of target will be invoked.
  21912. * @zh
  21913. * 使用指定的优先级为指定的对象设置 update 定时器。<br>
  21914. * update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。<br>
  21915. * 优先级的值越低,定时器被触发的越早。
  21916. * @param target
  21917. * @en The target bound to the callback. @zh 回调所绑定的目标对象。
  21918. * @param priority
  21919. * @en The priority. @zh 优先级。
  21920. * @param paused
  21921. * @en Whether is paused. @zh 是否被暂停。
  21922. */
  21923. scheduleUpdate(target: ISchedulable, priority: number, paused: boolean): void;
  21924. /**
  21925. * @en
  21926. * Unschedule a callback for a callback and a given target.
  21927. * If you want to unschedule the "update", use `unscheduleUpdate()`
  21928. * @zh
  21929. * 取消指定对象定时器。
  21930. * 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  21931. * @param callback @en The callback to be unscheduled @zh 被取消调度的回调。
  21932. * @param target @en The target bound to the callback. @zh 回调所绑定的目标对象。
  21933. */
  21934. unschedule(callback: __private.__types_globals__AnyFunction, target: ISchedulable): void;
  21935. /**
  21936. * @en Unschedule the update callback for a given target.
  21937. * @zh 取消指定对象的 update 定时器。
  21938. * @param target The target to be unscheduled.
  21939. */
  21940. unscheduleUpdate(target: ISchedulable): void;
  21941. /**
  21942. * @en
  21943. * Unschedule all scheduled callbacks for a given target.
  21944. * This also includes the "update" callback.
  21945. * @zh 取消指定对象的所有定时器,包括 update 定时器。
  21946. * @param target The target to be unscheduled.
  21947. */
  21948. unscheduleAllForTarget(target: ISchedulable): void;
  21949. /**
  21950. * @en
  21951. * Unschedule all scheduled callbacks from all targets including the system callbacks.
  21952. * You should NEVER call this method, unless you know what you are doing.
  21953. * @zh
  21954. * 取消所有对象的所有定时器,包括系统定时器。
  21955. * 不要调用此函数,除非你确定你在做什么。
  21956. */
  21957. unscheduleAll(): void;
  21958. /**
  21959. * @en
  21960. * Unschedule all callbacks from all targets with a minimum priority.
  21961. * You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  21962. * @zh
  21963. * 取消所有优先级的值大于指定优先级的定时器。
  21964. * 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  21965. * @param minPriority
  21966. * @en The minimum priority of selector to be unscheduled.
  21967. * Which means, all selectors which priority is higher than minPriority will be unscheduled.
  21968. * @zh 要取消调度的选择器的最低优先级。
  21969. * 这意味着,所有优先级高于 minPriority 的选择器将被取消调度。
  21970. */
  21971. unscheduleAllWithMinPriority(minPriority: number): void;
  21972. /**
  21973. * @en Checks whether a callback for a given target is scheduled.
  21974. * @zh 检查指定的回调函数和回调对象组合是否存在定时器。
  21975. * @param callback @en The callback to check. @zh 指定检测的回调。
  21976. * @param target @en The target of the callback. @zh 回调的目标对象。
  21977. * @returns @en True if the specified callback is invoked, false if not. @zh 返回true如果指定回调被调用, 否则返回false。
  21978. */
  21979. isScheduled(callback: __private.__types_globals__AnyFunction, target: ISchedulable): boolean;
  21980. /**
  21981. * @en
  21982. * Pause all selectors from all targets.
  21983. * You should NEVER call this method, unless you know what you are doing.
  21984. * @zh
  21985. * 暂停所有对象的所有定时器。
  21986. * 不要调用这个方法,除非你知道你正在做什么。
  21987. */
  21988. pauseAllTargets(): ISchedulable[];
  21989. /**
  21990. * @en
  21991. * Pause all selectors from all targets with a minimum priority.
  21992. * You should only call this with kCCPriorityNonSystemMin or higher.
  21993. * @zh
  21994. * 暂停所有优先级的值大于指定优先级的定时器。
  21995. * 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  21996. * @param minPriority @en the minimum priority. @zn 最小优先级。
  21997. */
  21998. pauseAllTargetsWithMinPriority(minPriority: number): ISchedulable[];
  21999. /**
  22000. * @en
  22001. * Resume selectors on a set of targets.<br/>
  22002. * This can be useful for undoing a call to pauseAllCallbacks.
  22003. * @zh
  22004. * 恢复指定数组中所有对象的定时器。<br/>
  22005. * 这个函数是 pauseAllCallbacks 的逆操作。
  22006. * @param targetsToResume
  22007. */
  22008. resumeTargets(targetsToResume: ISchedulable[]): void;
  22009. /**
  22010. * @en
  22011. * Pauses the target.<br/>
  22012. * All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  22013. * If the target is not present, nothing happens.
  22014. * @zh
  22015. * 暂停指定对象的定时器。<br/>
  22016. * 指定对象的所有定时器都会被暂停。<br/>
  22017. * 如果指定的对象没有定时器,什么也不会发生。
  22018. * @param target
  22019. */
  22020. pauseTarget(target: ISchedulable): void;
  22021. /**
  22022. * @en
  22023. * Resumes the target.<br/>
  22024. * The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  22025. * If the target is not present, nothing happens.
  22026. * @zh
  22027. * 恢复指定对象的所有定时器。<br/>
  22028. * 指定对象的所有定时器将继续工作。<br/>
  22029. * 如果指定的对象没有定时器,什么也不会发生。
  22030. * @param target
  22031. */
  22032. resumeTarget(target: ISchedulable): void;
  22033. /**
  22034. * @en Returns whether or not the target is paused.
  22035. * @zh 返回指定对象的定时器是否处于暂停状态。
  22036. * @param target
  22037. */
  22038. isTargetPaused(target: ISchedulable): boolean;
  22039. }
  22040. /**
  22041. * @en
  22042. * Real curve.
  22043. *
  22044. * The real curve is a kind of keyframe curve.
  22045. * When evaluating a real curve:
  22046. * - If the input is just the time of a keyframe,
  22047. * keyframe value's numeric value is used as result.
  22048. * - Otherwise, if the input is less than the time of the first keyframe or
  22049. * is greater than the time of the last keyframe time, it performs so-called extrapolation.
  22050. * - Otherwise, the input falls between two keyframes and then it interpolates between the two keyframes.
  22051. *
  22052. * Every keyframe may specify an interpolation mode
  22053. * to indicates how to perform the interpolation
  22054. * from current keyframe to next keyframe.
  22055. * Interpolation modes of keyframes may differ from each other.
  22056. *
  22057. * Real curve allows three interpolation modes: constant, linear and cubic.
  22058. * The constant and linear mode is easy.
  22059. * In case of cubic interpolation,
  22060. * the interpolation algorithm is effectively equivalent to cubic bezier(or cubic hermite) interpolation.
  22061. *
  22062. * Related quantities related to cubic interpolation are:
  22063. * - Keyframe times and numeric values.
  22064. * - The tangent and tangent weight of the previous keyframe and next keyframe.
  22065. *
  22066. * While performing the cubic bezier interpolation,
  22067. * The first control point is calculated from right tangent and right tangent weight of previous keyframe,
  22068. * the second control point is calculated from left tangent and left tangent weight of next keyframe.
  22069. *
  22070. * In equivalent bezier representation,
  22071. * the tangent is the line slope between sample point and control point
  22072. * and the tangent weight is the distance between sample point and control point.
  22073. * The tangent weight on either side can be marked as "not specified" through tangent weight mode.
  22074. * If either side weight is not specified,
  22075. * the tangent weight is treated at `sqrt(d_t^2 + (d_t * tangent)^2) * (1 / 3)`
  22076. * where `d_t` is the difference between two keyframes 's time and `tangent` is the tangent of that side.
  22077. *
  22078. * Note, in some cases, tangent/tangent weight/tangent weight mode may be "meaningless".
  22079. * The meaningless means that value can may not be stored(or serialized).
  22080. * @zh
  22081. * 实数曲线。
  22082. *
  22083. * 实数曲线是关键帧曲线的一种。
  22084. * 在求值实数曲线时:
  22085. * - 若输入正好就是关键帧上的时间,关键帧上的数值就作为结果。
  22086. * - 否则,如果输入小于第一个关键帧上的时间或大于最后一个关键帧上的时间,它会进行所谓的外推。
  22087. * - 否则,输入落于两帧之间,将通过插值两帧得到结果。
  22088. *
  22089. * 每个关键帧都可以指定插值模式,
  22090. * 以表示从当前帧数值变化到下一帧数值所采用的插值算法,
  22091. * 每个关键帧的插值模式都可以是各不相同的。
  22092. *
  22093. * 实数曲线允许三种插值模式:常量、线性和三次方的(也称立方)。
  22094. * 常量和线性模式都比较简单。
  22095. * 在三次插值的情况下,插值算法实质上等价于三次贝塞尔(或三次埃尔米特)插值。
  22096. *
  22097. * 三次插值的相关量有:
  22098. * - 关键帧上的时间和数值;
  22099. * - 前一关键帧和后一关键帧上的切线和切线权重。
  22100. *
  22101. * 当两帧之间进行三次贝塞尔曲线插值时,
  22102. * 会取前一帧的右切线、右切线权重来计算出第一个控制点,
  22103. * 会取后一帧的左切线、左切线权重来计算出第二个控制点。
  22104. *
  22105. * 在等效的贝塞尔表示中,
  22106. * 切线就是样本点和控制点之间的切线斜率,而切线权重就是样本点和控制点之间的距离。
  22107. * 任意一端的切线权重都可以通过切线权重模式来标记为“未指定的”。
  22108. * 若任意一端的切线权重是未指定的,
  22109. * 此端上的切线权重将被视为 `sqrt(d_t^2 + (d_t * tangent)^2) * (1 / 3)`,其中,
  22110. * `d_t` 是两帧时间的差,`tangent` 是此端上的切线。
  22111. *
  22112. * 注意,切线/切线权重/切线权重模式在某些情况下可能是“无意义的”。
  22113. * 无意义意味着这些值可能不会被存储或序列化。
  22114. */
  22115. export class RealCurve extends __private._cocos_core_curves_keyframe_curve__KeyframeCurve<RealKeyframeValue> {
  22116. /**
  22117. * @en
  22118. * Gets or sets the pre-extrapolation-mode of this curve.
  22119. * Defaults to `ExtrapolationMode.CLAMP`.
  22120. * @zh
  22121. * 获取或设置此曲线的前向外推模式。
  22122. * 默认为 `ExtrapolationMode.CLAMP`。
  22123. */
  22124. preExtrapolation: ExtrapolationMode;
  22125. /**
  22126. * @en
  22127. * Gets or sets the post-extrapolation-mode of this curve.
  22128. * Defaults to `ExtrapolationMode.CLAMP`.
  22129. * @zh
  22130. * 获取或设置此曲线的后向外推模式。
  22131. * 默认为 `ExtrapolationMode.CLAMP`。
  22132. */
  22133. postExtrapolation: ExtrapolationMode;
  22134. /**
  22135. * @en
  22136. * Evaluates this curve at specified time.
  22137. * @zh
  22138. * 计算此曲线在指定时间上的值。
  22139. * @param time Input time.
  22140. * @returns Result value.
  22141. */
  22142. evaluate(time: number): number;
  22143. /**
  22144. * @en
  22145. * Adds a keyframe into this curve.
  22146. * @zh
  22147. * 添加一个关键帧到此曲线。
  22148. * @param time Time of the keyframe.
  22149. * @param value Value of the keyframe.
  22150. * @returns The index to the new keyframe.
  22151. */
  22152. addKeyFrame(time: number, value: __private._cocos_core_curves_curve__RealKeyframeValueParameters): number;
  22153. /**
  22154. * @en
  22155. * Assigns all keyframes.
  22156. * @zh
  22157. * 赋值所有关键帧。
  22158. * @param keyframes An iterable to keyframes. The keyframes should be sorted by their time.
  22159. */
  22160. assignSorted(keyframes: Iterable<[
  22161. number,
  22162. __private._cocos_core_curves_curve__RealKeyframeValueParameters
  22163. ]>): void;
  22164. /**
  22165. * Assigns all keyframes.
  22166. * @param times Times array. Should be sorted.
  22167. * @param values Values array. Corresponding to each time in `times`.
  22168. */
  22169. assignSorted(times: readonly number[], values: __private._cocos_core_curves_curve__RealKeyframeValueParameters[]): void;
  22170. /**
  22171. * @en
  22172. * Returns if this curve is constant.
  22173. * @zh
  22174. * 返回此曲线是否是常量曲线。
  22175. * @param tolerance The tolerance.
  22176. * @returns Whether it is constant.
  22177. */
  22178. isConstant(tolerance: number): boolean;
  22179. /**
  22180. * @internal
  22181. */
  22182. [serializeTag](output: SerializationOutput, context: SerializationContext): void;
  22183. /**
  22184. * @internal
  22185. */
  22186. [deserializeTag](input: SerializationInput, context: __private._cocos_core_data_custom_serializable__DeserializationContext): void;
  22187. }
  22188. /**
  22189. * @en
  22190. * The method used for interpolation method between value of a keyframe and its next keyframe.
  22191. * @zh
  22192. * 在某关键帧(前一帧)和其下一帧之间插值时使用的插值方式。
  22193. */
  22194. export enum RealInterpolationMode {
  22195. /**
  22196. * @en
  22197. * Perform linear interpolation between previous keyframe value and next keyframe value.
  22198. * @zh
  22199. * 在前一帧和后一帧之间执行线性插值。
  22200. */
  22201. LINEAR = 0,
  22202. /**
  22203. * @en
  22204. * Always use the value from this keyframe.
  22205. * @zh
  22206. * 永远使用前一帧的值。
  22207. */
  22208. CONSTANT = 1,
  22209. /**
  22210. * @en
  22211. * Perform cubic(hermite) interpolation between previous keyframe value and next keyframe value.
  22212. * @zh
  22213. * 在前一帧和后一帧之间执行立方插值。
  22214. */
  22215. CUBIC = 2
  22216. }
  22217. /**
  22218. * @en
  22219. * Specifies how to extrapolate the value
  22220. * if input time is underflow(less than the the first frame time) or
  22221. * overflow(greater than the last frame time) when evaluating an curve.
  22222. * @zh
  22223. * 在求值曲线时,指定当输入时间下溢(小于第一帧的时间)或上溢(大于最后一帧的时间)时应该如何推断结果值。
  22224. */
  22225. export enum ExtrapolationMode {
  22226. /**
  22227. * @en
  22228. * Compute the result
  22229. * according to the first two frame's linear trend in the case of underflow and
  22230. * according to the last two frame's linear trend in the case of overflow.
  22231. * If there are less than two frames, fallback to `CLAMP`.
  22232. * @zh
  22233. * 下溢时,根据前两帧的线性趋势计算结果;上溢时,根据最后两帧的线性趋势计算结果。
  22234. * 如果曲线帧数小于 2,回退到 `CLAMP`。
  22235. */
  22236. LINEAR = 0,
  22237. /**
  22238. * @en
  22239. * Use first frame's value in the case of underflow,
  22240. * use last frame's value in the case of overflow.
  22241. * @zh
  22242. * 下溢时,使用第一帧的值;上溢时,使用最后一帧的值。
  22243. */
  22244. CLAMP = 1,
  22245. /**
  22246. * @en
  22247. * Computes the result as if the curve is infinitely and continuously looped.
  22248. * @zh
  22249. * 求值时将该曲线视作是无限连续循环的。
  22250. */
  22251. LOOP = 2,
  22252. /**
  22253. * @en
  22254. * Computes the result as if the curve is infinitely and continuously looped in a ping-pong manner.
  22255. * @zh
  22256. * 求值时将该曲线视作是以“乒乓”的形式无限连续循环的。
  22257. */
  22258. PING_PONG = 3
  22259. }
  22260. /**
  22261. * @en
  22262. * Specifies both side tangent weight mode of a keyframe value.
  22263. * @zh
  22264. * 指定关键帧两侧的切线权重模式。
  22265. */
  22266. export enum TangentWeightMode {
  22267. /**
  22268. * @en
  22269. * Neither side of the keyframe carries tangent weight information.
  22270. * @zh
  22271. * 关键帧的两侧都不携带切线权重信息。
  22272. */
  22273. NONE = 0,
  22274. /**
  22275. * @en
  22276. * Only left side of the keyframe carries tangent weight information.
  22277. * @zh
  22278. * 仅关键帧的左侧携带切线权重信息。
  22279. */
  22280. LEFT = 1,
  22281. /**
  22282. * @en
  22283. * Only right side of the keyframe carries tangent weight information.
  22284. * @zh
  22285. * 仅关键帧的右侧携带切线权重信息。
  22286. */
  22287. RIGHT = 2,
  22288. /**
  22289. * @en
  22290. * Both sides of the keyframe carries tangent weight information.
  22291. * @zh
  22292. * 关键帧的两侧都携带切线权重信息。
  22293. */
  22294. BOTH = 3
  22295. }
  22296. /**
  22297. * @en View to a real frame value.
  22298. * Note, the view may be invalidated due to keyframe change/add/remove.
  22299. * @zh 实数帧值的视图。
  22300. * 注意,该视图可能因关键帧的添加、改变、移除而失效。
  22301. */
  22302. export class RealKeyframeValue extends __private._cocos_core_data_editor_extendable__EditorExtendable {
  22303. /**
  22304. * @en
  22305. * When perform interpolation, the interpolation method should be taken
  22306. * when for this keyframe is used as starting keyframe.
  22307. * @zh
  22308. * 在执行插值时,当以此关键帧作为起始关键帧时应当使用的插值方式。
  22309. */
  22310. get interpolationMode(): RealInterpolationMode;
  22311. set interpolationMode(value: RealInterpolationMode);
  22312. /**
  22313. * @en
  22314. * Tangent weight mode when perform cubic interpolation
  22315. * This field is regarded if current interpolation mode is not cubic.
  22316. * @zh
  22317. * 当执行三次插值时,此关键帧使用的切线权重模式。
  22318. * 若当前的插值模式不是三次插值时,该字段无意义。
  22319. */
  22320. get tangentWeightMode(): TangentWeightMode;
  22321. set tangentWeightMode(value: TangentWeightMode);
  22322. /**
  22323. * @en
  22324. * Value of the keyframe.
  22325. * @zh
  22326. * 该关键帧的值。
  22327. */
  22328. value: number;
  22329. /**
  22330. * @en
  22331. * The tangent of this keyframe
  22332. * when it's used as starting point during cubic interpolation.
  22333. * Regarded otherwise.
  22334. * @zh
  22335. * 当此关键帧作为三次插值的起始点时,此关键帧的切线。其他情况下该字段无意义。
  22336. */
  22337. rightTangent: number;
  22338. /**
  22339. * @en
  22340. * The tangent weight of this keyframe
  22341. * when it's used as starting point during weighted cubic interpolation.
  22342. * Regarded otherwise.
  22343. * @zh
  22344. * 当此关键帧作为三次插值的起始点时,此关键帧的切线权重。其他情况下该字段无意义。
  22345. */
  22346. rightTangentWeight: number;
  22347. /**
  22348. * @en
  22349. * The tangent of this keyframe
  22350. * when it's used as ending point during cubic interpolation.
  22351. * Regarded otherwise.
  22352. * @zh
  22353. * 当此关键帧作为三次插值的目标点时,此关键帧的切线。其他情况下该字段无意义。
  22354. */
  22355. leftTangent: number;
  22356. /**
  22357. * @en
  22358. * The tangent weight of this keyframe
  22359. * when it's used as ending point during weighted cubic interpolation.
  22360. * Regarded otherwise.
  22361. * @zh
  22362. * 当此关键帧作为三次插值的目标点时,此关键帧的切线权重。其他情况下该字段无意义。
  22363. */
  22364. leftTangentWeight: number;
  22365. /**
  22366. * @deprecated Reserved for backward compatibility. Will be removed in future.
  22367. */
  22368. get easingMethod(): __private._cocos_core_curves_easing_method__EasingMethod;
  22369. set easingMethod(value: __private._cocos_core_curves_easing_method__EasingMethod);
  22370. }
  22371. /**
  22372. * @en
  22373. * Quaternion curve.
  22374. * @zh
  22375. * 四元数曲线
  22376. */
  22377. export class QuatCurve extends __private._cocos_core_curves_keyframe_curve__KeyframeCurve<QuatKeyframeValue> {
  22378. /**
  22379. * @en
  22380. * Gets or sets the pre-extrapolation-mode of this curve.
  22381. * Defaults to `ExtrapolationMode.CLAMP`.
  22382. * @zh
  22383. * 获取或设置此曲线的前向外推模式。
  22384. * 默认为 `ExtrapolationMode.CLAMP`。
  22385. */
  22386. preExtrapolation: ExtrapolationMode;
  22387. /**
  22388. * @en
  22389. * Gets or sets the post-extrapolation-mode of this curve.
  22390. * Defaults to `ExtrapolationMode.CLAMP`.
  22391. * @zh
  22392. * 获取或设置此曲线的后向外推模式。
  22393. * 默认为 `ExtrapolationMode.CLAMP`。
  22394. */
  22395. postExtrapolation: ExtrapolationMode;
  22396. /**
  22397. * @en
  22398. * Evaluates this curve at specified time.
  22399. * @zh
  22400. * 计算此曲线在指定时间上的值。
  22401. * @param time Input time.
  22402. * @param quat If specified, this value will be filled and returned.
  22403. * Otherwise a new quaternion object will be filled and returned.
  22404. * @returns Result value.
  22405. */
  22406. evaluate(time: number, quat?: math.Quat): math.Quat;
  22407. /**
  22408. * Adds a keyframe into this curve.
  22409. * @param time Time of the keyframe.
  22410. * @param value Value of the keyframe.
  22411. * @returns The index to the new keyframe.
  22412. */
  22413. addKeyFrame(time: number, value: __private._cocos_core_curves_quat_curve__QuatKeyframeValueParameters): number;
  22414. /**
  22415. * Assigns all keyframes.
  22416. * @param keyframes An iterable to keyframes. The keyframes should be sorted by their time.
  22417. */
  22418. assignSorted(keyframes: Iterable<[
  22419. number,
  22420. __private._cocos_core_curves_quat_curve__QuatKeyframeValueParameters
  22421. ]>): void;
  22422. /**
  22423. * Assigns all keyframes.
  22424. * @param times Times array. Should be sorted.
  22425. * @param values Values array. Corresponding to each time in `times`.
  22426. */
  22427. assignSorted(times: readonly number[], values: __private._cocos_core_curves_quat_curve__QuatKeyframeValueParameters[]): void;
  22428. /**
  22429. * @internal
  22430. */
  22431. [serializeTag](output: SerializationOutput, context: SerializationContext): void;
  22432. /**
  22433. * @internal
  22434. */
  22435. [deserializeTag](input: SerializationInput, context: __private._cocos_core_data_custom_serializable__DeserializationContext): void;
  22436. }
  22437. /**
  22438. * @en
  22439. * The method used for interpolation between values of a quaternion keyframe and its next keyframe.
  22440. * @zh
  22441. * 在某四元数关键帧(前一帧)和其下一帧之间插值时使用的插值方式。
  22442. */
  22443. export enum QuatInterpolationMode {
  22444. /**
  22445. * @en
  22446. * Perform spherical linear interpolation between previous keyframe value and next keyframe value.
  22447. * @zh
  22448. * 在前一帧和后一帧之间执行球面线性插值。
  22449. */
  22450. SLERP = 0,
  22451. /**
  22452. * @en
  22453. * Always use the value from this keyframe.
  22454. * @zh
  22455. * 永远使用前一帧的值。
  22456. */
  22457. CONSTANT = 1
  22458. }
  22459. /**
  22460. * View to a quaternion frame value.
  22461. * Note, the view may be invalidated due to keyframe change/add/remove.
  22462. */
  22463. export class QuatKeyframeValue {
  22464. /**
  22465. * @en
  22466. * When perform interpolation, the interpolation method should be taken
  22467. * when for this keyframe is used as starting keyframe.
  22468. * @zh
  22469. * 在执行插值时,当以此关键帧作为起始关键帧时应当使用的插值方式。
  22470. */
  22471. interpolationMode: QuatInterpolationMode;
  22472. /**
  22473. * @en
  22474. * Value of the keyframe.
  22475. * @zh
  22476. * 该关键帧的值。
  22477. */
  22478. value: math.IQuatLike;
  22479. /**
  22480. * @internal Reserved for backward compatibility. Will be removed in future.
  22481. */
  22482. easingMethod: __private._cocos_core_curves_easing_method__EasingMethod | [
  22483. number,
  22484. number,
  22485. number,
  22486. number
  22487. ];
  22488. constructor({ value, interpolationMode, easingMethod, }?: Partial<QuatKeyframeValue>);
  22489. }
  22490. export class ObjectCurve<T> extends __private._cocos_core_curves_keyframe_curve__KeyframeCurve<ObjectCurveKeyframe<T>> {
  22491. evaluate(time: number): T;
  22492. }
  22493. export type ObjectCurveKeyframe<T> = T;
  22494. export class ColorKey {
  22495. /**
  22496. * @en Color value.
  22497. * @zh 颜色值。
  22498. */
  22499. color: math.Color;
  22500. /**
  22501. * @en Time value.
  22502. * @zh 时间值。
  22503. */
  22504. time: number;
  22505. }
  22506. export class AlphaKey {
  22507. /**
  22508. * @en Alpha value.
  22509. * @zh 透明度。
  22510. */
  22511. alpha: number;
  22512. /**
  22513. * @en Time.
  22514. * @zh 时间帧。
  22515. */
  22516. time: number;
  22517. }
  22518. /**
  22519. * @en Gradient is a component that has a lot of color keys and alpha keys to get the interpolated color value.
  22520. * @zh 渐变曲线控件包含了颜色关键帧和透明度关键帧,在关键帧中进行插值渐变返回最终的颜色值。
  22521. */
  22522. export class Gradient {
  22523. /**
  22524. * @en
  22525. * There are 2 kind of mode:
  22526. * Blend just interpolate the nearest 2 colors from keys.
  22527. * Fixed get the nearest color from keys without interpolate.
  22528. * @zh
  22529. * 这个控件包含了两种取色模式:
  22530. * 混合模式对取到的最近两个颜色帧进行插值计算。
  22531. * 固定模式直接取最近的颜色帧返回,不进行插值。
  22532. */
  22533. static Mode: {
  22534. Blend: number;
  22535. Fixed: number;
  22536. };
  22537. /**
  22538. * @en Array of color key.
  22539. * @zh 颜色关键帧列表。
  22540. */
  22541. colorKeys: ColorKey[];
  22542. /**
  22543. * @en Array of alpha key.
  22544. * @zh 透明度关键帧列表。
  22545. */
  22546. alphaKeys: AlphaKey[];
  22547. /**
  22548. * @en Blend mode.
  22549. * @zh 混合模式。
  22550. */
  22551. mode: number;
  22552. /**
  22553. * @en Set color keys array and alpha keys array.
  22554. * @zh 设置颜色和透明度的关键帧列表。
  22555. * @param colorKeys @en Array of color keys @zh 颜色关键帧列表
  22556. * @param alphaKeys @en Array of alpha keys @zh 透明度关键帧列表
  22557. */
  22558. setKeys(colorKeys: ColorKey[], alphaKeys: AlphaKey[]): void;
  22559. /**
  22560. * @en Sort color keys and alpha keys.
  22561. * @zh 对颜色和透明度的关键帧进行排序。
  22562. */
  22563. sortKeys(): void;
  22564. /**
  22565. * @en Interpolate color and alpha from color and alpha keys.
  22566. * @zh 根据颜色列表插值计算颜色和透明度。
  22567. * @param time @en Normalized time to interpolate. @zh 用于插值的归一化时间。
  22568. * @returns @en Interpolated color value. @zh 插值过后的颜色值。
  22569. *
  22570. * @deprecated since v3.8 please use [[evaluateFast]] instead.
  22571. */
  22572. evaluate(time: number): math.Color;
  22573. /**
  22574. * @en Interpolate color and alpha from color and alpha keys.
  22575. * @zh 根据颜色列表插值计算颜色和透明度。
  22576. * @param out @en Interpolated color value. @zh 插值过后的颜色值。
  22577. * @param time @en Normalized time to interpolate. @zh 用于插值的归一化时间。
  22578. * @returns @en Interpolated color value. @zh 插值过后的颜色值。
  22579. */
  22580. evaluateFast(out: math.Color, time: number): math.Color;
  22581. /**
  22582. * @en Generates a random color and alpha.
  22583. * @zh 随机生成颜色和透明度。
  22584. * @returns @en Randomized color. @zh 随机生成的颜色。
  22585. * @deprecated since v3.8 please use [[getRandomColor]] instead.
  22586. */
  22587. randomColor(): math.Color;
  22588. /**
  22589. * @en Generates a random color and alpha.
  22590. * @zh 随机生成颜色和透明度。
  22591. * @param out @en Randomized color. @zh 随机生成的颜色。
  22592. * @returns @en Randomized color. @zh 随机生成的颜色。
  22593. */
  22594. getRandomColor(out: math.Color): math.Color;
  22595. }
  22596. /**
  22597. * @zh
  22598. * 配置模块用于获取 settings.json 配置文件中的配置信息,同时你可以覆盖一些配置从而影响引擎的启动和运行,可参考 [game.init] 的参数选项说明。你可以通过 [settings] 访问此模块单例。
  22599. * @en
  22600. * The Settings module is used to get the configuration information in the settings.json configuration file,
  22601. * and you can override some of the configuration to affect the launch and running of the engine, as described in the [game.init] parameter options.
  22602. * You can access this single instance of the module via [settings].
  22603. */
  22604. export class Settings {
  22605. static Category: typeof __private._cocos_core_settings__Category;
  22606. /**
  22607. * Initialization
  22608. * @internal
  22609. */
  22610. init(path?: string, overrides?: Record<string, any>): Promise<void>;
  22611. /**
  22612. * @zh
  22613. * 覆盖一部分配置数据。
  22614. *
  22615. * @en
  22616. * Override some configuration info in Settings module.
  22617. *
  22618. * @param category @en The category you want to override. @zh 想要覆盖的分组。
  22619. * @param name @en The name of the configuration in the category you want to override. @zh 分组中想要覆盖的具体配置名称。
  22620. * @param value @en The value of the configuration you want to override. @zh 想要覆盖的具体值。
  22621. *
  22622. * @example
  22623. * ```ts
  22624. * console.log(settings.querySettings(Settings.Category.ASSETS, 'server')); // print https://www.cocos.com
  22625. * settings.overrideSettings(Settings.Category.ASSETS, 'server', 'http://www.test.com');
  22626. * console.log(settings.querySettings(Settings.Category.ASSETS, 'server')); // print http://www.test.com
  22627. * ```
  22628. */
  22629. overrideSettings<T = any>(category: __private._cocos_core_settings__Category | string, name: string, value: T): void;
  22630. /**
  22631. * @zh
  22632. * 查询配置模块中具体分组中的具体配置值。
  22633. *
  22634. * @en
  22635. * Query specific configuration values in specific category in the settings module.
  22636. *
  22637. * @param category @en The name of category to query. @zh 想要查询的分组名称。
  22638. * @param name @en The name of configuration in category to query. @zh 分组中想要查询的具体的配置名称。
  22639. * @returns @en The value of configuration to query. @zh 想要查询的具体配置值。
  22640. *
  22641. * @example
  22642. * ```ts
  22643. * console.log(settings.querySettings(Settings.Category.ENGINE, 'debug')); // print false
  22644. * ```
  22645. */
  22646. querySettings<T = any>(category: __private._cocos_core_settings__Category | string, name: string): T | null;
  22647. }
  22648. export namespace Settings {
  22649. export type Category = typeof __private._cocos_core_settings__Category;
  22650. }
  22651. /**
  22652. * @zh
  22653. * Settings 模块单例,你能通过此单例访问 settings.json 中的配置数据。
  22654. * @en
  22655. * Settings module singleton, through this you can access the configuration data in settings.json.
  22656. */
  22657. export const settings: Settings;
  22658. /**
  22659. * @en Base class for all functional system managed by [[Director]].
  22660. * @zh 功能系统的基类,由 [[Director]] 管理。
  22661. */
  22662. export class System implements ISchedulable {
  22663. static Priority: {
  22664. LOW: number;
  22665. MEDIUM: number;
  22666. HIGH: number;
  22667. SCHEDULER: number;
  22668. };
  22669. protected _id: string;
  22670. protected _priority: number;
  22671. protected _executeInEditMode: boolean;
  22672. set priority(value: number);
  22673. get priority(): number;
  22674. set id(id: string);
  22675. get id(): string;
  22676. /**
  22677. * @en Sorting between different systems.
  22678. * @zh 不同系统间排序。
  22679. * @param a System a
  22680. * @param b System b
  22681. */
  22682. static sortByPriority(a: System, b: System): number;
  22683. /**
  22684. * @en Init the system, will be invoked by [[Director]] when registered, should be implemented if needed.
  22685. * @zh 系统初始化函数,会在注册时被 [[Director]] 调用,如果需要的话应该由子类实现
  22686. */
  22687. init(): void;
  22688. /**
  22689. * @en Update function of the system, it will be invoked between all components update phase and late update phase.
  22690. * @zh 系统的帧更新函数,它会在所有组件的 update 和 lateUpdate 之间被调用
  22691. * @param dt Delta time after the last frame
  22692. */
  22693. update(dt: number): void;
  22694. /**
  22695. * @en Post update function of the system, it will be invoked after all components late update phase and before the rendering process.
  22696. * @zh 系统的帧后处理函数,它会在所有组件的 lateUpdate 之后以及渲染之前被调用
  22697. * @param dt Delta time after the last frame
  22698. */
  22699. postUpdate(dt: number): void;
  22700. destroy(): void;
  22701. }
  22702. export namespace easing {
  22703. /**
  22704. * @en Not any easing effect.
  22705. * @zh 没有任何缓动效果。
  22706. */
  22707. export function constant(): number;
  22708. /**
  22709. * @en A linear function, `f(k) = k`. Result correlates to input value one to one.
  22710. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22711. * @zh 线性函数,`f(k) = k`。返回值和输入值一一对应。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22712. */
  22713. export function linear(k: number): number;
  22714. /**
  22715. * @en A quadratic function, f(k) = k * k. The interpolation starts slowly, then progressively speeds up until the end,
  22716. * at which point it stops abruptly. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22717. * @zh 一个二次方的函数,f(k) = k * k。插值开始时很慢,然后逐渐加快,直到结束,并突然停止。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22718. */
  22719. export function quadIn(k: number): number;
  22720. /**
  22721. * @en A quadratic function, f(k) = k * (2-k). The interpolation starts abruptly and then progressively slows down towards the end. Refer to
  22722. * [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22723. * @zh 一个二次方的函数,f(k) = k * (2-k)。插值开始时很突然,然后在接近尾声时逐渐减慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22724. */
  22725. export function quadOut(k: number): number;
  22726. /**
  22727. * @en The interpolation starts slowly, speeds up, and then slows down towards the end. Refer to
  22728. * [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) graphic feature.
  22729. * @zh 插值开始时很慢,接着加快,然后在接近尾声时减慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22730. */
  22731. export function quadInOut(k: number): number;
  22732. /**
  22733. * @en Starts slowly and accelerates. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22734. * @zh 启动慢,加速快。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22735. */
  22736. export function cubicIn(k: number): number;
  22737. /**
  22738. * @en Starts quickly and decelerates.
  22739. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22740. * @zh 起动迅速,减速慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22741. */
  22742. export function cubicOut(k: number): number;
  22743. /**
  22744. * @en Accelerates the animation at the beginning, and decelerates the animation at the end.
  22745. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22746. * @zh 在开始时加速动画,在结束时减慢动画的速度。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22747. */
  22748. export function cubicInOut(k: number): number;
  22749. /**
  22750. * @en Starts slowly and accelerates. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22751. * @zh 启动慢,加速快。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22752. */
  22753. export function quartIn(k: number): number;
  22754. /**
  22755. * @en Starts quickly and decelerates.
  22756. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22757. * @zh 起动迅速,减速慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22758. */
  22759. export function quartOut(k: number): number;
  22760. /**
  22761. * @en Accelerates the animation at the beginning, and decelerates the animation at the end.
  22762. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22763. * @zh 在开始时加速动画,在结束时减慢动画的速度。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22764. */
  22765. export function quartInOut(k: number): number;
  22766. /**
  22767. * @en Starts slowly and accelerates. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22768. * @zh 启动慢,加速快。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22769. */
  22770. export function quintIn(k: number): number;
  22771. /**
  22772. * @en Starts quickly and decelerates.
  22773. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22774. * @zh 起动迅速,减速慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22775. */
  22776. export function quintOut(k: number): number;
  22777. /**
  22778. * @en Accelerates the animation at the beginning, and decelerates the animation at the end.
  22779. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22780. * @zh 在开始时加速动画,在结束时减慢动画的速度。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22781. */
  22782. export function quintInOut(k: number): number;
  22783. /**
  22784. * @en Smoothly accelerates the animation.
  22785. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22786. * @zh 平滑地加速动画。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22787. */
  22788. export function sineIn(k: number): number;
  22789. /**
  22790. * @en Smoothly decelerates the animation.
  22791. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22792. * @zh 平滑地使动画降速。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22793. */
  22794. export function sineOut(k: number): number;
  22795. /**
  22796. * @en Smoothly accelerates the animation at the beginning, and smoothly decelerates the animation at the end.
  22797. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22798. * @zh 在开始时平滑地加速动画,在结束时平滑地减速动画。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22799. */
  22800. export function sineInOut(k: number): number;
  22801. /**
  22802. * @en Starts slowly and accelerates. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22803. * @zh 启动慢,加速快。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22804. */
  22805. export function expoIn(k: number): number;
  22806. /**
  22807. * @en Starts quickly and decelerates.
  22808. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22809. * @zh 起动迅速,减速慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22810. */
  22811. export function expoOut(k: number): number;
  22812. /**
  22813. * @en Accelerates the animation at the beginning, and decelerates the animation at the end.
  22814. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22815. * @zh 在开始时加速动画,在结束时减慢动画的速度。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22816. */
  22817. export function expoInOut(k: number): number;
  22818. /**
  22819. * @en Starts slowly and accelerates. Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22820. * @zh 启动慢,加速快。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22821. */
  22822. export function circIn(k: number): number;
  22823. /**
  22824. * @en Starts quickly and decelerates.
  22825. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22826. * @zh 起动迅速,减速慢。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22827. */
  22828. export function circOut(k: number): number;
  22829. /**
  22830. * @en Accelerates the animation at the beginning, and decelerates the animation at the end.
  22831. * Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22832. * @zh 在开始时加速动画,在结束时减慢动画的速度。具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22833. */
  22834. export function circInOut(k: number): number;
  22835. /**
  22836. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22837. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22838. */
  22839. export function elasticIn(k: number): number;
  22840. /**
  22841. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22842. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22843. */
  22844. export function elasticOut(k: number): number;
  22845. /**
  22846. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22847. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22848. */
  22849. export function elasticInOut(k: number): number;
  22850. /**
  22851. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22852. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22853. */
  22854. export function backIn(k: number): number;
  22855. /**
  22856. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22857. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22858. */
  22859. export function backOut(k: number): number;
  22860. /**
  22861. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22862. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22863. */
  22864. export function backInOut(k: number): number;
  22865. export function bounceIn(k: number): number;
  22866. /**
  22867. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22868. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22869. */
  22870. export function bounceOut(k: number): number;
  22871. /**
  22872. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22873. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22874. */
  22875. export function bounceInOut(k: number): number;
  22876. /**
  22877. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22878. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22879. */
  22880. export function smooth(k: number): number;
  22881. /**
  22882. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22883. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22884. */
  22885. export function fade(k: number): number;
  22886. /**
  22887. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22888. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22889. */
  22890. export const quadOutIn: (k: number) => number;
  22891. /**
  22892. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22893. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22894. */
  22895. export const cubicOutIn: (k: number) => number;
  22896. /**
  22897. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22898. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22899. */
  22900. export const quartOutIn: (k: number) => number;
  22901. /**
  22902. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22903. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22904. */
  22905. export const quintOutIn: (k: number) => number;
  22906. /**
  22907. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22908. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22909. */
  22910. export const sineOutIn: (k: number) => number;
  22911. /**
  22912. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22913. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22914. */
  22915. export const expoOutIn: (k: number) => number;
  22916. /**
  22917. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22918. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22919. */
  22920. export const circOutIn: (k: number) => number;
  22921. /**
  22922. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22923. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22924. */
  22925. export const elasticOutIn: (k: number) => number;
  22926. /**
  22927. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22928. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22929. */
  22930. export const backOutIn: (k: number) => number;
  22931. /**
  22932. * @en Refer to [this doc](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html) for graphic feature.
  22933. * @zh 具体效果可以参考[该文档](https://docs.cocos.com/creator/manual/zh/tween/tween-function.html)。
  22934. */
  22935. export const bounceOutIn: (k: number) => number;
  22936. }
  22937. export function bezier(C1: number, C2: number, C3: number, C4: number, t: number): number;
  22938. export function bezierByTime(controlPoints: BezierControlPoints, x: number): number;
  22939. export type BezierControlPoints = [
  22940. number,
  22941. number,
  22942. number,
  22943. number
  22944. ];
  22945. export function setPropertyEnumType(objectOrConstructor: object, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
  22946. export function setPropertyEnumTypeOnAttrs(attrs: Record<string, any>, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
  22947. export function isCCObject(object: any): object is CCObject;
  22948. export function isValid(value: any, strictMode?: boolean): boolean;
  22949. export namespace pipeline {
  22950. export enum SetIndex {
  22951. GLOBAL = 0,
  22952. MATERIAL = 1,
  22953. LOCAL = 2,
  22954. COUNT = 3
  22955. }
  22956. /**
  22957. * @en The predefined render priorities
  22958. * @zh 预设的渲染优先级。
  22959. */
  22960. export enum RenderPriority {
  22961. MIN = 0,
  22962. MAX = 255,
  22963. DEFAULT = 128
  22964. }
  22965. /**
  22966. * @internal This method only used to init localDescriptorSetLayout.layouts[UBOSkinning.NAME]
  22967. */
  22968. export function localDescriptorSetLayout_ResizeMaxJoints(maxCount: number): void;
  22969. /**
  22970. * @en Does the device support single-channeled half float texture? (for both color attachment and sampling)
  22971. * @zh 当前设备是否支持单通道半浮点贴图?(颜色输出和采样)
  22972. */
  22973. export function supportsR16HalfFloatTexture(device: gfx.Device): boolean;
  22974. /**
  22975. * @en Does the device support single-channeled float texture? (for both color attachment and sampling)
  22976. * @zh 当前设备是否支持单通道浮点贴图?(颜色输出和采样)
  22977. */
  22978. export function supportsR32FloatTexture(device: gfx.Device): boolean;
  22979. /**
  22980. * @en Does the device support 4-channeled float texture? (for both color attachment and sampling)
  22981. * @zh 当前设备是否支持4通道浮点贴图?(颜色输出和采样)
  22982. */
  22983. export function supportsRGBA16HalfFloatTexture(device: gfx.Device): boolean;
  22984. /**
  22985. * @en Does the device support 4-channeled float texture? (for both color attachment and sampling)
  22986. * @zh 当前设备是否支持4通道浮点贴图?(颜色输出和采样)
  22987. */
  22988. export function supportsRGBA32FloatTexture(device: gfx.Device): boolean;
  22989. export function isEnableEffect(): boolean;
  22990. export const PIPELINE_FLOW_MAIN = "MainFlow";
  22991. export const PIPELINE_FLOW_FORWARD = "ForwardFlow";
  22992. export const PIPELINE_FLOW_SHADOW = "ShadowFlow";
  22993. export const PIPELINE_FLOW_SMAA = "SMAAFlow";
  22994. export const PIPELINE_FLOW_TONEMAP = "ToneMapFlow";
  22995. /**
  22996. * @en The predefined render pass stage ids
  22997. * @zh 预设的渲染阶段。
  22998. */
  22999. export enum RenderPassStage {
  23000. DEFAULT = 100,
  23001. UI = 200
  23002. }
  23003. /**
  23004. * @en Render object interface
  23005. * @zh 渲染对象接口。
  23006. */
  23007. export interface IRenderObject {
  23008. model: renderer.scene.Model;
  23009. depth: number;
  23010. }
  23011. export interface IRenderPass {
  23012. priority: number;
  23013. hash: number;
  23014. depth: number;
  23015. shaderId: number;
  23016. subModel: renderer.scene.SubModel;
  23017. passIdx: number;
  23018. }
  23019. /**
  23020. * @en Render batch interface
  23021. * @zh 渲染批次接口。
  23022. */
  23023. export interface IRenderBatch {
  23024. pass: renderer.Pass;
  23025. }
  23026. /**
  23027. * @en Render queue descriptor
  23028. * @zh 渲染队列描述。
  23029. */
  23030. export interface IRenderQueueDesc {
  23031. isTransparent: boolean;
  23032. phases: number;
  23033. sortFunc: (a: IRenderPass, b: IRenderPass) => number;
  23034. }
  23035. export interface IDescriptorSetLayoutInfo {
  23036. bindings: gfx.DescriptorSetLayoutBinding[];
  23037. layouts: Record<string, gfx.UniformBlock | gfx.UniformSamplerTexture | gfx.UniformStorageImage | gfx.UniformStorageBuffer>;
  23038. }
  23039. export const globalDescriptorSetLayout: IDescriptorSetLayoutInfo;
  23040. export const localDescriptorSetLayout: IDescriptorSetLayoutInfo;
  23041. /**
  23042. * @en The uniform bindings
  23043. * @zh Uniform 参数绑定。
  23044. */
  23045. export enum PipelineGlobalBindings {
  23046. UBO_GLOBAL = 0,
  23047. UBO_CAMERA = 1,
  23048. UBO_SHADOW = 2,
  23049. UBO_CSM = 3,
  23050. SAMPLER_SHADOWMAP = 4,
  23051. SAMPLER_ENVIRONMENT = 5,
  23052. SAMPLER_SPOT_SHADOW_MAP = 6,
  23053. SAMPLER_DIFFUSEMAP = 7,
  23054. COUNT = 8
  23055. }
  23056. export enum ModelLocalBindings {
  23057. UBO_LOCAL = 0,
  23058. UBO_FORWARD_LIGHTS = 1,
  23059. UBO_SKINNING_ANIMATION = 2,
  23060. UBO_SKINNING_TEXTURE = 3,
  23061. UBO_MORPH = 4,
  23062. UBO_UI_LOCAL = 5,
  23063. UBO_SH = 6,
  23064. SAMPLER_JOINTS = 7,
  23065. SAMPLER_MORPH_POSITION = 8,
  23066. SAMPLER_MORPH_NORMAL = 9,
  23067. SAMPLER_MORPH_TANGENT = 10,
  23068. SAMPLER_LIGHTMAP = 11,
  23069. SAMPLER_SPRITE = 12,
  23070. SAMPLER_REFLECTION = 13,
  23071. STORAGE_REFLECTION = 14,
  23072. SAMPLER_REFLECTION_PROBE_CUBE = 15,
  23073. SAMPLER_REFLECTION_PROBE_PLANAR = 16,
  23074. SAMPLER_REFLECTION_PROBE_DATA_MAP = 17,
  23075. SAMPLER_REFLECTION_PROBE_BLEND_CUBE = 18,
  23076. COUNT = 19
  23077. }
  23078. export const bindingMappingInfo: gfx.BindingMappingInfo;
  23079. /**
  23080. * @en The global uniform buffer object
  23081. * @zh 全局 UBO。
  23082. */
  23083. export class UBOGlobal {
  23084. static readonly TIME_OFFSET = 0;
  23085. static readonly SCREEN_SIZE_OFFSET: number;
  23086. static readonly NATIVE_SIZE_OFFSET: number;
  23087. static readonly PROBE_INFO_OFFSET: number;
  23088. static readonly DEBUG_VIEW_MODE_OFFSET: number;
  23089. static readonly COUNT: number;
  23090. static readonly SIZE: number;
  23091. static readonly NAME = "CCGlobal";
  23092. static readonly BINDING = PipelineGlobalBindings.UBO_GLOBAL;
  23093. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23094. static readonly LAYOUT: gfx.UniformBlock;
  23095. }
  23096. /**
  23097. * @en The global camera uniform buffer object
  23098. * @zh 全局相机 UBO。
  23099. */
  23100. export class UBOCamera {
  23101. static readonly MAT_VIEW_OFFSET = 0;
  23102. static readonly MAT_VIEW_INV_OFFSET: number;
  23103. static readonly MAT_PROJ_OFFSET: number;
  23104. static readonly MAT_PROJ_INV_OFFSET: number;
  23105. static readonly MAT_VIEW_PROJ_OFFSET: number;
  23106. static readonly MAT_VIEW_PROJ_INV_OFFSET: number;
  23107. static readonly CAMERA_POS_OFFSET: number;
  23108. static readonly SURFACE_TRANSFORM_OFFSET: number;
  23109. static readonly SCREEN_SCALE_OFFSET: number;
  23110. static readonly EXPOSURE_OFFSET: number;
  23111. static readonly MAIN_LIT_DIR_OFFSET: number;
  23112. static readonly MAIN_LIT_COLOR_OFFSET: number;
  23113. static readonly AMBIENT_SKY_OFFSET: number;
  23114. static readonly AMBIENT_GROUND_OFFSET: number;
  23115. static readonly GLOBAL_FOG_COLOR_OFFSET: number;
  23116. static readonly GLOBAL_FOG_BASE_OFFSET: number;
  23117. static readonly GLOBAL_FOG_ADD_OFFSET: number;
  23118. static readonly NEAR_FAR_OFFSET: number;
  23119. static readonly VIEW_PORT_OFFSET: number;
  23120. static readonly COUNT: number;
  23121. static readonly SIZE: number;
  23122. static readonly NAME = "CCCamera";
  23123. static readonly BINDING = PipelineGlobalBindings.UBO_CAMERA;
  23124. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23125. static readonly LAYOUT: gfx.UniformBlock;
  23126. }
  23127. /**
  23128. * @en The uniform buffer object for 'cast shadow(fixed || csm)' && 'dir fixed area shadow' && 'spot shadow' && 'sphere shadow' && 'planar shadow'
  23129. * @zh 这个 UBO 仅仅只给 'cast shadow(fixed || csm)' && 'dir fixed area shadow' && 'spot shadow' && 'sphere shadow' && 'planar shadow' 使用
  23130. */
  23131. export class UBOShadow {
  23132. static readonly MAT_LIGHT_VIEW_OFFSET = 0;
  23133. static readonly MAT_LIGHT_VIEW_PROJ_OFFSET: number;
  23134. static readonly SHADOW_INV_PROJ_DEPTH_INFO_OFFSET: number;
  23135. static readonly SHADOW_PROJ_DEPTH_INFO_OFFSET: number;
  23136. static readonly SHADOW_PROJ_INFO_OFFSET: number;
  23137. static readonly SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET: number;
  23138. static readonly SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET: number;
  23139. static readonly SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET: number;
  23140. static readonly SHADOW_COLOR_OFFSET: number;
  23141. static readonly PLANAR_NORMAL_DISTANCE_INFO_OFFSET: number;
  23142. static readonly COUNT: number;
  23143. static readonly SIZE: number;
  23144. static readonly NAME = "CCShadow";
  23145. static readonly BINDING = PipelineGlobalBindings.UBO_SHADOW;
  23146. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23147. static readonly LAYOUT: gfx.UniformBlock;
  23148. }
  23149. /**
  23150. * @en The uniform buffer object only for dir csm shadow(level: 1 ~ 4)
  23151. * @zh 级联阴影使用的UBO
  23152. */
  23153. export class UBOCSM {
  23154. static readonly CSM_LEVEL_COUNT = 4;
  23155. static readonly CSM_VIEW_DIR_0_OFFSET = 0;
  23156. static readonly CSM_VIEW_DIR_1_OFFSET: number;
  23157. static readonly CSM_VIEW_DIR_2_OFFSET: number;
  23158. static readonly CSM_ATLAS_OFFSET: number;
  23159. static readonly MAT_CSM_VIEW_PROJ_OFFSET: number;
  23160. static readonly CSM_PROJ_DEPTH_INFO_OFFSET: number;
  23161. static readonly CSM_PROJ_INFO_OFFSET: number;
  23162. static readonly CSM_SPLITS_INFO_OFFSET: number;
  23163. static readonly COUNT: number;
  23164. static readonly SIZE: number;
  23165. static readonly NAME = "CCCSM";
  23166. static readonly BINDING = PipelineGlobalBindings.UBO_CSM;
  23167. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23168. static readonly LAYOUT: gfx.UniformBlock;
  23169. }
  23170. export const UNIFORM_SHADOWMAP_BINDING = PipelineGlobalBindings.SAMPLER_SHADOWMAP;
  23171. export const UNIFORM_ENVIRONMENT_BINDING = PipelineGlobalBindings.SAMPLER_ENVIRONMENT;
  23172. export const UNIFORM_DIFFUSEMAP_BINDING = PipelineGlobalBindings.SAMPLER_DIFFUSEMAP;
  23173. export const UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING = PipelineGlobalBindings.SAMPLER_SPOT_SHADOW_MAP;
  23174. /**
  23175. * @en The local uniform buffer object
  23176. * @zh 本地 UBO。
  23177. */
  23178. export class UBOLocal {
  23179. static readonly MAT_WORLD_OFFSET = 0;
  23180. static readonly MAT_WORLD_IT_OFFSET: number;
  23181. static readonly LIGHTINGMAP_UVPARAM: number;
  23182. static readonly LOCAL_SHADOW_BIAS: number;
  23183. static readonly REFLECTION_PROBE_DATA1: number;
  23184. static readonly REFLECTION_PROBE_DATA2: number;
  23185. static readonly REFLECTION_PROBE_BLEND_DATA1: number;
  23186. static readonly REFLECTION_PROBE_BLEND_DATA2: number;
  23187. static readonly COUNT: number;
  23188. static readonly SIZE: number;
  23189. static readonly NAME = "CCLocal";
  23190. static readonly BINDING = ModelLocalBindings.UBO_LOCAL;
  23191. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23192. static readonly LAYOUT: gfx.UniformBlock;
  23193. }
  23194. /**
  23195. * @en The world bound uniform buffer object
  23196. * @zh 世界空间包围盒 UBO。
  23197. */
  23198. export class UBOWorldBound {
  23199. static readonly WORLD_BOUND_CENTER = 0;
  23200. static readonly WORLD_BOUND_HALF_EXTENTS: number;
  23201. static readonly COUNT: number;
  23202. static readonly SIZE: number;
  23203. static readonly NAME = "CCWorldBound";
  23204. static readonly BINDING = ModelLocalBindings.UBO_LOCAL;
  23205. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23206. static readonly LAYOUT: gfx.UniformBlock;
  23207. }
  23208. export const INST_MAT_WORLD = "a_matWorld0";
  23209. export const INST_SH = "a_sh_linear_const_r";
  23210. export class UBOLocalBatched {
  23211. static readonly BATCHING_COUNT = 10;
  23212. static readonly MAT_WORLDS_OFFSET = 0;
  23213. static readonly COUNT: number;
  23214. static readonly SIZE: number;
  23215. static readonly NAME = "CCLocalBatched";
  23216. static readonly BINDING = ModelLocalBindings.UBO_LOCAL;
  23217. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23218. static readonly LAYOUT: gfx.UniformBlock;
  23219. }
  23220. /**
  23221. * @en The uniform buffer object for forward lighting
  23222. * @zh 前向灯光 UBO。
  23223. */
  23224. export class UBOForwardLight {
  23225. static readonly LIGHTS_PER_PASS = 1;
  23226. static readonly LIGHT_POS_OFFSET = 0;
  23227. static readonly LIGHT_COLOR_OFFSET: number;
  23228. static readonly LIGHT_SIZE_RANGE_ANGLE_OFFSET: number;
  23229. static readonly LIGHT_DIR_OFFSET: number;
  23230. static readonly LIGHT_BOUNDING_SIZE_VS_OFFSET: number;
  23231. static readonly COUNT: number;
  23232. static readonly SIZE: number;
  23233. static readonly NAME = "CCForwardLight";
  23234. static readonly BINDING = ModelLocalBindings.UBO_FORWARD_LIGHTS;
  23235. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23236. static readonly LAYOUT: gfx.UniformBlock;
  23237. }
  23238. export class UBODeferredLight {
  23239. static readonly LIGHTS_PER_PASS = 10;
  23240. }
  23241. export const JOINT_UNIFORM_CAPACITY = 30;
  23242. /**
  23243. * @en The uniform buffer object for skinning texture
  23244. * @zh 骨骼贴图 UBO。
  23245. */
  23246. export class UBOSkinningTexture {
  23247. static readonly JOINTS_TEXTURE_INFO_OFFSET = 0;
  23248. static readonly COUNT: number;
  23249. static readonly SIZE: number;
  23250. static readonly NAME = "CCSkinningTexture";
  23251. static readonly BINDING = ModelLocalBindings.UBO_SKINNING_TEXTURE;
  23252. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23253. static readonly LAYOUT: gfx.UniformBlock;
  23254. }
  23255. export class UBOSkinningAnimation {
  23256. static readonly JOINTS_ANIM_INFO_OFFSET = 0;
  23257. static readonly COUNT: number;
  23258. static readonly SIZE: number;
  23259. static readonly NAME = "CCSkinningAnimation";
  23260. static readonly BINDING = ModelLocalBindings.UBO_SKINNING_ANIMATION;
  23261. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23262. static readonly LAYOUT: gfx.UniformBlock;
  23263. }
  23264. export const INST_JOINT_ANIM_INFO = "a_jointAnimInfo";
  23265. export class UBOSkinning {
  23266. static get JOINT_UNIFORM_CAPACITY(): number;
  23267. static get COUNT(): number;
  23268. static get SIZE(): number;
  23269. static readonly NAME = "CCSkinning";
  23270. static readonly BINDING = ModelLocalBindings.UBO_SKINNING_TEXTURE;
  23271. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23272. static readonly LAYOUT: gfx.UniformBlock;
  23273. /**
  23274. * @internal This method only used init UBOSkinning configure.
  23275. */
  23276. static initLayout(capacity: number): void;
  23277. }
  23278. /**
  23279. * @en The uniform buffer object for morph setting
  23280. * @zh 形变配置的 UBO
  23281. */
  23282. export class UBOMorph {
  23283. static readonly MAX_MORPH_TARGET_COUNT = 60;
  23284. static readonly OFFSET_OF_WEIGHTS = 0;
  23285. static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH: number;
  23286. static readonly OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT: number;
  23287. static readonly OFFSET_OF_VERTICES_COUNT: number;
  23288. static readonly COUNT_BASE_4_BYTES: number;
  23289. static readonly SIZE: number;
  23290. static readonly NAME = "CCMorph";
  23291. static readonly BINDING = ModelLocalBindings.UBO_MORPH;
  23292. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23293. static readonly LAYOUT: gfx.UniformBlock;
  23294. }
  23295. export class UBOUILocal {
  23296. static readonly NAME = "CCUILocal";
  23297. static readonly BINDING = ModelLocalBindings.UBO_UI_LOCAL;
  23298. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23299. static readonly LAYOUT: gfx.UniformBlock;
  23300. }
  23301. /**
  23302. * @en The SH uniform buffer object
  23303. * @zh 球谐 UBO。
  23304. */
  23305. export class UBOSH {
  23306. static readonly SH_LINEAR_CONST_R_OFFSET = 0;
  23307. static readonly SH_LINEAR_CONST_G_OFFSET: number;
  23308. static readonly SH_LINEAR_CONST_B_OFFSET: number;
  23309. static readonly SH_QUADRATIC_R_OFFSET: number;
  23310. static readonly SH_QUADRATIC_G_OFFSET: number;
  23311. static readonly SH_QUADRATIC_B_OFFSET: number;
  23312. static readonly SH_QUADRATIC_A_OFFSET: number;
  23313. static readonly COUNT: number;
  23314. static readonly SIZE: number;
  23315. static readonly NAME = "CCSH";
  23316. static readonly BINDING = ModelLocalBindings.UBO_SH;
  23317. static readonly DESCRIPTOR: gfx.DescriptorSetLayoutBinding;
  23318. static readonly LAYOUT: gfx.UniformBlock;
  23319. }
  23320. export const UNIFORM_JOINT_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_JOINTS;
  23321. export const UNIFORM_REALTIME_JOINT_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_JOINTS;
  23322. export const UNIFORM_POSITION_MORPH_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_MORPH_POSITION;
  23323. export const UNIFORM_NORMAL_MORPH_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_MORPH_NORMAL;
  23324. export const UNIFORM_TANGENT_MORPH_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_MORPH_TANGENT;
  23325. export const UNIFORM_LIGHTMAP_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_LIGHTMAP;
  23326. export const UNIFORM_SPRITE_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_SPRITE;
  23327. export const UNIFORM_REFLECTION_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_REFLECTION;
  23328. export const UNIFORM_REFLECTION_STORAGE_BINDING = ModelLocalBindings.STORAGE_REFLECTION;
  23329. export const UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING = ModelLocalBindings.SAMPLER_REFLECTION_PROBE_CUBE;
  23330. export const UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING = ModelLocalBindings.SAMPLER_REFLECTION_PROBE_PLANAR;
  23331. export const UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING = ModelLocalBindings.SAMPLER_REFLECTION_PROBE_DATA_MAP;
  23332. export const UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING = ModelLocalBindings.SAMPLER_REFLECTION_PROBE_BLEND_CUBE;
  23333. export const CAMERA_DEFAULT_MASK: number;
  23334. export const CAMERA_EDITOR_MASK: number;
  23335. export const MODEL_ALWAYS_MASK: number;
  23336. }
  23337. /**
  23338. * @en Render pipeline describes how we handle the rendering process for all render objects in the related render scene root.
  23339. * It contains some general pipeline configurations, necessary rendering resources and some [[RenderFlow]]s.
  23340. * The rendering process function [[render]] is invoked by [[Root]] for all [[Camera]]s.
  23341. * @zh 渲染管线对象决定了引擎对相关渲染场景下的所有渲染对象实施的完整渲染流程。
  23342. * 这个类主要包含一些通用的管线配置,必要的渲染资源和一些 [[RenderFlow]]。
  23343. * 渲染流程函数 [[render]] 会由 [[Root]] 发起调用并对所有 [[Camera]] 执行预设的渲染流程。
  23344. */
  23345. export abstract class RenderPipeline extends Asset implements __private._cocos_rendering_pipeline_event__IPipelineEvent, __private._cocos_rendering_custom_pipeline__PipelineRuntime {
  23346. /**
  23347. * @en The tag of pipeline.
  23348. * @zh 管线的标签。
  23349. * @readonly
  23350. */
  23351. get tag(): number;
  23352. /**
  23353. * @en The flows of pipeline.
  23354. * @zh 管线的渲染流程列表。
  23355. * @readonly
  23356. */
  23357. get flows(): RenderFlow[];
  23358. /**
  23359. * @en Tag
  23360. * @zh 标签
  23361. * @readonly
  23362. */
  23363. protected _tag: number;
  23364. /**
  23365. * @en Flows
  23366. * @zh 渲染流程列表
  23367. * @readonly
  23368. */
  23369. protected _flows: RenderFlow[];
  23370. protected _quadIB: gfx.Buffer | null;
  23371. protected _quadVBOnscreen: gfx.Buffer | null;
  23372. protected _quadVBOffscreen: gfx.Buffer | null;
  23373. protected _quadIAOnscreen: gfx.InputAssembler | null;
  23374. protected _quadIAOffscreen: gfx.InputAssembler | null;
  23375. protected _eventProcessor: PipelineEventProcessor;
  23376. /**
  23377. * @zh
  23378. * 四边形输入汇集器。
  23379. */
  23380. get quadIAOnscreen(): gfx.InputAssembler;
  23381. get quadIAOffscreen(): gfx.InputAssembler;
  23382. getPipelineRenderData(): __private._cocos_rendering_render_pipeline__PipelineRenderData;
  23383. /**
  23384. * @en
  23385. * Constant macro string, static throughout the whole runtime.
  23386. * Used to pass device-specific parameters to shader.
  23387. * @zh 常量宏定义字符串,运行时全程不会改变,用于给 shader 传一些只和平台相关的参数。
  23388. * @readonly
  23389. */
  23390. get constantMacros(): string;
  23391. /**
  23392. * @en
  23393. * The current global-scoped shader macros.
  23394. * Used to control effects like IBL, fog, etc.
  23395. * @zh 当前的全局宏定义,用于控制如 IBL、雾效等模块。
  23396. * @readonly
  23397. */
  23398. get macros(): renderer.MacroRecord;
  23399. get device(): gfx.Device;
  23400. get globalDSManager(): __private._cocos_rendering_global_descriptor_set_manager__GlobalDSManager;
  23401. get descriptorSetLayout(): gfx.DescriptorSetLayout;
  23402. get descriptorSet(): gfx.DescriptorSet;
  23403. get commandBuffers(): gfx.CommandBuffer[];
  23404. get pipelineUBO(): __private._cocos_rendering_pipeline_ubo__PipelineUBO;
  23405. get pipelineSceneData(): PipelineSceneData;
  23406. set profiler(value: renderer.scene.Model | null);
  23407. get profiler(): renderer.scene.Model | null;
  23408. /**
  23409. * @deprecated since v3.6, please use camera.geometryRenderer instead.
  23410. */
  23411. get geometryRenderer(): GeometryRenderer | null;
  23412. set clusterEnabled(value: boolean);
  23413. get clusterEnabled(): boolean;
  23414. set bloomEnabled(value: boolean);
  23415. get bloomEnabled(): boolean;
  23416. protected _device: gfx.Device;
  23417. protected _globalDSManager: __private._cocos_rendering_global_descriptor_set_manager__GlobalDSManager;
  23418. protected _descriptorSet: gfx.DescriptorSet;
  23419. protected _commandBuffers: gfx.CommandBuffer[];
  23420. protected _pipelineUBO: __private._cocos_rendering_pipeline_ubo__PipelineUBO;
  23421. protected _macros: renderer.MacroRecord;
  23422. protected _constantMacros: string;
  23423. protected _profiler: renderer.scene.Model | null;
  23424. protected _geometryRenderer: GeometryRenderer | null;
  23425. protected _pipelineSceneData: PipelineSceneData;
  23426. protected _pipelineRenderData: __private._cocos_rendering_render_pipeline__PipelineRenderData | null;
  23427. protected _renderPasses: Map<number, gfx.RenderPass>;
  23428. protected _width: number;
  23429. protected _height: number;
  23430. protected _lastUsedRenderArea: gfx.Rect;
  23431. protected _clusterEnabled: boolean;
  23432. protected _bloomEnabled: boolean;
  23433. /**
  23434. * @en The initialization process, user shouldn't use it in most case, only useful when need to generate render pipeline programmatically.
  23435. * @zh 初始化函数,正常情况下不会用到,仅用于程序化生成渲染管线的情况。
  23436. * @param info The render pipeline information
  23437. */
  23438. initialize(info: __private._cocos_rendering_render_pipeline__IRenderPipelineInfo): boolean;
  23439. createRenderPass(clearFlags: gfx.ClearFlags, colorFmt: gfx.Format, depthFmt: gfx.Format): gfx.RenderPass;
  23440. getRenderPass(clearFlags: gfx.ClearFlags, fbo: gfx.Framebuffer): gfx.RenderPass;
  23441. newFramebufferByRatio(dyingFramebuffer: gfx.Framebuffer): gfx.Framebuffer;
  23442. /**
  23443. * @en generate renderArea by camera
  23444. * @zh 生成renderArea
  23445. * @param camera the camera
  23446. * @returns
  23447. */
  23448. generateRenderArea(camera: renderer.scene.Camera, out: gfx.Rect): void;
  23449. generateViewport(camera: renderer.scene.Camera, out?: gfx.Viewport): gfx.Viewport;
  23450. generateScissor(camera: renderer.scene.Camera, out?: gfx.Rect): gfx.Rect;
  23451. get shadingScale(): number;
  23452. set shadingScale(val: number);
  23453. getMacroString(name: string): string;
  23454. getMacroInt(name: string): number;
  23455. getMacroBool(name: string): boolean;
  23456. setMacroString(name: string, value: string): void;
  23457. setMacroInt(name: string, value: number): void;
  23458. setMacroBool(name: string, value: boolean): void;
  23459. /**
  23460. * @en Activate the render pipeline after loaded, it mainly activate the flows
  23461. * @zh 当渲染管线资源加载完成后,启用管线,主要是启用管线内的 flow
  23462. * TODO: remove swapchain dependency at this stage
  23463. * after deferred pipeline can handle multiple swapchains
  23464. */
  23465. activate(swapchain: gfx.Swapchain): boolean;
  23466. protected _ensureEnoughSize(cameras: renderer.scene.Camera[]): void;
  23467. /**
  23468. * @en Render function, it basically run the render process of all flows in sequence for the given view.
  23469. * @zh 渲染函数,对指定的渲染视图按顺序执行所有渲染流程。
  23470. * @param view Render view。
  23471. */
  23472. render(cameras: renderer.scene.Camera[]): void;
  23473. /**
  23474. * @zh
  23475. * 销毁四边形输入汇集器。
  23476. */
  23477. protected _destroyQuadInputAssembler(): void;
  23478. protected _destroyBloomData(): void;
  23479. /**
  23480. * @zh
  23481. * 创建四边形输入汇集器。
  23482. */
  23483. protected _createQuadInputAssembler(): __private._cocos_rendering_render_pipeline__PipelineInputAssemblerData;
  23484. updateQuadVertexData(renderArea: gfx.Rect, window: __private._cocos_render_scene_core_render_window__RenderWindow): void;
  23485. /**
  23486. * @en Internal destroy function
  23487. * @zh 内部销毁函数。
  23488. */
  23489. destroy(): boolean;
  23490. onGlobalPipelineStateChanged(): void;
  23491. protected _generateConstantMacros(): void;
  23492. protected updateGeometryRenderer(cameras: renderer.scene.Camera[]): void;
  23493. generateBloomRenderData(): void;
  23494. /**
  23495. * @en
  23496. * Register an callback of the pipeline event type on the RenderPipeline.
  23497. * @zh
  23498. * 在渲染管线中注册管线事件类型的回调。
  23499. */
  23500. on(type: PipelineEventType, callback: any, target?: any, once?: boolean): typeof callback;
  23501. /**
  23502. * @en
  23503. * Register an callback of the pipeline event type on the RenderPipeline,
  23504. * the callback will remove itself after the first time it is triggered.
  23505. * @zh
  23506. * 在渲染管线中注册管线事件类型的回调, 回调后会在第一时间删除自身。
  23507. */
  23508. once(type: PipelineEventType, callback: any, target?: any): typeof callback;
  23509. /**
  23510. * @en
  23511. * Removes the listeners previously registered with the same type, callback, target and or useCapture,
  23512. * if only type is passed as parameter, all listeners registered with that type will be removed.
  23513. * @zh
  23514. * 删除之前用同类型、回调、目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  23515. */
  23516. off(type: PipelineEventType, callback?: any, target?: any): void;
  23517. /**
  23518. * @zh 派发一个指定事件,并传递需要的参数
  23519. * @en Trigger an event directly with the event name and necessary arguments.
  23520. * @param type - event type
  23521. * @param args - Arguments when the event triggered
  23522. */
  23523. emit(type: PipelineEventType, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void;
  23524. /**
  23525. * @en Removes all callbacks previously registered with the same target (passed as parameter).
  23526. * This is not for removing all listeners in the current event target,
  23527. * and this is not for removing all listeners the target parameter have registered.
  23528. * It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  23529. * @zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  23530. * 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  23531. * 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  23532. * @param typeOrTarget - The target to be searched for all related listeners
  23533. */
  23534. targetOff(typeOrTarget: any): void;
  23535. /**
  23536. * @zh 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  23537. * @en Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  23538. * @param typeOrTarget - The event type or target with which the listeners will be removed
  23539. */
  23540. removeAll(typeOrTarget: any): void;
  23541. /**
  23542. * @zh 检查指定事件是否已注册回调。
  23543. * @en Checks whether there is correspond event listener registered on the given event.
  23544. * @param type - Event type.
  23545. * @param callback - Callback function when event triggered.
  23546. * @param target - Callback callee.
  23547. */
  23548. hasEventListener(type: PipelineEventType, callback?: any, target?: any): boolean;
  23549. }
  23550. /**
  23551. * @en Render flow is a sub process of the [[RenderPipeline]], it dispatch the render task to all the [[RenderStage]]s.
  23552. * @zh 渲染流程是渲染管线([[RenderPipeline]])的一个子过程,它将渲染任务派发到它的所有渲染阶段([[RenderStage]])中执行。
  23553. */
  23554. export abstract class RenderFlow {
  23555. /**
  23556. * @en The name of the render flow
  23557. * @zh 渲染流程的名字
  23558. */
  23559. get name(): string;
  23560. /**
  23561. * @en Priority of the current flow
  23562. * @zh 当前渲染流程的优先级。
  23563. */
  23564. get priority(): number;
  23565. /**
  23566. * @en Tag of the current flow
  23567. * @zh 当前渲染流程的标签。
  23568. */
  23569. get tag(): number;
  23570. /**
  23571. * @en The stages of flow.
  23572. * @zh 渲染流程 stage 列表。
  23573. * @readonly
  23574. */
  23575. get stages(): RenderStage[];
  23576. protected _name: string;
  23577. protected _priority: number;
  23578. protected _tag: number;
  23579. protected _stages: RenderStage[];
  23580. protected _pipeline: RenderPipeline;
  23581. /**
  23582. * @en Get pipeline
  23583. * @zh 获取pipeline
  23584. */
  23585. get pipeline(): RenderPipeline;
  23586. /**
  23587. * @en The initialization process, user shouldn't use it in most case, only useful when need to generate render pipeline programmatically.
  23588. * @zh 初始化函数,正常情况下不会用到,仅用于程序化生成渲染管线的情况。
  23589. * @param info The render flow information
  23590. */
  23591. initialize(info: __private._cocos_rendering_render_flow__IRenderFlowInfo): boolean;
  23592. /**
  23593. * @en Activate the current render flow in the given pipeline
  23594. * @zh 为指定的渲染管线开启当前渲染流程
  23595. * @param pipeline The render pipeline to activate this render flow
  23596. */
  23597. activate(pipeline: RenderPipeline): void;
  23598. /**
  23599. * @en Render function, it basically run all render stages in sequence for the given view.
  23600. * @zh 渲染函数,对指定的渲染视图按顺序执行所有渲染阶段。
  23601. * @param view Render view。
  23602. */
  23603. render(camera: renderer.scene.Camera): void;
  23604. /**
  23605. * @en Destroy function.
  23606. * @zh 销毁函数。
  23607. */
  23608. destroy(): void;
  23609. }
  23610. /**
  23611. * @en The render stage actually renders render objects to the output window or other GFX [[gfx.Framebuffer]].
  23612. * Typically, a render stage collects render objects it's responsible for, clear the camera,
  23613. * record and execute command buffer, and at last present the render result.
  23614. * @zh 渲染阶段是实质上的渲染执行者,它负责收集渲染数据并执行渲染将渲染结果输出到屏幕或其他 GFX [[gfx.Framebuffer]] 中。
  23615. * 典型的渲染阶段会收集它所管理的渲染对象,按照 [[Camera]] 的清除标记进行清屏,记录并执行渲染指令缓存,并最终呈现渲染结果。
  23616. */
  23617. export abstract class RenderStage {
  23618. /**
  23619. * @en Name of the current stage
  23620. * @zh 当前渲染阶段的名字。
  23621. */
  23622. get name(): string;
  23623. /**
  23624. * @en Priority of the current stage
  23625. * @zh 当前渲染阶段的优先级。
  23626. */
  23627. get priority(): number;
  23628. /**
  23629. * @en Tag of the current stage
  23630. * @zh 当前渲染阶段的标签。
  23631. */
  23632. get tag(): number;
  23633. /**
  23634. * @en Name
  23635. * @zh 名称。
  23636. */
  23637. protected _name: string;
  23638. /**
  23639. * @en Priority
  23640. * @zh 优先级。
  23641. */
  23642. protected _priority: number;
  23643. /**
  23644. * @en Whether to enable
  23645. * @zh 是否启用。
  23646. */
  23647. protected _enabled: boolean;
  23648. set enabled(val: boolean);
  23649. get enabled(): boolean;
  23650. /**
  23651. * @en Type
  23652. * @zh 类型。
  23653. */
  23654. protected _tag: number;
  23655. protected _pipeline: RenderPipeline;
  23656. protected _flow: RenderFlow;
  23657. /**
  23658. * @en The initialization process, user shouldn't use it in most case, only useful when need to generate render pipeline programmatically.
  23659. * @zh 初始化函数,正常情况下不会用到,仅用于程序化生成渲染管线的情况。
  23660. * @param info The render stage information
  23661. */
  23662. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23663. /**
  23664. * @en Activate the current render stage in the given render flow
  23665. * @zh 为指定的渲染流程开启当前渲染阶段
  23666. * @param flow The render flow to activate this render stage
  23667. */
  23668. activate(pipeline: RenderPipeline, flow: RenderFlow): void;
  23669. /**
  23670. * @en Destroy function
  23671. * @zh 销毁函数。
  23672. */
  23673. abstract destroy(): void;
  23674. /**
  23675. * @en Render function
  23676. * @zh 渲染函数。
  23677. * @param view The render view
  23678. */
  23679. abstract render(camera: renderer.scene.Camera): void;
  23680. }
  23681. export class PipelineSceneData {
  23682. /**
  23683. * @en Is open HDR.
  23684. * @zh 是否开启 HDR。
  23685. * @readonly
  23686. */
  23687. get isHDR(): boolean;
  23688. set isHDR(val: boolean);
  23689. get shadingScale(): number;
  23690. set shadingScale(val: number);
  23691. get csmSupported(): boolean;
  23692. set csmSupported(val: boolean);
  23693. get skinMaterialModel(): renderer.scene.Model;
  23694. set skinMaterialModel(val: renderer.scene.Model);
  23695. fog: renderer.scene.Fog;
  23696. ambient: renderer.scene.Ambient;
  23697. skybox: renderer.scene.Skybox;
  23698. shadows: renderer.scene.Shadows;
  23699. csmLayers: __private._cocos_rendering_shadow_csm_layers__CSMLayers;
  23700. octree: renderer.scene.Octree;
  23701. skin: renderer.scene.Skin;
  23702. postSettings: renderer.scene.PostSettings;
  23703. lightProbes: any;
  23704. /**
  23705. * @en The list for valid punctual Lights, only available after the scene culling of the current frame.
  23706. * @zh 场景中精确的有效光源,仅在当前帧的场景剔除完成后有效。
  23707. */
  23708. validPunctualLights: renderer.scene.Light[];
  23709. /**
  23710. * @en The list for render objects, only available after the scene culling of the current frame.
  23711. * @zh 渲染对象数组,仅在当前帧的场景剔除完成后有效。
  23712. */
  23713. renderObjects: pipeline.IRenderObject[];
  23714. shadowFrameBufferMap: Map<renderer.scene.Light, gfx.Framebuffer>;
  23715. protected _device: gfx.Device;
  23716. protected _geometryRendererMaterials: Material[];
  23717. protected _geometryRendererPasses: renderer.Pass[];
  23718. protected _geometryRendererShaders: gfx.Shader[];
  23719. protected _occlusionQueryVertexBuffer: gfx.Buffer | null;
  23720. protected _occlusionQueryIndicesBuffer: gfx.Buffer | null;
  23721. protected _occlusionQueryInputAssembler: gfx.InputAssembler | null;
  23722. protected _occlusionQueryMaterial: Material | null;
  23723. protected _occlusionQueryShader: gfx.Shader | null;
  23724. protected _isHDR: boolean;
  23725. protected _shadingScale: number;
  23726. protected _csmSupported: boolean;
  23727. constructor();
  23728. activate(device: gfx.Device): boolean;
  23729. initGeometryRendererMaterials(): void;
  23730. get geometryRendererPasses(): renderer.Pass[];
  23731. get geometryRendererShaders(): gfx.Shader[];
  23732. initOcclusionQuery(): void;
  23733. getOcclusionQueryPass(): renderer.Pass | null;
  23734. updatePipelineSceneData(): void;
  23735. destroy(): void;
  23736. }
  23737. /**
  23738. * @en The forward render pipeline
  23739. * @zh 前向渲染管线。
  23740. */
  23741. export class ForwardPipeline extends RenderPipeline {
  23742. protected renderTextures: __private._cocos_rendering_pipeline_serialization__RenderTextureConfig[];
  23743. protected _postRenderPass: gfx.RenderPass | null;
  23744. get postRenderPass(): gfx.RenderPass | null;
  23745. initialize(info: __private._cocos_rendering_render_pipeline__IRenderPipelineInfo): boolean;
  23746. activate(swapchain: gfx.Swapchain): boolean;
  23747. protected _ensureEnoughSize(cameras: renderer.scene.Camera[]): void;
  23748. destroy(): boolean;
  23749. }
  23750. export function createDefaultPipeline(): ForwardPipeline;
  23751. /**
  23752. * @en The forward flow in forward render pipeline
  23753. * @zh 前向渲染流程。
  23754. */
  23755. export class ForwardFlow extends RenderFlow {
  23756. /**
  23757. * @en The shared initialization information of forward render flow
  23758. * @zh 共享的前向渲染流程初始化参数
  23759. */
  23760. static initInfo: __private._cocos_rendering_render_flow__IRenderFlowInfo;
  23761. initialize(info: __private._cocos_rendering_render_flow__IRenderFlowInfo): boolean;
  23762. activate(pipeline: RenderPipeline): void;
  23763. render(camera: renderer.scene.Camera): void;
  23764. destroy(): void;
  23765. }
  23766. /**
  23767. * @en The forward render stage
  23768. * @zh 前向渲染阶段。
  23769. */
  23770. export class ForwardStage extends RenderStage {
  23771. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23772. protected renderQueues: __private._cocos_rendering_pipeline_serialization__RenderQueueDesc[];
  23773. protected _renderQueues: __private._cocos_rendering_render_queue__RenderQueue[];
  23774. additiveInstanceQueues: __private._cocos_rendering_render_instanced_queue__RenderInstancedQueue[];
  23775. constructor();
  23776. addRenderInstancedQueue(queue: __private._cocos_rendering_render_instanced_queue__RenderInstancedQueue): void;
  23777. removeRenderInstancedQueue(queue: __private._cocos_rendering_render_instanced_queue__RenderInstancedQueue): void;
  23778. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23779. activate(pipeline: ForwardPipeline, flow: ForwardFlow): void;
  23780. destroy(): void;
  23781. render(camera: renderer.scene.Camera): void;
  23782. }
  23783. /**
  23784. * @en The deferred render pipeline
  23785. * @zh 延迟渲染管线。
  23786. */
  23787. export class DeferredPipeline extends RenderPipeline {
  23788. protected renderTextures: __private._cocos_rendering_pipeline_serialization__RenderTextureConfig[];
  23789. initialize(info: __private._cocos_rendering_render_pipeline__IRenderPipelineInfo): boolean;
  23790. activate(swapchain: gfx.Swapchain): boolean;
  23791. destroy(): boolean;
  23792. onGlobalPipelineStateChanged(): void;
  23793. getPipelineRenderData(): __private._cocos_rendering_deferred_deferred_pipeline__DeferredRenderData;
  23794. protected _ensureEnoughSize(cameras: renderer.scene.Camera[]): void;
  23795. }
  23796. /**
  23797. * @en The main flow in deferred render pipeline
  23798. * @zh 延迟渲染流程。
  23799. */
  23800. export class MainFlow extends RenderFlow {
  23801. /**
  23802. * @en The shared initialization information of main render flow
  23803. * @zh 共享的延迟渲染流程初始化参数
  23804. */
  23805. static initInfo: __private._cocos_rendering_render_flow__IRenderFlowInfo;
  23806. initialize(info: __private._cocos_rendering_render_flow__IRenderFlowInfo): boolean;
  23807. activate(pipeline: RenderPipeline): void;
  23808. render(camera: renderer.scene.Camera): void;
  23809. destroy(): void;
  23810. }
  23811. /**
  23812. * @en The gbuffer render stage
  23813. * @zh 前向渲染阶段。
  23814. */
  23815. export class GbufferStage extends RenderStage {
  23816. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23817. protected renderQueues: __private._cocos_rendering_pipeline_serialization__RenderQueueDesc[];
  23818. protected _renderQueues: __private._cocos_rendering_render_queue__RenderQueue[];
  23819. constructor();
  23820. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23821. activate(pipeline: DeferredPipeline, flow: MainFlow): void;
  23822. destroy(): void;
  23823. render(camera: renderer.scene.Camera): void;
  23824. }
  23825. /**
  23826. * @en The lighting render stage
  23827. * @zh 前向渲染阶段。
  23828. */
  23829. export class LightingStage extends RenderStage {
  23830. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23831. constructor();
  23832. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23833. gatherLights(camera: renderer.scene.Camera): void;
  23834. protected _createStageDescriptor(pass: renderer.Pass): void;
  23835. activate(pipeline: DeferredPipeline, flow: MainFlow): void;
  23836. destroy(): void;
  23837. render(camera: renderer.scene.Camera): void;
  23838. }
  23839. /**
  23840. * @en The bloom post-process stage
  23841. * @zh Bloom 后处理阶段。
  23842. */
  23843. export class BloomStage extends RenderStage {
  23844. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23845. threshold: number;
  23846. intensity: number;
  23847. iterations: number;
  23848. constructor();
  23849. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23850. activate(pipeline: RenderPipeline, flow: RenderFlow): void;
  23851. destroy(): void;
  23852. render(camera: renderer.scene.Camera): void;
  23853. }
  23854. /**
  23855. * @en The postprocess render stage
  23856. * @zh 后处理渲染阶段。
  23857. */
  23858. export class PostProcessStage extends RenderStage {
  23859. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23860. constructor();
  23861. initialize(info: __private._cocos_rendering_render_stage__IRenderStageInfo): boolean;
  23862. activate(pipeline: RenderPipeline, flow: RenderFlow): void;
  23863. destroy(): void;
  23864. render(camera: renderer.scene.Camera): void;
  23865. }
  23866. /**
  23867. * @en Shadow map render flow
  23868. * @zh 阴影贴图绘制流程
  23869. */
  23870. export class ShadowFlow extends RenderFlow {
  23871. /**
  23872. * @en A common initialization info for shadow map render flow
  23873. * @zh 一个通用的 ShadowFlow 的初始化信息对象
  23874. */
  23875. static initInfo: __private._cocos_rendering_render_flow__IRenderFlowInfo;
  23876. initialize(info: __private._cocos_rendering_render_flow__IRenderFlowInfo): boolean;
  23877. activate(pipeline: RenderPipeline): void;
  23878. render(camera: renderer.scene.Camera): void;
  23879. destroy(): void;
  23880. /**
  23881. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  23882. */
  23883. _initShadowFrameBuffer(pipeline: RenderPipeline, light: renderer.scene.Light, swapchain: gfx.Swapchain): void;
  23884. }
  23885. /**
  23886. * @en Shadow map render stage
  23887. * @zh 阴影渲染阶段。
  23888. */
  23889. export class ShadowStage extends RenderStage {
  23890. /**
  23891. * @en A common initialization info for shadow map render stage
  23892. * @zh 一个通用的 ShadowStage 的初始化信息对象
  23893. */
  23894. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  23895. /**
  23896. * @en Sets the render shadow map info
  23897. * @zh 设置阴影渲染信息
  23898. * @param light
  23899. * @param shadowFrameBuffer
  23900. * @param level 层级
  23901. */
  23902. setUsage(globalDS: gfx.DescriptorSet, light: renderer.scene.Light, shadowFrameBuffer: gfx.Framebuffer, level?: number): void;
  23903. destroy(): void;
  23904. clearFramebuffer(camera: renderer.scene.Camera): void;
  23905. render(camera: renderer.scene.Camera): void;
  23906. activate(pipeline: ForwardPipeline, flow: ShadowFlow): void;
  23907. }
  23908. export class InstancedBuffer {
  23909. instances: __private._cocos_rendering_instanced_buffer__IInstancedItem[];
  23910. pass: renderer.Pass;
  23911. hasPendingModels: boolean;
  23912. dynamicOffsets: number[];
  23913. constructor(pass: renderer.Pass);
  23914. destroy(): void;
  23915. merge(subModel: renderer.scene.SubModel, passIdx: number, shaderImplant?: gfx.Shader | null): void;
  23916. uploadBuffers(cmdBuff: gfx.CommandBuffer): void;
  23917. clear(): void;
  23918. }
  23919. export class PipelineStateManager {
  23920. static getOrCreatePipelineState(device: gfx.Device, pass: renderer.Pass, shader: gfx.Shader, renderPass: gfx.RenderPass, ia: gfx.InputAssembler): gfx.PipelineState;
  23921. }
  23922. export class PipelineEventProcessor extends EventTarget {
  23923. eventTargetOn: <TFunction extends (...any: any[]) => void>(type: string | number, callback: TFunction, thisArg?: any, once?: boolean | undefined) => TFunction;
  23924. eventTargetOnce: <TFunction extends (...any: any[]) => void>(type: string | number, callback: TFunction, thisArg?: any) => TFunction;
  23925. on(type: PipelineEventType, callback: any, target?: any, once?: boolean): typeof callback;
  23926. once(type: PipelineEventType, callback: any, target?: any): typeof callback;
  23927. }
  23928. export enum PipelineEventType {
  23929. /**
  23930. * @en
  23931. * The event type for render frame begin event
  23932. *
  23933. * @zh
  23934. * 帧渲染开始事件。
  23935. */
  23936. RENDER_FRAME_BEGIN = "render-frame-begin",
  23937. /**
  23938. * @en
  23939. * The event type for render frame end event
  23940. *
  23941. * @zh
  23942. * 帧渲染结束事件。
  23943. */
  23944. RENDER_FRAME_END = "render-frame-end",
  23945. /**
  23946. * @en
  23947. * The event type for render camera begin event
  23948. *
  23949. * @zh
  23950. * 相机渲染开始事件。
  23951. */
  23952. RENDER_CAMERA_BEGIN = "render-camera-begin",
  23953. /**
  23954. * @en
  23955. * The event type for render camera end event
  23956. *
  23957. * @zh
  23958. * 相机渲染结束事件。
  23959. */
  23960. RENDER_CAMERA_END = "render-camera-end",
  23961. /**
  23962. * @en
  23963. * FBO attachment texture zoom event
  23964. *
  23965. * @zh
  23966. * FBO附件纹理缩放事件。
  23967. */
  23968. ATTACHMENT_SCALE_CAHNGED = "attachment-scale-changed"
  23969. }
  23970. /**
  23971. * @en Rendering debug view control class
  23972. * @zh 渲染调试控制类
  23973. */
  23974. export class DebugView {
  23975. /**
  23976. * @en Toggle rendering single debug mode.
  23977. * @zh 设置渲染单项调试模式。
  23978. */
  23979. get singleMode(): __private._cocos_rendering_debug_view__DebugViewSingleType;
  23980. set singleMode(val: __private._cocos_rendering_debug_view__DebugViewSingleType);
  23981. /**
  23982. * @en Toggle normal / pure lighting mode.
  23983. * @zh 切换正常光照和仅光照模式。
  23984. */
  23985. get lightingWithAlbedo(): boolean;
  23986. set lightingWithAlbedo(val: boolean);
  23987. /**
  23988. * @en Toggle CSM layer coloration mode.
  23989. * @zh 切换级联阴影染色调试模式。
  23990. */
  23991. get csmLayerColoration(): boolean;
  23992. set csmLayerColoration(val: boolean);
  23993. get debugViewType(): __private._cocos_rendering_debug_view__RenderingDebugViewType;
  23994. protected _singleMode: __private._cocos_rendering_debug_view__DebugViewSingleType;
  23995. protected _compositeModeValue: number;
  23996. protected _lightingWithAlbedo: boolean;
  23997. protected _csmLayerColoration: boolean;
  23998. constructor();
  23999. /**
  24000. * @en Whether enabled with specified rendering composite debug mode.
  24001. * @zh 获取指定的渲染组合调试模式是否开启。
  24002. * @param Specified composite type.
  24003. */
  24004. isCompositeModeEnabled(val: number): boolean;
  24005. /**
  24006. * @en Toggle specified rendering composite debug mode.
  24007. * @zh 开关指定的渲染组合调试模式。
  24008. * @param Specified composite type, enable or disable.
  24009. */
  24010. enableCompositeMode(val: __private._cocos_rendering_debug_view__DebugViewCompositeType, enable: boolean): void;
  24011. /**
  24012. * @en Toggle all rendering composite debug mode.
  24013. * @zh 开关所有的渲染组合调试模式。
  24014. */
  24015. enableAllCompositeMode(enable: boolean): void;
  24016. /**
  24017. * @en Get rendering debug view on / off state.
  24018. * @zh 查询当前是否开启了渲染调试模式。
  24019. */
  24020. isEnabled(): boolean;
  24021. /**
  24022. * @en Disable all debug view modes, reset to standard rendering mode.
  24023. * @zh 关闭所有的渲染调试模式,恢复到正常渲染。
  24024. */
  24025. reset(): void;
  24026. /**
  24027. * @internal
  24028. */
  24029. protected _activate(): void;
  24030. protected _updatePipeline(): void;
  24031. }
  24032. /**
  24033. * @en reflection probe render flow
  24034. * @zh 反射探针rendertexture绘制流程
  24035. */
  24036. export class ReflectionProbeFlow extends RenderFlow {
  24037. static initInfo: __private._cocos_rendering_render_flow__IRenderFlowInfo;
  24038. initialize(info: __private._cocos_rendering_render_flow__IRenderFlowInfo): boolean;
  24039. activate(pipeline: RenderPipeline): void;
  24040. render(camera: renderer.scene.Camera): void;
  24041. destroy(): void;
  24042. }
  24043. /**
  24044. * @en reflection probe render stage
  24045. * @zh 反射探针渲染阶段。
  24046. */
  24047. export class ReflectionProbeStage extends RenderStage {
  24048. /**
  24049. * @en A common initialization info for reflection probe render stage
  24050. * @zh 一个通用的 reflection probe stage 的初始化信息对象
  24051. */
  24052. static initInfo: __private._cocos_rendering_render_stage__IRenderStageInfo;
  24053. /**
  24054. * @en Sets the probe info
  24055. * @zh 设置probe信息
  24056. * @param probe
  24057. * @param frameBuffer
  24058. */
  24059. setUsageInfo(probe: renderer.scene.ReflectionProbe, frameBuffer: gfx.Framebuffer): void;
  24060. destroy(): void;
  24061. clearFramebuffer(camera: renderer.scene.Camera): void;
  24062. render(camera: renderer.scene.Camera): void;
  24063. activate(pipeline: ForwardPipeline, flow: ReflectionProbeFlow): void;
  24064. }
  24065. export const getPhaseID: (phaseName: string | number) => number;
  24066. export class ForwardPipelineBuilder implements rendering.PipelineBuilder {
  24067. setup(cameras: renderer.scene.Camera[], ppl: rendering.BasicPipeline): void;
  24068. }
  24069. export class DeferredPipelineBuilder implements rendering.PipelineBuilder {
  24070. setup(cameras: renderer.scene.Camera[], ppl: rendering.BasicPipeline): void;
  24071. }
  24072. /**
  24073. * @zh
  24074. * 场景树中的基本节点,基本特性有:
  24075. * * 具有层级关系
  24076. * * 持有各类组件
  24077. * * 维护空间变换(坐标、旋转、缩放)信息
  24078. */
  24079. /**
  24080. * @en
  24081. * Class of all entities in Cocos Creator scenes.
  24082. * Basic functionalities include:
  24083. * * Hierarchy management with parent and children
  24084. * * Components management
  24085. * * Coordinate system with position, scale, rotation in 3d space
  24086. * @zh
  24087. * Cocos Creator 场景中的所有节点类。
  24088. * 基本特性有:
  24089. * * 具有层级关系
  24090. * * 持有各类组件
  24091. * * 维护 3D 空间左边变换(坐标、旋转、缩放)信息
  24092. */
  24093. export class Node extends CCObject implements ISchedulable, CustomSerializable {
  24094. /**
  24095. * @en Gets all components attached to this node.
  24096. * @zh 获取附加到此节点的所有组件。
  24097. */
  24098. get components(): ReadonlyArray<Component>;
  24099. /**
  24100. * @en If true, the node is an persist node which won't be destroyed during scene transition.
  24101. * If false, the node will be destroyed automatically when loading a new scene. Default is false.
  24102. * @zh 如果为true,则该节点是一个常驻节点,不会在场景转换期间被销毁。
  24103. * 如果为false,节点将在加载新场景时自动销毁。默认为 false。
  24104. * @default false
  24105. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24106. */
  24107. get _persistNode(): boolean;
  24108. set _persistNode(value: boolean);
  24109. /**
  24110. * @en Name of node.
  24111. * @zh 该节点名称。
  24112. */
  24113. get name(): string;
  24114. set name(value: string);
  24115. /**
  24116. * @en The uuid for editor, will be stripped after building project.
  24117. * @zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。
  24118. * @readOnly
  24119. */
  24120. get uuid(): string;
  24121. /**
  24122. * @en All children nodes.
  24123. * @zh 节点的所有子节点。
  24124. * @readOnly
  24125. */
  24126. get children(): Node[];
  24127. /**
  24128. * @en
  24129. * The local active state of this node.
  24130. * Note that a Node may be inactive because a parent is not active, even if this returns true.
  24131. * Use [[activeInHierarchy]]
  24132. * if you want to check if the Node is actually treated as active in the scene.
  24133. * @zh
  24134. * 当前节点的自身激活状态。
  24135. * 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。
  24136. * 如果你想检查节点在场景中实际的激活状态可以使用 [[activeInHierarchy]]
  24137. * @default true
  24138. */
  24139. get active(): boolean;
  24140. set active(isActive: boolean);
  24141. /**
  24142. * @en Indicates whether this node is active in the scene.
  24143. * @zh 表示此节点是否在场景中激活。
  24144. */
  24145. get activeInHierarchy(): boolean;
  24146. /**
  24147. * @en The parent node
  24148. * @zh 父节点
  24149. */
  24150. get parent(): Node | null;
  24151. set parent(value: Node | null);
  24152. /**
  24153. * @en Which scene this node belongs to.
  24154. * @zh 此节点属于哪个场景。
  24155. * @readonly
  24156. */
  24157. get scene(): Scene;
  24158. /**
  24159. * @en The event processor of the current node, it provides EventTarget ability.
  24160. * @zh 当前节点的事件处理器,提供 EventTarget 能力。
  24161. * @readonly
  24162. *
  24163. * @deprecated since v3.4.0
  24164. */
  24165. get eventProcessor(): __private._cocos_scene_graph_node_event_processor__NodeEventProcessor;
  24166. /**
  24167. * @internal
  24168. */
  24169. protected static idGenerator: js.IDGenerator;
  24170. /**
  24171. * for walk
  24172. * @internal
  24173. */
  24174. protected static _stacks: Array<Array<(Node | null)>>;
  24175. /**
  24176. * @internal
  24177. */
  24178. protected static _stackId: number;
  24179. /**
  24180. * Call `_updateScene` of specified node.
  24181. * @internal
  24182. * @param node The node.
  24183. */
  24184. protected static _setScene(node: Node): void;
  24185. protected static _findComponent<T extends Component>(node: Node, constructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T | null;
  24186. protected static _findComponents<T extends Component>(node: Node, constructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>, components: Component[]): void;
  24187. protected static _findChildComponent<T extends Component>(children: Node[], constructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T | null;
  24188. protected static _findChildComponents(children: Node[], constructor: any, components: any): void;
  24189. protected _parent: this | null;
  24190. protected _children: this[];
  24191. protected _active: boolean;
  24192. protected _components: Component[];
  24193. /**
  24194. * TODO(PP_Pro): this property should be exported to editor only, we should support editorOnly tag.
  24195. * Tracking issue: https://github.com/cocos/cocos-engine/issues/14613
  24196. */
  24197. protected _prefab: Prefab._utils.PrefabInfo | null;
  24198. protected _scene: Scene;
  24199. protected _activeInHierarchy: boolean;
  24200. protected _id: string;
  24201. protected _name: string;
  24202. protected _eventProcessor: __private._cocos_scene_graph_node_event_processor__NodeEventProcessor;
  24203. protected _eventMask: number;
  24204. protected _siblingIndex: number;
  24205. /**
  24206. * @en
  24207. * record scene's id when set this node as persist node
  24208. * @zh
  24209. * 当设置节点为常驻节点时记录场景的 id
  24210. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24211. */
  24212. _originalSceneId: string;
  24213. /**
  24214. * Set `_scene` field of this node.
  24215. * The derived `Scene` overrides this method to behavior differently.
  24216. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24217. */
  24218. protected _updateScene(): void;
  24219. /**
  24220. * @en
  24221. * Properties configuration function.
  24222. * All properties in attrs will be set to the node,
  24223. * when the setter of the node is available,
  24224. * the property will be set via setter function.
  24225. * @zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  24226. * @param attrs - Properties to be set to node
  24227. * @example
  24228. * ```
  24229. * var attrs = { name: 'New Name', active: false };
  24230. * node.attr(attrs);
  24231. * ```
  24232. */
  24233. attr(attrs: unknown): void;
  24234. /**
  24235. * @en Get parent of the node.
  24236. * @zh 获取该节点的父节点。
  24237. */
  24238. getParent(): Node | null;
  24239. /**
  24240. * @en Set parent of the node.
  24241. * @zh 设置该节点的父节点。
  24242. * @param value Parent node
  24243. * @param keepWorldTransform Whether keep node's current world transform unchanged after this operation
  24244. */
  24245. setParent(value: Node | null, keepWorldTransform?: boolean): void;
  24246. /**
  24247. * @en Returns a child with the same uuid.
  24248. * @zh 通过 uuid 获取节点的子节点。
  24249. * @param uuid - The uuid to find the child node.
  24250. * @return a Node whose uuid equals to the input parameter
  24251. */
  24252. getChildByUuid(uuid: string): Node | null;
  24253. /**
  24254. * @en Returns a child with the same name.
  24255. * @zh 通过名称获取节点的子节点。
  24256. * @param name - A name to find the child node.
  24257. * @return a CCNode object whose name equals to the input parameter
  24258. * @example
  24259. * ```
  24260. * var child = node.getChildByName("Test Node");
  24261. * ```
  24262. */
  24263. getChildByName(name: string): Node | null;
  24264. /**
  24265. * @en Returns a child with the given path.
  24266. * @zh 通过路径获取节点的子节点。
  24267. * @param path - A path to find the child node.
  24268. * @return a Node object whose path equals to the input parameter
  24269. * @example
  24270. * ```
  24271. * var child = node.getChildByPath("subNode/Test Node");
  24272. * ```
  24273. */
  24274. getChildByPath(path: string): Node | null;
  24275. /**
  24276. * @en Add a child to the current node.
  24277. * @zh 添加一个子节点。
  24278. * @param child - the child node to be added
  24279. */
  24280. addChild(child: Node): void;
  24281. /**
  24282. * @en Inserts a child to the node at a specified index.
  24283. * @zh 插入子节点到指定位置
  24284. * @param child - the child node to be inserted
  24285. * @param siblingIndex - the sibling index to place the child in
  24286. * @example
  24287. * ```
  24288. * node.insertChild(child, 2);
  24289. * ```
  24290. */
  24291. insertChild(child: Node, siblingIndex: number): void;
  24292. /**
  24293. * @en Get the sibling index of the current node in its parent's children array.
  24294. * @zh 获取当前节点在父节点的 children 数组中的位置。
  24295. */
  24296. getSiblingIndex(): number;
  24297. /**
  24298. * @en Set the sibling index of the current node in its parent's children array.
  24299. * @zh 设置当前节点在父节点的 children 数组中的位置。
  24300. */
  24301. setSiblingIndex(index: number): void;
  24302. /**
  24303. * @en Walk though the sub children tree of the current node.
  24304. * Each node, including the current node, in the sub tree will be visited two times,
  24305. * before all children and after all children.
  24306. * This function call is not recursive, it's based on stack.
  24307. * Please don't walk any other node inside the walk process.
  24308. * @zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  24309. * 对子树中的所有节点,包含当前节点,会执行两次回调,preFunc 会在访问它的子节点之前调用,postFunc 会在访问所有子节点之后调用。
  24310. * 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  24311. * 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  24312. * @param preFunc The callback to process node when reach the node for the first time
  24313. * @param postFunc The callback to process node when re-visit the node after walked all children in its sub tree
  24314. * @example
  24315. * ```
  24316. * node.walk(function (target) {
  24317. * console.log('Walked through node ' + target.name + ' for the first time');
  24318. * }, function (target) {
  24319. * console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  24320. * });
  24321. * ```
  24322. */
  24323. walk(preFunc: (target: this) => void, postFunc?: (target: this) => void): void;
  24324. /**
  24325. * @en
  24326. * Remove itself from its parent node.
  24327. * If the node have no parent, then nothing happens.
  24328. * @zh
  24329. * 从父节点中删除该节点。
  24330. * 如果这个节点是一个孤立节点,那么什么都不会发生。
  24331. */
  24332. removeFromParent(): void;
  24333. /**
  24334. * @en Removes a child from the container.
  24335. * @zh 移除节点中指定的子节点。
  24336. * @param child - The child node which will be removed.
  24337. */
  24338. removeChild(child: this | Node): void;
  24339. /**
  24340. * @en Removes all children from the container.
  24341. * @zh 移除节点所有的子节点。
  24342. */
  24343. removeAllChildren(): void;
  24344. /**
  24345. * @en Is this node a child of the given node?
  24346. * @zh 是否是指定节点的子节点?
  24347. * @return True if this node is a child, deep child or identical to the given node.
  24348. */
  24349. isChildOf(parent: this | Scene | null): boolean;
  24350. /**
  24351. * @en
  24352. * Returns the component of supplied type if the node has one attached, null if it doesn't.
  24353. * You can also get component in the node by passing in the name of the script.
  24354. * @zh
  24355. * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。
  24356. * 传入参数也可以是脚本的名称。
  24357. * @param classConstructor The class of the target component
  24358. * @example
  24359. * ```
  24360. * // get sprite component.
  24361. * var sprite = node.getComponent(Sprite);
  24362. * ```
  24363. */
  24364. getComponent<T extends Component>(classConstructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T | null;
  24365. /**
  24366. * @en
  24367. * Returns the component of supplied type if the node has one attached, null if it doesn't.
  24368. * You can also get component in the node by passing in the name of the script.
  24369. * @zh
  24370. * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。
  24371. * 传入参数也可以是脚本的名称。
  24372. * @param className The class name of the target component
  24373. * @example
  24374. * ```
  24375. * // get custom test class.
  24376. * var test = node.getComponent("Test");
  24377. * ```
  24378. */
  24379. getComponent(className: string): Component | null;
  24380. /**
  24381. * @en Returns all components of given type in the node.
  24382. * @zh 返回节点上指定类型的所有组件。
  24383. * @param classConstructor The class of the target component
  24384. */
  24385. getComponents<T extends Component>(classConstructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T[];
  24386. /**
  24387. * @en Returns all components of given type in the node.
  24388. * @zh 返回节点上指定类型的所有组件。
  24389. * @param className The class name of the target component
  24390. */
  24391. getComponents(className: string): Component[];
  24392. /**
  24393. * @en Returns the component of given type in any of its children using depth first search.
  24394. * @zh 递归查找所有子节点中第一个匹配指定类型的组件。
  24395. * @param classConstructor The class of the target component
  24396. * @example
  24397. * ```
  24398. * var sprite = node.getComponentInChildren(Sprite);
  24399. * ```
  24400. */
  24401. getComponentInChildren<T extends Component>(classConstructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T | null;
  24402. /**
  24403. * @en Returns the component of given type in any of its children using depth first search.
  24404. * @zh 递归查找所有子节点中第一个匹配指定类型的组件。
  24405. * @param className The class name of the target component
  24406. * @example
  24407. * ```
  24408. * var Test = node.getComponentInChildren("Test");
  24409. * ```
  24410. */
  24411. getComponentInChildren(className: string): Component | null;
  24412. /**
  24413. * @en Returns all components of given type in self or any of its children.
  24414. * @zh 递归查找自身或所有子节点中指定类型的组件
  24415. * @param classConstructor The class of the target component
  24416. * @example
  24417. * ```
  24418. * var sprites = node.getComponentsInChildren(Sprite);
  24419. * ```
  24420. */
  24421. getComponentsInChildren<T extends Component>(classConstructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): T[];
  24422. /**
  24423. * @en Returns all components of given type in self or any of its children.
  24424. * @zh 递归查找自身或所有子节点中指定类型的组件
  24425. * @param className The class name of the target component
  24426. * @example
  24427. * ```
  24428. * var tests = node.getComponentsInChildren("Test");
  24429. * ```
  24430. */
  24431. getComponentsInChildren(className: string): Component[];
  24432. /**
  24433. * @en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  24434. * @zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  24435. * @param classConstructor The class of the component to add
  24436. * @throws `TypeError` if the `classConstructor` does not specify a cc-class constructor extending the `Component`.
  24437. * @example
  24438. * ```
  24439. * var sprite = node.addComponent(Sprite);
  24440. * ```
  24441. */
  24442. addComponent<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T;
  24443. /**
  24444. * @en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  24445. * @zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  24446. * @param className The class name of the component to add
  24447. * @throws `TypeError` if the `className` does not specify a cc-class constructor extending the `Component`.
  24448. * @example
  24449. * ```
  24450. * var test = node.addComponent("Test");
  24451. * ```
  24452. */
  24453. addComponent(className: string): Component;
  24454. /**
  24455. * @en
  24456. * Removes a component identified by the given name or removes the component object given.
  24457. * You can also use component.destroy() if you already have the reference.
  24458. * @zh
  24459. * 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  24460. * 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  24461. * @param classConstructor The class of the component to remove
  24462. * @deprecated please destroy the component to remove it.
  24463. * @example
  24464. * ```
  24465. * node.removeComponent(Sprite);
  24466. * ```
  24467. */
  24468. removeComponent<T extends Component>(classConstructor: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>): void;
  24469. /**
  24470. * @en
  24471. * Removes a component identified by the given name or removes the component object given.
  24472. * You can also use component.destroy() if you already have the reference.
  24473. * @zh
  24474. * 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  24475. * 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  24476. * @param classNameOrInstance The class name of the component to remove or the component instance to be removed
  24477. * @deprecated please destroy the component to remove it.
  24478. * @example
  24479. * ```
  24480. * import { Sprite } from 'cc';
  24481. * const sprite = node.getComponent(Sprite);
  24482. * if (sprite) {
  24483. * node.removeComponent(sprite);
  24484. * }
  24485. * node.removeComponent('Sprite');
  24486. * ```
  24487. */
  24488. removeComponent(classNameOrInstance: string | Component): void;
  24489. /**
  24490. * @en
  24491. * Register a callback of a specific event type on Node.
  24492. * Use this method to register touch or mouse event permit propagation based on scene graph,
  24493. * These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:
  24494. * 1. Capturing phase: dispatch in capture targets, e.g. parents in node tree, from root to the real target
  24495. * 2. At target phase: dispatch to the listeners of the real target
  24496. * 3. Bubbling phase: dispatch in bubble targets, e.g. parents in node tree, from the real target to root
  24497. * In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmediate()`.
  24498. * You can also register custom event and use `emit` to trigger custom event on Node.
  24499. * For such events, there won't be capturing and bubbling phase,
  24500. * your event will be dispatched directly to its listeners registered on the same node.
  24501. * You can also pass event callback parameters with `emit` by passing parameters after `type`.
  24502. * @zh
  24503. * 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。
  24504. * 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:
  24505. * 1. 捕获阶段:派发事件给捕获目标,比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。
  24506. * 2. 目标阶段:派发给目标节点的监听器。
  24507. * 3. 冒泡阶段:派发事件给冒泡目标,比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发直到根节点。
  24508. * 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。
  24509. * 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器
  24510. * 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  24511. * @param type - A string representing the event type to listen for.<br>See [[Node.EventType.POSITION_CHANGED]] for all builtin events.
  24512. * @param callback - The callback that will be invoked when the event is dispatched.
  24513. * The callback is ignored if it is a duplicate (the callbacks are unique).
  24514. * @param target - The target (this object) to invoke the callback, can be null
  24515. * @param useCapture - When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit,
  24516. * otherwise it will be triggered during bubbling phase.
  24517. * @return - Just returns the incoming callback so you can save the anonymous function easier.
  24518. * @example
  24519. * ```ts
  24520. * this.node.on(NodeEventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  24521. * node.on(NodeEventType.TOUCH_START, callback, this);
  24522. * node.on(NodeEventType.TOUCH_MOVE, callback, this);
  24523. * node.on(NodeEventType.TOUCH_END, callback, this);
  24524. * ```
  24525. */
  24526. on(type: string | NodeEventType, callback: __private.__types_globals__AnyFunction, target?: unknown, useCapture?: any): void;
  24527. /**
  24528. * @en
  24529. * Removes the callback previously registered with the same type, callback, target and or useCapture.
  24530. * This method is merely an alias to removeEventListener.
  24531. * @zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  24532. * @param type - A string representing the event type being removed.
  24533. * @param callback - The callback to remove.
  24534. * @param target - The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  24535. * @param useCapture - When set to true, the listener will be triggered at capturing phase
  24536. * which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
  24537. * @example
  24538. * ```ts
  24539. * this.node.off(NodeEventType.TOUCH_START, this.memberFunction, this);
  24540. * node.off(NodeEventType.TOUCH_START, callback, this.node);
  24541. * ```
  24542. */
  24543. off(type: string, callback?: __private.__types_globals__AnyFunction, target?: unknown, useCapture?: any): void;
  24544. /**
  24545. * @en
  24546. * Register an callback of a specific event type on the Node,
  24547. * the callback will remove itself after the first time it is triggered.
  24548. * @zh
  24549. * 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  24550. *
  24551. * @param type - A string representing the event type to listen for.
  24552. * @param callback - The callback that will be invoked when the event is dispatched.
  24553. * The callback is ignored if it is a duplicate (the callbacks are unique).
  24554. * @param target - The target (this object) to invoke the callback, can be null
  24555. */
  24556. once(type: string, callback: __private.__types_globals__AnyFunction, target?: unknown, useCapture?: any): void;
  24557. /**
  24558. * @en
  24559. * Trigger an event directly with the event name and necessary arguments.
  24560. * @zh
  24561. * 通过事件名发送自定义事件
  24562. * @param type - event type
  24563. * @param arg1 - First argument in callback
  24564. * @param arg2 - Second argument in callback
  24565. * @param arg3 - Third argument in callback
  24566. * @param arg4 - Fourth argument in callback
  24567. * @param arg5 - Fifth argument in callback
  24568. * @example
  24569. * ```ts
  24570. * eventTarget.emit('fire', event);
  24571. * eventTarget.emit('fire', message, emitter);
  24572. * ```
  24573. */
  24574. emit(type: string, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void;
  24575. /**
  24576. * @en
  24577. * Dispatches an event into the event flow.
  24578. * The event target is the EventTarget object upon which the dispatchEvent() method is called.
  24579. * @zh 分发事件到事件流中。
  24580. * @param event - The Event object that is dispatched into the event flow
  24581. */
  24582. dispatchEvent(event: Event): void;
  24583. /**
  24584. * @en Checks whether the EventTarget object has any callback registered for a specific type of event.
  24585. * @zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  24586. * @param type - The type of event.
  24587. * @param callback - The callback function of the event listener, if absent all event listeners for the given type will be removed
  24588. * @param target - The callback callee of the event listener
  24589. * @return True if a callback of the specified type is registered; false otherwise.
  24590. */
  24591. hasEventListener(type: string, callback?: __private.__types_globals__AnyFunction, target?: unknown): any;
  24592. /**
  24593. * @en Removes all callbacks previously registered with the same target.
  24594. * @zh 移除目标上的所有注册事件。
  24595. * @param target - The target to be searched for all related callbacks
  24596. */
  24597. targetOff(target: string | unknown): void;
  24598. destroy(): boolean;
  24599. /**
  24600. * @en
  24601. * Destroy all children from the node, and release all their own references to other objects.
  24602. * Actual destruct operation will delayed until before rendering.
  24603. * @zh
  24604. * 销毁所有子节点,并释放所有它们对其它对象的引用。
  24605. * 实际销毁操作会延迟到当前帧渲染前执行。
  24606. */
  24607. destroyAllChildren(): void;
  24608. /**
  24609. * Do remove component, only used internally.
  24610. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24611. */
  24612. _removeComponent(component: Component): void;
  24613. /**
  24614. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24615. */
  24616. _updateSiblingIndex(): void;
  24617. protected _instantiate(cloned: any, isSyncedNode: any): any;
  24618. protected _onHierarchyChangedBase(oldParent: this | null): void;
  24619. protected _onPreDestroyBase(): boolean;
  24620. protected _onSiblingIndexChanged?(siblingIndex: number): void;
  24621. /**
  24622. * @en
  24623. * Ensures that this node has already had the specified component(s). If not, this method throws.
  24624. * @zh
  24625. * 检查节点已经包含对应的组件,如果没有,则抛出异常
  24626. * @param constructor Constructor of the component.
  24627. * @throws If one or more component of same type have been existed in this node.
  24628. */
  24629. protected _checkMultipleComp?<T extends Component>(constructor: __private.__types_globals__Constructor<T>): void;
  24630. /**
  24631. * @en Event types emitted by Node
  24632. * @zh 节点可能发出的事件类型
  24633. */
  24634. static EventType: typeof NodeEventType;
  24635. /**
  24636. * @en Coordinates space
  24637. * @zh 空间变换操作的坐标系
  24638. */
  24639. static NodeSpace: typeof NodeSpace;
  24640. /**
  24641. * @en Bit masks for Node transformation parts
  24642. * @zh 节点变换更新的具体部分
  24643. * @deprecated please use [[Node.TransformBit]]
  24644. */
  24645. static TransformDirtyBit: typeof TransformBit;
  24646. /**
  24647. * @en Bit masks for Node transformation parts, can be used to determine which part changed in [[NodeEventType.TRANSFORM_CHANGED]] event
  24648. * @zh 节点变换更新的具体部分,可用于判断 [[NodeEventType.TRANSFORM_CHANGED]] 事件的具体类型
  24649. */
  24650. static TransformBit: typeof TransformBit;
  24651. /**
  24652. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24653. */
  24654. static reserveContentsForAllSyncablePrefabTag: symbol;
  24655. /**
  24656. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24657. */
  24658. _uiProps: __private._cocos_scene_graph_node_ui_properties__NodeUIProperties;
  24659. /**
  24660. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24661. */
  24662. _static: boolean;
  24663. protected _lpos: math.Vec3;
  24664. protected _lrot: math.Quat;
  24665. protected _lscale: math.Vec3;
  24666. protected _mobility: number;
  24667. protected _layer: number;
  24668. protected _euler: math.Vec3;
  24669. protected _transformFlags: TransformBit;
  24670. protected _eulerDirty: boolean;
  24671. protected _flagChangeVersion: number;
  24672. protected _hasChangedFlags: number;
  24673. constructor(name?: string);
  24674. /**
  24675. * @en Determine whether the given object is a normal Node. Will return false if [[Scene]] given.
  24676. * @zh 指定对象是否是普通的节点?如果传入 [[Scene]] 会返回 false。
  24677. */
  24678. static isNode(obj: unknown): obj is Node;
  24679. protected _onPreDestroy(): boolean;
  24680. /**
  24681. * @en Position in local coordinate system
  24682. * @zh 本地坐标系下的坐标
  24683. */
  24684. get position(): Readonly<math.Vec3>;
  24685. set position(val: Readonly<math.Vec3>);
  24686. /**
  24687. * @en Position in world coordinate system
  24688. * @zh 世界坐标系下的坐标
  24689. */
  24690. get worldPosition(): Readonly<math.Vec3>;
  24691. set worldPosition(val: Readonly<math.Vec3>);
  24692. /**
  24693. * @en Rotation in local coordinate system, represented by a quaternion
  24694. * @zh 本地坐标系下的旋转,用四元数表示
  24695. */
  24696. get rotation(): Readonly<math.Quat>;
  24697. set rotation(val: Readonly<math.Quat>);
  24698. /**
  24699. * @en Rotation in local coordinate system, represented by euler angles
  24700. * @zh 本地坐标系下的旋转,用欧拉角表示
  24701. */
  24702. set eulerAngles(val: Readonly<math.Vec3>);
  24703. get eulerAngles(): Readonly<math.Vec3>;
  24704. /**
  24705. * @en Rotation in local coordinate system, represented by euler angles, but limited on z axis
  24706. * @zh 本地坐标系下的旋转,用欧拉角表示,但是限定在 z 轴上。
  24707. */
  24708. get angle(): number;
  24709. set angle(val: number);
  24710. /**
  24711. * @en Rotation in world coordinate system, represented by a quaternion
  24712. * @zh 世界坐标系下的旋转,用四元数表示
  24713. */
  24714. get worldRotation(): Readonly<math.Quat>;
  24715. set worldRotation(val: Readonly<math.Quat>);
  24716. /**
  24717. * @en Scale in local coordinate system
  24718. * @zh 本地坐标系下的缩放
  24719. */
  24720. get scale(): Readonly<math.Vec3>;
  24721. set scale(val: Readonly<math.Vec3>);
  24722. /**
  24723. * @en Scale in world coordinate system
  24724. * @zh 世界坐标系下的缩放
  24725. */
  24726. get worldScale(): Readonly<math.Vec3>;
  24727. set worldScale(val: Readonly<math.Vec3>);
  24728. /**
  24729. * @en Local transformation matrix
  24730. * @zh 本地坐标系变换矩阵
  24731. */
  24732. set matrix(val: Readonly<math.Mat4>);
  24733. /**
  24734. * @en World transformation matrix
  24735. * @zh 世界坐标系变换矩阵
  24736. */
  24737. get worldMatrix(): Readonly<math.Mat4>;
  24738. /**
  24739. * @en The vector representing forward direction in local coordinate system, it's the minus z direction by default
  24740. * @zh 当前节点面向的前方方向,默认前方为 -z 方向
  24741. */
  24742. get forward(): math.Vec3;
  24743. set forward(dir: math.Vec3);
  24744. /**
  24745. * @en Return the up direction vertor of this node in world space.
  24746. * @zh 返回当前节点在世界空间中朝上的方向向量
  24747. */
  24748. get up(): math.Vec3;
  24749. /**
  24750. * @en Return the right direction vector of this node in world space.
  24751. * @zh 返回当前节点在世界空间中朝右的方向向量
  24752. */
  24753. get right(): math.Vec3;
  24754. set mobility(m: number);
  24755. get mobility(): number;
  24756. /**
  24757. * @en Layer of the current Node, it affects raycast, physics etc, refer to [[Layers]]
  24758. * @zh 节点所属层,主要影响射线检测、物理碰撞等,参考 [[Layers]]
  24759. */
  24760. set layer(l: number);
  24761. get layer(): number;
  24762. /**
  24763. * @en Whether the node's transformation have changed during the current frame.
  24764. * @zh 这个节点的空间变换信息在当前帧内是否有变过?
  24765. */
  24766. get hasChangedFlags(): number;
  24767. set hasChangedFlags(val: number);
  24768. /**
  24769. * @internal
  24770. */
  24771. [serializeTag](serializationOutput: SerializationOutput, context: SerializationContext): void;
  24772. /**
  24773. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24774. */
  24775. _onSetParent(oldParent: this | null, keepWorldTransform?: boolean): void;
  24776. protected _onHierarchyChanged(oldParent: this | null): void;
  24777. /**
  24778. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24779. */
  24780. _onBatchCreated(dontSyncChildPrefab: boolean): void;
  24781. /**
  24782. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24783. */
  24784. _onBeforeSerialize(): void;
  24785. /**
  24786. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  24787. */
  24788. _onPostActivated(active: boolean): void;
  24789. /**
  24790. * @en Perform a translation on the node
  24791. * @zh 移动节点
  24792. * @param trans The increment on position
  24793. * @param ns The operation coordinate space
  24794. */
  24795. translate(trans: math.Vec3, ns?: NodeSpace): void;
  24796. /**
  24797. * @en Perform a rotation on the node
  24798. * @zh 旋转节点
  24799. * @param rot The increment on rotation
  24800. * @param ns The operation coordinate space
  24801. */
  24802. rotate(rot: math.Quat, ns?: NodeSpace): void;
  24803. /**
  24804. * @en Set the orientation of the node to face the target position, the node is facing minus z direction by default
  24805. * @zh 设置当前节点旋转为面向目标位置,默认前方为 -z 方向
  24806. * @param pos Target position
  24807. * @param up Up direction
  24808. */
  24809. lookAt(pos: Readonly<math.Vec3>, up?: Readonly<math.Vec3>): void;
  24810. /**
  24811. * @en Invalidate the world transform information
  24812. * for this node and all its children recursively
  24813. * @zh 递归标记节点世界变换为 dirty
  24814. * @param dirtyBit The dirty bits to setup to children, can be composed with multiple dirty bits
  24815. */
  24816. invalidateChildren(dirtyBit: TransformBit): void;
  24817. /**
  24818. * @en Update the world transform information if outdated
  24819. * @zh 更新节点的世界变换信息
  24820. */
  24821. updateWorldTransform(): void;
  24822. /**
  24823. * @en Set position in local coordinate system
  24824. * @zh 设置本地坐标
  24825. * @param position Target position
  24826. */
  24827. setPosition(position: Readonly<math.Vec3>): void;
  24828. /**
  24829. * @en Set position in local coordinate system
  24830. * @zh 设置本地坐标
  24831. * @param x X axis position
  24832. * @param y Y axis position
  24833. * @param z Z axis position
  24834. */
  24835. setPosition(x: number, y: number, z?: number): void;
  24836. /**
  24837. * @en Get position in local coordinate system, please try to pass `out` vector and reuse it to avoid garbage.
  24838. * @zh 获取本地坐标,注意,尽可能传递复用的 [[Vec3]] 以避免产生垃圾。
  24839. * @param out Set the result to out vector
  24840. * @return If `out` given, the return value equals to `out`, otherwise a new vector will be generated and return
  24841. */
  24842. getPosition(out?: math.Vec3): math.Vec3;
  24843. /**
  24844. * @en Set rotation in local coordinate system with a quaternion representing the rotation.
  24845. * Please make sure the rotation is normalized.
  24846. * @zh 用四元数设置本地旋转, 请确保设置的四元数已归一化。
  24847. * @param rotation Rotation in quaternion
  24848. */
  24849. setRotation(rotation: Readonly<math.Quat>): void;
  24850. /**
  24851. * @en Set rotation in local coordinate system with a quaternion representing the rotation.
  24852. * Please make sure the rotation is normalized.
  24853. * @zh 用四元数设置本地旋转, 请确保设置的四元数已归一化。
  24854. * @param x X value in quaternion
  24855. * @param y Y value in quaternion
  24856. * @param z Z value in quaternion
  24857. * @param w W value in quaternion
  24858. */
  24859. setRotation(x: number, y: number, z: number, w: number): void;
  24860. /**
  24861. * @en Set rotation in local coordinate system with a vector representing euler angles
  24862. * @zh 用欧拉角设置本地旋转
  24863. * @param rotation Rotation in vector
  24864. */
  24865. setRotationFromEuler(rotation: math.Vec3): void;
  24866. /**
  24867. * @en Set rotation in local coordinate system with euler angles
  24868. * @zh 用欧拉角设置本地旋转
  24869. * @param x X axis rotation
  24870. * @param y Y axis rotation
  24871. * @param z Z axis rotation
  24872. */
  24873. setRotationFromEuler(x: number, y: number, zOpt?: number): void;
  24874. /**
  24875. * @en Get rotation as quaternion in local coordinate system, please try to pass `out` quaternion and reuse it to avoid garbage.
  24876. * @zh 获取本地旋转,注意,尽可能传递复用的 [[Quat]] 以避免产生垃圾。
  24877. * @param out Set the result to out quaternion
  24878. * @return If `out` given, the return value equals to `out`, otherwise a new quaternion will be generated and return
  24879. */
  24880. getRotation(out?: math.Quat): math.Quat;
  24881. /**
  24882. * @en Set scale in local coordinate system
  24883. * @zh 设置本地缩放
  24884. * @param scale Target scale
  24885. */
  24886. setScale(scale: Readonly<math.Vec3>): void;
  24887. /**
  24888. * @en Set scale in local coordinate system
  24889. * @zh 设置本地缩放
  24890. * @param x X axis scale
  24891. * @param y Y axis scale
  24892. * @param z Z axis scale
  24893. */
  24894. setScale(x: number, y: number, z?: number): void;
  24895. /**
  24896. * @en Get scale in local coordinate system, please try to pass `out` vector and reuse it to avoid garbage.
  24897. * @zh 获取本地缩放,注意,尽可能传递复用的 [[Vec3]] 以避免产生垃圾。
  24898. * @param out Set the result to out vector
  24899. * @return If `out` given, the return value equals to `out`, otherwise a new vector will be generated and return
  24900. */
  24901. getScale(out?: math.Vec3): math.Vec3;
  24902. /**
  24903. * @en Inversely transform a point from world coordinate system to local coordinate system.
  24904. * @zh 逆向变换一个空间点,一般用于将世界坐标转换到本地坐标系中。
  24905. * @param out The result point in local coordinate system will be stored in this vector
  24906. * @param p A position in world coordinate system
  24907. */
  24908. inverseTransformPoint(out: math.Vec3, p: math.Vec3): math.Vec3;
  24909. /**
  24910. * @en Set position in world coordinate system
  24911. * @zh 设置世界坐标
  24912. * @param position Target position
  24913. */
  24914. setWorldPosition(position: math.Vec3): void;
  24915. /**
  24916. * @en Set position in world coordinate system
  24917. * @zh 设置世界坐标
  24918. * @param x X axis position
  24919. * @param y Y axis position
  24920. * @param z Z axis position
  24921. */
  24922. setWorldPosition(x: number, y: number, z: number): void;
  24923. /**
  24924. * @en Get position in world coordinate system, please try to pass `out` vector and reuse it to avoid garbage.
  24925. * @zh 获取世界坐标,注意,尽可能传递复用的 [[Vec3]] 以避免产生垃圾。
  24926. * @param out Set the result to out vector
  24927. * @return If `out` given, the return value equals to `out`, otherwise a new vector will be generated and return
  24928. */
  24929. getWorldPosition(out?: math.Vec3): math.Vec3;
  24930. /**
  24931. * @en Set rotation in world coordinate system with a quaternion representing the rotation
  24932. * @zh 用四元数设置世界坐标系下的旋转
  24933. * @param rotation Rotation in quaternion
  24934. */
  24935. setWorldRotation(rotation: math.Quat): void;
  24936. /**
  24937. * @en Set rotation in world coordinate system with a quaternion representing the rotation
  24938. * @zh 用四元数设置世界坐标系下的旋转
  24939. * @param x X value in quaternion
  24940. * @param y Y value in quaternion
  24941. * @param z Z value in quaternion
  24942. * @param w W value in quaternion
  24943. */
  24944. setWorldRotation(x: number, y: number, z: number, w: number): void;
  24945. /**
  24946. * @en Set rotation in world coordinate system with euler angles
  24947. * @zh 用欧拉角设置世界坐标系下的旋转
  24948. * @param x X axis rotation
  24949. * @param y Y axis rotation
  24950. * @param z Z axis rotation
  24951. */
  24952. setWorldRotationFromEuler(x: number, y: number, z: number): void;
  24953. /**
  24954. * @en Get rotation as quaternion in world coordinate system, please try to pass `out` quaternion and reuse it to avoid garbage.
  24955. * @zh 获取世界坐标系下的旋转,注意,尽可能传递复用的 [[Quat]] 以避免产生垃圾。
  24956. * @param out Set the result to out quaternion
  24957. * @return If `out` given, the return value equals to `out`, otherwise a new quaternion will be generated and return
  24958. */
  24959. getWorldRotation(out?: math.Quat): math.Quat;
  24960. /**
  24961. * @en Set scale in world coordinate system
  24962. * @zh 设置世界坐标系下的缩放
  24963. * @param scale Target scale
  24964. */
  24965. setWorldScale(scale: math.Vec3): void;
  24966. /**
  24967. * @en Set scale in world coordinate system
  24968. * @zh 设置世界坐标系下的缩放
  24969. * @param x X axis scale
  24970. * @param y Y axis scale
  24971. * @param z Z axis scale
  24972. */
  24973. setWorldScale(x: number, y: number, z: number): void;
  24974. /**
  24975. * @en Get scale in world coordinate system, please try to pass `out` vector and reuse it to avoid garbage.
  24976. * @zh 获取世界缩放,注意,尽可能传递复用的 [[Vec3]] 以避免产生垃圾。
  24977. * @param out Set the result to out vector
  24978. * @return If `out` given, the return value equals to `out`, otherwise a new vector will be generated and return
  24979. */
  24980. getWorldScale(out?: math.Vec3): math.Vec3;
  24981. /**
  24982. * @en Get a world transform matrix
  24983. * @zh 获取世界变换矩阵
  24984. * @param out Set the result to out matrix
  24985. * @return If `out` given, the return value equals to `out`, otherwise a new matrix will be generated and return
  24986. */
  24987. getWorldMatrix(out?: math.Mat4): math.Mat4;
  24988. /**
  24989. * @en Get a world transform matrix with only rotation and scale
  24990. * @zh 获取只包含旋转和缩放的世界变换矩阵
  24991. * @param out Set the result to out matrix
  24992. * @return If `out` given, the return value equals to `out`, otherwise a new matrix will be generated and return
  24993. */
  24994. getWorldRS(out?: math.Mat4): math.Mat4;
  24995. /**
  24996. * @en Get a world transform matrix with only rotation and translation
  24997. * @zh 获取只包含旋转和位移的世界变换矩阵
  24998. * @param out Set the result to out matrix
  24999. * @return If `out` given, the return value equals to `out`, otherwise a new matrix will be generated and return
  25000. */
  25001. getWorldRT(out?: math.Mat4): math.Mat4;
  25002. /**
  25003. * @en Set local transformation with rotation, position and scale separately.
  25004. * @zh 一次性设置所有局部变换(平移、旋转、缩放)信息
  25005. * @param rot The rotation
  25006. * @param pos The position
  25007. * @param scale The scale
  25008. */
  25009. setRTS(rot?: math.Quat | math.Vec3, pos?: math.Vec3, scale?: math.Vec3): void;
  25010. /**
  25011. * @en Does the world transform information of this node need to be updated?
  25012. * @zh 这个节点的空间变换信息是否需要更新?
  25013. */
  25014. isTransformDirty(): boolean;
  25015. /**
  25016. * @en
  25017. * Pause all system events which is dispatched by [[SystemEvent]].
  25018. * If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree.
  25019. * @zh
  25020. * 暂停所有 [[SystemEvent]] 派发的系统事件。
  25021. * 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  25022. *
  25023. * @param recursive Whether pause system events recursively for the child node tree
  25024. */
  25025. pauseSystemEvents(recursive: boolean): void;
  25026. /**
  25027. * @en
  25028. * Resume all paused system events which is dispatched by [[SystemEvent]].
  25029. * If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree.
  25030. *
  25031. * @zh
  25032. * 恢复所有 [[SystemEvent]] 派发的系统事件。
  25033. * 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  25034. *
  25035. * @param recursive Whether resume system events recursively for the child node tree
  25036. */
  25037. resumeSystemEvents(recursive: boolean): void;
  25038. /**
  25039. * @en
  25040. * clear all node dirty state.
  25041. * @zh
  25042. * 清除所有节点的脏标记。
  25043. */
  25044. static resetHasChangedFlags(): void;
  25045. /**
  25046. * @en
  25047. * clear node array
  25048. * @zh
  25049. * 清除节点数组
  25050. */
  25051. static clearNodeArray(): void;
  25052. /**
  25053. * @en
  25054. * Get the complete path of the current node in the hierarchy.
  25055. *
  25056. * @zh
  25057. * 获得当前节点在 hierarchy 中的完整路径。
  25058. */
  25059. getPathInHierarchy(): string;
  25060. public get siblingIndex():number;
  25061. public set siblingIndex(v:number);
  25062. public get uiTrans(): UITransform;
  25063. public get childrenCount():number;
  25064. }
  25065. /**
  25066. * @en
  25067. * Scene is a subclass of [[Node]], composed by nodes, representing the root of a runnable environment in the game.
  25068. * It's managed by [[Director]] and user can switch from a scene to another using [[Director.loadScene]]
  25069. * @zh
  25070. * Scene 是 [[Node]] 的子类,由节点所构成,代表着游戏中可运行的某一个整体环境。
  25071. * 它由 [[Director]] 管理,用户可以使用 [[Director.loadScene]] 来切换场景
  25072. */
  25073. export class Scene extends Node {
  25074. /**
  25075. * @en The renderer scene, normally user don't need to use it
  25076. * @zh 渲染层场景,一般情况下用户不需要关心它
  25077. */
  25078. get renderScene(): renderer.RenderScene | null;
  25079. get globals(): SceneGlobals;
  25080. /**
  25081. * @en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  25082. * @zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。
  25083. */
  25084. autoReleaseAssets: boolean;
  25085. /**
  25086. * @en Per-scene level rendering info
  25087. * @zh 场景级别的渲染信息
  25088. *
  25089. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25090. */
  25091. _globals: SceneGlobals;
  25092. dependAssets: null;
  25093. protected _renderScene: renderer.RenderScene | null;
  25094. protected _inited: boolean;
  25095. protected _prefabSyncedInLiveReload: boolean;
  25096. protected _updateScene(): void;
  25097. constructor(name: string);
  25098. /**
  25099. * @en Destroy the current scene and all its nodes, this action won't destroy related assets
  25100. * @zh 销毁当前场景中的所有节点,这个操作不会销毁资源
  25101. */
  25102. destroy(): boolean;
  25103. /**
  25104. * @en Only for compatibility purpose, user should not add any component to the scene
  25105. * @zh 仅为兼容性保留,用户不应该在场景上直接添加任何组件
  25106. */
  25107. addComponent(...args: any[]): Component;
  25108. /**
  25109. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25110. */
  25111. _onHierarchyChanged(): void;
  25112. /**
  25113. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25114. */
  25115. _onPostActivated(active: boolean): void;
  25116. /**
  25117. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25118. */
  25119. _onBatchCreated(dontSyncChildPrefab: boolean): void;
  25120. /**
  25121. * @en
  25122. * Refer to [[Node.updateWorldTransform]]
  25123. * @zh
  25124. * 参考 [[Node.updateWorldTransform]]
  25125. */
  25126. updateWorldTransform(): void;
  25127. protected _instantiate(): void;
  25128. }
  25129. /**
  25130. * @zh 节点层管理器,层数据是以掩码数据方式存储在 [[Node.layer]] 中,用于射线检测、物理碰撞和用户自定义脚本逻辑。
  25131. * 每个节点可属于一个或多个层,可通过 “包含式” 或 “排除式” 两种检测器进行层检测。
  25132. * @en Node's layer manager, it's stored as bit mask data in [[Node.layer]].
  25133. * Layer information is widely used in raycast, physics and user logic.
  25134. * Every node can be assigned to multiple layers with different bit masks, you can setup layer with inclusive or exclusive operation.
  25135. */
  25136. export class Layers {
  25137. /**
  25138. * @en All layers in an Enum
  25139. * @zh 以 Enum 形式存在的所有层列表
  25140. */
  25141. static Enum: {
  25142. NONE: number;
  25143. IGNORE_RAYCAST: number;
  25144. GIZMOS: number;
  25145. EDITOR: number;
  25146. UI_3D: number;
  25147. SCENE_GIZMO: number;
  25148. UI_2D: number;
  25149. PROFILER: number;
  25150. DEFAULT: number;
  25151. ALL: number;
  25152. };
  25153. /**
  25154. * @en All layers in [[BitMask]] type
  25155. * @zh 包含所有层的 [[BitMask]]
  25156. */
  25157. static BitMask: {
  25158. NONE: number;
  25159. IGNORE_RAYCAST: number;
  25160. GIZMOS: number;
  25161. EDITOR: number;
  25162. UI_3D: number;
  25163. SCENE_GIZMO: number;
  25164. UI_2D: number;
  25165. PROFILER: number;
  25166. DEFAULT: number;
  25167. ALL: number;
  25168. };
  25169. /**
  25170. * @internal
  25171. */
  25172. static init(): void;
  25173. /**
  25174. * @en
  25175. * Make a layer mask accepting nothing but the listed layers
  25176. * @zh
  25177. * 创建一个包含式层检测器,只接受列表中的层
  25178. * @param includes All accepted layers
  25179. * @return A filter which can detect all accepted layers
  25180. */
  25181. static makeMaskInclude(includes: number[]): number;
  25182. /**
  25183. * @en
  25184. * Make a layer mask accepting everything but the listed layers
  25185. * @zh
  25186. * 创建一个排除式层检测器,只拒绝列表中的层
  25187. * @param excludes All excluded layers
  25188. * @return A filter which can detect for excluded layers
  25189. */
  25190. static makeMaskExclude(excludes: number[]): number;
  25191. /**
  25192. * @zh 添加一个新层,用户可编辑 0 - 19 位为用户自定义层
  25193. * @en Add a new layer, user can use layers from bit position 0 to 19, other bits are reserved.
  25194. * @param name Layer's name
  25195. * @param bitNum Layer's bit position
  25196. */
  25197. static addLayer(name: string, bitNum: number): void;
  25198. /**
  25199. * @en Remove a layer, user can remove layers from bit position 0 to 19, other bits are reserved.
  25200. * @zh 移除一个层,用户可编辑 0 - 19 位为用户自定义层
  25201. * @param bitNum Layer's bit position
  25202. */
  25203. static deleteLayer(bitNum: number): void;
  25204. /**
  25205. * @en Given a layer name, returns the layer index as defined by either a Builtin or a User Layer in the Tags and Layers manager.
  25206. * @zh 给定层名称,返回由标记和层管理器中的内置层或用户层定义的层索引。
  25207. * @param name layer's name
  25208. */
  25209. static nameToLayer(name: string): number;
  25210. /**
  25211. * @en Given a layer number, returns the name of the layer as defined in either a Builtin or a User Layer in the Tags and Layers manager.
  25212. * @zh 给定层数,返回在标记和层管理器中的内置层或用户层中定义的层名称。
  25213. * @param bitNum layer's value
  25214. */
  25215. static layerToName(bitNum: number): string;
  25216. }
  25217. export namespace Layers {
  25218. export type Enum = __private.__types_globals__EnumAlias<typeof Layers.Enum>;
  25219. export type BitMask = __private.__types_globals__EnumAlias<typeof Layers.BitMask>;
  25220. }
  25221. /**
  25222. * @en
  25223. * The EventHandler class sets the event callback in the scene.
  25224. * This class allows the user to set the callback target node, target component name, component method name, and call the target method through the `emit` method.
  25225. * @zh
  25226. * “EventHandler” 类用来设置场景中的事件回调,该类允许用户设置回调目标节点,目标组件名,组件方法名,并可通过 emit 方法调用目标函数。
  25227. *
  25228. * @example
  25229. * ```ts
  25230. * // Let's say we have a MainMenu component on newTarget
  25231. * // file: MainMenu.ts
  25232. * @ccclass('MainMenu')
  25233. * export class MainMenu extends Component {
  25234. * // sender: the node MainMenu.ts belongs to
  25235. * // eventType: CustomEventData
  25236. * onClick (sender, eventType) {
  25237. * cc.log('click');
  25238. * }
  25239. * }
  25240. *
  25241. * import { Component } from 'cc';
  25242. * const eventHandler = new Component.EventHandler();
  25243. * eventHandler.target = newTarget;
  25244. * eventHandler.component = "MainMenu";
  25245. * eventHandler.handler = "OnClick";
  25246. * eventHandler.customEventData = "my data";
  25247. * ```
  25248. */
  25249. export class EventHandler {
  25250. /**
  25251. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25252. */
  25253. get _componentName(): any;
  25254. set _componentName(value: any);
  25255. /**
  25256. * @en
  25257. * Dispatching component events.
  25258. * @zh
  25259. * 组件事件派发。
  25260. *
  25261. * @param events - The event list to be emitted
  25262. * @param args - The callback arguments
  25263. */
  25264. static emitEvents(events: EventHandler[], ...args: any[]): void;
  25265. /**
  25266. * @en
  25267. * The node that contains target component
  25268. * @zh
  25269. * 事件响应组件和函数所在节点
  25270. */
  25271. target: Node | null;
  25272. /**
  25273. * @en
  25274. * The name of the component(script) that contains target callback, such as the name 'MainMenu' of the script in the example
  25275. * @zh
  25276. * 事件响应函数所在组件名(脚本名), 比如例子中的脚本名 'MainMenu'
  25277. */
  25278. component: string;
  25279. /**
  25280. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25281. */
  25282. _componentId: string;
  25283. /**
  25284. * @en
  25285. * Event handler, such as the callback function name 'onClick' in the example
  25286. * @zh
  25287. * 响应事件函数名,比如例子中的 'onClick' 方法名
  25288. */
  25289. handler: string;
  25290. /**
  25291. * @en
  25292. * Custom Event Data
  25293. * @zh
  25294. * 自定义事件数据
  25295. */
  25296. customEventData: string;
  25297. /**
  25298. * @en Trigger the target callback with given arguments
  25299. * @zh 触发目标组件上的指定 handler 函数,可以选择传递参数。
  25300. * @param params - The arguments for invoking the callback
  25301. * @example
  25302. * ```ts
  25303. * import { Component } from 'cc';
  25304. * const eventHandler = new Component.EventHandler();
  25305. * eventHandler.target = newTarget;
  25306. * eventHandler.component = "MainMenu";
  25307. * eventHandler.handler = "OnClick"
  25308. * eventHandler.emit(["param1", "param2", ....]);
  25309. * ```
  25310. */
  25311. emit(params: any[]): void;
  25312. }
  25313. /**
  25314. * @en
  25315. * Base class for everything attached to Node(Entity).<br/>
  25316. * <br/>
  25317. * NOTE: Not allowed to use construction parameters for Component's subclasses,
  25318. * because Component is created by the engine.
  25319. * @zh
  25320. * 所有附加到节点的基类。<br/>
  25321. * <br/>
  25322. * 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。
  25323. */
  25324. export class Component extends CCObject {
  25325. static EventHandler: typeof EventHandler;
  25326. get name(): string;
  25327. set name(value: string);
  25328. /**
  25329. * @en The uuid for editor.
  25330. * @zh 组件的 uuid,用于编辑器。
  25331. * @readOnly
  25332. * @example
  25333. * ```ts
  25334. * import { log } from 'cc';
  25335. * log(comp.uuid);
  25336. * ```
  25337. */
  25338. get uuid(): string;
  25339. /**
  25340. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25341. */
  25342. get __scriptAsset(): null;
  25343. /**
  25344. * @en Indicates whether this component is enabled or not.
  25345. * @zh 表示该组件自身是否启用。
  25346. * @default true
  25347. * @example
  25348. * ```ts
  25349. * import { log } from 'cc';
  25350. * comp.enabled = true;
  25351. * log(comp.enabled);
  25352. * ```
  25353. */
  25354. get enabled(): boolean;
  25355. set enabled(value: boolean);
  25356. /**
  25357. * @en Indicates whether this component is enabled and its node is also active in the hierarchy.
  25358. * @zh 表示该组件是否被启用并且所在的节点也处于激活状态。
  25359. * @readOnly
  25360. * @example
  25361. * ```ts
  25362. * import { log } from 'cc';
  25363. * log(comp.enabledInHierarchy);
  25364. * ```
  25365. */
  25366. get enabledInHierarchy(): boolean;
  25367. /**
  25368. * @en Returns a value which used to indicate the onLoad get called or not.
  25369. * @zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。
  25370. * @readOnly
  25371. * @example
  25372. * ```ts
  25373. * import { log } from 'cc';
  25374. * log(this._isOnLoadCalled > 0);
  25375. * ```
  25376. *
  25377. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25378. */
  25379. get _isOnLoadCalled(): number;
  25380. static system: null;
  25381. /**
  25382. * @en The node this component is attached to. A component is always attached to a node.
  25383. * @zh 该组件被附加到的节点。组件总会附加到一个节点。
  25384. * @example
  25385. * ```ts
  25386. * import { log } from 'cc';
  25387. * log(comp.node);
  25388. * ```
  25389. */
  25390. node: Node;
  25391. /**
  25392. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25393. */
  25394. _enabled: boolean;
  25395. /**
  25396. * @internal
  25397. */
  25398. __prefab: Prefab._utils.CompPrefabInfo | null;
  25399. /**
  25400. * @internal
  25401. */
  25402. _sceneGetter: null | (() => renderer.RenderScene);
  25403. /**
  25404. * For internal usage.
  25405. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25406. */
  25407. _id: string;
  25408. /**
  25409. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25410. */
  25411. _getRenderScene(): renderer.RenderScene;
  25412. /**
  25413. * @en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  25414. * @zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  25415. * @param classConstructor The class of component to be retrieved or to be created
  25416. * @example
  25417. * ```ts
  25418. * import { Sprite } from 'cc';
  25419. * const sprite = node.addComponent(Sprite);
  25420. * ```
  25421. */
  25422. addComponent<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T | null;
  25423. /**
  25424. * @en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  25425. * @zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  25426. * @param className A string for the class name of the component
  25427. * @example
  25428. * ```ts
  25429. * const test = node.addComponent("Test");
  25430. * ```
  25431. */
  25432. addComponent(className: string): Component | null;
  25433. /**
  25434. * @en
  25435. * Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  25436. * You can also get component in the node by passing in the name of the script.
  25437. * @zh
  25438. * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  25439. * 传入参数也可以是脚本的名称。
  25440. * @param classConstructor The class of component to be retrieved or to be created
  25441. * @example
  25442. * ```ts
  25443. * import { Sprite } from 'cc';
  25444. * // get sprite component.
  25445. * var sprite = node.getComponent(Sprite);
  25446. * ```
  25447. */
  25448. getComponent<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T | null;
  25449. /**
  25450. * @en
  25451. * Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  25452. * You can also get component in the node by passing in the name of the script.
  25453. * @zh
  25454. * 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  25455. * 传入参数也可以是脚本的名称。
  25456. * @param className A string for the class name of the component
  25457. * @example
  25458. * ```ts
  25459. * // get custom test calss.
  25460. * var test = node.getComponent("Test");
  25461. * ```
  25462. */
  25463. getComponent(className: string): Component | null;
  25464. /**
  25465. * @en Returns all components of supplied type in the node.
  25466. * @zh 返回节点上指定类型的所有组件。
  25467. * @param classConstructor The class of components to be retrieved
  25468. * @example
  25469. * ```ts
  25470. * import { Sprite } from 'cc';
  25471. * const sprites = node.getComponents(Sprite);
  25472. * ```
  25473. */
  25474. getComponents<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T[];
  25475. /**
  25476. * @en Returns all components of supplied type in the node.
  25477. * @zh 返回节点上指定类型的所有组件。
  25478. * @param className A string for the class name of the components
  25479. * @example
  25480. * ```ts
  25481. * const tests = node.getComponents("Test");
  25482. * ```
  25483. */
  25484. getComponents(className: string): Component[];
  25485. /**
  25486. * @en Returns the component of supplied type in any of its children using depth first search.
  25487. * @zh 递归查找所有子节点中第一个匹配指定类型的组件。
  25488. * @param classConstructor The class of component to be retrieved
  25489. * @example
  25490. * ```ts
  25491. * import { Sprite } from 'cc';
  25492. * const sprite = node.getComponentInChildren(Sprite);
  25493. * ```
  25494. */
  25495. getComponentInChildren<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T | null;
  25496. /**
  25497. * @en Returns the component of supplied type in any of its children using depth first search.
  25498. * @zh 递归查找所有子节点中第一个匹配指定类型的组件。
  25499. * @param className A string for the class name of the component
  25500. * @example
  25501. * ```ts
  25502. * var Test = node.getComponentInChildren("Test");
  25503. * ```
  25504. */
  25505. getComponentInChildren(className: string): Component | null;
  25506. /**
  25507. * @en Returns all components of supplied type in self or any of its children.
  25508. * @zh 递归查找自身或所有子节点中指定类型的组件。
  25509. * @param classConstructor The class of components to be retrieved
  25510. * @example
  25511. * ```ts
  25512. * import { Sprite } from 'cc';
  25513. * const sprites = node.getComponentsInChildren(Sprite);
  25514. * ```
  25515. */
  25516. getComponentsInChildren<T extends Component>(classConstructor: __private.__types_globals__Constructor<T>): T[];
  25517. /**
  25518. * @en Returns all components of supplied type in self or any of its children.
  25519. * @zh 递归查找自身或所有子节点中指定类型的组件。
  25520. * @param className A string for the class name of the components
  25521. * @example
  25522. * ```ts
  25523. * const tests = node.getComponentsInChildren("Test");
  25524. * ```
  25525. */
  25526. getComponentsInChildren(className: string): Component[];
  25527. destroy(): boolean;
  25528. /**
  25529. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25530. */
  25531. _onPreDestroy(): void;
  25532. /**
  25533. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  25534. */
  25535. _instantiate(cloned?: Component): Component | undefined;
  25536. /**
  25537. * @en
  25538. * Use Scheduler system to schedule a custom task.<br/>
  25539. * If the task is already scheduled, then the interval parameter will be updated without scheduling it again.
  25540. * @zh
  25541. * 使用定时器系统调度一个自定义的回调任务。<br/>
  25542. * 如果回调任务已调度,那么将不会重复调度它,只会更新时间间隔参数。
  25543. * @param callback The callback function of the task
  25544. * @param interval The time interval between each invocation
  25545. * @param repeat The repeat count of this task, the task will be invoked (repeat + 1) times, use [[macro.REPEAT_FOREVER]] to repeat a task forever
  25546. * @param delay The delay time for the first invocation, Unit: s
  25547. * @example
  25548. * ```ts
  25549. * import { log } from 'cc';
  25550. * this.schedule((dt) => void log(`time: ${dt}`), 1);
  25551. * ```
  25552. */
  25553. schedule(callback: any, interval?: number, repeat?: number, delay?: number): void;
  25554. /**
  25555. * @en Use Scheduler system to schedule a task that runs only once, with a delay of 0 or larger.
  25556. * @zh 使用定时器系统调度一个只运行一次的回调任务,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  25557. * @method scheduleOnce
  25558. * @see [[schedule]]
  25559. * @param callback The callback function of the task
  25560. * @param delay The delay time for the first invocation, Unit: s
  25561. * @example
  25562. * ```ts
  25563. * import { log } from 'cc';
  25564. * this.scheduleOnce((dt) => void log(`time: ${dt}`), 2);
  25565. * ```
  25566. */
  25567. scheduleOnce(callback: any, delay?: number): void;
  25568. /**
  25569. * @en Un-schedules a custom task.
  25570. * @zh 取消调度一个自定义的回调任务。
  25571. * @param callback_fn The callback function of the task
  25572. * @example
  25573. * ```ts
  25574. * this.unschedule(_callback);
  25575. * ```
  25576. */
  25577. unschedule(callback_fn: any): void;
  25578. /**
  25579. * @en unschedule all scheduled tasks.
  25580. * @zh 取消调度所有已调度的回调函数。
  25581. * @example
  25582. * ```ts
  25583. * this.unscheduleAllCallbacks();
  25584. * ```
  25585. */
  25586. unscheduleAllCallbacks(): void;
  25587. /**
  25588. * @en Update is called every frame, if the Component is enabled.<br/>
  25589. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  25590. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25591. * @zh 如果该组件启用,则每帧调用 update。<br/>
  25592. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25593. * @param dt - the delta time in seconds it took to complete the last frame
  25594. */
  25595. protected update?(dt: number): void;
  25596. /**
  25597. * @en LateUpdate is called every frame, if the Component is enabled.<br/>
  25598. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  25599. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25600. * @zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  25601. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25602. * @param dt - the delta time in seconds it took to complete the last frame
  25603. */
  25604. protected lateUpdate?(dt: number): void;
  25605. /**
  25606. * @en `__preload` is called before every onLoad.<br/>
  25607. * It is used to initialize the builtin components internally,<br/>
  25608. * to avoid checking whether onLoad is called before every public method calls.<br/>
  25609. * This method should be removed if script priority is supported.
  25610. * @zh `__preload` 在每次onLoad之前调用。<br/>
  25611. * 它用于在内部初始化内置组件,<br/>
  25612. * 以避免在每次公有方法调用之前检查是否调用了onLoad。<br/>
  25613. * 如果支持脚本优先级,则应删除此方法。
  25614. * @private
  25615. */
  25616. protected __preload?(): void;
  25617. /**
  25618. * @en
  25619. * When attaching to an active node or its node first activated.<br/>
  25620. * onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  25621. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  25622. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25623. * @zh
  25624. * 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  25625. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25626. */
  25627. protected onLoad?(): void;
  25628. /**
  25629. * @en
  25630. * Called before all scripts' update if the Component is enabled the first time.<br/>
  25631. * Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  25632. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  25633. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25634. * @zh
  25635. * 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  25636. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25637. */
  25638. protected start?(): void;
  25639. /**
  25640. * @en Called when this component becomes enabled and its node is active.<br/>
  25641. * This is a lifecycle method. It may not be implemented in the super class.
  25642. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25643. * @zh 当该组件被启用,并且它的节点也激活时。<br/>
  25644. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25645. */
  25646. protected onEnable?(): void;
  25647. /**
  25648. * @en Called when this component becomes disabled or its node becomes inactive.<br/>
  25649. * This is a lifecycle method. It may not be implemented in the super class.
  25650. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25651. * @zh 当该组件被禁用或节点变为无效时调用。<br/>
  25652. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25653. */
  25654. protected onDisable?(): void;
  25655. /**
  25656. * @en Called when this component will be destroyed.<br/>
  25657. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  25658. * You can only call its super class method inside it. It should not be called manually elsewhere.
  25659. * @zh 当该组件被销毁时调用<br/>
  25660. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  25661. */
  25662. protected onDestroy?(): void;
  25663. onFocusInEditor?(): void;
  25664. onLostFocusInEditor?(): void;
  25665. /**
  25666. * @en Called to initialize the component or node’s properties when adding the component the first time or when the Reset command is used.
  25667. * This function is only called in editor.<br/>
  25668. * @zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  25669. */
  25670. resetInEditor?(didResetToDefault?: boolean): void;
  25671. /**
  25672. * @en
  25673. * If the component's bounding box is different from the node's, you can implement this method to supply
  25674. * a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  25675. * @zh
  25676. * 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  25677. * 以便编辑器的场景视图可以正确地执行点选测试。
  25678. * @param out_rect - The rect to store the result bounding rect
  25679. * @private
  25680. */
  25681. protected _getLocalBounds?(out_rect: math.Rect): void;
  25682. /**
  25683. * @en
  25684. * onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  25685. * an undo operation on this component.<br/>
  25686. * <br/>
  25687. * If the component contains the "internal state", short for "temporary member variables which not included<br/>
  25688. * in its CCClass properties", then you may need to implement this function.<br/>
  25689. * <br/>
  25690. * The editor will call the getset accessors of your component to record/restore the component's state<br/>
  25691. * for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  25692. * this function to manually synchronize your component's "internal states" with its public properties.<br/>
  25693. * Once you implement this function, all the getset accessors of your component will not be called when<br/>
  25694. * the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  25695. * will be recorded or restored by editor.<br/>
  25696. * <br/>
  25697. * Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  25698. * to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  25699. * properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  25700. * will not be called during reset operation. Which means that only the properties with default value<br/>
  25701. * will be reset by editor.
  25702. *
  25703. * This function is only called in editor mode.
  25704. * @zh
  25705. * onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  25706. * <br/>
  25707. * 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  25708. * <br/>
  25709. * 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。
  25710. * 然而,在极端的情况下,它可能无法良好运作。<br/>
  25711. * 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。
  25712. * 一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。
  25713. * 这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  25714. * <br/>
  25715. * 同样的,编辑可能无法在极端情况下正确地重置您的组件。<br/>
  25716. * 于是如果你需要支持组件重置菜单,你需要在该方法中手工同步组件属性到“内部状态”。<br/>
  25717. * 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
  25718. * 这意味着仅仅指定了默认值的属性将被编辑器重置。
  25719. * <br/>
  25720. * 此方法仅在编辑器下会被调用。
  25721. */
  25722. protected onRestore?(): void;
  25723. public findNode(path: string, referenceNode?: Node): Node;
  25724. public findComp<T extends Component>(path: string, comp: __private.__types_globals__Constructor<T> | __private.__types_globals__AbstractedConstructor<T>, referenceNode?: Node): T;
  25725. public instantiate(bundleName: string, path: string, parent?: Node): Promise<Node>;
  25726. public get uiTrans(): UITransform;
  25727. }
  25728. /**
  25729. * @en The class used to perform activating and deactivating operations of node and component.
  25730. * @zh 用于执行节点和组件的激活和停用操作的管理器。
  25731. */
  25732. export class NodeActivator {
  25733. resetComp?: ((comp: Component, didResetToDefault: boolean) => void);
  25734. protected _activatingStack: __private._cocos_scene_graph_node_activator__ActivateTask[];
  25735. constructor();
  25736. /**
  25737. * @en Reset all activation or des-activation tasks
  25738. * @zh 重置所有激活或非激活任务
  25739. */
  25740. reset(): void;
  25741. /**
  25742. * @en Activate or des-activate a node
  25743. * @zh 激活或者停用某个节点
  25744. * @param node Target node
  25745. * @param active Which state to set the node to
  25746. */
  25747. activateNode(node: Node, active: boolean): void;
  25748. /**
  25749. * @en Activate or des-activate a component
  25750. * @zh 激活或者停用某个组件
  25751. * @param comp Target component
  25752. * @param preloadInvoker The invoker for `_preload` method, normally from [[ComponentScheduler]]
  25753. * @param onLoadInvoker The invoker for `onLoad` method, normally from [[ComponentScheduler]]
  25754. * @param onEnableInvoker The invoker for `onEnable` method, normally from [[ComponentScheduler]]
  25755. */
  25756. activateComp(comp: Component, preloadInvoker?: __private._cocos_scene_graph_node_activator__UnsortedInvoker, onLoadInvoker?: __private._cocos_scene_graph_component_scheduler__OneOffInvoker, onEnableInvoker?: __private._cocos_scene_graph_component_scheduler__OneOffInvoker): void;
  25757. /**
  25758. * @en Destroy a component
  25759. * @zh 销毁一个组件
  25760. * @param comp Target component
  25761. */
  25762. destroyComp(comp: Component): void;
  25763. protected _activateNodeRecursively(node: Node, preloadInvoker: __private._cocos_scene_graph_node_activator__UnsortedInvoker, onLoadInvoker: __private._cocos_scene_graph_component_scheduler__OneOffInvoker, onEnableInvoker: __private._cocos_scene_graph_component_scheduler__OneOffInvoker): void;
  25764. protected _deactivateNodeRecursively(node: Node): void;
  25765. }
  25766. /**
  25767. * @en Class for prefab handling.
  25768. * @zh 预制资源类。
  25769. */
  25770. export class Prefab extends Asset {
  25771. /**
  25772. * @en Enumeration for optimization policy
  25773. * @zh Prefab 创建实例所用的优化策略枚举类型
  25774. */
  25775. static OptimizationPolicy: {
  25776. /**
  25777. * @en The optimization policy is automatically chosen based on the number of instantiations.
  25778. * When you first create an instance, the behavior is the same as SINGLE_INSTANCE.
  25779. * MULTI_INSTANCE will be automatically used after multiple creation.
  25780. * @zh 根据创建次数自动调整优化策略。初次创建实例时,行为等同 SINGLE_INSTANCE,多次创建后将自动采用 MULTI_INSTANCE。
  25781. */
  25782. AUTO: number;
  25783. /**
  25784. * @en Optimize for single instance creation.<br>
  25785. * This option skips code generation for this prefab.
  25786. * When this prefab will usually create only one instances, please select this option.
  25787. * @zh 优化单次创建性能。<br>
  25788. * 该选项会跳过针对这个 prefab 的代码生成优化操作。当该 prefab 加载后,一般只会创建一个实例时,请选择此项。
  25789. */
  25790. SINGLE_INSTANCE: number;
  25791. /**
  25792. * @en Optimize for creating instances multiple times.<br>
  25793. * This option enables code generation for this prefab.
  25794. * When this prefab will usually create multiple instances, please select this option.
  25795. * It is also recommended to select this option if the prefab instance in the scene
  25796. * has Auto Sync enabled and there are multiple instances in the scene.
  25797. * @zh 优化多次创建性能。<br>
  25798. * 该选项会启用针对这个 prefab 的代码生成优化操作。当该 prefab 加载后,一般会创建多个实例时,请选择此项。如果该 prefab 在场景中的节点启用了自动关联,并且在场景中有多份实例,也建议选择此项。
  25799. */
  25800. MULTI_INSTANCE: number;
  25801. };
  25802. static OptimizationPolicyThreshold: number;
  25803. /**
  25804. * @en The main [[Node]] in the prefab
  25805. * @zh Prefab 中的根节点,[[Node]] 类型
  25806. */
  25807. data: any;
  25808. /**
  25809. * @zh
  25810. * 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。推荐在编辑器的资源中设置。
  25811. * @en
  25812. * Indicates the optimization policy for instantiating this prefab.
  25813. * Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab.
  25814. * Suggest to set this policy in the editor's asset inspector.
  25815. * @default Prefab.OptimizationPolicy.AUTO
  25816. * @example
  25817. * ```ts
  25818. * import { Prefab } from 'cc';
  25819. * prefab.optimizationPolicy = Prefab.OptimizationPolicy.MULTI_INSTANCE;
  25820. * ```
  25821. */
  25822. optimizationPolicy: number;
  25823. persistent: boolean;
  25824. constructor();
  25825. createNode(cb: (err: Error | null, node: Node) => void): void;
  25826. /**
  25827. * @en
  25828. * Dynamically translation prefab data into minimized code.<br/>
  25829. * This method will be called automatically before the first time the prefab being instantiated,<br/>
  25830. * but you can re-call to refresh the create function once you modified the original prefab data in script.
  25831. * @zh
  25832. * 将预制数据动态转换为最小化代码。<br/>
  25833. * 此方法将在第一次实例化预制件之前自动调用,<br/>
  25834. * 但是您可以在脚本中修改原始预制数据后重新调用以刷新创建功能。
  25835. */
  25836. compileCreateFunction(): void;
  25837. initDefault(uuid?: string): void;
  25838. validate(): boolean;
  25839. onLoaded(): void;
  25840. }
  25841. export namespace Prefab {
  25842. export namespace _utils {
  25843. export function createNodeWithPrefab(node: Node): void;
  25844. export function generateTargetMap(node: Node, targetMap: TargetMap, isRoot: boolean): void;
  25845. export function getTarget(localID: string[], targetMap: any): Node | Component | null;
  25846. export function applyMountedChildren(node: Node, mountedChildren: MountedChildrenInfo[], targetMap: TargetMap): void;
  25847. export function applyMountedComponents(node: Node, mountedComponents: MountedComponentsInfo[], targetMap: TargetMap): void;
  25848. export function applyRemovedComponents(node: Node, removedComponents: TargetInfo[], targetMap: TargetMap): void;
  25849. export function applyPropertyOverrides(node: Node, propertyOverrides: PropertyOverrideInfo[], targetMap: TargetMap): void;
  25850. export function applyTargetOverrides(node: Node): void;
  25851. export function expandPrefabInstanceNode(node: Node, recursively?: boolean): void;
  25852. export function expandNestedPrefabInstanceNode(node: Node): void;
  25853. export function applyNodeAndComponentId(prefabInstanceNode: Node, rootId: string): void;
  25854. export class TargetInfo {
  25855. localID: string[];
  25856. }
  25857. export class TargetOverrideInfo {
  25858. source: Component | Node | null;
  25859. sourceInfo: TargetInfo | null;
  25860. propertyPath: string[];
  25861. target: Node | null;
  25862. targetInfo: TargetInfo | null;
  25863. }
  25864. export class CompPrefabInfo {
  25865. fileId: string;
  25866. }
  25867. export class PropertyOverrideInfo {
  25868. targetInfo: TargetInfo | null;
  25869. propertyPath: string[];
  25870. value: any;
  25871. isTarget(localID: string[], propPath: string[]): boolean | undefined;
  25872. }
  25873. export class MountedChildrenInfo {
  25874. targetInfo: TargetInfo | null;
  25875. nodes: Node[];
  25876. isTarget(localID: string[]): boolean | undefined;
  25877. }
  25878. export class MountedComponentsInfo {
  25879. targetInfo: TargetInfo | null;
  25880. components: Component[];
  25881. isTarget(localID: string[]): boolean | undefined;
  25882. }
  25883. /**
  25884. * Prefab实例类
  25885. * @internal
  25886. */
  25887. export class PrefabInstance {
  25888. fileId: string;
  25889. prefabRootNode?: Node;
  25890. mountedChildren: MountedChildrenInfo[];
  25891. mountedComponents: MountedComponentsInfo[];
  25892. propertyOverrides: PropertyOverrideInfo[];
  25893. removedComponents: TargetInfo[];
  25894. targetMap: TargetMap;
  25895. /**
  25896. * make sure prefab instance expand only once
  25897. * @internal
  25898. */
  25899. expanded: boolean;
  25900. findPropertyOverride(localID: string[], propPath: string[]): Prefab._utils.PropertyOverrideInfo | null | undefined;
  25901. removePropertyOverride(localID: string[], propPath: string[]): void;
  25902. }
  25903. export interface TargetMap {
  25904. [k: string]: TargetMap | Node | Component;
  25905. }
  25906. export class PrefabInfo {
  25907. root?: Node;
  25908. asset?: Prefab;
  25909. fileId: string;
  25910. instance?: PrefabInstance;
  25911. targetOverrides?: TargetOverrideInfo[];
  25912. nestedPrefabInstanceRoots?: Node[];
  25913. }
  25914. }
  25915. }
  25916. /**
  25917. * @en Node's coordinate space
  25918. * @zh 节点的坐标空间
  25919. */
  25920. export enum NodeSpace {
  25921. LOCAL = 0,
  25922. WORLD = 1
  25923. }
  25924. /**
  25925. * @en Bit masks for node's transformation
  25926. * @zh 节点的空间变换位标记
  25927. */
  25928. export enum TransformBit {
  25929. /**
  25930. * @en No change
  25931. * @zh 无改变
  25932. */
  25933. NONE = 0,
  25934. /**
  25935. * @en Translation changed
  25936. * @zh 节点位置改变
  25937. */
  25938. POSITION = 1,
  25939. /**
  25940. * @en Rotation changed
  25941. * @zh 节点旋转
  25942. */
  25943. ROTATION = 2,
  25944. /**
  25945. * @en Scale changed
  25946. * @zh 节点缩放
  25947. */
  25948. SCALE = 4,
  25949. /**
  25950. * @en Rotation or scale changed
  25951. * @zh 节点旋转及缩放
  25952. */
  25953. RS = 6,
  25954. /**
  25955. * @en Translation, rotation or scale changed
  25956. * @zh 节点平移,旋转及缩放
  25957. */
  25958. TRS = 7,
  25959. /**
  25960. * @en Invert mask of [[TRS]]
  25961. * @zh [[TRS]] 的反向掩码
  25962. */
  25963. TRS_MASK = "Bad expression <-8>"
  25964. }
  25965. /**
  25966. * @en Node's mobility
  25967. * @zh 节点的移动性
  25968. */
  25969. export const MobilityMode: {
  25970. /**
  25971. * @en Static node
  25972. * @zh 静态节点
  25973. */
  25974. Static: number;
  25975. /**
  25976. * @en Stationary node
  25977. * @zh 固定节点
  25978. */
  25979. Stationary: number;
  25980. /**
  25981. * @en Movable node
  25982. * @zh 可移动节点
  25983. */
  25984. Movable: number;
  25985. };
  25986. /**
  25987. * @en All event types which [[Node]] could emit
  25988. * @zh 所有 [[Node]] 可能派发的事件类型
  25989. */
  25990. export enum NodeEventType {
  25991. /**
  25992. * @en
  25993. * The event type for touch start event
  25994. *
  25995. * @zh
  25996. * 手指开始触摸事件。
  25997. */
  25998. TOUCH_START = "touch-start",
  25999. /**
  26000. * @en
  26001. * The event type for touch move event
  26002. *
  26003. * @zh
  26004. * 当手指在屏幕上移动时。
  26005. */
  26006. TOUCH_MOVE = "touch-move",
  26007. /**
  26008. * @en
  26009. * The event type for touch end event
  26010. *
  26011. * @zh
  26012. * 手指结束触摸事件。
  26013. */
  26014. TOUCH_END = "touch-end",
  26015. /**
  26016. * @en
  26017. * The event type for touch end event
  26018. *
  26019. * @zh
  26020. * 当手指在目标节点区域外离开屏幕时。
  26021. */
  26022. TOUCH_CANCEL = "touch-cancel",
  26023. /**
  26024. * @en
  26025. * The event type for mouse down events
  26026. *
  26027. * @zh
  26028. * 当鼠标按下时触发一次。
  26029. */
  26030. MOUSE_DOWN = "mouse-down",
  26031. /**
  26032. * @en
  26033. * The event type for mouse move events
  26034. *
  26035. * @zh
  26036. * 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。
  26037. */
  26038. MOUSE_MOVE = "mouse-move",
  26039. /**
  26040. * @en
  26041. * The event type for mouse up events
  26042. *
  26043. * @zh
  26044. * 当鼠标从按下状态松开时触发一次。
  26045. */
  26046. MOUSE_UP = "mouse-up",
  26047. /**
  26048. * @en
  26049. * The event type for mouse wheel events
  26050. *
  26051. * @zh 手指开始触摸事件
  26052. */
  26053. MOUSE_WHEEL = "mouse-wheel",
  26054. /**
  26055. * @en
  26056. * The event type for mouse leave target events
  26057. *
  26058. * @zh
  26059. * 当鼠标移入目标节点区域时,不论是否按下.
  26060. */
  26061. MOUSE_ENTER = "mouse-enter",
  26062. /**
  26063. * @en
  26064. * The event type for mouse leave target events
  26065. *
  26066. * @zh
  26067. * 当鼠标移出目标节点区域时,不论是否按下。
  26068. */
  26069. MOUSE_LEAVE = "mouse-leave",
  26070. /**
  26071. * @en The event type for press the key down event, the event will be continuously dispatched in the key pressed state
  26072. * @zh 当按下按键时触发的事件, 该事件在按下状态会持续派发
  26073. * @deprecated since v3.3, please use SystemEvent.EventType.KEY_DOWN instead
  26074. */
  26075. KEY_DOWN = "keydown",
  26076. /**
  26077. * @en The event type for press the key up event
  26078. * @zh 当松开按键时触发的事件
  26079. * @deprecated since v3.3, please use SystemEvent.EventType.KEY_UP instead
  26080. */
  26081. KEY_UP = "keyup",
  26082. /**
  26083. * @en
  26084. * The event type for press the devicemotion event
  26085. *
  26086. * @zh
  26087. * 重力感应
  26088. *
  26089. * @deprecated since v3.3, please use SystemEvent.EventType.DEVICEMOTION instead
  26090. */
  26091. DEVICEMOTION = "devicemotion",
  26092. /**
  26093. * @en
  26094. * The event type for position, rotation, scale changed.Use the type parameter as `Node.TransformBit` to check which part is changed
  26095. *
  26096. * @zh
  26097. * 节点改变位置、旋转或缩放事件。如果具体需要判断是哪一个事件,可通过判断回调的第一个参数类型是 `Node.TransformBit` 中的哪一个来获取
  26098. * @example
  26099. * ```
  26100. * this.node.on(Node.EventType.TRANSFORM_CHANGED, (type)=>{
  26101. * if (type & Node.TransformBit.POSITION) {
  26102. * //...
  26103. * }
  26104. * }, this);
  26105. * ```
  26106. */
  26107. TRANSFORM_CHANGED = "transform-changed",
  26108. /**
  26109. * @en
  26110. * The event occur when mobility changed.
  26111. * @zh
  26112. * 当可移动性改变时触发的事件
  26113. */
  26114. MOBILITY_CHANGED = "mobility-changed",
  26115. /**
  26116. * @en The event type for notifying the host scene has been changed for a persist node.
  26117. * @zh 当场景常驻节点的场景发生改变时触发的事件,一般在切换场景过程中触发。
  26118. */
  26119. SCENE_CHANGED_FOR_PERSISTS = "scene-changed-for-persists",
  26120. /**
  26121. * @en
  26122. * The event type for size change events.
  26123. * Performance note, this event will be triggered every time corresponding properties being changed,
  26124. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  26125. *
  26126. * @zh
  26127. * 当节点尺寸改变时触发的事件。
  26128. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  26129. */
  26130. SIZE_CHANGED = "size-changed",
  26131. /**
  26132. * @en
  26133. * The event type for anchor point change events.
  26134. * Performance note, this event will be triggered every time corresponding properties being changed,
  26135. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  26136. *
  26137. * @zh
  26138. * 当节点的 UITransform 锚点改变时触发的事件。
  26139. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  26140. */
  26141. ANCHOR_CHANGED = "anchor-changed",
  26142. /**
  26143. * @en
  26144. * The event type for color change events.
  26145. * Performance note, this event will be triggered every time corresponding properties being changed,
  26146. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  26147. *
  26148. * @zh
  26149. * 当节点的 UI 渲染组件颜色属性改变时触发的事件。
  26150. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  26151. */
  26152. COLOR_CHANGED = "color-changed",
  26153. /**
  26154. * @en
  26155. * The event type for adding a new child node to the target node.
  26156. *
  26157. * @zh
  26158. * 给目标节点添加子节点时触发的事件。
  26159. */
  26160. CHILD_ADDED = "child-added",
  26161. /**
  26162. * @en
  26163. * The event type for removing a child node from the target node.
  26164. *
  26165. * @zh
  26166. * 给目标节点移除子节点时触发的事件。
  26167. */
  26168. CHILD_REMOVED = "child-removed",
  26169. /**
  26170. * @en The event type for changing the parent of the target node
  26171. * @zh 目标节点的父节点改变时触发的事件。
  26172. */
  26173. PARENT_CHANGED = "parent-changed",
  26174. /**
  26175. * @en The event type for destroying the target node
  26176. * @zh 目标节点被销毁时触发的事件。
  26177. */
  26178. NODE_DESTROYED = "node-destroyed",
  26179. /**
  26180. * @en The event type for node layer change events.
  26181. * @zh 节点 layer 改变时触发的事件。
  26182. */
  26183. LAYER_CHANGED = "layer-changed",
  26184. /**
  26185. * @en This event indicates that the order of child nodes has been changed.
  26186. * @zh 该事件表示子节点的排序发生了改变。
  26187. * @deprecated since v3.8.2 @en Please use `CHILDREN_ORDER_CHANGED`. @zh 请使用 `CHILDREN_ORDER_CHANGED`。
  26188. */
  26189. SIBLING_ORDER_CHANGED = "sibling-order-changed",
  26190. /**
  26191. * @en This event indicates that the order of child nodes has been changed.
  26192. * @zh 该事件表示子节点的排序发生了改变。
  26193. */
  26194. CHILDREN_ORDER_CHANGED = "sibling-order-changed",
  26195. /**
  26196. * @en
  26197. * Note: This event is only emitted from the top most node whose active value did changed,
  26198. * not including its child nodes.
  26199. * @zh
  26200. * 注意:此节点激活时,此事件仅从最顶部的节点发出。
  26201. */
  26202. ACTIVE_IN_HIERARCHY_CHANGED = "active-in-hierarchy-changed",
  26203. /**
  26204. * @en
  26205. * The event occur when node add a new component.
  26206. * @zh
  26207. * 当节点上增加组件时触发的事件
  26208. */
  26209. COMPONENT_ADDED = "component-added",
  26210. /**
  26211. * @en
  26212. * The event occur when node remove a component.
  26213. * @zh
  26214. * 当节点上移除组件时触发的事件
  26215. */
  26216. COMPONENT_REMOVED = "component-removed",
  26217. /**
  26218. * @en
  26219. * The event occur when light probe changed in light probe group.
  26220. * @zh
  26221. * 当光照探针组组件的探针改变时触发的事件
  26222. */
  26223. LIGHT_PROBE_CHANGED = "light-probe-changed",
  26224. /**
  26225. * @en
  26226. * The event occur after light probe's baking data is changed
  26227. * @zh
  26228. * 当光照探针烘焙数据修改后触发的事件
  26229. */
  26230. LIGHT_PROBE_BAKING_CHANGED = "light-probe-baking-changed"
  26231. }
  26232. /**
  26233. * @en Environment lighting configuration in the Scene
  26234. * @zh 场景的环境光照相关配置
  26235. */
  26236. export class AmbientInfo {
  26237. /**
  26238. * @en The sky color in HDR mode
  26239. * @zh HDR 模式下的天空光照色
  26240. */
  26241. get skyColorHDR(): Readonly<math.Vec4>;
  26242. /**
  26243. * @en The ground color in HDR mode
  26244. * @zh HDR 模式下的地面光照色
  26245. */
  26246. get groundAlbedoHDR(): Readonly<math.Vec4>;
  26247. /**
  26248. * @en Sky illuminance in HDR mode
  26249. * @zh HDR 模式下的天空亮度
  26250. */
  26251. get skyIllumHDR(): number;
  26252. /**
  26253. * @en The sky color in LDR mode
  26254. * @zh LDR 模式下的天空光照色
  26255. */
  26256. get skyColorLDR(): Readonly<math.Vec4>;
  26257. /**
  26258. * @en The ground color in LDR mode
  26259. * @zh LDR 模式下的地面光照色
  26260. */
  26261. get groundAlbedoLDR(): Readonly<math.Vec4>;
  26262. /**
  26263. * @en Sky illuminance in LDR mode
  26264. * @zh LDR 模式下的天空亮度
  26265. */
  26266. get skyIllumLDR(): number;
  26267. /**
  26268. * @en Sky lighting color configurable in editor with color picker
  26269. * @zh 编辑器中可配置的天空光照颜色(通过颜色拾取器)
  26270. */
  26271. set skyLightingColor(val: math.Color);
  26272. get skyLightingColor(): math.Color;
  26273. /**
  26274. * @internal
  26275. */
  26276. set skyColor(val: math.Vec4);
  26277. /**
  26278. * @en Sky illuminance
  26279. * @zh 天空亮度
  26280. */
  26281. set skyIllum(val: number);
  26282. get skyIllum(): number;
  26283. /**
  26284. * @en Ground lighting color configurable in editor with color picker
  26285. * @zh 编辑器中可配置的地面光照颜色(通过颜色拾取器)
  26286. */
  26287. set groundLightingColor(val: math.Color);
  26288. get groundLightingColor(): math.Color;
  26289. /**
  26290. * @internal
  26291. */
  26292. set groundAlbedo(val: math.Vec4);
  26293. protected _skyColorHDR: math.Vec4;
  26294. protected _skyIllumHDR: number;
  26295. protected _groundAlbedoHDR: math.Vec4;
  26296. protected _skyColorLDR: math.Vec4;
  26297. protected _skyIllumLDR: number;
  26298. protected _groundAlbedoLDR: math.Vec4;
  26299. protected _resource: renderer.scene.Ambient | null;
  26300. /**
  26301. * @en Activate the ambient lighting configuration in the render scene, no need to invoke manually.
  26302. * @zh 在渲染场景中启用环境光照设置,不需要手动调用
  26303. * @param resource The ambient configuration object in the render scene
  26304. */
  26305. activate(resource: renderer.scene.Ambient): void;
  26306. }
  26307. /**
  26308. * @en Skybox related configuration
  26309. * @zh 天空盒相关配置
  26310. */
  26311. export class SkyboxInfo {
  26312. /**
  26313. * @en Whether to use diffuse convolution map. Enabled -> Will use map specified. Disabled -> Will revert to hemispheric lighting
  26314. * @zh 是否为IBL启用漫反射卷积图?不启用的话将使用默认的半球光照
  26315. */
  26316. set applyDiffuseMap(val: boolean);
  26317. get applyDiffuseMap(): boolean;
  26318. /**
  26319. * @en Whether activate skybox in the scene
  26320. * @zh 是否启用天空盒?
  26321. */
  26322. set enabled(val: boolean);
  26323. get enabled(): boolean;
  26324. /**
  26325. * @zh 环境反射类型
  26326. * @en environment reflection type
  26327. */
  26328. set envLightingType(val: number);
  26329. get envLightingType(): number;
  26330. /**
  26331. * @en Whether use environment lighting
  26332. * @zh 是否启用环境光照?
  26333. */
  26334. set useIBL(val: boolean);
  26335. get useIBL(): boolean;
  26336. /**
  26337. * @en Toggle HDR (TODO: This SHOULD be moved into it's own subgroup away from skybox)
  26338. * @zh 是否启用HDR?
  26339. */
  26340. set useHDR(val: boolean);
  26341. get useHDR(): boolean;
  26342. /**
  26343. * @en The texture cube used for the skybox
  26344. * @zh 使用的立方体贴图
  26345. */
  26346. set envmap(val: TextureCube | null);
  26347. get envmap(): TextureCube | null;
  26348. /**
  26349. * @en Rotate the skybox
  26350. * @zh 旋转天空盒
  26351. */
  26352. set rotationAngle(val: number);
  26353. get rotationAngle(): number;
  26354. /**
  26355. * @en The optional diffusion convolution map used in tandem with IBL
  26356. * @zh 使用的漫反射卷积图
  26357. */
  26358. set diffuseMap(val: TextureCube | null);
  26359. get diffuseMap(): TextureCube | null;
  26360. /**
  26361. * @en Convolutional map using environmental reflections
  26362. * @zh 使用环境反射卷积图
  26363. */
  26364. set reflectionMap(val: TextureCube | null);
  26365. get reflectionMap(): TextureCube | null;
  26366. /**
  26367. * @en Use custom skybox material
  26368. * @zh 使用自定义的天空盒材质
  26369. */
  26370. set skyboxMaterial(val: Material | null);
  26371. get skyboxMaterial(): Material | null;
  26372. protected _envLightingType: number;
  26373. protected _envmapHDR: TextureCube | null;
  26374. protected _envmapLDR: TextureCube | null;
  26375. protected _diffuseMapHDR: TextureCube | null;
  26376. protected _diffuseMapLDR: TextureCube | null;
  26377. protected _enabled: boolean;
  26378. protected _useHDR: boolean;
  26379. protected _editableMaterial: Material | null;
  26380. protected _reflectionHDR: TextureCube | null;
  26381. protected _reflectionLDR: TextureCube | null;
  26382. protected _rotationAngle: number;
  26383. protected _resource: renderer.scene.Skybox | null;
  26384. /**
  26385. * @en Activate the skybox configuration in the render scene, no need to invoke manually.
  26386. * @zh 在渲染场景中启用天空盒设置,不需要手动调用
  26387. * @param resource The skybox configuration object in the render scene
  26388. */
  26389. activate(resource: renderer.scene.Skybox): void;
  26390. /**
  26391. * @en When the environment map changed will call this function to update scene.
  26392. * @zh 环境贴图发生变化时,会调用此函数更新场景。
  26393. * @param val environment map
  26394. */
  26395. updateEnvMap(val: TextureCube): void;
  26396. /**
  26397. * @en
  26398. * Set custom skybox material properties.
  26399. * @zh
  26400. * 设置自定义的天空盒材质属性。
  26401. * @param name @en The target property name. @zh 目标 property 名称。
  26402. * @param val @en The target value. @zh 需要设置的目标值。
  26403. * @param passIdx
  26404. * @en The pass to apply to. Will apply to all passes if not specified.
  26405. * @zh 设置此属性的 pass 索引,如果没有指定,则会设置此属性到所有 pass 上。
  26406. */
  26407. setMaterialProperty(name: string, val: __private._cocos_asset_assets_material__MaterialPropertyFull | __private._cocos_asset_assets_material__MaterialPropertyFull[], passIdx?: number): void;
  26408. }
  26409. /**
  26410. * @zh 全局雾相关配置
  26411. * @en Global fog configuration
  26412. */
  26413. export class FogInfo {
  26414. static FogType: {
  26415. LINEAR: number;
  26416. EXP: number;
  26417. EXP_SQUARED: number;
  26418. LAYERED: number;
  26419. };
  26420. /**
  26421. * @zh 是否启用全局雾效
  26422. * @en Enable global fog
  26423. */
  26424. set enabled(val: boolean);
  26425. get enabled(): boolean;
  26426. /**
  26427. * @zh 是否启用精确雾效(像素雾)计算
  26428. * @en Enable accurate fog (pixel fog)
  26429. */
  26430. set accurate(val: boolean);
  26431. get accurate(): boolean;
  26432. /**
  26433. * @zh 全局雾颜色
  26434. * @en Global fog color
  26435. */
  26436. set fogColor(val: Readonly<math.Color>);
  26437. get fogColor(): Readonly<math.Color>;
  26438. /**
  26439. * @zh 全局雾类型
  26440. * @en Global fog type
  26441. */
  26442. get type(): number;
  26443. set type(val: number);
  26444. /**
  26445. * @zh 全局雾浓度
  26446. * @en Global fog density
  26447. */
  26448. get fogDensity(): number;
  26449. set fogDensity(val: number);
  26450. /**
  26451. * @zh 雾效起始位置
  26452. * @en Global fog start position
  26453. */
  26454. get fogStart(): number;
  26455. set fogStart(val: number);
  26456. /**
  26457. * @zh 雾效结束位置,只适用于线性雾
  26458. * @en Global fog end position, only for linear fog
  26459. */
  26460. get fogEnd(): number;
  26461. set fogEnd(val: number);
  26462. /**
  26463. * @zh 雾效衰减
  26464. * @en Global fog attenuation
  26465. */
  26466. get fogAtten(): number;
  26467. set fogAtten(val: number);
  26468. /**
  26469. * @zh 雾效顶部范围,只适用于层级雾
  26470. * @en Global fog top range, only for layered fog
  26471. */
  26472. get fogTop(): number;
  26473. set fogTop(val: number);
  26474. /**
  26475. * @zh 雾效范围,只适用于层级雾
  26476. * @en Global fog range, only for layered fog
  26477. */
  26478. get fogRange(): number;
  26479. set fogRange(val: number);
  26480. protected _type: number;
  26481. protected _fogColor: math.Color;
  26482. protected _enabled: boolean;
  26483. protected _fogDensity: number;
  26484. protected _fogStart: number;
  26485. protected _fogEnd: number;
  26486. protected _fogAtten: number;
  26487. protected _fogTop: number;
  26488. protected _fogRange: number;
  26489. protected _accurate: boolean;
  26490. protected _resource: renderer.scene.Fog | null;
  26491. /**
  26492. * @en Activate the fog configuration in the render scene, no need to invoke manually.
  26493. * @zh 在渲染场景中启用雾效设置,不需要手动调用
  26494. * @param resource The fog configuration object in the render scene
  26495. */
  26496. activate(resource: renderer.scene.Fog): void;
  26497. }
  26498. /**
  26499. * @en Scene level shadow related configuration
  26500. * @zh 场景级别阴影相关的配置
  26501. */
  26502. export class ShadowsInfo {
  26503. /**
  26504. * @en Whether activate planar shadow
  26505. * @zh 是否启用平面阴影?
  26506. */
  26507. set enabled(val: boolean);
  26508. get enabled(): boolean;
  26509. /**
  26510. * @en The type of the shadow
  26511. * @zh 阴影渲染的类型
  26512. */
  26513. set type(val: number);
  26514. get type(): number;
  26515. /**
  26516. * @en Shadow color
  26517. * @zh 阴影颜色
  26518. */
  26519. set shadowColor(val: Readonly<math.Color>);
  26520. get shadowColor(): Readonly<math.Color>;
  26521. /**
  26522. * @en The normal of the plane which receives shadow
  26523. * @zh 阴影接收平面的法线
  26524. */
  26525. set planeDirection(val: Readonly<math.Vec3>);
  26526. get planeDirection(): Readonly<math.Vec3>;
  26527. /**
  26528. * @en The distance from coordinate origin to the receiving plane.
  26529. * @zh 阴影接收平面与原点的距离
  26530. */
  26531. set planeHeight(val: number);
  26532. get planeHeight(): number;
  26533. /**
  26534. * @en Positional offset values in planar shading calculations.
  26535. * @zh 平面阴影计算中的位置偏移值。
  26536. */
  26537. set planeBias(val: number);
  26538. get planeBias(): number;
  26539. /**
  26540. * @en get or set shadow max received
  26541. * @zh 获取或者设置阴影接收的最大光源数量
  26542. */
  26543. set maxReceived(val: number);
  26544. get maxReceived(): number;
  26545. /**
  26546. * @en get or set shadow map size
  26547. * @zh 获取或者设置阴影纹理大小
  26548. */
  26549. set shadowMapSize(value: number);
  26550. get shadowMapSize(): number;
  26551. protected _enabled: boolean;
  26552. protected _type: number;
  26553. protected _normal: math.Vec3;
  26554. protected _distance: number;
  26555. protected _planeBias: number;
  26556. protected _shadowColor: math.Color;
  26557. protected _maxReceived: number;
  26558. protected _size: math.Vec2;
  26559. protected _resource: renderer.scene.Shadows | null;
  26560. /**
  26561. * @en Set plane which receives shadow with the given node's world transformation
  26562. * @zh 根据指定节点的世界变换设置阴影接收平面的信息
  26563. * @param node The node for setting up the plane
  26564. */
  26565. setPlaneFromNode(node: Node): void;
  26566. /**
  26567. * @en Activate the shadow configuration in the render scene, no need to invoke manually.
  26568. * @zh 在渲染场景中启用阴影设置,不需要手动调用
  26569. * @param resource The shadow configuration object in the render scene
  26570. */
  26571. activate(resource: renderer.scene.Shadows): void;
  26572. }
  26573. export const DEFAULT_WORLD_MIN_POS: math.Vec3;
  26574. export const DEFAULT_WORLD_MAX_POS: math.Vec3;
  26575. export const DEFAULT_OCTREE_DEPTH = 8;
  26576. /**
  26577. * @en Scene management and culling configuration based on octree
  26578. * @zh 基于八叉树的场景剔除配置
  26579. */
  26580. export class OctreeInfo {
  26581. /**
  26582. * @en Whether activate scene culling based on octree
  26583. * @zh 是否启用八叉树加速剔除?
  26584. */
  26585. set enabled(val: boolean);
  26586. get enabled(): boolean;
  26587. /**
  26588. * @en The minimal position of the scene bounding box.
  26589. * Objects entirely outside the bounding box will be culled, other objects will be managed dynamically.
  26590. * @zh 场景包围盒的最小位置,完全超出包围盒的物体会被剔除,其他物体根据情况被动态剔除。
  26591. */
  26592. set minPos(val: math.Vec3);
  26593. get minPos(): math.Vec3;
  26594. /**
  26595. * @en The maximum position of the scene bounding box.
  26596. * Objects entirely outside the bounding box will be culled, other objects will be managed dynamically.
  26597. * @zh 场景包围盒的最大位置,完全超出包围盒的物体会被剔除,其他物体根据情况被动态剔除。
  26598. */
  26599. set maxPos(val: math.Vec3);
  26600. get maxPos(): math.Vec3;
  26601. /**
  26602. * @en The depth of the octree.
  26603. * @zh 八叉树的深度。
  26604. */
  26605. set depth(val: number);
  26606. get depth(): number;
  26607. protected _enabled: boolean;
  26608. protected _minPos: math.Vec3;
  26609. protected _maxPos: math.Vec3;
  26610. protected _depth: number;
  26611. protected _resource: renderer.scene.Octree | null;
  26612. /**
  26613. * @en Activate the octree configuration in the render scene, no need to invoke manually.
  26614. * @zh 在渲染场景中启用八叉树设置,不需要手动调用
  26615. * @param resource The octree configuration object in the render scene
  26616. */
  26617. activate(resource: renderer.scene.Octree): void;
  26618. }
  26619. /**
  26620. * @en Global skin in the render scene.
  26621. * @zh 渲染场景中的全局皮肤后处理设置。
  26622. */
  26623. export class SkinInfo {
  26624. /**
  26625. * @en Enable skip.
  26626. * @zh 是否开启皮肤后效。
  26627. */
  26628. set enabled(val: boolean);
  26629. get enabled(): boolean;
  26630. /**
  26631. * @en Getter/Setter sampler width.
  26632. * @zh 设置或者获取采样宽度。
  26633. */
  26634. set blurRadius(val: number);
  26635. get blurRadius(): number;
  26636. /**
  26637. * @en Getter/Setter depth unit scale.
  26638. * @zh 设置或者获取深度单位比例。
  26639. */
  26640. set sssIntensity(val: number);
  26641. get sssIntensity(): number;
  26642. protected _enabled: boolean;
  26643. protected _blurRadius: number;
  26644. protected _sssIntensity: number;
  26645. protected _resource: renderer.scene.Skin | null;
  26646. /**
  26647. * @en Activate the skin configuration in the render scene, no need to invoke manually.
  26648. * @zh 在渲染场景中启用皮肤设置,不需要手动调用
  26649. * @param resource The skin configuration object in the render scene
  26650. */
  26651. activate(resource: renderer.scene.Skin): void;
  26652. }
  26653. export class PostSettingsInfo {
  26654. /**
  26655. * @zh 色调映射类型
  26656. * @en Tone mapping type
  26657. */
  26658. set toneMappingType(val: number);
  26659. get toneMappingType(): number;
  26660. protected _toneMappingType: number;
  26661. protected _resource: renderer.scene.PostSettings | null;
  26662. activate(resource: renderer.scene.PostSettings): void;
  26663. }
  26664. export interface ILightProbeNode {
  26665. node: Node;
  26666. probes: math.Vec3[] | null;
  26667. }
  26668. /**
  26669. * @en light probe configuration
  26670. * @zh 光照探针配置
  26671. */
  26672. export class LightProbeInfo {
  26673. /**
  26674. * @en GI multiplier
  26675. * @zh GI乘数
  26676. */
  26677. set giScale(val: number);
  26678. get giScale(): number;
  26679. /**
  26680. * @en GI sample counts
  26681. * @zh GI 采样数量
  26682. */
  26683. set giSamples(val: number);
  26684. get giSamples(): number;
  26685. /**
  26686. * @en light bounces
  26687. * @zh 光照反弹次数
  26688. */
  26689. set bounces(val: number);
  26690. get bounces(): number;
  26691. /**
  26692. * @en Reduce ringing of light probe
  26693. * @zh 减少光照探针的振铃效果
  26694. */
  26695. set reduceRinging(val: number);
  26696. get reduceRinging(): number;
  26697. /**
  26698. * @en Whether to show light probe
  26699. * @zh 是否显示光照探针
  26700. */
  26701. set showProbe(val: boolean);
  26702. get showProbe(): boolean;
  26703. /**
  26704. * @en Whether to show light probe's connection
  26705. * @zh 是否显示光照探针连线
  26706. */
  26707. set showWireframe(val: boolean);
  26708. get showWireframe(): boolean;
  26709. /**
  26710. * @en Whether to show light probe's convex
  26711. * @zh 是否显示光照探针凸包
  26712. */
  26713. set showConvex(val: boolean);
  26714. get showConvex(): boolean;
  26715. /**
  26716. * @en light probe's vertex and tetrahedron data
  26717. * @zh 光照探针顶点及四面体数据
  26718. */
  26719. set data(val: LightProbesData | null);
  26720. get data(): LightProbesData | null;
  26721. /**
  26722. * @en The value of all light probe sphere display size
  26723. * @zh 光照探针全局显示大小
  26724. */
  26725. set lightProbeSphereVolume(val: number);
  26726. get lightProbeSphereVolume(): number;
  26727. protected _giScale: number;
  26728. protected _giSamples: number;
  26729. protected _bounces: number;
  26730. protected _reduceRinging: number;
  26731. protected _showProbe: boolean;
  26732. protected _showWireframe: boolean;
  26733. protected _showConvex: boolean;
  26734. protected _data: LightProbesData | null;
  26735. protected _lightProbeSphereVolume: number;
  26736. protected _nodes: ILightProbeNode[];
  26737. protected _scene: Scene | null;
  26738. protected _resource: LightProbes | null;
  26739. activate(scene: Scene, resource: LightProbes): void;
  26740. onProbeBakeFinished(): void;
  26741. onProbeBakeCleared(): void;
  26742. clearSHCoefficients(): void;
  26743. isUniqueNode(): boolean;
  26744. addNode(node: Node): boolean;
  26745. removeNode(node: Node): boolean;
  26746. syncData(node: Node, probes: math.Vec3[]): void;
  26747. update(updateTet?: boolean): void;
  26748. }
  26749. /**
  26750. * @en All scene related global parameters, it affects all content in the corresponding scene
  26751. * @zh 各类场景级别的渲染参数,将影响全场景的所有物体
  26752. */
  26753. export class SceneGlobals {
  26754. /**
  26755. * @en The environment lighting configuration
  26756. * @zh 场景的环境光照相关配置
  26757. */
  26758. ambient: AmbientInfo;
  26759. /**
  26760. * @en Scene level shadow related configuration
  26761. * @zh 平面阴影相关配置
  26762. */
  26763. shadows: ShadowsInfo;
  26764. /**
  26765. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  26766. */
  26767. _skybox: SkyboxInfo;
  26768. /**
  26769. * @en Global fog configuration
  26770. * @zh 全局雾相关配置
  26771. */
  26772. fog: FogInfo;
  26773. /**
  26774. * @en Skybox related configuration
  26775. * @zh 天空盒相关配置
  26776. */
  26777. get skybox(): SkyboxInfo;
  26778. set skybox(value: SkyboxInfo);
  26779. /**
  26780. * @en Octree related configuration
  26781. * @zh 八叉树相关配置
  26782. */
  26783. octree: OctreeInfo;
  26784. /**
  26785. * @en Octree related configuration
  26786. * @zh 八叉树相关配置
  26787. */
  26788. skin: SkinInfo;
  26789. /**
  26790. * @en Light probe related configuration
  26791. * @zh 光照探针相关配置
  26792. */
  26793. lightProbeInfo: LightProbeInfo;
  26794. /**
  26795. * @en Tone mapping related configuration
  26796. * @zh 色调映射相关配置
  26797. */
  26798. postSettings: PostSettingsInfo;
  26799. /**
  26800. * @en bake with stationary main light
  26801. * @zh 主光源是否以静止状态烘培
  26802. */
  26803. bakedWithStationaryMainLight: boolean;
  26804. /**
  26805. * @en bake lightmap with highp mode
  26806. * @zh 是否使用高精度模式烘培光照图
  26807. */
  26808. bakedWithHighpLightmap: boolean;
  26809. /**
  26810. * @en disable light map
  26811. * @zh 关闭光照图效果
  26812. */
  26813. disableLightmap: boolean;
  26814. /**
  26815. * @en Activate and initialize the global configurations of the scene, no need to invoke manually.
  26816. * @zh 启用和初始化场景全局配置,不需要手动调用
  26817. */
  26818. activate(scene: Scene): void;
  26819. }
  26820. /**
  26821. * @internal
  26822. * @deprecated since v3.5
  26823. */
  26824. export class PrivateNode extends Node {
  26825. constructor(name?: string);
  26826. }
  26827. /**
  26828. * @en The Camera Component.
  26829. * @zh 相机组件。
  26830. */
  26831. export class Camera extends Component {
  26832. /**
  26833. * @en The projection type enumeration of the camera.
  26834. * @zh 相机的投影类型枚举。
  26835. */
  26836. static ProjectionType: typeof renderer.scene.CameraProjection;
  26837. /**
  26838. * @en The axis type of the fov
  26839. * @zh FOV 的轴向枚举
  26840. */
  26841. static FOVAxis: typeof renderer.scene.CameraFOVAxis;
  26842. /**
  26843. * @en The clear flag enumeration of the camera.
  26844. * @zh 相机的清除标志位枚举。
  26845. */
  26846. static ClearFlag: {
  26847. /**
  26848. * @en Clear the screen with [[SceneGlobals.skybox]], will clear the depth and stencil buffer at the same time.
  26849. * @zh 使用指定天空盒 [[SceneGlobals.skybox]] 清屏,会同时清理深度和蒙版缓冲。
  26850. */
  26851. SKYBOX: number;
  26852. /**
  26853. * @en Clear the screen with the given [[Camera.clearColor]], will clear the depth and stencil buffer at the same time.
  26854. * @zh 使用指定的相机清屏颜色 [[Camera.clearColor]] 来清屏,会同时清理将深度和蒙版缓冲。
  26855. */
  26856. SOLID_COLOR: gfx.ClearFlagBit;
  26857. /**
  26858. * @en Only clear the depth and stencil buffer while keeping the color buffer intact. Often used in UI camera.
  26859. * @zh 只清理深度和蒙版缓冲,同时保留颜色缓冲不变。常用于 UI 相机。
  26860. */
  26861. DEPTH_ONLY: gfx.ClearFlagBit;
  26862. /**
  26863. * @en Don't clear anything and continue rendering.
  26864. * @zh 不清理任何内容就开始渲染,适合多 Camera 叠加渲染。
  26865. */
  26866. DONT_CLEAR: gfx.ClearFlagBit;
  26867. };
  26868. /**
  26869. * @en The aperture value's enumeration of the camera.
  26870. * @zh 相机的光圈值枚举。
  26871. */
  26872. static Aperture: typeof renderer.scene.CameraAperture;
  26873. /**
  26874. * @en The shutter value's enumeration of the camera.
  26875. * @zh 相机的快门值枚举。
  26876. */
  26877. static Shutter: typeof renderer.scene.CameraShutter;
  26878. /**
  26879. * @en The ISO value's enumeration of the camera.
  26880. * @zh 相机的感光度值枚举。
  26881. */
  26882. static ISO: typeof renderer.scene.CameraISO;
  26883. /**
  26884. * @en The event for target texture changing.
  26885. * @zh 目标贴图修改的事件。
  26886. */
  26887. static TARGET_TEXTURE_CHANGE: string;
  26888. protected _projection: renderer.scene.CameraProjection;
  26889. protected _priority: number;
  26890. protected _fov: number;
  26891. protected _fovAxis: renderer.scene.CameraFOVAxis;
  26892. protected _orthoHeight: number;
  26893. protected _near: number;
  26894. protected _far: number;
  26895. protected _color: math.Color;
  26896. protected _depth: number;
  26897. protected _stencil: number;
  26898. protected _clearFlags: gfx.ClearFlagBit;
  26899. protected _rect: math.Rect;
  26900. protected _aperture: renderer.scene.CameraAperture;
  26901. protected _shutter: renderer.scene.CameraShutter;
  26902. protected _iso: renderer.scene.CameraISO;
  26903. protected _screenScale: number;
  26904. protected _visibility: number;
  26905. protected _targetTexture: RenderTexture | null;
  26906. protected _postProcess: postProcess.PostProcess | null;
  26907. protected _usePostProcess: boolean;
  26908. protected _camera: renderer.scene.Camera | null;
  26909. protected _inEditorMode: boolean;
  26910. protected _flows: string[] | undefined;
  26911. protected _cameraType: renderer.scene.CameraType;
  26912. protected _trackingType: renderer.scene.TrackingType;
  26913. /**
  26914. * @en The render camera representation.
  26915. * @zh 渲染场景中的相机对象。
  26916. */
  26917. get camera(): renderer.scene.Camera;
  26918. /**
  26919. * @en Render priority of the camera. Cameras with higher depth are rendered after cameras with lower depth.
  26920. * @zh 相机的渲染优先级,值越小越优先渲染。
  26921. */
  26922. get priority(): number;
  26923. set priority(val: number);
  26924. /**
  26925. * @en Visibility mask, declaring a set of node layers that will be visible to this camera.
  26926. * @zh 可见性掩码,声明在当前相机中可见的节点层级集合。
  26927. */
  26928. get visibility(): number;
  26929. set visibility(val: number);
  26930. /**
  26931. * @en Clearing flags of the camera, specifies which part of the framebuffer will be actually cleared every frame.
  26932. * @zh 相机的缓冲清除标志位,指定帧缓冲的哪部分要每帧清除。
  26933. */
  26934. get clearFlags(): gfx.ClearFlagBit;
  26935. set clearFlags(val: gfx.ClearFlagBit);
  26936. /**
  26937. * @en Clearing color of the camera.
  26938. * @zh 相机的颜色缓冲默认值。
  26939. */
  26940. get clearColor(): Readonly<math.Color>;
  26941. set clearColor(val: Readonly<math.Color>);
  26942. /**
  26943. * @en Clearing depth of the camera.
  26944. * @zh 相机的深度缓冲默认值。
  26945. */
  26946. get clearDepth(): number;
  26947. set clearDepth(val: number);
  26948. /**
  26949. * @en Clearing stencil of the camera.
  26950. * @zh 相机的模板缓冲默认值。
  26951. */
  26952. get clearStencil(): number;
  26953. set clearStencil(val: number);
  26954. /**
  26955. * @en Projection type of the camera.
  26956. * @zh 相机的投影类型。
  26957. */
  26958. get projection(): renderer.scene.CameraProjection;
  26959. set projection(val: renderer.scene.CameraProjection);
  26960. /**
  26961. * @en The axis on which the FOV would be fixed regardless of screen aspect changes.
  26962. * @zh 指定视角的固定轴向,在此轴上不会跟随屏幕长宽比例变化。
  26963. */
  26964. get fovAxis(): renderer.scene.CameraFOVAxis;
  26965. set fovAxis(val: renderer.scene.CameraFOVAxis);
  26966. /**
  26967. * @en Field of view of the camera.
  26968. * @zh 相机的视角大小。
  26969. */
  26970. get fov(): number;
  26971. set fov(val: number);
  26972. /**
  26973. * @en Viewport height in orthographic mode.
  26974. * @zh 正交模式下的相机视角高度。
  26975. */
  26976. get orthoHeight(): number;
  26977. set orthoHeight(val: number);
  26978. /**
  26979. * @en Near clipping distance of the camera, should be as large as possible within acceptable range.
  26980. * @zh 相机的近裁剪距离,应在可接受范围内尽量取最大。
  26981. */
  26982. get near(): number;
  26983. set near(val: number);
  26984. /**
  26985. * @en Far clipping distance of the camera, should be as small as possible within acceptable range.
  26986. * @zh 相机的远裁剪距离,应在可接受范围内尽量取最小。
  26987. */
  26988. get far(): number;
  26989. set far(val: number);
  26990. /**
  26991. * @en Camera aperture, controls the exposure parameter.
  26992. * @zh 相机光圈,影响相机的曝光参数。
  26993. */
  26994. get aperture(): renderer.scene.CameraAperture;
  26995. set aperture(val: renderer.scene.CameraAperture);
  26996. /**
  26997. * @en Camera shutter, controls the exposure parameter.
  26998. * @zh 相机快门,影响相机的曝光参数。
  26999. */
  27000. get shutter(): renderer.scene.CameraShutter;
  27001. set shutter(val: renderer.scene.CameraShutter);
  27002. /**
  27003. * @en Camera ISO, controls the exposure parameter.
  27004. * @zh 相机感光度,影响相机的曝光参数。
  27005. */
  27006. get iso(): renderer.scene.CameraISO;
  27007. set iso(val: renderer.scene.CameraISO);
  27008. /**
  27009. * @en Screen viewport of the camera wrt. the sceen size.
  27010. * @zh 此相机最终渲染到屏幕上的视口位置和大小。
  27011. */
  27012. get rect(): math.Rect;
  27013. set rect(val: math.Rect);
  27014. /**
  27015. * @en Output render texture of the camera. Default to null, which outputs directly to screen.
  27016. * @zh 指定此相机的渲染输出目标贴图,默认为空,直接渲染到屏幕。
  27017. */
  27018. get targetTexture(): RenderTexture | null;
  27019. set targetTexture(value: RenderTexture | null);
  27020. get usePostProcess(): boolean;
  27021. set usePostProcess(v: boolean);
  27022. get postProcess(): postProcess.PostProcess | null;
  27023. set postProcess(v: postProcess.PostProcess | null);
  27024. /**
  27025. * @en Scale of the internal buffer size,
  27026. * set to 1 to keep the same with the canvas size.
  27027. * @zh 相机内部缓冲尺寸的缩放值, 1 为与 canvas 尺寸相同。
  27028. */
  27029. get screenScale(): number;
  27030. set screenScale(val: number);
  27031. /**
  27032. * @internal
  27033. */
  27034. get inEditorMode(): boolean;
  27035. set inEditorMode(value: boolean);
  27036. /**
  27037. * @internal
  27038. */
  27039. get cameraType(): renderer.scene.CameraType;
  27040. set cameraType(val: renderer.scene.CameraType);
  27041. /**
  27042. * @internal
  27043. */
  27044. get trackingType(): renderer.scene.TrackingType;
  27045. set trackingType(val: renderer.scene.TrackingType);
  27046. onLoad(): void;
  27047. onEnable(): void;
  27048. onDisable(): void;
  27049. onDestroy(): void;
  27050. /**
  27051. * @en Convert a screen space (left-top origin) point to a ray.
  27052. * @zh 将一个屏幕空间(左上角为原点)坐标转换为射线。
  27053. * @param x The x axis position on screen.
  27054. * @param y The y axis position on screen.
  27055. * @param out The output ray object.
  27056. * @returns Return the output ray object.
  27057. */
  27058. screenPointToRay(x: number, y: number, out?: geometry.Ray): geometry.Ray;
  27059. /**
  27060. * @en Convert a world position to a screen space (left-top origin) position.
  27061. * @zh 将一个世界空间坐标转换为屏幕空间(左上角为原点)坐标。
  27062. * @param worldPos The position in world space coordinates
  27063. * @param out The output position in screen space coordinates.
  27064. * @returns Return the output position object.
  27065. */
  27066. worldToScreen(worldPos: math.Vec3 | Readonly<math.Vec3>, out?: math.Vec3): math.Vec3;
  27067. /**
  27068. * @en Convert a screen space (left-top origin) position to a world space position.
  27069. * @zh 将一个屏幕空间(左上角为原点)转换为世界空间坐标。
  27070. * @param screenPos The position in screen space coordinates
  27071. * @param out The output position in world space coordinates
  27072. * @returns Return the output position object.
  27073. */
  27074. screenToWorld(screenPos: math.Vec3, out?: math.Vec3): math.Vec3;
  27075. /**
  27076. * @en Convert a 3D world position to the local coordinates system of the given UI node.
  27077. * The converted position will be related to the given UI node under local space.
  27078. * @zh 将一个 3D 空间世界坐标转换到指定的 UI 本地节点坐标系下。转换后的位置是指定 UI 节点坐标系下的局部偏移。
  27079. * @param wpos @en The world position to convert @zh 需要转换的世界坐标
  27080. * @param uiNode @en The UI node coordinates in which the world position will be convert to @zh 用于同步位置的 UI 节点
  27081. * @param out @en Return the corresponding position of the given world position in the UI node's local coordinates @zh 返回传入的世界坐标在 UI 节点本地坐标系下的局部坐标
  27082. *
  27083. * @example
  27084. * ```ts
  27085. * this.convertToUINode(target.worldPosition, uiNode.parent, out);
  27086. * uiNode.position = out;
  27087. * ```
  27088. */
  27089. convertToUINode(wpos: math.Vec3 | Readonly<math.Vec3>, uiNode: Node, out?: math.Vec3): math.Vec3;
  27090. /**
  27091. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27092. */
  27093. _createCamera(): void;
  27094. protected _attachToScene(): void;
  27095. protected _detachFromScene(): void;
  27096. protected _checkTargetTextureEvent(old: RenderTexture | null): void;
  27097. protected _updateTargetTexture(): void;
  27098. }
  27099. /**
  27100. * @internal
  27101. */
  27102. export namespace Camera {
  27103. export type ProjectionType = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__ProjectionType>;
  27104. export type FOVAxis = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__FOVAxis>;
  27105. export type ClearFlag = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__ClearFlag>;
  27106. export type Aperture = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__Aperture>;
  27107. export type Shutter = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__Shutter>;
  27108. export type ISO = __private.__types_globals__EnumAlias<typeof __private._cocos_misc_camera_component__ISO>;
  27109. }
  27110. /**
  27111. * @en Base class for all rendering components containing model.
  27112. * @zh 所有包含 model 的渲染组件基类。
  27113. */
  27114. export class ModelRenderer extends Renderer {
  27115. /**
  27116. * @en The visibility which will be applied to the committed models.
  27117. * @zh 应用于所有提交渲染的 Model 的可见性
  27118. */
  27119. get visibility(): number;
  27120. set visibility(val: number);
  27121. /**
  27122. * @en The priority which will be applied to the committed models.(Valid only in transparent queues)
  27123. * @zh 应用于所有提交渲染的 Model 的排序优先级(只在半透明渲染队列中起效)
  27124. */
  27125. get priority(): number;
  27126. set priority(val: number);
  27127. protected _visFlags: number;
  27128. protected _models: renderer.scene.Model[];
  27129. protected _priority: number;
  27130. /**
  27131. * @zh 收集组件中的 models
  27132. * @en Collect the models in this component.
  27133. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27134. */
  27135. _collectModels(): renderer.scene.Model[];
  27136. protected onEnable(): void;
  27137. protected _attachToScene(): void;
  27138. protected _onVisibilityChange(val: any): void;
  27139. protected _updatePriority(): void;
  27140. }
  27141. /**
  27142. * @en Base class for all components which can submit contents for the rendering process.
  27143. * It manages a series of [[renderer.Model]]s and the visibility, the materials and the material instances of the models.
  27144. * There are several different material properties that must be distinguished clearly and used with caution:
  27145. * - [[sharedMaterials]] are shared for all component instances that are using the same material asset, modification will be applied universally.
  27146. * - [[materials]] are instances created independently for the component instance, modification will only be applied for the component instance.
  27147. * - Render Materials retrieved by [[getRenderMaterial]] are materials used for the actual rendering process, material instances are used if exist.
  27148. * By default, shared materials are used for rendering.
  27149. * Material instances are created only when user try to retrieve a material instance with [[material]], [[materials]] and [[getMaterialInstance]].
  27150. * @zh 所有可以提交内容到渲染流程的可渲染类的基类,它管理着一组 [[renderer.Model]],以及它们的可见性、材质和材质实例。
  27151. * 下面是这个组件所管理的各种材质属性的解释,需要正确区分并小心使用:
  27152. * - [[sharedMaterials]] 是共享材质,所有使用此材质资源的组件实例都默认使用材质的共享实例对象,所有修改都会影响所有使用它的组件实例。
  27153. * - [[materials]] 是专为组件对象创建的独立材质实例,所有修改仅会影响当前组件对象。
  27154. * - 使用 [[getRenderMaterial]] 获取的渲染材质是用于实际渲染流程的材质对象,当存在材质实例的时候,永远使用材质实例。
  27155. * 默认情况下,渲染组件使用共享材质进行渲染,材质实例也不会被创建出来。仅在用户通过 [[material]],[[materials]] 和 [[getMaterialInstance]] 接口获取材质时才会创建材质实例。
  27156. */
  27157. export class Renderer extends Component {
  27158. /**
  27159. * @en Get the default shared material
  27160. * @zh 获取默认的共享材质
  27161. */
  27162. get sharedMaterial(): Material | null;
  27163. /**
  27164. * @en All shared materials of model
  27165. * @zh 模型的所有共享材质
  27166. */
  27167. get sharedMaterials(): (Material | null)[];
  27168. set sharedMaterials(val: (Material | null)[]);
  27169. /**
  27170. * @en The default material instance, it will create a new instance from the default shared material if not created yet.
  27171. * @zh 获取默认的材质实例,如果还没有创建,将会根据默认共享材质创建一个新的材质实例
  27172. */
  27173. get material(): Material | renderer.MaterialInstance | null;
  27174. set material(val: Material | renderer.MaterialInstance | null);
  27175. /**
  27176. * @en The materials of the model.
  27177. * @zh 所有模型材质。
  27178. */
  27179. get materials(): (Material | renderer.MaterialInstance | null)[];
  27180. set materials(val: (Material | renderer.MaterialInstance | null)[]);
  27181. protected _materials: (Material | null)[];
  27182. protected _materialInstances: (renderer.MaterialInstance | null)[];
  27183. /**
  27184. * @deprecated Since v3.7.3, please use [[getSharedMaterial]] instead.
  27185. */
  27186. getMaterial(idx: number): Material | null;
  27187. /**
  27188. * @deprecated Since v3.8.1, please use [[setSharedMaterial]] instead.
  27189. */
  27190. setMaterial(material: Material | null, index: number): void;
  27191. /**
  27192. * @en Get the shared material asset of the specified sub-model.
  27193. * @zh 获取指定子模型的共享材质资源。
  27194. */
  27195. getSharedMaterial(idx: number): Material | null;
  27196. /**
  27197. * @en Set the shared material asset of the specified sub-model,
  27198. * new material instance will be created automatically if the sub-model is already using one.
  27199. * @zh 设置指定子模型的 sharedMaterial,如果对应位置有材质实例则会创建一个对应的材质实例。
  27200. */
  27201. setSharedMaterial(material: Material | null, index: number): void;
  27202. /**
  27203. * @en Get the material instance of the specified sub-model.
  27204. * It will create a new instance from the corresponding shared material if not created yet.
  27205. * @zh 获取指定子模型的材质实例。如果还没有创建,将会根据对应的共享材质创建一个新的材质实例
  27206. */
  27207. getMaterialInstance(idx: number): renderer.MaterialInstance | null;
  27208. /**
  27209. * @en Set the material instance of the specified sub-model.
  27210. * @zh 获取指定子模型的材质实例。
  27211. */
  27212. setMaterialInstance(matInst: Material | renderer.MaterialInstance | null, index: number): void;
  27213. /**
  27214. * @en Get the actual rendering material of the specified sub-model.
  27215. * (material instance if there is one, or the shared material asset)
  27216. * @zh 获取指定位置可供渲染的材质,如果有材质实例则使用材质实例,如果没有则使用材质资源
  27217. */
  27218. getRenderMaterial(index: number): Material | null;
  27219. protected _onMaterialModified(index: number, material: Material | null): void;
  27220. protected _clearMaterials(): void;
  27221. }
  27222. /**
  27223. * @en
  27224. * A temp fallback to contain the original component which can not be loaded.
  27225. * @zh
  27226. * 包含无法加载的原始组件的临时回退。
  27227. */
  27228. export class MissingScript extends Component {
  27229. static safeFindClass(id: string): __private.__types_globals__Constructor<unknown> | undefined;
  27230. /**
  27231. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27232. */
  27233. _$erialized: null;
  27234. constructor();
  27235. onLoad(): void;
  27236. }
  27237. /**
  27238. * @en
  27239. * Since the new Prefab system is not yet complete, the prefab that has a large difference with prefab asset cannot be automatically migrated.
  27240. * This component is used to save the relationship between the node with the referenced prefab asset in the old Prefab system.
  27241. * When the new Prefab system is complete, it will be automatically migrated to the new Prefab system.
  27242. *
  27243. * @zh
  27244. * PrefabLink
  27245. * 由于新的 Prefab 系统还不完善,所以旧的 Prefab 系统中和 Prefab 资源差异过大的 Prefab 无法实现自动迁移。
  27246. * 此组件用于保存在旧 Prefab 系统中这个节点关联的 Prefab 资源,等新的 Prefab 系统完善,会自动迁移到新的 Prefab 系统上。
  27247. */
  27248. export class PrefabLink extends Component {
  27249. prefab: Prefab | null;
  27250. }
  27251. /**
  27252. * @en
  27253. * ATTENTION: USE `director` INSTEAD OF `Director`.
  27254. * `director` is a singleton object which manage your game's logic flow.
  27255. * Since the `director` is a singleton, you don't need to call any constructor or create functions,
  27256. * the standard way to use it is by calling:
  27257. * `director.methodName();`
  27258. * It creates and handle the main Window and manages how and when to execute the Scenes.
  27259. *
  27260. * @zh
  27261. * 注意:用 `director` 代替 `Director`。
  27262. * `director` 一个管理你的游戏的逻辑流程的单例对象。
  27263. * 由于 `director` 是一个单例,你不需要调用任何构造函数或创建函数,
  27264. * 使用它的标准方法是通过调用:
  27265. * `director.methodName();`
  27266. * 它创建和处理主窗口并且管理什么时候执行场景。
  27267. */
  27268. export class Director extends EventTarget {
  27269. /**
  27270. * @en The event which will be triggered when the singleton of Director initialized.
  27271. * @zh Director 单例初始化时触发的事件
  27272. * @event Director.EVENT_INIT
  27273. */
  27274. static readonly EVENT_INIT = "director_init";
  27275. /**
  27276. * @en The event which will be triggered when the singleton of Director reset.
  27277. * @zh Director 单例重置时触发的事件
  27278. * @event Director.EVENT_RESET
  27279. */
  27280. static readonly EVENT_RESET = "director_reset";
  27281. /**
  27282. * @en The event which will be triggered before loading a new scene.
  27283. * @zh 加载新场景之前所触发的事件。
  27284. * @event Director.EVENT_BEFORE_SCENE_LOADING
  27285. */
  27286. static readonly EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading";
  27287. /**
  27288. * @en The event which will be triggered before launching a new scene.
  27289. * @zh 运行新场景之前所触发的事件。
  27290. * @event Director.EVENT_BEFORE_SCENE_LAUNCH
  27291. */
  27292. static readonly EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch";
  27293. /**
  27294. * @en The event which will be triggered after launching a new scene.
  27295. * @zh 运行新场景之后所触发的事件。
  27296. * @event Director.EVENT_AFTER_SCENE_LAUNCH
  27297. */
  27298. static readonly EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch";
  27299. /**
  27300. * @en The event which will be triggered at the beginning of every frame.
  27301. * @zh 每个帧的开始时所触发的事件。
  27302. * @event Director.EVENT_BEFORE_UPDATE
  27303. */
  27304. static readonly EVENT_BEFORE_UPDATE = "director_before_update";
  27305. /**
  27306. * @en The event which will be triggered after engine and components update logic.
  27307. * @zh 将在引擎和组件 “update” 逻辑之后所触发的事件。
  27308. * @event Director.EVENT_AFTER_UPDATE
  27309. */
  27310. static readonly EVENT_AFTER_UPDATE = "director_after_update";
  27311. /**
  27312. * @en The event which will be triggered before the rendering process.
  27313. * @zh 渲染过程之前所触发的事件。
  27314. * @event Director.EVENT_BEFORE_DRAW
  27315. */
  27316. static readonly EVENT_BEFORE_DRAW = "director_before_draw";
  27317. /**
  27318. * @en The event which will be triggered after the rendering process.
  27319. * @zh 渲染过程之后所触发的事件。
  27320. * @event Director.EVENT_AFTER_DRAW
  27321. */
  27322. static readonly EVENT_AFTER_DRAW = "director_after_draw";
  27323. /**
  27324. * @en The event which will be triggered before the pipeline render commit.
  27325. * @zh 当前渲染帧提交前所触发的事件。
  27326. * @event Director.EVENT_BEFORE_COMMIT
  27327. */
  27328. static readonly EVENT_BEFORE_COMMIT = "director_before_commit";
  27329. /**
  27330. * @en The event which will be triggered before the render pipeline processes the render scene.
  27331. * @zh 当前帧将渲染场景提交到渲染管线之前所触发的事件。
  27332. * @event Director.EVENT_BEFORE_RENDER
  27333. */
  27334. static readonly EVENT_BEFORE_RENDER = "director_before_render";
  27335. /**
  27336. * @en The event which will be triggered after the render pipeline finishes the rendering process on CPU.
  27337. * @zh 当前帧渲染管线渲染流程完成后所触发的事件。
  27338. * @event Director.EVENT_AFTER_RENDER
  27339. */
  27340. static readonly EVENT_AFTER_RENDER = "director_after_render";
  27341. /**
  27342. * @en The event which will be triggered before the physics process.<br/>
  27343. * @zh 物理过程之前所触发的事件。
  27344. * @event Director.EVENT_BEFORE_PHYSICS
  27345. */
  27346. static readonly EVENT_BEFORE_PHYSICS = "director_before_physics";
  27347. /**
  27348. * @en The event which will be triggered after the physics process.<br/>
  27349. * @zh 物理过程之后所触发的事件。
  27350. * @event Director.EVENT_AFTER_PHYSICS
  27351. */
  27352. static readonly EVENT_AFTER_PHYSICS = "director_after_physics";
  27353. /**
  27354. * @en The event which will be triggered at the frame begin.<br/>
  27355. * @zh 一帧开始时所触发的事件。
  27356. * @event Director.EVENT_BEGIN_FRAME
  27357. */
  27358. static readonly EVENT_BEGIN_FRAME = "director_begin_frame";
  27359. /**
  27360. * @en The event which will be triggered at the frame end.<br/>
  27361. * @zh 一帧结束之后所触发的事件。
  27362. * @event Director.EVENT_END_FRAME
  27363. */
  27364. static readonly EVENT_END_FRAME = "director_end_frame";
  27365. static instance: Director;
  27366. /**
  27367. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27368. */
  27369. _compScheduler: __private._cocos_scene_graph_component_scheduler__ComponentScheduler;
  27370. /**
  27371. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27372. */
  27373. _nodeActivator: NodeActivator;
  27374. constructor();
  27375. /**
  27376. * @en Calculates delta time since last time it was called, the result is saved to an internal property.
  27377. * @zh 计算从上一帧到现在的时间间隔,结果保存在私有属性中
  27378. * @deprecated since v3.3.0 no need to use it anymore
  27379. */
  27380. calculateDeltaTime(now: any): void;
  27381. /**
  27382. * @en End the life of director in the next frame
  27383. * @zh 执行完当前帧后停止 director 的执行
  27384. */
  27385. end(): void;
  27386. /**
  27387. * @en Pause the director's ticker, only involve the game logic execution.<br>
  27388. * It won't pause the rendering process nor the event manager.<br>
  27389. * If you want to pause the entire game including rendering, audio and event,<br>
  27390. * please use `game.pause`.
  27391. * @zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。<br>
  27392. * 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 `game.pause` 。
  27393. */
  27394. pause(): void;
  27395. /**
  27396. * @en Purge the `director` itself, including unschedule all schedule,<br>
  27397. * remove all event listeners, clean up and exit the running scene, stops all animations, clear cached data.
  27398. * @zh 清除 `director` 本身,包括停止所有的计时器,<br>
  27399. * 移除所有的事件监听器,清理并退出当前运行的场景,停止所有动画,清理缓存数据。
  27400. */
  27401. purgeDirector(): void;
  27402. /**
  27403. * @en Reset the director, can be used to restart the director after purge
  27404. * @zh 重置此 Director,可用于在清除后重启 Director。
  27405. */
  27406. reset(): void;
  27407. /**
  27408. * @en
  27409. * Run a scene. Replaces the running scene with a new one or enter the first scene.<br>
  27410. * The new scene will be launched immediately.
  27411. * @zh 运行指定场景。将正在运行的场景替换为(或重入为)新场景。新场景将立即启动。
  27412. * @param scene - The need run scene.
  27413. * @param onBeforeLoadScene - The function invoked at the scene before loading.
  27414. * @param onLaunched - The function invoked at the scene after launch.
  27415. */
  27416. runSceneImmediate(scene: Scene | SceneAsset, onBeforeLoadScene?: Director.OnBeforeLoadScene, onLaunched?: Director.OnSceneLaunched): void;
  27417. /**
  27418. * @en
  27419. * Run a scene. Replaces the running scene with a new one or enter the first scene.<br>
  27420. * The new scene will be launched at the end of the current frame.<br>
  27421. * @zh 运行指定场景。
  27422. * @param scene - The need run scene.
  27423. * @param onBeforeLoadScene - The function invoked at the scene before loading.
  27424. * @param onLaunched - The function invoked at the scene after launch.
  27425. * @private
  27426. */
  27427. runScene(scene: Scene | SceneAsset, onBeforeLoadScene?: Director.OnBeforeLoadScene, onLaunched?: Director.OnSceneLaunched): void;
  27428. /**
  27429. * @en Loads the scene by its name.
  27430. * @zh 通过场景名称进行加载场景。
  27431. *
  27432. * @param sceneName - The name of the scene to load.
  27433. * @param onLaunched - callback, will be called after scene launched.
  27434. * @return if error, return false
  27435. */
  27436. loadScene(sceneName: string, onLaunched?: Director.OnSceneLaunched, onUnloaded?: Director.OnUnload): boolean;
  27437. /**
  27438. * @en
  27439. * Pre-loads the scene asset to reduces loading time. You can call this method at any time you want.<br>
  27440. * After calling this method, you still need to launch the scene by `director.loadScene`.<br>
  27441. * It will be totally fine to call `director.loadScene` at any time even if the preloading is not<br>
  27442. * yet finished, the scene will be launched after loaded automatically.
  27443. * @zh 预加载场景资源,你可以在任何时候调用这个方法。
  27444. * 调用完后,你仍然需要通过 `director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。<br>
  27445. * 就算预加载还没完成,你也可以直接调用 `director.loadScene`,加载完成后场景就会启动。
  27446. * @param sceneName @en The name of the scene to load @zh 场景名称。
  27447. * @param onLoaded @en Callback to execute once the scene is loaded @zh 加载回调。
  27448. */
  27449. preloadScene(sceneName: string, onLoaded?: Director.OnSceneLoaded): void;
  27450. /**
  27451. * @en
  27452. * Pre-loads the scene to reduces loading time. You can call this method at any time you want.<br>
  27453. * After calling this method, you still need to launch the scene by `director.loadScene`.<br>
  27454. * It will be totally fine to call `director.loadScene` at any time even if the preloading is not<br>
  27455. * yet finished, the scene will be launched after loaded automatically.
  27456. * @zh 预加载场景,你可以在任何时候调用这个方法。
  27457. * 调用完后,你仍然需要通过 `director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。<br>
  27458. * 就算预加载还没完成,你也可以直接调用 `director.loadScene`,加载完成后场景就会启动。
  27459. * @param sceneName @en The name of scene to load @zh 场景名称。
  27460. * @param onProgress @en Callback to execute when the load progression change. @zh 加载进度回调。
  27461. * @param onLoaded @en Callback to execute once the scene is loaded @zh 加载回调。
  27462. */
  27463. preloadScene(sceneName: string, onProgress: Director.OnLoadSceneProgress, onLoaded: Director.OnSceneLoaded): void;
  27464. /**
  27465. * @en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  27466. * @zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  27467. */
  27468. resume(): void;
  27469. get root(): Root | null;
  27470. /**
  27471. * @en Returns current logic Scene.
  27472. * @zh 获取当前逻辑场景。
  27473. * @example
  27474. * ```
  27475. * import { director } from 'cc';
  27476. * // This will help you to get the Canvas node in scene
  27477. * director.getScene().getChildByName('Canvas');
  27478. * ```
  27479. */
  27480. getScene(): Scene | null;
  27481. /**
  27482. * @en Returns the delta time since last frame.
  27483. * @zh 获取上一帧的增量时间。
  27484. * @deprecated since v3.3.0, please use game.deltaTime instead
  27485. */
  27486. getDeltaTime(): number;
  27487. /**
  27488. * @en Returns the total passed time since game start, unit: ms
  27489. * @zh 获取从游戏开始到现在总共经过的时间,单位为 ms
  27490. * @deprecated since v3.3.0, please use game.totalTime instead
  27491. */
  27492. getTotalTime(): number;
  27493. /**
  27494. * @en Returns the current time.
  27495. * @zh 获取当前帧的时间。
  27496. * @deprecated since v3.3.0, please use game.frameStartTime instead
  27497. */
  27498. getCurrentTime(): number;
  27499. /**
  27500. * @en Returns how many frames were called since the director started.
  27501. * @zh 获取 director 启动以来游戏运行的总帧数。
  27502. */
  27503. getTotalFrames(): number;
  27504. /**
  27505. * @en Returns whether or not the Director is paused.
  27506. * @zh 是否处于暂停状态。
  27507. */
  27508. isPaused(): boolean;
  27509. /**
  27510. * @en Returns the scheduler associated with this director.
  27511. * @zh 获取和 director 相关联的调度器。
  27512. */
  27513. getScheduler(): Scheduler;
  27514. /**
  27515. * @en Sets the scheduler associated with this director.
  27516. * @zh 设置和 director 相关联的调度器。
  27517. */
  27518. setScheduler(scheduler: Scheduler): void;
  27519. /**
  27520. * @en Register a system.
  27521. * @zh 注册一个系统。
  27522. */
  27523. registerSystem(name: string, sys: System, priority: number): void;
  27524. unregisterSystem(sys: System): void;
  27525. /**
  27526. * @en get a system.
  27527. * @zh 获取一个 system。
  27528. */
  27529. getSystem(name: string): System | undefined;
  27530. /**
  27531. * @en Returns the `AnimationManager` associated with this director. Please use getSystem(AnimationManager.ID)
  27532. * @zh 获取和 director 相关联的 `AnimationManager`(动画管理器)。请使用 getSystem(AnimationManager.ID) 来替代
  27533. * @deprecated since 3.0.0
  27534. */
  27535. getAnimationManager(): any;
  27536. /**
  27537. * @en Starts the director
  27538. * @zh 开始执行游戏逻辑
  27539. */
  27540. startAnimation(): void;
  27541. /**
  27542. * @en Stops the director
  27543. * @zh 停止执行游戏逻辑,每帧渲染会继续执行
  27544. */
  27545. stopAnimation(): void;
  27546. /**
  27547. * @en Run main loop of director
  27548. * @zh 运行主循环
  27549. * @deprecated Since v3.6, please use [tick] instead
  27550. */
  27551. mainLoop(now: number): void;
  27552. /**
  27553. * @en Run main loop of director
  27554. * @zh 运行主循环
  27555. * @param dt Delta time in seconds
  27556. */
  27557. tick(dt: number): void;
  27558. /**
  27559. * @internal
  27560. */
  27561. init(): void;
  27562. /**
  27563. * @en
  27564. * Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br>
  27565. * The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  27566. * @zh
  27567. * 声明常驻根节点,该节点不会在场景切换中被销毁。<br>
  27568. * 目标节点必须位于为层级的根节点,否则无效。
  27569. * @param node - The node to be made persistent
  27570. */
  27571. addPersistRootNode(node: Node): void;
  27572. /**
  27573. * @en Remove a persistent root node.
  27574. * @zh 取消常驻根节点。
  27575. * @param node - The node to be removed from persistent node list
  27576. */
  27577. removePersistRootNode(node: Node): void;
  27578. /**
  27579. * @en Check whether the node is a persistent root node.
  27580. * @zh 检查节点是否是常驻根节点。
  27581. * @param node - The node to be checked
  27582. */
  27583. isPersistRootNode(node: Node): boolean;
  27584. }
  27585. export namespace Director {
  27586. export type OnBeforeLoadScene = () => void;
  27587. export type OnUnload = () => void;
  27588. export type OnSceneLoaded = (error: null | Error, sceneAsset?: SceneAsset) => void;
  27589. export type OnSceneLaunched = (error: null | Error, scene?: Scene) => void;
  27590. /**
  27591. * @param completedCount - The number of the items that are already completed.
  27592. * @param totalCount - The total number of the items.
  27593. * @param item - The latest item which flow out the pipeline.
  27594. */
  27595. export type OnLoadSceneProgress = (completedCount: number, totalCount: number, item: any) => void;
  27596. }
  27597. /**
  27598. * @en Director of the game, used to control game update loop and scene management
  27599. * @zh 游戏的导演,用于控制游戏更新循环与场景管理。
  27600. */
  27601. export const director: Director;
  27602. /**
  27603. * @zh
  27604. * 游戏配置。
  27605. * @en
  27606. * Game configuration.
  27607. */
  27608. export interface IGameConfig {
  27609. /**
  27610. * @zh
  27611. * 引擎配置文件路径
  27612. * @en
  27613. * The path of settings.json
  27614. */
  27615. settingsPath?: string;
  27616. /**
  27617. * @zh
  27618. * 引擎内 Effect 配置文件路径
  27619. * @en
  27620. * The path of effectSettings.json
  27621. */
  27622. effectSettingsPath?: string;
  27623. /**
  27624. * @zh
  27625. * 设置 debug 模式,在浏览器中这个选项会被忽略。
  27626. * @en
  27627. * Set debug mode, only valid in non-browser environment.
  27628. */
  27629. debugMode?: DebugMode;
  27630. /**
  27631. * @zh
  27632. * 覆盖 settings 模块中的配置项, 用于控制引擎的启动和初始化,你可以在 game.init 中传入参数,也可以在 [game.onPostBaseInitDelegate] 事件回调中覆盖。
  27633. * 需要注意的是你需要在 application.js 模板中指定此选项和监听此事件。
  27634. * @en
  27635. * Overrides the settings module's some configuration, which is used to control the startup and initialization of the engine.
  27636. * You can pass in parameters in game.init or override them in the [game.onPostBaseInitDelegate] event callback.
  27637. * Note: you need to specify this option in the application.js template or add a delegate callback.
  27638. */
  27639. overrideSettings: Partial<{
  27640. [k in Settings.Category[keyof Settings.Category]]: Record<string, any>;
  27641. }>;
  27642. /**
  27643. * @zh
  27644. * 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。
  27645. * @en
  27646. * Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.
  27647. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.PROFILING: { "showFPS": true }}``` to set this.
  27648. */
  27649. showFPS?: boolean;
  27650. /**
  27651. * @zh
  27652. * 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。
  27653. * @en
  27654. * Set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
  27655. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { "frameRate": 60 }}``` to set this.
  27656. */
  27657. frameRate?: number;
  27658. /**
  27659. * @zh
  27660. * 渲染模式。
  27661. * 设置渲染器类型,仅适用于 web 端:
  27662. * - 0 - 通过引擎自动选择。
  27663. * - 1 - 强制使用 canvas 渲染。
  27664. * - 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。
  27665. * - 3 - 使用空渲染器,可以用于测试和服务器端环境,目前暂时用于 Cocos 内部测试使用
  27666. * @en
  27667. * Sets the renderer type, only useful on web:
  27668. * - 0 - Automatically chosen by engine.
  27669. * - 1 - Forced to use canvas renderer.
  27670. * - 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers.
  27671. * - 3 - Use Headless Renderer, which is useful in test or server env, only for internal use by cocos team for now
  27672. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.RENDERING: { "renderMode": 0 }}``` to set this.
  27673. */
  27674. renderMode?: 0 | 1 | 2 | 3;
  27675. /**
  27676. * @en
  27677. * Render pipeline resources
  27678. * @zh
  27679. * Render pipeline 资源
  27680. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.RENDERING: { "renderPipeline": '' }}``` to set this.
  27681. */
  27682. renderPipeline?: string;
  27683. /**
  27684. * @en
  27685. * Asset Manager initialization options
  27686. * @zh
  27687. * 资源管理器初始化设置
  27688. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.ASSETS: {}}``` to set this.
  27689. */
  27690. assetOptions?: __private._cocos_asset_asset_manager_asset_manager__IAssetManagerOptions;
  27691. /**
  27692. * @en
  27693. * GPU instancing options
  27694. * @zh
  27695. * GPU instancing 选项
  27696. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.ANIMATION: { customJointTextureLayouts: [] }}``` to set this.
  27697. */
  27698. customJointTextureLayouts?: __private._cocos_3d_skeletal_animation_skeletal_animation_utils__ICustomJointTextureLayout[];
  27699. /**
  27700. * @en
  27701. * Physics system config
  27702. * @zh
  27703. * 物理系统设置
  27704. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.PHYSICS: {}}``` to set this.
  27705. */
  27706. physics?: physics.IPhysicsConfig;
  27707. /**
  27708. * @en
  27709. * The orientation from the builder configuration.
  27710. * Available value can be 'auto', 'landscape', 'portrait'.
  27711. * @zh
  27712. * 屏幕旋转方向,可选 “自动”,“横屏”,“竖屏”
  27713. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { 'orientation': 'auto' }}``` to set this.
  27714. */
  27715. orientation?: __private._pal_screen_adapter__ConfigOrientation;
  27716. /**
  27717. * @en
  27718. * Determine whether the game frame exact fits the screen.
  27719. * Now it only works on Web platform.
  27720. * @zh
  27721. * 是否让游戏外框对齐到屏幕上,目前只在 web 平台生效
  27722. * @deprecated Since v3.6, Please use ```overrideSettings: { Settings.Category.SCREEN: { 'exactFitScreen': true }}``` to set this.
  27723. */
  27724. exactFitScreen?: boolean;
  27725. }
  27726. /**
  27727. * @en An object to boot the game.
  27728. * @zh 包含游戏主体信息并负责驱动游戏的游戏对象。
  27729. */
  27730. export class Game extends EventTarget {
  27731. /**
  27732. * @en Event triggered when game hide to background.<br>
  27733. * Please note that this event is not 100% guaranteed to be fired on Web platform,<br>
  27734. * on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  27735. * @zh 游戏进入后台时触发的事件。<br>
  27736. * 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。<br>
  27737. * 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。
  27738. * @example
  27739. * ```ts
  27740. * import { game } from 'cc';
  27741. * game.on(Game.EVENT_HIDE, function () {
  27742. *
  27743. * });
  27744. * ```
  27745. */
  27746. static readonly EVENT_HIDE = "game_on_hide";
  27747. /**
  27748. * @en Event triggered when game back to foreground<br>
  27749. * Please note that this event is not 100% guaranteed to be fired on Web platform,<br>
  27750. * on native platforms, it corresponds to enter foreground event.
  27751. * @zh 游戏进入前台运行时触发的事件。<br>
  27752. * 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。<br>
  27753. * 在原生平台,它对应的是应用被切换到前台事件。
  27754. */
  27755. static readonly EVENT_SHOW: string;
  27756. /**
  27757. * @en Event triggered when system in low memory status.<br>
  27758. * This event is only triggered on native iOS/Android platform.
  27759. * @zh 程序在内存不足时触发的事件。<br>
  27760. * 该事件只会在 iOS/Android 平台触发。
  27761. */
  27762. static readonly EVENT_LOW_MEMORY: string;
  27763. /**
  27764. * @en Event triggered after game inited, at this point all engine objects and game scripts are loaded
  27765. * @zh 游戏启动后的触发事件,此时加载所有的引擎对象和游戏脚本。
  27766. */
  27767. static readonly EVENT_GAME_INITED = "game_inited";
  27768. /**
  27769. * @en Event triggered after engine inited, at this point you will be able to use all engine classes.<br>
  27770. * It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0.
  27771. * Since Cocos Creator v3.0, EVENT_RENDERER_INITED is a new event, look up define for details.
  27772. * @zh 在引擎初始化之后触发的事件,此时您能够使用引擎所有的类。<br>
  27773. * 它在 Cocos Creator v1.x 版本中名字为 EVENT_RENDERER_INITED,在 v2.0 更名为 EVENT_ENGINE_INITED
  27774. * 并在 Cocos Creator v3.0 中将 EVENT_RENDERER_INITED 用作为渲染器初始化的事件。
  27775. */
  27776. static readonly EVENT_ENGINE_INITED = "engine_inited";
  27777. /**
  27778. * @en Event triggered after renderer inited, at this point you will be able to use all gfx renderer feature.<br>
  27779. * @zh 在渲染器初始化之后触发的事件,此事件在 EVENT_ENGINE_INITED 之前触发,此时开始可使用 gfx 渲染框架。
  27780. */
  27781. static readonly EVENT_RENDERER_INITED: string;
  27782. /**
  27783. * @en Event triggered pre base module initialization, at this point you can not use pal/logging/sys/settings API.
  27784. * @zh 基础模块初始化之前的事件,在这个事件点你无法使用 pal/logging/sys/settings 的相关接口。
  27785. */
  27786. static readonly EVENT_PRE_BASE_INIT = "pre_base_init";
  27787. /**
  27788. * @en Event triggered post base module initialization, at this point you can use pal/logging/sys/settings API safely.
  27789. * @zh 基础模块初始化之后的事件,在这个事件点你可以安全使用 pal/logging/sys/settings 的相关接口。
  27790. */
  27791. static readonly EVENT_POST_BASE_INIT = "post_base_init";
  27792. /**
  27793. * @en Event triggered pre infrastructure initialization, at this point you can not use assetManager/gfx/screen/builtinResMgr/macro/Layer API.
  27794. * @zh 基础设施初始化之前的事件,在这个事件点你无法使用 assetManager/gfx/screen/builtinResMgr/macro/Layer 的相关接口。
  27795. */
  27796. static readonly EVENT_PRE_INFRASTRUCTURE_INIT = "pre_infrastructure_init";
  27797. /**
  27798. * @en Event triggered post infrastructure initialization, at this point you can use assetManager/gfx/screen/builtinResMgr/macro/Layer API safely.
  27799. * @zh 基础设施初始化之后的事件,在这个事件点你可以安全使用 assetManager/gfx/screen/builtinResMgr/macro/Layer 的相关接口。
  27800. */
  27801. static readonly EVENT_POST_INFRASTRUCTURE_INIT = "post_infrastructure_init";
  27802. /**
  27803. * @en Event triggered pre subsystem initialization, at this point you can not use physics/animation/rendering/tween/etc API.
  27804. * @zh 子系统初始化之前的事件,在这个事件点你无法使用 physics/animation/rendering/tween/etc 的相关接口。
  27805. */
  27806. static readonly EVENT_PRE_SUBSYSTEM_INIT = "pre_subsystem_init";
  27807. /**
  27808. * @en Event triggered post subsystem initialization, at this point you can use physics/animation/rendering/tween/etc API safely.
  27809. * @zh 子系统初始化之后的事件,在这个事件点你可以安全使用 physics/animation/rendering/tween/etc 的相关接口。
  27810. */
  27811. static readonly EVENT_POST_SUBSYSTEM_INIT = "post_subsystem_init";
  27812. /**
  27813. * @en Event triggered pre project data initialization,
  27814. * at this point you can not access project data using [resources.load]/[director.loadScene] API.
  27815. * @zh 项目数据初始化之前的事件,在这个事件点你无法使用访问项目数据的相关接口,例如 [resources.load]/[director.loadScene] 等 API。
  27816. */
  27817. static readonly EVENT_PRE_PROJECT_INIT = "pre_project_init";
  27818. /**
  27819. * @en Event triggered post project data initialization,
  27820. * at this point you can access project data using [resources.load]/[director.loadScene] API safely.
  27821. * @zh 项目数据初始化之后的事件,在这个事件点你可以安全使用访问项目数据的相关接口,例如 [resources.load]/[director.loadScene] 等 API。
  27822. */
  27823. static readonly EVENT_POST_PROJECT_INIT = "post_project_init";
  27824. /**
  27825. * @en Event triggered when game restart
  27826. * @zh 调用restart后,触发事件
  27827. */
  27828. static readonly EVENT_RESTART = "game_on_restart";
  27829. /**
  27830. * @en Triggered when the game is paused.<br>
  27831. * @zh 游戏暂停时触发该事件。<br>
  27832. * @example
  27833. * ```ts
  27834. * import { game } from 'cc';
  27835. * game.on(Game.EVENT_PAUSE, function () {
  27836. * //pause audio or video
  27837. * });
  27838. * ```
  27839. */
  27840. static readonly EVENT_PAUSE = "game_on_pause";
  27841. /**
  27842. * @en Triggered when the game is resumed.<br>
  27843. * @zh 游戏恢复时触发该事件。<br>
  27844. */
  27845. static readonly EVENT_RESUME = "game_on_resume";
  27846. /**
  27847. * @en Triggered when the game will be closed. <br>
  27848. * @zh 游戏将要关闭时触发的事件。<br>
  27849. */
  27850. static readonly EVENT_CLOSE = "game_on_close";
  27851. /**
  27852. * @en Web Canvas 2d API as renderer backend.
  27853. * @zh 使用 Web Canvas 2d API 作为渲染器后端。
  27854. */
  27855. static readonly RENDER_TYPE_CANVAS = 0;
  27856. /**
  27857. * @en WebGL API as renderer backend.
  27858. * @zh 使用 WebGL API 作为渲染器后端。
  27859. */
  27860. static readonly RENDER_TYPE_WEBGL = 1;
  27861. /**
  27862. * @en OpenGL API as renderer backend.
  27863. * @zh 使用 OpenGL API 作为渲染器后端。
  27864. */
  27865. static readonly RENDER_TYPE_OPENGL = 2;
  27866. /**
  27867. * @en Headless Renderer, usually used in test or server env
  27868. * @zh 空渲染器,通常用于测试环境或服务器端模式
  27869. */
  27870. static readonly RENDER_TYPE_HEADLESS = 3;
  27871. /**
  27872. * @en If delta time since last frame is more than this threshold in seconds,
  27873. * the game timer will consider user is debugging and adjust the delta time to [[frameTime]].
  27874. * @zh 如果距离上一帧的帧间隔超过了这个阈值(单位是 s),那么就会被认为正在调试,帧间隔会被自动调节为 [[frameTime]].
  27875. */
  27876. static DEBUG_DT_THRESHOLD: number;
  27877. /**
  27878. * @en The outer frame of the game canvas; parent of game container.
  27879. * @zh 游戏画布的外框,container 的父容器。
  27880. *
  27881. * @deprecated since 3.4.0, frame is a concept on web standard, please manager screens via the `screen` module.
  27882. */
  27883. frame: HTMLDivElement | null;
  27884. /**
  27885. * @en The container of game canvas.
  27886. * @zh 游戏画布的容器。
  27887. *
  27888. * @deprecated since 3.4.0, container is a concept on web standard, please manager screens via the `screen` module.
  27889. */
  27890. container: HTMLDivElement | null;
  27891. /**
  27892. * @en The canvas of the game.
  27893. * @zh 游戏的画布。
  27894. */
  27895. canvas: HTMLCanvasElement | null;
  27896. /**
  27897. * @en The renderer backend of the game.
  27898. * @zh 游戏的渲染器类型。
  27899. */
  27900. renderType: number;
  27901. eventTargetOn: <TFunction extends (...any: any[]) => void>(type: string | number, callback: TFunction, thisArg?: any, once?: boolean | undefined) => TFunction;
  27902. eventTargetOnce: <TFunction extends (...any: any[]) => void>(type: string | number, callback: TFunction, thisArg?: any) => TFunction;
  27903. /**
  27904. * @en
  27905. * The current game configuration,
  27906. * please be noticed any modification directly on this object after the game initialization won't take effect.
  27907. * @zh
  27908. * 当前的游戏配置
  27909. * 注意:请不要直接修改这个对象,它不会有任何效果。
  27910. */
  27911. config: IGameConfig;
  27912. /**
  27913. * @en Callback when the scripts of engine have been load.
  27914. * @zh 当引擎完成启动后的回调函数。
  27915. * @method onStart
  27916. */
  27917. onStart: Game.OnStart | null;
  27918. /**
  27919. * @en Indicates whether the engine and the renderer has been initialized
  27920. * @zh 引擎和渲染器是否以完成初始化
  27921. */
  27922. get inited(): boolean;
  27923. /**
  27924. * @en Expected frame rate of the game.
  27925. * @zh 游戏的设定帧率。
  27926. */
  27927. get frameRate(): string | number;
  27928. set frameRate(frameRate: number | string);
  27929. /**
  27930. * @en The delta time since last frame, unit: s.
  27931. * @zh 获取上一帧的增量时间,以秒为单位。
  27932. */
  27933. get deltaTime(): number;
  27934. /**
  27935. * @en The total passed time since game start, unit: ms
  27936. * @zh 获取从游戏开始到现在总共经过的时间,以毫秒为单位
  27937. */
  27938. get totalTime(): number;
  27939. /**
  27940. * @en The start time of the current frame in milliseconds.
  27941. * @zh 获取当前帧开始的时间(以 ms 为单位)。
  27942. */
  27943. get frameStartTime(): number;
  27944. /**
  27945. * @en The expected delta time of each frame in milliseconds
  27946. * @zh 期望帧率对应的每帧时间(以 ms 为单位)
  27947. */
  27948. frameTime: number;
  27949. /**
  27950. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  27951. */
  27952. _isCloning: boolean;
  27953. /**
  27954. * @en The event delegate pre base module initialization. At this point you can not use pal/logging/sys/settings API.
  27955. * @zh 基础模块初始化之前的事件代理。在这个事件点你无法使用 pal/logging/sys/settings 的相关接口。
  27956. */
  27957. readonly onPreBaseInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27958. /**
  27959. * @en The event delegate post base module initialization. At this point you can use pal/logging/sys/settings API safely.
  27960. * @zh 基础模块初始化之后的事件代理。在这个事件点你可以安全使用 pal/logging/sys/settings 的相关接口。
  27961. */
  27962. readonly onPostBaseInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27963. /**
  27964. * @en The event delegate pre infrastructure module initialization.
  27965. * At this point you can not use assetManager/gfx/screen/builtinResMgr/macro/Layer API.
  27966. * @zh 基础设施模块初始化之前的事件代理。在这个事件点你无法使用 assetManager/gfx/screen/builtinResMgr/macro/Layer 的相关接口。
  27967. */
  27968. readonly onPreInfrastructureInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27969. /**
  27970. * @en The event delegate post infrastructure module initialization.
  27971. * At this point you can use assetManager/gfx/screen/builtinResMgr/macro/Layer API safely.
  27972. *
  27973. * @zh 基础设施模块初始化之后的事件代理。在这个事件点你可以安全使用 assetManager/gfx/screen/builtinResMgr/macro/Layer 的相关接口。
  27974. */
  27975. readonly onPostInfrastructureInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27976. /**
  27977. * @en The event delegate pre sub system module initialization. At this point you can not use physics/animation/rendering/tween/etc API.
  27978. * @zh 子系统模块初始化之前的事件代理。在这个事件点你无法使用 physics/animation/rendering/tween/etc 的相关接口。
  27979. */
  27980. readonly onPreSubsystemInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27981. /**
  27982. * @en The event delegate post sub system module initialization. At this point you can use physics/animation/rendering/tween/etc API safely.
  27983. * @zh 子系统模块初始化之后的事件代理。在这个事件点你可以安全使用 physics/animation/rendering/tween/etc 的相关接口。
  27984. */
  27985. readonly onPostSubsystemInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27986. /**
  27987. * @en The event delegate pre project data initialization.
  27988. * At this point you can not access project data using [resources.load]/[director.loadScene] API.
  27989. * @zh 项目数据初始化之前的事件代理。在这个事件点你无法使用访问项目数据的相关接口,例如 [resources.load]/[director.loadScene] 等 API。
  27990. */
  27991. readonly onPreProjectInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27992. /**
  27993. * @en The event delegate post project data initialization.
  27994. * at this point you can access project data using [resources.load]/[director.loadScene] API safely.
  27995. * @zh 项目数据初始化之后的事件代理。
  27996. * 在这个事件点你可以安全使用访问项目数据的相关接口,例如 [resources.load]/[director.loadScene] 等 API。
  27997. */
  27998. readonly onPostProjectInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
  27999. /**
  28000. * @en Set frame rate of game.
  28001. * @zh 设置游戏帧率。
  28002. * @deprecated since v3.3.0 please use [[game.frameRate]]
  28003. */
  28004. setFrameRate(frameRate: number | string): void;
  28005. /**
  28006. * @en Get frame rate set for the game, it doesn't represent the real frame rate.
  28007. * @zh 获取设置的游戏帧率(不等同于实际帧率)。
  28008. * @return frame rate
  28009. * @deprecated since v3.3.0 please use [[game.frameRate]]
  28010. */
  28011. getFrameRate(): number;
  28012. /**
  28013. * @en Run the game frame by frame with a fixed delta time correspond to frame rate.
  28014. * @zh 以固定帧间隔执行一帧游戏循环,帧间隔与设定的帧率匹配。
  28015. */
  28016. step(): void;
  28017. /**
  28018. * @en Pause the game main loop. This will pause:
  28019. * - game logic execution
  28020. * - rendering process
  28021. * - input event dispatching (excluding Web and Minigame platforms)
  28022. *
  28023. * This is different with `director.pause()` which only pause the game logic execution.
  28024. *
  28025. * @zh 暂停游戏主循环。包含:
  28026. * - 游戏逻辑
  28027. * - 渲染
  28028. * - 输入事件派发(Web 和小游戏平台除外)
  28029. *
  28030. * 这点和只暂停游戏逻辑的 `director.pause()` 不同。
  28031. */
  28032. pause(): void;
  28033. /**
  28034. * @en Resume the game from pause. This will resume:<br>
  28035. * game logic execution, rendering process, event manager, background music and all audio effects.<br>
  28036. * @zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  28037. */
  28038. resume(): void;
  28039. /**
  28040. * @en Check whether the game is paused.
  28041. * @zh 判断游戏是否暂停。
  28042. */
  28043. isPaused(): boolean;
  28044. /**
  28045. * @en Restart game.
  28046. * @zh 重新开始游戏
  28047. */
  28048. restart(): Promise<void>;
  28049. /**
  28050. * @en End game, it will close the game window
  28051. * @zh 退出游戏
  28052. */
  28053. end(): void;
  28054. /**
  28055. * @en
  28056. * Register an callback of a specific event type on the game object.<br>
  28057. * This type of event should be triggered via `emit`.<br>
  28058. * @zh
  28059. * 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。<br>
  28060. *
  28061. * @param type - A string representing the event type to listen for.
  28062. * @param callback - The callback that will be invoked when the event is dispatched.<br>
  28063. * The callback is ignored if it is a duplicate (the callbacks are unique).
  28064. * @param target - The target (this object) to invoke the callback, can be null
  28065. * @param once - After the first invocation, whether the callback should be unregistered.
  28066. * @return - Just returns the incoming callback so you can save the anonymous function easier.
  28067. */
  28068. on(type: string, callback: () => void, target?: any, once?: boolean): any;
  28069. /**
  28070. * @en
  28071. * Register an callback of a specific event type on the game object,<br>
  28072. * the callback will remove itself after the first time it is triggered.<br>
  28073. * @zh
  28074. * 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  28075. *
  28076. * @param type - A string representing the event type to listen for.
  28077. * @param callback - The callback that will be invoked when the event is dispatched.<br>
  28078. * The callback is ignored if it is a duplicate (the callbacks are unique).
  28079. * @param target - The target (this object) to invoke the callback, can be null
  28080. */
  28081. once(type: string, callback: () => void, target?: any): any;
  28082. /**
  28083. * @en Init game with configuration object. Initialization process like below:
  28084. * -PreBaseInitEvent
  28085. * -BaseModuleInitialization(logging, sys, settings)
  28086. * -PostBaseInitEvent
  28087. * -PreInfrastructureInitEvent
  28088. * -InfrastructureModuleInitialization(assetManager, builtinResMgr, gfxDevice, screen, Layer, macro)
  28089. * -PostInfrastructureInitEvent
  28090. * -PreSubsystemInitEvent
  28091. * -SubsystemModuleInitialization(animation, physics, tween, ui, middleware, etc)
  28092. * -PostSubsystemInitEvent
  28093. * -EngineInitedEvent
  28094. * -PreProjectDataInitEvent
  28095. * -ProjectDataInitialization(GamePlayScripts, resources, etc)
  28096. * -PostProjectDataInitEvent
  28097. * -GameInitedEvent
  28098. *
  28099. * @zh 使用指定的配置初始化引擎。初始化流程如下:
  28100. * -PreBaseInitEvent
  28101. * -BaseModuleInitialization(logging, sys, settings)
  28102. * -PostBaseInitEvent
  28103. * -PreInfrastructureInitEvent
  28104. * -InfrastructureModuleInitialization(assetManager, builtinResMgr, gfxDevice, screen, Layer, macro)
  28105. * -PostInfrastructureInitEvent
  28106. * -PreSubsystemInitEvent
  28107. * -SubsystemModuleInitialization(animation, physics, tween, ui, middleware, etc)
  28108. * -PostSubsystemInitEvent
  28109. * -EngineInitedEvent
  28110. * -PreProjectDataInitEvent
  28111. * -ProjectDataInitialization(GamePlayScripts, resources, etc)
  28112. * -PostProjectDataInitEvent
  28113. * -GameInitedEvent
  28114. * @param config - Pass configuration object
  28115. */
  28116. init(config: IGameConfig): Promise<void>;
  28117. /**
  28118. * @internal only for game-view
  28119. */
  28120. _loadProjectBundles(): Promise<void[]>;
  28121. /**
  28122. * @en Run game with configuration object and onStart function.
  28123. * @zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  28124. * @param onStart - function to be executed after game initialized
  28125. */
  28126. run(onStart?: Game.OnStart): void;
  28127. /**
  28128. * @en
  28129. * Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br>
  28130. * The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  28131. * @zh
  28132. * 声明常驻根节点,该节点不会在场景切换中被销毁。<br>
  28133. * 目标节点必须位于为层级的根节点,否则无效。
  28134. * @param node - The node to be made persistent
  28135. * @deprecated Since v3.6.0, please use director.addPersistRootNode instead.
  28136. */
  28137. addPersistRootNode(node: Node): void;
  28138. /**
  28139. * @en Remove a persistent root node.
  28140. * @zh 取消常驻根节点。
  28141. * @param node - The node to be removed from persistent node list
  28142. * @deprecated Since v3.6.0, please use director.removePersistRootNode instead.
  28143. */
  28144. removePersistRootNode(node: Node): void;
  28145. /**
  28146. * @en Check whether the node is a persistent root node.
  28147. * @zh 检查节点是否是常驻根节点。
  28148. * @param node - The node to be checked.
  28149. * @deprecated Since v3.6.0, please use director.isPersistRootNode instead.
  28150. */
  28151. isPersistRootNode(node: Node): boolean;
  28152. }
  28153. export namespace Game {
  28154. export type OnStart = () => void;
  28155. }
  28156. /**
  28157. * @en
  28158. * This is a Game instance.
  28159. * @zh
  28160. * 这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。
  28161. */
  28162. export const game: Game;
  28163. /**
  28164. * @en Deserializes a previously serialized object to reconstruct it to the original.
  28165. * @zh 将序列化后的对象进行反序列化以使其复原。
  28166. *
  28167. * @param data Serialized data.
  28168. * @param details - Additional loading result.
  28169. * @param options Deserialization Options.
  28170. * @return The original object.
  28171. */
  28172. export function deserialize(data: __private._cocos_serialization_deserialize__IDeserializeInput | string | any, details?: Details, options?: __private._cocos_serialization_deserialize__IOptions & __private._cocos_serialization_deserialize_dynamic__DeserializeDynamicOptions): unknown;
  28173. export namespace deserialize {
  28174. export namespace Internal {
  28175. export type SharedString_ = __private._cocos_serialization_deserialize__SharedString;
  28176. export type Empty_ = __private._cocos_serialization_deserialize__Empty;
  28177. export type StringIndex_ = __private._cocos_serialization_deserialize__StringIndex;
  28178. export type InstanceIndex_ = __private._cocos_serialization_deserialize__InstanceIndex;
  28179. export type StringIndexBnotNumber_ = __private._cocos_serialization_deserialize__StringIndexBnotNumber;
  28180. export const enum DataTypeID_ {
  28181. SimpleType = 0,
  28182. InstanceRef = 1,
  28183. Array_InstanceRef = 2,
  28184. Array_AssetRefByInnerObj = 3,
  28185. Class = 4,
  28186. ValueTypeCreated = 5,
  28187. AssetRefByInnerObj = 6,
  28188. TRS = 7,
  28189. ValueType = 8,
  28190. Array_Class = 9,
  28191. CustomizedClass = 10,
  28192. Dict = 11,
  28193. Array = 12,
  28194. ARRAY_LENGTH = 13
  28195. }
  28196. export type DataTypes_ = __private._cocos_serialization_deserialize__DataTypes;
  28197. export type AnyData_ = __private._cocos_serialization_deserialize__AnyData;
  28198. export type OtherObjectData_ = __private._cocos_serialization_deserialize__OtherObjectData;
  28199. export type OtherObjectTypeID_ = __private._cocos_serialization_deserialize__OtherObjectTypeID;
  28200. export type AnyCCClass_ = __private._cocos_serialization_deserialize__AnyCCClass;
  28201. export type IClass_ = __private._cocos_serialization_deserialize__IClass;
  28202. export type IMask_ = __private._cocos_serialization_deserialize__IMask;
  28203. export type IClassObjectData_ = __private._cocos_serialization_deserialize__IClassObjectData;
  28204. export type ICustomObjectDataContent_ = __private._cocos_serialization_deserialize__ICustomObjectDataContent;
  28205. export type ICustomObjectData_ = __private._cocos_serialization_deserialize__ICustomObjectData;
  28206. export type ITRSData_ = __private._cocos_serialization_deserialize__ITRSData;
  28207. export type IDictData_ = __private._cocos_serialization_deserialize__IDictData;
  28208. export type IArrayData_ = __private._cocos_serialization_deserialize__IArrayData;
  28209. export const enum Refs_ {
  28210. EACH_RECORD_LENGTH = 3,
  28211. OWNER_OFFSET = 0,
  28212. KEY_OFFSET = 1,
  28213. TARGET_OFFSET = 2
  28214. }
  28215. export type IRefs_ = __private._cocos_serialization_deserialize__IRefs;
  28216. export const enum File_ {
  28217. Version = 0,
  28218. Context = 0,
  28219. SharedUuids = 1,
  28220. SharedStrings = 2,
  28221. SharedClasses = 3,
  28222. SharedMasks = 4,
  28223. Instances = 5,
  28224. InstanceTypes = 6,
  28225. Refs = 7,
  28226. DependObjs = 8,
  28227. DependKeys = 9,
  28228. DependUuidIndices = 10,
  28229. ARRAY_LENGTH = 11
  28230. }
  28231. export type IFileData_ = __private._cocos_serialization_deserialize__IFileData;
  28232. export type IPackedFileData_ = __private._cocos_serialization_deserialize__IPackedFileData;
  28233. }
  28234. export var Details: typeof _Details;
  28235. export var reportMissingClass: typeof __private._cocos_serialization_report_missing_class__reportMissingClass;
  28236. export var isCompiledJson: typeof __private._cocos_serialization_deserialize__isCompiledJson;
  28237. export var _macros: {
  28238. EMPTY_PLACEHOLDER: 0;
  28239. CUSTOM_OBJ_DATA_CLASS: 0;
  28240. CUSTOM_OBJ_DATA_CONTENT: 1;
  28241. CLASS_TYPE: 0;
  28242. CLASS_KEYS: 1;
  28243. CLASS_PROP_TYPE_OFFSET: 2;
  28244. MASK_CLASS: 0;
  28245. OBJ_DATA_MASK: 0;
  28246. DICT_JSON_LAYOUT: 0;
  28247. ARRAY_ITEM_VALUES: 0;
  28248. PACKED_SECTIONS: Internal.File_.Instances;
  28249. };
  28250. export type SerializableClassConstructor = new () => unknown;
  28251. export type ReportMissingClass = (id: string) => void;
  28252. export type ClassFinder = {
  28253. (id: string, serialized: unknown, owner?: unknown[] | Record<PropertyKey, unknown>, propName?: string): SerializableClassConstructor | undefined;
  28254. onDereferenced?: (deserializedList: Array<Record<PropertyKey, unknown> | undefined>, id: number, object: Record<string, unknown> | unknown[], propName: string) => void;
  28255. };
  28256. }
  28257. /** **************************************************************************
  28258. * IMPLEMENTS
  28259. *************************************************************************** */
  28260. /**
  28261. * @en Contains information collected during deserialization
  28262. * @zh 包含反序列化时的一些信息。
  28263. * @class Details
  28264. */
  28265. export class Details {
  28266. /**
  28267. * @en
  28268. * the object list whose field needs to load asset by uuid
  28269. * @zh
  28270. * 对象列表,其中每个对象有属性需要通过 uuid 进行资源加载
  28271. */
  28272. uuidObjList: __private._cocos_serialization_deserialize__IRuntimeFileData[deserialize.Internal.File_.DependObjs] | null;
  28273. /**
  28274. * @en
  28275. * the corresponding field name which referenced to the asset
  28276. * @zh
  28277. * 引用着资源的字段名称
  28278. */
  28279. uuidPropList: __private._cocos_serialization_deserialize__IRuntimeFileData[deserialize.Internal.File_.DependKeys] | null;
  28280. /**
  28281. * @en
  28282. * list of the depends assets' uuid
  28283. * @zh
  28284. * 依赖资源的 uuid 列表
  28285. */
  28286. uuidList: __private._cocos_serialization_deserialize__IRuntimeFileData[deserialize.Internal.File_.DependUuidIndices] | null;
  28287. /**
  28288. * @en
  28289. * list of the depends assets' type
  28290. * @zh
  28291. * 依赖的资源类型列表
  28292. */
  28293. uuidTypeList: string[];
  28294. static pool: js.Pool<Details>;
  28295. assignAssetsBy: (getter: (uuid: string, options: {
  28296. type: __private.__types_globals__Constructor<Asset>;
  28297. owner: Record<string, unknown>;
  28298. prop: string;
  28299. }) => Asset) => void;
  28300. /**
  28301. * @method init
  28302. * @param {Object} data
  28303. */
  28304. init(data?: __private._cocos_serialization_deserialize__IDeserializeInput): void;
  28305. /**
  28306. * @method reset
  28307. */
  28308. reset(): void;
  28309. /**
  28310. * @method push
  28311. * @param {Object} obj
  28312. * @param {String} propName
  28313. * @param {String} uuid
  28314. */
  28315. push(obj: object, propName: string, uuid: string, type?: string): void;
  28316. }
  28317. /**
  28318. * @zh 从 Prefab 实例化出新节点。
  28319. * @en Instantiate a node from the Prefab.
  28320. * @param prefab The prefab.
  28321. * @returns The instantiated node.
  28322. * @example
  28323. * ```ts
  28324. * import { instantiate, director } from 'cc';
  28325. * // Instantiate node from prefab.
  28326. * const node = instantiate(prefabAsset);
  28327. * node.parent = director.getScene();
  28328. * ```
  28329. */
  28330. export function instantiate(prefab: Prefab): Node;
  28331. /**
  28332. * @en Clones the object `original.
  28333. * @zh 克隆指定的任意类型的对象。
  28334. * @param original An existing object that you want to make a copy of.
  28335. * It can be any JavaScript object(`typeof original === 'object'`) but:
  28336. * - it shall not be array or null;
  28337. * - it shall not be object of `Asset`;
  28338. * - if it's an object of `CCObject`, it should not have been destroyed.
  28339. * @returns The newly instantiated object.
  28340. * @example
  28341. * ```ts
  28342. * import { instantiate, director } from 'cc';
  28343. * // Clone a node.
  28344. * const node = instantiate(targetNode);
  28345. * node.parent = director.getScene();
  28346. * ```
  28347. */
  28348. export function instantiate<T>(original: T): T;
  28349. export namespace instantiate {
  28350. export var _clone: typeof __private._cocos_serialization_instantiate__doInstantiate;
  28351. }
  28352. /**
  28353. * @en
  28354. * Base class for handling assets used in Creator.<br/>
  28355. *
  28356. * You may want to override:<br/>
  28357. * - createNode<br/>
  28358. * - getset functions of _nativeAsset<br/>
  28359. * - `Object._serialize`<br/>
  28360. * - `Object._deserialize`<br/>
  28361. * @zh
  28362. * Creator 中的资源基类。<br/>
  28363. *
  28364. * 您可能需要重写:<br/>
  28365. * - createNode <br/>
  28366. * - _nativeAsset 的 getset 方法<br/>
  28367. * - `Object._serialize`<br/>
  28368. * - `Object._deserialize`<br/>
  28369. *
  28370. * @class Asset
  28371. * @extends CCObject
  28372. */
  28373. export class Asset extends __private._cocos_asset_assets_asset__Asset_base {
  28374. /**
  28375. * 应 AssetDB 要求提供这个方法。
  28376. * @internal
  28377. * @method deserialize
  28378. * @param {String} data
  28379. * @return {Asset}
  28380. */
  28381. static deserialize(data: any): any;
  28382. /**
  28383. * @en
  28384. * Whether the asset is loaded or not
  28385. * @zh
  28386. * 该资源是否已经成功加载。
  28387. *
  28388. * @deprecated since v3.3
  28389. */
  28390. loaded: boolean;
  28391. /**
  28392. * @en
  28393. * The UUID of this asset.
  28394. *
  28395. * @zh
  28396. * 资源的 UUID。
  28397. *
  28398. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future, please use [[Asset.uuid]] instead.
  28399. */
  28400. _uuid: string;
  28401. /**
  28402. * @en
  28403. * Indicates whether this asset is a default asset.
  28404. *
  28405. * @zh
  28406. * 表明此资源是否是默认资源。
  28407. *
  28408. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  28409. */
  28410. isDefault: boolean;
  28411. /**
  28412. * @en
  28413. * Serializable url for native asset. For internal usage.
  28414. * @zh
  28415. * 用于本机资产的可序列化URL。供内部使用。
  28416. * @default ""
  28417. *
  28418. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28419. */
  28420. _native: string;
  28421. /**
  28422. * @en
  28423. * Path to native dependency.
  28424. * @zh
  28425. * 原生依赖的路径。
  28426. *
  28427. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28428. */
  28429. _nativeUrl: string;
  28430. /**
  28431. * @en
  28432. * Returns the url of this asset's native object, will return an empty string if this asset does not have any native dependency.
  28433. * @zh
  28434. * 返回该资源对应的目标平台资源的 URL,如果此资源没有原生依赖将返回一个空字符串。
  28435. * @readOnly
  28436. */
  28437. get nativeUrl(): string;
  28438. /**
  28439. * @en
  28440. * The UUID of this asset.
  28441. *
  28442. * @zh
  28443. * 资源的 UUID。
  28444. */
  28445. get uuid(): string;
  28446. /**
  28447. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future, please use `nativeAsset` instead.
  28448. */
  28449. get _nativeAsset(): any;
  28450. set _nativeAsset(obj: any);
  28451. /**
  28452. * @en
  28453. * The underlying native asset of this asset if one is available.<br>
  28454. * This property can be used to access additional details or functionality related to the asset.<br>
  28455. * This property will be initialized by the loader if `_native` is available.
  28456. * @zh
  28457. * 此资源的基础资源(如果有)。 此属性可用于访问与资源相关的其他详细信息或功能。<br>
  28458. * 如果`_native`可用,则此属性将由加载器初始化。
  28459. */
  28460. get nativeAsset(): any;
  28461. constructor(...args: ConstructorParameters<typeof CCObject>);
  28462. /**
  28463. * @en
  28464. * Returns the string representation of the object.<br>
  28465. * The `Asset` object overrides the `toString()` method of the `Object` object.<br>
  28466. * JavaScript calls the toString() method automatically<br>
  28467. * when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.<br>
  28468. * <br>
  28469. * For assets of the native type, it will return `this.nativeUrl`.<br>
  28470. * Otherwise, an empty string is returned.<br>
  28471. * This method may be overwritten by subclasses.
  28472. * @zh
  28473. * 返回对象的字符串表示形式。<br>
  28474. * `Asset` 对象将会重写 `Object` 对象的 `toString()` 方法。<br>
  28475. * 当资源要表示为文本值时或在字符串连接时引用时,<br>
  28476. * JavaScript 会自动调用 toString() 方法。<br>
  28477. * <br>
  28478. * 对于原始类型的资源,它将返回`this.nativeUrl`。<br>
  28479. * 否则,返回空字符串。<br>
  28480. * 子类可能会覆盖此方法。
  28481. * @method toString
  28482. * @returns @en String representation of this asset. @zh 此资源的字符串表示。
  28483. */
  28484. toString(): string;
  28485. /**
  28486. * 应 AssetDB 要求提供这个方法。
  28487. * 返回一个序列化后的对象
  28488. *
  28489. * @method serialize
  28490. * @returns {String}
  28491. * @private
  28492. */
  28493. serialize(): void;
  28494. /**
  28495. * @en
  28496. * Set native file name for this asset.
  28497. * @zh
  28498. * 为此资源设置原始文件名。
  28499. * @seealso nativeUrl
  28500. *
  28501. * @param filename
  28502. * @param inLibrary
  28503. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28504. */
  28505. _setRawAsset(filename: string, inLibrary?: boolean): void;
  28506. /**
  28507. * @en
  28508. * Create a new node using this asset in the scene.<br/>
  28509. * If this type of asset don't have its corresponding node type, this method should be null.
  28510. * @zh
  28511. * 使用该资源在场景中创建一个新节点。<br/>
  28512. * 如果这类资源没有相应的节点类型,该方法应该是空的。
  28513. */
  28514. createNode?(callback: __private._cocos_asset_assets_asset__CreateNodeCallback): void;
  28515. /**
  28516. * @en
  28517. * Get native dependency information.
  28518. *
  28519. * @zh
  28520. * 获取原生依赖信息。
  28521. *
  28522. * @returns @en The native dependency information. @zh 原生依赖信息。
  28523. *
  28524. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  28525. */
  28526. get _nativeDep(): {
  28527. __isNative__: boolean;
  28528. uuid: string;
  28529. ext: string;
  28530. } | undefined;
  28531. /**
  28532. * @en
  28533. * Current reference count to this asset.
  28534. *
  28535. * @zh
  28536. * 当前该资源被引用的数量。
  28537. */
  28538. get refCount(): number;
  28539. /**
  28540. * @en
  28541. * Increase the reference count. This will prevent assets from being automatically recycled.
  28542. * When you no longer need to hold the asset, you need to using [[decRef]] to decrease the refCount.
  28543. *
  28544. * @zh
  28545. * 增加资源的引用。这将阻止资源被自动释放。当你不再需要持有该资源时,你需要调用 [[decRef]] 来减少引用计数。
  28546. *
  28547. * @returns @en The asset itself. @zh 此资源本身。
  28548. *
  28549. */
  28550. addRef(): Asset;
  28551. /**
  28552. * @en
  28553. * Decrease the reference count and it will be auto released when refCount equals 0.
  28554. *
  28555. * @zh
  28556. * 减少资源的引用,如果引用数量为 0,则将自动释放该资源。
  28557. *
  28558. * @return @en The asset itself. @zh 此资源本身。
  28559. *
  28560. */
  28561. decRef(autoRelease?: boolean): Asset;
  28562. /**
  28563. * @en
  28564. * A callback after the asset is loaded that you can use to initialize the asset's internal data.
  28565. *
  28566. * @zh
  28567. * 资源加载后的回调,你可以用于初始化资源的内部数据。
  28568. *
  28569. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  28570. */
  28571. onLoaded(): void;
  28572. /**
  28573. * @en
  28574. * Initializes default asset.
  28575. *
  28576. * @zh
  28577. * 初始化为默认资源。
  28578. *
  28579. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  28580. */
  28581. initDefault(uuid?: string): void;
  28582. /**
  28583. * @en
  28584. * Used to verify this asset is an available asset.
  28585. *
  28586. * @zh
  28587. * 用于验证此资源是否为可用资源。
  28588. *
  28589. * @returns @zh 是否是可用资源。@en Whether this asset is available or not.
  28590. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  28591. */
  28592. validate(): boolean;
  28593. /**
  28594. * @en
  28595. * Destroy this asset and its internal data.
  28596. *
  28597. * @zh
  28598. * 销毁此资源以及其内部数据。
  28599. */
  28600. destroy(): boolean;
  28601. }
  28602. /**
  28603. * @en
  28604. * `BufferAsset` is a kind of assets whose internal data is a section of memory buffer
  28605. * that you can access through the [[BufferAsset.buffer]] function.
  28606. * @zh
  28607. * `BufferAsset` 是一类资产,其内部数据是一段内存缓冲,你可以通过 [[BufferAsset.buffer]] 函数获取其内部数据。
  28608. */
  28609. export class BufferAsset extends Asset {
  28610. /**
  28611. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28612. */
  28613. get _nativeAsset(): ArrayBuffer | ArrayBufferView;
  28614. set _nativeAsset(bin: ArrayBufferView | ArrayBuffer);
  28615. /**
  28616. * @zh 获取此资源中的缓冲数据。
  28617. * @en Get the ArrayBuffer data of this asset.
  28618. * @returns @en The ArrayBuffer. @zh 缓冲数据。
  28619. */
  28620. buffer(): ArrayBuffer;
  28621. validate(): boolean;
  28622. }
  28623. /**
  28624. * @en Sub mesh for rendering which contains all geometry data, it can be used to create [[gfx.InputAssembler]].
  28625. * @zh 包含所有顶点数据的渲染子网格,可以用来创建 [[gfx.InputAssembler]]。
  28626. */
  28627. export class RenderingSubMesh {
  28628. /**
  28629. * @en
  28630. * mesh object where this sub mesh locates.
  28631. * @zh
  28632. * 子网格所处的网格模型对象。
  28633. */
  28634. mesh?: Mesh;
  28635. /**
  28636. * @en
  28637. * sub mesh's index in mesh.
  28638. * @zh
  28639. * 子网格在网格模型中的索引。
  28640. */
  28641. subMeshIdx?: number;
  28642. /**
  28643. * @en
  28644. * sub mesh's constructor.
  28645. * @zh
  28646. * 子网格构造函数。
  28647. * @param vertexBuffers @en vertex buffers. @zh 顶点缓冲区数组。
  28648. * @param attributes @en vertex attributes. @zh 顶点属性数组。
  28649. * @param primitiveMode @en primitive mode. @zh 图元类型。
  28650. * @param indexBuffer @en index buffer. @zh 索引缓冲区。
  28651. * @param indirectBuffer @en indirect buffer. @zh 间接缓冲区。
  28652. */
  28653. constructor(vertexBuffers: gfx.Buffer[], attributes: gfx.Attribute[], primitiveMode: gfx.PrimitiveMode, indexBuffer?: gfx.Buffer | null, indirectBuffer?: gfx.Buffer | null, isOwnerOfIndexBuffer?: boolean);
  28654. /**
  28655. * @en All vertex attributes used by the sub mesh.
  28656. * @zh 所有顶点属性。
  28657. */
  28658. get attributes(): gfx.Attribute[];
  28659. /**
  28660. * @en All vertex buffers used by the sub mesh.
  28661. * @zh 使用的所有顶点缓冲区。
  28662. */
  28663. get vertexBuffers(): gfx.Buffer[];
  28664. /**
  28665. * @en Index buffer used by the sub mesh.
  28666. * @zh 使用的索引缓冲区,若未使用则无需指定。
  28667. */
  28668. get indexBuffer(): gfx.Buffer | null;
  28669. /**
  28670. * @en Indirect buffer used by the sub mesh.
  28671. * @zh 间接绘制缓冲区。
  28672. */
  28673. get indirectBuffer(): gfx.Buffer | null;
  28674. /**
  28675. * @en Primitive mode used by the sub mesh.
  28676. * @zh 图元类型。
  28677. */
  28678. get primitiveMode(): gfx.PrimitiveMode;
  28679. /**
  28680. * @en The geometric info of the sub mesh, used for raycast.
  28681. * @zh (用于射线检测的)几何信息。
  28682. */
  28683. get geometricInfo(): __private._cocos_asset_assets_rendering_sub_mesh__IGeometricInfo;
  28684. /**
  28685. * @en Invalidate the geometric info of the sub mesh after geometry changed.
  28686. * @zh 网格更新后,设置(用于射线检测的)几何信息为无效,需要重新计算。
  28687. */
  28688. invalidateGeometricInfo(): void;
  28689. /**
  28690. * @en the draw range.
  28691. * @zh 渲染范围。
  28692. */
  28693. set drawInfo(info: gfx.DrawInfo | null | undefined);
  28694. get drawInfo(): gfx.DrawInfo | null | undefined;
  28695. /**
  28696. * @en Flatted vertex buffers.
  28697. * @zh 扁平化的顶点缓冲区。
  28698. */
  28699. get flatBuffers(): __private._cocos_asset_assets_rendering_sub_mesh__IFlatBuffer[];
  28700. /**
  28701. * @en generate flatted vertex buffers.
  28702. * @zh 生成扁平化的顶点缓冲区。
  28703. */
  28704. genFlatBuffers(): void;
  28705. /**
  28706. * @en The vertex buffer for joint after mapping.
  28707. * @zh 骨骼索引按映射表处理后的顶点缓冲。
  28708. */
  28709. get jointMappedBuffers(): gfx.Buffer[];
  28710. /**
  28711. * @en The input assembler info.
  28712. * @zh 输入汇集器信息。
  28713. */
  28714. get iaInfo(): gfx.InputAssemblerInfo;
  28715. /**
  28716. * @en Destroys sub mesh.
  28717. * @zh 销毁子网格。
  28718. */
  28719. destroy(): void;
  28720. /**
  28721. * @en Adds a vertex attribute input called 'a_vertexId' into this sub-mesh.
  28722. * This is useful if you want to simulate `gl_VertexId` in WebGL context prior to 2.0.
  28723. * Once you call this function, the vertex attribute is permanently added.
  28724. * Subsequent calls to this function take no effect.
  28725. * @zh 添加一个 'a_vertexId' 顶点属性, 用于在 WebGL 2.0 之前的平台模拟 `gl_VertexId`,
  28726. * 一旦你调用此函数, 顶点属性永久被添加, 后续调用无效果。
  28727. * @param device @en Device used to create related rendering resources @zh 用于创建相关渲染资源的设备对象
  28728. */
  28729. enableVertexIdChannel(device: gfx.Device): void;
  28730. }
  28731. /**
  28732. * @en Class for scene loading.
  28733. * @zh 场景资源类。
  28734. *
  28735. */
  28736. export class SceneAsset extends Asset {
  28737. /**
  28738. * @en The scene node
  28739. * @zh 场景节点。
  28740. */
  28741. scene: Scene | null;
  28742. initDefault(uuid?: string): void;
  28743. validate(): boolean;
  28744. }
  28745. /**
  28746. * @en The asset for text file.
  28747. * @zh 文本资源。
  28748. */
  28749. export class TextAsset extends Asset {
  28750. /**
  28751. * @en The text content.
  28752. * @zh 此资源包含的文本。
  28753. */
  28754. text: string;
  28755. toString(): string;
  28756. }
  28757. /**
  28758. * @en Json asset, it will automatically parse the json to a JS object.
  28759. * @zh Json 资源。
  28760. * Json 资源加载后将直接解析为对象。如果你希望获得 JSON 的原始文本,你需要使用文本资源(使用文件名后缀“.txt”)。
  28761. */
  28762. export class JsonAsset extends Asset {
  28763. /**
  28764. * @en The parsed JS object
  28765. * @zh 解析后的对象。
  28766. */
  28767. json: Record<string, any> | null;
  28768. }
  28769. /**
  28770. * @en Image Asset. The image resource stores the raw data of the image and you can use this resource to create any Texture resource.
  28771. * @zh 图像资源。图像资源存储了图像的原始数据,你可以使用此资源来创建任意 [[TextureBase]] 资源。
  28772. */
  28773. export class ImageAsset extends Asset {
  28774. /**
  28775. * mergeCompressedTextureMips
  28776. * ************* hearder ***************
  28777. * COMPRESSED_MAGIC: 0x50494d43 *
  28778. * ************* document **************
  28779. * chunkCount: n *
  28780. * chunkDataSize[0]: xxx *
  28781. * ... *
  28782. * chunkDataSize[n - 1]: xxx *
  28783. * ************* chunks ****************
  28784. * ****************************** *
  28785. * * * *
  28786. * * chunk[0] * *
  28787. * * * *
  28788. * ****************************** *
  28789. * ...
  28790. * ****************************** *
  28791. * * * *
  28792. * * chunk[n - 1] * *
  28793. * * * *
  28794. * ****************************** *
  28795. * *************************************
  28796. * @param files @zh 压缩纹理数组。 @en Compressed Texture Arrays.
  28797. * @returns out @zh 合并后的压缩纹理数据。 @en Merged compressed texture data.
  28798. */
  28799. static mergeCompressedTextureMips(files: ArrayBuffer[] | ArrayBufferView[]): Uint8Array;
  28800. /**
  28801. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28802. */
  28803. get _nativeAsset(): any;
  28804. set _nativeAsset(value: any);
  28805. /**
  28806. * @en Image data.
  28807. * @zh 此图像资源的图像数据。
  28808. */
  28809. get data(): ArrayBufferView | HTMLCanvasElement | HTMLImageElement | ImageBitmap | null;
  28810. /**
  28811. * @en The pixel width of the image.
  28812. * @zh 此图像资源的像素宽度。
  28813. */
  28814. get width(): number;
  28815. /**
  28816. * @en The pixel height of the image.
  28817. * @zh 此图像资源的像素高度。
  28818. */
  28819. get height(): number;
  28820. /**
  28821. * @en The pixel format of the image.
  28822. * @zh 此图像资源的像素格式。
  28823. */
  28824. get format(): __private._cocos_asset_assets_asset_enum__PixelFormat;
  28825. /**
  28826. * @en Whether the image is in compressed texture format.
  28827. * @zh 此图像资源是否为压缩像素格式。
  28828. */
  28829. get isCompressed(): boolean;
  28830. /**
  28831. * @en The original source image URL, it could be empty.
  28832. * @zh 此图像资源的原始图像源的 URL。当原始图像元不是 HTML 文件时可能为空。
  28833. * @deprecated Please use [[nativeUrl]]
  28834. */
  28835. get url(): string;
  28836. constructor(nativeAsset?: __private._cocos_asset_assets_image_asset__ImageSource);
  28837. /**
  28838. * @en Reset the source of the image asset.
  28839. * @zh 重置此图像资源使用的原始图像源。
  28840. * @param data @en The new source. @zh 新的图片数据源。
  28841. */
  28842. reset(data: __private._cocos_asset_assets_image_asset__ImageSource): void;
  28843. destroy(): boolean;
  28844. initDefault(uuid?: string): void;
  28845. validate(): boolean;
  28846. }
  28847. /**
  28848. * @en The 2D texture asset. It supports mipmap, each level of mipmap use an [[ImageAsset]].
  28849. * @zh 二维贴图资源。二维贴图资源的每个 Mipmap 层级都为一张 [[ImageAsset]]。
  28850. */
  28851. export class Texture2D extends __private._cocos_asset_assets_simple_texture__SimpleTexture {
  28852. /**
  28853. * @en All levels of mipmap images, be noted, automatically generated mipmaps are not included.
  28854. * When setup mipmap, the size of the texture and pixel format could be modified.
  28855. * @zh 所有层级 Mipmap,注意,这里不包含自动生成的 Mipmap。
  28856. * 当设置 Mipmap 时,贴图的尺寸以及像素格式可能会改变。
  28857. */
  28858. get mipmaps(): ImageAsset[];
  28859. set mipmaps(value: ImageAsset[]);
  28860. /**
  28861. * @en Level 0 mipmap image.
  28862. * Be noted, `this.image = img` equals `this.mipmaps = [img]`,
  28863. * sets image will clear all previous mipmaps.
  28864. * @zh 0 级 Mipmap。
  28865. * 注意,`this.image = img` 等价于 `this.mipmaps = [img]`,
  28866. * 也就是说,通过 `this.image` 设置 0 级 Mipmap 时将隐式地清除之前的所有 Mipmap。
  28867. */
  28868. get image(): ImageAsset | null;
  28869. set image(value: ImageAsset | null);
  28870. /**
  28871. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28872. */
  28873. _mipmaps: ImageAsset[];
  28874. onLoaded(): void;
  28875. /**
  28876. * @en Reset the current texture with given size, pixel format and mipmap images.
  28877. * After reset, the gfx resource will become invalid, you must use [[uploadData]] explicitly to upload the new mipmaps to GPU resources.
  28878. * @zh 将当前贴图重置为指定尺寸、像素格式以及指定 mipmap 层级。重置后,贴图的像素数据将变为未定义。
  28879. * mipmap 图像的数据不会自动更新到贴图中,你必须显式调用 [[uploadData]] 来上传贴图数据。
  28880. * @param info @en The create information. @zh 创建贴图的相关信息。
  28881. */
  28882. reset(info: __private._cocos_asset_assets_texture_2d__ITexture2DCreateInfo): void;
  28883. /**
  28884. * @en Reset the current texture with given size, pixel format and mipmap images.
  28885. * After reset, the gfx resource will become invalid, you must use [[uploadData]] explicitly to upload the new mipmaps to GPU resources.
  28886. * @zh 将当前贴图重置为指定尺寸、像素格式以及指定 mipmap 层级。重置后,贴图的像素数据将变为未定义。
  28887. * mipmap 图像的数据不会自动更新到贴图中,你必须显式调用 [[uploadData]] 来上传贴图数据。
  28888. * @param width Pixel width
  28889. * @param height Pixel height
  28890. * @param format Pixel format
  28891. * @param mipmapLevel Mipmap level count
  28892. * @param baseLevel Mipmap base level
  28893. * @param maxLevel Mipmap maximum level
  28894. * @deprecated since v1.0 please use [[reset]] instead
  28895. */
  28896. create(width: number, height: number, format?: __private._cocos_asset_assets_asset_enum__PixelFormat, mipmapLevel?: number, baseLevel?: number, maxLevel?: number): void;
  28897. toString(): string;
  28898. updateMipmaps(firstLevel?: number, count?: number): void;
  28899. /**
  28900. * @en If the level 0 mipmap image is a HTML element, then return it, otherwise return null.
  28901. * @zh 若此贴图 0 级 Mipmap 的图像资源的实际源存在并为 HTML 元素则返回它,否则返回 `null`。
  28902. * @returns @en HTMLElement or `null`. @zh HTML 元素或者 null。
  28903. * @deprecated Please use [[ImageAsset.data]] instead
  28904. */
  28905. getHtmlElementObj(): HTMLCanvasElement | HTMLImageElement | null;
  28906. /**
  28907. * @en Destroy the current 2d texture, clear up all mipmap levels and the related GPU resources.
  28908. * @zh 销毁此贴图,清空所有 Mipmap 并释放占用的 GPU 资源。
  28909. */
  28910. destroy(): boolean;
  28911. /**
  28912. * @en Gets the description of the 2d texture.
  28913. * @zh 返回此贴图的描述。
  28914. * @returns @en The description. @zh 贴图的描述信息。
  28915. */
  28916. description(): string;
  28917. /**
  28918. * @en Release used GPU resources.
  28919. * @zh 释放占用的 GPU 资源。
  28920. * @deprecated please use [[destroy]] instead.
  28921. */
  28922. releaseTexture(): void;
  28923. /**
  28924. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28925. */
  28926. _serialize(ctxForExporting: any): {
  28927. base: any;
  28928. mipmaps: (string | null)[];
  28929. } | null;
  28930. /**
  28931. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  28932. */
  28933. _deserialize(serializedData: any, handle: any): void;
  28934. initDefault(uuid?: string): void;
  28935. validate(): boolean;
  28936. }
  28937. /**
  28938. * @en The texture cube asset.
  28939. * Each mipmap level of a texture cube have 6 [[ImageAsset]], represents 6 faces of the cube.
  28940. * @zh 立方体贴图资源。
  28941. * 立方体贴图资源的每个 Mipmap 层级都为 6 张 [[ImageAsset]],分别代表了立方体贴图的 6 个面。
  28942. */
  28943. export class TextureCube extends __private._cocos_asset_assets_simple_texture__SimpleTexture {
  28944. static FaceIndex: typeof __private._cocos_asset_assets_texture_cube__FaceIndex;
  28945. isRGBE: boolean;
  28946. _mipmapAtlas: __private._cocos_asset_assets_texture_cube__ITextureCubeMipmapAtlas | null;
  28947. _mipmapMode: __private._cocos_asset_assets_texture_cube__MipmapMode;
  28948. /**
  28949. * @en All levels of mipmap images, be noted, automatically generated mipmaps are not included.
  28950. * When setup mipmap, the size of the texture and pixel format could be modified.
  28951. * @zh 所有层级 Mipmap,注意,这里不包含自动生成的 Mipmap。
  28952. * 当设置 Mipmap 时,贴图的尺寸以及像素格式可能会改变。
  28953. */
  28954. get mipmaps(): __private._cocos_asset_assets_texture_cube__ITextureCubeMipmap[];
  28955. set mipmaps(value: __private._cocos_asset_assets_texture_cube__ITextureCubeMipmap[]);
  28956. /**
  28957. * @en Fill mipmaps for cube map with atlas.
  28958. * @zh 使用 atlas 方式排布的图填充到立方体贴图的 mipmaps。
  28959. * @param value @en All mipmaps of each face of the cube map are stored in the form of atlas
  28960. * and the value contains the atlas of the 6 faces and the layout information of each mipmap layer.
  28961. * @zh 立方体贴图六个面的图,其中每张图中的全部 mip 数据都使用 atlas 方式排布
  28962. */
  28963. set mipmapAtlas(value: __private._cocos_asset_assets_texture_cube__ITextureCubeMipmapAtlas | null);
  28964. get mipmapAtlas(): __private._cocos_asset_assets_texture_cube__ITextureCubeMipmapAtlas | null;
  28965. /**
  28966. * @en Whether mipmaps are baked convolutional maps.
  28967. * @zh mipmaps是否为烘焙出来的卷积图。
  28968. */
  28969. isUsingOfflineMipmaps(): boolean;
  28970. /**
  28971. * @en Level 0 mipmap image.
  28972. * Be noted, `this.image = img` equals `this.mipmaps = [img]`,
  28973. * sets image will clear all previous mipmaps.
  28974. * @zh 0 级 Mipmap。
  28975. * 注意,`this.image = img` 等价于 `this.mipmaps = [img]`,
  28976. * 也就是说,通过 `this.image` 设置 0 级 Mipmap 时将隐式地清除之前的所有 Mipmap。
  28977. */
  28978. get image(): __private._cocos_asset_assets_texture_cube__ITextureCubeMipmap | null;
  28979. set image(value: __private._cocos_asset_assets_texture_cube__ITextureCubeMipmap | null);
  28980. /**
  28981. * @en Create a texture cube with an array of [[Texture2D]] which represents 6 faces of the texture cube.
  28982. * @zh 通过二维贴图数组指定每个 Mipmap 的每个面创建立方体贴图。
  28983. * @param textures Texture array, the texture count must be multiple of 6. Every 6 textures are 6 faces of a mipmap level.
  28984. * The order should obey [[FaceIndex]] order.
  28985. * @param out Output texture cube, if not given, will create a new texture cube.
  28986. * @returns The created texture cube.
  28987. * @example
  28988. * ```ts
  28989. * const textures = new Array<Texture2D>(6);
  28990. * textures[TextureCube.FaceIndex.front] = frontImage;
  28991. * textures[TextureCube.FaceIndex.back] = backImage;
  28992. * textures[TextureCube.FaceIndex.left] = leftImage;
  28993. * textures[TextureCube.FaceIndex.right] = rightImage;
  28994. * textures[TextureCube.FaceIndex.top] = topImage;
  28995. * textures[TextureCube.FaceIndex.bottom] = bottomImage;
  28996. * const textureCube = TextureCube.fromTexture2DArray(textures);
  28997. * ```
  28998. */
  28999. static fromTexture2DArray(textures: Texture2D[], out?: TextureCube): TextureCube;
  29000. /**
  29001. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  29002. */
  29003. _mipmaps: __private._cocos_asset_assets_texture_cube__ITextureCubeMipmap[];
  29004. onLoaded(): void;
  29005. /**
  29006. * @en Reset the current texture with given size, pixel format and mipmap images.
  29007. * After reset, the gfx resource will become invalid, you must use [[uploadData]] explicitly to upload the new mipmaps to GPU resources.
  29008. * @zh 将当前贴图重置为指定尺寸、像素格式以及指定 mipmap 层级。重置后,贴图的像素数据将变为未定义。
  29009. * mipmap 图像的数据不会自动更新到贴图中,你必须显式调用 [[uploadData]] 来上传贴图数据。
  29010. * @param info @en The create information. @zh 创建贴图的相关信息。
  29011. */
  29012. reset(info: __private._cocos_asset_assets_texture_cube__ITextureCubeCreateInfo): void;
  29013. /**
  29014. * @en Updates the given level mipmap image.
  29015. * @zh 更新指定层级范围内的 Mipmap。当 Mipmap 数据发生了改变时应调用此方法提交更改。
  29016. * 若指定的层级范围超出了实际已有的层级范围,只有覆盖的那些层级范围会被更新。
  29017. * @param firstLevel @en First level to be updated. @zh 更新指定层的 mipmap。
  29018. * @param count @en Mipmap level count to be updated。 @zh 指定要更新层的数量。
  29019. */
  29020. updateMipmaps(firstLevel?: number, count?: number): void;
  29021. /**
  29022. * @en Destroys this texture, clear all mipmaps and release GPU resources
  29023. * @zh 销毁此贴图,清空所有 Mipmap 并释放占用的 GPU 资源。
  29024. */
  29025. destroy(): boolean;
  29026. /**
  29027. * @en Release used GPU resources.
  29028. * @zh 释放占用的 GPU 资源。
  29029. * @deprecated please use [[destroy]] instead
  29030. */
  29031. releaseTexture(): void;
  29032. /**
  29033. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  29034. */
  29035. _serialize(ctxForExporting: any): Record<string, unknown> | null;
  29036. /**
  29037. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  29038. */
  29039. _deserialize(serializedData: __private._cocos_asset_assets_texture_cube__ITextureCubeSerializeData, handle: any): void;
  29040. protected _getGfxTextureCreateInfo(presumed: __private._cocos_asset_assets_simple_texture__PresumedGFXTextureInfo): gfx.TextureInfo;
  29041. protected _getGfxTextureViewCreateInfo(presumed: __private._cocos_asset_assets_simple_texture__PresumedGFXTextureViewInfo): gfx.TextureViewInfo;
  29042. protected _uploadAtlas(): void;
  29043. initDefault(uuid?: string): void;
  29044. validate(): boolean;
  29045. }
  29046. /**
  29047. * @en Effect asset is the base template for instantiating material, all effects should be unique globally.
  29048. * All effects are managed in a static map of EffectAsset.
  29049. * @zh Effect 资源,作为材质实例初始化的模板,每个 effect 资源都应是全局唯一的。
  29050. * 所有 Effect 资源都由此类的一个静态对象管理。
  29051. */
  29052. export class EffectAsset extends Asset {
  29053. /**
  29054. * @en Register the effect asset to the static map.
  29055. * @zh 将指定 effect 注册到全局管理器。
  29056. *
  29057. * @param asset @en The effect asset to be registered. @zh 待注册的 effect asset。
  29058. */
  29059. static register(asset: EffectAsset): void;
  29060. /**
  29061. * @en Unregister the effect asset from the static map
  29062. * @zh 将指定 effect 从全局管理器移除。
  29063. *
  29064. * @param asset - @en The effect asset to be removed. @zh 待移除的 effect asset。
  29065. */
  29066. static remove(asset: EffectAsset | string): void;
  29067. /**
  29068. * @en Gets the effect asset by the given name.
  29069. * @zh 获取指定名字的 effect 资源。
  29070. *
  29071. * @param name - @en The name of effect you want to get. @zh 想要获取的 effect 的名字。
  29072. * @returns @en The effect. @zh 你查询的 effect.
  29073. */
  29074. static get(name: string): EffectAsset | null;
  29075. /**
  29076. * @en Gets all registered effect assets.
  29077. * @zh 获取所有已注册的 effect 资源。
  29078. * @returns @en All registered effects. @zh 所有已注册的 effect 资源。
  29079. */
  29080. static getAll(): Record<string, EffectAsset>;
  29081. /**
  29082. * @en The techniques used by the current effect.
  29083. * @zh 当前 effect 的所有可用 technique。
  29084. */
  29085. techniques: EffectAsset.ITechniqueInfo[];
  29086. /**
  29087. * @en The shaders used by the current effect.
  29088. * @zh 当前 effect 使用的所有 shader。
  29089. */
  29090. shaders: EffectAsset.IShaderInfo[];
  29091. /**
  29092. * @en The preprocess macro combinations for the shader
  29093. * @zh 每个 shader 需要预编译的宏定义组合。
  29094. */
  29095. combinations: EffectAsset.IPreCompileInfo[];
  29096. /**
  29097. * @en Whether to hide in editor mode.
  29098. * @zh 是否在编辑器内隐藏。
  29099. */
  29100. hideInEditor: boolean;
  29101. /**
  29102. * @en The loaded callback which should be invoked by the [[AssetManager]], will automatically register the effect.
  29103. * @zh 通过 [[AssetManager]] 加载完成时的回调,将自动注册 effect 资源。
  29104. */
  29105. onLoaded(): void;
  29106. destroy(): boolean;
  29107. initDefault(uuid?: string): void;
  29108. validate(): boolean;
  29109. }
  29110. export namespace EffectAsset {
  29111. export interface IPropertyInfo {
  29112. type: number;
  29113. handleInfo?: [
  29114. string,
  29115. number,
  29116. number
  29117. ];
  29118. samplerHash?: number;
  29119. value?: number[] | string | __private._cocos_asset_assets_texture_base__TextureBase;
  29120. linear?: boolean;
  29121. }
  29122. export interface IPassStates {
  29123. priority?: number;
  29124. primitive?: gfx.PrimitiveMode;
  29125. stage?: pipeline.RenderPassStage;
  29126. rasterizerState?: gfx.RasterizerState;
  29127. depthStencilState?: gfx.DepthStencilState;
  29128. blendState?: gfx.BlendState;
  29129. dynamicStates?: gfx.DynamicStateFlags;
  29130. phase?: string | number;
  29131. pass?: string;
  29132. subpass?: string;
  29133. }
  29134. export interface IPassInfo extends IPassStates {
  29135. program: string;
  29136. embeddedMacros?: renderer.MacroRecord;
  29137. propertyIndex?: number;
  29138. switch?: string;
  29139. properties?: Record<string, IPropertyInfo>;
  29140. shader?: IShaderInfo;
  29141. }
  29142. export interface ITechniqueInfo {
  29143. passes: IPassInfo[];
  29144. name?: string;
  29145. }
  29146. export interface IBlockInfo {
  29147. binding: number;
  29148. name: string;
  29149. members: gfx.Uniform[];
  29150. stageFlags: gfx.ShaderStageFlags;
  29151. }
  29152. export interface ISamplerTextureInfo {
  29153. binding: number;
  29154. name: string;
  29155. type: gfx.Type;
  29156. count: number;
  29157. stageFlags: gfx.ShaderStageFlags;
  29158. }
  29159. export interface ISamplerInfo {
  29160. set: number;
  29161. binding: number;
  29162. name: string;
  29163. count: number;
  29164. stageFlags: gfx.ShaderStageFlags;
  29165. }
  29166. export interface ITextureInfo {
  29167. set: number;
  29168. binding: number;
  29169. name: string;
  29170. type: gfx.Type;
  29171. count: number;
  29172. stageFlags: gfx.ShaderStageFlags;
  29173. }
  29174. export interface IBufferInfo {
  29175. binding: number;
  29176. name: string;
  29177. memoryAccess: gfx.MemoryAccess;
  29178. stageFlags: gfx.ShaderStageFlags;
  29179. }
  29180. export interface IImageInfo {
  29181. binding: number;
  29182. name: string;
  29183. type: gfx.Type;
  29184. count: number;
  29185. memoryAccess: gfx.MemoryAccess;
  29186. stageFlags: gfx.ShaderStageFlags;
  29187. }
  29188. export interface IInputAttachmentInfo {
  29189. set: number;
  29190. binding: number;
  29191. name: string;
  29192. count: number;
  29193. stageFlags: gfx.ShaderStageFlags;
  29194. }
  29195. export interface IAttributeInfo {
  29196. name: string;
  29197. format: gfx.Format;
  29198. isNormalized: boolean;
  29199. stream: number;
  29200. isInstanced: boolean;
  29201. location: number;
  29202. defines: string[];
  29203. }
  29204. export interface IDefineInfo {
  29205. name: string;
  29206. type: string;
  29207. range?: number[];
  29208. options?: string[];
  29209. default?: string;
  29210. }
  29211. export interface IBuiltin {
  29212. name: string;
  29213. defines: string[];
  29214. binding?: number;
  29215. }
  29216. export interface IBuiltinInfo {
  29217. buffers: IBuiltin[];
  29218. blocks: IBuiltin[];
  29219. samplerTextures: IBuiltin[];
  29220. images: IBuiltin[];
  29221. }
  29222. export interface IDescriptorInfo {
  29223. rate: number;
  29224. blocks: IBlockInfo[];
  29225. samplerTextures: ISamplerTextureInfo[];
  29226. samplers: ISamplerInfo[];
  29227. textures: ITextureInfo[];
  29228. buffers: IBufferInfo[];
  29229. images: IImageInfo[];
  29230. subpassInputs: IInputAttachmentInfo[];
  29231. }
  29232. export interface IShaderInfo {
  29233. name: string;
  29234. hash: number;
  29235. glsl4: {
  29236. vert: string;
  29237. frag: string;
  29238. compute?: string;
  29239. };
  29240. glsl3: {
  29241. vert: string;
  29242. frag: string;
  29243. compute?: string;
  29244. };
  29245. glsl1: {
  29246. vert: string;
  29247. frag: string;
  29248. };
  29249. builtins: {
  29250. globals: IBuiltinInfo;
  29251. locals: IBuiltinInfo;
  29252. statistics: Record<string, number>;
  29253. };
  29254. defines: IDefineInfo[];
  29255. attributes: IAttributeInfo[];
  29256. blocks: IBlockInfo[];
  29257. samplerTextures: ISamplerTextureInfo[];
  29258. samplers: ISamplerInfo[];
  29259. textures: ITextureInfo[];
  29260. buffers: IBufferInfo[];
  29261. images: IImageInfo[];
  29262. subpassInputs: IInputAttachmentInfo[];
  29263. descriptors: IDescriptorInfo[];
  29264. }
  29265. export interface IPreCompileInfo {
  29266. [name: string]: boolean[] | number[] | string[];
  29267. }
  29268. }
  29269. /**
  29270. * @en The basic infos for material initialization.
  29271. * @zh 用来初始化材质的基本信息。
  29272. */
  29273. export interface IMaterialInfo {
  29274. /**
  29275. * @en The EffectAsset to use. Must provide if `effectName` is not specified.
  29276. * @zh
  29277. * 这个材质将使用的 EffectAsset,直接提供资源引用,和 `effectName` 至少要指定一个。
  29278. */
  29279. effectAsset?: EffectAsset | null;
  29280. /**
  29281. * @en
  29282. * The name of the EffectAsset to use. Must provide if `effectAsset` is not specified.
  29283. * @zh
  29284. * 这个材质将使用的 EffectAsset,通过 effect 名指定,和 `effectAsset` 至少要指定一个。
  29285. */
  29286. effectName?: string;
  29287. /**
  29288. * @en
  29289. * The index of the technique to use.
  29290. * @zh
  29291. * 这个材质将使用第几个 technique,默认为 0。
  29292. */
  29293. technique?: number;
  29294. /**
  29295. * @en
  29296. * The shader macro definitions. Default to 0 or the specified value in [[EffectAsset]].
  29297. * @zh
  29298. * 这个材质定义的预处理宏,默认全为 0,或 [[EffectAsset]] 中的指定值。
  29299. */
  29300. defines?: renderer.MacroRecord | renderer.MacroRecord[];
  29301. /**
  29302. * @en
  29303. * The override values on top of the pipeline states specified in [[EffectAsset]].
  29304. * @zh
  29305. * 这个材质的自定义管线状态,将覆盖 effect 中的属性。<br>
  29306. * 注意在可能的情况下请尽量少的自定义管线状态,以减小对渲染效率的影响。
  29307. */
  29308. states?: renderer.PassOverrides | renderer.PassOverrides[];
  29309. }
  29310. /**
  29311. * @en The material asset, specifies in details how a model is drawn on screen.
  29312. * @zh 材质资源类,包含模型绘制方式的全部细节描述。
  29313. */
  29314. export class Material extends Asset {
  29315. /**
  29316. * @en Get hash for a material
  29317. * @zh 获取一个材质的哈希值
  29318. * @param material
  29319. */
  29320. static getHash(material: Material): number;
  29321. /**
  29322. * @internal
  29323. */
  29324. protected _techIdx: number;
  29325. /**
  29326. * @internal
  29327. */
  29328. protected _defines: renderer.MacroRecord[];
  29329. /**
  29330. * @internal
  29331. */
  29332. protected _states: renderer.PassOverrides[];
  29333. /**
  29334. * @internal
  29335. */
  29336. protected _props: Record<string, __private._cocos_asset_assets_material__MaterialPropertyFull | __private._cocos_asset_assets_material__MaterialPropertyFull[]>[];
  29337. /**
  29338. * @internal
  29339. */
  29340. protected _passes: renderer.Pass[];
  29341. /**
  29342. * @internal
  29343. */
  29344. protected _hash: number;
  29345. constructor();
  29346. /**
  29347. * @en The current [[EffectAsset]].
  29348. * @zh 当前使用的 [[EffectAsset]] 资源。
  29349. */
  29350. get effectAsset(): EffectAsset | null;
  29351. /**
  29352. * @en Name of the current [[EffectAsset]].
  29353. * @zh 当前使用的 [[EffectAsset]] 资源名。
  29354. */
  29355. get effectName(): string;
  29356. /**
  29357. * @en The current technique index.
  29358. * @zh 当前的 technique 索引。
  29359. */
  29360. get technique(): number;
  29361. /**
  29362. * @en The passes defined in this material.
  29363. * @zh 当前正在使用的 pass 数组。
  29364. */
  29365. get passes(): renderer.Pass[];
  29366. /**
  29367. * @en The hash value of this material.
  29368. * @zh 材质的 hash。
  29369. */
  29370. get hash(): number;
  29371. /**
  29372. * @en The parent material.
  29373. * @zh 父材质。
  29374. */
  29375. get parent(): Material | null;
  29376. /**
  29377. * @en The owner render component.
  29378. * @zh 该材质所归属的渲染组件。
  29379. */
  29380. get owner(): Renderer | null;
  29381. /**
  29382. * @en Initialize this material with the given information.
  29383. * @zh 根据所给信息初始化这个材质,初始化正常结束后材质即可立即用于渲染。
  29384. * @param info @en Material description info. @zh 材质描述信息
  29385. */
  29386. initialize(info: IMaterialInfo): void;
  29387. /**
  29388. * @en Reset the material with the given information.
  29389. * @zh 使用指定的信息重置该材质。
  29390. *
  29391. * @param info @en Material description info. @zh 材质描述信息。
  29392. */
  29393. reset(info: IMaterialInfo): void;
  29394. /**
  29395. * @en
  29396. * Destroy the material definitively.<br>
  29397. * Cannot re-initialize after destroy.<br>
  29398. * Modifications on active materials can be acheived by<br>
  29399. * creating a new Material, invoke the `copy` function<br>
  29400. * with the desired overrides, and assigning it to the target components.
  29401. * @zh
  29402. * 彻底销毁材质,注意销毁后无法重新初始化。<br>
  29403. * 如需修改现有材质,请创建一个新材质,<br>
  29404. * 调用 copy 函数传入需要的 overrides 并赋给目标组件。
  29405. */
  29406. destroy(): boolean;
  29407. /**
  29408. * @en Recompile the shader with the specified macro overrides. Allowed only on material instances.
  29409. * @zh 使用指定预处理宏重新编译当前 pass(数组)中的 shader。只允许对材质实例执行。
  29410. * @param overrides @en The shader macro override values. @zh 宏的覆盖值,用于编译不同 Shader 变体。
  29411. * @param passIdx @en The pass to apply to. Will apply to all passes if not specified. @zh 要重编的 pass 索引,如果没有指定,则重编所有 pass。
  29412. */
  29413. recompileShaders(overrides: renderer.MacroRecord, passIdx?: number): void;
  29414. /**
  29415. * @en Override the passes with the specified pipeline states. Allowed only on material instances.
  29416. * @zh 使用指定管线状态重载当前的 pass(数组)。只允许对材质实例执行。
  29417. * @param overrides The pipeline state override values.
  29418. * @param passIdx The pass to apply to. Will apply to all passes if not specified.
  29419. */
  29420. overridePipelineStates(overrides: renderer.PassOverrides, passIdx?: number): void;
  29421. /**
  29422. * @en Callback function after material is loaded in [[AssetManager]]. Initialize the resources automatically.
  29423. * @zh 通过 [[AssetManager]] 加载完成时的回调,将自动初始化材质资源。
  29424. */
  29425. onLoaded(): void;
  29426. /**
  29427. * @en Reset all the uniforms to the default value specified in [[EffectAsset]].
  29428. * @zh 重置材质的所有 uniform 参数数据为 [[EffectAsset]] 中的默认初始值。
  29429. * @param clearPasses @en Whether to clear the rendering data too. @zh 是否同时清空渲染数据。
  29430. */
  29431. resetUniforms(clearPasses?: boolean): void;
  29432. /**
  29433. * @en
  29434. * Convenient property setter provided for quick material setup.<br>
  29435. * [[renderer.Pass.setUniform]] should be used instead if you need to do per-frame uniform update.
  29436. * @zh
  29437. * 设置材质 uniform 参数的统一入口。<br>
  29438. * 注意如果需要每帧更新 uniform,建议使用 [[renderer.Pass.setUniform]] 以获得更好的性能。
  29439. * @param name @en The target uniform name. @zh 目标 Uniform 名称。
  29440. * @param val @en The target value. @zh 需要设置的目标值。
  29441. * @param passIdx
  29442. * @en The pass to apply to. Will apply to all passes if not specified.
  29443. * @zh 设置此属性的 pass 索引,如果没有指定,则会设置此属性到所有 pass 上。
  29444. */
  29445. setProperty(name: string, val: __private._cocos_asset_assets_material__MaterialPropertyFull | __private._cocos_asset_assets_material__MaterialPropertyFull[], passIdx?: number): void;
  29446. /**
  29447. * @en
  29448. * Gets the specified uniform value for this material.<br>
  29449. * Note that only uniforms set through [[Material.setProperty]] can be acquired here.<br>
  29450. * For the complete rendering data, use [[renderer.Pass.getUniform]] instead.
  29451. * @zh
  29452. * 获取当前材质的指定 uniform 参数的值。<br>
  29453. * 注意只有通过 [[Material.setProperty]] 函数设置的参数才能从此函数取出,<br>
  29454. * 如需取出完整的渲染数据,请使用 [[renderer.Pass.getUniform]]。
  29455. * @param name @en The property or uniform name. @zh 属性或 Uniform 的名称。
  29456. * @param passIdx
  29457. * @en The target pass index. If not specified, return the first found value in all passes.
  29458. * @zh 目标 pass 索引,如果没指定,则返回所有 pass 中第一个找到的值。
  29459. * @return @en The acquired material properties. @zh 获取的材质属性。
  29460. */
  29461. getProperty(name: string, passIdx?: number): Readonly<__private._cocos_asset_assets_material__MaterialPropertyFull | __private._cocos_asset_assets_material__MaterialPropertyFull[]>;
  29462. /**
  29463. * @en Copy the target material, with optional overrides.
  29464. * @zh 复制目标材质到当前实例,允许提供重载信息。
  29465. * @param mat @en The material to be copied. @zh 需要拷贝的原始材质。
  29466. * @param overrides @en The overriding states on top of the original material. @zh 需要在原始材质上覆盖的状态。
  29467. */
  29468. copy(mat: Material, overrides?: IMaterialInfo): void;
  29469. initDefault(uuid?: string): void;
  29470. validate(): boolean;
  29471. }
  29472. /**
  29473. * @en Render texture is a render target for [[Camera]] or [[Canvas]] component,
  29474. * the render pipeline will use its `RenderWindow` as the target of the rendering process.
  29475. * @zh 渲染贴图是 [[Camera]] 或 [[Canvas]] 组件的渲染目标对象,渲染管线会使用它的 `RenderWindow` 作为渲染的目标窗口。
  29476. */
  29477. export class RenderTexture extends __private._cocos_asset_assets_texture_base__TextureBase {
  29478. /**
  29479. * @en The render window for the render pipeline, it's created internally and cannot be modified.
  29480. * @zh 渲染管线所使用的渲染窗口,内部逻辑创建,无法被修改。
  29481. */
  29482. get window(): __private._cocos_render_scene_core_render_window__RenderWindow | null;
  29483. /**
  29484. * @en Initialize the render texture. Using IRenderTextureCreateInfo.
  29485. * @zh 初始化渲染贴图。设置渲染贴图的名称、尺寸、渲染通道信息。
  29486. * @param info @en The create info of render texture. @zh 渲染贴图的创建信息。
  29487. */
  29488. initialize(info: __private._cocos_asset_assets_render_texture__IRenderTextureCreateInfo): void;
  29489. /**
  29490. * @en Reset the render texture. User may change the name, size or render pass info of the render texture.
  29491. * @zh 重新初始化渲染贴图。用户可以更改渲染贴图的名称、尺寸、渲染通道信息。
  29492. * @param info @en The create info of render texture. @zh 渲染贴图的创建信息。
  29493. */
  29494. reset(info: __private._cocos_asset_assets_render_texture__IRenderTextureCreateInfo): void;
  29495. /**
  29496. * @en Destroy the render texture.
  29497. * @zh 销毁渲染贴图。
  29498. */
  29499. destroy(): boolean;
  29500. /**
  29501. * @en Resize the render texture.
  29502. * @zh 修改渲染贴图的尺寸。
  29503. * @param width @en The pixel width to resize to, the range is from 1 to 2048. @zh 需要调整到的像素宽度,范围为 1-2048。
  29504. * @param height @en The pixel height to resize to, the range is from 1 to 2048. @zh 需要调整到的像素高度,范围为 1-2048。
  29505. */
  29506. resize(width: number, height: number): void;
  29507. /**
  29508. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  29509. */
  29510. _serialize(ctxForExporting: any): any;
  29511. /**
  29512. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  29513. */
  29514. _deserialize(serializedData: any, handle: any): void;
  29515. /**
  29516. * @en Gets the related [[gfx.Texture]] resource, it's also the color attachment for the render window.
  29517. * @zh 获取渲染贴图的 GFX 资源,同时也是渲染窗口所指向的颜色缓冲贴图资源。
  29518. * @return @en The low level gfx texture. @zh 底层的 gfx 贴图。
  29519. */
  29520. getGFXTexture(): gfx.Texture | null;
  29521. /**
  29522. * @en Callback function after render texture is loaded in [[AssetManager]]. Initialize the render texture.
  29523. * @zh 通过 [[AssetManager]] 加载完成时的回调,初始化渲染贴图。
  29524. */
  29525. onLoaded(): void;
  29526. /**
  29527. * @en Initialize the render texture with uuid. The default size is 1x1.
  29528. * @zh 初始化渲染贴图。使用 uuid 进行初始化,贴图的尺寸为 1x1。
  29529. * @param uuid @en asset uuid. @zh 资源 uuid。
  29530. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  29531. */
  29532. initDefault(uuid?: string): void;
  29533. /**
  29534. * @en Validate the correctness of the render texture.
  29535. * @zh 验证渲染贴图的正确性。
  29536. * @deprecated Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  29537. */
  29538. validate(): boolean;
  29539. /**
  29540. * @en Read pixel buffer from render texture. @zh 从 render texture 读取像素数据。
  29541. * @param x @en The location on x axis. @zh 起始位置X轴坐标。
  29542. * @param y @en The location on y axis. @zh 起始位置Y轴坐标。
  29543. * @param width @en The pixel width. @zh 像素宽度。
  29544. * @param height @en The pixel height. @zh 像素高度。
  29545. * @param buffer @en The buffer to hold pixel data. @zh 像素缓存。
  29546. */
  29547. readPixels(x?: number, y?: number, width?: number, height?: number, buffer?: Uint8Array): Uint8Array | null;
  29548. }
  29549. /**
  29550. * @en The script asset base class
  29551. * @zh 脚本资源基类。
  29552. */
  29553. export class Script extends Asset {
  29554. }
  29555. /**
  29556. * @en JavaScript asset.
  29557. * @zh JavaScript 脚本资源。
  29558. */
  29559. export class JavaScript extends Script {
  29560. }
  29561. /**
  29562. * @en TypeScript asset
  29563. * @zh TypeScript 脚本资源。
  29564. */
  29565. export class TypeScript extends Script {
  29566. }
  29567. /**
  29568. * @en `assetManager` is a global singleton instance of [[AssetManager]].
  29569. * The engine uses `assetManager` to manage all asset and asset bundle, including loading, releasing, etc.
  29570. * @zh `assetManager` 为 [[AssetManager]] 的全局单例,引擎使用 `assetManager` 来完成所有资源和资源包的管理工作,包括加载,释放等。
  29571. */
  29572. export const assetManager: AssetManager;
  29573. /**
  29574. * @en
  29575. * This module controls asset's behaviors and information, include loading, releasing etc. it is a singleton
  29576. * You can access it via [[assetManager]].
  29577. *
  29578. * @zh
  29579. * 此模块管理资源的行为和信息,包括加载,释放等,这是一个单例,你能够通过 `assetManager` 访问它。
  29580. */
  29581. export class AssetManager {
  29582. /**
  29583. * @en
  29584. * Normal loading pipeline. Asset manager uses this pipeline to load all assets, it has an additional asset parsing process compared to the fetchPipeline.
  29585. *
  29586. * @zh
  29587. * 正常加载管线。Asset manager 使用此管线来加载所有资源,他与 fetchPipeline 相比额外多了资源的解析过程。
  29588. */
  29589. pipeline: AssetManager.Pipeline;
  29590. /**
  29591. * @en
  29592. * Fetching pipeline. Asset manager uses this pipeline to preload all assets, which lacks the asset parsing process compared to the pipeline.
  29593. *
  29594. * @zh
  29595. * 下载管线。Asset manager 使用此管线来预加载所有资源,他与 pipeline 相比缺少了资源的解析过程。
  29596. *
  29597. */
  29598. fetchPipeline: AssetManager.Pipeline;
  29599. /**
  29600. * @en
  29601. * Url transformer. Asset manager uses this pipeline to convert the uuid, path, etc. to the path of the final file path to be loaded.
  29602. * You can customize this pipeline to redirect the path to the path you want.
  29603. *
  29604. * @zh
  29605. * Url 转换器。Asset manager 使用此管线将 uuid, 路径等信息转换为最终要加载的文件路径。你可以自定义此管线将路径重定向到你想要的路径。
  29606. *
  29607. */
  29608. transformPipeline: AssetManager.Pipeline;
  29609. /**
  29610. * @en
  29611. * The collection of bundle which is already loaded, you can remove cache with [[removeBundle]].
  29612. *
  29613. * @zh
  29614. * 已加载 bundle 的集合, 你能通过 [[removeBundle]] 来移除缓存。
  29615. *
  29616. */
  29617. bundles: __private._cocos_asset_asset_manager_cache__ICache<AssetManager.Bundle>;
  29618. /**
  29619. * @en
  29620. * The collection of asset which is already loaded, you can remove cache with [[releaseAsset]].
  29621. *
  29622. * @zh
  29623. * 已加载资源的集合, 你能通过 [[releaseAsset]] 来移除缓存。
  29624. */
  29625. assets: __private._cocos_asset_asset_manager_cache__ICache<Asset>;
  29626. /**
  29627. * @internal only using in L10N for now.
  29628. */
  29629. readonly assetsOverrideMap: Map<string, string>;
  29630. /**
  29631. * @internal
  29632. */
  29633. generalImportBase: string;
  29634. /**
  29635. * @internal
  29636. */
  29637. generalNativeBase: string;
  29638. /**
  29639. * @en
  29640. * Manage relationship between asset and its dependencies.
  29641. *
  29642. * @zh
  29643. * 管理资源间依赖关系。
  29644. */
  29645. dependUtil: AssetManager.DependUtil;
  29646. /**
  29647. * @en
  29648. * A flag indicates whether to force loading assets and ignore errors.
  29649. *
  29650. * @zh
  29651. * 是否强制加载资源标志, 如果为 true,加载资源时将会忽略错误。
  29652. *
  29653. */
  29654. force: boolean;
  29655. /**
  29656. * @en
  29657. * Whether to use image bitmap to load image first. If enabled, images loading will become faster but memory usage will increase.
  29658. *
  29659. * @zh
  29660. * 是否优先使用 image bitmap 来加载图片,启用之后,图片加载速度会更快, 但内存占用会变高。
  29661. *
  29662. */
  29663. allowImageBitmap: boolean;
  29664. /**
  29665. * @en
  29666. * Some useful functions, such as the convert function between url and uuid.
  29667. *
  29668. * @zh
  29669. * 一些有用的方法, 例如 url 与 uuid 之间的转换方法。
  29670. *
  29671. */
  29672. utils: typeof __private._cocos_asset_asset_manager_helper;
  29673. /**
  29674. * @en
  29675. * The downloader used by `assetManager`.It manages all downloading tasks.
  29676. *
  29677. * @zh
  29678. * `assetManager` 所使用的下载器,管理所有下载任务。
  29679. *
  29680. */
  29681. downloader: AssetManager.Downloader;
  29682. /**
  29683. * @en
  29684. * The parser used by `assetManager`.It manages all parsing tasks.
  29685. *
  29686. * @zh
  29687. * `assetManager` 所使用的解析器,管理所有解析任务。
  29688. *
  29689. */
  29690. parser: AssetManager.Parser;
  29691. /**
  29692. * @en
  29693. * Manage all packed assets.
  29694. *
  29695. * @zh
  29696. * 管理所有合并后的资源。
  29697. *
  29698. * @deprecated Since v3.7, this is an engine internal interface. You usually don't need to care about how resources are merged and split.
  29699. */
  29700. packManager: __private._cocos_asset_asset_manager_pack_manager__PackManager;
  29701. /**
  29702. * @en
  29703. * Whether to cache loaded assets.
  29704. *
  29705. * @zh
  29706. * 是否缓存已加载的资源。
  29707. *
  29708. */
  29709. cacheAsset: boolean;
  29710. /**
  29711. * @en
  29712. * Cache manager is a module which controls all caches downloaded from server in non-web platform.
  29713. *
  29714. * @zh
  29715. * 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存。
  29716. *
  29717. */
  29718. cacheManager: AssetManager.CacheManager | null;
  29719. /**
  29720. * @en
  29721. * The preset of options.
  29722. *
  29723. * @zh
  29724. * 可选参数的预设集。
  29725. *
  29726. */
  29727. presets: Record<string, Record<string, any>>;
  29728. /**
  29729. * @internal
  29730. */
  29731. factory: __private._cocos_asset_asset_manager_factory__Factory;
  29732. /**
  29733. * @internal
  29734. */
  29735. preprocessPipe: typeof __private._cocos_asset_asset_manager_preprocess__default;
  29736. /**
  29737. * @internal
  29738. */
  29739. fetchPipe: typeof __private._cocos_asset_asset_manager_fetch__default;
  29740. /**
  29741. * @internal
  29742. */
  29743. loadPipe: typeof __private._cocos_asset_asset_manager_load__default;
  29744. /**
  29745. * @internal
  29746. */
  29747. references: AssetManager.Cache<any[]> | null;
  29748. /**
  29749. * @en
  29750. * A global singleton instance of [[AssetManager]], which you can access directly through [[assetManager]].
  29751. *
  29752. * @zh
  29753. * [[AssetManager]] 的全局单例,你可以直接通过 [[assetManager]] 访问。
  29754. */
  29755. static get instance(): AssetManager;
  29756. /**
  29757. * @en
  29758. * The builtin 'main' bundle.
  29759. *
  29760. * @zh
  29761. * 内置 main 包。
  29762. */
  29763. get main(): AssetManager.Bundle | null;
  29764. /**
  29765. * @en
  29766. * The builtin 'resources' bundle.
  29767. *
  29768. * @zh
  29769. * 内置 resources 包。
  29770. *
  29771. */
  29772. get resources(): AssetManager.Bundle | null;
  29773. /**
  29774. * @en
  29775. * Initializes assetManager with options.
  29776. * This method will be called automatically when the engine starts, you should not call this method manually at any time.
  29777. *
  29778. * @zh
  29779. * 初始化资源管理器,引擎在启动时,将会自动调用此方法,你不应该在任何时候手动调用此方法。
  29780. *
  29781. * @param options @en The configuration of asset manager. @zh 资源管理器的配置选项。
  29782. * @internal
  29783. */
  29784. init(options?: __private._cocos_asset_asset_manager_asset_manager__IAssetManagerOptions): void;
  29785. /**
  29786. * @en
  29787. * Gets the bundle which has been loaded with the name of bundle.
  29788. *
  29789. * @zh
  29790. * 通过包名称获取已加载的分包。
  29791. *
  29792. * @param name @en The name of bundle. @zh 资源包的名称。
  29793. * @returns @en The loaded bundle. @zh 已加载的资源包。
  29794. *
  29795. * @example
  29796. * // ${project}/assets/test1
  29797. * assetManager.getBundle('test1');
  29798. *
  29799. * assetManager.getBundle('resources');
  29800. *
  29801. */
  29802. getBundle(name: string): AssetManager.Bundle | null;
  29803. /**
  29804. * @en
  29805. * Removes this bundle. NOTE: The asset within this bundle will not be released automatically,
  29806. * you can call [[AssetManager.Bundle.releaseAll]] manually before removing it if you need.
  29807. *
  29808. * @zh
  29809. * 移除此包, 注意:这个包内的资源不会自动释放, 如果需要的话你可以在摧毁之前手动调用 [[AssetManager.Bundle.releaseAll]] 进行释放。
  29810. *
  29811. * @param bundle @en The bundle to be removed. @zh 准备移除的 Bundle。
  29812. *
  29813. */
  29814. removeBundle(bundle: AssetManager.Bundle): void;
  29815. /**
  29816. * @en
  29817. * General interface used to load assets with a progression callback and a complete callback.
  29818. * It is highly recommended that you use more simple API, such as `load`, `loadDir` etc. You can pass
  29819. * some additional data via the `options` parameter, and the parameters in `options` will affect this loading.
  29820. * The optional parameter will be transferred to handler of `downloader` and `parser` as `options`. You can
  29821. * register you own handler downloader or parser to collect these custom parameters for some effect.
  29822. *
  29823. * Reserved Keywords for additional parameters: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`,
  29824. * `bundle`, `onFileProgress`, `maxConcurrency`, `maxRequestsPerFrame`, `maxRetryCount`, `version`, `xhrResponseType`,
  29825. * `xhrWithCredentials`, `xhrMimeType`, `xhrTimeout`, `xhrHeader`, `reloadAsset`, `cacheAsset`, `cacheEnabled`,
  29826. * Please DO NOT use these words as your own options!
  29827. *
  29828. * @zh
  29829. * 通用加载资源接口,可传入进度回调以及完成回调,建议你使用更简单的API,例如 `load`、`loadDir` 等。你可以通过 `options` 参数额外传递一些数据,`options` 中的参数将会影响本次加载。
  29830. * 额外参数会传入加载流程中的 `downloader`, `parser` 的处理方法中, 你可以扩展 `downloader`, `parser` 收集参数完成想实现的效果。
  29831. *
  29832. * 额外参数保留关键字: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`,
  29833. * `maxConcurrency`, `maxRequestsPerFrame`, `maxRetryCount`, `version`, `xhrResponseType`, `xhrWithCredentials`, `xhrMimeType`, `xhrTimeout`, `xhrHeader`,
  29834. * `reloadAsset`, `cacheAsset`, `cacheEnabled`, 请不要使用这些字段为你自己的参数!
  29835. *
  29836. * @param requests @en The loading requests. @zh 加载请求。
  29837. * @param options @en Optional parameters. @zh 可选参数。
  29838. * @param onProgress @en Callback invoked when the loading progress change. @zh 加载进度发生变化时执行的回调。
  29839. * @param onProgress.finished
  29840. * @en The number of request items that have finished loading.
  29841. * @zh 已经完成加载的资源数量。
  29842. * @param onProgress.total @en The number of all request items to be loaded. @zh 所有待加载的资源数量。
  29843. * @param onProgress.item @en The finished request item. @zh 当前完成的加载项。
  29844. * @param onComplete @en Callback invoked when all assets loaded. @zh 所有资源加载完成后的回调。
  29845. * @param onComplete.err @en Error message during loading, or null if loaded successfully. @zh 加载过程中的错误信息,如果加载成功则为 null。
  29846. * @param onComplete.data @en The loaded data, or null if an error occurred during loading. @zh 已加载的数据,如果加载过程中有错误发生,则为 null。
  29847. *
  29848. * @example
  29849. * assetManager.loadAny({url: 'http://example.com/a.png'}, (err, img) => log(img));
  29850. * assetManager.loadAny(['60sVXiTH1D/6Aft4MRt9VC'], (err, assets) => log(assets));
  29851. * assetManager.loadAny([{ uuid: '0cbZa5Y71CTZAccaIFluuZ'}, {url: 'http://example.com/a.png'}], (err, assets) => log(assets));
  29852. * assetManager.downloader.register('.asset', (url, options, onComplete) => {
  29853. * url += '?userName=' + options.userName + "&password=" + options.password;
  29854. * // other logic.
  29855. * });
  29856. * assetManager.parser.register('.asset', (file, options, onComplete) => {
  29857. * var json = JSON.parse(file);
  29858. * var skin = json[options.skin];
  29859. * var model = json[options.model];
  29860. * onComplete(null, {skin, model});
  29861. * });
  29862. * assetManager.loadAny({ url: 'http://example.com/my.asset' }, { skin: 'xxx', model: 'xxx', userName: 'xxx', password: 'xxx' });
  29863. *
  29864. */
  29865. loadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, options: {
  29866. [key: string]: any;
  29867. preset?: string;
  29868. } | null, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: any) => void) | null): void;
  29869. loadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: any) => void) | null): void;
  29870. loadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, options: {
  29871. [key: string]: any;
  29872. preset?: string;
  29873. } | null, onComplete?: ((err: Error | null, data: any) => void) | null): void;
  29874. loadAny<T extends Asset>(requests: string, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  29875. loadAny<T extends Asset>(requests: string[], onComplete?: ((err: Error | null, data: T[]) => void) | null): void;
  29876. loadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, onComplete?: ((err: Error | null, data: any) => void) | null): void;
  29877. /**
  29878. * @en
  29879. * General interface used to preload assets with a progression callback and a complete callback.It is highly recommended that you use
  29880. * more simple API, such as `preloadRes`, `preloadResDir` etc. Everything about preload is just likes `assetManager.loadAny`, the
  29881. * difference is `assetManager.preloadAny` will only download asset but not parse asset. You need to invoke `assetManager.loadAny()`
  29882. * to finish loading asset
  29883. *
  29884. * @zh
  29885. * 通用预加载资源接口,可传入进度回调以及完成回调,非常建议你使用更简单的 API ,例如 `preloadRes`, `preloadResDir` 等。`preloadAny` 和 `loadAny`
  29886. * 几乎一样,区别在于 `preloadAny` 只会下载资源,不会去解析资源,你需要调用 `assetManager.loadAny()` 来完成资源加载。
  29887. *
  29888. * @param requests @en The preloading requests. @zh 预加载请求。
  29889. * @param options @en Optional parameters. @zh 可选参数。
  29890. * @param onProgress @en Callback invoked when the preloading progress change. @zh 预加载进度发生变化时执行的回调。
  29891. * @param onProgress.finished
  29892. * @en The number of request items that have finished preloading.
  29893. * @zh 已经完成加载的资源数量。
  29894. * @param onProgress.total @en The number of all request items to be preloaded. @zh 所有待预加载的资源数量。
  29895. * @param onProgress.item @en The finished request item. @zh 当前完成的预加载项。
  29896. * @param onComplete @en Callback invoked when all assets preloaded. @zh 所有资源预加载完成后的回调。
  29897. * @param onComplete.err
  29898. * @en The error occurred in preloading process. Or null if preloaded successfully.
  29899. * @zh 预加载过程中的发生的错误,如果预加载成功则为 null。
  29900. * @param onComplete.items @en The preloaded content. @zh 完成预加载的内容。
  29901. *
  29902. * @example
  29903. * assetManager.preloadAny('0cbZa5Y71CTZAccaIFluuZ', (err) => assetManager.loadAny('0cbZa5Y71CTZAccaIFluuZ'));
  29904. *
  29905. */
  29906. preloadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, options: {
  29907. [key: string]: any;
  29908. preset?: string;
  29909. } | null, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: AssetManager.RequestItem[]) => void) | null): void;
  29910. preloadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: AssetManager.RequestItem[]) => void) | null): void;
  29911. preloadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, options: {
  29912. [key: string]: any;
  29913. preset?: string;
  29914. } | null, onComplete?: ((err: Error | null, data: AssetManager.RequestItem[]) => void) | null): void;
  29915. preloadAny(requests: string | string[] | __private._cocos_asset_asset_manager_shared__IRequest | Array<__private._cocos_asset_asset_manager_shared__IRequest>, onComplete?: ((err: Error | null, data: AssetManager.RequestItem[]) => void) | null): void;
  29916. /**
  29917. * @en
  29918. * Loads remote asset with url, such as audio, image, text and so on.
  29919. * Note that `loadRemote` uses the extension name in the url to determine how to load the asset.
  29920. * If you pass in a url without the extension name, you need to specify the `ext` parameter
  29921. * in the `options` to indicate how you want the asset loaded. See the third example below.
  29922. *
  29923. * @zh
  29924. * 使用 url 加载远程资源,例如音频,图片,文本等等。需要注意的是 `loadRemote` 是通过 url 中的扩展名判断以何种方式加载该资源,
  29925. * 如果你传入的 url 中没有携带后缀名,你需要额外指定 `options` 中的 `ext` 参数来表明你需要何种方式加载该资源。请参考下面的第三个示例。
  29926. *
  29927. * @param url @en The url of asset. @zh 资源的 URL 链接。
  29928. * @param options @en Some optional parameters. @zh 一些可选参数。
  29929. * @param options.ext
  29930. * @en If the url does not have an extension name, you can specify one manually. This will affect the way the assets are loaded.
  29931. * @zh 如果 URL 链接中没有包含扩展名,你可以手动指定一个扩展名。这将会影响资源的加载方式。
  29932. * @param onComplete @en Callback invoked when finish loading. @zh 当完成加载时触发的回调函数。
  29933. * @param onComplete.err @en The error occurred in loading process. Or null if loaded successfully. @zh 加载过程中出现的错误,如果加载成功则为 null。
  29934. * @param onComplete.asset
  29935. * @en The loaded asset. If there is an error in the loading process, this asset will be null.
  29936. * @zh 加载好的资源,如果加载过程出现了错误,资源将会 null。
  29937. *
  29938. * @example
  29939. * assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => console.log(err));
  29940. * assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => console.log(err));
  29941. * assetManager.loadRemote('http://www.cloud.com/test3', { ext: '.png' }, (err, texture) => console.log(err));
  29942. *
  29943. */
  29944. loadRemote<T extends Asset>(url: string, options: {
  29945. [k: string]: any;
  29946. ext?: string;
  29947. } | null, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  29948. loadRemote<T extends Asset>(url: string, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  29949. /**
  29950. * @en
  29951. * loads bundle with bundle name or URL. When you have configured a bundle in your project, you can load the bundle by the name configured in your project.
  29952. * Or when you put the bundle on the server, you can also load it by the full url address.
  29953. *
  29954. * Note: When you load a remote bundle by name, the bundle will be cached locally after download and will continue to use that cache in future, even if
  29955. * the version of the bundle file on your server has changed. When you need to load the latest bundle, you can pass an additional `version` parameter in the
  29956. * optional parameters and the asset system will compare this version number with the local cache, if the comparison fails, the asset system will pull
  29957. * the latest version of the bundle data from the server again.
  29958. *
  29959. * @zh
  29960. * 通过包名称或 url 加载资源包。当你在项目中配置了 Bundle 后,你可以通过项目中配置的名称来加载该 Bundle。
  29961. * 或者当你将 bundle 放在服务器上时,你也可以通过完整的 url 地址进行加载。
  29962. *
  29963. * 注意:当你用名称加载远程 bundle 时,该 bundle 在下载后将会缓存在本地并在后续持续使用该缓存,即使你服务器上的 bundle 文件版本已经发生变化。当你需要加载
  29964. * 最新的 bundle 时,你可以在可选参数中额外传入一个 `version` 参数,资源系统将比对此版本号与本地缓存是否一致,如果比对失败,则资源系统将重新从服务器上拉取
  29965. * 最新版本的 bundle 数据。
  29966. *
  29967. * @param nameOrUrl @en The name or root path of bundle. @zh 待加载的 bundle 在项目中的名称或在服务器上的 url 路径。
  29968. * @param options @en Some optional parameters. @zh 一些可选参数。
  29969. * @param options.version
  29970. * @en The version of the bundle, which you can get in the editor's build system, or directly by looking at the md5 hash value in the `config.json` path in the bundle directory after the build.
  29971. * @zh bundle 的版本号,你可以在编辑器的构建系统中获取,或者直接查看构建后的 bundle 目录中 config.json 路径中的 md5 hash 值。
  29972. * @param onComplete @en Callback invoked when bundle loaded or failed. @zh bundle 加载完成的回调。
  29973. * @param onComplete.err @en The occurred error during the loading, Or null if loaded successfully. @zh 加载过程中发生的错误,如果加载成功则为 null。
  29974. * @param onComplete.bundle
  29975. * @en The loaded bundle. If there is an error in the loading process, this bundle will be null.
  29976. * @zh 加载完成的 bundle。如果加载过程中出现了错误,则为 null。
  29977. *
  29978. * @example
  29979. * loadBundle('myBundle', (err, bundle) => console.log(bundle));
  29980. * loadBundle('http://localhost:8080/test', null, (err, bundle) => console.log(err));
  29981. *
  29982. */
  29983. loadBundle(nameOrUrl: string, options: {
  29984. [k: string]: any;
  29985. version?: string;
  29986. } | null, onComplete?: ((err: Error | null, data: AssetManager.Bundle) => void) | null): void;
  29987. loadBundle(nameOrUrl: string, onComplete?: ((err: Error | null, data: AssetManager.Bundle) => void) | null): void;
  29988. /**
  29989. * @en
  29990. * Release asset and it's dependencies.
  29991. * This method will not only remove the cache of the asset in assetManager, but also clean up its content.
  29992. * For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  29993. * Notice, this method may cause the texture to be unusable, if there are still other nodes use the same texture,
  29994. * they may turn to black and report gl errors.
  29995. *
  29996. * @zh
  29997. * 释放资源以及其依赖资源, 这个方法不仅会从 assetManager 中删除资源的缓存引用,还会清理它的资源内容。
  29998. * 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  29999. * 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  30000. *
  30001. * @param asset @en The asset to be released. @zh 被释放的资源。
  30002. *
  30003. * @example
  30004. * // release a texture which is no longer need
  30005. * assetManager.releaseAsset(texture);
  30006. *
  30007. */
  30008. releaseAsset(asset: Asset): void;
  30009. /**
  30010. * @en
  30011. * Release all assets. Refer to [[releaseAsset]] for detailed information.
  30012. *
  30013. * @zh
  30014. * 释放所有资源。详细信息请参考 [[releaseAsset]]。
  30015. *
  30016. */
  30017. releaseAll(): void;
  30018. /**
  30019. * For internal usage.
  30020. * @param json
  30021. * @param options
  30022. * @param onComplete
  30023. * @internal
  30024. */
  30025. loadWithJson<T extends Asset>(json: Record<string, any>, options: {
  30026. [key: string]: any;
  30027. assetId?: string;
  30028. } | null, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: T) => void) | null): void;
  30029. loadWithJson<T extends Asset>(json: Record<string, any>, onProgress: ((finished: number, total: number, item: AssetManager.RequestItem) => void) | null, onComplete: ((err: Error | null, data: T) => void) | null): void;
  30030. loadWithJson<T extends Asset>(json: Record<string, any>, options: {
  30031. [key: string]: any;
  30032. assetId?: string;
  30033. }, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  30034. loadWithJson<T extends Asset>(json: Record<string, any>, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  30035. }
  30036. export namespace AssetManager {
  30037. /**
  30038. * @en
  30039. * The loading pipeline can complete the loading task by executing a series of phases. [[AssetManager]] uses it to load all assets.
  30040. *
  30041. * @zh
  30042. * 加载管线能通过执行一系列阶段来完成加载任务。[[AssetManager]] 使用其来加载所有资源。
  30043. *
  30044. */
  30045. export class Pipeline {
  30046. /**
  30047. * @en
  30048. * The unique id of this pipeline.
  30049. *
  30050. * @zh
  30051. * 管线的唯一 id。
  30052. *
  30053. */
  30054. id: number;
  30055. /**
  30056. * @en
  30057. * The name of this pipeline.
  30058. *
  30059. * @zh
  30060. * 此管线的名称。
  30061. *
  30062. */
  30063. name: string;
  30064. /**
  30065. * @en
  30066. * All pipes of this pipeline.
  30067. *
  30068. * @zh
  30069. * 此管线的所有管道。
  30070. *
  30071. */
  30072. pipes: Array<((task: Task, done: ((err?: Error | null) => void)) => void) | ((task: Task) => Error | void)>;
  30073. /**
  30074. * @en
  30075. * Creates a new pipeline.
  30076. *
  30077. * @zh
  30078. * 创建一个管线。
  30079. *
  30080. * @param name - @en The name of pipeline. @zh 管线的名称。
  30081. * @param funcs
  30082. * @en The array of pipes to create pipeline, every pipe must be function which take two parameters,
  30083. * the first is a `Task` flowed in pipeline, the second is complete callback.
  30084. * @zh 用于创建管线的管道数组,每个管道必须是一个接受两个参数的方法,第一个参数为任务 [[Task]], 第二个参数为完成回调。
  30085. *
  30086. * @example
  30087. * const pipeline = new Pipeline('download', [
  30088. * (task, done) => {
  30089. * const url = task.input;
  30090. * assetManager.downloader.downloadFile(url, null, null, (err, result) => {
  30091. * task.output = result;
  30092. * done(err);
  30093. * });
  30094. * },
  30095. * (task, done) => {
  30096. * const text = task.input;
  30097. * const json = JSON.stringify(text);
  30098. * task.output = json;
  30099. * done();
  30100. * }
  30101. * ]);
  30102. *
  30103. */
  30104. constructor(name: string, funcs: Array<((task: Task, done: ((err?: Error | null) => void)) => void) | ((task: Task) => Error | void)>);
  30105. /**
  30106. * @en
  30107. * Inserts a new pipe to pipeline at specific point .
  30108. *
  30109. * @zh
  30110. * 在某个特定的点为管线插入一个新的 pipe。
  30111. *
  30112. * @param func @en The new pipe to be inserted. @zh 待插入的管道。
  30113. * @param func.task @en The task handled with pipeline will be transferred to this function. @zh 正在被此管线处理的任务。
  30114. * @param func.done
  30115. * @en Callback you need to invoke manually when this pipe is finished. if the pipeline is synchronous, callback is unnecessary.
  30116. * @zh 当这个管道完成时,你需要手动调用回调。如果管道是同步的,回调就没有必要。
  30117. * @param index @en The specific point you want to insert at. @zh 要插入进的位置。
  30118. * @return @en Returns the Pipeline itself, which can be used to make chain calls. @zh 返回 Pipeline 本身,可以用于做链式调用。
  30119. *
  30120. * @example
  30121. * var pipeline = new Pipeline('test', []);
  30122. * pipeline.insert((task, done) => {
  30123. * // do something
  30124. * done();
  30125. * }, 0);
  30126. *
  30127. */
  30128. insert(func: ((task: Task, done: ((err?: Error | null) => void)) => void) | ((task: Task) => Error | void), index: number): Pipeline;
  30129. /**
  30130. * @en
  30131. * Appends a new pipe to the pipeline.
  30132. *
  30133. * @zh
  30134. * 添加一个管道到管线中。
  30135. *
  30136. * @param func @en The new pipe to be appended. @zh 要追加的新管道。
  30137. * @param func.task
  30138. * @en The task handled with pipeline will be transferred to this function.
  30139. * @zh 正在被此管线处理的任务。
  30140. * @param func.done
  30141. * @en Callback you need to invoke manually when this pipe is finished. if the pipeline is synchronous, callback is unnecessary.
  30142. * @zh 当这个管道完成时,你需要手动调用回调。如果管道是同步的,回调就没有必要。
  30143. * @return @en Returns the Pipeline itself, which can be used to make chain calls. @zh 返回 Pipeline 本身,可以用于做链式调用。
  30144. *
  30145. * @example
  30146. * var pipeline = new Pipeline('test', []);
  30147. * pipeline.append((task, done) => {
  30148. * // do something
  30149. * done();
  30150. * });
  30151. *
  30152. */
  30153. append(func: ((task: Task, done: ((err?: Error | null) => void)) => void) | ((task: Task) => Error | void)): Pipeline;
  30154. /**
  30155. * @en
  30156. * Removes pipe which at specific point.
  30157. *
  30158. * @zh
  30159. * 移除特定位置的管道。
  30160. *
  30161. * @param index @en The specific point. @zh 指定位置的索引。
  30162. * @return @en Returns the Pipeline itself, which can be used to make chain calls. @zh 返回 Pipeline 本身,可以用于做链式调用。
  30163. *
  30164. * @example
  30165. * var pipeline = new Pipeline('test', (task, done) => {
  30166. * // do something
  30167. * done();
  30168. * });
  30169. * pipeline.remove(0);
  30170. *
  30171. */
  30172. remove(index: number): Pipeline;
  30173. /**
  30174. * @en
  30175. * Executes task synchronously.
  30176. *
  30177. * @zh
  30178. * 同步执行任务。
  30179. *
  30180. * @param task @en The task will be executed. @zh 要执行的任务。
  30181. * @returns @en The execution result. @zh 执行结果。
  30182. *
  30183. * @example
  30184. * var pipeline = new Pipeline('sync', [(task) => {
  30185. * let input = task.input;
  30186. * task.output = doSomething(task.input);
  30187. * }]);
  30188. *
  30189. * var task = new Task({input: 'test'});
  30190. * console.log(pipeline.sync(task));
  30191. *
  30192. */
  30193. sync(task: Task): any;
  30194. /**
  30195. * @en
  30196. * Executes task asynchronously.
  30197. *
  30198. * @zh
  30199. * 异步执行任务。
  30200. *
  30201. * @param task @en The task will be executed. @zh 待执行的任务。
  30202. *
  30203. * @example
  30204. * var pipeline = new Pipeline('sync', [(task, done) => {
  30205. * let input = task.input;
  30206. * task.output = doSomething(task.input);
  30207. * done();
  30208. * }]);
  30209. * var task = new Task({input: 'test', onComplete: (err, result) => console.log(result)});
  30210. * pipeline.async(task);
  30211. *
  30212. */
  30213. async(task: Task): void;
  30214. }
  30215. /**
  30216. * @en
  30217. * Tasks are the smallest unit of data running in the pipeline, You can create a task and pass in the input information,
  30218. * and then get the output of that task after it has been executed in the pipeline to use.
  30219. *
  30220. * @zh
  30221. * 任务是在管线中运行的最小数据单位,你可以创建一个任务并传入输入信息,在经过管线执行后获取该任务的输出来使用。
  30222. *
  30223. */
  30224. export class Task {
  30225. /**
  30226. * @en
  30227. * Create a new task from pool.
  30228. *
  30229. * @zh
  30230. * 从对象池中创建 task。
  30231. *
  30232. * @param options @en Some optional parameters. @zh 一些可选参数。
  30233. * @param options.onComplete
  30234. * @en Callback when the task complete, if the pipeline is synchronous, onComplete is unnecessary.
  30235. * @zh 任务完成后的回调,如果流水线是同步的,onComplete 是不必要的。
  30236. * @param options.onProgress
  30237. * @en Continuously callback when the task is running, if the pipeline is synchronous, onProgress is unnecessary.
  30238. * @zh 在任务运行时持续回调,如果管道是同步的,onProgress 是不必要的。
  30239. * @param options.onError
  30240. * @en Callback when something goes wrong, if the pipeline is synchronous, onError is unnecessary.
  30241. * @zh 出错时的回调,如果流水线是同步的,onError 是不必要的。
  30242. * @param options.input @en Something will be handled with pipeline. @zh 需要被此管道处理的任务数据。
  30243. * @param options.progress @en Progress information. @zh 进度信息。
  30244. * @param options.options @en Custom parameters. @zh 自定义参数。
  30245. * @returns @en return a newly created task. @zh 返回一个新创建的任务。
  30246. *
  30247. */
  30248. static create(options: __private._cocos_asset_asset_manager_task__ITaskOption): Task;
  30249. /**
  30250. * @en
  30251. * The id of task.
  30252. *
  30253. * @zh
  30254. * 任务 id。
  30255. *
  30256. */
  30257. id: number;
  30258. /**
  30259. * @en
  30260. * The callback when task is completed.
  30261. *
  30262. * @zh
  30263. * 完成回调。
  30264. *
  30265. */
  30266. onComplete: ((err: Error | null | undefined, data: any) => void) | null;
  30267. /**
  30268. * @en
  30269. * The callback of progression.
  30270. *
  30271. * @zh
  30272. * 进度回调。
  30273. *
  30274. */
  30275. onProgress: ((...args: any[]) => void) | null;
  30276. /**
  30277. * @en
  30278. * The callback when something goes wrong.
  30279. *
  30280. * @zh
  30281. * 错误回调。
  30282. *
  30283. */
  30284. onError: ((...args: any[]) => void) | null;
  30285. /**
  30286. * @en
  30287. * The source data of task.
  30288. *
  30289. * @zh
  30290. * 任务的源数据。
  30291. *
  30292. */
  30293. source: any;
  30294. /**
  30295. * @en
  30296. * The output of task.
  30297. *
  30298. * @zh
  30299. * 任务的输出。
  30300. */
  30301. output: any;
  30302. /**
  30303. * @en
  30304. * The input of task.
  30305. *
  30306. * @zh
  30307. * 任务的输入。
  30308. *
  30309. */
  30310. input: any;
  30311. /**
  30312. * @en
  30313. * The progression of task.
  30314. *
  30315. * @zh
  30316. * 任务的进度。
  30317. *
  30318. */
  30319. progress: any;
  30320. /**
  30321. * @en
  30322. * Custom options.
  30323. *
  30324. * @zh
  30325. * 自定义参数。
  30326. *
  30327. */
  30328. options: Record<string, any> | null;
  30329. /**
  30330. * @deprecated Typo. Since v3.7, please use [[Task.isFinished]] instead.
  30331. */
  30332. get isFinish(): boolean;
  30333. /**
  30334. * @deprecated Typo. Since v3.7, please use [[Task.isFinished]] instead.
  30335. */
  30336. set isFinish(val: boolean);
  30337. /**
  30338. * @en
  30339. * Whether or not this task is completed.
  30340. *
  30341. * @zh
  30342. * 此任务是否已经完成。
  30343. *
  30344. */
  30345. isFinished: boolean;
  30346. /**
  30347. * @en
  30348. * Create a new Task.
  30349. *
  30350. * @zh
  30351. * 创建一个任务。
  30352. *
  30353. * @param options @en Some optional parameters. @zh 一些可选参数。
  30354. * @param options.onComplete
  30355. * @en Callback when the task complete, if the pipeline is synchronous, onComplete is unnecessary.
  30356. * @zh 任务完成后的回调,如果流水线是同步的,onComplete 是不必要的。
  30357. * @param options.onProgress
  30358. * @en Continuously callback when the task is running, if the pipeline is synchronous, onProgress is unnecessary.
  30359. * @zh 在任务运行时持续回调,如果管道是同步的,onProgress 是不必要的。
  30360. * @param options.onError
  30361. * @en Callback when something goes wrong, if the pipeline is synchronous, onError is unnecessary.
  30362. * @zh 出错时的回调,如果流水线是同步的,onError 是不必要的。
  30363. * @param options.input @en Something will be handled with pipeline. @zh 需要被此管道处理的任务数据。
  30364. * @param options.progress @en Progress information. @zh 进度信息。
  30365. * @param options.options @en Custom parameters. @zh 自定义参数。
  30366. * @returns @en return a newly created task. @zh 返回一个新创建的任务。
  30367. */
  30368. constructor(options?: __private._cocos_asset_asset_manager_task__ITaskOption);
  30369. /**
  30370. * @en
  30371. * Set parameters of this task.
  30372. *
  30373. * @zh
  30374. * 设置任务的参数。
  30375. *
  30376. * @param options @en Some optional parameters. @zh 一些可选参数。
  30377. * @param options.onComplete
  30378. * @en Callback when the task complete, if the pipeline is synchronous, onComplete is unnecessary.
  30379. * @zh 任务完成后的回调,如果流水线是同步的,onComplete 是不必要的。
  30380. * @param options.onProgress
  30381. * @en Continuously callback when the task is running, if the pipeline is synchronous, onProgress is unnecessary.
  30382. * @zh 在任务运行时持续回调,如果管道是同步的,onProgress 是不必要的。
  30383. * @param options.onError
  30384. * @en Callback when something goes wrong, if the pipeline is synchronous, onError is unnecessary.
  30385. * @zh 出错时的回调,如果流水线是同步的,onError 是不必要的。
  30386. * @param options.input @en Something will be handled with pipeline. @zh 需要被此管道处理的任务数据。
  30387. * @param options.progress @en Progress information. @zh 进度信息。
  30388. * @param options.options @en Custom parameters. @zh 自定义参数。
  30389. * @returns @en return a newly created task. @zh 返回一个新创建的任务。
  30390. *
  30391. * @example
  30392. * const task = new Task();
  30393. * task.set({input: ['test'], onComplete: (err, result) => console.log(err), onProgress: (finish, total) => console.log(finish / total)});
  30394. *
  30395. */
  30396. set(options?: __private._cocos_asset_asset_manager_task__ITaskOption): void;
  30397. /**
  30398. * @en
  30399. * Dispatch event with any parameter.
  30400. *
  30401. * @zh
  30402. * 分发事件,可以传递任意参数。
  30403. *
  30404. * @param event @en The event name. @zh 事件名称。
  30405. * @param param1 @en The parameter 1. @zh 参数 1。
  30406. * @param param2 @en The parameter 2. @zh 参数 2。
  30407. * @param param3 @en The parameter 3. @zh 参数 3。
  30408. * @param param4 @en The parameter 4. @zh 参数 4。
  30409. *
  30410. * @example
  30411. * const task = Task.create();
  30412. * task.onComplete = (msg) => console.log(msg);
  30413. * task.dispatch('complete', 'hello world');
  30414. *
  30415. */
  30416. dispatch(event: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
  30417. /**
  30418. * @en
  30419. * Recycle this task to be reused.
  30420. *
  30421. * @zh
  30422. * 回收 task 用于复用。
  30423. *
  30424. */
  30425. recycle(): void;
  30426. }
  30427. /**
  30428. * @en
  30429. * A data structure used to cache certain content.
  30430. *
  30431. * @zh
  30432. * 用于缓存某些内容的数据结构。
  30433. *
  30434. */
  30435. export class Cache<T = any> implements __private._cocos_asset_asset_manager_cache__ICache<T> {
  30436. protected _map: Record<string, T> | null;
  30437. protected _count: number;
  30438. /**
  30439. * @en
  30440. * Creates a Cache.
  30441. *
  30442. * @zh
  30443. * 创建一个 Cache。
  30444. *
  30445. * @param map @en An object used to initialize. @zh 用于初始化此缓存的对象。
  30446. *
  30447. */
  30448. constructor(map?: Record<string, T>);
  30449. /**
  30450. * @en
  30451. * Adds a Key-Value pair to cache.
  30452. *
  30453. * @zh
  30454. * 增加键值对到缓存中。
  30455. *
  30456. * @param key @en The key. @zh 要增加的键值对中的键。
  30457. * @param val @en The value. @zh 要增加的键值对中的值。
  30458. * @returns @en The value. @zh 新增的键值对中的值。
  30459. *
  30460. * @example
  30461. * var cache = new Cache();
  30462. * cache.add('test', null);
  30463. *
  30464. */
  30465. add(key: string, val: T): T;
  30466. /**
  30467. * @en
  30468. * Gets the cached content by key.
  30469. *
  30470. * @zh
  30471. * 通过 key 获取对应的 value。
  30472. *
  30473. * @param key @en The key. @zh 要查询的键。
  30474. * @returns @en The corresponding content. @zh 对应键值对中的值。
  30475. *
  30476. * @example
  30477. * let cache = new Cache();
  30478. * let test = cache.get('test');
  30479. *
  30480. */
  30481. get(key: string): T | undefined | null;
  30482. /**
  30483. * @en
  30484. * Checks whether or not content exists by key.
  30485. *
  30486. * @zh
  30487. * 通过 Key 判断是否存在对应的内容。
  30488. *
  30489. * @param key @en The key. @zh 要查询的键。
  30490. * @returns @en True indicates that content of the key exists. @zh 返回 True 则表明该值存在。
  30491. *
  30492. * @example
  30493. * var cache = new Cache();
  30494. * var exist = cache.has('test');
  30495. *
  30496. */
  30497. has(key: string): boolean;
  30498. /**
  30499. * @en
  30500. * Removes the cached content by key.
  30501. *
  30502. * @zh
  30503. * 通过 Key 移除对应的内容。
  30504. *
  30505. * @param key @en The key. @zh 要移除的键值对中的键。
  30506. * @returns @en The removed content. @zh 移出的键值对中的值。
  30507. *
  30508. * @example
  30509. * var cache = new Cache();
  30510. * var content = cache.remove('test');
  30511. *
  30512. */
  30513. remove(key: string): T | undefined | null;
  30514. /**
  30515. * @en
  30516. * Clear all content.
  30517. *
  30518. * @zh
  30519. * 清除所有内容。
  30520. *
  30521. * @example
  30522. * var cache = new Cache();
  30523. * cache.clear();
  30524. *
  30525. */
  30526. clear(): void;
  30527. /**
  30528. * @en
  30529. * Enumerates all content and invokes function.
  30530. *
  30531. * @zh
  30532. * 枚举所有内容并执行方法。
  30533. *
  30534. * @param func @en Function to be invoked. @zh 待执行的方法。
  30535. * @param func.val @en The value. @zh 传入的键值对中的值。
  30536. * @param func.key @en The corresponding key. @zh 传入的键值对中的键。
  30537. *
  30538. * @example
  30539. * var cache = new Cache();
  30540. * cache.forEach((val, key) => console.log(key));
  30541. *
  30542. */
  30543. forEach(func: (val: T, key: string) => void): void;
  30544. /**
  30545. * @en
  30546. * Enumerate all content to find one element which can fulfill condition.
  30547. *
  30548. * @zh
  30549. * 枚举所有内容,找到一个可以满足条件的元素。
  30550. *
  30551. * @param predicate @en The condition function. @zh 条件方法。
  30552. * @returns @en The first content that meets this condition. @zh 第一个符合该条件的内容。
  30553. *
  30554. * @example
  30555. * var cache = new Cache();
  30556. * var val = cache.find((val, key) => key === 'test');
  30557. *
  30558. */
  30559. find(predicate: (val: T, key: string) => boolean): T | null;
  30560. /**
  30561. * @en
  30562. * The count of cached content.
  30563. *
  30564. * @zh
  30565. * 缓存数量。
  30566. *
  30567. */
  30568. get count(): number;
  30569. /**
  30570. * @en
  30571. * Destroy this cache.
  30572. *
  30573. * @zh
  30574. * 销毁这个 cache。
  30575. *
  30576. */
  30577. destroy(): void;
  30578. }
  30579. /**
  30580. * @en
  30581. * A collection of information about a request.
  30582. *
  30583. * @zh
  30584. * 请求的相关信息集合。
  30585. *
  30586. */
  30587. export class RequestItem {
  30588. /**
  30589. * @en
  30590. * The id of request, combined from uuid and isNative.
  30591. *
  30592. * @zh
  30593. * 请求的 id, 由 uuid 和 isNative 组合而成。
  30594. */
  30595. get id(): string;
  30596. /**
  30597. * @en
  30598. * Create a new request item from pool.
  30599. *
  30600. * @zh
  30601. * 从对象池中创建 requestItem。
  30602. *
  30603. * @returns @en return a newly created RequestItem. @zh 返回一个刚创建的 `RequestItem`。
  30604. *
  30605. */
  30606. static create(): RequestItem;
  30607. /**
  30608. * @en
  30609. * The uuid of request.
  30610. *
  30611. * @zh
  30612. * 所请求资源的 uuid。
  30613. *
  30614. */
  30615. uuid: string;
  30616. /**
  30617. * @en
  30618. * The final url of request.
  30619. *
  30620. * @zh
  30621. * 请求的最终 url。
  30622. *
  30623. */
  30624. url: string;
  30625. /**
  30626. * @en
  30627. * The extension name of asset.
  30628. *
  30629. * @zh
  30630. * 资源的扩展名。
  30631. *
  30632. */
  30633. ext: string;
  30634. /**
  30635. * @en
  30636. * The content of asset.
  30637. *
  30638. * @zh
  30639. * 资源的内容。
  30640. *
  30641. */
  30642. content: any;
  30643. /**
  30644. * @en
  30645. * The file of asset.
  30646. *
  30647. * @zh
  30648. * 资源的文件。
  30649. *
  30650. */
  30651. file: any;
  30652. /**
  30653. * @en
  30654. * The information of asset.
  30655. *
  30656. * @zh
  30657. * 资源的相关信息。
  30658. *
  30659. */
  30660. info: __private._cocos_asset_asset_manager_config__IAssetInfo | null;
  30661. /**
  30662. * @en
  30663. * Whether or not it is native asset.
  30664. *
  30665. * @zh
  30666. * 资源是否是原生资源。
  30667. *
  30668. */
  30669. isNative: boolean;
  30670. /**
  30671. * @en
  30672. * Custom options.
  30673. *
  30674. * @zh
  30675. * 自定义参数。
  30676. *
  30677. */
  30678. options: Record<string, any>;
  30679. /**
  30680. * @en
  30681. * Recycle this to be reused.
  30682. *
  30683. * @zh
  30684. * 回收 requestItem 用于复用。
  30685. *
  30686. */
  30687. recycle(): void;
  30688. }
  30689. /**
  30690. * @en
  30691. * A bundle contains an amount of assets(includes scene), you can load, preload, release asset which is in this bundle.
  30692. *
  30693. * @zh
  30694. * 一个包含一定数量资源(包括场景)的包,你可以加载,预加载,释放此包内的资源。
  30695. *
  30696. */
  30697. export class Bundle {
  30698. /**
  30699. * @en
  30700. * The name of this bundle.
  30701. *
  30702. * @zh
  30703. * 此 bundle 的名称。
  30704. *
  30705. */
  30706. get name(): string;
  30707. /**
  30708. * @en
  30709. * The dependent bundles of this bundle.
  30710. *
  30711. * @zh
  30712. * 此 bundle 的依赖包。
  30713. *
  30714. */
  30715. get deps(): string[];
  30716. /**
  30717. * @en
  30718. * The root path of this bundle, such like 'http://example.com/bundle1'.
  30719. *
  30720. * @zh
  30721. * 此 bundle 的根路径, 例如 'http://example.com/bundle1'。
  30722. *
  30723. */
  30724. get base(): string;
  30725. /**
  30726. * @en
  30727. * Gets asset's info using path, only valid when asset is in bundle folder.
  30728. *
  30729. * @zh
  30730. * 使用 path 获取资源的配置信息。
  30731. *
  30732. * @param path @en The relative path of asset, such as 'images/a'. @zh 资源的相对路径,例如 `images/a`。
  30733. * @param type @en The constructor of asset, such as `Texture2D`. @zh 资源的类型,例如 [[Texture2D]]。
  30734. * @returns @en The asset info. @zh 资源的信息。
  30735. *
  30736. * @example
  30737. * const info = bundle.getInfoWithPath('image/a', Texture2D);
  30738. *
  30739. */
  30740. getInfoWithPath(path: string, type?: __private.__types_globals__Constructor<Asset> | null): __private._cocos_asset_asset_manager_config__IAddressableInfo | null;
  30741. /**
  30742. * @en
  30743. * Gets all asset's info within specific folder.
  30744. *
  30745. * @zh
  30746. * 获取在某个指定文件夹下的所有资源信息。
  30747. *
  30748. * @param path @en The relative path of folder, such as 'images'. @zh 文件夹的相对路径,例如 `images`。
  30749. * @param type
  30750. * @en The asset type, can be used to find the information of the specified type of asset in the directory.
  30751. * @zh 资源的类型,指定后可以用来查找目录下指定类型的资源信息。
  30752. * @param out @en The output array. @zh 输出数组。
  30753. * @returns @en Queried asset information. @zh 查询到的资源信息。
  30754. *
  30755. * @example
  30756. * const infos = [];
  30757. * bundle.getDirWithPath('images', Texture2D, infos);
  30758. */
  30759. getDirWithPath(path: string, type?: __private.__types_globals__Constructor<Asset> | null, out?: __private._cocos_asset_asset_manager_config__IAddressableInfo[]): __private._cocos_asset_asset_manager_config__IAddressableInfo[];
  30760. /**
  30761. * @en
  30762. * Get asset's information with uuid.
  30763. *
  30764. * @zh
  30765. * 通过 uuid 获取资源信息。
  30766. *
  30767. * @param uuid @en The asset's uuid. @zh 资源的 uuid。
  30768. * @returns @en The information of asset. @zh 资源的信息。
  30769. *
  30770. * @example
  30771. * const info = bundle.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  30772. *
  30773. */
  30774. getAssetInfo(uuid: string): __private._cocos_asset_asset_manager_config__IAssetInfo | null;
  30775. /**
  30776. * @en
  30777. * Gets scene's information with name.
  30778. *
  30779. * @zh
  30780. * 通过场景名获取场景信息。
  30781. *
  30782. * @param name @en The name of scene. @zh 场景名称。
  30783. * @returns @en The information of scene. @zh 场景信息。
  30784. *
  30785. * @example
  30786. * const info = bundle.getSceneInfo('first.fire');
  30787. *
  30788. */
  30789. getSceneInfo(name: string): __private._cocos_asset_asset_manager_config__ISceneInfo | null;
  30790. /**
  30791. * @en
  30792. * Initializes this bundle with options.
  30793. *
  30794. * @zh
  30795. * 初始化此 bundle。
  30796. *
  30797. * @param options
  30798. * @deprecate Since v3.7, this is an internal engine interface and you should not call this interface under any circumstances.
  30799. *
  30800. */
  30801. init(options: __private._cocos_asset_asset_manager_config__IConfigOption): void;
  30802. /**
  30803. * @en
  30804. * Loads the asset within this bundle by the path which is relative to bundle's path.
  30805. *
  30806. * @zh
  30807. * 通过相对路径加载分包中的资源。路径是相对分包文件夹路径的相对路径。
  30808. *
  30809. * @param paths
  30810. * @en Paths of the target assets.These paths are relative to the bundle's folder, extension name must be omitted.
  30811. * @zh 需要加载的资源的路径。此路径为工程中相对于 bundle 文件夹的相对路径,路径中请不要带扩展名。
  30812. * @param type
  30813. * @en Asset type, if this parameter is passed, the asset of the corresponding type will be found in the assets of the corresponding path to finish loading.
  30814. * @zh 资源类型,如果传入此参数,则会在对应路径的资源中找到对应类型的资源完成加载。
  30815. * @param onProgress
  30816. * @en Callback invoked when the loading progress change.
  30817. * @zh 加载进度发生变化时执行的回调。
  30818. * @param onProgress.finish
  30819. * @en The number of request items that have been loaded.
  30820. * @zh 已经完成加载的资源数量。
  30821. * @param onProgress.total
  30822. * @en The number of all request items to be loaded.
  30823. * @zh 所有待加载的资源数量。
  30824. * @param onProgress.item @en The finished request item. @zh 当前完成的加载项。
  30825. * @param onComplete @en Callback invoked when all assets loaded. @zh 所有资源加载完成后的回调。
  30826. * @param onComplete.error @en Error message during loading, or null if loaded successfully. @zh 加载过程中的错误信息,如果加载成功则为 null。
  30827. * @param onComplete.assets @en The loaded asset, or null if an error occurred during loading. @zh 已加载的资源,如果加载过程中有错误发生,则为 null。
  30828. *
  30829. * @example
  30830. * // load the texture (${project}/assets/resources/textures/background.jpg) from resources
  30831. * resources.load('textures/background', Texture2D, (err, texture) => console.log(err));
  30832. *
  30833. * // load the audio (${project}/assets/resources/music/hit.mp3) from resources
  30834. * resources.load('music/hit', AudioClip, (err, audio) => console.log(err));
  30835. *
  30836. * // load the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  30837. * bundle1.load('misc/character/cocos', Prefab, (err, prefab) => console.log(err));
  30838. *
  30839. * // load the sprite frame (${project}/assets/some/xxx/bundle2/imgs/cocos.png) from bundle2 folder
  30840. * bundle2.load('imgs/cocos', SpriteFrame, null, (err, spriteFrame) => console.log(err));
  30841. *
  30842. */
  30843. load<T extends Asset>(paths: string, type: __private.__types_globals__Constructor<T> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T) => void) | null): void;
  30844. load<T extends Asset>(paths: string[], type: __private.__types_globals__Constructor<T> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T[]) => void) | null): void;
  30845. load<T extends Asset>(paths: string, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T) => void) | null): void;
  30846. load<T extends Asset>(paths: string[], onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T[]) => void) | null): void;
  30847. load<T extends Asset>(paths: string, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  30848. load<T extends Asset>(paths: string[], onComplete?: ((err: Error | null, data: T[]) => void) | null): void;
  30849. load<T extends Asset>(paths: string, type: __private.__types_globals__Constructor<T> | null, onComplete?: ((err: Error | null, data: T) => void) | null): void;
  30850. load<T extends Asset>(paths: string[], type: __private.__types_globals__Constructor<T> | null, onComplete?: ((err: Error | null, data: T[]) => void) | null): void;
  30851. /**
  30852. * @en
  30853. * Preloads the asset within this bundle by the path which is relative to bundle's path.
  30854. * After calling this method, you still need to finish loading by calling [[Bundle.load]].
  30855. * It will be totally fine to call [[Bundle.load]] at any time even if the preloading is not
  30856. * yet finished.
  30857. *
  30858. * @zh
  30859. * 通过相对路径预加载分包中的资源。路径是相对分包文件夹路径的相对路径。调用完后,你仍然需要通过 [[Bundle.load]] 来完成加载。
  30860. * 就算预加载还没完成,你也可以直接调用 [[Bundle.load]]。
  30861. *
  30862. * @param paths
  30863. * @en Paths of the target assets.These paths are relative to the bundle's folder, extension name must be omitted.
  30864. * @zh 需要加载的资源的路径。此路径为工程中相对于 bundle 文件夹的相对路径,路径中请不要带扩展名。
  30865. * @param type
  30866. * @en Asset type, if this parameter is passed, the asset of the corresponding type will be found in the assets of the corresponding path to finish preloading.
  30867. * @zh 资源类型,如果传入此参数,则会在对应路径的资源中找到对应类型的资源完成预加载。
  30868. * @param onProgress
  30869. * @en Callback invoked when the preloading progress change.
  30870. * @zh 预加载进度发生变化时执行的回调。
  30871. * @param onProgress.finish
  30872. * @en The number of request items that have been preloaded.
  30873. * @zh 已经完成预加载的资源数量。
  30874. * @param onProgress.total
  30875. * @en The number of all request items to be preloaded.
  30876. * @zh 所有待预加载的资源数量。
  30877. * @param onProgress.item @en The finished request item. @zh 当前完成的预加载项。
  30878. * @param onComplete @en Callback invoked when all assets preloaded. @zh 所有资源预加载完成后的回调。
  30879. * @param onComplete.error @en Error message during preloading, or null if preloaded successfully. @zh 预加载过程中的错误信息,如果预加载成功则为 null。
  30880. * @param onComplete.items @en The preloaded items. @zh 预加载项。
  30881. *
  30882. * @example
  30883. * // preload the texture (${project}/assets/resources/textures/background.jpg) from resources
  30884. * resources.preload('textures/background', Texture2D);
  30885. *
  30886. * // preload the audio (${project}/assets/resources/music/hit.mp3) from resources
  30887. * resources.preload('music/hit', AudioClip);
  30888. * // wait for while
  30889. * resources.load('music/hit', AudioClip, (err, audioClip) => {});
  30890. *
  30891. * * // preload the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  30892. * bundle1.preload('misc/character/cocos', Prefab);
  30893. *
  30894. * // load the sprite frame of (${project}/assets/bundle2/imgs/cocos.png) from bundle2 folder
  30895. * bundle2.preload('imgs/cocos', SpriteFrame);
  30896. * // wait for while
  30897. * bundle2.load('imgs/cocos', SpriteFrame, (err, spriteFrame) => {});
  30898. *
  30899. */
  30900. preload(paths: string | string[], type: __private.__types_globals__Constructor<Asset> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30901. preload(paths: string | string[], onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30902. preload(paths: string | string[], onComplete?: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30903. preload(paths: string | string[], type: __private.__types_globals__Constructor<Asset> | null, onComplete?: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30904. /**
  30905. * @en
  30906. * Loads all assets under a folder inside the bundle folder.<br>
  30907. * <br>
  30908. * Note: All asset paths in Creator use forward slashes, paths using backslashes will not work.
  30909. *
  30910. * @zh
  30911. * 加载目标文件夹中的所有资源, 注意:路径中只能使用斜杠,反斜杠将停止工作。
  30912. *
  30913. * @param dir @en The path of the target folder. The path is relative to the bundle folder. @zh 目标文件夹路径,此路径为相对于 bundle 文件夹的路径。
  30914. * @param type @en The asset type. Only specify type asset will be loaded if this argument is supplied. @zh 资源类型,如果指定了此参数,则只会加载目标文件夹下此类型的资源。
  30915. * @param onProgress
  30916. * @en Callback invoked when the loading progress change.
  30917. * @zh 加载进度发生变化时执行的回调。
  30918. * @param onProgress.finish
  30919. * @en The number of request items that have been loaded.
  30920. * @zh 已经完成加载的资源数量。
  30921. * @param onProgress.total
  30922. * @en The number of all request items to be loaded.
  30923. * @zh 所有待加载的资源数量。
  30924. * @param onProgress.item @en The finished request item. @zh 当前完成的加载项。
  30925. * @param onComplete @en Callback invoked when all assets loaded. @zh 所有资源加载完成后的回调。
  30926. * @param onComplete.error @en Error message during loading, or null if loaded successfully. @zh 加载过程中的错误信息,如果加载成功则为 null。
  30927. * @param onComplete.assets @en An array of all loaded assets. @zh 完成加载的资源数组。
  30928. *
  30929. * @example
  30930. * // load all audios (resources/audios/)
  30931. * resources.loadDir('audios', AudioClip, (err, audios) => {});
  30932. *
  30933. * // load all textures in "resources/imgs/"
  30934. * resources.loadDir('imgs', Texture2D, null, function (err, textures) {
  30935. * var texture1 = textures[0];
  30936. * var texture2 = textures[1];
  30937. * });
  30938. *
  30939. * // load all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  30940. * bundle1.loadDir('misc/characters', Prefab, (err, prefabs) => console.log(err));
  30941. *
  30942. * // load all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  30943. * bundle2.loadDir('skills', SpriteFrame, null, (err, spriteFrames) => console.log(err));
  30944. *
  30945. */
  30946. loadDir<T extends Asset>(dir: string, type: __private.__types_globals__Constructor<T> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T[]) => void) | null): void;
  30947. loadDir<T extends Asset>(dir: string, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T[]) => void) | null): void;
  30948. loadDir<T extends Asset>(dir: string, onComplete?: ((err: Error | null, data: T[]) => void) | null): void;
  30949. loadDir<T extends Asset>(dir: string, type: __private.__types_globals__Constructor<T> | null, onComplete?: ((err: Error | null, data: T[]) => void) | null): void;
  30950. /**
  30951. * @en
  30952. * Preloads all assets under a folder inside the bundle folder.<br> After calling this method, you still need to
  30953. * finish loading by calling [[Bundle.loadDir]].
  30954. * It will be totally fine to call [[Bundle.loadDir]] at any time even if the preloading is not yet finished.
  30955. *
  30956. * @zh
  30957. * 预加载目标文件夹中的所有资源。调用完后,你仍然需要通过 [[Bundle.loadDir]] 来完成加载。
  30958. * 就算预加载还没完成,你也可以直接调用 [[Bundle.loadDir]]。
  30959. *
  30960. * @param dir @en The path of the target folder. The path is relative to the bundle folder. @zh 目标文件夹路径,此路径为相对于 bundle 文件夹的路径。
  30961. * @param type @en The asset type. Only specify type asset will be preloaded if this argument is supplied. @zh 资源类型,如果指定了此参数,则只会预加载目标文件夹下此类型的资源。
  30962. * @param onProgress
  30963. * @en Callback invoked when the preloading progress change.
  30964. * @zh 预加载进度发生变化时执行的回调。
  30965. * @param onProgress.finish
  30966. * @en The number of request items that have been preloaded.
  30967. * @zh 已经完成预加载的资源数量。
  30968. * @param onProgress.total
  30969. * @en The number of all request items to be preloaded.
  30970. * @zh 所有待预加载的资源数量。
  30971. * @param onProgress.item @en The finished request item. @zh 当前完成的预加载项。
  30972. * @param onComplete @en Callback invoked when all assets preloaded. @zh 所有资源预加载完成后的回调。
  30973. * @param onComplete.error @en Error message during preloading, or null if preloaded successfully. @zh 预加载过程中的错误信息,如果预加载成功则为 null。
  30974. * @param onComplete.items @en The preloaded items. @zh 预加载项。
  30975. *
  30976. * @example
  30977. * // preload all audios (resources/audios/)
  30978. * resources.preloadDir('audios', AudioClip);
  30979. *
  30980. * // preload all textures in "resources/imgs/"
  30981. * resources.preloadDir('imgs', Texture2D);
  30982. * // wait for while
  30983. * resources.loadDir('imgs', Texture2D, (err, textures) => {});
  30984. *
  30985. * // preload all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  30986. * bundle1.preloadDir('misc/characters', Prefab);
  30987. *
  30988. * // preload all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  30989. * bundle2.preloadDir('skills', SpriteFrame);
  30990. * // wait for while
  30991. * bundle2.loadDir('skills', SpriteFrame, (err, spriteFrames) => {});
  30992. */
  30993. preloadDir(dir: string, type: __private.__types_globals__Constructor<Asset> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30994. preloadDir(dir: string, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30995. preloadDir(dir: string, onComplete?: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30996. preloadDir(dir: string, type: __private.__types_globals__Constructor<Asset> | null, onComplete?: ((err: Error | null, data: RequestItem[]) => void) | null): void;
  30997. /**
  30998. * @en
  30999. * Loads the scene asset within this bundle by its name.
  31000. *
  31001. * @zh
  31002. * 通过场景名称加载分包中的场景资源。
  31003. *
  31004. * @param sceneName @en The name of the scene to be loaded. @zh 待加载的场景名称。
  31005. * @param options @en Some optional parameters. @zh 可选参数。
  31006. * @param onProgress
  31007. * @en Callback invoked when the loading progress change.
  31008. * @zh 加载进度发生变化时执行的回调。
  31009. * @param onProgress.finish
  31010. * @en The number of request items that have been loaded.
  31011. * @zh 已经完成加载的资源数量。
  31012. * @param onProgress.total
  31013. * @en The number of all request items to be loaded.
  31014. * @zh 所有待加载的资源数量。
  31015. * @param onProgress.item @en The finished request item. @zh 当前完成的加载项。
  31016. * @param onComplete @en Callback invoked when the scene loaded. @zh 场景加载完成后的回调。
  31017. * @param onComplete.error @en Error message during loading, or null if loaded successfully. @zh 加载过程中的错误信息,如果加载成功则为 null。
  31018. * @param onComplete.sceneAsset @en The scene asset. @zh 加载完成的场景资源。
  31019. *
  31020. * @example
  31021. * bundle1.loadScene('first', (err, sceneAsset) => director.runScene(sceneAsset));
  31022. *
  31023. */
  31024. loadScene(sceneName: string, options: {
  31025. [key: string]: any;
  31026. preset?: "string";
  31027. } | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: SceneAsset) => void) | null): void;
  31028. loadScene(sceneName: string, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: SceneAsset) => void) | null): void;
  31029. loadScene(sceneName: string, options: {
  31030. [key: string]: any;
  31031. preset?: "string";
  31032. } | null, onComplete?: ((err: Error | null, data: SceneAsset) => void) | null): void;
  31033. loadScene(sceneName: string, onComplete?: ((err: Error | null, data: SceneAsset) => void) | null): void;
  31034. /**
  31035. * @en
  31036. * Preload the scene asset within this bundle by its name. After calling this method, you still need to finish loading
  31037. * by calling [[Bundle.loadScene]] or [[Director.loadScene]].It will be totally fine to call [[Bundle.loadScene]] at any
  31038. * time even if the preloading is not yet finished.
  31039. *
  31040. * @zh
  31041. * 通过场景名称预加载分包中的场景资源.调用完后,你仍然需要通过 [[Bundle.loadScene]] 或 [[Director.loadScene]] 来完成加载。
  31042. * 就算预加载还没完成,你也可以直接调用 [[Bundle.loadScene]] 或 [[Director.loadScene]]。
  31043. *
  31044. * @param sceneName @en The name of the scene to be preloaded. @zh 待预加载的场景名称。
  31045. * @param options @en Some optional parameters. @zh 可选参数。
  31046. * @param onProgress
  31047. * @en Callback invoked when the preloading progress change.
  31048. * @zh 预加载进度发生变化时执行的回调。
  31049. * @param onProgress.finish
  31050. * @en The number of request items that have been preloaded.
  31051. * @zh 已经完成预加载的资源数量。
  31052. * @param onProgress.total
  31053. * @en The number of all request items to be preloaded.
  31054. * @zh 所有待预加载的资源数量。
  31055. * @param onProgress.item @en The finished request item. @zh 当前完成的预加载项。
  31056. * @param onComplete @en Callback invoked when the scene preloaded. @zh 场景预加载完成后的回调。
  31057. * @param onComplete.error @en Error message during preloading, or null if preloaded successfully. @zh 预加载过程中的错误信息,如果预加载成功则为 null。
  31058. *
  31059. * @example
  31060. * bundle1.preloadScene('first');
  31061. * // wait for a while
  31062. * bundle1.loadScene('first', (err, scene) => director.runScene(scene));
  31063. *
  31064. */
  31065. preloadScene(sceneName: string, options: {
  31066. [key: string]: any;
  31067. preset?: "string";
  31068. } | null, onProgress: ((finished: number, total: number, item: RequestItem) => void), onComplete: ((err?: Error | null) => void) | null): void;
  31069. preloadScene(sceneName: string, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err?: Error | null) => void) | null): void;
  31070. preloadScene(sceneName: string, options: {
  31071. [key: string]: any;
  31072. preset?: "string";
  31073. } | null, onComplete?: ((err?: Error | null) => void) | null): void;
  31074. preloadScene(sceneName: string, onComplete?: ((err?: Error | null) => void) | null): void;
  31075. /**
  31076. * @en
  31077. * Gets cached asset within this bundle by path and type. <br>
  31078. * After you load asset with [[load]] or [[loadDir]],
  31079. * you can acquire them by passing the path to this API.
  31080. *
  31081. * NOTE:When there are multiple asset with the same name, you can get the specific asset by specifying the type.
  31082. * Otherwise the first asset matching that name will be returned.
  31083. *
  31084. * @zh
  31085. * 通过路径与类型获取已缓存资源。在你使用 [[load]] 或者 [[loadDir]] 之后,
  31086. * 你能通过传路径通过这个 API 获取到这些资源。
  31087. *
  31088. * 注意:当有多个同名的资产时,你可以通过指定类型来获得具体的资产。
  31089. * 否则将返回与该名称相匹配的第一个资产。
  31090. *
  31091. * @param path @en The path of asset. @zh 资源的路径。
  31092. * @param type @en The asset type. Only specify type asset will be returned if this argument is supplied. @zh 资源类型,指定后只会返回该类型的资源。
  31093. * @returns @en The asset has been cached. @zh 已缓存的资源。
  31094. *
  31095. * @example
  31096. * bundle1.get('music/hit', AudioClip);
  31097. */
  31098. get<T extends Asset>(path: string, type?: __private.__types_globals__Constructor<T> | null): T | null;
  31099. /**
  31100. * @en
  31101. * Releases the asset loaded by [[load]] or [[loadDir]].
  31102. * and it's dependencies. Refer to [[AssetManager.releaseAsset]] for detailed information.
  31103. *
  31104. * NOTE:When there are multiple asset with the same name, you can specify the asset to be released by specifying the type.
  31105. * Otherwise the first resource matching that name will be released.
  31106. *
  31107. * @zh
  31108. * 释放通过 [[load]] 或者 [[loadDir]] 加载的资源。
  31109. * 详细信息请参考 [[AssetManager.releaseAsset]]。
  31110. *
  31111. * 注意:当存在多个资源同名时,可以通过指定类型来指定要释放的资源,否则将释放第一个匹配该名称的资源。
  31112. *
  31113. * @param path @en The path of asset. @zh 资源的路径。
  31114. * @param type @en The type of asset. @zh 资源的类型。
  31115. *
  31116. * @example
  31117. * // release a texture which is no longer need
  31118. * bundle1.release('misc/character/cocos');
  31119. *
  31120. */
  31121. release(path: string, type?: __private.__types_globals__Constructor<Asset> | null): void;
  31122. /**
  31123. * @en
  31124. * Release all assets within this bundle. Refer to [[AssetManager.releaseAll]] for detailed information.
  31125. *
  31126. * @zh
  31127. * 释放此包中的所有资源。详细信息请参考 [[AssetManager.releaseAll]]。
  31128. *
  31129. * @example
  31130. * // release all asset within bundle1
  31131. * bundle1.releaseAll();
  31132. */
  31133. releaseAll(): void;
  31134. /**
  31135. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  31136. */
  31137. _destroy(): void;
  31138. }
  31139. /**
  31140. * @en
  31141. * The builtin bundles
  31142. *
  31143. * @zh
  31144. * 内置 bundle
  31145. *
  31146. */
  31147. export enum BuiltinBundleName {
  31148. /**
  31149. * @en
  31150. * The builtin bundle of default asset
  31151. *
  31152. * @zh
  31153. * 内置 bundle, 对应默认资源
  31154. */
  31155. INTERNAL = "internal",
  31156. /**
  31157. * @en
  31158. * The builtin bundle corresponds to 'assets/resources'.
  31159. *
  31160. * @zh
  31161. * 内置 bundle, 对应 'assets/resources' 目录
  31162. *
  31163. */
  31164. RESOURCES = "resources",
  31165. /**
  31166. * @en
  31167. * The builtin bundle
  31168. *
  31169. * @zh
  31170. * 内置 bundle
  31171. *
  31172. */
  31173. MAIN = "main",
  31174. /**
  31175. * @en
  31176. * The builtin bundle, exists when Start Scene asset bundle is checked on the project building panel
  31177. *
  31178. * @zh
  31179. * 内置 bundle, 如果构建面板开启了首场景分包,则会有 START_SCENE bundle
  31180. *
  31181. */
  31182. START_SCENE = "start-scene"
  31183. }
  31184. /**
  31185. * @en
  31186. * Cache manager is a module which controls all caches downloaded from server in non-web platform, it is a singleton
  31187. * You can access it via [[AssetManager.cacheManager]].
  31188. *
  31189. * @zh
  31190. * 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存,这是一个单例,你能通过 [[AssetManager.cacheManager]] 访问它。
  31191. *
  31192. */
  31193. export abstract class CacheManager {
  31194. /**
  31195. * @en
  31196. * The name of cache directory.
  31197. *
  31198. * @zh
  31199. * 缓存目录的名称。
  31200. */
  31201. abstract cacheDir: string;
  31202. /**
  31203. * @en
  31204. * Whether to cache file into user's storage space, this property only works on mini-game platforms.
  31205. *
  31206. * @zh
  31207. * 是否缓存文件到用户存储空间,此属性只在小游戏平台有效。
  31208. *
  31209. */
  31210. abstract cacheEnabled: boolean;
  31211. /**
  31212. * @en
  31213. * Whether to clear cache automatically when storage ran out, this property only works on mini-game platforms.
  31214. *
  31215. * @zh
  31216. * 是否在存储空间满了后自动清理缓存,此属性只在小游戏平台有效。
  31217. *
  31218. */
  31219. abstract autoClear: boolean;
  31220. /**
  31221. * @en
  31222. * The interval between caching file, this property only works on mini-game platforms, unit: ms.
  31223. *
  31224. * @zh
  31225. * 缓存文件的间隔时间,此属性只在小游戏平台有效,单位:毫秒。
  31226. *
  31227. */
  31228. abstract cacheInterval: number;
  31229. /**
  31230. * @en
  31231. * The interval between deleting file, when you use `cleanLRU`, the file will be deleted as this interval, unit: ms.
  31232. *
  31233. * @zh
  31234. * 清理资源的间隔时间,当你使用 `cleanLRU` 时,资源将以此间隔被删除,单位:毫秒。
  31235. *
  31236. */
  31237. abstract deleteInterval: number;
  31238. /**
  31239. * @en
  31240. * List of all cached files.
  31241. *
  31242. * @zh
  31243. * 所有缓存文件列表。
  31244. *
  31245. */
  31246. abstract cachedFiles: Cache<{
  31247. bundle: string;
  31248. url: string;
  31249. lastTime: number;
  31250. }>;
  31251. /**
  31252. * @en
  31253. * Gets cached path with origin url.
  31254. *
  31255. * @zh
  31256. * 通过原始 url 获取缓存后的路径。
  31257. *
  31258. * @param originUrl @en The origin url of file. @zh 文件的原始 url。
  31259. * @returns @en The path where the file is cached. @zh 该文件所缓存的路径。
  31260. */
  31261. abstract getCache(originUrl: string): string;
  31262. /**
  31263. * @en
  31264. * Gets temporary path with origin url, this method only works on mini-game platforms.
  31265. *
  31266. * @zh
  31267. * 通过原始 url 获取临时文件的路径,此方法只在小游戏平台有效。
  31268. *
  31269. * @param originUrl @en The origin url of file. @zh 文件的原始 url。
  31270. * @returns @en The temporary path where the file is stored. @zh 该文件所存储的临时路径。
  31271. */
  31272. abstract getTemp(originUrl: string): string;
  31273. /**
  31274. * @en
  31275. * Clear all caches, please use with caution, If necessary, we recommend using it before the game is launched.
  31276. *
  31277. * @zh
  31278. * 清空所有缓存,请谨慎使用,如果必要的话,我们建议在游戏启动之前使用。
  31279. *
  31280. */
  31281. abstract clearCache(): void;
  31282. /**
  31283. * @en
  31284. * Clear part of caches with LRU strategy.
  31285. *
  31286. * @zh
  31287. * 使用 LRU 策略清空部分缓存。
  31288. *
  31289. */
  31290. abstract clearLRU(): void;
  31291. /**
  31292. * @en
  31293. * Removes cache with origin url.
  31294. *
  31295. * @zh
  31296. * 通过原始 url 移除缓存。
  31297. *
  31298. * @param originUrl @en The origin url to remove from cache. @zh 要从缓存中移除的原始 url。
  31299. */
  31300. abstract removeCache(originUrl: string): void;
  31301. }
  31302. /**
  31303. * @en
  31304. * Manages asset's dependency list, it is a singleton. You can access it via [[AssetManager.dependUtil]].
  31305. *
  31306. * @zh
  31307. * 管理资源的依赖列表,这是一个单例, 你能通过 [[AssetManager.dependUtil]] 访问它。
  31308. *
  31309. */
  31310. export class DependUtil {
  31311. /**
  31312. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  31313. */
  31314. _depends: Cache<__private._cocos_asset_asset_manager_depend_util__IDependencies>;
  31315. /**
  31316. * @en Global singleton for [[DependUtil]]. You can access it via [[AssetManager.dependUtil]].
  31317. * @zh [[DependUtil]] 的全局单例. 你可以通过 [[AssetManager.dependUtil]] 访问.
  31318. */
  31319. static get instance(): DependUtil;
  31320. /**
  31321. * @en
  31322. * Gets asset's native dependency. For example, ImageAsset's native dependency is image.
  31323. * Note: You will need to have loaded this resource to query this information.
  31324. *
  31325. * @zh
  31326. * 获取资源的原生依赖,例如 ImageAsset 的原生依赖是图片。
  31327. * 注意:你需要加载过该资源,才能查询此信息。
  31328. *
  31329. * @param uuid @en asset's uuid. @zh 资源的 uuid。
  31330. * @returns @en The native dependency information of this asset. @zh 资源的原生依赖的信息。
  31331. *
  31332. * @example
  31333. * var dep = dependUtil.getNativeDep('fcmR3XADNLgJ1ByKhqcC5Z');
  31334. * @deprecated Since v3.7, this is an engine internal interface.
  31335. * If you want to know the native dependency of the asset, use [[Asset.nativeUrl]] instead.
  31336. */
  31337. getNativeDep(uuid: string): Record<string, any> | null;
  31338. /**
  31339. * @en
  31340. * Gets asset's direct referencing dependency list. For example, Material's dependencies are Texture, effect asset etc.
  31341. * Note: You will need to have loaded this resource to query this information.
  31342. *
  31343. * @zh
  31344. * 获取资源直接引用的依赖列表,例如,材质的直接依赖资源是 Texture, Effect 等。
  31345. * 注意:你需要加载过该资源,才能查询此信息。
  31346. *
  31347. * @param uuid @en asset's uuid. @zh 资源的 uuid。
  31348. * @returns @en The direct referencing dependency asset list. @zh 直接引用的依赖资源列表。
  31349. *
  31350. * @example
  31351. * var deps = dependUtil.getDeps('fcmR3XADNLgJ1ByKhqcC5Z');
  31352. *
  31353. */
  31354. getDeps(uuid: string): string[];
  31355. /**
  31356. * @en
  31357. * Gets dependency list of the loaded asset, include indirect reference.
  31358. * Note: You will need to have loaded this resource to query this information.
  31359. *
  31360. * @zh
  31361. * 获取某个已经加载好的资源的所有依赖资源列表,包括间接引用的资源,并保存在数组中返回。
  31362. * 注意:你需要加载过该资源,才能查询此信息。
  31363. *
  31364. * @param uuid @en asset's uuid. @zh 资源的 uuid。
  31365. * @returns
  31366. * @en The all dependency list including direct reference and indirect reference.
  31367. * @zh 所有依赖列表,包括直接引用的与间接引用的。
  31368. *
  31369. * @example
  31370. * var deps = dependUtil.getDepsRecursively('fcmR3XADNLgJ1ByKhqcC5Z');
  31371. *
  31372. */
  31373. getDepsRecursively(uuid: string): string[];
  31374. }
  31375. /**
  31376. * @en
  31377. * Manages all download process, it is a singleton.
  31378. * You can access it via [[AssetManager.downloader]], It can download various types of files.
  31379. *
  31380. * @zh
  31381. * 管理所有下载过程,downloader 是个单例,你能通过 [[AssetManager.downloader]] 访问它,它能下载各种类型的文件。
  31382. *
  31383. */
  31384. export class Downloader {
  31385. /**
  31386. * @en Global singleton for [[Downloader]]. You can access it via [[AssetManager.downloader]].
  31387. * @zh [[Downloader]] 的全局单例. 你可以通过 [[AssetManager.downloader]] 访问.
  31388. */
  31389. static get instance(): Downloader;
  31390. /**
  31391. * @en
  31392. * The maximum number of concurrent when downloading.
  31393. *
  31394. * @zh
  31395. * 下载时的最大并发数。
  31396. */
  31397. maxConcurrency: number;
  31398. /**
  31399. * @en
  31400. * The maximum number of request can be launched per frame when downloading.
  31401. *
  31402. * @zh
  31403. * 下载时每帧可以启动的最大请求数。
  31404. *
  31405. */
  31406. maxRequestsPerFrame: number;
  31407. /**
  31408. * @en
  31409. * The address of remote server.
  31410. *
  31411. * @zh
  31412. * 远程服务器地址。
  31413. *
  31414. */
  31415. get remoteServerAddress(): string;
  31416. /**
  31417. * @en
  31418. * The max number of retries when fail.
  31419. *
  31420. * @zh
  31421. * 失败重试次数。
  31422. *
  31423. */
  31424. maxRetryCount: number;
  31425. /**
  31426. * Whether to automatically add a timestamp after the url.
  31427. * This function is mainly used to prevent the browser from using cache in editor mode.
  31428. * You don't need to change it at runtime.
  31429. * @internal
  31430. */
  31431. appendTimeStamp: boolean;
  31432. /**
  31433. * @en
  31434. * Wait for while before another retry, unit: ms.
  31435. *
  31436. * @zh
  31437. * 重试的间隔时间,单位为毫秒。
  31438. *
  31439. */
  31440. retryInterval: number;
  31441. /**
  31442. * @en Version information of all bundles.
  31443. * @zh 所有包的版本信息。
  31444. */
  31445. bundleVers: Record<string, string>;
  31446. /**
  31447. * @en The names of remote bundles.
  31448. * @zh 远程包名列表。
  31449. */
  31450. remoteBundles: ReadonlyArray<string>;
  31451. /**
  31452. * @deprecated Since v3.7, this is an engine internal interface. You can easily implement the functionality of this API using HTMLImageElement.
  31453. */
  31454. downloadDomImage: typeof __private._cocos_asset_asset_manager_download_dom_image__default;
  31455. /**
  31456. * @deprecated Since v3.7, this is an engine internal interface. You can easily implement the functionality of this API using HTMLAudioElement.
  31457. */
  31458. downloadDomAudio: __private._cocos_asset_asset_manager_downloader__DownloadHandler | null;
  31459. /**
  31460. * @deprecated Since v3.7, this is an engine internal interface. You can easily implement the functionality of this API using XMLHttpRequest.
  31461. */
  31462. downloadFile: typeof __private._cocos_asset_asset_manager_download_file__default;
  31463. /**
  31464. * @deprecated Since v3.7, this is an engine internal interface. You can easily implement the functionality of this API using XMLHttpRequest.
  31465. */
  31466. downloadScript: typeof __private._cocos_asset_asset_manager_download_script__default;
  31467. /**
  31468. * @en
  31469. * Register custom handler if you want to change default behavior or extend downloader to download other format file.
  31470. *
  31471. * @zh
  31472. * 当你想修改默认行为或者拓展 downloader 来下载其他格式文件时可以注册自定义的 handler。
  31473. *
  31474. * @param type
  31475. * @en Extension name likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}.
  31476. * @zh 扩展名,或者形如 {'.jpg': jpgHandler, '.png': pngHandler} 的映射表。
  31477. * @param handler @en Customized handling for this extension. @zh 针对此扩展名的自定义的处理方法。
  31478. * @param handler.url @en The url to be downloaded. @zh 待下载的 url.
  31479. * @param handler.options @en Some optional parameters will be transferred to handler. @zh 传递到处理方法的可选参数。
  31480. * @param handler.onComplete
  31481. * @en Callback when finishing downloading. You need to call this method manually and pass in the execution result after the custom handler
  31482. * is executed.
  31483. * @zh 完成下载后的回调。你需要在自定义处理方法执行完后手动调用此方法,并将执行结果传入。
  31484. *
  31485. * @example
  31486. * downloader.register('.tga', (url, options, onComplete) => onComplete(null, null));
  31487. * downloader.register({'.tga': (url, options, onComplete) => onComplete(null, null),
  31488. * '.ext': (url, options, onComplete) => onComplete(null, null)});
  31489. *
  31490. */
  31491. register(type: string, handler: (url: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)) => void): void;
  31492. register(map: Record<string, (url: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)) => void>): void;
  31493. /**
  31494. * @en
  31495. * Use corresponding handler to download file under limitation.
  31496. *
  31497. * @zh
  31498. * 在限制下使用对应的 handler 来下载文件。
  31499. *
  31500. * @param id @en The unique id of this download. @zh 本次下载的唯一 id.
  31501. * @param url @en The url should be downloaded. @zh 待下载的 url。
  31502. * @param type @en The type indicates that which handler should be used to download, such as '.jpg'. @zh 要使用的处理方法的类型,例如 '.jpg'。
  31503. * @param options @en Some optional parameters will be transferred to the corresponding handler. @zh 传递到处理方法的一些可选参数。
  31504. * @param options.onFileProgress @en Progressive callback will be transferred to handler. @zh 传递到处理方法的进度回调。
  31505. * @param options.maxRetryCount @en How many times should retry when download failed. @zh 下载失败后的重试数量。
  31506. * @param options.maxConcurrency @en The maximum number of concurrent when downloading. @zh 下载的最大并行数。
  31507. * @param options.maxRequestsPerFrame @en The maximum number of request can be launched per frame when downloading. @zh 每帧能发起的最大请求数量,在下载时。
  31508. * @param options.priority @en The priority of this url, default is 0, the greater number is higher priority. @zh 下载的优先级,值越大优先级越高。
  31509. * @param onComplete @en Callback when finishing downloading. @zh 完成下载后的回调。
  31510. * @param onComplete.err @en The occurred error, null indicates success. @zh 下载过程中出现的错误,如果为 null 则表明下载成功。
  31511. * @param onComplete.content @en The downloaded file. @zh 下载下来的文件内容。
  31512. *
  31513. * @example
  31514. * download('http://example.com/test.tga', '.tga', { onFileProgress: (loaded, total) => console.log(loaded/total) },
  31515. * onComplete: (err) => console.log(err));
  31516. */
  31517. download(id: string, url: string, type: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)): void;
  31518. /**
  31519. * @en Load sub package with name.
  31520. * @zh 通过子包名加载子包。
  31521. * @param name @en Sub package name. @zh 子包名称。
  31522. * @param completeCallback @en Callback invoked when sub package loaded. @zh 子包加载完成后的回调。
  31523. * @param completeCallback.error @en Error information. Will be null if loaded successfully. @zh 错误信息。如果加载成功则为 null。
  31524. *
  31525. * @deprecated loader.downloader.loadSubpackage is deprecated, please use AssetManager.loadBundle instead.
  31526. */
  31527. loadSubpackage(name: string, completeCallback?: ((err?: Error | null) => void)): void;
  31528. }
  31529. /**
  31530. * @en
  31531. * Parse the downloaded file, it's a singleton, you can access it via [[AssetManager.parser]].
  31532. *
  31533. * @zh
  31534. * 解析已下载的文件,parser 是一个单例, 你能通过 [[assetManager.parser]] 访问它。
  31535. *
  31536. */
  31537. export class Parser {
  31538. static get instance(): Parser;
  31539. /**
  31540. * @en
  31541. * Register custom handler if you want to change default behavior or extend parser to parse other format file.
  31542. *
  31543. * @zh
  31544. * 当你想修改默认行为或者拓展 parser 来解析其他格式文件时可以注册自定义的 handler。
  31545. *
  31546. * @param type
  31547. * @en Extension name likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}.
  31548. * @zh 形如 '.jpg' 的扩展名或形如 {'.jpg': jpgHandler, '.png': pngHandler} 的映射表。
  31549. * @param handler @en The corresponding handler. @zh 对应扩展名的处理方法。
  31550. * @param handler.file @en The file to be parsed. @zh 待解析的文件。
  31551. * @param handler.options @en Some optional parameters. @zh 一些可选的参数。
  31552. * @param handler.onComplete @en The callback invoked when parsing finished. @zh 完成解析的回调。
  31553. *
  31554. * @example
  31555. * parser.register('.tga', (file, options, onComplete) => onComplete(null, null));
  31556. * parser.register({'.tga': (file, options, onComplete) => onComplete(null, null),
  31557. * '.ext': (file, options, onComplete) => onComplete(null, null)});
  31558. *
  31559. */
  31560. register(type: string, handler: (file: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: any | null) => void)) => void): void;
  31561. register(map: Record<string, (file: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: any | null) => void)) => void>): void;
  31562. /**
  31563. * @en
  31564. * Use corresponding handler to parse file.
  31565. *
  31566. * @zh
  31567. * 使用对应的 handler 来解析文件。
  31568. *
  31569. * @param id @en The id of file. @zh 文件的唯一 id。
  31570. * @param file @en The data of file. @zh 文件的数据。
  31571. * @param type @en The corresponding type of file, likes '.jpg'. @zh 需要使用的解析方法类型。
  31572. * @param options @en Some optional parameters will be transferred to the corresponding handler. @zh 传递到解析方法的额外参数。
  31573. * @param onComplete @en The callback invoked when finishing parsing. @zh 完成解析的回调。
  31574. * @param onComplete.err @en The occurred error, null indicates success. @zh 解析过程中发生的错误,null 表明解析成功。
  31575. * @param onComplete.content @en The parsed data. @zh 解析后的数据。
  31576. *
  31577. * @example
  31578. * downloader.download('test.jpg', 'test.jpg', '.jpg', {}, (err, file) => {
  31579. * parser.parse('test.jpg', file, '.jpg', null, (err, img) => console.log(err));
  31580. * });
  31581. *
  31582. */
  31583. parse(id: string, file: any, type: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any | null) => void)): void;
  31584. }
  31585. }
  31586. /**
  31587. * @en
  31588. * A [[Bundle]] instance to manage all assets in assets/resources.
  31589. *
  31590. * @zh
  31591. * 一个 [[Bundle]] 实例,用于管理所有在 assets/resources 下的资源。
  31592. */
  31593. export const resources: AssetManager.Bundle;
  31594. /**
  31595. * @en Loader for resource loading process. The engine automatically initialize its singleton object [[loader]].
  31596. * @zh 资源加载管理器,引擎会自动创建一个单例对象 [[loader]]。
  31597. *
  31598. * @class loader
  31599. * @static
  31600. * @deprecated since v3.0 loader is deprecated, please backup your project and upgrade to assetManager
  31601. */
  31602. export class CCLoader {
  31603. /**
  31604. * @en The default progression callback during the loading process,
  31605. * if no progression callback is passed to [[load]] function, then this default callback will be used.
  31606. * @zh Loader 默认的进度回调函数,如果在调用 [[load]] 函数时没有指定进度回调函数的话,会调用默认进度回调函数。
  31607. *
  31608. * @deprecated since v3.0, loader.onProgress is deprecated, please transfer onProgress to API as a parameter
  31609. */
  31610. set onProgress(val: ((finished: number, total: number, item: AssetManager.RequestItem) => void));
  31611. /**
  31612. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  31613. */
  31614. _autoReleaseSetting: Record<string, boolean>;
  31615. /**
  31616. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  31617. */
  31618. get _cache(): Record<string, Asset>;
  31619. /**
  31620. * @en
  31621. * Load resources with a progression callback and a complete callback.<br>
  31622. *
  31623. * @zh
  31624. * 使用进度回调和完整回调加载资源。<br>
  31625. *
  31626. * @example
  31627. * ```TypeScript
  31628. * loader.load('a.png', function (err, tex) {
  31629. * log('Result should be a texture: ' + (tex instanceof Texture2D));
  31630. * });
  31631. *
  31632. * loader.load('http://example.com/a.png', function (err, tex) {
  31633. * log('Should load a texture from external url: ' + (tex instanceof Texture2D));
  31634. * });
  31635. *
  31636. * loader.load({url: 'http://example.com/getImageREST?file=a.png', type: 'png'}, function (err, tex) {
  31637. * log('Should load a texture from RESTful API by specify the type: ' + (tex instanceof Texture2D));
  31638. * });
  31639. * ```
  31640. *
  31641. * @param res - Url list in an array
  31642. * @param progressCallback - Callback invoked when progression change
  31643. * @param {Number} progressCallback.completedCount - The number of the items that are already completed
  31644. * @param {Number} progressCallback.totalCount - The total number of the items
  31645. * @param {Object} progressCallback.item - The latest item which flow out the pipeline
  31646. * @param completeCallback - Callback invoked when all resources loaded
  31647. * @deprecated since v3.0, loader.load is deprecated, please use assetManager.loadRemote instead
  31648. */
  31649. load(res: string | string[] | Record<string, any>, progressCallback?: ((...args: any[]) => void) | null, completeCallback?: ((...args: any[]) => void) | null): void;
  31650. /**
  31651. * @en Gets a new XMLHttpRequest instance.
  31652. * @zh 获取一个新的 XMLHttpRequest 的实例。
  31653. *
  31654. * @deprecated since v3.0 loader.getXMLHttpRequest is deprecated, please use XMLHttpRequest directly
  31655. */
  31656. getXMLHttpRequest(): XMLHttpRequest;
  31657. /**
  31658. * @en Returns an item in pipeline.
  31659. * @zh 根据 id 获取一个 item
  31660. * @param id The id of the item
  31661. *
  31662. * @return {Object}
  31663. * @deprecated since v3.0 loader.getItem is deprecated, please use assetManager.assets.get instead
  31664. */
  31665. getItem(id: any): {
  31666. content: Asset | null | undefined;
  31667. } | null;
  31668. /**
  31669. * @en
  31670. * Load assets from the "resources" folder inside the "assets" folder of your project.<br>
  31671. * <br>
  31672. * Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  31673. * @zh
  31674. * 从项目的 “assets” 文件夹下的 “resources” 文件夹中加载资源<br>
  31675. * <br>
  31676. * 注意:Creator 中的所有资源 URL 都使用正斜杠,使用反斜杠的 URL 将不起作用。
  31677. *
  31678. * @deprecated since v3.0 loader.loadRes is deprecated, please use resources.load instead
  31679. * @param url - Url of the target resource.
  31680. * The url is relative to the "resources" folder, extensions must be omitted.
  31681. * @param type - Only asset of type will be loaded if this argument is supplied.
  31682. * @param progressCallback - Callback invoked when progression change.
  31683. * @param {Number} progressCallback.completedCount - The number of the items that are already completed.
  31684. * @param {Number} progressCallback.totalCount - The total number of the items.
  31685. * @param {Object} progressCallback.item - The latest item which flow out the pipeline.
  31686. * @param completeCallback - Callback invoked when the resource loaded.
  31687. * @param {Error} completeCallback.error - The error info or null if loaded successfully.
  31688. * @param {Object} completeCallback.resource - The loaded resource if it can be found otherwise returns null.
  31689. * @example
  31690. * ```typescript
  31691. * // load the prefab (project/assets/resources/misc/character/cocos) from resources folder
  31692. * loader.loadRes('misc/character/cocos', function (err, prefab) {
  31693. * if (err) {
  31694. * error(err.message || err);
  31695. * return;
  31696. * }
  31697. * log('Result should be a prefab: ' + (prefab instanceof Prefab));
  31698. * });
  31699. *
  31700. * // load the sprite frame of (project/assets/resources/imgs/cocos.png) from resources folder
  31701. * loader.loadRes('imgs/cocos', SpriteFrame, function (err, spriteFrame) {
  31702. * if (err) {
  31703. * error(err.message || err);
  31704. * return;
  31705. * }
  31706. * log('Result should be a sprite frame: ' + (spriteFrame instanceof SpriteFrame));
  31707. * });
  31708. *
  31709. */
  31710. loadRes<T extends Asset>(url: string, type: __private.__types_globals__Constructor<T>, progressCallback: __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T>): any;
  31711. loadRes<T extends Asset>(url: string, type: __private.__types_globals__Constructor<T>, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T>): any;
  31712. loadRes<T extends Asset>(url: string, progressCallback: __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T>): any;
  31713. loadRes<T extends Asset>(url: string, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T>): any;
  31714. /**
  31715. * @en This method is like [[loadRes]] except that it accepts array of url.
  31716. * @zh 此方法除了接受 URL 数组参数外,与 [[loadRes]] 方法相同。
  31717. *
  31718. * @deprecated since v3.0 loader.loadResArray is deprecated, please use resources.load instead
  31719. * @param urls - Array of URLs of the target resource.
  31720. * The url is relative to the "resources" folder, extensions must be omitted.
  31721. * @param type - Only asset of type will be loaded if this argument is supplied.
  31722. * @param progressCallback - Callback invoked when progression change.
  31723. * @param {Number} progressCallback.completedCount - The number of the items that are already completed.
  31724. * @param {Number} progressCallback.totalCount - The total number of the items.
  31725. * @param {Object} progressCallback.item - The latest item which flow out the pipeline.
  31726. * @param completeCallback - A callback which is called when all assets have been loaded, or an error occurs.
  31727. * @param {Error} completeCallback.error - If one of the asset failed, the complete callback is immediately called
  31728. * with the error. If all assets are loaded successfully, error will be null.
  31729. * @param {Asset[]|Array} completeCallback.assets - An array of all loaded assets.
  31730. * If nothing to load, assets will be an empty array.
  31731. * @example
  31732. * ```typescript
  31733. * // load the SpriteFrames from resources folder
  31734. * let spriteFrames;
  31735. * let urls = ['misc/characters/character_01', 'misc/weapons/weapons_01'];
  31736. * loader.loadResArray(urls, SpriteFrame, function (err, assets) {
  31737. * if (err) {
  31738. * error(err);
  31739. * return;
  31740. * }
  31741. * spriteFrames = assets;
  31742. * // ...
  31743. * });
  31744. * ```
  31745. */
  31746. loadResArray<T extends Asset>(urls: string[], type?: __private.__types_globals__Constructor<T>, progressCallback?: __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback, completeCallback?: __private._cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T[]>): void;
  31747. /**
  31748. * @en
  31749. * Load all assets in a folder inside the "assets/resources" folder of your project.<br>
  31750. * <br>
  31751. * Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
  31752. * @zh
  31753. * 将所有资产加载到项目 “assets / resources” 文件夹中
  31754. * <br>
  31755. * 注意:Creator 中的所有资源 URL 都使用正斜杠,使用反斜杠的 URL 将不起作用。
  31756. *
  31757. * @deprecated since v3.0 loader.loadResDir is deprecated, please use resources.loadDir instead
  31758. * @param url - Url of the target folder.
  31759. * The url is relative to the "resources" folder, extensions must be omitted.
  31760. * @param type - Only asset of type will be loaded if this argument is supplied.
  31761. * @param progressCallback - Callback invoked when progression change.
  31762. * @param {Number} progressCallback.completedCount - The number of the items that are already completed.
  31763. * @param {Number} progressCallback.totalCount - The total number of the items.
  31764. * @param {Object} progressCallback.item - The latest item which flow out the pipeline.
  31765. * @param completeCallback - A callback which is called when all assets have been loaded, or an error occurs.
  31766. * @param {Error} completeCallback.error - If one of the asset failed, the complete callback is immediately called
  31767. * with the error. If all assets are loaded successfully, error will be null.
  31768. * @param {Asset[]} completeCallback.assets - An array of all loaded assets.
  31769. * If nothing to load, assets will be an empty array.
  31770. * @param {String[]} completeCallback.urls - An array that lists all the URLs of loaded assets.
  31771. * ```typescript
  31772. * // load the texture (resources/imgs/cocos.png) and the corresponding sprite frame
  31773. * loader.loadResDir('imgs/cocos', function (err, assets) {
  31774. * if (err) {
  31775. * error(err);
  31776. * return;
  31777. * }
  31778. * let texture = assets[0];
  31779. * let spriteFrame = assets[1];
  31780. * });
  31781. *
  31782. * // load all textures in "resources/imgs/"
  31783. * loader.loadResDir('imgs', Texture2D, function (err, textures) {
  31784. * let texture1 = textures[0];
  31785. * let texture2 = textures[1];
  31786. * });
  31787. *
  31788. * // load all JSONs in "resources/data/"
  31789. * loader.loadResDir('data', function (err, objects, urls) {
  31790. * let data = objects[0];
  31791. * let url = urls[0];
  31792. * });
  31793. * ```
  31794. */
  31795. loadResDir<T extends Asset>(url: string, type: __private.__types_globals__Constructor<T>, progressCallback: __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadDirCompleteCallback<T>): any;
  31796. loadResDir<T extends Asset>(url: string, type: __private.__types_globals__Constructor<T>, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadDirCompleteCallback<T>): any;
  31797. loadResDir<T extends Asset>(url: string, progressCallback: __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadDirCompleteCallback<T>): any;
  31798. loadResDir<T extends Asset>(url: string, completeCallback: __private._cocos_asset_asset_manager_deprecated__LoadDirCompleteCallback<T>): any;
  31799. /**
  31800. * @en
  31801. * Get resource data by id. <br>
  31802. * When you load resources with [[load]] or [[loadRes]],
  31803. * the url will be the unique identity of the resource.
  31804. * After loaded, you can acquire them by passing the url to this API.
  31805. * @zh
  31806. * 根据 ID 获取资源数据。<br>
  31807. * 当使用 [[load]] 或 [[loadRes]] 来加载资源时,<br>
  31808. * URL 将是资源的唯一标识。<br>
  31809. * 在完成加载之后,你可以通过将 URL 传递给此 API 来获取它们。
  31810. *
  31811. * @param url
  31812. * @param type - Only asset of type will be returned if this argument is supplied.
  31813. * @deprecated since v3.0 loader.getRes is deprecated, please use resources.get instead
  31814. */
  31815. getRes<T extends Asset>(url: string, type?: __private.__types_globals__Constructor<T>): T | null;
  31816. /**
  31817. * @en Get total resources count in loader.
  31818. * @zh 获取加载的总资源数量
  31819. * @deprecated since v3.0 loader.getResCount is deprecated, please use assetManager.assets.count instead
  31820. */
  31821. getResCount(): number;
  31822. /**
  31823. * @en
  31824. * Get all resource dependencies of the requested asset in an array, including itself.<br>
  31825. * The owner parameter accept the following types: 1. The asset itself; 2. The resource url; 3. The asset's uuid.<br>
  31826. * The returned array stores the dependencies with their uuids, after retrieve dependencies,<br>
  31827. * you can release them, access dependent assets by passing the uuid to [[getRes]], or other stuffs you want.<br>
  31828. * For release all dependencies of an asset, please refer to [[release]]
  31829. * Here is some examples:
  31830. * @zh
  31831. * 获取一个指定资源的所有依赖资源,包含它自身,并保存在数组中返回。<br>
  31832. * owner 参数接收以下几种类型:1. 资源 asset 对象;2. 资源目录下的 url;3. 资源的 uuid。<br>
  31833. * 返回的数组将仅保存依赖资源的 uuid,获取这些 uuid 后,你可以从 loader 释放这些资源;通过 [[getRes]] 获取某个资源或者进行其他你需要的操作。<br>
  31834. * 想要释放一个资源及其依赖资源,可以参考 [[release]]。<br>
  31835. * 下面是一些示例代码:
  31836. * @example
  31837. * ```typescript
  31838. * // Release all dependencies of a loaded prefab
  31839. * let deps = loader.getDependsRecursively(prefab);
  31840. * loader.release(deps);
  31841. * // Retrieve all dependent textures
  31842. * let deps = loader.getDependsRecursively('prefabs/sample');
  31843. * let textures = [];
  31844. * for (let i = 0; i < deps.length; ++i) {
  31845. * let item = loader.getRes(deps[i]);
  31846. * if (item instanceof Texture2D) {
  31847. * textures.push(item);
  31848. * }
  31849. * }
  31850. * ```
  31851. *
  31852. * @deprecated since v3.0 loader.getDependsRecursively is deprecated, please use use assetManager.dependUtil.getDepsRecursively instead
  31853. * @param owner - The owner asset or the resource url or the asset's uuid
  31854. * @returns the dependencies list
  31855. */
  31856. getDependsRecursively(owner: Asset | string): string[];
  31857. /**
  31858. * @en The md5 pipe in loader's pipeline, it could be absent if the project isn't build with md5 option.<br>
  31859. * It's used to modify the url to the real downloadable url with md5 suffix.
  31860. * @zh loader 中的 md5 加载管道,如果项目没有使用 md5 构建,则此项可能不存在。<br>
  31861. * 用于修改带有 md5 后缀的真实可下载的 URL 。
  31862. *
  31863. * @deprecated since v3.0 loader.md5Pipe is deprecated, assetLoader and md5Pipe were merged into assetManager.transformPipeline
  31864. */
  31865. get md5Pipe(): {
  31866. transformURL(url: string): string;
  31867. };
  31868. /**
  31869. * @en
  31870. * The downloader in loader's pipeline, it's by default the second pipe.<br>
  31871. * It's used to download files with several handlers: pure text, image, script, audio, font, uuid.<br>
  31872. * You can add your own download function with addDownloadHandlers
  31873. * @zh
  31874. * loader 中的资源下载程序,默认情况下是第二个加载的。<br>
  31875. * 它用于下载带有多个处理程序的文件:纯文本,图像,脚本,音频,字体,uuid。<br>
  31876. * 您可以使用 addDownloadHandlers 来添加自己的下载函数
  31877. *
  31878. * @deprecated since v3.0 loader.downloader is deprecated, please use assetManager.downloader instead
  31879. */
  31880. get downloader(): AssetManager.Downloader;
  31881. /**
  31882. * @en
  31883. * The loader in loader's pipeline, it's by default the third pipe.<br>
  31884. * It's used to parse downloaded content with several handlers: JSON, image, plist, fnt, uuid.<br>
  31885. * You can add your own download function with addLoadHandlers
  31886. * @zh
  31887. * loader 中的资源下载程序,默认情况下是第三个加载的。<br>
  31888. * 它用于解析下载的内容及多个处理程序的文件:纯文本,图像,脚本,音频,字体,uuid。<br>
  31889. * 您可以使用 addLoadHandlers 来添加自己的下载函数
  31890. *
  31891. * @deprecated since v3.0 loader.loader is deprecated, please use assetManager.parser instead
  31892. */
  31893. get loader(): AssetManager.Parser;
  31894. /**
  31895. * @en Add custom supported types handler or modify existing type handler for download process.
  31896. * @zh 为下载程序添加自定义支持的类型处理程序或修改现有的类型处理程序。
  31897. * @example
  31898. * ```typescript
  31899. * loader.addDownloadHandlers({
  31900. * // This will match all url with `.scene` extension or all url with `scene` type
  31901. * 'scene' : function (url, callback) {}
  31902. * });
  31903. * ```
  31904. * @param extMap Handlers for corresponding type in a map
  31905. * @deprecated since v3.0 loader.addDownloadHandlers is deprecated, please use assetManager.downloader.register instead
  31906. */
  31907. addDownloadHandlers(extMap: Record<string, (item: {
  31908. url: string;
  31909. }, cb: ((err: Error | null, data?: any | null) => void)) => void>): void;
  31910. /**
  31911. * @en Add custom supported types handler or modify existing type handler for load process.
  31912. * @zh 为加载程序添加自定义支持的类型处理程序或修改现有的类型处理程序。
  31913. * @example
  31914. * ```typescript
  31915. * loader.addLoadHandlers({
  31916. * // This will match all url with `.scene` extension or all url with `scene` type
  31917. * 'scene' : function (url, callback) {}
  31918. * });
  31919. * ```
  31920. * @param extMap Handlers for corresponding type in a map
  31921. * @deprecated since v3.0 loader.addLoadHandlers is deprecated, please use assetManager.parser.register instead
  31922. */
  31923. addLoadHandlers(extMap: Record<string, (config: {
  31924. content: any;
  31925. }, cb: ((err: Error | null, data?: any | null) => void)) => void>): void;
  31926. /**
  31927. * @en
  31928. * Release the content of an asset or an array of assets by uuid.<br>
  31929. * This method will not only remove the cache of the asset in loader, but also clean up its content.<br>
  31930. * For example, if you release a texture, the texture asset and its gl texture data will be freed up.<br>
  31931. * In complex project, you can use this function with [[getDependsRecursively]] to free up memory in critical circumstances.<br>
  31932. * Notice, this method may cause the texture to be unusable, if there are still other nodes use the same texture, they may turn to black
  31933. * and report gl errors.<br>
  31934. * @zh
  31935. * 通过 id(通常是资源 url)来释放一个资源或者一个资源数组。<br>
  31936. * 这个方法不仅会从 loader 中删除资源的缓存引用,还会清理它的资源内容。<br>
  31937. * 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。<br>
  31938. * 在复杂项目中,我们建议你结合 [[getDependsRecursively]] 来使用,便于在设备内存告急的情况下更快地释放不再需要的资源的内存。<br>
  31939. * 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。<br>
  31940. *
  31941. * @example
  31942. * ```typescript
  31943. * // Release a texture which is no longer need
  31944. * loader.release(texture);
  31945. * // Release all dependencies of a loaded prefab
  31946. * let deps = loader.getDependsRecursively('prefabs/sample');
  31947. * loader.release(deps);
  31948. * // If there is no instance of this prefab in the scene, the prefab and its dependencies like textures, sprite frames, etc, will be freed up.
  31949. * // If you have some other nodes share a texture in this prefab, you can skip it in two ways:
  31950. * // 1. Forbid auto release a texture before release
  31951. * loader.setAutoRelease(texture2d, false);
  31952. * // 2. Remove it from the dependencies array
  31953. * let deps = loader.getDependsRecursively('prefabs/sample');
  31954. * let index = deps.indexOf(texture2d._uuid);
  31955. * if (index !== -1)
  31956. * deps.splice(index, 1);
  31957. * loader.release(deps);
  31958. * ```
  31959. * @param asset Asset or assets to be released
  31960. * @deprecated since v3.0 loader.release is deprecated, please use assetManager.releaseAsset instead
  31961. */
  31962. release(asset: Asset | string | Array<Asset | string>): void;
  31963. /**
  31964. * @en Release the asset by its object. Refer to [[release]] for detailed informations.
  31965. * @zh 通过资源对象自身来释放资源。详细信息请参考 [[release]]
  31966. * @param asset The asset to be released
  31967. *
  31968. * @deprecated since v3.0 loader.releaseAsset is deprecated, please use assetManager.releaseAsset instead
  31969. */
  31970. releaseAsset(asset: Asset): void;
  31971. /**
  31972. * @en Release the asset loaded by [[loadRes]]. Refer to [[release]] for detailed informations.
  31973. * @zh 释放通过 [[loadRes]] 加载的资源。详细信息请参考 [[release]]
  31974. * @param res The asset url, it should be related path without extension to the `resources` folder.
  31975. * @param type If type is provided, the asset for correspond type will be returned
  31976. *
  31977. * @deprecated since v3.0 loader.releaseRes is deprecated, please use assetManager.releaseRes instead
  31978. */
  31979. releaseRes(res: string, type?: __private.__types_globals__Constructor<Asset>): void;
  31980. /**
  31981. *
  31982. * @en Resource all assets. Refer to [[release]] for detailed informations.
  31983. * @zh 释放所有资源。详细信息请参考 [[release]]
  31984. *
  31985. * @deprecated since v3.0 loader.releaseAll is deprecated, please use assetManager.releaseAll instead
  31986. */
  31987. releaseAll(): void;
  31988. /**
  31989. * @en Removes an completed item in pipeline.
  31990. * It will only remove the cache in the pipeline or loader, its dependencies won't be released.
  31991. * loader provided another method to completely cleanup the resource and its dependencies,
  31992. * please refer to [[release]]
  31993. * @zh 移除指定的已完成 item。
  31994. * 这将仅仅从 pipeline 或者 loader 中删除其缓存,并不会释放它所依赖的资源。
  31995. * loader 中提供了另一种删除资源及其依赖的清理方法,请参考 [[release]]
  31996. * @param id The id of the item
  31997. * @return succeed or not
  31998. *
  31999. * @deprecated since 3.0, loader.removeItem is deprecated, please use assetManager.assets.remove instead
  32000. */
  32001. removeItem(id: any): boolean;
  32002. /**
  32003. * @en
  32004. * Indicates whether to release the asset when loading a new scene.<br>
  32005. * By default, when loading a new scene, all assets in the previous scene will be released or preserved<br>
  32006. * according to whether the previous scene checked the "Auto Release Assets" option.<br>
  32007. * On the other hand, assets dynamically loaded by using `loader.loadRes` or `loader.loadResDir`<br>
  32008. * will not be affected by that option, remain not released by default.<br>
  32009. * Use this API to change the default behavior on a single asset, to force preserve or release specified asset when scene switching.<br>
  32010. * <br>
  32011. * See: [[setAutoReleaseRecursively]], [[isAutoRelease]]
  32012. * @zh
  32013. * 设置当场景切换时是否自动释放资源。<br>
  32014. * 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。<br>
  32015. * 而使用 `loader.loadRes` 或 `loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  32016. * 使用这个 API 可以在单个资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  32017. * <br>
  32018. * 参考:[[setAutoReleaseRecursively]],[[isAutoRelease]]
  32019. *
  32020. * @example
  32021. * ```typescript
  32022. * // auto release the texture event if "Auto Release Assets" disabled in current scene
  32023. * loader.setAutoRelease(texture2d, true);
  32024. * // don't release the texture even if "Auto Release Assets" enabled in current scene
  32025. * loader.setAutoRelease(texture2d, false);
  32026. * // first parameter can be url
  32027. * loader.setAutoRelease(audioUrl, false);
  32028. * ```
  32029. * @param asset - The asset or its url or its uuid
  32030. * @param autoRelease - Whether to release automatically during scene switch
  32031. *
  32032. * @deprecated since v3.0 loader.setAutoRelease is deprecated, if you want to prevent some asset from auto releasing, please use Asset.addRef instead
  32033. */
  32034. setAutoRelease(asset: Asset | string, autoRelease: boolean): void;
  32035. /**
  32036. * @en
  32037. * Indicates whether to release the asset and its referenced other assets when loading a new scene.<br>
  32038. * By default, when loading a new scene, all assets in the previous scene will be released or preserved<br>
  32039. * according to whether the previous scene checked the "Auto Release Assets" option.<br>
  32040. * On the other hand, assets dynamically loaded by using `loader.loadRes` or `loader.loadResDir`<br>
  32041. * will not be affected by that option, remain not released by default.<br>
  32042. * Use this API to change the default behavior on the specified asset and its recursively referenced assets,
  32043. * to force preserve or release specified asset when scene switching.<br>
  32044. * <br>
  32045. * See: [[setAutoRelease]], [[isAutoRelease]]
  32046. * @zh
  32047. * 设置当场景切换时是否自动释放资源及资源引用的其它资源。<br>
  32048. * 默认情况下,当加载新场景时,旧场景的资源根据旧场景是否勾选“Auto Release Assets”,将会被释放或者保留。<br>
  32049. * 而使用 `loader.loadRes` 或 `loader.loadResDir` 动态加载的资源,则不受场景设置的影响,默认不自动释放。<br>
  32050. * 使用这个 API 可以在指定资源及资源递归引用到的所有资源上改变这个默认行为,强制在切换场景时保留或者释放指定资源。<br>
  32051. * <br>
  32052. * 参考:[[setAutoRelease]],[[isAutoRelease]]
  32053. *
  32054. * @example
  32055. * ```typescript
  32056. * // auto release the SpriteFrame and its Texture event if "Auto Release Assets" disabled in current scene
  32057. * loader.setAutoReleaseRecursively(spriteFrame, true);
  32058. * // don't release the SpriteFrame and its Texture even if "Auto Release Assets" enabled in current scene
  32059. * loader.setAutoReleaseRecursively(spriteFrame, false);
  32060. * // don't release the Prefab and all the referenced assets
  32061. * loader.setAutoReleaseRecursively(prefab, false);
  32062. * ```
  32063. * @param asset - The asset or its url or its uuid
  32064. * @param autoRelease - Whether to release automatically during scene switch
  32065. * @deprecated loader.setAutoReleaseRecursively is deprecated, if you want to prevent some asset from auto releasing, please use Asset.addRef instead
  32066. */
  32067. setAutoReleaseRecursively(asset: Asset | string, autoRelease: boolean): void;
  32068. /**
  32069. * @en Returns whether the asset is configured as auto released, despite how "Auto Release Assets" property is set on scene asset.<br>
  32070. * <br>
  32071. * See: [[setAutoRelease]], [[setAutoReleaseRecursively]]
  32072. * @zh 返回指定的资源是否有被设置为自动释放,不论场景的“Auto Release Assets”如何设置。<br>
  32073. * <br>
  32074. * 参考:[[setAutoRelease]],[[setAutoReleaseRecursively]]
  32075. *
  32076. * @method isAutoRelease
  32077. * @param {Asset|String} asset - asset object or the raw asset's url
  32078. * @returns {Boolean}
  32079. * @deprecated loader.isAutoRelease is deprecated
  32080. */
  32081. isAutoRelease(asset: Asset | string): boolean;
  32082. }
  32083. /**
  32084. * @deprecated since 3.0, loader is deprecated, please use assetManager instead
  32085. */
  32086. export const loader: CCLoader;
  32087. /**
  32088. * @en
  32089. * Used to load/unload resources in the project
  32090. * @zh
  32091. * 管理项目中加载/卸载资源的资源库。
  32092. *
  32093. * @deprecated since v3.0 AssetLibrary is deprecated, please backup your project and upgrade to assetManager
  32094. */
  32095. export const AssetLibrary: {
  32096. /**
  32097. * @en
  32098. * init the asset library
  32099. * @zh
  32100. * 初始化 AssetLibrary。
  32101. * @method init
  32102. * @param {Object} options
  32103. * @param {String} options.libraryPath - 能接收的任意类型的路径,通常在编辑器里使用绝对的,在网页里使用相对的。
  32104. * @param {Object} options.mountPaths - mount point of actual urls for raw assets (only used in editor)
  32105. * @param {Object} [options.rawAssets] - uuid to raw asset's urls (only used in runtime)
  32106. * @param {String} [options.rawAssetsBase] - base of raw asset's urls (only used in runtime)
  32107. * @param {String} [options.packedAssets] - packed assets (only used in runtime)
  32108. * @deprecated AssetLibrary.init is deprecated, please use assetManager.init instead
  32109. */
  32110. init(options: Record<string, any>): void;
  32111. /**
  32112. * @zh
  32113. * 加载资源。
  32114. * @param {String} uuid
  32115. * @param {loadCallback} callback - @en Callback function to be executed after loading asset. @zh 加载完成后执行的回调函数。
  32116. * @param {Object} options
  32117. * @param {Boolean} options.readMainCache - 默认为true。如果为false,则资源及其所有依赖资源将重新加载并从库中创建新实例。
  32118. * @param {Boolean} options.writeMainCache - 默认为true。如果为true,则结果将缓存到 AssetLibrary,并且必须由用户手动卸载。
  32119. * @param {Asset} options.existingAsset - 加载现有资源,此参数仅在编辑器中可用。
  32120. * @deprecated since v3.0 AssetLibrary.loadAsset is deprecated, please use assetManager.loadAny instead
  32121. */
  32122. loadAsset(uuid: string, callback: (err: Error | null, data?: any | null) => void, options?: any): void;
  32123. };
  32124. /**
  32125. *
  32126. * @class url
  32127. * @static
  32128. *
  32129. * @deprecated since v3.0 url is deprecated
  32130. */
  32131. export const url: {};
  32132. export class BuiltinResMgr {
  32133. protected _resources: Record<string, Asset>;
  32134. protected _materialsToBeCompiled: Material[];
  32135. init(): void;
  32136. addAsset(key: string, asset: Asset): void;
  32137. get<T extends Asset>(uuid: string): T;
  32138. /**
  32139. * @internal
  32140. */
  32141. loadBuiltinAssets(): Promise<void>;
  32142. compileBuiltinMaterial(): void;
  32143. }
  32144. export const builtinResMgr: BuiltinResMgr;
  32145. /**
  32146. * @en
  32147. * `NodePool` is the cache pool designed for node type.<br/>
  32148. * It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  32149. *
  32150. * It's recommended to create `NodePool` instances by node type, the type corresponds to node type in game design, not the class,
  32151. * for example, a prefab is a specific node type. <br/>
  32152. * When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  32153. *
  32154. * Some common use case is :<br/>
  32155. * 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  32156. * 2. Blocks in candy crash (massive creation and recreation)<br/>
  32157. * etc...
  32158. * @zh
  32159. * `NodePool` 是用于管理节点对象的对象缓存池。<br/>
  32160. * 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  32161. * 以前 cocos2d-x 中的 pool 和新的节点事件注册系统不兼容,因此请使用 `NodePool` 来代替。
  32162. *
  32163. * 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  32164. * 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  32165. *
  32166. * 一些常见的用例是:<br/>
  32167. * 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  32168. * 2.糖果粉碎传奇中的木块(频繁创建)。
  32169. * 等等....
  32170. */
  32171. export class NodePool {
  32172. /**
  32173. * @en The pool handler component, it could be the class name or the constructor.
  32174. * @zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。
  32175. */
  32176. poolHandlerComp?: __private._extensions_ccpool_node_pool__Constructor<__private._extensions_ccpool_node_pool__IPoolHandlerComponent> | string;
  32177. /**
  32178. * @en
  32179. * Constructor for creating a pool for a specific node template (usually a prefab).
  32180. * You can pass a component (type or name) argument for handling event for reusing and recycling node.
  32181. * @zh
  32182. * 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  32183. * @param poolHandlerComp @en The constructor or the class name of the component to control the unuse/reuse logic. @zh 处理节点回收和复用事件逻辑的组件类型或名称。
  32184. * @example
  32185. * import { NodePool, Prefab } from 'cc';
  32186. * properties: {
  32187. * template: Prefab
  32188. * },
  32189. * onLoad () {
  32190. * // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  32191. * this.myPool = new NodePool('MyTemplateHandler');
  32192. * }
  32193. * }
  32194. */
  32195. constructor(poolHandlerComp?: __private._extensions_ccpool_node_pool__Constructor<__private._extensions_ccpool_node_pool__IPoolHandlerComponent> | string);
  32196. /**
  32197. * @en The current available size in the pool
  32198. * @zh 获取当前缓冲池的可用对象数量
  32199. */
  32200. size(): number;
  32201. /**
  32202. * @en Destroy all cached nodes in the pool
  32203. * @zh 销毁对象池中缓存的所有节点
  32204. */
  32205. clear(): void;
  32206. /**
  32207. * @en Put a new Node into the pool.
  32208. * It will automatically remove the node from its parent without cleanup.
  32209. * It will also invoke unuse method of the poolHandlerComp if exist.
  32210. * @zh 向缓冲池中存入一个不再需要的节点对象。
  32211. * 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  32212. * 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  32213. * @example
  32214. * import { instantiate } from 'cc';
  32215. * const myNode = instantiate(this.template);
  32216. * this.myPool.put(myNode);
  32217. */
  32218. put(obj: Node): void;
  32219. /**
  32220. * @en Get a obj from pool, if no available object in pool, null will be returned.
  32221. * This function will invoke the reuse function of poolHandlerComp if exist.
  32222. * @zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  32223. * 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  32224. * @param args - 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  32225. * @example
  32226. * let newNode = this.myPool.get();
  32227. */
  32228. get(...args: any[]): Node | null;
  32229. }
  32230. /**
  32231. * @en The event type supported by SystemEvent and Node events
  32232. * @zh SystemEvent 支持的事件类型以及节点事件类型
  32233. *
  32234. * @deprecated since v3.3.0, please use Input.EventType instead
  32235. */
  32236. export enum SystemEventType {
  32237. /**
  32238. * @en
  32239. * The event type for touch start event
  32240. *
  32241. * @zh
  32242. * 手指开始触摸事件。
  32243. */
  32244. TOUCH_START = "touch-start",
  32245. /**
  32246. * @en
  32247. * The event type for touch move event
  32248. *
  32249. * @zh
  32250. * 当手指在屏幕上移动时。
  32251. */
  32252. TOUCH_MOVE = "touch-move",
  32253. /**
  32254. * @en
  32255. * The event type for touch end event
  32256. *
  32257. * @zh
  32258. * 手指结束触摸事件。
  32259. */
  32260. TOUCH_END = "touch-end",
  32261. /**
  32262. * @en
  32263. * The event type for touch end event
  32264. *
  32265. * @zh
  32266. * 当手指在目标节点区域外离开屏幕时。
  32267. */
  32268. TOUCH_CANCEL = "touch-cancel",
  32269. /**
  32270. * @en
  32271. * The event type for mouse down events
  32272. *
  32273. * @zh
  32274. * 当鼠标按下时触发一次。
  32275. */
  32276. MOUSE_DOWN = "mouse-down",
  32277. /**
  32278. * @en
  32279. * The event type for mouse move events
  32280. *
  32281. * @zh
  32282. * 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。
  32283. */
  32284. MOUSE_MOVE = "mouse-move",
  32285. /**
  32286. * @en
  32287. * The event type for mouse up events
  32288. *
  32289. * @zh
  32290. * 当鼠标从按下状态松开时触发一次。
  32291. */
  32292. MOUSE_UP = "mouse-up",
  32293. /**
  32294. * @en
  32295. * The event type for mouse wheel events
  32296. *
  32297. * @zh 当滚动鼠标滚轮或操作其它类似输入设备时会触发滚轮事件。
  32298. */
  32299. MOUSE_WHEEL = "mouse-wheel",
  32300. /**
  32301. * @en
  32302. * The event type for mouse leave target events
  32303. *
  32304. * @zh
  32305. * 当鼠标移入目标节点区域时,不论是否按下.
  32306. *
  32307. * @deprecated since v3.3, please use Node.EventType.MOUSE_ENTER instead.
  32308. */
  32309. MOUSE_ENTER = "mouse-enter",
  32310. /**
  32311. * @en
  32312. * The event type for mouse leave target events
  32313. *
  32314. * @zh
  32315. * 当鼠标移出目标节点区域时,不论是否按下。
  32316. *
  32317. * @deprecated since v3.3, please use Node.EventType.MOUSE_LEAVE instead.
  32318. */
  32319. MOUSE_LEAVE = "mouse-leave",
  32320. /**
  32321. * @en The event type for the key down event, the event will be continuously dispatched in the key pressed state
  32322. * @zh 当按下按键时触发的事件, 该事件在按下状态会持续派发
  32323. */
  32324. KEY_DOWN = "keydown",
  32325. /**
  32326. * @en The event type for the key up event
  32327. * @zh 当松开按键时触发的事件
  32328. */
  32329. KEY_UP = "keyup",
  32330. /**
  32331. * @en
  32332. * The event type for the devicemotion event
  32333. *
  32334. * @zh
  32335. * 重力感应
  32336. */
  32337. DEVICEMOTION = "devicemotion",
  32338. /**
  32339. * @en
  32340. * The event type for position, rotation, scale changed.Use the type parameter as [[Node.TransformBit]] to check which part is changed
  32341. *
  32342. * @zh
  32343. * 节点改变位置、旋转或缩放事件。如果具体需要判断是哪一个事件,可通过判断回调的第一个参数类型是 [[Node.TransformBit]] 中的哪一个来获取
  32344. * @example
  32345. * ```
  32346. * this.node.on(Node.EventType.TRANSFORM_CHANGED, (type)=>{
  32347. * if (type & Node.TransformBit.POSITION) {
  32348. * //...
  32349. * }
  32350. * }, this);
  32351. * ```
  32352. *
  32353. * @deprecated since v3.3, please use Node.EventType.TRANSFORM_CHANGED instead
  32354. */
  32355. TRANSFORM_CHANGED = "transform-changed",
  32356. /**
  32357. * @en The event type for notifying the host scene has been changed for a persist node.
  32358. * @zh 当场景常驻节点的场景发生改变时触发的事件,一般在切换场景过程中触发。
  32359. *
  32360. * @deprecated since v3.3, please use Node.EventType.SCENE_CHANGED_FOR_PERSISTS instead
  32361. */
  32362. SCENE_CHANGED_FOR_PERSISTS = "scene-changed-for-persists",
  32363. /**
  32364. * @en
  32365. * The event type for size change events.
  32366. * Performance note, this event will be triggered every time corresponding properties being changed,
  32367. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  32368. *
  32369. * @zh
  32370. * 当节点尺寸改变时触发的事件。
  32371. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  32372. *
  32373. * @deprecated since v3.3, please use Node.EventType.SIZE_CHANGED instead
  32374. */
  32375. SIZE_CHANGED = "size-changed",
  32376. /**
  32377. * @en
  32378. * The event type for anchor point change events.
  32379. * Performance note, this event will be triggered every time corresponding properties being changed,
  32380. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  32381. *
  32382. * @zh
  32383. * 当节点的 UITransform 锚点改变时触发的事件。
  32384. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  32385. *
  32386. * @deprecated since v3.3, please use Node.EventType.ANCHOR_CHANGED instead
  32387. */
  32388. ANCHOR_CHANGED = "anchor-changed",
  32389. /**
  32390. * @en
  32391. * The event type for color change events.
  32392. * Performance note, this event will be triggered every time corresponding properties being changed,
  32393. * if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  32394. *
  32395. * @zh
  32396. * 当节点的 UI 渲染组件颜色属性改变时触发的事件。
  32397. * 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。
  32398. *
  32399. * @deprecated since v3.3, please use Node.EventType.COLOR_CHANGED instead
  32400. */
  32401. COLOR_CHANGED = "color-changed",
  32402. /**
  32403. * @en
  32404. * The event type for adding a new child node to the target node.
  32405. *
  32406. * @zh
  32407. * 给目标节点添加子节点时触发的事件。
  32408. *
  32409. * @deprecated since v3.3, please use Node.EventType.CHILD_ADDED instead
  32410. */
  32411. CHILD_ADDED = "child-added",
  32412. /**
  32413. * @en
  32414. * The event type for removing a child node from the target node.
  32415. *
  32416. * @zh
  32417. * 给目标节点移除子节点时触发的事件。
  32418. *
  32419. * @deprecated since v3.3, please use Node.EventType.CHILD_REMOVED instead
  32420. */
  32421. CHILD_REMOVED = "child-removed",
  32422. /**
  32423. * @en The event type for changing the parent of the target node
  32424. * @zh 目标节点的父节点改变时触发的事件。
  32425. *
  32426. * @deprecated since v3.3, please use Node.EventType.PARENT_CHANGED instead
  32427. */
  32428. PARENT_CHANGED = "parent-changed",
  32429. /**
  32430. * @en The event type for destroying the target node
  32431. * @zh 目标节点被销毁时触发的事件。
  32432. *
  32433. * @deprecated since v3.3, please use Node.EventType.NODE_DESTROYED instead
  32434. */
  32435. NODE_DESTROYED = "node-destroyed",
  32436. /**
  32437. * @en The event type for node layer change events.
  32438. * @zh 节点 layer 改变时触发的事件。
  32439. *
  32440. * @deprecated since v3.3, please use Node.EventType.LAYER_CHANGED instead
  32441. */
  32442. LAYER_CHANGED = "layer-changed",
  32443. /**
  32444. * @en The event type for node's sibling order changed.
  32445. * @zh 当节点在兄弟节点中的顺序发生变化时触发的事件。
  32446. *
  32447. * @deprecated since v3.3, please use Node.EventType.CHILDREN_ORDER_CHANGED instead
  32448. */
  32449. SIBLING_ORDER_CHANGED = "sibling-order-changed"
  32450. }
  32451. /**
  32452. * @en
  32453. * Base class of all kinds of events.
  32454. *
  32455. * @zh
  32456. * 所有事件对象的基类,包含事件相关基本信息。
  32457. */
  32458. export class Event {
  32459. /**
  32460. * @en
  32461. * Code for event without type.
  32462. *
  32463. * @zh
  32464. * 没有类型的事件。
  32465. */
  32466. static NO_TYPE: string;
  32467. /**
  32468. * @en
  32469. * The type code of Touch event.
  32470. *
  32471. * @zh
  32472. * 触摸事件类型。
  32473. *
  32474. * @deprecated since v3.3, please use SystemEvent.EventType.TOUCH_START, SystemEvent.EventType.TOUCH_MOVE, SystemEvent.EventType.TOUCH_END and SystemEvent.EventType.TOUCH_CANCEL instead
  32475. */
  32476. static TOUCH: string;
  32477. /**
  32478. * @en
  32479. * The type code of Mouse event.
  32480. *
  32481. * @zh
  32482. * 鼠标事件类型。
  32483. *
  32484. * @deprecated since v3.3, please use SystemEvent.EventType.MOUSE_DOWN, SystemEvent.EventType.MOUSE_MOVE, SystemEvent.EventType.MOUSE_UP, SystemEvent.EventType.MOUSE_WHEEL, Node.EventType.MOUSE_ENTER and Node.EventType.MOUSE_LEAVE instead
  32485. */
  32486. static MOUSE: string;
  32487. /**
  32488. * @en
  32489. * The type code of Keyboard event.
  32490. *
  32491. * @zh
  32492. * 键盘事件类型。
  32493. *
  32494. * @deprecated since v3.3, please use SystemEvent.EventType.KEY_DOWN and SystemEvent.EventType.KEY_UP instead
  32495. */
  32496. static KEYBOARD: string;
  32497. /**
  32498. * @en
  32499. * The type code of Acceleration event.
  32500. *
  32501. * @zh
  32502. * 加速器事件类型。
  32503. *
  32504. * @deprecated since v3.3, please use SystemEvent.EventType.DEVICEMOTION instead
  32505. */
  32506. static ACCELERATION: string;
  32507. /**
  32508. * @en
  32509. * Events not currently dispatched are in this phase.
  32510. *
  32511. * @zh
  32512. * 尚未派发事件阶段。
  32513. */
  32514. static NONE: number;
  32515. /**
  32516. * @en
  32517. * The capturing phase comprises the journey from the root to the last node before the event target's node
  32518. * [markdown](http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)
  32519. *
  32520. * @zh
  32521. * 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。
  32522. */
  32523. static CAPTURING_PHASE: number;
  32524. /**
  32525. * @en
  32526. * The target phase comprises only the event target node
  32527. * [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)
  32528. *
  32529. * @zh
  32530. * 目标阶段仅包括事件目标节点。
  32531. */
  32532. static AT_TARGET: number;
  32533. /**
  32534. * @en
  32535. * The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  32536. * [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)
  32537. *
  32538. * @zh
  32539. * 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。
  32540. */
  32541. static BUBBLING_PHASE: number;
  32542. /**
  32543. * @en
  32544. * The name of the event
  32545. *
  32546. * @zh
  32547. * 事件类型。
  32548. */
  32549. type: __private._cocos_input_types_event_enum__SystemEventTypeUnion;
  32550. /**
  32551. * @en
  32552. * Indicate whether the event bubbles up through the hierarchy or not.
  32553. *
  32554. * @zh
  32555. * 表示该事件是否进行冒泡。
  32556. */
  32557. bubbles: boolean;
  32558. /**
  32559. * @en
  32560. * A reference to the target to which the event was originally dispatched.
  32561. *
  32562. * @zh
  32563. * 最初事件触发的目标。
  32564. */
  32565. target: any;
  32566. /**
  32567. * @en
  32568. * A reference to the currently registered target for the event.
  32569. *
  32570. * @zh
  32571. * 当前目标。
  32572. */
  32573. currentTarget: any;
  32574. /**
  32575. * @en
  32576. * Indicates which phase of the event flow is currently being evaluated.
  32577. * Returns an integer value represented by 4 constants:
  32578. * - Event.NONE = 0
  32579. * - Event.CAPTURING_PHASE = 1
  32580. * - Event.AT_TARGET = 2
  32581. * - Event.BUBBLING_PHASE = 3
  32582. * The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  32583. * [markdown](http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  32584. *
  32585. * @zh
  32586. * 事件阶段。
  32587. */
  32588. eventPhase: number;
  32589. /**
  32590. * @en
  32591. * Stops propagation for current event.
  32592. *
  32593. * @zh
  32594. * 停止传递当前事件。
  32595. */
  32596. propagationStopped: boolean;
  32597. /**
  32598. * @en
  32599. * Stops propagation for current event immediately,
  32600. * the event won't even be dispatched to the listeners attached in the current target.
  32601. *
  32602. * @zh
  32603. * 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  32604. */
  32605. propagationImmediateStopped: boolean;
  32606. /**
  32607. * @param type - The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  32608. * @param bubbles - A boolean indicating whether the event bubbles up through the tree or not
  32609. */
  32610. constructor(type: __private._cocos_input_types_event_enum__SystemEventTypeUnion, bubbles?: boolean);
  32611. /**
  32612. * @en
  32613. * Reset the event for being stored in the object pool.
  32614. *
  32615. * @zh
  32616. * 重置事件对象以便在对象池中存储。
  32617. */
  32618. unuse(): void;
  32619. /**
  32620. * @en
  32621. * Reinitialize the event for being used again after retrieved from the object pool.
  32622. * @zh
  32623. * 重新初始化让对象池中取出的事件可再次使用。
  32624. * @param type - The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  32625. * @param bubbles - A boolean indicating whether the event bubbles up through the tree or not
  32626. */
  32627. reuse(type: __private._cocos_input_types_event_enum__SystemEventTypeUnion, bubbles?: boolean): void;
  32628. /**
  32629. * @en
  32630. * Checks whether the event has been stopped.
  32631. *
  32632. * @zh
  32633. * 检查该事件是否已经停止传递。
  32634. */
  32635. isStopped(): boolean;
  32636. /**
  32637. * @en
  32638. * Gets current target of the event <br/>
  32639. * note: It only be available when the event listener is associated with node. <br/>
  32640. * It returns 0 when the listener is associated with fixed priority.
  32641. * @zh
  32642. * 获取当前目标节点
  32643. * @returns - The target with which the event associates.
  32644. */
  32645. getCurrentTarget(): any;
  32646. /**
  32647. * @en
  32648. * Gets the event type.
  32649. * @zh
  32650. * 获取事件类型。
  32651. */
  32652. getType(): string;
  32653. }
  32654. /**
  32655. * @en
  32656. * The acceleration event.
  32657. * @zh
  32658. * 加速计事件。
  32659. */
  32660. export class EventAcceleration extends Event {
  32661. /**
  32662. * @en The acceleration object
  32663. * @zh 加速度对象
  32664. */
  32665. acc: Acceleration;
  32666. /**
  32667. * @param acc - The acceleration
  32668. * @param bubbles - Indicate whether the event bubbles up through the hierarchy or not.
  32669. */
  32670. constructor(acc: Acceleration, bubbles?: boolean);
  32671. }
  32672. /**
  32673. * @en
  32674. * The keyboard event.
  32675. * @zh
  32676. * 键盘事件。
  32677. */
  32678. export class EventKeyboard extends Event {
  32679. /**
  32680. * @en The unique ID of window which triggered the event.
  32681. * @zh 触发键盘事件的窗口 ID
  32682. */
  32683. windowId: number;
  32684. /**
  32685. * @en The KeyCode enum value of current keyboard event.
  32686. * @zh 当前键盘事件的 KeyCode 枚举值
  32687. */
  32688. keyCode: KeyCode;
  32689. /**
  32690. * @en Raw DOM KeyboardEvent.
  32691. * @zh 原始 DOM KeyboardEvent 事件对象
  32692. *
  32693. * @deprecated since v3.3, can't access rawEvent anymore
  32694. */
  32695. rawEvent?: KeyboardEvent;
  32696. /**
  32697. * @en Indicates whether the current key is being pressed
  32698. * @zh 表示当前按键是否正在被按下
  32699. */
  32700. get isPressed(): boolean;
  32701. /**
  32702. * @param keyCode - The key code of the current key or the DOM KeyboardEvent
  32703. * @param isPressed - Indicates whether the current key is being pressed, this is the DEPRECATED parameter.
  32704. * @param bubbles - Indicates whether the event bubbles up through the hierarchy or not.
  32705. */
  32706. constructor(keyCode: number | KeyboardEvent, isPressed: boolean, bubbles?: boolean);
  32707. /**
  32708. * @param keyCode - The key code of the current key or the DOM KeyboardEvent
  32709. * @param eventType - The type of the event
  32710. * @param bubbles - Indicates whether the event bubbles up through the hierarchy or not.
  32711. */
  32712. constructor(keyCode: KeyCode | KeyboardEvent, eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, bubbles?: boolean);
  32713. }
  32714. /**
  32715. * @en The mouse event
  32716. * @zh 鼠标事件类型
  32717. */
  32718. export class EventMouse extends Event {
  32719. /**
  32720. * @en The default tag when no button is pressed
  32721. * @zh 按键默认的缺省状态
  32722. */
  32723. static BUTTON_MISSING: number;
  32724. /**
  32725. * @en The tag of mouse's left button.
  32726. * @zh 鼠标左键的标签。
  32727. */
  32728. static BUTTON_LEFT: number;
  32729. /**
  32730. * @en The tag of mouse's right button (The right button number is 2 on browser).
  32731. * @zh 鼠标右键的标签。
  32732. */
  32733. static BUTTON_RIGHT: number;
  32734. /**
  32735. * @en The tag of mouse's middle button.
  32736. * @zh 鼠标中键的标签。
  32737. */
  32738. static BUTTON_MIDDLE: number;
  32739. /**
  32740. * @en The tag of mouse's button 4.
  32741. * @zh 鼠标按键 4 的标签。
  32742. */
  32743. static BUTTON_4: number;
  32744. /**
  32745. * @en The tag of mouse's button 5.
  32746. * @zh 鼠标按键 5 的标签。
  32747. */
  32748. static BUTTON_5: number;
  32749. /**
  32750. * @en The tag of mouse's button 6.
  32751. * @zh 鼠标按键 6 的标签。
  32752. */
  32753. static BUTTON_6: number;
  32754. /**
  32755. * @en The tag of mouse's button 7.
  32756. * @zh 鼠标按键 7 的标签。
  32757. */
  32758. static BUTTON_7: number;
  32759. /**
  32760. * @en The tag of mouse's button 8.
  32761. * @zh 鼠标按键 8 的标签。
  32762. */
  32763. static BUTTON_8: number;
  32764. /**
  32765. * @en Mouse movement on x axis of the UI coordinate system.
  32766. * @zh 鼠标在 UI 坐标系下 X 轴上的移动距离
  32767. */
  32768. movementX: number;
  32769. /**
  32770. * @en Mouse movement on y axis of the UI coordinate system.
  32771. * @zh 鼠标在 UI 坐标系下 Y 轴上的移动距离
  32772. */
  32773. movementY: number;
  32774. /**
  32775. * @en The unique ID of SystemWindow, which triggerd the event
  32776. * @zh 触发此事件的系统窗口 ID
  32777. */
  32778. windowId: number;
  32779. /**
  32780. * @en Set whether to prevent events from being swallowed by nodes, which is false by default.
  32781. * If set to true, the event is allowed to be dispatched to nodes at the bottom layer.
  32782. * NOTE: Setting to true will reduce the efficiency of event dispatching.
  32783. *
  32784. * @zh 设置是否阻止事件被节点吞噬, 默认为 false 。
  32785. * 如果设置为 true,则事件允许派发给渲染在下一层级的节点。
  32786. * 注意:设置为 true 会降低事件派发的效率。
  32787. *
  32788. * @experimental May be optimized in the future.
  32789. */
  32790. preventSwallow: boolean;
  32791. /**
  32792. * @en The type of the event
  32793. * @zh 鼠标事件类型
  32794. *
  32795. * @deprecated since v3.3, please use EventMouse.prototype.type instead.
  32796. */
  32797. get eventType(): string;
  32798. /**
  32799. * @param eventType - The type of the event
  32800. * @param bubbles - Indicate whether the event bubbles up through the hierarchy or not.
  32801. */
  32802. constructor(eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, bubbles?: boolean, prevLoc?: math.Vec2, windowId?: number);
  32803. /**
  32804. * @en Sets scroll data of the mouse.
  32805. * @zh 设置鼠标滚轮的滚动数据。
  32806. * @param scrollX - The scroll value on x axis
  32807. * @param scrollY - The scroll value on y axis
  32808. */
  32809. setScrollData(scrollX: number, scrollY: number): void;
  32810. /**
  32811. * @en Returns the scroll value on x axis.
  32812. * @zh 获取鼠标滚动的 X 轴距离,只有滚动时才有效。
  32813. */
  32814. getScrollX(): number;
  32815. /**
  32816. * @en Returns the scroll value on y axis.
  32817. * @zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  32818. */
  32819. getScrollY(): number;
  32820. /**
  32821. * @en Sets cursor location.
  32822. * @zh 设置当前鼠标位置。
  32823. * @param x - The location on x axis
  32824. * @param y - The location on y axis
  32825. */
  32826. setLocation(x: number, y: number): void;
  32827. /**
  32828. * @en Returns cursor location.
  32829. * @zh 获取鼠标相对于左下角位置对象,对象包含 x 和 y 属性。
  32830. * @param out - Pass the out object to avoid object creation, very good practice
  32831. */
  32832. getLocation(out?: math.Vec2): math.Vec2;
  32833. /**
  32834. * @en Returns the current cursor location in game view coordinates.
  32835. * @zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  32836. * @param out - Pass the out object to avoid object creation, very good practice
  32837. */
  32838. getLocationInView(out?: math.Vec2): math.Vec2;
  32839. /**
  32840. * @en Returns the current cursor location in ui coordinates.
  32841. * @zh 获取当前事件在 UI 窗口内的坐标位置,对象包含 x 和 y 属性。
  32842. * @param out - Pass the out object to avoid object creation, very good practice
  32843. */
  32844. getUILocation(out?: math.Vec2): math.Vec2;
  32845. /**
  32846. * @en Returns the previous touch location.
  32847. * @zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  32848. * @param out - Pass the out object to avoid object creation, very good practice
  32849. */
  32850. getPreviousLocation(out?: math.Vec2): math.Vec2;
  32851. /**
  32852. * @en Returns the previous touch location.
  32853. * @zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  32854. * @param out - Pass the out object to avoid object creation, very good practice
  32855. */
  32856. getUIPreviousLocation(out?: math.Vec2): math.Vec2;
  32857. /**
  32858. * @en Returns the delta distance from the previous location to current location.
  32859. * @zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  32860. * @param out - Pass the out object to avoid object creation, very good practice
  32861. */
  32862. getDelta(out?: math.Vec2): math.Vec2;
  32863. /**
  32864. * @en Returns the X axis delta distance from the previous location to current location.
  32865. * @zh 获取鼠标距离上一次事件移动的 X 轴距离。
  32866. */
  32867. getDeltaX(): number;
  32868. /**
  32869. * @en Returns the Y axis delta distance from the previous location to current location.
  32870. * @zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  32871. */
  32872. getDeltaY(): number;
  32873. /**
  32874. * @en Returns the delta distance from the previous location to current location in the UI coordinates.
  32875. * @zh 获取鼠标距离上一次事件移动在 UI 坐标系下的距离对象,对象包含 x 和 y 属性。
  32876. * @param out - Pass the out object to avoid object creation, very good practice
  32877. */
  32878. getUIDelta(out?: math.Vec2): math.Vec2;
  32879. /**
  32880. * @en Returns the X axis delta distance from the previous location to current location in the UI coordinates.
  32881. * @zh 获取鼠标距离上一次事件移动在 UI 坐标系下的 X 轴距离。
  32882. */
  32883. getUIDeltaX(): number;
  32884. /**
  32885. * @en Returns the Y axis delta distance from the previous location to current location in the UI coordinates.
  32886. * @zh 获取鼠标距离上一次事件移动在 UI 坐标系下的 Y 轴距离。
  32887. */
  32888. getUIDeltaY(): number;
  32889. /**
  32890. * @en Sets mouse button code.
  32891. * @zh 设置鼠标按键。
  32892. * @param button - The button code
  32893. */
  32894. setButton(button: number): void;
  32895. /**
  32896. * @en Returns mouse button code.
  32897. * @zh 获取鼠标按键。
  32898. */
  32899. getButton(): number;
  32900. /**
  32901. * @en Returns location data on X axis.
  32902. * @zh 获取鼠标当前 X 轴位置。
  32903. */
  32904. getLocationX(): number;
  32905. /**
  32906. * @en Returns location data on Y axis.
  32907. * @zh 获取鼠标当前 Y 轴位置。
  32908. */
  32909. getLocationY(): number;
  32910. /**
  32911. * @en Returns location data on X axis.
  32912. * @zh 获取鼠标当前 X 轴位置。
  32913. */
  32914. getUILocationX(): number;
  32915. /**
  32916. * @en Returns location data on Y axis.
  32917. * @zh 获取鼠标当前 Y 轴位置。
  32918. */
  32919. getUILocationY(): number;
  32920. }
  32921. /**
  32922. * @en
  32923. * The touch event.
  32924. *
  32925. * @zh
  32926. * 触摸事件。
  32927. */
  32928. export class EventTouch extends Event {
  32929. /**
  32930. * @en The maximum touch point numbers simultaneously
  32931. * @zh 同时存在的最大触点数量。
  32932. */
  32933. static MAX_TOUCHES: number;
  32934. /**
  32935. * @en The current touch object
  32936. * @zh 当前触点对象
  32937. */
  32938. touch: Touch | null;
  32939. /**
  32940. * @en Indicate whether the touch event is simulated or real
  32941. * @zh 表示触摸事件是真实触点触发的还是模拟的
  32942. */
  32943. simulate: boolean;
  32944. /**
  32945. * @en The unique ID of SystemWindow, which triggerd the event
  32946. * @zh 触发此事件的系统窗口 ID
  32947. */
  32948. windowId: number;
  32949. /**
  32950. * @en Set whether to prevent events from being swallowed by nodes, which is false by default.
  32951. * If set to true, the event is allowed to be dispatched to nodes at the bottom layer.
  32952. * NOTE: Setting to true will reduce the efficiency of event dispatching.
  32953. *
  32954. * @zh 设置是否阻止事件被节点吞噬, 默认为 false 。
  32955. * 如果设置为 true,则事件允许派发给渲染在下一层级的节点。
  32956. * 注意:设置为 true 会降低事件派发的效率。
  32957. *
  32958. * @experimental May be optimized in the future.
  32959. */
  32960. preventSwallow: boolean;
  32961. /**
  32962. * @param touches - An array of current touches
  32963. * @param bubbles - Indicate whether the event bubbles up through the hierarchy or not.
  32964. * @param eventType - The type of the event
  32965. */
  32966. constructor(changedTouches: Touch[], bubbles: boolean, eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, touches?: Touch[]);
  32967. /**
  32968. * @en Returns event type code.
  32969. * @zh 获取触摸事件类型。
  32970. *
  32971. * @deprecated since v3.3, please use EventTouch.prototype.type instead.
  32972. */
  32973. getEventCode(): string;
  32974. /**
  32975. * @en Returns touches of event.
  32976. * @zh 获取有变动的触摸点的列表。
  32977. * 注意:第一根手指按下不动,接着按第二根手指,这时候触点信息就只有变动的这根手指(第二根手指)的信息。
  32978. * 如果需要获取全部手指的信息,请使用 `getAllTouches`。
  32979. */
  32980. getTouches(): Touch[];
  32981. /**
  32982. * @en Returns touches of event.
  32983. * @zh 获取所有触摸点的列表。
  32984. * 注意:如果手指行为是 touch end,这个时候列表是没有该手指信息的。如需知道该手指信息,可通过 `getTouches` 获取识别。
  32985. */
  32986. getAllTouches(): Touch[];
  32987. /**
  32988. * @en Sets touch location.
  32989. * @zh 设置当前触点位置
  32990. * @param x - The current touch location on the x axis
  32991. * @param y - The current touch location on the y axis
  32992. */
  32993. setLocation(x: number, y: number): void;
  32994. /**
  32995. * @en Returns the current touch location.
  32996. * @zh 获取触点位置。
  32997. * @param out - Pass the out object to avoid object creation, very good practice
  32998. */
  32999. getLocation(out?: math.Vec2): math.Vec2;
  33000. /**
  33001. * @en Returns the current touch location in UI coordinates.
  33002. * @zh 获取 UI 坐标系下的触点位置。
  33003. * @param out - Pass the out object to avoid object creation, very good practice
  33004. */
  33005. getUILocation(out?: math.Vec2): math.Vec2;
  33006. /**
  33007. * @en Returns the current touch location in game screen coordinates.
  33008. * @zh 获取当前触点在游戏窗口中的位置。
  33009. * @param out - Pass the out object to avoid object creation, very good practice
  33010. */
  33011. getLocationInView(out?: math.Vec2): math.Vec2;
  33012. /**
  33013. * @en Returns the previous touch location.
  33014. * @zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  33015. * @param out - Pass the out object to avoid object creation, very good practice
  33016. */
  33017. getPreviousLocation(out?: math.Vec2): math.Vec2;
  33018. /**
  33019. * @en Returns the start touch location.
  33020. * @zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  33021. * @param out - Pass the out object to avoid object creation, very good practice
  33022. */
  33023. getStartLocation(out?: math.Vec2): math.Vec2;
  33024. /**
  33025. * @en Returns the start touch location in UI coordinates.
  33026. * @zh 获取触点落下时的 UI 世界下位置对象,对象包含 x 和 y 属性。
  33027. * @param out - Pass the out object to avoid object creation, very good practice
  33028. */
  33029. getUIStartLocation(out?: math.Vec2): math.Vec2;
  33030. /**
  33031. * @en Returns the id of the current touch point.
  33032. * @zh 获取触点的标识 ID,可以用来在多点触摸中跟踪触点。
  33033. */
  33034. getID(): number | null;
  33035. /**
  33036. * @en Returns the delta distance from the previous location to current location.
  33037. * @zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  33038. * @param out - Pass the out object to avoid object creation, very good practice
  33039. */
  33040. getDelta(out?: math.Vec2): math.Vec2;
  33041. /**
  33042. * @en Returns the delta distance from the previous location to current location.
  33043. * @zh 获取触点距离上一次事件 UI 世界下移动的距离对象,对象包含 x 和 y 属性。
  33044. * @param out - Pass the out object to avoid object creation, very good practice
  33045. */
  33046. getUIDelta(out?: math.Vec2): math.Vec2;
  33047. /**
  33048. * @en Returns the X axis delta distance from the previous location to current location.
  33049. * @zh 获取触点距离上一次事件移动的 x 轴距离。
  33050. */
  33051. getDeltaX(): number;
  33052. /**
  33053. * @en Returns the Y axis delta distance from the previous location to current location.
  33054. * @zh 获取触点距离上一次事件移动的 y 轴距离。
  33055. */
  33056. getDeltaY(): number;
  33057. /**
  33058. * @en Returns location X axis data.
  33059. * @zh 获取当前触点 X 轴位置。
  33060. */
  33061. getLocationX(): number;
  33062. /**
  33063. * @en Returns location Y axis data.
  33064. * @zh 获取当前触点 Y 轴位置。
  33065. */
  33066. getLocationY(): number;
  33067. }
  33068. /**
  33069. * @en
  33070. * The gamepad event.
  33071. * @zh
  33072. * 手柄事件。
  33073. */
  33074. export class EventGamepad extends Event {
  33075. /**
  33076. * @en The gamepad device which trigger the current gamepad event
  33077. * @zh 触发当前手柄事件的手柄设备
  33078. */
  33079. gamepad: __private._pal_input__GamepadInputDevice;
  33080. constructor(type: string, gamepad: __private._pal_input__GamepadInputDevice);
  33081. }
  33082. /**
  33083. * @en
  33084. * The 6DOF handle event.
  33085. *
  33086. * @zh
  33087. * 6DOF手柄事件。
  33088. */
  33089. export class EventHandle extends Event {
  33090. /**
  33091. * @en The handle device which trigger the current handle event
  33092. * @zh 触发当前手柄事件的手柄设备
  33093. */
  33094. handleInputDevice: __private._pal_input__HandleInputDevice;
  33095. /**
  33096. * @param eventType - The type of the event
  33097. * @param handleInputDevice - The handle device which trigger the current handle event
  33098. */
  33099. constructor(eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, handleInputDevice: __private._pal_input__HandleInputDevice);
  33100. }
  33101. /**
  33102. * @en
  33103. * The HMD event.
  33104. *
  33105. * @zh
  33106. * 头戴显示器事件。
  33107. */
  33108. export class EventHMD extends Event {
  33109. /**
  33110. * @en The hmd device which trigger the current hmd event
  33111. * @zh 触发当前头戴显示器事件的头戴显示器设备
  33112. */
  33113. hmdInputDevice: __private._pal_input__HMDInputDevice;
  33114. /**
  33115. * @param eventType - The type of the event
  33116. * @param hmdInputDevice - The hmd device which trigger the current hmd event
  33117. */
  33118. constructor(eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, hmdInputDevice: __private._pal_input__HMDInputDevice);
  33119. }
  33120. /**
  33121. * @en
  33122. * The Handheld event.
  33123. *
  33124. * @zh
  33125. * 手持设备事件。
  33126. */
  33127. export class EventHandheld extends Event {
  33128. /**
  33129. * @en The handheld device which trigger the current handheld event
  33130. * @zh 触发当前手持设备事件的手持设备
  33131. */
  33132. handheldInputDevice: __private._pal_input__HandheldInputDevice;
  33133. /**
  33134. * @param eventType - The type of the event
  33135. * @param handheldInputDevice - The handheld device which trigger the current handheld event
  33136. */
  33137. constructor(eventType: __private._cocos_input_types_event_enum__SystemEventTypeUnion, handheldInputDevice: __private._pal_input__HandheldInputDevice);
  33138. }
  33139. /**
  33140. * @en the device accelerometer reports values for each axis in units of g-force.
  33141. * @zh 设备重力传感器传递的各个轴的数据。
  33142. */
  33143. export class Acceleration {
  33144. x: number;
  33145. y: number;
  33146. z: number;
  33147. timestamp: number;
  33148. constructor(x?: number, y?: number, z?: number, timestamp?: number);
  33149. }
  33150. /**
  33151. * @en Enum type of keyCode for key event
  33152. * @zh 按键事件的按键码
  33153. */
  33154. export enum KeyCode {
  33155. /**
  33156. * @en None
  33157. * @zh 没有分配
  33158. */
  33159. NONE = 0,
  33160. /**
  33161. * @en The back key on mobile phone
  33162. * @zh 移动端返回键
  33163. */
  33164. MOBILE_BACK = 6,
  33165. /**
  33166. * @en The backspace key
  33167. * @zh 退格键
  33168. */
  33169. BACKSPACE = 8,
  33170. /**
  33171. * @en The tab key
  33172. * @zh Tab 键
  33173. */
  33174. TAB = 9,
  33175. /**
  33176. * @en The enter key
  33177. * @zh 回车键
  33178. */
  33179. ENTER = 13,
  33180. /**
  33181. * @en The left shift key
  33182. * @zh 左 Shift 键
  33183. */
  33184. SHIFT_LEFT = 16,
  33185. /**
  33186. * @en The left ctrl key
  33187. * @zh 左 Ctrl 键
  33188. */
  33189. CTRL_LEFT = 17,
  33190. /**
  33191. * @en The left alt key
  33192. * @zh 左 Alt 键
  33193. */
  33194. ALT_LEFT = 18,
  33195. /**
  33196. * @en The pause key
  33197. * @zh 暂停键
  33198. */
  33199. PAUSE = 19,
  33200. /**
  33201. * @en The caps lock key
  33202. * @zh 大写锁定键
  33203. */
  33204. CAPS_LOCK = 20,
  33205. /**
  33206. * @en The esc key
  33207. * @zh ESC 键
  33208. */
  33209. ESCAPE = 27,
  33210. /**
  33211. * @en The space key
  33212. * @zh 空格键
  33213. */
  33214. SPACE = 32,
  33215. /**
  33216. * @en The page up key
  33217. * @zh 向上翻页键
  33218. */
  33219. PAGE_UP = 33,
  33220. /**
  33221. * @en The page down key
  33222. * @zh 向下翻页键
  33223. */
  33224. PAGE_DOWN = 34,
  33225. /**
  33226. * @en The end key
  33227. * @zh 结束键
  33228. */
  33229. END = 35,
  33230. /**
  33231. * @en The home key
  33232. * @zh 主菜单键
  33233. */
  33234. HOME = 36,
  33235. /**
  33236. * @en The left key
  33237. * @zh 向左箭头键
  33238. */
  33239. ARROW_LEFT = 37,
  33240. /**
  33241. * @en The up key
  33242. * @zh 向上箭头键
  33243. */
  33244. ARROW_UP = 38,
  33245. /**
  33246. * @en The right key
  33247. * @zh 向右箭头键
  33248. */
  33249. ARROW_RIGHT = 39,
  33250. /**
  33251. * @en The down key
  33252. * @zh 向下箭头键
  33253. */
  33254. ARROW_DOWN = 40,
  33255. /**
  33256. * @en The insert key
  33257. * @zh 插入键
  33258. */
  33259. INSERT = 45,
  33260. /**
  33261. * @en The Delete key
  33262. * @zh 删除键
  33263. */
  33264. DELETE = 46,
  33265. /**
  33266. * @en The '0' key on the top of the alphanumeric keyboard.
  33267. * @zh 字母键盘上的 0 键
  33268. */
  33269. DIGIT_0 = 48,
  33270. /**
  33271. * @en The '1' key on the top of the alphanumeric keyboard.
  33272. * @zh 字母键盘上的 1 键
  33273. */
  33274. DIGIT_1 = 49,
  33275. /**
  33276. * @en The '2' key on the top of the alphanumeric keyboard.
  33277. * @zh 字母键盘上的 2 键
  33278. */
  33279. DIGIT_2 = 50,
  33280. /**
  33281. * @en The '3' key on the top of the alphanumeric keyboard.
  33282. * @zh 字母键盘上的 3 键
  33283. */
  33284. DIGIT_3 = 51,
  33285. /**
  33286. * @en The '4' key on the top of the alphanumeric keyboard.
  33287. * @zh 字母键盘上的 4 键
  33288. */
  33289. DIGIT_4 = 52,
  33290. /**
  33291. * @en The '5' key on the top of the alphanumeric keyboard.
  33292. * @zh 字母键盘上的 5 键
  33293. */
  33294. DIGIT_5 = 53,
  33295. /**
  33296. * @en The '6' key on the top of the alphanumeric keyboard.
  33297. * @zh 字母键盘上的 6 键
  33298. */
  33299. DIGIT_6 = 54,
  33300. /**
  33301. * @en The '7' key on the top of the alphanumeric keyboard.
  33302. * @zh 字母键盘上的 7 键
  33303. */
  33304. DIGIT_7 = 55,
  33305. /**
  33306. * @en The '8' key on the top of the alphanumeric keyboard.
  33307. * @zh 字母键盘上的 8 键
  33308. */
  33309. DIGIT_8 = 56,
  33310. /**
  33311. * @en The '9' key on the top of the alphanumeric keyboard.
  33312. * @zh 字母键盘上的 9 键
  33313. */
  33314. DIGIT_9 = 57,
  33315. /**
  33316. * @en The a key
  33317. * @zh A 键
  33318. */
  33319. KEY_A = 65,
  33320. /**
  33321. * @en The b key
  33322. * @zh B 键
  33323. */
  33324. KEY_B = 66,
  33325. /**
  33326. * @en The c key
  33327. * @zh C 键
  33328. */
  33329. KEY_C = 67,
  33330. /**
  33331. * @en The d key
  33332. * @zh D 键
  33333. */
  33334. KEY_D = 68,
  33335. /**
  33336. * @en The e key
  33337. * @zh E 键
  33338. */
  33339. KEY_E = 69,
  33340. /**
  33341. * @en The f key
  33342. * @zh F 键
  33343. */
  33344. KEY_F = 70,
  33345. /**
  33346. * @en The g key
  33347. * @zh G 键
  33348. */
  33349. KEY_G = 71,
  33350. /**
  33351. * @en The h key
  33352. * @zh H 键
  33353. */
  33354. KEY_H = 72,
  33355. /**
  33356. * @en The i key
  33357. * @zh I 键
  33358. */
  33359. KEY_I = 73,
  33360. /**
  33361. * @en The j key
  33362. * @zh J 键
  33363. */
  33364. KEY_J = 74,
  33365. /**
  33366. * @en The k key
  33367. * @zh K 键
  33368. */
  33369. KEY_K = 75,
  33370. /**
  33371. * @en The l key
  33372. * @zh L 键
  33373. */
  33374. KEY_L = 76,
  33375. /**
  33376. * @en The m key
  33377. * @zh M 键
  33378. */
  33379. KEY_M = 77,
  33380. /**
  33381. * @en The n key
  33382. * @zh N 键
  33383. */
  33384. KEY_N = 78,
  33385. /**
  33386. * @en The o key
  33387. * @zh O 键
  33388. */
  33389. KEY_O = 79,
  33390. /**
  33391. * @en The p key
  33392. * @zh P 键
  33393. */
  33394. KEY_P = 80,
  33395. /**
  33396. * @en The q key
  33397. * @zh Q 键
  33398. */
  33399. KEY_Q = 81,
  33400. /**
  33401. * @en The r key
  33402. * @zh R 键
  33403. */
  33404. KEY_R = 82,
  33405. /**
  33406. * @en The s key
  33407. * @zh S 键
  33408. */
  33409. KEY_S = 83,
  33410. /**
  33411. * @en The t key
  33412. * @zh T 键
  33413. */
  33414. KEY_T = 84,
  33415. /**
  33416. * @en The u key
  33417. * @zh U 键
  33418. */
  33419. KEY_U = 85,
  33420. /**
  33421. * @en The v key
  33422. * @zh V 键
  33423. */
  33424. KEY_V = 86,
  33425. /**
  33426. * @en The w key
  33427. * @zh W 键
  33428. */
  33429. KEY_W = 87,
  33430. /**
  33431. * @en The x key
  33432. * @zh X 键
  33433. */
  33434. KEY_X = 88,
  33435. /**
  33436. * @en The y key
  33437. * @zh Y 键
  33438. */
  33439. KEY_Y = 89,
  33440. /**
  33441. * @en The z key
  33442. * @zh Z 键
  33443. */
  33444. KEY_Z = 90,
  33445. /**
  33446. * @en The numeric keypad 0
  33447. * @zh 数字键盘 0
  33448. */
  33449. NUM_0 = 96,
  33450. /**
  33451. * @en The numeric keypad 1
  33452. * @zh 数字键盘 1
  33453. */
  33454. NUM_1 = 97,
  33455. /**
  33456. * @en The numeric keypad 2
  33457. * @zh 数字键盘 2
  33458. */
  33459. NUM_2 = 98,
  33460. /**
  33461. * @en The numeric keypad 3
  33462. * @zh 数字键盘 3
  33463. */
  33464. NUM_3 = 99,
  33465. /**
  33466. * @en The numeric keypad 4
  33467. * @zh 数字键盘 4
  33468. */
  33469. NUM_4 = 100,
  33470. /**
  33471. * @en The numeric keypad 5
  33472. * @zh 数字键盘 5
  33473. */
  33474. NUM_5 = 101,
  33475. /**
  33476. * @en The numeric keypad 6
  33477. * @zh 数字键盘 6
  33478. */
  33479. NUM_6 = 102,
  33480. /**
  33481. * @en The numeric keypad 7
  33482. * @zh 数字键盘 7
  33483. */
  33484. NUM_7 = 103,
  33485. /**
  33486. * @en The numeric keypad 8
  33487. * @zh 数字键盘 8
  33488. */
  33489. NUM_8 = 104,
  33490. /**
  33491. * @en The numeric keypad 9
  33492. * @zh 数字键盘 9
  33493. */
  33494. NUM_9 = 105,
  33495. /**
  33496. * @en The numeric keypad '*'
  33497. * @zh 数字键盘 *
  33498. */
  33499. NUM_MULTIPLY = 106,
  33500. /**
  33501. * @en The numeric keypad '+'
  33502. * @zh 数字键盘 +
  33503. */
  33504. NUM_PLUS = 107,
  33505. /**
  33506. * @en The numeric keypad '-'
  33507. * @zh 数字键盘 -
  33508. */
  33509. NUM_SUBTRACT = 109,
  33510. /**
  33511. * @en The numeric keypad '.'
  33512. * @zh 数字键盘小数点 '.'
  33513. */
  33514. NUM_DECIMAL = 110,
  33515. /**
  33516. * @en The numeric keypad '/'
  33517. * @zh 数字键盘 /
  33518. */
  33519. NUM_DIVIDE = 111,
  33520. /**
  33521. * @en The F1 function key
  33522. * @zh F1 功能键
  33523. */
  33524. F1 = 112,
  33525. /**
  33526. * @en The F2 function key
  33527. * @zh F2 功能键
  33528. */
  33529. F2 = 113,
  33530. /**
  33531. * @en The F3 function key
  33532. * @zh F3 功能键
  33533. */
  33534. F3 = 114,
  33535. /**
  33536. * @en The F4 function key
  33537. * @zh F4 功能键
  33538. */
  33539. F4 = 115,
  33540. /**
  33541. * @en The F5 function key
  33542. * @zh F5 功能键
  33543. */
  33544. F5 = 116,
  33545. /**
  33546. * @en The F6 function key
  33547. * @zh F6 功能键
  33548. */
  33549. F6 = 117,
  33550. /**
  33551. * @en The F7 function key
  33552. * @zh F7 功能键
  33553. */
  33554. F7 = 118,
  33555. /**
  33556. * @en The F8 function key
  33557. * @zh F8 功能键
  33558. */
  33559. F8 = 119,
  33560. /**
  33561. * @en The F9 function key
  33562. * @zh F9 功能键
  33563. */
  33564. F9 = 120,
  33565. /**
  33566. * @en The F10 function key
  33567. * @zh F10 功能键
  33568. */
  33569. F10 = 121,
  33570. /**
  33571. * @en The F11 function key
  33572. * @zh F11 功能键
  33573. */
  33574. F11 = 122,
  33575. /**
  33576. * @en The F12 function key
  33577. * @zh F12 功能键
  33578. */
  33579. F12 = 123,
  33580. /**
  33581. * @en The numlock key
  33582. * @zh 数字锁定键
  33583. */
  33584. NUM_LOCK = 144,
  33585. /**
  33586. * @en The scroll lock key
  33587. * @zh 滚动锁定键
  33588. */
  33589. SCROLL_LOCK = 145,
  33590. /**
  33591. * @en The ';' key.
  33592. * @zh 分号键
  33593. */
  33594. SEMICOLON = 186,
  33595. /**
  33596. * @en The '=' key.
  33597. * @zh 等于号键
  33598. */
  33599. EQUAL = 187,
  33600. /**
  33601. * @en The ',' key.
  33602. * @zh 逗号键
  33603. */
  33604. COMMA = 188,
  33605. /**
  33606. * @en The dash '-' key.
  33607. * @zh 中划线键
  33608. */
  33609. DASH = 189,
  33610. /**
  33611. * @en The '.' key
  33612. * @zh 句号键
  33613. */
  33614. PERIOD = 190,
  33615. /**
  33616. * @en The slash key '/'
  33617. * @zh 正斜杠键 '/'
  33618. */
  33619. SLASH = 191,
  33620. /**
  33621. * @en The back quote key `
  33622. * @zh 按键 `
  33623. */
  33624. BACK_QUOTE = 192,
  33625. /**
  33626. * @en The '[' key
  33627. * @zh 按键 [
  33628. */
  33629. BRACKET_LEFT = 219,
  33630. /**
  33631. * @en The back slash key '\'
  33632. * @zh 反斜杠键 '\'
  33633. */
  33634. BACKSLASH = 220,
  33635. /**
  33636. * @en The ']' key
  33637. * @zh 按键 ]
  33638. */
  33639. BRACKET_RIGHT = 221,
  33640. /**
  33641. * @en The quote key
  33642. * @zh 单引号键
  33643. */
  33644. QUOTE = 222,
  33645. /**
  33646. * @en The right shift key
  33647. * @zh 右 Shift 键
  33648. */
  33649. SHIFT_RIGHT = 2000,
  33650. /**
  33651. * @en The right ctrl key
  33652. * @zh 右 Ctrl 键
  33653. */
  33654. CTRL_RIGHT = 2001,
  33655. /**
  33656. * @en The right alt key
  33657. * @zh 右 Alt 键
  33658. */
  33659. ALT_RIGHT = 2002,
  33660. /**
  33661. * @en The numeric keypad enter
  33662. * @zh 数字键盘 enter
  33663. */
  33664. NUM_ENTER = 2003
  33665. }
  33666. /**
  33667. * @en The touch point class
  33668. * @zh 封装了触点相关的信息。
  33669. */
  33670. export class Touch {
  33671. get lastModified(): number;
  33672. /**
  33673. * @param x - x position of the touch point
  33674. * @param y - y position of the touch point
  33675. * @param id - The id of the touch point
  33676. */
  33677. constructor(x: number, y: number, id?: number);
  33678. /**
  33679. * @en Returns the current touch location in OpenGL coordinates.、
  33680. * @zh 获取当前触点位置。
  33681. * @param out - Pass the out object to avoid object creation, very good practice
  33682. */
  33683. getLocation(out?: math.Vec2): math.Vec2;
  33684. /**
  33685. * @en Returns X axis location value.
  33686. * @zh 获取当前触点 X 轴位置。
  33687. */
  33688. getLocationX(): number;
  33689. /**
  33690. * @en Returns Y axis location value.
  33691. * @zh 获取当前触点 Y 轴位置。
  33692. */
  33693. getLocationY(): number;
  33694. /**
  33695. * @en Returns the current touch location in UI coordinates.、
  33696. * @zh 获取当前触点在 UI 坐标系中的位置。
  33697. * @param out - Pass the out object to avoid object creation, very good practice
  33698. */
  33699. getUILocation(out?: math.Vec2): math.Vec2;
  33700. /**
  33701. * @en Returns X axis location value in UI coordinates.
  33702. * @zh 获取当前触点在 UI 坐标系中 X 轴位置。
  33703. */
  33704. getUILocationX(): number;
  33705. /**
  33706. * @en Returns Y axis location value in UI coordinates.
  33707. * @zh 获取当前触点在 UI 坐标系中 Y 轴位置。
  33708. */
  33709. getUILocationY(): number;
  33710. /**
  33711. * @en Returns the previous touch location.
  33712. * @zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  33713. * @param out - Pass the out object to avoid object creation, very good practice
  33714. */
  33715. getPreviousLocation(out?: math.Vec2): math.Vec2;
  33716. /**
  33717. * @en Returns the previous touch location in UI coordinates.
  33718. * @zh 获取触点在上一次事件时在 UI 坐标系中的位置对象,对象包含 x 和 y 属性。
  33719. * @param out - Pass the out object to avoid object creation, very good practice
  33720. */
  33721. getUIPreviousLocation(out?: math.Vec2): math.Vec2;
  33722. /**
  33723. * @en Returns the start touch location.
  33724. * @zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  33725. * @param out - Pass the out object to avoid object creation, very good practice
  33726. */
  33727. getStartLocation(out?: math.Vec2): math.Vec2;
  33728. /**
  33729. * @en Returns the start touch location in UI coordinates.
  33730. * @zh 获取触点落下时在 UI 坐标系中的位置对象,对象包含 x 和 y 属性。
  33731. * @param out - Pass the out object to avoid object creation, very good practice
  33732. */
  33733. getUIStartLocation(out?: math.Vec2): math.Vec2;
  33734. /**
  33735. * @en Returns the delta distance from the previous touche to the current one.
  33736. * @zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  33737. * @param out - Pass the out object to avoid object creation, very good practice
  33738. */
  33739. getDelta(out?: math.Vec2): math.Vec2;
  33740. /**
  33741. * @en Returns the delta distance from the previous touche to the current one in UI coordinates.
  33742. * @zh 获取触点距离上一次事件移动在 UI 坐标系中的距离对象,对象包含 x 和 y 属性。
  33743. * @param out - Pass the out object to avoid object creation, very good practice
  33744. */
  33745. getUIDelta(out?: math.Vec2): math.Vec2;
  33746. /**
  33747. * @en Returns the current touch location in screen coordinates.
  33748. * @zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  33749. * @param out - Pass the out object to avoid object creation, very good practice
  33750. */
  33751. getLocationInView(out?: math.Vec2): math.Vec2;
  33752. /**
  33753. * @en Returns the previous touch location in screen coordinates.
  33754. * @zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  33755. * @param out - Pass the out object to avoid object creation, very good practice
  33756. */
  33757. getPreviousLocationInView(out?: math.Vec2): math.Vec2;
  33758. /**
  33759. * @en Returns the start touch location in screen coordinates.
  33760. * @zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  33761. * @param out - Pass the out object to avoid object creation, very good practice
  33762. */
  33763. getStartLocationInView(out?: math.Vec2): math.Vec2;
  33764. /**
  33765. * @en Returns the id of the touch point.
  33766. * @zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  33767. */
  33768. getID(): number;
  33769. /**
  33770. * @en Resets touch point information.
  33771. * @zh 重置触点相关的信息。
  33772. * @param id - The id of the touch point
  33773. * @param x - x position of the touch point
  33774. * @param y - y position of the touch point
  33775. */
  33776. setTouchInfo(id?: number, x?: number, y?: number): void;
  33777. /**
  33778. * @en Sets touch point location.
  33779. * @zh 设置触点位置。
  33780. * @param point - The location
  33781. */
  33782. setPoint(point: math.Vec2): void;
  33783. /**
  33784. * @en Sets touch point location.
  33785. * @zh 设置触点位置。
  33786. * @param x - x position
  33787. * @param y - y position
  33788. */
  33789. setPoint(x: number, y: number): void;
  33790. /**
  33791. * @en Sets the location previously registered for the current touch.
  33792. * @zh 设置触点在前一次触发时收集的位置。
  33793. * @param point - The location
  33794. */
  33795. setPrevPoint(point: math.Vec2): void;
  33796. /**
  33797. * @en Sets the location previously registered for the current touch.
  33798. * @zh 设置触点在前一次触发时收集的位置。
  33799. * @param x - x position
  33800. * @param y - y position
  33801. */
  33802. setPrevPoint(x: number, y: number): void;
  33803. /**
  33804. * @zh Touch 对象的原始数据不应该被修改。如果你需要这么做,最好克隆一个新的对象。
  33805. * @en The original Touch object shouldn't be modified. If you need to, it's better to clone a new one.
  33806. */
  33807. clone(): Touch;
  33808. }
  33809. /**
  33810. * @en
  33811. * The singleton of the Input class, this singleton manages all events of input. include: touch, mouse, accelerometer, gamepad, handle, hmd and keyboard.
  33812. *
  33813. * @zh
  33814. * 输入类单例,该单例管理所有的输入事件,包括:触摸、鼠标、加速计、游戏手柄、6DOF手柄、头戴显示器 和 键盘。
  33815. *
  33816. * @example
  33817. * ```
  33818. * input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33819. * input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33820. * ```
  33821. */
  33822. export const input: Input;
  33823. /**
  33824. * @en
  33825. * This Input class manages all events of input. include: touch, mouse, accelerometer, gamepad, handle, hmd and keyboard.
  33826. * You can get the `Input` instance with `input`.
  33827. *
  33828. * @zh
  33829. * 该输入类管理所有的输入事件,包括:触摸、鼠标、加速计、游戏手柄、6DOF手柄、头戴显示器 和 键盘。
  33830. * 你可以通过 `input` 获取到 `Input` 的实例。
  33831. *
  33832. * @example
  33833. * ```
  33834. * input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33835. * input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33836. * ```
  33837. */
  33838. export class Input {
  33839. /**
  33840. * @en The input event type
  33841. * @zh 输入事件类型
  33842. */
  33843. static EventType: typeof __private._cocos_input_types_event_enum__InputEventType;
  33844. constructor();
  33845. /**
  33846. * @en
  33847. * Register a callback of a specific input event type.
  33848. * @zh
  33849. * 注册特定的输入事件回调。
  33850. *
  33851. * @param eventType - The event type
  33852. * @param callback - The event listener's callback
  33853. * @param target - The event listener's target and callee
  33854. */
  33855. on<K extends keyof __private._cocos_input_input__InputEventMap>(eventType: K, callback: __private._cocos_input_input__InputEventMap[K], target?: any): __private._cocos_input_input__InputEventMap[K];
  33856. /**
  33857. * @en
  33858. * Register a callback of a specific input event type once.
  33859. * @zh
  33860. * 注册单次的输入事件回调。
  33861. *
  33862. * @param eventType - The event type
  33863. * @param callback - The event listener's callback
  33864. * @param target - The event listener's target and callee
  33865. */
  33866. once<K extends keyof __private._cocos_input_input__InputEventMap>(eventType: K, callback: __private._cocos_input_input__InputEventMap[K], target?: any): __private._cocos_input_input__InputEventMap[K];
  33867. /**
  33868. * @en
  33869. * Unregister a callback of a specific input event type.
  33870. * @zh
  33871. * 取消注册特定的输入事件回调。
  33872. *
  33873. * @param eventType - The event type
  33874. * @param callback - The event listener's callback
  33875. * @param target - The event listener's target and callee
  33876. */
  33877. off<K extends keyof __private._cocos_input_input__InputEventMap>(eventType: K, callback?: __private._cocos_input_input__InputEventMap[K], target?: any): void;
  33878. /**
  33879. * @en
  33880. * Get touch object by touch ID.
  33881. * @zh
  33882. * 通过 touch ID 获取 touch对象。
  33883. */
  33884. getTouch(touchID: number): Readonly<Touch> | undefined;
  33885. /**
  33886. * @en
  33887. * Get all the current touches objects as array.
  33888. * @zh
  33889. * 获取当前 所有touch对象 的数组。
  33890. */
  33891. getAllTouches(): Touch[];
  33892. /**
  33893. * @en
  33894. * Get the number of touches.
  33895. * @zh
  33896. * 获取当前 touch 对象的数量。
  33897. */
  33898. getTouchCount(): number;
  33899. /**
  33900. * @en
  33901. * Sets whether to enable the accelerometer event listener or not.
  33902. *
  33903. * @zh
  33904. * 是否启用加速度计事件。
  33905. */
  33906. setAccelerometerEnabled(isEnable: boolean): void;
  33907. /**
  33908. * @en
  33909. * Sets the accelerometer interval value.
  33910. *
  33911. * @zh
  33912. * 设置加速度计间隔值。
  33913. */
  33914. setAccelerometerInterval(intervalInMileSeconds: number): void;
  33915. }
  33916. export namespace Input {
  33917. export type EventType = __private.__types_globals__EnumAlias<typeof __private._cocos_input_types_event_enum__InputEventType>;
  33918. }
  33919. /**
  33920. * @module cc
  33921. */
  33922. /**
  33923. * @en The singleton of the SystemEvent, there should only be one instance to be used globally
  33924. * @zh 系统事件单例,方便全局使用。
  33925. *
  33926. * @deprecated since v3.4.0, please use input instead.
  33927. */
  33928. export const systemEvent: SystemEvent;
  33929. /**
  33930. * @en
  33931. * The System event, it currently supports keyboard events and accelerometer events.<br/>
  33932. * You can get the `SystemEvent` instance with `systemEvent`.<br/>
  33933. * @zh
  33934. * 系统事件,它目前支持按键事件和重力感应事件。<br/>
  33935. * 你可以通过 `systemEvent` 获取到 `SystemEvent` 的实例。<br/>
  33936. *
  33937. * @deprecated since v3.4.0, please use Input class instead.
  33938. *
  33939. * @example
  33940. * ```
  33941. * import { systemEvent, SystemEvent } from 'cc';
  33942. * systemEvent.on(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33943. * systemEvent.off(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
  33944. * ```
  33945. */
  33946. export class SystemEvent extends EventTarget {
  33947. static EventType: typeof SystemEventType;
  33948. constructor();
  33949. /**
  33950. * @en
  33951. * Sets whether to enable the accelerometer event listener or not.
  33952. *
  33953. * @zh
  33954. * 是否启用加速度计事件。
  33955. */
  33956. setAccelerometerEnabled(isEnabled: boolean): void;
  33957. /**
  33958. * @en
  33959. * Sets the accelerometer interval value.
  33960. *
  33961. * @zh
  33962. * 设置加速度计间隔值。
  33963. */
  33964. setAccelerometerInterval(interval: number): void;
  33965. /**
  33966. * @en
  33967. * Register an callback of a specific system event type.
  33968. * @zh
  33969. * 注册特定事件类型回调。
  33970. *
  33971. * @param type - The event type
  33972. * @param callback - The event listener's callback
  33973. * @param target - The event listener's target and callee
  33974. * @param once - Register the event listener once
  33975. */
  33976. on<TFunction extends (...any: any[]) => void>(type: string, callback: TFunction, target?: unknown, once?: boolean): TFunction;
  33977. /**
  33978. * @en
  33979. * Removes the listeners previously registered with the same type, callback, target and or useCapture,
  33980. * if only type is passed as parameter, all listeners registered with that type will be removed.
  33981. * @zh
  33982. * 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  33983. *
  33984. * @param type - A string representing the event type being removed.
  33985. * @param callback - The callback to remove.
  33986. * @param target - The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  33987. */
  33988. off<K extends keyof __private._cocos_input_system_event__SystemEventMap>(type: K, callback?: __private._cocos_input_system_event__SystemEventMap[K], target?: any): void;
  33989. }
  33990. export namespace SystemEvent {
  33991. /**
  33992. * @en The event type supported by SystemEvent and Node events
  33993. * @zh SystemEvent 支持的事件类型以及节点事件类型
  33994. */
  33995. export type EventType = __private.__types_globals__EnumAlias<typeof SystemEventType>;
  33996. }
  33997. /**
  33998. * @zh 该对象提供由原生绑定出来的 JavaScript 接口。
  33999. * 注意:全局作用域下的 `jsb` 对象已经废弃,我们更推荐使用由 `cc` 模块下导出的 `native` 对象。
  34000. * 该对象是前者的子集,我们开放了一些开发者真正需要的原生接口,例如文件,反射等接口。
  34001. * 使用之前需要先通过 `NATIVE` 宏判断该接口在平台上是否支持。
  34002. *
  34003. * @en This object provides the JavaScript interface bound from the native.
  34004. * Note: `jsb` object in global scope is deprecated, we recommend using the exported `native` object from `cc` module.
  34005. * This object is a subset of the former, we open some interfaces that the developer really needs, such as file, reflection, etc.
  34006. * Before using, you need to check whether the interface is supported on the platform with the `NATIVE` constant.
  34007. *
  34008. * @example
  34009. * ```ts
  34010. * import { native } from 'cc';
  34011. * import { NATIVE } from 'cc/env';
  34012. *
  34013. * if (NATIVE) {
  34014. * native.reflection.callStaticMethod( ...args );
  34015. * }
  34016. * ```
  34017. */
  34018. export namespace native {
  34019. /**
  34020. * @en Copy text to clipboard @zh 拷贝字符串到剪切板
  34021. * @param text
  34022. */
  34023. function copyTextToClipboard(text: string): void;
  34024. /**
  34025. * @en Trigger garbage collection of ScriptEngine @zh 触发 ScriptEngine 的 GC
  34026. */
  34027. function garbageCollect(): void;
  34028. /**
  34029. * @en Save the image to the path indicated.
  34030. * @zh 保存图片到指定路径。
  34031. * @param data : @en the image data, should be raw data array with uint8 @zh 图片数据, 应为原始数据数组,uint8 格式。
  34032. * @param path : @en the path to save @zh 保存路径
  34033. * @param width : @en the width of the image @zh 图片宽度
  34034. * @param height : @en the height of the image @zh 图片高度
  34035. * @param filePath : @en the file path of the image @zh 图片文件路径
  34036. * @example
  34037. * ```ts
  34038. let renderTexture = new RenderTexture();
  34039. let renderWindowInfo = {
  34040. width: this._width,
  34041. height: this._height
  34042. };
  34043. renderTexture.reset(renderWindowInfo);
  34044. cameras.forEach((camera: any) => {
  34045. camera.targetTexture = renderTexture;
  34046. });
  34047. await this.waitForNextFrame();
  34048. cameras.forEach((camera: any) => {
  34049. camera.targetTexture = null;
  34050. });
  34051. let pixelData = renderTexture.readPixels();
  34052. native.saveImageData(pixelData, path, width, height, filePath).then(()=>{
  34053. console.log("Save image data success");
  34054. }).catch(()=>{
  34055. console.log("Fail to save image data");
  34056. });
  34057. */
  34058. function saveImageData(data: Uint8Array, width: number, height: number, filePath: string): Promise<void>;
  34059. export class EventAssetsManager {
  34060. getEventCode(): number;
  34061. getCURLECode(): number;
  34062. getCURLMCode(): number;
  34063. getMessage(): string;
  34064. getAssetId(): string;
  34065. getAssetsManagerEx(): AssetsManager;
  34066. isResuming(): boolean;
  34067. getPercent(): number;
  34068. getPercentByFile(): number;
  34069. getDownloadedBytes(): number;
  34070. getTotalBytes(): number;
  34071. getDownloadedFiles(): number;
  34072. getTotalFiles(): number;
  34073. constructor(eventName: string, manager: AssetsManager, code: number, assetId: string, message: string, curleCode: number, curlmCode: number);
  34074. }
  34075. export namespace EventAssetsManager {
  34076. export const ERROR_NO_LOCAL_MANIFEST: number;
  34077. export const ERROR_DOWNLOAD_MANIFEST: number;
  34078. export const ERROR_PARSE_MANIFEST: number;
  34079. export const NEW_VERSION_FOUND: number;
  34080. export const ALREADY_UP_TO_DATE: number;
  34081. export const UPDATE_PROGRESSION: number;
  34082. export const ASSET_UPDATED: number;
  34083. export const ERROR_UPDATING: number;
  34084. export const UPDATE_FINISHED: number;
  34085. export const UPDATE_FAILED: number;
  34086. export const ERROR_DECOMPRESS: number;
  34087. }
  34088. export interface ManifestAsset {
  34089. md5: string;
  34090. path: string;
  34091. compressed: boolean;
  34092. size: number;
  34093. downloadState: number;
  34094. }
  34095. export class Manifest {
  34096. /**
  34097. * @en Check whether the version informations have been fully loaded
  34098. * @zh 检查是否已加载版本信息
  34099. */
  34100. isVersionLoaded(): boolean;
  34101. /**
  34102. * @en Check whether the manifest have been fully loaded
  34103. * @zh 检查是否已加载 manifest
  34104. */
  34105. isLoaded(): boolean;
  34106. /**
  34107. * @en Gets remote package url.
  34108. * @zh 获取远程包的 URL
  34109. */
  34110. getPackageUrl(): string;
  34111. /**
  34112. * @en Gets remote manifest file url.
  34113. * @zh 获取远程 manifest 文件的 URL
  34114. */
  34115. getManifestFileUrl(): string;
  34116. /**
  34117. * @en Gets remote version file url.
  34118. * @zh 获取远程版本文件的 URL
  34119. */
  34120. getVersionFileUrl(): string;
  34121. /**
  34122. * @en Gets manifest version.
  34123. * @zh 获取远程 manifest 文件的版本
  34124. */
  34125. getVersion(): string;
  34126. /**
  34127. * @en Get the search paths list related to the Manifest.
  34128. * @zh 返回 Manifest 相关的搜索路径
  34129. */
  34130. getSearchPaths(): string[];
  34131. /**
  34132. * @en Get the manifest root path, normally it should also be the local storage path.
  34133. * @zh 获取 manifest 的根路径, 一般为本地存储目录.
  34134. */
  34135. getManifestRoot(): string;
  34136. constructor(content: string, manifestRoot: string);
  34137. constructor(manifestUrl: string);
  34138. /**
  34139. * @en Parse the manifest file information into this manifest
  34140. * @zh 解析 manifest 文件
  34141. * @param manifestUrl @en Url of the local manifest @zh 文件路径
  34142. */
  34143. parseFile(manifestUrl: string): void;
  34144. /**
  34145. * @en Parse the manifest from json string into this manifest
  34146. * @zh 解析 manifest 的 JSON 文件
  34147. * @param content @en Json string content @zh JSON 文本
  34148. * @param manifestRoot @en The root path of the manifest file (It should be local path,
  34149. * so that we can find assets path relative to the root path) @zh manifest 根路径
  34150. */
  34151. parseJSONString(content: string, manifestRoot: string): void;
  34152. /**
  34153. * @en Get whether the manifest is being updating
  34154. * @en 是否在更新
  34155. * @return @en Updating or not @zh 是否在更新
  34156. */
  34157. isUpdating(): boolean;
  34158. /**
  34159. * @en Set whether the manifest is being updating
  34160. * @zh 设置更新状态
  34161. * @param updating @en Updating or not @zh 是否更新
  34162. */
  34163. setUpdating(updating: boolean): void;
  34164. }
  34165. export namespace Manifest {
  34166. export enum DownloadState {
  34167. UNSTARTED,
  34168. DOWNLOADING,
  34169. SUCCESSED,
  34170. UNMARKED
  34171. }
  34172. }
  34173. export class AssetsManager {
  34174. /**
  34175. * @en Create function for creating a new AssetsManagerEx
  34176. *
  34177. * warning The cached manifest in your storage path have higher priority and will be searched first,
  34178. * only if it doesn't exist, AssetsManagerEx will use the given manifestUrl.
  34179. *
  34180. * @zh 创建 AssetManager
  34181. *
  34182. * @param manifestUrl @en The url for the local manifest file @zh manifest 文件路径
  34183. * @param storagePath @en The storage path for downloaded assets @zh 存储路径
  34184. */
  34185. static create(manifestUrl: string, storagePath: string): AssetsManager;
  34186. constructor(manifestUrl: string, storagePath: string, handle: (arg1: string, arg2: string) => number);
  34187. constructor(manifestUrl: string, storagePath: string);
  34188. /**
  34189. * @en Check out if there is a new version of manifest.
  34190. * You may use this method before updating, then let user determine whether
  34191. * he wants to update resources.
  34192. * @zh 检查更新
  34193. */
  34194. checkUpdate(): void;
  34195. /**
  34196. * @en Prepare the update process, this will cleanup download process flags,
  34197. * fill up download units with temporary manifest or remote manifest
  34198. * @zh 准备更新
  34199. */
  34200. prepareUpdate(): void;
  34201. /**
  34202. * @en Update with the current local manifest.
  34203. * @zh 执行更新
  34204. */
  34205. update(): void;
  34206. /**
  34207. * @en Reupdate all failed assets under the current AssetsManagerEx context
  34208. * @zh 重新下载之前失败的资源
  34209. */
  34210. downloadFailedAssets(): void;
  34211. /**
  34212. * @en Gets the current update state.
  34213. * @zh 返回当前的状态码
  34214. */
  34215. getState(): number;
  34216. /**
  34217. * @en Gets storage path.
  34218. * @zh 获取存储路径
  34219. */
  34220. getStoragePath(): string;
  34221. /**
  34222. * @en Function for retrieving the local manifest object
  34223. * @zh 获取本地 manifest 路径
  34224. */
  34225. getLocalManifest(): Manifest;
  34226. /**
  34227. * @en Load a local manifest from url.
  34228. *
  34229. * You can only manually load local manifest when the update state is UNCHECKED, it will fail once the update process is began.
  34230. *
  34231. * This API will do the following things:
  34232. *
  34233. * 1. Reset storage path
  34234. *
  34235. * 2. Set local storage
  34236. *
  34237. * 3. Search for cached manifest and compare with the local manifest
  34238. *
  34239. * 4. Init temporary manifest and remote manifest
  34240. *
  34241. * If successfully load the given local manifest and inited other manifests, it will return true, otherwise it will return false
  34242. * @zh 加载本地的 manifest
  34243. * @param manifestUrl @en The local manifest url @zh manifest 路径
  34244. */
  34245. loadLocalManifest(manifestUrl: string): boolean;
  34246. /**
  34247. * @en Load a custom local manifest object, the local manifest must be loaded already.
  34248. *
  34249. * You can only manually load local manifest when the update state is UNCHECKED, it will fail once the update process is began.
  34250. *
  34251. * This API will do the following things:
  34252. *
  34253. * 1. Reset storage path
  34254. *
  34255. * 2. Set local storage
  34256. *
  34257. * 3. Search for cached manifest and compare with the local manifest
  34258. *
  34259. * 4. Init temporary manifest and remote manifest
  34260. *
  34261. * If successfully load the given local manifest and inited other manifests, it will return true, otherwise it will return false
  34262. * @zh 加载本地的 manifest
  34263. *
  34264. * @param localManifest @en The local manifest object to be set @zh manifest 对象
  34265. *
  34266. * @param storagePath @en The local storage path @zh 存储路径
  34267. */
  34268. loadLocalManifest(localManifest: Manifest, storagePath: string): boolean;
  34269. /**
  34270. * @en Function for retrieving the remote manifest object
  34271. * @zh 获取远程的 manifest 对象
  34272. */
  34273. getRemoteManifest(): Manifest;
  34274. /**
  34275. * @en Load a custom remote manifest object, the manifest must be loaded already.
  34276. *
  34277. * You can only manually load remote manifest when the update state is UNCHECKED and local manifest is already inited,
  34278. * it will fail once the update process is began.
  34279. * @zh 加载自定义i的远程 manifest 对象
  34280. * @param remoteManifest @en The remote manifest object to be set @zh manifest 对象
  34281. */
  34282. loadRemoteManifest(remoteManifest: Manifest): boolean;
  34283. /**
  34284. * @en Gets whether the current download is resuming previous unfinished job,
  34285. * this will only be available after READY_TO_UPDATE state,
  34286. * under unknown states it will return false by default.
  34287. * @zh 是否在恢复状态
  34288. */
  34289. isResuming(): boolean;
  34290. /**
  34291. * @en Gets the total byte size to be downloaded of the update, this will only be available
  34292. * after READY_TO_UPDATE state, under unknown states it will return 0 by default.
  34293. * @zh 需要下载或者更新的总字节数
  34294. */
  34295. getTotalBytes(): number;
  34296. /**
  34297. * @en Gets the current downloaded byte size of the update, this will only be available
  34298. * after READY_TO_UPDATE state, under unknown states it will return 0 by default.
  34299. * @zh 已下载的字节数
  34300. */
  34301. getDownloadedBytes(): number;
  34302. /**
  34303. * @en Gets the total files count to be downloaded of the update, this will only be available
  34304. * after READY_TO_UPDATE state, under unknown states it will return 0 by default.
  34305. * @zh 需要下载的总的文件数目
  34306. */
  34307. getTotalFiles(): number;
  34308. /**
  34309. * @en Gets the current downloaded files count of the update, this will only be available
  34310. * after READY_TO_UPDATE state, under unknown states it will return 0 by default.
  34311. * @zh 已下载的文件数目
  34312. */
  34313. getDownloadedFiles(): number;
  34314. /**
  34315. * @en Function for retrieving the max concurrent task count
  34316. * @zh 下载的最大并发数
  34317. */
  34318. getMaxConcurrentTask(): number;
  34319. /**
  34320. * @en Function for setting the max concurrent task count
  34321. * @zh 设置下载的最大并发数目
  34322. */
  34323. setMaxConcurrentTask(max: number): void;
  34324. /**
  34325. * @en Set the handle function for comparing manifests versions
  34326. * @zh 设置版本比对函数
  34327. *
  34328. * @param handle @en The compare function @zh 比较函数
  34329. */
  34330. setVersionCompareHandle(handle: (arg1: string, arg2: string) => number): void;
  34331. /**
  34332. * @en Set the verification function for checking whether downloaded asset is correct, e.g. using md5 verification
  34333. * @zh 设置内容校验函数
  34334. * @param callback @en The verify callback function @zh 校验函数
  34335. */
  34336. setVerifyCallback(callback: (arg1: string, arg: ManifestAsset) => boolean): void;
  34337. /**
  34338. * @en Set the event callback for receiving update process events
  34339. * @zh 设置更新事件处理回调
  34340. * @param callback @en The event callback function @zh 事件处理回调
  34341. */
  34342. setEventCallback(callback: (arg: EventAssetsManager) => void): void;
  34343. }
  34344. export namespace AssetsManager {
  34345. export enum State {
  34346. UNINITED,
  34347. UNCHECKED,
  34348. PREDOWNLOAD_VERSION,
  34349. DOWNLOADING_VERSION,
  34350. VERSION_LOADED,
  34351. PREDOWNLOAD_MANIFEST,
  34352. DOWNLOADING_MANIFEST,
  34353. MANIFEST_LOADED,
  34354. NEED_UPDATE,
  34355. READY_TO_UPDATE,
  34356. UPDATING,
  34357. UNZIPPING,
  34358. UP_TO_DATE,
  34359. FAIL_TO_UPDATE
  34360. }
  34361. }
  34362. /**
  34363. * @en DownloadTask @zh 下载任务对象
  34364. * @param requestURL @en Request download resource URL @zh 请求下载资源的URL
  34365. * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
  34366. * @param identifier @en identifier @zh 标识符
  34367. */
  34368. export interface DownloadTask {
  34369. requestURL: string;
  34370. storagePath: string;
  34371. identifier: string;
  34372. }
  34373. /**
  34374. * @en DownloaderTask @zh 下载任务对象
  34375. * @param requestURL @en Request download resource URL @zh 请求下载资源的URL
  34376. * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
  34377. * @param identifier @en identifier @zh 标识符
  34378. * @deprecated since v3.7.0, please use `DownloadTask` to instead.
  34379. */
  34380. export interface DownloaderTask {
  34381. requestURL: string;
  34382. storagePath: string;
  34383. identifier: string;
  34384. }
  34385. /**
  34386. * @en DownloaderHints @zh 下载任务的配置接口
  34387. * @param countOfMaxProcessingTasks
  34388. * @en Maximum number of download tasks processed at the same time, optional, default is 6
  34389. * @zh 同时处理的最大下载任务数量, 可选, 默认值为6
  34390. * @param timeoutInSeconds @en Download request timeout, optional, default is 45 seconds @zh 下载请求的超时时间, 可选, 默认值为45秒
  34391. * @param tempFileNameSuffix @en Temporary file suffix generated during download, optional, default is .tmp @zh 下载时产生的临时文件后缀, 可选, 默认值为.tmp
  34392. */
  34393. export interface DownloaderHints {
  34394. countOfMaxProcessingTasks?: number;
  34395. timeoutInSeconds?: number;
  34396. tempFileNameSuffix?: string;
  34397. }
  34398. /**
  34399. * @en Downloader class for task download
  34400. * @zh Downloader 任务下载类
  34401. */
  34402. export class Downloader {
  34403. /**
  34404. * @en Downloader default constructor, constructed by the default value of DownloaderHints.
  34405. * @zh Downloader的默认构造函数, 通过DownloaderHints的默认值构造.
  34406. * @example
  34407. * ```ts
  34408. * let downloader = new native.Downloader(); // create a Downloader object by default constructor
  34409. * ```
  34410. */
  34411. constructor();
  34412. /**
  34413. * @en Downloader constructor with parameter, constructed by DownloaderHints.
  34414. * @zh Downloader的有参构造函数, 通过传递的DownloaderHints去构造.
  34415. * @example
  34416. * ```ts
  34417. * const hints: native.DownloaderHints = { // create a DownloaderHints interface
  34418. * countOfMaxProcessingTasks: 6,
  34419. * timeoutInSeconds: 100,
  34420. * tempFileNameSuffix: ".tmp"
  34421. * };
  34422. * let downloader = new native.Downloader(hints); // create a Downloader object with DownloaderHints
  34423. * ```
  34424. */
  34425. constructor(hints: DownloaderHints);
  34426. /**
  34427. * @en abort a download task, which could be downloaded from last break point.
  34428. * @zh 中止一个下载任务. 被终止的任务可以在之后被续传.
  34429. * @param task @en DownloadTask need to abort @zh 需要中止的下载任务
  34430. */
  34431. abort(task: DownloadTask): void;
  34432. /**
  34433. * @en create a download task. The maximum size for a single download file is 4GB.
  34434. * @zh 创建一个下载任务. 单个下载文件最大为4GB.
  34435. * @param requestURL
  34436. * @en Request download resource URL. Node: Users need to encode the URL containing special characters except spaces (such as Chinese, etc.)
  34437. * @zh 请求下载资源的URL. 注意: 当URL中包含除空格外特殊字符(如:中文等)时需要用户自行编码后传入.
  34438. * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
  34439. * @param identifier @en identifier @zh 标识符
  34440. * @return @en DownloadTask @zh 下载任务对象
  34441. * @example
  34442. * ```ts
  34443. * let task = downloader.createDownloadTask('https://example.com/exampleFile.zip', native.fileUtils.getWritablePath());
  34444. * ```
  34445. */
  34446. createDownloadTask(requestURL: string, storagePath: string, identifier?: string): DownloadTask;
  34447. /**
  34448. * @en setter for the callback function after download success
  34449. * @zh 任务成功下载后的回调函数的修改器
  34450. * @param task @en download task @zh 下载的任务
  34451. * @example
  34452. * ```ts
  34453. * // set a download success callback
  34454. * downloader.onSuccess = (task) => {
  34455. * console.log('Success!'); // call when task download success
  34456. * };
  34457. * ```
  34458. */
  34459. onSuccess: (task: DownloadTask) => void | undefined;
  34460. /**
  34461. * @en setter for the callback function while download.
  34462. * @zh 任务下载过程中的回调函数的修改器.
  34463. * @param task @en download task @zh 下载任务
  34464. * @param bytesReceived @en received bytes in current call @zh 此次接收到的字节
  34465. * @param totalBytesReceived @en total bytes have been received @zh 已接收到的所有字节
  34466. * @param totalBytesExpected @en total bytes expected to receive @zh 预计接收的所有字节
  34467. * @example
  34468. * ```ts
  34469. * // setter for the callback for download progress prompt
  34470. * downloader.onProgress = (task, bytesReceived, totalBytesReceived, totalBytesExpected) => {
  34471. * console.log(bytesReceived, totalBytesReceived); // download data info
  34472. * console.log(totalBytesReceived / totalBytesExpected * 100).toFixed(1) + '%'); // progress prompt
  34473. * };
  34474. * ```
  34475. */
  34476. onProgress: (task: DownloadTask, bytesReceived: number, totalBytesReceived: number, totalBytesExpected: number) => void | undefined;
  34477. /**
  34478. * @en setter for the callback function when download error
  34479. * @zh 任务下载发生错误时的回调函数的修改器
  34480. * @param task @en download task @zh 下载任务
  34481. * @param errorCode @en error code @zh 错误码
  34482. * @param errorCodeInternal @en internal error code @zh 内部错误码
  34483. * @param errorStr @en error info string @zh 错误信息
  34484. * @example
  34485. * ```ts
  34486. * // set a download error callback
  34487. * downloader.onError = (task, errorCode, errorCodeInternal, errorStr) => {
  34488. * console.log('Error:', errorStr);
  34489. * };
  34490. */
  34491. onError: (task: DownloadTask, errorCode: number, errorCodeInternal: number, errorStr: string) => void | undefined;
  34492. /**
  34493. * @deprecated since v3.6.0, please use `createDownloadTask` to instead.
  34494. * @en create a download task. The maximum size for a single download file is 4GB.
  34495. * @zh 创建一个下载任务. 单个下载文件最大为4GB.
  34496. * @param requestURL
  34497. * @en Request download resource URL. Node: Users need to encode the URL containing special characters except spaces (such as Chinese, etc.)
  34498. * @zh 请求下载资源的URL. 注意: 当URL中包含除空格外特殊字符(如:中文等)时需要用户自行编码后传入.
  34499. * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
  34500. * @param identifier @en identifier @zh 标识符
  34501. * @return @en DownloadTask @zh 下载任务对象
  34502. * @example
  34503. * ```ts
  34504. * let task = downloader.createDownloadFileTask('https://example.com/exampleFile.zip', native.fileUtils.getWritablePath());
  34505. * ```
  34506. */
  34507. createDownloadFileTask(requestURL: string, storagePath: string, identifier?: string): DownloadTask;
  34508. /**
  34509. * @deprecated since v3.6.0, please use setter `onSuccess` to instead.
  34510. * @en set callback function after download success
  34511. * @zh 设置任务成功下载后的回调函数
  34512. * @param onSucceed @en Download success callback @zh 下载成功后的回调函数
  34513. * @example
  34514. * ```ts
  34515. * // set a download success callback
  34516. * downloader.setOnFileTaskSuccess((task)=>{
  34517. * console.log('Success!'); // call when task download success
  34518. * });
  34519. * ```
  34520. */
  34521. setOnFileTaskSuccess(onSucceed: (task: DownloadTask) => void): void;
  34522. /**
  34523. * @deprecated since v3.6.0, please use setter `onProgress` to instead.
  34524. * @en set callback function while download.
  34525. * @zh 设置任务下载过程中的回调函数.
  34526. * @param onProgress @en Download progress callback @zh 下载过程中的回调函数
  34527. * @example
  34528. * ```ts
  34529. * // set a callback for download progress prompt
  34530. * downloader.setOnTaskProgress((task, bytesReceived, totalBytesReceived, totalBytesExpected)=>{
  34531. * console.log(bytesReceived, totalBytesReceived); // download data info
  34532. * console.log(totalBytesReceived / totalBytesExpected * 100).toFixed(1) + '%'); // progress prompt
  34533. * });
  34534. * ```
  34535. */
  34536. setOnTaskProgress(onProgress: (task: DownloadTask, bytesReceived: number, totalBytesReceived: number, totalBytesExpected: number) => void): void;
  34537. /**
  34538. * @deprecated since v3.6.0, please use setter `onError` to instead.
  34539. * @en set callback function when download error
  34540. * @zh 设置任务下载发生错误时的回调函数
  34541. * @param onError @en Download error callback @zh 下载发生错误时的回调函数
  34542. * @example
  34543. * ```ts
  34544. * // set a download error callback
  34545. * downloader.setOnTaskError((task, errorCode, errorCodeInternal, errorStr)=>{
  34546. * console.log('Error:', errorStr);
  34547. * });
  34548. * ```
  34549. */
  34550. setOnTaskError(onError: (task: DownloadTask, errorCode: number, errorCodeInternal: number, errorStr: string) => void): void;
  34551. }
  34552. /**
  34553. * @en ZipUtils Helper class to handle unzip related operations.
  34554. * @zh ZipUtils 对解压操作的辅助类。
  34555. */
  34556. export namespace zipUtils {
  34557. /**
  34558. * @en
  34559. * Inflates either zlib or gzip deflated memory. The inflated memory is expected to be freed by the caller.
  34560. * It will allocate 256k for the destination buffer.
  34561. * If it is not enough it will multiply the previous buffer size per 2, until there is enough memory.
  34562. *
  34563. * @zh
  34564. * 对 zlib 或 gzip 压缩的内存进行解压缩。解压后的数据需要在调用方中进行内存释放。
  34565. * 它会给目标内存分配 256k 大小的空间。如果不足以解压,它将会将目标空间扩大 2 倍直到足够大。
  34566. *
  34567. * @param input @en input data @zh 要解压的数据
  34568. * @param outLengthHint @en It is assumed to be the needed room to allocate the inflated buffer, which is optional. @zh 预计解压后的数据长度,可选。
  34569. *
  34570. * @return @en The deflated buffer. @zh 解压后的数据缓存区
  34571. */
  34572. function inflateMemory(input: string | ArrayBuffer | __private.__types_globals__TypedArray, outLengthHint?: number): ArrayBuffer | null;
  34573. /**
  34574. * @en Inflates a GZip file into memory.
  34575. * @zh 将 GZip 压缩文件解压缩到内存中。
  34576. *
  34577. * @param path @en The GZip file path. @zh GZip 文件的路径
  34578. *
  34579. * @return @en The deflated buffer. @zh 解压后的数据缓存区
  34580. */
  34581. function inflateGZipFile(path: string): ArrayBuffer | null;
  34582. /**
  34583. * @en Test a file is a GZip format file or not.
  34584. * @zh 判断一个文件是否是 GZip 格式。
  34585. *
  34586. * @param path @en The file path. @zh 文件的路径
  34587. *
  34588. * @return @en True is a GZip format file. false is not. @zh true GZip 格式文件,否则不是。
  34589. */
  34590. function isGZipFile(path: string): boolean;
  34591. /**
  34592. * @en Test the buffer is GZip format or not.
  34593. * @zh 判断一个缓存区的数据是否是 GZip 格式。
  34594. *
  34595. * @param buffer @en The buffer. @zh 数据缓存区
  34596. *
  34597. * @return @en True is GZip format. false is not. @zh 返回true表示是 GZip 格式,否则不是。
  34598. */
  34599. function isGZipBuffer(buffer: string | ArrayBuffer | __private.__types_globals__TypedArray): boolean;
  34600. /**
  34601. * @en Inflates a CCZ file into memory.
  34602. * @zh 将 CCZ 格式压缩文件解压缩到内存中。
  34603. *
  34604. * @param path @en The CCZ file path. @zh CCZ 文件的路径
  34605. * @return @en The deflated buffer. @zh 解压后的数据缓存区
  34606. */
  34607. function inflateCCZFile(path: string): ArrayBuffer | null;
  34608. /**
  34609. * @en Inflates a buffer with CCZ format into memory.
  34610. * @zh 将 CCZ 格式的内存块解压到内存中。
  34611. *
  34612. * @param buffer @en The buffer. @zh 数据缓存区
  34613. *
  34614. * @return @en The deflated buffer. @zh 解压后的数据缓存区
  34615. */
  34616. function inflateCCZBuffer(buffer: string | ArrayBuffer | __private.__types_globals__TypedArray): ArrayBuffer | null;
  34617. /**
  34618. * @en Test a file is a CCZ format file or not.
  34619. * @zh 判断一个文件是否是 CCZ 格式。
  34620. *
  34621. * @return @en True is a CCZ format file. false is not. @zh 返回true表示是 CCZ 格式,否则不是。
  34622. */
  34623. function isCCZFile(path: string): boolean;
  34624. /**
  34625. * @en Test the buffer is CCZ format or not.
  34626. * @zh 判断一个缓存区的数据是否是 CCZ 格式。
  34627. *
  34628. * @ param @en The buffer. @zh 数据缓存区
  34629. *
  34630. * @return @en True is CCZ format. false is not. @zh 返回true表示是 CCZ 格式,否则不是。
  34631. */
  34632. function isCCZBuffer(buffer: string | ArrayBuffer | __private.__types_globals__TypedArray): boolean;
  34633. /**
  34634. * @en
  34635. * Sets the pvr.ccz encryption key parts separately for added security.
  34636. *
  34637. * Example: If the key used to encrypt the pvr.ccz file is
  34638. * 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4
  34639. * different times, preferably from 4 different source files, as follows
  34640. *
  34641. * setPvrEncryptionKeyPart(0, 0xaaaaaaaa);
  34642. * setPvrEncryptionKeyPart(1, 0xbbbbbbbb);
  34643. * setPvrEncryptionKeyPart(2, 0xcccccccc);
  34644. * setPvrEncryptionKeyPart(3, 0xdddddddd);
  34645. *
  34646. * Splitting the key into 4 parts and calling the function from 4 different source
  34647. * files increases the difficulty to reverse engineer the encryption key.
  34648. * Be aware that encryption is *never* 100% secure and the key code
  34649. * can be cracked by knowledgeable persons.
  34650. *
  34651. * IMPORTANT: Be sure to call setPvrEncryptionKey or
  34652. * setPvrEncryptionKeyPart with all of the key parts *before* loading
  34653. * the sprite sheet or decryption will fail and the sprite sheet
  34654. * will fail to load.
  34655. *
  34656. * @zh
  34657. * 设置 pvr.ccz 加密密钥的部分,以增加安全性。
  34658. *
  34659. * 例如:如果使用来加密 pvr.ccz 文件的密钥为 0xaaaaaaaabbbbbbbbccccccccdddddddd,
  34660. * 则你可以调用此函数 4 次,至少来自 4 个不同的源文件,如下所示:
  34661. *
  34662. * setPvrEncryptionKeyPart(0, 0xaaaaaaaa);
  34663. * setPvrEncryptionKeyPart(1, 0xbbbbbbbb);
  34664. * setPvrEncryptionKeyPart(2, 0xcccccccc);
  34665. * setPvrEncryptionKeyPart(3, 0xdddddddd);
  34666. *
  34667. * 将密钥分成 4 个部分并调用此函数来自 4 个不同的源文件增加解密密钥的难度。
  34668. * 请注意,加密是从不完全安全的,密钥码可以被知道的人破解。
  34669. *
  34670. * 注意:调用 setPvrEncryptionKey 或 setPvrEncryptionKeyPart 函数之前,
  34671. * 请确保已经调用了 setPvrEncryptionKeyPart 函数,否则解密将失败,并且加载精灵图集将失败。
  34672. *
  34673. * @param index @en Part of the key [0..3]. @zh 密钥[0..3]的部分。
  34674. * @param value @en Value of the key part. @zh 密钥部分的值。
  34675. */
  34676. function setPvrEncryptionKeyPart(index: number, value: number): void;
  34677. /**
  34678. * @en
  34679. * Sets the pvr.ccz encryption key.
  34680. * Example: If the key used to encrypt the pvr.ccz file is
  34681. * 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with
  34682. * the key split into 4 parts as follows
  34683. *
  34684. * setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);
  34685. *
  34686. * Note that using this function makes it easier to reverse engineer and discover
  34687. * the complete key because the key parts are present in one function call.
  34688. *
  34689. * IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart
  34690. * with all of the key parts *before* loading the sprite sheet or decryption
  34691. * will fail and the sprite sheet will fail to load.
  34692. *
  34693. * @zh
  34694. * 设置 pvr.ccz 加密密钥。
  34695. * 例如:如果使用来加密 pvr.ccz 文件的密钥为 0xaaaaaaaabbbbbbbbccccccccdddddddd,
  34696. * 则你可以调用此函数,将密钥分成 4 个部分如下:
  34697. *
  34698. * setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);
  34699. *
  34700. * 注意:确保在加载精灵图集之前通过所有的密钥部分调用 setPvrEncryptionKey 或 setPvrEncryptionKeyPart,否则解密将失败,并且加载精灵图集将失败。
  34701. *
  34702. * @param keyPart1 @en The key value part 1. @zh 密钥部分 1 的值。
  34703. * @param keyPart2 @en The key value part 2. @zh 密钥部分 2 的值。
  34704. * @param keyPart3 @en The key value part 3. @zh 密钥部分 3 的值。
  34705. * @param keyPart4 @en The key value part 4. @zh 密钥部分 4 的值。
  34706. */
  34707. function setPvrEncryptionKey(keyPart1: number, keyPart2: number, keyPart3: number, keyPart4: number): void;
  34708. }
  34709. /**
  34710. * FileUtils Helper class to handle file operations.
  34711. */
  34712. export namespace fileUtils {
  34713. /**
  34714. * @en
  34715. * Checks whether the path is an absolute path.
  34716. *
  34717. * @zh
  34718. * 判断文件是否是绝对路径
  34719. * @note On Android, if the parameter passed in is relative to "@assets/", this method will treat it as an absolute path.
  34720. * Also on Blackberry, path starts with "app/native/Resources/" is treated as an absolute path.
  34721. *
  34722. * @param path The path that needs to be checked.
  34723. * @return True if it's an absolute path, false if not.
  34724. */
  34725. function isAbsolutePath(path: string): boolean;
  34726. /**
  34727. * @en
  34728. * Returns the fullpath for a given filename.
  34729. *
  34730. First it will try to get a new filename from the "filenameLookup" dictionary.
  34731. If a new filename can't be found on the dictionary, it will use the original filename.
  34732. Then it will try to obtain the full path of the filename using the FileUtils search rules: resolutions, and search paths.
  34733. The file search is based on the array element order of search paths and resolution directories.
  34734. For instance:
  34735. We set two elements("/mnt/sdcard/", "internal_dir/") to search paths vector by setSearchPaths,
  34736. and set three elements("resources-ipadhd/", "resources-ipad/", "resources-iphonehd")
  34737. to resolutions vector by setSearchResolutionsOrder. The "internal_dir" is relative to "Resources/".
  34738. If we have a file named 'sprite.png', the mapping in fileLookup dictionary contains `key: sprite.png -> value: sprite.pvr.gz`.
  34739. Firstly, it will replace 'sprite.png' with 'sprite.pvr.gz', then searching the file sprite.pvr.gz as follows:
  34740. /mnt/sdcard/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  34741. /mnt/sdcard/resources-ipad/sprite.pvr.gz (if not found, search next)
  34742. /mnt/sdcard/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  34743. /mnt/sdcard/sprite.pvr.gz (if not found, search next)
  34744. internal_dir/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  34745. internal_dir/resources-ipad/sprite.pvr.gz (if not found, search next)
  34746. internal_dir/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  34747. internal_dir/sprite.pvr.gz (if not found, return "sprite.png")
  34748. If the filename contains relative path like "gamescene/uilayer/sprite.png",
  34749. and the mapping in fileLookup dictionary contains `key: gamescene/uilayer/sprite.png -> value: gamescene/uilayer/sprite.pvr.gz`.
  34750. The file search order will be:
  34751. /mnt/sdcard/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  34752. /mnt/sdcard/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  34753. /mnt/sdcard/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  34754. /mnt/sdcard/gamescene/uilayer/sprite.pvr.gz (if not found, search next)
  34755. internal_dir/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  34756. internal_dir/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  34757. internal_dir/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  34758. internal_dir/gamescene/uilayer/sprite.pvr.gz (if not found, return "gamescene/uilayer/sprite.png")
  34759. If the new file can't be found on the file system, it will return the parameter filename directly.
  34760. This method was added to simplify multiplatform support.
  34761. Whether you are using cocos2d-js or any cross-compilation toolchain like StellaSDK or Apportable,
  34762. you might need to load different resources for a given file in the different platforms.
  34763. * @zh
  34764. * 通过文件名获取绝对路径
  34765. * @since v2.1
  34766. */
  34767. function fullPathForFilename(filename: string): string;
  34768. /**
  34769. *
  34770. * @en
  34771. * Gets string from a file.
  34772. *
  34773. * @zh
  34774. * 读取文件里的字符串
  34775. *
  34776. */
  34777. function getStringFromFile(filename: string): string;
  34778. /**
  34779. * @en
  34780. * Removes a file.
  34781. *
  34782. * @zh
  34783. * 删除文件
  34784. *
  34785. * @param filepath The full path of the file, it must be an absolute path.
  34786. * @return True if the file have been removed successfully, false if not.
  34787. */
  34788. function removeFile(filepath: string): boolean;
  34789. /**
  34790. * @en
  34791. * Checks whether the path is a directory.
  34792. *
  34793. * @zh
  34794. * 检测目录是否存在
  34795. *
  34796. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  34797. * @return True if the directory exists, false if not.
  34798. */
  34799. function isDirectoryExist(dirPath: string): boolean;
  34800. /**
  34801. * @en
  34802. * Normalize: remove . and ..
  34803. *
  34804. * @zh
  34805. * 标准化:去除'.' 和 '..'
  34806. *
  34807. * @param filepath
  34808. */
  34809. function normalizePath(filepath: string): string;
  34810. /**
  34811. * @en
  34812. * Gets the array of search paths.
  34813. *
  34814. * @zh
  34815. * 获取默认资源根路径
  34816. *
  34817. */
  34818. function getDefaultResourceRootPath(): string;
  34819. /**
  34820. * @en
  34821. * Converts the contents of a file to a ValueVector.
  34822. * This method is used internally.
  34823. *
  34824. * @zh
  34825. * 将文件的内容转换为 ValueVector
  34826. * 这个方法是内部使用的
  34827. */
  34828. function getValueVectorFromFile(filepath: string): Array<any>;
  34829. /**
  34830. * @en
  34831. * Gets the array of search paths.
  34832. *
  34833. * @zh
  34834. * 获取所有的搜索路径
  34835. *
  34836. * @return The array of search paths which may contain the prefix of default resource root path.
  34837. * @note In best practise, getter function should return the value of setter function passes in.
  34838. * But since we should not break the compatibility, we keep using the old logic.
  34839. * Therefore, If you want to get the original search paths, please call 'getOriginalSearchPaths()' instead.
  34840. * @see fullPathForFilename (const char*).
  34841. * @lua NA
  34842. */
  34843. function getSearchPaths(): Array<string>;
  34844. /**
  34845. * @en
  34846. * Get the directory where the file is located by the file path.
  34847. *
  34848. * @zh
  34849. * 通过文件路径获取文件所在目录
  34850. * @param filepath
  34851. */
  34852. function getFileDir(filepath: string): string;
  34853. /**
  34854. * @en
  34855. * write a ValueMap into a plist file.
  34856. *
  34857. * @zh
  34858. * 将 ValueMap 写入 plist 文件
  34859. *
  34860. * @param dict the ValueMap want to save (key,value)
  34861. * @return bool
  34862. */
  34863. function writeToFile(valueMap: any): boolean;
  34864. /**
  34865. * @en
  34866. * Gets the original search path array set by 'setSearchPaths' or 'addSearchPath'.
  34867. *
  34868. * @zh
  34869. * 获取由“setSearchPaths”或“addSearchPath”设置的原始搜索路径数组。
  34870. *
  34871. * @return The array of the original search paths
  34872. */
  34873. function getOriginalSearchPaths(): Array<string>;
  34874. /**
  34875. * @en
  34876. * List all files in a directory
  34877. *
  34878. * @zh
  34879. * 在文件夹中列出所有文件
  34880. *
  34881. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  34882. * @return File paths in a string vector
  34883. */
  34884. function listFiles(filepath: string): Array<string>;
  34885. /**
  34886. * @en
  34887. * Converts the contents of a file to a ValueMap.
  34888. *
  34889. * @zh
  34890. * 转换文件内容为ValueMap
  34891. *
  34892. * @param filename The filename of the file to gets content.
  34893. * @return ValueMap of the file contents.
  34894. * @note This method is used internally.
  34895. */
  34896. function getValueMapFromFile(filepath: string): any;
  34897. /**
  34898. * @en
  34899. * Retrieve the file size.
  34900. *
  34901. * @zh
  34902. * 获取文件大小
  34903. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  34904. * @param filepath The path of the file, it could be a relative or absolute path.
  34905. * @return The file size.
  34906. */
  34907. function getFileSize(filepath: string): number;
  34908. /**
  34909. * @en
  34910. * Converts the contents of a file to a ValueMap.
  34911. * This method is used internally.
  34912. *
  34913. * @zh
  34914. * 转换文件内容为ValueMap
  34915. * 这个方法是内部使用的
  34916. *
  34917. */
  34918. function getValueMapFromData(filedata: string, filesize: number): any;
  34919. /**
  34920. *
  34921. * @en
  34922. * Removes a directory..
  34923. *
  34924. * @zh
  34925. * 删除一个目录
  34926. *
  34927. * @param dirPath The full path of the directory, it must be an absolute path.
  34928. * @return True if the directory have been removed successfully, false if not.
  34929. */
  34930. function removeDirectory(dirPath: string): boolean;
  34931. /**
  34932. * @en
  34933. * Sets the array of search paths.
  34934. *
  34935. * You can use this array to modify the search path of the resources.
  34936. * If you want to use "themes" or search resources in the "cache", you can do it easily by adding new entries in this array.
  34937. *
  34938. * @note This method could access relative path and absolute path.
  34939. * If the relative path was passed to the vector, FileUtils will add the default resource directory before the relative path.
  34940. * For instance:
  34941. * On Android, the default resource root path is "@assets/".
  34942. * If "/mnt/sdcard/" and "resources-large" were set to the search paths vector,
  34943. * "resources-large" will be converted to "@assets/resources-large" since it was a relative path.
  34944. * @zh
  34945. * 设置一系列的搜索路径
  34946. * 通过这个数组可以修改资源的搜索路径。例如如果你想使用在cache里的主题资源,你需要尽早的添加到这个数组里
  34947. *
  34948. * @param searchPaths The array contains search paths.
  34949. * @see fullPathForFilename (const char*)
  34950. * @since v2.1
  34951. * In js:var setSearchPaths(var jsval);
  34952. * @lua NA
  34953. */
  34954. function setSearchPaths(searchPath: Array<string>): void;
  34955. /**
  34956. * @en
  34957. * write a string into a file.
  34958. *
  34959. * @zh
  34960. * 写字符串到文件里
  34961. *
  34962. * @param dataStr the string want to save
  34963. * @param fullPath The full path to the file you want to save a string
  34964. * @return bool True if write success
  34965. */
  34966. function writeStringToFile(dataStr: string, fullPath: string): boolean;
  34967. /**
  34968. * @en
  34969. * Add search path.
  34970. *
  34971. * @zh
  34972. * 添加文件的搜索路径
  34973. *
  34974. * @since v2.1
  34975. */
  34976. function addSearchPath(path: string, front: boolean): void;
  34977. /**
  34978. *
  34979. * @en
  34980. * write ValueVector into a plist file
  34981. *
  34982. * @zh
  34983. * 将 ValueVector 写入 plist 文件
  34984. *
  34985. *@param vecData the ValueVector want to save
  34986. *@param fullPath The full path to the file you want to save a string
  34987. *@return bool
  34988. */
  34989. function writeValueVectorToFile(vecData: Array<any>, fullPath: string): boolean;
  34990. /**
  34991. * @en
  34992. * Checks whether a file exists.
  34993. *
  34994. * @zh
  34995. * 检测路径是否存在
  34996. *
  34997. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  34998. * @param filename The path of the file, it could be a relative or absolute path.
  34999. * @return True if the file exists, false if not.
  35000. */
  35001. function isFileExist(filename: string): boolean;
  35002. /**
  35003. *
  35004. * @en
  35005. * Purges full path caches.
  35006. *
  35007. * @zh
  35008. * 清除路径缓存
  35009. */
  35010. function purgeCachedEntries(): void;
  35011. /**
  35012. * @en
  35013. * Gets full path from a file name and the path of the relative file.
  35014. *
  35015. * @zh
  35016. * 通过文件名或者相对路径转换成绝对路径
  35017. *
  35018. * @param filename The file name.
  35019. * @param relativeFile The path of the relative file.
  35020. * @return The full path.
  35021. * e.g. filename: hello.png, pszRelativeFile: /User/path1/path2/hello.plist
  35022. * Return: /User/path1/path2/hello.pvr (If there a a key(hello.png)-value(hello.pvr) in FilenameLookup dictionary. )
  35023. *
  35024. */
  35025. function fullPathFromRelativeFile(filename: string, relativeFile: string): string;
  35026. /**
  35027. * @en
  35028. * Windows fopen can't support UTF-8 filename
  35029. * Need convert all parameters fopen and other 3rd-party libs
  35030. *
  35031. * @zh
  35032. * windows的fopen函数不支持utf-8编码的文件
  35033. * 需要转换所有的参数给fopen或者其他的第三方的库使用
  35034. * @param filenameUtf8 std::string name file for conversion from utf-8
  35035. * @return std::string ansi filename in current locale
  35036. */
  35037. function getSuitableFOpen(filenameUtf8: string): string;
  35038. /**
  35039. *
  35040. * @en
  35041. * write ValueMap into a plist file
  35042. *
  35043. * @zh
  35044. * 将 ValueMap 写入 plist 文件
  35045. * @param dict the ValueMap want to save
  35046. * @param fullPath The full path to the file you want to save a string
  35047. * @return bool
  35048. */
  35049. function writeValueMapToFile(dict: any, fullPath: string): string;
  35050. /**
  35051. * @en
  35052. * Gets filename extension is a suffix (separated from the base filename by a dot) in lower case.
  35053. * Examples of filename extensions are .png, .jpeg, .exe, .dmg and .txt.
  35054. *
  35055. * @zh
  35056. * 获取文件的扩展名(使用'.'做分割符),返回的都是小写
  35057. * 例如:返回.png, .jpeg, .exe, .dmg等
  35058. * @param filePath The path of the file, it could be a relative or absolute path.
  35059. * @return suffix for filename in lower case or empty if a dot not found.
  35060. */
  35061. function getFileExtension(filePath: string): string;
  35062. /**
  35063. * @en
  35064. * Sets writable path.
  35065. *
  35066. * @zh
  35067. * 设置有可写权限的目录
  35068. *
  35069. * @param writablePath The path of the directory.
  35070. */
  35071. function setWritablePath(writablePath: string): void;
  35072. /**
  35073. * @en
  35074. * Set default resource root path.
  35075. *
  35076. * @zh
  35077. * 设置默认的资源根目录
  35078. *
  35079. * @param dirPath The path of the directory.
  35080. */
  35081. function setDefaultResourceRootPath(dirPath: string): void;
  35082. /**
  35083. * @en
  35084. * Creates a directory.
  35085. *
  35086. * @zh
  35087. * 创建一个目录
  35088. *
  35089. * @param dirPath The path of the directory, it must be an absolute path.
  35090. * @return True if the directory have been created successfully, false if not.
  35091. */
  35092. function createDirectory(dirPath: string): string;
  35093. /**
  35094. * @en
  35095. * List all files recursively in a directory.
  35096. *
  35097. * @zh
  35098. * 在一个目录里递归搜索所有的文件
  35099. *
  35100. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  35101. * @return File paths in a string vector
  35102. */
  35103. function listFilesRecursively(dirPath: string, files: Array<string>): void;
  35104. /**
  35105. * Gets the writable path.
  35106. * @return The path that can be write/read a file in
  35107. */
  35108. function getWritablePath(): string;
  35109. /**
  35110. * @en
  35111. * Renames a file under the given directory.
  35112. *
  35113. * @zh
  35114. * 文件(包含路径)重命名
  35115. *
  35116. * @param oldFullpath The current fullpath of the file. Includes path and name.
  35117. * @param newFullPath The new fullpath of the file. Includes path and name.
  35118. * @return True if the file have been renamed successfully, false if not.
  35119. */
  35120. function renameFile(oldFullpath: string, newFullPath: string): boolean;
  35121. /**
  35122. * @en
  35123. * Read binary data from a file.
  35124. *
  35125. * @zh
  35126. * 从文件中读取二进制数据
  35127. * Creates binary data from a file.
  35128. * @param fullpath The current fullpath of the file. Includes path and name.
  35129. * @return A data object.
  35130. */
  35131. function getDataFromFile(fullpath: string): ArrayBuffer;
  35132. /**
  35133. * @en
  35134. * write Data into a file
  35135. *
  35136. * @zh
  35137. * 把数据写入文件内
  35138. *
  35139. * @param data the data want to save
  35140. * @param fullpath The full path to the file you want to save a string
  35141. * @return bool
  35142. */
  35143. function writeDataToFile(buffer: ArrayBuffer, fullpath: string): boolean;
  35144. }
  35145. /**
  35146. * @en DebugTextInfo @zh 调试文本的配置接口
  35147. * @param color @en text color @zh 文本颜色
  35148. * @param bold @en bold text @zh 粗体
  35149. * @param italic @en italic text @zh 斜体
  35150. * @param shadow @en shadow effect @zh 阴影效果
  35151. * @param shadowThickness @en shadow thickness @zh 阴影宽度
  35152. * @param shadowColor @en shadow color @zh 阴影颜色
  35153. * @param scale @en scale @zh 缩放比例
  35154. */
  35155. export interface DebugTextInfo {
  35156. color: math.Color;
  35157. bold: boolean;
  35158. italic: boolean;
  35159. shadow: boolean;
  35160. shadowThickness: number;
  35161. shadowColor: math.Color;
  35162. scale: number;
  35163. }
  35164. /**
  35165. * @en DebugRenderer class used to output debug text on screen
  35166. * @zh 用于输出屏幕调试文字的调试渲染器类
  35167. */
  35168. export class DebugRenderer {
  35169. /**
  35170. * @en get DebugRenderer instance
  35171. * @zh 获取调试渲染器实例
  35172. * @return @en the DebugRenderer instance @zh 返回的调试渲染器实例
  35173. */
  35174. static getInstance(): DebugRenderer;
  35175. /**
  35176. * @en output a text
  35177. * @zh 输出一个文本
  35178. * @param text @en the output text @zh 输出的文本
  35179. * @param screenPos @en the output screen position @zh 输出的屏幕位置
  35180. * @param info @en the output text information @zh 输出的文本属性
  35181. */
  35182. addText(text: string, screenPos: math.Vec2, info?: DebugTextInfo): void;
  35183. }
  35184. export namespace reflection {
  35185. /**
  35186. * https://docs.cocos.com/creator/manual/zh/advanced-topics/java-reflection.html
  35187. * @en call Objective-C/Java static methods
  35188. * @zh 调用 Objective-C/Java 静态方法
  35189. *
  35190. * @param className : @en the class name of the Objective-C/Java class @zh Objective-C/Java 类的类名
  35191. * @param methodName : @en the method name of the Objective-C/Java class @zh Objective-C/Java 类的方法名
  35192. * @param methodSignature : @en the method signature of the Objective-C/Java class @zh Objective-C/Java 方法签名
  35193. * @param parameters : @en the parameters of the Objective-C/Java class to translate @zh 传递至该 Objective-C/Java 方法的参数
  35194. */
  35195. function callStaticMethod(className: string, methodName: string, methodSignature: string, ...parameters: any): any;
  35196. }
  35197. /**
  35198. * @en
  35199. * The API to listen and dispatch events on Objc/JAVA without reflection,
  35200. * Function onNative can only be overriden once by time.
  35201. * https://docs.cocos.com/creator/manual/en/advanced-topics/js-java-bridge.html
  35202. * Sample:
  35203. * ```
  35204. * native.bridge.onNative = (event, data) => {
  35205. * if (event === 'send_message') {
  35206. * console.log(data);
  35207. * }
  35208. * }
  35209. * ```
  35210. * ```
  35211. * // Java codes
  35212. * JsbBridge.sendToScript('send_message', 'hello world');
  35213. * ```
  35214. * @zh
  35215. * 不使用反射机制来调用和监听Objc/JAVA事件的接口,
  35216. * 同一时间只能重载一个onNative函数
  35217. * https://docs.cocos.com/creator/manual/zh/advanced-topics/js-java-bridge.html
  35218. * 示例:
  35219. * ```
  35220. * native.bridge.onNative = (event, data) => {
  35221. * if (event === 'send_message') {
  35222. * console.log(data);
  35223. * }
  35224. * }
  35225. * ```
  35226. * ```java
  35227. * JsbBridge.sendToScript('send_message', 'hello world');
  35228. * ```
  35229. */
  35230. export namespace bridge {
  35231. /**
  35232. * @en send to native with maxmimum of 2 parameters
  35233. * @zh 向原生发送消息,可接受1到2个参数。
  35234. * @param arg0 : @en the first parameter @zh 第一个参数
  35235. * @param arg1 : @en the second parameter @zh 第二个参数
  35236. */
  35237. function sendToNative(arg0: string, arg1?: string): void;
  35238. /**
  35239. * @en
  35240. * Define your own js callback function. When native scripts run sendToScript, this callback will be called.
  35241. * usage: jsb.bridge.onNative = (arg0: String, arg1: String) => {...}
  35242. * @zh
  35243. * 定义自己的js回调函数,当原生调用 sendToScript 时,该回调函数被触发。
  35244. * 使用 jsb.bridge.onNative = (arg0: String, arg1: String) => {...}
  35245. *
  35246. * @param arg0 : @en the first parameter @zh 第一个参数
  35247. * @param arg1 : @en the second parameter @zh 第二个参数
  35248. */
  35249. function onNative(arg0: string, arg1?: string | null): void;
  35250. }
  35251. /**
  35252. * @en
  35253. * Listener for jsbBridgeWrapper's event.
  35254. * It takes one argument as data which is transferred by jsbBridge.
  35255. * @zh
  35256. * jsbBridgeWrapper 的事件监听器,
  35257. * 它接受一个字符串参数,这个参数是通过 jsbBridge 进行传递的数据
  35258. * @param arg: @en the data transferred by jsbBridge @zh jsbBridge 进行传递的数据
  35259. */
  35260. export type OnNativeEventListener = (arg: string) => void;
  35261. /**
  35262. * @en
  35263. * A high level API to call Objc/JAVA methods.
  35264. * Use bridge to implement it. If use jsbBridgeWrapper, bridge should not be used.
  35265. * https://docs.cocos.com/creator/manual/en/advanced-topics/jsb-bridge-wrapper.html
  35266. * @zh
  35267. * 高级 API,用于调用 Objc/JAVA 方法。
  35268. * 该方法封装在bridge之上,如果使用 jsbBridgeWrapper,bridge 不应该被使用。
  35269. * https://docs.cocos.com/creator/manual/zh/advanced-topics/jsb-bridge-wrapper.html
  35270. */
  35271. export namespace jsbBridgeWrapper {
  35272. /**
  35273. * @en
  35274. * Register one listener to the event
  35275. * @zh
  35276. * 给事件注册一个监听
  35277. * @param event : @en the event name @zh 事件名称
  35278. * @param listener : @en the listener @zh 监听器
  35279. */
  35280. function addNativeEventListener(event: string, listener: OnNativeEventListener): any;
  35281. /**
  35282. * @en
  35283. * Dispatch the event registered on Objective-C, Java etc.
  35284. * @zh
  35285. * 调用 Objective-C、Java 等的注册的事件。
  35286. * @param event : @en the event name @zh 事件名称
  35287. * @param data : @en the data @zh 数据
  35288. */
  35289. function dispatchEventToNative(event: string, arg?: string): any;
  35290. /**
  35291. * @en Remove all listeners listennig to event.
  35292. * @zh 移除指定事件的所有监听。
  35293. * @param event : @en the event name @zh 事件名称
  35294. */
  35295. function removeAllListenersForEvent(event: string): any;
  35296. /**
  35297. * @en Remove the listener specified.
  35298. * @zh 移除指定的事件监听器
  35299. * @param event : @en the event name @zh 事件名称
  35300. */
  35301. function removeNativeEventListener(event: string, listener: OnNativeEventListener): any;
  35302. /**
  35303. * @en Remove all events, use it carefully!
  35304. * @zh 移除所有事件,请小心使用!
  35305. * @param event : @en the event name @zh 事件名称
  35306. */
  35307. function removeAllListeners(): any;
  35308. }
  35309. /**
  35310. * @en Current process information
  35311. * @zh 当前进程信息
  35312. */
  35313. export namespace process {
  35314. /**
  35315. * @en Get argument list passed to execution file
  35316. * @zh 获取当前传递给执行文件的参数列表
  35317. */
  35318. export const argv: Readonly<string[]>;
  35319. }
  35320. /**
  35321. * @en This object provides properties related to thermal characteristics and an optional callback function to track changes in thermal status.
  35322. * It is supported only on Android platforms with an API level of 31 or higher.
  35323. * @zh 该对象提供与热特性相关的属性以及用于跟踪热状态变化的可选回调函数。仅支持 API 等级为 31 或更高的 Android 平台。
  35324. *
  35325. * @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
  35326. */
  35327. export const adpf: {
  35328. /**
  35329. * @en Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling. The value range is a non-negative float, where 0.0 represents a fixed distance from overheating, 1.0 indicates the device will be severely throttled, and values greater than 1.0 may imply even heavier throttling.
  35330. * @zh 提供设备在达到严重节流之前当前有多少热余量的估计值。值的范围是非负浮点数,其中0.0表示距离过热的固定距离,1.0表示设备将被严重限制,而大于1.0的值可能表示更重的限制。
  35331. * @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
  35332. */
  35333. readonly thermalHeadroom: number;
  35334. /**
  35335. * @en A number indicating the current thermal status
  35336. * @zh 表示当前热状态的数字
  35337. */
  35338. readonly thermalStatus: number;
  35339. /**
  35340. * @en A number indicating the minimum threshold for thermal status
  35341. * @zh 表示热状态的最大阈值的数字
  35342. */
  35343. readonly thermalStatusMin: number;
  35344. /**
  35345. * @en A number indicating the maximum threshold for thermal status
  35346. * @zh 表示热状态的最大阈值的数字
  35347. */
  35348. readonly thermalStatusMax: number;
  35349. /**
  35350. * @en A normalized value of the current thermal status. It's computed based on the formula:
  35351. * (thermalStatus - thermalStatusMin) / thermalStatusMax.
  35352. * This value ranges between 0 and 1, giving a relative measure of the current thermal status against its minimum and maximum thresholds.
  35353. * @zh 当前热状态的归一化值,范围在 0 到 1 之间. 它是基于以下公式计算的: (thermalStatus - thermalStatusMin) / thermalStatusMax.
  35354. * 提供了当前热状态相对于其最小和最大阈值的相对测量。
  35355. */
  35356. readonly thermalStatusNormalized: number;
  35357. /**
  35358. * @en An optional callback function that is triggered when the thermal status changes
  35359. * @zh 该对象提供与热特性相关的属性以及用于跟踪热状态变化的可选回调函数
  35360. *
  35361. * @param previousStatus @zh 之前的热状态 @en The previous thermal status
  35362. * @param newStatus @zh 更改后的新热状态 @en The new thermal status after the change
  35363. * @param statusMin @zh 热状态的最小阈值 @en The minimum threshold for thermal status
  35364. * @param statusMax @zh 热状态的最大阈值 @en The maximum threshold for thermal status
  35365. * @returns
  35366. */
  35367. onThermalStatusChanged?: (previousStatus: number, newStatus: number, statusMin: number, statusMax: number) => void;
  35368. } | undefined;
  35369. }
  35370. export namespace rendering {
  35371. export function getUpdateFrequencyName(e: UpdateFrequency): string;
  35372. export function getParameterTypeName(e: ParameterType): string;
  35373. export function getResourceResidencyName(e: ResourceResidency): string;
  35374. export function getQueueHintName(e: QueueHint): string;
  35375. export function getResourceDimensionName(e: ResourceDimension): string;
  35376. export function getTaskTypeName(e: TaskType): string;
  35377. export function getLightingModeName(e: LightingMode): string;
  35378. export function getAttachmentTypeName(e: AttachmentType): string;
  35379. export function getAccessTypeName(e: AccessType): string;
  35380. export function getClearValueTypeName(e: ClearValueType): string;
  35381. export function getDescriptorTypeOrderName(e: DescriptorTypeOrder): string;
  35382. export function saveLightInfo(ar: OutputArchive, v: LightInfo): void;
  35383. export function loadLightInfo(ar: InputArchive, v: LightInfo): void;
  35384. export function saveDescriptor(ar: OutputArchive, v: Descriptor): void;
  35385. export function loadDescriptor(ar: InputArchive, v: Descriptor): void;
  35386. export function saveDescriptorBlock(ar: OutputArchive, v: DescriptorBlock): void;
  35387. export function loadDescriptorBlock(ar: InputArchive, v: DescriptorBlock): void;
  35388. export function saveDescriptorBlockFlattened(ar: OutputArchive, v: DescriptorBlockFlattened): void;
  35389. export function loadDescriptorBlockFlattened(ar: InputArchive, v: DescriptorBlockFlattened): void;
  35390. export function saveDescriptorBlockIndex(ar: OutputArchive, v: DescriptorBlockIndex): void;
  35391. export function loadDescriptorBlockIndex(ar: InputArchive, v: DescriptorBlockIndex): void;
  35392. export function saveResolvePair(ar: OutputArchive, v: ResolvePair): void;
  35393. export function loadResolvePair(ar: InputArchive, v: ResolvePair): void;
  35394. export function saveCopyPair(ar: OutputArchive, v: CopyPair): void;
  35395. export function loadCopyPair(ar: InputArchive, v: CopyPair): void;
  35396. export function saveMovePair(ar: OutputArchive, v: MovePair): void;
  35397. export function loadMovePair(ar: InputArchive, v: MovePair): void;
  35398. export function savePipelineStatistics(ar: OutputArchive, v: PipelineStatistics): void;
  35399. export function loadPipelineStatistics(ar: InputArchive, v: PipelineStatistics): void;
  35400. export enum UpdateFrequency {
  35401. PER_INSTANCE = 0,
  35402. PER_BATCH = 1,
  35403. PER_PHASE = 2,
  35404. PER_PASS = 3,
  35405. COUNT = 4
  35406. }
  35407. export enum ParameterType {
  35408. CONSTANTS = 0,
  35409. CBV = 1,
  35410. UAV = 2,
  35411. SRV = 3,
  35412. TABLE = 4,
  35413. SSV = 5
  35414. }
  35415. export enum ResourceResidency {
  35416. MANAGED = 0,
  35417. MEMORYLESS = 1,
  35418. PERSISTENT = 2,
  35419. EXTERNAL = 3,
  35420. BACKBUFFER = 4
  35421. }
  35422. export enum QueueHint {
  35423. NONE = 0,
  35424. OPAQUE = 1,
  35425. MASK = 2,
  35426. BLEND = 3,
  35427. RENDER_OPAQUE = 1,
  35428. RENDER_CUTOUT = 2,
  35429. RENDER_TRANSPARENT = 3
  35430. }
  35431. export enum ResourceDimension {
  35432. BUFFER = 0,
  35433. TEXTURE1D = 1,
  35434. TEXTURE2D = 2,
  35435. TEXTURE3D = 3
  35436. }
  35437. export enum ResourceFlags {
  35438. NONE = 0,
  35439. UNIFORM = 1,
  35440. INDIRECT = 2,
  35441. STORAGE = 4,
  35442. SAMPLED = 8,
  35443. COLOR_ATTACHMENT = 16,
  35444. DEPTH_STENCIL_ATTACHMENT = 32,
  35445. INPUT_ATTACHMENT = 64,
  35446. SHADING_RATE = 128,
  35447. TRANSFER_SRC = 256,
  35448. TRANSFER_DST = 512
  35449. }
  35450. export enum TaskType {
  35451. SYNC = 0,
  35452. ASYNC = 1
  35453. }
  35454. export enum SceneFlags {
  35455. NONE = 0,
  35456. OPAQUE = 1,
  35457. MASK = 2,
  35458. BLEND = 4,
  35459. OPAQUE_OBJECT = 1,
  35460. CUTOUT_OBJECT = 2,
  35461. TRANSPARENT_OBJECT = 4,
  35462. SHADOW_CASTER = 8,
  35463. UI = 16,
  35464. DEFAULT_LIGHTING = 32,
  35465. VOLUMETRIC_LIGHTING = 64,
  35466. CLUSTERED_LIGHTING = 128,
  35467. PLANAR_SHADOW = 256,
  35468. GEOMETRY = 512,
  35469. PROFILER = 1024,
  35470. DRAW_INSTANCING = 2048,
  35471. DRAW_NON_INSTANCING = 4096,
  35472. REFLECTION_PROBE = 8192,
  35473. GPU_DRIVEN = 16384,
  35474. NON_BUILTIN = 32768,
  35475. ALL = 4294967295
  35476. }
  35477. export enum LightingMode {
  35478. NONE = 0,
  35479. DEFAULT = 1,
  35480. CLUSTERED = 2
  35481. }
  35482. export enum AttachmentType {
  35483. RENDER_TARGET = 0,
  35484. DEPTH_STENCIL = 1,
  35485. SHADING_RATE = 2
  35486. }
  35487. export enum AccessType {
  35488. READ = 0,
  35489. READ_WRITE = 1,
  35490. WRITE = 2
  35491. }
  35492. export enum ClearValueType {
  35493. NONE = 0,
  35494. FLOAT_TYPE = 1,
  35495. INT_TYPE = 2
  35496. }
  35497. export class LightInfo {
  35498. constructor(light?: renderer.scene.Light | null, level?: number, culledByLight?: boolean, probe?: renderer.scene.ReflectionProbe | null);
  35499. reset(light?: renderer.scene.Light | null, level?: number, culledByLight?: boolean, probe?: renderer.scene.ReflectionProbe | null): void;
  35500. light: renderer.scene.Light | null;
  35501. probe: renderer.scene.ReflectionProbe | null;
  35502. level: number;
  35503. culledByLight: boolean;
  35504. }
  35505. export enum DescriptorTypeOrder {
  35506. UNIFORM_BUFFER = 0,
  35507. DYNAMIC_UNIFORM_BUFFER = 1,
  35508. SAMPLER_TEXTURE = 2,
  35509. SAMPLER = 3,
  35510. TEXTURE = 4,
  35511. STORAGE_BUFFER = 5,
  35512. DYNAMIC_STORAGE_BUFFER = 6,
  35513. STORAGE_IMAGE = 7,
  35514. INPUT_ATTACHMENT = 8
  35515. }
  35516. export class Descriptor {
  35517. constructor(type?: gfx.Type);
  35518. reset(type?: gfx.Type): void;
  35519. type: gfx.Type;
  35520. count: number;
  35521. }
  35522. export class DescriptorBlock {
  35523. reset(): void;
  35524. readonly descriptors: Map<string, Descriptor>;
  35525. readonly uniformBlocks: Map<string, gfx.UniformBlock>;
  35526. capacity: number;
  35527. count: number;
  35528. }
  35529. export class DescriptorBlockFlattened {
  35530. reset(): void;
  35531. readonly descriptorNames: string[];
  35532. readonly uniformBlockNames: string[];
  35533. readonly descriptors: Descriptor[];
  35534. readonly uniformBlocks: gfx.UniformBlock[];
  35535. capacity: number;
  35536. count: number;
  35537. }
  35538. export class DescriptorBlockIndex {
  35539. constructor(updateFrequency?: UpdateFrequency, parameterType?: ParameterType, descriptorType?: DescriptorTypeOrder, visibility?: gfx.ShaderStageFlagBit);
  35540. updateFrequency: UpdateFrequency;
  35541. parameterType: ParameterType;
  35542. descriptorType: DescriptorTypeOrder;
  35543. visibility: gfx.ShaderStageFlagBit;
  35544. }
  35545. export enum ResolveFlags {
  35546. NONE = 0,
  35547. COLOR = 1,
  35548. DEPTH = 2,
  35549. STENCIL = 4
  35550. }
  35551. export class ResolvePair {
  35552. constructor(source?: string, target?: string, resolveFlags?: ResolveFlags, mode?: gfx.ResolveMode, mode1?: gfx.ResolveMode);
  35553. reset(source?: string, target?: string, resolveFlags?: ResolveFlags, mode?: gfx.ResolveMode, mode1?: gfx.ResolveMode): void;
  35554. source: string;
  35555. target: string;
  35556. resolveFlags: ResolveFlags;
  35557. mode: gfx.ResolveMode;
  35558. mode1: gfx.ResolveMode;
  35559. }
  35560. export class CopyPair {
  35561. constructor(source?: string, target?: string, mipLevels?: number, numSlices?: number, sourceMostDetailedMip?: number, sourceFirstSlice?: number, sourcePlaneSlice?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number);
  35562. reset(source?: string, target?: string, mipLevels?: number, numSlices?: number, sourceMostDetailedMip?: number, sourceFirstSlice?: number, sourcePlaneSlice?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): void;
  35563. source: string;
  35564. target: string;
  35565. mipLevels: number;
  35566. numSlices: number;
  35567. sourceMostDetailedMip: number;
  35568. sourceFirstSlice: number;
  35569. sourcePlaneSlice: number;
  35570. targetMostDetailedMip: number;
  35571. targetFirstSlice: number;
  35572. targetPlaneSlice: number;
  35573. }
  35574. export class UploadPair {
  35575. constructor(source?: Uint8Array, target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number);
  35576. reset(target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): void;
  35577. readonly source: Uint8Array;
  35578. target: string;
  35579. mipLevels: number;
  35580. numSlices: number;
  35581. targetMostDetailedMip: number;
  35582. targetFirstSlice: number;
  35583. targetPlaneSlice: number;
  35584. }
  35585. export class MovePair {
  35586. constructor(source?: string, target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number);
  35587. reset(source?: string, target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): void;
  35588. source: string;
  35589. target: string;
  35590. mipLevels: number;
  35591. numSlices: number;
  35592. targetMostDetailedMip: number;
  35593. targetFirstSlice: number;
  35594. targetPlaneSlice: number;
  35595. }
  35596. export class PipelineStatistics {
  35597. reset(): void;
  35598. numRenderPasses: number;
  35599. numManagedTextures: number;
  35600. totalManagedTextures: number;
  35601. numUploadBuffers: number;
  35602. numUploadBufferViews: number;
  35603. numFreeUploadBuffers: number;
  35604. numFreeUploadBufferViews: number;
  35605. numDescriptorSets: number;
  35606. numFreeDescriptorSets: number;
  35607. numInstancingBuffers: number;
  35608. numInstancingUniformBlocks: number;
  35609. }
  35610. export class RenderCommonObjectPoolSettings {
  35611. constructor(batchSize: number);
  35612. lightInfoBatchSize: number;
  35613. descriptorBatchSize: number;
  35614. descriptorBlockBatchSize: number;
  35615. descriptorBlockFlattenedBatchSize: number;
  35616. descriptorBlockIndexBatchSize: number;
  35617. resolvePairBatchSize: number;
  35618. copyPairBatchSize: number;
  35619. uploadPairBatchSize: number;
  35620. movePairBatchSize: number;
  35621. pipelineStatisticsBatchSize: number;
  35622. }
  35623. export class RenderCommonObjectPool {
  35624. constructor(settings: RenderCommonObjectPoolSettings);
  35625. reset(): void;
  35626. createLightInfo(light?: renderer.scene.Light | null, level?: number, culledByLight?: boolean, probe?: renderer.scene.ReflectionProbe | null): LightInfo;
  35627. createDescriptor(type?: gfx.Type): Descriptor;
  35628. createDescriptorBlock(): DescriptorBlock;
  35629. createDescriptorBlockFlattened(): DescriptorBlockFlattened;
  35630. createDescriptorBlockIndex(updateFrequency?: UpdateFrequency, parameterType?: ParameterType, descriptorType?: DescriptorTypeOrder, visibility?: gfx.ShaderStageFlagBit): DescriptorBlockIndex;
  35631. createResolvePair(source?: string, target?: string, resolveFlags?: ResolveFlags, mode?: gfx.ResolveMode, mode1?: gfx.ResolveMode): ResolvePair;
  35632. createCopyPair(source?: string, target?: string, mipLevels?: number, numSlices?: number, sourceMostDetailedMip?: number, sourceFirstSlice?: number, sourcePlaneSlice?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): CopyPair;
  35633. createUploadPair(target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): UploadPair;
  35634. createMovePair(source?: string, target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): MovePair;
  35635. createPipelineStatistics(): PipelineStatistics;
  35636. }
  35637. /****************************************************************************
  35638. Copyright (c) 2021-2023 Xiamen Yaji Software Co., Ltd.
  35639. http://www.cocos.com
  35640. Permission is hereby granted, free of charge, to any person obtaining a copy
  35641. of this software and associated documentation files (the "Software"), to deal
  35642. in the Software without restriction, including without limitation the rights to
  35643. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  35644. of the Software, and to permit persons to whom the Software is furnished to do so,
  35645. subject to the following conditions:
  35646. The above copyright notice and this permission notice shall be included in
  35647. all copies or substantial portions of the Software.
  35648. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35649. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35650. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35651. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35652. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35653. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  35654. THE SOFTWARE.
  35655. ****************************************************************************/
  35656. /**
  35657. * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
  35658. * The following section is auto-generated.
  35659. * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
  35660. */
  35661. export interface OutputArchive {
  35662. writeBool(value: boolean): void;
  35663. writeNumber(value: number): void;
  35664. writeString(value: string): void;
  35665. }
  35666. export interface InputArchive {
  35667. readBool(): boolean;
  35668. readNumber(): number;
  35669. readString(): string;
  35670. }
  35671. export function createCustomPipeline(): BasicPipeline;
  35672. export function setCustomPipeline(name: string, builder: PipelineBuilder): void;
  35673. export function getCustomPipeline(name: string): PipelineBuilder;
  35674. export function init(device: gfx.Device, arrayBuffer: ArrayBuffer | null): void;
  35675. export function destroy(): void;
  35676. export function getPassID(name: string | undefined): number;
  35677. export function getSubpassID(passID: number, name: string): number;
  35678. export function getPhaseID(passID: number, name: string | number | undefined): number;
  35679. export function completePhaseName(name: string | number | undefined): string;
  35680. export const INVALID_ID = 4294967295;
  35681. export const enableEffectImport = true;
  35682. export const programLib: __private._cocos_rendering_custom_private__ProgramLibrary;
  35683. export const customPipelineBuilderMap: Map<string, PipelineBuilder>;
  35684. export function getPipelineTypeName(e: PipelineType): string;
  35685. /**
  35686. * @en Type of render pipeline.
  35687. * Different types of pipeline have different hardward capabilities and interfaces.
  35688. * @zh 管线类型,不同类型的管线具有不同的硬件能力与接口
  35689. */
  35690. export enum PipelineType {
  35691. /**
  35692. * @en Basic render pipeline.
  35693. * Basic render pipeline is available on all platforms.
  35694. * The corresponding interface is {@link BasicPipeline}
  35695. * @zh 基础渲染管线,全平台支持。对应接口为 {@link BasicPipeline}
  35696. */
  35697. BASIC = 0,
  35698. /**
  35699. * @en Standard render pipeline.
  35700. * Standard render pipeline supports compute shader and subpass rendering.
  35701. * It works well on Tile-based GPUs and is available on all native platforms.
  35702. * Vulkan, GLES3 and Metal backends are supported.
  35703. * The corresponding interface is {@link Pipeline}
  35704. * @zh 标准渲染管线.
  35705. * 标准渲染管线支持计算着色器(Compute Shader)与次通道渲染(Subpass rendering)。
  35706. * 能充分利用Tile-based GPU,支持所有原生平台并对移动平台特别优化。
  35707. * 支持Vulkan、GLES3、Metal图形后端。
  35708. * 对应接口为{@link Pipeline}
  35709. */
  35710. STANDARD = 1
  35711. }
  35712. /**
  35713. * @en Render subpass capabilities.
  35714. * Tile-based GPUs support reading color or depth_stencil attachment in pixel shader.
  35715. * Our implementation is based-on Vulkan abstraction (aka input attachment),
  35716. * and it is emulated on other graphics backends.
  35717. * For example, in GLES3 we have used various framebuffer fetch (FBF) extensions.
  35718. * As a result, different backends and hardwares support different input attachment features.
  35719. * User should inspect pipeline capabilities when implementing tile-based rendering algorithms.
  35720. * Using unsupported feature is undefined behaviour.
  35721. * @zh 次通道渲染能力
  35722. * Tile-based GPU可以在像素着色器读取当前像素的值。
  35723. * 我们的抽象方式基于Vulkan的input attachment,并在其他图形后端模拟了这个功能。
  35724. * 比如在GLES3上,我们使用了多种framebuffer fetch (FBF) 扩展来实现这个功能。
  35725. * 所以对于不同的硬件以及图形API,支持的能力是略有不同的。
  35726. * 在编写渲染算法时,应该查询当前设备的能力,来选择合适的tile-based算法。
  35727. * 使用硬件不支持的特性,会导致未定义行为。
  35728. */
  35729. export enum SubpassCapabilities {
  35730. NONE = 0,
  35731. /**
  35732. * @en Supports read depth/stencil value at current pixel.
  35733. * @zh 支持读取当前像素的depth/stencil值
  35734. */
  35735. INPUT_DEPTH_STENCIL = 1,
  35736. /**
  35737. * @en Supports read color value 0 at current pixel.
  35738. * @zh 支持读取当前像素第0个颜色值
  35739. */
  35740. INPUT_COLOR = 2,
  35741. /**
  35742. * @en Supports read color values at current pixel.
  35743. * @zh 支持读取当前像素任意颜色值
  35744. */
  35745. INPUT_COLOR_MRT = 4,
  35746. /**
  35747. * @en Each subpass has its own sample count.
  35748. * @zh 每个Subpass拥有不同的采样数
  35749. */
  35750. HETEROGENEOUS_SAMPLE_COUNT = 8
  35751. }
  35752. /**
  35753. * @en Pipeline capabilities.
  35754. * The following capabilities are partially supported on different hardware and graphics backends.
  35755. * @zh 管线能力。根据硬件与后端,支持的特性会有所不同
  35756. */
  35757. export class PipelineCapabilities {
  35758. subpass: SubpassCapabilities;
  35759. }
  35760. /**
  35761. * @en Base class of render graph node.
  35762. * A node of render graph represents a specific type of rendering operation.
  35763. * A render graph consists of these nodes and form a forest(which is a set of trees).
  35764. * @zh RenderGraph中节点的基类,每个RenderGraph节点代表一种渲染操作,并构成一个森林(一组树)
  35765. */
  35766. export interface RenderNode {
  35767. /**
  35768. * @en Get debug name of current node.
  35769. * @zh 获得当前节点调试用的名字
  35770. */
  35771. name: string;
  35772. /**
  35773. * @experimental
  35774. */
  35775. setCustomBehavior(name: string): void;
  35776. }
  35777. /**
  35778. * @en Render node which supports setting uniforms and descriptors.
  35779. * @zh 节点支持设置常量值(uniform/constant)与描述符
  35780. */
  35781. export interface Setter extends RenderNode {
  35782. /**
  35783. * @en Set matrix4x4 常量(uniform) which consists of 16 floats (64 bytes).
  35784. * @zh 设置4x4矩阵,常量(uniform)有16个float (64 bytes)
  35785. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35786. */
  35787. setMat4(name: string, mat: math.Mat4): void;
  35788. /**
  35789. * @en Set quaternion uniform which consists of 4 floats (16 bytes).
  35790. * @zh 设置四元数向量,常量(uniform)有4个float (16 bytes)
  35791. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35792. */
  35793. setQuaternion(name: string, quat: math.Quat): void;
  35794. /**
  35795. * @en Set color uniform which consists of 4 floats (16 bytes).
  35796. * @zh 设置颜色值,常量(uniform)有4个float (16 bytes)
  35797. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35798. */
  35799. setColor(name: string, color: gfx.Color): void;
  35800. /**
  35801. * @en Set vector4 uniform which consists of 4 floats (16 bytes).
  35802. * @zh 设置vector4向量,常量(uniform)有4个float (16 bytes)
  35803. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35804. */
  35805. setVec4(name: string, vec: math.Vec4): void;
  35806. /**
  35807. * @en Set vector2 uniform which consists of 2 floats (8 bytes).
  35808. * @zh 设置vector2向量,常量(uniform)有2个float (8 bytes)
  35809. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35810. */
  35811. setVec2(name: string, vec: math.Vec2): void;
  35812. /**
  35813. * @en Set float uniform (4 bytes).
  35814. * @zh 设置浮点值 (4 bytes)
  35815. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35816. */
  35817. setFloat(name: string, v: number): void;
  35818. /**
  35819. * @en Set uniform array.
  35820. * Size and type of the data should match the corresponding uniforms in the shader.
  35821. * Mismatches will cause undefined behaviour.
  35822. * Memory alignment is not required.
  35823. * @zh 设置数组。类型与大小需要与着色器中的常量(uniform)相匹配,不匹配会引起未定义行为。
  35824. * 内存地址不需要对齐。
  35825. * @param name @en uniform name in shader. @zh 填写着色器中的常量(uniform)名字
  35826. * @param arrayBuffer @en array of bytes @zh byte数组
  35827. */
  35828. setArrayBuffer(name: string, arrayBuffer: ArrayBuffer): void;
  35829. /**
  35830. * @en Set buffer descriptor.
  35831. * Size and type of the buffer should match the one in shader.
  35832. * Buffer should be in read states and satisfy shader stage visibilities.
  35833. * Mismatches will cause undefined behaviour.
  35834. * @zh 设置缓冲(buffer)描述符。大小与类型需要与着色器中的一致,处于只读状态且着色阶段可见。
  35835. * 不匹配会引起未定义行为。
  35836. * @param name @en descriptor name in shader. @zh 填写着色器中的描述符(descriptor)名字
  35837. * @param buffer @en readonly buffer @zh 只读的缓冲
  35838. */
  35839. setBuffer(name: string, buffer: gfx.Buffer): void;
  35840. /**
  35841. * @en Set texture descriptor.
  35842. * Type of the texture should match the one in shader.
  35843. * Texture should be in read states and satisfy shader stage visibilities.
  35844. * Mismatches will cause undefined behaviour.
  35845. * @zh 设置贴图描述符。类型需要与着色器中的一致,处于只读状态且着色阶段可见。
  35846. * 不匹配会引起未定义行为。
  35847. * @param name @en descriptor name in shader. @zh 填写着色器中的描述符(descriptor)名字
  35848. * @param texture @en readonly texture @zh 只读的贴图
  35849. */
  35850. setTexture(name: string, texture: gfx.Texture): void;
  35851. /**
  35852. * @deprecated Method will be removed in 3.9.0
  35853. */
  35854. setReadWriteBuffer(name: string, buffer: gfx.Buffer): void;
  35855. /**
  35856. * @deprecated Method will be removed in 3.9.0
  35857. */
  35858. setReadWriteTexture(name: string, texture: gfx.Texture): void;
  35859. /**
  35860. * @en Set sampler descriptor.
  35861. * Type of the sampler should match the one in shader.
  35862. * @zh 设置采样器描述符。类型需要与着色器中的一致。
  35863. * 不匹配会引起未定义行为。
  35864. * @param name @en descriptor name in shader. @zh 填写着色器中的描述符(descriptor)名字
  35865. */
  35866. setSampler(name: string, sampler: gfx.Sampler): void;
  35867. /**
  35868. * @en Set builtin camera constants of CCCamera, such as cc_matView.
  35869. * For list of constants, please check CCCamera in cc-global.chunk.
  35870. * @zh 设置内置相机常量,例如cc_matView。
  35871. * 具体常量见cc-global.chunk中的CCCamera.
  35872. * @param camera @en The camera instance to be set. @zh 当前相机
  35873. */
  35874. setBuiltinCameraConstants(camera: renderer.scene.Camera): void;
  35875. /**
  35876. * @deprecated Method will be removed in 3.9.0
  35877. * @en Same as setBuiltinDirectionalLightConstants
  35878. * @zh 同setBuiltinDirectionalLightConstants
  35879. * @param light @en The main light. @zh 主光
  35880. */
  35881. setBuiltinShadowMapConstants(light: renderer.scene.DirectionalLight): void;
  35882. /**
  35883. * @en Set builtin directional light and shadow constants.
  35884. * For list of constants, please check CCShadow in cc-shadow.chunk and CCCamera in cc-global.chunk.
  35885. * @zh 设置内置方向光与阴影常量。
  35886. * 具体常量见cc-shadow.chunk中的CCShadow与cc-global.chunk中的CCCamera。
  35887. * @param light @en The main light. @zh 主光
  35888. * @param camera @en The camera instance to be set. @zh 当前相机
  35889. */
  35890. setBuiltinDirectionalLightConstants(light: renderer.scene.DirectionalLight, camera: renderer.scene.Camera): void;
  35891. /**
  35892. * @en Set builtin sphere light and shadow constants.
  35893. * For list of constants, please check CCShadow in cc-shadow.chunk and CCForwardLight in cc-forward-light.chunk.
  35894. * @zh 设置内置球形光与阴影常量。
  35895. * 具体常量见cc-shadow.chunk中的CCShadow与cc-forward-light.chunk中的CCForwardLight。
  35896. * @param light @en The sphere light. @zh 球形光源
  35897. * @param camera @en The camera instance to be set. @zh 当前相机
  35898. */
  35899. setBuiltinSphereLightConstants(light: renderer.scene.SphereLight, camera: renderer.scene.Camera): void;
  35900. /**
  35901. * @en Set builtin spot light and shadow constants.
  35902. * For list of constants, please check CCShadow in cc-shadow.chunk and CCForwardLight in cc-forward-light.chunk.
  35903. * @zh 设置内置探照光与阴影常量。
  35904. * 具体常量见cc-shadow.chunk中的CCShadow与cc-forward-light.chunk中的CCForwardLight。
  35905. * @param light @en The spot light. @zh 探照光源
  35906. * @param camera @en The camera instance to be set. @zh 当前相机
  35907. */
  35908. setBuiltinSpotLightConstants(light: renderer.scene.SpotLight, camera: renderer.scene.Camera): void;
  35909. /**
  35910. * @en Set builtin point light and shadow constants.
  35911. * For list of constants, please check CCShadow in cc-shadow.chunk and CCForwardLight in cc-forward-light.chunk.
  35912. * @zh 设置内置点光与阴影常量。
  35913. * 具体常量见cc-shadow.chunk中的CCShadow与cc-forward-light.chunk中的CCForwardLight。
  35914. * @param light @en The point light. @zh 点光源
  35915. * @param camera @en The camera instance to be set. @zh 当前相机
  35916. */
  35917. setBuiltinPointLightConstants(light: renderer.scene.PointLight, camera: renderer.scene.Camera): void;
  35918. /**
  35919. * @en Set builtin ranged directional light and shadow constants.
  35920. * For list of constants, please check CCShadow in cc-shadow.chunk and CCForwardLight in cc-forward-light.chunk.
  35921. * @zh 设置内置区间平行光与阴影常量。
  35922. * 具体常量见cc-shadow.chunk中的CCShadow与cc-forward-light.chunk中的CCForwardLight。
  35923. * @param light @en The ranged directional light. @zh 区间平行光源
  35924. * @param camera @en The camera instance to be set. @zh 当前相机
  35925. */
  35926. setBuiltinRangedDirectionalLightConstants(light: renderer.scene.RangedDirectionalLight, camera: renderer.scene.Camera): void;
  35927. /**
  35928. * @en Set builtin directional light frustum and shadow constants.
  35929. * These constants are used in builtin shadow map, cascaded shadow map and planar shadow.
  35930. * For list of constants, please check CCShadow in cc-shadow.chunk and CCCSM in cc-csm.chunk.
  35931. * @zh 设置内置平行光视锥与阴影常量。
  35932. * 这些常量用于内置的阴影、级联阴影与平面阴影。
  35933. * 具体常量见cc-shadow.chunk中的CCShadow与cc-csm.chunk中的CCCSM。
  35934. * @param light @en The directional light. @zh 平行光源
  35935. * @param camera @en The camera instance to be set. @zh 当前相机
  35936. * @param csmLevel @en Curent level of cascaded shadow map @zh 级联阴影等级
  35937. */
  35938. setBuiltinDirectionalLightFrustumConstants(camera: renderer.scene.Camera, light: renderer.scene.DirectionalLight, csmLevel?: number): void;
  35939. /**
  35940. * @en Set builtin spot light frustum and shadow constants.
  35941. * These constants are used in builtin shadow map.
  35942. * For list of constants, please check CCShadow in cc-shadow.chunk.
  35943. * @zh 设置内置探照光视锥与阴影常量。
  35944. * 这些常量用于内置的阴影。
  35945. * 具体常量见cc-shadow.chunk中的CCShadow。
  35946. * @param light @en The spot light. @zh 探照光源
  35947. */
  35948. setBuiltinSpotLightFrustumConstants(light: renderer.scene.SpotLight): void;
  35949. }
  35950. /**
  35951. * @en Scene
  35952. * A scene is an abstraction of content for rendering.
  35953. * @zh 场景。需要绘制的场景内容。
  35954. */
  35955. export interface SceneBuilder extends Setter {
  35956. /**
  35957. * @en Use the frustum information of light instead of camera.
  35958. * Often used in building shadow map.
  35959. * @zh 使用光源视锥进行投影,而不是用相机。常用于shadow map的生成。
  35960. * @param light @en The light used for projection @zh 用于投影的光源
  35961. * @param csmLevel @en Curent level of cascaded shadow map @zh 级联阴影等级
  35962. * @param optCamera @en Additional scene culling camera. @zh 额外的场景裁切相机
  35963. */
  35964. useLightFrustum(light: renderer.scene.Light, csmLevel?: number, optCamera?: renderer.scene.Camera): void;
  35965. }
  35966. /**
  35967. * @en Render queue
  35968. * A render queue is an abstraction of graphics commands submission.
  35969. * Only when the graphics commands in a render queue are all submitted,
  35970. * the next render queue will start submitting.
  35971. * @zh 渲染队列。渲染队列是图形命令提交的抽象。
  35972. * 只有一个渲染队列中的渲染命令全部提交完,才会开始提交下一个渲染队列中的命令。
  35973. */
  35974. export interface RenderQueueBuilder extends Setter {
  35975. /**
  35976. * @deprecated Method will be removed in 3.9.0
  35977. * @en Render the scene the camera is looking at.
  35978. * @zh 渲染当前相机指向的场景。
  35979. * @param camera @en Required camera @zh 所需相机
  35980. * @param light @en Lighting information of the scene @zh 场景光照信息
  35981. * @param sceneFlags @en Rendering flags of the scene @zh 场景渲染标志位
  35982. */
  35983. addSceneOfCamera(camera: renderer.scene.Camera, light: LightInfo, sceneFlags?: SceneFlags): void;
  35984. /**
  35985. * @en Add the scene to be rendered.
  35986. * If SceneFlags.NON_BUILTIN is specified, no builtin constants will be set.
  35987. * Otherwise, related builtin constants will be set automatically.
  35988. * @zh 添加需要绘制的场景。
  35989. * 如果设置了SceneFlags.NON_BUILTIN,那么不会自动设置内置常量。
  35990. * @param camera @en Camera used for projection @zh 用于投影的相机
  35991. * @param sceneFlags @en Rendering flags of the scene @zh 场景渲染标志位
  35992. * @param light @en Light used for lighting computation @zh 用于光照的光源
  35993. */
  35994. addScene(camera: renderer.scene.Camera, sceneFlags: SceneFlags, light?: renderer.scene.Light): SceneBuilder;
  35995. /**
  35996. * @en Render a full-screen quad.
  35997. * @zh 渲染全屏四边形
  35998. * @param material @en The material used for shading @zh 着色所需材质
  35999. * @param passID @en Material pass ID @zh 材质通道ID
  36000. * @param sceneFlags @en Rendering flags of the quad @zh Quad所需场景渲染标志位
  36001. */
  36002. addFullscreenQuad(material: Material, passID: number, sceneFlags?: SceneFlags): void;
  36003. /**
  36004. * @en Render a full-screen quad from the camera view.
  36005. * @zh 从相机视角渲染全屏四边形
  36006. * @param camera @en The required camera @zh 所需相机
  36007. * @param material @en The material used for shading @zh 着色所需材质
  36008. * @param passID @en Material pass ID @zh 材质通道ID
  36009. * @param sceneFlags @en Rendering flags of the quad @zh Quad所需场景渲染标志位
  36010. */
  36011. addCameraQuad(camera: renderer.scene.Camera, material: Material, passID: number, sceneFlags?: SceneFlags): void;
  36012. /**
  36013. * @en Clear current render target.
  36014. * @zh 清除当前渲染目标
  36015. * @param name @en The name of the render target @zh 渲染目标的名字
  36016. * @param color @en The clearing color @zh 用来清除与填充的颜色
  36017. */
  36018. clearRenderTarget(name: string, color?: gfx.Color): void;
  36019. /**
  36020. * @en Set rendering viewport.
  36021. * @zh 设置渲染视口
  36022. * @param viewport @en The required viewport @zh 所需视口
  36023. */
  36024. setViewport(viewport: gfx.Viewport): void;
  36025. /**
  36026. * @experimental
  36027. */
  36028. addCustomCommand(customBehavior: string): void;
  36029. }
  36030. /**
  36031. * @en Basic render pass.
  36032. * @zh 基础光栅通道
  36033. */
  36034. export interface BasicRenderPassBuilder extends Setter {
  36035. /**
  36036. * @en Add render target for rasterization
  36037. * The render target must have registered in pipeline.
  36038. * @zh 添加光栅化渲染目标,渲染目标必须已注册。
  36039. * @param name @en name of the render target @zh 渲染目标的名字
  36040. * @param loadOp @en Type of load operation @zh 读取操作的类型
  36041. * @param storeOp @en Type of store operation @zh 写入操作的类型
  36042. * @param color @en The clear color to use when loadOp is Clear @zh 读取操作为清除时,所用颜色
  36043. */
  36044. addRenderTarget(name: string, loadOp?: gfx.LoadOp, storeOp?: gfx.StoreOp, color?: gfx.Color): void;
  36045. /**
  36046. * @en Add depth stencil for rasterization
  36047. * The depth stencil must have registered in pipeline.
  36048. * @zh 添加光栅化深度模板缓冲,深度模板缓冲必须已注册。
  36049. * @param name @en name of the depth stencil @zh 渲染目标的名字
  36050. * @param loadOp @en Type of load operation @zh 读取操作的类型
  36051. * @param storeOp @en Type of store operation @zh 写入操作的类型
  36052. * @param depth @en Depth value used to clear @zh 用于清除的深度值
  36053. * @param stencil @en Stencil value used to clear @zh 用于清除的模板值
  36054. * @param clearFlags @en To clear depth, stencil or both @zh 清除分量:深度、模板、两者。
  36055. */
  36056. addDepthStencil(name: string, loadOp?: gfx.LoadOp, storeOp?: gfx.StoreOp, depth?: number, stencil?: number, clearFlags?: gfx.ClearFlagBit): void;
  36057. /**
  36058. * @en Add texture for sampling
  36059. * The texture must have registered in pipeline.
  36060. * @zh 添加采样用的贴图,贴图必须已注册。
  36061. * @param name @en name of the texture @zh 贴图的注册名
  36062. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36063. * @param sampler @en the sampler to use @zh 采样器名字
  36064. * @param plane @en the image plane ID to sample (color|depth|stencil|video) @zh 需要采样的贴图平面(颜色|深度|模板|视频)
  36065. */
  36066. addTexture(name: string, slotName: string, sampler?: gfx.Sampler, plane?: number): void;
  36067. /**
  36068. * @en Add render queue.
  36069. * Every render queue has a hint type, such as NONE, OPAQUE, MASK or BLEND.
  36070. * User should only add objects of this hint type to the render queue.
  36071. * Objects of mixed types might cause downgrading of performance.
  36072. * The order of render queues should be adjusted according to the hardward and algorithms,
  36073. * in order to reach peak performance.
  36074. * For example, [1.opaque, 2.mask, 3.blend] might result in best performance on mobile platforms.
  36075. * This hint is for validation only and has no effect on rendering.
  36076. *
  36077. * Every render queue has a phase name. Only objects of the same phase name will be rendered.
  36078. *
  36079. * @zh 添加渲染队列
  36080. * 每个渲染队列有一个用途提示,例如无提示(NONE)、不透明(OPAQUE)、遮罩(MASK)和混合(BLEND)。
  36081. * 每个队列最好只渲染相匹配的对象,混合不同类型的对象,会造成性能下降。
  36082. * 不同类型队列的渲染顺序,需要根据硬件类型与渲染算法进行调整,以到达最高性能。
  36083. * 比如在移动平台上,先渲染OPAQUE,再渲染MASK、最后渲染BLEND可能会有最好的性能。
  36084. * 用途提示只用于问题检测,对渲染流程没有任何影响。
  36085. *
  36086. * 每个队列有一个相位(phase)名字,具有相同相位名字的物件才会被渲染。
  36087. *
  36088. * @param hint @en Usage hint of the queue @zh 用途的提示
  36089. * @param phaseName @en The name of the phase declared in the effect. Default value is 'default' @zh effect中相位(phase)的名字,缺省为'default'。
  36090. * @returns @en render queue builder @zh 渲染队列
  36091. */
  36092. addQueue(hint?: QueueHint, phaseName?: string): RenderQueueBuilder;
  36093. /**
  36094. * @en Set rendering viewport.
  36095. * @zh 设置渲染视口
  36096. * @param viewport @en The required viewport @zh 所需视口
  36097. */
  36098. setViewport(viewport: gfx.Viewport): void;
  36099. /**
  36100. * @deprecated Method will be removed in 3.9.0
  36101. */
  36102. setVersion(name: string, version: number): void;
  36103. /**
  36104. * @en Show statistics on screen
  36105. * @zh 在屏幕上渲染统计数据
  36106. */
  36107. showStatistics: boolean;
  36108. }
  36109. /**
  36110. * @en Basic multisample render pass builder
  36111. * Support resolve render targets and depth stencil.
  36112. * This render pass only contains one render subpass.
  36113. * If resolve targets are specified, they will be resolved at the end of the render pass.
  36114. * After resolving, the contents of multisample render targets and depth stencils are unspecified.
  36115. * @zh 基础的多重采样渲染通道。支持决算(Resolve)渲染目标与深度缓冲。
  36116. * 此渲染通道只包含一个渲染子通道。
  36117. * 如果添加了决算对象,那么在渲染通道结束时,会进行决算。
  36118. * 决算后多重采样渲染目标与深度缓冲的内容是未定义的。
  36119. */
  36120. export interface BasicMultisampleRenderPassBuilder extends BasicRenderPassBuilder {
  36121. /**
  36122. * @en Set resolve render target
  36123. * @zh 设置决算渲染目标
  36124. */
  36125. resolveRenderTarget(source: string, target: string): void;
  36126. /**
  36127. * @en Set resolve depth stencil
  36128. * @zh 设置决算深度模板缓冲
  36129. */
  36130. resolveDepthStencil(source: string, target: string, depthMode?: gfx.ResolveMode, stencilMode?: gfx.ResolveMode): void;
  36131. }
  36132. /**
  36133. * @en BasicPipeline
  36134. * Basic pipeline provides basic rendering features which are supported on all platforms.
  36135. * User can register resources which will be used in the render graph.
  36136. * Theses resources are generally read and write, and will be managed by the pipeline.
  36137. * The residency information of resource should not be changed after registration.
  36138. * In each frame, user can create a render graph to be executed by the pipeline.
  36139. * @zh 基础渲染管线。
  36140. * 基础渲染管线提供基础的渲染能力,能在全平台使用。
  36141. * 用户可以在渲染管线中注册资源,这些资源将由管线托管,用于render graph。
  36142. * 这些资源一般是可读写的资源。
  36143. * 资源在注册后,不能更改驻留属性。
  36144. * 用户可以每帧构建一个render graph,然后交由管线执行。
  36145. */
  36146. export interface BasicPipeline extends __private._cocos_rendering_custom_pipeline__PipelineRuntime {
  36147. readonly type: PipelineType;
  36148. readonly capabilities: PipelineCapabilities;
  36149. /**
  36150. * @en Enable cpu culling of objects affected by the light. Enabled by default.
  36151. * @zh 光照计算时,裁切受光源影响的物件。默认开启。
  36152. */
  36153. enableCpuLightCulling: boolean;
  36154. /**
  36155. * @en Check whether the resource has been registered in the pipeline.
  36156. * @zh 检查资源是否在管线中已注册
  36157. * @param name @en Resource name @zh 资源名字
  36158. * @returns Exist or not
  36159. */
  36160. containsResource(name: string): boolean;
  36161. /**
  36162. * @en Add or update render window to the pipeline.
  36163. * @zh 注册或更新渲染窗口(RenderWindow)
  36164. * @param name @en Resource name @zh 资源名字
  36165. * @param format @en Expected format of the render window @zh 期望的渲染窗口格式
  36166. * @param width @en Expected width of the render window @zh 期望的渲染窗口宽度
  36167. * @param height @en Expected height of the render window @zh 期望的渲染窗口高度
  36168. * @param renderWindow @en The render window to add. @zh 需要注册的渲染窗口
  36169. * @returns Resource ID
  36170. */
  36171. addRenderWindow(name: string, format: gfx.Format, width: number, height: number, renderWindow: __private._cocos_render_scene_core_render_window__RenderWindow): number;
  36172. /**
  36173. * @deprecated Method will be removed in 3.9.0
  36174. * @en Update render window information.
  36175. * When render window information is updated, such as resized, user should notify the pipeline.
  36176. * @zh 更新渲染窗口信息。当渲染窗口发生更新时,用户应通知管线。
  36177. * @param renderWindow @en The render window to update. @zh 渲染窗口
  36178. */
  36179. updateRenderWindow(name: string, renderWindow: __private._cocos_render_scene_core_render_window__RenderWindow): void;
  36180. /**
  36181. * @en Add or update 2D render target.
  36182. * @zh 添加或更新2D渲染目标
  36183. * @param name @en Resource name @zh 资源名字
  36184. * @param format @en Format of the resource @zh 资源的格式
  36185. * @param width @en Width of the resource @zh 资源的宽度
  36186. * @param height @en Height of the resource @zh 资源的高度
  36187. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36188. * @returns Resource ID
  36189. */
  36190. addRenderTarget(name: string, format: gfx.Format, width: number, height: number, residency?: ResourceResidency): number;
  36191. /**
  36192. * @en Add or update 2D depth stencil.
  36193. * @zh 添加或更新2D深度模板缓冲
  36194. * @param name @en Resource name @zh 资源名字
  36195. * @param format @en Format of the resource @zh 资源的格式
  36196. * @param width @en Width of the resource @zh 资源的宽度
  36197. * @param height @en Height of the resource @zh 资源的高度
  36198. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36199. * @returns Resource ID
  36200. */
  36201. addDepthStencil(name: string, format: gfx.Format, width: number, height: number, residency?: ResourceResidency): number;
  36202. /**
  36203. * @deprecated Method will be removed in 3.9.0
  36204. * @en Update render target information.
  36205. * @zh 更新渲染目标的信息
  36206. * @param name @en Resource name @zh 资源名字
  36207. * @param width @en Width of the resource @zh 资源的宽度
  36208. * @param height @en Height of the resource @zh 资源的高度
  36209. * @param format @en Format of the resource @zh 资源的格式
  36210. */
  36211. updateRenderTarget(name: string, width: number, height: number, format?: gfx.Format): void;
  36212. /**
  36213. * @deprecated Method will be removed in 3.9.0
  36214. * @en Update depth stencil information.
  36215. * @zh 更新深度模板缓冲的信息
  36216. * @param name @en Resource name @zh 资源名字
  36217. * @param width @en Width of the resource @zh 资源的宽度
  36218. * @param height @en Height of the resource @zh 资源的高度
  36219. * @param format @en Format of the resource @zh 资源的格式
  36220. */
  36221. updateDepthStencil(name: string, width: number, height: number, format?: gfx.Format): void;
  36222. /**
  36223. * @en Add or update buffer.
  36224. * @zh 添加或更新缓冲
  36225. * @param name @en Resource name @zh 资源名字
  36226. * @param size @en Size of the resource in bytes @zh 资源的大小
  36227. * @param flags @en Flags of the resource @zh 资源的标志位
  36228. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36229. * @returns Resource ID
  36230. */
  36231. addBuffer(name: string, size: number, flags: ResourceFlags, residency: ResourceResidency): number;
  36232. /**
  36233. * @deprecated Method will be removed in 3.9.0
  36234. * @en Update buffer information.
  36235. * @zh 更新缓冲的信息
  36236. * @param name @en Resource name @zh 资源名字
  36237. * @param size @en Size of the resource in bytes @zh 资源的大小
  36238. */
  36239. updateBuffer(name: string, size: number): void;
  36240. /**
  36241. * @en Add or update external texture.
  36242. * Must be readonly.
  36243. * @zh 添加或更新外部的贴图。贴图必须是只读的。
  36244. * @param name @en Resource name @zh 资源名字
  36245. * @param texture @en External unmanaged texture @zh 外部不受管理的贴图
  36246. * @param flags @en Flags of the resource @zh 资源的标志位
  36247. * @returns Resource ID
  36248. */
  36249. addExternalTexture(name: string, texture: gfx.Texture, flags: ResourceFlags): number;
  36250. /**
  36251. * @deprecated Method will be removed in 3.9.0
  36252. * @en Update external texture information.
  36253. * @zh 更新外部的贴图信息
  36254. * @param name @en Resource name @zh 资源名字
  36255. * @param texture @en External unmanaged texture @zh 外部不受管理的贴图
  36256. */
  36257. updateExternalTexture(name: string, texture: gfx.Texture): void;
  36258. /**
  36259. * @en Add or update texture.
  36260. * @zh 添加或更新外部的贴图。
  36261. * @param name @en Resource name @zh 资源名字
  36262. * @param type @en Type of the texture @zh 贴图的类型
  36263. * @param format @en Format of the texture @zh 贴图的格式
  36264. * @param width @en Width of the resource @zh 资源的宽度
  36265. * @param height @en Height of the resource @zh 资源的高度
  36266. * @param depth @en Depth of the resource @zh 资源的深度
  36267. * @param arraySize @en Size of the array @zh 资源数组的大小
  36268. * @param mipLevels @en Mip levels of the texture @zh 贴图的Mipmap数目
  36269. * @param sampleCount @en Sample count of the texture @zh 贴图的采样数目
  36270. * @param flags @en Flags of the resource @zh 资源的标志位
  36271. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36272. * @returns Resource ID
  36273. */
  36274. addTexture(name: string, type: gfx.TextureType, format: gfx.Format, width: number, height: number, depth: number, arraySize: number, mipLevels: number, sampleCount: gfx.SampleCount, flags: ResourceFlags, residency: ResourceResidency): number;
  36275. /**
  36276. * @deprecated Method will be removed in 3.9.0
  36277. * @en Update texture information.
  36278. * @zh 更新贴图信息
  36279. * @param name @en Resource name @zh 资源名字
  36280. * @param format @en Format of the texture @zh 贴图的格式
  36281. * @param width @en Width of the resource @zh 资源的宽度
  36282. * @param height @en Height of the resource @zh 资源的高度
  36283. * @param depth @en Depth of the resource @zh 资源的深度
  36284. * @param arraySize @en Size of the array @zh 资源数组的大小
  36285. * @param mipLevels @en Mip levels of the texture @zh 贴图的Mipmap数目
  36286. * @param sampleCount @en Sample count of the texture @zh 贴图的采样数目
  36287. */
  36288. updateTexture(name: string, format: gfx.Format, width: number, height: number, depth: number, arraySize: number, mipLevels: number, sampleCount: gfx.SampleCount): void;
  36289. /**
  36290. * @en Add or update resource.
  36291. * @zh 添加或更新资源
  36292. * @param name @en Resource name @zh 资源名字
  36293. * @param dimension @en Dimension of the resource @zh 资源的维度
  36294. * @param format @en Format of the texture @zh 资源的格式
  36295. * @param width @en Width of the resource @zh 资源的宽度
  36296. * @param height @en Height of the resource @zh 资源的高度
  36297. * @param depth @en Depth of the resource @zh 资源的深度
  36298. * @param arraySize @en Size of the array @zh 资源数组的大小
  36299. * @param mipLevels @en Mip levels of the texture @zh 资源的Mipmap数目
  36300. * @param sampleCount @en Sample count of the texture @zh 资源的采样数目
  36301. * @param flags @en Flags of the resource @zh 资源的标志位
  36302. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36303. * @returns Resource ID
  36304. */
  36305. addResource(name: string, dimension: ResourceDimension, format: gfx.Format, width: number, height: number, depth: number, arraySize: number, mipLevels: number, sampleCount: gfx.SampleCount, flags: ResourceFlags, residency: ResourceResidency): number;
  36306. /**
  36307. * @deprecated Method will be removed in 3.9.0
  36308. * @en Update resource information.
  36309. * @zh 更新资源信息
  36310. * @param name @en Resource name @zh 资源名字
  36311. * @param format @en Format of the texture @zh 资源的格式
  36312. * @param width @en Width of the resource @zh 资源的宽度
  36313. * @param height @en Height of the resource @zh 资源的高度
  36314. * @param depth @en Depth of the resource @zh 资源的深度
  36315. * @param arraySize @en Size of the array @zh 资源数组的大小
  36316. * @param mipLevels @en Mip levels of the texture @zh 资源的Mipmap数目
  36317. * @param sampleCount @en Sample count of the texture @zh 资源的采样数目
  36318. */
  36319. updateResource(name: string, format: gfx.Format, width: number, height: number, depth: number, arraySize: number, mipLevels: number, sampleCount: gfx.SampleCount): void;
  36320. /**
  36321. * @en Add render pass
  36322. * @zh 添加渲染通道
  36323. * @param width @en Width of the render pass @zh 渲染通道的宽度
  36324. * @param height @en Height of the render pass @zh 渲染通道的高度
  36325. * @param passName @en Pass name declared in the effect. Default value is 'default' @zh effect中的pass name,缺省为'default'
  36326. * @returns Basic render pass builder
  36327. */
  36328. addRenderPass(width: number, height: number, passName?: string): BasicRenderPassBuilder;
  36329. /**
  36330. * @beta Feature is under development
  36331. * @en Add multisample render pass
  36332. * @zh 添加多重采样渲染通道
  36333. * @param width @en Width of the render pass @zh 渲染通道的宽度
  36334. * @param height @en Height of the render pass @zh 渲染通道的高度
  36335. * @param count @en Sample count @zh 采样数
  36336. * @param quality @en Sample quality. Default value is 0 @zh 采样质量,默认值是0
  36337. * @param passName @en Pass name declared in the effect. Default value is 'default' @zh effect中的pass name,缺省为'default'
  36338. * @returns Multisample basic render pass builder
  36339. */
  36340. addMultisampleRenderPass(width: number, height: number, count: number, quality: number, passName?: string): BasicMultisampleRenderPassBuilder;
  36341. /**
  36342. * @deprecated Method will be removed in 3.9.0
  36343. */
  36344. addResolvePass(resolvePairs: ResolvePair[]): void;
  36345. /**
  36346. * @en Add copy pass.
  36347. * The source and target resources:
  36348. * Must be different resources(have different resource names).
  36349. * Must have compatible formats.
  36350. * Must have identical dimensions(width, height, depth), sample count and sample quality.
  36351. * Can't be currently mapped.
  36352. *
  36353. * Reinterpret copy is not supported.
  36354. *
  36355. * @zh 添加拷贝通道,来源与目标必须满足:
  36356. * 是不同的注册资源。
  36357. * 资源格式兼容。
  36358. * 具有相同的尺寸、采样数、采样质量。
  36359. * 不能被Map。
  36360. *
  36361. * 暂不支持转义拷贝。
  36362. *
  36363. * @param copyPairs @en Array of copy source and target @zh 拷贝来源与目标的数组
  36364. */
  36365. addCopyPass(copyPairs: CopyPair[]): void;
  36366. /**
  36367. * @en Builtin reflection probe pass
  36368. * @zh 添加内置环境光反射通道
  36369. * @param camera @en Capturing camera @zh 用于捕捉的相机
  36370. */
  36371. addBuiltinReflectionProbePass(camera: renderer.scene.Camera): void;
  36372. }
  36373. /**
  36374. * @beta Feature is under development
  36375. * @en Render subpass
  36376. * @zh 渲染次通道
  36377. */
  36378. export interface RenderSubpassBuilder extends Setter {
  36379. /**
  36380. * @en Add render target for rasterization
  36381. * The render target must have registered in pipeline.
  36382. * @zh 添加光栅化渲染目标,渲染目标必须已注册。
  36383. * @param name @en name of the render target @zh 渲染目标的名字
  36384. * @param accessType @en Access type @zh 读写状态
  36385. * @param slotName @en name of the descriptor in shader @zh 着色器中描述符的名字
  36386. * @param loadOp @en Type of load operation @zh 读取操作的类型
  36387. * @param storeOp @en Type of store operation @zh 写入操作的类型
  36388. * @param color @en The clear color to use when loadOp is Clear @zh 读取操作为清除时,所用颜色
  36389. */
  36390. addRenderTarget(name: string, accessType: AccessType, slotName?: string, loadOp?: gfx.LoadOp, storeOp?: gfx.StoreOp, color?: gfx.Color): void;
  36391. /**
  36392. * @en Add depth stencil for rasterization
  36393. * The depth stencil must have registered in pipeline.
  36394. * @zh 添加光栅化深度模板缓冲,深度模板缓冲必须已注册。
  36395. * @param name @en name of the depth stencil @zh 渲染目标的名字
  36396. * @param accessType @en Access type @zh 读写状态
  36397. * @param depthSlotName @en name of the depth descriptor in shader @zh 着色器中深度描述符的名字
  36398. * @param stencilSlotName @en name of the stencil descriptor in shader @zh 着色器中模板描述符的名字
  36399. * @param loadOp @en Type of load operation @zh 读取操作的类型
  36400. * @param storeOp @en Type of store operation @zh 写入操作的类型
  36401. * @param depth @en Depth value used to clear @zh 用于清除的深度值
  36402. * @param stencil @en Stencil value used to clear @zh 用于清除的模板值
  36403. * @param clearFlags @en To clear depth, stencil or both @zh 清除分量:深度、模板、两者。
  36404. */
  36405. addDepthStencil(name: string, accessType: AccessType, depthSlotName?: string, stencilSlotName?: string, loadOp?: gfx.LoadOp, storeOp?: gfx.StoreOp, depth?: number, stencil?: number, clearFlags?: gfx.ClearFlagBit): void;
  36406. /**
  36407. * @en Add texture for sampling
  36408. * The texture must have registered in pipeline.
  36409. * @zh 添加采样用的贴图,贴图必须已注册。
  36410. * @param name @en name of the texture @zh 贴图的注册名
  36411. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36412. * @param sampler @en the sampler to use @zh 采样器名字
  36413. * @param plane @en the image plane ID to sample (color|depth|stencil|video) @zh 需要采样的贴图平面(颜色|深度|模板|视频)
  36414. */
  36415. addTexture(name: string, slotName: string, sampler?: gfx.Sampler, plane?: number): void;
  36416. /**
  36417. * @en Add storage buffer.
  36418. * The buffer must have registered in pipeline.
  36419. * @zh 添加存储缓冲,缓冲必须已注册。
  36420. * @param name @en Name of the buffer @zh 缓冲的注册名
  36421. * @param accessType @en Access type @zh 读写状态
  36422. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36423. */
  36424. addStorageBuffer(name: string, accessType: AccessType, slotName: string): void;
  36425. /**
  36426. * @en Add storage texture.
  36427. * The texture must have registered in pipeline.
  36428. * @zh 添加存储贴图,贴图必须已注册。
  36429. * @param name @en Name of the buffer @zh 贴图的注册名
  36430. * @param accessType @en Access type @zh 读写状态
  36431. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36432. */
  36433. addStorageImage(name: string, accessType: AccessType, slotName: string): void;
  36434. /**
  36435. * @en Set rendering viewport.
  36436. * @zh 设置渲染视口
  36437. * @param viewport @en The required viewport @zh 所需视口
  36438. */
  36439. setViewport(viewport: gfx.Viewport): void;
  36440. /**
  36441. * @en Add render queue.
  36442. * Every render queue has a hint type, such as NONE, OPAQUE, MASK or BLEND.
  36443. * User should only add objects of this hint type to the render queue.
  36444. * Objects of mixed types might cause downgrading of performance.
  36445. * The order of render queues should be adjusted according to the hardward and algorithms,
  36446. * in order to reach peak performance.
  36447. * For example, [1.opaque, 2.mask, 3.blend] might result in best performance on mobile platforms.
  36448. * This hint is for validation only and has no effect on rendering.
  36449. *
  36450. * Every render queue has a phase name. Only objects of the same phase name will be rendered.
  36451. *
  36452. * @zh 添加渲染队列
  36453. * 每个渲染队列有一个用途提示,例如无提示(NONE)、不透明(OPAQUE)、遮罩(MASK)和混合(BLEND)。
  36454. * 每个队列最好只渲染相匹配的对象,混合不同类型的对象,会造成性能下降。
  36455. * 不同类型队列的渲染顺序,需要根据硬件类型与渲染算法进行调整,以到达最高性能。
  36456. * 比如在移动平台上,先渲染OPAQUE,再渲染MASK、最后渲染BLEND可能会有最好的性能。
  36457. * 用途提示只用于问题检测,对渲染流程没有任何影响。
  36458. *
  36459. * 每个队列有一个相位(phase)名字,具有相同相位名字的物件才会被渲染。
  36460. *
  36461. * @param hint @en Usage hint of the queue @zh 用途的提示
  36462. * @param phaseName @en The name of the phase declared in the effect. Default value is 'default' @zh effect中相位(phase)的名字,缺省为'default'。
  36463. * @returns @en render queue builder @zh 渲染队列
  36464. */
  36465. addQueue(hint?: QueueHint, phaseName?: string): RenderQueueBuilder;
  36466. /**
  36467. * @en Show statistics on screen
  36468. * @zh 在屏幕上渲染统计数据
  36469. */
  36470. showStatistics: boolean;
  36471. /**
  36472. * @experimental
  36473. */
  36474. setCustomShaderStages(name: string, stageFlags: gfx.ShaderStageFlagBit): void;
  36475. }
  36476. /**
  36477. * @beta Feature is under development
  36478. * @en Multisample render subpass
  36479. * @zh 多重采样渲染次通道
  36480. */
  36481. export interface MultisampleRenderSubpassBuilder extends RenderSubpassBuilder {
  36482. /**
  36483. * @en Resolve render target
  36484. * @zh 汇总渲染目标
  36485. * @param source @en Multisample source @zh 多重采样来源
  36486. * @param target @en Resolve target @zh 汇总目标
  36487. */
  36488. resolveRenderTarget(source: string, target: string): void;
  36489. /**
  36490. * @en Resolve depth stencil
  36491. * @zh 汇总深度模板缓冲
  36492. * @param source @en Multisample source @zh 多重采样来源
  36493. * @param target @en Resolve target @zh 汇总目标
  36494. * @param depthMode @en Resolve mode of depth component @zh 深度分量汇总模式
  36495. * @param stencilMode @en Resolve mode of stencil component @zh 模板分量汇总模式
  36496. */
  36497. resolveDepthStencil(source: string, target: string, depthMode?: gfx.ResolveMode, stencilMode?: gfx.ResolveMode): void;
  36498. }
  36499. /**
  36500. * @en Compute queue
  36501. * @zh 计算队列
  36502. */
  36503. export interface ComputeQueueBuilder extends Setter {
  36504. /**
  36505. * @en Dispatch compute task
  36506. * @zh 发送计算任务
  36507. * @param threadGroupCountX @en Thread group count X @zh 线程组的X分量的数目
  36508. * @param threadGroupCountY @en Thread group count Y @zh 线程组的Y分量的数目
  36509. * @param threadGroupCountZ @en Thread group count Z @zh 线程组的Z分量的数目
  36510. * @param material @en The material to use @zh 计算任务用的材质
  36511. * @param passID @en The name of the pass declared in the effect. @zh effect中的通道名字
  36512. */
  36513. addDispatch(threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number, material?: Material, passID?: number): void;
  36514. }
  36515. /**
  36516. * @beta Feature is under development
  36517. * @en Compute subpass
  36518. * @zh 计算次通道
  36519. */
  36520. export interface ComputeSubpassBuilder extends Setter {
  36521. /**
  36522. * @en Add input render target.
  36523. * @zh 添加输入渲染目标
  36524. * @param name @en name of the render target @zh 渲染目标的名字
  36525. * @param slotName @en name of the descriptor in shader @zh 着色器中描述符的名字
  36526. */
  36527. addRenderTarget(name: string, slotName: string): void;
  36528. /**
  36529. * @en Add texture for sampling
  36530. * The texture must have registered in pipeline.
  36531. * @zh 添加采样用的贴图,贴图必须已注册。
  36532. * @param name @en name of the texture @zh 贴图的注册名
  36533. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36534. * @param sampler @en the sampler to use @zh 采样器名字
  36535. * @param plane @en the image plane ID to sample (color|depth|stencil|video) @zh 需要采样的贴图平面(颜色|深度|模板|视频)
  36536. */
  36537. addTexture(name: string, slotName: string, sampler?: gfx.Sampler, plane?: number): void;
  36538. /**
  36539. * @en Add storage buffer.
  36540. * The buffer must have registered in pipeline.
  36541. * @zh 添加存储缓冲,缓冲必须已注册。
  36542. * @param name @en Name of the buffer @zh 缓冲的注册名
  36543. * @param accessType @en Access type @zh 读写状态
  36544. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36545. */
  36546. addStorageBuffer(name: string, accessType: AccessType, slotName: string): void;
  36547. /**
  36548. * @en Add storage texture.
  36549. * The texture must have registered in pipeline.
  36550. * @zh 添加存储贴图,贴图必须已注册。
  36551. * @param name @en Name of the buffer @zh 贴图的注册名
  36552. * @param accessType @en Access type @zh 读写状态
  36553. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36554. */
  36555. addStorageImage(name: string, accessType: AccessType, slotName: string): void;
  36556. /**
  36557. * @en Add render queue.
  36558. * Every render queue has a hint type, such as NONE, OPAQUE, MASK or BLEND.
  36559. * User should only add objects of this hint type to the render queue.
  36560. * Objects of mixed types might cause downgrading of performance.
  36561. * The order of render queues should be adjusted according to the hardward and algorithms,
  36562. * in order to reach peak performance.
  36563. * For example, [1.opaque, 2.mask, 3.blend] might result in best performance on mobile platforms.
  36564. * This hint is for validation only and has no effect on rendering.
  36565. *
  36566. * Every render queue has a phase name. Only objects of the same phase name will be rendered.
  36567. *
  36568. * @zh 添加渲染队列
  36569. * 每个渲染队列有一个用途提示,例如无提示(NONE)、不透明(OPAQUE)、遮罩(MASK)和混合(BLEND)。
  36570. * 每个队列最好只渲染相匹配的对象,混合不同类型的对象,会造成性能下降。
  36571. * 不同类型队列的渲染顺序,需要根据硬件类型与渲染算法进行调整,以到达最高性能。
  36572. * 比如在移动平台上,先渲染OPAQUE,再渲染MASK、最后渲染BLEND可能会有最好的性能。
  36573. * 用途提示只用于问题检测,对渲染流程没有任何影响。
  36574. *
  36575. * 每个队列有一个相位(phase)名字,具有相同相位名字的物件才会被渲染。
  36576. *
  36577. * @param hint @en Usage hint of the queue @zh 用途的提示
  36578. * @param phaseName @en The name of the phase declared in the effect. Default value is 'default' @zh effect中相位(phase)的名字,缺省为'default'。
  36579. * @returns @en compute queue builder @zh 计算队列
  36580. */
  36581. addQueue(phaseName?: string): ComputeQueueBuilder;
  36582. /**
  36583. * @experimental
  36584. */
  36585. setCustomShaderStages(name: string, stageFlags: gfx.ShaderStageFlagBit): void;
  36586. }
  36587. /**
  36588. * @beta Feature is under development
  36589. * @en Render pass
  36590. * @zh 渲染通道
  36591. */
  36592. export interface RenderPassBuilder extends BasicRenderPassBuilder {
  36593. /**
  36594. * @en Add storage buffer.
  36595. * The buffer must have registered in pipeline.
  36596. * @zh 添加存储缓冲,缓冲必须已注册。
  36597. * @param name @en Name of the buffer @zh 缓冲的注册名
  36598. * @param accessType @en Access type @zh 读写状态
  36599. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36600. */
  36601. addStorageBuffer(name: string, accessType: AccessType, slotName: string): void;
  36602. /**
  36603. * @en Add storage texture.
  36604. * The texture must have registered in pipeline.
  36605. * @zh 添加存储贴图,贴图必须已注册。
  36606. * @param name @en Name of the buffer @zh 贴图的注册名
  36607. * @param accessType @en Access type @zh 读写状态
  36608. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36609. */
  36610. addStorageImage(name: string, accessType: AccessType, slotName: string): void;
  36611. /**
  36612. * @beta Feature is under development
  36613. */
  36614. addMaterialTexture(resourceName: string, flags?: gfx.ShaderStageFlagBit): void;
  36615. /**
  36616. * @beta Feature is under development
  36617. * @en Add render subpass.
  36618. * @zh 添加渲染次通道
  36619. * @param subpassName @en Subpass name declared in the effect @zh effect中的subpass name
  36620. * @returns Render subpass builder
  36621. */
  36622. addRenderSubpass(subpassName: string): RenderSubpassBuilder;
  36623. /**
  36624. * @beta Feature is under development
  36625. * @en Add multisample render subpass.
  36626. * Sample count and quality should match those of the resources.
  36627. * @zh 添加多重采样渲染次通道,采样数与质量需要与资源一致。
  36628. * @param count @en Sample count @zh 采样数
  36629. * @param quality @en Sample quality @zh 采样质量
  36630. * @param subpassName @en Subpass name declared in the effect @zh effect中的subpass name
  36631. * @returns Multisample render subpass builder
  36632. */
  36633. addMultisampleRenderSubpass(count: number, quality: number, subpassName: string): MultisampleRenderSubpassBuilder;
  36634. /**
  36635. * @experimental
  36636. * @en Add compute subpass.
  36637. * @zh 添加计算次通道
  36638. * @param subpassName @en Subpass name declared in the effect @zh effect中的subpass name
  36639. * @returns Compute subpass builder
  36640. */
  36641. addComputeSubpass(subpassName?: string): ComputeSubpassBuilder;
  36642. /**
  36643. * @experimental
  36644. */
  36645. setCustomShaderStages(name: string, stageFlags: gfx.ShaderStageFlagBit): void;
  36646. }
  36647. /**
  36648. * @en Multisample render pass builder
  36649. * @zh 多重采样渲染通道。
  36650. */
  36651. export interface MultisampleRenderPassBuilder extends BasicMultisampleRenderPassBuilder {
  36652. /**
  36653. * @en Add storage buffer
  36654. * @zh 添加存储缓冲
  36655. * @param name @en Name of the storage buffer @zh 存储缓冲的名字
  36656. * @param accessType @en Access type of the buffer in the render pass @zh 渲染通道中缓冲的读写状态
  36657. * @param slotName @en name of the descriptor in shader @zh 着色器中描述符的名字
  36658. */
  36659. addStorageBuffer(name: string, accessType: AccessType, slotName: string): void;
  36660. /**
  36661. * @en Add storage image
  36662. * @zh 添加存储贴图
  36663. * @param name @en Name of the storage texture @zh 存储贴图的名字
  36664. * @param accessType @en Access type of the texture in the render pass @zh 渲染通道中贴图的读写状态
  36665. * @param slotName @en name of the descriptor in shader @zh 着色器中描述符的名字
  36666. */
  36667. addStorageImage(name: string, accessType: AccessType, slotName: string): void;
  36668. }
  36669. /**
  36670. * @en Compute pass
  36671. * @zh 计算通道
  36672. */
  36673. export interface ComputePassBuilder extends Setter {
  36674. /**
  36675. * @en Add texture for sampling
  36676. * The texture must have registered in pipeline.
  36677. * @zh 添加采样用的贴图,贴图必须已注册。
  36678. * @param name @en name of the texture @zh 贴图的注册名
  36679. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36680. * @param sampler @en the sampler to use @zh 采样器名字
  36681. * @param plane @en the image plane ID to sample (color|depth|stencil|video) @zh 需要采样的贴图平面(颜色|深度|模板|视频)
  36682. */
  36683. addTexture(name: string, slotName: string, sampler?: gfx.Sampler, plane?: number): void;
  36684. /**
  36685. * @en Add storage buffer.
  36686. * The buffer must have registered in pipeline.
  36687. * @zh 添加存储缓冲,缓冲必须已注册。
  36688. * @param name @en Name of the buffer @zh 缓冲的注册名
  36689. * @param accessType @en Access type @zh 读写状态
  36690. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36691. */
  36692. addStorageBuffer(name: string, accessType: AccessType, slotName: string): void;
  36693. /**
  36694. * @en Add storage texture.
  36695. * The texture must have registered in pipeline.
  36696. * @zh 添加存储贴图,贴图必须已注册。
  36697. * @param name @en Name of the buffer @zh 贴图的注册名
  36698. * @param accessType @en Access type @zh 读写状态
  36699. * @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
  36700. */
  36701. addStorageImage(name: string, accessType: AccessType, slotName: string): void;
  36702. /**
  36703. * @beta Feature is under development
  36704. */
  36705. addMaterialTexture(resourceName: string, flags?: gfx.ShaderStageFlagBit): void;
  36706. /**
  36707. * @en Add render queue.
  36708. * Every render queue has a hint type, such as NONE, OPAQUE, MASK or BLEND.
  36709. * User should only add objects of this hint type to the render queue.
  36710. * Objects of mixed types might cause downgrading of performance.
  36711. * The order of render queues should be adjusted according to the hardward and algorithms,
  36712. * in order to reach peak performance.
  36713. * For example, [1.opaque, 2.mask, 3.blend] might result in best performance on mobile platforms.
  36714. * This hint is for validation only and has no effect on rendering.
  36715. *
  36716. * Every render queue has a phase name. Only objects of the same phase name will be rendered.
  36717. *
  36718. * @zh 添加渲染队列
  36719. * 每个渲染队列有一个用途提示,例如无提示(NONE)、不透明(OPAQUE)、遮罩(MASK)和混合(BLEND)。
  36720. * 每个队列最好只渲染相匹配的对象,混合不同类型的对象,会造成性能下降。
  36721. * 不同类型队列的渲染顺序,需要根据硬件类型与渲染算法进行调整,以到达最高性能。
  36722. * 比如在移动平台上,先渲染OPAQUE,再渲染MASK、最后渲染BLEND可能会有最好的性能。
  36723. * 用途提示只用于问题检测,对渲染流程没有任何影响。
  36724. *
  36725. * 每个队列有一个相位(phase)名字,具有相同相位名字的物件才会被渲染。
  36726. *
  36727. * @param hint @en Usage hint of the queue @zh 用途的提示
  36728. * @param phaseName @en The name of the phase declared in the effect. Default value is 'default' @zh effect中相位(phase)的名字,缺省为'default'。
  36729. * @returns @en compute queue builder @zh 计算队列
  36730. */
  36731. addQueue(phaseName?: string): ComputeQueueBuilder;
  36732. /**
  36733. * @experimental
  36734. */
  36735. setCustomShaderStages(name: string, stageFlags: gfx.ShaderStageFlagBit): void;
  36736. }
  36737. /**
  36738. * @en Render pipeline.
  36739. * @zh 渲染管线
  36740. */
  36741. export interface Pipeline extends BasicPipeline {
  36742. /**
  36743. * @en Add or update storage buffer.
  36744. * @zh 添加或更新存储缓冲
  36745. * @param name @en Resource name @zh 资源名字
  36746. * @param format @en Format of the resource @zh 资源的格式
  36747. * @param size @en Size of the resource in bytes @zh 资源的大小
  36748. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36749. */
  36750. addStorageBuffer(name: string, format: gfx.Format, size: number, residency?: ResourceResidency): number;
  36751. /**
  36752. * @en Add or update 2D storage texture
  36753. * @zh 添加或更新2D存储贴图
  36754. * @param name @en Resource name @zh 资源名字
  36755. * @param format @en Format of the resource @zh 资源的格式
  36756. * @param width @en Width of the resource @zh 资源的宽度
  36757. * @param height @en Height of the resource @zh 资源的高度
  36758. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36759. */
  36760. addStorageTexture(name: string, format: gfx.Format, width: number, height: number, residency?: ResourceResidency): number;
  36761. /**
  36762. * @experimental
  36763. * @en Add or update 2D shading rate texture
  36764. * @zh 添加或更新2D着色率贴图
  36765. * @param name @en Resource name @zh 资源名字
  36766. * @param width @en Width of the resource @zh 资源的宽度
  36767. * @param height @en Height of the resource @zh 资源的高度
  36768. * @param residency @en Residency of the resource. @zh 资源的驻留性
  36769. */
  36770. addShadingRateTexture(name: string, width: number, height: number, residency?: ResourceResidency): number;
  36771. /**
  36772. * @en Update storage buffer information.
  36773. * @zh 更新存储缓冲的信息
  36774. * @param name @en Resource name @zh 资源名字
  36775. * @param size @en Size of the resource in bytes @zh 资源的大小
  36776. * @param format @en Format of the resource @zh 资源的格式
  36777. */
  36778. updateStorageBuffer(name: string, size: number, format?: gfx.Format): void;
  36779. /**
  36780. * @en Update storage texture information.
  36781. * @zh 更新2D存储贴图的信息
  36782. * @param name @en Resource name @zh 资源名字
  36783. * @param width @en Width of the resource @zh 资源的宽度
  36784. * @param height @en Height of the resource @zh 资源的高度
  36785. * @param format @en Format of the resource @zh 资源的格式
  36786. */
  36787. updateStorageTexture(name: string, width: number, height: number, format?: gfx.Format): void;
  36788. /**
  36789. * @en Update shading rate texture information.
  36790. * @zh 更新2D着色率贴图的信息
  36791. * @param name @en Resource name @zh 资源名字
  36792. * @param width @en Width of the resource @zh 资源的宽度
  36793. * @param height @en Height of the resource @zh 资源的高度
  36794. */
  36795. updateShadingRateTexture(name: string, width: number, height: number): void;
  36796. /**
  36797. * @en Add render pass
  36798. * @zh 添加渲染通道
  36799. * @param width @en Width of the render pass @zh 渲染通道的宽度
  36800. * @param height @en Height of the render pass @zh 渲染通道的高度
  36801. * @param passName @en Pass name declared in the effect. Default value is 'default' @zh effect中的pass name,缺省为'default'
  36802. * @returns Render pass builder
  36803. */
  36804. addRenderPass(width: number, height: number, passName: string): RenderPassBuilder;
  36805. /**
  36806. * @en Add multisample render pass
  36807. * @zh 添加多重采样渲染通道
  36808. * @param width @en Width of the render pass @zh 渲染通道的宽度
  36809. * @param height @en Height of the render pass @zh 渲染通道的高度
  36810. * @param count @en Sample count @zh 采样数目
  36811. * @param quality @en Sample quality (default is 0) @zh 采样质量(默认为0)
  36812. * @param passName @en Pass name declared in the effect. Default value is 'default' @zh effect中的pass name,缺省为'default'
  36813. * @returns Multisample render pass builder
  36814. */
  36815. addMultisampleRenderPass(width: number, height: number, count: number, quality: number, passName: string): MultisampleRenderPassBuilder;
  36816. /**
  36817. * @en Add compute pass
  36818. * @zh 添加计算通道
  36819. * @param passName @en Pass name declared in the effect. Default value is 'default' @zh effect中的pass name,缺省为'default'
  36820. * @returns Compute pass builder
  36821. */
  36822. addComputePass(passName: string): ComputePassBuilder;
  36823. /**
  36824. * @beta Feature is under development
  36825. * @en Add upload pass.
  36826. * The source and target resources:
  36827. * Must be different resources(have different resource names).
  36828. * Must have compatible formats.
  36829. * Must have identical dimensions(width, height, depth), sample count and sample quality.
  36830. * Can't be currently mapped.
  36831. *
  36832. * @zh 添加上传通道,来源与目标必须满足:
  36833. * 是不同的注册资源。
  36834. * 资源格式兼容。
  36835. * 具有相同的尺寸、采样数、采样质量。
  36836. * 不能被Map。
  36837. *
  36838. * @param uploadPairs @en Array of upload source and target @zh 上传来源与目标的数组
  36839. */
  36840. addUploadPass(uploadPairs: UploadPair[]): void;
  36841. /**
  36842. * @en Add move pass.
  36843. * Move-construct target resource, by moving source resources into subresources of target.
  36844. * After the move, the target resource must be completely initialized.
  36845. * Target write conflicts will result in undefined behaviour.
  36846. * The source and target resources:
  36847. * Must be different resources(have different resource names).
  36848. * Must have compatible formats.
  36849. * Must have identical dimensions(width, height, depth), sample count and sample quality.
  36850. * Can't be currently mapped.
  36851. *
  36852. * @zh 添加移动通道。
  36853. * 移动构造目标资源,将来源移入目标的次级资源。
  36854. * 移动后,目标资源必须完全初始化。
  36855. * 目标写入冲突是未定义行为。
  36856. * 来源与目标必须满足:
  36857. * 是不同的注册资源。
  36858. * 资源格式兼容。
  36859. * 具有相同的尺寸、采样数、采样质量。
  36860. * 不能被Map。
  36861. *
  36862. * @param movePairs @en Array of move source and target @zh 移动来源与目标的数组
  36863. */
  36864. addMovePass(movePairs: MovePair[]): void;
  36865. /**
  36866. * @experimental
  36867. */
  36868. addCustomBuffer(name: string, info: gfx.BufferInfo, type: string): number;
  36869. /**
  36870. * @experimental
  36871. */
  36872. addCustomTexture(name: string, info: gfx.TextureInfo, type: string): number;
  36873. }
  36874. /**
  36875. * @en Pipeline builder.
  36876. * User can implement this interface and setup render graph.
  36877. * Call setCustomPipeline to register the pipeline builder
  36878. * @zh 管线构造器
  36879. * 用户可以实现这个接口,来构建自己想要的render graph。
  36880. * 调用setCustomPipeline注册管线
  36881. */
  36882. export interface PipelineBuilder {
  36883. /**
  36884. * @en Setup render graph
  36885. * @zh 构建渲染管线
  36886. * @param cameras @en Camera list to render @zh 需要渲染的相机列表
  36887. * @param pipeline @en Current render pipeline @zh 当前管线
  36888. */
  36889. setup(cameras: renderer.scene.Camera[], pipeline: BasicPipeline): void;
  36890. /**
  36891. * @en Callback of pipeline state changed
  36892. * @zh 渲染管线状态更新的回调
  36893. */
  36894. onGlobalPipelineStateChanged?(): void;
  36895. }
  36896. }
  36897. export namespace postProcess {
  36898. export class PostProcessSetting extends Component {
  36899. onEnable(): void;
  36900. onDisable(): void;
  36901. }
  36902. export class PostProcess extends Component {
  36903. static all: PostProcess[];
  36904. global: boolean;
  36905. protected _shadingScale: number;
  36906. get shadingScale(): number;
  36907. set shadingScale(v: number);
  36908. enableShadingScaleInEditor: boolean;
  36909. settings: Map<typeof PostProcessSetting, PostProcessSetting>;
  36910. addSetting(setting: PostProcessSetting): void;
  36911. removeSetting(setting: PostProcessSetting): void;
  36912. getSetting(ctor: typeof PostProcessSetting): PostProcessSetting | undefined;
  36913. onEnable(): void;
  36914. onDisable(): void;
  36915. }
  36916. export class FSR extends PostProcessSetting {
  36917. protected _sharpness: number;
  36918. get sharpness(): number;
  36919. set sharpness(v: number);
  36920. }
  36921. export class BlitScreen extends PostProcessSetting {
  36922. protected _activeMaterials: Material[];
  36923. get activeMaterials(): Material[];
  36924. set activeMaterials(v: Material[]);
  36925. protected _materials: __private._cocos_rendering_post_process_components_blit_screen__BlitScreenMaterial[];
  36926. get materials(): __private._cocos_rendering_post_process_components_blit_screen__BlitScreenMaterial[];
  36927. set materials(v: __private._cocos_rendering_post_process_components_blit_screen__BlitScreenMaterial[]);
  36928. updateActiveMaterials(): void;
  36929. onLoad(): void;
  36930. }
  36931. export class TAA extends PostProcessSetting {
  36932. protected _sampleScale: number;
  36933. get sampleScale(): number;
  36934. set sampleScale(v: number);
  36935. protected _feedback: number;
  36936. get feedback(): number;
  36937. set feedback(v: number);
  36938. }
  36939. export class ColorGrading extends PostProcessSetting {
  36940. protected _contribute: number;
  36941. protected _colorGradingMap: Texture2D | null;
  36942. set contribute(value: number);
  36943. get contribute(): number;
  36944. set colorGradingMap(val: Texture2D);
  36945. get colorGradingMap(): Texture2D;
  36946. }
  36947. export class Bloom extends PostProcessSetting {
  36948. protected _enableAlphaMask: boolean;
  36949. protected _useHdrIlluminance: boolean;
  36950. protected _threshold: number;
  36951. protected _iterations: number;
  36952. protected _intensity: number;
  36953. set enableAlphaMask(value: boolean);
  36954. get enableAlphaMask(): boolean;
  36955. set useHdrIlluminance(value: boolean);
  36956. get useHdrIlluminance(): boolean;
  36957. set threshold(value: number);
  36958. get threshold(): number;
  36959. set iterations(value: number);
  36960. get iterations(): number;
  36961. set intensity(value: number);
  36962. get intensity(): number;
  36963. }
  36964. export class HBAO extends PostProcessSetting {
  36965. protected _radiusScale: number;
  36966. protected _angleBiasDegree: number;
  36967. protected _blurSharpness: number;
  36968. protected _aoSaturation: number;
  36969. protected _needBlur: boolean;
  36970. set radiusScale(value: number);
  36971. get radiusScale(): number;
  36972. set angleBiasDegree(value: number);
  36973. get angleBiasDegree(): number;
  36974. set blurSharpness(value: number);
  36975. get blurSharpness(): number;
  36976. set aoSaturation(value: number);
  36977. get aoSaturation(): number;
  36978. set needBlur(value: boolean);
  36979. get needBlur(): boolean;
  36980. }
  36981. export class DOF extends PostProcessSetting {
  36982. protected _focusDistance: number;
  36983. protected _focusRange: number;
  36984. protected _bokehRadius: number;
  36985. set focusDistance(value: number);
  36986. get focusDistance(): number;
  36987. set focusRange(value: number);
  36988. get focusRange(): number;
  36989. set bokehRadius(value: number);
  36990. get bokehRadius(): number;
  36991. }
  36992. export abstract class SettingPass extends BasePass {
  36993. getSetting: typeof __private._cocos_rendering_post_process_passes_setting_pass__getSetting;
  36994. get setting(): PostProcessSetting;
  36995. checkEnable(camera: renderer.scene.Camera): boolean;
  36996. }
  36997. export function getRTFormatBeforeToneMapping(ppl: rendering.BasicPipeline): gfx.Format;
  36998. export function forceEnableFloatOutput(ppl: __private._cocos_rendering_custom_pipeline__PipelineRuntime): boolean;
  36999. export function disablePostProcessForDebugView(): boolean;
  37000. export function getShadowMapSampler(): gfx.Sampler | undefined;
  37001. export abstract class BasePass {
  37002. abstract name: string;
  37003. effectName: string;
  37004. _id: number;
  37005. constructor();
  37006. context: __private._cocos_rendering_post_process_utils_pass_context__PassContext;
  37007. getCameraUniqueID: typeof __private._cocos_rendering_custom_define__getCameraUniqueID;
  37008. _material: Material | undefined;
  37009. get material(): Material;
  37010. enable: boolean;
  37011. outputNames: string[];
  37012. lastPass: BasePass | undefined;
  37013. slotName(camera: renderer.scene.Camera, index?: number): string;
  37014. enableInAllEditorCamera: boolean;
  37015. checkEnable(camera: renderer.scene.Camera): boolean;
  37016. onGlobalPipelineStateChanged?(): void;
  37017. renderProfiler(camera: any): void;
  37018. abstract render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): any;
  37019. }
  37020. export class ForwardPass extends BasePass {
  37021. name: string;
  37022. outputNames: string[];
  37023. enableInAllEditorCamera: boolean;
  37024. depthBufferShadingScale: number;
  37025. calcDepthSlot(camera: renderer.scene.Camera): void;
  37026. slotName(camera: renderer.scene.Camera, index?: number): string;
  37027. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37028. }
  37029. export class TAAPass extends SettingPass {
  37030. get setting(): TAA;
  37031. name: string;
  37032. effectName: string;
  37033. outputNames: string[];
  37034. prevMatViewProj: math.Mat4;
  37035. taaTextureIndex: number;
  37036. samples: math.Vec2[];
  37037. sampleIndex: number;
  37038. sampleOffset: math.Vec2;
  37039. forceRender: boolean;
  37040. dirty: boolean;
  37041. taaMaskMaterial: Material | undefined;
  37042. checkEnable(camera: renderer.scene.Camera): boolean;
  37043. slotName(camera: renderer.scene.Camera, index?: number): string;
  37044. applyCameraJitter(camera: renderer.scene.Camera): void;
  37045. updateSample(): void;
  37046. firstRender: boolean;
  37047. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37048. }
  37049. export class FSRPass extends SettingPass {
  37050. get setting(): FSR;
  37051. name: string;
  37052. effectName: string;
  37053. outputNames: string[];
  37054. checkEnable(camera: renderer.scene.Camera): boolean;
  37055. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37056. }
  37057. export class BlitScreenPass extends SettingPass {
  37058. get setting(): BlitScreen;
  37059. name: string;
  37060. effectName: string;
  37061. outputName: string;
  37062. slotName(camera: renderer.scene.Camera, index?: number): string;
  37063. checkEnable(camera: renderer.scene.Camera): boolean;
  37064. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37065. }
  37066. export class ColorGradingPass extends SettingPass {
  37067. get setting(): ColorGrading;
  37068. checkEnable(camera: renderer.scene.Camera): boolean;
  37069. name: string;
  37070. effectName: string;
  37071. outputNames: string[];
  37072. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37073. }
  37074. export class BloomPass extends SettingPass {
  37075. get setting(): Bloom;
  37076. checkEnable(camera: renderer.scene.Camera): boolean;
  37077. name: string;
  37078. effectName: string;
  37079. outputNames: string[];
  37080. set hdrInputName(name: string);
  37081. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37082. }
  37083. export class FxaaPass extends SettingPass {
  37084. get setting(): __private._cocos_rendering_post_process_components_fxaa__FXAA;
  37085. name: string;
  37086. effectName: string;
  37087. outputNames: string[];
  37088. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37089. }
  37090. export class ForwardFinalPass extends BasePass {
  37091. name: string;
  37092. outputNames: string[];
  37093. enableInAllEditorCamera: boolean;
  37094. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37095. }
  37096. export class ShadowPass extends BasePass {
  37097. name: string;
  37098. mainLightShadows: string[];
  37099. spotLightShadows: string[];
  37100. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37101. }
  37102. export class FloatOutputProcessPass extends SettingPass {
  37103. name: string;
  37104. effectName: string;
  37105. outputNames: string[];
  37106. hdrInputName: string;
  37107. enableInAllEditorCamera: boolean;
  37108. enable: boolean;
  37109. checkEnable(camera: renderer.scene.Camera): boolean;
  37110. getHDRInputName(): string;
  37111. onGlobalPipelineStateChanged(): void;
  37112. needDepthInput(ppl: rendering.Pipeline): boolean;
  37113. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37114. }
  37115. export class ForwardTransparencyPass extends BasePass {
  37116. name: string;
  37117. enableInAllEditorCamera: boolean;
  37118. depthBufferShadingScale: number;
  37119. slotName(camera: renderer.scene.Camera, index?: number): string;
  37120. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37121. }
  37122. export class ForwardTransparencySimplePass extends BasePass {
  37123. name: string;
  37124. slotName(camera: renderer.scene.Camera, index?: number): string;
  37125. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37126. }
  37127. export const COPY_INPUT_DS_PASS_INDEX = 0;
  37128. export const SSSS_BLUR_X_PASS_INDEX = 1;
  37129. export const SSSS_BLUR_Y_PASS_INDEX = 2;
  37130. export const EXPONENT = 2;
  37131. export const I_SAMPLES_COUNT = 25;
  37132. export class SSSSBlurData {
  37133. get ssssStrength(): math.Vec3;
  37134. set ssssStrength(val: math.Vec3);
  37135. get ssssFallOff(): math.Vec3;
  37136. set ssssFallOff(val: math.Vec3);
  37137. get kernel(): math.Vec4[];
  37138. constructor();
  37139. }
  37140. export class SkinPass extends SettingPass {
  37141. name: string;
  37142. effectName: string;
  37143. outputNames: string[];
  37144. ssssBlurData: SSSSBlurData;
  37145. enableInAllEditorCamera: boolean;
  37146. checkEnable(camera: renderer.scene.Camera): boolean;
  37147. render(camera: renderer.scene.Camera, ppl: rendering.BasicPipeline): void;
  37148. slotName(camera: renderer.scene.Camera, index?: number): string;
  37149. }
  37150. export class PostFinalPass extends BasePass {
  37151. name: string;
  37152. outputNames: string[];
  37153. effectName: string;
  37154. enableInAllEditorCamera: boolean;
  37155. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37156. }
  37157. export class DofPass extends SettingPass {
  37158. get setting(): DOF;
  37159. checkEnable(camera: renderer.scene.Camera): boolean;
  37160. name: string;
  37161. effectName: string;
  37162. outputNames: string[];
  37163. render(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37164. }
  37165. export class PostProcessBuilder implements rendering.PipelineBuilder {
  37166. pipelines: Map<string, BasePass[]>;
  37167. constructor();
  37168. onGlobalPipelineStateChanged(): void;
  37169. init(): void;
  37170. getPass(passClass: typeof BasePass, pipelineName?: string): BasePass | undefined;
  37171. addPass(pass: BasePass, pipelineName?: string): void;
  37172. insertPass(pass: BasePass, passClass: typeof BasePass, pipelineName?: string): void;
  37173. setup(cameras: renderer.scene.Camera[], ppl: rendering.Pipeline): void;
  37174. getCameraPipelineName(camera: renderer.scene.Camera): string;
  37175. getCameraPasses(camera: renderer.scene.Camera): BasePass[];
  37176. renderCamera(camera: renderer.scene.Camera, ppl: rendering.Pipeline): void;
  37177. }
  37178. }
  37179. export namespace dragonBones {
  37180. /**
  37181. * @en Event type in dragonbones animation.
  37182. * @zh 龙骨动画中的事件类型。
  37183. */
  37184. export enum EventType {
  37185. /**
  37186. * @en Event about animation frame.
  37187. * @zh 动画帧相关的事件。
  37188. */
  37189. Frame = 0,
  37190. /**
  37191. * @en Event about sound.
  37192. * @zh 声音相关的事件。
  37193. */
  37194. Sound = 1
  37195. }
  37196. /**
  37197. * @en Animation fade out mode.
  37198. * @zh 动画淡出模式。
  37199. */
  37200. export enum AnimationFadeOutMode {
  37201. None = 0,
  37202. /**
  37203. * @en Fade out the animation states of the same layer.
  37204. * @zh 淡出同层的动画状态。
  37205. */
  37206. SameLayer = 1,
  37207. /**
  37208. * @en Fade out the animation states of the same group.
  37209. * @zh 淡出同组的动画状态。
  37210. */
  37211. SameGroup = 2,
  37212. /**
  37213. * @en Fade out the animation states of the same layer and group.
  37214. * @zh 淡出同层并且同组的动画状态。
  37215. */
  37216. SameLayerAndGroup = 3,
  37217. /**
  37218. * @en Fade out of all animation states.
  37219. * @zh 淡出所有的动画状态。
  37220. */
  37221. All = 4
  37222. }
  37223. /**
  37224. * DragonBones factory
  37225. * @class CCFactory
  37226. * @extends BaseFactory
  37227. * @en Usually only one global factory instance is needed. The factory creates
  37228. * Armature object by parsing DragonBonesData and TextureAtlasData instances,
  37229. * and is responsible for global updating the Dragonbones component animation
  37230. * and rendering data.
  37231. * @zh 通常只需要一个全局工厂实例,工厂通过解析 DragonBonesData 和 TextureAtlasData
  37232. * 实例来创建骨架,并负责全局的龙骨组件动画和渲染数据的更新。
  37233. */
  37234. export class CCFactory extends BaseFactory implements ISchedulable {
  37235. static _factory: CCFactory | null;
  37236. /**
  37237. * @en
  37238. * Get an CCFactory instance.
  37239. * @zh
  37240. * 获取一个 CCFactory 实例。
  37241. * @method getInstance
  37242. * @returns @en The global CCFactory instance object.
  37243. * @zh 返回全局的 CCFactory 实例对象。
  37244. * @static
  37245. * @example
  37246. * let factory = CCFactory.getInstance();
  37247. */
  37248. static getInstance(): CCFactory;
  37249. /**
  37250. * @en The id value always 'CCFactory'.
  37251. * @zh 拥有固定值 'CCFactory'。
  37252. */
  37253. id?: string;
  37254. /**
  37255. * @en The uuid value always 'CCFactory'.
  37256. * @zh 拥有固定值 'CCFactory'。
  37257. */
  37258. uuid?: string;
  37259. /**
  37260. * @en Restores the sorted CCSlot objects.
  37261. * @zh 存储已排序好的插槽。
  37262. */
  37263. protected _slots?: CCSlot[];
  37264. constructor();
  37265. /**
  37266. * @en Sets CCFactory object null when Restart game.
  37267. * @zh 重启时需将工厂实例置空。
  37268. */
  37269. onRestart(): void;
  37270. /**
  37271. * @en Initialize update schedule.
  37272. * @zh 初始化更新计划。
  37273. */
  37274. initUpdate(dt?: number): void;
  37275. /**
  37276. * @en Trigger ArmatureDisplay components to update animation and render data.
  37277. * @zh 触发 ArmatureDisplay 组件更新动画和渲染数据。
  37278. */
  37279. update(dt: number): void;
  37280. /**
  37281. * @en Parser raw data to DragonBonesData.
  37282. * @zh 从 raw data 解析出 DragonBonesData 数据。
  37283. */
  37284. getDragonBonesDataByRawData(rawData: any): DragonBonesData | null;
  37285. /**
  37286. * @en Build new armature with a new display.
  37287. * @zh 创建骨架的显示数据。
  37288. */
  37289. buildArmatureDisplay(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): DisplayData | null;
  37290. /**
  37291. * @en Create a new node with Dragonbones component.
  37292. * @zh 创建一个附带龙骨组件的 node 节点。
  37293. */
  37294. createArmatureNode(comp: ArmatureDisplay, armatureName: string, node?: Node): ArmatureDisplay;
  37295. _buildTextureAtlasData(textureAtlasData: null | CCTextureAtlasData, textureAtlas?: __private._cocos_asset_assets_texture_base__TextureBase): CCTextureAtlasData;
  37296. _sortSlots(): void;
  37297. _buildArmature(dataPackage: any): Armature;
  37298. _buildSlot(dataPackage: any, slotData: any, displays: any): CCSlot;
  37299. /**
  37300. * @en Gets DragonBonesData object by UUID.
  37301. * @zh 通过 UUID 获取 DragonBonesData object。
  37302. */
  37303. getDragonBonesDataByUUID(uuid: any): DragonBonesData | null;
  37304. /**
  37305. * @en Remove DragonBonesData object from cache by UUID.
  37306. * @zh 通过 UUID 从缓存移除 DragonBonesData object。
  37307. */
  37308. removeDragonBonesDataByUUID(uuid: string, disposeData?: boolean): void;
  37309. }
  37310. /**
  37311. * @en Slots attach on bones,to control the display status and attributes of the display object.
  37312. * @zh 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  37313. */
  37314. export class CCSlot extends Slot {
  37315. static toString(): string;
  37316. /**
  37317. * @en Vertices in local coordinate system.
  37318. * @zh 局部坐标顶点数据。
  37319. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  37320. */
  37321. _localVertices: number[];
  37322. /**
  37323. * @en Indices array of vertex data.
  37324. * @zh 顶点数组索引。
  37325. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  37326. */
  37327. _indices: number[];
  37328. /**
  37329. * @en Local transformation matrix
  37330. * @zh 局部坐标系变换矩阵
  37331. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  37332. */
  37333. _matrix: math.Mat4;
  37334. /**
  37335. * @en World transformation matrix
  37336. * @zh 世界坐标系变换矩阵
  37337. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  37338. */
  37339. _worldMatrix: math.Mat4;
  37340. protected _worldMatrixDirty: boolean;
  37341. /**
  37342. * @en Color setting on a slot
  37343. * @zh 设置在 Slot 上的颜色
  37344. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  37345. */
  37346. _color: math.Color;
  37347. constructor();
  37348. /**
  37349. * @en Get a Texture2D object from _textureData.
  37350. * @zh 获取2D纹理对象。
  37351. * @returns @en A texture instance if _textureData is not null, otherwise returns null.
  37352. * @zh 若 _textureData 为 null,将返回 null。
  37353. */
  37354. getTexture(): Texture2D | null;
  37355. /**
  37356. * @en Calculates world matrix of slot.
  37357. * @zh 计算插槽世界矩阵。
  37358. */
  37359. calculWorldMatrix(): void;
  37360. /**
  37361. * @en Resets slot data and state.
  37362. * @zh 重置插槽数据和状态。
  37363. */
  37364. _onClear(): void;
  37365. /**
  37366. * just for adapt to dragonbones api,no need to do any thing
  37367. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37368. */
  37369. _onUpdateDisplay(): void;
  37370. /**
  37371. * just for adapt to dragonbones api,no need to do any thing
  37372. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37373. */
  37374. _initDisplay(value: any): void;
  37375. /**
  37376. * just for adapt to dragonbones api,no need to do any thing
  37377. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37378. */
  37379. _addDisplay(): void;
  37380. /**
  37381. * just for adapt to dragonbones api,no need to do any thing
  37382. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37383. */
  37384. _replaceDisplay(value: any): void;
  37385. /**
  37386. * just for adapt to dragonbones api,no need to do any thing
  37387. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37388. */
  37389. _removeDisplay(): void;
  37390. /**
  37391. * just for adapt to dragonbones api,no need to do any thing
  37392. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37393. */
  37394. _disposeDisplay(object: any): void;
  37395. /**
  37396. * just for adapt to dragonbones api,no need to do any thing
  37397. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37398. */
  37399. _updateVisible(): void;
  37400. /**
  37401. * just for adapt to dragonbones api,no need to do any thing
  37402. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37403. */
  37404. _updateGlueMesh(): void;
  37405. /**
  37406. * just for adapt to dragonbones api,no need to do any thing
  37407. * @deprecated Since v3.7.2, this interface that will be removed in the future.
  37408. */
  37409. _updateZOrder(): void;
  37410. /**
  37411. * @en Update the color blending mode of the slot.
  37412. * @zh 更新插槽的颜色混合模式。
  37413. */
  37414. _updateBlendMode(): void;
  37415. /**
  37416. * @en Update the color of the slot.
  37417. * @zh 更新插槽的颜色。
  37418. */
  37419. _updateColor(): void;
  37420. /**
  37421. * @en Update one frame of slot vertex data.
  37422. * @zh 更新一帧插槽顶点数据。
  37423. */
  37424. _updateFrame(): void;
  37425. /**
  37426. * @en Update mesh data of slot.
  37427. * @zh 更新槽点的网格数据。
  37428. */
  37429. _updateMesh(): void;
  37430. /**
  37431. * @en Reset current matrix to identity matrix.
  37432. * @zh 重置当前矩阵为单位矩阵。
  37433. */
  37434. _identityTransform(): void;
  37435. /**
  37436. * @en Update transform of slot.
  37437. * @zh 更新插槽的变换。
  37438. */
  37439. _updateTransform(): void;
  37440. /**
  37441. * @en Update world matrix of slot.
  37442. * @zh 更新插槽的世界矩阵。
  37443. */
  37444. updateWorldMatrix(): void;
  37445. }
  37446. /**
  37447. * @en The texture atlas of dragonbones.
  37448. * @zh 龙骨组件中的纹理图集资源。
  37449. */
  37450. export class CCTextureAtlasData extends TextureAtlasData {
  37451. /**
  37452. * @en The texture used for rendering.
  37453. * @zh 实际用于渲染显示的纹理对象。
  37454. */
  37455. get renderTexture(): __private._cocos_asset_assets_texture_base__TextureBase | null;
  37456. set renderTexture(value: __private._cocos_asset_assets_texture_base__TextureBase | null);
  37457. protected _renderTexture: __private._cocos_asset_assets_texture_base__TextureBase | null;
  37458. /**
  37459. * @en Create texture data, get data from the object pool.
  37460. * @zh 创建纹理数据,从对象池获取。
  37461. */
  37462. createTexture(): CCTextureData;
  37463. /**
  37464. * @en Clear associated texture resources.
  37465. * @zh 清除关联的纹理。
  37466. */
  37467. _onClear(): void;
  37468. }
  37469. /**
  37470. * @en Texture data used in dragonbones.
  37471. * @zh 龙骨资源中的纹理数据。
  37472. */
  37473. export class CCTextureData extends TextureData {
  37474. /**
  37475. * @en SpriteFrame assets.
  37476. * @zh SpriteFrame 资源。
  37477. */
  37478. spriteFrame: SpriteFrame | null;
  37479. /**
  37480. * @en Clear SpriteFrame assets.
  37481. * @zh 清除关联的SpriteFrame 资源。
  37482. */
  37483. _onClear(): void;
  37484. }
  37485. /**
  37486. * @en CCArmatureDisplay contains function about data showing and sending events.
  37487. * @zh CCArmatureDisplay 封装了数据显示和事件派发的功能。
  37488. */
  37489. export class CCArmatureDisplay extends DisplayData implements IEventDispatcher {
  37490. /**
  37491. * @en Return this.
  37492. * @zh 返回自身。
  37493. */
  37494. get node(): CCArmatureDisplay;
  37495. /**
  37496. * @deprecated This variable will be removed in the future.
  37497. */
  37498. shouldAdvanced: boolean;
  37499. /**
  37500. * @en The node contains ArmatureDisplay component.
  37501. * @zh ArmatureDisplay 组件所在的 node。
  37502. */
  37503. _ccNode: Node | null;
  37504. /**
  37505. * @en ArmatureDisplay component.
  37506. * @zh ArmatureDisplay 组件。
  37507. */
  37508. _ccComponent: ArmatureDisplay | null;
  37509. /**
  37510. * @en EventTarget is an object to which an event is dispatched when something has occurred.
  37511. * @zh 事件目标是具有注册监听器、派发事件能力的对象。
  37512. */
  37513. _eventTarget: EventTarget;
  37514. /**
  37515. * @en The core Armature object.
  37516. * @zh 核心骨架对象。
  37517. */
  37518. _armature: Armature | null;
  37519. constructor();
  37520. /**
  37521. * @en The funciton is empty and always return false.
  37522. * @zh 方法未实现总返回 false。
  37523. */
  37524. hasEvent(type: string): boolean;
  37525. /**
  37526. * @en The funciton has no realization.
  37527. * @zh 方法未实现。
  37528. */
  37529. addEvent(type: string, listener: any, thisObject: any): void;
  37530. /**
  37531. * @en The funciton has no realization.
  37532. * @zh 方法未实现。
  37533. */
  37534. removeEvent(type: string, listener: any, thisObject: any): void;
  37535. /**
  37536. * @en Sets EventTarget object.
  37537. * @zh 设置事件目标。
  37538. */
  37539. setEventTarget(eventTarget: EventTarget): void;
  37540. /**
  37541. * @en Gets the root display object.
  37542. * @zh 获取顶层的显示容器实例。
  37543. */
  37544. getRootDisplay(): CCArmatureDisplay;
  37545. /**
  37546. * @en Convert pos to parent slot coordination.
  37547. * @zh 将坐标转换到父插槽的坐标系下。
  37548. */
  37549. convertToRootSpace(pos: math.Vec3): math.Vec3;
  37550. /**
  37551. * @en Convert pos to world coordination.
  37552. * @zh 将坐标转换到世界坐标系下。
  37553. */
  37554. convertToWorldSpace(point: math.Vec3): math.Vec3 | undefined;
  37555. /**
  37556. * @en Get the node of root ArmatureDisplay component in.
  37557. * @zh 获取顶层 ArmatureDisplay 组件所在的 node。
  37558. */
  37559. getRootNode(): Node | null;
  37560. /**
  37561. * @en Initialize _armature at start.
  37562. * @zh 初始时设置骨架。
  37563. */
  37564. dbInit(armature: Armature | null): void;
  37565. /**
  37566. * @en Clears Armature object.
  37567. * @zh 清除骨架对象。
  37568. */
  37569. dbClear(): void;
  37570. /**
  37571. * @en Trigger ArmatureDisplay component to update render data.
  37572. * @zh 触发 ArmatureDisplay 组件更新渲染数据。
  37573. */
  37574. dbUpdate(): void;
  37575. hasDBEventListener(type: any): boolean;
  37576. addDBEventListener(type: string, listener: any, target: any): void;
  37577. removeDBEventListener(type: string, listener: any, target: any): void;
  37578. dispatchDBEvent(type: string, eventObject: any): void;
  37579. }
  37580. /**
  37581. * @en Cached data of armature.
  37582. * @zh 骨架缓存。
  37583. */
  37584. export class ArmatureCache {
  37585. protected _privateMode: boolean;
  37586. protected _animationPool: Record<string, __private._cocos_dragon_bones_ArmatureCache__AnimationCache>;
  37587. protected _armatureCache: Record<string, __private._cocos_dragon_bones_ArmatureCache__ArmatureInfo>;
  37588. constructor();
  37589. /**
  37590. * @en Enable private cache mode.
  37591. * @zh 启用私有缓存模式。
  37592. */
  37593. enablePrivateMode(): void;
  37594. /**
  37595. * @en If using private cache mode, all cached data will be destroyed when corresponding dragonbone nodes are destroyed.
  37596. * @zh 如果为私有缓存模式,cache 数据将随组件一起销毁。
  37597. */
  37598. dispose(): void;
  37599. /**
  37600. * @en When dragonbones assets be destroy, remove armature from dragonbones cache.
  37601. * @zh 当 dragonbones assets 销毁时,从 cache 中移除骨架。
  37602. */
  37603. resetArmature(uuid: string): void;
  37604. static FrameTime: number;
  37605. static sharedCache: ArmatureCache;
  37606. }
  37607. /**
  37608. * @en The skeleton data of dragonBones.
  37609. * @zh dragonBones 的骨骼数据。
  37610. * @class DragonBonesAsset
  37611. * @extends Asset
  37612. */
  37613. export class DragonBonesAsset extends Asset {
  37614. /**
  37615. * @en The string parsed from the DragonBonesAsset data in json format.
  37616. * See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  37617. * @zh Json 格式的 DragonBones 骨骼数据被解析后的字符串。
  37618. * 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  37619. * @property {string} dragonBonesJson
  37620. */
  37621. protected _dragonBonesJson: string;
  37622. get dragonBonesJson(): string;
  37623. set dragonBonesJson(value: string);
  37624. protected _dragonBonesJsonData?: ArrayBuffer;
  37625. constructctor(): void;
  37626. /**
  37627. * @en Create a new node with Dragonbones component.
  37628. * @zh 创建一个附带龙骨组件的 node 节点。
  37629. */
  37630. createNode(callback: (err: Error | null, node: Node) => void): void;
  37631. /**
  37632. * @en Reset DragonBonesAsset data and state.
  37633. * @zh 重置 DragonBonesAsset 数据和状态。
  37634. */
  37635. reset(): void;
  37636. /**
  37637. * @en Initialize with altas uuid.
  37638. * @zh 使用 uuid 初始化 DragonBonesAsset 资产数据。
  37639. * @param factory @en The global CCFactory instance object.
  37640. * @zh 全局的 CCFactory 对象。
  37641. * @param atlasUUID @en Atlas uuid. @zh Atlas uuid。
  37642. */
  37643. init(factory?: CCFactory, atlasUUID?: string): string;
  37644. /**
  37645. * @en Destroy DragonBonesAsset data.
  37646. * @zh 销毁 DragonBonesAsset 资产数据。
  37647. */
  37648. destroy(): boolean;
  37649. protected _clear(): void;
  37650. }
  37651. /**
  37652. * @en The skeleton atlas data of dragonBones.
  37653. * @zh DragonBones 的骨骼纹理数据。
  37654. * @class DragonBonesAtlasAsset
  37655. * @extends Asset
  37656. */
  37657. export class DragonBonesAtlasAsset extends Asset {
  37658. constructor();
  37659. /**
  37660. * @en atlas of json file.
  37661. * @zh 纹理图集的 json 文件。
  37662. */
  37663. _atlasJson: string;
  37664. get atlasJson(): string;
  37665. set atlasJson(value: string);
  37666. /**
  37667. * @en 2D Texture.
  37668. * @zh 2D 纹理。
  37669. */
  37670. _texture: Texture2D | null;
  37671. /**
  37672. * @en Data with json format for Describing the atlas information.
  37673. * @zh 描述图集信息的 json 数据。
  37674. */
  37675. _atlasJsonData: any;
  37676. /**
  37677. * @en Dragonbones instance of CCFactory.
  37678. * @zh Dragonbones 工厂实例。
  37679. */
  37680. _factory: CCFactory | null;
  37681. /**
  37682. * @en 2D texture.
  37683. * @zh 2D 纹理。
  37684. * @property {Texture2D} texture
  37685. */
  37686. get texture(): Texture2D | null;
  37687. set texture(value: Texture2D | null);
  37688. /**
  37689. * @en The texture atlas data.
  37690. * @zh 贴图集数据。
  37691. */
  37692. _textureAtlasData: TextureAtlasData | null;
  37693. /**
  37694. * @en Create a new node with Dragonbones component.
  37695. * @zh 创建一个附带龙骨组件的 node 节点。
  37696. */
  37697. createNode(callback: (error: Error | null, node: Node) => void): void;
  37698. /**
  37699. * @en Atlas resource initialization. Parse the original atlas data and atlas object into a
  37700. * TextureAtlasData instance, and cache it to the factory.
  37701. * @zh 图集资源初始化。将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  37702. */
  37703. init(factory: CCFactory): void;
  37704. /**
  37705. * @en Destroy altas assets.
  37706. * @zh 销毁图集资源。
  37707. */
  37708. destroy(): boolean;
  37709. protected _clear(): void;
  37710. }
  37711. /**
  37712. * @en Control animation speed, should be larger than 0.
  37713. * @zh 控制龙骨动画播放速度,数值应大于 0。
  37714. */
  37715. export let timeScale: number;
  37716. /**
  37717. * @en Enum for cache mode type.
  37718. * @zh Dragonbones 渲染类型。
  37719. * @enum ArmatureDisplay.AnimationCacheMode
  37720. */
  37721. export enum AnimationCacheMode {
  37722. /**
  37723. * @en The realtime mode.
  37724. * @zh 实时计算模式。
  37725. * @property {Number} REALTIME
  37726. */
  37727. REALTIME = 0,
  37728. /**
  37729. * @en The shared cache mode.
  37730. * @zh 共享缓存模式。
  37731. * @property {Number} SHARED_CACHE
  37732. */
  37733. SHARED_CACHE = 1,
  37734. /**
  37735. * @en The private cache mode.
  37736. * @zh 私有缓存模式。
  37737. * @property {Number} PRIVATE_CACHE
  37738. */
  37739. PRIVATE_CACHE = 2
  37740. }
  37741. /**
  37742. * @en Struct that can store rendering data-related information.
  37743. * @zh 用于存储渲染数据相关信息的结构体。
  37744. */
  37745. export interface ArmatureDisplayDrawData {
  37746. /**
  37747. * @en A Material instance. @zh 材质实例。
  37748. */
  37749. material: Material | null;
  37750. /**
  37751. * @en 2D Texture. @zh 2D 纹理。
  37752. */
  37753. texture: Texture2D | null;
  37754. /**
  37755. * @en Vertex index offset. @zh 顶点索引偏移。
  37756. */
  37757. indexOffset: number;
  37758. /**
  37759. * @en Vertex index count. @zh 顶点索引数量。
  37760. */
  37761. indexCount: number;
  37762. }
  37763. /**
  37764. * @en DragonBones Socket. Used to attach components to bone nodes and move them together
  37765. * with bone animations. Developers need to specify the bone path that needs to follow the
  37766. * movement and which node the motion transformation will be applied to.
  37767. * @zh 骨骼挂点。用于将组件挂载在骨骼节点上,随骨骼动画一起运动。
  37768. * 用户需指定需要跟随运动的骨骼路径以及运动变换将作用于哪个节点上。
  37769. */
  37770. export class DragonBoneSocket {
  37771. /**
  37772. * @en Path of the target joint.
  37773. * @zh 此挂点的目标骨骼路径。
  37774. */
  37775. path: string;
  37776. /**
  37777. * @en Transform output node.
  37778. * @zh 此挂点的变换信息输出节点。
  37779. */
  37780. target: Node | null;
  37781. boneIndex: number | null;
  37782. constructor(path?: string, target?: Node | null);
  37783. }
  37784. /**
  37785. * @en
  37786. * The Armature Display of DragonBones <br/>
  37787. * <br/>
  37788. * Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  37789. * which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  37790. * Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments. <br/>
  37791. * Cocos Creator supports DragonBones version to 5.6.300.
  37792. * @zh
  37793. * DragonBones 骨骼动画 <br/>
  37794. * <br/>
  37795. * Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  37796. * 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  37797. * 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。<br/>
  37798. * Cocos Creator 支持 DragonBones 版本最高到 v5.6.300.
  37799. *
  37800. * @class ArmatureDisplay
  37801. * @extends RenderComponent
  37802. */
  37803. export class ArmatureDisplay extends UIRenderer {
  37804. static AnimationCacheMode: typeof AnimationCacheMode;
  37805. /**
  37806. * @en
  37807. * The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  37808. * attachments, skins, etc) and animations but does not hold any state.<br/>
  37809. * Multiple ArmatureDisplay can share the same DragonBones data.
  37810. * @zh
  37811. * 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  37812. * attachments,皮肤等等)和动画但不持有任何状态。<br/>
  37813. * 多个 ArmatureDisplay 可以共用相同的骨骼数据。
  37814. * @property {DragonBonesAsset} dragonAsset
  37815. */
  37816. get dragonAsset(): DragonBonesAsset | null;
  37817. set dragonAsset(value: DragonBonesAsset | null);
  37818. /**
  37819. * @en
  37820. * The atlas asset for the DragonBones.
  37821. * @zh
  37822. * 骨骼数据所需的 Atlas Texture 数据。
  37823. * @property {DragonBonesAtlasAsset} dragonAtlasAsset
  37824. */
  37825. get dragonAtlasAsset(): DragonBonesAtlasAsset | null;
  37826. set dragonAtlasAsset(value: DragonBonesAtlasAsset | null);
  37827. /**
  37828. * @en The name of current armature.
  37829. * @zh 当前的 Armature 名称。
  37830. * @property {String} armatureName
  37831. */
  37832. get armatureName(): string;
  37833. set armatureName(name: string);
  37834. /**
  37835. * @en The name of current playing animation.
  37836. * @zh 当前播放的动画名称。
  37837. * @property {String} animationName
  37838. */
  37839. get animationName(): string;
  37840. set animationName(value: string);
  37841. /**
  37842. * @en The time scale of this armature.
  37843. * @zh 当前骨骼中所有动画的时间缩放率。
  37844. * @property {Number} timeScale
  37845. * @default 1
  37846. */
  37847. get timeScale(): number;
  37848. set timeScale(value: number);
  37849. /**
  37850. * @en The play times of the default animation.
  37851. * -1 means using the value of config file;
  37852. * 0 means repeat for ever
  37853. * >0 means repeat times
  37854. * @zh 播放默认动画的循环次数
  37855. * -1 表示使用配置文件中的默认值;
  37856. * 0 表示无限循环
  37857. * >0 表示循环次数
  37858. * @property {Number} playTimes
  37859. * @default -1
  37860. */
  37861. playTimes: number;
  37862. /**
  37863. * @en Indicates whether to enable premultiplied alpha.
  37864. * You should disable this option when image's transparent area appears to have opaque pixels,
  37865. * or enable this option when image's half transparent area appears to be darken.
  37866. * @zh 是否启用贴图预乘。
  37867. * 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。
  37868. * @property {Boolean} premultipliedAlpha
  37869. * @default false
  37870. */
  37871. premultipliedAlpha: boolean;
  37872. /**
  37873. * @en Indicates whether open debug bones.
  37874. * @zh 是否显示 bone 的 debug 信息。
  37875. * @property {Boolean} debugBones
  37876. * @default false
  37877. */
  37878. get debugBones(): boolean;
  37879. set debugBones(value: boolean);
  37880. /**
  37881. * @en Enabled batch model. If rendering a large number of identical textures and simple
  37882. * skeleton animations, enabling batching can reduce the number of drawcalls and improve
  37883. * rendering efficiency, otherwise it is not necessary to enable it.
  37884. * @zh 开启合批。如果渲染大量相同纹理,且结构简单的龙骨动画,开启合批可以降低 drawcall 数量,
  37885. * 提升渲染效率,否则不需要开启。
  37886. */
  37887. get enableBatch(): boolean;
  37888. set enableBatch(value: boolean);
  37889. /**
  37890. * @en
  37891. * The bone sockets this animation component maintains.<br>
  37892. * Sockets have to be registered here before attaching custom nodes to animated bones.
  37893. * @zh
  37894. * 当前动画组件维护的挂点数组。要挂载自定义节点到受动画驱动的骨骼上,必须先在此注册挂点。
  37895. */
  37896. get sockets(): DragonBoneSocket[];
  37897. set sockets(val: DragonBoneSocket[]);
  37898. /**
  37899. * @en Gets the socket nodes. Socket nodes are registered synchronous motion
  37900. * transformation with bones.
  37901. * @zh 获取 socket nodes,socket nodes 被注册到组件上,可以随骨骼做同步运动变换。
  37902. */
  37903. get socketNodes(): Map<string, Node>;
  37904. /**
  37905. * @en The armature is the core of the skeletal animation system.
  37906. * @zh 骨架是骨骼动画系统的核心。
  37907. */
  37908. _armature: Armature | null;
  37909. /**
  37910. * @en The tool for mounting functionality.
  37911. * @zh 挂载工具。
  37912. */
  37913. attachUtil: AttachUtil;
  37914. /**
  37915. * @en Draw call list.
  37916. * @zh Draw call 列表。
  37917. */
  37918. get drawList(): memop.RecyclePool<ArmatureDisplayDrawData>;
  37919. protected _defaultArmatureIndexValue: __private._cocos_dragon_bones_ArmatureDisplay__DefaultArmaturesEnum;
  37920. /**
  37921. * @en The skeleton data of dragonBones.
  37922. * @zh DragonBones 的骨骼数据。
  37923. */
  37924. _dragonAsset: DragonBonesAsset | null;
  37925. /**
  37926. * @en The skeleton atlas data of dragonBones.
  37927. * @zh DragonBones 的骨骼纹理数据。
  37928. */
  37929. _dragonAtlasAsset: DragonBonesAtlasAsset | null;
  37930. /**
  37931. * @en The armature data name.
  37932. * @zh 骨架数据名称。
  37933. */
  37934. _armatureName: string;
  37935. protected _animationName: string;
  37936. protected _animationIndexValue: __private._cocos_dragon_bones_ArmatureDisplay__DefaultAnimsEnum;
  37937. protected _preCacheMode: number;
  37938. protected _cacheMode: AnimationCacheMode;
  37939. protected _defaultCacheModeValue: AnimationCacheMode;
  37940. protected _timeScale: number;
  37941. protected _playTimes: number;
  37942. protected _debugBones: boolean;
  37943. protected _enableBatch: boolean;
  37944. /**
  37945. * @en The graphics component for debugging.
  37946. * @zh 用于调试的 Graphics 组件。
  37947. */
  37948. _debugDraw: Graphics | null;
  37949. protected _playing: boolean;
  37950. protected _armatureCache: ArmatureCache | null;
  37951. protected _eventTarget: EventTarget;
  37952. protected _factory: CCFactory | null;
  37953. protected _displayProxy: CCArmatureDisplay | null;
  37954. protected _drawIdx: number;
  37955. protected _drawList: memop.RecyclePool<ArmatureDisplayDrawData>;
  37956. protected _materialCache: {
  37957. [key: string]: renderer.MaterialInstance;
  37958. };
  37959. protected _enumArmatures: any;
  37960. protected _enumAnimations: any;
  37961. protected _socketNodes: Map<string, Node>;
  37962. protected _cachedSockets: Map<string, __private._cocos_dragon_bones_ArmatureDisplay__BoneIndex>;
  37963. protected _sockets: DragonBoneSocket[];
  37964. constructor();
  37965. /**
  37966. * @en Initializes _factory from CCFactory, if golbal factory not exists, will create a new one.
  37967. * @zh 初始化变量 _factory,如果全局工厂实例不存在将新创建一个工厂实列对象。
  37968. */
  37969. initFactory(): void;
  37970. onLoad(): void;
  37971. /**
  37972. * @en
  37973. * Destroy render data,will be called when need to rebuild render data or component is destroyed.
  37974. * @zh
  37975. * 销毁渲染数据,一般在重新生成渲染数据时或销毁组件时调用。
  37976. */
  37977. destroyRenderData(): void;
  37978. protected _updateBuiltinMaterial(): Material;
  37979. /**
  37980. * @en Custom material.
  37981. * @zh 自定义材质。
  37982. */
  37983. get customMaterial(): Material | null;
  37984. set customMaterial(val: Material | null);
  37985. protected _render(batcher: UI): void;
  37986. __preload(): void;
  37987. /**
  37988. * @en Initialize asset data and internal data within the component.
  37989. * @zh 初始化资产数据以及组件内部数据。
  37990. */
  37991. _init(): void;
  37992. /**
  37993. * @en
  37994. * The key of dragonbones cache data, which is regard as 'dragonbonesName', when you want to change dragonbones cloth.
  37995. * @zh
  37996. * 缓存龙骨数据的 key 值,换装的时会使用到该值,作为 'dragonbonesName' 使用。
  37997. * @method getArmatureKey
  37998. * @returns @en The key of dragonbones cache data. @zh 缓存龙骨数据的 key 值。
  37999. * @example
  38000. * let factory = dragonBones.CCFactory.getInstance();
  38001. * let needChangeSlot = needChangeArmature.armature().getSlot("changeSlotName");
  38002. * factory.replaceSlotDisplay(toChangeArmature.getArmatureKey(), "armatureName", "slotName", "displayName", needChangeSlot);
  38003. */
  38004. getArmatureKey(): string;
  38005. /**
  38006. * @en
  38007. * It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  38008. * If set the mode in editor, then no need to worry about order problem.
  38009. * @zh
  38010. * 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  38011. * 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  38012. *
  38013. * @method setAnimationCacheMode
  38014. * @param cacheMode
  38015. * @en The value can be set to REALTIME, SHARED_CACHE, or PRIVATE_CACHE.
  38016. * @zh 可以在 REALTIME,SHARED_CACHE,PRIVATE_CACHE 中取值。
  38017. * @example
  38018. * armatureDisplay.setAnimationCacheMode(dragonBones.ArmatureDisplay.AnimationCacheMode.SHARED_CACHE);
  38019. */
  38020. setAnimationCacheMode(cacheMode: AnimationCacheMode): void;
  38021. /**
  38022. * @en Whether in cached mode.
  38023. * @zh 当前是否处于缓存模式。
  38024. * @method isAnimationCached
  38025. * @returns @en True means animation mode is SHARED_CACHE or PRIVATE_CACHE.
  38026. * False means animation mode is REALTIME.
  38027. * @zh True 代表动画使用 SHARED_CACHE 或 PRIVATE_CACHE 模式。
  38028. * False 代表动画使用 REALTIME 模式。
  38029. */
  38030. isAnimationCached(): boolean;
  38031. /**
  38032. * @en Be called when the component state becomes available.
  38033. * Instance of ArmatureDisplay will be added into ArmatureSystem.
  38034. * @zh 组件状态变为可用时调用。ArmatureDisplay 实例将被添加到 ArmatureSystem。
  38035. */
  38036. onEnable(): void;
  38037. /**
  38038. * @en Be called when the component state becomes invalid.
  38039. * Instance of ArmatureDisplay will be removed from ArmatureSystem.
  38040. * @zh 组件状态变为不可用时调用。ArmatureDisplay 实例将被从 ArmatureSystem 移除。
  38041. */
  38042. onDisable(): void;
  38043. /**
  38044. * @en Update animation frame.
  38045. * @zh 更新动画序列。
  38046. * @param dt @en Delta time, unit is second. @zh 时间差,单位为秒。
  38047. */
  38048. updateAnimation(dt: any): void;
  38049. /**
  38050. * @en Destroy component, release resource.
  38051. * @zh 销毁组件时调用,释放相关资源。
  38052. */
  38053. onDestroy(): void;
  38054. /**
  38055. * @en Update the debugging component show.
  38056. * @zh 更新调试 Graphic 组件的显示。
  38057. */
  38058. _updateDebugDraw(): void;
  38059. /**
  38060. * @en Update related data due to batching settings.
  38061. * @zh 更新由于合批设置导致的相关数据。
  38062. */
  38063. protected _updateBatch(): void;
  38064. /**
  38065. * @en Building data of armature.
  38066. * @zh 构建骨架数据。
  38067. */
  38068. _buildArmature(): void;
  38069. /**
  38070. * @en Gets sockets binding on this component.
  38071. * @zh 获取绑定在本组件上的socket。
  38072. */
  38073. querySockets(): string[];
  38074. /**
  38075. * @en Query socket path with slot or bone name.
  38076. * @zh 查询 Socket 路径。
  38077. * @param name @en Slot name or Bone name. @zh 插槽或骨骼名称。
  38078. */
  38079. querySocketPathByName(name: string): string[];
  38080. _updateCacheModeEnum(): void;
  38081. /**
  38082. * @en
  38083. * Play the specified animation.
  38084. * Parameter animName specify the animation name.
  38085. * Parameter playTimes specify the repeat times of the animation.
  38086. * -1 means use the value of the config file.
  38087. * 0 means play the animation for ever.
  38088. * >0 means repeat times.
  38089. * @zh
  38090. * 播放指定的动画.
  38091. * animName 指定播放动画的名称。
  38092. * playTimes 指定播放动画的次数。
  38093. * -1 为使用配置文件中的次数。
  38094. * 0 为无限循环播放。
  38095. * >0 为动画的重复次数。
  38096. */
  38097. playAnimation(animName: string, playTimes?: number): AnimationState | null;
  38098. /**
  38099. * @en
  38100. * Updating an animation cache to calculate all frame data in the animation is a cost in
  38101. * performance due to calculating all data in a single frame.
  38102. * To update the cache, use the invalidAnimationCache method with high performance.
  38103. * @zh
  38104. * 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  38105. * 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  38106. * @method updateAnimationCache
  38107. * @param animName @en Animation's name. @zh 动画名称。
  38108. */
  38109. updateAnimationCache(animName: string): void;
  38110. /**
  38111. * @en
  38112. * Invalidates the animation cache, which is then recomputed on each frame.
  38113. * @zh
  38114. * 使动画缓存失效,之后会在每帧重新计算。
  38115. * @method invalidAnimationCache
  38116. */
  38117. invalidAnimationCache(): void;
  38118. /**
  38119. * @en
  38120. * Get the all armature names in the DragonBones Data.
  38121. * @zh
  38122. * 获取 DragonBones 数据中所有的 armature 名称。
  38123. * @method getArmatureNames
  38124. * @returns @en Return an array of armature names. @zh 返回 armature 名称数组。
  38125. */
  38126. getArmatureNames(): string[];
  38127. /**
  38128. * @en
  38129. * Get the all animation names of specified armature.
  38130. * @zh
  38131. * 获取指定的 armature 的所有动画名称。
  38132. * @method getAnimationNames
  38133. * @param armatureName @en The name of armature. @zh Armature 名称。
  38134. * @returns @en Return an array of all animation names.
  38135. * @zh 返回包含所有动画名称的数组。
  38136. */
  38137. getAnimationNames(armatureName: string): string[];
  38138. /**
  38139. * @en
  38140. * Add event listener for the DragonBones Event, the same to addEventListener.
  38141. * @zh
  38142. * 添加 DragonBones 事件监听器,与 addEventListener 作用相同。
  38143. * @method on
  38144. * @param eventType @en A string representing the event type to listen for.
  38145. * @zh 用于表示监听事件类型的字符串。
  38146. * @param listener @en The callback that will be invoked when the event is dispatched.
  38147. * @zh 事件派发时的回调。
  38148. * @param target @en The target (this object) to invoke the callback, can be null.
  38149. * @zh 调用回调函数的对象,可以为 null。
  38150. */
  38151. on(eventType: string, listener: any, target: any): void;
  38152. /**
  38153. * @en
  38154. * Remove the event listener for the DragonBones Event, the same to removeEventListener.
  38155. * @zh
  38156. * 移除 DragonBones 事件监听器,与 removeEventListener 作用相同。
  38157. * @method off
  38158. * @param eventType @en A string representing the event type to listen for.
  38159. * @zh 用于表示监听事件类型的字符串。
  38160. * @param listener @en The callback that will be invoked when the event is dispatched.
  38161. * @zh 事件派发时的回调。
  38162. * @param target @en The target (this object) to invoke the callback, can be null.
  38163. * @zh 调用回调函数的对象,可以为 null。
  38164. */
  38165. off(eventType: string, listener: any, target: any): void;
  38166. /**
  38167. * @en
  38168. * Add DragonBones one-time event listener, the callback will remove itself after the first time it is triggered.
  38169. * @zh
  38170. * 添加 DragonBones 一次性事件监听器,回调会在第一时间被触发后删除自身。
  38171. * @method once
  38172. * @param eventType @en A string representing the event type to listen for.
  38173. * @zh 用于表示监听事件类型的字符串。
  38174. * @param listener @en The callback that will be invoked when the event is dispatched.
  38175. * @zh 事件派发时的回调。
  38176. * @param target @en The target (this object) to invoke the callback, can be null.
  38177. * @zh 调用回调函数的对象,可以为 null。
  38178. */
  38179. once(eventType: string, listener: any, target: any): void;
  38180. /**
  38181. * @en
  38182. * Add event listener for the DragonBones Event.
  38183. * @zh
  38184. * 添加 DragonBones 事件监听器。
  38185. * @method addEventListener
  38186. * @param eventType @en A string representing the event type to listen for.
  38187. * @zh 用于表示监听事件类型的字符串。
  38188. * @param listener @en The callback that will be invoked when the event is dispatched.
  38189. * @zh 事件派发时的回调。
  38190. * @param target @en The target (this object) to invoke the callback, can be null.
  38191. * @zh 调用回调函数的对象,可以为 null。
  38192. */
  38193. addEventListener(eventType: any, listener: any, target: any): void;
  38194. /**
  38195. * @en Remove the event listener for the DragonBones Event.
  38196. * @zh 移除 DragonBones 事件监听器。
  38197. * @method removeEventListener
  38198. * @param eventType @en A string representing the event type to listen for.
  38199. * @zh 用于表示监听事件类型的字符串。
  38200. * @param listener @en The callback that will be invoked when the event is dispatched.
  38201. * @zh 事件派发时的回调。
  38202. * @param target @en The target (this object) to invoke the callback, can be null.
  38203. * @zh 调用回调函数的对象,可以为 null。
  38204. */
  38205. removeEventListener(eventType: any, listener: any, target: any): void;
  38206. /**
  38207. * @en Build the armature for specified name.
  38208. * @zh 构建指定名称的 armature 对象。
  38209. * @method buildArmature
  38210. * @param armatureName @en The name of armature. @zh Armature 名称。
  38211. * @param node @en The node contains ArmatureDisplay component.
  38212. * @zh 承载 ArmatureDisplay 组件的 node。
  38213. * @returns @en Return a new ArmatureDisplay component.
  38214. * @zh 返回一个新创建的 ArmatureDisplay 组件。
  38215. */
  38216. buildArmature(armatureName: string, node?: Node): ArmatureDisplay;
  38217. /**
  38218. * @en
  38219. * Get the current armature object of the ArmatureDisplay.
  38220. * @zh
  38221. * 获取 ArmatureDisplay 当前使用的 Armature 对象。
  38222. * @method armature
  38223. * @returns @en Return the armature object. @zh 返回 armature 对象。
  38224. */
  38225. armature(): Armature | null;
  38226. protected _flushAssembler(): void;
  38227. protected _updateSocketBindings(): void;
  38228. protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  38229. /**
  38230. * @en Sets flag for update render data.
  38231. * @zh 标记组件渲染数据更新。
  38232. */
  38233. markForUpdateRenderData(enable?: boolean): void;
  38234. }
  38235. /**
  38236. * @engineInternal Since v3.7.2 this is an engine private class.
  38237. * Users no need to call any function in this class.
  38238. */
  38239. /**
  38240. * @en Attach node tool.
  38241. * @zh 挂点工具类。
  38242. * @class dragonBones.AttachUtil
  38243. */
  38244. export class AttachUtil {
  38245. constructor();
  38246. /**
  38247. * @en Initializes parameters.
  38248. * @zh 初始化参数设置。
  38249. */
  38250. init(armatureDisplay: ArmatureDisplay): void;
  38251. /**
  38252. * @en Resets parameter values.
  38253. * @zh 重置参数设置。
  38254. */
  38255. reset(): void;
  38256. /**
  38257. * @en Synchronize transformation of nodes attached to bones.
  38258. * @zh 同步变换附着在骨骼上节点。
  38259. */
  38260. _syncAttachedNode(): void;
  38261. }
  38262. /* eslint-disable @typescript-eslint/ban-types */
  38263. /**
  38264. * The MIT License (MIT)
  38265. *
  38266. * Copyright (c) 2012-2017 DragonBones team and other contributors
  38267. *
  38268. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  38269. * this software and associated documentation files (the "Software"), to deal in
  38270. * the Software without restriction, including without limitation the rights to
  38271. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  38272. * the Software, and to permit persons to whom the Software is furnished to do so,
  38273. * subject to the following conditions:
  38274. *
  38275. * The above copyright notice and this permission notice shall be included in all
  38276. * copies or substantial portions of the Software.
  38277. *
  38278. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38279. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  38280. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  38281. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  38282. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  38283. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  38284. */
  38285. /**
  38286. * @internal
  38287. * @private
  38288. */
  38289. export const webAssemblyModule: {
  38290. HEAP16: Int16Array;
  38291. _malloc(byteSize: number): number;
  38292. _free(pointer: number): void;
  38293. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  38294. };
  38295. /**
  38296. * @internal
  38297. * @private
  38298. */
  38299. export enum BinaryOffset {
  38300. WeigthBoneCount = 0,
  38301. WeigthFloatOffset = 1,
  38302. WeigthBoneIndices = 2,
  38303. MeshVertexCount = 0,
  38304. MeshTriangleCount = 1,
  38305. MeshFloatOffset = 2,
  38306. MeshWeightOffset = 3,
  38307. MeshVertexIndices = 4,
  38308. TimelineScale = 0,
  38309. TimelineOffset = 1,
  38310. TimelineKeyFrameCount = 2,
  38311. TimelineFrameValueCount = 3,
  38312. TimelineFrameValueOffset = 4,
  38313. TimelineFrameOffset = 5,
  38314. FramePosition = 0,
  38315. FrameTweenType = 1,
  38316. FrameTweenEasingOrCurveSampleCount = 2,
  38317. FrameCurveSamples = 3,
  38318. DeformMeshOffset = 0,
  38319. DeformCount = 1,
  38320. DeformValueCount = 2,
  38321. DeformValueOffset = 3,
  38322. DeformFloatOffset = 4
  38323. }
  38324. /**
  38325. * @internal
  38326. * @private
  38327. */
  38328. export enum ArmatureType {
  38329. Armature = 0,
  38330. MovieClip = 1,
  38331. Stage = 2
  38332. }
  38333. /**
  38334. * @internal
  38335. * @private
  38336. */
  38337. export enum BoneType {
  38338. Bone = 0,
  38339. Surface = 1
  38340. }
  38341. /**
  38342. * @private
  38343. */
  38344. export enum DisplayType {
  38345. Image = 0,
  38346. Armature = 1,
  38347. Mesh = 2,
  38348. BoundingBox = 3
  38349. }
  38350. /**
  38351. * - Bounding box type.
  38352. * @version DragonBones 5.0
  38353. * @language en_US
  38354. */
  38355. /**
  38356. * - 边界框类型。
  38357. * @version DragonBones 5.0
  38358. * @language zh_CN
  38359. */
  38360. export enum BoundingBoxType {
  38361. Rectangle = 0,
  38362. Ellipse = 1,
  38363. Polygon = 2
  38364. }
  38365. /**
  38366. * @internal
  38367. * @private
  38368. */
  38369. export enum ActionType {
  38370. Play = 0,
  38371. Stop = 1,
  38372. GotoAndPlay = 2,
  38373. GotoAndStop = 3,
  38374. FadeIn = 4,
  38375. FadeOut = 5,
  38376. Frame = 10,
  38377. Sound = 11
  38378. }
  38379. /**
  38380. * @internal
  38381. * @private
  38382. */
  38383. export enum BlendMode {
  38384. Normal = 0,
  38385. Add = 1,
  38386. Alpha = 2,
  38387. Darken = 3,
  38388. Difference = 4,
  38389. Erase = 5,
  38390. HardLight = 6,
  38391. Invert = 7,
  38392. Layer = 8,
  38393. Lighten = 9,
  38394. Multiply = 10,
  38395. Overlay = 11,
  38396. Screen = 12,
  38397. Subtract = 13
  38398. }
  38399. /**
  38400. * @internal
  38401. * @private
  38402. */
  38403. export enum TweenType {
  38404. None = 0,
  38405. Line = 1,
  38406. Curve = 2,
  38407. QuadIn = 3,
  38408. QuadOut = 4,
  38409. QuadInOut = 5
  38410. }
  38411. /**
  38412. * @internal
  38413. * @private
  38414. */
  38415. export enum TimelineType {
  38416. Action = 0,
  38417. ZOrder = 1,
  38418. BoneAll = 10,
  38419. BoneTranslate = 11,
  38420. BoneRotate = 12,
  38421. BoneScale = 13,
  38422. Surface = 50,
  38423. SlotDisplay = 20,
  38424. SlotColor = 21,
  38425. SlotFFD = 22,
  38426. IKConstraint = 30,
  38427. AnimationTime = 40,
  38428. AnimationWeight = 41
  38429. }
  38430. /**
  38431. * - Offset mode.
  38432. * @version DragonBones 5.5
  38433. * @language en_US
  38434. */
  38435. /**
  38436. * - 偏移模式。
  38437. * @version DragonBones 5.5
  38438. * @language zh_CN
  38439. */
  38440. export enum OffsetMode {
  38441. None = 0,
  38442. Additive = 1,
  38443. Override = 2
  38444. }
  38445. /**
  38446. * @private
  38447. */
  38448. export interface Map<T> {
  38449. [key: string]: T;
  38450. }
  38451. /**
  38452. * @private
  38453. */
  38454. export class DragonBones {
  38455. static readonly VERSION: string;
  38456. static yDown: boolean;
  38457. static debug: boolean;
  38458. static debugDraw: boolean;
  38459. static webAssembly: boolean;
  38460. constructor(eventManager: IEventDispatcher);
  38461. advanceTime(passedTime: number): void;
  38462. bufferEvent(value: EventObject): void;
  38463. bufferObject(object: BaseObject): void;
  38464. readonly clock: WorldClock;
  38465. readonly eventManager: IEventDispatcher;
  38466. }
  38467. /**
  38468. * - The BaseObject is the base export class for all objects in the DragonBones framework.
  38469. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  38470. * @version DragonBones 4.5
  38471. * @language en_US
  38472. */
  38473. /**
  38474. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  38475. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  38476. * @version DragonBones 4.5
  38477. * @language zh_CN
  38478. */
  38479. export abstract class BaseObject {
  38480. static toString(): string;
  38481. /**
  38482. * - Set the maximum cache count of the specify object pool.
  38483. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  38484. * @param maxCount - Max count.
  38485. * @version DragonBones 4.5
  38486. * @language en_US
  38487. */
  38488. /**
  38489. * - 设置特定对象池的最大缓存数量。
  38490. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  38491. * @param maxCount - 最大缓存数量。
  38492. * @version DragonBones 4.5
  38493. * @language zh_CN
  38494. */
  38495. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  38496. /**
  38497. * - Clear the cached instances of a specify object pool.
  38498. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  38499. * @version DragonBones 4.5
  38500. * @language en_US
  38501. */
  38502. /**
  38503. * - 清除特定对象池的缓存实例。
  38504. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  38505. * @version DragonBones 4.5
  38506. * @language zh_CN
  38507. */
  38508. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  38509. /**
  38510. * - Get an instance of the specify export class from object pool.
  38511. * @param objectConstructor - The specify class.
  38512. * @version DragonBones 4.5
  38513. * @language en_US
  38514. */
  38515. /**
  38516. * - 从对象池中获取特定类的实例。
  38517. * @param objectConstructor - 特定的类。
  38518. * @version DragonBones 4.5
  38519. * @language zh_CN
  38520. */
  38521. static borrowObject<T extends BaseObject>(objectConstructor: {
  38522. new(): T;
  38523. }): T;
  38524. /**
  38525. * - A unique identification number assigned to the object.
  38526. * @version DragonBones 4.5
  38527. * @language en_US
  38528. */
  38529. /**
  38530. * - 分配给此实例的唯一标识号。
  38531. * @version DragonBones 4.5
  38532. * @language zh_CN
  38533. */
  38534. readonly hashCode: number;
  38535. /**
  38536. * @private
  38537. */
  38538. protected abstract _onClear(): void;
  38539. /**
  38540. * - Clear the object and return it back to object pool。
  38541. * @version DragonBones 4.5
  38542. * @language en_US
  38543. */
  38544. /**
  38545. * - 清除该实例的所有数据并将其返还对象池。
  38546. * @version DragonBones 4.5
  38547. * @language zh_CN
  38548. */
  38549. returnToPool(): void;
  38550. }
  38551. /**
  38552. * - 2D Transform matrix.
  38553. * @version DragonBones 3.0
  38554. * @language en_US
  38555. */
  38556. /**
  38557. * - 2D 转换矩阵。
  38558. * @version DragonBones 3.0
  38559. * @language zh_CN
  38560. */
  38561. export class Matrix {
  38562. /**
  38563. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  38564. * @default 1.0
  38565. * @version DragonBones 3.0
  38566. * @language en_US
  38567. */
  38568. /**
  38569. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  38570. * @default 1.0
  38571. * @version DragonBones 3.0
  38572. * @language zh_CN
  38573. */
  38574. a: number;
  38575. /**
  38576. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  38577. * @default 0.0
  38578. * @version DragonBones 3.0
  38579. * @language en_US
  38580. */
  38581. /**
  38582. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  38583. * @default 0.0
  38584. * @version DragonBones 3.0
  38585. * @language zh_CN
  38586. */
  38587. b: number;
  38588. /**
  38589. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  38590. * @default 0.0
  38591. * @version DragonBones 3.0
  38592. * @language en_US
  38593. */
  38594. /**
  38595. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  38596. * @default 0.0
  38597. * @version DragonBones 3.0
  38598. * @language zh_CN
  38599. */
  38600. c: number;
  38601. /**
  38602. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  38603. * @default 1.0
  38604. * @version DragonBones 3.0
  38605. * @language en_US
  38606. */
  38607. /**
  38608. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  38609. * @default 1.0
  38610. * @version DragonBones 3.0
  38611. * @language zh_CN
  38612. */
  38613. d: number;
  38614. /**
  38615. * - The distance by which to translate each point along the x axis.
  38616. * @default 0.0
  38617. * @version DragonBones 3.0
  38618. * @language en_US
  38619. */
  38620. /**
  38621. * - 沿 x 轴平移每个点的距离。
  38622. * @default 0.0
  38623. * @version DragonBones 3.0
  38624. * @language zh_CN
  38625. */
  38626. tx: number;
  38627. /**
  38628. * - The distance by which to translate each point along the y axis.
  38629. * @default 0.0
  38630. * @version DragonBones 3.0
  38631. * @language en_US
  38632. */
  38633. /**
  38634. * - 沿 y 轴平移每个点的距离。
  38635. * @default 0.0
  38636. * @version DragonBones 3.0
  38637. * @language zh_CN
  38638. */
  38639. ty: number;
  38640. /**
  38641. * @private
  38642. */
  38643. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  38644. toString(): string;
  38645. /**
  38646. * @private
  38647. */
  38648. copyFrom(value: Matrix): Matrix;
  38649. /**
  38650. * @private
  38651. */
  38652. copyFromArray(value: Array<number>, offset?: number): Matrix;
  38653. /**
  38654. * - Convert to unit matrix.
  38655. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  38656. * @version DragonBones 3.0
  38657. * @language en_US
  38658. */
  38659. /**
  38660. * - 转换为单位矩阵。
  38661. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  38662. * @version DragonBones 3.0
  38663. * @language zh_CN
  38664. */
  38665. identity(): Matrix;
  38666. /**
  38667. * - Multiplies the current matrix with another matrix.
  38668. * @param value - The matrix that needs to be multiplied.
  38669. * @version DragonBones 3.0
  38670. * @language en_US
  38671. */
  38672. /**
  38673. * - 将当前矩阵与另一个矩阵相乘。
  38674. * @param value - 需要相乘的矩阵。
  38675. * @version DragonBones 3.0
  38676. * @language zh_CN
  38677. */
  38678. concat(value: Matrix): Matrix;
  38679. /**
  38680. * - Convert to inverse matrix.
  38681. * @version DragonBones 3.0
  38682. * @language en_US
  38683. */
  38684. /**
  38685. * - 转换为逆矩阵。
  38686. * @version DragonBones 3.0
  38687. * @language zh_CN
  38688. */
  38689. invert(): Matrix;
  38690. /**
  38691. * - Apply a matrix transformation to a specific point.
  38692. * @param x - X coordinate.
  38693. * @param y - Y coordinate.
  38694. * @param result - The point after the transformation is applied.
  38695. * @param delta - Whether to ignore tx, ty's conversion to point.
  38696. * @version DragonBones 3.0
  38697. * @language en_US
  38698. */
  38699. /**
  38700. * - 将矩阵转换应用于特定点。
  38701. * @param x - 横坐标。
  38702. * @param y - 纵坐标。
  38703. * @param result - 应用转换之后的点。
  38704. * @param delta - 是否忽略 tx,ty 对点的转换。
  38705. * @version DragonBones 3.0
  38706. * @language zh_CN
  38707. */
  38708. transformPoint(x: number, y: number, result: {
  38709. x: number;
  38710. y: number;
  38711. }, delta?: boolean): void;
  38712. /**
  38713. * @private
  38714. */
  38715. transformRectangle(rectangle: {
  38716. x: number;
  38717. y: number;
  38718. width: number;
  38719. height: number;
  38720. }, delta?: boolean): void;
  38721. }
  38722. /**
  38723. * - 2D Transform.
  38724. * @version DragonBones 3.0
  38725. * @language en_US
  38726. */
  38727. /**
  38728. * - 2D 变换。
  38729. * @version DragonBones 3.0
  38730. * @language zh_CN
  38731. */
  38732. export class Transform {
  38733. /**
  38734. * @private
  38735. */
  38736. static readonly PI: number;
  38737. /**
  38738. * @private
  38739. */
  38740. static readonly PI_D: number;
  38741. /**
  38742. * @private
  38743. */
  38744. static readonly PI_H: number;
  38745. /**
  38746. * @private
  38747. */
  38748. static readonly PI_Q: number;
  38749. /**
  38750. * @private
  38751. */
  38752. static readonly RAD_DEG: number;
  38753. /**
  38754. * @private
  38755. */
  38756. static readonly DEG_RAD: number;
  38757. /**
  38758. * @private
  38759. */
  38760. static normalizeRadian(value: number): number;
  38761. /**
  38762. * - Horizontal translate.
  38763. * @version DragonBones 3.0
  38764. * @language en_US
  38765. */
  38766. /**
  38767. * - 水平位移。
  38768. * @version DragonBones 3.0
  38769. * @language zh_CN
  38770. */
  38771. x: number;
  38772. /**
  38773. * - Vertical translate.
  38774. * @version DragonBones 3.0
  38775. * @language en_US
  38776. */
  38777. /**
  38778. * - 垂直位移。
  38779. * @version DragonBones 3.0
  38780. * @language zh_CN
  38781. */
  38782. y: number;
  38783. /**
  38784. * - Skew. (In radians)
  38785. * @version DragonBones 3.0
  38786. * @language en_US
  38787. */
  38788. /**
  38789. * - 倾斜。 (以弧度为单位)
  38790. * @version DragonBones 3.0
  38791. * @language zh_CN
  38792. */
  38793. skew: number;
  38794. /**
  38795. * - rotation. (In radians)
  38796. * @version DragonBones 3.0
  38797. * @language en_US
  38798. */
  38799. /**
  38800. * - 旋转。 (以弧度为单位)
  38801. * @version DragonBones 3.0
  38802. * @language zh_CN
  38803. */
  38804. rotation: number;
  38805. /**
  38806. * - Horizontal Scaling.
  38807. * @version DragonBones 3.0
  38808. * @language en_US
  38809. */
  38810. /**
  38811. * - 水平缩放。
  38812. * @version DragonBones 3.0
  38813. * @language zh_CN
  38814. */
  38815. scaleX: number;
  38816. /**
  38817. * - Vertical scaling.
  38818. * @version DragonBones 3.0
  38819. * @language en_US
  38820. */
  38821. /**
  38822. * - 垂直缩放。
  38823. * @version DragonBones 3.0
  38824. * @language zh_CN
  38825. */
  38826. scaleY: number;
  38827. /**
  38828. * @private
  38829. */
  38830. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  38831. toString(): string;
  38832. /**
  38833. * @private
  38834. */
  38835. copyFrom(value: Transform): Transform;
  38836. /**
  38837. * @private
  38838. */
  38839. identity(): Transform;
  38840. /**
  38841. * @private
  38842. */
  38843. add(value: Transform): Transform;
  38844. /**
  38845. * @private
  38846. */
  38847. minus(value: Transform): Transform;
  38848. /**
  38849. * @private
  38850. */
  38851. fromMatrix(matrix: Matrix): Transform;
  38852. /**
  38853. * @private
  38854. */
  38855. toMatrix(matrix: Matrix): Transform;
  38856. }
  38857. /**
  38858. * @internal
  38859. * @private
  38860. */
  38861. export class ColorTransform {
  38862. alphaMultiplier: number;
  38863. redMultiplier: number;
  38864. greenMultiplier: number;
  38865. blueMultiplier: number;
  38866. alphaOffset: number;
  38867. redOffset: number;
  38868. greenOffset: number;
  38869. blueOffset: number;
  38870. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  38871. copyFrom(value: ColorTransform): void;
  38872. identity(): void;
  38873. }
  38874. /**
  38875. * - The Point object represents a location in a two-dimensional coordinate system.
  38876. * @version DragonBones 3.0
  38877. * @language en_US
  38878. */
  38879. /**
  38880. * - Point 对象表示二维坐标系统中的某个位置。
  38881. * @version DragonBones 3.0
  38882. * @language zh_CN
  38883. */
  38884. export class Point {
  38885. /**
  38886. * - The horizontal coordinate.
  38887. * @default 0.0
  38888. * @version DragonBones 3.0
  38889. * @language en_US
  38890. */
  38891. /**
  38892. * - 该点的水平坐标。
  38893. * @default 0.0
  38894. * @version DragonBones 3.0
  38895. * @language zh_CN
  38896. */
  38897. x: number;
  38898. /**
  38899. * - The vertical coordinate.
  38900. * @default 0.0
  38901. * @version DragonBones 3.0
  38902. * @language en_US
  38903. */
  38904. /**
  38905. * - 该点的垂直坐标。
  38906. * @default 0.0
  38907. * @version DragonBones 3.0
  38908. * @language zh_CN
  38909. */
  38910. y: number;
  38911. /**
  38912. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  38913. * @param x - The horizontal coordinate.
  38914. * @param y - The vertical coordinate.
  38915. * @version DragonBones 3.0
  38916. * @language en_US
  38917. */
  38918. /**
  38919. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  38920. * @param x - 该对象的x属性值,默认为 0.0。
  38921. * @param y - 该对象的y属性值,默认为 0.0。
  38922. * @version DragonBones 3.0
  38923. * @language zh_CN
  38924. */
  38925. constructor(x?: number, y?: number);
  38926. /**
  38927. * @private
  38928. */
  38929. copyFrom(value: Point): void;
  38930. /**
  38931. * @private
  38932. */
  38933. clear(): void;
  38934. }
  38935. /**
  38936. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  38937. * width and its height.<br/>
  38938. * The x, y, width, and height properties of the Rectangle export class are independent of each other; changing the value of
  38939. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  38940. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  38941. * if you change the bottom property, the value of the height property changes.
  38942. * @version DragonBones 3.0
  38943. * @language en_US
  38944. */
  38945. /**
  38946. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  38947. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  38948. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  38949. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  38950. * @version DragonBones 3.0
  38951. * @language zh_CN
  38952. */
  38953. export class Rectangle {
  38954. /**
  38955. * - The x coordinate of the top-left corner of the rectangle.
  38956. * @default 0.0
  38957. * @version DragonBones 3.0
  38958. * @language en_US
  38959. */
  38960. /**
  38961. * - 矩形左上角的 x 坐标。
  38962. * @default 0.0
  38963. * @version DragonBones 3.0
  38964. * @language zh_CN
  38965. */
  38966. x: number;
  38967. /**
  38968. * - The y coordinate of the top-left corner of the rectangle.
  38969. * @default 0.0
  38970. * @version DragonBones 3.0
  38971. * @language en_US
  38972. */
  38973. /**
  38974. * - 矩形左上角的 y 坐标。
  38975. * @default 0.0
  38976. * @version DragonBones 3.0
  38977. * @language zh_CN
  38978. */
  38979. y: number;
  38980. /**
  38981. * - The width of the rectangle, in pixels.
  38982. * @default 0.0
  38983. * @version DragonBones 3.0
  38984. * @language en_US
  38985. */
  38986. /**
  38987. * - 矩形的宽度(以像素为单位)。
  38988. * @default 0.0
  38989. * @version DragonBones 3.0
  38990. * @language zh_CN
  38991. */
  38992. width: number;
  38993. /**
  38994. * - 矩形的高度(以像素为单位)。
  38995. * @default 0.0
  38996. * @version DragonBones 3.0
  38997. * @language en_US
  38998. */
  38999. /**
  39000. * - The height of the rectangle, in pixels.
  39001. * @default 0.0
  39002. * @version DragonBones 3.0
  39003. * @language zh_CN
  39004. */
  39005. height: number;
  39006. /**
  39007. * @private
  39008. */
  39009. constructor(x?: number, y?: number, width?: number, height?: number);
  39010. /**
  39011. * @private
  39012. */
  39013. copyFrom(value: Rectangle): void;
  39014. /**
  39015. * @private
  39016. */
  39017. clear(): void;
  39018. }
  39019. /**
  39020. * - The user custom data.
  39021. * @version DragonBones 5.0
  39022. * @language en_US
  39023. */
  39024. /**
  39025. * - 用户自定义数据。
  39026. * @version DragonBones 5.0
  39027. * @language zh_CN
  39028. */
  39029. export class UserData extends BaseObject {
  39030. static toString(): string;
  39031. /**
  39032. * - The custom int numbers.
  39033. * @version DragonBones 5.0
  39034. * @language en_US
  39035. */
  39036. /**
  39037. * - 自定义整数。
  39038. * @version DragonBones 5.0
  39039. * @language zh_CN
  39040. */
  39041. readonly ints: Array<number>;
  39042. /**
  39043. * - The custom float numbers.
  39044. * @version DragonBones 5.0
  39045. * @language en_US
  39046. */
  39047. /**
  39048. * - 自定义浮点数。
  39049. * @version DragonBones 5.0
  39050. * @language zh_CN
  39051. */
  39052. readonly floats: Array<number>;
  39053. /**
  39054. * - The custom strings.
  39055. * @version DragonBones 5.0
  39056. * @language en_US
  39057. */
  39058. /**
  39059. * - 自定义字符串。
  39060. * @version DragonBones 5.0
  39061. * @language zh_CN
  39062. */
  39063. readonly strings: Array<string>;
  39064. /**
  39065. * @inheritDoc
  39066. */
  39067. protected _onClear(): void;
  39068. /**
  39069. * @internal
  39070. * @private
  39071. */
  39072. addInt(value: number): void;
  39073. /**
  39074. * @internal
  39075. * @private
  39076. */
  39077. addFloat(value: number): void;
  39078. /**
  39079. * @internal
  39080. * @private
  39081. */
  39082. addString(value: string): void;
  39083. /**
  39084. * - Get the custom int number.
  39085. * @version DragonBones 5.0
  39086. * @language en_US
  39087. */
  39088. /**
  39089. * - 获取自定义整数。
  39090. * @version DragonBones 5.0
  39091. * @language zh_CN
  39092. */
  39093. getInt(index?: number): number;
  39094. /**
  39095. * - Get the custom float number.
  39096. * @version DragonBones 5.0
  39097. * @language en_US
  39098. */
  39099. /**
  39100. * - 获取自定义浮点数。
  39101. * @version DragonBones 5.0
  39102. * @language zh_CN
  39103. */
  39104. getFloat(index?: number): number;
  39105. /**
  39106. * - Get the custom string.
  39107. * @version DragonBones 5.0
  39108. * @language en_US
  39109. */
  39110. /**
  39111. * - 获取自定义字符串。
  39112. * @version DragonBones 5.0
  39113. * @language zh_CN
  39114. */
  39115. getString(index?: number): string;
  39116. }
  39117. /**
  39118. * @internal
  39119. * @private
  39120. */
  39121. export class ActionData extends BaseObject {
  39122. static toString(): string;
  39123. type: ActionType;
  39124. name: string;
  39125. bone: BoneData | null;
  39126. slot: SlotData | null;
  39127. data: UserData | null;
  39128. protected _onClear(): void;
  39129. }
  39130. /**
  39131. * - The DragonBones data.
  39132. * A DragonBones data contains multiple armature data.
  39133. * @see dragonBones.ArmatureData
  39134. * @version DragonBones 3.0
  39135. * @language en_US
  39136. */
  39137. /**
  39138. * - 龙骨数据。
  39139. * 一个龙骨数据包含多个骨架数据。
  39140. * @see dragonBones.ArmatureData
  39141. * @version DragonBones 3.0
  39142. * @language zh_CN
  39143. */
  39144. export class DragonBonesData extends BaseObject {
  39145. static toString(): string;
  39146. /**
  39147. * @private
  39148. */
  39149. autoSearch: boolean;
  39150. /**
  39151. * - The animation frame rate.
  39152. * @version DragonBones 3.0
  39153. * @language en_US
  39154. */
  39155. /**
  39156. * - 动画帧频。
  39157. * @version DragonBones 3.0
  39158. * @language zh_CN
  39159. */
  39160. frameRate: number;
  39161. /**
  39162. * - The data version.
  39163. * @version DragonBones 3.0
  39164. * @language en_US
  39165. */
  39166. /**
  39167. * - 数据版本。
  39168. * @version DragonBones 3.0
  39169. * @language zh_CN
  39170. */
  39171. version: string;
  39172. /**
  39173. * - The DragonBones data name.
  39174. * The name is consistent with the DragonBones project name.
  39175. * @version DragonBones 3.0
  39176. * @language en_US
  39177. */
  39178. /**
  39179. * - 龙骨数据名称。
  39180. * 该名称与龙骨项目名保持一致。
  39181. * @version DragonBones 3.0
  39182. * @language zh_CN
  39183. */
  39184. name: string;
  39185. /**
  39186. * @private
  39187. */
  39188. stage: ArmatureData | null;
  39189. /**
  39190. * @internal
  39191. * @private
  39192. */
  39193. readonly frameIndices: Array<number>;
  39194. /**
  39195. * @internal
  39196. * @private
  39197. */
  39198. readonly cachedFrames: Array<number>;
  39199. /**
  39200. * - All armature data names.
  39201. * @version DragonBones 3.0
  39202. * @language en_US
  39203. */
  39204. /**
  39205. * - 所有的骨架数据名称。
  39206. * @version DragonBones 3.0
  39207. * @language zh_CN
  39208. */
  39209. readonly armatureNames: Array<string>;
  39210. /**
  39211. * @private
  39212. */
  39213. readonly armatures: Map<ArmatureData>;
  39214. /**
  39215. * @internal
  39216. * @private
  39217. */
  39218. binary: ArrayBuffer;
  39219. /**
  39220. * @internal
  39221. * @private
  39222. */
  39223. intArray: Int16Array;
  39224. /**
  39225. * @internal
  39226. * @private
  39227. */
  39228. floatArray: Float32Array;
  39229. /**
  39230. * @internal
  39231. * @private
  39232. */
  39233. frameIntArray: Int16Array;
  39234. /**
  39235. * @internal
  39236. * @private
  39237. */
  39238. frameFloatArray: Float32Array;
  39239. /**
  39240. * @internal
  39241. * @private
  39242. */
  39243. frameArray: Int16Array;
  39244. /**
  39245. * @internal
  39246. * @private
  39247. */
  39248. timelineArray: Uint16Array;
  39249. /**
  39250. * @private
  39251. */
  39252. userData: UserData | null;
  39253. /**
  39254. * @inheritDoc
  39255. */
  39256. protected _onClear(): void;
  39257. /**
  39258. * @internal
  39259. * @private
  39260. */
  39261. addArmature(value: ArmatureData): void;
  39262. /**
  39263. * - Get a specific armature data.
  39264. * @param name - The armature data name.
  39265. * @version DragonBones 3.0
  39266. * @language en_US
  39267. */
  39268. /**
  39269. * - 获取特定的骨架数据。
  39270. * @param name - 骨架数据名称。
  39271. * @version DragonBones 3.0
  39272. * @language zh_CN
  39273. */
  39274. getArmature(name: string): ArmatureData | null;
  39275. /**
  39276. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  39277. * @deprecated
  39278. * @language en_US
  39279. */
  39280. /**
  39281. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  39282. * @deprecated
  39283. * @language zh_CN
  39284. */
  39285. dispose(): void;
  39286. }
  39287. /**
  39288. * - The armature data.
  39289. * @version DragonBones 3.0
  39290. * @language en_US
  39291. */
  39292. /**
  39293. * - 骨架数据。
  39294. * @version DragonBones 3.0
  39295. * @language zh_CN
  39296. */
  39297. export class ArmatureData extends BaseObject {
  39298. static toString(): string;
  39299. /**
  39300. * @private
  39301. */
  39302. type: ArmatureType;
  39303. /**
  39304. * - The animation frame rate.
  39305. * @version DragonBones 3.0
  39306. * @language en_US
  39307. */
  39308. /**
  39309. * - 动画帧率。
  39310. * @version DragonBones 3.0
  39311. * @language zh_CN
  39312. */
  39313. frameRate: number;
  39314. /**
  39315. * @private
  39316. */
  39317. cacheFrameRate: number;
  39318. /**
  39319. * @private
  39320. */
  39321. scale: number;
  39322. /**
  39323. * - The armature name.
  39324. * @version DragonBones 3.0
  39325. * @language en_US
  39326. */
  39327. /**
  39328. * - 骨架名称。
  39329. * @version DragonBones 3.0
  39330. * @language zh_CN
  39331. */
  39332. name: string;
  39333. /**
  39334. * @private
  39335. */
  39336. readonly aabb: Rectangle;
  39337. /**
  39338. * - The names of all the animation data.
  39339. * @version DragonBones 3.0
  39340. * @language en_US
  39341. */
  39342. /**
  39343. * - 所有的动画数据名称。
  39344. * @version DragonBones 3.0
  39345. * @language zh_CN
  39346. */
  39347. readonly animationNames: Array<string>;
  39348. /**
  39349. * @private
  39350. */
  39351. readonly sortedBones: Array<BoneData>;
  39352. /**
  39353. * @private
  39354. */
  39355. readonly sortedSlots: Array<SlotData>;
  39356. /**
  39357. * @private
  39358. */
  39359. readonly defaultActions: Array<ActionData>;
  39360. /**
  39361. * @private
  39362. */
  39363. readonly actions: Array<ActionData>;
  39364. /**
  39365. * @private
  39366. */
  39367. readonly bones: Map<BoneData>;
  39368. /**
  39369. * @private
  39370. */
  39371. readonly slots: Map<SlotData>;
  39372. /**
  39373. * @private
  39374. */
  39375. readonly constraints: Map<ConstraintData>;
  39376. /**
  39377. * @private
  39378. */
  39379. readonly skins: Map<SkinData>;
  39380. /**
  39381. * @private
  39382. */
  39383. readonly animations: Map<AnimationData>;
  39384. /**
  39385. * - The default skin data.
  39386. * @version DragonBones 4.5
  39387. * @language en_US
  39388. */
  39389. /**
  39390. * - 默认插槽数据。
  39391. * @version DragonBones 4.5
  39392. * @language zh_CN
  39393. */
  39394. defaultSkin: SkinData | null;
  39395. /**
  39396. * - The default animation data.
  39397. * @version DragonBones 4.5
  39398. * @language en_US
  39399. */
  39400. /**
  39401. * - 默认动画数据。
  39402. * @version DragonBones 4.5
  39403. * @language zh_CN
  39404. */
  39405. defaultAnimation: AnimationData | null;
  39406. /**
  39407. * @private
  39408. */
  39409. canvas: CanvasData | null;
  39410. /**
  39411. * @private
  39412. */
  39413. userData: UserData | null;
  39414. /**
  39415. * @private
  39416. */
  39417. parent: DragonBonesData;
  39418. /**
  39419. * @inheritDoc
  39420. */
  39421. protected _onClear(): void;
  39422. /**
  39423. * @internal
  39424. * @private
  39425. */
  39426. sortBones(): void;
  39427. /**
  39428. * @internal
  39429. * @private
  39430. */
  39431. cacheFrames(frameRate: number): void;
  39432. /**
  39433. * @internal
  39434. * @private
  39435. */
  39436. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  39437. /**
  39438. * @internal
  39439. * @private
  39440. */
  39441. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  39442. /**
  39443. * @internal
  39444. * @private
  39445. */
  39446. addBone(value: BoneData): void;
  39447. /**
  39448. * @internal
  39449. * @private
  39450. */
  39451. addSlot(value: SlotData): void;
  39452. /**
  39453. * @internal
  39454. * @private
  39455. */
  39456. addConstraint(value: ConstraintData): void;
  39457. /**
  39458. * @internal
  39459. * @private
  39460. */
  39461. addSkin(value: SkinData): void;
  39462. /**
  39463. * @internal
  39464. * @private
  39465. */
  39466. addAnimation(value: AnimationData): void;
  39467. /**
  39468. * @internal
  39469. * @private
  39470. */
  39471. addAction(value: ActionData, isDefault: boolean): void;
  39472. /**
  39473. * - Get a specific done data.
  39474. * @param name - The bone name.
  39475. * @version DragonBones 3.0
  39476. * @language en_US
  39477. */
  39478. /**
  39479. * - 获取特定的骨骼数据。
  39480. * @param name - 骨骼名称。
  39481. * @version DragonBones 3.0
  39482. * @language zh_CN
  39483. */
  39484. getBone(name: string): BoneData | null;
  39485. /**
  39486. * - Get a specific slot data.
  39487. * @param name - The slot name.
  39488. * @version DragonBones 3.0
  39489. * @language en_US
  39490. */
  39491. /**
  39492. * - 获取特定的插槽数据。
  39493. * @param name - 插槽名称。
  39494. * @version DragonBones 3.0
  39495. * @language zh_CN
  39496. */
  39497. getSlot(name: string): SlotData | null;
  39498. /**
  39499. * @private
  39500. */
  39501. getConstraint(name: string): ConstraintData | null;
  39502. /**
  39503. * - Get a specific skin data.
  39504. * @param name - The skin name.
  39505. * @version DragonBones 3.0
  39506. * @language en_US
  39507. */
  39508. /**
  39509. * - 获取特定皮肤数据。
  39510. * @param name - 皮肤名称。
  39511. * @version DragonBones 3.0
  39512. * @language zh_CN
  39513. */
  39514. getSkin(name: string): SkinData | null;
  39515. /**
  39516. * @internal
  39517. * @private
  39518. */
  39519. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  39520. /**
  39521. * - Get a specific animation data.
  39522. * @param name - The animation name.
  39523. * @version DragonBones 3.0
  39524. * @language en_US
  39525. */
  39526. /**
  39527. * - 获取特定的动画数据。
  39528. * @param name - 动画名称。
  39529. * @version DragonBones 3.0
  39530. * @language zh_CN
  39531. */
  39532. getAnimation(name: string): AnimationData | null;
  39533. }
  39534. /**
  39535. * - The bone data.
  39536. * @version DragonBones 3.0
  39537. * @language en_US
  39538. */
  39539. /**
  39540. * - 骨骼数据。
  39541. * @version DragonBones 3.0
  39542. * @language zh_CN
  39543. */
  39544. export class BoneData extends BaseObject {
  39545. static toString(): string;
  39546. /**
  39547. * @private
  39548. */
  39549. inheritTranslation: boolean;
  39550. /**
  39551. * @private
  39552. */
  39553. inheritRotation: boolean;
  39554. /**
  39555. * @private
  39556. */
  39557. inheritScale: boolean;
  39558. /**
  39559. * @private
  39560. */
  39561. inheritReflection: boolean;
  39562. /**
  39563. * @private
  39564. */
  39565. type: BoneType;
  39566. /**
  39567. * - The bone length.
  39568. * @version DragonBones 3.0
  39569. * @language en_US
  39570. */
  39571. /**
  39572. * - 骨骼长度。
  39573. * @version DragonBones 3.0
  39574. * @language zh_CN
  39575. */
  39576. length: number;
  39577. /**
  39578. * - The bone name.
  39579. * @version DragonBones 3.0
  39580. * @language en_US
  39581. */
  39582. /**
  39583. * - 骨骼名称。
  39584. * @version DragonBones 3.0
  39585. * @language zh_CN
  39586. */
  39587. name: string;
  39588. /**
  39589. * @private
  39590. */
  39591. readonly transform: Transform;
  39592. /**
  39593. * @private
  39594. */
  39595. userData: UserData | null;
  39596. /**
  39597. * - The parent bone data.
  39598. * @version DragonBones 3.0
  39599. * @language en_US
  39600. */
  39601. /**
  39602. * - 父骨骼数据。
  39603. * @version DragonBones 3.0
  39604. * @language zh_CN
  39605. */
  39606. parent: BoneData | null;
  39607. /**
  39608. * @inheritDoc
  39609. */
  39610. protected _onClear(): void;
  39611. }
  39612. /**
  39613. * @internal
  39614. * @private
  39615. */
  39616. export class SurfaceData extends BoneData {
  39617. static toString(): string;
  39618. segmentX: number;
  39619. segmentY: number;
  39620. readonly vertices: Array<number>;
  39621. /**
  39622. * @inheritDoc
  39623. */
  39624. protected _onClear(): void;
  39625. }
  39626. /**
  39627. * - The slot data.
  39628. * @version DragonBones 3.0
  39629. * @language en_US
  39630. */
  39631. /**
  39632. * - 插槽数据。
  39633. * @version DragonBones 3.0
  39634. * @language zh_CN
  39635. */
  39636. export class SlotData extends BaseObject {
  39637. /**
  39638. * @internal
  39639. * @private
  39640. */
  39641. static readonly DEFAULT_COLOR: ColorTransform;
  39642. /**
  39643. * @internal
  39644. * @private
  39645. */
  39646. static createColor(): ColorTransform;
  39647. static toString(): string;
  39648. /**
  39649. * @private
  39650. */
  39651. blendMode: BlendMode;
  39652. /**
  39653. * @private
  39654. */
  39655. displayIndex: number;
  39656. /**
  39657. * @private
  39658. */
  39659. zOrder: number;
  39660. /**
  39661. * - The slot name.
  39662. * @version DragonBones 3.0
  39663. * @language en_US
  39664. */
  39665. /**
  39666. * - 插槽名称。
  39667. * @version DragonBones 3.0
  39668. * @language zh_CN
  39669. */
  39670. name: string;
  39671. /**
  39672. * @private
  39673. */
  39674. color: ColorTransform;
  39675. /**
  39676. * @private
  39677. */
  39678. userData: UserData | null;
  39679. /**
  39680. * - The parent bone data.
  39681. * @version DragonBones 3.0
  39682. * @language en_US
  39683. */
  39684. /**
  39685. * - 父骨骼数据。
  39686. * @version DragonBones 3.0
  39687. * @language zh_CN
  39688. */
  39689. parent: BoneData;
  39690. /**
  39691. * @inheritDoc
  39692. */
  39693. protected _onClear(): void;
  39694. }
  39695. /**
  39696. * @internal
  39697. * @private
  39698. */
  39699. export abstract class ConstraintData extends BaseObject {
  39700. order: number;
  39701. name: string;
  39702. target: BoneData;
  39703. root: BoneData;
  39704. bone: BoneData | null;
  39705. protected _onClear(): void;
  39706. }
  39707. /**
  39708. * @internal
  39709. * @private
  39710. */
  39711. export class IKConstraintData extends ConstraintData {
  39712. static toString(): string;
  39713. scaleEnabled: boolean;
  39714. bendPositive: boolean;
  39715. weight: number;
  39716. protected _onClear(): void;
  39717. }
  39718. /**
  39719. * @internal
  39720. * @private
  39721. */
  39722. export class CanvasData extends BaseObject {
  39723. static toString(): string;
  39724. hasBackground: boolean;
  39725. color: number;
  39726. x: number;
  39727. y: number;
  39728. width: number;
  39729. height: number;
  39730. protected _onClear(): void;
  39731. }
  39732. /**
  39733. * - The skin data, typically a armature data instance contains at least one skinData.
  39734. * @version DragonBones 3.0
  39735. * @language en_US
  39736. */
  39737. /**
  39738. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  39739. * @version DragonBones 3.0
  39740. * @language zh_CN
  39741. */
  39742. export class SkinData extends BaseObject {
  39743. static toString(): string;
  39744. /**
  39745. * - The skin name.
  39746. * @version DragonBones 3.0
  39747. * @language en_US
  39748. */
  39749. /**
  39750. * - 皮肤名称。
  39751. * @version DragonBones 3.0
  39752. * @language zh_CN
  39753. */
  39754. name: string;
  39755. /**
  39756. * @private
  39757. */
  39758. readonly displays: Map<Array<DisplayData | null>>;
  39759. /**
  39760. * @private
  39761. */
  39762. parent: ArmatureData;
  39763. /**
  39764. * @inheritDoc
  39765. */
  39766. protected _onClear(): void;
  39767. /**
  39768. * @internal
  39769. * @private
  39770. */
  39771. addDisplay(slotName: string, value: DisplayData | null): void;
  39772. /**
  39773. * @private
  39774. */
  39775. getDisplay(slotName: string, displayName: string): DisplayData | null;
  39776. /**
  39777. * @private
  39778. */
  39779. getDisplays(slotName: string): Array<DisplayData | null> | null;
  39780. }
  39781. /**
  39782. * @internal
  39783. * @private
  39784. */
  39785. export abstract class DisplayData extends BaseObject {
  39786. type: DisplayType;
  39787. name: string;
  39788. path: string;
  39789. parent: SkinData;
  39790. readonly transform: Transform;
  39791. protected _onClear(): void;
  39792. }
  39793. /**
  39794. * @internal
  39795. * @private
  39796. */
  39797. export class ImageDisplayData extends DisplayData {
  39798. static toString(): string;
  39799. readonly pivot: Point;
  39800. texture: TextureData | null;
  39801. protected _onClear(): void;
  39802. }
  39803. /**
  39804. * @internal
  39805. * @private
  39806. */
  39807. export class ArmatureDisplayData extends DisplayData {
  39808. static toString(): string;
  39809. inheritAnimation: boolean;
  39810. readonly actions: Array<ActionData>;
  39811. armature: ArmatureData | null;
  39812. protected _onClear(): void;
  39813. /**
  39814. * @private
  39815. */
  39816. addAction(value: ActionData): void;
  39817. }
  39818. /**
  39819. * @internal
  39820. * @private
  39821. */
  39822. export class MeshDisplayData extends DisplayData {
  39823. static toString(): string;
  39824. inheritDeform: boolean;
  39825. offset: number;
  39826. weight: WeightData | null;
  39827. glue: GlueData | null;
  39828. texture: TextureData | null;
  39829. protected _onClear(): void;
  39830. }
  39831. /**
  39832. * @internal
  39833. * @private
  39834. */
  39835. export class BoundingBoxDisplayData extends DisplayData {
  39836. static toString(): string;
  39837. boundingBox: BoundingBoxData | null;
  39838. protected _onClear(): void;
  39839. }
  39840. /**
  39841. * @internal
  39842. * @private
  39843. */
  39844. export class WeightData extends BaseObject {
  39845. static toString(): string;
  39846. count: number;
  39847. offset: number;
  39848. readonly bones: Array<BoneData>;
  39849. protected _onClear(): void;
  39850. addBone(value: BoneData): void;
  39851. }
  39852. /**
  39853. * @internal
  39854. * @private
  39855. */
  39856. export class GlueData extends BaseObject {
  39857. static toString(): string;
  39858. readonly weights: Array<number>;
  39859. readonly meshes: Array<MeshDisplayData | null>;
  39860. protected _onClear(): void;
  39861. addMesh(value: MeshDisplayData | null): void;
  39862. }
  39863. /**
  39864. * - The base export class of bounding box data.
  39865. * @see dragonBones.RectangleData
  39866. * @see dragonBones.EllipseData
  39867. * @see dragonBones.PolygonData
  39868. * @version DragonBones 5.0
  39869. * @language en_US
  39870. */
  39871. /**
  39872. * - 边界框数据基类。
  39873. * @see dragonBones.RectangleData
  39874. * @see dragonBones.EllipseData
  39875. * @see dragonBones.PolygonData
  39876. * @version DragonBones 5.0
  39877. * @language zh_CN
  39878. */
  39879. export abstract class BoundingBoxData extends BaseObject {
  39880. /**
  39881. * - The bounding box type.
  39882. * @version DragonBones 5.0
  39883. * @language en_US
  39884. */
  39885. /**
  39886. * - 边界框类型。
  39887. * @version DragonBones 5.0
  39888. * @language zh_CN
  39889. */
  39890. type: BoundingBoxType;
  39891. /**
  39892. * @private
  39893. */
  39894. color: number;
  39895. /**
  39896. * @private
  39897. */
  39898. width: number;
  39899. /**
  39900. * @private
  39901. */
  39902. height: number;
  39903. /**
  39904. * @private
  39905. */
  39906. protected _onClear(): void;
  39907. /**
  39908. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  39909. * @version DragonBones 5.0
  39910. * @language en_US
  39911. */
  39912. /**
  39913. * - 检查边界框是否包含特定点。(本地坐标系)
  39914. * @version DragonBones 5.0
  39915. * @language zh_CN
  39916. */
  39917. abstract containsPoint(pX: number, pY: number): boolean;
  39918. /**
  39919. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  39920. * @version DragonBones 5.0
  39921. * @language en_US
  39922. */
  39923. /**
  39924. * - 检查边界框是否与特定线段相交。(本地坐标系)
  39925. * @version DragonBones 5.0
  39926. * @language zh_CN
  39927. */
  39928. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  39929. x: number;
  39930. y: number;
  39931. } | null, intersectionPointB: {
  39932. x: number;
  39933. y: number;
  39934. } | null, normalRadians: {
  39935. x: number;
  39936. y: number;
  39937. } | null): number;
  39938. }
  39939. /**
  39940. * - The rectangle bounding box data.
  39941. * @version DragonBones 5.1
  39942. * @language en_US
  39943. */
  39944. /**
  39945. * - 矩形边界框数据。
  39946. * @version DragonBones 5.1
  39947. * @language zh_CN
  39948. */
  39949. export class RectangleBoundingBoxData extends BoundingBoxData {
  39950. static toString(): string;
  39951. /**
  39952. * @private
  39953. */
  39954. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  39955. x: number;
  39956. y: number;
  39957. } | null, intersectionPointB?: {
  39958. x: number;
  39959. y: number;
  39960. } | null, normalRadians?: {
  39961. x: number;
  39962. y: number;
  39963. } | null): number;
  39964. /**
  39965. * @inheritDoc
  39966. * @private
  39967. */
  39968. protected _onClear(): void;
  39969. /**
  39970. * @inheritDoc
  39971. */
  39972. containsPoint(pX: number, pY: number): boolean;
  39973. /**
  39974. * @inheritDoc
  39975. */
  39976. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  39977. x: number;
  39978. y: number;
  39979. } | null, intersectionPointB?: {
  39980. x: number;
  39981. y: number;
  39982. } | null, normalRadians?: {
  39983. x: number;
  39984. y: number;
  39985. } | null): number;
  39986. }
  39987. /**
  39988. * - The ellipse bounding box data.
  39989. * @version DragonBones 5.1
  39990. * @language en_US
  39991. */
  39992. /**
  39993. * - 椭圆边界框数据。
  39994. * @version DragonBones 5.1
  39995. * @language zh_CN
  39996. */
  39997. export class EllipseBoundingBoxData extends BoundingBoxData {
  39998. static toString(): string;
  39999. /**
  40000. * @private
  40001. */
  40002. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  40003. x: number;
  40004. y: number;
  40005. } | null, intersectionPointB?: {
  40006. x: number;
  40007. y: number;
  40008. } | null, normalRadians?: {
  40009. x: number;
  40010. y: number;
  40011. } | null): number;
  40012. /**
  40013. * @inheritDoc
  40014. * @private
  40015. */
  40016. protected _onClear(): void;
  40017. /**
  40018. * @inheritDoc
  40019. */
  40020. containsPoint(pX: number, pY: number): boolean;
  40021. /**
  40022. * @inheritDoc
  40023. */
  40024. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  40025. x: number;
  40026. y: number;
  40027. } | null, intersectionPointB?: {
  40028. x: number;
  40029. y: number;
  40030. } | null, normalRadians?: {
  40031. x: number;
  40032. y: number;
  40033. } | null): number;
  40034. }
  40035. /**
  40036. * - The polygon bounding box data.
  40037. * @version DragonBones 5.1
  40038. * @language en_US
  40039. */
  40040. /**
  40041. * - 多边形边界框数据。
  40042. * @version DragonBones 5.1
  40043. * @language zh_CN
  40044. */
  40045. export class PolygonBoundingBoxData extends BoundingBoxData {
  40046. static toString(): string;
  40047. /**
  40048. * @private
  40049. */
  40050. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  40051. x: number;
  40052. y: number;
  40053. } | null, intersectionPointB?: {
  40054. x: number;
  40055. y: number;
  40056. } | null, normalRadians?: {
  40057. x: number;
  40058. y: number;
  40059. } | null): number;
  40060. /**
  40061. * @private
  40062. */
  40063. x: number;
  40064. /**
  40065. * @private
  40066. */
  40067. y: number;
  40068. /**
  40069. * - The polygon vertices.
  40070. * @version DragonBones 5.1
  40071. * @language en_US
  40072. */
  40073. /**
  40074. * - 多边形顶点。
  40075. * @version DragonBones 5.1
  40076. * @language zh_CN
  40077. */
  40078. readonly vertices: Array<number>;
  40079. /**
  40080. * @private
  40081. */
  40082. weight: WeightData | null;
  40083. /**
  40084. * @inheritDoc
  40085. * @private
  40086. */
  40087. protected _onClear(): void;
  40088. /**
  40089. * @inheritDoc
  40090. */
  40091. containsPoint(pX: number, pY: number): boolean;
  40092. /**
  40093. * @inheritDoc
  40094. */
  40095. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  40096. x: number;
  40097. y: number;
  40098. } | null, intersectionPointB?: {
  40099. x: number;
  40100. y: number;
  40101. } | null, normalRadians?: {
  40102. x: number;
  40103. y: number;
  40104. } | null): number;
  40105. }
  40106. /**
  40107. * - The animation data.
  40108. * @version DragonBones 3.0
  40109. * @language en_US
  40110. */
  40111. /**
  40112. * - 动画数据。
  40113. * @version DragonBones 3.0
  40114. * @language zh_CN
  40115. */
  40116. export class AnimationData extends BaseObject {
  40117. static toString(): string;
  40118. /**
  40119. * - FrameIntArray.
  40120. * @internal
  40121. * @private
  40122. */
  40123. frameIntOffset: number;
  40124. /**
  40125. * - FrameFloatArray.
  40126. * @internal
  40127. * @private
  40128. */
  40129. frameFloatOffset: number;
  40130. /**
  40131. * - FrameArray.
  40132. * @internal
  40133. * @private
  40134. */
  40135. frameOffset: number;
  40136. /**
  40137. * - The frame count of the animation.
  40138. * @version DragonBones 3.0
  40139. * @language en_US
  40140. */
  40141. /**
  40142. * - 动画的帧数。
  40143. * @version DragonBones 3.0
  40144. * @language zh_CN
  40145. */
  40146. frameCount: number;
  40147. /**
  40148. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  40149. * @version DragonBones 3.0
  40150. * @language en_US
  40151. */
  40152. /**
  40153. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  40154. * @version DragonBones 3.0
  40155. * @language zh_CN
  40156. */
  40157. playTimes: number;
  40158. /**
  40159. * - The duration of the animation. (In seconds)
  40160. * @version DragonBones 3.0
  40161. * @language en_US
  40162. */
  40163. /**
  40164. * - 动画的持续时间。 (以秒为单位)
  40165. * @version DragonBones 3.0
  40166. * @language zh_CN
  40167. */
  40168. duration: number;
  40169. /**
  40170. * @private
  40171. */
  40172. scale: number;
  40173. /**
  40174. * - The fade in time of the animation. (In seconds)
  40175. * @version DragonBones 3.0
  40176. * @language en_US
  40177. */
  40178. /**
  40179. * - 动画的淡入时间。 (以秒为单位)
  40180. * @version DragonBones 3.0
  40181. * @language zh_CN
  40182. */
  40183. fadeInTime: number;
  40184. /**
  40185. * @private
  40186. */
  40187. cacheFrameRate: number;
  40188. /**
  40189. * - The animation name.
  40190. * @version DragonBones 3.0
  40191. * @language en_US
  40192. */
  40193. /**
  40194. * - 动画名称。
  40195. * @version DragonBones 3.0
  40196. * @language zh_CN
  40197. */
  40198. name: string;
  40199. /**
  40200. * @private
  40201. */
  40202. readonly cachedFrames: Array<boolean>;
  40203. /**
  40204. * @private
  40205. */
  40206. readonly boneTimelines: Map<Array<TimelineData>>;
  40207. /**
  40208. * @private
  40209. */
  40210. readonly surfaceTimelines: Map<Array<TimelineData>>;
  40211. /**
  40212. * @private
  40213. */
  40214. readonly slotTimelines: Map<Array<TimelineData>>;
  40215. /**
  40216. * @private
  40217. */
  40218. readonly constraintTimelines: Map<Array<TimelineData>>;
  40219. /**
  40220. * @private
  40221. */
  40222. readonly animationTimelines: Map<Array<TimelineData>>;
  40223. /**
  40224. * @private
  40225. */
  40226. readonly boneCachedFrameIndices: Map<Array<number>>;
  40227. /**
  40228. * @private
  40229. */
  40230. readonly slotCachedFrameIndices: Map<Array<number>>;
  40231. /**
  40232. * @private
  40233. */
  40234. actionTimeline: TimelineData | null;
  40235. /**
  40236. * @private
  40237. */
  40238. zOrderTimeline: TimelineData | null;
  40239. /**
  40240. * @private
  40241. */
  40242. parent: ArmatureData;
  40243. /**
  40244. * @inheritDoc
  40245. */
  40246. protected _onClear(): void;
  40247. /**
  40248. * @internal
  40249. * @private
  40250. */
  40251. cacheFrames(frameRate: number): void;
  40252. /**
  40253. * @private
  40254. */
  40255. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  40256. /**
  40257. * @private
  40258. */
  40259. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  40260. /**
  40261. * @private
  40262. */
  40263. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  40264. /**
  40265. * @private
  40266. */
  40267. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  40268. /**
  40269. * @private
  40270. */
  40271. addAnimationTimeline(name: string, timeline: TimelineData): void;
  40272. /**
  40273. * @private
  40274. */
  40275. getBoneTimelines(name: string): Array<TimelineData> | null;
  40276. /**
  40277. * @private
  40278. */
  40279. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  40280. /**
  40281. * @private
  40282. */
  40283. getSlotTimelines(name: string): Array<TimelineData> | null;
  40284. /**
  40285. * @private
  40286. */
  40287. getConstraintTimelines(name: string): Array<TimelineData> | null;
  40288. /**
  40289. * @private
  40290. */
  40291. getAnimationTimelines(name: string): Array<TimelineData> | null;
  40292. /**
  40293. * @private
  40294. */
  40295. getBoneCachedFrameIndices(name: string): Array<number> | null;
  40296. /**
  40297. * @private
  40298. */
  40299. getSlotCachedFrameIndices(name: string): Array<number> | null;
  40300. }
  40301. /**
  40302. * @internal
  40303. * @private
  40304. */
  40305. export class TimelineData extends BaseObject {
  40306. static toString(): string;
  40307. type: TimelineType;
  40308. offset: number;
  40309. frameIndicesOffset: number;
  40310. protected _onClear(): void;
  40311. }
  40312. /**
  40313. * - The animation config is used to describe all the information needed to play an animation state.
  40314. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  40315. * @see dragonBones.AnimationState
  40316. * @beta
  40317. * @version DragonBones 5.0
  40318. * @language en_US
  40319. */
  40320. /**
  40321. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  40322. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  40323. * @see dragonBones.AnimationState
  40324. * @beta
  40325. * @version DragonBones 5.0
  40326. * @language zh_CN
  40327. */
  40328. export class AnimationConfig extends BaseObject {
  40329. static toString(): string;
  40330. /**
  40331. * @private
  40332. */
  40333. pauseFadeOut: boolean;
  40334. /**
  40335. * - Fade out the pattern of other animation states when the animation state is fade in.
  40336. * This property is typically used to specify the substitution of multiple animation states blend.
  40337. * @default dragonBones.AnimationFadeOutMode.All
  40338. * @version DragonBones 5.0
  40339. * @language en_US
  40340. */
  40341. /**
  40342. * - 淡入动画状态时淡出其他动画状态的模式。
  40343. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  40344. * @default dragonBones.AnimationFadeOutMode.All
  40345. * @version DragonBones 5.0
  40346. * @language zh_CN
  40347. */
  40348. fadeOutMode: __private.__node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode;
  40349. /**
  40350. * @private
  40351. */
  40352. fadeOutTweenType: TweenType;
  40353. /**
  40354. * @private
  40355. */
  40356. fadeOutTime: number;
  40357. /**
  40358. * @private
  40359. */
  40360. pauseFadeIn: boolean;
  40361. /**
  40362. * @private
  40363. */
  40364. actionEnabled: boolean;
  40365. /**
  40366. * @private
  40367. */
  40368. additiveBlending: boolean;
  40369. /**
  40370. * - Whether the animation state has control over the display property of the slots.
  40371. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  40372. * especially if other animation state are controlling the display properties of the slots.
  40373. * @default true
  40374. * @version DragonBones 5.0
  40375. * @language en_US
  40376. */
  40377. /**
  40378. * - 动画状态是否对插槽的显示对象属性有控制权。
  40379. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  40380. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  40381. * @default true
  40382. * @version DragonBones 5.0
  40383. * @language zh_CN
  40384. */
  40385. displayControl: boolean;
  40386. /**
  40387. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  40388. * This property should usually be set to false when blend multiple animation states.
  40389. * @default true
  40390. * @version DragonBones 5.1
  40391. * @language en_US
  40392. */
  40393. /**
  40394. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  40395. * 通常在混合多个动画状态时应该将该属性设置为 false。
  40396. * @default true
  40397. * @version DragonBones 5.1
  40398. * @language zh_CN
  40399. */
  40400. resetToPose: boolean;
  40401. /**
  40402. * @private
  40403. */
  40404. fadeInTweenType: TweenType;
  40405. /**
  40406. * - The play times. [0: Loop play, [1~N]: Play N times]
  40407. * @version DragonBones 3.0
  40408. * @language en_US
  40409. */
  40410. /**
  40411. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  40412. * @version DragonBones 3.0
  40413. * @language zh_CN
  40414. */
  40415. playTimes: number;
  40416. /**
  40417. * - The blend layer.
  40418. * High layer animation state will get the blend weight first.
  40419. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  40420. * @readonly
  40421. * @version DragonBones 5.0
  40422. * @language en_US
  40423. */
  40424. /**
  40425. * - 混合图层。
  40426. * 图层高的动画状态会优先获取混合权重。
  40427. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  40428. * @readonly
  40429. * @version DragonBones 5.0
  40430. * @language zh_CN
  40431. */
  40432. layer: number;
  40433. /**
  40434. * - The start time of play. (In seconds)
  40435. * @default 0.0
  40436. * @version DragonBones 5.0
  40437. * @language en_US
  40438. */
  40439. /**
  40440. * - 播放的开始时间。 (以秒为单位)
  40441. * @default 0.0
  40442. * @version DragonBones 5.0
  40443. * @language zh_CN
  40444. */
  40445. position: number;
  40446. /**
  40447. * - The duration of play.
  40448. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  40449. * @default -1.0
  40450. * @version DragonBones 5.0
  40451. * @language en_US
  40452. */
  40453. /**
  40454. * - 播放的持续时间。
  40455. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  40456. * @default -1.0
  40457. * @version DragonBones 5.0
  40458. * @language zh_CN
  40459. */
  40460. duration: number;
  40461. /**
  40462. * - The play speed.
  40463. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  40464. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  40465. * @default 1.0
  40466. * @version DragonBones 3.0
  40467. * @language en_US
  40468. */
  40469. /**
  40470. * - 播放速度。
  40471. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  40472. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  40473. * @default 1.0
  40474. * @version DragonBones 3.0
  40475. * @language zh_CN
  40476. */
  40477. timeScale: number;
  40478. /**
  40479. * - The blend weight.
  40480. * @default 1.0
  40481. * @version DragonBones 5.0
  40482. * @language en_US
  40483. */
  40484. /**
  40485. * - 混合权重。
  40486. * @default 1.0
  40487. * @version DragonBones 5.0
  40488. * @language zh_CN
  40489. */
  40490. weight: number;
  40491. /**
  40492. * - The fade in time.
  40493. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  40494. * @default -1.0
  40495. * @version DragonBones 5.0
  40496. * @language en_US
  40497. */
  40498. /**
  40499. * - 淡入时间。
  40500. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  40501. * @default -1.0
  40502. * @version DragonBones 5.0
  40503. * @language zh_CN
  40504. */
  40505. fadeInTime: number;
  40506. /**
  40507. * - The auto fade out time when the animation state play completed.
  40508. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  40509. * @default -1.0
  40510. * @version DragonBones 5.0
  40511. * @language en_US
  40512. */
  40513. /**
  40514. * - 动画状态播放完成后的自动淡出时间。
  40515. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  40516. * @default -1.0
  40517. * @version DragonBones 5.0
  40518. * @language zh_CN
  40519. */
  40520. autoFadeOutTime: number;
  40521. /**
  40522. * - The name of the animation state. (Can be different from the name of the animation data)
  40523. * @version DragonBones 5.0
  40524. * @language en_US
  40525. */
  40526. /**
  40527. * - 动画状态名称。 (可以不同于动画数据)
  40528. * @version DragonBones 5.0
  40529. * @language zh_CN
  40530. */
  40531. name: string;
  40532. /**
  40533. * - The animation data name.
  40534. * @version DragonBones 5.0
  40535. * @language en_US
  40536. */
  40537. /**
  40538. * - 动画数据名称。
  40539. * @version DragonBones 5.0
  40540. * @language zh_CN
  40541. */
  40542. animation: string;
  40543. /**
  40544. * - The blend group name of the animation state.
  40545. * This property is typically used to specify the substitution of multiple animation states blend.
  40546. * @readonly
  40547. * @version DragonBones 5.0
  40548. * @language en_US
  40549. */
  40550. /**
  40551. * - 混合组名称。
  40552. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  40553. * @readonly
  40554. * @version DragonBones 5.0
  40555. * @language zh_CN
  40556. */
  40557. group: string;
  40558. /**
  40559. * @private
  40560. */
  40561. readonly boneMask: Array<string>;
  40562. /**
  40563. * @private
  40564. */
  40565. protected _onClear(): void;
  40566. /**
  40567. * @private
  40568. */
  40569. clear(): void;
  40570. /**
  40571. * @private
  40572. */
  40573. copyFrom(value: AnimationConfig): void;
  40574. /**
  40575. * @private
  40576. */
  40577. containsBoneMask(name: string): boolean;
  40578. /**
  40579. * @private
  40580. */
  40581. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  40582. /**
  40583. * @private
  40584. */
  40585. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  40586. }
  40587. /**
  40588. * - The texture atlas data.
  40589. * @version DragonBones 3.0
  40590. * @language en_US
  40591. */
  40592. /**
  40593. * - 贴图集数据。
  40594. * @version DragonBones 3.0
  40595. * @language zh_CN
  40596. */
  40597. export abstract class TextureAtlasData extends BaseObject {
  40598. /**
  40599. * @private
  40600. */
  40601. autoSearch: boolean;
  40602. /**
  40603. * @private
  40604. */
  40605. width: number;
  40606. /**
  40607. * @private
  40608. */
  40609. height: number;
  40610. /**
  40611. * @private
  40612. */
  40613. scale: number;
  40614. /**
  40615. * - The texture atlas name.
  40616. * @version DragonBones 3.0
  40617. * @language en_US
  40618. */
  40619. /**
  40620. * - 贴图集名称。
  40621. * @version DragonBones 3.0
  40622. * @language zh_CN
  40623. */
  40624. name: string;
  40625. /**
  40626. * - The image path of the texture atlas.
  40627. * @version DragonBones 3.0
  40628. * @language en_US
  40629. */
  40630. /**
  40631. * - 贴图集图片路径。
  40632. * @version DragonBones 3.0
  40633. * @language zh_CN
  40634. */
  40635. imagePath: string;
  40636. /**
  40637. * @private
  40638. */
  40639. readonly textures: Map<TextureData>;
  40640. /**
  40641. * @inheritDoc
  40642. */
  40643. protected _onClear(): void;
  40644. /**
  40645. * @private
  40646. */
  40647. copyFrom(value: TextureAtlasData): void;
  40648. /**
  40649. * @internal
  40650. * @private
  40651. */
  40652. abstract createTexture(): TextureData;
  40653. /**
  40654. * @internal
  40655. * @private
  40656. */
  40657. addTexture(value: TextureData): void;
  40658. /**
  40659. * @private
  40660. */
  40661. getTexture(name: string): TextureData | null;
  40662. }
  40663. /**
  40664. * @internal
  40665. * @private
  40666. */
  40667. export abstract class TextureData extends BaseObject {
  40668. static createRectangle(): Rectangle;
  40669. rotated: boolean;
  40670. name: string;
  40671. readonly region: Rectangle;
  40672. parent: TextureAtlasData;
  40673. frame: Rectangle | null;
  40674. protected _onClear(): void;
  40675. copyFrom(value: TextureData): void;
  40676. }
  40677. /**
  40678. * - The armature proxy interface, the docking engine needs to implement it concretely.
  40679. * @see dragonBones.Armature
  40680. * @version DragonBones 5.0
  40681. * @language en_US
  40682. */
  40683. /**
  40684. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  40685. * @see dragonBones.Armature
  40686. * @version DragonBones 5.0
  40687. * @language zh_CN
  40688. */
  40689. export interface IArmatureProxy extends IEventDispatcher {
  40690. /**
  40691. * @internal
  40692. * @private
  40693. */
  40694. dbInit(armature: Armature): void;
  40695. /**
  40696. * @internal
  40697. * @private
  40698. */
  40699. dbClear(): void;
  40700. /**
  40701. * @internal
  40702. * @private
  40703. */
  40704. dbUpdate(): void;
  40705. /**
  40706. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  40707. * @example
  40708. * <pre>
  40709. * removeChild(armatureDisplay);
  40710. * armatureDisplay.dispose();
  40711. * </pre>
  40712. * @version DragonBones 4.5
  40713. * @language en_US
  40714. */
  40715. /**
  40716. * - 释放该实例和骨架。 (骨架会回收到对象池)
  40717. * @example
  40718. * <pre>
  40719. * removeChild(armatureDisplay);
  40720. * armatureDisplay.dispose();
  40721. * </pre>
  40722. * @version DragonBones 4.5
  40723. * @language zh_CN
  40724. */
  40725. dispose(disposeProxy: boolean): void;
  40726. /**
  40727. * - The armature.
  40728. * @version DragonBones 4.5
  40729. * @language en_US
  40730. */
  40731. /**
  40732. * - 骨架。
  40733. * @version DragonBones 4.5
  40734. * @language zh_CN
  40735. */
  40736. readonly armature: Armature;
  40737. /**
  40738. * - The animation player.
  40739. * @version DragonBones 3.0
  40740. * @language en_US
  40741. */
  40742. /**
  40743. * - 动画播放器。
  40744. * @version DragonBones 3.0
  40745. * @language zh_CN
  40746. */
  40747. readonly animation: Animation;
  40748. }
  40749. /**
  40750. * - Armature is the core of the skeleton animation system.
  40751. * @see dragonBones.ArmatureData
  40752. * @see dragonBones.Bone
  40753. * @see dragonBones.Slot
  40754. * @see dragonBones.Animation
  40755. * @version DragonBones 3.0
  40756. * @language en_US
  40757. */
  40758. /**
  40759. * - 骨架是骨骼动画系统的核心。
  40760. * @see dragonBones.ArmatureData
  40761. * @see dragonBones.Bone
  40762. * @see dragonBones.Slot
  40763. * @see dragonBones.Animation
  40764. * @version DragonBones 3.0
  40765. * @language zh_CN
  40766. */
  40767. export class Armature extends BaseObject implements IAnimatable {
  40768. static toString(): string;
  40769. /**
  40770. * - Whether to inherit the animation control of the parent armature.
  40771. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  40772. * @default true
  40773. * @version DragonBones 4.5
  40774. * @language en_US
  40775. */
  40776. /**
  40777. * - 是否继承父骨架的动画控制。
  40778. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  40779. * @default true
  40780. * @version DragonBones 4.5
  40781. * @language zh_CN
  40782. */
  40783. inheritAnimation: boolean;
  40784. /**
  40785. * @private
  40786. */
  40787. userData: any;
  40788. /**
  40789. * @internal
  40790. * @private
  40791. */
  40792. _cacheFrameIndex: number;
  40793. /* private */
  40794. readonly _bones;
  40795. /* private */
  40796. public readonly _slots: Array<Slot>;
  40797. /**
  40798. * @internal
  40799. * @private
  40800. */
  40801. readonly _glueSlots: Array<Slot>;
  40802. /**
  40803. * @internal
  40804. * @private
  40805. */
  40806. readonly _constraints: Array<Constraint>;
  40807. /**
  40808. * @internal
  40809. * @private
  40810. */
  40811. _armatureData: ArmatureData;
  40812. /* private */
  40813. _animation;
  40814. public _display: DisplayData;
  40815. /* private */
  40816. _skinData: SkinData;
  40817. /* private */
  40818. _isChildArmature: boolean;
  40819. /**
  40820. * @internal
  40821. * @private
  40822. */
  40823. _replaceTextureAtlasData: TextureAtlasData | null;
  40824. /**
  40825. * @internal
  40826. * @private
  40827. */
  40828. _dragonBones: DragonBones;
  40829. /**
  40830. * @internal
  40831. * @private
  40832. */
  40833. _parent: Slot | null;
  40834. /**
  40835. * @private
  40836. */
  40837. protected _onClear(): void;
  40838. /**
  40839. * @internal
  40840. * @private
  40841. */
  40842. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  40843. /**
  40844. * @internal
  40845. * @private
  40846. */
  40847. _addBoneToBoneList(value: Bone): void;
  40848. /**
  40849. * @internal
  40850. * @private
  40851. */
  40852. _removeBoneFromBoneList(value: Bone): void;
  40853. /**
  40854. * @internal
  40855. * @private
  40856. */
  40857. _addSlotToSlotList(value: Slot): void;
  40858. /**
  40859. * @internal
  40860. * @private
  40861. */
  40862. _removeSlotFromSlotList(value: Slot): void;
  40863. /**
  40864. * @internal
  40865. * @private
  40866. */
  40867. _bufferAction(action: ActionData, append: boolean): void;
  40868. /**
  40869. * - Dispose the armature. (Return to the object pool)
  40870. * @example
  40871. * <pre>
  40872. * removeChild(armature.display);
  40873. * armature.dispose();
  40874. * </pre>
  40875. * @version DragonBones 3.0
  40876. * @language en_US
  40877. */
  40878. /**
  40879. * - 释放骨架。 (回收到对象池)
  40880. * @example
  40881. * <pre>
  40882. * removeChild(armature.display);
  40883. * armature.dispose();
  40884. * </pre>
  40885. * @version DragonBones 3.0
  40886. * @language zh_CN
  40887. */
  40888. dispose(): void;
  40889. /**
  40890. * @internal
  40891. * @private
  40892. */
  40893. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  40894. /**
  40895. * @inheritDoc
  40896. */
  40897. advanceTime(passedTime: number): void;
  40898. /**
  40899. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  40900. * @param boneName - The bone name. (If not set, all bones will be update)
  40901. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  40902. * @see dragonBones.Bone#invalidUpdate()
  40903. * @see dragonBones.Slot#invalidUpdate()
  40904. * @version DragonBones 3.0
  40905. * @language en_US
  40906. */
  40907. /**
  40908. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  40909. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  40910. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  40911. * @see dragonBones.Bone#invalidUpdate()
  40912. * @see dragonBones.Slot#invalidUpdate()
  40913. * @version DragonBones 3.0
  40914. * @language zh_CN
  40915. */
  40916. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  40917. /**
  40918. * - Check whether a specific point is inside a custom bounding box in a slot.
  40919. * The coordinate system of the point is the inner coordinate system of the armature.
  40920. * Custom bounding boxes need to be customized in Dragonbones Pro.
  40921. * @param x - The horizontal coordinate of the point.
  40922. * @param y - The vertical coordinate of the point.
  40923. * @version DragonBones 5.0
  40924. * @language en_US
  40925. */
  40926. /**
  40927. * - 检查特定点是否在某个插槽的自定义边界框内。
  40928. * 点的坐标系为骨架内坐标系。
  40929. * 自定义边界框需要在 DragonBones Pro 中自定义。
  40930. * @param x - 点的水平坐标。
  40931. * @param y - 点的垂直坐标。
  40932. * @version DragonBones 5.0
  40933. * @language zh_CN
  40934. */
  40935. containsPoint(x: number, y: number): Slot | null;
  40936. /**
  40937. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  40938. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  40939. * Custom bounding boxes need to be customized in Dragonbones Pro.
  40940. * @param xA - The horizontal coordinate of the beginning of the segment.
  40941. * @param yA - The vertical coordinate of the beginning of the segment.
  40942. * @param xB - The horizontal coordinate of the end point of the segment.
  40943. * @param yB - The vertical coordinate of the end point of the segment.
  40944. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  40945. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  40946. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  40947. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  40948. * @version DragonBones 5.0
  40949. * @language en_US
  40950. */
  40951. /**
  40952. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  40953. * 线段和交点的坐标系均为骨架内坐标系。
  40954. * 自定义边界框需要在 DragonBones Pro 中自定义。
  40955. * @param xA - 线段起点的水平坐标。
  40956. * @param yA - 线段起点的垂直坐标。
  40957. * @param xB - 线段终点的水平坐标。
  40958. * @param yB - 线段终点的垂直坐标。
  40959. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  40960. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  40961. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  40962. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  40963. * @version DragonBones 5.0
  40964. * @language zh_CN
  40965. */
  40966. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  40967. x: number;
  40968. y: number;
  40969. } | null, intersectionPointB?: {
  40970. x: number;
  40971. y: number;
  40972. } | null, normalRadians?: {
  40973. x: number;
  40974. y: number;
  40975. } | null): Slot | null;
  40976. /**
  40977. * - Get a specific bone.
  40978. * @param name - The bone name.
  40979. * @see dragonBones.Bone
  40980. * @version DragonBones 3.0
  40981. * @language en_US
  40982. */
  40983. /**
  40984. * - 获取特定的骨骼。
  40985. * @param name - 骨骼名称。
  40986. * @see dragonBones.Bone
  40987. * @version DragonBones 3.0
  40988. * @language zh_CN
  40989. */
  40990. getBone(name: string): Bone | null;
  40991. /**
  40992. * - Get a specific bone by the display.
  40993. * @param display - The display object.
  40994. * @see dragonBones.Bone
  40995. * @version DragonBones 3.0
  40996. * @language en_US
  40997. */
  40998. /**
  40999. * - 通过显示对象获取特定的骨骼。
  41000. * @param display - 显示对象。
  41001. * @see dragonBones.Bone
  41002. * @version DragonBones 3.0
  41003. * @language zh_CN
  41004. */
  41005. getBoneByDisplay(display: any): Bone | null;
  41006. /**
  41007. * - Get a specific slot.
  41008. * @param name - The slot name.
  41009. * @see dragonBones.Slot
  41010. * @version DragonBones 3.0
  41011. * @language en_US
  41012. */
  41013. /**
  41014. * - 获取特定的插槽。
  41015. * @param name - 插槽名称。
  41016. * @see dragonBones.Slot
  41017. * @version DragonBones 3.0
  41018. * @language zh_CN
  41019. */
  41020. getSlot(name: string): Slot | null;
  41021. /**
  41022. * - Get a specific slot by the display.
  41023. * @param display - The display object.
  41024. * @see dragonBones.Slot
  41025. * @version DragonBones 3.0
  41026. * @language en_US
  41027. */
  41028. /**
  41029. * - 通过显示对象获取特定的插槽。
  41030. * @param display - 显示对象。
  41031. * @see dragonBones.Slot
  41032. * @version DragonBones 3.0
  41033. * @language zh_CN
  41034. */
  41035. getSlotByDisplay(display: any): Slot | null;
  41036. /**
  41037. * @deprecated
  41038. */
  41039. addBone(value: Bone, parentName: string): void;
  41040. /**
  41041. * @deprecated
  41042. */
  41043. addSlot(value: Slot, parentName: string): void;
  41044. /**
  41045. * @private
  41046. */
  41047. addConstraint(value: Constraint): void;
  41048. /**
  41049. * @deprecated
  41050. */
  41051. removeBone(value: Bone): void;
  41052. /**
  41053. * @deprecated
  41054. */
  41055. removeSlot(value: Slot): void;
  41056. /**
  41057. * - Get all bones.
  41058. * @see dragonBones.Bone
  41059. * @version DragonBones 3.0
  41060. * @language en_US
  41061. */
  41062. /**
  41063. * - 获取所有的骨骼。
  41064. * @see dragonBones.Bone
  41065. * @version DragonBones 3.0
  41066. * @language zh_CN
  41067. */
  41068. getBones(): Array<Bone>;
  41069. /**
  41070. * - Get all slots.
  41071. * @see dragonBones.Slot
  41072. * @version DragonBones 3.0
  41073. * @language en_US
  41074. */
  41075. /**
  41076. * - 获取所有的插槽。
  41077. * @see dragonBones.Slot
  41078. * @version DragonBones 3.0
  41079. * @language zh_CN
  41080. */
  41081. getSlots(): Array<Slot>;
  41082. /**
  41083. * - Whether to flip the armature horizontally.
  41084. * @version DragonBones 5.5
  41085. * @language en_US
  41086. */
  41087. /**
  41088. * - 是否将骨架水平翻转。
  41089. * @version DragonBones 5.5
  41090. * @language zh_CN
  41091. */
  41092. flipX: boolean;
  41093. /**
  41094. * - Whether to flip the armature vertically.
  41095. * @version DragonBones 5.5
  41096. * @language en_US
  41097. */
  41098. /**
  41099. * - 是否将骨架垂直翻转。
  41100. * @version DragonBones 5.5
  41101. * @language zh_CN
  41102. */
  41103. flipY: boolean;
  41104. /**
  41105. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  41106. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  41107. * The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate.
  41108. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  41109. * @example
  41110. * <pre>
  41111. * armature.cacheFrameRate = 24;
  41112. * </pre>
  41113. * @see dragonBones.DragonBonesData#frameRate
  41114. * @see dragonBones.ArmatureData#frameRate
  41115. * @version DragonBones 4.5
  41116. * @language en_US
  41117. */
  41118. /**
  41119. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  41120. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  41121. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  41122. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  41123. * @example
  41124. * <pre>
  41125. * armature.cacheFrameRate = 24;
  41126. * </pre>
  41127. * @see dragonBones.DragonBonesData#frameRate
  41128. * @see dragonBones.ArmatureData#frameRate
  41129. * @version DragonBones 4.5
  41130. * @language zh_CN
  41131. */
  41132. cacheFrameRate: number;
  41133. /**
  41134. * - The armature name.
  41135. * @version DragonBones 3.0
  41136. * @language en_US
  41137. */
  41138. /**
  41139. * - 骨架名称。
  41140. * @version DragonBones 3.0
  41141. * @language zh_CN
  41142. */
  41143. readonly name: string;
  41144. /**
  41145. * - The armature data.
  41146. * @see dragonBones.ArmatureData
  41147. * @version DragonBones 4.5
  41148. * @language en_US
  41149. */
  41150. /**
  41151. * - 骨架数据。
  41152. * @see dragonBones.ArmatureData
  41153. * @version DragonBones 4.5
  41154. * @language zh_CN
  41155. */
  41156. readonly armatureData: ArmatureData;
  41157. /**
  41158. * - The animation player.
  41159. * @see dragonBones.Animation
  41160. * @version DragonBones 3.0
  41161. * @language en_US
  41162. */
  41163. /**
  41164. * - 动画播放器。
  41165. * @see dragonBones.Animation
  41166. * @version DragonBones 3.0
  41167. * @language zh_CN
  41168. */
  41169. readonly animation: Animation;
  41170. /**
  41171. * @pivate
  41172. */
  41173. readonly proxy: IArmatureProxy;
  41174. /**
  41175. * - The EventDispatcher instance of the armature.
  41176. * @version DragonBones 4.5
  41177. * @language en_US
  41178. */
  41179. /**
  41180. * - 该骨架的 EventDispatcher 实例。
  41181. * @version DragonBones 4.5
  41182. * @language zh_CN
  41183. */
  41184. readonly eventDispatcher: IEventDispatcher;
  41185. /**
  41186. * - The display container.
  41187. * The display of the slot is displayed as the parent.
  41188. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  41189. * @version DragonBones 3.0
  41190. * @language en_US
  41191. */
  41192. /**
  41193. * - 显示容器实例。
  41194. * 插槽的显示对象都会以此显示容器为父级。
  41195. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  41196. * @version DragonBones 3.0
  41197. * @language zh_CN
  41198. */
  41199. readonly display: any;
  41200. /**
  41201. * @private
  41202. */
  41203. replacedTexture: any;
  41204. /**
  41205. * @inheritDoc
  41206. */
  41207. clock: WorldClock | null;
  41208. /**
  41209. * - Get the parent slot which the armature belongs to.
  41210. * @see dragonBones.Slot
  41211. * @version DragonBones 4.5
  41212. * @language en_US
  41213. */
  41214. /**
  41215. * - 该骨架所属的父插槽。
  41216. * @see dragonBones.Slot
  41217. * @version DragonBones 4.5
  41218. * @language zh_CN
  41219. */
  41220. readonly parent: Slot | null;
  41221. /**
  41222. * @deprecated
  41223. * @private
  41224. */
  41225. replaceTexture(texture: any): void;
  41226. /**
  41227. * - Deprecated, please refer to {@link #eventDispatcher}.
  41228. * @deprecated
  41229. * @language en_US
  41230. */
  41231. /**
  41232. * - 已废弃,请参考 {@link #eventDispatcher}。
  41233. * @deprecated
  41234. * @language zh_CN
  41235. */
  41236. hasEventListener(type: EventStringType): boolean;
  41237. /**
  41238. * - Deprecated, please refer to {@link #eventDispatcher}.
  41239. * @deprecated
  41240. * @language en_US
  41241. */
  41242. /**
  41243. * - 已废弃,请参考 {@link #eventDispatcher}。
  41244. * @deprecated
  41245. * @language zh_CN
  41246. */
  41247. addEventListener(type: EventStringType, listener: Function, target: any): void;
  41248. /**
  41249. * - Deprecated, please refer to {@link #eventDispatcher}.
  41250. * @deprecated
  41251. * @language en_US
  41252. */
  41253. /**
  41254. * - 已废弃,请参考 {@link #eventDispatcher}。
  41255. * @deprecated
  41256. * @language zh_CN
  41257. */
  41258. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  41259. /**
  41260. * - Deprecated, please refer to {@link #cacheFrameRate}.
  41261. * @deprecated
  41262. * @language en_US
  41263. */
  41264. /**
  41265. * - 已废弃,请参考 {@link #cacheFrameRate}。
  41266. * @deprecated
  41267. * @language zh_CN
  41268. */
  41269. enableAnimationCache(frameRate: number): void;
  41270. /**
  41271. * - Deprecated, please refer to {@link #display}.
  41272. * @deprecated
  41273. * @language en_US
  41274. */
  41275. /**
  41276. * - 已废弃,请参考 {@link #display}。
  41277. * @deprecated
  41278. * @language zh_CN
  41279. */
  41280. getDisplay(): any;
  41281. }
  41282. /**
  41283. * - The base export class of the transform object.
  41284. * @see dragonBones.Transform
  41285. * @version DragonBones 4.5
  41286. * @language en_US
  41287. */
  41288. /**
  41289. * - 变换对象的基类。
  41290. * @see dragonBones.Transform
  41291. * @version DragonBones 4.5
  41292. * @language zh_CN
  41293. */
  41294. export abstract class TransformObject extends BaseObject {
  41295. /**
  41296. * @private
  41297. */
  41298. protected static readonly _helpMatrix: Matrix;
  41299. /**
  41300. * @private
  41301. */
  41302. protected static readonly _helpTransform: Transform;
  41303. /**
  41304. * @private
  41305. */
  41306. protected static readonly _helpPoint: Point;
  41307. /**
  41308. * - A matrix relative to the armature coordinate system.
  41309. * @version DragonBones 3.0
  41310. * @language en_US
  41311. */
  41312. /**
  41313. * - 相对于骨架坐标系的矩阵。
  41314. * @version DragonBones 3.0
  41315. * @language zh_CN
  41316. */
  41317. readonly globalTransformMatrix: Matrix;
  41318. /**
  41319. * - A transform relative to the armature coordinate system.
  41320. * @see #updateGlobalTransform()
  41321. * @version DragonBones 3.0
  41322. * @language en_US
  41323. */
  41324. /**
  41325. * - 相对于骨架坐标系的变换。
  41326. * @see #updateGlobalTransform()
  41327. * @version DragonBones 3.0
  41328. * @language zh_CN
  41329. */
  41330. readonly global: Transform;
  41331. /**
  41332. * - The offset transform relative to the armature or the parent bone coordinate system.
  41333. * @see #dragonBones.Bone#invalidUpdate()
  41334. * @version DragonBones 3.0
  41335. * @language en_US
  41336. */
  41337. /**
  41338. * - 相对于骨架或父骨骼坐标系的偏移变换。
  41339. * @see #dragonBones.Bone#invalidUpdate()
  41340. * @version DragonBones 3.0
  41341. * @language zh_CN
  41342. */
  41343. readonly offset: Transform;
  41344. /**
  41345. * @private
  41346. */
  41347. origin: Transform | null;
  41348. /**
  41349. * @private
  41350. */
  41351. userData: any;
  41352. /**
  41353. * @private
  41354. */
  41355. protected _globalDirty: boolean;
  41356. /**
  41357. * @internal
  41358. * @private
  41359. */
  41360. _armature: Armature;
  41361. /**
  41362. * @internal
  41363. * @private
  41364. */
  41365. _parent: Bone;
  41366. /**
  41367. * @private
  41368. */
  41369. protected _onClear(): void;
  41370. /**
  41371. * @internal
  41372. * @private
  41373. */
  41374. _setArmature(value: Armature | null): void;
  41375. /**
  41376. * @internal
  41377. * @private
  41378. */
  41379. _setParent(value: Bone | null): void;
  41380. /**
  41381. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  41382. * some engines do not rely on these attributes to update rendering, such as Egret.
  41383. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  41384. * @example
  41385. * <pre>
  41386. * bone.updateGlobalTransform();
  41387. * let rotation = bone.global.rotation;
  41388. * </pre>
  41389. * @version DragonBones 3.0
  41390. * @language en_US
  41391. */
  41392. /**
  41393. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  41394. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  41395. * @example
  41396. * <pre>
  41397. * bone.updateGlobalTransform();
  41398. * let rotation = bone.global.rotation;
  41399. * </pre>
  41400. * @version DragonBones 3.0
  41401. * @language zh_CN
  41402. */
  41403. updateGlobalTransform(): void;
  41404. /**
  41405. * - The armature to which it belongs.
  41406. * @version DragonBones 3.0
  41407. * @language en_US
  41408. */
  41409. /**
  41410. * - 所属的骨架。
  41411. * @version DragonBones 3.0
  41412. * @language zh_CN
  41413. */
  41414. readonly armature: Armature;
  41415. /**
  41416. * - The parent bone to which it belongs.
  41417. * @version DragonBones 3.0
  41418. * @language en_US
  41419. */
  41420. /**
  41421. * - 所属的父骨骼。
  41422. * @version DragonBones 3.0
  41423. * @language zh_CN
  41424. */
  41425. readonly parent: Bone;
  41426. }
  41427. /**
  41428. * - Bone is one of the most important logical units in the armature animation system,
  41429. * and is responsible for the realization of translate, rotation, scaling in the animations.
  41430. * A armature can contain multiple bones.
  41431. * @see dragonBones.BoneData
  41432. * @see dragonBones.Armature
  41433. * @see dragonBones.Slot
  41434. * @version DragonBones 3.0
  41435. * @language en_US
  41436. */
  41437. /**
  41438. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  41439. * 一个骨架中可以包含多个骨骼。
  41440. * @see dragonBones.BoneData
  41441. * @see dragonBones.Armature
  41442. * @see dragonBones.Slot
  41443. * @version DragonBones 3.0
  41444. * @language zh_CN
  41445. */
  41446. export class Bone extends TransformObject {
  41447. static toString(): string;
  41448. /**
  41449. * - The offset mode.
  41450. * @see #offset
  41451. * @version DragonBones 5.5
  41452. * @language en_US
  41453. */
  41454. /**
  41455. * - 偏移模式。
  41456. * @see #offset
  41457. * @version DragonBones 5.5
  41458. * @language zh_CN
  41459. */
  41460. offsetMode: OffsetMode;
  41461. /**
  41462. * @internal
  41463. * @private
  41464. */
  41465. readonly animationPose: Transform;
  41466. /**
  41467. * @internal
  41468. * @private
  41469. */
  41470. _transformDirty: boolean;
  41471. /**
  41472. * @internal
  41473. * @private
  41474. */
  41475. _childrenTransformDirty: boolean;
  41476. protected _localDirty: boolean;
  41477. /**
  41478. * @internal
  41479. * @private
  41480. */
  41481. _hasConstraint: boolean;
  41482. protected _cachedFrameIndex: number;
  41483. /**
  41484. * @internal
  41485. * @private
  41486. */
  41487. readonly _blendState: BlendState;
  41488. /**
  41489. * @internal
  41490. * @private
  41491. */
  41492. _boneData: BoneData;
  41493. /**
  41494. * @internal
  41495. * @private
  41496. */
  41497. _cachedFrameIndices: Array<number> | null;
  41498. /**
  41499. * @inheritDoc
  41500. */
  41501. protected _onClear(): void;
  41502. /**
  41503. * @private
  41504. */
  41505. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  41506. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  41507. /**
  41508. * @inheritDoc
  41509. */
  41510. _setArmature(value: Armature | null): void;
  41511. /**
  41512. * @internal
  41513. * @private
  41514. */
  41515. init(boneData: BoneData): void;
  41516. /**
  41517. * @internal
  41518. * @private
  41519. */
  41520. update(cacheFrameIndex: number): void;
  41521. /**
  41522. * @internal
  41523. * @private
  41524. */
  41525. updateByConstraint(): void;
  41526. /**
  41527. * - Forces the bone to update the transform in the next frame.
  41528. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  41529. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  41530. * @example
  41531. * <pre>
  41532. * let bone = armature.getBone("arm");
  41533. * bone.offset.scaleX = 2.0;
  41534. * bone.invalidUpdate();
  41535. * </pre>
  41536. * @version DragonBones 3.0
  41537. * @language en_US
  41538. */
  41539. /**
  41540. * - 强制骨骼在下一帧更新变换。
  41541. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  41542. * @example
  41543. * <pre>
  41544. * let bone = armature.getBone("arm");
  41545. * bone.offset.scaleX = 2.0;
  41546. * bone.invalidUpdate();
  41547. * </pre>
  41548. * @version DragonBones 3.0
  41549. * @language zh_CN
  41550. */
  41551. invalidUpdate(): void;
  41552. /**
  41553. * - Check whether the bone contains a specific bone or slot.
  41554. * @see dragonBones.Bone
  41555. * @see dragonBones.Slot
  41556. * @version DragonBones 3.0
  41557. * @language en_US
  41558. */
  41559. /**
  41560. * - 检查该骨骼是否包含特定的骨骼或插槽。
  41561. * @see dragonBones.Bone
  41562. * @see dragonBones.Slot
  41563. * @version DragonBones 3.0
  41564. * @language zh_CN
  41565. */
  41566. contains(value: TransformObject): boolean;
  41567. /**
  41568. * - The bone data.
  41569. * @version DragonBones 4.5
  41570. * @language en_US
  41571. */
  41572. /**
  41573. * - 骨骼数据。
  41574. * @version DragonBones 4.5
  41575. * @language zh_CN
  41576. */
  41577. readonly boneData: BoneData;
  41578. /**
  41579. * - The visible of all slots in the bone.
  41580. * @default true
  41581. * @see dragonBones.Slot#visible
  41582. * @version DragonBones 3.0
  41583. * @language en_US
  41584. */
  41585. /**
  41586. * - 此骨骼所有插槽的可见。
  41587. * @default true
  41588. * @see dragonBones.Slot#visible
  41589. * @version DragonBones 3.0
  41590. * @language zh_CN
  41591. */
  41592. visible: boolean;
  41593. /**
  41594. * - The bone name.
  41595. * @version DragonBones 3.0
  41596. * @language en_US
  41597. */
  41598. /**
  41599. * - 骨骼名称。
  41600. * @version DragonBones 3.0
  41601. * @language zh_CN
  41602. */
  41603. readonly name: string;
  41604. /**
  41605. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  41606. * @deprecated
  41607. * @language en_US
  41608. */
  41609. /**
  41610. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  41611. * @deprecated
  41612. * @language zh_CN
  41613. */
  41614. getBones(): Array<Bone>;
  41615. /**
  41616. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  41617. * @deprecated
  41618. * @language en_US
  41619. */
  41620. /**
  41621. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  41622. * @deprecated
  41623. * @language zh_CN
  41624. */
  41625. getSlots(): Array<Slot>;
  41626. /**
  41627. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  41628. * @deprecated
  41629. * @language en_US
  41630. */
  41631. /**
  41632. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  41633. * @deprecated
  41634. * @language zh_CN
  41635. */
  41636. readonly slot: Slot | null;
  41637. }
  41638. /**
  41639. * @internal
  41640. * @private
  41641. */
  41642. export class Surface extends Bone {
  41643. static toString(): string;
  41644. /**
  41645. * For debug draw.
  41646. * @internal
  41647. * @private
  41648. */
  41649. readonly _vertices: Array<number>;
  41650. /**
  41651. * For timeline state.
  41652. * @internal
  41653. * @private
  41654. */
  41655. readonly _deformVertices: Array<number>;
  41656. /**
  41657. * @inheritDoc
  41658. */
  41659. protected _onClear(): void;
  41660. /**
  41661. * @private
  41662. */
  41663. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  41664. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  41665. init(surfaceData: SurfaceData): void;
  41666. /**
  41667. * @internal
  41668. * @private
  41669. */
  41670. update(cacheFrameIndex: number): void;
  41671. }
  41672. /**
  41673. * - The slot attached to the armature, controls the display status and properties of the display object.
  41674. * A bone can contain multiple slots.
  41675. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  41676. * but you can toggle the display object into frame animation while the animation is playing.
  41677. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  41678. * and a custom other display object.
  41679. * @see dragonBones.Armature
  41680. * @see dragonBones.Bone
  41681. * @see dragonBones.SlotData
  41682. * @version DragonBones 3.0
  41683. * @language en_US
  41684. */
  41685. /**
  41686. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  41687. * 一个骨骼上可以包含多个插槽。
  41688. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  41689. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  41690. * @see dragonBones.Armature
  41691. * @see dragonBones.Bone
  41692. * @see dragonBones.SlotData
  41693. * @version DragonBones 3.0
  41694. * @language zh_CN
  41695. */
  41696. export abstract class Slot extends TransformObject {
  41697. /**
  41698. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  41699. * @default null
  41700. * @see dragonBones.AnimationState#displayControl
  41701. * @see dragonBones.AnimationState#name
  41702. * @see dragonBones.AnimationState#group
  41703. * @version DragonBones 4.5
  41704. * @language en_US
  41705. */
  41706. /**
  41707. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  41708. * @default null
  41709. * @see dragonBones.AnimationState#displayControl
  41710. * @see dragonBones.AnimationState#name
  41711. * @see dragonBones.AnimationState#group
  41712. * @version DragonBones 4.5
  41713. * @language zh_CN
  41714. */
  41715. displayController: string | null;
  41716. /**
  41717. * @private
  41718. */
  41719. protected _displayDirty: boolean;
  41720. /**
  41721. * @private
  41722. */
  41723. protected _zOrderDirty: boolean;
  41724. /**
  41725. * @private
  41726. */
  41727. protected _visibleDirty: boolean;
  41728. /**
  41729. * @private
  41730. */
  41731. protected _blendModeDirty: boolean;
  41732. /**
  41733. * @internal
  41734. * @private
  41735. */
  41736. _colorDirty: boolean;
  41737. /**
  41738. * @internal
  41739. * @private
  41740. */
  41741. _meshDirty: boolean;
  41742. /**
  41743. * @private
  41744. */
  41745. protected _transformDirty: boolean;
  41746. /**
  41747. * @private
  41748. */
  41749. /* protected */
  41750. _visible: boolean;
  41751. /**
  41752. * @private
  41753. */
  41754. /* protected */
  41755. _blendMode: BlendMode;
  41756. /**
  41757. * @private
  41758. */
  41759. protected _displayIndex: number;
  41760. /**
  41761. * @private
  41762. */
  41763. protected _animationDisplayIndex: number;
  41764. /**
  41765. * @internal
  41766. * @private
  41767. */
  41768. _zOrder: number;
  41769. /**
  41770. * @private
  41771. */
  41772. protected _cachedFrameIndex: number;
  41773. /**
  41774. * @internal
  41775. * @private
  41776. */
  41777. _pivotX: number;
  41778. /**
  41779. * @internal
  41780. * @private
  41781. */
  41782. _pivotY: number;
  41783. /**
  41784. * @private
  41785. */
  41786. protected readonly _localMatrix: Matrix;
  41787. /**
  41788. * @internal
  41789. * @private
  41790. */
  41791. readonly _colorTransform: ColorTransform;
  41792. /**
  41793. * @internal
  41794. * @private
  41795. */
  41796. // readonly _deformVertices: Array<number>;
  41797. readonly _deformVertices: DeformVertices;
  41798. /**
  41799. * @private
  41800. */
  41801. readonly _displayDatas: Array<DisplayData | null>;
  41802. /**
  41803. * @private
  41804. */
  41805. protected readonly _displayList: Array<any | Armature>;
  41806. /**
  41807. * @private
  41808. */
  41809. protected readonly _meshBones: Array<Bone | null>;
  41810. /**
  41811. * @private
  41812. */
  41813. protected readonly _meshSlots: Array<Slot | null>;
  41814. /**
  41815. * @internal
  41816. * @private
  41817. */
  41818. _slotData: SlotData;
  41819. /**
  41820. * @private
  41821. */
  41822. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  41823. /**
  41824. * @private
  41825. */
  41826. /* protected */
  41827. _displayData: DisplayData | null;
  41828. /**
  41829. * @private
  41830. */
  41831. protected _textureData: TextureData | null;
  41832. /**
  41833. * @internal
  41834. * @private
  41835. */
  41836. _meshData: MeshDisplayData | null;
  41837. /**
  41838. * @private
  41839. */
  41840. protected _boundingBoxData: BoundingBoxData | null;
  41841. /**
  41842. * @private
  41843. */
  41844. protected _rawDisplay: any;
  41845. /**
  41846. * @private
  41847. */
  41848. protected _meshDisplay: any;
  41849. /**
  41850. * @private
  41851. */
  41852. protected _display: any;
  41853. /**
  41854. * @private
  41855. */
  41856. protected _childArmature: Armature | null;
  41857. /**
  41858. * @internal
  41859. * @private
  41860. */
  41861. _cachedFrameIndices: Array<number> | null;
  41862. /**
  41863. * @inheritDoc
  41864. */
  41865. protected _onClear(): void;
  41866. /**
  41867. * @private
  41868. */
  41869. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  41870. /**
  41871. * @private
  41872. */
  41873. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  41874. /**
  41875. * @private
  41876. */
  41877. protected abstract _onUpdateDisplay(): void;
  41878. /**
  41879. * @private
  41880. */
  41881. protected abstract _addDisplay(): void;
  41882. /**
  41883. * @private
  41884. */
  41885. protected abstract _replaceDisplay(value: any): void;
  41886. /**
  41887. * @private
  41888. */
  41889. protected abstract _removeDisplay(): void;
  41890. /**
  41891. * @private
  41892. */
  41893. protected abstract _updateZOrder(): void;
  41894. /**
  41895. * @private
  41896. */
  41897. abstract _updateVisible(): void;
  41898. /**
  41899. * @private
  41900. */
  41901. protected abstract _updateBlendMode(): void;
  41902. /**
  41903. * @private
  41904. */
  41905. protected abstract _updateColor(): void;
  41906. /**
  41907. * @private
  41908. */
  41909. protected abstract _updateFrame(): void;
  41910. /**
  41911. * @private
  41912. */
  41913. protected abstract _updateMesh(): void;
  41914. /**
  41915. * @internal
  41916. * @private
  41917. */
  41918. abstract _updateGlueMesh(): void;
  41919. /**
  41920. * @private
  41921. */
  41922. protected abstract _updateTransform(): void;
  41923. /**
  41924. * @private
  41925. */
  41926. protected abstract _identityTransform(): void;
  41927. /**
  41928. * @private
  41929. */
  41930. protected _getDefaultRawDisplayData(): DisplayData | null;
  41931. /**
  41932. * @private
  41933. */
  41934. protected _updateDisplayData(): void;
  41935. /**
  41936. * @private
  41937. */
  41938. protected _updateDisplay(): void;
  41939. /**
  41940. * @private
  41941. */
  41942. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  41943. /**
  41944. * @private
  41945. */
  41946. protected _isMeshBonesUpdate(): boolean;
  41947. /**
  41948. * @inheritDoc
  41949. */
  41950. _setArmature(value: Armature | null): void;
  41951. /**
  41952. * @internal
  41953. * @private
  41954. */
  41955. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  41956. /**
  41957. * @internal
  41958. * @private
  41959. */
  41960. _setZorder(value: number): boolean;
  41961. /**
  41962. * @internal
  41963. * @private
  41964. */
  41965. _setColor(value: ColorTransform): boolean;
  41966. /**
  41967. * @internal
  41968. * @private
  41969. */
  41970. _setDisplayList(value: Array<any> | null): boolean;
  41971. /**
  41972. * @internal
  41973. * @private
  41974. */
  41975. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  41976. /**
  41977. * @internal
  41978. * @private
  41979. */
  41980. update(cacheFrameIndex: number): void;
  41981. /**
  41982. * @private
  41983. */
  41984. updateTransformAndMatrix(): void;
  41985. /**
  41986. * @private
  41987. */
  41988. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  41989. /**
  41990. * - Check whether a specific point is inside a custom bounding box in the slot.
  41991. * The coordinate system of the point is the inner coordinate system of the armature.
  41992. * Custom bounding boxes need to be customized in Dragonbones Pro.
  41993. * @param x - The horizontal coordinate of the point.
  41994. * @param y - The vertical coordinate of the point.
  41995. * @version DragonBones 5.0
  41996. * @language en_US
  41997. */
  41998. /**
  41999. * - 检查特定点是否在插槽的自定义边界框内。
  42000. * 点的坐标系为骨架内坐标系。
  42001. * 自定义边界框需要在 DragonBones Pro 中自定义。
  42002. * @param x - 点的水平坐标。
  42003. * @param y - 点的垂直坐标。
  42004. * @version DragonBones 5.0
  42005. * @language zh_CN
  42006. */
  42007. containsPoint(x: number, y: number): boolean;
  42008. /**
  42009. * - Check whether a specific segment intersects a custom bounding box for the slot.
  42010. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  42011. * Custom bounding boxes need to be customized in Dragonbones Pro.
  42012. * @param xA - The horizontal coordinate of the beginning of the segment.
  42013. * @param yA - The vertical coordinate of the beginning of the segment.
  42014. * @param xB - The horizontal coordinate of the end point of the segment.
  42015. * @param yB - The vertical coordinate of the end point of the segment.
  42016. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  42017. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  42018. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  42019. * @returns Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections]
  42020. * @version DragonBones 5.0
  42021. * @language en_US
  42022. */
  42023. /**
  42024. * - 检查特定线段是否与插槽的自定义边界框相交。
  42025. * 线段和交点的坐标系均为骨架内坐标系。
  42026. * 自定义边界框需要在 DragonBones Pro 中自定义。
  42027. * @param xA - 线段起点的水平坐标。
  42028. * @param yA - 线段起点的垂直坐标。
  42029. * @param xB - 线段终点的水平坐标。
  42030. * @param yB - 线段终点的垂直坐标。
  42031. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  42032. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  42033. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  42034. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  42035. * @version DragonBones 5.0
  42036. * @language zh_CN
  42037. */
  42038. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  42039. x: number;
  42040. y: number;
  42041. } | null, intersectionPointB?: {
  42042. x: number;
  42043. y: number;
  42044. } | null, normalRadians?: {
  42045. x: number;
  42046. y: number;
  42047. } | null): number;
  42048. /**
  42049. * - Forces the slot to update the state of the display object in the next frame.
  42050. * @version DragonBones 4.5
  42051. * @language en_US
  42052. */
  42053. /**
  42054. * - 强制插槽在下一帧更新显示对象的状态。
  42055. * @version DragonBones 4.5
  42056. * @language zh_CN
  42057. */
  42058. invalidUpdate(): void;
  42059. /**
  42060. * - The visible of slot's display object.
  42061. * @default true
  42062. * @version DragonBones 5.6
  42063. * @language en_US
  42064. */
  42065. /**
  42066. * - 插槽的显示对象的可见。
  42067. * @default true
  42068. * @version DragonBones 5.6
  42069. * @language zh_CN
  42070. */
  42071. visible: boolean;
  42072. /**
  42073. * - The index of the display object displayed in the display list.
  42074. * @example
  42075. * <pre>
  42076. * let slot = armature.getSlot("weapon");
  42077. * slot.displayIndex = 3;
  42078. * slot.displayController = "none";
  42079. * </pre>
  42080. * @version DragonBones 4.5
  42081. * @language en_US
  42082. */
  42083. /**
  42084. * - 此时显示的显示对象在显示列表中的索引。
  42085. * @example
  42086. * <pre>
  42087. * let slot = armature.getSlot("weapon");
  42088. * slot.displayIndex = 3;
  42089. * slot.displayController = "none";
  42090. * </pre>
  42091. * @version DragonBones 4.5
  42092. * @language zh_CN
  42093. */
  42094. displayIndex: number;
  42095. /**
  42096. * - The slot name.
  42097. * @see dragonBones.SlotData#name
  42098. * @version DragonBones 3.0
  42099. * @language en_US
  42100. */
  42101. /**
  42102. * - 插槽名称。
  42103. * @see dragonBones.SlotData#name
  42104. * @version DragonBones 3.0
  42105. * @language zh_CN
  42106. */
  42107. readonly name: string;
  42108. /**
  42109. * - Contains a display list of display objects or child armatures.
  42110. * @version DragonBones 3.0
  42111. * @language en_US
  42112. */
  42113. /**
  42114. * - 包含显示对象或子骨架的显示列表。
  42115. * @version DragonBones 3.0
  42116. * @language zh_CN
  42117. */
  42118. displayList: Array<any>;
  42119. /**
  42120. * - The slot data.
  42121. * @see dragonBones.SlotData
  42122. * @version DragonBones 4.5
  42123. * @language en_US
  42124. */
  42125. /**
  42126. * - 插槽数据。
  42127. * @see dragonBones.SlotData
  42128. * @version DragonBones 4.5
  42129. * @language zh_CN
  42130. */
  42131. readonly slotData: SlotData;
  42132. /**
  42133. * @private
  42134. */
  42135. rawDisplayDatas: Array<DisplayData | null> | null;
  42136. /**
  42137. * - The custom bounding box data for the slot at current time.
  42138. * @version DragonBones 5.0
  42139. * @language en_US
  42140. */
  42141. /**
  42142. * - 插槽此时的自定义包围盒数据。
  42143. * @version DragonBones 5.0
  42144. * @language zh_CN
  42145. */
  42146. readonly boundingBoxData: BoundingBoxData | null;
  42147. /**
  42148. * @private
  42149. */
  42150. readonly rawDisplay: any;
  42151. /**
  42152. * @private
  42153. */
  42154. readonly meshDisplay: any;
  42155. /**
  42156. * - The display object that the slot displays at this time.
  42157. * @example
  42158. * <pre>
  42159. * let slot = armature.getSlot("text");
  42160. * slot.display = new yourEngine.TextField();
  42161. * </pre>
  42162. * @version DragonBones 3.0
  42163. * @language en_US
  42164. */
  42165. /**
  42166. * - 插槽此时显示的显示对象。
  42167. * @example
  42168. * <pre>
  42169. * let slot = armature.getSlot("text");
  42170. * slot.display = new yourEngine.TextField();
  42171. * </pre>
  42172. * @version DragonBones 3.0
  42173. * @language zh_CN
  42174. */
  42175. display: any;
  42176. /**
  42177. * - The child armature that the slot displayed at current time.
  42178. * @example
  42179. * <pre>
  42180. * let slot = armature.getSlot("weapon");
  42181. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  42182. * </pre>
  42183. * @version DragonBones 3.0
  42184. * @language en_US
  42185. */
  42186. /**
  42187. * - 插槽此时显示的子骨架。
  42188. * @example
  42189. * <pre>
  42190. * let slot = armature.getSlot("weapon");
  42191. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  42192. * </pre>
  42193. * @version DragonBones 3.0
  42194. * @language zh_CN
  42195. */
  42196. childArmature: Armature | null;
  42197. /**
  42198. * - Deprecated, please refer to {@link #display}.
  42199. * @deprecated
  42200. * @language en_US
  42201. */
  42202. /**
  42203. * - 已废弃,请参考 {@link #display}。
  42204. * @deprecated
  42205. * @language zh_CN
  42206. */
  42207. getDisplay(): any;
  42208. /**
  42209. * - Deprecated, please refer to {@link #display}.
  42210. * @deprecated
  42211. * @language en_US
  42212. */
  42213. /**
  42214. * - 已废弃,请参考 {@link #display}。
  42215. * @deprecated
  42216. * @language zh_CN
  42217. */
  42218. setDisplay(value: any): void;
  42219. }
  42220. /**
  42221. * @internal
  42222. * @private
  42223. */
  42224. export abstract class Constraint extends BaseObject {
  42225. protected static readonly _helpMatrix: Matrix;
  42226. protected static readonly _helpTransform: Transform;
  42227. protected static readonly _helpPoint: Point;
  42228. /**
  42229. * - For timeline state.
  42230. * @internal
  42231. */
  42232. _constraintData: ConstraintData;
  42233. protected _armature: Armature;
  42234. /**
  42235. * - For sort bones.
  42236. * @internal
  42237. */
  42238. _target: Bone;
  42239. /**
  42240. * - For sort bones.
  42241. * @internal
  42242. */
  42243. _root: Bone;
  42244. protected _bone: Bone | null;
  42245. protected _onClear(): void;
  42246. abstract init(constraintData: ConstraintData, armature: Armature): void;
  42247. abstract update(): void;
  42248. abstract invalidUpdate(): void;
  42249. readonly name: string;
  42250. }
  42251. /**
  42252. * @internal
  42253. * @private
  42254. */
  42255. export class IKConstraint extends Constraint {
  42256. static toString(): string;
  42257. /**
  42258. * - For timeline state.
  42259. * @internal
  42260. */
  42261. _bendPositive: boolean;
  42262. /**
  42263. * - For timeline state.
  42264. * @internal
  42265. */
  42266. _weight: number;
  42267. protected _onClear(): void;
  42268. init(constraintData: ConstraintData, armature: Armature): void;
  42269. update(): void;
  42270. invalidUpdate(): void;
  42271. }
  42272. /**
  42273. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  42274. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  42275. * @see dragonBones.WorldClock
  42276. * @see dragonBones.Armature
  42277. * @version DragonBones 3.0
  42278. * @language en_US
  42279. */
  42280. /**
  42281. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  42282. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  42283. * @see dragonBones.WorldClock
  42284. * @see dragonBones.Armature
  42285. * @version DragonBones 3.0
  42286. * @language zh_CN
  42287. */
  42288. export interface IAnimatable {
  42289. /**
  42290. * - Advance time.
  42291. * @param passedTime - Passed time. (In seconds)
  42292. * @version DragonBones 3.0
  42293. * @language en_US
  42294. */
  42295. /**
  42296. * - 更新时间。
  42297. * @param passedTime - 前进的时间。 (以秒为单位)
  42298. * @version DragonBones 3.0
  42299. * @language zh_CN
  42300. */
  42301. advanceTime(passedTime: number): void;
  42302. /**
  42303. * - The Wordclock instance to which the current belongs.
  42304. * @example
  42305. * <pre>
  42306. * armature.clock = factory.clock; // Add armature to clock.
  42307. * armature.clock = null; // Remove armature from clock.
  42308. * </pre>
  42309. * @version DragonBones 5.0
  42310. * @language en_US
  42311. */
  42312. /**
  42313. * - 当前所属的 WordClock 实例。
  42314. * @example
  42315. * <pre>
  42316. * armature.clock = factory.clock; // 将骨架添加到时钟。
  42317. * armature.clock = null; // 将骨架从时钟移除。
  42318. * </pre>
  42319. * @version DragonBones 5.0
  42320. * @language zh_CN
  42321. */
  42322. clock: WorldClock | null;
  42323. }
  42324. /**
  42325. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  42326. * @see dragonBones.IAnimateble
  42327. * @see dragonBones.Armature
  42328. * @version DragonBones 3.0
  42329. * @language en_US
  42330. */
  42331. /**
  42332. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  42333. * @see dragonBones.IAnimateble
  42334. * @see dragonBones.Armature
  42335. * @version DragonBones 3.0
  42336. * @language zh_CN
  42337. */
  42338. export class WorldClock implements IAnimatable {
  42339. /**
  42340. * - Current time. (In seconds)
  42341. * @version DragonBones 3.0
  42342. * @language en_US
  42343. */
  42344. /**
  42345. * - 当前的时间。 (以秒为单位)
  42346. * @version DragonBones 3.0
  42347. * @language zh_CN
  42348. */
  42349. time: number;
  42350. /**
  42351. * - The play speed, used to control animation speed-shift play.
  42352. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  42353. * @default 1.0
  42354. * @version DragonBones 3.0
  42355. * @language en_US
  42356. */
  42357. /**
  42358. * - 播放速度,用于控制动画变速播放。
  42359. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  42360. * @default 1.0
  42361. * @version DragonBones 3.0
  42362. * @language zh_CN
  42363. */
  42364. timeScale: number;
  42365. /**
  42366. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  42367. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  42368. * @version DragonBones 3.0
  42369. * @language en_US
  42370. */
  42371. /**
  42372. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  42373. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  42374. * @version DragonBones 3.0
  42375. * @language zh_CN
  42376. */
  42377. constructor(time?: number);
  42378. /**
  42379. * - Advance time for all IAnimatable instances.
  42380. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  42381. * @version DragonBones 3.0
  42382. * @language en_US
  42383. */
  42384. /**
  42385. * - 为所有的 IAnimatable 实例更新时间。
  42386. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  42387. * @version DragonBones 3.0
  42388. * @language zh_CN
  42389. */
  42390. advanceTime(passedTime: number): void;
  42391. /**
  42392. * - Check whether contains a specific instance of IAnimatable.
  42393. * @param value - The IAnimatable instance.
  42394. * @version DragonBones 3.0
  42395. * @language en_US
  42396. */
  42397. /**
  42398. * - 检查是否包含特定的 IAnimatable 实例。
  42399. * @param value - IAnimatable 实例。
  42400. * @version DragonBones 3.0
  42401. * @language zh_CN
  42402. */
  42403. contains(value: IAnimatable): boolean;
  42404. /**
  42405. * - Add IAnimatable instance.
  42406. * @param value - The IAnimatable instance.
  42407. * @version DragonBones 3.0
  42408. * @language en_US
  42409. */
  42410. /**
  42411. * - 添加 IAnimatable 实例。
  42412. * @param value - IAnimatable 实例。
  42413. * @version DragonBones 3.0
  42414. * @language zh_CN
  42415. */
  42416. add(value: IAnimatable): void;
  42417. /**
  42418. * - Removes a specified IAnimatable instance.
  42419. * @param value - The IAnimatable instance.
  42420. * @version DragonBones 3.0
  42421. * @language en_US
  42422. */
  42423. /**
  42424. * - 移除特定的 IAnimatable 实例。
  42425. * @param value - IAnimatable 实例。
  42426. * @version DragonBones 3.0
  42427. * @language zh_CN
  42428. */
  42429. remove(value: IAnimatable): void;
  42430. /**
  42431. * - Clear all IAnimatable instances.
  42432. * @version DragonBones 3.0
  42433. * @language en_US
  42434. */
  42435. /**
  42436. * - 清除所有的 IAnimatable 实例。
  42437. * @version DragonBones 3.0
  42438. * @language zh_CN
  42439. */
  42440. clear(): void;
  42441. /**
  42442. * @inheritDoc
  42443. */
  42444. clock: WorldClock | null;
  42445. /**
  42446. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  42447. * @deprecated
  42448. * @language en_US
  42449. */
  42450. /**
  42451. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  42452. * @deprecated
  42453. * @language zh_CN
  42454. */
  42455. static readonly clock: WorldClock;
  42456. }
  42457. /**
  42458. * - The animation player is used to play the animation data and manage the animation states.
  42459. * @see dragonBones.AnimationData
  42460. * @see dragonBones.AnimationState
  42461. * @version DragonBones 3.0
  42462. * @language en_US
  42463. */
  42464. /**
  42465. * - 动画播放器用来播放动画数据和管理动画状态。
  42466. * @see dragonBones.AnimationData
  42467. * @see dragonBones.AnimationState
  42468. * @version DragonBones 3.0
  42469. * @language zh_CN
  42470. */
  42471. export class Animation extends BaseObject {
  42472. static toString(): string;
  42473. /**
  42474. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  42475. * @default 1.0
  42476. * @version DragonBones 3.0
  42477. * @language en_US
  42478. */
  42479. /**
  42480. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  42481. * @default 1.0
  42482. * @version DragonBones 3.0
  42483. * @language zh_CN
  42484. */
  42485. timeScale: number;
  42486. /**
  42487. * @private
  42488. */
  42489. protected _onClear(): void;
  42490. /**
  42491. * @internal
  42492. * @private
  42493. */
  42494. init(armature: Armature): void;
  42495. /**
  42496. * @internal
  42497. * @private
  42498. */
  42499. advanceTime(passedTime: number): void;
  42500. /**
  42501. * - Clear all animations states.
  42502. * @see dragonBones.AnimationState
  42503. * @version DragonBones 4.5
  42504. * @language en_US
  42505. */
  42506. /**
  42507. * - 清除所有的动画状态。
  42508. * @see dragonBones.AnimationState
  42509. * @version DragonBones 4.5
  42510. * @language zh_CN
  42511. */
  42512. reset(): void;
  42513. /**
  42514. * - Pause a specific animation state.
  42515. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  42516. * @see dragonBones.AnimationState
  42517. * @version DragonBones 3.0
  42518. * @language en_US
  42519. */
  42520. /**
  42521. * - 暂停指定动画状态的播放。
  42522. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  42523. * @see dragonBones.AnimationState
  42524. * @version DragonBones 3.0
  42525. * @language zh_CN
  42526. */
  42527. stop(animationName?: string | null): void;
  42528. /**
  42529. * - Play animation with a specific animation config.
  42530. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  42531. * @param animationConfig - The animation config.
  42532. * @returns The playing animation state.
  42533. * @see dragonBones.AnimationConfig
  42534. * @beta
  42535. * @version DragonBones 5.0
  42536. * @language en_US
  42537. */
  42538. /**
  42539. * - 通过指定的动画配置来播放动画。
  42540. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  42541. * @param animationConfig - 动画配置。
  42542. * @returns 播放的动画状态。
  42543. * @see dragonBones.AnimationConfig
  42544. * @beta
  42545. * @version DragonBones 5.0
  42546. * @language zh_CN
  42547. */
  42548. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  42549. /**
  42550. * - Play a specific animation.
  42551. * @param animationName - The name of animation data. (If not set, The default animation will be played, or resume the animation playing from pause status, or replay the last playing animation)
  42552. * @param playTimes - Playing repeat times. [-1: Use default value of the animation data, 0: No end loop playing, [1~N]: Repeat N times] (default: -1)
  42553. * @returns The playing animation state.
  42554. * @example
  42555. * <pre>
  42556. * armature.animation.play("walk");
  42557. * </pre>
  42558. * @version DragonBones 3.0
  42559. * @language en_US
  42560. */
  42561. /**
  42562. * - 播放指定动画。
  42563. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  42564. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  42565. * @returns 播放的动画状态。
  42566. * @example
  42567. * <pre>
  42568. * armature.animation.play("walk");
  42569. * </pre>
  42570. * @version DragonBones 3.0
  42571. * @language zh_CN
  42572. */
  42573. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  42574. /**
  42575. * - Fade in a specific animation.
  42576. * @param animationName - The name of animation data.
  42577. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  42578. * @param playTimes - playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  42579. * @param layer - The blending layer, the animation states in high level layer will get the blending weights with high priority, when the total blending weights are more than 1.0, there will be no more weights can be allocated to the other animation states. (Default: 0)
  42580. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  42581. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  42582. * @returns The playing animation state.
  42583. * @example
  42584. * <pre>
  42585. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  42586. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  42587. * </pre>
  42588. * @version DragonBones 4.5
  42589. * @language en_US
  42590. */
  42591. /**
  42592. * - 淡入播放指定的动画。
  42593. * @param animationName - 动画数据名称。
  42594. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  42595. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  42596. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  42597. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  42598. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  42599. * @returns 播放的动画状态。
  42600. * @example
  42601. * <pre>
  42602. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  42603. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  42604. * </pre>
  42605. * @version DragonBones 4.5
  42606. * @language zh_CN
  42607. */
  42608. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: __private.__node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode): AnimationState | null;
  42609. /**
  42610. * - Play a specific animation from the specific time.
  42611. * @param animationName - The name of animation data.
  42612. * @param time - The start time point of playing. (In seconds)
  42613. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  42614. * @returns The played animation state.
  42615. * @version DragonBones 4.5
  42616. * @language en_US
  42617. */
  42618. /**
  42619. * - 从指定时间开始播放指定的动画。
  42620. * @param animationName - 动画数据名称。
  42621. * @param time - 播放开始的时间。 (以秒为单位)
  42622. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  42623. * @returns 播放的动画状态。
  42624. * @version DragonBones 4.5
  42625. * @language zh_CN
  42626. */
  42627. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  42628. /**
  42629. * - Play a specific animation from the specific frame.
  42630. * @param animationName - The name of animation data.
  42631. * @param frame - The start frame of playing.
  42632. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  42633. * @returns The played animation state.
  42634. * @version DragonBones 4.5
  42635. * @language en_US
  42636. */
  42637. /**
  42638. * - 从指定帧开始播放指定的动画。
  42639. * @param animationName - 动画数据名称。
  42640. * @param frame - 播放开始的帧数。
  42641. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  42642. * @returns 播放的动画状态。
  42643. * @version DragonBones 4.5
  42644. * @language zh_CN
  42645. */
  42646. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  42647. /**
  42648. * - Play a specific animation from the specific progress.
  42649. * @param animationName - The name of animation data.
  42650. * @param progress - The start progress value of playing.
  42651. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  42652. * @returns The played animation state.
  42653. * @version DragonBones 4.5
  42654. * @language en_US
  42655. */
  42656. /**
  42657. * - 从指定进度开始播放指定的动画。
  42658. * @param animationName - 动画数据名称。
  42659. * @param progress - 开始播放的进度。
  42660. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  42661. * @returns 播放的动画状态。
  42662. * @version DragonBones 4.5
  42663. * @language zh_CN
  42664. */
  42665. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  42666. /**
  42667. * - Stop a specific animation at the specific time.
  42668. * @param animationName - The name of animation data.
  42669. * @param time - The stop time. (In seconds)
  42670. * @returns The played animation state.
  42671. * @version DragonBones 4.5
  42672. * @language en_US
  42673. */
  42674. /**
  42675. * - 在指定时间停止指定动画播放
  42676. * @param animationName - 动画数据名称。
  42677. * @param time - 停止的时间。 (以秒为单位)
  42678. * @returns 播放的动画状态。
  42679. * @version DragonBones 4.5
  42680. * @language zh_CN
  42681. */
  42682. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  42683. /**
  42684. * - Stop a specific animation at the specific frame.
  42685. * @param animationName - The name of animation data.
  42686. * @param frame - The stop frame.
  42687. * @returns The played animation state.
  42688. * @version DragonBones 4.5
  42689. * @language en_US
  42690. */
  42691. /**
  42692. * - 在指定帧停止指定动画的播放
  42693. * @param animationName - 动画数据名称。
  42694. * @param frame - 停止的帧数。
  42695. * @returns 播放的动画状态。
  42696. * @version DragonBones 4.5
  42697. * @language zh_CN
  42698. */
  42699. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  42700. /**
  42701. * - Stop a specific animation at the specific progress.
  42702. * @param animationName - The name of animation data.
  42703. * @param progress - The stop progress value.
  42704. * @returns The played animation state.
  42705. * @version DragonBones 4.5
  42706. * @language en_US
  42707. */
  42708. /**
  42709. * - 在指定的进度停止指定的动画播放。
  42710. * @param animationName - 动画数据名称。
  42711. * @param progress - 停止进度。
  42712. * @returns 播放的动画状态。
  42713. * @version DragonBones 4.5
  42714. * @language zh_CN
  42715. */
  42716. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  42717. /**
  42718. * - Get a specific animation state.
  42719. * @param animationName - The name of animation state.
  42720. * @example
  42721. * <pre>
  42722. * armature.animation.play("walk");
  42723. * let walkState = armature.animation.getState("walk");
  42724. * walkState.timeScale = 0.5;
  42725. * </pre>
  42726. * @version DragonBones 3.0
  42727. * @language en_US
  42728. */
  42729. /**
  42730. * - 获取指定的动画状态
  42731. * @param animationName - 动画状态名称。
  42732. * @example
  42733. * <pre>
  42734. * armature.animation.play("walk");
  42735. * let walkState = armature.animation.getState("walk");
  42736. * walkState.timeScale = 0.5;
  42737. * </pre>
  42738. * @version DragonBones 3.0
  42739. * @language zh_CN
  42740. */
  42741. getState(animationName: string): AnimationState | null;
  42742. /**
  42743. * - Check whether a specific animation data is included.
  42744. * @param animationName - The name of animation data.
  42745. * @see dragonBones.AnimationData
  42746. * @version DragonBones 3.0
  42747. * @language en_US
  42748. */
  42749. /**
  42750. * - 检查是否包含指定的动画数据
  42751. * @param animationName - 动画数据名称。
  42752. * @see dragonBones.AnimationData
  42753. * @version DragonBones 3.0
  42754. * @language zh_CN
  42755. */
  42756. hasAnimation(animationName: string): boolean;
  42757. /**
  42758. * - Get all the animation states.
  42759. * @version DragonBones 5.1
  42760. * @language en_US
  42761. */
  42762. /**
  42763. * - 获取所有的动画状态
  42764. * @version DragonBones 5.1
  42765. * @language zh_CN
  42766. */
  42767. getStates(): Array<AnimationState>;
  42768. /**
  42769. * - Check whether there is an animation state is playing
  42770. * @see dragonBones.AnimationState
  42771. * @version DragonBones 3.0
  42772. * @language en_US
  42773. */
  42774. /**
  42775. * - 检查是否有动画状态正在播放
  42776. * @see dragonBones.AnimationState
  42777. * @version DragonBones 3.0
  42778. * @language zh_CN
  42779. */
  42780. readonly isPlaying: boolean;
  42781. /**
  42782. * - Check whether all the animation states' playing were finished.
  42783. * @see dragonBones.AnimationState
  42784. * @version DragonBones 3.0
  42785. * @language en_US
  42786. */
  42787. /**
  42788. * - 检查是否所有的动画状态均已播放完毕。
  42789. * @see dragonBones.AnimationState
  42790. * @version DragonBones 3.0
  42791. * @language zh_CN
  42792. */
  42793. readonly isCompleted: boolean;
  42794. /**
  42795. * - The name of the last playing animation state.
  42796. * @see #lastAnimationState
  42797. * @version DragonBones 3.0
  42798. * @language en_US
  42799. */
  42800. /**
  42801. * - 上一个播放的动画状态名称
  42802. * @see #lastAnimationState
  42803. * @version DragonBones 3.0
  42804. * @language zh_CN
  42805. */
  42806. readonly lastAnimationName: string;
  42807. /**
  42808. * - The name of all animation data
  42809. * @version DragonBones 4.5
  42810. * @language en_US
  42811. */
  42812. /**
  42813. * - 所有动画数据的名称
  42814. * @version DragonBones 4.5
  42815. * @language zh_CN
  42816. */
  42817. readonly animationNames: Array<string>;
  42818. /**
  42819. * - All animation data.
  42820. * @version DragonBones 4.5
  42821. * @language en_US
  42822. */
  42823. /**
  42824. * - 所有的动画数据。
  42825. * @version DragonBones 4.5
  42826. * @language zh_CN
  42827. */
  42828. animations: Map<AnimationData>;
  42829. /**
  42830. * - An AnimationConfig instance that can be used quickly.
  42831. * @see dragonBones.AnimationConfig
  42832. * @version DragonBones 5.0
  42833. * @language en_US
  42834. */
  42835. /**
  42836. * - 一个可以快速使用的动画配置实例。
  42837. * @see dragonBones.AnimationConfig
  42838. * @version DragonBones 5.0
  42839. * @language zh_CN
  42840. */
  42841. readonly animationConfig: AnimationConfig;
  42842. /**
  42843. * - The last playing animation state
  42844. * @see dragonBones.AnimationState
  42845. * @version DragonBones 3.0
  42846. * @language en_US
  42847. */
  42848. /**
  42849. * - 上一个播放的动画状态
  42850. * @see dragonBones.AnimationState
  42851. * @version DragonBones 3.0
  42852. * @language zh_CN
  42853. */
  42854. readonly lastAnimationState: AnimationState | null;
  42855. /**
  42856. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  42857. * @deprecated
  42858. * @language en_US
  42859. */
  42860. /**
  42861. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  42862. * @deprecated
  42863. * @language zh_CN
  42864. */
  42865. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: __private.__node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  42866. /**
  42867. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  42868. * @deprecated
  42869. * @language en_US
  42870. */
  42871. /**
  42872. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  42873. * @deprecated
  42874. * @language zh_CN
  42875. */
  42876. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  42877. /**
  42878. * - Deprecated, please refer to {@link #animationNames}.
  42879. * @deprecated
  42880. * @language en_US
  42881. */
  42882. /**
  42883. * - 已废弃,请参考 {@link #animationNames}。
  42884. * @deprecated
  42885. * @language zh_CN
  42886. */
  42887. readonly animationList: Array<string>;
  42888. /**
  42889. * - Deprecated, please refer to {@link #animationNames}.
  42890. * @deprecated
  42891. * @language en_US
  42892. */
  42893. /**
  42894. * - 已废弃,请参考 {@link #animationNames}。
  42895. * @deprecated
  42896. * @language zh_CN
  42897. */
  42898. readonly animationDataList: Array<AnimationData>;
  42899. }
  42900. /**
  42901. * - The animation state is generated when the animation data is played.
  42902. * @see dragonBones.Animation
  42903. * @see dragonBones.AnimationData
  42904. * @version DragonBones 3.0
  42905. * @language en_US
  42906. */
  42907. /**
  42908. * - 动画状态由播放动画数据时产生。
  42909. * @see dragonBones.Animation
  42910. * @see dragonBones.AnimationData
  42911. * @version DragonBones 3.0
  42912. * @language zh_CN
  42913. */
  42914. export class AnimationState extends BaseObject {
  42915. static toString(): string;
  42916. /**
  42917. * @private
  42918. */
  42919. actionEnabled: boolean;
  42920. /**
  42921. * @private
  42922. */
  42923. additiveBlending: boolean;
  42924. /**
  42925. * - Whether the animation state has control over the display object properties of the slots.
  42926. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  42927. * especially if other animation state are controlling the display object properties of the slots.
  42928. * @default true
  42929. * @version DragonBones 5.0
  42930. * @language en_US
  42931. */
  42932. /**
  42933. * - 动画状态是否对插槽的显示对象属性有控制权。
  42934. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  42935. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  42936. * @default true
  42937. * @version DragonBones 5.0
  42938. * @language zh_CN
  42939. */
  42940. displayControl: boolean;
  42941. /**
  42942. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  42943. * This property should usually be set to false when blend multiple animation states.
  42944. * @default true
  42945. * @version DragonBones 5.1
  42946. * @language en_US
  42947. */
  42948. /**
  42949. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  42950. * 通常在混合多个动画状态时应该将该属性设置为 false。
  42951. * @default true
  42952. * @version DragonBones 5.1
  42953. * @language zh_CN
  42954. */
  42955. resetToPose: boolean;
  42956. /**
  42957. * - The play times. [0: Loop play, [1~N]: Play N times]
  42958. * @version DragonBones 3.0
  42959. * @language en_US
  42960. */
  42961. /**
  42962. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  42963. * @version DragonBones 3.0
  42964. * @language zh_CN
  42965. */
  42966. playTimes: number;
  42967. /**
  42968. * - The blend layer.
  42969. * High layer animation state will get the blend weight first.
  42970. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  42971. * @readonly
  42972. * @version DragonBones 5.0
  42973. * @language en_US
  42974. */
  42975. /**
  42976. * - 混合图层。
  42977. * 图层高的动画状态会优先获取混合权重。
  42978. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  42979. * @readonly
  42980. * @version DragonBones 5.0
  42981. * @language zh_CN
  42982. */
  42983. layer: number;
  42984. /**
  42985. * - The play speed.
  42986. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  42987. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  42988. * @default 1.0
  42989. * @version DragonBones 3.0
  42990. * @language en_US
  42991. */
  42992. /**
  42993. * - 播放速度。
  42994. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  42995. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  42996. * @default 1.0
  42997. * @version DragonBones 3.0
  42998. * @language zh_CN
  42999. */
  43000. timeScale: number;
  43001. /**
  43002. * - The blend weight.
  43003. * @default 1.0
  43004. * @version DragonBones 5.0
  43005. * @language en_US
  43006. */
  43007. /**
  43008. * - 混合权重。
  43009. * @default 1.0
  43010. * @version DragonBones 5.0
  43011. * @language zh_CN
  43012. */
  43013. weight: number;
  43014. /**
  43015. * - The auto fade out time when the animation state play completed.
  43016. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  43017. * @default -1.0
  43018. * @version DragonBones 5.0
  43019. * @language en_US
  43020. */
  43021. /**
  43022. * - 动画状态播放完成后的自动淡出时间。
  43023. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  43024. * @default -1.0
  43025. * @version DragonBones 5.0
  43026. * @language zh_CN
  43027. */
  43028. autoFadeOutTime: number;
  43029. /**
  43030. * @private
  43031. */
  43032. fadeTotalTime: number;
  43033. /**
  43034. * - The name of the animation state. (Can be different from the name of the animation data)
  43035. * @readonly
  43036. * @version DragonBones 5.0
  43037. * @language en_US
  43038. */
  43039. /**
  43040. * - 动画状态名称。 (可以不同于动画数据)
  43041. * @readonly
  43042. * @version DragonBones 5.0
  43043. * @language zh_CN
  43044. */
  43045. name: string;
  43046. /**
  43047. * - The blend group name of the animation state.
  43048. * This property is typically used to specify the substitution of multiple animation states blend.
  43049. * @readonly
  43050. * @version DragonBones 5.0
  43051. * @language en_US
  43052. */
  43053. /**
  43054. * - 混合组名称。
  43055. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  43056. * @readonly
  43057. * @version DragonBones 5.0
  43058. * @language zh_CN
  43059. */
  43060. group: string;
  43061. /**
  43062. * - xx: Play Enabled, Fade Play Enabled
  43063. * @internal
  43064. * @private
  43065. */
  43066. _playheadState: number;
  43067. /**
  43068. * -1: Fade in, 0: Fade complete, 1: Fade out;
  43069. * @internal
  43070. * @private
  43071. */
  43072. _fadeState: number;
  43073. /**
  43074. * -1: Fade start, 0: Fading, 1: Fade complete;
  43075. * @internal
  43076. * @private
  43077. */
  43078. _subFadeState: number;
  43079. /**
  43080. * @internal
  43081. * @private
  43082. */
  43083. _position: number;
  43084. /**
  43085. * @internal
  43086. * @private
  43087. */
  43088. _duration: number;
  43089. /**
  43090. * @internal
  43091. * @private
  43092. */
  43093. _fadeProgress: number;
  43094. /**
  43095. * @internal
  43096. * @private
  43097. */
  43098. _weightResult: number;
  43099. /**
  43100. * @internal
  43101. * @private
  43102. */
  43103. readonly _blendState: BlendState;
  43104. /**
  43105. * @internal
  43106. * @private
  43107. */
  43108. _animationData: AnimationData;
  43109. /**
  43110. * @internal
  43111. * @private
  43112. */
  43113. _actionTimeline: ActionTimelineState;
  43114. /**
  43115. * @internal
  43116. * @private
  43117. */
  43118. _parent: AnimationState;
  43119. /**
  43120. * @private
  43121. */
  43122. protected _onClear(): void;
  43123. /**
  43124. * @internal
  43125. * @private
  43126. */
  43127. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  43128. /**
  43129. * @internal
  43130. * @private
  43131. */
  43132. advanceTime(passedTime: number, cacheFrameRate: number): void;
  43133. /**
  43134. * - Continue play.
  43135. * @version DragonBones 3.0
  43136. * @language en_US
  43137. */
  43138. /**
  43139. * - 继续播放。
  43140. * @version DragonBones 3.0
  43141. * @language zh_CN
  43142. */
  43143. play(): void;
  43144. /**
  43145. * - Stop play.
  43146. * @version DragonBones 3.0
  43147. * @language en_US
  43148. */
  43149. /**
  43150. * - 暂停播放。
  43151. * @version DragonBones 3.0
  43152. * @language zh_CN
  43153. */
  43154. stop(): void;
  43155. /**
  43156. * - Fade out the animation state.
  43157. * @param fadeOutTime - The fade out time. (In seconds)
  43158. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  43159. * @version DragonBones 3.0
  43160. * @language en_US
  43161. */
  43162. /**
  43163. * - 淡出动画状态。
  43164. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  43165. * @param pausePlayhead - 淡出时是否暂停播放。
  43166. * @version DragonBones 3.0
  43167. * @language zh_CN
  43168. */
  43169. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  43170. /**
  43171. * - Check if a specific bone mask is included.
  43172. * @param name - The bone name.
  43173. * @version DragonBones 3.0
  43174. * @language en_US
  43175. */
  43176. /**
  43177. * - 检查是否包含特定骨骼遮罩。
  43178. * @param name - 骨骼名称。
  43179. * @version DragonBones 3.0
  43180. * @language zh_CN
  43181. */
  43182. containsBoneMask(name: string): boolean;
  43183. /**
  43184. * - Add a specific bone mask.
  43185. * @param name - The bone name.
  43186. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  43187. * @version DragonBones 3.0
  43188. * @language en_US
  43189. */
  43190. /**
  43191. * - 添加特定的骨骼遮罩。
  43192. * @param name - 骨骼名称。
  43193. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  43194. * @version DragonBones 3.0
  43195. * @language zh_CN
  43196. */
  43197. addBoneMask(name: string, recursive?: boolean): void;
  43198. /**
  43199. * - Remove the mask of a specific bone.
  43200. * @param name - The bone name.
  43201. * @param recursive - Whether to remove the bone's sub-bone mask.
  43202. * @version DragonBones 3.0
  43203. * @language en_US
  43204. */
  43205. /**
  43206. * - 删除特定骨骼的遮罩。
  43207. * @param name - 骨骼名称。
  43208. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  43209. * @version DragonBones 3.0
  43210. * @language zh_CN
  43211. */
  43212. removeBoneMask(name: string, recursive?: boolean): void;
  43213. /**
  43214. * - Remove all bone masks.
  43215. * @version DragonBones 3.0
  43216. * @language en_US
  43217. */
  43218. /**
  43219. * - 删除所有骨骼遮罩。
  43220. * @version DragonBones 3.0
  43221. * @language zh_CN
  43222. */
  43223. removeAllBoneMask(): void;
  43224. /**
  43225. * - Whether the animation state is fading in.
  43226. * @version DragonBones 5.1
  43227. * @language en_US
  43228. */
  43229. /**
  43230. * - 是否正在淡入。
  43231. * @version DragonBones 5.1
  43232. * @language zh_CN
  43233. */
  43234. readonly isFadeIn: boolean;
  43235. /**
  43236. * - Whether the animation state is fading out.
  43237. * @version DragonBones 5.1
  43238. * @language en_US
  43239. */
  43240. /**
  43241. * - 是否正在淡出。
  43242. * @version DragonBones 5.1
  43243. * @language zh_CN
  43244. */
  43245. readonly isFadeOut: boolean;
  43246. /**
  43247. * - Whether the animation state is fade completed.
  43248. * @version DragonBones 5.1
  43249. * @language en_US
  43250. */
  43251. /**
  43252. * - 是否淡入或淡出完毕。
  43253. * @version DragonBones 5.1
  43254. * @language zh_CN
  43255. */
  43256. readonly isFadeComplete: boolean;
  43257. /**
  43258. * - Whether the animation state is playing.
  43259. * @version DragonBones 3.0
  43260. * @language en_US
  43261. */
  43262. /**
  43263. * - 是否正在播放。
  43264. * @version DragonBones 3.0
  43265. * @language zh_CN
  43266. */
  43267. readonly isPlaying: boolean;
  43268. /**
  43269. * - Whether the animation state is play completed.
  43270. * @version DragonBones 3.0
  43271. * @language en_US
  43272. */
  43273. /**
  43274. * - 是否播放完毕。
  43275. * @version DragonBones 3.0
  43276. * @language zh_CN
  43277. */
  43278. readonly isCompleted: boolean;
  43279. /**
  43280. * - The times has been played.
  43281. * @version DragonBones 3.0
  43282. * @language en_US
  43283. */
  43284. /**
  43285. * - 已经循环播放的次数。
  43286. * @version DragonBones 3.0
  43287. * @language zh_CN
  43288. */
  43289. readonly currentPlayTimes: number;
  43290. /**
  43291. * - The total time. (In seconds)
  43292. * @version DragonBones 3.0
  43293. * @language en_US
  43294. */
  43295. /**
  43296. * - 总播放时间。 (以秒为单位)
  43297. * @version DragonBones 3.0
  43298. * @language zh_CN
  43299. */
  43300. readonly totalTime: number;
  43301. /**
  43302. * - The time is currently playing. (In seconds)
  43303. * @version DragonBones 3.0
  43304. * @language en_US
  43305. */
  43306. /**
  43307. * - 当前播放的时间。 (以秒为单位)
  43308. * @version DragonBones 3.0
  43309. * @language zh_CN
  43310. */
  43311. currentTime: number;
  43312. /**
  43313. * - The animation data.
  43314. * @see dragonBones.AnimationData
  43315. * @version DragonBones 3.0
  43316. * @language en_US
  43317. */
  43318. /**
  43319. * - 动画数据。
  43320. * @see dragonBones.AnimationData
  43321. * @version DragonBones 3.0
  43322. * @language zh_CN
  43323. */
  43324. readonly animationData: AnimationData;
  43325. }
  43326. /**
  43327. * @internal
  43328. * @private
  43329. */
  43330. export class BonePose extends BaseObject {
  43331. static toString(): string;
  43332. readonly current: Transform;
  43333. readonly delta: Transform;
  43334. readonly result: Transform;
  43335. protected _onClear(): void;
  43336. }
  43337. /**
  43338. * @internal
  43339. * @private
  43340. */
  43341. export class BlendState {
  43342. dirty: boolean;
  43343. layer: number;
  43344. leftWeight: number;
  43345. layerWeight: number;
  43346. blendWeight: number;
  43347. update(weight: number, layer: number): number;
  43348. clear(): void;
  43349. }
  43350. /**
  43351. * @internal
  43352. * @private
  43353. */
  43354. export enum TweenState {
  43355. None = 0,
  43356. Once = 1,
  43357. Always = 2
  43358. }
  43359. /**
  43360. * @internal
  43361. * @private
  43362. */
  43363. export abstract class TimelineState extends BaseObject {
  43364. playState: number;
  43365. currentPlayTimes: number;
  43366. currentTime: number;
  43367. protected _tweenState: TweenState;
  43368. protected _frameRate: number;
  43369. protected _frameValueOffset: number;
  43370. protected _frameCount: number;
  43371. protected _frameOffset: number;
  43372. protected _frameIndex: number;
  43373. protected _frameRateR: number;
  43374. protected _position: number;
  43375. protected _duration: number;
  43376. protected _timeScale: number;
  43377. protected _timeOffset: number;
  43378. protected _dragonBonesData: DragonBonesData;
  43379. protected _animationData: AnimationData;
  43380. protected _timelineData: TimelineData | null;
  43381. protected _armature: Armature;
  43382. protected _animationState: AnimationState;
  43383. protected _actionTimeline: TimelineState;
  43384. protected _frameArray: Array<number> | Int16Array;
  43385. protected _frameIntArray: Array<number> | Int16Array;
  43386. protected _frameFloatArray: Array<number> | Int16Array;
  43387. protected _timelineArray: Array<number> | Uint16Array;
  43388. protected _frameIndices: Array<number>;
  43389. protected _onClear(): void;
  43390. protected abstract _onArriveAtFrame(): void;
  43391. protected abstract _onUpdateFrame(): void;
  43392. protected _setCurrentTime(passedTime: number): boolean;
  43393. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  43394. fadeOut(): void;
  43395. update(passedTime: number): void;
  43396. }
  43397. /**
  43398. * @internal
  43399. * @private
  43400. */
  43401. export abstract class TweenTimelineState extends TimelineState {
  43402. protected _tweenType: TweenType;
  43403. protected _curveCount: number;
  43404. protected _framePosition: number;
  43405. protected _frameDurationR: number;
  43406. protected _tweenProgress: number;
  43407. protected _tweenEasing: number;
  43408. protected _onClear(): void;
  43409. protected _onArriveAtFrame(): void;
  43410. protected _onUpdateFrame(): void;
  43411. }
  43412. /**
  43413. * @internal
  43414. * @private
  43415. */
  43416. export abstract class BoneTimelineState extends TweenTimelineState {
  43417. bone: Bone;
  43418. bonePose: BonePose;
  43419. protected _onClear(): void;
  43420. blend(state: number): void;
  43421. }
  43422. /**
  43423. * @internal
  43424. * @private
  43425. */
  43426. export abstract class SlotTimelineState extends TweenTimelineState {
  43427. slot: Slot;
  43428. protected _onClear(): void;
  43429. }
  43430. /**
  43431. * @internal
  43432. * @private
  43433. */
  43434. export abstract class ConstraintTimelineState extends TweenTimelineState {
  43435. constraint: Constraint;
  43436. protected _onClear(): void;
  43437. }
  43438. /**
  43439. * @internal
  43440. * @private
  43441. */
  43442. export class ActionTimelineState extends TimelineState {
  43443. static toString(): string;
  43444. protected _onArriveAtFrame(): void;
  43445. protected _onUpdateFrame(): void;
  43446. update(passedTime: number): void;
  43447. setCurrentTime(value: number): void;
  43448. }
  43449. /**
  43450. * @internal
  43451. * @private
  43452. */
  43453. export class ZOrderTimelineState extends TimelineState {
  43454. static toString(): string;
  43455. protected _onArriveAtFrame(): void;
  43456. protected _onUpdateFrame(): void;
  43457. }
  43458. /**
  43459. * @internal
  43460. * @private
  43461. */
  43462. export class BoneAllTimelineState extends BoneTimelineState {
  43463. static toString(): string;
  43464. protected _onArriveAtFrame(): void;
  43465. protected _onUpdateFrame(): void;
  43466. fadeOut(): void;
  43467. }
  43468. /**
  43469. * @internal
  43470. * @private
  43471. */
  43472. export class BoneTranslateTimelineState extends BoneTimelineState {
  43473. static toString(): string;
  43474. protected _onArriveAtFrame(): void;
  43475. protected _onUpdateFrame(): void;
  43476. }
  43477. /**
  43478. * @internal
  43479. * @private
  43480. */
  43481. export class BoneRotateTimelineState extends BoneTimelineState {
  43482. static toString(): string;
  43483. protected _onArriveAtFrame(): void;
  43484. protected _onUpdateFrame(): void;
  43485. fadeOut(): void;
  43486. }
  43487. /**
  43488. * @internal
  43489. * @private
  43490. */
  43491. export class BoneScaleTimelineState extends BoneTimelineState {
  43492. static toString(): string;
  43493. protected _onArriveAtFrame(): void;
  43494. protected _onUpdateFrame(): void;
  43495. }
  43496. /**
  43497. * @internal
  43498. * @private
  43499. */
  43500. export class SurfaceTimelineState extends TweenTimelineState {
  43501. static toString(): string;
  43502. surface: Surface;
  43503. protected _onClear(): void;
  43504. protected _onArriveAtFrame(): void;
  43505. protected _onUpdateFrame(): void;
  43506. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  43507. blend(state: number): void;
  43508. }
  43509. /**
  43510. * @internal
  43511. * @private
  43512. */
  43513. export class SlotDislayTimelineState extends SlotTimelineState {
  43514. static toString(): string;
  43515. protected _onArriveAtFrame(): void;
  43516. }
  43517. /**
  43518. * @internal
  43519. * @private
  43520. */
  43521. export class SlotColorTimelineState extends SlotTimelineState {
  43522. static toString(): string;
  43523. protected _onClear(): void;
  43524. protected _onArriveAtFrame(): void;
  43525. protected _onUpdateFrame(): void;
  43526. fadeOut(): void;
  43527. update(passedTime: number): void;
  43528. }
  43529. /**
  43530. * @internal
  43531. * @private
  43532. */
  43533. export class SlotFFDTimelineState extends SlotTimelineState {
  43534. static toString(): string;
  43535. meshOffset: number;
  43536. protected _onClear(): void;
  43537. protected _onArriveAtFrame(): void;
  43538. protected _onUpdateFrame(): void;
  43539. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  43540. fadeOut(): void;
  43541. update(passedTime: number): void;
  43542. }
  43543. /**
  43544. * @internal
  43545. * @private
  43546. */
  43547. export class IKConstraintTimelineState extends ConstraintTimelineState {
  43548. static toString(): string;
  43549. protected _onClear(): void;
  43550. protected _onArriveAtFrame(): void;
  43551. protected _onUpdateFrame(): void;
  43552. }
  43553. /**
  43554. * @internal
  43555. * @private
  43556. */
  43557. export class AnimationTimelineState extends TweenTimelineState {
  43558. static toString(): string;
  43559. animationState: AnimationState;
  43560. protected _onClear(): void;
  43561. protected _onArriveAtFrame(): void;
  43562. protected _onUpdateFrame(): void;
  43563. blend(state: number): void;
  43564. }
  43565. /**
  43566. * - The properties of the object carry basic information about an event,
  43567. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  43568. * @version DragonBones 4.5
  43569. * @language en_US
  43570. */
  43571. /**
  43572. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  43573. * @version DragonBones 4.5
  43574. * @language zh_CN
  43575. */
  43576. export class EventObject extends BaseObject {
  43577. /**
  43578. * - Animation start play.
  43579. * @version DragonBones 4.5
  43580. * @language en_US
  43581. */
  43582. /**
  43583. * - 动画开始播放。
  43584. * @version DragonBones 4.5
  43585. * @language zh_CN
  43586. */
  43587. static readonly START: string;
  43588. /**
  43589. * - Animation loop play complete once.
  43590. * @version DragonBones 4.5
  43591. * @language en_US
  43592. */
  43593. /**
  43594. * - 动画循环播放完成一次。
  43595. * @version DragonBones 4.5
  43596. * @language zh_CN
  43597. */
  43598. static readonly LOOP_COMPLETE: string;
  43599. /**
  43600. * - Animation play complete.
  43601. * @version DragonBones 4.5
  43602. * @language en_US
  43603. */
  43604. /**
  43605. * - 动画播放完成。
  43606. * @version DragonBones 4.5
  43607. * @language zh_CN
  43608. */
  43609. static readonly COMPLETE: string;
  43610. /**
  43611. * - Animation fade in start.
  43612. * @version DragonBones 4.5
  43613. * @language en_US
  43614. */
  43615. /**
  43616. * - 动画淡入开始。
  43617. * @version DragonBones 4.5
  43618. * @language zh_CN
  43619. */
  43620. static readonly FADE_IN: string;
  43621. /**
  43622. * - Animation fade in complete.
  43623. * @version DragonBones 4.5
  43624. * @language en_US
  43625. */
  43626. /**
  43627. * - 动画淡入完成。
  43628. * @version DragonBones 4.5
  43629. * @language zh_CN
  43630. */
  43631. static readonly FADE_IN_COMPLETE: string;
  43632. /**
  43633. * - Animation fade out start.
  43634. * @version DragonBones 4.5
  43635. * @language en_US
  43636. */
  43637. /**
  43638. * - 动画淡出开始。
  43639. * @version DragonBones 4.5
  43640. * @language zh_CN
  43641. */
  43642. static readonly FADE_OUT: string;
  43643. /**
  43644. * - Animation fade out complete.
  43645. * @version DragonBones 4.5
  43646. * @language en_US
  43647. */
  43648. /**
  43649. * - 动画淡出完成。
  43650. * @version DragonBones 4.5
  43651. * @language zh_CN
  43652. */
  43653. static readonly FADE_OUT_COMPLETE: string;
  43654. /**
  43655. * - Animation frame event.
  43656. * @version DragonBones 4.5
  43657. * @language en_US
  43658. */
  43659. /**
  43660. * - 动画帧事件。
  43661. * @version DragonBones 4.5
  43662. * @language zh_CN
  43663. */
  43664. static readonly FRAME_EVENT: string;
  43665. /**
  43666. * - Animation frame sound event.
  43667. * @version DragonBones 4.5
  43668. * @language en_US
  43669. */
  43670. /**
  43671. * - 动画帧声音事件。
  43672. * @version DragonBones 4.5
  43673. * @language zh_CN
  43674. */
  43675. static readonly SOUND_EVENT: string;
  43676. static toString(): string;
  43677. /**
  43678. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  43679. * @version DragonBones 4.5
  43680. * @language en_US
  43681. */
  43682. /**
  43683. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  43684. * @version DragonBones 4.5
  43685. * @language zh_CN
  43686. */
  43687. time: number;
  43688. /**
  43689. * - The event type。
  43690. * @version DragonBones 4.5
  43691. * @language en_US
  43692. */
  43693. /**
  43694. * - 事件类型。
  43695. * @version DragonBones 4.5
  43696. * @language zh_CN
  43697. */
  43698. type: EventStringType;
  43699. /**
  43700. * - The event name. (The frame event name or the frame sound name)
  43701. * @version DragonBones 4.5
  43702. * @language en_US
  43703. */
  43704. /**
  43705. * - 事件名称。 (帧事件的名称或帧声音的名称)
  43706. * @version DragonBones 4.5
  43707. * @language zh_CN
  43708. */
  43709. name: string;
  43710. /**
  43711. * - The armature that dispatch the event.
  43712. * @see dragonBones.Armature
  43713. * @version DragonBones 4.5
  43714. * @language en_US
  43715. */
  43716. /**
  43717. * - 发出该事件的骨架。
  43718. * @see dragonBones.Armature
  43719. * @version DragonBones 4.5
  43720. * @language zh_CN
  43721. */
  43722. armature: Armature;
  43723. /**
  43724. * - The bone that dispatch the event.
  43725. * @see dragonBones.Bone
  43726. * @version DragonBones 4.5
  43727. * @language en_US
  43728. */
  43729. /**
  43730. * - 发出该事件的骨骼。
  43731. * @see dragonBones.Bone
  43732. * @version DragonBones 4.5
  43733. * @language zh_CN
  43734. */
  43735. bone: Bone | null;
  43736. /**
  43737. * - The slot that dispatch the event.
  43738. * @see dragonBones.Slot
  43739. * @version DragonBones 4.5
  43740. * @language en_US
  43741. */
  43742. /**
  43743. * - 发出该事件的插槽。
  43744. * @see dragonBones.Slot
  43745. * @version DragonBones 4.5
  43746. * @language zh_CN
  43747. */
  43748. slot: Slot | null;
  43749. /**
  43750. * - The animation state that dispatch the event.
  43751. * @see dragonBones.AnimationState
  43752. * @version DragonBones 4.5
  43753. * @language en_US
  43754. */
  43755. /**
  43756. * - 发出该事件的动画状态。
  43757. * @see dragonBones.AnimationState
  43758. * @version DragonBones 4.5
  43759. * @language zh_CN
  43760. */
  43761. animationState: AnimationState;
  43762. /**
  43763. * - The custom data.
  43764. * @see dragonBones.CustomData
  43765. * @version DragonBones 5.0
  43766. * @language en_US
  43767. */
  43768. /**
  43769. * - 自定义数据。
  43770. * @see dragonBones.CustomData
  43771. * @version DragonBones 5.0
  43772. * @language zh_CN
  43773. */
  43774. data: UserData | null;
  43775. /**
  43776. * @private
  43777. */
  43778. protected _onClear(): void;
  43779. }
  43780. /**
  43781. * @private
  43782. */
  43783. export type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  43784. /**
  43785. * - The event dispatcher interface.
  43786. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  43787. * @version DragonBones 4.5
  43788. * @language en_US
  43789. */
  43790. /**
  43791. * - 事件派发接口。
  43792. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  43793. * @version DragonBones 4.5
  43794. * @language zh_CN
  43795. */
  43796. export interface IEventDispatcher {
  43797. /**
  43798. * - Checks whether the object has any listeners registered for a specific type of event。
  43799. * @param type - Event type.
  43800. * @version DragonBones 4.5
  43801. * @language en_US
  43802. */
  43803. /**
  43804. * - 检查是否为特定的事件类型注册了任何侦听器。
  43805. * @param type - 事件类型。
  43806. * @version DragonBones 4.5
  43807. * @language zh_CN
  43808. */
  43809. hasDBEventListener(type: EventStringType): boolean;
  43810. /**
  43811. * - Dispatches an event into the event flow.
  43812. * @param type - Event type.
  43813. * @param eventObject - Event object.
  43814. * @see dragonBones.EventObject
  43815. * @version DragonBones 4.5
  43816. * @language en_US
  43817. */
  43818. /**
  43819. * - 分派特定的事件到事件流中。
  43820. * @param type - 事件类型。
  43821. * @param eventObject - 事件数据。
  43822. * @see dragonBones.EventObject
  43823. * @version DragonBones 4.5
  43824. * @language zh_CN
  43825. */
  43826. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  43827. /**
  43828. * - Add an event listener object so that the listener receives notification of an event.
  43829. * @param type - Event type.
  43830. * @param listener - Event listener.
  43831. * @param thisObject - The listener function's "this".
  43832. * @version DragonBones 4.5
  43833. * @language en_US
  43834. */
  43835. /**
  43836. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  43837. * @param type - 事件类型。
  43838. * @param listener - 事件侦听器。
  43839. * @param thisObject - 侦听函数绑定的 this 对象。
  43840. * @version DragonBones 4.5
  43841. * @language zh_CN
  43842. */
  43843. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  43844. /**
  43845. * - Removes a listener from the object.
  43846. * @param type - Event type.
  43847. * @param listener - Event listener.
  43848. * @param thisObject - The listener function's "this".
  43849. * @version DragonBones 4.5
  43850. * @language en_US
  43851. */
  43852. /**
  43853. * - 删除特定事件类型的侦听器。
  43854. * @param type - 事件类型。
  43855. * @param listener - 事件侦听器。
  43856. * @param thisObject - 侦听函数绑定的 this 对象。
  43857. * @version DragonBones 4.5
  43858. * @language zh_CN
  43859. */
  43860. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  43861. /**
  43862. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  43863. * @deprecated
  43864. * @language en_US
  43865. */
  43866. /**
  43867. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  43868. * @deprecated
  43869. * @language zh_CN
  43870. */
  43871. hasEvent(type: EventStringType): boolean;
  43872. /**
  43873. * - Deprecated, please refer to {@link #addDBEventListener()}.
  43874. * @deprecated
  43875. * @language en_US
  43876. */
  43877. /**
  43878. * - 已废弃,请参考 {@link #addDBEventListener()}。
  43879. * @deprecated
  43880. * @language zh_CN
  43881. */
  43882. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  43883. /**
  43884. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  43885. * @deprecated
  43886. * @language en_US
  43887. */
  43888. /**
  43889. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  43890. * @deprecated
  43891. * @language zh_CN
  43892. */
  43893. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  43894. }
  43895. /**
  43896. * @internal
  43897. * @private
  43898. */
  43899. export abstract class DataParser {
  43900. protected static readonly DATA_VERSION_2_3: string;
  43901. protected static readonly DATA_VERSION_3_0: string;
  43902. protected static readonly DATA_VERSION_4_0: string;
  43903. protected static readonly DATA_VERSION_4_5: string;
  43904. protected static readonly DATA_VERSION_5_0: string;
  43905. protected static readonly DATA_VERSION_5_5: string;
  43906. protected static readonly DATA_VERSION: string;
  43907. protected static readonly DATA_VERSIONS: Array<string>;
  43908. protected static readonly TEXTURE_ATLAS: string;
  43909. protected static readonly SUB_TEXTURE: string;
  43910. protected static readonly FORMAT: string;
  43911. protected static readonly IMAGE_PATH: string;
  43912. protected static readonly WIDTH: string;
  43913. protected static readonly HEIGHT: string;
  43914. protected static readonly ROTATED: string;
  43915. protected static readonly FRAME_X: string;
  43916. protected static readonly FRAME_Y: string;
  43917. protected static readonly FRAME_WIDTH: string;
  43918. protected static readonly FRAME_HEIGHT: string;
  43919. protected static readonly DRADON_BONES: string;
  43920. protected static readonly USER_DATA: string;
  43921. protected static readonly ARMATURE: string;
  43922. protected static readonly BONE: string;
  43923. protected static readonly SURFACE: string;
  43924. protected static readonly SLOT: string;
  43925. protected static readonly CONSTRAINT: string;
  43926. protected static readonly IK: string;
  43927. protected static readonly SKIN: string;
  43928. protected static readonly DISPLAY: string;
  43929. protected static readonly ANIMATION: string;
  43930. protected static readonly Z_ORDER: string;
  43931. protected static readonly FFD: string;
  43932. protected static readonly FRAME: string;
  43933. protected static readonly TRANSLATE_FRAME: string;
  43934. protected static readonly ROTATE_FRAME: string;
  43935. protected static readonly SCALE_FRAME: string;
  43936. protected static readonly DISPLAY_FRAME: string;
  43937. protected static readonly COLOR_FRAME: string;
  43938. protected static readonly DEFAULT_ACTIONS: string;
  43939. protected static readonly ACTIONS: string;
  43940. protected static readonly EVENTS: string;
  43941. protected static readonly INTS: string;
  43942. protected static readonly FLOATS: string;
  43943. protected static readonly STRINGS: string;
  43944. protected static readonly CANVAS: string;
  43945. protected static readonly TRANSFORM: string;
  43946. protected static readonly PIVOT: string;
  43947. protected static readonly AABB: string;
  43948. protected static readonly COLOR: string;
  43949. protected static readonly VERSION: string;
  43950. protected static readonly COMPATIBLE_VERSION: string;
  43951. protected static readonly FRAME_RATE: string;
  43952. protected static readonly TYPE: string;
  43953. protected static readonly SUB_TYPE: string;
  43954. protected static readonly NAME: string;
  43955. protected static readonly PARENT: string;
  43956. protected static readonly TARGET: string;
  43957. protected static readonly STAGE: string;
  43958. protected static readonly SHARE: string;
  43959. protected static readonly PATH: string;
  43960. protected static readonly LENGTH: string;
  43961. protected static readonly DISPLAY_INDEX: string;
  43962. protected static readonly BLEND_MODE: string;
  43963. protected static readonly INHERIT_TRANSLATION: string;
  43964. protected static readonly INHERIT_ROTATION: string;
  43965. protected static readonly INHERIT_SCALE: string;
  43966. protected static readonly INHERIT_REFLECTION: string;
  43967. protected static readonly INHERIT_ANIMATION: string;
  43968. protected static readonly INHERIT_DEFORM: string;
  43969. protected static readonly SEGMENT_X: string;
  43970. protected static readonly SEGMENT_Y: string;
  43971. protected static readonly BEND_POSITIVE: string;
  43972. protected static readonly CHAIN: string;
  43973. protected static readonly WEIGHT: string;
  43974. protected static readonly FADE_IN_TIME: string;
  43975. protected static readonly PLAY_TIMES: string;
  43976. protected static readonly SCALE: string;
  43977. protected static readonly OFFSET: string;
  43978. protected static readonly POSITION: string;
  43979. protected static readonly DURATION: string;
  43980. protected static readonly TWEEN_EASING: string;
  43981. protected static readonly TWEEN_ROTATE: string;
  43982. protected static readonly TWEEN_SCALE: string;
  43983. protected static readonly CLOCK_WISE: string;
  43984. protected static readonly CURVE: string;
  43985. protected static readonly SOUND: string;
  43986. protected static readonly EVENT: string;
  43987. protected static readonly ACTION: string;
  43988. protected static readonly X: string;
  43989. protected static readonly Y: string;
  43990. protected static readonly SKEW_X: string;
  43991. protected static readonly SKEW_Y: string;
  43992. protected static readonly SCALE_X: string;
  43993. protected static readonly SCALE_Y: string;
  43994. protected static readonly VALUE: string;
  43995. protected static readonly ROTATE: string;
  43996. protected static readonly SKEW: string;
  43997. protected static readonly ALPHA_OFFSET: string;
  43998. protected static readonly RED_OFFSET: string;
  43999. protected static readonly GREEN_OFFSET: string;
  44000. protected static readonly BLUE_OFFSET: string;
  44001. protected static readonly ALPHA_MULTIPLIER: string;
  44002. protected static readonly RED_MULTIPLIER: string;
  44003. protected static readonly GREEN_MULTIPLIER: string;
  44004. protected static readonly BLUE_MULTIPLIER: string;
  44005. protected static readonly UVS: string;
  44006. protected static readonly VERTICES: string;
  44007. protected static readonly TRIANGLES: string;
  44008. protected static readonly WEIGHTS: string;
  44009. protected static readonly SLOT_POSE: string;
  44010. protected static readonly BONE_POSE: string;
  44011. protected static readonly GLUE_WEIGHTS: string;
  44012. protected static readonly GLUE_MESHES: string;
  44013. protected static readonly GOTO_AND_PLAY: string;
  44014. protected static readonly DEFAULT_NAME: string;
  44015. protected static _getArmatureType(value: string): ArmatureType;
  44016. protected static _getBoneType(value: string): BoneType;
  44017. protected static _getDisplayType(value: string): DisplayType;
  44018. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  44019. protected static _getActionType(value: string): ActionType;
  44020. protected static _getBlendMode(value: string): BlendMode;
  44021. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  44022. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  44023. /**
  44024. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  44025. * @deprecated
  44026. * @language en_US
  44027. */
  44028. /**
  44029. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  44030. * @deprecated
  44031. * @language zh_CN
  44032. */
  44033. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  44034. /**
  44035. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  44036. * @deprecated
  44037. * @language en_US
  44038. */
  44039. /**
  44040. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  44041. * @deprecated
  44042. * @language zh_CN
  44043. */
  44044. static parseTextureAtlasData(rawData: any, scale?: number): any;
  44045. }
  44046. /**
  44047. * @internal
  44048. * @private
  44049. */
  44050. export class ObjectDataParser extends DataParser {
  44051. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  44052. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  44053. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  44054. protected _rawTextureAtlasIndex: number;
  44055. protected readonly _rawBones: Array<BoneData>;
  44056. protected _data: DragonBonesData;
  44057. protected _armature: ArmatureData;
  44058. protected _bone: BoneData;
  44059. protected _surface: SurfaceData;
  44060. protected _slot: SlotData;
  44061. protected _skin: SkinData;
  44062. protected _mesh: MeshDisplayData;
  44063. protected _animation: AnimationData;
  44064. protected _timeline: TimelineData;
  44065. protected _rawTextureAtlases: Array<any> | null;
  44066. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  44067. protected _parseBone(rawData: any): BoneData;
  44068. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  44069. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  44070. protected _parseSkin(rawData: any): SkinData;
  44071. protected _parseDisplay(rawData: any): DisplayData | null;
  44072. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  44073. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  44074. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  44075. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  44076. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  44077. protected _parseAnimation(rawData: any): AnimationData;
  44078. protected _parseTimeline(rawData: any, rawFrames: Array<any> | null, framesKey: string, type: TimelineType, addIntOffset: boolean, addFloatOffset: boolean, frameValueCount: number, frameParser: (rawData: any, frameStart: number, frameCount: number) => number): TimelineData | null;
  44079. protected _parseBoneTimeline(rawData: any): void;
  44080. protected _parseSlotTimeline(rawData: any): void;
  44081. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  44082. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  44083. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  44084. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  44085. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  44086. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  44087. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  44088. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  44089. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  44090. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  44091. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  44092. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  44093. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  44094. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  44095. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  44096. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  44097. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  44098. protected _parseArray(rawData: any): void;
  44099. protected _modifyArray(): void;
  44100. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  44101. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  44102. /**
  44103. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  44104. * @deprecated
  44105. * @language en_US
  44106. */
  44107. /**
  44108. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  44109. * @deprecated
  44110. * @language zh_CN
  44111. */
  44112. static getInstance(): ObjectDataParser;
  44113. }
  44114. /**
  44115. * @internal
  44116. * @private
  44117. */
  44118. export class ActionFrame {
  44119. frameStart: number;
  44120. readonly actions: Array<number>;
  44121. }
  44122. /**
  44123. * @internal
  44124. * @private
  44125. */
  44126. export class BinaryDataParser extends ObjectDataParser {
  44127. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  44128. protected _parseAnimation(rawData: any): AnimationData;
  44129. protected _parseArray(rawData: any): void;
  44130. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  44131. /**
  44132. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  44133. * @deprecated
  44134. * @language en_US
  44135. */
  44136. /**
  44137. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  44138. * @deprecated
  44139. * @language zh_CN
  44140. */
  44141. static getInstance(): BinaryDataParser;
  44142. }
  44143. /**
  44144. * - Base export class for the factory that create the armatures. (Typically only one global factory instance is required)
  44145. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  44146. * Once the data has been parsed, it has been cached in the factory instance and does not need to be parsed again until it is cleared by the factory instance.
  44147. * @see dragonBones.DragonBonesData
  44148. * @see dragonBones.TextureAtlasData
  44149. * @see dragonBones.ArmatureData
  44150. * @see dragonBones.Armature
  44151. * @version DragonBones 3.0
  44152. * @language en_US
  44153. */
  44154. /**
  44155. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  44156. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  44157. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  44158. * @see dragonBones.DragonBonesData
  44159. * @see dragonBones.TextureAtlasData
  44160. * @see dragonBones.ArmatureData
  44161. * @see dragonBones.Armature
  44162. * @version DragonBones 3.0
  44163. * @language zh_CN
  44164. */
  44165. export abstract class BaseFactory {
  44166. /**
  44167. * @private
  44168. */
  44169. public static _objectParser: ObjectDataParser;
  44170. /**
  44171. * @private
  44172. */
  44173. public static _binaryParser: BinaryDataParser;
  44174. /**
  44175. * @private
  44176. */
  44177. autoSearch: boolean;
  44178. /**
  44179. * @private
  44180. */
  44181. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  44182. /**
  44183. * @private
  44184. */
  44185. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  44186. /**
  44187. * @private
  44188. */
  44189. /* protected */
  44190. _dragonBones: DragonBones;
  44191. /**
  44192. * @private
  44193. */
  44194. protected _dataParser: DataParser;
  44195. /**
  44196. * - Create a factory instance. (typically only one global factory instance is required)
  44197. * @version DragonBones 3.0
  44198. * @language en_US
  44199. */
  44200. /**
  44201. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  44202. * @version DragonBones 3.0
  44203. * @language zh_CN
  44204. */
  44205. constructor(dataParser?: DataParser | null);
  44206. /**
  44207. * @private
  44208. */
  44209. protected _isSupportMesh(): boolean;
  44210. /**
  44211. * @private
  44212. */
  44213. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  44214. /**
  44215. * @private
  44216. */
  44217. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  44218. /**
  44219. * @private
  44220. */
  44221. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  44222. /**
  44223. * @private
  44224. */
  44225. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  44226. /**
  44227. * @private
  44228. */
  44229. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  44230. /**
  44231. * @private
  44232. */
  44233. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  44234. /**
  44235. * @private
  44236. */
  44237. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  44238. /**
  44239. * @private
  44240. */
  44241. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  44242. /**
  44243. * @private
  44244. */
  44245. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  44246. /**
  44247. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  44248. * @param rawData - The raw data.
  44249. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  44250. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  44251. * @returns DragonBonesData instance
  44252. * @see #getDragonBonesData()
  44253. * @see #addDragonBonesData()
  44254. * @see #removeDragonBonesData()
  44255. * @see dragonBones.DragonBonesData
  44256. * @version DragonBones 4.5
  44257. * @language en_US
  44258. */
  44259. /**
  44260. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  44261. * @param rawData - 原始数据。
  44262. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  44263. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  44264. * @returns DragonBonesData 实例
  44265. * @see #getDragonBonesData()
  44266. * @see #addDragonBonesData()
  44267. * @see #removeDragonBonesData()
  44268. * @see dragonBones.DragonBonesData
  44269. * @version DragonBones 4.5
  44270. * @language zh_CN
  44271. */
  44272. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  44273. /**
  44274. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  44275. * @param rawData - The raw texture atlas data.
  44276. * @param textureAtlas - The texture atlas object.
  44277. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  44278. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  44279. * @returns TextureAtlasData instance
  44280. * @see #getTextureAtlasData()
  44281. * @see #addTextureAtlasData()
  44282. * @see #removeTextureAtlasData()
  44283. * @see dragonBones.TextureAtlasData
  44284. * @version DragonBones 4.5
  44285. * @language en_US
  44286. */
  44287. /**
  44288. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  44289. * @param rawData - 原始贴图集数据。
  44290. * @param textureAtlas - 贴图集对象。
  44291. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  44292. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  44293. * @returns TextureAtlasData 实例
  44294. * @see #getTextureAtlasData()
  44295. * @see #addTextureAtlasData()
  44296. * @see #removeTextureAtlasData()
  44297. * @see dragonBones.TextureAtlasData
  44298. * @version DragonBones 4.5
  44299. * @language zh_CN
  44300. */
  44301. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  44302. /**
  44303. * @private
  44304. */
  44305. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  44306. /**
  44307. * - Get a specific DragonBonesData instance.
  44308. * @param name - The DragonBonesData instance cache name.
  44309. * @returns DragonBonesData instance
  44310. * @see #parseDragonBonesData()
  44311. * @see #addDragonBonesData()
  44312. * @see #removeDragonBonesData()
  44313. * @see dragonBones.DragonBonesData
  44314. * @version DragonBones 3.0
  44315. * @language en_US
  44316. */
  44317. /**
  44318. * - 获取特定的 DragonBonesData 实例。
  44319. * @param name - DragonBonesData 实例的缓存名称。
  44320. * @returns DragonBonesData 实例
  44321. * @see #parseDragonBonesData()
  44322. * @see #addDragonBonesData()
  44323. * @see #removeDragonBonesData()
  44324. * @see dragonBones.DragonBonesData
  44325. * @version DragonBones 3.0
  44326. * @language zh_CN
  44327. */
  44328. getDragonBonesData(name: string): DragonBonesData | null;
  44329. /**
  44330. * - Cache a DragonBonesData instance to the factory.
  44331. * @param data - The DragonBonesData instance.
  44332. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  44333. * @see #parseDragonBonesData()
  44334. * @see #getDragonBonesData()
  44335. * @see #removeDragonBonesData()
  44336. * @see dragonBones.DragonBonesData
  44337. * @version DragonBones 3.0
  44338. * @language en_US
  44339. */
  44340. /**
  44341. * - 将 DragonBonesData 实例缓存到工厂中。
  44342. * @param data - DragonBonesData 实例。
  44343. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  44344. * @see #parseDragonBonesData()
  44345. * @see #getDragonBonesData()
  44346. * @see #removeDragonBonesData()
  44347. * @see dragonBones.DragonBonesData
  44348. * @version DragonBones 3.0
  44349. * @language zh_CN
  44350. */
  44351. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  44352. /**
  44353. * - Remove a DragonBonesData instance.
  44354. * @param name - The DragonBonesData instance cache name.
  44355. * @param disposeData - Whether to dispose data. (Default: true)
  44356. * @see #parseDragonBonesData()
  44357. * @see #getDragonBonesData()
  44358. * @see #addDragonBonesData()
  44359. * @see dragonBones.DragonBonesData
  44360. * @version DragonBones 3.0
  44361. * @language en_US
  44362. */
  44363. /**
  44364. * - 移除 DragonBonesData 实例。
  44365. * @param name - DragonBonesData 实例缓存名称。
  44366. * @param disposeData - 是否释放数据。 (默认: true)
  44367. * @see #parseDragonBonesData()
  44368. * @see #getDragonBonesData()
  44369. * @see #addDragonBonesData()
  44370. * @see dragonBones.DragonBonesData
  44371. * @version DragonBones 3.0
  44372. * @language zh_CN
  44373. */
  44374. removeDragonBonesData(name: string, disposeData?: boolean): void;
  44375. /**
  44376. * - Get a list of specific TextureAtlasData instances.
  44377. * @param name - The TextureAtlasData cahce name.
  44378. * @see #parseTextureAtlasData()
  44379. * @see #addTextureAtlasData()
  44380. * @see #removeTextureAtlasData()
  44381. * @see dragonBones.TextureAtlasData
  44382. * @version DragonBones 3.0
  44383. * @language en_US
  44384. */
  44385. /**
  44386. * - 获取特定的 TextureAtlasData 实例列表。
  44387. * @param name - TextureAtlasData 实例缓存名称。
  44388. * @see #parseTextureAtlasData()
  44389. * @see #addTextureAtlasData()
  44390. * @see #removeTextureAtlasData()
  44391. * @see dragonBones.TextureAtlasData
  44392. * @version DragonBones 3.0
  44393. * @language zh_CN
  44394. */
  44395. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  44396. /**
  44397. * - Cache a TextureAtlasData instance to the factory.
  44398. * @param data - The TextureAtlasData instance.
  44399. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  44400. * @see #parseTextureAtlasData()
  44401. * @see #getTextureAtlasData()
  44402. * @see #removeTextureAtlasData()
  44403. * @see dragonBones.TextureAtlasData
  44404. * @version DragonBones 3.0
  44405. * @language en_US
  44406. */
  44407. /**
  44408. * - 将 TextureAtlasData 实例缓存到工厂中。
  44409. * @param data - TextureAtlasData 实例。
  44410. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  44411. * @see #parseTextureAtlasData()
  44412. * @see #getTextureAtlasData()
  44413. * @see #removeTextureAtlasData()
  44414. * @see dragonBones.TextureAtlasData
  44415. * @version DragonBones 3.0
  44416. * @language zh_CN
  44417. */
  44418. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  44419. /**
  44420. * - Remove a TextureAtlasData instance.
  44421. * @param name - The TextureAtlasData instance cache name.
  44422. * @param disposeData - Whether to dispose data.
  44423. * @see #parseTextureAtlasData()
  44424. * @see #getTextureAtlasData()
  44425. * @see #addTextureAtlasData()
  44426. * @see dragonBones.TextureAtlasData
  44427. * @version DragonBones 3.0
  44428. * @language en_US
  44429. */
  44430. /**
  44431. * - 移除 TextureAtlasData 实例。
  44432. * @param name - TextureAtlasData 实例的缓存名称。
  44433. * @param disposeData - 是否释放数据。
  44434. * @see #parseTextureAtlasData()
  44435. * @see #getTextureAtlasData()
  44436. * @see #addTextureAtlasData()
  44437. * @see dragonBones.TextureAtlasData
  44438. * @version DragonBones 3.0
  44439. * @language zh_CN
  44440. */
  44441. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  44442. /**
  44443. * - Get a specific armature data.
  44444. * @param name - The armature data name.
  44445. * @param dragonBonesName - The cached name for DragonbonesData instance.
  44446. * @see dragonBones.ArmatureData
  44447. * @version DragonBones 5.1
  44448. * @language en_US
  44449. */
  44450. /**
  44451. * - 获取特定的骨架数据。
  44452. * @param name - 骨架数据名称。
  44453. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  44454. * @see dragonBones.ArmatureData
  44455. * @version DragonBones 5.1
  44456. * @language zh_CN
  44457. */
  44458. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  44459. /**
  44460. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  44461. * @param disposeData - Whether to dispose data.
  44462. * @version DragonBones 4.5
  44463. * @language en_US
  44464. */
  44465. /**
  44466. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  44467. * @param disposeData - 是否释放数据。
  44468. * @version DragonBones 4.5
  44469. * @language zh_CN
  44470. */
  44471. clear(disposeData?: boolean): void;
  44472. /**
  44473. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  44474. * @param armatureName - The armature data name.
  44475. * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature)
  44476. * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data)
  44477. * @returns The armature.
  44478. * @example
  44479. * <pre>
  44480. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  44481. * armature.clock = factory.clock;
  44482. * </pre>
  44483. * @see dragonBones.DragonBonesData
  44484. * @see dragonBones.ArmatureData
  44485. * @see dragonBones.Armature
  44486. * @version DragonBones 3.0
  44487. * @language en_US
  44488. */
  44489. /**
  44490. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  44491. * @param armatureName - 骨架数据名称。
  44492. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  44493. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  44494. * @returns 骨架。
  44495. * @example
  44496. * <pre>
  44497. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  44498. * armature.clock = factory.clock;
  44499. * </pre>
  44500. * @see dragonBones.DragonBonesData
  44501. * @see dragonBones.ArmatureData
  44502. * @see dragonBones.Armature
  44503. * @version DragonBones 3.0
  44504. * @language zh_CN
  44505. */
  44506. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  44507. /**
  44508. * @private
  44509. */
  44510. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  44511. /**
  44512. * - Replaces the current display data for a particular slot with a specific display data.
  44513. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  44514. * @param dragonBonesName - The DragonBonesData instance cache name.
  44515. * @param armatureName - The armature data name.
  44516. * @param slotName - The slot data name.
  44517. * @param displayName - The display data name.
  44518. * @param slot - The slot.
  44519. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  44520. * @example
  44521. * <pre>
  44522. * let slot = armature.getSlot("weapon");
  44523. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  44524. * </pre>
  44525. * @version DragonBones 4.5
  44526. * @language en_US
  44527. */
  44528. /**
  44529. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  44530. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  44531. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  44532. * @param armatureName - 骨架数据名称。
  44533. * @param slotName - 插槽数据名称。
  44534. * @param displayName - 显示对象数据名称。
  44535. * @param slot - 插槽。
  44536. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  44537. * @example
  44538. * <pre>
  44539. * let slot = armature.getSlot("weapon");
  44540. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  44541. * </pre>
  44542. * @version DragonBones 4.5
  44543. * @language zh_CN
  44544. */
  44545. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  44546. /**
  44547. * @private
  44548. */
  44549. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  44550. /**
  44551. * - Share specific skin data with specific armature.
  44552. * @param armature - The armature.
  44553. * @param skin - The skin data.
  44554. * @param isOverride - Whether it completely override the original skin. (Default: false)
  44555. * @param exclude - A list of slot names that do not need to be replace.
  44556. * @example
  44557. * <pre>
  44558. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  44559. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  44560. * if (armatureDataB && armatureDataB.defaultSkin) {
  44561. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  44562. * }
  44563. * </pre>
  44564. * @see dragonBones.Armature
  44565. * @see dragonBones.SkinData
  44566. * @version DragonBones 5.6
  44567. * @language en_US
  44568. */
  44569. /**
  44570. * - 将特定的皮肤数据共享给特定的骨架使用。
  44571. * @param armature - 骨架。
  44572. * @param skin - 皮肤数据。
  44573. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  44574. * @param exclude - 不需要被替换的插槽名称列表。
  44575. * @example
  44576. * <pre>
  44577. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  44578. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  44579. * if (armatureDataB && armatureDataB.defaultSkin) {
  44580. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  44581. * }
  44582. * </pre>
  44583. * @see dragonBones.Armature
  44584. * @see dragonBones.SkinData
  44585. * @version DragonBones 5.6
  44586. * @language zh_CN
  44587. */
  44588. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  44589. /**
  44590. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  44591. * This enables you to make a armature template so that other armature without animations can share it's animations.
  44592. * @param armature - The armtaure.
  44593. * @param armatureData - The armature data.
  44594. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  44595. * @example
  44596. * <pre>
  44597. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  44598. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  44599. * if (armatureDataB) {
  44600. * factory.replaceAnimation(armatureA, armatureDataB);
  44601. * }
  44602. * </pre>
  44603. * @see dragonBones.Armature
  44604. * @see dragonBones.ArmatureData
  44605. * @version DragonBones 5.6
  44606. * @language en_US
  44607. */
  44608. /**
  44609. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  44610. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  44611. * @param armature - 骨架。
  44612. * @param armatureData - 骨架数据。
  44613. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  44614. * @example
  44615. * <pre>
  44616. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  44617. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  44618. * if (armatureDataB) {
  44619. * factory.replaceAnimation(armatureA, armatureDataB);
  44620. * }
  44621. * </pre>
  44622. * @see dragonBones.Armature
  44623. * @see dragonBones.ArmatureData
  44624. * @version DragonBones 5.6
  44625. * @language zh_CN
  44626. */
  44627. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  44628. /**
  44629. * @private
  44630. */
  44631. getAllDragonBonesData(): Map<DragonBonesData>;
  44632. /**
  44633. * @private
  44634. */
  44635. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  44636. /**
  44637. * - An Worldclock instance updated by engine.
  44638. * @version DragonBones 5.7
  44639. * @language en_US
  44640. */
  44641. /**
  44642. * - 由引擎驱动的 WorldClock 实例。
  44643. * @version DragonBones 5.7
  44644. * @language zh_CN
  44645. */
  44646. readonly clock: WorldClock;
  44647. /**
  44648. * @private
  44649. */
  44650. readonly dragonBones: DragonBones;
  44651. /**
  44652. * - Deprecated, please refer to {@link #replaceSkin}.
  44653. * @deprecated
  44654. * @language en_US
  44655. */
  44656. /**
  44657. * - 已废弃,请参考 {@link #replaceSkin}。
  44658. * @deprecated
  44659. * @language zh_CN
  44660. */
  44661. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  44662. /**
  44663. * - Deprecated, please refer to {@link #replaceAnimation}.
  44664. * @deprecated
  44665. * @language en_US
  44666. */
  44667. /**
  44668. * - 已废弃,请参考 {@link #replaceAnimation}。
  44669. * @deprecated
  44670. * @language zh_CN
  44671. */
  44672. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  44673. }
  44674. /**
  44675. * @internal
  44676. * @private
  44677. */
  44678. export class BuildArmaturePackage {
  44679. dataName: string;
  44680. textureAtlasName: string;
  44681. data: DragonBonesData;
  44682. armature: ArmatureData;
  44683. skin: SkinData | null;
  44684. }
  44685. export class DeformVertices extends BaseObject {
  44686. static toString(): string;
  44687. vertices: number[];
  44688. bones: Bone[];
  44689. verticesData: {
  44690. offset: number;
  44691. data: {
  44692. intArray: Int32Array;
  44693. floatArray: Float32Array;
  44694. };
  44695. weight: {
  44696. offset: number;
  44697. };
  44698. inheritDeform: boolean;
  44699. rotated: boolean;
  44700. };
  44701. verticesDirty: boolean;
  44702. isBonesUpdate(): boolean;
  44703. _onClear(): void;
  44704. }
  44705. }
  44706. export interface IGeometryInfo {
  44707. maxLines: number;
  44708. maxDashedLines: number;
  44709. maxTriangles: number;
  44710. }
  44711. export class GeometryRenderer {
  44712. constructor();
  44713. activate(device: gfx.Device, info?: IGeometryInfo): void;
  44714. render(renderPass: gfx.RenderPass, cmdBuff: gfx.CommandBuffer, sceneData: PipelineSceneData): void;
  44715. destroy(): void;
  44716. empty(): boolean;
  44717. update(): void;
  44718. reset(): void;
  44719. addDashedLine(v0: math.Vec3, v1: math.Vec3, color: math.Color, depthTest?: boolean): void;
  44720. addLine(v0: math.Vec3, v1: math.Vec3, color: math.Color, depthTest?: boolean): void;
  44721. addTriangle(v0: math.Vec3, v1: math.Vec3, v2: math.Vec3, color: math.Color, wireframe?: boolean, depthTest?: boolean, unlit?: boolean): void;
  44722. addQuad(v0: math.Vec3, v1: math.Vec3, v2: math.Vec3, v3: math.Vec3, color: math.Color, wireframe?: boolean, depthTest?: boolean, unlit?: boolean): void;
  44723. addBoundingBox(aabb: geometry.AABB, color: math.Color, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44724. addCross(position: math.Vec3, size: number, color: math.Color, depthTest?: boolean): void;
  44725. addFrustum(frustum: geometry.Frustum, color: math.Color, depthTest?: boolean): void;
  44726. addCapsule(center: math.Vec3, radius: number, height: number, color: math.Color, segmentsU?: number, hemiSegmentsV?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44727. addCylinder(center: math.Vec3, radius: number, height: number, color: math.Color, segments?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44728. addCone(center: math.Vec3, radius: number, height: number, color: math.Color, segments?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44729. addCircle(center: math.Vec3, radius: number, color: math.Color, segments?: number, depthTest?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44730. addArc(center: math.Vec3, radius: number, color: math.Color, startAngle: number, endAngle: number, segments?: number, depthTest?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44731. addPolygon(center: math.Vec3, radius: number, color: math.Color, segments?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44732. addDisc(center: math.Vec3, radius: number, color: math.Color, segments?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44733. addSector(center: math.Vec3, radius: number, color: math.Color, startAngle: number, endAngle: number, segments?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44734. addSphere(center: math.Vec3, radius: number, color: math.Color, segmentsU?: number, segmentsV?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44735. addTorus(center: math.Vec3, bigRadius: number, radius: number, color: math.Color, segmentsU?: number, segmentsV?: number, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44736. addOctahedron(center: math.Vec3, radius: number, color: math.Color, wireframe?: boolean, depthTest?: boolean, unlit?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44737. addBezier(v0: math.Vec3, v1: math.Vec3, v2: math.Vec3, v3: math.Vec3, color: math.Color, segments?: number, depthTest?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44738. addSpline(spline: geometry.Spline, color: math.Color, index?: number, knotSize?: number, segments?: number, depthTest?: boolean): void;
  44739. addMesh(center: math.Vec3, vertices: Array<math.Vec3>, color: math.Color, depthTest?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44740. addIndexedMesh(center: math.Vec3, vertices: Array<math.Vec3>, indices: Array<number>, color: math.Color, depthTest?: boolean, useTransform?: boolean, transform?: math.Mat4): void;
  44741. }
  44742. export class EmptyDevice extends gfx.Device {
  44743. initialize(info: gfx.DeviceInfo): boolean;
  44744. destroy(): void;
  44745. flushCommands(cmdBuffs: Readonly<gfx.CommandBuffer[]>): void;
  44746. acquire(swapchains: Readonly<gfx.Swapchain[]>): void;
  44747. present(): void;
  44748. createCommandBuffer(info: Readonly<gfx.CommandBufferInfo>): gfx.CommandBuffer;
  44749. createSwapchain(info: Readonly<gfx.SwapchainInfo>): gfx.Swapchain;
  44750. createBuffer(info: Readonly<gfx.BufferInfo> | Readonly<gfx.BufferViewInfo>): gfx.Buffer;
  44751. createTexture(info: Readonly<gfx.TextureInfo> | Readonly<gfx.TextureViewInfo>): gfx.Texture;
  44752. createDescriptorSet(info: Readonly<gfx.DescriptorSetInfo>): gfx.DescriptorSet;
  44753. createShader(info: Readonly<gfx.ShaderInfo>): gfx.Shader;
  44754. createInputAssembler(info: Readonly<gfx.InputAssemblerInfo>): gfx.InputAssembler;
  44755. createRenderPass(info: Readonly<gfx.RenderPassInfo>): gfx.RenderPass;
  44756. createFramebuffer(info: Readonly<gfx.FramebufferInfo>): gfx.Framebuffer;
  44757. createDescriptorSetLayout(info: Readonly<gfx.DescriptorSetLayoutInfo>): gfx.DescriptorSetLayout;
  44758. createPipelineLayout(info: Readonly<gfx.PipelineLayoutInfo>): gfx.PipelineLayout;
  44759. createPipelineState(info: Readonly<gfx.PipelineStateInfo>): gfx.PipelineState;
  44760. createQueue(info: Readonly<gfx.QueueInfo>): gfx.Queue;
  44761. getSampler(info: Readonly<gfx.SamplerInfo>): gfx.Sampler;
  44762. getSwapchains(): Readonly<gfx.Swapchain[]>;
  44763. getGeneralBarrier(info: Readonly<gfx.GeneralBarrierInfo>): gfx.GeneralBarrier;
  44764. getTextureBarrier(info: Readonly<gfx.TextureBarrierInfo>): gfx.TextureBarrier;
  44765. getBufferBarrier(info: Readonly<gfx.BufferBarrierInfo>): __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier;
  44766. copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44767. copyTextureToBuffers(texture: Readonly<gfx.Texture>, buffers: ArrayBufferView[], regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44768. copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44769. }
  44770. export class WebGLDevice extends gfx.Device {
  44771. get gl(): WebGLRenderingContext;
  44772. get extensions(): __private._cocos_gfx_webgl_webgl_define__IWebGLExtensions;
  44773. get stateCache(): __private._cocos_gfx_webgl_webgl_state_cache__WebGLStateCache;
  44774. get nullTex2D(): __private._cocos_gfx_webgl_webgl_texture__WebGLTexture;
  44775. get nullTexCube(): __private._cocos_gfx_webgl_webgl_texture__WebGLTexture;
  44776. get textureExclusive(): boolean[];
  44777. get bindingMappings(): __private._cocos_gfx_webgl_webgl_gpu_objects__IWebGLBindingMapping;
  44778. get blitManager(): __private._cocos_gfx_webgl_webgl_gpu_objects__IWebGLBlitManager;
  44779. protected _textureExclusive: boolean[];
  44780. initialize(info: Readonly<gfx.DeviceInfo>): boolean;
  44781. destroy(): void;
  44782. flushCommands(cmdBuffs: gfx.CommandBuffer[]): void;
  44783. acquire(swapchains: gfx.Swapchain[]): void;
  44784. present(): void;
  44785. protected initFormatFeatures(exts: __private._cocos_gfx_webgl_webgl_define__IWebGLExtensions): void;
  44786. createCommandBuffer(info: Readonly<gfx.CommandBufferInfo>): gfx.CommandBuffer;
  44787. createSwapchain(info: Readonly<gfx.SwapchainInfo>): gfx.Swapchain;
  44788. createBuffer(info: Readonly<gfx.BufferInfo> | Readonly<gfx.BufferViewInfo>): gfx.Buffer;
  44789. createTexture(info: Readonly<gfx.TextureInfo> | Readonly<gfx.TextureViewInfo>): gfx.Texture;
  44790. createDescriptorSet(info: Readonly<gfx.DescriptorSetInfo>): gfx.DescriptorSet;
  44791. createShader(info: Readonly<gfx.ShaderInfo>): gfx.Shader;
  44792. createInputAssembler(info: Readonly<gfx.InputAssemblerInfo>): gfx.InputAssembler;
  44793. createRenderPass(info: Readonly<gfx.RenderPassInfo>): gfx.RenderPass;
  44794. createFramebuffer(info: Readonly<gfx.FramebufferInfo>): gfx.Framebuffer;
  44795. createDescriptorSetLayout(info: Readonly<gfx.DescriptorSetLayoutInfo>): gfx.DescriptorSetLayout;
  44796. createPipelineLayout(info: Readonly<gfx.PipelineLayoutInfo>): gfx.PipelineLayout;
  44797. createPipelineState(info: Readonly<gfx.PipelineStateInfo>): gfx.PipelineState;
  44798. createQueue(info: Readonly<gfx.QueueInfo>): gfx.Queue;
  44799. getSampler(info: Readonly<gfx.SamplerInfo>): gfx.Sampler;
  44800. getSwapchains(): Readonly<gfx.Swapchain[]>;
  44801. getGeneralBarrier(info: Readonly<gfx.GeneralBarrierInfo>): gfx.GeneralBarrier;
  44802. getTextureBarrier(info: Readonly<gfx.TextureBarrierInfo>): gfx.TextureBarrier;
  44803. getBufferBarrier(info: Readonly<gfx.BufferBarrierInfo>): __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier;
  44804. copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44805. copyTextureToBuffers(texture: Readonly<gfx.Texture>, buffers: ArrayBufferView[], regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44806. copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44807. }
  44808. export class WebGL2Device extends gfx.Device {
  44809. get gl(): WebGL2RenderingContext;
  44810. get extensions(): __private._cocos_gfx_webgl2_webgl2_define__IWebGL2Extensions;
  44811. get stateCache(): __private._cocos_gfx_webgl2_webgl2_state_cache__WebGL2StateCache;
  44812. get nullTex2D(): __private._cocos_gfx_webgl2_webgl2_texture__WebGL2Texture;
  44813. get nullTexCube(): __private._cocos_gfx_webgl2_webgl2_texture__WebGL2Texture;
  44814. get textureExclusive(): boolean[];
  44815. get bindingMappings(): __private._cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BindingMapping;
  44816. get blitManager(): __private._cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BlitManager | null;
  44817. protected _textureExclusive: boolean[];
  44818. initialize(info: Readonly<gfx.DeviceInfo>): boolean;
  44819. destroy(): void;
  44820. flushCommands(cmdBuffs: Readonly<gfx.CommandBuffer[]>): void;
  44821. acquire(swapchains: Readonly<gfx.Swapchain[]>): void;
  44822. present(): void;
  44823. protected initFormatFeatures(exts: __private._cocos_gfx_webgl2_webgl2_define__IWebGL2Extensions): void;
  44824. createCommandBuffer(info: Readonly<gfx.CommandBufferInfo>): gfx.CommandBuffer;
  44825. createSwapchain(info: Readonly<gfx.SwapchainInfo>): gfx.Swapchain;
  44826. createBuffer(info: Readonly<gfx.BufferInfo> | Readonly<gfx.BufferViewInfo>): gfx.Buffer;
  44827. createTexture(info: Readonly<gfx.TextureInfo> | Readonly<gfx.TextureViewInfo>): gfx.Texture;
  44828. createDescriptorSet(info: Readonly<gfx.DescriptorSetInfo>): gfx.DescriptorSet;
  44829. createShader(info: Readonly<gfx.ShaderInfo>): gfx.Shader;
  44830. createInputAssembler(info: Readonly<gfx.InputAssemblerInfo>): gfx.InputAssembler;
  44831. createRenderPass(info: Readonly<gfx.RenderPassInfo>): gfx.RenderPass;
  44832. createFramebuffer(info: Readonly<gfx.FramebufferInfo>): gfx.Framebuffer;
  44833. createDescriptorSetLayout(info: Readonly<gfx.DescriptorSetLayoutInfo>): gfx.DescriptorSetLayout;
  44834. createPipelineLayout(info: Readonly<gfx.PipelineLayoutInfo>): gfx.PipelineLayout;
  44835. createPipelineState(info: Readonly<gfx.PipelineStateInfo>): gfx.PipelineState;
  44836. createQueue(info: Readonly<gfx.QueueInfo>): gfx.Queue;
  44837. getSampler(info: Readonly<gfx.SamplerInfo>): gfx.Sampler;
  44838. getSwapchains(): Readonly<gfx.Swapchain[]>;
  44839. getGeneralBarrier(info: Readonly<gfx.GeneralBarrierInfo>): gfx.GeneralBarrier;
  44840. getTextureBarrier(info: Readonly<gfx.TextureBarrierInfo>): gfx.TextureBarrier;
  44841. getBufferBarrier(info: Readonly<gfx.BufferBarrierInfo>): __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier;
  44842. copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44843. copyTextureToBuffers(texture: Readonly<gfx.Texture>, buffers: ArrayBufferView[], regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44844. copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
  44845. }
  44846. /**
  44847. * @en Intersection2D helper class
  44848. * @zh 辅助类,用于测试形状与形状是否相交
  44849. * @class Intersection2D
  44850. */
  44851. export class Intersection2D {
  44852. static lineLine: typeof __private._cocos_physics_2d_builtin_intersection_2d__lineLine;
  44853. static lineRect: typeof __private._cocos_physics_2d_builtin_intersection_2d__lineRect;
  44854. static linePolygon: typeof __private._cocos_physics_2d_builtin_intersection_2d__linePolygon;
  44855. static rectRect: typeof __private._cocos_physics_2d_builtin_intersection_2d__rectRect;
  44856. static rectPolygon: typeof __private._cocos_physics_2d_builtin_intersection_2d__rectPolygon;
  44857. static rectCircle: typeof __private._cocos_physics_2d_builtin_intersection_2d__rectCircle;
  44858. static polygonPolygon: typeof __private._cocos_physics_2d_builtin_intersection_2d__polygonPolygon;
  44859. static circleCircle: typeof __private._cocos_physics_2d_builtin_intersection_2d__circleCircle;
  44860. static polygonCircle: typeof __private._cocos_physics_2d_builtin_intersection_2d__polygonCircle;
  44861. static pointInPolygon: typeof __private._cocos_physics_2d_builtin_intersection_2d__pointInPolygon;
  44862. static pointLineDistance: typeof __private._cocos_physics_2d_builtin_intersection_2d__pointLineDistance;
  44863. }
  44864. export const PlaceMethod: {
  44865. UNIFORM: number;
  44866. ADAPTIVE: number;
  44867. };
  44868. export interface PlacementInfo {
  44869. method: number;
  44870. nProbesX: number;
  44871. nProbesY: number;
  44872. nProbesZ: number;
  44873. minPos: math.Vec3;
  44874. maxPos: math.Vec3;
  44875. }
  44876. export class AutoPlacement {
  44877. static generate(info: PlacementInfo): math.Vec3[];
  44878. }
  44879. export class Vertex {
  44880. position: math.Vec3;
  44881. normal: math.Vec3;
  44882. coefficients: math.Vec3[];
  44883. constructor(pos: math.Vec3);
  44884. }
  44885. export class CircumSphere {
  44886. center: math.Vec3;
  44887. radiusSquared: number;
  44888. init(p0: math.Vec3, p1: math.Vec3, p2: math.Vec3, p3: math.Vec3): void;
  44889. }
  44890. /**
  44891. * inner tetrahedron or outer cell structure
  44892. */
  44893. export class Tetrahedron {
  44894. invalid: boolean;
  44895. vertex0: number;
  44896. vertex1: number;
  44897. vertex2: number;
  44898. vertex3: number;
  44899. neighbours: number[];
  44900. matrix: math.Mat3;
  44901. offset: math.Vec3;
  44902. sphere: CircumSphere;
  44903. constructor(delaunay: Delaunay, v0: number, v1: number, v2: number, v3?: number);
  44904. isInCircumSphere(point: math.Vec3): boolean;
  44905. contain(vertexIndex: number): boolean;
  44906. isInnerTetrahedron(): boolean;
  44907. isOuterCell(): boolean;
  44908. }
  44909. export class Delaunay {
  44910. _probes: Vertex[];
  44911. constructor(probes: Vertex[]);
  44912. build(): Tetrahedron[];
  44913. }
  44914. export class LightProbeSampler {
  44915. /**
  44916. * generate one sample from sphere uniformly
  44917. */
  44918. static uniformSampleSphere(u1: number, u2: number): math.Vec3;
  44919. /**
  44920. * generate ucount1 * ucount2 samples from sphere uniformly
  44921. */
  44922. static uniformSampleSphereAll(sampleCount: number): math.Vec3[];
  44923. /**
  44924. * probability density function of uniform distribution on spherical surface
  44925. */
  44926. static uniformSpherePdf(): number;
  44927. }
  44928. /**
  44929. * Spherical Harmonics utility class
  44930. */
  44931. export class SH {
  44932. /**
  44933. * update ubo data by coefficients
  44934. */
  44935. static updateUBOData(data: Float32Array, offset: number, coefficients: math.Vec3[]): void;
  44936. /**
  44937. * recreate a function from sh coefficients, which is same as SHEvaluate in shader
  44938. */
  44939. static shaderEvaluate(normal: math.Vec3, coefficients: math.Vec3[]): math.Vec3;
  44940. /**
  44941. * recreate a function from sh coefficients
  44942. */
  44943. static evaluate(sample: math.Vec3, coefficients: math.Vec3[]): math.Vec3;
  44944. /**
  44945. * project a function to sh coefficients
  44946. */
  44947. static project(samples: math.Vec3[], values: math.Vec3[]): math.Vec3[];
  44948. /**
  44949. * calculate irradiance's sh coefficients from radiance's sh coefficients directly
  44950. */
  44951. static convolveCosine(radianceCoefficients: math.Vec3[]): math.Vec3[];
  44952. /**
  44953. * return basis function count
  44954. */
  44955. static getBasisCount(): number;
  44956. /**
  44957. * evaluate from a basis function
  44958. */
  44959. static evaluateBasis(index: number, sample: math.Vec3): number;
  44960. static reduceRinging(coefficients: math.Vec3[], lambda: number): void;
  44961. }
  44962. export class LightProbesData {
  44963. get probes(): Vertex[];
  44964. get tetrahedrons(): Tetrahedron[];
  44965. empty(): boolean;
  44966. reset(): void;
  44967. updateProbes(points: math.Vec3[]): void;
  44968. updateTetrahedrons(): void;
  44969. getInterpolationSHCoefficients(tetIndex: number, weights: math.Vec4, coefficients: math.Vec3[]): boolean;
  44970. getInterpolationWeights(position: math.Vec3, tetIndex: number, weights: math.Vec4): number;
  44971. hasCoefficients(): boolean;
  44972. }
  44973. /**
  44974. * @en light probe data
  44975. * @zh 光照探针数据
  44976. */
  44977. export class LightProbes {
  44978. /**
  44979. * @en GI multiplier
  44980. * @zh GI乘数
  44981. */
  44982. set giScale(val: number);
  44983. get giScale(): number;
  44984. /**
  44985. * @en GI sample counts
  44986. * @zh GI 采样数量
  44987. */
  44988. set giSamples(val: number);
  44989. get giSamples(): number;
  44990. /**
  44991. * @en light bounces
  44992. * @zh 光照反弹次数
  44993. */
  44994. set bounces(val: number);
  44995. get bounces(): number;
  44996. /**
  44997. * @en Reduce ringing of light probe
  44998. * @zh 减少光照探针的振铃效果
  44999. */
  45000. set reduceRinging(val: number);
  45001. get reduceRinging(): number;
  45002. /**
  45003. * @en Whether to show light probe
  45004. * @zh 是否显示光照探针
  45005. */
  45006. set showProbe(val: boolean);
  45007. get showProbe(): boolean;
  45008. /**
  45009. * @en Whether to show light probe's connection
  45010. * @zh 是否显示光照探针连线
  45011. */
  45012. set showWireframe(val: boolean);
  45013. get showWireframe(): boolean;
  45014. /**
  45015. * @en Whether to show light probe's convex
  45016. * @zh 是否显示光照探针凸包
  45017. */
  45018. set showConvex(val: boolean);
  45019. get showConvex(): boolean;
  45020. /**
  45021. * @en light probe's vertex and tetrahedron data
  45022. * @zh 光照探针顶点及四面体数据
  45023. */
  45024. set data(val: LightProbesData | null);
  45025. get data(): LightProbesData | null;
  45026. /**
  45027. * @en The value of all light probe sphere display size
  45028. * @zh 光照探针全局显示大小
  45029. */
  45030. set lightProbeSphereVolume(val: number);
  45031. get lightProbeSphereVolume(): number;
  45032. protected _giScale: number;
  45033. protected _giSamples: number;
  45034. protected _bounces: number;
  45035. protected _reduceRinging: number;
  45036. protected _showProbe: boolean;
  45037. protected _showWireframe: boolean;
  45038. protected _showConvex: boolean;
  45039. protected _data: LightProbesData | null;
  45040. protected _lightProbeSphereVolume: number;
  45041. initialize(info: LightProbeInfo): void;
  45042. empty(): boolean;
  45043. }
  45044. /**
  45045. * @en The light probe group component.
  45046. * @zh 光照探针组组件。
  45047. */
  45048. export class LightProbeGroup extends Component {
  45049. protected _probes: math.Vec3[];
  45050. protected _method: number;
  45051. protected _minPos: math.Vec3;
  45052. protected _maxPos: math.Vec3;
  45053. protected _nProbesX: number;
  45054. protected _nProbesY: number;
  45055. protected _nProbesZ: number;
  45056. get probes(): math.Vec3[];
  45057. set probes(val: math.Vec3[]);
  45058. get method(): number;
  45059. /**
  45060. * @en Minimum position of the light probe group
  45061. * @zh 光照探针组包围盒最小值
  45062. */
  45063. get minPos(): math.Vec3;
  45064. set minPos(val: math.Vec3);
  45065. /**
  45066. * @en Maximum position of the light probe group
  45067. * @zh 光照探针组包围盒最大值
  45068. */
  45069. get maxPos(): math.Vec3;
  45070. set maxPos(val: math.Vec3);
  45071. get nProbesX(): number;
  45072. set nProbesX(val: number);
  45073. get nProbesY(): number;
  45074. set nProbesY(val: number);
  45075. get nProbesZ(): number;
  45076. set nProbesZ(val: number);
  45077. onLoad(): void;
  45078. onEnable(): void;
  45079. onDisable(): void;
  45080. generateLightProbes(): void;
  45081. onProbeChanged(updateTet?: boolean, emitEvent?: boolean): void;
  45082. }
  45083. /**
  45084. * @en Particle System base class.
  45085. * cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
  45086. * 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
  45087. * cocos2d uses a another approach, but the results are almost identical.
  45088. * cocos2d supports all the variables used by Particle Designer plus a bit more:
  45089. * - spinning particles (supported when using ParticleSystem)
  45090. * - tangential acceleration (Gravity mode)
  45091. * - radial acceleration (Gravity mode)
  45092. * - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only)
  45093. * It is possible to customize any of the above mentioned properties in runtime. Example:
  45094. * emitter.radialAccel = 15;
  45095. * emitter.startSpin = 0;
  45096. *
  45097. * @zh 2D 粒子基础类型
  45098. * cocos2d 同样支 Particle Designer (http://particledesigner.71squared.com/) 生成的粒子
  45099. * 粒子设计器中的 半径模式 使用 30 hz 的固定发射率。由于 cocos2d 无法保证,
  45100. * cocos2d 使用了另一种方法,但结果几乎相同。
  45101. * cocos2d 支持 Particle Designer 使用的所有变量,还有:
  45102. * -旋转粒子(使用粒子系统时支持)
  45103. * -切向加速度(重力模式)
  45104. * -径向加速度(重力模式)
  45105. * -半径方向(半径模式)(Particle Designer 仅支持向外到向内的方向)
  45106. * 可以在运行时自定义上述任何属性。例如:
  45107. * emitter.radialAccel = 15;
  45108. * emitter.startSpin = 0;
  45109. *
  45110. */
  45111. export class ParticleSystem2D extends UIRenderer {
  45112. static EmitterMode: {
  45113. GRAVITY: number;
  45114. RADIUS: number;
  45115. };
  45116. static PositionType: {
  45117. FREE: number;
  45118. RELATIVE: number;
  45119. GROUPED: number;
  45120. };
  45121. static readonly DURATION_INFINITY = "Bad expression <-1>";
  45122. static readonly START_SIZE_EQUAL_TO_END_SIZE = "Bad expression <-1>";
  45123. static readonly START_RADIUS_EQUAL_TO_END_RADIUS = "Bad expression <-1>";
  45124. /**
  45125. * @en If set custom to true, then use custom properties instead of read particle file.
  45126. * @zh 是否自定义粒子属性。
  45127. */
  45128. get custom(): boolean;
  45129. set custom(value: boolean);
  45130. /**
  45131. * @en The plist file.
  45132. * @zh plist 格式的粒子配置文件。
  45133. */
  45134. get file(): ParticleAsset | null;
  45135. set file(value: ParticleAsset | null);
  45136. /**
  45137. * @en SpriteFrame used for particles display
  45138. * @zh 用于粒子呈现的 SpriteFrame
  45139. */
  45140. get spriteFrame(): SpriteFrame | null;
  45141. set spriteFrame(value: SpriteFrame | null);
  45142. /**
  45143. * @en Current quantity of particles that are being simulated.
  45144. * @zh 当前播放的粒子数量。
  45145. * @readonly
  45146. */
  45147. get particleCount(): number;
  45148. /**
  45149. * @en Maximum particles of the system.
  45150. * @zh 粒子最大数量。
  45151. */
  45152. get totalParticles(): number;
  45153. set totalParticles(value: number);
  45154. /**
  45155. * @en How many seconds the emitter wil run. -1 means 'forever'.
  45156. * @zh 发射器生存时间,单位秒,-1表示持续发射。
  45157. */
  45158. duration: number;
  45159. /**
  45160. * @en Emission rate of the particles.
  45161. * @zh 每秒发射的粒子数目。
  45162. */
  45163. emissionRate: number;
  45164. /**
  45165. * @en Life of each particle setter.
  45166. * @zh 粒子的运行时间。
  45167. */
  45168. life: number;
  45169. /**
  45170. * @en Variation of life.
  45171. * @zh 粒子的运行时间变化范围。
  45172. */
  45173. lifeVar: number;
  45174. /**
  45175. * @en Start color of each particle.
  45176. * @zh 粒子初始颜色。
  45177. */
  45178. get startColor(): math.Color;
  45179. set startColor(val: math.Color);
  45180. /**
  45181. * @en Variation of the start color.
  45182. * @zh 粒子初始颜色变化范围。
  45183. */
  45184. get startColorVar(): math.Color;
  45185. set startColorVar(val: math.Color);
  45186. set color(value: Readonly<math.Color>);
  45187. get color(): Readonly<math.Color>;
  45188. /**
  45189. * @en Ending color of each particle.
  45190. * @zh 粒子结束颜色。
  45191. */
  45192. get endColor(): math.Color;
  45193. set endColor(val: math.Color);
  45194. /**
  45195. * @en Variation of the end color.
  45196. * @zh 粒子结束颜色变化范围。
  45197. */
  45198. get endColorVar(): math.Color;
  45199. set endColorVar(val: math.Color);
  45200. /**
  45201. * @en Angle of each particle setter.
  45202. * @zh 粒子角度。
  45203. */
  45204. angle: number;
  45205. /**
  45206. * @en Variation of angle of each particle setter.
  45207. * @zh 粒子角度变化范围。
  45208. */
  45209. angleVar: number;
  45210. /**
  45211. * @en Start size in pixels of each particle.
  45212. * @zh 粒子的初始大小。
  45213. */
  45214. startSize: number;
  45215. /**
  45216. * @en Variation of start size in pixels.
  45217. * @zh 粒子初始大小的变化范围。
  45218. */
  45219. startSizeVar: number;
  45220. /**
  45221. * @en End size in pixels of each particle.
  45222. * @zh 粒子结束时的大小。
  45223. */
  45224. endSize: number;
  45225. /**
  45226. * @en Variation of end size in pixels.
  45227. * @zh 粒子结束大小的变化范围。
  45228. */
  45229. endSizeVar: number;
  45230. /**
  45231. * @en Start angle of each particle.
  45232. * @zh 粒子开始自旋角度。
  45233. */
  45234. startSpin: number;
  45235. /**
  45236. * @en Variation of start angle.
  45237. * @zh 粒子开始自旋角度变化范围。
  45238. */
  45239. startSpinVar: number;
  45240. /**
  45241. * @en End angle of each particle.
  45242. * @zh 粒子结束自旋角度。
  45243. */
  45244. endSpin: number;
  45245. /**
  45246. * @en Variation of end angle.
  45247. * @zh 粒子结束自旋角度变化范围。
  45248. */
  45249. endSpinVar: number;
  45250. /**
  45251. * @en Source position of the emitter.
  45252. * @zh 发射器位置。
  45253. */
  45254. sourcePos: math.Vec2;
  45255. /**
  45256. * @en Variation of source position.
  45257. * @zh 发射器位置的变化范围。(横向和纵向)
  45258. */
  45259. posVar: math.Vec2;
  45260. /**
  45261. * @en Particles movement type.
  45262. * @zh 粒子位置类型。
  45263. */
  45264. get positionType(): number;
  45265. set positionType(val: number);
  45266. /**
  45267. * @en Preview particle system effect.
  45268. * @ch 查看粒子效果
  45269. */
  45270. get preview(): boolean;
  45271. set preview(val: boolean);
  45272. /**
  45273. * @en Particles emitter modes.
  45274. * @zh 发射器类型。
  45275. */
  45276. emitterMode: number;
  45277. /**
  45278. * @en Gravity of the emitter.
  45279. * @zh 重力。
  45280. */
  45281. gravity: math.Vec2;
  45282. /**
  45283. * @en Speed of the emitter.
  45284. * @zh 速度。
  45285. */
  45286. speed: number;
  45287. /**
  45288. * @en Variation of the speed.
  45289. * @zh 速度变化范围。
  45290. */
  45291. speedVar: number;
  45292. /**
  45293. * @en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  45294. * @zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。
  45295. */
  45296. tangentialAccel: number;
  45297. /**
  45298. * @en Variation of the tangential acceleration.
  45299. * @zh 每个粒子的切向加速度变化范围。
  45300. */
  45301. tangentialAccelVar: number;
  45302. /**
  45303. * @en Acceleration of each particle. Only available in 'Gravity' mode.
  45304. * @zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。
  45305. */
  45306. radialAccel: number;
  45307. /**
  45308. * @en Variation of the radial acceleration.
  45309. * @zh 粒子径向加速度变化范围。
  45310. */
  45311. radialAccelVar: number;
  45312. /**
  45313. * @en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  45314. * @zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。
  45315. */
  45316. rotationIsDir: boolean;
  45317. /**
  45318. * @en Starting radius of the particles. Only available in 'Radius' mode.
  45319. * @zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。
  45320. */
  45321. startRadius: number;
  45322. /**
  45323. * @en Variation of the starting radius.
  45324. * @zh 初始半径变化范围。
  45325. */
  45326. startRadiusVar: number;
  45327. /**
  45328. * @en Ending radius of the particles. Only available in 'Radius' mode.
  45329. * @zh 结束半径,只有在半径模式下可用。
  45330. */
  45331. endRadius: number;
  45332. /**
  45333. * @en Variation of the ending radius.
  45334. * @zh 结束半径变化范围。
  45335. */
  45336. endRadiusVar: number;
  45337. /**
  45338. * @en Number of degrees to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  45339. * @zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。
  45340. */
  45341. rotatePerS: number;
  45342. /**
  45343. * @en Variation of the degrees to rotate a particle around the source pos per second.
  45344. * @zh 粒子每秒围绕起始点的旋转角度变化范围。
  45345. */
  45346. rotatePerSVar: number;
  45347. /**
  45348. * @en Indicate whether the system simulation have stopped.
  45349. * @zh 指示粒子播放是否完毕。
  45350. */
  45351. get stopped(): boolean;
  45352. /**
  45353. * @en Indicate whether the particle system is activated.
  45354. * @zh 是否激活粒子。
  45355. * @readonly
  45356. */
  45357. get active(): boolean;
  45358. get assembler(): IAssembler | null;
  45359. aspectRatio: number;
  45360. /**
  45361. * The temporary SpriteFrame object used for the renderer. Because there is no corresponding asset, it can't be serialized.
  45362. * @internal since v3.5.0, this is an engine private interface that will be removed in the future.
  45363. */
  45364. _renderSpriteFrame: SpriteFrame | null;
  45365. /**
  45366. * @internal since v3.5.0, this is an engine private interface that will be removed in the future.
  45367. */
  45368. _simulator: __private._cocos_particle_2d_particle_simulator_2d__Simulator;
  45369. /**
  45370. * @en If set to true, the particle system will automatically start playing on onLoad.
  45371. * @zh 如果设置为 true 运行时会自动发射粒子。
  45372. */
  45373. playOnLoad: boolean;
  45374. /**
  45375. * @en Indicate whether the owner node will be auto-removed when it has no particles left.
  45376. * @zh 粒子播放完毕后自动销毁所在的节点。
  45377. */
  45378. autoRemoveOnFinish: boolean;
  45379. constructor();
  45380. onEnable(): void;
  45381. onDestroy(): void;
  45382. onFocusInEditor(): void;
  45383. onLostFocusInEditor(): void;
  45384. __preload(): void;
  45385. protected _flushAssembler(): void;
  45386. protected lateUpdate(dt: any): void;
  45387. /**
  45388. * @en Add a particle to the emitter.
  45389. * @zh 添加一个粒子到发射器中。
  45390. * @return {Boolean}
  45391. */
  45392. addParticle(): void;
  45393. /**
  45394. * @en Stop emitting particles. Running particles will continue to run until they die.
  45395. * @zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  45396. * @example
  45397. * // stop particle system.
  45398. * myParticleSystem.stopSystem();
  45399. */
  45400. stopSystem(): void;
  45401. /**
  45402. * @en Kill all living particles.
  45403. * @zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  45404. * @example
  45405. * // play particle system.
  45406. * myParticleSystem.resetSystem();
  45407. */
  45408. resetSystem(): void;
  45409. /**
  45410. * @en Whether or not the system is full.
  45411. * @zh 发射器中粒子是否大于等于设置的总粒子数量。
  45412. * @return {Boolean}
  45413. */
  45414. isFull(): boolean;
  45415. /**
  45416. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45417. */
  45418. _applyFile(): void;
  45419. /**
  45420. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45421. */
  45422. _initTextureWithDictionary(dict: any): boolean;
  45423. /**
  45424. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45425. */
  45426. _initWithDictionary(dict: any): boolean;
  45427. /**
  45428. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45429. */
  45430. _syncAspect(): void;
  45431. /**
  45432. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45433. */
  45434. _applySpriteFrame(): void;
  45435. /**
  45436. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45437. */
  45438. _getTexture(): __private._cocos_asset_assets_texture_base__TextureBase | null;
  45439. /**
  45440. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45441. */
  45442. _updateMaterial(): void;
  45443. /**
  45444. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45445. */
  45446. _finishedSimulation(): void;
  45447. protected _canRender(): boolean;
  45448. protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  45449. protected _updatePositionType(): void;
  45450. }
  45451. /**
  45452. * @en
  45453. * cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  45454. * You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  45455. * length and color. The fadeTime controls how long it takes each vertex in <br/>
  45456. * the streak to fade out, the minimum segment size it how many pixels the <br/>
  45457. * streak will move before adding a new ribbon segment, and the texture <br/>
  45458. * length is the how many pixels the texture is stretched across. The texture <br/>
  45459. * is vertically aligned along the streak segment.
  45460. * @zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。
  45461. */
  45462. export class MotionStreak extends UIRenderer {
  45463. static Point: typeof __private._cocos_particle_2d_motion_streak_2d__Point;
  45464. /**
  45465. * @en Preview the trailing effect in editor mode.
  45466. * @zh 在编辑器模式下预览拖尾效果。
  45467. */
  45468. get preview(): boolean;
  45469. set preview(val: boolean);
  45470. /**
  45471. * @en The fade time to fade.
  45472. * @zh 拖尾的渐隐时间,以秒为单位。
  45473. * @example
  45474. * motionStreak.fadeTime = 3;
  45475. */
  45476. get fadeTime(): number;
  45477. set fadeTime(val: number);
  45478. /**
  45479. * @en The minimum segment size.
  45480. * @zh 拖尾之间最小距离。
  45481. * @example
  45482. * motionStreak.minSeg = 3;
  45483. */
  45484. get minSeg(): number;
  45485. set minSeg(val: number);
  45486. /**
  45487. * @en The stroke's width.
  45488. * @zh 拖尾的宽度。
  45489. * @example
  45490. * motionStreak.stroke = 64;
  45491. */
  45492. get stroke(): number;
  45493. set stroke(val: number);
  45494. /**
  45495. * @en The texture of the MotionStreak.
  45496. * @zh 拖尾的贴图。
  45497. * @example
  45498. * motionStreak.texture = newTexture;
  45499. */
  45500. get texture(): Texture2D | null;
  45501. set texture(val: Texture2D | null);
  45502. /**
  45503. * @en The fast Mode.
  45504. * @zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。
  45505. * @example
  45506. * motionStreak.fastMode = true;
  45507. */
  45508. get fastMode(): boolean;
  45509. set fastMode(val: boolean);
  45510. get points(): __private._cocos_particle_2d_motion_streak_2d__Point[];
  45511. onEnable(): void;
  45512. protected _flushAssembler(): void;
  45513. onFocusInEditor(): void;
  45514. onLostFocusInEditor(): void;
  45515. /**
  45516. * @en Remove all living segments of the ribbon.
  45517. * @zh 删除当前所有的拖尾片段。
  45518. * @example
  45519. * // Remove all living segments of the ribbon.
  45520. * myMotionStreak.reset();
  45521. */
  45522. reset(): void;
  45523. lateUpdate(dt: any): void;
  45524. /**
  45525. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45526. */
  45527. _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  45528. }
  45529. export const MotionStreakAssemblerManager: IAssemblerManager;
  45530. export const ParticleSystem2DAssembler: IAssemblerManager;
  45531. /**
  45532. * @en Class for 2D particle asset handling.
  45533. * @zh 2D 粒子资产
  45534. * @class ParticleAsset
  45535. * @extends Asset
  45536. */
  45537. export class ParticleAsset extends Asset {
  45538. spriteFrame: SpriteFrame | null;
  45539. }
  45540. export class Billboard extends Component {
  45541. /**
  45542. * @zh Billboard纹理。
  45543. */
  45544. get texture(): null;
  45545. set texture(val: null);
  45546. /**
  45547. * @zh 高度。
  45548. */
  45549. get height(): number;
  45550. set height(val: number);
  45551. /**
  45552. * @zh 宽度。
  45553. */
  45554. get width(): number;
  45555. set width(val: number);
  45556. /**
  45557. * @zh billboard绕中心点旋转的角度
  45558. */
  45559. get rotation(): number;
  45560. set rotation(val: number);
  45561. get technique(): number;
  45562. set technique(val: number);
  45563. constructor();
  45564. onLoad(): void;
  45565. onEnable(): void;
  45566. onDisable(): void;
  45567. }
  45568. export class Line extends ModelRenderer {
  45569. /**
  45570. * @zh 显示的纹理。
  45571. * @en Texture used.
  45572. */
  45573. get texture(): null;
  45574. set texture(val: null);
  45575. get lineMaterial(): Material | null;
  45576. set lineMaterial(val: Material | null);
  45577. get sharedMaterials(): (Material | null)[];
  45578. set sharedMaterials(val: (Material | null)[]);
  45579. /**
  45580. * @zh positions是否为世界空间坐标。
  45581. * @en Whether positions are world space coordinates.
  45582. */
  45583. get worldSpace(): boolean;
  45584. set worldSpace(val: boolean);
  45585. /**
  45586. * @en Inflection point positions of each polyline.
  45587. * @zh 每段折线的拐点坐标。
  45588. */
  45589. get positions(): math.Vec3[];
  45590. set positions(val: math.Vec3[]);
  45591. /**
  45592. * @zh 线段的宽度。
  45593. * @en Width of this line.
  45594. */
  45595. get width(): CurveRange;
  45596. set width(val: CurveRange);
  45597. /**
  45598. * @zh 线段颜色。
  45599. * @en Color of this line.
  45600. */
  45601. get color(): GradientRange;
  45602. set color(val: GradientRange);
  45603. /**
  45604. * @zh 图块数。
  45605. * @en Texture tile count.
  45606. */
  45607. get tile(): math.Vec2;
  45608. set tile(val: math.Vec2);
  45609. get offset(): math.Vec2;
  45610. set offset(val: math.Vec2);
  45611. constructor();
  45612. onLoad(): void;
  45613. onEnable(): void;
  45614. onDisable(): void;
  45615. protected _attachToScene(): void;
  45616. protected _onMaterialModified(index: number, material: Material | null): void;
  45617. }
  45618. /**
  45619. * @en
  45620. * Particle system component, which can make many effects such as smoke and fire.
  45621. * Include some interesting modules and components such as Velocity Overtime, Force Overtime, Trail and Noise.
  45622. * You can open these modules to see how the particles animate.
  45623. * @zh
  45624. * 粒子系统能够用来制作许多特效,例如 烟雾和火焰。
  45625. * 包含一些有趣的模块,例如 速度模块,受力模块,拖尾模块和噪声模块。
  45626. * 打开这些模块可以看到粒子如何进行变化。
  45627. */
  45628. export class ParticleSystem extends ModelRenderer {
  45629. /**
  45630. * @en Maximum particle capacity to generate.
  45631. * @zh 粒子系统能生成的最大粒子数量。
  45632. */
  45633. get capacity(): number;
  45634. set capacity(val: number);
  45635. /**
  45636. * @en The initial color of the particle.
  45637. * @zh 粒子初始颜色。
  45638. */
  45639. startColor: GradientRange;
  45640. /**
  45641. * @en The space of particle scaling.
  45642. * @zh 计算粒子缩放的空间。
  45643. */
  45644. scaleSpace: number;
  45645. /**
  45646. * @en Whether to modify particle size on XYZ axis.
  45647. * @zh 是否需要修改粒子在三个轴上的大小。
  45648. */
  45649. startSize3D: boolean;
  45650. /**
  45651. * @en The initial X size of the particle.
  45652. * @zh 粒子初始x轴方向大小。
  45653. */
  45654. startSizeX: CurveRange;
  45655. /**
  45656. * @en The initial Y size of the particle.
  45657. * @zh 粒子初始y轴方向大小。
  45658. */
  45659. startSizeY: CurveRange;
  45660. /**
  45661. * @en The initial Z size of the particle.
  45662. * @zh 粒子初始z轴方向大小。
  45663. */
  45664. startSizeZ: CurveRange;
  45665. /**
  45666. * @en The initial velocity of the particle.
  45667. * @zh 粒子初始速度。
  45668. */
  45669. startSpeed: CurveRange;
  45670. /**
  45671. * @en Whether to modify particle rotation on XYZ axis.
  45672. * @zh 是否需要修改粒子在三个轴上的旋转。
  45673. */
  45674. startRotation3D: boolean;
  45675. /**
  45676. * @en The initial rotation angle of the particle on X axis.
  45677. * @zh 粒子初始x轴旋转角度。
  45678. */
  45679. startRotationX: CurveRange;
  45680. /**
  45681. * @en The initial rotation angle of the particle on Y axis.
  45682. * @zh 粒子初始y轴旋转角度。
  45683. */
  45684. startRotationY: CurveRange;
  45685. /**
  45686. * @en The initial rotation angle of the particle on Z axis.
  45687. * @zh 粒子初始z轴旋转角度。
  45688. */
  45689. startRotationZ: CurveRange;
  45690. /**
  45691. * @en The time delay to start emission after the particle system starts running.
  45692. * @zh 粒子系统开始运行后,延迟粒子发射的时间。
  45693. */
  45694. startDelay: CurveRange;
  45695. /**
  45696. * @en Particle life time.
  45697. * @zh 粒子生命周期。
  45698. */
  45699. startLifetime: CurveRange;
  45700. /**
  45701. * @en Particle system duration time.
  45702. * @zh 粒子系统运行时间。
  45703. */
  45704. duration: number;
  45705. /**
  45706. * @en Whether the particle system is looping.
  45707. * @zh 粒子系统是否循环播放。
  45708. */
  45709. loop: boolean;
  45710. /**
  45711. * @en Play one round before start this particle system.
  45712. * @zh 选中之后,粒子系统会以已播放完一轮之后的状态开始播放(仅当循环播放启用时有效)。
  45713. */
  45714. get prewarm(): boolean;
  45715. set prewarm(val: boolean);
  45716. /**
  45717. * @en The simulation space of the particle system, it could be world, local or custom.
  45718. * @zh 选择粒子系统所在的坐标系[[Space]]。<br>
  45719. */
  45720. get simulationSpace(): number;
  45721. set simulationSpace(val: number);
  45722. /**
  45723. * @en The simulation speed of the particle system.
  45724. * @zh 控制整个粒子系统的更新速度。
  45725. */
  45726. simulationSpeed: number;
  45727. /**
  45728. * @en Automatically start playing after particle system initialized.
  45729. * @zh 粒子系统加载后是否自动开始播放。
  45730. */
  45731. playOnAwake: boolean;
  45732. /**
  45733. * @en The gravity of the particle system.
  45734. * @zh 粒子受重力影响的重力系数。
  45735. */
  45736. gravityModifier: CurveRange;
  45737. /**
  45738. * @en The value curve of emission rate over time.
  45739. * @zh 随时间推移发射的粒子数的变化曲线。
  45740. */
  45741. rateOverTime: CurveRange;
  45742. /**
  45743. * @en The value curve of emission rate over distance.
  45744. * @zh 每移动单位距离发射的粒子数的变化曲线。
  45745. */
  45746. rateOverDistance: CurveRange;
  45747. /**
  45748. * @en Burst triggers of the particle system.
  45749. * @zh 设定在指定时间发射指定数量的粒子的 burst 的数量。
  45750. */
  45751. bursts: Burst[];
  45752. /**
  45753. * @en Enable particle culling switch. Open it to enable particle culling.
  45754. * If enabled will generate emitter bounding box and emitters outside the frustum will be culled.
  45755. * @zh 粒子剔除开关,如果打开将会生成一个发射器包围盒,包围盒在相机外发射器将被剔除。
  45756. */
  45757. set renderCulling(value: boolean);
  45758. get renderCulling(): boolean;
  45759. /**
  45760. * @en Particle culling mode option. Includes pause, pause and catchup, always simulate.
  45761. * @zh 粒子剔除模式选择。包括暂停模拟,暂停以后快进继续以及不间断模拟。
  45762. */
  45763. get cullingMode(): number;
  45764. set cullingMode(value: number);
  45765. _cullingMode: number;
  45766. /**
  45767. * @en Emitter culling mode.
  45768. * @zh 发射器的各种剔除模式。
  45769. */
  45770. static CullingMode: {
  45771. Pause: number;
  45772. PauseAndCatchup: number;
  45773. AlwaysSimulate: number;
  45774. };
  45775. /**
  45776. * @en Particle bounding box half width.
  45777. * @zh 粒子包围盒半宽。
  45778. */
  45779. get aabbHalfX(): number;
  45780. set aabbHalfX(value: number);
  45781. /**
  45782. * @en Particle bounding box half height.
  45783. * @zh 粒子包围盒半高。
  45784. */
  45785. get aabbHalfY(): number;
  45786. set aabbHalfY(value: number);
  45787. /**
  45788. * @en Particle bounding box half depth.
  45789. * @zh 粒子包围盒半深。
  45790. */
  45791. get aabbHalfZ(): number;
  45792. set aabbHalfZ(value: number);
  45793. /**
  45794. * @en Culling module data before serialize.
  45795. * @zh 序列化之前剔除不需要的模块数据。
  45796. */
  45797. get dataCulling(): boolean;
  45798. set dataCulling(value: boolean);
  45799. get sharedMaterials(): any;
  45800. set sharedMaterials(val: any);
  45801. _colorOverLifetimeModule: __private._cocos_particle_animator_color_overtime__default | null;
  45802. /**
  45803. * @en The module controlling particle's color over life time.
  45804. * @zh 颜色控制模块。
  45805. */
  45806. get colorOverLifetimeModule(): __private._cocos_particle_animator_color_overtime__default | null;
  45807. set colorOverLifetimeModule(val: __private._cocos_particle_animator_color_overtime__default | null);
  45808. _shapeModule: __private._cocos_particle_emitter_shape_module__default | null;
  45809. /**
  45810. * @en The module controlling emitter's shape.
  45811. * @zh 粒子发射器模块。
  45812. */
  45813. get shapeModule(): __private._cocos_particle_emitter_shape_module__default | null;
  45814. set shapeModule(val: __private._cocos_particle_emitter_shape_module__default | null);
  45815. _sizeOvertimeModule: __private._cocos_particle_animator_size_overtime__default | null;
  45816. /**
  45817. * @en The module controlling particle's size over time.
  45818. * @zh 粒子大小模块。
  45819. */
  45820. get sizeOvertimeModule(): __private._cocos_particle_animator_size_overtime__default | null;
  45821. set sizeOvertimeModule(val: __private._cocos_particle_animator_size_overtime__default | null);
  45822. _velocityOvertimeModule: __private._cocos_particle_animator_velocity_overtime__default | null;
  45823. /**
  45824. * @en The module controlling particle's velocity over time.
  45825. * @zh 粒子速度模块。
  45826. */
  45827. get velocityOvertimeModule(): __private._cocos_particle_animator_velocity_overtime__default | null;
  45828. set velocityOvertimeModule(val: __private._cocos_particle_animator_velocity_overtime__default | null);
  45829. _forceOvertimeModule: __private._cocos_particle_animator_force_overtime__default | null;
  45830. /**
  45831. * @en The module controlling the force applied to particles over time.
  45832. * @zh 粒子加速度模块。
  45833. */
  45834. get forceOvertimeModule(): __private._cocos_particle_animator_force_overtime__default | null;
  45835. set forceOvertimeModule(val: __private._cocos_particle_animator_force_overtime__default | null);
  45836. _limitVelocityOvertimeModule: __private._cocos_particle_animator_limit_velocity_overtime__default | null;
  45837. /**
  45838. * @en The module which limits the velocity applied to particles over time, only supported in CPU particle system.
  45839. * @zh 粒子限制速度模块(只支持 CPU 粒子)。
  45840. */
  45841. get limitVelocityOvertimeModule(): __private._cocos_particle_animator_limit_velocity_overtime__default | null;
  45842. set limitVelocityOvertimeModule(val: __private._cocos_particle_animator_limit_velocity_overtime__default | null);
  45843. _rotationOvertimeModule: __private._cocos_particle_animator_rotation_overtime__default | null;
  45844. /**
  45845. * @en The module controlling the rotation of particles over time.
  45846. * @zh 粒子旋转模块。
  45847. */
  45848. get rotationOvertimeModule(): __private._cocos_particle_animator_rotation_overtime__default | null;
  45849. set rotationOvertimeModule(val: __private._cocos_particle_animator_rotation_overtime__default | null);
  45850. _textureAnimationModule: __private._cocos_particle_animator_texture_animation__default | null;
  45851. /**
  45852. * @en The module controlling the texture animation of particles.
  45853. * @zh 贴图动画模块。
  45854. */
  45855. get textureAnimationModule(): __private._cocos_particle_animator_texture_animation__default | null;
  45856. set textureAnimationModule(val: __private._cocos_particle_animator_texture_animation__default | null);
  45857. /**
  45858. * @en The module controlling noise map applied to the particles, only supported in CPU particle system.
  45859. * @zh 噪声动画模块,仅支持 CPU 粒子。
  45860. */
  45861. get noiseModule(): __private._cocos_particle_animator_noise_module__NoiseModule | null;
  45862. set noiseModule(val: __private._cocos_particle_animator_noise_module__NoiseModule | null);
  45863. _trailModule: __private._cocos_particle_renderer_trail__default | null;
  45864. /**
  45865. * @en The module controlling the trail module.
  45866. * @zh 粒子轨迹模块。
  45867. */
  45868. get trailModule(): __private._cocos_particle_renderer_trail__default | null;
  45869. set trailModule(val: __private._cocos_particle_renderer_trail__default | null);
  45870. /**
  45871. * @en Particle system renderer (CPU or GPU).
  45872. * @zh 粒子系统渲染器(CPU 还是 GPU)。
  45873. */
  45874. renderer: __private._cocos_particle_renderer_particle_system_renderer_data__default;
  45875. /**
  45876. * @en Particle update processor (update every particle).
  45877. * @zh 粒子更新器(负责更新每个粒子)。
  45878. */
  45879. processor: __private._cocos_particle_renderer_particle_system_renderer_base__ParticleSystemRendererBase;
  45880. constructor();
  45881. onFocusInEditor(): void;
  45882. onLoad(): void;
  45883. /**
  45884. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45885. */
  45886. _onMaterialModified(index: number, material: Material): void;
  45887. /**
  45888. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45889. */
  45890. _onRebuildPSO(index: number, material: Material): void;
  45891. /**
  45892. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45893. */
  45894. _collectModels(): renderer.scene.Model[];
  45895. protected _attachToScene(): void;
  45896. /**
  45897. * @en Play particle system.
  45898. * @zh 播放粒子效果。
  45899. */
  45900. play(): void;
  45901. /**
  45902. * @en Pause particle system.
  45903. * @zh 暂停播放粒子效果。
  45904. */
  45905. pause(): void;
  45906. /**
  45907. * @zh 停止发射粒子。
  45908. * @en Stop emitting particles.
  45909. */
  45910. stopEmitting(): void;
  45911. /**
  45912. * @en Stop particle system.
  45913. * @zh 停止播放粒子。
  45914. */
  45915. stop(): void;
  45916. /**
  45917. * @en remove all particles from current particle system.
  45918. * @zh 将所有粒子从粒子系统中清除。
  45919. */
  45920. clear(): void;
  45921. /**
  45922. * @en Get current particle capacity.
  45923. * @zh 获取当前粒子数量。
  45924. */
  45925. getParticleCount(): number;
  45926. /**
  45927. * @ignore
  45928. */
  45929. setCustomData1(x: any, y: any): void;
  45930. /**
  45931. * @ignore
  45932. */
  45933. setCustomData2(x: any, y: any): void;
  45934. protected onDestroy(): void;
  45935. protected onEnable(): void;
  45936. protected onDisable(): void;
  45937. protected update(dt: number): void;
  45938. protected beforeRender(): void;
  45939. protected _onVisibilityChange(val: any): void;
  45940. /**
  45941. * @ignore
  45942. */
  45943. get isPlaying(): boolean;
  45944. /**
  45945. * @en Query particle system is paused or not.
  45946. * @zh 获取粒子系统当前是否已经暂停运行。
  45947. */
  45948. get isPaused(): boolean;
  45949. /**
  45950. * @en Query particle system is stopped or not.
  45951. * @zh 获取粒子系统当前是否已经停止。
  45952. */
  45953. get isStopped(): boolean;
  45954. /**
  45955. * @en Query particle system is emitting or not.
  45956. * @zh 获取粒子系统当前是否还在发射。
  45957. */
  45958. get isEmitting(): boolean;
  45959. /**
  45960. * @en Query particle system simulation time.
  45961. * @zh 获取粒子系统运行时间。
  45962. */
  45963. get time(): number;
  45964. /**
  45965. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  45966. */
  45967. _onBeforeSerialize(props: any): any;
  45968. /**
  45969. * @en Gets the preview of noise texture.
  45970. * @zh 获取噪声图预览。
  45971. * @param width @en Noise texture width @zh 噪声图宽度
  45972. * @param height @en Noise texture height @zh 噪声图高度
  45973. * @returns @en Noise texture RGB pixel array @zh 噪声图 RGB 纹理数组
  45974. */
  45975. getNoisePreview(width: number, height: number): number[];
  45976. }
  45977. /**
  45978. * @en Contains some util functions for particle system. Such as create and destroy particle system.
  45979. * @zh 该类包含一些粒子系统的工具函数,例如创建和销毁粒子系统。
  45980. */
  45981. export class ParticleUtils {
  45982. /**
  45983. * @en Instantiate particle system from prefab.
  45984. * @zh 从 prefab 实例化粒子系统。
  45985. */
  45986. static instantiate(prefab: any): CCObject;
  45987. /**
  45988. * @en Destroy particle system prefab.
  45989. * @zh 销毁创建出来的粒子系统prefab。
  45990. * @param prefab @en Particle system prefab to destroy. @zh 要销毁的粒子系统prefab。
  45991. */
  45992. static destroy(prefab: any): void;
  45993. /**
  45994. * @en Play particle system.
  45995. * @zh 播放粒子系统。
  45996. * @param rootNode @en Root node contains the particle system. @zh 包含粒子系统的根节点。
  45997. */
  45998. static play(rootNode: Node): void;
  45999. /**
  46000. * @en Stop particle system.
  46001. * @zh 停止播放粒子系统。
  46002. * @param rootNode @en Root node contains the particle system. @zh 包含粒子系统的根节点。
  46003. */
  46004. static stop(rootNode: Node): void;
  46005. }
  46006. /**
  46007. * @en
  46008. * CurveRange is a data structure which contains some constants or curves.
  46009. * Calculate the value by its mode and particle system will use it to change particle attribute associated with it.
  46010. * Refer [[CurveRange.Mode]] to see the detail of calculation mode.
  46011. * @zh
  46012. * CurveRange 是一类数据结构,其包含了多个常数值或曲线值,计算时其将根据计算模式计算最终值,粒子系统使用此数据结构对所有的粒子的属性进行修改。
  46013. * 详细的计算模式请参考 [[CurveRange.Mode]] 的解释。
  46014. */
  46015. export class CurveRange {
  46016. /**
  46017. * @en The curve mode. See [[Mode]].
  46018. * @zh 曲线类型 [[Mode]]。
  46019. */
  46020. static Mode: {
  46021. Constant: number;
  46022. Curve: number;
  46023. TwoCurves: number;
  46024. TwoConstants: number;
  46025. };
  46026. /**
  46027. * @en Spline will create a RealCurve when mode is curve. The mode of curve range, see [[Mode]].
  46028. * A RealCurve will be created for each spline(SplineMin & SplineMax) when mode is TwoCurves.
  46029. * @zh 当mode为Curve时,spline创建1个RealCurve,当mode为TwoCurves时,splineMax创建1个RealCurve,splineMin创建一个RealCurve。
  46030. */
  46031. set mode(mode: number);
  46032. get mode(): number;
  46033. /**
  46034. * @en The spline used when mode is Mode.Curve.
  46035. * @zh 当 mode 为Curve时,使用的曲线。
  46036. */
  46037. spline: RealCurve;
  46038. /**
  46039. * @en The min spline when mode is Mode.TwoCurves.
  46040. * @zh 当 mode 为TwoCurves时,使用的曲线下限。
  46041. */
  46042. splineMin: RealCurve;
  46043. /**
  46044. * @en Max spline when mode is TwoCurves.
  46045. * @zh 当 mode 为TwoCurves时,使用的曲线上限。
  46046. */
  46047. splineMax: RealCurve;
  46048. /**
  46049. * @en Gets/Sets the curve when use curve mode.
  46050. * @zh 当 mode 为 Curve 时,使用的曲线。
  46051. * @deprecated Since V3.3. Use `spline` instead.
  46052. */
  46053. get curve(): geometry.AnimationCurve;
  46054. set curve(value: geometry.AnimationCurve);
  46055. /**
  46056. * @en Get/Set min curve when use TwoCurves mode.
  46057. * @zh 当 mode 为 TwoCurves 时,使用的曲线下限。
  46058. * @deprecated Since V3.3. Use `splineMin` instead.
  46059. */
  46060. get curveMin(): geometry.AnimationCurve;
  46061. set curveMin(value: geometry.AnimationCurve);
  46062. /**
  46063. * @en Gets/Sets max curve when use TwoCurves mode.
  46064. * @zh 当 mode 为 TwoCurves 时,使用的曲线上限。
  46065. * @deprecated Since V3.3. Use `splineMax` instead.
  46066. */
  46067. get curveMax(): geometry.AnimationCurve;
  46068. set curveMax(value: geometry.AnimationCurve);
  46069. /**
  46070. * @en Constant value when use constant mode.
  46071. * @zh 当 mode 为 Constant 时,曲线的值。
  46072. */
  46073. constant: number;
  46074. /**
  46075. * @en Constant min value when use TwoConstants mode.
  46076. * @zh 当 mode 为 TwoConstants 时,曲线的下限。
  46077. */
  46078. constantMin: number;
  46079. /**
  46080. * @en Constant max value when use TwoConstants mode.
  46081. * @zh 当 mode 为 TwoConstants 时,曲线的上限。
  46082. */
  46083. constantMax: number;
  46084. /**
  46085. * @en Mulitplier used to evaluate spline.
  46086. * @zh 应用于曲线插值的系数。
  46087. */
  46088. multiplier: number;
  46089. constructor();
  46090. /**
  46091. * @en Calculate curve value.
  46092. * @zh 计算曲线数值。
  46093. * @param time @en Normalized time to interpolate. @zh 用于插值的归一化时间。
  46094. * @param rndRatio @en Interpolation ratio when mode is TwoCurves or TwoConstants.
  46095. * Particle attribute will pass in a random number to get a random result.
  46096. * @zh 当模式为双曲线或双常数时,使用的插值比例,通常粒子系统会传入一个随机数以获得一个随机结果。
  46097. * @returns @en Curve value. @zh 曲线的值。
  46098. */
  46099. evaluate(time: number, rndRatio: number): number;
  46100. /**
  46101. * @en Gets the max value this curve can reach.
  46102. * @zh 获得曲线能达到的最大值。
  46103. * @returns @en Max value of this curve @zh 曲线能达到的最大值
  46104. */
  46105. getMax(): number;
  46106. isZero(): boolean;
  46107. /**
  46108. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  46109. */
  46110. _onBeforeSerialize(props: any): readonly [
  46111. "mode",
  46112. "constant",
  46113. "multiplier"
  46114. ] | readonly [
  46115. "mode",
  46116. "spline",
  46117. "multiplier"
  46118. ] | readonly [
  46119. "mode",
  46120. "splineMin",
  46121. "splineMax",
  46122. "multiplier"
  46123. ] | readonly [
  46124. "mode",
  46125. "constantMin",
  46126. "constantMax",
  46127. "multiplier"
  46128. ];
  46129. }
  46130. /**
  46131. * @en
  46132. * GradientRange is a data structure which contains some constant colors or gradients.
  46133. * Calculate the color by its mode and particle system will use it to change particle attribute associated with it.
  46134. * Refer [[GradientRange.Mode]] to see the detail of calculation mode.
  46135. * @zh
  46136. * GradientRange 是一类数据结构,其包含了多个常数颜色或渐变色,计算时其将根据计算模式计算最终颜色,粒子系统使用此数据结构对所有的粒子的属性进行修改。
  46137. * 详细的计算模式请参考 [[GradientRange.Mode]] 的解释。
  46138. */
  46139. export class GradientRange {
  46140. /**
  46141. * @en Gets/Sets color gradient mode to use. See [[Mode]].
  46142. * @zh 使用的渐变色类型 参考 [[Mode]]。
  46143. */
  46144. get mode(): number;
  46145. set mode(m: number);
  46146. /**
  46147. * @en The gradient mode. See [[Mode]].
  46148. * @zh 渐变色类型 参考 [[Mode]]。
  46149. */
  46150. static Mode: {
  46151. Color: number;
  46152. Gradient: number;
  46153. TwoColors: number;
  46154. TwoGradients: number;
  46155. RandomColor: number;
  46156. };
  46157. /**
  46158. * @en Color value when use color mode.
  46159. * @zh 当 mode 为 Color 时的颜色。
  46160. */
  46161. color: math.Color;
  46162. /**
  46163. * @en Min color value when use TwoColors mode.
  46164. * @zh 当 mode 为 TwoColors 时的颜色下限。
  46165. */
  46166. colorMin: math.Color;
  46167. /**
  46168. * @en Max color value when use TwoColors mode.
  46169. * @zh 当 mode 为 TwoColors 时的颜色上限。
  46170. */
  46171. colorMax: math.Color;
  46172. /**
  46173. * @en Gradient value when use gradient mode.
  46174. * @zh 当 mode 为 Gradient 时的颜色渐变。
  46175. */
  46176. gradient: Gradient;
  46177. /**
  46178. * @en Gradient min value when use TwoGradients.
  46179. * @zh 当mode为TwoGradients时的颜色渐变下限。
  46180. */
  46181. gradientMin: Gradient;
  46182. /**
  46183. * @en Gradient max value when use TwoGradients.
  46184. * @zh 当 mode 为 TwoGradients 时的颜色渐变上限。
  46185. */
  46186. gradientMax: Gradient;
  46187. /**
  46188. * @en Calculate gradient value.
  46189. * @zh 计算颜色渐变曲线数值。
  46190. * @param time @en Normalized time to interpolate. @zh 用于插值的归一化时间。
  46191. * @param rndRatio @en Interpolation ratio when mode is TwoColors or TwoGradients.
  46192. * Particle attribute will pass in a random number to get a random result.
  46193. * @zh 当模式为双色或双渐变色时,使用的插值比例,通常粒子系统会传入一个随机数以获得一个随机结果。
  46194. * @returns @en Gradient value. @zh 颜色渐变曲线的值。
  46195. */
  46196. evaluate(time: number, rndRatio: number): math.Color;
  46197. /**
  46198. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  46199. */
  46200. _onBeforeSerialize(props: any): any;
  46201. }
  46202. /**
  46203. * @en
  46204. * A burst is a particle emission event, where a number of particles are all emitted at the same time
  46205. * @zh
  46206. * Burst 是粒子的一种发射事件,触发时很多粒子将会同时喷出
  46207. */
  46208. export class Burst {
  46209. /**
  46210. * @en The time from particle system start until this burst triggered.
  46211. * @zh 粒子系统开始运行到触发此次 Brust 的时间。
  46212. */
  46213. get time(): number;
  46214. set time(val: number);
  46215. /**
  46216. * @en Burst trigger count.
  46217. * @zh Burst 的触发次数。
  46218. */
  46219. get repeatCount(): number;
  46220. set repeatCount(val: number);
  46221. /**
  46222. * @en Trigger interval count.
  46223. * @zh 每次触发的间隔时间。
  46224. */
  46225. repeatInterval: number;
  46226. /**
  46227. * @en Burst particle count.
  46228. * @zh 发射的粒子的数量。
  46229. */
  46230. count: CurveRange;
  46231. constructor();
  46232. /**
  46233. * @en Update burst trigger
  46234. * @zh 更新触发事件
  46235. * @param psys @en Particle system to burst. @zh 要触发的粒子系统。
  46236. * @param dt @en Update interval time. @zh 粒子系统更新的间隔时间。
  46237. * @internal
  46238. */
  46239. update(psys: any, dt: number): void;
  46240. /**
  46241. * @en Reset remaining burst count and burst time to zero.
  46242. * @zh 重置触发时间和留存的触发次数为零。
  46243. */
  46244. reset(): void;
  46245. /**
  46246. * @en Get the max particle count this burst trigger.
  46247. * @zh 获取最大的触发粒子数量。
  46248. * @param psys @en Particle system to burst. @zh 要触发的粒子系统。
  46249. * @returns @en burst max particle count. @zh 一次最多触发的粒子个数。
  46250. */
  46251. getMaxCount(psys: any): number;
  46252. }
  46253. export const Physics2DUtils: {
  46254. PolygonSeparator: typeof __private._cocos_physics_2d_framework_utils_polygon_separator;
  46255. PolygonPartition: typeof __private._cocos_physics_2d_framework_utils_polygon_partition;
  46256. };
  46257. /**
  46258. * @en
  46259. * The physics selector is used to register and switch the physics engine backend.
  46260. * @zh
  46261. * 物理选择器用于注册和切换物理引擎后端。
  46262. */
  46263. export const selector: __private._cocos_physics_2d_framework_physics_selector__IPhysicsSelector;
  46264. export enum ERigidBody2DType {
  46265. /**
  46266. * @en
  46267. * zero mass, zero velocity, may be manually moved.
  46268. * @zh
  46269. * 零质量,零速度,可以手动移动。
  46270. */
  46271. Static = 0,
  46272. /**
  46273. * @en
  46274. * zero mass, non-zero velocity set by user.
  46275. * @zh
  46276. * 零质量,可以被设置速度。
  46277. */
  46278. Kinematic = 1,
  46279. /**
  46280. * @en
  46281. * positive mass, non-zero velocity determined by forces.
  46282. * @zh
  46283. * 有质量,可以设置速度,力等。
  46284. */
  46285. Dynamic = 2,
  46286. /**
  46287. * @en
  46288. * An extension of Kinematic type, can be animated by Animation.
  46289. * @zh
  46290. * Kinematic 类型的扩展,可以被动画控制动画效果。
  46291. */
  46292. Animated = 3
  46293. }
  46294. export enum ECollider2DType {
  46295. None = 0,
  46296. BOX = 1,
  46297. CIRCLE = 2,
  46298. POLYGON = 3
  46299. }
  46300. export enum EJoint2DType {
  46301. None = 0,
  46302. DISTANCE = 1,
  46303. SPRING = 2,
  46304. WHEEL = 3,
  46305. MOUSE = 4,
  46306. FIXED = 5,
  46307. SLIDER = 6,
  46308. RELATIVE = 7,
  46309. HINGE = 8
  46310. }
  46311. export enum PhysicsGroup {
  46312. DEFAULT = 1
  46313. }
  46314. /**
  46315. * @en Enum for ERaycast2DType.
  46316. * @zh 射线检测类型。
  46317. * @enum ERaycast2DType.
  46318. */
  46319. export enum ERaycast2DType {
  46320. /**
  46321. * @en
  46322. * Detects closest collider on the raycast path.
  46323. * @zh
  46324. * 检测射线路径上最近的碰撞体。
  46325. */
  46326. Closest = 0,
  46327. /**
  46328. * @en
  46329. * Detects any collider on the raycast path.
  46330. * Once detects a collider, will stop the searching process.
  46331. * @zh
  46332. * 检测射线路径上任意的碰撞体。
  46333. * 一旦检测到任何碰撞体,将立刻结束检测其他的碰撞体。
  46334. */
  46335. Any = 1,
  46336. /**
  46337. * @en
  46338. * Detects all colliders on the raycast path.
  46339. * One collider may return several collision points(because one collider may have several fixtures,
  46340. * one fixture will return one point, the point may inside collider), AllClosest will return the closest one.
  46341. * @zh
  46342. * 检测射线路径上所有的碰撞体。
  46343. * 同一个碰撞体上有可能会返回多个碰撞点(因为一个碰撞体可能由多个夹具组成,每一个夹具会返回一个碰撞点,碰撞点有可能在碰撞体内部),AllClosest 删选同一个碰撞体上最近的哪一个碰撞点。
  46344. */
  46345. AllClosest = 2,
  46346. /**
  46347. * @en
  46348. * Detects all colliders on the raycast path.
  46349. * One collider may return several collision points, All will return all these points.
  46350. * @zh
  46351. * 检测射线路径上所有的碰撞体。
  46352. * 同一个碰撞体上有可能会返回多个碰撞点,All 将返回所有这些碰撞点。
  46353. */
  46354. All = 3
  46355. }
  46356. export const Contact2DType: {
  46357. None: string;
  46358. BEGIN_CONTACT: string;
  46359. END_CONTACT: string;
  46360. PRE_SOLVE: string;
  46361. POST_SOLVE: string;
  46362. };
  46363. export interface RaycastResult2D {
  46364. collider: Collider2D;
  46365. fixtureIndex: number;
  46366. point: math.Vec2;
  46367. normal: math.Vec2;
  46368. fraction: number;
  46369. }
  46370. export enum EPhysics2DDrawFlags {
  46371. None = 0,
  46372. Shape = 1,
  46373. Joint = 2,
  46374. Aabb = 4,
  46375. Pair = 8,
  46376. CenterOfMass = 16,
  46377. Particle = 32,
  46378. Controller = 64,
  46379. All = 63
  46380. }
  46381. export const PHYSICS_2D_PTM_RATIO = 32;
  46382. export class PhysicsSystem2D extends __private._cocos_physics_2d_framework_physics_system__PhysicsSystem2D_base {
  46383. /**
  46384. * @en
  46385. * Gets or sets whether the physical system is enabled, which can be used to pause or continue running the physical system.
  46386. * @zh
  46387. * 获取或设置是否启用物理系统,可以用于暂停或继续运行物理系统。
  46388. */
  46389. get enable(): boolean;
  46390. set enable(value: boolean);
  46391. /**
  46392. * @zh
  46393. * Gets or sets whether the physical system allows automatic sleep, which defaults to true.
  46394. * @zh
  46395. * 获取或设置物理系统是否允许自动休眠,默认为 true。
  46396. */
  46397. get allowSleep(): boolean;
  46398. set allowSleep(v: boolean);
  46399. /**
  46400. * @en
  46401. * Gets or sets the value of gravity in the physical world, which defaults to (0, -10).
  46402. * @zh
  46403. * 获取或设置物理世界的重力数值,默认为 (0, -10)。
  46404. */
  46405. get gravity(): math.Vec2;
  46406. set gravity(gravity: math.Vec2);
  46407. /**
  46408. * @en
  46409. * Gets or sets the maximum number of simulated substeps per frame.
  46410. * @zh
  46411. * 获取或设置每帧模拟的最大子步数。
  46412. */
  46413. get maxSubSteps(): number;
  46414. set maxSubSteps(value: number);
  46415. /**
  46416. * @en
  46417. * Gets or sets the fixed delta time consumed by each simulation step.
  46418. * @zh
  46419. * 获取或设置每步模拟消耗的固定时间。
  46420. */
  46421. get fixedTimeStep(): number;
  46422. set fixedTimeStep(value: number);
  46423. /**
  46424. * @en
  46425. * Turn on or off the automatic simulation.
  46426. * @zh
  46427. * 获取或设置是否自动模拟。
  46428. */
  46429. get autoSimulation(): boolean;
  46430. set autoSimulation(value: boolean);
  46431. get debugDrawFlags(): number;
  46432. set debugDrawFlags(v: number);
  46433. /**
  46434. * @en
  46435. * The velocity iterations for the velocity constraint solver.
  46436. * @zh
  46437. * 速度更新迭代数。
  46438. */
  46439. velocityIterations: number;
  46440. /**
  46441. * @en
  46442. * The position Iterations for the position constraint solver.
  46443. * @zh
  46444. * 位置迭代更新数。
  46445. */
  46446. positionIterations: number;
  46447. /**
  46448. * @en
  46449. * Gets the wrappered object of the physical world through which you can access the actual underlying object.
  46450. * @zh
  46451. * 获取物理世界的封装对象,通过它你可以访问到实际的底层对象。
  46452. */
  46453. get physicsWorld(): __private._cocos_physics_2d_spec_i_physics_world__IPhysicsWorld;
  46454. /**
  46455. * @en
  46456. * Gets the ID of the system.
  46457. * @zh
  46458. * 获取此系统的ID。
  46459. */
  46460. static readonly ID = "PHYSICS_2D";
  46461. static get PHYSICS_NONE(): boolean;
  46462. static get PHYSICS_BUILTIN(): boolean;
  46463. static get PHYSICS_BOX2D(): boolean;
  46464. static get PHYSICS_BOX2D_WASM(): boolean;
  46465. /**
  46466. * @en
  46467. * Gets the predefined physics groups.
  46468. * @zh
  46469. * 获取预定义的物理分组。
  46470. */
  46471. static get PhysicsGroup(): typeof PhysicsGroup;
  46472. /**
  46473. * @en
  46474. * Gets the physical system instance.
  46475. * @zh
  46476. * 获取物理系统实例。
  46477. */
  46478. static get instance(): PhysicsSystem2D;
  46479. /**
  46480. * @en
  46481. * Gets the collision matrix。
  46482. * @zh
  46483. * 获取碰撞矩阵。
  46484. */
  46485. readonly collisionMatrix: physics.ICollisionMatrix;
  46486. get stepping(): boolean;
  46487. /**
  46488. * @en
  46489. * Perform a simulation of the physics system, which will now be performed automatically on each frame.
  46490. * @zh
  46491. * 执行一次物理系统的模拟,目前将在每帧自动执行一次。
  46492. * @param deltaTime @en time step. @zh 与上一次执行相差的时间,目前为每帧消耗时间。
  46493. */
  46494. postUpdate(deltaTime: number): void;
  46495. _callAfterStep(target: object, func: Function): void;
  46496. /**
  46497. * @en
  46498. * Reset the accumulator of time to given value.
  46499. * @zh
  46500. * 重置时间累积总量为给定值。
  46501. */
  46502. resetAccumulator(time?: number): void;
  46503. /**
  46504. * @en
  46505. * Perform simulation steps for the physics world.
  46506. * @zh
  46507. * 执行物理世界的模拟步进。
  46508. * @param fixedTimeStep
  46509. */
  46510. step(fixedTimeStep: number): void;
  46511. /**
  46512. * @en
  46513. * Raycast the world for all colliders in the path of the ray.
  46514. * The raycast ignores colliders that contain the starting point.
  46515. * @zh
  46516. * 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  46517. * @method rayCast
  46518. * @param {Vec2} p1 @en start point of the raycast. @zh 射线起点。
  46519. * @param {Vec2} p2 @en end point of the raycast. @zh 射线终点。
  46520. * @param {RayCastType} type - @en optional, default is RayCastType.Closest. @zh 可选,默认是RayCastType.Closest。
  46521. * @param {number} mask - @en optional, default is 0xffffffff. @zh 可选,默认是0xffffffff。
  46522. * @return {[PhysicsRayCastResult]}
  46523. */
  46524. raycast(p1: math.IVec2Like, p2: math.IVec2Like, type?: ERaycast2DType, mask?: number): readonly Readonly<RaycastResult2D>[];
  46525. /**
  46526. * @en Test which colliders contain the point.
  46527. * @zh 检测给定点在哪些碰撞体内。
  46528. */
  46529. testPoint(p: math.Vec2): readonly Collider2D[];
  46530. /**
  46531. * @en Test which colliders contain the point.
  46532. * @zh 检测给定点在哪些碰撞体内。
  46533. */
  46534. testAABB(rect: math.Rect): readonly Collider2D[];
  46535. static constructAndRegister(): void;
  46536. }
  46537. /**
  46538. * @en
  46539. * Contact impulses for reporting.
  46540. * @zh
  46541. * 用于返回给回调的接触冲量。
  46542. */
  46543. export interface IPhysics2DImpulse {
  46544. /**
  46545. * @en
  46546. * Normal impulses.
  46547. * @zh
  46548. * 法线方向的冲量。
  46549. * @property normalImpulses
  46550. */
  46551. normalImpulses: number[];
  46552. /**
  46553. * @en
  46554. * Tangent impulses.
  46555. * @zh
  46556. * 切线方向的冲量。
  46557. * @property tangentImpulses
  46558. */
  46559. tangentImpulses: number[];
  46560. }
  46561. /**
  46562. * @en
  46563. * A world manifold.
  46564. * @zh
  46565. * 世界坐标系下的流形。
  46566. */
  46567. export interface IPhysics2DWorldManifold {
  46568. /**
  46569. * @en
  46570. * world contact point (point of intersection)
  46571. * @zh
  46572. * 碰撞点集合
  46573. */
  46574. points: math.Vec2[];
  46575. /**
  46576. * @en
  46577. * a negative value indicates overlap.
  46578. * @zh
  46579. * 一个负数,用于指明重叠的部分。
  46580. */
  46581. separations: number[];
  46582. /**
  46583. * @en
  46584. * world vector pointing from A to B.
  46585. * @zh
  46586. * 世界坐标系下由 A 指向 B 的向量。
  46587. */
  46588. normal: math.Vec2;
  46589. }
  46590. /**
  46591. * @en Manifold Type.
  46592. * @zh 流形类型。
  46593. */
  46594. export enum Physics2DManifoldType {
  46595. Circles = 0,
  46596. FaceA = 1,
  46597. FaceB = 2
  46598. }
  46599. /**
  46600. * @en
  46601. * A manifold point is a contact point belonging to a contact manifold.
  46602. * It holds details related to the geometry and dynamics of the contact points.
  46603. * Note: the impulses are used for internal caching and may not
  46604. * provide reliable contact forces, especially for high speed collisions.
  46605. * @zh
  46606. * ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  46607. * 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。
  46608. */
  46609. export interface IPhysics2DManifoldPoint {
  46610. /**
  46611. * @en
  46612. * The local point usage depends on the manifold type:
  46613. * - Physics2DManifoldType.Circles: the local center of circleB.
  46614. * - Physics2DManifoldType.FaceA: the local center of circleB or the clip point of polygonB.
  46615. * - Physics2DManifoldType.FaceB: the clip point of polygonA.
  46616. * @zh
  46617. * 本地坐标点的用途取决于 manifold 的类型。
  46618. * - Physics2DManifoldType.Circles: circleB 的本地中心点。
  46619. * - Physics2DManifoldType.FaceA: circleB 的本地中心点 或者是 polygonB 的截取点。
  46620. * - Physics2DManifoldType.FaceB: polygonB 的截取点。
  46621. */
  46622. localPoint: math.Vec2;
  46623. /**
  46624. * @en
  46625. * Normal impulse.
  46626. * @zh
  46627. * 法线冲量。
  46628. */
  46629. normalImpulse: number;
  46630. /**
  46631. * @en
  46632. * Tangent impulse.
  46633. * @zh
  46634. * 切线冲量。
  46635. */
  46636. tangentImpulse: number;
  46637. }
  46638. /**
  46639. * @en Manifold.
  46640. * @zh 流形。
  46641. */
  46642. export interface IPhysics2DManifold {
  46643. /**
  46644. * @en
  46645. * Manifold type.
  46646. * @zh
  46647. * Manifold 类型。
  46648. */
  46649. type: Physics2DManifoldType;
  46650. /**
  46651. * @en
  46652. * The local point usage depends on the manifold type:
  46653. * -Physics2DManifoldType.Circles: the local center of circleA.
  46654. * -Physics2DManifoldType.FaceA: the center of faceA.
  46655. * -Physics2DManifoldType.FaceB: the center of faceB.
  46656. * @zh
  46657. * 用途取决于 manifold 类型
  46658. * -Physics2DManifoldType.Circles: circleA 的本地中心点。
  46659. * -Physics2DManifoldType.FaceA: faceA 的本地中心点。
  46660. * -Physics2DManifoldType.FaceB: faceB 的本地中心点。
  46661. */
  46662. localPoint: math.Vec2;
  46663. /**
  46664. * @en
  46665. * -Physics2DManifoldType.Circles: not used.
  46666. * -Physics2DManifoldType.FaceA: the normal on polygonA.
  46667. * -Physics2DManifoldType.FaceB: the normal on polygonB.
  46668. * @zh
  46669. * -Physics2DManifoldType.Circles: 没被使用到。
  46670. * -Physics2DManifoldType.FaceA: polygonA 的法向量。
  46671. * -Physics2DManifoldType.FaceB: polygonB 的法向量。
  46672. */
  46673. localNormal: math.Vec2;
  46674. /**
  46675. * @en
  46676. * the points of contact.
  46677. * @zh
  46678. * 接触点信息。
  46679. */
  46680. points: IPhysics2DManifoldPoint[];
  46681. }
  46682. /**
  46683. * @en
  46684. * PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  46685. * Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  46686. * @zh
  46687. * 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  46688. * 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。
  46689. */
  46690. export interface IPhysics2DContact {
  46691. /**
  46692. * @en
  46693. * One of the collider that collided.
  46694. * @zh
  46695. * 发生碰撞的碰撞体之一。
  46696. */
  46697. colliderA: Collider2D | null;
  46698. /**
  46699. * @en
  46700. * One of the collider that collided.
  46701. * @zh
  46702. * 发生碰撞的碰撞体之一。
  46703. */
  46704. colliderB: Collider2D | null;
  46705. /**
  46706. * @en
  46707. * If set disabled to true, the contact will be ignored until contact end.
  46708. * If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  46709. * @zh
  46710. * 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  46711. * 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。
  46712. */
  46713. disabled: boolean;
  46714. /**
  46715. * @en
  46716. * Disabled contact for current time step or sub-step.
  46717. * @zh
  46718. * 在当前时间步或子步中忽略此接触。
  46719. */
  46720. disabledOnce: boolean;
  46721. /**
  46722. * @en
  46723. * Get the world manifold.
  46724. * @zh
  46725. * 获取世界坐标系下的碰撞信息。
  46726. */
  46727. getWorldManifold(): IPhysics2DWorldManifold;
  46728. /**
  46729. * @en
  46730. * Get the manifold.
  46731. * @zh
  46732. * 获取本地(局部)坐标系下的碰撞信息。
  46733. */
  46734. getManifold(): IPhysics2DManifold;
  46735. /**
  46736. * @en
  46737. * Get the impulses.
  46738. * Note: PhysicsImpulse can only used in onPostSolve callback.
  46739. * @zh
  46740. * 获取冲量信息。
  46741. * 注意:这个信息只有在 onPostSolve 回调中才能获取到。
  46742. */
  46743. getImpulse(): IPhysics2DImpulse | null;
  46744. /**
  46745. * @en
  46746. * Is this contact touching?
  46747. * @zh
  46748. * 返回碰撞体是否已经接触到。
  46749. */
  46750. isTouching(): boolean;
  46751. /**
  46752. * @en
  46753. * Set the desired tangent speed for a conveyor belt behavior.
  46754. * @zh
  46755. * 为传送带设置期望的切线速度。
  46756. */
  46757. setTangentSpeed(value: number): any;
  46758. /**
  46759. * @en
  46760. * Get the desired tangent speed.
  46761. * @zh
  46762. * 获取切线速度。
  46763. */
  46764. getTangentSpeed(): number;
  46765. /**
  46766. * @en
  46767. * Override the default friction mixture. You can call this in onPreSolve callback.
  46768. * @zh
  46769. * 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  46770. */
  46771. setFriction(value: number): any;
  46772. /**
  46773. * @en
  46774. * Get the friction.
  46775. * @zh
  46776. * 获取当前摩擦力系数。
  46777. */
  46778. getFriction(): number;
  46779. /**
  46780. * @en
  46781. * Override the default restitution mixture. You can call this in onPreSolve callback.
  46782. * @zh
  46783. * 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  46784. */
  46785. setRestitution(restitution: number): any;
  46786. /**
  46787. * @en
  46788. * Get the restitution.
  46789. * @zh
  46790. * 获取当前恢复系数。
  46791. */
  46792. getRestitution(): number;
  46793. }
  46794. export class RigidBody2D extends Component {
  46795. /**
  46796. * @en
  46797. * Gets or sets the group of the rigid body.
  46798. * @zh
  46799. * 获取或设置分组。
  46800. */
  46801. get group(): number;
  46802. set group(v: number);
  46803. enabledContactListener: boolean;
  46804. /**
  46805. * @en
  46806. * Is this a fast moving body that should be prevented from tunneling through
  46807. * other moving bodies?
  46808. * Note :
  46809. * - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  46810. * - You should use this flag sparingly since it increases processing time.
  46811. * @zh
  46812. * 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  46813. * 需要注意的是 :
  46814. * - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  46815. * - 应该尽量少的使用此选项,因为它会增加程序处理时间。
  46816. */
  46817. bullet: boolean;
  46818. /**
  46819. * @en
  46820. * Rigidbody type : Static, Kinematic, Dynamic or Animated.
  46821. * @zh
  46822. * 刚体类型: Static, Kinematic, Dynamic or Animated.
  46823. */
  46824. get type(): ERigidBody2DType;
  46825. set type(v: ERigidBody2DType);
  46826. /**
  46827. * @en
  46828. * Set this flag to false if this body should never fall asleep.
  46829. * Note that this increases CPU usage.
  46830. * @zh
  46831. * 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  46832. * 需要注意这将使 CPU 占用率提高。
  46833. */
  46834. get allowSleep(): boolean;
  46835. set allowSleep(v: boolean);
  46836. /**
  46837. * @en
  46838. * Scale the gravity applied to this body.
  46839. * @zh
  46840. * 缩放应用在此刚体上的重力值。
  46841. */
  46842. get gravityScale(): number;
  46843. set gravityScale(v: number);
  46844. /**
  46845. * @en
  46846. * Linear damping is use to reduce the linear velocity.
  46847. * The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  46848. * time step when the damping parameter is large.
  46849. * @zh
  46850. * Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。
  46851. */
  46852. get linearDamping(): number;
  46853. set linearDamping(v: number);
  46854. /**
  46855. * @en
  46856. * Angular damping is use to reduce the angular velocity. The damping parameter
  46857. * can be larger than 1 but the damping effect becomes sensitive to the
  46858. * time step when the damping parameter is large.
  46859. * @zh
  46860. * Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。
  46861. */
  46862. get angularDamping(): number;
  46863. set angularDamping(v: number);
  46864. /**
  46865. * @en
  46866. * The linear velocity of the body's origin in world co-ordinates.
  46867. * @zh
  46868. * 刚体在世界坐标下的线性速度。
  46869. */
  46870. get linearVelocity(): math.Vec2;
  46871. set linearVelocity(v: math.Vec2);
  46872. /**
  46873. * @en
  46874. * The angular velocity of the body in radians/second.
  46875. * @zh
  46876. * 刚体的角速度,单位是 弧度/秒。
  46877. */
  46878. get angularVelocity(): number;
  46879. set angularVelocity(v: number);
  46880. /**
  46881. * @en
  46882. * Should this body be prevented from rotating?
  46883. * @zh
  46884. * 是否禁止此刚体进行旋转。
  46885. */
  46886. get fixedRotation(): boolean;
  46887. set fixedRotation(v: boolean);
  46888. /**
  46889. * @en
  46890. * Whether to wake up this rigid body during initialization.
  46891. * @zh
  46892. * 是否在初始化时唤醒此刚体。
  46893. */
  46894. awakeOnLoad: boolean;
  46895. /**
  46896. * @en
  46897. * Whether the rigid body is awake.
  46898. * @zh
  46899. * 获取刚体是否正在休眠。
  46900. */
  46901. isAwake(): boolean;
  46902. /**
  46903. * @en
  46904. * Wake up the rigid body.
  46905. * @zh
  46906. * 唤醒刚体。
  46907. */
  46908. wakeUp(): void;
  46909. /**
  46910. * @en
  46911. * Dormancy of rigid body.
  46912. * @zh
  46913. * 休眠刚体。
  46914. */
  46915. sleep(): void;
  46916. /**
  46917. * @en
  46918. * Get total mass of the body.
  46919. * @zh
  46920. * 获取刚体的质量。
  46921. */
  46922. getMass(): number;
  46923. /**
  46924. * @en
  46925. * Apply a force at a world point. If the force is not
  46926. * applied at the center of mass, it will generate a torque and
  46927. * affect the angular velocity.
  46928. * @zh
  46929. * 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  46930. * @param force @en the world force vector. @zh 世界坐标系下的力。
  46931. * @param point @en the world position. @zh 世界坐标系下的力的作用点。
  46932. * @param wake @en also wake up the body. @zh 唤醒刚体。
  46933. */
  46934. applyForce(force: math.Vec2, point: math.Vec2, wake: boolean): void;
  46935. /**
  46936. * @en
  46937. * Apply a force to the center of mass.
  46938. * @zh
  46939. * 施加一个力到刚体上的质心上。
  46940. * @param force @en the world force vector. @zh 世界坐标系下的力。
  46941. * @param wake @en also wake up the body. @zh 唤醒刚体。
  46942. */
  46943. applyForceToCenter(force: math.Vec2, wake: boolean): void;
  46944. /**
  46945. * @en
  46946. * Apply a torque. This affects the angular velocity.
  46947. * @zh
  46948. * 施加一个扭矩力,将影响刚体的角速度。
  46949. * @param torque @en about the z-axis (out of the screen), usually in N-m. @zh 扭矩 N-m。
  46950. * @param wake @en also wake up the body @zh 唤醒刚体。
  46951. */
  46952. applyTorque(torque: number, wake: boolean): void;
  46953. /**
  46954. * @en
  46955. * Apply a impulse at a world point, this immediately modifies the velocity.
  46956. * If the impulse is not applied at the center of mass, it will generate a torque and
  46957. * affect the angular velocity.
  46958. * @zh
  46959. * 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  46960. * 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  46961. * @param impulse @en the world impulse vector, usually in N-seconds or kg-m/s. @zh 冲量 N-seconds 或者 kg-m/s。
  46962. * @param point @en the world position. @zh 世界坐标系下的作用点。
  46963. * @param wake @en also wake up the body. @zh 唤醒刚体。
  46964. */
  46965. applyLinearImpulse(impulse: math.Vec2, point: math.Vec2, wake: boolean): void;
  46966. /**
  46967. * @en
  46968. * Apply a impulse at the center of mass, this immediately modifies the velocity.
  46969. * @zh
  46970. * 施加冲量到刚体上的质心点,将立即改变刚体的线性速度。
  46971. * @param impulse @en the world impulse vector, usually in N-seconds or kg-m/s. @zh 冲量 N-seconds 或者 kg-m/s。
  46972. * @param wake @en also wake up the body @zh 唤醒刚体。
  46973. */
  46974. applyLinearImpulseToCenter(impulse: math.Vec2, wake: boolean): void;
  46975. /**
  46976. * @en
  46977. * Apply an angular impulse.
  46978. * @zh
  46979. * 施加一个角冲量。
  46980. * @param impulse @en the angular impulse in units of kg*m*m/s. @zh 角冲量 kg*m*m/s。
  46981. * @param wake @en also wake up the body. @zh 唤醒刚体。
  46982. */
  46983. applyAngularImpulse(impulse: number, wake: boolean): void;
  46984. /**
  46985. * @en
  46986. * Get the world linear velocity of a world point attached to this body.
  46987. * @zh
  46988. * 获取刚体上指定点的线性速度。
  46989. * @param worldPoint @en a point in world coordinates. @zh 世界坐标系下的点。
  46990. * @param out @en optional, the returned world velocity. @zh 可选,返回的世界坐标系下的速度。
  46991. * @return @en the world linear velocity. @zh 指定点的世界坐标系下的速度。
  46992. */
  46993. getLinearVelocityFromWorldPoint<Out extends math.IVec2Like>(worldPoint: math.IVec2Like, out: Out): Out;
  46994. /**
  46995. * @en
  46996. * Converts a world coordinate point to the given rigid body coordinate.
  46997. * @zh
  46998. * 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量。
  46999. * @param worldVector @en a vector in world coordinates. @zh 世界坐标系下的向量。
  47000. * @param out @en optional, the returned vector in local coordinate. @zh 可选,返回的本地坐标系下的向量。
  47001. * @return @en a vector in local coordinate. @zh 本地坐标系下的向量。
  47002. */
  47003. getLocalVector<Out extends math.IVec2Like>(worldVector: math.IVec2Like, out: Out): Out;
  47004. /**
  47005. * @en
  47006. * Converts a given vector in this rigid body's local coordinate system to the world coordinate system
  47007. * @zh
  47008. * 将一个给定的刚体本地坐标系下的向量转换为世界坐标系下的向量。
  47009. * @param localVector @en a vector in local coordinates. @zh 本地坐标系下的向量。
  47010. * @param out @en optional, the returned vector in world coordinate. @zh 可选,返回的世界坐标系下的向量。
  47011. * @return @en a vector in world coordinate. @zh 世界坐标系下的向量。
  47012. */
  47013. getWorldVector<Out extends math.IVec2Like>(localVector: math.IVec2Like, out: Out): Out;
  47014. /**
  47015. * @en
  47016. * Converts a given point in the world coordinate system to this rigid body's local coordinate system.
  47017. * @zh
  47018. * 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点。
  47019. * @param worldPoint @en a point in world coordinates. @zh 世界坐标系下的点。
  47020. * @param out @en optional, the returned point in local coordinate. @zh 可选,返回的本地坐标系下的点。
  47021. * @return @en a point in local coordinate. @zh 本地坐标系下的点。
  47022. */
  47023. getLocalPoint<Out extends math.IVec2Like>(worldPoint: math.IVec2Like, out: Out): Out;
  47024. /**
  47025. * @en
  47026. * Converts a given point in this rigid body's local coordinate system to the world coordinate system.
  47027. * @zh
  47028. * 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点。
  47029. * @param localPoint @en a point in local coordinate. @zh 本地坐标系下的点。
  47030. * @param out @en optional, the returned point in world coordinate. @zh 可选,返回的世界坐标系下的点。
  47031. * @return @en a point in world coordinate. @zh 世界坐标系下的点。
  47032. */
  47033. getWorldPoint<Out extends math.IVec2Like>(localPoint: math.IVec2Like, out: Out): Out;
  47034. /**
  47035. * @en
  47036. * Get the local position of the center of mass.
  47037. * @zh
  47038. * 获取刚体本地坐标系下的质心。
  47039. */
  47040. getLocalCenter<Out extends math.IVec2Like>(out: Out): Out;
  47041. /**
  47042. * @en
  47043. * Get the world position of the center of mass.
  47044. * @zh
  47045. * 获取刚体世界坐标系下的质心。
  47046. */
  47047. getWorldCenter<Out extends math.IVec2Like>(out: Out): Out;
  47048. /**
  47049. * @en
  47050. * Get the rotational inertia of the body about the local origin.
  47051. * @zh
  47052. * 获取刚体本地坐标系下原点的旋转惯性。
  47053. */
  47054. getInertia(): number;
  47055. protected onLoad(): void;
  47056. protected onEnable(): void;
  47057. protected onDisable(): void;
  47058. protected onDestroy(): void;
  47059. get impl(): __private._cocos_physics_2d_spec_i_rigid_body__IRigidBody2D | null;
  47060. }
  47061. export class Collider2D extends __private._cocos_physics_2d_framework_components_colliders_collider_2d__Collider2D_base {
  47062. editing: boolean;
  47063. /**
  47064. * @en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  47065. * @zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。
  47066. */
  47067. tag: number;
  47068. /**
  47069. * @en
  47070. * Gets or sets the group of the rigid body.
  47071. * @zh
  47072. * 获取或设置分组。
  47073. */
  47074. get group(): number;
  47075. set group(v: number);
  47076. /**
  47077. * @en The density.
  47078. * @zh 密度。
  47079. */
  47080. get density(): number;
  47081. set density(v: number);
  47082. /**
  47083. * @en
  47084. * A sensor collider collects contact information but never generates a collision response
  47085. * @zh
  47086. * 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。
  47087. */
  47088. get sensor(): boolean;
  47089. set sensor(v: boolean);
  47090. /**
  47091. * @en
  47092. * The friction coefficient, usually in the range [0,1].
  47093. * @zh
  47094. * 摩擦系数,取值一般在 [0, 1] 之间。
  47095. */
  47096. get friction(): number;
  47097. set friction(v: number);
  47098. /**
  47099. * @en
  47100. * The restitution (elasticity) usually in the range [0,1].
  47101. * @zh
  47102. * 弹性系数,取值一般在 [0, 1]之间。
  47103. */
  47104. get restitution(): number;
  47105. set restitution(v: number);
  47106. /**
  47107. * @en Position offset
  47108. * @zh 位置偏移量
  47109. */
  47110. get offset(): math.Vec2;
  47111. set offset(v: math.Vec2);
  47112. /**
  47113. * @en
  47114. * Physics collider will find the rigidbody component on the node and set to this property.
  47115. * @zh
  47116. * 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。
  47117. */
  47118. get body(): RigidBody2D | null;
  47119. get impl(): __private._cocos_physics_2d_spec_i_physics_shape__IBaseShape | null;
  47120. readonly TYPE: ECollider2DType;
  47121. protected onLoad(): void;
  47122. protected onEnable(): void;
  47123. protected onDisable(): void;
  47124. protected onDestroy(): void;
  47125. /**
  47126. * @en
  47127. * If the physics engine is box2d, need to call this function to apply current changes to collider, this will regenerate inner box2d fixtures.
  47128. * @zh
  47129. * 如果物理引擎是 box2d, 需要调用此函数来应用当前 collider 中的修改,调用此函数会重新生成 box2d 的夹具。
  47130. */
  47131. apply(): void;
  47132. /**
  47133. * @en
  47134. * Get the world aabb of the collider.
  47135. * @zh
  47136. * 获取碰撞体的世界坐标系下的包围盒。
  47137. */
  47138. get worldAABB(): Readonly<math.Rect>;
  47139. protected _shape: __private._cocos_physics_2d_spec_i_physics_shape__IBaseShape | null;
  47140. protected _body: RigidBody2D | null;
  47141. protected _group: physics.PhysicsGroup;
  47142. protected _density: number;
  47143. protected _sensor: boolean;
  47144. protected _friction: number;
  47145. protected _restitution: number;
  47146. protected _offset: math.Vec2;
  47147. }
  47148. export class BoxCollider2D extends Collider2D {
  47149. /**
  47150. * @en Box size.
  47151. * @zh 包围盒大小。
  47152. */
  47153. get size(): math.Size;
  47154. set size(v: math.Size);
  47155. /**
  47156. * @en Get world points.
  47157. * @zh 世界坐标下 BoX 的四个点。
  47158. */
  47159. get worldPoints(): readonly Readonly<math.Vec2>[];
  47160. readonly TYPE = ECollider2DType.BOX;
  47161. }
  47162. export class CircleCollider2D extends Collider2D {
  47163. /**
  47164. * @en Circle radius.
  47165. * @zh 圆形半径。
  47166. */
  47167. get radius(): number;
  47168. set radius(v: number);
  47169. /**
  47170. * @en Get world center of the circle collider.
  47171. * @zh 世界坐标下圆形碰撞体的中心。
  47172. */
  47173. get worldPosition(): Readonly<math.Vec2>;
  47174. /**
  47175. * @en Get world radius of the circle collider.
  47176. * @zh 世界坐标下圆形碰撞体的半径。
  47177. */
  47178. get worldRadius(): number;
  47179. readonly TYPE = ECollider2DType.CIRCLE;
  47180. }
  47181. export class PolygonCollider2D extends Collider2D {
  47182. threshold: number;
  47183. /**
  47184. * @en Polygon points.
  47185. * @zh 多边形顶点数组。
  47186. */
  47187. get points(): math.Vec2[];
  47188. set points(v: math.Vec2[]);
  47189. /**
  47190. * @en Get world points.
  47191. * @zh 世界坐标下多边形碰撞体的点。
  47192. */
  47193. get worldPoints(): readonly Readonly<math.Vec2>[];
  47194. readonly TYPE = ECollider2DType.POLYGON;
  47195. }
  47196. export class Joint2D extends Component {
  47197. /**
  47198. * @en
  47199. * The position of Joint2D in the attached rigid body's local space.
  47200. * @zh
  47201. * 在自身刚体的本地空间中,Joint2D的位置。
  47202. */
  47203. anchor: math.Vec2;
  47204. /**
  47205. * @en
  47206. * The position of Joint2D in the connected rigid body's local space.
  47207. * @zh
  47208. * 在连接刚体的本地空间中,Joint2D的位置。
  47209. */
  47210. connectedAnchor: math.Vec2;
  47211. /**
  47212. * @en
  47213. * whether collision is turned on between two rigid bodies connected by a joint.
  47214. * @zh
  47215. * 关节连接的两刚体之间是否开启碰撞。
  47216. */
  47217. collideConnected: boolean;
  47218. /**
  47219. * @en
  47220. * The jointed rigid body, null means link to a static rigid body at the world origin.
  47221. * @zh
  47222. * 关节连接的刚体,为空时表示连接到位于世界原点的静态刚体。
  47223. */
  47224. connectedBody: RigidBody2D | null;
  47225. /**
  47226. * @en
  47227. * the Joint2D attached rigid-body.
  47228. * @zh
  47229. * 关节所绑定的刚体组件。
  47230. */
  47231. _body: RigidBody2D | null;
  47232. get body(): RigidBody2D | null;
  47233. get impl(): __private._cocos_physics_2d_spec_i_physics_joint__IJoint2D | null;
  47234. protected _joint: __private._cocos_physics_2d_spec_i_physics_joint__IJoint2D | null;
  47235. /**
  47236. * @en
  47237. * the type of this joint.
  47238. * @zh
  47239. * 此关节的类型。
  47240. */
  47241. TYPE: EJoint2DType;
  47242. protected onLoad(): void;
  47243. protected onEnable(): void;
  47244. protected onDisable(): void;
  47245. protected start(): void;
  47246. protected onDestroy(): void;
  47247. /**
  47248. * @en
  47249. * If the physics engine is box2d, need to call this function to apply current changes to joint, this will regenerate inner box2d joint.
  47250. * @zh
  47251. * 如果物理引擎是 box2d, 需要调用此函数来应用当前 joint 中的修改。
  47252. */
  47253. apply(): void;
  47254. }
  47255. export class DistanceJoint2D extends Joint2D {
  47256. TYPE: EJoint2DType;
  47257. /**
  47258. * @en
  47259. * The max length.
  47260. * @zh
  47261. * 最大长度。
  47262. */
  47263. get maxLength(): number;
  47264. set maxLength(v: number);
  47265. /**
  47266. * @en
  47267. * Auto calculate the distance between the connected two rigid bodies.
  47268. * @zh
  47269. * 自动计算关节连接的两个刚体间的距离。
  47270. */
  47271. get autoCalcDistance(): boolean;
  47272. set autoCalcDistance(v: boolean);
  47273. }
  47274. export class SpringJoint2D extends Joint2D {
  47275. TYPE: EJoint2DType;
  47276. /**
  47277. * @en
  47278. * The spring frequency.
  47279. * @zh
  47280. * 弹性系数。
  47281. */
  47282. get frequency(): number;
  47283. set frequency(v: number);
  47284. /**
  47285. * @en
  47286. * The damping ratio.
  47287. * @zh
  47288. * 阻尼,表示关节变形后,恢复到初始状态受到的阻力。
  47289. */
  47290. get dampingRatio(): number;
  47291. set dampingRatio(v: number);
  47292. /**
  47293. * @en
  47294. * The distance separating the two ends of the joint.
  47295. * @zh
  47296. * 关节两端的距离。
  47297. */
  47298. get distance(): number;
  47299. set distance(v: number);
  47300. /**
  47301. * @en
  47302. * Auto calculate the distance between the connected two rigid bodies.
  47303. * @zh
  47304. * 自动计算关节连接的两个刚体间的距离。
  47305. */
  47306. get autoCalcDistance(): boolean;
  47307. set autoCalcDistance(v: boolean);
  47308. }
  47309. export class MouseJoint2D extends Joint2D {
  47310. TYPE: EJoint2DType;
  47311. get target(): math.Vec2;
  47312. set target(v: math.Vec2);
  47313. /**
  47314. * @en
  47315. * The spring frequency.
  47316. * @zh
  47317. * 弹簧系数。
  47318. */
  47319. get frequency(): number;
  47320. set frequency(v: number);
  47321. /**
  47322. * @en
  47323. * The damping ratio.
  47324. * @zh
  47325. * 阻尼,表示关节变形后,恢复到初始状态受到的阻力。
  47326. */
  47327. get dampingRatio(): number;
  47328. set dampingRatio(v: number);
  47329. /**
  47330. * @en
  47331. * The maximum force.
  47332. * @zh
  47333. * 最大阻力值。
  47334. */
  47335. get maxForce(): number;
  47336. set maxForce(v: number);
  47337. update(dt: any): void;
  47338. }
  47339. export class RelativeJoint2D extends Joint2D {
  47340. TYPE: EJoint2DType;
  47341. /**
  47342. * @en
  47343. * The maximum force can be applied to rigidbody.
  47344. * @zh
  47345. * 可以应用于刚体的最大的力值。
  47346. */
  47347. get maxForce(): number;
  47348. set maxForce(v: number);
  47349. /**
  47350. * @en
  47351. * The maximum torque can be applied to rigidbody.
  47352. * @zh
  47353. * 可以应用于刚体的最大扭矩值。
  47354. */
  47355. get maxTorque(): number;
  47356. set maxTorque(v: number);
  47357. /**
  47358. * @en
  47359. * The position correction factor in the range [0,1].
  47360. * @zh
  47361. * 位置矫正系数,范围为 [0, 1]。
  47362. */
  47363. get correctionFactor(): number;
  47364. set correctionFactor(v: number);
  47365. /**
  47366. * @en
  47367. * The linear offset from connected rigidbody to rigidbody.
  47368. * @zh
  47369. * 关节另一端的刚体相对于起始端刚体的位置偏移量。
  47370. */
  47371. get linearOffset(): math.Vec2;
  47372. set linearOffset(v: math.Vec2);
  47373. /**
  47374. * @en
  47375. * The angular offset from connected rigidbody to rigidbody.
  47376. * @zh
  47377. * 关节另一端的刚体相对于起始端刚体的角度偏移量。
  47378. */
  47379. get angularOffset(): number;
  47380. set angularOffset(v: number);
  47381. /**
  47382. * @en
  47383. * Auto calculate the angularOffset and linearOffset between the connected two rigid bodies.
  47384. * @zh
  47385. * 自动计算关节连接的两个刚体间的 angularOffset 和 linearOffset。
  47386. */
  47387. get autoCalcOffset(): boolean;
  47388. set autoCalcOffset(v: boolean);
  47389. }
  47390. export class SliderJoint2D extends Joint2D {
  47391. TYPE: EJoint2DType;
  47392. /**
  47393. * @en Slide direction.
  47394. * @zh 滑动的方向。
  47395. */
  47396. get angle(): number;
  47397. set angle(v: number);
  47398. /**
  47399. * @en Auto calculate slide direction according to the slide direction.
  47400. * @zh 根据连接的两个刚体自动计算滑动方向。
  47401. */
  47402. get autoCalcAngle(): boolean;
  47403. set autoCalcAngle(v: boolean);
  47404. /**
  47405. * @en
  47406. * Enable joint motor?
  47407. * @zh
  47408. * 是否开启关节马达?
  47409. */
  47410. get enableMotor(): boolean;
  47411. set enableMotor(v: boolean);
  47412. /**
  47413. * @en
  47414. * The maxium force can be applied to rigidbody to rearch the target motor speed.
  47415. * @zh
  47416. * 可以施加到刚体的最大力。
  47417. */
  47418. get maxMotorForce(): number;
  47419. set maxMotorForce(v: number);
  47420. /**
  47421. * @en
  47422. * The expected motor speed.
  47423. * @zh
  47424. * 期望的马达速度。
  47425. */
  47426. get motorSpeed(): number;
  47427. set motorSpeed(v: number);
  47428. /**
  47429. * @en
  47430. * Enable joint distance limit?
  47431. * @zh
  47432. * 是否开启关节的距离限制?
  47433. */
  47434. get enableLimit(): boolean;
  47435. set enableLimit(v: boolean);
  47436. /**
  47437. * @en
  47438. * The lower joint limit.
  47439. * @zh
  47440. * 刚体能够移动的最小值。
  47441. */
  47442. get lowerLimit(): number;
  47443. set lowerLimit(v: number);
  47444. /**
  47445. * @en
  47446. * The lower joint limit.
  47447. * @zh
  47448. * 刚体能够移动的最大值。
  47449. */
  47450. get upperLimit(): number;
  47451. set upperLimit(v: number);
  47452. }
  47453. export class FixedJoint2D extends Joint2D {
  47454. TYPE: EJoint2DType;
  47455. /**
  47456. * @en
  47457. * The frequency.
  47458. * @zh
  47459. * 弹性系数。
  47460. */
  47461. get frequency(): number;
  47462. set frequency(v: number);
  47463. /**
  47464. * @en
  47465. * The damping ratio.
  47466. * @zh
  47467. * 阻尼,表示关节变形后,恢复到初始状态受到的阻力。
  47468. */
  47469. get dampingRatio(): number;
  47470. set dampingRatio(v: number);
  47471. }
  47472. export class WheelJoint2D extends Joint2D {
  47473. TYPE: EJoint2DType;
  47474. /**
  47475. * @en Wheel susspension direction.
  47476. * @zh 轮子震动方向。
  47477. */
  47478. get angle(): number;
  47479. set angle(v: number);
  47480. /**
  47481. * @en
  47482. * Enable joint motor?
  47483. * @zh
  47484. * 是否开启关节马达?
  47485. */
  47486. get enableMotor(): boolean;
  47487. set enableMotor(v: boolean);
  47488. /**
  47489. * @en
  47490. * The maxium torque can be applied to rigidbody to rearch the target motor speed.
  47491. * @zh
  47492. * 可以施加到刚体的最大扭矩。
  47493. */
  47494. get maxMotorTorque(): number;
  47495. set maxMotorTorque(v: number);
  47496. /**
  47497. * @en
  47498. * The expected motor speed.
  47499. * @zh
  47500. * 期望的马达速度。
  47501. */
  47502. get motorSpeed(): number;
  47503. set motorSpeed(v: number);
  47504. /**
  47505. * @en
  47506. * The spring frequency.
  47507. * @zh
  47508. * 弹性系数。
  47509. */
  47510. get frequency(): number;
  47511. set frequency(v: number);
  47512. /**
  47513. * @en
  47514. * The damping ratio.
  47515. * @zh
  47516. * 阻尼,表示关节变形后,恢复到初始状态受到的阻力。
  47517. */
  47518. get dampingRatio(): number;
  47519. set dampingRatio(v: number);
  47520. }
  47521. export class HingeJoint2D extends Joint2D {
  47522. TYPE: EJoint2DType;
  47523. /**
  47524. * @en
  47525. * Enable joint limit?
  47526. * @zh
  47527. * 是否开启关节的限制?
  47528. */
  47529. get enableLimit(): boolean;
  47530. set enableLimit(v: boolean);
  47531. /**
  47532. * @en
  47533. * The lower angle.
  47534. * @zh
  47535. * 角度的最低限制。
  47536. */
  47537. get lowerAngle(): number;
  47538. set lowerAngle(v: number);
  47539. /**
  47540. * @en
  47541. * The upper angle.
  47542. * @zh
  47543. * 角度的最高限制。
  47544. */
  47545. get upperAngle(): number;
  47546. set upperAngle(v: number);
  47547. /**
  47548. * @en
  47549. * Enable joint motor?
  47550. * @zh
  47551. * 是否开启关节马达?
  47552. */
  47553. get enableMotor(): boolean;
  47554. set enableMotor(v: boolean);
  47555. /**
  47556. * @en
  47557. * The maxium torque can be applied to rigidbody to rearch the target motor speed.
  47558. * @zh
  47559. * 可以施加到刚体的最大扭矩。
  47560. */
  47561. get maxMotorTorque(): number;
  47562. set maxMotorTorque(v: number);
  47563. /**
  47564. * @en
  47565. * The expected motor speed.
  47566. * @zh
  47567. * 期望的马达速度。
  47568. */
  47569. get motorSpeed(): number;
  47570. set motorSpeed(v: number);
  47571. }
  47572. /**
  47573. * @en
  47574. * The definition of the triggering event.
  47575. * @zh
  47576. * 触发事件。
  47577. */
  47578. export interface ITriggerEvent {
  47579. /**
  47580. * @en
  47581. * The type of trigger event.
  47582. * @zh
  47583. * 触发的事件类型。
  47584. */
  47585. readonly type: TriggerEventType;
  47586. /**
  47587. * @en
  47588. * The collider component instance of the event owner.
  47589. * @zh
  47590. * 触发事件中的自己的碰撞器
  47591. */
  47592. readonly selfCollider: physics.Collider;
  47593. /**
  47594. * @en
  47595. * Trigger another collider in event.
  47596. * @zh
  47597. * 触发事件中的另一个碰撞器
  47598. */
  47599. readonly otherCollider: physics.Collider;
  47600. /**
  47601. * @en
  47602. * Gets the lowLevel object, through which all the exposed properties can be accessed.
  47603. * @zh
  47604. * 获取实现对象,通过它可以访问到底层暴露的所有属性。
  47605. */
  47606. readonly impl: any;
  47607. }
  47608. /**
  47609. * @en
  47610. * The value type definition of the trigger event.
  47611. * @zh
  47612. * 触发事件的值类型定义。
  47613. */
  47614. export type TriggerEventType = "onTriggerEnter" | "onTriggerStay" | "onTriggerExit";
  47615. /**
  47616. * @en
  47617. * Signature definition of the callback function that triggers the event.
  47618. * @zh
  47619. * 触发事件的回调函数签名定义。
  47620. */
  47621. export type TriggerCallback = (event?: ITriggerEvent) => void;
  47622. /**
  47623. * @en
  47624. * Collision information for collision events.
  47625. * @zh
  47626. * 碰撞事件的碰撞信息。
  47627. */
  47628. export interface IContactEquation {
  47629. /**
  47630. * @en
  47631. * Gets the lowLevel object, through which all the exposed properties can be accessed.
  47632. * @zh
  47633. * 获取实现对象,通过它可以访问到底层暴露的所有属性。
  47634. */
  47635. readonly impl: any;
  47636. /**
  47637. * @en
  47638. * Gets whether the rigid body bound to the selfCollider is A.
  47639. * @zh
  47640. * 获取`selfCollider`所绑定的刚体是否为 A 。
  47641. */
  47642. readonly isBodyA: boolean;
  47643. /**
  47644. * @en
  47645. * Gets the contact point relative to the rigid body A in the local coordinate system.
  47646. * @zh
  47647. * 获取本地坐标系中相对于刚体 A 的碰撞点。
  47648. * @param out used to storage the output.
  47649. */
  47650. getLocalPointOnA(out: math.IVec3Like): void;
  47651. /**
  47652. * @en
  47653. * Gets the contact point relative to the rigid body B in the local coordinate system.
  47654. * @zh
  47655. * 获取本地坐标系中相对于刚体 B 的碰撞点。
  47656. * @param out used to storage the output.
  47657. */
  47658. getLocalPointOnB(out: math.IVec3Like): void;
  47659. /**
  47660. * @en
  47661. * Gets the contact point relative to the rigid body A in the world coordinate system.
  47662. * @zh
  47663. * 获取世界坐标系中相对于刚体 A 的碰撞点。
  47664. * @param out used to storage the output.
  47665. */
  47666. getWorldPointOnA(out: math.IVec3Like): void;
  47667. /**
  47668. * @en
  47669. * Gets the contact point relative to the rigid body B in the world coordinate system.
  47670. * @zh
  47671. * 获取世界坐标系中相对于刚体 B 的碰撞点。
  47672. * @param out used to storage the output.
  47673. */
  47674. getWorldPointOnB(out: math.IVec3Like): void;
  47675. /**
  47676. * @en
  47677. * Gets the contact normal relative to the rigid body A in the local coordinate system.
  47678. * @zh
  47679. * 获取本地坐标系中相对于刚体 A 的碰撞法线。
  47680. * @param out used to storage the output.
  47681. */
  47682. getLocalNormalOnA(out: math.IVec3Like): void;
  47683. /**
  47684. * @en
  47685. * Gets the contact normal relative to the rigid body B in the local coordinate system.
  47686. * @zh
  47687. * 获取本地坐标系中相对于刚体 B 的碰撞法线。
  47688. * @param out used to storage the output.
  47689. */
  47690. getLocalNormalOnB(out: math.IVec3Like): void;
  47691. /**
  47692. * @en
  47693. * Gets the contact normal relative to the rigid body A in the world coordinate system.
  47694. * @zh
  47695. * 获取世界坐标系中相对于刚体 A 的碰撞法线。
  47696. * @param out used to storage the output.
  47697. */
  47698. getWorldNormalOnA(out: math.IVec3Like): void;
  47699. /**
  47700. * @en
  47701. * Gets the contact normal relative to the rigid body B in the world coordinate system.
  47702. * @zh
  47703. * 获取世界坐标系中相对于刚体 B 的碰撞法线。
  47704. * @param out used to storage the output.
  47705. */
  47706. getWorldNormalOnB(out: math.IVec3Like): void;
  47707. }
  47708. /**
  47709. * @en
  47710. * The definition of the collision event.
  47711. * @zh
  47712. * 碰撞事件。
  47713. */
  47714. export interface ICollisionEvent {
  47715. /**
  47716. * @en
  47717. * The type of collision event.
  47718. * @zh
  47719. * 碰撞的事件类型。
  47720. */
  47721. readonly type: CollisionEventType;
  47722. /**
  47723. * @en
  47724. * The collider component instance of the event owner.
  47725. * @zh
  47726. * 碰撞中的自己的碰撞器。
  47727. */
  47728. readonly selfCollider: physics.Collider;
  47729. /**
  47730. * @en
  47731. * Another collider in collision.
  47732. * @zh
  47733. * 碰撞中的另一个碰撞器。
  47734. */
  47735. readonly otherCollider: physics.Collider;
  47736. /**
  47737. * @en
  47738. * Information about all points of impact in a collision event.
  47739. * @zh
  47740. * 碰撞中的所有碰撞点的信息。
  47741. */
  47742. readonly contacts: IContactEquation[];
  47743. /**
  47744. * @en
  47745. * Gets the lowLevel object, through which all the exposed properties can be accessed.
  47746. * @zh
  47747. * 获取实现对象,通过它可以访问到底层暴露的所有属性。
  47748. */
  47749. readonly impl: any;
  47750. }
  47751. /**
  47752. * @en
  47753. * Value type definitions for collision events.
  47754. * @zh
  47755. * 碰撞事件的值类型定义。
  47756. */
  47757. export type CollisionEventType = "onCollisionEnter" | "onCollisionStay" | "onCollisionExit";
  47758. /**
  47759. * @en
  47760. * Callback function signature definition for collision events.
  47761. * @zh
  47762. * 碰撞事件的回调函数签名定义。
  47763. */
  47764. export type CollisionCallback = (event?: ICollisionEvent) => void;
  47765. /**
  47766. * @en
  47767. * The definition of the trigger event of the character controller.
  47768. * @zh
  47769. * 角色控制器触发事件的值类型定义。
  47770. */
  47771. export type CharacterTriggerEventType = "onControllerTriggerEnter" | "onControllerTriggerStay" | "onControllerTriggerExit";
  47772. /**
  47773. * @en
  47774. * Value type definitions fot the collision events of character controller.
  47775. * @zh
  47776. * 角色控制器碰撞事件的值类型定义。
  47777. */
  47778. export type CharacterCollisionEventType = "onControllerColliderHit";
  47779. /**
  47780. * @en
  47781. * Contact information of the collision event of character controller.
  47782. * @zh
  47783. * 角色控制器碰撞事件的碰撞信息。
  47784. */
  47785. export class CharacterControllerContact {
  47786. /**
  47787. * @en
  47788. * Character Controller in collision.
  47789. * @zh
  47790. * 碰撞中的角色控制器。
  47791. */
  47792. controller: physics.CharacterController;
  47793. /**
  47794. * @en
  47795. * Collider in collision.
  47796. * @zh
  47797. * 碰撞中的碰撞器。
  47798. */
  47799. collider: physics.Collider;
  47800. /**
  47801. * @en
  47802. * The contact point in the world coordinate system.
  47803. * @zh
  47804. * 世界坐标系中的碰撞点。
  47805. */
  47806. worldPosition: math.Vec3;
  47807. /**
  47808. * @en
  47809. * The contact normal in the world coordinate system.
  47810. * @zh
  47811. * 世界坐标系中的碰撞法线。
  47812. */
  47813. worldNormal: math.Vec3;
  47814. /**
  47815. * @en
  47816. * Motion direction.
  47817. * @zh
  47818. * 移动方向。
  47819. */
  47820. motionDirection: math.Vec3;
  47821. /**
  47822. * @en
  47823. * Motion length.
  47824. * @zh
  47825. * 移动长度。
  47826. */
  47827. motionLength: number;
  47828. }
  47829. export namespace physics {
  47830. /**
  47831. * @en
  47832. * Physics system.
  47833. * @zh
  47834. * 物理系统。
  47835. */
  47836. export class PhysicsSystem extends System implements __private._cocos_physics_framework_physics_selector__IWorldInitData {
  47837. static get PHYSICS_NONE(): boolean;
  47838. static get PHYSICS_BUILTIN(): boolean;
  47839. static get PHYSICS_CANNON(): boolean;
  47840. static get PHYSICS_BULLET(): boolean;
  47841. static get PHYSICS_PHYSX(): boolean;
  47842. /**
  47843. * @en
  47844. * Gets the ID of the system.
  47845. * @zh
  47846. * 获取此系统的ID。
  47847. */
  47848. static readonly ID = "PHYSICS";
  47849. /**
  47850. * @en
  47851. * Gets the predefined physics groups.
  47852. * @zh
  47853. * 获取预定义的物理分组。
  47854. */
  47855. static get PhysicsGroup(): typeof PhysicsGroup;
  47856. /**
  47857. * @en
  47858. * Gets the physical system instance.
  47859. * @zh
  47860. * 获取物理系统实例。
  47861. */
  47862. static get instance(): PhysicsSystem;
  47863. /**
  47864. * @en
  47865. * Gets or sets whether the physical system is enabled, which can be used to pause or continue running the physical system.
  47866. * @zh
  47867. * 获取或设置是否启用物理系统,可以用于暂停或继续运行物理系统。
  47868. */
  47869. get enable(): boolean;
  47870. set enable(value: boolean);
  47871. /**
  47872. * @zh
  47873. * Gets or sets whether the physical system allows automatic sleep, which defaults to true.
  47874. * @zh
  47875. * 获取或设置物理系统是否允许自动休眠,默认为 true。
  47876. */
  47877. get allowSleep(): boolean;
  47878. set allowSleep(v: boolean);
  47879. /**
  47880. * @en
  47881. * Gets or sets the maximum number of simulated substeps per frame.
  47882. * @zh
  47883. * 获取或设置每帧模拟的最大子步数。
  47884. */
  47885. get maxSubSteps(): number;
  47886. set maxSubSteps(value: number);
  47887. /**
  47888. * @en
  47889. * Gets or sets the fixed delta time consumed by each simulation step in seconds.
  47890. * @zh
  47891. * 获取或设置每步模拟消耗的固定时间(以 s 为单位)。
  47892. */
  47893. get fixedTimeStep(): number;
  47894. set fixedTimeStep(value: number);
  47895. /**
  47896. * @en
  47897. * Gets or sets the value of gravity in the physical world, which defaults to (0, -10, 0).
  47898. * @zh
  47899. * 获取或设置物理世界的重力数值,默认为 (0, -10, 0)。
  47900. */
  47901. get gravity(): math.Vec3;
  47902. set gravity(gravity: math.Vec3);
  47903. /**
  47904. * @en
  47905. * Gets or sets the default speed threshold for going to sleep.
  47906. * @zh
  47907. * 获取或设置进入休眠的默认速度临界值。
  47908. */
  47909. get sleepThreshold(): number;
  47910. set sleepThreshold(v: number);
  47911. /**
  47912. * @en
  47913. * Turn on or off the automatic simulation.
  47914. * @zh
  47915. * 获取或设置是否自动模拟。
  47916. */
  47917. get autoSimulation(): boolean;
  47918. set autoSimulation(value: boolean);
  47919. /**
  47920. * @en
  47921. * Gets the global default physical material.
  47922. * @zh
  47923. * 获取全局的默认物理材质。
  47924. */
  47925. get defaultMaterial(): PhysicsMaterial;
  47926. /**
  47927. * @en
  47928. * Set the default physics material.
  47929. * @zh
  47930. * 设置默认物理材质。
  47931. */
  47932. setDefaultPhysicsMaterial(material: PhysicsMaterial): void;
  47933. /**
  47934. * @en
  47935. * Gets the wrappered object of the physical world through which you can access the actual underlying object.
  47936. * @zh
  47937. * 获取物理世界的封装对象,通过它你可以访问到实际的底层对象。
  47938. */
  47939. get physicsWorld(): __private._cocos_physics_spec_i_physics_world__IPhysicsWorld;
  47940. /**
  47941. * @en
  47942. * Gets the raycastClosest test result.
  47943. * @zh
  47944. * 获取 raycastClosest 的检测结果。
  47945. */
  47946. readonly raycastClosestResult: PhysicsRayResult;
  47947. /**
  47948. * @en
  47949. * Gets the raycast test results.
  47950. * @zh
  47951. * 获取 raycast 的检测结果。
  47952. */
  47953. readonly raycastResults: PhysicsRayResult[];
  47954. /**
  47955. * @en
  47956. * Gets the lineStripCastClosest test result.
  47957. * @zh
  47958. * 获取 lineStripCastClosest 的检测结果。
  47959. */
  47960. lineStripCastClosestResult: PhysicsLineStripCastResult;
  47961. /**
  47962. * @en
  47963. * Gets the lineStripCast test results.
  47964. * @zh
  47965. * 获取 lineStripCast 的检测结果。
  47966. */
  47967. lineStripCastResults: PhysicsLineStripCastResult[];
  47968. /**
  47969. * @en
  47970. * Gets the sweepCastClosest test result.
  47971. * @zh
  47972. * 获取 sweepCastClosest 的检测结果。
  47973. */
  47974. readonly sweepCastClosestResult: PhysicsRayResult;
  47975. /**
  47976. * @en
  47977. * Gets the sweepCast test results.
  47978. * @zh
  47979. * 获取 sweepCast 的检测结果。
  47980. */
  47981. readonly sweepCastResults: PhysicsRayResult[];
  47982. /**
  47983. * @en
  47984. * Gets the collision matrix that used for initialization only.
  47985. * @zh
  47986. * 获取碰撞矩阵,它仅用于初始化。
  47987. */
  47988. readonly collisionMatrix: ICollisionMatrix;
  47989. /**
  47990. * @en
  47991. * The minimum size of the collision body.
  47992. * @zh
  47993. * 碰撞体的最小尺寸。
  47994. */
  47995. minVolumeSize: number;
  47996. readonly useNodeChains: boolean;
  47997. postUpdate(deltaTime: number): void;
  47998. /**
  47999. * @en
  48000. * Reset the physics configuration.
  48001. * @zh
  48002. * 重置物理配置。
  48003. */
  48004. resetConfiguration(config?: IPhysicsConfig): void;
  48005. /**
  48006. * @en
  48007. * Reset the accumulator of time to given value.
  48008. * @zh
  48009. * 重置时间累积总量为给定值。
  48010. */
  48011. resetAccumulator(time?: number): void;
  48012. /**
  48013. * @en
  48014. * Perform simulation steps for the physics world.
  48015. * @zh
  48016. * 执行物理世界的模拟步进。
  48017. * @param fixedTimeStep
  48018. */
  48019. step(fixedTimeStep: number, deltaTime?: number, maxSubSteps?: number): void;
  48020. /**
  48021. * @en
  48022. * Sync the scene world transform changes to the physics world.
  48023. * @zh
  48024. * 同步场景世界的变化信息到物理世界中。
  48025. */
  48026. syncSceneToPhysics(): void;
  48027. /**
  48028. * @en
  48029. * Emit trigger and collision events.
  48030. * @zh
  48031. * 触发`trigger`和`collision`事件。
  48032. */
  48033. emitEvents(): void;
  48034. /**
  48035. * @en
  48036. * Get or set debug draw flags. Default is EPhysicsDrawFlags.NONE.
  48037. * Refer to EPhysicsDrawFlags.
  48038. * Note: Since physics debug draw uses Geometry-Renderer to do drawing,
  48039. * make sure Geometry-Renderer is not cropped in Project Setting.
  48040. * @zh
  48041. * 获取或设置调试绘制标志。默认为 EPhysicsDrawFlags.NONE。
  48042. * 参考 EPhysicsDrawFlags。
  48043. * 注意:因为物理调试绘制使用几何渲染器来绘制,请确保项目设置中几何渲染器没有被裁剪掉。
  48044. */
  48045. get debugDrawFlags(): number;
  48046. set debugDrawFlags(v: number);
  48047. /**
  48048. * @en
  48049. * Get or set constraint debug draw size. Default is 0.3.
  48050. * @zh
  48051. * 获取或设置约束的调试绘制尺寸。默认为 0.3。
  48052. */
  48053. get debugDrawConstraintSize(): number;
  48054. set debugDrawConstraintSize(v: number);
  48055. /**
  48056. * @en
  48057. * Collision detect all collider, and record all the detected results, through PhysicsSystem.Instance.RaycastResults access to the results.
  48058. * @zh
  48059. * 检测所有的碰撞盒,并记录所有被检测到的结果,通过 PhysicsSystem.instance.raycastResults 访问结果。
  48060. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48061. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48062. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48063. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48064. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48065. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48066. */
  48067. raycast(worldRay: geometry.Ray, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48068. /**
  48069. * @en
  48070. * Collision detect all collider, and record and ray test results with the shortest distance
  48071. * by PhysicsSystem.Instance.RaycastClosestResult access to the results.
  48072. * @zh
  48073. * 检测所有的碰撞盒,并记录与射线距离最短的检测结果,通过 PhysicsSystem.instance.raycastClosestResult 访问结果。
  48074. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48075. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48076. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48077. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48078. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48079. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48080. */
  48081. raycastClosest(worldRay: geometry.Ray, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48082. /**
  48083. * @en
  48084. * Collision detect all collider and record all the detected results, using
  48085. * PhysicsSystem.Instance.lineStripCastResults to access the results.
  48086. * @zh
  48087. * 逐线段检测所有的碰撞盒,并记录所有检测结果。通过 PhysicsSystem.instance.lineStripCastResults 访问结果。
  48088. * @param samplePointsWorldSpace @zh 世界空间下的采样点/直线段 @en sample points/line segments in world space
  48089. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48090. * @param maxDistance @zh 沿着直线段的最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48091. * @en Maximum detection distance along the line segments, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48092. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48093. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48094. */
  48095. lineStripCast(samplePointsWorldSpace: Array<math.Vec3>, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48096. /**
  48097. * @en
  48098. * Collision detect all collider, and record the ray test results with the shortest distance.
  48099. * Using PhysicsSystem.Instance.lineStripCastClosestResult to access the result.
  48100. * @zh
  48101. * 逐线段检测所有的碰撞盒,并记录沿这些线段距离最短的检测结果,通过 PhysicsSystem.instance.lineStripCastClosestResult 访问结果。
  48102. * @param samplePointsWorldSpace @zh 世界空间下的采样点/直线段 @en sample points/line segments in world space
  48103. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48104. * @param maxDistance @zh 沿着直线段的最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48105. * @en Maximum detection distance along the line segments, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48106. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48107. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48108. */
  48109. lineStripCastClosest(samplePointsWorldSpace: Array<math.Vec3>, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48110. /**
  48111. * @en
  48112. * Cast a box along a ray and record information on what was hit.
  48113. * Access the results through PhysicsSystem.Instance.sweepCastResults.
  48114. * @zh
  48115. * 将盒体沿着射线发射,记录所有被检测到的结果,通过 PhysicsSystem.instance.sweepCastResults 访问结果。
  48116. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48117. * @param halfExtent @zh 盒体的一半尺寸 @en Half extent of the box
  48118. * @param orientation @zh 盒体的方向 @en Orientation of the box
  48119. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48120. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48121. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48122. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48123. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48124. */
  48125. sweepBox(worldRay: geometry.Ray, halfExtent: math.IVec3Like, orientation: math.IQuatLike, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48126. /**
  48127. * @en
  48128. * Cast a box along a ray and record information on the closest hit.
  48129. * Access the results through PhysicsSystem.Instance.sweepCastClosestResult.
  48130. * @zh
  48131. * 将盒体沿着射线发射,记录距离最近的碰撞结果,通过 PhysicsSystem.instance.sweepCastClosestResult 访问结果。
  48132. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48133. * @param halfExtent @zh 盒体的一半尺寸 @en Half extent of the box
  48134. * @param orientation @zh 盒体的方向 @en Orientation of the box
  48135. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48136. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48137. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48138. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48139. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48140. */
  48141. sweepBoxClosest(worldRay: geometry.Ray, halfExtent: math.IVec3Like, orientation: math.IQuatLike, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48142. /**
  48143. * @en
  48144. * Cast a sphere along a ray and record information on what was hit.
  48145. * Access the results through PhysicsSystem.Instance.sweepCastResults.
  48146. * @zh
  48147. * 将球体沿着射线发射,记录所有被检测到的结果,通过 PhysicsSystem.instance.sweepCastResults 访问结果。
  48148. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48149. * @param radius @zh 球体的半径 @en Radius of the sphere
  48150. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48151. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48152. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48153. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48154. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48155. */
  48156. sweepSphere(worldRay: geometry.Ray, radius: number, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48157. /**
  48158. * @en
  48159. * Cast a sphere along a ray and record information on the closest hit.
  48160. * Access the result through PhysicsSystem.Instance.sweepCastClosestResult.
  48161. * @zh
  48162. * 将球体沿着射线发射,记录距离最近的碰撞结果,通过 PhysicsSystem.instance.sweepCastClosestResult 访问结果。
  48163. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48164. * @param radius @zh 球体的半径 @en Radius of the sphere
  48165. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48166. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48167. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48168. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48169. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48170. */
  48171. sweepSphereClosest(worldRay: geometry.Ray, radius: number, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48172. /**
  48173. * @en
  48174. * Cast a capsule along a ray and record information on what was hit.
  48175. * Access the results through PhysicsSystem.Instance.sweepCastResults.
  48176. * Capsule's default axis is along the world space Y axis.
  48177. * @zh
  48178. * 将胶囊体沿着射线发射,记录所有被检测到的结果,通过 PhysicsSystem.instance.sweepCastResults 访问结果。
  48179. * 胶囊体的默认朝向是世界空间下的 Y 轴。
  48180. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48181. * @param radius @zh 胶囊体的半径 @en Radius of the capsule
  48182. * @param height @zh 胶囊体末端两个半球圆心的距离 @en Distance between the two half-sphere centers of the capsule
  48183. * @param orientation @zh 胶囊体的朝向 @en Orientation of the capsule
  48184. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48185. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48186. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48187. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48188. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48189. */
  48190. sweepCapsule(worldRay: geometry.Ray, radius: number, height: number, orientation: math.IQuatLike, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48191. /**
  48192. * @en
  48193. * Cast a capsule along a ray and record information on the closest hit.
  48194. * Access the result through PhysicsSystem.Instance.sweepCastClosestResult.
  48195. * Capsule's default axis is along the world space Y axis.
  48196. * @zh
  48197. * 将胶囊体沿着射线发射,记录距离最近的碰撞结果,通过 PhysicsSystem.instance.sweepCastClosestResult 访问结果。
  48198. * 胶囊体的默认朝向是世界空间下的 Y 轴。
  48199. * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
  48200. * @param radius @zh 胶囊体的半径 @en Radius of the capsule
  48201. * @param height @zh 胶囊体末端两个半球圆心的距离 @en Distance between the two half-sphere centers of the capsule
  48202. * @param orientation @zh 胶囊体的朝向 @en Orientation of the capsule
  48203. * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
  48204. * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
  48205. * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
  48206. * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
  48207. * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
  48208. */
  48209. sweepCapsuleClosest(worldRay: geometry.Ray, radius: number, height: number, orientation: math.IQuatLike, mask?: number, maxDistance?: number, queryTrigger?: boolean): boolean;
  48210. /**
  48211. * @en
  48212. * Construct and register the system singleton.
  48213. * If the module is pre-loaded, it will be executed automatically.
  48214. * @zh
  48215. * 构造并注册系统单例。
  48216. * 预先加载模块的情况下,会自动执行。
  48217. */
  48218. static constructAndRegister(): void;
  48219. }
  48220. /**
  48221. * @en
  48222. * Used to store physics ray test results.
  48223. * @zh
  48224. * 用于保存物理射线检测结果。
  48225. */
  48226. export class PhysicsRayResult {
  48227. /**
  48228. * @en
  48229. * The hit point,in world space.
  48230. * @zh
  48231. * 在世界坐标系下的击中点。
  48232. */
  48233. get hitPoint(): math.Vec3;
  48234. /**
  48235. * @en
  48236. * The distance between the ray origin with the hit.
  48237. * @zh
  48238. * 距离。
  48239. */
  48240. get distance(): number;
  48241. /**
  48242. * @en
  48243. * The collider hit by the ray.
  48244. * @zh
  48245. * 击中的碰撞盒
  48246. */
  48247. get collider(): Collider;
  48248. /**
  48249. * @en
  48250. * The normal of the hit plane,in world space.
  48251. * @zh
  48252. * 在世界坐标系下击中面的法线。
  48253. */
  48254. get hitNormal(): math.Vec3;
  48255. protected _hitPoint: math.Vec3;
  48256. protected _hitNormal: math.Vec3;
  48257. protected _distance: number;
  48258. protected _collider: Collider | null;
  48259. /**
  48260. * @en
  48261. * internal methods.
  48262. * @zh
  48263. * 设置射线,此方法由引擎内部使用,请勿在外部脚本调用。
  48264. *
  48265. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  48266. */
  48267. _assign(hitPoint: math.IVec3Like, distance: number, collider: Collider, hitNormal: math.IVec3Like): void;
  48268. /**
  48269. * @en
  48270. * clone.
  48271. * @zh
  48272. * 克隆。
  48273. */
  48274. clone(): PhysicsRayResult;
  48275. }
  48276. /**
  48277. * @en
  48278. * Used to store physics line strip cast test results.
  48279. * @zh
  48280. * 用于保存物理逐线段检测结果。
  48281. */
  48282. export class PhysicsLineStripCastResult extends PhysicsRayResult {
  48283. /**
  48284. * @en
  48285. * The line id of the line segments. This is only for lineStripCast
  48286. * @zh
  48287. * id
  48288. */
  48289. get id(): number;
  48290. /**
  48291. * @en
  48292. * clone.
  48293. * @zh
  48294. * 克隆。
  48295. */
  48296. clone(): PhysicsLineStripCastResult;
  48297. }
  48298. /**
  48299. * @en
  48300. * Base class for colliders.
  48301. * @zh
  48302. * 碰撞器的基类。
  48303. */
  48304. export class Collider extends __private._cocos_physics_framework_components_colliders_collider__Collider_base {
  48305. /**
  48306. * @en
  48307. * Enumeration of collider types.
  48308. * @zh
  48309. * 碰撞体类型的枚举。
  48310. */
  48311. static readonly Type: typeof EColliderType;
  48312. /**
  48313. * @en
  48314. * Enumeration of axes.
  48315. * @zh
  48316. * 坐标轴方向的枚举。
  48317. */
  48318. static readonly Axis: typeof EAxisDirection;
  48319. /**
  48320. * @en
  48321. * Get the rigid body component to which the collider is bound, possibly null.
  48322. * @zh
  48323. * 获取碰撞器所绑定的刚体组件,可能为空。
  48324. */
  48325. get attachedRigidBody(): RigidBody | null;
  48326. /**
  48327. * @en
  48328. * Gets or sets the physical material for this collider.
  48329. * @zh
  48330. * 获取或设置此碰撞器的物理材质。
  48331. */
  48332. get sharedMaterial(): PhysicsMaterial | null;
  48333. set sharedMaterial(value: PhysicsMaterial | null);
  48334. /**
  48335. * @en
  48336. * Gets or sets the physics material for this collider, which in Shared state will generate a new instance.
  48337. * @zh
  48338. * 获取或设置此碰撞器的物理材质,共享状态下获取将会生成新的实例。
  48339. */
  48340. get material(): PhysicsMaterial | null;
  48341. set material(value: PhysicsMaterial | null);
  48342. /**
  48343. * @en
  48344. * Gets or sets the collider is trigger, this will be always trigger if using builtin.
  48345. * @zh
  48346. * 获取或设置碰撞器是否为触发器。(builtin 中无论真假都为触发器)
  48347. */
  48348. get isTrigger(): boolean;
  48349. set isTrigger(value: boolean);
  48350. /**
  48351. * @en
  48352. * Gets or sets the center of the collider, in local space.
  48353. * @zh
  48354. * 在本地空间中,获取或设置碰撞器的中心点。
  48355. */
  48356. get center(): math.Vec3;
  48357. set center(value: math.Vec3);
  48358. /**
  48359. * @en
  48360. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48361. * @zh
  48362. * 获取封装对象,通过此对象可以访问到底层实例。
  48363. */
  48364. get shape(): __private._cocos_physics_spec_i_physics_shape__IBaseShape | null;
  48365. get worldBounds(): Readonly<geometry.AABB>;
  48366. get boundingSphere(): Readonly<geometry.Sphere>;
  48367. get needTriggerEvent(): boolean;
  48368. get needCollisionEvent(): boolean;
  48369. readonly type: EColliderType;
  48370. protected _shape: __private._cocos_physics_spec_i_physics_shape__IBaseShape | null;
  48371. protected _aabb: geometry.AABB | null;
  48372. protected _boundingSphere: geometry.Sphere | null;
  48373. protected _isSharedMaterial: boolean;
  48374. protected _needTriggerEvent: boolean;
  48375. protected _needCollisionEvent: boolean;
  48376. protected _material: PhysicsMaterial | null;
  48377. protected _isTrigger: boolean;
  48378. protected readonly _center: math.Vec3;
  48379. protected get _isInitialized(): boolean;
  48380. constructor(type: EColliderType);
  48381. /**
  48382. * @en
  48383. * Registers callbacks associated with triggered or collision events.
  48384. * @zh
  48385. * 注册触发或碰撞事件相关的回调。
  48386. * @param type - The event type, onTriggerEnter|onTriggerStay|onTriggerExit|onCollisionEnter|onCollisionStay|onCollisionExit;
  48387. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  48388. * @param target - The event callback target.
  48389. */
  48390. on<TFunction extends __private._cocos_physics_framework_components_colliders_collider__Callback>(type: TriggerEventType | CollisionEventType | CharacterTriggerEventType, callback: TFunction, target?: any, once?: boolean): any;
  48391. /**
  48392. * @en
  48393. * Unregisters callbacks associated with trigger or collision events that have been registered.
  48394. * @zh
  48395. * 取消已经注册的触发或碰撞事件相关的回调。
  48396. * @param type - The event type, onTriggerEnter|onTriggerStay|onTriggerExit|onCollisionEnter|onCollisionStay|onCollisionExit;
  48397. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  48398. * @param target - The event callback target.
  48399. */
  48400. off(type: TriggerEventType | CollisionEventType | CharacterTriggerEventType, callback?: __private._cocos_physics_framework_components_colliders_collider__Callback, target?: any): void;
  48401. /**
  48402. * @en
  48403. * Registers a callback associated with a trigger or collision event, which is automatically unregistered once executed.
  48404. * @zh
  48405. * 注册触发或碰撞事件相关的回调,执行一次后会自动取消注册。
  48406. * @param type - The event type, onTriggerEnter|onTriggerStay|onTriggerExit|onCollisionEnter|onCollisionStay|onCollisionExit;
  48407. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  48408. * @param target - The event callback target.
  48409. */
  48410. once<TFunction extends __private._cocos_physics_framework_components_colliders_collider__Callback>(type: TriggerEventType | CollisionEventType | CharacterTriggerEventType, callback: TFunction, target?: any): any;
  48411. /**
  48412. * @en
  48413. * Removes all registered events of the specified target or type.
  48414. * @zh
  48415. * 移除所有指定目标或类型的注册事件。
  48416. * @param typeOrTarget - The event type or target.
  48417. */
  48418. removeAll(typeOrTarget: TriggerEventType | CollisionEventType | Record<string, unknown>): void;
  48419. /**
  48420. * @en
  48421. * Gets the group value.
  48422. * @zh
  48423. * 获取分组值。
  48424. * @returns @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  48425. */
  48426. getGroup(): number;
  48427. /**
  48428. * @en
  48429. * Sets the group value.
  48430. * @zh
  48431. * 设置分组值。
  48432. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  48433. */
  48434. setGroup(v: number): void;
  48435. /**
  48436. * @en
  48437. * Add a grouping value to fill in the group you want to join.
  48438. * @zh
  48439. * 添加分组值,可填要加入的 group。
  48440. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  48441. */
  48442. addGroup(v: number): void;
  48443. /**
  48444. * @en
  48445. * Subtract the grouping value to fill in the group to be removed.
  48446. * @zh
  48447. * 减去分组值,可填要移除的 group。
  48448. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  48449. */
  48450. removeGroup(v: number): void;
  48451. /**
  48452. * @en
  48453. * Gets the mask value.
  48454. * @zh
  48455. * 获取掩码值。
  48456. * @returns @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  48457. */
  48458. getMask(): number;
  48459. /**
  48460. * @en
  48461. * Sets the mask value.
  48462. * @zh
  48463. * 设置掩码值。
  48464. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  48465. */
  48466. setMask(v: number): void;
  48467. /**
  48468. * @en
  48469. * Add mask values to fill in groups that need to be checked.
  48470. * @zh
  48471. * 添加掩码值,可填入需要检查的 group。
  48472. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  48473. */
  48474. addMask(v: number): void;
  48475. /**
  48476. * @en
  48477. * Subtract the mask value to fill in the group that does not need to be checked.
  48478. * @zh
  48479. * 减去掩码值,可填入不需要检查的 group。
  48480. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  48481. */
  48482. removeMask(v: number): void;
  48483. protected onLoad(): void;
  48484. protected onEnable(): void;
  48485. protected onDisable(): void;
  48486. protected onDestroy(): void;
  48487. }
  48488. export namespace Collider {
  48489. export type Type = __private.__types_globals__EnumAlias<typeof EColliderType>;
  48490. export type Axis = __private.__types_globals__EnumAlias<typeof EAxisDirection>;
  48491. }
  48492. /**
  48493. * @en
  48494. * Box collider component.
  48495. * @zh
  48496. * 盒子碰撞器。
  48497. */
  48498. export class BoxCollider extends Collider {
  48499. /**
  48500. * @en
  48501. * Gets or sets the size of the box, in local space.
  48502. * @zh
  48503. * 获取或设置盒的大小。
  48504. */
  48505. get size(): math.Vec3;
  48506. set size(value: math.Vec3);
  48507. /**
  48508. * @en
  48509. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48510. * @zh
  48511. * 获取封装对象,通过此对象可以访问到底层实例。
  48512. */
  48513. get shape(): __private._cocos_physics_spec_i_physics_shape__IBoxShape;
  48514. constructor();
  48515. }
  48516. /**
  48517. * @en
  48518. * Sphere collider component.
  48519. * @zh
  48520. * 球碰撞器。
  48521. */
  48522. export class SphereCollider extends Collider {
  48523. /**
  48524. * @en
  48525. * Gets or sets the radius of the sphere.
  48526. * @zh
  48527. * 获取或设置球的半径。
  48528. */
  48529. get radius(): number;
  48530. set radius(value: number);
  48531. /**
  48532. * @en
  48533. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48534. * @zh
  48535. * 获取封装对象,通过此对象可以访问到底层实例。
  48536. */
  48537. get shape(): __private._cocos_physics_spec_i_physics_shape__ISphereShape;
  48538. constructor();
  48539. }
  48540. /**
  48541. * @en
  48542. * Capsule collider component.
  48543. * @zh
  48544. * 胶囊体碰撞器。
  48545. */
  48546. export class CapsuleCollider extends Collider {
  48547. /**
  48548. * @en
  48549. * Gets or sets the radius of the sphere on the capsule body, in local space.
  48550. * @zh
  48551. * 获取或设置胶囊体在本地坐标系下的球半径。
  48552. */
  48553. get radius(): number;
  48554. set radius(value: number);
  48555. /**
  48556. * @en
  48557. * Gets or sets the cylinder on the capsule body is at the corresponding axial height, in local space.
  48558. * @zh
  48559. * 获取或设置在本地坐标系下的胶囊体上圆柱体的高度。
  48560. */
  48561. get cylinderHeight(): number;
  48562. set cylinderHeight(value: number);
  48563. /**
  48564. * @en
  48565. * Gets or sets the capsule direction, in local space.
  48566. * @zh
  48567. * 获取或设置在本地坐标系下胶囊体的方向。
  48568. */
  48569. get direction(): EAxisDirection;
  48570. set direction(value: EAxisDirection);
  48571. /**
  48572. * @en
  48573. * Gets or sets the capsule height, in local space, with the minimum value being the diameter of the sphere.
  48574. * @zh
  48575. * 获取或设置在本地坐标系下胶囊体的高度,最小值为球的直径。
  48576. */
  48577. get height(): number;
  48578. set height(value: number);
  48579. /**
  48580. * @en
  48581. * Gets the capsule body is at the corresponding axial height, in world space.
  48582. * @zh
  48583. * 获取胶囊体在世界坐标系下相应胶囊体朝向上的高度,只读属性。
  48584. */
  48585. get worldHeight(): number;
  48586. /**
  48587. * @en
  48588. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48589. * @zh
  48590. * 获取封装对象,通过此对象可以访问到底层实例。
  48591. */
  48592. get shape(): __private._cocos_physics_spec_i_physics_shape__ICapsuleShape;
  48593. constructor();
  48594. }
  48595. /**
  48596. * @en
  48597. * Triangle mesh collider component.
  48598. * @zh
  48599. * 三角网格碰撞器。
  48600. */
  48601. export class MeshCollider extends Collider {
  48602. /**
  48603. * @en
  48604. * Gets or sets the mesh assets referenced by this collider.
  48605. * @zh
  48606. * 获取或设置此碰撞体引用的网格资源.
  48607. */
  48608. get mesh(): Mesh | null;
  48609. set mesh(value: Mesh | null);
  48610. /**
  48611. * @en
  48612. * Gets or sets whether the collider replaces the mesh with a convex shape.
  48613. * @zh
  48614. * 获取或设置此碰撞体是否用凸形状代替网格.
  48615. */
  48616. get convex(): boolean;
  48617. set convex(value: boolean);
  48618. /**
  48619. * @en
  48620. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48621. * @zh
  48622. * 获取封装对象,通过此对象可以访问到底层实例。
  48623. */
  48624. get shape(): __private._cocos_physics_spec_i_physics_shape__ITrimeshShape;
  48625. protected onEnable(): void;
  48626. constructor();
  48627. }
  48628. /**
  48629. * @en
  48630. * Cylinder collider component.
  48631. * @zh
  48632. * 圆柱体碰撞器。
  48633. */
  48634. export class CylinderCollider extends Collider {
  48635. /**
  48636. * @en
  48637. * Gets or sets the radius of the circle on the cylinder body, in local space.
  48638. * @zh
  48639. * 获取或设置圆柱体上圆面半径。
  48640. */
  48641. get radius(): number;
  48642. set radius(value: number);
  48643. /**
  48644. * @en
  48645. * Gets or sets the cylinder body is at the corresponding axial height, in local space.
  48646. * @zh
  48647. * 获取或设置圆柱体在相应轴向的高度。
  48648. */
  48649. get height(): number;
  48650. set height(value: number);
  48651. /**
  48652. * @en
  48653. * Gets or sets the cylinder direction, in local space.
  48654. * @zh
  48655. * 获取或设置在圆柱体本地空间上的方向。
  48656. */
  48657. get direction(): EAxisDirection;
  48658. set direction(value: EAxisDirection);
  48659. get shape(): __private._cocos_physics_spec_i_physics_shape__ICylinderShape;
  48660. constructor();
  48661. }
  48662. /**
  48663. * @en
  48664. * Cone collider component.
  48665. * @zh
  48666. * 圆锥体碰撞器。
  48667. */
  48668. export class ConeCollider extends Collider {
  48669. /**
  48670. * @en
  48671. * Gets or sets the radius of the circle on the cone body, in local space.
  48672. * @zh
  48673. * 获取或设置圆锥体上圆面半径。
  48674. */
  48675. get radius(): number;
  48676. set radius(value: number);
  48677. /**
  48678. * @en
  48679. * Gets or sets the cone body is at the corresponding axial height, in local space.
  48680. * @zh
  48681. * 获取或设置圆锥体在相应轴向的高度。
  48682. */
  48683. get height(): number;
  48684. set height(value: number);
  48685. /**
  48686. * @en
  48687. * Gets or sets the cone direction, in local space.
  48688. * @zh
  48689. * 获取或设置在圆锥体本地空间上的方向。
  48690. */
  48691. get direction(): EAxisDirection;
  48692. set direction(value: EAxisDirection);
  48693. get shape(): __private._cocos_physics_spec_i_physics_shape__IConeShape;
  48694. constructor();
  48695. }
  48696. /**
  48697. * @en
  48698. * Terrain collider component.
  48699. * @zh
  48700. * 地形碰撞器。
  48701. */
  48702. export class TerrainCollider extends Collider {
  48703. /**
  48704. * @en
  48705. * Gets or sets the terrain assets referenced by this collider.
  48706. * @zh
  48707. * 获取或设置此碰撞体引用的网格资源.
  48708. */
  48709. get terrain(): __private._cocos_physics_spec_i_external__ITerrainAsset | null;
  48710. set terrain(value: __private._cocos_physics_spec_i_external__ITerrainAsset | null);
  48711. /**
  48712. * @en
  48713. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48714. * @zh
  48715. * 获取封装对象,通过此对象可以访问到底层实例。
  48716. */
  48717. get shape(): __private._cocos_physics_spec_i_physics_shape__ITerrainShape;
  48718. protected onEnable(): void;
  48719. constructor();
  48720. }
  48721. /**
  48722. * @en
  48723. * Simplex collider, support point, line, triangle, tetrahedron.
  48724. * @zh
  48725. * 单纯形碰撞器,支持点、线、三角形、四面体。
  48726. */
  48727. export class SimplexCollider extends Collider {
  48728. static readonly ESimplexType: typeof ESimplexType;
  48729. get shapeType(): ESimplexType;
  48730. set shapeType(v: ESimplexType);
  48731. get vertex0(): math.IVec3Like;
  48732. set vertex0(v: math.IVec3Like);
  48733. get vertex1(): math.IVec3Like;
  48734. set vertex1(v: math.IVec3Like);
  48735. get vertex2(): math.IVec3Like;
  48736. set vertex2(v: math.IVec3Like);
  48737. get vertex3(): math.IVec3Like;
  48738. set vertex3(v: math.IVec3Like);
  48739. /**
  48740. * @en
  48741. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48742. * @zh
  48743. * 获取封装对象,通过此对象可以访问到底层实例。
  48744. */
  48745. get shape(): __private._cocos_physics_spec_i_physics_shape__ISimplexShape;
  48746. get vertices(): math.IVec3Like[];
  48747. constructor();
  48748. updateVertices(): void;
  48749. }
  48750. export namespace SimplexCollider {
  48751. export type ESimplexType = __private.__types_globals__EnumAlias<typeof physics.ESimplexType>;
  48752. }
  48753. /**
  48754. * @en
  48755. * Plane collider component.
  48756. * @zh
  48757. * 静态平面碰撞器。
  48758. */
  48759. export class PlaneCollider extends Collider {
  48760. /**
  48761. * @en
  48762. * Gets or sets the normal of the plane, in local space.
  48763. * @zh
  48764. * 获取或设置平面在本地坐标系下的法线。
  48765. */
  48766. get normal(): math.Vec3;
  48767. set normal(value: math.Vec3);
  48768. /**
  48769. * @en
  48770. * Gets or sets the value of the plane moving along the normal, in local space.
  48771. * @zh
  48772. * 获取或设置平面在本地坐标系下沿着法线移动的数值。
  48773. */
  48774. get constant(): number;
  48775. set constant(v: number);
  48776. /**
  48777. * @en
  48778. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  48779. * @zh
  48780. * 获取封装对象,通过此对象可以访问到底层实例。
  48781. */
  48782. get shape(): __private._cocos_physics_spec_i_physics_shape__IPlaneShape;
  48783. protected onEnable(): void;
  48784. constructor();
  48785. }
  48786. /**
  48787. * @en
  48788. * Base class for joint constraints, which depends on rigid body components.
  48789. * @zh
  48790. * 关节约束的基类,它依赖于刚体组件。
  48791. */
  48792. export class Constraint extends __private._cocos_physics_framework_components_constraints_constraint__Constraint_base {
  48793. /**
  48794. * @en
  48795. * Enumeration of joint types.
  48796. * @zh
  48797. * 关节类型的枚举。
  48798. */
  48799. static readonly Type: typeof EConstraintType;
  48800. /**
  48801. * @en
  48802. * Gets the collider attached rigid-body.
  48803. * @zh
  48804. * 获取碰撞器所绑定的刚体组件。
  48805. */
  48806. get attachedBody(): RigidBody | null;
  48807. /**
  48808. * @en
  48809. * Get or set the jointed rigid body, null means link to a static rigid body at the world origin.
  48810. * @zh
  48811. * 获取或设置关节连接的刚体,为空时表示链接到位于世界原点的静态刚体。
  48812. */
  48813. get connectedBody(): RigidBody | null;
  48814. set connectedBody(v: RigidBody | null);
  48815. /**
  48816. * @en
  48817. * Get or set whether collision is turned on between two rigid bodies connected by a joint.
  48818. * @zh
  48819. * 获取或设置关节连接的两刚体之间是否开启碰撞。
  48820. */
  48821. get enableCollision(): boolean;
  48822. set enableCollision(v: boolean);
  48823. /**
  48824. * @en
  48825. * Gets the type of this joint.
  48826. * @zh
  48827. * 获取此关节的类型。
  48828. */
  48829. readonly TYPE: EConstraintType;
  48830. protected _enableCollision: boolean;
  48831. protected _connectedBody: RigidBody | null;
  48832. protected _constraint: __private._cocos_physics_spec_i_physics_constraint__IBaseConstraint | null;
  48833. constructor(type: EConstraintType);
  48834. protected onLoad(): void;
  48835. protected onEnable(): void;
  48836. protected onDisable(): void;
  48837. protected onDestroy(): void;
  48838. }
  48839. export namespace Constraint {
  48840. export type Type = __private.__types_globals__EnumAlias<typeof EConstraintType>;
  48841. }
  48842. /**
  48843. * @en Hinge constraint.
  48844. * It keeps the local rotation axes of two rigid bodies aligned,
  48845. * and locks the relative motion along the rotation axis.
  48846. * @zh 铰链约束。
  48847. * 它保持两个刚体的本地旋转轴对齐,并锁定沿旋转轴的相对运动。
  48848. */
  48849. export class HingeConstraint extends Constraint {
  48850. /**
  48851. * @en
  48852. * The pivot point of the constraint in the local coordinate system of the attached rigid body.
  48853. * @zh
  48854. * 约束关节在连接刚体的本地坐标系中的锚点。
  48855. */
  48856. get pivotA(): math.Vec3;
  48857. set pivotA(v: math.Vec3);
  48858. /**
  48859. * @en
  48860. * The pivot point of the constraint in the local coordinate system of the connected rigid body.
  48861. * @zh
  48862. * 约束关节在连接刚体的本地坐标系中的锚点。
  48863. */
  48864. get pivotB(): math.Vec3;
  48865. set pivotB(v: math.Vec3);
  48866. /**
  48867. * @en
  48868. * The axis of the constraint in the local coordinate system of the attached rigid body.
  48869. * @zh
  48870. * 约束关节在连接刚体的本地坐标系中的轴。
  48871. */
  48872. get axis(): math.Vec3;
  48873. set axis(v: math.Vec3);
  48874. /**
  48875. * @en
  48876. * Whether to enable the rotation limit of the hinge constraint.
  48877. * @zh
  48878. * 是否开启旋转限制。
  48879. */
  48880. get limitEnabled(): boolean;
  48881. set limitEnabled(v: boolean);
  48882. /**
  48883. * @en
  48884. * The upper limit to the rotation angle of pivotB related to pivotB's local position.
  48885. * @zh
  48886. * 转轴约束的旋转角度上限。
  48887. */
  48888. get upperLimit(): number;
  48889. set upperLimit(v: number);
  48890. /**
  48891. * @en
  48892. * The lower limit to the rotation angle of pivotB related to pivotB's local position.
  48893. * @zh
  48894. * 转轴约束的旋转角度下限。
  48895. */
  48896. get lowerLimit(): number;
  48897. set lowerLimit(v: number);
  48898. /**
  48899. * @en
  48900. * Whether the motor is enabled or not.
  48901. * @zh
  48902. * 转轴约束是否启用 Motor
  48903. */
  48904. get motorEnabled(): boolean;
  48905. set motorEnabled(v: boolean);
  48906. /**
  48907. * @en
  48908. * The rotation speed of pivotA related to pivotB.
  48909. * @zh
  48910. * 转轴约束的旋转速度。
  48911. */
  48912. get motorVelocity(): number;
  48913. set motorVelocity(v: number);
  48914. /**
  48915. * @en
  48916. * The max drive force of the motor.
  48917. * @zh
  48918. * 转轴约束的最大驱动力。
  48919. */
  48920. get motorForceLimit(): number;
  48921. set motorForceLimit(v: number);
  48922. get constraint(): __private._cocos_physics_spec_i_physics_constraint__IHingeConstraint;
  48923. constructor();
  48924. }
  48925. /**
  48926. * @en The fixed constraint.
  48927. * It locks the relative position and rotation between two rigid bodies.
  48928. * @zh 固定关节。
  48929. * 固定关节会锁定两个刚体间的相对位置和相对旋转。
  48930. */
  48931. export class FixedConstraint extends Constraint {
  48932. /**
  48933. * @en
  48934. * The maximum force that can be applied to the constraint before it breaks.
  48935. * @zh
  48936. * 约束的断裂力阈值。
  48937. */
  48938. get breakForce(): number;
  48939. set breakForce(v: number);
  48940. /**
  48941. * @en
  48942. * The maximum torque that can be applied to the constraint before it breaks.
  48943. * @zh
  48944. * 约束的断裂扭矩阈值。
  48945. */
  48946. get breakTorque(): number;
  48947. set breakTorque(v: number);
  48948. get constraint(): __private._cocos_physics_spec_i_physics_constraint__IFixedConstraint;
  48949. constructor();
  48950. }
  48951. /**
  48952. * @en The point to point constraint.
  48953. * It locks the relative position of the pivots between two rigid bodies.
  48954. * @zh 点对点约束。
  48955. * 点对点约束会锁定两个刚体间的连接点的相对位置。
  48956. */
  48957. export class PointToPointConstraint extends Constraint {
  48958. /**
  48959. * @en
  48960. * The pivot point of the constraint in the local coordinate system of the attached rigid body.
  48961. * @zh
  48962. * 约束关节在连接刚体本地坐标系中的位置。
  48963. */
  48964. get pivotA(): math.IVec3Like;
  48965. set pivotA(v: math.IVec3Like);
  48966. /**
  48967. * @en
  48968. * The pivot point of the constraint in the local coordinate system of the connected rigid body.
  48969. * @zh
  48970. * 约束关节在连接刚体本地坐标系中的位置。
  48971. */
  48972. get pivotB(): math.IVec3Like;
  48973. set pivotB(v: math.IVec3Like);
  48974. get constraint(): __private._cocos_physics_spec_i_physics_constraint__IPointToPointConstraint;
  48975. constructor();
  48976. }
  48977. /**
  48978. * @en The configurable constraint component.
  48979. * The configurable constraint provides all the functionality of other constraints, and provides comprehensive configurable options.
  48980. * @zh 可配置约束组件。
  48981. * 可配置约束提供了其他约束的所有功能支持,提供了全面的可配置选项。
  48982. */
  48983. export class ConfigurableConstraint extends Constraint {
  48984. /**
  48985. * @en
  48986. * The axis of the constraint in the local coordinate system of the attached rigid body.
  48987. * @zh
  48988. * 约束关节在连接刚体的本地坐标系中的轴。
  48989. */
  48990. get axis(): math.Vec3;
  48991. set axis(v: math.Vec3);
  48992. /**
  48993. * @en The secondary axis of the constraint in the local coordinate system of the attached rigid body.
  48994. * @zh 约束关节在连接刚体的本地坐标系中的第二轴。
  48995. */
  48996. get secondaryAxis(): math.Vec3;
  48997. set secondaryAxis(v: math.Vec3);
  48998. /**
  48999. * @en
  49000. * The pivot point of the constraint in the local coordinate system of the attached rigid body.
  49001. * @zh
  49002. * 约束关节在连接刚体的本地坐标系中的锚点。
  49003. */
  49004. get pivotA(): math.Vec3;
  49005. set pivotA(v: math.Vec3);
  49006. /**
  49007. * @en
  49008. * The pivot point of the constraint in the local coordinate system of the connected rigid body.
  49009. * @zh
  49010. * 约束关节在连接刚体的本地坐标系中的锚点。
  49011. */
  49012. get pivotB(): math.Vec3;
  49013. set pivotB(v: math.Vec3);
  49014. /**
  49015. * @en
  49016. * The pivotB is derived automatically.
  49017. * @zh
  49018. * pivotB 会自动计算。
  49019. */
  49020. get autoPivotB(): boolean;
  49021. set autoPivotB(v: boolean);
  49022. /**
  49023. * @en
  49024. * The break force threshold of the constraint.
  49025. * @zh
  49026. * 约束的断裂力阈值。
  49027. */
  49028. get breakForce(): number;
  49029. set breakForce(v: number);
  49030. /**
  49031. * @en
  49032. * The break torque threshold of the constraint.
  49033. * @zh
  49034. * 约束的断裂扭矩阈值。
  49035. */
  49036. get breakTorque(): number;
  49037. set breakTorque(v: number);
  49038. /**
  49039. * @en
  49040. * The linear limit settings of the constraint.
  49041. * @zh
  49042. * 线性限制设置。
  49043. */
  49044. get linearLimitSettings(): __private._cocos_physics_framework_components_constraints_configurable_constraint__LinearLimitSettings;
  49045. set linearLimitSettings(v: __private._cocos_physics_framework_components_constraints_configurable_constraint__LinearLimitSettings);
  49046. /**
  49047. * @en
  49048. * The angular limit settings of the constraint.
  49049. * @zh
  49050. * 角度限制设置。
  49051. */
  49052. get angularLimitSettings(): __private._cocos_physics_framework_components_constraints_configurable_constraint__AngularLimitSettings;
  49053. set angularLimitSettings(v: __private._cocos_physics_framework_components_constraints_configurable_constraint__AngularLimitSettings);
  49054. /**
  49055. * @en
  49056. * The linear drive settings of the constraint.
  49057. * @zh
  49058. * 线性驱动设置。
  49059. */
  49060. get linearDriverSettings(): __private._cocos_physics_framework_components_constraints_configurable_constraint__LinearDriverSettings;
  49061. set linearDriverSettings(v: __private._cocos_physics_framework_components_constraints_configurable_constraint__LinearDriverSettings);
  49062. /**
  49063. * @en
  49064. * The angular drive settings of the constraint.
  49065. * @zh
  49066. * 角度驱动设置。
  49067. */
  49068. get angularDriverSettings(): __private._cocos_physics_framework_components_constraints_configurable_constraint__AngularDriverSettings;
  49069. set angularDriverSettings(v: __private._cocos_physics_framework_components_constraints_configurable_constraint__AngularDriverSettings);
  49070. get constraint(): __private._cocos_physics_spec_i_physics_constraint__IConfigurableConstraint;
  49071. constructor();
  49072. onLoad(): void;
  49073. }
  49074. /**
  49075. * @en
  49076. * Rigid body component.
  49077. * @zh
  49078. * 刚体组件。
  49079. */
  49080. export class RigidBody extends Component {
  49081. /**
  49082. * @en
  49083. * Enumeration of rigid body types.
  49084. * @zh
  49085. * 刚体类型的枚举。
  49086. */
  49087. static readonly Type: typeof ERigidBodyType;
  49088. /**
  49089. * @en
  49090. * Gets or sets the group of the rigid body.
  49091. * @zh
  49092. * 获取或设置分组。
  49093. */
  49094. get group(): number;
  49095. set group(v: number);
  49096. /**
  49097. * @en
  49098. * Gets or sets the type of rigid body.
  49099. * @zh
  49100. * 获取或设置刚体类型。
  49101. */
  49102. get type(): ERigidBodyType;
  49103. set type(v: ERigidBodyType);
  49104. /**
  49105. * @en
  49106. * Gets or sets the mass of the rigid body.
  49107. * @zh
  49108. * 获取或设置刚体的质量。
  49109. */
  49110. get mass(): number;
  49111. set mass(value: number);
  49112. /**
  49113. * @en
  49114. * Gets or sets whether hibernation is allowed.
  49115. * @zh
  49116. * 获取或设置是否允许休眠。
  49117. */
  49118. get allowSleep(): boolean;
  49119. set allowSleep(v: boolean);
  49120. /**
  49121. * @en
  49122. * Gets or sets linear damping.
  49123. * @zh
  49124. * 获取或设置线性阻尼。
  49125. */
  49126. get linearDamping(): number;
  49127. set linearDamping(value: number);
  49128. /**
  49129. * @en
  49130. * Gets or sets the rotation damping.
  49131. * @zh
  49132. * 获取或设置旋转阻尼。
  49133. */
  49134. get angularDamping(): number;
  49135. set angularDamping(value: number);
  49136. /**
  49137. * @en
  49138. * Gets or sets whether a rigid body uses gravity.
  49139. * @zh
  49140. * 获取或设置刚体是否使用重力。
  49141. */
  49142. get useGravity(): boolean;
  49143. set useGravity(value: boolean);
  49144. /**
  49145. * @en
  49146. * Gets or sets the linear velocity factor that can be used to control the scaling of the velocity in each axis direction.
  49147. * @zh
  49148. * 获取或设置线性速度的因子,可以用来控制每个轴方向上的速度的缩放。
  49149. */
  49150. get linearFactor(): math.Vec3;
  49151. set linearFactor(value: math.Vec3);
  49152. /**
  49153. * @en
  49154. * Gets or sets the rotation speed factor that can be used to control the scaling of the rotation speed in each axis direction.
  49155. * @zh
  49156. * 获取或设置旋转速度的因子,可以用来控制每个轴方向上的旋转速度的缩放。
  49157. */
  49158. get angularFactor(): math.Vec3;
  49159. set angularFactor(value: math.Vec3);
  49160. /**
  49161. * @en
  49162. * Gets or sets the speed threshold for going to sleep.
  49163. * @zh
  49164. * 获取或设置进入休眠的速度临界值。
  49165. */
  49166. get sleepThreshold(): number;
  49167. set sleepThreshold(v: number);
  49168. /**
  49169. * @en
  49170. * Turning on or off continuous collision detection.
  49171. * @zh
  49172. * 开启或关闭连续碰撞检测。
  49173. */
  49174. get useCCD(): boolean;
  49175. set useCCD(v: boolean);
  49176. /**
  49177. * @en
  49178. * Gets whether it is the state of awake.
  49179. * @zh
  49180. * 获取是否是唤醒的状态。
  49181. */
  49182. get isAwake(): boolean;
  49183. /**
  49184. * @en
  49185. * Gets whether you can enter a dormant state.
  49186. * @zh
  49187. * 获取是否是可进入休眠的状态。
  49188. */
  49189. get isSleepy(): boolean;
  49190. /**
  49191. * @en
  49192. * Gets whether the state is dormant.
  49193. * @zh
  49194. * 获取是否是正在休眠的状态。
  49195. */
  49196. get isSleeping(): boolean;
  49197. /**
  49198. * @en
  49199. * Gets or sets whether the rigid body is static.
  49200. * @zh
  49201. * 获取或设置刚体是否是静态类型的(静止不动的)。
  49202. */
  49203. get isStatic(): boolean;
  49204. set isStatic(v: boolean);
  49205. /**
  49206. * @en
  49207. * Gets or sets whether the rigid body moves through physical dynamics.
  49208. * @zh
  49209. * 获取或设置刚体是否是动力学态类型的(将根据物理动力学控制运动)。
  49210. */
  49211. get isDynamic(): boolean;
  49212. set isDynamic(v: boolean);
  49213. /**
  49214. * @en
  49215. * Gets or sets whether a rigid body is controlled by users.
  49216. * @zh
  49217. * 获取或设置刚体是否是运动态类型的(将由用户来控制运动)。
  49218. */
  49219. get isKinematic(): boolean;
  49220. set isKinematic(v: boolean);
  49221. /**
  49222. * @en
  49223. * Gets the wrapper object, through which the lowLevel instance can be accessed.
  49224. * @zh
  49225. * 获取封装对象,通过此对象可以访问到底层实例。
  49226. */
  49227. get body(): __private._cocos_physics_spec_i_rigid_body__IRigidBody | null;
  49228. protected get _isInitialized(): boolean;
  49229. protected onLoad(): void;
  49230. protected onEnable(): void;
  49231. protected onDisable(): void;
  49232. protected onDestroy(): void;
  49233. /**
  49234. * @en
  49235. * Apply force to a world point. This could, for example, be a point on the Body surface.
  49236. * @zh
  49237. * 在世界空间中,相对于刚体的质心的某点上对刚体施加作用力。
  49238. * @param force @zh 作用力 @en The force applied
  49239. * @param relativePoint @zh 作用点,相对于刚体的质心 @en The point to apply the force on, relative to the center of mass of the rigid body
  49240. */
  49241. applyForce(force: math.Vec3, relativePoint?: math.Vec3): void;
  49242. /**
  49243. * @en
  49244. * Apply force to a local point. This could, for example, be a point on the Body surface.
  49245. * @zh
  49246. * 在本地空间中,相对于刚体的质心的某点上对刚体施加作用力。
  49247. * @param force @zh 作用力 @en The force applied
  49248. * @param localPoint @zh 作用点 @en The point to apply the force on
  49249. */
  49250. applyLocalForce(force: math.Vec3, localPoint?: math.Vec3): void;
  49251. /**
  49252. * @en
  49253. * In world space, impulse is applied to the rigid body at some point relative to the center of mass of the rigid body.
  49254. * @zh
  49255. * 在世界空间中,相对于刚体的质心的某点上对刚体施加冲量。
  49256. * @param impulse @zh 冲量 @en The impulse applied
  49257. * @param relativePoint @zh 作用点,相对于刚体的中心点 @en The point to apply the impulse, relative to the center of mass of the rigid body
  49258. */
  49259. applyImpulse(impulse: math.Vec3, relativePoint?: math.Vec3): void;
  49260. /**
  49261. * @en
  49262. * In local space, impulse is applied to the rigid body at some point relative to the center of mass of the rigid body.
  49263. * @zh
  49264. * 在本地空间中,相对于刚体的质心的某点上对刚体施加冲量。
  49265. * @param impulse @zh 冲量 @en The impulse applied
  49266. * @param localPoint @zh 作用点 @en The point to apply the impulse
  49267. */
  49268. applyLocalImpulse(impulse: math.Vec3, localPoint?: math.Vec3): void;
  49269. /**
  49270. * @en
  49271. * In world space, torque is applied to the rigid body.
  49272. * @zh
  49273. * 在世界空间中,对刚体施加扭矩。
  49274. * @param torque @zh 扭矩 @en The torque applied
  49275. */
  49276. applyTorque(torque: math.Vec3): void;
  49277. /**
  49278. * @zh
  49279. * 在本地空间中,对刚体施加扭矩。
  49280. * @zh
  49281. * In local space, torque is applied to the rigid body.
  49282. * @param torque @zh 扭矩 @en The torque applied
  49283. */
  49284. applyLocalTorque(torque: math.Vec3): void;
  49285. /**
  49286. * @en
  49287. * Wake up the rigid body.
  49288. * @zh
  49289. * 唤醒刚体。
  49290. */
  49291. wakeUp(): void;
  49292. /**
  49293. * @en
  49294. * Dormancy of rigid body.
  49295. * @zh
  49296. * 休眠刚体。
  49297. */
  49298. sleep(): void;
  49299. /**
  49300. * @en
  49301. * Clear the forces and velocity of the rigid body.
  49302. * @zh
  49303. * 清除刚体受到的力和速度。
  49304. */
  49305. clearState(): void;
  49306. /**
  49307. * @en
  49308. * Clear the forces of the rigid body.
  49309. * @zh
  49310. * 清除刚体受到的力。
  49311. */
  49312. clearForces(): void;
  49313. /**
  49314. * @en
  49315. * Clear velocity of the rigid body.
  49316. * @zh
  49317. * 清除刚体的速度。
  49318. */
  49319. clearVelocity(): void;
  49320. /**
  49321. * @en
  49322. * Gets the linear velocity.
  49323. * @zh
  49324. * 获取线性速度。
  49325. * @param out @zh 速度向量 @en The velocity vector
  49326. */
  49327. getLinearVelocity(out: math.Vec3): void;
  49328. /**
  49329. * @en
  49330. * Sets the linear velocity.
  49331. * @zh
  49332. * 设置线性速度。
  49333. * @param value @zh 速度向量 @en The velocity vector
  49334. */
  49335. setLinearVelocity(value: math.Vec3): void;
  49336. /**
  49337. * @en
  49338. * Gets the angular velocity.
  49339. * @zh
  49340. * 获取旋转速度。
  49341. * @param out @zh 角速度向量 @en The angular velocity vector
  49342. */
  49343. getAngularVelocity(out: math.Vec3): void;
  49344. /**
  49345. * @en
  49346. * Sets the angular velocity.
  49347. * @zh
  49348. * 设置旋转速度。
  49349. * @param value @zh 角速度向量 @en The angular velocity vector
  49350. */
  49351. setAngularVelocity(value: math.Vec3): void;
  49352. /**
  49353. * @en
  49354. * Gets the group value.
  49355. * @zh
  49356. * 获取分组值。
  49357. * @returns @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49358. */
  49359. getGroup(): number;
  49360. /**
  49361. * @en
  49362. * Sets the group value.
  49363. * @zh
  49364. * 设置分组值。
  49365. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49366. */
  49367. setGroup(v: number): void;
  49368. /**
  49369. * @en
  49370. * Add a grouping value to fill in the group you want to join.
  49371. * @zh
  49372. * 添加分组值,可填要加入的 group。
  49373. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49374. */
  49375. addGroup(v: number): void;
  49376. /**
  49377. * @en
  49378. * Subtract the grouping value to fill in the group to be removed.
  49379. * @zh
  49380. * 减去分组值,可填要移除的 group。
  49381. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49382. */
  49383. removeGroup(v: number): void;
  49384. /**
  49385. * @en
  49386. * Gets the mask value.
  49387. * @zh
  49388. * 获取掩码值。
  49389. * @returns {number} @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49390. */
  49391. getMask(): number;
  49392. /**
  49393. * @en
  49394. * Sets the mask value.
  49395. * @zh
  49396. * 设置掩码值。
  49397. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49398. */
  49399. setMask(v: number): void;
  49400. /**
  49401. * @en
  49402. * Add mask values to fill in groups that need to be checked.
  49403. * @zh
  49404. * 添加掩码值,可填入需要检查的 group。
  49405. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49406. */
  49407. addMask(v: number): void;
  49408. /**
  49409. * @en
  49410. * Subtract the mask value to fill in the group that does not need to be checked.
  49411. * @zh
  49412. * 减去掩码值,可填入不需要检查的 group。
  49413. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49414. */
  49415. removeMask(v: number): void;
  49416. }
  49417. export namespace RigidBody {
  49418. export type Type = __private.__types_globals__EnumAlias<typeof ERigidBodyType>;
  49419. }
  49420. /**
  49421. * @en
  49422. * Physics materials.
  49423. * @zh
  49424. * 物理材质。
  49425. */
  49426. export class PhysicsMaterial extends Asset {
  49427. /**
  49428. * @en
  49429. * Gets all physics material instances.
  49430. * @zh
  49431. * 获取所有的物理材质实例。
  49432. */
  49433. static allMaterials: PhysicsMaterial[];
  49434. /**
  49435. * @en
  49436. * The event which will be triggered when the entity of physics material update.
  49437. * @zh
  49438. * 物理材质实例更新时触发的事件。
  49439. * @event PhysicsMaterial.EVENT_UPDATE
  49440. */
  49441. static readonly EVENT_UPDATE = "event_update";
  49442. /**
  49443. * @en
  49444. * Friction for this material.
  49445. * @zh
  49446. * 此材质的摩擦系数。
  49447. */
  49448. get friction(): number;
  49449. set friction(value: number);
  49450. /**
  49451. * @en
  49452. * Rolling friction for this material.
  49453. * @zh
  49454. * 此材质的滚动摩擦系数。
  49455. */
  49456. get rollingFriction(): number;
  49457. set rollingFriction(value: number);
  49458. /**
  49459. * @en
  49460. * Spinning friction for this material.
  49461. * @zh
  49462. * 此材质的自旋摩擦系数。
  49463. */
  49464. get spinningFriction(): number;
  49465. set spinningFriction(value: number);
  49466. /**
  49467. * @en
  49468. * Restitution for this material.
  49469. * @zh
  49470. * 此材质的回弹系数。
  49471. */
  49472. get restitution(): number;
  49473. set restitution(value: number);
  49474. readonly id: number;
  49475. constructor();
  49476. /**
  49477. * @en
  49478. * clone.
  49479. * @zh
  49480. * 克隆。
  49481. */
  49482. clone(): PhysicsMaterial;
  49483. /**
  49484. * @en
  49485. * destroy.
  49486. * @zh
  49487. * 销毁。
  49488. * @return 是否成功
  49489. */
  49490. destroy(): boolean;
  49491. /**
  49492. * @en
  49493. * Sets the coefficients values.
  49494. * @zh
  49495. * 设置材质相关的系数。
  49496. * @param friction
  49497. * @param rollingFriction
  49498. * @param spinningFriction
  49499. * @param restitution
  49500. */
  49501. setValues(friction: number, rollingFriction: number, spinningFriction: number, restitution: number): void;
  49502. }
  49503. /**
  49504. * @en
  49505. * A tool component to help apply force to the rigid body at each frame.
  49506. * @zh
  49507. * 在每帧对一个刚体施加持续的力,依赖 RigidBody 组件。
  49508. */
  49509. export class ConstantForce extends Component {
  49510. /**
  49511. * @en
  49512. * Gets or sets forces in world coordinates.
  49513. * @zh
  49514. * 获取或设置世界坐标系下的力。
  49515. */
  49516. get force(): math.Vec3;
  49517. set force(value: math.Vec3);
  49518. /**
  49519. * @en
  49520. * Gets or sets the forces in the local coordinate system.
  49521. * @zh
  49522. * 获取或设置本地坐标系下的力。
  49523. */
  49524. get localForce(): math.Vec3;
  49525. set localForce(value: math.Vec3);
  49526. /**
  49527. * @en
  49528. * Gets or sets the torsional force in world coordinates.
  49529. * @zh
  49530. * 获取或设置世界坐标系下的扭转力。
  49531. */
  49532. get torque(): math.Vec3;
  49533. set torque(value: math.Vec3);
  49534. /**
  49535. * @en
  49536. * Gets or sets the torsional force in the local coordinate system.
  49537. * @zh
  49538. * 获取或设置本地坐标系下的扭转力。
  49539. */
  49540. get localTorque(): math.Vec3;
  49541. set localTorque(value: math.Vec3);
  49542. onLoad(): void;
  49543. lateUpdate(dt: number): void;
  49544. }
  49545. /**
  49546. * @en
  49547. * Base class for Character Controller component.
  49548. * @zh
  49549. * 角色控制器组件基类。
  49550. */
  49551. export class CharacterController extends __private._cocos_physics_framework_components_character_controllers_character_controller__CharacterController_base {
  49552. /**
  49553. * @en
  49554. * Gets or sets the group of the character controller.
  49555. * @zh
  49556. * 获取或设置分组。
  49557. */
  49558. get group(): number;
  49559. set group(v: number);
  49560. /**
  49561. * @en
  49562. * Gets or sets the minimum movement distance of the character controller.
  49563. * @zh
  49564. * 获取或设置角色控制器的最小移动距离。
  49565. */
  49566. get minMoveDistance(): number;
  49567. set minMoveDistance(value: number);
  49568. /**
  49569. * @en 、
  49570. * Gets or sets the maximum height the character controller can automatically climb.
  49571. * @zh
  49572. * 获取或设置角色控制器的最大自动爬台阶高度。
  49573. */
  49574. get stepOffset(): number;
  49575. set stepOffset(value: number);
  49576. /**
  49577. * @en
  49578. * Gets or sets the slope limit of the character controller in degree.
  49579. * @zh
  49580. * 获取或设置角色控制器的最大爬坡角度。
  49581. */
  49582. get slopeLimit(): number;
  49583. set slopeLimit(value: number);
  49584. /**
  49585. * @en
  49586. * Gets or sets the skin width of the character controller.
  49587. * @zh
  49588. * 获取或设置角色控制器的皮肤宽度。
  49589. */
  49590. get skinWidth(): number;
  49591. set skinWidth(value: number);
  49592. /**
  49593. * @en
  49594. * Gets or sets the center of the character controller in local space.
  49595. * @zh
  49596. * 获取或设置角色控制器的中心点在局部坐标系中的位置。
  49597. */
  49598. get center(): Readonly<math.Vec3>;
  49599. set center(value: Readonly<math.Vec3>);
  49600. /**
  49601. * @en
  49602. * Gets the type of this character controller.
  49603. * @zh
  49604. * 获取此角色控制器的类型。
  49605. */
  49606. readonly type: ECharacterControllerType;
  49607. constructor(type: ECharacterControllerType);
  49608. protected _cct: __private._cocos_physics_spec_i_character_controller__IBaseCharacterController | null;
  49609. protected _needCollisionEvent: boolean;
  49610. protected _needTriggerEvent: boolean;
  49611. protected get _isInitialized(): boolean;
  49612. protected onLoad(): void;
  49613. protected onEnable(): void;
  49614. protected onDisable(): void;
  49615. protected onDestroy(): void;
  49616. /**
  49617. * @en
  49618. * Gets world position of center.
  49619. * @zh
  49620. * 获取中心的世界坐标。
  49621. */
  49622. get centerWorldPosition(): Readonly<math.Vec3>;
  49623. /**
  49624. * @en
  49625. * Sets world position of center.
  49626. * Note: Calling this function will immediately synchronize the position of
  49627. * the character controller in the physics world to the node.
  49628. * @zh
  49629. * 设置中心的世界坐标。
  49630. * 注意:调用该函数会立刻将角色控制器在物理世界中的位置同步到节点上。
  49631. */
  49632. set centerWorldPosition(value: Readonly<math.Vec3>);
  49633. /**
  49634. * @en
  49635. * Gets the velocity.
  49636. * Note: velocity is only updated after move() is called.
  49637. * @zh
  49638. * 获取速度。
  49639. * 注意:velocity 只会在 move() 调用后更新。
  49640. */
  49641. get velocity(): Readonly<math.Vec3>;
  49642. /**
  49643. * @en
  49644. * Gets whether the character is on the ground.
  49645. * Note: isGrounded is only updated after move() is called.
  49646. * @zh
  49647. * 获取是否在地面上。
  49648. * 注意:isGrounded 只会在 move() 调用后更新。
  49649. */
  49650. get isGrounded(): boolean;
  49651. /**
  49652. * @en
  49653. * Move the character.
  49654. * @zh
  49655. * 移动角色控制器。
  49656. * @param movement @zh 移动向量 @en The movement vector
  49657. */
  49658. move(movement: math.Vec3): void;
  49659. /**
  49660. * @en
  49661. * Registers callbacks associated with triggered or collision events.
  49662. * @zh
  49663. * 注册触发或碰撞事件相关的回调。
  49664. * @param type - The event type, onControllerColliderHit;
  49665. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  49666. * @param target - The event callback target.
  49667. */
  49668. on<TFunction extends __private._cocos_physics_framework_components_character_controllers_character_controller__Callback>(type: CharacterTriggerEventType | CharacterCollisionEventType, callback: TFunction, target?: any, once?: boolean): any;
  49669. /**
  49670. * @en
  49671. * Unregisters callbacks associated with trigger or collision events that have been registered.
  49672. * @zh
  49673. * 取消已经注册的触发或碰撞事件相关的回调。
  49674. * @param type - The event type, onControllerColliderHit;
  49675. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  49676. * @param target - The event callback target.
  49677. */
  49678. off(type: CharacterTriggerEventType | CharacterCollisionEventType, callback?: __private._cocos_physics_framework_components_character_controllers_character_controller__Callback, target?: any): void;
  49679. /**
  49680. * @en
  49681. * Registers a callback associated with a trigger or collision event, which is automatically unregistered once executed.
  49682. * @zh
  49683. * 注册触发或碰撞事件相关的回调,执行一次后会自动取消注册。
  49684. * @param type - The event type, onControllerColliderHit;
  49685. * @param callback - The event callback, signature:`(event?:ICollisionEvent|ITriggerEvent)=>void`.
  49686. * @param target - The event callback target.
  49687. */
  49688. once<TFunction extends __private._cocos_physics_framework_components_character_controllers_character_controller__Callback>(type: CharacterTriggerEventType | CharacterCollisionEventType, callback: TFunction, target?: any): any;
  49689. /**
  49690. * @en
  49691. * Gets the group value.
  49692. * @zh
  49693. * 获取分组值。
  49694. * @returns @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49695. */
  49696. getGroup(): number;
  49697. /**
  49698. * @en
  49699. * Sets the group value.
  49700. * @zh
  49701. * 设置分组值。
  49702. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49703. */
  49704. setGroup(v: number): void;
  49705. /**
  49706. * @en
  49707. * Add a grouping value to fill in the group you want to join.
  49708. * @zh
  49709. * 添加分组值,可填要加入的 group。
  49710. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49711. */
  49712. addGroup(v: number): void;
  49713. /**
  49714. * @en
  49715. * Subtract the grouping value to fill in the group to be removed.
  49716. * @zh
  49717. * 减去分组值,可填要移除的 group。
  49718. * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
  49719. */
  49720. removeGroup(v: number): void;
  49721. /**
  49722. * @en
  49723. * Gets the mask value.
  49724. * @zh
  49725. * 获取掩码值。
  49726. * @returns {number} @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49727. */
  49728. getMask(): number;
  49729. /**
  49730. * @en
  49731. * Sets the mask value.
  49732. * @zh
  49733. * 设置掩码值。
  49734. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49735. */
  49736. setMask(v: number): void;
  49737. /**
  49738. * @en
  49739. * Add mask values to fill in groups that need to be checked.
  49740. * @zh
  49741. * 添加掩码值,可填入需要检查的 group。
  49742. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49743. */
  49744. addMask(v: number): void;
  49745. /**
  49746. * @en
  49747. * Subtract the mask value to fill in the group that does not need to be checked.
  49748. * @zh
  49749. * 减去掩码值,可填入不需要检查的 group。
  49750. * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
  49751. */
  49752. removeMask(v: number): void;
  49753. get needCollisionEvent(): boolean;
  49754. get needTriggerEvent(): boolean;
  49755. }
  49756. /**
  49757. * @en
  49758. * Character Controller component.
  49759. * @zh
  49760. * 角色控制器组件。
  49761. */
  49762. export class BoxCharacterController extends CharacterController {
  49763. constructor();
  49764. /**
  49765. * @en
  49766. * Gets or sets the half height of the box shape of the CharacterController in local space.
  49767. * @zh
  49768. * 获取或设置立方体在本地坐标系下的高度的一半。
  49769. */
  49770. get halfHeight(): number;
  49771. set halfHeight(value: number);
  49772. /**
  49773. * @en
  49774. * Gets or sets the half side extent of box shape of the CharacterController in local space.
  49775. * @zh
  49776. * 获取或设置立方体在本地坐标系下的横向宽度的一半。
  49777. */
  49778. get halfSideExtent(): number;
  49779. set halfSideExtent(value: number);
  49780. /**
  49781. * @en
  49782. * Gets or sets the half forward extent of the box on the CharacterController in local space.
  49783. * @zh
  49784. * 获取或设置立方体在本地坐标系下的纵向宽度一半。
  49785. */
  49786. get halfForwardExtent(): number;
  49787. set halfForwardExtent(value: number);
  49788. }
  49789. /**
  49790. * @en
  49791. * Character Controller component.
  49792. * @zh
  49793. * 角色控制器组件。
  49794. */
  49795. export class CapsuleCharacterController extends CharacterController {
  49796. constructor();
  49797. /**
  49798. * @en
  49799. * Gets or sets the radius of the sphere of the capsule shape of the CharacterController in local space.
  49800. * @zh
  49801. * 获取或设置在本地坐标系下的胶囊体球半径。
  49802. */
  49803. get radius(): number;
  49804. set radius(value: number);
  49805. /**
  49806. * @en
  49807. * Gets or sets the height of the capsule shape of the CharacterController in local space.
  49808. * Height the distance between the two sphere centers at the end of the capsule.
  49809. * @zh
  49810. * 获取或设置在本地坐标系下的胶囊体末端两个球心的距离。
  49811. */
  49812. get height(): number;
  49813. set height(value: number);
  49814. }
  49815. /**
  49816. * @en
  49817. * The physics selector is used to register and switch the physics engine backend.
  49818. * @zh
  49819. * 物理选择器用于注册和切换物理引擎后端。
  49820. */
  49821. export const selector: __private._cocos_physics_framework_physics_selector__IPhysicsSelector;
  49822. export namespace utils {
  49823. export function setWrap<Wrapper>(object: any, wrapper: Wrapper): void;
  49824. export function getWrap<Wrapper>(object: any): Wrapper;
  49825. export function maxComponent(v: math.IVec3Like): number;
  49826. export function shrinkPositions(buffer: Float32Array | number[]): number[];
  49827. export function absolute(v: math.Vec3): math.Vec3;
  49828. /**
  49829. * @en
  49830. * Generate a cylinder with radiusTop radiusBottom 0.5, height 2 and centered at origin,
  49831. * but may be repositioned through the `center` option.
  49832. * @zh
  49833. * 生成一个圆柱。
  49834. * @param radiusTop @en Radius of top plane. @zh 顶部半径。
  49835. * @param radiusBottom @en Radius of bottom plane. @zh 底部半径。
  49836. * @param height @en The cylinder height. @zh 圆柱的高
  49837. * @param opts @en The optional creation parameters of the cylinder. @zh 圆柱参数选项。
  49838. */
  49839. export function cylinder(radiusTop?: number, radiusBottom?: number, height?: number, opts?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_cylinder__ICylinderOptions>): primitives.IGeometry;
  49840. export const VEC3_0: math.Vec3;
  49841. export const TriggerEventObject: {
  49842. type: TriggerEventType;
  49843. selfCollider: Collider | null;
  49844. otherCollider: Collider | null;
  49845. impl: any;
  49846. };
  49847. export const CharacterTriggerEventObject: {
  49848. type: CharacterTriggerEventType;
  49849. collider: Collider | null;
  49850. characterController: CharacterController | null;
  49851. impl: any;
  49852. };
  49853. export const CollisionEventObject: {
  49854. type: CollisionEventType;
  49855. selfCollider: Collider;
  49856. otherCollider: Collider;
  49857. contacts: IContactEquation[];
  49858. impl: any;
  49859. };
  49860. }
  49861. export interface ICollisionMatrix {
  49862. [x: string]: number;
  49863. }
  49864. export interface ICollisionGroup {
  49865. index: number;
  49866. name: string;
  49867. }
  49868. export interface IPhysicsConfig {
  49869. gravity?: math.IVec3Like;
  49870. allowSleep?: boolean;
  49871. fixedTimeStep?: number;
  49872. maxSubSteps?: number;
  49873. sleepThreshold?: number;
  49874. collisionMatrix?: ICollisionMatrix;
  49875. collisionGroups?: ICollisionGroup[];
  49876. autoSimulation?: boolean;
  49877. useNodeChains?: boolean;
  49878. physicsEngine?: "builtin" | "cannon.js" | "bullet" | "physx" | string;
  49879. }
  49880. /**
  49881. * @en
  49882. * Rigid body type.
  49883. * @zh
  49884. * 刚体类型。
  49885. */
  49886. export enum ERigidBodyType {
  49887. /**
  49888. * @en
  49889. * Dynamic type.
  49890. * @zh
  49891. * 动态刚体。
  49892. */
  49893. DYNAMIC = 1,
  49894. /**
  49895. * @en
  49896. * Static type.
  49897. * @zh
  49898. * 静态刚体。
  49899. */
  49900. STATIC = 2,
  49901. /**
  49902. * @en
  49903. * Kinematic type.
  49904. * @zh
  49905. * 运动学刚体。
  49906. */
  49907. KINEMATIC = 4
  49908. }
  49909. /**
  49910. * @en
  49911. * Axis Direction.
  49912. * @zh
  49913. * 轴方向。
  49914. */
  49915. export enum EAxisDirection {
  49916. /**
  49917. * @en
  49918. * X axis.
  49919. * @zh
  49920. * X 轴。
  49921. */
  49922. X_AXIS = 0,
  49923. /**
  49924. * @en
  49925. * Y axis.
  49926. * @zh
  49927. * Y 轴。
  49928. */
  49929. Y_AXIS = 1,
  49930. /**
  49931. * @en
  49932. * Z axis.
  49933. * @zh
  49934. * Z 轴。
  49935. */
  49936. Z_AXIS = 2
  49937. }
  49938. /**
  49939. * @en
  49940. * Degree of freedom.
  49941. * @zh
  49942. * 自由度。
  49943. */
  49944. export enum ED6Axis {
  49945. /**
  49946. * @en
  49947. * X axis.
  49948. * @zh
  49949. * X 轴。
  49950. */
  49951. X = 0,
  49952. /**
  49953. * @en
  49954. * Y axis.
  49955. * @zh
  49956. * Y 轴。
  49957. */
  49958. Y = 1,
  49959. /**
  49960. * @en
  49961. * Z axis.
  49962. * @zh
  49963. * Z 轴。
  49964. */
  49965. Z = 2,
  49966. /**
  49967. * @en
  49968. * Swing 1, directs toward the local Y axis.
  49969. * @zh
  49970. * 摆动 1,其方向朝向 Y 轴。
  49971. */
  49972. SWING1 = 3,
  49973. /**
  49974. * @en
  49975. * Swing 2, directs toward the local Z axis.
  49976. * @zh
  49977. * 摆动 2,其方向朝向 Z 轴。
  49978. */
  49979. SWING2 = 4,
  49980. /**
  49981. * @en
  49982. * Twist, directs toward the local X axis.
  49983. * @zh
  49984. * 扭转,其方向朝向 X 轴。
  49985. */
  49986. TWIST = 5
  49987. }
  49988. /**
  49989. * @en
  49990. * Simplex Type.
  49991. * @zh
  49992. * 单形体类型。
  49993. */
  49994. export enum ESimplexType {
  49995. /**
  49996. * @en
  49997. * Point.
  49998. * @zh
  49999. * 点。
  50000. */
  50001. VERTEX = 1,
  50002. /**
  50003. * @en
  50004. * Line.
  50005. * @zh
  50006. * 线。
  50007. */
  50008. LINE = 2,
  50009. /**
  50010. * @en
  50011. * Triangle.
  50012. * @zh
  50013. * 三角形。
  50014. */
  50015. TRIANGLE = 3,
  50016. /**
  50017. * @en
  50018. * Tetrahedron.
  50019. * @zh
  50020. * 四面体。
  50021. */
  50022. TETRAHEDRON = 4
  50023. }
  50024. /**
  50025. * @en
  50026. * Collider Type.
  50027. * @zh
  50028. * 碰撞体类型。
  50029. */
  50030. export enum EColliderType {
  50031. /**
  50032. * @en
  50033. * Box collider.
  50034. * @zh
  50035. * 盒子碰撞体。
  50036. */
  50037. BOX = 0,
  50038. /**
  50039. * @en
  50040. * Sphere collider.
  50041. * @zh
  50042. * 球碰撞体。
  50043. */
  50044. SPHERE = 1,
  50045. /**
  50046. * @en
  50047. * Capsule collider.
  50048. * @zh
  50049. * 胶囊碰撞体。
  50050. */
  50051. CAPSULE = 2,
  50052. /**
  50053. * @en
  50054. * Cylinder collider.
  50055. * @zh
  50056. * 圆柱碰撞体。
  50057. */
  50058. CYLINDER = 3,
  50059. /**
  50060. * @en
  50061. * Cone collider.
  50062. * @zh
  50063. * 圆锥碰撞体。
  50064. */
  50065. CONE = 4,
  50066. /**
  50067. * @en
  50068. * Mesh collider.
  50069. * @zh
  50070. * 网格碰撞体。
  50071. */
  50072. MESH = 5,
  50073. /**
  50074. * @en
  50075. * Plane collider.
  50076. * @zh
  50077. * 平面碰撞体。
  50078. */
  50079. PLANE = 6,
  50080. /**
  50081. * @en
  50082. * Simplex collider.
  50083. * @zh
  50084. * 单形体碰撞体。
  50085. */
  50086. SIMPLEX = 7,
  50087. /**
  50088. * @en
  50089. * Terrain collider.
  50090. * @zh
  50091. * 地形碰撞体。
  50092. */
  50093. TERRAIN = 8
  50094. }
  50095. /**
  50096. * @en
  50097. * Constraint Type.
  50098. * @zh
  50099. * 约束类型。
  50100. */
  50101. export enum EConstraintType {
  50102. /**
  50103. * @en
  50104. * Point to point constraint.
  50105. * @zh
  50106. * 点对点约束。
  50107. */
  50108. POINT_TO_POINT = 0,
  50109. /**
  50110. * @en
  50111. * Hinge constraint.
  50112. * @zh
  50113. * 铰链约束。
  50114. */
  50115. HINGE = 1,
  50116. /**
  50117. * @en
  50118. * Fixed constraint.
  50119. * @zh
  50120. * 固定约束。
  50121. */
  50122. FIXED = 2,
  50123. /**
  50124. * @en
  50125. * Configurable constraint.
  50126. * @zh
  50127. * 可配置约束。
  50128. */
  50129. CONFIGURABLE = 3
  50130. }
  50131. /**
  50132. * @en
  50133. * Constraint Mode for degrees of freedom.
  50134. * @zh
  50135. * 自由度约束模式。
  50136. */
  50137. export enum EConstraintMode {
  50138. /**
  50139. * @en
  50140. * Free mode, the specified degrees of freedom are free to move.
  50141. * @zh
  50142. * 自由模式,指定的自由度可以自由移动。
  50143. */
  50144. FREE = 0,
  50145. /**
  50146. * @en
  50147. * Limited mode, the specified degrees of freedom are limited.
  50148. * @zh
  50149. * 限制模式,指定的自由度受到限制。
  50150. */
  50151. LIMITED = 1,
  50152. /**
  50153. * @en
  50154. * Locked mode, the specified degrees of freedom are locked.
  50155. * @zh
  50156. * 锁定模式,指定的自由度被锁定。
  50157. */
  50158. LOCKED = 2
  50159. }
  50160. /**
  50161. * @en
  50162. * Driver Type.
  50163. * @zh
  50164. * 驱动类型。
  50165. */
  50166. export enum EDriverMode {
  50167. /**
  50168. * @en
  50169. * Disabled.
  50170. * @zh
  50171. * 禁用。
  50172. */
  50173. DISABLED = 0,
  50174. /**
  50175. * @en
  50176. * Servo motor, which targets the specified rotation angle.
  50177. * @zh
  50178. * 伺服电机,旋转到特定角度。
  50179. */
  50180. SERVO = 1,
  50181. /**
  50182. * @en
  50183. * Induction motor, which targets the specified velocity.
  50184. * @zh
  50185. * 感应电机,旋转到特定速度。
  50186. */
  50187. INDUCTION = 2
  50188. }
  50189. /**
  50190. * @en
  50191. * Character Controller Type.
  50192. * @zh
  50193. * 角色控制器类型。
  50194. */
  50195. export enum ECharacterControllerType {
  50196. /**
  50197. * @en
  50198. * Box Character Controller.
  50199. * @zh
  50200. * 盒体角色控制器。
  50201. */
  50202. BOX = 0,
  50203. /**
  50204. * @en
  50205. * Capsule Character Controller.
  50206. * @zh
  50207. * 胶囊体角色控制器。
  50208. */
  50209. CAPSULE = 1
  50210. }
  50211. /**
  50212. * @en
  50213. * Physics Group.
  50214. * @zh
  50215. * 物理分组。
  50216. */
  50217. export enum PhysicsGroup {
  50218. /**
  50219. * @en
  50220. * Default group.
  50221. * @zh
  50222. * 默认分组。
  50223. */
  50224. DEFAULT = 1
  50225. }
  50226. export enum EPhysicsDrawFlags {
  50227. /**
  50228. * @en
  50229. * Draw nothing.
  50230. * @zh
  50231. * 不绘制。
  50232. */
  50233. NONE = 0,
  50234. /**
  50235. * @en
  50236. * Draw wireframe
  50237. * @zh
  50238. * 绘制线框。
  50239. */
  50240. WIRE_FRAME = 1,
  50241. /**
  50242. * @en
  50243. * Draw Constraint.
  50244. * @zh
  50245. * 绘制约束
  50246. */
  50247. CONSTRAINT = 2,
  50248. /**
  50249. * @en
  50250. * Draw AABB.
  50251. * @zh
  50252. * 绘制包围盒。
  50253. */
  50254. AABB = 4
  50255. }
  50256. export { ITriggerEvent, TriggerEventType, TriggerCallback, IContactEquation, ICollisionEvent, CollisionEventType, CollisionCallback, CharacterTriggerEventType, CharacterCollisionEventType, CharacterControllerContact };
  50257. }
  50258. export namespace primitives {
  50259. /**
  50260. * @en
  50261. * This function generates a box with specified extents and centered at origin,
  50262. * but may be repositioned through the `center` option.
  50263. * @zh
  50264. * 生成一个立方体,其大小是定义的范围且中心在原点。
  50265. * @param options @zh 参数选项。@en The optional creation parameters of the box
  50266. */
  50267. export function box(options?: __private._cocos_primitive_box__IBoxOptions): IGeometry;
  50268. /**
  50269. * @en
  50270. * Generate a cone with radius 0.5, height 1, centered at origin,
  50271. * but may be repositioned through the `center` option.
  50272. * @zh
  50273. * 生成一个圆锥。
  50274. * @param radius @zh 圆锥半径。 @en The radius of cone
  50275. * @param height @zh 圆锥高度。 @en The height of cone
  50276. * @param opts @zh 圆锥参数选项。@en The optional creation parameters of the cone
  50277. */
  50278. export function cone(radius?: number, height?: number, opts?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_cone__IConeOptions>): IGeometry;
  50279. /**
  50280. * @en
  50281. * This function generates a plane on XOZ plane with positive Y direction.
  50282. * @zh
  50283. * 生成一个平面,其位于XOZ平面,方向为Y轴正方向。
  50284. * @param options @zh 平面参数选项。@en The optional creation parameters of the plane
  50285. */
  50286. export function plane(options?: __private._cocos_primitive_plane__IPlaneOptions): IGeometry;
  50287. /**
  50288. * @en
  50289. * Generate a quad with width and height both to 1, centered at origin.
  50290. * @zh
  50291. * 生成一个四边形,宽高都为1,中心在原点。
  50292. * @param options @zh 参数选项。 @en The optional creation parameters of the quad
  50293. */
  50294. export function quad(options?: IGeometryOptions): IGeometry;
  50295. /**
  50296. * @en
  50297. * Generate a shpere with radius 0.5.
  50298. * @zh
  50299. * 生成一个球。
  50300. * @param radius @en The radius. @zh 球半径。
  50301. * @param options @en The sphere creation options. @zh 参数选项。
  50302. */
  50303. export function sphere(radius?: number, opts?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_sphere__ISphereOptions>): IGeometry;
  50304. /**
  50305. * @en
  50306. * Generate a torus with radius 0.4, tube 0.1 and centered at origin.
  50307. * @zh
  50308. * 生成一个环面。
  50309. * @param radius @zh 环面半径。@en The radius fo torus
  50310. * @param tube @zh 管形大小。@en The radius of tube
  50311. * @param opts @zh 参数选项。@en The optional creation parameters of the torus
  50312. */
  50313. export function torus(radius?: number, tube?: number, opts?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_torus__ITorusOptions>): {
  50314. positions: number[];
  50315. normals: number[];
  50316. uvs: number[];
  50317. indices: number[];
  50318. minPos: math.Vec3;
  50319. maxPos: math.Vec3;
  50320. boundingRadius: number;
  50321. };
  50322. /**
  50323. * Generate a capsule with radiusTop radiusBottom 0.5, height 2, centered at origin,
  50324. * but may be repositioned through the `center` option.
  50325. * @zh
  50326. * 生成一个胶囊体。
  50327. * @param radiusTop @zh 顶部半径。 @en The radius of top sphere
  50328. * @param radiusBottom @zh 底部半径。@en The radius of bottom sphere
  50329. * @param opts @zh 胶囊体参数选项。@en The optional creation parameters of the capsule
  50330. */
  50331. export function capsule(radiusTop?: number, radiusBottom?: number, height?: number, opts?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_capsule__ICapsuteOptions>): {
  50332. positions: number[];
  50333. normals: number[];
  50334. uvs: number[];
  50335. indices: number[];
  50336. minPos: math.Vec3;
  50337. maxPos: math.Vec3;
  50338. boundingRadius: number;
  50339. };
  50340. /**
  50341. * @en
  50342. * Generate a circle with radius 1, centered at origin,
  50343. * but may be repositioned through the `center` option.
  50344. * @zh
  50345. * 生成一个圆,其半径是单位1,中心点在原点。
  50346. * @param options @zh 参数选项。 @en The optional creation parameters of the circle
  50347. */
  50348. export function circle(options?: __private.__types_globals__RecursivePartial<__private._cocos_primitive_circle__ICircleOptions> | __private._cocos_primitive_circle__ICircleOptions): IGeometry;
  50349. /**
  50350. * @en
  50351. * Translate the geometry.
  50352. * @zh
  50353. * 平移几何体。
  50354. * @param geometry @zh 几何体信息。@en The geometry to be translated
  50355. * @param offset @zh 偏移量。@en The translation
  50356. */
  50357. export function translate(geometry: IGeometry, offset: {
  50358. x?: number;
  50359. y?: number;
  50360. z?: number;
  50361. }): IGeometry;
  50362. /**
  50363. * @en
  50364. * Scale the geometry.
  50365. * @zh
  50366. * 缩放几何体。
  50367. * @param geometry @zh 几何体信息。 @en The geometry to be scaled
  50368. * @param value @zh 缩放量。@en The scaling size
  50369. */
  50370. export function scale(geometry: IGeometry, value: {
  50371. x?: number;
  50372. y?: number;
  50373. z?: number;
  50374. }): IGeometry;
  50375. /**
  50376. * @en
  50377. * Converts geometry to wireframe mode. Only geometry with triangle topology is supported.
  50378. * @zh
  50379. * 将几何体转换为线框模式,仅支持三角形拓扑的几何体。
  50380. * @param geometry @zh 几何体信息。@en The geometry to be converted to wireframe
  50381. */
  50382. export function wireframed(geometry: IGeometry): IGeometry;
  50383. /**
  50384. * @deprecated
  50385. */
  50386. export function wireframe(indices: number[]): number[];
  50387. /**
  50388. * @deprecated
  50389. */
  50390. export function invWinding(indices: number[]): number[];
  50391. /**
  50392. * @deprecated
  50393. */
  50394. export function toWavefrontOBJ(primitive: IGeometry, scale?: number): string;
  50395. /**
  50396. * @deprecated
  50397. */
  50398. export function normals(positions: number[], nms: number[], length?: number): number[];
  50399. /**
  50400. * @en
  50401. * Apply the options to default.
  50402. * @zh
  50403. * 应用默认的几何参数选项。
  50404. */
  50405. export function applyDefaultGeometryOptions<GeometryOptions = IGeometryOptions>(options?: __private.__types_globals__RecursivePartial<IGeometryOptions>): GeometryOptions;
  50406. /**
  50407. * @en
  50408. * The definition of the parameter for building a primitive geometry.
  50409. * @zh
  50410. * 几何体参数选项。
  50411. */
  50412. export interface IGeometryOptions {
  50413. /**
  50414. * @en
  50415. * Whether to include normal. Default to true.
  50416. * @zh
  50417. * 是否包含法线。默认为true。
  50418. */
  50419. includeNormal: boolean;
  50420. /**
  50421. * @en
  50422. * Whether to include uv. Default to true.
  50423. * @zh
  50424. * 是否包含UV。默认为true。
  50425. */
  50426. includeUV: boolean;
  50427. }
  50428. /**
  50429. * @en
  50430. * The definition of the geometry, this struct can build a mesh.
  50431. * @zh
  50432. * 几何体信息。
  50433. */
  50434. export interface IGeometry {
  50435. /**
  50436. * @en
  50437. * Vertex positions.
  50438. * @zh
  50439. * 顶点位置。
  50440. */
  50441. positions: number[];
  50442. /**
  50443. * @en
  50444. * Vertex normals.
  50445. * @zh
  50446. * 顶点法线。
  50447. */
  50448. normals?: number[];
  50449. /**
  50450. * @en
  50451. * Texture coordinates.
  50452. * @zh
  50453. * 纹理坐标。
  50454. */
  50455. uvs?: number[];
  50456. /**
  50457. * @en
  50458. * Vertex Tangents.
  50459. * @zh
  50460. * 顶点切线。
  50461. */
  50462. tangents?: number[];
  50463. /**
  50464. * @en
  50465. * Vertex colors.
  50466. * @zh
  50467. * 顶点颜色。
  50468. */
  50469. colors?: number[];
  50470. /**
  50471. * @en
  50472. * specify vertex attributes, use (positions|normals|uvs|colors) as keys
  50473. * @zh
  50474. * 顶点属性。
  50475. */
  50476. attributes?: gfx.Attribute[];
  50477. customAttributes?: {
  50478. attr: gfx.Attribute;
  50479. values: number[];
  50480. }[];
  50481. /**
  50482. * @en
  50483. * Bounding sphere radius.
  50484. * @zh
  50485. * 包围球半径。
  50486. */
  50487. boundingRadius?: number;
  50488. /**
  50489. * @en
  50490. * Min position.
  50491. * @zh
  50492. * 最小位置。
  50493. */
  50494. minPos?: {
  50495. x: number;
  50496. y: number;
  50497. z: number;
  50498. };
  50499. /**
  50500. * @en
  50501. * Max position.
  50502. * @zh
  50503. * 最大位置。
  50504. */
  50505. maxPos?: {
  50506. x: number;
  50507. y: number;
  50508. z: number;
  50509. };
  50510. /**
  50511. * @en
  50512. * Geometry indices, if one needs indexed-draw.
  50513. * @zh
  50514. * 几何索引,当使用索引绘制时。
  50515. */
  50516. indices?: number[];
  50517. /**
  50518. * @en
  50519. * Topology of the geometry vertices. Default is TRIANGLE_LIST.
  50520. * @zh
  50521. * 几何顶点的拓扑图元。默认值是TRIANGLE_LIST。
  50522. */
  50523. primitiveMode?: gfx.PrimitiveMode;
  50524. /**
  50525. * @en
  50526. * whether rays casting from the back face of this geometry could collide with it
  50527. * @zh
  50528. * 是否是双面,用于判断来自于几何体背面的射线检测。
  50529. */
  50530. doubleSided?: boolean;
  50531. }
  50532. /**
  50533. * @en
  50534. * The definition of the dynamic geometry, this struct can build a dynamic mesh.
  50535. * @zh
  50536. * 几何体信息。
  50537. */
  50538. export interface IDynamicGeometry {
  50539. /**
  50540. * @en
  50541. * Vertex positions: 3 float components.
  50542. * @zh
  50543. * 顶点位置:3个float分量。
  50544. */
  50545. positions: Float32Array;
  50546. /**
  50547. * @en
  50548. * Vertex normals: 3 float components.
  50549. * @zh
  50550. * 顶点法线:3个float分量。
  50551. */
  50552. normals?: Float32Array;
  50553. /**
  50554. * @en
  50555. * Texture coordinates: 2 float components.
  50556. * @zh
  50557. * 纹理坐标:2个float分量。
  50558. */
  50559. uvs?: Float32Array;
  50560. /**
  50561. * @en
  50562. * Vertex Tangents: 4 float components.
  50563. * @zh
  50564. * 顶点切线:4个float分量。
  50565. */
  50566. tangents?: Float32Array;
  50567. /**
  50568. * @en
  50569. * Vertex colors: 4 float components.
  50570. * @zh
  50571. * 顶点颜色:4个float分量。
  50572. */
  50573. colors?: Float32Array;
  50574. /**
  50575. * @en
  50576. * Custom attributes
  50577. * @zh
  50578. * 定制属性列表。
  50579. */
  50580. customAttributes?: {
  50581. attr: gfx.Attribute;
  50582. values: Float32Array;
  50583. }[];
  50584. /**
  50585. * @en
  50586. * Min position.
  50587. * @zh
  50588. * 最小位置。
  50589. */
  50590. minPos?: {
  50591. x: number;
  50592. y: number;
  50593. z: number;
  50594. };
  50595. /**
  50596. * @en
  50597. * Max position.
  50598. * @zh
  50599. * 最大位置。
  50600. */
  50601. maxPos?: {
  50602. x: number;
  50603. y: number;
  50604. z: number;
  50605. };
  50606. /**
  50607. * @en
  50608. * 16 bits Geometry indices, if one needs indexed-draw.
  50609. * @zh
  50610. * 16位几何索引,当使用索引绘制时。
  50611. */
  50612. indices16?: Uint16Array;
  50613. /**
  50614. * @en
  50615. * 32 bits Geometry indices, if one needs indexed-draw.
  50616. * @zh
  50617. * 32位几何索引,当使用索引绘制时。
  50618. */
  50619. indices32?: Uint32Array;
  50620. /**
  50621. * @en
  50622. * Topology of the geometry vertices. Default is TRIANGLE_LIST.
  50623. * @zh
  50624. * 几何顶点的拓扑图元。默认值是TRIANGLE_LIST。
  50625. */
  50626. primitiveMode?: gfx.PrimitiveMode;
  50627. /**
  50628. * @en
  50629. * whether rays casting from the back face of this geometry could collide with it
  50630. * @zh
  50631. * 是否是双面,用于判断来自于几何体背面的射线检测。
  50632. */
  50633. doubleSided?: boolean;
  50634. }
  50635. export interface ICreateMeshOptions {
  50636. /**
  50637. * @en calculate mesh's aabb or not
  50638. * @zh 是否计算模型的包围盒。
  50639. */
  50640. calculateBounds?: boolean;
  50641. }
  50642. export interface ICreateDynamicMeshOptions {
  50643. /**
  50644. * @en max sub mesh count
  50645. * @zh 最大子模型个数。
  50646. */
  50647. maxSubMeshes: number;
  50648. /**
  50649. * @en max sub mesh vertex count
  50650. * @zh 子模型最大顶点个数。
  50651. */
  50652. maxSubMeshVertices: number;
  50653. /**
  50654. * @en max sub mesh index count
  50655. * @zh 子模型最大索引个数。
  50656. */
  50657. maxSubMeshIndices: number;
  50658. }
  50659. export import cylinder = physics.utils.cylinder;
  50660. }
  50661. /**
  50662. * @en
  50663. * Basic primitive mesh, this can be generate some primitive mesh at runtime.
  50664. * @zh
  50665. * 基础图形网格,可以在运行时构建一些基础的网格。
  50666. */
  50667. export class Primitive extends Mesh {
  50668. static PrimitiveType: typeof __private._cocos_primitive_primitive__PrimitiveType;
  50669. /**
  50670. * @en
  50671. * The type of the primitive mesh, set it before you call onLoaded.
  50672. * @zh
  50673. * 此基础图形网格的类型,请在 onLoaded 调用之前设置。
  50674. */
  50675. type: number;
  50676. /**
  50677. * @en
  50678. * The option for build the primitive mesh, set it before you call onLoaded.
  50679. * @zh
  50680. * 创建此基础图形网格的可选参数,请在 onLoaded 调用之前设置。
  50681. */
  50682. info: Record<string, number>;
  50683. constructor(type?: __private._cocos_primitive_primitive__PrimitiveType);
  50684. /**
  50685. * @en
  50686. * Construct the primitive mesh with `type` and `info`.
  50687. * @zh
  50688. * 根据`type`和`info`构建相应的网格。
  50689. */
  50690. onLoaded(): void;
  50691. }
  50692. export namespace Primitive {
  50693. export type PrimitiveType = __private.__types_globals__EnumAlias<typeof __private._cocos_primitive_primitive__PrimitiveType>;
  50694. }
  50695. export class Profiler extends System {
  50696. constructor();
  50697. init(): void;
  50698. /**
  50699. * @deprecated We have removed this private interface in version 3.8, please use the public interface get stats instead.
  50700. */
  50701. get _stats(): __private._cocos_profiler_profiler__IProfilerState | null;
  50702. /**
  50703. * @zh 获取引擎运行性能状态
  50704. * @en Get engine performance status
  50705. */
  50706. get stats(): __private._cocos_profiler_profiler__IProfilerState | null;
  50707. isShowingStats(): boolean;
  50708. hideStats(): void;
  50709. showStats(): void;
  50710. generateCanvas(): void;
  50711. generateStats(): void;
  50712. generateNode(): void;
  50713. beforeUpdate(): void;
  50714. afterUpdate(): void;
  50715. beforePhysics(): void;
  50716. afterPhysics(): void;
  50717. beforeDraw(): void;
  50718. afterRender(): void;
  50719. afterPresent(): void;
  50720. }
  50721. export const profiler: Profiler;
  50722. /**
  50723. * @en
  50724. * The data conversion tool for skeleton animation
  50725. * @zh
  50726. * 骨骼动画数据转换中心。
  50727. * @internal
  50728. */
  50729. export class SkelAnimDataHub {
  50730. static getOrExtract(clip: AnimationClip): __private._cocos_3d_skeletal_animation_skeletal_animation_data_hub__BakeData;
  50731. static destroy(clip: AnimationClip): void;
  50732. }
  50733. /**
  50734. * @en The animation state for skeletal animations.
  50735. * @zh 骨骼动画的动画状态控制对象。
  50736. */
  50737. export class SkeletalAnimationState extends AnimationState {
  50738. protected _frames: number;
  50739. protected _bakedDuration: number;
  50740. protected _animInfo: __private._cocos_3d_skeletal_animation_skeletal_animation_utils__IAnimInfo | null;
  50741. protected _sockets: __private._cocos_3d_skeletal_animation_skeletal_animation_state__ISocketData[];
  50742. protected _animInfoMgr: __private._cocos_3d_skeletal_animation_skeletal_animation_utils__JointAnimationInfo;
  50743. protected _parent: SkeletalAnimation | null;
  50744. protected _curvesInited: boolean;
  50745. constructor(clip: AnimationClip, name?: string);
  50746. initialize(root: Node): void;
  50747. protected onPlay(): void;
  50748. /**
  50749. * @internal This method only friends to `SkeletalAnimation`.
  50750. */
  50751. setUseBaked(useBaked: boolean): void;
  50752. /**
  50753. * @en Rebuild animation curves and register the socket transforms per frame to the sockets. It will replace the internal sockets list.
  50754. * @zh 为所有指定挂点更新动画曲线运算结果,并存储所有挂点的逐帧变换矩阵。这个方法会用传入的挂点更新取代内部挂点列表。
  50755. * @param sockets @en The sockets need update @zh 需要重建的挂点列表
  50756. * @returns void
  50757. */
  50758. rebuildSocketCurves(sockets: Socket[]): void;
  50759. }
  50760. /**
  50761. * @en The socket to synchronize transform from skeletal joint to target node.
  50762. * @zh 骨骼动画的挂点,用于将骨骼树的挂点节点变化矩阵同步到目标节点上
  50763. */
  50764. export class Socket {
  50765. /**
  50766. * @en Path of the target joint.
  50767. * @zh 此挂点的目标骨骼路径。
  50768. */
  50769. path: string;
  50770. /**
  50771. * @en Transform output node.
  50772. * @zh 此挂点的变换信息输出节点。
  50773. */
  50774. target: Node | null;
  50775. constructor(path?: string, target?: Node | null);
  50776. }
  50777. /**
  50778. * @en
  50779. * Skeletal animation component, offers the following features on top of [[Animation]]:
  50780. * * Choice between baked animation and real-time calculation, to leverage efficiency and expressiveness.
  50781. * * Joint socket system: Create any socket node directly under the animation component root node,
  50782. * find your target joint and register both to the socket list, so that the socket node would be in-sync with the joint.
  50783. * @zh
  50784. * 骨骼动画组件,在普通动画组件基础上额外提供以下功能:
  50785. * * 可选预烘焙动画模式或实时计算模式,用以权衡运行时效率与效果;
  50786. * * 提供骨骼挂点功能:通过在动画根节点下创建挂点节点,并在骨骼动画组件上配置 socket 列表,挂点节点的 Transform 就能与骨骼保持同步。
  50787. */
  50788. export class SkeletalAnimation extends Animation {
  50789. static Socket: typeof Socket;
  50790. /**
  50791. * @en
  50792. * The joint sockets this animation component maintains.<br>
  50793. * Sockets have to be registered here before attaching custom nodes to animated joints.
  50794. * @zh
  50795. * 当前动画组件维护的挂点数组。要挂载自定义节点到受动画驱动的骨骼上,必须先在此注册挂点。
  50796. */
  50797. get sockets(): Socket[];
  50798. set sockets(val: Socket[]);
  50799. /**
  50800. * @en
  50801. * Whether to bake animations. Default to true,<br>
  50802. * which substantially increases performance while making all animations completely fixed.<br>
  50803. * Dynamically changing this property will take effect when playing the next animation clip.
  50804. * Note, in editor(not in preview) mode, this option takes no effect: animation is always non-baked.
  50805. * @zh
  50806. * 是否使用预烘焙动画,默认启用,可以大幅提高运行效时率,但所有动画效果会被彻底固定,不支持任何形式的编辑和混合。<br>
  50807. * 运行时动态修改此选项会在播放下一条动画片段时生效。
  50808. * 注意,在编辑器(非预览)模式下,此选项不起作用:动画总是非预烘焙的。
  50809. */
  50810. get useBakedAnimation(): boolean;
  50811. set useBakedAnimation(value: boolean);
  50812. protected _useBakedAnimation: boolean;
  50813. protected _sockets: Socket[];
  50814. onLoad(): void;
  50815. onDestroy(): void;
  50816. onEnable(): void;
  50817. onDisable(): void;
  50818. start(): void;
  50819. pause(): void;
  50820. resume(): void;
  50821. stop(): void;
  50822. /**
  50823. * @en Query all socket paths
  50824. * @zh 获取所有挂点的骨骼路径
  50825. * @returns @en All socket paths @zh 所有挂点的骨骼路径
  50826. */
  50827. querySockets(): string[];
  50828. /**
  50829. * @en Rebuild animations to synchronize immediately all sockets to their target node.
  50830. * @zh 重建动画并立即同步所有挂点的转换矩阵到它们的目标节点上。
  50831. */
  50832. rebuildSocketAnimations(): void;
  50833. /**
  50834. * @en Create or get the target node from a socket.
  50835. * If a socket haven't been created for the corresponding path, this function will register a new socket.
  50836. * @zh 创建或获取一个挂点的同步目标节点。
  50837. * 如果对应路径还没有创建挂点,这个函数会创建一个新的挂点。
  50838. * @param path @en Path of the target joint. @zh 此挂点的骨骼路径。
  50839. * @returns @en The target node of the socket. @zh 挂点的目标节点
  50840. */
  50841. createSocket(path: string): Node | null;
  50842. /**
  50843. * @internal This method only friends to skinned mesh renderer.
  50844. */
  50845. notifySkinnedMeshAdded(skinnedMeshRenderer: SkinnedMeshRenderer): void;
  50846. /**
  50847. * @internal This method only friends to skinned mesh renderer.
  50848. */
  50849. notifySkinnedMeshRemoved(skinnedMeshRenderer: SkinnedMeshRenderer): void;
  50850. /**
  50851. * Get all users.
  50852. * @internal This method only friends to the skeleton animation state.
  50853. */
  50854. getUsers(): Set<SkinnedMeshRenderer>;
  50855. protected _createState(clip: AnimationClip, name?: string): SkeletalAnimationState;
  50856. protected _doCreateState(clip: AnimationClip, name: string): SkeletalAnimationState;
  50857. protected doPlayOrCrossFade(state: AnimationState, duration: number): void;
  50858. }
  50859. /**
  50860. * @zh 排序层管理器,用于在 sorting 组件中帮助用户进行对象分组并进行层级排序。
  50861. * 在sorting组件中,layer 的排序优先级高于 sortingOrder。
  50862. * @en Sorting layers manager, Used in the sorting component to help the user group objects and perform layer sorting.
  50863. * In the sorting component, layer has higher sorting priority than sortingOrder.
  50864. * */
  50865. export class SortingLayers {
  50866. /**
  50867. * @en All sortinglayers in an Enum
  50868. * @zh 以 Enum 形式存在的所有排序层列表
  50869. */
  50870. static Enum: {
  50871. default: number;
  50872. };
  50873. /**
  50874. * @zh 计算排序优先级
  50875. * @en Calculate sorting priority
  50876. */
  50877. static getSortingPriority(layer?: number, order?: number): number;
  50878. /**
  50879. * @zh 获取 Layer 顺序索引
  50880. * @en Get Layer index by id
  50881. */
  50882. static getLayerIndex(layer?: number): number;
  50883. /**
  50884. * @zh 通过 Layer 名字获取 Layer 顺序索引值
  50885. * @en Get Layer index by name
  50886. */
  50887. static getLayerIndexByName(name: string): number;
  50888. /**
  50889. * @zh 获取 Layer 名字
  50890. * @en Get Layer name by id
  50891. */
  50892. static getLayerName(layer?: number): string;
  50893. /**
  50894. * @zh 通过 Layer 名字获取 Layer id 值
  50895. * @en Get Layer id by name
  50896. */
  50897. static getLayerByName(name: string): number;
  50898. /**
  50899. * @zh 检查 Layer id 有效性
  50900. * @en Check Layer id validity
  50901. */
  50902. static isLayerValid(id: number): boolean;
  50903. /**
  50904. * @zh 获取内置 Sorting Layer 数组
  50905. * @en Get Builtin Layer array
  50906. */
  50907. static getBuiltinLayers(): ReadonlyArray<__private._cocos_sorting_sorting_layers__SortingItem>;
  50908. }
  50909. /**
  50910. * @en
  50911. * Render sort component. This component must be placed on a node with a [[MeshRenderer]] or [[SpriteRenderer]] component.
  50912. *
  50913. * @zh
  50914. * 渲染排序组件。该组件必须放置在带有 [[MeshRenderer]] 或者 [[SpriteRenderer]] 组件的节点上。
  50915. */
  50916. export class Sorting extends Component {
  50917. /**
  50918. * @zh 组件所属排序层 id,影响组件的渲染排序。
  50919. * @en The sorting layer id of the component, which affects the rendering order of the component.
  50920. */
  50921. get sortingLayer(): number;
  50922. set sortingLayer(val: number);
  50923. /**
  50924. * @zh 组件在当前排序层中的顺序,在默认排序规则中,越小越先渲染。
  50925. * @en Model Renderer's order within a sorting layer. In the default sorting rule, smaller values are rendered first.
  50926. */
  50927. get sortingOrder(): number;
  50928. set sortingOrder(val: number);
  50929. protected _sortingLayer: number;
  50930. protected _sortingOrder: number;
  50931. protected __preload(): void;
  50932. protected _updateSortingPriority(): void;
  50933. }
  50934. export namespace sp {
  50935. /*
  50936. Copyright (c) 2022-2023 Xiamen Yaji Software Co., Ltd.
  50937. https://www.cocos.com/
  50938. Permission is hereby granted, free of charge, to any person obtaining a copy
  50939. of this software and associated documentation files (the "Software"), to deal
  50940. in the Software without restriction, including without limitation the rights to
  50941. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50942. of the Software, and to permit persons to whom the Software is furnished to do so,
  50943. subject to the following conditions:
  50944. The above copyright notice and this permission notice shall be included in
  50945. all copies or substantial portions of the Software.
  50946. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50947. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50948. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50949. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50950. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50951. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  50952. THE SOFTWARE.
  50953. */
  50954. /* eslint @typescript-eslint/no-explicit-any: "off" */
  50955. export namespace spine {
  50956. export class String {
  50957. length: number;
  50958. isEmpty: boolean;
  50959. strPtr: number;
  50960. str: string;
  50961. }
  50962. export class SPVectorFloat {
  50963. size(): number;
  50964. resize(newSize: number, defaultValue: number);
  50965. set(index: number, value: number);
  50966. get(index: number): number;
  50967. delete();
  50968. }
  50969. export class Animation {
  50970. constructor(name: string, timelines: Array<Timeline>, duration: number);
  50971. duration: number;
  50972. name: string;
  50973. timelines: Array<Timeline>;
  50974. apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  50975. hasTimeline(id: number): boolean;
  50976. }
  50977. export interface Timeline {
  50978. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  50979. getPropertyId(): number;
  50980. }
  50981. export enum MixBlend {
  50982. setup = 0,
  50983. first = 1,
  50984. replace = 2,
  50985. add = 3
  50986. }
  50987. export enum MixDirection {
  50988. mixIn = 0,
  50989. mixOut = 1
  50990. }
  50991. export enum TimelineType {
  50992. rotate = 0,
  50993. translate = 1,
  50994. scale = 2,
  50995. shear = 3,
  50996. attachment = 4,
  50997. color = 5,
  50998. deform = 6,
  50999. event = 7,
  51000. drawOrder = 8,
  51001. ikConstraint = 9,
  51002. transformConstraint = 10,
  51003. pathConstraintPosition = 11,
  51004. pathConstraintSpacing = 12,
  51005. pathConstraintMix = 13,
  51006. twoColor = 14
  51007. }
  51008. export abstract class CurveTimeline implements Timeline {
  51009. static readonly LINEAR: number;
  51010. static readonly STEPPED: number;
  51011. static readonly BEZIER: number;
  51012. static readonly BEZIER_SIZE: number;
  51013. abstract getPropertyId(): number;
  51014. constructor(frameCount: number);
  51015. getFrameCount(): number;
  51016. setLinear(frameIndex: number): void;
  51017. setStepped(frameIndex: number): void;
  51018. getCurveType(frameIndex: number): number;
  51019. setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  51020. getCurvePercent(frameIndex: number, percent: number): number;
  51021. abstract apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51022. }
  51023. export class RotateTimeline extends CurveTimeline {
  51024. static ENTRIES: number;
  51025. static PREV_TIME: number;
  51026. static PREV_ROTATION: number;
  51027. static ROTATION: number;
  51028. boneIndex: number;
  51029. frames: ArrayLike<number>;
  51030. constructor(frameCount: number);
  51031. getPropertyId(): number;
  51032. setFrame(frameIndex: number, time: number, degrees: number): void;
  51033. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51034. }
  51035. export class TranslateTimeline extends CurveTimeline {
  51036. static readonly ENTRIES: number;
  51037. frames: ArrayLike<number>;
  51038. constructor(frameCount: number);
  51039. getPropertyId(): number;
  51040. setFrame(frameIndex: number, time: number, x: number, y: number): void;
  51041. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51042. }
  51043. export class ScaleTimeline extends TranslateTimeline {
  51044. constructor(frameCount: number);
  51045. getPropertyId(): number;
  51046. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51047. }
  51048. export class ShearTimeline extends TranslateTimeline {
  51049. constructor(frameCount: number);
  51050. getPropertyId(): number;
  51051. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51052. }
  51053. export class ColorTimeline extends CurveTimeline {
  51054. static ENTRIES: number;
  51055. slotIndex: number;
  51056. frames: ArrayLike<number>;
  51057. constructor(frameCount: number);
  51058. getPropertyId(): number;
  51059. getSlotIndex(): number;
  51060. setSlotIndex(inValue: number): void;
  51061. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
  51062. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51063. }
  51064. export class TwoColorTimeline extends CurveTimeline {
  51065. static readonly ENTRIES: number;
  51066. slotIndex: number;
  51067. frames: ArrayLike<number>;
  51068. constructor(frameCount: number);
  51069. getPropertyId(): number;
  51070. getSlotIndex(): number;
  51071. setSlotIndex(inValue: number): void;
  51072. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
  51073. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51074. }
  51075. export class AttachmentTimeline implements Timeline {
  51076. slotIndex: number;
  51077. frames: ArrayLike<number>;
  51078. attachmentNames: Array<string>;
  51079. constructor(frameCount: number);
  51080. getPropertyId(): number;
  51081. getFrameCount(): number;
  51082. getSlotIndex(): number;
  51083. setSlotIndex(inValue: number): void;
  51084. getAttachmentNames(): Array<string>;
  51085. setFrame(frameIndex: number, time: number, attachmentName: string): void;
  51086. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51087. }
  51088. export class DeformTimeline extends CurveTimeline {
  51089. slotIndex: number;
  51090. attachment: VertexAttachment;
  51091. frames: ArrayLike<number>;
  51092. frameVertices: Array<ArrayLike<number>>;
  51093. constructor(frameCount: number);
  51094. getPropertyId(): number;
  51095. setFrame(frameIndex: number, time: number, vertices: ArrayLike<number>): void;
  51096. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51097. }
  51098. export class EventTimeline implements Timeline {
  51099. frames: ArrayLike<number>;
  51100. events: Array<Event>;
  51101. constructor(frameCount: number);
  51102. getPropertyId(): number;
  51103. getFrameCount(): number;
  51104. setFrame(frameIndex: number, event: Event): void;
  51105. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51106. }
  51107. export class DrawOrderTimeline implements Timeline {
  51108. frames: ArrayLike<number>;
  51109. drawOrders: Array<Array<number>>;
  51110. constructor(frameCount: number);
  51111. getPropertyId(): number;
  51112. getFrameCount(): number;
  51113. setFrame(frameIndex: number, time: number, drawOrder: Array<number>): void;
  51114. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51115. }
  51116. export class IkConstraintTimeline extends Updatable {
  51117. static readonly ENTRIES: number;
  51118. frames: ArrayLike<number>;
  51119. constructor(frameCount: number);
  51120. getPropertyId(): number;
  51121. setFrame(frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean): void;
  51122. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51123. }
  51124. export class TransformConstraintTimeline extends CurveTimeline {
  51125. static ENTRIES: number;
  51126. constructor(frameCount: number);
  51127. getPropertyId(): number;
  51128. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number): void;
  51129. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51130. }
  51131. export class PathConstraintPositionTimeline extends CurveTimeline {
  51132. static readonly ENTRIES: number;
  51133. constructor(frameCount: number);
  51134. getPropertyId(): number;
  51135. setFrame(frameIndex: number, time: number, value: number): void;
  51136. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51137. }
  51138. export class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {
  51139. constructor(frameCount: number);
  51140. getPropertyId(): number;
  51141. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51142. }
  51143. export class PathConstraintMixTimeline extends CurveTimeline {
  51144. static readonly ENTRIES: number;
  51145. frames: ArrayLike<number>;
  51146. constructor(frameCount: number);
  51147. getPropertyId(): number;
  51148. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number): void;
  51149. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  51150. }
  51151. export class AnimationState {
  51152. data: AnimationStateData;
  51153. tracks: TrackEntry[];
  51154. timeScale: number;
  51155. constructor(data: AnimationStateData);
  51156. update(delta: number): void;
  51157. apply(skeleton: Skeleton): boolean;
  51158. applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean): void;
  51159. setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string, attachments: boolean): void;
  51160. applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
  51161. clearTracks(): void;
  51162. clearTrack(trackIndex: number): void;
  51163. setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
  51164. setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
  51165. addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;
  51166. addAnimationWith(trackIndex: number, animation: Animation, loop: boolean, delay: number): TrackEntry;
  51167. setEmptyAnimation(trackIndex: number, mixDuration: number): TrackEntry;
  51168. addEmptyAnimation(trackIndex: number, mixDuration: number, delay: number): TrackEntry;
  51169. setEmptyAnimations(mixDuration: number): void;
  51170. trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
  51171. getCurrent(trackIndex: number): TrackEntry;
  51172. setListener(listener: AnimationStateListener): void;
  51173. clearListeners(): void;
  51174. }
  51175. export class TrackEntry {
  51176. animation: Animation;
  51177. next: TrackEntry;
  51178. mixingFrom: TrackEntry;
  51179. mixingTo: TrackEntry;
  51180. listener: AnimationStateListener;
  51181. trackIndex: number;
  51182. loop: boolean;
  51183. holdPrevious: boolean;
  51184. eventThreshold: number;
  51185. attachmentThreshold: number;
  51186. drawOrderThreshold: number;
  51187. animationStart: number;
  51188. animationEnd: number;
  51189. animationLast: number;
  51190. nextAnimationLast: number;
  51191. delay: number;
  51192. trackTime: number;
  51193. trackLast: number;
  51194. nextTrackLast: number;
  51195. trackEnd: number;
  51196. timeScale: number;
  51197. alpha: number;
  51198. mixTime: number;
  51199. mixDuration: number;
  51200. interruptAlpha: number;
  51201. totalAlpha: number;
  51202. mixBlend: MixBlend;
  51203. timelineMode: number[];
  51204. timelineHoldMix: TrackEntry[];
  51205. timelinesRotation: number[];
  51206. reset(): void;
  51207. getAnimationTime(): number;
  51208. setAnimationLast(animationLast: number): void;
  51209. isComplete(): boolean;
  51210. resetRotationDirections(): void;
  51211. }
  51212. export class EventQueue {
  51213. objects: Array<any>;
  51214. drainDisabled: boolean;
  51215. animState: AnimationState;
  51216. constructor(animState: AnimationState);
  51217. start(entry: TrackEntry): void;
  51218. interrupt(entry: TrackEntry): void;
  51219. end(entry: TrackEntry): void;
  51220. dispose(entry: TrackEntry): void;
  51221. complete(entry: TrackEntry): void;
  51222. event(entry: TrackEntry, event: Event): void;
  51223. drain(): void;
  51224. clear(): void;
  51225. }
  51226. export enum EventType {
  51227. start = 0,
  51228. interrupt = 1,
  51229. end = 2,
  51230. dispose = 3,
  51231. complete = 4,
  51232. event = 5
  51233. }
  51234. export interface AnimationStateListener {
  51235. start(entry: TrackEntry): void;
  51236. interrupt(entry: TrackEntry): void;
  51237. end(entry: TrackEntry): void;
  51238. dispose(entry: TrackEntry): void;
  51239. complete(entry: TrackEntry): void;
  51240. event(entry: TrackEntry, event: Event): void;
  51241. }
  51242. export abstract class AnimationStateAdapter implements AnimationStateListener {
  51243. start(entry: TrackEntry): void;
  51244. interrupt(entry: TrackEntry): void;
  51245. end(entry: TrackEntry): void;
  51246. dispose(entry: TrackEntry): void;
  51247. complete(entry: TrackEntry): void;
  51248. event(entry: TrackEntry, event: Event): void;
  51249. }
  51250. export class AnimationStateData {
  51251. skeletonData: SkeletonData;
  51252. animationToMixTime: Map<number>;
  51253. defaultMix: number;
  51254. constructor(skeletonData: SkeletonData);
  51255. setMix(fromName: string, toName: string, duration: number): void;
  51256. setMixWith(from: Animation, to: Animation, duration: number): void;
  51257. getMix(from: Animation, to: Animation): number;
  51258. }
  51259. export class AssetManager implements Disposable {
  51260. constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
  51261. setRawDataURI(path: string, data: string): void;
  51262. loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, error: string) => void): void;
  51263. loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
  51264. loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  51265. loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, error: string) => void): void;
  51266. get(path: string): any;
  51267. remove(path: string): void;
  51268. removeAll(): void;
  51269. isLoadingComplete(): boolean;
  51270. getToLoad(): number;
  51271. getLoaded(): number;
  51272. dispose(): void;
  51273. hasErrors(): boolean;
  51274. getErrors(): Map<string>;
  51275. }
  51276. export class AtlasAttachmentLoader implements AttachmentLoader {
  51277. atlas: TextureAtlas;
  51278. constructor(atlas: TextureAtlas);
  51279. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  51280. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  51281. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  51282. newPathAttachment(skin: Skin, name: string): PathAttachment;
  51283. newPointAttachment(skin: Skin, name: string): PointAttachment;
  51284. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  51285. }
  51286. export enum BlendMode {
  51287. Normal = 0,
  51288. Additive = 1,
  51289. Multiply = 2,
  51290. Screen = 3
  51291. }
  51292. export class Bone implements Updatable {
  51293. data: BoneData;
  51294. skeleton: Skeleton;
  51295. parent: Bone;
  51296. children: Bone[];
  51297. x: number;
  51298. y: number;
  51299. rotation: number;
  51300. scaleX: number;
  51301. scaleY: number;
  51302. shearX: number;
  51303. shearY: number;
  51304. ax: number;
  51305. ay: number;
  51306. arotation: number;
  51307. ascaleX: number;
  51308. ascaleY: number;
  51309. ashearX: number;
  51310. ashearY: number;
  51311. appliedValid: boolean;
  51312. a: number;
  51313. b: number;
  51314. c: number;
  51315. d: number;
  51316. worldY: number;
  51317. worldX: number;
  51318. sorted: boolean;
  51319. active: boolean;
  51320. constructor(data: BoneData, skeleton: Skeleton, parent: Bone);
  51321. isActive(): boolean;
  51322. update(): void;
  51323. updateWorldTransform(): void;
  51324. updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
  51325. setToSetupPose(): void;
  51326. getWorldRotationX(): number;
  51327. getWorldRotationY(): number;
  51328. getWorldScaleX(): number;
  51329. getWorldScaleY(): number;
  51330. worldToLocal(world: Vector2): Vector2;
  51331. localToWorld(local: Vector2): Vector2;
  51332. worldToLocalRotation(worldRotation: number): number;
  51333. localToWorldRotation(localRotation: number): number;
  51334. rotateWorld(degrees: number): void;
  51335. }
  51336. export class BoneData {
  51337. index: number;
  51338. name: string;
  51339. parent: BoneData;
  51340. length: number;
  51341. x: number;
  51342. y: number;
  51343. rotation: number;
  51344. scaleX: number;
  51345. scaleY: number;
  51346. shearX: number;
  51347. shearY: number;
  51348. transformMode: TransformMode;
  51349. skinRequired: boolean;
  51350. constructor(index: number, name: string, parent: BoneData);
  51351. }
  51352. export enum TransformMode {
  51353. Normal = 0,
  51354. OnlyTranslation = 1,
  51355. NoRotationOrReflection = 2,
  51356. NoScale = 3,
  51357. NoScaleOrReflection = 4
  51358. }
  51359. export abstract class ConstraintData {
  51360. name: string;
  51361. order: number;
  51362. skinRequired: boolean;
  51363. constructor(name: string, order: number, skinRequired: boolean);
  51364. }
  51365. export class Event {
  51366. data: EventData;
  51367. intValue: number;
  51368. floatValue: number;
  51369. stringValue: string;
  51370. time: number;
  51371. volume: number;
  51372. balance: number;
  51373. constructor(time: number, data: EventData);
  51374. }
  51375. export class EventData {
  51376. name: string;
  51377. intValue: number;
  51378. floatValue: number;
  51379. stringValue: string;
  51380. audioPath: string;
  51381. volume: number;
  51382. balance: number;
  51383. constructor(name: string);
  51384. }
  51385. export class IkConstraint implements Updatable {
  51386. data: IkConstraintData;
  51387. bones: Array<Bone>;
  51388. target: Bone;
  51389. bendDirection: number;
  51390. compress: boolean;
  51391. stretch: boolean;
  51392. mix: number;
  51393. softness: number;
  51394. active: boolean;
  51395. constructor(data: IkConstraintData, skeleton: Skeleton);
  51396. isActive(): boolean;
  51397. apply(): void;
  51398. update(): void;
  51399. apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
  51400. apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
  51401. }
  51402. export class IkConstraintData extends ConstraintData {
  51403. bones: BoneData[];
  51404. target: BoneData;
  51405. bendDirection: number;
  51406. compress: boolean;
  51407. stretch: boolean;
  51408. uniform: boolean;
  51409. mix: number;
  51410. softness: number;
  51411. constructor(name: string);
  51412. }
  51413. export class PathConstraint implements Updatable {
  51414. static NONE: number;
  51415. static BEFORE: number;
  51416. static AFTER: number;
  51417. static epsilon: number;
  51418. data: PathConstraintData;
  51419. bones: Array<Bone>;
  51420. target: Slot;
  51421. position: number;
  51422. spacing: number;
  51423. rotateMix: number;
  51424. translateMix: number;
  51425. spaces: number[];
  51426. positions: number[];
  51427. world: number[];
  51428. curves: number[];
  51429. lengths: number[];
  51430. segments: number[];
  51431. active: boolean;
  51432. constructor(data: PathConstraintData, skeleton: Skeleton);
  51433. isActive(): boolean;
  51434. apply(): void;
  51435. update(): void;
  51436. }
  51437. export class PathConstraintData extends ConstraintData {
  51438. bones: BoneData[];
  51439. target: SlotData;
  51440. positionMode: PositionMode;
  51441. spacingMode: SpacingMode;
  51442. rotateMode: RotateMode;
  51443. offsetRotation: number;
  51444. position: number;
  51445. spacing: number;
  51446. rotateMix: number;
  51447. translateMix: number;
  51448. constructor(name: string);
  51449. }
  51450. export enum PositionMode {
  51451. Fixed = 0,
  51452. Percent = 1
  51453. }
  51454. export enum SpacingMode {
  51455. Length = 0,
  51456. Fixed = 1,
  51457. Percent = 2
  51458. }
  51459. export enum RotateMode {
  51460. Tangent = 0,
  51461. Chain = 1,
  51462. ChainScale = 2
  51463. }
  51464. export class SharedAssetManager implements Disposable {
  51465. constructor(pathPrefix?: string);
  51466. loadText(clientId: string, path: string): void;
  51467. loadJson(clientId: string, path: string): void;
  51468. loadTexture(clientId: string, textureLoader: (image: HTMLImageElement | ImageBitmap) => any, path: string): void;
  51469. get(clientId: string, path: string): any;
  51470. isLoadingComplete(clientId: string): boolean;
  51471. dispose(): void;
  51472. hasErrors(): boolean;
  51473. getErrors(): Map<string>;
  51474. }
  51475. export class Skeleton {
  51476. data: SkeletonData;
  51477. bones: Array<Bone>;
  51478. slots: Array<Slot>;
  51479. drawOrder: Array<Slot>;
  51480. ikConstraints: Array<IkConstraint>;
  51481. transformConstraints: Array<TransformConstraint>;
  51482. pathConstraints: Array<PathConstraint>;
  51483. _updateCache: Updatable[];
  51484. skin: Skin;
  51485. color: Color;
  51486. time: number;
  51487. scaleX: number;
  51488. scaleY: number;
  51489. x: number;
  51490. y: number;
  51491. constructor(data: SkeletonData);
  51492. updateCache(): void;
  51493. updateWorldTransform(): void;
  51494. setToSetupPose(): void;
  51495. setBonesToSetupPose(): void;
  51496. setSlotsToSetupPose(): void;
  51497. getRootBone(): Bone;
  51498. findBone(boneName: string): Bone;
  51499. findBoneIndex(boneName: string): number;
  51500. findSlot(slotName: string): Slot;
  51501. findSlotIndex(slotName: string): number;
  51502. setSkinByName(skinName: string): void;
  51503. setSkin(newSkin: Skin): void;
  51504. getAttachmentByName(slotName: string, attachmentName: string): Attachment;
  51505. getAttachment(slotIndex: number, attachmentName: string): Attachment;
  51506. setAttachment(slotName: string, attachmentName: string): void;
  51507. findIkConstraint(constraintName: string): IkConstraint;
  51508. findTransformConstraint(constraintName: string): TransformConstraint;
  51509. findPathConstraint(constraintName: string): PathConstraint;
  51510. //getBounds(offset: Vector2, size: Vector2, temp?: Array<number>): void;
  51511. update(delta: number): void;
  51512. }
  51513. export class SkeletonBinary {
  51514. static AttachmentTypeValues: number[];
  51515. static TransformModeValues: TransformMode[];
  51516. static PositionModeValues: PositionMode[];
  51517. static SpacingModeValues: SpacingMode[];
  51518. static RotateModeValues: RotateMode[];
  51519. static BlendModeValues: BlendMode[];
  51520. static BONE_ROTATE: number;
  51521. static BONE_TRANSLATE: number;
  51522. static BONE_SCALE: number;
  51523. static BONE_SHEAR: number;
  51524. static SLOT_ATTACHMENT: number;
  51525. static SLOT_COLOR: number;
  51526. static SLOT_TWO_COLOR: number;
  51527. static PATH_POSITION: number;
  51528. static PATH_SPACING: number;
  51529. static PATH_MIX: number;
  51530. static CURVE_LINEAR: number;
  51531. static CURVE_STEPPED: number;
  51532. static CURVE_BEZIER: number;
  51533. scale: number;
  51534. attachmentLoader: AttachmentLoader;
  51535. constructor(attachmentLoader: AttachmentLoader);
  51536. readSkeletonData(binary: Uint8Array): SkeletonData;
  51537. setCurve(timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  51538. }
  51539. export class SkeletonBounds {
  51540. update(skeleton: Skeleton, updateAabb: boolean): void;
  51541. aabbContainsPoint(x: number, y: number): boolean;
  51542. aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number): boolean;
  51543. aabbIntersectsSkeleton(bounds: SkeletonBounds): boolean;
  51544. containsPoint(x: number, y: number): BoundingBoxAttachment;
  51545. containsPointPolygon(polygon: ArrayLike<number>, x: number, y: number): boolean;
  51546. intersectsSegment(x1: number, y1: number, x2: number, y2: number): BoundingBoxAttachment;
  51547. intersectsSegmentPolygon(polygon: ArrayLike<number>, x1: number, y1: number, x2: number, y2: number): boolean;
  51548. getPolygon(boundingBox: BoundingBoxAttachment): ArrayLike<number>;
  51549. getWidth(): number;
  51550. getHeight(): number;
  51551. }
  51552. export class SkeletonClipping {
  51553. clippedVertices: number[];
  51554. clippedTriangles: number[];
  51555. clippedUVs: number[];
  51556. clipStart(slot: Slot, clip: ClippingAttachment): number;
  51557. clipEndWithSlot(slot: Slot): void;
  51558. clipEnd(): void;
  51559. isClipping(): boolean;
  51560. clipTriangles(vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>, light: Color, dark: Color, twoColor: boolean, strideFloat?: number, offsetV?: number, offsetI?: number): void;
  51561. }
  51562. export class SkeletonData {
  51563. name: string;
  51564. bones: BoneData[];
  51565. slots: SlotData[];
  51566. skins: Skin[];
  51567. defaultSkin: Skin;
  51568. events: EventData[];
  51569. animations: Animation[];
  51570. ikConstraints: IkConstraintData[];
  51571. transformConstraints: TransformConstraintData[];
  51572. pathConstraints: PathConstraintData[];
  51573. x: number;
  51574. y: number;
  51575. width: number;
  51576. height: number;
  51577. version: string;
  51578. hash: string;
  51579. fps: number;
  51580. imagesPath: string;
  51581. audioPath: string;
  51582. findBone(boneName: string): BoneData;
  51583. findBoneIndex(boneName: string): number;
  51584. findSlot(slotName: string): SlotData;
  51585. findSlotIndex(slotName: string): number;
  51586. findSkin(skinName: string): Skin;
  51587. findEvent(eventDataName: string): EventData;
  51588. findAnimation(animationName: string): Animation;
  51589. findIkConstraint(constraintName: string): IkConstraintData;
  51590. findTransformConstraint(constraintName: string): TransformConstraintData;
  51591. findPathConstraint(constraintName: string): PathConstraintData;
  51592. findPathConstraintIndex(pathConstraintName: string): number;
  51593. }
  51594. export class SkeletonJson {
  51595. attachmentLoader: AttachmentLoader;
  51596. scale: number;
  51597. constructor(attachmentLoader: AttachmentLoader);
  51598. readSkeletonData(json: any): SkeletonData;
  51599. readAttachment(map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment;
  51600. readVertices(map: any, attachment: VertexAttachment, verticesLength: number): void;
  51601. readAnimation(map: any, name: string, skeletonData: SkeletonData): void;
  51602. readCurve(map: any, timeline: CurveTimeline, frameIndex: number): void;
  51603. getValue(map: any, prop: string, defaultValue: any): any;
  51604. static blendModeFromString(str: string): BlendMode;
  51605. static positionModeFromString(str: string): PositionMode;
  51606. static spacingModeFromString(str: string): SpacingMode;
  51607. static rotateModeFromString(str: string): RotateMode;
  51608. static transformModeFromString(str: string): TransformMode;
  51609. }
  51610. export class SkinEntry {
  51611. slotIndex: number;
  51612. name: string;
  51613. attachment: Attachment;
  51614. constructor(slotIndex: number, name: string, attachment: Attachment);
  51615. }
  51616. export class Skin {
  51617. name: string;
  51618. attachments: Map<Attachment>[];
  51619. bones: BoneData[];
  51620. constraints: ConstraintData[];
  51621. constructor(name: string);
  51622. setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
  51623. addSkin(skin: Skin): void;
  51624. copySkin(skin: Skin): void;
  51625. findNamesForSlot(slotIndex: number, names: Array<string>): void;
  51626. getBones(): Array<Bone>;
  51627. getConstraints(): Array<ConstraintData>;
  51628. getAttachment(slotIndex: number, name: string): Attachment;
  51629. removeAttachment(slotIndex: number, name: string): void;
  51630. getAttachments(): Array<SkinEntry>;
  51631. getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
  51632. }
  51633. export class Slot {
  51634. data: SlotData;
  51635. bone: Bone;
  51636. color: Color;
  51637. darkColor: Color;
  51638. attachment: Attachment;
  51639. attachmentState: number;
  51640. deform: number[];
  51641. constructor(data: SlotData, bone: Bone);
  51642. getSkeleton(): Skeleton;
  51643. getAttachment(): Attachment;
  51644. setAttachment(attachment: Attachment): void;
  51645. setAttachmentTime(time: number): void;
  51646. getAttachmentTime(): number;
  51647. setToSetupPose(): void;
  51648. }
  51649. export class SlotData {
  51650. index: number;
  51651. name: string;
  51652. boneData: BoneData;
  51653. color: Color;
  51654. darkColor: Color;
  51655. attachmentName: string;
  51656. blendMode: BlendMode;
  51657. constructor(index: number, name: string, boneData: BoneData);
  51658. }
  51659. export abstract class Texture {
  51660. protected _image: HTMLImageElement | ImageBitmap;
  51661. constructor(image: HTMLImageElement | ImageBitmap);
  51662. getImage(): HTMLImageElement | ImageBitmap;
  51663. abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  51664. abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  51665. abstract dispose(): void;
  51666. static filterFromString(text: string): TextureFilter;
  51667. static wrapFromString(text: string): TextureWrap;
  51668. }
  51669. export enum TextureFilter {
  51670. Nearest = 9728,
  51671. Linear = 9729,
  51672. MipMap = 9987,
  51673. MipMapNearestNearest = 9984,
  51674. MipMapLinearNearest = 9985,
  51675. MipMapNearestLinear = 9986,
  51676. MipMapLinearLinear = 9987
  51677. }
  51678. export enum TextureWrap {
  51679. MirroredRepeat = 33648,
  51680. ClampToEdge = 33071,
  51681. Repeat = 10497
  51682. }
  51683. export class TextureRegion {
  51684. renderObject: any;
  51685. u: number;
  51686. v: number;
  51687. u2: number;
  51688. v2: number;
  51689. width: number;
  51690. height: number;
  51691. rotate: boolean;
  51692. offsetX: number;
  51693. offsetY: number;
  51694. originalWidth: number;
  51695. originalHeight: number;
  51696. }
  51697. export class FakeTexture extends Texture {
  51698. setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  51699. setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  51700. dispose(): void;
  51701. }
  51702. export class TextureAtlas implements Disposable {
  51703. pages: TextureAtlasPage[];
  51704. regions: TextureAtlasRegion[];
  51705. constructor(atlasText: string, textureLoader: (path: string) => any);
  51706. findRegion(name: string): TextureAtlasRegion;
  51707. dispose(): void;
  51708. }
  51709. export class TextureAtlasPage {
  51710. name: string;
  51711. minFilter: TextureFilter;
  51712. magFilter: TextureFilter;
  51713. uWrap: TextureWrap;
  51714. vWrap: TextureWrap;
  51715. texture: Texture;
  51716. width: number;
  51717. height: number;
  51718. }
  51719. export class TextureAtlasRegion extends TextureRegion {
  51720. page: TextureAtlasPage;
  51721. name: string;
  51722. x: number;
  51723. y: number;
  51724. index: number;
  51725. rotate: boolean;
  51726. degrees: number;
  51727. texture: Texture;
  51728. }
  51729. export class TransformConstraint implements Updatable {
  51730. data: TransformConstraintData;
  51731. bones: Array<Bone>;
  51732. target: Bone;
  51733. rotateMix: number;
  51734. translateMix: number;
  51735. scaleMix: number;
  51736. shearMix: number;
  51737. active: boolean;
  51738. constructor(data: TransformConstraintData, skeleton: Skeleton);
  51739. isActive(): boolean;
  51740. apply(): void;
  51741. update(): void;
  51742. }
  51743. export class TransformConstraintData extends ConstraintData {
  51744. bones: BoneData[];
  51745. target: BoneData;
  51746. rotateMix: number;
  51747. translateMix: number;
  51748. scaleMix: number;
  51749. shearMix: number;
  51750. offsetRotation: number;
  51751. offsetX: number;
  51752. offsetY: number;
  51753. offsetScaleX: number;
  51754. offsetScaleY: number;
  51755. offsetShearY: number;
  51756. relative: boolean;
  51757. local: boolean;
  51758. constructor(name: string);
  51759. }
  51760. export class Triangulator {
  51761. triangulate(verticesArray: ArrayLike<number>): Array<number>;
  51762. decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
  51763. }
  51764. export abstract class Updatable {
  51765. update(): void;
  51766. isActive(): boolean;
  51767. }
  51768. export interface Map<T> {
  51769. [key: string]: T;
  51770. }
  51771. export class IntSet {
  51772. array: number[];
  51773. add(value: number): boolean;
  51774. contains(value: number): boolean;
  51775. remove(value: number): void;
  51776. clear(): void;
  51777. }
  51778. export interface Disposable {
  51779. dispose(): void;
  51780. }
  51781. export interface Restorable {
  51782. restore(): void;
  51783. }
  51784. export class Color {
  51785. r: number;
  51786. g: number;
  51787. b: number;
  51788. a: number;
  51789. static WHITE: Color;
  51790. static RED: Color;
  51791. static GREEN: Color;
  51792. static BLUE: Color;
  51793. static MAGENTA: Color;
  51794. constructor(r?: number, g?: number, b?: number, a?: number);
  51795. set(r: number, g: number, b: number, a: number): Color;
  51796. setFromColor(c: Color): Color;
  51797. setFromString(hex: string): Color;
  51798. add(r: number, g: number, b: number, a: number): Color;
  51799. clamp(): Color;
  51800. static rgba8888ToColor(color: Color, value: number): void;
  51801. static rgb888ToColor(color: Color, value: number): void;
  51802. }
  51803. export class MathUtils {
  51804. static readonly PI: number;
  51805. static readonly PI2: number;
  51806. static readonly radiansToDegrees: number;
  51807. static readonly radDeg: number;
  51808. static readonly degreesToRadians: number;
  51809. static readonly degRad: number;
  51810. static abs(value: number): number;
  51811. static signum(value: number): number;
  51812. static clamp(value: number, min: number, max: number): number;
  51813. static fmod(a: number, b: number): number;
  51814. static atan2(y: number, x: number): number;
  51815. static cos(radians: number): number;
  51816. static sin(radians: number): number;
  51817. static sqrt(value: number): number;
  51818. static acos(value: number): number;
  51819. static sinDeg(degrees: number): number;
  51820. static cosDeg(degrees: number): number;
  51821. static isNan(value: number): number;
  51822. static random(): number;
  51823. static randomTriangular(min: number, max: number): number;
  51824. static randomTriangularWith(min: number, max: number, mode: number): number;
  51825. static pow(a: number, b: number): number;
  51826. }
  51827. export abstract class Interpolation {
  51828. protected abstract applyInternal(a: number): number;
  51829. apply(start: number, end: number, a: number): number;
  51830. }
  51831. export class Pow extends Interpolation {
  51832. protected power: number;
  51833. constructor(power: number);
  51834. applyInternal(a: number): number;
  51835. }
  51836. export class PowOut extends Pow {
  51837. constructor(power: number);
  51838. applyInternal(a: number): number;
  51839. }
  51840. export class Utils {
  51841. static SUPPORTS_TYPED_ARRAYS: boolean;
  51842. static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number): void;
  51843. static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
  51844. static ensureArrayCapacity<T>(array: Array<T>, size: number, value?: any): Array<T>;
  51845. static newArray<T>(size: number, defaultValue: T): Array<T>;
  51846. static newFloatArray(size: number): ArrayLike<number>;
  51847. static newShortArray(size: number): ArrayLike<number>;
  51848. static toFloatArray(array: Array<number>): number[] | Float32Array;
  51849. static toSinglePrecision(value: number): number;
  51850. static webkit602BugfixHelper(alpha: number, blend: MixBlend): void;
  51851. static contains<T>(array: Array<T>, element: T, identity?: boolean): boolean;
  51852. }
  51853. export class DebugUtils {
  51854. static logBones(skeleton: Skeleton): void;
  51855. }
  51856. export class Pool<T> {
  51857. constructor(instantiator: () => T);
  51858. obtain(): T;
  51859. free(item: T): void;
  51860. freeAll(items: ArrayLike<T>): void;
  51861. clear(): void;
  51862. }
  51863. export class Vector2 {
  51864. x: number;
  51865. y: number;
  51866. constructor(x?: number, y?: number);
  51867. set(x: number, y: number): Vector2;
  51868. length(): number;
  51869. normalize(): Vector2;
  51870. }
  51871. export class TimeKeeper {
  51872. maxDelta: number;
  51873. framesPerSecond: number;
  51874. delta: number;
  51875. totalTime: number;
  51876. update(): void;
  51877. }
  51878. export interface ArrayLike<T> {
  51879. length: number;
  51880. [n: number]: T;
  51881. }
  51882. export class WindowedMean {
  51883. values: Array<number>;
  51884. addedValues: number;
  51885. lastValue: number;
  51886. mean: number;
  51887. dirty: boolean;
  51888. constructor(windowSize?: number);
  51889. hasEnoughData(): boolean;
  51890. addValue(value: number): void;
  51891. getMean(): number;
  51892. }
  51893. export abstract class VertexEffect {
  51894. begin(skeleton: Skeleton): void;
  51895. transform(x: number, y: number): void;
  51896. end(): void;
  51897. }
  51898. // interface Math {
  51899. // fround(n: number): number;
  51900. // }
  51901. export abstract class Attachment {
  51902. name: string;
  51903. constructor(name: string);
  51904. abstract copy(): Attachment;
  51905. }
  51906. export abstract class VertexAttachment extends Attachment {
  51907. id: number;
  51908. bones: Array<number>;
  51909. vertices: ArrayLike<number>;
  51910. worldVerticesLength: number;
  51911. deformAttachment: VertexAttachment;
  51912. constructor(name: string);
  51913. computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  51914. copyTo(attachment: VertexAttachment): void;
  51915. }
  51916. export interface AttachmentLoader {
  51917. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  51918. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  51919. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  51920. newPathAttachment(skin: Skin, name: string): PathAttachment;
  51921. newPointAttachment(skin: Skin, name: string): PointAttachment;
  51922. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  51923. }
  51924. export enum AttachmentType {
  51925. Region = 0,
  51926. BoundingBox = 1,
  51927. Mesh = 2,
  51928. LinkedMesh = 3,
  51929. Path = 4,
  51930. Point = 5,
  51931. Clipping = 6
  51932. }
  51933. export class BoundingBoxAttachment extends VertexAttachment {
  51934. constructor(name: string);
  51935. copy(): Attachment;
  51936. }
  51937. export class ClippingAttachment extends VertexAttachment {
  51938. endSlot: SlotData;
  51939. constructor(name: string);
  51940. copy(): Attachment;
  51941. }
  51942. export class MeshAttachment extends VertexAttachment {
  51943. path: string;
  51944. regionUVs: ArrayLike<number>;
  51945. uvs: ArrayLike<number>;
  51946. triangles: Array<number>;
  51947. color: Color;
  51948. width: number;
  51949. height: number;
  51950. hullLength: number;
  51951. edges: Array<number>;
  51952. constructor(name: string);
  51953. updateUVs(): void;
  51954. getParentMesh(): MeshAttachment;
  51955. setParentMesh(parentMesh: MeshAttachment): void;
  51956. copy(): Attachment;
  51957. newLinkedMesh(): MeshAttachment;
  51958. }
  51959. export class PathAttachment extends VertexAttachment {
  51960. lengths: Array<number>;
  51961. closed: boolean;
  51962. constantSpeed: boolean;
  51963. constructor(name: string);
  51964. copy(): Attachment;
  51965. }
  51966. export class PointAttachment extends VertexAttachment {
  51967. x: number;
  51968. y: number;
  51969. rotation: number;
  51970. constructor(name: string);
  51971. computeWorldPosition(bone: Bone, point: Vector2): Vector2;
  51972. computeWorldRotation(bone: Bone): number;
  51973. copy(): Attachment;
  51974. }
  51975. export class RegionAttachment extends Attachment {
  51976. static OX1: number;
  51977. static OY1: number;
  51978. static OX2: number;
  51979. static OY2: number;
  51980. static OX3: number;
  51981. static OY3: number;
  51982. static OX4: number;
  51983. static OY4: number;
  51984. static X1: number;
  51985. static Y1: number;
  51986. static C1R: number;
  51987. static C1G: number;
  51988. static C1B: number;
  51989. static C1A: number;
  51990. static U1: number;
  51991. static V1: number;
  51992. static X2: number;
  51993. static Y2: number;
  51994. static C2R: number;
  51995. static C2G: number;
  51996. static C2B: number;
  51997. static C2A: number;
  51998. static U2: number;
  51999. static V2: number;
  52000. static X3: number;
  52001. static Y3: number;
  52002. static C3R: number;
  52003. static C3G: number;
  52004. static C3B: number;
  52005. static C3A: number;
  52006. static U3: number;
  52007. static V3: number;
  52008. static X4: number;
  52009. static Y4: number;
  52010. static C4R: number;
  52011. static C4G: number;
  52012. static C4B: number;
  52013. static C4A: number;
  52014. static U4: number;
  52015. static V4: number;
  52016. x: number;
  52017. y: number;
  52018. scaleX: number;
  52019. scaleY: number;
  52020. rotation: number;
  52021. width: number;
  52022. height: number;
  52023. color: Color;
  52024. path: string;
  52025. rendererObject: any;
  52026. region: TextureRegion;
  52027. offset: ArrayLike<number>;
  52028. uvs: ArrayLike<number>;
  52029. tempColor: Color;
  52030. constructor(name: string);
  52031. updateOffset(): void;
  52032. computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  52033. copy(): Attachment;
  52034. }
  52035. export class JitterEffect implements VertexEffect {
  52036. jitterX: number;
  52037. jitterY: number;
  52038. constructor(jitterX: number, jitterY: number);
  52039. begin(skeleton: Skeleton): void;
  52040. transform(x: number, y: number): void;
  52041. end(): void;
  52042. }
  52043. export class SwirlEffect implements VertexEffect {
  52044. static interpolation: PowOut;
  52045. centerX: number;
  52046. centerY: number;
  52047. radius: number;
  52048. angle: number;
  52049. worldX;
  52050. worldY;
  52051. constructor(radius: number, interpolation?: Interpolation);
  52052. begin(skeleton: Skeleton): void;
  52053. transform(x: number, y: number): void;
  52054. end(): void;
  52055. }
  52056. export class SkeletonSystem {
  52057. public static destroySpineInstance(instance: SkeletonInstance): void;
  52058. public static updateAnimation(deltaTime: number): void;
  52059. public static updateRenderData(): void;
  52060. public static getCount(): number;
  52061. }
  52062. export class SkeletonInstance {
  52063. dtRate: number;
  52064. isCache: boolean;
  52065. isDelete: boolean;
  52066. enable: boolean;
  52067. setTrackEntryListener: any;
  52068. destroy();
  52069. initSkeleton(data: SkeletonData);
  52070. getAnimationState();
  52071. setAnimation(trackIndex: number, name: string, loop: boolean): spine.TrackEntry | null;
  52072. setSkin(name: string);
  52073. setPremultipliedAlpha(usePremultipliedAlpha: boolean);
  52074. setColor(r: number, g: number, b: number, a: number);
  52075. setMix(fromName: string, toName: string, duration: number);
  52076. updateAnimation(dt: number);
  52077. setUseTint(useTint: boolean);
  52078. clearEffect();
  52079. setJitterEffect(jitter: spine.VertexEffect);
  52080. setSwirlEffect(swirl: spine.VertexEffect);
  52081. updateRenderData();
  52082. setListener(id: number, type: number);
  52083. setDebugMode(debug: boolean);
  52084. getDebugShapes();
  52085. resizeSlotRegion(slotName: string, width: number, height: number, createNew: boolean);
  52086. setSlotTexture(slotName: string, index: number);
  52087. }
  52088. export class wasmUtil {
  52089. static spineWasmInit(): void;
  52090. static spineWasmDestroy(): void;
  52091. static queryStoreMemory(size: number): number;
  52092. static querySpineSkeletonDataByUUID(uuid: string): SkeletonData;
  52093. static createSpineSkeletonDataWithJson(jsonStr: string, atlasText: string): SkeletonData;
  52094. static createSpineSkeletonDataWithBinary(byteSize: number, atlasText: string): SkeletonData;
  52095. static registerSpineSkeletonDataWithUUID(data: SkeletonData, uuid: string);
  52096. static destroySpineSkeletonDataWithUUID(uuid: string);
  52097. static destroySpineSkeleton(skeleton: Skeleton): void;
  52098. static getCurrentListenerID(): number;
  52099. static getCurrentEventType(): EventType;
  52100. static getCurrentTrackEntry(): TrackEntry;
  52101. static getCurrentEvent(): Event;
  52102. static wasm: any;
  52103. }
  52104. }
  52105. /**
  52106. * @internal Since v3.7.2, this is an engine private type.
  52107. */
  52108. /**
  52109. * @en
  52110. * The attachment type of spine. It contains three type: REGION(0), BOUNDING_BOX(1), MESH(2) and SKINNED_MESH.
  52111. * [REGION] An attachment that displays a textured quadrilateral.
  52112. * [BOUNDING_BOX] An attachment with vertices that make up a polygon. Can be used for hit detection,
  52113. * creating physics bodies, spawning particle effects, and more.
  52114. * [MESH] An attachment that displays a textured mesh.
  52115. * [SKINNED_MESH] No used any more.
  52116. * @zh
  52117. * Attachment 类型枚举。类型包括 REGION, BOUNDING_BOX, MESH, SKINNED_MESH。
  52118. * [REGION] 一个用于显示 texture 四边形的附件。
  52119. * [BOUNDING_BOX] 一个带有顶点的附件。顶点构成的多边形可用于碰撞检测,创建物理实体,生成粒子特效等等。
  52120. * [MESH] 一个可以显示 texture 网格的附件。
  52121. * [SKINNED_MESH] 已废弃。
  52122. */
  52123. export enum ATTACHMENT_TYPE {
  52124. REGION = 0,
  52125. BOUNDING_BOX = 1,
  52126. MESH = 2,
  52127. SKINNED_MESH = 3
  52128. }
  52129. /**
  52130. * @en The event type of spine skeleton animation.
  52131. * @zh 骨骼动画事件类型。
  52132. * @enum AnimationEventType
  52133. */
  52134. export enum AnimationEventType {
  52135. /**
  52136. * @en The play spine skeleton animation start type.
  52137. * @zh 开始播放骨骼动画。
  52138. * @property {Number} START
  52139. */
  52140. START = 0,
  52141. /**
  52142. * @en Another entry has replaced this entry as the current entry. This entry may continue being applied for mixing.
  52143. * @zh 当前的 entry 被其他的 entry 替换。当使用 mixing 时,当前的 entry 会继续运行。
  52144. */
  52145. INTERRUPT = 1,
  52146. /**
  52147. * @en The play spine skeleton animation finish type.
  52148. * @zh 播放骨骼动画结束。
  52149. * @property {Number} END
  52150. */
  52151. END = 2,
  52152. /**
  52153. * @en The entry will be disposed.
  52154. * @zh entry 将被销毁。
  52155. */
  52156. DISPOSE = 3,
  52157. /**
  52158. * @en The play spine skeleton animation complete type.
  52159. * @zh 播放骨骼动画完成。
  52160. * @property {Number} COMPLETE
  52161. */
  52162. COMPLETE = 4,
  52163. /**
  52164. * @en The spine skeleton animation event type.
  52165. * @zh 骨骼动画事件。
  52166. * @property {Number} EVENT
  52167. */
  52168. EVENT = 5
  52169. }
  52170. /**
  52171. * @en
  52172. * Animation playback rate.
  52173. * @zh
  52174. * 动画播放速率。
  52175. */
  52176. export const timeScale = 1;
  52177. /**
  52178. * @en Enum for animation cache mode type.
  52179. * @zh Spine 动画缓存类型。
  52180. */
  52181. export enum AnimationCacheMode {
  52182. /**
  52183. * @en Unset mode.
  52184. * @zh 未设置模式。
  52185. */
  52186. UNSET = "Bad expression <-1>",
  52187. /**
  52188. * @en The realtime mode.
  52189. * @zh 实时计算模式。
  52190. */
  52191. REALTIME = 0,
  52192. /**
  52193. * @en The shared cache mode.
  52194. * @zh 共享缓存模式。
  52195. */
  52196. SHARED_CACHE = 1,
  52197. /**
  52198. * @en The private cache mode.
  52199. * @zh 私有缓存模式。
  52200. */
  52201. PRIVATE_CACHE = 2
  52202. }
  52203. export interface TempColor {
  52204. r: number;
  52205. g: number;
  52206. b: number;
  52207. a: number;
  52208. }
  52209. /**
  52210. * @en
  52211. * The Sockets attached to bones, synchronous transform with spine animation.
  52212. * @zh
  52213. * Spine 挂点,可附着在目标骨骼上随 spine 动画一起运动。
  52214. * @class SpineSocket
  52215. */
  52216. export class SpineSocket {
  52217. /**
  52218. * @en Path of the target joint.
  52219. * @zh 此挂点的目标骨骼路径。
  52220. */
  52221. path: string;
  52222. /**
  52223. * @en Transform output node.
  52224. * @zh 此挂点的变换信息输出节点。
  52225. */
  52226. target: Node | null;
  52227. constructor(path?: string, target?: Node | null);
  52228. }
  52229. /**
  52230. * @en
  52231. * The skeleton of Spine <br/>
  52232. * <br/>
  52233. * (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  52234. * which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  52235. * Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  52236. * Cocos Creator supports spine versions lower than 3.8.99.
  52237. * @zh
  52238. * Spine 骨骼动画 <br/>
  52239. * <br/>
  52240. * (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  52241. * 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  52242. * 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。
  52243. * Cocos Creator 支持 spine 版本最高到3.8.99。
  52244. * @class Skeleton
  52245. * @extends UIRenderer
  52246. */
  52247. export class Skeleton extends UIRenderer {
  52248. static SpineSocket: typeof SpineSocket;
  52249. static AnimationCacheMode: typeof AnimationCacheMode;
  52250. protected _skeletonData: SkeletonData | null;
  52251. protected defaultSkin: string;
  52252. protected defaultAnimation: string;
  52253. /**
  52254. * @en Indicates whether to enable premultiplied alpha.
  52255. * You should disable this option when image's transparent area appears to have opaque pixels,
  52256. * or enable this option when image's half transparent area appears to be darken.
  52257. * @zh 是否启用贴图预乘。
  52258. * 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。
  52259. */
  52260. protected _premultipliedAlpha: boolean;
  52261. protected _timeScale: number;
  52262. protected _preCacheMode: AnimationCacheMode;
  52263. protected _cacheMode: AnimationCacheMode;
  52264. protected _sockets: SpineSocket[];
  52265. protected _useTint: boolean;
  52266. protected _debugMesh: boolean;
  52267. protected _debugBones: boolean;
  52268. protected _debugSlots: boolean;
  52269. protected _enableBatch: boolean;
  52270. protected _runtimeData: spine.SkeletonData | null;
  52271. _skeleton: spine.Skeleton;
  52272. protected _instance: spine.SkeletonInstance | null;
  52273. protected _state: spine.AnimationState;
  52274. protected _textures: Texture2D[];
  52275. protected _animationName: string;
  52276. protected _skinName: string;
  52277. protected _drawList: memop.RecyclePool<__private._cocos_spine_skeleton__SkeletonDrawData>;
  52278. protected _materialCache: {
  52279. [key: string]: renderer.MaterialInstance;
  52280. };
  52281. paused: boolean;
  52282. protected _enumSkins: __private._cocos_core_value_types_enum__EnumType;
  52283. protected _enumAnimations: __private._cocos_core_value_types_enum__EnumType;
  52284. protected attachUtil: __private._cocos_spine_attach_util__AttachUtil;
  52285. protected _socketNodes: Map<number, Node>;
  52286. protected _cachedSockets: Map<string, number>;
  52287. protected _paused: boolean;
  52288. protected _accTime: number;
  52289. protected _playCount: number;
  52290. protected _skeletonCache: __private._cocos_spine_skeleton_cache__SkeletonCache | null;
  52291. protected _animCache: __private._cocos_spine_skeleton_cache__AnimationCache | null;
  52292. protected _animationQueue: __private._cocos_spine_skeleton__AnimationItem[];
  52293. protected _headAniInfo: __private._cocos_spine_skeleton__AnimationItem | null;
  52294. protected _isAniComplete: boolean;
  52295. protected _playTimes: number;
  52296. protected _needUpdateSkeltonData: boolean;
  52297. protected _listener: __private._cocos_spine_track_entry_listeners__TrackEntryListeners | null;
  52298. _vLength: number;
  52299. _vBuffer: Uint8Array | null;
  52300. _iLength: number;
  52301. _iBuffer: Uint8Array | null;
  52302. _model: any;
  52303. _tempColor: TempColor;
  52304. constructor();
  52305. /**
  52306. * @en
  52307. * The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  52308. * attachments, skins, etc) and animations but does not hold any state.<br/>
  52309. * Multiple skeletons can share the same skeleton data.
  52310. * @zh
  52311. * 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  52312. * attachments,皮肤等等)和动画但不持有任何状态。<br/>
  52313. * 多个 Skeleton 可以共用相同的骨骼数据。
  52314. * @property {sp.SkeletonData} skeletonData
  52315. */
  52316. get skeletonData(): SkeletonData | null;
  52317. set skeletonData(value: SkeletonData | null);
  52318. /**
  52319. * @en Animation mode, with options for real-time mode, private cached, or public cached mode.
  52320. * @zh 动画模式,可选实时模式,私有 cached 或公共 cached 模式。
  52321. */
  52322. get defaultCacheMode(): AnimationCacheMode;
  52323. set defaultCacheMode(mode: AnimationCacheMode);
  52324. /**
  52325. * @en Whether premultipliedAlpha enabled.
  52326. * @zh 是否启用 alpha 预乘。
  52327. */
  52328. get premultipliedAlpha(): boolean;
  52329. set premultipliedAlpha(v: boolean);
  52330. /**
  52331. * @en Whether play animations in loop mode.
  52332. * @zh 是否循环播放当前骨骼动画。
  52333. */
  52334. loop: boolean;
  52335. /**
  52336. * @en The time scale of this skeleton.
  52337. * @zh 当前骨骼中所有动画的时间缩放率。
  52338. */
  52339. get timeScale(): number;
  52340. set timeScale(value: number);
  52341. /**
  52342. * @en Enabled two color tint.
  52343. * @zh 是否启用染色效果。
  52344. */
  52345. get useTint(): boolean;
  52346. set useTint(value: boolean);
  52347. /**
  52348. * @en If rendering a large number of identical textures and simple skeletal animations,
  52349. * enabling batching can reduce the number of draw calls and improve rendering performance.
  52350. * @zh 如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低 draw call 数量提升渲染性能。
  52351. */
  52352. get enableBatch(): boolean;
  52353. set enableBatch(value: boolean);
  52354. /**
  52355. * @en
  52356. * The bone sockets this animation component maintains.<br>
  52357. * A SpineSocket object contains a path reference to bone, and a target node.
  52358. * @zh
  52359. * 当前动画组件维护的挂点数组。一个挂点组件包括动画节点路径和目标节点。
  52360. */
  52361. get sockets(): SpineSocket[];
  52362. set sockets(val: SpineSocket[]);
  52363. /**
  52364. * @en Indicates whether open debug slots.
  52365. * @zh 是否显示 slot 的 debug 信息。
  52366. */
  52367. get debugSlots(): boolean;
  52368. set debugSlots(v: boolean);
  52369. /**
  52370. * @en Indicates whether open debug bones.
  52371. * @zh 是否显示 bone 的 debug 信息。
  52372. */
  52373. get debugBones(): boolean;
  52374. set debugBones(v: boolean);
  52375. /**
  52376. * @en Indicates whether open debug mesh.
  52377. * @zh 是否显示 mesh 的 debug 信息。
  52378. */
  52379. get debugMesh(): boolean;
  52380. set debugMesh(value: boolean);
  52381. get socketNodes(): Map<number, Node> | null;
  52382. /**
  52383. * @en The name of current playing animation.
  52384. * @zh 当前播放的动画名称。
  52385. * @property {String} animation
  52386. */
  52387. get animation(): string;
  52388. set animation(value: string);
  52389. /**
  52390. * @en The customMaterial。
  52391. * @zh 用户自定材质。
  52392. */
  52393. get customMaterial(): Material | null;
  52394. set customMaterial(val: Material | null);
  52395. __preload(): void;
  52396. /**
  52397. * @en Gets the animation state object.
  52398. * @zh 获取动画状态。
  52399. * @method getState
  52400. * @return {sp.spine.AnimationState} state
  52401. */
  52402. getState(): spine.AnimationState | undefined;
  52403. /**
  52404. * @en Be called when component state becomes available.
  52405. * @zh 组件状态变为可用时调用。
  52406. */
  52407. onEnable(): void;
  52408. /**
  52409. * @en Be called when component state becomes disabled.
  52410. * @zh 组件状态变为禁用状态时调用。
  52411. */
  52412. onDisable(): void;
  52413. onDestroy(): void;
  52414. /**
  52415. * @en Clear animation and set to setup pose, default value of track index is 0.
  52416. * @zh 清除指定动画并还原到初始姿势, 默认清除 track索引 为0的动画。
  52417. * @param {NUmber} [trackIndex] @en track index. @zh track 的索引。
  52418. */
  52419. clearAnimation(trackIndex?: number): void;
  52420. /**
  52421. * @en Clear all animations and set to setup pose.
  52422. * @zh 清除所有动画并还原到初始姿势。
  52423. */
  52424. clearAnimations(): void;
  52425. protected _updateSkeletonData(): void;
  52426. /**
  52427. * @en
  52428. * Sets runtime skeleton data to sp.Skeleton.<br>
  52429. * This method is different from the `skeletonData` property. This method is passed in the raw data provided by the
  52430. * Spine runtime, and the skeletonData type is the asset type provided by Creator.
  52431. * @zh
  52432. * 设置底层运行时用到的 SkeletonData。<br>
  52433. * 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  52434. * @param skeletonData @en The skeleton data contains the skeleton information (bind pose bones, slots, draw order, attachments,
  52435. * skins, etc) and animations but does not hold any state. @zh 骨架数据(SkeletonData)包含骨架信息(绑定pose的骨骼、槽位、绘制顺序、附件、
  52436. * 皮肤等)和动画, 但不保存任何状态。
  52437. */
  52438. setSkeletonData(skeletonData: spine.SkeletonData): void;
  52439. /**
  52440. * @en Sets slots visible range.
  52441. * @zh 设置骨骼插槽可视范围。
  52442. * @param {Number} startSlotIndex @en start slot index. @zh 开始插槽的索引。
  52443. * @param {Number} endSlotIndex @en end slot index. @zh 结束插槽的索引。
  52444. */
  52445. setSlotsRange(startSlotIndex: number, endSlotIndex: number): void;
  52446. /**
  52447. * @en
  52448. * Returns the attachment for the slot and attachment name.
  52449. * The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  52450. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  52451. * @zh
  52452. * 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  52453. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  52454. *
  52455. * @method getAttachment
  52456. * @param {String} slotName @en slot name. @zh 插槽的名字。
  52457. * @param {String} attachmentName @en attachment name. @en 附件的名称。
  52458. * @return {sp.spine.Attachment}
  52459. */
  52460. getAttachment(slotName: string, attachmentName: string): spine.Attachment | null;
  52461. /**
  52462. * @en
  52463. * Sets the attachment for the slot and attachment name.
  52464. * The skeleton looks first in its skin, then in the skeleton data’s default skin.
  52465. * @zh
  52466. * 通过 slot 和 attachment 的名字来设置 attachment。
  52467. * Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  52468. * @method setAttachment
  52469. * @param {String} slotName @en slot name. @zh 插槽的名字。
  52470. * @param {String} attachmentName @en attachment name. @en 附件的名称。
  52471. */
  52472. setAttachment(slotName: string, attachmentName: string): void;
  52473. /**
  52474. * @en
  52475. * Get Texture Atlas used in attachments.
  52476. * @zh
  52477. * 获取附件图集。
  52478. * @param regionAttachment @en An attachment type of RegionAttachment or BoundingBoxAttachment. @zh RegionAttachment 或 BoundingBoxAttachment 的附件。
  52479. * @return @en TextureRegion contains texture and atlas text information. @zh TextureRegion包含纹理和图集文本信息。
  52480. */
  52481. getTextureAtlas(regionAttachment: spine.RegionAttachment | spine.BoundingBoxAttachment): spine.TextureRegion;
  52482. /**
  52483. * @en Set the current animation. Any queued animations are cleared.<br>
  52484. * @zh 设置当前动画。队列中的任何的动画将被清除。<br>
  52485. * @param trackIndex @en Index of track. @zh 动画通道索引。
  52486. * @param name @en The name of animation. @zh 动画名称。
  52487. * @param loop @en Use loop mode or not. @zh 是否使用循环播放模式。
  52488. */
  52489. setAnimation(trackIndex: number, name: string, loop?: boolean): spine.TrackEntry | null;
  52490. /**
  52491. * @en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  52492. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  52493. * @zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  52494. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  52495. * @param trackIndex @en Index of trackEntry. @zh TrackEntry 索引。
  52496. * @param name @en The name of animation. @zh 动画名称。
  52497. * @param loop @en Set play animation in a loop. @zh 是否循环播放。
  52498. * @param delay @en Delay time of animation start. @zh 动画开始的延迟时间。
  52499. * @return {sp.spine.TrackEntry}
  52500. */
  52501. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): spine.TrackEntry | null;
  52502. /**
  52503. * @en Find animation with specified name.
  52504. * @zh 查找指定名称的动画
  52505. * @param name @en The name of animation. @zh 动画名称。
  52506. * @returns {sp.spine.Animation}
  52507. */
  52508. findAnimation(name: string): spine.Animation | null;
  52509. /**
  52510. * @en Returns track entry by trackIndex.<br>
  52511. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  52512. * @zh 通过 track 索引获取 TrackEntry。<br>
  52513. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  52514. * @param trackIndex @en The index of trackEntry. @zh TrackEntry 索引。
  52515. * @return {sp.spine.TrackEntry}
  52516. */
  52517. getCurrent(trackIndex: number): spine.TrackEntry | null;
  52518. /**
  52519. * @en
  52520. * Finds a skin by name and makes it the active skin.
  52521. * This does a string comparison for every skin.<br>
  52522. * Note that setting the skin does not change which attachments are visible.<br>
  52523. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  52524. * @zh
  52525. * 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  52526. * 注意:设置皮肤不会改变 attachment 的可见性。<br>
  52527. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  52528. *
  52529. * @param skinName @en The name of skin. @zh 皮肤名称。
  52530. */
  52531. setSkin(name: string): void;
  52532. /**
  52533. * @en Update skeleton animation.
  52534. * @zh 更新骨骼动画。
  52535. * @param dt @en delta time. @zh 时间差。
  52536. */
  52537. updateAnimation(dt: number): void;
  52538. protected _updateCache(dt: number): void;
  52539. protected _emitCacheCompleteEvent(): void;
  52540. protected _flushAssembler(): void;
  52541. protected _render(batcher: UI): void;
  52542. protected _updateBuiltinMaterial(): Material;
  52543. protected _updateAnimEnum(): void;
  52544. protected _updateSkinEnum(): void;
  52545. protected _refreshInspector(): void;
  52546. /**
  52547. * @en Call this method to destroy the rendering data.
  52548. * @zh 调用该方法销毁渲染数据。
  52549. */
  52550. destroyRenderData(): void;
  52551. protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  52552. /**
  52553. * @en Mark to re-update the rendering data, usually used to force refresh the display.
  52554. * @zh 标记重新更新渲染数据,一般用于强制刷新显示。
  52555. */
  52556. markForUpdateRenderData(enable?: boolean): void;
  52557. /**
  52558. * @en Whether in cached mode.
  52559. * @zh 当前是否处于缓存模式。
  52560. */
  52561. isAnimationCached(): boolean;
  52562. /**
  52563. * @en
  52564. * It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  52565. * If set the mode in editor, then no need to worry about order problem.
  52566. * @zh
  52567. * 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  52568. * 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  52569. *
  52570. * @example
  52571. * skeleton.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
  52572. */
  52573. setAnimationCacheMode(cacheMode: AnimationCacheMode): void;
  52574. /**
  52575. * @en Sets the bones and slots to the setup pose.
  52576. * @zh 还原到起始动作。
  52577. */
  52578. setToSetupPose(): void;
  52579. /**
  52580. * @en
  52581. * Sets the bones to the setup pose,
  52582. * using the values from the `BoneData` list in the `SkeletonData`.
  52583. * @zh
  52584. * 设置 bone 到起始动作。
  52585. * 使用 SkeletonData 中的 BoneData 列表中的值。
  52586. */
  52587. setBonesToSetupPose(): void;
  52588. /**
  52589. * @en
  52590. * Sets the slots to the setup pose,
  52591. * using the values from the `SlotData` list in the `SkeletonData`.
  52592. * @zh
  52593. * 设置 slot 到起始动作。
  52594. * 使用 SkeletonData 中的 SlotData 列表中的值。
  52595. */
  52596. setSlotsToSetupPose(): void;
  52597. /**
  52598. * @en
  52599. * Invalidates the animation cache, which is then recomputed on each frame.
  52600. * @zh
  52601. * 使动画缓存失效,之后会在每帧重新计算。
  52602. * @method invalidAnimationCache
  52603. */
  52604. invalidAnimationCache(): void;
  52605. /**
  52606. * @en
  52607. * Finds a bone by name.
  52608. * This does a string comparison for every bone.<br>
  52609. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  52610. * @zh
  52611. * 通过名称查找 bone。
  52612. * 这里对每个 bone 的名称进行了对比。<br>
  52613. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  52614. *
  52615. * @param boneName @en The name of bone. @zh 骨骼名称。
  52616. */
  52617. findBone(boneName: string): spine.Bone | null;
  52618. /**
  52619. * @en
  52620. * Finds a slot by name. This does a string comparison for every slot.<br>
  52621. * Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  52622. * @zh
  52623. * 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  52624. * 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  52625. *
  52626. * @param slotName @en The name of slot. @zh 插槽名称。
  52627. */
  52628. findSlot(slotName: string): spine.Slot | null;
  52629. /**
  52630. * @en
  52631. * Mix applies all keyframe values,
  52632. * interpolated for the specified time and mixed with the current values.
  52633. * @zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  52634. * @param fromAnimation @en Mix start animation. @zh 过渡起始动画。
  52635. * @param toAnimation @en Mix end animation. @zh 过渡结束动画。
  52636. * @param duration @ Time of animation mix. @zh 动画过渡时间。
  52637. */
  52638. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  52639. /**
  52640. * @en Clears all tracks of animation state.
  52641. * @zh 清除所有 track 的动画状态。
  52642. */
  52643. clearTracks(): void;
  52644. /**
  52645. * @en Clears track of animation state by trackIndex.
  52646. * @zh 清除出指定 track 的动画状态。
  52647. * @param trackIndex @en Index of track. @zh 动画通道索引。
  52648. */
  52649. clearTrack(trackIndex: number): void;
  52650. /**
  52651. * @en Computes the world SRT from the local SRT for each bone.
  52652. * @zh 重新更新所有骨骼的世界 Transform,
  52653. * 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  52654. * @example
  52655. * var bone = spine.findBone('head');
  52656. * cc.log(bone.worldX); // return 0;
  52657. * spine.updateWorldTransform();
  52658. * bone = spine.findBone('head');
  52659. * cc.log(bone.worldX); // return -23.12;
  52660. */
  52661. protected updateWorldTransform(): void;
  52662. protected _updateSocketBindings(): void;
  52663. protected _indexBoneSockets(): void;
  52664. /**
  52665. * @en Query all bones that can attach sockets.
  52666. * @zh 查询所有可以添加挂点的所有骨骼。
  52667. * @return String typed array of bones's path.
  52668. */
  52669. querySockets(): string[];
  52670. protected _updateUseTint(): void;
  52671. protected _updateBatch(): void;
  52672. protected _updateDebugDraw(): void;
  52673. /**
  52674. * @en Sets vertex effect delegate.
  52675. * @zh 设置顶点特效动画代理。
  52676. * @param effectDelegate @en Vertex effect delegate. @zh 顶点特效代理。
  52677. */
  52678. setVertexEffectDelegate(effectDelegate: VertexEffectDelegate | null | undefined): void;
  52679. protected _ensureListener(): void;
  52680. /**
  52681. * @en Sets the start event listener.
  52682. * @zh 用来设置开始播放动画的事件监听。
  52683. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52684. */
  52685. setStartListener(listener: __private._cocos_spine_skeleton__TrackListener): void;
  52686. /**
  52687. * @en Sets the interrupt event listener.
  52688. * @zh 用来设置动画被打断的事件监听。
  52689. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52690. */
  52691. setInterruptListener(listener: __private._cocos_spine_skeleton__TrackListener): void;
  52692. /**
  52693. * @en Sets the end event listener.
  52694. * @zh 用来设置动画播放完后的事件监听。
  52695. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52696. */
  52697. setEndListener(listener: __private._cocos_spine_skeleton__TrackListener): void;
  52698. /**
  52699. * @en Sets the dispose event listener.
  52700. * @zh 用来设置动画将被销毁的事件监听。
  52701. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52702. */
  52703. setDisposeListener(listener: __private._cocos_spine_skeleton__TrackListener): void;
  52704. /**
  52705. * @en Sets the complete event listener.
  52706. * @zh 用来设置动画播放一次循环结束后的事件监听。
  52707. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52708. */
  52709. setCompleteListener(listener: __private._cocos_spine_skeleton__TrackListener): void;
  52710. /**
  52711. * @en Sets the animation event listener.
  52712. * @zh 用来设置动画播放过程中帧事件的监听。
  52713. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52714. */
  52715. setEventListener(listener: __private._cocos_spine_skeleton__TrackListener2): void;
  52716. /**
  52717. * @en Sets the start event listener for specified TrackEntry.
  52718. * @zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  52719. * @param entry @en Animation track entry. @zh Track entry。
  52720. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52721. */
  52722. setTrackStartListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener): void;
  52723. /**
  52724. * @en Sets the interrupt event listener for specified TrackEntry.
  52725. * @zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  52726. * @param entry
  52727. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52728. */
  52729. setTrackInterruptListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener): void;
  52730. /**
  52731. * @en Sets the end event listener for specified TrackEntry.
  52732. * @zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  52733. * @param entry
  52734. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52735. */
  52736. setTrackEndListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener): void;
  52737. /**
  52738. * @en Sets the dispose event listener for specified TrackEntry.
  52739. * @zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  52740. * @param entry
  52741. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52742. */
  52743. setTrackDisposeListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener): void;
  52744. /**
  52745. * @en Sets the complete event listener for specified TrackEntry.
  52746. * @zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  52747. * @param entry @en AnimationState track. @zn 动画轨道属性。
  52748. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52749. */
  52750. setTrackCompleteListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener2): void;
  52751. /**
  52752. * @en Sets the event listener for specified TrackEntry.
  52753. * @zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  52754. * @param entry
  52755. * @param listener @en Listener for registering callback functions. @zh 监听器对象,可注册回调方法。
  52756. */
  52757. setTrackEventListener(entry: spine.TrackEntry, listener: __private._cocos_spine_skeleton__TrackListener | __private._cocos_spine_skeleton__TrackListener2): void;
  52758. /**
  52759. * @en Set texture for slot, this function can be use to changing local skin.
  52760. * @zh 为 slot 设置贴图纹理,可使用该该方法实现局部换装功能。
  52761. * @param slotName @en The name of slot. @zh Slot 名字。
  52762. * @param tex2d @en The texture will show on the slot. @zh 在该 Slot 上显示的 2D 纹理。
  52763. * @param createNew @en Whether to create new Attachment. If value is false, all sp.Skeleton share the
  52764. * same attachment will be changed. @zh 是否需要创建新的 attachment,如果值为 false, 所有共享相同 attachment
  52765. * 的组件都将受影响。
  52766. */
  52767. setSlotTexture(slotName: string, tex2d: Texture2D, createNew?: boolean): void;
  52768. protected _applyLayer(): void;
  52769. }
  52770. /**
  52771. * @en The skeleton data of spine.
  52772. * @zh Spine 的骨骼数据。
  52773. * @class SkeletonData
  52774. * @extends Asset
  52775. */
  52776. export class SkeletonData extends Asset {
  52777. /**
  52778. * @en See http://en.esotericsoftware.com/spine-json-format
  52779. * @zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format
  52780. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  52781. */
  52782. _skeletonJson: spine.SkeletonJson | null;
  52783. /**
  52784. * @en A string parsed from the _skeletonJson.
  52785. * @zh 从 _skeletonJson 中解析出的字符串。
  52786. */
  52787. get skeletonJsonStr(): string;
  52788. /**
  52789. * @en See http://en.esotericsoftware.com/spine-json-format
  52790. * @zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format
  52791. */
  52792. get skeletonJson(): spine.SkeletonJson;
  52793. set skeletonJson(value: spine.SkeletonJson);
  52794. /**
  52795. * @en An atlas text description.
  52796. * @zh Atlas 文本描述。
  52797. */
  52798. get atlasText(): string;
  52799. set atlasText(value: string);
  52800. /**
  52801. * @en Texture array.
  52802. * @zh 纹理数组。
  52803. */
  52804. textures: Texture2D[];
  52805. /**
  52806. * @en Texture name array.
  52807. * @zh 纹理名称数组。
  52808. * @private
  52809. */
  52810. textureNames: string[];
  52811. /**
  52812. * @en
  52813. * A scale can be specified on the JSON or binary loader which will scale the bone positions,
  52814. * image sizes, and animation translations.
  52815. * This can be useful when using different sized images than were used when design ing the skeleton
  52816. * in Spine. For example, if using images that are half the size than were used in Spine,
  52817. * a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  52818. * resolution texture atlases.
  52819. * see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  52820. * @zh 在 JSON 或二进制加载器上可以指定一个缩放比例,该缩放比例将缩放骨头位置、图像大小和动画平移。
  52821. * 这在使用与 Spine 中设计骨架不同大小的图像时非常有用。例如,如果使用的图像大小是 Spine 中使用的
  52822. * 图像大小的一半,可以使用 0.5 的缩放比例。这在游戏中经常使用,因为游戏可以使用低分辨率或高分辨率
  52823. * 的纹理图集。可查看 Spine 官方文档:
  52824. * http://zh.esotericsoftware.com/spine-using-runtimes#Scaling
  52825. */
  52826. scale: number;
  52827. /**
  52828. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  52829. */
  52830. get _nativeAsset(): ArrayBuffer;
  52831. set _nativeAsset(bin: ArrayBuffer);
  52832. /**
  52833. * @en A string describing atlas.
  52834. * @zh 描述图集信息的字符串。
  52835. */
  52836. protected _atlasText: string;
  52837. constructor();
  52838. /**
  52839. * @internal
  52840. * @deprecated Since v3.7.2, this is an engine private interface that will be removed in the future.
  52841. */
  52842. createNode(callback: (err: Error | null, node: Node) => void): void;
  52843. /**
  52844. * @en Resets skeleton data state.
  52845. * @zh 重置数据。
  52846. */
  52847. reset(): void;
  52848. /**
  52849. * @internal Since v3.7.2, this is an engine private function, only works in editor.
  52850. * @en Reset skeleton skin and animation enumeration.
  52851. * @zh 重置皮肤和动画枚举。
  52852. */
  52853. resetEnums(): void;
  52854. /**
  52855. * @en Gets the included SkeletonData used in spine runtime.<br>
  52856. * Returns a sp.spine.SkeletonData object.
  52857. * @zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  52858. * 返回一个 p.spine.SkeletonData 对象。
  52859. * @param quiet @en If vaulue is false, feedback information will be printed when an error occurs.
  52860. * @zh 值为 false 时,当发生错误时将打印出反馈信息。
  52861. */
  52862. getRuntimeData(quiet?: boolean): spine.SkeletonData | null;
  52863. /**
  52864. * @internal Since v3.7.2, this is an engine private function, it only works in editor.
  52865. */
  52866. getSkinsEnum(): {
  52867. [key: string]: number;
  52868. } | null;
  52869. /**
  52870. * @internal Since v3.7.2, this is an engine private function, it only works in editor.
  52871. */
  52872. getAnimsEnum(): {
  52873. [key: string]: number;
  52874. } | null;
  52875. /**
  52876. * @en Destroy skeleton data.
  52877. * @zh 销毁 skeleton data。
  52878. */
  52879. destroy(): boolean;
  52880. }
  52881. /**
  52882. * @en
  52883. * The delegate of spine vertex effect.
  52884. * @zh
  52885. * Spine 顶点动画代理。
  52886. * @class VertexEffectDelegate
  52887. */
  52888. export class VertexEffectDelegate {
  52889. /**
  52890. * @internal
  52891. * @deprecated Since v3.7.2, this is an engine private variable that will be removed in the future.
  52892. */
  52893. name: string;
  52894. /**
  52895. * @en Spine vertex effect object instance.
  52896. * @zh Spine 顶点特效对象实例。
  52897. */
  52898. _vertexEffect: spine.VertexEffect;
  52899. constructor();
  52900. /**
  52901. * @en Clears vertex effect.
  52902. * @zh 清空顶点特效。
  52903. */
  52904. clear(): void;
  52905. /**
  52906. * @en Inits delegate with jitter effect.
  52907. * @zh 设置顶点抖动特效。
  52908. * @param {Number} jitterX
  52909. * @param {Number} jitterY
  52910. * @return {spine.VertexEffect} @en Return a vertex effect type of jitter. @zh 返回一个 jitter 类型的顶点特效对象实例。
  52911. */
  52912. initJitter(jitterX: number, jitterY: number): spine.VertexEffect;
  52913. /**
  52914. * @en Inits delegate with swirl effect.
  52915. * @zh 设置顶点漩涡特效。
  52916. * @method initSwirlWithPow
  52917. * @param {Number} radius
  52918. * @param {Number} power
  52919. * @return {sp.spine.JitterEffect} @en Return a vertex effect type of swirl. @zh 返回一个 swirl 类型的顶点特效对象实例。
  52920. */
  52921. initSwirlWithPow(radius: number, power: number): spine.VertexEffect;
  52922. /**
  52923. * @en Inits delegate with swirl effect.
  52924. * @zh 设置顶点漩涡特效。
  52925. * @method initSwirlWithPowOut
  52926. * @param {Number} radius
  52927. * @param {Number} power
  52928. * @return {sp.spine.SwirlEffect} @en Return a vertex effect type of swirl. @zh 返回一个 swirl 类型的顶点特效对象实例。
  52929. */
  52930. initSwirlWithPowOut(radius: number, power: number): spine.VertexEffect;
  52931. /**
  52932. * @en Gets jitter vertex effect.
  52933. * @zh 获取顶点抖动特效。
  52934. * @method getJitterVertexEffect
  52935. * @return {sp.spine.JitterEffect}
  52936. */
  52937. getJitterVertexEffect(): spine.VertexEffect;
  52938. /**
  52939. * @en Gets swirl vertex effect.
  52940. * @zh 获取顶点漩涡特效。
  52941. * @method getSwirlVertexEffect
  52942. * @return {sp.spine.SwirlEffect}
  52943. */
  52944. getSwirlVertexEffect(): spine.VertexEffect;
  52945. /**
  52946. * @en Gets vertex effect.
  52947. * @zh 获取顶点特效。
  52948. * @method getVertexEffect
  52949. * @return {sp.spine.JitterEffect|sp.spine.SwirlEffect}
  52950. */
  52951. getVertexEffect(): spine.VertexEffect;
  52952. /**
  52953. * @en Gets effect type.
  52954. * @zh 获取特效类型。
  52955. * @method getEffectType
  52956. * @return {String}
  52957. */
  52958. getEffectType(): string;
  52959. }
  52960. /**
  52961. * @internal Since v3.7.2 this is an engine private object.
  52962. */
  52963. export const simpleSpineAssembler: IAssemblerManager;
  52964. }
  52965. export class HeightField {
  52966. data: Uint16Array;
  52967. w: number;
  52968. h: number;
  52969. constructor(w: number, h: number);
  52970. set(i: number, j: number, value: number): void;
  52971. get(i: number, j: number): number;
  52972. getClamp(i: number, j: number): number;
  52973. getAt(x: number, y: number): number;
  52974. }
  52975. /**
  52976. * @en Terrain info
  52977. * @zh 地形信息
  52978. */
  52979. export class TerrainInfo {
  52980. /**
  52981. * @en tile size
  52982. * @zh 栅格大小
  52983. */
  52984. tileSize: number;
  52985. /**
  52986. * @en block count
  52987. * @zh 地形块的数量
  52988. */
  52989. blockCount: number[];
  52990. /**
  52991. * @en weight map size
  52992. * @zh 权重图大小
  52993. */
  52994. weightMapSize: number;
  52995. /**
  52996. * @en light map size
  52997. * @zh 光照图大小
  52998. */
  52999. lightMapSize: number;
  53000. /**
  53001. * @en terrain size
  53002. * @zh 地形大小
  53003. */
  53004. get size(): math.Size;
  53005. /**
  53006. * @en tile count
  53007. * @zh 栅格数量
  53008. */
  53009. get tileCount(): number[];
  53010. /**
  53011. * @en vertex count
  53012. * @zh 顶点数量
  53013. */
  53014. get vertexCount(): number[];
  53015. }
  53016. /**
  53017. * @en Terrain layer
  53018. * @zh 地形纹理层
  53019. */
  53020. export class TerrainLayer {
  53021. /**
  53022. * @en detail texture
  53023. * @zh 细节纹理
  53024. */
  53025. detailMap: Texture2D | null;
  53026. /**
  53027. * @en normal texture
  53028. * @zh 法线纹理
  53029. */
  53030. normalMap: Texture2D | null;
  53031. /**
  53032. * @en tile size
  53033. * @zh 平铺大小
  53034. */
  53035. tileSize: number;
  53036. /**
  53037. * @en metallic
  53038. * @zh 金属性
  53039. */
  53040. metallic: number;
  53041. /**
  53042. * @en roughness
  53043. * @zh 粗糙度
  53044. */
  53045. roughness: number;
  53046. }
  53047. /**
  53048. * @en Terrain block light map info
  53049. * @zh 地形块光照图信息
  53050. */
  53051. export class TerrainBlockLightmapInfo {
  53052. texture: Texture2D | null;
  53053. UOff: number;
  53054. VOff: number;
  53055. UScale: number;
  53056. VScale: number;
  53057. }
  53058. /**
  53059. * @en Terrain block
  53060. * @zh 地形块
  53061. */
  53062. export class TerrainBlock {
  53063. constructor(t: Terrain, i: number, j: number);
  53064. build(): void;
  53065. rebuild(): void;
  53066. destroy(): void;
  53067. update(): void;
  53068. setBrushMaterial(mtl: Material | null): void;
  53069. _getBrushMaterial(): Material | null;
  53070. _getBrushPass(): renderer.Pass | null;
  53071. /**
  53072. * @en valid
  53073. * @zh 是否有效
  53074. */
  53075. get valid(): boolean;
  53076. /**
  53077. * @en get current material
  53078. * @zh 获得当前的材质
  53079. */
  53080. get material(): Material | null;
  53081. /**
  53082. * @en get layers
  53083. * @zh 获得纹理层索引
  53084. */
  53085. get layers(): number[];
  53086. /**
  53087. * @en get weight map
  53088. * @zh 获得权重图
  53089. */
  53090. get weightmap(): Texture2D | null;
  53091. /**
  53092. * @en get light map
  53093. * @zh 获得光照图
  53094. */
  53095. get lightmap(): Texture2D | null;
  53096. /**
  53097. * @en get light map uv parameter
  53098. * @zh 获得光照图纹理坐标参数
  53099. */
  53100. get lightmapUVParam(): math.Vec4;
  53101. /**
  53102. * @zh 地形块的可见性
  53103. * @en The visibility of the block
  53104. */
  53105. set visible(val: boolean);
  53106. get visible(): boolean;
  53107. /**
  53108. * @en get terrain owner
  53109. * @zh 获得地形对象
  53110. */
  53111. getTerrain(): Terrain;
  53112. /**
  53113. * @en get index
  53114. * @zh 获得地形索引
  53115. */
  53116. getIndex(): number[];
  53117. /**
  53118. * @en get rect bound
  53119. * @zh 获得地形矩形包围体
  53120. */
  53121. getRect(): math.Rect;
  53122. /**
  53123. * @en set layer
  53124. * @zh 设置纹理层
  53125. */
  53126. setLayer(index: number, layerId: number): void;
  53127. /**
  53128. * @en get layer
  53129. * @zh 获得纹理层
  53130. */
  53131. getLayer(index: number): number;
  53132. /**
  53133. * @en get max layer index
  53134. * @zh 获得最大纹理索引
  53135. */
  53136. getMaxLayer(): number;
  53137. _getMaterialDefines(nLayers: number): renderer.MacroRecord;
  53138. _invalidMaterial(): void;
  53139. _updateMaterial(init: boolean): void;
  53140. _updateHeight(): void;
  53141. _updateWeightMap(): void;
  53142. /**
  53143. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53144. */
  53145. _updateLightmap(info: TerrainBlockLightmapInfo): void;
  53146. /**
  53147. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53148. */
  53149. _updateLod(): void;
  53150. /**
  53151. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53152. */
  53153. _resetLod(): void;
  53154. /**
  53155. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53156. */
  53157. _updateIndexBuffer(): void;
  53158. }
  53159. /**
  53160. * @en Terrain
  53161. * @zh 地形组件
  53162. */
  53163. export class Terrain extends Component {
  53164. protected __asset: TerrainAsset | null;
  53165. protected _effectAsset: EffectAsset | null;
  53166. protected _lightmapInfos: TerrainBlockLightmapInfo[];
  53167. protected _receiveShadow: boolean;
  53168. protected _useNormalmap: boolean;
  53169. protected _usePBR: boolean;
  53170. protected _lodEnable: boolean;
  53171. protected _lodBias: number;
  53172. protected _buitinAsset: TerrainAsset | null;
  53173. protected _tileSize: number;
  53174. protected _blockCount: number[];
  53175. protected _weightMapSize: number;
  53176. protected _lightMapSize: number;
  53177. protected _heights: Uint16Array;
  53178. protected _weights: Uint8Array;
  53179. protected _normals: Float32Array;
  53180. protected _layerList: (TerrainLayer | null)[];
  53181. protected _layerBuffer: number[];
  53182. protected _blocks: TerrainBlock[];
  53183. protected _lod: __private._cocos_terrain_terrain_lod__TerrainLod | null;
  53184. protected _sharedIndexBuffer: gfx.Buffer | null;
  53185. protected _sharedLodIndexBuffer: gfx.Buffer | null;
  53186. constructor();
  53187. set _asset(value: TerrainAsset | null);
  53188. /**
  53189. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53190. */
  53191. get _asset(): TerrainAsset | null;
  53192. /**
  53193. * @en Terrain effect asset
  53194. * @zh 地形特效资源
  53195. */
  53196. set effectAsset(value: EffectAsset | null);
  53197. get effectAsset(): EffectAsset | null;
  53198. /**
  53199. * @en Receive shadow
  53200. * @zh 是否接受阴影
  53201. */
  53202. get receiveShadow(): boolean;
  53203. set receiveShadow(val: boolean);
  53204. /**
  53205. * @en Use normal map
  53206. * @zh 是否使用法线贴图
  53207. */
  53208. get useNormalMap(): boolean;
  53209. set useNormalMap(val: boolean);
  53210. /**
  53211. * @en Use pbr material
  53212. * @zh 是否使用物理材质
  53213. */
  53214. get usePBR(): boolean;
  53215. set usePBR(val: boolean);
  53216. /**
  53217. * @en Enable lod
  53218. * @zh 是否允许lod
  53219. */
  53220. get lodEnable(): boolean;
  53221. set lodEnable(val: boolean);
  53222. /**
  53223. * @en Lod bias
  53224. * @zh Lod偏移距离
  53225. */
  53226. get LodBias(): number;
  53227. set LodBias(val: number);
  53228. /**
  53229. * @en get terrain size
  53230. * @zh 获得地形大小
  53231. */
  53232. get size(): math.Size;
  53233. /**
  53234. * @en get tile size
  53235. * @zh 获得栅格大小
  53236. */
  53237. get tileSize(): number;
  53238. /**
  53239. * @en get tile count
  53240. * @zh 获得栅格数量
  53241. */
  53242. get tileCount(): number[];
  53243. /**
  53244. * @en get vertex count
  53245. * @zh 获得顶点数量
  53246. */
  53247. get vertexCount(): number[];
  53248. /**
  53249. * @en get block count
  53250. * @zh 获得地形块数量
  53251. */
  53252. get blockCount(): number[];
  53253. /**
  53254. * @en get light map size
  53255. * @zh 获得光照图大小
  53256. */
  53257. get lightMapSize(): number;
  53258. /**
  53259. * @en get weight map size
  53260. * @zh 获得权重图大小
  53261. */
  53262. get weightMapSize(): number;
  53263. /**
  53264. * @en get height buffer
  53265. * @zh 获得高度缓存
  53266. */
  53267. get heights(): Uint16Array;
  53268. /**
  53269. * @en get weight buffer
  53270. * @zh 获得权重缓存
  53271. */
  53272. get weights(): Uint8Array;
  53273. /**
  53274. * @en check valid
  53275. * @zh 检测是否有效
  53276. */
  53277. get valid(): boolean;
  53278. /**
  53279. * @en get terrain info
  53280. * @zh 获得地形信息
  53281. */
  53282. get info(): TerrainInfo;
  53283. /**
  53284. * @en build
  53285. * @zh 构建地形
  53286. */
  53287. build(info: TerrainInfo): void;
  53288. /**
  53289. * @en rebuild
  53290. * @zh 重建地形
  53291. */
  53292. rebuild(info: TerrainInfo): void;
  53293. /**
  53294. * @en import height field
  53295. * @zh 导入高度图
  53296. */
  53297. importHeightField(hf: HeightField, heightScale: number): void;
  53298. /**
  53299. * @en export height field
  53300. * @zh 导出高度图
  53301. */
  53302. exportHeightField(hf: HeightField, heightScale: number): void;
  53303. exportAsset(): TerrainAsset;
  53304. exportLayerListToAsset(asset: TerrainAsset): void;
  53305. getEffectAsset(): EffectAsset;
  53306. onEnable(): void;
  53307. onDisable(): void;
  53308. onDestroy(): void;
  53309. onRestore(): void;
  53310. update(deltaTime: number): void;
  53311. onUpdateFromCamera(cam: renderer.scene.Camera): void;
  53312. /**
  53313. * @en add layer
  53314. * @zh 添加纹理层
  53315. */
  53316. addLayer(layer: TerrainLayer): number;
  53317. /**
  53318. * @en set layer
  53319. * @zh 设置纹理层
  53320. */
  53321. setLayer(i: number, layer: TerrainLayer): void;
  53322. /**
  53323. * @en remove layer
  53324. * @zh 移除纹理层
  53325. */
  53326. removeLayer(id: number): void;
  53327. /**
  53328. * @en get layer
  53329. * @zh 获得纹理层
  53330. */
  53331. getLayer(id: number): TerrainLayer | null;
  53332. /**
  53333. * @en get position
  53334. * @zh 获得地形上的位置
  53335. */
  53336. getPosition(i: number, j: number): math.Vec3;
  53337. getHeightField(): Uint16Array;
  53338. /**
  53339. * @en set height
  53340. * @zh 设置地形上的高度
  53341. */
  53342. setHeight(i: number, j: number, h: number): void;
  53343. /**
  53344. * @en get height
  53345. * @zh 获得地形上的高度
  53346. */
  53347. getHeight(i: number, j: number): number;
  53348. /**
  53349. * @en set height
  53350. * @zh 设置高度
  53351. */
  53352. getHeightClamp(i: number, j: number): number;
  53353. /**
  53354. * @en get height by point
  53355. * @zh 根据点的坐标获得高度
  53356. */
  53357. getHeightAt(x: number, y: number): number | null;
  53358. /**
  53359. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53360. */
  53361. _setNormal(i: number, j: number, n: math.Vec3): void;
  53362. /**
  53363. * @en get normal
  53364. * @zh 获得法线
  53365. */
  53366. getNormal(i: number, j: number): math.Vec3;
  53367. /**
  53368. * @en get normal by point
  53369. * @zh 根据点的坐标获得法线
  53370. */
  53371. getNormalAt(x: number, y: number): math.Vec3 | null;
  53372. /**
  53373. * @en set weight
  53374. * @zh 设置权重
  53375. */
  53376. setWeight(i: number, j: number, w: math.Vec4): void;
  53377. /**
  53378. * @en get weight
  53379. * @zh 获得权重
  53380. */
  53381. getWeight(i: number, j: number): math.Vec4;
  53382. /**
  53383. * @en get normal by point
  53384. * @zh 根据点的坐标获得权重
  53385. */
  53386. getWeightAt(x: number, y: number): math.Vec4 | null;
  53387. /**
  53388. * @en get max weight layer by point
  53389. * @zh 根据点的坐标获得权重最大的纹理层
  53390. */
  53391. getMaxWeightLayerAt(x: number, y: number): TerrainLayer | null;
  53392. /**
  53393. * @en get block layers
  53394. * @zh 获得地形块纹理层
  53395. */
  53396. getBlockLayers(i: number, j: number): number[];
  53397. /**
  53398. * @en get block layer
  53399. * @zh 获得地形块纹理层
  53400. */
  53401. getBlockLayer(i: number, j: number, index: number): number;
  53402. /**
  53403. * @en set block layer
  53404. * @zh 获得地形块层
  53405. */
  53406. setBlockLayer(i: number, j: number, index: number, layerId: number): void;
  53407. /**
  53408. * @en get block
  53409. * @zh 获得地形块对象
  53410. */
  53411. getBlock(i: number, j: number): TerrainBlock;
  53412. /**
  53413. * @en get all blocks
  53414. * @zh 获得地形块缓存
  53415. */
  53416. getBlocks(): TerrainBlock[];
  53417. /**
  53418. * @en ray check
  53419. * @zh 射线检测
  53420. * @param start ray start
  53421. * @param dir ray direction
  53422. * @param step ray step
  53423. * @param worldSpace is world space
  53424. */
  53425. rayCheck(start: math.Vec3, dir: math.Vec3, step: number, worldSpace?: boolean): math.Vec3 | null;
  53426. /**
  53427. * @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
  53428. */
  53429. _createSharedIndexBuffer(): gfx.Buffer;
  53430. /**
  53431. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53432. */
  53433. _getSharedIndexBuffer(): gfx.Buffer;
  53434. /**
  53435. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53436. */
  53437. _getIndexData(key: __private._cocos_terrain_terrain_lod__TerrainLodKey): __private._cocos_terrain_terrain_lod__TerrainIndexData | null;
  53438. /**
  53439. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53440. */
  53441. _resetLightmap(enable: boolean): void;
  53442. /**
  53443. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53444. */
  53445. _updateLightmap(blockId: number, tex: Texture2D | null, uOff: number, vOff: number, uScale: number, vScale: number): void;
  53446. /**
  53447. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53448. */
  53449. _getLightmapInfo(i: number, j: number): TerrainBlockLightmapInfo | null;
  53450. /**
  53451. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53452. */
  53453. _calcNormal(x: number, z: number): math.Vec3;
  53454. /**
  53455. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53456. */
  53457. _buildNormals(): void;
  53458. }
  53459. export const TERRAIN_MAX_LEVELS = 4;
  53460. export const TERRAIN_MAX_BLEND_LAYERS = 4;
  53461. export const TERRAIN_MAX_LAYER_COUNT = 256;
  53462. export const TERRAIN_BLOCK_TILE_COMPLEXITY = 32;
  53463. export const TERRAIN_BLOCK_VERTEX_COMPLEXITY = 33;
  53464. export const TERRAIN_BLOCK_VERTEX_SIZE = 8;
  53465. export const TERRAIN_HEIGHT_BASE = 32768;
  53466. export const TERRAIN_HEIGHT_FACTORY: number;
  53467. export const TERRAIN_HEIGHT_FACTORY_V7: number;
  53468. export const TERRAIN_HEIGHT_FMIN: number;
  53469. export const TERRAIN_HEIGHT_FMAX: number;
  53470. export const TERRAIN_NORTH_INDEX = 0;
  53471. export const TERRAIN_SOUTH_INDEX = 1;
  53472. export const TERRAIN_WEST_INDEX = 2;
  53473. export const TERRAIN_EAST_INDEX = 3;
  53474. export const TERRAIN_DATA_VERSION = 16842753;
  53475. export const TERRAIN_DATA_VERSION2 = 16842754;
  53476. export const TERRAIN_DATA_VERSION3 = 16842755;
  53477. export const TERRAIN_DATA_VERSION4 = 16842756;
  53478. export const TERRAIN_DATA_VERSION5 = 16842757;
  53479. export const TERRAIN_DATA_VERSION6 = 16842758;
  53480. export const TERRAIN_DATA_VERSION7 = 16842759;
  53481. export const TERRAIN_DATA_VERSION8 = 16842760;
  53482. export const TERRAIN_DATA_VERSION_DEFAULT = 16843025;
  53483. /**
  53484. * @en terrain layer info
  53485. * @zh 地形纹理信息
  53486. */
  53487. export class TerrainLayerInfo {
  53488. slot: number;
  53489. tileSize: number;
  53490. detailMap: Texture2D | null;
  53491. normalMap: Texture2D | null;
  53492. roughness: number;
  53493. metallic: number;
  53494. }
  53495. /**
  53496. * @en terrain layer binary info
  53497. * @zh 地形纹理二进制信息
  53498. */
  53499. export class TerrainLayerBinaryInfo {
  53500. slot: number;
  53501. tileSize: number;
  53502. roughness: number;
  53503. metallic: number;
  53504. detailMapId: string;
  53505. normalMapId: string;
  53506. }
  53507. /**
  53508. * @en terrain asset
  53509. * @zh 地形资源
  53510. */
  53511. export class TerrainAsset extends Asset {
  53512. protected _version: number;
  53513. protected _data: Uint8Array | null;
  53514. protected _tileSize: number;
  53515. protected _blockCount: number[];
  53516. protected _weightMapSize: number;
  53517. protected _lightMapSize: number;
  53518. protected _heights: Uint16Array;
  53519. protected _normals: Float32Array;
  53520. protected _weights: Uint8Array;
  53521. protected _layerBuffer: number[];
  53522. protected _layerBinaryInfos: TerrainLayerBinaryInfo[];
  53523. protected _layerInfos: TerrainLayerInfo[];
  53524. constructor();
  53525. /**
  53526. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53527. */
  53528. get _nativeAsset(): ArrayBuffer;
  53529. set _nativeAsset(value: ArrayBuffer);
  53530. /**
  53531. * @en version
  53532. * @zh 版本
  53533. */
  53534. get version(): number;
  53535. /**
  53536. * @en tile size
  53537. * @zh 栅格大小
  53538. */
  53539. set tileSize(value: number);
  53540. get tileSize(): number;
  53541. /**
  53542. * @en block count
  53543. * @zh 块数量
  53544. */
  53545. set blockCount(value: number[]);
  53546. get blockCount(): number[];
  53547. /**
  53548. * @en light map size
  53549. * @zh 光照图大小
  53550. */
  53551. set lightMapSize(value: number);
  53552. get lightMapSize(): number;
  53553. /**
  53554. * @en weight map size
  53555. * @zh 权重图大小
  53556. */
  53557. set weightMapSize(value: number);
  53558. get weightMapSize(): number;
  53559. /**
  53560. * @en height buffer
  53561. * @zh 高度缓存
  53562. */
  53563. set heights(value: Uint16Array);
  53564. get heights(): Uint16Array;
  53565. /**
  53566. * @en normal buffer
  53567. * @zh 法线缓存
  53568. */
  53569. set normals(value: Float32Array);
  53570. get normals(): Float32Array;
  53571. /**
  53572. * @en weight buffer
  53573. * @zh 权重缓存
  53574. */
  53575. set weights(value: Uint8Array);
  53576. get weights(): Uint8Array;
  53577. /**
  53578. * @en layer buffer
  53579. * @zh 纹理索引缓存
  53580. */
  53581. set layerBuffer(value: number[]);
  53582. get layerBuffer(): number[];
  53583. /**
  53584. * @en layer info
  53585. * @zh 纹理信息
  53586. */
  53587. set layerInfos(value: TerrainLayerInfo[]);
  53588. get layerInfos(): TerrainLayerInfo[];
  53589. get layerBinaryInfos(): TerrainLayerBinaryInfo[];
  53590. /**
  53591. * @en get layer
  53592. * @zh 获得纹理索引
  53593. * @param xBlock block index x
  53594. * @param yBlock block index y
  53595. * @param layerId layer id
  53596. */
  53597. getLayer(xBlock: number, yBlock: number, layerId: number): number;
  53598. getHeight(i: number, j: number): number;
  53599. getVertexCountI(): number;
  53600. getVertexCountJ(): number;
  53601. /**
  53602. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53603. */
  53604. _setNativeData(_nativeData: Uint8Array): void;
  53605. /**
  53606. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53607. */
  53608. _loadNativeData(_nativeData: Uint8Array): boolean;
  53609. /**
  53610. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53611. */
  53612. _exportNativeData(): Uint8Array;
  53613. /**
  53614. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  53615. */
  53616. _exportDefaultNativeData(): Uint8Array;
  53617. }
  53618. /**
  53619. * @en Renders a TMX Tile Map in the scene.
  53620. * @zh 在场景中渲染一个 tmx 格式的 Tile Map。
  53621. * @class TiledMap
  53622. * @extends Component
  53623. */
  53624. export class TiledMap extends Component {
  53625. _texGrids: __private._cocos_tiledmap_tiled_types__TiledTextureGrids;
  53626. _textures: SpriteFrame[];
  53627. _tilesets: __private._cocos_tiledmap_tiled_types__TMXTilesetInfo[];
  53628. _animations: __private._cocos_tiledmap_tiled_types__TiledAnimationType;
  53629. _imageLayers: __private._cocos_tiledmap_tiled_types__TMXImageLayerInfo[];
  53630. _layers: TiledLayer[];
  53631. _groups: TiledObjectGroup[];
  53632. _images: __private._cocos_tiledmap_tiled_map__ImageExtendedNode[];
  53633. _properties: __private._cocos_tiledmap_tiled_types__PropertiesInfo;
  53634. _tileProperties: Map<__private._cocos_tiledmap_tiled_types__GID, __private._cocos_tiledmap_tiled_types__PropertiesInfo>;
  53635. _mapInfo: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo | null;
  53636. _mapSize: math.Size;
  53637. _tileSize: math.Size;
  53638. _mapOrientation: __private._cocos_tiledmap_tiled_types__Orientation;
  53639. static Orientation: typeof __private._cocos_tiledmap_tiled_types__Orientation;
  53640. static Property: typeof __private._cocos_tiledmap_tiled_types__Property;
  53641. static TileFlag: typeof __private._cocos_tiledmap_tiled_types__TileFlag;
  53642. static StaggerAxis: typeof __private._cocos_tiledmap_tiled_types__StaggerAxis;
  53643. static StaggerIndex: typeof __private._cocos_tiledmap_tiled_types__StaggerIndex;
  53644. static TMXObjectType: typeof __private._cocos_tiledmap_tiled_types__TMXObjectType;
  53645. static RenderOrder: typeof __private._cocos_tiledmap_tiled_types__RenderOrder;
  53646. _tmxFile: TiledMapAsset | null;
  53647. /**
  53648. * @en The TiledMap Asset.
  53649. * @zh TiledMap 资源。
  53650. * @property {TiledMapAsset} tmxAsset
  53651. * @default ""
  53652. */
  53653. get tmxAsset(): TiledMapAsset;
  53654. set tmxAsset(value: TiledMapAsset);
  53655. /**
  53656. * @en
  53657. * Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation, then need to manually
  53658. * disable this, otherwise, the rendering will be wrong.
  53659. * @zh
  53660. * 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 或者采用了摄像机的话,需要手动关闭,否则渲染会出错。
  53661. */
  53662. protected _enableCulling: boolean;
  53663. get enableCulling(): boolean;
  53664. set enableCulling(value: boolean);
  53665. protected cleanupImageCache: boolean;
  53666. /**
  53667. * @en Gets the map size.
  53668. * @zh 获取地图大小。
  53669. * @method getMapSize
  53670. * @return {Size}
  53671. * @example
  53672. * let mapSize = tiledMap.getMapSize();
  53673. * cc.log("Map Size: " + mapSize);
  53674. */
  53675. getMapSize(): math.Size;
  53676. /**
  53677. * @en Gets the tile size.
  53678. * @zh 获取地图背景中 tile 元素的大小。
  53679. * @method getTileSize
  53680. * @return {Size}
  53681. * @example
  53682. * let tileSize = tiledMap.getTileSize();
  53683. * cc.log("Tile Size: " + tileSize);
  53684. */
  53685. getTileSize(): math.Size;
  53686. /**
  53687. * @en map orientation.
  53688. * @zh 获取地图方向。
  53689. * @method getMapOrientation
  53690. * @return {Number}
  53691. * @example
  53692. * let mapOrientation = tiledMap.getMapOrientation();
  53693. * cc.log("Map Orientation: " + mapOrientation);
  53694. */
  53695. getMapOrientation(): __private._cocos_tiledmap_tiled_types__Orientation;
  53696. /**
  53697. * @en object groups.
  53698. * @zh 获取所有的对象层。
  53699. * @method getObjectGroups
  53700. * @return {TiledObjectGroup[]}
  53701. * @example
  53702. * let objGroups = titledMap.getObjectGroups();
  53703. * for (let i = 0; i < objGroups.length; ++i) {
  53704. * cc.log("obj: " + objGroups[i]);
  53705. * }
  53706. */
  53707. getObjectGroups(): TiledObjectGroup[];
  53708. /**
  53709. * @en Return the TMXObjectGroup for the specific group.
  53710. * @zh 获取指定的 TMXObjectGroup。
  53711. * @method getObjectGroup
  53712. * @param {String} groupName
  53713. * @return {TiledObjectGroup}
  53714. * @example
  53715. * let group = titledMap.getObjectGroup("Players");
  53716. * cc.log("ObjectGroup: " + group);
  53717. */
  53718. getObjectGroup(groupName: string): TiledObjectGroup | null;
  53719. /**
  53720. * @en Gets the map properties.
  53721. * @zh 获取地图的属性。
  53722. * @method getProperties
  53723. * @return {Object[]}
  53724. * @example
  53725. * let properties = titledMap.getProperties();
  53726. * for (let i = 0; i < properties.length; ++i) {
  53727. * cc.log("Properties: " + properties[i]);
  53728. * }
  53729. */
  53730. getProperties(): __private._cocos_tiledmap_tiled_types__PropertiesInfo;
  53731. /**
  53732. * @en Return All layers array.
  53733. * @zh 返回包含所有 layer 的数组。
  53734. * @method getLayers
  53735. * @returns {TiledLayer[]}
  53736. * @example
  53737. * let layers = titledMap.getLayers();
  53738. * for (let i = 0; i < layers.length; ++i) {
  53739. * cc.log("Layers: " + layers[i]);
  53740. * }
  53741. */
  53742. getLayers(): TiledLayer[];
  53743. /**
  53744. * @en return the cc.TiledLayer for the specific layer.
  53745. * @zh 获取指定名称的 layer。
  53746. * @method getLayer
  53747. * @param {String} layerName
  53748. * @return {TiledLayer}
  53749. * @example
  53750. * let layer = titledMap.getLayer("Player");
  53751. * cc.log(layer);
  53752. */
  53753. getLayer(layerName: any): TiledLayer | null;
  53754. protected _changeLayer(layerName: any, replaceLayer: any): void;
  53755. /**
  53756. * @en Return the value for the specific property name.
  53757. * @zh 通过属性名称,获取指定的属性。
  53758. * @method getProperty
  53759. * @param {String} propertyName
  53760. * @return {String}
  53761. * @example
  53762. * let property = titledMap.getProperty("info");
  53763. * cc.log("Property: " + property);
  53764. */
  53765. getProperty(propertyName: string): string | number;
  53766. /**
  53767. * @en Return properties dictionary for tile GID.
  53768. * @zh 通过 GID ,获取指定的属性。
  53769. * @method getPropertiesForGID
  53770. * @param {Number} GID
  53771. * @return {Object}
  53772. * @example
  53773. * let properties = titledMap.getPropertiesForGID(GID);
  53774. * cc.log("Properties: " + properties);
  53775. */
  53776. getPropertiesForGID(gid: __private._cocos_tiledmap_tiled_types__GID): __private._cocos_tiledmap_tiled_types__PropertiesInfo | undefined;
  53777. __preload(): void;
  53778. onEnable(): void;
  53779. onDisable(): void;
  53780. _applyFile(): void;
  53781. _releaseMapInfo(): void;
  53782. _syncAnchorPoint(): void;
  53783. _fillAniGrids(texGrids: __private._cocos_tiledmap_tiled_types__TiledTextureGrids, animations: __private._cocos_tiledmap_tiled_types__TiledAnimationType): void;
  53784. _buildLayerAndGroup(): void;
  53785. protected _buildWithMapInfo(mapInfo: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo): void;
  53786. doCleanupImageCache(texture: any): void;
  53787. lateUpdate(dt: number): void;
  53788. }
  53789. /**
  53790. * @en
  53791. * Class for tiled map asset handling.
  53792. * @zh
  53793. * 用于获取 tiled map 资源类
  53794. * @class TiledMapAsset
  53795. * @extends Asset
  53796. *
  53797. */
  53798. export class TiledMapAsset extends Asset {
  53799. tmxXmlStr: string;
  53800. tsxFiles: TextAsset[];
  53801. tsxFileNames: string[];
  53802. /**
  53803. * @en
  53804. * SpriteFrame array
  53805. * @zh
  53806. * SpriteFrame 数组
  53807. */
  53808. spriteFrames: SpriteFrame[];
  53809. /**
  53810. * @en
  53811. * ImageLayerSpriteFrame array
  53812. * @zh
  53813. * ImageLayerSpriteFrame 数组
  53814. * @property {SpriteFrame[]} imageLayerSpriteFrame
  53815. */
  53816. imageLayerSpriteFrame: SpriteFrame[];
  53817. /**
  53818. * @en
  53819. * Name of each object in imageLayerSpriteFrame
  53820. * @zh
  53821. * 每个 imageLayerSpriteFrame 名称
  53822. * @property {String[]} imageLayerTextureNames
  53823. */
  53824. imageLayerSpriteFrameNames: string[];
  53825. /**
  53826. * @en
  53827. * Name of each object in spriteFrames
  53828. * @zh
  53829. * 每个 SpriteFrame 名称
  53830. * @property {String[]} spriteFrameNames
  53831. */
  53832. spriteFrameNames: string[];
  53833. /**
  53834. * @en
  53835. * Size of each object in spriteFrames
  53836. * @zh
  53837. * 每个 SpriteFrame 的大小
  53838. * @property {Size[]} spriteFrameSizes
  53839. */
  53840. spriteFrameSizes: math.Size[];
  53841. }
  53842. export class TiledUserNodeData extends Component {
  53843. _index: number;
  53844. _row: number;
  53845. _col: number;
  53846. _tiledLayer: TiledLayer | null;
  53847. constructor();
  53848. }
  53849. export interface TiledRenderData {
  53850. renderData: RenderData | null;
  53851. texture: Texture2D | null;
  53852. }
  53853. /**
  53854. * @en Render the TMX layer.
  53855. * @zh 渲染 TMX layer。
  53856. * @class TiledLayer
  53857. * @extends Component
  53858. */
  53859. export class TiledLayer extends UIRenderer {
  53860. protected _userNodeGrid: __private.__types_globals__SafeRecord<number, {
  53861. count: number;
  53862. } & __private.__types_globals__SafeRecord<number, {
  53863. count: number;
  53864. list: (TiledUserNodeData | null)[];
  53865. }>>;
  53866. protected _userNodeMap: {
  53867. [key: string]: TiledUserNodeData;
  53868. };
  53869. protected _userNodeDirty: boolean;
  53870. tiledTiles: (TiledTile | null)[];
  53871. protected _viewPort: {
  53872. x: number;
  53873. y: number;
  53874. width: number;
  53875. height: number;
  53876. };
  53877. protected _cullingRect: {
  53878. leftDown: {
  53879. row: number;
  53880. col: number;
  53881. };
  53882. rightTop: {
  53883. row: number;
  53884. col: number;
  53885. };
  53886. };
  53887. get cullingRect(): {
  53888. leftDown: {
  53889. row: number;
  53890. col: number;
  53891. };
  53892. rightTop: {
  53893. row: number;
  53894. col: number;
  53895. };
  53896. };
  53897. protected _cullingDirty: boolean;
  53898. protected _rightTop: {
  53899. row: number;
  53900. col: number;
  53901. };
  53902. get rightTop(): {
  53903. row: number;
  53904. col: number;
  53905. };
  53906. protected _layerInfo: __private._cocos_tiledmap_tiled_types__TMXLayerInfo | null;
  53907. protected _mapInfo: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo | null;
  53908. protected _topOffset: number;
  53909. protected _downOffset: number;
  53910. protected _leftOffset: number;
  53911. protected _rightOffset: number;
  53912. tiles: __private._cocos_tiledmap_tiled_types__MixedGID[];
  53913. vertices: SafeArray<{
  53914. minCol: number;
  53915. maxCol: number;
  53916. } & __private.__types_globals__SafeRecord<number, {
  53917. left: number;
  53918. bottom: number;
  53919. index: number;
  53920. }>>;
  53921. protected _verticesDirty: boolean;
  53922. protected _layerName: string;
  53923. protected _layerSize?: math.Size;
  53924. get layerSize(): math.Size;
  53925. protected _minGID?: __private._cocos_tiledmap_tiled_types__GID;
  53926. protected _maxGID?: __private._cocos_tiledmap_tiled_types__GID;
  53927. protected _layerOrientation: null | __private._cocos_tiledmap_tiled_types__Orientation;
  53928. protected _opacity?: number;
  53929. protected _tintColor?: math.Color;
  53930. texGrids: __private._cocos_tiledmap_tiled_types__TiledTextureGrids | null;
  53931. protected _textures: SpriteFrame[];
  53932. protected _tilesets: __private._cocos_tiledmap_tiled_types__TMXTilesetInfo[];
  53933. protected _leftDownToCenterX: number;
  53934. protected _leftDownToCenterY: number;
  53935. protected _hasTiledNodeGrid: boolean;
  53936. protected _hasAniGrid: boolean;
  53937. protected _animations: __private._cocos_tiledmap_tiled_types__TiledAnimationType | null;
  53938. protected _enableCulling?: boolean;
  53939. colorChanged: boolean;
  53940. protected _properties?: __private._cocos_tiledmap_tiled_types__PropertiesInfo;
  53941. renderOrder?: __private._cocos_tiledmap_tiled_types__RenderOrder;
  53942. protected _staggerAxis?: __private._cocos_tiledmap_tiled_types__StaggerAxis;
  53943. protected _staggerIndex?: __private._cocos_tiledmap_tiled_types__StaggerIndex;
  53944. protected _hexSideLength?: number;
  53945. protected _mapTileSize?: math.Size;
  53946. protected _odd_even?: number;
  53947. protected _diffX1?: number;
  53948. protected _diffY1?: number;
  53949. protected _useAutomaticVertexZ?: boolean;
  53950. protected _vertexZvalue?: number;
  53951. protected _offset?: math.Vec2;
  53952. protected _tiledDataArray: __private._cocos_tiledmap_tiled_layer__TiledDataArray;
  53953. protected _cameraNode?: Node;
  53954. get tiledDataArray(): __private._cocos_tiledmap_tiled_layer__TiledDataArray;
  53955. get leftDownToCenterX(): number;
  53956. get leftDownToCenterY(): number;
  53957. constructor();
  53958. hasTiledNode(): boolean;
  53959. hasAnimation(): boolean;
  53960. /**
  53961. * @en enable or disable culling
  53962. * @zh 开启或关闭裁剪。
  53963. * @method enableCulling
  53964. * @param value
  53965. */
  53966. set enableCulling(value: boolean);
  53967. get enableCulling(): boolean;
  53968. /**
  53969. * @en Adds user's node into layer.
  53970. * @zh 添加用户节点。
  53971. * @method addUserNode
  53972. * @param {cc.Node} node
  53973. * @return {Boolean}
  53974. */
  53975. addUserNode(node: Node): boolean;
  53976. /**
  53977. * @en Removes user's node.
  53978. * @zh 移除用户节点。
  53979. * @method removeUserNode
  53980. * @param {cc.Node} node
  53981. * @return {Boolean}
  53982. */
  53983. removeUserNode(node: Node): boolean;
  53984. /**
  53985. * @en Destroy user's node.
  53986. * @zh 销毁用户节点。
  53987. * @method destroyUserNode
  53988. * @param {cc.Node} node
  53989. */
  53990. destroyUserNode(node: Node): void;
  53991. protected _nodeLocalPosToLayerPos(nodePos: math.IVec2Like, out: math.IVec2Like): void;
  53992. getNodesByRowCol(row: number, col: number): {
  53993. count: number;
  53994. list: (TiledUserNodeData | null)[];
  53995. } | null | undefined;
  53996. getNodesCountByRow(row: any): number;
  53997. protected _updateAllUserNode(): void;
  53998. protected _updateCullingOffsetByUserNode(node_: Node): void;
  53999. protected _userNodeSizeChange(): void;
  54000. protected _userNodePosChange(): void;
  54001. protected _removeUserNodeFromGrid(dataComp: TiledUserNodeData): void;
  54002. protected _limitInLayer(rowCol: {
  54003. row: number;
  54004. col: number;
  54005. }): void;
  54006. protected _addUserNodeToGrid(dataComp: TiledUserNodeData, tempRowCol: {
  54007. col: number;
  54008. row: number;
  54009. }): void;
  54010. isUserNodeDirty(): boolean;
  54011. setUserNodeDirty(value: any): void;
  54012. protected _reinstallCamera(): renderer.scene.Camera | null;
  54013. protected _uninstallCamera(): void;
  54014. onEnable(): void;
  54015. onDisable(): void;
  54016. protected _syncAnchorPoint(): void;
  54017. /**
  54018. * @en Gets the layer name.
  54019. * @zh 获取层的名称。
  54020. * @method getLayerName
  54021. * @return {String}
  54022. * @example
  54023. * let layerName = tiledLayer.getLayerName();
  54024. * cc.log(layerName);
  54025. */
  54026. getLayerName(): string;
  54027. /**
  54028. * @en Set the layer name.
  54029. * @zh 设置层的名称
  54030. * @method setLayerName
  54031. * @param {String} layerName
  54032. * @example
  54033. * tiledLayer.setLayerName("New Layer");
  54034. */
  54035. setLayerName(layerName: string): void;
  54036. /**
  54037. * @en Return the value for the specific property name.
  54038. * @zh 获取指定属性名的值。
  54039. * @method getProperty
  54040. * @param {String} propertyName
  54041. * @return {*}
  54042. * @example
  54043. * let property = tiledLayer.getProperty("info");
  54044. * cc.log(property);
  54045. */
  54046. getProperty(propertyName: string): string | number;
  54047. /**
  54048. * @en Returns the position in pixels of a given tile coordinate.
  54049. * @zh 获取指定 tile 的像素坐标。
  54050. * @method getPositionAt
  54051. * @param {Vec2|Number} pos position or x
  54052. * @param {Number} [y]
  54053. * @return {Vec2}
  54054. * @example
  54055. * let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  54056. * cc.log("Pos: " + pos);
  54057. * let pos = tiledLayer.getPositionAt(0, 0);
  54058. * cc.log("Pos: " + pos);
  54059. */
  54060. getPositionAt(pos: math.IVec2Like | number, y?: number): math.Vec2 | null;
  54061. isInvalidPosition(x: number, y: number): boolean;
  54062. protected _positionForIsoAt(x: number, y: number): math.Vec2;
  54063. protected _positionForOrthoAt(x: number, y: number): math.Vec2;
  54064. protected _positionForHexAt(col: number, row: number): math.Vec2;
  54065. /**
  54066. * @en
  54067. * Sets the tiles gid (gid = tile global id) at a given tiles rect.
  54068. * @zh
  54069. * 设置给定区域的 tile 的 gid (gid = tile 全局 id),
  54070. * @method setTilesGIDAt
  54071. * @param {Array} gids an array contains gid
  54072. * @param {Number} beginCol begin col number
  54073. * @param {Number} beginRow begin row number
  54074. * @param {Number} totalCols count of column
  54075. * @example
  54076. * tiledLayer.setTilesGIDAt([1, 1, 1, 1], 10, 10, 2)
  54077. */
  54078. setTilesGIDAt(gids: number[], beginCol: number, beginRow: number, totalCols: number): void;
  54079. /**
  54080. * @en
  54081. * Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  54082. * The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  54083. * If a tile is already placed at that position, then it will be removed.
  54084. * @zh
  54085. * 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  54086. * tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  54087. * 如果一个 tile 已经放在那个位置,那么它将被删除。
  54088. * @method setTileGIDAt
  54089. * @param {Number} gid
  54090. * @param {Vec2|Number} posOrX position or x
  54091. * @param {Number} flagsOrY flags or y
  54092. * @param {Number} [flags]
  54093. * @example
  54094. * tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  54095. */
  54096. setTileGIDAt(gid: __private._cocos_tiledmap_tiled_types__MixedGID, x: number, y: number, flags?: number): void;
  54097. protected _updateTileForGID(gidAndFlags: __private._cocos_tiledmap_tiled_types__MixedGID, x: number, y: number): void;
  54098. /**
  54099. * @en
  54100. * Returns the tile gid at a given tile coordinate. <br />
  54101. * if it returns 0, it means that the tile is empty. <br />
  54102. * @zh
  54103. * 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  54104. * 如果它返回 0,则表示该 tile 为空。<br />
  54105. * @method getTileGIDAt
  54106. * @param {Vec2} pos
  54107. * @return {Number}
  54108. * @example
  54109. * let tileGid = tiledLayer.getTileGIDAt(0, 0);
  54110. */
  54111. getTileGIDAt(x: number, y: number): number | null;
  54112. /**
  54113. * @en
  54114. * Returns the tile flags at a given tile coordinate. <br />
  54115. * @zh
  54116. * 通过给定的 tile 坐标, 返回 tile 的 flags. <br />
  54117. * 如果它返回 null,则表示该 tile 为空。<br />
  54118. * @method getTileGIDAt
  54119. * @param {number}} x
  54120. * @param {number}} y
  54121. * @return {Number}
  54122. * @example
  54123. * let tileGid = tiledLayer.getTileGIDAt(0, 0);
  54124. */
  54125. getTileFlagsAt(x: number, y: number): number | null;
  54126. setCullingDirty(value: boolean): void;
  54127. isCullingDirty(): boolean;
  54128. updateViewPort(x: number, y: number, width: number, height: number): void;
  54129. protected _positionToRowCol(x: number, y: number, result: {
  54130. col: number;
  54131. row: number;
  54132. }): {
  54133. col: number;
  54134. row: number;
  54135. };
  54136. updateCulling(): void;
  54137. /**
  54138. * @en Layer orientation, which is the same as the map orientation.
  54139. * @zh 获取 Layer 方向(同地图方向)。
  54140. * @method getLayerOrientation
  54141. * @return {Number}
  54142. * @example
  54143. * let orientation = tiledLayer.getLayerOrientation();
  54144. * cc.log("Layer Orientation: " + orientation);
  54145. */
  54146. getLayerOrientation(): __private._cocos_tiledmap_tiled_types__Orientation | null;
  54147. /**
  54148. * @en properties from the layer. They can be added using Tiled.
  54149. * @zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  54150. * @method getProperties
  54151. * @return {Object}
  54152. * @example
  54153. * let properties = tiledLayer.getProperties();
  54154. * cc.log("Properties: " + properties);
  54155. */
  54156. getProperties(): __private._cocos_tiledmap_tiled_types__PropertiesInfo | undefined;
  54157. protected _updateVertex(col: number, row: number): void;
  54158. protected _updateVertices(): void;
  54159. /**
  54160. * @en
  54161. * Get the TiledTile with the tile coordinate.<br/>
  54162. * If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  54163. * then will create a new TiledTile at the coordinate.
  54164. * The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  54165. * @zh
  54166. * 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  54167. * 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  54168. * 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  54169. * @method getTiledTileAt
  54170. * @param {Integer} x
  54171. * @param {Integer} y
  54172. * @param {Boolean} forceCreate
  54173. * @return {cc.TiledTile}
  54174. * @example
  54175. * let tile = tiledLayer.getTiledTileAt(100, 100, true);
  54176. * cc.log(tile);
  54177. */
  54178. getTiledTileAt(x: number, y: number, forceCreate?: boolean): TiledTile | null;
  54179. /**
  54180. * @en
  54181. * Change tile to TiledTile at the specified coordinate.
  54182. * @zh
  54183. * 将指定的 tile 坐标替换为指定的 TiledTile。
  54184. * @method setTiledTileAt
  54185. * @param {Integer} x
  54186. * @param {Integer} y
  54187. * @param {cc.TiledTile} tiledTile
  54188. * @return {cc.TiledTile}
  54189. */
  54190. setTiledTileAt(x: number, y: number, tiledTile: TiledTile | null): TiledTile | null;
  54191. /**
  54192. * @en Return texture.
  54193. * @zh 获取纹理。
  54194. * @method getTexture
  54195. * @param index The index of textures
  54196. * @return {Texture2D}
  54197. */
  54198. getTexture(index?: number): SpriteFrame | null;
  54199. /**
  54200. * @en Return texture.
  54201. * @zh 获取纹理。
  54202. * @method getTextures
  54203. * @return {Texture2D}
  54204. */
  54205. getTextures(): SpriteFrame[];
  54206. /**
  54207. * @en Set the texture.
  54208. * @zh 设置纹理。
  54209. * @method setTexture
  54210. * @param {SpriteFrame} texture
  54211. */
  54212. setTexture(texture: SpriteFrame): void;
  54213. /**
  54214. * @en Set the texture.
  54215. * @zh 设置纹理。
  54216. * @method setTexture
  54217. * @param {SpriteFrame} textures
  54218. */
  54219. setTextures(textures: SpriteFrame[]): void;
  54220. /**
  54221. * @en Gets layer size.
  54222. * @zh 获得层大小。
  54223. * @method getLayerSize
  54224. * @return {Size}
  54225. * @example
  54226. * let size = tiledLayer.getLayerSize();
  54227. * cc.log("layer size: " + size);
  54228. */
  54229. getLayerSize(): math.Size;
  54230. /**
  54231. * @en Size of the map's tile (could be different from the tile's size).
  54232. * @zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  54233. * @method getMapTileSize
  54234. * @return {Size}
  54235. * @example
  54236. * let mapTileSize = tiledLayer.getMapTileSize();
  54237. * cc.log("MapTile size: " + mapTileSize);
  54238. */
  54239. getMapTileSize(): math.Size;
  54240. /**
  54241. * @en Gets Tile set first information for the layer.
  54242. * @zh 获取 layer 索引位置为0的 Tileset 信息。
  54243. * @method getTileSet
  54244. * @param index The index of tilesets
  54245. * @return {TMXTilesetInfo}
  54246. */
  54247. getTileSet(index: number): __private._cocos_tiledmap_tiled_types__TMXTilesetInfo | null;
  54248. /**
  54249. * @en Gets tile set all information for the layer.
  54250. * @zh 获取 layer 所有的 Tileset 信息。
  54251. * @method getTileSet
  54252. * @return {TMXTilesetInfo}
  54253. */
  54254. getTileSets(): __private._cocos_tiledmap_tiled_types__TMXTilesetInfo[];
  54255. /**
  54256. * @en Sets tile set information for the layer.
  54257. * @zh 设置 layer 的 tileset 信息。
  54258. * @method setTileSet
  54259. * @param {TMXTilesetInfo} tileset
  54260. */
  54261. setTileSet(tileset: __private._cocos_tiledmap_tiled_types__TMXTilesetInfo): void;
  54262. /**
  54263. * @en Sets Tile set information for the layer.
  54264. * @zh 设置 layer 的 Tileset 信息。
  54265. * @method setTileSets
  54266. * @param {TMXTilesetInfo} tilesets
  54267. */
  54268. setTileSets(tilesets: __private._cocos_tiledmap_tiled_types__TMXTilesetInfo[]): void;
  54269. init(layerInfo: __private._cocos_tiledmap_tiled_types__TMXLayerInfo, mapInfo: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo, tilesets: __private._cocos_tiledmap_tiled_types__TMXTilesetInfo[], textures: SpriteFrame[], texGrids: __private._cocos_tiledmap_tiled_types__TiledTextureGrids): void;
  54270. protected _prepareToRender(): void;
  54271. requestTiledRenderData(): TiledRenderData;
  54272. requestSubNodesData(): __private._cocos_tiledmap_tiled_layer__TiledSubNodeData;
  54273. destroyRenderData(): void;
  54274. protected _flushAssembler(): void;
  54275. /**
  54276. * @en
  54277. * Index of mesh render data array
  54278. * @zh
  54279. * 网格渲染数据数组的索引
  54280. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  54281. */
  54282. _tiledDataArrayIdx: number;
  54283. protected _render(ui: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
  54284. protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
  54285. prepareDrawData(): void;
  54286. }
  54287. /**
  54288. * @en Renders the TMX object group.
  54289. * @zh 渲染 tmx object group。
  54290. * @class TiledObjectGroup
  54291. * @extends Component
  54292. */
  54293. export class TiledObjectGroup extends Component {
  54294. protected _premultiplyAlpha: boolean;
  54295. get premultiplyAlpha(): boolean;
  54296. set premultiplyAlpha(value: boolean);
  54297. /**
  54298. * @en Offset position of child objects.
  54299. * @zh 获取子对象的偏移位置。
  54300. * @method getPositionOffset
  54301. * @return {Vec2}
  54302. * @example
  54303. * let offset = tMXObjectGroup.getPositionOffset();
  54304. */
  54305. getPositionOffset(): math.Vec2 | undefined;
  54306. /**
  54307. * @en List of properties stored in a dictionary.
  54308. * @zh 以映射的形式获取属性列表。
  54309. * @method getProperties
  54310. * @return {Object}
  54311. * @example
  54312. * let offset = tMXObjectGroup.getProperties();
  54313. */
  54314. getProperties(): __private._cocos_tiledmap_tiled_types__PropertiesInfo | undefined;
  54315. /**
  54316. * @en Gets the Group name.
  54317. * @zh 获取组名称。
  54318. * @method getGroupName
  54319. * @return {String}
  54320. * @example
  54321. * let groupName = tMXObjectGroup.getGroupName;
  54322. */
  54323. getGroupName(): string | undefined;
  54324. /**
  54325. * Return the value for the specific property name
  54326. * @param {String} propertyName
  54327. * @return {Object}
  54328. */
  54329. getProperty(propertyName: {
  54330. toString(): string;
  54331. } | string): string | number;
  54332. /**
  54333. * @en
  54334. * Return the object for the specific object name. <br />
  54335. * It will return the 1st object found on the array for the given name.
  54336. * @zh 获取指定的对象。
  54337. * @method getObject
  54338. * @param {String} objectName
  54339. * @return {Object|Null}
  54340. * @example
  54341. * let object = tMXObjectGroup.getObject("Group");
  54342. */
  54343. getObject(objectName: string): __private._cocos_tiledmap_tiled_types__TMXObject | null;
  54344. /**
  54345. * @en Gets the objects.
  54346. * @zh 获取对象数组。
  54347. * @method getObjects
  54348. * @return {Array}
  54349. * @example
  54350. * let objects = tMXObjectGroup.getObjects();
  54351. */
  54352. getObjects(): __private._cocos_tiledmap_tiled_types__TMXObject[];
  54353. protected _groupName?: string;
  54354. protected _positionOffset?: math.Vec2;
  54355. protected _mapInfo?: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo;
  54356. protected _properties?: __private._cocos_tiledmap_tiled_types__PropertiesInfo;
  54357. protected _offset?: math.Vec2;
  54358. get offset(): math.Vec2;
  54359. protected _opacity?: number;
  54360. protected _tintColor: math.Color | null;
  54361. protected _animations?: __private._cocos_tiledmap_tiled_types__TiledAnimationType;
  54362. protected _hasAniObj?: boolean;
  54363. protected _texGrids?: __private._cocos_tiledmap_tiled_types__TiledTextureGrids;
  54364. protected aniObjects?: {
  54365. object: __private._cocos_tiledmap_tiled_types__TMXObject;
  54366. imgNode: Node;
  54367. gridGID: __private._cocos_tiledmap_tiled_types__GID;
  54368. }[];
  54369. protected _objects: __private._cocos_tiledmap_tiled_types__TMXObject[];
  54370. /**
  54371. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  54372. */
  54373. _init(groupInfo: __private._cocos_tiledmap_tiled_types__TMXObjectGroupInfo, mapInfo: __private._cocos_tiledmap_tmx_xml_parser__TMXMapInfo, texGrids: __private._cocos_tiledmap_tiled_types__TiledTextureGrids): void;
  54374. update(dt: number): void;
  54375. }
  54376. export class TiledTile extends Component {
  54377. _layer: TiledLayer | null;
  54378. constructor();
  54379. _x: number;
  54380. _y: number;
  54381. /**
  54382. * @en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  54383. * @zh 指定 TiledTile 的横向坐标,以地图块为单位
  54384. * @property {Number} x
  54385. * @default 0
  54386. */
  54387. get x(): number;
  54388. set x(value: number);
  54389. /**
  54390. * @en Specify the TiledTile vertical coordinate,use map tile as the unit.
  54391. * @zh 指定 TiledTile 的纵向坐标,以地图块为单位
  54392. * @property {Number} y
  54393. * @default 0
  54394. */
  54395. get y(): number;
  54396. set y(value: number);
  54397. /**
  54398. * @en Specify the TiledTile gid.
  54399. * @zh 指定 TiledTile 的 gid 值
  54400. * @property {Number} gid
  54401. * @default 0
  54402. */
  54403. get grid(): number;
  54404. set grid(value: number);
  54405. onEnable(): void;
  54406. onDisable(): void;
  54407. updateInfo(): void;
  54408. }
  54409. export const tiledLayerAssembler: IAssemblerManager;
  54410. /**
  54411. * @en
  54412. * Tween system.
  54413. * @zh
  54414. * 缓动系统。
  54415. */
  54416. export class TweenSystem extends System {
  54417. /**
  54418. * @en
  54419. * The ID flag of the system.
  54420. * @zh
  54421. * 此系统的 ID 标记。
  54422. */
  54423. static readonly ID = "TWEEN";
  54424. /**
  54425. * @en
  54426. * Gets the instance of the tween system.
  54427. * @zh
  54428. * 获取缓动系统的实例。
  54429. */
  54430. static readonly instance: TweenSystem;
  54431. /**
  54432. * @en
  54433. * Gets the action manager.
  54434. * @zh
  54435. * 获取动作管理器。
  54436. */
  54437. get ActionManager(): __private._cocos_tween_actions_action_manager__ActionManager;
  54438. /**
  54439. * @en
  54440. * The update will auto execute after all components update.
  54441. * @zh
  54442. * 此方法会在组件 update 之后自动执行。
  54443. * @param dt @en The delta time @zh 间隔时间
  54444. */
  54445. update(dt: number): void;
  54446. }
  54447. /**
  54448. * @en
  54449. * tween is a utility function that helps instantiate Tween instances.
  54450. * @zh
  54451. * tween 是一个工具函数,帮助实例化 Tween 实例。
  54452. * @param target @en The target of the result tween @zh 缓动的目标
  54453. * @returns Tween 实例
  54454. * @example
  54455. * tween(this.node)
  54456. * .to(1, {scale: new Vec3(2, 2, 2), position: new Vec3(5, 5, 5)})
  54457. * .call(() => { console.log('This is a callback'); })
  54458. * .by(1, {scale: new Vec3(-1, -1, -1)}, {easing: 'sineOutIn'})
  54459. * .start()
  54460. */
  54461. export function tween<T>(target?: T): Tween<T>;
  54462. /**
  54463. * @en
  54464. * tweenUtil is a utility function that helps instantiate Tween instances.
  54465. * @zh
  54466. * tweenUtil 是一个工具函数,帮助实例化 Tween 实例。
  54467. * @deprecated please use `tween` instead.
  54468. */
  54469. export function tweenUtil<T>(target?: T): Tween<T>;
  54470. /**
  54471. * @en
  54472. * Tween provide a simple and flexible way to action, It's transplanted from cocos creator。
  54473. * @zh
  54474. * Tween 提供了一个简单灵活的方法来缓动目标,从 creator 移植而来。
  54475. * @class Tween
  54476. * @param [target]
  54477. * @example
  54478. * tween(this.node)
  54479. * .to(1, {scale: new Vec3(2, 2, 2), position: new Vec3(5, 5, 5)})
  54480. * .call(() => { console.log('This is a callback'); })
  54481. * .by(1, {scale: new Vec3(-1, -1, -1), position: new Vec3(-5, -5, -5)}, {easing: 'sineOutIn'})
  54482. * .start()
  54483. */
  54484. export class Tween<T> {
  54485. constructor(target?: T | null);
  54486. /**
  54487. * @en Sets tween tag
  54488. * @zh 设置缓动的标签
  54489. * @method tag
  54490. * @param tag @en The tag set for this tween @zh 为当前缓动设置的标签
  54491. */
  54492. tag(tag: number): Tween<T>;
  54493. /**
  54494. * @en
  54495. * Insert an action or tween to this sequence.
  54496. * @zh
  54497. * 插入一个 tween 到队列中。
  54498. * @method then
  54499. * @param other @en The rear tween of this tween @zh 当前缓动的后置缓动
  54500. */
  54501. then(other: Tween<T>): Tween<T>;
  54502. /**
  54503. * @en
  54504. * Sets tween target.
  54505. * @zh
  54506. * 设置 tween 的 target。
  54507. * @method target
  54508. * @param target @en The target of this tween @zh 当前缓动的目标对象
  54509. */
  54510. target(target: T): Tween<T | undefined>;
  54511. /**
  54512. * @en
  54513. * Start this tween.
  54514. * @zh
  54515. * 运行当前 tween。
  54516. */
  54517. start(): Tween<T>;
  54518. /**
  54519. * @en
  54520. * Stop this tween.
  54521. * @zh
  54522. * 停止当前 tween。
  54523. */
  54524. stop(): Tween<T>;
  54525. /**
  54526. * @en
  54527. * Clone a tween.
  54528. * @zh
  54529. * 克隆当前 tween。
  54530. * @method clone
  54531. * @param target @en The target of clone tween @zh 克隆缓动的目标对象
  54532. */
  54533. clone(target: T): Tween<T>;
  54534. /**
  54535. * @en
  54536. * Integrate all previous actions to an action.
  54537. * @zh
  54538. * 将之前所有的 action 整合为一个 action。
  54539. */
  54540. union(): Tween<T>;
  54541. /**
  54542. * @en
  54543. * Add an action which calculates with absolute value.
  54544. * @zh
  54545. * 添加一个对属性进行绝对值计算的 action。
  54546. * @method to
  54547. * @param duration @en Tween time, in seconds @zh 缓动时间,单位为秒
  54548. * @param props @en List of properties of tween @zh 缓动的属性列表
  54549. * @param opts @en Optional functions of tween @zh 可选的缓动功能
  54550. * @param opts.progress @en Interpolation function @zh 缓动的速度插值函数
  54551. * @param opts.easing @en Tween function or a lambda @zh 缓动的曲线函数或lambda表达式
  54552. */
  54553. to(duration: number, props: __private._cocos_tween_tween__ConstructorType<T>, opts?: ITweenOption): Tween<T>;
  54554. /**
  54555. * @en
  54556. * Add an action which calculates with relative value.
  54557. * @zh
  54558. * 添加一个对属性进行相对值计算的 action。
  54559. * @method by
  54560. * @param duration @en Tween time, in seconds @zh 缓动时间,单位为秒
  54561. * @param props @en List of properties of tween @zh 缓动的属性列表
  54562. * @param opts @en Optional functions of tween @zh 可选的缓动功能
  54563. * @param [opts.progress]
  54564. * @param [opts.easing]
  54565. * @return {Tween}
  54566. */
  54567. by(duration: number, props: __private._cocos_tween_tween__ConstructorType<T>, opts?: ITweenOption): Tween<T>;
  54568. /**
  54569. * @en
  54570. * Directly set target properties.
  54571. * @zh
  54572. * 直接设置 target 的属性。
  54573. * @method set
  54574. * @param props @en List of properties of tween @zh 缓动的属性列表
  54575. * @return {Tween}
  54576. */
  54577. set(props: __private._cocos_tween_tween__ConstructorType<T>): Tween<T>;
  54578. /**
  54579. * @en
  54580. * Add a delay action.
  54581. * @zh
  54582. * 添加一个延时 action。
  54583. * @method delay
  54584. * @param duration @en Delay time of this tween @zh 当前缓动的延迟时间
  54585. * @return {Tween}
  54586. */
  54587. delay(duration: number): Tween<T>;
  54588. /**
  54589. * @en
  54590. * Add a callback action.
  54591. * @zh
  54592. * 添加一个回调 action。
  54593. * @method call
  54594. * @param callback @en Callback function at the end of this tween @zh 当前缓动结束时的回调函数
  54595. * @return {Tween}
  54596. */
  54597. call(callback: Function): Tween<T>;
  54598. /**
  54599. * @en
  54600. * Add a sequence action.
  54601. * @zh
  54602. * 添加一个队列 action。
  54603. * @method sequence
  54604. * @param args @en All tween that make up the sequence @zh 组成队列的所有缓动
  54605. */
  54606. sequence(...args: Tween<T>[]): Tween<T>;
  54607. /**
  54608. * @en
  54609. * Add a parallel action.
  54610. * @zh
  54611. * 添加一个并行 action。
  54612. * @method parallel
  54613. * @param args @en The tween parallel to this tween @zh 与当前缓动并行的缓动
  54614. */
  54615. parallel(...args: Tween<T>[]): Tween<T>;
  54616. /**
  54617. * @en
  54618. * Add a repeat action.
  54619. * This action will integrate before actions to a sequence action as their parameters.
  54620. * @zh
  54621. * 添加一个重复 action,这个 action 会将前一个动作作为他的参数。
  54622. * @param repeatTimes @en The repeat times of this tween @zh 重复次数
  54623. * @param embedTween @en Optional, embedded tween of this tween @zh 可选,嵌入缓动
  54624. */
  54625. repeat(repeatTimes: number, embedTween?: Tween<T>): Tween<T>;
  54626. /**
  54627. * @en
  54628. * Add a repeat forever action.
  54629. * This action will integrate before actions to a sequence action as their parameters.
  54630. * @zh
  54631. * 添加一个永久重复 action,这个 action 会将前一个动作作为他的参数。
  54632. * @method repeatForever
  54633. * @param embedTween @en Optional, embedded tween of this tween @zh 可选,嵌入缓动
  54634. */
  54635. repeatForever(embedTween?: Tween<T>): Tween<T>;
  54636. /**
  54637. * @en
  54638. * Add a reverse time action.
  54639. * This action will integrate before actions to a sequence action as their parameters.
  54640. * @zh
  54641. * 添加一个倒置时间 action,这个 action 会将前一个动作作为他的参数。
  54642. * @method reverseTime
  54643. * @param embedTween @en Optional, embedded tween of this tween @zh 可选,嵌入缓动
  54644. */
  54645. reverseTime(embedTween?: Tween<T>): Tween<T>;
  54646. /**
  54647. * @en
  54648. * Add a hide action, only for node target.
  54649. * @zh
  54650. * 添加一个隐藏 action,只适用于 target 是节点类型的。
  54651. */
  54652. hide(): Tween<T>;
  54653. /**
  54654. * @en
  54655. * Add a show action, only for node target.
  54656. * @zh
  54657. * 添加一个显示 action,只适用于 target 是节点类型的。
  54658. */
  54659. show(): Tween<T>;
  54660. /**
  54661. * @en
  54662. * Add a removeSelf action, only for node target.
  54663. * @zh
  54664. * 添加一个移除自己 action,只适用于 target 是节点类型的。
  54665. */
  54666. removeSelf(): Tween<T>;
  54667. /**
  54668. * @en
  54669. * Add a destroySelf action, only for node target.
  54670. * @zh
  54671. * 添加一个移除并销毁自己 action,只适用于 target 是节点类型的。
  54672. */
  54673. destroySelf(): Tween<T>;
  54674. /**
  54675. * @en
  54676. * Stop all tweens
  54677. * @zh
  54678. * 停止所有缓动
  54679. */
  54680. static stopAll(): void;
  54681. /**
  54682. * @en
  54683. * Stop all tweens by tag
  54684. * @zh
  54685. * 停止所有指定标签的缓动
  54686. */
  54687. static stopAllByTag(tag: number, target?: object): void;
  54688. /**
  54689. * @en
  54690. * Stop all tweens by target
  54691. * @zh
  54692. * 停止所有指定对象的缓动
  54693. */
  54694. static stopAllByTarget(target?: object): void;
  54695. }
  54696. export class TweenAction extends __private._cocos_tween_actions_action_interval__ActionInterval {
  54697. constructor(duration: number, props: any, opts?: ITweenOption);
  54698. clone(): TweenAction;
  54699. startWithTarget(target: Record<string, unknown>): void;
  54700. update(t: number): void;
  54701. progress(start: number, end: number, current: number, t: number): number;
  54702. }
  54703. /**
  54704. * @en
  54705. * Built-in string value definition for the cache function.
  54706. * @zh
  54707. * 内置缓动函数的字符串值定义。
  54708. */
  54709. export type TweenEasing = "linear" | "smooth" | "fade" | "constant" | "quadIn" | "quadOut" | "quadInOut" | "quadOutIn" | "cubicIn" | "cubicOut" | "cubicInOut" | "cubicOutIn" | "quartIn" | "quartOut" | "quartInOut" | "quartOutIn" | "quintIn" | "quintOut" | "quintInOut" | "quintOutIn" | "sineIn" | "sineOut" | "sineInOut" | "sineOutIn" | "expoIn" | "expoOut" | "expoInOut" | "expoOutIn" | "circIn" | "circOut" | "circInOut" | "circOutIn" | "elasticIn" | "elasticOut" | "elasticInOut" | "elasticOutIn" | "backIn" | "backOut" | "backInOut" | "backOutIn" | "bounceIn" | "bounceOut" | "bounceInOut" | "bounceOutIn";
  54710. /**
  54711. * @en
  54712. * The interface of optional property.
  54713. * @zh
  54714. * 缓动的可选属性的接口定义。
  54715. */
  54716. export interface ITweenOption {
  54717. /**
  54718. * @en
  54719. * Easing function, you can pass in a string or custom function.
  54720. * @zh
  54721. * 缓动函数,可以使用已有的,也可以传入自定义的函数。
  54722. */
  54723. easing?: TweenEasing | ((k: number) => number);
  54724. /**
  54725. * @en
  54726. * Interpolation function, you can pass in a custom function.
  54727. * @zh
  54728. * 插值函数,参数的意义 start:起始值,end:目标值,current:当前值,ratio:当前进度
  54729. */
  54730. progress?: (start: number, end: number, current: number, ratio: number) => number;
  54731. /**
  54732. * @en
  54733. * A callback that is triggered when a tween action is started.
  54734. * @zh
  54735. * 回调,当缓动动作启动时触发。
  54736. */
  54737. onStart?: (target?: object) => void;
  54738. /**
  54739. * @en
  54740. * A callback that is triggered when a tween action is update.
  54741. * @zh
  54742. * 回调,当缓动动作更新时触发。
  54743. */
  54744. onUpdate?: (target?: object, ratio?: number) => void;
  54745. /**
  54746. * @en
  54747. * A callback that is triggered when a tween action is completed.
  54748. * @zh
  54749. * 回调,当缓动动作完成时触发。
  54750. */
  54751. onComplete?: (target?: object) => void;
  54752. }
  54753. /**
  54754. * @en
  54755. * Button component. Can be pressed or clicked. Button has 4 Transition types:
  54756. *
  54757. * - Button.Transition.NONE // Button will do nothing
  54758. * - Button.Transition.COLOR // Button will change target's color
  54759. * - Button.Transition.SPRITE // Button will change target Sprite's sprite
  54760. * - Button.Transition.SCALE // Button will change target node's scale
  54761. *
  54762. * The button can bind events (but you must be on the button's node to bind events).<br/>
  54763. * The following events can be triggered on all platforms.
  54764. *
  54765. * - cc.Node.EventType.TOUCH_START // Press
  54766. * - cc.Node.EventType.TOUCH_MOVE // After pressing and moving
  54767. * - cc.Node.EventType.TOUCH_END // After pressing and releasing
  54768. * - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
  54769. *
  54770. * The following events are only triggered on the PC platform:
  54771. *
  54772. * - cc.Node.EventType.MOUSE_DOWN
  54773. * - cc.Node.EventType.MOUSE_MOVE
  54774. * - cc.Node.EventType.MOUSE_ENTER
  54775. * - cc.Node.EventType.MOUSE_LEAVE
  54776. * - cc.Node.EventType.MOUSE_UP
  54777. *
  54778. * The developer can get the current clicked node with `event.target` from event object which is passed as parameter
  54779. * in the callback function of click event.
  54780. *
  54781. * @zh
  54782. * 按钮组件。可以被按下,或者点击。<br>
  54783. * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
  54784. *
  54785. * - Button.Transition.NONE // 不做任何过渡
  54786. * - Button.Transition.COLOR // 进行颜色之间过渡
  54787. * - Button.Transition.SPRITE // 进行精灵之间过渡
  54788. * - Button.Transition.SCALE // 进行缩放过渡
  54789. *
  54790. * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件)。<br/>
  54791. * 以下事件可以在全平台上都触发:
  54792. *
  54793. * - cc.Node.EventType.TOUCH_START // 按下时事件
  54794. * - cc.Node.EventType.TOUCH_Move // 按住移动后事件
  54795. * - cc.Node.EventType.TOUCH_END // 按下后松开后事件
  54796. * - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
  54797. *
  54798. * 以下事件只在 PC 平台上触发:
  54799. *
  54800. * - cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
  54801. * - cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
  54802. * - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
  54803. * - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
  54804. * - cc.Node.EventType.MOUSE_UP // 鼠标松开事件
  54805. *
  54806. * 开发者可以通过获取 **点击事件** 回调函数的参数 event 的 target 属性获取当前点击对象。
  54807. *
  54808. * @example
  54809. * ```ts
  54810. * import { log, Node } from 'cc';
  54811. * // Add an event to the button.
  54812. * button.node.on(Node.EventType.TOUCH_START, (event) => {
  54813. * log("This is a callback after the trigger event");
  54814. * });
  54815. * // You could also add a click event
  54816. * // Note: In this way, you can't get the touch event info, so use it wisely.
  54817. * button.node.on(Node.EventType.CLICK, (button) => {
  54818. * //The event is a custom event, you could get the Button component via first argument
  54819. * })
  54820. * ```
  54821. */
  54822. export class Button extends Component {
  54823. /**
  54824. * @en
  54825. * Transition target.<br/>
  54826. * When Button state changed:
  54827. * - Button.Transition.NONE // Button will do nothing
  54828. * - Button.Transition.COLOR // Button will change target's color
  54829. * - Button.Transition.SPRITE // Button will change target Sprite's sprite
  54830. * - Button.Transition.SCALE // Button will change target node's scale
  54831. *
  54832. * @zh
  54833. * 需要过渡的目标。<br/>
  54834. * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
  54835. * - Button.Transition.NONE // 不做任何过渡
  54836. * - Button.Transition.COLOR // 进行颜色之间过渡
  54837. * - Button.Transition.SPRITE // 进行 Sprite 之间的过渡
  54838. * - Button.Transition.SCALE // 进行缩放过渡
  54839. */
  54840. get target(): Node;
  54841. set target(value: Node);
  54842. /**
  54843. * @en
  54844. * Whether the Button is disabled.
  54845. * If true, the Button will trigger event and do transition.
  54846. *
  54847. * @zh
  54848. * 按钮事件是否被响应,如果为 false,则按钮将被禁用。
  54849. */
  54850. get interactable(): boolean;
  54851. set interactable(value: boolean);
  54852. /**
  54853. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  54854. */
  54855. set _resizeToTarget(value: boolean);
  54856. /**
  54857. * @en
  54858. * Transition type.
  54859. *
  54860. * @zh
  54861. * 按钮状态改变时过渡方式。
  54862. */
  54863. get transition(): __private._cocos_ui_button__Transition;
  54864. set transition(value: __private._cocos_ui_button__Transition);
  54865. /**
  54866. * @en
  54867. * Normal state color.
  54868. *
  54869. * @zh
  54870. * 普通状态下按钮所显示的颜色。
  54871. */
  54872. get normalColor(): Readonly<math.Color>;
  54873. set normalColor(value: Readonly<math.Color>);
  54874. /**
  54875. * @en
  54876. * Pressed state color.
  54877. *
  54878. * @zh
  54879. * 按下状态时按钮所显示的颜色。
  54880. */
  54881. get pressedColor(): Readonly<math.Color>;
  54882. set pressedColor(value: Readonly<math.Color>);
  54883. /**
  54884. * @en
  54885. * Hover state color.
  54886. *
  54887. * @zh
  54888. * 悬停状态下按钮所显示的颜色。
  54889. */
  54890. get hoverColor(): Readonly<math.Color>;
  54891. set hoverColor(value: Readonly<math.Color>);
  54892. /**
  54893. * @en
  54894. * Disabled state color.
  54895. *
  54896. * @zh
  54897. * 禁用状态下按钮所显示的颜色。
  54898. */
  54899. get disabledColor(): Readonly<math.Color>;
  54900. set disabledColor(value: Readonly<math.Color>);
  54901. /**
  54902. * @en
  54903. * Color and Scale transition duration.
  54904. *
  54905. * @zh
  54906. * 颜色过渡和缩放过渡时所需时间。
  54907. */
  54908. get duration(): number;
  54909. set duration(value: number);
  54910. /**
  54911. * @en
  54912. * When user press the button, the button will zoom to a scale.
  54913. * The final scale of the button equals (button original scale * zoomScale)
  54914. * NOTE: Setting zoomScale less than 1 is not adviced, which could fire the touchCancel event
  54915. * if the touch point is out of touch area after scaling.
  54916. * if you need to do so, you should set target as another background node instead of the button node.
  54917. *
  54918. * @zh
  54919. * 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale。
  54920. * 注意:不建议 zoomScale 的值小于 1, 否则缩放后如果触摸点在触摸区域外, 则会触发 touchCancel 事件。
  54921. * 如果你需要这么做,你应该把 target 设置为另一个背景节点,而不是按钮节点。
  54922. */
  54923. get zoomScale(): number;
  54924. set zoomScale(value: number);
  54925. /**
  54926. * @en
  54927. * Normal state sprite.
  54928. *
  54929. * @zh
  54930. * 普通状态下按钮所显示的 Sprite。
  54931. */
  54932. get normalSprite(): SpriteFrame | null;
  54933. set normalSprite(value: SpriteFrame | null);
  54934. /**
  54935. * @en
  54936. * Pressed state sprite.
  54937. *
  54938. * @zh
  54939. * 按下状态时按钮所显示的 Sprite。
  54940. */
  54941. get pressedSprite(): SpriteFrame | null;
  54942. set pressedSprite(value: SpriteFrame | null);
  54943. /**
  54944. * @en
  54945. * Hover state sprite.
  54946. *
  54947. * @zh
  54948. * 悬停状态下按钮所显示的 Sprite。
  54949. */
  54950. get hoverSprite(): SpriteFrame | null;
  54951. set hoverSprite(value: SpriteFrame | null);
  54952. /**
  54953. * @en
  54954. * Disabled state sprite.
  54955. *
  54956. * @zh
  54957. * 禁用状态下按钮所显示的 Sprite。
  54958. */
  54959. get disabledSprite(): SpriteFrame | null;
  54960. set disabledSprite(value: SpriteFrame | null);
  54961. /**
  54962. * @en Enum for transition type.
  54963. * @zh 过渡类型。
  54964. */
  54965. static Transition: typeof __private._cocos_ui_button__Transition;
  54966. /**
  54967. * @en The event types of [[Button]]. All button events are distributed by the owner Node, not the component
  54968. * @zh [[Button]] 的事件类型,注意:事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。
  54969. */
  54970. static EventType: typeof __private._cocos_ui_button__EventType;
  54971. /**
  54972. * @en
  54973. * If Button is clicked, it will trigger event's handler.
  54974. *
  54975. * @zh
  54976. * 按钮的点击事件列表。
  54977. */
  54978. clickEvents: EventHandler[];
  54979. protected _interactable: boolean;
  54980. protected _transition: __private._cocos_ui_button__Transition;
  54981. protected _normalColor: math.Color;
  54982. protected _hoverColor: math.Color;
  54983. protected _pressedColor: math.Color;
  54984. protected _disabledColor: math.Color;
  54985. protected _normalSprite: SpriteFrame | null;
  54986. protected _hoverSprite: SpriteFrame | null;
  54987. protected _pressedSprite: SpriteFrame | null;
  54988. protected _disabledSprite: SpriteFrame | null;
  54989. protected _duration: number;
  54990. protected _zoomScale: number;
  54991. protected _target: Node | null;
  54992. __preload(): void;
  54993. onEnable(): void;
  54994. onDisable(): void;
  54995. onDestroy(): void;
  54996. update(dt: number): void;
  54997. protected _resizeNodeToTargetNode(): void;
  54998. protected _resetState(): void;
  54999. protected _registerNodeEvent(): void;
  55000. protected _registerTargetEvent(target: any): void;
  55001. protected _unregisterNodeEvent(): void;
  55002. protected _unregisterTargetEvent(target: any): void;
  55003. protected _getTargetSprite(target: Node | null): Sprite | null;
  55004. protected _applyTarget(): void;
  55005. protected _onTouchBegan(event?: EventTouch): void;
  55006. protected _onTouchMove(event?: EventTouch): void;
  55007. protected _onTouchEnded(event?: EventTouch): void;
  55008. protected _onTouchCancel(event?: EventTouch): void;
  55009. protected _onMouseMoveIn(event?: EventMouse): void;
  55010. protected _onMouseMoveOut(event?: EventMouse): void;
  55011. protected _updateState(): void;
  55012. protected _getButtonState(): string;
  55013. protected _updateColorTransition(state: string): void;
  55014. protected _updateSpriteTransition(state: string): void;
  55015. protected _updateScaleTransition(state: string): void;
  55016. protected _zoomUp(): void;
  55017. protected _zoomBack(): void;
  55018. protected _applyTransition(state: string): void;
  55019. }
  55020. /**
  55021. * @en
  55022. * `EditBox` is a component for inputing text, you can use it to gather small amounts of text from users.
  55023. *
  55024. * @zh
  55025. * `EditBox` 组件,用于获取用户的输入文本。
  55026. */
  55027. export class EditBox extends Component {
  55028. /**
  55029. * @en
  55030. * Input string of EditBox.
  55031. *
  55032. * @zh
  55033. * 输入框的初始输入内容,如果为空则会显示占位符的文本。
  55034. */
  55035. get string(): string;
  55036. set string(value: string);
  55037. /**
  55038. * @en
  55039. * The display text of placeholder.
  55040. *
  55041. * @zh
  55042. * 输入框占位符的文本内容。
  55043. */
  55044. get placeholder(): string;
  55045. set placeholder(value: string);
  55046. /**
  55047. * @en
  55048. * The Label component attached to the node for EditBox's input text label.
  55049. *
  55050. * @zh
  55051. * 输入框输入文本节点上挂载的 Label 组件对象。
  55052. */
  55053. get textLabel(): Label | null;
  55054. set textLabel(oldValue: Label | null);
  55055. /**
  55056. * @en
  55057. * The Label component attached to the node for EditBox's placeholder text label.
  55058. *
  55059. * @zh
  55060. * 输入框占位符节点上挂载的 Label 组件对象。
  55061. */
  55062. get placeholderLabel(): Label | null;
  55063. set placeholderLabel(oldValue: Label | null);
  55064. /**
  55065. * @en
  55066. * The background image of EditBox.
  55067. *
  55068. * @zh
  55069. * 输入框的背景图片。
  55070. */
  55071. get backgroundImage(): SpriteFrame | null;
  55072. set backgroundImage(value: SpriteFrame | null);
  55073. /**
  55074. * @en
  55075. * Set the input flags that are to be applied to the EditBox.
  55076. *
  55077. * @zh
  55078. * 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。
  55079. */
  55080. get inputFlag(): __private._cocos_ui_editbox_types__InputFlag;
  55081. set inputFlag(value: __private._cocos_ui_editbox_types__InputFlag);
  55082. /**
  55083. * @en
  55084. * Set the input mode of the edit box.
  55085. * If you pass ANY, it will create a multiline EditBox.
  55086. *
  55087. * @zh
  55088. * 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。
  55089. */
  55090. get inputMode(): __private._cocos_ui_editbox_types__InputMode;
  55091. set inputMode(oldValue: __private._cocos_ui_editbox_types__InputMode);
  55092. /**
  55093. * @en
  55094. * The return key type of EditBox.
  55095. * Note: it is meaningless for web platforms and desktop platforms.
  55096. *
  55097. * @zh
  55098. * 指定移动设备上面回车按钮的样式。
  55099. * 注意:这个选项对 web 平台与 desktop 平台无效。
  55100. */
  55101. get returnType(): __private._cocos_ui_editbox_types__KeyboardReturnType;
  55102. set returnType(value: __private._cocos_ui_editbox_types__KeyboardReturnType);
  55103. /**
  55104. * @en
  55105. * The maximize input length of EditBox.
  55106. * - If pass a value less than 0, it won't limit the input number of characters.
  55107. * - If pass 0, it doesn't allow input any characters.
  55108. *
  55109. * @zh
  55110. * 输入框最大允许输入的字符个数。
  55111. * - 如果值为小于 0 的值,则不会限制输入字符个数。
  55112. * - 如果值为 0,则不允许用户进行任何输入。
  55113. */
  55114. get maxLength(): number;
  55115. set maxLength(value: number);
  55116. /**
  55117. * @en
  55118. * Set the tabIndex of the DOM input element (only useful on Web).
  55119. *
  55120. * @zh
  55121. * 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。
  55122. */
  55123. get tabIndex(): number;
  55124. set tabIndex(value: number);
  55125. /**
  55126. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  55127. */
  55128. static _EditBoxImpl: typeof __private._cocos_ui_editbox_edit_box_impl_base__EditBoxImplBase;
  55129. /**
  55130. * @en Keyboard Return Type.
  55131. * @zh 键盘的返回键类型。
  55132. */
  55133. static KeyboardReturnType: typeof __private._cocos_ui_editbox_types__KeyboardReturnType;
  55134. /**
  55135. * @en Defines some flag bits for setting text display and text formatting.
  55136. * @zh 定义了一些用于设置文本显示和文本格式化的标志位。
  55137. */
  55138. static InputFlag: typeof __private._cocos_ui_editbox_types__InputFlag;
  55139. /**
  55140. * @en Input Mode.
  55141. * @zh 输入模式。
  55142. */
  55143. static InputMode: typeof __private._cocos_ui_editbox_types__InputMode;
  55144. /**
  55145. * @en Keyboard event enumeration.
  55146. * @zh 键盘的事件枚举。
  55147. */
  55148. static EventType: typeof __private._cocos_ui_editbox_edit_box__EventType;
  55149. /**
  55150. * @en
  55151. * The event handler to be called when EditBox began to edit text.
  55152. *
  55153. * @zh
  55154. * 开始编辑文本输入框触发的事件回调。
  55155. */
  55156. editingDidBegan: EventHandler[];
  55157. /**
  55158. * @en
  55159. * The event handler to be called when EditBox text changes.
  55160. *
  55161. * @zh
  55162. * 编辑文本输入框时触发的事件回调。
  55163. */
  55164. textChanged: EventHandler[];
  55165. /**
  55166. * @en
  55167. * The event handler to be called when EditBox edit ends.
  55168. *
  55169. * @zh
  55170. * 结束编辑文本输入框时触发的事件回调。
  55171. */
  55172. editingDidEnded: EventHandler[];
  55173. /**
  55174. * @en
  55175. * The event handler to be called when return key is pressed. Windows is not supported.
  55176. *
  55177. * @zh
  55178. * 当用户按下回车按键时的事件回调,目前不支持 windows 平台。
  55179. */
  55180. editingReturn: EventHandler[];
  55181. /**
  55182. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55183. */
  55184. _impl: __private._cocos_ui_editbox_edit_box_impl_base__EditBoxImplBase | null;
  55185. /**
  55186. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55187. */
  55188. _background: Sprite | null;
  55189. protected _textLabel: Label | null;
  55190. protected _placeholderLabel: Label | null;
  55191. protected _returnType: __private._cocos_ui_editbox_types__KeyboardReturnType;
  55192. protected _string: string;
  55193. protected _tabIndex: number;
  55194. protected _backgroundImage: SpriteFrame | null;
  55195. protected _inputFlag: __private._cocos_ui_editbox_types__InputFlag;
  55196. protected _inputMode: __private._cocos_ui_editbox_types__InputMode;
  55197. protected _maxLength: number;
  55198. __preload(): void;
  55199. onEnable(): void;
  55200. onDisable(): void;
  55201. onDestroy(): void;
  55202. /**
  55203. * @en Let the EditBox get focus.
  55204. * @zh 让当前 EditBox 获得焦点。
  55205. */
  55206. setFocus(): void;
  55207. /**
  55208. * @en Let the EditBox get focus.
  55209. * @zh 让当前 EditBox 获得焦点。
  55210. */
  55211. focus(): void;
  55212. /**
  55213. * @en Let the EditBox lose focus.
  55214. * @zh 让当前 EditBox 失去焦点。
  55215. */
  55216. blur(): void;
  55217. /**
  55218. * @en Determine whether EditBox is getting focus or not.
  55219. * @zh 判断 EditBox 是否获得了焦点。
  55220. * Note: only available on Web at the moment.
  55221. */
  55222. isFocused(): boolean;
  55223. /**
  55224. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55225. */
  55226. _editBoxEditingDidBegan(): void;
  55227. /**
  55228. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55229. * @param text content filtered by sensitive words.This parameter may be undefined.
  55230. * If relevant platform returns desensitized content, it will be passed to developer by EventType.EDITING_DID_ENDED.
  55231. * Now only ByteDance minigame platform
  55232. */
  55233. _editBoxEditingDidEnded(text?: string): void;
  55234. /**
  55235. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55236. */
  55237. _editBoxTextChanged(text: string): void;
  55238. /**
  55239. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55240. * @param text content filtered by sensitive words.This parameter may be undefined.
  55241. * If relevant platform returns desensitized content, it will be passed to developer by EventType.EDITING_RETURN.
  55242. * Now only ByteDance minigame platform
  55243. */
  55244. _editBoxEditingReturn(text?: string): void;
  55245. /**
  55246. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55247. */
  55248. _showLabels(): void;
  55249. /**
  55250. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  55251. */
  55252. _hideLabels(): void;
  55253. protected _onTouchBegan(event: EventTouch): void;
  55254. protected _onTouchCancel(event: EventTouch): void;
  55255. protected _onTouchEnded(event: EventTouch): void;
  55256. protected _init(): void;
  55257. protected _ensureBackgroundSprite(): void;
  55258. protected _updateTextLabel(): void;
  55259. protected _updatePlaceholderLabel(): void;
  55260. protected _syncSize(): void;
  55261. protected _updateLabels(): void;
  55262. protected _updateString(text: string): void;
  55263. protected _updateLabelStringStyle(text: string, ignorePassword?: boolean): string;
  55264. protected _registerEvent(): void;
  55265. protected _unregisterEvent(): void;
  55266. protected _updateLabelPosition(size: math.Size): void;
  55267. protected _resizeChildNodes(): void;
  55268. protected _xrUnClick(): void;
  55269. protected _xrKeyBoardInput(str: string): void;
  55270. }
  55271. /**
  55272. * @en
  55273. * The Layout is a container component, use it to arrange child elements easily.<br>
  55274. * Note:<br>
  55275. * 1.Scaling and rotation of child nodes are not considered.<br>
  55276. * 2.After setting the Layout, the results need to be updated until the next frame,unless you manually call.[[updateLayout]]
  55277. *
  55278. * @zh
  55279. * Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  55280. * 注意:<br>
  55281. * 1.不会考虑子节点的缩放和旋转。<br>
  55282. * 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用。[[updateLayout]]
  55283. */
  55284. export class Layout extends Component {
  55285. /**
  55286. * @en
  55287. * Alignment horizontal. Fixed starting position in the same direction when Type is Horizontal.
  55288. *
  55289. * @zh
  55290. * 横向对齐。在 Type 为 Horizontal 时按同个方向固定起始位置排列。
  55291. */
  55292. get alignHorizontal(): boolean;
  55293. set alignHorizontal(value: boolean);
  55294. /**
  55295. * @en
  55296. * Alignment vertical. Fixed starting position in the same direction when Type is Vertical.
  55297. *
  55298. * @zh
  55299. * 纵向对齐。在 Type 为 Horizontal 或 Vertical 时按同个方向固定起始位置排列。
  55300. */
  55301. get alignVertical(): boolean;
  55302. set alignVertical(value: boolean);
  55303. /**
  55304. * @en
  55305. * The layout type.
  55306. *
  55307. * @zh
  55308. * 布局类型。
  55309. */
  55310. get type(): __private._cocos_ui_layout__Type;
  55311. set type(value: __private._cocos_ui_layout__Type);
  55312. /**
  55313. * @en
  55314. * The are three resize modes for Layout. None, resize Container and resize children.
  55315. *
  55316. * @zh
  55317. * 缩放模式。
  55318. */
  55319. get resizeMode(): __private._cocos_ui_layout__ResizeMode;
  55320. set resizeMode(value: __private._cocos_ui_layout__ResizeMode);
  55321. /**
  55322. * @en
  55323. * The cell size for grid layout.
  55324. *
  55325. * @zh
  55326. * 每个格子的大小,只有布局类型为 GRID 的时候才有效。
  55327. */
  55328. get cellSize(): Readonly<math.Size>;
  55329. set cellSize(value: Readonly<math.Size>);
  55330. /**
  55331. * @en
  55332. * The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  55333. * and then break line on demand. Choose vertical if you want to layout vertically at first.
  55334. *
  55335. * @zh
  55336. * 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。
  55337. */
  55338. get startAxis(): __private._cocos_ui_layout__AxisDirection;
  55339. set startAxis(value: __private._cocos_ui_layout__AxisDirection);
  55340. /**
  55341. * @en
  55342. * The left padding of layout, it only effect the layout in one direction.
  55343. *
  55344. * @zh
  55345. * 容器内左边距,只会在一个布局方向上生效。
  55346. */
  55347. get paddingLeft(): number;
  55348. set paddingLeft(value: number);
  55349. /**
  55350. * @en
  55351. * The right padding of layout, it only effect the layout in one direction.
  55352. *
  55353. * @zh
  55354. * 容器内右边距,只会在一个布局方向上生效。
  55355. */
  55356. get paddingRight(): number;
  55357. set paddingRight(value: number);
  55358. /**
  55359. * @en
  55360. * The top padding of layout, it only effect the layout in one direction.
  55361. *
  55362. * @zh
  55363. * 容器内上边距,只会在一个布局方向上生效。
  55364. */
  55365. get paddingTop(): number;
  55366. set paddingTop(value: number);
  55367. /**
  55368. * @en
  55369. * The bottom padding of layout, it only effect the layout in one direction.
  55370. *
  55371. * @zh
  55372. * 容器内下边距,只会在一个布局方向上生效。
  55373. */
  55374. get paddingBottom(): number;
  55375. set paddingBottom(value: number);
  55376. /**
  55377. * @en
  55378. * The distance in x-axis between each element in layout.
  55379. *
  55380. * @zh
  55381. * 子节点之间的水平间距。
  55382. */
  55383. get spacingX(): number;
  55384. set spacingX(value: number);
  55385. /**
  55386. * @en
  55387. * The distance in y-axis between each element in layout.
  55388. *
  55389. * @zh
  55390. * 子节点之间的垂直间距。
  55391. */
  55392. get spacingY(): number;
  55393. set spacingY(value: number);
  55394. /**
  55395. * @en
  55396. * Only take effect in Vertical layout mode.
  55397. * This option changes the start element's positioning.
  55398. *
  55399. * @zh
  55400. * 垂直排列子节点的方向。
  55401. */
  55402. get verticalDirection(): __private._cocos_ui_layout__VerticalDirection;
  55403. set verticalDirection(value: __private._cocos_ui_layout__VerticalDirection);
  55404. /**
  55405. * @en
  55406. * Only take effect in horizontal layout mode.
  55407. * This option changes the start element's positioning.
  55408. *
  55409. * @zh
  55410. * 水平排列子节点的方向。
  55411. */
  55412. get horizontalDirection(): __private._cocos_ui_layout__HorizontalDirection;
  55413. set horizontalDirection(value: __private._cocos_ui_layout__HorizontalDirection);
  55414. /**
  55415. * @en
  55416. * The padding of layout, it will effect the layout in horizontal and vertical direction.
  55417. *
  55418. * @zh
  55419. * 容器内边距,该属性会在四个布局方向上生效。
  55420. */
  55421. get padding(): number;
  55422. set padding(value: number);
  55423. /**
  55424. * @en
  55425. * The layout constraint inside the container.
  55426. *
  55427. * @zh
  55428. * 容器内布局约束。
  55429. */
  55430. get constraint(): __private._cocos_ui_layout__Constraint;
  55431. set constraint(value: __private._cocos_ui_layout__Constraint);
  55432. /**
  55433. * @en
  55434. * The limit value used by the layout constraint inside the container.
  55435. *
  55436. * @zh
  55437. * 容器内布局约束使用的限定值。
  55438. */
  55439. get constraintNum(): number;
  55440. set constraintNum(value: number);
  55441. /**
  55442. * @en
  55443. * Adjust the layout if the children scaled.
  55444. *
  55445. * @zh
  55446. * 子节点缩放比例是否影响布局。
  55447. */
  55448. get affectedByScale(): boolean;
  55449. set affectedByScale(value: boolean);
  55450. /**
  55451. * @en Layout type.
  55452. * @zh 布局类型。
  55453. */
  55454. static Type: typeof __private._cocos_ui_layout__Type;
  55455. /**
  55456. * @en Vertical layout direction.
  55457. * @zh 垂直方向布局方式。
  55458. */
  55459. static VerticalDirection: typeof __private._cocos_ui_layout__VerticalDirection;
  55460. /**
  55461. * @en Horizontal layout direction.
  55462. * @zh 水平方向布局方式。
  55463. */
  55464. static HorizontalDirection: typeof __private._cocos_ui_layout__HorizontalDirection;
  55465. /**
  55466. * @en Layout Resize Mode.
  55467. * @zh 缩放模式。
  55468. */
  55469. static ResizeMode: typeof __private._cocos_ui_layout__ResizeMode;
  55470. /**
  55471. * @en Grid Layout start axis direction.
  55472. * @zh 布局轴向,只用于 GRID 布局。
  55473. */
  55474. static AxisDirection: typeof __private._cocos_ui_layout__AxisDirection;
  55475. /**
  55476. * @en Layout constraint.
  55477. * @zh 布局约束。
  55478. */
  55479. static Constraint: typeof __private._cocos_ui_layout__Constraint;
  55480. protected _resizeMode: __private._cocos_ui_layout__ResizeMode;
  55481. protected _layoutType: __private._cocos_ui_layout__Type;
  55482. protected _cellSize: math.Size;
  55483. protected _startAxis: __private._cocos_ui_layout__AxisDirection;
  55484. protected _paddingLeft: number;
  55485. protected _paddingRight: number;
  55486. protected _paddingTop: number;
  55487. protected _paddingBottom: number;
  55488. protected _spacingX: number;
  55489. protected _spacingY: number;
  55490. protected _verticalDirection: __private._cocos_ui_layout__VerticalDirection;
  55491. protected _horizontalDirection: __private._cocos_ui_layout__HorizontalDirection;
  55492. protected _constraint: __private._cocos_ui_layout__Constraint;
  55493. protected _constraintNum: number;
  55494. protected _affectedByScale: boolean;
  55495. protected _isAlign: boolean;
  55496. protected _layoutSize: math.Size;
  55497. protected _layoutDirty: boolean;
  55498. protected _childrenDirty: boolean;
  55499. protected _usefulLayoutObj: UITransform[];
  55500. protected _init: boolean;
  55501. /**
  55502. * @en
  55503. * Perform the layout update.
  55504. *
  55505. * @zh
  55506. * 立即执行更新布局。
  55507. * @param force @en force update or not. @zh 是否强制更新。
  55508. * @example
  55509. * ```ts
  55510. * import { Layout, log } from 'cc';
  55511. * layout.type = Layout.Type.HORIZONTAL;
  55512. * layout.node.addChild(childNode);
  55513. * log(childNode.x); // not yet changed
  55514. * layout.updateLayout();
  55515. * log(childNode.x); // changed
  55516. * ```
  55517. */
  55518. updateLayout(force?: boolean): void;
  55519. protected onEnable(): void;
  55520. protected onDisable(): void;
  55521. protected _checkUsefulObj(): void;
  55522. protected _addEventListeners(): void;
  55523. protected _removeEventListeners(): void;
  55524. protected _addChildrenEventListeners(): void;
  55525. protected _removeChildrenEventListeners(): void;
  55526. protected _childAdded(child: Node): void;
  55527. protected _childRemoved(child: Node): void;
  55528. protected _resized(): void;
  55529. protected _doLayoutHorizontally(baseWidth: number, rowBreak: boolean, fnPositionY: (...args: any[]) => number, applyChildren: boolean): number;
  55530. protected _doLayoutVertically(baseHeight: number, columnBreak: boolean, fnPositionX: (...args: any[]) => number, applyChildren: boolean): number;
  55531. protected _doLayoutGridAxisHorizontal(layoutAnchor: math.Vec2 | Readonly<math.Vec2>, layoutSize: math.Size): void;
  55532. protected _doLayoutGridAxisVertical(layoutAnchor: math.Vec2 | Readonly<math.Vec2>, layoutSize: math.Size): void;
  55533. protected _doLayoutGrid(): void;
  55534. protected _getHorizontalBaseWidth(horizontal?: boolean): number;
  55535. protected _getVerticalBaseHeight(): number;
  55536. protected _doLayout(): void;
  55537. protected _getUsedScaleValue(value: number): number;
  55538. protected _transformDirty(type: TransformBit): void;
  55539. protected _doLayoutDirty(): void;
  55540. protected _childrenChanged(): void;
  55541. protected _getPaddingH(): number;
  55542. protected _getPaddingV(): number;
  55543. protected _getFixedBreakingNum(): number;
  55544. }
  55545. /**
  55546. * @en
  55547. * Visual indicator of progress in some operation.
  55548. * Displays a bar to the user representing how far the operation has progressed.
  55549. *
  55550. * @zh
  55551. * 进度条组件,可用于显示加载资源时的进度。
  55552. *
  55553. * @example
  55554. * ```ts
  55555. * // update progressBar
  55556. * update(dt) {
  55557. * var progress = progressBar.progress;
  55558. * if (progress > 0) {
  55559. * progress += dt;
  55560. * }
  55561. * else {
  55562. * progress = 1;
  55563. * }
  55564. * progressBar.progress = progress;
  55565. * }
  55566. * ```
  55567. */
  55568. export class ProgressBar extends Component {
  55569. /**
  55570. * @en
  55571. * The targeted Sprite which will be changed progressively.
  55572. *
  55573. * @zh
  55574. * 用来显示进度条比例的 Sprite 对象。
  55575. */
  55576. get barSprite(): Sprite | null;
  55577. set barSprite(value: Sprite | null);
  55578. /**
  55579. * @en
  55580. * The progress mode, there are two modes supported now: horizontal and vertical.
  55581. *
  55582. * @zh
  55583. * 进度条的模式。
  55584. */
  55585. get mode(): __private._cocos_ui_progress_bar__Mode;
  55586. set mode(value: __private._cocos_ui_progress_bar__Mode);
  55587. /**
  55588. * @en
  55589. * The total width or height of the bar sprite.
  55590. *
  55591. * @zh
  55592. * 进度条实际的总长度。
  55593. */
  55594. get totalLength(): number;
  55595. set totalLength(value: number);
  55596. /**
  55597. * @en
  55598. * The current progress of the bar sprite. The valid value is between 0-1.
  55599. *
  55600. * @zh
  55601. * 当前进度值,该数值的区间是 0-1 之间。
  55602. */
  55603. get progress(): number;
  55604. set progress(value: number);
  55605. /**
  55606. * @en
  55607. * Whether reverse the progress direction of the bar sprite.
  55608. *
  55609. * @zh
  55610. * 进度条是否进行反方向变化。
  55611. */
  55612. get reverse(): boolean;
  55613. set reverse(value: boolean);
  55614. static Mode: typeof __private._cocos_ui_progress_bar__Mode;
  55615. protected _barSprite: Sprite | null;
  55616. protected _mode: __private._cocos_ui_progress_bar__Mode;
  55617. protected _totalLength: number;
  55618. protected _progress: number;
  55619. protected _reverse: boolean;
  55620. protected onLoad(): void;
  55621. protected _initBarSprite(): void;
  55622. protected _updateBarStatus(): void;
  55623. }
  55624. /**
  55625. * @en
  55626. * The ScrollBar control allows the user to scroll an image or other view that is too large to see completely.
  55627. *
  55628. * @zh
  55629. * 滚动条组件。
  55630. */
  55631. export class ScrollBar extends Component {
  55632. /**
  55633. * @en
  55634. * The "handle" part of the ScrollBar.
  55635. *
  55636. * @zh
  55637. * 作为当前滚动区域位置显示的滑块 Sprite。
  55638. */
  55639. get handle(): Sprite | null;
  55640. set handle(value: Sprite | null);
  55641. /**
  55642. * @en
  55643. * The direction of scrolling.
  55644. *
  55645. * @zh
  55646. * ScrollBar 的滚动方向。
  55647. */
  55648. get direction(): __private._cocos_ui_scroll_bar__Direction;
  55649. set direction(value: __private._cocos_ui_scroll_bar__Direction);
  55650. /**
  55651. * @en
  55652. * Whether enable auto hide or not.
  55653. *
  55654. * @zh
  55655. * 是否在没有滚动动作时自动隐藏 ScrollBar。
  55656. */
  55657. get enableAutoHide(): boolean;
  55658. set enableAutoHide(value: boolean);
  55659. /**
  55660. * @en
  55661. * The time to hide ScrollBar when scroll finished.
  55662. * Note: This value is only useful when enableAutoHide is true.
  55663. *
  55664. * @zh
  55665. * 没有滚动动作后经过多久会自动隐藏。<br/>
  55666. * 注意:只要当 “enableAutoHide” 为 true 时,才有效。
  55667. */
  55668. get autoHideTime(): number;
  55669. set autoHideTime(value: number);
  55670. static Direction: typeof __private._cocos_ui_scroll_bar__Direction;
  55671. protected _scrollView: ScrollView | null;
  55672. protected _handle: Sprite | null;
  55673. protected _direction: __private._cocos_ui_scroll_bar__Direction;
  55674. protected _enableAutoHide: boolean;
  55675. protected _autoHideTime: number;
  55676. protected _touching: boolean;
  55677. protected _opacity: number;
  55678. protected _autoHideRemainingTime: number;
  55679. /**
  55680. * @en
  55681. * Hide ScrollBar.
  55682. *
  55683. * @zh
  55684. * 滚动条隐藏。
  55685. */
  55686. hide(): void;
  55687. /**
  55688. * @en
  55689. * Show ScrollBar.
  55690. *
  55691. * @zh
  55692. * 滚动条显示。
  55693. */
  55694. show(): void;
  55695. /**
  55696. * @en
  55697. * Reset the position of ScrollBar.
  55698. *
  55699. * @zh
  55700. * 重置滚动条位置。
  55701. *
  55702. * @param outOfBoundary @en Rolling displacement. @zh 滚动位移。
  55703. */
  55704. onScroll(outOfBoundary: math.Vec2 | Readonly<math.Vec2>): void;
  55705. /**
  55706. * @en
  55707. * Sets the scroll view.
  55708. *
  55709. * @zh
  55710. * 滚动视窗设置。
  55711. *
  55712. * @param scrollView @en The scroll view which is attached with this scroll bar. @zh 当前滚动条附着的滚动视窗。
  55713. */
  55714. setScrollView(scrollView: ScrollView): void;
  55715. onTouchBegan(): void;
  55716. onTouchEnded(): void;
  55717. protected onEnable(): void;
  55718. protected start(): void;
  55719. protected update(dt: any): void;
  55720. protected _convertToScrollViewSpace(out: math.Vec2, content: Node): void;
  55721. protected _setOpacity(opacity: number): void;
  55722. protected _updateHandlerPosition(position: math.Vec2): void;
  55723. protected _fixupHandlerPosition(out: math.Vec3): void;
  55724. protected _conditionalDisableScrollBar(contentSize: math.Size, scrollViewSize: math.Size): boolean;
  55725. protected _calculateLength(contentMeasure: number, scrollViewMeasure: number, handleNodeMeasure: number, outOfBoundary: number): number;
  55726. protected _calculatePosition(out: math.Vec2, contentMeasure: number, scrollViewMeasure: number, handleNodeMeasure: number, contentPosition: number, outOfBoundary: number, actualLenth: number): void;
  55727. protected _updateLength(length: number): void;
  55728. protected _processAutoHide(deltaTime: number): void;
  55729. }
  55730. /**
  55731. * @en
  55732. * Layout container for a view hierarchy that can be scrolled by the user,
  55733. * allowing it to be larger than the physical display.
  55734. *
  55735. * @zh
  55736. * 滚动视图组件。
  55737. */
  55738. export class ScrollView extends ViewGroup {
  55739. static EventType: typeof __private._cocos_ui_scroll_view__EventType;
  55740. /**
  55741. * @en
  55742. * The elapse time of bouncing back. A value of 0 will bounce back immediately.
  55743. *
  55744. * @zh
  55745. * 回弹持续的时间,0 表示将立即反弹。
  55746. */
  55747. bounceDuration: number;
  55748. /**
  55749. * @en
  55750. * It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  55751. * A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  55752. *
  55753. * @zh
  55754. * 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。
  55755. */
  55756. brake: number;
  55757. /**
  55758. * @en
  55759. * When elastic is set, the content will be bounce back when move out of boundary.
  55760. *
  55761. * @zh
  55762. * 是否允许滚动内容超过边界,并在停止触摸后回弹。
  55763. */
  55764. elastic: boolean;
  55765. /**
  55766. * @en
  55767. * When inertia is set, the content will continue to move when touch ended.
  55768. *
  55769. * @zh
  55770. * 是否开启滚动惯性。
  55771. */
  55772. inertia: boolean;
  55773. /**
  55774. * @en
  55775. * This is a reference to the UI element to be scrolled.
  55776. *
  55777. * @zh
  55778. * 可滚动展示内容的节点。
  55779. */
  55780. get content(): Node | null;
  55781. set content(value: Node | null);
  55782. /**
  55783. * @en
  55784. * Enable horizontal scroll.
  55785. *
  55786. * @zh
  55787. * 是否开启水平滚动。
  55788. */
  55789. horizontal: boolean;
  55790. /**
  55791. * @en
  55792. * The horizontal scrollbar reference.
  55793. * @zh
  55794. * 水平滚动的 ScrollBar。
  55795. */
  55796. get horizontalScrollBar(): ScrollBar | null;
  55797. set horizontalScrollBar(value: ScrollBar | null);
  55798. /**
  55799. * @en
  55800. * Enable vertical scroll.
  55801. *
  55802. * @zh
  55803. * 是否开启垂直滚动。
  55804. */
  55805. vertical: boolean;
  55806. /**
  55807. * @en
  55808. * The vertical scrollbar reference.
  55809. *
  55810. * @zh
  55811. * 垂直滚动的 ScrollBar。
  55812. */
  55813. get verticalScrollBar(): ScrollBar | null;
  55814. set verticalScrollBar(value: ScrollBar | null);
  55815. /**
  55816. * @en
  55817. * If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  55818. * It's set to true by default.
  55819. *
  55820. * @zh
  55821. * 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。<br/>
  55822. * 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。
  55823. */
  55824. cancelInnerEvents: boolean;
  55825. /**
  55826. * @en
  55827. * ScrollView events callback.
  55828. *
  55829. * @zh
  55830. * 滚动视图的事件回调函数。
  55831. */
  55832. scrollEvents: EventHandler[];
  55833. /**
  55834. * @en The display view in the scroll view component.
  55835. * @zh scroll view 组件中的显示区域。
  55836. */
  55837. get view(): UITransform | null;
  55838. protected _autoScrolling: boolean;
  55839. protected _scrolling: boolean;
  55840. protected _content: Node | null;
  55841. protected _horizontalScrollBar: ScrollBar | null;
  55842. protected _verticalScrollBar: ScrollBar | null;
  55843. protected _topBoundary: number;
  55844. protected _bottomBoundary: number;
  55845. protected _leftBoundary: number;
  55846. protected _rightBoundary: number;
  55847. protected _touchMoveDisplacements: math.Vec3[];
  55848. protected _touchMoveTimeDeltas: number[];
  55849. protected _touchMovePreviousTimestamp: number;
  55850. protected _touchMoved: boolean;
  55851. protected _autoScrollAttenuate: boolean;
  55852. protected _autoScrollStartPosition: math.Vec3;
  55853. protected _autoScrollTargetDelta: math.Vec3;
  55854. protected _autoScrollTotalTime: number;
  55855. protected _autoScrollAccumulatedTime: number;
  55856. protected _autoScrollCurrentlyOutOfBoundary: boolean;
  55857. protected _autoScrollBraking: boolean;
  55858. protected _autoScrollBrakingStartPosition: math.Vec3;
  55859. protected _outOfBoundaryAmount: math.Vec3;
  55860. protected _outOfBoundaryAmountDirty: boolean;
  55861. protected _stopMouseWheel: boolean;
  55862. protected _mouseWheelEventElapsedTime: number;
  55863. protected _isScrollEndedWithThresholdEventFired: boolean;
  55864. protected _scrollEventEmitMask: number;
  55865. protected _isBouncing: boolean;
  55866. protected _contentPos: math.Vec3;
  55867. protected _deltaPos: math.Vec3;
  55868. protected _deltaAmount: math.Vec3;
  55869. protected _hoverIn: __private._cocos_ui_scroll_view__XrhoverType;
  55870. /**
  55871. * @en
  55872. * Scroll the content to the bottom boundary of ScrollView.
  55873. *
  55874. * @zh
  55875. * 视图内容将在规定时间内滚动到视图底部。
  55876. *
  55877. * @param timeInSecond
  55878. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55879. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true) @zh 滚动加速是否衰减,默认为 true
  55880. * @example
  55881. * ```ts
  55882. * // Scroll to the bottom of the view.
  55883. * scrollView.scrollToBottom(0.1);
  55884. * ```
  55885. */
  55886. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  55887. /**
  55888. * @en
  55889. * Scroll the content to the top boundary of ScrollView.
  55890. *
  55891. * @zh
  55892. * 视图内容将在规定时间内滚动到视图顶部。
  55893. *
  55894. * @param timeInSecond
  55895. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55896. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true
  55897. * @example
  55898. * ```ts
  55899. * // Scroll to the top of the view.
  55900. * scrollView.scrollToTop(0.1);
  55901. * ```
  55902. */
  55903. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  55904. /**
  55905. * @en
  55906. * Scroll the content to the left boundary of ScrollView.
  55907. *
  55908. * @zh
  55909. * 视图内容将在规定时间内滚动到视图左边。
  55910. *
  55911. * @param timeInSecond
  55912. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55913. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55914. * @example
  55915. * ```ts
  55916. * // Scroll to the left of the view.
  55917. * scrollView.scrollToLeft(0.1);
  55918. * ```
  55919. */
  55920. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  55921. /**
  55922. * @en
  55923. * Scroll the content to the right boundary of ScrollView.
  55924. *
  55925. * @zh
  55926. * 视图内容将在规定时间内滚动到视图右边。
  55927. *
  55928. * @param timeInSecond
  55929. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55930. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55931. * @example
  55932. * ```ts
  55933. * // Scroll to the right of the view.
  55934. * scrollView.scrollToRight(0.1);
  55935. * ```
  55936. */
  55937. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  55938. /**
  55939. * @en
  55940. * Scroll the content to the top left boundary of ScrollView.
  55941. *
  55942. * @zh
  55943. * 视图内容将在规定时间内滚动到视图左上角。
  55944. *
  55945. * @param timeInSecond
  55946. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55947. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55948. * @example
  55949. * ```ts
  55950. * // Scroll to the upper left corner of the view.
  55951. * scrollView.scrollToTopLeft(0.1);
  55952. * ```
  55953. */
  55954. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  55955. /**
  55956. * @en
  55957. * Scroll the content to the top right boundary of ScrollView.
  55958. *
  55959. * @zh
  55960. * 视图内容将在规定时间内滚动到视图右上角。
  55961. *
  55962. * @param timeInSecond
  55963. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55964. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55965. * @example
  55966. * ```ts
  55967. * // Scroll to the top right corner of the view.
  55968. * scrollView.scrollToTopRight(0.1);
  55969. * ```
  55970. */
  55971. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  55972. /**
  55973. * @en
  55974. * Scroll the content to the bottom left boundary of ScrollView.
  55975. *
  55976. * @zh
  55977. * 视图内容将在规定时间内滚动到视图左下角。
  55978. *
  55979. * @param timeInSecond
  55980. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55981. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55982. * @example
  55983. * ```ts
  55984. * // Scroll to the lower left corner of the view.
  55985. * scrollView.scrollToBottomLeft(0.1);
  55986. * ```
  55987. */
  55988. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  55989. /**
  55990. * @en
  55991. * Scroll the content to the bottom right boundary of ScrollView.
  55992. *
  55993. * @zh
  55994. * 视图内容将在规定时间内滚动到视图右下角。
  55995. *
  55996. * @param timeInSecond
  55997. * @en The rolling time(in seconds). If time is up, the content will slide to the bottom border. @zh 滚动时间(s)。 如果超时,内容将立即跳到底部边界。
  55998. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  55999. * @example
  56000. * ```ts
  56001. * // Scroll to the lower right corner of the view.
  56002. * scrollView.scrollToBottomRight(0.1);
  56003. * ```
  56004. */
  56005. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  56006. /**
  56007. * @en
  56008. * Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted,
  56009. * then it will jump to the specific offset immediately.
  56010. *
  56011. * @zh
  56012. * 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond 参数不传,则立即滚动到指定偏移位置。
  56013. *
  56014. * @param offset
  56015. * @en After scrolling the view, the position of the view content relative to the view window. @zh 滚动视图后,视图内容(content)相对于视图窗口(viewport)的位置。
  56016. * @param timeInSecond
  56017. * @en Scroll time (s). If it times out, the content immediately jumps to the specified offset. @zh 滚动时间(s)。 如果超时,内容将立即跳到指定偏移量处。
  56018. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  56019. * @example
  56020. * ```ts
  56021. * // Scroll to middle position in 0.1 second in x-axis
  56022. * let maxScrollOffset = this.getMaxScrollOffset();
  56023. * scrollView.scrollToOffset(new Vec2(maxScrollOffset.x / 2, 0), 0.1);
  56024. * ```
  56025. */
  56026. scrollToOffset(offset: math.Vec2, timeInSecond?: number, attenuated?: boolean): void;
  56027. /**
  56028. * @en
  56029. * Get the position of the scrolling view relative to the origin in the upper-left corner of the viewport.
  56030. *
  56031. * @zh
  56032. * 获取滚动视图相对于视图窗口左上角原点的位置。
  56033. *
  56034. * @return @en Current rolling offset. @zh 当前滚动偏移量。
  56035. */
  56036. getScrollOffset(): math.Vec2;
  56037. /**
  56038. * @en
  56039. * Get the maximize available scroll offset.
  56040. *
  56041. * @zh
  56042. * 获取滚动视图最大可以滚动的偏移量。
  56043. *
  56044. * @return @en Maximum scrollable offset. @zh 最大可滚动偏移量。
  56045. */
  56046. getMaxScrollOffset(): math.Vec2;
  56047. /**
  56048. * @en
  56049. * Scroll the content to the horizontal percent position of ScrollView.
  56050. *
  56051. * @zh
  56052. * 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  56053. *
  56054. * @param percent
  56055. * @en Scroll to the destination which is located at the percent interpolation from left border to the right border @zh 滚动到从左到右指定百分比插值的位置
  56056. * @param timeInSecond
  56057. * @en Scroll time (s). If it times out, the content immediately jumps to the specified offset. @zh 滚动时间(s)。 如果超时,内容将立即跳到指定偏移量处。
  56058. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  56059. * @example
  56060. * ```ts
  56061. * // Scroll to middle position.
  56062. * scrollView.scrollToBottomRight(0.5, 0.1);
  56063. * ```
  56064. */
  56065. scrollToPercentHorizontal(percent: number, timeInSecond: number, attenuated: boolean): void;
  56066. /**
  56067. * @en
  56068. * Scroll the content to the percent position of ScrollView in any direction.
  56069. *
  56070. * @zh
  56071. * 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  56072. *
  56073. * @param anchor
  56074. * @en Scroll to the destination which is located at the anchor interpolation from left/top border to the right/bottom border.
  56075. * @zh 滚动到从左/上到右/下指定锚点对应分量插值的位置。
  56076. * @param timeInSecond
  56077. * @en Scroll time (s). If it times out, the content immediately jumps to the specified offset. @zh 滚动时间(s)。 如果超时,内容将立即跳到指定偏移量处。
  56078. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  56079. * @example
  56080. * ```ts
  56081. * // Vertical scroll to the bottom of the view.
  56082. * scrollView.scrollTo(new Vec2(0, 1), 0.1);
  56083. *
  56084. * // Horizontal scroll to view right.
  56085. * scrollView.scrollTo(new Vec2(1, 0), 0.1);
  56086. * ```
  56087. */
  56088. scrollTo(anchor: math.Vec2, timeInSecond?: number, attenuated?: boolean): void;
  56089. /**
  56090. * @en
  56091. * Scroll the content to the vertical percent position of ScrollView.
  56092. *
  56093. * @zh
  56094. * 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  56095. *
  56096. * @param percent
  56097. * @en Scroll to the destination which is located at the percent interpolation from top border to the bottom border. @zh 滚动到从上到下指定百分比插值的位置。
  56098. * @param timeInSecond
  56099. * @en Scroll time (s). If it times out, the content immediately jumps to the specified offset. @zh 滚动时间(s)。 如果超时,内容将立即跳到指定偏移量处。
  56100. * @param attenuated @en Whether the rolling acceleration is attenuated(The default is true). @zh 滚动加速是否衰减,默认为 true。
  56101. * @example
  56102. * ```ts
  56103. * scrollView.scrollToPercentVertical(0.5, 0.1);
  56104. * ```
  56105. */
  56106. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  56107. /**
  56108. * @en
  56109. * Stop auto scroll immediately.
  56110. *
  56111. * @zh
  56112. * 停止自动滚动, 调用此 API 可以让 ScrollView 立即停止滚动。
  56113. */
  56114. stopAutoScroll(): void;
  56115. /**
  56116. * @en
  56117. * Modify the content position.
  56118. *
  56119. * @zh
  56120. * 设置当前视图内容的坐标点。
  56121. *
  56122. * @param position @en Current content position. @zh 希望设置内容框体的位置。
  56123. * @deprecated Since 3.1.0, setContentPosition is deprecated, please use scrollToOffset instead.
  56124. */
  56125. setContentPosition(position: math.Vec3): void;
  56126. /**
  56127. * @en
  56128. * Query the content's position in its parent space.
  56129. *
  56130. * @zh
  56131. * 获取当前视图内容的坐标点。
  56132. *
  56133. * @returns @en current content position. @zh 当前视图内容的坐标点。
  56134. * @deprecated Since 3.1.0, getContentPosition is deprecated.
  56135. */
  56136. getContentPosition(): math.Vec3;
  56137. /**
  56138. * @en
  56139. * Query whether the user is currently dragging the ScrollView to scroll it.
  56140. *
  56141. * @zh
  56142. * 用户是否在拖拽当前滚动视图。
  56143. *
  56144. * @returns @en If or not the current scrolling view is being dragged. @zh 是否在拖拽当前滚动视图。
  56145. */
  56146. isScrolling(): boolean;
  56147. /**
  56148. * @en
  56149. * Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  56150. *
  56151. * @zh
  56152. * 当前滚动视图是否在惯性滚动。
  56153. *
  56154. * @returns @en Whether the scrolling view is scrolling inertially. @zh 滚动视图是否在惯性滚动。
  56155. */
  56156. isAutoScrolling(): boolean;
  56157. /**
  56158. * @en Get the minimum precision time of the end-of-scroll event.
  56159. * @zh 获得滚动结束的事件的最小精度时间。
  56160. * @returns @en Minimum time. @zh 最小时间。
  56161. */
  56162. getScrollEndedEventTiming(): number;
  56163. start(): void;
  56164. onEnable(): void;
  56165. update(dt: number): void;
  56166. onDisable(): void;
  56167. protected _registerEvent(): void;
  56168. protected _unregisterEvent(): void;
  56169. protected _onMouseWheel(event: EventMouse, captureListeners?: Node[]): void;
  56170. protected _onTouchBegan(event: EventTouch, captureListeners?: Node[]): void;
  56171. protected _onTouchMoved(event: EventTouch, captureListeners?: Node[]): void;
  56172. protected _onTouchEnded(event: EventTouch, captureListeners?: Node[]): void;
  56173. protected _onTouchCancelled(event: EventTouch, captureListeners?: Node[]): void;
  56174. protected _calculateBoundary(): void;
  56175. protected _hasNestedViewGroup(event: Event, captureListeners?: Node[]): boolean;
  56176. protected _startInertiaScroll(touchMoveVelocity: math.Vec3): void;
  56177. protected _calculateAttenuatedFactor(distance: number): number;
  56178. protected _startAttenuatingAutoScroll(deltaMove: math.Vec3, initialVelocity: math.Vec3): void;
  56179. protected _calculateAutoScrollTimeByInitialSpeed(initialSpeed: number): number;
  56180. protected _startAutoScroll(deltaMove: math.Vec3, timeInSecond: number, attenuated?: boolean): void;
  56181. protected _calculateTouchMoveVelocity(): math.Vec3;
  56182. protected _flattenVectorByDirection(vector: math.Vec3): math.Vec3;
  56183. protected _moveContent(deltaMove: math.Vec3, canStartBounceBack?: boolean): void;
  56184. protected _getContentLeftBoundary(): number;
  56185. protected _getContentRightBoundary(): number;
  56186. protected _getContentTopBoundary(): number;
  56187. protected _getContentBottomBoundary(): number;
  56188. protected _getHowMuchOutOfBoundary(addition?: math.Vec3): math.Vec3;
  56189. protected _updateScrollBar(outOfBoundary: math.Vec2 | Readonly<math.Vec2>): void;
  56190. protected _onScrollBarTouchBegan(): void;
  56191. protected _onScrollBarTouchEnded(): void;
  56192. protected _dispatchEvent(event: string): void;
  56193. protected _adjustContentOutOfBoundary(): void;
  56194. protected _hideScrollBar(): void;
  56195. protected _updateScrollBarState(): void;
  56196. protected _stopPropagationIfTargetIsMe(event: Event): void;
  56197. protected _processDeltaMove(deltaMove: math.Vec3): void;
  56198. protected _handleMoveLogic(touch: Touch): void;
  56199. protected _handleReleaseLogic(touch: Touch): void;
  56200. protected _getLocalAxisAlignDelta(out: math.Vec3, touch: Touch): void;
  56201. protected _scrollChildren(deltaMove: math.Vec3): void;
  56202. protected _handlePressLogic(): void;
  56203. protected _clampDelta(out: math.Vec3): void;
  56204. protected _gatherTouchMove(delta: math.Vec3): void;
  56205. protected _startBounceBackIfNeeded(): boolean;
  56206. protected _processInertiaScroll(): void;
  56207. protected _isOutOfBoundary(): boolean;
  56208. protected _isNecessaryAutoScrollBrake(): boolean;
  56209. protected _processAutoScrolling(dt: any): void;
  56210. protected _checkMouseWheel(dt: number): void;
  56211. protected _calculateMovePercentDelta(options: any): math.Vec3;
  56212. protected _moveContentToTopLeft(scrollViewSize: math.Size): void;
  56213. protected _scaleChanged(value: TransformBit): void;
  56214. protected _xrHoverEnter(event: XrUIPressEvent): void;
  56215. protected _xrHoverExit(event: XrUIPressEvent): void;
  56216. protected _xrThumbStickMove(event: math.Vec2): void;
  56217. }
  56218. /**
  56219. * @en
  56220. * The Slider Control.
  56221. *
  56222. * @zh
  56223. * 滑动器组件。
  56224. */
  56225. export class Slider extends Component {
  56226. /**
  56227. * @en
  56228. * The "handle" part of the slider.
  56229. *
  56230. * @zh
  56231. * 滑动器滑块按钮部件。
  56232. */
  56233. get handle(): Sprite | null;
  56234. set handle(value: Sprite | null);
  56235. /**
  56236. * @en
  56237. * The slider direction.
  56238. *
  56239. * @zh
  56240. * 滑动器方向。
  56241. */
  56242. get direction(): number;
  56243. set direction(value: number);
  56244. /**
  56245. * @en
  56246. * The current progress of the slider. The valid value is between 0-1.
  56247. *
  56248. * @zh
  56249. * 当前进度值,该数值的区间是 0-1 之间。
  56250. */
  56251. get progress(): number;
  56252. set progress(value: number);
  56253. static Direction: typeof __private._cocos_ui_slider__Direction;
  56254. /**
  56255. * @en
  56256. * The slider slide events' callback array.
  56257. *
  56258. * @zh
  56259. * 滑动器组件滑动事件回调函数数组。
  56260. */
  56261. slideEvents: EventHandler[];
  56262. __preload(): void;
  56263. onEnable(): void;
  56264. onDisable(): void;
  56265. protected _onHandleDragStart(event?: EventTouch): void;
  56266. protected _onTouchBegan(event?: EventTouch): void;
  56267. protected _onTouchMoved(event?: EventTouch): void;
  56268. protected _onTouchEnded(event?: EventTouch): void;
  56269. protected _onTouchCancelled(event?: EventTouch): void;
  56270. protected _handleSliderLogic(touch: Touch | null): void;
  56271. protected _emitSlideEvent(): void;
  56272. protected _updateProgress(touch: Touch | null): void;
  56273. protected _updateHandlePosition(): void;
  56274. protected _xrHandleProgress(point: math.Vec3): void;
  56275. protected _xrClick(event: XrUIPressEvent): void;
  56276. protected _xrUnClick(): void;
  56277. protected _xrHoverStay(event: XrUIPressEvent): void;
  56278. }
  56279. /**
  56280. * @en
  56281. * The toggle component is a CheckBox, when it used together with a ToggleGroup,
  56282. * it could be treated as a RadioButton.
  56283. *
  56284. * @zh
  56285. * Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。
  56286. */
  56287. export class Toggle extends Button {
  56288. /**
  56289. * @en
  56290. * When this value is true, the check mark component will be enabled,
  56291. * otherwise the check mark component will be disabled.
  56292. *
  56293. * @zh
  56294. * 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。
  56295. */
  56296. get isChecked(): boolean;
  56297. set isChecked(value: boolean);
  56298. /**
  56299. * @en
  56300. * The image used for the checkmark.
  56301. *
  56302. * @zh
  56303. * Toggle 处于选中状态时显示的图片。
  56304. */
  56305. get checkMark(): Sprite | null;
  56306. set checkMark(value: Sprite | null);
  56307. /**
  56308. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  56309. */
  56310. set _resizeToTarget(value: boolean);
  56311. /**
  56312. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56313. */
  56314. get _toggleContainer(): ToggleContainer | null;
  56315. /**
  56316. * @en Enum for toggle event.
  56317. * @zh toggle 事件枚举。
  56318. */
  56319. static EventType: typeof __private._cocos_ui_toggle__EventType & typeof __private._cocos_ui_button__EventType;
  56320. /**
  56321. * @en
  56322. * If Toggle is clicked, it will trigger event's handler.
  56323. *
  56324. * @zh
  56325. * Toggle 按钮的点击事件列表。
  56326. */
  56327. checkEvents: EventHandler[];
  56328. protected _isChecked: boolean;
  56329. protected _checkMark: Sprite | null;
  56330. protected _internalToggle(): void;
  56331. protected _set(value: boolean, emitEvent?: boolean): void;
  56332. /**
  56333. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  56334. */
  56335. playEffect(): void;
  56336. /**
  56337. * @en
  56338. * Set isChecked without invoking checkEvents.
  56339. *
  56340. * @zh
  56341. * 设置 isChecked 而不调用 checkEvents 回调。
  56342. *
  56343. * @param value @en Whether this toggle is pressed. @zh 是否被按下。
  56344. */
  56345. setIsCheckedWithoutNotify(value: boolean): void;
  56346. onEnable(): void;
  56347. onDisable(): void;
  56348. protected _emitToggleEvents(): void;
  56349. }
  56350. /**
  56351. * @en
  56352. * ToggleContainer is not a visible UI component but a way to modify the behavior of a set of Toggles. <br/>
  56353. * Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  56354. * Note: All the first layer child node containing the toggle component will auto be added to the container.
  56355. *
  56356. * @zh
  56357. * ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,<br/>
  56358. * 任何时候只能有一个 Toggle 处于选中状态。
  56359. */
  56360. export class ToggleContainer extends Component {
  56361. protected _allowSwitchOff: boolean;
  56362. /**
  56363. * @en
  56364. * If this setting is true, a toggle could be switched off and on when pressed.
  56365. * If it is false, it will make sure there is always only one toggle could be switched on
  56366. * and the already switched on toggle can't be switched off.
  56367. *
  56368. * @zh
  56369. * 如果这个设置为 true,那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。
  56370. */
  56371. get allowSwitchOff(): boolean;
  56372. set allowSwitchOff(value: boolean);
  56373. /**
  56374. * @en
  56375. * If Toggle is clicked, it will trigger event's handler.
  56376. *
  56377. * @zh
  56378. * Toggle 按钮的点击事件列表。
  56379. */
  56380. checkEvents: EventHandler[];
  56381. /**
  56382. * @en
  56383. * Read only property, return the toggle items array reference managed by ToggleContainer.
  56384. *
  56385. * @zh
  56386. * 只读属性,返回 toggleContainer 管理的 toggle 数组引用。
  56387. */
  56388. get toggleItems(): Toggle[];
  56389. onEnable(): void;
  56390. onDisable(): void;
  56391. activeToggles(): Toggle[];
  56392. anyTogglesChecked(): boolean;
  56393. /**
  56394. * @en
  56395. * Refresh the state of the managed toggles.
  56396. *
  56397. * @zh
  56398. * 刷新管理的 toggle 状态。
  56399. *
  56400. * @param toggle @en The toggle to be updated. @zh 需要被更新的切换键。
  56401. * @param emitEvent @en Whether events are needed to be emitted. @zh 是否需要触发事件。
  56402. */
  56403. notifyToggleCheck(toggle: Toggle, emitEvent?: boolean): void;
  56404. /**
  56405. * @en Ensure toggles state valid.
  56406. * @zh 确保 toggles 状态有效。
  56407. */
  56408. ensureValidState(): void;
  56409. }
  56410. export class ViewGroup extends Component {
  56411. }
  56412. /**
  56413. * @en
  56414. * Stores and manipulate the anchoring based on its parent.
  56415. * Widget are used for GUI but can also be used for other things.
  56416. * Widget will adjust current node's position and size automatically,
  56417. * but the results after adjustment can not be obtained until the next frame unless you call [[updateAlignment]] manually.
  56418. *
  56419. * @zh Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。<br/>
  56420. * Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 [[updateAlignment]]。
  56421. */
  56422. export class Widget extends Component {
  56423. /**
  56424. * @en
  56425. * Specifies an alignment target that can only be one of the parent nodes of the current node.
  56426. * The default value is null, and when null, indicates the current parent.
  56427. *
  56428. * @zh
  56429. * 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。
  56430. */
  56431. get target(): Node | null;
  56432. set target(value: Node | null);
  56433. /**
  56434. * @en
  56435. * Whether to align to the top.
  56436. *
  56437. * @zh
  56438. * 是否对齐上边。
  56439. */
  56440. get isAlignTop(): boolean;
  56441. set isAlignTop(value: boolean);
  56442. /**
  56443. * @en
  56444. * Whether to align to the bottom.
  56445. *
  56446. * @zh
  56447. * 是否对齐下边。
  56448. */
  56449. get isAlignBottom(): boolean;
  56450. set isAlignBottom(value: boolean);
  56451. /**
  56452. * @en
  56453. * Whether to align to the left.
  56454. *
  56455. * @zh
  56456. * 是否对齐左边。
  56457. */
  56458. get isAlignLeft(): boolean;
  56459. set isAlignLeft(value: boolean);
  56460. /**
  56461. * @en
  56462. * Whether to align to the right.
  56463. *
  56464. * @zh
  56465. * 是否对齐右边。
  56466. */
  56467. get isAlignRight(): boolean;
  56468. set isAlignRight(value: boolean);
  56469. /**
  56470. * @en
  56471. * Whether to align vertically.
  56472. *
  56473. * @zh
  56474. * 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。
  56475. */
  56476. get isAlignVerticalCenter(): boolean;
  56477. set isAlignVerticalCenter(value: boolean);
  56478. /**
  56479. * @en
  56480. * Whether to align horizontally.
  56481. *
  56482. * @zh
  56483. * 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。
  56484. */
  56485. get isAlignHorizontalCenter(): boolean;
  56486. set isAlignHorizontalCenter(value: boolean);
  56487. /**
  56488. * @en
  56489. * Whether to stretch horizontally, when enable the left and right alignment will be stretched horizontally,
  56490. * the width setting is invalid (read only).
  56491. *
  56492. * @zh
  56493. * 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸。此时节点的宽度(只读)。
  56494. */
  56495. get isStretchWidth(): boolean;
  56496. /**
  56497. * @en
  56498. * Whether to stretch vertically, when enable the left and right alignment will be stretched vertically,
  56499. * then height setting is invalid (read only).
  56500. *
  56501. * @zh
  56502. * 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度(只读)。
  56503. */
  56504. get isStretchHeight(): boolean;
  56505. /**
  56506. * @en
  56507. * The margins between the top of this node and the top of parent node,
  56508. * the value can be negative, Only available in 'isAlignTop' open.
  56509. *
  56510. * @zh
  56511. * 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。
  56512. */
  56513. get top(): number;
  56514. set top(value: number);
  56515. /**
  56516. * @EditorOnly Not for user
  56517. */
  56518. get editorTop(): number;
  56519. set editorTop(value: number);
  56520. /**
  56521. * @en
  56522. * The margins between the bottom of this node and the bottom of parent node,
  56523. * the value can be negative, Only available in 'isAlignBottom' open.
  56524. *
  56525. * @zh
  56526. * 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。
  56527. */
  56528. get bottom(): number;
  56529. set bottom(value: number);
  56530. /**
  56531. * @EditorOnly Not for user
  56532. */
  56533. get editorBottom(): number;
  56534. set editorBottom(value: number);
  56535. /**
  56536. * @en
  56537. * The margins between the left of this node and the left of parent node,
  56538. * the value can be negative, Only available in 'isAlignLeft' open.
  56539. *
  56540. * @zh
  56541. * 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。
  56542. */
  56543. get left(): number;
  56544. set left(value: number);
  56545. /**
  56546. * @EditorOnly Not for user
  56547. */
  56548. get editorLeft(): number;
  56549. set editorLeft(value: number);
  56550. /**
  56551. * @en
  56552. * The margins between the right of this node and the right of parent node,
  56553. * the value can be negative, Only available in 'isAlignRight' open.
  56554. *
  56555. * @zh
  56556. * 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。
  56557. */
  56558. get right(): number;
  56559. set right(value: number);
  56560. /**
  56561. * @EditorOnly Not for user
  56562. */
  56563. get editorRight(): number;
  56564. set editorRight(value: number);
  56565. /**
  56566. * @en
  56567. * Horizontally aligns the midpoint offset value,
  56568. * the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  56569. *
  56570. * @zh
  56571. * 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。
  56572. */
  56573. get horizontalCenter(): number;
  56574. set horizontalCenter(value: number);
  56575. /**
  56576. * @EditorOnly Not for user
  56577. */
  56578. get editorHorizontalCenter(): number;
  56579. set editorHorizontalCenter(value: number);
  56580. /**
  56581. * @en
  56582. * Vertically aligns the midpoint offset value,
  56583. * the value can be negative, Only available in 'isAlignVerticalCenter' open.
  56584. *
  56585. * @zh
  56586. * 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。
  56587. */
  56588. get verticalCenter(): number;
  56589. set verticalCenter(value: number);
  56590. /**
  56591. * @EditorOnly Not for user
  56592. */
  56593. get editorVerticalCenter(): number;
  56594. set editorVerticalCenter(value: number);
  56595. /**
  56596. * @en
  56597. * If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  56598. *
  56599. * @zh
  56600. * 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的比例(0 到 1)作为边距。
  56601. */
  56602. get isAbsoluteTop(): boolean;
  56603. set isAbsoluteTop(value: boolean);
  56604. /**
  56605. * @en
  56606. * If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  56607. *
  56608. * @zh
  56609. * 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的比例(0 到 1)作为边距。
  56610. */
  56611. get isAbsoluteBottom(): boolean;
  56612. set isAbsoluteBottom(value: boolean);
  56613. /**
  56614. * @en
  56615. * If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  56616. *
  56617. * @zh
  56618. * 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的比例(0 到 1)作为边距。
  56619. */
  56620. get isAbsoluteLeft(): boolean;
  56621. set isAbsoluteLeft(value: boolean);
  56622. /**
  56623. * @en
  56624. * If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  56625. *
  56626. * @zh
  56627. * 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的比例(0 到 1)作为边距。
  56628. */
  56629. get isAbsoluteRight(): boolean;
  56630. set isAbsoluteRight(value: boolean);
  56631. /**
  56632. * @en
  56633. * If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  56634. *
  56635. * @zh
  56636. * 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为比例(0 到 1)。
  56637. */
  56638. get isAbsoluteHorizontalCenter(): boolean;
  56639. set isAbsoluteHorizontalCenter(value: boolean);
  56640. /**
  56641. * @en
  56642. * If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  56643. *
  56644. * @zh
  56645. * 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为比例(0 到 1)。
  56646. */
  56647. get isAbsoluteVerticalCenter(): boolean;
  56648. set isAbsoluteVerticalCenter(value: boolean);
  56649. /**
  56650. * @en
  56651. * Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  56652. *
  56653. * @zh
  56654. * 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。
  56655. *
  56656. * @example
  56657. * ```
  56658. * import { Widget } from 'cc';
  56659. * widget.alignMode = Widget.AlignMode.ON_WINDOW_RESIZE;
  56660. * ```
  56661. */
  56662. get alignMode(): __private._cocos_ui_widget__AlignMode;
  56663. set alignMode(value: __private._cocos_ui_widget__AlignMode);
  56664. /**
  56665. * @zh
  56666. * 对齐标志位。
  56667. * @en
  56668. * Align flags.
  56669. */
  56670. get alignFlags(): number;
  56671. set alignFlags(value: number);
  56672. static AlignMode: typeof __private._cocos_ui_widget__AlignMode;
  56673. /**
  56674. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56675. */
  56676. _lastPos: math.Vec3;
  56677. /**
  56678. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56679. */
  56680. _lastSize: math.Size;
  56681. /**
  56682. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56683. */
  56684. _dirty: boolean;
  56685. /**
  56686. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56687. */
  56688. _hadAlignOnce: boolean;
  56689. /**
  56690. * @en
  56691. * Immediately perform the widget alignment. You need to manually call this method only if
  56692. * you need to get the latest results after the alignment before the end of current frame.
  56693. *
  56694. * @zh
  56695. * 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  56696. * 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  56697. *
  56698. * @example
  56699. * ```ts
  56700. * import { log } from 'cc';
  56701. * widget.top = 10; // change top margin
  56702. * log(widget.node.y); // not yet changed
  56703. * widget.updateAlignment();
  56704. * log(widget.node.y); // changed
  56705. * ```
  56706. */
  56707. updateAlignment(): void;
  56708. /**
  56709. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56710. */
  56711. _validateTargetInDEV(): void;
  56712. setDirty(): void;
  56713. onEnable(): void;
  56714. onDisable(): void;
  56715. onDestroy(): void;
  56716. /**
  56717. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56718. */
  56719. _adjustWidgetToAllowMovingInEditor(eventType: TransformBit): void;
  56720. /**
  56721. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56722. */
  56723. _adjustWidgetToAllowResizingInEditor(): void;
  56724. /**
  56725. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56726. */
  56727. _adjustWidgetToAnchorChanged(): void;
  56728. /**
  56729. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  56730. */
  56731. _adjustTargetToParentChanged(oldParent: Node): void;
  56732. protected _registerEvent(): void;
  56733. protected _unregisterEvent(): void;
  56734. protected _removeParentEvent(): void;
  56735. protected _autoChangedValue(flag: __private._cocos_ui_widget__AlignFlags, isAbs: boolean): void;
  56736. protected _registerTargetEvents(): void;
  56737. protected _unregisterTargetEvents(): void;
  56738. protected _unregisterOldParentEvents(oldParent: Node): void;
  56739. protected _setDirtyByMode(): void;
  56740. }
  56741. export namespace Widget {
  56742. export type AlignMode = __private.__types_globals__EnumAlias<typeof __private._cocos_ui_widget__AlignMode>;
  56743. }
  56744. /**
  56745. * @en
  56746. * The PageView control.
  56747. *
  56748. * @zh
  56749. * 页面视图组件。
  56750. */
  56751. export class PageView extends ScrollView {
  56752. /**
  56753. * @en
  56754. * Specify the size type of each page in PageView.
  56755. *
  56756. * @zh
  56757. * 页面视图中每个页面大小类型。
  56758. */
  56759. get sizeMode(): __private._cocos_ui_page_view__SizeMode;
  56760. set sizeMode(value: __private._cocos_ui_page_view__SizeMode);
  56761. /**
  56762. * @en
  56763. * The page view direction.
  56764. *
  56765. * @zh
  56766. * 页面视图滚动类型。
  56767. */
  56768. get direction(): __private._cocos_ui_page_view__Direction;
  56769. set direction(value: __private._cocos_ui_page_view__Direction);
  56770. /**
  56771. * @en
  56772. * The scroll threshold value, when drag exceeds this value,
  56773. * release the next page will automatically scroll, less than the restore.
  56774. *
  56775. * @zh
  56776. * 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。
  56777. */
  56778. get scrollThreshold(): number;
  56779. set scrollThreshold(value: number);
  56780. /**
  56781. * @en
  56782. * Change the PageTurning event timing of PageView.
  56783. *
  56784. * @zh
  56785. * 设置 PageView PageTurning 事件的发送时机。
  56786. */
  56787. get pageTurningEventTiming(): number;
  56788. set pageTurningEventTiming(value: number);
  56789. /**
  56790. * @en
  56791. * The Page View Indicator.
  56792. *
  56793. * @zh
  56794. * 页面视图指示器组件。
  56795. */
  56796. get indicator(): PageViewIndicator | null;
  56797. set indicator(value: PageViewIndicator | null);
  56798. get curPageIdx(): number;
  56799. /**
  56800. * @en Enum for Page View Size Mode.
  56801. * @zh 页面视图每个页面统一的大小类型。
  56802. */
  56803. static SizeMode: typeof __private._cocos_ui_page_view__SizeMode;
  56804. /**
  56805. * @en Enum for Page View Direction.
  56806. * @zh 页面视图滚动类型。
  56807. */
  56808. static Direction: typeof __private._cocos_ui_page_view__Direction;
  56809. /**
  56810. * @en Enum for Page View event.
  56811. * @zh 页面视图事件枚举
  56812. */
  56813. static EventType: typeof __private._cocos_ui_page_view__EventType & typeof __private._cocos_ui_scroll_view__EventType;
  56814. /**
  56815. * @en
  56816. * Auto page turning velocity threshold. When users swipe the PageView quickly,
  56817. * it will calculate a velocity based on the scroll distance and time,
  56818. * if the calculated velocity is larger than the threshold, then it will trigger page turning.
  56819. *
  56820. * @zh
  56821. * 快速滑动翻页临界值。
  56822. * 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  56823. * 该值与此临界值相比较,如果大于临界值,则进行自动翻页。
  56824. */
  56825. autoPageTurningThreshold: number;
  56826. /**
  56827. * @en
  56828. * The vertical scrollbar reference.
  56829. * @zh
  56830. * 垂直滚动的 ScrollBar。
  56831. */
  56832. get verticalScrollBar(): ScrollBar | null;
  56833. set verticalScrollBar(value: ScrollBar | null);
  56834. /**
  56835. * @en
  56836. * The horizontal scrollbar reference.
  56837. * @zh
  56838. * 水平滚动的 ScrollBar。
  56839. */
  56840. get horizontalScrollBar(): ScrollBar | null;
  56841. set horizontalScrollBar(value: ScrollBar | null);
  56842. /**
  56843. * @en
  56844. * Enable horizontal scroll.
  56845. * @zh
  56846. * 是否开启水平滚动。
  56847. */
  56848. horizontal: boolean;
  56849. /**
  56850. * @en
  56851. * Enable vertical scroll.
  56852. * @zh
  56853. * 是否开启垂直滚动。
  56854. */
  56855. vertical: boolean;
  56856. /**
  56857. * @en
  56858. * If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  56859. * It's set to true by default.
  56860. * @zh
  56861. * 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。<br/>
  56862. * 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。
  56863. */
  56864. cancelInnerEvents: boolean;
  56865. /**
  56866. * @en
  56867. * ScrollView events callback.
  56868. * @zh
  56869. * 滚动视图的事件回调函数。
  56870. */
  56871. scrollEvents: EventHandler[];
  56872. /**
  56873. * @en The time required to turn over a page, unit: second.
  56874. * @zh 每个页面翻页时所需时间,单位:秒。
  56875. */
  56876. pageTurningSpeed: number;
  56877. /**
  56878. * @en PageView events callback.
  56879. * @zh 滚动视图的事件回调函数。
  56880. */
  56881. pageEvents: EventHandler[];
  56882. protected _sizeMode: __private._cocos_ui_page_view__SizeMode;
  56883. protected _direction: __private._cocos_ui_page_view__Direction;
  56884. protected _scrollThreshold: number;
  56885. protected _pageTurningEventTiming: number;
  56886. protected _indicator: PageViewIndicator | null;
  56887. protected _curPageIdx: number;
  56888. protected _lastPageIdx: number;
  56889. protected _pages: Node[];
  56890. protected _initContentPos: math.Vec3;
  56891. protected _scrollCenterOffsetX: number[];
  56892. protected _scrollCenterOffsetY: number[];
  56893. protected _touchBeganPosition: math.Vec2;
  56894. protected _touchEndPosition: math.Vec2;
  56895. onEnable(): void;
  56896. onDisable(): void;
  56897. onLoad(): void;
  56898. /**
  56899. * @en
  56900. * Returns current page index.
  56901. *
  56902. * @zh
  56903. * 返回当前页面索引。
  56904. *
  56905. * @returns @en Current page index of this page view. @zh 当前页面索引。
  56906. */
  56907. getCurrentPageIndex(): number;
  56908. /**
  56909. * @en
  56910. * Set current page index.
  56911. *
  56912. * @zh
  56913. * 设置当前页面索引。
  56914. * @param index @en The page index to scroll to. @zh 需要滚动到的页面索引。
  56915. */
  56916. setCurrentPageIndex(index: number): void;
  56917. /**
  56918. * @en
  56919. * Returns all pages of pageview.
  56920. *
  56921. * @zh
  56922. * 返回视图中的所有页面。
  56923. *
  56924. * @returns @en return all pages of this page view. @zh 返回当前视图所有页面。
  56925. */
  56926. getPages(): Node[];
  56927. /**
  56928. * @en
  56929. * At the end of the current page view to insert a new view.
  56930. *
  56931. * @zh
  56932. * 在当前页面视图的尾部插入一个新视图。
  56933. *
  56934. * @param page @en New page to add to this page view. @zh 新加入的视图。
  56935. */
  56936. addPage(page: Node): void;
  56937. /**
  56938. * @en
  56939. * Inserts a page in the specified location.
  56940. *
  56941. * @zh
  56942. * 将页面插入指定位置中。
  56943. *
  56944. * @param page @en New page to insert to this page view. @zh 新插入的视图。
  56945. * @param index @en The index of new page to be inserted. @zh 新插入视图的索引。
  56946. */
  56947. insertPage(page: Node, index: number): void;
  56948. /**
  56949. * @en
  56950. * Removes a page from PageView.
  56951. *
  56952. * @zh
  56953. * 移除指定页面。
  56954. *
  56955. * @param page @en The page to be removed. @zh 将被移除的页面。
  56956. */
  56957. removePage(page: Node): void;
  56958. /**
  56959. * @en
  56960. * Removes a page at index of PageView.
  56961. *
  56962. * @zh
  56963. * 移除指定下标的页面。
  56964. *
  56965. * @param index @en The index of the page to be removed. @zh 将被移除界面的页面下标。
  56966. */
  56967. removePageAtIndex(index: number): void;
  56968. /**
  56969. * @en
  56970. * Removes all pages from PageView.
  56971. *
  56972. * @zh
  56973. * 移除所有页面。
  56974. */
  56975. removeAllPages(): void;
  56976. /**
  56977. * @en
  56978. * Scroll PageView to index.
  56979. *
  56980. * @zh
  56981. * 滚动到指定页面
  56982. *
  56983. * @param idx @en The index of page to be scroll to. @zh 希望滚动到的页面下标。
  56984. * @param timeInSecond @en How long time to scroll to the page, in seconds. @zh 滚动到指定页面所需时间,单位:秒。
  56985. */
  56986. scrollToPage(idx: number, timeInSecond?: number): void;
  56987. getScrollEndedEventTiming(): number;
  56988. protected _updatePageView(): void;
  56989. protected _updateAllPagesSize(): void;
  56990. protected _handleReleaseLogic(): void;
  56991. protected _onTouchBegan(event: EventTouch, captureListeners: any): void;
  56992. protected _onTouchMoved(event: EventTouch, captureListeners: any): void;
  56993. protected _onTouchEnded(event: EventTouch, captureListeners: any): void;
  56994. protected _onTouchCancelled(event: EventTouch, captureListeners: any): void;
  56995. protected _onMouseWheel(): void;
  56996. protected _syncScrollDirection(): void;
  56997. protected _syncSizeMode(): void;
  56998. protected _initPages(): void;
  56999. protected _dispatchPageTurningEvent(): void;
  57000. protected _isQuicklyScrollable(touchMoveVelocity: math.Vec3): boolean;
  57001. protected _moveOffsetValue(idx: number): math.Vec2;
  57002. protected _getDragDirection(moveOffset: math.Vec2): number;
  57003. protected _isScrollable(offset: math.Vec2, index: number, nextIndex: number): boolean;
  57004. protected _autoScrollToPage(): void;
  57005. }
  57006. /**
  57007. * @en
  57008. * The Page View Indicator Component.
  57009. *
  57010. * @zh
  57011. * 页面视图每页标记组件。
  57012. */
  57013. export class PageViewIndicator extends Component {
  57014. /**
  57015. * @en
  57016. * The spriteFrame for each element.
  57017. *
  57018. * @zh
  57019. * 每个页面标记显示的图片。
  57020. */
  57021. get spriteFrame(): SpriteFrame | null;
  57022. set spriteFrame(value: SpriteFrame | null);
  57023. /**
  57024. * @en
  57025. * The location direction of PageViewIndicator.
  57026. *
  57027. * @zh
  57028. * 页面标记摆放方向。
  57029. *
  57030. * @param direction @en The direction of the PageViewIndicator. @zh 页面标记的摆放方向。
  57031. */
  57032. get direction(): __private._cocos_ui_page_view_indicator__Direction;
  57033. set direction(value: __private._cocos_ui_page_view_indicator__Direction);
  57034. /**
  57035. * @en
  57036. * The cellSize for each element.
  57037. *
  57038. * @zh
  57039. * 每个页面标记的大小。
  57040. */
  57041. get cellSize(): math.Size;
  57042. set cellSize(value: math.Size);
  57043. /**
  57044. * @en Enum for PageView Indicator direction.
  57045. * @zh 页面视图指示器的摆放方向。
  57046. * @enum PageViewIndicator.Direction
  57047. */
  57048. static Direction: typeof __private._cocos_ui_page_view_indicator__Direction;
  57049. /**
  57050. * @en
  57051. * The distance between each element.
  57052. *
  57053. * @zh
  57054. * 每个页面标记之间的边距。
  57055. */
  57056. spacing: number;
  57057. protected _spriteFrame: SpriteFrame | null;
  57058. protected _direction: __private._cocos_ui_page_view_indicator__Direction;
  57059. protected _cellSize: math.Size;
  57060. protected _layout: Layout | null;
  57061. protected _pageView: PageView | null;
  57062. protected _indicators: Node[];
  57063. onLoad(): void;
  57064. /**
  57065. * @en
  57066. * Set Page View.
  57067. *
  57068. * @zh
  57069. * 设置页面视图。
  57070. *
  57071. * @param target @en The page view which is attached with this indicator. @zh 当前标记对象附着到的页面视图对象。
  57072. */
  57073. setPageView(target: PageView): void;
  57074. /**
  57075. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57076. */
  57077. _updateLayout(): void;
  57078. /**
  57079. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57080. */
  57081. _createIndicator(): Node;
  57082. /**
  57083. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57084. */
  57085. _changedState(): void;
  57086. /**
  57087. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57088. */
  57089. _refresh(): void;
  57090. }
  57091. /**
  57092. * @en
  57093. * This component is used to adjust the layout of current node to respect the safe area of a notched mobile device such as the iPhone X.
  57094. * It is typically used for the top node of the UI interaction area. For specific usage, refer to the official [test-cases-3d/assets/cases/ui/20.safe-area/safe-area.scene](https://github.com/cocos-creator/test-cases-3d).
  57095. *
  57096. * The concept of safe area is to give you a fixed inner rectangle in which you can safely display content that will be drawn on screen.
  57097. * You are strongly discouraged from providing controls outside of this area. But your screen background could embellish edges.
  57098. *
  57099. * This component internally uses the API `sys.getSafeAreaRect();` to obtain the safe area of the current iOS or Android device,
  57100. * and implements the adaptation by using the Widget component and set anchor.
  57101. *
  57102. * @zh
  57103. * 该组件会将所在节点的布局适配到 iPhone X 等异形屏手机的安全区域内,通常用于 UI 交互区域的顶层节点,具体用法可参考官方范例 [test-cases-3d/assets/cases/ui/20.safe-area/safe-area.scene](https://github.com/cocos-creator/test-cases-3d)。
  57104. *
  57105. * 该组件内部通过 API `sys.getSafeAreaRect();` 获取到当前 iOS 或 Android 设备的安全区域,并通过 Widget 组件实现适配。
  57106. *
  57107. */
  57108. export class SafeArea extends Component {
  57109. onEnable(): void;
  57110. onDisable(): void;
  57111. /**
  57112. * @en Adapt to safe area.
  57113. * @zh 立即适配安全区域。
  57114. * @method updateArea
  57115. * @example
  57116. * let safeArea = this.node.addComponent(cc.SafeArea);
  57117. * safeArea.updateArea();
  57118. */
  57119. updateArea(): void;
  57120. }
  57121. /**
  57122. * @en The component that converts 3D node coordinates to UI node coordinates.
  57123. * It mainly provides the converted world coordinates after mapping and the perspective ratio of the simulated perspective camera.
  57124. * @zh 3D 节点坐标转换到 UI 节点坐标组件
  57125. * 主要提供映射后的转换世界坐标以及模拟透视相机远近比。
  57126. */
  57127. export class UICoordinateTracker extends Component {
  57128. /**
  57129. * @en
  57130. * Target node.
  57131. *
  57132. * @zh
  57133. * 目标对象。
  57134. */
  57135. get target(): Node | null;
  57136. set target(value: Node | null);
  57137. /**
  57138. * @en
  57139. * The 3D camera representing the original coordinate system.
  57140. *
  57141. * @zh
  57142. * 照射相机。
  57143. */
  57144. get camera(): Camera | null;
  57145. set camera(value: Camera | null);
  57146. /**
  57147. * @en
  57148. * Whether to scale the converted 2d node's size according to the distance between the camera and the 3d node.
  57149. *
  57150. * @zh
  57151. * 是否是缩放映射。
  57152. */
  57153. get useScale(): boolean;
  57154. set useScale(value: boolean);
  57155. /**
  57156. * @en
  57157. * The distance from the camera for displaying the 2d node in normal size.
  57158. *
  57159. * @zh
  57160. * 距相机多少距离为正常显示计算大小。
  57161. */
  57162. get distance(): number;
  57163. set distance(value: number);
  57164. /**
  57165. * @en
  57166. * Event callback after coordinates synchronization.
  57167. * The first parameter of the callback is the mapped local coordinate in UI camera.
  57168. * The second parameter is the distance scale of the 3d node from the 3d camera viewport.
  57169. *
  57170. * @zh
  57171. * 映射数据事件。回调的第一个参数是映射后的本地坐标,第二个是距相机距离比。
  57172. */
  57173. syncEvents: EventHandler[];
  57174. protected _target: Node | null;
  57175. protected _camera: Camera | null;
  57176. protected _useScale: boolean;
  57177. protected _distance: number;
  57178. protected _transformPos: math.Vec3;
  57179. protected _viewPos: math.Vec3;
  57180. protected _canMove: boolean;
  57181. protected _lastWPos: math.Vec3;
  57182. protected _lastCameraPos: math.Vec3;
  57183. onEnable(): void;
  57184. update(): void;
  57185. protected _checkCanMove(): void;
  57186. }
  57187. /**
  57188. * @en
  57189. * This component will block all input events (mouse and touch) within the size of the node,
  57190. * preventing the input from penetrating into the underlying node, typically for the background of the top UI.<br>
  57191. * This component does not have any API interface and can be added directly to the scene to take effect.
  57192. * @zh
  57193. * 该组件将拦截所属节点尺寸内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  57194. * 该组件没有任何 API 接口,直接添加到场景即可生效。
  57195. */
  57196. export class BlockInputEvents extends Component {
  57197. onEnable(): void;
  57198. onDisable(): void;
  57199. }
  57200. /**
  57201. * @en SubContextView is a view component which controls open data context viewport in WeChat game platform.<br/>
  57202. * The component's node size decide the viewport of the sub context content in main context,
  57203. * the entire sub context texture will be scaled to the node's bounding box area.<br/>
  57204. * This component provides multiple important features:<br/>
  57205. * 1. Sub context could use its own resolution size and policy.<br/>
  57206. * 2. Sub context could be minized to smallest size it needed.<br/>
  57207. * 3. Resolution of sub context content could be increased.<br/>
  57208. * 4. User touch input is transformed to the correct viewport.<br/>
  57209. * 5. Texture update is handled by this component. User don't need to worry.<br/>
  57210. * One important thing to be noted, whenever the node's bounding box change,
  57211. * you need to manually reset the viewport of sub context using updateSubContextViewport.
  57212. * @zh SubContextView 可以用来控制微信小游戏平台开放数据域在主域中的视窗的位置。<br/>
  57213. * 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  57214. * 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  57215. * 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  57216. * 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  57217. * 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  57218. * 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  57219. * 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/>
  57220. * 唯一需要注意的是,当子域节点的包围盒发生改变时,开发者需要使用 `updateSubContextViewport` 来手动更新子域视窗。
  57221. */
  57222. export class SubContextView extends Component {
  57223. /**
  57224. * @en Specify a reference value of canvas size for style editing in Open Data Context.
  57225. * The width and height setting of CSS style should not exceed this size, otherwise the rendered content will exceed the canvas.
  57226. * NOTE: This property is read-only at runtime. Please configure the design resolution in the Editor.
  57227. *
  57228. * @zh 为开放数据域的样式编辑指定一个画布尺寸的参考值,CSS 样式的宽高设置不应该超过这个尺寸,否则渲染的内容会超出画布。
  57229. * 注意:该属性在运行时是只读的,请在编辑器环境下配置好设计分辨率。
  57230. */
  57231. get designResolutionSize(): math.Size;
  57232. set designResolutionSize(value: math.Size);
  57233. /**
  57234. * @en Setting frame rate in Open Data Context.
  57235. *
  57236. * @zh 设置开放数据域的渲染帧率。
  57237. */
  57238. get fps(): number;
  57239. set fps(value: number);
  57240. constructor();
  57241. onLoad(): void;
  57242. onEnable(): void;
  57243. onDisable(): void;
  57244. update(dt?: number): void;
  57245. onDestroy(): void;
  57246. }
  57247. /**
  57248. * @en widget Manager, use to align widget
  57249. * @zh widget 管理器,用于对齐操作
  57250. * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
  57251. */
  57252. export const widgetManager: {
  57253. isAligning: boolean;
  57254. _nodesOrderDirty: boolean;
  57255. _activeWidgetsIterator: js.array.MutableForwardIterator<Widget>;
  57256. animationState: {
  57257. previewing: boolean;
  57258. time: number;
  57259. animatedSinceLastFrame: boolean;
  57260. } | null;
  57261. init(): void;
  57262. add(widget: Widget): void;
  57263. remove(widget: Widget): void;
  57264. onResized(): void;
  57265. refreshWidgetOnResized(node: Node): void;
  57266. updateOffsetsToStayPut(widget: Widget, e?: __private._cocos_ui_widget__AlignFlags): void;
  57267. updateAlignment: typeof __private._cocos_ui_widget_manager__updateAlignment;
  57268. AlignMode: typeof __private._cocos_ui_widget__AlignMode;
  57269. AlignFlags: typeof __private._cocos_ui_widget__AlignFlags;
  57270. };
  57271. export class View extends __private._cocos_ui_view__View_base {
  57272. static instance: View;
  57273. /**
  57274. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57275. */
  57276. _designResolutionSize: math.Size;
  57277. constructor();
  57278. init(): void;
  57279. /**
  57280. * @en
  57281. * Sets whether resize canvas automatically when browser's size changed.<br/>
  57282. * Useful only on web.
  57283. * @zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  57284. * 仅在 Web 模式下有效。
  57285. * @param enabled - Whether enable automatic resize with browser's resize event
  57286. */
  57287. resizeWithBrowserSize(enabled: boolean): void;
  57288. /**
  57289. * @en
  57290. * Sets the callback function for `view`'s resize action,<br/>
  57291. * this callback will be invoked before applying resolution policy, <br/>
  57292. * so you can do any additional modifications within the callback.<br/>
  57293. * Useful only on web.
  57294. * @zh 设置 `view` 调整视窗尺寸行为的回调函数,
  57295. * 这个回调函数会在应用适配模式之前被调用,
  57296. * 因此你可以在这个回调函数内添加任意附加改变,
  57297. * 仅在 Web 平台下有效。
  57298. * @param callback - The callback function
  57299. *
  57300. * @deprecated since v3.8.0, please use [[screen.on]] to listen for events.
  57301. */
  57302. setResizeCallback(callback: (() => void) | null): void;
  57303. /**
  57304. * @en
  57305. * Sets the orientation of the game, it can be landscape, portrait or auto.
  57306. * When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  57307. * `view` will automatically rotate the game canvas using CSS.
  57308. * Note that this function doesn't have any effect in native,
  57309. * in native, you need to set the application orientation in native project settings
  57310. * @zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  57311. * 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  57312. * `view` 会自动用 CSS 旋转游戏场景的 canvas,
  57313. * 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  57314. * @param orientation - Possible values: macro.ORIENTATION_LANDSCAPE | macro.ORIENTATION_PORTRAIT | macro.ORIENTATION_AUTO
  57315. */
  57316. setOrientation(orientation: number): void;
  57317. /**
  57318. * @en
  57319. * Sets whether the engine modify the "viewport" meta in your web page.<br/>
  57320. * It's enabled by default, we strongly suggest you not to disable it.<br/>
  57321. * And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  57322. * Only useful on web
  57323. * @zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  57324. * 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  57325. * 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  57326. * 仅在 Web 模式下有效
  57327. * @param enabled - Enable automatic modification to "viewport" meta
  57328. * @deprecated since v3.3
  57329. */
  57330. adjustViewportMeta(enabled: boolean): void;
  57331. /**
  57332. * @en
  57333. * Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  57334. * it takes effect only when you called setDesignResolutionPolicy<br/>
  57335. * Only useful on web
  57336. * @zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  57337. * 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  57338. * 仅在 Web 模式下有效。
  57339. * @param enabled - Enable or disable retina display
  57340. *
  57341. * @deprecated since v3.4.0
  57342. */
  57343. enableRetina(enabled: boolean): void;
  57344. /**
  57345. * @en
  57346. * Check whether retina display is enabled.<br/>
  57347. * Only useful on web
  57348. * @zh 检查是否对 Retina 显示设备进行优化。
  57349. * 仅在 Web 模式下有效。
  57350. *
  57351. * @deprecated since v3.4.0
  57352. */
  57353. isRetinaEnabled(): boolean;
  57354. /**
  57355. * @en
  57356. * If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  57357. * You can pass true as parameter to enable it and disable it by passing false.<br/>
  57358. * Only useful on web
  57359. * @zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  57360. * 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  57361. * @param enabled - Enable or disable auto full screen on mobile devices
  57362. *
  57363. * @deprecated since v3.3, please use screen.requestFullScreen() instead.
  57364. */
  57365. enableAutoFullScreen(enabled: boolean): void;
  57366. /**
  57367. * @en
  57368. * Check whether auto full screen is enabled.<br/>
  57369. * Only useful on web
  57370. * @zh 检查自动进入全屏模式是否启动。
  57371. * 仅在 Web 模式下有效。
  57372. * @return Auto full screen enabled or not
  57373. *
  57374. * @deprecated since v3.3
  57375. */
  57376. isAutoFullScreenEnabled(): boolean;
  57377. /**
  57378. * @en Set the canvas size in CSS pixels on Web platform.
  57379. * This method is not supported on other platforms.
  57380. * @zh Web 平台下,可以以 CSS 像素尺寸来设置 canvas 尺寸。
  57381. * 这个方法并不支持其他平台。
  57382. * @private
  57383. * @param {Number} width
  57384. * @param {Number} height
  57385. *
  57386. * @deprecated since v3.4.0, setting size in CSS pixels is not recommended, please use screen.windowSize instead.
  57387. */
  57388. setCanvasSize(width: number, height: number): void;
  57389. /**
  57390. * @en
  57391. * Returns the canvas size of the view.<br/>
  57392. * On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  57393. * On web, it returns the size of the canvas element.
  57394. * @zh 返回视图中 canvas 的尺寸。
  57395. * 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  57396. * 在 Web 平台下,它返回 canvas 元素尺寸。
  57397. *
  57398. * @deprecated since v3.4.0, please use screen.windowSize instead.
  57399. */
  57400. getCanvasSize(): math.Size;
  57401. /**
  57402. * @en
  57403. * Returns the frame size of the view in CSS pixels.<br/>
  57404. * On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  57405. * On web, it returns the size of the canvas's outer DOM element.
  57406. * @zh 以 CSS 像素尺寸返回视图中边框尺寸。
  57407. * 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  57408. * 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  57409. *
  57410. * @deprecated since v3.4.0, getting size in CSS pixels is not recommended, please use screen.windowSize instead.
  57411. */
  57412. getFrameSize(): math.Size;
  57413. /**
  57414. * @en Setting the frame size of the view in CSS pixels.
  57415. * On native, it sets the frame size of view.<br/>
  57416. * On web, it sets the size of the canvas's outer DOM element.
  57417. * @zh 以 CSS 像素尺寸设置视图中边框尺寸。
  57418. * 在 native 平台下,设置视图框架尺寸。
  57419. * 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  57420. * @param {Number} width
  57421. * @param {Number} height
  57422. *
  57423. * @deprecated since v3.4.0, setting size in CSS pixels is not recommended, please use screen.windowSize instead.
  57424. */
  57425. setFrameSize(width: number, height: number): void;
  57426. /**
  57427. * @en Returns the visible area size of the view port.
  57428. * @zh 返回视图窗口可见区域尺寸。
  57429. */
  57430. getVisibleSize(): math.Size;
  57431. /**
  57432. * @en Returns the visible area size of the view port.
  57433. * @zh 返回视图窗口可见区域像素尺寸。
  57434. */
  57435. getVisibleSizeInPixel(): math.Size;
  57436. /**
  57437. * @en Returns the visible origin of the view port.
  57438. * @zh 返回视图窗口可见区域原点。
  57439. */
  57440. getVisibleOrigin(): math.Vec2;
  57441. /**
  57442. * @en Returns the visible origin of the view port.
  57443. * @zh 返回视图窗口可见区域像素原点。
  57444. */
  57445. getVisibleOriginInPixel(): math.Vec2;
  57446. /**
  57447. * @en Returns the current resolution policy
  57448. * @zh 返回当前分辨率方案
  57449. * @see [[ResolutionPolicy]]
  57450. */
  57451. getResolutionPolicy(): ResolutionPolicy;
  57452. /**
  57453. * @en Sets the current resolution policy
  57454. * @zh 设置当前分辨率模式
  57455. * @see [[ResolutionPolicy]]
  57456. */
  57457. setResolutionPolicy(resolutionPolicy: ResolutionPolicy | number): void;
  57458. /**
  57459. * @en Sets the resolution policy with designed view size in points.<br/>
  57460. * The resolution policy include: <br/>
  57461. * [1] ResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.<br/>
  57462. * [2] ResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.<br/>
  57463. * [3] ResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.<br/>
  57464. * [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  57465. * [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  57466. * [ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by ResolutionPolicy<br/>
  57467. * @zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  57468. * @param width Design resolution width.
  57469. * @param height Design resolution height.
  57470. * @param resolutionPolicy The resolution policy desired
  57471. */
  57472. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy | number): void;
  57473. /**
  57474. * @en Returns the designed size for the view.
  57475. * @zh 返回视图的设计分辨率。
  57476. */
  57477. getDesignResolutionSize(): math.Size;
  57478. /**
  57479. * @en Sets the container to desired pixel resolution and fit the game content to it.
  57480. * This function is very useful for adaptation in mobile browsers.
  57481. * In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  57482. * In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  57483. * But this API can be helpful to set a desired pixel resolution which is in between.
  57484. * This API will do the following:
  57485. * 1. Set viewport's width to the desired width in pixel
  57486. * 2. Set body width to the exact pixel resolution
  57487. * 3. The resolution policy will be reset with designed view size in points.
  57488. * @zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  57489. * @param width Design resolution width.
  57490. * @param height Design resolution height.
  57491. * @param resolutionPolicy The resolution policy desired
  57492. *
  57493. * @deprecated since v3.6.0
  57494. */
  57495. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy | number): void;
  57496. /**
  57497. * @en Returns the view port rectangle.
  57498. * @zh 返回视窗剪裁区域。
  57499. */
  57500. getViewportRect(): math.Rect;
  57501. /**
  57502. * @en Returns scale factor of the horizontal direction (X axis).
  57503. * @zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  57504. */
  57505. getScaleX(): number;
  57506. /**
  57507. * @en Returns scale factor of the vertical direction (Y axis).
  57508. * @zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  57509. */
  57510. getScaleY(): number;
  57511. /**
  57512. * @en Returns device pixel ratio for retina display.
  57513. * @zh 返回设备或浏览器像素比例。
  57514. *
  57515. * @deprecated since v3.4.0, please use screen.devicePixelRatio instead.
  57516. */
  57517. getDevicePixelRatio(): number;
  57518. /**
  57519. * @en Returns the real location in view for a translation based on a related position
  57520. * @zh 将屏幕坐标转换为游戏视图下的坐标。
  57521. * @param tx - The X axis translation
  57522. * @param ty - The Y axis translation
  57523. * @param relatedPos - The related position object including "left", "top", "width", "height" informations
  57524. * @param out - The out object to save the conversion result
  57525. *
  57526. * @deprecated since v3.4.0
  57527. */
  57528. convertToLocationInView(tx: number, ty: number, relatedPos: any, out?: math.Vec2): math.Vec2;
  57529. }
  57530. /**
  57531. * @en ResolutionPolicy class is the root strategy class of scale strategy,
  57532. * its main task is to maintain the compatibility with Cocos2d-x.
  57533. *
  57534. * @zh ResolutionPolicy 类是适配策略的根策略类,它的主要任务是保持与 Cocos2d-x 的兼容性。
  57535. */
  57536. export class ResolutionPolicy {
  57537. /**
  57538. * @en The entire application is visible in the specified area without trying to preserve the original aspect ratio.
  57539. * Distortion can occur, and the application may appear stretched or compressed.
  57540. *
  57541. * @zh 整个应用程序在指定区域可见,无需尝试保留原始纵横比,
  57542. * 可能会发生变形,出现画面拉伸或压缩。
  57543. */
  57544. static EXACT_FIT: number;
  57545. /**
  57546. * @en The entire application fills the specified area, without distortion but possibly with some cropping,
  57547. * while maintaining the original aspect ratio of the application.
  57548. *
  57549. * @zh 整个应用程序填充指定区域,没有变形,但可能有一些裁剪,
  57550. * 同时保持画面的原始纵横比。
  57551. */
  57552. static NO_BORDER: number;
  57553. /**
  57554. * @en The entire application is visible in the specified area without distortion while maintaining the original
  57555. * aspect ratio of the application. Borders can appear on two sides of the application.
  57556. *
  57557. * @zh 整个应用程序在指定区域可见,没有变形,同时保持原始纵横比,
  57558. * 边框可能出现在画面的旁侧。
  57559. */
  57560. static SHOW_ALL: number;
  57561. /**
  57562. * @en The application takes the height of the design resolution size and modifies the width of the internal
  57563. * canvas so that it fits the aspect ratio of the device
  57564. * no distortion will occur however you must make sure your application works on different
  57565. * aspect ratios
  57566. *
  57567. * @zh 该应用程序采用设计分辨率大小的高度并修改内部画布的宽度,使其适合设备的纵横比,不会发生变形,
  57568. * 但是您必须确保您的应用程序在不同的纵横比的设备下工作。
  57569. */
  57570. static FIXED_HEIGHT: number;
  57571. /**
  57572. * @en The application takes the width of the design resolution size and modifies the height of the internal
  57573. * canvas so that it fits the aspect ratio of the device
  57574. * no distortion will occur however you must make sure your application works on different
  57575. * aspect ratios
  57576. *
  57577. * @zh 该应用程序采用设计分辨率大小的宽度并修改内部画布的高度,使其适合设备的纵横比,不会发生变形
  57578. * 但是您必须确保您的应用程序在不同的纵横比的设备下工作。
  57579. */
  57580. static FIXED_WIDTH: number;
  57581. /**
  57582. * @en Unknown policy
  57583. *
  57584. * @zh 未知的策略
  57585. */
  57586. static UNKNOWN: number;
  57587. static ContainerStrategy: typeof __private._cocos_ui_view__ContainerStrategy;
  57588. static ContentStrategy: typeof __private._cocos_ui_view__ContentStrategy;
  57589. name: string;
  57590. /**
  57591. * Constructor of ResolutionPolicy
  57592. * @param containerStg
  57593. * @param contentStg
  57594. */
  57595. constructor(containerStg: __private._cocos_ui_view__ContainerStrategy, contentStg: __private._cocos_ui_view__ContentStrategy);
  57596. get canvasSize(): math.Size;
  57597. /**
  57598. * @en Manipulation before applying the resolution policy
  57599. * @zh 策略应用前的操作
  57600. * @param _view The target view
  57601. */
  57602. preApply(_view: View): void;
  57603. /**
  57604. * @en Function to apply this resolution policy
  57605. * The return value is {scale: [scaleX, scaleY], viewport: {new Rect}},
  57606. * The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  57607. * @zh 调用策略方法
  57608. * @param _view - The target view
  57609. * @param designedResolution - The user defined design resolution
  57610. * @return An object contains the scale X/Y values and the viewport rect
  57611. */
  57612. apply(_view: View, designedResolution: math.Size): __private._cocos_ui_view__AdaptResult;
  57613. /**
  57614. * @en Manipulation after appyling the strategy
  57615. * @zh 策略应用之后的操作
  57616. * @param _view - The target view
  57617. */
  57618. postApply(_view: View): void;
  57619. /**
  57620. * @en Setup the container's scale strategy
  57621. * @zh 设置容器的适配策略
  57622. * @param containerStg The container strategy
  57623. */
  57624. setContainerStrategy(containerStg: __private._cocos_ui_view__ContainerStrategy): void;
  57625. /**
  57626. * @en Setup the content's scale strategy
  57627. * @zh 设置内容的适配策略
  57628. * @param contentStg The content strategy
  57629. */
  57630. setContentStrategy(contentStg: __private._cocos_ui_view__ContentStrategy): void;
  57631. }
  57632. /**
  57633. * @en view is the singleton view object.
  57634. * @zh view 是全局的视图单例对象。
  57635. */
  57636. export const view: View;
  57637. /**
  57638. * @deprecated Since v1.2
  57639. */
  57640. export class UIReorderComponent {
  57641. constructor();
  57642. }
  57643. /**
  57644. * @en
  57645. * The video clip asset.
  57646. * @zh
  57647. * 视频片段资源。
  57648. */
  57649. export class VideoClip extends Asset {
  57650. protected _duration: number;
  57651. protected _video: HTMLVideoElement | null;
  57652. constructor();
  57653. /**
  57654. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  57655. */
  57656. set _nativeAsset(clip: HTMLVideoElement | null);
  57657. get _nativeAsset(): HTMLVideoElement | null;
  57658. }
  57659. /**
  57660. * @en
  57661. * VideoPlayer is a component for playing videos, you can use it for showing videos in your game.
  57662. * Because different platforms have different authorization, API and control methods for VideoPlayer component.
  57663. * And have not yet formed a unified standard, only Web, iOS, and Android platforms are currently supported.
  57664. * @zh
  57665. * Video 组件,用于在游戏中播放视频。
  57666. * 由于不同平台对于 VideoPlayer 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。
  57667. */
  57668. export class VideoPlayer extends Component {
  57669. protected _resourceType: number;
  57670. protected _remoteURL: string;
  57671. protected _clip: VideoClip | null;
  57672. protected _playOnAwake: boolean;
  57673. protected _volume: number;
  57674. protected _mute: boolean;
  57675. protected _playbackRate: number;
  57676. protected _loop: boolean;
  57677. protected _fullScreenOnAwake: boolean;
  57678. protected _stayOnBottom: boolean;
  57679. protected _keepAspectRatio: boolean;
  57680. protected _impl: __private._cocos_video_video_player_impl_web__VideoPlayerImplWeb | null;
  57681. protected _cachedCurrentTime: number;
  57682. /**
  57683. * @en
  57684. * The resource type of video player, REMOTE for remote url and LOCAL for local file path.
  57685. * @zh
  57686. * 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。
  57687. */
  57688. get resourceType(): number;
  57689. set resourceType(val: number);
  57690. /**
  57691. * @en
  57692. * The remote URL of video.
  57693. * @zh
  57694. * 远程视频的 URL。
  57695. */
  57696. get remoteURL(): string;
  57697. set remoteURL(val: string);
  57698. /**
  57699. * @en
  57700. * The local video clip.
  57701. * @zh
  57702. * 本地视频剪辑。
  57703. */
  57704. get clip(): VideoClip | null;
  57705. set clip(val: VideoClip | null);
  57706. /**
  57707. * @en
  57708. * Whether the video start playing automatically after loaded.
  57709. * @zh
  57710. * 视频加载后是否自动开始播放。
  57711. */
  57712. get playOnAwake(): boolean;
  57713. set playOnAwake(value: boolean);
  57714. /**
  57715. * @en
  57716. * The Video playback rate. The value range is from [0.0 ~ 10.0].
  57717. * @zh
  57718. * 视频播放时的速率, 值的区间为[0.0 ~ 10.0]。
  57719. */
  57720. get playbackRate(): number;
  57721. set playbackRate(value: number);
  57722. /**
  57723. * @en
  57724. * The volume of the video. The value range is from [0.0 ~ 1.0].
  57725. * @zh
  57726. * 视频的音量. 值的区间为[0.0 ~ 1.0]。
  57727. */
  57728. get volume(): number;
  57729. set volume(value: number);
  57730. /**
  57731. * @en
  57732. * Mutes the VideoPlayer. When the volume is set to 0, the volume is muted, and unmuted is to restore the original volume.
  57733. * @zh
  57734. * 是否静音视频。设置音量为0时是静音,取消静音是恢复原来的音量。
  57735. */
  57736. get mute(): boolean;
  57737. set mute(value: boolean);
  57738. /**
  57739. * @en
  57740. * Whether the video should play again when it ends.
  57741. * @zh
  57742. * 视频是否应在结束时再次播放。
  57743. */
  57744. get loop(): boolean;
  57745. set loop(value: boolean);
  57746. /**
  57747. * @en
  57748. * Whether to keep the original aspect ratio of the video.
  57749. * @zh
  57750. * 是否保持视频原来的宽高比。
  57751. */
  57752. get keepAspectRatio(): boolean;
  57753. set keepAspectRatio(value: boolean);
  57754. /**
  57755. * @en
  57756. * Whether to play the video in full screen.
  57757. * @zh
  57758. * 是否全屏播放视频。
  57759. */
  57760. get fullScreenOnAwake(): boolean;
  57761. set fullScreenOnAwake(value: boolean);
  57762. /**
  57763. * @en
  57764. * Always at the bottom of the game view.
  57765. * This property relies on the translucency feature of Canvas, please enable ENABLE_TRANSPARENT_CANVAS in project preferences.
  57766. * Note: It's only available on the Web platform.
  57767. * Due to the support and limitations of each browser, the effect may not be guaranteed to be consistent.
  57768. * @zh
  57769. * 永远在游戏视图最底层。
  57770. * 该属性依赖 Canvas 的半透明特性,请在项目偏好设置里开启 ENABLE_TRANSPARENT_CANVAS。
  57771. * 注意:该属性只有在 Web 平台上有效果。由于各浏览器的支持与限制,效果可能无法保证一致。
  57772. */
  57773. get stayOnBottom(): boolean;
  57774. set stayOnBottom(value: boolean);
  57775. static EventType: typeof __private._cocos_video_video_player_enums__EventType;
  57776. static ResourceType: {
  57777. REMOTE: number;
  57778. LOCAL: number;
  57779. };
  57780. /**
  57781. * @en
  57782. * The video player's callback, it will be triggered in certain situations, such as playing, paused, stopped and completed.
  57783. * @zh
  57784. * 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。
  57785. */
  57786. videoPlayerEvent: EventHandler[];
  57787. /**
  57788. * @en
  57789. * Gets the original video object, generally used for user customization.
  57790. * @zh
  57791. * 获取原始视频对象,一般用于用户定制。
  57792. */
  57793. get nativeVideo(): HTMLVideoElement | null;
  57794. /**
  57795. * @en
  57796. * Gets the time progress of the current video playback.
  57797. * @zh
  57798. * 获取当前视频播放的时间进度。
  57799. */
  57800. get currentTime(): number;
  57801. /**
  57802. * @en
  57803. * Sets the time point when the video starts to play, in seconds.
  57804. * @zh
  57805. * 设置视频开始播放的时间点,单位是秒。
  57806. */
  57807. set currentTime(val: number);
  57808. /**
  57809. * @en
  57810. * Gets the audio duration, in seconds.
  57811. * @zh
  57812. * 获取以秒为单位的视频总时长。
  57813. */
  57814. get duration(): number;
  57815. /**
  57816. * @en
  57817. * Gets current audio state.
  57818. * @zh
  57819. * 获取当前视频状态。
  57820. */
  57821. get state(): __private._cocos_video_video_player_enums__EventType;
  57822. /**
  57823. * @en
  57824. * Whether the current video is playing, The return value type is Boolean.
  57825. * @zh
  57826. * 当前视频是否正在播放,返回值为布尔类型。
  57827. */
  57828. get isPlaying(): boolean;
  57829. protected syncSource(): void;
  57830. __preload(): void;
  57831. onEnable(): void;
  57832. onDisable(): void;
  57833. onDestroy(): void;
  57834. update(dt: number): void;
  57835. onMetaLoaded(): void;
  57836. onReadyToPlay(): void;
  57837. onPlaying(): void;
  57838. onPaused(): void;
  57839. onStopped(): void;
  57840. onCompleted(): void;
  57841. onError(): void;
  57842. onClicked(): void;
  57843. /**
  57844. * @en
  57845. * Play the clip.<br>
  57846. * Restart if already playing.<br>
  57847. * Resume if paused.
  57848. * @zh
  57849. * 开始播放。<br>
  57850. * 如果视频处于正在播放状态,将会重新开始播放视频。<br>
  57851. * 如果视频处于暂停状态,则会继续播放视频。
  57852. */
  57853. play(): void;
  57854. /**
  57855. * @en
  57856. * Resume the clip.
  57857. * If a video is paused, call this method to resume playing.
  57858. * @zh
  57859. * 继续播放。如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  57860. */
  57861. resume(): void;
  57862. /**
  57863. * @en
  57864. * Pause the clip.
  57865. * @zh
  57866. * 暂停播放。
  57867. */
  57868. pause(): void;
  57869. /**
  57870. * @en
  57871. * Stop the clip.
  57872. * @zh
  57873. * 停止播放。
  57874. */
  57875. stop(): void;
  57876. }
  57877. /**
  57878. * @en
  57879. * WebView component, used to display web pages in the game.
  57880. * Since different platforms have different authorizations, APIs, and control methods for WebView components, there is no unified standard yet.
  57881. * So currently only Web, iOS, and Android platforms are supported.
  57882. * @zh
  57883. * WebView 组件,用于在游戏中显示网页。
  57884. * 由于不同平台对于 WebView 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。
  57885. */
  57886. export class WebView extends Component {
  57887. protected _url: string;
  57888. protected _impl: __private._cocos_web_view_web_view_impl__WebViewImpl | null;
  57889. /**
  57890. * @en WebView event type.
  57891. * @zh 网页视图事件类型。
  57892. */
  57893. static EventType: typeof __private._cocos_web_view_web_view_enums__EventType;
  57894. /**
  57895. * @en
  57896. * A given URL to be loaded by the WebView, it should have a http or https prefix.
  57897. * @zh
  57898. * 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串。
  57899. */
  57900. get url(): string;
  57901. set url(val: string);
  57902. /**
  57903. * @en
  57904. * The webview's event callback, it will be triggered after the loading is completed or when the loading error occurs.
  57905. * @zh
  57906. * WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数。
  57907. */
  57908. webviewEvents: EventHandler[];
  57909. /**
  57910. * @en
  57911. * Raw webview objects for user customization.
  57912. * @zh
  57913. * 原始网页对象,用于用户定制。
  57914. */
  57915. get nativeWebView(): HTMLIFrameElement | null;
  57916. /**
  57917. * @en
  57918. * Gets the current webview state.
  57919. * @zh
  57920. * 获取当前网页视图状态。
  57921. */
  57922. get state(): __private._cocos_web_view_web_view_enums__EventType;
  57923. /**
  57924. * @en
  57925. * Sets javascript interface scheme (see also setOnJSCallback).
  57926. * Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.
  57927. * Please refer to the official documentation for more details.
  57928. * @zh
  57929. * 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。
  57930. * 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。
  57931. * 详情请参阅官方文档
  57932. * @method setJavascriptInterfaceScheme
  57933. * @param {String} scheme
  57934. */
  57935. setJavascriptInterfaceScheme(scheme: string): void;
  57936. /**
  57937. * @en
  57938. * This callback called when load URL that start with javascript
  57939. * interface scheme (see also setJavascriptInterfaceScheme).
  57940. * Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.
  57941. * Please refer to the official documentation for more details.
  57942. * @zh
  57943. * 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。
  57944. * 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  57945. * 详情请参阅官方文档。
  57946. * @method setOnJSCallback
  57947. * @param {Function} callback
  57948. */
  57949. setOnJSCallback(callback: () => void): void;
  57950. /**
  57951. * @en
  57952. * Evaluates JavaScript in the context of the currently displayed page.
  57953. * Please refer to the official document for more details
  57954. * Note: Cross domain issues need to be resolved by yourself
  57955. * @zh
  57956. * 执行 WebView 内部页面脚本(详情请参阅官方文档)。
  57957. * 注意:需要自行解决跨域问题。
  57958. * @method evaluateJS
  57959. * @param {String} str
  57960. */
  57961. evaluateJS(str: string): void;
  57962. __preload(): void;
  57963. onLoading(): void;
  57964. onLoaded(): void;
  57965. onError(...args: any[any]): void;
  57966. onEnable(): void;
  57967. onDisable(): void;
  57968. onDestroy(): void;
  57969. update(dt: number): void;
  57970. }
  57971. export enum DeviceType {
  57972. Other = 0,
  57973. Left = 1,
  57974. Right = 2
  57975. }
  57976. /**
  57977. * @en Xr 3DUI event type
  57978. * @zh xr的3DUI事件类型
  57979. */
  57980. export enum XrUIPressEventType {
  57981. XRUI_HOVER_ENTERED = "xrui-hover-entered",
  57982. XRUI_HOVER_EXITED = "xrui-hover-exited",
  57983. XRUI_HOVER_STAY = "xrui-hover-stay",
  57984. XRUI_CLICK = "xrui-click",
  57985. XRUI_UNCLICK = "xrui-unclick"
  57986. }
  57987. /**
  57988. * @en Xr Keyboard event type
  57989. * @zh xr的虚拟键盘事件类型
  57990. */
  57991. export enum XrKeyboardEventType {
  57992. /**
  57993. * @en
  57994. * The event type for XR keyboard case switching event
  57995. *
  57996. * @zh
  57997. * XR键盘大小写切换事件
  57998. */
  57999. XR_CAPS_LOCK = "xr-caps-lock",
  58000. /**
  58001. * @en
  58002. * The event type for XR keyboard initialization event
  58003. *
  58004. * @zh
  58005. * XR键盘初始化事件
  58006. */
  58007. XR_KEYBOARD_INIT = "xr-keyboard-init",
  58008. /**
  58009. * @en
  58010. * The event type for XR keyboard input event
  58011. *
  58012. * @zh
  58013. * XR键盘input事件
  58014. */
  58015. XR_KEYBOARD_INPUT = "xr-keyboard-input",
  58016. /**
  58017. * @en
  58018. * The event type for XR keyboard to latin
  58019. *
  58020. * @zh
  58021. * 转latin
  58022. */
  58023. TO_LATIN = "to-latin",
  58024. /**
  58025. * @en
  58026. * The event type for XR keyboard to symbol
  58027. *
  58028. * @zh
  58029. * 转symbol
  58030. */
  58031. TO_SYMBOL = "to-symbol",
  58032. /**
  58033. * @en
  58034. * The event type for XR keyboard to math_symbol
  58035. *
  58036. * @zh
  58037. * 转math_symbol
  58038. */
  58039. TO_MATH_SYMBOL = "to-math-symbol"
  58040. }
  58041. /**
  58042. * @en Xr 3DUI event.
  58043. *
  58044. * @zh xr的3DUI事件。
  58045. */
  58046. export class XrUIPressEvent extends Event {
  58047. /**
  58048. * @en Event trigger
  58049. * @zh 事件触发者(左右手柄等)
  58050. */
  58051. deviceType: DeviceType;
  58052. /**
  58053. * @en Collision detection point
  58054. * @zh 碰撞检测点
  58055. */
  58056. hitPoint: math.Vec3;
  58057. }
  58058. export import find = utils.find;
  58059. export import bits = math.bits;
  58060. export import Vec2 = math.Vec2;
  58061. export import v2 = math.v2;
  58062. export import Vec3 = math.Vec3;
  58063. export import v3 = math.v3;
  58064. export import Vec4 = math.Vec4;
  58065. export import v4 = math.v4;
  58066. export import Quat = math.Quat;
  58067. export import quat = math.quat;
  58068. export import Mat3 = math.Mat3;
  58069. export import Mat4 = math.Mat4;
  58070. export import mat4 = math.mat4;
  58071. export import AffineTransform = math.AffineTransform;
  58072. export import Size = math.Size;
  58073. export import size = math.size;
  58074. export import Rect = math.Rect;
  58075. export import rect = math.rect;
  58076. export import Color = math.Color;
  58077. export import color = math.color;
  58078. export import equals = math.equals;
  58079. export import approx = math.approx;
  58080. export import clamp = math.clamp;
  58081. export import clamp01 = math.clamp01;
  58082. export import lerp = math.lerp;
  58083. export import toRadian = math.toRadian;
  58084. export import toDegree = math.toDegree;
  58085. export import random = math.random;
  58086. export import setRandGenerator = math.setRandGenerator;
  58087. export import randomRange = math.randomRange;
  58088. export import randomRangeInt = math.randomRangeInt;
  58089. export import pseudoRandom = math.pseudoRandom;
  58090. export import pseudoRandomRange = math.pseudoRandomRange;
  58091. export import pseudoRandomRangeInt = math.pseudoRandomRangeInt;
  58092. export import nextPow2 = math.nextPow2;
  58093. export import repeat = math.repeat;
  58094. export import pingPong = math.pingPong;
  58095. export import inverseLerp = math.inverseLerp;
  58096. export import absMaxComponent = math.absMaxComponent;
  58097. export import absMax = math.absMax;
  58098. export import enumerableProps = math.enumerableProps;
  58099. export import floatToHalf = math.floatToHalf;
  58100. export import halfToFloat = math.halfToFloat;
  58101. export import HALF_PI = math.HALF_PI;
  58102. export import TWO_PI = math.TWO_PI;
  58103. export import EPSILON = math.EPSILON;
  58104. export import IColorLike = math.IColorLike;
  58105. export import IMat3Like = math.IMat3Like;
  58106. export import IMat4Like = math.IMat4Like;
  58107. export import IQuatLike = math.IQuatLike;
  58108. export import IRectLike = math.IRectLike;
  58109. export import ISizeLike = math.ISizeLike;
  58110. export import IVec2Like = math.IVec2Like;
  58111. export import IVec3Like = math.IVec3Like;
  58112. export import IVec4Like = math.IVec4Like;
  58113. export import FloatArray = math.FloatArray;
  58114. export import IVec2 = math.IVec2;
  58115. export import IVec3 = math.IVec3;
  58116. export import IVec4 = math.IVec4;
  58117. export import IMat3 = math.IMat3;
  58118. export import IMat4 = math.IMat4;
  58119. export import IRect = math.IRect;
  58120. export import IQuat = math.IQuat;
  58121. export import IColor = math.IColor;
  58122. export import MATH_FLOAT_ARRAY = math.MATH_FLOAT_ARRAY;
  58123. export import MathBase = math.MathBase;
  58124. export import Pool = memop.Pool;
  58125. export import RecyclePool = memop.RecyclePool;
  58126. export import CachedArray = memop.CachedArray;
  58127. export import PhysicsSystem = physics.PhysicsSystem;
  58128. export import PhysicsRayResult = physics.PhysicsRayResult;
  58129. export import PhysicsLineStripCastResult = physics.PhysicsLineStripCastResult;
  58130. export import Collider = physics.Collider;
  58131. export import ColliderComponent = physics.Collider;
  58132. export import BoxCollider = physics.BoxCollider;
  58133. export import BoxColliderComponent = physics.BoxCollider;
  58134. export import SphereCollider = physics.SphereCollider;
  58135. export import SphereColliderComponent = physics.SphereCollider;
  58136. export import CapsuleCollider = physics.CapsuleCollider;
  58137. export import CapsuleColliderComponent = physics.CapsuleCollider;
  58138. export import MeshCollider = physics.MeshCollider;
  58139. export import MeshColliderComponent = physics.MeshCollider;
  58140. export import CylinderCollider = physics.CylinderCollider;
  58141. export import CylinderColliderComponent = physics.CylinderCollider;
  58142. export import ConeCollider = physics.ConeCollider;
  58143. export import TerrainCollider = physics.TerrainCollider;
  58144. export import SimplexCollider = physics.SimplexCollider;
  58145. export import PlaneCollider = physics.PlaneCollider;
  58146. export import Constraint = physics.Constraint;
  58147. export import HingeConstraint = physics.HingeConstraint;
  58148. export import FixedConstraint = physics.FixedConstraint;
  58149. export import PointToPointConstraint = physics.PointToPointConstraint;
  58150. export import ConfigurableConstraint = physics.ConfigurableConstraint;
  58151. export import RigidBody = physics.RigidBody;
  58152. export import RigidBodyComponent = physics.RigidBody;
  58153. export import PhysicsMaterial = physics.PhysicsMaterial;
  58154. export import PhysicMaterial = physics.PhysicsMaterial;
  58155. export import ConstantForce = physics.ConstantForce;
  58156. export import CharacterController = physics.CharacterController;
  58157. export import BoxCharacterController = physics.BoxCharacterController;
  58158. export import CapsuleCharacterController = physics.CapsuleCharacterController;
  58159. export import ERigidBodyType = physics.ERigidBodyType;
  58160. export import EAxisDirection = physics.EAxisDirection;
  58161. export import EColliderType = physics.EColliderType;
  58162. export import EPhysicsDrawFlags = physics.EPhysicsDrawFlags;
  58163. export namespace __private {
  58164. /**
  58165. * Engine classes with this kind of signature are integrated with editor extendability.
  58166. * @internal
  58167. */
  58168. export interface _cocos_core_data_editor_extras_tag__EditorExtendableObject {
  58169. /**
  58170. * @en
  58171. * The editor extras on this object.
  58172. *
  58173. * BE CAREFUL: this property is currently governed by Cocos Creator Editor.
  58174. * Its definition is not visible and is unknown to both engine code and users codes,
  58175. * they SHALL NOT operate it.
  58176. *
  58177. * You should use the editor extras tag to visit this property.
  58178. * @example
  58179. * ```ts
  58180. * import { editorExtrasTag } from 'cc';
  58181. * node[editorExtrasTag] = {};
  58182. * node[editorExtrasTag].someWhat;
  58183. * ```
  58184. * Even if you know `editorExtrasTag === '__editorExtras__'` in current,
  58185. * don't access the property through that:
  58186. * ```ts
  58187. * node.__editorExtras__ = {}; // Error: might be break in future.
  58188. * ```
  58189. * @zh
  58190. * 此对象的编辑器额外数据。
  58191. *
  58192. * **注意**:此属性目前由 Cocos Creator 编辑器管理。
  58193. * 它的定义不管是对于引擎还是用户代码都是不可见的,也 **不应该** 操作该数据。
  58194. *
  58195. * 你应该仅使用编辑器额外数据标签来访问此数据。
  58196. * @example
  58197. * ```ts
  58198. * import { editorExtrasTag } from 'cc';
  58199. * node[editorExtrasTag] = {};
  58200. * node[editorExtrasTag].someWhat;
  58201. * ```
  58202. * 即使你知道目前 `editorExtrasTag === '__editorExtras__'`,
  58203. * 也不要通过字符串属性来访问:
  58204. * ```ts
  58205. * node.__editorExtras__ = {}; // 错误:在未来可能无法生效
  58206. * ```
  58207. */
  58208. [editorExtrasTag]: unknown;
  58209. }
  58210. /**
  58211. * Class which implements the `EditorExtendableObject` interface.
  58212. * @engineInternal
  58213. */
  58214. export const _cocos_core_data_editor_extendable__EditorExtendable: new (...args: any[]) => _cocos_core_data_editor_extras_tag__EditorExtendableObject;
  58215. export type _cocos_core_data_editor_extendable__EditorExtendable = InstanceType<typeof _cocos_core_data_editor_extendable__EditorExtendable>;
  58216. export abstract class _cocos_animation_embedded_player_embedded_player__EmbeddedPlayableState {
  58217. constructor(randomAccess: boolean);
  58218. /**
  58219. * @zh
  58220. * 是否可以随意调整此播放器到任何时间。
  58221. * @en
  58222. * Indicates if this player can be adjusted to any time.
  58223. */
  58224. get randomAccess(): boolean;
  58225. /**
  58226. * @zh
  58227. * 销毁此播放器。
  58228. * @zh
  58229. * Destroys this player state.
  58230. */
  58231. abstract destroy(): void;
  58232. /**
  58233. * @zh
  58234. * 该方法在此播放器开始播放时触发。
  58235. * @en
  58236. * This method is called when this player gets to play.
  58237. */
  58238. abstract play(): void;
  58239. /**
  58240. * @zh
  58241. * 该方法在此播放器暂停播放时触发。
  58242. * @en
  58243. * This method is called when this player pauses.
  58244. */
  58245. abstract pause(): void;
  58246. /**
  58247. * @zh
  58248. * 该方法在此播放器结束播放时触发,或在宿主动画剪辑本身停止播放时触发。
  58249. * @en
  58250. * This method is called when this player ends its playback, and is called when the host animation clip is stopped.
  58251. */
  58252. abstract stop(): void;
  58253. /**
  58254. * @zh
  58255. * 如果 [[`EmbeddedPlayer.reconciledSpeed`]] 为 `true`,则在宿主的播放速度改变时触发。
  58256. * @en
  58257. * If [[`EmbeddedPlayer.reconciledSpeed`]] is `true`, is called when the host changes its speed.
  58258. * @param speed The speed.
  58259. */
  58260. abstract setSpeed(speed: number): void;
  58261. setTime(_time: number): void;
  58262. }
  58263. export class _cocos_animation_embedded_player_embedded_particle_system_player__EmbeddedParticleSystemPlayableState extends _cocos_animation_embedded_player_embedded_player__EmbeddedPlayableState {
  58264. constructor(particleSystem: ParticleSystem);
  58265. destroy(): void;
  58266. /**
  58267. * Plays the particle system from the beginning no matter current time.
  58268. */
  58269. play(): void;
  58270. /**
  58271. * Pause the particle system no matter current time.
  58272. */
  58273. pause(): void;
  58274. /**
  58275. * Stops the particle system.
  58276. */
  58277. stop(): void;
  58278. /**
  58279. * Sets the speed of the particle system.
  58280. * @param speed The speed.
  58281. */
  58282. setSpeed(speed: number): void;
  58283. }
  58284. export class _cocos_animation_embedded_player_embedded_animation_clip_player__EmbeddedAnimationClipPlayableState extends _cocos_animation_embedded_player_embedded_player__EmbeddedPlayableState {
  58285. constructor(animationState: AnimationState);
  58286. destroy(): void;
  58287. /**
  58288. * Plays the animation state at specified time.
  58289. */
  58290. play(): void;
  58291. /**
  58292. * Pause the animation state.
  58293. */
  58294. pause(): void;
  58295. /**
  58296. * Stops the animation state.
  58297. */
  58298. stop(): void;
  58299. /**
  58300. * Sets the speed of the animation state.
  58301. */
  58302. setSpeed(speed: number): void;
  58303. setTime(time: number): void;
  58304. }
  58305. export type _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName = "position" | "scale" | "rotation" | "eulerAngles";
  58306. export interface _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterHost {
  58307. readonly weight: number;
  58308. }
  58309. export interface _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<TValue> {
  58310. /**
  58311. * How many writer reference this property.
  58312. */
  58313. refCount: number;
  58314. readonly result: Readonly<TValue>;
  58315. blend(value: Readonly<TValue>, weight: number): void;
  58316. }
  58317. export interface _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendStateTypeMap<TVec3PropertyBlendState, TQuatPropertyBlendState> {
  58318. "rotation": TQuatPropertyBlendState;
  58319. "position": TVec3PropertyBlendState;
  58320. "scale": TVec3PropertyBlendState;
  58321. "eulerAngles": TVec3PropertyBlendState;
  58322. }
  58323. export interface _cocos_animation_tracks_track__RuntimeBinding<T = unknown> {
  58324. setValue(value: T): void;
  58325. getValue?(): T;
  58326. }
  58327. export class _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterInternal<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName> implements _cocos_animation_tracks_track__RuntimeBinding {
  58328. protected _node: Node;
  58329. protected _property: P;
  58330. protected _propertyBlendState: _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendStateTypeMap<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>>[P];
  58331. protected _host: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterHost;
  58332. protected _constants: boolean;
  58333. constructor(_node: Node, _property: P, _propertyBlendState: _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendStateTypeMap<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>>[P], _host: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterHost, _constants: boolean);
  58334. get node(): Node;
  58335. get property(): P;
  58336. getValue(): Node[P];
  58337. setValue(value: _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendStateTypeMap<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>>[P]["result"]): void;
  58338. }
  58339. export type _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriter<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName> = Omit<_cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterInternal<P>, "node" | "property">;
  58340. export abstract class _cocos_3d_skeletal_animation_skeletal_animation_blending__NodeBlendState<TVec3PropertyBlendState extends _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, TQuatPropertyBlendState extends _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>> {
  58341. get empty(): boolean;
  58342. refProperty<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName>(node: Node, property: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName): _cocos_3d_skeletal_animation_skeletal_animation_blending__NodeBlendState<TVec3PropertyBlendState, TQuatPropertyBlendState>["_properties"][P];
  58343. deRefProperty(property: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName): void;
  58344. apply(node: Node): void;
  58345. protected _transformApplyFlags: number;
  58346. protected _properties: {
  58347. position?: TVec3PropertyBlendState;
  58348. rotation?: TQuatPropertyBlendState;
  58349. eulerAngles?: TVec3PropertyBlendState;
  58350. scale?: TVec3PropertyBlendState;
  58351. };
  58352. protected abstract _createVec3BlendState(currentValue: Readonly<math.Vec3>): TVec3PropertyBlendState;
  58353. protected abstract _createQuatBlendState(currentValue: Readonly<math.Quat>): TQuatPropertyBlendState;
  58354. }
  58355. export abstract class _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateBuffer<TNodeBlendState extends _cocos_3d_skeletal_animation_skeletal_animation_blending__NodeBlendState<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>> = _cocos_3d_skeletal_animation_skeletal_animation_blending__NodeBlendState<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>>> {
  58356. protected _nodeBlendStates: Map<Node, TNodeBlendState>;
  58357. createWriter<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName>(node: Node, property: P, host: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriterHost, constants: boolean): _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriter<P>;
  58358. destroyWriter<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName>(writer: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriter<P>): void;
  58359. ref<P extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName>(node: Node, property: P): _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendStateTypeMap<_cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3>, _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat>>[P];
  58360. deRef(node: Node, property: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName): void;
  58361. apply(): void;
  58362. protected abstract createNodeBlendState(): TNodeBlendState;
  58363. }
  58364. export type _cocos_animation_pose_output__Pose = _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateBuffer;
  58365. export class _cocos_animation_pose_output__PoseOutput {
  58366. weight: number;
  58367. constructor(pose: _cocos_animation_pose_output__Pose);
  58368. destroy(): void;
  58369. createPoseWriter(node: Node, property: _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName, constants: boolean): _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateWriter<_cocos_3d_skeletal_animation_skeletal_animation_blending__BlendingPropertyName>;
  58370. }
  58371. /**
  58372. * Composite of track path and value proxy.
  58373. * Not exposed to external. If there is any reason it should be exposed,
  58374. * please redesign the public interfaces.
  58375. */
  58376. export class _cocos_animation_tracks_track__TrackBinding {
  58377. path: Readonly<animation.TrackPath>;
  58378. proxy: animation.IValueProxyFactory | undefined;
  58379. parseTrsPath(): {
  58380. node: string;
  58381. property: "position" | "scale" | "rotation" | "eulerAngles";
  58382. } | null;
  58383. createRuntimeBinding(target: unknown, poseOutput: _cocos_animation_pose_output__PoseOutput | undefined, isConstant: boolean): _cocos_animation_tracks_track__RuntimeBinding<unknown> | {
  58384. target: any;
  58385. setValue: any;
  58386. getValue: any;
  58387. } | null;
  58388. isMaskedOff(mask: AnimationMask): boolean;
  58389. }
  58390. export type _cocos_animation_tracks_track__Binder = (binding: _cocos_animation_tracks_track__TrackBinding) => undefined | _cocos_animation_tracks_track__RuntimeBinding;
  58391. export type _cocos_animation_exotic_animation_exotic_animation__FloatArray = Float32Array | Float64Array;
  58392. export enum _cocos_animation_exotic_animation_exotic_animation__FloatPrecision {
  58393. FLOAT_32 = 0,
  58394. FLOAT_64 = 1
  58395. }
  58396. export type _cocos_animation_exotic_animation_exotic_animation__QuantizationType = "uint8" | "uint16";
  58397. export type _cocos_animation_exotic_animation_exotic_animation__UintArray = Uint8Array | Uint16Array | Uint32Array;
  58398. export class _cocos_animation_exotic_animation_exotic_animation__QuantizedFloatArray {
  58399. originalPrecision: _cocos_animation_exotic_animation_exotic_animation__FloatPrecision;
  58400. min: number;
  58401. extent: number;
  58402. values: _cocos_animation_exotic_animation_exotic_animation__UintArray;
  58403. get quantizationType(): _cocos_animation_exotic_animation_exotic_animation__QuantizationType;
  58404. constructor(originalPrecision: _cocos_animation_exotic_animation_exotic_animation__FloatPrecision, values: _cocos_animation_exotic_animation_exotic_animation__UintArray, extent: number, min?: number);
  58405. /**
  58406. * @internal
  58407. */
  58408. toHashString(): string;
  58409. }
  58410. export type _cocos_animation_exotic_animation_exotic_animation__MayBeQuantized = _cocos_animation_exotic_animation_exotic_animation__FloatArray | _cocos_animation_exotic_animation_exotic_animation__QuantizedFloatArray;
  58411. export class _cocos_animation_exotic_animation_exotic_animation__ExoticVectorLikeTrackValues {
  58412. constructor(values: _cocos_animation_exotic_animation_exotic_animation__FloatArray);
  58413. get precision(): _cocos_animation_exotic_animation_exotic_animation__FloatPrecision;
  58414. quantize(type: _cocos_animation_exotic_animation_exotic_animation__QuantizationType): void;
  58415. /**
  58416. * @internal
  58417. */
  58418. toHashString(): string;
  58419. protected _values: _cocos_animation_exotic_animation_exotic_animation__MayBeQuantized;
  58420. protected _isQuantized: boolean;
  58421. }
  58422. export interface _cocos_animation_exotic_animation_exotic_animation__ExoticTrackValues<TValue> {
  58423. readonly precision: _cocos_animation_exotic_animation_exotic_animation__FloatPrecision;
  58424. get(index: number, resultValue: TValue): void;
  58425. lerp(prevIndex: number, nextIndex: number, ratio: number, prevValue: TValue, nextValue: TValue, resultValue: TValue): void;
  58426. }
  58427. export class _cocos_animation_exotic_animation_exotic_animation__ExoticVec3TrackValues extends _cocos_animation_exotic_animation_exotic_animation__ExoticVectorLikeTrackValues implements _cocos_animation_exotic_animation_exotic_animation__ExoticTrackValues<math.Vec3> {
  58428. static imitate(values: _cocos_animation_exotic_animation_exotic_animation__FloatArray, model: _cocos_animation_exotic_animation_exotic_animation__ExoticVec3TrackValues): _cocos_animation_exotic_animation_exotic_animation__ExoticVec3TrackValues;
  58429. get(index: number, resultValue: math.Vec3): void;
  58430. lerp(prevIndex: number, nextIndex: number, ratio: number, prevValue: math.Vec3, nextValue: math.Vec3, resultValue: math.Vec3): void;
  58431. }
  58432. export class _cocos_animation_exotic_animation_exotic_animation__ExoticTrack<TTrackValues extends {
  58433. toHashString(): string;
  58434. }> {
  58435. constructor(times: _cocos_animation_exotic_animation_exotic_animation__FloatArray, values: TTrackValues);
  58436. times: _cocos_animation_exotic_animation_exotic_animation__FloatArray;
  58437. values: TTrackValues;
  58438. /**
  58439. * @internal
  58440. */
  58441. toHashString(): string;
  58442. }
  58443. export type _cocos_animation_exotic_animation_exotic_animation__ExoticVec3Track = _cocos_animation_exotic_animation_exotic_animation__ExoticTrack<_cocos_animation_exotic_animation_exotic_animation__ExoticVec3TrackValues>;
  58444. export class _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrackValues extends _cocos_animation_exotic_animation_exotic_animation__ExoticVectorLikeTrackValues implements _cocos_animation_exotic_animation_exotic_animation__ExoticTrackValues<math.Quat> {
  58445. static imitate(values: _cocos_animation_exotic_animation_exotic_animation__FloatArray, model: _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrackValues): _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrackValues;
  58446. get(index: number, resultValue: math.Quat): void;
  58447. lerp(prevIndex: number, nextIndex: number, ratio: number, prevValue: math.Quat, nextValue: math.Quat, resultValue: math.Quat): void;
  58448. }
  58449. export type _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrack = _cocos_animation_exotic_animation_exotic_animation__ExoticTrack<_cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrackValues>;
  58450. export class _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimationEvaluator {
  58451. constructor(path: string, position: _cocos_animation_exotic_animation_exotic_animation__ExoticVec3Track | null, rotation: _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrack | null, scale: _cocos_animation_exotic_animation_exotic_animation__ExoticVec3Track | null, binder: _cocos_animation_tracks_track__Binder);
  58452. evaluate(time: number): void;
  58453. }
  58454. /**
  58455. * The reason why we wrap the index into an object is in that
  58456. * the number of bones may vary due to animation replacement/added/moved(remember we have "overrideClips").
  58457. */
  58458. export interface _cocos_animation_core_animation_handle__TransformHandle {
  58459. __brand: "TransformHandle";
  58460. /**
  58461. * Index of the transform in pose's transform array.
  58462. */
  58463. readonly index: number;
  58464. destroy(): void;
  58465. }
  58466. export interface _cocos_animation_core_animation_handle__AuxiliaryCurveHandle {
  58467. __brand: "AuxiliaryCurveHandle";
  58468. /**
  58469. * Index of the auxiliary curve in pose's auxiliary curve array.
  58470. */
  58471. readonly index: number;
  58472. destroy(): void;
  58473. }
  58474. export type _cocos_animation_core_transform__ReadonlyTransform = _cocos_animation_core_transform__Transform;
  58475. export class _cocos_animation_core_transform__Transform {
  58476. static IDENTITY: Readonly<_cocos_animation_core_transform__Transform>;
  58477. static ZERO: Readonly<_cocos_animation_core_transform__Transform>;
  58478. get position(): Readonly<math.Vec3>;
  58479. set position(value: Readonly<math.Vec3>);
  58480. get rotation(): Readonly<math.Quat>;
  58481. set rotation(value: Readonly<math.Quat>);
  58482. get scale(): Readonly<math.Vec3>;
  58483. set scale(value: Readonly<math.Vec3>);
  58484. static clone(src: _cocos_animation_core_transform__ReadonlyTransform): _cocos_animation_core_transform__Transform;
  58485. static setIdentity(out: _cocos_animation_core_transform__Transform): _cocos_animation_core_transform__Transform;
  58486. static copy(out: _cocos_animation_core_transform__Transform, src: _cocos_animation_core_transform__ReadonlyTransform): _cocos_animation_core_transform__Transform;
  58487. static equals(a: _cocos_animation_core_transform__ReadonlyTransform, b: _cocos_animation_core_transform__ReadonlyTransform, epsilon?: number): boolean;
  58488. static strictEquals(a: _cocos_animation_core_transform__ReadonlyTransform, b: _cocos_animation_core_transform__ReadonlyTransform): boolean;
  58489. static lerp(out: _cocos_animation_core_transform__Transform, from: _cocos_animation_core_transform__ReadonlyTransform, to: _cocos_animation_core_transform__ReadonlyTransform, t: number): _cocos_animation_core_transform__Transform;
  58490. /**
  58491. * Associate two transforms.
  58492. * The result is as if the `first` transform is applied and then the `second` transform.
  58493. * @param out The result transform.
  58494. * @param first The first transform to apply.
  58495. * @param second The second transform to apply.
  58496. * @returns `out`.
  58497. * @note
  58498. * Much important things to note is that
  58499. * currently the following prerequisites are imposed on scales of both transforms:
  58500. * - The scale should be uniformed, ie. all components should be the same.
  58501. * - Each component of the scale shall be non-negative.
  58502. */
  58503. static multiply(out: _cocos_animation_core_transform__Transform, second: _cocos_animation_core_transform__ReadonlyTransform, first: _cocos_animation_core_transform__ReadonlyTransform): _cocos_animation_core_transform__Transform;
  58504. /**
  58505. * Calculates the relative transitions.
  58506. * The result is as if `first` transform is associated by applying the result first then the `second`.
  58507. * @param out The result transform.
  58508. * @param first See description.
  58509. * @param second See description.
  58510. * @returns `out`.
  58511. * @note
  58512. *
  58513. * Note: if scale of second transform contains 0,
  58514. * the result scale's corresponding component would be error.
  58515. *
  58516. * Same restriction is applied to this method like `Transform.multiply`.
  58517. */
  58518. static calculateRelative: (out: _cocos_animation_core_transform__Transform, first: _cocos_animation_core_transform__ReadonlyTransform, second: _cocos_animation_core_transform__ReadonlyTransform) => _cocos_animation_core_transform__Transform;
  58519. /**
  58520. * Inverts the transform.
  58521. * @param out Out transform.
  58522. * @param transform Transform to invert.
  58523. */
  58524. static invert(out: _cocos_animation_core_transform__Transform, transform: _cocos_animation_core_transform__ReadonlyTransform): _cocos_animation_core_transform__Transform;
  58525. static fromMatrix(out: _cocos_animation_core_transform__Transform, matrix: Readonly<math.Mat4>): _cocos_animation_core_transform__Transform;
  58526. static toMatrix(out: math.Mat4, transform: _cocos_animation_core_transform__ReadonlyTransform): math.Mat4;
  58527. }
  58528. /**
  58529. * Array-buffer-based transform array.
  58530. */
  58531. export class _cocos_animation_core_transform_array__TransformArray {
  58532. static get BYTES_PER_ELEMENT(): number;
  58533. constructor(length?: number);
  58534. constructor(buffer: ArrayBuffer, byteOffset?: number, length?: number);
  58535. get buffer(): ArrayBufferLike;
  58536. get byteLength(): number;
  58537. get byteOffset(): number;
  58538. get length(): number;
  58539. getTransform(index: number, out: _cocos_animation_core_transform__Transform): _cocos_animation_core_transform__Transform;
  58540. getPosition(index: number, out: math.Vec3): math.Vec3;
  58541. getRotation(index: number, out: math.Quat): math.Quat;
  58542. getScale(index: number, out: math.Vec3): math.Vec3;
  58543. setTransform(index: number, value: Readonly<_cocos_animation_core_transform__Transform>): void;
  58544. setPosition(index: number, value: Readonly<math.Vec3>): void;
  58545. setRotation(index: number, value: Readonly<math.Quat>): void;
  58546. setScale(index: number, value: Readonly<math.Vec3>): void;
  58547. /**
  58548. * Same algorithm as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/copyWithin
  58549. * except for the the operating objects are transforms.
  58550. */
  58551. copyWithin(target: number, start: number, end?: number): void;
  58552. /**
  58553. * Same algorithm as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/fill
  58554. * except for the the operating objects are transforms.
  58555. */
  58556. fill(value: Readonly<_cocos_animation_core_transform__Transform>, start?: number, end?: number): void;
  58557. /**
  58558. * Same as `this.fill(Transform.ZERO, start, end)`.
  58559. */
  58560. fillZero(start?: number, end?: number): void;
  58561. /**
  58562. * Same algorithm as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set
  58563. * except for:
  58564. * - the the operating objects are transforms,
  58565. * - plain array is not allowed.
  58566. */
  58567. set(transformArray: Readonly<_cocos_animation_core_transform_array__TransformArray>, targetOffset?: number): void;
  58568. /**
  58569. * Same algorithm as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice
  58570. * except for the the operating objects are transforms.
  58571. */
  58572. slice(start?: number, end?: number): _cocos_animation_core_transform_array__TransformArray;
  58573. /**
  58574. * Copy a span of `source` into `this`.
  58575. * Equivalent to `this.set(source.slice(sourceOffset, sourceOffset + size), targetOffset)`
  58576. * except without perform the slicing.
  58577. * */
  58578. copyRange(targetOffset: number, source: Readonly<_cocos_animation_core_transform_array__TransformArray>, sourceOffset: number, size: number): void;
  58579. }
  58580. export enum _cocos_animation_core_pose__PoseTransformSpace {
  58581. /**
  58582. * Transforms are stored relative to their parent nodes.
  58583. */
  58584. LOCAL = 0,
  58585. /**
  58586. * Transforms are stored relative to the belonging animation controller's node's space.
  58587. */
  58588. COMPONENT = 1
  58589. }
  58590. export class _cocos_animation_core_pose__Pose {
  58591. readonly transforms: _cocos_animation_core_transform_array__TransformArray;
  58592. readonly auxiliaryCurves: Float64Array;
  58593. /**
  58594. * @internal
  58595. */
  58596. _poseTransformSpace: _cocos_animation_core_pose__PoseTransformSpace;
  58597. /**
  58598. * @internal
  58599. */
  58600. static _create(transforms: _cocos_animation_core_transform_array__TransformArray, auxiliaryCurves: Float64Array): _cocos_animation_core_pose__Pose;
  58601. }
  58602. export class _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimationAGEvaluation {
  58603. constructor(transformHandle: _cocos_animation_core_animation_handle__TransformHandle, position: _cocos_animation_exotic_animation_exotic_animation__ExoticVec3Track | null, rotation: _cocos_animation_exotic_animation_exotic_animation__ExoticQuatTrack | null, scale: _cocos_animation_exotic_animation_exotic_animation__ExoticVec3Track | null);
  58604. destroy(): void;
  58605. evaluate(time: number, pose: _cocos_animation_core_pose__Pose): void;
  58606. }
  58607. export class _cocos_animation_exotic_animation_exotic_animation__SplitInfo {
  58608. preLerpIndex: number;
  58609. preLerpRatio: number;
  58610. directKeyframesBegin: number;
  58611. directKeyframesEnd: number;
  58612. postLerpIndex: number;
  58613. postLerpRatio: number;
  58614. constructor();
  58615. get keyframesCount(): number;
  58616. calculate(times: ArrayLike<number>, from: number, to: number): void;
  58617. }
  58618. export class _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimation {
  58619. constructor(path: string);
  58620. createPosition(times: _cocos_animation_exotic_animation_exotic_animation__FloatArray, values: _cocos_animation_exotic_animation_exotic_animation__FloatArray): void;
  58621. createRotation(times: _cocos_animation_exotic_animation_exotic_animation__FloatArray, values: _cocos_animation_exotic_animation_exotic_animation__FloatArray): void;
  58622. createScale(times: _cocos_animation_exotic_animation_exotic_animation__FloatArray, values: _cocos_animation_exotic_animation_exotic_animation__FloatArray): void;
  58623. createEvaluator(binder: _cocos_animation_tracks_track__Binder): _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimationEvaluator;
  58624. createEvaluatorForAnimationGraph(context: ____private._cocos_animation_marionette_animation_graph_animation_clip_binding__AnimationClipGraphBindingContext): _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimationAGEvaluation | null;
  58625. split(from: number, to: number, splitInfoCache: _cocos_animation_exotic_animation_exotic_animation__SplitInfo): _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimation;
  58626. get path(): string;
  58627. /**
  58628. * @internal
  58629. */
  58630. toHashString(): string;
  58631. }
  58632. export class _cocos_animation_exotic_animation_exotic_animation__ExoticTrsAnimationEvaluator {
  58633. constructor(nodeAnimations: _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimation[], binder: _cocos_animation_tracks_track__Binder);
  58634. evaluate(time: number): void;
  58635. }
  58636. /**
  58637. * Exotic TRS animation graph evaluator.
  58638. */
  58639. export class _cocos_animation_exotic_animation_exotic_animation__ExoticTrsAGEvaluation {
  58640. constructor(nodeAnimations: _cocos_animation_exotic_animation_exotic_animation__ExoticNodeAnimation[], context: ____private._cocos_animation_marionette_animation_graph_animation_clip_binding__AnimationClipGraphBindingContext);
  58641. destroy(): void;
  58642. evaluate(time: number, pose: _cocos_animation_core_pose__Pose): void;
  58643. }
  58644. export type _cocos_animation_tracks_track__Curve = RealCurve | QuatCurve | ObjectCurve<unknown>;
  58645. /**
  58646. * @en
  58647. * Channel contains a curve.
  58648. * @zh
  58649. * 通道包含了一条曲线。
  58650. */
  58651. export class _cocos_animation_tracks_track__Channel<T = _cocos_animation_tracks_track__Curve> {
  58652. constructor(curve: T);
  58653. /**
  58654. * @internal Not used for now.
  58655. */
  58656. name: string;
  58657. /**
  58658. * @en The curve within the channel.
  58659. * @zh 通道中的曲线。
  58660. */
  58661. get curve(): T;
  58662. }
  58663. export type _cocos_animation_tracks_track__RealChannel = _cocos_animation_tracks_track__Channel<RealCurve>;
  58664. export const _cocos_animation_define__createEvalSymbol: unique symbol;
  58665. export interface _cocos_animation_tracks_track__TrackEval<TValue> {
  58666. /**
  58667. * A flag indicating if the track requires a default value to be passed to `this.evaluate`.
  58668. */
  58669. readonly requiresDefault: boolean;
  58670. /**
  58671. * Evaluates the track.
  58672. * @param time The time.
  58673. * @param defaultValue A default value.
  58674. * This param will be passed if `this.requiresDefault === true` and
  58675. * the caller is able to provide such a default value.
  58676. */
  58677. evaluate(time: number, defaultValue?: TValue extends unknown ? unknown : Readonly<TValue>): TValue;
  58678. }
  58679. export class _cocos_animation_tracks_array_track__RealArrayTrackEval implements _cocos_animation_tracks_track__TrackEval<readonly number[]> {
  58680. constructor(_curves: RealCurve[]);
  58681. get requiresDefault(): boolean;
  58682. evaluate(time: number): number[];
  58683. }
  58684. export class _cocos_animation_core_pose__TransformFilter {
  58685. constructor(involvedTransforms: readonly number[]);
  58686. get involvedTransforms(): Readonly<Uint16Array>;
  58687. }
  58688. export class _editor_src_marionette_preview__MotionEvalRecord {
  58689. constructor(motion: _Motion);
  58690. get motion(): _Motion;
  58691. get duration(): number;
  58692. sample(progress: number, context: ____private._cocos_animation_marionette_animation_graph_context__AnimationGraphEvaluationContext): _cocos_animation_core_pose__Pose;
  58693. getWeightsRecursive(weight: number): Iterable<[
  58694. ____private._cocos_animation_marionette_graph_debug__RuntimeID,
  58695. number
  58696. ]>;
  58697. rebind(bindContext: ____private._cocos_animation_marionette_animation_graph_context__AnimationGraphBindingContext): void;
  58698. }
  58699. export class _editor_src_marionette_preview__AnimationGraphPartialPreviewer {
  58700. constructor(root: Node);
  58701. destroy(): void;
  58702. clear(): void;
  58703. evaluate(): void;
  58704. addVariable(id: string, description: _VariableDescription): void;
  58705. removeVariable(id: string): void;
  58706. updateVariable(id: string, value: animation.Value_experimental): void;
  58707. protected createMotionEval(motion: _Motion): _editor_src_marionette_preview__MotionEvalRecord | null;
  58708. protected doEvaluate(_evaluationContext: ____private._cocos_animation_marionette_animation_graph_context__AnimationGraphEvaluationContext): _cocos_animation_core_pose__Pose | null;
  58709. }
  58710. export const _cocos_serialization_deserialize_symbols__onAfterDeserializedTag: unique symbol;
  58711. export type __types_globals__Constructor<T = unknown> = new (...args: any[]) => T;
  58712. export type _editor_src_marionette_pose_graph_editor_api__Constructor<T = unknown> = new (...args: any[]) => T;
  58713. export interface _editor_src_marionette_pose_graph_editor_api__PoseGraphOutputNodeCopyInfo {
  58714. editorExtras: ____private._cocos_animation_marionette_pose_graph_graph_output_node__PoseGraphOutputNode[typeof editorExtrasTag];
  58715. }
  58716. export interface _editor_src_marionette_pose_graph_editor_api__PoseGraphNodesCopyInfo {
  58717. nodes: (_poseGraphOp.Node | _editor_src_marionette_pose_graph_editor_api__PoseGraphOutputNodeCopyInfo)[];
  58718. bindings: Array<{
  58719. consumer: number;
  58720. inputKey: _poseGraphOp.InputKey;
  58721. producer: number;
  58722. outputKey: _poseGraphOp.OutputKey;
  58723. }>;
  58724. }
  58725. export type _editor_src_marionette_visit_visit_pose_node__PoseNodeLocationRoot = [
  58726. string | ""
  58727. ];
  58728. export type _editor_src_marionette_visit_visit_pose_node__PoseNodeLocation = [
  58729. node: ____private._cocos_animation_marionette_pose_graph_pose_node__PoseNode,
  58730. graph: _PoseGraph,
  58731. ...root: _editor_src_marionette_visit_visit_pose_node__PoseNodeLocationRoot
  58732. ];
  58733. export type _cocos_serialization_compiled_builtin_value_type__ValueTypeData = [
  58734. typeIndex: number,
  58735. ...values: number[]
  58736. ];
  58737. export const _cocos_core_platform_macro__KEY: {
  58738. /**
  58739. * @en None
  58740. * @zh 没有分配
  58741. * @readonly
  58742. */
  58743. none: number;
  58744. /**
  58745. * @en The back key on mobile phone
  58746. * @zh 移动端返回键
  58747. * @readonly
  58748. * @deprecated since v3.3, please use KeyCode.MOBILE_BACK instead.
  58749. */
  58750. back: number;
  58751. /**
  58752. * @en The menu key on mobile phone
  58753. * @zh 移动端菜单键
  58754. * @readonly
  58755. * @deprecated since v3.3
  58756. */
  58757. menu: number;
  58758. /**
  58759. * @en The backspace key
  58760. * @zh 退格键
  58761. * @readonly
  58762. */
  58763. backspace: number;
  58764. /**
  58765. * @en The tab key
  58766. * @zh Tab 键
  58767. * @readonly
  58768. */
  58769. tab: number;
  58770. /**
  58771. * @en The enter key
  58772. * @zh 回车键
  58773. * @readonly
  58774. */
  58775. enter: number;
  58776. /**
  58777. * @en The shift key
  58778. * @zh Shift 键
  58779. * @readonly
  58780. * @deprecated since v3.3, please use KeyCode.SHIFT_LEFT instead.
  58781. */
  58782. shift: number;
  58783. /**
  58784. * @en The ctrl key
  58785. * @zh Ctrl 键
  58786. * @readonly
  58787. * @deprecated since v3.3, please use KeyCode.CTRL_LEFT instead.
  58788. */
  58789. ctrl: number;
  58790. /**
  58791. * @en The alt key
  58792. * @zh Alt 键
  58793. * @readonly
  58794. * @deprecated since v3.3, please use KeyCode.ALT_LEFT instead.
  58795. */
  58796. alt: number;
  58797. /**
  58798. * @en The pause key
  58799. * @zh 暂停键
  58800. * @readonly
  58801. */
  58802. pause: number;
  58803. /**
  58804. * @en The caps lock key
  58805. * @zh 大写锁定键
  58806. * @readonly
  58807. */
  58808. capslock: number;
  58809. /**
  58810. * @en The esc key
  58811. * @zh ESC 键
  58812. * @readonly
  58813. */
  58814. escape: number;
  58815. /**
  58816. * @en The space key
  58817. * @zh 空格键
  58818. * @readonly
  58819. */
  58820. space: number;
  58821. /**
  58822. * @en The page up key
  58823. * @zh 向上翻页键
  58824. * @readonly
  58825. */
  58826. pageup: number;
  58827. /**
  58828. * @en The page down key
  58829. * @zh 向下翻页键
  58830. * @readonly
  58831. */
  58832. pagedown: number;
  58833. /**
  58834. * @en The end key
  58835. * @zh 结束键
  58836. * @readonly
  58837. */
  58838. end: number;
  58839. /**
  58840. * @en The home key
  58841. * @zh 主菜单键
  58842. * @readonly
  58843. */
  58844. home: number;
  58845. /**
  58846. * @en The left key
  58847. * @zh 向左箭头键
  58848. * @readonly
  58849. */
  58850. left: number;
  58851. /**
  58852. * @en The up key
  58853. * @zh 向上箭头键
  58854. * @readonly
  58855. */
  58856. up: number;
  58857. /**
  58858. * @en The right key
  58859. * @zh 向右箭头键
  58860. * @readonly
  58861. */
  58862. right: number;
  58863. /**
  58864. * @en The down key
  58865. * @zh 向下箭头键
  58866. * @readonly
  58867. */
  58868. down: number;
  58869. /**
  58870. * @en The select key
  58871. * @zh Select 键
  58872. * @readonly
  58873. * @deprecated since v3.3
  58874. */
  58875. select: number;
  58876. /**
  58877. * @en The insert key
  58878. * @zh 插入键
  58879. * @readonly
  58880. */
  58881. insert: number;
  58882. /**
  58883. * @en The Delete key
  58884. * @zh 删除键
  58885. * @readonly
  58886. */
  58887. Delete: number;
  58888. /**
  58889. * @en The '0' key on the top of the alphanumeric keyboard.
  58890. * @zh 字母键盘上的 0 键
  58891. * @readonly
  58892. * @deprecated since v3.3
  58893. */
  58894. 0: number;
  58895. /**
  58896. * @en The '1' key on the top of the alphanumeric keyboard.
  58897. * @zh 字母键盘上的 1 键
  58898. * @readonly
  58899. * @deprecated since v3.3
  58900. */
  58901. 1: number;
  58902. /**
  58903. * @en The '2' key on the top of the alphanumeric keyboard.
  58904. * @zh 字母键盘上的 2 键
  58905. * @readonly
  58906. * @deprecated since v3.3
  58907. */
  58908. 2: number;
  58909. /**
  58910. * @en The '3' key on the top of the alphanumeric keyboard.
  58911. * @zh 字母键盘上的 3 键
  58912. * @readonly
  58913. * @deprecated since v3.3
  58914. */
  58915. 3: number;
  58916. /**
  58917. * @en The '4' key on the top of the alphanumeric keyboard.
  58918. * @zh 字母键盘上的 4 键
  58919. * @readonly
  58920. * @deprecated since v3.3
  58921. */
  58922. 4: number;
  58923. /**
  58924. * @en The '5' key on the top of the alphanumeric keyboard.
  58925. * @zh 字母键盘上的 5 键
  58926. * @readonly
  58927. * @deprecated since v3.3
  58928. */
  58929. 5: number;
  58930. /**
  58931. * @en The '6' key on the top of the alphanumeric keyboard.
  58932. * @zh 字母键盘上的 6 键
  58933. * @readonly
  58934. * @deprecated since v3.3
  58935. */
  58936. 6: number;
  58937. /**
  58938. * @en The '7' key on the top of the alphanumeric keyboard.
  58939. * @zh 字母键盘上的 7 键
  58940. * @readonly
  58941. * @deprecated since v3.3
  58942. */
  58943. 7: number;
  58944. /**
  58945. * @en The '8' key on the top of the alphanumeric keyboard.
  58946. * @zh 字母键盘上的 8 键
  58947. * @readonly
  58948. * @deprecated since v3.3
  58949. */
  58950. 8: number;
  58951. /**
  58952. * @en The '9' key on the top of the alphanumeric keyboard.
  58953. * @zh 字母键盘上的 9 键
  58954. * @readonly
  58955. * @deprecated since v3.3
  58956. */
  58957. 9: number;
  58958. /**
  58959. * @en The a key
  58960. * @zh A 键
  58961. * @readonly
  58962. */
  58963. a: number;
  58964. /**
  58965. * @en The b key
  58966. * @zh B 键
  58967. * @readonly
  58968. */
  58969. b: number;
  58970. /**
  58971. * @en The c key
  58972. * @zh C 键
  58973. * @readonly
  58974. */
  58975. c: number;
  58976. /**
  58977. * @en The d key
  58978. * @zh D 键
  58979. * @readonly
  58980. */
  58981. d: number;
  58982. /**
  58983. * @en The e key
  58984. * @zh E 键
  58985. * @readonly
  58986. */
  58987. e: number;
  58988. /**
  58989. * @en The f key
  58990. * @zh F 键
  58991. * @readonly
  58992. */
  58993. f: number;
  58994. /**
  58995. * @en The g key
  58996. * @zh G 键
  58997. * @readonly
  58998. */
  58999. g: number;
  59000. /**
  59001. * @en The h key
  59002. * @zh H 键
  59003. * @readonly
  59004. */
  59005. h: number;
  59006. /**
  59007. * @en The i key
  59008. * @zh I 键
  59009. * @readonly
  59010. */
  59011. i: number;
  59012. /**
  59013. * @en The j key
  59014. * @zh J 键
  59015. * @readonly
  59016. */
  59017. j: number;
  59018. /**
  59019. * @en The k key
  59020. * @zh K 键
  59021. * @readonly
  59022. */
  59023. k: number;
  59024. /**
  59025. * @en The l key
  59026. * @zh L 键
  59027. * @readonly
  59028. */
  59029. l: number;
  59030. /**
  59031. * @en The m key
  59032. * @zh M 键
  59033. * @readonly
  59034. */
  59035. m: number;
  59036. /**
  59037. * @en The n key
  59038. * @zh N 键
  59039. * @readonly
  59040. */
  59041. n: number;
  59042. /**
  59043. * @en The o key
  59044. * @zh O 键
  59045. * @readonly
  59046. */
  59047. o: number;
  59048. /**
  59049. * @en The p key
  59050. * @zh P 键
  59051. * @readonly
  59052. */
  59053. p: number;
  59054. /**
  59055. * @en The q key
  59056. * @zh Q 键
  59057. * @readonly
  59058. */
  59059. q: number;
  59060. /**
  59061. * @en The r key
  59062. * @zh R 键
  59063. * @readonly
  59064. */
  59065. r: number;
  59066. /**
  59067. * @en The s key
  59068. * @zh S 键
  59069. * @readonly
  59070. */
  59071. s: number;
  59072. /**
  59073. * @en The t key
  59074. * @zh T 键
  59075. * @readonly
  59076. */
  59077. t: number;
  59078. /**
  59079. * @en The u key
  59080. * @zh U 键
  59081. * @readonly
  59082. */
  59083. u: number;
  59084. /**
  59085. * @en The v key
  59086. * @zh V 键
  59087. * @readonly
  59088. */
  59089. v: number;
  59090. /**
  59091. * @en The w key
  59092. * @zh W 键
  59093. * @readonly
  59094. */
  59095. w: number;
  59096. /**
  59097. * @en The x key
  59098. * @zh X 键
  59099. * @readonly
  59100. */
  59101. x: number;
  59102. /**
  59103. * @en The y key
  59104. * @zh Y 键
  59105. * @readonly
  59106. */
  59107. y: number;
  59108. /**
  59109. * @en The z key
  59110. * @zh Z 键
  59111. * @readonly
  59112. */
  59113. z: number;
  59114. /**
  59115. * @en The numeric keypad 0
  59116. * @zh 数字键盘 0
  59117. * @readonly
  59118. */
  59119. num0: number;
  59120. /**
  59121. * @en The numeric keypad 1
  59122. * @zh 数字键盘 1
  59123. * @readonly
  59124. */
  59125. num1: number;
  59126. /**
  59127. * @en The numeric keypad 2
  59128. * @zh 数字键盘 2
  59129. * @readonly
  59130. */
  59131. num2: number;
  59132. /**
  59133. * @en The numeric keypad 3
  59134. * @zh 数字键盘 3
  59135. * @readonly
  59136. */
  59137. num3: number;
  59138. /**
  59139. * @en The numeric keypad 4
  59140. * @zh 数字键盘 4
  59141. * @readonly
  59142. */
  59143. num4: number;
  59144. /**
  59145. * @en The numeric keypad 5
  59146. * @zh 数字键盘 5
  59147. * @readonly
  59148. */
  59149. num5: number;
  59150. /**
  59151. * @en The numeric keypad 6
  59152. * @zh 数字键盘 6
  59153. * @readonly
  59154. */
  59155. num6: number;
  59156. /**
  59157. * @en The numeric keypad 7
  59158. * @zh 数字键盘 7
  59159. * @readonly
  59160. */
  59161. num7: number;
  59162. /**
  59163. * @en The numeric keypad 8
  59164. * @zh 数字键盘 8
  59165. * @readonly
  59166. */
  59167. num8: number;
  59168. /**
  59169. * @en The numeric keypad 9
  59170. * @zh 数字键盘 9
  59171. * @readonly
  59172. */
  59173. num9: number;
  59174. /**
  59175. * @en The numeric keypad '*'
  59176. * @zh 数字键盘 *
  59177. * @readonly
  59178. * @deprecated since v3.3
  59179. */
  59180. "*": number;
  59181. /**
  59182. * @en The numeric keypad '+'
  59183. * @zh 数字键盘 +
  59184. * @readonly
  59185. * @deprecated since v3.3
  59186. */
  59187. "+": number;
  59188. /**
  59189. * @en The numeric keypad '-'
  59190. * @zh 数字键盘 -
  59191. * @readonly
  59192. * @deprecated since v3.3
  59193. */
  59194. "-": number;
  59195. /**
  59196. * @en The numeric keypad 'delete'
  59197. * @zh 数字键盘删除键
  59198. * @readonly
  59199. */
  59200. numdel: number;
  59201. /**
  59202. * @en The numeric keypad '/'
  59203. * @zh 数字键盘 /
  59204. * @readonly
  59205. * @deprecated since v3.3
  59206. */
  59207. "/": number;
  59208. /**
  59209. * @en The F1 function key
  59210. * @zh F1 功能键
  59211. * @readonly
  59212. */
  59213. f1: number;
  59214. /**
  59215. * @en The F2 function key
  59216. * @zh F2 功能键
  59217. * @readonly
  59218. */
  59219. f2: number;
  59220. /**
  59221. * @en The F3 function key
  59222. * @zh F3 功能键
  59223. * @readonly
  59224. */
  59225. f3: number;
  59226. /**
  59227. * @en The F4 function key
  59228. * @zh F4 功能键
  59229. * @readonly
  59230. */
  59231. f4: number;
  59232. /**
  59233. * @en The F5 function key
  59234. * @zh F5 功能键
  59235. * @readonly
  59236. */
  59237. f5: number;
  59238. /**
  59239. * @en The F6 function key
  59240. * @zh F6 功能键
  59241. * @readonly
  59242. */
  59243. f6: number;
  59244. /**
  59245. * @en The F7 function key
  59246. * @zh F7 功能键
  59247. * @readonly
  59248. */
  59249. f7: number;
  59250. /**
  59251. * @en The F8 function key
  59252. * @zh F8 功能键
  59253. * @readonly
  59254. */
  59255. f8: number;
  59256. /**
  59257. * @en The F9 function key
  59258. * @zh F9 功能键
  59259. * @readonly
  59260. */
  59261. f9: number;
  59262. /**
  59263. * @en The F10 function key
  59264. * @zh F10 功能键
  59265. * @readonly
  59266. */
  59267. f10: number;
  59268. /**
  59269. * @en The F11 function key
  59270. * @zh F11 功能键
  59271. * @readonly
  59272. */
  59273. f11: number;
  59274. /**
  59275. * @en The F12 function key
  59276. * @zh F12 功能键
  59277. * @readonly
  59278. */
  59279. f12: number;
  59280. /**
  59281. * @en The numlock key
  59282. * @zh 数字锁定键
  59283. * @readonly
  59284. */
  59285. numlock: number;
  59286. /**
  59287. * @en The scroll lock key
  59288. * @zh 滚动锁定键
  59289. * @readonly
  59290. */
  59291. scrolllock: number;
  59292. /**
  59293. * @en The ';' key.
  59294. * @zh 分号键
  59295. * @readonly
  59296. * @deprecated since v3.3
  59297. */
  59298. ";": number;
  59299. /**
  59300. * @en The ';' key.
  59301. * @zh 分号键
  59302. * @readonly
  59303. */
  59304. semicolon: number;
  59305. /**
  59306. * @en The '=' key.
  59307. * @zh 等于号键
  59308. * @readonly
  59309. */
  59310. equal: number;
  59311. /**
  59312. * @en The '=' key.
  59313. * @zh 等于号键
  59314. * @readonly
  59315. * @deprecated since v3.3
  59316. */
  59317. "=": number;
  59318. /**
  59319. * @en The ',' key.
  59320. * @zh 逗号键
  59321. * @readonly
  59322. * @deprecated since v3.3
  59323. */
  59324. ",": number;
  59325. /**
  59326. * @en The ',' key.
  59327. * @zh 逗号键
  59328. * @readonly
  59329. */
  59330. comma: number;
  59331. /**
  59332. * @en The dash '-' key.
  59333. * @zh 中划线键
  59334. * @readonly
  59335. */
  59336. dash: number;
  59337. /**
  59338. * @en The '.' key.
  59339. * @zh 句号键
  59340. * @readonly
  59341. * @deprecated since v3.3
  59342. */
  59343. ".": number;
  59344. /**
  59345. * @en The '.' key
  59346. * @zh 句号键
  59347. * @readonly
  59348. */
  59349. period: number;
  59350. /**
  59351. * @en The forward slash key
  59352. * @zh 正斜杠键
  59353. * @readonly
  59354. */
  59355. forwardslash: number;
  59356. /**
  59357. * @en The grave key
  59358. * @zh 按键 `
  59359. * @readonly
  59360. */
  59361. grave: number;
  59362. /**
  59363. * @en The '[' key
  59364. * @zh 按键 [
  59365. * @readonly
  59366. * @deprecated since v3.3
  59367. */
  59368. "[": number;
  59369. /**
  59370. * @en The '[' key
  59371. * @zh 按键 [
  59372. * @readonly
  59373. */
  59374. openbracket: number;
  59375. /**
  59376. * @en The '\' key
  59377. * @zh 反斜杠键
  59378. * @readonly
  59379. */
  59380. backslash: number;
  59381. /**
  59382. * @en The ']' key
  59383. * @zh 按键 ]
  59384. * @readonly
  59385. * @deprecated since v3.3
  59386. */
  59387. "]": number;
  59388. /**
  59389. * @en The ']' key
  59390. * @zh 按键 ]
  59391. * @readonly
  59392. */
  59393. closebracket: number;
  59394. /**
  59395. * @en The quote key
  59396. * @zh 单引号键
  59397. * @readonly
  59398. */
  59399. quote: number;
  59400. /**
  59401. * @en The dpad left key
  59402. * @zh 导航键 向左
  59403. * @readonly
  59404. * @deprecated since v3.3
  59405. */
  59406. dpadLeft: number;
  59407. /**
  59408. * @en The dpad right key
  59409. * @zh 导航键 向右
  59410. * @readonly
  59411. * @deprecated since v3.3
  59412. */
  59413. dpadRight: number;
  59414. /**
  59415. * @en The dpad up key
  59416. * @zh 导航键 向上
  59417. * @readonly
  59418. * @deprecated since v3.3
  59419. */
  59420. dpadUp: number;
  59421. /**
  59422. * @en The dpad down key
  59423. * @zh 导航键 向下
  59424. * @readonly
  59425. * @deprecated since v3.3
  59426. */
  59427. dpadDown: number;
  59428. /**
  59429. * @en The dpad center key
  59430. * @zh 导航键 确定键
  59431. * @readonly
  59432. * @deprecated since v3.3
  59433. */
  59434. dpadCenter: number;
  59435. };
  59436. export type __types_globals__TypedArray = Uint8Array | Uint8ClampedArray | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array;
  59437. export class _cocos_2d_renderer_native_2d__NativeUIMeshBuffer {
  59438. get vData(): Float32Array;
  59439. set vData(val: Float32Array);
  59440. get iData(): Uint16Array;
  59441. set iData(val: Uint16Array);
  59442. syncSharedBufferToNative(data: __types_globals__TypedArray): any;
  59443. initialize(attrs: gfx.Attribute[]): any;
  59444. reset(): any;
  59445. destroy(): any;
  59446. setDirty(): any;
  59447. recycleIA(): any;
  59448. uploadBuffers(): any;
  59449. }
  59450. /**
  59451. * @en Stencil stage types enum.
  59452. * @zh 模板状态类型枚举。
  59453. * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
  59454. */
  59455. export enum _cocos_2d_renderer_stencil_manager__Stage {
  59456. DISABLED = 0,
  59457. CLEAR = 1,
  59458. ENTER_LEVEL = 2,
  59459. ENABLED = 3,
  59460. EXIT_LEVEL = 4,
  59461. CLEAR_INVERTED = 5,
  59462. ENTER_LEVEL_INVERTED = 6
  59463. }
  59464. export interface _cocos_2d_assets_sprite_atlas__ISpriteFrameList {
  59465. [key: string]: SpriteFrame | null;
  59466. }
  59467. /**
  59468. * @en
  59469. * The texture pixel format, default value is RGBA8888,<br>
  59470. * you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,<br>
  59471. * other formats are supported by compressed file types or raw data.
  59472. * @zh
  59473. * 纹理像素格式,默认值为RGBA8888,<br>
  59474. * 你应该注意到普通图像文件(png,jpg)加载的纹理只能支持RGBA8888格式,<br>
  59475. * 压缩文件类型或原始数据支持其他格式。
  59476. */
  59477. export enum _cocos_asset_assets_asset_enum__PixelFormat {
  59478. /**
  59479. * @en
  59480. * 16-bit pixel format containing red, green and blue channels
  59481. * @zh
  59482. * 包含 RGB 通道的 16 位纹理。
  59483. */
  59484. RGB565 = 47,
  59485. /**
  59486. * @en
  59487. * 16-bit pixel format containing red, green, blue channels with 5 bits per channel and one bit alpha channel: RGB5A1
  59488. * @zh
  59489. * 包含 RGB(分别占 5 bits)和 1 bit 的 alpha 通道的 16 位纹理:RGB5A1。
  59490. */
  59491. RGB5A1 = 49,
  59492. /**
  59493. * @en
  59494. * 16-bit pixel format containing red, green, blue and alpha channels: RGBA4444
  59495. * @zh
  59496. * 包含 RGBA 通道的 16 位纹理:RGBA4444。
  59497. */
  59498. RGBA4444 = 50,
  59499. /**
  59500. * @en
  59501. * 24-bit pixel format containing red, green and blue channels: RGB888
  59502. * @zh
  59503. * 包含 RGB 通道的 24 位纹理:RGB888。
  59504. */
  59505. RGB888 = 24,
  59506. /**
  59507. * @en
  59508. * 32-bit float pixel format containing red, green and blue channels: RGBA32F
  59509. * @zh
  59510. * 包含 RGB 通道的 32 位浮点数像素格式:RGBA32F。
  59511. */
  59512. RGB32F = 32,
  59513. /**
  59514. * @en
  59515. * 32-bit pixel format containing red, green, blue and alpha channels: RGBA8888
  59516. * @zh
  59517. * 包含 RGBA 四通道的 32 位整形像素格式:RGBA8888。
  59518. */
  59519. RGBA8888 = 35,
  59520. /**
  59521. * @en
  59522. * 32-bit float pixel format containing red, green, blue and alpha channels: RGBA32F
  59523. * @zh
  59524. * 32位浮点数像素格式:RGBA32F。
  59525. */
  59526. RGBA32F = 44,
  59527. /**
  59528. * @en
  59529. * 8-bit pixel format used as masks
  59530. * @zh
  59531. * 用作蒙版的8位纹理。
  59532. */
  59533. A8 = 1,
  59534. /**
  59535. * @en
  59536. * 8-bit intensity pixel format
  59537. * @zh
  59538. * 8位强度纹理。
  59539. */
  59540. I8 = 2,
  59541. /**
  59542. * @en
  59543. * 16-bit pixel format used as masks
  59544. * @zh
  59545. * 用作蒙版的16位纹理。
  59546. */
  59547. AI8 = 3,
  59548. /**
  59549. * @en A pixel format containing red, green, and blue channels that is PVR 2bpp compressed.
  59550. * @zh 包含 RGB 通道的 PVR 2BPP 压缩纹理格式
  59551. */
  59552. RGB_PVRTC_2BPPV1 = 83,
  59553. /**
  59554. * @en A pixel format containing red, green, blue, and alpha channels that is PVR 2bpp compressed.
  59555. * @zh 包含 RGBA 通道的 PVR 2BPP 压缩纹理格式
  59556. */
  59557. RGBA_PVRTC_2BPPV1 = 84,
  59558. /**
  59559. * @en A pixel format containing red, green, blue, and alpha channels that is PVR 2bpp compressed.
  59560. * RGB_A_PVRTC_2BPPV1 texture is a 2x height RGB_PVRTC_2BPPV1 format texture.
  59561. * It separate the origin alpha channel to the bottom half atlas, the origin rgb channel to the top half atlas.
  59562. * @zh 包含 RGBA 通道的 PVR 2BPP 压缩纹理格式
  59563. * 这种压缩纹理格式贴图的高度是普通 RGB_PVRTC_2BPPV1 贴图高度的两倍,使用上半部分作为原始 RGB 通道数据,下半部分用来存储透明通道数据。
  59564. */
  59565. RGB_A_PVRTC_2BPPV1,
  59566. /**
  59567. * @en A pixel format containing red, green, and blue channels that is PVR 4bpp compressed.
  59568. * @zh 包含 RGB 通道的 PVR 4BPP 压缩纹理格式
  59569. */
  59570. RGB_PVRTC_4BPPV1 = 85,
  59571. /**
  59572. * @en A pixel format containing red, green, blue and alpha channels that is PVR 4bpp compressed.
  59573. * @zh 包含 RGBA 通道的 PVR 4BPP 压缩纹理格式
  59574. */
  59575. RGBA_PVRTC_4BPPV1 = 86,
  59576. /**
  59577. * @en A pixel format containing red, green, blue, and alpha channels that is PVR 4bpp compressed.
  59578. * RGB_A_PVRTC_4BPPV1 texture is a 2x height RGB_PVRTC_4BPPV1 format texture.
  59579. * It separate the origin alpha channel to the bottom half atlas, the origin rgb channel to the top half atlas.
  59580. * @zh 包含 RGBA 通道的 PVR 4BPP 压缩纹理格式
  59581. * 这种压缩纹理格式贴图的高度是普通 RGB_PVRTC_4BPPV1 贴图高度的两倍,使用上半部分作为原始 RGB 通道数据,下半部分用来存储透明通道数据。
  59582. */
  59583. RGB_A_PVRTC_4BPPV1,
  59584. /**
  59585. * @en A pixel format containing red, green, and blue channels that is ETC1 compressed.
  59586. * @zh 包含 RGB 通道的 ETC1 压缩纹理格式
  59587. */
  59588. RGB_ETC1 = 72,
  59589. /**
  59590. * @en A pixel format containing red, green, blue, and alpha channels that is ETC1 compressed.
  59591. * @zh 包含 RGBA 通道的 ETC1 压缩纹理格式
  59592. */
  59593. RGBA_ETC1,
  59594. /**
  59595. * @en A pixel format containing red, green, and blue channels that is ETC2 compressed.
  59596. * @zh 包含 RGB 通道的 ETC2 压缩纹理格式
  59597. */
  59598. RGB_ETC2 = 73,
  59599. /**
  59600. * @en A pixel format containing red, green, blue, and alpha channels that is ETC2 compressed.
  59601. * @zh 包含 RGBA 通道的 ETC2 压缩纹理格式
  59602. */
  59603. RGBA_ETC2 = 77,
  59604. /**
  59605. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 4x4 block size.
  59606. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 4x4
  59607. */
  59608. RGBA_ASTC_4x4 = 89,
  59609. /**
  59610. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 5x4 block size.
  59611. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 5x4
  59612. */
  59613. RGBA_ASTC_5x4 = 90,
  59614. /**
  59615. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 5x5 block size.
  59616. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 5x5
  59617. */
  59618. RGBA_ASTC_5x5 = 91,
  59619. /**
  59620. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 6x5 block size.
  59621. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 6x5
  59622. */
  59623. RGBA_ASTC_6x5 = 92,
  59624. /**
  59625. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 6x6 block size.
  59626. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 6x6
  59627. */
  59628. RGBA_ASTC_6x6 = 93,
  59629. /**
  59630. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x5 block size.
  59631. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x5
  59632. */
  59633. RGBA_ASTC_8x5 = 94,
  59634. /**
  59635. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x6 block size.
  59636. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x6
  59637. */
  59638. RGBA_ASTC_8x6 = 95,
  59639. /**
  59640. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x8 block size.
  59641. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x8
  59642. */
  59643. RGBA_ASTC_8x8 = 96,
  59644. /**
  59645. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x5 block size.
  59646. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x5
  59647. */
  59648. RGBA_ASTC_10x5 = 97,
  59649. /**
  59650. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x6 block size.
  59651. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x6
  59652. */
  59653. RGBA_ASTC_10x6 = 98,
  59654. /**
  59655. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x8 block size.
  59656. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x8
  59657. */
  59658. RGBA_ASTC_10x8 = 99,
  59659. /**
  59660. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x10 block size.
  59661. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x10
  59662. */
  59663. RGBA_ASTC_10x10 = 100,
  59664. /**
  59665. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 12x10 block size.
  59666. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 12x10
  59667. */
  59668. RGBA_ASTC_12x10 = 101,
  59669. /**
  59670. * @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 12x12 block size.
  59671. * @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 12x12
  59672. */
  59673. RGBA_ASTC_12x12 = 102
  59674. }
  59675. /**
  59676. * @en
  59677. * The texture wrap mode.
  59678. * @zh
  59679. * 纹理环绕方式。
  59680. */
  59681. export enum _cocos_asset_assets_asset_enum__WrapMode {
  59682. /**
  59683. * @en
  59684. * Specifies that the repeat warp mode will be used.
  59685. * @zh
  59686. * 指定环绕模式:重复纹理图像。
  59687. */
  59688. REPEAT = 0,
  59689. /**
  59690. * @en
  59691. * Specifies that the clamp to edge warp mode will be used.
  59692. * @zh
  59693. * 指定环绕模式:纹理边缘拉伸效果。
  59694. */
  59695. CLAMP_TO_EDGE = 2,
  59696. /**
  59697. * @en
  59698. * Specifies that the mirrored repeat warp mode will be used.
  59699. * @zh
  59700. * 指定环绕模式:以镜像模式重复纹理图像。
  59701. */
  59702. MIRRORED_REPEAT = 1,
  59703. /**
  59704. * @en
  59705. * Specifies that the clamp to border wrap mode will be used.
  59706. * @zh
  59707. * 指定环绕模式:超出纹理坐标部分以用户指定颜色填充。
  59708. */
  59709. CLAMP_TO_BORDER = 3
  59710. }
  59711. /**
  59712. * @en
  59713. * The texture filter mode
  59714. * @zh
  59715. * 纹理过滤模式。
  59716. */
  59717. export enum _cocos_asset_assets_asset_enum__Filter {
  59718. NONE = 0,
  59719. /**
  59720. * @en
  59721. * Specifies linear filtering.
  59722. * @zh
  59723. * 线性过滤模式。
  59724. */
  59725. LINEAR = 2,
  59726. /**
  59727. * @en
  59728. * Specifies nearest filtering.
  59729. * @zh
  59730. * 临近过滤模式。
  59731. */
  59732. NEAREST = 1
  59733. }
  59734. /**
  59735. * @en The base texture class, it defines features shared by all textures.
  59736. * @zh 贴图资源基类。它定义了所有贴图共用的概念。
  59737. */
  59738. export class _cocos_asset_assets_texture_base__TextureBase extends Asset {
  59739. /**
  59740. * @en Whether the pixel data is compressed.
  59741. * @zh 此贴图是否为压缩的像素格式。
  59742. */
  59743. get isCompressed(): boolean;
  59744. /**
  59745. * @en Pixel width of the texture.
  59746. * @zh 此贴图的像素宽度。
  59747. */
  59748. get width(): number;
  59749. /**
  59750. * @en Pixel height of the texture.
  59751. * @zh 此贴图的像素高度。
  59752. */
  59753. get height(): number;
  59754. /**
  59755. * @en The pixel format enum.
  59756. * @zh 像素格式枚举类型。
  59757. */
  59758. static PixelFormat: typeof _cocos_asset_assets_asset_enum__PixelFormat;
  59759. /**
  59760. * @en The wrap mode enum.
  59761. * @zh 环绕模式枚举类型。
  59762. */
  59763. static WrapMode: typeof _cocos_asset_assets_asset_enum__WrapMode;
  59764. /**
  59765. * @en The texture filter mode enum.
  59766. * @zh 纹理过滤模式枚举类型。
  59767. */
  59768. static Filter: typeof _cocos_asset_assets_asset_enum__Filter;
  59769. constructor();
  59770. /**
  59771. * @en Gets the id of the texture.
  59772. * @zh 获取标识符。
  59773. * @returns @en The id of this texture. @zh 此贴图的 id。
  59774. */
  59775. getId(): string;
  59776. /**
  59777. * @en Gets the pixel format.
  59778. * @zh 获取像素格式。
  59779. * @returns @en The pixel format. @zh 像素格式。
  59780. */
  59781. getPixelFormat(): _cocos_asset_assets_asset_enum__PixelFormat;
  59782. /**
  59783. * @en Gets the anisotropy.
  59784. * @zh 获取各向异性。
  59785. * @returns @en The anisotropy. @zh 各项异性值。
  59786. */
  59787. getAnisotropy(): number;
  59788. /**
  59789. * @en Sets the wrap mode of the texture.
  59790. * Be noted, if the size of the texture is not power of two, only [[WrapMode.CLAMP_TO_EDGE]] is allowed.
  59791. * @zh 设置此贴图的缠绕模式。
  59792. * 注意,若贴图尺寸不是 2 的整数幂,缠绕模式仅允许 [[WrapMode.CLAMP_TO_EDGE]]。
  59793. * @param wrapS @en S(U) coordinate wrap mode. @zh S(U) 坐标系缠绕模式.
  59794. * @param wrapT @en T(V) coordinate wrap mode. @zh T(V) 坐标系缠绕模式.
  59795. * @param wrapR @en R(W) coordinate wrap mode. @zh R(W) 坐标系缠绕模式.
  59796. */
  59797. setWrapMode(wrapS: _cocos_asset_assets_asset_enum__WrapMode, wrapT: _cocos_asset_assets_asset_enum__WrapMode, wrapR?: _cocos_asset_assets_asset_enum__WrapMode): void;
  59798. /**
  59799. * @en Sets the texture's filter mode.
  59800. * @zh 设置此贴图的过滤算法。
  59801. * @param minFilter @en Filter mode for scale down. @zh 贴图缩小时使用的过滤模式。
  59802. * @param magFilter @en Filter mode for scale up. @zh 贴图放大时使用的过滤模式。
  59803. */
  59804. setFilters(minFilter: _cocos_asset_assets_asset_enum__Filter, magFilter: _cocos_asset_assets_asset_enum__Filter): void;
  59805. /**
  59806. * @en Sets the texture's mip filter mode.
  59807. * @zh 设置此贴图的多层 mip 过滤算法。
  59808. * @param mipFilter @en Filter mode for multiple mip level. @zh 多层 mip 过滤模式。
  59809. */
  59810. setMipFilter(mipFilter: _cocos_asset_assets_asset_enum__Filter): void;
  59811. /**
  59812. * @en Sets the texture's anisotropy.
  59813. * @zh 设置此贴图的各向异性。
  59814. * @param anisotropy @en The anisotropy to be set. @zh 待设置的各向异性数值。
  59815. */
  59816. setAnisotropy(anisotropy: number): void;
  59817. /**
  59818. * @en Destroy the current texture, clear up the related GPU resources.
  59819. * @zh 销毁此贴图,并释放占用的 GPU 资源。
  59820. */
  59821. destroy(): boolean;
  59822. /**
  59823. * @en Gets the texture hash.
  59824. * @zh 获取此贴图的哈希值。
  59825. */
  59826. getHash(): number;
  59827. /**
  59828. * @en Gets the GFX Texture resource
  59829. * @zh 获取此贴图底层的 GFX 贴图对象。
  59830. */
  59831. getGFXTexture(): gfx.Texture | null;
  59832. /**
  59833. * @en Gets the internal GFX sampler hash.
  59834. * @zh 获取此贴图内部使用的 GFX 采样器信息。
  59835. * @private
  59836. */
  59837. getSamplerInfo(): Readonly<gfx.SamplerInfo>;
  59838. /**
  59839. * @en Gets the sampler resource for the texture
  59840. * @zh 获取此贴图底层的 GFX 采样信息。
  59841. */
  59842. getGFXSampler(): gfx.Sampler;
  59843. /**
  59844. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  59845. */
  59846. _serialize(ctxForExporting: any): any;
  59847. /**
  59848. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  59849. */
  59850. _deserialize(serializedData: any, handle: any): void;
  59851. protected _getGFXDevice(): gfx.Device | null;
  59852. protected _getGFXFormat(): gfx.Format;
  59853. protected _setGFXFormat(format?: _cocos_asset_assets_asset_enum__PixelFormat): void;
  59854. protected _getGFXPixelFormat(format: _cocos_asset_assets_asset_enum__PixelFormat): gfx.Format;
  59855. }
  59856. export interface _cocos_2d_assets_bitmap_font__IConfig {
  59857. [key: string]: any;
  59858. }
  59859. export class _cocos_2d_assets_bitmap_font__FontLetterDefinition {
  59860. u: number;
  59861. v: number;
  59862. w: number;
  59863. h: number;
  59864. offsetX: number;
  59865. offsetY: number;
  59866. textureID: number;
  59867. valid: boolean;
  59868. xAdvance: number;
  59869. }
  59870. export interface _cocos_2d_assets_bitmap_font__ILetterDefinition {
  59871. [key: string]: _cocos_2d_assets_bitmap_font__FontLetterDefinition;
  59872. }
  59873. export class _cocos_2d_assets_bitmap_font__FontAtlas {
  59874. letterDefinitions: any;
  59875. texture: any;
  59876. constructor(texture: any);
  59877. addLetterDefinitions(letter: any, letterDefinition: any): void;
  59878. cloneLetterDefinition(): _cocos_2d_assets_bitmap_font__ILetterDefinition;
  59879. getTexture(): any;
  59880. getLetter(key: any): any;
  59881. getLetterDefinitionForChar(char: any, labelInfo?: any): any;
  59882. clear(): void;
  59883. }
  59884. /**
  59885. * @en Image source in memory
  59886. * @zh 内存图像源。
  59887. */
  59888. export interface _cocos_asset_assets_image_asset__IMemoryImageSource {
  59889. _data: ArrayBufferView | null;
  59890. _compressed: boolean;
  59891. width: number;
  59892. height: number;
  59893. format: number;
  59894. mipmapLevelDataSize?: number[];
  59895. }
  59896. /**
  59897. * @en The image source, can be HTML canvas, image type or image in memory data
  59898. * @zh 图像资源的原始图像源。可以来源于 HTML 元素也可以来源于内存。
  59899. */
  59900. export type _cocos_asset_assets_image_asset__ImageSource = HTMLCanvasElement | HTMLImageElement | _cocos_asset_assets_image_asset__IMemoryImageSource | ImageBitmap;
  59901. export enum _cocos_2d_assets_sprite_frame__MeshType {
  59902. RECT = 0,
  59903. POLYGON = 1
  59904. }
  59905. export interface _cocos_2d_assets_sprite_frame__IVertices {
  59906. rawPosition: math.Vec3[];
  59907. positions: number[];
  59908. indexes: number[];
  59909. uv: number[];
  59910. nuv: number[];
  59911. minPos: math.Vec3;
  59912. maxPos: math.Vec3;
  59913. }
  59914. /**
  59915. * @internal
  59916. */
  59917. export class _cocos_2d_renderer_static_vb_accessor__StaticVBChunk {
  59918. vertexAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  59919. bufferId: number;
  59920. meshBuffer: MeshBuffer;
  59921. vertexOffset: number;
  59922. vb: Float32Array;
  59923. indexCount: number;
  59924. get ib(): Readonly<Uint16Array>;
  59925. constructor(vertexAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor, bufferId: number, meshBuffer: MeshBuffer, vertexOffset: number, vb: Float32Array, indexCount: number);
  59926. setIndexBuffer(indices: ArrayLike<number>): void;
  59927. }
  59928. export class _cocos_2d_renderer_buffer_accessor__BufferAccessor {
  59929. get attributes(): Readonly<gfx.Attribute[]>;
  59930. get vertexFormatBytes(): number;
  59931. get floatsPerVertex(): number;
  59932. protected _device: gfx.Device;
  59933. protected _attributes: gfx.Attribute[];
  59934. protected _vertexFormatBytes: number;
  59935. protected _floatsPerVertex: number;
  59936. protected _buffers: MeshBuffer[];
  59937. constructor(device: gfx.Device, attributes: gfx.Attribute[]);
  59938. initialize(): void;
  59939. reset(): void;
  59940. request(vertexCount?: number, indexCount?: number): void;
  59941. appendBuffers(vertices: Float32Array, indices: Uint16Array): void;
  59942. uploadBuffers(): void;
  59943. destroy(): void;
  59944. }
  59945. export class _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor extends _cocos_2d_renderer_buffer_accessor__BufferAccessor {
  59946. static IB_SCALE: number;
  59947. static ID_COUNT: number;
  59948. get id(): number;
  59949. constructor(device: gfx.Device, attributes: gfx.Attribute[], vCount?: number, iCount?: number);
  59950. destroy(): void;
  59951. reset(): void;
  59952. getVertexBuffer(bid: number): Float32Array;
  59953. getIndexBuffer(bid: number): Uint16Array;
  59954. getMeshBuffer(bid: number): MeshBuffer;
  59955. uploadBuffers(): void;
  59956. appendIndices(bufferId: number, indices: Uint16Array): void;
  59957. allocateChunk(vertexCount: number, indexCount: number): _cocos_2d_renderer_static_vb_accessor__StaticVBChunk | null;
  59958. recycleChunk(chunk: _cocos_2d_renderer_static_vb_accessor__StaticVBChunk): void;
  59959. static generateID(): number;
  59960. }
  59961. export class _cocos_2d_renderer_draw_batch__DrawBatch2D {
  59962. get inputAssembler(): gfx.InputAssembler | null;
  59963. set inputAssembler(ia: gfx.InputAssembler | null);
  59964. get descriptorSet(): gfx.DescriptorSet | null;
  59965. set descriptorSet(ds: gfx.DescriptorSet | null);
  59966. get visFlags(): number;
  59967. set visFlags(vis: number);
  59968. get passes(): renderer.Pass[];
  59969. get shaders(): gfx.Shader[];
  59970. model: renderer.scene.Model | null;
  59971. texture: gfx.Texture | null;
  59972. sampler: gfx.Sampler | null;
  59973. useLocalData: Node | null;
  59974. isStatic: boolean;
  59975. textureHash: number;
  59976. samplerHash: number;
  59977. destroy(ui: _cocos_2d_renderer_i_batcher__IBatcher): void;
  59978. clear(): void;
  59979. fillPasses(mat: Material | null, dss: any, dssHash: any, patches: any): void;
  59980. }
  59981. export interface _cocos_2d_renderer_i_batcher__IBatcher {
  59982. currBufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  59983. readonly batches: memop.CachedArray<_cocos_2d_renderer_draw_batch__DrawBatch2D>;
  59984. currStaticRoot: UIStaticBatch | null;
  59985. currIsStatic: boolean;
  59986. device: gfx.Device;
  59987. initialize(): boolean;
  59988. destroy(): any;
  59989. addScreen(comp: RenderRoot2D): any;
  59990. getFirstRenderCamera(node: Node): renderer.scene.Camera | null;
  59991. removeScreen(comp: RenderRoot2D): any;
  59992. sortScreens(): any;
  59993. update(): any;
  59994. uploadBuffers(): any;
  59995. reset(): any;
  59996. switchBufferAccessor(attributes?: gfx.Attribute[]): _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
  59997. commitComp(comp: UIRenderer, renderData: BaseRenderData | null, frame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, assembler: any, transform: Node | null): any;
  59998. commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): any;
  59999. setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): any;
  60000. endStaticBatch(): any;
  60001. commitStaticBatch(comp: UIStaticBatch): any;
  60002. autoMergeBatches(renderComp?: UIRenderer): any;
  60003. forceMergeBatches(material: Material, frame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): any;
  60004. finishMergeBatches(): any;
  60005. flushMaterial(mat: Material): any;
  60006. walk(node: Node, level?: number): any;
  60007. }
  60008. export enum _cocos_2d_renderer_render_entity__MaskMode {
  60009. NONE = 0,
  60010. MASK = 1,
  60011. MASK_INVERTED = 2,
  60012. MASK_NODE = 3,
  60013. MASK_NODE_INVERTED = 4
  60014. }
  60015. export class _cocos_2d_renderer_native_2d__NativeRenderDrawInfo {
  60016. constructor();
  60017. get vbBuffer(): ArrayBufferLike;
  60018. set vbBuffer(vbBuffer: ArrayBufferLike);
  60019. get ibBuffer(): ArrayBufferLike;
  60020. set ibBuffer(ibBuffer: ArrayBufferLike);
  60021. get vDataBuffer(): ArrayBufferLike;
  60022. set vDataBuffer(vDataBuffer: ArrayBufferLike);
  60023. get iDataBuffer(): ArrayBufferLike;
  60024. set iDataBuffer(iDataBuffer: ArrayBufferLike);
  60025. get material(): Material | null;
  60026. set material(material: Material | null);
  60027. get texture(): gfx.Texture | null;
  60028. set texture(texture: gfx.Texture | null);
  60029. get sampler(): gfx.Sampler | null;
  60030. set sampler(sampler: gfx.Sampler | null);
  60031. get model(): renderer.scene.Model | null;
  60032. set model(model: renderer.scene.Model | null);
  60033. get subNode(): Node;
  60034. set subNode(node: Node);
  60035. changeMeshBuffer(): any;
  60036. setRender2dBufferToNative(data: __types_globals__TypedArray): any;
  60037. syncSharedBufferToNative(data: __types_globals__TypedArray): any;
  60038. getAttrSharedBufferForJS(): ArrayBufferLike;
  60039. }
  60040. export class _cocos_2d_renderer_native_2d__NativeRenderEntity {
  60041. constructor(type: number);
  60042. addDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo): any;
  60043. setDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo, index: number): any;
  60044. removeDynamicRenderDrawInfo(): any;
  60045. clearDynamicRenderDrawInfos(): any;
  60046. clearStaticRenderDrawInfos(): any;
  60047. get node(): Node | null;
  60048. set node(node: Node | null);
  60049. get renderTransform(): Node | null;
  60050. set renderTransform(node: Node | null);
  60051. get stencilStage(): number;
  60052. set stencilStage(stage: number);
  60053. get staticDrawInfoSize(): number;
  60054. set staticDrawInfoSize(size: number);
  60055. getStaticRenderDrawInfo(index: number): _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
  60056. getEntitySharedBufferForJS(): ArrayBufferLike;
  60057. }
  60058. export enum _cocos_2d_renderer_render_draw_info__RenderDrawInfoType {
  60059. COMP = 0,
  60060. MODEL = 1,
  60061. MIDDLEWARE = 2,
  60062. SUB_NODE = 3
  60063. }
  60064. export class _cocos_2d_renderer_render_draw_info__RenderDrawInfo {
  60065. protected _accId: number;
  60066. protected _bufferId: number;
  60067. protected _vertexOffset: number;
  60068. protected _indexOffset: number;
  60069. protected _vb: Float32Array | null;
  60070. protected _ib: Uint16Array | null;
  60071. protected _vData: Float32Array | null;
  60072. protected _iData: Uint16Array | null;
  60073. protected _vertDirty: boolean;
  60074. protected _vbCount: number;
  60075. protected _ibCount: number;
  60076. protected _dataHash: number;
  60077. protected _isMeshBuffer: boolean;
  60078. protected _material: Material | null;
  60079. protected _texture: gfx.Texture | null;
  60080. protected _sampler: gfx.Sampler | null;
  60081. protected _stride: number;
  60082. protected _useLocal: boolean;
  60083. protected _model: renderer.scene.Model | null;
  60084. protected _drawInfoType: _cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
  60085. protected _subNode: Node | null;
  60086. protected _nativeObj: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
  60087. protected _uint8SharedBuffer: Uint8Array;
  60088. protected _uint16SharedBuffer: Uint16Array;
  60089. protected _uint32SharedBuffer: Uint32Array;
  60090. protected _render2dBuffer: Float32Array;
  60091. constructor(nativeDrawInfo?: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo);
  60092. get nativeObj(): _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
  60093. get render2dBuffer(): Float32Array;
  60094. clear(): void;
  60095. setAccId(accId: any): void;
  60096. setBufferId(bufferId: any): void;
  60097. setAccAndBuffer(accId: any, bufferId: any): void;
  60098. setVertexOffset(vertexOffset: any): void;
  60099. setIndexOffset(indexOffset: any): void;
  60100. setVB(vbBuffer: Float32Array): void;
  60101. setIB(ibBuffer: Uint16Array): void;
  60102. setVData(vDataBuffer: ArrayBufferLike): void;
  60103. setIData(iDataBuffer: ArrayBufferLike): void;
  60104. setVBCount(vbCount: any): void;
  60105. setIBCount(ibCount: any): void;
  60106. setVertDirty(val: boolean): void;
  60107. setDataHash(dataHash: number): void;
  60108. setIsMeshBuffer(isMeshBuffer: boolean): void;
  60109. setMaterial(material: Material): void;
  60110. setTexture(texture: gfx.Texture | null): void;
  60111. setSampler(sampler: gfx.Sampler | null): void;
  60112. setModel(model: renderer.scene.Model): void;
  60113. setDrawInfoType(drawInfoType: _cocos_2d_renderer_render_draw_info__RenderDrawInfoType): void;
  60114. setSubNode(node: Node): void;
  60115. setStride(stride: number): void;
  60116. initRender2dBuffer(): void;
  60117. fillRender2dBuffer(vertexDataArr: IRenderData[]): void;
  60118. }
  60119. export enum _cocos_2d_renderer_render_entity__RenderEntityType {
  60120. STATIC = 0,
  60121. DYNAMIC = 1,
  60122. CROSSED = 2
  60123. }
  60124. export class _cocos_2d_renderer_render_entity__RenderEntity {
  60125. protected _node: Node | null;
  60126. protected _renderTransform: Node | null;
  60127. protected _stencilStage: _cocos_2d_renderer_stencil_manager__Stage;
  60128. protected _useLocal: boolean;
  60129. protected _maskMode: _cocos_2d_renderer_render_entity__MaskMode;
  60130. protected _floatSharedBuffer: Float32Array;
  60131. protected _uint8SharedBuffer: Uint8Array;
  60132. protected _boolSharedBuffer: Uint8Array;
  60133. get nativeObj(): _cocos_2d_renderer_native_2d__NativeRenderEntity;
  60134. get renderDrawInfoArr(): _cocos_2d_renderer_render_draw_info__RenderDrawInfo[];
  60135. get renderEntityType(): _cocos_2d_renderer_render_entity__RenderEntityType;
  60136. protected _color: math.Color;
  60137. get color(): math.Color;
  60138. set color(val: math.Color);
  60139. protected _localOpacity: number;
  60140. get localOpacity(): number;
  60141. set localOpacity(val: number);
  60142. protected _colorDirty: boolean;
  60143. get colorDirty(): boolean;
  60144. set colorDirty(val: boolean);
  60145. protected _enabled: boolean;
  60146. get enabled(): boolean;
  60147. set enabled(val: boolean);
  60148. constructor(entityType: _cocos_2d_renderer_render_entity__RenderEntityType);
  60149. addDynamicRenderDrawInfo(renderDrawInfo: _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null): void;
  60150. removeDynamicRenderDrawInfo(): void;
  60151. clearDynamicRenderDrawInfos(): void;
  60152. clearStaticRenderDrawInfos(): void;
  60153. setDynamicRenderDrawInfo(renderDrawInfo: _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null, index: number): void;
  60154. setMaskMode(mode: _cocos_2d_renderer_render_entity__MaskMode): void;
  60155. getStaticRenderDrawInfo(): _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null;
  60156. setNode(node: Node | null): void;
  60157. setRenderTransform(renderTransform: Node | null): void;
  60158. setStencilStage(stage: _cocos_2d_renderer_stencil_manager__Stage): void;
  60159. setUseLocal(useLocal: boolean): void;
  60160. }
  60161. export enum _cocos_2d_framework_sprite_renderer__SpriteMode {
  60162. SIMPLE = 0,
  60163. SLICED = 1,
  60164. TILED = 2
  60165. }
  60166. /**
  60167. * @en The type for mask.
  60168. *
  60169. * @zh 遮罩组件类型。
  60170. */
  60171. export enum _cocos_2d_components_mask__MaskType {
  60172. /**
  60173. * @en Rect mask.
  60174. *
  60175. * @zh
  60176. * 使用矩形作为遮罩。
  60177. */
  60178. GRAPHICS_RECT = 0,
  60179. /**
  60180. * @en Ellipse Mask.
  60181. *
  60182. * @zh
  60183. * 使用椭圆作为遮罩。
  60184. */
  60185. GRAPHICS_ELLIPSE = 1,
  60186. /**
  60187. * @en Graphics Mask.
  60188. *
  60189. * @zh
  60190. * 使用图像模版作为遮罩。
  60191. */
  60192. GRAPHICS_STENCIL = 2,
  60193. /**
  60194. * @en SpriteFrame Mask.
  60195. *
  60196. * @zh
  60197. * 使用图片模版作为遮罩。
  60198. */
  60199. SPRITE_STENCIL = 3
  60200. }
  60201. export interface _cocos_2d_components_rich_text__ISegment {
  60202. node: Node;
  60203. comp: Label | Sprite | null;
  60204. lineCount: number;
  60205. styleIndex: number;
  60206. imageOffset: string;
  60207. clickParam: string;
  60208. clickHandler: string;
  60209. type: string;
  60210. }
  60211. /**
  60212. * @en
  60213. * Enum for sprite type.
  60214. *
  60215. * @zh
  60216. * Sprite 类型。
  60217. */
  60218. export enum _cocos_2d_components_sprite__SpriteType {
  60219. /**
  60220. * @en
  60221. * The simple type.
  60222. *
  60223. * @zh
  60224. * 普通类型。
  60225. */
  60226. SIMPLE = 0,
  60227. /**
  60228. * @en
  60229. * The sliced type.
  60230. *
  60231. * @zh
  60232. * 切片(九宫格)类型。
  60233. */
  60234. SLICED = 1,
  60235. /**
  60236. * @en
  60237. * The tiled type.
  60238. *
  60239. * @zh 平铺类型
  60240. */
  60241. TILED = 2,
  60242. /**
  60243. * @en
  60244. * The filled type.
  60245. *
  60246. * @zh
  60247. * 填充类型。
  60248. */
  60249. FILLED = 3
  60250. }
  60251. /**
  60252. * @en
  60253. * Enum for fill type.
  60254. *
  60255. * @zh
  60256. * 填充类型。
  60257. */
  60258. export enum _cocos_2d_components_sprite__FillType {
  60259. /**
  60260. * @en
  60261. * The horizontal fill.
  60262. *
  60263. * @zh
  60264. * 水平方向填充。
  60265. */
  60266. HORIZONTAL = 0,
  60267. /**
  60268. * @en
  60269. * The vertical fill.
  60270. *
  60271. * @zh
  60272. * 垂直方向填充。
  60273. */
  60274. VERTICAL = 1,
  60275. /**
  60276. * @en
  60277. * The radial fill.
  60278. *
  60279. * @zh 径向填充
  60280. */
  60281. RADIAL = 2
  60282. }
  60283. /**
  60284. * @en
  60285. * Sprite Size can track trimmed size, raw size or none.
  60286. *
  60287. * @zh
  60288. * 精灵尺寸调整模式。
  60289. */
  60290. export enum _cocos_2d_components_sprite__SizeMode {
  60291. /**
  60292. * @en
  60293. * Use the customized node size.
  60294. *
  60295. * @zh
  60296. * 使用节点预设的尺寸。
  60297. */
  60298. CUSTOM = 0,
  60299. /**
  60300. * @en
  60301. * Match the trimmed size of the sprite frame automatically.
  60302. *
  60303. * @zh
  60304. * 自动适配为精灵裁剪后的尺寸。
  60305. */
  60306. TRIMMED = 1,
  60307. /**
  60308. * @en
  60309. * Match the raw size of the sprite frame automatically.
  60310. *
  60311. * @zh
  60312. * 自动适配为精灵原图尺寸。
  60313. */
  60314. RAW = 2
  60315. }
  60316. export enum _cocos_2d_components_sprite__EventType {
  60317. SPRITE_FRAME_CHANGED = "spriteframe-changed"
  60318. }
  60319. /**
  60320. * @en Enum for LineJoin.
  60321. * @zh 线段拐角属性
  60322. * @enum Graphics.LineJoin
  60323. */
  60324. export enum _cocos_2d_assembler_graphics_types__LineJoin {
  60325. /**
  60326. * @en Fills an additional triangular area between the common endpoint of connected segments, and the separate outside rectangular corners of each segment.
  60327. * @zh 在相连部分的末端填充一个额外的以三角形为底的区域, 每个部分都有各自独立的矩形拐角。
  60328. */
  60329. BEVEL = 0,
  60330. /**
  60331. * @en Rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected segments.
  60332. * The radius for these rounded corners is equal to the line width.
  60333. * @zh 通过填充一个额外的,圆心在相连部分末端的扇形,绘制拐角的形状。 圆角的半径是线段的宽度。
  60334. */
  60335. ROUND = 1,
  60336. /**
  60337. * @en Connected segments are joined by extending their outside edges to connect at a single point,
  60338. * with the effect of filling an additional lozenge-shaped area.
  60339. * @zh 通过延伸相连部分的外边缘,使其相交于一点,形成一个额外的菱形区域。
  60340. */
  60341. MITER = 2
  60342. }
  60343. /**
  60344. * @en Enum for LineCap.
  60345. * @zh 线段末端属性
  60346. * @enum Graphics.LineCap
  60347. */
  60348. export enum _cocos_2d_assembler_graphics_types__LineCap {
  60349. /**
  60350. * @en The ends of lines are squared off at the endpoints.
  60351. * @zh 线段末端以方形结束。
  60352. */
  60353. BUTT = 0,
  60354. /**
  60355. * @en The ends of lines are rounded.
  60356. * @zh 线段末端以圆形结束。
  60357. */
  60358. ROUND = 1,
  60359. /**
  60360. * @en The ends of lines are squared off by adding a box with an equal width and half the height of the line's thickness.
  60361. * @zh 线段末端以方形结束,但是增加了一个宽度和线段相同,高度是线段厚度一半的矩形区域。
  60362. */
  60363. SQUARE = 2
  60364. }
  60365. export class _cocos_2d_assembler_graphics_webgl_impl__Point extends math.Vec2 {
  60366. dx: number;
  60367. dy: number;
  60368. dmx: number;
  60369. dmy: number;
  60370. flags: number;
  60371. len: number;
  60372. reset(): void;
  60373. }
  60374. export class _cocos_2d_assembler_graphics_webgl_impl__Path {
  60375. closed: boolean;
  60376. bevel: number;
  60377. complex: boolean;
  60378. points: _cocos_2d_assembler_graphics_webgl_impl__Point[];
  60379. reset(): void;
  60380. }
  60381. export enum _cocos_2d_assembler_graphics_types__PointFlags {
  60382. PT_CORNER = 1,
  60383. PT_LEFT = 2,
  60384. PT_BEVEL = 4,
  60385. PT_INNERBEVEL = 8
  60386. }
  60387. export class _cocos_2d_assembler_graphics_webgl_impl__Impl {
  60388. dataOffset: number;
  60389. updatePathOffset: boolean;
  60390. pathLength: number;
  60391. pathOffset: number;
  60392. paths: _cocos_2d_assembler_graphics_webgl_impl__Path[];
  60393. tessTol: number;
  60394. distTol: number;
  60395. fillColor: math.Color;
  60396. lineCap: _cocos_2d_assembler_graphics_types__LineCap;
  60397. strokeColor: math.Color;
  60398. lineJoin: _cocos_2d_assembler_graphics_types__LineJoin;
  60399. lineWidth: number;
  60400. pointsOffset: number;
  60401. constructor(comp: Graphics);
  60402. moveTo(x: number, y: number): void;
  60403. lineTo(x: number, y: number): void;
  60404. bezierCurveTo(c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number): void;
  60405. quadraticCurveTo(cx: number, cy: number, x: number, y: number): void;
  60406. arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise: boolean): void;
  60407. ellipse(cx: number, cy: number, rx: number, ry: number): void;
  60408. circle(cx: number, cy: number, r: number): void;
  60409. rect(x: number, y: number, w: number, h: number): void;
  60410. roundRect(x: number, y: number, w: number, h: number, r: number): void;
  60411. clear(): void;
  60412. close(): void;
  60413. requestRenderData(): MeshRenderData;
  60414. getRenderDataList(): MeshRenderData[];
  60415. addPoint(x: number, y: number, flags: _cocos_2d_assembler_graphics_types__PointFlags): void;
  60416. }
  60417. export class _cocos_2d_renderer_native_2d__NativeUIModelProxy {
  60418. initModel(node: any): any;
  60419. activeSubModels(): any;
  60420. uploadData(): any;
  60421. destroy(): any;
  60422. clear(): any;
  60423. getModel(): renderer.scene.Model;
  60424. updateModels(model: any): any;
  60425. attachDrawInfo(): any;
  60426. attachNode(node: any): any;
  60427. clearModels(): any;
  60428. }
  60429. export interface _cocos_2d_assembler_label_font_utils__ISharedLabelData {
  60430. canvas: HTMLCanvasElement;
  60431. context: CanvasRenderingContext2D | null;
  60432. }
  60433. export class _cocos_2d_assembler_label_font_utils__CanvasPool {
  60434. static getInstance(): _cocos_2d_assembler_label_font_utils__CanvasPool;
  60435. pool: _cocos_2d_assembler_label_font_utils__ISharedLabelData[];
  60436. get(): _cocos_2d_assembler_label_font_utils__ISharedLabelData;
  60437. put(canvas: _cocos_2d_assembler_label_font_utils__ISharedLabelData): void;
  60438. }
  60439. export class _cocos_2d_assembler_label_font_utils__LetterRenderTexture extends Texture2D {
  60440. /**
  60441. * @en
  60442. * Init the render texture with size.
  60443. * @zh
  60444. * 初始化 render texture。
  60445. * @param [width]
  60446. * @param [height]
  60447. * @param [string]
  60448. */
  60449. initWithSize(width: number, height: number, format?: number): void;
  60450. /**
  60451. * @en Draw a texture to the specified position
  60452. * @zh 将指定的图片渲染到指定的位置上。
  60453. * @param {Texture2D} image
  60454. * @param {Number} x
  60455. * @param {Number} y
  60456. */
  60457. drawTextureAt(image: ImageAsset, x: number, y: number): void;
  60458. }
  60459. export class _cocos_2d_assembler_label_text_style__TextStyle {
  60460. isBold: boolean;
  60461. isItalic: boolean;
  60462. isUnderline: boolean;
  60463. underlineHeight: number;
  60464. isOutlined: boolean;
  60465. outlineColor: math.Color;
  60466. outlineWidth: number;
  60467. hasShadow: boolean;
  60468. shadowColor: math.Color;
  60469. shadowBlur: number;
  60470. shadowOffsetX: number;
  60471. shadowOffsetY: number;
  60472. color: math.Color;
  60473. fontSize: number;
  60474. actualFontSize: number;
  60475. isSystemFontUsed: boolean;
  60476. originFontSize: number;
  60477. bmfontScale: number;
  60478. fontFamily: string;
  60479. fontDesc: string;
  60480. fntConfig: _cocos_2d_assets_bitmap_font__IConfig | null;
  60481. spriteFrame: SpriteFrame | null;
  60482. fontScale: number;
  60483. reset(): void;
  60484. }
  60485. export class _cocos_2d_assembler_label_text_layout__TextLayout {
  60486. horizontalAlign: number;
  60487. verticalAlign: number;
  60488. wrapping: boolean;
  60489. overFlow: number;
  60490. lineHeight: number;
  60491. maxLineWidth: number;
  60492. spacingX: number;
  60493. textWidthTemp: number;
  60494. textHeightTemp: number;
  60495. textDimensions: math.Size;
  60496. horizontalKerning: number[];
  60497. numberOfLines: number;
  60498. linesOffsetX: number[];
  60499. letterOffsetY: number;
  60500. tailoredTopY: number;
  60501. tailoredBottomY: number;
  60502. textDesiredHeight: number;
  60503. linesWidth: number[];
  60504. reset(): void;
  60505. }
  60506. export interface _cocos_2d_assembler_label_text_processing__IRenderData {
  60507. x: number;
  60508. y: number;
  60509. z: number;
  60510. u: number;
  60511. v: number;
  60512. color: math.Color;
  60513. }
  60514. export class _cocos_2d_assembler_label_text_output_data__TextOutputRenderData {
  60515. quadCount: number;
  60516. vertexBuffer: _cocos_2d_assembler_label_text_processing__IRenderData[];
  60517. texture: Texture2D | SpriteFrame | null;
  60518. uiTransAnchorX: number;
  60519. uiTransAnchorY: number;
  60520. reset(): void;
  60521. }
  60522. export class _cocos_2d_assembler_label_text_output_data__TextOutputLayoutData {
  60523. parsedString: string[];
  60524. nodeContentSize: math.Size;
  60525. canvasSize: math.Size;
  60526. canvasPadding: math.Rect;
  60527. contentSizeExtend: math.Size;
  60528. startPosition: math.Vec2;
  60529. reset(): void;
  60530. }
  60531. export class _cocos_2d_renderer_native_2d__NativeBatcher2d {
  60532. syncMeshBuffersToNative(accId: number, buffers: _cocos_2d_renderer_native_2d__NativeUIMeshBuffer[]): any;
  60533. update(): any;
  60534. uploadBuffers(): any;
  60535. reset(): any;
  60536. syncRootNodesToNative(nodes: Node[]): any;
  60537. releaseDescriptorSetCache(texture: gfx.Texture, sampler: gfx.Sampler): any;
  60538. }
  60539. export class _cocos_2d_utils_dynamic_atlas_atlas__DynamicAtlasTexture extends Texture2D {
  60540. /**
  60541. * @en
  60542. * Initialize the render texture.
  60543. *
  60544. * @zh
  60545. * 初始化 render texture。
  60546. *
  60547. * @method initWithSize
  60548. */
  60549. initWithSize(width: number, height: number, format?: number): void;
  60550. /**
  60551. * @en
  60552. * Draw a texture to the specified position.
  60553. *
  60554. * @zh
  60555. * 将指定的图片渲染到指定的位置上。
  60556. *
  60557. * @method drawTextureAt
  60558. * @param {Texture2D} image
  60559. * @param {Number} x
  60560. * @param {Number} y
  60561. */
  60562. drawTextureAt(image: ImageAsset, x: number, y: number): void;
  60563. }
  60564. /**
  60565. * @en The instance of [[MorphRendering]] for dedicated control in the mesh renderer.
  60566. * The root [[MorphRendering]] is owned by [[Mesh]] asset, each [[MeshRenderer]] can have its own morph rendering instance.
  60567. * @zh 用于网格渲染器中独立控制 [[MorphRendering]] 的实例。原始 [[MorphRendering]] 被 [[Mesh]] 资源持有,每个 [[MeshRenderer]] 都持有自己的形变网格渲染实例。
  60568. */
  60569. export interface _cocos_3d_assets_morph_rendering__MorphRenderingInstance {
  60570. /**
  60571. * Sets weights of targets of specified sub mesh.
  60572. * @param subMeshIndex
  60573. * @param weights
  60574. */
  60575. setWeights(subMeshIndex: number, weights: number[]): void;
  60576. /**
  60577. * Adapts pipeline state to do the rendering.
  60578. * @param subMeshIndex
  60579. * @param pipelineState
  60580. */
  60581. adaptPipelineState(subMeshIndex: number, descriptorSet: gfx.DescriptorSet): void;
  60582. /**
  60583. * Acquire the define overrides needed to do the rendering.
  60584. */
  60585. requiredPatches(subMeshIndex: number): renderer.IMacroPatch[] | null;
  60586. /**
  60587. * Destroy the rendering instance.
  60588. */
  60589. destroy(): void;
  60590. }
  60591. /**
  60592. * @en Interface for classes which control the rendering of morph resources.
  60593. * @zh 支持形变网格渲染的基类。
  60594. */
  60595. export interface _cocos_3d_assets_morph_rendering__MorphRendering {
  60596. createInstance(): _cocos_3d_assets_morph_rendering__MorphRenderingInstance;
  60597. }
  60598. /**
  60599. * @en Model's bake settings.
  60600. * @zh 模型烘焙设置
  60601. */
  60602. export class _cocos_3d_framework_mesh_renderer__ModelBakeSettings extends EventTarget {
  60603. /**
  60604. * @en The event which will be triggered when the useLightProbe is changed.
  60605. * @zh useLightProbe属性修改时触发的事件
  60606. */
  60607. static readonly USE_LIGHT_PROBE_CHANGED = "use_light_probe_changed";
  60608. /**
  60609. * @en The event which will be triggered when the reflectionProbe is changed.
  60610. * @zh reflectionProbe 属性修改时触发的事件
  60611. */
  60612. static readonly REFLECTION_PROBE_CHANGED = "reflection_probe_changed";
  60613. /**
  60614. * @en The event which will be triggered when the bakeToReflectionProbe is changed.
  60615. * @zh bakeToReflectionProbe 属性修改时触发的事件
  60616. */
  60617. static readonly BAKE_TO_REFLECTION_PROBE_CHANGED = "bake_to_reflection_probe_changed";
  60618. texture: Texture2D | null;
  60619. uvParam: math.Vec4;
  60620. protected _bakeable: boolean;
  60621. protected _castShadow: boolean;
  60622. protected _receiveShadow: boolean;
  60623. protected _lightmapSize: number;
  60624. protected _useLightProbe: boolean;
  60625. protected _bakeToLightProbe: boolean;
  60626. protected _reflectionProbeType: ReflectionProbeType;
  60627. protected _bakeToReflectionProbe: boolean;
  60628. probeCubemap: TextureCube | null;
  60629. probeBlendCubemap: TextureCube | null;
  60630. probePlanarmap: gfx.Texture | null;
  60631. /**
  60632. * @en Whether the model is static and bake-able with light map.
  60633. * Notice: the model's vertex data must have the second UV attribute to enable light map baking.
  60634. * @zh 模型是否是静态的并可以烘培光照贴图。
  60635. * 注意:模型顶点数据必须包含第二套 UV 属性来支持光照贴图烘焙。
  60636. */
  60637. get bakeable(): boolean;
  60638. set bakeable(val: boolean);
  60639. /**
  60640. * @en Whether to cast shadow in light map baking.
  60641. * @zh 在光照贴图烘焙中是否投射阴影。
  60642. */
  60643. get castShadow(): boolean;
  60644. set castShadow(val: boolean);
  60645. /**
  60646. * @en Whether to receive shadow in light map baking.
  60647. * @zh 在光照贴图烘焙中是否接受阴影。
  60648. */
  60649. get receiveShadow(): boolean;
  60650. set receiveShadow(val: boolean);
  60651. /**
  60652. * @en The lightmap size.
  60653. * @zh 光照图大小。
  60654. */
  60655. get lightmapSize(): number;
  60656. set lightmapSize(val: number);
  60657. /**
  60658. * @en Whether to use light probe which provides indirect light to dynamic objects.
  60659. * @zh 模型是否使用光照探针,光照探针为动态物体提供间接光。
  60660. */
  60661. get useLightProbe(): boolean;
  60662. set useLightProbe(val: boolean);
  60663. /**
  60664. * @en Whether the model is used to calculate light probe
  60665. * @zh 模型是否用于计算光照探针
  60666. */
  60667. get bakeToLightProbe(): boolean;
  60668. set bakeToLightProbe(val: boolean);
  60669. /**
  60670. * @en Used to set whether to use the reflection probe or set probe's type.
  60671. * @zh 用于设置是否使用反射探针或者设置反射探针的类型。
  60672. */
  60673. get reflectionProbe(): ReflectionProbeType;
  60674. set reflectionProbe(val: ReflectionProbeType);
  60675. /**
  60676. * @en Whether the model can be render by the reflection probe
  60677. * @zh 模型是否能被反射探针渲染
  60678. */
  60679. get bakeToReflectionProbe(): boolean;
  60680. set bakeToReflectionProbe(val: boolean);
  60681. }
  60682. /**
  60683. * @en Shadow projection mode.
  60684. * @zh 阴影投射方式。
  60685. */
  60686. export const _cocos_3d_framework_mesh_renderer__ModelShadowCastingMode: {
  60687. /**
  60688. * @en Disable shadow projection.
  60689. * @zh 不投射阴影。
  60690. */
  60691. OFF: number;
  60692. /**
  60693. * @en Enable shadow projection.
  60694. * @zh 开启阴影投射。
  60695. */
  60696. ON: number;
  60697. };
  60698. export type __types_globals__EnumAlias<EnumT> = EnumT[keyof EnumT];
  60699. /**
  60700. * @en Shadow receive mode.
  60701. * @zh 阴影接收方式。
  60702. */
  60703. export const _cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode: {
  60704. /**
  60705. * @en Disable shadow receiving.
  60706. * @zh 不接收阴影。
  60707. */
  60708. OFF: number;
  60709. /**
  60710. * @en Enable shadow receiving.
  60711. * @zh 开启阴影投射。
  60712. */
  60713. ON: number;
  60714. };
  60715. /**
  60716. * @en Static light settings.
  60717. * @zh 静态灯光设置
  60718. */
  60719. export class _cocos_3d_lights_light_component__StaticLightSettings {
  60720. protected _baked: boolean;
  60721. protected _editorOnly: boolean;
  60722. protected _castShadow: boolean;
  60723. /**
  60724. * @en Whether the light is editor only.
  60725. * @zh 是否只在编辑器里生效。
  60726. */
  60727. get editorOnly(): boolean;
  60728. set editorOnly(val: boolean);
  60729. /**
  60730. * @en Whether the light is baked
  60731. * @zh 光源是否被烘焙
  60732. */
  60733. get baked(): boolean;
  60734. set baked(val: boolean);
  60735. /**
  60736. * @en Whether the light will cast shadow during baking process.
  60737. * @zh 光源在烘焙时是否投射阴影。
  60738. */
  60739. get castShadow(): boolean;
  60740. set castShadow(val: boolean);
  60741. }
  60742. /**
  60743. * @en The physical term used for light.
  60744. * @zh 光源所使用的物理计量单位。
  60745. */
  60746. export const _cocos_3d_lights_light_component__PhotometricTerm: {
  60747. LUMINOUS_FLUX: number;
  60748. LUMINANCE: number;
  60749. };
  60750. /**
  60751. * @en
  60752. * The model that support morph target rendering.
  60753. * @zh
  60754. * 支持渲染蒙皮形变的模型。
  60755. */
  60756. export class _cocos_3d_models_morph_model__MorphModel extends renderer.scene.Model {
  60757. /**
  60758. * @en Acquire the material's macro patches for the given sub model.
  60759. * @zh 获取指定子模型的材质宏组合。
  60760. * @param subModelIndex @en The index for the requested sub model. @zh 子模型的序号。
  60761. * @returns @en The macro patches. @zh 材质宏组合
  60762. */
  60763. getMacroPatches(subModelIndex: number): renderer.IMacroPatch[] | null;
  60764. /**
  60765. * @en Initialize a sub model with the sub mesh data and the material.
  60766. * @zh 用子网格数据和材质初始化一个子模型。
  60767. * @param idx @en The index of the sub model @zh 子模型的序号
  60768. * @param subMeshData @en The sub mesh data to be set @zh 需要设置的子网格
  60769. * @param mat sub material
  60770. */
  60771. initSubModel(subModelIndex: number, subMeshData: RenderingSubMesh, material: Material): void;
  60772. destroy(): void;
  60773. /**
  60774. * @en Sets the material for a given sub model.
  60775. * @zh 给指定的子模型设置材质。
  60776. * @param subModelIndex @en The index of the sub model @zh 子模型的序号
  60777. * @param material @en The material to be set @zh 需要设置的材质
  60778. * @returns void
  60779. */
  60780. setSubModelMaterial(subModelIndex: number, material: Material): void;
  60781. /**
  60782. * Sets morph rendering instance for the model, it's managed by the MeshRenderer
  60783. * @internal
  60784. */
  60785. setMorphRendering(morphRendering: _cocos_3d_assets_morph_rendering__MorphRenderingInstance): void;
  60786. protected _updateLocalDescriptors(submodelIdx: number, descriptorSet: gfx.DescriptorSet): void;
  60787. }
  60788. /**
  60789. * @en
  60790. * The skinning model that is using real-time pose calculation.
  60791. * @zh
  60792. * 实时计算动画的蒙皮模型。
  60793. */
  60794. export class _cocos_3d_models_skinning_model__SkinningModel extends _cocos_3d_models_morph_model__MorphModel {
  60795. constructor();
  60796. destroy(): void;
  60797. /**
  60798. * @en Abstract function for [[BakedSkinningModel]], empty implementation.
  60799. * @zh 由 [[BakedSkinningModel]] 继承的空函数。
  60800. */
  60801. uploadAnimation(): void;
  60802. /**
  60803. * @en Bind the skeleton with its skinning root node and the mesh data.
  60804. * @zh 在模型中绑定一个骨骼,需要提供骨骼的蒙皮根节点和蒙皮网格数据。
  60805. * @param skeleton @en The skeleton to be bound @zh 要绑定的骨骼
  60806. * @param skinningRoot @en The skinning root of the skeleton @zh 骨骼的蒙皮根节点
  60807. * @param mesh @en The mesh @zh 蒙皮网格
  60808. * @returns void
  60809. */
  60810. bindSkeleton(skeleton?: Skeleton | null, skinningRoot?: Node | null, mesh?: Mesh | null): void;
  60811. /**
  60812. * @en Update world transform and bounding boxes for the model
  60813. * @zh 更新模型的世界矩阵和包围盒
  60814. * @param stamp @en The update time stamp @zh 更新的时间戳
  60815. */
  60816. updateTransform(stamp: number): void;
  60817. /**
  60818. * @en Update uniform buffer objects for rendering.
  60819. * @zh 更新用于渲染的 UBO
  60820. * @param stamp @en The update time stamp @zh 更新的时间戳
  60821. * @returns @en successful or not @zh 更新是否成功
  60822. */
  60823. updateUBOs(stamp: number): boolean;
  60824. /**
  60825. * @en Initialize sub model with the sub mesh data and the material
  60826. * @zh 用子网格数据和材质初始化一个子模型
  60827. * @param idx @en The index of the sub model to be initialized @zh 需要初始化的子模型序号
  60828. * @param subMeshData @en The sub mesh data @zh 子网格数据
  60829. * @param mat @en The material @zh 子模型材质
  60830. */
  60831. initSubModel(idx: number, subMeshData: RenderingSubMesh, mat: Material): void;
  60832. getMacroPatches(subModelIndex: number): renderer.IMacroPatch[] | null;
  60833. /**
  60834. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  60835. */
  60836. _updateLocalDescriptors(submodelIdx: number, descriptorSet: gfx.DescriptorSet): void;
  60837. protected _updateInstancedAttributes(attributes: gfx.Attribute[], subModel: renderer.scene.SubModel): void;
  60838. }
  60839. export interface _cocos_3d_skeletal_animation_skeletal_animation_utils__IInternalJointAnimInfo {
  60840. downstream?: math.Mat4;
  60841. curveData?: math.Mat4[];
  60842. bindposeIdx: number;
  60843. bindposeCorrection?: math.Mat4;
  60844. }
  60845. export interface _cocos_3d_skeletal_animation_skeletal_animation_utils__IJointTextureHandle {
  60846. pixelOffset: number;
  60847. refCount: number;
  60848. clipHash: number;
  60849. skeletonHash: number;
  60850. readyToBeDeleted: boolean;
  60851. handle: renderer.ITextureBufferHandle;
  60852. bounds: Map<number, geometry.AABB[]>;
  60853. animInfos?: _cocos_3d_skeletal_animation_skeletal_animation_utils__IInternalJointAnimInfo[];
  60854. }
  60855. /**
  60856. * @en
  60857. * The skinning model that is using GPU baked animation.
  60858. * @zh
  60859. * GPU 预烘焙动画的蒙皮模型。
  60860. */
  60861. export class _cocos_3d_models_baked_skinning_model__BakedSkinningModel extends _cocos_3d_models_morph_model__MorphModel {
  60862. /**
  60863. * @en The animation clip that have been uploaded
  60864. * @zh 已被上传的动画片段
  60865. */
  60866. uploadedAnim: AnimationClip | null | undefined;
  60867. constructor();
  60868. destroy(): void;
  60869. bindSkeleton(skeleton?: Skeleton | null, skinningRoot?: Node | null, mesh?: Mesh | null): void;
  60870. updateTransform(stamp: number): void;
  60871. updateUBOs(stamp: number): boolean;
  60872. getMacroPatches(subModelIndex: number): renderer.IMacroPatch[] | null;
  60873. /**
  60874. * @en Pre-simulate and store the frames data of the given animation clip to a joint texture and upload it to GPU.
  60875. * Normally, it's automatically managed by [[SkeletalAnimationState]].
  60876. * But user can also use Joint Texture Layout Settings in the editor to manually organize the joint textures.
  60877. * @zh 预计算并存储一个指定动画片段的完整帧数据到一张骨骼贴图上,并将其上传到 GPU。
  60878. * 一般情况下 [[SkeletalAnimationState]] 会自动管理所有骨骼贴图,但用户也可以使用编辑器的骨骼贴图布局设置面板来手动管理所有骨骼贴图。
  60879. * @param anim @en The animation clip to be uploaded to the joint texture. @zh 需要上传到骨骼贴图上的动画片段。
  60880. * @returns void
  60881. */
  60882. uploadAnimation(anim: AnimationClip | null): void;
  60883. protected _applyJointTexture(texture?: _cocos_3d_skeletal_animation_skeletal_animation_utils__IJointTextureHandle | null): void;
  60884. protected _updateLocalDescriptors(submodelIdx: number, descriptorSet: gfx.DescriptorSet): void;
  60885. protected _updateInstancedAttributes(attributes: gfx.Attribute[], subModel: renderer.scene.SubModel): void;
  60886. }
  60887. /**
  60888. * 动画使用的循环模式。
  60889. */
  60890. export enum _cocos_animation_types__WrapMode {
  60891. /**
  60892. * 向 Animation Component 或者 AnimationClip 查找 wrapMode
  60893. */
  60894. Default = 0,
  60895. /**
  60896. * 动画只播放一遍
  60897. */
  60898. Normal = 1,
  60899. /**
  60900. * 从最后一帧或结束位置开始反向播放,到第一帧或开始位置停止
  60901. */
  60902. Reverse = 36,
  60903. /**
  60904. * 循环播放
  60905. */
  60906. Loop = 2,
  60907. /**
  60908. * 反向循环播放
  60909. */
  60910. LoopReverse = 38,
  60911. /**
  60912. * 从第一帧播放到最后一帧,然后反向播放回第一帧,到第一帧后再正向播放,如此循环
  60913. */
  60914. PingPong = 22,
  60915. /**
  60916. * 从最后一帧开始反向播放,其他同 PingPong
  60917. */
  60918. PingPongReverse = 54
  60919. }
  60920. export interface _cocos_animation_tracks_utils__Range {
  60921. min: number;
  60922. max: number;
  60923. }
  60924. export interface _cocos_animation_animation_clip__IAnimationEvent {
  60925. functionName: string;
  60926. parameters: string[];
  60927. }
  60928. export interface _cocos_animation_animation_clip__IAnimationEventGroup {
  60929. events: _cocos_animation_animation_clip__IAnimationEvent[];
  60930. }
  60931. export class _cocos_animation_animation_clip__EventEvaluator {
  60932. constructor(_targetNode: Node, _ratios: readonly number[], _eventGroups: readonly _cocos_animation_animation_clip__IAnimationEventGroup[], _wrapMode: _cocos_animation_types__WrapMode);
  60933. setWrapMode(wrapMode: _cocos_animation_types__WrapMode): void;
  60934. ignore(ratio: number, direction: number): void;
  60935. reset(): void;
  60936. sample(ratio: number, direction: number, iterations: number): void;
  60937. }
  60938. export class _cocos_animation_animation_clip__EmbeddedPlayerEvaluation {
  60939. constructor(embeddedPlayers: ReadonlyArray<EmbeddedPlayer>, rootNode: Node);
  60940. destroy(): void;
  60941. /**
  60942. * Evaluates the embedded players.
  60943. * @param time The time([0, clipDuration]).
  60944. * @param iterations The iterations the evaluation occurred. Should be integral.
  60945. */
  60946. evaluate(time: number, iterations: number): void;
  60947. notifyHostSpeedChanged(speed: number): void;
  60948. /**
  60949. * Notifies that the host has ran into **playing** state.
  60950. * @param time The time where host ran into playing state.
  60951. */
  60952. notifyHostPlay(time: number): void;
  60953. /**
  60954. * Notifies that the host has ran into **pause** state.
  60955. */
  60956. notifyHostPause(time: number): void;
  60957. /**
  60958. * Notifies that the host has ran into **stopped** state.
  60959. */
  60960. notifyHostStop(): void;
  60961. }
  60962. export interface _cocos_animation_animation_clip__RootMotionOptions {
  60963. }
  60964. export interface _cocos_animation_animation_clip__AnimationClipEvalContext {
  60965. /**
  60966. * The output pose.
  60967. */
  60968. pose?: _cocos_animation_pose_output__PoseOutput;
  60969. /**
  60970. * The root animating target(should be scene node now).
  60971. */
  60972. target: unknown;
  60973. /**
  60974. * The animation mask applied.
  60975. */
  60976. mask?: AnimationMask;
  60977. /**
  60978. * Path to the root bone.
  60979. */
  60980. rootMotion?: _cocos_animation_animation_clip__RootMotionOptions;
  60981. }
  60982. export class _cocos_animation_animation_clip__TrackEvalStatus<TValue> {
  60983. constructor(binding: _cocos_animation_tracks_track__RuntimeBinding<TValue>, trackEval: _cocos_animation_tracks_track__TrackEval<TValue>);
  60984. evaluate(time: number): void;
  60985. }
  60986. export type _cocos_animation_animation_clip__ExoticAnimationEvaluator = ReturnType<ExoticAnimation["createEvaluator"]>;
  60987. export class _cocos_animation_animation_clip__BoneTransform {
  60988. position: math.Vec3;
  60989. scale: math.Vec3;
  60990. rotation: math.Quat;
  60991. eulerAngles: math.Vec3;
  60992. getTransform(out: math.Mat4): void;
  60993. }
  60994. export class _cocos_animation_animation_clip__RootMotionEvaluation {
  60995. constructor(_rootBone: Node, _duration: number, _boneTransform: _cocos_animation_animation_clip__BoneTransform, _trackEvalStatuses: _cocos_animation_animation_clip__TrackEvalStatus<unknown>[]);
  60996. evaluate(time: number, motionLength: number): void;
  60997. }
  60998. export class _cocos_animation_animation_clip__AnimationClipEvaluation {
  60999. constructor(trackEvalStatuses: _cocos_animation_animation_clip__TrackEvalStatus<unknown>[], exoticAnimationEvaluator: _cocos_animation_animation_clip__ExoticAnimationEvaluator | undefined, rootMotionEvaluation: _cocos_animation_animation_clip__RootMotionEvaluation | undefined);
  61000. /**
  61001. * Evaluates this animation.
  61002. * @param time The time.
  61003. */
  61004. evaluate(time: number): void;
  61005. /**
  61006. * Gets the root bone motion.
  61007. * @param startTime Start time.
  61008. * @param endTime End time.
  61009. */
  61010. evaluateRootMotion(time: number, motionLength: number): void;
  61011. }
  61012. export const _cocos_animation_internal_symbols__BAKE_SKELETON_CURVE_SYMBOL: unique symbol;
  61013. export interface _cocos_animation_animation_clip__SkeletonAnimationBakeInfo {
  61014. samples: number;
  61015. frames: number;
  61016. joints: Record<string, {
  61017. transforms?: math.Mat4[];
  61018. }>;
  61019. }
  61020. export type _cocos_animation_tracks_untyped_track__UntypedTrackRefine = (path: Readonly<animation.TrackPath>, proxy: animation.IValueProxyFactory | undefined) => "vec2" | "vec3" | "vec4" | "color" | "size";
  61021. export const _cocos_animation_animation_clip__searchForRootBonePathSymbol: unique symbol;
  61022. export type _cocos_animation_animation_clip__WrapMode_ = _cocos_animation_types__WrapMode;
  61023. /**
  61024. * For internal
  61025. */
  61026. export class _cocos_animation_types__WrappedInfo {
  61027. ratio: number;
  61028. time: number;
  61029. direction: number;
  61030. stopped: boolean;
  61031. iterations: number;
  61032. frameIndex: number;
  61033. constructor(info?: _cocos_animation_types__WrappedInfo);
  61034. set(info: _cocos_animation_types__WrappedInfo): void;
  61035. }
  61036. export class _cocos_animation_playable__Playable {
  61037. /**
  61038. * @en Whether if this `Playable` is in playing.
  61039. * @zh 该 `Playable` 是否正在播放状态。
  61040. * @default false
  61041. */
  61042. get isPlaying(): boolean;
  61043. /**
  61044. * @en Whether if this `Playable` has been paused. This can be true even if in edit mode(isPlaying == false).
  61045. * @zh 该 `Playable` 是否已被暂停。
  61046. * @default false
  61047. */
  61048. get isPaused(): boolean;
  61049. /**
  61050. * @en Whether if this `Playable` has been paused or stopped.
  61051. * @zh 该 `Playable` 是否已被暂停或停止。
  61052. */
  61053. get isMotionless(): boolean;
  61054. /**
  61055. * @en Play this animation.
  61056. * @zh 播放动画。
  61057. */
  61058. play(): void;
  61059. /**
  61060. * @en Stop this animation.
  61061. * @zh 停止动画播放。
  61062. */
  61063. stop(): void;
  61064. /**
  61065. * @en Pause this animation.
  61066. * @zh 暂停动画。
  61067. */
  61068. pause(): void;
  61069. /**
  61070. * @en Resume this animation.
  61071. * @zh 重新播放动画。
  61072. */
  61073. resume(): void;
  61074. /**
  61075. * @en Perform a single frame step.
  61076. * @zh 执行一帧动画。
  61077. */
  61078. step(): void;
  61079. update(deltaTime: number): void;
  61080. protected onPlay(): void;
  61081. protected onPause(): void;
  61082. protected onResume(): void;
  61083. protected onStop(): void;
  61084. protected onError(message: string): void;
  61085. }
  61086. /**
  61087. * @en The event type supported by Animation
  61088. * @zh Animation 支持的事件类型。
  61089. */
  61090. export enum _cocos_animation_animation_state__EventType {
  61091. /**
  61092. * @en Emit when begin playing animation
  61093. * @zh 开始播放时触发。
  61094. */
  61095. PLAY = "play",
  61096. /**
  61097. * @en Emit when stop playing animation
  61098. * @zh 停止播放时触发。
  61099. */
  61100. STOP = "stop",
  61101. /**
  61102. * @en Emit when pause animation
  61103. * @zh 暂停播放时触发。
  61104. */
  61105. PAUSE = "pause",
  61106. /**
  61107. * @en Emit when resume animation
  61108. * @zh 恢复播放时触发。
  61109. */
  61110. RESUME = "resume",
  61111. /**
  61112. * @en If animation repeat count is larger than 1, emit when animation play to the last frame.
  61113. * @zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发。
  61114. */
  61115. LASTFRAME = "lastframe",
  61116. /**
  61117. * @en Triggered when finish playing animation.
  61118. * @zh 动画完成播放时触发。
  61119. */
  61120. FINISHED = "finished"
  61121. }
  61122. export interface _cocos_animation_cross_fade__CrossFadeScheduler {
  61123. addCrossFade(crossFade: _cocos_animation_cross_fade__CrossFade): void;
  61124. removeCrossFade(crossFade: _cocos_animation_cross_fade__CrossFade): void;
  61125. }
  61126. export class _cocos_animation_cross_fade__CrossFade extends _cocos_animation_playable__Playable {
  61127. constructor(scheduler?: _cocos_animation_cross_fade__CrossFadeScheduler);
  61128. update(deltaTime: number): void;
  61129. /**
  61130. * 在指定时间内将从当前动画状态切换到指定的动画状态。
  61131. * @param state 指定的动画状态。
  61132. * @param duration 切换时间。
  61133. */
  61134. crossFade(state: AnimationState | null, duration: number): void;
  61135. clear(): void;
  61136. protected onPlay(): void;
  61137. /**
  61138. * 停止我们淡入淡出的所有动画状态并停止淡入淡出。
  61139. */
  61140. protected onPause(): void;
  61141. /**
  61142. * 恢复我们淡入淡出的所有动画状态并继续淡入淡出。
  61143. */
  61144. protected onResume(): void;
  61145. /**
  61146. * 停止所有淡入淡出的动画状态。
  61147. */
  61148. protected onStop(): void;
  61149. }
  61150. export type _cocos_core_event_eventify__EventType = string | number;
  61151. /**
  61152. * @zh
  61153. * 实现该接口的对象具有处理事件的能力。
  61154. * @en
  61155. * Objects those implement this interface have essentially the capability to process events.
  61156. */
  61157. export interface _cocos_core_event_eventify__IEventified {
  61158. /**
  61159. * @zh 检查指定事件是否已注册回调。
  61160. * @en Checks whether there is correspond event listener registered on the given event.
  61161. * @param type - Event type.
  61162. * @param callback - Callback function when event triggered.
  61163. * @param target - Callback callee.
  61164. */
  61165. hasEventListener(type: string, callback?: (...any: any[]) => void, target?: any): boolean;
  61166. /**
  61167. * @en
  61168. * Register an callback of a specific event type on the EventTarget.
  61169. * This type of event should be triggered via `emit`.
  61170. * @zh
  61171. * 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  61172. *
  61173. * @param type - A string representing the event type to listen for.
  61174. * @param callback - The callback that will be invoked when the event is dispatched.
  61175. * The callback is ignored if it is a duplicate (the callbacks are unique).
  61176. * @param thisArg - The target (this object) to invoke the callback, can be null
  61177. * @return - Just returns the incoming callback so you can save the anonymous function easier.
  61178. * @example
  61179. * import { log } from 'cc';
  61180. * eventTarget.on('fire', function () {
  61181. * log("fire in the hole");
  61182. * }, node);
  61183. */
  61184. on<TFunction extends (...any: any[]) => void>(type: _cocos_core_event_eventify__EventType, callback: TFunction, thisArg?: any, once?: boolean): typeof callback;
  61185. /**
  61186. * @en
  61187. * Register an callback of a specific event type on the EventTarget,
  61188. * the callback will remove itself after the first time it is triggered.
  61189. * @zh
  61190. * 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  61191. *
  61192. * @param type - A string representing the event type to listen for.
  61193. * @param callback - The callback that will be invoked when the event is dispatched.
  61194. * The callback is ignored if it is a duplicate (the callbacks are unique).
  61195. * @param target - The target (this object) to invoke the callback, can be null
  61196. * @example
  61197. * import { log } from 'cc';
  61198. * eventTarget.once('fire', function () {
  61199. * log("this is the callback and will be invoked only once");
  61200. * }, node);
  61201. */
  61202. once<TFunction extends (...any: any[]) => void>(type: _cocos_core_event_eventify__EventType, callback: TFunction, thisArg?: any): typeof callback;
  61203. /**
  61204. * @en
  61205. * Removes the listeners previously registered with the same type, callback, target and or useCapture,
  61206. * if only type is passed as parameter, all listeners registered with that type will be removed.
  61207. * @zh
  61208. * 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  61209. *
  61210. * @param type - A string representing the event type being removed.
  61211. * @param callback - The callback to remove.
  61212. * @param target - The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  61213. * @example
  61214. * import { log } from 'cc';
  61215. * // register fire eventListener
  61216. * var callback = eventTarget.on('fire', function () {
  61217. * log("fire in the hole");
  61218. * }, target);
  61219. * // remove fire event listener
  61220. * eventTarget.off('fire', callback, target);
  61221. * // remove all fire event listeners
  61222. * eventTarget.off('fire');
  61223. */
  61224. off<TFunction extends (...any: any[]) => void>(type: _cocos_core_event_eventify__EventType, callback?: TFunction, thisArg?: any): void;
  61225. /**
  61226. * @en Removes all callbacks previously registered with the same target (passed as parameter).
  61227. * This is not for removing all listeners in the current event target,
  61228. * and this is not for removing all listeners the target parameter have registered.
  61229. * It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  61230. * @zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  61231. * 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  61232. * 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  61233. * @param typeOrTarget - The target to be searched for all related listeners
  61234. */
  61235. targetOff(typeOrTarget: any): void;
  61236. /**
  61237. * @zh 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  61238. * @en Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  61239. * @param typeOrTarget - The event type or target with which the listeners will be removed
  61240. */
  61241. removeAll(typeOrTarget: any): void;
  61242. /**
  61243. * @zh 派发一个指定事件,并传递需要的参数
  61244. * @en Trigger an event directly with the event name and necessary arguments.
  61245. * @param type - event type
  61246. * @param args - Arguments when the event triggered
  61247. */
  61248. emit(type: _cocos_core_event_eventify__EventType, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void;
  61249. }
  61250. export const _cocos_animation_animation_component__Animation_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
  61251. export type _cocos_animation_animation_component__EventType_ = _cocos_animation_animation_state__EventType;
  61252. export const _cocos_animation_tracks_track__trackBindingTag: unique symbol;
  61253. export interface _cocos_animation_tracks_track__CustomizedTrackPathResolver {
  61254. get(target: unknown): unknown;
  61255. }
  61256. export const _cocos_animation_tracks_track__parseTrsPathTag: unique symbol;
  61257. export const _cocos_animation_tracks_track__normalizedFollowTag: unique symbol;
  61258. /**
  61259. * @en 表示一个包含了单条通道的轨道。
  61260. * @zh Describes a track which contains only single channel.
  61261. */
  61262. export abstract class _cocos_animation_tracks_track__SingleChannelTrack<TCurve extends _cocos_animation_tracks_track__Curve> extends animation.Track {
  61263. constructor();
  61264. /**
  61265. * @en The channel within the track.
  61266. * @zh 轨道包含的通道。
  61267. */
  61268. get channel(): _cocos_animation_tracks_track__Channel<TCurve>;
  61269. channels(): Iterable<_cocos_animation_tracks_track__Channel<TCurve>>;
  61270. /**
  61271. * @internal
  61272. */
  61273. protected createCurve(): TCurve;
  61274. /**
  61275. * @internal
  61276. */
  61277. [_cocos_animation_define__createEvalSymbol](): _cocos_animation_tracks_track__TrackEval<unknown>;
  61278. }
  61279. export class _cocos_animation_tracks_vector_track__Vec2TrackEval implements _cocos_animation_tracks_track__TrackEval<math.Vec2> {
  61280. constructor(_x: RealCurve | undefined, _y: RealCurve | undefined);
  61281. get requiresDefault(): boolean;
  61282. evaluate(time: number, defaultValue?: Readonly<math.Vec2>): math.Vec2;
  61283. }
  61284. export class _cocos_animation_tracks_vector_track__Vec3TrackEval implements _cocos_animation_tracks_track__TrackEval<math.Vec3> {
  61285. constructor(_x: RealCurve | undefined, _y: RealCurve | undefined, _z: RealCurve | undefined);
  61286. get requiresDefault(): boolean;
  61287. evaluate(time: number, defaultValue?: Readonly<math.Vec3>): math.Vec3;
  61288. }
  61289. export class _cocos_animation_tracks_vector_track__Vec4TrackEval implements _cocos_animation_tracks_track__TrackEval<math.Vec4> {
  61290. constructor(_x: RealCurve | undefined, _y: RealCurve | undefined, _z: RealCurve | undefined, _w: RealCurve | undefined);
  61291. get requiresDefault(): boolean;
  61292. evaluate(time: number, defaultValue?: Readonly<math.Vec4>): math.Vec4;
  61293. }
  61294. export class _cocos_animation_tracks_quat_track__QuatTrackEval implements _cocos_animation_tracks_track__TrackEval<math.Quat> {
  61295. constructor(_curve: QuatCurve);
  61296. get requiresDefault(): boolean;
  61297. evaluate(time: number): math.Quat;
  61298. }
  61299. export class _cocos_animation_tracks_color_track__ColorTrackEval implements _cocos_animation_tracks_track__TrackEval<math.Color> {
  61300. constructor(_x: RealCurve | undefined, _y: RealCurve | undefined, _z: RealCurve | undefined, _w: RealCurve | undefined);
  61301. get requiresDefault(): boolean;
  61302. evaluate(time: number, defaultValue?: math.Color): math.Color;
  61303. }
  61304. export class _cocos_animation_tracks_size_track__SizeTrackEval implements _cocos_animation_tracks_track__TrackEval<math.Size> {
  61305. constructor(_width: RealCurve | undefined, _height: RealCurve | undefined);
  61306. get requiresDefault(): boolean;
  61307. evaluate(time: number, defaultValue?: Readonly<math.Size>): math.Size;
  61308. }
  61309. export interface _cocos_animation_cubic_spline_value__ICubicSplineValue<T> extends ILerpable {
  61310. dataPoint: T;
  61311. inTangent: T;
  61312. outTangent: T;
  61313. lerp(to: _cocos_animation_cubic_spline_value__ICubicSplineValue<T>, t: number, dt: number): T;
  61314. getNoLerp(): T;
  61315. }
  61316. export type _cocos_animation_cubic_spline_value__CubicSplineValueConstructor<T> = new (dataPoint: T, inTangent: T, outTangent: T) => _cocos_animation_cubic_spline_value__ICubicSplineValue<T>;
  61317. export class _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyVec3PropertyBlendState implements _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Vec3> {
  61318. refCount: number;
  61319. accumulatedWeight: number;
  61320. result: math.Vec3;
  61321. blend(value: Readonly<math.Vec3>, weight: number): void;
  61322. reset(): void;
  61323. }
  61324. export class _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyQuatPropertyBlendState implements _cocos_3d_skeletal_animation_skeletal_animation_blending__PropertyBlendState<math.Quat> {
  61325. refCount: number;
  61326. accumulatedWeight: number;
  61327. result: math.Quat;
  61328. blend(value: Readonly<math.Quat>, weight: number): void;
  61329. reset(): void;
  61330. }
  61331. export class _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyNodeBlendState extends _cocos_3d_skeletal_animation_skeletal_animation_blending__NodeBlendState<_cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyVec3PropertyBlendState, _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyQuatPropertyBlendState> {
  61332. apply(node: Node): void;
  61333. protected _createVec3BlendState(_currentValue: Readonly<math.Vec3>): _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyVec3PropertyBlendState;
  61334. protected _createQuatBlendState(_currentValue: Readonly<math.Quat>): _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyQuatPropertyBlendState;
  61335. }
  61336. export class _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyBlendStateBuffer extends _cocos_3d_skeletal_animation_skeletal_animation_blending__BlendStateBuffer<_cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyNodeBlendState> {
  61337. protected createNodeBlendState(): _cocos_3d_skeletal_animation_skeletal_animation_blending__LegacyNodeBlendState;
  61338. }
  61339. export enum _pal_audio_type__AudioType {
  61340. DOM_AUDIO = 0,
  61341. WEB_AUDIO = 1,
  61342. MINIGAME_AUDIO = 2,
  61343. NATIVE_AUDIO = 3,
  61344. UNKNOWN_AUDIO = 4
  61345. }
  61346. /**
  61347. * Each audio instance needs to be managed, but should not take up too much memory.
  61348. * The `OneShotAudio` is a lite version of audio class designed for audio manager.
  61349. */
  61350. export class _pal_audio__OneShotAudio {
  61351. /**
  61352. * Play the audio.
  61353. */
  61354. public play(): void;
  61355. /**
  61356. * Stops playing the audio.
  61357. */
  61358. public stop(): void;
  61359. /**
  61360. * Get or set the onPlay callback.
  61361. */
  61362. get onPlay(): () => void | undefined;
  61363. set onPlay(cb: () => void | undefined);
  61364. /**
  61365. * Get or set the onEnd callback.
  61366. */
  61367. get onEnd(): () => void | undefined;
  61368. set onEnd(cb: () => void | undefined);
  61369. }
  61370. export class _pal_audio__AudioPlayer {
  61371. /**
  61372. * Destroys the player.
  61373. */
  61374. destroy(): void;
  61375. /**
  61376. * Asynchronously creates an audio player to load an audio.
  61377. * @param url URL to the audio.
  61378. * @param opts Load options.
  61379. * @returns The audio player.
  61380. */
  61381. static load(url: string, opts?: import('pal/audio/type').AudioLoadOptions): Promise<_pal_audio__AudioPlayer>;
  61382. /**
  61383. * Asynchronously load a native audio for playing one shot.
  61384. * This is a basic loading method for AudioPlayer.
  61385. * @param url URL to the audio.
  61386. * @param opts Load options.
  61387. * @returns The native audio such as `HTMLAudioElement` or `AudioBuffer`.
  61388. */
  61389. static loadNative(url: string, opts?: import('pal/audio/type').AudioLoadOptions): Promise<unknown>;
  61390. /**
  61391. * Asynchronously load an OneShotAudio instance.
  61392. * @param url URL to the audio.
  61393. * @param volume Specify the volume.
  61394. * @param opts Load options.
  61395. * @returns The OneShotAudio instance.
  61396. */
  61397. static loadOneShotAudio(url: string, volume: number, opts?: import('pal/audio/type').AudioLoadOptions): Promise<_pal_audio__OneShotAudio>;
  61398. /**
  61399. * Max audio channel count allowed on current platform.
  61400. * If the amount of playing audios exceeds the limit,
  61401. * some audio instances would be discarded by audio manager.
  61402. */
  61403. static readonly maxAudioChannel: number;
  61404. /**
  61405. * Readonly property to get the url of audio src.
  61406. */
  61407. get src(): string;
  61408. /**
  61409. * The type of this player.
  61410. * For WEB platform, it can be `WEB_AUDIO` or `DOM_AUDIO`.
  61411. */
  61412. get type(): import('pal/audio/type').AudioType;
  61413. /**
  61414. * The state of this player.
  61415. * The state would be restored to `INIT` when the audio finished its playing.
  61416. */
  61417. get state(): import('pal/audio/type').AudioState;
  61418. /**
  61419. * Gets or sets whether if the playing audio should be looped.
  61420. */
  61421. get loop(): boolean;
  61422. set loop(val: boolean);
  61423. /**
  61424. * The volume of this player, ranged from 0 to 1.
  61425. */
  61426. get volume(): number;
  61427. set volume(val: number);
  61428. /**
  61429. * The duration of this audio player.
  61430. */
  61431. get duration(): number;
  61432. /**
  61433. * The current time of this player, in seconds, ranged from 0 to its total duration.
  61434. * Note this field is immutable, if you want to set the current time, please call the seek() method instead.
  61435. */
  61436. get currentTime(): number;
  61437. /**
  61438. * Get the sample rate.
  61439. */
  61440. get sampleRate(): number;
  61441. /**
  61442. * Get pcm data view from specified channel.
  61443. * @param channelIndex The channel index. 0 is left channel, 1 is right channel.
  61444. */
  61445. public getPCMData(channelIndex: number): import('pal/audio/type').AudioPCMDataView | undefined;
  61446. /**
  61447. * Asynchronously seeks the player's playing time onto specified location.
  61448. * @param time Desired playing time.
  61449. */
  61450. seek(time: number): Promise<void>;
  61451. /**
  61452. * Asynchronously plays the audio or resumes the audio while it is paused.
  61453. */
  61454. play(): Promise<void>;
  61455. /**
  61456. * Asynchronously pauses the playing.
  61457. */
  61458. pause(): Promise<void>;
  61459. /**
  61460. * Asynchronously stops the playing.
  61461. */
  61462. stop(): Promise<void>;
  61463. /**
  61464. * Registers an callback which would be called at an interruption begin.
  61465. * The interruption includes the show/hide events, phone call/alarm, earphones un-plugging.
  61466. * @param cb The callback.
  61467. */
  61468. onInterruptionBegin(cb: () => void): void;
  61469. /**
  61470. * Unregister the callback that registered to `onInterruptionBegin`.
  61471. * @param cb The callback. If not specified, all callback would be unregistered.
  61472. */
  61473. offInterruptionBegin(cb?: () => void): void;
  61474. /**
  61475. * Register an callback which would be called at an interruption end.
  61476. * @param cb The callback.
  61477. */
  61478. onInterruptionEnd(cb: () => void): void;
  61479. /**
  61480. * Unregister the callback that registered to `onInterruptionEnd`.
  61481. * @param cb The callback. If not specified, all callback would be unregistered.
  61482. */
  61483. offInterruptionEnd(cb?: () => void): void;
  61484. /**
  61485. * Register an callback which would be called when the player finished its playing.
  61486. * @param cb The callback.
  61487. */
  61488. onEnded(cb: () => void): void;
  61489. /**
  61490. * Unregister the callback that registered to `onEnded`.
  61491. * @param cb The callback. If not specified, all callback would be unregistered.
  61492. */
  61493. offEnded(cb?: () => void): void;
  61494. }
  61495. export interface _cocos_audio_audio_clip__AudioMeta {
  61496. player: _pal_audio__AudioPlayer | null;
  61497. url: string;
  61498. type: _pal_audio_type__AudioType;
  61499. duration: number;
  61500. }
  61501. export enum _pal_audio_type__AudioState {
  61502. INIT = 0,
  61503. PLAYING = 1,
  61504. PAUSED = 2,
  61505. STOPPED = 3,
  61506. INTERRUPTED = 4
  61507. }
  61508. export enum _cocos_audio_audio_source__AudioSourceEventType {
  61509. STARTED = "started",
  61510. ENDED = "ended"
  61511. }
  61512. export type _pal_audio_type__AudioBufferView = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
  61513. export interface _cocos_render_scene_core_render_window__IRenderWindowInfo {
  61514. title?: string;
  61515. width: number;
  61516. height: number;
  61517. renderPassInfo: gfx.RenderPassInfo;
  61518. swapchain?: gfx.Swapchain;
  61519. externalResLow?: number;
  61520. externalResHigh?: number;
  61521. externalFlag?: gfx.TextureFlags;
  61522. }
  61523. /**
  61524. * @en The render window represents the render target, it could be an off screen frame buffer or the on screen buffer.
  61525. * @zh 渲染窗口代表了一个渲染目标,可以是离屏的帧缓冲,也可以是屏幕缓冲
  61526. */
  61527. export class _cocos_render_scene_core_render_window__RenderWindow {
  61528. /**
  61529. * @en Get window width. Pre-rotated (i.e. rotationally invariant, always in identity/portrait mode) if possible.
  61530. * If you want to get oriented size instead, you should use [[renderer.scene.Camera.width]] which corresponds to the current screen rotation.
  61531. * @zh 获取窗口宽度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[renderer.scene.Camera.width]]。
  61532. */
  61533. get width(): number;
  61534. /**
  61535. * @en Get window height. Pre-rotated (i.e. rotationally invariant, always in identity/portrait mode) if possible.
  61536. * If you want to get oriented size instead, you should use [[renderer.scene.Camera.width]] which corresponds to the current screen rotation.
  61537. * @zh 获取窗口高度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[renderer.scene.Camera.height]]。
  61538. */
  61539. get height(): number;
  61540. /**
  61541. * @en Get the swapchain for this window, if there is one
  61542. * @zh 如果存在的话,获取此窗口的交换链
  61543. */
  61544. get swapchain(): gfx.Swapchain;
  61545. /**
  61546. * @en Get window frame buffer.
  61547. * @zh 帧缓冲对象。
  61548. */
  61549. get framebuffer(): gfx.Framebuffer;
  61550. get cameras(): renderer.scene.Camera[];
  61551. protected _title: string;
  61552. protected _width: number;
  61553. protected _height: number;
  61554. protected _swapchain: gfx.Swapchain;
  61555. protected _renderPass: gfx.RenderPass | null;
  61556. protected _colorTextures: gfx.Texture[];
  61557. protected _depthStencilTexture: gfx.Texture | null;
  61558. protected _cameras: renderer.scene.Camera[];
  61559. protected _hasOnScreenAttachments: boolean;
  61560. protected _hasOffScreenAttachments: boolean;
  61561. protected _framebuffer: gfx.Framebuffer | null;
  61562. protected _device: gfx.Device | null;
  61563. /**
  61564. * @private
  61565. */
  61566. static registerCreateFunc(root: Root): void;
  61567. initialize(device: gfx.Device, info: _cocos_render_scene_core_render_window__IRenderWindowInfo): boolean;
  61568. destroy(): void;
  61569. /**
  61570. * @en Resize window.
  61571. * @zh 重置窗口大小。
  61572. * @param width The new width.
  61573. * @param height The new height.
  61574. */
  61575. resize(width: number, height: number): void;
  61576. /**
  61577. * @en Extract all render cameras attached to the render window to the output cameras list
  61578. * @zh 将所有挂载到当前渲染窗口的摄像机存储到输出列表参数中
  61579. * @param cameras @en The output cameras list, should be empty before invoke this function
  61580. * @zh 输出相机列表参数,传入时应该为空
  61581. */
  61582. extractRenderCameras(cameras: renderer.scene.Camera[]): void;
  61583. /**
  61584. * @en Attach a new camera to the render window
  61585. * @zh 添加渲染相机
  61586. * @param camera @en The camera to attach @zh 要挂载的相机
  61587. */
  61588. attachCamera(camera: renderer.scene.Camera): void;
  61589. /**
  61590. * @en Detach a camera from the render window
  61591. * @zh 移除场景中的渲染相机
  61592. * @param camera @en The camera to detach @zh 要移除的相机
  61593. */
  61594. detachCamera(camera: renderer.scene.Camera): void;
  61595. /**
  61596. * @en Clear all attached cameras
  61597. * @zh 清空全部渲染相机
  61598. */
  61599. clearCameras(): void;
  61600. /**
  61601. * @en Sort all attached cameras with priority
  61602. * @zh 按照优先级对所有挂载的相机排序
  61603. */
  61604. sortCameras(): void;
  61605. }
  61606. export class _cocos_rendering_global_descriptor_set_manager__GlobalDSManager {
  61607. get descriptorSetMap(): Map<renderer.scene.Light, gfx.DescriptorSet>;
  61608. get linearSampler(): gfx.Sampler;
  61609. get pointSampler(): gfx.Sampler;
  61610. get descriptorSetLayout(): gfx.DescriptorSetLayout;
  61611. set globalDescriptorSet(val: gfx.DescriptorSet);
  61612. get globalDescriptorSet(): gfx.DescriptorSet;
  61613. constructor(device: gfx.Device);
  61614. regenLayout(): void;
  61615. /**
  61616. * @en Bind buffer for all descriptorSets, so that all created descriptorSet buffer are consistent
  61617. * @zh 为所有的 descriptorSet 绑定 buffer,使得所有已创建的 descriptorSet buffer 保持一致
  61618. * @param binding The target binding.
  61619. * @param buffer The buffer to be bound.
  61620. */
  61621. bindBuffer(binding: number, buffer: gfx.Buffer): void;
  61622. /**
  61623. * @en Bind sampler for all descriptorSets, so that all created descriptorSet sampler are consistent
  61624. * @zh 为所有的 descriptorSet 绑定 sampler,使得所有已创建的 descriptorSet sampler 保持一致
  61625. * @param binding The target binding.
  61626. * @param sampler The sampler to be bound.
  61627. */
  61628. bindSampler(binding: number, sampler: gfx.Sampler): void;
  61629. /**
  61630. * @en Bind texture for all descriptorSets, so that all created descriptorSet texture are consistent
  61631. * @zh 为所有的 descriptorSet 绑定 texture,使得所有已创建的 descriptorSet texture 保持一致
  61632. * @param binding The target binding.
  61633. * @param texture The texture to be bound.
  61634. */
  61635. bindTexture(binding: number, texture: gfx.Texture): void;
  61636. /**
  61637. * @en Update all descriptorSet
  61638. * @zh 更新所有的 descriptorSet
  61639. */
  61640. update(): void;
  61641. /**
  61642. * @en The layout of all created descriptorSets in buffer, sampler, and texture (except shadow) is consistent with the globalDescriptorSet
  61643. * @zh 所有创建出来的 descriptorSet 在 buffer、 sampler、 texture(shadow 除外)的布局与 globalDescriptorSet 保持一致
  61644. * @param idx Specify index creation
  61645. * @return descriptorSet
  61646. */
  61647. getOrCreateDescriptorSet(light: renderer.scene.Light): gfx.DescriptorSet | undefined;
  61648. destroy(): void;
  61649. }
  61650. /**
  61651. * @engineInternal
  61652. * @en PipelineRuntime is the runtime of both classical and custom pipelines.
  61653. * It is used internally and should not be called directly.
  61654. * @zh PipelineRuntime是经典管线以及自定义管线的运行时。
  61655. * 属于内部实现,用户不应直接调用。
  61656. */
  61657. export interface _cocos_rendering_custom_pipeline__PipelineRuntime {
  61658. /**
  61659. * @en Activate PipelineRuntime with default swapchain
  61660. * @zh 用默认交换链初始化PipelineRuntime
  61661. * @param swapchain @en Default swapchain @zh 默认的交换链
  61662. * @returns Success or not
  61663. */
  61664. activate(swapchain: gfx.Swapchain): boolean;
  61665. /**
  61666. * @en Destroy resources of PipelineRuntime
  61667. * @zh 销毁PipelineRuntime所持资源
  61668. * @returns Success or not
  61669. */
  61670. destroy(): boolean;
  61671. /**
  61672. * @en Render contents of cameras
  61673. * @zh 根据相机进行绘制
  61674. * @param cameras @en Camera list @zh 相机列表
  61675. */
  61676. render(cameras: renderer.scene.Camera[]): void;
  61677. /**
  61678. * @en Get graphics device
  61679. * @zh 获得图形设备
  61680. */
  61681. readonly device: gfx.Device;
  61682. /**
  61683. * @en Get user macros
  61684. * @zh 获得用户宏列表
  61685. */
  61686. readonly macros: renderer.MacroRecord;
  61687. /**
  61688. * @en Get global descriptor set manager
  61689. * @zh 获得全局(Global)级别描述符集(DescriptorSet)管理器
  61690. */
  61691. readonly globalDSManager: _cocos_rendering_global_descriptor_set_manager__GlobalDSManager;
  61692. /**
  61693. * @en Get global descriptor set layout
  61694. * @zh 获得全局(Global)级别描述符集的布局(DescriptorSet Layout)
  61695. */
  61696. readonly descriptorSetLayout: gfx.DescriptorSetLayout;
  61697. /**
  61698. * @en Get global descriptor set
  61699. * @zh 获得全局(Global)级别描述符集(DescriptorSet)
  61700. */
  61701. readonly descriptorSet: gfx.DescriptorSet;
  61702. /**
  61703. * @en Get command buffers of render pipeline
  61704. * @zh 获得渲染管线的命令缓冲(CommandBuffer)列表
  61705. */
  61706. readonly commandBuffers: gfx.CommandBuffer[];
  61707. /**
  61708. * @en Get scene data of render pipeline.
  61709. * Scene data contains render configurations of the current scene.
  61710. * @zh 获得渲染管线相关的场景数据,此场景数据一般包含渲染所需配置信息
  61711. */
  61712. readonly pipelineSceneData: PipelineSceneData;
  61713. /**
  61714. * @en Get constant macros.
  61715. * Constant macro is platform-dependent and immutable.
  61716. * @zh 获得常量宏列表,常量宏平台相关且无法修改
  61717. */
  61718. readonly constantMacros: string;
  61719. /**
  61720. * @en Get profiler model.
  61721. * This model is used to render profile information in Debug mode.
  61722. * @zh 获得分析工具(Profiler)的渲染实例,用于Debug模式下显示调试与性能检测信息
  61723. */
  61724. profiler: renderer.scene.Model | null;
  61725. /**
  61726. * @en Get geometry renderer.
  61727. * Geometry renderer is used to render procedural geometries.
  61728. * @zh 获得几何渲染器(GeometryRenderer),几何渲染器用于程序化渲染基础几何图形
  61729. */
  61730. readonly geometryRenderer: GeometryRenderer | null;
  61731. /**
  61732. * @en Get shading scale.
  61733. * Shading scale affects shading texels per pixel.
  61734. * Currently it affects classic native forward pipeline and builtin custom pipeline.
  61735. * Users can change the size of the render targets according to the shading scale,
  61736. * when writing their own custom pipelines.
  61737. * To change screen size, please check director.root.resize.
  61738. * @zh 获得渲染倍率(ShadingScale),每像素(pixel)绘制的纹素(texel)会根据渲染倍率进行调整。
  61739. * 目前仅对原有原生Forward管线以及内置自定义管线生效。
  61740. * 用户编写自定义管线时,可以根据渲染倍率进行渲染目标尺寸大小的调整。
  61741. * 如果要修改屏幕大小,详见director.root.resize。
  61742. */
  61743. shadingScale: number;
  61744. /**
  61745. * @en Get macro as string.
  61746. * @zh 根据宏名获得字符串
  61747. * @param name @en Name of macro @zh 宏的名字
  61748. * @returns String value
  61749. */
  61750. getMacroString(name: string): string;
  61751. /**
  61752. * @en Get macro as integer.
  61753. * @zh 根据宏名获得整型
  61754. * @param name @en Name of macro @zh 宏的名字
  61755. * @returns Integer value
  61756. */
  61757. getMacroInt(name: string): number;
  61758. /**
  61759. * @en Get macro as boolean.
  61760. * @zh 根据宏名获得布尔值
  61761. * @param name @en Name of macro @zh 宏的名字
  61762. * @returns Boolean value
  61763. */
  61764. getMacroBool(name: string): boolean;
  61765. /**
  61766. * @en Assign string value to macro.
  61767. * @zh 给宏赋值字符串
  61768. * @param name @en Name of macro @zh 宏的名字
  61769. * @param value @en String value @zh 字符串
  61770. */
  61771. setMacroString(name: string, value: string): void;
  61772. /**
  61773. * @en Assign integer value to macro.
  61774. * @zh 给宏赋值整型
  61775. * @param name @en Name of macro @zh 宏的名字
  61776. * @param value @en Integer value @zh 整型值
  61777. */
  61778. setMacroInt(name: string, value: number): void;
  61779. /**
  61780. * @en Assign boolean value to macro.
  61781. * @zh 给宏赋值布尔值
  61782. * @param name @en Name of macro @zh 宏的名字
  61783. * @param value @en Boolean value @zh 布尔值
  61784. */
  61785. setMacroBool(name: string, value: boolean): void;
  61786. /**
  61787. * @en Trigger pipeline state change event
  61788. * @zh 触发管线状态更新事件
  61789. */
  61790. onGlobalPipelineStateChanged(): void;
  61791. }
  61792. export interface _cocos_rendering_pipeline_event__IPipelineEvent {
  61793. on(type: PipelineEventType, callback: any, target?: any, once?: boolean): typeof callback;
  61794. once(type: PipelineEventType, callback: any, target?: any): typeof callback;
  61795. off(type: PipelineEventType, callback?: any, target?: any): any;
  61796. emit(type: PipelineEventType, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): any;
  61797. targetOff(typeOrTarget: any): void;
  61798. removeAll(typeOrTarget: any): void;
  61799. hasEventListener(type: PipelineEventType, callback?: any, target?: any): boolean;
  61800. }
  61801. export interface _cocos_3d_skeletal_animation_skeletal_animation_utils__IChunkContent {
  61802. skeleton: number;
  61803. clips: number[];
  61804. }
  61805. export interface _cocos_3d_skeletal_animation_skeletal_animation_utils__ICustomJointTextureLayout {
  61806. textureLength: number;
  61807. contents: _cocos_3d_skeletal_animation_skeletal_animation_utils__IChunkContent[];
  61808. }
  61809. /**
  61810. * The pool for joint textures.
  61811. * @internal
  61812. */
  61813. export class _cocos_3d_skeletal_animation_skeletal_animation_utils__JointTexturePool {
  61814. get pixelsPerJoint(): number;
  61815. constructor(device: gfx.Device);
  61816. clear(): void;
  61817. registerCustomTextureLayouts(layouts: _cocos_3d_skeletal_animation_skeletal_animation_utils__ICustomJointTextureLayout[]): void;
  61818. /**
  61819. * @en
  61820. * Get joint texture for the default pose.
  61821. * @zh
  61822. * 获取默认姿势的骨骼贴图。
  61823. */
  61824. getDefaultPoseTexture(skeleton: Skeleton, mesh: Mesh, skinningRoot: Node): _cocos_3d_skeletal_animation_skeletal_animation_utils__IJointTextureHandle | null;
  61825. /**
  61826. * @en
  61827. * Get joint texture for the specified animation clip.
  61828. * @zh
  61829. * 获取指定动画片段的骨骼贴图。
  61830. */
  61831. getSequencePoseTexture(skeleton: Skeleton, clip: AnimationClip, mesh: Mesh, skinningRoot: Node): _cocos_3d_skeletal_animation_skeletal_animation_utils__IJointTextureHandle | null;
  61832. releaseHandle(handle: _cocos_3d_skeletal_animation_skeletal_animation_utils__IJointTextureHandle): void;
  61833. releaseSkeleton(skeleton: Skeleton): void;
  61834. releaseAnimationClip(clip: AnimationClip): void;
  61835. }
  61836. export interface _cocos_3d_skeletal_animation_skeletal_animation_utils__IAnimInfo {
  61837. buffer: gfx.Buffer;
  61838. data: Float32Array;
  61839. dirty: boolean;
  61840. dirtyForJSB: Uint8Array;
  61841. currentClip: AnimationClip | null;
  61842. }
  61843. export class _cocos_3d_skeletal_animation_skeletal_animation_utils__JointAnimationInfo {
  61844. constructor(device: gfx.Device);
  61845. getData(nodeID?: string): _cocos_3d_skeletal_animation_skeletal_animation_utils__IAnimInfo;
  61846. destroy(nodeID: string): void;
  61847. switchClip(info: _cocos_3d_skeletal_animation_skeletal_animation_utils__IAnimInfo, clip: AnimationClip | null): _cocos_3d_skeletal_animation_skeletal_animation_utils__IAnimInfo;
  61848. clear(): void;
  61849. }
  61850. export class _cocos_3d_skeletal_animation_data_pool_manager__DataPoolManager {
  61851. jointTexturePool: _cocos_3d_skeletal_animation_skeletal_animation_utils__JointTexturePool;
  61852. jointAnimationInfo: _cocos_3d_skeletal_animation_skeletal_animation_utils__JointAnimationInfo;
  61853. constructor(device: gfx.Device);
  61854. releaseSkeleton(skeleton: Skeleton): void;
  61855. releaseAnimationClip(clip: AnimationClip): void;
  61856. clear(): void;
  61857. }
  61858. /**
  61859. * @en Initialization information for the Root
  61860. * @zh Root 初始化描述信息
  61861. */
  61862. export interface _cocos_root__IRootInfo {
  61863. enableHDR?: boolean;
  61864. }
  61865. /**
  61866. * @en GFX buffer barrier.
  61867. * @zh GFX buffer内存屏障。
  61868. */
  61869. export class _cocos_gfx_base_states_buffer_barrier__BufferBarrier extends gfx.GFXObject {
  61870. get info(): Readonly<gfx.BufferBarrierInfo>;
  61871. get hash(): number;
  61872. protected _info: gfx.BufferBarrierInfo;
  61873. protected _hash: number;
  61874. constructor(info: Readonly<gfx.BufferBarrierInfo>, hash: number);
  61875. static computeHash(info: Readonly<gfx.BufferBarrierInfo>): number;
  61876. }
  61877. export type __types_globals__TypedArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Uint16ArrayConstructor | Int16ArrayConstructor | Uint32ArrayConstructor | Int32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
  61878. /**
  61879. * @engineInternal
  61880. */
  61881. export class _cocos_core_data_gc_object__GCObject {
  61882. constructor();
  61883. destroy(): void;
  61884. }
  61885. export interface _cocos_render_scene_core_program_lib__IDefineRecord extends EffectAsset.IDefineInfo {
  61886. _map: (value: any) => number;
  61887. _offset: number;
  61888. }
  61889. /**
  61890. * @en The global maintainer of all shader resources.
  61891. * @zh 维护 shader 资源实例的全局管理器。
  61892. */
  61893. export class _cocos_render_scene_core_program_lib__ProgramLib {
  61894. protected _templates: Record<string, renderer.IProgramInfo>;
  61895. protected _cache: Record<string, gfx.Shader>;
  61896. protected _templateInfos: Record<number, renderer.ITemplateInfo>;
  61897. register(effect: EffectAsset): void;
  61898. /**
  61899. * @en Register the shader template with the given info
  61900. * @zh 注册 shader 模板。
  61901. */
  61902. define(shader: EffectAsset.IShaderInfo): renderer.IProgramInfo;
  61903. /**
  61904. * @en Gets the shader template with its name
  61905. * @zh 通过名字获取 Shader 模板
  61906. * @param name Target shader name
  61907. */
  61908. getTemplate(name: string): renderer.IProgramInfo;
  61909. /**
  61910. * @en Gets the shader template info with its name
  61911. * @zh 通过名字获取 Shader 模版信息
  61912. * @param name Target shader name
  61913. */
  61914. getTemplateInfo(name: string): renderer.ITemplateInfo;
  61915. /**
  61916. * @en Gets the pipeline layout of the shader template given its name
  61917. * @zh 通过名字获取 Shader 模板相关联的管线布局
  61918. * @param name Target shader name
  61919. */
  61920. getDescriptorSetLayout(device: gfx.Device, name: string, isLocal?: boolean): gfx.DescriptorSetLayout;
  61921. /**
  61922. * @en
  61923. * Does this library has the specified program
  61924. * @zh
  61925. * 当前是否有已注册的指定名字的 shader
  61926. * @param name Target shader name
  61927. */
  61928. hasProgram(name: string): boolean;
  61929. /**
  61930. * @en Gets the shader key with the name and a macro combination
  61931. * @zh 根据 shader 名和预处理宏列表获取 shader key。
  61932. * @param name Target shader name
  61933. * @param defines The combination of preprocess macros
  61934. */
  61935. getKey(name: string, defines: renderer.MacroRecord): string;
  61936. /**
  61937. * @en Destroy all shader instance match the preprocess macros
  61938. * @zh 销毁所有完全满足指定预处理宏特征的 shader 实例。
  61939. * @param defines The preprocess macros as filter
  61940. */
  61941. destroyShaderByDefines(defines: renderer.MacroRecord): void;
  61942. /**
  61943. * @en Gets the shader resource instance with given information
  61944. * @zh 获取指定 shader 的渲染资源实例
  61945. * @param name Shader name
  61946. * @param defines Preprocess macros
  61947. * @param pipeline The [[RenderPipeline]] which owns the render command
  61948. * @param key The shader cache key, if already known
  61949. */
  61950. getGFXShader(device: gfx.Device, name: string, defines: renderer.MacroRecord, pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime, key?: string): gfx.Shader;
  61951. }
  61952. export type __types_globals__RecursivePartial<T> = {
  61953. [P in keyof T]?: T[P] extends Array<infer U> ? Array<__types_globals__RecursivePartial<U>> : T[P] extends ReadonlyArray<infer V> ? ReadonlyArray<__types_globals__RecursivePartial<V>> : __types_globals__RecursivePartial<T[P]>;
  61954. };
  61955. export interface _cocos_render_scene_core_pass__IPassDynamics {
  61956. [type: number]: {
  61957. dirty: boolean;
  61958. value: number;
  61959. };
  61960. }
  61961. export interface _cocos_render_scene_core_memory_pools__IHandle<P extends renderer.PoolType> extends Number {
  61962. _: P;
  61963. }
  61964. export type _cocos_render_scene_core_memory_pools__BufferManifest = {
  61965. [key: string]: number | string;
  61966. COUNT: number;
  61967. };
  61968. export enum _cocos_render_scene_core_memory_pools__BufferDataType {
  61969. UINT32 = 0,
  61970. FLOAT32 = 1,
  61971. NEVER = 2
  61972. }
  61973. export type _cocos_render_scene_core_memory_pools__BufferDataTypeManifest<E extends _cocos_render_scene_core_memory_pools__BufferManifest> = {
  61974. [key in E[keyof E]]: _cocos_render_scene_core_memory_pools__BufferDataType;
  61975. };
  61976. export type _cocos_render_scene_core_memory_pools__BufferDataMembersManifest<E extends _cocos_render_scene_core_memory_pools__BufferManifest> = {
  61977. [key in E[keyof E]]: number;
  61978. };
  61979. export type _cocos_render_scene_core_memory_pools__BufferArrayType = Float32Array | Uint32Array;
  61980. export interface _cocos_render_scene_core_memory_pools__IMemoryPool<P extends renderer.PoolType> {
  61981. free(handle: _cocos_render_scene_core_memory_pools__IHandle<P>): void;
  61982. }
  61983. export class _cocos_render_scene_core_memory_pools__BufferPool<P extends renderer.PoolType, E extends _cocos_render_scene_core_memory_pools__BufferManifest> implements _cocos_render_scene_core_memory_pools__IMemoryPool<P> {
  61984. constructor(poolType: P, dataType: _cocos_render_scene_core_memory_pools__BufferDataTypeManifest<E>, dataMembers: _cocos_render_scene_core_memory_pools__BufferDataMembersManifest<E>, enumType: E, entryBits?: number);
  61985. alloc(): _cocos_render_scene_core_memory_pools__IHandle<P>;
  61986. getBuffer(handle: _cocos_render_scene_core_memory_pools__IHandle<P>): _cocos_render_scene_core_memory_pools__BufferArrayType;
  61987. getTypedArray<K extends E[keyof E]>(handle: _cocos_render_scene_core_memory_pools__IHandle<P>, element: K): _cocos_render_scene_core_memory_pools__BufferArrayType;
  61988. free(handle: _cocos_render_scene_core_memory_pools__IHandle<P>): void;
  61989. }
  61990. export interface __types_globals__IWritableArrayLike<T> {
  61991. readonly length: number;
  61992. [index: number]: T;
  61993. }
  61994. export abstract class _cocos_core_memop_scalable_container__ScalableContainer {
  61995. /**
  61996. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  61997. */
  61998. _poolHandle: number;
  61999. constructor();
  62000. abstract tryShrink(): void;
  62001. destroy(): void;
  62002. }
  62003. /**
  62004. * @en
  62005. * line-sphere intersect detect.
  62006. * @zh
  62007. * 线段与球的相交性检测
  62008. * @param line @zh 线段 @en The line to test
  62009. * @param sphere @zh 球 @en The sphere to test
  62010. * @returns @zh 如果没有相交,返回 0 ,否则返回非 0。 @en zero if no intersection, otherwise returns a non-zero value.no intersection
  62011. */
  62012. function _cocos_core_geometry_intersect__lineSphere(line: geometry.Line, sphere: geometry.Sphere): number;
  62013. /**
  62014. * @en
  62015. * line-aabb intersect detect.
  62016. * @zh
  62017. * 线段与轴对齐包围盒的相交性检测
  62018. * @param line @zh 线段 @en The line to test
  62019. * @param aabb @zh 轴对齐包围盒 @en The aabb to test
  62020. * @returns @zh 如果没有相交,返回 0 ,否则返回非 0。 @en zero if no intersection, otherwise returns a non-zero value.no intersection
  62021. */
  62022. function _cocos_core_geometry_intersect__lineAABB(line: geometry.Line, aabb: geometry.AABB): number;
  62023. /**
  62024. * @en
  62025. * line-obb intersect detect.
  62026. * @zh
  62027. * 线段与OBB的相交性检测。
  62028. * @param line @zh 线段 @en The line to test.
  62029. * @param obb @zh OBB @en The OBB to test.
  62030. * @returns @zh 如果没有相交,返回 0 ,否则返回非 0。 @en zero if no intersection, otherwise returns a non-zero value.no intersection
  62031. */
  62032. function _cocos_core_geometry_intersect__lineOBB(line: geometry.Line, obb: geometry.OBB): number;
  62033. /**
  62034. * @engineInternal
  62035. */
  62036. export enum _cocos_core_geometry_curve__WrapModeMask {
  62037. Default = 0,
  62038. Normal = 1,
  62039. Loop = 2,
  62040. ShouldWrap = 4,
  62041. Clamp = 8,
  62042. PingPong = 22,
  62043. Reverse = 36
  62044. }
  62045. /**
  62046. * @engineInternal
  62047. */
  62048. export class _cocos_core_geometry_curve__OptimizedKey {
  62049. index: number;
  62050. time: number;
  62051. endTime: number;
  62052. coefficient: Float32Array;
  62053. constructor();
  62054. evaluate(T: number): number;
  62055. }
  62056. /**
  62057. * @en
  62058. * Define an enum type. <br/>
  62059. * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
  62060. * Otherwise it will use the value specified by user who writes the enum definition.
  62061. *
  62062. * @zh
  62063. * 定义一个枚举类型。<br/>
  62064. * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  62065. *
  62066. * @param obj
  62067. * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
  62068. * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
  62069. * @return @en The defined enum type. @zh 定义的枚举类型。
  62070. */
  62071. export function _cocos_core_value_types_enum__Enum<T>(obj: T): T;
  62072. export namespace _cocos_core_value_types_enum__Enum {
  62073. var update: <T>(obj: T) => T;
  62074. var isEnum: <EnumT extends {}>(enumType: EnumT) => boolean;
  62075. var getList: <EnumT extends {}>(enumType: EnumT) => readonly _cocos_core_value_types_enum__Enum.Enumerator<EnumT>[];
  62076. var sortList: <EnumT extends {}>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
  62077. }
  62078. export namespace _cocos_core_value_types_enum__Enum {
  62079. interface Enumerator<EnumT> {
  62080. /**
  62081. * The name of the enumerator.
  62082. */
  62083. name: keyof EnumT;
  62084. /**
  62085. * The value of the numerator.
  62086. */
  62087. value: EnumT[keyof EnumT];
  62088. }
  62089. }
  62090. export type _cocos_core_utils_pool__CleanUpFunction<T> = (value: T) => boolean | void;
  62091. export type __types_globals__Getter = () => any;
  62092. export type __types_globals__Setter = (value: any) => void;
  62093. export type _cocos_core_platform_debug__StringSubstitution = number | string;
  62094. export interface _cocos_core_utils_x_deprecated__IReplacement {
  62095. /** Deprecated property name. */
  62096. name: string;
  62097. /** Times to print log when accessing deprecated property. */
  62098. logTimes?: number;
  62099. /** New property name. */
  62100. newName?: string;
  62101. /** The object to deprecate this property. */
  62102. target?: object;
  62103. /** The name of the object to deprecate this property. */
  62104. targetName?: string;
  62105. /** New function to access the property. If it is valid, `customSetter` and `customGetter` will be ignored. */
  62106. customFunction?: Function;
  62107. /** New setter. */
  62108. customSetter?: (v: any) => void;
  62109. /** New getter. */
  62110. customGetter?: () => any;
  62111. /** Property description used in warning log. */
  62112. suggest?: string;
  62113. }
  62114. export interface _cocos_core_utils_x_deprecated__IRemoveItem {
  62115. /** Removed property name. */
  62116. name: string;
  62117. /** Times to print log when accessing removed property. */
  62118. logTimes?: number;
  62119. /** Property description used in warning log. */
  62120. suggest?: string;
  62121. }
  62122. export interface _cocos_core_utils_x_deprecated__IMarkItem {
  62123. /** Deprecated property name. */
  62124. name: string;
  62125. /** Times to print log when accessing deprecated property. */
  62126. logTimes?: number;
  62127. /** Property description used in warning log. */
  62128. suggest?: string;
  62129. }
  62130. export type _cocos_core_data_utils_attribute_defines__GroupOptions = {
  62131. name: string;
  62132. } & Partial<{
  62133. id: string;
  62134. name: string;
  62135. displayOrder: number;
  62136. style: string;
  62137. }>;
  62138. export interface _cocos_core_data_utils_attribute_defines__IExposedAttributes {
  62139. /**
  62140. * 指定属性的类型。
  62141. */
  62142. type?: any;
  62143. /**
  62144. * 控制是否在编辑器中显示该属性。
  62145. */
  62146. visible?: boolean | (() => boolean);
  62147. /**
  62148. * 该属性在编辑器中的显示名称。
  62149. */
  62150. displayName?: string;
  62151. /**
  62152. *
  62153. */
  62154. displayOrder?: number;
  62155. /**
  62156. * @en Editor tooltip of this property.
  62157. * @zh 该属性在编辑器中的工具提示内容。
  62158. */
  62159. tooltip?: string;
  62160. /**
  62161. * @en The group name where this property is organized into, on property inspector.
  62162. * @zh 在属性检查器上该属性所属的分类标签名。
  62163. */
  62164. group?: string | _cocos_core_data_utils_attribute_defines__GroupOptions;
  62165. /**
  62166. *
  62167. */
  62168. multiline?: boolean;
  62169. /**
  62170. * 指定该属性是否为可读的。
  62171. * 将 `readonly` 指定为 `true` 或选项对象时都将标记为该属性是可读的;
  62172. * 当指定为 `true` 时将应用所有默认的只读性质。
  62173. * @default false
  62174. */
  62175. readonly?: boolean | {
  62176. /**
  62177. * 如果该属性是对象或数组,指定该对象的属性或该数组的元素是否是只读的。
  62178. * 若为 `true`,递归的所有属性或元素都将是只读的。
  62179. * @default true
  62180. */
  62181. deep?: boolean;
  62182. };
  62183. /**
  62184. * 当该属性为数值类型时,指定了该属性允许的最小值。
  62185. */
  62186. min?: number;
  62187. /**
  62188. * 当该属性为数值类型时,指定了该属性允许的最大值。
  62189. */
  62190. max?: number;
  62191. /**
  62192. * 当该属性为数值类型时并在编辑器中提供了滑动条时,指定了滑动条的步长。
  62193. */
  62194. step?: number;
  62195. /**
  62196. * 当该属性为数值类型时,指定了该属性允许的范围。
  62197. */
  62198. range?: number[];
  62199. /**
  62200. * 当该属性为数值类型时,是否在编辑器中提供滑动条来调节值。
  62201. */
  62202. slide?: boolean;
  62203. /**
  62204. * 该属性是否参与序列化和反序列化。
  62205. */
  62206. serializable?: boolean;
  62207. /**
  62208. * 该属性的曾用名。
  62209. */
  62210. formerlySerializedAs?: string;
  62211. /**
  62212. * 该属性是否仅仅在编辑器环境中生效。
  62213. */
  62214. editorOnly?: boolean;
  62215. /**
  62216. * 是否覆盖基类中的同名属性。
  62217. */
  62218. override?: boolean;
  62219. /**
  62220. *
  62221. */
  62222. animatable?: boolean;
  62223. /**
  62224. *
  62225. */
  62226. unit?: string;
  62227. /**
  62228. * 转换为弧度
  62229. */
  62230. radian?: boolean;
  62231. /**
  62232. * @en User custom data, which can be obtained through the `CCClass.attr()` interface.
  62233. * @zh 用户自定义数据,可以通过 `CCClass.attr()` 接口获取自定义数据。
  62234. */
  62235. userData?: Record<string, any>;
  62236. /**
  62237. * 在允许的情况下,在编辑器中显示为一组单选按钮
  62238. */
  62239. radioGroup?: boolean;
  62240. }
  62241. /**
  62242. * @zh CCClass 属性选项。
  62243. * @en CCClass property options
  62244. */
  62245. export type _cocos_core_data_decorators_property__IPropertyOptions = _cocos_core_data_utils_attribute_defines__IExposedAttributes;
  62246. /// <reference types="./@types/globals" />
  62247. export type _cocos_core_data_decorators_utils__Initializer = () => unknown;
  62248. export type _cocos_core_data_decorators_utils__BabelPropertyDecoratorDescriptor = PropertyDescriptor & {
  62249. initializer?: _cocos_core_data_decorators_utils__Initializer;
  62250. };
  62251. /**
  62252. * @en
  62253. * The signature is compatible with both the TypeScript legacy decorator and the Babel legacy decorator.
  62254. * The third argument is `descriptor` in the Babel case.
  62255. * For some engine internally optimized decorators, the third argument is the initializer.
  62256. * @zh
  62257. * 该签名同时兼容 TypeScript legacy 装饰器以及 Babel legacy 装饰器。
  62258. * 第三个参数在 Babel 情况下,会传入 descriptor。对于一些被优化的引擎内部装饰器,会传入 initializer。
  62259. */
  62260. export type _cocos_core_data_decorators_utils__LegacyPropertyDecorator = (target: Record<string, any>, propertyKey: string | symbol, descriptorOrInitializer?: _cocos_core_data_decorators_utils__BabelPropertyDecoratorDescriptor | _cocos_core_data_decorators_utils__Initializer | null) => void;
  62261. export type _cocos_core_data_decorators_property__SimplePropertyType = Function | string | typeof CCString | typeof CCInteger | typeof CCBoolean;
  62262. export type _cocos_core_data_decorators_property__PropertyType = _cocos_core_data_decorators_property__SimplePropertyType | _cocos_core_data_decorators_property__SimplePropertyType[];
  62263. export class _cocos_core_data_utils_attribute__PrimitiveType<T> {
  62264. name: string;
  62265. default: T;
  62266. constructor(name: string, defaultValue: T);
  62267. toString(): string;
  62268. }
  62269. namespace _cocos_core_data_utils_attribute {
  62270. export const DELIMETER = "$_$";
  62271. export function createAttrsSingle(owner: Object, superAttrs?: any): any;
  62272. /**
  62273. * @param subclass Should not have '__attrs__'.
  62274. */
  62275. export function createAttrs(subclass: any): any;
  62276. /**
  62277. * Tag the class with any meta attributes, then return all current attributes assigned to it.
  62278. * This function holds only the attributes, not their implementations.
  62279. * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
  62280. * @param propertyName The name of the property or function, used to retrieve the attributes.
  62281. * @private
  62282. */
  62283. export function attr(constructor: any, propertyName: string): {
  62284. [attributeName: string]: any;
  62285. };
  62286. /**
  62287. * Returns a read-only meta-object.
  62288. */
  62289. export function getClassAttrs(constructor: any): any;
  62290. export function setClassAttr(ctor: any, propName: any, key: any, value: any): void;
  62291. export class PrimitiveType<T> {
  62292. name: string;
  62293. default: T;
  62294. constructor(name: string, defaultValue: T);
  62295. toString(): string;
  62296. }
  62297. /**
  62298. * @en
  62299. * Indicates that the editor should treat this property or array element as an Integer value.
  62300. * @zh
  62301. * 指定编辑器以整数形式对待该属性或数组元素。
  62302. * @example
  62303. * ```ts
  62304. * import { CCInteger, _decorator } from "cc";
  62305. *
  62306. * // in the class definition:
  62307. *
  62308. * @_decorator.property({type: CCInteger})
  62309. * count = 0;
  62310. *
  62311. * @_decorator.property({type: [CCInteger]})
  62312. * array = [];
  62313. * ```
  62314. */
  62315. export const CCInteger: _cocos_core_data_utils_attribute__PrimitiveType<number>;
  62316. /**
  62317. * @en
  62318. * Indicates that the editor should treat this property or array element as a Float value.
  62319. * @zh
  62320. * 指定编辑器以浮点数形式对待该属性或数组元素。
  62321. * @example
  62322. * ```ts
  62323. * import { CCFloat, _decorator } from "cc";
  62324. *
  62325. * // in the class definition:
  62326. *
  62327. * @_decorator.property({type: CCFloat})
  62328. * x = 0;
  62329. *
  62330. * @_decorator.property({type: [CCFloat]})
  62331. * array = [];
  62332. * ```
  62333. */
  62334. export const CCFloat: _cocos_core_data_utils_attribute__PrimitiveType<number>;
  62335. /**
  62336. * @en
  62337. * Indicates that the editor should treat this property or array element as a Boolean value.
  62338. * @zh
  62339. * 指定编辑器以布尔值形式对待该属性或数组元素。
  62340. *
  62341. * @example
  62342. * ```ts
  62343. * import { CCBoolean, _decorator } from "cc";
  62344. * // in the class definition
  62345. * @_decorator.property({type: CCBoolean})
  62346. * isTrue = false;
  62347. *
  62348. * @_decorator.property({type: [CCBoolean]})
  62349. * array = [];
  62350. * ```
  62351. */
  62352. export const CCBoolean: _cocos_core_data_utils_attribute__PrimitiveType<boolean>;
  62353. /**
  62354. * @en
  62355. * Indicates that the editor should treat this property or array element as a String value.
  62356. * @zh
  62357. * 指定编辑器以字符串形式对待该属性或数组元素。
  62358. * @example
  62359. * ```ts
  62360. * import { CCString, _decorator } from "cc";
  62361. *
  62362. * // in the class definition
  62363. *
  62364. * @_decorator.property({type: CCString})
  62365. * name = '';
  62366. *
  62367. * @_decorator.property({type: [CCString]})
  62368. * array = [];
  62369. * ```
  62370. */
  62371. export const CCString: _cocos_core_data_utils_attribute__PrimitiveType<string>;
  62372. export function getTypeChecker_ET(type: string, attributeName: string): (constructor: Function, mainPropertyName: string) => void;
  62373. export function getObjTypeChecker_ET(typeCtor: any): (classCtor: any, mainPropName: any) => void;
  62374. }
  62375. /**
  62376. * Tag the class with any meta attributes, then return all current attributes assigned to it.
  62377. * This function holds only the attributes, not their implementations.
  62378. * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
  62379. * @param propertyName The name of the property or function, used to retrieve the attributes.
  62380. * @private
  62381. */
  62382. export function _cocos_core_data_utils_attribute__attr(constructor: any, propertyName: string): {
  62383. [attributeName: string]: any;
  62384. };
  62385. /**
  62386. * Returns if the class is a cc-class or is fast-defined.
  62387. * @param constructor The constructor of the class.
  62388. * @returns Judge result.
  62389. * @engineInternal
  62390. */
  62391. export function _cocos_core_data_class__isCCClassOrFastDefined<T>(constructor: __types_globals__Constructor<T>): boolean;
  62392. export enum _cocos_core_data_utils_compact_value_type_array__StorageUnit {
  62393. Uint8 = 0,
  62394. Uint16 = 1,
  62395. Uint32 = 2,
  62396. Int8 = 3,
  62397. Int16 = 4,
  62398. Int32 = 5,
  62399. Float32 = 6,
  62400. Float64 = 7
  62401. }
  62402. export enum _cocos_core_data_utils_compact_value_type_array__ElementType {
  62403. Scalar = 0,
  62404. Vec2 = 1,
  62405. Vec3 = 2,
  62406. Vec4 = 3,
  62407. Quat = 4,
  62408. Mat4 = 5
  62409. }
  62410. /**
  62411. * @engineInternal
  62412. */
  62413. export type _cocos_core_data_custom_serializable__DeserializationContext = {
  62414. /**
  62415. * True if the deserialization procedure is deserializing from CCON.
  62416. */
  62417. fromCCON: boolean;
  62418. };
  62419. export class _cocos_core_event_event_target__Empty {
  62420. }
  62421. export type _cocos_core_event_eventify__Constructor<T> = new (...args: any[]) => T;
  62422. export type _pal_screen_adapter_enum_type_screen_event__PalScreenEvent = "window-resize" | "orientation-change" | "fullscreen-change";
  62423. export enum _pal_system_info_enum_type_feature__Feature {
  62424. /**
  62425. * @en Feature to support Webp.
  62426. * @zh 是否支持 Webp 特性。
  62427. */
  62428. WEBP = "WEBP",
  62429. /**
  62430. * @en Feature to support Image Bitmap.
  62431. * @zh 是否支持 Image Bitmap 特性。
  62432. */
  62433. IMAGE_BITMAP = "IMAGE_BITMAP",
  62434. /**
  62435. * @en Feature to support Web View.
  62436. * @zh 是否支持 Web View 特性。
  62437. */
  62438. WEB_VIEW = "WEB_VIEW",
  62439. /**
  62440. * @en Feature to support Video Player.
  62441. * @zh 是否支持 Video Player 特性。
  62442. */
  62443. VIDEO_PLAYER = "VIDEO_PLAYER",
  62444. /**
  62445. * @en Feature to support Safe Area.
  62446. * @zh 是否支持 Safe Area 特性。
  62447. */
  62448. SAFE_AREA = "SAFE_AREA",
  62449. /**
  62450. * @en Feature to support HPE (high performance emulator) platforms, such as Google Play Games For PC.
  62451. * @zh 是否支持 HPE 平台, 比如: Android 的 Google Play Games 在 PC 上的模拟器.
  62452. */
  62453. HPE = "HPE",
  62454. /**
  62455. * @en Feature to support Touch Input.
  62456. * Touch Input is only supported on some devices with touch screen.
  62457. * This feature tells that whether the device has a touch screen.
  62458. * @zh 是否支持触摸输入。
  62459. * 触摸输入只在一些带触摸屏的设备上支持。
  62460. * 这个特性旨在说明设备上是否带触摸屏。
  62461. */
  62462. INPUT_TOUCH = "INPUT_TOUCH",
  62463. /**
  62464. * @en Feature to support dispatching EventKeyboard.
  62465. * @zh 是否支持派发 EventKeyboard。
  62466. */
  62467. EVENT_KEYBOARD = "EVENT_KEYBOARD",
  62468. /**
  62469. * @en Feature to support dispatching EventMouse.
  62470. * @zh 是否支持派发 EventMouse。
  62471. */
  62472. EVENT_MOUSE = "EVENT_MOUSE",
  62473. /**
  62474. * @en Feature to support dispatching EventTouch.
  62475. * On some devices without touch screen, we still can simulate dispatching EventTouch from EventMouse.
  62476. * @zh 是否支持派发 EventTouch。
  62477. * 在一些不带触摸屏的设备上,我们仍然会从 EventMouse 模拟派发 EventTouch。
  62478. */
  62479. EVENT_TOUCH = "EVENT_TOUCH",
  62480. /**
  62481. * @en Feature to support dispatching EventAcceleration.
  62482. * @zh 是否支持派发 EventAcceleration。
  62483. */
  62484. EVENT_ACCELEROMETER = "EVENT_ACCELEROMETER",
  62485. /**
  62486. * @en Feature to support dispatching EventGamepad.
  62487. * @zh 是否支持派发 EventGamepad.
  62488. */
  62489. EVENT_GAMEPAD = "EVENT_GAMEPAD",
  62490. /**
  62491. * @en Feature to support dispatching EventHandle.
  62492. * @zh 是否支持派发 EventHandle
  62493. */
  62494. EVENT_HANDLE = "EVENT_HANDLE",
  62495. /**
  62496. * @en Feature to support dispatching EventHMD.
  62497. * @zh 是否支持派发 EventHMD
  62498. */
  62499. EVENT_HMD = "EVENT_HMD",
  62500. /**
  62501. * @en Feature to support dispatching EventHandheld.
  62502. * @zh 是否支持派发 EventHandheld
  62503. */
  62504. EVENT_HANDHELD = "EVENT_HANDHELD",
  62505. /**
  62506. * @en Check whether Webassembly is supported at runtime. Generally, it needs to be checked when the constant `NATIVE_CODE_BUNDLE_MODE` is 2.
  62507. * If it is not supported, you need to fallback to the Asm solution.
  62508. * @zh 运行时检测是否支持 Webassembly,一般在宏 `NATIVE_CODE_BUNDLE_MODE` 为 2 时需要检测,如果不支持,需要回滚到 Asm 方案
  62509. */
  62510. WASM = "WASM"
  62511. }
  62512. export enum _pal_system_info_enum_type_network_type__NetworkType {
  62513. /**
  62514. * @en Network is unreachable.
  62515. * @zh 网络不通
  62516. */
  62517. NONE = 0,
  62518. /**
  62519. * @en Network is reachable via WiFi or cable.
  62520. * @zh 通过无线或者有线本地网络连接因特网
  62521. */
  62522. LAN = 1,
  62523. /**
  62524. * @en Network is reachable via Wireless Wide Area Network
  62525. * @zh 通过蜂窝移动网络连接因特网
  62526. */
  62527. WWAN = 2
  62528. }
  62529. export enum _pal_system_info_enum_type_language__Language {
  62530. /**
  62531. * @en Unknown language code
  62532. * @zh 语言代码 - 未知
  62533. */
  62534. UNKNOWN = "unknown",
  62535. /**
  62536. * @en English language code
  62537. * @zh 语言代码 - 英语
  62538. */
  62539. ENGLISH = "en",
  62540. /**
  62541. * @en Chinese language code
  62542. * @zh 语言代码 - 中文
  62543. */
  62544. CHINESE = "zh",
  62545. /**
  62546. * @en French language code
  62547. * @zh 语言代码 - 法语
  62548. */
  62549. FRENCH = "fr",
  62550. /**
  62551. * @en Italian language code
  62552. * @zh 语言代码 - 意大利语
  62553. */
  62554. ITALIAN = "it",
  62555. /**
  62556. * @en German language code
  62557. * @zh 语言代码 - 德语
  62558. */
  62559. GERMAN = "de",
  62560. /**
  62561. * @en Spanish language code
  62562. * @zh 语言代码 - 西班牙语
  62563. */
  62564. SPANISH = "es",
  62565. /**
  62566. * @en Spanish language code
  62567. * @zh 语言代码 - 荷兰语
  62568. */
  62569. DUTCH = "du",
  62570. /**
  62571. * @en Russian language code
  62572. * @zh 语言代码 - 俄罗斯语
  62573. */
  62574. RUSSIAN = "ru",
  62575. /**
  62576. * @en Korean language code
  62577. * @zh 语言代码 - 韩语
  62578. */
  62579. KOREAN = "ko",
  62580. /**
  62581. * @en Japanese language code
  62582. * @zh 语言代码 - 日语
  62583. */
  62584. JAPANESE = "ja",
  62585. /**
  62586. * @en Hungarian language code
  62587. * @zh 语言代码 - 匈牙利语
  62588. */
  62589. HUNGARIAN = "hu",
  62590. /**
  62591. * @en Portuguese language code
  62592. * @zh 语言代码 - 葡萄牙语
  62593. */
  62594. PORTUGUESE = "pt",
  62595. /**
  62596. * @en Arabic language code
  62597. * @zh 语言代码 - 阿拉伯语
  62598. */
  62599. ARABIC = "ar",
  62600. /**
  62601. * @en Norwegian language code
  62602. * @zh 语言代码 - 挪威语
  62603. */
  62604. NORWEGIAN = "no",
  62605. /**
  62606. * @en Polish language code
  62607. * @zh 语言代码 - 波兰语
  62608. */
  62609. POLISH = "pl",
  62610. /**
  62611. * @en Turkish language code
  62612. * @zh 语言代码 - 土耳其语
  62613. */
  62614. TURKISH = "tr",
  62615. /**
  62616. * @en Ukrainian language code
  62617. * @zh 语言代码 - 乌克兰语
  62618. */
  62619. UKRAINIAN = "uk",
  62620. /**
  62621. * @en Romanian language code
  62622. * @zh 语言代码 - 罗马尼亚语
  62623. */
  62624. ROMANIAN = "ro",
  62625. /**
  62626. * @en Bulgarian language code
  62627. * @zh 语言代码 - 保加利亚语
  62628. */
  62629. BULGARIAN = "bg",
  62630. /**
  62631. * @en Hindi language code
  62632. * @zh 语言代码 - 印度语
  62633. */
  62634. HINDI = "hi"
  62635. }
  62636. export enum _pal_system_info_enum_type_operating_system__OS {
  62637. /**
  62638. * @en Operating System - Unknown
  62639. * @zh 操作系统 - 未知
  62640. */
  62641. UNKNOWN = "Unknown",
  62642. /**
  62643. * @en Operating System - iOS
  62644. * @zh 操作系统 - iOS
  62645. */
  62646. IOS = "iOS",
  62647. /**
  62648. * @en Operating System - Android
  62649. * @zh 操作系统 - 安卓
  62650. */
  62651. ANDROID = "Android",
  62652. /**
  62653. * @en Operating System - Windows
  62654. * @zh 操作系统 - Windows
  62655. */
  62656. WINDOWS = "Windows",
  62657. /**
  62658. * @en Operating System - Linux
  62659. * @zh 操作系统 - Linux
  62660. */
  62661. LINUX = "Linux",
  62662. /**
  62663. * @en Operating System - Mac OS X
  62664. * @zh 操作系统 - Mac OS X
  62665. */
  62666. OSX = "OS X",
  62667. /**
  62668. * @en Operating System - HarmonyOS
  62669. * @zh 操作系统 - 鸿蒙
  62670. */
  62671. OHOS = "OHOS",
  62672. /**
  62673. * @en Operating System - OpenHarmony
  62674. * @zh 操作系统 - OpenHarmony
  62675. */
  62676. OPENHARMONY = "OpenHarmony"
  62677. }
  62678. export enum _pal_system_info_enum_type_platform__Platform {
  62679. UNKNOWN = "UNKNOWN",
  62680. EDITOR_PAGE = "EDITOR_PAGE",
  62681. EDITOR_CORE = "EDITOR_CORE",
  62682. MOBILE_BROWSER = "MOBILE_BROWSER",
  62683. DESKTOP_BROWSER = "DESKTOP_BROWSER",
  62684. WIN32 = "WIN32",
  62685. ANDROID = "ANDROID",
  62686. IOS = "IOS",
  62687. MACOS = "MACOS",
  62688. OHOS = "OHOS",
  62689. OPENHARMONY = "OPENHARMONY",
  62690. WECHAT_GAME = "WECHAT_GAME",
  62691. WECHAT_MINI_PROGRAM = "WECHAT_MINI_PROGRAM",
  62692. BAIDU_MINI_GAME = "BAIDU_MINI_GAME",
  62693. XIAOMI_QUICK_GAME = "XIAOMI_QUICK_GAME",
  62694. ALIPAY_MINI_GAME = "ALIPAY_MINI_GAME",
  62695. TAOBAO_CREATIVE_APP = "TAOBAO_CREATIVE_APP",
  62696. TAOBAO_MINI_GAME = "TAOBAO_MINI_GAME",
  62697. BYTEDANCE_MINI_GAME = "BYTEDANCE_MINI_GAME",
  62698. OPPO_MINI_GAME = "OPPO_MINI_GAME",
  62699. VIVO_MINI_GAME = "VIVO_MINI_GAME",
  62700. HUAWEI_QUICK_GAME = "HUAWEI_QUICK_GAME",
  62701. COCOSPLAY = "COCOSPLAY",
  62702. LINKSURE_MINI_GAME = "LINKSURE_MINI_GAME",
  62703. QTT_MINI_GAME = "QTT_MINI_GAME"
  62704. }
  62705. export enum _pal_system_info_enum_type_browser_type__BrowserType {
  62706. /**
  62707. * @en Browser Type - Unknown
  62708. * @zh 浏览器类型 - 未知
  62709. */
  62710. UNKNOWN = "unknown",
  62711. /**
  62712. * @en Browser Type - WeChat inner browser
  62713. * @zh 浏览器类型 - 微信内置浏览器
  62714. */
  62715. WECHAT = "wechat",
  62716. /**
  62717. * @en Browser Type - Android Browser
  62718. * @zh 浏览器类型 - 安卓浏览器
  62719. */
  62720. ANDROID = "androidbrowser",
  62721. /**
  62722. * @en Browser Type - Internet Explorer
  62723. * @zh 浏览器类型 - 微软 IE
  62724. */
  62725. IE = "ie",
  62726. /**
  62727. * @en Browser Type - Microsoft Edge
  62728. * @zh 浏览器类型 - 微软 Edge
  62729. */
  62730. EDGE = "edge",
  62731. /**
  62732. * @en Browser Type - QQ Browser
  62733. * @zh 浏览器类型 - QQ 浏览器
  62734. */
  62735. QQ = "qqbrowser",
  62736. /**
  62737. * @en Browser Type - Mobile QQ Browser
  62738. * @zh 浏览器类型 - 手机 QQ 浏览器
  62739. */
  62740. MOBILE_QQ = "mqqbrowser",
  62741. /**
  62742. * @en Browser Type - UC Browser
  62743. * @zh 浏览器类型 - UC 浏览器
  62744. */
  62745. UC = "ucbrowser",
  62746. /**
  62747. * @en Browser Type - Third party integrated UC browser
  62748. * @zh 浏览器类型 - 第三方应用中集成的 UC 浏览器
  62749. */
  62750. UCBS = "ucbs",
  62751. /**
  62752. * @en Browser Type - 360 Browser
  62753. * @zh 浏览器类型 - 360 浏览器
  62754. */
  62755. BROWSER_360 = "360browser",
  62756. /**
  62757. * @en Browser Type - Baidu Box App
  62758. * @zh 浏览器类型 - Baidu Box App
  62759. */
  62760. BAIDU_APP = "baiduboxapp",
  62761. /**
  62762. * @en Browser Type - Baidu Browser
  62763. * @zh 浏览器类型 - 百度浏览器
  62764. */
  62765. BAIDU = "baidubrowser",
  62766. /**
  62767. * @en Browser Type - Maxthon Browser
  62768. * @zh 浏览器类型 - 傲游浏览器
  62769. */
  62770. MAXTHON = "maxthon",
  62771. /**
  62772. * @en Browser Type - Opera Browser
  62773. * @zh 浏览器类型 - Opera 浏览器
  62774. */
  62775. OPERA = "opera",
  62776. /**
  62777. * @en Browser Type - Oupeng Browser
  62778. * @zh 浏览器类型 - 欧朋浏览器
  62779. */
  62780. OUPENG = "oupeng",
  62781. /**
  62782. * @en Browser Type - MI UI Browser
  62783. * @zh 浏览器类型 - MIUI 内置浏览器
  62784. */
  62785. MIUI = "miuibrowser",
  62786. /**
  62787. * @en Browser Type - Firefox Browser
  62788. * @zh 浏览器类型 - Firefox 浏览器
  62789. */
  62790. FIREFOX = "firefox",
  62791. /**
  62792. * @en Browser Type - Safari Browser
  62793. * @zh 浏览器类型 - Safari 浏览器
  62794. */
  62795. SAFARI = "safari",
  62796. /**
  62797. * @en Browser Type - Chrome Browser
  62798. * @zh 浏览器类型 - Chrome 浏览器
  62799. */
  62800. CHROME = "chrome",
  62801. /**
  62802. * @en Browser Type - Cheetah Browser
  62803. * @zh 浏览器类型 - 猎豹浏览器
  62804. */
  62805. LIEBAO = "liebao",
  62806. /**
  62807. * @en Browser Type - QZone Inner Browser
  62808. * @zh 浏览器类型 - QZone 内置浏览器
  62809. */
  62810. QZONE = "qzone",
  62811. /**
  62812. * @en Browser Type - Sogou Browser
  62813. * @zh 浏览器类型 - 搜狗浏览器
  62814. */
  62815. SOUGOU = "sogou",
  62816. /**
  62817. * @en Browser Type - Huawei Browser
  62818. * @zh 浏览器类型 - 华为浏览器
  62819. */
  62820. HUAWEI = "huawei"
  62821. }
  62822. export type _cocos_core_scheduler__CallbackType = (dt?: number) => void;
  62823. /**
  62824. * Alias of `Function` but suppress eslint warning.
  62825. * Please avoid using it and explicitly specify function signatures as possible.
  62826. */
  62827. // eslint-disable-next-line @typescript-eslint/ban-types
  62828. export type __types_globals__AnyFunction = Function;
  62829. /**
  62830. * @en
  62831. * The parameter describing a real keyframe value.
  62832. * In the case of partial keyframe value,
  62833. * each component of the keyframe value is taken from the parameter.
  62834. * For unspecified components, default values are taken:
  62835. * - Interpolation mode: `InterpolationMode.Linear`
  62836. * - Tangent weight mode: `TangentWeightMode.None`
  62837. * - Value/Tangents/Tangent weights: `0.0`
  62838. * @zh
  62839. * 用于描述实数关键帧值的参数。
  62840. * 若是部分关键帧的形式,关键帧值的每个分量都是从该参数中取得。
  62841. * 对于未指定的分量,使用默认值:
  62842. * - 插值模式:`InterpolationMode.Linear`
  62843. * - 切线权重模式:`TangentWeightMode.None`
  62844. * - 值/切线/切线权重:`0.0`
  62845. */
  62846. export type _cocos_core_curves_curve__RealKeyframeValueParameters = number | Partial<RealKeyframeValue>;
  62847. export type _cocos_core_curves_keyframe_curve__KeyFrame<TKeyframeValue> = [
  62848. number,
  62849. TKeyframeValue
  62850. ];
  62851. export interface _cocos_core_curves_curve_base__CurveBase {
  62852. readonly rangeMin: number;
  62853. readonly rangeMax: number;
  62854. }
  62855. /**
  62856. * @en
  62857. * Keyframe curve.
  62858. * @zh
  62859. * 关键帧曲线。
  62860. */
  62861. export class _cocos_core_curves_keyframe_curve__KeyframeCurve<TKeyframeValue> implements _cocos_core_curves_curve_base__CurveBase, Iterable<_cocos_core_curves_keyframe_curve__KeyFrame<TKeyframeValue>> {
  62862. /**
  62863. * @en
  62864. * Gets the count of keyframes.
  62865. * @zh
  62866. * 获取关键帧数量。
  62867. */
  62868. get keyFramesCount(): number;
  62869. /**
  62870. * @en
  62871. * Gets the minimal keyframe time on this curve.
  62872. * @zh
  62873. * 获取此曲线上最小的关键帧时间。
  62874. */
  62875. get rangeMin(): number;
  62876. /**
  62877. * @en
  62878. * Gets the maximum keyframe time on this curve.
  62879. * @zh
  62880. * 获取此曲线上最大的关键帧时间。
  62881. */
  62882. get rangeMax(): number;
  62883. /**
  62884. * @en
  62885. * Returns an iterator to keyframe pairs.
  62886. * @zh
  62887. * 返回关键帧对的迭代器。
  62888. */
  62889. [Symbol.iterator](): {
  62890. next: () => IteratorResult<_cocos_core_curves_keyframe_curve__KeyFrame<TKeyframeValue>>;
  62891. };
  62892. /**
  62893. * @en
  62894. * Returns an iterator to keyframe pairs.
  62895. * @zh
  62896. * 返回关键帧对的迭代器。
  62897. */
  62898. keyframes(): Iterable<_cocos_core_curves_keyframe_curve__KeyFrame<TKeyframeValue>>;
  62899. /**
  62900. * @en
  62901. * Returns an iterator to keyframe times.
  62902. * @zh
  62903. * 返回关键帧时间的迭代器。
  62904. */
  62905. times(): Iterable<number>;
  62906. /**
  62907. * @en
  62908. * Returns an iterator to keyframe values.
  62909. * @zh
  62910. * 返回关键帧值的迭代器。
  62911. */
  62912. values(): Iterable<TKeyframeValue>;
  62913. /**
  62914. * @en
  62915. * Gets the time of specified keyframe.
  62916. * @zh
  62917. * 获取指定关键帧上的时间。
  62918. * @param index Index to the keyframe.
  62919. * @returns The keyframe 's time.
  62920. */
  62921. getKeyframeTime(index: number): number;
  62922. /**
  62923. * @en
  62924. * Gets the value of specified keyframe.
  62925. * @zh
  62926. * 获取指定关键帧上的值。
  62927. * @param index Index to the keyframe.
  62928. * @returns The keyframe 's value.
  62929. */
  62930. getKeyframeValue(index: number): TKeyframeValue;
  62931. /**
  62932. * @en
  62933. * Adds a keyframe into this curve.
  62934. * @zh
  62935. * 添加一个关键帧到此曲线中。
  62936. * @param time Time of the keyframe.
  62937. * @param keyframeValue Value of the keyframe.
  62938. * @returns The index to the new keyframe.
  62939. */
  62940. addKeyFrame(time: number, keyframeValue: TKeyframeValue): number;
  62941. /**
  62942. * @en
  62943. * Removes a keyframe from this curve.
  62944. * @zh
  62945. * 移除此曲线的一个关键帧。
  62946. * @param index Index to the keyframe.
  62947. */
  62948. removeKeyframe(index: number): void;
  62949. /**
  62950. * @en
  62951. * Searches for the keyframe at specified time.
  62952. * @zh
  62953. * 搜索指定时间上的关键帧。
  62954. * @param time Time to search.
  62955. * @returns Index to the keyframe or negative number if not found.
  62956. */
  62957. indexOfKeyframe(time: number): number;
  62958. /**
  62959. * @en
  62960. * Updates the time of a keyframe.
  62961. * @zh
  62962. * 更新关键帧的时间。
  62963. * @param index Index to the keyframe.
  62964. * @param time New time.
  62965. */
  62966. updateTime(index: number, time: number): void;
  62967. /**
  62968. * @en
  62969. * Assigns all keyframes.
  62970. * @zh
  62971. * 赋值所有关键帧。
  62972. * @param keyframes An iterable to keyframes. The keyframes should be sorted by their time.
  62973. */
  62974. assignSorted(keyframes: Iterable<[
  62975. number,
  62976. TKeyframeValue
  62977. ]>): void;
  62978. /**
  62979. * @en
  62980. * Assigns all keyframes.
  62981. * @zh
  62982. * 赋值所有关键帧。
  62983. * @param times Times array. Should be sorted.
  62984. * @param values Values array. Corresponding to each time in `times`.
  62985. */
  62986. assignSorted(times: readonly number[], values: TKeyframeValue[]): void;
  62987. /**
  62988. * @en
  62989. * Removes all key frames.
  62990. * @zh
  62991. * 移除所有关键帧。
  62992. */
  62993. clear(): void;
  62994. protected searchKeyframe(time: number): number;
  62995. protected setKeyframes(times: number[], values: TKeyframeValue[]): void;
  62996. protected _times: number[];
  62997. protected _values: TKeyframeValue[];
  62998. }
  62999. /**
  63000. * @engineInternal
  63001. */
  63002. export enum _cocos_core_curves_easing_method__EasingMethod {
  63003. LINEAR = 0,
  63004. CONSTANT = 1,
  63005. QUAD_IN = 2,
  63006. QUAD_OUT = 3,
  63007. QUAD_IN_OUT = 4,
  63008. QUAD_OUT_IN = 5,
  63009. CUBIC_IN = 6,
  63010. CUBIC_OUT = 7,
  63011. CUBIC_IN_OUT = 8,
  63012. CUBIC_OUT_IN = 9,
  63013. QUART_IN = 10,
  63014. QUART_OUT = 11,
  63015. QUART_IN_OUT = 12,
  63016. QUART_OUT_IN = 13,
  63017. QUINT_IN = 14,
  63018. QUINT_OUT = 15,
  63019. QUINT_IN_OUT = 16,
  63020. QUINT_OUT_IN = 17,
  63021. SINE_IN = 18,
  63022. SINE_OUT = 19,
  63023. SINE_IN_OUT = 20,
  63024. SINE_OUT_IN = 21,
  63025. EXPO_IN = 22,
  63026. EXPO_OUT = 23,
  63027. EXPO_IN_OUT = 24,
  63028. EXPO_OUT_IN = 25,
  63029. CIRC_IN = 26,
  63030. CIRC_OUT = 27,
  63031. CIRC_IN_OUT = 28,
  63032. CIRC_OUT_IN = 29,
  63033. ELASTIC_IN = 30,
  63034. ELASTIC_OUT = 31,
  63035. ELASTIC_IN_OUT = 32,
  63036. ELASTIC_OUT_IN = 33,
  63037. BACK_IN = 34,
  63038. BACK_OUT = 35,
  63039. BACK_IN_OUT = 36,
  63040. BACK_OUT_IN = 37,
  63041. BOUNCE_IN = 38,
  63042. BOUNCE_OUT = 39,
  63043. BOUNCE_IN_OUT = 40,
  63044. BOUNCE_OUT_IN = 41,
  63045. SMOOTH = 42,
  63046. FADE = 43
  63047. }
  63048. /**
  63049. * The parameter describing a real keyframe value.
  63050. * In the case of partial keyframe value,
  63051. * each component of the keyframe value is taken from the parameter.
  63052. * For unspecified components, default values are taken:
  63053. * - Interpolation mode: slerp
  63054. * - Value: Identity quaternion
  63055. * @zh
  63056. * 用于描述实数关键帧值的参数。
  63057. * 若是部分关键帧的形式,关键帧值的每个分量都是从该参数中取得。
  63058. * 对于未指定的分量,使用默认值:
  63059. * - 插值模式:球面线性插值
  63060. * - 值:单位四元数
  63061. */
  63062. export type _cocos_core_curves_quat_curve__QuatKeyframeValueParameters = Partial<QuatKeyframeValue>;
  63063. /**
  63064. * @zh
  63065. * Settings 中的默认分组,通常与模块一一对应。
  63066. *
  63067. * @en
  63068. * The default grouping in Settings, which usually corresponds to the module.
  63069. */
  63070. export enum _cocos_core_settings__Category {
  63071. PATH = "path",
  63072. ENGINE = "engine",
  63073. ASSETS = "assets",
  63074. SCRIPTING = "scripting",
  63075. PHYSICS = "physics",
  63076. RENDERING = "rendering",
  63077. LAUNCH = "launch",
  63078. SCREEN = "screen",
  63079. SPLASH_SCREEN = "splashScreen",
  63080. ANIMATION = "animation",
  63081. PROFILING = "profiling",
  63082. PLUGINS = "plugins",
  63083. XR = "xr"
  63084. }
  63085. export type _cocos_core_value_types_enum__EnumType = Record<string, string | number>;
  63086. export class _cocos_rendering_render_pipeline__BloomRenderData {
  63087. renderPass: gfx.RenderPass;
  63088. sampler: gfx.Sampler;
  63089. prefiterTex: gfx.Texture;
  63090. downsampleTexs: gfx.Texture[];
  63091. upsampleTexs: gfx.Texture[];
  63092. combineTex: gfx.Texture;
  63093. prefilterFramebuffer: gfx.Framebuffer;
  63094. downsampleFramebuffers: gfx.Framebuffer[];
  63095. upsampleFramebuffers: gfx.Framebuffer[];
  63096. combineFramebuffer: gfx.Framebuffer;
  63097. }
  63098. export class _cocos_rendering_render_pipeline__PipelineRenderData {
  63099. outputFrameBuffer: gfx.Framebuffer;
  63100. outputRenderTargets: gfx.Texture[];
  63101. outputDepth: gfx.Texture;
  63102. sampler: gfx.Sampler;
  63103. bloom: _cocos_rendering_render_pipeline__BloomRenderData | null;
  63104. }
  63105. export class _cocos_rendering_pipeline_ubo__PipelineUBO {
  63106. static updateGlobalUBOView(window: _cocos_render_scene_core_render_window__RenderWindow, bufferView: Float32Array): void;
  63107. static updateCameraUBOView(pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime, bufferView: Float32Array, camera: renderer.scene.Camera): void;
  63108. static getPCFRadius(shadowInfo: renderer.scene.Shadows, mainLight: renderer.scene.DirectionalLight): number;
  63109. static updatePlanarNormalAndDistance(shadowInfo: renderer.scene.Shadows, shadowUBO: Float32Array): void;
  63110. static updateShadowUBOView(pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime, shadowBufferView: Float32Array, csmBufferView: Float32Array, camera: renderer.scene.Camera): void;
  63111. static updateShadowUBOLightView(pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime, shadowBufferView: Float32Array, light: renderer.scene.Light, level: number): void;
  63112. protected _globalUBO: Float32Array;
  63113. protected _cameraUBO: Float32Array;
  63114. protected _shadowUBO: Float32Array;
  63115. protected _csmUBO: Float32Array;
  63116. static _combineSignY: number;
  63117. protected _device: gfx.Device;
  63118. protected _pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime;
  63119. /**
  63120. *|combinedSignY|clipSpaceSignY|screenSpaceSignY| Backends |
  63121. *| :--: | :--: | :--: | :--: |
  63122. *| 0 | -1 | -1 | Vulkan |
  63123. *| 1 | 1 | -1 | Metal |
  63124. *| 2 | -1 | 1 | |
  63125. *| 3 | 1 | 1 | GL-like |
  63126. */
  63127. static getCombineSignY(): number;
  63128. activate(device: gfx.Device, pipeline: _cocos_rendering_custom_pipeline__PipelineRuntime): void;
  63129. /**
  63130. * @en Update all UBOs
  63131. * @zh 更新全部 UBO。
  63132. */
  63133. updateGlobalUBO(window: _cocos_render_scene_core_render_window__RenderWindow): void;
  63134. updateCameraUBO(camera: renderer.scene.Camera): void;
  63135. updateShadowUBO(camera: renderer.scene.Camera): void;
  63136. updateShadowUBOLight(globalDS: gfx.DescriptorSet, light: renderer.scene.Light, level?: number): void;
  63137. updateShadowUBORange(offset: number, data: math.Mat4 | math.Color): void;
  63138. destroy(): void;
  63139. }
  63140. /**
  63141. * @en Render pipeline information descriptor
  63142. * @zh 渲染管线描述信息。
  63143. */
  63144. export interface _cocos_rendering_render_pipeline__IRenderPipelineInfo {
  63145. flows: RenderFlow[];
  63146. tag?: number;
  63147. }
  63148. export class _cocos_rendering_render_pipeline__PipelineInputAssemblerData {
  63149. quadIB: gfx.Buffer | null;
  63150. quadVB: gfx.Buffer | null;
  63151. quadIA: gfx.InputAssembler | null;
  63152. }
  63153. /**
  63154. * @en Render flow information descriptor
  63155. * @zh 渲染流程描述信息。
  63156. */
  63157. export interface _cocos_rendering_render_flow__IRenderFlowInfo {
  63158. name: string;
  63159. priority: number;
  63160. stages: RenderStage[];
  63161. tag?: number;
  63162. }
  63163. export enum _cocos_rendering_pipeline_serialization__RenderQueueSortMode {
  63164. FRONT_TO_BACK = 0,
  63165. BACK_TO_FRONT = 1
  63166. }
  63167. /**
  63168. * @en The render queue descriptor
  63169. * @zh 渲染队列描述信息
  63170. */
  63171. export class _cocos_rendering_pipeline_serialization__RenderQueueDesc {
  63172. /**
  63173. * @en Whether the render queue is a transparent queue
  63174. * @zh 当前队列是否是半透明队列
  63175. */
  63176. isTransparent: boolean;
  63177. /**
  63178. * @en The sort mode of the render queue
  63179. * @zh 渲染队列的排序模式
  63180. */
  63181. sortMode: _cocos_rendering_pipeline_serialization__RenderQueueSortMode;
  63182. /**
  63183. * @en The stages using this queue
  63184. * @zh 使用当前渲染队列的阶段列表
  63185. */
  63186. stages: string[];
  63187. }
  63188. /**
  63189. * @en The render stage information descriptor
  63190. * @zh 渲染阶段描述信息。
  63191. */
  63192. export interface _cocos_rendering_render_stage__IRenderStageInfo {
  63193. name: string;
  63194. priority: number;
  63195. tag?: number;
  63196. renderQueues?: _cocos_rendering_pipeline_serialization__RenderQueueDesc[];
  63197. }
  63198. export class _cocos_rendering_shadow_csm_layers__ShadowLayerVolume {
  63199. protected _shadowObjects: pipeline.IRenderObject[];
  63200. protected _shadowCameraFar: number;
  63201. protected _level: number;
  63202. protected _matShadowView: math.Mat4;
  63203. protected _matShadowProj: math.Mat4;
  63204. protected _matShadowViewProj: math.Mat4;
  63205. protected _validFrustum: geometry.Frustum;
  63206. protected _splitFrustum: geometry.Frustum;
  63207. protected _lightViewFrustum: geometry.Frustum;
  63208. protected _castLightViewBoundingBox: geometry.AABB;
  63209. constructor(level: number);
  63210. get level(): number;
  63211. get shadowObjects(): pipeline.IRenderObject[];
  63212. get shadowCameraFar(): number;
  63213. set shadowCameraFar(val: number);
  63214. get matShadowView(): math.Mat4;
  63215. set matShadowView(val: math.Mat4);
  63216. get matShadowProj(): math.Mat4;
  63217. set matShadowProj(val: math.Mat4);
  63218. get matShadowViewProj(): math.Mat4;
  63219. set matShadowViewProj(val: math.Mat4);
  63220. get validFrustum(): Readonly<geometry.Frustum>;
  63221. get splitFrustum(): Readonly<geometry.Frustum>;
  63222. get lightViewFrustum(): Readonly<geometry.Frustum>;
  63223. get castLightViewBoundingBox(): Readonly<geometry.AABB>;
  63224. copyToValidFrustum(validFrustum: Readonly<geometry.Frustum>): void;
  63225. calculateValidFrustumOrtho(width: number, height: number, near: number, far: number, transform: math.Mat4): void;
  63226. calculateSplitFrustum(camera: renderer.scene.Camera, m: math.Mat4, start: number, end: number): void;
  63227. destroy(): void;
  63228. createMatrix(dirLight: renderer.scene.DirectionalLight, shadowMapWidth: number, onlyForCulling: boolean): void;
  63229. }
  63230. export class _cocos_rendering_shadow_csm_layers__CSMShadowLayer extends _cocos_rendering_shadow_csm_layers__ShadowLayerVolume {
  63231. protected _splitCameraNear: number;
  63232. protected _splitCameraFar: number;
  63233. protected _csmAtlas: math.Vec4;
  63234. constructor(level: number);
  63235. get splitCameraNear(): number;
  63236. set splitCameraNear(val: number);
  63237. get splitCameraFar(): number;
  63238. set splitCameraFar(val: number);
  63239. get csmAtlas(): math.Vec4;
  63240. set csmAtlas(val: math.Vec4);
  63241. destroy(): void;
  63242. }
  63243. /**
  63244. * @en Shadow CSM layer manager
  63245. * @zh CSM阴影图层管理
  63246. */
  63247. export class _cocos_rendering_shadow_csm_layers__CSMLayers {
  63248. protected _castShadowObjects: pipeline.IRenderObject[];
  63249. protected _layerObjects: memop.CachedArray<pipeline.IRenderObject>;
  63250. protected _layers: _cocos_rendering_shadow_csm_layers__CSMShadowLayer[];
  63251. protected _levelCount: number;
  63252. protected _specialLayer: _cocos_rendering_shadow_csm_layers__ShadowLayerVolume;
  63253. protected _shadowDistance: number;
  63254. get castShadowObjects(): pipeline.IRenderObject[];
  63255. get layerObjects(): memop.CachedArray<pipeline.IRenderObject>;
  63256. get layers(): _cocos_rendering_shadow_csm_layers__CSMShadowLayer[];
  63257. get specialLayer(): _cocos_rendering_shadow_csm_layers__ShadowLayerVolume;
  63258. constructor();
  63259. update(sceneData: PipelineSceneData, camera: renderer.scene.Camera): void;
  63260. destroy(): void;
  63261. }
  63262. export class _cocos_rendering_pipeline_serialization__RenderTextureConfig {
  63263. name: string;
  63264. texture: RenderTexture | null;
  63265. }
  63266. /**
  63267. * @en The render queue. It manages a GFX [[RenderPass]] queue which will be executed by the [[RenderStage]].
  63268. * @zh 渲染队列。它管理一个 GFX [[RenderPass]] 队列,队列中的渲染过程会被 [[RenderStage]] 所执行。
  63269. */
  63270. export class _cocos_rendering_render_queue__RenderQueue {
  63271. /**
  63272. * @en A cached array of render passes
  63273. * @zh 基于缓存数组的渲染过程队列。
  63274. */
  63275. queue: memop.CachedArray<pipeline.IRenderPass>;
  63276. /**
  63277. * @en Construct a RenderQueue with render queue descriptor
  63278. * @zh 利用渲染队列描述来构造一个 RenderQueue。
  63279. * @param desc Render queue descriptor
  63280. */
  63281. constructor(desc: pipeline.IRenderQueueDesc);
  63282. /**
  63283. * @en Clear the render queue
  63284. * @zh 清空渲染队列。
  63285. */
  63286. clear(): void;
  63287. /**
  63288. * @en Insert a render pass into the queue
  63289. * @zh 插入渲染过程。
  63290. * @param renderObj The render object of the pass
  63291. * @param modelIdx The model id
  63292. * @param passIdx The pass id
  63293. * @returns Whether the new render pass is successfully added
  63294. */
  63295. insertRenderPass(renderObj: pipeline.IRenderObject, subModelIdx: number, passIdx: number): boolean;
  63296. /**
  63297. * @en Sort the current queue
  63298. * @zh 排序渲染队列。
  63299. */
  63300. sort(): void;
  63301. recordCommandBuffer(device: gfx.Device, renderPass: gfx.RenderPass, cmdBuff: gfx.CommandBuffer): void;
  63302. }
  63303. /**
  63304. * @en Render queue for instanced batching
  63305. * @zh 渲染合批队列。
  63306. */
  63307. export class _cocos_rendering_render_instanced_queue__RenderInstancedQueue {
  63308. /**
  63309. * @en A set of instanced buffer
  63310. * @zh Instance 合批缓存集合。
  63311. */
  63312. queue: Set<InstancedBuffer>;
  63313. /**
  63314. * @en Clear the render queue
  63315. * @zh 清空渲染队列。
  63316. */
  63317. clear(): void;
  63318. sort(): void;
  63319. uploadBuffers(cmdBuff: gfx.CommandBuffer): void;
  63320. /**
  63321. * @en Record command buffer for the current queue
  63322. * @zh 记录命令缓冲。
  63323. * @param cmdBuff The command buffer to store the result
  63324. */
  63325. recordCommandBuffer(device: gfx.Device, renderPass: gfx.RenderPass, cmdBuff: gfx.CommandBuffer, descriptorSet?: gfx.DescriptorSet | null, dynamicOffsets?: Readonly<number[]>): void;
  63326. }
  63327. export class _cocos_rendering_deferred_deferred_pipeline__DeferredRenderData extends _cocos_rendering_render_pipeline__PipelineRenderData {
  63328. gbufferFrameBuffer: gfx.Framebuffer;
  63329. gbufferRenderTargets: gfx.Texture[];
  63330. }
  63331. export interface _cocos_rendering_instanced_buffer__IInstancedItem {
  63332. count: number;
  63333. capacity: number;
  63334. vb: gfx.Buffer;
  63335. data: Uint8Array;
  63336. ia: gfx.InputAssembler;
  63337. stride: number;
  63338. shader: gfx.Shader | null;
  63339. descriptorSet: gfx.DescriptorSet;
  63340. lightingMap: gfx.Texture;
  63341. reflectionProbeCubemap: gfx.Texture;
  63342. reflectionProbePlanarMap: gfx.Texture;
  63343. useReflectionProbeType: number;
  63344. reflectionProbeBlendCubemap: gfx.Texture;
  63345. }
  63346. /**
  63347. * @zh
  63348. * 渲染单项调试模式
  63349. * @en
  63350. * Rendering single debug mode
  63351. * @readonly
  63352. */
  63353. export const enum _cocos_rendering_debug_view__DebugViewSingleType {
  63354. NONE = 0,
  63355. VERTEX_COLOR = 1,
  63356. VERTEX_NORMAL = 2,
  63357. VERTEX_TANGENT = 3,
  63358. WORLD_POS = 4,
  63359. VERTEX_MIRROR = 5,
  63360. FACE_SIDE = 6,
  63361. UV0 = 7,
  63362. UV1 = 8,
  63363. UV_LIGHTMAP = 9,
  63364. PROJ_DEPTH = 10,
  63365. LINEAR_DEPTH = 11,
  63366. FRAGMENT_NORMAL = 12,
  63367. FRAGMENT_TANGENT = 13,
  63368. FRAGMENT_BINORMAL = 14,
  63369. BASE_COLOR = 15,
  63370. DIFFUSE_COLOR = 16,
  63371. SPECULAR_COLOR = 17,
  63372. TRANSPARENCY = 18,
  63373. METALLIC = 19,
  63374. ROUGHNESS = 20,
  63375. SPECULAR_INTENSITY = 21,
  63376. IOR = 22,
  63377. DIRECT_DIFFUSE = 23,
  63378. DIRECT_SPECULAR = 24,
  63379. DIRECT_ALL = 25,
  63380. ENV_DIFFUSE = 26,
  63381. ENV_SPECULAR = 27,
  63382. ENV_ALL = 28,
  63383. EMISSIVE = 29,
  63384. LIGHT_MAP = 30,
  63385. SHADOW = 31,
  63386. AO = 32,
  63387. FRESNEL = 33,
  63388. DIRECT_TRANSMIT_DIFFUSE = 34,
  63389. DIRECT_TRANSMIT_SPECULAR = 35,
  63390. ENV_TRANSMIT_DIFFUSE = 36,
  63391. ENV_TRANSMIT_SPECULAR = 37,
  63392. TRANSMIT_ALL = 38,
  63393. DIRECT_TRT = 39,
  63394. ENV_TRT = 40,
  63395. TRT_ALL = 41,
  63396. FOG = 42
  63397. }
  63398. export const enum _cocos_rendering_debug_view__RenderingDebugViewType {
  63399. NONE = 0,
  63400. SINGLE = 1,
  63401. COMPOSITE_AND_MISC = 2
  63402. }
  63403. /**
  63404. * @zh
  63405. * 渲染组合调试模式
  63406. * @en
  63407. * Rendering composite debug mode
  63408. * @readonly
  63409. */
  63410. export const enum _cocos_rendering_debug_view__DebugViewCompositeType {
  63411. DIRECT_DIFFUSE = 0,
  63412. DIRECT_SPECULAR = 1,
  63413. ENV_DIFFUSE = 2,
  63414. ENV_SPECULAR = 3,
  63415. EMISSIVE = 4,
  63416. LIGHT_MAP = 5,
  63417. SHADOW = 6,
  63418. AO = 7,
  63419. NORMAL_MAP = 8,
  63420. FOG = 9,
  63421. TONE_MAPPING = 10,
  63422. GAMMA_CORRECTION = 11,
  63423. FRESNEL = 12,
  63424. TRANSMIT_DIFFUSE = 13,
  63425. TRANSMIT_SPECULAR = 14,
  63426. TRT = 15,
  63427. TT = 16,
  63428. MAX_BIT_COUNT = 17
  63429. }
  63430. export enum _cocos_scene_graph_node_event_processor__DispatcherEventType {
  63431. ADD_POINTER_EVENT_PROCESSOR = 0,
  63432. REMOVE_POINTER_EVENT_PROCESSOR = 1,
  63433. MARK_LIST_DIRTY = 2
  63434. }
  63435. /// <reference types="./@types/globals" />
  63436. export class _cocos_core_event_callbacks_invoker__CallbackInfo {
  63437. callback: __types_globals__AnyFunction;
  63438. target: unknown | undefined;
  63439. once: boolean;
  63440. set(callback: __types_globals__AnyFunction, target?: unknown, once?: boolean): void;
  63441. reset(): void;
  63442. check(): boolean;
  63443. }
  63444. /**
  63445. * @zh 事件监听器列表的简单封装。
  63446. * @en A simple list of event callbacks
  63447. */
  63448. export class _cocos_core_event_callbacks_invoker__CallbackList {
  63449. callbackInfos: Array<_cocos_core_event_callbacks_invoker__CallbackInfo | null>;
  63450. isInvoking: boolean;
  63451. containCanceled: boolean;
  63452. /**
  63453. * @zh 从列表中移除与指定目标相同回调函数的事件。
  63454. * @en Remove the event listeners with the given callback from the list
  63455. *
  63456. * @param cb - The callback to be removed
  63457. */
  63458. removeByCallback(cb: __types_globals__AnyFunction): void;
  63459. /**
  63460. * @zh 从列表中移除与指定目标相同调用者的事件。
  63461. * @en Remove the event listeners with the given target from the list
  63462. * @param target
  63463. */
  63464. removeByTarget(target: unknown): void;
  63465. /**
  63466. * @zh 移除指定编号事件。
  63467. * @en Remove the event listener at the given index
  63468. * @param index
  63469. */
  63470. cancel(index: number): void;
  63471. /**
  63472. * @zh 注销所有事件。
  63473. * @en Cancel all event listeners
  63474. */
  63475. cancelAll(): void;
  63476. /**
  63477. * @zh 立即删除所有取消的回调。(在移除过程中会更加紧凑的排列数组)
  63478. * @en Delete all canceled callbacks and compact array
  63479. */
  63480. purgeCanceled(): void;
  63481. /**
  63482. * @zh 清除并重置所有数据。
  63483. * @en Clear all data
  63484. */
  63485. clear(): void;
  63486. }
  63487. export interface _cocos_core_event_callbacks_invoker__ICallbackTable {
  63488. [x: string]: _cocos_core_event_callbacks_invoker__CallbackList | undefined;
  63489. }
  63490. export type _cocos_core_event_callbacks_invoker__EventType = string | number;
  63491. /**
  63492. * @zh CallbacksInvoker 用来根据事件名(Key)管理事件监听器列表并调用回调方法。
  63493. * @en CallbacksInvoker is used to manager and invoke event listeners with different event keys,
  63494. * each key is mapped to a CallbackList.
  63495. * @engineInternal
  63496. */
  63497. export class _cocos_core_event_callbacks_invoker__CallbacksInvoker<EventTypeClass extends _cocos_core_event_callbacks_invoker__EventType = _cocos_core_event_callbacks_invoker__EventType> {
  63498. /**
  63499. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  63500. */
  63501. _callbackTable: _cocos_core_event_callbacks_invoker__ICallbackTable;
  63502. /**
  63503. * @zh 向一个事件名注册一个新的事件监听器,包含回调函数和调用者
  63504. * @en Register an event listener to a given event key with callback and target.
  63505. *
  63506. * @param key - Event type
  63507. * @param callback - Callback function when event triggered
  63508. * @param target - Callback callee
  63509. * @param once - Whether invoke the callback only once (and remove it)
  63510. */
  63511. on(key: EventTypeClass, callback: __types_globals__AnyFunction, target?: unknown, once?: boolean): __types_globals__AnyFunction;
  63512. /**
  63513. * @zh 检查指定事件是否已注册回调。
  63514. * @en Checks whether there is correspond event listener registered on the given event
  63515. * @param key - Event type
  63516. * @param callback - Callback function when event triggered
  63517. * @param target - Callback callee
  63518. */
  63519. hasEventListener(key: EventTypeClass, callback?: __types_globals__AnyFunction, target?: unknown): boolean;
  63520. /**
  63521. * @zh 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  63522. * @en Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  63523. * @param keyOrTarget - The event type or target with which the listeners will be removed
  63524. */
  63525. removeAll(keyOrTarget: EventTypeClass | unknown): void;
  63526. /**
  63527. * @zh 删除以指定事件,回调函数,目标注册的回调。
  63528. * @en Remove event listeners registered with the given event key, callback and target
  63529. * @param key - Event type
  63530. * @param callback - The callback function of the event listener, if absent all event listeners for the given type will be removed
  63531. * @param target - The callback callee of the event listener
  63532. */
  63533. off(key: EventTypeClass, callback?: __types_globals__AnyFunction, target?: unknown): void;
  63534. /**
  63535. * @zh 派发一个指定事件,并传递需要的参数
  63536. * @en Trigger an event directly with the event name and necessary arguments.
  63537. * @param key - event type
  63538. * @param arg0 - The first argument to be passed to the callback
  63539. * @param arg1 - The second argument to be passed to the callback
  63540. * @param arg2 - The third argument to be passed to the callback
  63541. * @param arg3 - The fourth argument to be passed to the callback
  63542. * @param arg4 - The fifth argument to be passed to the callback
  63543. */
  63544. emit(key: EventTypeClass, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void;
  63545. /**
  63546. * 移除所有回调。
  63547. */
  63548. clear(): void;
  63549. }
  63550. export interface _cocos_scene_graph_node_event_processor__IMask {
  63551. index: number;
  63552. comp: Component;
  63553. }
  63554. /**
  63555. * @en The input event type
  63556. * @zh 输入事件类型
  63557. */
  63558. export enum _cocos_input_types_event_enum__InputEventType {
  63559. /**
  63560. * @en
  63561. * The event type for touch start event
  63562. *
  63563. * @zh
  63564. * 手指开始触摸事件。
  63565. */
  63566. TOUCH_START = "touch-start",
  63567. /**
  63568. * @en
  63569. * The event type for touch move event
  63570. *
  63571. * @zh
  63572. * 当手指在屏幕上移动时。
  63573. */
  63574. TOUCH_MOVE = "touch-move",
  63575. /**
  63576. * @en
  63577. * The event type for touch end event
  63578. *
  63579. * @zh
  63580. * 手指结束触摸事件。
  63581. */
  63582. TOUCH_END = "touch-end",
  63583. /**
  63584. * @en
  63585. * The event type for touch end event
  63586. *
  63587. * @zh
  63588. * 当手指在目标节点区域外离开屏幕时。
  63589. */
  63590. TOUCH_CANCEL = "touch-cancel",
  63591. /**
  63592. * @en
  63593. * The event type for mouse down events
  63594. *
  63595. * @zh
  63596. * 当鼠标按下时触发一次。
  63597. */
  63598. MOUSE_DOWN = "mouse-down",
  63599. /**
  63600. * @en
  63601. * The event type for mouse move events
  63602. *
  63603. * @zh
  63604. * 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。
  63605. */
  63606. MOUSE_MOVE = "mouse-move",
  63607. /**
  63608. * @en
  63609. * The event type for mouse up events
  63610. *
  63611. * @zh
  63612. * 当鼠标从按下状态松开时触发一次。
  63613. */
  63614. MOUSE_UP = "mouse-up",
  63615. /**
  63616. * @en
  63617. * The event type for mouse wheel events
  63618. *
  63619. * @zh 手指开始触摸事件
  63620. */
  63621. MOUSE_WHEEL = "mouse-wheel",
  63622. /**
  63623. * @en The event type for the key down event
  63624. * @zh 当按下按键时触发的事件
  63625. */
  63626. KEY_DOWN = "keydown",
  63627. /**
  63628. * @en The event type for the key pressing event, the event will be continuously dispatched in the key pressed state
  63629. * @zh 当按着按键时触发的事件, 该事件在按下状态会持续派发
  63630. */
  63631. KEY_PRESSING = "key-pressing",
  63632. /**
  63633. * @en The event type for the key up event
  63634. * @zh 当松开按键时触发的事件
  63635. */
  63636. KEY_UP = "keyup",
  63637. /**
  63638. * @en
  63639. * The event type for the devicemotion event
  63640. *
  63641. * @zh
  63642. * 重力感应
  63643. */
  63644. DEVICEMOTION = "devicemotion",
  63645. /**
  63646. * @en The event type for gamepad input
  63647. * @zh 手柄输入事件
  63648. */
  63649. GAMEPAD_INPUT = "gamepad-input",
  63650. /**
  63651. * @en The event type for gamepad device change, including gamepad connecting and disconnecting
  63652. * @zh 手柄设备改变时触发的事件,包括手柄连接,手柄断开连接
  63653. */
  63654. GAMEPAD_CHANGE = "gamepad-change",
  63655. /**
  63656. * @en The event type for 6DOF handle input
  63657. * @zh 6DOF手柄输入事件
  63658. */
  63659. HANDLE_INPUT = "handle-input",
  63660. /**
  63661. * @en The event type for handle pose input
  63662. * @zh 手柄姿态输入事件
  63663. */
  63664. HANDLE_POSE_INPUT = "handle-pose-input",
  63665. /**
  63666. * @en The event type for hmd pose input
  63667. * @zh 头戴显示器姿态输入事件
  63668. */
  63669. HMD_POSE_INPUT = "hmd-pose-input",
  63670. /**
  63671. * @en The event type for handheld pose input
  63672. * @zh 手持设备相机姿态输入事件
  63673. */
  63674. HANDHELD_POSE_INPUT = "handheld-pose-input"
  63675. }
  63676. export type _cocos_input_types_event_enum__SystemEventTypeUnion = SystemEventType | NodeEventType | _cocos_input_types_event_enum__InputEventType | string;
  63677. /**
  63678. * @en The event processor for Node
  63679. * @zh 节点事件类。
  63680. */
  63681. export class _cocos_scene_graph_node_event_processor__NodeEventProcessor {
  63682. /**
  63683. * @internal
  63684. */
  63685. static _maskComp: __types_globals__Constructor<Component> | null;
  63686. /**
  63687. * @internal
  63688. */
  63689. static callbacksInvoker: _cocos_core_event_callbacks_invoker__CallbacksInvoker<_cocos_scene_graph_node_event_processor__DispatcherEventType>;
  63690. /**
  63691. * Whether the node event is enabled
  63692. */
  63693. get isEnabled(): boolean;
  63694. /**
  63695. * The list of claimed touch ids
  63696. */
  63697. claimedTouchIdList: number[];
  63698. /**
  63699. * The masks in the parent chain of the node
  63700. */
  63701. maskList: _cocos_scene_graph_node_event_processor__IMask[] | null;
  63702. /**
  63703. * To cache camera priority.
  63704. */
  63705. cachedCameraPriority: number;
  63706. /**
  63707. * To record whether the mouse move in at the previous mouse event.
  63708. */
  63709. previousMouseIn: boolean;
  63710. /**
  63711. * The owner of node event processor.
  63712. */
  63713. get node(): Node;
  63714. /**
  63715. * Target in bubbling phase.
  63716. */
  63717. bubblingTarget: _cocos_core_event_callbacks_invoker__CallbacksInvoker<_cocos_input_types_event_enum__SystemEventTypeUnion> | null;
  63718. /**
  63719. * Target in capturing phase.
  63720. */
  63721. capturingTarget: _cocos_core_event_callbacks_invoker__CallbacksInvoker<_cocos_input_types_event_enum__SystemEventTypeUnion> | null;
  63722. /**
  63723. * Whether the node has registered the mouse event callback
  63724. */
  63725. shouldHandleEventMouse: boolean;
  63726. /**
  63727. * Whether the node has registered the touch event callback
  63728. */
  63729. shouldHandleEventTouch: boolean;
  63730. constructor(node: Node);
  63731. /**
  63732. * Set enable state of the node event processor
  63733. * @param value Enable state
  63734. * @param recursive Recursively set the state or not
  63735. * @returns void
  63736. */
  63737. setEnabled(value: boolean, recursive?: boolean): void;
  63738. reattach(): void;
  63739. destroy(): void;
  63740. on(type: NodeEventType, callback: __types_globals__AnyFunction, target?: unknown, useCapture?: boolean): __types_globals__AnyFunction;
  63741. once(type: NodeEventType, callback: __types_globals__AnyFunction, target?: unknown, useCapture?: boolean): __types_globals__AnyFunction;
  63742. off(type: NodeEventType, callback?: __types_globals__AnyFunction, target?: unknown, useCapture?: boolean): void;
  63743. targetOff(target: unknown): void;
  63744. emit(type: _cocos_input_types_event_enum__SystemEventTypeUnion, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void;
  63745. dispatchEvent(event: Event): void;
  63746. hasEventListener(type: _cocos_input_types_event_enum__SystemEventTypeUnion, callback?: __types_globals__AnyFunction, target?: unknown): boolean;
  63747. /**
  63748. * @zh
  63749. * 获得所提供的事件类型在目标捕获阶段监听的所有目标。
  63750. * 捕获阶段包括从根节点到目标节点的过程。
  63751. * 结果保存在数组参数中,并且必须从子节点排序到父节点。
  63752. *
  63753. * @param type - 一个监听事件类型的字符串。
  63754. * @param array - 接收目标的数组。
  63755. */
  63756. getCapturingTargets(type: string, targets: Node[]): void;
  63757. /**
  63758. * @zh
  63759. * 获得所提供的事件类型在目标冒泡阶段监听的所有目标。
  63760. * 冒泡阶段目标节点到根节点的过程。
  63761. * 结果保存在数组参数中,并且必须从子节点排序到父节点。
  63762. *
  63763. * @param type - 一个监听事件类型的字符串。
  63764. * @param array - 接收目标的数组。
  63765. */
  63766. getBubblingTargets(type: string, targets: Node[]): void;
  63767. onUpdatingSiblingIndex(): void;
  63768. }
  63769. export type __types_globals__AbstractedConstructor<T = unknown> = new (...args: any[]) => T;
  63770. /**
  63771. * @en Node's UI properties abstraction
  63772. * @zh 节点上 UI 相关的属性抽象类
  63773. */
  63774. export class _cocos_scene_graph_node_ui_properties__NodeUIProperties {
  63775. /**
  63776. * @en The UI transform component
  63777. * @zh UI 变换组件
  63778. */
  63779. get uiTransformComp(): UITransform | null;
  63780. set uiTransformComp(value: UITransform | null);
  63781. /**
  63782. * @en The base UI component
  63783. * @zh UI 基类组件
  63784. */
  63785. get uiComp(): UIMeshRenderer | UIRenderer | null;
  63786. set uiComp(comp: UIMeshRenderer | UIRenderer | null);
  63787. get opacity(): number;
  63788. get localOpacity(): number;
  63789. set localOpacity(val: number);
  63790. colorDirty: boolean;
  63791. protected _uiTransformComp: UITransform | null;
  63792. constructor(node: any);
  63793. /**
  63794. * @deprecated since v3.4
  63795. */
  63796. applyOpacity(effectOpacity: any): void;
  63797. /**
  63798. * @en Make the opacity state of node tree is dirty, not effect anymore
  63799. * @zh 为结点树的透明度状态设置脏标签,不再有效果
  63800. * @deprecated since v3.4
  63801. */
  63802. static markOpacityTree(node: any, isDirty?: boolean): void;
  63803. }
  63804. function _cocos_scene_graph_component_scheduler__stableRemoveInactive(iterator: any, flagToClear: any): void;
  63805. export type _cocos_scene_graph_component_scheduler__InvokeFunc = (...args: unknown[]) => void;
  63806. export class _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
  63807. static stableRemoveInactive: typeof _cocos_scene_graph_component_scheduler__stableRemoveInactive;
  63808. protected _zero: js.array.MutableForwardIterator<any>;
  63809. protected _neg: js.array.MutableForwardIterator<any>;
  63810. protected _pos: js.array.MutableForwardIterator<any>;
  63811. protected _invoke: _cocos_scene_graph_component_scheduler__InvokeFunc;
  63812. constructor(invokeFunc: _cocos_scene_graph_component_scheduler__InvokeFunc);
  63813. }
  63814. export class _cocos_scene_graph_node_activator__UnsortedInvoker extends _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
  63815. add(comp: Component): void;
  63816. remove(comp: Component): void;
  63817. cancelInactive(flagToClear: number): void;
  63818. invoke(): void;
  63819. }
  63820. export class _cocos_scene_graph_component_scheduler__OneOffInvoker extends _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
  63821. add(comp: Component): void;
  63822. remove(comp: Component): void;
  63823. cancelInactive(flagToClear: number): void;
  63824. invoke(): void;
  63825. }
  63826. export interface _cocos_scene_graph_node_activator__ActivateTask {
  63827. preload: _cocos_scene_graph_node_activator__UnsortedInvoker;
  63828. onLoad: _cocos_scene_graph_component_scheduler__OneOffInvoker;
  63829. onEnable: _cocos_scene_graph_component_scheduler__OneOffInvoker;
  63830. }
  63831. export type _cocos_asset_assets_material__MaterialPropertyFull = renderer.MaterialProperty | _cocos_asset_assets_texture_base__TextureBase | gfx.Texture | null;
  63832. export const _cocos_misc_camera_component__ProjectionType: typeof renderer.scene.CameraProjection;
  63833. export const _cocos_misc_camera_component__FOVAxis: typeof renderer.scene.CameraFOVAxis;
  63834. /**
  63835. * @en Clear screen flag enumeration of the camera.
  63836. * @zh 相机的清屏标记枚举。
  63837. */
  63838. export const _cocos_misc_camera_component__ClearFlag: {
  63839. /**
  63840. * @en Clear the screen with [[SceneGlobals.skybox]], will clear the depth and stencil buffer at the same time.
  63841. * @zh 使用指定天空盒 [[SceneGlobals.skybox]] 清屏,会同时清理深度和蒙版缓冲。
  63842. */
  63843. SKYBOX: number;
  63844. /**
  63845. * @en Clear the screen with the given [[Camera.clearColor]], will clear the depth and stencil buffer at the same time.
  63846. * @zh 使用指定的相机清屏颜色 [[Camera.clearColor]] 来清屏,会同时清理将深度和蒙版缓冲。
  63847. */
  63848. SOLID_COLOR: gfx.ClearFlagBit;
  63849. /**
  63850. * @en Only clear the depth and stencil buffer while keeping the color buffer intact. Often used in UI camera.
  63851. * @zh 只清理深度和蒙版缓冲,同时保留颜色缓冲不变。常用于 UI 相机。
  63852. */
  63853. DEPTH_ONLY: gfx.ClearFlagBit;
  63854. /**
  63855. * @en Don't clear anything and continue rendering.
  63856. * @zh 不清理任何内容就开始渲染,适合多 Camera 叠加渲染。
  63857. */
  63858. DONT_CLEAR: gfx.ClearFlagBit;
  63859. };
  63860. export const _cocos_misc_camera_component__Aperture: typeof renderer.scene.CameraAperture;
  63861. export const _cocos_misc_camera_component__Shutter: typeof renderer.scene.CameraShutter;
  63862. export const _cocos_misc_camera_component__ISO: typeof renderer.scene.CameraISO;
  63863. export class _cocos_scene_graph_component_scheduler__ReusableInvoker extends _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
  63864. add(comp: Component): void;
  63865. remove(comp: Component): void;
  63866. invoke(dt: number): void;
  63867. }
  63868. /**
  63869. * @en The Manager for Component's life-cycle methods.
  63870. * It collaborates with [[NodeActivator]] to schedule and invoke life cycle methods for components
  63871. * @zh 组件生命周期函数的调度器。
  63872. * 它和 [[NodeActivator]] 一起调度并执行组件的生命周期函数。
  63873. */
  63874. export class _cocos_scene_graph_component_scheduler__ComponentScheduler {
  63875. /**
  63876. * @en The invoker of `start` callback
  63877. * @zh `start` 回调的调度器
  63878. */
  63879. startInvoker: _cocos_scene_graph_component_scheduler__OneOffInvoker;
  63880. /**
  63881. * @en The invoker of `update` callback
  63882. * @zh `update` 回调的调度器
  63883. */
  63884. updateInvoker: _cocos_scene_graph_component_scheduler__ReusableInvoker;
  63885. /**
  63886. * @en The invoker of `lateUpdate` callback
  63887. * @zh `lateUpdate` 回调的调度器
  63888. */
  63889. lateUpdateInvoker: _cocos_scene_graph_component_scheduler__ReusableInvoker;
  63890. constructor();
  63891. /**
  63892. * @en Cancel all future callbacks, including `start`, `update` and `lateUpdate`
  63893. * @zh 取消所有未来的函数调度,包括 `start`,`update` 和 `lateUpdate`
  63894. */
  63895. unscheduleAll(): void;
  63896. /**
  63897. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  63898. */
  63899. _onEnabled(comp: Component): void;
  63900. /**
  63901. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  63902. */
  63903. _onDisabled(comp: Component): void;
  63904. /**
  63905. * @en Enable a component
  63906. * @zh 启用一个组件
  63907. * @param comp The component to be enabled
  63908. * @param invoker The invoker which is responsible to schedule the `onEnable` call
  63909. */
  63910. enableComp(comp: Component, invoker?: _cocos_scene_graph_component_scheduler__OneOffInvoker): void;
  63911. /**
  63912. * @en Disable a component
  63913. * @zh 禁用一个组件
  63914. * @param comp The component to be disabled
  63915. */
  63916. disableComp(comp: Component): void;
  63917. /**
  63918. * @en Process start phase for registered components
  63919. * @zh 为当前注册的组件执行 start 阶段任务
  63920. */
  63921. startPhase(): void;
  63922. /**
  63923. * @en Process update phase for registered components
  63924. * @zh 为当前注册的组件执行 update 阶段任务
  63925. * @param dt @en Time passed after the last frame in seconds @zh 距离上一帧的时间,以秒计算
  63926. */
  63927. updatePhase(dt: number): void;
  63928. /**
  63929. * @en Process late update phase for registered components
  63930. * @zh 为当前注册的组件执行 late update 阶段任务
  63931. * @param dt @en Time passed after the last frame in seconds @zh 距离上一帧的时间,以秒计算
  63932. */
  63933. lateUpdatePhase(dt: number): void;
  63934. }
  63935. /**
  63936. * @zh
  63937. * AssetManager 配置。
  63938. * @en
  63939. * AssetManager configuration.
  63940. */
  63941. export interface _cocos_asset_asset_manager_asset_manager__IAssetManagerOptions {
  63942. importBase?: string;
  63943. nativeBase?: string;
  63944. jsbDownloaderMaxTasks?: number;
  63945. jsbDownloaderTimeout?: number;
  63946. /**
  63947. * @zh
  63948. * 所有 bundle 的版本信息。
  63949. * @en
  63950. * Version for all bundles.
  63951. */
  63952. bundleVers?: Record<string, string>;
  63953. /**
  63954. * @zh
  63955. * 远程服务器地址。
  63956. * @en
  63957. * Remote server address.
  63958. */
  63959. server?: string;
  63960. /**
  63961. * @zh
  63962. * 配置为子包的 bundle。
  63963. * @en
  63964. * All subpackages.
  63965. */
  63966. subpackages?: string[];
  63967. /**
  63968. * @zh
  63969. * 配置为远程包的 bundle。
  63970. * @en
  63971. * All remote bundles.
  63972. */
  63973. remoteBundles?: string[];
  63974. /**
  63975. * @en
  63976. * The maximum number of concurrent when downloading.
  63977. *
  63978. * @zh
  63979. * 下载时的最大并发数。
  63980. */
  63981. downloadMaxConcurrency?: number;
  63982. }
  63983. export type _pal_screen_adapter__ConfigOrientation = "auto" | "landscape" | "portrait";
  63984. export type _cocos_serialization_deserialize__SharedString = string;
  63985. export const _cocos_serialization_deserialize__EMPTY_PLACEHOLDER = 0;
  63986. export type _cocos_serialization_deserialize__Empty = typeof _cocos_serialization_deserialize__EMPTY_PLACEHOLDER;
  63987. export type _cocos_serialization_deserialize__Ctor<T> = new () => T;
  63988. export type _cocos_serialization_deserialize__AnyCtor = _cocos_serialization_deserialize__Ctor<Object>;
  63989. export type _cocos_serialization_deserialize__IClass = [
  63990. string | _cocos_serialization_deserialize__AnyCtor,
  63991. string[],
  63992. number,
  63993. ...deserialize.Internal.DataTypeID_[]
  63994. ];
  63995. export class _cocos_serialization_deserialize_dynamic__DeserializerPool extends js.Pool<_cocos_serialization_deserialize_dynamic___Deserializer> {
  63996. constructor();
  63997. }
  63998. export type _cocos_serialization_deserialize_dynamic__ClassFinder = deserialize.ClassFinder;
  63999. export type _cocos_serialization_deserialize_dynamic__ReportMissingClass = deserialize.ReportMissingClass;
  64000. export type _cocos_serialization_deserialize_dynamic__TypedArrayViewConstructorName = "Uint8Array" | "Int8Array" | "Uint16Array" | "Int16Array" | "Uint32Array" | "Int32Array" | "Float32Array" | "Float64Array";
  64001. export interface _cocos_serialization_deserialize_dynamic__SerializedTypedArray {
  64002. __id__: never;
  64003. __uuid__: never;
  64004. __type__: "TypedArray";
  64005. array: number[];
  64006. ctor: _cocos_serialization_deserialize_dynamic__TypedArrayViewConstructorName;
  64007. }
  64008. export interface _cocos_serialization_deserialize_dynamic__SerializedTypedArrayRef {
  64009. __id__: never;
  64010. __uuid__: never;
  64011. __type__: "TypedArrayRef";
  64012. ctor: _cocos_serialization_deserialize_dynamic__TypedArrayViewConstructorName;
  64013. offset: number;
  64014. length: number;
  64015. }
  64016. export type _cocos_serialization_deserialize_dynamic__NotA<T, ReservedNames> = T extends ReservedNames ? never : T;
  64017. export type _cocos_serialization_deserialize_dynamic__NotB<T, ReservedNames> = ReservedNames extends T ? never : T;
  64018. export type _cocos_serialization_deserialize_dynamic__FooName<T, ReservedNames> = _cocos_serialization_deserialize_dynamic__NotA<T, ReservedNames> & _cocos_serialization_deserialize_dynamic__NotB<T, ReservedNames>;
  64019. export type _cocos_serialization_deserialize_dynamic__NotKnownTypeTag = _cocos_serialization_deserialize_dynamic__FooName<string, "TypedArray" | "TypedArrayRef">;
  64020. export type _cocos_serialization_deserialize_dynamic__NotTypeTag = _cocos_serialization_deserialize_dynamic__FooName<string, "__type__">;
  64021. export interface _cocos_serialization_deserialize_dynamic__SerializedObjectReference {
  64022. __type__: never;
  64023. __uuid__: never;
  64024. __id__: number;
  64025. }
  64026. export interface _cocos_serialization_deserialize_dynamic__SerializedUUIDReference {
  64027. __type__: never;
  64028. __id__: never;
  64029. __uuid__: string;
  64030. __expectedType__: string;
  64031. }
  64032. export type _cocos_serialization_deserialize_dynamic__SerializedFieldObjectValue = _cocos_serialization_deserialize_dynamic__SerializedObjectReference | _cocos_serialization_deserialize_dynamic__SerializedUUIDReference | unknown;
  64033. export type _cocos_serialization_deserialize_dynamic__SerializedFieldValue = string | number | boolean | null | _cocos_serialization_deserialize_dynamic__SerializedFieldObjectValue;
  64034. export type _cocos_serialization_deserialize_dynamic__SerializedGeneralTypedObject = {
  64035. __id__: never;
  64036. __uuid__: never;
  64037. __type__?: _cocos_serialization_deserialize_dynamic__NotKnownTypeTag;
  64038. } & Record<_cocos_serialization_deserialize_dynamic__NotTypeTag, _cocos_serialization_deserialize_dynamic__SerializedFieldValue>;
  64039. export type _cocos_serialization_deserialize_dynamic__SerializedObject = _cocos_serialization_deserialize_dynamic__SerializedTypedArray | _cocos_serialization_deserialize_dynamic__SerializedTypedArrayRef | _cocos_serialization_deserialize_dynamic__SerializedGeneralTypedObject;
  64040. export type _cocos_serialization_deserialize_dynamic__SerializedData = _cocos_serialization_deserialize_dynamic__SerializedObject | _cocos_serialization_deserialize_dynamic__SerializedObject[];
  64041. export class _cocos_serialization_deserialize_dynamic___Deserializer {
  64042. static pool: _cocos_serialization_deserialize_dynamic__DeserializerPool;
  64043. result: Details;
  64044. customEnv: unknown;
  64045. deserializedList: Array<Record<PropertyKey, unknown> | undefined>;
  64046. deserializedData: any;
  64047. constructor(result: Details, classFinder: _cocos_serialization_deserialize_dynamic__ClassFinder, reportMissingClass: _cocos_serialization_deserialize_dynamic__ReportMissingClass, customEnv: unknown, ignoreEditorOnly: unknown);
  64048. reset(result: Details, classFinder: _cocos_serialization_deserialize_dynamic__ClassFinder, reportMissingClass: _cocos_serialization_deserialize_dynamic__ReportMissingClass, customEnv: unknown, ignoreEditorOnly: unknown): void;
  64049. clear(): void;
  64050. deserialize(serializedData: _cocos_serialization_deserialize_dynamic__SerializedData | CCON): any;
  64051. }
  64052. export type _cocos_serialization_deserialize_dynamic__CompiledDeserializeFn = (deserializer: _cocos_serialization_deserialize_dynamic___Deserializer, object: Record<string, unknown>, deserialized: Record<string, unknown>, constructor: __types_globals__AnyFunction) => void;
  64053. export interface _cocos_serialization_deserialize__CCClassConstructor<T> extends _cocos_serialization_deserialize__Ctor<T> {
  64054. __values__: string[];
  64055. __deserialize__?: _cocos_serialization_deserialize_dynamic__CompiledDeserializeFn;
  64056. }
  64057. export type _cocos_serialization_deserialize__AnyCCClass = _cocos_serialization_deserialize__CCClassConstructor<Object>;
  64058. export type _cocos_serialization_deserialize__IMask = [
  64059. number,
  64060. ...number[]
  64061. ];
  64062. export type _cocos_serialization_deserialize__InstanceIndex = number;
  64063. export type _cocos_serialization_deserialize__ReverseIndex = number;
  64064. /** **************************************************************************
  64065. * TYPE DECLARATIONS
  64066. *************************************************************************** */
  64067. export type _cocos_serialization_deserialize__Bnot<T extends number, U extends number> = T | U;
  64068. export type _cocos_serialization_deserialize__InstanceBnotReverseIndex = _cocos_serialization_deserialize__Bnot<_cocos_serialization_deserialize__InstanceIndex, _cocos_serialization_deserialize__ReverseIndex>;
  64069. export type _cocos_serialization_deserialize__IValueTypeData = [
  64070. number,
  64071. ...number[]
  64072. ];
  64073. export type _cocos_serialization_deserialize__ITRSData = [
  64074. number,
  64075. number,
  64076. number,
  64077. number,
  64078. number,
  64079. number,
  64080. number,
  64081. number,
  64082. number,
  64083. number
  64084. ];
  64085. export const _cocos_serialization_deserialize__CUSTOM_OBJ_DATA_CLASS = 0;
  64086. export const _cocos_serialization_deserialize__CUSTOM_OBJ_DATA_CONTENT = 1;
  64087. export type _cocos_serialization_deserialize__ICustomObjectDataContent = any;
  64088. export interface _cocos_serialization_deserialize__ICustomObjectData extends Array<any> {
  64089. [_cocos_serialization_deserialize__CUSTOM_OBJ_DATA_CLASS]: number;
  64090. [_cocos_serialization_deserialize__CUSTOM_OBJ_DATA_CONTENT]: _cocos_serialization_deserialize__ICustomObjectDataContent;
  64091. }
  64092. export const _cocos_serialization_deserialize__DICT_JSON_LAYOUT = 0;
  64093. export type _cocos_serialization_deserialize__AdvancedTypeID = Exclude<deserialize.Internal.DataTypeID_, deserialize.Internal.DataTypeID_.SimpleType>;
  64094. export type _cocos_serialization_deserialize__AdvancedData = _cocos_serialization_deserialize__DataTypes[Exclude<keyof _cocos_serialization_deserialize__DataTypes, deserialize.Internal.DataTypeID_.SimpleType>];
  64095. export interface _cocos_serialization_deserialize__IDictData extends Array<any> {
  64096. [_cocos_serialization_deserialize__DICT_JSON_LAYOUT]: any;
  64097. [1]: string;
  64098. [2]: _cocos_serialization_deserialize__AdvancedTypeID;
  64099. [3]: _cocos_serialization_deserialize__AdvancedData;
  64100. [index: number]: any;
  64101. }
  64102. export type _cocos_serialization_deserialize__IArrayData = [
  64103. _cocos_serialization_deserialize__AnyData[],
  64104. ...deserialize.Internal.DataTypeID_[]
  64105. ];
  64106. export interface _cocos_serialization_deserialize__DataTypes {
  64107. [deserialize.Internal.DataTypeID_.SimpleType]: number | string | boolean | null | object;
  64108. [deserialize.Internal.DataTypeID_.InstanceRef]: _cocos_serialization_deserialize__InstanceBnotReverseIndex;
  64109. [deserialize.Internal.DataTypeID_.Array_InstanceRef]: _cocos_serialization_deserialize__DataTypes[deserialize.Internal.DataTypeID_.InstanceRef][];
  64110. [deserialize.Internal.DataTypeID_.Array_AssetRefByInnerObj]: _cocos_serialization_deserialize__DataTypes[deserialize.Internal.DataTypeID_.AssetRefByInnerObj][];
  64111. [deserialize.Internal.DataTypeID_.Class]: _cocos_serialization_deserialize__IClassObjectData;
  64112. [deserialize.Internal.DataTypeID_.ValueTypeCreated]: _cocos_serialization_deserialize__IValueTypeData;
  64113. [deserialize.Internal.DataTypeID_.AssetRefByInnerObj]: number;
  64114. [deserialize.Internal.DataTypeID_.TRS]: _cocos_serialization_deserialize__ITRSData;
  64115. [deserialize.Internal.DataTypeID_.ValueType]: _cocos_serialization_deserialize__IValueTypeData;
  64116. [deserialize.Internal.DataTypeID_.Array_Class]: _cocos_serialization_deserialize__DataTypes[deserialize.Internal.DataTypeID_.Class][];
  64117. [deserialize.Internal.DataTypeID_.CustomizedClass]: _cocos_serialization_deserialize__ICustomObjectData;
  64118. [deserialize.Internal.DataTypeID_.Dict]: _cocos_serialization_deserialize__IDictData;
  64119. [deserialize.Internal.DataTypeID_.Array]: _cocos_serialization_deserialize__IArrayData;
  64120. }
  64121. export type _cocos_serialization_deserialize__AnyData = _cocos_serialization_deserialize__DataTypes[keyof _cocos_serialization_deserialize__DataTypes];
  64122. export type _cocos_serialization_deserialize__IClassObjectData = [
  64123. number,
  64124. ..._cocos_serialization_deserialize__AnyData[]
  64125. ];
  64126. export type _cocos_serialization_deserialize__PrimitiveObjectTypeID = (deserialize.Internal.DataTypeID_.SimpleType | deserialize.Internal.DataTypeID_.Array | deserialize.Internal.DataTypeID_.Array_Class | deserialize.Internal.DataTypeID_.Array_AssetRefByInnerObj | deserialize.Internal.DataTypeID_.Array_InstanceRef | deserialize.Internal.DataTypeID_.Dict);
  64127. export type _cocos_serialization_deserialize__OtherObjectData = _cocos_serialization_deserialize__ICustomObjectDataContent | Exclude<_cocos_serialization_deserialize__DataTypes[_cocos_serialization_deserialize__PrimitiveObjectTypeID], (number | string | boolean | null)>;
  64128. export type _cocos_serialization_deserialize__NoNativeDep = boolean;
  64129. export type _cocos_serialization_deserialize__RootInstanceIndex = _cocos_serialization_deserialize__InstanceIndex;
  64130. export type _cocos_serialization_deserialize__BoolAndNum<B extends boolean, N extends number> = _cocos_serialization_deserialize__Bnot<N, N>;
  64131. export type _cocos_serialization_deserialize__RootInfo = _cocos_serialization_deserialize__BoolAndNum<_cocos_serialization_deserialize__NoNativeDep, _cocos_serialization_deserialize__RootInstanceIndex>;
  64132. export type _cocos_serialization_deserialize__OtherObjectTypeID = _cocos_serialization_deserialize__Bnot<number, _cocos_serialization_deserialize__PrimitiveObjectTypeID>;
  64133. export type _cocos_serialization_deserialize__StringIndex = number;
  64134. export type _cocos_serialization_deserialize__StringIndexBnotNumber = _cocos_serialization_deserialize__Bnot<_cocos_serialization_deserialize__StringIndex, number>;
  64135. export interface _cocos_serialization_deserialize__IRefs extends Array<number> {
  64136. [0]: (object | _cocos_serialization_deserialize__InstanceIndex);
  64137. [1]?: _cocos_serialization_deserialize__StringIndexBnotNumber;
  64138. [2]?: _cocos_serialization_deserialize__InstanceIndex;
  64139. [index: number]: any;
  64140. }
  64141. export interface _cocos_serialization_deserialize__IFileDataMap {
  64142. [deserialize.Internal.File_.Version]: number;
  64143. [deserialize.Internal.File_.SharedUuids]: _cocos_serialization_deserialize__SharedString[] | _cocos_serialization_deserialize__Empty;
  64144. [deserialize.Internal.File_.SharedStrings]: _cocos_serialization_deserialize__SharedString[] | _cocos_serialization_deserialize__Empty;
  64145. [deserialize.Internal.File_.SharedClasses]: (_cocos_serialization_deserialize__IClass | string | _cocos_serialization_deserialize__AnyCCClass)[];
  64146. [deserialize.Internal.File_.SharedMasks]: _cocos_serialization_deserialize__IMask[] | _cocos_serialization_deserialize__Empty;
  64147. [deserialize.Internal.File_.Instances]: (_cocos_serialization_deserialize__IClassObjectData | _cocos_serialization_deserialize__OtherObjectData | _cocos_serialization_deserialize__RootInfo)[];
  64148. [deserialize.Internal.File_.InstanceTypes]: _cocos_serialization_deserialize__OtherObjectTypeID[] | _cocos_serialization_deserialize__Empty;
  64149. [deserialize.Internal.File_.Refs]: _cocos_serialization_deserialize__IRefs | _cocos_serialization_deserialize__Empty;
  64150. [deserialize.Internal.File_.DependObjs]: (object | _cocos_serialization_deserialize__InstanceIndex)[];
  64151. [deserialize.Internal.File_.DependKeys]: (_cocos_serialization_deserialize__StringIndexBnotNumber | string)[];
  64152. [deserialize.Internal.File_.DependUuidIndices]: (_cocos_serialization_deserialize__StringIndex | string)[];
  64153. }
  64154. export type _cocos_serialization_deserialize_type_utilities__Tuple<T, N, R extends T[] = [
  64155. ]> = R["length"] extends N ? R : _cocos_serialization_deserialize_type_utilities__Tuple<T, N, [
  64156. ...R,
  64157. T
  64158. ]>;
  64159. export type _cocos_serialization_deserialize_type_utilities__EnumMapImpl<Map extends Record<number, any>, _, Minus1 extends any[] = [
  64160. ], Index extends keyof Map = Minus1["length"]> = [
  64161. ...(Minus1 extends [
  64162. infer _2,
  64163. ...infer Remain
  64164. ] ? _cocos_serialization_deserialize_type_utilities__EnumMapImpl<Map, _2, Remain> : [
  64165. ]),
  64166. Map[Index]
  64167. ];
  64168. export type _cocos_serialization_deserialize_type_utilities__MapTuple<Map extends Record<number, any>, T> = T extends [
  64169. infer _1,
  64170. ...infer Remain
  64171. ] ? _cocos_serialization_deserialize_type_utilities__EnumMapImpl<Map, _1, Remain> : never;
  64172. export type _cocos_serialization_deserialize_type_utilities__MapEnum<Map extends Record<number, any>, Length extends number> = _cocos_serialization_deserialize_type_utilities__MapTuple<Map, _cocos_serialization_deserialize_type_utilities__Tuple<unknown, Length>>;
  64173. export type _cocos_serialization_deserialize__IFileData = _cocos_serialization_deserialize_type_utilities__MapEnum<{
  64174. [x in keyof _cocos_serialization_deserialize__IFileDataMap as `${x}`]: _cocos_serialization_deserialize__IFileDataMap[x];
  64175. }, 11>;
  64176. export class _cocos_serialization_deserialize__FileInfo {
  64177. version: number;
  64178. preprocessed: boolean;
  64179. constructor(version: number);
  64180. }
  64181. export interface _cocos_serialization_deserialize__ICustomHandler {
  64182. result: Details;
  64183. customEnv: any;
  64184. }
  64185. export interface _cocos_serialization_deserialize__DeserializeContext extends _cocos_serialization_deserialize__ICustomHandler {
  64186. _version?: number;
  64187. }
  64188. export type _cocos_serialization_deserialize__IRuntimeFileDataMap = Omit<_cocos_serialization_deserialize__IFileDataMap, deserialize.Internal.File_.Version> & {
  64189. [deserialize.Internal.File_.Context]: _cocos_serialization_deserialize__FileInfo & _cocos_serialization_deserialize__DeserializeContext;
  64190. };
  64191. /**
  64192. * At runtime, we intruded the original file data and injected some helpers.
  64193. */
  64194. export type _cocos_serialization_deserialize__IRuntimeFileData = _cocos_serialization_deserialize_type_utilities__MapEnum<{
  64195. [x in keyof _cocos_serialization_deserialize__IRuntimeFileDataMap as `${x}`]: _cocos_serialization_deserialize__IRuntimeFileDataMap[x];
  64196. }, 11>;
  64197. export type _cocos_serialization_deserialize__IDeserializeInput = _cocos_serialization_deserialize__IFileData | _cocos_serialization_deserialize__IRuntimeFileData;
  64198. export type _cocos_serialization_deserialize__ClassFinder = deserialize.ClassFinder;
  64199. export interface _cocos_serialization_deserialize__IOptions extends Partial<_cocos_serialization_deserialize__ICustomHandler> {
  64200. classFinder?: _cocos_serialization_deserialize__ClassFinder;
  64201. reportMissingClass?: deserialize.ReportMissingClass;
  64202. }
  64203. export interface _cocos_serialization_deserialize_dynamic__DeserializeDynamicOptions {
  64204. classFinder?: _cocos_serialization_deserialize_dynamic__ClassFinder;
  64205. ignoreEditorOnly?: boolean;
  64206. createAssetRefs?: boolean;
  64207. customEnv?: unknown;
  64208. reportMissingClass?: _cocos_serialization_deserialize_dynamic__ReportMissingClass;
  64209. }
  64210. export type _cocos_serialization_deserialize_type_utilities__TupleSplit<T, N extends number, O extends readonly any[] = readonly [
  64211. ]> = O["length"] extends N ? [
  64212. O,
  64213. T
  64214. ] : T extends readonly [
  64215. infer F,
  64216. ...infer R
  64217. ] ? _cocos_serialization_deserialize_type_utilities__TupleSplit<readonly [
  64218. ...R
  64219. ], N, readonly [
  64220. ...O,
  64221. F
  64222. ]> : [
  64223. O,
  64224. T
  64225. ];
  64226. export type _cocos_serialization_deserialize_type_utilities__TakeFirst<T extends readonly any[], N extends number> = _cocos_serialization_deserialize_type_utilities__TupleSplit<T, N>[0];
  64227. export type _cocos_serialization_deserialize_type_utilities__SkipFirst<T extends readonly any[], N extends number> = _cocos_serialization_deserialize_type_utilities__TupleSplit<T, N>[1];
  64228. export type _cocos_serialization_deserialize_type_utilities__TupleSlice<T extends readonly any[], S extends number, E extends number = T["length"]> = _cocos_serialization_deserialize_type_utilities__SkipFirst<_cocos_serialization_deserialize_type_utilities__TakeFirst<T, E>, S>;
  64229. export type _cocos_serialization_deserialize__ISharedData = _cocos_serialization_deserialize_type_utilities__TupleSlice<_cocos_serialization_deserialize__IFileData, 1, 5>;
  64230. export type _cocos_serialization_deserialize__IPackedFileSection = [
  64231. ...document: _cocos_serialization_deserialize_type_utilities__TupleSlice<_cocos_serialization_deserialize__IFileData, 5>
  64232. ];
  64233. export type _cocos_serialization_deserialize__IPackedFileData = [
  64234. version: number,
  64235. ...shared: _cocos_serialization_deserialize__ISharedData,
  64236. sections: _cocos_serialization_deserialize__IPackedFileSection[]
  64237. ];
  64238. /**
  64239. *
  64240. * @engineInternal
  64241. */
  64242. export function _cocos_serialization_report_missing_class__reportMissingClass(id: string): void;
  64243. export function _cocos_serialization_deserialize__isCompiledJson(json: unknown): boolean;
  64244. function _cocos_serialization_instantiate__doInstantiate(obj: any, parent?: any): any;
  64245. /**
  64246. * @param error - null or the error info
  64247. * @param node - the created node or null
  64248. */
  64249. export type _cocos_asset_assets_asset__CreateNodeCallback = (error: Error | null, node: Node) => void;
  64250. export const _cocos_asset_assets_asset__Asset_base: new (...args: any[]) => CCObject & _cocos_core_event_eventify__IEventified;
  64251. /**
  64252. * @en Array views for index buffer
  64253. * @zh 允许存储索引的数组视图。
  64254. */
  64255. export type _cocos_asset_assets_rendering_sub_mesh__IBArray = Uint8Array | Uint16Array | Uint32Array;
  64256. /**
  64257. * @en The interface of geometric information.
  64258. * @zh 几何信息。
  64259. */
  64260. export interface _cocos_asset_assets_rendering_sub_mesh__IGeometricInfo {
  64261. /**
  64262. * @en Vertex positions.
  64263. * @zh 顶点位置。
  64264. */
  64265. positions: Float32Array;
  64266. /**
  64267. * @en Indices data.
  64268. * @zh 索引数据。
  64269. */
  64270. indices?: _cocos_asset_assets_rendering_sub_mesh__IBArray;
  64271. /**
  64272. * @en Whether the geometry is treated as double sided.
  64273. * @zh 是否将图元按双面对待。
  64274. */
  64275. doubleSided?: boolean;
  64276. /**
  64277. * @en The bounding box.
  64278. * @zh 此几何体的轴对齐包围盒。
  64279. */
  64280. boundingBox: {
  64281. max: math.Vec3 | Readonly<math.Vec3>;
  64282. min: math.Vec3 | Readonly<math.Vec3>;
  64283. };
  64284. }
  64285. /**
  64286. * @en Flat vertex buffer.
  64287. * @zh 扁平化顶点缓冲区。
  64288. */
  64289. export interface _cocos_asset_assets_rendering_sub_mesh__IFlatBuffer {
  64290. stride: number;
  64291. count: number;
  64292. buffer: Uint8Array;
  64293. }
  64294. /**
  64295. * @en The create information for [[Texture2D]].
  64296. * @zh 用来创建贴图的信息。
  64297. */
  64298. export interface _cocos_asset_assets_texture_2d__ITexture2DCreateInfo {
  64299. /**
  64300. * @en The pixel width.
  64301. * @zh 像素宽度。
  64302. */
  64303. width: number;
  64304. /**
  64305. * @en The pixel height.
  64306. * @zh 像素高度。
  64307. */
  64308. height: number;
  64309. /**
  64310. * @en The pixel format.
  64311. * @zh 像素格式。
  64312. * @default PixelFormat.RGBA8888
  64313. */
  64314. format?: _cocos_asset_assets_asset_enum__PixelFormat;
  64315. /**
  64316. * @en The mipmap level count.
  64317. * @zh mipmap 层级。
  64318. * @default 1
  64319. */
  64320. mipmapLevel?: number;
  64321. /**
  64322. * @en The selected base mipmap level.
  64323. * @zh 选择使用的最小 mipmap 层级。
  64324. * @default 1
  64325. */
  64326. baseLevel?: number;
  64327. /**
  64328. * @en The selected maximum mipmap level.
  64329. * @zh 选择使用的最大 mipmap 层级。
  64330. * @default 1000
  64331. */
  64332. maxLevel?: number;
  64333. }
  64334. /**
  64335. * @en The simple texture base class.
  64336. * It create the GFX Texture and can set mipmap levels.
  64337. * @zh 简单贴图基类。
  64338. * 简单贴图内部创建了 GFX 贴图和该贴图上的 GFX 贴图视图。
  64339. * 简单贴图允许指定不同的 Mipmap 层级。
  64340. */
  64341. export class _cocos_asset_assets_simple_texture__SimpleTexture extends _cocos_asset_assets_texture_base__TextureBase {
  64342. /**
  64343. * @en The mipmap level of the texture.
  64344. * @zh 贴图中的 Mipmap 层级数量。
  64345. */
  64346. get mipmapLevel(): number;
  64347. /**
  64348. * @en The GFX Texture resource.
  64349. * @zh 获取此贴图底层的 GFX 贴图对象。
  64350. * @return @en The low level gfx texture. @zh 底层的 GFX 贴图。
  64351. */
  64352. getGFXTexture(): gfx.Texture | null;
  64353. destroy(): boolean;
  64354. /**
  64355. * @en Update the level 0 mipmap image.
  64356. * @zh 更新 0 级 Mipmap。
  64357. */
  64358. updateImage(): void;
  64359. /**
  64360. * @en Update the given level mipmap image.
  64361. * @zh 更新指定层级范围内的 Mipmap。当 Mipmap 数据发生了改变时应调用此方法提交更改。
  64362. * 若指定的层级范围超出了实际已有的层级范围,只有覆盖的那些层级范围会被更新。
  64363. * @param firstLevel @en First level to be updated. @zh 更新指定层的 mipmap。
  64364. * @param count @en Mipmap level count to be updated。 @zh 指定要更新层的数量。
  64365. */
  64366. updateMipmaps(firstLevel?: number, count?: number): void;
  64367. /**
  64368. * @en Upload data to the given mipmap level.
  64369. * The size of the image will affect how the mipmap is updated.
  64370. * - When the image is an ArrayBuffer, the size of the image must match the mipmap size.
  64371. * - If the image size matches the mipmap size, the mipmap data will be updated entirely.
  64372. * - If the image size is smaller than the mipmap size, the mipmap will be updated from top left corner.
  64373. * - If the image size is larger, an error will be raised
  64374. * @zh 上传图像数据到指定层级的 Mipmap 中。
  64375. * 图像的尺寸影响 Mipmap 的更新范围:
  64376. * - 当图像是 `ArrayBuffer` 时,图像的尺寸必须和 Mipmap 的尺寸一致;否则,
  64377. * - 若图像的尺寸与 Mipmap 的尺寸相同,上传后整个 Mipmap 的数据将与图像数据一致;
  64378. * - 若图像的尺寸小于指定层级 Mipmap 的尺寸(不管是长或宽),则从贴图左上角开始,图像尺寸范围内的 Mipmap 会被更新;
  64379. * - 若图像的尺寸超出了指定层级 Mipmap 的尺寸(不管是长或宽),都将引起错误。
  64380. * @param source @en The source image or image data. @zh 源图像或图像数据。
  64381. * @param level @en Mipmap level to upload the image to. @zh 要上传的 mipmap 层级。
  64382. * @param arrayIndex @en The array index. @zh 要上传的数组索引。
  64383. */
  64384. uploadData(source: HTMLCanvasElement | HTMLImageElement | ArrayBufferView | ImageBitmap, level?: number, arrayIndex?: number): void;
  64385. /**
  64386. * @en Set mipmap level range for this texture.
  64387. * @zh 设置当前贴图的 mipmap 范围。
  64388. * @param baseLevel @en The base mipmap level. @zh 最低 mipmap 等级。
  64389. * @param maxLevel @en The maximum mipmap level. @zh 最高 mipmap 等级。
  64390. */
  64391. setMipRange(baseLevel: number, maxLevel: number): void;
  64392. /**
  64393. * @en Whether mipmaps are baked convolutional maps.
  64394. * @zh mipmaps 是否为烘焙出来的卷积图。
  64395. */
  64396. isUsingOfflineMipmaps(): boolean;
  64397. }
  64398. /**
  64399. * @en The index for all faces of the cube
  64400. * @zh 立方体每个面的约定索引。
  64401. */
  64402. export enum _cocos_asset_assets_texture_cube__FaceIndex {
  64403. right = 0,
  64404. left = 1,
  64405. top = 2,
  64406. bottom = 3,
  64407. front = 4,
  64408. back = 5
  64409. }
  64410. /**
  64411. * @en The texture cube mipmap interface
  64412. * @zh 立方体贴图的 Mipmap 接口。
  64413. */
  64414. export interface _cocos_asset_assets_texture_cube__ITextureCubeMipmap {
  64415. front: ImageAsset;
  64416. back: ImageAsset;
  64417. left: ImageAsset;
  64418. right: ImageAsset;
  64419. top: ImageAsset;
  64420. bottom: ImageAsset;
  64421. }
  64422. /**
  64423. * @en The MipmapAtlas region interface
  64424. * @zh MipmapAtlas的region接口。
  64425. */
  64426. export interface _cocos_asset_assets_texture_cube__IMipmapAtlasLayout {
  64427. left: number;
  64428. top: number;
  64429. width: number;
  64430. height: number;
  64431. level: number;
  64432. }
  64433. /**
  64434. * @en The texture cube MipmapAtlas interface
  64435. * @zh 立方体贴图的 MipmapAtlas 接口。
  64436. */
  64437. export interface _cocos_asset_assets_texture_cube__ITextureCubeMipmapAtlas {
  64438. atlas: _cocos_asset_assets_texture_cube__ITextureCubeMipmap;
  64439. layout: _cocos_asset_assets_texture_cube__IMipmapAtlasLayout[];
  64440. }
  64441. /**
  64442. * @en The way to fill mipmaps.
  64443. * @zh 填充mipmaps的方式。
  64444. */
  64445. export enum _cocos_asset_assets_texture_cube__MipmapMode {
  64446. /**
  64447. * @zh
  64448. * 不使用mipmaps
  64449. * @en
  64450. * Not using mipmaps
  64451. * @readonly
  64452. */
  64453. NONE = 0,
  64454. /**
  64455. * @zh
  64456. * 使用自动生成的mipmaps
  64457. * @en
  64458. * Using the automatically generated mipmaps
  64459. * @readonly
  64460. */
  64461. AUTO = 1,
  64462. /**
  64463. * @zh
  64464. * 使用卷积图填充mipmaps
  64465. * @en
  64466. * Filling mipmaps with convolutional maps
  64467. * @readonly
  64468. */
  64469. BAKED_CONVOLUTION_MAP = 2
  64470. }
  64471. export type _cocos_asset_assets_texture_cube__ITextureCubeCreateInfo = _cocos_asset_assets_texture_2d__ITexture2DCreateInfo;
  64472. export interface _cocos_asset_assets_texture_cube__ITextureCubeSerializeData {
  64473. base: string;
  64474. rgbe: boolean;
  64475. mipmapMode: number;
  64476. mipmapAtlas: {
  64477. front: string;
  64478. back: string;
  64479. left: string;
  64480. right: string;
  64481. top: string;
  64482. bottom: string;
  64483. };
  64484. mipmapLayout: [
  64485. ];
  64486. mipmaps: {
  64487. front: string;
  64488. back: string;
  64489. left: string;
  64490. right: string;
  64491. top: string;
  64492. bottom: string;
  64493. }[];
  64494. }
  64495. export type _cocos_asset_assets_simple_texture__PresumedGFXTextureInfo = Pick<gfx.TextureInfo, "usage" | "flags" | "format" | "levelCount">;
  64496. export type _cocos_asset_assets_simple_texture__PresumedGFXTextureViewInfo = Pick<gfx.TextureViewInfo, "texture" | "format" | "baseLevel" | "levelCount">;
  64497. export interface _cocos_asset_assets_render_texture__IRenderTextureCreateInfo {
  64498. name?: string;
  64499. width: number;
  64500. height: number;
  64501. passInfo?: gfx.RenderPassInfo;
  64502. externalResLow?: number;
  64503. externalResHigh?: number;
  64504. externalFlag?: gfx.TextureFlags;
  64505. }
  64506. /**
  64507. * @zh 缓存结构的接口定义,可以用于保存数据。
  64508. * @en Interface definition of a cache structure that can be used to save data.
  64509. */
  64510. export interface _cocos_asset_asset_manager_cache__ICache<T> {
  64511. /**
  64512. * @en
  64513. * Adds a Key-Value pair to cache.
  64514. *
  64515. * @zh
  64516. * 增加键值对到缓存中。
  64517. *
  64518. * @param key @en The key. @zh 要增加的键值对中的键。
  64519. * @param val @en The value. @zh 要增加的键值对中的值。
  64520. * @returns @en The value. @zh 新增的键值对中的值。
  64521. */
  64522. add(key: string, val: T): T;
  64523. /**
  64524. * @en
  64525. * Gets the cached content by key.
  64526. *
  64527. * @zh
  64528. * 通过 key 获取对应的 value。
  64529. *
  64530. * @param key @en The key. @zh 要查询的键。
  64531. * @returns @en The corresponding content. @zh 对应键值对中的值。
  64532. */
  64533. get(key: string): T | undefined | null;
  64534. /**
  64535. * @en
  64536. * Checks whether or not content exists by key.
  64537. *
  64538. * @zh
  64539. * 通过 Key 判断是否存在对应的内容。
  64540. *
  64541. * @param key @en The key. @zh 要查询的键。
  64542. * @returns @en True indicates that content of the key exists. @zh 返回 True 则表明该值存在。
  64543. */
  64544. has(key: string): boolean;
  64545. /**
  64546. * @en
  64547. * Removes the cached content by key.
  64548. *
  64549. * @zh
  64550. * 通过 Key 移除对应的内容。
  64551. *
  64552. * @param key @en The key. @zh 要移除的键值对中的键。
  64553. * @returns @en The removed content. @zh 移出的键值对中的值。
  64554. */
  64555. remove(key: string): T | undefined | null;
  64556. /**
  64557. * @en
  64558. * Clear all contents.
  64559. *
  64560. * @zh
  64561. * 清除所有内容。
  64562. */
  64563. clear(): void;
  64564. /**
  64565. *
  64566. * @en
  64567. * Enumerates all contents and invokes function.
  64568. *
  64569. * @zh
  64570. * 枚举所有内容并执行方法。
  64571. *
  64572. * @param func @en Function to be invoked. @zh 待执行的方法。
  64573. * @param func.val @en The value. @zh 传入的键值对中的值。
  64574. * @param func.key @en The corresponding key. @zh 传入的键值对中的键。
  64575. */
  64576. forEach(func: (val: T, key: string) => void): void;
  64577. /**
  64578. * @en
  64579. * Enumerates all content to find one element which can fulfill condition.
  64580. *
  64581. * @zh
  64582. * 枚举所有内容,找到一个可以满足条件的元素。
  64583. *
  64584. * @param predicate @en The condition function. @zh 条件方法。
  64585. * @returns @en The first content that meets this condition. @zh 第一个符合该条件的内容。
  64586. */
  64587. find(predicate: (val: T, key: string) => boolean): T | null;
  64588. /**
  64589. * @en
  64590. * The count of cached content.
  64591. *
  64592. * @zh
  64593. * 缓存数量。
  64594. */
  64595. readonly count: number;
  64596. /**
  64597. * @en
  64598. * Destroy this cache。
  64599. *
  64600. * @zh
  64601. * 销毁这个 cache.
  64602. */
  64603. destroy(): void;
  64604. }
  64605. namespace _cocos_asset_asset_manager_helper {
  64606. /**
  64607. * @en
  64608. * Extracts uuid from url.
  64609. *
  64610. * @zh
  64611. * 从 url 中提取 uuid。
  64612. *
  64613. * @param url @en The url to be converted. @zh 待转换的 url。
  64614. * @returns @en The uuid extracted from url. @zh url 转换为的 uuid。
  64615. *
  64616. * @example
  64617. * var url = 'res/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  64618. * var uuid = getUuidFromURL(url); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  64619. */
  64620. export function getUuidFromURL(url: string): string;
  64621. /**
  64622. * @en
  64623. * Transforms uuid to url.
  64624. *
  64625. * @zh
  64626. * 转换 uuid 为 url。
  64627. *
  64628. * @param uuid @en The uuid of asset. @zh 资源的 uuid。
  64629. * @param options @en Some optional parameters. @zh 一些可选参数。
  64630. * @param options.isNative @en Indicates whether the path you want is a native resource path. @zh 需要转换的路径是否是原生资源路径。
  64631. * @param options.nativeExt @en Extension of the native resource path, it is required when isNative is true. @zh 原生资源路径的扩展名,如果 `isNative` 为 true,则需要。
  64632. * @returns @en The url converted from uuid. @zh 从 uuid 转换而来的 url.
  64633. *
  64634. * @example
  64635. * // json path, 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  64636. * var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: false});
  64637. *
  64638. * // png path, 'assets/main/native/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.png';
  64639. * var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: true, nativeExt: '.png'});
  64640. *
  64641. */
  64642. export function getUrlWithUuid(uuid: string, options?: {
  64643. [k: string]: any;
  64644. isNative: boolean;
  64645. nativeExt?: string;
  64646. } | null): string;
  64647. /**
  64648. * @en
  64649. * Checks if the type of asset is scene.
  64650. *
  64651. * @zh
  64652. * 检查资源类型是否是场景。
  64653. *
  64654. * @param asset @en The asset to be checked. @zh 待检查的资源。
  64655. * @returns @en Whether or not the asset is a SceneAsset. @zh 此资源是否是场景资源。
  64656. *
  64657. */
  64658. export function isScene(asset: any): boolean;
  64659. /**
  64660. * @en
  64661. * Normalizes url, strip './' and '/'.
  64662. *
  64663. * @zh
  64664. * 标准化 url ,去除 './' 和 '/'。
  64665. *
  64666. * @param url @en The url to be normalized. @zh 待标准化的 url。
  64667. * @returns @en The normalized url. @zh 标准化后的 url。
  64668. */
  64669. export function normalize(url: string): string;
  64670. export function transform(input: string | string[] | Record<string, any> | Array<Record<string, any>>, options?: Record<string, any> | null): string | string[];
  64671. }
  64672. export type _cocos_asset_asset_manager_pack_manager__Unpacker = (packUuid: string[], data: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)) => void;
  64673. /**
  64674. * @en
  64675. * Handle the packed asset, include unpacking, loading, cache and so on. It is a singleton. All member can be accessed with `assetManager.packManager`
  64676. *
  64677. * @zh
  64678. * 处理打包资源,包括拆包,加载,缓存等等,这是一个单例, 所有成员能通过 `assetManager.packManager` 访问
  64679. *
  64680. */
  64681. export class _cocos_asset_asset_manager_pack_manager__PackManager {
  64682. /**
  64683. * @en
  64684. * Unpack the json, revert to what it was before packing
  64685. *
  64686. * @zh
  64687. * 拆解 json 包,恢复为打包之前的内容
  64688. *
  64689. * @param pack - The pack
  64690. * @param json - The content of pack
  64691. * @param options - Some optional parameters
  64692. * @param onComplete - Callback when finish unpacking
  64693. * @param onComplete.err - The occurred error, null indicates success
  64694. * @param onComplete.content - The unpacked assets
  64695. *
  64696. * @example
  64697. * downloader.downloadFile('pack.json', { xhrResponseType: 'json'}, null, (err, file) => {
  64698. * packManager.unpackJson(['a', 'b'], file, null, (err, data) => console.log(err));
  64699. * });
  64700. *
  64701. */
  64702. unpackJson(pack: string[], json: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: Record<string, any> | null) => void)): void;
  64703. init(): void;
  64704. /**
  64705. * @en
  64706. * Register custom handler if you want to change default behavior or extend packManager to unpack other format pack
  64707. *
  64708. * @zh
  64709. * 当你想修改默认行为或者拓展 packManager 来拆分其他格式的包时可以注册自定义的 handler
  64710. *
  64711. * @param type - Extension likes '.bin' or map likes {'.bin': binHandler, '.ab': abHandler}
  64712. * @param handler - handler
  64713. * @param handler.packUuid - The uuid of pack
  64714. * @param handler.data - The content of pack
  64715. * @param handler.options - Some optional parameters
  64716. * @param handler.onComplete - Callback when finishing unpacking
  64717. *
  64718. * @example
  64719. * packManager.register('.bin', (packUuid, file, options, onComplete) => onComplete(null, null));
  64720. * packManager.register({
  64721. * '.bin': (packUuid, file, options, onComplete) => onComplete(null, null),
  64722. * '.ab': (packUuid, file, options, onComplete) => onComplete(null, null),
  64723. * });
  64724. */
  64725. register(type: string, handler: _cocos_asset_asset_manager_pack_manager__Unpacker): void;
  64726. register(map: Record<string, _cocos_asset_asset_manager_pack_manager__Unpacker>): void;
  64727. /**
  64728. * @en
  64729. * Use corresponding handler to unpack package
  64730. *
  64731. * @zh
  64732. * 用对应的 handler 来进行解包
  64733. *
  64734. * @method unpack
  64735. * @param pack - The uuid of packed assets
  64736. * @param data - The packed data
  64737. * @param type - The type indicates that which handler should be used to download, such as '.jpg'
  64738. * @param options - Some optional parameter
  64739. * @param onComplete - callback when finishing unpacking
  64740. * @param onComplete.err - The occurred error, null indicates success
  64741. * @param onComplete.data - Original assets
  64742. *
  64743. * @example
  64744. * downloader.downloadFile('pack.json', {xhrResponseType: 'json'}, null, (err, file) => {
  64745. * packManager.unpack(['2fawq123d', '1zsweq23f'], file, '.json', null, (err, data) => console.log(err));
  64746. * });
  64747. *
  64748. */
  64749. unpack(pack: string[], data: any, type: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)): void;
  64750. /**
  64751. * @en
  64752. * Download request item, If item is not in any package, download as usual. Otherwise, download the corresponding package and unpack it.
  64753. * And then retrieve the corresponding content form it.
  64754. *
  64755. * @zh
  64756. * 下载请求对象,如果请求对象不在任何包内,则正常下载,否则下载对应的 package 并进行拆解,并取回包内对应的内容
  64757. *
  64758. * @param item - Some item you want to download
  64759. * @param options - Some optional parameters
  64760. * @param onComplete - Callback when finished
  64761. * @param onComplete.err - The occurred error, null indicates success
  64762. * @param onComplete.data - The unpacked data retrieved from package
  64763. *
  64764. * @example
  64765. * var requestItem = AssetManager.RequestItem.create();
  64766. * requestItem.uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  64767. * requestItem.info = config.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  64768. * packManager.load(requestItem, null, (err, data) => console.log(err));
  64769. *
  64770. */
  64771. load(item: AssetManager.RequestItem, options: Record<string, any> | null, onComplete: ((err: Error | null, data?: any) => void)): void;
  64772. }
  64773. export type _cocos_asset_asset_manager_factory__CreateHandler = (id: string, data: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: Asset | AssetManager.Bundle | null) => void)) => void;
  64774. export class _cocos_asset_asset_manager_factory__Factory {
  64775. register(type: string | Record<string, _cocos_asset_asset_manager_factory__CreateHandler>, handler?: _cocos_asset_asset_manager_factory__CreateHandler): void;
  64776. create(id: string, data: any, type: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: Asset | AssetManager.Bundle | null) => void)): void;
  64777. }
  64778. export function _cocos_asset_asset_manager_preprocess__default(task: AssetManager.Task, done: ((err?: Error | null) => void)): void;
  64779. export function _cocos_asset_asset_manager_fetch__default(task: AssetManager.Task, done: ((err?: Error | null) => void)): void;
  64780. export function _cocos_asset_asset_manager_load__default(task: AssetManager.Task, done: ((err?: Error | null) => void)): void;
  64781. export interface _cocos_asset_asset_manager_shared__IRequest extends Record<string, any> {
  64782. uuid?: string;
  64783. url?: string;
  64784. path?: string;
  64785. dir?: string;
  64786. scene?: string;
  64787. }
  64788. export interface _cocos_asset_asset_manager_task__ITaskOption {
  64789. onComplete?: ((err: Error | null | undefined, data: any) => void) | null;
  64790. onProgress?: ((...args: any[]) => void) | null;
  64791. onError?: ((...args: any[]) => void) | null;
  64792. input: any;
  64793. progress?: any;
  64794. options?: Record<string, any> | null;
  64795. }
  64796. /**
  64797. * @en Information about the merged files.
  64798. * @zh 合并文件的信息。
  64799. */
  64800. export interface _cocos_asset_asset_manager_config__IPackInfo {
  64801. /**
  64802. * @en The unique id of this merged file.
  64803. * @zh 此合并文件的唯一 id.
  64804. */
  64805. uuid: string;
  64806. /**
  64807. * @en The uuid of all the assets contained in this file.
  64808. * @zh 此文件中包含的所有资源的 uuid。
  64809. */
  64810. packedUuids: string[];
  64811. /**
  64812. * @en The extension of this merged file on the file system, default is 'json'.
  64813. * @zh 此合并文件在文件系统上的扩展名,默认为 'json'.
  64814. */
  64815. ext: string;
  64816. }
  64817. /**
  64818. * @en Th asset's meta information. Used to obtain information about the asset.
  64819. * @zh 资源的元信息。用于获取资源的相关信息。
  64820. */
  64821. export interface _cocos_asset_asset_manager_config__IAssetInfo {
  64822. /**
  64823. * @en The uuid of asset.
  64824. * @zh 资源的 uuid.
  64825. */
  64826. uuid: string;
  64827. /**
  64828. * @en Information about the file where the asset is located. A asset can be in multiple merged files.
  64829. * @zh 资源所在文件的相关信息。一个资源可在多个合并文件中。
  64830. */
  64831. packs?: _cocos_asset_asset_manager_config__IPackInfo[];
  64832. /**
  64833. * @en The redirect bundle of this asset. When multiple bundles with different priorities reference to the same asset,
  64834. * the asset will be stored in the bundle with the higher priority first, while the other bundles will store a record
  64835. * and the `redirect` property of that record will point to the bundle that actually stores the resource.
  64836. * @zh 资源所重定向的 bundle。当多个 bundle 引用同一份资源,且优先级不一样时,资源会优先存储在优先级高的 bundle 中,
  64837. * 其他 bundle 则会存储一条记录,并且该记录的 redirect 属性将指向真实存储此资源的 bundle。
  64838. */
  64839. redirect?: string;
  64840. /**
  64841. * @en The version of the asset.
  64842. * @zh 资源的版本号。
  64843. */
  64844. ver?: string;
  64845. /**
  64846. * @en The version of the native dependency of the asset.
  64847. * @zh 资源的原生依赖的版本号。
  64848. */
  64849. nativeVer?: string;
  64850. /**
  64851. * @en The extension of the asset, or 'json' if it is null.
  64852. * This property is used to mark assets with special extensions like 'CCON'.
  64853. * @zh 资源的原生依赖的版本号。
  64854. */
  64855. extension?: string;
  64856. }
  64857. /**
  64858. * @en Addressable asset information, you can look up the path of the asset in the project and the type of the asset.
  64859. * @zh 可寻址资源的信息,你可以查询到该资源在项目中的路径与资源的类型。
  64860. */
  64861. export interface _cocos_asset_asset_manager_config__IAddressableInfo extends _cocos_asset_asset_manager_config__IAssetInfo {
  64862. /**
  64863. * @en The relative path of this asset in the project relative to the bundle folder.
  64864. * @zh 此资源在项目中相对于 bundle 文件夹的相对路径。
  64865. */
  64866. path: string;
  64867. /**
  64868. * @en The type of the asset.
  64869. * @zh 此资源的类型。
  64870. */
  64871. ctor: __types_globals__Constructor<Asset>;
  64872. }
  64873. /**
  64874. * @en Information about the scene asset.
  64875. * @zh 场景资源的相关信息。
  64876. */
  64877. export interface _cocos_asset_asset_manager_config__ISceneInfo extends _cocos_asset_asset_manager_config__IAssetInfo {
  64878. /**
  64879. * @en The path of the scene asset in the project relative to the bundle folder.
  64880. * @zh 场景资源在项目中相对 bundle 文件夹的路径。
  64881. */
  64882. url: string;
  64883. }
  64884. export interface _cocos_asset_asset_manager_config__IConfigOption {
  64885. importBase: string;
  64886. nativeBase: string;
  64887. base: string;
  64888. name: string;
  64889. deps: string[];
  64890. uuids: string[];
  64891. paths: Record<string, any[]>;
  64892. scenes: Record<string, string>;
  64893. packs: Record<string, string[]>;
  64894. versions: {
  64895. import: string[];
  64896. native: string[];
  64897. };
  64898. redirect: string[];
  64899. debug: boolean;
  64900. types: string[];
  64901. extensionMap: Record<string, string[]>;
  64902. }
  64903. export interface _cocos_asset_asset_manager_depend_util__IDependencies {
  64904. nativeDep?: Record<string, any>;
  64905. deps: string[];
  64906. parsedFromExistAsset?: boolean;
  64907. persistDeps?: string[];
  64908. }
  64909. export function _cocos_asset_asset_manager_download_dom_image__default(url: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: HTMLImageElement | null) => void)): HTMLImageElement;
  64910. export type _cocos_asset_asset_manager_downloader__DownloadHandler = (url: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any) => void)) => void;
  64911. export type _cocos_asset_asset_manager_download_file__FileProgressCallback = (loaded: number, total: number) => void;
  64912. export function _cocos_asset_asset_manager_download_file__default(url: string, options: Record<string, any>, onProgress: _cocos_asset_asset_manager_download_file__FileProgressCallback | null | undefined, onComplete: ((err: Error | null, data?: any) => void)): XMLHttpRequest;
  64913. export function _cocos_asset_asset_manager_download_script__default(url: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any | null) => void)): HTMLScriptElement | null;
  64914. export type _cocos_asset_asset_manager_deprecated__LoadProgressCallback = (completedCount: number, totalCount: number, item: any) => void;
  64915. export type _cocos_asset_asset_manager_deprecated__LoadCompleteCallback<T> = (error: Error | null, asset: T) => void;
  64916. export type _cocos_asset_asset_manager_deprecated__LoadDirCompleteCallback<T> = (error: Error | null, asset: T[], urls: string[]) => void;
  64917. export interface _extensions_ccpool_node_pool__IPoolHandlerComponent extends Component {
  64918. unuse(): void;
  64919. reuse(args: any): void;
  64920. }
  64921. export type _extensions_ccpool_node_pool__Constructor<T = {}> = new (...args: any[]) => T;
  64922. export type _pal_input__InputSourceButton = import('pal/input/input-source').InputSourceButton;
  64923. export type _pal_input__InputSourceDpad = import('pal/input/input-source').InputSourceDpad;
  64924. export type _pal_input__InputSourceStick = import('pal/input/input-source').InputSourceStick;
  64925. export type _pal_input__InputSourcePosition = import('pal/input/input-source').InputSourcePosition;
  64926. export type _pal_input__InputSourceOrientation = import('pal/input/input-source').InputSourceOrientation;
  64927. /**
  64928. * Class designed for gamepad input
  64929. */
  64930. export class _pal_input__GamepadInputDevice {
  64931. public static all: _pal_input__GamepadInputDevice[];
  64932. public static xr: (_pal_input__GamepadInputDevice | null);
  64933. /**
  64934. * @en The gamepad device id
  64935. * @zh 手柄设备 id
  64936. */
  64937. public get deviceId(): number;
  64938. /**
  64939. * @en whether the gamepad is connected
  64940. * @zh 手柄是否处于连接状态
  64941. */
  64942. public get connected(): boolean;
  64943. /**
  64944. * @en The control button in the north direction which is generally the button Y
  64945. * @zh 处于北向的控制按键,一般是按键 Y
  64946. */
  64947. public get buttonNorth(): _pal_input__InputSourceButton;
  64948. /**
  64949. * @en The control button in the east direction which is generally the button B
  64950. * @zh 处于东向的控制按键,一般是按键 B
  64951. */
  64952. public get buttonEast(): _pal_input__InputSourceButton;
  64953. /**
  64954. * @en The control button in the west direction which is generally the button X
  64955. * @zh 处于西向的控制按键,一般是按键 X
  64956. */
  64957. public get buttonWest(): _pal_input__InputSourceButton;
  64958. /**
  64959. * @en The control button in the south direction which is generally the button A
  64960. * @zh 处于南向的控制按键,一般是按键 A
  64961. */
  64962. public get buttonSouth(): _pal_input__InputSourceButton;
  64963. /**
  64964. * @en The button L1
  64965. * @zh 按键 L1
  64966. */
  64967. public get buttonL1(): _pal_input__InputSourceButton;
  64968. /**
  64969. * @en The button L2
  64970. * @zh 按键 L2
  64971. */
  64972. public get buttonL2(): _pal_input__InputSourceButton;
  64973. /**
  64974. * @en The button L3
  64975. * @zh 按键 L3
  64976. */
  64977. public get buttonL3(): _pal_input__InputSourceButton;
  64978. /**
  64979. * @en The button R1
  64980. * @zh 按键 R1
  64981. */
  64982. public get buttonR1(): _pal_input__InputSourceButton;
  64983. /**
  64984. * @en The button R2
  64985. * @zh 按键 R2
  64986. */
  64987. public get buttonR2(): _pal_input__InputSourceButton;
  64988. /**
  64989. * @en The button R3
  64990. * @zh 按键 R3
  64991. */
  64992. public get buttonR3(): _pal_input__InputSourceButton;
  64993. // public get buttonTouchPad (): InputSourceButton;
  64994. // public get buttonHome (): InputSourceButton;
  64995. /**
  64996. * @en The button Share
  64997. * @zh 分享按键
  64998. */
  64999. public get buttonShare(): _pal_input__InputSourceButton;
  65000. /**
  65001. * @en The button Options
  65002. * @zh 选项按键
  65003. */
  65004. public get buttonOptions(): _pal_input__InputSourceButton;
  65005. /**
  65006. * @en The dpad buttons
  65007. * @zh 方向按键
  65008. */
  65009. public get dpad(): _pal_input__InputSourceDpad;
  65010. /**
  65011. * @en The left stick
  65012. * @zh 左摇杆
  65013. */
  65014. public get leftStick(): _pal_input__InputSourceStick;
  65015. /**
  65016. * @en The right stick
  65017. * @zh 右摇杆
  65018. */
  65019. public get rightStick(): _pal_input__InputSourceStick;
  65020. /**
  65021. * @en The button Start
  65022. * @zh 开始按键
  65023. */
  65024. public get buttonStart(): _pal_input__InputSourceButton;
  65025. /**
  65026. * @en The grab Left Grip
  65027. * @zh 左手柄握住
  65028. */
  65029. public get gripLeft(): _pal_input__InputSourceButton;
  65030. /**
  65031. * @en The grab Right Grip
  65032. * @zh 右手柄握住
  65033. */
  65034. public get gripRight(): _pal_input__InputSourceButton;
  65035. /**
  65036. * @en The position Left hand
  65037. * @zh 左手位置
  65038. */
  65039. public get handLeftPosition(): _pal_input__InputSourcePosition;
  65040. /**
  65041. * @en The orientation Left hand
  65042. * @zh 左手方向
  65043. */
  65044. public get handLeftOrientation(): _pal_input__InputSourceOrientation;
  65045. /**
  65046. * @en The position Right hand
  65047. * @zh 右手位置
  65048. */
  65049. public get handRightPosition(): _pal_input__InputSourcePosition;
  65050. /**
  65051. * @en The orientation Right hand
  65052. * @zh 右手方向
  65053. */
  65054. public get handRightOrientation(): _pal_input__InputSourceOrientation;
  65055. /**
  65056. * @en The position Left aim
  65057. * @zh 左射线位置
  65058. */
  65059. public get aimLeftPosition(): _pal_input__InputSourcePosition;
  65060. /**
  65061. * @en The orientation Left aim
  65062. * @zh 左射线方向
  65063. */
  65064. public get aimLeftOrientation(): _pal_input__InputSourceOrientation;
  65065. /**
  65066. * @en The position Right aim
  65067. * @zh 右射线位置
  65068. */
  65069. public get aimRightPosition(): _pal_input__InputSourcePosition;
  65070. /**
  65071. * @en The orientation Right aim
  65072. * @zh 右射线方向
  65073. */
  65074. public get aimRightOrientation(): _pal_input__InputSourceOrientation;
  65075. }
  65076. /**
  65077. * Class designed for handle input.
  65078. */
  65079. export class _pal_input__HandleInputDevice {
  65080. /**
  65081. * @en The control button in the north direction which is generally the button Y
  65082. * @zh 处于北向的控制按键,一般是按键 Y
  65083. */
  65084. public get buttonNorth(): _pal_input__InputSourceButton;
  65085. /**
  65086. * @en The control button in the east direction which is generally the button B
  65087. * @zh 处于东向的控制按键,一般是按键 B
  65088. */
  65089. public get buttonEast(): _pal_input__InputSourceButton;
  65090. /**
  65091. * @en The control button in the west direction which is generally the button X
  65092. * @zh 处于西向的控制按键,一般是按键 X
  65093. */
  65094. public get buttonWest(): _pal_input__InputSourceButton;
  65095. /**
  65096. * @en The control button in the south direction which is generally the button A
  65097. * @zh 处于南向的控制按键,一般是按键 A
  65098. */
  65099. public get buttonSouth(): _pal_input__InputSourceButton;
  65100. /**
  65101. * @en The button Left Trigger
  65102. * @zh 左扳机按键
  65103. */
  65104. public get buttonTriggerLeft(): _pal_input__InputSourceButton;
  65105. /**
  65106. * @en The button Right Trigger
  65107. * @zh 右扳机按键
  65108. */
  65109. public get buttonTriggerRight(): _pal_input__InputSourceButton;
  65110. /**
  65111. * @en The grab Left Trigger
  65112. * @zh 左扳机扣动
  65113. */
  65114. public get triggerLeft(): _pal_input__InputSourceButton;
  65115. /**
  65116. * @en The grab Right Trigger
  65117. * @zh 右扳机扣动
  65118. */
  65119. public get triggerRight(): _pal_input__InputSourceButton;
  65120. /**
  65121. * @en The grab Left Grip
  65122. * @zh 左手柄握住
  65123. */
  65124. public get gripLeft(): _pal_input__InputSourceButton;
  65125. /**
  65126. * @en The grab Right Grip
  65127. * @zh 右手柄握住
  65128. */
  65129. public get gripRight(): _pal_input__InputSourceButton;
  65130. /**
  65131. * @en The left stick
  65132. * @zh 左摇杆
  65133. */
  65134. public get leftStick(): _pal_input__InputSourceStick;
  65135. /**
  65136. * @en The right stick
  65137. * @zh 右摇杆
  65138. */
  65139. public get rightStick(): _pal_input__InputSourceStick;
  65140. /**
  65141. * @en The button Left Stick
  65142. * @zh 左摇杆按键
  65143. */
  65144. public get buttonLeftStick(): _pal_input__InputSourceButton;
  65145. /**
  65146. * @en The button Right Stick
  65147. * @zh 右摇杆按键
  65148. */
  65149. public get buttonRightStick(): _pal_input__InputSourceButton;
  65150. /**
  65151. * @en The button Options
  65152. * @zh 选项按键
  65153. */
  65154. public get buttonOptions(): _pal_input__InputSourceButton;
  65155. /**
  65156. * @en The button Start
  65157. * @zh 开始按键
  65158. */
  65159. public get buttonStart(): _pal_input__InputSourceButton;
  65160. /**
  65161. * @en The position Left hand
  65162. * @zh 左手位置
  65163. */
  65164. public get handLeftPosition(): _pal_input__InputSourcePosition;
  65165. /**
  65166. * @en The orientation Left hand
  65167. * @zh 左手方向
  65168. */
  65169. public get handLeftOrientation(): _pal_input__InputSourceOrientation;
  65170. /**
  65171. * @en The position Right hand
  65172. * @zh 右手位置
  65173. */
  65174. public get handRightPosition(): _pal_input__InputSourcePosition;
  65175. /**
  65176. * @en The orientation Right hand
  65177. * @zh 右手方向
  65178. */
  65179. public get handRightOrientation(): _pal_input__InputSourceOrientation;
  65180. /**
  65181. * @en The position Left aim
  65182. * @zh 左射线位置
  65183. */
  65184. public get aimLeftPosition(): _pal_input__InputSourcePosition;
  65185. /**
  65186. * @en The orientation Left aim
  65187. * @zh 左射线方向
  65188. */
  65189. public get aimLeftOrientation(): _pal_input__InputSourceOrientation;
  65190. /**
  65191. * @en The position Right aim
  65192. * @zh 右射线位置
  65193. */
  65194. public get aimRightPosition(): _pal_input__InputSourcePosition;
  65195. /**
  65196. * @en The orientation Right aim
  65197. * @zh 右射线方向
  65198. */
  65199. public get aimRightOrientation(): _pal_input__InputSourceOrientation;
  65200. }
  65201. /**
  65202. * Class designed for HMD input.
  65203. */
  65204. export class _pal_input__HMDInputDevice {
  65205. /**
  65206. * @en The position Left view
  65207. * @zh 左窗口位置
  65208. */
  65209. public get viewLeftPosition(): _pal_input__InputSourcePosition;
  65210. /**
  65211. * @en The orientation Left view
  65212. * @zh 左窗口方向
  65213. */
  65214. public get viewLeftOrientation(): _pal_input__InputSourceOrientation;
  65215. /**
  65216. * @en The position Right view
  65217. * @zh 右窗口位置
  65218. */
  65219. public get viewRightPosition(): _pal_input__InputSourcePosition;
  65220. /**
  65221. * @en The orientation Right view
  65222. * @zh 右窗口方向
  65223. */
  65224. public get viewRightOrientation(): _pal_input__InputSourceOrientation;
  65225. /**
  65226. * @en The position Middle head
  65227. * @zh 头部中间位置
  65228. */
  65229. public get headMiddlePosition(): _pal_input__InputSourcePosition;
  65230. /**
  65231. * @en The orientation Middle head
  65232. * @zh 头部中间方向
  65233. */
  65234. public get headMiddleOrientation(): _pal_input__InputSourceOrientation;
  65235. }
  65236. /**
  65237. * Class designed for Handheld input.
  65238. */
  65239. export class _pal_input__HandheldInputDevice {
  65240. /**
  65241. * @en The position handheld
  65242. * @zh 手持设备相机位置
  65243. */
  65244. public get handheldPosition(): _pal_input__InputSourcePosition;
  65245. /**
  65246. * @en The orientation handheld
  65247. * @zh 手持设备相机方向
  65248. */
  65249. public get handheldOrientation(): _pal_input__InputSourceOrientation;
  65250. }
  65251. export interface _cocos_input_input__InputEventMap {
  65252. [Input.EventType.MOUSE_DOWN]: (event: EventMouse) => void;
  65253. [Input.EventType.MOUSE_MOVE]: (event: EventMouse) => void;
  65254. [Input.EventType.MOUSE_UP]: (event: EventMouse) => void;
  65255. [Input.EventType.MOUSE_WHEEL]: (event: EventMouse) => void;
  65256. [Input.EventType.TOUCH_START]: (event: EventTouch) => void;
  65257. [Input.EventType.TOUCH_MOVE]: (event: EventTouch) => void;
  65258. [Input.EventType.TOUCH_END]: (event: EventTouch) => void;
  65259. [Input.EventType.TOUCH_CANCEL]: (event: EventTouch) => void;
  65260. [Input.EventType.KEY_DOWN]: (event: EventKeyboard) => void;
  65261. [Input.EventType.KEY_PRESSING]: (event: EventKeyboard) => void;
  65262. [Input.EventType.KEY_UP]: (event: EventKeyboard) => void;
  65263. [Input.EventType.DEVICEMOTION]: (event: EventAcceleration) => void;
  65264. [Input.EventType.GAMEPAD_CHANGE]: (event: EventGamepad) => void;
  65265. [Input.EventType.GAMEPAD_INPUT]: (event: EventGamepad) => void;
  65266. [Input.EventType.HANDLE_INPUT]: (event: EventHandle) => void;
  65267. [Input.EventType.HANDLE_POSE_INPUT]: (event: EventHandle) => void;
  65268. [Input.EventType.HMD_POSE_INPUT]: (event: EventHMD) => void;
  65269. [Input.EventType.HANDHELD_POSE_INPUT]: (event: EventHandheld) => void;
  65270. }
  65271. export interface _cocos_input_system_event__SystemEventMap {
  65272. [SystemEvent.EventType.MOUSE_DOWN]: (event: EventMouse) => void;
  65273. [SystemEvent.EventType.MOUSE_MOVE]: (event: EventMouse) => void;
  65274. [SystemEvent.EventType.MOUSE_UP]: (event: EventMouse) => void;
  65275. [SystemEvent.EventType.MOUSE_WHEEL]: (event: EventMouse) => void;
  65276. [SystemEvent.EventType.TOUCH_START]: (touch: Touch, event: EventTouch) => void;
  65277. [SystemEvent.EventType.TOUCH_MOVE]: (touch: Touch, event: EventTouch) => void;
  65278. [SystemEvent.EventType.TOUCH_END]: (touch: Touch, event: EventTouch) => void;
  65279. [SystemEvent.EventType.TOUCH_CANCEL]: (touch: Touch, event: EventTouch) => void;
  65280. [SystemEvent.EventType.KEY_DOWN]: (event: EventKeyboard) => void;
  65281. [SystemEvent.EventType.KEY_UP]: (event: EventKeyboard) => void;
  65282. [SystemEvent.EventType.DEVICEMOTION]: (event: EventAcceleration) => void;
  65283. }
  65284. export interface _cocos_rendering_custom_private__ProgramProxy {
  65285. readonly name: string;
  65286. readonly shader: gfx.Shader;
  65287. }
  65288. export interface _cocos_rendering_custom_private__ProgramLibrary {
  65289. addEffect(effectAsset: EffectAsset): void;
  65290. precompileEffect(device: gfx.Device, effectAsset: EffectAsset): void;
  65291. getKey(phaseID: number, programName: string, defines: renderer.MacroRecord): string;
  65292. getPipelineLayout(device: gfx.Device, phaseID: number, programName: string): gfx.PipelineLayout;
  65293. getMaterialDescriptorSetLayout(device: gfx.Device, phaseID: number, programName: string): gfx.DescriptorSetLayout;
  65294. getLocalDescriptorSetLayout(device: gfx.Device, phaseID: number, programName: string): gfx.DescriptorSetLayout;
  65295. getProgramInfo(phaseID: number, programName: string): renderer.IProgramInfo;
  65296. getShaderInfo(phaseID: number, programName: string): gfx.ShaderInfo;
  65297. getProgramVariant(device: gfx.Device, phaseID: number, name: string, defines: renderer.MacroRecord, key?: string): _cocos_rendering_custom_private__ProgramProxy | null;
  65298. getBlockSizes(phaseID: number, programName: string): number[];
  65299. getHandleMap(phaseID: number, programName: string): Record<string, number>;
  65300. getProgramID(phaseID: number, programName: string): number;
  65301. getDescriptorNameID(name: string): number;
  65302. getDescriptorName(nameID: number): string;
  65303. }
  65304. export class _cocos_rendering_post_process_components_blit_screen__BlitScreenMaterial {
  65305. protected _material: Material | undefined;
  65306. get material(): Material | undefined;
  65307. set material(v: Material | undefined);
  65308. enable: boolean;
  65309. }
  65310. export function _cocos_rendering_post_process_passes_setting_pass__getSetting<T extends postProcess.PostProcessSetting>(settingClass: new () => T): T;
  65311. export class _cocos_rendering_post_process_utils_pass_context__PassContext {
  65312. clearFlag: gfx.ClearFlagBit;
  65313. clearColor: gfx.Color;
  65314. clearDepthColor: gfx.Color;
  65315. ppl: rendering.Pipeline | undefined;
  65316. camera: renderer.scene.Camera | undefined;
  65317. material: Material | undefined;
  65318. pass: rendering.RenderPassBuilder | undefined;
  65319. rasterWidth: number;
  65320. rasterHeight: number;
  65321. layoutName: string;
  65322. shadingScale: number;
  65323. viewport: gfx.Rect;
  65324. passViewport: gfx.Rect;
  65325. passPathName: string;
  65326. passVersion: number;
  65327. isFinalCamera: boolean;
  65328. isFinalPass: boolean;
  65329. depthSlotName: string;
  65330. shadowPass: any;
  65331. forwardPass: any;
  65332. postProcess: postProcess.PostProcess | undefined;
  65333. maxSpotLights: number;
  65334. maxSphereLights: number;
  65335. maxPointLights: number;
  65336. maxRangedDirLights: number;
  65337. setClearFlag(clearFlag: gfx.ClearFlagBit): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65338. setClearColor(x: number, y: number, z: number, w: number): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65339. setClearDepthColor(x: number, y: number, z: number, w: number): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65340. version(): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65341. clearBlack(): void;
  65342. addRenderPass(layoutName: string, passName: string): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65343. addSceneLights(queue: rendering.RenderQueueBuilder, camera: renderer.scene.Camera, flags?: rendering.SceneFlags): void;
  65344. updateViewPort(): void;
  65345. updatePassViewPort(shadingScale?: number, offsetScale?: number): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65346. addRasterView(name: string, format: gfx.Format, offscreen?: boolean, residency?: rendering.ResourceResidency): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65347. setPassInput(inputName: string, shaderName: string): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65348. blitScreen(passIdx?: number): _cocos_rendering_post_process_utils_pass_context__PassContext;
  65349. }
  65350. export function _cocos_rendering_custom_define__getCameraUniqueID(camera: renderer.scene.Camera): number;
  65351. export class _cocos_rendering_post_process_components_fxaa__FXAA extends postProcess.PostProcessSetting {
  65352. }
  65353. /**
  65354. * @engineInternal Since v3.7.2 this is an engine private interface.
  65355. */
  65356. export interface _cocos_dragon_bones_ArmatureCache__ArmatureFrameSegment {
  65357. indexCount: number;
  65358. vfCount: number;
  65359. vertexCount: number;
  65360. tex: Texture2D;
  65361. blendMode: dragonBones.BlendMode;
  65362. }
  65363. /**
  65364. * @engineInternal Since v3.7.2 this is an engine private interface.
  65365. */
  65366. export interface _cocos_dragon_bones_ArmatureCache__ArmatureFrameColor {
  65367. r: number;
  65368. g: number;
  65369. b: number;
  65370. a: number;
  65371. vfOffset?: number;
  65372. }
  65373. /**
  65374. * @engineInternal Since v3.7.2 this is an engine private interface.
  65375. */
  65376. export interface _cocos_dragon_bones_ArmatureCache__ArmatureFrameBoneInfo {
  65377. globalTransformMatrix: dragonBones.Matrix;
  65378. }
  65379. /**
  65380. * @engineInternal Since v3.7.2 this is an engine private interface.
  65381. */
  65382. export interface _cocos_dragon_bones_ArmatureCache__ArmatureFrame {
  65383. segments: _cocos_dragon_bones_ArmatureCache__ArmatureFrameSegment[];
  65384. colors: _cocos_dragon_bones_ArmatureCache__ArmatureFrameColor[];
  65385. boneInfos: _cocos_dragon_bones_ArmatureCache__ArmatureFrameBoneInfo[];
  65386. vertices: Float32Array;
  65387. uintVert: Uint32Array;
  65388. indices: Uint16Array;
  65389. }
  65390. /**
  65391. * @engineInternal Since v3.7.2 this is an engine private interface.
  65392. */
  65393. export interface _cocos_dragon_bones_ArmatureCache__ArmatureInfo {
  65394. curAnimationCache: _cocos_dragon_bones_ArmatureCache__AnimationCache | null;
  65395. armature: dragonBones.Armature;
  65396. animationsCache: {
  65397. [key: string]: _cocos_dragon_bones_ArmatureCache__AnimationCache;
  65398. };
  65399. }
  65400. /**
  65401. * @engineInternal Since v3.7.2 this is an engine private class.
  65402. * @en Cache all frames in an animation.
  65403. * @zh 缓存所有动画帧。
  65404. */
  65405. export class _cocos_dragon_bones_ArmatureCache__AnimationCache {
  65406. maxVertexCount: number;
  65407. maxIndexCount: number;
  65408. _privateMode: boolean;
  65409. _inited: boolean;
  65410. _invalid: boolean;
  65411. _enableCacheAttachedInfo: boolean;
  65412. frames: SafeArray<_cocos_dragon_bones_ArmatureCache__ArmatureFrame>;
  65413. totalTime: number;
  65414. isCompleted: boolean;
  65415. _frameIdx: number;
  65416. _armatureInfo: _cocos_dragon_bones_ArmatureCache__ArmatureInfo | null;
  65417. _animationName: string | null;
  65418. _tempSegments: _cocos_dragon_bones_ArmatureCache__ArmatureFrameSegment[] | null;
  65419. _tempColors: _cocos_dragon_bones_ArmatureCache__ArmatureFrameColor[] | null;
  65420. _tempBoneInfos: _cocos_dragon_bones_ArmatureCache__ArmatureFrameBoneInfo[] | null;
  65421. constructor();
  65422. /**
  65423. * @en Clears all animation frames cached.
  65424. * @zh 清除所有缓存动画帧。
  65425. */
  65426. clear(): void;
  65427. /**
  65428. * @en Start to play cached frames.
  65429. * @zh 开始播放缓存动画帧。
  65430. */
  65431. begin(): void;
  65432. /**
  65433. * @en Complete to play cached frames.
  65434. * @zh 完成播放缓存动画帧。
  65435. */
  65436. end(): void;
  65437. /**
  65438. * @en Update to specified animation frame.
  65439. * @zh 更新动画到指定帧序列。
  65440. * @param toFrameIdx @en Frame index. @zh 帧序列。
  65441. */
  65442. updateToFrame(toFrameIdx?: number): void;
  65443. /**
  65444. * @en Check if initialized or not.
  65445. * @zh 检查是否已初始化。
  65446. * @returns @en True means has been initialized, false means not.
  65447. * @zh True 表示已初始化完成,false 表示还没初始化。
  65448. */
  65449. isInited(): boolean;
  65450. /**
  65451. * @en Check if current state is invalid.
  65452. * @zh 检查当前状态是否为无效。
  65453. * @returns @zh True means invalid, false means valid.
  65454. * @en True 表示当前数据为无效状态,false 表示当前数据有效。
  65455. */
  65456. isInvalid(): boolean;
  65457. /**
  65458. * @en Mark all cached frames as invalid.
  65459. * @zh 将所有缓存帧标记为无效的。
  65460. */
  65461. invalidAllFrame(): void;
  65462. /**
  65463. * @en Update all cached frames.
  65464. * @zh 更新所有缓存帧。
  65465. */
  65466. updateAllFrame(): void;
  65467. /**
  65468. * @en Enable attached information.
  65469. * @zh 启用挂载附着信息。
  65470. */
  65471. enableCacheAttachedInfo(): void;
  65472. /**
  65473. * @en Update to specified animation frame of armature.
  65474. * @zh 更新龙骨动画到指定帧序列。
  65475. * @param armature @en Armature. @zh 指定骨架。
  65476. * @param index @en Frame index. @zh 帧序列。
  65477. */
  65478. updateFrame(armature: any, index: any): void;
  65479. }
  65480. export enum _cocos_dragon_bones_ArmatureDisplay__DefaultArmaturesEnum {
  65481. default = "Bad expression <-1>"
  65482. }
  65483. export enum _cocos_dragon_bones_ArmatureDisplay__DefaultAnimsEnum {
  65484. '<None>' = 0
  65485. }
  65486. export interface _cocos_dragon_bones_ArmatureDisplay__BoneIndex extends Number {
  65487. _any: number;
  65488. }
  65489. /**
  65490. * - Animation fade out mode.
  65491. * @version DragonBones 4.5
  65492. * @language en_US
  65493. */
  65494. /**
  65495. * - 动画淡出模式。
  65496. * @version DragonBones 4.5
  65497. * @language zh_CN
  65498. */
  65499. export enum __node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode {
  65500. /**
  65501. * - Do not fade out of any animation states.
  65502. * @language en_US
  65503. */
  65504. /**
  65505. * - 不淡出任何的动画状态。
  65506. * @language zh_CN
  65507. */
  65508. None = 0,
  65509. /**
  65510. * - Fade out the animation states of the same layer.
  65511. * @language en_US
  65512. */
  65513. /**
  65514. * - 淡出同层的动画状态。
  65515. * @language zh_CN
  65516. */
  65517. SameLayer = 1,
  65518. /**
  65519. * - Fade out the animation states of the same group.
  65520. * @language en_US
  65521. */
  65522. /**
  65523. * - 淡出同组的动画状态。
  65524. * @language zh_CN
  65525. */
  65526. SameGroup = 2,
  65527. /**
  65528. * - Fade out the animation states of the same layer and group.
  65529. * @language en_US
  65530. */
  65531. /**
  65532. * - 淡出同层并且同组的动画状态。
  65533. * @language zh_CN
  65534. */
  65535. SameLayerAndGroup = 3,
  65536. /**
  65537. * - Fade out of all animation states.
  65538. * @language en_US
  65539. */
  65540. /**
  65541. * - 淡出所有的动画状态。
  65542. * @language zh_CN
  65543. */
  65544. All = 4,
  65545. /**
  65546. * - Does not replace the animation state with the same name.
  65547. * @language en_US
  65548. */
  65549. /**
  65550. * - 不替换同名的动画状态。
  65551. * @language zh_CN
  65552. */
  65553. Single = 5
  65554. }
  65555. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_half_float {
  65556. readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum;
  65557. readonly RGB16F_EXT: GLenum;
  65558. readonly RGBA16F_EXT: GLenum;
  65559. readonly UNSIGNED_NORMALIZED_EXT: GLenum;
  65560. }
  65561. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_half_float {
  65562. readonly RGBA16F_EXT: GLenum;
  65563. readonly RGB16F_EXT: GLenum;
  65564. readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum;
  65565. readonly UNSIGNED_NORMALIZED_EXT: GLenum;
  65566. }
  65567. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_multi_draw {
  65568. multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void;
  65569. multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void;
  65570. multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void;
  65571. multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void;
  65572. }
  65573. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_multi_draw {
  65574. multiDrawArraysWEBGL(mode: GLenum, firstsList: GLint[] | Int32Array, firstsOffset: GLuint, countsList: GLsizei[] | Int32Array, countsOffset: GLuint, drawCount: GLsizei): void;
  65575. multiDrawElementsWEBGL(mode: GLenum, countsList: GLint[] | Int32Array, countsOffset: GLuint, type: GLenum, offsetsList: GLsizei[] | Int32Array, OffsetsOffset: GLuint, drawCount: GLsizei): void;
  65576. multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: GLint[] | Int32Array, firstsOffset: GLuint, countsList: GLsizei[] | Int32Array, countsOffset: GLuint, instanceCountsList: GLsizei[] | Int32Array, instanceCountsOffset: GLuint, drawCount: GLsizei): void;
  65577. multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: GLint[] | Int32Array, countsOffset: GLuint, type: GLenum, offsetsList: GLsizei[] | Int32Array, OffsetsOffset: GLuint, instanceCountsList: GLsizei[] | Int32Array, instanceCountsOffset: GLuint, drawCount: GLsizei): void;
  65578. }
  65579. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc1 {
  65580. readonly COMPRESSED_RGB_ETC1_WEBGL: GLenum;
  65581. }
  65582. // note that ETC1 is not supported with the compressedTexSubImage2D() method
  65583. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc1 {
  65584. readonly COMPRESSED_RGB_ETC1_WEBGL: GLenum;
  65585. }
  65586. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc {
  65587. readonly COMPRESSED_R11_EAC: GLenum;
  65588. readonly COMPRESSED_RG11_EAC: GLenum;
  65589. readonly COMPRESSED_RGB8_ETC2: GLenum;
  65590. readonly COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GLenum;
  65591. readonly COMPRESSED_RGBA8_ETC2_EAC: GLenum;
  65592. readonly COMPRESSED_SIGNED_R11_EAC: GLenum;
  65593. readonly COMPRESSED_SIGNED_RG11_EAC: GLenum;
  65594. readonly COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GLenum;
  65595. readonly COMPRESSED_SRGB8_ETC2: GLenum;
  65596. readonly COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GLenum;
  65597. }
  65598. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc {
  65599. readonly COMPRESSED_R11_EAC: GLenum;
  65600. readonly COMPRESSED_SIGNED_R11_EAC: GLenum;
  65601. readonly COMPRESSED_RG11_EAC: GLenum;
  65602. readonly COMPRESSED_SIGNED_RG11_EAC: GLenum;
  65603. readonly COMPRESSED_RGB8_ETC2: GLenum;
  65604. readonly COMPRESSED_RGBA8_ETC2_EAC: GLenum;
  65605. readonly COMPRESSED_SRGB8_ETC2: GLenum;
  65606. readonly COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GLenum;
  65607. readonly COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GLenum;
  65608. readonly COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GLenum;
  65609. }
  65610. export interface __types_webGLextras__WEBGL_compressed_texture_pvrtc {
  65611. readonly COMPRESSED_RGB_PVRTC_4BPPV1_IMG: GLenum;
  65612. readonly COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GLenum;
  65613. readonly COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GLenum;
  65614. readonly COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GLenum;
  65615. }
  65616. export interface _cocos_gfx_webgl_webgl_define__IWebGLExtensions {
  65617. EXT_texture_filter_anisotropic: EXT_texture_filter_anisotropic | null;
  65618. EXT_blend_minmax: EXT_blend_minmax | null;
  65619. EXT_frag_depth: EXT_frag_depth | null;
  65620. EXT_shader_texture_lod: EXT_shader_texture_lod | null;
  65621. EXT_sRGB: EXT_sRGB | null;
  65622. OES_vertex_array_object: OES_vertex_array_object | null;
  65623. EXT_color_buffer_half_float: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_half_float | null;
  65624. WEBGL_multi_draw: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_multi_draw | null;
  65625. WEBGL_color_buffer_float: WEBGL_color_buffer_float | null;
  65626. WEBGL_compressed_texture_etc1: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc1 | null;
  65627. WEBGL_compressed_texture_etc: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc | null;
  65628. WEBGL_compressed_texture_pvrtc: __types_webGLextras__WEBGL_compressed_texture_pvrtc | null;
  65629. WEBGL_compressed_texture_astc: WEBGL_compressed_texture_astc | null;
  65630. WEBGL_compressed_texture_s3tc: WEBGL_compressed_texture_s3tc | null;
  65631. WEBGL_compressed_texture_s3tc_srgb: WEBGL_compressed_texture_s3tc_srgb | null;
  65632. WEBGL_debug_shaders: WEBGL_debug_shaders | null;
  65633. WEBGL_draw_buffers: WEBGL_draw_buffers | null;
  65634. WEBGL_lose_context: WEBGL_lose_context | null;
  65635. WEBGL_depth_texture: WEBGL_depth_texture | null;
  65636. WEBGL_debug_renderer_info: WEBGL_debug_renderer_info | null;
  65637. OES_texture_half_float: OES_texture_half_float | null;
  65638. OES_texture_half_float_linear: OES_texture_half_float_linear | null;
  65639. OES_texture_float: OES_texture_float | null;
  65640. OES_texture_float_linear: OES_texture_float_linear | null;
  65641. OES_standard_derivatives: OES_standard_derivatives | null;
  65642. OES_element_index_uint: OES_element_index_uint | null;
  65643. ANGLE_instanced_arrays: ANGLE_instanced_arrays | null;
  65644. destroyShadersImmediately: boolean;
  65645. noCompressedTexSubImage2D: boolean;
  65646. isLocationActive: (glLoc: unknown) => glLoc is WebGLUniformLocation;
  65647. useVAO: boolean;
  65648. }
  65649. export interface _cocos_gfx_webgl_webgl_state_cache__IWebGLTexUnit {
  65650. glTexture: WebGLTexture | null;
  65651. }
  65652. export class _cocos_gfx_webgl_webgl_state_cache__WebGLStateCache {
  65653. glArrayBuffer: WebGLBuffer | null;
  65654. glElementArrayBuffer: WebGLBuffer | null;
  65655. glVAO: WebGLVertexArrayObjectOES | null;
  65656. texUnit: number;
  65657. glTexUnits: _cocos_gfx_webgl_webgl_state_cache__IWebGLTexUnit[];
  65658. glRenderbuffer: WebGLRenderbuffer | null;
  65659. glFramebuffer: WebGLFramebuffer | null;
  65660. viewport: gfx.Viewport;
  65661. scissorRect: gfx.Rect;
  65662. rs: gfx.RasterizerState;
  65663. dss: gfx.DepthStencilState;
  65664. bs: gfx.BlendState;
  65665. glProgram: WebGLProgram | null;
  65666. glEnabledAttribLocs: boolean[];
  65667. glCurrentAttribLocs: boolean[];
  65668. texUnitCacheMap: Record<string, number>;
  65669. initialize(texUnit: number, vertexAttributes: number): void;
  65670. }
  65671. export interface _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture {
  65672. type: gfx.TextureType;
  65673. format: gfx.Format;
  65674. usage: gfx.TextureUsage;
  65675. width: number;
  65676. height: number;
  65677. depth: number;
  65678. size: number;
  65679. arrayLayer: number;
  65680. mipLevel: number;
  65681. samples: gfx.SampleCount;
  65682. flags: gfx.TextureFlags;
  65683. isPowerOf2: boolean;
  65684. glTarget: GLenum;
  65685. glInternalFmt: GLenum;
  65686. glFormat: GLenum;
  65687. glType: GLenum;
  65688. glUsage: GLenum;
  65689. glTexture: WebGLTexture | null;
  65690. glRenderbuffer: WebGLRenderbuffer | null;
  65691. glWrapS: GLenum;
  65692. glWrapT: GLenum;
  65693. glMinFilter: GLenum;
  65694. glMagFilter: GLenum;
  65695. isSwapchainTexture: boolean;
  65696. }
  65697. export class _cocos_gfx_webgl_webgl_texture__WebGLTexture extends gfx.Texture {
  65698. get gpuTexture(): _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture;
  65699. get lodLevel(): number;
  65700. initialize(info: Readonly<gfx.TextureInfo> | Readonly<gfx.TextureViewInfo>, isSwapchainTexture?: boolean): void;
  65701. destroy(): void;
  65702. getGLTextureHandle(): number;
  65703. resize(width: number, height: number): void;
  65704. }
  65705. export interface _cocos_gfx_webgl_webgl_gpu_objects__IWebGLBindingMapping {
  65706. blockOffsets: number[];
  65707. samplerTextureOffsets: number[];
  65708. flexibleSet: number;
  65709. }
  65710. export class _cocos_gfx_webgl_webgl_gpu_objects__IWebGLBlitManager {
  65711. constructor();
  65712. destroy(): void;
  65713. draw(gpuTextureSrc: _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture, gpuTextureDst: _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture, regions: gfx.TextureBlit[], filter: gfx.Filter): void;
  65714. }
  65715. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_float {
  65716. }
  65717. export interface __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_float {
  65718. }
  65719. export interface _cocos_gfx_webgl2_webgl2_define__IWebGL2Extensions {
  65720. EXT_texture_filter_anisotropic: EXT_texture_filter_anisotropic | null;
  65721. EXT_color_buffer_half_float: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_half_float | null;
  65722. EXT_color_buffer_float: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__EXT_color_buffer_float | null;
  65723. WEBGL_multi_draw: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_multi_draw | null;
  65724. WEBGL_compressed_texture_etc1: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc1 | null;
  65725. WEBGL_compressed_texture_etc: __node_modules_cocos_ccbuild_node_modules_typescript_lib_libdom__WEBGL_compressed_texture_etc | null;
  65726. WEBGL_compressed_texture_pvrtc: __types_webGLextras__WEBGL_compressed_texture_pvrtc | null;
  65727. WEBGL_compressed_texture_astc: WEBGL_compressed_texture_astc | null;
  65728. WEBGL_compressed_texture_s3tc: WEBGL_compressed_texture_s3tc | null;
  65729. WEBGL_compressed_texture_s3tc_srgb: WEBGL_compressed_texture_s3tc_srgb | null;
  65730. WEBGL_debug_shaders: WEBGL_debug_shaders | null;
  65731. WEBGL_lose_context: WEBGL_lose_context | null;
  65732. WEBGL_debug_renderer_info: WEBGL_debug_renderer_info | null;
  65733. OES_texture_half_float_linear: OES_texture_half_float_linear | null;
  65734. OES_texture_float_linear: OES_texture_float_linear | null;
  65735. useVAO: boolean;
  65736. }
  65737. export interface _cocos_gfx_webgl2_webgl2_state_cache__IWebGL2TexUnit {
  65738. glTexture: WebGLTexture | null;
  65739. }
  65740. export class _cocos_gfx_webgl2_webgl2_state_cache__WebGL2StateCache {
  65741. glArrayBuffer: WebGLBuffer | null;
  65742. glElementArrayBuffer: WebGLBuffer | null;
  65743. glUniformBuffer: WebGLBuffer | null;
  65744. glBindUBOs: (WebGLBuffer | null)[];
  65745. glBindUBOOffsets: number[];
  65746. glVAO: WebGLVertexArrayObject | null;
  65747. texUnit: number;
  65748. glTexUnits: _cocos_gfx_webgl2_webgl2_state_cache__IWebGL2TexUnit[];
  65749. glSamplerUnits: (WebGLSampler | null)[];
  65750. glRenderbuffer: WebGLRenderbuffer | null;
  65751. glFramebuffer: WebGLFramebuffer | null;
  65752. glReadFramebuffer: WebGLFramebuffer | null;
  65753. viewport: gfx.Viewport;
  65754. scissorRect: gfx.Rect;
  65755. rs: gfx.RasterizerState;
  65756. dss: gfx.DepthStencilState;
  65757. bs: gfx.BlendState;
  65758. glProgram: WebGLProgram | null;
  65759. glEnabledAttribLocs: boolean[];
  65760. glCurrentAttribLocs: boolean[];
  65761. texUnitCacheMap: Record<string, number>;
  65762. initialize(texUnit: number, bufferBindings: number, vertexAttributes: number): void;
  65763. }
  65764. export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture {
  65765. type: gfx.TextureType;
  65766. format: gfx.Format;
  65767. usage: gfx.TextureUsage;
  65768. width: number;
  65769. height: number;
  65770. depth: number;
  65771. size: number;
  65772. arrayLayer: number;
  65773. mipLevel: number;
  65774. samples: gfx.SampleCount;
  65775. flags: gfx.TextureFlags;
  65776. isPowerOf2: boolean;
  65777. glTarget: GLenum;
  65778. glInternalFmt: GLenum;
  65779. glFormat: GLenum;
  65780. glType: GLenum;
  65781. glUsage: GLenum;
  65782. glTexture: WebGLTexture | null;
  65783. glRenderbuffer: WebGLRenderbuffer | null;
  65784. glWrapS: GLenum;
  65785. glWrapT: GLenum;
  65786. glMinFilter: GLenum;
  65787. glMagFilter: GLenum;
  65788. isSwapchainTexture: boolean;
  65789. }
  65790. export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTextureView {
  65791. gpuTexture: _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture;
  65792. type: gfx.TextureType;
  65793. format: gfx.Format;
  65794. baseLevel: number;
  65795. levelCount: number;
  65796. }
  65797. export class _cocos_gfx_webgl2_webgl2_texture__WebGL2Texture extends gfx.Texture {
  65798. get gpuTexture(): _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture;
  65799. get gpuTextureView(): _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTextureView;
  65800. initialize(info: Readonly<gfx.TextureInfo> | Readonly<gfx.TextureViewInfo>, isSwapchainTexture?: boolean): void;
  65801. destroy(): void;
  65802. getGLTextureHandle(): number;
  65803. resize(width: number, height: number): void;
  65804. }
  65805. export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BindingMapping {
  65806. blockOffsets: number[];
  65807. samplerTextureOffsets: number[];
  65808. flexibleSet: number;
  65809. }
  65810. export class _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BlitManager {
  65811. get srcFramebuffer(): WebGLFramebuffer | null;
  65812. get dstFramebuffer(): WebGLFramebuffer | null;
  65813. constructor();
  65814. destroy(): void;
  65815. }
  65816. /**
  65817. * @en Test line and line
  65818. * @zh 测试线段与线段是否相交
  65819. */
  65820. function _cocos_physics_2d_builtin_intersection_2d__lineLine(a1: Readonly<math.Vec2>, a2: Readonly<math.Vec2>, b1: Readonly<math.Vec2>, b2: math.Vec2): boolean;
  65821. /**
  65822. * @en Test line and rect
  65823. * @zh 测试线段与矩形是否相交
  65824. */
  65825. function _cocos_physics_2d_builtin_intersection_2d__lineRect(a1: Readonly<math.Vec2>, a2: Readonly<math.Vec2>, b: math.Rect): boolean;
  65826. /**
  65827. * @en Test line and polygon
  65828. * @zh 测试线段与多边形是否相交
  65829. */
  65830. function _cocos_physics_2d_builtin_intersection_2d__linePolygon(a1: Readonly<math.Vec2>, a2: Readonly<math.Vec2>, b: readonly math.Vec2[]): boolean;
  65831. /**
  65832. * @en Test rect and rect
  65833. * @zh 测试矩形与矩形是否相交
  65834. */
  65835. function _cocos_physics_2d_builtin_intersection_2d__rectRect(a: math.Rect, b: math.Rect): boolean;
  65836. /**
  65837. * @en Test rect and polygon
  65838. * @zh 测试矩形与多边形是否相交
  65839. */
  65840. function _cocos_physics_2d_builtin_intersection_2d__rectPolygon(a: Readonly<math.Rect>, b: readonly math.Vec2[]): boolean;
  65841. /**
  65842. * @en Test rect and circle
  65843. * @zh 测试矩形与圆形是否相交
  65844. */
  65845. function _cocos_physics_2d_builtin_intersection_2d__rectCircle(rect: math.Rect, cp: Readonly<math.Vec2>, cr: number): boolean;
  65846. /**
  65847. * @en Test polygon and polygon
  65848. * @zh 测试多边形与多边形是否相交
  65849. */
  65850. function _cocos_physics_2d_builtin_intersection_2d__polygonPolygon(a: readonly math.Vec2[], b: readonly math.Vec2[]): boolean;
  65851. /**
  65852. * @en Test circle and circle
  65853. * @zh 测试圆形与圆形是否相交
  65854. */
  65855. function _cocos_physics_2d_builtin_intersection_2d__circleCircle(c1p: Readonly<math.Vec2>, c1r: number, c2p: Readonly<math.Vec2>, c2r: number): boolean;
  65856. /**
  65857. * @en Test polygon and circle
  65858. * @zh 测试多边形与圆形是否相交
  65859. */
  65860. function _cocos_physics_2d_builtin_intersection_2d__polygonCircle(polygon: readonly math.Vec2[], cp: Readonly<math.Vec2>, cr: number): boolean;
  65861. /**
  65862. * @en Test whether the point is in the polygon
  65863. * @zh 测试一个点是否在一个多边形中
  65864. */
  65865. function _cocos_physics_2d_builtin_intersection_2d__pointInPolygon(point: Readonly<math.Vec2>, polygon: readonly math.Vec2[]): boolean;
  65866. /**
  65867. * @en Calculate the distance of point to line.
  65868. * @zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  65869. */
  65870. function _cocos_physics_2d_builtin_intersection_2d__pointLineDistance(point: Readonly<math.Vec2>, start: Readonly<math.Vec2>, end: Readonly<math.Vec2>, isSegment: boolean): number;
  65871. export class _cocos_particle_2d_particle_simulator_2d__Particle {
  65872. pos: math.Vec2;
  65873. startPos: math.Vec2;
  65874. color: math.Color;
  65875. deltaColor: {
  65876. r: number;
  65877. g: number;
  65878. b: number;
  65879. a: number;
  65880. };
  65881. size: number;
  65882. deltaSize: number;
  65883. rotation: number;
  65884. deltaRotation: number;
  65885. timeToLive: number;
  65886. drawPos: math.Vec2;
  65887. aspectRatio: number;
  65888. dir: math.Vec2;
  65889. radialAccel: number;
  65890. tangentialAccel: number;
  65891. angle: number;
  65892. degreesPerSecond: number;
  65893. radius: number;
  65894. deltaRadius: number;
  65895. }
  65896. export class _cocos_particle_2d_particle_simulator_2d__Simulator {
  65897. particles: _cocos_particle_2d_particle_simulator_2d__Particle[];
  65898. active: boolean;
  65899. uvFilled: number;
  65900. finished: boolean;
  65901. renderData: MeshRenderData;
  65902. constructor(system: any);
  65903. stop(): void;
  65904. reset(): void;
  65905. emitParticle(pos: any): void;
  65906. updateUVs(force?: boolean): void;
  65907. updateParticleBuffer(particle: any, pos: any, buffer: any, offset: number): void;
  65908. step(dt: number): void;
  65909. requestData(vertexCount: number, indexCount: number): void;
  65910. initDrawInfo(): void;
  65911. }
  65912. export class _cocos_particle_2d_motion_streak_2d__Point {
  65913. point: math.Vec2;
  65914. dir: math.Vec2;
  65915. distance: number;
  65916. time: number;
  65917. constructor(point?: math.Vec2, dir?: math.Vec2);
  65918. setPoint(x: any, y: any): void;
  65919. setDir(x: any, y: any): void;
  65920. }
  65921. export class _cocos_particle_particle__Particle {
  65922. static INDENTIFY_NEG_QUAT: number;
  65923. static R2D: number;
  65924. particleSystem: ParticleSystem;
  65925. position: math.Vec3;
  65926. velocity: math.Vec3;
  65927. animatedVelocity: math.Vec3;
  65928. ultimateVelocity: math.Vec3;
  65929. angularVelocity: math.Vec3;
  65930. axisOfRotation: math.Vec3;
  65931. rotation: math.Vec3;
  65932. startEuler: math.Vec3;
  65933. startRotation: math.Quat;
  65934. startRotated: boolean;
  65935. deltaQuat: math.Quat;
  65936. deltaMat: math.Mat4;
  65937. localMat: math.Mat4;
  65938. startSize: math.Vec3;
  65939. size: math.Vec3;
  65940. startColor: math.Color;
  65941. color: math.Color;
  65942. randomSeed: number;
  65943. remainingLifetime: number;
  65944. loopCount: number;
  65945. lastLoop: number;
  65946. trailDelay: number;
  65947. startLifetime: number;
  65948. emitAccumulator0: number;
  65949. emitAccumulator1: number;
  65950. frameIndex: number;
  65951. startRow: number;
  65952. constructor(particleSystem: any);
  65953. reset(): void;
  65954. }
  65955. export class _cocos_particle_renderer_particle_system_renderer_cpu__PVData {
  65956. position: math.Vec3;
  65957. texcoord: math.Vec3;
  65958. size: math.Vec3;
  65959. rotation: math.Vec3;
  65960. color: number;
  65961. velocity: math.Vec3 | null;
  65962. constructor();
  65963. }
  65964. export class _cocos_particle_models_particle_batch_model__default extends renderer.scene.Model {
  65965. constructor();
  65966. setCapacity(capacity: number): void;
  65967. setVertexAttributes(mesh: Mesh | null, attrs: gfx.Attribute[]): void;
  65968. updateMaterial(mat: Material): void;
  65969. addParticleVertexData(index: number, pvdata: _cocos_particle_renderer_particle_system_renderer_cpu__PVData): void;
  65970. addGPUParticleVertexData(p: _cocos_particle_particle__Particle, num: number, time: number): void;
  65971. updateGPUParticles(num: number, time: number, dt: number): number;
  65972. constructAttributeIndex(): void;
  65973. updateIA(count: number): void;
  65974. clear(): void;
  65975. destroy(): void;
  65976. doDestroy(): void;
  65977. set useInstance(value: boolean);
  65978. get useInstance(): boolean;
  65979. }
  65980. export class _cocos_particle_renderer_particle_system_renderer_data__default {
  65981. /**
  65982. * @zh 设定粒子生成模式。
  65983. */
  65984. get renderMode(): number;
  65985. set renderMode(val: number);
  65986. /**
  65987. * @zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按速度大小进行拉伸。
  65988. */
  65989. get velocityScale(): number;
  65990. set velocityScale(val: number);
  65991. /**
  65992. * @zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按粒子大小进行拉伸。
  65993. */
  65994. get lengthScale(): number;
  65995. set lengthScale(val: number);
  65996. /**
  65997. * @zh 粒子发射的模型。
  65998. */
  65999. get mesh(): Mesh | null;
  66000. set mesh(val: Mesh | null);
  66001. /**
  66002. * @zh 粒子使用的材质。
  66003. */
  66004. get particleMaterial(): Material | null;
  66005. set particleMaterial(val: Material | null);
  66006. /**
  66007. * @en particle cpu material
  66008. * @zh 粒子使用的cpu材质。
  66009. */
  66010. get cpuMaterial(): Material | null;
  66011. set cpuMaterial(val: Material | null);
  66012. /**
  66013. * @en particle gpu material
  66014. * @zh 粒子使用的gpu材质。
  66015. */
  66016. get gpuMaterial(): Material | null;
  66017. set gpuMaterial(val: Material | null);
  66018. /**
  66019. * @en particle trail material
  66020. * @zh 拖尾使用的材质。
  66021. */
  66022. get trailMaterial(): Material | null;
  66023. set trailMaterial(val: Material | null);
  66024. get mainTexture(): Texture2D | null;
  66025. set mainTexture(val: Texture2D | null);
  66026. get useGPU(): boolean;
  66027. set useGPU(val: boolean);
  66028. /**
  66029. * @en Particle alignment space option. Includes world, local and view.
  66030. * @zh 粒子对齐空间选择。包括世界空间,局部空间和视角空间。
  66031. */
  66032. get alignSpace(): number;
  66033. set alignSpace(val: number);
  66034. static AlignmentSpace: {
  66035. World: number;
  66036. Local: number;
  66037. View: number;
  66038. };
  66039. create(ps: any): void;
  66040. onInit(ps: any): void;
  66041. }
  66042. export interface _cocos_particle_particle__IParticleModule {
  66043. target: _cocos_particle_renderer_particle_system_renderer_base__ParticleSystemRendererBase | null;
  66044. needUpdate: boolean;
  66045. needAnimate: boolean;
  66046. name: string;
  66047. bindTarget(target: any): void;
  66048. update(space: number, trans: math.Mat4): void;
  66049. animate(p: _cocos_particle_particle__Particle, dt?: number): void;
  66050. }
  66051. export abstract class _cocos_particle_renderer_particle_system_renderer_base__ParticleSystemRendererBase {
  66052. protected _particleSystem: ParticleSystem | null;
  66053. protected _model: _cocos_particle_models_particle_batch_model__default | null;
  66054. protected _renderInfo: _cocos_particle_renderer_particle_system_renderer_data__default | null;
  66055. protected _vertAttrs: gfx.Attribute[];
  66056. protected _useInstance: boolean;
  66057. constructor(info: _cocos_particle_renderer_particle_system_renderer_data__default);
  66058. getUseInstance(): boolean;
  66059. getInfo(): _cocos_particle_renderer_particle_system_renderer_data__default;
  66060. onInit(ps: ParticleSystem): void;
  66061. onEnable(): void;
  66062. onDisable(): void;
  66063. onDestroy(): void;
  66064. attachToScene(): void;
  66065. detachFromScene(): void;
  66066. setVertexAttributes(): void;
  66067. clear(): void;
  66068. getModel(): _cocos_particle_models_particle_batch_model__default | null;
  66069. protected _initModel(): void;
  66070. updateTrailMaterial(): void;
  66071. getDefaultTrailMaterial(): null;
  66072. abstract getParticleCount(): number;
  66073. abstract getFreeParticle(): _cocos_particle_particle__Particle | null;
  66074. abstract onMaterialModified(index: number, material: Material): void;
  66075. abstract onRebuildPSO(index: number, material: Material): void;
  66076. abstract updateVertexAttrib(): void;
  66077. abstract updateRenderMode(): void;
  66078. abstract updateMaterialParams(): void;
  66079. abstract setNewParticle(p: _cocos_particle_particle__Particle): void;
  66080. abstract getDefaultMaterial(): Material | null;
  66081. abstract updateRotation(pass: renderer.Pass | null): void;
  66082. abstract updateScale(pass: renderer.Pass | null): void;
  66083. abstract updateParticles(dt: number): number;
  66084. abstract updateRenderData(): void;
  66085. abstract enableModule(name: string, val: boolean, pm: _cocos_particle_particle__IParticleModule): void;
  66086. abstract beforeRender(): void;
  66087. abstract setUseInstance(value: boolean): void;
  66088. abstract getNoisePreview(out: number[], width: number, height: number): void;
  66089. }
  66090. export abstract class _cocos_particle_particle__ParticleModuleBase implements _cocos_particle_particle__IParticleModule {
  66091. target: _cocos_particle_renderer_particle_system_renderer_base__ParticleSystemRendererBase | null;
  66092. needUpdate: boolean;
  66093. needAnimate: boolean;
  66094. bindTarget(target: _cocos_particle_renderer_particle_system_renderer_base__ParticleSystemRendererBase): void;
  66095. update(space: number, trans: math.Mat4): void;
  66096. abstract name: string;
  66097. abstract animate(p: _cocos_particle_particle__Particle, dt?: number): void;
  66098. }
  66099. /**
  66100. * @en
  66101. * This module will modify particle color over life time. You can set the color gradient to see how it changes.
  66102. * @zh
  66103. * 本模块用于在粒子生命周期内对颜色进行改变,可以修改模块下的颜色渐变条来查看粒子颜色渐变效果。
  66104. */
  66105. export class _cocos_particle_animator_color_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66106. _enable: boolean;
  66107. /**
  66108. * @en Enable or disable this module.
  66109. * @zh 是否启用。
  66110. */
  66111. get enable(): boolean;
  66112. set enable(val: boolean);
  66113. /**
  66114. * @en Change color over life time. Evaluate by key interpolation.
  66115. * @zh 颜色随时间变化的参数,各个 key 之间线性插值变化。
  66116. */
  66117. color: GradientRange;
  66118. name: string;
  66119. /**
  66120. * @en Apply color animation to particle.
  66121. * @zh 作用颜色变换到粒子上。
  66122. * @param particle @en Particle to animate. @zh 模块需要更新的粒子。
  66123. * @internal
  66124. */
  66125. animate(particle: _cocos_particle_particle__Particle): void;
  66126. }
  66127. /**
  66128. * @en
  66129. * This module defines the the volume or surface from which particles can be emitted, and the direction of the start velocity.
  66130. * The Shape property defines the shape of the emission volume, and the rest of the module properties vary depending on the Shape you choose.
  66131. * All shapes have properties that define their dimensions, such as the Radius property.
  66132. * To edit these, drag the handles on the wireframe emitter shape in the Scene view.
  66133. * The choice of shape affects the region from which particles can be emitted, but also the initial direction of the particles.
  66134. * @zh
  66135. * 本模块定义一个发射体或发射面,粒子将会从它进行发射,并且定义了粒子发射的初始方向和初始速度。
  66136. * 形状属性定义粒子系统的发射体,剩下的属性依赖于选择的形状。
  66137. * 所有形状都具有定义其大小的属性,例如 Radius 属性。要编辑这些属性,请在视图中拖动线框发射器形状上的控制柄。
  66138. * 形状的选择会影响可发射粒子的区域,但也会影响粒子的初始方向。
  66139. */
  66140. export class _cocos_particle_emitter_shape_module__default {
  66141. /**
  66142. * @en Emitter position.
  66143. * @zh 粒子发射器位置。
  66144. */
  66145. get position(): math.Vec3;
  66146. set position(val: math.Vec3);
  66147. /**
  66148. * @en Emitter rotation.
  66149. * @zh 粒子发射器旋转角度。
  66150. */
  66151. get rotation(): math.Vec3;
  66152. set rotation(val: math.Vec3);
  66153. /**
  66154. * @en Emitter size scale.
  66155. * @zh 粒子发射器缩放比例。
  66156. */
  66157. get scale(): math.Vec3;
  66158. set scale(val: math.Vec3);
  66159. /**
  66160. * @en Particles will be emitted in an arc if shape is Cone or Circle.
  66161. * @zh 粒子发射器在一个扇形范围内发射。
  66162. */
  66163. get arc(): number;
  66164. set arc(val: number);
  66165. /**
  66166. * @en The angle of the Cone.<bg>
  66167. * Define how the cone opening and closing.
  66168. * @zh 圆锥的轴与母线的夹角<bg>。
  66169. * 决定圆锥发射器的开合程度。
  66170. */
  66171. get angle(): number;
  66172. set angle(val: number);
  66173. /**
  66174. * @en Enable this module or not.
  66175. * @zh 是否启用。
  66176. */
  66177. get enable(): boolean;
  66178. set enable(val: boolean);
  66179. /**
  66180. * @en Emitter [[ShapeType]].
  66181. * @zh 粒子发射器类型 [[ShapeType]]。
  66182. *
  66183. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  66184. */
  66185. _shapeType: number;
  66186. get shapeType(): number;
  66187. set shapeType(val: number);
  66188. /**
  66189. * @en Particles emitted from which part of the shape [[EmitLocation]] (Box Cone Sphere Hemisphere).
  66190. * @zh 粒子从发射器哪个部位发射 [[EmitLocation]]。
  66191. */
  66192. emitFrom: number;
  66193. /**
  66194. * @en Align particle with particle direction.
  66195. * @zh 根据粒子的初始方向决定粒子的移动方向。
  66196. */
  66197. alignToDirection: boolean;
  66198. /**
  66199. * @en Particle direction random amount.
  66200. * @zh 粒子生成方向随机设定。
  66201. */
  66202. randomDirectionAmount: number;
  66203. /**
  66204. * @en Blend particle directions towards a spherical direction, where they travel outwards from the center of their transform.
  66205. * @zh 表示当前发射方向与当前位置到结点中心连线方向的插值。
  66206. */
  66207. sphericalDirectionAmount: number;
  66208. /**
  66209. * @en Particle position random amount.
  66210. * @zh 粒子生成位置随机设定(设定此值为非 0 会使粒子生成位置超出生成器大小范围)。
  66211. */
  66212. randomPositionAmount: number;
  66213. /**
  66214. * @en Emition radius (available for Circle Cone Sphere Hemisphere).
  66215. * @zh 粒子发射器半径。
  66216. */
  66217. radius: number;
  66218. /**
  66219. * @en Emit position in shape (available for Circle Cone Sphere Hemisphere): <bg>
  66220. * - 0 Emit from surface;
  66221. * - 1 Emit from volume center;
  66222. * - 0 to 1 Emit within surface and volume center.
  66223. * @zh 粒子发射器发射位置(对 Box 类型的发射器无效):<bg>
  66224. * - 0 表示从表面发射;
  66225. * - 1 表示从中心发射;
  66226. * - 0 ~ 1 之间表示在中心到表面之间发射。
  66227. */
  66228. radiusThickness: number;
  66229. /**
  66230. * @en Arc mode for Cone and Circle shape.
  66231. * @zh 粒子在扇形范围内的发射方式 [[ArcMode]]。
  66232. */
  66233. arcMode: number;
  66234. /**
  66235. * @en Control arc spread for Cone and circle shape.
  66236. * @zh 控制可能产生粒子的弧周围的离散间隔。
  66237. */
  66238. arcSpread: number;
  66239. /**
  66240. * @en Emit speed around arc (available for Cone and Circle).
  66241. * @zh 粒子沿圆周发射的速度。
  66242. */
  66243. arcSpeed: CurveRange;
  66244. /**
  66245. * @en The length from Cone bottom to top.
  66246. * @zh 圆锥顶部截面距离底部的轴长<bg>。
  66247. * 决定圆锥发射器的高度。
  66248. */
  66249. length: number;
  66250. /**
  66251. * @en Shape thickness for box shape.
  66252. * @zh 粒子发射器发射位置(针对 Box 类型的粒子发射器)。
  66253. */
  66254. boxThickness: math.Vec3;
  66255. constructor();
  66256. /**
  66257. * @en Apply particle system to this shape and create shape transform matrix.
  66258. * @zh 把发射形状应用到粒子系统,并且创建发射形状变换矩阵。
  66259. * @param ps @en Emit shape applied to which Particle system. @zh 使用发射形状的粒子系统。
  66260. * @internal
  66261. */
  66262. onInit(ps: ParticleSystem): void;
  66263. /**
  66264. * @en Emit particle by this shape.
  66265. * @zh 通过这个形状发射粒子。
  66266. * @param p @en Particle emitted. @zh 发射出来的粒子。
  66267. * @internal
  66268. */
  66269. emit(p: any): void;
  66270. }
  66271. /**
  66272. * @en
  66273. * This module will modify particle size over life time.
  66274. * Open the separateAxes option you can change the particle size on XYZ axis (Size on Z axis is invalid for billboard particle)
  66275. * Size on every axis is curve so you can modify these curves to see how it animate.
  66276. * @zh
  66277. * 本模块用于在粒子生命周期内对大小进行改变。
  66278. * 打开 separateAxes 就能够修改粒子在三个轴方向的大小(z轴大小对公告板粒子无效)
  66279. * 每个轴上的粒子大小都是可以用曲线来进行编辑,修改曲线就能够看到粒子大小变化的效果了。
  66280. */
  66281. export class _cocos_particle_animator_size_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66282. _enable: boolean;
  66283. /**
  66284. * @en Enable this module or not.
  66285. * @zh 是否启用。
  66286. */
  66287. get enable(): boolean;
  66288. set enable(val: boolean);
  66289. /**
  66290. * @en Different size on separate axis.
  66291. * @zh 决定是否在每个轴上独立控制粒子大小。
  66292. */
  66293. separateAxes: boolean;
  66294. /**
  66295. * @en Curve to modify particle size.
  66296. * @zh 定义一条曲线来决定粒子在其生命周期中的大小变化。
  66297. */
  66298. size: CurveRange;
  66299. /**
  66300. * @en Curve to modify particle size on X axis.
  66301. * @zh 定义一条曲线来决定粒子在其生命周期中 X 轴方向上的大小变化。
  66302. */
  66303. x: CurveRange;
  66304. /**
  66305. * @en Curve to modify particle size on Y axis.
  66306. * @zh 定义一条曲线来决定粒子在其生命周期中 Y 轴方向上的大小变化。
  66307. */
  66308. y: CurveRange;
  66309. /**
  66310. * @en Curve to modify particle size on Z axis.
  66311. * @zh 定义一条曲线来决定粒子在其生命周期中 Z 轴方向上的大小变化。
  66312. */
  66313. z: CurveRange;
  66314. name: string;
  66315. /**
  66316. * @en Apply size animation to particle.
  66317. * @zh 应用大小变换到粒子上。
  66318. * @param particle @en Particle to animate @zh 模块需要更新的粒子
  66319. * @param dt @en Update interval time @zh 粒子系统更新的间隔时间
  66320. * @internal
  66321. */
  66322. animate(particle: _cocos_particle_particle__Particle, dt: number): void;
  66323. }
  66324. /**
  66325. * @en
  66326. * This module will modify particle velocity over life time.
  66327. * Open the separateAxes option you can change the velocity on XYZ axis.
  66328. * Velocity on every axis is curve so you can modify these curves to see how it animate.
  66329. * @zh
  66330. * 本模块用于在粒子生命周期内改变粒子的速度。
  66331. * 打开 separateAxes 就能够修改粒子在三个轴方向的速度大小。
  66332. * 每个轴上的速度大小都是可以用曲线来进行编辑,修改曲线就能够看到粒子速度变化的效果了。
  66333. */
  66334. export class _cocos_particle_animator_velocity_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66335. _enable: boolean;
  66336. /**
  66337. * @en Enable this module or not.
  66338. * @zh 是否启用。
  66339. */
  66340. get enable(): boolean;
  66341. set enable(val: boolean);
  66342. /**
  66343. * @en Velocity on X axis.
  66344. * @zh X 轴方向上的速度分量。
  66345. */
  66346. x: CurveRange;
  66347. /**
  66348. * @en Velocity on Y axis.
  66349. * @zh Y 轴方向上的速度分量。
  66350. */
  66351. y: CurveRange;
  66352. /**
  66353. * @en Velocity on Z axis.
  66354. * @zh Z 轴方向上的速度分量。
  66355. */
  66356. z: CurveRange;
  66357. /**
  66358. * @en Speed modifier (available for CPU particle).
  66359. * @zh 速度修正系数(只支持 CPU 粒子)。
  66360. */
  66361. speedModifier: CurveRange;
  66362. /**
  66363. * @en Velocity [[Space]] used to calculate particle velocity.
  66364. * @zh 速度计算时采用的坐标系[[Space]]。
  66365. */
  66366. space: number;
  66367. name: string;
  66368. constructor();
  66369. /**
  66370. * @en Update velocity overtime module calculate transform.
  66371. * @zh 更新模块,计算坐标变换。
  66372. * @param space @en Velocity overtime module update space @zh 模块更新空间
  66373. * @param worldTransform @en Particle system world transform @zh 粒子系统的世界变换矩阵
  66374. * @internal
  66375. */
  66376. update(space: number, worldTransform: math.Mat4): void;
  66377. /**
  66378. * @en Apply velocity animation to particle.
  66379. * @zh 作用速度变换到粒子上。
  66380. * @param p @en Particle to animate @zh 模块需要更新的粒子
  66381. * @param dt @en Update interval time @zh 粒子系统更新的间隔时间
  66382. * @internal
  66383. */
  66384. animate(p: _cocos_particle_particle__Particle, dt: number): void;
  66385. }
  66386. /**
  66387. * @en
  66388. * This module will apply force to particle over life time.
  66389. * Force on every axis is curve so you can modify these curves to see how it animate.
  66390. * @zh
  66391. * 本模块用于在粒子生命周期内对粒子施加外力。
  66392. * 每个轴上的受力大小都是可以用曲线来进行编辑,修改曲线就能够看到粒子受力变化的效果了。
  66393. */
  66394. export class _cocos_particle_animator_force_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66395. _enable: boolean;
  66396. /**
  66397. * @en Enable this module or not.
  66398. * @zh 是否启用。
  66399. */
  66400. get enable(): boolean;
  66401. set enable(val: boolean);
  66402. /**
  66403. * @en Force on the X axis.
  66404. * @zh X 轴方向上的加速度分量。
  66405. */
  66406. x: CurveRange;
  66407. /**
  66408. * @en Force on the Y axis.
  66409. * @zh Y 轴方向上的加速度分量。
  66410. */
  66411. y: CurveRange;
  66412. /**
  66413. * @en Force on the Z axis.
  66414. * @zh Z 轴方向上的加速度分量。
  66415. */
  66416. z: CurveRange;
  66417. /**
  66418. * @en Force calculation coordinate. See [[Space]].
  66419. * @zh 加速度计算时采用的坐标系 [[Space]]。
  66420. */
  66421. space: number;
  66422. randomized: boolean;
  66423. name: string;
  66424. constructor();
  66425. /**
  66426. * @en Update force module calculate transform.
  66427. * @zh 更新模块,计算坐标变换。
  66428. * @param space @en Force module update space. @zh 模块更新空间。
  66429. * @param worldTransform @en Particle system world transform. @zh 粒子系统的世界变换矩阵。
  66430. * @internal
  66431. */
  66432. update(space: any, worldTransform: any): void;
  66433. /**
  66434. * @en Apply force to particle.
  66435. * @zh 作用力到粒子上。
  66436. * @param p @en Particle to animate. @zh 模块需要更新的粒子。
  66437. * @param dt @en Update interval time. @zh 粒子系统更新的间隔时间。
  66438. * @internal
  66439. */
  66440. animate(p: _cocos_particle_particle__Particle, dt: any): void;
  66441. }
  66442. /**
  66443. * @en
  66444. * This module will damping particle velocity to the limit value over life time.
  66445. * Open the separateAxes option you can damping the particle velocity on XYZ axis
  66446. * Limit value on every axis is curve so you can modify these curves to see how it animate.
  66447. * @zh
  66448. * 本模块用于在粒子生命周期内对速度进行衰减,速度每次衰减比例为 dampen 持续衰减到极限速度。
  66449. * 打开 separateAxes 就能够修改粒子在三个轴方向的极限速度大小。
  66450. * 每个轴上的粒子极限速度大小都是可以用曲线来进行编辑,修改曲线就能够看到粒子大小变化的效果了。
  66451. */
  66452. export class _cocos_particle_animator_limit_velocity_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66453. _enable: boolean;
  66454. /**
  66455. * @en Enable this module or not.
  66456. * @zh 是否启用。
  66457. */
  66458. get enable(): boolean;
  66459. set enable(val: boolean);
  66460. /**
  66461. * @en Limit velocity on X axis.
  66462. * @zh X 轴方向上的速度下限。
  66463. */
  66464. limitX: CurveRange;
  66465. /**
  66466. * @en Limit velocity on Y axis.
  66467. * @zh Y 轴方向上的速度下限。
  66468. */
  66469. limitY: CurveRange;
  66470. /**
  66471. * @en Limit velocity on Z axis.
  66472. * @zh Z 轴方向上的速度下限。
  66473. */
  66474. limitZ: CurveRange;
  66475. /**
  66476. * @en Velocity limit.
  66477. * @zh 速度下限。
  66478. */
  66479. limit: CurveRange;
  66480. /**
  66481. * @en Dampen velocity percent every time.
  66482. * @zh 速度每次衰减的比例。
  66483. */
  66484. dampen: number;
  66485. /**
  66486. * @en Limit velocity on separate axis.
  66487. * @zh 是否三个轴分开限制。
  66488. */
  66489. separateAxes: boolean;
  66490. /**
  66491. * @en Space used to calculate limit velocity.
  66492. * @zh 计算速度下限时采用的坐标系 [[Space]]。
  66493. */
  66494. space: number;
  66495. drag: null;
  66496. multiplyDragByParticleSize: boolean;
  66497. multiplyDragByParticleVelocity: boolean;
  66498. name: string;
  66499. constructor();
  66500. /**
  66501. * @en Update limit velocity module calculate transform.
  66502. * @zh 更新模块,计算坐标变换。
  66503. * @param space @en Limit velocity module update space @zh 模块更新空间
  66504. * @param worldTransform @en Particle system world transform @zh 粒子系统的世界变换矩阵
  66505. * @internal
  66506. */
  66507. update(space: number, worldTransform: math.Mat4): void;
  66508. /**
  66509. * @en Apply limit velocity to particle.
  66510. * @zh 作用速度衰减到粒子上。
  66511. * @param p @en Particle to animate @zh 模块需要更新的粒子
  66512. * @param dt @en Update interval time @zh 粒子系统更新的间隔时间
  66513. * @internal
  66514. */
  66515. animate(p: _cocos_particle_particle__Particle, dt: number): void;
  66516. }
  66517. /**
  66518. * @en
  66519. * This module will apply rotation to particle over life time.
  66520. * Open the separateAxes option you can change the rotation on XYZ axis
  66521. * Rotation on every axis is curve so you can modify these curves to see how it animate.
  66522. * @zh
  66523. * 本模块用于在粒子生命周期内对粒子施加旋转角速度。
  66524. * 打开 separateAxes 就能够修改粒子在三个轴方向的旋转角速度大小。
  66525. * 每个轴上的旋转角速度都是可以用曲线来进行编辑,修改曲线就能够看到粒子受力变化的效果了。
  66526. */
  66527. export class _cocos_particle_animator_rotation_overtime__default extends _cocos_particle_particle__ParticleModuleBase {
  66528. _enable: boolean;
  66529. /**
  66530. * @en Enable this module or not.
  66531. * @zh 是否启用。
  66532. */
  66533. get enable(): boolean;
  66534. set enable(val: boolean);
  66535. /**
  66536. * @en Rotation around separate axis.
  66537. * @zh 是否三个轴分开设定旋转。
  66538. */
  66539. get separateAxes(): boolean;
  66540. set separateAxes(val: boolean);
  66541. /**
  66542. * @en Angle around X axis.
  66543. * @zh 绕 X 轴设定旋转。
  66544. */
  66545. x: CurveRange;
  66546. /**
  66547. * @en Angle around Y axis.
  66548. * @zh 绕 Y 轴设定旋转。
  66549. */
  66550. y: CurveRange;
  66551. /**
  66552. * @en Angle around Z axis.
  66553. * @zh 绕 Z 轴设定旋转。
  66554. */
  66555. z: CurveRange;
  66556. name: string;
  66557. /**
  66558. * @en Apply rotation to particle.
  66559. * @zh 作用旋转到粒子上。
  66560. * @param p @en Particle to animate @zh 模块需要更新的粒子
  66561. * @param dt @en Update interval time @zh 粒子系统更新的间隔时间
  66562. * @internal
  66563. */
  66564. animate(p: _cocos_particle_particle__Particle, dt: number): void;
  66565. }
  66566. /**
  66567. * @en
  66568. * Use this module to play frame animation of the particle texture.
  66569. * @zh
  66570. * 这个模块用于播放粒子纹理带的纹理帧动画。
  66571. */
  66572. export class _cocos_particle_animator_texture_animation__default extends _cocos_particle_particle__ParticleModuleBase {
  66573. /**
  66574. * @en Enable this module or not.
  66575. * @zh 是否启用。
  66576. */
  66577. get enable(): boolean;
  66578. set enable(val: boolean);
  66579. /**
  66580. * @en Set texture animation [[Mode]] (only support Grid mode).
  66581. * @zh 设定粒子贴图动画的类型(暂只支持 Grid 模式)[[Mode]]。
  66582. */
  66583. get mode(): number;
  66584. set mode(val: number);
  66585. /**
  66586. * @en Tile count on X axis.
  66587. * @zh X 方向动画帧数。
  66588. */
  66589. get numTilesX(): number;
  66590. set numTilesX(val: number);
  66591. /**
  66592. * @en Tile count on Y axis.
  66593. * @zh Y 方向动画帧数。
  66594. */
  66595. get numTilesY(): number;
  66596. set numTilesY(val: number);
  66597. /**
  66598. * @en Texture animation type. See [[Animation]].
  66599. * @zh 动画播放方式 [[Animation]]。
  66600. */
  66601. animation: number;
  66602. /**
  66603. * @en Curve to control texture animation speed.
  66604. * @zh 一个周期内动画播放的帧与时间变化曲线。
  66605. */
  66606. frameOverTime: CurveRange;
  66607. /**
  66608. * @en Texture animation frame start to play.
  66609. * @zh 从第几帧开始播放,时间为整个粒子系统的生命周期。
  66610. */
  66611. startFrame: CurveRange;
  66612. /**
  66613. * @en Animation cycle count per particle life.
  66614. * @zh 一个生命周期内播放循环的次数。
  66615. */
  66616. cycleCount: number;
  66617. /**
  66618. * @ignore
  66619. */
  66620. get flipU(): number;
  66621. set flipU(val: number);
  66622. get flipV(): number;
  66623. set flipV(val: number);
  66624. get uvChannelMask(): number;
  66625. set uvChannelMask(val: number);
  66626. /**
  66627. * @en Get random row from texture to generate animation.<br>
  66628. * This option is available when [[Animation]] type is SingleRow.
  66629. * @zh 随机从动画贴图中选择一行以生成动画。<br>
  66630. * 此选项仅在动画播放方式为 SingleRow 时生效。
  66631. */
  66632. randomRow: boolean;
  66633. /**
  66634. * @en Generate animation from specific row in texture.<br>
  66635. * This option is available when [[Animation]] type is SingleRow and randomRow option is disabled.
  66636. * @zh 从动画贴图中选择特定行以生成动画。<br>
  66637. * 此选项仅在动画播放方式为 SingleRow 时且禁用 randomRow 时可用。
  66638. */
  66639. rowIndex: number;
  66640. name: string;
  66641. /**
  66642. * @en Init start row to particle.
  66643. * @zh 给粒子创建初始行属性。
  66644. * @param p @en Particle to set start row. @zh 设置初始行属性的粒子。
  66645. * @internal
  66646. */
  66647. init(p: _cocos_particle_particle__Particle): void;
  66648. /**
  66649. * @en Apply texture animation to particle.
  66650. * @zh 应用贴图动画到粒子。
  66651. * @param p @en Particle to animate. @zh 模块需要更新的粒子。
  66652. * @param dt @en Update interval time. @zh 粒子系统更新的间隔时间。
  66653. * @internal
  66654. */
  66655. animate(p: _cocos_particle_particle__Particle, dt: number): void;
  66656. }
  66657. /**
  66658. * @en
  66659. * Adding noise to your particles is a simple and effective way to create interesting patterns and effects.
  66660. * @zh
  66661. * 为粒子添加噪声是创建有趣方案和效果的简单有效方法。
  66662. */
  66663. export class _cocos_particle_animator_noise_module__NoiseModule extends _cocos_particle_particle__ParticleModuleBase {
  66664. _enable: boolean;
  66665. /**
  66666. * @en Enable this module or not.
  66667. * @zh 是否启用。
  66668. */
  66669. get enable(): boolean;
  66670. set enable(val: boolean);
  66671. /**
  66672. * @en Strength on X axis.
  66673. * @zh X 轴上的强度大小。
  66674. */
  66675. get strengthX(): number;
  66676. set strengthX(value: number);
  66677. /**
  66678. * @en Strength on Y axis.
  66679. * @zh Y 轴上的强度大小。
  66680. */
  66681. get strengthY(): number;
  66682. set strengthY(value: number);
  66683. /**
  66684. * @en Strength on Z axis.
  66685. * @zh Z 轴上的强度大小。
  66686. */
  66687. get strengthZ(): number;
  66688. set strengthZ(value: number);
  66689. /**
  66690. * @en Noise texture roll speed on X axis.
  66691. * @zh X 轴上的噪声图滚动速度。
  66692. */
  66693. get noiseSpeedX(): number;
  66694. set noiseSpeedX(value: number);
  66695. /**
  66696. * @en Noise texture roll speed on Y axis.
  66697. * @zh Y 轴上的噪声图滚动速度。
  66698. */
  66699. get noiseSpeedY(): number;
  66700. set noiseSpeedY(value: number);
  66701. /**
  66702. * @en Noise texture roll speed on Z axis.
  66703. * @zh Z 轴上的噪声图滚动速度。
  66704. */
  66705. get noiseSpeedZ(): number;
  66706. set noiseSpeedZ(value: number);
  66707. /**
  66708. * @en Noise frequency.
  66709. * @zh 噪声图频率。
  66710. */
  66711. get noiseFrequency(): number;
  66712. set noiseFrequency(value: number);
  66713. /**
  66714. * @en Remap the final noise X axis values into a different range.
  66715. * @zh 噪声值映射到 X 轴的不同范围。
  66716. */
  66717. get remapX(): number;
  66718. set remapX(value: number);
  66719. /**
  66720. * @en Remap the final noise Y axis values into a different range.
  66721. * @zh 噪声值映射到 Y 轴的不同范围。
  66722. */
  66723. get remapY(): number;
  66724. set remapY(value: number);
  66725. /**
  66726. * @en Remap the final noise Z axis values into a different range.
  66727. * @zh 噪声值映射到 Z 轴的不同范围。
  66728. */
  66729. get remapZ(): number;
  66730. set remapZ(value: number);
  66731. /**
  66732. * @en Specify how many layers of overlapping noise are combined to produce the final noise values.
  66733. * @zh 指定组合多少层重叠噪声来产生最终噪声值。
  66734. */
  66735. get octaves(): number;
  66736. set octaves(value: number);
  66737. /**
  66738. * @en For each additional noise layer, reduce the strength by this proportion.
  66739. * @zh 对于每个附加的噪声层,按此比例降低强度。
  66740. */
  66741. get octaveMultiplier(): number;
  66742. set octaveMultiplier(value: number);
  66743. /**
  66744. * @en For each additional noise layer, adjust the frequency by this multiplier.
  66745. * @zh 对于每个附加的噪声层,按此乘数调整频率。
  66746. */
  66747. get octaveScale(): number;
  66748. set octaveScale(value: number);
  66749. name: string;
  66750. /**
  66751. * @en Apply noise effect to particle.
  66752. * @zh 作用噪声效果到粒子上。
  66753. * @param particle @en Particle to animate @zh 模块需要更新的粒子
  66754. * @param dt @en Update interval time @zh 粒子系统更新的间隔时间
  66755. * @internal
  66756. */
  66757. animate(particle: _cocos_particle_particle__Particle, dt: number): void;
  66758. /**
  66759. * @en Gets the preview of noise texture.
  66760. * @zh 获取噪声图预览。
  66761. * @param out @en Noise texture pixels array @zh 噪声图像素数组
  66762. * @param ps @en Particle system @zh 噪声图作用的粒子系统
  66763. * @param width @en Texture width @zh 噪声图宽度
  66764. * @param height @en Texture height @zh 噪声图高度
  66765. */
  66766. getNoisePreview(out: number[], ps: any, width: number, height: number): void;
  66767. }
  66768. export class _cocos_particle_renderer_trail__default {
  66769. /**
  66770. * 是否启用。
  66771. */
  66772. get enable(): boolean;
  66773. set enable(val: boolean);
  66774. /**
  66775. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  66776. */
  66777. _enable: boolean;
  66778. /**
  66779. * 设定粒子生成轨迹的方式。
  66780. */
  66781. mode: number;
  66782. /**
  66783. * 轨迹存在的生命周期。
  66784. */
  66785. lifeTime: CurveRange;
  66786. /**
  66787. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  66788. */
  66789. _minParticleDistance: number;
  66790. /**
  66791. * 每个轨迹粒子之间的最小间距。
  66792. */
  66793. get minParticleDistance(): number;
  66794. set minParticleDistance(val: number);
  66795. get space(): number;
  66796. set space(val: number);
  66797. /**
  66798. * 粒子本身是否存在。
  66799. */
  66800. existWithParticles: boolean;
  66801. /**
  66802. * 设定纹理填充方式。
  66803. */
  66804. textureMode: number;
  66805. widthFromParticle: boolean;
  66806. /**
  66807. * 控制轨迹长度的曲线。
  66808. */
  66809. widthRatio: CurveRange;
  66810. colorFromParticle: boolean;
  66811. colorOverTrail: GradientRange;
  66812. colorOvertime: GradientRange;
  66813. /**
  66814. * @en Get trail model
  66815. * @zh 获取拖尾模型
  66816. * @return Model of this trail and type is scene.Model
  66817. */
  66818. getModel(): renderer.scene.Model | null;
  66819. constructor();
  66820. onInit(ps: any): void;
  66821. onEnable(): void;
  66822. onDisable(): void;
  66823. /**
  66824. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  66825. */
  66826. _attachToScene(): void;
  66827. /**
  66828. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  66829. */
  66830. _detachFromScene(): void;
  66831. destroy(): void;
  66832. play(): void;
  66833. clear(): void;
  66834. updateMaterial(): void;
  66835. update(): void;
  66836. animate(p: _cocos_particle_particle__Particle, scaledDt: number): void;
  66837. removeParticle(p: _cocos_particle_particle__Particle): void;
  66838. updateRenderData(): void;
  66839. updateIA(count: number): void;
  66840. beforeRender(): void;
  66841. }
  66842. namespace _cocos_physics_2d_framework_utils_polygon_separator {
  66843. /**
  66844. * @en
  66845. * Decompose the polygon into several smaller non-concave polygon.
  66846. * If the polygon is already convex, it will return the original polygon, unless it is over Settings.MaxPolygonVertices.
  66847. * Precondition: Counter Clockwise polygon
  66848. * @zh
  66849. * 使用Mark Bayazit算法将输入多边形拆分成多个凸多边形。如果输入多边形是凸多边形,将返回原多边形。要求输入多边形是逆时针的。
  66850. * @param polygon @en one polygon. @zh 一个多边形。
  66851. * @return @en polygon array. @zh 多边形数组。
  66852. */
  66853. export function ConvexPartition(vertices: math.IVec2Like[]): math.IVec2Like[][];
  66854. export function ForceCounterClockWise(vertices: any): void;
  66855. export function IsCounterClockWise(vertices: any): boolean;
  66856. }
  66857. namespace _cocos_physics_2d_framework_utils_polygon_partition {
  66858. /**
  66859. * @en
  66860. * Decompose the polygon into several convex polygon using Hertel-Mehlhorn algorithm.
  66861. * If the polygon is already convex, it will return the original polygon.
  66862. * @zh
  66863. * 使用Hertel-Mehlhorn算法将输入多边形拆分成多个凸多边形。如果输入多边形是凸多边形,将返回原多边形。
  66864. * @param polygon @en one polygon. @zh 一个多边形。
  66865. * @return @en polygon array. @zh 多边形数组。
  66866. */
  66867. export function ConvexPartition(polygon: math.IVec2Like[]): math.IVec2Like[][] | null;
  66868. }
  66869. export type _cocos_physics_2d_framework_physics_selector__IPhysicsEngineId = "builtin" | "box2d" | "box2d-wasm" | string;
  66870. export interface _cocos_physics_2d_framework_physics_selector__IPhysicsWrapperObject {
  66871. PhysicsWorld: any;
  66872. RigidBody?: any;
  66873. BoxShape?: any;
  66874. CircleShape?: any;
  66875. PolygonShape?: any;
  66876. DistanceJoint?: any;
  66877. FixedJoint?: any;
  66878. MouseJoint?: any;
  66879. SpringJoint?: any;
  66880. RelativeJoint?: any;
  66881. SliderJoint?: any;
  66882. WheelJoint?: any;
  66883. HingeJoint?: any;
  66884. }
  66885. export interface _cocos_physics_2d_framework_physics_selector__IPhysicsBackend {
  66886. [key: string]: _cocos_physics_2d_framework_physics_selector__IPhysicsWrapperObject;
  66887. }
  66888. export interface _cocos_physics_2d_spec_i_physics_world__IPhysicsWorld {
  66889. readonly impl: any;
  66890. debugDrawFlags: number;
  66891. setGravity: (v: math.IVec2Like) => void;
  66892. setAllowSleep: (v: boolean) => void;
  66893. step(deltaTime: number, velocityIterations?: number, positionIterations?: number): void;
  66894. syncPhysicsToScene(): void;
  66895. syncSceneToPhysics(): void;
  66896. raycast(p1: math.IVec2Like, p2: math.IVec2Like, type: ERaycast2DType, mask: number): RaycastResult2D[];
  66897. testPoint(p: math.Vec2): readonly Collider2D[];
  66898. testAABB(rect: math.Rect): readonly Collider2D[];
  66899. drawDebug(): void;
  66900. }
  66901. export interface _cocos_physics_2d_framework_physics_selector__IPhysicsSelector {
  66902. /**
  66903. * @en
  66904. * The id of the physics engine being used by the physics system.
  66905. * @zh
  66906. * 物理系统正在使用的物理引擎的唯一标志。
  66907. */
  66908. readonly id: _cocos_physics_2d_framework_physics_selector__IPhysicsEngineId;
  66909. /**
  66910. * @en
  66911. * The wrapper of the physics engine being used by the physics system.
  66912. * @zh
  66913. * 物理系统使用的物理引擎的封装层。
  66914. */
  66915. readonly wrapper: _cocos_physics_2d_framework_physics_selector__IPhysicsWrapperObject;
  66916. /**
  66917. * @en
  66918. * All physics engine backends that the physics module has registered.
  66919. * @zh
  66920. * 物理模块已注册的所有物理引擎后端。
  66921. */
  66922. readonly backend: _cocos_physics_2d_framework_physics_selector__IPhysicsBackend;
  66923. /**
  66924. * @en
  66925. * An instance of the physical world through which you can access the lowlevel objects.
  66926. * @zh
  66927. * 物理世界实例,通过它可以访问到底层对象。
  66928. */
  66929. readonly physicsWorld: _cocos_physics_2d_spec_i_physics_world__IPhysicsWorld | null;
  66930. /**
  66931. * @en
  66932. * To register the backend, the system will use the last backend registered before initialization,
  66933. * and the registration after that needs to be switched manually.
  66934. * @zh
  66935. * 注册后端,系统将使用在初始化前注册的最后一个后端,此后注册的需要手动切换。
  66936. */
  66937. register: (id: _cocos_physics_2d_framework_physics_selector__IPhysicsEngineId, wrapper: _cocos_physics_2d_framework_physics_selector__IPhysicsWrapperObject) => void;
  66938. /**
  66939. * @en
  66940. * Switch to the physics backend corresponding to the id in the registry.
  66941. * @zh
  66942. * 切换为注册表里对应 id 的物理后端。
  66943. */
  66944. switchTo: (id: _cocos_physics_2d_framework_physics_selector__IPhysicsEngineId) => void;
  66945. [x: string]: any;
  66946. }
  66947. export const _cocos_physics_2d_framework_physics_system__PhysicsSystem2D_base: new (...args: any[]) => System & _cocos_core_event_eventify__IEventified;
  66948. export interface _cocos_physics_spec_i_lifecycle__ILifecycle {
  66949. /**
  66950. * @en Update is called every frame, if the Component is enabled.<br/>
  66951. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  66952. * You can only call its super class method inside it. It should not be called manually elsewhere.
  66953. * @zh 如果该组件启用,则每帧调用 update。<br/>
  66954. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  66955. * @param dt - the delta time in seconds it took to complete the last frame
  66956. */
  66957. update?(dt: number): void;
  66958. /**
  66959. * @en LateUpdate is called every frame, if the Component is enabled.<br/>
  66960. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  66961. * You can only call its super class method inside it. It should not be called manually elsewhere.
  66962. * @zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  66963. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  66964. * @param dt - the delta time in seconds it took to complete the last frame
  66965. */
  66966. lateUpdate?(dt: number): void;
  66967. /**
  66968. * @en `__preload` is called before every onLoad.<br/>
  66969. * It is used to initialize the builtin components internally,<br/>
  66970. * to avoid checking whether onLoad is called before every public method calls.<br/>
  66971. * This method should be removed if script priority is supported.
  66972. * @zh `__preload` 在每次onLoad之前调用。<br/>
  66973. * 它用于在内部初始化内置组件,<br/>
  66974. * 以避免在每次公有方法调用之前检查是否调用了onLoad。<br/>
  66975. * 如果支持脚本优先级,则应删除此方法。
  66976. * @private
  66977. */
  66978. __preload?(component: any): void;
  66979. /**
  66980. * @en
  66981. * When attaching to an active node or its node first activated.<br/>
  66982. * onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  66983. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  66984. * You can only call its super class method inside it. It should not be called manually elsewhere.
  66985. * @zh
  66986. * 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  66987. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  66988. */
  66989. onLoad?(): void;
  66990. /**
  66991. * @en
  66992. * Called before all scripts' update if the Component is enabled the first time.<br/>
  66993. * Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  66994. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  66995. * You can only call its super class method inside it. It should not be called manually elsewhere.
  66996. * @zh
  66997. * 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  66998. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  66999. */
  67000. start?(): void;
  67001. /**
  67002. * @en Called when this component becomes enabled and its node is active.<br/>
  67003. * This is a lifecycle method. It may not be implemented in the super class.
  67004. * You can only call its super class method inside it. It should not be called manually elsewhere.
  67005. * @zh 当该组件被启用,并且它的节点也激活时。<br/>
  67006. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  67007. */
  67008. onEnable?(): void;
  67009. /**
  67010. * @en Called when this component becomes disabled or its node becomes inactive.<br/>
  67011. * This is a lifecycle method. It may not be implemented in the super class.
  67012. * You can only call its super class method inside it. It should not be called manually elsewhere.
  67013. * @zh 当该组件被禁用或节点变为无效时调用。<br/>
  67014. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  67015. */
  67016. onDisable?(): void;
  67017. /**
  67018. * @en Called when this component will be destroyed.<br/>
  67019. * This is a lifecycle method. It may not be implemented in the super class.<br/>
  67020. * You can only call its super class method inside it. It should not be called manually elsewhere.
  67021. * @zh 当该组件被销毁时调用<br/>
  67022. * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  67023. */
  67024. onDestroy?(): void;
  67025. onFocusInEditor?(): void;
  67026. onLostFocusInEditor?(): void;
  67027. /**
  67028. * @en Called to initialize the component or node’s properties when adding the component the first time or when the Reset command is used.
  67029. * This function is only called in editor.<br/>
  67030. * @zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  67031. */
  67032. resetInEditor?(): void;
  67033. /**
  67034. * @en
  67035. * onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  67036. * an undo operation on this component.<br/>
  67037. * <br/>
  67038. * If the component contains the "internal state", short for "temporary member variables which not included<br/>
  67039. * in its CCClass properties", then you may need to implement this function.<br/>
  67040. * <br/>
  67041. * The editor will call the getset accessors of your component to record/restore the component's state<br/>
  67042. * for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  67043. * this function to manually synchronize your component's "internal states" with its public properties.<br/>
  67044. * Once you implement this function, all the getset accessors of your component will not be called when<br/>
  67045. * the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  67046. * will be recorded or restored by editor.<br/>
  67047. * <br/>
  67048. * Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  67049. * to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  67050. * properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  67051. * will not be called during reset operation. Which means that only the properties with default value<br/>
  67052. * will be reset by editor.
  67053. *
  67054. * This function is only called in editor mode.
  67055. * @zh
  67056. * onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  67057. * <br/>
  67058. * 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  67059. * <br/>
  67060. * 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。
  67061. * 然而,在极端的情况下,它可能无法良好运作。<br/>
  67062. * 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。
  67063. * 一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。
  67064. * 这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  67065. * <br/>
  67066. * 同样的,编辑可能无法在极端情况下正确地重置您的组件。<br/>
  67067. * 于是如果你需要支持组件重置菜单,你需要在该方法中手工同步组件属性到“内部状态”。<br/>
  67068. * 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
  67069. * 这意味着仅仅指定了默认值的属性将被编辑器重置。
  67070. * <br/>
  67071. * 此方法仅在编辑器下会被调用。
  67072. */
  67073. onRestore?(): void;
  67074. }
  67075. export interface _cocos_physics_2d_spec_i_rigid_body__IRigidBody2D extends _cocos_physics_spec_i_lifecycle__ILifecycle {
  67076. readonly impl: any;
  67077. readonly rigidBody: RigidBody2D;
  67078. readonly isAwake: boolean;
  67079. readonly isSleeping: boolean;
  67080. initialize(v: RigidBody2D): void;
  67081. setType(v: ERigidBody2DType): void;
  67082. setLinearDamping: (v: number) => void;
  67083. setAngularDamping: (v: number) => void;
  67084. setGravityScale: (v: number) => void;
  67085. setFixedRotation: (v: boolean) => void;
  67086. setAllowSleep: (v: boolean) => void;
  67087. isActive: () => boolean;
  67088. setActive: (v: boolean) => void;
  67089. wakeUp(): void;
  67090. sleep(): void;
  67091. getMass(): number;
  67092. getInertia(): number;
  67093. getLinearVelocity<Out extends math.IVec2Like>(out: Out): Out;
  67094. setLinearVelocity(value: math.IVec2Like): void;
  67095. getLinearVelocityFromWorldPoint<Out extends math.IVec2Like>(worldPoint: math.IVec2Like, out: Out): Out;
  67096. getAngularVelocity(): number;
  67097. setAngularVelocity(value: number): void;
  67098. getLocalVector<Out extends math.IVec2Like>(worldVector: math.IVec2Like, out: Out): Out;
  67099. getWorldVector<Out extends math.IVec2Like>(localVector: math.IVec2Like, out: Out): Out;
  67100. getLocalPoint<Out extends math.IVec2Like>(worldPoint: math.IVec2Like, out: Out): Out;
  67101. getWorldPoint<Out extends math.IVec2Like>(localPoint: math.IVec2Like, out: Out): Out;
  67102. getLocalCenter<Out extends math.IVec2Like>(out: Out): Out;
  67103. getWorldCenter<Out extends math.IVec2Like>(out: Out): Out;
  67104. applyForce(force: math.Vec2, point: math.Vec2, wake: boolean): any;
  67105. applyForceToCenter(force: math.Vec2, wake: boolean): any;
  67106. applyTorque(torque: number, wake: boolean): any;
  67107. applyLinearImpulse(impulse: math.Vec2, point: math.Vec2, wake: boolean): any;
  67108. applyLinearImpulseToCenter(impulse: math.Vec2, wake: boolean): any;
  67109. applyAngularImpulse(impulse: number, wake: boolean): any;
  67110. }
  67111. export interface _cocos_physics_2d_spec_i_physics_shape__IBaseShape extends _cocos_physics_spec_i_lifecycle__ILifecycle {
  67112. readonly impl: any;
  67113. readonly collider: Collider2D;
  67114. readonly worldAABB: Readonly<math.Rect>;
  67115. initialize(v: Collider2D): void;
  67116. apply(): void;
  67117. onGroupChanged(): void;
  67118. }
  67119. export const _cocos_physics_2d_framework_components_colliders_collider_2d__Collider2D_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
  67120. export interface _cocos_physics_2d_spec_i_physics_joint__IJoint2D extends _cocos_physics_spec_i_lifecycle__ILifecycle {
  67121. readonly impl: any;
  67122. apply(): void;
  67123. initialize(v: Joint2D): void;
  67124. }
  67125. export interface _cocos_physics_spec_i_physics_world__IRaycastOptions {
  67126. mask: number;
  67127. group: number;
  67128. queryTrigger: boolean;
  67129. maxDistance: number;
  67130. }
  67131. export interface _cocos_physics_spec_i_physics_world__IPhysicsWorld {
  67132. readonly impl: any;
  67133. debugDrawFlags: physics.EPhysicsDrawFlags;
  67134. debugDrawConstraintSize: number;
  67135. setGravity: (v: math.IVec3Like) => void;
  67136. setAllowSleep: (v: boolean) => void;
  67137. setDefaultMaterial: (v: physics.PhysicsMaterial) => void;
  67138. step(fixedTimeStep: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
  67139. raycast(worldRay: geometry.Ray, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, pool: memop.RecyclePool<physics.PhysicsRayResult>, results: physics.PhysicsRayResult[]): boolean;
  67140. raycastClosest(worldRay: geometry.Ray, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, out: physics.PhysicsRayResult): boolean;
  67141. sweepBox(worldRay: geometry.Ray, halfExtent: math.IVec3Like, orientation: math.IQuatLike, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, pool: memop.RecyclePool<physics.PhysicsRayResult>, results: physics.PhysicsRayResult[]): boolean;
  67142. sweepBoxClosest(worldRay: geometry.Ray, halfExtent: math.IVec3Like, orientation: math.IQuatLike, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, result: physics.PhysicsRayResult): boolean;
  67143. sweepSphere(worldRay: geometry.Ray, radius: number, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, pool: memop.RecyclePool<physics.PhysicsRayResult>, results: physics.PhysicsRayResult[]): boolean;
  67144. sweepSphereClosest(worldRay: geometry.Ray, radius: number, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, result: physics.PhysicsRayResult): boolean;
  67145. sweepCapsule(worldRay: geometry.Ray, radius: number, height: number, orientation: math.IQuatLike, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, pool: memop.RecyclePool<physics.PhysicsRayResult>, results: physics.PhysicsRayResult[]): boolean;
  67146. sweepCapsuleClosest(worldRay: geometry.Ray, radius: number, height: number, orientation: math.IQuatLike, options: _cocos_physics_spec_i_physics_world__IRaycastOptions, result: physics.PhysicsRayResult): boolean;
  67147. emitEvents(): void;
  67148. syncSceneToPhysics(): void;
  67149. syncAfterEvents(): void;
  67150. destroy(): void;
  67151. }
  67152. export interface _cocos_physics_framework_physics_selector__IWorldInitData {
  67153. gravity: math.IVec3Like;
  67154. allowSleep: boolean;
  67155. defaultMaterial: physics.PhysicsMaterial;
  67156. }
  67157. export interface _cocos_physics_spec_i_group_mask__IGroupMask {
  67158. setGroup(v: number): void;
  67159. getGroup(): number;
  67160. addGroup(v: number): void;
  67161. removeGroup(v: number): void;
  67162. setMask(v: number): void;
  67163. getMask(): number;
  67164. addMask(v: number): void;
  67165. removeMask(v: number): void;
  67166. }
  67167. export interface _cocos_physics_spec_i_physics_shape__IBaseShape extends _cocos_physics_spec_i_lifecycle__ILifecycle, _cocos_physics_spec_i_group_mask__IGroupMask {
  67168. readonly impl: any;
  67169. readonly collider: physics.Collider;
  67170. readonly attachedRigidBody: physics.RigidBody | null;
  67171. initialize(v: physics.Collider): void;
  67172. setMaterial: (v: physics.PhysicsMaterial | null) => void;
  67173. setAsTrigger: (v: boolean) => void;
  67174. setCenter: (v: math.IVec3Like) => void;
  67175. getAABB: (v: geometry.AABB) => void;
  67176. getBoundingSphere: (v: geometry.Sphere) => void;
  67177. updateEventListener: () => void;
  67178. }
  67179. export type _cocos_physics_framework_components_colliders_collider__Callback = (...args: any[]) => any;
  67180. export const _cocos_physics_framework_components_colliders_collider__Collider_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
  67181. export interface _cocos_physics_spec_i_physics_shape__IBoxShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67182. updateSize: () => void;
  67183. }
  67184. export interface _cocos_physics_spec_i_physics_shape__ISphereShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67185. updateRadius: () => void;
  67186. }
  67187. export interface _cocos_physics_spec_i_physics_shape__ICapsuleShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67188. setRadius: (v: number) => void;
  67189. setCylinderHeight: (v: number) => void;
  67190. setDirection: (v: number) => void;
  67191. }
  67192. export interface _cocos_physics_spec_i_physics_shape__ITrimeshShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67193. setMesh: (v: Mesh | null) => void;
  67194. }
  67195. export interface _cocos_physics_spec_i_physics_shape__ICylinderShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67196. setRadius: (v: number) => void;
  67197. setHeight: (v: number) => void;
  67198. setDirection: (v: number) => void;
  67199. }
  67200. export interface _cocos_physics_spec_i_physics_shape__IConeShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67201. setRadius: (v: number) => void;
  67202. setHeight: (v: number) => void;
  67203. setDirection: (v: number) => void;
  67204. }
  67205. export interface _cocos_physics_spec_i_physics_shape__IConeShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67206. setRadius: (v: number) => void;
  67207. setHeight: (v: number) => void;
  67208. setDirection: (v: number) => void;
  67209. }
  67210. export interface _cocos_physics_spec_i_external__ITerrainAsset {
  67211. _uuid: string;
  67212. tileSize: number;
  67213. getVertexCountI: () => number;
  67214. getVertexCountJ: () => number;
  67215. getHeight: (i: number, j: number) => number;
  67216. }
  67217. export interface _cocos_physics_spec_i_physics_shape__ITerrainShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67218. setTerrain: (v: _cocos_physics_spec_i_external__ITerrainAsset | null) => void;
  67219. }
  67220. export interface _cocos_physics_spec_i_physics_shape__ISimplexShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67221. setShapeType: (v: physics.SimplexCollider.ESimplexType) => void;
  67222. setVertices: (v: math.IVec3Like[]) => void;
  67223. }
  67224. export interface _cocos_physics_spec_i_physics_shape__IPlaneShape extends _cocos_physics_spec_i_physics_shape__IBaseShape {
  67225. setNormal: (v: math.IVec3Like) => void;
  67226. setConstant: (v: number) => void;
  67227. }
  67228. export interface _cocos_physics_spec_i_physics_constraint__IBaseConstraint extends _cocos_physics_spec_i_lifecycle__ILifecycle {
  67229. readonly impl: any;
  67230. initialize(v: physics.Constraint): void;
  67231. setConnectedBody(v: physics.RigidBody | null): void;
  67232. setEnableCollision(v: boolean): void;
  67233. }
  67234. export const _cocos_physics_framework_components_constraints_constraint__Constraint_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
  67235. export interface _cocos_physics_spec_i_physics_constraint__IHingeConstraint extends _cocos_physics_spec_i_physics_constraint__IBaseConstraint {
  67236. setPivotA(v: math.IVec3Like): void;
  67237. setPivotB(v: math.IVec3Like): void;
  67238. setAxis(v: math.IVec3Like): void;
  67239. setLimitEnabled(v: boolean): void;
  67240. setLowerLimit(min: number): void;
  67241. setUpperLimit(max: number): void;
  67242. setMotorEnabled(v: boolean): void;
  67243. setMotorVelocity(v: number): void;
  67244. setMotorForceLimit(v: number): void;
  67245. }
  67246. export interface _cocos_physics_spec_i_physics_constraint__IFixedConstraint extends _cocos_physics_spec_i_physics_constraint__IBaseConstraint {
  67247. setBreakForce(v: number): void;
  67248. setBreakTorque(v: number): void;
  67249. }
  67250. export interface _cocos_physics_spec_i_physics_constraint__IPointToPointConstraint extends _cocos_physics_spec_i_physics_constraint__IBaseConstraint {
  67251. setPivotA(v: math.IVec3Like): void;
  67252. setPivotB(v: math.IVec3Like): void;
  67253. }
  67254. export interface _cocos_physics_spec_i_physics_constraint__IConfigurableConstraint extends _cocos_physics_spec_i_physics_constraint__IBaseConstraint {
  67255. setConstraintMode(idx: number, v: physics.EConstraintMode): void;
  67256. setLinearLimit(idx: number, lower: number, upper: number): void;
  67257. setAngularExtent(twist: number, swing1: number, swing2: number): void;
  67258. setLinearRestitution(v: number): void;
  67259. setSwingRestitution(v: number): void;
  67260. setTwistRestitution(v: number): void;
  67261. setLinearSoftConstraint(v: boolean): void;
  67262. setLinearStiffness(v: number): void;
  67263. setLinearDamping(v: number): void;
  67264. setSwingSoftConstraint(v: boolean): void;
  67265. setTwistSoftConstraint(v: boolean): void;
  67266. setSwingStiffness(v: number): void;
  67267. setSwingDamping(v: number): void;
  67268. setTwistStiffness(v: number): void;
  67269. setTwistDamping(v: number): void;
  67270. setDriverMode(idx: number, v: physics.EDriverMode): void;
  67271. setLinearMotorTarget(v: math.IVec3Like): void;
  67272. setLinearMotorVelocity(v: math.IVec3Like): void;
  67273. setLinearMotorForceLimit(v: number): void;
  67274. setAngularMotorTarget(v: math.IVec3Like): void;
  67275. setAngularMotorVelocity(v: math.IVec3Like): void;
  67276. setAngularMotorForceLimit(v: number): void;
  67277. setPivotA(v: math.IVec3Like): void;
  67278. setPivotB(v: math.IVec3Like): void;
  67279. setAutoPivotB(v: boolean): void;
  67280. setAxis(v: math.IVec3Like): void;
  67281. setSecondaryAxis(v: math.IVec3Like): void;
  67282. setBreakForce(v: number): void;
  67283. setBreakTorque(v: number): void;
  67284. }
  67285. /**
  67286. * @en The linear limit settings of the configurable constraint.
  67287. * @zh 可配置约束的线性限制设置。
  67288. */
  67289. export class _cocos_physics_framework_components_constraints_configurable_constraint__LinearLimitSettings {
  67290. get xMotion(): physics.EConstraintMode;
  67291. set xMotion(v: physics.EConstraintMode);
  67292. get yMotion(): physics.EConstraintMode;
  67293. set yMotion(v: physics.EConstraintMode);
  67294. get zMotion(): physics.EConstraintMode;
  67295. set zMotion(v: physics.EConstraintMode);
  67296. get upper(): math.Vec3;
  67297. set upper(v: math.Vec3);
  67298. get lower(): math.Vec3;
  67299. set lower(v: math.Vec3);
  67300. get restitution(): number;
  67301. set restitution(v: number);
  67302. get enableSoftConstraint(): boolean;
  67303. set enableSoftConstraint(v: boolean);
  67304. get stiffness(): number;
  67305. set stiffness(v: number);
  67306. get damping(): number;
  67307. set damping(v: number);
  67308. constructor(configurableConstraint: _cocos_physics_spec_i_physics_constraint__IConfigurableConstraint);
  67309. }
  67310. /**
  67311. * @en The angular limit settings of the configurable constraint.
  67312. * @zh 可配置约束的角度限制设置。
  67313. */
  67314. export class _cocos_physics_framework_components_constraints_configurable_constraint__AngularLimitSettings {
  67315. get twistMotion(): physics.EConstraintMode;
  67316. set twistMotion(v: physics.EConstraintMode);
  67317. get swingMotion1(): physics.EConstraintMode;
  67318. set swingMotion1(v: physics.EConstraintMode);
  67319. get swingMotion2(): physics.EConstraintMode;
  67320. set swingMotion2(v: physics.EConstraintMode);
  67321. get twistExtent(): number;
  67322. set twistExtent(v: number);
  67323. get swingExtent1(): number;
  67324. set swingExtent1(v: number);
  67325. get swingExtent2(): number;
  67326. set swingExtent2(v: number);
  67327. get twistRestitution(): number;
  67328. set twistRestitution(v: number);
  67329. get swingRestitution(): number;
  67330. set swingRestitution(v: number);
  67331. get enableSoftConstraintTwist(): boolean;
  67332. set enableSoftConstraintTwist(v: boolean);
  67333. get twistStiffness(): number;
  67334. set twistStiffness(v: number);
  67335. get twistDamping(): number;
  67336. set twistDamping(v: number);
  67337. get enableSoftConstraintSwing(): boolean;
  67338. set enableSoftConstraintSwing(v: boolean);
  67339. get swingStiffness(): number;
  67340. set swingStiffness(v: number);
  67341. get swingDamping(): number;
  67342. set swingDamping(v: number);
  67343. constructor(configurableConstraint: _cocos_physics_spec_i_physics_constraint__IConfigurableConstraint);
  67344. }
  67345. /**
  67346. * @en The linear driver settings of the configurable constraint.
  67347. * @zh 可配置约束的线性驱动器设置。
  67348. */
  67349. export class _cocos_physics_framework_components_constraints_configurable_constraint__LinearDriverSettings {
  67350. get xDrive(): physics.EDriverMode;
  67351. set xDrive(v: physics.EDriverMode);
  67352. get yDrive(): physics.EDriverMode;
  67353. set yDrive(v: physics.EDriverMode);
  67354. get zDrive(): physics.EDriverMode;
  67355. set zDrive(v: physics.EDriverMode);
  67356. get targetPosition(): math.Vec3;
  67357. set targetPosition(v: math.Vec3);
  67358. get targetVelocity(): math.Vec3;
  67359. set targetVelocity(v: math.Vec3);
  67360. get strength(): number;
  67361. set strength(v: number);
  67362. constructor(configurableConstraint: _cocos_physics_spec_i_physics_constraint__IConfigurableConstraint);
  67363. }
  67364. /**
  67365. * @en The angular driver settings of the configurable constraint.
  67366. * @zh 可配置约束的角度驱动器设置。
  67367. */
  67368. export class _cocos_physics_framework_components_constraints_configurable_constraint__AngularDriverSettings {
  67369. get twistDrive(): physics.EDriverMode;
  67370. set twistDrive(v: physics.EDriverMode);
  67371. get swingDrive1(): physics.EDriverMode;
  67372. set swingDrive1(v: physics.EDriverMode);
  67373. get swingDrive2(): physics.EDriverMode;
  67374. set swingDrive2(v: physics.EDriverMode);
  67375. get targetOrientation(): math.Vec3;
  67376. set targetOrientation(v: math.Vec3);
  67377. get targetVelocity(): math.Vec3;
  67378. set targetVelocity(v: math.Vec3);
  67379. get strength(): number;
  67380. set strength(v: number);
  67381. constructor(configurableConstraint: _cocos_physics_spec_i_physics_constraint__IConfigurableConstraint);
  67382. }
  67383. export interface _cocos_physics_spec_i_rigid_body__IRigidBody extends _cocos_physics_spec_i_lifecycle__ILifecycle, _cocos_physics_spec_i_group_mask__IGroupMask {
  67384. readonly impl: any;
  67385. readonly rigidBody: physics.RigidBody;
  67386. readonly isAwake: boolean;
  67387. readonly isSleepy: boolean;
  67388. readonly isSleeping: boolean;
  67389. initialize(v: physics.RigidBody): void;
  67390. setType: (v: physics.ERigidBodyType) => void;
  67391. setMass: (v: number) => void;
  67392. setLinearDamping: (v: number) => void;
  67393. setAngularDamping: (v: number) => void;
  67394. useGravity: (v: boolean) => void;
  67395. setLinearFactor: (v: math.IVec3Like) => void;
  67396. setAngularFactor: (v: math.IVec3Like) => void;
  67397. setAllowSleep: (v: boolean) => void;
  67398. wakeUp(): void;
  67399. sleep(): void;
  67400. clearState(): void;
  67401. clearForces(): void;
  67402. clearVelocity(): void;
  67403. setSleepThreshold(v: number): void;
  67404. getSleepThreshold(): number;
  67405. useCCD: (v: boolean) => void;
  67406. isUsingCCD: () => boolean;
  67407. getLinearVelocity(out: math.IVec3Like): void;
  67408. setLinearVelocity(value: math.IVec3Like): void;
  67409. getAngularVelocity(out: math.IVec3Like): void;
  67410. setAngularVelocity(value: math.IVec3Like): void;
  67411. applyForce(force: math.IVec3Like, relativePoint?: math.IVec3Like): void;
  67412. applyLocalForce(force: math.IVec3Like, relativePoint?: math.IVec3Like): void;
  67413. applyImpulse(force: math.IVec3Like, relativePoint?: math.IVec3Like): void;
  67414. applyLocalImpulse(force: math.IVec3Like, relativePoint?: math.IVec3Like): void;
  67415. applyTorque(torque: math.IVec3Like): void;
  67416. applyLocalTorque(torque: math.IVec3Like): void;
  67417. }
  67418. export interface _cocos_physics_spec_i_character_controller__IBaseCharacterController extends _cocos_physics_spec_i_lifecycle__ILifecycle, _cocos_physics_spec_i_group_mask__IGroupMask {
  67419. initialize(v: physics.CharacterController): boolean;
  67420. updateEventListener: () => void;
  67421. onGround(): boolean;
  67422. getPosition(out: math.IVec3Like): void;
  67423. setPosition(value: math.IVec3Like): void;
  67424. setStepOffset(value: number): void;
  67425. setSlopeLimit(value: number): void;
  67426. setContactOffset(value: number): void;
  67427. setDetectCollisions(value: boolean): void;
  67428. setOverlapRecovery(value: boolean): void;
  67429. move(movement: math.IVec3Like, minDist: number, elapsedTime: number): void;
  67430. syncPhysicsToScene(): void;
  67431. }
  67432. export type _cocos_physics_framework_components_character_controllers_character_controller__Callback = (...args: any[]) => any;
  67433. export const _cocos_physics_framework_components_character_controllers_character_controller__CharacterController_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
  67434. export type _cocos_physics_framework_physics_selector__IPhysicsEngineId = "builtin" | "cannon.js" | "bullet" | "physx" | string;
  67435. export interface _cocos_physics_spec_i_character_controller__IBoxCharacterController extends _cocos_physics_spec_i_character_controller__IBaseCharacterController {
  67436. setHalfHeight(value: number): void;
  67437. setHalfSideExtent(value: number): void;
  67438. setHalfForwardExtent(value: number): void;
  67439. }
  67440. export interface _cocos_physics_spec_i_character_controller__ICapsuleCharacterController extends _cocos_physics_spec_i_character_controller__IBaseCharacterController {
  67441. setRadius(value: number): void;
  67442. setHeight(value: number): void;
  67443. }
  67444. export interface _cocos_physics_framework_physics_selector__IPhysicsWrapperObject {
  67445. PhysicsWorld?: __types_globals__Constructor<_cocos_physics_spec_i_physics_world__IPhysicsWorld>;
  67446. RigidBody?: __types_globals__Constructor<_cocos_physics_spec_i_rigid_body__IRigidBody>;
  67447. BoxCharacterController?: __types_globals__Constructor<_cocos_physics_spec_i_character_controller__IBoxCharacterController>;
  67448. CapsuleCharacterController?: __types_globals__Constructor<_cocos_physics_spec_i_character_controller__ICapsuleCharacterController>;
  67449. BoxShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__IBoxShape>;
  67450. SphereShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ISphereShape>;
  67451. CapsuleShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ICapsuleShape>;
  67452. TrimeshShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ITrimeshShape>;
  67453. CylinderShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ICylinderShape>;
  67454. ConeShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__IConeShape>;
  67455. TerrainShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ITerrainShape>;
  67456. SimplexShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__ISimplexShape>;
  67457. PlaneShape?: __types_globals__Constructor<_cocos_physics_spec_i_physics_shape__IPlaneShape>;
  67458. PointToPointConstraint?: __types_globals__Constructor<_cocos_physics_spec_i_physics_constraint__IPointToPointConstraint>;
  67459. HingeConstraint?: __types_globals__Constructor<_cocos_physics_spec_i_physics_constraint__IHingeConstraint>;
  67460. FixedConstraint?: __types_globals__Constructor<_cocos_physics_spec_i_physics_constraint__IFixedConstraint>;
  67461. ConfigurableConstraint?: __types_globals__Constructor<_cocos_physics_spec_i_physics_constraint__IConfigurableConstraint>;
  67462. }
  67463. export interface _cocos_physics_framework_physics_selector__IPhysicsBackend {
  67464. [key: string]: _cocos_physics_framework_physics_selector__IPhysicsWrapperObject;
  67465. }
  67466. export interface _cocos_physics_framework_physics_selector__IPhysicsSelector {
  67467. /**
  67468. * @en
  67469. * The id of the physics engine being used by the physics system.
  67470. * @zh
  67471. * 物理系统正在使用的物理引擎的唯一标志。
  67472. */
  67473. readonly id: _cocos_physics_framework_physics_selector__IPhysicsEngineId;
  67474. /**
  67475. * @en
  67476. * The wrapper of the physics engine being used by the physics system.
  67477. * @zh
  67478. * 物理系统使用的物理引擎的封装层。
  67479. */
  67480. readonly wrapper: _cocos_physics_framework_physics_selector__IPhysicsWrapperObject;
  67481. /**
  67482. * @en
  67483. * All physics engine backends that the physics module has registered.
  67484. * @zh
  67485. * 物理模块已注册的所有物理引擎后端。
  67486. */
  67487. readonly backend: _cocos_physics_framework_physics_selector__IPhysicsBackend;
  67488. /**
  67489. * @en
  67490. * An instance of the physical world through which you can access the lowlevel objects.
  67491. * @zh
  67492. * 物理世界实例,通过它可以访问到底层对象。
  67493. */
  67494. readonly physicsWorld: _cocos_physics_spec_i_physics_world__IPhysicsWorld | null;
  67495. /**
  67496. * @en
  67497. * To register the backend, the system will use the last backend registered before initialization,
  67498. * and the registration after that needs to be switched manually.
  67499. * @zh
  67500. * 注册后端,系统将使用在初始化前注册的最后一个后端,此后注册的需要手动切换。
  67501. */
  67502. register: (id: _cocos_physics_framework_physics_selector__IPhysicsEngineId, wrapper: _cocos_physics_framework_physics_selector__IPhysicsWrapperObject) => void;
  67503. /**
  67504. * @en
  67505. * Switch to the physics backend corresponding to the id in the registry.
  67506. * @zh
  67507. * 切换为注册表里对应 id 的物理后端。
  67508. */
  67509. switchTo: (id: _cocos_physics_framework_physics_selector__IPhysicsEngineId) => void;
  67510. [x: string]: any;
  67511. }
  67512. /**
  67513. * @en
  67514. * The definition of the parameter for building a cylinder.
  67515. * @zh
  67516. * 圆柱参数选项。
  67517. */
  67518. export interface _cocos_primitive_cylinder__ICylinderOptions extends primitives.IGeometryOptions {
  67519. radialSegments: number;
  67520. heightSegments: number;
  67521. capped: boolean;
  67522. arc: number;
  67523. }
  67524. /**
  67525. * @en
  67526. * The definition of the parameter for building a box.
  67527. * @zh
  67528. * 立方体参数选项。
  67529. */
  67530. export interface _cocos_primitive_box__IBoxOptions extends __types_globals__RecursivePartial<primitives.IGeometryOptions> {
  67531. /**
  67532. * @en
  67533. * Box extent on X-axis.
  67534. * @zh
  67535. * 立方体宽度。
  67536. */
  67537. width?: number;
  67538. /**
  67539. * @en
  67540. * Box extent on Y-axis.
  67541. * @zh
  67542. * 立方体高度。
  67543. */
  67544. height?: number;
  67545. /**
  67546. * @en
  67547. * Box extent on Z-axis.
  67548. * @zh
  67549. * 立方体长度。
  67550. */
  67551. length?: number;
  67552. /**
  67553. * @en
  67554. * Segment count on X-axis.
  67555. * @zh
  67556. * 宽度线段数。
  67557. */
  67558. widthSegments?: number;
  67559. /**
  67560. * @en
  67561. * Segment count on Y-axis.
  67562. * @zh
  67563. * 高度线段数。
  67564. */
  67565. heightSegments?: number;
  67566. /**
  67567. * @en
  67568. * Segment count on Z-axis.
  67569. * @zh
  67570. * 长度线段数。
  67571. */
  67572. lengthSegments?: number;
  67573. }
  67574. export type _cocos_primitive_cone__IConeOptions = _cocos_primitive_cylinder__ICylinderOptions;
  67575. /**
  67576. * @en
  67577. * The definition of the parameter for building a plane.
  67578. * @zh
  67579. * 平面参数选项。
  67580. */
  67581. export interface _cocos_primitive_plane__IPlaneOptions extends __types_globals__RecursivePartial<primitives.IGeometryOptions> {
  67582. /**
  67583. * Plane extent on X-axis.
  67584. */
  67585. width: number;
  67586. /**
  67587. * Plane extent on Z-axis.
  67588. */
  67589. length: number;
  67590. /**
  67591. * Segment count on X-axis.
  67592. */
  67593. widthSegments: number;
  67594. /**
  67595. * Segment count on Z-axis.
  67596. */
  67597. lengthSegments: number;
  67598. }
  67599. /**
  67600. * @zh
  67601. * 球参数选项。
  67602. * @en
  67603. * The options of sphere
  67604. */
  67605. export interface _cocos_primitive_sphere__ISphereOptions extends primitives.IGeometryOptions {
  67606. segments: number;
  67607. }
  67608. /**
  67609. * @zh
  67610. * 环面参数选项。
  67611. * @en
  67612. * The options about torus
  67613. */
  67614. export interface _cocos_primitive_torus__ITorusOptions extends primitives.IGeometryOptions {
  67615. radialSegments: number;
  67616. tubularSegments: number;
  67617. arc: number;
  67618. }
  67619. /**
  67620. * @en
  67621. * The definition of the parameter for building a capsule.
  67622. * @zh
  67623. * 胶囊体参数选项。
  67624. */
  67625. export interface _cocos_primitive_capsule__ICapsuteOptions {
  67626. sides: number;
  67627. heightSegments: number;
  67628. capped: boolean;
  67629. arc: number;
  67630. }
  67631. /**
  67632. * @en
  67633. * The definition of the parameter for building a circle.
  67634. * @zh
  67635. * 圆形参数选项。
  67636. */
  67637. export interface _cocos_primitive_circle__ICircleOptions extends primitives.IGeometryOptions {
  67638. segments: number;
  67639. }
  67640. export enum _cocos_primitive_primitive__PrimitiveType {
  67641. BOX = 0,
  67642. SPHERE = 1,
  67643. CYLINDER = 2,
  67644. CONE = 3,
  67645. CAPSULE = 4,
  67646. TORUS = 5,
  67647. PLANE = 6,
  67648. QUAD = 7
  67649. }
  67650. export class _cocos_profiler_counter__Counter {
  67651. get value(): number;
  67652. set value(val: number);
  67653. protected _id: string;
  67654. protected _opts: _cocos_profiler_counter__ICounterOption;
  67655. protected _accumStart: number;
  67656. protected _total: number;
  67657. protected _value: number;
  67658. protected _averageValue: number;
  67659. protected _accumValue: number;
  67660. protected _accumSamples: number;
  67661. constructor(id: string, opts: _cocos_profiler_counter__ICounterOption, now: number);
  67662. sample(now: number): void;
  67663. human(): number;
  67664. alarm(): boolean;
  67665. protected _average(v: number, now?: number): void;
  67666. }
  67667. export interface _cocos_profiler_counter__ICounterOption {
  67668. desc: string;
  67669. counter: _cocos_profiler_counter__Counter;
  67670. min?: number;
  67671. max?: number;
  67672. average?: number;
  67673. below?: number;
  67674. over?: number;
  67675. color?: string;
  67676. isInteger?: boolean;
  67677. }
  67678. export interface _cocos_profiler_profiler__IProfilerState {
  67679. frame: _cocos_profiler_counter__ICounterOption;
  67680. fps: _cocos_profiler_counter__ICounterOption;
  67681. draws: _cocos_profiler_counter__ICounterOption;
  67682. instances: _cocos_profiler_counter__ICounterOption;
  67683. tricount: _cocos_profiler_counter__ICounterOption;
  67684. logic: _cocos_profiler_counter__ICounterOption;
  67685. physics: _cocos_profiler_counter__ICounterOption;
  67686. render: _cocos_profiler_counter__ICounterOption;
  67687. present: _cocos_profiler_counter__ICounterOption;
  67688. textureMemory: _cocos_profiler_counter__ICounterOption;
  67689. bufferMemory: _cocos_profiler_counter__ICounterOption;
  67690. }
  67691. export type _cocos_3d_skeletal_animation_skeletal_animation_data_hub__BakeData = ReturnType<AnimationClip[typeof _cocos_animation_internal_symbols__BAKE_SKELETON_CURVE_SYMBOL]>;
  67692. export interface _cocos_3d_skeletal_animation_skeletal_animation_state__ITransform {
  67693. pos: math.Vec3;
  67694. rot: math.Quat;
  67695. scale: math.Vec3;
  67696. }
  67697. export interface _cocos_3d_skeletal_animation_skeletal_animation_state__ISocketData {
  67698. target: Node;
  67699. frames: _cocos_3d_skeletal_animation_skeletal_animation_state__ITransform[];
  67700. }
  67701. export interface _cocos_sorting_sorting_layers__SortingItem {
  67702. id: number;
  67703. name: string;
  67704. value: number;
  67705. }
  67706. /**
  67707. * @engineInternal
  67708. */
  67709. export interface _cocos_spine_skeleton__SkeletonDrawData {
  67710. material: Material | null;
  67711. texture: Texture2D | null;
  67712. indexOffset: number;
  67713. indexCount: number;
  67714. }
  67715. export class _cocos_spine_skeleton_cache__FrameBoneInfo {
  67716. a: number;
  67717. b: number;
  67718. c: number;
  67719. d: number;
  67720. worldX: number;
  67721. worldY: number;
  67722. }
  67723. /**
  67724. * @en Attach node tool
  67725. * @zh 挂点工具类
  67726. * @class sp.AttachUtil
  67727. */
  67728. export class _cocos_spine_attach_util__AttachUtil {
  67729. protected _isInitialized: boolean;
  67730. protected _skeletonBones: sp.spine.Bone[] | _cocos_spine_skeleton_cache__FrameBoneInfo[] | null;
  67731. protected _socketNodes: Map<number, Node> | null;
  67732. constructor();
  67733. init(skeletonComp: sp.Skeleton): void;
  67734. updateSkeletonBones(bones: _cocos_spine_skeleton_cache__FrameBoneInfo[]): void;
  67735. reset(): void;
  67736. _syncAttachedNode(): void;
  67737. matrixHandle(node: Node, bone: any): void;
  67738. }
  67739. export type _cocos_spine_track_entry_listeners__TrackListener = (x: sp.spine.TrackEntry) => void;
  67740. export type _cocos_spine_track_entry_listeners__TrackListener2 = (x: sp.spine.TrackEntry, ev: sp.spine.Event) => void;
  67741. export type _cocos_spine_track_entry_listeners__CommonTrackEntryListener = _cocos_spine_track_entry_listeners__TrackListener | _cocos_spine_track_entry_listeners__TrackListener2;
  67742. export class _cocos_spine_track_entry_listeners__TrackEntryListeners {
  67743. start?: ((entry: sp.spine.TrackEntry) => void);
  67744. interrupt?: ((entry: sp.spine.TrackEntry) => void);
  67745. end?: ((entry: sp.spine.TrackEntry) => void);
  67746. dispose?: ((entry: sp.spine.TrackEntry) => void);
  67747. complete?: ((entry: sp.spine.TrackEntry) => void);
  67748. event?: ((entry: sp.spine.TrackEntry, event: sp.spine.Event) => void);
  67749. static getListeners(entry: sp.spine.TrackEntry, instance: sp.spine.SkeletonInstance): sp.spine.AnimationStateListener;
  67750. static emitListener(id: number, entry: sp.spine.TrackEntry, event: sp.spine.Event): void;
  67751. static emitTrackEntryListener(id: number, entry: sp.spine.TrackEntry, event: sp.spine.Event, eventType: sp.spine.EventType): void;
  67752. static addListener(listener: _cocos_spine_track_entry_listeners__CommonTrackEntryListener): number;
  67753. }
  67754. export class _cocos_spine_skeleton_cache__SpineDrawItem {
  67755. iCount: number;
  67756. blendMode: number;
  67757. textureID: number;
  67758. }
  67759. export class _cocos_spine_skeleton_cache__SpineModel {
  67760. vCount: number;
  67761. iCount: number;
  67762. vData: Uint8Array;
  67763. iData: Uint16Array;
  67764. meshes: _cocos_spine_skeleton_cache__SpineDrawItem[];
  67765. }
  67766. export interface _cocos_spine_skeleton_cache__AnimationFrame {
  67767. model: _cocos_spine_skeleton_cache__SpineModel;
  67768. boneInfos: _cocos_spine_skeleton_cache__FrameBoneInfo[];
  67769. }
  67770. export class _cocos_spine_skeleton_cache__AnimationCache {
  67771. protected _instance: sp.spine.SkeletonInstance | null;
  67772. protected _state: sp.spine.AnimationState;
  67773. protected _skeletonData: sp.spine.SkeletonData;
  67774. protected _skeleton: sp.spine.Skeleton;
  67775. _privateMode: boolean;
  67776. protected _curIndex: number;
  67777. protected _isCompleted: boolean;
  67778. protected _maxFrameIdex: number;
  67779. protected _frameIdx: number;
  67780. protected _inited: boolean;
  67781. protected _invalid: boolean;
  67782. protected _enableCacheAttachedInfo: boolean;
  67783. protected _skeletonInfo: _cocos_spine_skeleton_cache__SkeletonCacheItemInfo | null;
  67784. protected _animationName: string | null;
  67785. isCompleted: boolean;
  67786. totalTime: number;
  67787. frames: _cocos_spine_skeleton_cache__AnimationFrame[];
  67788. constructor(data: sp.spine.SkeletonData);
  67789. init(skeletonInfo: _cocos_spine_skeleton_cache__SkeletonCacheItemInfo, animationName: string): void;
  67790. get skeleton(): sp.spine.Skeleton;
  67791. setSkin(skinName: string): void;
  67792. setAnimation(animationName: string): void;
  67793. updateToFrame(frameIdx: number): void;
  67794. getFrame(frameIdx: number): _cocos_spine_skeleton_cache__AnimationFrame;
  67795. invalidAnimationFrames(): void;
  67796. begin(): void;
  67797. end(): void;
  67798. bind(listener: _cocos_spine_track_entry_listeners__TrackEntryListeners): void;
  67799. unbind(listener: _cocos_spine_track_entry_listeners__TrackEntryListeners): void;
  67800. protected needToUpdate(toFrameIdx?: number): boolean;
  67801. isInited(): boolean;
  67802. isInvalid(): boolean;
  67803. invalidAllFrame(): void;
  67804. enableCacheAttachedInfo(): void;
  67805. clear(): void;
  67806. destroy(): void;
  67807. }
  67808. export interface _cocos_spine_skeleton_cache__SkeletonCacheItemInfo {
  67809. skeleton: sp.spine.Skeleton | null;
  67810. clipper: sp.spine.SkeletonClipping | null;
  67811. state: sp.spine.AnimationState | null;
  67812. listener: _cocos_spine_track_entry_listeners__TrackEntryListeners;
  67813. curAnimationCache: _cocos_spine_skeleton_cache__AnimationCache | null;
  67814. animationsCache: {
  67815. [key: string]: _cocos_spine_skeleton_cache__AnimationCache;
  67816. };
  67817. assetUUID: string;
  67818. }
  67819. export class _cocos_spine_skeleton_cache__SkeletonCache {
  67820. static readonly FrameTime: number;
  67821. static sharedCache: _cocos_spine_skeleton_cache__SkeletonCache;
  67822. protected _privateMode: boolean;
  67823. protected _skeletonCache: {
  67824. [key: string]: _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
  67825. };
  67826. protected _animationPool: {
  67827. [key: string]: _cocos_spine_skeleton_cache__AnimationCache;
  67828. };
  67829. constructor();
  67830. enablePrivateMode(): void;
  67831. clear(): void;
  67832. invalidAnimationCache(uuid: string): void;
  67833. destroySkeleton(assetUuid: string): void;
  67834. createSkeletonInfo(skeletonAsset: sp.SkeletonData): _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
  67835. getSkeletonInfo(skeletonAsset: sp.SkeletonData): null | _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
  67836. getAnimationCache(uuid: string, animationName: string): null | _cocos_spine_skeleton_cache__AnimationCache;
  67837. initAnimationCache(uuid: string, data: sp.SkeletonData, animationName: string): null | _cocos_spine_skeleton_cache__AnimationCache;
  67838. destroyCachedAnimations(uuid?: string): void;
  67839. }
  67840. export interface _cocos_spine_skeleton__AnimationItem {
  67841. animationName: string;
  67842. loop: boolean;
  67843. delay: number;
  67844. }
  67845. export interface _cocos_spine_skeleton__AnimationItem {
  67846. animationName: string;
  67847. loop: boolean;
  67848. delay: number;
  67849. }
  67850. export type _cocos_spine_skeleton__TrackListener = (x: sp.spine.TrackEntry) => void;
  67851. export type _cocos_spine_skeleton__TrackListener2 = (x: sp.spine.TrackEntry, ev: sp.spine.Event | number) => void;
  67852. export class _cocos_terrain_terrain_lod__TerrainIndexPool {
  67853. size: number;
  67854. indices: Uint16Array | null;
  67855. }
  67856. export class _cocos_terrain_terrain_lod__TerrainLodKey {
  67857. level: number;
  67858. north: number;
  67859. south: number;
  67860. west: number;
  67861. east: number;
  67862. equals(rk: _cocos_terrain_terrain_lod__TerrainLodKey): boolean;
  67863. }
  67864. export class _cocos_terrain_terrain_lod__TerrainIndexData {
  67865. key: _cocos_terrain_terrain_lod__TerrainLodKey;
  67866. start: number;
  67867. size: number;
  67868. buffer: Uint16Array | null;
  67869. primCount: number;
  67870. }
  67871. export class _cocos_terrain_terrain_lod__TerrainLod {
  67872. static mapIndex(i: number, j: number, k: number): number;
  67873. /**
  67874. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  67875. */
  67876. _bodyIndexPool: _cocos_terrain_terrain_lod__TerrainIndexPool[];
  67877. /**
  67878. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  67879. */
  67880. _connecterIndexPool: _cocos_terrain_terrain_lod__TerrainIndexPool[];
  67881. /**
  67882. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  67883. */
  67884. _indexMap: _cocos_terrain_terrain_lod__TerrainIndexData[];
  67885. /**
  67886. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  67887. */
  67888. _indexBuffer: Uint16Array;
  67889. constructor();
  67890. getIndexData(k: _cocos_terrain_terrain_lod__TerrainLodKey): _cocos_terrain_terrain_lod__TerrainIndexData | null;
  67891. }
  67892. export type _cocos_tiledmap_tiled_types__GID = number;
  67893. export type _cocos_tiledmap_tiled_types__MixedGID = number;
  67894. /**
  67895. * Size in pixels of the image
  67896. * @property {cc.Size} imageSize
  67897. */
  67898. /**
  67899. * <p>cc.TMXTilesetInfo contains the information about the tilesets like: <br />
  67900. * - Tileset name<br />
  67901. * - Tileset spacing<br />
  67902. * - Tileset margin<br />
  67903. * - size of the tiles<br />
  67904. * - Image used for the tiles<br />
  67905. * - Image size<br />
  67906. *
  67907. * This information is obtained from the TMX file. </p>
  67908. * @class TMXTilesetInfo
  67909. */
  67910. export class _cocos_tiledmap_tiled_types__TMXTilesetInfo {
  67911. /**
  67912. * Tileset name
  67913. * @property {string} name
  67914. */
  67915. name: string;
  67916. /**
  67917. * First grid
  67918. * @property {number} firstGid
  67919. */
  67920. firstGid: _cocos_tiledmap_tiled_types__GID;
  67921. /**
  67922. * Spacing
  67923. * @property {number} spacing
  67924. */
  67925. spacing: number;
  67926. /**
  67927. * Margin
  67928. * @property {number} margin
  67929. */
  67930. margin: number;
  67931. /**
  67932. * Texture containing the tiles (should be sprite sheet / texture atlas)
  67933. * @property {cc.SpriteFrame} sourceImage
  67934. */
  67935. sourceImage?: SpriteFrame;
  67936. imageName: string | null;
  67937. imageOffset: math.Vec2 | null;
  67938. imageSize: math.Size;
  67939. tileOffset: math.Vec2;
  67940. _tileSize: math.Size;
  67941. collection: boolean;
  67942. rectForGID(gid_: _cocos_tiledmap_tiled_types__MixedGID | _cocos_tiledmap_tiled_types__GID, result?: _cocos_tiledmap_tiled_types__TiledGrid): math.Rect | _cocos_tiledmap_tiled_types__TiledGrid;
  67943. }
  67944. export interface _cocos_tiledmap_tiled_types__TiledGrid {
  67945. tileset: _cocos_tiledmap_tiled_types__TMXTilesetInfo;
  67946. x: number;
  67947. y: number;
  67948. width: number;
  67949. height: number;
  67950. t: number;
  67951. l: number;
  67952. r: number;
  67953. b: number;
  67954. cx: number;
  67955. cy: number;
  67956. offsetX: number;
  67957. offsetY: number;
  67958. rotated: boolean;
  67959. gid: _cocos_tiledmap_tiled_types__GID;
  67960. spriteFrame: SpriteFrame;
  67961. texture: Texture2D;
  67962. _name?: string;
  67963. _rect?: math.Rect;
  67964. _rotated?: boolean;
  67965. }
  67966. export type _cocos_tiledmap_tiled_types__TiledTextureGrids = Map<_cocos_tiledmap_tiled_types__GID, _cocos_tiledmap_tiled_types__TiledGrid>;
  67967. export interface _cocos_tiledmap_tiled_types__TiledAnimation {
  67968. frames: {
  67969. grid: _cocos_tiledmap_tiled_types__TiledGrid | null;
  67970. tileid: _cocos_tiledmap_tiled_types__GID;
  67971. duration: number;
  67972. }[];
  67973. dt: number;
  67974. frameIdx: number;
  67975. }
  67976. export type _cocos_tiledmap_tiled_types__TiledAnimationType = Map<_cocos_tiledmap_tiled_types__GID, _cocos_tiledmap_tiled_types__TiledAnimation>;
  67977. /**
  67978. * cc.TMXImageLayerInfo contains the information about the image layers.
  67979. * This information is obtained from the TMX file.
  67980. * @class TMXImageLayerInfo
  67981. */
  67982. export class _cocos_tiledmap_tiled_types__TMXImageLayerInfo {
  67983. name: string;
  67984. visible: boolean;
  67985. width: number;
  67986. height: number;
  67987. offset: math.Vec2;
  67988. opacity: number;
  67989. trans: math.Color;
  67990. sourceImage?: SpriteFrame;
  67991. tintColor: math.Color | null;
  67992. }
  67993. export interface _cocos_tiledmap_tiled_map__ImageExtendedNode extends Node {
  67994. layerInfo: _cocos_tiledmap_tiled_types__TMXImageLayerInfo;
  67995. _offset: math.Vec2;
  67996. }
  67997. export type _cocos_tiledmap_tiled_types__PropertiesInfo = {
  67998. [key: string]: number | string;
  67999. };
  68000. /**
  68001. * @en The orientation of tiled map.
  68002. * @zh Tiled Map 地图方向。
  68003. * @enum TiledMap.Orientation
  68004. * @static
  68005. */
  68006. export enum _cocos_tiledmap_tiled_types__Orientation {
  68007. /**
  68008. * @en Orthogonal orientation.
  68009. * @zh 直角鸟瞰地图(90°地图)。
  68010. * @property ORTHO
  68011. * @type {Number}
  68012. * @static
  68013. */
  68014. ORTHO = 0,
  68015. /**
  68016. * @en Hexagonal orientation.
  68017. * @zh 六边形地图
  68018. * @property HEX
  68019. * @type {Number}
  68020. * @static
  68021. */
  68022. HEX = 1,
  68023. /**
  68024. * Isometric orientation.
  68025. * 等距斜视地图(斜45°地图)。
  68026. * @property ISO
  68027. * @type {Number}
  68028. * @static
  68029. */
  68030. ISO = 2
  68031. }
  68032. /**
  68033. * @en The render order of tiled map.
  68034. * @zh 地图的渲染顺序
  68035. * @enum TiledMap.RenderOrder
  68036. * @static
  68037. */
  68038. export enum _cocos_tiledmap_tiled_types__RenderOrder {
  68039. /**
  68040. * @property RightDown
  68041. * @type {Number}
  68042. * @static
  68043. */
  68044. RightDown = 0,
  68045. /**
  68046. * @property RightUp
  68047. * @type {Number}
  68048. * @static
  68049. */
  68050. RightUp = 1,
  68051. /**
  68052. * @property LeftDown
  68053. * @type {Number}
  68054. * @static
  68055. */
  68056. LeftDown = 2,
  68057. /**
  68058. * @property LeftUp
  68059. * @type {Number}
  68060. * @static
  68061. */
  68062. LeftUp = 3
  68063. }
  68064. /**
  68065. * @en TiledMap Object Type
  68066. * @zh 地图物体类型
  68067. * @enum TiledMap.TMXObjectType
  68068. * @static
  68069. */
  68070. export enum _cocos_tiledmap_tiled_types__TMXObjectType {
  68071. /**
  68072. * @property RECT
  68073. * @type {Number}
  68074. * @static
  68075. */
  68076. RECT = 0,
  68077. /**
  68078. * @property ELLIPSE
  68079. * @type {Number}
  68080. * @static
  68081. */
  68082. ELLIPSE = 1,
  68083. /**
  68084. * @property POLYGON
  68085. * @type {Number}
  68086. * @static
  68087. */
  68088. POLYGON = 2,
  68089. /**
  68090. * @property POLYLINE
  68091. * @type {Number}
  68092. * @static
  68093. */
  68094. POLYLINE = 3,
  68095. /**
  68096. * @property IMAGE
  68097. * @type {Number}
  68098. * @static
  68099. */
  68100. IMAGE = 4,
  68101. /**
  68102. * @property TEXT
  68103. * @type {Number}
  68104. * @static
  68105. */
  68106. TEXT = 5
  68107. }
  68108. export interface _cocos_tiledmap_tiled_types__TMXObject {
  68109. id: number | string;
  68110. name: string;
  68111. width: number;
  68112. height: number;
  68113. x: number;
  68114. y: number;
  68115. rotation: number;
  68116. type: _cocos_tiledmap_tiled_types__TMXObjectType;
  68117. visible: boolean;
  68118. wrap: boolean;
  68119. color: math.Color;
  68120. halign: HorizontalTextAlignment;
  68121. valign: VerticalTextAlignment;
  68122. pixelsize: number;
  68123. text: string;
  68124. gid: _cocos_tiledmap_tiled_types__MixedGID;
  68125. points: {
  68126. x: number;
  68127. y: number;
  68128. }[];
  68129. polylinePoints: {
  68130. x: number;
  68131. y: number;
  68132. }[] | null;
  68133. offset?: math.Vec2;
  68134. }
  68135. export type _cocos_tiledmap_tiled_types__DrawOrder = "topdown" | "bottomup";
  68136. /**
  68137. * <p>cc.TMXObjectGroupInfo contains the information about the object group like:
  68138. * - group name
  68139. * - group size
  68140. * - group opacity at creation time (it can be modified at runtime)
  68141. * - Whether the group is visible
  68142. *
  68143. * This information is obtained from the TMX file.</p>
  68144. * @class TMXObjectGroupInfo
  68145. */
  68146. export class _cocos_tiledmap_tiled_types__TMXObjectGroupInfo {
  68147. /**
  68148. * Properties of the ObjectGroup info.
  68149. * @property {Array} properties
  68150. */
  68151. properties: _cocos_tiledmap_tiled_types__PropertiesInfo;
  68152. name: string;
  68153. objects: _cocos_tiledmap_tiled_types__TMXObject[];
  68154. visible: boolean;
  68155. opacity: number;
  68156. color: math.Color;
  68157. offset: math.Vec2;
  68158. draworder: _cocos_tiledmap_tiled_types__DrawOrder;
  68159. tintColor: math.Color | null;
  68160. /**
  68161. * Gets the Properties.
  68162. * @return {Array}
  68163. */
  68164. getProperties(): _cocos_tiledmap_tiled_types__PropertiesInfo;
  68165. /**
  68166. * Set the Properties.
  68167. * @param {object} value
  68168. */
  68169. setProperties(value: _cocos_tiledmap_tiled_types__PropertiesInfo): void;
  68170. }
  68171. /**
  68172. * cc.TMXLayerInfo contains the information about the layers like:
  68173. * - Layer name
  68174. * - Layer size
  68175. * - Layer opacity at creation time (it can be modified at runtime)
  68176. * - Whether the layer is visible (if it's not visible, then the CocosNode won't be created)
  68177. * This information is obtained from the TMX file.
  68178. * @class TMXLayerInfo
  68179. */
  68180. export class _cocos_tiledmap_tiled_types__TMXLayerInfo {
  68181. /**
  68182. * Properties of the layer info.
  68183. * @property {Object} properties
  68184. */
  68185. properties: _cocos_tiledmap_tiled_types__PropertiesInfo;
  68186. name: string;
  68187. layerSize: math.Size | null;
  68188. tiles: number[] | Uint32Array;
  68189. visible: boolean;
  68190. opacity: number;
  68191. ownTiles: boolean;
  68192. minGID: _cocos_tiledmap_tiled_types__GID;
  68193. maxGID: _cocos_tiledmap_tiled_types__GID;
  68194. offset: math.Vec2;
  68195. tintColor: math.Color | null;
  68196. /**
  68197. * Gets the Properties.
  68198. * @return {Object}
  68199. */
  68200. getProperties(): _cocos_tiledmap_tiled_types__PropertiesInfo;
  68201. /**
  68202. * Set the Properties.
  68203. * @param {object} value
  68204. */
  68205. setProperties(value: _cocos_tiledmap_tiled_types__PropertiesInfo): void;
  68206. /**
  68207. * @property ATTRIB_NONE
  68208. * @constant
  68209. * @static
  68210. * @type {Number}
  68211. * @default 1
  68212. */
  68213. static ATTRIB_NONE: number;
  68214. /**
  68215. * @property ATTRIB_BASE64
  68216. * @constant
  68217. * @static
  68218. * @type {Number}
  68219. * @default 2
  68220. */
  68221. static ATTRIB_BASE64: number;
  68222. /**
  68223. * @property ATTRIB_GZIP
  68224. * @constant
  68225. * @static
  68226. * @type {Number}
  68227. * @default 4
  68228. */
  68229. static ATTRIB_GZIP: number;
  68230. /**
  68231. * @property ATTRIB_ZLIB
  68232. * @constant
  68233. * @static
  68234. * @type {Number}
  68235. * @default 8
  68236. */
  68237. static ATTRIB_ZLIB: number;
  68238. }
  68239. /**
  68240. * @en The stagger axis of Hex tiled map.
  68241. * @zh 六边形地图的 stagger axis 值
  68242. * @enum TiledMap.StaggerAxis
  68243. * @static
  68244. */
  68245. export enum _cocos_tiledmap_tiled_types__StaggerAxis {
  68246. /**
  68247. * @property STAGGERAXIS_X
  68248. * @type {Number}
  68249. * @static
  68250. */
  68251. STAGGERAXIS_X = 0,
  68252. /**
  68253. * @property STAGGERAXIS_Y
  68254. * @type {Number}
  68255. * @static
  68256. */
  68257. STAGGERAXIS_Y = 1
  68258. }
  68259. /**
  68260. * @en The stagger index of Hex tiled map.
  68261. * @zh 六边形地图的 stagger index 值
  68262. * @enum TiledMap.RenderOrder
  68263. * @static
  68264. */
  68265. export enum _cocos_tiledmap_tiled_types__StaggerIndex {
  68266. /**
  68267. * @property STAGGERINDEX_ODD
  68268. * @type {Number}
  68269. * @static
  68270. */
  68271. STAGGERINDEX_ODD = 0,
  68272. /**
  68273. * @property STAGGERINDEX_EVEN
  68274. * @type {Number}
  68275. * @static
  68276. */
  68277. STAGGERINDEX_EVEN = 1
  68278. }
  68279. /**
  68280. * <p>cc.TMXMapInfo contains the information about the map like: <br/>
  68281. * - Map orientation (hexagonal, isometric or orthogonal)<br/>
  68282. * - Tile size<br/>
  68283. * - Map size</p>
  68284. *
  68285. * <p>And it also contains: <br/>
  68286. * - Layers (an array of TMXLayerInfo objects)<br/>
  68287. * - Tilesets (an array of TMXTilesetInfo objects) <br/>
  68288. * - ObjectGroups (an array of TMXObjectGroupInfo objects) </p>
  68289. *
  68290. * <p>This information is obtained from the TMX file. </p>
  68291. * @class TMXMapInfo
  68292. */
  68293. export class _cocos_tiledmap_tmx_xml_parser__TMXMapInfo {
  68294. /**
  68295. * Properties of the map info.
  68296. * @property {Array} properties
  68297. */
  68298. properties: _cocos_tiledmap_tiled_types__PropertiesInfo;
  68299. /**
  68300. * Map orientation.
  68301. * @property {Number} orientation
  68302. */
  68303. orientation: _cocos_tiledmap_tiled_types__Orientation | null;
  68304. /**
  68305. * Parent element.
  68306. * @property {Object} parentElement
  68307. */
  68308. parentElement: Record<string, unknown> | null;
  68309. /**
  68310. * Parent GID.
  68311. * @property {Number} parentGID
  68312. */
  68313. parentGID: _cocos_tiledmap_tiled_types__MixedGID;
  68314. /**
  68315. * Layer attributes.
  68316. * @property {Object} layerAttrs
  68317. */
  68318. layerAttrs: number;
  68319. /**
  68320. * Is reading storing characters stream.
  68321. * @property {Boolean} storingCharacters
  68322. */
  68323. storingCharacters: boolean;
  68324. /**
  68325. * Current string stored from characters stream.
  68326. * @property {String} currentString
  68327. */
  68328. currentString: string | null;
  68329. renderOrder: _cocos_tiledmap_tiled_types__RenderOrder;
  68330. protected _supportVersion: number[];
  68331. protected _objectGroups: _cocos_tiledmap_tiled_types__TMXObjectGroupInfo[];
  68332. protected _allChildren: (_cocos_tiledmap_tiled_types__TMXLayerInfo | _cocos_tiledmap_tiled_types__TMXImageLayerInfo | _cocos_tiledmap_tiled_types__TMXObjectGroupInfo)[];
  68333. protected _mapSize: math.Size;
  68334. get mapSize(): math.Size;
  68335. protected _tileSize: math.Size;
  68336. get tileSize(): math.Size;
  68337. protected _layers: _cocos_tiledmap_tiled_types__TMXLayerInfo[];
  68338. protected _tilesets: _cocos_tiledmap_tiled_types__TMXTilesetInfo[];
  68339. protected _imageLayers: _cocos_tiledmap_tiled_types__TMXImageLayerInfo[];
  68340. protected _tileProperties: Map<_cocos_tiledmap_tiled_types__GID, _cocos_tiledmap_tiled_types__PropertiesInfo>;
  68341. protected _tileAnimations: _cocos_tiledmap_tiled_types__TiledAnimationType;
  68342. protected _tsxContentMap: {
  68343. [key: string]: string;
  68344. } | null;
  68345. protected _spriteFrameMap: {
  68346. [key: string]: SpriteFrame;
  68347. } | null;
  68348. protected _spfSizeMap: {
  68349. [key: string]: math.Size;
  68350. };
  68351. protected _staggerAxis: _cocos_tiledmap_tiled_types__StaggerAxis | null;
  68352. protected _staggerIndex: _cocos_tiledmap_tiled_types__StaggerIndex | null;
  68353. protected _hexSideLength: number;
  68354. protected _imageLayerSPF: {
  68355. [key: string]: SpriteFrame;
  68356. } | null;
  68357. constructor(tmxFile: string, tsxContentMap: {
  68358. [key: string]: string;
  68359. }, spfTexturesMap: {
  68360. [key: string]: SpriteFrame;
  68361. }, textureSizes: {
  68362. [key: string]: math.Size;
  68363. }, imageLayerTextures: {
  68364. [key: string]: SpriteFrame;
  68365. });
  68366. getOrientation(): _cocos_tiledmap_tiled_types__Orientation | null;
  68367. /**
  68368. * Set the Map orientation.
  68369. * @param {Number} value
  68370. */
  68371. setOrientation(value: _cocos_tiledmap_tiled_types__Orientation): void;
  68372. /**
  68373. * Gets the staggerAxis of map.
  68374. * @return {TiledMap.StaggerAxis}
  68375. */
  68376. getStaggerAxis(): _cocos_tiledmap_tiled_types__StaggerAxis | null;
  68377. /**
  68378. * Set the staggerAxis of map.
  68379. * @param {TiledMap.StaggerAxis} value
  68380. */
  68381. setStaggerAxis(value: _cocos_tiledmap_tiled_types__StaggerAxis): void;
  68382. /**
  68383. * Gets stagger index
  68384. * @return {TiledMap.StaggerIndex}
  68385. */
  68386. getStaggerIndex(): _cocos_tiledmap_tiled_types__StaggerIndex | null;
  68387. /**
  68388. * Set the stagger index.
  68389. * @param {TiledMap.StaggerIndex} value
  68390. */
  68391. setStaggerIndex(value: any): void;
  68392. /**
  68393. * Gets Hex side length.
  68394. * @return {Number}
  68395. */
  68396. getHexSideLength(): number;
  68397. /**
  68398. * Set the Hex side length.
  68399. * @param {Number} value
  68400. */
  68401. setHexSideLength(value: number): void;
  68402. /**
  68403. * Map width & height
  68404. * @return {Size}
  68405. */
  68406. getMapSize(): math.Size;
  68407. /**
  68408. * Map width & height
  68409. * @param {Size} value
  68410. */
  68411. setMapSize(value: math.Size): void;
  68412. get mapWidth(): number;
  68413. set mapWidth(width: number);
  68414. get mapHeight(): number;
  68415. set mapHeight(height: number);
  68416. /**
  68417. * Tiles width & height
  68418. * @return {Size}
  68419. */
  68420. getTileSize(): math.Size;
  68421. /**
  68422. * Tiles width & height
  68423. * @param {Size} value
  68424. */
  68425. setTileSize(value: math.Size): void;
  68426. get tileWidth(): number;
  68427. set tileWidth(width: number);
  68428. /**
  68429. * Height of a tile
  68430. */
  68431. get tileHeight(): number;
  68432. set tileHeight(height: number);
  68433. /**
  68434. * Layers
  68435. * @return {Array}
  68436. */
  68437. getLayers(): _cocos_tiledmap_tiled_types__TMXLayerInfo[];
  68438. /**
  68439. * Layers
  68440. * @param {cc.TMXLayerInfo} value
  68441. */
  68442. setLayers(value: _cocos_tiledmap_tiled_types__TMXLayerInfo): void;
  68443. /**
  68444. * ImageLayers
  68445. * @return {Array}
  68446. */
  68447. getImageLayers(): _cocos_tiledmap_tiled_types__TMXImageLayerInfo[];
  68448. /**
  68449. * ImageLayers
  68450. * @param {cc.TMXImageLayerInfo} value
  68451. */
  68452. setImageLayers(value: _cocos_tiledmap_tiled_types__TMXImageLayerInfo): void;
  68453. /**
  68454. * tilesets
  68455. * @return {Array}
  68456. */
  68457. getTilesets(): _cocos_tiledmap_tiled_types__TMXTilesetInfo[];
  68458. /**
  68459. * tilesets
  68460. * @param {cc.TMXTilesetInfo} value
  68461. */
  68462. setTilesets(value: _cocos_tiledmap_tiled_types__TMXTilesetInfo): void;
  68463. /**
  68464. * ObjectGroups
  68465. * @return {Array}
  68466. */
  68467. getObjectGroups(): _cocos_tiledmap_tiled_types__TMXObjectGroupInfo[];
  68468. /**
  68469. * ObjectGroups
  68470. * @param {cc.TMXObjectGroup} value
  68471. */
  68472. setObjectGroups(value: _cocos_tiledmap_tiled_types__TMXObjectGroupInfo): void;
  68473. getAllChildren(): (_cocos_tiledmap_tiled_types__TMXObjectGroupInfo | _cocos_tiledmap_tiled_types__TMXLayerInfo | _cocos_tiledmap_tiled_types__TMXImageLayerInfo)[];
  68474. /**
  68475. * parent element
  68476. * @return {Object}
  68477. */
  68478. getParentElement(): Record<string, unknown> | null;
  68479. /**
  68480. * parent element
  68481. * @param {Object} value
  68482. */
  68483. setParentElement(value: any): void;
  68484. /**
  68485. * parent GID
  68486. * @return {Number}
  68487. */
  68488. getParentGID(): number;
  68489. /**
  68490. * parent GID
  68491. * @param {Number} value
  68492. */
  68493. setParentGID(value: any): void;
  68494. /**
  68495. * Layer attribute
  68496. * @return {Object}
  68497. */
  68498. getLayerAttribs(): number;
  68499. /**
  68500. * Layer attribute
  68501. * @param {Object} value
  68502. */
  68503. setLayerAttribs(value: any): void;
  68504. /**
  68505. * Is reading storing characters stream
  68506. * @return {Boolean}
  68507. */
  68508. getStoringCharacters(): boolean;
  68509. /**
  68510. * Is reading storing characters stream
  68511. * @param {Boolean} value
  68512. */
  68513. setStoringCharacters(value: any): void;
  68514. /**
  68515. * Properties
  68516. * @return {Array}
  68517. */
  68518. getProperties(): _cocos_tiledmap_tiled_types__PropertiesInfo;
  68519. /**
  68520. * Properties
  68521. * @param {object} value
  68522. */
  68523. setProperties(value: any): void;
  68524. /**
  68525. * initializes a TMX format with an XML string and a TMX resource path
  68526. * @param {String} tmxString
  68527. * @param {Object} tsxMap
  68528. * @param {Object} spfTextureMap
  68529. * @return {Boolean}
  68530. */
  68531. initWithXML(tmxString: string, tsxMap: {
  68532. [key: string]: string;
  68533. }, spfTextureMap: {
  68534. [key: string]: SpriteFrame;
  68535. }, textureSizes: {
  68536. [key: string]: math.Size;
  68537. }, imageLayerTextures: {
  68538. [key: string]: SpriteFrame;
  68539. }): HTMLElement;
  68540. /**
  68541. * Initializes parsing of an XML string, either a tmx (Map) string or tsx (Tileset) string
  68542. * @param {String} xmlString
  68543. * @param {Number} tilesetFirstGid
  68544. * @return {Element}
  68545. */
  68546. parseXMLString(xmlStr: string, tilesetFirstGid?: number): HTMLElement;
  68547. protected _shouldIgnoreNode(node: ChildNode): boolean;
  68548. protected _parseImageLayer(selLayer: Element): _cocos_tiledmap_tiled_types__TMXImageLayerInfo | null;
  68549. protected _parseLayer(selLayer: Element): _cocos_tiledmap_tiled_types__TMXLayerInfo | null;
  68550. protected _parseObjectGroup(selGroup: Element): _cocos_tiledmap_tiled_types__TMXObjectGroupInfo;
  68551. protected _parsePointsString(pointsString?: string): {
  68552. x: number;
  68553. y: number;
  68554. }[] | null;
  68555. /**
  68556. * Sets the tile animations.
  68557. * @return {Object}
  68558. */
  68559. setTileAnimations(animations: _cocos_tiledmap_tiled_types__TiledAnimationType): void;
  68560. /**
  68561. * Gets the tile animations.
  68562. * @return {Object}
  68563. */
  68564. getTileAnimations(): _cocos_tiledmap_tiled_types__TiledAnimationType;
  68565. /**
  68566. * Gets the tile properties.
  68567. * @return {Object}
  68568. */
  68569. getTileProperties(): Map<number, _cocos_tiledmap_tiled_types__PropertiesInfo>;
  68570. /**
  68571. * Set the tile properties.
  68572. * @param {Object} tileProperties
  68573. */
  68574. setTileProperties(tileProperties: Map<_cocos_tiledmap_tiled_types__GID, _cocos_tiledmap_tiled_types__PropertiesInfo>): void;
  68575. /**
  68576. * Gets the currentString
  68577. * @return {String}
  68578. */
  68579. getCurrentString(): string | null;
  68580. /**
  68581. * Set the currentString
  68582. * @param {String} currentString
  68583. */
  68584. setCurrentString(currentString: string): void;
  68585. static getNameWithPostfix(name: string): string;
  68586. static getShortName(name: string): string;
  68587. }
  68588. /**
  68589. * The property type of tiled map.
  68590. * @enum TiledMap.Property
  68591. * @static
  68592. */
  68593. export enum _cocos_tiledmap_tiled_types__Property {
  68594. /**
  68595. * @property NONE
  68596. * @type {Number}
  68597. * @static
  68598. */
  68599. NONE = 0,
  68600. /**
  68601. * @property MAP
  68602. * @type {Number}
  68603. * @static
  68604. */
  68605. MAP = 1,
  68606. /**
  68607. * @property LAYER
  68608. * @type {Number}
  68609. * @static
  68610. */
  68611. LAYER = 2,
  68612. /**
  68613. * @property OBJECTGROUP
  68614. * @type {Number}
  68615. * @static
  68616. */
  68617. OBJECTGROUP = 3,
  68618. /**
  68619. * @property OBJECT
  68620. * @type {Number}
  68621. * @static
  68622. */
  68623. OBJECT = 4,
  68624. /**
  68625. * @property TILE
  68626. * @type {Number}
  68627. * @static
  68628. */
  68629. TILE = 5
  68630. }
  68631. /**
  68632. * The tile flags of tiled map.
  68633. * @enum TiledMap.TileFlag
  68634. * @static
  68635. */
  68636. export enum _cocos_tiledmap_tiled_types__TileFlag {
  68637. /**
  68638. * @property HORIZONTAL
  68639. * @type {Number}
  68640. * @static
  68641. */
  68642. HORIZONTAL = 2147483648,
  68643. /**
  68644. * @property VERTICAL
  68645. * @type {Number}
  68646. * @static
  68647. */
  68648. VERTICAL = 1073741824,
  68649. /**
  68650. * @property DIAGONAL
  68651. * @type {Number}
  68652. * @static
  68653. */
  68654. DIAGONAL = 536870912,
  68655. /**
  68656. * @property FLIPPED_ALL
  68657. * @type {Number}
  68658. * @static
  68659. */
  68660. FLIPPED_ALL = 4026531840,
  68661. /**
  68662. * @property FLIPPED_MASK
  68663. * @type {Number}
  68664. * @static
  68665. */
  68666. FLIPPED_MASK = 268435455
  68667. }
  68668. /**
  68669. * To provide a safe Record type, if you want to enable checking index access on Object, please use SafeRecord instead of Record.
  68670. * we provide this type because we don't want to enable `noUncheckedIndexedAccess` in tsconfig.json for it's noisy for a lot of code.
  68671. */
  68672. export type __types_globals__SafeRecord<T extends (string | number | symbol), K> = Record<T, K | undefined>;
  68673. export interface _cocos_tiledmap_tiled_layer__TiledSubNodeData {
  68674. subNodes: (null | TiledUserNodeData)[];
  68675. }
  68676. export type _cocos_tiledmap_tiled_layer__TiledDataArray = (TiledRenderData | _cocos_tiledmap_tiled_layer__TiledSubNodeData)[];
  68677. /**
  68678. * @en Base classAction for action classes.
  68679. * @zh Action 类是所有动作类型的基类。
  68680. * @class Action
  68681. */
  68682. export class _cocos_tween_actions_action__Action {
  68683. /**
  68684. * @en Default Action tag.
  68685. * @zh 默认动作标签。
  68686. * @constant
  68687. * @static
  68688. * @default -1
  68689. */
  68690. static TAG_INVALID: number;
  68691. protected originalTarget: Node | null;
  68692. protected target: Node | null;
  68693. protected tag: number;
  68694. /**
  68695. * @en
  68696. * to copy object with deep copy.
  68697. * returns a clone of action.
  68698. * @zh 返回一个克隆的动作。
  68699. * @method clone
  68700. * @return {Action}
  68701. */
  68702. clone(): _cocos_tween_actions_action__Action;
  68703. /**
  68704. * @en
  68705. * return true if the action has finished.
  68706. * @zh 如果动作已完成就返回 true。
  68707. * @method isDone
  68708. * @return {Boolean}
  68709. */
  68710. isDone(): boolean;
  68711. startWithTarget(target: any): void;
  68712. stop(): void;
  68713. step(dt: number): void;
  68714. update(dt: number): void;
  68715. /**
  68716. * @en get the target.
  68717. * @zh 获取当前目标节点。
  68718. * @method getTarget
  68719. * @return {object}
  68720. */
  68721. getTarget(): Node | null;
  68722. /**
  68723. * @en The action will modify the target properties.
  68724. * @zh 设置目标节点。
  68725. * @method setTarget
  68726. * @param {object} target
  68727. */
  68728. setTarget(target: Node): void;
  68729. /**
  68730. * @en get the original target.
  68731. * @zh 获取原始目标节点。
  68732. * @method getOriginalTarget
  68733. * @return {object}
  68734. */
  68735. getOriginalTarget(): Node | null;
  68736. setOriginalTarget(originalTarget: any): void;
  68737. /**
  68738. * @en get tag number.
  68739. * @zh 获取用于识别动作的标签。
  68740. * @method getTag
  68741. * @return {Number}
  68742. */
  68743. getTag(): number;
  68744. /**
  68745. * @en set tag number.
  68746. * @zh 设置标签,用于识别动作。
  68747. * @method setTag
  68748. * @param {Number} tag
  68749. */
  68750. setTag(tag: number): void;
  68751. /**
  68752. * @en
  68753. * Returns a reversed action. <br />
  68754. * For example: <br />
  68755. * - The action will be x coordinates of 0 move to 100. <br />
  68756. * - The reversed action will be x of 100 move to 0.
  68757. * - Will be rewritten
  68758. * @zh 返回一个新的动作,执行与原动作完全相反的动作。
  68759. * @method reverse
  68760. * @return {Action | null}
  68761. */
  68762. reverse(): _cocos_tween_actions_action__Action | null;
  68763. retain(): void;
  68764. release(): void;
  68765. }
  68766. /**
  68767. * @en
  68768. * `ActionManager` is a class that can manage actions.<br/>
  68769. * Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
  68770. * which uses this class's singleton object.
  68771. * But there are some cases where you might need to use this class. <br/>
  68772. * Examples:<br/>
  68773. * - When you want to run an action where the target is different from a CCNode.<br/>
  68774. * - When you want to pause / resume the actions<br/>
  68775. * @zh
  68776. * `ActionManager` 是可以管理动作的单例类。<br/>
  68777. * 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
  68778. * 但也有一些情况下,您可能需要使用这个类。 <br/>
  68779. * 例如:
  68780. * - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
  68781. * - 当你想要暂停/恢复动作时。 <br/>
  68782. * @class ActionManager
  68783. * @example {@link cocos2d/core/CCActionManager/ActionManager.js}
  68784. */
  68785. export class _cocos_tween_actions_action_manager__ActionManager {
  68786. /**
  68787. * @en
  68788. * Adds an action with a target.<br/>
  68789. * If the target is already present, then the action will be added to the existing target.
  68790. * If the target is not present, a new instance of this target will be created either paused or not,
  68791. * and the action will be added to the newly created target.
  68792. * When the target is paused, the queued actions won't be 'ticked'.
  68793. * @zh
  68794. * 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
  68795. * 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
  68796. * 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
  68797. * 当目标状态的 paused 为 true,动作将不会被执行
  68798. *
  68799. * @method addAction
  68800. * @param {Action} action
  68801. * @param {object} target
  68802. * @param {Boolean} paused
  68803. */
  68804. addAction(action: _cocos_tween_actions_action__Action, target: Node, paused: boolean): void;
  68805. /**
  68806. * @en Removes all actions from all the targets.
  68807. * @zh 移除所有对象的所有动作。
  68808. * @method removeAllActions
  68809. */
  68810. removeAllActions(): void;
  68811. /**
  68812. * @en
  68813. * Removes all actions from a certain target. <br/>
  68814. * All the actions that belongs to the target will be removed.
  68815. * @zh
  68816. * 移除指定对象上的所有动作。<br/>
  68817. * 属于该目标的所有的动作将被删除。
  68818. * @method removeAllActionsFromTarget
  68819. * @param {Node} target
  68820. */
  68821. removeAllActionsFromTarget(target: Node): void;
  68822. /**
  68823. * @en Removes an action given an action reference.
  68824. * @zh 移除指定的动作。
  68825. * @method removeAction
  68826. * @param {Action} action
  68827. */
  68828. removeAction(action: _cocos_tween_actions_action__Action): void;
  68829. /**
  68830. * @internal
  68831. */
  68832. _removeActionByTag(tag: number, element: any, target?: Node): void;
  68833. /**
  68834. * @internal
  68835. */
  68836. _removeAllActionsByTag(tag: number, element: any, target?: Node): void;
  68837. /**
  68838. * @en Removes an action given its tag and the target.
  68839. * @zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
  68840. * @method removeActionByTag
  68841. * @param {Number} tag
  68842. * @param {Node} target
  68843. */
  68844. removeActionByTag(tag: number, target?: Node): void;
  68845. /**
  68846. * @en Removes all actions given the tag and the target.
  68847. * @zh 删除指定对象下特定标签的所有动作。
  68848. * @method removeAllActionsByTag
  68849. * @param {Number} tag
  68850. * @param {Node} target
  68851. */
  68852. removeAllActionsByTag(tag: number, target?: Node): void;
  68853. /**
  68854. * @en Gets an action given its tag an a target.
  68855. * @zh 通过目标对象和标签获取一个动作。
  68856. * @method getActionByTag
  68857. * @param {Number} tag
  68858. * @param {Node} target
  68859. * @return {Action|null} return the Action with the given tag on success
  68860. */
  68861. getActionByTag(tag: number, target: Node): _cocos_tween_actions_action__Action | null;
  68862. /**
  68863. * @en
  68864. * Returns the numbers of actions that are running in a certain target. <br/>
  68865. * Composable actions are counted as 1 action. <br/>
  68866. * Example: <br/>
  68867. * - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  68868. * - If you are running 7 Sequences of 2 actions, it will return 7.
  68869. * @zh
  68870. * 返回指定对象下所有正在运行的动作数量。 <br/>
  68871. * 组合动作被算作一个动作。<br/>
  68872. * 例如:<br/>
  68873. * - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
  68874. * - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
  68875. *
  68876. * @method getNumberOfRunningActionsInTarget
  68877. * @param {Node} target
  68878. * @return {Number}
  68879. */
  68880. getNumberOfRunningActionsInTarget(target: Node): number;
  68881. /**
  68882. * @en Pauses the target: all running actions and newly added actions will be paused.
  68883. * @zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
  68884. * @method pauseTarget
  68885. * @param {Node} target
  68886. */
  68887. pauseTarget(target: Node): void;
  68888. /**
  68889. * @en Resumes the target. All queued actions will be resumed.
  68890. * @zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
  68891. * @method resumeTarget
  68892. * @param {Node} target
  68893. */
  68894. resumeTarget(target: Node): void;
  68895. /**
  68896. * @en Pauses all running actions, returning a list of targets whose actions were paused.
  68897. * @zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
  68898. * @method pauseAllRunningActions
  68899. * @return {Array} a list of targets whose actions were paused.
  68900. */
  68901. pauseAllRunningActions(): Array<any>;
  68902. /**
  68903. * @en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
  68904. * @zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
  68905. * @method resumeTargets
  68906. * @param {Array} targetsToResume
  68907. */
  68908. resumeTargets(targetsToResume: Array<any>): void;
  68909. /**
  68910. * @en Pause a set of targets.
  68911. * @zh 暂停一组指定对象。
  68912. * @method pauseTargets
  68913. * @param {Array} targetsToPause
  68914. */
  68915. pauseTargets(targetsToPause: Array<any>): void;
  68916. /**
  68917. * @en
  68918. * purges the shared action manager. It releases the retained instance. <br/>
  68919. * because it uses this, so it can not be static.
  68920. * @zh
  68921. * 清除共用的动作管理器。它释放了持有的实例。 <br/>
  68922. * 因为它使用 this,因此它不能是静态的。
  68923. * @method purgeSharedManager
  68924. */
  68925. purgeSharedManager(): void;
  68926. /**
  68927. * @en The ActionManager update。
  68928. * @zh ActionManager 主循环。
  68929. * @method update
  68930. * @param {Number} dt delta time in seconds
  68931. */
  68932. update(dt: number): void;
  68933. }
  68934. export type _cocos_tween_tween__FlagExcludedType<Base, Type> = {
  68935. [Key in keyof Base]: Base[Key] extends Type ? never : Key;
  68936. };
  68937. export type _cocos_tween_tween__AllowedNames<Base, Type> = _cocos_tween_tween__FlagExcludedType<Base, Type>[keyof Base];
  68938. export type _cocos_tween_tween__KeyPartial<T, K extends keyof T> = {
  68939. [P in K]?: T[P];
  68940. };
  68941. export type _cocos_tween_tween__OmitType<Base, Type> = _cocos_tween_tween__KeyPartial<Base, _cocos_tween_tween__AllowedNames<Base, Type>>;
  68942. export type _cocos_tween_tween__ConstructorType<T> = _cocos_tween_tween__OmitType<T, Function>;
  68943. /**
  68944. * @en
  68945. * Base class actions that do have a finite time duration. <br/>
  68946. * Possible actions: <br/>
  68947. * - An action with a duration of 0 seconds. <br/>
  68948. * - An action with a duration of 35.5 seconds.
  68949. *
  68950. * Infinite time actions are valid
  68951. * @zh 有限时间动作,这种动作拥有时长 duration 属性。
  68952. * @class FiniteTimeAction
  68953. * @extends Action
  68954. */
  68955. export class _cocos_tween_actions_action__FiniteTimeAction extends _cocos_tween_actions_action__Action {
  68956. _duration: number;
  68957. _timesForRepeat: number;
  68958. /**
  68959. * @en get duration of the action. (seconds).
  68960. * @zh 获取动作以秒为单位的持续时间。
  68961. * @method getDuration
  68962. * @return {Number}
  68963. */
  68964. getDuration(): number;
  68965. /**
  68966. * @en set duration of the action. (seconds).
  68967. * @zh 设置动作以秒为单位的持续时间。
  68968. * @method setDuration
  68969. * @param {Number} duration
  68970. */
  68971. setDuration(duration: number): void;
  68972. /**
  68973. * @en
  68974. * to copy object with deep copy.
  68975. * returns a clone of action.
  68976. * @zh 返回一个克隆的动作。
  68977. * @method clone
  68978. * @return {FiniteTimeAction}
  68979. */
  68980. clone(): _cocos_tween_actions_action__FiniteTimeAction;
  68981. }
  68982. /**
  68983. * @en
  68984. * <p> An interval action is an action that takes place within a certain period of time. <br/>
  68985. * It has an start time, and a finish time. The finish time is the parameter<br/>
  68986. * duration plus the start time.</p>
  68987. *
  68988. * <p>These CCActionInterval actions have some interesting properties, like:<br/>
  68989. * - They can run normally (default) <br/>
  68990. * - They can run reversed with the reverse method <br/>
  68991. * - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>
  68992. *
  68993. * <p>For example, you can simulate a Ping Pong effect running the action normally and<br/>
  68994. * then running it again in Reverse mode. </p>
  68995. * @zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。
  68996. * @class ActionInterval
  68997. * @extends FiniteTimeAction
  68998. * @param {Number} d duration in seconds
  68999. */
  69000. export class _cocos_tween_actions_action_interval__ActionInterval extends _cocos_tween_actions_action__FiniteTimeAction {
  69001. protected MAX_VALUE: number;
  69002. protected _elapsed: number;
  69003. protected _firstTick: boolean;
  69004. protected _easeList: Function[];
  69005. protected _speed: number;
  69006. protected _repeatForever: boolean;
  69007. _repeatMethod: boolean;
  69008. protected _speedMethod: boolean;
  69009. constructor(d?: number);
  69010. getElapsed(): number;
  69011. initWithDuration(d: number): boolean;
  69012. isDone(): boolean;
  69013. _cloneDecoration(action: _cocos_tween_actions_action_interval__ActionInterval): void;
  69014. _reverseEaseList(action: _cocos_tween_actions_action_interval__ActionInterval): void;
  69015. clone(): _cocos_tween_actions_action_interval__ActionInterval;
  69016. /**
  69017. * @en Implementation of ease motion.
  69018. * @zh 缓动运动。
  69019. * @method easing
  69020. * @param {Object} easeObj
  69021. * @returns {ActionInterval}
  69022. * @example
  69023. * import { easeIn } from 'cc';
  69024. * action.easing(easeIn(3.0));
  69025. */
  69026. easing(easeObj: any): _cocos_tween_actions_action_interval__ActionInterval;
  69027. _computeEaseTime(dt: any): any;
  69028. step(dt: number): void;
  69029. startWithTarget(target: any): void;
  69030. reverse(): _cocos_tween_actions_action_interval__ActionInterval;
  69031. setAmplitudeRate(amp: any): void;
  69032. getAmplitudeRate(): number;
  69033. /**
  69034. * @en
  69035. * Changes the speed of an action, making it take longer (speed>1)
  69036. * or less (speed<1) time. <br/>
  69037. * Useful to simulate 'slow motion' or 'fast forward' effect.
  69038. * @zh
  69039. * 改变一个动作的速度,使它的执行使用更长的时间(speed > 1)<br/>
  69040. * 或更少(speed < 1)可以有效得模拟“慢动作”或“快进”的效果。
  69041. * @param {Number} speed
  69042. * @returns {Action}
  69043. */
  69044. speed(speed: number): _cocos_tween_actions_action__Action;
  69045. /**
  69046. * @en
  69047. * Get this action speed.
  69048. * @zh
  69049. * 返回此动作速度
  69050. * @return {Number}
  69051. */
  69052. getSpeed(): number;
  69053. /**
  69054. * @en
  69055. * Set this action speed.
  69056. * @zh
  69057. * 设置此动作速度
  69058. * @param {Number} speed
  69059. * @returns {ActionInterval}
  69060. */
  69061. setSpeed(speed: number): _cocos_tween_actions_action_interval__ActionInterval;
  69062. /**
  69063. * @en
  69064. * Repeats an action a number of times.
  69065. * To repeat an action forever use the CCRepeatForever action.
  69066. * @zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。
  69067. * @method repeat
  69068. * @param {Number} times
  69069. * @returns {ActionInterval}
  69070. */
  69071. repeat(times: number): _cocos_tween_actions_action_interval__ActionInterval;
  69072. /**
  69073. * @en
  69074. * Repeats an action for ever. <br/>
  69075. * To repeat the an action for a limited number of times use the Repeat action. <br/>
  69076. * @zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。
  69077. * @method repeatForever
  69078. * @returns {ActionInterval}
  69079. */
  69080. repeatForever(): _cocos_tween_actions_action_interval__ActionInterval;
  69081. }
  69082. /**
  69083. * @en Enum for transition type.
  69084. *
  69085. * @zh 过渡类型。
  69086. */
  69087. export enum _cocos_ui_button__Transition {
  69088. /**
  69089. * @en The none type.
  69090. *
  69091. * @zh 不做任何过渡。
  69092. */
  69093. NONE = 0,
  69094. /**
  69095. * @en The color type.
  69096. *
  69097. * @zh 颜色过渡。
  69098. */
  69099. COLOR = 1,
  69100. /**
  69101. * @en The sprite type.
  69102. *
  69103. * @zh 精灵过渡。
  69104. */
  69105. SPRITE = 2,
  69106. /**
  69107. * @en The scale type.
  69108. *
  69109. * @zh 缩放过渡。
  69110. */
  69111. SCALE = 3
  69112. }
  69113. /**
  69114. * @en The event types of [[Button]]. All button events are distributed by the owner Node, not the component
  69115. * @zh [[Button]] 的事件类型,注意:事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。
  69116. */
  69117. export enum _cocos_ui_button__EventType {
  69118. /**
  69119. * @event click
  69120. * @param {Event.EventCustom} event
  69121. * @param {Button} button - The Button component.
  69122. */
  69123. CLICK = "click"
  69124. }
  69125. /**
  69126. * 定义了一些用于设置文本显示和文本格式化的标志位。
  69127. * @readonly
  69128. * @enum EditBox.InputFlag
  69129. */
  69130. export enum _cocos_ui_editbox_types__InputFlag {
  69131. /**
  69132. * 表明输入的文本是保密的数据,任何时候都应该隐藏起来,它隐含了 EDIT_BOX_INPUT_FLAG_SENSITIVE。
  69133. */
  69134. PASSWORD = 0,
  69135. /**
  69136. * 表明输入的文本是敏感数据,它禁止存储到字典或表里面,也不能用来自动补全和提示用户输入。
  69137. * 一个信用卡号码就是一个敏感数据的例子。
  69138. */
  69139. SENSITIVE = 1,
  69140. /**
  69141. * 这个标志用来指定在文本编辑的时候,是否把每一个单词的首字母大写。
  69142. */
  69143. INITIAL_CAPS_WORD = 2,
  69144. /**
  69145. * 这个标志用来指定在文本编辑是否每个句子的首字母大写。
  69146. */
  69147. INITIAL_CAPS_SENTENCE = 3,
  69148. /**
  69149. * 自动把输入的所有字符大写。
  69150. */
  69151. INITIAL_CAPS_ALL_CHARACTERS = 4,
  69152. /**
  69153. * Don't do anything with the input text.
  69154. */
  69155. DEFAULT = 5
  69156. }
  69157. /**
  69158. * 输入模式。
  69159. * @readonly
  69160. * @enum EditBox.InputMode
  69161. */
  69162. export enum _cocos_ui_editbox_types__InputMode {
  69163. /**
  69164. * 用户可以输入任何文本,包括换行符。
  69165. */
  69166. ANY = 0,
  69167. /**
  69168. * 允许用户输入一个电子邮件地址。
  69169. */
  69170. EMAIL_ADDR = 1,
  69171. /**
  69172. * 允许用户输入一个整数值。
  69173. */
  69174. NUMERIC = 2,
  69175. /**
  69176. * 允许用户输入一个电话号码。
  69177. */
  69178. PHONE_NUMBER = 3,
  69179. /**
  69180. * 允许用户输入一个 URL。
  69181. */
  69182. URL = 4,
  69183. /**
  69184. * 允许用户输入一个实数。
  69185. */
  69186. DECIMAL = 5,
  69187. /**
  69188. * 除了换行符以外,用户可以输入任何文本。
  69189. */
  69190. SINGLE_LINE = 6
  69191. }
  69192. /**
  69193. * 键盘的返回键类型。
  69194. * @readonly
  69195. * @enum EditBox.KeyboardReturnType
  69196. */
  69197. export enum _cocos_ui_editbox_types__KeyboardReturnType {
  69198. /**
  69199. * 默认。
  69200. */
  69201. DEFAULT = 0,
  69202. /**
  69203. * 完成类型。
  69204. */
  69205. DONE = 1,
  69206. /**
  69207. * 发送类型。
  69208. */
  69209. SEND = 2,
  69210. /**
  69211. * 搜索类型。
  69212. */
  69213. SEARCH = 3,
  69214. /**
  69215. * 跳转类型。
  69216. */
  69217. GO = 4,
  69218. /**
  69219. * 下一个类型。
  69220. */
  69221. NEXT = 5
  69222. }
  69223. export class _cocos_ui_editbox_edit_box_impl_base__EditBoxImplBase {
  69224. /**
  69225. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  69226. */
  69227. _editing: boolean;
  69228. /**
  69229. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  69230. */
  69231. _delegate: EditBox | null;
  69232. init(delegate: EditBox): void;
  69233. onEnable(): void;
  69234. beforeDraw(): void;
  69235. onDisable(): void;
  69236. clear(): void;
  69237. setTabIndex(index: number): void;
  69238. setSize(width: number, height: number): void;
  69239. setFocus(value: any): void;
  69240. isFocused(): boolean;
  69241. beginEditing(): void;
  69242. endEditing(): void;
  69243. }
  69244. export enum _cocos_ui_editbox_edit_box__EventType {
  69245. EDITING_DID_BEGAN = "editing-did-began",
  69246. EDITING_DID_ENDED = "editing-did-ended",
  69247. TEXT_CHANGED = "text-changed",
  69248. EDITING_RETURN = "editing-return",
  69249. XR_EDITING_DID_BEGAN = "xr-editing-did-began",
  69250. XR_EDITING_DID_ENDED = "xr-editing-did-ended"
  69251. }
  69252. /**
  69253. * @en Layout type.
  69254. *
  69255. * @zh 布局类型。
  69256. */
  69257. export enum _cocos_ui_layout__Type {
  69258. /**
  69259. * @en No layout.
  69260. *
  69261. * @zh 禁用布局。
  69262. */
  69263. NONE = 0,
  69264. /**
  69265. * @en Horizontal layout.
  69266. *
  69267. * @zh 水平布局。
  69268. */
  69269. HORIZONTAL = 1,
  69270. /**
  69271. * @en Vertical layout.
  69272. *
  69273. * @zh 垂直布局。
  69274. */
  69275. VERTICAL = 2,
  69276. /**
  69277. * @en Grid layout.
  69278. *
  69279. * @zh 网格布局。
  69280. */
  69281. GRID = 3
  69282. }
  69283. /**
  69284. * @en Layout Resize Mode.
  69285. *
  69286. * @zh 缩放模式。
  69287. */
  69288. export enum _cocos_ui_layout__ResizeMode {
  69289. /**
  69290. * @en Don't scale.
  69291. *
  69292. * @zh 不做任何缩放。
  69293. */
  69294. NONE = 0,
  69295. /**
  69296. * @en The container size will be expanded with its children's size.
  69297. *
  69298. * @zh 容器的大小会根据子节点的大小自动缩放。
  69299. */
  69300. CONTAINER = 1,
  69301. /**
  69302. * @en Child item size will be adjusted with the container's size.
  69303. *
  69304. * @zh 子节点的大小会随着容器的大小自动缩放。
  69305. */
  69306. CHILDREN = 2
  69307. }
  69308. /**
  69309. * @en Grid Layout start axis direction.
  69310. *
  69311. * @zh 布局轴向,只用于 GRID 布局。
  69312. */
  69313. export enum _cocos_ui_layout__AxisDirection {
  69314. /**
  69315. * @en The horizontal axis.
  69316. *
  69317. * @zh 进行水平方向布局。
  69318. */
  69319. HORIZONTAL = 0,
  69320. /**
  69321. * @en The vertical axis.
  69322. *
  69323. * @zh 进行垂直方向布局。
  69324. */
  69325. VERTICAL = 1
  69326. }
  69327. /**
  69328. * @en Vertical layout direction.
  69329. *
  69330. * @zh 垂直方向布局方式。
  69331. */
  69332. export enum _cocos_ui_layout__VerticalDirection {
  69333. /**
  69334. * @en Items arranged from bottom to top.
  69335. *
  69336. * @zh 从下到上排列。
  69337. */
  69338. BOTTOM_TO_TOP = 0,
  69339. /**
  69340. * @en Items arranged from top to bottom.
  69341. * @zh 从上到下排列。
  69342. */
  69343. TOP_TO_BOTTOM = 1
  69344. }
  69345. /**
  69346. * @en Horizontal layout direction.
  69347. *
  69348. * @zh 水平方向布局方式。
  69349. */
  69350. export enum _cocos_ui_layout__HorizontalDirection {
  69351. /**
  69352. * @en Items arranged from left to right.
  69353. *
  69354. * @zh 从左往右排列。
  69355. */
  69356. LEFT_TO_RIGHT = 0,
  69357. /**
  69358. * @en Items arranged from right to left.
  69359. * @zh 从右往左排列。
  69360. */
  69361. RIGHT_TO_LEFT = 1
  69362. }
  69363. /**
  69364. * @en Layout constraint.
  69365. *
  69366. * @zh 布局约束。
  69367. */
  69368. export enum _cocos_ui_layout__Constraint {
  69369. /**
  69370. * @en Constraint free.
  69371. *
  69372. * @zh 自由排布。
  69373. */
  69374. NONE = 0,
  69375. /**
  69376. * @en Keep the number of rows fixed.
  69377. *
  69378. * @zh 固定行。
  69379. */
  69380. FIXED_ROW = 1,
  69381. /**
  69382. * @en Keep the number of rows fixed columns.
  69383. *
  69384. * @zh 固定列。
  69385. */
  69386. FIXED_COL = 2
  69387. }
  69388. /**
  69389. * @en
  69390. * Enum for ProgressBar mode.
  69391. *
  69392. * @zh
  69393. * 进度条模式。
  69394. */
  69395. export enum _cocos_ui_progress_bar__Mode {
  69396. /**
  69397. * @en
  69398. * The mode of horizontal.
  69399. *
  69400. * @zh
  69401. * 水平方向模式。
  69402. */
  69403. HORIZONTAL = 0,
  69404. /**
  69405. * @en
  69406. * The mode of vertical.
  69407. *
  69408. * @zh
  69409. * 垂直方向模式。
  69410. */
  69411. VERTICAL = 1,
  69412. /**
  69413. * @en
  69414. * The mode of fill.
  69415. *
  69416. * @zh
  69417. * 填充模式。
  69418. */
  69419. FILLED = 2
  69420. }
  69421. /**
  69422. * @en
  69423. * Enum for ScrollBar direction.
  69424. *
  69425. * @zh
  69426. * 滚动条方向。
  69427. */
  69428. export enum _cocos_ui_scroll_bar__Direction {
  69429. /**
  69430. * @en
  69431. * Horizontal scroll.
  69432. *
  69433. * @zh
  69434. * 横向滚动。
  69435. */
  69436. HORIZONTAL = 0,
  69437. /**
  69438. * @en
  69439. * Vertical scroll.
  69440. *
  69441. * @zh
  69442. * 纵向滚动。
  69443. */
  69444. VERTICAL = 1
  69445. }
  69446. /**
  69447. * @en
  69448. * Enum for ScrollView event type.
  69449. *
  69450. * @zh
  69451. * 滚动视图事件类型。
  69452. */
  69453. export enum _cocos_ui_scroll_view__EventType {
  69454. /**
  69455. * @en
  69456. * It means an invalid event type or "default empty value" of EventType.
  69457. *
  69458. * @zh
  69459. * 代表无效事件, 或者EventType的默认空值。
  69460. */
  69461. NONE = "",
  69462. /**
  69463. * @en
  69464. * The event emitted when ScrollView scroll to the top boundary of inner container.
  69465. *
  69466. * @zh
  69467. * 滚动视图滚动到顶部边界事件。
  69468. */
  69469. SCROLL_TO_TOP = "scroll-to-top",
  69470. /**
  69471. * @en
  69472. * The event emitted when ScrollView scroll to the bottom boundary of inner container.
  69473. *
  69474. * @zh
  69475. * 滚动视图滚动到底部边界事件。
  69476. */
  69477. SCROLL_TO_BOTTOM = "scroll-to-bottom",
  69478. /**
  69479. * @en
  69480. * The event emitted when ScrollView scroll to the left boundary of inner container.
  69481. *
  69482. * @zh
  69483. * 滚动视图滚动到左边界事件。
  69484. */
  69485. SCROLL_TO_LEFT = "scroll-to-left",
  69486. /**
  69487. * @en
  69488. * The event emitted when ScrollView scroll to the right boundary of inner container.
  69489. *
  69490. * @zh
  69491. * 滚动视图滚动到右边界事件。
  69492. */
  69493. SCROLL_TO_RIGHT = "scroll-to-right",
  69494. /**
  69495. * @en
  69496. * The event emitted when ScrollView scroll began.
  69497. *
  69498. * @zh
  69499. * 滚动视图滚动开始时发出的事件。
  69500. */
  69501. SCROLL_BEGAN = "scroll-began",
  69502. /**
  69503. * @en
  69504. * The event emitted when ScrollView auto scroll ended.
  69505. *
  69506. * @zh
  69507. * 滚动视图滚动结束的时候发出的事件。
  69508. */
  69509. SCROLL_ENDED = "scroll-ended",
  69510. /**
  69511. * @en
  69512. * The event emitted when ScrollView scroll to the top boundary of inner container and start bounce.
  69513. *
  69514. * @zh
  69515. * 滚动视图滚动到顶部边界并且开始回弹时发出的事件。
  69516. */
  69517. BOUNCE_TOP = "bounce-top",
  69518. /**
  69519. * @en
  69520. * The event emitted when ScrollView scroll to the bottom boundary of inner container and start bounce.
  69521. *
  69522. * @zh
  69523. * 滚动视图滚动到底部边界并且开始回弹时发出的事件。
  69524. */
  69525. BOUNCE_BOTTOM = "bounce-bottom",
  69526. /**
  69527. * @en
  69528. * The event emitted when ScrollView scroll to the left boundary of inner container and start bounce.
  69529. *
  69530. * @zh
  69531. * 滚动视图滚动到左边界并且开始回弹时发出的事件。
  69532. */
  69533. BOUNCE_LEFT = "bounce-left",
  69534. /**
  69535. * @en
  69536. * The event emitted when ScrollView scroll to the right boundary of inner container and start bounce.
  69537. *
  69538. * @zh
  69539. * 滚动视图滚动到右边界并且开始回弹时发出的事件。
  69540. */
  69541. BOUNCE_RIGHT = "bounce-right",
  69542. /**
  69543. * @en
  69544. * The event emitted when ScrollView is scrolling.
  69545. *
  69546. * @zh
  69547. * 滚动视图正在滚动时发出的事件。
  69548. */
  69549. SCROLLING = "scrolling",
  69550. /**
  69551. * @en
  69552. * The event emitted when ScrollView auto scroll ended with a threshold.
  69553. *
  69554. * @zh
  69555. * 滚动视图自动滚动快要结束的时候发出的事件。
  69556. */
  69557. SCROLL_ENG_WITH_THRESHOLD = "scroll-ended-with-threshold",
  69558. /**
  69559. * @en
  69560. * The event emitted when user release the touch.
  69561. *
  69562. * @zh
  69563. * 当用户松手的时候会发出一个事件。
  69564. */
  69565. TOUCH_UP = "touch-up"
  69566. }
  69567. export enum _cocos_ui_scroll_view__XrhoverType {
  69568. NONE = 0,
  69569. LEFT = 1,
  69570. RIGHT = 2
  69571. }
  69572. /**
  69573. * @en
  69574. * The Slider Direction.
  69575. *
  69576. * @zh
  69577. * 滑动器方向。
  69578. */
  69579. export enum _cocos_ui_slider__Direction {
  69580. /**
  69581. * @en
  69582. * The horizontal direction.
  69583. *
  69584. * @zh
  69585. * 水平方向。
  69586. */
  69587. Horizontal = 0,
  69588. /**
  69589. * @en
  69590. * The vertical direction.
  69591. *
  69592. * @zh
  69593. * 垂直方向。
  69594. */
  69595. Vertical = 1
  69596. }
  69597. export enum _cocos_ui_toggle__EventType {
  69598. TOGGLE = "toggle"
  69599. }
  69600. /**
  69601. * @en Enum for Widget's alignment mode, indicating when the widget should refresh.
  69602. *
  69603. * @zh Widget 的对齐模式,表示 Widget 应该何时刷新。
  69604. */
  69605. export enum _cocos_ui_widget__AlignMode {
  69606. /**
  69607. * @en Only align once when the Widget is enabled for the first time.
  69608. * This will allow the script or animation to continue controlling the current node.
  69609. * It will only be aligned once before the end of frame when onEnable is called,then immediately disables the Widget.
  69610. *
  69611. * @zh 仅在 Widget 第一次激活时对齐一次,便于脚本或动画继续控制当前节点。<br/>
  69612. * 开启后会在 onEnable 时所在的那一帧结束前对齐一次,然后立刻禁用该 Widget。
  69613. */
  69614. ONCE = 0,
  69615. /**
  69616. * @en Keep aligning all the way.
  69617. *
  69618. * @zh 始终保持对齐。
  69619. */
  69620. ALWAYS = 1,
  69621. /**
  69622. * @en
  69623. * At the beginning, the widget will be aligned as the method 'ONCE'.
  69624. * After that the widget will be aligned only when the size of screen is modified.
  69625. *
  69626. * @zh
  69627. * 一开始会像 ONCE 一样对齐一次,之后每当窗口大小改变时还会重新对齐。
  69628. */
  69629. ON_WINDOW_RESIZE = 2
  69630. }
  69631. /**
  69632. * @en Enum for Widget's alignment flag, indicating when the widget select alignment.
  69633. *
  69634. * @zh Widget 的对齐标志,表示 Widget 选择对齐状态。
  69635. */
  69636. export enum _cocos_ui_widget__AlignFlags {
  69637. /**
  69638. * @en Align top.
  69639. *
  69640. * @zh 上边对齐。
  69641. */
  69642. TOP = 1,
  69643. /**
  69644. * @en Align middle.
  69645. *
  69646. * @zh 垂直中心对齐。
  69647. */
  69648. MID = 2,
  69649. /**
  69650. * @en Align bottom.
  69651. *
  69652. * @zh 下边对齐。
  69653. */
  69654. BOT = 4,
  69655. /**
  69656. * @en Align left.
  69657. *
  69658. * @zh 左边对齐。
  69659. */
  69660. LEFT = 8,
  69661. /**
  69662. * @en Align center.
  69663. *
  69664. * @zh 横向中心对齐。
  69665. */
  69666. CENTER = 16,
  69667. /**
  69668. * @en Align right.
  69669. *
  69670. * @zh 右边对齐。
  69671. */
  69672. RIGHT = 32,
  69673. /**
  69674. * @en Align horizontal.
  69675. *
  69676. * @zh 横向对齐。
  69677. */
  69678. HORIZONTAL = 56,
  69679. /**
  69680. * @en Align vertical.
  69681. *
  69682. * @zh 纵向对齐。
  69683. */
  69684. VERTICAL = 7
  69685. }
  69686. /**
  69687. * @en Enum for Page View Size Mode.
  69688. *
  69689. * @zh 页面视图每个页面统一的大小类型。
  69690. */
  69691. export enum _cocos_ui_page_view__SizeMode {
  69692. /**
  69693. * @en Each page is unified in size.
  69694. * @zh 每个页面统一大小。
  69695. */
  69696. Unified = 0,
  69697. /**
  69698. * @en Each page is in free size.
  69699. * @zh 每个页面大小随意。
  69700. */
  69701. Free = 1
  69702. }
  69703. /**
  69704. * @en Enum for Page View Direction.
  69705. *
  69706. * @zh 页面视图滚动类型。
  69707. */
  69708. export enum _cocos_ui_page_view__Direction {
  69709. /**
  69710. * @en Horizontal scroll.
  69711. * @zh 水平滚动。
  69712. */
  69713. Horizontal = 0,
  69714. /**
  69715. * @en Vertical scroll.
  69716. * @zh 垂直滚动。
  69717. */
  69718. Vertical = 1
  69719. }
  69720. /**
  69721. * @en Enum for ScrollView event type.
  69722. *
  69723. * @zh 滚动视图事件类型。
  69724. */
  69725. export enum _cocos_ui_page_view__EventType {
  69726. PAGE_TURNING = "page-turning"
  69727. }
  69728. /**
  69729. * @en Enum for PageView Indicator direction.
  69730. *
  69731. * @zh 页面视图指示器的摆放方向。
  69732. *
  69733. * @enum PageViewIndicator.Direction
  69734. */
  69735. export enum _cocos_ui_page_view_indicator__Direction {
  69736. /**
  69737. * @en The horizontal direction.
  69738. *
  69739. * @zh 水平方向。
  69740. */
  69741. HORIZONTAL = 0,
  69742. /**
  69743. * @en The vertical direction.
  69744. *
  69745. * @zh 垂直方向。
  69746. */
  69747. VERTICAL = 1
  69748. }
  69749. function _cocos_ui_widget_manager__updateAlignment(node: Node): void;
  69750. export const _cocos_ui_view__View_base: new (...args: any[]) => System & _cocos_core_event_eventify__IEventified;
  69751. /**
  69752. * ContainerStrategy class is the root strategy class of container's scale strategy,
  69753. * it controls the behavior of how to scale the cc.game.container and cc.game.canvas object
  69754. */
  69755. export class _cocos_ui_view__ContainerStrategy {
  69756. static EQUAL_TO_FRAME: any;
  69757. static PROPORTION_TO_FRAME: any;
  69758. name: string;
  69759. /**
  69760. * @en Manipulation before appling the strategy
  69761. * @zh 在应用策略之前的操作
  69762. * @param view - The target view
  69763. */
  69764. preApply(_view: View): void;
  69765. /**
  69766. * @en Function to apply this strategy
  69767. * @zh 策略应用方法
  69768. * @param view
  69769. * @param designedResolution
  69770. */
  69771. apply(_view: View, designedResolution: math.Size): void;
  69772. /**
  69773. * @en
  69774. * Manipulation after applying the strategy
  69775. * @zh 策略调用之后的操作
  69776. * @param view The target view
  69777. */
  69778. postApply(_view: View): void;
  69779. protected _setupCanvas(): void;
  69780. }
  69781. /**
  69782. * !en
  69783. * Emit when design resolution changed.
  69784. * !zh
  69785. * 当设计分辨率改变时发送。
  69786. * @event design-resolution-changed
  69787. */
  69788. export interface _cocos_ui_view__AdaptResult {
  69789. scale: number[];
  69790. viewport?: null | math.Rect;
  69791. }
  69792. /**
  69793. * @en
  69794. * Emit when canvas resize.
  69795. * @zh
  69796. * 当画布大小改变时发送。
  69797. * @event canvas-resize
  69798. */
  69799. /**
  69800. * ContentStrategy class is the root strategy class of content's scale strategy,
  69801. * it controls the behavior of how to scale the scene and setup the viewport for the game
  69802. *
  69803. * @class ContentStrategy
  69804. */
  69805. export class _cocos_ui_view__ContentStrategy {
  69806. static EXACT_FIT: any;
  69807. static SHOW_ALL: any;
  69808. static NO_BORDER: any;
  69809. static FIXED_HEIGHT: any;
  69810. static FIXED_WIDTH: any;
  69811. name: string;
  69812. constructor();
  69813. /**
  69814. * @en Manipulation before applying the strategy
  69815. * @zh 策略应用前的操作
  69816. * @param view - The target view
  69817. */
  69818. preApply(_view: View): void;
  69819. /**
  69820. * @en Function to apply this strategy
  69821. * The return value is {scale: [scaleX, scaleY], viewport: {new Rect}},
  69822. * The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  69823. * @zh 调用策略方法
  69824. * @return The result scale and viewport rect
  69825. */
  69826. apply(_view: View, designedResolution: math.Size): _cocos_ui_view__AdaptResult;
  69827. /**
  69828. * @en Manipulation after applying the strategy
  69829. * @zh 策略调用之后的操作
  69830. * @param view - The target view
  69831. */
  69832. postApply(_view: View): void;
  69833. /**
  69834. * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
  69835. */
  69836. _buildResult(containerW: any, containerH: any, contentW: any, contentH: any, scaleX: any, scaleY: any): _cocos_ui_view__AdaptResult;
  69837. }
  69838. export enum _cocos_video_video_player_enums__EventType {
  69839. /**
  69840. * @en None.
  69841. * @zh 无。
  69842. */
  69843. NONE = "none",
  69844. /**
  69845. * @en The video is playing.
  69846. * @zh 视频播放中。
  69847. */
  69848. PLAYING = "playing",
  69849. /**
  69850. * @en Video paused.
  69851. * @zh 视频暂停中。
  69852. */
  69853. PAUSED = "paused",
  69854. /**
  69855. * @en Video stopped.
  69856. * @zh 视频停止中。
  69857. */
  69858. STOPPED = "stopped",
  69859. /**
  69860. * @en Video playback complete.
  69861. * @zh 视频播放完毕。
  69862. */
  69863. COMPLETED = "completed",
  69864. /**
  69865. * @en Video metadata loading complete.
  69866. * @zh 视频元数据加载完毕。
  69867. */
  69868. META_LOADED = "meta-loaded",
  69869. /**
  69870. * @en The video is ready to play when loaded.
  69871. * @zh 视频加载完毕可播放。
  69872. */
  69873. READY_TO_PLAY = "ready-to-play",
  69874. /**
  69875. * @en Errors triggered while processing video
  69876. * @zh 处理视频时触发的错误。
  69877. */
  69878. ERROR = "error",
  69879. /**
  69880. * @en Video is clicked.
  69881. * @zh 视频被点击。
  69882. */
  69883. CLICKED = "clicked"
  69884. }
  69885. export abstract class _cocos_video_video_player_impl__VideoPlayerImpl {
  69886. protected _componentEventList: Map<string, () => void>;
  69887. protected _state: _cocos_video_video_player_enums__EventType;
  69888. protected _video: HTMLVideoElement | null;
  69889. protected _onInterruptedBegin: () => void;
  69890. protected _onInterruptedEnd: () => void;
  69891. protected _interrupted: boolean;
  69892. protected _loaded: boolean;
  69893. protected _loadedMeta: boolean;
  69894. protected _ignorePause: boolean;
  69895. protected _fullScreenOnAwake: boolean;
  69896. protected _visible: boolean;
  69897. protected _playing: boolean;
  69898. protected _cachedCurrentTime: number;
  69899. protected _waitingFullscreen: boolean;
  69900. protected _waitingPlay: boolean;
  69901. protected _keepAspectRatio: boolean;
  69902. protected _component: VideoPlayer | null;
  69903. protected _uiTrans: UITransform | null;
  69904. protected _node: Node | null;
  69905. protected _stayOnBottom: boolean;
  69906. protected _dirty: boolean;
  69907. protected _forceUpdate: boolean;
  69908. protected _w: number;
  69909. protected _h: number;
  69910. protected _m00: number;
  69911. protected _m01: number;
  69912. protected _m04: number;
  69913. protected _m05: number;
  69914. protected _m12: number;
  69915. protected _m13: number;
  69916. constructor(component: any);
  69917. abstract canPlay(): void;
  69918. abstract canFullScreen(enabled: boolean): void;
  69919. abstract pause(): void;
  69920. abstract resume(): void;
  69921. abstract stop(): void;
  69922. abstract seekTo(val: number): void;
  69923. abstract createVideoPlayer(url: string): void;
  69924. abstract removeVideoPlayer(): void;
  69925. abstract enable(): void;
  69926. abstract disable(noPause?: boolean): void;
  69927. abstract syncClip(clip: any): void;
  69928. abstract syncURL(url: string): void;
  69929. abstract syncStayOnBottom(enabled: boolean): void;
  69930. abstract syncKeepAspectRatio(enabled: boolean): void;
  69931. abstract syncPlaybackRate(val: number): void;
  69932. abstract syncVolume(val: number): void;
  69933. abstract syncMute(enabled: boolean): void;
  69934. abstract syncLoop(enabled: boolean): void;
  69935. abstract syncMatrix(): void;
  69936. abstract getDuration(): number;
  69937. abstract getCurrentTime(): number;
  69938. get fullScreenOnAwake(): boolean;
  69939. get loaded(): boolean;
  69940. get componentEventList(): Map<string, () => void>;
  69941. get video(): HTMLVideoElement | null;
  69942. get state(): _cocos_video_video_player_enums__EventType;
  69943. get isPlaying(): boolean;
  69944. get UICamera(): renderer.scene.Camera | null;
  69945. onLoadedMetadata(e: Event): void;
  69946. onCanPlay(e: Event): void;
  69947. onPlay(e: Event): void;
  69948. onPlaying(e: Event): void;
  69949. onPause(e: Event): void;
  69950. onStoped(e: Event): void;
  69951. onEnded(e: Event): void;
  69952. onClick(e: Event): void;
  69953. onError(e: Event): void;
  69954. play(): void;
  69955. delayedPlay(): void;
  69956. syncFullScreenOnAwake(enabled: boolean): void;
  69957. delayedFullScreen(): void;
  69958. protected dispatchEvent(key: any): void;
  69959. protected syncUITransform(width: any, height: any): void;
  69960. protected syncCurrentTime(): void;
  69961. destroy(): void;
  69962. }
  69963. export class _cocos_video_video_player_impl_web__VideoPlayerImplWeb extends _cocos_video_video_player_impl__VideoPlayerImpl {
  69964. protected _eventList: Map<string, ((e: Event) => void)>;
  69965. protected _clearColorA: number;
  69966. protected _clearFlag: any;
  69967. constructor(component: any);
  69968. protected addListener(type: string, handler: (e: Event) => void): void;
  69969. protected removeAllListeners(): void;
  69970. canPlay(): void;
  69971. pause(): void;
  69972. resume(): void;
  69973. stop(): void;
  69974. syncClip(clip: any): void;
  69975. syncURL(url: string): void;
  69976. syncPlaybackRate(val: number): void;
  69977. syncVolume(val: number): void;
  69978. syncMute(enabled: boolean): void;
  69979. syncLoop(enabled: boolean): void;
  69980. getDuration(): number;
  69981. getCurrentTime(): number;
  69982. seekTo(val: number): void;
  69983. canFullScreen(enabled: boolean): void;
  69984. syncStayOnBottom(enabled: boolean): void;
  69985. syncKeepAspectRatio(enabled: boolean): void;
  69986. removeVideoPlayer(): void;
  69987. createVideoPlayer(url: string): void;
  69988. protected _bindDomEvent(): void;
  69989. onCanPlay(e: Event): void;
  69990. enable(): void;
  69991. disable(noPause?: boolean): void;
  69992. syncMatrix(): void;
  69993. }
  69994. export enum _cocos_web_view_web_view_enums__EventType {
  69995. /**
  69996. * @en None.
  69997. * @zh 无。
  69998. */
  69999. NONE = "none",
  70000. /**
  70001. * @en Web page is loading.
  70002. * @zh 网页加载中。
  70003. */
  70004. LOADING = "loading",
  70005. /**
  70006. * @en Web page Load completed.
  70007. * @zh 网页加载完成。
  70008. */
  70009. LOADED = "loaded",
  70010. /**
  70011. * @en Web page error occurs when loading.
  70012. * @zh 网页加载出错。
  70013. */
  70014. ERROR = "error"
  70015. }
  70016. export abstract class _cocos_web_view_web_view_impl__WebViewImpl {
  70017. protected _componentEventList: Map<_cocos_web_view_web_view_enums__EventType, (...args: any[any]) => void>;
  70018. protected _state: _cocos_web_view_web_view_enums__EventType;
  70019. protected _wrapper: any;
  70020. protected _webview: HTMLIFrameElement | null;
  70021. protected _loaded: boolean;
  70022. protected _forceUpdate: boolean;
  70023. protected _component: WebView | null;
  70024. protected _uiTrans: UITransform | null;
  70025. protected _node: Node | null;
  70026. protected _w: number;
  70027. protected _h: number;
  70028. protected _m00: number;
  70029. protected _m01: number;
  70030. protected _m04: number;
  70031. protected _m05: number;
  70032. protected _m12: number;
  70033. protected _m13: number;
  70034. constructor(component: WebView);
  70035. reset(): void;
  70036. abstract loadURL(url: string): void;
  70037. abstract createWebView(): void;
  70038. abstract removeWebView(): void;
  70039. abstract enable(): void;
  70040. abstract disable(): void;
  70041. abstract syncMatrix(): void;
  70042. abstract evaluateJS(str: string): void;
  70043. abstract setOnJSCallback(callback: () => void): void;
  70044. abstract setJavascriptInterfaceScheme(scheme: string): void;
  70045. get loaded(): boolean;
  70046. get componentEventList(): Map<_cocos_web_view_web_view_enums__EventType, (...args: any) => void>;
  70047. get webview(): HTMLIFrameElement | null;
  70048. get state(): _cocos_web_view_web_view_enums__EventType;
  70049. get UICamera(): renderer.scene.Camera | null;
  70050. protected dispatchEvent(key: _cocos_web_view_web_view_enums__EventType, ...args: any[any]): void;
  70051. destroy(): void;
  70052. }
  70053. }
  70054. import { exoticAnimationTag, ExoticAnimation, additiveSettingsTag, AnimationClipAdditiveSettings } from "cc/editor/exotic-animation";
  70055. import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
  70056. import { AnimationMask, __private as ___private } from "cc/editor/new-gen-anim";
  70057. import { CCON } from "cc/editor/serialization";
  70058. export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
  70059. import { Details as _Details } from "cc";
  70060. export { };
  70061. }