123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985 |
- (function(t, e, i) {
- function n(i, r) {
- var s = e[i];
- if (!s) {
- var o = t[i];
- if (!o) return;
- var a = {};
- s = e[i] = {
- exports: a
- }, o[0]((function(t) {
- return n(o[1][t] || t)
- }), s, a)
- }
- return s.exports
- }
- for (var r = 0; r < i.length; r++) n(i[r])
- })({
- 1: [(function(t, e, i) {
- "use strict";
- t("../core/platform/CCClass");
- var n = t("../core/utils/misc");
- cc.Action = cc.Class({
- name: "cc.Action",
- ctor: function() {
- this.originalTarget = null, this.target = null, this.tag = cc.Action.TAG_INVALID
- },
- clone: function() {
- var t = new cc.Action;
- return t.originalTarget = null, t.target = null, t.tag = this.tag, t
- },
- isDone: function() {
- return !0
- },
- startWithTarget: function(t) {
- this.originalTarget = t, this.target = t
- },
- stop: function() {
- this.target = null
- },
- step: function(t) {
- cc.logID(1006)
- },
- update: function(t) {
- cc.logID(1007)
- },
- getTarget: function() {
- return this.target
- },
- setTarget: function(t) {
- this.target = t
- },
- getOriginalTarget: function() {
- return this.originalTarget
- },
- setOriginalTarget: function(t) {
- this.originalTarget = t
- },
- getTag: function() {
- return this.tag
- },
- setTag: function(t) {
- this.tag = t
- },
- retain: function() {},
- release: function() {}
- }), cc.Action.TAG_INVALID = -1, cc.FiniteTimeAction = cc.Class({
- name: "cc.FiniteTimeAction",
- extends: cc.Action,
- ctor: function() {
- this._duration = 0
- },
- getDuration: function() {
- return this._duration * (this._timesForRepeat || 1)
- },
- setDuration: function(t) {
- this._duration = t
- },
- reverse: function() {
- return cc.logID(1008), null
- },
- clone: function() {
- return new cc.FiniteTimeAction
- }
- }), cc.Speed = cc.Class({
- name: "cc.Speed",
- extends: cc.Action,
- ctor: function(t, e) {
- this._speed = 0, this._innerAction = null, t && this.initWithAction(t, e)
- },
- getSpeed: function() {
- return this._speed
- },
- setSpeed: function(t) {
- this._speed = t
- },
- initWithAction: function(t, e) {
- return t ? (this._innerAction = t, this._speed = e, !0) : (cc.errorID(1021), !1)
- },
- clone: function() {
- var t = new cc.Speed;
- return t.initWithAction(this._innerAction.clone(), this._speed), t
- },
- startWithTarget: function(t) {
- cc.Action.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
- },
- stop: function() {
- this._innerAction.stop(), cc.Action.prototype.stop.call(this)
- },
- step: function(t) {
- this._innerAction.step(t * this._speed)
- },
- isDone: function() {
- return this._innerAction.isDone()
- },
- reverse: function() {
- return new cc.Speed(this._innerAction.reverse(), this._speed)
- },
- setInnerAction: function(t) {
- this._innerAction !== t && (this._innerAction = t)
- },
- getInnerAction: function() {
- return this._innerAction
- }
- }), cc.speed = function(t, e) {
- return new cc.Speed(t, e)
- }, cc.Follow = cc.Class({
- name: "cc.Follow",
- extends: cc.Action,
- ctor: function(t, e) {
- this._followedNode = null, this._boundarySet = !1, this._boundaryFullyCovered = !1, this._halfScreenSize = null, this._fullScreenSize = null, this.leftBoundary = 0, this.rightBoundary = 0, this.topBoundary = 0, this.bottomBoundary = 0, this._worldRect = cc.rect(0, 0, 0, 0), t && (e ? this.initWithTarget(t, e) : this.initWithTarget(t))
- },
- clone: function() {
- var t = new cc.Follow,
- e = this._worldRect,
- i = new cc.Rect(e.x, e.y, e.width, e.height);
- return t.initWithTarget(this._followedNode, i), t
- },
- isBoundarySet: function() {
- return this._boundarySet
- },
- setBoudarySet: function(t) {
- this._boundarySet = t
- },
- initWithTarget: function(t, e) {
- if (!t) return cc.errorID(1022), !1;
- e = e || cc.rect(0, 0, 0, 0), this._followedNode = t, this._worldRect = e, this._boundarySet = !(0 === e.width && 0 === e.height), this._boundaryFullyCovered = !1;
- var i = cc.winSize;
- return this._fullScreenSize = cc.v2(i.width, i.height), this._halfScreenSize = this._fullScreenSize.mul(.5), this._boundarySet && (this.leftBoundary = -(e.x + e.width - this._fullScreenSize.x), this.rightBoundary = -e.x, this.topBoundary = -e.y, this.bottomBoundary = -(e.y + e.height - this._fullScreenSize.y), this.rightBoundary < this.leftBoundary && (this.rightBoundary = this.leftBoundary = (this.leftBoundary + this.rightBoundary) / 2), this.topBoundary < this.bottomBoundary && (this.topBoundary = this.bottomBoundary = (this.topBoundary + this.bottomBoundary) / 2), this.topBoundary === this.bottomBoundary && this.leftBoundary === this.rightBoundary && (this._boundaryFullyCovered = !0)), !0
- },
- step: function(t) {
- var e = this.target.convertToWorldSpaceAR(cc.Vec2.ZERO),
- i = this._followedNode.convertToWorldSpaceAR(cc.Vec2.ZERO),
- r = e.sub(i),
- s = this.target.parent.convertToNodeSpaceAR(r.add(this._halfScreenSize));
- if (this._boundarySet) {
- if (this._boundaryFullyCovered) return;
- this.target.setPosition(n.clampf(s.x, this.leftBoundary, this.rightBoundary), n.clampf(s.y, this.bottomBoundary, this.topBoundary))
- } else this.target.setPosition(s.x, s.y)
- },
- isDone: function() {
- return !this._followedNode.activeInHierarchy
- },
- stop: function() {
- this.target = null, cc.Action.prototype.stop.call(this)
- }
- }), cc.follow = function(t, e) {
- return new cc.Follow(t, e)
- }
- }), {
- "../core/platform/CCClass": 198,
- "../core/utils/misc": 300
- }],
- 2: [(function(t, e, i) {
- "use strict";
- function n(t, e, i, n, r, s) {
- var o = s * s,
- a = o * s,
- l = (1 - r) / 2,
- h = l * (2 * o - a - s),
- c = l * (-a + o) + (2 * a - 3 * o + 1),
- u = l * (a - 2 * o + s) + (-2 * a + 3 * o),
- _ = l * (a - o),
- f = t.x * h + e.x * c + i.x * u + n.x * _,
- d = t.y * h + e.y * c + i.y * u + n.y * _;
- return cc.v2(f, d)
- }
- function r(t, e) {
- return t[Math.min(t.length - 1, Math.max(e, 0))]
- }
- function s(t) {
- for (var e = [], i = t.length - 1; i >= 0; i--) e.push(cc.v2(t[i].x, t[i].y));
- return e
- }
- function o(t) {
- for (var e = [], i = 0; i < t.length; i++) e.push(cc.v2(t[i].x, t[i].y));
- return e
- }
- cc.CardinalSplineTo = cc.Class({
- name: "cc.CardinalSplineTo",
- extends: cc.ActionInterval,
- ctor: function(t, e, i) {
- this._points = [], this._deltaT = 0, this._tension = 0, this._previousPosition = null, this._accumulatedDiff = null, void 0 !== i && cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, i)
- },
- initWithDuration: function(t, e, i) {
- return e && 0 !== e.length ? !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this.setPoints(e), this._tension = i, !0) : (cc.errorID(1024), !1)
- },
- clone: function() {
- var t = new cc.CardinalSplineTo;
- return t.initWithDuration(this._duration, o(this._points), this._tension), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._deltaT = 1 / (this._points.length - 1), this._previousPosition = cc.v2(this.target.x, this.target.y), this._accumulatedDiff = cc.v2(0, 0)
- },
- update: function(t) {
- var e, i;
- t = this._computeEaseTime(t);
- var s = this._points;
- if (1 === t) e = s.length - 1, i = 1;
- else {
- var o = this._deltaT;
- i = (t - o * (e = 0 | t / o)) / o
- }
- var a, l, h = n(r(s, e - 1), r(s, e - 0), r(s, e + 1), r(s, e + 2), this._tension, i);
- if (cc.macro.ENABLE_STACKABLE_ACTIONS && (a = this.target.x - this._previousPosition.x, l = this.target.y - this._previousPosition.y, 0 !== a || 0 !== l)) {
- var c = this._accumulatedDiff;
- a = c.x + a, l = c.y + l, c.x = a, c.y = l, h.x += a, h.y += l
- }
- this.updatePosition(h)
- },
- reverse: function() {
- var t = s(this._points);
- return cc.cardinalSplineTo(this._duration, t, this._tension)
- },
- updatePosition: function(t) {
- this.target.setPosition(t), this._previousPosition = t
- },
- getPoints: function() {
- return this._points
- },
- setPoints: function(t) {
- this._points = t
- }
- }), cc.cardinalSplineTo = function(t, e, i) {
- return new cc.CardinalSplineTo(t, e, i)
- }, cc.CardinalSplineBy = cc.Class({
- name: "cc.CardinalSplineBy",
- extends: cc.CardinalSplineTo,
- ctor: function(t, e, i) {
- this._startPosition = cc.v2(0, 0), void 0 !== i && this.initWithDuration(t, e, i)
- },
- startWithTarget: function(t) {
- cc.CardinalSplineTo.prototype.startWithTarget.call(this, t), this._startPosition.x = t.x, this._startPosition.y = t.y
- },
- reverse: function() {
- for (var t, e = this._points.slice(), i = e[0], n = 1; n < e.length; ++n) t = e[n], e[n] = t.sub(i), i = t;
- var r = s(e);
- i = r[r.length - 1], r.pop(), i.x = -i.x, i.y = -i.y, r.unshift(i);
- for (n = 1; n < r.length; ++n)(t = r[n]).x = -t.x, t.y = -t.y, t.x += i.x, t.y += i.y, r[n] = t, i = t;
- return cc.cardinalSplineBy(this._duration, r, this._tension)
- },
- updatePosition: function(t) {
- var e = this._startPosition,
- i = t.x + e.x,
- n = t.y + e.y;
- this._previousPosition.x = i, this._previousPosition.y = n, this.target.setPosition(i, n)
- },
- clone: function() {
- var t = new cc.CardinalSplineBy;
- return t.initWithDuration(this._duration, o(this._points), this._tension), t
- }
- }), cc.cardinalSplineBy = function(t, e, i) {
- return new cc.CardinalSplineBy(t, e, i)
- }, cc.CatmullRomTo = cc.Class({
- name: "cc.CatmullRomTo",
- extends: cc.CardinalSplineTo,
- ctor: function(t, e) {
- e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5)
- },
- clone: function() {
- var t = new cc.CatmullRomTo;
- return t.initWithDuration(this._duration, o(this._points)), t
- }
- }), cc.catmullRomTo = function(t, e) {
- return new cc.CatmullRomTo(t, e)
- }, cc.CatmullRomBy = cc.Class({
- name: "cc.CatmullRomBy",
- extends: cc.CardinalSplineBy,
- ctor: function(t, e) {
- e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5)
- },
- clone: function() {
- var t = new cc.CatmullRomBy;
- return t.initWithDuration(this._duration, o(this._points)), t
- }
- }), cc.catmullRomBy = function(t, e) {
- return new cc.CatmullRomBy(t, e)
- }
- }), {}],
- 3: [(function(t, e, i) {
- "use strict";
- cc.easeIn = function(t) {
- return {
- _rate: t,
- easing: function(t) {
- return Math.pow(t, this._rate)
- },
- reverse: function() {
- return cc.easeIn(1 / this._rate)
- }
- }
- }, cc.easeOut = function(t) {
- return {
- _rate: t,
- easing: function(t) {
- return Math.pow(t, 1 / this._rate)
- },
- reverse: function() {
- return cc.easeOut(1 / this._rate)
- }
- }
- }, cc.easeInOut = function(t) {
- return {
- _rate: t,
- easing: function(t) {
- return (t *= 2) < 1 ? .5 * Math.pow(t, this._rate) : 1 - .5 * Math.pow(2 - t, this._rate)
- },
- reverse: function() {
- return cc.easeInOut(this._rate)
- }
- }
- };
- var n = {
- easing: function(t) {
- return 0 === t ? 0 : Math.pow(2, 10 * (t - 1))
- },
- reverse: function() {
- return r
- }
- };
- cc.easeExponentialIn = function() {
- return n
- };
- var r = {
- easing: function(t) {
- return 1 === t ? 1 : 1 - Math.pow(2, -10 * t)
- },
- reverse: function() {
- return n
- }
- };
- cc.easeExponentialOut = function() {
- return r
- };
- var s = {
- easing: function(t) {
- return 1 !== t && 0 !== t ? (t *= 2) < 1 ? .5 * Math.pow(2, 10 * (t - 1)) : .5 * (2 - Math.pow(2, -10 * (t - 1))) : t
- },
- reverse: function() {
- return s
- }
- };
- cc.easeExponentialInOut = function() {
- return s
- };
- var o = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : -1 * Math.cos(t * Math.PI / 2) + 1
- },
- reverse: function() {
- return a
- }
- };
- cc.easeSineIn = function() {
- return o
- };
- var a = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : Math.sin(t * Math.PI / 2)
- },
- reverse: function() {
- return o
- }
- };
- cc.easeSineOut = function() {
- return a
- };
- var l = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : -.5 * (Math.cos(Math.PI * t) - 1)
- },
- reverse: function() {
- return l
- }
- };
- cc.easeSineInOut = function() {
- return l
- };
- var h = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : (t -= 1, -Math.pow(2, 10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3))
- },
- reverse: function() {
- return c
- }
- };
- cc.easeElasticIn = function(t) {
- return t && .3 !== t ? {
- _period: t,
- easing: function(t) {
- return 0 === t || 1 === t ? t : (t -= 1, -Math.pow(2, 10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period))
- },
- reverse: function() {
- return cc.easeElasticOut(this._period)
- }
- } : h
- };
- var c = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3) + 1
- },
- reverse: function() {
- return h
- }
- };
- function u(t) {
- return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375
- }
- cc.easeElasticOut = function(t) {
- return t && .3 !== t ? {
- _period: t,
- easing: function(t) {
- return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period) + 1
- },
- reverse: function() {
- return cc.easeElasticIn(this._period)
- }
- } : c
- }, cc.easeElasticInOut = function(t) {
- return {
- _period: t = t || .3,
- easing: function(t) {
- var e = 0,
- i = this._period;
- if (0 === t || 1 === t) e = t;
- else {
- t *= 2, i || (i = this._period = .3 * 1.5);
- var n = i / 4;
- e = (t -= 1) < 0 ? -.5 * Math.pow(2, 10 * t) * Math.sin((t - n) * Math.PI * 2 / i) : Math.pow(2, -10 * t) * Math.sin((t - n) * Math.PI * 2 / i) * .5 + 1
- }
- return e
- },
- reverse: function() {
- return cc.easeElasticInOut(this._period)
- }
- }
- };
- var _ = {
- easing: function(t) {
- return 1 - u(1 - t)
- },
- reverse: function() {
- return f
- }
- };
- cc.easeBounceIn = function() {
- return _
- };
- var f = {
- easing: function(t) {
- return u(t)
- },
- reverse: function() {
- return _
- }
- };
- cc.easeBounceOut = function() {
- return f
- };
- var d = {
- easing: function(t) {
- return t < .5 ? .5 * (1 - u(1 - (t *= 2))) : .5 * u(2 * t - 1) + .5
- },
- reverse: function() {
- return d
- }
- };
- cc.easeBounceInOut = function() {
- return d
- };
- var p = {
- easing: function(t) {
- return 0 === t || 1 === t ? t : t * t * (2.70158 * t - 1.70158)
- },
- reverse: function() {
- return m
- }
- };
- cc.easeBackIn = function() {
- return p
- };
- var m = {
- easing: function(t) {
- return (t -= 1) * t * (2.70158 * t + 1.70158) + 1
- },
- reverse: function() {
- return p
- }
- };
- cc.easeBackOut = function() {
- return m
- };
- var y = {
- easing: function(t) {
- return (t *= 2) < 1 ? t * t * (3.5949095 * t - 2.5949095) / 2 : (t -= 2) * t * (3.5949095 * t + 2.5949095) / 2 + 1
- },
- reverse: function() {
- return y
- }
- };
- cc.easeBackInOut = function() {
- return y
- }, cc.easeBezierAction = function(t, e, i, n) {
- return {
- easing: function(r) {
- return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n
- },
- reverse: function() {
- return cc.easeBezierAction(n, i, e, t)
- }
- }
- };
- var v = {
- easing: function(t) {
- return Math.pow(t, 2)
- },
- reverse: function() {
- return v
- }
- };
- cc.easeQuadraticActionIn = function() {
- return v
- };
- var g = {
- easing: function(t) {
- return -t * (t - 2)
- },
- reverse: function() {
- return g
- }
- };
- cc.easeQuadraticActionOut = function() {
- return g
- };
- var x = {
- easing: function(t) {
- return (t *= 2) < 1 ? t * t * .5 : -.5 * (--t * (t - 2) - 1)
- },
- reverse: function() {
- return x
- }
- };
- cc.easeQuadraticActionInOut = function() {
- return x
- };
- var b = {
- easing: function(t) {
- return t * t * t * t
- },
- reverse: function() {
- return b
- }
- };
- cc.easeQuarticActionIn = function() {
- return b
- };
- var A = {
- easing: function(t) {
- return -((t -= 1) * t * t * t - 1)
- },
- reverse: function() {
- return A
- }
- };
- cc.easeQuarticActionOut = function() {
- return A
- };
- var C = {
- easing: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2)
- },
- reverse: function() {
- return C
- }
- };
- cc.easeQuarticActionInOut = function() {
- return C
- };
- var T = {
- easing: function(t) {
- return t * t * t * t * t
- },
- reverse: function() {
- return T
- }
- };
- cc.easeQuinticActionIn = function() {
- return T
- };
- var S = {
- easing: function(t) {
- return (t -= 1) * t * t * t * t + 1
- },
- reverse: function() {
- return S
- }
- };
- cc.easeQuinticActionOut = function() {
- return S
- };
- var w = {
- easing: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2)
- },
- reverse: function() {
- return w
- }
- };
- cc.easeQuinticActionInOut = function() {
- return w
- };
- var E = {
- easing: function(t) {
- return -1 * (Math.sqrt(1 - t * t) - 1)
- },
- reverse: function() {
- return E
- }
- };
- cc.easeCircleActionIn = function() {
- return E
- };
- var M = {
- easing: function(t) {
- return t -= 1, Math.sqrt(1 - t * t)
- },
- reverse: function() {
- return M
- }
- };
- cc.easeCircleActionOut = function() {
- return M
- };
- var D = {
- easing: function(t) {
- return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : (t -= 2, .5 * (Math.sqrt(1 - t * t) + 1))
- },
- reverse: function() {
- return D
- }
- };
- cc.easeCircleActionInOut = function() {
- return D
- };
- var B = {
- easing: function(t) {
- return t * t * t
- },
- reverse: function() {
- return B
- }
- };
- cc.easeCubicActionIn = function() {
- return B
- };
- var I = {
- easing: function(t) {
- return (t -= 1) * t * t + 1
- },
- reverse: function() {
- return I
- }
- };
- cc.easeCubicActionOut = function() {
- return I
- };
- var P = {
- easing: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2)
- },
- reverse: function() {
- return P
- }
- };
- cc.easeCubicActionInOut = function() {
- return P
- }
- }), {}],
- 4: [(function(t, e, i) {
- "use strict";
- cc.ActionInstant = cc.Class({
- name: "cc.ActionInstant",
- extends: cc.FiniteTimeAction,
- isDone: function() {
- return !0
- },
- step: function(t) {
- this.update(1)
- },
- update: function(t) {},
- reverse: function() {
- return this.clone()
- },
- clone: function() {
- return new cc.ActionInstant
- }
- }), cc.Show = cc.Class({
- name: "cc.Show",
- extends: cc.ActionInstant,
- update: function(t) {
- for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
- e[i].enabled = !0
- }
- },
- reverse: function() {
- return new cc.Hide
- },
- clone: function() {
- return new cc.Show
- }
- }), cc.show = function() {
- return new cc.Show
- }, cc.Hide = cc.Class({
- name: "cc.Hide",
- extends: cc.ActionInstant,
- update: function(t) {
- for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
- e[i].enabled = !1
- }
- },
- reverse: function() {
- return new cc.Show
- },
- clone: function() {
- return new cc.Hide
- }
- }), cc.hide = function() {
- return new cc.Hide
- }, cc.ToggleVisibility = cc.Class({
- name: "cc.ToggleVisibility",
- extends: cc.ActionInstant,
- update: function(t) {
- for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
- var n = e[i];
- n.enabled = !n.enabled
- }
- },
- reverse: function() {
- return new cc.ToggleVisibility
- },
- clone: function() {
- return new cc.ToggleVisibility
- }
- }), cc.toggleVisibility = function() {
- return new cc.ToggleVisibility
- }, cc.RemoveSelf = cc.Class({
- name: "cc.RemoveSelf",
- extends: cc.ActionInstant,
- ctor: function(t) {
- this._isNeedCleanUp = !0, void 0 !== t && this.init(t)
- },
- update: function(t) {
- this.target.removeFromParent(this._isNeedCleanUp)
- },
- init: function(t) {
- return this._isNeedCleanUp = t, !0
- },
- reverse: function() {
- return new cc.RemoveSelf(this._isNeedCleanUp)
- },
- clone: function() {
- return new cc.RemoveSelf(this._isNeedCleanUp)
- }
- }), cc.removeSelf = function(t) {
- return new cc.RemoveSelf(t)
- }, cc.FlipX = cc.Class({
- name: "cc.FlipX",
- extends: cc.ActionInstant,
- ctor: function(t) {
- this._flippedX = !1, void 0 !== t && this.initWithFlipX(t)
- },
- initWithFlipX: function(t) {
- return this._flippedX = t, !0
- },
- update: function(t) {
- this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? -1 : 1)
- },
- reverse: function() {
- return new cc.FlipX(!this._flippedX)
- },
- clone: function() {
- var t = new cc.FlipX;
- return t.initWithFlipX(this._flippedX), t
- }
- }), cc.flipX = function(t) {
- return new cc.FlipX(t)
- }, cc.FlipY = cc.Class({
- name: "cc.FlipY",
- extends: cc.ActionInstant,
- ctor: function(t) {
- this._flippedY = !1, void 0 !== t && this.initWithFlipY(t)
- },
- initWithFlipY: function(t) {
- return this._flippedY = t, !0
- },
- update: function(t) {
- this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedY ? -1 : 1)
- },
- reverse: function() {
- return new cc.FlipY(!this._flippedY)
- },
- clone: function() {
- var t = new cc.FlipY;
- return t.initWithFlipY(this._flippedY), t
- }
- }), cc.flipY = function(t) {
- return new cc.FlipY(t)
- }, cc.Place = cc.Class({
- name: "cc.Place",
- extends: cc.ActionInstant,
- ctor: function(t, e) {
- this._x = 0, this._y = 0, void 0 !== t && (void 0 !== t.x && (e = t.y, t = t.x), this.initWithPosition(t, e))
- },
- initWithPosition: function(t, e) {
- return this._x = t, this._y = e, !0
- },
- update: function(t) {
- this.target.setPosition(this._x, this._y)
- },
- clone: function() {
- var t = new cc.Place;
- return t.initWithPosition(this._x, this._y), t
- }
- }), cc.place = function(t, e) {
- return new cc.Place(t, e)
- }, cc.CallFunc = cc.Class({
- name: "cc.CallFunc",
- extends: cc.ActionInstant,
- ctor: function(t, e, i) {
- this._selectorTarget = null, this._function = null, this._data = null, this.initWithFunction(t, e, i)
- },
- initWithFunction: function(t, e, i) {
- return t && (this._function = t), e && (this._selectorTarget = e), void 0 !== i && (this._data = i), !0
- },
- execute: function() {
- this._function && this._function.call(this._selectorTarget, this.target, this._data)
- },
- update: function(t) {
- this.execute()
- },
- getTargetCallback: function() {
- return this._selectorTarget
- },
- setTargetCallback: function(t) {
- t !== this._selectorTarget && (this._selectorTarget && (this._selectorTarget = null), this._selectorTarget = t)
- },
- clone: function() {
- var t = new cc.CallFunc;
- return t.initWithFunction(this._function, this._selectorTarget, this._data), t
- }
- }), cc.callFunc = function(t, e, i) {
- return new cc.CallFunc(t, e, i)
- }
- }), {}],
- 5: [(function(t, e, i) {
- "use strict";
- function n(t, e, i, n, r) {
- return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n
- }
- cc.ActionInterval = cc.Class({
- name: "cc.ActionInterval",
- extends: cc.FiniteTimeAction,
- ctor: function(t) {
- this.MAX_VALUE = 2, this._elapsed = 0, this._firstTick = !1, this._easeList = null, this._speed = 1, this._timesForRepeat = 1, this._repeatForever = !1, this._repeatMethod = !1, this._speedMethod = !1, void 0 !== t && cc.ActionInterval.prototype.initWithDuration.call(this, t)
- },
- getElapsed: function() {
- return this._elapsed
- },
- initWithDuration: function(t) {
- return this._duration = 0 === t ? cc.macro.FLT_EPSILON : t, this._elapsed = 0, this._firstTick = !0, !0
- },
- isDone: function() {
- return this._elapsed >= this._duration
- },
- _cloneDecoration: function(t) {
- t._repeatForever = this._repeatForever, t._speed = this._speed, t._timesForRepeat = this._timesForRepeat, t._easeList = this._easeList, t._speedMethod = this._speedMethod, t._repeatMethod = this._repeatMethod
- },
- _reverseEaseList: function(t) {
- if (this._easeList) {
- t._easeList = [];
- for (var e = 0; e < this._easeList.length; e++) t._easeList.push(this._easeList[e].reverse())
- }
- },
- clone: function() {
- var t = new cc.ActionInterval(this._duration);
- return this._cloneDecoration(t), t
- },
- easing: function(t) {
- this._easeList ? this._easeList.length = 0 : this._easeList = [];
- for (var e = 0; e < arguments.length; e++) this._easeList.push(arguments[e]);
- return this
- },
- _computeEaseTime: function(t) {
- var e = this._easeList;
- if (!e || 0 === e.length) return t;
- for (var i = 0, n = e.length; i < n; i++) t = e[i].easing(t);
- return t
- },
- step: function(t) {
- this._firstTick ? (this._firstTick = !1, this._elapsed = 0) : this._elapsed += t;
- var e = this._elapsed / (this._duration > 1.192092896e-7 ? this._duration : 1.192092896e-7);
- e = 1 > e ? e : 1, this.update(e > 0 ? e : 0), this._repeatMethod && this._timesForRepeat > 1 && this.isDone() && (this._repeatForever || this._timesForRepeat--, this.startWithTarget(this.target), this.step(this._elapsed - this._duration))
- },
- startWithTarget: function(t) {
- cc.Action.prototype.startWithTarget.call(this, t), this._elapsed = 0, this._firstTick = !0
- },
- reverse: function() {
- return cc.logID(1010), null
- },
- setAmplitudeRate: function(t) {
- cc.logID(1011)
- },
- getAmplitudeRate: function() {
- return cc.logID(1012), 0
- },
- speed: function(t) {
- return t <= 0 ? (cc.logID(1013), this) : (this._speedMethod = !0, this._speed *= t, this)
- },
- getSpeed: function() {
- return this._speed
- },
- setSpeed: function(t) {
- return this._speed = t, this
- },
- repeat: function(t) {
- return t = Math.round(t), isNaN(t) || t < 1 ? (cc.logID(1014), this) : (this._repeatMethod = !0, this._timesForRepeat *= t, this)
- },
- repeatForever: function() {
- return this._repeatMethod = !0, this._timesForRepeat = this.MAX_VALUE, this._repeatForever = !0, this
- }
- }), cc.actionInterval = function(t) {
- return new cc.ActionInterval(t)
- }, cc.Sequence = cc.Class({
- name: "cc.Sequence",
- extends: cc.ActionInterval,
- ctor: function(t) {
- this._actions = [], this._split = null, this._last = 0, this._reversed = !1;
- var e = t instanceof Array ? t : arguments;
- if (1 !== e.length) {
- var i = e.length - 1;
- if (i >= 0 && null == e[i] && cc.logID(1015), i >= 0) {
- for (var n, r = e[0], s = 1; s < i; s++) e[s] && (n = r, r = cc.Sequence._actionOneTwo(n, e[s]));
- this.initWithTwoActions(r, e[i])
- }
- } else cc.errorID(1019)
- },
- initWithTwoActions: function(t, e) {
- if (!t || !e) return cc.errorID(1025), !1;
- var i = t._duration,
- n = e._duration,
- r = (i *= t._repeatMethod ? t._timesForRepeat : 1) + (n *= e._repeatMethod ? e._timesForRepeat : 1);
- return this.initWithDuration(r), this._actions[0] = t, this._actions[1] = e, !0
- },
- clone: function() {
- var t = new cc.Sequence;
- return this._cloneDecoration(t), t.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone()), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._split = this._actions[0]._duration / this._duration, this._split *= this._actions[0]._repeatMethod ? this._actions[0]._timesForRepeat : 1, this._last = -1
- },
- stop: function() {
- -1 !== this._last && this._actions[this._last].stop(), cc.Action.prototype.stop.call(this)
- },
- update: function(t) {
- var e, i, n = 0,
- r = this._split,
- s = this._actions,
- o = this._last;
- (t = this._computeEaseTime(t)) < r ? (e = 0 !== r ? t / r : 1, 0 === n && 1 === o && this._reversed && (s[1].update(0), s[1].stop())) : (n = 1, e = 1 === r ? 1 : (t - r) / (1 - r), -1 === o && (s[0].startWithTarget(this.target), s[0].update(1), s[0].stop()), 0 === o && (s[0].update(1), s[0].stop())), i = s[n], o === n && i.isDone() || (o !== n && i.startWithTarget(this.target), e *= i._timesForRepeat, i.update(e > 1 ? e % 1 : e), this._last = n)
- },
- reverse: function() {
- var t = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse());
- return this._cloneDecoration(t), this._reverseEaseList(t), t._reversed = !0, t
- }
- }), cc.sequence = function(t) {
- var e = t instanceof Array ? t : arguments;
- if (1 === e.length) return cc.errorID(1019), null;
- var i = e.length - 1;
- i >= 0 && null == e[i] && cc.logID(1015);
- var n = null;
- if (i >= 0) {
- n = e[0];
- for (var r = 1; r <= i; r++) e[r] && (n = cc.Sequence._actionOneTwo(n, e[r]))
- }
- return n
- }, cc.Sequence._actionOneTwo = function(t, e) {
- var i = new cc.Sequence;
- return i.initWithTwoActions(t, e), i
- }, cc.Repeat = cc.Class({
- name: "cc.Repeat",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._times = 0, this._total = 0, this._nextDt = 0, this._actionInstant = !1, this._innerAction = null, void 0 !== e && this.initWithAction(t, e)
- },
- initWithAction: function(t, e) {
- var i = t._duration * e;
- return !!this.initWithDuration(i) && (this._times = e, this._innerAction = t, t instanceof cc.ActionInstant && (this._actionInstant = !0, this._times -= 1), this._total = 0, !0)
- },
- clone: function() {
- var t = new cc.Repeat;
- return this._cloneDecoration(t), t.initWithAction(this._innerAction.clone(), this._times), t
- },
- startWithTarget: function(t) {
- this._total = 0, this._nextDt = this._innerAction._duration / this._duration, cc.ActionInterval.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
- },
- stop: function() {
- this._innerAction.stop(), cc.Action.prototype.stop.call(this)
- },
- update: function(t) {
- t = this._computeEaseTime(t);
- var e = this._innerAction,
- i = this._duration,
- n = this._times,
- r = this._nextDt;
- if (t >= r) {
- for (; t > r && this._total < n;) e.update(1), this._total++, e.stop(), e.startWithTarget(this.target), r += e._duration / i, this._nextDt = r > 1 ? 1 : r;
- t >= 1 && this._total < n && (e.update(1), this._total++), this._actionInstant || (this._total === n ? e.stop() : e.update(t - (r - e._duration / i)))
- } else e.update(t * n % 1)
- },
- isDone: function() {
- return this._total === this._times
- },
- reverse: function() {
- var t = new cc.Repeat(this._innerAction.reverse(), this._times);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- setInnerAction: function(t) {
- this._innerAction !== t && (this._innerAction = t)
- },
- getInnerAction: function() {
- return this._innerAction
- }
- }), cc.repeat = function(t, e) {
- return new cc.Repeat(t, e)
- }, cc.RepeatForever = cc.Class({
- name: "cc.RepeatForever",
- extends: cc.ActionInterval,
- ctor: function(t) {
- this._innerAction = null, t && this.initWithAction(t)
- },
- initWithAction: function(t) {
- return t ? (this._innerAction = t, !0) : (cc.errorID(1026), !1)
- },
- clone: function() {
- var t = new cc.RepeatForever;
- return this._cloneDecoration(t), t.initWithAction(this._innerAction.clone()), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
- },
- step: function(t) {
- var e = this._innerAction;
- e.step(t), e.isDone() && (e.startWithTarget(this.target), e.step(e.getElapsed() - e._duration))
- },
- isDone: function() {
- return !1
- },
- reverse: function() {
- var t = new cc.RepeatForever(this._innerAction.reverse());
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- setInnerAction: function(t) {
- this._innerAction !== t && (this._innerAction = t)
- },
- getInnerAction: function() {
- return this._innerAction
- }
- }), cc.repeatForever = function(t) {
- return new cc.RepeatForever(t)
- }, cc.Spawn = cc.Class({
- name: "cc.Spawn",
- extends: cc.ActionInterval,
- ctor: function(t) {
- this._one = null, this._two = null;
- var e = t instanceof Array ? t : arguments;
- if (1 !== e.length) {
- var i = e.length - 1;
- if (i >= 0 && null == e[i] && cc.logID(1015), i >= 0) {
- for (var n, r = e[0], s = 1; s < i; s++) e[s] && (n = r, r = cc.Spawn._actionOneTwo(n, e[s]));
- this.initWithTwoActions(r, e[i])
- }
- } else cc.errorID(1020)
- },
- initWithTwoActions: function(t, e) {
- if (!t || !e) return cc.errorID(1027), !1;
- var i = !1,
- n = t._duration,
- r = e._duration;
- return this.initWithDuration(Math.max(n, r)) && (this._one = t, this._two = e, n > r ? this._two = cc.Sequence._actionOneTwo(e, cc.delayTime(n - r)) : n < r && (this._one = cc.Sequence._actionOneTwo(t, cc.delayTime(r - n))), i = !0), i
- },
- clone: function() {
- var t = new cc.Spawn;
- return this._cloneDecoration(t), t.initWithTwoActions(this._one.clone(), this._two.clone()), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._one.startWithTarget(t), this._two.startWithTarget(t)
- },
- stop: function() {
- this._one.stop(), this._two.stop(), cc.Action.prototype.stop.call(this)
- },
- update: function(t) {
- t = this._computeEaseTime(t), this._one && this._one.update(t), this._two && this._two.update(t)
- },
- reverse: function() {
- var t = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse());
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.spawn = function(t) {
- var e = t instanceof Array ? t : arguments;
- if (1 === e.length) return cc.errorID(1020), null;
- e.length > 0 && null == e[e.length - 1] && cc.logID(1015);
- for (var i = e[0], n = 1; n < e.length; n++) null != e[n] && (i = cc.Spawn._actionOneTwo(i, e[n]));
- return i
- }, cc.Spawn._actionOneTwo = function(t, e) {
- var i = new cc.Spawn;
- return i.initWithTwoActions(t, e), i
- }, cc.RotateTo = cc.Class({
- name: "cc.RotateTo",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._startAngle = 0, this._dstAngle = 0, this._angle = 0, void 0 !== e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._dstAngle = e, !0)
- },
- clone: function() {
- var t = new cc.RotateTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._dstAngle), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = t.angle % 360,
- i = cc.macro.ROTATE_ACTION_CCW ? this._dstAngle - e : e - this._dstAngle;
- i > 180 && (i -= 360), i < -180 && (i += 360), this._startAngle = e, this._angle = cc.macro.ROTATE_ACTION_CCW ? i : -i
- },
- reverse: function() {
- cc.logID(1016)
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target && (this.target.angle = this._startAngle + this._angle * t)
- }
- }), cc.rotateTo = function(t, e) {
- return new cc.RotateTo(t, e)
- }, cc.RotateBy = cc.Class({
- name: "cc.RotateBy",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- e *= cc.macro.ROTATE_ACTION_CCW ? 1 : -1, this._deltaAngle = 0, this._startAngle = 0, void 0 !== e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaAngle = e, !0)
- },
- clone: function() {
- var t = new cc.RotateBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._deltaAngle), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startAngle = t.angle
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target && (this.target.angle = this._startAngle + this._deltaAngle * t)
- },
- reverse: function() {
- var t = new cc.RotateBy;
- return t.initWithDuration(this._duration, -this._deltaAngle), this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.rotateBy = function(t, e) {
- return new cc.RotateBy(t, e)
- }, cc.MoveBy = cc.Class({
- name: "cc.MoveBy",
- extends: cc.ActionInterval,
- ctor: function(t, e, i) {
- this._positionDelta = cc.v2(0, 0), this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), void 0 !== e && cc.MoveBy.prototype.initWithDuration.call(this, t, e, i)
- },
- initWithDuration: function(t, e, i) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 !== e.x && (i = e.y, e = e.x), this._positionDelta.x = e, this._positionDelta.y = i, !0)
- },
- clone: function() {
- var t = new cc.MoveBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._positionDelta), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = t.x,
- i = t.y;
- this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
- },
- update: function(t) {
- if (t = this._computeEaseTime(t), this.target) {
- var e = this._positionDelta.x * t,
- i = this._positionDelta.y * t,
- n = this._startPosition;
- if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
- var r = this.target.x,
- s = this.target.y,
- o = this._previousPosition;
- n.x = n.x + r - o.x, n.y = n.y + s - o.y, e += n.x, i += n.y, o.x = e, o.y = i, this.target.setPosition(e, i)
- } else this.target.setPosition(n.x + e, n.y + i)
- }
- },
- reverse: function() {
- var t = new cc.MoveBy(this._duration, cc.v2(-this._positionDelta.x, -this._positionDelta.y));
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.moveBy = function(t, e, i) {
- return new cc.MoveBy(t, e, i)
- }, cc.MoveTo = cc.Class({
- name: "cc.MoveTo",
- extends: cc.MoveBy,
- ctor: function(t, e, i) {
- this._endPosition = cc.v2(0, 0), void 0 !== e && this.initWithDuration(t, e, i)
- },
- initWithDuration: function(t, e, i) {
- return !!cc.MoveBy.prototype.initWithDuration.call(this, t, e, i) && (void 0 !== e.x && (i = e.y, e = e.x), this._endPosition.x = e, this._endPosition.y = i, !0)
- },
- clone: function() {
- var t = new cc.MoveTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endPosition), t
- },
- startWithTarget: function(t) {
- cc.MoveBy.prototype.startWithTarget.call(this, t), this._positionDelta.x = this._endPosition.x - t.x, this._positionDelta.y = this._endPosition.y - t.y
- }
- }), cc.moveTo = function(t, e, i) {
- return new cc.MoveTo(t, e, i)
- }, cc.SkewTo = cc.Class({
- name: "cc.SkewTo",
- extends: cc.ActionInterval,
- ctor: function(t, e, i) {
- this._skewX = 0, this._skewY = 0, this._startSkewX = 0, this._startSkewY = 0, this._endSkewX = 0, this._endSkewY = 0, this._deltaX = 0, this._deltaY = 0, void 0 !== i && cc.SkewTo.prototype.initWithDuration.call(this, t, e, i)
- },
- initWithDuration: function(t, e, i) {
- var n = !1;
- return cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endSkewX = e, this._endSkewY = i, n = !0), n
- },
- clone: function() {
- var t = new cc.SkewTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endSkewX, this._endSkewY), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startSkewX = t.skewX % 180, this._deltaX = this._endSkewX - this._startSkewX, this._deltaX > 180 && (this._deltaX -= 360), this._deltaX < -180 && (this._deltaX += 360), this._startSkewY = t.skewY % 360, this._deltaY = this._endSkewY - this._startSkewY, this._deltaY > 180 && (this._deltaY -= 360), this._deltaY < -180 && (this._deltaY += 360)
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target.skewX = this._startSkewX + this._deltaX * t, this.target.skewY = this._startSkewY + this._deltaY * t
- }
- }), cc.skewTo = function(t, e, i) {
- return new cc.SkewTo(t, e, i)
- }, cc.SkewBy = cc.Class({
- name: "cc.SkewBy",
- extends: cc.SkewTo,
- ctor: function(t, e, i) {
- void 0 !== i && this.initWithDuration(t, e, i)
- },
- initWithDuration: function(t, e, i) {
- var n = !1;
- return cc.SkewTo.prototype.initWithDuration.call(this, t, e, i) && (this._skewX = e, this._skewY = i, n = !0), n
- },
- clone: function() {
- var t = new cc.SkewBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._skewX, this._skewY), t
- },
- startWithTarget: function(t) {
- cc.SkewTo.prototype.startWithTarget.call(this, t), this._deltaX = this._skewX, this._deltaY = this._skewY, this._endSkewX = this._startSkewX + this._deltaX, this._endSkewY = this._startSkewY + this._deltaY
- },
- reverse: function() {
- var t = new cc.SkewBy(this._duration, -this._skewX, -this._skewY);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.skewBy = function(t, e, i) {
- return new cc.SkewBy(t, e, i)
- }, cc.JumpBy = cc.Class({
- name: "cc.JumpBy",
- extends: cc.ActionInterval,
- ctor: function(t, e, i, n, r) {
- this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), this._delta = cc.v2(0, 0), this._height = 0, this._jumps = 0, void 0 !== n && cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r)
- },
- initWithDuration: function(t, e, i, n, r) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 === r && (r = n, n = i, i = e.y, e = e.x), this._delta.x = e, this._delta.y = i, this._height = n, this._jumps = r, !0)
- },
- clone: function() {
- var t = new cc.JumpBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._delta, this._height, this._jumps), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = t.x,
- i = t.y;
- this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
- },
- update: function(t) {
- if (t = this._computeEaseTime(t), this.target) {
- var e = t * this._jumps % 1,
- i = 4 * this._height * e * (1 - e);
- i += this._delta.y * t;
- var n = this._delta.x * t,
- r = this._startPosition;
- if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
- var s = this.target.x,
- o = this.target.y,
- a = this._previousPosition;
- r.x = r.x + s - a.x, r.y = r.y + o - a.y, n += r.x, i += r.y, a.x = n, a.y = i, this.target.setPosition(n, i)
- } else this.target.setPosition(r.x + n, r.y + i)
- }
- },
- reverse: function() {
- var t = new cc.JumpBy(this._duration, cc.v2(-this._delta.x, -this._delta.y), this._height, this._jumps);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.jumpBy = function(t, e, i, n, r) {
- return new cc.JumpBy(t, e, i, n, r)
- }, cc.JumpTo = cc.Class({
- name: "cc.JumpTo",
- extends: cc.JumpBy,
- ctor: function(t, e, i, n, r) {
- this._endPosition = cc.v2(0, 0), void 0 !== n && this.initWithDuration(t, e, i, n, r)
- },
- initWithDuration: function(t, e, i, n, r) {
- return !!cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r) && (void 0 === r && (i = e.y, e = e.x), this._endPosition.x = e, this._endPosition.y = i, !0)
- },
- startWithTarget: function(t) {
- cc.JumpBy.prototype.startWithTarget.call(this, t), this._delta.x = this._endPosition.x - this._startPosition.x, this._delta.y = this._endPosition.y - this._startPosition.y
- },
- clone: function() {
- var t = new cc.JumpTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endPosition, this._height, this._jumps), t
- }
- }), cc.jumpTo = function(t, e, i, n, r) {
- return new cc.JumpTo(t, e, i, n, r)
- }, cc.BezierBy = cc.Class({
- name: "cc.BezierBy",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._config = [], this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), e && cc.BezierBy.prototype.initWithDuration.call(this, t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._config = e, !0)
- },
- clone: function() {
- var t = new cc.BezierBy;
- this._cloneDecoration(t);
- for (var e = [], i = 0; i < this._config.length; i++) {
- var n = this._config[i];
- e.push(cc.v2(n.x, n.y))
- }
- return t.initWithDuration(this._duration, e), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = t.x,
- i = t.y;
- this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
- },
- update: function(t) {
- if (t = this._computeEaseTime(t), this.target) {
- var e = this._config,
- i = e[0].x,
- r = e[1].x,
- s = e[2].x,
- o = e[0].y,
- a = e[1].y,
- l = e[2].y,
- h = n(0, i, r, s, t),
- c = n(0, o, a, l, t),
- u = this._startPosition;
- if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
- var _ = this.target.x,
- f = this.target.y,
- d = this._previousPosition;
- u.x = u.x + _ - d.x, u.y = u.y + f - d.y, h += u.x, c += u.y, d.x = h, d.y = c, this.target.setPosition(h, c)
- } else this.target.setPosition(u.x + h, u.y + c)
- }
- },
- reverse: function() {
- var t = this._config,
- e = t[0].x,
- i = t[0].y,
- n = t[1].x,
- r = t[1].y,
- s = t[2].x,
- o = t[2].y,
- a = [cc.v2(n - s, r - o), cc.v2(e - s, i - o), cc.v2(-s, -o)],
- l = new cc.BezierBy(this._duration, a);
- return this._cloneDecoration(l), this._reverseEaseList(l), l
- }
- }), cc.bezierBy = function(t, e) {
- return new cc.BezierBy(t, e)
- }, cc.BezierTo = cc.Class({
- name: "cc.BezierTo",
- extends: cc.BezierBy,
- ctor: function(t, e) {
- this._toConfig = [], e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toConfig = e, !0)
- },
- clone: function() {
- var t = new cc.BezierTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toConfig), t
- },
- startWithTarget: function(t) {
- cc.BezierBy.prototype.startWithTarget.call(this, t);
- var e = this._startPosition,
- i = this._toConfig,
- n = this._config;
- n[0] = i[0].sub(e), n[1] = i[1].sub(e), n[2] = i[2].sub(e)
- }
- }), cc.bezierTo = function(t, e) {
- return new cc.BezierTo(t, e)
- }, cc.ScaleTo = cc.Class({
- name: "cc.ScaleTo",
- extends: cc.ActionInterval,
- ctor: function(t, e, i) {
- this._scaleX = 1, this._scaleY = 1, this._startScaleX = 1, this._startScaleY = 1, this._endScaleX = 0, this._endScaleY = 0, this._deltaX = 0, this._deltaY = 0, void 0 !== e && cc.ScaleTo.prototype.initWithDuration.call(this, t, e, i)
- },
- initWithDuration: function(t, e, i) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endScaleX = e, this._endScaleY = null != i ? i : e, !0)
- },
- clone: function() {
- var t = new cc.ScaleTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startScaleX = t.scaleX, this._startScaleY = t.scaleY, this._deltaX = this._endScaleX - this._startScaleX, this._deltaY = this._endScaleY - this._startScaleY
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target && (this.target.scaleX = this._startScaleX + this._deltaX * t, this.target.scaleY = this._startScaleY + this._deltaY * t)
- }
- }), cc.scaleTo = function(t, e, i) {
- return new cc.ScaleTo(t, e, i)
- }, cc.ScaleBy = cc.Class({
- name: "cc.ScaleBy",
- extends: cc.ScaleTo,
- startWithTarget: function(t) {
- cc.ScaleTo.prototype.startWithTarget.call(this, t), this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX, this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY
- },
- reverse: function() {
- var t = new cc.ScaleBy(this._duration, 1 / this._endScaleX, 1 / this._endScaleY);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- clone: function() {
- var t = new cc.ScaleBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), t
- }
- }), cc.scaleBy = function(t, e, i) {
- return new cc.ScaleBy(t, e, i)
- }, cc.Blink = cc.Class({
- name: "cc.Blink",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._times = 0, this._originalState = !1, void 0 !== e && this.initWithDuration(t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._times = e, !0)
- },
- clone: function() {
- var t = new cc.Blink;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._times), t
- },
- update: function(t) {
- if (t = this._computeEaseTime(t), this.target && !this.isDone()) {
- var e = 1 / this._times,
- i = t % e;
- this.target.opacity = i > e / 2 ? 255 : 0
- }
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._originalState = t.opacity
- },
- stop: function() {
- this.target.opacity = this._originalState, cc.ActionInterval.prototype.stop.call(this)
- },
- reverse: function() {
- var t = new cc.Blink(this._duration, this._times);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.blink = function(t, e) {
- return new cc.Blink(t, e)
- }, cc.FadeTo = cc.Class({
- name: "cc.FadeTo",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._toOpacity = 0, this._fromOpacity = 0, void 0 !== e && cc.FadeTo.prototype.initWithDuration.call(this, t, e)
- },
- initWithDuration: function(t, e) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toOpacity = e, !0)
- },
- clone: function() {
- var t = new cc.FadeTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
- },
- update: function(t) {
- t = this._computeEaseTime(t);
- var e = void 0 !== this._fromOpacity ? this._fromOpacity : 255;
- this.target.opacity = e + (this._toOpacity - e) * t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._fromOpacity = t.opacity
- }
- }), cc.fadeTo = function(t, e) {
- return new cc.FadeTo(t, e)
- }, cc.FadeIn = cc.Class({
- name: "cc.FadeIn",
- extends: cc.FadeTo,
- ctor: function(t) {
- null == t && (t = 0), this._reverseAction = null, this.initWithDuration(t, 255)
- },
- reverse: function() {
- var t = new cc.FadeOut;
- return t.initWithDuration(this._duration, 0), this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- clone: function() {
- var t = new cc.FadeIn;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
- },
- startWithTarget: function(t) {
- this._reverseAction && (this._toOpacity = this._reverseAction._fromOpacity), cc.FadeTo.prototype.startWithTarget.call(this, t)
- }
- }), cc.fadeIn = function(t) {
- return new cc.FadeIn(t)
- }, cc.FadeOut = cc.Class({
- name: "cc.FadeOut",
- extends: cc.FadeTo,
- ctor: function(t) {
- null == t && (t = 0), this._reverseAction = null, this.initWithDuration(t, 0)
- },
- reverse: function() {
- var t = new cc.FadeIn;
- return t._reverseAction = this, t.initWithDuration(this._duration, 255), this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- clone: function() {
- var t = new cc.FadeOut;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
- }
- }), cc.fadeOut = function(t) {
- return new cc.FadeOut(t)
- }, cc.TintTo = cc.Class({
- name: "cc.TintTo",
- extends: cc.ActionInterval,
- ctor: function(t, e, i, n) {
- this._to = cc.color(0, 0, 0), this._from = cc.color(0, 0, 0), e instanceof cc.Color && (n = e.b, i = e.g, e = e.r), void 0 !== n && this.initWithDuration(t, e, i, n)
- },
- initWithDuration: function(t, e, i, n) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._to = cc.color(e, i, n), !0)
- },
- clone: function() {
- var t = new cc.TintTo;
- this._cloneDecoration(t);
- var e = this._to;
- return t.initWithDuration(this._duration, e.r, e.g, e.b), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._from = this.target.color
- },
- update: function(t) {
- t = this._computeEaseTime(t);
- var e = this._from,
- i = this._to;
- e && (this.target.color = cc.color(e.r + (i.r - e.r) * t, e.g + (i.g - e.g) * t, e.b + (i.b - e.b) * t))
- }
- }), cc.tintTo = function(t, e, i, n) {
- return new cc.TintTo(t, e, i, n)
- }, cc.TintBy = cc.Class({
- name: "cc.TintBy",
- extends: cc.ActionInterval,
- ctor: function(t, e, i, n) {
- this._deltaR = 0, this._deltaG = 0, this._deltaB = 0, this._fromR = 0, this._fromG = 0, this._fromB = 0, void 0 !== n && this.initWithDuration(t, e, i, n)
- },
- initWithDuration: function(t, e, i, n) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaR = e, this._deltaG = i, this._deltaB = n, !0)
- },
- clone: function() {
- var t = new cc.TintBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._deltaR, this._deltaG, this._deltaB), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = t.color;
- this._fromR = e.r, this._fromG = e.g, this._fromB = e.b
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target.color = cc.color(this._fromR + this._deltaR * t, this._fromG + this._deltaG * t, this._fromB + this._deltaB * t)
- },
- reverse: function() {
- var t = new cc.TintBy(this._duration, -this._deltaR, -this._deltaG, -this._deltaB);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- }
- }), cc.tintBy = function(t, e, i, n) {
- return new cc.TintBy(t, e, i, n)
- }, cc.DelayTime = cc.Class({
- name: "cc.DelayTime",
- extends: cc.ActionInterval,
- update: function(t) {},
- reverse: function() {
- var t = new cc.DelayTime(this._duration);
- return this._cloneDecoration(t), this._reverseEaseList(t), t
- },
- clone: function() {
- var t = new cc.DelayTime;
- return this._cloneDecoration(t), t.initWithDuration(this._duration), t
- }
- }), cc.delayTime = function(t) {
- return new cc.DelayTime(t)
- }, cc.ReverseTime = cc.Class({
- name: "cc.ReverseTime",
- extends: cc.ActionInterval,
- ctor: function(t) {
- this._other = null, t && this.initWithAction(t)
- },
- initWithAction: function(t) {
- return t ? t === this._other ? (cc.errorID(1029), !1) : !!cc.ActionInterval.prototype.initWithDuration.call(this, t._duration) && (this._other = t, !0) : (cc.errorID(1028), !1)
- },
- clone: function() {
- var t = new cc.ReverseTime;
- return this._cloneDecoration(t), t.initWithAction(this._other.clone()), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._other.startWithTarget(t)
- },
- update: function(t) {
- t = this._computeEaseTime(t), this._other && this._other.update(1 - t)
- },
- reverse: function() {
- return this._other.clone()
- },
- stop: function() {
- this._other.stop(), cc.Action.prototype.stop.call(this)
- }
- }), cc.reverseTime = function(t) {
- return new cc.ReverseTime(t)
- }, cc.TargetedAction = cc.Class({
- name: "cc.TargetedAction",
- extends: cc.ActionInterval,
- ctor: function(t, e) {
- this._action = null, this._forcedTarget = null, e && this.initWithTarget(t, e)
- },
- initWithTarget: function(t, e) {
- return !!this.initWithDuration(e._duration) && (this._forcedTarget = t, this._action = e, !0)
- },
- clone: function() {
- var t = new cc.TargetedAction;
- return this._cloneDecoration(t), t.initWithTarget(this._forcedTarget, this._action.clone()), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._action.startWithTarget(this._forcedTarget)
- },
- stop: function() {
- this._action.stop()
- },
- update: function(t) {
- t = this._computeEaseTime(t), this._action.update(t)
- },
- getForcedTarget: function() {
- return this._forcedTarget
- },
- setForcedTarget: function(t) {
- this._forcedTarget !== t && (this._forcedTarget = t)
- }
- }), cc.targetedAction = function(t, e) {
- return new cc.TargetedAction(t, e)
- }
- }), {}],
- 6: [(function(t, e, i) {
- "use strict";
- t("../core/platform/CCClass");
- var n = t("../core/platform/js"),
- r = function() {
- this.actions = [], this.target = null, this.actionIndex = 0, this.currentAction = null, this.paused = !1, this.lock = !1
- };
- cc.ActionManager = function() {
- this._hashTargets = n.createMap(!0), this._arrayTargets = [], this._currentTarget = null, cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
- }, cc.ActionManager.prototype = {
- constructor: cc.ActionManager,
- _elementPool: [],
- _searchElementByTarget: function(t, e) {
- for (var i = 0; i < t.length; i++)
- if (e === t[i].target) return t[i];
- return null
- },
- _getElement: function(t, e) {
- var i = this._elementPool.pop();
- return i || (i = new r), i.target = t, i.paused = !!e, i
- },
- _putElement: function(t) {
- t.actions.length = 0, t.actionIndex = 0, t.currentAction = null, t.paused = !1, t.target = null, t.lock = !1, this._elementPool.push(t)
- },
- addAction: function(t, e, i) {
- if (t && e) {
- var n = this._hashTargets[e._id];
- n ? n.actions || (n.actions = []) : (n = this._getElement(e, i), this._hashTargets[e._id] = n, this._arrayTargets.push(n)), n.actions.push(t), t.startWithTarget(e)
- } else cc.errorID(1e3)
- },
- removeAllActions: function() {
- for (var t = this._arrayTargets, e = 0; e < t.length; e++) {
- var i = t[e];
- i && this._putElement(i)
- }
- this._arrayTargets.length = 0, this._hashTargets = n.createMap(!0)
- },
- removeAllActionsFromTarget: function(t, e) {
- if (null != t) {
- var i = this._hashTargets[t._id];
- i && (i.actions.length = 0, this._deleteHashElement(i))
- }
- },
- removeAction: function(t) {
- if (null != t) {
- var e = t.getOriginalTarget(),
- i = this._hashTargets[e._id];
- if (i) {
- for (var n = 0; n < i.actions.length; n++)
- if (i.actions[n] === t) {
- i.actions.splice(n, 1), i.actionIndex >= n && i.actionIndex--;
- break
- }
- } else cc.logID(1001)
- }
- },
- removeActionByTag: function(t, e) {
- t === cc.Action.TAG_INVALID && cc.logID(1002), cc.assertID(e, 1003);
- var i = this._hashTargets[e._id];
- if (i)
- for (var n = i.actions.length, r = 0; r < n; ++r) {
- var s = i.actions[r];
- if (s && s.getTag() === t && s.getOriginalTarget() === e) {
- this._removeActionAtIndex(r, i);
- break
- }
- }
- },
- getActionByTag: function(t, e) {
- t === cc.Action.TAG_INVALID && cc.logID(1004);
- var i = this._hashTargets[e._id];
- if (i) {
- if (null != i.actions)
- for (var n = 0; n < i.actions.length; ++n) {
- var r = i.actions[n];
- if (r && r.getTag() === t) return r
- }
- cc.logID(1005, t)
- }
- return null
- },
- getNumberOfRunningActionsInTarget: function(t) {
- var e = this._hashTargets[t._id];
- return e && e.actions ? e.actions.length : 0
- },
- pauseTarget: function(t) {
- var e = this._hashTargets[t._id];
- e && (e.paused = !0)
- },
- resumeTarget: function(t) {
- var e = this._hashTargets[t._id];
- e && (e.paused = !1)
- },
- pauseAllRunningActions: function() {
- for (var t = [], e = this._arrayTargets, i = 0; i < e.length; i++) {
- var n = e[i];
- n && !n.paused && (n.paused = !0, t.push(n.target))
- }
- return t
- },
- resumeTargets: function(t) {
- if (t)
- for (var e = 0; e < t.length; e++) t[e] && this.resumeTarget(t[e])
- },
- pauseTargets: function(t) {
- if (t)
- for (var e = 0; e < t.length; e++) t[e] && this.pauseTarget(t[e])
- },
- purgeSharedManager: function() {
- cc.director.getScheduler().unscheduleUpdate(this)
- },
- _removeActionAtIndex: function(t, e) {
- e.actions[t];
- e.actions.splice(t, 1), e.actionIndex >= t && e.actionIndex--, 0 === e.actions.length && this._deleteHashElement(e)
- },
- _deleteHashElement: function(t) {
- var e = !1;
- if (t && !t.lock && this._hashTargets[t.target._id]) {
- delete this._hashTargets[t.target._id];
- for (var i = this._arrayTargets, n = 0, r = i.length; n < r; n++)
- if (i[n] === t) {
- i.splice(n, 1);
- break
- }
- this._putElement(t), e = !0
- }
- return e
- },
- update: function(t) {
- for (var e, i = this._arrayTargets, n = 0; n < i.length; n++) {
- if (this._currentTarget = i[n], !(e = this._currentTarget).paused && e.actions) {
- for (e.lock = !0, e.actionIndex = 0; e.actionIndex < e.actions.length; e.actionIndex++)
- if (e.currentAction = e.actions[e.actionIndex], e.currentAction) {
- if (e.currentAction.step(t * (e.currentAction._speedMethod ? e.currentAction._speed : 1)), e.currentAction && e.currentAction.isDone()) {
- e.currentAction.stop();
- var r = e.currentAction;
- e.currentAction = null, this.removeAction(r)
- }
- e.currentAction = null
- }
- e.lock = !1
- }
- 0 === e.actions.length && this._deleteHashElement(e) && n--
- }
- }
- }
- }), {
- "../core/platform/CCClass": 198,
- "../core/platform/js": 218
- }],
- 7: [(function(t, e, i) {
- "use strict";
- t("./CCActionManager"), t("./CCAction"), t("./CCActionInterval"), t("./CCActionInstant"), t("./CCActionEase"), t("./CCActionCatmullRom"), t("./tween")
- }), {
- "./CCAction": 1,
- "./CCActionCatmullRom": 2,
- "./CCActionEase": 3,
- "./CCActionInstant": 4,
- "./CCActionInterval": 5,
- "./CCActionManager": 6,
- "./tween": 8
- }],
- 8: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TweenAction",
- extends: cc.ActionInterval,
- ctor: function(t, e, i) {
- if (this._opts = i = i || Object.create(null), this._props = Object.create(null), i.progress = i.progress || this.progress, i.easing && "string" == typeof i.easing) {
- var n = i.easing;
- i.easing = cc.easing[n], !i.easing && cc.warnID(1031, n)
- }
- var r = this._opts.relative;
- for (var s in e) {
- var o = e[s],
- a = void 0,
- l = void 0;
- if (void 0 !== o.value && (o.easing || o.progress) && ("string" == typeof o.easing ? !(a = cc.easing[o.easing]) && cc.warnID(1031, o.easing) : a = o.easing, l = o.progress, o = o.value), "number" == typeof o || o.lerp && (!r || o.add || o.mul) && o.clone) {
- var h = Object.create(null);
- h.value = o, h.easing = a, h.progress = l, this._props[s] = h
- } else cc.warn("Can not animate " + s + " property, because it do not have [lerp, (add|mul), clone] function.")
- }
- this._originProps = e, this.initWithDuration(t)
- },
- clone: function() {
- var t = new n(this._duration, this._originProps, this._opts);
- return this._cloneDecoration(t), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t);
- var e = !!this._opts.relative,
- i = this._props;
- for (var n in i) {
- var r = t[n],
- s = i[n];
- "number" == typeof r ? (s.start = r, s.current = r, s.end = e ? r + s.value : s.value) : (s.start = r.clone(), s.current = r.clone(), s.end = e ? (r.add || r.mul).call(r, s.value) : s.value)
- }
- },
- update: function(t) {
- var e = this._opts,
- i = t;
- e.easing && (i = e.easing(t));
- var n = this.target;
- if (n) {
- var r = this._props,
- s = this._opts.progress;
- for (var o in r) {
- var a = r[o],
- l = a.easing ? a.easing(t) : i,
- h = a.current = (a.progress || s)(a.start, a.end, a.current, l);
- n[o] = h
- }
- }
- },
- progress: function(t, e, i, n) {
- return "number" == typeof t ? i = t + (e - t) * n : t.lerp(e, n, i), i
- }
- }),
- r = cc.Class({
- name: "cc.SetAction",
- extends: cc.ActionInstant,
- ctor: function(t) {
- this._props = {}, void 0 !== t && this.init(t)
- },
- init: function(t) {
- for (var e in t) this._props[e] = t[e];
- return !0
- },
- update: function() {
- var t = this._props,
- e = this.target;
- for (var i in t) e[i] = t[i]
- },
- clone: function() {
- var t = new r;
- return t.init(this._props), t
- }
- });
- function s(t) {
- this._actions = [], this._finalAction = null, this._target = t
- }
- s.prototype.then = function(t) {
- return t instanceof cc.Action ? this._actions.push(t.clone()) : this._actions.push(t._union()), this
- }, s.prototype.target = function(t) {
- return this._target = t, this
- }, s.prototype.start = function() {
- return this._target ? (this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), this._finalAction = this._union(), cc.director.getActionManager().addAction(this._finalAction, this._target, !1), this) : (cc.warn("Please set target to tween first"), this)
- }, s.prototype.stop = function() {
- return this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), this
- }, s.prototype.clone = function(t) {
- var e = this._union();
- return cc.tween(t).then(e.clone())
- }, s.prototype.union = function() {
- var t = this._union();
- return this._actions.length = 0, this._actions.push(t), this
- }, s.prototype._union = function() {
- var t = this._actions;
- return t = 1 === t.length ? t[0] : cc.sequence(t)
- };
- var o = [];
- function a(t) {
- return function() {
- o.length = 0;
- for (var e = arguments.length, i = 0; i < e; i++) {
- var n = o[i] = arguments[i];
- n instanceof s && (o[i] = n._union())
- }
- return t.apply(this, o)
- }
- }
- for (var l = {
- to: function(t, e, i) {
- return (i = i || Object.create(null)).relative = !1, new n(t, e, i)
- },
- by: function(t, e, i) {
- return (i = i || Object.create(null)).relative = !0, new n(t, e, i)
- },
- set: function(t) {
- return new r(t)
- },
- delay: cc.delayTime,
- call: cc.callFunc,
- hide: cc.hide,
- show: cc.show,
- removeSelf: cc.removeSelf,
- sequence: a(cc.sequence),
- parallel: a(cc.spawn)
- }, h = {
- repeat: cc.repeat,
- repeatForever: function(t) {
- return cc.repeat(t, 1e9)
- },
- reverseTime: cc.reverseTime
- }, c = Object.keys(l), u = function(t) {
- var e = c[t];
- s.prototype[e] = function() {
- var t = l[e].apply(l, arguments);
- return this._actions.push(t), this
- }
- }, _ = 0; _ < c.length; _++) u(_);
- c = Object.keys(h);
- var f = function(t) {
- var e = c[t];
- s.prototype[e] = function() {
- var t = this._actions,
- i = arguments[arguments.length - 1],
- n = arguments.length - 1;
- i instanceof cc.Tween ? i = i._union() : i instanceof cc.Action || (i = t[t.length - 1], t.length -= 1, n += 1);
- for (var r = [i], s = 0; s < n; s++) r.push(arguments[s]);
- return i = h[e].apply(this, r), t.push(i), this
- }
- };
- for (_ = 0; _ < c.length; _++) f(_);
- cc.tween = function(t) {
- return new s(t)
- }, cc.Tween = s
- }), {}],
- 9: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = t("./playable"),
- s = t("./animation-curves"),
- o = s.EventAnimCurve,
- a = s.EventInfo,
- l = t("./types").WrapModeMask,
- h = t("../core/utils/binary-search").binarySearchEpsilon;
- function c(t, e) {
- r.call(this), this.target = t, this.animation = e, this._anims = new n.array.MutableForwardIterator([])
- }
- n.extend(c, r);
- var u = c.prototype;
- function _(t, e) {
- var i = e.clip;
- e.duration = i.duration, e.speed = i.speed, e.wrapMode = i.wrapMode, e.frameRate = i.sample, (e.wrapMode & l.Loop) === l.Loop ? e.repeatCount = 1 / 0 : e.repeatCount = 1;
- var n = e.curves = i.createCurves(e, t),
- r = i.events;
- if (r)
- for (var s = void 0, c = 0, u = r.length; c < u; c++) {
- s || ((s = new o).target = t, n.push(s));
- var _ = r[c],
- f = _.frame / e.duration,
- d = void 0,
- p = h(s.ratios, f);
- p >= 0 ? d = s.events[p] : (d = new a, s.ratios.push(f), s.events.push(d)), d.add(_.func, _.params)
- }
- }
- u.playState = function(t, e) {
- t.clip && (t.curveLoaded || _(this.target, t), t.animator = this, t.play(), "number" == typeof e && t.setTime(e), this.play())
- }, u.stopStatesExcept = function(t) {
- var e = this._anims,
- i = e.array;
- for (e.i = 0; e.i < i.length; ++e.i) {
- var n = i[e.i];
- n !== t && this.stopState(n)
- }
- }, u.addAnimation = function(t) {
- -1 === this._anims.array.indexOf(t) && this._anims.push(t), t._setEventTarget(this.animation)
- }, u.removeAnimation = function(t) {
- var e = this._anims.array.indexOf(t);
- e >= 0 ? (this._anims.fastRemoveAt(e), 0 === this._anims.array.length && this.stop()) : cc.errorID(3908), t.animator = null
- }, u.sample = function() {
- var t = this._anims,
- e = t.array;
- for (t.i = 0; t.i < e.length; ++t.i) {
- e[t.i].sample()
- }
- }, u.stopState = function(t) {
- t && t.stop()
- }, u.pauseState = function(t) {
- t && t.pause()
- }, u.resumeState = function(t) {
- t && t.resume(), this.isPaused && this.resume()
- }, u.setStateTime = function(t, e) {
- if (void 0 !== e) t && (t.setTime(e), t.sample());
- else {
- e = t;
- for (var i = this._anims.array, n = 0; n < i.length; ++n) {
- var r = i[n];
- r.setTime(e), r.sample()
- }
- }
- }, u.onStop = function() {
- var t = this._anims,
- e = t.array;
- for (t.i = 0; t.i < e.length; ++t.i) {
- e[t.i].stop()
- }
- }, u.onPause = function() {
- for (var t = this._anims.array, e = 0; e < t.length; ++e) {
- var i = t[e];
- i.pause(), i.animator = null
- }
- }, u.onResume = function() {
- for (var t = this._anims.array, e = 0; e < t.length; ++e) {
- var i = t[e];
- i.animator = this, i.resume()
- }
- }, u._reloadClip = function(t) {
- _(this.target, t)
- }, e.exports = c
- }), {
- "../core/utils/binary-search": 292,
- "./animation-curves": 11,
- "./playable": 18,
- "./types": 19
- }],
- 10: [(function(t, e, i) {
- "use strict";
- var n = t("./types").WrapMode,
- r = t("./animation-curves"),
- s = r.DynamicAnimCurve,
- o = r.quickFindIndex,
- a = t("./motion-path-helper").sampleMotionPaths,
- l = t("../core/utils/binary-search").binarySearchEpsilon,
- h = cc.Class({
- name: "cc.AnimationClip",
- extends: cc.Asset,
- properties: {
- _duration: {
- default: 0,
- type: cc.Float
- },
- duration: {
- get: function() {
- return this._duration
- }
- },
- sample: {
- default: 60
- },
- speed: {
- default: 1
- },
- wrapMode: {
- default: n.Normal
- },
- curveData: {
- default: {},
- visible: !1
- },
- events: {
- default: [],
- visible: !1
- }
- },
- statics: {
- createWithSpriteFrames: function(t, e) {
- if (!Array.isArray(t)) return cc.errorID(3905), null;
- var i = new h;
- i.sample = e || i.sample, i._duration = t.length / i.sample;
- for (var n = [], r = 1 / i.sample, s = 0, o = t.length; s < o; s++) n[s] = {
- frame: s * r,
- value: t[s]
- };
- return i.curveData = {
- comps: {
- "cc.Sprite": {
- spriteFrame: n
- }
- }
- }, i
- }
- },
- onLoad: function() {
- this._duration = Number.parseFloat(this.duration), this.speed = Number.parseFloat(this.speed), this.wrapMode = Number.parseInt(this.wrapMode), this.frameRate = Number.parseFloat(this.sample)
- },
- createPropCurve: function(t, e, i) {
- var n = [],
- r = t instanceof cc.Node && "position" === e,
- h = new s;
- h.target = t, h.prop = e;
- for (var c = 0, u = i.length; c < u; c++) {
- var _ = i[c],
- f = _.frame / this.duration;
- h.ratios.push(f), r && n.push(_.motionPath);
- var d = _.value;
- h.values.push(d);
- var p = _.curve;
- if (p) {
- if ("string" == typeof p) {
- h.types.push(p);
- continue
- }
- if (Array.isArray(p)) {
- p[0] === p[1] && p[2] === p[3] ? h.types.push(s.Linear) : h.types.push(s.Bezier(p));
- continue
- }
- }
- h.types.push(s.Linear)
- }
- r && a(n, h, this.duration, this.sample, t);
- for (var m = h.ratios, y = void 0, v = void 0, g = !0, x = 1, b = m.length; x < b; x++)
- if (y = m[x] - m[x - 1], 1 === x) v = y;
- else if (Math.abs(y - v) > 1e-6) {
- g = !1;
- break
- }
- h._findFrameIndex = g ? o : l;
- var A = h.values[0];
- return void 0 === A || null === A || h._lerp || ("number" == typeof A ? h._lerp = s.prototype._lerpNumber : A instanceof cc.Quat ? h._lerp = s.prototype._lerpQuat : A instanceof cc.Vec2 || A instanceof cc.Vec3 ? h._lerp = s.prototype._lerpVector : A.lerp && (h._lerp = s.prototype._lerpObject)), h
- },
- createTargetCurves: function(t, e, i) {
- var n = e.props,
- r = e.comps;
- if (n)
- for (var s in n) {
- var o = n[s],
- a = this.createPropCurve(t, s, o);
- i.push(a)
- }
- if (r)
- for (var l in r) {
- var h = t.getComponent(l);
- if (h) {
- var c = r[l];
- for (var u in c) {
- var _ = c[u],
- f = this.createPropCurve(h, u, _);
- i.push(f)
- }
- }
- }
- },
- createCurves: function(t, e) {
- var i = this.curveData,
- n = i.paths,
- r = [];
- for (var s in this.createTargetCurves(e, i, r), n) {
- var o = cc.find(s, e);
- if (o) {
- var a = n[s];
- this.createTargetCurves(o, a, r)
- }
- }
- return r
- }
- });
- cc.AnimationClip = e.exports = h
- }), {
- "../core/utils/binary-search": 292,
- "./animation-curves": 11,
- "./motion-path-helper": 17,
- "./types": 19
- }],
- 11: [(function(t, e, i) {
- "use strict";
- var n = t("./bezier").bezierByTime,
- r = t("../core/utils/binary-search").binarySearchEpsilon,
- s = t("./types").WrapModeMask,
- o = t("./types").WrappedInfo;
- function a(t, e) {
- if ("string" == typeof e) {
- var i = cc.easing[e];
- i ? t = i(t) : cc.errorID(3906, e)
- } else Array.isArray(e) && (t = n(e, t));
- return t
- }
- var l = cc.Class({
- name: "cc.AnimCurve",
- sample: function(t, e, i) {},
- onTimeChangedManually: void 0
- });
- function h(t, e) {
- var i = t.length - 1;
- if (0 === i) return 0;
- var n = t[0];
- if (e < n) return 0;
- var r = t[i];
- if (e > r) return ~t.length;
- var s = (e = (e - n) / (r - n)) / (1 / i),
- o = 0 | s;
- return s - o < 1e-6 ? o : o + 1 - s < 1e-6 ? o + 1 : ~(o + 1)
- }
- var c = cc.Class({
- name: "cc.DynamicAnimCurve",
- extends: l,
- ctor: function() {
- this._cachedIndex = 0
- },
- properties: {
- target: null,
- prop: "",
- values: [],
- ratios: [],
- types: []
- },
- _findFrameIndex: r,
- _lerp: void 0,
- _lerpNumber: function(t, e, i) {
- return t + (e - t) * i
- },
- _lerpObject: function(t, e, i) {
- return t.lerp(e, i)
- },
- _lerpQuat: (function() {
- var t = cc.quat();
- return function(e, i, n) {
- return e.lerp(i, n, t)
- }
- })(),
- _lerpVector: (function() {
- var t = cc.v3();
- return function(e, i, n) {
- return e.lerp(i, n, t)
- }
- })(),
- sample: function(t, e, i) {
- var n = this.values,
- r = this.ratios,
- s = r.length;
- if (0 !== s) {
- var o = !0,
- l = this._cachedIndex;
- if (l < 0 && (l = ~l) > 0 && l < r.length) {
- var h = r[l - 1],
- c = r[l];
- e > h && e < c && (o = !1)
- }
- o && (this._cachedIndex = this._findFrameIndex(r, e));
- var u = void 0,
- _ = this._cachedIndex;
- if (_ < 0)
- if ((_ = ~_) <= 0) u = n[0];
- else if (_ >= s) u = n[s - 1];
- else {
- var f = n[_ - 1];
- if (this._lerp) {
- var d = r[_ - 1],
- p = r[_],
- m = this.types[_ - 1],
- y = (e - d) / (p - d);
- m && (y = a(y, m));
- var v = n[_];
- u = this._lerp(f, v, y)
- } else u = f
- } else u = n[_];
- this.target[this.prop] = u
- }
- }
- });
- c.Linear = null, c.Bezier = function(t) {
- return t
- };
- var u = function() {
- this.events = []
- };
- u.prototype.add = function(t, e) {
- this.events.push({
- func: t || "",
- params: e || []
- })
- };
- var _ = cc.Class({
- name: "cc.EventAnimCurve",
- extends: l,
- properties: {
- target: null,
- ratios: [],
- events: [],
- _wrappedInfo: {
- default: function() {
- return new o
- }
- },
- _lastWrappedInfo: null,
- _ignoreIndex: NaN
- },
- _wrapIterations: function(t) {
- return t - (0 | t) == 0 && (t -= 1), 0 | t
- },
- sample: function(t, e, i) {
- var n = this.ratios.length,
- a = i.getWrappedInfo(i.time, this._wrappedInfo),
- l = a.direction,
- h = r(this.ratios, a.ratio);
- if (h < 0 && (h = ~h - 1, l < 0 && (h += 1)), this._ignoreIndex !== h && (this._ignoreIndex = NaN), a.frameIndex = h, !this._lastWrappedInfo) return this._fireEvent(h), void(this._lastWrappedInfo = new o(a));
- var c = i.wrapMode,
- u = this._wrapIterations(a.iterations),
- _ = this._lastWrappedInfo,
- f = this._wrapIterations(_.iterations),
- d = _.frameIndex,
- p = _.direction,
- m = -1 !== f && u !== f;
- if (d === h && m && 1 === n) this._fireEvent(0);
- else if (d !== h || m) {
- l = p;
- do {
- if (d !== h) {
- if (-1 === l && 0 === d && h > 0 ? ((c & s.PingPong) === s.PingPong ? l *= -1 : d = n, f++) : 1 === l && d === n - 1 && h < n - 1 && ((c & s.PingPong) === s.PingPong ? l *= -1 : d = -1, f++), d === h) break;
- if (f > u) break
- }
- d += l, cc.director.getAnimationManager().pushDelayEvent(this, "_fireEvent", [d])
- } while (d !== h && d > -1 && d < n)
- }
- this._lastWrappedInfo.set(a)
- },
- _fireEvent: function(t) {
- if (!(t < 0 || t >= this.events.length || this._ignoreIndex === t)) {
- var e = this.events[t].events;
- if (this.target.isValid)
- for (var i = this.target._components, n = 0; n < e.length; n++)
- for (var r = e[n], s = r.func, o = 0; o < i.length; o++) {
- var a = i[o],
- l = a[s];
- l && l.apply(a, r.params)
- }
- }
- },
- onTimeChangedManually: function(t, e) {
- this._lastWrappedInfo = null, this._ignoreIndex = NaN;
- var i = e.getWrappedInfo(t, this._wrappedInfo),
- n = i.direction,
- s = r(this.ratios, i.ratio);
- s < 0 && (s = ~s - 1, n < 0 && (s += 1), this._ignoreIndex = s)
- }
- });
- e.exports = {
- AnimCurve: l,
- DynamicAnimCurve: c,
- EventAnimCurve: _,
- EventInfo: u,
- computeRatioByType: a,
- quickFindIndex: h
- }
- }), {
- "../core/utils/binary-search": 292,
- "./bezier": 14,
- "./types": 19
- }],
- 12: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = cc.Class({
- ctor: function() {
- this._anims = new n.array.MutableForwardIterator([]), this._delayEvents = [], cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
- },
- update: function(t) {
- var e = this._anims,
- i = e.array;
- for (e.i = 0; e.i < i.length; ++e.i) {
- var n = i[e.i];
- n._isPlaying && !n._isPaused && n.update(t)
- }
- for (var r = this._delayEvents, s = 0; s < r.length; s++) {
- var o = r[s];
- o.target[o.func].apply(o.target, o.args)
- }
- r.length = 0
- },
- destruct: function() {},
- addAnimation: function(t) {
- -1 === this._anims.array.indexOf(t) && this._anims.push(t)
- },
- removeAnimation: function(t) {
- var e = this._anims.array.indexOf(t);
- e >= 0 ? this._anims.fastRemoveAt(e) : cc.errorID(3907)
- },
- pushDelayEvent: function(t, e, i) {
- this._delayEvents.push({
- target: t,
- func: e,
- args: i
- })
- }
- });
- cc.AnimationManager = e.exports = r
- }), {}],
- 13: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = t("./playable"),
- s = t("./types"),
- o = s.WrappedInfo,
- a = s.WrapMode,
- l = s.WrapModeMask;
- function h(t, e) {
- r.call(this), this._currentFramePlayed = !1, this._delay = 0, this._delayTime = 0, this._wrappedInfo = new o, this._lastWrappedInfo = null, this._process = u, this._clip = t, this._name = e || t && t.name, this.animator = null, this.curves = [], this.delay = 0, this.repeatCount = 1, this.duration = 1, this.speed = 1, this.wrapMode = a.Normal, this.time = 0, this._target = null, this._lastframeEventOn = !1, this.emit = function() {
- for (var t = new Array(arguments.length), e = 0, i = t.length; e < i; e++) t[e] = arguments[e];
- cc.director.getAnimationManager().pushDelayEvent(this, "_emit", t)
- }
- }
- n.extend(h, r);
- var c = h.prototype;
- function u() {
- var t, e = this.sample();
- this._lastframeEventOn && (t = this._lastWrappedInfo ? this._lastWrappedInfo : this._lastWrappedInfo = new o(e), this.repeatCount > 1 && (0 | e.iterations) > (0 | t.iterations) && this.emit("lastframe", this), t.set(e));
- e.stopped && (this.stop(), this.emit("finished", this))
- }
- function _() {
- var t = this.time,
- e = this.duration;
- t > e ? 0 === (t %= e) && (t = e) : t < 0 && 0 !== (t %= e) && (t += e);
- for (var i = t / e, n = this.curves, r = 0, s = n.length; r < s; r++) {
- n[r].sample(t, i, this)
- }
- this._lastframeEventOn && (void 0 === this._lastIterations && (this._lastIterations = i), (this.time > 0 && this._lastIterations > i || this.time < 0 && this._lastIterations < i) && this.emit("lastframe", this), this._lastIterations = i)
- }
- c._emit = function(t, e) {
- this._target && this._target.isValid && this._target.emit(t, t, e)
- }, c.on = function(t, e, i) {
- return this._target && this._target.isValid ? ("lastframe" === t && (this._lastframeEventOn = !0), this._target.on(t, e, i)) : null
- }, c.once = function(t, e, i) {
- if (this._target && this._target.isValid) {
- "lastframe" === t && (this._lastframeEventOn = !0);
- var n = this;
- return this._target.once(t, (function(t) {
- e.call(i, t), n._lastframeEventOn = !1
- }))
- }
- return null
- }, c.off = function(t, e, i) {
- this._target && this._target.isValid && ("lastframe" === t && (this._target.hasEventListener(t) || (this._lastframeEventOn = !1)), this._target.off(t, e, i))
- }, c._setEventTarget = function(t) {
- this._target = t
- }, c.onPlay = function() {
- this.setTime(0), this._delayTime = this._delay, cc.director.getAnimationManager().addAnimation(this), this.animator && this.animator.addAnimation(this), this.emit("play", this)
- }, c.onStop = function() {
- this.isPaused || cc.director.getAnimationManager().removeAnimation(this), this.animator && this.animator.removeAnimation(this), this.emit("stop", this)
- }, c.onResume = function() {
- cc.director.getAnimationManager().addAnimation(this), this.emit("resume", this)
- }, c.onPause = function() {
- cc.director.getAnimationManager().removeAnimation(this), this.emit("pause", this)
- }, c.setTime = function(t) {
- this._currentFramePlayed = !1, this.time = t || 0;
- for (var e = this.curves, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- r.onTimeChangedManually && r.onTimeChangedManually(t, this)
- }
- }, c.update = function(t) {
- this._delayTime > 0 && (this._delayTime -= t, this._delayTime > 0) || (this._currentFramePlayed ? this.time += t * this.speed : this._currentFramePlayed = !0, this._process())
- }, c._needRevers = function(t) {
- var e = this.wrapMode,
- i = !1;
- (e & l.PingPong) === l.PingPong && (t - (0 | t) == 0 && t > 0 && (t -= 1), 1 & t && (i = !i));
- return (e & l.Reverse) === l.Reverse && (i = !i), i
- }, c.getWrappedInfo = function(t, e) {
- e = e || new o;
- var i = !1,
- n = this.duration,
- r = this.repeatCount,
- s = t > 0 ? t / n : -t / n;
- if (s >= r) {
- s = r, i = !0;
- var a = r - (0 | r);
- 0 === a && (a = 1), t = a * n * (t > 0 ? 1 : -1)
- }
- if (t > n) {
- var h = t % n;
- t = 0 === h ? n : h
- } else t < 0 && 0 !== (t %= n) && (t += n);
- var c = !1,
- u = this._wrapMode & l.ShouldWrap;
- u && (c = this._needRevers(s));
- var _ = c ? -1 : 1;
- return this.speed < 0 && (_ *= -1), u && c && (t = n - t), e.ratio = t / n, e.time = t, e.direction = _, e.stopped = i, e.iterations = s, e
- }, c.sample = function() {
- for (var t = this.getWrappedInfo(this.time, this._wrappedInfo), e = this.curves, i = 0, n = e.length; i < n; i++) {
- e[i].sample(t.time, t.ratio, this)
- }
- return t
- }, n.get(c, "clip", (function() {
- return this._clip
- })), n.get(c, "name", (function() {
- return this._name
- })), n.obsolete(c, "AnimationState.length", "duration"), n.getset(c, "curveLoaded", (function() {
- return this.curves.length > 0
- }), (function() {
- this.curves.length = 0
- })), n.getset(c, "wrapMode", (function() {
- return this._wrapMode
- }), (function(t) {
- this._wrapMode = t, this.time = 0, t & l.Loop ? this.repeatCount = 1 / 0 : this.repeatCount = 1
- })), n.getset(c, "repeatCount", (function() {
- return this._repeatCount
- }), (function(t) {
- this._repeatCount = t;
- var e = this._wrapMode & l.ShouldWrap,
- i = (this.wrapMode & l.Reverse) === l.Reverse;
- this._process = t !== 1 / 0 || e || i ? u : _
- })), n.getset(c, "delay", (function() {
- return this._delay
- }), (function(t) {
- this._delayTime = this._delay = t
- })), cc.AnimationState = e.exports = h
- }), {
- "./playable": 18,
- "./types": 19
- }],
- 14: [(function(t, e, i) {
- "use strict";
- function n(t, e, i, n, r) {
- var s = 1 - r;
- return s * (s * (t + (3 * e - t) * r) + 3 * i * r * r) + n * r * r * r
- }
- var r = Math.cos,
- s = Math.acos,
- o = Math.max,
- a = 2 * Math.PI,
- l = Math.sqrt;
- function h(t) {
- return t < 0 ? -Math.pow(-t, 1 / 3) : Math.pow(t, 1 / 3)
- }
- function c(t, e) {
- var i, n, c, u, _ = e - 0,
- f = e - t[0],
- d = 3 * _,
- p = 3 * f,
- m = 3 * (e - t[2]),
- y = 1 / (-_ + p - m + (e - 1)),
- v = (d - 6 * f + m) * y,
- g = v * (1 / 3),
- x = (-d + p) * y,
- b = 1 / 3 * (3 * x - v * v),
- A = b * (1 / 3),
- C = (2 * v * v * v - 9 * v * x + 27 * (_ * y)) / 27,
- T = C / 2,
- S = T * T + A * A * A;
- if (S < 0) {
- var w = 1 / 3 * -b,
- E = l(w * w * w),
- M = -C / (2 * E),
- D = s(M < -1 ? -1 : M > 1 ? 1 : M),
- B = 2 * h(E);
- return n = B * r(D * (1 / 3)) - g, c = B * r((D + a) * (1 / 3)) - g, u = B * r((D + 2 * a) * (1 / 3)) - g, 0 <= n && n <= 1 ? 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? o(n, c, u) : o(n, c) : 0 <= u && u <= 1 ? o(n, u) : n : 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? o(c, u) : c : u
- }
- if (0 === S) return c = -(i = T < 0 ? h(-T) : -h(T)) - g, 0 <= (n = 2 * i - g) && n <= 1 ? 0 <= c && c <= 1 ? o(n, c) : n : c;
- var I = l(S);
- return n = (i = h(-T + I)) - h(T + I) - g
- }
- function u(t, e) {
- var i = c(t, e),
- n = t[1];
- return ((1 - i) * (n + (t[3] - n) * i) * 3 + i * i) * i
- }
- e.exports = {
- bezier: n,
- bezierByTime: u
- }
- }), {}],
- 15: [(function(t, e, i) {
- "use strict";
- var n = {
- constant: function() {
- return 0
- },
- linear: function(t) {
- return t
- },
- quadIn: function(t) {
- return t * t
- },
- quadOut: function(t) {
- return t * (2 - t)
- },
- quadInOut: function(t) {
- return (t *= 2) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1)
- },
- cubicIn: function(t) {
- return t * t * t
- },
- cubicOut: function(t) {
- return --t * t * t + 1
- },
- cubicInOut: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2)
- },
- quartIn: function(t) {
- return t * t * t * t
- },
- quartOut: function(t) {
- return 1 - --t * t * t * t
- },
- quartInOut: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2)
- },
- quintIn: function(t) {
- return t * t * t * t * t
- },
- quintOut: function(t) {
- return --t * t * t * t * t + 1
- },
- quintInOut: function(t) {
- return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2)
- },
- sineIn: function(t) {
- return 1 - Math.cos(t * Math.PI / 2)
- },
- sineOut: function(t) {
- return Math.sin(t * Math.PI / 2)
- },
- sineInOut: function(t) {
- return .5 * (1 - Math.cos(Math.PI * t))
- },
- expoIn: function(t) {
- return 0 === t ? 0 : Math.pow(1024, t - 1)
- },
- expoOut: function(t) {
- return 1 === t ? 1 : 1 - Math.pow(2, -10 * t)
- },
- expoInOut: function(t) {
- return 0 === t ? 0 : 1 === t ? 1 : (t *= 2) < 1 ? .5 * Math.pow(1024, t - 1) : .5 * (2 - Math.pow(2, -10 * (t - 1)))
- },
- circIn: function(t) {
- return 1 - Math.sqrt(1 - t * t)
- },
- circOut: function(t) {
- return Math.sqrt(1 - --t * t)
- },
- circInOut: function(t) {
- return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1)
- },
- elasticIn: function(t) {
- var e, i = .1;
- return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), -i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4))
- },
- elasticOut: function(t) {
- var e, i = .1;
- return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), i * Math.pow(2, -10 * t) * Math.sin((t - e) * (2 * Math.PI) / .4) + 1)
- },
- elasticInOut: function(t) {
- var e, i = .1;
- return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4) * .5 + 1)
- },
- backIn: function(t) {
- var e = 1.70158;
- return t * t * ((e + 1) * t - e)
- },
- backOut: function(t) {
- var e = 1.70158;
- return --t * t * ((e + 1) * t + e) + 1
- },
- backInOut: function(t) {
- var e = 2.5949095;
- return (t *= 2) < 1 ? t * t * ((e + 1) * t - e) * .5 : .5 * ((t -= 2) * t * ((e + 1) * t + e) + 2)
- },
- bounceIn: function(t) {
- return 1 - n.bounceOut(1 - t)
- },
- bounceOut: function(t) {
- return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375
- },
- bounceInOut: function(t) {
- return t < .5 ? .5 * n.bounceIn(2 * t) : .5 * n.bounceOut(2 * t - 1) + .5
- },
- smooth: function(t) {
- return t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t)
- },
- fade: function(t) {
- return t <= 0 ? 0 : t >= 1 ? 1 : t * t * t * (t * (6 * t - 15) + 10)
- }
- };
- function r(t, e) {
- return function(i) {
- return i < .5 ? e(2 * i) / 2 : t(2 * i - 1) / 2 + .5
- }
- }
- n.quadOutIn = r(n.quadIn, n.quadOut), n.cubicOutIn = r(n.cubicIn, n.cubicOut), n.quartOutIn = r(n.quartIn, n.quartOut), n.quintOutIn = r(n.quintIn, n.quintOut), n.sineOutIn = r(n.sineIn, n.sineOut), n.expoOutIn = r(n.expoIn, n.expoOut), n.circOutIn = r(n.circIn, n.circOut), n.backOutIn = r(n.backIn, n.backOut), n.bounceIn = function(t) {
- return 1 - n.bounceOut(1 - t)
- }, n.bounceInOut = function(t) {
- return t < .5 ? .5 * n.bounceIn(2 * t) : .5 * n.bounceOut(2 * t - 1) + .5
- }, n.bounceOutIn = r(n.bounceIn, n.bounceOut), cc.easing = e.exports = n
- }), {}],
- 16: [(function(t, e, i) {
- "use strict";
- t("./bezier"), t("./easing"), t("./types"), t("./motion-path-helper"), t("./animation-curves"), t("./animation-clip"), t("./animation-manager"), t("./animation-state"), t("./animation-animator")
- }), {
- "./animation-animator": 9,
- "./animation-clip": 10,
- "./animation-curves": 11,
- "./animation-manager": 12,
- "./animation-state": 13,
- "./bezier": 14,
- "./easing": 15,
- "./motion-path-helper": 17,
- "./types": 19
- }],
- 17: [(function(t, e, i) {
- "use strict";
- var n = t("./animation-curves").DynamicAnimCurve,
- r = t("./animation-curves").computeRatioByType,
- s = t("./bezier").bezier,
- o = t("../core/utils/binary-search").binarySearchEpsilon,
- a = cc.v2;
- function l(t) {
- this.points = t || [], this.beziers = [], this.ratios = [], this.progresses = [], this.length = 0, this.computeBeziers()
- }
- function h() {
- this.start = a(), this.end = a(), this.startCtrlPoint = a(), this.endCtrlPoint = a()
- }
- function c(t) {
- if (!Array.isArray(t)) return !1;
- for (var e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- if (!Array.isArray(n) || 6 !== n.length) return !1
- }
- return !0
- }
- function u(t, e, i, s, h) {
- function u(t) {
- return t instanceof cc.Vec2 ? { in: t,
- pos: t,
- out: t
- } : Array.isArray(t) && 6 === t.length ? { in: a(t[2], t[3]),
- pos: a(t[0], t[1]),
- out: a(t[4], t[5])
- } : { in: cc.Vec2.ZERO,
- pos: cc.Vec2.ZERO,
- out: cc.Vec2.ZERO
- }
- }
- var _ = e.values = e.values.map((function(t) {
- return Array.isArray(t) && (t = 2 === t.length ? cc.v2(t[0], t[1]) : cc.v3(t[0], t[1], t[2])), t
- }));
- if (0 !== t.length && 0 !== _.length) {
- for (var f = !1, d = 0; d < t.length; d++) {
- var p = t[d];
- if (p && !c(p) && (cc.errorID(3904, h ? h.name : "", "position", d), p = null), p && p.length > 0) {
- f = !0;
- break
- }
- }
- if (f && 1 !== _.length) {
- for (var m = e.types, y = e.ratios, v = e.values = [], g = e.types = [], x = e.ratios = [], b = 0, A = n.Linear, C = 0, T = t.length; C < T - 1; C++) {
- var S, w = t[C],
- E = y[C],
- M = y[C + 1] - E,
- D = _[C],
- B = _[C + 1],
- I = m[C],
- P = [],
- R = b / M,
- O = 1 / (M * i * s);
- if (w && w.length > 0) {
- var L = [];
- L.push(u(D));
- for (var F = 0, N = w.length; F < N; F++) {
- var V = u(w[F]);
- L.push(V)
- }
- L.push(u(B));
- var k = new l(L);
- k.computeBeziers();
- for (var G = k.progresses; 1 - R > 1e-6;) {
- var U, z, j, W;
- if ((S = r(S = R, I)) < 0) W = (0 - S) * (z = k.beziers[0]).getLength(), j = z.start.sub(z.endCtrlPoint).normalize(), U = z.start.add(j.mul(W));
- else if (S > 1) W = (S - 1) * (z = k.beziers[k.beziers.length - 1]).getLength(), j = z.end.sub(z.startCtrlPoint).normalize(), U = z.end.add(j.mul(W));
- else {
- var H = o(G, S);
- H < 0 && (H = ~H), S -= H > 0 ? G[H - 1] : 0, S /= k.ratios[H], U = k.beziers[H].getPointAt(S)
- }
- P.push(U), R += O
- }
- } else
- for (; 1 - R > 1e-6;) S = r(S = R, I), P.push(D.lerp(B, S)), R += O;
- A = "constant" === I ? I : n.Linear;
- for (F = 0, N = P.length; F < N; F++) {
- var X = E + b + O * F * M;
- Y(P[F], A, X)
- }
- b = Math.abs(R - 1) > 1e-6 ? (R - 1) * M : 0
- }
- y[y.length - 1] !== x[x.length - 1] && Y(_[_.length - 1], A, y[y.length - 1])
- }
- }
- function Y(t, e, i) {
- v.push(t), g.push(e), x.push(i)
- }
- }
- l.prototype.computeBeziers = function() {
- var t;
- this.beziers.length = 0, this.ratios.length = 0, this.progresses.length = 0, this.length = 0;
- for (var e = 1; e < this.points.length; e++) {
- var i = this.points[e - 1],
- n = this.points[e];
- (t = new h).start = i.pos, t.startCtrlPoint = i.out, t.end = n.pos, t.endCtrlPoint = n.in, this.beziers.push(t), this.length += t.getLength()
- }
- var r = 0;
- for (e = 0; e < this.beziers.length; e++) t = this.beziers[e], this.ratios[e] = t.getLength() / this.length, this.progresses[e] = r += this.ratios[e];
- return this.beziers
- }, h.prototype.getPointAt = function(t) {
- var e = this.getUtoTmapping(t);
- return this.getPoint(e)
- }, h.prototype.getPoint = function(t) {
- var e = s(this.start.x, this.startCtrlPoint.x, this.endCtrlPoint.x, this.end.x, t),
- i = s(this.start.y, this.startCtrlPoint.y, this.endCtrlPoint.y, this.end.y, t);
- return new a(e, i)
- }, h.prototype.getLength = function() {
- var t = this.getLengths();
- return t[t.length - 1]
- }, h.prototype.getLengths = function(t) {
- if (t || (t = this.__arcLengthDivisions ? this.__arcLengthDivisions : 200), this.cacheArcLengths && this.cacheArcLengths.length === t + 1) return this.cacheArcLengths;
- var e, i, n = [],
- r = this.getPoint(0),
- s = a(),
- o = 0;
- for (n.push(0), i = 1; i <= t; i++) e = this.getPoint(i / t), s.x = r.x - e.x, s.y = r.y - e.y, o += s.mag(), n.push(o), r = e;
- return this.cacheArcLengths = n, n
- }, h.prototype.getUtoTmapping = function(t, e) {
- var i, n = this.getLengths(),
- r = 0,
- s = n.length;
- i = e || t * n[s - 1];
- for (var o, a = 0, l = s - 1; a <= l;)
- if ((o = n[r = Math.floor(a + (l - a) / 2)] - i) < 0) a = r + 1;
- else {
- if (!(o > 0)) {
- l = r;
- break
- }
- l = r - 1
- }
- if (n[r = l] === i) return r / (s - 1);
- var h = n[r];
- return (r + (i - h) / (n[r + 1] - h)) / (s - 1)
- }, e.exports = {
- sampleMotionPaths: u,
- Curve: l,
- Bezier: h
- }
- }), {
- "../core/utils/binary-search": 292,
- "./animation-curves": 11,
- "./bezier": 14
- }],
- 18: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = t("../core/CCDebug");
- function s() {
- this._isPlaying = !1, this._isPaused = !1, this._stepOnce = !1
- }
- var o = s.prototype;
- n.get(o, "isPlaying", (function() {
- return this._isPlaying
- }), !0), n.get(o, "isPaused", (function() {
- return this._isPaused
- }), !0);
- var a = function() {};
- o.onPlay = a, o.onPause = a, o.onResume = a, o.onStop = a, o.onError = a, o.play = function() {
- this._isPlaying ? this._isPaused ? (this._isPaused = !1, this.onResume()) : this.onError(r.getError(3912)) : (this._isPlaying = !0, this.onPlay())
- }, o.stop = function() {
- this._isPlaying && (this._isPlaying = !1, this.onStop(), this._isPaused = !1)
- }, o.pause = function() {
- this._isPlaying && !this._isPaused && (this._isPaused = !0, this.onPause())
- }, o.resume = function() {
- this._isPlaying && this._isPaused && (this._isPaused = !1, this.onResume())
- }, o.step = function() {
- this.pause(), this._stepOnce = !0, this._isPlaying || this.play()
- }, e.exports = s
- }), {
- "../core/CCDebug": 49
- }],
- 19: [(function(t, e, i) {
- "use strict";
- var n = {
- Loop: 2,
- ShouldWrap: 4,
- PingPong: 22,
- Reverse: 36
- },
- r = cc.Enum({
- Default: 0,
- Normal: 1,
- Reverse: n.Reverse,
- Loop: n.Loop,
- LoopReverse: n.Loop | n.Reverse,
- PingPong: n.PingPong,
- PingPongReverse: n.PingPong | n.Reverse
- });
- function s(t) {
- t ? this.set(t) : (this.ratio = 0, this.time = 0, this.direction = 1, this.stopped = !0, this.iterations = 0, this.frameIndex = void 0)
- }
- cc.WrapMode = r, s.prototype.set = function(t) {
- this.ratio = t.ratio, this.time = t.time, this.direction = t.direction, this.stopped = t.stopped, this.iterations = t.iterations, this.frameIndex = t.frameIndex
- }, e.exports = {
- WrapModeMask: n,
- WrapMode: r,
- WrappedInfo: s
- }
- }), {}],
- 20: [(function(t, e, i) {
- "use strict";
- var n = t("../core/event/event-target"),
- r = t("../core/platform/CCSys"),
- s = t("../core/assets/CCAudioClip").LoadMode,
- o = !1,
- a = [],
- l = function t(e) {
- n.call(this), this._src = e, this._element = null, this.id = 0, this._volume = 1, this._loop = !1, this._nextTime = 0, this._state = t.State.INITIALZING, this._onended = function() {
- this._state = t.State.STOPPED, this.emit("ended")
- }.bind(this)
- };
- cc.js.extend(l, n), l.State = {
- ERROR: -1,
- INITIALZING: 0,
- PLAYING: 1,
- PAUSED: 2,
- STOPPED: 3
- }, (function(t) {
- t._bindEnded = function(t) {
- t = t || this._onended;
- var e = this._element;
- this._src && e instanceof HTMLAudioElement ? e.addEventListener("ended", t) : e.onended = t
- }, t._unbindEnded = function() {
- var t = this._element;
- t instanceof HTMLAudioElement ? t.removeEventListener("ended", this._onended) : t && (t.onended = null)
- }, t._onLoaded = function() {
- this._createElement(), this.setVolume(this._volume), this.setLoop(this._loop), 0 !== this._nextTime && this.setCurrentTime(this._nextTime), this.getState() === l.State.PLAYING ? this.play() : this._state = l.State.INITIALZING
- }, t._createElement = function() {
- var t = this._src._nativeAsset;
- t instanceof HTMLAudioElement ? (this._element || (this._element = document.createElement("audio")), this._element.src = t.src) : this._element = new c(t, this)
- }, t.play = function() {
- this._state = l.State.PLAYING, this._element && (this._bindEnded(), this._element.play(), this._touchToPlay())
- }, t._touchToPlay = function() {
- if (this._src && this._src.loadMode === s.DOM_AUDIO && this._element.paused && a.push({
- instance: this,
- offset: 0,
- audio: this._element
- }), !o) {
- o = !0;
- var t = "ontouchend" in window ? "touchend" : "mousedown";
- cc.game.canvas.addEventListener(t, (function() {
- for (var t = void 0; t = a.pop();) t.audio.play(t.offset)
- }))
- }
- }, t.destroy = function() {
- this._element = null
- }, t.pause = function() {
- this._element && this.getState() === l.State.PLAYING && (this._unbindEnded(), this._element.pause(), this._state = l.State.PAUSED)
- }, t.resume = function() {
- this._element && this.getState() === l.State.PAUSED && (this._bindEnded(), this._element.play(), this._state = l.State.PLAYING)
- }, t.stop = function() {
- if (this._element) {
- this._element.pause();
- try {
- this._element.currentTime = 0
- } catch (t) {}
- for (var t = 0; t < a.length; t++)
- if (a[t].instance === this) {
- a.splice(t, 1);
- break
- }
- this._unbindEnded(), this.emit("stop"), this._state = l.State.STOPPED
- }
- }, t.setLoop = function(t) {
- this._loop = t, this._element && (this._element.loop = t)
- }, t.getLoop = function() {
- return this._loop
- }, t.setVolume = function(t) {
- this._volume = t, this._element && (this._element.volume = t)
- }, t.getVolume = function() {
- return this._volume
- }, t.setCurrentTime = function(t) {
- if (this._element) {
- this._nextTime = 0, this._unbindEnded(), this._bindEnded(function() {
- this._bindEnded()
- }.bind(this));
- try {
- this._element.currentTime = t
- } catch (i) {
- var e = this._element;
- if (e.addEventListener) {
- e.addEventListener("loadedmetadata", (function i() {
- e.removeEventListener("loadedmetadata", i), e.currentTime = t
- }))
- }
- }
- } else this._nextTime = t
- }, t.getCurrentTime = function() {
- return this._element ? this._element.currentTime : 0
- }, t.getDuration = function() {
- return this._element ? this._element.duration : 0
- }, t.getState = function() {
- return this._forceUpdatingState(), this._state
- }, t._forceUpdatingState = function() {
- var t = this._element;
- t && (l.State.PLAYING === this._state && t.paused ? this._state = l.State.STOPPED : l.State.STOPPED !== this._state || t.paused || (this._state = l.State.PLAYING))
- }, Object.defineProperty(t, "src", {
- get: function() {
- return this._src
- },
- set: function(t) {
- if (this._unbindEnded(), t)
- if (this._src = t, t.loaded) this._onLoaded();
- else {
- var e = this;
- t.once("load", (function() {
- t === e._src && e._onLoaded()
- })), cc.loader.load({
- url: t.nativeUrl,
- skips: ["Loader"]
- }, (function(e, i) {
- e ? cc.error(e) : t.loaded || (t._nativeAsset = i)
- }))
- }
- else this._src = null, this._element instanceof HTMLAudioElement ? this._element.src = "" : this._element = null, this._state = l.State.INITIALZING;
- return t
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t, "paused", {
- get: function() {
- return !this._element || this._element.paused
- },
- enumerable: !0,
- configurable: !0
- })
- })(l.prototype);
- var h = void 0;
- h = cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE || cc.sys.browserType === cc.sys.BROWSER_TYPE_BAIDU || cc.sys.browserType === cc.sys.BROWSER_TYPE_UC ? .01 : 0;
- var c = function(t, e) {
- this._audio = e, this._context = r.__audioSupport.context, this._buffer = t, this._gainObj = this._context.createGain(), this.volume = 1, this._gainObj.connect(this._context.destination), this._loop = !1, this._startTime = -1, this._currentSource = null, this.playedLength = 0, this._currentTimer = null, this._endCallback = function() {
- this.onended && this.onended(this)
- }.bind(this)
- };
- (function(t) {
- t.play = function(t) {
- this._currentSource && !this.paused && (this._currentSource.onended = null, this._currentSource.stop(0), this.playedLength = 0);
- var e = this._context.createBufferSource();
- e.buffer = this._buffer, e.connect(this._gainObj), e.loop = this._loop, this._startTime = this._context.currentTime, (t = t || this.playedLength) && (this._startTime -= t);
- var i = this._buffer.duration,
- n = t,
- r = void 0;
- if (this._loop ? e.start ? e.start(0, n) : e.notoGrainOn ? e.noteGrainOn(0, n) : e.noteOn(0, n) : (r = i - t, e.start ? e.start(0, n, r) : e.noteGrainOn ? e.noteGrainOn(0, n, r) : e.noteOn(0, n, r)), this._currentSource = e, e.onended = this._endCallback, (!e.context.state || "suspended" === e.context.state) && 0 === this._context.currentTime) {
- var s = this;
- clearTimeout(this._currentTimer), this._currentTimer = setTimeout((function() {
- 0 === s._context.currentTime && a.push({
- instance: s._audio,
- offset: t,
- audio: s
- })
- }), 10)
- }
- }, t.pause = function() {
- if (clearTimeout(this._currentTimer), !this.paused) {
- this.playedLength = this._context.currentTime - this._startTime, this.playedLength %= this._buffer.duration;
- var t = this._currentSource;
- this._currentSource = null, this._startTime = -1, t && t.stop(0)
- }
- }, Object.defineProperty(t, "paused", {
- get: function() {
- return (!this._currentSource || !this._currentSource.loop) && (-1 === this._startTime || this._context.currentTime - this._startTime > this._buffer.duration)
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t, "loop", {
- get: function() {
- return this._loop
- },
- set: function(t) {
- return this._currentSource && (this._currentSource.loop = t), this._loop = t
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t, "volume", {
- get: function() {
- return this._volume
- },
- set: function(t) {
- if (this._volume = t, this._gainObj.gain.setTargetAtTime) try {
- this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, h)
- } catch (e) {
- this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, .01)
- } else this._gainObj.gain.value = t;
- r.os === r.OS_IOS && !this.paused && this._currentSource && (this._currentSource.onended = null, this.pause(), this.play())
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t, "currentTime", {
- get: function() {
- return this.paused ? this.playedLength : (this.playedLength = this._context.currentTime - this._startTime, this.playedLength %= this._buffer.duration, this.playedLength)
- },
- set: function(t) {
- return this.paused ? this.playedLength = t : (this.pause(), this.playedLength = t, this.play()), t
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t, "duration", {
- get: function() {
- return this._buffer.duration
- },
- enumerable: !0,
- configurable: !0
- })
- })(c.prototype), e.exports = cc.Audio = l
- }), {
- "../core/assets/CCAudioClip": 57,
- "../core/event/event-target": 131,
- "../core/platform/CCSys": 207
- }],
- 21: [(function(t, e, i) {
- "use strict";
- var n = t("./CCAudio"),
- r = t("../core/assets/CCAudioClip"),
- s = cc.js,
- o = 0,
- a = s.createMap(!0),
- l = {},
- h = [],
- c = function(t) {
- t._finishCallback = null, t.off("ended"), t.off("stop"), t.src = null, h.includes(t) || (h.length < 32 ? h.push(t) : t.destroy())
- },
- u = function(t) {
- var e = o++,
- i = l[t];
- if (i || (i = l[t] = []), d._maxAudioInstance <= i.length) {
- var r = i.shift();
- _(r).stop()
- }
- var s = h.pop() || new n,
- u = function() {
- if (_(this.id)) {
- delete a[this.id];
- var t = i.indexOf(this.id);
- cc.js.array.fastRemoveAt(i, t)
- }
- c(this)
- };
- return s.on("ended", (function() {
- this._finishCallback && this._finishCallback(), u.call(this)
- }), s), s.on("stop", u, s), s.id = e, a[e] = s, i.push(e), s
- },
- _ = function(t) {
- return a[t]
- },
- f = function(t) {
- return void 0 === t ? t = 1 : "string" == typeof t && (t = Number.parseFloat(t)), t
- },
- d = {
- AudioState: n.State,
- _maxWebAudioSize: 2097152,
- _maxAudioInstance: 24,
- _id2audio: a,
- play: function(t, e, i) {
- var n, s = t;
- if ("string" == typeof t) cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio"), n = u(s = t), r._loadByUrl(s, (function(t, e) {
- e && (n.src = e)
- }));
- else {
- if (!t) return;
- s = t.nativeUrl, (n = u(s)).src = t
- }
- return n.setLoop(e || !1), i = f(i), n.setVolume(i), n.play(), n.id
- },
- setLoop: function(t, e) {
- var i = _(t);
- i && i.setLoop && i.setLoop(e)
- },
- isLoop: function(t) {
- var e = _(t);
- return !(!e || !e.getLoop) && e.getLoop()
- },
- setVolume: function(t, e) {
- var i = _(t);
- i && i.setVolume(e)
- },
- getVolume: function(t) {
- var e = _(t);
- return e ? e.getVolume() : 1
- },
- setCurrentTime: function(t, e) {
- var i = _(t);
- return !!i && (i.setCurrentTime(e), !0)
- },
- getCurrentTime: function(t) {
- var e = _(t);
- return e ? e.getCurrentTime() : 0
- },
- getDuration: function(t) {
- var e = _(t);
- return e ? e.getDuration() : 0
- },
- getState: function(t) {
- var e = _(t);
- return e ? e.getState() : this.AudioState.ERROR
- },
- setFinishCallback: function(t, e) {
- var i = _(t);
- i && (i._finishCallback = e)
- },
- pause: function(t) {
- var e = _(t);
- return !!e && (e.pause(), !0)
- },
- _pauseIDCache: [],
- pauseAll: function() {
- for (var t in a) {
- var e = a[t];
- e.getState() === n.State.PLAYING && (this._pauseIDCache.push(t), e.pause())
- }
- },
- resume: function(t) {
- var e = _(t);
- e && e.resume()
- },
- resumeAll: function() {
- for (var t = 0; t < this._pauseIDCache.length; ++t) {
- var e = this._pauseIDCache[t],
- i = _(e);
- i && i.resume()
- }
- this._pauseIDCache.length = 0
- },
- stop: function(t) {
- var e = _(t);
- return !!e && (e.stop(), !0)
- },
- stopAll: function() {
- for (var t in a) {
- var e = a[t];
- e && e.stop()
- }
- },
- setMaxAudioInstance: function(t) {
- this._maxAudioInstance = t
- },
- getMaxAudioInstance: function() {
- return this._maxAudioInstance
- },
- uncache: function(t) {
- var e = t;
- if ("string" == typeof t) cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio"), e = t;
- else {
- if (!t) return;
- e = t.nativeUrl
- }
- var i = l[e];
- if (i)
- for (; i.length > 0;) {
- var n = i.pop(),
- r = a[n];
- r && (r.stop(), delete a[n])
- }
- },
- uncacheAll: function() {
- this.stopAll();
- var t = void 0;
- for (var e in a)(t = a[e]) && t.destroy();
- for (; t = h.pop();) t.destroy();
- a = s.createMap(!0), l = {}
- },
- getProfile: function(t) {},
- preload: function(t, e) {
- cc.loader.load(t, e && function(t) {
- t || e()
- })
- },
- setMaxWebAudioSize: function(t) {
- this._maxWebAudioSize = 1024 * t
- },
- _breakCache: null,
- _break: function() {
- for (var t in this._breakCache = [], a) {
- var e = a[t];
- e.getState() === n.State.PLAYING && (this._breakCache.push(t), e.pause())
- }
- },
- _restore: function() {
- if (this._breakCache) {
- for (; this._breakCache.length > 0;) {
- var t = this._breakCache.pop(),
- e = _(t);
- e && e.resume && e.resume()
- }
- this._breakCache = null
- }
- },
- _music: {
- id: -1,
- loop: !1,
- volume: 1
- },
- _effect: {
- volume: 1,
- pauseCache: []
- },
- playMusic: function(t, e) {
- var i = this._music;
- return this.stop(i.id), i.id = this.play(t, e, i.volume), i.loop = e, i.id
- },
- stopMusic: function() {
- this.stop(this._music.id)
- },
- pauseMusic: function() {
- return this.pause(this._music.id), this._music.id
- },
- resumeMusic: function() {
- return this.resume(this._music.id), this._music.id
- },
- getMusicVolume: function() {
- return this._music.volume
- },
- setMusicVolume: function(t) {
- t = f(t);
- var e = this._music;
- return e.volume = t, this.setVolume(e.id, e.volume), e.volume
- },
- isMusicPlaying: function() {
- return this.getState(this._music.id) === this.AudioState.PLAYING
- },
- playEffect: function(t, e) {
- return this.play(t, e || !1, this._effect.volume)
- },
- setEffectsVolume: function(t) {
- t = f(t);
- var e = this._music.id;
- for (var i in this._effect.volume = t, a) {
- var n = a[i];
- n && n.id !== e && d.setVolume(i, t)
- }
- },
- getEffectsVolume: function() {
- return this._effect.volume
- },
- pauseEffect: function(t) {
- return this.pause(t)
- },
- pauseAllEffects: function() {
- var t = this._music.id,
- e = this._effect;
- for (var i in e.pauseCache.length = 0, a) {
- var n = a[i];
- if (n && n.id !== t) n.getState() === this.AudioState.PLAYING && (e.pauseCache.push(i), n.pause())
- }
- },
- resumeEffect: function(t) {
- this.resume(t)
- },
- resumeAllEffects: function() {
- for (var t = this._effect.pauseCache, e = 0; e < t.length; ++e) {
- var i = t[e],
- n = a[i];
- n && n.resume()
- }
- },
- stopEffect: function(t) {
- return this.stop(t)
- },
- stopAllEffects: function() {
- var t = this._music.id;
- for (var e in a) {
- var i = a[e];
- if (i && i.id !== t) i.getState() === d.AudioState.PLAYING && i.stop()
- }
- }
- };
- e.exports = cc.audioEngine = d
- }), {
- "../core/assets/CCAudioClip": 57,
- "./CCAudio": 20
- }],
- 22: [(function(t, e, i) {
- "use strict";
- var n = {
- name: "Jacob__Codec"
- };
- n.Base64 = t("./base64"), n.GZip = t("./gzip"), n.unzip = function() {
- return n.GZip.gunzip.apply(n.GZip, arguments)
- }, n.unzipBase64 = function() {
- var t = n.Base64.decode.apply(n.Base64, arguments);
- try {
- return n.GZip.gunzip.call(n.GZip, t)
- } catch (e) {
- return t.slice(7)
- }
- }, n.unzipBase64AsArray = function(t, e) {
- e = e || 1;
- var i, n, r, s = this.unzipBase64(t),
- o = [];
- for (i = 0, r = s.length / e; i < r; i++)
- for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
- return o
- }, n.unzipAsArray = function(t, e) {
- e = e || 1;
- var i, n, r, s = this.unzip(t),
- o = [];
- for (i = 0, r = s.length / e; i < r; i++)
- for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
- return o
- }, cc.codec = e.exports = n
- }), {
- "./base64": 23,
- "./gzip": 24
- }],
- 23: [(function(t, e, i) {
- "use strict";
- var n = t("../core/utils/misc").BASE64_VALUES,
- r = {
- name: "Jacob__Codec__Base64",
- decode: function(t) {
- var e, i, r, s, o, a, l = [],
- h = 0;
- for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); h < t.length;) e = n[t.charCodeAt(h++)] << 2 | (s = n[t.charCodeAt(h++)]) >> 4, i = (15 & s) << 4 | (o = n[t.charCodeAt(h++)]) >> 2, r = (3 & o) << 6 | (a = n[t.charCodeAt(h++)]), l.push(String.fromCharCode(e)), 64 !== o && l.push(String.fromCharCode(i)), 64 !== a && l.push(String.fromCharCode(r));
- return l = l.join("")
- },
- decodeAsArray: function(t, e) {
- var i, n, r, s = this.decode(t),
- o = [];
- for (i = 0, r = s.length / e; i < r; i++)
- for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
- return o
- }
- };
- e.exports = r
- }), {
- "../core/utils/misc": 300
- }],
- 24: [(function(t, e, i) {
- "use strict";
- var n = function(t) {
- this.data = t, this.debug = !1, this.gpflags = void 0, this.files = 0, this.unzipped = [], this.buf32k = new Array(32768), this.bIdx = 0, this.modeZIP = !1, this.bytepos = 0, this.bb = 1, this.bits = 0, this.nameBuf = [], this.fileout = void 0, this.literalTree = new Array(n.LITERALS), this.distanceTree = new Array(32), this.treepos = 0, this.Places = null, this.len = 0, this.fpos = new Array(17), this.fpos[0] = 0, this.flens = void 0, this.fmax = void 0
- };
- n.gunzip = function(t) {
- return t.constructor === Array || (t.constructor, String), new n(t).gunzip()[0][0]
- }, n.HufNode = function() {
- this.b0 = 0, this.b1 = 0, this.jump = null, this.jumppos = -1
- }, n.LITERALS = 288, n.NAMEMAX = 256, n.bitReverse = [0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255], n.cplens = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], n.cplext = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99], n.cpdist = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], n.cpdext = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], n.border = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], n.prototype.gunzip = function() {
- return this.outputArr = [], this.nextFile(), this.unzipped
- }, n.prototype.readByte = function() {
- return this.bits += 8, this.bytepos < this.data.length ? this.data.charCodeAt(this.bytepos++) : -1
- }, n.prototype.byteAlign = function() {
- this.bb = 1
- }, n.prototype.readBit = function() {
- var t;
- return this.bits++, t = 1 & this.bb, this.bb >>= 1, 0 === this.bb && (this.bb = this.readByte(), t = 1 & this.bb, this.bb = this.bb >> 1 | 128), t
- }, n.prototype.readBits = function(t) {
- for (var e = 0, i = t; i--;) e = e << 1 | this.readBit();
- return t && (e = n.bitReverse[e] >> 8 - t), e
- }, n.prototype.flushBuffer = function() {
- this.bIdx = 0
- }, n.prototype.addBuffer = function(t) {
- this.buf32k[this.bIdx++] = t, this.outputArr.push(String.fromCharCode(t)), 32768 === this.bIdx && (this.bIdx = 0)
- }, n.prototype.IsPat = function() {
- for (;;) {
- if (this.fpos[this.len] >= this.fmax) return -1;
- if (this.flens[this.fpos[this.len]] === this.len) return this.fpos[this.len]++;
- this.fpos[this.len]++
- }
- }, n.prototype.Rec = function() {
- var t, e = this.Places[this.treepos];
- if (17 === this.len) return -1;
- if (this.treepos++, this.len++, (t = this.IsPat()) >= 0) e.b0 = t;
- else if (e.b0 = 32768, this.Rec()) return -1;
- if ((t = this.IsPat()) >= 0) e.b1 = t, e.jump = null;
- else if (e.b1 = 32768, e.jump = this.Places[this.treepos], e.jumppos = this.treepos, this.Rec()) return -1;
- return this.len--, 0
- }, n.prototype.CreateTree = function(t, e, i, n) {
- var r;
- for (this.Places = t, this.treepos = 0, this.flens = i, this.fmax = e, r = 0; r < 17; r++) this.fpos[r] = 0;
- return this.len = 0, this.Rec() ? -1 : 0
- }, n.prototype.DecodeValue = function(t) {
- for (var e, i, n = 0, r = t[n];;)
- if (this.readBit()) {
- if (!(32768 & r.b1)) return r.b1;
- for (r = r.jump, e = t.length, i = 0; i < e; i++)
- if (t[i] === r) {
- n = i;
- break
- }
- } else {
- if (!(32768 & r.b0)) return r.b0;
- r = t[++n]
- }
- return -1
- }, n.prototype.DeflateLoop = function() {
- var t, e, i;
- do {
- var r, s;
- if (t = this.readBit(), 0 === (e = this.readBits(2)))
- for (this.byteAlign(), r = this.readByte(), r |= this.readByte() << 8, s = this.readByte(), 65535 & (r ^ ~(s |= this.readByte() << 8)) && document.write("BlockLen checksum mismatch\n"); r--;) o = this.readByte(), this.addBuffer(o);
- else if (1 === e)
- for (;;)
- if ((a = n.bitReverse[this.readBits(7)] >> 1) > 23 ? (a = a << 1 | this.readBit()) > 199 ? a = (a -= 128) << 1 | this.readBit() : (a -= 48) > 143 && (a += 136) : a += 256, a < 256) this.addBuffer(a);
- else {
- if (256 === a) break;
- for (a -= 257, p = this.readBits(n.cplext[a]) + n.cplens[a], a = n.bitReverse[this.readBits(5)] >> 3, n.cpdext[a] > 8 ? (m = this.readBits(8), m |= this.readBits(n.cpdext[a] - 8) << 8) : m = this.readBits(n.cpdext[a]), m += n.cpdist[a], a = 0; a < p; a++) {
- var o = this.buf32k[this.bIdx - m & 32767];
- this.addBuffer(o)
- }
- }
- else if (2 === e) {
- var a, l, h, c, u, _ = new Array(320);
- for (h = 257 + this.readBits(5), c = 1 + this.readBits(5), u = 4 + this.readBits(4), a = 0; a < 19; a++) _[a] = 0;
- for (a = 0; a < u; a++) _[n.border[a]] = this.readBits(3);
- for (p = this.distanceTree.length, i = 0; i < p; i++) this.distanceTree[i] = new n.HufNode;
- if (this.CreateTree(this.distanceTree, 19, _, 0)) return this.flushBuffer(), 1;
- l = h + c, i = 0;
- for (; i < l;)
- if (0, (a = this.DecodeValue(this.distanceTree)) < 16) _[i++] = a;
- else if (16 === a) {
- var f;
- if (i + (a = 3 + this.readBits(2)) > l) return this.flushBuffer(), 1;
- for (f = i ? _[i - 1] : 0; a--;) _[i++] = f
- } else {
- if (i + (a = 17 === a ? 3 + this.readBits(3) : 11 + this.readBits(7)) > l) return this.flushBuffer(), 1;
- for (; a--;) _[i++] = 0
- }
- for (p = this.literalTree.length, i = 0; i < p; i++) this.literalTree[i] = new n.HufNode;
- if (this.CreateTree(this.literalTree, h, _, 0)) return this.flushBuffer(), 1;
- for (p = this.literalTree.length, i = 0; i < p; i++) this.distanceTree[i] = new n.HufNode;
- var d = new Array;
- for (i = h; i < _.length; i++) d[i - h] = _[i];
- if (this.CreateTree(this.distanceTree, c, d, 0)) return this.flushBuffer(), 1;
- for (;;)
- if ((a = this.DecodeValue(this.literalTree)) >= 256) {
- var p, m;
- if (0 === (a -= 256)) break;
- for (a--, p = this.readBits(n.cplext[a]) + n.cplens[a], a = this.DecodeValue(this.distanceTree), n.cpdext[a] > 8 ? (m = this.readBits(8), m |= this.readBits(n.cpdext[a] - 8) << 8) : m = this.readBits(n.cpdext[a]), m += n.cpdist[a]; p--;) {
- o = this.buf32k[this.bIdx - m & 32767];
- this.addBuffer(o)
- }
- } else this.addBuffer(a)
- }
- } while (!t);
- return this.flushBuffer(), this.byteAlign(), 0
- }, n.prototype.unzipFile = function(t) {
- var e;
- for (this.gunzip(), e = 0; e < this.unzipped.length; e++)
- if (this.unzipped[e][1] === t) return this.unzipped[e][0]
- }, n.prototype.nextFile = function() {
- this.outputArr = [], this.modeZIP = !1;
- var t = [];
- if (t[0] = this.readByte(), t[1] = this.readByte(), 120 === t[0] && 218 === t[1] && (this.DeflateLoop(), this.unzipped[this.files] = [this.outputArr.join(""), "geonext.gxt"], this.files++), 31 === t[0] && 139 === t[1] && (this.skipdir(), this.unzipped[this.files] = [this.outputArr.join(""), "file"], this.files++), 80 === t[0] && 75 === t[1] && (this.modeZIP = !0, t[2] = this.readByte(), t[3] = this.readByte(), 3 === t[2] && 4 === t[3])) {
- t[0] = this.readByte(), t[1] = this.readByte(), this.gpflags = this.readByte(), this.gpflags |= this.readByte() << 8;
- var e = this.readByte();
- e |= this.readByte() << 8, this.readByte(), this.readByte(), this.readByte(), this.readByte();
- this.readByte();
- this.readByte() << 8, this.readByte() << 16, this.readByte() << 24;
- this.readByte();
- this.readByte() << 8, this.readByte() << 16, this.readByte() << 24;
- var i = this.readByte();
- i |= this.readByte() << 8;
- var r = this.readByte();
- for (r |= this.readByte() << 8, o = 0, this.nameBuf = []; i--;) {
- var s = this.readByte();
- "/" === s | ":" === s ? o = 0 : o < n.NAMEMAX - 1 && (this.nameBuf[o++] = String.fromCharCode(s))
- }
- this.fileout || (this.fileout = this.nameBuf);
- for (var o = 0; o < r;) s = this.readByte(), o++;
- 8 === e && (this.DeflateLoop(), this.unzipped[this.files] = [this.outputArr.join(""), this.nameBuf.join("")], this.files++), this.skipdir()
- }
- }, n.prototype.skipdir = function() {
- var t, e, i = [];
- if (8 & this.gpflags && (i[0] = this.readByte(), i[1] = this.readByte(), i[2] = this.readByte(), i[3] = this.readByte(), this.readByte(), this.readByte() << 8, this.readByte() << 16, this.readByte() << 24, this.readByte(), this.readByte() << 8, this.readByte() << 16, this.readByte() << 24), this.modeZIP && this.nextFile(), i[0] = this.readByte(), 8 !== i[0]) return 0;
- if (this.gpflags = this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), 4 & this.gpflags)
- for (i[0] = this.readByte(), i[2] = this.readByte(), this.len = i[0] + 256 * i[1], t = 0; t < this.len; t++) this.readByte();
- if (8 & this.gpflags)
- for (t = 0, this.nameBuf = []; e = this.readByte();) "7" !== e && ":" !== e || (t = 0), t < n.NAMEMAX - 1 && (this.nameBuf[t++] = e);
- if (16 & this.gpflags)
- for (; e = this.readByte(););
- 2 & this.gpflags && (this.readByte(), this.readByte()), this.DeflateLoop(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.modeZIP && this.nextFile()
- }, e.exports = n
- }), {}],
- 25: [(function(t, e, i) {
- "use strict";
- (function() {
- function t(t) {
- throw t
- }
- var e = void 0,
- i = !0,
- n = this;
- function r(t, i) {
- var r, s = t.split("."),
- o = n;
- !(s[0] in o) && o.execScript && o.execScript("var " + s[0]);
- for (; s.length && (r = s.shift());) s.length || i === e ? o = o[r] ? o[r] : o[r] = {} : o[r] = i
- }
- var s = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array;
- function o(t) {
- if ("string" == typeof t) {
- var e, i, n = t.split("");
- for (e = 0, i = n.length; e < i; e++) n[e] = (255 & n[e].charCodeAt(0)) >>> 0;
- t = n
- }
- for (var r, s = 1, o = 0, a = t.length, l = 0; 0 < a;) {
- a -= r = 1024 < a ? 1024 : a;
- do {
- o += s += t[l++]
- } while (--r);
- s %= 65521, o %= 65521
- }
- return (o << 16 | s) >>> 0
- }
- function a(e, i) {
- this.index = "number" == typeof i ? i : 0, this.i = 0, this.buffer = e instanceof(s ? Uint8Array : Array) ? e : new(s ? Uint8Array : Array)(32768), 2 * this.buffer.length <= this.index && t(Error("invalid index")), this.buffer.length <= this.index && this.f()
- }
- a.prototype.f = function() {
- var t, e = this.buffer,
- i = e.length,
- n = new(s ? Uint8Array : Array)(i << 1);
- if (s) n.set(e);
- else
- for (t = 0; t < i; ++t) n[t] = e[t];
- return this.buffer = n
- }, a.prototype.d = function(t, e, i) {
- var n, r = this.buffer,
- s = this.index,
- o = this.i,
- a = r[s];
- if (i && 1 < e && (t = 8 < e ? (f[255 & t] << 24 | f[t >>> 8 & 255] << 16 | f[t >>> 16 & 255] << 8 | f[t >>> 24 & 255]) >> 32 - e : f[t] >> 8 - e), 8 > e + o) a = a << e | t, o += e;
- else
- for (n = 0; n < e; ++n) a = a << 1 | t >> e - n - 1 & 1, 8 == ++o && (o = 0, r[s++] = f[a], a = 0, s === r.length && (r = this.f()));
- r[s] = a, this.buffer = r, this.i = o, this.index = s
- }, a.prototype.finish = function() {
- var t, e = this.buffer,
- i = this.index;
- return 0 < this.i && (e[i] <<= 8 - this.i, e[i] = f[e[i]], i++), s ? t = e.subarray(0, i) : (e.length = i, t = e), t
- };
- var l, h = new(s ? Uint8Array : Array)(256);
- for (l = 0; 256 > l; ++l) {
- for (var c = _ = l, u = 7, _ = _ >>> 1; _; _ >>>= 1) c <<= 1, c |= 1 & _, --u;
- h[l] = (c << u & 255) >>> 0
- }
- var f = h;
- function d(t) {
- this.buffer = new(s ? Uint16Array : Array)(2 * t), this.length = 0
- }
- function p(t) {
- var e, i, n, r, o, a, l, h, c, u = t.length,
- _ = 0,
- f = Number.POSITIVE_INFINITY;
- for (h = 0; h < u; ++h) t[h] > _ && (_ = t[h]), t[h] < f && (f = t[h]);
- for (e = 1 << _, i = new(s ? Uint32Array : Array)(e), n = 1, r = 0, o = 2; n <= _;) {
- for (h = 0; h < u; ++h)
- if (t[h] === n) {
- for (a = 0, l = r, c = 0; c < n; ++c) a = a << 1 | 1 & l, l >>= 1;
- for (c = a; c < e; c += o) i[c] = n << 16 | h;
- ++r
- }++n, r <<= 1, o <<= 1
- }
- return [i, _, f]
- }
- function m(t, e) {
- this.h = v, this.w = 0, this.input = t, this.b = 0, e && (e.lazy && (this.w = e.lazy), "number" == typeof e.compressionType && (this.h = e.compressionType), e.outputBuffer && (this.a = s && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer), "number" == typeof e.outputIndex && (this.b = e.outputIndex)), this.a || (this.a = new(s ? Uint8Array : Array)(32768))
- }
- s && new Uint32Array([0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117]), d.prototype.getParent = function(t) {
- return 2 * ((t - 2) / 4 | 0)
- }, d.prototype.push = function(t, e) {
- var i, n, r, s = this.buffer;
- for (i = this.length, s[this.length++] = e, s[this.length++] = t; 0 < i && (n = this.getParent(i), s[i] > s[n]);) r = s[i], s[i] = s[n], s[n] = r, r = s[i + 1], s[i + 1] = s[n + 1], s[n + 1] = r, i = n;
- return this.length
- }, d.prototype.pop = function() {
- var t, e, i, n, r, s = this.buffer;
- for (e = s[0], t = s[1], this.length -= 2, s[0] = s[this.length], s[1] = s[this.length + 1], r = 0; !((n = 2 * r + 2) >= this.length) && (n + 2 < this.length && s[n + 2] > s[n] && (n += 2), s[n] > s[r]);) i = s[r], s[r] = s[n], s[n] = i, i = s[r + 1], s[r + 1] = s[n + 1], s[n + 1] = i, r = n;
- return {
- index: t,
- value: e,
- length: this.length
- }
- };
- var y, v = 2,
- g = {
- NONE: 0,
- r: 1,
- j: v,
- N: 3
- },
- x = [];
- for (y = 0; 288 > y; y++) switch (i) {
- case 143 >= y:
- x.push([y + 48, 8]);
- break;
- case 255 >= y:
- x.push([y - 144 + 400, 9]);
- break;
- case 279 >= y:
- x.push([y - 256 + 0, 7]);
- break;
- case 287 >= y:
- x.push([y - 280 + 192, 8]);
- break;
- default:
- t("invalid literal: " + y)
- }
- function b(t, e) {
- this.length = t, this.G = e
- }
- function A() {
- var e = C;
- switch (i) {
- case 3 === e:
- return [257, e - 3, 0];
- case 4 === e:
- return [258, e - 4, 0];
- case 5 === e:
- return [259, e - 5, 0];
- case 6 === e:
- return [260, e - 6, 0];
- case 7 === e:
- return [261, e - 7, 0];
- case 8 === e:
- return [262, e - 8, 0];
- case 9 === e:
- return [263, e - 9, 0];
- case 10 === e:
- return [264, e - 10, 0];
- case 12 >= e:
- return [265, e - 11, 1];
- case 14 >= e:
- return [266, e - 13, 1];
- case 16 >= e:
- return [267, e - 15, 1];
- case 18 >= e:
- return [268, e - 17, 1];
- case 22 >= e:
- return [269, e - 19, 2];
- case 26 >= e:
- return [270, e - 23, 2];
- case 30 >= e:
- return [271, e - 27, 2];
- case 34 >= e:
- return [272, e - 31, 2];
- case 42 >= e:
- return [273, e - 35, 3];
- case 50 >= e:
- return [274, e - 43, 3];
- case 58 >= e:
- return [275, e - 51, 3];
- case 66 >= e:
- return [276, e - 59, 3];
- case 82 >= e:
- return [277, e - 67, 4];
- case 98 >= e:
- return [278, e - 83, 4];
- case 114 >= e:
- return [279, e - 99, 4];
- case 130 >= e:
- return [280, e - 115, 4];
- case 162 >= e:
- return [281, e - 131, 5];
- case 194 >= e:
- return [282, e - 163, 5];
- case 226 >= e:
- return [283, e - 195, 5];
- case 257 >= e:
- return [284, e - 227, 5];
- case 258 === e:
- return [285, e - 258, 0];
- default:
- t("invalid length: " + e)
- }
- }
- m.prototype.n = function() {
- var n, r, o, l, h = this.input;
- switch (this.h) {
- case 0:
- for (o = 0, l = h.length; o < l;) {
- var c, u, _, f = r = s ? h.subarray(o, o + 65535) : h.slice(o, o + 65535),
- d = (o += r.length) === l,
- p = e,
- m = e,
- y = this.a,
- g = this.b;
- if (s) {
- for (y = new Uint8Array(this.a.buffer); y.length <= g + f.length + 5;) y = new Uint8Array(y.length << 1);
- y.set(this.a)
- }
- if (c = d ? 1 : 0, y[g++] = 0 | c, _ = 65536 + ~(u = f.length) & 65535, y[g++] = 255 & u, y[g++] = u >>> 8 & 255, y[g++] = 255 & _, y[g++] = _ >>> 8 & 255, s) y.set(f, g), g += f.length, y = y.subarray(0, g);
- else {
- for (p = 0, m = f.length; p < m; ++p) y[g++] = f[p];
- y.length = g
- }
- this.b = g, this.a = y
- }
- break;
- case 1:
- var b = new a(new Uint8Array(this.a.buffer), this.b);
- b.d(1, 1, i), b.d(1, 2, i);
- var A, C, T, S = E(this, h);
- for (A = 0, C = S.length; A < C; A++)
- if (T = S[A], a.prototype.d.apply(b, x[T]), 256 < T) b.d(S[++A], S[++A], i), b.d(S[++A], 5), b.d(S[++A], S[++A], i);
- else if (256 === T) break;
- this.a = b.finish(), this.b = this.a.length;
- break;
- case v:
- var w, B, I, P, R, O, L, F, N, V, k, G, U, z, j, W = new a(new Uint8Array(this.a), this.b),
- H = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
- X = Array(19);
- for (w = v, W.d(1, 1, i), W.d(w, 2, i), B = E(this, h), L = D(O = M(this.L, 15)), N = D(F = M(this.K, 7)), I = 286; 257 < I && 0 === O[I - 1]; I--);
- for (P = 30; 1 < P && 0 === F[P - 1]; P--);
- var Y, q, J, Z, K, Q, $ = I,
- tt = P,
- et = new(s ? Uint32Array : Array)($ + tt),
- it = new(s ? Uint32Array : Array)(316),
- nt = new(s ? Uint8Array : Array)(19);
- for (Y = q = 0; Y < $; Y++) et[q++] = O[Y];
- for (Y = 0; Y < tt; Y++) et[q++] = F[Y];
- if (!s)
- for (Y = 0, Z = nt.length; Y < Z; ++Y) nt[Y] = 0;
- for (Y = K = 0, Z = et.length; Y < Z; Y += q) {
- for (q = 1; Y + q < Z && et[Y + q] === et[Y]; ++q);
- if (J = q, 0 === et[Y])
- if (3 > J)
- for (; 0 < J--;) it[K++] = 0, nt[0]++;
- else
- for (; 0 < J;)(Q = 138 > J ? J : 138) > J - 3 && Q < J && (Q = J - 3), 10 >= Q ? (it[K++] = 17, it[K++] = Q - 3, nt[17]++) : (it[K++] = 18, it[K++] = Q - 11, nt[18]++), J -= Q;
- else if (it[K++] = et[Y], nt[et[Y]]++, 3 > --J)
- for (; 0 < J--;) it[K++] = et[Y], nt[et[Y]]++;
- else
- for (; 0 < J;)(Q = 6 > J ? J : 6) > J - 3 && Q < J && (Q = J - 3), it[K++] = 16, it[K++] = Q - 3, nt[16]++, J -= Q
- }
- for (n = s ? it.subarray(0, K) : it.slice(0, K), V = M(nt, 7), z = 0; 19 > z; z++) X[z] = V[H[z]];
- for (R = 19; 4 < R && 0 === X[R - 1]; R--);
- for (k = D(V), W.d(I - 257, 5, i), W.d(P - 1, 5, i), W.d(R - 4, 4, i), z = 0; z < R; z++) W.d(X[z], 3, i);
- for (z = 0, j = n.length; z < j; z++)
- if (G = n[z], W.d(k[G], V[G], i), 16 <= G) {
- switch (z++, G) {
- case 16:
- U = 2;
- break;
- case 17:
- U = 3;
- break;
- case 18:
- U = 7;
- break;
- default:
- t("invalid code: " + G)
- }
- W.d(n[z], U, i)
- }
- var rt, st, ot, at, lt, ht, ct, ut, _t = [L, O],
- ft = [N, F];
- for (lt = _t[0], ht = _t[1], ct = ft[0], ut = ft[1], rt = 0, st = B.length; rt < st; ++rt)
- if (ot = B[rt], W.d(lt[ot], ht[ot], i), 256 < ot) W.d(B[++rt], B[++rt], i), at = B[++rt], W.d(ct[at], ut[at], i), W.d(B[++rt], B[++rt], i);
- else if (256 === ot) break;
- this.a = W.finish(), this.b = this.a.length;
- break;
- default:
- t("invalid compression type")
- }
- return this.a
- };
- var C, T, S = [];
- for (C = 3; 258 >= C; C++) T = A(), S[C] = T[2] << 24 | T[1] << 16 | T[0];
- var w = s ? new Uint32Array(S) : S;
- function E(n, r) {
- function o(e, n) {
- var r, s, o, a, l = e.G,
- h = [],
- c = 0;
- switch (r = w[e.length], h[c++] = 65535 & r, h[c++] = r >> 16 & 255, h[c++] = r >> 24, i) {
- case 1 === l:
- s = [0, l - 1, 0];
- break;
- case 2 === l:
- s = [1, l - 2, 0];
- break;
- case 3 === l:
- s = [2, l - 3, 0];
- break;
- case 4 === l:
- s = [3, l - 4, 0];
- break;
- case 6 >= l:
- s = [4, l - 5, 1];
- break;
- case 8 >= l:
- s = [5, l - 7, 1];
- break;
- case 12 >= l:
- s = [6, l - 9, 2];
- break;
- case 16 >= l:
- s = [7, l - 13, 2];
- break;
- case 24 >= l:
- s = [8, l - 17, 3];
- break;
- case 32 >= l:
- s = [9, l - 25, 3];
- break;
- case 48 >= l:
- s = [10, l - 33, 4];
- break;
- case 64 >= l:
- s = [11, l - 49, 4];
- break;
- case 96 >= l:
- s = [12, l - 65, 5];
- break;
- case 128 >= l:
- s = [13, l - 97, 5];
- break;
- case 192 >= l:
- s = [14, l - 129, 6];
- break;
- case 256 >= l:
- s = [15, l - 193, 6];
- break;
- case 384 >= l:
- s = [16, l - 257, 7];
- break;
- case 512 >= l:
- s = [17, l - 385, 7];
- break;
- case 768 >= l:
- s = [18, l - 513, 8];
- break;
- case 1024 >= l:
- s = [19, l - 769, 8];
- break;
- case 1536 >= l:
- s = [20, l - 1025, 9];
- break;
- case 2048 >= l:
- s = [21, l - 1537, 9];
- break;
- case 3072 >= l:
- s = [22, l - 2049, 10];
- break;
- case 4096 >= l:
- s = [23, l - 3073, 10];
- break;
- case 6144 >= l:
- s = [24, l - 4097, 11];
- break;
- case 8192 >= l:
- s = [25, l - 6145, 11];
- break;
- case 12288 >= l:
- s = [26, l - 8193, 12];
- break;
- case 16384 >= l:
- s = [27, l - 12289, 12];
- break;
- case 24576 >= l:
- s = [28, l - 16385, 13];
- break;
- case 32768 >= l:
- s = [29, l - 24577, 13];
- break;
- default:
- t("invalid distance")
- }
- for (r = s, h[c++] = r[0], h[c++] = r[1], h[c++] = r[2], o = 0, a = h.length; o < a; ++o) y[v++] = h[o];
- x[h[0]]++, A[h[3]]++, g = e.length + n - 1, d = null
- }
- var a, l, h, c, u, _, f, d, p, m = {},
- y = s ? new Uint16Array(2 * r.length) : [],
- v = 0,
- g = 0,
- x = new(s ? Uint32Array : Array)(286),
- A = new(s ? Uint32Array : Array)(30),
- C = n.w;
- if (!s) {
- for (h = 0; 285 >= h;) x[h++] = 0;
- for (h = 0; 29 >= h;) A[h++] = 0
- }
- for (x[256] = 1, a = 0, l = r.length; a < l; ++a) {
- for (h = u = 0, c = 3; h < c && a + h !== l; ++h) u = u << 8 | r[a + h];
- if (m[u] === e && (m[u] = []), _ = m[u], !(0 < g--)) {
- for (; 0 < _.length && 32768 < a - _[0];) _.shift();
- if (a + 3 >= l) {
- for (d && o(d, -1), h = 0, c = l - a; h < c; ++h) p = r[a + h], y[v++] = p, ++x[p];
- break
- }
- if (0 < _.length) {
- var T = e,
- S = e,
- E = 0,
- M = e,
- D = e,
- B = e,
- I = r.length,
- P = (D = 0, _.length);
- t: for (; D < P; D++) {
- if (T = _[P - D - 1], M = 3, 3 < E) {
- for (B = E; 3 < B; B--)
- if (r[T + B - 1] !== r[a + B - 1]) continue t;
- M = E
- }
- for (; 258 > M && a + M < I && r[T + M] === r[a + M];) ++M;
- if (M > E && (S = T, E = M), 258 === M) break
- }
- f = new b(E, a - S), d ? d.length < f.length ? (p = r[a - 1], y[v++] = p, ++x[p], o(f, 0)) : o(d, -1) : f.length < C ? d = f : o(f, 0)
- } else d ? o(d, -1) : (p = r[a], y[v++] = p, ++x[p])
- }
- _.push(a)
- }
- return y[v++] = 256, x[256]++, n.L = x, n.K = A, s ? y.subarray(0, v) : y
- }
- function M(t, e) {
- function i(t) {
- var e = C[t][T[t]];
- e === v ? (i(t + 1), i(t + 1)) : --b[e], ++T[t]
- }
- var n, r, o, a, l, h = t.length,
- c = new d(572),
- u = new(s ? Uint8Array : Array)(h);
- if (!s)
- for (a = 0; a < h; a++) u[a] = 0;
- for (a = 0; a < h; ++a) 0 < t[a] && c.push(a, t[a]);
- if (n = Array(c.length / 2), r = new(s ? Uint32Array : Array)(c.length / 2), 1 === n.length) return u[c.pop().index] = 1, u;
- for (a = 0, l = c.length / 2; a < l; ++a) n[a] = c.pop(), r[a] = n[a].value;
- var _, f, p, m, y, v = r.length,
- g = new(s ? Uint16Array : Array)(e),
- x = new(s ? Uint8Array : Array)(e),
- b = new(s ? Uint8Array : Array)(v),
- A = Array(e),
- C = Array(e),
- T = Array(e),
- S = (1 << e) - v,
- w = 1 << e - 1;
- for (g[e - 1] = v, f = 0; f < e; ++f) S < w ? x[f] = 0 : (x[f] = 1, S -= w), S <<= 1, g[e - 2 - f] = (g[e - 1 - f] / 2 | 0) + v;
- for (g[0] = x[0], A[0] = Array(g[0]), C[0] = Array(g[0]), f = 1; f < e; ++f) g[f] > 2 * g[f - 1] + x[f] && (g[f] = 2 * g[f - 1] + x[f]), A[f] = Array(g[f]), C[f] = Array(g[f]);
- for (_ = 0; _ < v; ++_) b[_] = e;
- for (p = 0; p < g[e - 1]; ++p) A[e - 1][p] = r[p], C[e - 1][p] = p;
- for (_ = 0; _ < e; ++_) T[_] = 0;
- for (1 === x[e - 1] && (--b[0], ++T[e - 1]), f = e - 2; 0 <= f; --f) {
- for (m = _ = 0, y = T[f + 1], p = 0; p < g[f]; p++)(m = A[f + 1][y] + A[f + 1][y + 1]) > r[_] ? (A[f][p] = m, C[f][p] = v, y += 2) : (A[f][p] = r[_], C[f][p] = _, ++_);
- T[f] = 0, 1 === x[f] && i(f)
- }
- for (o = b, a = 0, l = n.length; a < l; ++a) u[n[a].index] = o[a];
- return u
- }
- function D(e) {
- var i, n, r, o, a = new(s ? Uint16Array : Array)(e.length),
- l = [],
- h = [],
- c = 0;
- for (i = 0, n = e.length; i < n; i++) l[e[i]] = 1 + (0 | l[e[i]]);
- for (i = 1, n = 16; i <= n; i++) h[i] = c, (c += 0 | l[i]) > 1 << i && t("overcommitted"), c <<= 1;
- for (65536 > c && t("undercommitted"), i = 0, n = e.length; i < n; i++)
- for (c = h[e[i]], h[e[i]] += 1, r = a[i] = 0, o = e[i]; r < o; r++) a[i] = a[i] << 1 | 1 & c, c >>>= 1;
- return a
- }
- function B(t, e) {
- this.input = t, this.a = new(s ? Uint8Array : Array)(32768), this.h = I.j;
- var i, n = {};
- for (i in !e && (e = {}) || "number" != typeof e.compressionType || (this.h = e.compressionType), e) n[i] = e[i];
- n.outputBuffer = this.a, this.z = new m(this.input, n)
- }
- var I = g;
- function P(e, i) {
- switch (this.k = [], this.l = 32768, this.e = this.g = this.c = this.q = 0, this.input = s ? new Uint8Array(e) : e, this.s = !1, this.m = O, this.B = !1, !i && (i = {}) || (i.index && (this.c = i.index), i.bufferSize && (this.l = i.bufferSize), i.bufferType && (this.m = i.bufferType), i.resize && (this.B = i.resize)), this.m) {
- case R:
- this.b = 32768, this.a = new(s ? Uint8Array : Array)(32768 + this.l + 258);
- break;
- case O:
- this.b = 0, this.a = new(s ? Uint8Array : Array)(this.l), this.f = this.J, this.t = this.H, this.o = this.I;
- break;
- default:
- t(Error("invalid inflate mode"))
- }
- }
- B.prototype.n = function() {
- var e, i, n, r, a, l, h, c = 0;
- switch (h = this.a, e = ct) {
- case ct:
- i = Math.LOG2E * Math.log(32768) - 8;
- break;
- default:
- t(Error("invalid compression method"))
- }
- switch (n = i << 4 | e, h[c++] = n, e) {
- case ct:
- switch (this.h) {
- case I.NONE:
- a = 0;
- break;
- case I.r:
- a = 1;
- break;
- case I.j:
- a = 2;
- break;
- default:
- t(Error("unsupported compression type"))
- }
- break;
- default:
- t(Error("invalid compression method"))
- }
- return r = a << 6 | 0, h[c++] = r | 31 - (256 * n + r) % 31, l = o(this.input), this.z.b = c, c = (h = this.z.n()).length, s && ((h = new Uint8Array(h.buffer)).length <= c + 4 && (this.a = new Uint8Array(h.length + 4), this.a.set(h), h = this.a), h = h.subarray(0, c + 4)), h[c++] = l >> 24 & 255, h[c++] = l >> 16 & 255, h[c++] = l >> 8 & 255, h[c++] = 255 & l, h
- }, r("Zlib.Deflate", B), r("Zlib.Deflate.compress", (function(t, e) {
- return new B(t, e).n()
- })), r("Zlib.Deflate.CompressionType", I), r("Zlib.Deflate.CompressionType.NONE", I.NONE), r("Zlib.Deflate.CompressionType.FIXED", I.r), r("Zlib.Deflate.CompressionType.DYNAMIC", I.j);
- var R = 0,
- O = 1,
- L = {
- D: R,
- C: O
- };
- P.prototype.p = function() {
- for (; !this.s;) {
- var n = tt(this, 3);
- switch (1 & n && (this.s = i), n >>>= 1) {
- case 0:
- var r = this.input,
- o = this.c,
- a = this.a,
- l = this.b,
- h = e,
- c = e,
- u = e,
- _ = a.length,
- f = e;
- switch (this.e = this.g = 0, (h = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (first byte)")), c = h, (h = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (second byte)")), c |= h << 8, (h = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (first byte)")), u = h, (h = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (second byte)")), c === ~(u |= h << 8) && t(Error("invalid uncompressed block header: length verify")), o + c > r.length && t(Error("input buffer is broken")), this.m) {
- case R:
- for (; l + c > a.length;) {
- if (c -= f = _ - l, s) a.set(r.subarray(o, o + f), l), l += f, o += f;
- else
- for (; f--;) a[l++] = r[o++];
- this.b = l, a = this.f(), l = this.b
- }
- break;
- case O:
- for (; l + c > a.length;) a = this.f({
- v: 2
- });
- break;
- default:
- t(Error("invalid inflate mode"))
- }
- if (s) a.set(r.subarray(o, o + c), l), l += c, o += c;
- else
- for (; c--;) a[l++] = r[o++];
- this.c = o, this.b = l, this.a = a;
- break;
- case 1:
- this.o(K, $);
- break;
- case 2:
- it(this);
- break;
- default:
- t(Error("unknown BTYPE: " + n))
- }
- }
- return this.t()
- };
- var F, N, V = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
- k = s ? new Uint16Array(V) : V,
- G = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258],
- U = s ? new Uint16Array(G) : G,
- z = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0],
- j = s ? new Uint8Array(z) : z,
- W = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577],
- H = s ? new Uint16Array(W) : W,
- X = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13],
- Y = s ? new Uint8Array(X) : X,
- q = new(s ? Uint8Array : Array)(288);
- for (F = 0, N = q.length; F < N; ++F) q[F] = 143 >= F ? 8 : 255 >= F ? 9 : 279 >= F ? 7 : 8;
- var J, Z, K = p(q),
- Q = new(s ? Uint8Array : Array)(30);
- for (J = 0, Z = Q.length; J < Z; ++J) Q[J] = 5;
- var $ = p(Q);
- function tt(i, n) {
- for (var r, s = i.g, o = i.e, a = i.input, l = i.c; o < n;)(r = a[l++]) === e && t(Error("input buffer is broken")), s |= r << o, o += 8;
- return r = s & (1 << n) - 1, i.g = s >>> n, i.e = o - n, i.c = l, r
- }
- function et(i, n) {
- for (var r, s, o, a = i.g, l = i.e, h = i.input, c = i.c, u = n[0], _ = n[1]; l < _;)(r = h[c++]) === e && t(Error("input buffer is broken")), a |= r << l, l += 8;
- return o = (s = u[a & (1 << _) - 1]) >>> 16, i.g = a >> o, i.e = l - o, i.c = c, 65535 & s
- }
- function it(t) {
- function e(t, e, i) {
- var n, r, s, o;
- for (o = 0; o < t;) switch (n = et(this, e)) {
- case 16:
- for (s = 3 + tt(this, 2); s--;) i[o++] = r;
- break;
- case 17:
- for (s = 3 + tt(this, 3); s--;) i[o++] = 0;
- r = 0;
- break;
- case 18:
- for (s = 11 + tt(this, 7); s--;) i[o++] = 0;
- r = 0;
- break;
- default:
- r = i[o++] = n
- }
- return i
- }
- var i, n, r, o, a = tt(t, 5) + 257,
- l = tt(t, 5) + 1,
- h = tt(t, 4) + 4,
- c = new(s ? Uint8Array : Array)(k.length);
- for (o = 0; o < h; ++o) c[k[o]] = tt(t, 3);
- i = p(c), n = new(s ? Uint8Array : Array)(a), r = new(s ? Uint8Array : Array)(l), t.o(p(e.call(t, a, i, n)), p(e.call(t, l, i, r)))
- }
- function nt(e, i) {
- var n, r;
- switch (this.input = e, this.c = 0, !i && (i = {}) || (i.index && (this.c = i.index), i.verify && (this.M = i.verify)), n = e[this.c++], r = e[this.c++], 15 & n) {
- case ct:
- this.method = ct;
- break;
- default:
- t(Error("unsupported compression method"))
- }
- 0 != ((n << 8) + r) % 31 && t(Error("invalid fcheck flag:" + ((n << 8) + r) % 31)), 32 & r && t(Error("fdict flag is not supported")), this.A = new P(e, {
- index: this.c,
- bufferSize: i.bufferSize,
- bufferType: i.bufferType,
- resize: i.resize
- })
- }
- P.prototype.o = function(t, e) {
- var i = this.a,
- n = this.b;
- this.u = t;
- for (var r, s, o, a, l = i.length - 258; 256 !== (r = et(this, t));)
- if (256 > r) n >= l && (this.b = n, i = this.f(), n = this.b), i[n++] = r;
- else
- for (a = U[s = r - 257], 0 < j[s] && (a += tt(this, j[s])), r = et(this, e), o = H[r], 0 < Y[r] && (o += tt(this, Y[r])), n >= l && (this.b = n, i = this.f(), n = this.b); a--;) i[n] = i[n++ - o];
- for (; 8 <= this.e;) this.e -= 8, this.c--;
- this.b = n
- }, P.prototype.I = function(t, e) {
- var i = this.a,
- n = this.b;
- this.u = t;
- for (var r, s, o, a, l = i.length; 256 !== (r = et(this, t));)
- if (256 > r) n >= l && (l = (i = this.f()).length), i[n++] = r;
- else
- for (a = U[s = r - 257], 0 < j[s] && (a += tt(this, j[s])), r = et(this, e), o = H[r], 0 < Y[r] && (o += tt(this, Y[r])), n + a > l && (l = (i = this.f()).length); a--;) i[n] = i[n++ - o];
- for (; 8 <= this.e;) this.e -= 8, this.c--;
- this.b = n
- }, P.prototype.f = function() {
- var t, e, i = new(s ? Uint8Array : Array)(this.b - 32768),
- n = this.b - 32768,
- r = this.a;
- if (s) i.set(r.subarray(32768, i.length));
- else
- for (t = 0, e = i.length; t < e; ++t) i[t] = r[t + 32768];
- if (this.k.push(i), this.q += i.length, s) r.set(r.subarray(n, n + 32768));
- else
- for (t = 0; 32768 > t; ++t) r[t] = r[n + t];
- return this.b = 32768, r
- }, P.prototype.J = function(t) {
- var e, i, n, r = this.input.length / this.c + 1 | 0,
- o = this.input,
- a = this.a;
- return t && ("number" == typeof t.v && (r = t.v), "number" == typeof t.F && (r += t.F)), 2 > r ? i = (n = (o.length - this.c) / this.u[2] / 2 * 258 | 0) < a.length ? a.length + n : a.length << 1 : i = a.length * r, s ? (e = new Uint8Array(i)).set(a) : e = a, this.a = e
- }, P.prototype.t = function() {
- var t, e, i, n, r, o = 0,
- a = this.a,
- l = this.k,
- h = new(s ? Uint8Array : Array)(this.q + (this.b - 32768));
- if (0 === l.length) return s ? this.a.subarray(32768, this.b) : this.a.slice(32768, this.b);
- for (e = 0, i = l.length; e < i; ++e)
- for (n = 0, r = (t = l[e]).length; n < r; ++n) h[o++] = t[n];
- for (e = 32768, i = this.b; e < i; ++e) h[o++] = a[e];
- return this.k = [], this.buffer = h
- }, P.prototype.H = function() {
- var t, e = this.b;
- return s ? this.B ? (t = new Uint8Array(e)).set(this.a.subarray(0, e)) : t = this.a.subarray(0, e) : (this.a.length > e && (this.a.length = e), t = this.a), this.buffer = t
- }, nt.prototype.p = function() {
- var e, i = this.input;
- return e = this.A.p(), this.c = this.A.c, this.M && ((i[this.c++] << 24 | i[this.c++] << 16 | i[this.c++] << 8 | i[this.c++]) >>> 0 !== o(e) && t(Error("invalid adler-32 checksum"))), e
- }, r("Zlib.Inflate", nt), r("Zlib.Inflate.BufferType", L), L.ADAPTIVE = L.C, L.BLOCK = L.D, r("Zlib.Inflate.prototype.decompress", nt.prototype.p);
- s && new Uint16Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
- s && new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258]);
- s && new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0]);
- s && new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]);
- s && new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]);
- var rt, st, ot = new(s ? Uint8Array : Array)(288);
- for (rt = 0, st = ot.length; rt < st; ++rt) ot[rt] = 143 >= rt ? 8 : 255 >= rt ? 9 : 279 >= rt ? 7 : 8;
- p(ot);
- var at, lt, ht = new(s ? Uint8Array : Array)(30);
- for (at = 0, lt = ht.length; at < lt; ++at) ht[at] = 5;
- p(ht);
- var ct = 8
- }).call(window);
- var n = window.Zlib;
- n.Deflate = n.Deflate, n.Deflate.compress = n.Deflate.compress, n.Inflate = n.Inflate, n.Inflate.BufferType = n.Inflate.BufferType, n.Inflate.prototype.decompress = n.Inflate.prototype.decompress, e.exports = n
- }), {}],
- 26: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n, r, s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S, w = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- E = I(t("../../renderer/enums")),
- M = t("../value-types"),
- D = t("../vmath"),
- B = I(t("../vmath/mat4"));
- function I(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function P(t, e, i, n) {
- i && Object.defineProperty(t, e, {
- enumerable: i.enumerable,
- configurable: i.configurable,
- writable: i.writable,
- value: i.initializer ? i.initializer.call(n) : void 0
- })
- }
- function R(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function O(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function L(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- function F(t, e, i, n, r) {
- var s = {};
- return Object.keys(n).forEach((function(t) {
- s[t] = n[t]
- })), s.enumerable = !!s.enumerable, s.configurable = !!s.configurable, ("value" in s || s.initializer) && (s.writable = !0), s = i.slice().reverse().reduce((function(i, n) {
- return n(t, e, i) || i
- }), s), r && void 0 !== s.initializer && (s.value = s.initializer ? s.initializer.call(r) : void 0, s.initializer = void 0), void 0 === s.initializer && (Object.defineProperty(t, e, s), s = null), s
- }
- var N = null;
- N = t("../../renderer/scene/light");
- var V = t("../renderer/index"),
- k = t("../platform/CCEnum"),
- G = t("../components/CCComponent"),
- U = t("../platform/CCClassDecorator"),
- z = U.ccclass,
- j = U.menu,
- W = U.inspector,
- H = U.property,
- X = U.executeInEditMode,
- Y = (B.default.create(), k({
- DIRECTIONAL: 0,
- POINT: 1,
- SPOT: 2,
- AMBIENT: 3
- })),
- q = k({
- NONE: 0,
- HARD: 2
- }),
- J = (n = z("cc.Light"), r = j("i18n:MAIN_MENU.component.renderers/Light"), s = W("packages://inspector/inspectors/comps/light.js"), o = H({
- type: Y
- }), a = H({
- type: q
- }), n(l = r(l = X(l = s((S = T = (function(t) {
- function e() {
- R(this, e);
- var i = O(this, t.call(this));
- return P(i, "_type", c, i), P(i, "_color", u, i), P(i, "_intensity", _, i), P(i, "_range", f, i), P(i, "_spotAngle", d, i), P(i, "_spotExp", p, i), P(i, "_shadowType", m, i), P(i, "_shadowResolution", y, i), P(i, "_shadowDarkness", v, i), P(i, "_shadowMinDepth", g, i), P(i, "_shadowMaxDepth", x, i), P(i, "_shadowDepthScale", b, i), P(i, "_shadowFrustumSize", A, i), P(i, "_shadowBias", C, i), i._light = new N, i
- }
- return L(e, t), w(e, [{
- key: "type",
- get: function() {
- return this._type
- },
- set: function(t) {
- this._type = t;
- var e = E.default.LIGHT_DIRECTIONAL;
- t === Y.POINT ? e = E.default.LIGHT_POINT : t === Y.SPOT ? e = E.default.LIGHT_SPOT : t === Y.AMBIENT && (e = E.default.LIGHT_AMBIENT), this._light.setType(e)
- }
- }, {
- key: "color",
- get: function() {
- return this._color
- },
- set: function(t) {
- this._color = t, this._light.setColor(t.r / 255, t.g / 255, t.b / 255)
- }
- }, {
- key: "intensity",
- get: function() {
- return this._intensity
- },
- set: function(t) {
- this._intensity = t, this._light.setIntensity(t)
- }
- }, {
- key: "range",
- get: function() {
- return this._range
- },
- set: function(t) {
- this._range = t, this._light.setRange(t)
- }
- }, {
- key: "spotAngle",
- get: function() {
- return this._spotAngle
- },
- set: function(t) {
- this._spotAngle = t, this._light.setSpotAngle((0, D.toRadian)(t))
- }
- }, {
- key: "spotExp",
- get: function() {
- return this._spotExp
- },
- set: function(t) {
- this._spotExp = t, this._light.setSpotExp(t)
- }
- }, {
- key: "shadowType",
- get: function() {
- return this._shadowType
- },
- set: function(t) {
- this._shadowType = t;
- var e = E.default.SHADOW_NONE;
- t === q.HARD ? e = E.default.SHADOW_HARD : t === q.SOFT && (e = E.default.SHADOW_SOFT), this._light.setShadowType(e)
- }
- }, {
- key: "shadowResolution",
- get: function() {
- return this._shadowResolution
- },
- set: function(t) {
- this._shadowResolution = t, this._light.setShadowResolution(t)
- }
- }, {
- key: "shadowDarkness",
- get: function() {
- return this._shadowDarkness
- },
- set: function(t) {
- this._shadowDarkness = t, this._light.setShadowDarkness(t)
- }
- }, {
- key: "shadowMinDepth",
- get: function() {
- return this._shadowMinDepth
- },
- set: function(t) {
- this._shadowMinDepth = t, this._light.setShadowMinDepth(t)
- }
- }, {
- key: "shadowMaxDepth",
- get: function() {
- return this._shadowMaxDepth
- },
- set: function(t) {
- this._shadowMaxDepth = t, this._light.setShadowMaxDepth(t)
- }
- }, {
- key: "shadowDepthScale",
- get: function() {
- return this._shadowDepthScale
- },
- set: function(t) {
- this._shadowDepthScale = t, this._light.setShadowDepthScale(t)
- }
- }, {
- key: "shadowFrustumSize",
- get: function() {
- return this._shadowFrustumSize
- },
- set: function(t) {
- this._shadowFrustumSize = t, this._light.setShadowFrustumSize(t)
- }
- }]), e.prototype.onLoad = function() {
- this._light.setNode(this.node), this.type = this._type, this.color = this._color, this.intensity = this._intensity, this.range = this._range, this.spotAngle = this._spotAngle, this.spotExp = this._spotExp, this.shadowType = this._shadowType, this.shadowResolution = this._shadowResolution, this.shadowDarkness = this._shadowDarkness, this.shadowMaxDepth = this._shadowMaxDepth, this.shadowDepthScale = this._shadowDepthScale, this.shadowFrustumSize = this._shadowFrustumSize, this.shadowBias = this._shadowBias
- }, e.prototype.onEnable = function() {
- V.scene.addLight(this._light)
- }, e.prototype.onDisable = function() {
- V.scene.removeLight(this._light)
- }, e
- })(G), T.Type = Y, T.ShadowType = q, c = F((h = S).prototype, "_type", [H], {
- enumerable: !0,
- initializer: function() {
- return Y.DIRECTIONAL
- }
- }), u = F(h.prototype, "_color", [H], {
- enumerable: !0,
- initializer: function() {
- return M.Color.WHITE
- }
- }), _ = F(h.prototype, "_intensity", [H], {
- enumerable: !0,
- initializer: function() {
- return 1
- }
- }), f = F(h.prototype, "_range", [H], {
- enumerable: !0,
- initializer: function() {
- return 1e3
- }
- }), d = F(h.prototype, "_spotAngle", [H], {
- enumerable: !0,
- initializer: function() {
- return 60
- }
- }), p = F(h.prototype, "_spotExp", [H], {
- enumerable: !0,
- initializer: function() {
- return 1
- }
- }), m = F(h.prototype, "_shadowType", [H], {
- enumerable: !0,
- initializer: function() {
- return q.NONE
- }
- }), y = F(h.prototype, "_shadowResolution", [H], {
- enumerable: !0,
- initializer: function() {
- return 1024
- }
- }), v = F(h.prototype, "_shadowDarkness", [H], {
- enumerable: !0,
- initializer: function() {
- return .5
- }
- }), g = F(h.prototype, "_shadowMinDepth", [H], {
- enumerable: !0,
- initializer: function() {
- return 1
- }
- }), x = F(h.prototype, "_shadowMaxDepth", [H], {
- enumerable: !0,
- initializer: function() {
- return 4096
- }
- }), b = F(h.prototype, "_shadowDepthScale", [H], {
- enumerable: !0,
- initializer: function() {
- return 250
- }
- }), A = F(h.prototype, "_shadowFrustumSize", [H], {
- enumerable: !0,
- initializer: function() {
- return 1024
- }
- }), C = F(h.prototype, "_shadowBias", [H], {
- enumerable: !0,
- initializer: function() {
- return 5e-4
- }
- }), F(h.prototype, "type", [o], Object.getOwnPropertyDescriptor(h.prototype, "type"), h.prototype), F(h.prototype, "color", [H], Object.getOwnPropertyDescriptor(h.prototype, "color"), h.prototype), F(h.prototype, "intensity", [H], Object.getOwnPropertyDescriptor(h.prototype, "intensity"), h.prototype), F(h.prototype, "range", [H], Object.getOwnPropertyDescriptor(h.prototype, "range"), h.prototype), F(h.prototype, "spotAngle", [H], Object.getOwnPropertyDescriptor(h.prototype, "spotAngle"), h.prototype), F(h.prototype, "spotExp", [H], Object.getOwnPropertyDescriptor(h.prototype, "spotExp"), h.prototype), F(h.prototype, "shadowType", [a], Object.getOwnPropertyDescriptor(h.prototype, "shadowType"), h.prototype), F(h.prototype, "shadowResolution", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowResolution"), h.prototype), F(h.prototype, "shadowDarkness", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowDarkness"), h.prototype), F(h.prototype, "shadowMinDepth", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowMinDepth"), h.prototype), F(h.prototype, "shadowMaxDepth", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowMaxDepth"), h.prototype), F(h.prototype, "shadowDepthScale", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowDepthScale"), h.prototype), F(h.prototype, "shadowFrustumSize", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowFrustumSize"), h.prototype), l = h)) || l) || l) || l) || l);
- i.default = J, cc.Light = J, e.exports = i.default
- }), {
- "../../renderer/enums": 355,
- "../../renderer/scene/light": 381,
- "../components/CCComponent": 95,
- "../platform/CCClassDecorator": 199,
- "../platform/CCEnum": 200,
- "../renderer/index": 247,
- "../value-types": 315,
- "../vmath": 326,
- "../vmath/mat4": 330
- }],
- 27: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Model",
- extends: cc.Asset,
- ctor: function() {
- this._rootNode = null
- },
- properties: {
- _nodes: {
- default: []
- },
- _precomputeJointMatrix: !1,
- nodes: {
- get: function() {
- return this._nodes
- }
- },
- rootNode: {
- get: function() {
- return this._rootNode
- }
- },
- precomputeJointMatrix: {
- get: function() {
- return this._precomputeJointMatrix
- }
- }
- },
- onLoad: function() {
- var t = this._nodes;
- this._rootNode = t[0];
- for (var e = 0; e < t.length; e++) {
- var i = t[e];
- i.position = cc.v3.apply(this, i.position), i.scale = cc.v3.apply(this, i.scale), i.quat = cc.quat.apply(this, i.quat), i.uniqueBindPose && (i.uniqueBindPose = cc.mat4.apply(this, i.uniqueBindPose));
- var n = i.bindpose;
- if (n)
- for (var r in n) n[r] = cc.mat4.apply(this, n[r]);
- var s = i.children;
- if (s)
- for (var o = 0; o < s.length; o++) s[o] = t[s[o]]
- }
- }
- });
- cc.Model = e.exports = n
- }), {}],
- 28: [(function(t, e, i) {
- "use strict";
- var n = cc.vmath.quat,
- r = cc.quat(),
- s = cc.v3();
- cc.Rotate3DTo = cc.Class({
- name: "cc.Rotate3DTo",
- extends: cc.ActionInterval,
- ctor: function(t, e, i, n) {
- this._startQuat = cc.quat(), this._dstQuat = cc.quat(), void 0 !== e && this.initWithDuration(t, e, i, n)
- },
- initWithDuration: function(t, e, i, n) {
- if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
- var r = this._dstQuat;
- return e instanceof cc.Quat ? r.set(e) : (e instanceof cc.Vec3 ? (i = e.y, n = e.z, e = e.x) : (i = i || 0, n = n || 0), cc.vmath.quat.fromEuler(r, e, i, n)), !0
- }
- return !1
- },
- clone: function() {
- var t = new cc.Rotate3DTo;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._dstQuat), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startQuat.set(t.quat)
- },
- reverse: function() {
- cc.logID(1016)
- },
- update: function(t) {
- t = this._computeEaseTime(t), this.target && (n.slerp(r, this._startQuat, this._dstQuat, t), this.target.setRotation(r))
- }
- }), cc.rotate3DTo = function(t, e, i, n) {
- return new cc.Rotate3DTo(t, e, i, n)
- }, cc.Rotate3DBy = cc.Class({
- name: "cc.Rotate3DBy",
- extends: cc.ActionInterval,
- ctor: function(t, e, i, n) {
- this._angle = cc.v3(), this._quat = cc.quat(), this._lastDt = 0, void 0 !== e && this.initWithDuration(t, e, i, n)
- },
- initWithDuration: function(t, e, i, n) {
- return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (e instanceof cc.Vec3 ? (i = e.y, n = e.z, e = e.x) : (i = i || 0, n = n || 0), cc.vmath.vec3.set(this._angle, e, i, n), !0)
- },
- clone: function() {
- var t = new cc.Rotate3DBy;
- return this._cloneDecoration(t), t.initWithDuration(this._duration, this._angle), t
- },
- startWithTarget: function(t) {
- cc.ActionInterval.prototype.startWithTarget.call(this, t), this._quat.set(t.quat), this._lastDt = 0
- },
- update: (function() {
- var t = Math.PI / 180;
- return function(e) {
- if (e = this._computeEaseTime(e), this.target) {
- var i = this._angle,
- r = this._quat,
- s = e - this._lastDt,
- o = i.x,
- a = i.y,
- l = i.z;
- o && n.rotateX(r, r, o * t * s), a && n.rotateY(r, r, a * t * s), l && n.rotateZ(r, r, l * t * s), this.target.setRotation(r), this._lastDt = e
- }
- }
- })(),
- reverse: function() {
- var t = this._angle;
- s.x = -t.x, s.y = -t.y, s.z = -t.z;
- var e = new cc.Rotate3DBy(this._duration, s);
- return this._cloneDecoration(e), this._reverseEaseList(e), e
- }
- }), cc.rotate3DBy = function(t, e, i, n) {
- return new cc.Rotate3DBy(t, e, i, n)
- }
- }), {}],
- 29: [(function(t, e, i) {
- "use strict";
- t("./polyfill-3d"), t("./primitive"), t("./CCModel"), t("./skeleton/CCSkeleton"), t("./skeleton/CCSkeletonAnimationClip"), t("./actions"), t("./skeleton/CCSkeletonAnimation"), t("./skeleton/CCSkinnedMeshRenderer"), t("./skeleton/skinned-mesh-renderer"), t("./CCLightComponent")
- }), {
- "./CCLightComponent": 26,
- "./CCModel": 27,
- "./actions": 28,
- "./polyfill-3d": 30,
- "./primitive": 35,
- "./skeleton/CCSkeleton": 44,
- "./skeleton/CCSkeletonAnimation": 45,
- "./skeleton/CCSkeletonAnimationClip": 46,
- "./skeleton/CCSkinnedMeshRenderer": 47,
- "./skeleton/skinned-mesh-renderer": 48
- }],
- 30: [(function(t, e, i) {
- "use strict";
- var n = t("../vmath"),
- r = t("../CCNode"),
- s = r.EventType,
- o = r._LocalDirtyFlag,
- a = t("../renderer/render-flow"),
- l = Math.PI / 180,
- h = 1,
- c = 2;
- function u() {
- if (this._localMatDirty) {
- var t = this._matrix,
- e = t.m;
- if (n.mat4.fromTRSArray(t, this._trs), this._skewX || this._skewY) {
- var i = e[0],
- r = e[1],
- s = e[4],
- o = e[5],
- a = Math.tan(this._skewX * l),
- h = Math.tan(this._skewY * l);
- a === 1 / 0 && (a = 99999999), h === 1 / 0 && (h = 99999999), e[0] = i + s * h, e[1] = r + o * h, e[4] = s + i * a, e[5] = o + r * a
- }
- this._localMatDirty = 0, this._worldMatDirty = !0
- }
- }
- function _() {
- if (this._localMatDirty && this._updateLocalMatrix(), this._parent) {
- var t = this._parent._worldMatrix;
- n.mat4.mul(this._worldMatrix, t, this._matrix)
- } else n.mat4.copy(this._worldMatrix, this._matrix);
- this._worldMatDirty = !1
- }
- function f(t, e, i) {
- var n = void 0;
- void 0 === e ? (n = t.x, e = t.y, i = t.z || 0) : (n = t, i = i || 0);
- var r = this._trs;
- r[0] === n && r[1] === e && r[2] === i || (r[0] = n, r[1] = e, r[2] = i, this.setLocalDirty(o.POSITION), this._renderFlag |= a.FLAG_WORLD_TRANSFORM, this._eventMask & h && this.emit(s.POSITION_CHANGED))
- }
- var d = cc.Node.prototype,
- p = d._updateLocalMatrix,
- m = d._calculWorldMatrix,
- y = d._upgrade_1x_to_2x,
- v = d._mulMat;
- d.setPosition = f, d.setScale = function(t, e, i) {
- t && "number" != typeof t ? (e = t.y, i = void 0 === t.z ? 1 : t.z, t = t.x) : void 0 !== t && void 0 === e ? (e = t, i = t) : void 0 === i && (i = 1);
- var n = this._trs;
- n[7] === t && n[8] === e && n[9] === i || (n[7] = t, n[8] = e, n[9] = i, this.setLocalDirty(o.SCALE), this._renderFlag |= a.FLAG_TRANSFORM, this._eventMask & c && this.emit(s.SCALE_CHANGED))
- }, d._upgrade_1x_to_2x = function() {
- this._is3DNode && this._update3DFunction(), y.call(this)
- }, d._update3DFunction = function() {
- this._is3DNode ? (this._updateLocalMatrix = u, this._calculWorldMatrix = _, this._mulMat = n.mat4.mul) : (this._updateLocalMatrix = p, this._calculWorldMatrix = m, this._mulMat = v), this._renderComponent && this._renderComponent._on3DNodeChanged && this._renderComponent._on3DNodeChanged(), this._renderFlag |= a.FLAG_TRANSFORM, this._localMatDirty = o.ALL
- }, cc.js.getset(d, "position", d.getPosition, f, !1, !0), cc.js.getset(d, "is3DNode", (function() {
- return this._is3DNode
- }), (function(t) {
- this._is3DNode = t, this._update3DFunction()
- })), cc.js.getset(d, "scaleZ", (function() {
- return this._trs[9]
- }), (function(t) {
- this._trs[9] !== t && (this._trs[9] = t, this.setLocalDirty(o.SCALE), this._renderFlag |= a.FLAG_TRANSFORM, this._eventMask & c && this.emit(s.SCALE_CHANGED))
- })), cc.js.getset(d, "z", (function() {
- return this._trs[2]
- }), (function(t) {
- var e = this._trs;
- t !== e[2] && (e[2] = t, this.setLocalDirty(o.POSITION), this._renderFlag |= a.FLAG_WORLD_TRANSFORM, this._eventMask & h && this.emit(s.POSITION_CHANGED))
- })), cc.js.getset(d, "eulerAngles", (function() {
- return n.trs.toEuler(this._eulerAngles, this._trs)
- }), (function(t) {
- n.trs.fromEuler(this._trs, t), this.setLocalDirty(o.ROTATION), this._renderFlag |= a.FLAG_TRANSFORM
- })), cc.js.getset(d, "quat", (function() {
- var t = this._trs;
- return cc.quat(t[3], t[4], t[5], t[6])
- }), d.setRotation)
- }), {
- "../CCNode": 52,
- "../renderer/render-flow": 248,
- "../vmath": 326
- }],
- 31: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1,
- y = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
- v = void 0 !== y.widthSegments ? y.widthSegments : 1,
- g = void 0 !== y.heightSegments ? y.heightSegments : 1,
- x = void 0 !== y.lengthSegments ? y.lengthSegments : 1,
- b = void 0 !== y.invWinding && y.invWinding,
- A = .5 * t,
- C = .5 * e,
- T = .5 * i,
- S = [n.vec3.set(h, -A, -C, T), n.vec3.set(c, A, -C, T), n.vec3.set(u, A, C, T), n.vec3.set(_, -A, C, T), n.vec3.set(f, A, -C, -T), n.vec3.set(d, -A, -C, -T), n.vec3.set(p, -A, C, -T), n.vec3.set(m, A, C, -T)],
- w = [
- [2, 3, 1],
- [4, 5, 7],
- [7, 6, 2],
- [1, 0, 4],
- [1, 4, 2],
- [5, 0, 6]
- ],
- E = [
- [0, 0, 1],
- [0, 0, -1],
- [0, 1, 0],
- [0, -1, 0],
- [1, 0, 0],
- [-1, 0, 0]
- ],
- M = [],
- D = [],
- B = [],
- I = [],
- P = n.vec3.create(-A, -C, -T),
- R = n.vec3.create(A, C, T),
- O = Math.sqrt(A * A + C * C + T * T);
- function L(t, e, i) {
- var r = void 0,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = M.length / 3,
- f = w[t],
- d = E[t];
- for (u = 0; u <= i; u++)
- for (c = 0; c <= e; c++)
- if (r = c / e, h = u / i, n.vec3.lerp(s, S[f[0]], S[f[1]], r), n.vec3.lerp(o, S[f[0]], S[f[2]], h), n.vec3.sub(a, o, S[f[0]]), n.vec3.add(l, s, a), M.push(l.x, l.y, l.z), D.push(d[0], d[1], d[2]), B.push(r, h), c < e && u < i) {
- var p = e + 1,
- m = c + u * p,
- y = c + (u + 1) * p,
- v = c + 1 + (u + 1) * p,
- g = c + 1 + u * p;
- b ? (I.push(_ + m, _ + y, _ + g), I.push(_ + g, _ + y, _ + v)) : (I.push(_ + m, _ + g, _ + y), I.push(_ + y, _ + g, _ + v))
- }
- }
- return L(0, v, g), L(4, x, g), L(1, v, g), L(5, x, g), L(3, v, x), L(2, v, x), new r.default(M, D, B, I, P, R, O)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- var s = n.vec3.create(0, 0, 0),
- o = n.vec3.create(0, 0, 0),
- a = n.vec3.create(0, 0, 0),
- l = n.vec3.create(0, 0, 0),
- h = n.vec3.create(0, 0, 0),
- c = n.vec3.create(0, 0, 0),
- u = n.vec3.create(0, 0, 0),
- _ = n.vec3.create(0, 0, 0),
- f = n.vec3.create(0, 0, 0),
- d = n.vec3.create(0, 0, 0),
- p = n.vec3.create(0, 0, 0),
- m = n.vec3.create(0, 0, 0);
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 32: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .5,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2,
- a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
- l = i - t - e,
- h = a.sides || 32,
- c = a.heightSegments || 32,
- u = e / i,
- _ = l / i,
- f = t / i,
- d = Math.floor(c * u),
- p = Math.floor(c * f),
- m = Math.floor(c * _),
- y = l + e - i / 2,
- v = e - i / 2,
- g = e - i / 2,
- x = a.arc || 2 * Math.PI,
- b = [],
- A = [],
- C = [],
- T = [],
- S = Math.max(t, e),
- w = n.vec3.create(-S, -i / 2, -S),
- E = n.vec3.create(S, i / 2, S),
- M = i / 2,
- D = 0,
- B = [];
- return (function() {
- for (var t = 0; t <= d; ++t)
- for (var i = t * Math.PI / d / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= h; ++s) {
- var o = 2 * s * Math.PI / h - Math.PI / 2,
- a = Math.sin(o),
- l = Math.cos(o),
- u = a * n,
- _ = r,
- f = l * n,
- p = s / h,
- m = t / c;
- if (b.push(u * e, _ * e + g, f * e), A.push(u, _, f), C.push(p, m), t < d && s < h) {
- var y = h + 1,
- v = y * t + s,
- x = y * (t + 1) + s,
- S = y * (t + 1) + s + 1,
- w = y * t + s + 1;
- T.push(v, w, x), T.push(w, S, x)
- }++D
- }
- })(), (function() {
- for (var i = (t - e) / l, r = 0; r <= m; r++) {
- for (var a = [], c = r / m, f = c * (t - e) + e, d = 0; d <= h; ++d) {
- var p = d / h,
- y = c * _ + u,
- g = p * x - x / 4,
- S = Math.sin(g),
- w = Math.cos(g);
- b.push(f * S), b.push(c * l + v), b.push(f * w), n.vec3.normalize(s, n.vec3.set(o, S, -i, w)), A.push(s.x), A.push(s.y), A.push(s.z), C.push(p, y), a.push(D), ++D
- }
- B.push(a)
- }
- for (var E = 0; E < m; ++E)
- for (var M = 0; M < h; ++M) {
- var I = B[E][M],
- P = B[E + 1][M],
- R = B[E + 1][M + 1],
- O = B[E][M + 1];
- T.push(I), T.push(O), T.push(P), T.push(O), T.push(R), T.push(P)
- }
- })(), (function() {
- for (var e = 0; e <= p; ++e)
- for (var i = e * Math.PI / p / 2 + Math.PI / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= h; ++s) {
- var o = 2 * s * Math.PI / h - Math.PI / 2,
- a = Math.sin(o),
- l = Math.cos(o),
- u = a * n,
- _ = r,
- d = l * n,
- v = s / h,
- g = e / c + (1 - f);
- if (b.push(u * t, _ * t + y, d * t), A.push(u, _, d), C.push(v, g), e < p && s < h) {
- var x = h + 1,
- S = x * e + s + B[m][h] + 1,
- w = x * (e + 1) + s + B[m][h] + 1,
- E = x * (e + 1) + s + 1 + B[m][h] + 1,
- M = x * e + s + 1 + B[m][h] + 1;
- T.push(S, M, w), T.push(M, E, w)
- }
- }
- })(), new r.default(b, A, C, T, w, E, M)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- var s = n.vec3.create(0, 0, 0),
- o = n.vec3.create(0, 0, 0);
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 33: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
- return (0, n.default)(0, t, e, i)
- };
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./cylinder"));
- e.exports = i.default
- }), {
- "./cylinder": 34
- }],
- 34: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .5,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2,
- a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
- l = .5 * i,
- h = a.radialSegments || 32,
- c = a.heightSegments || 1,
- u = void 0 === a.capped || a.capped,
- _ = a.arc || 2 * Math.PI,
- f = 0;
- u || (t > 0 && f++, e > 0 && f++);
- var d = (h + 1) * (c + 1);
- u && (d += (h + 1) * f + h * f);
- var p = h * c * 2 * 3;
- u && (p += h * f * 3);
- var m = new Array(p),
- y = new Array(3 * d),
- v = new Array(3 * d),
- g = new Array(2 * d),
- x = Math.max(t, e),
- b = n.vec3.create(-x, -l, -x),
- A = n.vec3.create(x, l, x),
- C = Math.sqrt(x * x + l * l),
- T = 0,
- S = 0;
- return (function() {
- for (var r = [], a = t - e, u = a * a / i * Math.sign(a), f = 0; f <= c; f++) {
- for (var d = [], p = f / c, x = p * a + e, b = 0; b <= h; ++b) {
- var A = b / h,
- C = A * _,
- w = Math.sin(C),
- E = Math.cos(C);
- y[3 * T] = x * w, y[3 * T + 1] = p * i - l, y[3 * T + 2] = x * E, n.vec3.normalize(s, n.vec3.set(o, w, -u, E)), v[3 * T] = s.x, v[3 * T + 1] = s.y, v[3 * T + 2] = s.z, g[2 * T] = 2 * (1 - A) % 1, g[2 * T + 1] = p, d.push(T), ++T
- }
- r.push(d)
- }
- for (var M = 0; M < c; ++M)
- for (var D = 0; D < h; ++D) {
- var B = r[M][D],
- I = r[M + 1][D],
- P = r[M + 1][D + 1],
- R = r[M][D + 1];
- m[S] = B, m[++S] = R, m[++S] = I, m[++S] = R, m[++S] = P, m[++S] = I, ++S
- }
- })(), u && (e > 0 && w(!1), t > 0 && w(!0)), new r.default(y, v, g, m, b, A, C);
- function w(i) {
- var n, r, s = i ? t : e,
- o = i ? 1 : -1;
- n = T;
- for (var a = 1; a <= h; ++a) y[3 * T] = 0, y[3 * T + 1] = l * o, y[3 * T + 2] = 0, v[3 * T] = 0, v[3 * T + 1] = o, v[3 * T + 2] = 0, g[2 * T] = .5, g[2 * T + 1] = .5, ++T;
- r = T;
- for (var c = 0; c <= h; ++c) {
- var u = c / h * _,
- f = Math.cos(u),
- d = Math.sin(u);
- y[3 * T] = s * d, y[3 * T + 1] = l * o, y[3 * T + 2] = s * f, v[3 * T] = 0, v[3 * T + 1] = o, v[3 * T + 2] = 0, g[2 * T] = .5 - .5 * d * o, g[2 * T + 1] = .5 + .5 * f, ++T
- }
- for (var p = 0; p < h; ++p) {
- var x = n + p,
- b = r + p;
- i ? (m[S] = b + 1, m[++S] = x, m[++S] = b, ++S) : (m[S] = x, m[++S] = b + 1, m[++S] = b, ++S)
- }
- }
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- var s = n.vec3.create(0, 0, 0),
- o = n.vec3.create(0, 0, 0);
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 35: [(function(t, e, i) {
- "use strict";
- var n = d(t("./utils")),
- r = d(t("./box")),
- s = d(t("./cone")),
- o = d(t("./cylinder")),
- a = d(t("./plane")),
- l = d(t("./quad")),
- h = d(t("./sphere")),
- c = d(t("./torus")),
- u = d(t("./capsule")),
- _ = t("./polyhedron"),
- f = d(t("./vertex-data"));
- function d(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- cc.primitive = Object.assign({
- box: r.default,
- cone: s.default,
- cylinder: o.default,
- plane: a.default,
- quad: l.default,
- sphere: h.default,
- torus: c.default,
- capsule: u.default,
- polyhedron: _.polyhedron,
- PolyhedronType: _.PolyhedronType,
- VertexData: f.default
- }, n.default)
- }), {
- "./box": 31,
- "./capsule": 32,
- "./cone": 33,
- "./cylinder": 34,
- "./plane": 36,
- "./polyhedron": 37,
- "./quad": 38,
- "./sphere": 39,
- "./torus": 40,
- "./utils": 41,
- "./vertex-data": 42
- }],
- 36: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
- _ = void 0 !== i.widthSegments ? i.widthSegments : 10,
- f = void 0 !== i.lengthSegments ? i.lengthSegments : 10,
- d = .5 * t,
- p = .5 * e,
- m = [],
- y = [],
- v = [],
- g = [],
- x = n.vec3.create(-d, 0, -p),
- b = n.vec3.create(d, 0, p),
- A = Math.sqrt(t * t + e * e);
- n.vec3.set(h, -d, 0, p), n.vec3.set(c, d, 0, p), n.vec3.set(u, -d, 0, -p);
- for (var C = 0; C <= f; C++)
- for (var T = 0; T <= _; T++) {
- var S = T / _,
- w = C / f;
- if (n.vec3.lerp(s, h, c, S), n.vec3.lerp(o, h, u, w), n.vec3.sub(a, o, h), n.vec3.add(l, s, a), m.push(l.x, l.y, l.z), y.push(0, 1, 0), v.push(S, w), T < _ && C < f) {
- var E = _ + 1,
- M = T + C * E,
- D = T + (C + 1) * E,
- B = T + 1 + (C + 1) * E,
- I = T + 1 + C * E;
- g.push(M, I, D), g.push(I, B, D)
- }
- }
- return new r.default(m, y, v, g, x, b, A)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- var s = n.vec3.create(0, 0, 0),
- o = n.vec3.create(0, 0, 0),
- a = n.vec3.create(0, 0, 0),
- l = n.vec3.create(0, 0, 0),
- h = n.vec3.create(0, 0, 0),
- c = n.vec3.create(0, 0, 0),
- u = n.vec3.create(0, 0, 0);
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 37: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.polyhedron = i.PolyhedronType = void 0;
- var n = t("./utils"),
- r = t("../../vmath"),
- s = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- i.PolyhedronType = cc.Enum({
- Tetrahedron: 0,
- Octahedron: 1,
- Dodecahedron: 2,
- Icosahedron: 3,
- Rhombicuboctahedron: 4,
- TriangularPrism: 5,
- PentagonalPrism: 6,
- HexagonalPrism: 7,
- SquarePyramid: 8,
- PentagonalPyramid: 9,
- TriangularDipyramid: 10,
- PentagonalDipyramid: 11,
- ElongatedSquareDipyramid: 12,
- ElongatedPentagonalDipyramid: 13,
- ElongatedPentagonalCupola: 14
- });
- var o = [];
- o[0] = {
- vertex: [
- [0, 0, 1.732051],
- [1.632993, 0, -.5773503],
- [-.8164966, 1.414214, -.5773503],
- [-.8164966, -1.414214, -.5773503]
- ],
- face: [
- [0, 1, 2],
- [0, 2, 3],
- [0, 3, 1],
- [1, 3, 2]
- ]
- }, o[1] = {
- vertex: [
- [0, 0, 1.414214],
- [1.414214, 0, 0],
- [0, 1.414214, 0],
- [-1.414214, 0, 0],
- [0, -1.414214, 0],
- [0, 0, -1.414214]
- ],
- face: [
- [0, 1, 2],
- [0, 2, 3],
- [0, 3, 4],
- [0, 4, 1],
- [1, 4, 5],
- [1, 5, 2],
- [2, 5, 3],
- [3, 5, 4]
- ]
- }, o[2] = {
- vertex: [
- [0, 0, 1.070466],
- [.7136442, 0, .7978784],
- [-.3568221, .618034, .7978784],
- [-.3568221, -.618034, .7978784],
- [.7978784, .618034, .3568221],
- [.7978784, -.618034, .3568221],
- [-.9341724, .381966, .3568221],
- [.1362939, 1, .3568221],
- [.1362939, -1, .3568221],
- [-.9341724, -.381966, .3568221],
- [.9341724, .381966, -.3568221],
- [.9341724, -.381966, -.3568221],
- [-.7978784, .618034, -.3568221],
- [-.1362939, 1, -.3568221],
- [-.1362939, -1, -.3568221],
- [-.7978784, -.618034, -.3568221],
- [.3568221, .618034, -.7978784],
- [.3568221, -.618034, -.7978784],
- [-.7136442, 0, -.7978784],
- [0, 0, -1.070466]
- ],
- face: [
- [0, 1, 4, 7, 2],
- [0, 2, 6, 9, 3],
- [0, 3, 8, 5, 1],
- [1, 5, 11, 10, 4],
- [2, 7, 13, 12, 6],
- [3, 9, 15, 14, 8],
- [4, 10, 16, 13, 7],
- [5, 8, 14, 17, 11],
- [6, 12, 18, 15, 9],
- [10, 11, 17, 19, 16],
- [12, 13, 16, 19, 18],
- [14, 15, 18, 19, 17]
- ]
- }, o[3] = {
- vertex: [
- [0, 0, 1.175571],
- [1.051462, 0, .5257311],
- [.3249197, 1, .5257311],
- [-.8506508, .618034, .5257311],
- [-.8506508, -.618034, .5257311],
- [.3249197, -1, .5257311],
- [.8506508, .618034, -.5257311],
- [.8506508, -.618034, -.5257311],
- [-.3249197, 1, -.5257311],
- [-1.051462, 0, -.5257311],
- [-.3249197, -1, -.5257311],
- [0, 0, -1.175571]
- ],
- face: [
- [0, 1, 2],
- [0, 2, 3],
- [0, 3, 4],
- [0, 4, 5],
- [0, 5, 1],
- [1, 5, 7],
- [1, 7, 6],
- [1, 6, 2],
- [2, 6, 8],
- [2, 8, 3],
- [3, 8, 9],
- [3, 9, 4],
- [4, 9, 10],
- [4, 10, 5],
- [5, 10, 7],
- [6, 7, 11],
- [6, 11, 8],
- [7, 10, 11],
- [8, 11, 9],
- [9, 11, 10]
- ]
- }, o[4] = {
- vertex: [
- [0, 0, 1.070722],
- [.7148135, 0, .7971752],
- [-.104682, .7071068, .7971752],
- [-.6841528, .2071068, .7971752],
- [-.104682, -.7071068, .7971752],
- [.6101315, .7071068, .5236279],
- [1.04156, .2071068, .1367736],
- [.6101315, -.7071068, .5236279],
- [-.3574067, 1, .1367736],
- [-.7888348, -.5, .5236279],
- [-.9368776, .5, .1367736],
- [-.3574067, -1, .1367736],
- [.3574067, 1, -.1367736],
- [.9368776, -.5, -.1367736],
- [.7888348, .5, -.5236279],
- [.3574067, -1, -.1367736],
- [-.6101315, .7071068, -.5236279],
- [-1.04156, -.2071068, -.1367736],
- [-.6101315, -.7071068, -.5236279],
- [.104682, .7071068, -.7971752],
- [.6841528, -.2071068, -.7971752],
- [.104682, -.7071068, -.7971752],
- [-.7148135, 0, -.7971752],
- [0, 0, -1.070722]
- ],
- face: [
- [0, 2, 3],
- [1, 6, 5],
- [4, 9, 11],
- [7, 15, 13],
- [8, 16, 10],
- [12, 14, 19],
- [17, 22, 18],
- [20, 21, 23],
- [0, 1, 5, 2],
- [0, 3, 9, 4],
- [0, 4, 7, 1],
- [1, 7, 13, 6],
- [2, 5, 12, 8],
- [2, 8, 10, 3],
- [3, 10, 17, 9],
- [4, 11, 15, 7],
- [5, 6, 14, 12],
- [6, 13, 20, 14],
- [8, 12, 19, 16],
- [9, 17, 18, 11],
- [10, 16, 22, 17],
- [11, 18, 21, 15],
- [13, 15, 21, 20],
- [14, 20, 23, 19],
- [16, 19, 23, 22],
- [18, 22, 23, 21]
- ]
- }, o[5] = {
- vertex: [
- [0, 0, 1.322876],
- [1.309307, 0, .1889822],
- [-.9819805, .8660254, .1889822],
- [.1636634, -1.299038, .1889822],
- [.3273268, .8660254, -.9449112],
- [-.8183171, -.4330127, -.9449112]
- ],
- face: [
- [0, 3, 1],
- [2, 4, 5],
- [0, 1, 4, 2],
- [0, 2, 5, 3],
- [1, 3, 5, 4]
- ]
- }, o[6] = {
- vertex: [
- [0, 0, 1.159953],
- [1.013464, 0, .5642542],
- [-.3501431, .9510565, .5642542],
- [-.7715208, -.6571639, .5642542],
- [.6633206, .9510565, -.03144481],
- [.8682979, -.6571639, -.3996071],
- [-1.121664, .2938926, -.03144481],
- [-.2348831, -1.063314, -.3996071],
- [.5181548, .2938926, -.9953061],
- [-.5850262, -.112257, -.9953061]
- ],
- face: [
- [0, 1, 4, 2],
- [0, 2, 6, 3],
- [1, 5, 8, 4],
- [3, 6, 9, 7],
- [5, 7, 9, 8],
- [0, 3, 7, 5, 1],
- [2, 4, 8, 9, 6]
- ]
- }, o[7] = {
- vertex: [
- [0, 0, 1.118034],
- [.8944272, 0, .6708204],
- [-.2236068, .8660254, .6708204],
- [-.7826238, -.4330127, .6708204],
- [.6708204, .8660254, .2236068],
- [1.006231, -.4330127, -.2236068],
- [-1.006231, .4330127, .2236068],
- [-.6708204, -.8660254, -.2236068],
- [.7826238, .4330127, -.6708204],
- [.2236068, -.8660254, -.6708204],
- [-.8944272, 0, -.6708204],
- [0, 0, -1.118034]
- ],
- face: [
- [0, 1, 4, 2],
- [0, 2, 6, 3],
- [1, 5, 8, 4],
- [3, 6, 10, 7],
- [5, 9, 11, 8],
- [7, 10, 11, 9],
- [0, 3, 7, 9, 5, 1],
- [2, 4, 8, 11, 10, 6]
- ]
- }, o[8] = {
- vertex: [
- [-.729665, .670121, .319155],
- [-.655235, -.29213, -.754096],
- [-.093922, -.607123, .537818],
- [.702196, .595691, .485187],
- [.776626, -.36656, -.588064]
- ],
- face: [
- [1, 4, 2],
- [0, 1, 2],
- [3, 0, 2],
- [4, 3, 2],
- [4, 1, 0, 3]
- ]
- }, o[9] = {
- vertex: [
- [-.868849, -.100041, .61257],
- [-.329458, .976099, .28078],
- [-.26629, -.013796, -.477654],
- [-.13392, -1.034115, .229829],
- [.738834, .707117, -.307018],
- [.859683, -.535264, -.338508]
- ],
- face: [
- [3, 0, 2],
- [5, 3, 2],
- [4, 5, 2],
- [1, 4, 2],
- [0, 1, 2],
- [0, 3, 5, 4, 1]
- ]
- }, o[10] = {
- vertex: [
- [-.610389, .243975, .531213],
- [-.187812, -.48795, -.664016],
- [-.187812, .9759, -.664016],
- [.187812, -.9759, .664016],
- [.798201, .243975, .132803]
- ],
- face: [
- [1, 3, 0],
- [3, 4, 0],
- [3, 1, 4],
- [0, 2, 1],
- [0, 4, 2],
- [2, 4, 1]
- ]
- }, o[11] = {
- vertex: [
- [-1.028778, .392027, -.048786],
- [-.640503, -.646161, .621837],
- [-.125162, -.395663, -.540059],
- [.004683, .888447, -.651988],
- [.125161, .395663, .540059],
- [.632925, -.791376, .433102],
- [1.031672, .157063, -.354165]
- ],
- face: [
- [3, 2, 0],
- [2, 1, 0],
- [2, 5, 1],
- [0, 4, 3],
- [0, 1, 4],
- [4, 1, 5],
- [2, 3, 6],
- [3, 4, 6],
- [5, 2, 6],
- [4, 5, 6]
- ]
- }, o[12] = {
- vertex: [
- [-.669867, .334933, -.529576],
- [-.669867, .334933, .529577],
- [-.4043, 1.212901, 0],
- [-.334933, -.669867, -.529576],
- [-.334933, -.669867, .529577],
- [.334933, .669867, -.529576],
- [.334933, .669867, .529577],
- [.4043, -1.212901, 0],
- [.669867, -.334933, -.529576],
- [.669867, -.334933, .529577]
- ],
- face: [
- [8, 9, 7],
- [6, 5, 2],
- [3, 8, 7],
- [5, 0, 2],
- [4, 3, 7],
- [0, 1, 2],
- [9, 4, 7],
- [1, 6, 2],
- [9, 8, 5, 6],
- [8, 3, 0, 5],
- [3, 4, 1, 0],
- [4, 9, 6, 1]
- ]
- }, o[13] = {
- vertex: [
- [-.931836, .219976, -.264632],
- [-.636706, .318353, .692816],
- [-.613483, -.735083, -.264632],
- [-.326545, .979634, 0],
- [-.318353, -.636706, .692816],
- [-.159176, .477529, -.856368],
- [.159176, -.477529, -.856368],
- [.318353, .636706, .692816],
- [.326545, -.979634, 0],
- [.613482, .735082, -.264632],
- [.636706, -.318353, .692816],
- [.931835, -.219977, -.264632]
- ],
- face: [
- [11, 10, 8],
- [7, 9, 3],
- [6, 11, 8],
- [9, 5, 3],
- [2, 6, 8],
- [5, 0, 3],
- [4, 2, 8],
- [0, 1, 3],
- [10, 4, 8],
- [1, 7, 3],
- [10, 11, 9, 7],
- [11, 6, 5, 9],
- [6, 2, 0, 5],
- [2, 4, 1, 0],
- [4, 10, 7, 1]
- ]
- }, o[14] = {
- vertex: [
- [-.93465, .300459, -.271185],
- [-.838689, -.260219, -.516017],
- [-.711319, .717591, .128359],
- [-.710334, -.156922, .080946],
- [-.599799, .556003, -.725148],
- [-.503838, -.004675, -.969981],
- [-.487004, .26021, .48049],
- [-.460089, -.750282, -.512622],
- [-.376468, .973135, -.325605],
- [-.331735, -.646985, .084342],
- [-.254001, .831847, .530001],
- [-.125239, -.494738, -.966586],
- [.029622, .027949, .730817],
- [.056536, -.982543, -.262295],
- [.08085, 1.087391, .076037],
- [.125583, -.532729, .485984],
- [.262625, .599586, .780328],
- [.391387, -.726999, -.716259],
- [.513854, -.868287, .139347],
- [.597475, .85513, .326364],
- [.641224, .109523, .783723],
- [.737185, -.451155, .538891],
- [.848705, -.612742, -.314616],
- [.976075, .365067, .32976],
- [1.072036, -.19561, .084927]
- ],
- face: [
- [15, 18, 21],
- [12, 20, 16],
- [6, 10, 2],
- [3, 0, 1],
- [9, 7, 13],
- [2, 8, 4, 0],
- [0, 4, 5, 1],
- [1, 5, 11, 7],
- [7, 11, 17, 13],
- [13, 17, 22, 18],
- [18, 22, 24, 21],
- [21, 24, 23, 20],
- [20, 23, 19, 16],
- [16, 19, 14, 10],
- [10, 14, 8, 2],
- [15, 9, 13, 18],
- [12, 15, 21, 20],
- [6, 12, 16, 10],
- [3, 6, 2, 0],
- [9, 3, 1, 7],
- [9, 15, 12, 6, 3],
- [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]
- ]
- };
- i.polyhedron = function(t) {
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
- t = t && (t < 0 || t >= o.length) ? 0 : t || 0;
- for (var a = i.sizeX || e, l = i.sizeY || e, h = i.sizeZ || e, c = o[t], u = c.face.length, _ = [], f = [], d = [], p = [], m = r.vec3.create(1 / 0, 1 / 0, 1 / 0), y = r.vec3.create(-1 / 0, -1 / 0, -1 / 0), v = 0; v < c.vertex.length; v++) {
- var g = c.vertex[v][0] * a,
- x = c.vertex[v][1] * l,
- b = c.vertex[v][2] * h;
- m.x = Math.min(m.x, g), m.y = Math.min(m.y, x), m.z = Math.min(m.z, b), y.x = Math.max(y.x, g), y.y = Math.max(y.y, x), y.z = Math.max(y.z, b), _.push(g, x, b), p.push(0, 0)
- }
- for (var A = 0; A < u; A++)
- for (var C = 0; C < c.face[A].length - 2; C++) f.push(c.face[A][0], c.face[A][C + 2], c.face[A][C + 1]);
- (0, n.calcNormals)(_, f, d);
- var T = Math.sqrt(Math.pow(y.x - m.x, 2), Math.pow(y.y - m.y, 2), Math.pow(y.z - m.z, 2));
- return new s.default(_, d, p, f, m, y, T)
- }
- }), {
- "../../vmath": 326,
- "./utils": 41,
- "./vertex-data": 42
- }],
- 38: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- return new r.default(s, o, a, l, h, c, u)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- var s = [-.5, -.5, 0, -.5, .5, 0, .5, .5, 0, .5, -.5, 0],
- o = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],
- a = [0, 0, 0, 1, 1, 1, 1, 0],
- l = [0, 3, 1, 3, 2, 1],
- h = n.vec3.create(-.5, -.5, 0),
- c = n.vec3.create(.5, .5, 0),
- u = Math.sqrt(.5);
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 39: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = void 0 !== e.segments ? e.segments : 32, s = [], o = [], a = [], l = [], h = n.vec3.create(-t, -t, -t), c = n.vec3.create(t, t, t), u = t, _ = 0; _ <= i; ++_)
- for (var f = _ * Math.PI / i, d = Math.sin(f), p = -Math.cos(f), m = 0; m <= i; ++m) {
- var y = 2 * m * Math.PI / i - Math.PI / 2,
- v = Math.sin(y) * d,
- g = p,
- x = Math.cos(y) * d,
- b = m / i,
- A = _ / i;
- if (s.push(v * t, g * t, x * t), o.push(v, g, x), a.push(b, A), _ < i && m < i) {
- var C = i + 1,
- T = C * _ + m,
- S = C * (_ + 1) + m,
- w = C * (_ + 1) + m + 1,
- E = C * _ + m + 1;
- l.push(T, E, S), l.push(E, w, S)
- }
- }
- return new r.default(s, o, a, l, h, c, u)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 40: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function() {
- for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .4, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .1, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, s = i.radialSegments || 32, o = i.tubularSegments || 32, a = i.arc || 2 * Math.PI, l = [], h = [], c = [], u = [], _ = n.vec3.create(-t - e, -e, -t - e), f = n.vec3.create(t + e, e, t + e), d = t + e, p = 0; p <= s; p++)
- for (var m = 0; m <= o; m++) {
- var y = m / o,
- v = p / s,
- g = y * a,
- x = v * Math.PI * 2,
- b = (t + e * Math.cos(x)) * Math.sin(g),
- A = e * Math.sin(x),
- C = (t + e * Math.cos(x)) * Math.cos(g),
- T = Math.sin(g) * Math.cos(x),
- S = Math.sin(x),
- w = Math.cos(g) * Math.cos(x);
- if (l.push(b, A, C), h.push(T, S, w), c.push(y, v), m < o && p < s) {
- var E = o + 1,
- M = E * p + m,
- D = E * (p + 1) + m,
- B = E * (p + 1) + m + 1,
- I = E * p + m + 1;
- u.push(M, I, D), u.push(I, B, D)
- }
- }
- return new r.default(l, h, c, u, _, f, d)
- };
- var n = t("../../vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vertex-data"));
- e.exports = i.default
- }), {
- "../../vmath": 326,
- "./vertex-data": 42
- }],
- 41: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.wireframe = function(t) {
- for (var e = [
- [0, 1],
- [1, 2],
- [2, 0]
- ], i = [], n = {}, r = 0; r < t.length; r += 3)
- for (var s = 0; s < 3; ++s) {
- var o = t[r + e[s][0]],
- a = t[r + e[s][1]],
- l = o > a ? a << 16 | o : o << 16 | a;
- void 0 === n[l] && (n[l] = 0, i.push(o, a))
- }
- return i
- }, i.invWinding = function(t) {
- for (var e = [], i = 0; i < t.length; i += 3) e.push(t[i], t[i + 2], t[i + 1]);
- return e
- }, i.toWavefrontOBJ = function(t) {
- for (var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, i = t.positions, n = t.uvs, r = t.normals, s = t.indices, o = function(t) {
- return s[t] + 1 + "/" + (s[t] + 1) + "/" + (s[t] + 1)
- }, a = "", l = 0; l < i.length; l += 3) a += "v " + i[l] * e + " " + i[l + 1] * e + " " + i[l + 2] * e + "\n";
- for (var h = 0; h < n.length; h += 2) a += "vt " + n[h] + " " + n[h + 1] + "\n";
- for (var c = 0; c < r.length; c += 3) a += "vn " + r[c] + " " + r[c + 1] + " " + r[c + 2] + "\n";
- for (var u = 0; u < s.length; u += 3) a += "f " + o(u) + " " + o(u + 1) + " " + o(u + 2) + "\n";
- return a
- }, i.normals = function(t, e) {
- for (var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, n = new Array(2 * t.length), r = 0; r < t.length / 3; ++r) {
- var s = 3 * r,
- o = 6 * r;
- n[o + 0] = t[s + 0], n[o + 1] = t[s + 1], n[o + 2] = t[s + 2], n[o + 3] = t[s + 0] + e[s + 0] * i, n[o + 4] = t[s + 1] + e[s + 1] * i, n[o + 5] = t[s + 2] + e[s + 2] * i
- }
- return n
- }, i.calcNormals = function(t, e, i) {
- for (var s = 0, o = (i = i || new Array(t.length)).length; s < o; s++) i[s] = 0;
- for (var a = void 0, l = void 0, h = void 0, c = cc.v3(), u = cc.v3(), _ = cc.v3(), f = cc.v3(), d = cc.v3(), p = 0, m = e.length; p < m; p += 3) a = 3 * e[p + 0], l = 3 * e[p + 1], h = 3 * e[p + 2], r(c, t, a), r(u, t, l), r(_, t, h), n.vec3.sub(f, _, u), n.vec3.sub(d, c, u), n.vec3.cross(f, f, d), i[a] += f.x, i[a + 1] += f.y, i[a + 2] += f.z, i[l] += f.x, i[l + 1] += f.y, i[l + 2] += f.z, i[h] += f.x, i[h + 1] += f.y, i[h + 2] += f.z;
- for (var y = cc.v3(), v = 0, g = i.length; v < g; v += 3) y.x = i[v], y.y = i[v + 1], y.z = i[v + 2], y.normalizeSelf(), i[v] = y.x, i[v + 1] = y.y, i[v + 2] = y.z;
- return i
- };
- var n = t("../../vmath");
- function r(t, e, i) {
- t.x = e[i], t.y = e[i + 1], t.z = e[i + 2]
- }
- }), {
- "../../vmath": 326
- }],
- 42: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function(t, e, i, n, r, s, o) {
- this.positions = t, this.normals = e, this.uvs = i, this.indices = n, this.minPos = r, this.maxPos = s, this.boundingRadius = o
- }, e.exports = i.default
- }), {}],
- 43: [(function(t, e, i) {
- "use strict";
- var n = t("../../../animation/animation-curves"),
- r = n.DynamicAnimCurve,
- s = n.quickFindIndex,
- o = cc.Class({
- name: "cc.JointMatrixCurve",
- extends: r,
- _findFrameIndex: s,
- sample: function(t, e) {
- var i = this.ratios,
- n = this._findFrameIndex(i, e);
- n < -1 && (n = ~n - 1);
- for (var r = this.pairs, s = 0; s < r.length; s++) {
- var o = r[s];
- o.target._jointMatrix = o.values[n]
- }
- }
- });
- e.exports = o
- }), {
- "../../../animation/animation-curves": 11
- }],
- 44: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Skeleton",
- extends: cc.Asset,
- ctor: function() {
- this._bindposes = [], this._uniqueBindPoses = [], this._jointPaths = []
- },
- properties: {
- _model: cc.Model,
- _jointIndices: [],
- _skinIndex: -1,
- jointPaths: {
- get: function() {
- return this._jointPaths
- }
- },
- bindposes: {
- get: function() {
- return this._bindposes
- }
- },
- uniqueBindPoses: {
- get: function() {
- return this._uniqueBindPoses
- }
- },
- model: {
- get: function() {
- return this._model
- }
- }
- },
- onLoad: function() {
- for (var t = this._model.nodes, e = this._jointIndices, i = this._jointPaths, n = this._bindposes, r = this._uniqueBindPoses, s = 0; s < e.length; s++) {
- var o = t[e[s]];
- i[s] = o.path, o.uniqueBindPose ? n[s] = r[s] = o.uniqueBindPose : n[s] = o.bindpose[this._skinIndex]
- }
- }
- });
- cc.Skeleton = e.exports = n
- }), {}],
- 45: [(function(t, e, i) {
- "use strict";
- var n = t("../../components/CCAnimation"),
- r = t("../CCModel"),
- s = t("./CCSkeletonAnimationClip"),
- o = cc.Class({
- name: "cc.SkeletonAnimation",
- extends: n,
- editor: !1,
- properties: {
- _model: {
- default: null,
- type: r
- },
- _defaultClip: {
- override: !0,
- default: null,
- type: s
- },
- _clips: {
- override: !0,
- default: [],
- type: [s],
- visible: !0
- },
- defaultClip: {
- override: !0,
- get: function() {
- return this._defaultClip
- },
- set: function(t) {
- this._defaultClip = t
- },
- type: s
- },
- model: {
- get: function() {
- return this._model
- },
- set: function(t) {
- this._model = t, this._updateClipModel()
- },
- type: r
- }
- },
- __preload: function() {
- this._updateClipModel()
- },
- _updateClipModel: function() {
- this._defaultClip && (this._defaultClip._model = this._model);
- for (var t = this._clips, e = 0; e < t.length; e++) t[e]._model = this._model
- },
- addClip: function(t, e) {
- return t._model = this._model, n.prototype.addClip.call(this, t, e)
- },
- searchClips: !1
- });
- cc.SkeletonAnimation = e.exports = o
- }), {
- "../../components/CCAnimation": 90,
- "../CCModel": 27,
- "./CCSkeletonAnimationClip": 46,
- "fire-path": void 0
- }],
- 46: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../vmath/mat4"));
- var r = t("../../../animation/animation-clip"),
- s = t("./CCJointMatrixCurve");
- function o(t) {
- var e = new Float32Array(16);
- return e.set(t.m), e
- }
- var a = cc.Class({
- name: "cc.SkeletonAnimationClip",
- extends: r,
- properties: {
- _nativeAsset: {
- override: !0,
- get: function() {
- return this._buffer
- },
- set: function(t) {
- var e = ArrayBuffer.isView(t) ? t.buffer : t;
- this._buffer = new Float32Array(e || t, 0, e.byteLength / 4)
- }
- },
- description: {
- default: null,
- type: Object
- },
- curveData: {
- visible: !1,
- override: !0,
- get: function() {
- return this._curveData || {}
- },
- set: function() {}
- }
- },
- statics: {
- preventDeferredLoadDependents: !0
- },
- _init: function() {
- return this._curveData ? this._curveData : (this._curveData = {}, this._generateCommonCurve(), this._model.precomputeJointMatrix && this._generateJointMatrixCurve(), this._curveData)
- },
- _generateCommonCurve: function() {
- var t = this._buffer,
- e = this.description,
- i = 0;
- function n() {
- return t[i++]
- }
- this._curveData.paths || (this._curveData.paths = {});
- var r = this._curveData.paths;
- for (var s in e) {
- var o = e[s],
- a = {};
- for (var l in r[s] = {
- props: a
- }, o) {
- var h = [],
- c = o[l].frameCount;
- i = o[l].offset;
- for (var u = 0; u < c; u++) {
- var _ = n(),
- f = void 0;
- "position" === l || "scale" === l ? f = cc.v3(n(), n(), n()) : "quat" === l && (f = cc.quat(n(), n(), n(), n())), h.push({
- frame: _,
- value: f
- })
- }
- a[l] = h
- }
- }
- },
- _generateJointMatrixCurve: function() {
- var t = this._model.rootNode,
- e = this._curveData.paths,
- i = {
- ratios: [],
- jointMatrixMap: {}
- },
- r = i.jointMatrixMap;
- function s(i, a, l) {
- var h = void 0,
- c = e[i.path];
- if (i !== t && c) {
- var u = c.props;
- for (var _ in u)
- for (var f = u[_], d = 0; d < f.length; d++) {
- var p = f[d];
- if (Math.abs(p.frame - a) < 1e-4) {
- i[_].set(p.value);
- break
- }
- if (p.frame > a) {
- var m = f[d - 1],
- y = (a - m.frame) / (p.frame - m.frame);
- m.value.lerp(p.value, y, i[_]);
- break
- }
- }
- h = n.default.create(), n.default.fromRTS(h, i.quat, i.position, i.scale), l && n.default.mul(h, l, h), u._jointMatrix || (u._jointMatrix = []);
- var v = void 0;
- i.uniqueBindPose && (v = n.default.create(), n.default.mul(v, h, i.uniqueBindPose)), r[i.path] || (r[i.path] = []), v ? r[i.path].push(o(v)) : r[i.path].push(h)
- }
- var g = i.children;
- for (var x in g) {
- s(g[x], a, h)
- }
- }
- for (var a = 0, l = this.duration, h = 1 / this.sample; a < l;) i.ratios.push(a / l), s(t, a), a += h;
- this._curveData = i
- },
- _createJointMatrixCurve: function(t, e) {
- var i = new s;
- i.ratios = this.curveData.ratios, i.pairs = [];
- var n = this.curveData.jointMatrixMap;
- for (var r in n) {
- var o = cc.find(r, e);
- o && i.pairs.push({
- target: o,
- values: n[r]
- })
- }
- return [i]
- },
- createCurves: function(t, e) {
- return this._model ? (this._init(), this._model.precomputeJointMatrix ? this._createJointMatrixCurve(t, e) : r.prototype.createCurves.call(this, t, e)) : (cc.warn("Skeleton Animation Clip [" + this.name + "] Can not find model"), [])
- }
- });
- cc.SkeletonAnimationClip = e.exports = a
- }), {
- "../../../animation/animation-clip": 10,
- "../../vmath/mat4": 330,
- "./CCJointMatrixCurve": 43
- }],
- 47: [(function(t, e, i) {
- "use strict";
- var n = t("./CCSkeleton"),
- r = t("../../mesh/CCMeshRenderer"),
- s = t("../../renderer/render-flow"),
- o = t("../../../renderer/enums"),
- a = cc.vmath.mat4,
- l = a.create(),
- h = a.create(),
- c = cc.Class({
- name: "cc.SkinnedMeshRenderer",
- extends: r,
- editor: !1,
- ctor: function() {
- this._jointsData = this._jointsFloat32Data = null, this._jointsTexture = null, this._joints = [], this._dummyNode = new cc.Node, this._jointsTextureOptions = null, this._usingRGBA8Texture = !1
- },
- properties: {
- _skeleton: n,
- _rootBone: cc.Node,
- skeleton: {
- get: function() {
- return this._skeleton
- },
- set: function(t) {
- this._skeleton = t, this._init(), this._activateMaterial(!0)
- },
- type: n
- },
- rootBone: {
- get: function() {
- return this._rootBone
- },
- set: function(t) {
- this._rootBone = t, this._init()
- },
- type: cc.Node
- },
- enableAutoBatch: {
- get: function() {
- return !1
- },
- visible: !1,
- override: !0
- }
- },
- _activateMaterial: function(t) {
- this._jointsData ? this._super(t) : this.disableRender()
- },
- __preload: function() {
- this._resetAssembler(), this._init()
- },
- _init: function() {
- this._model = this._skeleton && this._skeleton.model, this._calFunc = null, this._initJoints(), this._initJointsTexture(), this._initCalcFunc(), this._updateRenderNode()
- },
- _calcWorldMatrixToRoot: function(t) {
- var e = t._worldMatrixToRoot;
- if (!e) {
- t._worldMatrixToRoot = e = cc.mat4(), t.getLocalMatrix(e);
- var i = t.parent;
- i !== this.rootBone && (i._worldMatrixToRoot || this._calcWorldMatrixToRoot(i), a.mul(e, i._worldMatrixToRoot, e))
- }
- },
- _initJoints: function() {
- var t = this._joints;
- if (t.length = 0, this.skeleton && this.rootBone) {
- for (var e = this._useJointMatrix(), i = this.skeleton.jointPaths, n = this.rootBone, r = 0; r < i.length; r++) {
- var o = cc.find(i[r], n);
- o || cc.warn("Can not find joint in root bone [%s] with path [%s]", n.name, i[r]), e && (o._renderFlag &= ~s.FLAG_CHILDREN, this._calcWorldMatrixToRoot(o)), t.push(o)
- }
- if (e)
- for (var h = this.skeleton.uniqueBindPoses, c = 0; c < i.length; c++) {
- var u = t[c];
- h[c] ? (a.mul(l, u._worldMatrixToRoot, h[c]), u._jointMatrix = a.array([], l)) : u._jointMatrix = u._worldMatrixToRoot
- }
- }
- },
- _initJointsTexture: function() {
- if (this._skeleton) {
- var t = this._joints.length,
- e = this._customProperties,
- i = !1;
- if (t <= cc.sys.getMaxJointMatrixSize() && (i = !0, this._jointsData = this._jointsFloat32Data = new Float32Array(16 * t), e.setProperty("cc_jointMatrices", this._jointsFloat32Data, o.PARAM_FLOAT4, !0), e.define("CC_USE_JOINTS_TEXTRUE", !1)), !i) {
- var n = !!cc.sys.glExtension("OES_texture_float"),
- r = void 0;
- r = t > 256 ? 64 : t > 64 ? 32 : t > 16 ? 16 : 8, this._jointsData = this._jointsFloat32Data = new Float32Array(r * r * 4);
- var s = cc.Texture2D.PixelFormat.RGBA32F,
- a = r,
- l = r;
- n || (this._jointsData = new Uint8Array(this._jointsFloat32Data.buffer), s = cc.Texture2D.PixelFormat.RGBA8888, a *= 4, this._usingRGBA8Texture = !0, cc.warn("SkinnedMeshRenderer [" + this.node.name + "] has too many joints [" + t + "] and device do not support float32 texture, fallback to use RGBA8888 texture, which is much slower."));
- var h = this._jointsTexture || new cc.Texture2D,
- c = cc.Texture2D.Filter.NEAREST;
- h.setFilters(c, c), h.initWithData(this._jointsData, s, a, l), this._jointsTexture = h, this._jointsTextureOptions = {
- format: s,
- width: h.width,
- height: h.height,
- images: []
- }, e.setProperty("cc_jointsTexture", h.getImpl(), o.PARAM_TEXTURE_2D), e.setProperty("cc_jointsTextureSize", new Float32Array([a, l]), o.PARAM_FLOAT2), e.define("CC_JOINTS_TEXTURE_FLOAT32", n), e.define("CC_USE_JOINTS_TEXTRUE", !0)
- }
- e.define("CC_USE_SKINNING", !0)
- }
- },
- _setJointsDataWithArray: function(t, e) {
- this._jointsFloat32Data.set(e, 16 * t)
- },
- _setJointsDataWithMatrix: function(t, e) {
- this._jointsFloat32Data.set(e.m, 16 * t)
- },
- _commitJointsData: function() {
- this._jointsTexture && (this._jointsTextureOptions.images[0] = this._jointsData, this._jointsTexture.update(this._jointsTextureOptions))
- },
- _useJointMatrix: function() {
- return this._model && this._model.precomputeJointMatrix
- },
- _updateRenderNode: function() {
- this._useJointMatrix() || this._usingRGBA8Texture ? this._assembler.setRenderNode(this.rootBone) : this._assembler.setRenderNode(this._dummyNode)
- },
- _initCalcFunc: function() {
- this._useJointMatrix() ? this._calFunc = this._calJointMatrix : this._usingRGBA8Texture ? this._calFunc = this._calRGBA8WorldMatrix : this._calFunc = this._calWorldMatrix
- },
- _calJointMatrix: function() {
- for (var t = this._joints, e = this.skeleton.bindposes, i = this.skeleton.uniqueBindPoses, n = 0; n < t.length; ++n) {
- var r = t[n]._jointMatrix;
- i[n] ? this._setJointsDataWithArray(n, r) : (a.multiply(l, r, e[n]), this._setJointsDataWithMatrix(n, l))
- }
- },
- _calRGBA8WorldMatrix: function() {
- var t = this._joints,
- e = this.skeleton.bindposes;
- this.rootBone._updateWorldMatrix();
- for (var i = this.rootBone._worldMatrix, n = a.invert(h, i), r = 0; r < t.length; ++r) {
- var s = t[r];
- s._updateWorldMatrix(), a.multiply(l, n, s._worldMatrix), a.multiply(l, l, e[r]), this._setJointsDataWithMatrix(r, l)
- }
- },
- _calWorldMatrix: function() {
- for (var t = this._joints, e = this.skeleton.bindposes, i = 0; i < t.length; ++i) {
- var n = t[i];
- n._updateWorldMatrix(), a.multiply(l, n._worldMatrix, e[i]), this._setJointsDataWithMatrix(i, l)
- }
- },
- calcJointMatrix: function() {
- this.skeleton && this.rootBone && (this._calFunc.call(this), this._commitJointsData())
- }
- });
- cc.SkinnedMeshRenderer = e.exports = c
- }), {
- "../../../renderer/enums": 355,
- "../../mesh/CCMeshRenderer": 166,
- "../../renderer/render-flow": 248,
- "./CCSkeleton": 44
- }],
- 48: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("./CCSkinnedMeshRenderer"),
- a = t("../../mesh/mesh-renderer"),
- l = (t("../../renderer/render-flow"), (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.fillBuffers = function(e, i) {
- e.calcJointMatrix(), t.prototype.fillBuffers.call(this, e, i)
- }, e
- })(a));
- i.default = l, cc.Assembler.register(o, l), e.exports = i.default
- }), {
- "../../mesh/mesh-renderer": 169,
- "../../renderer/render-flow": 248,
- "./CCSkinnedMeshRenderer": 47
- }],
- 49: [(function(t, e, i) {
- "use strict";
- var n = t("./platform/utils"),
- r = (t("../../DebugInfos"), "https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md"),
- s = void 0;
- cc.log = cc.warn = cc.error = cc.assert = console.log.bind ? console.log.bind(console) : console.log;
- function o(t) {
- return function() {
- var e = arguments[0],
- i = t + " " + e + ", please go to " + r + "#" + e + " to see details.";
- if (1 === arguments.length) return i;
- if (2 === arguments.length) return i + " Arguments: " + arguments[1];
- var n = cc.js.shiftArguments.apply(null, arguments);
- return i + " Arguments: " + n.join(", ")
- }
- }
- cc._throw = function(t) {
- n.callInNextTick((function() {
- throw t
- }))
- };
- var a = o("Log");
- cc.logID = function() {
- cc.log(a.apply(null, arguments))
- };
- var l = o("Warning");
- cc.warnID = function() {
- cc.warn(l.apply(null, arguments))
- };
- var h = o("Error");
- cc.errorID = function() {
- cc.error(h.apply(null, arguments))
- };
- var c = o("Assert");
- cc.assertID = function(t) {
- t || cc.assert(!1, c.apply(null, cc.js.shiftArguments.apply(null, arguments)))
- };
- var u = cc.Enum({
- NONE: 0,
- INFO: 1,
- WARN: 2,
- ERROR: 3,
- INFO_FOR_WEB_PAGE: 4,
- WARN_FOR_WEB_PAGE: 5,
- ERROR_FOR_WEB_PAGE: 6
- });
- e.exports = cc.debug = {
- DebugMode: u,
- _resetDebugSetting: function(t) {
- if (cc.log = cc.warn = cc.error = cc.assert = function() {}, t !== u.NONE) {
- if (t > u.ERROR) {
- var e = function(t) {
- if (cc.game.canvas) {
- if (!s) {
- var e = document.createElement("Div");
- e.setAttribute("id", "logInfoDiv"), e.setAttribute("width", "200"), e.setAttribute("height", cc.game.canvas.height);
- var i = e.style;
- i.zIndex = "99999", i.position = "absolute", i.top = i.left = "0", (s = document.createElement("textarea")).setAttribute("rows", "20"), s.setAttribute("cols", "30"), s.setAttribute("disabled", "true");
- var n = s.style;
- n.backgroundColor = "transparent", n.borderBottom = "1px solid #cccccc", n.borderTopWidth = n.borderLeftWidth = n.borderRightWidth = "0px", n.borderTopStyle = n.borderLeftStyle = n.borderRightStyle = "none", n.padding = "0px", n.margin = 0, e.appendChild(s), cc.game.canvas.parentNode.appendChild(e)
- }
- s.value = s.value + t + "\r\n", s.scrollTop = s.scrollHeight
- }
- };
- cc.error = function() {
- e("ERROR : " + cc.js.formatStr.apply(null, arguments))
- }, cc.assert = function(t, i) {
- !t && i && (i = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments)), e("ASSERT: " + i))
- }, t !== u.ERROR_FOR_WEB_PAGE && (cc.warn = function() {
- e("WARN : " + cc.js.formatStr.apply(null, arguments))
- }), t === u.INFO_FOR_WEB_PAGE && (cc.log = function() {
- e(cc.js.formatStr.apply(null, arguments))
- })
- } else console && console.log.apply && (console.error || (console.error = console.log), console.warn || (console.warn = console.log), console.error.bind ? cc.error = console.error.bind(console) : cc.error = function() {
- return console.error.apply(console, arguments)
- }, cc.assert = function(t, e) {
- if (!t) throw e && (e = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments))), new Error(e)
- });
- t !== u.ERROR && (console.warn.bind ? cc.warn = console.warn.bind(console) : cc.warn = function() {
- return console.warn.apply(console, arguments)
- }), t === u.INFO && (console.log.bind ? cc.log = console.log.bind(console) : cc.log = function() {
- return console.log.apply(console, arguments)
- })
- }
- },
- getError: o("ERROR"),
- isDisplayStats: function() {
- return !!cc.profiler && cc.profiler.isShowingStats()
- },
- setDisplayStats: function(t) {
- cc.profiler && (t ? cc.profiler.showStats() : cc.profiler.hideStats(), cc.game.config.showFPS = !!t)
- }
- }
- }), {
- "../../DebugInfos": void 0,
- "./platform/utils": 222
- }],
- 50: [(function(t, e, i) {
- "use strict";
- var n = t("./event/event-target"),
- r = t("./load-pipeline/auto-release-utils"),
- s = t("./component-scheduler"),
- o = t("./node-activator"),
- a = t("./platform/CCObject"),
- l = t("./CCGame"),
- h = t("./renderer"),
- c = t("./event-manager"),
- u = t("./CCScheduler");
- cc.Director = function() {
- n.call(this), this._paused = !1, this._purgeDirectorInNextLoop = !1, this._winSizeInPoints = null, this._loadingScene = "", this._scene = null, this._totalFrames = 0, this._lastUpdate = 0, this._deltaTime = 0, this._startTime = 0, this._scheduler = null, this._compScheduler = null, this._nodeActivator = null, this._actionManager = null;
- var t = this;
- l.on(l.EVENT_SHOW, (function() {
- t._lastUpdate = performance.now()
- })), l.once(l.EVENT_ENGINE_INITED, this.init, this)
- }, cc.Director.prototype = {
- constructor: cc.Director,
- init: function() {
- return this._totalFrames = 0, this._lastUpdate = performance.now(), this._startTime = this._lastUpdate, this._paused = !1, this._purgeDirectorInNextLoop = !1, this._winSizeInPoints = cc.size(0, 0), this._scheduler = new u, cc.ActionManager ? (this._actionManager = new cc.ActionManager, this._scheduler.scheduleUpdate(this._actionManager, u.PRIORITY_SYSTEM, !1)) : this._actionManager = null, this.sharedInit(), !0
- },
- sharedInit: function() {
- this._compScheduler = new s, this._nodeActivator = new o, c && c.setEnabled(!0), cc.AnimationManager ? (this._animationManager = new cc.AnimationManager, this._scheduler.scheduleUpdate(this._animationManager, u.PRIORITY_SYSTEM, !1)) : this._animationManager = null, cc.CollisionManager ? (this._collisionManager = new cc.CollisionManager, this._scheduler.scheduleUpdate(this._collisionManager, u.PRIORITY_SYSTEM, !1)) : this._collisionManager = null, cc.PhysicsManager ? (this._physicsManager = new cc.PhysicsManager, this._scheduler.scheduleUpdate(this._physicsManager, u.PRIORITY_SYSTEM, !1)) : this._physicsManager = null, cc._widgetManager && cc._widgetManager.init(this), cc.loader.init(this)
- },
- calculateDeltaTime: function(t) {
- t || (t = performance.now()), this._deltaTime = t > this._lastUpdate ? (t - this._lastUpdate) / 1e3 : 0, this._lastUpdate = t
- },
- convertToGL: function(t) {
- var e = l.container,
- i = cc.view,
- n = e.getBoundingClientRect(),
- r = n.left + window.pageXOffset - e.clientLeft,
- s = n.top + window.pageYOffset - e.clientTop,
- o = i._devicePixelRatio * (t.x - r),
- a = i._devicePixelRatio * (s + n.height - t.y);
- return i._isRotated ? cc.v2(i._viewportRect.width - a, o) : cc.v2(o, a)
- },
- convertToUI: function(t) {
- var e = l.container,
- i = cc.view,
- n = e.getBoundingClientRect(),
- r = n.left + window.pageXOffset - e.clientLeft,
- s = n.top + window.pageYOffset - e.clientTop,
- o = cc.v2(0, 0);
- return i._isRotated ? (o.x = r + t.y / i._devicePixelRatio, o.y = s + n.height - (i._viewportRect.width - t.x) / i._devicePixelRatio) : (o.x = r + t.x * i._devicePixelRatio, o.y = s + n.height - t.y * i._devicePixelRatio), o
- },
- end: function() {
- this._purgeDirectorInNextLoop = !0
- },
- getWinSize: function() {
- return cc.size(cc.winSize)
- },
- getWinSizeInPixels: function() {
- return cc.size(cc.winSize)
- },
- pause: function() {
- this._paused || (this._paused = !0)
- },
- purgeCachedData: function() {
- cc.loader.releaseAll()
- },
- purgeDirector: function() {
- this._scheduler.unscheduleAll(), this._compScheduler.unscheduleAll(), this._nodeActivator.reset(), c && c.setEnabled(!1), cc.isValid(this._scene) && this._scene.destroy(), this._scene = null, cc.renderer.clear(), cc.AssetLibrary.resetBuiltins(), cc.game.pause(), cc.loader.releaseAll()
- },
- reset: function() {
- this.purgeDirector(), c && c.setEnabled(!0), this._actionManager && this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._animationManager && this._scheduler.scheduleUpdate(this._animationManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._collisionManager && this._scheduler.scheduleUpdate(this._collisionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._physicsManager && this._scheduler.scheduleUpdate(this._physicsManager, cc.Scheduler.PRIORITY_SYSTEM, !1), cc.game.resume()
- },
- runSceneImmediate: function(t, e, i) {
- cc.assertID(t instanceof cc.Scene, 1216), t._load();
- for (var n = Object.keys(l._persistRootNodes).map((function(t) {
- return l._persistRootNodes[t]
- })), s = 0; s < n.length; s++) {
- var o = n[s],
- h = t.getChildByUuid(o.uuid);
- if (h) {
- var c = h.getSiblingIndex();
- h._destroyImmediate(), t.insertChild(o, c)
- } else o.parent = t
- }
- var u = this._scene,
- _ = u && u.autoReleaseAssets && u.dependAssets;
- r.autoRelease(_, t.dependAssets, n), cc.isValid(u) && u.destroy(), this._scene = null, a._deferredDestroy(), e && e(), this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, t), this._scene = t, t._activate(), cc.game.resume(), i && i(null, t), this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, t)
- },
- runScene: function(t, e, i) {
- cc.assertID(t, 1205), cc.assertID(t instanceof cc.Scene, 1216), t._load(), this.once(cc.Director.EVENT_AFTER_UPDATE, (function() {
- this.runSceneImmediate(t, e, i)
- }), this)
- },
- _getSceneUuid: function(t) {
- var e = l._sceneInfos;
- if ("string" == typeof t) {
- t.endsWith(".fire") || (t += ".fire"), "/" === t[0] || t.startsWith("db://") || (t = "/" + t);
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- if (n.url.endsWith(t)) return n
- }
- } else if ("number" == typeof t) {
- if (0 <= t && t < e.length) return e[t];
- cc.errorID(1206, t)
- } else cc.errorID(1207, t);
- return null
- },
- loadScene: function(t, e, i) {
- if (this._loadingScene) return cc.warnID(1208, t, this._loadingScene), !1;
- var n = this._getSceneUuid(t);
- if (n) {
- var r = n.uuid;
- return this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t), this._loadingScene = t, this._loadSceneByUuid(r, e, i), !0
- }
- return cc.errorID(1209, t), !1
- },
- preloadScene: function(t, e, i) {
- void 0 === i && (i = e, e = null);
- var n = this._getSceneUuid(t);
- if (n) this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t), cc.loader.load({
- uuid: n.uuid,
- type: "uuid"
- }, e, (function(e, n) {
- e && cc.errorID(1210, t, e.message), i && i(e, n)
- }));
- else {
- var r = 'Can not preload the scene "' + t + '" because it is not in the build settings.';
- i(new Error(r)), cc.error("preloadScene: " + r)
- }
- },
- _loadSceneByUuid: function(t, e, i, n) {
- console.time("LoadScene " + t), cc.AssetLibrary.loadAsset(t, (function(n, r) {
- console.timeEnd("LoadScene " + t);
- var s = cc.director;
- if (s._loadingScene = "", n) n = "Failed to load scene: " + n, cc.error(n);
- else {
- if (r instanceof cc.SceneAsset) {
- var o = r.scene;
- return o._id = r._uuid, o._name = r._name, void s.runSceneImmediate(o, i, e)
- }
- n = "The asset " + t + " is not a scene", cc.error(n)
- }
- e && e(n)
- }))
- },
- resume: function() {
- this._paused && (this._lastUpdate = performance.now(), this._lastUpdate || cc.logID(1200), this._paused = !1, this._deltaTime = 0)
- },
- setDepthTest: function(t) {
- cc.Camera.main && (cc.Camera.main.depth = !!t)
- },
- setClearColor: function(t) {
- cc.Camera.main && (cc.Camera.main.backgroundColor = t)
- },
- getRunningScene: function() {
- return this._scene
- },
- getScene: function() {
- return this._scene
- },
- getAnimationInterval: function() {
- return 1e3 / l.getFrameRate()
- },
- setAnimationInterval: function(t) {
- l.setFrameRate(Math.round(1e3 / t))
- },
- getDeltaTime: function() {
- return this._deltaTime
- },
- getTotalTime: function() {
- return performance.now() - this._startTime
- },
- getTotalFrames: function() {
- return this._totalFrames
- },
- isPaused: function() {
- return this._paused
- },
- getScheduler: function() {
- return this._scheduler
- },
- setScheduler: function(t) {
- this._scheduler !== t && (this._scheduler = t)
- },
- getActionManager: function() {
- return this._actionManager
- },
- setActionManager: function(t) {
- this._actionManager !== t && (this._actionManager && this._scheduler.unscheduleUpdate(this._actionManager), this._actionManager = t, this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1))
- },
- getAnimationManager: function() {
- return this._animationManager
- },
- getCollisionManager: function() {
- return this._collisionManager
- },
- getPhysicsManager: function() {
- return this._physicsManager
- },
- startAnimation: function() {
- cc.game.resume()
- },
- stopAnimation: function() {
- cc.game.pause()
- },
- _resetDeltaTime: function() {
- this._lastUpdate = performance.now(), this._deltaTime = 0
- },
- mainLoop: function(t) {
- this._purgeDirectorInNextLoop ? (this._purgeDirectorInNextLoop = !1, this.purgeDirector()) : (this.calculateDeltaTime(t), this._paused || (this.emit(cc.Director.EVENT_BEFORE_UPDATE), this._compScheduler.startPhase(), this._compScheduler.updatePhase(this._deltaTime), this._scheduler.update(this._deltaTime), this._compScheduler.lateUpdatePhase(this._deltaTime), this.emit(cc.Director.EVENT_AFTER_UPDATE), a._deferredDestroy()), this.emit(cc.Director.EVENT_BEFORE_DRAW), h.render(this._scene, this._deltaTime), this.emit(cc.Director.EVENT_AFTER_DRAW), c.frameUpdateListeners(), this._totalFrames++)
- },
- __fastOn: function(t, e, i) {
- this.on(t, e, i)
- },
- __fastOff: function(t, e, i) {
- this.off(t, e, i)
- }
- }, cc.js.addon(cc.Director.prototype, n.prototype), cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed", cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading", cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch", cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch", cc.Director.EVENT_BEFORE_UPDATE = "director_before_update", cc.Director.EVENT_AFTER_UPDATE = "director_after_update", cc.Director.EVENT_BEFORE_VISIT = "director_before_draw", cc.Director.EVENT_AFTER_VISIT = "director_before_draw", cc.Director.EVENT_BEFORE_DRAW = "director_before_draw", cc.Director.EVENT_AFTER_DRAW = "director_after_draw", cc.Director.PROJECTION_2D = 0, cc.Director.PROJECTION_3D = 1, cc.Director.PROJECTION_CUSTOM = 3, cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_2D, cc.director = new cc.Director, e.exports = cc.director
- }), {
- "./CCGame": 51,
- "./CCScheduler": 55,
- "./component-scheduler": 89,
- "./event-manager": 129,
- "./event/event-target": 131,
- "./load-pipeline/auto-release-utils": 149,
- "./node-activator": 170,
- "./platform/CCObject": 204,
- "./renderer": 247
- }],
- 51: [(function(t, e, i) {
- "use strict";
- var n = t("./event/event-target");
- t("../audio/CCAudioEngine");
- var r = t("./CCDebug"),
- s = t("./renderer/index.js"),
- o = t("../core/renderer/utils/dynamic-atlas/manager"),
- a = {
- EVENT_HIDE: "game_on_hide",
- EVENT_SHOW: "game_on_show",
- EVENT_RESTART: "game_on_restart",
- EVENT_GAME_INITED: "game_inited",
- EVENT_ENGINE_INITED: "engine_inited",
- EVENT_RENDERER_INITED: "engine_inited",
- RENDER_TYPE_CANVAS: 0,
- RENDER_TYPE_WEBGL: 1,
- RENDER_TYPE_OPENGL: 2,
- _persistRootNodes: {},
- _paused: !0,
- _configLoaded: !1,
- _isCloning: !1,
- _prepared: !1,
- _rendererInitialized: !1,
- _renderContext: null,
- _intervalId: null,
- _lastTime: null,
- _frameTime: null,
- _sceneInfos: [],
- frame: null,
- container: null,
- canvas: null,
- renderType: -1,
- config: null,
- onStart: null,
- setFrameRate: function(t) {
- this.config.frameRate = t, this._intervalId && window.cancelAnimFrame(this._intervalId), this._intervalId = 0, this._paused = !0, this._setAnimFrame(), this._runMainLoop()
- },
- getFrameRate: function() {
- return this.config.frameRate
- },
- step: function() {
- cc.director.mainLoop()
- },
- pause: function() {
- this._paused || (this._paused = !0, cc.audioEngine && cc.audioEngine._break(), this._intervalId && window.cancelAnimFrame(this._intervalId), this._intervalId = 0)
- },
- resume: function() {
- this._paused && (this._paused = !1, cc.audioEngine && cc.audioEngine._restore(), cc.director._resetDeltaTime(), this._runMainLoop())
- },
- isPaused: function() {
- return this._paused
- },
- restart: function() {
- cc.director.once(cc.Director.EVENT_AFTER_DRAW, (function() {
- for (var t in a._persistRootNodes) a.removePersistRootNode(a._persistRootNodes[t]);
- cc.director.getScene().destroy(), cc.Object._deferredDestroy(), cc.audioEngine && cc.audioEngine.uncacheAll(), cc.director.reset(), a.pause(), cc.AssetLibrary._loadBuiltins((function() {
- a.onStart(), a.emit(a.EVENT_RESTART)
- }))
- }))
- },
- end: function() {
- close()
- },
- _initEngine: function() {
- this._rendererInitialized || (this._initRenderer(), this._initEvents(), this.emit(this.EVENT_ENGINE_INITED))
- },
- _prepareFinished: function(t) {
- var e = this;
- this._initEngine(), this._setAnimFrame(), cc.AssetLibrary._loadBuiltins((function() {
- console.log("Cocos Creator v" + cc.ENGINE_VERSION), e._prepared = !0, e._runMainLoop(), e.emit(e.EVENT_GAME_INITED), t && t()
- }))
- },
- eventTargetOn: n.prototype.on,
- eventTargetOnce: n.prototype.once,
- on: function(t, e, i) {
- this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOn(t, e, i)
- },
- once: function(t, e, i) {
- this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOnce(t, e, i)
- },
- prepare: function(t) {
- if (this._prepared) t && t();
- else {
- var e = this.config.jsList;
- if (e && e.length > 0) {
- var i = this;
- cc.loader.load(e, (function(e) {
- if (e) throw new Error(JSON.stringify(e));
- i._prepareFinished(t)
- }))
- } else this._prepareFinished(t)
- }
- },
- run: function(t, e) {
- this._initConfig(t), this.onStart = e, this.prepare(a.onStart && a.onStart.bind(a))
- },
- addPersistRootNode: function(t) {
- if (cc.Node.isNode(t) && t.uuid) {
- var e = t.uuid;
- if (!this._persistRootNodes[e]) {
- var i = cc.director._scene;
- if (cc.isValid(i))
- if (t.parent) {
- if (!(t.parent instanceof cc.Scene)) return void cc.warnID(3801);
- if (t.parent !== i) return void cc.warnID(3802)
- } else t.parent = i;
- this._persistRootNodes[e] = t, t._persistNode = !0
- }
- } else cc.warnID(3800)
- },
- removePersistRootNode: function(t) {
- var e = t.uuid || "";
- t === this._persistRootNodes[e] && (delete this._persistRootNodes[e], t._persistNode = !1)
- },
- isPersistRootNode: function(t) {
- return t._persistNode
- },
- _setAnimFrame: function() {
- this._lastTime = performance.now();
- var t = a.config.frameRate;
- this._frameTime = 1e3 / t, 60 !== t && 30 !== t ? (window.requestAnimFrame = this._stTime, window.cancelAnimFrame = this._ctTime) : (window.requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || this._stTime, window.cancelAnimFrame = window.cancelAnimationFrame || window.cancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.msCancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.oCancelAnimationFrame || this._ctTime)
- },
- _stTime: function(t) {
- var e = performance.now(),
- i = Math.max(0, a._frameTime - (e - a._lastTime)),
- n = window.setTimeout((function() {
- t()
- }), i);
- return a._lastTime = e + i, n
- },
- _ctTime: function(t) {
- window.clearTimeout(t)
- },
- _runMainLoop: function() {
- if (this._prepared) {
- var t, e = this,
- i = e.config,
- n = cc.director,
- s = !0,
- o = i.frameRate;
- r.setDisplayStats(i.showFPS), t = function(i) {
- if (!e._paused) {
- if (e._intervalId = window.requestAnimFrame(t), 30 === o && (s = !s)) return;
- n.mainLoop(i)
- }
- }, e._intervalId = window.requestAnimFrame(t), e._paused = !1
- }
- },
- _initConfig: function(t) {
- "number" != typeof t.debugMode && (t.debugMode = 0), t.exposeClassName = !!t.exposeClassName, "number" != typeof t.frameRate && (t.frameRate = 60);
- var e = t.renderMode;
- ("number" != typeof e || e > 2 || e < 0) && (t.renderMode = 0), "boolean" != typeof t.registerSystemEvent && (t.registerSystemEvent = !0), t.showFPS = !!t.showFPS, this._sceneInfos = t.scenes || [], this.collisionMatrix = t.collisionMatrix || [], this.groupList = t.groupList || [], r._resetDebugSetting(t.debugMode), this.config = t, this._configLoaded = !0
- },
- _determineRenderType: function() {
- var t = this.config,
- e = parseInt(t.renderMode) || 0;
- this.renderType = this.RENDER_TYPE_CANVAS;
- var i = !1;
- if (0 === e ? cc.sys.capabilities.opengl ? (this.renderType = this.RENDER_TYPE_WEBGL, i = !0) : cc.sys.capabilities.canvas && (this.renderType = this.RENDER_TYPE_CANVAS, i = !0) : 1 === e && cc.sys.capabilities.canvas ? (this.renderType = this.RENDER_TYPE_CANVAS, i = !0) : 2 === e && cc.sys.capabilities.opengl && (this.renderType = this.RENDER_TYPE_WEBGL, i = !0), !i) throw new Error(r.getError(3820, e))
- },
- _initRenderer: function() {
- if (!this._rendererInitialized) {
- var t = this.config.id,
- e = void 0,
- i = void 0,
- n = void 0,
- r = void 0,
- a = t instanceof HTMLElement ? t : document.querySelector(t) || document.querySelector("#" + t);
- if ("CANVAS" === a.tagName ? (e = a.width, i = a.height, this.canvas = n = a, this.container = r = document.createElement("DIV"), n.parentNode && n.parentNode.insertBefore(r, n)) : ("DIV" !== a.tagName && cc.warnID(3819), e = a.clientWidth, i = a.clientHeight, this.canvas = n = document.createElement("CANVAS"), this.container = r = document.createElement("DIV"), a.appendChild(r)), r.setAttribute("id", "Cocos2dGameContainer"), r.appendChild(n), this.frame = r.parentNode === document.body ? document.documentElement : r.parentNode, (function(t, e) {
- (" " + t.className + " ").indexOf(" " + e + " ") > -1 || (t.className && (t.className += " "), t.className += e)
- })(n, "gameCanvas"), n.setAttribute("width", e || 480), n.setAttribute("height", i || 320), n.setAttribute("tabindex", 99), this._determineRenderType(), this.renderType === this.RENDER_TYPE_WEBGL) {
- var l = {
- stencil: !0,
- antialias: cc.macro.ENABLE_WEBGL_ANTIALIAS,
- alpha: cc.macro.ENABLE_TRANSPARENT_CANVAS
- };
- s.initWebGL(n, l), this._renderContext = s.device._gl, !cc.macro.CLEANUP_IMAGE_CACHE && o && (o.enabled = !0)
- }
- this._renderContext || (this.renderType = this.RENDER_TYPE_CANVAS, s.initCanvas(n), this._renderContext = s.device._ctx), this.canvas.oncontextmenu = function() {
- if (!cc._isContextMenuEnable) return !1
- }, this._rendererInitialized = !0
- }
- },
- _initEvents: function() {
- var t, e = window;
- this.config.registerSystemEvent && _cc.inputManager.registerSystemEvent(this.canvas), void 0 !== document.hidden ? t = "hidden" : void 0 !== document.mozHidden ? t = "mozHidden" : void 0 !== document.msHidden ? t = "msHidden" : void 0 !== document.webkitHidden && (t = "webkitHidden");
- var i = !1;
- function n() {
- i || (i = !0, a.emit(a.EVENT_HIDE))
- }
- function r(t, e, n, r, s) {
- i && (i = !1, a.emit(a.EVENT_SHOW, t, e, n, r, s))
- }
- if (t)
- for (var s = ["visibilitychange", "mozvisibilitychange", "msvisibilitychange", "webkitvisibilitychange", "qbrowserVisibilityChange"], o = 0; o < s.length; o++) document.addEventListener(s[o], (function(e) {
- var i = document[t];
- (i = i || e.hidden) ? n(): r()
- }));
- else e.addEventListener("blur", n), e.addEventListener("focus", r);
- navigator.userAgent.indexOf("MicroMessenger") > -1 && (e.onfocus = r), "onpageshow" in window && "onpagehide" in window && (e.addEventListener("pagehide", n), e.addEventListener("pageshow", r), document.addEventListener("pagehide", n), document.addEventListener("pageshow", r)), this.on(a.EVENT_HIDE, (function() {
- a.pause()
- })), this.on(a.EVENT_SHOW, (function() {
- a.resume()
- }))
- }
- };
- n.call(a), cc.js.addon(a, n.prototype), cc.game = e.exports = a
- }), {
- "../audio/CCAudioEngine": 21,
- "../core/renderer/utils/dynamic-atlas/manager": 250,
- "./CCDebug": 49,
- "./event/event-target": 131,
- "./renderer/index.js": 247
- }],
- 52: [(function(t, e, i) {
- "use strict";
- var n = t("./vmath"),
- r = t("./utils/base-node"),
- s = t("./utils/prefab-helper"),
- o = t("./utils/trans-pool").NodeMemPool,
- a = t("./utils/affine-transform"),
- l = t("./event-manager"),
- h = t("./platform/CCMacro"),
- c = t("./platform/js"),
- u = (t("./event/event"), t("./event/event-target")),
- _ = t("./renderer/render-flow"),
- f = cc.Object.Flags.Destroying,
- d = Math.PI / 180,
- p = !!cc.ActionManager,
- m = function() {},
- y = cc.v3(),
- v = cc.quat(),
- g = cc.v3(),
- x = cc.v3(),
- b = cc.quat(),
- A = cc.quat(),
- C = cc.v3(),
- T = cc.v3(),
- S = cc.v3(),
- w = cc.v3(),
- E = cc.v3(),
- M = cc.quat(),
- D = cc.quat(),
- B = cc.v3(),
- I = n.quat.create(),
- P = cc.v3(),
- R = cc.v3(),
- O = cc.quat(),
- L = cc.quat(),
- F = (cc.quat(), n.mat4.create()),
- N = n.vec3.create(),
- V = new Array(16);
- V.length = 0;
- var k = cc.Enum({
- DEBUG: 31
- }),
- G = cc.Enum({
- POSITION: 1,
- SCALE: 2,
- ROTATION: 4,
- SKEW: 8,
- TRS: 7,
- RS: 6,
- ALL: 65535
- }),
- U = cc.Enum({
- TOUCH_START: "touchstart",
- TOUCH_MOVE: "touchmove",
- TOUCH_END: "touchend",
- TOUCH_CANCEL: "touchcancel",
- MOUSE_DOWN: "mousedown",
- MOUSE_MOVE: "mousemove",
- MOUSE_ENTER: "mouseenter",
- MOUSE_LEAVE: "mouseleave",
- MOUSE_UP: "mouseup",
- MOUSE_WHEEL: "mousewheel",
- POSITION_CHANGED: "position-changed",
- ROTATION_CHANGED: "rotation-changed",
- SCALE_CHANGED: "scale-changed",
- SIZE_CHANGED: "size-changed",
- ANCHOR_CHANGED: "anchor-changed",
- COLOR_CHANGED: "color-changed",
- CHILD_ADDED: "child-added",
- CHILD_REMOVED: "child-removed",
- CHILD_REORDER: "child-reorder",
- GROUP_CHANGED: "group-changed",
- SIBLING_ORDER_CHANGED: "sibling-order-changed"
- }),
- z = [U.TOUCH_START, U.TOUCH_MOVE, U.TOUCH_END, U.TOUCH_CANCEL],
- j = [U.MOUSE_DOWN, U.MOUSE_ENTER, U.MOUSE_MOVE, U.MOUSE_LEAVE, U.MOUSE_UP, U.MOUSE_WHEEL],
- W = !0,
- H = function(t, e) {
- if (0 !== t) {
- var i = "";
- W && cc.warn("`cc.Node.skewX/Y` is deprecated since v2.2.1, please use 3D node instead.", i), W = !1
- }
- },
- X = null,
- Y = function(t, e) {
- var i = t.getLocation(),
- n = this.owner;
- return !!n._hitTest(i, this) && (e.type = U.TOUCH_START, e.touch = t, e.bubbles = !0, n.dispatchEvent(e), !0)
- },
- q = function(t, e) {
- var i = this.owner;
- e.type = U.TOUCH_MOVE, e.touch = t, e.bubbles = !0, i.dispatchEvent(e)
- },
- J = function(t, e) {
- var i = t.getLocation(),
- n = this.owner;
- n._hitTest(i, this) ? e.type = U.TOUCH_END : e.type = U.TOUCH_CANCEL, e.touch = t, e.bubbles = !0, n.dispatchEvent(e)
- },
- Z = function(t, e) {
- t.getLocation();
- var i = this.owner;
- e.type = U.TOUCH_CANCEL, e.touch = t, e.bubbles = !0, i.dispatchEvent(e)
- },
- K = function(t) {
- var e = t.getLocation(),
- i = this.owner;
- i._hitTest(e, this) && (t.type = U.MOUSE_DOWN, t.bubbles = !0, i.dispatchEvent(t))
- },
- Q = function(t) {
- var e = t.getLocation(),
- i = this.owner;
- if (i._hitTest(e, this)) this._previousIn || (X && X._mouseListener && (t.type = U.MOUSE_LEAVE, X.dispatchEvent(t), X._mouseListener._previousIn = !1), X = this.owner, t.type = U.MOUSE_ENTER, i.dispatchEvent(t), this._previousIn = !0), t.type = U.MOUSE_MOVE, t.bubbles = !0, i.dispatchEvent(t);
- else {
- if (!this._previousIn) return;
- t.type = U.MOUSE_LEAVE, i.dispatchEvent(t), this._previousIn = !1, X = null
- }
- t.stopPropagation()
- },
- $ = function(t) {
- var e = t.getLocation(),
- i = this.owner;
- i._hitTest(e, this) && (t.type = U.MOUSE_UP, t.bubbles = !0, i.dispatchEvent(t), t.stopPropagation())
- },
- tt = function(t) {
- var e = t.getLocation(),
- i = this.owner;
- i._hitTest(e, this) && (t.type = U.MOUSE_WHEEL, t.bubbles = !0, i.dispatchEvent(t), t.stopPropagation())
- };
- function et(t) {
- var e = cc.Mask;
- if (e)
- for (var i = 0, n = t; n && cc.Node.isNode(n); n = n._parent, ++i)
- if (n.getComponent(e)) return {
- index: i,
- node: n
- };
- return null
- }
- function it(t, e) {
- if (!(t._objFlags & f)) {
- var i = 0;
- if (t._bubblingListeners)
- for (; i < e.length; ++i)
- if (t._bubblingListeners.hasEventListener(e[i])) return !0;
- if (t._capturingListeners)
- for (; i < e.length; ++i)
- if (t._capturingListeners.hasEventListener(e[i])) return !0;
- return !1
- }
- return !0
- }
- function nt(t, e) {
- var i, n;
- for (e.target = t, V.length = 0, t._getCapturingTargets(e.type, V), e.eventPhase = 1, n = V.length - 1; n >= 0; --n)
- if ((i = V[n])._capturingListeners && (e.currentTarget = i, i._capturingListeners.emit(e.type, e, V), e._propagationStopped)) return void(V.length = 0);
- if (V.length = 0, e.eventPhase = 2, e.currentTarget = t, t._capturingListeners && t._capturingListeners.emit(e.type, e), !e._propagationImmediateStopped && t._bubblingListeners && t._bubblingListeners.emit(e.type, e), !e._propagationStopped && e.bubbles)
- for (t._getBubblingTargets(e.type, V), e.eventPhase = 3, n = 0; n < V.length; ++n)
- if ((i = V[n])._bubblingListeners && (e.currentTarget = i, i._bubblingListeners.emit(e.type, e), e._propagationStopped)) return void(V.length = 0);
- V.length = 0
- }
- function rt(t) {
- var e = t.groupIndex;
- return 0 === e && t.parent && (e = rt(t.parent)), e
- }
- function st(t) {
- var e = rt(t);
- t._cullingMask = 1 << e;
- for (var i = 0; i < t._children.length; i++) st(t._children[i])
- }
- var ot = {
- name: "cc.Node",
- extends: r,
- properties: {
- _opacity: 255,
- _color: cc.Color.WHITE,
- _contentSize: cc.Size,
- _anchorPoint: cc.v2(.5, .5),
- _position: void 0,
- _scale: void 0,
- _trs: null,
- _eulerAngles: cc.Vec3,
- _skewX: 0,
- _skewY: 0,
- _zIndex: {
- default: void 0,
- type: cc.Integer
- },
- _localZOrder: {
- default: 0,
- serializable: !1
- },
- _is3DNode: !1,
- _groupIndex: {
- default: 0,
- formerlySerializedAs: "groupIndex"
- },
- groupIndex: {
- get: function() {
- return this._groupIndex
- },
- set: function(t) {
- this._groupIndex = t, st(this), this.emit(U.GROUP_CHANGED, this)
- }
- },
- group: {
- get: function() {
- return cc.game.groupList[this.groupIndex] || ""
- },
- set: function(t) {
- this.groupIndex = cc.game.groupList.indexOf(t)
- }
- },
- x: {
- get: function() {
- return this._trs[0]
- },
- set: function(t) {
- var e = this._trs;
- if (t !== e[0]) {
- e[0] = t, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
- }
- }
- },
- y: {
- get: function() {
- return this._trs[1]
- },
- set: function(t) {
- var e = this._trs;
- if (t !== e[1]) {
- e[1] = t, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
- }
- }
- },
- rotation: {
- get: function() {
- return -this.angle
- },
- set: function(t) {
- this.angle = -t
- }
- },
- angle: {
- get: function() {
- return this._eulerAngles.z
- },
- set: function(t) {
- n.vec3.set(this._eulerAngles, 0, 0, t), n.trs.fromAngleZ(this._trs, t), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED)
- }
- },
- rotationX: {
- get: function() {
- return this._eulerAngles.x
- },
- set: function(t) {
- this._eulerAngles.x !== t && (this._eulerAngles.x = t, this._eulerAngles.x === this._eulerAngles.y ? n.trs.fromAngleZ(this._trs, -t) : n.trs.fromEulerNumber(this._trs, t, this._eulerAngles.y, 0), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
- }
- },
- rotationY: {
- get: function() {
- return this._eulerAngles.y
- },
- set: function(t) {
- this._eulerAngles.y !== t && (this._eulerAngles.y = t, this._eulerAngles.x === this._eulerAngles.y ? n.trs.fromAngleZ(this._trs, -t) : n.trs.fromEulerNumber(this._trs, this._eulerAngles.x, t, 0), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
- }
- },
- scale: {
- get: function() {
- return this._trs[7]
- },
- set: function(t) {
- this.setScale(t)
- }
- },
- scaleX: {
- get: function() {
- return this._trs[7]
- },
- set: function(t) {
- this._trs[7] !== t && (this._trs[7] = t, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
- }
- },
- scaleY: {
- get: function() {
- return this._trs[8]
- },
- set: function(t) {
- this._trs[8] !== t && (this._trs[8] = t, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
- }
- },
- skewX: {
- get: function() {
- return this._skewX
- },
- set: function(t) {
- H(t), this._skewX = t, this.setLocalDirty(G.SKEW)
- }
- },
- skewY: {
- get: function() {
- return this._skewY
- },
- set: function(t) {
- H(t), this._skewY = t, this.setLocalDirty(G.SKEW)
- }
- },
- opacity: {
- get: function() {
- return this._opacity
- },
- set: function(t) {
- t = cc.misc.clampf(t, 0, 255), this._opacity !== t && (this._opacity = t, this._renderFlag |= _.FLAG_OPACITY_COLOR)
- },
- range: [0, 255]
- },
- color: {
- get: function() {
- return this._color.clone()
- },
- set: function(t) {
- this._color.equals(t) || (this._color.set(t), this._renderFlag |= _.FLAG_COLOR, 32 & this._eventMask && this.emit(U.COLOR_CHANGED, t))
- }
- },
- anchorX: {
- get: function() {
- return this._anchorPoint.x
- },
- set: function(t) {
- var e = this._anchorPoint;
- e.x !== t && (e.x = t, 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED))
- }
- },
- anchorY: {
- get: function() {
- return this._anchorPoint.y
- },
- set: function(t) {
- var e = this._anchorPoint;
- e.y !== t && (e.y = t, 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED))
- }
- },
- width: {
- get: function() {
- return this._contentSize.width
- },
- set: function(t) {
- t !== this._contentSize.width && (this._contentSize.width = t, 8 & this._eventMask && this.emit(U.SIZE_CHANGED))
- }
- },
- height: {
- get: function() {
- return this._contentSize.height
- },
- set: function(t) {
- t !== this._contentSize.height && (this._contentSize.height = t, 8 & this._eventMask && this.emit(U.SIZE_CHANGED))
- }
- },
- zIndex: {
- get: function() {
- return this._localZOrder >> 16
- },
- set: function(t) {
- t > h.MAX_ZINDEX ? (cc.warnID(1636), t = h.MAX_ZINDEX) : t < h.MIN_ZINDEX && (cc.warnID(1637), t = h.MIN_ZINDEX), this.zIndex !== t && (this._localZOrder = 65535 & this._localZOrder | t << 16, this.emit(U.SIBLING_ORDER_CHANGED), this._parent && this._onSiblingIndexChanged())
- }
- }
- },
- ctor: function() {
- this._reorderChildDirty = !1, this._widget = null, this._renderComponent = null, this._capturingListeners = null, this._bubblingListeners = null, this._touchListener = null, this._mouseListener = null, this._initDataFromPool(), this._eventMask = 0, this._cullingMask = 1, this._childArrivalOrder = 1, this._renderFlag = _.FLAG_TRANSFORM | _.FLAG_OPACITY_COLOR
- },
- statics: {
- EventType: U,
- _LocalDirtyFlag: G,
- isNode: function(t) {
- return t instanceof at && (t.constructor === at || !(t instanceof cc.Scene))
- },
- BuiltinGroupIndex: k
- },
- _onSiblingIndexChanged: function() {
- for (var t = this._parent, e = t._children, i = 0, n = e.length; i < n; i++) e[i]._updateOrderOfArrival();
- t._delaySort()
- },
- _onPreDestroy: function() {
- this._onPreDestroyBase();
- p && cc.director.getActionManager().removeAllActionsFromTarget(this), X === this && (X = null), (this._touchListener || this._mouseListener) && (l.removeListeners(this), this._touchListener && (this._touchListener.owner = null, this._touchListener.mask = null, this._touchListener = null), this._mouseListener && (this._mouseListener.owner = null, this._mouseListener.mask = null, this._mouseListener = null)), this._backDataIntoPool(), this._reorderChildDirty && cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this)
- },
- _onPostActivated: function(t) {
- var e = p ? cc.director.getActionManager() : null;
- if (t)
- if (this._renderFlag |= _.FLAG_WORLD_TRANSFORM, e && e.resumeTarget(this), l.resumeTarget(this), this._touchListener) {
- var i = this._touchListener.mask = et(this);
- this._mouseListener && (this._mouseListener.mask = i)
- } else this._mouseListener && (this._mouseListener.mask = et(this));
- else e && e.pauseTarget(this), l.pauseTarget(this)
- },
- _onHierarchyChanged: function(t) {
- this._updateOrderOfArrival(), st(this), this._parent && this._parent._delaySort(), this._renderFlag |= _.FLAG_WORLD_TRANSFORM, this._onHierarchyChangedBase(t), cc._widgetManager && (cc._widgetManager._nodesOrderDirty = !0)
- },
- _initDataFromPool: function() {
- this._spaceInfo || (this._spaceInfo = o.pop());
- var t = this._spaceInfo;
- this._matrix = n.mat4.create(t.localMat), n.mat4.identity(this._matrix), this._worldMatrix = n.mat4.create(t.worldMat), n.mat4.identity(this._worldMatrix), this._localMatDirty = G.ALL, this._worldMatDirty = !0;
- var e = this._trs = this._spaceInfo.trs;
- e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 0, e[6] = 1, e[7] = 1, e[8] = 1, e[9] = 1
- },
- _backDataIntoPool: function() {
- o.push(this._spaceInfo), this._matrix = null, this._worldMatrix = null, this._trs = null, this._spaceInfo = null
- },
- _toEuler: function() {
- if (this.is3DNode) n.trs.toEuler(this._eulerAngles, this._trs);
- else {
- var t = Math.asin(this._trs[5]) / d * 2;
- n.vec3.set(this._eulerAngles, 0, 0, t)
- }
- },
- _fromEuler: function() {
- this.is3DNode ? n.trs.fromEuler(this._trs, this._eulerAngles) : n.trs.fromAngleZ(this._trs, this._eulerAngles.z)
- },
- _upgrade_1x_to_2x: function() {
- var t = this._trs;
- if (t) {
- var e = t;
- t = this._trs = this._spaceInfo.trs, 11 === e.length ? t.set(e.subarray(1)) : t.set(e)
- } else t = this._trs = this._spaceInfo.trs;
- void 0 !== this._zIndex && (this._localZOrder = this._zIndex << 16, this._zIndex = void 0), this._fromEuler(), 0 !== this._localZOrder && (this._zIndex = (4294901760 & this._localZOrder) >> 16), this._color.a < 255 && 255 === this._opacity && (this._opacity = this._color.a, this._color.a = 255)
- },
- _onBatchCreated: function() {
- var t = this._prefab;
- t && t.sync && t.root === this && s.syncWithPrefab(this), this._upgrade_1x_to_2x(), this._updateOrderOfArrival(), this._cullingMask = 1 << rt(this), this._activeInHierarchy || (p && cc.director.getActionManager().pauseTarget(this), l.pauseTarget(this));
- for (var e = this._children, i = 0, n = e.length; i < n; i++) e[i]._onBatchCreated();
- e.length > 0 && (this._renderFlag |= _.FLAG_CHILDREN)
- },
- _onBatchRestored: function() {
- if (this._upgrade_1x_to_2x(), this._cullingMask = 1 << rt(this), !this._activeInHierarchy) {
- var t = cc.director.getActionManager();
- t && t.pauseTarget(this), l.pauseTarget(this)
- }
- for (var e = this._children, i = 0, n = e.length; i < n; i++) e[i]._onBatchRestored();
- e.length > 0 && (this._renderFlag |= _.FLAG_CHILDREN)
- },
- _checknSetupSysEvent: function(t) {
- var e = !1,
- i = !1;
- return -1 !== z.indexOf(t) ? (this._touchListener || (this._touchListener = cc.EventListener.create({
- event: cc.EventListener.TOUCH_ONE_BY_ONE,
- swallowTouches: !0,
- owner: this,
- mask: et(this),
- onTouchBegan: Y,
- onTouchMoved: q,
- onTouchEnded: J,
- onTouchCancelled: Z
- }), l.addListener(this._touchListener, this), e = !0), i = !0) : -1 !== j.indexOf(t) && (this._mouseListener || (this._mouseListener = cc.EventListener.create({
- event: cc.EventListener.MOUSE,
- _previousIn: !1,
- owner: this,
- mask: et(this),
- onMouseDown: K,
- onMouseMove: Q,
- onMouseUp: $,
- onMouseScroll: tt
- }), l.addListener(this._mouseListener, this), e = !0), i = !0), e && !this._activeInHierarchy && cc.director.getScheduler().schedule((function() {
- this._activeInHierarchy || l.pauseTarget(this)
- }), this, 0, 0, 0, !1), i
- },
- on: function(t, e, i, n) {
- if (this._checknSetupSysEvent(t)) return this._onDispatch(t, e, i, n);
- switch (t) {
- case U.POSITION_CHANGED:
- this._eventMask |= 1;
- break;
- case U.SCALE_CHANGED:
- this._eventMask |= 2;
- break;
- case U.ROTATION_CHANGED:
- this._eventMask |= 4;
- break;
- case U.SIZE_CHANGED:
- this._eventMask |= 8;
- break;
- case U.ANCHOR_CHANGED:
- this._eventMask |= 16;
- break;
- case U.COLOR_CHANGED:
- this._eventMask |= 32
- }
- return this._bubblingListeners || (this._bubblingListeners = new u), this._bubblingListeners.on(t, e, i)
- },
- once: function(t, e, i, n) {
- (this._checknSetupSysEvent(t) && n ? this._capturingListeners = this._capturingListeners || new u : this._bubblingListeners = this._bubblingListeners || new u).once(t, e, i)
- },
- _onDispatch: function(t, e, i, n) {
- if ("boolean" == typeof i ? (n = i, i = void 0) : n = !!n, e) {
- var r = null;
- return (r = n ? this._capturingListeners = this._capturingListeners || new u : this._bubblingListeners = this._bubblingListeners || new u).hasEventListener(t, e, i) || (r.on(t, e, i), i && i.__eventTargets && i.__eventTargets.push(this)), e
- }
- cc.errorID(6800)
- },
- off: function(t, e, i, n) {
- var r = -1 !== z.indexOf(t),
- s = !r && -1 !== j.indexOf(t);
- if (r || s) this._offDispatch(t, e, i, n), r ? this._touchListener && !it(this, z) && (l.removeListener(this._touchListener), this._touchListener = null) : s && this._mouseListener && !it(this, j) && (l.removeListener(this._mouseListener), this._mouseListener = null);
- else if (this._bubblingListeners) {
- if (this._bubblingListeners.off(t, e, i), !this._bubblingListeners.hasEventListener(t)) switch (t) {
- case U.POSITION_CHANGED:
- this._eventMask &= -2;
- break;
- case U.SCALE_CHANGED:
- this._eventMask &= -3;
- break;
- case U.ROTATION_CHANGED:
- this._eventMask &= -5;
- break;
- case U.SIZE_CHANGED:
- this._eventMask &= -9;
- break;
- case U.ANCHOR_CHANGED:
- this._eventMask &= -17;
- break;
- case U.COLOR_CHANGED:
- this._eventMask &= -33
- }
- }
- },
- _offDispatch: function(t, e, i, n) {
- if ("boolean" == typeof i ? (n = i, i = void 0) : n = !!n, e) {
- var r = n ? this._capturingListeners : this._bubblingListeners;
- r && (r.off(t, e, i), i && i.__eventTargets && c.array.fastRemove(i.__eventTargets, this))
- } else this._capturingListeners && this._capturingListeners.removeAll(t), this._bubblingListeners && this._bubblingListeners.removeAll(t)
- },
- targetOff: function(t) {
- var e = this._bubblingListeners;
- e && (e.targetOff(t), 1 & this._eventMask && !e.hasEventListener(U.POSITION_CHANGED) && (this._eventMask &= -2), 2 & this._eventMask && !e.hasEventListener(U.SCALE_CHANGED) && (this._eventMask &= -3), 4 & this._eventMask && !e.hasEventListener(U.ROTATION_CHANGED) && (this._eventMask &= -5), 8 & this._eventMask && !e.hasEventListener(U.SIZE_CHANGED) && (this._eventMask &= -9), 16 & this._eventMask && !e.hasEventListener(U.ANCHOR_CHANGED) && (this._eventMask &= -17), 32 & this._eventMask && !e.hasEventListener(U.COLOR_CHANGED) && (this._eventMask &= -33)), this._capturingListeners && this._capturingListeners.targetOff(t), t && t.__eventTargets && c.array.fastRemove(t.__eventTargets, this), this._touchListener && !it(this, z) && (l.removeListener(this._touchListener), this._touchListener = null), this._mouseListener && !it(this, j) && (l.removeListener(this._mouseListener), this._mouseListener = null)
- },
- hasEventListener: function(t) {
- var e = !1;
- return this._bubblingListeners && (e = this._bubblingListeners.hasEventListener(t)), !e && this._capturingListeners && (e = this._capturingListeners.hasEventListener(t)), e
- },
- emit: function(t, e, i, n, r, s) {
- this._bubblingListeners && this._bubblingListeners.emit(t, e, i, n, r, s)
- },
- dispatchEvent: function(t) {
- nt(this, t), V.length = 0
- },
- pauseSystemEvents: function(t) {
- l.pauseTarget(this, t)
- },
- resumeSystemEvents: function(t) {
- l.resumeTarget(this, t)
- },
- _hitTest: function(t, e) {
- var i = this._contentSize.width,
- r = this._contentSize.height,
- s = P,
- o = R,
- a = cc.Camera.findCamera(this);
- if (a ? a.getScreenToWorldPoint(t, s) : s.set(t), this._updateWorldMatrix(), !n.mat4.invert(F, this._worldMatrix)) return !1;
- if (n.vec2.transformMat4(o, s, F), o.x += this._anchorPoint.x * i, o.y += this._anchorPoint.y * r, o.x >= 0 && o.y >= 0 && o.x <= i && o.y <= r) {
- if (e && e.mask) {
- for (var l = e.mask, h = this, c = 0; h && c < l.index; ++c, h = h.parent);
- if (h === l.node) {
- var u = h.getComponent(cc.Mask);
- return !u || !u.enabledInHierarchy || u._hitTest(s)
- }
- return e.mask = null, !0
- }
- return !0
- }
- return !1
- },
- _getCapturingTargets: function(t, e) {
- for (var i = this.parent; i;) i._capturingListeners && i._capturingListeners.hasEventListener(t) && e.push(i), i = i.parent
- },
- _getBubblingTargets: function(t, e) {
- for (var i = this.parent; i;) i._bubblingListeners && i._bubblingListeners.hasEventListener(t) && e.push(i), i = i.parent
- },
- runAction: p ? function(t) {
- if (this.active) return cc.assertID(t, 1618), cc.director.getActionManager().addAction(t, this, !1), t
- } : m,
- pauseAllActions: p ? function() {
- cc.director.getActionManager().pauseTarget(this)
- } : m,
- resumeAllActions: p ? function() {
- cc.director.getActionManager().resumeTarget(this)
- } : m,
- stopAllActions: p ? function() {
- cc.director.getActionManager().removeAllActionsFromTarget(this)
- } : m,
- stopAction: p ? function(t) {
- cc.director.getActionManager().removeAction(t)
- } : m,
- stopActionByTag: p ? function(t) {
- t !== cc.Action.TAG_INVALID ? cc.director.getActionManager().removeActionByTag(t, this) : cc.logID(1612)
- } : m,
- getActionByTag: p ? function(t) {
- return t === cc.Action.TAG_INVALID ? (cc.logID(1613), null) : cc.director.getActionManager().getActionByTag(t, this)
- } : function() {
- return null
- },
- getNumberOfRunningActions: p ? function() {
- return cc.director.getActionManager().getNumberOfRunningActionsInTarget(this)
- } : function() {
- return 0
- },
- getPosition: function(t) {
- return t = t || cc.v3(), n.trs.toPosition(t, this._trs)
- },
- setPosition: function(t, e) {
- var i;
- void 0 === e ? (i = t.x, e = t.y) : i = t;
- var n = this._trs;
- n[0] === i && n[1] === e || (n[0] = i, n[1] = e, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED))
- },
- getScale: function(t) {
- return void 0 !== t ? n.trs.toScale(t, this._trs) : (cc.warnID(1400, "cc.Node.getScale", "cc.Node.scale or cc.Node.getScale(cc.Vec3)"), this._trs[7])
- },
- setScale: function(t, e) {
- t && "number" != typeof t ? (e = t.y, t = t.x) : void 0 === e && (e = t);
- var i = this._trs;
- i[7] === t && i[8] === e || (i[7] = t, i[8] = e, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
- },
- getRotation: function(t) {
- return t instanceof cc.Quat ? n.trs.toRotation(t, this._trs) : -this.angle
- },
- setRotation: function(t, e, i, n) {
- if ("number" == typeof t && void 0 === e) this.angle = -t;
- else {
- var r = t;
- void 0 === e && (r = t.x, e = t.y, i = t.z, n = t.w);
- var s = this._trs;
- s[3] === r && s[4] === e && s[5] === i && s[6] === n || (s[3] = r, s[4] = e, s[5] = i, s[6] = n, this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
- }
- },
- getContentSize: function() {
- return cc.size(this._contentSize.width, this._contentSize.height)
- },
- setContentSize: function(t, e) {
- var i = this._contentSize;
- if (void 0 === e) {
- if (t.width === i.width && t.height === i.height) return;
- 0, i.width = t.width, i.height = t.height
- } else {
- if (t === i.width && e === i.height) return;
- 0, i.width = t, i.height = e
- }
- 8 & this._eventMask && this.emit(U.SIZE_CHANGED)
- },
- getAnchorPoint: function() {
- return cc.v2(this._anchorPoint)
- },
- setAnchorPoint: function(t, e) {
- var i = this._anchorPoint;
- if (void 0 === e) {
- if (t.x === i.x && t.y === i.y) return;
- i.x = t.x, i.y = t.y
- } else {
- if (t === i.x && e === i.y) return;
- i.x = t, i.y = e
- }
- this.setLocalDirty(G.POSITION), 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED)
- },
- _invTransformPoint: function(t, e) {
- this._parent ? this._parent._invTransformPoint(t, e) : n.vec3.copy(t, e);
- var i = this._trs;
- return n.trs.toPosition(g, i), n.vec3.sub(t, t, g), n.trs.toRotation(b, i), n.quat.conjugate(A, b), n.vec3.transformQuat(t, t, A), n.trs.toScale(g, i), n.vec3.inverseSafe(x, g), n.vec3.mul(t, t, x), t
- },
- getWorldPosition: function(t) {
- n.trs.toPosition(t, this._trs);
- for (var e = this._parent, i = void 0; e;) i = e._trs, n.trs.toScale(y, i), n.vec3.mul(t, t, y), n.trs.toRotation(v, i), n.vec3.transformQuat(t, t, v), n.trs.toPosition(y, i), n.vec3.add(t, t, y), e = e._parent;
- return t
- },
- setWorldPosition: function(t) {
- var e = this._trs;
- this._parent ? this._parent._invTransformPoint(C, t) : n.vec3.copy(C, t), n.trs.fromPosition(e, C), this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
- },
- getWorldRotation: function(t) {
- n.trs.toRotation(O, this._trs), n.quat.copy(t, O);
- for (var e = this._parent; e;) n.trs.toRotation(O, e._trs), n.quat.mul(t, O, t), e = e._parent;
- return t
- },
- setWorldRotation: function(t) {
- this._parent ? (this._parent.getWorldRotation(L), n.quat.conjugate(L, L), n.quat.mul(L, L, t)) : n.quat.copy(L, t), n.trs.fromRotation(this._trs, L), this.setLocalDirty(G.ROTATION)
- },
- getWorldScale: function(t) {
- n.trs.toScale(T, this._trs), n.vec3.copy(t, T);
- for (var e = this._parent; e;) n.trs.toScale(T, e._trs), n.vec3.mul(t, t, T), e = e._parent;
- return t
- },
- setWorldScale: function(t) {
- this._parent ? (this._parent.getWorldScale(S), n.vec3.div(S, t, S)) : n.vec3.copy(S, t), n.trs.fromScale(this._trs, S), this.setLocalDirty(G.SCALE)
- },
- getWorldRT: function(t) {
- var e = w,
- i = M,
- r = this._trs;
- n.trs.toPosition(e, r), n.trs.toRotation(i, r);
- for (var s = this._parent; s;) r = s._trs, n.trs.toScale(E, r), n.vec3.mul(e, e, E), n.trs.toRotation(D, r), n.vec3.transformQuat(e, e, D), n.trs.toPosition(E, r), n.vec3.add(e, e, E), n.quat.mul(i, D, i), s = s._parent;
- return n.mat4.fromRT(t, i, e), t
- },
- lookAt: function(t, e) {
- this.getWorldPosition(B), n.vec3.sub(B, B, t), n.vec3.normalize(B, B), n.quat.fromViewUp(I, B, e), this.setWorldRotation(I)
- },
- _updateLocalMatrix: function() {
- var t = this._localMatDirty;
- if (t) {
- var e = this._matrix.m,
- i = this._trs;
- if (t & (G.RS | G.SKEW)) {
- var n = -this._eulerAngles.z,
- r = this._skewX || this._skewY,
- s = i[7],
- o = i[8];
- if (n || r) {
- var a = 1,
- l = 0,
- h = 0,
- c = 1;
- if (n) {
- var u = n * d;
- h = Math.sin(u), a = c = Math.cos(u), l = -h
- }
- if (e[0] = a *= s, e[1] = l *= s, e[4] = h *= o, e[5] = c *= o, r) {
- var _ = e[0],
- f = e[1],
- p = e[4],
- m = e[5],
- y = Math.tan(this._skewX * d),
- v = Math.tan(this._skewY * d);
- y === 1 / 0 && (y = 99999999), v === 1 / 0 && (v = 99999999), e[0] = _ + p * v, e[1] = f + m * v, e[4] = p + _ * y, e[5] = m + f * y
- }
- } else e[0] = s, e[1] = 0, e[4] = 0, e[5] = o
- }
- e[12] = i[0], e[13] = i[1], this._localMatDirty = 0, this._worldMatDirty = !0
- }
- },
- _calculWorldMatrix: function() {
- this._localMatDirty && this._updateLocalMatrix();
- var t = this._parent;
- t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : n.mat4.copy(this._worldMatrix, this._matrix), this._worldMatDirty = !1
- },
- _mulMat: function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m,
- o = n[0],
- a = n[1],
- l = n[4],
- h = n[5],
- c = n[12],
- u = n[13],
- _ = r[0],
- f = r[1],
- d = r[4],
- p = r[5],
- m = r[12],
- y = r[13];
- 0 !== a || 0 !== l ? (s[0] = _ * o + f * l, s[1] = _ * a + f * h, s[4] = d * o + p * l, s[5] = d * a + p * h, s[12] = o * m + l * y + c, s[13] = a * m + h * y + u) : (s[0] = _ * o, s[1] = f * h, s[4] = d * o, s[5] = p * h, s[12] = o * m + c, s[13] = h * y + u)
- },
- _updateWorldMatrix: function() {
- if (this._parent && this._parent._updateWorldMatrix(), this._worldMatDirty) {
- this._calculWorldMatrix();
- for (var t = this._children, e = 0, i = t.length; e < i; e++) t[e]._worldMatDirty = !0
- }
- },
- setLocalDirty: function(t) {
- this._localMatDirty |= t, this._worldMatDirty = !0, t === G.POSITION ? this._renderFlag |= _.FLAG_WORLD_TRANSFORM : this._renderFlag |= _.FLAG_TRANSFORM
- },
- setWorldDirty: function() {
- this._worldMatDirty = !0
- },
- getLocalMatrix: function(t) {
- return this._updateLocalMatrix(), n.mat4.copy(t, this._matrix)
- },
- getWorldMatrix: function(t) {
- return this._updateWorldMatrix(), n.mat4.copy(t, this._worldMatrix)
- },
- convertToNodeSpaceAR: function(t, e) {
- return this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix), t instanceof cc.Vec2 ? (e = e || new cc.Vec2, n.vec2.transformMat4(e, t, F)) : (e = e || new cc.Vec3, n.vec3.transformMat4(e, t, F))
- },
- convertToWorldSpaceAR: function(t, e) {
- return this._updateWorldMatrix(), t instanceof cc.Vec2 ? (e = e || new cc.Vec2, n.vec2.transformMat4(e, t, this._worldMatrix)) : (e = e || new cc.Vec3, n.vec3.transformMat4(e, t, this._worldMatrix))
- },
- convertToNodeSpace: function(t) {
- this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix);
- var e = new cc.Vec2;
- return n.vec2.transformMat4(e, t, F), e.x += this._anchorPoint.x * this._contentSize.width, e.y += this._anchorPoint.y * this._contentSize.height, e
- },
- convertToWorldSpace: function(t) {
- this._updateWorldMatrix();
- var e = new cc.Vec2(t.x - this._anchorPoint.x * this._contentSize.width, t.y - this._anchorPoint.y * this._contentSize.height);
- return n.vec2.transformMat4(e, e, this._worldMatrix)
- },
- getNodeToParentTransform: function(t) {
- t || (t = a.identity()), this._updateLocalMatrix();
- var e = this._contentSize;
- return N.x = -this._anchorPoint.x * e.width, N.y = -this._anchorPoint.y * e.height, n.mat4.copy(F, this._matrix), n.mat4.translate(F, F, N), a.fromMat4(t, F)
- },
- getNodeToParentTransformAR: function(t) {
- return t || (t = a.identity()), this._updateLocalMatrix(), a.fromMat4(t, this._matrix)
- },
- getNodeToWorldTransform: function(t) {
- t || (t = a.identity()), this._updateWorldMatrix();
- var e = this._contentSize;
- return N.x = -this._anchorPoint.x * e.width, N.y = -this._anchorPoint.y * e.height, n.mat4.copy(F, this._worldMatrix), n.mat4.translate(F, F, N), a.fromMat4(t, F)
- },
- getNodeToWorldTransformAR: function(t) {
- return t || (t = a.identity()), this._updateWorldMatrix(), a.fromMat4(t, this._worldMatrix)
- },
- getParentToNodeTransform: function(t) {
- return t || (t = a.identity()), this._updateLocalMatrix(), n.mat4.invert(F, this._matrix), a.fromMat4(t, F)
- },
- getWorldToNodeTransform: function(t) {
- return t || (t = a.identity()), this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix), a.fromMat4(t, F)
- },
- convertTouchToNodeSpace: function(t) {
- return this.convertToNodeSpace(t.getLocation())
- },
- convertTouchToNodeSpaceAR: function(t) {
- return this.convertToNodeSpaceAR(t.getLocation())
- },
- getBoundingBox: function() {
- this._updateLocalMatrix();
- var t = this._contentSize.width,
- e = this._contentSize.height,
- i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e);
- return i.transformMat4(i, this._matrix)
- },
- getBoundingBoxToWorld: function() {
- return this._parent ? (this._parent._updateWorldMatrix(), this._getBoundingBoxTo(this._parent._worldMatrix)) : this.getBoundingBox()
- },
- _getBoundingBoxTo: function(t) {
- this._updateLocalMatrix();
- var e = this._contentSize.width,
- i = this._contentSize.height,
- r = cc.rect(-this._anchorPoint.x * e, -this._anchorPoint.y * i, e, i);
- t = n.mat4.mul(this._worldMatrix, t, this._matrix);
- if (r.transformMat4(r, t), !this._children) return r;
- for (var s = this._children, o = 0; o < s.length; o++) {
- var a = s[o];
- if (a && a.active) {
- var l = a._getBoundingBoxTo(t);
- l && r.union(r, l)
- }
- }
- return r
- },
- _updateOrderOfArrival: function() {
- var t = this._parent ? ++this._parent._childArrivalOrder : 0;
- if (this._localZOrder = 4294901760 & this._localZOrder | t, 65535 === t) {
- var e = this._parent._children;
- e.forEach((function(t, e) {
- t._localZOrder = 4294901760 & t._localZOrder | e + 1
- })), this._parent._childArrivalOrder = e.length
- }
- this.emit(U.SIBLING_ORDER_CHANGED)
- },
- addChild: function(t, e, i) {
- cc.assertID(t, 1606), cc.assertID(null === t._parent, 1605), t.parent = this, void 0 !== e && (t.zIndex = e), void 0 !== i && (t.name = i)
- },
- cleanup: function() {
- p && cc.director.getActionManager().removeAllActionsFromTarget(this), l.removeListeners(this);
- var t, e, i = this._children.length;
- for (t = 0; t < i; ++t)(e = this._children[t]) && e.cleanup()
- },
- sortAllChildren: function() {
- if (this._reorderChildDirty) {
- l._setDirtyForNode(this), this._reorderChildDirty = !1;
- var t = this._children;
- if (t.length > 1) {
- var e, i, n, r = t.length;
- for (e = 1; e < r; e++) {
- for (n = t[e], i = e - 1; i >= 0 && n._localZOrder < t[i]._localZOrder;) t[i + 1] = t[i], i--;
- t[i + 1] = n
- }
- this.emit(U.CHILD_REORDER, this)
- }
- cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this)
- }
- },
- _delaySort: function() {
- this._reorderChildDirty || (this._reorderChildDirty = !0, cc.director.__fastOn(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this))
- },
- _restoreProperties: !1,
- onRestore: !1
- };
- var at = cc.Class(ot),
- lt = at.prototype;
- c.getset(lt, "position", lt.getPosition, lt.setPosition, !1, !0), cc.Node = e.exports = at
- }), {
- "./event-manager": 129,
- "./event/event": 132,
- "./event/event-target": 131,
- "./platform/CCMacro": 203,
- "./platform/js": 218,
- "./renderer/render-flow": 248,
- "./utils/affine-transform": 290,
- "./utils/base-node": 291,
- "./utils/prefab-helper": 303,
- "./utils/trans-pool": 309,
- "./vmath": 326
- }],
- 53: [(function(t, e, i) {
- "use strict";
- var n = t("./CCNode"),
- r = t("./renderer/render-flow"),
- s = (cc.Object.Flags.HideInHierarchy, n._LocalDirtyFlag),
- o = cc.Class({
- name: "cc.PrivateNode",
- extends: n,
- properties: {
- x: {
- get: function() {
- return this._originPos.x
- },
- set: function(t) {
- var e = this._originPos;
- t !== e.x && (e.x = t, this._posDirty(!0))
- },
- override: !0
- },
- y: {
- get: function() {
- return this._originPos.y
- },
- set: function(t) {
- var e = this._originPos;
- t !== e.y && (e.y = t, this._posDirty(!0))
- },
- override: !0
- },
- zIndex: {
- get: function() {
- return cc.macro.MIN_ZINDEX
- },
- set: function() {
- cc.warnID(1638)
- },
- override: !0
- },
- showInEditor: {
- default: !1,
- editorOnly: !0,
- override: !0
- }
- },
- ctor: function(t) {
- this._localZOrder = cc.macro.MIN_ZINDEX << 16, this._originPos = cc.v2()
- },
- _posDirty: function(t) {
- this.setLocalDirty(s.POSITION), this._renderFlag |= r.FLAG_TRANSFORM, !0 === t && 1 & this._eventMask && this.emit(n.EventType.POSITION_CHANGED)
- },
- _updateLocalMatrix: function() {
- if (this._localMatDirty) {
- var t = this.parent;
- t && (this._trs[0] = this._originPos.x - (t._anchorPoint.x - .5) * t._contentSize.width, this._trs[1] = this._originPos.y - (t._anchorPoint.y - .5) * t._contentSize.height), this._super()
- }
- },
- getPosition: function() {
- return new cc.Vec2(this._originPos)
- },
- setPosition: function(t, e) {
- void 0 === e && (e = (t = t.x).y);
- var i = this._originPos;
- i.x === t && i.y === e || (i.x = t, i.y = e, this._posDirty(!0))
- },
- setParent: function(t) {
- var e = this._parent;
- this._super(t), e !== t && (e && e.off(n.EventType.ANCHOR_CHANGED, this._posDirty, this), t && t.on(n.EventType.ANCHOR_CHANGED, this._posDirty, this))
- },
- _updateOrderOfArrival: function() {}
- });
- cc.js.getset(o.prototype, "parent", o.prototype.getParent, o.prototype.setParent), cc.js.getset(o.prototype, "position", o.prototype.getPosition, o.prototype.setPosition), cc.PrivateNode = e.exports = o
- }), {
- "./CCNode": 52,
- "./renderer/render-flow": 248
- }],
- 54: [(function(t, e, i) {
- "use strict";
- cc.Scene = cc.Class({
- name: "cc.Scene",
- extends: t("./CCNode"),
- properties: {
- _is3DNode: {
- default: !0,
- override: !0
- },
- autoReleaseAssets: {
- default: void 0,
- type: cc.Boolean
- }
- },
- ctor: function() {
- this._anchorPoint.x = 0, this._anchorPoint.y = 0, this._activeInHierarchy = !1, this._inited = !cc.game._isCloning, this.dependAssets = null
- },
- destroy: function() {
- if (cc.Object.prototype.destroy.call(this))
- for (var t = this._children, e = 0; e < t.length; ++e) t[e].active = !1;
- this._active = !1, this._activeInHierarchy = !1
- },
- _onHierarchyChanged: function() {},
- _instantiate: null,
- _load: function() {
- this._inited || (this._onBatchCreated(), this._inited = !0)
- },
- _activate: function(t) {
- t = !1 !== t, cc.director._nodeActivator.activateNode(this, t)
- }
- }), e.exports = cc.Scene
- }), {
- "./CCNode": 52
- }],
- 55: [(function(t, e, i) {
- "use strict";
- var n = t("./platform/js"),
- r = new(t("./platform/id-generater"))("Scheduler"),
- s = function(t, e, i, n) {
- this.target = t, this.priority = e, this.paused = i, this.markedForDeletion = n
- },
- o = [];
- s.get = function(t, e, i, n) {
- var r = o.pop();
- return r ? (r.target = t, r.priority = e, r.paused = i, r.markedForDeletion = n) : r = new s(t, e, i, n), r
- }, s.put = function(t) {
- o.length < 20 && (t.target = null, o.push(t))
- };
- var a = function(t, e, i, n) {
- this.list = t, this.entry = e, this.target = i, this.callback = n
- },
- l = [];
- a.get = function(t, e, i, n) {
- var r = l.pop();
- return r ? (r.list = t, r.entry = e, r.target = i, r.callback = n) : r = new a(t, e, i, n), r
- }, a.put = function(t) {
- l.length < 20 && (t.list = t.entry = t.target = t.callback = null, l.push(t))
- };
- var h = function(t, e, i, n, r, s) {
- var o = this;
- o.timers = t, o.target = e, o.timerIndex = i, o.currentTimer = n, o.currentTimerSalvaged = r, o.paused = s
- },
- c = [];
- function u() {
- this._lock = !1, this._scheduler = null, this._elapsed = -1, this._runForever = !1, this._useDelay = !1, this._timesExecuted = 0, this._repeat = 0, this._delay = 0, this._interval = 0, this._target = null, this._callback = null
- }
- h.get = function(t, e, i, n, r, s) {
- var o = c.pop();
- return o ? (o.timers = t, o.target = e, o.timerIndex = i, o.currentTimer = n, o.currentTimerSalvaged = r, o.paused = s) : o = new h(t, e, i, n, r, s), o
- }, h.put = function(t) {
- c.length < 20 && (t.timers = t.target = t.currentTimer = null, c.push(t))
- };
- var _ = u.prototype;
- _.initWithCallback = function(t, e, i, n, r, s) {
- return this._lock = !1, this._scheduler = t, this._target = i, this._callback = e, this._elapsed = -1, this._interval = n, this._delay = s, this._useDelay = this._delay > 0, this._repeat = r, this._runForever = this._repeat === cc.macro.REPEAT_FOREVER, !0
- }, _.getInterval = function() {
- return this._interval
- }, _.setInterval = function(t) {
- this._interval = t
- }, _.update = function(t) {
- -1 === this._elapsed ? (this._elapsed = 0, this._timesExecuted = 0) : (this._elapsed += t, this._runForever && !this._useDelay ? this._elapsed >= this._interval && (this.trigger(), this._elapsed = 0) : (this._useDelay ? this._elapsed >= this._delay && (this.trigger(), this._elapsed -= this._delay, this._timesExecuted += 1, this._useDelay = !1) : this._elapsed >= this._interval && (this.trigger(), this._elapsed = 0, this._timesExecuted += 1), this._callback && !this._runForever && this._timesExecuted > this._repeat && this.cancel()))
- }, _.getCallback = function() {
- return this._callback
- }, _.trigger = function() {
- this._target && this._callback && (this._lock = !0, this._callback.call(this._target, this._elapsed), this._lock = !1)
- }, _.cancel = function() {
- this._scheduler.unschedule(this._callback, this._target)
- };
- var f = [];
- u.get = function() {
- return f.pop() || new u
- }, u.put = function(t) {
- f.length < 20 && !t._lock && (t._scheduler = t._target = t._callback = null, f.push(t))
- }, cc.Scheduler = function() {
- this._timeScale = 1, this._updatesNegList = [], this._updates0List = [], this._updatesPosList = [], this._hashForUpdates = n.createMap(!0), this._hashForTimers = n.createMap(!0), this._currentTarget = null, this._currentTargetSalvaged = !1, this._updateHashLocked = !1, this._arrayForTimers = []
- }, cc.Scheduler.prototype = {
- constructor: cc.Scheduler,
- _removeHashElement: function(t) {
- delete this._hashForTimers[t.target._id];
- for (var e = this._arrayForTimers, i = 0, n = e.length; i < n; i++)
- if (e[i] === t) {
- e.splice(i, 1);
- break
- }
- h.put(t)
- },
- _removeUpdateFromHash: function(t) {
- var e = t.target._id,
- i = this._hashForUpdates[e];
- if (i) {
- for (var n = i.list, r = i.entry, o = 0, l = n.length; o < l; o++)
- if (n[o] === r) {
- n.splice(o, 1);
- break
- }
- delete this._hashForUpdates[e], s.put(r), a.put(i)
- }
- },
- _priorityIn: function(t, e, i) {
- for (var n = 0; n < t.length; n++)
- if (i < t[n].priority) return void t.splice(n, 0, e);
- t.push(e)
- },
- _appendIn: function(t, e) {
- t.push(e)
- },
- enableForTarget: function(t) {
- t._id || (t.__instanceId ? cc.warnID(1513) : t._id = r.getNewId())
- },
- setTimeScale: function(t) {
- this._timeScale = t
- },
- getTimeScale: function() {
- return this._timeScale
- },
- update: function(t) {
- var e, i, n, r;
- for (this._updateHashLocked = !0, 1 !== this._timeScale && (t *= this._timeScale), e = 0, n = (i = this._updatesNegList).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
- for (e = 0, n = (i = this._updates0List).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
- for (e = 0, n = (i = this._updatesPosList).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
- var s, o = this._arrayForTimers;
- for (e = 0; e < o.length; e++) {
- if (s = o[e], this._currentTarget = s, this._currentTargetSalvaged = !1, !s.paused)
- for (s.timerIndex = 0; s.timerIndex < s.timers.length; ++s.timerIndex) s.currentTimer = s.timers[s.timerIndex], s.currentTimerSalvaged = !1, s.currentTimer.update(t), s.currentTimer = null;
- this._currentTargetSalvaged && 0 === this._currentTarget.timers.length && (this._removeHashElement(this._currentTarget), --e)
- }
- for (e = 0, i = this._updatesNegList; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
- for (e = 0, i = this._updates0List; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
- for (e = 0, i = this._updatesPosList; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
- this._updateHashLocked = !1, this._currentTarget = null
- },
- schedule: function(t, e, i, n, r, s) {
- if ("function" != typeof t) {
- var o = t;
- t = e, e = o
- }
- 4 !== arguments.length && 5 !== arguments.length || (s = !!n, n = cc.macro.REPEAT_FOREVER, r = 0), cc.assertID(e, 1502);
- var a = e._id;
- a || (e.__instanceId ? (cc.warnID(1513), a = e._id = e.__instanceId) : cc.errorID(1510));
- var l, c, _ = this._hashForTimers[a];
- if (_ ? _.paused !== s && cc.warnID(1511) : (_ = h.get(null, e, 0, null, null, s), this._arrayForTimers.push(_), this._hashForTimers[a] = _), null == _.timers) _.timers = [];
- else
- for (c = 0; c < _.timers.length; ++c)
- if ((l = _.timers[c]) && t === l._callback) return cc.logID(1507, l.getInterval(), i), void(l._interval = i);
- (l = u.get()).initWithCallback(this, t, e, i, n, r), _.timers.push(l), this._currentTarget === _ && this._currentTargetSalvaged && (this._currentTargetSalvaged = !1)
- },
- scheduleUpdate: function(t, e, i) {
- var n = t._id;
- n || (t.__instanceId ? (cc.warnID(1513), n = t._id = t.__instanceId) : cc.errorID(1510));
- var r = this._hashForUpdates[n];
- if (r && r.entry) {
- if (r.entry.priority === e) return r.entry.markedForDeletion = !1, void(r.entry.paused = i);
- if (this._updateHashLocked) return cc.logID(1506), r.entry.markedForDeletion = !1, void(r.entry.paused = i);
- this.unscheduleUpdate(t)
- }
- var o, l = s.get(t, e, i, !1);
- 0 === e ? (o = this._updates0List, this._appendIn(o, l)) : (o = e < 0 ? this._updatesNegList : this._updatesPosList, this._priorityIn(o, l, e)), this._hashForUpdates[n] = a.get(o, l, t, null)
- },
- unschedule: function(t, e) {
- if (e && t) {
- var i = e._id;
- i || (e.__instanceId ? (cc.warnID(1513), i = e._id = e.__instanceId) : cc.errorID(1510));
- var n = this._hashForTimers[i];
- if (n)
- for (var r = n.timers, s = 0, o = r.length; s < o; s++) {
- var a = r[s];
- if (t === a._callback) return a !== n.currentTimer || n.currentTimerSalvaged || (n.currentTimerSalvaged = !0), r.splice(s, 1), u.put(a), n.timerIndex >= s && n.timerIndex--, void(0 === r.length && (this._currentTarget === n ? this._currentTargetSalvaged = !0 : this._removeHashElement(n)))
- }
- }
- },
- unscheduleUpdate: function(t) {
- if (t) {
- var e = t._id;
- e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
- var i = this._hashForUpdates[e];
- i && (this._updateHashLocked ? i.entry.markedForDeletion = !0 : this._removeUpdateFromHash(i.entry))
- }
- },
- unscheduleAllForTarget: function(t) {
- if (t) {
- var e = t._id;
- e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
- var i = this._hashForTimers[e];
- if (i) {
- var n = i.timers;
- n.indexOf(i.currentTimer) > -1 && !i.currentTimerSalvaged && (i.currentTimerSalvaged = !0);
- for (var r = 0, s = n.length; r < s; r++) u.put(n[r]);
- n.length = 0, this._currentTarget === i ? this._currentTargetSalvaged = !0 : this._removeHashElement(i)
- }
- this.unscheduleUpdate(t)
- }
- },
- unscheduleAll: function() {
- this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)
- },
- unscheduleAllWithMinPriority: function(t) {
- var e, i, n, r = this._arrayForTimers;
- for (e = r.length - 1; e >= 0; e--) i = r[e], this.unscheduleAllForTarget(i.target);
- var s = 0;
- if (t < 0)
- for (e = 0; e < this._updatesNegList.length;) s = this._updatesNegList.length, (n = this._updatesNegList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), s == this._updatesNegList.length && e++;
- if (t <= 0)
- for (e = 0; e < this._updates0List.length;) s = this._updates0List.length, (n = this._updates0List[e]) && this.unscheduleUpdate(n.target), s == this._updates0List.length && e++;
- for (e = 0; e < this._updatesPosList.length;) s = this._updatesPosList.length, (n = this._updatesPosList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), s == this._updatesPosList.length && e++
- },
- isScheduled: function(t, e) {
- cc.assertID(t, 1508), cc.assertID(e, 1509);
- var i = e._id;
- i || (e.__instanceId ? (cc.warnID(1513), i = e._id = e.__instanceId) : cc.errorID(1510));
- var n = this._hashForTimers[i];
- if (!n) return !1;
- if (null == n.timers) return !1;
- for (var r = n.timers, s = 0; s < r.length; ++s) {
- if (t === r[s]._callback) return !0
- }
- return !1
- },
- pauseAllTargets: function() {
- return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)
- },
- pauseAllTargetsWithMinPriority: function(t) {
- var e, i, n, r, s = [],
- o = this._arrayForTimers;
- for (i = 0, n = o.length; i < n; i++)(e = o[i]) && (e.paused = !0, s.push(e.target));
- if (t < 0)
- for (i = 0; i < this._updatesNegList.length; i++)(r = this._updatesNegList[i]) && r.priority >= t && (r.paused = !0, s.push(r.target));
- if (t <= 0)
- for (i = 0; i < this._updates0List.length; i++)(r = this._updates0List[i]) && (r.paused = !0, s.push(r.target));
- for (i = 0; i < this._updatesPosList.length; i++)(r = this._updatesPosList[i]) && r.priority >= t && (r.paused = !0, s.push(r.target));
- return s
- },
- resumeTargets: function(t) {
- if (t)
- for (var e = 0; e < t.length; e++) this.resumeTarget(t[e])
- },
- pauseTarget: function(t) {
- cc.assertID(t, 1503);
- var e = t._id;
- e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
- var i = this._hashForTimers[e];
- i && (i.paused = !0);
- var n = this._hashForUpdates[e];
- n && (n.entry.paused = !0)
- },
- resumeTarget: function(t) {
- cc.assertID(t, 1504);
- var e = t._id;
- e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
- var i = this._hashForTimers[e];
- i && (i.paused = !1);
- var n = this._hashForUpdates[e];
- n && (n.entry.paused = !1)
- },
- isTargetPaused: function(t) {
- cc.assertID(t, 1505);
- var e = t._id;
- e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
- var i = this._hashForTimers[e];
- if (i) return i.paused;
- var n = this._hashForUpdates[e];
- return !!n && n.entry.paused
- }
- }, cc.Scheduler.PRIORITY_SYSTEM = 1 << 31, cc.Scheduler.PRIORITY_NON_SYSTEM = cc.Scheduler.PRIORITY_SYSTEM + 1, e.exports = cc.Scheduler
- }), {
- "./platform/id-generater": 214,
- "./platform/js": 218
- }],
- 56: [(function(t, e, i) {
- "use strict";
- var n = t("./CCRawAsset");
- cc.Asset = cc.Class({
- name: "cc.Asset",
- extends: n,
- ctor: function() {
- this.loaded = !0, this.url = ""
- },
- properties: {
- nativeUrl: {
- get: function() {
- if (this._native) {
- var t = this._native;
- if (47 === t.charCodeAt(0)) return t.slice(1);
- if (cc.AssetLibrary) {
- var e = cc.AssetLibrary.getLibUrlNoExt(this._uuid, !0);
- return 46 === t.charCodeAt(0) ? e + t : e + "/" + t
- }
- cc.errorID(6400)
- }
- return ""
- },
- visible: !1
- },
- _native: "",
- _nativeAsset: {
- get: function() {
- return this._$nativeAsset
- },
- set: function(t) {
- this._$nativeAsset = t
- }
- }
- },
- statics: {
- deserialize: !1,
- preventDeferredLoadDependents: !1,
- preventPreloadNativeObject: !1
- },
- toString: function() {
- return this.nativeUrl
- },
- serialize: !1,
- createNode: null,
- _setRawAsset: function(t, e) {
- this._native = !1 !== e ? t || void 0 : "/" + t
- }
- }), e.exports = cc.Asset
- }), {
- "./CCRawAsset": 65
- }],
- 57: [(function(t, e, i) {
- "use strict";
- var n = t("./CCAsset"),
- r = t("../event/event-target"),
- s = cc.Enum({
- WEB_AUDIO: 0,
- DOM_AUDIO: 1
- }),
- o = cc.Class({
- name: "cc.AudioClip",
- extends: n,
- mixins: [r],
- ctor: function() {
- this.loaded = !1, this._audio = null
- },
- properties: {
- loadMode: {
- default: s.WEB_AUDIO,
- type: s
- },
- _nativeAsset: {
- get: function() {
- return this._audio
- },
- set: function(t) {
- t instanceof cc.AudioClip ? this._audio = t._nativeAsset : this._audio = t, this._audio && (this.loaded = !0, this.emit("load"))
- },
- override: !0
- }
- },
- statics: {
- LoadMode: s,
- _loadByUrl: function(t, e) {
- var i = cc.loader.getItem(t) || cc.loader.getItem(t + "?useDom=1");
- i && i.complete ? i._owner instanceof o ? e(null, i._owner) : e(null, i.content) : cc.loader.load(t, (function(n, r) {
- if (n) return e(n);
- i = cc.loader.getItem(t) || cc.loader.getItem(t + "?useDom=1"), e(null, i.content)
- }))
- }
- },
- destroy: function() {
- cc.audioEngine.uncache(this), this._super()
- }
- });
- cc.AudioClip = o, e.exports = o
- }), {
- "../event/event-target": 131,
- "./CCAsset": 56
- }],
- 58: [(function(t, e, i) {
- "use strict";
- var n = function() {
- this.u = 0, this.v = 0, this.w = 0, this.h = 0, this.offsetX = 0, this.offsetY = 0, this.textureID = 0, this.valid = !1, this.xAdvance = 0
- },
- r = function(t) {
- this._letterDefinitions = {}, this._texture = t
- };
- r.prototype = {
- constructor: r,
- addLetterDefinitions: function(t, e) {
- this._letterDefinitions[t] = e
- },
- cloneLetterDefinition: function() {
- var t = {};
- for (var e in this._letterDefinitions) {
- var i = new n;
- cc.js.mixin(i, this._letterDefinitions[e]), t[e] = i
- }
- return t
- },
- getTexture: function() {
- return this._texture
- },
- getLetter: function(t) {
- return this._letterDefinitions[t]
- },
- getLetterDefinitionForChar: function(t) {
- var e = t.charCodeAt(0);
- return this._letterDefinitions.hasOwnProperty(e) ? this._letterDefinitions[e] : null
- },
- clear: function() {
- this._letterDefinitions = {}
- }
- };
- var s = cc.Class({
- name: "cc.BitmapFont",
- extends: cc.Font,
- properties: {
- fntDataStr: {
- default: ""
- },
- spriteFrame: {
- default: null,
- type: cc.SpriteFrame
- },
- fontSize: {
- default: -1
- },
- _fntConfig: null,
- _fontDefDictionary: null
- },
- onLoad: function() {
- var t = this.spriteFrame;
- !this._fontDefDictionary && t && (this._fontDefDictionary = new r(t._texture));
- var e = this._fntConfig;
- if (e) {
- var i = e.fontDefDictionary;
- for (var s in i) {
- var o = new n,
- a = i[s].rect;
- o.offsetX = i[s].xOffset, o.offsetY = i[s].yOffset, o.w = a.width, o.h = a.height, o.u = a.x, o.v = a.y, o.textureID = 0, o.valid = !0, o.xAdvance = i[s].xAdvance, this._fontDefDictionary.addLetterDefinitions(s, o)
- }
- }
- }
- });
- cc.BitmapFont = s, cc.BitmapFont.FontLetterDefinition = n, cc.BitmapFont.FontAtlas = r, e.exports = s
- }), {}],
- 59: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.BufferAsset",
- extends: cc.Asset,
- ctor: function() {
- this._buffer = null
- },
- properties: {
- _nativeAsset: {
- get: function() {
- return this._buffer
- },
- set: function(t) {
- this._buffer = t.buffer || t
- },
- override: !0
- },
- buffer: function() {
- return this._buffer
- }
- }
- });
- cc.BufferAsset = e.exports = n
- }), {}],
- 60: [(function(t, e, i) {
- "use strict";
- var n = t("./CCAsset"),
- r = t("../../renderer/core/effect"),
- s = cc.Class({
- name: "cc.EffectAsset",
- extends: n,
- ctor: function() {
- this._effect = null
- },
- properties: {
- properties: Object,
- techniques: [],
- shaders: []
- },
- onLoad: function() {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
- for (var t = cc.renderer._forward._programLib, e = 0; e < this.shaders.length; e++) t.define(this.shaders[e]);
- this._initEffect()
- }
- },
- _initEffect: function() {
- this._effect || (this._effect = r.parseEffect(this))
- },
- getInstantiatedEffect: function() {
- return this._initEffect(), this._effect.clone()
- }
- });
- e.exports = cc.EffectAsset = s
- }), {
- "../../renderer/core/effect": 349,
- "./CCAsset": 56
- }],
- 61: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Font",
- extends: cc.Asset
- });
- cc.Font = e.exports = n
- }), {}],
- 62: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.JsonAsset",
- extends: cc.Asset,
- properties: {
- json: null
- }
- });
- e.exports = cc.JsonAsset = n
- }), {}],
- 63: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.LabelAtlas",
- extends: cc.BitmapFont,
- onLoad: function() {
- this.spriteFrame ? this._fntConfig ? this._super() : cc.warnID(9101, this.name) : cc.warnID(9100, this.name)
- }
- });
- cc.LabelAtlas = n, e.exports = n
- }), {}],
- 64: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- AUTO: 0,
- SINGLE_INSTANCE: 1,
- MULTI_INSTANCE: 2
- }),
- r = cc.Class({
- name: "cc.Prefab",
- extends: cc.Asset,
- ctor: function() {
- this._createFunction = null, this._instantiatedTimes = 0
- },
- properties: {
- data: null,
- optimizationPolicy: n.AUTO,
- asyncLoadAssets: !1,
- readonly: {
- default: !1,
- editorOnly: !0
- }
- },
- statics: {
- OptimizationPolicy: n,
- OptimizationPolicyThreshold: 3
- },
- createNode: !1,
- compileCreateFunction: function() {
- var e = t("../platform/instantiate-jit");
- this._createFunction = e.compile(this.data)
- },
- _doInstantiate: function(t) {
- return this.data._prefab ? this.data._prefab._synced = !0 : cc.warnID(3700), this._createFunction || this.compileCreateFunction(), this._createFunction(t)
- },
- _instantiate: function() {
- var t;
- return this.optimizationPolicy !== n.SINGLE_INSTANCE && (this.optimizationPolicy === n.MULTI_INSTANCE || this._instantiatedTimes + 1 >= r.OptimizationPolicyThreshold) ? (t = this._doInstantiate(), this.data._instantiate(t)) : (this.data._prefab._synced = !0, t = this.data._instantiate()), ++this._instantiatedTimes, t
- },
- destroy: function() {
- this.data && this.data.destroy(), this._super()
- }
- });
- cc.Prefab = e.exports = r, cc.js.obsolete(cc, "cc._Prefab", "Prefab")
- }), {
- "../platform/instantiate-jit": 216
- }],
- 65: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/CCObject"),
- r = t("../platform/js");
- cc.RawAsset = cc.Class({
- name: "cc.RawAsset",
- extends: n,
- ctor: function() {
- Object.defineProperty(this, "_uuid", {
- value: "",
- writable: !0
- })
- }
- }), r.value(cc.RawAsset, "isRawAssetType", (function(t) {
- return r.isChildClassOf(t, cc.RawAsset) && !r.isChildClassOf(t, cc.Asset)
- })), r.value(cc.RawAsset, "wasRawAssetType", (function(t) {
- return t === cc.Texture2D || t === cc.AudioClip || t === cc.ParticleAsset || t === cc.Asset
- })), e.exports = cc.RawAsset
- }), {
- "../platform/CCObject": 204,
- "../platform/js": 218
- }],
- 66: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../renderer/gfx"));
- var r = t("../renderer"),
- s = t("./CCTexture2D"),
- o = cc.Class({
- name: "cc.RenderTexture",
- extends: s,
- ctor: function() {
- this._framebuffer = null
- },
- initWithSize: function(t, e, i) {
- this.width = Math.floor(t || cc.visibleRect.width), this.height = Math.floor(e || cc.visibleRect.height), this._resetUnderlyingMipmaps();
- var s = {
- colors: [this._texture]
- };
- this._depthStencilBuffer && this._depthStencilBuffer.destroy();
- var o = void 0;
- i && (o = new n.default.RenderBuffer(r.device, i, t, e), i === n.default.RB_FMT_D24S8 ? s.depthStencil = o : i === n.default.RB_FMT_S8 ? s.stencil = o : i === n.default.RB_FMT_D16 && (s.depth = o)), this._depthStencilBuffer = o, this._framebuffer && this._framebuffer.destroy(), this._framebuffer = new n.default.FrameBuffer(r.device, t, e, s), this._packable = !1, this.loaded = !0, this.emit("load")
- },
- updateSize: function(t, e) {
- this.width = Math.floor(t || cc.visibleRect.width), this.height = Math.floor(e || cc.visibleRect.height), this._resetUnderlyingMipmaps();
- var i = this._depthStencilBuffer;
- i && i.update(this.width, this.height), this._framebuffer._width = t, this._framebuffer._height = e
- },
- drawTextureAt: function(t, e, i) {
- t._image && this._texture.updateSubImage({
- x: e,
- y: i,
- image: t._image,
- width: t.width,
- height: t.height,
- level: 0,
- flipY: !1,
- premultiplyAlpha: t._premultiplyAlpha
- })
- },
- readPixels: function(t, e, i, n, r) {
- if (!this._framebuffer || !this._texture) return t;
- e = e || 0, i = i || 0;
- var s = n || this.width,
- o = r || this.height;
- t = t || new Uint8Array(s * o * 4);
- var a = cc.game._renderContext,
- l = a.getParameter(a.FRAMEBUFFER_BINDING);
- return a.bindFramebuffer(a.FRAMEBUFFER, this._framebuffer.getHandle()), a.readPixels(e, i, s, o, a.RGBA, a.UNSIGNED_BYTE, t), a.bindFramebuffer(a.FRAMEBUFFER, l), t
- },
- destroy: function() {
- this._super(), this._framebuffer && (this._framebuffer.destroy(), this._framebuffer = null)
- }
- });
- cc.RenderTexture = e.exports = o
- }), {
- "../../renderer/gfx": 360,
- "../renderer": 247,
- "./CCTexture2D": 73
- }],
- 67: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.SceneAsset",
- extends: cc.Asset,
- properties: {
- scene: null,
- asyncLoadAssets: void 0
- }
- });
- cc.SceneAsset = n, e.exports = n
- }), {}],
- 68: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Script",
- extends: cc.Asset
- });
- cc._Script = n;
- var r = cc.Class({
- name: "cc.JavaScript",
- extends: n
- });
- cc._JavaScript = r;
- var s = cc.Class({
- name: "cc.CoffeeScript",
- extends: n
- });
- cc._CoffeeScript = s;
- var o = cc.Class({
- name: "cc.TypeScript",
- extends: n
- });
- cc._TypeScript = o
- }), {}],
- 69: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.SpriteAtlas",
- extends: cc.Asset,
- properties: {
- _spriteFrames: {
- default: {}
- }
- },
- getTexture: function() {
- var t = Object.keys(this._spriteFrames);
- if (t.length > 0) {
- var e = this._spriteFrames[t[0]];
- return e ? e.getTexture() : null
- }
- return null
- },
- getSpriteFrame: function(t) {
- var e = this._spriteFrames[t];
- return e ? (e.name || (e.name = t), e) : null
- },
- getSpriteFrames: function() {
- var t = [],
- e = this._spriteFrames;
- for (var i in e) t.push(this.getSpriteFrame(i));
- return t
- }
- });
- cc.SpriteAtlas = n, e.exports = n
- }), {}],
- 70: [(function(t, e, i) {
- "use strict";
- var n = t("../event/event-target"),
- r = t("../utils/texture-util"),
- s = [{
- u: 0,
- v: 0
- }, {
- u: 0,
- v: 0
- }, {
- u: 0,
- v: 0
- }, {
- u: 0,
- v: 0
- }],
- o = cc.Class({
- name: "cc.SpriteFrame",
- extends: t("../assets/CCAsset"),
- mixins: [n],
- properties: {
- _textureSetter: {
- set: function(t) {
- t && (this._texture !== t && this._refreshTexture(t), this._textureFilename = t.url)
- }
- },
- insetTop: {
- get: function() {
- return this._capInsets[1]
- },
- set: function(t) {
- this._capInsets[1] = t, this._texture && this._calculateSlicedUV()
- }
- },
- insetBottom: {
- get: function() {
- return this._capInsets[3]
- },
- set: function(t) {
- this._capInsets[3] = t, this._texture && this._calculateSlicedUV()
- }
- },
- insetLeft: {
- get: function() {
- return this._capInsets[0]
- },
- set: function(t) {
- this._capInsets[0] = t, this._texture && this._calculateSlicedUV()
- }
- },
- insetRight: {
- get: function() {
- return this._capInsets[2]
- },
- set: function(t) {
- this._capInsets[2] = t, this._texture && this._calculateSlicedUV()
- }
- }
- },
- ctor: function() {
- n.call(this);
- var t = arguments[0],
- e = arguments[1],
- i = arguments[2],
- r = arguments[3],
- s = arguments[4];
- this._rect = null, this.uv = [], this._texture = null, this._original = null, this._offset = null, this._originalSize = null, this._rotated = !1, this.vertices = null, this._capInsets = [0, 0, 0, 0], this.uvSliced = [], this._textureFilename = "", void 0 !== t && this.setTexture(t, e, i, r, s)
- },
- textureLoaded: function() {
- return this._texture && this._texture.loaded
- },
- isRotated: function() {
- return this._rotated
- },
- setRotated: function(t) {
- this._rotated = t, this._texture && this._calculateUV()
- },
- getRect: function() {
- return cc.rect(this._rect)
- },
- setRect: function(t) {
- this._rect = t, this._texture && this._calculateUV()
- },
- getOriginalSize: function() {
- return cc.size(this._originalSize)
- },
- setOriginalSize: function(t) {
- this._originalSize ? (this._originalSize.width = t.width, this._originalSize.height = t.height) : this._originalSize = cc.size(t)
- },
- getTexture: function() {
- return this._texture
- },
- _textureLoadedCallback: function() {
- var t = this._texture;
- if (t) {
- var e = t.width,
- i = t.height;
- this._rect ? this._checkRect(this._texture) : this._rect = cc.rect(0, 0, e, i), this._originalSize || this.setOriginalSize(cc.size(e, i)), this._offset || this.setOffset(cc.v2(0, 0)), this._calculateUV(), this.emit("load")
- }
- },
- _refreshTexture: function(t) {
- this._texture = t, t.loaded ? this._textureLoadedCallback() : t.once("load", this._textureLoadedCallback, this)
- },
- getOffset: function() {
- return cc.v2(this._offset)
- },
- setOffset: function(t) {
- this._offset = cc.v2(t)
- },
- clone: function() {
- return new o(this._texture || this._textureFilename, this._rect, this._rotated, this._offset, this._originalSize)
- },
- setTexture: function(t, e, i, n, r) {
- this._rect = e || null, n ? this.setOffset(n) : this._offset = null, r ? this.setOriginalSize(r) : this._originalSize = null, this._rotated = i || !1;
- var s = t;
- return "string" == typeof s && s && (this._textureFilename = s, this._loadTexture()), s instanceof cc.Texture2D && this._texture !== s && this._refreshTexture(s), !0
- },
- _loadTexture: function() {
- if (this._textureFilename) {
- var t = r.loadImage(this._textureFilename);
- this._refreshTexture(t)
- }
- },
- ensureLoadTexture: function() {
- this._texture ? this._texture.loaded || (this._refreshTexture(this._texture), r.postLoadTexture(this._texture)) : this._textureFilename && this._loadTexture()
- },
- _checkRect: function(t) {
- var e = this._rect,
- i = e.x,
- n = e.y;
- this._rotated ? (i += e.height, n += e.width) : (i += e.width, n += e.height), i > t.width && cc.errorID(3300, t.url + "/" + this.name, i, t.width), n > t.height && cc.errorID(3400, t.url + "/" + this.name, n, t.height)
- },
- _calculateSlicedUV: function() {
- var t = this._rect,
- e = this._texture.width,
- i = this._texture.height,
- n = this._capInsets[0],
- r = this._capInsets[2],
- o = t.width - n - r,
- a = this._capInsets[1],
- l = this._capInsets[3],
- h = t.height - a - l,
- c = this.uvSliced;
- if (c.length = 0, this._rotated) {
- s[0].u = t.x / e, s[1].u = (t.x + l) / e, s[2].u = (t.x + l + h) / e, s[3].u = (t.x + t.height) / e, s[3].v = t.y / i, s[2].v = (t.y + n) / i, s[1].v = (t.y + n + o) / i, s[0].v = (t.y + t.width) / i;
- for (var u = 0; u < 4; ++u)
- for (var _ = s[u], f = 0; f < 4; ++f) {
- var d = s[3 - f];
- c.push({
- u: _.u,
- v: d.v
- })
- }
- } else {
- s[0].u = t.x / e, s[1].u = (t.x + n) / e, s[2].u = (t.x + n + o) / e, s[3].u = (t.x + t.width) / e, s[3].v = t.y / i, s[2].v = (t.y + a) / i, s[1].v = (t.y + a + h) / i, s[0].v = (t.y + t.height) / i;
- for (var p = 0; p < 4; ++p)
- for (var m = s[p], y = 0; y < 4; ++y) {
- var v = s[y];
- c.push({
- u: v.u,
- v: m.v
- })
- }
- }
- },
- _setDynamicAtlasFrame: function(t) {
- t && (this._original = {
- _texture: this._texture,
- _x: this._rect.x,
- _y: this._rect.y
- }, this._texture = t.texture, this._rect.x = t.x, this._rect.y = t.y, this._calculateUV())
- },
- _resetDynamicAtlasFrame: function() {
- this._original && (this._rect.x = this._original._x, this._rect.y = this._original._y, this._texture = this._original._texture, this._original = null, this._calculateUV())
- },
- _calculateUV: function() {
- var t = this._rect,
- e = this._texture,
- i = this.uv,
- n = e.width,
- r = e.height;
- if (this._rotated) {
- var s = 0 === n ? 0 : t.x / n,
- o = 0 === n ? 0 : (t.x + t.height) / n,
- a = 0 === r ? 0 : (t.y + t.width) / r,
- l = 0 === r ? 0 : t.y / r;
- i[0] = s, i[1] = l, i[2] = s, i[3] = a, i[4] = o, i[5] = l, i[6] = o, i[7] = a
- } else {
- var h = 0 === n ? 0 : t.x / n,
- c = 0 === n ? 0 : (t.x + t.width) / n,
- u = 0 === r ? 0 : (t.y + t.height) / r,
- _ = 0 === r ? 0 : t.y / r;
- i[0] = h, i[1] = u, i[2] = c, i[3] = u, i[4] = h, i[5] = _, i[6] = c, i[7] = _
- }
- var f = this.vertices;
- if (f) {
- f.nu.length = 0, f.nv.length = 0;
- for (var d = 0; d < f.u.length; d++) f.nu[d] = f.u[d] / n, f.nv[d] = f.v[d] / r
- }
- this._calculateSlicedUV()
- },
- _serialize: !1,
- _deserialize: function(t, e) {
- var i = t.rect;
- i && (this._rect = new cc.Rect(i[0], i[1], i[2], i[3])), t.offset && this.setOffset(new cc.Vec2(t.offset[0], t.offset[1])), t.originalSize && this.setOriginalSize(new cc.Size(t.originalSize[0], t.originalSize[1])), this._rotated = 1 === t.rotated, this._name = t.name;
- var n = t.capInsets;
- n && (this._capInsets[0] = n[0], this._capInsets[1] = n[1], this._capInsets[2] = n[2], this._capInsets[3] = n[3]), this.vertices = t.vertices, this.vertices && (this.vertices.nu = [], this.vertices.nv = []);
- var r = t.texture;
- r && e.result.push(this, "_textureSetter", r)
- }
- }),
- a = o.prototype;
- a.copyWithZone = a.clone, a.copy = a.clone, a.initWithTexture = a.setTexture, cc.SpriteFrame = o, e.exports = o
- }), {
- "../assets/CCAsset": 56,
- "../event/event-target": 131,
- "../utils/texture-util": 308
- }],
- 71: [(function(t, e, i) {
- "use strict";
- var n = t("./CCFont"),
- r = cc.Class({
- name: "cc.TTFFont",
- extends: n,
- properties: {
- _fontFamily: null,
- _nativeAsset: {
- type: cc.String,
- get: function() {
- return this._fontFamily
- },
- set: function(t) {
- this._fontFamily = t || "Arial"
- },
- override: !0
- }
- }
- });
- cc.TTFFont = e.exports = r
- }), {
- "./CCFont": 61
- }],
- 72: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TextAsset",
- extends: cc.Asset,
- properties: {
- text: ""
- },
- toString: function() {
- return this.text
- }
- });
- e.exports = cc.TextAsset = n
- }), {}],
- 73: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../renderer/gfx"));
- var r = t("../event/event-target"),
- s = t("../renderer");
- t("../platform/CCClass");
- var o = new(t("../platform/id-generater"))("Tex"),
- a = 1024,
- l = cc.Enum({
- RGB565: n.default.TEXTURE_FMT_R5_G6_B5,
- RGB5A1: n.default.TEXTURE_FMT_R5_G5_B5_A1,
- RGBA4444: n.default.TEXTURE_FMT_R4_G4_B4_A4,
- RGB888: n.default.TEXTURE_FMT_RGB8,
- RGBA8888: n.default.TEXTURE_FMT_RGBA8,
- RGBA32F: n.default.TEXTURE_FMT_RGBA32F,
- A8: n.default.TEXTURE_FMT_A8,
- I8: n.default.TEXTURE_FMT_L8,
- AI8: n.default.TEXTURE_FMT_L8_A8,
- RGB_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_2BPPV1,
- RGBA_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_2BPPV1,
- RGB_A_PVRTC_2BPPV1: a++,
- RGB_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_4BPPV1,
- RGBA_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_4BPPV1,
- RGB_A_PVRTC_4BPPV1: a++,
- RGB_ETC1: n.default.TEXTURE_FMT_RGB_ETC1,
- RGBA_ETC1: a++,
- RGB_ETC2: n.default.TEXTURE_FMT_RGB_ETC2,
- RGBA_ETC2: n.default.TEXTURE_FMT_RGBA_ETC2
- }),
- h = cc.Enum({
- REPEAT: 10497,
- CLAMP_TO_EDGE: 33071,
- MIRRORED_REPEAT: 33648
- }),
- c = cc.Enum({
- LINEAR: 9729,
- NEAREST: 9728
- }),
- u = {
- 9728: 0,
- 9729: 1
- },
- _ = [],
- f = {
- width: void 0,
- height: void 0,
- minFilter: void 0,
- magFilter: void 0,
- wrapS: void 0,
- wrapT: void 0,
- format: void 0,
- genMipmaps: void 0,
- images: void 0,
- image: void 0,
- flipY: void 0,
- premultiplyAlpha: void 0
- };
- function d() {
- for (var t in f) f[t] = void 0;
- return _.length = 0, f.images = _, f.flipY = !1, f
- }
- var p = cc.Class({
- name: "cc.Texture2D",
- extends: t("../assets/CCAsset"),
- mixins: [r],
- properties: {
- _nativeAsset: {
- get: function() {
- return this._image
- },
- set: function(t) {
- t._compressed && t._data ? this.initWithData(t._data, this._format, t.width, t.height) : this.initWithElement(t)
- },
- override: !0
- },
- _format: l.RGBA8888,
- _premultiplyAlpha: !1,
- _flipY: !1,
- _minFilter: c.LINEAR,
- _magFilter: c.LINEAR,
- _mipFilter: c.LINEAR,
- _wrapS: h.CLAMP_TO_EDGE,
- _wrapT: h.CLAMP_TO_EDGE,
- _genMipmaps: !1,
- genMipmaps: {
- get: function() {
- return this._genMipmaps
- },
- set: function(t) {
- if (this._genMipmaps !== t) {
- var e = d();
- e.genMipmaps = t, this.update(e)
- }
- }
- },
- _packable: !0,
- packable: {
- get: function() {
- return this._packable
- },
- set: function(t) {
- this._packable = t
- }
- }
- },
- statics: {
- PixelFormat: l,
- WrapMode: h,
- Filter: c,
- _FilterIndex: u,
- extnames: [".png", ".jpg", ".jpeg", ".bmp", ".webp", ".pvr", ".pkm"]
- },
- ctor: function() {
- this._id = o.getNewId(), this.loaded = !1, this.width = 0, this.height = 0, this._hashDirty = !0, this._hash = 0, this._texture = null
- },
- getImpl: function() {
- return this._texture
- },
- getId: function() {
- return this._id
- },
- toString: function() {
- return this.url || ""
- },
- update: function(t) {
- if (t) {
- var e = !1;
- void 0 !== t.width && (this.width = t.width), void 0 !== t.height && (this.height = t.height), void 0 !== t.minFilter && (this._minFilter = t.minFilter, t.minFilter = u[t.minFilter]), void 0 !== t.magFilter && (this._magFilter = t.magFilter, t.magFilter = u[t.magFilter]), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter, t.mipFilter = u[t.mipFilter]), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format), void 0 !== t.flipY && (this._flipY = t.flipY, e = !0), void 0 !== t.premultiplyAlpha && (this._premultiplyAlpha = t.premultiplyAlpha, e = !0), void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps), e && this._image && (t.image = this._image), t.images && t.images.length > 0 ? this._image = t.images[0] : void 0 !== t.image && (this._image = t.image, t.images || (_.length = 0, t.images = _), t.images.push(t.image)), t.images && t.images.length > 0 && this._texture.update(t), this._hashDirty = !0
- }
- },
- initWithElement: function(t) {
- if (t)
- if (this._image = t, t.complete || t instanceof HTMLCanvasElement) this.handleLoadedTexture();
- else {
- var e = this;
- t.addEventListener("load", (function() {
- e.handleLoadedTexture()
- })), t.addEventListener("error", (function(t) {
- cc.warnID(3119, t.message)
- }))
- }
- },
- initWithData: function(t, e, i, n) {
- var r = d();
- return r.image = t, r.images = [r.image], r.genMipmaps = this._genMipmaps, r.premultiplyAlpha = this._premultiplyAlpha, r.flipY = this._flipY, r.minFilter = u[this._minFilter], r.magFilter = u[this._magFilter], r.wrapS = this._wrapS, r.wrapT = this._wrapT, r.format = this._getGFXPixelFormat(e), r.width = i, r.height = n, this._texture ? this._texture.update(r) : this._texture = new s.Texture2D(s.device, r), this.width = i, this.height = n, this._checkPackable(), this.loaded = !0, this.emit("load"), !0
- },
- getHtmlElementObj: function() {
- return this._image
- },
- destroy: function() {
- this._image = null, this._texture && this._texture.destroy(), this._super()
- },
- getPixelFormat: function() {
- return this._format
- },
- hasPremultipliedAlpha: function() {
- return this._premultiplyAlpha || !1
- },
- handleLoadedTexture: function() {
- if (this._image && this._image.width && this._image.height) {
- this.width = this._image.width, this.height = this._image.height;
- var t = d();
- t.image = this._image, t.images = [t.image], t.width = this.width, t.height = this.height, t.genMipmaps = this._genMipmaps, t.format = this._getGFXPixelFormat(this._format), t.premultiplyAlpha = this._premultiplyAlpha, t.flipY = this._flipY, t.minFilter = u[this._minFilter], t.magFilter = u[this._magFilter], t.wrapS = this._wrapS, t.wrapT = this._wrapT, this._texture ? this._texture.update(t) : this._texture = new s.Texture2D(s.device, t), this._checkPackable(), this.loaded = !0, this.emit("load"), cc.macro.CLEANUP_IMAGE_CACHE && this._image instanceof HTMLImageElement && this._clearImage()
- }
- },
- description: function() {
- return "<cc.Texture2D | Name = " + this.url + " | Dimensions = " + this.width + " x " + this.height + ">"
- },
- releaseTexture: function() {
- this._image = null, this._texture && this._texture.destroy()
- },
- setWrapMode: function(t, e) {
- if (this._wrapS !== t || this._wrapT !== e) {
- var i = d();
- i.wrapS = t, i.wrapT = e, this.update(i)
- }
- },
- setFilters: function(t, e) {
- if (this._minFilter !== t || this._magFilter !== e) {
- var i = d();
- i.minFilter = t, i.magFilter = e, this.update(i)
- }
- },
- setFlipY: function(t) {
- if (this._flipY !== t) {
- var e = d();
- e.flipY = t, this.update(e)
- }
- },
- setPremultiplyAlpha: function(t) {
- if (this._premultiplyAlpha !== t) {
- var e = d();
- e.premultiplyAlpha = t, this.update(e)
- }
- },
- _checkPackable: function() {
- var t = cc.dynamicAtlasManager;
- if (t)
- if (this._isCompressed()) this._packable = !1;
- else {
- var e = this.width,
- i = this.height;
- !this._image || e > t.maxFrameSize || i > t.maxFrameSize || e <= t.minFrameSize || i <= t.minFrameSize || this._getHash() !== t.Atlas.DEFAULT_HASH ? this._packable = !1 : this._image && this._image instanceof HTMLCanvasElement && (this._packable = !0)
- }
- },
- _getOpts: function() {
- var t = d();
- return t.width = this.width, t.height = this.height, t.genMipmaps = this._genMipmaps, t.format = this._format, t.premultiplyAlpha = this._premultiplyAlpha, t.anisotropy = this._anisotropy, t.flipY = this._flipY, t.minFilter = u[this._minFilter], t.magFilter = u[this._magFilter], t.mipFilter = u[this._mipFilter], t.wrapS = this._wrapS, t.wrapT = this._wrapT, t
- },
- _getGFXPixelFormat: function(t) {
- return t === l.RGBA_ETC1 ? t = l.RGB_ETC1 : t === l.RGB_A_PVRTC_4BPPV1 ? t = l.RGB_PVRTC_4BPPV1 : t === l.RGB_A_PVRTC_2BPPV1 && (t = l.RGB_PVRTC_2BPPV1), t
- },
- _resetUnderlyingMipmaps: function(t) {
- var e = this._getOpts();
- e.images = t || [null], this._texture ? this._texture.update(e) : this._texture = new s.Texture2D(s.device, e)
- },
- _serialize: !1,
- _deserialize: function(t, e) {
- var i = cc.renderer.device,
- n = t.split(","),
- r = n[0];
- if (r) {
- for (var s = r.split("_"), o = "", a = "", h = 999, c = this._format, u = cc.macro.SUPPORT_TEXTURE_FORMATS, _ = 0; _ < s.length; _++) {
- var f = s[_].split("@"),
- d = f[0];
- d = p.extnames[d.charCodeAt(0) - 48] || d;
- var m = u.indexOf(d);
- if (-1 !== m && m < h) {
- var y = f[1] ? parseInt(f[1]) : this._format;
- if (".pvr" === d && !i.ext("WEBGL_compressed_texture_pvrtc")) continue;
- if (!(y !== l.RGB_ETC1 && y !== l.RGBA_ETC1 || i.ext("WEBGL_compressed_texture_etc1"))) continue;
- if (!(y !== l.RGB_ETC2 && y !== l.RGBA_ETC2 || i.ext("WEBGL_compressed_texture_etc"))) continue;
- if (".webp" === d && !cc.sys.capabilities.webp) continue;
- h = m, a = d, c = y
- } else o || (o = d)
- }
- a ? (this._setRawAsset(a), this._format = c) : (this._setRawAsset(o), cc.warnID(3120, e.customEnv.url, o, o))
- }
- 8 === n.length && (this._minFilter = parseInt(n[1]), this._magFilter = parseInt(n[2]), this._wrapS = parseInt(n[3]), this._wrapT = parseInt(n[4]), this._premultiplyAlpha = 49 === n[5].charCodeAt(0), this._genMipmaps = 49 === n[6].charCodeAt(0), this._packable = 49 === n[7].charCodeAt(0))
- },
- _getHash: function() {
- if (!this._hashDirty) return this._hash;
- var t = this._genMipmaps ? 1 : 0,
- e = this._premultiplyAlpha ? 1 : 0,
- i = this._flipY ? 1 : 0,
- n = this._minFilter === c.LINEAR ? 1 : 2,
- r = this._magFilter === c.LINEAR ? 1 : 2,
- s = this._wrapS === h.REPEAT ? 1 : this._wrapS === h.CLAMP_TO_EDGE ? 2 : 3,
- o = this._wrapT === h.REPEAT ? 1 : this._wrapT === h.CLAMP_TO_EDGE ? 2 : 3,
- a = this._format;
- this._image;
- return this._hash = Number("" + n + r + a + s + o + t + e + i), this._hashDirty = !1, this._hash
- },
- _isCompressed: function() {
- return this._texture && this._texture._compressed
- },
- _clearImage: function() {
- cc.loader.removeItem(this._image.id || this._image.src), this._image.src = ""
- }
- });
- cc.Texture2D = e.exports = p
- }), {
- "../../renderer/gfx": 360,
- "../assets/CCAsset": 56,
- "../event/event-target": 131,
- "../platform/CCClass": 198,
- "../platform/id-generater": 214,
- "../renderer": 247
- }],
- 74: [(function(t, e, i) {
- "use strict";
- t("./CCRawAsset"), t("./CCAsset"), t("./CCFont"), t("./CCPrefab"), t("./CCAudioClip"), t("./CCScripts"), t("./CCSceneAsset"), t("./CCSpriteFrame"), t("./CCTexture2D"), t("./CCRenderTexture"), t("./CCTTFFont"), t("./CCSpriteAtlas"), t("./CCBitmapFont"), t("./CCLabelAtlas"), t("./CCTextAsset"), t("./CCJsonAsset"), t("./CCBufferAsset"), t("./CCEffectAsset"), t("./material/CCMaterial")
- }), {
- "./CCAsset": 56,
- "./CCAudioClip": 57,
- "./CCBitmapFont": 58,
- "./CCBufferAsset": 59,
- "./CCEffectAsset": 60,
- "./CCFont": 61,
- "./CCJsonAsset": 62,
- "./CCLabelAtlas": 63,
- "./CCPrefab": 64,
- "./CCRawAsset": 65,
- "./CCRenderTexture": 66,
- "./CCSceneAsset": 67,
- "./CCScripts": 68,
- "./CCSpriteAtlas": 69,
- "./CCSpriteFrame": 70,
- "./CCTTFFont": 71,
- "./CCTextAsset": 72,
- "./CCTexture2D": 73,
- "./material/CCMaterial": 75
- }],
- 75: [(function(t, e, i) {
- "use strict";
- var n = o(t("../../../renderer/murmurhash2_gc")),
- r = o(t("./utils")),
- s = o(t("./material-pool"));
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var a = t("../CCAsset"),
- l = t("../CCTexture2D"),
- h = l.PixelFormat,
- c = t("../CCEffectAsset"),
- u = t("../../utils/texture-util"),
- _ = cc.Class({
- name: "cc.Material",
- extends: a,
- ctor: function() {
- this._manualHash = !1, this._dirty = !0, this._effect = null, this._owner = null, this._hash = 0
- },
- properties: {
- _effectAsset: {
- type: c,
- default: null
- },
- _defines: {
- default: {},
- type: Object
- },
- _props: {
- default: {},
- type: Object
- },
- effectName: void 0,
- effectAsset: {
- get: function() {
- return this._effectAsset
- },
- set: function(t) {
- cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS && (this._effectAsset = t, t ? this._effect = this._effectAsset.getInstantiatedEffect() : cc.error("Can not set an empty effect asset."))
- }
- },
- effect: {
- get: function() {
- return this._effect
- }
- },
- owner: {
- get: function() {
- return this._owner
- }
- }
- },
- statics: {
- getBuiltinMaterial: function(t) {
- return cc.AssetLibrary.getBuiltin("material", "builtin-" + t)
- },
- getInstantiatedBuiltinMaterial: function(t, e) {
- var i = this.getBuiltinMaterial(t);
- return _.getInstantiatedMaterial(i, e)
- },
- getInstantiatedMaterial: function(t, e) {
- return t._owner === e ? t : s.default.get(t, e)
- }
- },
- copy: function(t) {
- for (var e in this.effectAsset = t.effectAsset, t._defines) this.define(e, t._defines[e]);
- for (var i in t._props) this.setProperty(i, t._props[i])
- },
- setProperty: function(t, e, i) {
- if ((this._props[t] !== e || i) && (this._props[t] = e, this._dirty = !0, this._effect))
- if (e instanceof l) {
- var n = function() {
- this._effect.setProperty(t, e);
- var i = e.getPixelFormat();
- i !== h.RGBA_ETC1 && i !== h.RGB_A_PVRTC_4BPPV1 && i !== h.RGB_A_PVRTC_2BPPV1 || this.define("CC_USE_ALPHA_ATLAS_" + t.toUpperCase(), !0)
- };
- e.loaded ? n.call(this) : (e.once("load", n, this), u.postLoadTexture(e))
- } else this._effect.setProperty(t, e)
- },
- getProperty: function(t) {
- return this._props[t]
- },
- define: function(t, e, i) {
- (this._defines[t] !== e || i) && (this._defines[t] = e, this._dirty = !0, this._effect && this._effect.define(t, e))
- },
- getDefine: function(t) {
- return this._defines[t]
- },
- setDirty: function(t) {
- this._dirty = t
- },
- updateHash: function(t) {
- void 0 === t || null === t ? t = this.computeHash() : this._manualHash = !0, this._dirty = !1, this._hash = t, this._effect && this._effect.updateHash(this._hash)
- },
- computeHash: function() {
- var t = this._effect,
- e = "";
- return t && (e += r.default.serializeDefines(t._defines), e += r.default.serializeTechniques(t._techniques), e += r.default.serializeUniforms(t._properties)), (0, n.default)(e, 666)
- },
- getHash: function() {
- return this._dirty ? (this._manualHash || this.updateHash(), this._dirty = !1, this._hash) : this._hash
- },
- onLoad: function() {
- if (this.effectAsset = this._effectAsset, this._effect) {
- for (var t in this._defines) this.define(t, this._defines[t], !0);
- for (var e in this._props) this.setProperty(e, this._props[e], !0)
- }
- }
- });
- e.exports = cc.Material = _
- }), {
- "../../../renderer/murmurhash2_gc": 378,
- "../../utils/texture-util": 308,
- "../CCAsset": 56,
- "../CCEffectAsset": 60,
- "../CCTexture2D": 73,
- "./material-pool": 77,
- "./utils": 78
- }],
- 76: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = s(t("../../../renderer/murmurhash2_gc")),
- r = s(t("./utils"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var a = (function() {
- function t() {
- o(this, t), this._properties = {}, this._defines = {}, this._dirty = !1
- }
- return t.prototype.setProperty = function(t, e, i, n) {
- var r = this._properties[t];
- if (r) {
- if (r.value === e) return
- } else(r = Object.create(null)).name = t, r.type = i, r.directly = n, this._properties[t] = r;
- this._dirty = !0, r.directly = n, r.value = e
- }, t.prototype.getProperty = function(t) {
- var e = this._properties[t];
- return e ? e.value : null
- }, t.prototype.define = function(t, e) {
- this._defines[t] !== e && (this._dirty = !0, this._defines[t] = e)
- }, t.prototype.getDefine = function(t) {
- return this._defines[t]
- }, t.prototype.extractProperties = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
- return Object.assign(t, this._properties), t
- }, t.prototype.extractDefines = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
- return Object.assign(t, this._defines), t
- }, t.prototype.getHash = function() {
- if (!this._dirty) return this._hash;
- this._dirty = !1;
- var t = "";
- return t += r.default.serializeDefines(this._defines), t += r.default.serializeUniforms(this._properties), this._hash = (0, n.default)(t, 666)
- }, t
- })();
- i.default = a, cc.CustomProperties = a, e.exports = i.default
- }), {
- "../../../renderer/murmurhash2_gc": 378,
- "./utils": 78
- }],
- 77: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = s(t("./utils")),
- r = s(t("../../utils/pool"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = new(function(t) {
- function e() {
- var i, n;
- o(this, e);
- for (var r = arguments.length, s = Array(r), l = 0; l < r; l++) s[l] = arguments[l];
- return i = n = a(this, t.call.apply(t, [this].concat(s))), n.enabled = !1, n._pool = {}, a(n, i)
- }
- return l(e, t), e.prototype.get = function(t, e) {
- var i = this._pool,
- r = void 0;
- if (this.enabled) {
- var s = t.effectAsset._uuid;
- if (i[s]) {
- var o = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
- r = i[s][o] && i[s][o].pop()
- }
- }
- return r ? this.count-- : ((r = new cc.Material).copy(t), r._name = t._name + " (Instance)", r._uuid = t._uuid), r._owner = e, r
- }, e.prototype.put = function(t) {
- if (this.enabled && t._owner) {
- var e = this._pool,
- i = t.effectAsset._uuid;
- e[i] || (e[i] = {});
- var r = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
- e[i][r] || (e[i][r] = []), this.count > this.maxSize || (this._clean(t), e[i][r].push(t), this.count++)
- }
- }, e.prototype.clear = function() {
- this._pool = {}, this.count = 0
- }, e.prototype._clean = function(t) {
- t._owner = null
- }, e
- }(r.default));
- r.default.register("material", h), i.default = h, e.exports = i.default
- }), {
- "../../utils/pool": 302,
- "./utils": 78
- }],
- 78: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../renderer/enums"));
- function r(t) {
- var e = t._programName + t._cullMode;
- return t._blend && (e += t._blendEq + t._blendAlphaEq + t._blendSrc + t._blendDst + t._blendSrcAlpha + t._blendDstAlpha + t._blendColor), t._depthTest && (e += t._depthWrite + t._depthFunc), t._stencilTest && (e += t._stencilFuncFront + t._stencilRefFront + t._stencilMaskFront + t._stencilFailOpFront + t._stencilZFailOpFront + t._stencilZPassOpFront + t._stencilWriteMaskFront + t._stencilFuncBack + t._stencilRefBack + t._stencilMaskBack + t._stencilFailOpBack + t._stencilZFailOpBack + t._stencilZPassOpBack + t._stencilWriteMaskBack), e
- }
- i.default = {
- serializeDefines: function(t) {
- var e = "";
- for (var i in t) e += i + t[i];
- return e
- },
- serializeTechniques: function(t) {
- for (var e = "", i = 0; i < t.length; i++) {
- var n = t[i];
- e += n.stageIDs;
- for (var s = 0; s < n.passes.length; s++) e += r(n.passes[s])
- }
- return e
- },
- serializeUniforms: function(t) {
- var e = "";
- for (var i in t) {
- var r = t[i],
- s = r.value;
- s && (r.type === n.default.PARAM_TEXTURE_2D || r.type === n.default.PARAM_TEXTURE_CUBE ? e += s._id + ";" : e += s.toString() + ";")
- }
- return e
- }
- }, e.exports = i.default
- }), {
- "../../../renderer/enums": 355
- }],
- 79: [(function(t, e, i) {
- "use strict";
- t("../CCNode").EventType;
- var n = 56,
- r = 7,
- s = cc.Enum({
- ONCE: 0,
- ON_WINDOW_RESIZE: 1,
- ALWAYS: 2
- });
- function o(t) {
- return t instanceof cc.Scene ? cc.visibleRect : t._contentSize
- }
- function a(t, e, i, n) {
- for (var r = t._parent.scaleX, s = t._parent.scaleY, o = 0, a = 0, l = t._parent;;) {
- if (o += l.x, a += l.y, !(l = l._parent)) return i.x = i.y = 0, void(n.x = n.y = 1);
- if (l === e) break;
- var h = l.scaleX,
- c = l.scaleY;
- o *= h, a *= c, r *= h, s *= c
- }
- n.x = 0 !== r ? 1 / r : 1, n.y = 0 !== s ? 1 / s : 1, i.x = -o, i.y = -a
- }
- var l = cc.Vec2.ZERO,
- h = cc.Vec2.ONE;
- function c(t, e) {
- var i, s, c, u = e._target;
- u ? a(t, i = u, s = l, c = h) : i = t._parent;
- var _ = o(i),
- f = i._anchorPoint,
- d = i instanceof cc.Scene,
- p = t.x,
- m = t.y,
- y = t._anchorPoint;
- if (e._alignFlags & n) {
- var v, g, x = _.width;
- d ? (v = cc.visibleRect.left.x, g = cc.visibleRect.right.x) : g = (v = -f.x * x) + x, v += e._isAbsLeft ? e._left : e._left * x, g -= e._isAbsRight ? e._right : e._right * x, u && (v += s.x, v *= c.x, g += s.x, g *= c.x);
- var b, A = y.x,
- C = t.scaleX;
- if (C < 0 && (A = 1 - A, C = -C), e.isStretchWidth) b = g - v, 0 !== C && (t.width = b / C), p = v + A * b;
- else if (b = t.width * C, e.isAlignHorizontalCenter) {
- var T = e._isAbsHorizontalCenter ? e._horizontalCenter : e._horizontalCenter * x,
- S = (.5 - f.x) * _.width;
- u && (T *= c.x, S += s.x, S *= c.x), p = S + (A - .5) * b + T
- } else p = e.isAlignLeft ? v + A * b : g + (A - 1) * b
- }
- if (e._alignFlags & r) {
- var w, E, M = _.height;
- d ? (E = cc.visibleRect.bottom.y, w = cc.visibleRect.top.y) : w = (E = -f.y * M) + M, E += e._isAbsBottom ? e._bottom : e._bottom * M, w -= e._isAbsTop ? e._top : e._top * M, u && (E += s.y, E *= c.y, w += s.y, w *= c.y);
- var D, B = y.y,
- I = t.scaleY;
- if (I < 0 && (B = 1 - B, I = -I), e.isStretchHeight) D = w - E, 0 !== I && (t.height = D / I), m = E + B * D;
- else if (D = t.height * I, e.isAlignVerticalCenter) {
- var P = e._isAbsVerticalCenter ? e._verticalCenter : e._verticalCenter * M,
- R = (.5 - f.y) * _.height;
- u && (P *= c.y, R += s.y, R *= c.y), m = R + (B - .5) * D + P
- } else m = e.isAlignBottom ? E + B * D : w + (B - 1) * D
- }
- t.setPosition(p, m)
- }
- function u(t) {
- var e = t._widget;
- e && (c(t, e), e.alignMode !== s.ALWAYS ? e.enabled = !1 : f.push(e));
- for (var i = t._children, n = 0; n < i.length; n++) {
- var r = i[n];
- r._active && u(r)
- }
- }
- function _() {
- var t = cc.director.getScene();
- if (t) {
- if (d.isAligning = !0, d._nodesOrderDirty) f.length = 0, u(t), d._nodesOrderDirty = !1;
- else {
- var e, i = d._activeWidgetsIterator;
- for (i.i = 0; i.i < f.length; ++i.i) c((e = f[i.i]).node, e)
- }
- d.isAligning = !1
- }
- }
- var f = [];
- var d = cc._widgetManager = e.exports = {
- _AlignFlags: {
- TOP: 1,
- MID: 2,
- BOT: 4,
- LEFT: 8,
- CENTER: 16,
- RIGHT: 32
- },
- isAligning: !1,
- _nodesOrderDirty: !1,
- _activeWidgetsIterator: new cc.js.array.MutableForwardIterator(f),
- init: function(t) {
- t.on(cc.Director.EVENT_AFTER_UPDATE, _), cc.sys.isMobile ? window.addEventListener("resize", this.onResized.bind(this)) : cc.view.on("canvas-resize", this.onResized, this)
- },
- add: function(t) {
- t.node._widget = t, this._nodesOrderDirty = !0
- },
- remove: function(t) {
- t.node._widget = null, this._activeWidgetsIterator.remove(t)
- },
- onResized: function() {
- var t = cc.director.getScene();
- t && this.refreshWidgetOnResized(t)
- },
- refreshWidgetOnResized: function(t) {
- var e = cc.Node.isNode(t) && t.getComponent(cc.Widget);
- e && e.alignMode === s.ON_WINDOW_RESIZE && (e.enabled = !0);
- for (var i = t._children, n = 0; n < i.length; n++) {
- var r = i[n];
- this.refreshWidgetOnResized(r)
- }
- },
- updateAlignment: function t(e) {
- var i = e._parent;
- cc.Node.isNode(i) && t(i);
- var n = e._widget || e.getComponent(cc.Widget);
- n && i && c(e, n)
- },
- AlignMode: s
- }
- }), {
- "../CCNode": 52
- }],
- 80: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../geom-utils"));
- var r = t("../utils/affine-transform"),
- s = t("../renderer/index"),
- o = t("../renderer/render-flow"),
- a = t("../CCGame"),
- l = null;
- l = t("../../renderer/scene/camera");
- var h = cc.vmath.mat4,
- c = cc.vmath.vec2,
- u = cc.vmath.vec3,
- _ = h.create(),
- f = h.create(),
- d = cc.v3(),
- p = cc.v3(),
- m = cc.v3(),
- y = [],
- v = null;
- function g() {
- if (v) {
- var t = v.getNode(),
- e = cc.game.canvas;
- t.z = e.height / 1.1566, t.x = e.width / 2, t.y = e.height / 2
- }
- }
- var x = cc.Enum({
- COLOR: 1,
- DEPTH: 2,
- STENCIL: 4
- }),
- b = cc.Enum({
- OPAQUE: 1,
- TRANSPARENT: 2
- }),
- A = cc.Class({
- name: "cc.Camera",
- extends: cc.Component,
- ctor: function() {
- if (a.renderType !== a.RENDER_TYPE_CANVAS) {
- var t = new l;
- t.setStages(["opaque"]), t.dirty = !0, this._inited = !1, this._camera = t
- } else this._inited = !0
- },
- editor: !1,
- properties: {
- _cullingMask: 4294967295,
- _clearFlags: x.DEPTH | x.STENCIL,
- _backgroundColor: cc.color(0, 0, 0, 255),
- _depth: 0,
- _zoomRatio: 1,
- _targetTexture: null,
- _fov: 60,
- _orthoSize: 10,
- _nearClip: 1,
- _farClip: 4096,
- _ortho: !0,
- _rect: cc.rect(0, 0, 1, 1),
- _renderStages: 1,
- _alignWithScreen: !0,
- zoomRatio: {
- get: function() {
- return this._zoomRatio
- },
- set: function(t) {
- this._zoomRatio = t
- },
- tooltip: !1
- },
- fov: {
- get: function() {
- return this._fov
- },
- set: function(t) {
- this._fov = t
- },
- tooltip: !1
- },
- orthoSize: {
- get: function() {
- return this._orthoSize
- },
- set: function(t) {
- this._orthoSize = t
- },
- tooltip: !1
- },
- nearClip: {
- get: function() {
- return this._nearClip
- },
- set: function(t) {
- this._nearClip = t, this._updateClippingpPlanes()
- },
- tooltip: !1
- },
- farClip: {
- get: function() {
- return this._farClip
- },
- set: function(t) {
- this._farClip = t, this._updateClippingpPlanes()
- },
- tooltip: !1
- },
- ortho: {
- get: function() {
- return this._ortho
- },
- set: function(t) {
- this._ortho = t, this._updateProjection()
- },
- tooltip: !1
- },
- rect: {
- get: function() {
- return this._rect
- },
- set: function(t) {
- this._rect = t, this._updateRect()
- },
- tooltip: !1
- },
- cullingMask: {
- get: function() {
- return this._cullingMask
- },
- set: function(t) {
- this._cullingMask = t, this._updateCameraMask()
- },
- tooltip: !1
- },
- clearFlags: {
- get: function() {
- return this._clearFlags
- },
- set: function(t) {
- this._clearFlags = t, this._camera && this._camera.setClearFlags(t)
- },
- tooltip: !1
- },
- backgroundColor: {
- get: function() {
- return this._backgroundColor
- },
- set: function(t) {
- this._backgroundColor = t, this._updateBackgroundColor()
- },
- tooltip: !1
- },
- depth: {
- get: function() {
- return this._depth
- },
- set: function(t) {
- this._depth = t, this._camera && this._camera.setPriority(t)
- },
- tooltip: !1
- },
- targetTexture: {
- get: function() {
- return this._targetTexture
- },
- set: function(t) {
- this._targetTexture = t, this._updateTargetTexture()
- },
- tooltip: !1
- },
- renderStages: {
- get: function() {
- return this._renderStages
- },
- set: function(t) {
- this._renderStages = t, this._updateStages()
- },
- tooltip: !1
- },
- alignWithScreen: {
- get: function() {
- return this._alignWithScreen
- },
- set: function(t) {
- this._alignWithScreen = t
- }
- },
- _is3D: {
- get: function() {
- return this.node && this.node._is3DNode
- }
- }
- },
- statics: {
- main: null,
- cameras: y,
- ClearFlags: x,
- findCamera: function(t) {
- for (var e = 0, i = y.length; e < i; e++) {
- var n = y[e];
- if (n.containsNode(t)) return n
- }
- return null
- },
- _findRendererCamera: function(t) {
- for (var e = s.scene._cameras, i = 0; i < e._count; i++)
- if (e._data[i]._cullingMask & t._cullingMask) return e._data[i];
- return null
- },
- _setupDebugCamera: function() {
- if (!v && a.renderType !== a.RENDER_TYPE_CANVAS) {
- var t = new l;
- v = t, t.setStages(["opaque"]), t.setFov(60 * Math.PI / 180), t.setNear(.1), t.setFar(4096), t.dirty = !0, t.cullingMask = 1 << cc.Node.BuiltinGroupIndex.DEBUG, t.setPriority(cc.macro.MAX_ZINDEX), t.setClearFlags(0), t.setColor(0, 0, 0, 0);
- var e = new cc.Node;
- t.setNode(e), g(), cc.view.on("design-resolution-changed", g), s.scene.addCamera(t)
- }
- }
- },
- _updateCameraMask: function() {
- if (this._camera) {
- var t = this._cullingMask & ~(1 << cc.Node.BuiltinGroupIndex.DEBUG);
- this._camera.cullingMask = t
- }
- },
- _updateBackgroundColor: function() {
- if (this._camera) {
- var t = this._backgroundColor;
- this._camera.setColor(t.r / 255, t.g / 255, t.b / 255, t.a / 255)
- }
- },
- _updateTargetTexture: function() {
- if (this._camera) {
- var t = this._targetTexture;
- this._camera.setFrameBuffer(t ? t._framebuffer : null)
- }
- },
- _updateClippingpPlanes: function() {
- this._camera && (this._camera.setNear(this._nearClip), this._camera.setFar(this._farClip))
- },
- _updateProjection: function() {
- if (this._camera) {
- var t = this._ortho ? 1 : 0;
- this._camera.setType(t)
- }
- },
- _updateRect: function() {
- if (this._camera) {
- var t = this._rect;
- this._camera.setRect(t.x, t.y, t.width, t.height)
- }
- },
- _updateStages: function() {
- var t = this._renderStages,
- e = [];
- t & b.OPAQUE && e.push("opaque"), t & b.TRANSPARENT && e.push("transparent"), this._camera.setStages(e)
- },
- _init: function() {
- if (!this._inited) {
- this._inited = !0;
- var t = this._camera;
- t && (t.setNode(this.node), t.setClearFlags(this._clearFlags), t.setPriority(this._depth), this._updateBackgroundColor(), this._updateCameraMask(), this._updateTargetTexture(), this._updateClippingpPlanes(), this._updateProjection(), this._updateStages(), this._updateRect(), this.beforeDraw())
- }
- },
- onLoad: function() {
- this._init()
- },
- onEnable: function() {
- a.renderType !== a.RENDER_TYPE_CANVAS && (cc.director.on(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), s.scene.addCamera(this._camera)), y.push(this)
- },
- onDisable: function() {
- a.renderType !== a.RENDER_TYPE_CANVAS && (cc.director.off(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), s.scene.removeCamera(this._camera)), cc.js.array.remove(y, this)
- },
- getScreenToWorldMatrix2D: function(t) {
- return this.getWorldToScreenMatrix2D(t), h.invert(t, t), t
- },
- getWorldToScreenMatrix2D: function(t) {
- this.node.getWorldRT(_);
- var e = this.zoomRatio,
- i = _.m;
- i[0] *= e, i[1] *= e, i[4] *= e, i[5] *= e;
- var n = i[12],
- r = i[13],
- s = cc.visibleRect.center;
- return i[12] = s.x - (i[0] * n + i[4] * r), i[13] = s.y - (i[1] * n + i[5] * r), t !== _ && h.copy(t, _), t
- },
- getScreenToWorldPoint: function(t, e) {
- return this.node.is3DNode ? (e = e || new cc.Vec3, this._camera.screenToWorld(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, this.getScreenToWorldMatrix2D(_), c.transformMat4(e, t, _)), e
- },
- getWorldToScreenPoint: function(t, e) {
- return this.node.is3DNode ? (e = e || new cc.Vec3, this._camera.worldToScreen(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, this.getWorldToScreenMatrix2D(_), c.transformMat4(e, t, _)), e
- },
- getRay: function(t) {
- return n.default ? (u.set(m, t.x, t.y, 1), this._camera.screenToWorld(p, m, cc.visibleRect.width, cc.visibleRect.height), this.ortho ? (u.set(m, t.x, t.y, -1), this._camera.screenToWorld(d, m, cc.visibleRect.width, cc.visibleRect.height)) : this.node.getWorldPosition(d), n.default.Ray.fromPoints(n.default.Ray.create(), d, p)) : t
- },
- containsNode: function(t) {
- return t._cullingMask & this.cullingMask
- },
- render: function(t) {
- if (!(t = t || cc.director.getScene())) return null;
- this.node.getWorldMatrix(_), this.beforeDraw(), o.render(t), s._forward.renderCamera(this._camera, s.scene)
- },
- _onAlignWithScreen: function() {
- var t = cc.game.canvas.height / cc.view._scaleY;
- this._targetTexture && (t = cc.visibleRect.height);
- var e = this._fov * cc.macro.RAD;
- this.node.z = t / (2 * Math.tan(e / 2)), e = 2 * Math.atan(Math.tan(e / 2) / this.zoomRatio), this._camera.setFov(e), this._camera.setOrthoHeight(t / 2 / this.zoomRatio), this.node.setRotation(0, 0, 0, 1)
- },
- beforeDraw: function() {
- if (this._camera) {
- if (this._alignWithScreen) this._onAlignWithScreen();
- else {
- var t = this._fov * cc.macro.RAD;
- t = 2 * Math.atan(Math.tan(t / 2) / this.zoomRatio), this._camera.setFov(t), this._camera.setOrthoHeight(this._orthoSize * this.zoomRatio)
- }
- this._camera.dirty = !0
- }
- }
- });
- cc.js.mixin(A.prototype, {
- getNodeToCameraTransform: function(t) {
- var e = r.identity();
- return t.getWorldMatrix(f), this.containsNode(t) && (this.getWorldToCameraMatrix(_), h.mul(f, f, _)), r.fromMat4(e, f), e
- },
- getCameraToWorldPoint: function(t, e) {
- return this.getScreenToWorldPoint(t, e)
- },
- getWorldToCameraPoint: function(t, e) {
- return this.getWorldToScreenPoint(t, e)
- },
- getCameraToWorldMatrix: function(t) {
- return this.getScreenToWorldMatrix2D(t)
- },
- getWorldToCameraMatrix: function(t) {
- return this.getWorldToScreenMatrix2D(t)
- }
- }), e.exports = cc.Camera = A
- }), {
- "../../renderer/scene/camera": 380,
- "../CCGame": 51,
- "../geom-utils": 136,
- "../renderer/index": 247,
- "../renderer/render-flow": 248,
- "../utils/affine-transform": 290
- }],
- 81: [(function(t, e, i) {
- "use strict";
- cc.Collider.Box = cc.Class({
- properties: {
- _offset: cc.v2(0, 0),
- _size: cc.size(100, 100),
- offset: {
- tooltip: !1,
- get: function() {
- return this._offset
- },
- set: function(t) {
- this._offset = t
- },
- type: cc.Vec2
- },
- size: {
- tooltip: !1,
- get: function() {
- return this._size
- },
- set: function(t) {
- this._size.width = t.width < 0 ? 0 : t.width, this._size.height = t.height < 0 ? 0 : t.height
- },
- type: cc.Size
- }
- },
- resetInEditor: !1
- });
- var n = cc.Class({
- name: "cc.BoxCollider",
- extends: cc.Collider,
- mixins: [cc.Collider.Box],
- editor: !1
- });
- cc.BoxCollider = e.exports = n
- }), {}],
- 82: [(function(t, e, i) {
- "use strict";
- cc.Collider.Circle = cc.Class({
- properties: {
- _offset: cc.v2(0, 0),
- _radius: 50,
- offset: {
- get: function() {
- return this._offset
- },
- set: function(t) {
- this._offset = t
- },
- type: cc.Vec2
- },
- radius: {
- tooltip: !1,
- get: function() {
- return this._radius
- },
- set: function(t) {
- this._radius = t < 0 ? 0 : t
- }
- }
- },
- resetInEditor: !1
- });
- var n = cc.Class({
- name: "cc.CircleCollider",
- extends: cc.Collider,
- mixins: [cc.Collider.Circle],
- editor: !1
- });
- cc.CircleCollider = e.exports = n
- }), {}],
- 83: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Collider",
- extends: cc.Component,
- properties: {
- editing: {
- default: !1,
- serializable: !1,
- tooltip: !1
- },
- tag: {
- tooltip: !1,
- default: 0,
- range: [0, 1e7],
- type: cc.Integer
- }
- },
- onDisable: function() {
- cc.director.getCollisionManager().removeCollider(this)
- },
- onEnable: function() {
- cc.director.getCollisionManager().addCollider(this)
- }
- });
- cc.Collider = e.exports = n
- }), {}],
- 84: [(function(t, e, i) {
- "use strict";
- var n = t("./CCContact"),
- r = n.CollisionType,
- s = t("../CCNode").EventType,
- o = cc.vmath,
- a = cc.v2();
- function l(t, e, i, n, r, s) {
- var o = t.x,
- a = t.y,
- l = t.width,
- h = t.height,
- c = e.m,
- u = c[0],
- _ = c[1],
- f = c[4],
- d = c[5],
- p = u * o + f * a + c[12],
- m = _ * o + d * a + c[13],
- y = u * l,
- v = _ * l,
- g = f * h,
- x = d * h;
- n.x = p, n.y = m, r.x = y + p, r.y = v + m, i.x = g + p, i.y = x + m, s.x = y + g + p, s.y = v + x + m
- }
- var h = cc.Class({
- mixins: [cc.EventTarget],
- properties: {
- enabled: !1,
- enabledDrawBoundingBox: !1
- },
- ctor: function() {
- this._contacts = [], this._colliders = [], this._debugDrawer = null, this._enabledDebugDraw = !1, cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
- },
- update: function(t) {
- if (this.enabled) {
- var e = void 0,
- i = void 0,
- n = this._colliders;
- for (e = 0, i = n.length; e < i; e++) this.updateCollider(n[e]);
- var s = this._contacts,
- o = [];
- for (e = 0, i = s.length; e < i; e++) {
- var a = s[e].updateState();
- a !== r.None && o.push([a, s[e]])
- }
- for (e = 0, i = o.length; e < i; e++) {
- var l = o[e];
- this._doCollide(l[0], l[1])
- }
- this.drawColliders()
- }
- },
- _doCollide: function(t, e) {
- var i = void 0;
- switch (t) {
- case r.CollisionEnter:
- i = "onCollisionEnter";
- break;
- case r.CollisionStay:
- i = "onCollisionStay";
- break;
- case r.CollisionExit:
- i = "onCollisionExit"
- }
- var n = e.collider1,
- s = e.collider2,
- o = n.node._components,
- a = s.node._components,
- l = void 0,
- h = void 0,
- c = void 0;
- for (l = 0, h = o.length; l < h; l++)(c = o[l])[i] && c[i](s, n);
- for (l = 0, h = a.length; l < h; l++)(c = a[l])[i] && c[i](n, s)
- },
- shouldCollide: function(t, e) {
- var i = t.node,
- n = e.node,
- r = cc.game.collisionMatrix;
- return i !== n && r[i.groupIndex][n.groupIndex]
- },
- initCollider: function(t) {
- if (!t.world) {
- var e = t.world = {};
- e.aabb = cc.rect(), e.preAabb = cc.rect(), e.matrix = o.mat4.create(), e.radius = 0, t instanceof cc.BoxCollider ? (e.position = null, e.points = [cc.v2(), cc.v2(), cc.v2(), cc.v2()]) : t instanceof cc.PolygonCollider ? (e.position = null, e.points = t.points.map((function(t) {
- return cc.v2(t.x, t.y)
- }))) : t instanceof cc.CircleCollider && (e.position = cc.v2(), e.points = null)
- }
- },
- updateCollider: function(t) {
- var e = t.offset,
- i = t.world,
- n = i.aabb,
- r = i.matrix;
- t.node.getWorldMatrix(r);
- var s = i.preAabb;
- if (s.x = n.x, s.y = n.y, s.width = n.width, s.height = n.height, t instanceof cc.BoxCollider) {
- var h = t.size;
- n.x = e.x - h.width / 2, n.y = e.y - h.height / 2, n.width = h.width, n.height = h.height;
- var c = i.points,
- u = c[0],
- _ = c[1],
- f = c[2],
- d = c[3];
- l(n, r, u, _, f, d);
- var p = Math.min(u.x, _.x, f.x, d.x),
- m = Math.min(u.y, _.y, f.y, d.y),
- y = Math.max(u.x, _.x, f.x, d.x),
- v = Math.max(u.y, _.y, f.y, d.y);
- n.x = p, n.y = m, n.width = y - p, n.height = v - m
- } else if (t instanceof cc.CircleCollider) {
- o.vec2.transformMat4(a, t.offset, r), i.position.x = a.x, i.position.y = a.y;
- var g = r.m,
- x = g[12],
- b = g[13];
- g[12] = g[13] = 0, a.x = t.radius, a.y = 0, o.vec2.transformMat4(a, a, r);
- var A = Math.sqrt(a.x * a.x + a.y * a.y);
- i.radius = A, n.x = i.position.x - A, n.y = i.position.y - A, n.width = 2 * A, n.height = 2 * A, g[12] = x, g[13] = b
- } else if (t instanceof cc.PolygonCollider) {
- var C = t.points,
- T = i.points;
- T.length = C.length;
- for (var S = 1e6, w = 1e6, E = -1e6, M = -1e6, D = 0, B = C.length; D < B; D++) {
- T[D] || (T[D] = cc.v2()), a.x = C[D].x + e.x, a.y = C[D].y + e.y, o.vec2.transformMat4(a, a, r);
- var I = a.x,
- P = a.y;
- T[D].x = I, T[D].y = P, I > E && (E = I), I < S && (S = I), P > M && (M = P), P < w && (w = P)
- }
- n.x = S, n.y = w, n.width = E - S, n.height = M - w
- }
- },
- addCollider: function(t) {
- var e = this._colliders;
- if (-1 === e.indexOf(t)) {
- for (var i = 0, r = e.length; i < r; i++) {
- var o = e[i];
- if (this.shouldCollide(t, o)) {
- var a = new n(t, o);
- this._contacts.push(a)
- }
- }
- e.push(t), this.initCollider(t)
- }
- t.node.on(s.GROUP_CHANGED, this.onNodeGroupChanged, this)
- },
- removeCollider: function(t) {
- var e = this._colliders,
- i = e.indexOf(t);
- if (i >= 0) {
- e.splice(i, 1);
- for (var n = this._contacts, o = n.length - 1; o >= 0; o--) {
- var a = n[o];
- a.collider1 !== t && a.collider2 !== t || (a.touching && this._doCollide(r.CollisionExit, a), n.splice(o, 1))
- }
- t.node.off(s.GROUP_CHANGED, this.onNodeGroupChanged, this)
- } else cc.errorID(6600)
- },
- onNodeGroupChanged: function(t) {
- for (var e = t.getComponents(cc.Collider), i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- cc.PhysicsCollider && r instanceof cc.PhysicsCollider || (this.removeCollider(r), this.addCollider(r))
- }
- },
- drawColliders: function() {
- if (this._enabledDebugDraw) {
- this._checkDebugDrawValid();
- var t = this._debugDrawer;
- t.clear();
- for (var e = this._colliders, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (t.strokeColor = cc.Color.WHITE, r instanceof cc.BoxCollider || r instanceof cc.PolygonCollider) {
- var s = r.world.points;
- if (s.length > 0) {
- t.moveTo(s[0].x, s[0].y);
- for (var o = 1; o < s.length; o++) t.lineTo(s[o].x, s[o].y);
- t.close(), t.stroke()
- }
- } else r instanceof cc.CircleCollider && (t.circle(r.world.position.x, r.world.position.y, r.world.radius), t.stroke());
- if (this.enabledDrawBoundingBox) {
- var a = r.world.aabb;
- t.strokeColor = cc.Color.BLUE, t.moveTo(a.xMin, a.yMin), t.lineTo(a.xMin, a.yMax), t.lineTo(a.xMax, a.yMax), t.lineTo(a.xMax, a.yMin), t.close(), t.stroke()
- }
- }
- }
- },
- _checkDebugDrawValid: function() {
- if (!this._debugDrawer || !this._debugDrawer.isValid) {
- var t = new cc.Node("COLLISION_MANAGER_DEBUG_DRAW");
- t.zIndex = cc.macro.MAX_ZINDEX, cc.game.addPersistRootNode(t), this._debugDrawer = t.addComponent(cc.Graphics)
- }
- }
- });
- cc.js.getset(h.prototype, "enabledDebugDraw", (function() {
- return this._enabledDebugDraw
- }), (function(t) {
- t && !this._enabledDebugDraw ? (this._checkDebugDrawValid(), this._debugDrawer.node.active = !0) : !t && this._enabledDebugDraw && (this._debugDrawer.clear(!0), this._debugDrawer.node.active = !1), this._enabledDebugDraw = t
- })), cc.CollisionManager = e.exports = h
- }), {
- "../CCNode": 52,
- "./CCContact": 85
- }],
- 85: [(function(t, e, i) {
- "use strict";
- var n = t("./CCIntersection"),
- r = cc.Enum({
- None: 0,
- CollisionEnter: 1,
- CollisionStay: 2,
- CollisionExit: 3
- });
- function s(t, e) {
- this.collider1 = t, this.collider2 = e, this.touching = !1;
- var i = t instanceof cc.BoxCollider || t instanceof cc.PolygonCollider,
- r = e instanceof cc.BoxCollider || e instanceof cc.PolygonCollider,
- s = t instanceof cc.CircleCollider,
- o = e instanceof cc.CircleCollider;
- i && r ? this.testFunc = n.polygonPolygon : s && o ? this.testFunc = n.circleCircle : i && o ? this.testFunc = n.polygonCircle : s && r ? (this.testFunc = n.polygonCircle, this.collider1 = e, this.collider2 = t) : cc.errorID(6601, cc.js.getClassName(t), cc.js.getClassName(e))
- }
- s.prototype.test = function() {
- var t = this.collider1.world,
- e = this.collider2.world;
- return !!t.aabb.intersects(e.aabb) && (this.testFunc === n.polygonPolygon ? this.testFunc(t.points, e.points) : this.testFunc === n.circleCircle ? this.testFunc(t, e) : this.testFunc === n.polygonCircle && this.testFunc(t.points, e))
- }, s.prototype.updateState = function() {
- var t = this.test(),
- e = r.None;
- return t && !this.touching ? (this.touching = !0, e = r.CollisionEnter) : t && this.touching ? e = r.CollisionStay : !t && this.touching && (this.touching = !1, e = r.CollisionExit), e
- }, s.CollisionType = r, e.exports = s
- }), {
- "./CCIntersection": 86
- }],
- 86: [(function(t, e, i) {
- "use strict";
- var n = {};
- function r(t, e, i, n) {
- var r = (n.x - i.x) * (t.y - i.y) - (n.y - i.y) * (t.x - i.x),
- s = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x),
- o = (n.y - i.y) * (e.x - t.x) - (n.x - i.x) * (e.y - t.y);
- if (0 !== o) {
- var a = r / o,
- l = s / o;
- if (0 <= a && a <= 1 && 0 <= l && l <= 1) return !0
- }
- return !1
- }
- function s(t, e, i) {
- for (var n = i.length, s = 0; s < n; ++s) {
- if (r(t, e, i[s], i[(s + 1) % n])) return !0
- }
- return !1
- }
- function o(t, e) {
- for (var i = !1, n = t.x, r = t.y, s = e.length, o = 0, a = s - 1; o < s; a = o++) {
- var l = e[o].x,
- h = e[o].y,
- c = e[a].x,
- u = e[a].y;
- h > r != u > r && n < (c - l) * (r - h) / (u - h) + l && (i = !i)
- }
- return i
- }
- function a(t, e, i, n) {
- var r, s = i.x - e.x,
- o = i.y - e.y,
- a = s * s + o * o,
- l = ((t.x - e.x) * s + (t.y - e.y) * o) / a;
- return r = n ? a ? l < 0 ? e : l > 1 ? i : cc.v2(e.x + l * s, e.y + l * o) : e : cc.v2(e.x + l * s, e.y + l * o), s = t.x - r.x, o = t.y - r.y, Math.sqrt(s * s + o * o)
- }
- n.lineLine = r, n.lineRect = function(t, e, i) {
- var n = new cc.Vec2(i.x, i.y),
- s = new cc.Vec2(i.x, i.yMax),
- o = new cc.Vec2(i.xMax, i.yMax),
- a = new cc.Vec2(i.xMax, i.y);
- return !!(r(t, e, n, s) || r(t, e, s, o) || r(t, e, o, a) || r(t, e, a, n))
- }, n.linePolygon = s, n.rectRect = function(t, e) {
- var i = t.x,
- n = t.y,
- r = t.x + t.width,
- s = t.y + t.height,
- o = e.x,
- a = e.y,
- l = e.x + e.width,
- h = e.y + e.height;
- return i <= l && r >= o && n <= h && s >= a
- }, n.rectPolygon = function(t, e) {
- var i, n, r = new cc.Vec2(t.x, t.y),
- a = new cc.Vec2(t.x, t.yMax),
- l = new cc.Vec2(t.xMax, t.yMax),
- h = new cc.Vec2(t.xMax, t.y);
- if (s(r, a, e)) return !0;
- if (s(a, l, e)) return !0;
- if (s(l, h, e)) return !0;
- if (s(h, r, e)) return !0;
- for (i = 0, n = e.length; i < n; ++i)
- if (o(e[i], t)) return !0;
- return !!(o(r, e) || o(a, e) || o(l, e) || o(h, e))
- }, n.polygonPolygon = function(t, e) {
- var i, n;
- for (i = 0, n = t.length; i < n; ++i)
- if (s(t[i], t[(i + 1) % n], e)) return !0;
- for (i = 0, n = e.length; i < n; ++i)
- if (o(e[i], t)) return !0;
- for (i = 0, n = t.length; i < n; ++i)
- if (o(t[i], e)) return !0;
- return !1
- }, n.circleCircle = function(t, e) {
- return t.position.sub(e.position).mag() < t.radius + e.radius
- }, n.polygonCircle = function(t, e) {
- var i = e.position;
- if (o(i, t)) return !0;
- for (var n = 0, r = t.length; n < r; n++)
- if (a(i, 0 === n ? t[t.length - 1] : t[n - 1], t[n], !0) < e.radius) return !0;
- return !1
- }, n.pointInPolygon = o, n.pointLineDistance = a, cc.Intersection = e.exports = n
- }), {}],
- 87: [(function(t, e, i) {
- "use strict";
- cc.Collider.Polygon = cc.Class({
- properties: {
- threshold: {
- default: 1,
- serializable: !1,
- visible: !1
- },
- _offset: cc.v2(0, 0),
- offset: {
- get: function() {
- return this._offset
- },
- set: function(t) {
- this._offset = t
- },
- type: cc.Vec2
- },
- points: {
- tooltip: !1,
- default: function() {
- return [cc.v2(-50, -50), cc.v2(50, -50), cc.v2(50, 50), cc.v2(-50, 50)]
- },
- type: [cc.Vec2]
- }
- },
- resetPointsByContour: !1
- });
- var n = cc.Class({
- name: "cc.PolygonCollider",
- extends: cc.Collider,
- mixins: [cc.Collider.Polygon],
- editor: !1
- });
- cc.PolygonCollider = e.exports = n
- }), {}],
- 88: [(function(t, e, i) {
- "use strict";
- t("./CCCollisionManager"), t("./CCCollider"), t("./CCBoxCollider"), t("./CCCircleCollider"), t("./CCPolygonCollider")
- }), {
- "./CCBoxCollider": 81,
- "./CCCircleCollider": 82,
- "./CCCollider": 83,
- "./CCCollisionManager": 84,
- "./CCPolygonCollider": 87
- }],
- 89: [(function(t, e, i) {
- "use strict";
- t("./platform/CCClass");
- var n = t("./platform/CCObject").Flags,
- r = t("./platform/js").array,
- s = n.IsStartCalled,
- o = n.IsOnEnableCalled;
- n.IsEditorOnEnableCalled;
- function a(t, e) {
- for (var i = e.constructor._executionOrder, n = e._id, r = 0, s = t.length - 1, o = s >>> 1; r <= s; o = r + s >>> 1) {
- var a = t[o],
- l = a.constructor._executionOrder;
- if (l > i) s = o - 1;
- else if (l < i) r = o + 1;
- else {
- var h = a._id;
- if (h > n) s = o - 1;
- else {
- if (!(h < n)) return o;
- r = o + 1
- }
- }
- }
- return ~r
- }
- function l(t, e) {
- for (var i = t.array, n = t.i + 1; n < i.length;) {
- var r = i[n];
- r._enabled && r.node._activeInHierarchy ? ++n : (t.removeAt(n), e && (r._objFlags &= ~e))
- }
- }
- var h = cc.Class({
- __ctor__: function(t) {
- var e = r.MutableForwardIterator;
- this._zero = new e([]), this._neg = new e([]), this._pos = new e([]), this._invoke = t
- },
- statics: {
- stableRemoveInactive: l
- },
- add: null,
- remove: null,
- invoke: null
- });
- function c(t, e) {
- return t.constructor._executionOrder - e.constructor._executionOrder
- }
- var u = cc.Class({
- extends: h,
- add: function(t) {
- var e = t.constructor._executionOrder;
- (0 === e ? this._zero : e < 0 ? this._neg : this._pos).array.push(t)
- },
- remove: function(t) {
- var e = t.constructor._executionOrder;
- (0 === e ? this._zero : e < 0 ? this._neg : this._pos).fastRemove(t)
- },
- cancelInactive: function(t) {
- l(this._zero, t), l(this._neg, t), l(this._pos, t)
- },
- invoke: function() {
- var t = this._neg;
- t.array.length > 0 && (t.array.sort(c), this._invoke(t), t.array.length = 0), this._invoke(this._zero), this._zero.array.length = 0;
- var e = this._pos;
- e.array.length > 0 && (e.array.sort(c), this._invoke(e), e.array.length = 0)
- }
- }),
- _ = cc.Class({
- extends: h,
- add: function(t) {
- var e = t.constructor._executionOrder;
- if (0 === e) this._zero.array.push(t);
- else {
- var i = e < 0 ? this._neg.array : this._pos.array,
- n = a(i, t);
- n < 0 && i.splice(~n, 0, t)
- }
- },
- remove: function(t) {
- var e = t.constructor._executionOrder;
- if (0 === e) this._zero.fastRemove(t);
- else {
- var i = e < 0 ? this._neg : this._pos,
- n = a(i.array, t);
- n >= 0 && i.removeAt(n)
- }
- },
- invoke: function(t) {
- this._neg.array.length > 0 && this._invoke(this._neg, t), this._invoke(this._zero, t), this._pos.array.length > 0 && this._invoke(this._pos, t)
- }
- });
- function f(t, e, i, n) {
- var r = "var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];" + t + "}";
- return n = e ? Function("it", "dt", r) : Function("it", r), t = Function("c", "dt", t),
- function(e, r) {
- try {
- n(e, r)
- } catch (n) {
- cc._throw(n);
- var s = e.array;
- for (i && (s[e.i]._objFlags |= i), ++e.i; e.i < s.length; ++e.i) try {
- t(s[e.i], r)
- } catch (t) {
- cc._throw(t), i && (s[e.i]._objFlags |= i)
- }
- }
- }
- }
- var d = f("c.start();c._objFlags|=" + s, !1, s),
- p = f("c.update(dt)", !0),
- m = f("c.lateUpdate(dt)", !0);
- function y() {
- this.startInvoker = new u(d), this.updateInvoker = new _(p), this.lateUpdateInvoker = new _(m), this.scheduleInNextFrame = [], this._updating = !1
- }
- var v = cc.Class({
- ctor: y,
- unscheduleAll: y,
- statics: {
- LifeCycleInvoker: h,
- OneOffInvoker: u,
- createInvokeImpl: f,
- invokeOnEnable: function(t) {
- var e = cc.director._compScheduler,
- i = t.array;
- for (t.i = 0; t.i < i.length; ++t.i) {
- var n = i[t.i];
- if (n._enabled) n.onEnable(), !n.node._activeInHierarchy || e._onEnabled(n)
- }
- }
- },
- _onEnabled: function(t) {
- cc.director.getScheduler().resumeTarget(t), t._objFlags |= o, this._updating ? this.scheduleInNextFrame.push(t) : this._scheduleImmediate(t)
- },
- _onDisabled: function(t) {
- cc.director.getScheduler().pauseTarget(t), t._objFlags &= ~o;
- var e = this.scheduleInNextFrame.indexOf(t);
- e >= 0 ? r.fastRemoveAt(this.scheduleInNextFrame, e) : (!t.start || t._objFlags & s || this.startInvoker.remove(t), t.update && this.updateInvoker.remove(t), t.lateUpdate && this.lateUpdateInvoker.remove(t))
- },
- enableComp: function(t, e) {
- if (!(t._objFlags & o)) {
- if (t.onEnable) {
- if (e) return void e.add(t);
- if (t.onEnable(), !t.node._activeInHierarchy) return
- }
- this._onEnabled(t)
- }
- },
- disableComp: function(t) {
- t._objFlags & o && (t.onDisable && t.onDisable(), this._onDisabled(t))
- },
- _scheduleImmediate: function(t) {
- !t.start || t._objFlags & s || this.startInvoker.add(t), t.update && this.updateInvoker.add(t), t.lateUpdate && this.lateUpdateInvoker.add(t)
- },
- _deferredSchedule: function() {
- for (var t = this.scheduleInNextFrame, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- this._scheduleImmediate(n)
- }
- t.length = 0
- },
- startPhase: function() {
- this._updating = !0, this.scheduleInNextFrame.length > 0 && this._deferredSchedule(), this.startInvoker.invoke()
- },
- updatePhase: function(t) {
- this.updateInvoker.invoke(t)
- },
- lateUpdatePhase: function(t) {
- this.lateUpdateInvoker.invoke(t), this._updating = !1
- }
- });
- e.exports = v
- }), {
- "./platform/CCClass": 198,
- "./platform/CCObject": 204,
- "./platform/js": 218,
- "./utils/misc": 300
- }],
- 90: [(function(t, e, i) {
- "use strict";
- var n = t("../../animation/animation-animator"),
- r = t("../../animation/animation-clip"),
- s = t("../event/event-target"),
- o = t("../platform/js");
- function a(t, e) {
- return t === e || t && e && (t.name === e.name || t._uuid === e._uuid)
- }
- var l = cc.Enum({
- PLAY: "play",
- STOP: "stop",
- PAUSE: "pause",
- RESUME: "resume",
- LASTFRAME: "lastframe",
- FINISHED: "finished"
- }),
- h = cc.Class({
- name: "cc.Animation",
- extends: t("./CCComponent"),
- mixins: [s],
- editor: !1,
- statics: {
- EventType: l
- },
- ctor: function() {
- cc.EventTarget.call(this), this._animator = null, this._nameToState = o.createMap(!0), this._didInit = !1, this._currentClip = null
- },
- properties: {
- _defaultClip: {
- default: null,
- type: r
- },
- defaultClip: {
- type: r,
- get: function() {
- return this._defaultClip
- },
- set: function(t) {},
- tooltip: !1
- },
- currentClip: {
- get: function() {
- return this._currentClip
- },
- set: function(t) {
- this._currentClip = t
- },
- type: r,
- visible: !1
- },
- _writableClips: {
- get: function() {
- return this._clips
- },
- set: function(t) {
- this._didInit = !1, this._clips = t, this._init()
- },
- type: [r]
- },
- _clips: {
- default: [],
- type: [r],
- tooltip: !1,
- visible: !0
- },
- playOnLoad: {
- default: !1,
- tooltip: !1
- }
- },
- start: function() {
- if (this.playOnLoad && this._defaultClip && !(this._animator && this._animator.isPlaying)) {
- var t = this.getAnimationState(this._defaultClip.name);
- this._animator.playState(t)
- }
- },
- onEnable: function() {
- this._animator && this._animator.resume()
- },
- onDisable: function() {
- this._animator && this._animator.pause()
- },
- onDestroy: function() {
- this.stop()
- },
- getClips: function() {
- return this._clips
- },
- play: function(t, e) {
- var i = this.playAdditive(t, e);
- return this._animator.stopStatesExcept(i), i
- },
- playAdditive: function(t, e) {
- this._init();
- var i = this.getAnimationState(t || this._defaultClip && this._defaultClip.name);
- if (i) {
- this.enabled = !0;
- var n = this._animator;
- n.isPlaying && i.isPlaying ? i.isPaused ? n.resumeState(i) : (n.stopState(i), n.playState(i, e)) : n.playState(i, e), this.enabledInHierarchy || n.pause(), this.currentClip = i.clip
- }
- return i
- },
- stop: function(t) {
- if (this._didInit)
- if (t) {
- var e = this._nameToState[t];
- e && this._animator.stopState(e)
- } else this._animator.stop()
- },
- pause: function(t) {
- if (this._didInit)
- if (t) {
- var e = this._nameToState[t];
- e && this._animator.pauseState(e)
- } else this.enabled = !1
- },
- resume: function(t) {
- if (this._didInit)
- if (t) {
- var e = this._nameToState[t];
- e && this._animator.resumeState(e)
- } else this.enabled = !0
- },
- setCurrentTime: function(t, e) {
- if (this._init(), e) {
- var i = this._nameToState[e];
- i && this._animator.setStateTime(i, t)
- } else this._animator.setStateTime(t)
- },
- getAnimationState: function(t) {
- this._init();
- var e = this._nameToState[t];
- return e && !e.curveLoaded && this._animator._reloadClip(e), e || null
- },
- addClip: function(t, e) {
- if (t) {
- this._init(), cc.js.array.contains(this._clips, t) || this._clips.push(t), e = e || t.name;
- var i = this._nameToState[e];
- if (i) {
- if (i.clip === t) return i;
- var n = this._clips.indexOf(i.clip); - 1 !== n && this._clips.splice(n, 1)
- }
- var r = new cc.AnimationState(t, e);
- return this._nameToState[e] = r, r
- }
- cc.warnID(3900)
- },
- removeClip: function(t, e) {
- if (t) {
- this._init();
- var i = void 0;
- for (var n in this._nameToState) {
- if ((i = this._nameToState[n]).clip === t) break
- }
- if (t === this._defaultClip) {
- if (!e) return void cc.warnID(3902);
- this._defaultClip = null
- }
- if (i && i.isPlaying) {
- if (!e) return void cc.warnID(3903);
- this.stop(i.name)
- }
- this._clips = this._clips.filter((function(e) {
- return e !== t
- })), i && delete this._nameToState[i.name]
- } else cc.warnID(3901)
- },
- sample: function(t) {
- if (this._init(), t) {
- var e = this._nameToState[t];
- e && e.sample()
- } else this._animator.sample()
- },
- on: function(t, e, i, n) {
- this._init();
- var r = this._EventTargetOn(t, e, i, n);
- if ("lastframe" === t) {
- var s = this._nameToState;
- for (var o in s) s[o]._lastframeEventOn = !0
- }
- return r
- },
- off: function(t, e, i, n) {
- if (this._init(), "lastframe" === t) {
- var r = this._nameToState;
- for (var s in r) r[s]._lastframeEventOn = !1
- }
- this._EventTargetOff(t, e, i, n)
- },
- _init: function() {
- this._didInit || (this._didInit = !0, this._animator = new n(this.node, this), this._createStates())
- },
- _createStates: function() {
- this._nameToState = o.createMap(!0);
- for (var t = null, e = !1, i = 0; i < this._clips.length; ++i) {
- var n = this._clips[i];
- n && (t = new cc.AnimationState(n), this._nameToState[t.name] = t, a(this._defaultClip, n) && (e = t))
- }
- this._defaultClip && !e && (t = new cc.AnimationState(this._defaultClip), this._nameToState[t.name] = t)
- }
- });
- h.prototype._EventTargetOn = s.prototype.on, h.prototype._EventTargetOff = s.prototype.off, cc.Animation = e.exports = h
- }), {
- "../../animation/animation-animator": 9,
- "../../animation/animation-clip": 10,
- "../event/event-target": 131,
- "../platform/js": 218,
- "./CCComponent": 95
- }],
- 91: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc"),
- r = t("./CCComponent"),
- s = t("../assets/CCAudioClip"),
- o = cc.Class({
- name: "cc.AudioSource",
- extends: r,
- editor: !1,
- ctor: function() {
- this.audio = new cc.Audio
- },
- properties: {
- _clip: {
- default: null,
- type: s
- },
- _volume: 1,
- _mute: !1,
- _loop: !1,
- _pausedFlag: {
- default: !1,
- serializable: !1
- },
- isPlaying: {
- get: function() {
- return this.audio.getState() === cc.Audio.State.PLAYING
- },
- visible: !1
- },
- clip: {
- get: function() {
- return this._clip
- },
- set: function(t) {
- if ("string" != typeof t) t !== this._clip && (this._clip = t, this.audio.stop(), this.preload && (this.audio.src = this._clip));
- else {
- cc.warnID(8401, "cc.AudioSource", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio");
- var e = this;
- s._loadByUrl(t, (function(t, i) {
- i && (e.clip = i)
- }))
- }
- },
- type: s,
- tooltip: !1,
- animatable: !1
- },
- volume: {
- get: function() {
- return this._volume
- },
- set: function(t) {
- return t = n.clamp01(t), this._volume = t, this._mute || this.audio.setVolume(t), t
- },
- tooltip: !1
- },
- mute: {
- get: function() {
- return this._mute
- },
- set: function(t) {
- return this._mute = t, this.audio.setVolume(t ? 0 : this._volume), t
- },
- animatable: !1,
- tooltip: !1
- },
- loop: {
- get: function() {
- return this._loop
- },
- set: function(t) {
- return this._loop = t, this.audio.setLoop(t), t
- },
- animatable: !1,
- tooltip: !1
- },
- playOnLoad: {
- default: !1,
- tooltip: !1,
- animatable: !1
- },
- preload: {
- default: !1,
- animatable: !1
- }
- },
- _ensureDataLoaded: function() {
- this.audio.src !== this._clip && (this.audio.src = this._clip)
- },
- _pausedCallback: function() {
- this.audio.getState() === cc.Audio.State.PLAYING && (this.audio.pause(), this._pausedFlag = !0)
- },
- _restoreCallback: function() {
- this._pausedFlag && this.audio.resume(), this._pausedFlag = !1
- },
- onLoad: function() {
- this.audio.setVolume(this._mute ? 0 : this._volume), this.audio.setLoop(this._loop)
- },
- onEnable: function() {
- this.preload && (this.audio.src = this._clip), this.playOnLoad && this.play(), cc.game.on(cc.game.EVENT_HIDE, this._pausedCallback, this), cc.game.on(cc.game.EVENT_SHOW, this._restoreCallback, this)
- },
- onDisable: function() {
- this.stop(), cc.game.off(cc.game.EVENT_HIDE, this._pausedCallback, this), cc.game.off(cc.game.EVENT_SHOW, this._restoreCallback, this)
- },
- onDestroy: function() {
- this.stop(), this.audio.destroy(), cc.audioEngine.uncache(this._clip)
- },
- play: function() {
- if (this._clip) {
- var t = this.audio;
- this._clip.loaded && t.stop(), this._ensureDataLoaded(), t.setCurrentTime(0), t.play()
- }
- },
- stop: function() {
- this.audio.stop()
- },
- pause: function() {
- this.audio.pause()
- },
- resume: function() {
- this._ensureDataLoaded(), this.audio.resume()
- },
- rewind: function() {
- this.audio.setCurrentTime(0)
- },
- getCurrentTime: function() {
- return this.audio.getCurrentTime()
- },
- setCurrentTime: function(t) {
- return this.audio.setCurrentTime(t), t
- },
- getDuration: function() {
- return this.audio.getDuration()
- }
- });
- cc.AudioSource = e.exports = o
- }), {
- "../assets/CCAudioClip": 57,
- "../utils/misc": 300,
- "./CCComponent": 95
- }],
- 92: [(function(t, e, i) {
- "use strict";
- var n = ["touchstart", "touchmove", "touchend", "mousedown", "mousemove", "mouseup", "mouseenter", "mouseleave", "mousewheel"];
- function r(t) {
- t.stopPropagation()
- }
- var s = cc.Class({
- name: "cc.BlockInputEvents",
- extends: t("./CCComponent"),
- editor: {
- menu: "i18n:MAIN_MENU.component.ui/Block Input Events",
- inspector: "packages://inspector/inspectors/comps/block-input-events.js",
- help: "i18n:COMPONENT.help_url.block_input_events"
- },
- onEnable: function() {
- for (var t = 0; t < n.length; t++) this.node.on(n[t], r, this)
- },
- onDisable: function() {
- for (var t = 0; t < n.length; t++) this.node.off(n[t], r, this)
- }
- });
- cc.BlockInputEvents = e.exports = s
- }), {
- "./CCComponent": 95
- }],
- 93: [(function(t, e, i) {
- "use strict";
- var n = t("./CCComponent"),
- r = t("../utils/gray-sprite-state"),
- s = cc.Enum({
- NONE: 0,
- COLOR: 1,
- SPRITE: 2,
- SCALE: 3
- }),
- o = cc.Enum({
- NORMAL: 0,
- HOVER: 1,
- PRESSED: 2,
- DISABLED: 3
- }),
- a = cc.Class({
- name: "cc.Button",
- extends: n,
- mixins: [r],
- ctor: function() {
- this._pressed = !1, this._hovered = !1, this._fromColor = null, this._toColor = null, this._time = 0, this._transitionFinished = !0, this._fromScale = cc.Vec2.ZERO, this._toScale = cc.Vec2.ZERO, this._originalScale = null, this._graySpriteMaterial = null, this._spriteMaterial = null, this._sprite = null
- },
- editor: !1,
- properties: {
- interactable: {
- default: !0,
- tooltip: !1,
- notify: function() {
- this._updateState(), this.interactable || this._resetState()
- },
- animatable: !1
- },
- _resizeToTarget: {
- animatable: !1,
- set: function(t) {
- t && this._resizeNodeToTargetNode()
- }
- },
- enableAutoGrayEffect: {
- default: !1,
- tooltip: !1,
- notify: function() {
- this._updateDisabledState()
- }
- },
- transition: {
- default: s.NONE,
- tooltip: !1,
- type: s,
- animatable: !1,
- notify: function(t) {
- this._updateTransition(t)
- },
- formerlySerializedAs: "transition"
- },
- normalColor: {
- default: cc.Color.WHITE,
- displayName: "Normal",
- tooltip: !1,
- notify: function() {
- this.transition === s.Color && this._getButtonState() === o.NORMAL && (this._getTarget().opacity = this.normalColor.a), this._updateState()
- }
- },
- pressedColor: {
- default: cc.color(211, 211, 211),
- displayName: "Pressed",
- tooltip: !1,
- notify: function() {
- this.transition === s.Color && this._getButtonState() === o.PRESSED && (this._getTarget().opacity = this.pressedColor.a), this._updateState()
- },
- formerlySerializedAs: "pressedColor"
- },
- hoverColor: {
- default: cc.Color.WHITE,
- displayName: "Hover",
- tooltip: !1,
- notify: function() {
- this.transition === s.Color && this._getButtonState() === o.HOVER && (this._getTarget().opacity = this.hoverColor.a), this._updateState()
- },
- formerlySerializedAs: "hoverColor"
- },
- disabledColor: {
- default: cc.color(124, 124, 124),
- displayName: "Disabled",
- tooltip: !1,
- notify: function() {
- this.transition === s.Color && this._getButtonState() === o.DISABLED && (this._getTarget().opacity = this.disabledColor.a), this._updateState()
- }
- },
- duration: {
- default: .1,
- range: [0, 10],
- tooltip: !1
- },
- zoomScale: {
- default: 1.2,
- tooltip: !1
- },
- normalSprite: {
- default: null,
- type: cc.SpriteFrame,
- displayName: "Normal",
- tooltip: !1,
- notify: function() {
- this._updateState()
- }
- },
- pressedSprite: {
- default: null,
- type: cc.SpriteFrame,
- displayName: "Pressed",
- tooltip: !1,
- formerlySerializedAs: "pressedSprite",
- notify: function() {
- this._updateState()
- }
- },
- hoverSprite: {
- default: null,
- type: cc.SpriteFrame,
- displayName: "Hover",
- tooltip: !1,
- formerlySerializedAs: "hoverSprite",
- notify: function() {
- this._updateState()
- }
- },
- disabledSprite: {
- default: null,
- type: cc.SpriteFrame,
- displayName: "Disabled",
- tooltip: !1,
- notify: function() {
- this._updateState()
- }
- },
- target: {
- default: null,
- type: cc.Node,
- tooltip: !1,
- notify: function(t) {
- this._applyTarget(), t && this.target !== t && this._unregisterTargetEvent(t)
- }
- },
- clickEvents: {
- default: [],
- type: cc.Component.EventHandler,
- tooltip: !1
- }
- },
- statics: {
- Transition: s
- },
- __preload: function() {
- this._applyTarget(), this._resetState()
- },
- _resetState: function() {
- this._pressed = !1, this._hovered = !1;
- var t = this._getTarget(),
- e = this.transition,
- i = this._originalScale;
- e === s.COLOR && this.interactable ? this._setTargetColor(this.normalColor) : e === s.SCALE && i && t.setScale(i.x, i.y), this._transitionFinished = !0
- },
- onEnable: function() {
- this.normalSprite && this.normalSprite.ensureLoadTexture(), this.hoverSprite && this.hoverSprite.ensureLoadTexture(), this.pressedSprite && this.pressedSprite.ensureLoadTexture(), this.disabledSprite && this.disabledSprite.ensureLoadTexture(), this._registerNodeEvent()
- },
- onDisable: function() {
- this._resetState(), this._unregisterNodeEvent()
- },
- _getTarget: function() {
- return this.target ? this.target : this.node
- },
- _onTargetSpriteFrameChanged: function(t) {
- this.transition === s.SPRITE && this._setCurrentStateSprite(t.spriteFrame)
- },
- _onTargetColorChanged: function(t) {
- this.transition === s.COLOR && this._setCurrentStateColor(t)
- },
- _onTargetScaleChanged: function() {
- var t = this._getTarget();
- this._originalScale && (this.transition !== s.SCALE || this._transitionFinished) && (this._originalScale.x = t.scaleX, this._originalScale.y = t.scaleY)
- },
- _setTargetColor: function(t) {
- var e = this._getTarget();
- e.color = t, e.opacity = t.a
- },
- _getStateColor: function(t) {
- switch (t) {
- case o.NORMAL:
- return this.normalColor;
- case o.HOVER:
- return this.hoverColor;
- case o.PRESSED:
- return this.pressedColor;
- case o.DISABLED:
- return this.disabledColor
- }
- },
- _getStateSprite: function(t) {
- switch (t) {
- case o.NORMAL:
- return this.normalSprite;
- case o.HOVER:
- return this.hoverSprite;
- case o.PRESSED:
- return this.pressedSprite;
- case o.DISABLED:
- return this.disabledSprite
- }
- },
- _setCurrentStateColor: function(t) {
- switch (this._getButtonState()) {
- case o.NORMAL:
- this.normalColor = t;
- break;
- case o.HOVER:
- this.hoverColor = t;
- break;
- case o.PRESSED:
- this.pressedColor = t;
- break;
- case o.DISABLED:
- this.disabledColor = t
- }
- },
- _setCurrentStateSprite: function(t) {
- switch (this._getButtonState()) {
- case o.NORMAL:
- this.normalSprite = t;
- break;
- case o.HOVER:
- this.hoverSprite = t;
- break;
- case o.PRESSED:
- this.pressedSprite = t;
- break;
- case o.DISABLED:
- this.disabledSprite = t
- }
- },
- update: function(t) {
- var e = this._getTarget();
- if (!this._transitionFinished && (this.transition === s.COLOR || this.transition === s.SCALE)) {
- this.time += t;
- var i = 1;
- if (this.duration > 0 && (i = this.time / this.duration), i >= 1 && (i = 1), this.transition === s.COLOR) {
- var n = this._fromColor.lerp(this._toColor, i);
- this._setTargetColor(n)
- } else this.transition === s.SCALE && this._originalScale && (e.scale = this._fromScale.lerp(this._toScale, i));
- 1 === i && (this._transitionFinished = !0)
- }
- },
- _registerNodeEvent: function() {
- this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), this.node.on(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), this.node.on(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this)
- },
- _unregisterNodeEvent: function() {
- this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), this.node.off(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), this.node.off(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this)
- },
- _registerTargetEvent: function(t) {
- t.on(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this)
- },
- _unregisterTargetEvent: function(t) {
- t.off(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this)
- },
- _getTargetSprite: function(t) {
- var e = null;
- return t && (e = t.getComponent(cc.Sprite)), e
- },
- _applyTarget: function() {
- var t = this._getTarget();
- this._sprite = this._getTargetSprite(t), this._originalScale || (this._originalScale = cc.Vec2.ZERO), this._originalScale.x = t.scaleX, this._originalScale.y = t.scaleY, this._registerTargetEvent(t)
- },
- _onTouchBegan: function(t) {
- this.interactable && this.enabledInHierarchy && (this._pressed = !0, this._updateState(), t.stopPropagation())
- },
- _onTouchMove: function(t) {
- if (this.interactable && this.enabledInHierarchy && this._pressed) {
- var e = t.touch,
- i = this.node._hitTest(e.getLocation()),
- n = this._getTarget(),
- r = this._originalScale;
- if (this.transition === s.SCALE && r) i ? (this._fromScale.x = r.x, this._fromScale.y = r.y, this._toScale.x = r.x * this.zoomScale, this._toScale.y = r.y * this.zoomScale, this._transitionFinished = !1) : (this.time = 0, this._transitionFinished = !0, n.setScale(r.x, r.y));
- else {
- var a = void 0;
- a = i ? o.PRESSED : o.NORMAL, this._applyTransition(a)
- }
- t.stopPropagation()
- }
- },
- _onTouchEnded: function(t) {
- this.interactable && this.enabledInHierarchy && (this._pressed && (cc.Component.EventHandler.emitEvents(this.clickEvents, t), this.node.emit("click", this)), this._pressed = !1, this._updateState(), t.stopPropagation())
- },
- _onTouchCancel: function() {
- this.interactable && this.enabledInHierarchy && (this._pressed = !1, this._updateState())
- },
- _onMouseMoveIn: function() {
- !this._pressed && this.interactable && this.enabledInHierarchy && (this.transition !== s.SPRITE || this.hoverSprite) && (this._hovered || (this._hovered = !0, this._updateState()))
- },
- _onMouseMoveOut: function() {
- this._hovered && (this._hovered = !1, this._updateState())
- },
- _updateState: function() {
- var t = this._getButtonState();
- this._applyTransition(t), this._updateDisabledState()
- },
- _getButtonState: function() {
- return this.interactable ? this._pressed ? o.PRESSED : this._hovered ? o.HOVER : o.NORMAL : o.DISABLED
- },
- _updateColorTransitionImmediately: function(t) {
- var e = this._getStateColor(t);
- this._setTargetColor(e), this._fromColor = e.clone(), this._toColor = e
- },
- _updateColorTransition: function(t) {
- if (t === o.DISABLED) this._updateColorTransitionImmediately(t);
- else {
- var e = this._getTarget(),
- i = this._getStateColor(t);
- this._fromColor = e.color.clone(), this._toColor = i, this.time = 0, this._transitionFinished = !1
- }
- },
- _updateSpriteTransition: function(t) {
- var e = this._getStateSprite(t);
- this._sprite && e && (this._sprite.spriteFrame = e)
- },
- _updateScaleTransition: function(t) {
- t === o.PRESSED ? this._zoomUp() : this._zoomBack()
- },
- _zoomUp: function() {
- this._originalScale && (this._fromScale.x = this._originalScale.x, this._fromScale.y = this._originalScale.y, this._toScale.x = this._originalScale.x * this.zoomScale, this._toScale.y = this._originalScale.y * this.zoomScale, this.time = 0, this._transitionFinished = !1)
- },
- _zoomBack: function() {
- if (this._originalScale) {
- var t = this._getTarget();
- this._fromScale.x = t.scaleX, this._fromScale.y = t.scaleY, this._toScale.x = this._originalScale.x, this._toScale.y = this._originalScale.y, this.time = 0, this._transitionFinished = !1
- }
- },
- _updateTransition: function(t) {
- t === s.COLOR ? this._updateColorTransitionImmediately(o.NORMAL) : t === s.SPRITE && this._updateSpriteTransition(o.NORMAL), this._updateState()
- },
- _applyTransition: function(t) {
- var e = this.transition;
- e === s.COLOR ? this._updateColorTransition(t) : e === s.SPRITE ? this._updateSpriteTransition(t) : e === s.SCALE && this._updateScaleTransition(t)
- },
- _resizeNodeToTargetNode: !1,
- _updateDisabledState: function() {
- if (this._sprite) {
- var t = !1;
- this.enableAutoGrayEffect && (this.transition === s.SPRITE && this.disabledSprite || this.interactable || (t = !0)), this._switchGrayMaterial(t, this._sprite)
- }
- }
- });
- cc.Button = e.exports = a
- }), {
- "../utils/gray-sprite-state": 296,
- "./CCComponent": 95
- }],
- 94: [(function(t, e, i) {
- "use strict";
- var n = t("../camera/CCCamera"),
- r = t("./CCComponent"),
- s = cc.Class({
- name: "cc.Canvas",
- extends: r,
- editor: !1,
- resetInEditor: !1,
- statics: {
- instance: null
- },
- properties: {
- _designResolution: cc.size(960, 640),
- designResolution: {
- get: function() {
- return cc.size(this._designResolution)
- },
- set: function(t) {
- this._designResolution.width = t.width, this._designResolution.height = t.height, this.applySettings(), this.alignWithScreen()
- },
- tooltip: !1
- },
- _fitWidth: !1,
- _fitHeight: !0,
- fitHeight: {
- get: function() {
- return this._fitHeight
- },
- set: function(t) {
- this._fitHeight !== t && (this._fitHeight = t, this.applySettings(), this.alignWithScreen())
- },
- tooltip: !1
- },
- fitWidth: {
- get: function() {
- return this._fitWidth
- },
- set: function(t) {
- this._fitWidth !== t && (this._fitWidth = t, this.applySettings(), this.alignWithScreen())
- },
- tooltip: !1
- }
- },
- ctor: function() {
- this._thisOnResized = this.alignWithScreen.bind(this)
- },
- __preload: function() {
- if (s.instance) return cc.errorID(6700, this.node.name, s.instance.node.name);
- s.instance = this, cc.sys.isMobile ? window.addEventListener("resize", this._thisOnResized) : cc.view.on("canvas-resize", this._thisOnResized), this.applySettings(), this.alignWithScreen();
- var t = cc.find("Main Camera", this.node);
- t || ((t = new cc.Node("Main Camera")).parent = this.node, t.setSiblingIndex(0));
- var e = t.getComponent(n);
- if (!e) {
- e = t.addComponent(n);
- var i = n.ClearFlags;
- e.clearFlags = i.COLOR | i.DEPTH | i.STENCIL, e.depth = -1
- }
- n.main = e
- },
- onDestroy: function() {
- cc.sys.isMobile ? window.removeEventListener("resize", this._thisOnResized) : cc.view.off("canvas-resize", this._thisOnResized), s.instance === this && (s.instance = null)
- },
- alignWithScreen: function() {
- var t, e, i = e = cc.visibleRect;
- t = cc.view.getDesignResolutionSize();
- var n = 0,
- r = 0;
- !this.fitHeight && !this.fitWidth && (n = .5 * (t.width - i.width), r = .5 * (t.height - i.height)), this.node.setPosition(.5 * i.width + n, .5 * i.height + r), this.node.width = e.width, this.node.height = e.height
- },
- applySettings: function() {
- var t, e = cc.ResolutionPolicy;
- t = this.fitHeight && this.fitWidth ? e.SHOW_ALL : this.fitHeight || this.fitWidth ? this.fitWidth ? e.FIXED_WIDTH : e.FIXED_HEIGHT : e.NO_BORDER;
- var i = this._designResolution;
- cc.view.setDesignResolutionSize(i.width, i.height, t)
- }
- });
- cc.Canvas = e.exports = s
- }), {
- "../camera/CCCamera": 80,
- "./CCComponent": 95
- }],
- 95: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/CCObject"),
- r = t("../platform/js"),
- s = new(t("../platform/id-generater"))("Comp"),
- o = (n.Flags.IsOnEnableCalled, n.Flags.IsOnLoadCalled),
- a = cc.Class({
- name: "cc.Component",
- extends: n,
- ctor: function() {
- this._id = s.getNewId(), this.__eventTargets = []
- },
- properties: {
- node: {
- default: null,
- visible: !1
- },
- name: {
- get: function() {
- if (this._name) return this._name;
- var t = cc.js.getClassName(this),
- e = t.lastIndexOf(".");
- return e >= 0 && (t = t.slice(e + 1)), this.node.name + "<" + t + ">"
- },
- set: function(t) {
- this._name = t
- },
- visible: !1
- },
- uuid: {
- get: function() {
- return this._id
- },
- visible: !1
- },
- __scriptAsset: !1,
- _enabled: !0,
- enabled: {
- get: function() {
- return this._enabled
- },
- set: function(t) {
- if (this._enabled !== t && (this._enabled = t, this.node._activeInHierarchy)) {
- var e = cc.director._compScheduler;
- t ? e.enableComp(this) : e.disableComp(this)
- }
- },
- visible: !1,
- animatable: !0
- },
- enabledInHierarchy: {
- get: function() {
- return this._enabled && this.node._activeInHierarchy
- },
- visible: !1
- },
- _isOnLoadCalled: {
- get: function() {
- return this._objFlags & o
- }
- }
- },
- update: null,
- lateUpdate: null,
- __preload: null,
- onLoad: null,
- start: null,
- onEnable: null,
- onDisable: null,
- onDestroy: null,
- onFocusInEditor: null,
- onLostFocusInEditor: null,
- resetInEditor: null,
- addComponent: function(t) {
- return this.node.addComponent(t)
- },
- getComponent: function(t) {
- return this.node.getComponent(t)
- },
- getComponents: function(t) {
- return this.node.getComponents(t)
- },
- getComponentInChildren: function(t) {
- return this.node.getComponentInChildren(t)
- },
- getComponentsInChildren: function(t) {
- return this.node.getComponentsInChildren(t)
- },
- _getLocalBounds: null,
- onRestore: null,
- destroy: function() {
- this._super() && this._enabled && this.node._activeInHierarchy && cc.director._compScheduler.disableComp(this)
- },
- _onPreDestroy: function() {
- this.unscheduleAllCallbacks();
- for (var t = this.__eventTargets, e = 0, i = t.length; e < i; ++e) {
- var n = t[e];
- n && n.targetOff(this)
- }
- t.length = 0, cc.director._nodeActivator.destroyComp(this), this.node._removeComponent(this)
- },
- _instantiate: function(t) {
- return t || (t = cc.instantiate._clone(this, this)), t.node = null, t
- },
- schedule: function(t, e, i, n) {
- cc.assertID(t, 1619), cc.assertID(e >= 0, 1620), e = e || 0, i = isNaN(i) ? cc.macro.REPEAT_FOREVER : i, n = n || 0;
- var r = cc.director.getScheduler(),
- s = r.isTargetPaused(this);
- r.schedule(t, this, e, i, n, s)
- },
- scheduleOnce: function(t, e) {
- this.schedule(t, 0, 0, e)
- },
- unschedule: function(t) {
- t && cc.director.getScheduler().unschedule(t, this)
- },
- unscheduleAllCallbacks: function() {
- cc.director.getScheduler().unscheduleAllForTarget(this)
- }
- });
- a._requireComponent = null, a._executionOrder = 0, r.value(a, "_registerEditorProps", (function(t, e) {
- var i = e.requireComponent;
- i && (t._requireComponent = i);
- var n = e.executionOrder;
- n && "number" == typeof n && (t._executionOrder = n)
- })), a.prototype.__scriptUuid = "", cc.Component = e.exports = a
- }), {
- "../platform/CCObject": 204,
- "../platform/id-generater": 214,
- "../platform/js": 218
- }],
- 96: [(function(t, e, i) {
- "use strict";
- cc.Component.EventHandler = cc.Class({
- name: "cc.ClickEvent",
- properties: {
- target: {
- default: null,
- type: cc.Node
- },
- component: "",
- _componentId: "",
- _componentName: {
- get: function() {
- return this._genCompIdIfNeeded(), this._compId2Name(this._componentId)
- },
- set: function(t) {
- this._componentId = this._compName2Id(t)
- }
- },
- handler: {
- default: ""
- },
- customEventData: {
- default: ""
- }
- },
- statics: {
- emitEvents: function(t) {
- var e = void 0;
- if (arguments.length > 0)
- for (var i = 0, n = (e = new Array(arguments.length - 1)).length; i < n; i++) e[i] = arguments[i + 1];
- for (var r = 0, s = t.length; r < s; r++) {
- var o = t[r];
- o instanceof cc.Component.EventHandler && o.emit(e)
- }
- }
- },
- emit: function(t) {
- var e = this.target;
- if (cc.isValid(e)) {
- this._genCompIdIfNeeded();
- var i = cc.js._getClassById(this._componentId),
- n = e.getComponent(i);
- if (cc.isValid(n)) {
- var r = n[this.handler];
- "function" == typeof r && (null != this.customEventData && "" !== this.customEventData && (t = t.slice()).push(this.customEventData), r.apply(n, t))
- }
- }
- },
- _compName2Id: function(t) {
- var e = cc.js.getClassByName(t);
- return cc.js._getClassId(e)
- },
- _compId2Name: function(t) {
- var e = cc.js._getClassById(t);
- return cc.js.getClassName(e)
- },
- _genCompIdIfNeeded: function() {
- this._componentId || (this._componentName = this.component, this.component = "")
- }
- })
- }), {}],
- 97: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/CCMacro"),
- r = t("./CCRenderComponent"),
- s = t("../assets/material/CCMaterial"),
- o = t("../renderer/utils/label/label-frame"),
- a = n.TextAlignment,
- l = n.VerticalTextAlignment,
- h = cc.Enum({
- NONE: 0,
- CLAMP: 1,
- SHRINK: 2,
- RESIZE_HEIGHT: 3
- }),
- c = cc.Enum({
- NONE: 0,
- BITMAP: 1,
- CHAR: 2
- }),
- u = cc.Class({
- name: "cc.Label",
- extends: r,
- ctor: function() {
- this._actualFontSize = 0, this._assemblerData = null, this._frame = null, this._ttfTexture = null, this._letterTexture = null, cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._activateMaterial = this._activateMaterialCanvas : this._activateMaterial = this._activateMaterialWebgl
- },
- editor: !1,
- properties: {
- _useOriginalSize: !0,
- _string: {
- default: "",
- formerlySerializedAs: "_N$string"
- },
- string: {
- get: function() {
- return this._string
- },
- set: function(t) {
- var e = this._string;
- this._string = "" + t, this.string !== e && this._lazyUpdateRenderData(), this._checkStringEmpty()
- },
- multiline: !0,
- tooltip: !1
- },
- horizontalAlign: {
- default: a.LEFT,
- type: a,
- tooltip: !1,
- notify: function(t) {
- this.horizontalAlign !== t && this._lazyUpdateRenderData()
- },
- animatable: !1
- },
- verticalAlign: {
- default: l.TOP,
- type: l,
- tooltip: !1,
- notify: function(t) {
- this.verticalAlign !== t && this._lazyUpdateRenderData()
- },
- animatable: !1
- },
- actualFontSize: {
- displayName: "Actual Font Size",
- animatable: !1,
- readonly: !0,
- get: function() {
- return this._actualFontSize
- },
- tooltip: !1
- },
- _fontSize: 40,
- fontSize: {
- get: function() {
- return this._fontSize
- },
- set: function(t) {
- this._fontSize !== t && (this._fontSize = t, this._lazyUpdateRenderData())
- },
- range: [0, 512],
- tooltip: !1
- },
- fontFamily: {
- default: "Arial",
- tooltip: !1,
- notify: function(t) {
- this.fontFamily !== t && this._lazyUpdateRenderData()
- },
- animatable: !1
- },
- _lineHeight: 40,
- lineHeight: {
- get: function() {
- return this._lineHeight
- },
- set: function(t) {
- this._lineHeight !== t && (this._lineHeight = t, this._lazyUpdateRenderData())
- },
- tooltip: !1
- },
- overflow: {
- default: h.NONE,
- type: h,
- tooltip: !1,
- notify: function(t) {
- this.overflow !== t && this._lazyUpdateRenderData()
- },
- animatable: !1
- },
- _enableWrapText: !0,
- enableWrapText: {
- get: function() {
- return this._enableWrapText
- },
- set: function(t) {
- this._enableWrapText !== t && (this._enableWrapText = t, this._lazyUpdateRenderData())
- },
- animatable: !1,
- tooltip: !1
- },
- _N$file: null,
- font: {
- get: function() {
- return this._N$file
- },
- set: function(t) {
- this.font !== t && (t || (this._isSystemFontUsed = !0), this._N$file = t, t && this._isSystemFontUsed && (this._isSystemFontUsed = !1), "string" == typeof t && cc.warnID(4e3), this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData())
- },
- type: cc.Font,
- tooltip: !1,
- animatable: !1
- },
- _isSystemFontUsed: !0,
- useSystemFont: {
- get: function() {
- return this._isSystemFontUsed
- },
- set: function(t) {
- this._isSystemFontUsed !== t && (this._isSystemFontUsed = !!t, t && (this.font = null, this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData(), this._checkStringEmpty()))
- },
- animatable: !1,
- tooltip: !1
- },
- _bmFontOriginalSize: {
- displayName: "BMFont Original Size",
- get: function() {
- return this._N$file instanceof cc.BitmapFont ? this._N$file.fontSize : -1
- },
- visible: !0,
- animatable: !1
- },
- _spacingX: 0,
- spacingX: {
- get: function() {
- return this._spacingX
- },
- set: function(t) {
- this._spacingX = t, this._lazyUpdateRenderData()
- },
- tooltip: !1
- },
- _batchAsBitmap: !1,
- cacheMode: {
- default: c.NONE,
- type: c,
- tooltip: !1,
- notify: function(t) {
- this.cacheMode !== t && (t !== c.BITMAP || this.font instanceof cc.BitmapFont || this._frame && this._frame._resetDynamicAtlasFrame(), t === c.CHAR && (this._ttfTexture = null), this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData())
- },
- animatable: !1
- },
- _isBold: {
- default: !1,
- serializable: !1
- },
- _isItalic: {
- default: !1,
- serializable: !1
- },
- _isUnderline: {
- default: !1,
- serializable: !1
- }
- },
- statics: {
- HorizontalAlign: a,
- VerticalAlign: l,
- Overflow: h,
- CacheMode: c,
- _shareAtlas: null,
- clearCharCache: function() {
- u._shareAtlas && u._shareAtlas.clearAllCache()
- }
- },
- onLoad: function() {
- this._batchAsBitmap && this.cacheMode === c.NONE && (this.cacheMode = c.BITMAP, this._batchAsBitmap = !1), cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && (this.cacheMode = c.NONE)
- },
- onEnable: function() {
- this._super(), this.node.on(cc.Node.EventType.SIZE_CHANGED, this._lazyUpdateRenderData, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._lazyUpdateRenderData, this), this._forceUpdateRenderData(), this._checkStringEmpty()
- },
- onDisable: function() {
- this._super(), this.node.off(cc.Node.EventType.SIZE_CHANGED, this._lazyUpdateRenderData, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._lazyUpdateRenderData, this)
- },
- onDestroy: function() {
- this._assembler && this._assembler._resetAssemblerData && this._assembler._resetAssemblerData(this._assemblerData), this._assemblerData = null, this._letterTexture = null, this._ttfTexture && (this._ttfTexture.destroy(), this._ttfTexture = null), this._super()
- },
- _updateColor: function() {
- this.font instanceof cc.BitmapFont || this._lazyUpdateRenderData(), r.prototype._updateColor.call(this)
- },
- _resetAssembler: function() {
- this._frame = null, r.prototype._resetAssembler.call(this)
- },
- _canRender: function() {
- var t = this._super(),
- e = this.font;
- if (e instanceof cc.BitmapFont) {
- var i = e.spriteFrame;
- i && i.textureLoaded() || (t = !1)
- }
- return t
- },
- _checkStringEmpty: function() {
- this.markForRender(!!this.string)
- },
- _on3DNodeChanged: function() {
- this._resetAssembler(), this._applyFontTexture(!0)
- },
- _applyFontTexture: function(t) {
- var e = this.font;
- if (e instanceof cc.BitmapFont) {
- var i = e.spriteFrame;
- this._frame = i;
- var n = this,
- r = function() {
- n._frame._texture = i._texture, n._activateMaterial(t), t && n._assembler && n._assembler.updateRenderData(n)
- };
- i && i.textureLoaded() ? r() : (this.disableRender(), i && (i.once("load", r, this), i.ensureLoadTexture()))
- } else this._frame || (this._frame = new o), this.cacheMode === c.CHAR ? (this._letterTexture = this._assembler._getAssemblerData(), this._frame._refreshTexture(this._letterTexture)) : this._ttfTexture || (this._ttfTexture = new cc.Texture2D, this._assemblerData = this._assembler._getAssemblerData(), this._ttfTexture.initWithElement(this._assemblerData.canvas)), this.cacheMode !== c.CHAR && (this._frame._resetDynamicAtlasFrame(), this._frame._refreshTexture(this._ttfTexture)), this._activateMaterial(t), t && this._assembler && this._assembler.updateRenderData(this)
- },
- _activateMaterialCanvas: function(t) {
- t && (this._frame._texture.url = this.uuid + "_texture", this.markForUpdateRenderData(!0), this.markForRender(!0))
- },
- _activateMaterialWebgl: function(t) {
- if (t)
- if (this._frame) {
- var e = this.sharedMaterials[0];
- (e = e ? s.getInstantiatedMaterial(e, this) : s.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", this._frame._texture), this.setMaterial(0, e), this.markForUpdateRenderData(!0), this.markForRender(!0)
- } else this.disableRender()
- },
- _lazyUpdateRenderData: function() {
- this.setVertsDirty(), this.markForUpdateRenderData(!0)
- },
- _forceUpdateRenderData: function() {
- this.setVertsDirty(), this._resetAssembler(), this._applyFontTexture(!0), this.markForUpdateRenderData(!0)
- },
- _enableBold: function(t) {
- this._isBold = !!t
- },
- _enableItalics: function(t) {
- this._isItalic = !!t
- },
- _enableUnderline: function(t) {
- this._isUnderline = !!t
- }
- });
- cc.Label = e.exports = u
- }), {
- "../assets/material/CCMaterial": 75,
- "../platform/CCMacro": 203,
- "../renderer/utils/label/label-frame": 252,
- "./CCRenderComponent": 106
- }],
- 98: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.LabelOutline",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- _color: cc.Color.WHITE,
- _width: 1,
- color: {
- tooltip: !1,
- get: function() {
- return this._color
- },
- set: function(t) {
- this._color = t, this._updateRenderData()
- }
- },
- width: {
- tooltip: !1,
- get: function() {
- return this._width
- },
- set: function(t) {
- this._width !== t && (this._width = t, this._updateRenderData())
- },
- range: [0, 512]
- }
- },
- onEnable: function() {
- this._updateRenderData()
- },
- onDisable: function() {
- this._updateRenderData()
- },
- _updateRenderData: function() {
- var t = this.node.getComponent(cc.Label);
- t && t._lazyUpdateRenderData()
- }
- });
- cc.LabelOutline = e.exports = n
- }), {
- "./CCComponent": 95
- }],
- 99: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.LabelShadow",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- _color: cc.Color.WHITE,
- _offset: cc.v2(2, 2),
- _blur: 2,
- color: {
- tooltip: !1,
- get: function() {
- return this._color
- },
- set: function(t) {
- this._color = t, this._updateRenderData()
- }
- },
- offset: {
- tooltip: !1,
- get: function() {
- return this._offset
- },
- set: function(t) {
- this._offset = t, this._updateRenderData()
- }
- },
- blur: {
- tooltip: !1,
- get: function() {
- return this._blur
- },
- set: function(t) {
- this._blur = t, this._updateRenderData()
- },
- range: [0, 1024]
- }
- },
- onEnable: function() {
- this._updateRenderData()
- },
- onDisable: function() {
- this._updateRenderData()
- },
- _updateRenderData: function() {
- var t = this.node.getComponent(cc.Label);
- t && t._lazyUpdateRenderData()
- }
- });
- cc.LabelShadow = e.exports = n
- }), {
- "./CCComponent": 95
- }],
- 100: [(function(t, e, i) {
- "use strict";
- var n = t("../CCNode").EventType,
- r = cc.Enum({
- NONE: 0,
- HORIZONTAL: 1,
- VERTICAL: 2,
- GRID: 3
- }),
- s = cc.Enum({
- NONE: 0,
- CONTAINER: 1,
- CHILDREN: 2
- }),
- o = cc.Enum({
- HORIZONTAL: 0,
- VERTICAL: 1
- }),
- a = cc.Enum({
- BOTTOM_TO_TOP: 0,
- TOP_TO_BOTTOM: 1
- }),
- l = cc.Enum({
- LEFT_TO_RIGHT: 0,
- RIGHT_TO_LEFT: 1
- }),
- h = cc.Class({
- name: "cc.Layout",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- _layoutSize: cc.size(300, 200),
- _layoutDirty: {
- default: !0,
- serializable: !1
- },
- _resize: s.NONE,
- _N$layoutType: r.NONE,
- type: {
- type: r,
- get: function() {
- return this._N$layoutType
- },
- set: function(t) {
- this._N$layoutType = t, this._doLayoutDirty()
- },
- tooltip: !1,
- animatable: !1
- },
- resizeMode: {
- type: s,
- tooltip: !1,
- animatable: !1,
- get: function() {
- return this._resize
- },
- set: function(t) {
- this.type === r.NONE && t === s.CHILDREN || (this._resize = t, this._doLayoutDirty())
- }
- },
- cellSize: {
- default: cc.size(40, 40),
- tooltip: !1,
- type: cc.Size,
- notify: function() {
- this._doLayoutDirty()
- }
- },
- startAxis: {
- default: o.HORIZONTAL,
- tooltip: !1,
- type: o,
- notify: function() {
- this._doLayoutDirty()
- },
- animatable: !1
- },
- _N$padding: {
- default: 0
- },
- paddingLeft: {
- default: 0,
- tooltip: !1,
- notify: function() {
- this._doLayoutDirty()
- }
- },
- paddingRight: {
- default: 0,
- tooltip: !1,
- notify: function() {
- this._doLayoutDirty()
- }
- },
- paddingTop: {
- default: 0,
- tooltip: !1,
- notify: function() {
- this._doLayoutDirty()
- }
- },
- paddingBottom: {
- default: 0,
- tooltip: !1,
- notify: function() {
- this._doLayoutDirty()
- }
- },
- spacingX: {
- default: 0,
- notify: function() {
- this._doLayoutDirty()
- },
- tooltip: !1
- },
- spacingY: {
- default: 0,
- notify: function() {
- this._doLayoutDirty()
- },
- tooltip: !1
- },
- verticalDirection: {
- default: a.TOP_TO_BOTTOM,
- type: a,
- notify: function() {
- this._doLayoutDirty()
- },
- tooltip: !1,
- animatable: !1
- },
- horizontalDirection: {
- default: l.LEFT_TO_RIGHT,
- type: l,
- notify: function() {
- this._doLayoutDirty()
- },
- tooltip: !1,
- animatable: !1
- },
- affectedByScale: {
- default: !1,
- notify: function() {
- this._doLayoutDirty()
- },
- animatable: !1,
- tooltip: !1
- }
- },
- statics: {
- Type: r,
- VerticalDirection: a,
- HorizontalDirection: l,
- ResizeMode: s,
- AxisDirection: o
- },
- _migratePaddingData: function() {
- this.paddingLeft = this._N$padding, this.paddingRight = this._N$padding, this.paddingTop = this._N$padding, this.paddingBottom = this._N$padding, this._N$padding = 0
- },
- onEnable: function() {
- this._addEventListeners(), this.node.getContentSize().equals(cc.size(0, 0)) && this.node.setContentSize(this._layoutSize), 0 !== this._N$padding && this._migratePaddingData(), this._doLayoutDirty()
- },
- onDisable: function() {
- this._removeEventListeners()
- },
- _doLayoutDirty: function() {
- this._layoutDirty = !0
- },
- _doScaleDirty: function() {
- this._layoutDirty = this._layoutDirty || this.affectedByScale
- },
- _addEventListeners: function() {
- cc.director.on(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), this.node.on(n.SIZE_CHANGED, this._resized, this), this.node.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), this.node.on(n.CHILD_ADDED, this._childAdded, this), this.node.on(n.CHILD_REMOVED, this._childRemoved, this), this.node.on(n.CHILD_REORDER, this._doLayoutDirty, this), this._addChildrenEventListeners()
- },
- _removeEventListeners: function() {
- cc.director.off(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), this.node.off(n.SIZE_CHANGED, this._resized, this), this.node.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), this.node.off(n.CHILD_ADDED, this._childAdded, this), this.node.off(n.CHILD_REMOVED, this._childRemoved, this), this.node.off(n.CHILD_REORDER, this._doLayoutDirty, this), this._removeChildrenEventListeners()
- },
- _addChildrenEventListeners: function() {
- for (var t = this.node.children, e = 0; e < t.length; ++e) {
- var i = t[e];
- i.on(n.SCALE_CHANGED, this._doScaleDirty, this), i.on(n.SIZE_CHANGED, this._doLayoutDirty, this), i.on(n.POSITION_CHANGED, this._doLayoutDirty, this), i.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), i.on("active-in-hierarchy-changed", this._doLayoutDirty, this)
- }
- },
- _removeChildrenEventListeners: function() {
- for (var t = this.node.children, e = 0; e < t.length; ++e) {
- var i = t[e];
- i.off(n.SCALE_CHANGED, this._doScaleDirty, this), i.off(n.SIZE_CHANGED, this._doLayoutDirty, this), i.off(n.POSITION_CHANGED, this._doLayoutDirty, this), i.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), i.off("active-in-hierarchy-changed", this._doLayoutDirty, this)
- }
- },
- _childAdded: function(t) {
- t.on(n.SCALE_CHANGED, this._doScaleDirty, this), t.on(n.SIZE_CHANGED, this._doLayoutDirty, this), t.on(n.POSITION_CHANGED, this._doLayoutDirty, this), t.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), t.on("active-in-hierarchy-changed", this._doLayoutDirty, this), this._doLayoutDirty()
- },
- _childRemoved: function(t) {
- t.off(n.SCALE_CHANGED, this._doScaleDirty, this), t.off(n.SIZE_CHANGED, this._doLayoutDirty, this), t.off(n.POSITION_CHANGED, this._doLayoutDirty, this), t.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), t.off("active-in-hierarchy-changed", this._doLayoutDirty, this), this._doLayoutDirty()
- },
- _resized: function() {
- this._layoutSize = this.node.getContentSize(), this._doLayoutDirty()
- },
- _doLayoutHorizontally: function(t, e, i, n) {
- var o = this.node.getAnchorPoint(),
- h = this.node.children,
- c = 1,
- u = this.paddingLeft,
- _ = -o.x * t;
- this.horizontalDirection === l.RIGHT_TO_LEFT && (c = -1, _ = (1 - o.x) * t, u = this.paddingRight);
- for (var f = _ + c * u - c * this.spacingX, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < h.length; ++b) {
- (C = h[b]).activeInHierarchy && x++
- }
- var A = this.cellSize.width;
- this.type !== r.GRID && this.resizeMode === s.CHILDREN && (A = (t - (this.paddingLeft + this.paddingRight) - (x - 1) * this.spacingX) / x);
- for (b = 0; b < h.length; ++b) {
- var C = h[b],
- T = this._getUsedScaleValue(C.scaleX),
- S = this._getUsedScaleValue(C.scaleY);
- if (C.activeInHierarchy) {
- this._resize === s.CHILDREN && (C.width = A / T, this.type === r.GRID && (C.height = this.cellSize.height / S));
- var w = C.anchorX,
- E = C.width * T,
- M = C.height * S;
- m > p && (p = m), M >= p && (m = p, p = M, g = C.getAnchorPoint().y), this.horizontalDirection === l.RIGHT_TO_LEFT && (w = 1 - C.anchorX), f = f + c * w * E + c * this.spacingX;
- var D = c * (1 - w) * E;
- if (e) {
- var B = f + D + c * (c > 0 ? this.paddingRight : this.paddingLeft),
- I = this.horizontalDirection === l.LEFT_TO_RIGHT && B > (1 - o.x) * t,
- P = this.horizontalDirection === l.RIGHT_TO_LEFT && B < -o.x * t;
- (I || P) && (M >= p ? (0 === m && (m = p), d += m, m = p) : (d += p, m = M, p = 0), f = _ + c * (u + w * E), y++)
- }
- var R = i(C, d, y);
- t >= E + this.paddingLeft + this.paddingRight && n && C.setPosition(cc.v2(f, R));
- var O, L = 1,
- F = 0 === p ? M : p;
- this.verticalDirection === a.TOP_TO_BOTTOM ? (v = v || this.node._contentSize.height, (O = R + (L = -1) * (F * g + this.paddingBottom)) < v && (v = O)) : (v = v || -this.node._contentSize.height, (O = R + L * (F * g + this.paddingTop)) > v && (v = O)), f += D
- }
- }
- return v
- },
- _getVerticalBaseHeight: function(t) {
- var e = 0,
- i = 0;
- if (this.resizeMode === s.CONTAINER) {
- for (var n = 0; n < t.length; ++n) {
- var r = t[n];
- r.activeInHierarchy && (i++, e += r.height * this._getUsedScaleValue(r.scaleY))
- }
- e += (i - 1) * this.spacingY + this.paddingBottom + this.paddingTop
- } else e = this.node.getContentSize().height;
- return e
- },
- _doLayoutVertically: function(t, e, i, n) {
- var o = this.node.getAnchorPoint(),
- h = this.node.children,
- c = 1,
- u = this.paddingBottom,
- _ = -o.y * t;
- this.verticalDirection === a.TOP_TO_BOTTOM && (c = -1, _ = (1 - o.y) * t, u = this.paddingTop);
- for (var f = _ + c * u - c * this.spacingY, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < h.length; ++b) {
- (C = h[b]).activeInHierarchy && x++
- }
- var A = this.cellSize.height;
- this.type !== r.GRID && this.resizeMode === s.CHILDREN && (A = (t - (this.paddingTop + this.paddingBottom) - (x - 1) * this.spacingY) / x);
- for (b = 0; b < h.length; ++b) {
- var C = h[b],
- T = this._getUsedScaleValue(C.scaleX),
- S = this._getUsedScaleValue(C.scaleY);
- if (C.activeInHierarchy) {
- this.resizeMode === s.CHILDREN && (C.height = A / S, this.type === r.GRID && (C.width = this.cellSize.width / T));
- var w = C.anchorY,
- E = C.width * T,
- M = C.height * S;
- m > p && (p = m), E >= p && (m = p, p = E, g = C.getAnchorPoint().x), this.verticalDirection === a.TOP_TO_BOTTOM && (w = 1 - C.anchorY), f = f + c * w * M + c * this.spacingY;
- var D = c * (1 - w) * M;
- if (e) {
- var B = f + D + c * (c > 0 ? this.paddingTop : this.paddingBottom),
- I = this.verticalDirection === a.BOTTOM_TO_TOP && B > (1 - o.y) * t,
- P = this.verticalDirection === a.TOP_TO_BOTTOM && B < -o.y * t;
- (I || P) && (E >= p ? (0 === m && (m = p), d += m, m = p) : (d += p, m = E, p = 0), f = _ + c * (u + w * M), y++)
- }
- var R = i(C, d, y);
- t >= M + (this.paddingTop + this.paddingBottom) && n && C.setPosition(cc.v2(R, f));
- var O, L = 1,
- F = 0 === p ? E : p;
- this.horizontalDirection === l.RIGHT_TO_LEFT ? (L = -1, v = v || this.node._contentSize.width, (O = R + L * (F * g + this.paddingLeft)) < v && (v = O)) : (v = v || -this.node._contentSize.width, (O = R + L * (F * g + this.paddingRight)) > v && (v = O)), f += D
- }
- }
- return v
- },
- _doLayoutBasic: function() {
- for (var t = this.node.children, e = null, i = 0; i < t.length; ++i) {
- var n = t[i];
- n.activeInHierarchy && (e ? e.union(e, n.getBoundingBoxToWorld()) : e = n.getBoundingBoxToWorld())
- }
- if (e) {
- var r = this.node.convertToNodeSpaceAR(cc.v2(e.x, e.y));
- r = cc.v2(r.x - this.paddingLeft, r.y - this.paddingBottom);
- var s = this.node.convertToNodeSpaceAR(cc.v2(e.xMax, e.yMax)),
- o = (s = cc.v2(s.x + this.paddingRight, s.y + this.paddingTop)).sub(r);
- if (0 !== (o = cc.size(parseFloat(o.x.toFixed(2)), parseFloat(o.y.toFixed(2)))).width) {
- var a = -r.x / o.width;
- this.node.anchorX = parseFloat(a.toFixed(2))
- }
- if (0 !== o.height) {
- var l = -r.y / o.height;
- this.node.anchorY = parseFloat(l.toFixed(2))
- }
- this.node.setContentSize(o)
- }
- },
- _doLayoutGridAxisHorizontal: function(t, e) {
- var i = e.width,
- n = 1,
- r = -t.y * e.height,
- o = this.paddingBottom;
- this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, r = (1 - t.y) * e.height, o = this.paddingTop);
- var l = function(t, e, i) {
- return r + n * (e + t.anchorY * t.height * this._getUsedScaleValue(t.scaleY) + o + i * this.spacingY)
- }.bind(this),
- h = 0;
- if (this.resizeMode === s.CONTAINER) {
- var c = this._doLayoutHorizontally(i, !0, l, !1);
- (h = r - c) < 0 && (h *= -1), r = -t.y * h, this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, r = (1 - t.y) * h)
- }
- this._doLayoutHorizontally(i, !0, l, !0), this.resizeMode === s.CONTAINER && this.node.setContentSize(i, h)
- },
- _doLayoutGridAxisVertical: function(t, e) {
- var i = e.height,
- n = 1,
- r = -t.x * e.width,
- o = this.paddingLeft;
- this.horizontalDirection === l.RIGHT_TO_LEFT && (n = -1, r = (1 - t.x) * e.width, o = this.paddingRight);
- var a = function(t, e, i) {
- return r + n * (e + t.anchorX * t.width * this._getUsedScaleValue(t.scaleX) + o + i * this.spacingX)
- }.bind(this),
- h = 0;
- if (this.resizeMode === s.CONTAINER) {
- var c = this._doLayoutVertically(i, !0, a, !1);
- (h = r - c) < 0 && (h *= -1), r = -t.x * h, this.horizontalDirection === l.RIGHT_TO_LEFT && (n = -1, r = (1 - t.x) * h)
- }
- this._doLayoutVertically(i, !0, a, !0), this.resizeMode === s.CONTAINER && this.node.setContentSize(h, i)
- },
- _doLayoutGrid: function() {
- var t = this.node.getAnchorPoint(),
- e = this.node.getContentSize();
- this.startAxis === o.HORIZONTAL ? this._doLayoutGridAxisHorizontal(t, e) : this.startAxis === o.VERTICAL && this._doLayoutGridAxisVertical(t, e)
- },
- _getHorizontalBaseWidth: function(t) {
- var e = 0,
- i = 0;
- if (this.resizeMode === s.CONTAINER) {
- for (var n = 0; n < t.length; ++n) {
- var r = t[n];
- r.activeInHierarchy && (i++, e += r.width * this._getUsedScaleValue(r.scaleX))
- }
- e += (i - 1) * this.spacingX + this.paddingLeft + this.paddingRight
- } else e = this.node.getContentSize().width;
- return e
- },
- _doLayout: function() {
- if (this.type === r.HORIZONTAL) {
- var t = this._getHorizontalBaseWidth(this.node.children);
- this._doLayoutHorizontally(t, !1, (function(t) {
- return t.y
- }), !0), this.node.width = t
- } else if (this.type === r.VERTICAL) {
- var e = this._getVerticalBaseHeight(this.node.children);
- this._doLayoutVertically(e, !1, (function(t) {
- return t.x
- }), !0), this.node.height = e
- } else this.type === r.NONE ? this.resizeMode === s.CONTAINER && this._doLayoutBasic() : this.type === r.GRID && this._doLayoutGrid()
- },
- _getUsedScaleValue: function(t) {
- return this.affectedByScale ? Math.abs(t) : 1
- },
- updateLayout: function() {
- this._layoutDirty && this.node.children.length > 0 && (this._doLayout(), this._layoutDirty = !1)
- }
- });
- Object.defineProperty(h.prototype, "padding", {
- get: function() {
- return cc.warnID(4100), this.paddingLeft
- },
- set: function(t) {
- this._N$padding = t, this._migratePaddingData(), this._doLayoutDirty()
- }
- }), cc.Layout = e.exports = h
- }), {
- "../CCNode": 52,
- "./CCComponent": 95
- }],
- 101: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../renderer/gfx")),
- r = t("../vmath");
- var s = t("../utils/misc"),
- o = t("../assets/material/CCMaterial"),
- a = t("./CCRenderComponent"),
- l = t("../renderer/render-flow"),
- h = t("../graphics/graphics"),
- c = t("../CCNode"),
- u = cc.v2(),
- _ = r.mat4.create(),
- f = [];
- function d(t, e, i) {
- f.length = 0;
- for (var n = 2 * Math.PI / i, r = 0; r < i; ++r) f.push(cc.v2(e.x * Math.cos(n * r) + t.x, e.y * Math.sin(n * r) + t.y));
- return f
- }
- var p = cc.Enum({
- RECT: 0,
- ELLIPSE: 1,
- IMAGE_STENCIL: 2
- }),
- m = cc.Class({
- name: "cc.Mask",
- extends: a,
- editor: !1,
- ctor: function() {
- this._graphics = null, this._enableMaterial = null, this._exitMaterial = null, this._clearMaterial = null
- },
- properties: {
- _spriteFrame: {
- default: null,
- type: cc.SpriteFrame
- },
- _type: p.RECT,
- type: {
- get: function() {
- return this._type
- },
- set: function(t) {
- this._type !== t && this._resetAssembler(), this._type = t, this._type !== p.IMAGE_STENCIL && (this.spriteFrame = null, this.alphaThreshold = 0, this._updateGraphics()), this._activateMaterial()
- },
- type: p,
- tooltip: !1
- },
- spriteFrame: {
- type: cc.SpriteFrame,
- tooltip: !1,
- get: function() {
- return this._spriteFrame
- },
- set: function(t) {
- var e = this._spriteFrame;
- e !== t && (this._spriteFrame = t, this._applySpriteFrame(e))
- }
- },
- alphaThreshold: {
- default: .1,
- type: cc.Float,
- range: [0, 1, .1],
- slide: !0,
- tooltip: !1,
- notify: function() {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
- var t = this.sharedMaterials[0];
- t && t.setProperty("alphaThreshold", this.alphaThreshold)
- } else cc.warnID(4201)
- }
- },
- inverted: {
- default: !1,
- type: cc.Boolean,
- tooltip: !1,
- notify: function() {
- cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS || cc.warnID(4202)
- }
- },
- _segments: 64,
- segements: {
- get: function() {
- return this._segments
- },
- set: function(t) {
- this._segments = s.clampf(t, 3, 1e4), this._updateGraphics()
- },
- type: cc.Integer,
- tooltip: !1
- },
- _resizeToTarget: {
- animatable: !1,
- set: function(t) {
- t && this._resizeNodeToTargetNode()
- }
- }
- },
- statics: {
- Type: p
- },
- onLoad: function() {
- this._createGraphics()
- },
- onRestore: function() {
- this._createGraphics(), this._type !== p.IMAGE_STENCIL ? this._updateGraphics() : this._applySpriteFrame()
- },
- onEnable: function() {
- this._super(), this._type === p.IMAGE_STENCIL ? this._spriteFrame && this._spriteFrame.textureLoaded() || (this.markForRender(!1), this._spriteFrame && (this.markForUpdateRenderData(!1), this._spriteFrame.once("load", this._onTextureLoaded, this), this._spriteFrame.ensureLoadTexture())) : this._updateGraphics(), this.node.on(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this), this.node._renderFlag |= l.FLAG_POST_RENDER, this._activateMaterial()
- },
- onDisable: function() {
- this._super(), this.node.off(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this), this.node._renderFlag &= ~l.FLAG_POST_RENDER
- },
- onDestroy: function() {
- this._super(), this._removeGraphics()
- },
- _resizeNodeToTargetNode: !1,
- _onTextureLoaded: function() {
- this.setVertsDirty(), this._assembler && this._assembler._renderData && this.markForUpdateRenderData(!0), this.enabledInHierarchy && this._activateMaterial()
- },
- _applySpriteFrame: function(t) {
- t && t.off && t.off("load", this._onTextureLoaded, this);
- var e = this._spriteFrame;
- e ? e.textureLoaded() ? this._onTextureLoaded(null) : (e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()) : this.disableRender()
- },
- _activateMaterial: function() {
- if (this._type !== p.IMAGE_STENCIL || this.spriteFrame && this.spriteFrame.textureLoaded()) {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
- var t = this.sharedMaterials[0];
- if ((t = t ? o.getInstantiatedMaterial(t, this) : o.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("USE_ALPHA_TEST", !0), this._type === p.IMAGE_STENCIL) {
- var e = this.spriteFrame.getTexture();
- t.define("CC_USE_MODEL", !1), t.define("USE_TEXTURE", !0), t.setProperty("texture", e), t.setProperty("alphaThreshold", this.alphaThreshold)
- } else t.define("CC_USE_MODEL", !0), t.define("USE_TEXTURE", !1);
- this._enableMaterial || (this._enableMaterial = o.getInstantiatedBuiltinMaterial("2d-sprite", this)), this._exitMaterial || (this._exitMaterial = o.getInstantiatedBuiltinMaterial("2d-sprite", this), this._exitMaterial.effect.setStencilEnabled(n.default.STENCIL_DISABLE)), this._clearMaterial || (this._clearMaterial = o.getInstantiatedBuiltinMaterial("clear-stencil", this)), this.setMaterial(0, t)
- }
- this.markForRender(!0)
- } else this.markForRender(!1)
- },
- _createGraphics: function() {
- this._graphics || (this._graphics = new h, cc.Assembler.init(this._graphics), this._graphics.node = this.node, this._graphics.lineWidth = 0, this._graphics.strokeColor = cc.color(0, 0, 0, 0)), this._clearGraphics || (this._clearGraphics = new h, cc.Assembler.init(this._clearGraphics), this._clearGraphics.node = new c, this._clearGraphics._activateMaterial(), this._clearGraphics.lineWidth = 0, this._clearGraphics.rect(-1, -1, 2, 2), this._clearGraphics.fill())
- },
- _updateGraphics: function() {
- var t = this.node,
- e = this._graphics;
- e.clear(!1);
- var i = t._contentSize.width,
- n = t._contentSize.height,
- r = -i * t._anchorPoint.x,
- s = -n * t._anchorPoint.y;
- if (this._type === p.RECT) e.rect(r, s, i, n);
- else if (this._type === p.ELLIPSE) {
- for (var o = d(cc.v2(r + i / 2, s + n / 2), {
- x: i / 2,
- y: n / 2
- }, this._segments), a = 0; a < o.length; ++a) {
- var l = o[a];
- 0 === a ? e.moveTo(l.x, l.y) : e.lineTo(l.x, l.y)
- }
- e.close()
- }
- cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? e.stroke() : e.fill()
- },
- _removeGraphics: function() {
- this._graphics && (this._graphics.destroy(), this._graphics = null), this._clearGraphics && (this._clearGraphics.destroy(), this._clearGraphics = null)
- },
- _hitTest: function(t) {
- var e = this.node,
- i = e.getContentSize(),
- n = i.width,
- s = i.height,
- o = u;
- if (e._updateWorldMatrix(), !r.mat4.invert(_, e._worldMatrix)) return !1;
- r.vec2.transformMat4(o, t, _), o.x += e._anchorPoint.x * n, o.y += e._anchorPoint.y * s;
- var a = !1;
- if (this.type === p.RECT || this.type === p.IMAGE_STENCIL) a = o.x >= 0 && o.y >= 0 && o.x <= n && o.y <= s;
- else if (this.type === p.ELLIPSE) {
- var l = n / 2,
- h = s / 2,
- c = o.x - .5 * n,
- f = o.y - .5 * s;
- a = c * c / (l * l) + f * f / (h * h) < 1
- }
- return this.inverted && (a = !a), a
- },
- markForUpdateRenderData: function(t) {
- t && this.enabledInHierarchy ? this.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA : t || (this.node._renderFlag &= ~l.FLAG_UPDATE_RENDER_DATA)
- },
- markForRender: function(t) {
- t && this.enabledInHierarchy ? this.node._renderFlag |= l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER : t || (this.node._renderFlag &= ~(l.FLAG_RENDER | l.FLAG_POST_RENDER))
- },
- disableRender: function() {
- this.node._renderFlag &= ~(l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER)
- }
- });
- cc.Mask = e.exports = m
- }), {
- "../../renderer/gfx": 360,
- "../CCNode": 52,
- "../assets/material/CCMaterial": 75,
- "../graphics/graphics": 140,
- "../renderer/render-flow": 248,
- "../utils/misc": 300,
- "../vmath": 326,
- "./CCRenderComponent": 106
- }],
- 102: [(function(t, e, i) {
- "use strict";
- var n = t("../components/CCRenderComponent"),
- r = t("../assets/material/CCMaterial"),
- s = t("../utils/texture-util"),
- o = t("../../core/utils/blend-func"),
- a = cc.Class({
- name: "cc.MotionStreak",
- extends: n,
- mixins: [o],
- editor: !1,
- ctor: function() {
- this._points = []
- },
- properties: {
- preview: {
- default: !1,
- editorOnly: !0,
- notify: !1,
- animatable: !1
- },
- _fadeTime: 1,
- fadeTime: {
- get: function() {
- return this._fadeTime
- },
- set: function(t) {
- this._fadeTime = t, this.reset()
- },
- animatable: !1,
- tooltip: !1
- },
- _minSeg: 1,
- minSeg: {
- get: function() {
- return this._minSeg
- },
- set: function(t) {
- this._minSeg = t
- },
- animatable: !1,
- tooltip: !1
- },
- _stroke: 64,
- stroke: {
- get: function() {
- return this._stroke
- },
- set: function(t) {
- this._stroke = t
- },
- animatable: !1,
- tooltip: !1
- },
- _texture: {
- default: null,
- type: cc.Texture2D
- },
- texture: {
- get: function() {
- return this._texture
- },
- set: function(t) {
- this._texture !== t && (this._texture = t, t && t.loaded ? this._activateMaterial() : (this.disableRender(), this._ensureLoadTexture()))
- },
- type: cc.Texture2D,
- animatable: !1,
- tooltip: !1
- },
- _color: cc.Color.WHITE,
- color: {
- get: function() {
- return this._color
- },
- set: function(t) {
- this._color = t
- },
- type: cc.Color,
- tooltip: !1
- },
- _fastMode: !1,
- fastMode: {
- get: function() {
- return this._fastMode
- },
- set: function(t) {
- this._fastMode = t
- },
- animatable: !1,
- tooltip: !1
- }
- },
- onEnable: function() {
- this._super(), this._texture && this._texture.loaded ? this._activateMaterial() : (this.disableRender(), this._ensureLoadTexture()), this.reset()
- },
- _ensureLoadTexture: function() {
- if (this._texture && !this._texture.loaded) {
- var t = this;
- s.postLoadTexture(this._texture, (function() {
- t._activateMaterial()
- }))
- }
- },
- _activateMaterial: function() {
- if (this._texture && this._texture.loaded) {
- var t = this.sharedMaterials[0];
- (t = t ? r.getInstantiatedMaterial(t, this) : r.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", this._texture), this.setMaterial(0, t), this.markForRender(!0)
- } else this.disableRender()
- },
- onFocusInEditor: !1,
- onLostFocusInEditor: !1,
- reset: function() {
- this._points.length = 0, this._assembler._renderData.clear()
- },
- update: function(t) {
- this._assembler.update(this, t)
- }
- });
- cc.MotionStreak = e.exports = a
- }), {
- "../../core/utils/blend-func": 293,
- "../assets/material/CCMaterial": 75,
- "../components/CCRenderComponent": 106,
- "../utils/texture-util": 308
- }],
- 103: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- Unified: 0,
- Free: 1
- }),
- r = cc.Enum({
- Horizontal: 0,
- Vertical: 1
- }),
- s = cc.Enum({
- PAGE_TURNING: 0
- }),
- o = cc.Class({
- name: "cc.PageView",
- extends: cc.ScrollView,
- editor: !1,
- ctor: function() {
- this._curPageIdx = 0, this._lastPageIdx = 0, this._pages = [], this._initContentPos = cc.v2(), this._scrollCenterOffsetX = [], this._scrollCenterOffsetY = []
- },
- properties: {
- sizeMode: {
- default: n.Unified,
- type: n,
- tooltip: !1,
- notify: function() {
- this._syncSizeMode()
- }
- },
- direction: {
- default: r.Horizontal,
- type: r,
- tooltip: !1,
- notify: function() {
- this._syncScrollDirection()
- }
- },
- scrollThreshold: {
- default: .5,
- type: cc.Float,
- slide: !0,
- range: [0, 1, .01],
- tooltip: !1
- },
- autoPageTurningThreshold: {
- default: 100,
- type: cc.Float,
- tooltip: !1
- },
- pageTurningEventTiming: {
- default: .1,
- type: cc.Float,
- range: [0, 1, .01],
- tooltip: !1
- },
- indicator: {
- default: null,
- type: cc.PageViewIndicator,
- tooltip: !1,
- notify: function() {
- this.indicator && this.indicator.setPageView(this)
- }
- },
- pageTurningSpeed: {
- default: .3,
- type: cc.Float,
- tooltip: !1
- },
- pageEvents: {
- default: [],
- type: cc.Component.EventHandler,
- tooltip: !1
- }
- },
- statics: {
- SizeMode: n,
- Direction: r,
- EventType: s
- },
- __preload: function() {
- this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this)
- },
- onEnable: function() {
- this._super(), this.node.on("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this)
- },
- onDisable: function() {
- this._super(), this.node.off("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this)
- },
- onLoad: function() {
- this._initPages(), this.indicator && this.indicator.setPageView(this)
- },
- onDestroy: function() {
- this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this)
- },
- getCurrentPageIndex: function() {
- return this._curPageIdx
- },
- setCurrentPageIndex: function(t) {
- this.scrollToPage(t, !0)
- },
- getPages: function() {
- return this._pages
- },
- addPage: function(t) {
- t && -1 === this._pages.indexOf(t) && this.content && (this.content.addChild(t), this._pages.push(t), this._updatePageView())
- },
- insertPage: function(t, e) {
- e < 0 || !t || -1 !== this._pages.indexOf(t) || !this.content || (e >= this._pages.length ? this.addPage(t) : (this._pages.splice(e, 0, t), this.content.addChild(t), this._updatePageView()))
- },
- removePage: function(t) {
- if (t && this.content) {
- var e = this._pages.indexOf(t); - 1 !== e ? this.removePageAtIndex(e) : cc.warnID(4300, t.name)
- }
- },
- removePageAtIndex: function(t) {
- var e = this._pages;
- if (!(t < 0 || t >= e.length)) {
- var i = e[t];
- i && (this.content.removeChild(i), e.splice(t, 1), this._updatePageView())
- }
- },
- removeAllPages: function() {
- if (this.content) {
- for (var t = this._pages, e = 0, i = t.length; e < i; e++) this.content.removeChild(t[e]);
- this._pages.length = 0, this._updatePageView()
- }
- },
- scrollToPage: function(t, e) {
- t < 0 || t >= this._pages.length || (e = void 0 !== e ? e : .3, this._curPageIdx = t, this.scrollToOffset(this._moveOffsetValue(t), e, !0), this.indicator && this.indicator._changedState())
- },
- getScrollEndedEventTiming: function() {
- return this.pageTurningEventTiming
- },
- _syncScrollDirection: function() {
- this.horizontal = this.direction === r.Horizontal, this.vertical = this.direction === r.Vertical
- },
- _syncSizeMode: function() {
- if (this.content) {
- var t = this.content.getComponent(cc.Layout);
- if (t) {
- if (this.sizeMode === n.Free && this._pages.length > 0) {
- var e = this._pages[this._pages.length - 1];
- this.direction === r.Horizontal ? (t.paddingLeft = (this._view.width - this._pages[0].width) / 2, t.paddingRight = (this._view.width - e.width) / 2) : this.direction === r.Vertical && (t.paddingTop = (this._view.height - this._pages[0].height) / 2, t.paddingBottom = (this._view.height - e.height) / 2)
- }
- t.updateLayout()
- }
- }
- },
- _updatePageView: function() {
- var t = this.content.getComponent(cc.Layout);
- t && t.enabled && t.updateLayout();
- var e = this._pages.length;
- this._curPageIdx >= e && (this._curPageIdx = 0 === e ? 0 : e - 1, this._lastPageIdx = this._curPageIdx);
- for (var i = this._initContentPos, n = 0; n < e; ++n) {
- var s = this._pages[n];
- s.setSiblingIndex(n), this.direction === r.Horizontal ? this._scrollCenterOffsetX[n] = Math.abs(i.x + s.x) : this._scrollCenterOffsetY[n] = Math.abs(i.y + s.y)
- }
- this.indicator && this.indicator._refresh()
- },
- _updateAllPagesSize: function() {
- if (this.sizeMode === n.Unified)
- for (var t = this._pages, e = this._view.getContentSize(), i = 0, r = t.length; i < r; i++) t[i].setContentSize(e)
- },
- _initPages: function() {
- if (this.content) {
- this._initContentPos = this.content.position;
- for (var t = this.content.children, e = 0; e < t.length; ++e) {
- var i = t[e];
- this._pages.indexOf(i) >= 0 || this._pages.push(i)
- }
- this._syncScrollDirection(), this._syncSizeMode(), this._updatePageView()
- }
- },
- _dispatchPageTurningEvent: function() {
- this._lastPageIdx !== this._curPageIdx && (this._lastPageIdx = this._curPageIdx, cc.Component.EventHandler.emitEvents(this.pageEvents, this, s.PAGE_TURNING), this.node.emit("page-turning", this))
- },
- _isScrollable: function(t, e, i) {
- if (this.sizeMode === n.Free) {
- var s, o;
- if (this.direction === r.Horizontal) return s = this._scrollCenterOffsetX[e], o = this._scrollCenterOffsetX[i], Math.abs(t.x) >= Math.abs(s - o) * this.scrollThreshold;
- if (this.direction === r.Vertical) return s = this._scrollCenterOffsetY[e], o = this._scrollCenterOffsetY[i], Math.abs(t.y) >= Math.abs(s - o) * this.scrollThreshold
- } else {
- if (this.direction === r.Horizontal) return Math.abs(t.x) >= this._view.width * this.scrollThreshold;
- if (this.direction === r.Vertical) return Math.abs(t.y) >= this._view.height * this.scrollThreshold
- }
- },
- _isQuicklyScrollable: function(t) {
- if (this.direction === r.Horizontal) {
- if (Math.abs(t.x) > this.autoPageTurningThreshold) return !0
- } else if (this.direction === r.Vertical && Math.abs(t.y) > this.autoPageTurningThreshold) return !0;
- return !1
- },
- _moveOffsetValue: function(t) {
- var e = cc.v2(0, 0);
- return this.sizeMode === n.Free ? this.direction === r.Horizontal ? e.x = this._scrollCenterOffsetX[t] : this.direction === r.Vertical && (e.y = this._scrollCenterOffsetY[t]) : this.direction === r.Horizontal ? e.x = t * this._view.width : this.direction === r.Vertical && (e.y = t * this._view.height), e
- },
- _getDragDirection: function(t) {
- return this.direction === r.Horizontal ? 0 === t.x ? 0 : t.x > 0 ? 1 : -1 : this.direction === r.Vertical ? 0 === t.y ? 0 : t.y < 0 ? 1 : -1 : void 0
- },
- _handleReleaseLogic: function(t) {
- this._autoScrollToPage(), this._scrolling && (this._scrolling = !1, this._autoScrolling || this._dispatchEvent("scroll-ended"))
- },
- _autoScrollToPage: function() {
- var t = this._startBounceBackIfNeeded(),
- e = this._touchBeganPosition.sub(this._touchEndPosition);
- if (t) {
- var i = this._getDragDirection(e);
- if (0 === i) return;
- this._curPageIdx = i > 0 ? this._pages.length - 1 : 0, this.indicator && this.indicator._changedState()
- } else {
- var n = this._curPageIdx,
- r = n + this._getDragDirection(e),
- s = this.pageTurningSpeed * Math.abs(n - r);
- if (r < this._pages.length) {
- if (this._isScrollable(e, n, r)) return void this.scrollToPage(r, s);
- var o = this._calculateTouchMoveVelocity();
- if (this._isQuicklyScrollable(o)) return void this.scrollToPage(r, s)
- }
- this.scrollToPage(n, s)
- }
- },
- _onTouchBegan: function(t, e) {
- this._touchBeganPosition = t.touch.getLocation(), this._super(t, e)
- },
- _onTouchMoved: function(t, e) {
- this._super(t, e)
- },
- _onTouchEnded: function(t, e) {
- this._touchEndPosition = t.touch.getLocation(), this._super(t, e)
- },
- _onTouchCancelled: function(t, e) {
- this._touchEndPosition = t.touch.getLocation(), this._super(t, e)
- },
- _onMouseWheel: function() {}
- });
- cc.PageView = e.exports = o
- }), {}],
- 104: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- HORIZONTAL: 0,
- VERTICAL: 1
- }),
- r = cc.Class({
- name: "cc.PageViewIndicator",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- _layout: null,
- _pageView: null,
- _indicators: [],
- spriteFrame: {
- default: null,
- type: cc.SpriteFrame,
- tooltip: !1
- },
- direction: {
- default: n.HORIZONTAL,
- type: n,
- tooltip: !1
- },
- cellSize: {
- default: cc.size(20, 20),
- tooltip: !1
- },
- spacing: {
- default: 0,
- tooltip: !1
- }
- },
- statics: {
- Direction: n
- },
- onLoad: function() {
- this._updateLayout()
- },
- setPageView: function(t) {
- this._pageView = t, this._refresh()
- },
- _updateLayout: function() {
- this._layout = this.getComponent(cc.Layout), this._layout || (this._layout = this.addComponent(cc.Layout)), this.direction === n.HORIZONTAL ? (this._layout.type = cc.Layout.Type.HORIZONTAL, this._layout.spacingX = this.spacing) : this.direction === n.VERTICAL && (this._layout.type = cc.Layout.Type.VERTICAL, this._layout.spacingY = this.spacing), this._layout.resizeMode = cc.Layout.ResizeMode.CONTAINER
- },
- _createIndicator: function() {
- var t = new cc.Node;
- return t.addComponent(cc.Sprite).spriteFrame = this.spriteFrame, t.parent = this.node, t.width = this.cellSize.width, t.height = this.cellSize.height, t
- },
- _changedState: function() {
- var t = this._indicators;
- if (0 !== t.length) {
- var e = this._pageView._curPageIdx;
- if (!(e >= t.length)) {
- for (var i = 0; i < t.length; ++i) {
- t[i].opacity = 127.5
- }
- t[e].opacity = 255
- }
- }
- },
- _refresh: function() {
- if (this._pageView) {
- var t = this._indicators,
- e = this._pageView.getPages();
- if (e.length !== t.length) {
- var i = 0;
- if (e.length > t.length)
- for (i = 0; i < e.length; ++i) t[i] || (t[i] = this._createIndicator());
- else
- for (i = t.length - e.length; i > 0; --i) {
- var n = t[i - 1];
- this.node.removeChild(n), t.splice(i - 1, 1)
- }
- this._layout && this._layout.enabledInHierarchy && this._layout.updateLayout(), this._changedState()
- }
- }
- }
- });
- cc.PageViewIndicator = e.exports = r
- }), {
- "./CCComponent": 95
- }],
- 105: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc"),
- r = t("./CCComponent"),
- s = cc.Enum({
- HORIZONTAL: 0,
- VERTICAL: 1,
- FILLED: 2
- }),
- o = cc.Class({
- name: "cc.ProgressBar",
- extends: r,
- editor: !1,
- _initBarSprite: function() {
- if (this.barSprite) {
- var t = this.barSprite.node;
- if (!t) return;
- var e = this.node.getContentSize(),
- i = this.node.getAnchorPoint(),
- n = t.getContentSize();
- t.parent === this.node && this.node.setContentSize(n), this.barSprite.fillType === cc.Sprite.FillType.RADIAL && (this.mode = s.FILLED);
- var r = t.getContentSize();
- if (this.mode === s.HORIZONTAL ? this.totalLength = r.width : this.mode === s.VERTICAL ? this.totalLength = r.height : this.totalLength = this.barSprite.fillRange, t.parent === this.node) {
- var o = -e.width * i.x;
- t.setPosition(cc.v2(o, 0))
- }
- }
- },
- _updateBarStatus: function() {
- if (this.barSprite) {
- var t = this.barSprite.node;
- if (!t) return;
- var e, i, r, o = t.getAnchorPoint(),
- a = t.getContentSize(),
- l = t.getPosition(),
- h = cc.v2(0, .5),
- c = n.clamp01(this.progress),
- u = this.totalLength * c;
- switch (this.mode) {
- case s.HORIZONTAL:
- this.reverse && (h = cc.v2(1, .5)), e = cc.size(u, a.height), i = this.totalLength, r = a.height;
- break;
- case s.VERTICAL:
- h = this.reverse ? cc.v2(.5, 1) : cc.v2(.5, 0), e = cc.size(a.width, u), i = a.width, r = this.totalLength
- }
- if (this.mode === s.FILLED) this.barSprite.type !== cc.Sprite.Type.FILLED ? cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!") : (this.reverse && (u *= -1), this.barSprite.fillRange = u);
- else if (this.barSprite.type !== cc.Sprite.Type.FILLED) {
- var _ = h.x - o.x,
- f = h.y - o.y,
- d = cc.v2(i * _, r * f);
- t.setPosition(l.x + d.x, l.y + d.y), t.setAnchorPoint(h), t.setContentSize(e)
- } else cc.warn("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")
- }
- },
- properties: {
- barSprite: {
- default: null,
- type: cc.Sprite,
- tooltip: !1,
- notify: function() {
- this._initBarSprite()
- },
- animatable: !1
- },
- mode: {
- default: s.HORIZONTAL,
- type: s,
- tooltip: !1,
- notify: function() {
- if (this.barSprite) {
- var t = this.barSprite.node;
- if (!t) return;
- var e = t.getContentSize();
- this.mode === s.HORIZONTAL ? this.totalLength = e.width : this.mode === s.VERTICAL ? this.totalLength = e.height : this.mode === s.FILLED && (this.totalLength = this.barSprite.fillRange)
- }
- },
- animatable: !1
- },
- _N$totalLength: 1,
- totalLength: {
- range: [0, Number.MAX_VALUE],
- tooltip: !1,
- get: function() {
- return this._N$totalLength
- },
- set: function(t) {
- this.mode === s.FILLED && (t = n.clamp01(t)), this._N$totalLength = t, this._updateBarStatus()
- }
- },
- progress: {
- default: 1,
- type: cc.Float,
- range: [0, 1, .1],
- slide: !0,
- tooltip: !1,
- notify: function() {
- this._updateBarStatus()
- }
- },
- reverse: {
- default: !1,
- tooltip: !1,
- notify: function() {
- this.barSprite && (this.barSprite.fillStart = 1 - this.barSprite.fillStart), this._updateBarStatus()
- },
- animatable: !1
- }
- },
- statics: {
- Mode: s
- }
- });
- cc.ProgressBar = e.exports = o
- }), {
- "../utils/misc": 300,
- "./CCComponent": 95
- }],
- 106: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../renderer/assembler"));
- var r = t("./CCComponent"),
- s = t("../renderer/render-flow"),
- o = t("../assets/material/CCMaterial"),
- a = cc.Class({
- name: "RenderComponent",
- extends: r,
- editor: !1,
- properties: {
- _materials: {
- default: [],
- type: o
- },
- sharedMaterials: {
- get: function() {
- return this._materials
- },
- set: function(t) {
- this._materials = t, this._activateMaterial(!0)
- },
- type: [o],
- displayName: "Materials",
- animatable: !1
- }
- },
- ctor: function() {
- this._vertsDirty = !0, this._material = null, this._assembler = null
- },
- _resetAssembler: function() {
- this.setVertsDirty(!0), n.default.init(this), this._updateColor()
- },
- __preload: function() {
- this._resetAssembler()
- },
- onEnable: function() {
- this.node._renderComponent && (this.node._renderComponent.enabled = !1), this.node._renderComponent = this, this.node.on(cc.Node.EventType.SIZE_CHANGED, this._onNodeSizeDirty, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._onNodeSizeDirty, this), this.node._renderFlag |= s.FLAG_RENDER | s.FLAG_UPDATE_RENDER_DATA | s.FLAG_OPACITY_COLOR
- },
- onDisable: function() {
- this.node._renderComponent = null, this.node.off(cc.Node.EventType.SIZE_CHANGED, this._onNodeSizeDirty, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._onNodeSizeDirty, this), this.disableRender()
- },
- onDestroy: function() {
- for (var t = this._materials, e = 0; e < t.length; e++) cc.pool.material.put(t[e]);
- t.length = 0, cc.pool.assembler.put(this._assembler)
- },
- setVertsDirty: function() {
- this._vertsDirty = !0, this.markForUpdateRenderData(!0)
- },
- _onNodeSizeDirty: function() {
- this.setVertsDirty()
- },
- _on3DNodeChanged: function() {
- this.setVertsDirty()
- },
- _canRender: function() {
- return this._enabled && this.node._activeInHierarchy
- },
- markForUpdateRenderData: function(t) {
- t && this._canRender() ? this.node._renderFlag |= s.FLAG_UPDATE_RENDER_DATA : t || (this.node._renderFlag &= ~s.FLAG_UPDATE_RENDER_DATA)
- },
- markForRender: function(t) {
- t && this._canRender() ? this.node._renderFlag |= s.FLAG_RENDER : t || (this.node._renderFlag &= ~s.FLAG_RENDER)
- },
- disableRender: function() {
- this.node._renderFlag &= ~(s.FLAG_RENDER | s.FLAG_UPDATE_RENDER_DATA)
- },
- getMaterial: function(t) {
- if (t < 0 || t >= this._materials.length) return null;
- var e = this._materials[t];
- if (!e) return null;
- var i = o.getInstantiatedMaterial(e, this);
- return i !== e && this.setMaterial(t, i), this._materials[t]
- },
- setMaterial: function(t, e) {
- this._materials[t] = e, e && this.markForUpdateRenderData(!0)
- },
- _activateMaterial: function(t) {},
- _updateColor: function() {
- this._assembler.updateColor && this._assembler.updateColor(this)
- },
- _checkBacth: function(t, e) {
- var i = this.sharedMaterials[0];
- (i && i.getHash() !== t.material.getHash() || t.cullingMask !== e) && (t._flush(), t.node = i.getDefine("CC_USE_MODEL") ? this.node : t._dummyNode, t.material = i, t.cullingMask = e)
- }
- });
- cc.RenderComponent = e.exports = a
- }), {
- "../assets/material/CCMaterial": 75,
- "../renderer/assembler": 227,
- "../renderer/render-flow": 248,
- "./CCComponent": 95
- }],
- 107: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("../platform/CCMacro"),
- s = t("../utils/text-utils"),
- o = new(t("../utils/html-text-parser")),
- a = r.TextAlignment,
- l = r.VerticalTextAlignment;
- var h = new n.Pool(function(t) {
- if (!cc.isValid(t)) return !1;
- var e = t.getComponent(cc.LabelOutline);
- return e && (e.width = 0), !0
- }, 20);
- h.get = function(t, e) {
- var i = this._get();
- i || (i = new cc.PrivateNode("RICHTEXT_CHILD"));
- var n = i.getComponent(cc.Label);
- return n || (n = i.addComponent(cc.Label)), i.setPosition(0, 0), i.setAnchorPoint(.5, .5), i.setContentSize(128, 128), i.skewX = 0, "string" != typeof t && (t = "" + t), e.font instanceof cc.Font ? n.font = e.font : n.fontFamily = e.fontFamily, n.string = t, n.horizontalAlign = a.LEFT, n.verticalAlign = l.TOP, n.fontSize = e.fontSize || 40, n.overflow = 0, n.enableWrapText = !0, n.lineHeight = 40, n._enableBold(!1), n._enableItalics(!1), n._enableUnderline(!1), i
- };
- var c = cc.Class({
- name: "cc.RichText",
- extends: cc.Component,
- ctor: function() {
- this._textArray = null, this._labelSegments = [], this._labelSegmentsCache = [], this._linesWidth = [], this._updateRichTextStatus = this._updateRichText
- },
- editor: !1,
- properties: {
- string: {
- default: "<color=#00ff00>Rich</c><color=#0fffff>Text</color>",
- multiline: !0,
- tooltip: !1,
- notify: function() {
- this._updateRichTextStatus()
- }
- },
- horizontalAlign: {
- default: a.LEFT,
- type: a,
- tooltip: !1,
- animatable: !1,
- notify: function(t) {
- this.horizontalAlign !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
- }
- },
- fontSize: {
- default: 40,
- tooltip: !1,
- notify: function(t) {
- this.fontSize !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
- }
- },
- _fontFamily: "Arial",
- fontFamily: {
- tooltip: !1,
- get: function() {
- return this._fontFamily
- },
- set: function(t) {
- this._fontFamily !== t && (this._fontFamily = t, this._layoutDirty = !0, this._updateRichTextStatus())
- },
- animatable: !1
- },
- font: {
- default: null,
- type: cc.TTFFont,
- tooltip: !1,
- notify: function(t) {
- this.font !== t && (this._layoutDirty = !0, this.font ? (this.useSystemFont = !1, this._onTTFLoaded()) : this.useSystemFont = !0, this._updateRichTextStatus())
- }
- },
- _isSystemFontUsed: !0,
- useSystemFont: {
- get: function() {
- return this._isSystemFontUsed
- },
- set: function(t) {
- this._isSystemFontUsed !== t && (this._isSystemFontUsed = t, this._layoutDirty = !0, this._updateRichTextStatus())
- },
- animatable: !1,
- tooltip: !1
- },
- maxWidth: {
- default: 0,
- tooltip: !1,
- notify: function(t) {
- this.maxWidth !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
- }
- },
- lineHeight: {
- default: 40,
- tooltip: !1,
- notify: function(t) {
- this.lineHeight !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
- }
- },
- imageAtlas: {
- default: null,
- type: cc.SpriteAtlas,
- tooltip: !1,
- notify: function(t) {
- this.imageAtlas !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
- }
- },
- handleTouchEvent: {
- default: !0,
- tooltip: !1,
- notify: function(t) {
- this.handleTouchEvent !== t && this.enabledInHierarchy && (this.handleTouchEvent ? this._addEventListeners() : this._removeEventListeners())
- }
- }
- },
- statics: {
- HorizontalAlign: a,
- VerticalAlign: l
- },
- onEnable: function() {
- this.handleTouchEvent && this._addEventListeners(), this._updateRichText(), this._activateChildren(!0)
- },
- onDisable: function() {
- this.handleTouchEvent && this._removeEventListeners(), this._activateChildren(!1)
- },
- start: function() {
- this._onTTFLoaded()
- },
- _onColorChanged: function(t) {
- this.node.children.forEach((function(e) {
- e.color = t
- }))
- },
- _addEventListeners: function() {
- this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this)
- },
- _removeEventListeners: function() {
- this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this)
- },
- _updateLabelSegmentTextAttributes: function() {
- this._labelSegments.forEach(function(t) {
- this._applyTextAttribute(t)
- }.bind(this))
- },
- _createFontLabel: function(t) {
- return h.get(t, this)
- },
- _onTTFLoaded: function() {
- if (this.font instanceof cc.TTFFont)
- if (this.font._nativeAsset) this._layoutDirty = !0, this._updateRichText();
- else {
- var t = this;
- cc.loader.load(this.font.nativeUrl, (function(e, i) {
- t._layoutDirty = !0, t._updateRichText()
- }))
- }
- else this._layoutDirty = !0, this._updateRichText()
- },
- _measureText: function(t, e) {
- var i = this,
- n = function(e) {
- var n = void 0;
- return 0 === i._labelSegmentsCache.length ? (n = i._createFontLabel(e), i._labelSegmentsCache.push(n)) : (n = i._labelSegmentsCache[0]).getComponent(cc.Label).string = e, n._styleIndex = t, i._applyTextAttribute(n), n.getContentSize().width
- };
- return e ? n(e) : n
- },
- _onTouchEnded: function(t) {
- for (var e = this, i = this.node.getComponents(cc.Component), n = function(n) {
- var r = e._labelSegments[n],
- s = r._clickHandler,
- o = r._clickParam;
- s && e._containsTouchLocation(r, t.touch.getLocation()) && (i.forEach((function(e) {
- e.enabledInHierarchy && e[s] && e[s](t, o)
- })), t.stopPropagation())
- }, r = 0; r < this._labelSegments.length; ++r) n(r)
- },
- _containsTouchLocation: function(t, e) {
- return t.getBoundingBoxToWorld().contains(e)
- },
- _resetState: function() {
- for (var t = this.node.children, e = t.length - 1; e >= 0; e--) {
- var i = t[e];
- "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.parent === this.node ? i.parent = null : t.splice(e, 1), "RICHTEXT_CHILD" === i.name && h.put(i))
- }
- this._labelSegments.length = 0, this._labelSegmentsCache.length = 0, this._linesWidth.length = 0, this._lineOffsetX = 0, this._lineCount = 1, this._labelWidth = 0, this._labelHeight = 0, this._layoutDirty = !0
- },
- onRestore: !1,
- _activateChildren: function(t) {
- for (var e = this.node.children.length - 1; e >= 0; e--) {
- var i = this.node.children[e];
- "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.active = t)
- }
- },
- _addLabelSegment: function(t, e) {
- var i = void 0;
- return 0 === this._labelSegmentsCache.length ? i = this._createFontLabel(t) : (i = this._labelSegmentsCache.pop()).getComponent(cc.Label).string = t, i._styleIndex = e, i._lineCount = this._lineCount, i.active = this.node.active, i.setAnchorPoint(0, 0), this._applyTextAttribute(i), this.node.addChild(i), this._labelSegments.push(i), i
- },
- _updateRichTextWithMaxWidth: function(t, e, i) {
- var n = e;
- if (this._lineOffsetX > 0 && n + this._lineOffsetX > this.maxWidth)
- for (var r = 0; this._lineOffsetX <= this.maxWidth;) {
- var o = this._getFirstWordLen(t, r, t.length),
- a = t.substr(r, o),
- l = this._measureText(i, a);
- if (!(this._lineOffsetX + l <= this.maxWidth)) {
- if (r > 0) {
- var h = t.substr(0, r);
- this._addLabelSegment(h, i), t = t.substr(r, t.length), n = this._measureText(i, t)
- }
- this._updateLineInfo();
- break
- }
- this._lineOffsetX += l, r += o
- }
- if (n > this.maxWidth)
- for (var c = s.fragmentText(t, n, this.maxWidth, this._measureText(i)), u = 0; u < c.length; ++u) {
- var _ = c[u],
- f = this._addLabelSegment(_, i).getContentSize();
- this._lineOffsetX += f.width, c.length > 1 && u < c.length - 1 && this._updateLineInfo()
- } else this._lineOffsetX += n, this._addLabelSegment(t, i)
- },
- _isLastComponentCR: function(t) {
- return t.length - 1 === t.lastIndexOf("\n")
- },
- _updateLineInfo: function() {
- this._linesWidth.push(this._lineOffsetX), this._lineOffsetX = 0, this._lineCount++
- },
- _needsUpdateTextLayout: function(t) {
- if (this._layoutDirty || !this._textArray || !t) return !0;
- if (this._textArray.length !== t.length) return !0;
- for (var e = 0; e < this._textArray.length; ++e) {
- var i = this._textArray[e],
- n = t[e];
- if (i.text !== n.text) return !0;
- if (i.style) {
- if (n.style) {
- if (!!n.style.outline != !!i.style.outline) return !0;
- if (i.style.size !== n.style.size || i.style.italic !== n.style.italic || i.style.isImage !== n.style.isImage) return !0;
- if (i.style.isImage === n.style.isImage && i.style.src !== n.style.src) return !0
- } else if (i.style.size || i.style.italic || i.style.isImage || i.style.outline) return !0
- } else if (n.style && (n.style.size || n.style.italic || n.style.isImage || n.style.outline)) return !0
- }
- return !1
- },
- _addRichTextImageElement: function(t) {
- var e = t.style.src,
- i = this.imageAtlas.getSpriteFrame(e);
- if (i) {
- var n = new cc.PrivateNode("RICHTEXT_Image_CHILD"),
- r = n.addComponent(cc.Sprite);
- n.setAnchorPoint(0, 0), r.type = cc.Sprite.Type.SLICED, r.sizeMode = cc.Sprite.SizeMode.CUSTOM, this.node.addChild(n), this._labelSegments.push(n);
- var s = i.getRect(),
- o = 1,
- a = s.width,
- l = s.height,
- h = t.style.imageWidth,
- c = t.style.imageHeight;
- c > 0 && c < this.lineHeight ? (a *= o = c / l, l *= o) : (a *= o = this.lineHeight / l, l *= o), h > 0 && (a = h), this.maxWidth > 0 ? (this._lineOffsetX + a > this.maxWidth && this._updateLineInfo(), this._lineOffsetX += a) : (this._lineOffsetX += a, this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX)), r.spriteFrame = i, n.setContentSize(a, l), n._lineCount = this._lineCount, t.style.event ? (t.style.event.click && (n._clickHandler = t.style.event.click), t.style.event.param ? n._clickParam = t.style.event.param : n._clickParam = "") : n._clickHandler = null
- } else cc.warnID(4400)
- },
- _updateRichText: function() {
- if (this.enabled) {
- var t = o.parse(this.string);
- if (!this._needsUpdateTextLayout(t)) return this._textArray = t, void this._updateLabelSegmentTextAttributes();
- this._textArray = t, this._resetState();
- for (var e = !1, i = void 0, n = 0; n < this._textArray.length; ++n) {
- var r = this._textArray[n],
- a = r.text;
- if ("" === a) {
- if (r.style && r.style.newline) {
- this._updateLineInfo();
- continue
- }
- if (r.style && r.style.isImage && this.imageAtlas) {
- this._addRichTextImageElement(r);
- continue
- }
- }
- for (var l = a.split("\n"), h = 0; h < l.length; ++h) {
- var c = l[h];
- if ("" !== c)
- if (e = !1, this.maxWidth > 0) {
- var u = this._measureText(n, c);
- this._updateRichTextWithMaxWidth(c, u, n), l.length > 1 && h < l.length - 1 && this._updateLineInfo()
- } else i = this._addLabelSegment(c, n).getContentSize(), this._lineOffsetX += i.width, this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX), l.length > 1 && h < l.length - 1 && this._updateLineInfo();
- else {
- if (this._isLastComponentCR(a) && h === l.length - 1) continue;
- this._updateLineInfo(), e = !0
- }
- }
- }
- e || this._linesWidth.push(this._lineOffsetX), this.maxWidth > 0 && (this._labelWidth = this.maxWidth), this._labelHeight = (this._lineCount + s.BASELINE_RATIO) * this.lineHeight, this.node.setContentSize(this._labelWidth, this._labelHeight), this._updateRichTextPosition(), this._layoutDirty = !1
- }
- },
- _getFirstWordLen: function(t, e, i) {
- var n = t.charAt(e);
- if (s.isUnicodeCJK(n) || s.isUnicodeSpace(n)) return 1;
- for (var r = 1, o = e + 1; o < i && (n = t.charAt(o), !s.isUnicodeSpace(n) && !s.isUnicodeCJK(n)); ++o) r++;
- return r
- },
- _updateRichTextPosition: function() {
- for (var t = 0, e = 1, i = this._lineCount, n = 0; n < this._labelSegments.length; ++n) {
- var r = this._labelSegments[n],
- s = r._lineCount;
- s > e && (t = 0, e = s);
- var o = 0;
- switch (this.horizontalAlign) {
- case a.LEFT:
- o = -this._labelWidth / 2;
- break;
- case a.CENTER:
- o = -this._linesWidth[s - 1] / 2;
- break;
- case a.RIGHT:
- o = this._labelWidth / 2 - this._linesWidth[s - 1]
- }
- r.x = t + o;
- var l = r.getContentSize();
- r.y = this.lineHeight * (i - s) - this._labelHeight / 2, s === e && (t += l.width)
- }
- },
- _convertLiteralColorValue: function(t) {
- var e = t.toUpperCase();
- return cc.Color[e] ? cc.Color[e] : cc.color().fromHEX(t)
- },
- _applyTextAttribute: function(t) {
- var e = t.getComponent(cc.Label);
- if (e) {
- var i = t._styleIndex;
- this._isSystemFontUsed && (e.fontFamily = this._fontFamily), e.useSystemFont = this._isSystemFontUsed, e.lineHeight = this.lineHeight, e.horizontalAlign = a.LEFT, e.verticalAlign = l.CENTER;
- var n = null;
- if (this._textArray[i] && (n = this._textArray[i].style), n && n.color ? t.color = this._convertLiteralColorValue(n.color) : t.color = this.node.color, e._enableBold(n && n.bold), e._enableItalics(n && n.italic), n && n.italic && (t.skewX = 12), e._enableUnderline(n && n.underline), n && n.outline) {
- var r = t.getComponent(cc.LabelOutline);
- r || (r = t.addComponent(cc.LabelOutline)), r.color = this._convertLiteralColorValue(n.outline.color), r.width = n.outline.width
- }
- n && n.size ? e.fontSize = n.size : e.fontSize = this.fontSize, e._forceUpdateRenderData(), n && n.event ? (n.event.click && (t._clickHandler = n.event.click), n.event.param ? t._clickParam = n.event.param : t._clickParam = "") : t._clickHandler = null
- }
- },
- onDestroy: function() {
- for (var t = 0; t < this._labelSegments.length; ++t) this._labelSegments[t].removeFromParent(), h.put(this._labelSegments[t])
- }
- });
- cc.RichText = e.exports = c
- }), {
- "../platform/CCMacro": 203,
- "../platform/js": 218,
- "../utils/html-text-parser": 297,
- "../utils/text-utils": 307
- }],
- 108: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc"),
- r = (t("./CCComponent"), cc.Enum({
- HORIZONTAL: 0,
- VERTICAL: 1
- })),
- s = cc.Class({
- name: "cc.Scrollbar",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- _scrollView: null,
- _touching: !1,
- _autoHideRemainingTime: {
- default: 0,
- serializable: !1
- },
- _opacity: 255,
- handle: {
- default: null,
- type: cc.Sprite,
- tooltip: !1,
- notify: function() {
- this._onScroll(cc.v2(0, 0))
- },
- animatable: !1
- },
- direction: {
- default: r.HORIZONTAL,
- type: r,
- tooltip: !1,
- notify: function() {
- this._onScroll(cc.v2(0, 0))
- },
- animatable: !1
- },
- enableAutoHide: {
- default: !0,
- animatable: !1,
- tooltip: !1
- },
- autoHideTime: {
- default: 1,
- animatable: !1,
- tooltip: !1
- }
- },
- statics: {
- Direction: r
- },
- setTargetScrollView: function(t) {
- this._scrollView = t
- },
- _convertToScrollViewSpace: function(t) {
- var e = this._scrollView.node,
- i = t.convertToWorldSpaceAR(cc.v2(-t.anchorX * t.width, -t.anchorY * t.height)),
- n = e.convertToNodeSpaceAR(i);
- return n.x += e.anchorX * e.width, n.y += e.anchorY * e.height, n
- },
- _setOpacity: function(t) {
- this.handle && (this.node.opacity = t, this.handle.node.opacity = t)
- },
- _onScroll: function(t) {
- if (this._scrollView) {
- var e = this._scrollView.content;
- if (e) {
- var i = e.getContentSize(),
- n = this._scrollView.node.getContentSize(),
- s = this.node.getContentSize();
- if (this._conditionalDisableScrollBar(i, n)) return;
- this.enableAutoHide && (this._autoHideRemainingTime = this.autoHideTime, this._setOpacity(this._opacity));
- var o = 0,
- a = 0,
- l = 0,
- h = 0,
- c = 0;
- this.direction === r.HORIZONTAL ? (o = i.width, a = n.width, c = s.width, l = t.x, h = -this._convertToScrollViewSpace(e).x) : this.direction === r.VERTICAL && (o = i.height, a = n.height, c = s.height, l = t.y, h = -this._convertToScrollViewSpace(e).y);
- var u = this._calculateLength(o, a, c, l),
- _ = this._calculatePosition(o, a, c, h, l, u);
- this._updateLength(u), this._updateHanlderPosition(_)
- }
- }
- },
- _updateHanlderPosition: function(t) {
- if (this.handle) {
- var e = this._fixupHandlerPosition();
- this.handle.node.setPosition(t.x + e.x, t.y + e.y)
- }
- },
- _fixupHandlerPosition: function() {
- var t = this.node.getContentSize(),
- e = this.node.getAnchorPoint(),
- i = this.handle.node.getContentSize(),
- n = this.handle.node.parent,
- s = this.node.convertToWorldSpaceAR(cc.v2(-t.width * e.x, -t.height * e.y)),
- o = n.convertToNodeSpaceAR(s);
- return this.direction === r.HORIZONTAL ? o = cc.v2(o.x, o.y + (t.height - i.height) / 2) : this.direction === r.VERTICAL && (o = cc.v2(o.x + (t.width - i.width) / 2, o.y)), this.handle.node.setPosition(o), o
- },
- _onTouchBegan: function() {
- this.enableAutoHide && (this._touching = !0)
- },
- _conditionalDisableScrollBar: function(t, e) {
- return t.width <= e.width && this.direction === r.HORIZONTAL || t.height <= e.height && this.direction === r.VERTICAL
- },
- _onTouchEnded: function() {
- if (this.enableAutoHide && (this._touching = !1, !(this.autoHideTime <= 0))) {
- if (this._scrollView) {
- var t = this._scrollView.content;
- if (t) {
- var e = t.getContentSize(),
- i = this._scrollView.node.getContentSize();
- if (this._conditionalDisableScrollBar(e, i)) return
- }
- }
- this._autoHideRemainingTime = this.autoHideTime
- }
- },
- _calculateLength: function(t, e, i, n) {
- var r = t;
- return n && (r += 20 * (n > 0 ? n : -n)), i * (e / r)
- },
- _calculatePosition: function(t, e, i, s, o, a) {
- var l = t - e;
- o && (l += Math.abs(o));
- var h = 0;
- l && (h = s / l, h = n.clamp01(h));
- var c = (i - a) * h;
- return this.direction === r.VERTICAL ? cc.v2(0, c) : cc.v2(c, 0)
- },
- _updateLength: function(t) {
- if (this.handle) {
- var e = this.handle.node,
- i = e.getContentSize();
- e.setAnchorPoint(cc.v2(0, 0)), this.direction === r.HORIZONTAL ? e.setContentSize(t, i.height) : e.setContentSize(i.width, t)
- }
- },
- _processAutoHide: function(t) {
- if (this.enableAutoHide && !(this._autoHideRemainingTime <= 0) && !this._touching && (this._autoHideRemainingTime -= t, this._autoHideRemainingTime <= this.autoHideTime)) {
- this._autoHideRemainingTime = Math.max(0, this._autoHideRemainingTime);
- var e = this._opacity * (this._autoHideRemainingTime / this.autoHideTime);
- this._setOpacity(e)
- }
- },
- start: function() {
- this.enableAutoHide && this._setOpacity(0)
- },
- hide: function() {
- this._autoHideRemainingTime = 0, this._setOpacity(0)
- },
- show: function() {
- this._autoHideRemainingTime = this.autoHideTime, this._setOpacity(this._opacity)
- },
- update: function(t) {
- this._processAutoHide(t)
- }
- });
- cc.Scrollbar = e.exports = s
- }), {
- "../utils/misc": 300,
- "./CCComponent": 95
- }],
- 109: [(function(t, e, i) {
- "use strict";
- var n = t("../CCNode").EventType,
- r = function(t) {
- return (t -= 1) * t * t * t * t + 1
- },
- s = function() {
- return (new Date).getMilliseconds()
- },
- o = cc.Enum({
- SCROLL_TO_TOP: 0,
- SCROLL_TO_BOTTOM: 1,
- SCROLL_TO_LEFT: 2,
- SCROLL_TO_RIGHT: 3,
- SCROLLING: 4,
- BOUNCE_TOP: 5,
- BOUNCE_BOTTOM: 6,
- BOUNCE_LEFT: 7,
- BOUNCE_RIGHT: 8,
- SCROLL_ENDED: 9,
- TOUCH_UP: 10,
- AUTOSCROLL_ENDED_WITH_THRESHOLD: 11,
- SCROLL_BEGAN: 12
- }),
- a = {
- "scroll-to-top": o.SCROLL_TO_TOP,
- "scroll-to-bottom": o.SCROLL_TO_BOTTOM,
- "scroll-to-left": o.SCROLL_TO_LEFT,
- "scroll-to-right": o.SCROLL_TO_RIGHT,
- scrolling: o.SCROLLING,
- "bounce-bottom": o.BOUNCE_BOTTOM,
- "bounce-left": o.BOUNCE_LEFT,
- "bounce-right": o.BOUNCE_RIGHT,
- "bounce-top": o.BOUNCE_TOP,
- "scroll-ended": o.SCROLL_ENDED,
- "touch-up": o.TOUCH_UP,
- "scroll-ended-with-threshold": o.AUTOSCROLL_ENDED_WITH_THRESHOLD,
- "scroll-began": o.SCROLL_BEGAN
- },
- l = cc.Class({
- name: "cc.ScrollView",
- extends: t("./CCViewGroup"),
- editor: !1,
- ctor: function() {
- this._topBoundary = 0, this._bottomBoundary = 0, this._leftBoundary = 0, this._rightBoundary = 0, this._touchMoveDisplacements = [], this._touchMoveTimeDeltas = [], this._touchMovePreviousTimestamp = 0, this._touchMoved = !1, this._autoScrolling = !1, this._autoScrollAttenuate = !1, this._autoScrollStartPosition = cc.v2(0, 0), this._autoScrollTargetDelta = cc.v2(0, 0), this._autoScrollTotalTime = 0, this._autoScrollAccumulatedTime = 0, this._autoScrollCurrentlyOutOfBoundary = !1, this._autoScrollBraking = !1, this._autoScrollBrakingStartPosition = cc.v2(0, 0), this._outOfBoundaryAmount = cc.v2(0, 0), this._outOfBoundaryAmountDirty = !0, this._stopMouseWheel = !1, this._mouseWheelEventElapsedTime = 0, this._isScrollEndedWithThresholdEventFired = !1, this._scrollEventEmitMask = 0, this._isBouncing = !1, this._scrolling = !1
- },
- properties: {
- content: {
- default: void 0,
- type: cc.Node,
- tooltip: !1,
- formerlySerializedAs: "content",
- notify: function(t) {
- this._calculateBoundary()
- }
- },
- horizontal: {
- default: !0,
- animatable: !1,
- tooltip: !1
- },
- vertical: {
- default: !0,
- animatable: !1,
- tooltip: !1
- },
- inertia: {
- default: !0,
- tooltip: !1
- },
- brake: {
- default: .5,
- type: cc.Float,
- range: [0, 1, .1],
- tooltip: !1
- },
- elastic: {
- default: !0,
- animatable: !1,
- tooltip: !1
- },
- bounceDuration: {
- default: 1,
- range: [0, 10],
- tooltip: !1
- },
- horizontalScrollBar: {
- default: void 0,
- type: cc.Scrollbar,
- tooltip: !1,
- notify: function() {
- this.horizontalScrollBar && (this.horizontalScrollBar.setTargetScrollView(this), this._updateScrollBar(0))
- },
- animatable: !1
- },
- verticalScrollBar: {
- default: void 0,
- type: cc.Scrollbar,
- tooltip: !1,
- notify: function() {
- this.verticalScrollBar && (this.verticalScrollBar.setTargetScrollView(this), this._updateScrollBar(0))
- },
- animatable: !1
- },
- scrollEvents: {
- default: [],
- type: cc.Component.EventHandler,
- tooltip: !1
- },
- cancelInnerEvents: {
- default: !0,
- animatable: !1,
- tooltip: !1
- },
- _view: {
- get: function() {
- if (this.content) return this.content.parent
- }
- }
- },
- statics: {
- EventType: o
- },
- scrollToBottom: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(0, 0),
- applyToHorizontal: !1,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i, !0)
- },
- scrollToTop: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(0, 1),
- applyToHorizontal: !1,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToLeft: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(0, 0),
- applyToHorizontal: !0,
- applyToVertical: !1
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToRight: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(1, 0),
- applyToHorizontal: !0,
- applyToVertical: !1
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToTopLeft: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(0, 1),
- applyToHorizontal: !0,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToTopRight: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(1, 1),
- applyToHorizontal: !0,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToBottomLeft: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(0, 0),
- applyToHorizontal: !0,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToBottomRight: function(t, e) {
- var i = this._calculateMovePercentDelta({
- anchor: cc.v2(1, 0),
- applyToHorizontal: !0,
- applyToVertical: !0
- });
- t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
- },
- scrollToOffset: function(t, e, i) {
- var n = this.getMaxScrollOffset(),
- r = cc.v2(0, 0);
- 0 === n.x ? r.x = 0 : r.x = t.x / n.x, 0 === n.y ? r.y = 1 : r.y = (n.y - t.y) / n.y, this.scrollTo(r, e, i)
- },
- getScrollOffset: function() {
- var t = this._getContentTopBoundary() - this._topBoundary,
- e = this._getContentLeftBoundary() - this._leftBoundary;
- return cc.v2(e, t)
- },
- getMaxScrollOffset: function() {
- var t = this._view.getContentSize(),
- e = this.content.getContentSize(),
- i = e.width - t.width,
- n = e.height - t.height;
- return i = i >= 0 ? i : 0, n = n >= 0 ? n : 0, cc.v2(i, n)
- },
- scrollToPercentHorizontal: function(t, e, i) {
- var n = this._calculateMovePercentDelta({
- anchor: cc.v2(t, 0),
- applyToHorizontal: !0,
- applyToVertical: !1
- });
- e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
- },
- scrollTo: function(t, e, i) {
- var n = this._calculateMovePercentDelta({
- anchor: cc.v2(t),
- applyToHorizontal: !0,
- applyToVertical: !0
- });
- e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
- },
- scrollToPercentVertical: function(t, e, i) {
- var n = this._calculateMovePercentDelta({
- anchor: cc.v2(0, t),
- applyToHorizontal: !1,
- applyToVertical: !0
- });
- e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
- },
- stopAutoScroll: function() {
- this._autoScrolling = !1, this._autoScrollAccumulatedTime = this._autoScrollTotalTime
- },
- setContentPosition: function(t) {
- t.fuzzyEquals(this.getContentPosition(), 1e-4) || (this.content.setPosition(t), this._outOfBoundaryAmountDirty = !0)
- },
- getContentPosition: function() {
- return this.content.getPosition()
- },
- isScrolling: function() {
- return this._scrolling
- },
- isAutoScrolling: function() {
- return this._autoScrolling
- },
- _registerEvent: function() {
- this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), this.node.on(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0)
- },
- _unregisterEvent: function() {
- this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), this.node.off(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0)
- },
- _onMouseWheel: function(t, e) {
- if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
- var i = cc.v2(0, 0),
- n = -.1;
- 0, this.vertical ? i = cc.v2(0, t.getScrollY() * n) : this.horizontal && (i = cc.v2(t.getScrollY() * n, 0)), this._mouseWheelEventElapsedTime = 0, this._processDeltaMove(i), this._stopMouseWheel || (this._handlePressLogic(), this.schedule(this._checkMouseWheel, 1 / 60), this._stopMouseWheel = !0), this._stopPropagationIfTargetIsMe(t)
- }
- },
- _checkMouseWheel: function(t) {
- if (!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4)) return this._processInertiaScroll(), this.unschedule(this._checkMouseWheel), void(this._stopMouseWheel = !1);
- this._mouseWheelEventElapsedTime += t, this._mouseWheelEventElapsedTime > .1 && (this._onScrollBarTouchEnded(), this.unschedule(this._checkMouseWheel), this._stopMouseWheel = !1)
- },
- _calculateMovePercentDelta: function(t) {
- var e = t.anchor,
- i = t.applyToHorizontal,
- n = t.applyToVertical;
- this._calculateBoundary(), e = e.clampf(cc.v2(0, 0), cc.v2(1, 1));
- var r = this._view.getContentSize(),
- s = this.content.getContentSize(),
- o = this._getContentBottomBoundary() - this._bottomBoundary;
- o = -o;
- var a = this._getContentLeftBoundary() - this._leftBoundary;
- a = -a;
- var l = cc.v2(0, 0),
- h = 0;
- return i && (h = s.width - r.width, l.x = a - h * e.x), n && (h = s.height - r.height, l.y = o - h * e.y), l
- },
- _moveContentToTopLeft: function(t) {
- var e = this.content.getContentSize(),
- i = this._getContentBottomBoundary() - this._bottomBoundary;
- i = -i;
- var n = cc.v2(0, 0),
- r = 0,
- s = this._getContentLeftBoundary() - this._leftBoundary;
- s = -s, e.height < t.height && (r = e.height - t.height, n.y = i - r), e.width < t.width && (r = e.width - t.width, n.x = s), this._updateScrollBarState(), this._moveContent(n), this._adjustContentOutOfBoundary()
- },
- _calculateBoundary: function() {
- if (this.content) {
- var t = this.content.getComponent(cc.Layout);
- t && t.enabledInHierarchy && t.updateLayout();
- var e = this._view.getContentSize(),
- i = e.width * this._view.anchorX,
- n = e.height * this._view.anchorY;
- this._leftBoundary = -i, this._bottomBoundary = -n, this._rightBoundary = this._leftBoundary + e.width, this._topBoundary = this._bottomBoundary + e.height, this._moveContentToTopLeft(e)
- }
- },
- _hasNestedViewGroup: function(t, e) {
- if (t.eventPhase === cc.Event.CAPTURING_PHASE) {
- if (e)
- for (var i = 0; i < e.length; ++i) {
- var n = e[i];
- if (this.node === n) return !!t.target.getComponent(cc.ViewGroup);
- if (n.getComponent(cc.ViewGroup)) return !0
- }
- return !1
- }
- },
- _stopPropagationIfTargetIsMe: function(t) {
- t.eventPhase === cc.Event.AT_TARGET && t.target === this.node && t.stopPropagation()
- },
- _onTouchBegan: function(t, e) {
- if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
- var i = t.touch;
- this.content && this._handlePressLogic(i), this._touchMoved = !1, this._stopPropagationIfTargetIsMe(t)
- }
- },
- _onTouchMoved: function(t, e) {
- if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
- var i = t.touch;
- if (this.content && this._handleMoveLogic(i), this.cancelInnerEvents) {
- if (i.getLocation().sub(i.getStartLocation()).mag() > 7 && !this._touchMoved && t.target !== this.node) {
- var n = new cc.Event.EventTouch(t.getTouches(), t.bubbles);
- n.type = cc.Node.EventType.TOUCH_CANCEL, n.touch = t.touch, n.simulate = !0, t.target.dispatchEvent(n), this._touchMoved = !0
- }
- this._stopPropagationIfTargetIsMe(t)
- }
- }
- },
- _onTouchEnded: function(t, e) {
- if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
- this._dispatchEvent("touch-up");
- var i = t.touch;
- this.content && this._handleReleaseLogic(i), this._touchMoved ? t.stopPropagation() : this._stopPropagationIfTargetIsMe(t)
- }
- },
- _onTouchCancelled: function(t, e) {
- if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
- if (!t.simulate) {
- var i = t.touch;
- this.content && this._handleReleaseLogic(i)
- }
- this._stopPropagationIfTargetIsMe(t)
- }
- },
- _processDeltaMove: function(t) {
- this._scrollChildren(t), this._gatherTouchMove(t)
- },
- _handleMoveLogic: function(t) {
- var e = t.getDelta();
- this._processDeltaMove(e)
- },
- _scrollChildren: function(t) {
- var e = t = this._clampDelta(t),
- i = void 0;
- this.elastic && (i = this._getHowMuchOutOfBoundary(), e.x *= 0 === i.x ? 1 : .5, e.y *= 0 === i.y ? 1 : .5), this.elastic || (i = this._getHowMuchOutOfBoundary(e), e = e.add(i));
- var n = -1;
- if (e.y > 0) this.content.y - this.content.anchorY * this.content.height + e.y > this._bottomBoundary && (n = "scroll-to-bottom");
- else if (e.y < 0) {
- this.content.y - this.content.anchorY * this.content.height + this.content.height + e.y <= this._topBoundary && (n = "scroll-to-top")
- }
- if (e.x < 0) this.content.x - this.content.anchorX * this.content.width + this.content.width + e.x <= this._rightBoundary && (n = "scroll-to-right");
- else if (e.x > 0) {
- this.content.x - this.content.anchorX * this.content.width + e.x >= this._leftBoundary && (n = "scroll-to-left")
- }
- this._moveContent(e, !1), 0 === e.x && 0 === e.y || (this._scrolling || (this._scrolling = !0, this._dispatchEvent("scroll-began")), this._dispatchEvent("scrolling")), -1 !== n && this._dispatchEvent(n)
- },
- _handlePressLogic: function() {
- this._autoScrolling && this._dispatchEvent("scroll-ended"), this._autoScrolling = !1, this._isBouncing = !1, this._touchMovePreviousTimestamp = s(), this._touchMoveDisplacements.length = 0, this._touchMoveTimeDeltas.length = 0, this._onScrollBarTouchBegan()
- },
- _clampDelta: function(t) {
- var e = this.content.getContentSize(),
- i = this._view.getContentSize();
- return e.width < i.width && (t.x = 0), e.height < i.height && (t.y = 0), t
- },
- _gatherTouchMove: function(t) {
- for (t = this._clampDelta(t); this._touchMoveDisplacements.length >= 5;) this._touchMoveDisplacements.shift(), this._touchMoveTimeDeltas.shift();
- this._touchMoveDisplacements.push(t);
- var e = s();
- this._touchMoveTimeDeltas.push((e - this._touchMovePreviousTimestamp) / 1e3), this._touchMovePreviousTimestamp = e
- },
- _startBounceBackIfNeeded: function() {
- if (!this.elastic) return !1;
- var t = this._getHowMuchOutOfBoundary();
- if ((t = this._clampDelta(t)).fuzzyEquals(cc.v2(0, 0), 1e-4)) return !1;
- var e = Math.max(this.bounceDuration, 0);
- return this._startAutoScroll(t, e, !0), this._isBouncing || (t.y > 0 && this._dispatchEvent("bounce-top"), t.y < 0 && this._dispatchEvent("bounce-bottom"), t.x > 0 && this._dispatchEvent("bounce-right"), t.x < 0 && this._dispatchEvent("bounce-left"), this._isBouncing = !0), !0
- },
- _processInertiaScroll: function() {
- if (!this._startBounceBackIfNeeded() && this.inertia) {
- var t = this._calculateTouchMoveVelocity();
- !t.fuzzyEquals(cc.v2(0, 0), 1e-4) && this.brake < 1 && this._startInertiaScroll(t)
- }
- this._onScrollBarTouchEnded()
- },
- _handleReleaseLogic: function(t) {
- var e = t.getDelta();
- this._gatherTouchMove(e), this._processInertiaScroll(), this._scrolling && (this._scrolling = !1, this._autoScrolling || this._dispatchEvent("scroll-ended"))
- },
- _isOutOfBoundary: function() {
- return !this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4)
- },
- _isNecessaryAutoScrollBrake: function() {
- if (this._autoScrollBraking) return !0;
- if (this._isOutOfBoundary()) {
- if (!this._autoScrollCurrentlyOutOfBoundary) return this._autoScrollCurrentlyOutOfBoundary = !0, this._autoScrollBraking = !0, this._autoScrollBrakingStartPosition = this.getContentPosition(), !0
- } else this._autoScrollCurrentlyOutOfBoundary = !1;
- return !1
- },
- getScrollEndedEventTiming: function() {
- return 1e-4
- },
- _processAutoScrolling: function(t) {
- var e = this._isNecessaryAutoScrollBrake(),
- i = e ? .05 : 1;
- this._autoScrollAccumulatedTime += t * (1 / i);
- var n = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
- this._autoScrollAttenuate && (n = r(n));
- var s = this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(n)),
- o = Math.abs(n - 1) <= 1e-4;
- if (Math.abs(n - 1) <= this.getScrollEndedEventTiming() && !this._isScrollEndedWithThresholdEventFired && (this._dispatchEvent("scroll-ended-with-threshold"), this._isScrollEndedWithThresholdEventFired = !0), this.elastic) {
- var a = s.sub(this._autoScrollBrakingStartPosition);
- e && (a = a.mul(i)), s = this._autoScrollBrakingStartPosition.add(a)
- } else {
- var l = s.sub(this.getContentPosition()),
- h = this._getHowMuchOutOfBoundary(l);
- h.fuzzyEquals(cc.v2(0, 0), 1e-4) || (s = s.add(h), o = !0)
- }
- o && (this._autoScrolling = !1);
- var c = s.sub(this.getContentPosition());
- this._moveContent(this._clampDelta(c), o), this._dispatchEvent("scrolling"), this._autoScrolling || (this._isBouncing = !1, this._scrolling = !1, this._dispatchEvent("scroll-ended"))
- },
- _startInertiaScroll: function(t) {
- var e = t.mul(.7);
- this._startAttenuatingAutoScroll(e, t)
- },
- _calculateAttenuatedFactor: function(t) {
- return this.brake <= 0 ? 1 - this.brake : (1 - this.brake) * (1 / (1 + 14e-6 * t + t * t * 8e-9))
- },
- _startAttenuatingAutoScroll: function(t, e) {
- var i = this._calculateAutoScrollTimeByInitalSpeed(e.mag()),
- n = t.normalize(),
- r = this.content.getContentSize(),
- s = this._view.getContentSize(),
- o = r.width - s.width,
- a = r.height - s.height,
- l = this._calculateAttenuatedFactor(o),
- h = this._calculateAttenuatedFactor(a);
- n = cc.v2(n.x * o * (1 - this.brake) * l, n.y * a * h * (1 - this.brake));
- var c = t.mag(),
- u = n.mag() / c;
- n = n.add(t), this.brake > 0 && u > 7 && (u = Math.sqrt(u), n = t.mul(u).add(t)), this.brake > 0 && u > 3 && (i *= u = 3), 0 === this.brake && u > 1 && (i *= u), this._startAutoScroll(n, i, !0)
- },
- _calculateAutoScrollTimeByInitalSpeed: function(t) {
- return Math.sqrt(Math.sqrt(t / 5))
- },
- _startAutoScroll: function(t, e, i) {
- var n = this._flattenVectorByDirection(t);
- this._autoScrolling = !0, this._autoScrollTargetDelta = n, this._autoScrollAttenuate = i, this._autoScrollStartPosition = this.getContentPosition(), this._autoScrollTotalTime = e, this._autoScrollAccumulatedTime = 0, this._autoScrollBraking = !1, this._isScrollEndedWithThresholdEventFired = !1, this._autoScrollBrakingStartPosition = cc.v2(0, 0), this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4) || (this._autoScrollCurrentlyOutOfBoundary = !0)
- },
- _calculateTouchMoveVelocity: function() {
- var t = 0;
- if ((t = this._touchMoveTimeDeltas.reduce((function(t, e) {
- return t + e
- }), t)) <= 0 || t >= .5) return cc.v2(0, 0);
- var e = cc.v2(0, 0);
- return e = this._touchMoveDisplacements.reduce((function(t, e) {
- return t.add(e)
- }), e), cc.v2(e.x * (1 - this.brake) / t, e.y * (1 - this.brake) / t)
- },
- _flattenVectorByDirection: function(t) {
- var e = t;
- return e.x = this.horizontal ? e.x : 0, e.y = this.vertical ? e.y : 0, e
- },
- _moveContent: function(t, e) {
- var i = this._flattenVectorByDirection(t),
- n = this.getContentPosition().add(i);
- this.setContentPosition(n);
- var r = this._getHowMuchOutOfBoundary();
- this._updateScrollBar(r), this.elastic && e && this._startBounceBackIfNeeded()
- },
- _getContentLeftBoundary: function() {
- return this.getContentPosition().x - this.content.getAnchorPoint().x * this.content.getContentSize().width
- },
- _getContentRightBoundary: function() {
- var t = this.content.getContentSize();
- return this._getContentLeftBoundary() + t.width
- },
- _getContentTopBoundary: function() {
- var t = this.content.getContentSize();
- return this._getContentBottomBoundary() + t.height
- },
- _getContentBottomBoundary: function() {
- return this.getContentPosition().y - this.content.getAnchorPoint().y * this.content.getContentSize().height
- },
- _getHowMuchOutOfBoundary: function(t) {
- if ((t = t || cc.v2(0, 0)).fuzzyEquals(cc.v2(0, 0), 1e-4) && !this._outOfBoundaryAmountDirty) return this._outOfBoundaryAmount;
- var e = cc.v2(0, 0);
- return this._getContentLeftBoundary() + t.x > this._leftBoundary ? e.x = this._leftBoundary - (this._getContentLeftBoundary() + t.x) : this._getContentRightBoundary() + t.x < this._rightBoundary && (e.x = this._rightBoundary - (this._getContentRightBoundary() + t.x)), this._getContentTopBoundary() + t.y < this._topBoundary ? e.y = this._topBoundary - (this._getContentTopBoundary() + t.y) : this._getContentBottomBoundary() + t.y > this._bottomBoundary && (e.y = this._bottomBoundary - (this._getContentBottomBoundary() + t.y)), t.fuzzyEquals(cc.v2(0, 0), 1e-4) && (this._outOfBoundaryAmount = e, this._outOfBoundaryAmountDirty = !1), e = this._clampDelta(e)
- },
- _updateScrollBarState: function() {
- if (this.content) {
- var t = this.content.getContentSize(),
- e = this._view.getContentSize();
- this.verticalScrollBar && (t.height < e.height ? this.verticalScrollBar.hide() : this.verticalScrollBar.show()), this.horizontalScrollBar && (t.width < e.width ? this.horizontalScrollBar.hide() : this.horizontalScrollBar.show())
- }
- },
- _updateScrollBar: function(t) {
- this.horizontalScrollBar && this.horizontalScrollBar._onScroll(t), this.verticalScrollBar && this.verticalScrollBar._onScroll(t)
- },
- _onScrollBarTouchBegan: function() {
- this.horizontalScrollBar && this.horizontalScrollBar._onTouchBegan(), this.verticalScrollBar && this.verticalScrollBar._onTouchBegan()
- },
- _onScrollBarTouchEnded: function() {
- this.horizontalScrollBar && this.horizontalScrollBar._onTouchEnded(), this.verticalScrollBar && this.verticalScrollBar._onTouchEnded()
- },
- _dispatchEvent: function(t) {
- if ("scroll-ended" === t) this._scrollEventEmitMask = 0;
- else if ("scroll-to-top" === t || "scroll-to-bottom" === t || "scroll-to-left" === t || "scroll-to-right" === t) {
- var e = 1 << a[t];
- if (this._scrollEventEmitMask & e) return;
- this._scrollEventEmitMask |= e
- }
- cc.Component.EventHandler.emitEvents(this.scrollEvents, this, a[t]), this.node.emit(t, this)
- },
- _adjustContentOutOfBoundary: function() {
- if (this._outOfBoundaryAmountDirty = !0, this._isOutOfBoundary()) {
- var t = this._getHowMuchOutOfBoundary(cc.v2(0, 0)),
- e = this.getContentPosition().add(t);
- this.content && (this.content.setPosition(e), this._updateScrollBar(0))
- }
- },
- start: function() {
- this._calculateBoundary(), this.content && cc.director.once(cc.Director.EVENT_BEFORE_DRAW, this._adjustContentOutOfBoundary, this)
- },
- _hideScrollbar: function() {
- this.horizontalScrollBar && this.horizontalScrollBar.hide(), this.verticalScrollBar && this.verticalScrollBar.hide()
- },
- onDisable: function() {
- this._unregisterEvent(), this.content && (this.content.off(n.SIZE_CHANGED, this._calculateBoundary, this), this.content.off(n.SCALE_CHANGED, this._calculateBoundary, this), this._view && (this._view.off(n.POSITION_CHANGED, this._calculateBoundary, this), this._view.off(n.SCALE_CHANGED, this._calculateBoundary, this), this._view.off(n.SIZE_CHANGED, this._calculateBoundary, this))), this._hideScrollbar(), this.stopAutoScroll()
- },
- onEnable: function() {
- this._registerEvent(), this.content && (this.content.on(n.SIZE_CHANGED, this._calculateBoundary, this), this.content.on(n.SCALE_CHANGED, this._calculateBoundary, this), this._view && (this._view.on(n.POSITION_CHANGED, this._calculateBoundary, this), this._view.on(n.SCALE_CHANGED, this._calculateBoundary, this), this._view.on(n.SIZE_CHANGED, this._calculateBoundary, this))), this._updateScrollBarState()
- },
- update: function(t) {
- this._autoScrolling && this._processAutoScrolling(t)
- }
- });
- cc.ScrollView = e.exports = l
- }), {
- "../CCNode": 52,
- "./CCViewGroup": 116
- }],
- 110: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc"),
- r = t("./CCComponent"),
- s = cc.Enum({
- Horizontal: 0,
- Vertical: 1
- }),
- o = cc.Class({
- name: "cc.Slider",
- extends: r,
- editor: !1,
- ctor: function() {
- this._offset = cc.v2(), this._touchHandle = !1, this._dragging = !1
- },
- properties: {
- handle: {
- default: null,
- type: cc.Button,
- tooltip: !1,
- notify: function() {
- 0
- }
- },
- direction: {
- default: s.Horizontal,
- type: s,
- tooltip: !1
- },
- progress: {
- default: .5,
- type: cc.Float,
- range: [0, 1, .1],
- slide: !0,
- tooltip: !1,
- notify: function() {
- this._updateHandlePosition()
- }
- },
- slideEvents: {
- default: [],
- type: cc.Component.EventHandler,
- tooltip: !1
- }
- },
- statics: {
- Direction: s
- },
- __preload: function() {
- this._updateHandlePosition()
- },
- onEnable: function() {
- this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), this.handle && this.handle.isValid && (this.handle.node.on(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), this.handle.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.handle.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this))
- },
- onDisable: function() {
- this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), this.handle && this.handle.isValid && (this.handle.node.off(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), this.handle.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.handle.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this))
- },
- _onHandleDragStart: function(t) {
- this._dragging = !0, this._touchHandle = !0, this._offset = this.handle.node.convertToNodeSpaceAR(t.touch.getLocation()), t.stopPropagation()
- },
- _onTouchBegan: function(t) {
- this.handle && (this._dragging = !0, this._touchHandle || this._handleSliderLogic(t.touch), t.stopPropagation())
- },
- _onTouchMoved: function(t) {
- this._dragging && (this._handleSliderLogic(t.touch), t.stopPropagation())
- },
- _onTouchEnded: function(t) {
- this._dragging = !1, this._touchHandle = !1, this._offset = cc.v2(), t.stopPropagation()
- },
- _onTouchCancelled: function(t) {
- this._dragging = !1, t.stopPropagation()
- },
- _handleSliderLogic: function(t) {
- this._updateProgress(t), this._emitSlideEvent()
- },
- _emitSlideEvent: function() {
- cc.Component.EventHandler.emitEvents(this.slideEvents, this), this.node.emit("slide", this)
- },
- _updateProgress: function(t) {
- if (this.handle) {
- var e = this.node,
- i = e.convertToNodeSpaceAR(t.getLocation());
- this.direction === s.Horizontal ? this.progress = n.clamp01((i.x - this._offset.x + e.anchorX * e.width) / e.width) : this.progress = n.clamp01((i.y - this._offset.y + e.anchorY * e.height) / e.height)
- }
- },
- _updateHandlePosition: function() {
- if (this.handle) {
- var t;
- t = this.direction === s.Horizontal ? cc.v2(-this.node.width * this.node.anchorX + this.progress * this.node.width, 0) : cc.v2(0, -this.node.height * this.node.anchorY + this.progress * this.node.height);
- var e = this.node.convertToWorldSpaceAR(t);
- this.handle.node.position = this.handle.node.parent.convertToNodeSpaceAR(e)
- }
- }
- });
- cc.Slider = e.exports = o
- }), {
- "../utils/misc": 300,
- "./CCComponent": 95
- }],
- 111: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc"),
- r = (t("../CCNode").EventType, t("./CCRenderComponent")),
- s = t("../utils/blend-func"),
- o = (t("../renderer/render-flow"), t("../assets/material/CCMaterial")),
- a = cc.Enum({
- SIMPLE: 0,
- SLICED: 1,
- TILED: 2,
- FILLED: 3,
- MESH: 4
- }),
- l = cc.Enum({
- HORIZONTAL: 0,
- VERTICAL: 1,
- RADIAL: 2
- }),
- h = cc.Enum({
- CUSTOM: 0,
- TRIMMED: 1,
- RAW: 2
- }),
- c = cc.Enum({
- NORMAL: 0,
- GRAY: 1
- }),
- u = cc.Class({
- name: "cc.Sprite",
- extends: r,
- mixins: [s],
- editor: !1,
- ctor: function() {
- cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._activateMaterial = this._activateMaterialCanvas : this._activateMaterial = this._activateMaterialWebgl
- },
- properties: {
- _spriteFrame: {
- default: null,
- type: cc.SpriteFrame
- },
- _type: a.SIMPLE,
- _sizeMode: h.TRIMMED,
- _fillType: 0,
- _fillCenter: cc.v2(0, 0),
- _fillStart: 0,
- _fillRange: 0,
- _isTrimmedMode: !0,
- _atlas: {
- default: null,
- type: cc.SpriteAtlas,
- tooltip: !1,
- editorOnly: !0,
- visible: !0,
- animatable: !1
- },
- spriteFrame: {
- get: function() {
- return this._spriteFrame
- },
- set: function(t, e) {
- var i = this._spriteFrame;
- i !== t && (this._spriteFrame = t, this.markForUpdateRenderData(!1), this._applySpriteFrame(i))
- },
- type: cc.SpriteFrame
- },
- type: {
- get: function() {
- return this._type
- },
- set: function(t) {
- this._type !== t && (this._type = t, this._resetAssembler())
- },
- type: a,
- animatable: !1,
- tooltip: !1
- },
- fillType: {
- get: function() {
- return this._fillType
- },
- set: function(t) {
- t !== this._fillType && (this._fillType = t, this._resetAssembler())
- },
- type: l,
- tooltip: !1
- },
- fillCenter: {
- get: function() {
- return this._fillCenter
- },
- set: function(t) {
- this._fillCenter.x = t.x, this._fillCenter.y = t.y, this._type === a.FILLED && this.setVertsDirty()
- },
- tooltip: !1
- },
- fillStart: {
- get: function() {
- return this._fillStart
- },
- set: function(t) {
- this._fillStart = n.clampf(t, -1, 1), this._type === a.FILLED && this.setVertsDirty()
- },
- tooltip: !1
- },
- fillRange: {
- get: function() {
- return this._fillRange
- },
- set: function(t) {
- this._fillRange = n.clampf(t, -1, 1), this._type === a.FILLED && this.setVertsDirty()
- },
- tooltip: !1
- },
- trim: {
- get: function() {
- return this._isTrimmedMode
- },
- set: function(t) {
- this._isTrimmedMode !== t && (this._isTrimmedMode = t, this._type !== a.SIMPLE && this._type !== a.MESH || this.setVertsDirty())
- },
- animatable: !1,
- tooltip: !1
- },
- sizeMode: {
- get: function() {
- return this._sizeMode
- },
- set: function(t) {
- this._sizeMode = t, t !== h.CUSTOM && this._applySpriteSize()
- },
- animatable: !1,
- type: h,
- tooltip: !1
- }
- },
- statics: {
- FillType: l,
- Type: a,
- SizeMode: h,
- State: c
- },
- setVisible: function(t) {
- this.enabled = t
- },
- setState: function() {},
- getState: function() {},
- onEnable: function() {
- this._super(), this._spriteFrame && this._spriteFrame.textureLoaded() ? this._activateMaterial() : (this.disableRender(), this._spriteFrame && (this._spriteFrame.once("load", this._onTextureLoaded, this), this._spriteFrame.ensureLoadTexture()))
- },
- _on3DNodeChanged: function() {
- this._resetAssembler()
- },
- _activateMaterialCanvas: function() {
- this.setVertsDirty(), this.markForUpdateRenderData(!0), this.markForRender(!0)
- },
- _activateMaterialWebgl: function() {
- var t = this._spriteFrame;
- if (t && t.textureLoaded()) {
- var e = this.sharedMaterials[0];
- (e = e ? o.getInstantiatedMaterial(e, this) : o.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", t.getTexture()), this.setVertsDirty(), this.setMaterial(0, e), this.markForRender(!0)
- } else this.disableRender()
- },
- _applyAtlas: !1,
- _canRender: function() {
- if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
- if (!this._enabled) return !1
- } else if (!this._enabled || !this.sharedMaterials[0] || !this.node._activeInHierarchy) return !1;
- var t = this._spriteFrame;
- return !(!t || !t.textureLoaded())
- },
- _applySpriteSize: function() {
- if (this._spriteFrame) {
- if (h.RAW === this._sizeMode) {
- var t = this._spriteFrame._originalSize;
- this.node.setContentSize(t)
- } else if (h.TRIMMED === this._sizeMode) {
- var e = this._spriteFrame._rect;
- this.node.setContentSize(e.width, e.height)
- }
- this.setVertsDirty(), this._activateMaterial()
- }
- },
- _onTextureLoaded: function() {
- this.isValid && this._applySpriteSize()
- },
- _applySpriteFrame: function(t) {
- t && !t.textureLoaded() && t.off("load", this._onTextureLoaded, this);
- var e = this._spriteFrame;
- e ? e.textureLoaded() ? this._applySpriteSize() : (this.markForRender(!1), e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()) : this.markForRender(!1)
- },
- _resized: !1
- });
- cc.Sprite = e.exports = u
- }), {
- "../CCNode": 52,
- "../assets/material/CCMaterial": 75,
- "../renderer/render-flow": 248,
- "../utils/blend-func": 293,
- "../utils/misc": 300,
- "./CCRenderComponent": 106
- }],
- 112: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- NONE: 0,
- CHECKBOX: 1,
- TEXT_ATLAS: 2,
- SLIDER_BAR: 3,
- LIST_VIEW: 4,
- PAGE_VIEW: 5
- }),
- r = cc.Enum({
- VERTICAL: 0,
- HORIZONTAL: 1
- }),
- s = cc.Enum({
- TOP: 0,
- CENTER: 1,
- BOTTOM: 2
- }),
- o = cc.Enum({
- LEFT: 0,
- CENTER: 1,
- RIGHT: 2
- }),
- a = cc.Class({
- name: "cc.StudioComponent",
- extends: cc.Component,
- editor: !1,
- properties: !1,
- statics: {
- ComponentType: n,
- ListDirection: r,
- VerticalAlign: s,
- HorizontalAlign: o
- }
- }),
- l = t("../utils/prefab-helper");
- a.PlaceHolder = cc.Class({
- name: "cc.StudioComponent.PlaceHolder",
- extends: cc.Component,
- properties: {
- _baseUrl: "",
- nestedPrefab: cc.Prefab
- },
- onLoad: function() {
- this.nestedPrefab && this._replaceWithNestedPrefab()
- },
- _replaceWithNestedPrefab: function() {
- var t = this.node,
- e = t._prefab;
- e.root = t, e.asset = this.nestedPrefab, l.syncWithPrefab(t)
- }
- }), cc.StudioComponent = e.exports = a;
- var h = cc.Class({
- name: "cc.StudioWidget",
- extends: cc.Widget,
- editor: !1,
- _validateTargetInDEV: function() {}
- });
- cc.StudioWidget = e.exports = h
- }), {
- "../utils/prefab-helper": 303
- }],
- 113: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/gray-sprite-state"),
- r = cc.Class({
- name: "cc.Toggle",
- extends: t("./CCButton"),
- mixins: [n],
- editor: !1,
- properties: {
- _N$isChecked: !0,
- isChecked: {
- get: function() {
- return this._N$isChecked
- },
- set: function(t) {
- if (t !== this._N$isChecked) {
- var e = this.toggleGroup || this._toggleContainer;
- e && e.enabled && this._N$isChecked && !e.allowSwitchOff || (this._N$isChecked = t, this._updateCheckMark(), e && e.enabled && e.updateToggles(this), this._emitToggleEvents())
- }
- },
- tooltip: !1
- },
- toggleGroup: {
- default: null,
- tooltip: !1,
- type: t("./CCToggleGroup")
- },
- checkMark: {
- default: null,
- type: cc.Sprite,
- tooltip: !1
- },
- checkEvents: {
- default: [],
- type: cc.Component.EventHandler
- },
- _resizeToTarget: {
- animatable: !1,
- set: function(t) {
- t && this._resizeNodeToTargetNode()
- }
- }
- },
- onEnable: function() {
- this._super(), this._registerToggleEvent(), this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.addToggle(this)
- },
- onDisable: function() {
- this._super(), this._unregisterToggleEvent(), this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.removeToggle(this)
- },
- _hideCheckMark: function() {
- this._N$isChecked = !1, this._updateCheckMark()
- },
- toggle: function(t) {
- this.isChecked = !this.isChecked
- },
- check: function() {
- this.isChecked = !0
- },
- uncheck: function() {
- this.isChecked = !1
- },
- _updateCheckMark: function() {
- this.checkMark && (this.checkMark.node.active = !!this.isChecked)
- },
- _updateDisabledState: function() {
- if (this._super(), this.enableAutoGrayEffect && this.checkMark) {
- var t = !this.interactable;
- this._switchGrayMaterial(t, this.checkMark)
- }
- },
- _registerToggleEvent: function() {
- this.node.on("click", this.toggle, this)
- },
- _unregisterToggleEvent: function() {
- this.node.off("click", this.toggle, this)
- },
- _emitToggleEvents: function() {
- this.node.emit("toggle", this), this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, this)
- }
- });
- cc.Toggle = e.exports = r, t("../platform/js").get(r.prototype, "_toggleContainer", (function() {
- var t = this.node.parent;
- return cc.Node.isNode(t) ? t.getComponent(cc.ToggleContainer) : null
- }))
- }), {
- "../platform/js": 218,
- "../utils/gray-sprite-state": 296,
- "./CCButton": 93,
- "./CCToggleGroup": 115
- }],
- 114: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.ToggleContainer",
- extends: cc.Component,
- editor: !1,
- properties: {
- allowSwitchOff: {
- tooltip: !1,
- default: !1
- },
- checkEvents: {
- default: [],
- type: cc.Component.EventHandler
- }
- },
- updateToggles: function(t) {
- this.enabledInHierarchy && t.isChecked && (this.toggleItems.forEach((function(e) {
- e !== t && e.isChecked && e.enabled && e._hideCheckMark()
- })), this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, t))
- },
- _allowOnlyOneToggleChecked: function() {
- var t = !1;
- return this.toggleItems.forEach((function(e) {
- t ? e._hideCheckMark() : e.isChecked && (t = !0)
- })), t
- },
- _makeAtLeastOneToggleChecked: function() {
- if (!this._allowOnlyOneToggleChecked() && !this.allowSwitchOff) {
- var t = this.toggleItems;
- t.length > 0 && t[0].check()
- }
- },
- onEnable: function() {
- this.node.on("child-added", this._allowOnlyOneToggleChecked, this), this.node.on("child-removed", this._makeAtLeastOneToggleChecked, this)
- },
- onDisable: function() {
- this.node.off("child-added", this._allowOnlyOneToggleChecked, this), this.node.off("child-removed", this._makeAtLeastOneToggleChecked, this)
- },
- start: function() {
- this._makeAtLeastOneToggleChecked()
- }
- });
- t("../platform/js").get(n.prototype, "toggleItems", (function() {
- return this.node.getComponentsInChildren(cc.Toggle)
- })), cc.ToggleContainer = e.exports = n
- }), {
- "../platform/js": 218
- }],
- 115: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.ToggleGroup",
- extends: cc.Component,
- ctor: function() {
- this._toggleItems = []
- },
- editor: !1,
- properties: {
- allowSwitchOff: {
- tooltip: !1,
- default: !1
- },
- toggleItems: {
- get: function() {
- return this._toggleItems
- }
- }
- },
- updateToggles: function(t) {
- this.enabledInHierarchy && this._toggleItems.forEach((function(e) {
- t.isChecked && e !== t && e.isChecked && e.enabled && e._hideCheckMark()
- }))
- },
- addToggle: function(t) {
- -1 === this._toggleItems.indexOf(t) && this._toggleItems.push(t), this._allowOnlyOneToggleChecked()
- },
- removeToggle: function(t) {
- var e = this._toggleItems.indexOf(t);
- e > -1 && this._toggleItems.splice(e, 1), this._makeAtLeastOneToggleChecked()
- },
- _allowOnlyOneToggleChecked: function() {
- var t = !1;
- return this._toggleItems.forEach((function(e) {
- t && e.enabled && e._hideCheckMark(), e.isChecked && e.enabled && (t = !0)
- })), t
- },
- _makeAtLeastOneToggleChecked: function() {
- this._allowOnlyOneToggleChecked() || this.allowSwitchOff || this._toggleItems.length > 0 && (this._toggleItems[0].isChecked = !0)
- },
- start: function() {
- this._makeAtLeastOneToggleChecked()
- }
- }),
- r = !1;
- t("../platform/js").get(cc, "ToggleGroup", (function() {
- return r || (cc.logID(1405, "cc.ToggleGroup", "cc.ToggleContainer"), r = !0), n
- })), e.exports = n
- }), {
- "../platform/js": 218
- }],
- 116: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.ViewGroup",
- extends: t("./CCComponent")
- });
- cc.ViewGroup = e.exports = n
- }), {
- "./CCComponent": 95
- }],
- 117: [(function(t, e, i) {
- "use strict";
- var n = t("../base-ui/CCWidgetManager"),
- r = n.AlignMode,
- s = n._AlignFlags,
- o = s.TOP,
- a = s.MID,
- l = s.BOT,
- h = s.LEFT,
- c = s.CENTER,
- u = s.RIGHT,
- _ = o | l,
- f = h | u,
- d = cc.Class({
- name: "cc.Widget",
- extends: t("./CCComponent"),
- editor: !1,
- properties: {
- target: {
- get: function() {
- return this._target
- },
- set: function(t) {
- this._target = t
- },
- type: cc.Node,
- tooltip: !1
- },
- isAlignTop: {
- get: function() {
- return (this._alignFlags & o) > 0
- },
- set: function(t) {
- this._setAlign(o, t)
- },
- animatable: !1,
- tooltip: !1
- },
- isAlignVerticalCenter: {
- get: function() {
- return (this._alignFlags & a) > 0
- },
- set: function(t) {
- t ? (this.isAlignTop = !1, this.isAlignBottom = !1, this._alignFlags |= a) : this._alignFlags &= ~a
- },
- animatable: !1,
- tooltip: !1
- },
- isAlignBottom: {
- get: function() {
- return (this._alignFlags & l) > 0
- },
- set: function(t) {
- this._setAlign(l, t)
- },
- animatable: !1,
- tooltip: !1
- },
- isAlignLeft: {
- get: function() {
- return (this._alignFlags & h) > 0
- },
- set: function(t) {
- this._setAlign(h, t)
- },
- animatable: !1,
- tooltip: !1
- },
- isAlignHorizontalCenter: {
- get: function() {
- return (this._alignFlags & c) > 0
- },
- set: function(t) {
- t ? (this.isAlignLeft = !1, this.isAlignRight = !1, this._alignFlags |= c) : this._alignFlags &= ~c
- },
- animatable: !1,
- tooltip: !1
- },
- isAlignRight: {
- get: function() {
- return (this._alignFlags & u) > 0
- },
- set: function(t) {
- this._setAlign(u, t)
- },
- animatable: !1,
- tooltip: !1
- },
- isStretchWidth: {
- get: function() {
- return (this._alignFlags & f) === f
- },
- visible: !1
- },
- isStretchHeight: {
- get: function() {
- return (this._alignFlags & _) === _
- },
- visible: !1
- },
- top: {
- get: function() {
- return this._top
- },
- set: function(t) {
- this._top = t
- },
- tooltip: !1
- },
- bottom: {
- get: function() {
- return this._bottom
- },
- set: function(t) {
- this._bottom = t
- },
- tooltip: !1
- },
- left: {
- get: function() {
- return this._left
- },
- set: function(t) {
- this._left = t
- },
- tooltip: !1
- },
- right: {
- get: function() {
- return this._right
- },
- set: function(t) {
- this._right = t
- },
- tooltip: !1
- },
- horizontalCenter: {
- get: function() {
- return this._horizontalCenter
- },
- set: function(t) {
- this._horizontalCenter = t
- },
- tooltip: !1
- },
- verticalCenter: {
- get: function() {
- return this._verticalCenter
- },
- set: function(t) {
- this._verticalCenter = t
- },
- tooltip: !1
- },
- isAbsoluteHorizontalCenter: {
- get: function() {
- return this._isAbsHorizontalCenter
- },
- set: function(t) {
- this._isAbsHorizontalCenter = t
- },
- animatable: !1
- },
- isAbsoluteVerticalCenter: {
- get: function() {
- return this._isAbsVerticalCenter
- },
- set: function(t) {
- this._isAbsVerticalCenter = t
- },
- animatable: !1
- },
- isAbsoluteTop: {
- get: function() {
- return this._isAbsTop
- },
- set: function(t) {
- this._isAbsTop = t
- },
- animatable: !1
- },
- isAbsoluteBottom: {
- get: function() {
- return this._isAbsBottom
- },
- set: function(t) {
- this._isAbsBottom = t
- },
- animatable: !1
- },
- isAbsoluteLeft: {
- get: function() {
- return this._isAbsLeft
- },
- set: function(t) {
- this._isAbsLeft = t
- },
- animatable: !1
- },
- isAbsoluteRight: {
- get: function() {
- return this._isAbsRight
- },
- set: function(t) {
- this._isAbsRight = t
- },
- animatable: !1
- },
- alignMode: {
- default: r.ON_WINDOW_RESIZE,
- type: r,
- tooltip: !1
- },
- _wasAlignOnce: {
- default: void 0,
- formerlySerializedAs: "isAlignOnce"
- },
- _target: null,
- _alignFlags: 0,
- _left: 0,
- _right: 0,
- _top: 0,
- _bottom: 0,
- _verticalCenter: 0,
- _horizontalCenter: 0,
- _isAbsLeft: !0,
- _isAbsRight: !0,
- _isAbsTop: !0,
- _isAbsBottom: !0,
- _isAbsHorizontalCenter: !0,
- _isAbsVerticalCenter: !0,
- _originalWidth: 0,
- _originalHeight: 0
- },
- statics: {
- AlignMode: r
- },
- onLoad: function() {
- void 0 !== this._wasAlignOnce && (this.alignMode = this._wasAlignOnce ? r.ONCE : r.ALWAYS, this._wasAlignOnce = void 0)
- },
- onEnable: function() {
- n.add(this)
- },
- onDisable: function() {
- n.remove(this)
- },
- _validateTargetInDEV: !1,
- _setAlign: function(t, e) {
- if (e !== (this._alignFlags & t) > 0) {
- var i = (t & f) > 0;
- e ? (this._alignFlags |= t, i ? (this.isAlignHorizontalCenter = !1, this.isStretchWidth && (this._originalWidth = this.node.width)) : (this.isAlignVerticalCenter = !1, this.isStretchHeight && (this._originalHeight = this.node.height))) : (i ? this.isStretchWidth && (this.node.width = this._originalWidth) : this.isStretchHeight && (this.node.height = this._originalHeight), this._alignFlags &= ~t)
- }
- },
- updateAlignment: function() {
- n.updateAlignment(this.node)
- }
- });
- Object.defineProperty(d.prototype, "isAlignOnce", {
- get: function() {
- return this.alignMode === r.ONCE
- },
- set: function(t) {
- this.alignMode = t ? r.ONCE : r.ALWAYS
- }
- }), cc.Widget = e.exports = d
- }), {
- "../base-ui/CCWidgetManager": 79,
- "./CCComponent": 95
- }],
- 118: [(function(t, e, i) {
- "use strict";
- var n = t("../../platform/CCMacro"),
- r = t("../editbox/EditBoxImplBase"),
- s = t("../CCLabel"),
- o = t("./types"),
- a = o.InputMode,
- l = o.InputFlag,
- h = o.KeyboardReturnType;
- function c(t) {
- return t.replace(/(?:^|\s)\S/g, (function(t) {
- return t.toUpperCase()
- }))
- }
- function u(t) {
- return t.charAt(0).toUpperCase() + t.slice(1)
- }
- var _ = cc.Class({
- name: "cc.EditBox",
- extends: cc.Component,
- editor: !1,
- properties: {
- _useOriginalSize: !0,
- _string: "",
- string: {
- tooltip: !1,
- get: function() {
- return this._string
- },
- set: function(t) {
- t = "" + t, this.maxLength >= 0 && t.length >= this.maxLength && (t = t.slice(0, this.maxLength)), this._string = t, this._updateString(t)
- }
- },
- textLabel: {
- tooltip: !1,
- default: null,
- type: s,
- notify: function(t) {
- this.textLabel && this.textLabel !== t && (this._updateTextLabel(), this._updateLabels())
- }
- },
- placeholderLabel: {
- tooltip: !1,
- default: null,
- type: s,
- notify: function(t) {
- this.placeholderLabel && this.placeholderLabel !== t && (this._updatePlaceholderLabel(), this._updateLabels())
- }
- },
- background: {
- tooltip: !1,
- default: null,
- type: cc.Sprite,
- notify: function(t) {
- this.background && this.background !== t && this._updateBackgroundSprite()
- }
- },
- _N$backgroundImage: {
- default: void 0,
- type: cc.SpriteFrame
- },
- backgroundImage: {
- get: function() {
- return this.background ? this.background.spriteFrame : null
- },
- set: function(t) {
- this.background && (this.background.spriteFrame = t)
- }
- },
- returnType: {
- default: h.DEFAULT,
- tooltip: !1,
- displayName: "KeyboardReturnType",
- type: h
- },
- _N$returnType: {
- default: void 0,
- type: cc.Float
- },
- inputFlag: {
- tooltip: !1,
- default: l.DEFAULT,
- type: l,
- notify: function() {
- this._updateString(this._string)
- }
- },
- inputMode: {
- tooltip: !1,
- default: a.ANY,
- type: a,
- notify: function(t) {
- this.inputMode !== t && (this._updateTextLabel(), this._updatePlaceholderLabel())
- }
- },
- fontSize: {
- get: function() {
- return this.textLabel ? this.textLabel.fontSize : null
- },
- set: function(t) {
- this.textLabel && (this.textLabel.fontSize = t)
- }
- },
- _N$fontSize: {
- default: void 0,
- type: cc.Float
- },
- lineHeight: {
- get: function() {
- return this.textLabel ? this.textLabel.lineHeight : null
- },
- set: function(t) {
- this.textLabel && (this.textLabel.lineHeight = t)
- }
- },
- _N$lineHeight: {
- default: void 0,
- type: cc.Float
- },
- fontColor: {
- get: function() {
- return this.textLabel ? this.textLabel.node.color : null
- },
- set: function(t) {
- this.textLabel && (this.textLabel.node.color = t, this.textLabel.node.opacity = t.a)
- }
- },
- _N$fontColor: void 0,
- placeholder: {
- tooltip: !1,
- get: function() {
- return this.placeholderLabel ? this.placeholderLabel.string : ""
- },
- set: function(t) {
- this.placeholderLabel && (this.placeholderLabel.string = t)
- }
- },
- _N$placeholder: {
- default: void 0,
- type: cc.String
- },
- placeholderFontSize: {
- get: function() {
- return this.placeholderLabel ? this.placeholderLabel.fontSize : null
- },
- set: function(t) {
- this.placeholderLabel && (this.placeholderLabel.fontSize = t)
- }
- },
- _N$placeholderFontSize: {
- default: void 0,
- type: cc.Float
- },
- placeholderFontColor: {
- get: function() {
- return this.placeholderLabel ? this.placeholderLabel.node.color : null
- },
- set: function(t) {
- this.placeholderLabel && (this.placeholderLabel.node.color = t, this.placeholderLabel.node.opacity = t.a)
- }
- },
- _N$placeholderFontColor: void 0,
- maxLength: {
- tooltip: !1,
- default: 20
- },
- _N$maxLength: {
- default: void 0,
- type: cc.Float
- },
- stayOnTop: {
- default: !1,
- notify: function() {
- cc.warn("editBox.stayOnTop is removed since v2.1.")
- }
- },
- _tabIndex: 0,
- tabIndex: {
- tooltip: !1,
- get: function() {
- return this._tabIndex
- },
- set: function(t) {
- this._tabIndex !== t && (this._tabIndex = t, this._impl && this._impl.setTabIndex(t))
- }
- },
- editingDidBegan: {
- default: [],
- type: cc.Component.EventHandler
- },
- textChanged: {
- default: [],
- type: cc.Component.EventHandler
- },
- editingDidEnded: {
- default: [],
- type: cc.Component.EventHandler
- },
- editingReturn: {
- default: [],
- type: cc.Component.EventHandler
- }
- },
- statics: {
- _ImplClass: r,
- KeyboardReturnType: h,
- InputFlag: l,
- InputMode: a
- },
- _init: function() {
- this._upgradeComp(), this._isLabelVisible = !0, this.node.on(cc.Node.EventType.SIZE_CHANGED, this._syncSize, this), (this._impl = new _._ImplClass).init(this), this._updateString(this._string), this._syncSize()
- },
- _updateBackgroundSprite: function() {
- var t = this.background;
- if (!t) {
- var e = this.node.getChildByName("BACKGROUND_SPRITE");
- e || (e = new cc.Node("BACKGROUND_SPRITE")), (t = e.getComponent(cc.Sprite)) || (t = e.addComponent(cc.Sprite)), e.parent = this.node, this.background = t
- }
- t.type = cc.Sprite.Type.SLICED, void 0 !== this._N$backgroundImage && (t.spriteFrame = this._N$backgroundImage, this._N$backgroundImage = void 0)
- },
- _updateTextLabel: function() {
- var t = this.textLabel;
- if (!t) {
- var e = this.node.getChildByName("TEXT_LABEL");
- e || (e = new cc.Node("TEXT_LABEL")), (t = e.getComponent(s)) || (t = e.addComponent(s)), e.parent = this.node, this.textLabel = t
- }
- t.node.setAnchorPoint(0, 1), t.overflow = s.Overflow.CLAMP, this.inputMode === a.ANY ? (t.verticalAlign = n.VerticalTextAlignment.TOP, t.enableWrapText = !0) : (t.verticalAlign = n.VerticalTextAlignment.CENTER, t.enableWrapText = !1), t.string = this._updateLabelStringStyle(this._string), void 0 !== this._N$fontColor && (t.node.color = this._N$fontColor, t.node.opacity = this._N$fontColor.a, this._N$fontColor = void 0), void 0 !== this._N$fontSize && (t.fontSize = this._N$fontSize, this._N$fontSize = void 0), void 0 !== this._N$lineHeight && (t.lineHeight = this._N$lineHeight, this._N$lineHeight = void 0)
- },
- _updatePlaceholderLabel: function() {
- var t = this.placeholderLabel;
- if (!t) {
- var e = this.node.getChildByName("PLACEHOLDER_LABEL");
- e || (e = new cc.Node("PLACEHOLDER_LABEL")), (t = e.getComponent(s)) || (t = e.addComponent(s)), e.parent = this.node, this.placeholderLabel = t
- }
- t.node.setAnchorPoint(0, 1), t.overflow = s.Overflow.CLAMP, this.inputMode === a.ANY ? (t.verticalAlign = n.VerticalTextAlignment.TOP, t.enableWrapText = !0) : (t.verticalAlign = n.VerticalTextAlignment.CENTER, t.enableWrapText = !1), t.string = this.placeholder, void 0 !== this._N$placeholderFontColor && (t.node.color = this._N$placeholderFontColor, t.node.opacity = this._N$placeholderFontColor.a, this._N$placeholderFontColor = void 0), void 0 !== this._N$placeholderFontSize && (t.fontSize = this._N$placeholderFontSize, this._N$placeholderFontSize = void 0)
- },
- _upgradeComp: function() {
- void 0 !== this._N$returnType && (this.returnType = this._N$returnType, this._N$returnType = void 0), void 0 !== this._N$maxLength && (this.maxLength = this._N$maxLength, this._N$maxLength = void 0), void 0 !== this._N$backgroundImage && this._updateBackgroundSprite(), void 0 === this._N$fontColor && void 0 === this._N$fontSize && void 0 === this._N$lineHeight || this._updateTextLabel(), void 0 === this._N$placeholderFontColor && void 0 === this._N$placeholderFontSize || this._updatePlaceholderLabel(), void 0 !== this._N$placeholder && (this.placeholder = this._N$placeholder, this._N$placeholder = void 0)
- },
- _syncSize: function() {
- if (this._impl) {
- var t = this.node.getContentSize();
- this._impl.setSize(t.width, t.height)
- }
- },
- _showLabels: function() {
- this._isLabelVisible = !0, this._updateLabels()
- },
- _hideLabels: function() {
- this._isLabelVisible = !1, this.textLabel && (this.textLabel.node.active = !1), this.placeholderLabel && (this.placeholderLabel.node.active = !1)
- },
- _updateLabels: function() {
- if (this._isLabelVisible) {
- var t = this._string;
- this.textLabel && (this.textLabel.node.active = "" !== t), this.placeholderLabel && (this.placeholderLabel.node.active = "" === t)
- }
- },
- _updateString: function(t) {
- var e = this.textLabel;
- if (e) {
- var i = t;
- i && (i = this._updateLabelStringStyle(i)), e.string = i, this._updateLabels()
- }
- },
- _updateLabelStringStyle: function(t, e) {
- var i = this.inputFlag;
- if (e || i !== l.PASSWORD) i === l.INITIAL_CAPS_ALL_CHARACTERS ? t = t.toUpperCase() : i === l.INITIAL_CAPS_WORD ? t = c(t) : i === l.INITIAL_CAPS_SENTENCE && (t = u(t));
- else {
- for (var n = "", r = t.length, s = 0; s < r; ++s) n += "\u25cf";
- t = n
- }
- return t
- },
- editBoxEditingDidBegan: function() {
- cc.Component.EventHandler.emitEvents(this.editingDidBegan, this), this.node.emit("editing-did-began", this)
- },
- editBoxEditingDidEnded: function() {
- cc.Component.EventHandler.emitEvents(this.editingDidEnded, this), this.node.emit("editing-did-ended", this)
- },
- editBoxTextChanged: function(t) {
- t = this._updateLabelStringStyle(t, !0), this.string = t, cc.Component.EventHandler.emitEvents(this.textChanged, t, this), this.node.emit("text-changed", this)
- },
- editBoxEditingReturn: function() {
- cc.Component.EventHandler.emitEvents(this.editingReturn, this), this.node.emit("editing-return", this)
- },
- onEnable: function() {
- this._registerEvent(), this._impl && this._impl.enable()
- },
- onDisable: function() {
- this._unregisterEvent(), this._impl && this._impl.disable()
- },
- onDestroy: function() {
- this._impl && this._impl.clear()
- },
- __preload: function() {
- this._init()
- },
- _registerEvent: function() {
- this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)
- },
- _unregisterEvent: function() {
- this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)
- },
- _onTouchBegan: function(t) {
- t.stopPropagation()
- },
- _onTouchCancel: function(t) {
- t.stopPropagation()
- },
- _onTouchEnded: function(t) {
- this._impl && this._impl.beginEditing(), t.stopPropagation()
- },
- setFocus: function() {
- cc.warnID(1400, "setFocus()", "focus()"), this._impl && this._impl.setFocus(!0)
- },
- focus: function() {
- this._impl && this._impl.setFocus(!0)
- },
- blur: function() {
- this._impl && this._impl.setFocus(!1)
- },
- isFocused: function() {
- return !!this._impl && this._impl.isFocused()
- },
- update: function() {
- this._impl && this._impl.update()
- }
- });
- cc.EditBox = e.exports = _, cc.sys.isBrowser && t("./WebEditBoxImpl")
- }), {
- "../../platform/CCMacro": 203,
- "../CCLabel": 97,
- "../editbox/EditBoxImplBase": 119,
- "./WebEditBoxImpl": 120,
- "./types": 122
- }],
- 119: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- ctor: function() {
- this._delegate = null, this._editing = !1
- },
- init: function(t) {},
- enable: function() {},
- disable: function() {
- this._editing && this.endEditing()
- },
- clear: function() {},
- update: function() {},
- setTabIndex: function(t) {},
- setSize: function(t, e) {},
- setFocus: function(t) {
- t ? this.beginEditing() : this.endEditing()
- },
- isFocused: function() {
- return this._editing
- },
- beginEditing: function() {},
- endEditing: function() {}
- });
- e.exports = n
- }), {}],
- 120: [(function(t, e, i) {
- "use strict";
- var n = t("../../platform/utils"),
- r = t("../../platform/CCMacro"),
- s = t("./types"),
- o = t("../CCLabel"),
- a = t("./tabIndexUtil"),
- l = cc.EditBox,
- h = cc.js,
- c = s.InputMode,
- u = s.InputFlag,
- _ = s.KeyboardReturnType,
- f = cc.vmath,
- d = {
- zoomInvalid: !1
- };
- cc.sys.OS_ANDROID !== cc.sys.os || cc.sys.browserType !== cc.sys.BROWSER_TYPE_SOUGOU && cc.sys.browserType !== cc.sys.BROWSER_TYPE_360 || (d.zoomInvalid = !0);
- var p = 0,
- m = cc.v3(),
- y = null,
- v = !1,
- g = !1,
- x = l._ImplClass;
- function b() {
- x.call(this), this._domId = "EditBoxId_" + ++p, this._placeholderStyleSheet = null, this._elem = null, this._isTextArea = !1, this._worldMat = f.mat4.create(), this._cameraMat = f.mat4.create(), this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this._inputMode = null, this._inputFlag = null, this._returnType = null, this._eventListeners = {}, this._textLabelFont = null, this._textLabelFontSize = null, this._textLabelFontColor = null, this._textLabelAlign = null, this._placeholderLabelFont = null, this._placeholderLabelFontSize = null, this._placeholderLabelFontColor = null, this._placeholderLabelAlign = null, this._placeholderLineHeight = null
- }
- h.extend(b, x), l._ImplClass = b, Object.assign(b.prototype, {
- init: function(t) {
- t && (this._delegate = t, t.inputMode === c.ANY ? this._createTextArea() : this._createInput(), a.add(this), this.setTabIndex(t.tabIndex), this._initStyleSheet(), this._registerEventListeners(), this._addDomToGameContainer(), v = cc.view.isAutoFullScreenEnabled(), g = cc.view._resizeWithBrowserSize)
- },
- clear: function() {
- this._removeEventListeners(), this._removeDomFromGameContainer(), a.remove(this), y === this && (y = null)
- },
- update: function() {
- this._updateMatrix()
- },
- setTabIndex: function(t) {
- this._elem.tabIndex = t, a.resort()
- },
- setSize: function(t, e) {
- var i = this._elem;
- i.style.width = t + "px", i.style.height = e + "px"
- },
- beginEditing: function() {
- y && y !== this && y.setFocus(!1), this._editing = !0, y = this, this._delegate.editBoxEditingDidBegan(), this._showDom(), this._elem.focus()
- },
- endEditing: function() {
- this._elem && this._elem.blur()
- },
- _createInput: function() {
- this._isTextArea = !1, this._elem = document.createElement("input")
- },
- _createTextArea: function() {
- this._isTextArea = !0, this._elem = document.createElement("textarea")
- },
- _addDomToGameContainer: function() {
- cc.game.container.appendChild(this._elem), document.head.appendChild(this._placeholderStyleSheet)
- },
- _removeDomFromGameContainer: function() {
- n.contains(cc.game.container, this._elem) && cc.game.container.removeChild(this._elem), n.contains(document.head, this._placeholderStyleSheet) && document.head.removeChild(this._placeholderStyleSheet), delete this._elem, delete this._placeholderStyleSheet
- },
- _showDom: function() {
- this._updateMaxLength(), this._updateInputType(), this._updateStyleSheet(), this._elem.style.display = "", this._delegate._hideLabels(), cc.sys.isMobile && this._showDomOnMobile()
- },
- _hideDom: function() {
- this._elem.style.display = "none", this._delegate._showLabels(), cc.sys.isMobile && this._hideDomOnMobile()
- },
- _showDomOnMobile: function() {
- cc.sys.os === cc.sys.OS_ANDROID && (v && (cc.view.enableAutoFullScreen(!1), cc.screen.exitFullScreen()), g && cc.view.resizeWithBrowserSize(!1), this._adjustWindowScroll())
- },
- _hideDomOnMobile: function() {
- cc.sys.os === cc.sys.OS_ANDROID && setTimeout((function() {
- y || (v && cc.view.enableAutoFullScreen(!0), g && cc.view.resizeWithBrowserSize(!0))
- }), 800), this._scrollBackWindow()
- },
- _adjustWindowScroll: function() {
- var t = this;
- setTimeout((function() {
- window.scrollY < 100 && t._elem.scrollIntoView({
- block: "start",
- inline: "nearest",
- behavior: "smooth"
- })
- }), 800)
- },
- _scrollBackWindow: function() {
- setTimeout((function() {
- var t = cc.sys;
- t.browserType !== t.BROWSER_TYPE_WECHAT || t.os !== t.OS_IOS ? window.scrollTo(0, 0) : window.top && window.top.scrollTo(0, 0)
- }), 800)
- },
- _updateMatrix: function() {
- var t = this._delegate.node;
- t.getWorldMatrix(this._worldMat);
- var e = this._worldMat,
- i = e.m;
- if (this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
- this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
- var n = cc.view._scaleX,
- r = cc.view._scaleY,
- s = cc.view._viewportRect,
- o = cc.view._devicePixelRatio;
- m.x = -t._anchorPoint.x * this._w, m.y = -t._anchorPoint.y * this._h, f.mat4.translate(e, e, m);
- var a = void 0;
- cc.Camera.findCamera(t).getWorldToScreenMatrix2D(this._cameraMat), a = this._cameraMat, f.mat4.mul(a, a, e), n /= o, r /= o;
- var l = cc.game.container,
- h = a.m,
- c = h[0] * n,
- u = h[1],
- _ = h[4],
- p = h[5] * r,
- y = l && l.style.paddingLeft && parseInt(l.style.paddingLeft);
- y += s.x / o;
- var v = l && l.style.paddingBottom && parseInt(l.style.paddingBottom);
- v += s.y / o;
- var g = h[12] * n + y,
- x = h[13] * r + v;
- d.zoomInvalid && (this.setSize(t.width * c, t.height * p), c = 1, p = 1);
- var b = this._elem,
- A = "matrix(" + c + "," + -u + "," + -_ + "," + p + "," + g + "," + -x + ")";
- b.style.transform = A, b.style["-webkit-transform"] = A, b.style["transform-origin"] = "0px 100% 0px", b.style["-webkit-transform-origin"] = "0px 100% 0px"
- }
- },
- _updateInputType: function() {
- var t = this._delegate,
- e = t.inputMode,
- i = t.inputFlag,
- n = t.returnType,
- r = this._elem;
- if (this._inputMode !== e || this._inputFlag !== i || this._returnType !== n) {
- if (this._inputMode = e, this._inputFlag = i, this._returnType = n, this._isTextArea) {
- var s = "none";
- return i === u.INITIAL_CAPS_ALL_CHARACTERS ? s = "uppercase" : i === u.INITIAL_CAPS_WORD && (s = "capitalize"), void(r.style.textTransform = s)
- }
- if (i !== u.PASSWORD) {
- var o = r.type;
- e === c.EMAIL_ADDR ? o = "email" : e === c.NUMERIC || e === c.DECIMAL ? o = "number" : e === c.PHONE_NUMBER ? (o = "number", r.pattern = "[0-9]*") : e === c.URL ? o = "url" : (o = "text", n === _.SEARCH && (o = "search")), r.type = o;
- var a = "none";
- i === u.INITIAL_CAPS_ALL_CHARACTERS ? a = "uppercase" : i === u.INITIAL_CAPS_WORD && (a = "capitalize"), r.style.textTransform = a
- } else r.type = "password"
- }
- },
- _updateMaxLength: function() {
- var t = this._delegate.maxLength;
- t < 0 && (t = 65535), this._elem.maxLength = t
- },
- _initStyleSheet: function() {
- var t = this._elem;
- t.style.display = "none", t.style.border = 0, t.style.background = "transparent", t.style.width = "100%", t.style.height = "100%", t.style.active = 0, t.style.outline = "medium", t.style.padding = "0", t.style.textTransform = "uppercase", t.style.position = "absolute", t.style.bottom = "0px", t.style.left = "2px", t.className = "cocosEditBox", t.id = this._domId, this._isTextArea ? (t.style.resize = "none", t.style.overflow_y = "scroll") : (t.type = "text", t.style["-moz-appearance"] = "textfield"), this._placeholderStyleSheet = document.createElement("style")
- },
- _updateStyleSheet: function() {
- var t = this._delegate,
- e = this._elem;
- e.value = t.string, e.placeholder = t.placeholder, this._updateTextLabel(t.textLabel), this._updatePlaceholderLabel(t.placeholderLabel)
- },
- _updateTextLabel: function(t) {
- if (t) {
- var e = t.font;
- e = !e || e instanceof cc.BitmapFont ? t.fontFamily : e._fontFamily;
- var i = t.fontSize * t.node.scaleY;
- if (this._textLabelFont !== e || this._textLabelFontSize !== i || this._textLabelFontColor !== t.fontColor || this._textLabelAlign !== t.horizontalAlign) {
- this._textLabelFont = e, this._textLabelFontSize = i, this._textLabelFontColor = t.fontColor, this._textLabelAlign = t.horizontalAlign;
- var n = this._elem;
- switch (n.style.fontSize = i + "px", n.style.color = t.node.color.toCSS("rgba"), n.style.fontFamily = e, t.horizontalAlign) {
- case o.HorizontalAlign.LEFT:
- n.style.textAlign = "left";
- break;
- case o.HorizontalAlign.CENTER:
- n.style.textAlign = "center";
- break;
- case o.HorizontalAlign.RIGHT:
- n.style.textAlign = "right"
- }
- }
- }
- },
- _updatePlaceholderLabel: function(t) {
- if (t) {
- var e = t.font;
- e = !e || e instanceof cc.BitmapFont ? t.fontFamily : t.font._fontFamily;
- var i = t.fontSize * t.node.scaleY;
- if (this._placeholderLabelFont !== e || this._placeholderLabelFontSize !== i || this._placeholderLabelFontColor !== t.fontColor || this._placeholderLabelAlign !== t.horizontalAlign || this._placeholderLineHeight !== t.fontSize) {
- this._placeholderLabelFont = e, this._placeholderLabelFontSize = i, this._placeholderLabelFontColor = t.fontColor, this._placeholderLabelAlign = t.horizontalAlign, this._placeholderLineHeight = t.fontSize;
- var n = this._placeholderStyleSheet,
- r = t.node.color.toCSS("rgba"),
- s = t.fontSize,
- a = void 0;
- switch (t.horizontalAlign) {
- case o.HorizontalAlign.LEFT:
- a = "left";
- break;
- case o.HorizontalAlign.CENTER:
- a = "center";
- break;
- case o.HorizontalAlign.RIGHT:
- a = "right"
- }
- n.innerHTML = "#" + this._domId + "::-webkit-input-placeholder,#" + this._domId + "::-moz-placeholder,#" + this._domId + ":-ms-input-placeholder{text-transform: initial; font-family: " + e + "; font-size: " + i + "px; color: " + r + "; line-height: " + s + "px; text-align: " + a + ";}", cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE && (n.innerHTML += "#" + this._domId + "::-ms-clear{display: none;}")
- }
- }
- },
- _registerEventListeners: function() {
- var t = this,
- e = this._elem,
- i = !1,
- n = this._eventListeners;
- n.compositionStart = function() {
- i = !0
- }, n.compositionEnd = function() {
- i = !1, t._delegate.editBoxTextChanged(e.value)
- }, n.onInput = function() {
- i || t._delegate.editBoxTextChanged(e.value)
- }, n.onClick = function(e) {
- t._editing && cc.sys.isMobile && t._adjustWindowScroll()
- }, n.onKeydown = function(i) {
- i.keyCode === r.KEY.enter ? (i.stopPropagation(), t._delegate.editBoxEditingReturn(), t._isTextArea || e.blur()) : i.keyCode === r.KEY.tab && (i.stopPropagation(), i.preventDefault(), a.next(t))
- }, n.onBlur = function() {
- t._editing = !1, y = null, t._hideDom(), t._delegate.editBoxEditingDidEnded()
- }, e.addEventListener("compositionstart", n.compositionStart), e.addEventListener("compositionend", n.compositionEnd), e.addEventListener("input", n.onInput), e.addEventListener("keydown", n.onKeydown), e.addEventListener("blur", n.onBlur), e.addEventListener("touchstart", n.onClick)
- },
- _removeEventListeners: function() {
- var t = this._elem,
- e = this._eventListeners;
- t.removeEventListener("compositionstart", e.compositionStart), t.removeEventListener("compositionend", e.compositionEnd), t.removeEventListener("input", e.onInput), t.removeEventListener("keydown", e.onKeydown), t.removeEventListener("blur", e.onBlur), t.removeEventListener("touchstart", e.onClick), e.compositionStart = null, e.compositionEnd = null, e.onInput = null, e.onKeydown = null, e.onBlur = null, e.onClick = null
- }
- })
- }), {
- "../../platform/CCMacro": 203,
- "../../platform/utils": 222,
- "../CCLabel": 97,
- "./tabIndexUtil": 121,
- "./types": 122
- }],
- 121: [(function(t, e, i) {
- "use strict";
- e.exports = {
- _tabIndexList: [],
- add: function(t) {
- var e = this._tabIndexList; - 1 === e.indexOf(t) && e.push(t)
- },
- remove: function(t) {
- var e = this._tabIndexList,
- i = e.indexOf(t); - 1 !== i && e.splice(i, 1)
- },
- resort: function() {
- this._tabIndexList.sort((function(t, e) {
- return t._delegate._tabIndex - e._delegate._tabIndex
- }))
- },
- next: function(t) {
- var e = this._tabIndexList,
- i = e.indexOf(t);
- if (t.setFocus(!1), -1 !== i) {
- var n = e[i + 1];
- n && n._delegate._tabIndex >= 0 && n.setFocus(!0)
- }
- }
- }
- }), {}],
- 122: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- DEFAULT: 0,
- DONE: 1,
- SEND: 2,
- SEARCH: 3,
- GO: 4,
- NEXT: 5
- }),
- r = cc.Enum({
- ANY: 0,
- EMAIL_ADDR: 1,
- NUMERIC: 2,
- PHONE_NUMBER: 3,
- URL: 4,
- DECIMAL: 5,
- SINGLE_LINE: 6
- }),
- s = cc.Enum({
- PASSWORD: 0,
- SENSITIVE: 1,
- INITIAL_CAPS_WORD: 2,
- INITIAL_CAPS_SENTENCE: 3,
- INITIAL_CAPS_ALL_CHARACTERS: 4,
- DEFAULT: 5
- });
- e.exports = {
- KeyboardReturnType: n,
- InputMode: r,
- InputFlag: s
- }
- }), {}],
- 123: [(function(t, e, i) {
- "use strict";
- t("./CCComponent"), t("./CCComponentEventHandler"), t("./missing-script");
- var n = t("./WXSubContextView"),
- r = t("./SwanSubContextView");
- n || (n = cc.Class({
- name: "cc.WXSubContextView",
- extends: cc.Component
- })), r || (r = cc.Class({
- name: "cc.SwanSubContextView",
- extends: cc.Component
- }));
- var s = [t("./CCSprite"), t("./CCWidget"), t("./CCCanvas"), t("./CCAudioSource"), t("./CCAnimation"), t("./CCButton"), t("./CCLabel"), t("./CCProgressBar"), t("./CCMask"), t("./CCScrollBar"), t("./CCScrollView"), t("./CCPageViewIndicator"), t("./CCPageView"), t("./CCSlider"), t("./CCLayout"), t("./editbox/CCEditBox"), t("./CCLabelOutline"), t("./CCLabelShadow"), t("./CCRichText"), t("./CCToggleContainer"), t("./CCToggleGroup"), t("./CCToggle"), t("./CCBlockInputEvents"), t("./CCMotionStreak"), n, r];
- e.exports = s
- }), {
- "./CCAnimation": 90,
- "./CCAudioSource": 91,
- "./CCBlockInputEvents": 92,
- "./CCButton": 93,
- "./CCCanvas": 94,
- "./CCComponent": 95,
- "./CCComponentEventHandler": 96,
- "./CCLabel": 97,
- "./CCLabelOutline": 98,
- "./CCLabelShadow": 99,
- "./CCLayout": 100,
- "./CCMask": 101,
- "./CCMotionStreak": 102,
- "./CCPageView": 103,
- "./CCPageViewIndicator": 104,
- "./CCProgressBar": 105,
- "./CCRichText": 107,
- "./CCScrollBar": 108,
- "./CCScrollView": 109,
- "./CCSlider": 110,
- "./CCSprite": 111,
- "./CCToggle": 113,
- "./CCToggleContainer": 114,
- "./CCToggleGroup": 115,
- "./CCWidget": 117,
- "./SwanSubContextView": void 0,
- "./WXSubContextView": void 0,
- "./editbox/CCEditBox": 118,
- "./missing-script": 124
- }],
- 124: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = t("../utils/misc").BUILTIN_CLASSID_RE,
- s = cc.Class({
- name: "cc.MissingClass",
- properties: {
- _$erialized: {
- default: null,
- visible: !1,
- editorOnly: !0
- }
- }
- }),
- o = cc.Class({
- name: "cc.MissingScript",
- extends: cc.Component,
- editor: {
- inspector: "packages://inspector/inspectors/comps/missing-script.js"
- },
- properties: {
- compiled: {
- default: !1,
- serializable: !1
- },
- _$erialized: {
- default: null,
- visible: !1,
- editorOnly: !0
- }
- },
- ctor: !1,
- statics: {
- safeFindClass: function(t, e) {
- var i = n._getClassById(t);
- return i || (t ? (cc.deserialize.reportMissingClass(t), o.getMissingWrapper(t, e)) : null)
- },
- getMissingWrapper: function(t, e) {
- return e.node && (/^[0-9a-zA-Z+/]{23}$/.test(t) || r.test(t)) ? o : s
- }
- },
- onLoad: function() {
- cc.warnID(4600, this.node.name)
- }
- });
- cc._MissingScript = e.exports = o
- }), {
- "../utils/misc": 300
- }],
- 125: [(function(t, e, i) {
- "use strict";
- var n = cc.js;
- t("../event/event");
- var r = function(t, e) {
- cc.Event.call(this, cc.Event.MOUSE, e), this._eventType = t, this._button = 0, this._x = 0, this._y = 0, this._prevX = 0, this._prevY = 0, this._scrollX = 0, this._scrollY = 0
- };
- n.extend(r, cc.Event);
- var s = r.prototype;
- s.setScrollData = function(t, e) {
- this._scrollX = t, this._scrollY = e
- }, s.getScrollX = function() {
- return this._scrollX
- }, s.getScrollY = function() {
- return this._scrollY
- }, s.setLocation = function(t, e) {
- this._x = t, this._y = e
- }, s.getLocation = function() {
- return cc.v2(this._x, this._y)
- }, s.getLocationInView = function() {
- return cc.v2(this._x, cc.view._designResolutionSize.height - this._y)
- }, s._setPrevCursor = function(t, e) {
- this._prevX = t, this._prevY = e
- }, s.getPreviousLocation = function() {
- return cc.v2(this._prevX, this._prevY)
- }, s.getDelta = function() {
- return cc.v2(this._x - this._prevX, this._y - this._prevY)
- }, s.getDeltaX = function() {
- return this._x - this._prevX
- }, s.getDeltaY = function() {
- return this._y - this._prevY
- }, s.setButton = function(t) {
- this._button = t
- }, s.getButton = function() {
- return this._button
- }, s.getLocationX = function() {
- return this._x
- }, s.getLocationY = function() {
- return this._y
- }, r.NONE = 0, r.DOWN = 1, r.UP = 2, r.MOVE = 3, r.SCROLL = 4, r.BUTTON_LEFT = 0, r.BUTTON_RIGHT = 2, r.BUTTON_MIDDLE = 1, r.BUTTON_4 = 3, r.BUTTON_5 = 4, r.BUTTON_6 = 5, r.BUTTON_7 = 6, r.BUTTON_8 = 7;
- var o = function(t, e) {
- cc.Event.call(this, cc.Event.TOUCH, e), this._eventCode = 0, this._touches = t || [], this.touch = null, this.currentTouch = null
- };
- n.extend(o, cc.Event), (s = o.prototype).getEventCode = function() {
- return this._eventCode
- }, s.getTouches = function() {
- return this._touches
- }, s._setEventCode = function(t) {
- this._eventCode = t
- }, s._setTouches = function(t) {
- this._touches = t
- }, s.setLocation = function(t, e) {
- this.touch && this.touch.setTouchInfo(this.touch.getID(), t, e)
- }, s.getLocation = function() {
- return this.touch ? this.touch.getLocation() : cc.v2()
- }, s.getLocationInView = function() {
- return this.touch ? this.touch.getLocationInView() : cc.v2()
- }, s.getPreviousLocation = function() {
- return this.touch ? this.touch.getPreviousLocation() : cc.v2()
- }, s.getStartLocation = function() {
- return this.touch ? this.touch.getStartLocation() : cc.v2()
- }, s.getID = function() {
- return this.touch ? this.touch.getID() : null
- }, s.getDelta = function() {
- return this.touch ? this.touch.getDelta() : cc.v2()
- }, s.getDeltaX = function() {
- return this.touch ? this.touch.getDelta().x : 0
- }, s.getDeltaY = function() {
- return this.touch ? this.touch.getDelta().y : 0
- }, s.getLocationX = function() {
- return this.touch ? this.touch.getLocationX() : 0
- }, s.getLocationY = function() {
- return this.touch ? this.touch.getLocationY() : 0
- }, o.MAX_TOUCHES = 5, o.BEGAN = 0, o.MOVED = 1, o.ENDED = 2, o.CANCELED = 3;
- var a = function(t, e) {
- cc.Event.call(this, cc.Event.ACCELERATION, e), this.acc = t
- };
- n.extend(a, cc.Event);
- var l = function(t, e, i) {
- cc.Event.call(this, cc.Event.KEYBOARD, i), this.keyCode = t, this.isPressed = e
- };
- n.extend(l, cc.Event), cc.Event.EventMouse = r, cc.Event.EventTouch = o, cc.Event.EventAcceleration = a, cc.Event.EventKeyboard = l, e.exports = cc.Event
- }), {
- "../event/event": 132
- }],
- 126: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- cc.EventListener = function(t, e, i) {
- this._onEvent = i, this._type = t || 0, this._listenerID = e || "", this._registered = !1, this._fixedPriority = 0, this._node = null, this._target = null, this._paused = !0, this._isEnabled = !0
- }, cc.EventListener.prototype = {
- constructor: cc.EventListener,
- _setPaused: function(t) {
- this._paused = t
- },
- _isPaused: function() {
- return this._paused
- },
- _setRegistered: function(t) {
- this._registered = t
- },
- _isRegistered: function() {
- return this._registered
- },
- _getType: function() {
- return this._type
- },
- _getListenerID: function() {
- return this._listenerID
- },
- _setFixedPriority: function(t) {
- this._fixedPriority = t
- },
- _getFixedPriority: function() {
- return this._fixedPriority
- },
- _setSceneGraphPriority: function(t) {
- this._target = t, this._node = t
- },
- _getSceneGraphPriority: function() {
- return this._node
- },
- checkAvailable: function() {
- return null !== this._onEvent
- },
- clone: function() {
- return null
- },
- setEnabled: function(t) {
- this._isEnabled = t
- },
- isEnabled: function() {
- return this._isEnabled
- },
- retain: function() {},
- release: function() {}
- }, cc.EventListener.UNKNOWN = 0, cc.EventListener.TOUCH_ONE_BY_ONE = 1, cc.EventListener.TOUCH_ALL_AT_ONCE = 2, cc.EventListener.KEYBOARD = 3, cc.EventListener.MOUSE = 4, cc.EventListener.ACCELERATION = 6, cc.EventListener.CUSTOM = 8;
- var r = cc.EventListener.ListenerID = {
- MOUSE: "__cc_mouse",
- TOUCH_ONE_BY_ONE: "__cc_touch_one_by_one",
- TOUCH_ALL_AT_ONCE: "__cc_touch_all_at_once",
- KEYBOARD: "__cc_keyboard",
- ACCELERATION: "__cc_acceleration"
- },
- s = function(t, e) {
- this._onCustomEvent = e, cc.EventListener.call(this, cc.EventListener.CUSTOM, t, this._callback)
- };
- n.extend(s, cc.EventListener), n.mixin(s.prototype, {
- _onCustomEvent: null,
- _callback: function(t) {
- null !== this._onCustomEvent && this._onCustomEvent(t)
- },
- checkAvailable: function() {
- return cc.EventListener.prototype.checkAvailable.call(this) && null !== this._onCustomEvent
- },
- clone: function() {
- return new s(this._listenerID, this._onCustomEvent)
- }
- });
- var o = function() {
- cc.EventListener.call(this, cc.EventListener.MOUSE, r.MOUSE, this._callback)
- };
- n.extend(o, cc.EventListener), n.mixin(o.prototype, {
- onMouseDown: null,
- onMouseUp: null,
- onMouseMove: null,
- onMouseScroll: null,
- _callback: function(t) {
- var e = cc.Event.EventMouse;
- switch (t._eventType) {
- case e.DOWN:
- this.onMouseDown && this.onMouseDown(t);
- break;
- case e.UP:
- this.onMouseUp && this.onMouseUp(t);
- break;
- case e.MOVE:
- this.onMouseMove && this.onMouseMove(t);
- break;
- case e.SCROLL:
- this.onMouseScroll && this.onMouseScroll(t)
- }
- },
- clone: function() {
- var t = new o;
- return t.onMouseDown = this.onMouseDown, t.onMouseUp = this.onMouseUp, t.onMouseMove = this.onMouseMove, t.onMouseScroll = this.onMouseScroll, t
- },
- checkAvailable: function() {
- return !0
- }
- });
- var a = function() {
- cc.EventListener.call(this, cc.EventListener.TOUCH_ONE_BY_ONE, r.TOUCH_ONE_BY_ONE, null), this._claimedTouches = []
- };
- n.extend(a, cc.EventListener), n.mixin(a.prototype, {
- constructor: a,
- _claimedTouches: null,
- swallowTouches: !1,
- onTouchBegan: null,
- onTouchMoved: null,
- onTouchEnded: null,
- onTouchCancelled: null,
- setSwallowTouches: function(t) {
- this.swallowTouches = t
- },
- isSwallowTouches: function() {
- return this.swallowTouches
- },
- clone: function() {
- var t = new a;
- return t.onTouchBegan = this.onTouchBegan, t.onTouchMoved = this.onTouchMoved, t.onTouchEnded = this.onTouchEnded, t.onTouchCancelled = this.onTouchCancelled, t.swallowTouches = this.swallowTouches, t
- },
- checkAvailable: function() {
- return !!this.onTouchBegan || (cc.logID(1801), !1)
- }
- });
- var l = function() {
- cc.EventListener.call(this, cc.EventListener.TOUCH_ALL_AT_ONCE, r.TOUCH_ALL_AT_ONCE, null)
- };
- n.extend(l, cc.EventListener), n.mixin(l.prototype, {
- constructor: l,
- onTouchesBegan: null,
- onTouchesMoved: null,
- onTouchesEnded: null,
- onTouchesCancelled: null,
- clone: function() {
- var t = new l;
- return t.onTouchesBegan = this.onTouchesBegan, t.onTouchesMoved = this.onTouchesMoved, t.onTouchesEnded = this.onTouchesEnded, t.onTouchesCancelled = this.onTouchesCancelled, t
- },
- checkAvailable: function() {
- return null !== this.onTouchesBegan || null !== this.onTouchesMoved || null !== this.onTouchesEnded || null !== this.onTouchesCancelled || (cc.logID(1802), !1)
- }
- });
- var h = function(t) {
- this._onAccelerationEvent = t, cc.EventListener.call(this, cc.EventListener.ACCELERATION, r.ACCELERATION, this._callback)
- };
- n.extend(h, cc.EventListener), n.mixin(h.prototype, {
- constructor: h,
- _onAccelerationEvent: null,
- _callback: function(t) {
- this._onAccelerationEvent(t.acc, t)
- },
- checkAvailable: function() {
- return cc.assertID(this._onAccelerationEvent, 1803), !0
- },
- clone: function() {
- return new h(this._onAccelerationEvent)
- }
- });
- var c = function() {
- cc.EventListener.call(this, cc.EventListener.KEYBOARD, r.KEYBOARD, this._callback)
- };
- n.extend(c, cc.EventListener), n.mixin(c.prototype, {
- constructor: c,
- onKeyPressed: null,
- onKeyReleased: null,
- _callback: function(t) {
- t.isPressed ? this.onKeyPressed && this.onKeyPressed(t.keyCode, t) : this.onKeyReleased && this.onKeyReleased(t.keyCode, t)
- },
- clone: function() {
- var t = new c;
- return t.onKeyPressed = this.onKeyPressed, t.onKeyReleased = this.onKeyReleased, t
- },
- checkAvailable: function() {
- return null !== this.onKeyPressed || null !== this.onKeyReleased || (cc.logID(1800), !1)
- }
- }), cc.EventListener.create = function(t) {
- cc.assertID(t && t.event, 1900);
- var e = t.event;
- delete t.event;
- var i = null;
- for (var n in e === cc.EventListener.TOUCH_ONE_BY_ONE ? i = new a : e === cc.EventListener.TOUCH_ALL_AT_ONCE ? i = new l : e === cc.EventListener.MOUSE ? i = new o : e === cc.EventListener.CUSTOM ? (i = new s(t.eventName, t.callback), delete t.eventName, delete t.callback) : e === cc.EventListener.KEYBOARD ? i = new c : e === cc.EventListener.ACCELERATION && (i = new h(t.callback), delete t.callback), t) i[n] = t[n];
- return i
- }, e.exports = cc.EventListener
- }), {
- "../platform/js": 218
- }],
- 127: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- t("./CCEventListener");
- var r = cc.EventListener.ListenerID,
- s = function() {
- this._fixedListeners = [], this._sceneGraphListeners = [], this.gt0Index = 0
- };
- s.prototype = {
- constructor: s,
- size: function() {
- return this._fixedListeners.length + this._sceneGraphListeners.length
- },
- empty: function() {
- return 0 === this._fixedListeners.length && 0 === this._sceneGraphListeners.length
- },
- push: function(t) {
- 0 === t._getFixedPriority() ? this._sceneGraphListeners.push(t) : this._fixedListeners.push(t)
- },
- clearSceneGraphListeners: function() {
- this._sceneGraphListeners.length = 0
- },
- clearFixedListeners: function() {
- this._fixedListeners.length = 0
- },
- clear: function() {
- this._sceneGraphListeners.length = 0, this._fixedListeners.length = 0
- },
- getFixedPriorityListeners: function() {
- return this._fixedListeners
- },
- getSceneGraphPriorityListeners: function() {
- return this._sceneGraphListeners
- }
- };
- var o = function(t) {
- var e = cc.Event,
- i = t.type;
- return i === e.ACCELERATION ? r.ACCELERATION : i === e.KEYBOARD ? r.KEYBOARD : i.startsWith(e.MOUSE) ? r.MOUSE : (i.startsWith(e.TOUCH) && cc.logID(2e3), "")
- },
- a = {
- DIRTY_NONE: 0,
- DIRTY_FIXED_PRIORITY: 1,
- DIRTY_SCENE_GRAPH_PRIORITY: 2,
- DIRTY_ALL: 3,
- _listenersMap: {},
- _priorityDirtyFlagMap: {},
- _nodeListenersMap: {},
- _toAddedListeners: [],
- _toRemovedListeners: [],
- _dirtyListeners: {},
- _inDispatch: 0,
- _isEnabled: !1,
- _internalCustomListenerIDs: [],
- _setDirtyForNode: function(t) {
- var e = this._nodeListenersMap[t._id];
- if (void 0 !== e)
- for (var i = 0, n = e.length; i < n; i++) {
- var r = e[i]._getListenerID();
- null == this._dirtyListeners[r] && (this._dirtyListeners[r] = !0)
- }
- if (t.getChildren) {
- var s = t.getChildren(),
- o = 0;
- for (n = s ? s.length : 0; o < n; o++) this._setDirtyForNode(s[o])
- }
- },
- pauseTarget: function(t, e) {
- if (t instanceof cc._BaseNode) {
- var i, n, r = this._nodeListenersMap[t._id];
- if (r)
- for (i = 0, n = r.length; i < n; i++) r[i]._setPaused(!0);
- if (!0 === e) {
- var s = t.getChildren();
- for (i = 0, n = s ? s.length : 0; i < n; i++) this.pauseTarget(s[i], !0)
- }
- } else cc.warnID(3506)
- },
- resumeTarget: function(t, e) {
- if (t instanceof cc._BaseNode) {
- var i, n, r = this._nodeListenersMap[t._id];
- if (r)
- for (i = 0, n = r.length; i < n; i++) r[i]._setPaused(!1);
- if (this._setDirtyForNode(t), !0 === e && t.getChildren) {
- var s = t.getChildren();
- for (i = 0, n = s ? s.length : 0; i < n; i++) this.resumeTarget(s[i], !0)
- }
- } else cc.warnID(3506)
- },
- _addListener: function(t) {
- 0 === this._inDispatch ? this._forceAddEventListener(t) : this._toAddedListeners.push(t)
- },
- _forceAddEventListener: function(t) {
- var e = t._getListenerID(),
- i = this._listenersMap[e];
- if (i || (i = new s, this._listenersMap[e] = i), i.push(t), 0 === t._getFixedPriority()) {
- this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
- var n = t._getSceneGraphPriority();
- null === n && cc.logID(3507), this._associateNodeAndEventListener(n, t), n.activeInHierarchy && this.resumeTarget(n)
- } else this._setDirty(e, this.DIRTY_FIXED_PRIORITY)
- },
- _getListeners: function(t) {
- return this._listenersMap[t]
- },
- _updateDirtyFlagForSceneGraph: function() {
- var t = this._dirtyListeners;
- for (var e in t) this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
- this._dirtyListeners = {}
- },
- _removeAllListenersInVector: function(t) {
- if (t)
- for (var e, i = t.length - 1; i >= 0; i--)(e = t[i])._setRegistered(!1), null != e._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(e._getSceneGraphPriority(), e), e._setSceneGraphPriority(null)), 0 === this._inDispatch && cc.js.array.removeAt(t, i)
- },
- _removeListenersForListenerID: function(t) {
- var e, i = this._listenersMap[t];
- if (i) {
- var n = i.getFixedPriorityListeners(),
- r = i.getSceneGraphPriorityListeners();
- this._removeAllListenersInVector(r), this._removeAllListenersInVector(n), delete this._priorityDirtyFlagMap[t], this._inDispatch || (i.clear(), delete this._listenersMap[t])
- }
- var s, o = this._toAddedListeners;
- for (e = o.length - 1; e >= 0; e--)(s = o[e]) && s._getListenerID() === t && cc.js.array.removeAt(o, e)
- },
- _sortEventListeners: function(t) {
- var e = this.DIRTY_NONE,
- i = this._priorityDirtyFlagMap;
- (i[t] && (e = i[t]), e !== this.DIRTY_NONE) && (i[t] = this.DIRTY_NONE, e & this.DIRTY_FIXED_PRIORITY && this._sortListenersOfFixedPriority(t), e & this.DIRTY_SCENE_GRAPH_PRIORITY && cc.director.getScene() && this._sortListenersOfSceneGraphPriority(t))
- },
- _sortListenersOfSceneGraphPriority: function(t) {
- var e = this._getListeners(t);
- if (e) {
- var i = e.getSceneGraphPriorityListeners();
- i && 0 !== i.length && e.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes)
- }
- },
- _sortEventListenersOfSceneGraphPriorityDes: function(t, e) {
- var i = t._getSceneGraphPriority(),
- n = e._getSceneGraphPriority();
- if (!(e && n && n._activeInHierarchy && null !== n._parent)) return -1;
- if (!t || !i || !i._activeInHierarchy || null === i._parent) return 1;
- for (var r = i, s = n, o = !1; r._parent._id !== s._parent._id;) r = null === r._parent._parent ? (o = !0) && n : r._parent, s = null === s._parent._parent ? (o = !0) && i : s._parent;
- if (r._id === s._id) {
- if (r._id === n._id) return -1;
- if (r._id === i._id) return 1
- }
- return o ? r._localZOrder - s._localZOrder : s._localZOrder - r._localZOrder
- },
- _sortListenersOfFixedPriority: function(t) {
- var e = this._listenersMap[t];
- if (e) {
- var i = e.getFixedPriorityListeners();
- if (i && 0 !== i.length) {
- i.sort(this._sortListenersOfFixedPriorityAsc);
- for (var n = 0, r = i.length; n < r && !(i[n]._getFixedPriority() >= 0);) ++n;
- e.gt0Index = n
- }
- }
- },
- _sortListenersOfFixedPriorityAsc: function(t, e) {
- return t._getFixedPriority() - e._getFixedPriority()
- },
- _onUpdateListeners: function(t) {
- var e, i, n, r = t.getFixedPriorityListeners(),
- s = t.getSceneGraphPriorityListeners(),
- o = this._toRemovedListeners;
- if (s)
- for (e = s.length - 1; e >= 0; e--)(i = s[e])._isRegistered() || (cc.js.array.removeAt(s, e), -1 !== (n = o.indexOf(i)) && o.splice(n, 1));
- if (r)
- for (e = r.length - 1; e >= 0; e--)(i = r[e])._isRegistered() || (cc.js.array.removeAt(r, e), -1 !== (n = o.indexOf(i)) && o.splice(n, 1));
- s && 0 === s.length && t.clearSceneGraphListeners(), r && 0 === r.length && t.clearFixedListeners()
- },
- frameUpdateListeners: function() {
- var t = this._listenersMap,
- e = this._priorityDirtyFlagMap;
- for (var i in t) t[i].empty() && (delete e[i], delete t[i]);
- var n = this._toAddedListeners;
- if (0 !== n.length) {
- for (var r = 0, s = n.length; r < s; r++) this._forceAddEventListener(n[r]);
- n.length = 0
- }
- 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners()
- },
- _updateTouchListeners: function(t) {
- var e = this._inDispatch;
- if (cc.assertID(e > 0, 3508), !(e > 1)) {
- var i;
- (i = this._listenersMap[r.TOUCH_ONE_BY_ONE]) && this._onUpdateListeners(i), (i = this._listenersMap[r.TOUCH_ALL_AT_ONCE]) && this._onUpdateListeners(i), cc.assertID(1 === e, 3509);
- var n = this._toAddedListeners;
- if (0 !== n.length) {
- for (var s = 0, o = n.length; s < o; s++) this._forceAddEventListener(n[s]);
- this._toAddedListeners.length = 0
- }
- 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners()
- }
- },
- _cleanToRemovedListeners: function() {
- for (var t = this._toRemovedListeners, e = 0; e < t.length; e++) {
- var i = t[e],
- n = this._listenersMap[i._getListenerID()];
- if (n) {
- var r, s = n.getFixedPriorityListeners(),
- o = n.getSceneGraphPriorityListeners();
- o && -1 !== (r = o.indexOf(i)) && o.splice(r, 1), s && -1 !== (r = s.indexOf(i)) && s.splice(r, 1)
- }
- }
- t.length = 0
- },
- _onTouchEventCallback: function(t, e) {
- if (!t._isRegistered()) return !1;
- var i = e.event,
- n = i.currentTouch;
- i.currentTarget = t._node;
- var r, s = !1,
- o = i.getEventCode(),
- l = cc.Event.EventTouch;
- return o === l.BEGAN ? t.onTouchBegan && (s = t.onTouchBegan(n, i)) && t._registered && t._claimedTouches.push(n) : t._claimedTouches.length > 0 && -1 !== (r = t._claimedTouches.indexOf(n)) && (s = !0, o === l.MOVED && t.onTouchMoved ? t.onTouchMoved(n, i) : o === l.ENDED ? (t.onTouchEnded && t.onTouchEnded(n, i), t._registered && t._claimedTouches.splice(r, 1)) : o === l.CANCELLED && (t.onTouchCancelled && t.onTouchCancelled(n, i), t._registered && t._claimedTouches.splice(r, 1))), i.isStopped() ? (a._updateTouchListeners(i), !0) : !(!s || !t.swallowTouches) && (e.needsMutableSet && e.touches.splice(n, 1), !0)
- },
- _dispatchTouchEvent: function(t) {
- this._sortEventListeners(r.TOUCH_ONE_BY_ONE), this._sortEventListeners(r.TOUCH_ALL_AT_ONCE);
- var e = this._getListeners(r.TOUCH_ONE_BY_ONE),
- i = this._getListeners(r.TOUCH_ALL_AT_ONCE);
- if (null !== e || null !== i) {
- var n = t.getTouches(),
- s = cc.js.array.copy(n),
- o = {
- event: t,
- needsMutableSet: e && i,
- touches: s,
- selTouch: null
- };
- if (e)
- for (var a = 0; a < n.length; a++) t.currentTouch = n[a], t._propagationStopped = t._propagationImmediateStopped = !1, this._dispatchEventToListeners(e, this._onTouchEventCallback, o);
- i && s.length > 0 && (this._dispatchEventToListeners(i, this._onTouchesEventCallback, {
- event: t,
- touches: s
- }), t.isStopped()) || this._updateTouchListeners(t)
- }
- },
- _onTouchesEventCallback: function(t, e) {
- if (!t._registered) return !1;
- var i = cc.Event.EventTouch,
- n = e.event,
- r = e.touches,
- s = n.getEventCode();
- return n.currentTarget = t._node, s === i.BEGAN && t.onTouchesBegan ? t.onTouchesBegan(r, n) : s === i.MOVED && t.onTouchesMoved ? t.onTouchesMoved(r, n) : s === i.ENDED && t.onTouchesEnded ? t.onTouchesEnded(r, n) : s === i.CANCELLED && t.onTouchesCancelled && t.onTouchesCancelled(r, n), !!n.isStopped() && (a._updateTouchListeners(n), !0)
- },
- _associateNodeAndEventListener: function(t, e) {
- var i = this._nodeListenersMap[t._id];
- i || (i = [], this._nodeListenersMap[t._id] = i), i.push(e)
- },
- _dissociateNodeAndEventListener: function(t, e) {
- var i = this._nodeListenersMap[t._id];
- i && (cc.js.array.remove(i, e), 0 === i.length && delete this._nodeListenersMap[t._id])
- },
- _dispatchEventToListeners: function(t, e, i) {
- var n, r, s = !1,
- o = t.getFixedPriorityListeners(),
- a = t.getSceneGraphPriorityListeners(),
- l = 0;
- if (o && 0 !== o.length)
- for (; l < t.gt0Index; ++l)
- if ((r = o[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
- s = !0;
- break
- }
- if (a && !s)
- for (n = 0; n < a.length; n++)
- if ((r = a[n]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
- s = !0;
- break
- }
- if (o && !s)
- for (; l < o.length; ++l)
- if ((r = o[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
- s = !0;
- break
- }
- },
- _setDirty: function(t, e) {
- var i = this._priorityDirtyFlagMap;
- null == i[t] ? i[t] = e : i[t] = e | i[t]
- },
- _sortNumberAsc: function(t, e) {
- return t - e
- },
- hasEventListener: function(t) {
- return !!this._getListeners(t)
- },
- addListener: function(t, e) {
- if (cc.assertID(t && e, 3503), cc.js.isNumber(e) || e instanceof cc._BaseNode) {
- if (t instanceof cc.EventListener) {
- if (t._isRegistered()) return void cc.logID(3505)
- } else cc.assertID(!cc.js.isNumber(e), 3504), t = cc.EventListener.create(t);
- if (t.checkAvailable()) {
- if (cc.js.isNumber(e)) {
- if (0 === e) return void cc.logID(3500);
- t._setSceneGraphPriority(null), t._setFixedPriority(e), t._setRegistered(!0), t._setPaused(!1), this._addListener(t)
- } else t._setSceneGraphPriority(e), t._setFixedPriority(0), t._setRegistered(!0), this._addListener(t);
- return t
- }
- } else cc.warnID(3506)
- },
- addCustomListener: function(t, e) {
- var i = new cc.EventListener.create({
- event: cc.EventListener.CUSTOM,
- eventName: t,
- callback: e
- });
- return this.addListener(i, 1), i
- },
- removeListener: function(t) {
- if (null != t) {
- var e, i = this._listenersMap;
- for (var n in i) {
- var r = i[n],
- s = r.getFixedPriorityListeners(),
- o = r.getSceneGraphPriorityListeners();
- if ((e = this._removeListenerInVector(o, t)) ? this._setDirty(t._getListenerID(), this.DIRTY_SCENE_GRAPH_PRIORITY) : (e = this._removeListenerInVector(s, t)) && this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY), r.empty() && (delete this._priorityDirtyFlagMap[t._getListenerID()], delete i[n]), e) break
- }
- if (!e)
- for (var a = this._toAddedListeners, l = a.length - 1; l >= 0; l--) {
- var h = a[l];
- if (h === t) {
- cc.js.array.removeAt(a, l), h._setRegistered(!1);
- break
- }
- }
- }
- },
- _removeListenerInCallback: function(t, e) {
- if (null == t) return !1;
- for (var i = t.length - 1; i >= 0; i--) {
- var n = t[i];
- if (n._onCustomEvent === e || n._onEvent === e) return n._setRegistered(!1), null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), n._setSceneGraphPriority(null)), 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), !0
- }
- return !1
- },
- _removeListenerInVector: function(t, e) {
- if (null == t) return !1;
- for (var i = t.length - 1; i >= 0; i--) {
- var n = t[i];
- if (n === e) return n._setRegistered(!1), null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), n._setSceneGraphPriority(null)), 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), !0
- }
- return !1
- },
- removeListeners: function(t, e) {
- var i = this;
- if (cc.js.isNumber(t) || t instanceof cc._BaseNode)
- if (void 0 !== t._id) {
- var n, s = i._nodeListenersMap[t._id];
- if (s) {
- var o = cc.js.array.copy(s);
- for (n = 0; n < o.length; n++) i.removeListener(o[n]);
- delete i._nodeListenersMap[t._id]
- }
- var a = i._toAddedListeners;
- for (n = 0; n < a.length;) {
- var l = a[n];
- l._getSceneGraphPriority() === t ? (l._setSceneGraphPriority(null), l._setRegistered(!1), a.splice(n, 1)) : ++n
- }
- if (!0 === e) {
- var h, c = t.getChildren();
- for (n = 0, h = c.length; n < h; n++) i.removeListeners(c[n], !0)
- }
- } else t === cc.EventListener.TOUCH_ONE_BY_ONE ? i._removeListenersForListenerID(r.TOUCH_ONE_BY_ONE) : t === cc.EventListener.TOUCH_ALL_AT_ONCE ? i._removeListenersForListenerID(r.TOUCH_ALL_AT_ONCE) : t === cc.EventListener.MOUSE ? i._removeListenersForListenerID(r.MOUSE) : t === cc.EventListener.ACCELERATION ? i._removeListenersForListenerID(r.ACCELERATION) : t === cc.EventListener.KEYBOARD ? i._removeListenersForListenerID(r.KEYBOARD) : cc.logID(3501);
- else cc.warnID(3506)
- },
- removeCustomListeners: function(t) {
- this._removeListenersForListenerID(t)
- },
- removeAllListeners: function() {
- var t = this._listenersMap,
- e = this._internalCustomListenerIDs;
- for (var i in t) - 1 === e.indexOf(i) && this._removeListenersForListenerID(i)
- },
- setPriority: function(t, e) {
- if (null != t) {
- var i = this._listenersMap;
- for (var n in i) {
- var r = i[n].getFixedPriorityListeners();
- if (r)
- if (-1 !== r.indexOf(t)) return null != t._getSceneGraphPriority() && cc.logID(3502), void(t._getFixedPriority() !== e && (t._setFixedPriority(e), this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY)))
- }
- }
- },
- setEnabled: function(t) {
- this._isEnabled = t
- },
- isEnabled: function() {
- return this._isEnabled
- },
- dispatchEvent: function(t) {
- if (this._isEnabled)
- if (this._updateDirtyFlagForSceneGraph(), this._inDispatch++, t && t.getType) {
- if (t.getType().startsWith(cc.Event.TOUCH)) return this._dispatchTouchEvent(t), void this._inDispatch--;
- var e = o(t);
- this._sortEventListeners(e);
- var i = this._listenersMap[e];
- null != i && (this._dispatchEventToListeners(i, this._onListenerCallback, t), this._onUpdateListeners(i)), this._inDispatch--
- } else cc.errorID(3511)
- },
- _onListenerCallback: function(t, e) {
- return e.currentTarget = t._target, t._onEvent(e), e.isStopped()
- },
- dispatchCustomEvent: function(t, e) {
- var i = new cc.Event.EventCustom(t);
- i.setUserData(e), this.dispatchEvent(i)
- }
- };
- n.get(cc, "eventManager", (function() {
- return cc.warnID(1405, "cc.eventManager", "cc.EventTarget or cc.systemEvent"), a
- })), e.exports = a
- }), {
- "../platform/js": 218,
- "./CCEventListener": 126
- }],
- 128: [(function(t, e, i) {
- "use strict";
- cc.Touch = function(t, e, i) {
- this._lastModified = 0, this.setTouchInfo(i, t, e)
- }, cc.Touch.prototype = {
- constructor: cc.Touch,
- getLocation: function() {
- return cc.v2(this._point.x, this._point.y)
- },
- getLocationX: function() {
- return this._point.x
- },
- getLocationY: function() {
- return this._point.y
- },
- getPreviousLocation: function() {
- return cc.v2(this._prevPoint.x, this._prevPoint.y)
- },
- getStartLocation: function() {
- return cc.v2(this._startPoint.x, this._startPoint.y)
- },
- getDelta: function() {
- return this._point.sub(this._prevPoint)
- },
- getLocationInView: function() {
- return cc.v2(this._point.x, cc.view._designResolutionSize.height - this._point.y)
- },
- getPreviousLocationInView: function() {
- return cc.v2(this._prevPoint.x, cc.view._designResolutionSize.height - this._prevPoint.y)
- },
- getStartLocationInView: function() {
- return cc.v2(this._startPoint.x, cc.view._designResolutionSize.height - this._startPoint.y)
- },
- getID: function() {
- return this._id
- },
- setTouchInfo: function(t, e, i) {
- this._prevPoint = this._point, this._point = cc.v2(e || 0, i || 0), this._id = t, this._startPointCaptured || (this._startPoint = cc.v2(this._point), cc.view._convertPointWithScale(this._startPoint), this._startPointCaptured = !0)
- },
- _setPoint: function(t, e) {
- void 0 === e ? (this._point.x = t.x, this._point.y = t.y) : (this._point.x = t, this._point.y = e)
- },
- _setPrevPoint: function(t, e) {
- this._prevPoint = void 0 === e ? cc.v2(t.x, t.y) : cc.v2(t || 0, e || 0)
- }
- }
- }), {}],
- 129: [(function(t, e, i) {
- "use strict";
- t("./CCEvent"), t("./CCTouch"), t("./CCEventListener");
- var n = t("./CCEventManager");
- e.exports = n
- }), {
- "./CCEvent": 125,
- "./CCEventListener": 126,
- "./CCEventManager": 127,
- "./CCTouch": 128
- }],
- 130: [(function(t, e, i) {
- "use strict";
- var n = cc.js,
- r = t("../platform/callbacks-invoker");
- function s() {
- r.call(this)
- }
- n.extend(s, r), s.prototype.emit = function(t, e) {
- var i = t.type,
- n = this._callbackTable[i];
- if (n) {
- var r = !n.isInvoking;
- n.isInvoking = !0;
- for (var s = n.callbackInfos, o = 0, a = s.length; o < a; ++o) {
- var l = s[o];
- if (l && l.callback && (l.callback.call(l.target, t, e), t._propagationImmediateStopped)) break
- }
- r && (n.isInvoking = !1, n.containCanceled && n.purgeCanceled())
- }
- }, e.exports = s
- }), {
- "../platform/callbacks-invoker": 211
- }],
- 131: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("../platform/callbacks-invoker"),
- s = n.array.fastRemove;
- function o() {
- r.call(this)
- }
- n.extend(o, r);
- var a = o.prototype;
- a.__on = a.on, a.on = function(t, e, i, n) {
- if (e) return this.hasEventListener(t, e, i) || (this.__on(t, e, i, n), i && i.__eventTargets && i.__eventTargets.push(this)), e;
- cc.errorID(6800)
- }, a.__off = a.off, a.off = function(t, e, i) {
- if (e) this.__off(t, e, i), i && i.__eventTargets && s(i.__eventTargets, this);
- else {
- var n = this._callbackTable[t];
- if (!n) return;
- for (var r = n.callbackInfos, o = 0; o < r.length; ++o) {
- var a = r[o] && r[o].target;
- a && a.__eventTargets && s(a.__eventTargets, this)
- }
- this.removeAll(t)
- }
- }, a.targetOff = function(t) {
- this.removeAll(t), t && t.__eventTargets && s(t.__eventTargets, this)
- }, a.once = function(t, e, i) {
- this.on(t, e, i, !0)
- }, a.dispatchEvent = function(t) {
- this.emit(t.type, t)
- }, cc.EventTarget = e.exports = o
- }), {
- "../platform/callbacks-invoker": 211,
- "../platform/js": 218
- }],
- 132: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- cc.Event = function(t, e) {
- this.type = t, this.bubbles = !!e, this.target = null, this.currentTarget = null, this.eventPhase = 0, this._propagationStopped = !1, this._propagationImmediateStopped = !1
- }, cc.Event.prototype = {
- constructor: cc.Event,
- unuse: function() {
- this.type = cc.Event.NO_TYPE, this.target = null, this.currentTarget = null, this.eventPhase = cc.Event.NONE, this._propagationStopped = !1, this._propagationImmediateStopped = !1
- },
- reuse: function(t, e) {
- this.type = t, this.bubbles = e || !1
- },
- stopPropagation: function() {
- this._propagationStopped = !0
- },
- stopPropagationImmediate: function() {
- this._propagationImmediateStopped = !0
- },
- isStopped: function() {
- return this._propagationStopped || this._propagationImmediateStopped
- },
- getCurrentTarget: function() {
- return this.currentTarget
- },
- getType: function() {
- return this.type
- }
- }, cc.Event.NO_TYPE = "no_type", cc.Event.TOUCH = "touch", cc.Event.MOUSE = "mouse", cc.Event.KEYBOARD = "keyboard", cc.Event.ACCELERATION = "acceleration", cc.Event.NONE = 0, cc.Event.CAPTURING_PHASE = 1, cc.Event.AT_TARGET = 2, cc.Event.BUBBLING_PHASE = 3;
- var r = function(t, e) {
- cc.Event.call(this, t, e), this.detail = null
- };
- n.extend(r, cc.Event), r.prototype.reset = r, r.prototype.setUserData = function(t) {
- this.detail = t
- }, r.prototype.getUserData = function() {
- return this.detail
- }, r.prototype.getEventName = cc.Event.prototype.getType;
- var s = new n.Pool(10);
- r.put = function(t) {
- s.put(t)
- }, r.get = function(t, e) {
- var i = s._get();
- return i ? i.reset(t, e) : i = new r(t, e), i
- }, cc.Event.EventCustom = r, e.exports = cc.Event
- }), {
- "../platform/js": 218
- }],
- 133: [(function(t, e, i) {
- "use strict";
- t("./event"), t("./event-listeners"), t("./event-target"), t("./system-event")
- }), {
- "./event": 132,
- "./event-listeners": 130,
- "./event-target": 131,
- "./system-event": 134
- }],
- 134: [(function(t, e, i) {
- "use strict";
- var n = t("../event/event-target"),
- r = t("../event-manager"),
- s = t("../platform/CCInputManager"),
- o = cc.Enum({
- KEY_DOWN: "keydown",
- KEY_UP: "keyup",
- DEVICEMOTION: "devicemotion"
- }),
- a = null,
- l = null,
- h = cc.Class({
- name: "SystemEvent",
- extends: n,
- statics: {
- EventType: o
- },
- setAccelerometerEnabled: function(t) {
- t && window.DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceMotionEvent.requestPermission().then((function(t) {
- console.log("Device Motion Event request permission: " + t), s.setAccelerometerEnabled("granted" === t)
- })) : s.setAccelerometerEnabled(t)
- },
- setAccelerometerInterval: function(t) {
- s.setAccelerometerInterval(t)
- },
- on: function(t, e, i, n) {
- this._super(t, e, i, n), t !== o.KEY_DOWN && t !== o.KEY_UP || (a || (a = cc.EventListener.create({
- event: cc.EventListener.KEYBOARD,
- onKeyPressed: function(t, e) {
- e.type = o.KEY_DOWN, cc.systemEvent.dispatchEvent(e)
- },
- onKeyReleased: function(t, e) {
- e.type = o.KEY_UP, cc.systemEvent.dispatchEvent(e)
- }
- })), r.hasEventListener(cc.EventListener.ListenerID.KEYBOARD) || r.addListener(a, 1)), t === o.DEVICEMOTION && (l || (l = cc.EventListener.create({
- event: cc.EventListener.ACCELERATION,
- callback: function(t, e) {
- e.type = o.DEVICEMOTION, cc.systemEvent.dispatchEvent(e)
- }
- })), r.hasEventListener(cc.EventListener.ListenerID.ACCELERATION) || r.addListener(l, 1))
- },
- off: function(t, e, i) {
- if (this._super(t, e, i), a && (t === o.KEY_DOWN || t === o.KEY_UP)) {
- var n = this.hasEventListener(o.KEY_DOWN),
- s = this.hasEventListener(o.KEY_UP);
- n || s || r.removeListener(a)
- }
- l && t === o.DEVICEMOTION && r.removeListener(l)
- }
- });
- cc.SystemEvent = e.exports = h, cc.systemEvent = new cc.SystemEvent
- }), {
- "../event-manager": 129,
- "../event/event-target": 131,
- "../platform/CCInputManager": 202
- }],
- 135: [(function(t, e, i) {
- "use strict";
- var n = cc.vmath.vec3,
- r = cc.vmath.mat3,
- s = n.create(),
- o = n.create(),
- a = r.create(),
- l = function(t, e, i) {
- var r = a.m,
- s = i.m;
- r[0] = Math.abs(s[0]), r[1] = Math.abs(s[1]), r[2] = Math.abs(s[2]), r[3] = Math.abs(s[4]), r[4] = Math.abs(s[5]), r[5] = Math.abs(s[6]), r[6] = Math.abs(s[8]), r[7] = Math.abs(s[9]), r[8] = Math.abs(s[10]), n.transformMat3(t, e, a)
- };
- function h(t, e, i, n, r, s) {
- this.center = cc.v3(t, e, i), this.halfExtents = cc.v3(n, r, s)
- }
- var c = h.prototype;
- c.getBoundary = function(t, e) {
- n.sub(t, this.center, this.halfExtents), n.add(e, this.center, this.halfExtents)
- }, c.transform = function(t, e, i, r, s) {
- s || (s = this), n.transformMat4(s.center, this.center, t), l(s.halfExtents, this.halfExtents, t)
- }, h.create = function(t, e, i, n, r, s) {
- return new h(t, e, i, n, r, s)
- }, h.clone = function(t) {
- return new h(t.center.x, t.center.y, t.center.z, t.halfExtents.x, t.halfExtents.y, t.halfExtents.z)
- }, h.copy = function(t, e) {
- return n.copy(t.center, e.center), n.copy(t.halfExtents, e.halfExtents), t
- }, h.fromPoints = function(t, e, i) {
- return n.scale(t.center, n.add(s, e, i), .5), n.scale(t.halfExtents, n.sub(o, i, e), .5), t
- }, h.set = function(t, e, i, r, s, o, a) {
- return n.set(t.center, e, i, r), n.set(t.halfExtents, s, o, a), t
- }, e.exports = h
- }), {}],
- 136: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, cc.geomUtils = {
- Triangle: t("./triangle"),
- Aabb: t("./aabb"),
- Ray: t("./ray"),
- intersect: t("./intersect")
- }, i.default = cc.geomUtils, e.exports = i.default
- }), {
- "./aabb": 135,
- "./intersect": 137,
- "./ray": 138,
- "./triangle": 139
- }],
- 137: [(function(t, e, i) {
- "use strict";
- var n = s(t("../../renderer/gfx")),
- r = s(t("../../renderer/memop/recycle-pool"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var o = t("./aabb"),
- a = t("./ray"),
- l = t("./triangle"),
- h = cc.vmath.mat4,
- c = cc.vmath.vec3,
- u = {};
- u.rayAabb = (function() {
- var t = c.create(),
- e = c.create();
- return function(i, n) {
- var r = i.o,
- s = i.d,
- o = 1 / s.x,
- a = 1 / s.y,
- l = 1 / s.z;
- c.sub(t, n.center, n.halfExtents), c.add(e, n.center, n.halfExtents);
- var h = (t.x - r.x) * o,
- u = (e.x - r.x) * o,
- _ = (t.y - r.y) * a,
- f = (e.y - r.y) * a,
- d = (t.z - r.z) * l,
- p = (e.z - r.z) * l,
- m = Math.max(Math.max(Math.min(h, u), Math.min(_, f)), Math.min(d, p)),
- y = Math.min(Math.min(Math.max(h, u), Math.max(_, f)), Math.max(d, p));
- return y < 0 || m > y ? 0 : m
- }
- })(), u.rayTriangle = (function() {
- var t = c.create(0, 0, 0),
- e = c.create(0, 0, 0),
- i = c.create(0, 0, 0),
- n = c.create(0, 0, 0),
- r = c.create(0, 0, 0);
- return function(s, o) {
- c.sub(t, o.b, o.a), c.sub(e, o.c, o.a), c.cross(i, s.d, e);
- var a = c.dot(t, i);
- if (a <= 0) return 0;
- c.sub(n, s.o, o.a);
- var l = c.dot(n, i);
- if (l < 0 || l > a) return 0;
- c.cross(r, n, t);
- var h = c.dot(s.d, r);
- if (h < 0 || l + h > a) return 0;
- var u = c.dot(e, r) / a;
- return u < 0 ? 0 : u
- }
- })(), u.rayMesh = (function() {
- var t = l.create(),
- e = 1 / 0,
- i = {
- 5120: "getInt8",
- 5121: "getUint8",
- 5122: "getInt16",
- 5123: "getUint16",
- 5124: "getInt32",
- 5125: "getUint32",
- 5126: "getFloat32"
- },
- r = (function() {
- var t = new ArrayBuffer(2);
- return new DataView(t).setInt16(0, 256, !0), 256 === new Int16Array(t)[0]
- })();
- function s(t, e, i, n, s) {
- c.set(t, e[i](s, r), e[i](s += n, r), e[i](s += n, r))
- }
- return function(r, o) {
- e = 1 / 0;
- for (var a = o._subMeshes, l = 0; l < a.length; l++)
- if (a[l]._primitiveType === n.default.PT_TRIANGLES)
- for (var h = o._subDatas[l] || o._subDatas[0], c = h.vData, _ = new DataView(c.buffer, c.byteOffset, c.byteLength), f = h.getIData(Uint16Array), d = h.vfm.element(n.default.ATTR_POSITION), p = d.offset, m = d.stride, y = i[d.type], v = 0; v < f.length; v += 3) {
- s(t.a, _, y, 4, f[v] * m + p), s(t.b, _, y, 4, f[v + 1] * m + p), s(t.c, _, y, 4, f[v + 2] * m + p);
- var g = u.rayTriangle(r, t);
- g > 0 && g < e && (e = g)
- }
- return e
- }
- })(), u.raycast = (function() {
- function t(e, i) {
- for (var n = e.children, r = n.length - 1; r >= 0; r--) {
- t(n[r], i)
- }
- i(e)
- }
- function e(t, e) {
- return t.distance - e.distance
- }
- function i(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y,
- o = e.z,
- a = n[3] * r + n[7] * s + n[11] * o;
- return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o) * a, t.y = (n[1] * r + n[5] * s + n[9] * o) * a, t.z = (n[2] * r + n[6] * s + n[10] * o) * a, t
- }
- var n = new r.default(function() {
- return {
- distance: 0,
- node: null
- }
- }, 1),
- s = [],
- l = o.create(),
- _ = c.create(),
- f = c.create(),
- d = a.create(),
- p = h.create(),
- m = h.create(),
- y = c.create();
- function v(t) {
- return t > 0 && t < 1 / 0
- }
- return function(r, a, g, x) {
- return n.reset(), s.length = 0, t(r = r || cc.director.getScene(), (function(t) {
- if (!x || x(t)) {
- h.invert(m, t.getWorldMatrix(p)), c.transformMat4(d.o, a.o, m), c.normalize(d.d, i(d.d, a.d, m));
- var e = 1 / 0,
- r = t._renderComponent;
- if (r instanceof cc.MeshRenderer ? e = u.rayAabb(d, r._boundingBox) : t.width && t.height && (c.set(_, -t.width * t.anchorX, -t.height * t.anchorY, t.z), c.set(f, t.width * (1 - t.anchorX), t.height * (1 - t.anchorY), t.z), o.fromPoints(l, _, f), e = u.rayAabb(d, l)), v(e) && (g && (e = g(d, t, e)), v(e))) {
- c.scale(y, d.d, e), i(y, y, p);
- var b = n.add();
- b.node = t, b.distance = cc.vmath.vec3.mag(y), s.push(b)
- }
- }
- })), s.sort(e), s
- }
- })(), e.exports = u
- }), {
- "../../renderer/gfx": 360,
- "../../renderer/memop/recycle-pool": 375,
- "./aabb": 135,
- "./ray": 138,
- "./triangle": 139
- }],
- 138: [(function(t, e, i) {
- "use strict";
- var n = cc.vmath.vec3;
- function r(t, e, i, n, r, s) {
- this.o = cc.v3(t, e, i), this.d = cc.v3(n, r, s)
- }
- r.create = function(t, e, i, n, s, o) {
- return new r(t, e, i, n, s, o)
- }, r.clone = function(t) {
- return new r(t.o.x, t.o.y, t.o.z, t.d.x, t.d.y, t.d.z)
- }, r.copy = function(t, e) {
- return t.o.x = e.o.x, t.o.y = e.o.y, t.o.z = e.o.z, t.d.x = e.d.x, t.d.y = e.d.y, t.d.z = e.d.z, t
- }, r.set = function(t, e, i, n, r, s, o) {
- return t.o.x = e, t.o.y = i, t.o.z = n, t.d.x = r, t.d.y = s, t.d.z = o, t
- }, r.fromPoints = function(t, e, i) {
- return n.copy(t.o, e), n.normalize(t.d, n.sub(t.d, i, e)), t
- }, e.exports = r
- }), {}],
- 139: [(function(t, e, i) {
- "use strict";
- var n = cc.vmath.vec3;
- function r(t, e, i, n, r, s, o, a, l) {
- this.a = cc.v3(t, e, i), this.b = cc.v3(n, r, s), this.c = cc.v3(o, a, l)
- }
- r.create = function(t, e, i, n, s, o, a, l, h) {
- return new r(t, e, i, n, s, o, a, l, h)
- }, r.clone = function(t) {
- return new r(t.a.x, t.a.y, t.a.z, t.b.x, t.b.y, t.b.z, t.c.x, t.c.y, t.c.z)
- }, r.copy = function(t, e) {
- return n.copy(t.a, e.a), n.copy(t.b, e.b), n.copy(t.c, e.c), t
- }, r.fromPoints = function(t, e, i, r) {
- return n.copy(t.a, e), n.copy(t.b, i), n.copy(t.c, r), t
- }, r.set = function(t, e, i, n, r, s, o, a, l, h) {
- return t.a.x = e, t.a.y = i, t.a.z = n, t.b.x = r, t.b.y = s, t.b.z = o, t.c.x = a, t.c.y = l, t.c.z = h, t
- }, e.exports = r
- }), {}],
- 140: [(function(t, e, i) {
- "use strict";
- var n = t("../components/CCRenderComponent"),
- r = t("../assets/material/CCMaterial"),
- s = t("./types"),
- o = s.LineCap,
- a = s.LineJoin,
- l = cc.Class({
- name: "cc.Graphics",
- extends: n,
- editor: !1,
- ctor: function() {
- this._impl = new l._Impl(this)
- },
- properties: {
- _lineWidth: 1,
- _strokeColor: cc.Color.BLACK,
- _lineJoin: a.MITER,
- _lineCap: o.BUTT,
- _fillColor: cc.Color.WHITE,
- _miterLimit: 10,
- lineWidth: {
- get: function() {
- return this._lineWidth
- },
- set: function(t) {
- this._lineWidth = t, this._impl.lineWidth = t
- }
- },
- lineJoin: {
- get: function() {
- return this._lineJoin
- },
- set: function(t) {
- this._lineJoin = t, this._impl.lineJoin = t
- },
- type: a
- },
- lineCap: {
- get: function() {
- return this._lineCap
- },
- set: function(t) {
- this._lineCap = t, this._impl.lineCap = t
- },
- type: o
- },
- strokeColor: {
- get: function() {
- return this._strokeColor
- },
- set: function(t) {
- this._impl.strokeColor = this._strokeColor = cc.color(t)
- }
- },
- fillColor: {
- get: function() {
- return this._fillColor
- },
- set: function(t) {
- this._impl.fillColor = this._fillColor = cc.color(t)
- }
- },
- miterLimit: {
- get: function() {
- return this._miterLimit
- },
- set: function(t) {
- this._miterLimit = t, this._impl.miterLimit = t
- }
- }
- },
- statics: {
- LineJoin: a,
- LineCap: o
- },
- onRestore: function() {
- this._impl || (this._impl = new l._Impl(this))
- },
- onEnable: function() {
- this._super(), this._activateMaterial()
- },
- onDestroy: function() {
- this.clear(!0), this._super(), this._impl = null
- },
- _activateMaterial: function() {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
- var t = this.sharedMaterials[0];
- (t = t ? r.getInstantiatedMaterial(t, this) : r.getInstantiatedBuiltinMaterial("2d-base", this)).define("CC_USE_MODEL", !0), this.setMaterial(0, t)
- } else this.disableRender()
- },
- moveTo: function(t, e) {
- this._impl.moveTo(t, e)
- },
- lineTo: function(t, e) {
- this._impl.lineTo(t, e)
- },
- bezierCurveTo: function(t, e, i, n, r, s) {
- this._impl.bezierCurveTo(t, e, i, n, r, s)
- },
- quadraticCurveTo: function(t, e, i, n) {
- this._impl.quadraticCurveTo(t, e, i, n)
- },
- arc: function(t, e, i, n, r, s) {
- this._impl.arc(t, e, i, n, r, s)
- },
- ellipse: function(t, e, i, n) {
- this._impl.ellipse(t, e, i, n)
- },
- circle: function(t, e, i) {
- this._impl.circle(t, e, i)
- },
- rect: function(t, e, i, n) {
- this._impl.rect(t, e, i, n)
- },
- roundRect: function(t, e, i, n, r) {
- this._impl.roundRect(t, e, i, n, r)
- },
- fillRect: function(t, e, i, n) {
- this.rect(t, e, i, n), this.fill()
- },
- clear: function(t) {
- this._impl.clear(t), this._assembler && this._assembler.clear(t)
- },
- close: function() {
- this._impl.close()
- },
- stroke: function() {
- this._assembler || this._resetAssembler(), this._assembler.stroke(this)
- },
- fill: function() {
- this._assembler || this._resetAssembler(), this._assembler.fill(this)
- }
- });
- cc.Graphics = e.exports = l, cc.Graphics.Types = s, cc.Graphics.Helper = t("./helper")
- }), {
- "../assets/material/CCMaterial": 75,
- "../components/CCRenderComponent": 106,
- "./helper": 141,
- "./types": 143
- }],
- 141: [(function(t, e, i) {
- "use strict";
- var n = t("./types").PointFlags,
- r = Math.PI,
- s = Math.min,
- o = Math.max,
- a = Math.cos,
- l = Math.sin,
- h = Math.abs,
- c = Math.sign,
- u = .5522847493;
- e.exports = {
- arc: function(t, e, i, n, c, u, _) {
- var f, d, p, m = 0,
- y = 0,
- v = 0,
- g = 0,
- x = 0,
- b = 0,
- A = 0,
- C = 0,
- T = 0,
- S = 0,
- w = 0,
- E = 0,
- M = 0;
- if (y = u - c, _ = _ || !1)
- if (h(y) >= 2 * r) y = 2 * r;
- else
- for (; y < 0;) y += 2 * r;
- else if (h(y) >= 2 * r) y = 2 * -r;
- else
- for (; y > 0;) y -= 2 * r;
- for (p = 0 | o(1, s(h(y) / (.5 * r) + .5, 5)), v = h(4 / 3 * (1 - a(f = y / p / 2)) / l(f)), _ || (v = -v), d = 0; d <= p; d++) b = e + (g = a(m = c + y * (d / p))) * n, A = i + (x = l(m)) * n, C = -x * n * v, T = g * n * v, 0 === d ? t.moveTo(b, A) : t.bezierCurveTo(S + E, w + M, b - C, A - T, b, A), S = b, w = A, E = C, M = T
- },
- ellipse: function(t, e, i, n, r) {
- t.moveTo(e - n, i), t.bezierCurveTo(e - n, i + r * u, e - n * u, i + r, e, i + r), t.bezierCurveTo(e + n * u, i + r, e + n, i + r * u, e + n, i), t.bezierCurveTo(e + n, i - r * u, e + n * u, i - r, e, i - r), t.bezierCurveTo(e - n * u, i - r, e - n, i - r * u, e - n, i), t.close()
- },
- roundRect: function(t, e, i, n, r, o) {
- if (o < .1) t.rect(e, i, n, r);
- else {
- var a = s(o, .5 * h(n)) * c(n),
- l = s(o, .5 * h(r)) * c(r);
- t.moveTo(e, i + l), t.lineTo(e, i + r - l), t.bezierCurveTo(e, i + r - l * (1 - u), e + a * (1 - u), i + r, e + a, i + r), t.lineTo(e + n - a, i + r), t.bezierCurveTo(e + n - a * (1 - u), i + r, e + n, i + r - l * (1 - u), e + n, i + r - l), t.lineTo(e + n, i + l), t.bezierCurveTo(e + n, i + l * (1 - u), e + n - a * (1 - u), i, e + n - a, i), t.lineTo(e + a, i), t.bezierCurveTo(e + a * (1 - u), i, e, i + l * (1 - u), e, i + l), t.close()
- }
- },
- tesselateBezier: function t(e, i, r, s, o, a, l, c, u, _, f) {
- var d, p, m, y, v, g, x, b, A, C, T, S, w, E, M, D;
- _ > 10 || (v = .5 * (a + c), g = .5 * (l + u), x = .5 * ((d = .5 * (i + s)) + (m = .5 * (s + a))), b = .5 * ((p = .5 * (r + o)) + (y = .5 * (o + l))), ((M = h((s - c) * (E = u - r) - (o - u) * (w = c - i))) + (D = h((a - c) * E - (l - u) * w))) * (M + D) < e._tessTol * (w * w + E * E) ? e._addPoint(c, u, 0 === f ? f | n.PT_BEVEL : f) : (t(e, i, r, d, p, x, b, T = .5 * (x + (A = .5 * (m + v))), S = .5 * (b + (C = .5 * (y + g))), _ + 1, 0), t(e, T, S, A, C, v, g, c, u, _ + 1, f)))
- }
- }
- }), {
- "./types": 143
- }],
- 142: [(function(t, e, i) {
- "use strict";
- t("./graphics")
- }), {
- "./graphics": 140
- }],
- 143: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- BUTT: 0,
- ROUND: 1,
- SQUARE: 2
- }),
- r = cc.Enum({
- BEVEL: 0,
- ROUND: 1,
- MITER: 2
- }),
- s = cc.Enum({
- PT_CORNER: 1,
- PT_LEFT: 2,
- PT_BEVEL: 4,
- PT_INNERBEVEL: 8
- });
- e.exports = {
- LineCap: n,
- LineJoin: r,
- PointFlags: s
- }
- }), {}],
- 144: [(function(t, e, i) {
- "use strict";
- t("./platform"), t("./assets"), t("./CCNode"), t("./CCPrivateNode"), t("./CCScene"), t("./components"), t("./graphics"), t("./collider"), t("./collider/CCIntersection"), t("./physics"), t("./camera/CCCamera"), t("./geom-utils"), t("./mesh"), t("./3d"), t("./3d/polyfill-3d"), t("./base-ui/CCWidgetManager")
- }), {
- "./3d": 29,
- "./3d/polyfill-3d": 30,
- "./CCNode": 52,
- "./CCPrivateNode": 53,
- "./CCScene": 54,
- "./assets": 74,
- "./base-ui/CCWidgetManager": 79,
- "./camera/CCCamera": 80,
- "./collider": 88,
- "./collider/CCIntersection": 86,
- "./components": 123,
- "./geom-utils": 136,
- "./graphics": 142,
- "./mesh": 167,
- "./physics": 182,
- "./platform": 215
- }],
- 145: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("./pipeline"),
- s = t("./loading-items"),
- o = t("./asset-loader"),
- a = t("./downloader"),
- l = t("./loader"),
- h = t("./asset-table"),
- c = t("../platform/utils").callInNextTick,
- u = t("./auto-release-utils"),
- _ = Object.create(null);
- _.assets = new h, _.internal = new h;
- var f = {
- url: null,
- raw: !1
- };
- function d(t) {
- var e, i, n;
- if ("object" == typeof t) {
- if (i = t, t.url) return i;
- e = t.uuid
- } else i = {}, e = t;
- return n = i.type ? "uuid" === i.type : cc.AssetLibrary._uuidInSettings(e), cc.AssetLibrary._getAssetInfoInRuntime(e, f), i.url = n ? f.url : e, f.url && "uuid" === i.type && f.raw ? (i.type = null, i.isRawAsset = !0) : n || (i.isRawAsset = !0), i
- }
- var p = [],
- m = [];
- function y() {
- var t = new o,
- e = new a,
- i = new l;
- r.call(this, [t, e, i]), this.assetLoader = t, this.md5Pipe = null, this.downloader = e, this.loader = i, this.onProgress = null, this._autoReleaseSetting = n.createMap(!0)
- }
- n.extend(y, r);
- var v = y.prototype;
- v.init = function(t) {}, v.getXMLHttpRequest = function() {
- return window.XMLHttpRequest ? new window.XMLHttpRequest : new ActiveXObject("MSXML2.XMLHTTP")
- }, v.addDownloadHandlers = function(t) {
- this.downloader.addHandlers(t)
- }, v.addLoadHandlers = function(t) {
- this.loader.addHandlers(t)
- }, v.load = function(t, e, i) {
- void 0 === i && (i = e, e = this.onProgress || null);
- var n, r = this,
- o = !1;
- t instanceof Array || (t ? (o = !0, t = [t]) : t = []), p.length = 0;
- for (var a = 0; a < t.length; ++a) {
- var l = t[a];
- if (l && l.id && (cc.warnID(4920, l.id), l.uuid || l.url || (l.url = l.id)), (n = d(l)).url || n.uuid) {
- var h = this._cache[n.url];
- p.push(h || n)
- }
- }
- var u = s.create(this, e, (function(t, e) {
- c((function() {
- if (i) {
- if (o) {
- var s = n.url;
- i.call(r, t, e.getContent(s))
- } else i.call(r, t, e);
- i = null
- }
- e.destroy()
- }))
- }));
- s.initQueueDeps(u), u.append(p), p.length = 0
- }, v.flowInDeps = function(t, e, i) {
- m.length = 0;
- for (var n = 0; n < e.length; ++n) {
- var r = d(e[n]);
- if (r.url || r.uuid) {
- var o = this._cache[r.url];
- o ? m.push(o) : m.push(r)
- }
- }
- var a = s.create(this, t ? function(t, e, i) {
- this._ownerQueue && this._ownerQueue.onProgress && this._ownerQueue._childOnProgress(i)
- } : null, (function(e, n) {
- i(e, n), t && t.deps && (t.deps.length = 0), n.destroy()
- }));
- if (t) {
- var l = s.getQueue(t);
- a._ownerQueue = l._ownerQueue || l
- }
- var h = a.append(m, t);
- return m.length = 0, h
- }, v._assetTables = _, v._getResUuid = function(t, e, i, n) {
- var r = _[i = i || "assets"];
- if (!t || !r) return null;
- var s = t.indexOf("?"); - 1 !== s && (t = t.substr(0, s));
- var o = r.getUuid(t, e);
- if (!o) {
- var a = cc.path.extname(t);
- a && (t = t.slice(0, -a.length), (o = r.getUuid(t, e)) && !n && cc.warnID(4901, t, a))
- }
- return o
- }, v._getReferenceKey = function(t) {
- var e;
- return "object" == typeof t ? e = t._uuid || null : "string" == typeof t && (e = this._getResUuid(t, null, null, !0) || t), e ? (cc.AssetLibrary._getAssetInfoInRuntime(e, f), this._cache[f.url] ? f.url : e) : (cc.warnID(4800, t), e)
- }, v._urlNotFound = function(t, e, i) {
- c((function() {
- t = cc.url.normalize(t);
- var r = (e ? n.getClassName(e) : "Asset") + ' in "resources/' + t + '" does not exist.';
- i && i(new Error(r), [])
- }))
- }, v._parseLoadResArgs = function(t, e, i) {
- if (void 0 === i) {
- var r = t instanceof Array || n.isChildClassOf(t, cc.RawAsset);
- e ? (i = e, r && (e = this.onProgress || null)) : void 0 !== e || r || (i = t, e = this.onProgress || null, t = null), void 0 === e || r || (e = t, t = null)
- }
- return {
- type: t,
- onProgress: e,
- onComplete: i
- }
- }, v.loadRes = function(t, e, i, n, r) {
- 5 !== arguments.length && (r = n, n = i, i = "assets");
- var s = this._parseLoadResArgs(e, n, r);
- e = s.type, n = s.onProgress, r = s.onComplete;
- var o = this,
- a = o._getResUuid(t, e, i);
- a ? this.load({
- type: "uuid",
- uuid: a
- }, n, (function(t, e) {
- e && o.setAutoReleaseRecursively(a, !1), r && r(t, e)
- })) : o._urlNotFound(t, e, r)
- }, v._loadResUuids = function(t, e, i, n) {
- if (t.length > 0) {
- var r = this,
- s = t.map((function(t) {
- return {
- type: "uuid",
- uuid: t
- }
- }));
- this.load(s, e, (function(t, e) {
- if (i) {
- for (var o = [], a = n && [], l = 0; l < s.length; ++l) {
- var h = s[l].uuid,
- c = this._getReferenceKey(h),
- u = e.getContent(c);
- u && (r.setAutoReleaseRecursively(h, !1), o.push(u), a && a.push(n[l]))
- }
- n ? i(t, o, a) : i(t, o)
- }
- }))
- } else i && c((function() {
- n ? i(null, [], []) : i(null, [])
- }))
- }, v.loadResArray = function(t, e, i, n, r) {
- 5 !== arguments.length && (r = n, n = i, i = "assets");
- var s = this._parseLoadResArgs(e, n, r);
- e = s.type, n = s.onProgress, r = s.onComplete;
- for (var o = [], a = e instanceof Array, l = 0; l < t.length; l++) {
- var h = t[l],
- c = a ? e[l] : e,
- u = this._getResUuid(h, c, i);
- if (!u) return void this._urlNotFound(h, c, r);
- o.push(u)
- }
- this._loadResUuids(o, n, r)
- }, v.loadResDir = function(t, e, i, n, r) {
- if (5 !== arguments.length && (r = n, n = i, i = "assets"), _[i]) {
- var s = this._parseLoadResArgs(e, n, r);
- e = s.type, n = s.onProgress, r = s.onComplete;
- var o = [],
- a = _[i].getUuidArray(t, e, o);
- this._loadResUuids(a, n, r, o)
- }
- }, v.getRes = function(t, e) {
- var i = this._cache[t];
- if (!i) {
- var n = this._getResUuid(t, e, null, !0);
- if (!n) return null;
- var r = this._getReferenceKey(n);
- i = this._cache[r]
- }
- return i && i.alias && (i = i.alias), i && i.complete ? i.content : null
- }, v.getResCount = function() {
- return Object.keys(this._cache).length
- }, v.getDependsRecursively = function(t) {
- if (t) {
- var e = this._getReferenceKey(t),
- i = u.getDependsRecursively(e);
- return i.push(e), i
- }
- return []
- }, v.release = function(t) {
- if (Array.isArray(t))
- for (var e = 0; e < t.length; e++) {
- var i = t[e];
- this.release(i)
- } else if (t) {
- var n = this._getReferenceKey(t);
- if (n && n in cc.AssetLibrary.getBuiltinDeps()) return;
- var r = this.getItem(n);
- if (r) {
- this.removeItem(n);
- t = r.content
- }
- if (t instanceof cc.Asset) {
- var s = t.nativeUrl;
- s && this.release(s), t.destroy()
- }
- }
- }, v.releaseAsset = function(t) {
- var e = t._uuid;
- e && this.release(e)
- }, v.releaseRes = function(t, e, i) {
- var n = this._getResUuid(t, e, i);
- n ? this.release(n) : cc.errorID(4914, t)
- }, v.releaseResDir = function(t, e, i) {
- if (_[i = i || "assets"])
- for (var n = _[i].getUuidArray(t, e), r = 0; r < n.length; r++) {
- var s = n[r];
- this.release(s)
- }
- }, v.releaseAll = function() {
- for (var t in this._cache) this.release(t)
- }, v.removeItem = function(t) {
- var e = r.prototype.removeItem.call(this, t);
- return delete this._autoReleaseSetting[t], e
- }, v.setAutoRelease = function(t, e) {
- var i = this._getReferenceKey(t);
- i && (this._autoReleaseSetting[i] = !!e)
- }, v.setAutoReleaseRecursively = function(t, e) {
- e = !!e;
- var i = this._getReferenceKey(t);
- if (i) {
- this._autoReleaseSetting[i] = e;
- for (var n = u.getDependsRecursively(i), r = 0; r < n.length; r++) {
- var s = n[r];
- this._autoReleaseSetting[s] = e
- }
- } else 0
- }, v.isAutoRelease = function(t) {
- var e = this._getReferenceKey(t);
- return !!e && !!this._autoReleaseSetting[e]
- }, cc.loader = new y, e.exports = cc.loader
- }), {
- "../platform/js": 218,
- "../platform/utils": 222,
- "./asset-loader": 146,
- "./asset-table": 147,
- "./auto-release-utils": 149,
- "./downloader": 151,
- "./loader": 154,
- "./loading-items": 155,
- "./pipeline": 158,
- "./released-asset-checker": 159
- }],
- 146: [(function(t, e, i) {
- "use strict";
- t("../utils/CCPath");
- var n = t("../CCDebug"),
- r = t("./pipeline"),
- s = t("./loading-items"),
- o = "AssetLoader",
- a = function(t) {
- this.id = o, this.async = !0, this.pipeline = null
- };
- a.ID = o;
- var l = [];
- a.prototype.handle = function(t, e) {
- var i = t.uuid;
- if (!i) return t.content || null;
- cc.AssetLibrary.queryAssetInfo(i, (function(r, o, a) {
- if (r) e(r);
- else if (t.url = t.rawUrl = o, t.isRawAsset = a, a) {
- var h = cc.path.extname(o).toLowerCase();
- if (!h) return void e(new Error(n.getError(4931, i, o)));
- h = h.substr(1);
- var c = s.getQueue(t);
- l[0] = {
- queueId: t.queueId,
- id: o,
- url: o,
- type: h,
- error: null,
- alias: t,
- complete: !0
- }, c.append(l), t.type = h, e(null, t.content)
- } else t.type = "uuid", e(null, t.content)
- }))
- }, r.AssetLoader = e.exports = a
- }), {
- "../CCDebug": 49,
- "../utils/CCPath": 289,
- "./loading-items": 155,
- "./pipeline": 158
- }],
- 147: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/misc").pushToMap,
- r = t("../platform/js");
- function s(t, e) {
- this.uuid = t, this.type = e
- }
- function o() {
- this._pathToUuid = r.createMap(!0)
- }
- function a(t, e) {
- if (t.length > e.length) {
- var i = t.charCodeAt(e.length);
- return 46 === i || 47 === i
- }
- return !0
- }
- var l = o.prototype;
- l.getUuid = function(t, e) {
- t = cc.url.normalize(t);
- var i = this._pathToUuid[t];
- if (i)
- if (Array.isArray(i)) {
- if (!e) return i[0].uuid;
- for (var n = 0; n < i.length; n++) {
- var s = i[n];
- if (r.isChildClassOf(s.type, e)) return s.uuid
- }
- } else {
- if (!e || r.isChildClassOf(i.type, e)) return i.uuid
- }
- return ""
- }, l.getUuidArray = function(t, e, i) {
- "/" === (t = cc.url.normalize(t))[t.length - 1] && (t = t.slice(0, -1));
- var n = this._pathToUuid,
- s = [],
- o = r.isChildClassOf;
- for (var l in n)
- if (l.startsWith(t) && a(l, t) || !t) {
- var h = n[l];
- if (Array.isArray(h))
- for (var c = 0; c < h.length; c++) {
- var u = h[c];
- (!e || o(u.type, e)) && (s.push(u.uuid), i && i.push(l))
- } else(!e || o(h.type, e)) && (s.push(h.uuid), i && i.push(l))
- }
- return s
- }, l.add = function(t, e, i, r) {
- t = t.substring(0, t.length - cc.path.extname(t).length);
- var o = new s(e, i);
- n(this._pathToUuid, t, o, r)
- }, l._getInfo_DEBUG = !1, l.reset = function() {
- this._pathToUuid = r.createMap(!0)
- }, e.exports = o
- }), {
- "../platform/js": 218,
- "../utils/misc": 300
- }],
- 148: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/CCSys"),
- r = t("../CCDebug"),
- s = n.__audioSupport,
- o = s.format,
- a = s.context;
- function l(t, e) {
- var i = document.createElement("audio");
- i.src = t.url;
- var n = function() {
- clearTimeout(r), i.removeEventListener("canplaythrough", o, !1), i.removeEventListener("error", a, !1), s.USE_LOADER_EVENT && i.removeEventListener(s.USE_LOADER_EVENT, o, !1)
- },
- r = setTimeout((function() {
- 0 === i.readyState ? a() : o()
- }), 8e3),
- o = function() {
- n(), e(null, i)
- },
- a = function() {
- n();
- var i = "load audio failure - " + t.url;
- cc.log(i), e(i)
- };
- i.addEventListener("canplaythrough", o, !1), i.addEventListener("error", a, !1), s.USE_LOADER_EVENT && i.addEventListener(s.USE_LOADER_EVENT, o, !1)
- }
- function h(t, e) {
- a || e(new Error(r.getError(4926)));
- var i = cc.loader.getXMLHttpRequest();
- i.open("GET", t.url, !0), i.responseType = "arraybuffer", i.onload = function() {
- a.decodeAudioData(i.response, (function(t) {
- e(null, t)
- }), (function() {
- e("decode error - " + t.id, null)
- }))
- }, i.onerror = function() {
- e("request error - " + t.id, null)
- }, i.send()
- }
- e.exports = function(t, e) {
- if (0 === o.length) return new Error(r.getError(4927));
- var i;
- i = s.WEB_AUDIO ? t._owner instanceof cc.AudioClip ? t._owner.loadMode === cc.AudioClip.LoadMode.WEB_AUDIO ? h : l : t.urlParam && t.urlParam.useDom ? l : h : l, i(t, e)
- }
- }), {
- "../CCDebug": 49,
- "../platform/CCSys": 207
- }],
- 149: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- function r(t, e) {
- var i = cc.loader.getItem(t);
- if (i) {
- var n = i.dependKeys;
- if (n)
- for (var s = 0; s < n.length; s++) {
- var o = n[s];
- e[o] || (e[o] = !0, r(o, e))
- }
- }
- }
- function s(t, e) {
- if (t._uuid) {
- var i = cc.loader._getReferenceKey(t);
- e[i] || (e[i] = !0, r(i, e))
- }
- }
- function o(t, e) {
- for (var i = Object.getOwnPropertyNames(t), n = 0; n < i.length; n++) {
- var r = t[i[n]];
- if ("object" == typeof r && r)
- if (Array.isArray(r))
- for (var o = 0; o < r.length; o++) {
- var a = r[o];
- a instanceof cc.RawAsset && s(a, e)
- } else if (r.constructor && r.constructor !== Object) r instanceof cc.RawAsset && s(r, e);
- else
- for (var l = Object.getOwnPropertyNames(r), h = 0; h < l.length; h++) {
- var c = r[l[h]];
- c instanceof cc.RawAsset && s(c, e)
- }
- }
- }
- function a(t, e) {
- for (var i = 0; i < t._components.length; i++) o(t._components[i], e);
- for (var n = 0; n < t._children.length; n++) a(t._children[n], e)
- }
- e.exports = {
- autoRelease: function(t, e, i) {
- var r = cc.loader._autoReleaseSetting,
- s = n.createMap();
- if (e)
- for (var o = 0; o < e.length; o++) s[e[o]] = !0;
- for (var l = 0; l < i.length; l++) a(i[l], s);
- if (t)
- for (var h = 0; h < t.length; h++) {
- var c = t[h];
- !1 === r[c] || s[c] || cc.loader.release(c)
- }
- for (var u = Object.keys(r), _ = 0; _ < u.length; _++) {
- var f = u[_];
- !0 !== r[f] || s[f] || cc.loader.release(f)
- }
- },
- getDependsRecursively: function(t) {
- var e = {};
- return r(t, e), Object.keys(e)
- }
- }
- }), {
- "../platform/js": 218
- }],
- 150: [(function(t, e, i) {
- "use strict";
- e.exports = function(t, e) {
- var i = t.url,
- n = cc.loader.getXMLHttpRequest(),
- r = "Load binary data failed: " + i;
- n.open("GET", i, !0), n.responseType = "arraybuffer", n.onload = function() {
- var t = n.response;
- if (t) {
- var i = new Uint8Array(t);
- e(null, i)
- } else e({
- status: n.status,
- errorMessage: r + "(no response)"
- })
- }, n.onerror = function() {
- e({
- status: n.status,
- errorMessage: r + "(error)"
- })
- }, n.ontimeout = function() {
- e({
- status: n.status,
- errorMessage: r + "(time out)"
- })
- }, n.send(null)
- }
- }), {}],
- 151: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("../CCDebug");
- t("../utils/CCPath");
- var s, o = t("./pipeline"),
- a = t("./pack-downloader"),
- l = t("./binary-downloader"),
- h = t("./text-downloader"),
- c = t("./utils").urlAppendTimestamp;
- function u() {
- return null
- }
- function _(t, e, i) {
- var n = t.url,
- s = document,
- o = document.createElement("script");
- function a() {
- o.parentNode.removeChild(o), o.removeEventListener("load", a, !1), o.removeEventListener("error", l, !1), e(null, n)
- }
- function l() {
- o.parentNode.removeChild(o), o.removeEventListener("load", a, !1), o.removeEventListener("error", l, !1), e(new Error(r.getError(4928, n)))
- }
- "file:" !== window.location.protocol && (o.crossOrigin = "anonymous"), o.async = i, o.src = c(n), o.addEventListener("load", a, !1), o.addEventListener("error", l, !1), s.body.appendChild(o)
- }
- function f(t, e, i, n) {
- void 0 === i && (i = !0);
- var s = c(t.url);
- if (n = n || new Image, i && "file:" !== window.location.protocol ? n.crossOrigin = "anonymous" : n.crossOrigin = null, n.complete && n.naturalWidth > 0 && n.src === s) return n;
- var o = function i() {
- n.removeEventListener("load", i), n.removeEventListener("error", a), n.id = t.id, e(null, n)
- },
- a = function i() {
- n.removeEventListener("load", o), n.removeEventListener("error", i), "https:" !== window.location.protocol && n.crossOrigin && "anonymous" === n.crossOrigin.toLowerCase() ? f(t, e, !1, n) : e(new Error(r.getError(4930, s)))
- };
- n.addEventListener("load", o), n.addEventListener("error", a), n.src = s
- }
- var d = {
- js: _,
- png: f,
- jpg: f,
- bmp: f,
- jpeg: f,
- gif: f,
- ico: f,
- tiff: f,
- webp: f,
- image: f,
- pvr: l,
- pkm: l,
- mp3: s = t("./audio-downloader"),
- ogg: s,
- wav: s,
- m4a: s,
- txt: h,
- xml: h,
- vsh: h,
- fsh: h,
- atlas: h,
- tmx: h,
- tsx: h,
- json: h,
- ExportJson: h,
- plist: h,
- fnt: h,
- font: u,
- eot: u,
- ttf: u,
- woff: u,
- svg: u,
- ttc: u,
- uuid: function(t, e) {
- var i = a.load(t, e);
- return void 0 === i ? this.extMap.json(t, e) : i || void 0
- },
- binary: l,
- bin: l,
- dbbin: l,
- default: h
- },
- p = "Downloader",
- m = function(t) {
- this.id = p, this.async = !0, this.pipeline = null, this._curConcurrent = 0, this._loadQueue = [], this._subpackages = {}, this.extMap = n.mixin(t, d)
- };
- m.ID = p, m.PackDownloader = a, m.prototype.addHandlers = function(t) {
- n.mixin(this.extMap, t)
- }, m.prototype._handleLoadQueue = function() {
- for (; this._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT;) {
- var t = this._loadQueue.shift();
- if (!t) break;
- var e = this.handle(t.item, t.callback);
- void 0 !== e && (e instanceof Error ? t.callback(e) : t.callback(null, e))
- }
- }, m.prototype.handle = function(t, e) {
- var i = this,
- n = this.extMap[t.type] || this.extMap.default,
- r = void 0;
- if (this._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT) {
- if (this._curConcurrent++, void 0 !== (r = n.call(this, t, (function(t, n) {
- i._curConcurrent = Math.max(0, i._curConcurrent - 1), i._handleLoadQueue(), e && e(t, n)
- })))) return this._curConcurrent = Math.max(0, this._curConcurrent - 1), this._handleLoadQueue(), r
- } else if (t.ignoreMaxConcurrency) {
- if (void 0 !== (r = n.call(this, t, e))) return r
- } else this._loadQueue.push({
- item: t,
- callback: e
- })
- }, m.prototype.loadSubpackage = function(t, e) {
- var i = this._subpackages[t];
- i ? i.loaded ? e && e() : _({
- url: i.path + "index.js"
- }, (function(t) {
- t || (i.loaded = !0), e && e(t)
- })) : e && e(new Error("Can't find subpackage " + t))
- }, o.Downloader = e.exports = m
- }), {
- "../CCDebug": 49,
- "../platform/js": 218,
- "../utils/CCPath": 289,
- "./audio-downloader": 148,
- "./binary-downloader": 150,
- "./pack-downloader": 157,
- "./pipeline": 158,
- "./text-downloader": 161,
- "./utils": 163
- }],
- 152: [(function(t, e, i) {
- "use strict";
- var n = t("../utils/text-utils"),
- r = null,
- s = "BES bswy:->@123\u4e01\u3041\u1101",
- o = {},
- a = -1,
- l = [],
- h = 3e3,
- c = (function() {
- var t = void 0;
- return function() {
- if (void 0 === t)
- if (window.FontFace) {
- var e = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),
- i = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor);
- t = e ? parseInt(e[1], 10) > 42 : !i
- } else t = !1;
- return t
- }
- })();
- function u() {
- for (var t = !0, e = Date.now(), i = l.length - 1; i >= 0; i--) {
- var o = l[i],
- c = o.fontFamilyName;
- if (e - o.startTime > h) cc.warnID(4933, c), o.callback(null, c), l.splice(i, 1);
- else {
- var u = o.refWidth;
- r.font = "40px " + c, u !== n.safeMeasureText(r, s) ? (l.splice(i, 1), o.callback(null, c)) : t = !1
- }
- }
- t && (clearInterval(a), a = -1)
- }
- function _(t, e, i) {
- var n = new Promise(function(i, n) {
- (function r() {
- Date.now() - t >= h ? n() : document.fonts.load("40px " + e).then((function(t) {
- t.length >= 1 ? i() : setTimeout(r, 100)
- }), (function() {
- n()
- }))
- })()
- }),
- r = null,
- s = new Promise(function(t, e) {
- r = setTimeout(e, h)
- });
- Promise.race([s, n]).then((function() {
- r && (clearTimeout(r), r = null), i(null, e)
- }), (function() {
- cc.warnID(4933, e), i(null, e)
- }))
- }
- var f = {
- loadFont: function(t, e) {
- var i = t.url,
- h = f._getFontFamily(i);
- if (o[h]) return h;
- if (!r) {
- var d = document.createElement("canvas");
- d.width = 100, d.height = 100, r = d.getContext("2d")
- }
- var p = "40px " + h;
- r.font = p;
- var m = n.safeMeasureText(r, s),
- y = document.createElement("style");
- y.type = "text/css";
- var v = "";
- isNaN(h - 0) ? v += "@font-face { font-family:" + h + "; src:" : v += "@font-face { font-family:'" + h + "'; src:", v += "url('" + i + "');", y.textContent = v + "}", document.body.appendChild(y);
- var g = document.createElement("div"),
- x = g.style;
- if (x.fontFamily = h, g.innerHTML = ".", x.position = "absolute", x.left = "-100px", x.top = "-100px", document.body.appendChild(g), c()) _(Date.now(), h, e);
- else {
- var b = {
- fontFamilyName: h,
- refWidth: m,
- callback: e,
- startTime: Date.now()
- };
- l.push(b), -1 === a && (a = setInterval(u, 100))
- }
- o[h] = y
- },
- _getFontFamily: function(t) {
- var e = t.lastIndexOf(".ttf");
- if (-1 === e) return t;
- var i, n = t.lastIndexOf("/");
- return -1 !== (i = -1 === n ? t.substring(0, e) + "_LABEL" : t.substring(n + 1, e) + "_LABEL").indexOf(" ") && (i = '"' + i + '"'), i
- }
- };
- e.exports = f
- }), {
- "../utils/text-utils": 307
- }],
- 153: [(function(t, e, i) {
- "use strict";
- t("./downloader"), t("./loader"), t("./loading-items"), t("./pipeline"), t("./CCLoader")
- }), {
- "./CCLoader": 145,
- "./downloader": 151,
- "./loader": 154,
- "./loading-items": 155,
- "./pipeline": 158
- }],
- 154: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("../platform/CCSAXParser").plistParser,
- s = t("./pipeline"),
- o = t("../assets/CCTexture2D"),
- a = t("./uuid-loader"),
- l = t("./font-loader");
- function h(t) {
- if ("string" != typeof t.content) return new Error("JSON Loader: Input item doesn't contain string content");
- try {
- return JSON.parse(t.content)
- } catch (e) {
- return new Error("JSON Loader: Parse json [" + t.id + "] failed : " + e)
- }
- }
- function c(t) {
- if (t._owner instanceof cc.Asset) return null;
- var e = t.content;
- if (cc.sys.platform !== cc.sys.FB_PLAYABLE_ADS && !(e instanceof Image)) return new Error("Image Loader: Input item doesn't contain Image content");
- var i = t.texture || new o;
- return i._uuid = t.uuid, i.url = t.url, i._setRawAsset(t.rawUrl, !1), i._nativeAsset = e, i
- }
- function u(t, e) {
- if (t._owner instanceof cc.Asset) return null;
- var i = new cc.AudioClip;
- return i._setRawAsset(t.rawUrl, !1), i._nativeAsset = t.content, i.url = t.url, i
- }
- function _(t) {
- return t.load ? t.load(t.content) : null
- }
- var f = 13,
- d = 55727696,
- p = 0,
- m = 6,
- y = 7,
- v = 12;
- var g = 16,
- x = 6,
- b = 8,
- A = 10,
- C = 12,
- T = 14,
- S = 0,
- w = 1,
- E = 3;
- function M(t, e) {
- return t[e] << 8 | t[e + 1]
- }
- var D = {
- png: c,
- jpg: c,
- bmp: c,
- jpeg: c,
- gif: c,
- ico: c,
- tiff: c,
- webp: c,
- image: c,
- pvr: function(t) {
- var e = t.content instanceof ArrayBuffer ? t.content : t.content.buffer,
- i = new Int32Array(e, 0, f);
- if (i[p] != d) return new Error("Invalid magic number in PVR header");
- var n = i[y],
- r = i[m],
- s = i[v] + 52;
- return {
- _data: new Uint8Array(e, s),
- _compressed: !0,
- width: n,
- height: r
- }
- },
- pkm: function(t) {
- var e = t.content instanceof ArrayBuffer ? t.content : t.content.buffer,
- i = new Uint8Array(e),
- n = M(i, x);
- if (n !== S && n !== w && n !== E) return new Error("Invalid magic number in ETC header");
- var r = M(i, C),
- s = M(i, T);
- return M(i, b), M(i, A), {
- _data: new Uint8Array(e, g),
- _compressed: !0,
- width: r,
- height: s
- }
- },
- mp3: u,
- ogg: u,
- wav: u,
- m4a: u,
- json: h,
- ExportJson: h,
- plist: function(t) {
- if ("string" != typeof t.content) return new Error("Plist Loader: Input item doesn't contain string content");
- var e = r.parse(t.content);
- return e || new Error("Plist Loader: Parse [" + t.id + "] failed")
- },
- uuid: a,
- prefab: a,
- fire: a,
- scene: a,
- binary: _,
- dbbin: _,
- bin: _,
- font: l.loadFont,
- eot: l.loadFont,
- ttf: l.loadFont,
- woff: l.loadFont,
- svg: l.loadFont,
- ttc: l.loadFont,
- default: function() {
- return null
- }
- },
- B = function(t) {
- this.id = "Loader", this.async = !0, this.pipeline = null, this.extMap = n.mixin(t, D)
- };
- B.ID = "Loader", B.prototype.addHandlers = function(t) {
- this.extMap = n.mixin(this.extMap, t)
- }, B.prototype.handle = function(t, e) {
- return (this.extMap[t.type] || this.extMap.default).call(this, t, e)
- }, s.Loader = e.exports = B
- }), {
- "../assets/CCTexture2D": 73,
- "../platform/CCSAXParser": 205,
- "../platform/js": 218,
- "./font-loader": 152,
- "./pipeline": 158,
- "./uuid-loader": 164
- }],
- 155: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/callbacks-invoker");
- t("../utils/CCPath");
- var r = t("../platform/js"),
- s = 0 | 998 * Math.random(),
- o = r.createMap(!0),
- a = [],
- l = {
- WORKING: 1,
- COMPLETE: 2,
- ERROR: 3
- },
- h = r.createMap(!0);
- function c(t) {
- return "string" == typeof(t.url || t)
- }
- function u(t) {
- if (t) {
- var e = t.split("?");
- if (e && e[0] && e[1]) {
- var i = {};
- return e[1].split("&").forEach((function(t) {
- var e = t.split("=");
- i[e[0]] = e[1]
- })), i
- }
- }
- }
- function _(t, e) {
- var i = "object" == typeof t ? t.url : t,
- n = {
- queueId: e,
- id: i,
- url: i,
- rawUrl: void 0,
- urlParam: u(i),
- type: "",
- error: null,
- content: null,
- complete: !1,
- states: {},
- deps: null
- };
- if ("object" == typeof t && (r.mixin(n, t), t.skips))
- for (var s = 0; s < t.skips.length; s++) {
- var o = t.skips[s];
- n.states[o] = l.COMPLETE
- }
- return n.rawUrl = n.url, i && !n.type && (n.type = cc.path.extname(i).toLowerCase().substr(1)), n
- }
- var f = [];
- function d(t, e, i) {
- if (!t || !e) return !1;
- var n = !1;
- if (f.push(e.id), e.deps) {
- var r, s, o = e.deps;
- for (r = 0; r < o.length; r++) {
- if ((s = o[r]).id === t.id) {
- n = !0;
- break
- }
- if (!(f.indexOf(s.id) >= 0) && (s.deps && d(t, s, !0))) {
- n = !0;
- break
- }
- }
- }
- return i || (f.length = 0), n
- }
- var p = function(t, e, i, a) {
- n.call(this), this._id = ++s, o[this._id] = this, this._pipeline = t, this._errorUrls = r.createMap(!0), this._appending = !1, this._ownerQueue = null, this.onProgress = i, this.onComplete = a, this.map = r.createMap(!0), this.completed = {}, this.totalCount = 0, this.completedCount = 0, this._pipeline ? this.active = !0 : this.active = !1, e && (e.length > 0 ? this.append(e) : this.allComplete())
- };
- p.ItemState = new cc.Enum(l), p.create = function(t, e, i, n) {
- void 0 === i ? "function" == typeof e && (n = e, e = i = null) : void 0 === n && ("function" == typeof e ? (n = i, i = e, e = null) : (n = i, i = null));
- var r = a.pop();
- return r ? (r._pipeline = t, r.onProgress = i, r.onComplete = n, o[r._id] = r, r._pipeline && (r.active = !0), e && r.append(e)) : r = new p(t, e, i, n), r
- }, p.getQueue = function(t) {
- return t.queueId ? o[t.queueId] : null
- }, p.itemComplete = function(t) {
- var e = o[t.queueId];
- e && e.itemComplete(t.id)
- }, p.initQueueDeps = function(t) {
- var e = h[t._id];
- e ? (e.completed.length = 0, e.deps.length = 0) : e = h[t._id] = {
- completed: [],
- deps: []
- }
- }, p.registerQueueDep = function(t, e) {
- var i = t.queueId || t;
- if (!i) return !1;
- var n = h[i];
- if (n) - 1 === n.deps.indexOf(e) && n.deps.push(e);
- else if (t.id)
- for (var r in h) {
- var s = h[r]; - 1 !== s.deps.indexOf(t.id) && -1 === s.deps.indexOf(e) && s.deps.push(e)
- }
- }, p.finishDep = function(t) {
- for (var e in h) {
- var i = h[e]; - 1 !== i.deps.indexOf(t) && -1 === i.completed.indexOf(t) && i.completed.push(t)
- }
- };
- var m = p.prototype;
- r.mixin(m, n.prototype), m.append = function(t, e) {
- if (!this.active) return [];
- e && !e.deps && (e.deps = []), this._appending = !0;
- var i, n, r, s = [];
- for (i = 0; i < t.length; ++i)
- if (!(n = t[i]).queueId || this.map[n.id]) {
- if (c(n)) {
- var a = (r = _(n, this._id)).id;
- this.map[a] || (this.map[a] = r, this.totalCount++, e && e.deps.push(r), p.registerQueueDep(e || this._id, a), s.push(r))
- }
- } else {
- if (this.map[n.id] = n, e && e.deps.push(n), n.complete || d(e, n)) {
- this.totalCount++, this.itemComplete(n.id);
- continue
- }
- var l = this,
- h = o[n.queueId];
- h && (this.totalCount++, p.registerQueueDep(e || this._id, n.id), h.addListener(n.id, (function(t) {
- l.itemComplete(t.id)
- })))
- }
- return this._appending = !1, this.completedCount === this.totalCount ? this.allComplete() : this._pipeline.flowIn(s), s
- }, m._childOnProgress = function(t) {
- if (this.onProgress) {
- var e = h[this._id];
- this.onProgress(e ? e.completed.length : this.completedCount, e ? e.deps.length : this.totalCount, t)
- }
- }, m.allComplete = function() {
- var t = r.isEmptyObject(this._errorUrls) ? null : this._errorUrls;
- this.onComplete && this.onComplete(t, this)
- }, m.isCompleted = function() {
- return this.completedCount >= this.totalCount
- }, m.isItemCompleted = function(t) {
- return !!this.completed[t]
- }, m.exists = function(t) {
- return !!this.map[t]
- }, m.getContent = function(t) {
- var e = this.map[t],
- i = null;
- return e && (e.content ? i = e.content : e.alias && (i = e.alias.content)), i
- }, m.getError = function(t) {
- var e = this.map[t],
- i = null;
- return e && (e.error ? i = e.error : e.alias && (i = e.alias.error)), i
- }, m.addListener = n.prototype.on, m.hasListener = n.prototype.hasEventListener, m.removeListener = n.prototype.off, m.removeAllListeners = n.prototype.removeAll, m.removeItem = function(t) {
- var e = this.map[t];
- e && this.completed[e.alias || t] && (delete this.completed[t], delete this.map[t], e.alias && (delete this.completed[e.alias.id], delete this.map[e.alias.id]), this.completedCount--, this.totalCount--)
- }, m.itemComplete = function(t) {
- var e = this.map[t];
- if (e) {
- var i = t in this._errorUrls;
- if (e.error instanceof Error || r.isString(e.error) ? this._errorUrls[t] = e.error : e.error ? r.mixin(this._errorUrls, e.error) : !e.error && i && delete this._errorUrls[t], this.completed[t] = e, this.completedCount++, p.finishDep(e.id), this.onProgress) {
- var n = h[this._id];
- this.onProgress(n ? n.completed.length : this.completedCount, n ? n.deps.length : this.totalCount, e)
- }
- this.emit(t, e), this.removeAll(t), !this._appending && this.completedCount >= this.totalCount && this.allComplete()
- }
- }, m.destroy = function() {
- this.active = !1, this._appending = !1, this._pipeline = null, this._ownerQueue = null, r.clear(this._errorUrls), this.onProgress = null, this.onComplete = null, this.map = r.createMap(!0), this.completed = {}, this.totalCount = 0, this.completedCount = 0, n.call(this), h[this._id] && (h[this._id].completed.length = 0, h[this._id].deps.length = 0), delete o[this._id], delete h[this._id], -1 === a.indexOf(this) && a.length < 10 && a.push(this)
- }, cc.LoadingItems = e.exports = p
- }), {
- "../platform/callbacks-invoker": 211,
- "../platform/js": 218,
- "../utils/CCPath": 289
- }],
- 156: [(function(t, e, i) {
- "use strict";
- var n = t("./pipeline"),
- r = "MD5Pipe",
- s = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/,
- o = function(t, e, i) {
- this.id = r, this.async = !1, this.pipeline = null, this.md5AssetsMap = t, this.md5NativeAssetsMap = e, this.libraryBase = i
- };
- o.ID = r, o.prototype.handle = function(t) {
- return t.url = this.transformURL(t.url), null
- }, o.prototype.transformURL = function(t) {
- var e = !t.startsWith(this.libraryBase) ? this.md5NativeAssetsMap : this.md5AssetsMap;
- return t = t.replace(s, (function(t, i) {
- var n = e[i];
- return n ? t + "." + n : t
- }))
- }, n.MD5Pipe = e.exports = o
- }), {
- "./pipeline": 158
- }],
- 157: [(function(t, e, i) {
- "use strict";
- var n = t("./unpackers"),
- r = t("../utils/misc").pushToMap,
- s = {
- Invalid: 0,
- Removed: 1,
- Downloading: 2,
- Loaded: 3
- };
- function o() {
- this.unpacker = null, this.state = s.Invalid, this.duration = 0
- }
- var a = {},
- l = {},
- h = {},
- c = [],
- u = null;
- function _(t, e) {
- return new Error("Can not retrieve " + t + " from packer " + e)
- }
- e.exports = {
- msToRelease: 12e4,
- initPacks: function(t) {
- for (var e in l = t, a = {}, t)
- for (var i = t[e], n = 0; n < i.length; n++) {
- var s = i[n],
- o = 1 === i.length;
- r(a, s, e, o)
- }
- },
- _loadNewPack: function(t, e, i) {
- var n = this,
- r = cc.AssetLibrary.getLibUrlNoExt(e) + ".json";
- cc.loader.load({
- url: r,
- ignoreMaxConcurrency: !0
- }, (function(s, o) {
- if (s) return cc.errorID(4916, t), i(s);
- h[e].url = r;
- var a = n._doLoadNewPack(t, e, o);
- a ? i(null, a) : i(_(t, e))
- }))
- },
- _doPreload: function(t, e) {
- var i = h[t];
- i || ((i = h[t] = new o).state = s.Downloading), i.state !== s.Loaded && (i.unpacker = new n.JsonUnpacker, i.unpacker.load(l[t], e), i.state = s.Loaded)
- },
- _doLoadNewPack: function(t, e, i) {
- var r = h[e];
- if (r.state !== s.Loaded) {
- "string" == typeof i && (i = JSON.parse(i)), Array.isArray(i) ? r.unpacker = new n.JsonUnpacker : i.type === n.TextureUnpacker.ID && (r.unpacker = new n.TextureUnpacker), r.unpacker.load(l[e], i), r.state = s.Loaded, r.duration = 0, c.push(e);
- var o = this;
- u || (u = setInterval((function() {
- for (var t = o.msToRelease / 5e3, e = c.length - 1; e >= 0; e--) {
- var i = c[e];
- ++h[i].duration > t && o.release(i)
- }
- 0 === c.length && (clearInterval(u), u = null)
- }), 5e3))
- }
- return r.unpacker.retrieve(t)
- },
- _selectLoadedPack: function(t) {
- for (var e = s.Invalid, i = "", n = 0; n < t.length; n++) {
- var r = t[n],
- o = h[r];
- if (o) {
- var a = o.state;
- if (a === s.Loaded) return r;
- a > e && (e = a, i = r)
- }
- }
- return e !== s.Invalid ? i : t[0]
- },
- load: function(t, e) {
- var i = t.uuid,
- n = a[i];
- if (n) {
- Array.isArray(n) && (n = this._selectLoadedPack(n));
- var r = h[n];
- if (r && r.state === s.Loaded) {
- r.duration = 0;
- var l = r.unpacker.retrieve(i);
- return l || _(i, n)
- }
- return r || (console.log("Create unpacker %s for %s", n, i), (r = h[n] = new o).state = s.Downloading), this._loadNewPack(i, n, e), null
- }
- },
- release: function(t) {
- var e = h[t];
- e && (cc.loader.release(e.url), delete h[t], cc.js.array.fastRemove(c, t))
- }
- }
- }), {
- "../utils/misc": 300,
- "./unpackers": 162
- }],
- 158: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("./loading-items"),
- s = r.ItemState;
- function o(t, e) {
- var i = t.id,
- n = e.states[i],
- r = t.next,
- a = t.pipeline;
- if (!e.error && n !== s.WORKING && n !== s.ERROR)
- if (n === s.COMPLETE) r ? o(r, e) : a.flowOut(e);
- else {
- e.states[i] = s.WORKING;
- var l = t.handle(e, (function(t, n) {
- t ? (e.error = t, e.states[i] = s.ERROR, a.flowOut(e)) : (n && (e.content = n), e.states[i] = s.COMPLETE, r ? o(r, e) : a.flowOut(e))
- }));
- l instanceof Error ? (e.error = l, e.states[i] = s.ERROR, a.flowOut(e)) : void 0 !== l && (null !== l && (e.content = l), e.states[i] = s.COMPLETE, r ? o(r, e) : a.flowOut(e))
- }
- }
- var a = function(t) {
- this._pipes = t, this._cache = n.createMap(!0);
- for (var e = 0; e < t.length; ++e) {
- var i = t[e];
- i.handle && i.id && (i.pipeline = this, i.next = e < t.length - 1 ? t[e + 1] : null)
- }
- };
- a.ItemState = s;
- var l = a.prototype;
- l.insertPipe = function(t, e) {
- if (!t.handle || !t.id || e > this._pipes.length) cc.warnID(4921);
- else if (this._pipes.indexOf(t) > 0) cc.warnID(4922);
- else {
- t.pipeline = this;
- var i = null;
- e < this._pipes.length && (i = this._pipes[e]);
- var n = null;
- e > 0 && (n = this._pipes[e - 1]), n && (n.next = t), t.next = i, this._pipes.splice(e, 0, t)
- }
- }, l.insertPipeAfter = function(t, e) {
- var i = this._pipes.indexOf(t);
- i < 0 || this.insertPipe(e, i + 1)
- }, l.appendPipe = function(t) {
- t.handle && t.id && (t.pipeline = this, t.next = null, this._pipes.length > 0 && (this._pipes[this._pipes.length - 1].next = t), this._pipes.push(t))
- }, l.flowIn = function(t) {
- var e, i, n = this._pipes[0];
- if (n) {
- for (e = 0; e < t.length; e++) i = t[e], this._cache[i.id] = i;
- for (e = 0; e < t.length; e++) o(n, i = t[e])
- } else
- for (e = 0; e < t.length; e++) this.flowOut(t[e])
- }, l.flowInDeps = function(t, e, i) {
- return r.create(this, (function(t, e) {
- i(t, e), e.destroy()
- })).append(e, t)
- }, l.flowOut = function(t) {
- t.error ? delete this._cache[t.id] : this._cache[t.id] || (this._cache[t.id] = t), t.complete = !0, r.itemComplete(t)
- }, l.copyItemStates = function(t, e) {
- if (e instanceof Array)
- for (var i = 0; i < e.length; ++i) e[i].states = t.states;
- else e.states = t.states
- }, l.getItem = function(t) {
- var e = this._cache[t];
- return e ? (e.alias && (e = e.alias), e) : e
- }, l.removeItem = function(t) {
- var e = this._cache[t];
- return e && e.complete && delete this._cache[t], e
- }, l.clear = function() {
- for (var t in this._cache) {
- var e = this._cache[t];
- delete this._cache[t], e.complete || (e.error = new Error("Canceled manually"), this.flowOut(e))
- }
- }, cc.Pipeline = e.exports = a
- }), {
- "../platform/js": 218,
- "./loading-items": 155
- }],
- 159: [(function(t, e, i) {
- "use strict"
- }), {
- "../platform/js": 218
- }],
- 160: [(function(t, e, i) {
- "use strict";
- var n = t("./pipeline"),
- r = "SubPackPipe",
- s = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/;
- function o(t) {
- var e = t.match(s);
- return e ? e[1] : ""
- }
- var a = Object.create(null),
- l = function(t) {
- for (var e in this.id = r, this.async = !1, this.pipeline = null, t) {
- var i = t[e];
- i.uuids && i.uuids.forEach((function(t) {
- a[t] = i.path
- }))
- }
- };
- l.ID = r, l.prototype.handle = function(t) {
- return t.url = this.transformURL(t.url), null
- }, l.prototype.transformURL = function(t) {
- var e = o(t);
- if (e) {
- var i = a[e];
- if (i) return t.replace("res/raw-assets/", i + "raw-assets/")
- }
- return t
- }, n.SubPackPipe = e.exports = l
- }), {
- "./pipeline": 158
- }],
- 161: [(function(t, e, i) {
- "use strict";
- var n = t("./utils").urlAppendTimestamp;
- e.exports = function(t, e) {
- var i = t.url;
- i = n(i);
- var r = cc.loader.getXMLHttpRequest(),
- s = "Load text file failed: " + i;
- r.open("GET", i, !0), r.overrideMimeType && r.overrideMimeType("text/plain; charset=utf-8"), r.onload = function() {
- 4 === r.readyState ? 200 === r.status || 0 === r.status ? e(null, r.responseText) : e({
- status: r.status,
- errorMessage: s + "(wrong status)"
- }) : e({
- status: r.status,
- errorMessage: s + "(wrong readyState)"
- })
- }, r.onerror = function() {
- e({
- status: r.status,
- errorMessage: s + "(error)"
- })
- }, r.ontimeout = function() {
- e({
- status: r.status,
- errorMessage: s + "(time out)"
- })
- }, r.send(null)
- }
- }), {
- "./utils": 163
- }],
- 162: [(function(t, e, i) {
- "use strict";
- var n = t("../assets/CCTexture2D"),
- r = t("../platform/js");
- function s() {
- this.jsons = {}
- }
- function o() {
- this.contents = {}
- }
- s.prototype.load = function(t, e) {
- e.length !== t.length && cc.errorID(4915);
- for (var i = 0; i < t.length; i++) {
- var n = t[i],
- r = e[i];
- this.jsons[n] = r
- }
- }, s.prototype.retrieve = function(t) {
- return this.jsons[t] || null
- }, o.ID = r._getClassId(n), o.prototype.load = function(t, e) {
- var i = e.data.split("|");
- i.length !== t.length && cc.errorID(4915);
- for (var n = 0; n < t.length; n++) this.contents[t[n]] = i[n]
- }, o.prototype.retrieve = function(t) {
- var e = this.contents[t];
- return e ? {
- __type__: o.ID,
- content: e
- } : null
- }, e.exports = {
- JsonUnpacker: s,
- TextureUnpacker: o
- }
- }), {
- "../assets/CCTexture2D": 73,
- "../platform/js": 218
- }],
- 163: [(function(t, e, i) {
- "use strict";
- var n = /\?/;
- e.exports = {
- urlAppendTimestamp: function(t) {
- return cc.game.config.noCache && "string" == typeof t && (n.test(t) ? t += "&_t=" + (new Date - 0) : t += "?_t=" + (new Date - 0)), t
- }
- }
- }), {}],
- 164: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js"),
- r = t("../CCDebug");
- t("../platform/deserialize");
- var s = t("./loading-items");
- function o(t) {
- return t && (t[0] && "cc.Scene" === t[0].__type__ || t[1] && "cc.Scene" === t[1].__type__ || t[0] && "cc.Prefab" === t[0].__type__)
- }
- function a(t, e, i, n) {
- var r, s, o, a = i.uuidList,
- l = i.uuidObjList,
- h = i.uuidPropList,
- c = i._stillUseUrl,
- u = t.dependKeys = [];
- if (n)
- for (r = [], s = 0; s < a.length; s++) {
- o = a[s];
- var _ = l[s],
- f = h[s],
- d = cc.AssetLibrary._getAssetInfoInRuntime(o);
- if (d.raw) {
- var p = d.url;
- _[f] = p, u.push(p)
- } else r.push({
- type: "uuid",
- uuid: o,
- deferredLoadRaw: !0,
- _owner: _,
- _ownerProp: f,
- _stillUseUrl: c[s]
- })
- } else {
- for (r = new Array(a.length), s = 0; s < a.length; s++) o = a[s], r[s] = {
- type: "uuid",
- uuid: o,
- _owner: l[s],
- _ownerProp: h[s],
- _stillUseUrl: c[s]
- };
- e._native && !e.constructor.preventPreloadNativeObject && r.push({
- url: e.nativeUrl,
- _owner: e,
- _ownerProp: "_nativeAsset"
- })
- }
- return r
- }
- function l(t, e, i, n, r) {
- e.content = i;
- var o = e.dependKeys;
- t.flowInDeps(e, n, (function(t, e) {
- var a, l = e.map;
- for (var h in l)(a = l[h]).uuid && a.content && (a.content._uuid = a.uuid);
- function c(t) {
- var e = t.content;
- this._stillUseUrl && (e = e && cc.RawAsset.wasRawAssetType(e.constructor) ? e.nativeUrl : t.rawUrl), "_nativeAsset" === this._ownerProp && (this._owner.url = t.url), this._owner[this._ownerProp] = e, t.uuid !== i._uuid && o.indexOf(t.id) < 0 && o.push(t.id)
- }
- for (var u = 0; u < n.length; u++) {
- var _ = n[u],
- f = _.uuid,
- d = _.url;
- _._owner, _._ownerProp;
- if (a = l[d]) {
- var p = _;
- if (a.complete || a.content) {
- if (a.error) cc._throw(a.error.message || a.error.errorMessage || a.error);
- else c.call(p, a)
- } else {
- var m = s.getQueue(a),
- y = m._callbackTable[f];
- y ? y.unshift(c, p) : m.addListener(f, c, p)
- }
- }
- }
- if (!t && i.onLoad) try {
- i.onLoad()
- } catch (t) {
- cc._throw(t)
- }
- r(t, i)
- }))
- }
- function h(t, e, i) {
- var n = e.deferredLoadRaw;
- return n ? t instanceof cc.Asset && t.constructor.preventDeferredLoadDependents && (n = !1) : i && (t instanceof cc.SceneAsset || t instanceof cc.Prefab) && (n = t.asyncLoadAssets), n
- }
- function c(t, e) {
- var i, s;
- if ("string" == typeof t.content) try {
- i = JSON.parse(t.content)
- } catch (e) {
- return new Error(r.getError(4923, t.id, e.stack))
- } else {
- if ("object" != typeof t.content) return new Error(r.getError(4924));
- i = t.content
- }
- var c = o(i);
- s = c ? cc._MissingScript.safeFindClass : function(t) {
- var e = n._getClassById(t);
- return e || (cc.warnID(4903, t), Object)
- };
- var u, _ = cc.deserialize.Details.pool.get();
- try {
- u = cc.deserialize(i, _, {
- classFinder: s,
- target: t.existingAsset,
- customEnv: t
- })
- } catch (e) {
- cc.deserialize.Details.pool.put(_);
- var f = e.stack;
- return new Error(r.getError(4925, t.id, f))
- }
- u._uuid = t.uuid, u.url = u.nativeUrl;
- var d = a(t, u, _, h(u, t, c));
- if (cc.deserialize.Details.pool.put(_), 0 === d.length) return u.onLoad && u.onLoad(), e(null, u);
- l(this.pipeline, t, u, d, e)
- }
- e.exports = c, c.isSceneObj = o
- }), {
- "../CCDebug": 49,
- "../platform/deserialize": 213,
- "../platform/js": 218,
- "./loading-items": 155
- }],
- 165: [(function(t, e, i) {
- "use strict";
- var n = o(t("../../renderer/core/input-assembler")),
- r = o(t("../../renderer/gfx")),
- s = t("./mesh-data");
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var a = t("../renderer"),
- l = t("../event/event-target");
- function h(t, e, i) {
- t[e] = i._val
- }
- function c(t, e, i) {
- t[e] = i.x, t[e + 1] = i.y
- }
- function u(t, e, i) {
- t[e] = i.x, t[e + 1] = i.y, t[e + 2] = i.z
- }
- var _ = cc.Class({
- name: "cc.Mesh",
- extends: cc.Asset,
- mixins: [l],
- properties: {
- _nativeAsset: {
- override: !0,
- get: function() {
- return this._buffer
- },
- set: function(t) {
- this._buffer = ArrayBuffer.isView(t) ? t.buffer : t, this.initWithBuffer()
- }
- },
- _vertexBundles: {
- default: null,
- type: s.VertexBundle
- },
- _primitives: {
- default: null,
- Primitive: s.Primitive
- },
- _minPos: cc.v3(),
- _maxPos: cc.v3(),
- subMeshes: {
- get: function() {
- return this._subMeshes
- },
- set: function(t) {
- this._subMeshes = t
- }
- },
- subDatas: {
- get: function() {
- return this._subDatas
- }
- }
- },
- ctor: function() {
- this._subMeshes = [], this.loaded = !1, this._subDatas = []
- },
- initWithBuffer: function() {
- this._subMeshes.length = 0;
- for (var t = this._primitives, e = 0; e < t.length; e++) {
- var i = t[e],
- o = i.data,
- l = new Uint8Array(this._buffer, o.offset, o.length),
- h = this._vertexBundles[i.vertexBundleIndices[0]],
- c = h.data,
- u = new r.default.VertexFormat(h.formats),
- _ = new Uint8Array(this._buffer, c.offset, c.length),
- f = this._canVertexFormatBatch(u),
- d = new s.MeshData;
- d.vData = _, d.iData = l, d.vfm = u, d.offset = c.offset, d.canBatch = f, this._subDatas.push(d);
- var p = new r.default.VertexBuffer(a.device, u, r.default.USAGE_STATIC, _),
- m = new r.default.IndexBuffer(a.device, i.indexUnit, r.default.USAGE_STATIC, l);
- this._subMeshes.push(new n.default(p, m))
- }
- this.loaded = !0, this.emit("load")
- },
- _canVertexFormatBatch: function(t) {
- var e = t._attr2el[r.default.ATTR_POSITION];
- return !e || e.type === r.default.ATTR_TYPE_FLOAT32 && t._bytes % 4 == 0
- },
- init: function(t, e) {
- var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
- o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
- l = new Uint8Array(t._bytes * e),
- h = new s.MeshData;
- h.vData = l, h.vfm = t, h.vDirty = !0, h.canBatch = this._canVertexFormatBatch(t);
- var c = new r.default.VertexBuffer(a.device, t, i ? r.default.USAGE_DYNAMIC : r.default.USAGE_STATIC, l);
- h.vb = c, this._subMeshes[o] = new n.default(h.vb);
- var u = this._subDatas[o];
- u && (u.vb && u.vb.destroy(), u.ib && u.ib.destroy()), this._subDatas[o] = h, this.loaded = !0, this.emit("load"), this.emit("init-format")
- },
- setVertices: function(t, e, i) {
- i = i || 0;
- var n = this._subDatas[i],
- s = n.vfm.element(t);
- if (!s) return cc.warn("Cannot find " + t + " attribute in vertex defines.");
- var o = "number" == typeof e[0],
- a = s.num,
- l = o ? e.length / a | 0 : e.length;
- n.vData.byteLength < l * s.stride && (n.vData = new Uint8Array(l * n.vfm._bytes));
- var _ = void 0,
- f = 4;
- t === r.default.ATTR_COLOR ? o ? (_ = n.getVData(), f = 1) : _ = n.getVData(Uint32Array) : _ = n.getVData(Float32Array);
- var d = s.stride / f,
- p = s.offset / f;
- if (o)
- for (var m = 0, y = e.length / a; m < y; m++)
- for (var v = m * a, g = m * d + p, x = 0; x < a; x++) _[g + x] = e[v + x];
- else {
- var b = void 0;
- b = t === r.default.ATTR_COLOR ? h : 2 === a ? c : u;
- for (var A = 0, C = e.length; A < C; A++) {
- b(_, A * d + p, e[A])
- }
- }
- n.vDirty = !0
- },
- setIndices: function(t, e, i) {
- e = e || 0;
- var n = t;
- t instanceof Uint16Array ? n = new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : Array.isArray(t) && (n = new Uint16Array(t), n = new Uint8Array(n.buffer, n.byteOffset, n.byteLength));
- var s = i ? r.default.USAGE_DYNAMIC : r.default.USAGE_STATIC,
- o = this._subDatas[e];
- if (o.ib) o.iData = n, o.iDirty = !0;
- else {
- o.iData = n;
- var l = new r.default.IndexBuffer(a.device, r.default.INDEX_FMT_UINT16, s, n, n.byteLength / r.default.IndexBuffer.BYTES_PER_INDEX[r.default.INDEX_FMT_UINT16]);
- o.ib = l, this._subMeshes[e]._indexBuffer = o.ib
- }
- },
- setPrimitiveType: function(t, e) {
- e = e || 0, this._subMeshes[e] ? this._subMeshes[e]._primitiveType = t : cc.warn("Do not have sub mesh at index " + e)
- },
- clear: function() {
- this._subMeshes.length = 0;
- for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
- var n = t[e].vb;
- n && n.destroy();
- var r = t[e].ib;
- r && r.destroy()
- }
- t.length = 0
- },
- setBoundingBox: function(t, e) {
- this._minPos = t, this._maxPos = e
- },
- destroy: function() {
- this.clear()
- },
- _uploadData: function() {
- for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- if (n.vDirty) {
- var r = n.vb,
- s = n.vData;
- r.update(0, s), n.vDirty = !1
- }
- if (n.iDirty) {
- var o = n.ib,
- a = n.iData;
- o.update(0, a), n.iDirty = !1
- }
- }
- }
- });
- cc.Mesh = e.exports = _
- }), {
- "../../renderer/core/input-assembler": 350,
- "../../renderer/gfx": 360,
- "../event/event-target": 131,
- "../renderer": 247,
- "./mesh-data": 168
- }],
- 166: [(function(t, e, i) {
- "use strict";
- var n = a(t("../../renderer/gfx")),
- r = a(t("../../renderer/core/input-assembler")),
- s = a(t("../geom-utils")),
- o = (a(t("../assets/material/custom-properties")), t("../utils/mesh-util"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var l = t("../components/CCRenderComponent"),
- h = t("./CCMesh"),
- c = t("../renderer/render-flow"),
- u = t("../renderer"),
- _ = t("../assets/material/CCMaterial"),
- f = cc.Color.BLACK,
- d = cc.Enum({
- OFF: 0,
- ON: 1
- }),
- p = cc.Class({
- name: "cc.MeshRenderer",
- extends: l,
- editor: !1,
- properties: {
- _mesh: {
- default: null,
- type: h
- },
- _receiveShadows: !1,
- _shadowCastingMode: d.OFF,
- _enableAutoBatch: !1,
- mesh: {
- get: function() {
- return this._mesh
- },
- set: function(t) {
- this._mesh !== t && (this._setMesh(t), t ? (this.markForRender(!0), this._activateMaterial(!0), this.markForUpdateRenderData(!0), this.node._renderFlag |= c.FLAG_TRANSFORM) : this.markForRender(!1))
- },
- type: h,
- animatable: !1
- },
- textures: {
- default: [],
- type: cc.Texture2D,
- visible: !1
- },
- receiveShadows: {
- get: function() {
- return this._receiveShadows
- },
- set: function(t) {
- this._receiveShadows = t, this._updateReceiveShadow()
- },
- animatable: !1
- },
- shadowCastingMode: {
- get: function() {
- return this._shadowCastingMode
- },
- set: function(t) {
- this._shadowCastingMode = t, this._updateCastShadow()
- },
- type: d,
- animatable: !1
- },
- enableAutoBatch: {
- get: function() {
- return this._enableAutoBatch
- },
- set: function(t) {
- this._enableAutoBatch = t
- }
- }
- },
- statics: {
- ShadowCastingMode: d
- },
- ctor: function() {
- this._wireFrameDatas = [], this._boundingBox = null, this._customProperties = new cc.CustomProperties
- },
- onEnable: function() {
- if (this._super(), this._mesh && !this._mesh.loaded) {
- this.disableRender();
- var t = this;
- this._mesh.once("load", (function() {
- t._setMesh(t._mesh), t._activateMaterial()
- })), (0, o.postLoadMesh)(this._mesh)
- } else this._setMesh(this._mesh), this._activateMaterial();
- this._updateRenderNode()
- },
- onDestroy: function() {
- this._setMesh(null), cc.pool.assembler.put(this._assembler)
- },
- _updateRenderNode: function() {
- this._assembler.setRenderNode(this.node)
- },
- _setMesh: function(t) {
- this._mesh && this._mesh.off("init-format", this._updateMeshAttribute, this), t && t.on("init-format", this._updateMeshAttribute, this), this._mesh = t
- },
- _getDefaultMaterial: function() {
- return _.getBuiltinMaterial("unlit")
- },
- _activateMaterial: function(t) {
- var e = this._mesh;
- if (e && 0 !== e._subDatas.length) {
- s.default && (this._boundingBox = s.default.Aabb.fromPoints(s.default.Aabb.create(), e._minPos, e._maxPos));
- var i = this.textures;
- if (i && i.length > 0)
- for (var n = 0; n < i.length; n++) {
- var r = this.sharedMaterials[n];
- r || ((r = cc.Material.getInstantiatedMaterial(this._getDefaultMaterial(), this)).setProperty("diffuseTexture", i[n]), this.setMaterial(n, r))
- }
- var o = this.sharedMaterials;
- if (!o[0]) {
- var a = this._getDefaultMaterial();
- o[0] = a
- }
- this._updateReceiveShadow(), this._updateCastShadow(), this._updateMeshAttribute(), this.markForUpdateRenderData(!0), this.markForRender(!0)
- } else this.disableRender()
- },
- _updateReceiveShadow: function() {
- this._customProperties.define("CC_USE_SHADOW_MAP", this._receiveShadows)
- },
- _updateCastShadow: function() {
- this._customProperties.define("CC_SHADOW_CASTING", this._shadowCastingMode === d.ON)
- },
- _updateMeshAttribute: function() {
- var t = this._mesh && this._mesh.subDatas;
- if (t) {
- var e = t[0].vfm;
- this._customProperties.define("CC_USE_ATTRIBUTE_COLOR", !!e.element(n.default.ATTR_COLOR)), this._customProperties.define("CC_USE_ATTRIBUTE_UV0", !!e.element(n.default.ATTR_UV0)), this._customProperties.define("CC_USE_ATTRIBUTE_NORMAL", !!e.element(n.default.ATTR_NORMAL)), this._customProperties.define("CC_USE_ATTRIBUTE_TANGENT", !!e.element(n.default.ATTR_TANGENT)), this._wireFrameDatas.length = 0
- }
- },
- _updateWireFrameDatas: function() {
- var t = this._wireFrameDatas,
- e = this._mesh.subMeshes;
- if (e.length !== t.length) {
- t.length = e.length;
- for (var i = this._mesh._subDatas, n = 0; n < e.length; n++) t[n] = this._createWireFrameData(e[n], i[n].iData)
- }
- },
- _createWireFrameData: function(t, e) {
- var i = new _;
- i.copy(_.getBuiltinMaterial("unlit")), i.setProperty("diffuseColor", f);
- for (var s = [], o = 0; o < e.length; o += 3) {
- var a = e[o + 0],
- l = e[o + 1],
- h = e[o + 2];
- s.push(a, l, l, h, h, a)
- }
- var c = new Uint16Array(s),
- d = new n.default.IndexBuffer(u.device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, c, c.length);
- return {
- material: i,
- ia: new r.default(t._vertexBuffer, d, n.default.PT_LINES)
- }
- },
- _checkBacth: function() {}
- });
- cc.MeshRenderer = e.exports = p
- }), {
- "../../renderer/core/input-assembler": 350,
- "../../renderer/gfx": 360,
- "../assets/material/CCMaterial": 75,
- "../assets/material/custom-properties": 76,
- "../components/CCRenderComponent": 106,
- "../geom-utils": 136,
- "../renderer": 247,
- "../renderer/render-flow": 248,
- "../utils/mesh-util": 299,
- "./CCMesh": 165
- }],
- 167: [(function(t, e, i) {
- "use strict";
- t("./CCMesh"), t("./CCMeshRenderer"), t("./mesh-renderer")
- }), {
- "./CCMesh": 165,
- "./CCMeshRenderer": 166,
- "./mesh-renderer": 169
- }],
- 168: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.Primitive = i.VertexBundle = i.VertexFormat = i.BufferRange = void 0, i.MeshData = o;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../renderer/gfx"));
- var r = i.BufferRange = cc.Class({
- name: "cc.BufferRange",
- properties: {
- offset: 0,
- length: 0
- }
- }),
- s = i.VertexFormat = cc.Class({
- name: "cc.mesh.VertexFormat",
- properties: {
- name: "",
- type: -1,
- num: -1,
- normalize: !1
- }
- });
- i.VertexBundle = cc.Class({
- name: "cc.mesh.VertexBundle",
- properties: {
- data: {
- default: null,
- type: r
- },
- formats: {
- default: [],
- type: s
- },
- verticesCount: 0
- }
- }), i.Primitive = cc.Class({
- name: "cc.mesh.Primitive",
- properties: {
- vertexBundleIndices: {
- default: [],
- type: cc.Float
- },
- data: {
- default: null,
- type: r
- },
- indexUnit: n.default.INDEX_FMT_UINT16,
- topology: n.default.PT_TRIANGLES
- }
- });
- function o() {
- this.vData = null, this.float32VData = null, this.uint32VData = null, this.iData = null, this.uint16IData = null, this.vfm = null, this.offset = 0, this.vb = null, this.ib = null, this.vDirty = !1, this.iDirty = !1
- }
- o.prototype.getVData = function(t) {
- return t === Float32Array ? (this.float32VData || (this.float32VData = new Float32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4)), this.float32VData) : t === Uint32Array ? (this.uint32VData || (this.uint32VData = new Uint32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4)), this.uint32VData) : this.vData
- }, o.prototype.getIData = function(t) {
- return t === Uint16Array ? (this.uint16IData || (this.uint16IData = new Uint16Array(this.iData.buffer, this.iData.byteOffset, this.iData.byteLength / 2)), this.uint16IData) : this.iData
- }
- }), {
- "../../renderer/gfx": 360
- }],
- 169: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = o(t("../renderer/assembler")),
- r = o(t("../../renderer/gfx")),
- s = o(t("../vmath/vec3"));
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function a(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function l(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function h(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var c = t("./CCMeshRenderer"),
- u = (function(t) {
- function e(i) {
- a(this, e);
- var n = l(this, t.call(this, i));
- return n._renderNode = null, n
- }
- return h(e, t), e.prototype.setRenderNode = function(t) {
- this._renderNode = t
- }, e.prototype.fillBuffers = function(t, e) {
- if (t.mesh) {
- t.mesh._uploadData();
- for (var i = e.customProperties && e.customProperties.getHash() === t._customProperties.getHash(), n = e.cullingMask === t.node._cullingMask, s = t.enableAutoBatch, o = t.sharedMaterials, a = t.mesh._subMeshes, l = t.mesh.subDatas, h = 0; h < a.length; h++) {
- var c = a[h],
- u = l[h],
- _ = o[h] || o[0];
- s && u.canBatch && c._primitiveType === r.default.PT_TRIANGLES ? (i && n && _.getHash() === e.material.getHash() || (e._flush(), e.material = _, e.cullingMask = t.node._cullingMask, e.customProperties = t._customProperties, e.node = e._dummyNode), this._fillBuffer(t, u, e)) : (e._flush(), e.material = _, e.cullingMask = t.node._cullingMask, e.customProperties = t._customProperties, e.node = this._renderNode, e._flushIA(c))
- }
- cc.macro.SHOW_MESH_WIREFRAME && this._drawWireFrames(t, e)
- }
- }, e.prototype._fillBuffer = function(t, e, i) {
- for (var n = t.node._worldMatrix, o = e.getVData(Float32Array), a = e.vfm, l = a._attr2el[r.default.ATTR_POSITION].offset / 4, h = a._bytes / 4, c = o.length / h | 0, u = e.getIData(Uint16Array), _ = u.length, f = i.getBuffer("mesh", a), d = f.request(c, _), p = d.indiceOffset, m = d.byteOffset >> 2, y = d.vertexOffset, v = f._vData, g = f._iData, x = cc.v3(), b = 0; b < c; b++) {
- for (var A = b * h, C = 0; C < l; C++) v[m++] = o[A + C];
- x.x = o[A + l], x.y = o[A + l + 1], x.z = o[A + l + 2], s.default.transformMat4(x, x, n), v[m++] = x.x, v[m++] = x.y, v[m++] = x.z;
- for (var T = l + 3; T < h; T++) v[m++] = o[A + T]
- }
- for (var S = 0; S < _; S++) g[p + S] = y + u[S]
- }, e.prototype._drawWireFrames = function(t, e) {
- e._flush(), t._updateWireFrameDatas(), e.node = this._renderNode;
- for (var i = t._wireFrameDatas, n = 0; n < i.length; n++) {
- var r = i[n],
- s = r.material;
- e.material = s, e._flushIA(r.ia)
- }
- }, e
- })(n.default);
- i.default = u, n.default.register(c, u), e.exports = i.default
- }), {
- "../../renderer/gfx": 360,
- "../renderer/assembler": 227,
- "../vmath/vec3": 335,
- "./CCMeshRenderer": 166
- }],
- 170: [(function(t, e, i) {
- "use strict";
- var n = t("./component-scheduler"),
- r = t("./platform/CCObject").Flags,
- s = t("./platform/js"),
- o = r.IsPreloadStarted,
- a = r.IsOnLoadStarted,
- l = r.IsOnLoadCalled,
- h = r.Deactivating,
- c = cc.Class({
- extends: n.LifeCycleInvoker,
- add: function(t) {
- this._zero.array.push(t)
- },
- remove: function(t) {
- this._zero.fastRemove(t)
- },
- cancelInactive: function(t) {
- n.LifeCycleInvoker.stableRemoveInactive(this._zero, t)
- },
- invoke: function() {
- this._invoke(this._zero), this._zero.array.length = 0
- }
- }),
- u = n.createInvokeImpl("c.__preload();"),
- _ = n.createInvokeImpl("c.onLoad();c._objFlags|=" + l, !1, l),
- f = new s.Pool(4);
- function d(t, e, i) {
- e ? t._removeComponent(e) : s.array.removeAt(t._components, i)
- }
- function p() {
- this._activatingStack = []
- }
- f.get = function() {
- var t = this._get() || {
- preload: new c(u),
- onLoad: new n.OneOffInvoker(_),
- onEnable: new n.OneOffInvoker(n.invokeOnEnable)
- };
- t.preload._zero.i = -1;
- var e = t.onLoad;
- return e._zero.i = -1, e._neg.i = -1, e._pos.i = -1, (e = t.onEnable)._zero.i = -1, e._neg.i = -1, e._pos.i = -1, t
- };
- var m = cc.Class({
- ctor: p,
- reset: p,
- _activateNodeRecursively: function(t, e, i, n) {
- if (t._objFlags & h) cc.errorID(3816, t.name);
- else {
- t._activeInHierarchy = !0;
- for (var r = t._components.length, s = 0; s < r; ++s) {
- var o = t._components[s];
- o instanceof cc.Component ? this.activateComp(o, e, i, n) : (d(t, o, s), --s, --r)
- }
- t._childArrivalOrder = t._children.length;
- for (var a = 0, l = t._children.length; a < l; ++a) {
- var c = t._children[a];
- c._localZOrder = 4294901760 & c._localZOrder | a + 1, c._active && this._activateNodeRecursively(c, e, i, n)
- }
- t._onPostActivated(!0)
- }
- },
- _deactivateNodeRecursively: function(t) {
- t._objFlags |= h, t._activeInHierarchy = !1;
- for (var e = t._components.length, i = 0; i < e; ++i) {
- var n = t._components[i];
- if (n._enabled && (cc.director._compScheduler.disableComp(n), t._activeInHierarchy)) return void(t._objFlags &= ~h)
- }
- for (var r = 0, s = t._children.length; r < s; ++r) {
- var o = t._children[r];
- if (o._activeInHierarchy && (this._deactivateNodeRecursively(o), t._activeInHierarchy)) return void(t._objFlags &= ~h)
- }
- t._onPostActivated(!1), t._objFlags &= ~h
- },
- activateNode: function(t, e) {
- if (e) {
- var i = f.get();
- this._activatingStack.push(i), this._activateNodeRecursively(t, i.preload, i.onLoad, i.onEnable), i.preload.invoke(), i.onLoad.invoke(), i.onEnable.invoke(), this._activatingStack.pop(), f.put(i)
- } else {
- this._deactivateNodeRecursively(t);
- for (var n = this._activatingStack, r = 0; r < n.length; r++) {
- var s = n[r];
- s.preload.cancelInactive(o), s.onLoad.cancelInactive(a), s.onEnable.cancelInactive()
- }
- }
- t.emit("active-in-hierarchy-changed", t)
- },
- activateComp: function(t, e, i, n) {
- if (cc.isValid(t, !0) && (t._objFlags & o || (t._objFlags |= o, t.__preload && (e ? e.add(t) : t.__preload())), t._objFlags & a || (t._objFlags |= a, t.onLoad ? i ? i.add(t) : (t.onLoad(), t._objFlags |= l) : t._objFlags |= l), t._enabled)) {
- if (!t.node._activeInHierarchy) return;
- cc.director._compScheduler.enableComp(t, n)
- }
- },
- destroyComp: function(t) {
- cc.director._compScheduler.disableComp(t), t.onDestroy && t._objFlags & l && t.onDestroy()
- },
- resetComp: !1
- });
- e.exports = m
- }), {
- "./component-scheduler": 89,
- "./platform/CCObject": 204,
- "./platform/js": 218,
- "./utils/misc": 300
- }],
- 171: [(function(t, e, i) {
- "use strict";
- var n = t("./CCPhysicsTypes").PTM_RATIO,
- r = t("./CCPhysicsTypes").ContactType,
- s = [],
- o = [cc.v2(), cc.v2()],
- a = new b2.WorldManifold,
- l = {
- points: [],
- separations: [],
- normal: cc.v2()
- };
- function h() {
- this.localPoint = cc.v2(), this.normalImpulse = 0, this.tangentImpulse = 0
- }
- var c = [new h, new h],
- u = (new b2.Manifold, {
- type: 0,
- localPoint: cc.v2(),
- localNormal: cc.v2(),
- points: []
- }),
- _ = {
- normalImpulses: [],
- tangentImpulses: []
- };
- function f() {}
- f.prototype.init = function(t) {
- this.colliderA = t.GetFixtureA().collider, this.colliderB = t.GetFixtureB().collider, this.disabled = !1, this.disabledOnce = !1, this._impulse = null, this._inverted = !1, this._b2contact = t, t._contact = this
- }, f.prototype.reset = function() {
- this.setTangentSpeed(0), this.resetFriction(), this.resetRestitution(), this.colliderA = null, this.colliderB = null, this.disabled = !1, this._impulse = null, this._b2contact._contact = null, this._b2contact = null
- }, f.prototype.getWorldManifold = function() {
- var t = l.points,
- e = l.separations,
- i = l.normal;
- this._b2contact.GetWorldManifold(a);
- var r = a.points,
- s = a.separations,
- h = this._b2contact.GetManifold().pointCount;
- t.length = e.length = h;
- for (var c = 0; c < h; c++) {
- var u = o[c];
- u.x = r[c].x * n, u.y = r[c].y * n, t[c] = u, e[c] = s[c] * n
- }
- return i.x = a.normal.x, i.y = a.normal.y, this._inverted && (i.x *= -1, i.y *= -1), l
- }, f.prototype.getManifold = function() {
- for (var t = u.points, e = u.localNormal, i = u.localPoint, r = this._b2contact.GetManifold(), s = r.points, o = t.length = r.pointCount, a = 0; a < o; a++) {
- var l = c[a],
- h = s[a];
- l.localPoint.x = h.localPoint.x * n, l.localPoint.Y = h.localPoint.Y * n, l.normalImpulse = h.normalImpulse * n, l.tangentImpulse = h.tangentImpulse, t[a] = l
- }
- return i.x = r.localPoint.x * n, i.y = r.localPoint.y * n, e.x = r.localNormal.x, e.y = r.localNormal.y, u.type = r.type, this._inverted && (e.x *= -1, e.y *= -1), u
- }, f.prototype.getImpulse = function() {
- var t = this._impulse;
- if (!t) return null;
- for (var e = _.normalImpulses, i = _.tangentImpulses, r = t.count, s = 0; s < r; s++) e[s] = t.normalImpulses[s] * n, i[s] = t.tangentImpulses[s];
- return i.length = e.length = r, _
- }, f.prototype.emit = function(t) {
- var e;
- switch (t) {
- case r.BEGIN_CONTACT:
- e = "onBeginContact";
- break;
- case r.END_CONTACT:
- e = "onEndContact";
- break;
- case r.PRE_SOLVE:
- e = "onPreSolve";
- break;
- case r.POST_SOLVE:
- e = "onPostSolve"
- }
- var i, n, s, o, a = this.colliderA,
- l = this.colliderB,
- h = a.body,
- c = l.body;
- if (h.enabledContactListener)
- for (i = h.node._components, this._inverted = !1, n = 0, s = i.length; n < s; n++)(o = i[n])[e] && o[e](this, a, l);
- if (c.enabledContactListener)
- for (i = c.node._components, this._inverted = !0, n = 0, s = i.length; n < s; n++)(o = i[n])[e] && o[e](this, l, a);
- (this.disabled || this.disabledOnce) && (this.setEnabled(!1), this.disabledOnce = !1)
- }, f.get = function(t) {
- var e;
- return (e = 0 === s.length ? new cc.PhysicsContact : s.pop()).init(t), e
- }, f.put = function(t) {
- var e = t._contact;
- e && (s.push(e), e.reset())
- };
- var d = f.prototype;
- d.setEnabled = function(t) {
- this._b2contact.SetEnabled(t)
- }, d.isTouching = function() {
- return this._b2contact.IsTouching()
- }, d.setTangentSpeed = function(t) {
- this._b2contact.SetTangentSpeed(t / n)
- }, d.getTangentSpeed = function() {
- return this._b2contact.GetTangentSpeed() * n
- }, d.setFriction = function(t) {
- this._b2contact.SetFriction(t)
- }, d.getFriction = function() {
- return this._b2contact.GetFriction()
- }, d.resetFriction = function() {
- return this._b2contact.ResetFriction()
- }, d.setRestitution = function(t) {
- this._b2contact.SetRestitution(t)
- }, d.getRestitution = function() {
- return this._b2contact.GetRestitution()
- }, d.resetRestitution = function() {
- return this._b2contact.ResetRestitution()
- }, f.ContactType = r, cc.PhysicsContact = e.exports = f
- }), {
- "./CCPhysicsTypes": 173
- }],
- 172: [(function(t, e, i) {
- "use strict";
- var n = t("./CCPhysicsTypes"),
- r = n.ContactType,
- s = n.BodyType,
- o = n.RayCastType,
- a = n.DrawBits,
- l = n.PTM_RATIO,
- h = (n.ANGLE_TO_PHYSICS_ANGLE, n.PHYSICS_ANGLE_TO_ANGLE),
- c = t("./utils").convertToNodeRotation,
- u = t("./platform/CCPhysicsDebugDraw"),
- _ = new b2.AABB,
- f = new b2.Vec2,
- d = new b2.Vec2,
- p = cc.v2(),
- m = cc.Class({
- mixins: [cc.EventTarget],
- statics: {
- DrawBits: a,
- PTM_RATIO: l,
- VELOCITY_ITERATIONS: 10,
- POSITION_ITERATIONS: 10,
- FIXED_TIME_STEP: 1 / 60,
- MAX_ACCUMULATOR: .2
- },
- ctor: function() {
- this._debugDrawFlags = 0, this._debugDrawer = null, this._world = null, this._bodies = [], this._joints = [], this._contactMap = {}, this._contactID = 0, this._delayEvents = [], this._accumulator = 0, cc.director._scheduler && cc.director._scheduler.enableForTarget(this), this.enabledAccumulator = !1
- },
- pushDelayEvent: function(t, e, i) {
- this._steping ? this._delayEvents.push({
- target: t,
- func: e,
- args: i
- }) : t[e].apply(t, i)
- },
- update: function(t) {
- var e = this._world;
- if (e && this.enabled) {
- this.emit("before-step"), this._steping = !0;
- var i = m.VELOCITY_ITERATIONS,
- n = m.POSITION_ITERATIONS;
- if (this.enabledAccumulator) {
- this._accumulator += t;
- var r = m.FIXED_TIME_STEP,
- s = m.MAX_ACCUMULATOR;
- for (this._accumulator > s && (this._accumulator = s); this._accumulator > r;) e.Step(r, i, n), this._accumulator -= r
- } else {
- var o = 1 / cc.game.config.frameRate;
- e.Step(o, i, n)
- }
- this.debugDrawFlags && (this._checkDebugDrawValid(), this._debugDrawer.clear(), e.DrawDebugData()), this._steping = !1;
- for (var a = this._delayEvents, l = 0, h = a.length; l < h; l++) {
- var c = a[l];
- c.target[c.func].apply(c.target, c.args)
- }
- a.length = 0, this._syncNode()
- }
- },
- testPoint: function(t) {
- var e = f.x = t.x / l,
- i = f.y = t.y / l,
- n = .2 / l;
- _.lowerBound.x = e - n, _.lowerBound.y = i - n, _.upperBound.x = e + n, _.upperBound.y = i + n;
- var r = this._aabbQueryCallback;
- r.init(f), this._world.QueryAABB(r, _);
- var s = r.getFixture();
- return s ? s.collider : null
- },
- testAABB: function(t) {
- _.lowerBound.x = t.xMin / l, _.lowerBound.y = t.yMin / l, _.upperBound.x = t.xMax / l, _.upperBound.y = t.yMax / l;
- var e = this._aabbQueryCallback;
- return e.init(), this._world.QueryAABB(e, _), e.getFixtures().map((function(t) {
- return t.collider
- }))
- },
- rayCast: function(t, e, i) {
- if (t.equals(e)) return [];
- i = i || o.Closest, f.x = t.x / l, f.y = t.y / l, d.x = e.x / l, d.y = e.y / l;
- var n = this._raycastQueryCallback;
- n.init(i), this._world.RayCast(n, f, d);
- var r = n.getFixtures();
- if (r.length > 0) {
- for (var s = n.getPoints(), a = n.getNormals(), h = n.getFractions(), c = [], u = 0, _ = r.length; u < _; u++) {
- var p = r[u],
- m = p.collider;
- if (i === o.AllClosest) {
- var y = c.find((function(t) {
- return t.collider === m
- }));
- if (y) {
- h[u] < y.fraction && (y.fixtureIndex = m._getFixtureIndex(p), y.point.x = s[u].x * l, y.point.y = s[u].y * l, y.normal.x = a[u].x, y.normal.y = a[u].y, y.fraction = h[u]);
- continue
- }
- }
- c.push({
- collider: m,
- fixtureIndex: m._getFixtureIndex(p),
- point: cc.v2(s[u].x * l, s[u].y * l),
- normal: cc.v2(a[u]),
- fraction: h[u]
- })
- }
- return c
- }
- return []
- },
- syncPosition: function() {
- for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncPosition()
- },
- syncRotation: function() {
- for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncRotation()
- },
- _registerContactFixture: function(t) {
- this._contactListener.registerContactFixture(t)
- },
- _unregisterContactFixture: function(t) {
- this._contactListener.unregisterContactFixture(t)
- },
- _addBody: function(t, e) {
- var i = this._world,
- n = t.node;
- i && n && (t._b2Body = i.CreateBody(e), t._b2Body.body = t, this._bodies.push(t))
- },
- _removeBody: function(t) {
- var e = this._world;
- e && (t._b2Body.body = null, e.DestroyBody(t._b2Body), t._b2Body = null, cc.js.array.remove(this._bodies, t))
- },
- _addJoint: function(t, e) {
- var i = this._world.CreateJoint(e);
- i && (i._joint = t, t._joint = i, this._joints.push(t))
- },
- _removeJoint: function(t) {
- t._isValid() && this._world.DestroyJoint(t._joint), t._joint && (t._joint._joint = null), cc.js.array.remove(this._joints, t)
- },
- _initCallback: function() {
- if (this._world) {
- if (!this._contactListener) {
- var t = new cc.PhysicsContactListener;
- t.setBeginContact(this._onBeginContact), t.setEndContact(this._onEndContact), t.setPreSolve(this._onPreSolve), t.setPostSolve(this._onPostSolve), this._world.SetContactListener(t), this._contactListener = t, this._aabbQueryCallback = new cc.PhysicsAABBQueryCallback, this._raycastQueryCallback = new cc.PhysicsRayCastCallback
- }
- } else cc.warn("Please init PhysicsManager first")
- },
- _init: function() {
- this.enabled = !0, this.debugDrawFlags = a.e_shapeBit
- },
- _getWorld: function() {
- return this._world
- },
- _syncNode: function() {
- for (var t = this._bodies, e = 0, i = t.length; e < i; e++) {
- var n = t[e],
- r = n.node,
- o = n._b2Body,
- a = o.GetPosition();
- p.x = a.x * l, p.y = a.y * l;
- var u = o.GetAngle() * h;
- null !== r.parent.parent && (p = r.parent.convertToNodeSpaceAR(p), u = c(r.parent, u));
- var _ = r._eventMask;
- r._eventMask = 0, r.position = p, r.angle = -u, r._eventMask = _, n.type === s.Animated && n.resetVelocity()
- }
- },
- _onBeginContact: function(t) {
- cc.PhysicsContact.get(t).emit(r.BEGIN_CONTACT)
- },
- _onEndContact: function(t) {
- var e = t._contact;
- e && (e.emit(r.END_CONTACT), cc.PhysicsContact.put(t))
- },
- _onPreSolve: function(t) {
- var e = t._contact;
- e && e.emit(r.PRE_SOLVE)
- },
- _onPostSolve: function(t, e) {
- var i = t._contact;
- i && (i._impulse = e, i.emit(r.POST_SOLVE), i._impulse = null)
- },
- _checkDebugDrawValid: function() {
- if (!this._debugDrawer || !this._debugDrawer.isValid) {
- var t = new cc.Node("PHYSICS_MANAGER_DEBUG_DRAW");
- t.zIndex = cc.macro.MAX_ZINDEX, cc.game.addPersistRootNode(t), this._debugDrawer = t.addComponent(cc.Graphics);
- var e = new u(this._debugDrawer);
- e.SetFlags(this.debugDrawFlags), this._world.SetDebugDraw(e)
- }
- }
- });
- cc.js.getset(m.prototype, "enabled", (function() {
- return this._enabled
- }), (function(t) {
- if (t && !this._world) {
- var e = new b2.World(new b2.Vec2(0, -10));
- e.SetAllowSleeping(!0), this._world = e, this._initCallback()
- }
- this._enabled = t
- })), cc.js.getset(m.prototype, "debugDrawFlags", (function() {
- return this._debugDrawFlags
- }), (function(t) {
- t && !this._debugDrawFlags ? this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !0) : !t && this._debugDrawFlags && this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !1), t && (this._checkDebugDrawValid(), this._world.m_debugDraw.SetFlags(t)), this._debugDrawFlags = t, t && (this._checkDebugDrawValid(), this._world.m_debugDraw.SetFlags(t))
- })), cc.js.getset(m.prototype, "gravity", (function() {
- if (this._world) {
- var t = this._world.GetGravity();
- return cc.v2(t.x * l, t.y * l)
- }
- return cc.v2()
- }), (function(t) {
- this._world && this._world.SetGravity(new b2.Vec2(t.x / l, t.y / l))
- })), cc.PhysicsManager = e.exports = m
- }), {
- "./CCPhysicsTypes": 173,
- "./platform/CCPhysicsDebugDraw": 194,
- "./utils": 196
- }],
- 173: [(function(t, e, i) {
- "use strict";
- var n = cc.Enum({
- Static: 0,
- Kinematic: 1,
- Dynamic: 2,
- Animated: 3
- });
- cc.RigidBodyType = n;
- var r = cc.Enum({
- Closest: 0,
- Any: 1,
- AllClosest: 2,
- All: 3
- });
- cc.RayCastType = r, e.exports = {
- BodyType: n,
- ContactType: {
- BEGIN_CONTACT: "begin-contact",
- END_CONTACT: "end-contact",
- PRE_SOLVE: "pre-solve",
- POST_SOLVE: "post-solve"
- },
- RayCastType: r,
- DrawBits: b2.DrawFlags,
- PTM_RATIO: 32,
- ANGLE_TO_PHYSICS_ANGLE: -Math.PI / 180,
- PHYSICS_ANGLE_TO_ANGLE: -180 / Math.PI
- }
- }), {}],
- 174: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- var i = e.length;
- return e[t < 0 ? i - -t % i : t % i]
- }
- function r(t, e, i) {
- for (var r = []; e < t;) e += i.length;
- for (; t <= e; ++t) r.push(n(t, i));
- return r
- }
- function s(t, e, i) {
- if (o(t, i)) {
- if (h(n(t, i), n(t - 1, i), n(e, i)) && c(n(t, i), n(t + 1, i), n(e, i))) return !1
- } else if (c(n(t, i), n(t + 1, i), n(e, i)) || h(n(t, i), n(t - 1, i), n(e, i))) return !1;
- if (o(e, i)) {
- if (h(n(e, i), n(e - 1, i), n(t, i)) && c(n(e, i), n(e + 1, i), n(t, i))) return !1
- } else if (c(n(e, i), n(e + 1, i), n(t, i)) || h(n(e, i), n(e - 1, i), n(t, i))) return !1;
- for (var r = 0; r < i.length; ++r)
- if ((r + 1) % i.length != t && r != t && (r + 1) % i.length != e && r != e) {
- var s = cc.v2();
- if (m(n(t, i), n(e, i), n(r, i), n(r + 1, i), s)) return !1
- }
- return !0
- }
- function o(t, e) {
- return a(t, e)
- }
- function a(t, e, i) {
- if (void 0 === i) {
- var r = t,
- s = e;
- t = n(r - 1, s), e = n(r, s), i = n(r + 1, s)
- }
- return v(t, e, i) < 0
- }
- function l(t, e, i) {
- return v(t, e, i) > 0
- }
- function h(t, e, i) {
- return v(t, e, i) >= 0
- }
- function c(t, e, i) {
- return v(t, e, i) <= 0
- }
- function u(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y;
- return i * i + n * n
- }
- function _(t) {
- f(t) || t.reverse()
- }
- function f(t) {
- return t.length < 3 || d(t) > 0
- }
- function d(t) {
- var e, i = 0;
- for (e = 0; e < t.length; e++) {
- var n = (e + 1) % t.length;
- i += t[e].x * t[n].y, i -= t[e].y * t[n].x
- }
- return i /= 2
- }
- function p(t, e, i, n) {
- var r = cc.v2(),
- s = e.y - t.y,
- o = t.x - e.x,
- a = s * t.x + o * t.y,
- l = n.y - i.y,
- h = i.x - n.x,
- c = l * i.x + h * i.y,
- u = s * h - l * o;
- return y(u, 0) || (r.x = (h * a - o * c) / u, r.y = (s * c - l * a) / u), r
- }
- function m(t, e, i, n, r) {
- if (t == i || t == n || e == i || e == n) return !1;
- var s = t.x,
- o = t.y,
- a = e.x,
- l = e.y,
- h = i.x,
- c = i.y,
- u = n.x,
- _ = n.y;
- if (Math.max(s, a) < Math.min(h, u) || Math.max(h, u) < Math.min(s, a)) return !1;
- if (Math.max(o, l) < Math.min(c, _) || Math.max(c, _) < Math.min(o, l)) return !1;
- var f = (u - h) * (o - c) - (_ - c) * (s - h),
- d = (a - s) * (o - c) - (l - o) * (s - h),
- p = (_ - c) * (a - s) - (u - h) * (l - o);
- return !(Math.abs(p) < 1e-6) && (d /= p, 0 < (f /= p) && f < 1 && 0 < d && d < 1 && (r.x = s + f * (a - s), r.y = o + f * (l - o), !0))
- }
- function y(t, e) {
- return Math.abs(t - e) <= 1e-6
- }
- function v(t, e, i) {
- return t.x * (e.y - i.y) + e.x * (i.y - t.y) + i.x * (t.y - e.y)
- }
- e.exports = {
- ConvexPartition: function t(e) {
- _(e);
- for (var i, f, d, m, y, v, g = [], x = cc.v2(), b = cc.v2(), A = 0, C = 0, T = 0; T < e.length; ++T)
- if (o(T, e)) {
- f = d = 1e8;
- for (var S = 0; S < e.length; ++S) l(n(T - 1, e), n(T, e), n(S, e)) && c(n(T - 1, e), n(T, e), n(S - 1, e)) && (m = p(n(T - 1, e), n(T, e), n(S, e), n(S - 1, e)), a(n(T + 1, e), n(T, e), m) && (i = u(n(T, e), m)) < f && (f = i, x = m, A = S)), l(n(T + 1, e), n(T, e), n(S + 1, e)) && c(n(T + 1, e), n(T, e), n(S, e)) && (m = p(n(T + 1, e), n(T, e), n(S, e), n(S + 1, e)), l(n(T - 1, e), n(T, e), m) && (i = u(n(T, e), m)) < d && (d = i, C = S, b = m));
- if (A == (C + 1) % e.length) {
- var w = x.add(b).div(2);
- (y = r(T, C, e)).push(w), (v = r(A, T, e)).push(w)
- } else {
- for (var E = 0, M = A; C < A;) C += e.length;
- for (S = A; S <= C; ++S)
- if (s(T, S, e)) {
- var D = 1 / (u(n(T, e), n(S, e)) + 1);
- o(S, e) ? c(n(S - 1, e), n(S, e), n(T, e)) && h(n(S + 1, e), n(S, e), n(T, e)) ? D += 3 : D += 2 : D += 1, D > E && (M = S, E = D)
- }
- y = r(T, M, e), v = r(M, T, e)
- }
- return g = (g = g.concat(t(y))).concat(t(v))
- }
- g.push(e);
- for (T = g.length - 1; T >= 0; T--) 0 == g[T].length && g.splice(T, 0);
- return g
- },
- ForceCounterClockWise: _,
- IsCounterClockWise: f
- }
- }), {}],
- 175: [(function(t, e, i) {
- "use strict";
- var n = t("../CCNode").EventType,
- r = t("./CCPhysicsTypes").PTM_RATIO,
- s = t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- o = t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,
- a = t("./utils").getWorldRotation,
- l = t("./CCPhysicsTypes").BodyType,
- h = new b2.Vec2,
- c = new b2.Vec2,
- u = cc.Vec2.ZERO,
- _ = cc.Class({
- name: "cc.RigidBody",
- extends: cc.Component,
- editor: !1,
- properties: {
- _type: l.Dynamic,
- _allowSleep: !0,
- _gravityScale: 1,
- _linearDamping: 0,
- _angularDamping: 0,
- _linearVelocity: cc.v2(0, 0),
- _angularVelocity: 0,
- _fixedRotation: !1,
- enabled: {
- get: function() {
- return this._enabled
- },
- set: function() {
- cc.warnID(8200)
- },
- visible: !1,
- override: !0
- },
- enabledContactListener: {
- default: !1,
- tooltip: !1
- },
- bullet: {
- default: !1,
- tooltip: !1
- },
- type: {
- type: l,
- tooltip: !1,
- get: function() {
- return this._type
- },
- set: function(t) {
- this._type = t, this._b2Body && (t === l.Animated ? this._b2Body.SetType(l.Kinematic) : this._b2Body.SetType(t))
- }
- },
- allowSleep: {
- tooltip: !1,
- get: function() {
- return this._b2Body ? this._b2Body.IsSleepingAllowed() : this._allowSleep
- },
- set: function(t) {
- this._allowSleep = t, this._b2Body && this._b2Body.SetSleepingAllowed(t)
- }
- },
- gravityScale: {
- tooltip: !1,
- get: function() {
- return this._gravityScale
- },
- set: function(t) {
- this._gravityScale = t, this._b2Body && this._b2Body.SetGravityScale(t)
- }
- },
- linearDamping: {
- tooltip: !1,
- get: function() {
- return this._linearDamping
- },
- set: function(t) {
- this._linearDamping = t, this._b2Body && this._b2Body.SetLinearDamping(this._linearDamping)
- }
- },
- angularDamping: {
- tooltip: !1,
- get: function() {
- return this._angularDamping
- },
- set: function(t) {
- this._angularDamping = t, this._b2Body && this._b2Body.SetAngularDamping(t)
- }
- },
- linearVelocity: {
- tooltip: !1,
- type: cc.Vec2,
- get: function() {
- var t = this._linearVelocity;
- if (this._b2Body) {
- var e = this._b2Body.GetLinearVelocity();
- t.x = e.x * r, t.y = e.y * r
- }
- return t
- },
- set: function(t) {
- this._linearVelocity = t;
- var e = this._b2Body;
- if (e) {
- var i = e.m_linearVelocity;
- i.Set(t.x / r, t.y / r), e.SetLinearVelocity(i)
- }
- }
- },
- angularVelocity: {
- tooltip: !1,
- get: function() {
- return this._b2Body ? this._b2Body.GetAngularVelocity() * o : this._angularVelocity
- },
- set: function(t) {
- this._angularVelocity = t, this._b2Body && this._b2Body.SetAngularVelocity(t * s)
- }
- },
- fixedRotation: {
- tooltip: !1,
- get: function() {
- return this._fixedRotation
- },
- set: function(t) {
- this._fixedRotation = t, this._b2Body && this._b2Body.SetFixedRotation(t)
- }
- },
- awake: {
- visible: !1,
- tooltip: !1,
- get: function() {
- return !!this._b2Body && this._b2Body.IsAwake()
- },
- set: function(t) {
- this._b2Body && this._b2Body.SetAwake(t)
- }
- },
- awakeOnLoad: {
- default: !0,
- tooltip: !1,
- animatable: !1
- },
- active: {
- visible: !1,
- get: function() {
- return !!this._b2Body && this._b2Body.IsActive()
- },
- set: function(t) {
- this._b2Body && this._b2Body.SetActive(t)
- }
- }
- },
- getLocalPoint: function(t, e) {
- if (e = e || cc.v2(), this._b2Body) {
- h.Set(t.x / r, t.y / r);
- var i = this._b2Body.GetLocalPoint(h, e);
- e.x = i.x * r, e.y = i.y * r
- }
- return e
- },
- getWorldPoint: function(t, e) {
- if (e = e || cc.v2(), this._b2Body) {
- h.Set(t.x / r, t.y / r);
- var i = this._b2Body.GetWorldPoint(h, e);
- e.x = i.x * r, e.y = i.y * r
- }
- return e
- },
- getWorldVector: function(t, e) {
- if (e = e || cc.v2(), this._b2Body) {
- h.Set(t.x / r, t.y / r);
- var i = this._b2Body.GetWorldVector(h, e);
- e.x = i.x * r, e.y = i.y * r
- }
- return e
- },
- getLocalVector: function(t, e) {
- if (e = e || cc.v2(), this._b2Body) {
- h.Set(t.x / r, t.y / r);
- var i = this._b2Body.GetLocalVector(h, e);
- e.x = i.x * r, e.y = i.y * r
- }
- return e
- },
- getWorldPosition: function(t) {
- if (t = t || cc.v2(), this._b2Body) {
- var e = this._b2Body.GetPosition();
- t.x = e.x * r, t.y = e.y * r
- }
- return t
- },
- getWorldRotation: function() {
- return this._b2Body ? this._b2Body.GetAngle() * o : 0
- },
- getLocalCenter: function(t) {
- if (t = t || cc.v2(), this._b2Body) {
- var e = this._b2Body.GetLocalCenter();
- t.x = e.x * r, t.y = e.y * r
- }
- return t
- },
- getWorldCenter: function(t) {
- if (t = t || cc.v2(), this._b2Body) {
- var e = this._b2Body.GetWorldCenter();
- t.x = e.x * r, t.y = e.y * r
- }
- return t
- },
- getLinearVelocityFromWorldPoint: function(t, e) {
- if (e = e || cc.v2(), this._b2Body) {
- h.Set(t.x / r, t.y / r);
- var i = this._b2Body.GetLinearVelocityFromWorldPoint(h, e);
- e.x = i.x * r, e.y = i.y * r
- }
- return e
- },
- getMass: function() {
- return this._b2Body ? this._b2Body.GetMass() : 0
- },
- getInertia: function() {
- return this._b2Body ? this._b2Body.GetInertia() * r * r : 0
- },
- getJointList: function() {
- if (!this._b2Body) return [];
- var t = [],
- e = this._b2Body.GetJointList();
- if (!e) return [];
- t.push(e.joint._joint);
- for (var i = e.prev; i;) t.push(i.joint._joint), i = i.prev;
- for (var n = e.next; n;) t.push(n.joint._joint), n = n.next;
- return t
- },
- applyForce: function(t, e, i) {
- this._b2Body && (h.Set(t.x / r, t.y / r), c.Set(e.x / r, e.y / r), this._b2Body.ApplyForce(h, c, i))
- },
- applyForceToCenter: function(t, e) {
- this._b2Body && (h.Set(t.x / r, t.y / r), this._b2Body.ApplyForceToCenter(h, e))
- },
- applyTorque: function(t, e) {
- this._b2Body && this._b2Body.ApplyTorque(t / r, e)
- },
- applyLinearImpulse: function(t, e, i) {
- this._b2Body && (h.Set(t.x / r, t.y / r), c.Set(e.x / r, e.y / r), this._b2Body.ApplyLinearImpulse(h, c, i))
- },
- applyAngularImpulse: function(t, e) {
- this._b2Body && this._b2Body.ApplyAngularImpulse(t / r / r, e)
- },
- syncPosition: function(t) {
- var e = this._b2Body;
- if (e) {
- var i, n = this.node.convertToWorldSpaceAR(u);
- if ((i = this.type === l.Animated ? e.GetLinearVelocity() : e.GetPosition()).x = n.x / r, i.y = n.y / r, this.type === l.Animated && t) {
- var s = e.GetPosition(),
- o = cc.game.config.frameRate;
- i.x = (i.x - s.x) * o, i.y = (i.y - s.y) * o, e.SetAwake(!0), e.SetLinearVelocity(i)
- } else e.SetTransformVec(i, e.GetAngle())
- }
- },
- syncRotation: function(t) {
- var e = this._b2Body;
- if (e) {
- var i = s * a(this.node);
- if (this.type === l.Animated && t) {
- var n = e.GetAngle(),
- r = cc.game.config.frameRate;
- e.SetAwake(!0), e.SetAngularVelocity((i - n) * r)
- } else e.SetTransformVec(e.GetPosition(), i)
- }
- },
- resetVelocity: function() {
- var t = this._b2Body;
- if (t) {
- var e = t.m_linearVelocity;
- e.Set(0, 0), t.SetLinearVelocity(e), t.SetAngularVelocity(0)
- }
- },
- onEnable: function() {
- this._init()
- },
- onDisable: function() {
- this._destroy()
- },
- _registerNodeEvents: function() {
- var t = this.node;
- t.on(n.POSITION_CHANGED, this._onNodePositionChanged, this), t.on(n.ROTATION_CHANGED, this._onNodeRotationChanged, this), t.on(n.SCALE_CHANGED, this._onNodeScaleChanged, this)
- },
- _unregisterNodeEvents: function() {
- var t = this.node;
- t.off(n.POSITION_CHANGED, this._onNodePositionChanged, this), t.off(n.ROTATION_CHANGED, this._onNodeRotationChanged, this), t.off(n.SCALE_CHANGED, this._onNodeScaleChanged, this)
- },
- _onNodePositionChanged: function() {
- this.syncPosition(!0)
- },
- _onNodeRotationChanged: function(t) {
- this.syncRotation(!0)
- },
- _onNodeScaleChanged: function(t) {
- if (this._b2Body)
- for (var e = this.getComponents(cc.PhysicsCollider), i = 0; i < e.length; i++) e[i].apply()
- },
- _init: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
- },
- _destroy: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
- },
- __init: function() {
- if (!this._inited) {
- this._registerNodeEvents();
- var t = new b2.BodyDef;
- this.type === l.Animated ? t.type = l.Kinematic : t.type = this.type, t.allowSleep = this.allowSleep, t.gravityScale = this.gravityScale, t.linearDamping = this.linearDamping, t.angularDamping = this.angularDamping;
- var e = this.linearVelocity;
- t.linearVelocity = new b2.Vec2(e.x / r, e.y / r), t.angularVelocity = this.angularVelocity * s, t.fixedRotation = this.fixedRotation, t.bullet = this.bullet;
- var i = this.node,
- n = i.convertToWorldSpaceAR(u);
- t.position = new b2.Vec2(n.x / r, n.y / r), t.angle = -Math.PI / 180 * a(i), t.awake = this.awakeOnLoad, cc.director.getPhysicsManager()._addBody(this, t), this._inited = !0
- }
- },
- __destroy: function() {
- this._inited && (cc.director.getPhysicsManager()._removeBody(this), this._unregisterNodeEvents(), this._inited = !1)
- },
- _getBody: function() {
- return this._b2Body
- }
- });
- cc.RigidBody = e.exports = _
- }), {
- "../CCNode": 52,
- "./CCPhysicsTypes": 173,
- "./utils": 196
- }],
- 176: [(function(t, e, i) {
- "use strict";
- var n = t("../../../external/box2d/box2d");
- for (var r in window.b2 = {}, n)
- if (-1 === r.indexOf("b2_")) {
- var s = r.replace("b2", "");
- b2[s] = n[r]
- }
- b2.maxPolygonVertices = 8
- }), {
- "../../../external/box2d/box2d": 421
- }],
- 177: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.PhysicsBoxCollider",
- extends: cc.PhysicsCollider,
- mixins: [cc.Collider.Box],
- editor: {
- menu: !1,
- requireComponent: cc.RigidBody
- },
- _createShape: function(t) {
- var e = Math.abs(t.x),
- i = Math.abs(t.y),
- r = this.size.width / 2 / n * e,
- s = this.size.height / 2 / n * i,
- o = this.offset.x / n * e,
- a = this.offset.y / n * i,
- l = new b2.PolygonShape;
- return l.SetAsBox(r, s, new b2.Vec2(o, a), 0), l
- }
- });
- cc.PhysicsBoxCollider = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 178: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.PhysicsChainCollider",
- extends: cc.PhysicsCollider,
- editor: {
- menu: !1,
- inspector: !1,
- requireComponent: cc.RigidBody
- },
- properties: {
- loop: !1,
- points: {
- default: function() {
- return [cc.v2(-50, 0), cc.v2(50, 0)]
- },
- type: [cc.Vec2]
- },
- threshold: {
- default: 1,
- serializable: !1,
- visible: !1
- }
- },
- _createShape: function(t) {
- for (var e = new b2.ChainShape, i = this.points, r = [], s = 0; s < i.length; s++) {
- var o = i[s];
- r.push(new b2.Vec2(o.x / n * t.x, o.y / n * t.y))
- }
- return this.loop ? e.CreateLoop(r, r.length) : e.CreateChain(r, r.length), e
- },
- resetInEditor: !1,
- resetPointsByContour: !1
- });
- cc.PhysicsChainCollider = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 179: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.PhysicsCircleCollider",
- extends: cc.PhysicsCollider,
- mixins: [cc.Collider.Circle],
- editor: {
- menu: !1,
- requireComponent: cc.RigidBody
- },
- _createShape: function(t) {
- var e = Math.abs(t.x),
- i = Math.abs(t.y),
- r = this.offset.x / n * e,
- s = this.offset.y / n * i,
- o = new b2.CircleShape;
- return o.m_radius = this.radius / n * e, o.m_p = new b2.Vec2(r, s), o
- }
- });
- cc.PhysicsCircleCollider = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 180: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../utils").getWorldScale,
- s = cc.Class({
- name: "cc.PhysicsCollider",
- extends: cc.Collider,
- ctor: function() {
- this._fixtures = [], this._shapes = [], this._inited = !1, this._rect = cc.rect()
- },
- properties: {
- _density: 1,
- _sensor: !1,
- _friction: .2,
- _restitution: 0,
- density: {
- tooltip: !1,
- get: function() {
- return this._density
- },
- set: function(t) {
- this._density = t
- }
- },
- sensor: {
- tooltip: !1,
- get: function() {
- return this._sensor
- },
- set: function(t) {
- this._sensor = t
- }
- },
- friction: {
- tooltip: !1,
- get: function() {
- return this._friction
- },
- set: function(t) {
- this._friction = t
- }
- },
- restitution: {
- tooltip: !1,
- get: function() {
- return this._restitution
- },
- set: function(t) {
- this._restitution = t
- }
- },
- body: {
- default: null,
- type: cc.RigidBody,
- visible: !1
- }
- },
- onDisable: function() {
- this._destroy()
- },
- onEnable: function() {
- this._init()
- },
- start: function() {
- this._init()
- },
- _getFixtureIndex: function(t) {
- return this._fixtures.indexOf(t)
- },
- _init: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
- },
- _destroy: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
- },
- __init: function() {
- if (!this._inited) {
- var t = this.body || this.getComponent(cc.RigidBody);
- if (t) {
- var e = t._getBody();
- if (e) {
- var i = t.node,
- n = r(i);
- this._scale = n;
- var s = 0 === n.x && 0 === n.y ? [] : this._createShape(n);
- s instanceof Array || (s = [s]);
- for (var o = 1 << i.groupIndex, a = 0, l = cc.game.collisionMatrix[i.groupIndex], h = 0; h < l.length; h++) l[h] && (a |= 1 << h);
- for (var c = {
- categoryBits: o,
- maskBits: a,
- groupIndex: 0
- }, u = cc.director.getPhysicsManager(), _ = 0; _ < s.length; _++) {
- var f = s[_],
- d = new b2.FixtureDef;
- d.density = this.density, d.isSensor = this.sensor, d.friction = this.friction, d.restitution = this.restitution, d.shape = f, d.filter = c;
- var p = e.CreateFixture(d);
- p.collider = this, t.enabledContactListener && u._registerContactFixture(p), this._shapes.push(f), this._fixtures.push(p)
- }
- this.body = t, this._inited = !0
- }
- }
- }
- },
- __destroy: function() {
- if (this._inited) {
- for (var t = this._fixtures, e = this.body._getBody(), i = cc.director.getPhysicsManager(), n = t.length - 1; n >= 0; n--) {
- var r = t[n];
- r.collider = null, i._unregisterContactFixture(r), e && e.DestroyFixture(r)
- }
- this.body = null, this._fixtures.length = 0, this._shapes.length = 0, this._inited = !1
- }
- },
- _createShape: function() {},
- apply: function() {
- this._destroy(), this._init()
- },
- getAABB: function() {
- for (var t = 1e7, e = 1e7, i = -1e7, r = -1e7, s = this._fixtures, o = 0; o < s.length; o++)
- for (var a = s[o], l = a.GetShape().GetChildCount(), h = 0; h < l; h++) {
- var c = a.GetAABB(h);
- c.lowerBound.x < t && (t = c.lowerBound.x), c.lowerBound.y < e && (e = c.lowerBound.y), c.upperBound.x > i && (i = c.upperBound.x), c.upperBound.y > r && (r = c.upperBound.y)
- }
- t *= n, e *= n, i *= n, r *= n;
- var u = this._rect;
- return u.x = t, u.y = e, u.width = i - t, u.height = r - e, u
- }
- });
- cc.PhysicsCollider = e.exports = s
- }), {
- "../CCPhysicsTypes": 173,
- "../utils": 196
- }],
- 181: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPolygonSeparator"),
- s = cc.Class({
- name: "cc.PhysicsPolygonCollider",
- extends: cc.PhysicsCollider,
- mixins: [cc.Collider.Polygon],
- editor: {
- menu: !1,
- inspector: !1,
- requireComponent: cc.RigidBody
- },
- _createShape: function(t) {
- var e = [],
- i = this.points;
- i.length > 0 && i[0].equals(i[i.length - 1]) && (i.length -= 1);
- for (var s = r.ConvexPartition(i), o = this.offset, a = 0; a < s.length; a++) {
- for (var l = s[a], h = null, c = [], u = null, _ = 0, f = l.length; _ < f; _++) {
- h || (h = new b2.PolygonShape);
- var d = l[_],
- p = (d.x + o.x) / n * t.x,
- m = (d.y + o.y) / n * t.y,
- y = new b2.Vec2(p, m);
- c.push(y), u || (u = y), c.length === b2.maxPolygonVertices && (h.Set(c, c.length), e.push(h), h = null, _ < f - 1 && (c = [u, c[c.length - 1]]))
- }
- h && (h.Set(c, c.length), e.push(h))
- }
- return e
- }
- });
- cc.PhysicsPolygonCollider = e.exports = s
- }), {
- "../CCPhysicsTypes": 173,
- "../CCPolygonSeparator": 174
- }],
- 182: [(function(t, e, i) {
- "use strict";
- t("./box2d-adapter"), t("./CCPhysicsManager"), t("./CCRigidBody"), t("./CCPhysicsContact"), t("./collider/CCPhysicsCollider"), t("./collider/CCPhysicsChainCollider"), t("./collider/CCPhysicsCircleCollider"), t("./collider/CCPhysicsBoxCollider"), t("./collider/CCPhysicsPolygonCollider"), t("./joint/CCJoint"), t("./joint/CCDistanceJoint"), t("./joint/CCRevoluteJoint"), t("./joint/CCMouseJoint"), t("./joint/CCMotorJoint"), t("./joint/CCPrismaticJoint"), t("./joint/CCWeldJoint"), t("./joint/CCWheelJoint"), t("./joint/CCRopeJoint"), t("./platform/CCPhysicsContactListner"), t("./platform/CCPhysicsAABBQueryCallback"), t("./platform/CCPhysicsRayCastCallback")
- }), {
- "./CCPhysicsContact": 171,
- "./CCPhysicsManager": 172,
- "./CCRigidBody": 175,
- "./box2d-adapter": 176,
- "./collider/CCPhysicsBoxCollider": 177,
- "./collider/CCPhysicsChainCollider": 178,
- "./collider/CCPhysicsCircleCollider": 179,
- "./collider/CCPhysicsCollider": 180,
- "./collider/CCPhysicsPolygonCollider": 181,
- "./joint/CCDistanceJoint": 183,
- "./joint/CCJoint": 184,
- "./joint/CCMotorJoint": 185,
- "./joint/CCMouseJoint": 186,
- "./joint/CCPrismaticJoint": 187,
- "./joint/CCRevoluteJoint": 188,
- "./joint/CCRopeJoint": 189,
- "./joint/CCWeldJoint": 190,
- "./joint/CCWheelJoint": 191,
- "./platform/CCPhysicsAABBQueryCallback": 192,
- "./platform/CCPhysicsContactListner": 193,
- "./platform/CCPhysicsRayCastCallback": 195
- }],
- 183: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.DistanceJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _distance: 1,
- _frequency: 0,
- _dampingRatio: 0,
- distance: {
- tooltip: !1,
- get: function() {
- return this._distance
- },
- set: function(t) {
- this._distance = t, this._joint && this._joint.SetLength(t)
- }
- },
- frequency: {
- tooltip: !1,
- get: function() {
- return this._frequency
- },
- set: function(t) {
- this._frequency = t, this._joint && this._joint.SetFrequency(t)
- }
- },
- dampingRatio: {
- tooltip: !1,
- get: function() {
- return this._dampingRatio
- },
- set: function(t) {
- this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.DistanceJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.length = this.distance / n, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
- }
- });
- cc.DistanceJoint = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 184: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.Joint",
- extends: cc.Component,
- editor: {
- requireComponent: cc.RigidBody
- },
- properties: {
- anchor: {
- default: cc.v2(0, 0),
- tooltip: !1
- },
- connectedAnchor: {
- default: cc.v2(0, 0),
- tooltip: !1
- },
- connectedBody: {
- default: null,
- type: cc.RigidBody,
- tooltip: !1
- },
- collideConnected: {
- default: !1,
- tooltip: !1
- }
- },
- onDisable: function() {
- this._destroy()
- },
- onEnable: function() {
- this._init()
- },
- start: function() {
- this._init()
- },
- apply: function() {
- this._destroy(), this._init()
- },
- getWorldAnchor: function() {
- if (this._joint) {
- var t = this._joint.GetAnchorA();
- return cc.v2(t.x * n, t.y * n)
- }
- return cc.Vec2.ZERO
- },
- getWorldConnectedAnchor: function() {
- if (this._joint) {
- var t = this._joint.GetAnchorB();
- return cc.v2(t.x * n, t.y * n)
- }
- return cc.Vec2.ZERO
- },
- getReactionForce: function(t) {
- var e = cc.v2();
- return this._joint ? this._joint.GetReactionForce(t, e) : e
- },
- getReactionTorque: function(t) {
- return this._joint ? this._joint.GetReactionTorque(t) : 0
- },
- _init: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
- },
- _destroy: function() {
- cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
- },
- __init: function() {
- if (!this._inited && (this.body = this.getComponent(cc.RigidBody), this._isValid())) {
- var t = this._createJointDef();
- if (!t) return;
- t.bodyA = this.body._getBody(), t.bodyB = this.connectedBody._getBody(), t.collideConnected = this.collideConnected, cc.director.getPhysicsManager()._addJoint(this, t), this._inited = !0
- }
- },
- __destroy: function() {
- this._inited && (cc.director.getPhysicsManager()._removeJoint(this), this._joint = null, this._inited = !1)
- },
- _createJointDef: function() {
- return null
- },
- _isValid: function() {
- return this.body && this.body._getBody() && this.connectedBody && this.connectedBody._getBody()
- }
- });
- cc.Joint = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 185: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- s = cc.Class({
- name: "cc.MotorJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _linearOffset: cc.v2(0, 0),
- _angularOffset: 0,
- _maxForce: 1,
- _maxTorque: 1,
- _correctionFactor: .3,
- anchor: {
- tooltip: !1,
- default: cc.v2(0, 0),
- override: !0,
- visible: !1
- },
- connectedAnchor: {
- tooltip: !1,
- default: cc.v2(0, 0),
- override: !0,
- visible: !1
- },
- linearOffset: {
- tooltip: !1,
- get: function() {
- return this._linearOffset
- },
- set: function(t) {
- this._linearOffset = t, this._joint && this._joint.SetLinearOffset(new b2.Vec2(t.x / n, t.y / n))
- }
- },
- angularOffset: {
- tooltip: !1,
- get: function() {
- return this._angularOffset
- },
- set: function(t) {
- this._angularOffset = t, this._joint && this._joint.SetAngularOffset(t)
- }
- },
- maxForce: {
- tooltip: !1,
- get: function() {
- return this._maxForce
- },
- set: function(t) {
- this._maxForce = t, this._joint && this._joint.SetMaxForce(t)
- }
- },
- maxTorque: {
- tooltip: !1,
- get: function() {
- return this._maxTorque
- },
- set: function(t) {
- this._maxTorque = t, this._joint && this._joint.SetMaxTorque(t)
- }
- },
- correctionFactor: {
- tooltip: !1,
- get: function() {
- return this._correctionFactor
- },
- set: function(t) {
- this._correctionFactor = t, this._joint && this._joint.SetCorrectionFactor(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.MotorJointDef;
- return t.linearOffset = new b2.Vec2(this.linearOffset.x / n, this.linearOffset.y / n), t.angularOffset = this.angularOffset * r, t.maxForce = this.maxForce, t.maxTorque = this.maxTorque, t.correctionFactor = this.correctionFactor, t
- }
- });
- cc.MotorJoint = e.exports = s
- }), {
- "../CCPhysicsTypes": 173
- }],
- 186: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = new b2.Vec2,
- s = cc.Class({
- name: "cc.MouseJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _target: 1,
- _frequency: 5,
- _dampingRatio: .7,
- _maxForce: 0,
- connectedBody: {
- default: null,
- type: cc.RigidBody,
- visible: !1,
- override: !0
- },
- collideConnected: {
- default: !0,
- visible: !1,
- override: !0
- },
- anchor: {
- tooltip: !1,
- default: cc.v2(0, 0),
- override: !0,
- visible: !1
- },
- connectedAnchor: {
- tooltip: !1,
- default: cc.v2(0, 0),
- override: !0,
- visible: !1
- },
- mouseRegion: {
- tooltip: !1,
- default: null,
- type: cc.Node
- },
- target: {
- tooltip: !1,
- visible: !1,
- get: function() {
- return this._target
- },
- set: function(t) {
- this._target = t, this._joint && (r.x = t.x / n, r.y = t.y / n, this._joint.SetTarget(r))
- }
- },
- frequency: {
- tooltip: !1,
- get: function() {
- return this._frequency
- },
- set: function(t) {
- this._frequency = t, this._joint && this._joint.SetFrequency(t)
- }
- },
- dampingRatio: {
- tooltip: !1,
- get: function() {
- return this._dampingRatio
- },
- set: function(t) {
- this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
- }
- },
- maxForce: {
- tooltip: !1,
- visible: !1,
- get: function() {
- return this._maxForce
- },
- set: function(t) {
- this._maxForce = t, this._joint && this._joint.SetMaxForce(t)
- }
- }
- },
- onLoad: function() {
- var t = this.mouseRegion || this.node;
- t.on(cc.Node.EventType.TOUCH_START, this.onTouchBegan, this), t.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this), t.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this), t.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this)
- },
- onEnable: function() {},
- start: function() {},
- onTouchBegan: function(t) {
- var e = cc.director.getPhysicsManager(),
- i = this._pressPoint = t.touch.getLocation();
- cc.Camera && cc.Camera.main && (i = cc.Camera.main.getScreenToWorldPoint(i));
- var n = e.testPoint(i);
- n && ((this.connectedBody = n.body).awake = !0, this.maxForce = 1e3 * this.connectedBody.getMass(), this.target = i, this._init())
- },
- onTouchMove: function(t) {
- this._pressPoint = t.touch.getLocation()
- },
- onTouchEnd: function(t) {
- this._destroy(), this._pressPoint = null
- },
- _createJointDef: function() {
- var t = new b2.MouseJointDef;
- return r.x = this.target.x / n, r.y = this.target.y / n, t.target = r, t.maxForce = this.maxForce, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
- },
- update: function() {
- if (this._pressPoint && this._isValid()) {
- var t = cc.Camera.findCamera(this.node);
- this.target = t ? t.getScreenToWorldPoint(this._pressPoint) : this._pressPoint
- }
- }
- });
- cc.MouseJoint = e.exports = s
- }), {
- "../CCPhysicsTypes": 173
- }],
- 187: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- s = cc.Class({
- name: "cc.PrismaticJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- localAxisA: {
- default: cc.v2(1, 0),
- tooltip: !1
- },
- referenceAngle: {
- default: 0,
- tooltip: !1
- },
- enableLimit: {
- default: !1,
- tooltip: !1
- },
- enableMotor: {
- default: !1,
- tooltip: !1
- },
- lowerLimit: {
- default: 0,
- tooltip: !1
- },
- upperLimit: {
- default: 0,
- tooltip: !1
- },
- _maxMotorForce: 0,
- _motorSpeed: 0,
- maxMotorForce: {
- tooltip: !1,
- get: function() {
- return this._maxMotorForce
- },
- set: function(t) {
- this._maxMotorForce = t, this._joint && this._joint.SetMaxMotorForce(t)
- }
- },
- motorSpeed: {
- tooltip: !1,
- get: function() {
- return this._motorSpeed
- },
- set: function(t) {
- this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.PrismaticJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y), t.referenceAngle = this.referenceAngle * r, t.enableLimit = this.enableLimit, t.lowerTranslation = this.lowerLimit / n, t.upperTranslation = this.upperLimit / n, t.enableMotor = this.enableMotor, t.maxMotorForce = this.maxMotorForce, t.motorSpeed = this.motorSpeed, t
- }
- });
- cc.PrismaticJoint = e.exports = s
- }), {
- "../CCPhysicsTypes": 173
- }],
- 188: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- s = t("../CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,
- o = cc.Class({
- name: "cc.RevoluteJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _maxMotorTorque: 0,
- _motorSpeed: 0,
- _enableLimit: !1,
- _enableMotor: !1,
- referenceAngle: {
- default: 0,
- tooltip: !1
- },
- lowerAngle: {
- default: 0,
- tooltip: !1
- },
- upperAngle: {
- default: 0,
- tooltip: !1
- },
- maxMotorTorque: {
- tooltip: !1,
- get: function() {
- return this._maxMotorTorque
- },
- set: function(t) {
- this._maxMotorTorque = t, this._joint && this._joint.SetMaxMotorTorque(t)
- }
- },
- motorSpeed: {
- tooltip: !1,
- get: function() {
- return this._motorSpeed
- },
- set: function(t) {
- this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t * r)
- }
- },
- enableLimit: {
- tooltip: !1,
- get: function() {
- return this._enableLimit
- },
- set: function(t) {
- this._enableLimit = t, this._joint && this._joint.EnableLimit(t)
- }
- },
- enableMotor: {
- tooltip: !1,
- get: function() {
- return this._enableMotor
- },
- set: function(t) {
- this._enableMotor = t, this._joint && this._joint.EnableMotor(t)
- }
- }
- },
- getJointAngle: function() {
- return this._joint ? this._joint.GetJointAngle() * s : 0
- },
- setLimits: function(t, e) {
- if (this._joint) return this._joint.SetLimits(t * r, e * r)
- },
- _createJointDef: function() {
- var t = new b2.RevoluteJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.lowerAngle = this.upperAngle * r, t.upperAngle = this.lowerAngle * r, t.maxMotorTorque = this.maxMotorTorque, t.motorSpeed = this.motorSpeed * r, t.enableLimit = this.enableLimit, t.enableMotor = this.enableMotor, t.referenceAngle = this.referenceAngle * r, t
- }
- });
- cc.RevoluteJoint = e.exports = o
- }), {
- "../CCPhysicsTypes": 173
- }],
- 189: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.Class({
- name: "cc.RopeJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _maxLength: 1,
- maxLength: {
- tooltip: !1,
- get: function() {
- return this._maxLength
- },
- set: function(t) {
- this._maxLength = t, this._joint && this._joint.SetMaxLength(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.RopeJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.maxLength = this.maxLength / n, t
- }
- });
- cc.RopeJoint = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 190: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- s = cc.Class({
- name: "cc.WeldJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- referenceAngle: {
- default: 0,
- tooltip: !1
- },
- _frequency: 0,
- _dampingRatio: 0,
- frequency: {
- tooltip: !1,
- get: function() {
- return this._frequency
- },
- set: function(t) {
- this._frequency = t, this._joint && this._joint.SetFrequency(t)
- }
- },
- dampingRatio: {
- tooltip: !1,
- get: function() {
- return this._dampingRatio
- },
- set: function(t) {
- this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.WeldJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.referenceAngle = this.referenceAngle * r, t.frequencyHz = this.frequency, t.dampingRatio = this.dampingRatio, t
- }
- });
- cc.WeldJoint = e.exports = s
- }), {
- "../CCPhysicsTypes": 173
- }],
- 191: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
- s = cc.Class({
- name: "cc.WheelJoint",
- extends: cc.Joint,
- editor: !1,
- properties: {
- _maxMotorTorque: 0,
- _motorSpeed: 0,
- _enableMotor: !1,
- _frequency: 2,
- _dampingRatio: .7,
- localAxisA: {
- default: cc.v2(1, 0),
- tooltip: !1
- },
- maxMotorTorque: {
- tooltip: !1,
- get: function() {
- return this._maxMotorTorque
- },
- set: function(t) {
- this._maxMotorTorque = t, this._joint && this._joint.SetMaxMotorTorque(t)
- }
- },
- motorSpeed: {
- tooltip: !1,
- get: function() {
- return this._motorSpeed
- },
- set: function(t) {
- this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t * r)
- }
- },
- enableMotor: {
- tooltip: !1,
- get: function() {
- return this._enableMotor
- },
- set: function(t) {
- this._enableMotor = t, this._joint && this._joint.EnableMotor(t)
- }
- },
- frequency: {
- tooltip: !1,
- get: function() {
- return this._frequency
- },
- set: function(t) {
- this._frequency = t, this._joint && this._joint.SetFrequency(t)
- }
- },
- dampingRatio: {
- tooltip: !1,
- get: function() {
- return this._dampingRatio
- },
- set: function(t) {
- this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
- }
- }
- },
- _createJointDef: function() {
- var t = new b2.WheelJointDef;
- return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y), t.maxMotorTorque = this.maxMotorTorque, t.motorSpeed = this.motorSpeed * r, t.enableMotor = this.enableMotor, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
- }
- });
- cc.WheelJoint = e.exports = s
- }), {
- "../CCPhysicsTypes": 173
- }],
- 192: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").BodyType;
- function r() {
- this._point = new b2.Vec2, this._isPoint = !1, this._fixtures = []
- }
- r.prototype.init = function(t) {
- t ? (this._isPoint = !0, this._point.x = t.x, this._point.y = t.y) : this._isPoint = !1, this._fixtures.length = 0
- }, r.prototype.ReportFixture = function(t) {
- if (t.GetBody().GetType() === n.Dynamic)
- if (this._isPoint) {
- if (t.TestPoint(this._point)) return this._fixtures.push(t), !1
- } else this._fixtures.push(t);
- return !0
- }, r.prototype.getFixture = function() {
- return this._fixtures[0]
- }, r.prototype.getFixtures = function() {
- return this._fixtures
- }, cc.PhysicsAABBQueryCallback = e.exports = r
- }), {
- "../CCPhysicsTypes": 173
- }],
- 193: [(function(t, e, i) {
- "use strict";
- function n() {
- this._contactFixtures = []
- }
- n.prototype.setBeginContact = function(t) {
- this._BeginContact = t
- }, n.prototype.setEndContact = function(t) {
- this._EndContact = t
- }, n.prototype.setPreSolve = function(t) {
- this._PreSolve = t
- }, n.prototype.setPostSolve = function(t) {
- this._PostSolve = t
- }, n.prototype.BeginContact = function(t) {
- if (this._BeginContact) {
- var e = t.GetFixtureA(),
- i = t.GetFixtureB(),
- n = this._contactFixtures;
- t._shouldReport = !1, -1 === n.indexOf(e) && -1 === n.indexOf(i) || (t._shouldReport = !0, this._BeginContact(t))
- }
- }, n.prototype.EndContact = function(t) {
- this._EndContact && t._shouldReport && (t._shouldReport = !1, this._EndContact(t))
- }, n.prototype.PreSolve = function(t, e) {
- this._PreSolve && t._shouldReport && this._PreSolve(t, e)
- }, n.prototype.PostSolve = function(t, e) {
- this._PostSolve && t._shouldReport && this._PostSolve(t, e)
- }, n.prototype.registerContactFixture = function(t) {
- this._contactFixtures.push(t)
- }, n.prototype.unregisterContactFixture = function(t) {
- cc.js.array.remove(this._contactFixtures, t)
- }, cc.PhysicsContactListener = e.exports = n
- }), {}],
- 194: [(function(t, e, i) {
- "use strict";
- var n = t("../CCPhysicsTypes").PTM_RATIO,
- r = cc.v2(),
- s = cc.Color.GREEN,
- o = cc.Color.RED;
- function a(t) {
- b2.Draw.call(this), this._drawer = t, this._xf = this._dxf = new b2.Transform
- }
- cc.js.extend(a, b2.Draw), cc.js.mixin(a.prototype, {
- _DrawPolygon: function(t, e) {
- for (var i = this._drawer, s = 0; s < e; s++) {
- b2.Transform.MulXV(this._xf, t[s], r);
- var o = r.x * n,
- a = r.y * n;
- 0 === s ? i.moveTo(o, a) : i.lineTo(o, a)
- }
- i.close()
- },
- DrawPolygon: function(t, e, i) {
- this._applyStrokeColor(i), this._DrawPolygon(t, e), this._drawer.stroke()
- },
- DrawSolidPolygon: function(t, e, i) {
- this._applyFillColor(i), this._DrawPolygon(t, e), this._drawer.fill(), this._drawer.stroke()
- },
- _DrawCircle: function(t, e) {
- var i = this._xf.p;
- this._drawer.circle((t.x + i.x) * n, (t.y + i.y) * n, e * n)
- },
- DrawCircle: function(t, e, i) {
- this._applyStrokeColor(i), this._DrawCircle(t, e), this._drawer.stroke()
- },
- DrawSolidCircle: function(t, e, i, n) {
- this._applyFillColor(n), this._DrawCircle(t, e), this._drawer.fill()
- },
- DrawSegment: function(t, e, i) {
- var s = this._drawer;
- if (t.x === e.x && t.y === e.y) return this._applyFillColor(i), this._DrawCircle(t, 2 / n), void s.fill();
- this._applyStrokeColor(i), b2.Transform.MulXV(this._xf, t, r), s.moveTo(r.x * n, r.y * n), b2.Transform.MulXV(this._xf, e, r), s.lineTo(r.x * n, r.y * n), s.stroke()
- },
- DrawTransform: function(t) {
- var e = this._drawer;
- e.strokeColor = o, r.x = r.y = 0, b2.Transform.MulXV(t, r, r), e.moveTo(r.x * n, r.y * n), r.x = 1, r.y = 0, b2.Transform.MulXV(t, r, r), e.lineTo(r.x * n, r.y * n), e.stroke(), e.strokeColor = s, r.x = r.y = 0, b2.Transform.MulXV(t, r, r), e.moveTo(r.x * n, r.y * n), r.x = 0, r.y = 1, b2.Transform.MulXV(t, r, r), e.lineTo(r.x * n, r.y * n), e.stroke()
- },
- DrawPoint: function(t, e, i) {},
- _applyStrokeColor: function(t) {
- var e = this._drawer.strokeColor;
- e.r = 255 * t.r, e.g = 255 * t.g, e.b = 255 * t.b, e.a = 150, this._drawer.strokeColor = e
- },
- _applyFillColor: function(t) {
- var e = this._drawer.fillColor;
- e.r = 255 * t.r, e.g = 255 * t.g, e.b = 255 * t.b, e.a = 150, this._drawer.fillColor = e
- },
- PushTransform: function(t) {
- this._xf = t
- },
- PopTransform: function() {
- this._xf = this._dxf
- }
- }), e.exports = a
- }), {
- "../CCPhysicsTypes": 173
- }],
- 195: [(function(t, e, i) {
- "use strict";
- function n() {
- this._type = 0, this._fixtures = [], this._points = [], this._normals = [], this._fractions = []
- }
- n.prototype.init = function(t) {
- this._type = t, this._fixtures.length = 0, this._points.length = 0, this._normals.length = 0, this._fractions.length = 0
- }, n.prototype.ReportFixture = function(t, e, i, n) {
- return 0 === this._type ? (this._fixtures[0] = t, this._points[0] = e, this._normals[0] = i, this._fractions[0] = n, n) : (this._fixtures.push(t), this._points.push(cc.v2(e)), this._normals.push(cc.v2(i)), this._fractions.push(n), 1 === this._type ? 0 : this._type >= 2 ? 1 : n)
- }, n.prototype.getFixtures = function() {
- return this._fixtures
- }, n.prototype.getPoints = function() {
- return this._points
- }, n.prototype.getNormals = function() {
- return this._normals
- }, n.prototype.getFractions = function() {
- return this._fractions
- }, cc.PhysicsRayCastCallback = e.exports = n
- }), {}],
- 196: [(function(t, e, i) {
- "use strict";
- e.exports = {
- getWorldRotation: function(t) {
- for (var e = t.angle, i = t.parent; i.parent;) e += i.angle, i = i.parent;
- return -e
- },
- getWorldScale: function(t) {
- for (var e = t.scaleX, i = t.scaleY, n = t.parent; n.parent;) e *= n.scaleX, i *= n.scaleY, n = n.parent;
- return cc.v2(e, i)
- },
- convertToNodeRotation: function(t, e) {
- e -= -t.angle;
- for (var i = t.parent; i.parent;) e -= -i.angle, i = i.parent;
- return e
- }
- }
- }), {}],
- 197: [(function(t, e, i) {
- "use strict";
- t("../assets/CCAsset");
- var n = t("./utils").callInNextTick,
- r = t("../load-pipeline/CCLoader"),
- s = t("../load-pipeline/asset-table"),
- o = t("../load-pipeline/pack-downloader"),
- a = t("../load-pipeline/auto-release-utils"),
- l = t("../utils/decode-uuid"),
- h = t("../load-pipeline/md5-pipe"),
- c = t("../load-pipeline/subpackage-pipe"),
- u = t("./js"),
- _ = "",
- f = "",
- d = u.createMap(!0);
- function p(t) {
- return t && (t.constructor === cc.SceneAsset || t instanceof cc.Scene)
- }
- function m(t, e) {
- this.url = t, this.type = e
- }
- var y = {
- loadAsset: function(t, e, i) {
- if ("string" != typeof t) return n(e, new Error("[AssetLibrary] uuid must be string"), null);
- var s = {
- uuid: t,
- type: "uuid"
- };
- i && i.existingAsset && (s.existingAsset = i.existingAsset), r.load(s, (function(i, n) {
- if (i || !n) {
- var s = "string" == typeof i ? i : i ? i.message || i.errorMessage || JSON.stringify(i) : "Unknown error";
- i = new Error("[AssetLibrary] loading JSON or dependencies failed:" + s)
- } else {
- if (n.constructor === cc.SceneAsset) {
- var o = cc.loader._getReferenceKey(t);
- n.scene.dependAssets = a.getDependsRecursively(o)
- }
- if (p(n)) {
- var l = cc.loader._getReferenceKey(t);
- r.removeItem(l)
- }
- }
- e && e(i, n)
- }))
- },
- getLibUrlNoExt: function(t, e) {
- return t = l(t), (e ? f + "assets/" : _) + t.slice(0, 2) + "/" + t
- },
- _queryAssetInfoInEditor: function(t, e) {
- 0
- },
- _getAssetInfoInRuntime: function(t, e) {
- e = e || {
- url: null,
- raw: !1
- };
- var i = d[t];
- return i && !u.isChildClassOf(i.type, cc.Asset) ? (e.url = f + i.url, e.raw = !0) : (e.url = this.getLibUrlNoExt(t) + ".json", e.raw = !1), e
- },
- _uuidInSettings: function(t) {
- return t in d
- },
- queryAssetInfo: function(t, e) {
- var i = this._getAssetInfoInRuntime(t);
- e(null, i.url, i.raw)
- },
- parseUuidInEditor: function(t) {},
- loadJson: function(t, e) {
- var i = "" + ((new Date).getTime() + Math.random()),
- n = {
- uuid: i,
- type: "uuid",
- content: t,
- skips: [r.assetLoader.id, r.downloader.id]
- };
- r.load(n, (function(t, n) {
- if (t) t = new Error("[AssetLibrary] loading JSON or dependencies failed: " + t.message);
- else {
- if (n.constructor === cc.SceneAsset) {
- var s = cc.loader._getReferenceKey(i);
- n.scene.dependAssets = a.getDependsRecursively(s)
- }
- if (p(n)) {
- var o = cc.loader._getReferenceKey(i);
- r.removeItem(o)
- }
- }
- n._uuid = "", e && e(t, n)
- }))
- },
- getAssetByUuid: function(t) {
- return y._uuidToAsset[t] || null
- },
- init: function(t) {
- var e = t.libraryPath;
- if (e = e.replace(/\\/g, "/"), _ = cc.path.stripSep(e) + "/", f = t.rawAssetsBase, t.subpackages) {
- var i = new c(t.subpackages);
- cc.loader.insertPipeAfter(cc.loader.assetLoader, i), cc.loader.subPackPipe = i
- }
- var n = t.md5AssetsMap;
- if (n && n.import) {
- var a = 0,
- p = 0,
- y = u.createMap(!0),
- v = n.import;
- for (a = 0; a < v.length; a += 2) y[p = l(v[a])] = v[a + 1];
- var g = u.createMap(!0);
- for (v = n["raw-assets"], a = 0; a < v.length; a += 2) g[p = l(v[a])] = v[a + 1];
- var x = new h(y, g, _);
- cc.loader.insertPipeAfter(cc.loader.assetLoader, x), cc.loader.md5Pipe = x
- }
- var b = r._assetTables;
- for (var A in b) b[A].reset();
- var C = t.rawAssets;
- if (C)
- for (var T in C) {
- var S = C[T];
- for (var p in S) {
- var w = S[p],
- E = w[0],
- M = w[1],
- D = cc.js._getClassById(M);
- if (D) {
- d[p] = new m(T + "/" + E, D);
- var B = cc.path.extname(E);
- B && (E = E.slice(0, -B.length));
- var I = 1 === w[2];
- b[T] || (b[T] = new s), b[T].add(E, p, D, !I)
- } else cc.error("Cannot get", M)
- }
- }
- t.packedAssets && o.initPacks(t.packedAssets), cc.url._init(t.mountPaths && t.mountPaths.assets || f + "assets")
- },
- _uuidToAsset: {}
- },
- v = {
- effect: {},
- material: {}
- },
- g = {};
- function x(t, e, i) {
- var n = t + "s",
- r = v[t] = {},
- s = "internal";
- cc.loader.loadResDir(n, e, s, (function() {}), (function(t, e) {
- if (t) cc.error(t);
- else
- for (var n = 0; n < e.length; n++) {
- var s = e[n];
- cc.loader.getDependsRecursively(s).forEach((function(t) {
- return g[t] = !0
- })), r["" + s.name] = s
- }
- i()
- }))
- }
- y._loadBuiltins = function(t) {
- if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) return t && t();
- x("effect", cc.EffectAsset, (function() {
- x("material", cc.Material, t)
- }))
- }, y.getBuiltin = function(t, e) {
- return v[t][e]
- }, y.getBuiltins = function(t) {
- return t ? v[t] : v
- }, y.resetBuiltins = function() {
- v = {
- effect: {},
- material: {}
- }, g = {}
- }, y.getBuiltinDeps = function() {
- return g
- }, e.exports = cc.AssetLibrary = y
- }), {
- "../assets/CCAsset": 56,
- "../load-pipeline/CCLoader": 145,
- "../load-pipeline/asset-table": 147,
- "../load-pipeline/auto-release-utils": 149,
- "../load-pipeline/md5-pipe": 156,
- "../load-pipeline/pack-downloader": 157,
- "../load-pipeline/subpackage-pipe": 160,
- "../utils/decode-uuid": 294,
- "./js": 218,
- "./utils": 222
- }],
- 198: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = t("./CCEnum"),
- s = t("./utils"),
- o = (s.isPlainEmptyObj_DEV, s.cloneable_DEV, t("./attribute")),
- a = o.DELIMETER,
- l = t("./preprocess-class");
- t("./requiring-frame");
- var h = ["name", "extends", "mixins", "ctor", "__ctor__", "properties", "statics", "editor", "__ES6__"];
- function c(t, e) {
- t.indexOf(e) < 0 && t.push(e)
- }
- var u = {
- datas: null,
- push: function(t) {
- if (this.datas) this.datas.push(t);
- else {
- this.datas = [t];
- var e = this;
- setTimeout((function() {
- e.init()
- }), 0)
- }
- },
- init: function() {
- var t = this.datas;
- if (t) {
- for (var e = 0; e < t.length; ++e) {
- var i = t[e],
- r = i.cls,
- s = i.props;
- "function" == typeof s && (s = s());
- var o = n.getClassName(r);
- s ? M(r, o, s, r.$super, i.mixins) : cc.errorID(3633, o)
- }
- this.datas = null
- }
- }
- };
- function _(t, e) {
- c(t.__props__, e)
- }
- function f(t, e, i, n, r) {
- var s = n.default;
- o.setClassAttr(t, i, "default", s), _(t, i), I(t, n, e, i, !1)
- }
- function d(t, e, i, r, s) {
- var a = r.get,
- l = r.set,
- h = t.prototype,
- c = Object.getOwnPropertyDescriptor(h, i),
- u = !c;
- a && (I(t, r, e, i, !0), o.setClassAttr(t, i, "serializable", !1), s || n.get(h, i, a, u, u)), l && (s || n.set(h, i, l, u, u))
- }
- function p(t) {
- return "function" == typeof t ? t() : t
- }
- function m(t, e, i) {
- for (var r in e) t.hasOwnProperty(r) || i && !i(r) || Object.defineProperty(t, r, n.getPropertyDescriptor(e, r))
- }
- function y(t, e, i, r) {
- var s, a, l = r.__ctor__,
- h = r.ctor,
- c = r.__ES6__;
- c ? (s = [h], a = h) : (s = l ? [l] : S(e, i, r), a = T(s, e, t, r), n.value(a, "extend", (function(t) {
- return t.extends = this, D(t)
- }), !0)), n.value(a, "__ctors__", s.length > 0 ? s : null, !0);
- var u = a.prototype;
- if (e && (c || (n.extend(a, e), u = a.prototype), a.$super = e), i) {
- for (var _ = i.length - 1; _ >= 0; _--) {
- var f = i[_];
- m(u, f.prototype), m(a, f, (function(t) {
- return f.hasOwnProperty(t) && !0
- })), D._isCCClass(f) && m(o.getClassAttrs(a), o.getClassAttrs(f))
- }
- u.constructor = a
- }
- return c || (u.__initProps__ = C), n.setClassName(t, a), a
- }
- function v(t, e, i, r) {
- var s = cc.Component,
- o = cc._RF.peek();
- if (o && n.isChildClassOf(e, s)) {
- if (n.isChildClassOf(o.cls, s)) return cc.errorID(3615), null;
- 0, t = t || o.script
- }
- var a = y(t, e, i, r);
- if (o)
- if (n.isChildClassOf(e, s)) {
- var l = o.uuid;
- l && n._setClassId(l, a), o.cls = a
- } else n.isChildClassOf(o.cls, s) || (o.cls = a);
- return a
- }
- function g(t) {
- for (var e = n.getClassName(t), i = t.constructor, r = "new " + e + "(", s = 0; s < i.__props__.length; s++) {
- var o = t[i.__props__[s]];
- 0, r += o, s < i.__props__.length - 1 && (r += ",")
- }
- return r + ")"
- }
- function x(t) {
- return JSON.stringify(t).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")
- }
- function b(t, e) {
- for (var i = [], n = "", r = 0; r < e.length; r++) {
- var s = e[r],
- o = s + a + "default";
- if (o in t) {
- var l, h;
- l = A.test(s) ? "this." + s + "=" : "this[" + x(s) + "]=";
- var c = t[o];
- if ("object" == typeof c && c) h = c instanceof cc.ValueType ? g(c) : Array.isArray(c) ? "[]" : "{}";
- else if ("function" == typeof c) {
- var u = i.length;
- i.push(c), h = "F[" + u + "]()"
- } else h = "string" == typeof c ? x(c) : c;
- n += l = l + h + ";\n"
- }
- }
- return 0 === i.length ? Function(n) : Function("F", "return (function(){\n" + n + "})")(i)
- }
- var A = /^[A-Za-z_$][0-9A-Za-z_$]*$/;
- function C(t) {
- var e = o.getClassAttrs(t),
- i = t.__props__;
- null === i && (u.init(), i = t.__props__);
- var n = b(e, i);
- t.prototype.__initProps__ = n, n.call(this)
- }
- var T = function(t, e, i, n) {
- var r = "return function CCClass(){\n";
- e && E(e, n, i) && (r += "this._super=null;\n"), r += "this.__initProps__(CCClass);\n";
- var s = t.length;
- if (s > 0) {
- 0;
- var o = "].apply(this,arguments);\n";
- if (1 === s) r += "CCClass.__ctors__[0" + o;
- else {
- r += "var cs=CCClass.__ctors__;\n";
- for (var a = 0; a < s; a++) r += "cs[" + a + o
- }
- 0
- }
- return r += "}", Function(r)()
- };
- function S(t, e, i) {
- function n(t) {
- return D._isCCClass(t) ? t.__ctors__ || [] : [t]
- }
- for (var r = [], s = [t].concat(e), o = 0; o < s.length; o++) {
- var a = s[o];
- if (a)
- for (var l = n(a), h = 0; h < l.length; h++) c(r, l[h])
- }
- var u = i.ctor;
- return u && r.push(u), r
- }
- var w = /xyz/.test((function() {
- xyz
- })) ? /\b\._super\b/ : /.*/;
- /xyz/.test((function() {
- xyz
- }));
- function E(t, e, i) {
- var r = !1;
- for (var s in e)
- if (!(h.indexOf(s) >= 0)) {
- var o = e[s];
- if ("function" == typeof o) {
- var a = n.getPropertyDescriptor(t.prototype, s);
- if (a) {
- var l = a.value;
- if ("function" == typeof l) {
- w.test(o) && (r = !0, e[s] = (function(t, e) {
- return function() {
- var i = this._super;
- this._super = t;
- var n = e.apply(this, arguments);
- return this._super = i, n
- }
- })(l, o));
- continue
- }
- }
- 0
- }
- }
- return r
- }
- function M(t, e, i, n, r, s) {
- if (t.__props__ = [], n && n.__props__ && (t.__props__ = n.__props__.slice()), r)
- for (var h = 0; h < r.length; ++h) {
- var c = r[h];
- c.__props__ && (t.__props__ = t.__props__.concat(c.__props__.filter((function(e) {
- return t.__props__.indexOf(e) < 0
- }))))
- }
- if (i)
- for (var u in l.preprocessAttrs(i, e, t, s), i) {
- var _ = i[u];
- "default" in _ ? f(t, e, u, _) : d(t, e, u, _, s)
- }
- var p = o.getClassAttrs(t);
- t.__values__ = t.__props__.filter((function(t) {
- return !1 !== p[t + a + "serializable"]
- }))
- }
- function D(t) {
- var e = (t = t || {}).name,
- i = t.extends,
- r = t.mixins,
- s = v(e, i, r, t);
- e || (e = cc.js.getClassName(s)), s._sealed = !0, i && (i._sealed = !1);
- var o = t.properties;
- "function" == typeof o || i && null === i.__props__ || r && r.some((function(t) {
- return null === t.__props__
- })) ? (u.push({
- cls: s,
- props: o,
- mixins: r
- }), s.__props__ = s.__values__ = null) : M(s, e, o, i, t.mixins, t.__ES6__);
- var a, c = t.statics;
- if (c)
- for (a in c) s[a] = c[a];
- for (var _ in t)
- if (!(h.indexOf(_) >= 0)) {
- var f = t[_];
- l.validateMethodWithProps(f, _, e, s, i) && n.value(s.prototype, _, f, !0, !0)
- }
- var d = t.editor;
- return d && n.isChildClassOf(i, cc.Component) && cc.Component._registerEditorProps(s, d), s
- }
- D._isCCClass = function(t) {
- return t && t.hasOwnProperty("__ctors__")
- }, D._fastDefine = function(t, e, i) {
- n.setClassName(t, e);
- for (var r = e.__props__ = e.__values__ = Object.keys(i), s = o.getClassAttrs(e), l = 0; l < r.length; l++) {
- var h = r[l];
- s[h + a + "visible"] = !1, s[h + a + "default"] = i[h]
- }
- }, D.Attr = o, D.attr = o.attr, D.getInheritanceChain = function(t) {
- for (var e = []; t = n.getSuper(t);) t !== Object && e.push(t);
- return e
- };
- var B = {
- Integer: "Number",
- Float: "Number",
- Boolean: "Boolean",
- String: "String"
- };
- function I(t, e, i, n, s) {
- var l = null,
- h = "";
- function c() {
- return h = n + a, l = o.getClassAttrs(t)
- }
- var u = e.type;
- if (u) {
- var _ = B[u];
- _ ? (l || c())[h + "type"] = u : "Object" === u || (u === o.ScriptUuid ? ((l || c())[h + "type"] = "Script", l[h + "ctor"] = cc.ScriptAsset) : "object" == typeof u ? r.isEnum(u) && ((l || c())[h + "type"] = "Enum", l[h + "enumList"] = r.getList(u)) : "function" == typeof u && ((l || c())[h + "type"] = "Object", l[h + "ctor"] = u))
- }
- function f(t, i) {
- if (t in e) {
- var n = e[t];
- typeof n === i && ((l || c())[h + t] = n)
- }
- }
- e.editorOnly && ((l || c())[h + "editorOnly"] = !0), e.url && ((l || c())[h + "saveUrlAsAsset"] = !0), !1 === e.serializable && ((l || c())[h + "serializable"] = !1), f("formerlySerializedAs", "string");
- var d = e.range;
- d && Array.isArray(d) && d.length >= 2 && ((l || c())[h + "min"] = d[0], l[h + "max"] = d[1], d.length > 2 && (l[h + "step"] = d[2])), f("min", "number"), f("max", "number"), f("step", "number")
- }
- cc.Class = D, e.exports = {
- isArray: function(t) {
- return t = p(t), Array.isArray(t)
- },
- fastDefine: D._fastDefine,
- getNewValueTypeCode: g,
- IDENTIFIER_RE: A,
- escapeForJS: x,
- getDefault: p
- }
- }), {
- "./CCEnum": 200,
- "./attribute": 210,
- "./js": 218,
- "./preprocess-class": 219,
- "./requiring-frame": 220,
- "./utils": 222
- }],
- 199: [(function(t, e, i) {
- "use strict";
- t("./CCClass");
- var n = t("./preprocess-class"),
- r = t("./js"),
- s = "__ccclassCache__";
- function o(t) {
- return t
- }
- function a(t, e) {
- return t[e] || (t[e] = {})
- }
- function l(t) {
- return function(e) {
- return "function" == typeof e ? t(e) : function(i) {
- return t(i, e)
- }
- }
- }
- function h(t, e, i) {
- return function(t) {
- return function(i) {
- return e(i, t)
- }
- }
- }
- var c = h.bind(null, !1);
- function u(t) {
- return h.bind(null, !1)
- }
- var _ = u(),
- f = u();
- function d(t, e) {
- return a(t, s)
- }
- function p(t) {
- var e;
- try {
- e = t()
- } catch (e) {
- return t
- }
- return "object" != typeof e || null === e ? e : t
- }
- function m(t) {
- var e;
- try {
- e = new t
- } catch (t) {
- return {}
- }
- return e
- }
- function y(t, e, i, s, o, a) {
- var l;
- s && (l = n.getFullFormOfProperty(s));
- var h = e[i],
- c = r.mixin(h || {}, l || s || {});
- if (o && (o.get || o.set)) {
- o.get && (c.get = o.get), o.set && (c.set = o.set)
- } else {
- 0;
- var u = void 0;
- if (o) o.initializer && (u = p(o.initializer), !0);
- else {
- var _ = a.default || (a.default = m(t));
- _.hasOwnProperty(i) && (u = _[i], !0)
- }
- 0, c.default = u
- }
- e[i] = c
- }
- var v = l((function(t, e) {
- var i = r.getSuper(t);
- i === Object && (i = null);
- var n = {
- name: e,
- extends: i,
- ctor: t,
- __ES6__: !0
- },
- o = t[s];
- if (o) {
- var a = o.proto;
- a && r.mixin(n, a), t[s] = void 0
- }
- return cc.Class(n)
- }));
- function g(t, e, i) {
- return t((function(t, n) {
- var r = d(t);
- if (r) {
- var s = void 0 !== i ? i : n;
- a(a(r, "proto"), "editor")[e] = s
- }
- }), e)
- }
- function x(t) {
- return t(o)
- }
- var b = x(l),
- A = g(c, "requireComponent"),
- C = x(_),
- T = g(f, "executionOrder"),
- S = x(l),
- w = x(l),
- E = x(_),
- M = x(_),
- D = x(_);
- cc._decorator = e.exports = {
- ccclass: v,
- property: function(t, e, i) {
- var n = null;
- function r(t, e, i) {
- var r = d(t.constructor);
- if (r) {
- var s = a(a(r, "proto"), "properties");
- y(t.constructor, s, e, n, i, r)
- }
- }
- if (void 0 === e) return n = t, r;
- r(t, e, i)
- },
- executeInEditMode: b,
- requireComponent: A,
- menu: C,
- executionOrder: T,
- disallowMultiple: S,
- playOnFocus: w,
- inspector: E,
- icon: M,
- help: D,
- mixins: function() {
- for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
- return function(e) {
- var i = d(e);
- i && (a(i, "proto").mixins = t)
- }
- }
- }
- }), {
- "./CCClass": 198,
- "./js": 218,
- "./preprocess-class": 219,
- "./utils": 222
- }],
- 200: [(function(t, e, i) {
- "use strict";
- var n = t("./js");
- function r(t) {
- if ("__enums__" in t) return t;
- n.value(t, "__enums__", null, !0);
- for (var e = -1, i = Object.keys(t), r = 0; r < i.length; r++) {
- var s = i[r],
- o = t[s];
- if (-1 === o) o = ++e, t[s] = o;
- else if ("number" == typeof o) e = o;
- else if ("string" == typeof o && Number.isInteger(parseFloat(s))) continue;
- var a = "" + o;
- s !== a && n.value(t, a, s)
- }
- return t
- }
- r.isEnum = function(t) {
- return t && t.hasOwnProperty("__enums__")
- }, r.getList = function(t) {
- if (t.__enums__) return t.__enums__;
- var e = t.__enums__ = [];
- for (var i in t) {
- var n = t[i];
- Number.isInteger(n) && e.push({
- name: i,
- value: n
- })
- }
- return e.sort((function(t, e) {
- return t.value - e.value
- })), e
- }, e.exports = cc.Enum = r
- }), {
- "./js": 218
- }],
- 201: [(function(t, e, i) {
- "use strict";
- var n = t("../event-manager"),
- r = t("./CCInputManager"),
- s = void 0;
- cc.Acceleration = function(t, e, i, n) {
- this.x = t || 0, this.y = e || 0, this.z = i || 0, this.timestamp = n || 0
- }, r.setAccelerometerEnabled = function(t) {
- var e = this;
- if (e._accelEnabled !== t) {
- e._accelEnabled = t;
- var i = cc.director.getScheduler();
- i.enableForTarget(e), e._accelEnabled ? (e._registerAccelerometerEvent(), e._accelCurTime = 0, i.scheduleUpdate(e)) : (e._unregisterAccelerometerEvent(), e._accelCurTime = 0, i.unscheduleUpdate(e))
- }
- }, r.setAccelerometerInterval = function(t) {
- this._accelInterval !== t && (this._accelInterval = t)
- }, r._registerKeyboardEvent = function() {
- cc.game.canvas.addEventListener("keydown", (function(t) {
- n.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !0)), t.stopPropagation(), t.preventDefault()
- }), !1), cc.game.canvas.addEventListener("keyup", (function(t) {
- n.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !1)), t.stopPropagation(), t.preventDefault()
- }), !1)
- }, r._registerAccelerometerEvent = function() {
- var t = window,
- e = this;
- e._acceleration = new cc.Acceleration, e._accelDeviceEvent = t.DeviceMotionEvent || t.DeviceOrientationEvent, cc.sys.browserType === cc.sys.BROWSER_TYPE_MOBILE_QQ && (e._accelDeviceEvent = window.DeviceOrientationEvent);
- var i = e._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation",
- n = navigator.userAgent;
- (/Android/.test(n) || /Adr/.test(n) && cc.sys.browserType === cc.BROWSER_TYPE_UC) && (e._minus = -1), s = e.didAccelerate.bind(e), t.addEventListener(i, s, !1)
- }, r._unregisterAccelerometerEvent = function() {
- var t = window,
- e = this._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation";
- s && t.removeEventListener(e, s, !1)
- }, r.didAccelerate = function(t) {
- var e = this,
- i = window;
- if (e._accelEnabled) {
- var n = e._acceleration,
- r = void 0,
- s = void 0,
- o = void 0;
- if (e._accelDeviceEvent === window.DeviceMotionEvent) {
- var a = t.accelerationIncludingGravity;
- r = e._accelMinus * a.x * .1, s = e._accelMinus * a.y * .1, o = .1 * a.z
- } else r = t.gamma / 90 * .981, s = -t.beta / 90 * .981, o = t.alpha / 90 * .981;
- if (cc.view._isRotated) {
- var l = r;
- r = -s, s = l
- }
- n.x = r, n.y = s, n.z = o, n.timestamp = t.timeStamp || Date.now();
- var h = n.x;
- 90 === i.orientation ? (n.x = -n.y, n.y = h) : -90 === i.orientation ? (n.x = n.y, n.y = -h) : 180 === i.orientation && (n.x = -n.x, n.y = -n.y), cc.sys.os === cc.sys.OS_ANDROID && cc.sys.browserType !== cc.sys.BROWSER_TYPE_MOBILE_QQ && (n.x = -n.x, n.y = -n.y)
- }
- }
- }), {
- "../event-manager": 129,
- "./CCInputManager": 202
- }],
- 202: [(function(t, e, i) {
- "use strict";
- var n = t("./CCMacro"),
- r = t("./CCSys"),
- s = t("../event-manager"),
- o = n.TOUCH_TIMEOUT,
- a = cc.v2(),
- l = {
- _mousePressed: !1,
- _isRegisterEvent: !1,
- _preTouchPoint: cc.v2(0, 0),
- _prevMousePoint: cc.v2(0, 0),
- _preTouchPool: [],
- _preTouchPoolPointer: 0,
- _touches: [],
- _touchesIntegerDict: {},
- _indexBitsUsed: 0,
- _maxTouches: 8,
- _accelEnabled: !1,
- _accelInterval: .2,
- _accelMinus: 1,
- _accelCurTime: 0,
- _acceleration: null,
- _accelDeviceEvent: null,
- _canvasBoundingRect: {
- left: 0,
- top: 0,
- adjustedLeft: 0,
- adjustedTop: 0,
- width: 0,
- height: 0
- },
- _getUnUsedIndex: function() {
- for (var t = this._indexBitsUsed, e = cc.sys.now(), i = 0; i < this._maxTouches; i++) {
- if (!(1 & t)) return this._indexBitsUsed |= 1 << i, i;
- var n = this._touches[i];
- if (e - n._lastModified > o) return this._removeUsedIndexBit(i), delete this._touchesIntegerDict[n.getID()], i;
- t >>= 1
- }
- return -1
- },
- _removeUsedIndexBit: function(t) {
- if (!(t < 0 || t >= this._maxTouches)) {
- var e = 1 << t;
- e = ~e, this._indexBitsUsed &= e
- }
- },
- _glView: null,
- _updateCanvasBoundingRect: function() {
- var t = cc.game.canvas,
- e = this._canvasBoundingRect,
- i = document.documentElement,
- n = window.pageXOffset - i.clientLeft,
- r = window.pageYOffset - i.clientTop;
- if (t.getBoundingClientRect) {
- var s = t.getBoundingClientRect();
- e.left = s.left + n, e.top = s.top + r, e.width = s.width, e.height = s.height
- } else t instanceof HTMLCanvasElement ? (e.left = n, e.top = r, e.width = t.width, e.height = t.height) : (e.left = n, e.top = r, e.width = parseInt(t.style.width), e.height = parseInt(t.style.height))
- },
- handleTouchesBegin: function(t) {
- for (var e = void 0, i = void 0, n = void 0, o = [], a = this._touchesIntegerDict, l = r.now(), h = 0, c = t.length; h < c; h++)
- if (null == a[n = (e = t[h]).getID()]) {
- var u = this._getUnUsedIndex();
- if (-1 === u) {
- cc.logID(2300, u);
- continue
- }(i = this._touches[u] = new cc.Touch(e._point.x, e._point.y, e.getID()))._lastModified = l, i._setPrevPoint(e._prevPoint), a[n] = u, o.push(i)
- }
- if (o.length > 0) {
- this._glView._convertTouchesWithScale(o);
- var _ = new cc.Event.EventTouch(o);
- _._eventCode = cc.Event.EventTouch.BEGAN, s.dispatchEvent(_)
- }
- },
- handleTouchesMove: function(t) {
- for (var e = void 0, i = void 0, n = void 0, o = [], a = this._touches, l = r.now(), h = 0, c = t.length; h < c; h++) n = (e = t[h]).getID(), null != (i = this._touchesIntegerDict[n]) && a[i] && (a[i]._setPoint(e._point), a[i]._setPrevPoint(e._prevPoint), a[i]._lastModified = l, o.push(a[i]));
- if (o.length > 0) {
- this._glView._convertTouchesWithScale(o);
- var u = new cc.Event.EventTouch(o);
- u._eventCode = cc.Event.EventTouch.MOVED, s.dispatchEvent(u)
- }
- },
- handleTouchesEnd: function(t) {
- var e = this.getSetOfTouchesEndOrCancel(t);
- if (e.length > 0) {
- this._glView._convertTouchesWithScale(e);
- var i = new cc.Event.EventTouch(e);
- i._eventCode = cc.Event.EventTouch.ENDED, s.dispatchEvent(i)
- }
- this._preTouchPool.length = 0
- },
- handleTouchesCancel: function(t) {
- var e = this.getSetOfTouchesEndOrCancel(t);
- if (e.length > 0) {
- this._glView._convertTouchesWithScale(e);
- var i = new cc.Event.EventTouch(e);
- i._eventCode = cc.Event.EventTouch.CANCELLED, s.dispatchEvent(i)
- }
- this._preTouchPool.length = 0
- },
- getSetOfTouchesEndOrCancel: function(t) {
- for (var e = void 0, i = void 0, n = void 0, r = [], s = this._touches, o = this._touchesIntegerDict, a = 0, l = t.length; a < l; a++) null != (i = o[n = (e = t[a]).getID()]) && s[i] && (s[i]._setPoint(e._point), s[i]._setPrevPoint(e._prevPoint), r.push(s[i]), this._removeUsedIndexBit(i), delete o[n]);
- return r
- },
- getPreTouch: function(t) {
- for (var e = null, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--)
- if (i[r].getID() === n) {
- e = i[r];
- break
- }
- return e || (e = t), e
- },
- setPreTouch: function(t) {
- for (var e = !1, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--)
- if (i[r].getID() === n) {
- i[r] = t, e = !0;
- break
- }
- e || (i.length <= 50 ? i.push(t) : (i[this._preTouchPoolPointer] = t, this._preTouchPoolPointer = (this._preTouchPoolPointer + 1) % 50))
- },
- getTouchByXY: function(t, e, i) {
- var n = this._preTouchPoint,
- r = this._glView.convertToLocationInView(t, e, i),
- s = new cc.Touch(r.x, r.y, 0);
- return s._setPrevPoint(n.x, n.y), n.x = r.x, n.y = r.y, s
- },
- getMouseEvent: function(t, e, i) {
- var n = this._prevMousePoint,
- r = new cc.Event.EventMouse(i);
- return r._setPrevCursor(n.x, n.y), n.x = t.x, n.y = t.y, this._glView._convertMouseToLocationInView(n, e), r.setLocation(n.x, n.y), r
- },
- getPointByEvent: function(t, e) {
- return null != t.pageX ? {
- x: t.pageX,
- y: t.pageY
- } : (e.left -= document.body.scrollLeft, e.top -= document.body.scrollTop, {
- x: t.clientX,
- y: t.clientY
- })
- },
- getTouchesByEvent: function(t, e) {
- for (var i = [], n = this._glView, s = void 0, o = void 0, l = void 0, h = this._preTouchPoint, c = t.changedTouches.length, u = 0; u < c; u++)
- if (s = t.changedTouches[u]) {
- var _ = void 0;
- _ = r.BROWSER_TYPE_FIREFOX === r.browserType ? n.convertToLocationInView(s.pageX, s.pageY, e, a) : n.convertToLocationInView(s.clientX, s.clientY, e, a), null != s.identifier ? (o = new cc.Touch(_.x, _.y, s.identifier), l = this.getPreTouch(o).getLocation(), o._setPrevPoint(l.x, l.y), this.setPreTouch(o)) : (o = new cc.Touch(_.x, _.y))._setPrevPoint(h.x, h.y), h.x = _.x, h.y = _.y, i.push(o)
- }
- return i
- },
- registerSystemEvent: function(t) {
- if (!this._isRegisterEvent) {
- this._glView = cc.view;
- var e = this,
- i = this._canvasBoundingRect;
- window.addEventListener("resize", this._updateCanvasBoundingRect.bind(this));
- var n = r.isMobile,
- o = "mouse" in r.capabilities,
- a = "touches" in r.capabilities;
- if (o) {
- n || (window.addEventListener("mousedown", (function() {
- e._mousePressed = !0
- }), !1), window.addEventListener("mouseup", (function(t) {
- if (e._mousePressed) {
- e._mousePressed = !1;
- var n = e.getPointByEvent(t, i);
- if (!cc.rect(i.left, i.top, i.width, i.height).contains(n)) {
- e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, i)]);
- var r = e.getMouseEvent(n, i, cc.Event.EventMouse.UP);
- r.setButton(t.button), s.dispatchEvent(r)
- }
- }
- }), !1));
- for (var l = cc.Event.EventMouse, h = [!n && ["mousedown", l.DOWN, function(i, n, r, s) {
- e._mousePressed = !0, e.handleTouchesBegin([e.getTouchByXY(r.x, r.y, s)]), t.focus()
- }], !n && ["mouseup", l.UP, function(t, i, n, r) {
- e._mousePressed = !1, e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, r)])
- }], !n && ["mousemove", l.MOVE, function(t, i, n, r) {
- e.handleTouchesMove([e.getTouchByXY(n.x, n.y, r)]), e._mousePressed || i.setButton(null)
- }],
- ["mousewheel", l.SCROLL, function(t, e) {
- e.setScrollData(0, t.wheelDelta)
- }],
- ["DOMMouseScroll", l.SCROLL, function(t, e) {
- e.setScrollData(0, -120 * t.detail)
- }]
- ], c = 0; c < h.length; ++c) {
- var u = h[c];
- u && (function() {
- var n = u[0],
- r = u[1],
- o = u[2];
- t.addEventListener(n, (function(t) {
- var n = e.getPointByEvent(t, i),
- a = e.getMouseEvent(n, i, r);
- a.setButton(t.button), o(t, a, n, i), s.dispatchEvent(a), t.stopPropagation(), t.preventDefault()
- }), !1)
- })()
- }
- }
- if (window.navigator.msPointerEnabled) {
- var _ = {
- MSPointerDown: e.handleTouchesBegin,
- MSPointerMove: e.handleTouchesMove,
- MSPointerUp: e.handleTouchesEnd,
- MSPointerCancel: e.handleTouchesCancel
- },
- f = function(n) {
- var r = _[n];
- t.addEventListener(n, (function(t) {
- var n = document.documentElement;
- i.adjustedLeft = i.left - n.scrollLeft, i.adjustedTop = i.top - n.scrollTop, r.call(e, [e.getTouchByXY(t.clientX, t.clientY, i)]), t.stopPropagation()
- }), !1)
- };
- for (var d in _) f(d)
- }
- if (a) {
- var p = {
- touchstart: function(i) {
- e.handleTouchesBegin(i), t.focus()
- },
- touchmove: function(t) {
- e.handleTouchesMove(t)
- },
- touchend: function(t) {
- e.handleTouchesEnd(t)
- },
- touchcancel: function(t) {
- e.handleTouchesCancel(t)
- }
- },
- m = function(n) {
- var r = p[n];
- t.addEventListener(n, (function(t) {
- if (t.changedTouches) {
- var n = document.body;
- i.adjustedLeft = i.left - (n.scrollLeft || 0), i.adjustedTop = i.top - (n.scrollTop || 0), r(e.getTouchesByEvent(t, i)), t.stopPropagation(), t.preventDefault()
- }
- }), !1)
- };
- for (var d in p) m(d)
- }
- this._registerKeyboardEvent(), this._isRegisterEvent = !0
- }
- },
- _registerKeyboardEvent: function() {},
- _registerAccelerometerEvent: function() {},
- update: function(t) {
- this._accelCurTime > this._accelInterval && (this._accelCurTime -= this._accelInterval, s.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration))), this._accelCurTime += t
- }
- };
- e.exports = _cc.inputManager = l
- }), {
- "../event-manager": 129,
- "./CCMacro": 203,
- "./CCSys": 207
- }],
- 203: [(function(t, e, i) {
- "use strict";
- cc.macro = {
- RAD: Math.PI / 180,
- DEG: 180 / Math.PI,
- REPEAT_FOREVER: Number.MAX_VALUE - 1,
- FLT_EPSILON: 1.192092896e-7,
- MIN_ZINDEX: -Math.pow(2, 15),
- MAX_ZINDEX: Math.pow(2, 15) - 1,
- ONE: 1,
- ZERO: 0,
- SRC_ALPHA: 770,
- SRC_ALPHA_SATURATE: 776,
- SRC_COLOR: 768,
- DST_ALPHA: 772,
- DST_COLOR: 774,
- ONE_MINUS_SRC_ALPHA: 771,
- ONE_MINUS_SRC_COLOR: 769,
- ONE_MINUS_DST_ALPHA: 773,
- ONE_MINUS_DST_COLOR: 775,
- ONE_MINUS_CONSTANT_ALPHA: 32772,
- ONE_MINUS_CONSTANT_COLOR: 32770,
- ORIENTATION_PORTRAIT: 1,
- ORIENTATION_LANDSCAPE: 2,
- ORIENTATION_AUTO: 3,
- DENSITYDPI_DEVICE: "device-dpi",
- DENSITYDPI_HIGH: "high-dpi",
- DENSITYDPI_MEDIUM: "medium-dpi",
- DENSITYDPI_LOW: "low-dpi",
- FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: !0,
- DIRECTOR_STATS_POSITION: cc.v2(0, 0),
- ENABLE_STACKABLE_ACTIONS: !0,
- TOUCH_TIMEOUT: 5e3,
- BATCH_VERTEX_COUNT: 2e4,
- ENABLE_TILEDMAP_CULLING: !0,
- DOWNLOAD_MAX_CONCURRENT: 64,
- ENABLE_TRANSPARENT_CANVAS: !1,
- ENABLE_WEBGL_ANTIALIAS: !1,
- ENABLE_CULLING: !1,
- CLEANUP_IMAGE_CACHE: !1,
- SHOW_MESH_WIREFRAME: !1,
- ROTATE_ACTION_CCW: !1
- };
- cc.macro.SUPPORT_TEXTURE_FORMATS = [".pkm", ".pvr", ".webp", ".jpg", ".jpeg", ".bmp", ".png"], cc.macro.KEY = {
- none: 0,
- back: 6,
- menu: 18,
- backspace: 8,
- tab: 9,
- enter: 13,
- shift: 16,
- ctrl: 17,
- alt: 18,
- pause: 19,
- capslock: 20,
- escape: 27,
- space: 32,
- pageup: 33,
- pagedown: 34,
- end: 35,
- home: 36,
- left: 37,
- up: 38,
- right: 39,
- down: 40,
- select: 41,
- insert: 45,
- Delete: 46,
- 0: 48,
- 1: 49,
- 2: 50,
- 3: 51,
- 4: 52,
- 5: 53,
- 6: 54,
- 7: 55,
- 8: 56,
- 9: 57,
- a: 65,
- b: 66,
- c: 67,
- d: 68,
- e: 69,
- f: 70,
- g: 71,
- h: 72,
- i: 73,
- j: 74,
- k: 75,
- l: 76,
- m: 77,
- n: 78,
- o: 79,
- p: 80,
- q: 81,
- r: 82,
- s: 83,
- t: 84,
- u: 85,
- v: 86,
- w: 87,
- x: 88,
- y: 89,
- z: 90,
- num0: 96,
- num1: 97,
- num2: 98,
- num3: 99,
- num4: 100,
- num5: 101,
- num6: 102,
- num7: 103,
- num8: 104,
- num9: 105,
- "*": 106,
- "+": 107,
- "-": 109,
- numdel: 110,
- "/": 111,
- f1: 112,
- f2: 113,
- f3: 114,
- f4: 115,
- f5: 116,
- f6: 117,
- f7: 118,
- f8: 119,
- f9: 120,
- f10: 121,
- f11: 122,
- f12: 123,
- numlock: 144,
- scrolllock: 145,
- ";": 186,
- semicolon: 186,
- equal: 187,
- "=": 187,
- ",": 188,
- comma: 188,
- dash: 189,
- ".": 190,
- period: 190,
- forwardslash: 191,
- grave: 192,
- "[": 219,
- openbracket: 219,
- backslash: 220,
- "]": 221,
- closebracket: 221,
- quote: 222,
- dpadLeft: 1e3,
- dpadRight: 1001,
- dpadUp: 1003,
- dpadDown: 1004,
- dpadCenter: 1005
- }, cc.macro.ImageFormat = cc.Enum({
- JPG: 0,
- PNG: 1,
- TIFF: 2,
- WEBP: 3,
- PVR: 4,
- ETC: 5,
- S3TC: 6,
- ATITC: 7,
- TGA: 8,
- RAWDATA: 9,
- UNKNOWN: 10
- }), cc.macro.BlendFactor = cc.Enum({
- ONE: 1,
- ZERO: 0,
- SRC_ALPHA: 770,
- SRC_COLOR: 768,
- DST_ALPHA: 772,
- DST_COLOR: 774,
- ONE_MINUS_SRC_ALPHA: 771,
- ONE_MINUS_SRC_COLOR: 769,
- ONE_MINUS_DST_ALPHA: 773,
- ONE_MINUS_DST_COLOR: 775
- }), cc.macro.TextAlignment = cc.Enum({
- LEFT: 0,
- CENTER: 1,
- RIGHT: 2
- }), cc.macro.VerticalTextAlignment = cc.Enum({
- TOP: 0,
- CENTER: 1,
- BOTTOM: 2
- }), e.exports = cc.macro
- }), {}],
- 204: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = t("./CCClass"),
- s = 1;
- function o() {
- this._name = "", this._objFlags = 0
- }
- r.fastDefine("cc.Object", o, {
- _name: "",
- _objFlags: 0
- }), n.value(o, "Flags", {
- Destroyed: s,
- DontSave: 8,
- EditorOnly: 16,
- Dirty: 32,
- DontDestroy: 64,
- PersistentMask: -4192741,
- Destroying: 128,
- Deactivating: 256,
- LockedInEditor: 512,
- HideInHierarchy: 1024,
- IsPreloadStarted: 8192,
- IsOnLoadStarted: 32768,
- IsOnLoadCalled: 16384,
- IsOnEnableCalled: 2048,
- IsStartCalled: 65536,
- IsEditorOnEnableCalled: 4096,
- IsPositionLocked: 1 << 21,
- IsRotationLocked: 1 << 17,
- IsScaleLocked: 1 << 18,
- IsAnchorLocked: 1 << 19,
- IsSizeLocked: 1 << 20
- });
- var a = [];
- function l() {
- for (var t = a.length, e = 0; e < t; ++e) {
- var i = a[e];
- i._objFlags & s || i._destroyImmediate()
- }
- t === a.length ? a.length = 0 : a.splice(0, t)
- }
- n.value(o, "_deferredDestroy", l);
- var h = o.prototype;
- n.getset(h, "name", (function() {
- return this._name
- }), (function(t) {
- this._name = t
- }), !0), n.get(h, "isValid", (function() {
- return !(this._objFlags & s)
- }), !0);
- function c(t, e) {
- var i, n = t instanceof cc._BaseNode || t instanceof cc.Component,
- s = n ? "_id" : null,
- o = {};
- for (i in t)
- if (t.hasOwnProperty(i)) {
- if (i === s) continue;
- switch (typeof t[i]) {
- case "string":
- o[i] = "";
- break;
- case "object":
- case "function":
- o[i] = null
- }
- }
- if (cc.Class._isCCClass(e))
- for (var a = cc.Class.Attr.getClassAttrs(e), l = e.__props__, h = 0; h < l.length; h++) {
- var c = (i = l[h]) + cc.Class.Attr.DELIMETER + "default";
- if (c in a) {
- if (n && "_id" === i) continue;
- switch (typeof a[c]) {
- case "string":
- o[i] = "";
- break;
- case "object":
- case "function":
- o[i] = null;
- break;
- case "undefined":
- o[i] = void 0
- }
- }
- }
- var u = "";
- for (i in o) {
- var _;
- _ = r.IDENTIFIER_RE.test(i) ? "o." + i + "=" : "o[" + r.escapeForJS(i) + "]=";
- var f = o[i];
- "" === f && (f = '""'), u += _ + f + ";\n"
- }
- return Function("o", u)
- }
- h.destroy = function() {
- return this._objFlags & s ? (cc.warnID(5e3), !1) : !(4 & this._objFlags) && (this._objFlags |= 4, a.push(this), !0)
- }, h._destruct = function() {
- var t = this.constructor,
- e = t.__destruct__;
- e || (e = c(this, t), n.value(t, "__destruct__", e, !0)), e(this)
- }, h._onPreDestroy = null, h._destroyImmediate = function() {
- this._objFlags & s ? cc.errorID(5e3) : (this._onPreDestroy && this._onPreDestroy(), this._destruct(), this._objFlags |= s)
- }, h._deserialize = null, cc.isValid = function(t, e) {
- return "object" == typeof t ? !(!t || t._objFlags & (e ? 4 | s : s)) : void 0 !== t
- }, cc.Object = e.exports = o
- }), {
- "./CCClass": 198,
- "./js": 218
- }],
- 205: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- cc.SAXParser = function() {
- window.DOMParser ? (this._isSupportDOMParser = !0, this._parser = new DOMParser) : (this._isSupportDOMParser = !1, this._parser = null)
- }, cc.SAXParser.prototype = {
- constructor: cc.SAXParser,
- parse: function(t) {
- return this._parseXML(t)
- },
- _parseXML: function(t) {
- var e;
- return this._isSupportDOMParser ? e = this._parser.parseFromString(t, "text/xml") : ((e = new ActiveXObject("Microsoft.XMLDOM")).async = "false", e.loadXML(t)), e
- }
- }, cc.PlistParser = function() {
- cc.SAXParser.call(this)
- }, n.extend(cc.PlistParser, cc.SAXParser), n.mixin(cc.PlistParser.prototype, {
- parse: function(t) {
- var e = this._parseXML(t),
- i = e.documentElement;
- if ("plist" !== i.tagName) return cc.warnID(5100), {};
- for (var n = null, r = 0, s = i.childNodes.length; r < s && 1 !== (n = i.childNodes[r]).nodeType; r++);
- return e = null, this._parseNode(n)
- },
- _parseNode: function(t) {
- var e = null,
- i = t.tagName;
- if ("dict" === i) e = this._parseDict(t);
- else if ("array" === i) e = this._parseArray(t);
- else if ("string" === i)
- if (1 === t.childNodes.length) e = t.firstChild.nodeValue;
- else {
- e = "";
- for (var n = 0; n < t.childNodes.length; n++) e += t.childNodes[n].nodeValue
- }
- else "false" === i ? e = !1 : "true" === i ? e = !0 : "real" === i ? e = parseFloat(t.firstChild.nodeValue) : "integer" === i && (e = parseInt(t.firstChild.nodeValue, 10));
- return e
- },
- _parseArray: function(t) {
- for (var e = [], i = 0, n = t.childNodes.length; i < n; i++) {
- var r = t.childNodes[i];
- 1 === r.nodeType && e.push(this._parseNode(r))
- }
- return e
- },
- _parseDict: function(t) {
- for (var e = {}, i = null, n = 0, r = t.childNodes.length; n < r; n++) {
- var s = t.childNodes[n];
- 1 === s.nodeType && ("key" === s.tagName ? i = s.firstChild.nodeValue : e[i] = this._parseNode(s))
- }
- return e
- }
- }), cc.saxParser = new cc.SAXParser, cc.plistParser = new cc.PlistParser, e.exports = {
- saxParser: cc.saxParser,
- plistParser: cc.plistParser
- }
- }), {
- "../platform/js": 218
- }],
- 206: [(function(t, e, i) {
- "use strict";
- cc.screen = {
- _supportsFullScreen: !1,
- _onfullscreenchange: null,
- _onfullscreenerror: null,
- _preOnFullScreenChange: null,
- _preOnFullScreenError: null,
- _preOnTouch: null,
- _touchEvent: "",
- _fn: null,
- _fnMap: [
- ["requestFullscreen", "exitFullscreen", "fullscreenchange", "fullscreenEnabled", "fullscreenElement", "fullscreenerror"],
- ["requestFullScreen", "exitFullScreen", "fullScreenchange", "fullScreenEnabled", "fullScreenElement", "fullscreenerror"],
- ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitIsFullScreen", "webkitCurrentFullScreenElement", "webkitfullscreenerror"],
- ["mozRequestFullScreen", "mozCancelFullScreen", "mozfullscreenchange", "mozFullScreen", "mozFullScreenElement", "mozfullscreenerror"],
- ["msRequestFullscreen", "msExitFullscreen", "MSFullscreenChange", "msFullscreenEnabled", "msFullscreenElement", "msfullscreenerror"]
- ],
- init: function() {
- this._fn = {};
- var t, e, i, n, r = this._fnMap;
- for (t = 0, e = r.length; t < e; t++)
- if ((i = r[t]) && void 0 !== document[i[1]]) {
- for (t = 0, n = i.length; t < n; t++) this._fn[r[0][t]] = i[t];
- break
- }
- this._supportsFullScreen = void 0 !== this._fn.requestFullscreen, this._touchEvent = "ontouchend" in window ? "touchend" : "mousedown"
- },
- fullScreen: function() {
- return !!this._supportsFullScreen && !!(document[this._fn.fullscreenElement] || document[this._fn.webkitFullscreenElement] || document[this._fn.mozFullScreenElement])
- },
- requestFullScreen: function(t, e, i) {
- if (t && "video" === t.tagName.toLowerCase()) {
- if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser && t.readyState > 0) return void(t.webkitEnterFullscreen && t.webkitEnterFullscreen());
- t.setAttribute("x5-video-player-fullscreen", "true")
- }
- if (this._supportsFullScreen) {
- if (t = t || document.documentElement, e) {
- var n = this._fn.fullscreenchange;
- this._onfullscreenchange && document.removeEventListener(n, this._onfullscreenchange), this._onfullscreenchange = e, document.addEventListener(n, e, !1)
- }
- if (i) {
- var r = this._fn.fullscreenerror;
- this._onfullscreenerror && document.removeEventListener(r, this._onfullscreenerror), this._onfullscreenerror = i, document.addEventListener(r, i, {
- once: !0
- })
- }
- t[this._fn.requestFullscreen]()
- }
- },
- exitFullScreen: function(t) {
- if (t && "video" === t.tagName.toLowerCase()) {
- if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser) return void(t.webkitExitFullscreen && t.webkitExitFullscreen());
- t.setAttribute("x5-video-player-fullscreen", "false")
- }
- return !this._supportsFullScreen || document[this._fn.exitFullscreen]()
- },
- autoFullScreen: function(t, e) {
- t = t || document.body, this._ensureFullScreen(t, e), this.requestFullScreen(t, e)
- },
- disableAutoFullScreen: function(t) {
- var e = cc.game.canvas || t,
- i = this._touchEvent;
- this._preOnTouch && (e.removeEventListener(i, this._preOnTouch), this._preOnTouch = null)
- },
- _ensureFullScreen: function(t, e) {
- var i = this,
- n = cc.game.canvas || t,
- r = this._fn.fullscreenerror,
- s = this._touchEvent;
- function o() {
- i._preOnFullScreenError = null, i._preOnTouch && n.removeEventListener(s, i._preOnTouch), i._preOnTouch = function() {
- i._preOnTouch = null, i.requestFullScreen(t, e)
- }, n.addEventListener(s, i._preOnTouch, {
- once: !0
- })
- }
- this._preOnFullScreenError && t.removeEventListener(r, this._preOnFullScreenError), this._preOnFullScreenError = o, t.addEventListener(r, o, {
- once: !0
- })
- }
- }, cc.screen.init()
- }), {}],
- 207: [(function(t, e, i) {
- "use strict";
- window._CCSettings && _CCSettings.platform;
- var n = "undefined" == typeof window ? global : window;
- var r = cc && cc.sys ? cc.sys : (function() {
- cc.sys = {};
- var t = cc.sys;
- if (t.LANGUAGE_ENGLISH = "en", t.LANGUAGE_CHINESE = "zh", t.LANGUAGE_FRENCH = "fr", t.LANGUAGE_ITALIAN = "it", t.LANGUAGE_GERMAN = "de", t.LANGUAGE_SPANISH = "es", t.LANGUAGE_DUTCH = "du", t.LANGUAGE_RUSSIAN = "ru", t.LANGUAGE_KOREAN = "ko", t.LANGUAGE_JAPANESE = "ja", t.LANGUAGE_HUNGARIAN = "hu", t.LANGUAGE_PORTUGUESE = "pt", t.LANGUAGE_ARABIC = "ar", t.LANGUAGE_NORWEGIAN = "no", t.LANGUAGE_POLISH = "pl", t.LANGUAGE_TURKISH = "tr", t.LANGUAGE_UKRAINIAN = "uk", t.LANGUAGE_ROMANIAN = "ro", t.LANGUAGE_BULGARIAN = "bg", t.LANGUAGE_UNKNOWN = "unknown", t.OS_IOS = "iOS", t.OS_ANDROID = "Android", t.OS_WINDOWS = "Windows", t.OS_MARMALADE = "Marmalade", t.OS_LINUX = "Linux", t.OS_BADA = "Bada", t.OS_BLACKBERRY = "Blackberry", t.OS_OSX = "OS X", t.OS_WP8 = "WP8", t.OS_WINRT = "WINRT", t.OS_UNKNOWN = "Unknown", t.UNKNOWN = -1, t.WIN32 = 0, t.LINUX = 1, t.MACOS = 2, t.ANDROID = 3, t.IPHONE = 4, t.IPAD = 5, t.BLACKBERRY = 6, t.NACL = 7, t.EMSCRIPTEN = 8, t.TIZEN = 9, t.WINRT = 10, t.WP8 = 11, t.MOBILE_BROWSER = 100, t.DESKTOP_BROWSER = 101, t.EDITOR_PAGE = 102, t.EDITOR_CORE = 103, t.WECHAT_GAME = 104, t.QQ_PLAY = 105, t.FB_PLAYABLE_ADS = 106, t.BAIDU_GAME = 107, t.VIVO_GAME = 108, t.OPPO_GAME = 109, t.HUAWEI_GAME = 110, t.XIAOMI_GAME = 111, t.JKW_GAME = 112, t.ALIPAY_GAME = 113, t.WECHAT_GAME_SUB = 114, t.BAIDU_GAME_SUB = 115, t.BROWSER_TYPE_WECHAT = "wechat", t.BROWSER_TYPE_WECHAT_GAME = "wechatgame", t.BROWSER_TYPE_WECHAT_GAME_SUB = "wechatgamesub", t.BROWSER_TYPE_BAIDU_GAME = "baidugame", t.BROWSER_TYPE_BAIDU_GAME_SUB = "baidugamesub", t.BROWSER_TYPE_XIAOMI_GAME = "xiaomigame", t.BROWSER_TYPE_ALIPAY_GAME = "alipaygame", t.BROWSER_TYPE_QQ_PLAY = "qqplay", t.BROWSER_TYPE_ANDROID = "androidbrowser", t.BROWSER_TYPE_IE = "ie", t.BROWSER_TYPE_EDGE = "edge", t.BROWSER_TYPE_QQ = "qqbrowser", t.BROWSER_TYPE_MOBILE_QQ = "mqqbrowser", t.BROWSER_TYPE_UC = "ucbrowser", t.BROWSER_TYPE_UCBS = "ucbs", t.BROWSER_TYPE_360 = "360browser", t.BROWSER_TYPE_BAIDU_APP = "baiduboxapp", t.BROWSER_TYPE_BAIDU = "baidubrowser", t.BROWSER_TYPE_MAXTHON = "maxthon", t.BROWSER_TYPE_OPERA = "opera", t.BROWSER_TYPE_OUPENG = "oupeng", t.BROWSER_TYPE_MIUI = "miuibrowser", t.BROWSER_TYPE_FIREFOX = "firefox", t.BROWSER_TYPE_SAFARI = "safari", t.BROWSER_TYPE_CHROME = "chrome", t.BROWSER_TYPE_LIEBAO = "liebao", t.BROWSER_TYPE_QZONE = "qzone", t.BROWSER_TYPE_SOUGOU = "sogou", t.BROWSER_TYPE_UNKNOWN = "unknown", t.isNative = !1, t.isBrowser = "object" == typeof window && "object" == typeof document && !0, t.glExtension = function(t) {
- return !!cc.renderer.device.ext(t)
- }, t.getMaxJointMatrixSize = function() {
- if (!t._maxJointMatrixSize) {
- var e = cc.game._renderContext,
- i = Math.floor(e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS) / 4) - 10;
- t._maxJointMatrixSize = i < 50 ? 0 : 50
- }
- return t._maxJointMatrixSize
- }, n.__globalAdapter && n.__globalAdapter.adaptSys) n.__globalAdapter.adaptSys(t);
- else {
- var e = window,
- i = e.navigator,
- r = document,
- s = r.documentElement,
- o = i.userAgent.toLowerCase();
- t.isMobile = /mobile|android|iphone|ipad/.test(o), "undefined" != typeof FbPlayableAd ? t.platform = t.FB_PLAYABLE_ADS : t.platform = t.isMobile ? t.MOBILE_BROWSER : t.DESKTOP_BROWSER;
- var a = i.language;
- a = a || i.browserLanguage, t.languageCode = a.toLowerCase(), a = a ? a.split("-")[0] : t.LANGUAGE_ENGLISH, t.language = a;
- var l = !1,
- h = !1,
- c = "",
- u = 0,
- _ = /android (\d+(?:\.\d+)*)/i.exec(o) || /android (\d+(?:\.\d+)*)/i.exec(i.platform);
- _ && (l = !0, c = _[1] || "", u = parseInt(c) || 0), (_ = /(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(o)) ? (h = !0, c = _[2] || "", u = parseInt(c) || 0) : (/(iPhone|iPad|iPod)/.exec(i.platform) || "MacIntel" === i.platform && i.maxTouchPoints && i.maxTouchPoints > 1) && (h = !0, c = "", u = 0);
- var f = t.OS_UNKNOWN; - 1 !== i.appVersion.indexOf("Win") ? f = t.OS_WINDOWS : h ? f = t.OS_IOS : -1 !== i.appVersion.indexOf("Mac") ? f = t.OS_OSX : -1 !== i.appVersion.indexOf("X11") && -1 === i.appVersion.indexOf("Linux") ? f = t.OS_UNIX : l ? f = t.OS_ANDROID : -1 === i.appVersion.indexOf("Linux") && -1 === o.indexOf("ubuntu") || (f = t.OS_LINUX), t.os = f, t.osVersion = c, t.osMainVersion = u, t.browserType = t.BROWSER_TYPE_UNKNOWN, (function() {
- var e = /mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o) || /qqbrowser|ucbrowser|ubrowser|edge/i.exec(o) || /chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),
- i = e ? e[0].toLowerCase() : t.BROWSER_TYPE_UNKNOWN;
- "safari" === i && l ? i = t.BROWSER_TYPE_ANDROID : "qq" === i && o.match(/android.*applewebkit/i) && (i = t.BROWSER_TYPE_ANDROID);
- var n = {
- micromessenger: t.BROWSER_TYPE_WECHAT,
- trident: t.BROWSER_TYPE_IE,
- edge: t.BROWSER_TYPE_EDGE,
- "360 aphone": t.BROWSER_TYPE_360,
- mxbrowser: t.BROWSER_TYPE_MAXTHON,
- "opr/": t.BROWSER_TYPE_OPERA,
- ubrowser: t.BROWSER_TYPE_UC
- };
- t.browserType = n[i] || i
- })(), t.browserVersion = "", (function() {
- var e = o.match(/(mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i);
- e || (e = o.match(/(qqbrowser|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i)), t.browserVersion = e ? e[4] : ""
- })();
- var d = window.innerWidth || document.documentElement.clientWidth,
- p = window.innerHeight || document.documentElement.clientHeight,
- m = window.devicePixelRatio || 1;
- t.windowPixelResolution = {
- width: m * d,
- height: m * p
- }, t._checkWebGLRenderMode = function() {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_WEBGL) throw new Error("This feature supports WebGL render mode only.")
- };
- var y = document.createElement("canvas");
- try {
- var v = t.localStorage = e.localStorage;
- v.setItem("storage", ""), v.removeItem("storage"), v = null
- } catch (e) {
- var g = function() {
- cc.warnID(5200)
- };
- t.localStorage = {
- getItem: g,
- setItem: g,
- removeItem: g,
- clear: g
- }
- }
- var x = y.toDataURL("image/webp").startsWith("data:image/webp"),
- b = !!y.getContext("2d"),
- A = !1;
- e.WebGLRenderingContext && (A = !0);
- var C, T = t.capabilities = {
- canvas: b,
- opengl: A,
- webp: x
- };
- (void 0 !== s.ontouchstart || void 0 !== r.ontouchstart || i.msPointerEnabled) && (T.touches = !0), void 0 !== s.onmouseup && (T.mouse = !0), void 0 !== s.onkeyup && (T.keyboard = !0), (e.DeviceMotionEvent || e.DeviceOrientationEvent) && (T.accelerometer = !0), (function() {
- t.browserVersion;
- var e = !!(window.AudioContext || window.webkitAudioContext || window.mozAudioContext);
- C = {
- ONLY_ONE: !1,
- WEB_AUDIO: e,
- DELAY_CREATE_CTX: !1
- }, t.os === t.OS_IOS && (C.USE_LOADER_EVENT = "loadedmetadata"), t.browserType === t.BROWSER_TYPE_FIREFOX && (C.DELAY_CREATE_CTX = !0, C.USE_LOADER_EVENT = "canplay"), t.os === t.OS_ANDROID && t.browserType === t.BROWSER_TYPE_UC && (C.ONE_SOURCE = !0)
- })();
- try {
- C.WEB_AUDIO && (C.context = new(window.AudioContext || window.webkitAudioContext || window.mozAudioContext), C.DELAY_CREATE_CTX && setTimeout((function() {
- C.context = new(window.AudioContext || window.webkitAudioContext || window.mozAudioContext)
- }), 0))
- } catch (t) {
- C.WEB_AUDIO = !1, cc.logID(5201)
- }
- var S = [];
- (function() {
- var t = document.createElement("audio");
- t.canPlayType && (t.canPlayType('audio/ogg; codecs="vorbis"') && S.push(".ogg"), t.canPlayType("audio/mpeg") && S.push(".mp3"), t.canPlayType('audio/wav; codecs="1"') && S.push(".wav"), t.canPlayType("audio/mp4") && S.push(".mp4"), t.canPlayType("audio/x-m4a") && S.push(".m4a"))
- })(), C.format = S, t.__audioSupport = C
- }
- return t.NetworkType = {
- NONE: 0,
- LAN: 1,
- WWAN: 2
- }, t.getNetworkType = function() {
- return t.NetworkType.LAN
- }, t.getBatteryLevel = function() {
- return 1
- }, t.garbageCollect = function() {}, t.restartVM = function() {}, t.getSafeAreaRect = function() {
- var t = cc.view.getVisibleSize();
- return cc.rect(0, 0, t.width, t.height)
- }, t.isObjectValid = function(t) {
- return !!t
- }, t.dump = function() {
- var t = "";
- t += "isMobile : " + this.isMobile + "\r\n", t += "language : " + this.language + "\r\n", t += "browserType : " + this.browserType + "\r\n", t += "browserVersion : " + this.browserVersion + "\r\n", t += "capabilities : " + JSON.stringify(this.capabilities) + "\r\n", t += "os : " + this.os + "\r\n", t += "osVersion : " + this.osVersion + "\r\n", t += "platform : " + this.platform + "\r\n", t += "Using " + (cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WEBGL" : "CANVAS") + " renderer.\r\n", cc.log(t)
- }, t.openURL = function(t) {
- window.open(t)
- }, t.now = function() {
- return Date.now ? Date.now() : +new Date
- }, t
- })();
- e.exports = r
- }), {}],
- 208: [(function(t, e, i) {
- "use strict";
- var n = t("../event/event-target"),
- r = t("../platform/js"),
- s = t("../renderer");
- t("../platform/CCClass");
- var o = {
- init: function() {
- this.html = document.getElementsByTagName("html")[0]
- },
- availWidth: function(t) {
- return t && t !== this.html ? t.clientWidth : window.innerWidth
- },
- availHeight: function(t) {
- return t && t !== this.html ? t.clientHeight : window.innerHeight
- },
- meta: {
- width: "device-width"
- },
- adaptationType: cc.sys.browserType
- };
- switch (cc.sys.os === cc.sys.OS_IOS && (o.adaptationType = cc.sys.BROWSER_TYPE_SAFARI), o.adaptationType) {
- case cc.sys.BROWSER_TYPE_SAFARI:
- o.meta["minimal-ui"] = "true";
- case cc.sys.BROWSER_TYPE_SOUGOU:
- case cc.sys.BROWSER_TYPE_UC:
- o.availWidth = function(t) {
- return t.clientWidth
- }, o.availHeight = function(t) {
- return t.clientHeight
- }
- }
- var a = null,
- l = function() {
- n.call(this);
- var t = this,
- e = cc.ContainerStrategy,
- i = cc.ContentStrategy;
- o.init(this), t._frameSize = cc.size(0, 0), t._designResolutionSize = cc.size(0, 0), t._originalDesignResolutionSize = cc.size(0, 0), t._scaleX = 1, t._scaleY = 1, t._viewportRect = cc.rect(0, 0, 0, 0), t._visibleRect = cc.rect(0, 0, 0, 0), t._autoFullScreen = !1, t._devicePixelRatio = 1, t._maxPixelRatio = 2, t._retinaEnabled = !1, t._resizeCallback = null, t._resizing = !1, t._resizeWithBrowserSize = !1, t._orientationChanging = !0, t._isRotated = !1, t._orientation = cc.macro.ORIENTATION_AUTO, t._isAdjustViewport = !0, t._antiAliasEnabled = !1, t._resolutionPolicy = null, t._rpExactFit = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.EXACT_FIT), t._rpShowAll = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.SHOW_ALL), t._rpNoBorder = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.NO_BORDER), t._rpFixedHeight = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.FIXED_HEIGHT), t._rpFixedWidth = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.FIXED_WIDTH), cc.game.once(cc.game.EVENT_ENGINE_INITED, this.init, this)
- };
- cc.js.extend(l, n), cc.js.mixin(l.prototype, {
- init: function() {
- this._initFrameSize(), this.enableAntiAlias(!0);
- var t = cc.game.canvas.width,
- e = cc.game.canvas.height;
- this._designResolutionSize.width = t, this._designResolutionSize.height = e, this._originalDesignResolutionSize.width = t, this._originalDesignResolutionSize.height = e, this._viewportRect.width = t, this._viewportRect.height = e, this._visibleRect.width = t, this._visibleRect.height = e, cc.winSize.width = this._visibleRect.width, cc.winSize.height = this._visibleRect.height, cc.visibleRect && cc.visibleRect.init(this._visibleRect)
- },
- _resizeEvent: function(t) {
- var e, i = (e = this.setDesignResolutionSize ? this : cc.view)._frameSize.width,
- n = e._frameSize.height,
- r = e._isRotated;
- if (cc.sys.isMobile) {
- var s = cc.game.container.style,
- o = s.margin;
- s.margin = "0", s.display = "none", e._initFrameSize(), s.margin = o, s.display = "block"
- } else e._initFrameSize();
- if (!0 === t || e._isRotated !== r || e._frameSize.width !== i || e._frameSize.height !== n) {
- var a = e._originalDesignResolutionSize.width,
- l = e._originalDesignResolutionSize.height;
- e._resizing = !0, a > 0 && e.setDesignResolutionSize(a, l, e._resolutionPolicy), e._resizing = !1, e.emit("canvas-resize"), e._resizeCallback && e._resizeCallback.call()
- }
- },
- _orientationChange: function() {
- cc.view._orientationChanging = !0, cc.view._resizeEvent()
- },
- resizeWithBrowserSize: function(t) {
- t ? this._resizeWithBrowserSize || (this._resizeWithBrowserSize = !0, window.addEventListener("resize", this._resizeEvent), window.addEventListener("orientationchange", this._orientationChange)) : this._resizeWithBrowserSize && (this._resizeWithBrowserSize = !1, window.removeEventListener("resize", this._resizeEvent), window.removeEventListener("orientationchange", this._orientationChange))
- },
- setResizeCallback: function(t) {
- "function" != typeof t && null != t || (this._resizeCallback = t)
- },
- setOrientation: function(t) {
- if ((t &= cc.macro.ORIENTATION_AUTO) && this._orientation !== t) {
- this._orientation = t;
- var e = this._originalDesignResolutionSize.width,
- i = this._originalDesignResolutionSize.height;
- this.setDesignResolutionSize(e, i, this._resolutionPolicy)
- }
- },
- _initFrameSize: function() {
- var t = this._frameSize,
- e = o.availWidth(cc.game.frame),
- i = o.availHeight(cc.game.frame),
- n = e >= i;
- !cc.sys.isMobile || n && this._orientation & cc.macro.ORIENTATION_LANDSCAPE || !n && this._orientation & cc.macro.ORIENTATION_PORTRAIT ? (t.width = e, t.height = i, cc.game.container.style["-webkit-transform"] = "rotate(0deg)", cc.game.container.style.transform = "rotate(0deg)", this._isRotated = !1) : (t.width = i, t.height = e, cc.game.container.style["-webkit-transform"] = "rotate(90deg)", cc.game.container.style.transform = "rotate(90deg)", cc.game.container.style["-webkit-transform-origin"] = "0px 0px 0px", cc.game.container.style.transformOrigin = "0px 0px 0px", this._isRotated = !0), this._orientationChanging && setTimeout((function() {
- cc.view._orientationChanging = !1
- }), 1e3)
- },
- _setViewportMeta: function(t, e) {
- var i = document.getElementById("cocosMetaElement");
- i && e && document.head.removeChild(i);
- var n, r, s, o = document.getElementsByName("viewport"),
- a = o ? o[0] : null;
- for (r in n = a ? a.content : "", (i = i || document.createElement("meta")).id = "cocosMetaElement", i.name = "viewport", i.content = "", t) - 1 == n.indexOf(r) ? n += "," + r + "=" + t[r] : e && (s = new RegExp(r + "s*=s*[^,]+"), n.replace(s, r + "=" + t[r]));
- /^,/.test(n) && (n = n.substr(1)), i.content = n, a && (a.content = n), document.head.appendChild(i)
- },
- _adjustViewportMeta: function() {
- this._isAdjustViewport && (this._setViewportMeta(o.meta, !1), this._isAdjustViewport = !1)
- },
- adjustViewportMeta: function(t) {
- this._isAdjustViewport = t
- },
- enableRetina: function(t) {
- this._retinaEnabled = !!t
- },
- isRetinaEnabled: function() {
- return this._retinaEnabled
- },
- enableAntiAlias: function(t) {
- if (this._antiAliasEnabled !== t)
- if (this._antiAliasEnabled = t, cc.game.renderType === cc.game.RENDER_TYPE_WEBGL) {
- var e = cc.loader._cache;
- for (var i in e) {
- var n = e[i],
- r = n && n.content instanceof cc.Texture2D ? n.content : null;
- if (r) {
- var s = cc.Texture2D.Filter;
- t ? r.setFilters(s.LINEAR, s.LINEAR) : r.setFilters(s.NEAREST, s.NEAREST)
- }
- }
- } else if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
- var o = cc.game.canvas.getContext("2d");
- o.imageSmoothingEnabled = t, o.mozImageSmoothingEnabled = t
- }
- },
- isAntiAliasEnabled: function() {
- return this._antiAliasEnabled
- },
- enableAutoFullScreen: function(t) {
- t && t !== this._autoFullScreen && cc.sys.isMobile ? (this._autoFullScreen = !0, cc.screen.autoFullScreen(cc.game.frame)) : (this._autoFullScreen = !1, cc.screen.disableAutoFullScreen(cc.game.frame))
- },
- isAutoFullScreenEnabled: function() {
- return this._autoFullScreen
- },
- setCanvasSize: function(t, e) {
- var i = cc.game.canvas,
- n = cc.game.container;
- i.width = t * this._devicePixelRatio, i.height = e * this._devicePixelRatio, i.style.width = t + "px", i.style.height = e + "px", n.style.width = t + "px", n.style.height = e + "px", this._resizeEvent()
- },
- getCanvasSize: function() {
- return cc.size(cc.game.canvas.width, cc.game.canvas.height)
- },
- getFrameSize: function() {
- return cc.size(this._frameSize.width, this._frameSize.height)
- },
- setFrameSize: function(t, e) {
- this._frameSize.width = t, this._frameSize.height = e, cc.game.frame.style.width = t + "px", cc.game.frame.style.height = e + "px", this._resizeEvent(!0)
- },
- getVisibleSize: function() {
- return cc.size(this._visibleRect.width, this._visibleRect.height)
- },
- getVisibleSizeInPixel: function() {
- return cc.size(this._visibleRect.width * this._scaleX, this._visibleRect.height * this._scaleY)
- },
- getVisibleOrigin: function() {
- return cc.v2(this._visibleRect.x, this._visibleRect.y)
- },
- getVisibleOriginInPixel: function() {
- return cc.v2(this._visibleRect.x * this._scaleX, this._visibleRect.y * this._scaleY)
- },
- getResolutionPolicy: function() {
- return this._resolutionPolicy
- },
- setResolutionPolicy: function(t) {
- var e = this;
- if (t instanceof cc.ResolutionPolicy) e._resolutionPolicy = t;
- else {
- var i = cc.ResolutionPolicy;
- t === i.EXACT_FIT && (e._resolutionPolicy = e._rpExactFit), t === i.SHOW_ALL && (e._resolutionPolicy = e._rpShowAll), t === i.NO_BORDER && (e._resolutionPolicy = e._rpNoBorder), t === i.FIXED_HEIGHT && (e._resolutionPolicy = e._rpFixedHeight), t === i.FIXED_WIDTH && (e._resolutionPolicy = e._rpFixedWidth)
- }
- },
- setDesignResolutionSize: function(t, e, i) {
- if (t > 0 || e > 0) {
- this.setResolutionPolicy(i);
- var n = this._resolutionPolicy;
- if (n && n.preApply(this), cc.sys.isMobile && this._adjustViewportMeta(), this._orientationChanging = !0, this._resizing || this._initFrameSize(), n) {
- this._originalDesignResolutionSize.width = this._designResolutionSize.width = t, this._originalDesignResolutionSize.height = this._designResolutionSize.height = e;
- var r = n.apply(this, this._designResolutionSize);
- if (r.scale && 2 === r.scale.length && (this._scaleX = r.scale[0], this._scaleY = r.scale[1]), r.viewport) {
- var o = this._viewportRect,
- a = this._visibleRect,
- l = r.viewport;
- o.x = l.x, o.y = l.y, o.width = l.width, o.height = l.height, a.x = 0, a.y = 0, a.width = l.width / this._scaleX, a.height = l.height / this._scaleY
- }
- n.postApply(this), cc.winSize.width = this._visibleRect.width, cc.winSize.height = this._visibleRect.height, cc.visibleRect && cc.visibleRect.init(this._visibleRect), s.updateCameraViewport(), _cc.inputManager._updateCanvasBoundingRect(), this.emit("design-resolution-changed")
- } else cc.logID(2201)
- } else cc.logID(2200)
- },
- getDesignResolutionSize: function() {
- return cc.size(this._designResolutionSize.width, this._designResolutionSize.height)
- },
- setRealPixelResolution: function(t, e, i) {
- this._setViewportMeta({
- width: t
- }, !0), document.documentElement.style.width = t + "px", document.body.style.width = t + "px", document.body.style.left = "0px", document.body.style.top = "0px", this.setDesignResolutionSize(t, e, i)
- },
- setViewportInPoints: function(t, e, i, n) {
- var r = this._scaleX,
- s = this._scaleY;
- cc.game._renderContext.viewport(t * r + this._viewportRect.x, e * s + this._viewportRect.y, i * r, n * s)
- },
- setScissorInPoints: function(t, e, i, n) {
- var r = this._scaleX,
- s = this._scaleY,
- o = Math.ceil(t * r + this._viewportRect.x),
- l = Math.ceil(e * s + this._viewportRect.y),
- h = Math.ceil(i * r),
- c = Math.ceil(n * s),
- u = cc.game._renderContext;
- if (!a) {
- var _ = u.getParameter(u.SCISSOR_BOX);
- a = cc.rect(_[0], _[1], _[2], _[3])
- }
- a.x === o && a.y === l && a.width === h && a.height === c || (a.x = o, a.y = l, a.width = h, a.height = c, u.scissor(o, l, h, c))
- },
- isScissorEnabled: function() {
- return cc.game._renderContext.isEnabled(gl.SCISSOR_TEST)
- },
- getScissorRect: function() {
- if (!a) {
- var t = gl.getParameter(gl.SCISSOR_BOX);
- a = cc.rect(t[0], t[1], t[2], t[3])
- }
- var e = 1 / this._scaleX,
- i = 1 / this._scaleY;
- return cc.rect((a.x - this._viewportRect.x) * e, (a.y - this._viewportRect.y) * i, a.width * e, a.height * i)
- },
- getViewportRect: function() {
- return this._viewportRect
- },
- getScaleX: function() {
- return this._scaleX
- },
- getScaleY: function() {
- return this._scaleY
- },
- getDevicePixelRatio: function() {
- return this._devicePixelRatio
- },
- convertToLocationInView: function(t, e, i, n) {
- var r = n || cc.v2(),
- s = i.adjustedLeft ? i.adjustedLeft : i.left,
- o = i.adjustedTop ? i.adjustedTop : i.top,
- a = this._devicePixelRatio * (t - s),
- l = this._devicePixelRatio * (o + i.height - e);
- return this._isRotated ? (r.x = cc.game.canvas.width - l, r.y = a) : (r.x = a, r.y = l), r
- },
- _convertMouseToLocationInView: function(t, e) {
- var i = this._viewportRect;
- t.x = (this._devicePixelRatio * (t.x - e.left) - i.x) / this._scaleX, t.y = (this._devicePixelRatio * (e.top + e.height - t.y) - i.y) / this._scaleY
- },
- _convertPointWithScale: function(t) {
- var e = this._viewportRect;
- t.x = (t.x - e.x) / this._scaleX, t.y = (t.y - e.y) / this._scaleY
- },
- _convertTouchesWithScale: function(t) {
- for (var e, i, n, r = this._viewportRect, s = this._scaleX, o = this._scaleY, a = 0; a < t.length; a++) i = (e = t[a])._point, n = e._prevPoint, i.x = (i.x - r.x) / s, i.y = (i.y - r.y) / o, n.x = (n.x - r.x) / s, n.y = (n.y - r.y) / o
- }
- }), cc.ContainerStrategy = cc.Class({
- name: "ContainerStrategy",
- preApply: function(t) {},
- apply: function(t, e) {},
- postApply: function(t) {},
- _setupContainer: function(t, e, i) {
- var n = cc.game.canvas;
- this._setupStyle(t, e, i);
- var r = t._devicePixelRatio = 1;
- t.isRetinaEnabled() && (r = t._devicePixelRatio = Math.min(t._maxPixelRatio, window.devicePixelRatio || 1)), n.width = e * r, n.height = i * r
- },
- _setupStyle: function(t, e, i) {
- var n = cc.game.canvas,
- r = cc.game.container;
- cc.sys.os === cc.sys.OS_ANDROID && (document.body.style.width = (t._isRotated ? i : e) + "px", document.body.style.height = (t._isRotated ? e : i) + "px"), r.style.width = n.style.width = e + "px", r.style.height = n.style.height = i + "px"
- },
- _fixContainer: function() {
- document.body.insertBefore(cc.game.container, document.body.firstChild);
- var t = document.body.style;
- t.width = window.innerWidth + "px", t.height = window.innerHeight + "px", t.overflow = "hidden";
- var e = cc.game.container.style;
- e.position = "fixed", e.left = e.top = "0px", document.body.scrollTop = 0
- }
- }), cc.ContentStrategy = cc.Class({
- name: "ContentStrategy",
- ctor: function() {
- this._result = {
- scale: [1, 1],
- viewport: null
- }
- },
- _buildResult: function(t, e, i, n, r, s) {
- Math.abs(t - i) < 2 && (i = t), Math.abs(e - n) < 2 && (n = e);
- var o = cc.rect((t - i) / 2, (e - n) / 2, i, n);
- return cc.game.renderType, cc.game.RENDER_TYPE_CANVAS, this._result.scale = [r, s], this._result.viewport = o, this._result
- },
- preApply: function(t) {},
- apply: function(t, e) {
- return {
- scale: [1, 1]
- }
- },
- postApply: function(t) {}
- }), (function() {
- var t = cc.Class({
- name: "EqualToFrame",
- extends: cc.ContainerStrategy,
- apply: function(t) {
- var e = t._frameSize.height,
- i = cc.game.container.style;
- this._setupContainer(t, t._frameSize.width, t._frameSize.height), t._isRotated ? i.margin = "0 0 0 " + e + "px" : i.margin = "0px", i.padding = "0px"
- }
- }),
- e = cc.Class({
- name: "ProportionalToFrame",
- extends: cc.ContainerStrategy,
- apply: function(t, e) {
- var i, n, r = t._frameSize.width,
- s = t._frameSize.height,
- o = cc.game.container.style,
- a = e.width,
- l = e.height,
- h = r / a,
- c = s / l;
- h < c ? (i = r, n = l * h) : (i = a * c, n = s);
- var u = Math.round((r - i) / 2),
- _ = Math.round((s - n) / 2);
- i = r - 2 * u, n = s - 2 * _, this._setupContainer(t, i, n), t._isRotated ? o.margin = "0 0 0 " + s + "px" : o.margin = "0px", o.paddingLeft = u + "px", o.paddingRight = u + "px", o.paddingTop = _ + "px", o.paddingBottom = _ + "px"
- }
- }),
- i = (cc.Class({
- name: "EqualToWindow",
- extends: t,
- preApply: function(t) {
- this._super(t), cc.game.frame = document.documentElement
- },
- apply: function(t) {
- this._super(t), this._fixContainer()
- }
- }), cc.Class({
- name: "ProportionalToWindow",
- extends: e,
- preApply: function(t) {
- this._super(t), cc.game.frame = document.documentElement
- },
- apply: function(t, e) {
- this._super(t, e), this._fixContainer()
- }
- }), cc.Class({
- name: "OriginalContainer",
- extends: cc.ContainerStrategy,
- apply: function(t) {
- this._setupContainer(t, cc.game.canvas.width, cc.game.canvas.height)
- }
- })),
- n = ("undefined" == typeof window ? global : window).__globalAdapter;
- n && (n.adaptContainerStrategy && n.adaptContainerStrategy(cc.ContainerStrategy.prototype), n.adaptView && n.adaptView(l.prototype)), cc.ContainerStrategy.EQUAL_TO_FRAME = new t, cc.ContainerStrategy.PROPORTION_TO_FRAME = new e, cc.ContainerStrategy.ORIGINAL_CONTAINER = new i;
- var r = cc.Class({
- name: "ExactFit",
- extends: cc.ContentStrategy,
- apply: function(t, e) {
- var i = cc.game.canvas.width,
- n = cc.game.canvas.height,
- r = i / e.width,
- s = n / e.height;
- return this._buildResult(i, n, i, n, r, s)
- }
- }),
- s = cc.Class({
- name: "ShowAll",
- extends: cc.ContentStrategy,
- apply: function(t, e) {
- var i, n, r = cc.game.canvas.width,
- s = cc.game.canvas.height,
- o = e.width,
- a = e.height,
- l = r / o,
- h = s / a,
- c = 0;
- return l < h ? (i = r, n = a * (c = l)) : (i = o * (c = h), n = s), this._buildResult(r, s, i, n, c, c)
- }
- }),
- o = cc.Class({
- name: "NoBorder",
- extends: cc.ContentStrategy,
- apply: function(t, e) {
- var i, n, r, s = cc.game.canvas.width,
- o = cc.game.canvas.height,
- a = e.width,
- l = e.height,
- h = s / a,
- c = o / l;
- return h < c ? (n = a * (i = c), r = o) : (n = s, r = l * (i = h)), this._buildResult(s, o, n, r, i, i)
- }
- }),
- a = cc.Class({
- name: "FixedHeight",
- extends: cc.ContentStrategy,
- apply: function(t, e) {
- var i = cc.game.canvas.width,
- n = cc.game.canvas.height,
- r = n / e.height,
- s = i,
- o = n;
- return this._buildResult(i, n, s, o, r, r)
- }
- }),
- h = cc.Class({
- name: "FixedWidth",
- extends: cc.ContentStrategy,
- apply: function(t, e) {
- var i = cc.game.canvas.width,
- n = cc.game.canvas.height,
- r = i / e.width,
- s = i,
- o = n;
- return this._buildResult(i, n, s, o, r, r)
- }
- });
- cc.ContentStrategy.EXACT_FIT = new r, cc.ContentStrategy.SHOW_ALL = new s, cc.ContentStrategy.NO_BORDER = new o, cc.ContentStrategy.FIXED_HEIGHT = new a, cc.ContentStrategy.FIXED_WIDTH = new h
- })(), cc.ResolutionPolicy = cc.Class({
- name: "cc.ResolutionPolicy",
- ctor: function(t, e) {
- this._containerStrategy = null, this._contentStrategy = null, this.setContainerStrategy(t), this.setContentStrategy(e)
- },
- preApply: function(t) {
- this._containerStrategy.preApply(t), this._contentStrategy.preApply(t)
- },
- apply: function(t, e) {
- return this._containerStrategy.apply(t, e), this._contentStrategy.apply(t, e)
- },
- postApply: function(t) {
- this._containerStrategy.postApply(t), this._contentStrategy.postApply(t)
- },
- setContainerStrategy: function(t) {
- t instanceof cc.ContainerStrategy && (this._containerStrategy = t)
- },
- setContentStrategy: function(t) {
- t instanceof cc.ContentStrategy && (this._contentStrategy = t)
- }
- }), r.get(cc.ResolutionPolicy.prototype, "canvasSize", (function() {
- return cc.v2(cc.game.canvas.width, cc.game.canvas.height)
- })), cc.ResolutionPolicy.EXACT_FIT = 0, cc.ResolutionPolicy.NO_BORDER = 1, cc.ResolutionPolicy.SHOW_ALL = 2, cc.ResolutionPolicy.FIXED_HEIGHT = 3, cc.ResolutionPolicy.FIXED_WIDTH = 4, cc.ResolutionPolicy.UNKNOWN = 5, cc.view = new l, cc.winSize = cc.size(), e.exports = cc.view
- }), {
- "../event/event-target": 131,
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../renderer": 247
- }],
- 209: [(function(t, e, i) {
- "use strict";
- cc.visibleRect = {
- topLeft: cc.v2(0, 0),
- topRight: cc.v2(0, 0),
- top: cc.v2(0, 0),
- bottomLeft: cc.v2(0, 0),
- bottomRight: cc.v2(0, 0),
- bottom: cc.v2(0, 0),
- center: cc.v2(0, 0),
- left: cc.v2(0, 0),
- right: cc.v2(0, 0),
- width: 0,
- height: 0,
- init: function(t) {
- var e = this.width = t.width,
- i = this.height = t.height,
- n = t.x,
- r = t.y,
- s = r + i,
- o = n + e;
- this.topLeft.x = n, this.topLeft.y = s, this.topRight.x = o, this.topRight.y = s, this.top.x = n + e / 2, this.top.y = s, this.bottomLeft.x = n, this.bottomLeft.y = r, this.bottomRight.x = o, this.bottomRight.y = r, this.bottom.x = n + e / 2, this.bottom.y = r, this.center.x = n + e / 2, this.center.y = r + i / 2, this.left.x = n, this.left.y = r + i / 2, this.right.x = o, this.right.y = r + i / 2
- }
- }
- }), {}],
- 210: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = (t("./utils").isPlainEmptyObj_DEV, "$_$");
- function s(t, e) {
- var i = e ? Object.create(e) : {};
- return n.value(t, "__attrs__", i), i
- }
- function o(t) {
- if ("function" != typeof t) {
- return s(t, l(t.constructor))
- }
- for (var e, i = cc.Class.getInheritanceChain(t), n = i.length - 1; n >= 0; n--) {
- var r = i[n];
- r.hasOwnProperty("__attrs__") && r.__attrs__ || s(r, (e = i[n + 1]) && e.__attrs__)
- }
- return s(t, (e = i[0]) && e.__attrs__), t.__attrs__
- }
- function a(t, e, i) {
- var n = l(t),
- s = e + r,
- o = {};
- for (var a in n) a.startsWith(s) && (o[a.slice(s.length)] = n[a]);
- return o
- }
- function l(t) {
- return t.hasOwnProperty("__attrs__") && t.__attrs__ || o(t)
- }
- function h(t, e) {
- this.name = t, this.default = e
- }
- h.prototype.toString = function() {
- return this.name
- }, cc.Integer = new h("Integer", 0), cc.Float = new h("Float", 0), cc.Boolean = new h("Boolean", !1), cc.String = new h("String", ""), e.exports = {
- PrimitiveType: h,
- attr: a,
- getClassAttrs: l,
- setClassAttr: function(t, e, i, n) {
- l(t)[e + r + i] = n
- },
- DELIMETER: r,
- getTypeChecker_ET: !1,
- getObjTypeChecker_ET: !1,
- ScriptUuid: {}
- }
- }), {
- "./CCClass": 198,
- "./js": 218,
- "./utils": 222
- }],
- 211: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = n.array.fastRemoveAt;
- function s() {}
- function o() {
- this.callback = s, this.target = void 0, this.once = !1
- }
- o.prototype.set = function(t, e, i) {
- this.callback = t, this.target = e, this.once = !!i
- };
- var a = new n.Pool(function(t) {
- return t.callback = s, t.target = void 0, t.once = !1, !0
- }, 32);
- function l() {
- this.callbackInfos = [], this.isInvoking = !1, this.containCanceled = !1
- }
- a.get = function() {
- return this._get() || new o
- };
- var h = l.prototype;
- h.removeByCallback = function(t) {
- for (var e = 0; e < this.callbackInfos.length; ++e) {
- var i = this.callbackInfos[e];
- i && i.callback === t && (a.put(i), r(this.callbackInfos, e), --e)
- }
- }, h.removeByTarget = function(t) {
- for (var e = 0; e < this.callbackInfos.length; ++e) {
- var i = this.callbackInfos[e];
- i && i.target === t && (a.put(i), r(this.callbackInfos, e), --e)
- }
- }, h.cancel = function(t) {
- var e = this.callbackInfos[t];
- e && (a.put(e), this.callbackInfos[t] = null), this.containCanceled = !0
- }, h.cancelAll = function() {
- for (var t = 0; t < this.callbackInfos.length; t++) {
- var e = this.callbackInfos[t];
- e && (a.put(e), this.callbackInfos[t] = null)
- }
- this.containCanceled = !0
- }, h.purgeCanceled = function() {
- for (var t = this.callbackInfos.length - 1; t >= 0; --t) {
- this.callbackInfos[t] || r(this.callbackInfos, t)
- }
- this.containCanceled = !1
- }, h.clear = function() {
- this.cancelAll(), this.callbackInfos.length = 0, this.isInvoking = !1, this.containCanceled = !1
- };
- var c = new n.Pool(function(t) {
- return t.callback = s, t.target = void 0, t.once = !1, !0
- }, 16);
- function u() {
- this._callbackTable = n.createMap(!0)
- }
- c.get = function() {
- return this._get() || new l
- }, (h = u.prototype).on = function(t, e, i, n) {
- var r = this._callbackTable[t];
- r || (r = this._callbackTable[t] = c.get());
- var s = a.get();
- s.set(e, i, n), r.callbackInfos.push(s)
- }, h.hasEventListener = function(t, e, i) {
- var n = this._callbackTable[t];
- if (!n) return !1;
- var r = n.callbackInfos;
- if (!e) {
- if (n.isInvoking) {
- for (var s = 0; s < r.length; ++s)
- if (r[s]) return !0;
- return !1
- }
- return r.length > 0
- }
- for (var o = 0; o < r.length; ++o) {
- var a = r[o];
- if (a && a.callback === e && a.target === i) return !0
- }
- return !1
- }, h.removeAll = function(t) {
- if ("string" == typeof t) {
- var e = this._callbackTable[t];
- e && (e.isInvoking ? e.cancelAll() : (e.clear(), c.put(e), delete this._callbackTable[t]))
- } else if (t)
- for (var i in this._callbackTable) {
- var n = this._callbackTable[i];
- if (n.isInvoking)
- for (var r = n.callbackInfos, s = 0; s < r.length; ++s) {
- var o = r[s];
- o && o.target === t && n.cancel(s)
- } else n.removeByTarget(t)
- }
- }, h.off = function(t, e, i) {
- var n = this._callbackTable[t];
- if (n)
- for (var s = n.callbackInfos, o = 0; o < s.length; ++o) {
- var l = s[o];
- if (l && l.callback === e && l.target === i) {
- n.isInvoking ? n.cancel(o) : (r(s, o), a.put(l));
- break
- }
- }
- }, h.emit = function(t, e, i, n, r, s) {
- var o = this._callbackTable[t];
- if (o) {
- var a = !o.isInvoking;
- o.isInvoking = !0;
- for (var l = o.callbackInfos, h = 0, c = l.length; h < c; ++h) {
- var u = l[h];
- if (u) {
- var _ = u.target,
- f = u.callback;
- u.once && this.off(t, f, _), _ ? f.call(_, e, i, n, r, s) : f(e, i, n, r, s)
- }
- }
- a && (o.isInvoking = !1, o.containCanceled && o.purgeCanceled())
- }
- }, e.exports = u
- }), {
- "./js": 218
- }],
- 212: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- for (var i = 0; i < e.length; i++) {
- var r = e[i];
- Array.isArray(r) ? n(t, r) : t.push(r)
- }
- }
- e.exports = {
- flattenCodeArray: function(t) {
- var e = [];
- return n(e, t), e.join("")
- }
- }
- }), {}],
- 213: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = t("./attribute"),
- s = t("./CCClass"),
- o = t("../utils/misc"),
- a = function() {
- this.uuidList = [], this.uuidObjList = [], this.uuidPropList = [], this._stillUseUrl = n.createMap(!0)
- };
- a.prototype.reset = function() {
- this.uuidList.length = 0, this.uuidObjList.length = 0, this.uuidPropList.length = 0, n.clear(this._stillUseUrl)
- }, a.prototype.push = function(t, e, i, n) {
- n && (this._stillUseUrl[this.uuidList.length] = !0), this.uuidList.push(i), this.uuidObjList.push(t), this.uuidPropList.push(e)
- }, (a.pool = new n.Pool(function(t) {
- t.reset()
- }, 10)).get = function() {
- return this._get() || new a
- };
- var l = (function() {
- function t(t, e, i, n, r) {
- this.result = t, this.customEnv = n, this.deserializedList = [], this.deserializedData = null, this._classFinder = i, this._idList = [], this._idObjList = [], this._idPropList = []
- }
- function e(t) {
- var e, i, n, r = t.deserializedList,
- s = t._idPropList,
- o = t._idList,
- a = t._idObjList;
- t._classFinder && t._classFinder.onDereferenced;
- for (e = 0; e < o.length; e++) i = s[e], n = o[e], a[e][i] = r[n]
- }
- var i = t.prototype;
- function a(t, e, i, r, s, o) {
- if (e instanceof cc.ValueType) {
- s || t.push("if(prop){");
- var a = n.getClassName(e);
- t.push("s._deserializeTypedObject(o" + i + ",prop," + a + ");"), s || t.push("}else o" + i + "=null;")
- } else t.push("if(prop){"), t.push("s._deserializeObjField(o,prop," + r + ",null," + !!o + ");"), t.push("}else o" + i + "=null;")
- }
- i.deserialize = function(t) {
- if (Array.isArray(t)) {
- var i = t,
- n = i.length;
- this.deserializedList.length = n;
- for (var r = 0; r < n; r++) {
- if (i[r]) this.deserializedList[r] = this._deserializeObject(i[r], !1)
- }
- this.deserializedData = n > 0 ? this.deserializedList[0] : []
- } else this.deserializedList.length = 1, this.deserializedData = t ? this._deserializeObject(t, !1) : null, this.deserializedList[0] = this.deserializedData;
- return e(this), this.deserializedData
- }, i._deserializeObject = function(t, e, i, r, s) {
- var o, a = null,
- l = null,
- c = t.__type__;
- if ("TypedArray" === c) {
- var u = t.array;
- a = new window[t.ctor](u.length);
- for (var _ = 0; _ < u.length; ++_) a[_] = u[_];
- return a
- }
- if (c) {
- if (!(l = this._classFinder(c, t, r, s))) return this._classFinder === n._getClassById && cc.deserialize.reportMissingClass(c), null;
- if ((a = new l)._deserialize) return a._deserialize(t.content, this), a;
- cc.Class._isCCClass(l) ? h(this, a, t, l, i) : this._deserializeTypedObject(a, t, l)
- } else if (Array.isArray(t)) {
- a = new Array(t.length);
- for (var f = 0; f < t.length; f++) "object" == typeof(o = t[f]) && o ? this._deserializeObjField(a, o, "" + f, null, e) : a[f] = o
- } else a = {}, this._deserializePrimitiveObject(a, t);
- return a
- }, i._deserializeObjField = function(t, e, i, n, r) {
- var s = e.__id__;
- if (void 0 === s) {
- var o = e.__uuid__;
- o ? this.result.push(t, i, o, r) : t[i] = this._deserializeObject(e, r)
- } else {
- var a = this.deserializedList[s];
- a ? t[i] = a : (this._idList.push(s), this._idObjList.push(t), this._idPropList.push(i))
- }
- }, i._deserializePrimitiveObject = function(t, e) {
- for (var i in e)
- if (e.hasOwnProperty(i)) {
- var n = e[i];
- "object" != typeof n ? "__type__" !== i && (t[i] = n) : n ? this._deserializeObjField(t, n, i) : t[i] = null
- }
- }, i._deserializeTypedObject = function(t, e, i) {
- if (i === cc.Vec2) return t.x = e.x || 0, void(t.y = e.y || 0);
- if (i === cc.Vec3) return t.x = e.x || 0, t.y = e.y || 0, void(t.z = e.z || 0);
- if (i !== cc.Color) {
- if (i === cc.Size) return t.width = e.width || 0, void(t.height = e.height || 0);
- for (var n = r.DELIMETER + "default", o = r.getClassAttrs(i), a = i.__props__ || Object.keys(t), l = 0; l < a.length; l++) {
- var h = a[l],
- c = e[h];
- void 0 !== c && e.hasOwnProperty(h) || (c = s.getDefault(o[h + n])), "object" != typeof c ? t[h] = c : c ? this._deserializeObjField(t, c, h) : t[h] = null
- }
- } else {
- t.r = e.r || 0, t.g = e.g || 0, t.b = e.b || 0;
- var u = e.a;
- t.a = void 0 === u ? 255 : u
- }
- };
- var l = function(t, e) {
- for (var i = r.DELIMETER + "type", l = (r.DELIMETER, r.DELIMETER + "default"), h = r.DELIMETER + "saveUrlAsAsset", c = r.DELIMETER + "formerlySerializedAs", u = r.getClassAttrs(e), _ = e.__values__, f = ["var prop;"], d = o.BUILTIN_CLASSID_RE.test(n._getClassId(e)), p = 0; p < _.length; p++) {
- var m, y, v = _[p];
- 0, s.IDENTIFIER_RE.test(v) ? (y = '"' + v + '"', m = "." + v) : m = "[" + (y = s.escapeForJS(v)) + "]";
- var g = m;
- if (u[v + c]) {
- var x = u[v + c];
- g = s.IDENTIFIER_RE.test(x) ? "." + x : "[" + s.escapeForJS(x) + "]"
- }
- f.push("prop=d" + g + ";"), f.push('if(typeof prop!=="undefined"){');
- var b = u[v + h],
- A = s.getDefault(u[v + l]);
- if (d) {
- var C, T = u[v + i];
- if (void 0 === A && T) C = T instanceof r.PrimitiveType;
- else {
- var S = typeof A;
- C = "string" === S && !b || "number" === S || "boolean" === S
- }
- C ? f.push("o" + m + "=prop;") : a(f, A, m, y, !0, b)
- } else f.push('if(typeof prop!=="object"){o' + m + "=prop;}else{"), a(f, A, m, y, !1, b), f.push("}");
- f.push("}")
- }(cc.js.isChildClassOf(e, cc._BaseNode) || cc.js.isChildClassOf(e, cc.Component)) && f.push("d._id&&(o._id=d._id);");
- return "_$erialized" === _[_.length - 1] && (f.push("o._$erialized=JSON.parse(JSON.stringify(d));"), f.push("s._deserializePrimitiveObject(o._$erialized,d);")), Function("s", "o", "d", "k", "t", f.join(""))
- };
- function h(t, e, i, r, s) {
- var o;
- r.hasOwnProperty("__deserialize__") ? o = r.__deserialize__ : (o = l(t, r), n.value(r, "__deserialize__", o, !0)), o(t, e, i, r, s)
- }
- return t.pool = new n.Pool(function(t) {
- t.result = null, t.customEnv = null, t.deserializedList.length = 0, t.deserializedData = null, t._classFinder = null, t._idList.length = 0, t._idObjList.length = 0, t._idPropList.length = 0
- }, 1), t.pool.get = function(e, i, n, r, s) {
- var o = this._get();
- return o ? (o.result = e, o.customEnv = r, o._classFinder = n, o) : new t(e, i, n, r, s)
- }, t
- })();
- cc.deserialize = function(t, e, i) {
- var r = (i = i || {}).classFinder || n._getClassById,
- s = i.createAssetRefs || cc.sys.platform === cc.sys.EDITOR_CORE,
- o = i.customEnv,
- h = i.ignoreEditorOnly;
- "string" == typeof t && (t = JSON.parse(t));
- var c = !e;
- e = e || a.pool.get();
- var u = l.pool.get(e, !1, r, o, h);
- cc.game._isCloning = !0;
- var _ = u.deserialize(t);
- return cc.game._isCloning = !1, l.pool.put(u), s && e.assignAssetsBy(Editor.serialize.asAsset), c && a.pool.put(e), _
- }, cc.deserialize.Details = a, cc.deserialize.reportMissingClass = function(t) {
- cc.warnID(5302, t)
- }
- }), {
- "../utils/misc": 300,
- "./CCClass": 198,
- "./attribute": 210,
- "./js": 218
- }],
- 214: [(function(t, e, i) {
- "use strict";
- var n = ".";
- function r(t) {
- this.id = 0 | 998 * Math.random(), this.prefix = t ? t + n : ""
- }
- r.prototype.getNewId = function() {
- return this.prefix + ++this.id
- }, r.global = new r("global"), e.exports = r
- }), {}],
- 215: [(function(t, e, i) {
- "use strict";
- t("./js"), t("./CCClass"), t("./CCClassDecorator"), t("./CCEnum"), t("./CCObject"), t("./callbacks-invoker"), t("./url"), t("./deserialize"), t("./instantiate"), t("./instantiate-jit"), t("./requiring-frame"), t("./CCSys"), t("./CCMacro"), t("./CCAssetLibrary"), t("./CCVisibleRect")
- }), {
- "./CCAssetLibrary": 197,
- "./CCClass": 198,
- "./CCClassDecorator": 199,
- "./CCEnum": 200,
- "./CCMacro": 203,
- "./CCObject": 204,
- "./CCSys": 207,
- "./CCVisibleRect": 209,
- "./callbacks-invoker": 211,
- "./deserialize": 213,
- "./instantiate": 217,
- "./instantiate-jit": 216,
- "./js": 218,
- "./requiring-frame": 220,
- "./url": 221
- }],
- 216: [(function(t, e, i) {
- "use strict";
- var n = t("./CCObject"),
- r = n.Flags.Destroyed,
- s = n.Flags.PersistentMask,
- o = t("./attribute"),
- a = t("./js"),
- l = t("./CCClass"),
- h = t("./compiler"),
- c = o.DELIMETER + "default",
- u = l.IDENTIFIER_RE,
- _ = l.escapeForJS,
- f = "var ",
- d = "o",
- p = "t",
- m = {
- "cc.Node": "cc.Node",
- "cc.Sprite": "cc.Sprite",
- "cc.Label": "cc.Label",
- "cc.Button": "cc.Button",
- "cc.Widget": "cc.Widget",
- "cc.Animation": "cc.Animation",
- "cc.ClickEvent": !1,
- "cc.PrefabInfo": !1
- };
- try {
- !Float32Array.name && (Float32Array.name = "Float32Array"), !Float64Array.name && (Float64Array.name = "Float64Array"), !Int8Array.name && (Int8Array.name = "Int8Array"), !Int16Array.name && (Int16Array.name = "Int16Array"), !Int32Array.name && (Int32Array.name = "Int32Array"), !Uint8Array.name && (Uint8Array.name = "Uint8Array"), !Uint16Array.name && (Uint16Array.name = "Uint16Array"), !Uint32Array.name && (Uint32Array.name = "Uint32Array")
- } catch (t) {}
- function y(t) {
- if (t === Float32Array) return "Float32Array";
- if (t === Float64Array) return "Float64Array";
- if (t === Int8Array) return "Int8Array";
- if (t === Int16Array) return "Int16Array";
- if (t === Int32Array) return "Int32Array";
- if (t === Uint8Array) return "Uint8Array";
- if (t === Uint16Array) return "Uint16Array";
- if (t === Uint32Array) return "Uint32Array";
- throw new Error("Unknown TypedArray could not be instantiated: " + t)
- }
- function v(t, e) {
- this.varName = t, this.expression = e
- }
- function g(t, e) {
- return e instanceof v ? new v(e.varName, t + e.expression) : t + e
- }
- function x(t, e, i) {
- Array.isArray(i) ? (i[0] = g(e, i[0]), t.push(i)) : t.push(g(e, i) + ";")
- }
- function b(t) {
- this._exps = [], this._targetExp = t
- }
- function A(t, e) {
- if ("function" == typeof t) try {
- t = t()
- } catch (t) {
- return !1
- }
- if (t === e) return !0;
- if (t && e) {
- if (t instanceof cc.ValueType && t.equals(e)) return !0;
- if (Array.isArray(t) && Array.isArray(e) || t.constructor === Object && e.constructor === Object) try {
- return Array.isArray(t) && Array.isArray(e) && 0 === t.length && 0 === e.length
- } catch (t) {}
- }
- return !1
- }
- function C(t) {
- return u.test(t) ? "." + t : "[" + _(t) + "]"
- }
- function T(t, e) {
- var i;
- this.parent = e, this.objsToClear_iN$t = [], this.codeArray = [], this.objs = [], this.funcs = [], this.funcModuleCache = a.createMap(), a.mixin(this.funcModuleCache, m), this.globalVariables = [], this.globalVariableId = 0, this.localVariableId = 0, this.codeArray.push(f + d + "," + p + ";", "if(R){", d + "=R;", "}else{", d + "=R=new " + this.getFuncModule(t.constructor, !0) + "();", "}"), a.value(t, "_iN$t", {
- globalVar: "R"
- }, !0), this.objsToClear_iN$t.push(t), this.enumerateObject(this.codeArray, t), this.globalVariables.length > 0 && (i = f + this.globalVariables.join(",") + ";");
- var n = h.flattenCodeArray(["return (function(R){", i || [], this.codeArray, "return o;", "})"]);
- this.result = Function("O", "F", n)(this.objs, this.funcs);
- for (var r = 0, s = this.objsToClear_iN$t.length; r < s; ++r) this.objsToClear_iN$t[r]._iN$t = null;
- this.objsToClear_iN$t.length = 0
- }
- v.prototype.toString = function() {
- return f + this.varName + "=" + this.expression + ";"
- }, b.prototype.append = function(t, e) {
- this._exps.push([t, e])
- }, b.prototype.writeCode = function(t) {
- var e;
- if (this._exps.length > 1) t.push(p + "=" + this._targetExp + ";"), e = p;
- else {
- if (1 !== this._exps.length) return;
- e = this._targetExp
- }
- for (var i = 0; i < this._exps.length; i++) {
- var n = this._exps[i];
- x(t, e + C(n[0]) + "=", n[1])
- }
- }, b.pool = new a.Pool(function(t) {
- t._exps.length = 0, t._targetExp = null
- }, 1), b.pool.get = function(t) {
- var e = this._get() || new b;
- return e._targetExp = t, e
- };
- var S = T.prototype;
- S.getFuncModule = function(t, e) {
- var i = a.getClassName(t);
- if (i) {
- var n = this.funcModuleCache[i];
- if (n) return n;
- if (void 0 === n) {
- var r = -1 !== i.indexOf(".");
- if (r) try {
- if (r = t === Function("return " + i)()) return this.funcModuleCache[i] = i, i
- } catch (t) {}
- }
- }
- var s = this.funcs.indexOf(t);
- s < 0 && (s = this.funcs.length, this.funcs.push(t));
- var o = "F[" + s + "]";
- return e && (o = "(" + o + ")"), this.funcModuleCache[i] = o, o
- }, S.getObjRef = function(t) {
- var e = this.objs.indexOf(t);
- return e < 0 && (e = this.objs.length, this.objs.push(t)), "O[" + e + "]"
- }, S.setValueType = function(t, e, i, n) {
- var r = b.pool.get(n),
- s = e.constructor.__props__;
- s || (s = Object.keys(e));
- for (var o = 0; o < s.length; o++) {
- var a = s[o],
- l = i[a];
- if (e[a] !== l) {
- var h = this.enumerateField(i, a, l);
- r.append(a, h)
- }
- }
- r.writeCode(t), b.pool.put(r)
- }, S.enumerateCCClass = function(t, e, i) {
- for (var n = i.__values__, r = o.getClassAttrs(i), s = 0; s < n.length; s++) {
- var a = n[s],
- h = e[a],
- u = r[a + c];
- if (!A(u, h))
- if ("object" == typeof h && h instanceof cc.ValueType && (u = l.getDefault(u)) && u.constructor === h.constructor) {
- var _ = d + C(a);
- this.setValueType(t, u, h, _)
- } else this.setObjProp(t, e, a, h)
- }
- }, S.instantiateArray = function(t) {
- if (0 === t.length) return "[]";
- var e = "a" + ++this.localVariableId,
- i = [new v(e, "new Array(" + t.length + ")")];
- a.value(t, "_iN$t", {
- globalVar: "",
- source: i
- }, !0), this.objsToClear_iN$t.push(t);
- for (var n = 0; n < t.length; ++n) {
- x(i, e + "[" + n + "]=", this.enumerateField(t, n, t[n]))
- }
- return i
- }, S.instantiateTypedArray = function(t) {
- var e = t.constructor.name || y(t.constructor);
- if (0 === t.length) return "new " + e;
- var i = "a" + ++this.localVariableId,
- n = [new v(i, "new " + e + "(" + t.length + ")")];
- t._iN$t = {
- globalVar: "",
- source: n
- }, this.objsToClear_iN$t.push(t);
- for (var r = 0; r < t.length; ++r) {
- if (0 !== t[r]) x(n, i + "[" + r + "]=", t[r])
- }
- return n
- }, S.enumerateField = function(t, e, i) {
- if ("object" == typeof i && i) {
- var r = i._iN$t;
- if (r) {
- var o = r.globalVar;
- if (!o) {
- o = r.globalVar = "v" + ++this.globalVariableId, this.globalVariables.push(o);
- var a = r.source[0];
- r.source[0] = g(o + "=", a)
- }
- return o
- }
- return ArrayBuffer.isView(i) ? this.instantiateTypedArray(i) : Array.isArray(i) ? this.instantiateArray(i) : this.instantiateObj(i)
- }
- return "function" == typeof i ? this.getFuncModule(i) : "string" == typeof i ? _(i) : ("_objFlags" === e && t instanceof n && (i &= s), i)
- }, S.setObjProp = function(t, e, i, n) {
- x(t, d + C(i) + "=", this.enumerateField(e, i, n))
- }, S.enumerateObject = function(t, e) {
- var i = e.constructor;
- if (cc.Class._isCCClass(i)) this.enumerateCCClass(t, e, i);
- else
- for (var n in e)
- if (e.hasOwnProperty(n) && (95 !== n.charCodeAt(0) || 95 !== n.charCodeAt(1) || "__type__" === n)) {
- var r = e[n];
- "object" == typeof r && r && r === e._iN$t || this.setObjProp(t, e, n, r)
- }
- }, S.instantiateObj = function(t) {
- if (t instanceof cc.ValueType) return l.getNewValueTypeCode(t);
- if (t instanceof cc.Asset) return this.getObjRef(t);
- if (t._objFlags & r) return null;
- var e, i = t.constructor;
- if (cc.Class._isCCClass(i)) {
- if (this.parent)
- if (this.parent instanceof cc.Component) {
- if (t instanceof cc._BaseNode || t instanceof cc.Component) return this.getObjRef(t)
- } else if (this.parent instanceof cc._BaseNode)
- if (t instanceof cc._BaseNode) {
- if (!t.isChildOf(this.parent)) return this.getObjRef(t)
- } else if (t instanceof cc.Component && !t.node.isChildOf(this.parent)) return this.getObjRef(t);
- e = new v(d, "new " + this.getFuncModule(i, !0) + "()")
- } else if (i === Object) e = new v(d, "{}");
- else {
- if (i) return this.getObjRef(t);
- e = new v(d, "Object.create(null)")
- }
- var n = [e];
- return a.value(t, "_iN$t", {
- globalVar: "",
- source: n
- }, !0), this.objsToClear_iN$t.push(t), this.enumerateObject(n, t), ["(function(){", n, "return o;})();"]
- }, e.exports = {
- compile: function(t) {
- return new T(t, t instanceof cc._BaseNode && t).result
- },
- equalsToDefault: A
- }
- }), {
- "./CCClass": 198,
- "./CCObject": 204,
- "./attribute": 210,
- "./compiler": 212,
- "./js": 218
- }],
- 217: [(function(t, e, i) {
- "use strict";
- var n = t("./CCObject"),
- r = t("../value-types/value-type"),
- s = n.Flags.Destroyed,
- o = n.Flags.PersistentMask,
- a = t("./utils").isDomNode,
- l = t("./js");
- function h(t, e) {
- if (!e) {
- if ("object" != typeof t || Array.isArray(t)) return null;
- if (!t) return null;
- if (!cc.isValid(t)) return null;
- 0
- }
- var i;
- if (t instanceof n) {
- if (t._instantiate) return cc.game._isCloning = !0, i = t._instantiate(), cc.game._isCloning = !1, i;
- if (t instanceof cc.Asset) return null
- }
- return cc.game._isCloning = !0, i = u(t), cc.game._isCloning = !1, i
- }
- var c = [];
- function u(t, e) {
- if (Array.isArray(t)) return null;
- if (a && a(t)) return null;
- var i;
- if (t._iN$t) i = t._iN$t;
- else if (t.constructor) {
- i = new(0, t.constructor)
- } else i = Object.create(null);
- f(t, i, e);
- for (var n = 0, r = c.length; n < r; ++n) c[n]._iN$t = null;
- return c.length = 0, i
- }
- function _(t, e, i, n) {
- for (var s = t.__values__, o = 0; o < s.length; o++) {
- var a = s[o],
- l = e[a];
- if ("object" == typeof l && l) {
- var h = i[a];
- h instanceof r && h.constructor === l.constructor ? h.set(l) : i[a] = l._iN$t || d(l, n)
- } else i[a] = l
- }
- }
- function f(t, e, i) {
- l.value(t, "_iN$t", e, !0), c.push(t);
- var r = t.constructor;
- if (cc.Class._isCCClass(r)) _(r, t, e, i);
- else
- for (var s in t)
- if (t.hasOwnProperty(s) && (95 !== s.charCodeAt(0) || 95 !== s.charCodeAt(1) || "__type__" === s)) {
- var a = t[s];
- if ("object" == typeof a && a) {
- if (a === e) continue;
- e[s] = a._iN$t || d(a, i)
- } else e[s] = a
- }
- t instanceof n && (e._objFlags &= o)
- }
- function d(t, e) {
- if (t instanceof r) return t.clone();
- if (t instanceof cc.Asset) return t;
- var i;
- if (ArrayBuffer.isView(t)) {
- var n = t.length;
- i = new t.constructor(n), t._iN$t = i, c.push(t);
- for (var o = 0; o < n; ++o) i[o] = t[o];
- return i
- }
- if (Array.isArray(t)) {
- var a = t.length;
- i = new Array(a), l.value(t, "_iN$t", i, !0), c.push(t);
- for (var h = 0; h < a; ++h) {
- var u = t[h];
- i[h] = "object" == typeof u && u ? u._iN$t || d(u, e) : u
- }
- return i
- }
- if (t._objFlags & s) return null;
- var _ = t.constructor;
- if (cc.Class._isCCClass(_)) {
- if (e)
- if (e instanceof cc.Component) {
- if (t instanceof cc._BaseNode || t instanceof cc.Component) return t
- } else if (e instanceof cc._BaseNode)
- if (t instanceof cc._BaseNode) {
- if (!t.isChildOf(e)) return t
- } else if (t instanceof cc.Component && !t.node.isChildOf(e)) return t;
- i = new _
- } else if (_ === Object) i = {};
- else {
- if (_) return t;
- i = Object.create(null)
- }
- return f(t, i, e), i
- }
- h._clone = u, cc.instantiate = h, e.exports = h
- }), {
- "../value-types/value-type": 320,
- "./CCObject": 204,
- "./js": 218,
- "./utils": 222
- }],
- 218: [(function(t, e, i) {
- "use strict";
- var n = new(t("./id-generater"))("TmpCId.");
- function r(t, e) {
- for (; t;) {
- var i = Object.getOwnPropertyDescriptor(t, e);
- if (i) return i;
- t = Object.getPrototypeOf(t)
- }
- return null
- }
- function s(t, e, i) {
- var n = r(e, t);
- Object.defineProperty(i, t, n)
- }
- var o = {
- isNumber: function(t) {
- return "number" == typeof t || t instanceof Number
- },
- isString: function(t) {
- return "string" == typeof t || t instanceof String
- },
- addon: function(t) {
- t = t || {};
- for (var e = 1, i = arguments.length; e < i; e++) {
- var n = arguments[e];
- if (n) {
- if ("object" != typeof n) {
- cc.errorID(5402, n);
- continue
- }
- for (var r in n) r in t || s(r, n, t)
- }
- }
- return t
- },
- mixin: function(t) {
- t = t || {};
- for (var e = 1, i = arguments.length; e < i; e++) {
- var n = arguments[e];
- if (n) {
- if ("object" != typeof n) {
- cc.errorID(5403, n);
- continue
- }
- for (var r in n) s(r, n, t)
- }
- }
- return t
- },
- extend: function(t, e) {
- for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
- return t.prototype = Object.create(e.prototype, {
- constructor: {
- value: t,
- writable: !0,
- configurable: !0
- }
- }), t
- },
- getSuper: function(t) {
- var e = t.prototype,
- i = e && Object.getPrototypeOf(e);
- return i && i.constructor
- },
- isChildClassOf: function(t, e) {
- if (t && e) {
- if ("function" != typeof t) return !1;
- if ("function" != typeof e) return !1;
- if (t === e) return !0;
- for (;;) {
- if (!(t = o.getSuper(t))) return !1;
- if (t === e) return !0
- }
- }
- return !1
- },
- clear: function(t) {
- for (var e = Object.keys(t), i = 0; i < e.length; i++) delete t[e[i]]
- },
- isEmptyObject: function(t) {
- for (var e in t) return !1;
- return !0
- },
- getPropertyDescriptor: r
- },
- a = {
- value: void 0,
- enumerable: !1,
- writable: !1,
- configurable: !0
- };
- o.value = function(t, e, i, n, r) {
- a.value = i, a.writable = n, a.enumerable = r, Object.defineProperty(t, e, a), a.value = void 0
- };
- var l = {
- get: null,
- set: null,
- enumerable: !1
- };
- o.getset = function(t, e, i, n, r, s) {
- "function" != typeof n && (r = n, n = void 0), l.get = i, l.set = n, l.enumerable = r, l.configurable = s, Object.defineProperty(t, e, l), l.get = null, l.set = null
- };
- var h = {
- get: null,
- enumerable: !1,
- configurable: !1
- };
- o.get = function(t, e, i, n, r) {
- h.get = i, h.enumerable = n, h.configurable = r, Object.defineProperty(t, e, h), h.get = null
- };
- var c = {
- set: null,
- enumerable: !1,
- configurable: !1
- };
- o.set = function(t, e, i, n, r) {
- c.set = i, c.enumerable = n, c.configurable = r, Object.defineProperty(t, e, c), c.set = null
- }, o.getClassName = function(t) {
- if ("function" == typeof t) {
- var e = t.prototype;
- if (e && e.hasOwnProperty("__classname__") && e.__classname__) return e.__classname__;
- var i = "";
- if (t.name && (i = t.name), t.toString) {
- var n, r = t.toString();
- (n = "[" === r.charAt(0) ? r.match(/\[\w+\s*(\w+)\]/) : r.match(/function\s*(\w+)/)) && 2 === n.length && (i = n[1])
- }
- return "Object" !== i ? i : ""
- }
- return t && t.constructor ? o.getClassName(t.constructor) : ""
- }, (function() {
- var t = {},
- e = {};
- function i(t, e, i) {
- return o.getset(o, e, (function() {
- return Object.assign({}, i)
- }), (function(t) {
- o.clear(i), Object.assign(i, t)
- })),
- function(e, n) {
- if (n.prototype.hasOwnProperty(t) && delete i[n.prototype[t]], o.value(n.prototype, t, e), e) {
- var r = i[e];
- if (r && r !== n) {
- var s = "A Class already exists with the same " + t + ' : "' + e + '".';
- 0, cc.error(s)
- } else i[e] = n
- }
- }
- }
- o._setClassId = i("__cid__", "_registeredClassIds", t);
- var r = i("__classname__", "_registeredClassNames", e);
- o.setClassName = function(t, e) {
- if (r(t, e), !e.prototype.hasOwnProperty("__cid__")) {
- var i = t || n.getNewId();
- i && o._setClassId(i, e)
- }
- }, o.unregisterClass = function() {
- for (var i = 0; i < arguments.length; i++) {
- var n = arguments[i].prototype,
- r = n.__cid__;
- r && delete t[r];
- var s = n.__classname__;
- s && delete e[s]
- }
- }, o._getClassById = function(e) {
- return t[e]
- }, o.getClassByName = function(t) {
- return e[t]
- }, o._getClassId = function(t, e) {
- if (e = void 0 === e || e, "function" == typeof t && t.prototype.hasOwnProperty("__cid__")) return t.prototype.__cid__;
- if (t && t.constructor) {
- var i = t.constructor.prototype;
- if (i && i.hasOwnProperty("__cid__")) return t.__cid__
- }
- return ""
- }
- })(), o.obsolete = function(t, e, i, n) {
- var r = /([^.]+)$/,
- s = r.exec(e)[0],
- a = r.exec(i)[0];
- function l() {
- return this[a]
- }
- n ? o.getset(t, s, l, (function(t) {
- this[a] = t
- })) : o.get(t, s, l)
- }, o.obsoletes = function(t, e, i, n) {
- for (var r in i) {
- var s = i[r];
- o.obsolete(t, e + "." + r, s, n)
- }
- };
- var u = /(%d)|(%s)/,
- _ = /%s/;
- function f(t, e) {
- t.splice(e, 1)
- }
- function d(t, e) {
- var i = t.indexOf(e);
- return i >= 0 && (f(t, i), !0)
- }
- o.formatStr = function() {
- var t = arguments.length;
- if (0 === t) return "";
- var e = arguments[0];
- if (1 === t) return "" + e;
- if ("string" == typeof e && u.test(e))
- for (var i = 1; i < t; ++i) {
- var n = arguments[i],
- r = "number" == typeof n ? u : _;
- r.test(e) ? e = e.replace(r, n) : e += " " + n
- } else
- for (var s = 1; s < t; ++s) e += " " + arguments[s];
- return e
- }, o.shiftArguments = function() {
- for (var t = arguments.length - 1, e = new Array(t), i = 0; i < t; ++i) e[i] = arguments[i + 1];
- return e
- }, o.createMap = function(t) {
- var e = Object.create(null);
- if (t) {
- e["."] = !0, e["/"] = !0, delete e["."], delete e["/"]
- }
- return e
- };
- var p = Array.prototype.indexOf;
- function m(t, e) {
- void 0 === e && (e = t, t = null), this.get = null, this.count = 0, this._pool = new Array(e), this._cleanup = t
- }
- o.array = {
- remove: d,
- fastRemove: function(t, e) {
- var i = t.indexOf(e);
- i >= 0 && (t[i] = t[t.length - 1], --t.length)
- },
- removeAt: f,
- fastRemoveAt: function(t, e) {
- var i = t.length;
- e < 0 || e >= i || (t[e] = t[i - 1], t.length = i - 1)
- },
- contains: function(t, e) {
- return t.indexOf(e) >= 0
- },
- verifyType: function(t, e) {
- if (t && t.length > 0)
- for (var i = 0; i < t.length; i++)
- if (!(t[i] instanceof e)) return cc.logID(1300), !1;
- return !0
- },
- removeArray: function(t, e) {
- for (var i = 0, n = e.length; i < n; i++) d(t, e[i])
- },
- appendObjectsAt: function(t, e, i) {
- return t.splice.apply(t, [i, 0].concat(e)), t
- },
- copy: function(t) {
- var e, i = t.length,
- n = new Array(i);
- for (e = 0; e < i; e += 1) n[e] = t[e];
- return n
- },
- indexOf: p,
- MutableForwardIterator: t("../utils/mutable-forward-iterator")
- }, m.prototype._get = function() {
- if (this.count > 0) {
- --this.count;
- var t = this._pool[this.count];
- return this._pool[this.count] = null, t
- }
- return null
- }, m.prototype.put = function(t) {
- var e = this._pool;
- if (this.count < e.length) {
- if (this._cleanup && !1 === this._cleanup(t)) return;
- e[this.count] = t, ++this.count
- }
- }, m.prototype.resize = function(t) {
- t >= 0 && (this._pool.length = t, this.count > t && (this.count = t))
- }, o.Pool = m, cc.js = o, e.exports = o
- }), {
- "../utils/mutable-forward-iterator": 301,
- "./id-generater": 214
- }],
- 219: [(function(t, e, i) {
- "use strict";
- var n = t("./js"),
- r = t("./attribute"),
- s = {
- url: {
- canUsedInGet: !0
- },
- default: {},
- serializable: {},
- editorOnly: {},
- formerlySerializedAs: {}
- };
- function o(t, e, i, n) {
- if (!t.get && !t.set)
- if (t.hasOwnProperty("default")) {
- var r = "_N$" + e;
- t.get = function() {
- return this[r]
- }, t.set = function(t) {
- var e = this[r];
- this[r] = t, i.call(this, e)
- };
- var o = {};
- for (var a in n[r] = o, s) {
- var l = s[a];
- t.hasOwnProperty(a) && (o[a] = t[a], l.canUsedInGet || delete t[a])
- }
- } else 0
- }
- function a(t, e, i, n) {
- Array.isArray(n) && n.length > 0 && (n = n[0]), t.type = n
- }
- function l(t, e, i, n) {
- if (Array.isArray(e)) {
- if (!(e.length > 0)) return cc.errorID(5508, i, n);
- if (cc.RawAsset.isRawAssetType(e[0])) return t.url = e[0], void delete t.type;
- t.type = e = e[0]
- }
- "function" == typeof e && (e === String ? t.type = cc.String : e === Boolean ? t.type = cc.Boolean : e === Number && (t.type = cc.Float))
- }
- i.getFullFormOfProperty = function(t, e, i) {
- if (t && t.constructor === Object) return null;
- if (Array.isArray(t) && t.length > 0) {
- t[0];
- return {
- default: [],
- type: t,
- _short: !0
- }
- }
- if ("function" == typeof t) {
- var s = t;
- return cc.RawAsset.isRawAssetType(s) || cc.RawAsset.wasRawAssetType(s) ? {
- default: "",
- url: s,
- _short: !0
- } : {
- default: n.isChildClassOf(s, cc.ValueType) ? new s : null,
- type: s,
- _short: !0
- }
- }
- return t instanceof r.PrimitiveType ? {
- default: t.default,
- _short: !0
- } : {
- default: t,
- _short: !0
- }
- }, i.preprocessAttrs = function(t, e, n, r) {
- for (var s in t) {
- var h = t[s],
- c = i.getFullFormOfProperty(h, s, e);
- if (c && (h = t[s] = c), h) {
- var u = h.notify;
- u && o(h, s, u, t), "type" in h && l(h, h.type, e, s), "url" in h && a(h, 0, 0, h.url), "type" in h && h.type
- }
- }
- }, i.validateMethodWithProps = function(t, e, i, n, r) {
- return "function" == typeof t || null === t
- }
- }), {
- "./CCClass": 198,
- "./attribute": 210,
- "./js": 218
- }],
- 220: [(function(t, e, i) {
- "use strict";
- var n = [];
- cc._RF = {
- push: function(t, e, i) {
- void 0 === i && (i = e, e = ""), n.push({
- uuid: e,
- script: i,
- module: t,
- exports: t.exports,
- beh: null
- })
- },
- pop: function() {
- var t = n.pop(),
- e = t.module,
- i = e.exports;
- if (i === t.exports) {
- for (var r in i) return;
- e.exports = i = t.cls
- }
- },
- peek: function() {
- return n[n.length - 1]
- }
- }
- }), {}],
- 221: [(function(t, e, i) {
- "use strict";
- cc.url = {
- _rawAssets: "",
- normalize: function(t) {
- return t && (46 === t.charCodeAt(0) && 47 === t.charCodeAt(1) ? t = t.slice(2) : 47 === t.charCodeAt(0) && (t = t.slice(1))), t
- },
- raw: function(t) {
- if ((t = this.normalize(t)).startsWith("resources/")) {
- var e = cc.loader._getResUuid(t.slice(10), cc.Asset, null, !0);
- if (e) return cc.AssetLibrary.getLibUrlNoExt(e, !0) + cc.path.extname(t)
- } else cc.errorID(7002, t);
- return this._rawAssets + t
- },
- _init: function(t) {
- this._rawAssets = cc.path.stripSep(t) + "/"
- }
- }, e.exports = cc.url
- }), {}],
- 222: [(function(t, e, i) {
- "use strict";
- t("./js");
- e.exports = {
- contains: function(t, e) {
- if ("function" == typeof t.contains) return t.contains(e);
- if ("function" == typeof t.compareDocumentPosition) return !!(16 & t.compareDocumentPosition(e));
- var i = e.parentNode;
- if (i)
- do {
- if (i === t) return !0;
- i = i.parentNode
- } while (null !== i);
- return !1
- },
- isDomNode: "object" == typeof window && ("function" == typeof Node ? function(t) {
- return t instanceof Node
- } : function(t) {
- return t && "object" == typeof t && "number" == typeof t.nodeType && "string" == typeof t.nodeName
- }),
- callInNextTick: function(t, e, i) {
- t && setTimeout((function() {
- t(e, i)
- }), 0)
- }
- }
- }), {
- "./js": 218
- }],
- 223: [(function(t, e, i) {
- "use strict";
- t("./platform/js"), t("./value-types"), t("./utils"), t("./platform/CCInputManager"), t("./platform/CCInputExtension"), t("./event"), t("./platform/CCSys"), t("./platform/CCMacro"), t("./load-pipeline"), t("./CCDirector"), t("./renderer"), t("./platform/CCView"), t("./platform/CCScreen"), t("./CCScheduler"), t("./event-manager")
- }), {
- "./CCDirector": 50,
- "./CCScheduler": 55,
- "./event": 133,
- "./event-manager": 129,
- "./load-pipeline": 153,
- "./platform/CCInputExtension": 201,
- "./platform/CCInputManager": 202,
- "./platform/CCMacro": 203,
- "./platform/CCScreen": 206,
- "./platform/CCSys": 207,
- "./platform/CCView": 208,
- "./platform/js": 218,
- "./renderer": 247,
- "./utils": 298,
- "./value-types": 315
- }],
- 224: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = a(t("./assembler")),
- s = a(t("./utils/dynamic-atlas/manager")),
- o = a(t("./webgl/render-data"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function h(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function c(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var u = (function(t) {
- function e() {
- l(this, e);
- var i = h(this, t.call(this));
- return i._renderData = new o.default, i._renderData.init(i), i.initData(), i.initLocal(), i
- }
- return c(e, t), e.prototype.initData = function() {
- this._renderData.createQuadData(0, this.verticesFloats, this.indicesCount)
- }, e.prototype.initLocal = function() {
- this._local = [], this._local.length = 4
- }, e.prototype.updateColor = function(t, e) {
- var i = this._renderData.uintVDatas[0];
- if (i) {
- e = e || t.node.color._val;
- for (var n = this.floatsPerVert, r = this.colorOffset, s = i.length; r < s; r += n) i[r] = e
- }
- }, e.prototype.getBuffer = function() {
- return cc.renderer._handle._meshBuffer
- }, e.prototype.updateWorldVerts = function(t) {
- var e = this._local,
- i = this._renderData.vDatas[0],
- n = t.node._worldMatrix.m,
- r = n[0],
- s = n[1],
- o = n[4],
- a = n[5],
- l = n[12],
- h = n[13],
- c = e[0],
- u = e[2],
- _ = e[1],
- f = e[3];
- if (1 === r && 0 === s && 0 === o && 1 === a) i[0] = c + l, i[1] = _ + h, i[5] = u + l, i[6] = _ + h, i[10] = c + l, i[11] = f + h, i[15] = u + l, i[16] = f + h;
- else {
- var d = r * c,
- p = r * u,
- m = s * c,
- y = s * u,
- v = o * _,
- g = o * f,
- x = a * _,
- b = a * f;
- i[0] = d + v + l, i[1] = m + x + h, i[5] = p + v + l, i[6] = y + x + h, i[10] = d + g + l, i[11] = m + b + h, i[15] = p + g + l, i[16] = y + b + h
- }
- }, e.prototype.fillBuffers = function(t, e) {
- e.worldMatDirty && this.updateWorldVerts(t);
- var i = this._renderData,
- n = i.vDatas[0],
- r = i.iDatas[0],
- s = this.getBuffer(e),
- o = s.request(this.verticesCount, this.indicesCount),
- a = o.byteOffset >> 2,
- l = s._vData;
- n.length + a > l.length ? l.set(n.subarray(0, l.length - a), a) : l.set(n, a);
- for (var h = s._iData, c = o.indiceOffset, u = o.vertexOffset, _ = 0, f = r.length; _ < f; _++) h[c++] = u + r[_]
- }, e.prototype.packToDynamicAtlas = function(t, e) {
- if (e) {
- if (!e._original && s.default && e._texture.packable) {
- var i = s.default.insertSpriteFrame(e);
- i && e._setDynamicAtlasFrame(i)
- }
- var n = t.sharedMaterials[0];
- if (!n) return;
- n.getProperty("texture") !== e._texture && (t._vertsDirty = !0, t._activateMaterial(!0))
- }
- }, n(e, [{
- key: "verticesFloats",
- get: function() {
- return this.verticesCount * this.floatsPerVert
- }
- }]), e
- })(r.default);
- i.default = u, cc.js.addon(u.prototype, {
- floatsPerVert: 5,
- verticesCount: 4,
- indicesCount: 6,
- uvOffset: 2,
- colorOffset: 4
- }), cc.Assembler2D = u, e.exports = i.default
- }), {
- "./assembler": 227,
- "./utils/dynamic-atlas/manager": 250,
- "./webgl/render-data": 286
- }],
- 225: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- for (var n = t("./webgl/vertex-format"), r = cc.vmath.vec3, s = [], o = 0; o < 4; o++) s.push(r.create());
- var a = {
- floatsPerVert: 6,
- uvOffset: 3,
- colorOffset: 5,
- getBuffer: function(t) {
- return t._meshBuffer3D
- },
- getVfmt: function() {
- return n.vfmt3D
- },
- updateWorldVerts: function(t) {
- var e = t.node._worldMatrix,
- i = this._local,
- n = this._renderData.vDatas[0];
- r.set(s[0], i[0], i[1], 0), r.set(s[1], i[2], i[1], 0), r.set(s[2], i[0], i[3], 0), r.set(s[3], i[2], i[3], 0);
- for (var o = this.floatsPerVert, a = 0; a < 4; a++) {
- var l = s[a];
- r.transformMat4(l, l, e);
- var h = o * a;
- n[h] = l.x, n[h + 1] = l.y, n[h + 2] = l.z
- }
- }
- };
- cc.Assembler3D = a, i.default = a, e.exports = i.default
- }), {
- "./webgl/vertex-format": 288
- }],
- 226: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../utils/pool"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = 0;
- function l(t) {
- return Object.getOwnPropertyDescriptor(t, "__assemblerId__") || (t.__assemblerId__ = ++a), t.__assemblerId__
- }
- var h = new(function(t) {
- function e() {
- var i, n;
- r(this, e);
- for (var o = arguments.length, a = Array(o), l = 0; l < o; l++) a[l] = arguments[l];
- return i = n = s(this, t.call.apply(t, [this].concat(a))), n._pool = {}, s(n, i)
- }
- return o(e, t), e.prototype.put = function(t) {
- if (t && this.enabled) {
- var e = l(t.constructor),
- i = this._pool;
- i[e] || (i[e] = []), this.count > this.maxSize || (this._clean(t), i[e].push(t), this.count++)
- }
- }, e.prototype.get = function(t) {
- var e = void 0;
- if (this.enabled) {
- var i = this._pool,
- n = l(t);
- e = i[n] && i[n].pop()
- }
- return e ? this.count-- : e = new t, e
- }, e.prototype.clear = function() {
- this._pool = {}, this.count = 0
- }, e.prototype._clean = function(t) {
- t._renderComp = null
- }, e
- }(n.default));
- n.default.register("assembler", h), i.default = h, e.exports = i.default
- }), {
- "../utils/pool": 302
- }],
- 227: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("./webgl/vertex-format"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./assembler-pool"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t() {
- s(this, t), this._extendNative && this._extendNative()
- }
- return t.prototype.init = function(t) {
- this._renderComp = t
- }, t.prototype.updateRenderData = function(t) {}, t.prototype.fillBuffers = function(t, e) {}, t.prototype.getVfmt = function() {
- return n.vfmtPosUvColor
- }, t
- })();
- i.default = o, o.register = function(t, e) {
- t.__assembler__ = e
- }, o.init = function(t) {
- for (var e = t.constructor, i = e.__assembler__; !i;) {
- if (!(e = e.$super)) return void cc.warn("Can not find assembler for render component : [" + cc.js.getClassName(t) + "]");
- i = e.__assembler__
- }
- if (i.getConstructor && (i = i.getConstructor(t)), !t._assembler || t._assembler.constructor !== i) {
- var n = r.default.get(i);
- n.init(t), t._assembler = n
- }
- }, cc.Assembler = o, e.exports = i.default
- }), {
- "./assembler-pool": 226,
- "./webgl/vertex-format": 288
- }],
- 228: [(function(t, e, i) {
- "use strict";
- var n = function(t) {
- var e;
- try {
- e = t.getContext("2d")
- } catch (t) {
- return void console.error(t)
- }
- this._canvas = t, this._ctx = e, this._caps = {}, this._stats = {
- drawcalls: 0
- }, this._vx = this._vy = this._vw = this._vh = 0, this._sx = this._sy = this._sw = this._sh = 0
- };
- n.prototype._restoreTexture = function(t) {}, n.prototype.setViewport = function(t, e, i, n) {
- this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._vx = t, this._vy = e, this._vw = i, this._vh = n)
- }, n.prototype.setScissor = function(t, e, i, n) {
- this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._sx = t, this._sy = e, this._sw = i, this._sh = n)
- }, n.prototype.clear = function(t) {
- var e = this._ctx;
- e.clearRect(this._vx, this._vy, this._vw, this._vh), !t || 0 === t[0] && 0 === t[1] && 0 === t[2] || (e.fillStyle = "rgb(" + t[0] + "," + t[1] + "," + t[2] + ")", e.globalAlpha = t[3], e.fillRect(this._vx, this._vy, this._vw, this._vh))
- }, n.prototype.resetDrawCalls = function() {
- this._stats.drawcalls = 0
- }, n.prototype.getDrawCalls = function() {
- return this._stats.drawcalls
- }, e.exports = n
- }), {}],
- 229: [(function(t, e, i) {
- "use strict";
- var n = function(t, e) {
- this._device = t, this._width = 4, this._height = 4, this._image = null, e && (void 0 !== e.width && (this._width = e.width), void 0 !== e.height && (this._height = e.height), this.updateImage(e))
- };
- n.prototype.update = function(t) {
- this.updateImage(t)
- }, n.prototype.updateImage = function(t) {
- if (t.images && t.images[0]) {
- var e = t.images[0];
- e && e !== this._image && (this._image = e)
- }
- }, n.prototype.destroy = function() {
- this._image = null
- }, e.exports = n
- }), {}],
- 230: [(function(t, e, i) {
- "use strict";
- var n = function() {};
- n.prototype = {
- constructor: n,
- clear: function() {},
- render: function() {}
- }, e.exports = n
- }), {}],
- 231: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, t("./render-flow"), t("./renderers");
- var n = s(t("./forward-renderer")),
- r = s(t("./render-component-handle"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- i.default = {
- ForwardRenderer: n.default,
- RenderComponentHandle: r.default
- }, e.exports = i.default
- }), {
- "./forward-renderer": 230,
- "./render-component-handle": 232,
- "./render-flow": 233,
- "./renderers": 236
- }],
- 232: [(function(t, e, i) {
- "use strict";
- var n = t("./renderers/utils"),
- r = function(t, e) {
- this._device = t, this._camera = e, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.walking = !1
- };
- r.prototype = {
- constructor: r,
- reset: function() {
- var t = this._device._ctx,
- e = this._device._canvas,
- i = cc.Camera.main ? cc.Camera.main.backgroundColor : cc.color(),
- r = "rgba(" + i.r + ", " + i.g + ", " + i.b + ", " + i.a / 255 + ")";
- t.fillStyle = r, t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, e.width, e.height), t.fillRect(0, 0, e.width, e.height), this._device._stats.drawcalls = 0, n.context.reset()
- },
- terminate: function() {}
- }, e.exports = r
- }), {
- "./renderers/utils": 246
- }],
- 233: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../render-flow"));
- n.default.prototype._draw = function(t, e) {
- var i = n.default.getBachther(),
- r = i._device._ctx,
- s = i._camera;
- r.setTransform(s.a, s.b, s.c, s.d, s.tx, s.ty), r.scale(1, -1);
- var o = t._renderComponent;
- o._assembler[e](r, o), this._next._func(t)
- }, n.default.prototype._render = function(t) {
- this._draw(t, "draw")
- }, n.default.prototype._postRender = function(t) {
- this._draw(t, "postDraw")
- }
- }), {
- "../render-flow": 248
- }],
- 234: [(function(t, e, i) {
- "use strict";
- var n = t("../../../../graphics/helper"),
- r = t("../../../../graphics/types"),
- s = t("../../../../platform/js"),
- o = r.LineJoin,
- a = r.LineCap;
- function l() {
- this.cmds = [], this.style = {
- strokeStyle: "black",
- fillStyle: "white",
- lineCap: "butt",
- lineJoin: "miter",
- miterLimit: 10
- }
- }
- var h = l.prototype;
- s.mixin(h, {
- moveTo: function(t, e) {
- this.cmds.push(["moveTo", [t, e]])
- },
- lineTo: function(t, e) {
- this.cmds.push(["lineTo", [t, e]])
- },
- bezierCurveTo: function(t, e, i, n, r, s) {
- this.cmds.push(["bezierCurveTo", [t, e, i, n, r, s]])
- },
- quadraticCurveTo: function(t, e, i, n) {
- this.cmds.push(["quadraticCurveTo", [t, e, i, n]])
- },
- arc: function(t, e, i, r, s, o) {
- n.arc(this, t, e, i, r, s, o)
- },
- ellipse: function(t, e, i, r) {
- n.ellipse(this, t, e, i, r)
- },
- circle: function(t, e, i) {
- n.ellipse(this, t, e, i, i)
- },
- rect: function(t, e, i, n) {
- this.moveTo(t, e), this.lineTo(t, e + n), this.lineTo(t + i, e + n), this.lineTo(t + i, e), this.close()
- },
- roundRect: function(t, e, i, r, s) {
- n.roundRect(this, t, e, i, r, s)
- },
- clear: function(t, e) {
- this.cmds.length = 0
- },
- close: function() {
- this.cmds.push(["closePath", []])
- },
- stroke: function() {
- this.cmds.push(["stroke", []])
- },
- fill: function() {
- this.cmds.push(["fill", []])
- }
- }), s.set(h, "strokeColor", (function(t) {
- var e = "rgba(" + (0 | t.r) + "," + (0 | t.g) + "," + (0 | t.b) + "," + t.a / 255 + ")";
- this.cmds.push(["strokeStyle", e]), this.style.strokeStyle = e
- })), s.set(h, "fillColor", (function(t) {
- var e = "rgba(" + (0 | t.r) + "," + (0 | t.g) + "," + (0 | t.b) + "," + t.a / 255 + ")";
- this.cmds.push(["fillStyle", e]), this.style.fillStyle = e
- })), s.set(h, "lineWidth", (function(t) {
- this.cmds.push(["lineWidth", t]), this.style.lineWidth = t
- })), s.set(h, "lineCap", (function(t) {
- var e = "butt";
- t === a.BUTT ? e = "butt" : t === a.ROUND ? e = "round" : t === a.SQUARE && (e = "square"), this.cmds.push(["lineCap", e]), this.style.lineCap = e
- })), s.set(h, "lineJoin", (function(t) {
- var e = "bevel";
- t === o.BEVEL ? e = "bevel" : t === o.ROUND ? e = "round" : t === o.MITER && (e = "miter"), this.cmds.push(["lineJoin", e]), this.style.lineJoin = e
- })), s.set(h, "miterLimit", (function(t) {
- this.cmds.push(["miterLimit", t]), this.style.miterLimit = t
- })), cc.Graphics._Impl = l, e.exports = l
- }), {
- "../../../../graphics/helper": 141,
- "../../../../graphics/types": 143,
- "../../../../platform/js": 218
- }],
- 235: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = s(t("../../../assembler")),
- r = (s(t("./impl")), s(t("../../../../graphics/graphics")));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var a = (function() {
- function t() {
- o(this, t)
- }
- return t.prototype.init = function() {}, t.prototype.draw = function(t, e) {
- var i = e.node,
- n = i._worldMatrix.m,
- r = n[0],
- s = n[1],
- o = n[4],
- a = n[5],
- l = n[12],
- h = n[13];
- t.transform(r, s, o, a, l, h), t.save(), t.globalAlpha = i.opacity / 255;
- var c = e._impl.style;
- t.strokeStyle = c.strokeStyle, t.fillStyle = c.fillStyle, t.lineWidth = c.lineWidth, t.lineJoin = c.lineJoin, t.miterLimit = c.miterLimit;
- for (var u = !0, _ = e._impl.cmds, f = 0, d = _.length; f < d; f++) {
- var p = _[f],
- m = p[0],
- y = p[1];
- "moveTo" === m && u ? (t.beginPath(), u = !1) : "fill" !== m && "stroke" !== m && "fillRect" !== m || (u = !0), "function" == typeof t[m] ? t[m].apply(t, y) : t[m] = y
- }
- return t.restore(), 1
- }, t.prototype.stroke = function(t) {
- t._impl.stroke()
- }, t.prototype.fill = function(t) {
- t._impl.fill()
- }, t.prototype.clear = function() {}, t
- })();
- i.default = a, n.default.register(r.default, a), e.exports = i.default
- }), {
- "../../../../graphics/graphics": 140,
- "../../../assembler": 227,
- "./impl": 234
- }],
- 236: [(function(t, e, i) {
- "use strict";
- t("../../../components/CCSprite"), t("../../../components/CCLabel"), t("../../../components/CCMask"), t("../../../graphics/graphics"), t("./sprite"), t("./label"), t("./graphics"), t("./mask")
- }), {
- "../../../components/CCLabel": 97,
- "../../../components/CCMask": 101,
- "../../../components/CCSprite": 111,
- "../../../graphics/graphics": 140,
- "./graphics": 235,
- "./label": 238,
- "./mask": 240,
- "./sprite": 242
- }],
- 237: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = o(t("../../../utils/label/bmfont")),
- r = o(t("../render-data")),
- s = o(t("../utils"));
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function a(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function l(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function h(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var c = (function(t) {
- function e() {
- return a(this, e), l(this, t.apply(this, arguments))
- }
- return h(e, t), e.prototype.init = function() {
- this._renderData = new r.default
- }, e.prototype.updateColor = function() {}, e.prototype.appendQuad = function(t, e, i, n, r, s, o) {
- var a = this._renderData,
- l = a.dataLength;
- a.dataLength += 2;
- var h = a.vertices,
- c = i.width,
- u = i.height,
- _ = void 0,
- f = void 0,
- d = void 0,
- p = void 0;
- n ? (_ = i.x, d = i.x + u, f = i.y, p = i.y + c, h[l].u = _, h[l].v = p, h[l + 1].u = _, h[l + 1].v = f) : (_ = i.x, d = i.x + c, f = i.y, p = i.y + u, h[l].u = _, h[l].v = f, h[l + 1].u = d, h[l + 1].v = p), h[l].x = r, h[l].y = s - u * o, h[l + 1].x = r + c * o, h[l + 1].y = s
- }, e.prototype.draw = function(t, e) {
- var i = e.node,
- n = i._worldMatrix.m,
- r = n[0],
- o = n[1],
- a = n[4],
- l = n[5],
- h = n[12],
- c = n[13];
- t.transform(r, o, a, l, h, c), t.scale(1, -1), s.default.context.setGlobalAlpha(t, i.opacity / 255);
- for (var u = e._frame._texture, _ = this._renderData.vertices, f = s.default.getColorizedImage(u, i._color), d = 0, p = _.length; d < p; d += 2) {
- var m = _[d].x,
- y = _[d].y,
- v = _[d + 1].x - m,
- g = _[d + 1].y - y;
- y = -y - g;
- var x = _[d].u,
- b = _[d].v,
- A = _[d + 1].u - x,
- C = _[d + 1].v - b;
- t.drawImage(f, x, b, A, C, m, y, v, g)
- }
- return 1
- }, e
- })(n.default);
- i.default = c, e.exports = i.default
- }), {
- "../../../utils/label/bmfont": 251,
- "../render-data": 241,
- "../utils": 246
- }],
- 238: [(function(t, e, i) {
- "use strict";
- var n = a(t("../../../assembler")),
- r = a(t("../../../../components/CCLabel")),
- s = a(t("./ttf")),
- o = a(t("./bmfont"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var l = {
- pool: [],
- get: function() {
- var t = this.pool.pop();
- if (!t) {
- var e = document.createElement("canvas");
- t = {
- canvas: e,
- context: e.getContext("2d")
- }
- }
- return t
- },
- put: function(t) {
- this.pool.length >= 32 || this.pool.push(t)
- }
- };
- r.default._canvasPool = l, n.default.register(r.default, {
- getConstructor: function(t) {
- var e = s.default;
- return t.font instanceof cc.BitmapFont ? e = o.default : t.cacheMode === r.default.CacheMode.CHAR && cc.warn("sorry, canvas mode does not support CHAR mode currently!"), e
- },
- TTF: s.default,
- Bmfont: o.default
- })
- }), {
- "../../../../components/CCLabel": 97,
- "../../../assembler": 227,
- "./bmfont": 237,
- "./ttf": 239
- }],
- 239: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = o(t("../../../utils/label/ttf")),
- r = o(t("../render-data")),
- s = o(t("../utils"));
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function a(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function l(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function h(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var c = (function(t) {
- function e() {
- return a(this, e), l(this, t.apply(this, arguments))
- }
- return h(e, t), e.prototype.init = function() {
- this._renderData = new r.default, this._renderData.dataLength = 2
- }, e.prototype.updateColor = function() {}, e.prototype.updateVerts = function(t) {
- var e = this._renderData,
- i = t.node,
- n = i.width,
- r = i.height,
- s = i.anchorX * n,
- o = i.anchorY * r,
- a = e.vertices;
- a[0].x = -s, a[0].y = -o, a[1].x = n - s, a[1].y = r - o
- }, e.prototype._updateTexture = function(t) {
- n.default.prototype._updateTexture.call(this, t);
- var e = t._frame._texture;
- s.default.dropColorizedImage(e, t.node.color)
- }, e.prototype.draw = function(t, e) {
- var i = e.node,
- n = i._worldMatrix.m,
- r = n[0],
- o = n[1],
- a = n[4],
- l = n[5],
- h = n[12],
- c = n[13];
- t.transform(r, o, a, l, h, c), t.scale(1, -1), s.default.context.setGlobalAlpha(t, i.opacity / 255);
- var u = e._frame._texture,
- _ = this._renderData.vertices,
- f = u.getHtmlElementObj(),
- d = _[0].x,
- p = _[0].y,
- m = _[1].x - d,
- y = _[1].y - p;
- return p = -p - y, t.drawImage(f, d, p, m, y), 1
- }, e
- })(n.default);
- i.default = c, e.exports = i.default
- }), {
- "../../../utils/label/ttf": 254,
- "../render-data": 241,
- "../utils": 246
- }],
- 240: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../assembler"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../components/CCMask"),
- l = (t("./graphics"), (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.draw = function(t, e) {
- t.save(), e._graphics._assembler.draw(t, e._graphics), t.clip()
- }, e.prototype.postDraw = function(t, e) {
- t.restore()
- }, e
- })(n.default));
- i.default = l, n.default.register(a, l), e.exports = i.default
- }), {
- "../../../components/CCMask": 101,
- "../../assembler": 227,
- "./graphics": 235
- }],
- 241: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })();
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- r(this, t), this.vertices = []
- }
- return n(t, [{
- key: "dataLength",
- get: function() {
- return this.vertices.length
- },
- set: function(t) {
- var e = this.vertices.length;
- this.vertices.length = t;
- for (var i = e; i < t; i++) this.vertices[i] = {
- x: 0,
- y: 0,
- u: 0,
- v: 0
- }
- }
- }]), t
- })();
- i.default = s, e.exports = i.default
- }), {}],
- 242: [(function(t, e, i) {
- "use strict";
- var n = l(t("../../../assembler")),
- r = t("../../../../components/CCSprite"),
- s = l(t("./simple")),
- o = l(t("./sliced")),
- a = l(t("./tiled"));
- function l(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var h = {
- getConstructor: function(t) {
- var e = s.default;
- switch (t.type) {
- case r.Type.SLICED:
- e = o.default;
- break;
- case r.Type.TILED:
- e = a.default
- }
- return e
- },
- Simple: s.default,
- Sliced: o.default,
- Tiled: a.default
- };
- n.default.register(cc.Sprite, h)
- }), {
- "../../../../components/CCSprite": 111,
- "../../../assembler": 227,
- "./simple": 243,
- "./sliced": 244,
- "./tiled": 245
- }],
- 243: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = s(t("../../../assembler")),
- r = s(t("../render-data"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = t("../utils"),
- c = (function(t) {
- function e() {
- return o(this, e), a(this, t.apply(this, arguments))
- }
- return l(e, t), e.prototype.init = function() {
- this._renderData = new r.default, this._renderData.dataLength = 2
- }, e.prototype.updateRenderData = function(t) {
- t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1)
- }, e.prototype.updateUVs = function(t) {
- var e = t.spriteFrame,
- i = this._renderData.vertices,
- n = e._rect;
- if (e._rotated) {
- var r = n.x,
- s = n.width,
- o = n.y,
- a = n.height;
- i[0].u = r, i[0].v = o, i[1].u = a, i[1].v = s
- } else {
- var l = n.x,
- h = n.width,
- c = n.y,
- u = n.height;
- i[0].u = l, i[0].v = c, i[1].u = h, i[1].v = u
- }
- }, e.prototype.updateVerts = function(t) {
- var e = this._renderData,
- i = t.node,
- n = e.vertices,
- r = t.spriteFrame,
- s = i.width,
- o = i.height,
- a = i.anchorX * s,
- l = i.anchorY * o,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = void 0;
- if (t.trim) h = -a, c = -l, u = s, _ = o;
- else {
- var f = r._originalSize.width,
- d = r._originalSize.height,
- p = r._rect.width,
- m = r._rect.height,
- y = r._offset,
- v = s / f,
- g = o / d;
- h = (y.x + (f - p) / 2) * v - a, c = (y.y + (d - m) / 2) * g - l, u = s, _ = o
- }
- r._rotated ? (n[0].y = h, n[0].x = c, n[1].y = u, n[1].x = _) : (n[0].x = h, n[0].y = c, n[1].x = u, n[1].y = _), e.vertDirty = !1
- }, e.prototype.draw = function(t, e) {
- var i = e.node,
- n = e._spriteFrame,
- r = i._worldMatrix.m,
- s = r[0],
- o = r[1],
- a = r[4],
- l = r[5],
- c = r[12],
- u = r[13];
- t.transform(s, o, a, l, c, u), t.scale(1, -1), n._rotated && t.rotate(-Math.PI / 2), h.context.setGlobalAlpha(t, i.opacity / 255);
- var _ = n._texture,
- f = this._renderData.vertices,
- d = h.getColorizedImage(_, i._color),
- p = f[0].x,
- m = f[0].y,
- y = f[1].x,
- v = f[1].y;
- m = -m - v;
- var g = f[0].u,
- x = f[0].v,
- b = f[1].u,
- A = f[1].v;
- return t.drawImage(d, g, x, b, A, p, m, y, v), 1
- }, e
- })(n.default);
- i.default = c, e.exports = i.default
- }), {
- "../../../assembler": 227,
- "../render-data": 241,
- "../utils": 246
- }],
- 244: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- s(t("../../../assembler"));
- var n = s(t("../render-data")),
- r = s(t("./simple"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = t("../utils"),
- c = (function(t) {
- function e() {
- return o(this, e), a(this, t.apply(this, arguments))
- }
- return l(e, t), e.prototype.init = function() {
- this._renderData = new n.default, this._renderData.dataLength = 4
- }, e.prototype.updateUVs = function(t) {
- var e = t.spriteFrame,
- i = this._renderData,
- n = e._rect,
- r = e.insetLeft,
- s = e.insetRight,
- o = n.width - r - s,
- a = e.insetTop,
- l = e.insetBottom,
- h = n.height - a - l,
- c = i.vertices;
- e._rotated ? (c[0].u = n.x, c[1].u = l + n.x, c[2].u = l + h + n.x, c[3].u = n.x + n.height, c[3].v = n.y, c[2].v = r + n.y, c[1].v = r + o + n.y, c[0].v = n.y + n.width) : (c[0].u = n.x, c[1].u = r + n.x, c[2].u = r + o + n.x, c[3].u = n.x + n.width, c[3].v = n.y, c[2].v = a + n.y, c[1].v = a + h + n.y, c[0].v = n.y + n.height)
- }, e.prototype.updateVerts = function(t) {
- var e = this._renderData.vertices,
- i = t.node,
- n = i.width,
- r = i.height,
- s = i.anchorX * n,
- o = i.anchorY * r,
- a = t.spriteFrame,
- l = a.insetLeft,
- h = a.insetRight,
- c = a.insetTop,
- u = a.insetBottom,
- _ = n - l - h,
- f = r - c - u,
- d = n / (l + h),
- p = r / (c + u);
- d = isNaN(d) || d > 1 ? 1 : d, p = isNaN(p) || p > 1 ? 1 : p, _ = _ < 0 ? 0 : _, f = f < 0 ? 0 : f, a._rotated ? (e[0].y = -s, e[0].x = -o, e[1].y = h * d - s, e[1].x = u * p - o, e[2].y = e[1].y + _, e[2].x = e[1].x + f, e[3].y = n - s, e[3].x = r - o) : (e[0].x = -s, e[0].y = -o, e[1].x = l * d - s, e[1].y = u * p - o, e[2].x = e[1].x + _, e[2].y = e[1].y + f, e[3].x = n - s, e[3].y = r - o), t._vertsDirty = !1
- }, e.prototype.draw = function(t, e) {
- var i = e.node,
- n = e._spriteFrame,
- r = i._worldMatrix.m,
- s = r[0],
- o = r[1],
- a = r[4],
- l = r[5],
- c = r[12],
- u = r[13];
- t.transform(s, o, a, l, c, u), t.scale(1, -1), n._rotated && t.rotate(-Math.PI / 2), h.context.setGlobalAlpha(t, i.opacity / 255);
- for (var _ = n._texture, f = this._renderData.vertices, d = h.getColorizedImage(_, i._color), p = 0, m = void 0, y = void 0, v = void 0, g = void 0, x = void 0, b = void 0, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, E = void 0, M = 0; M < 3; ++M) {
- g = f[M], v = f[M + 1];
- for (var D = 0; D < 3; ++D) m = f[D], y = f[D + 1], x = m.x, b = g.y, A = y.x - x, b = -b - (C = v.y - b), T = m.u, S = v.v, w = y.u - T, E = g.v - S, w > 0 && E > 0 && A > 0 && C > 0 && (t.drawImage(d, T, S, w, E, x, b, A, C), p++)
- }
- return p
- }, e
- })(r.default);
- i.default = c, e.exports = i.default
- }), {
- "../../../assembler": 227,
- "../render-data": 241,
- "../utils": 246,
- "./simple": 243
- }],
- 245: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../assembler"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../utils"),
- l = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.draw = function(t, e) {
- var i = e.node,
- n = i._worldMatrix.m,
- r = n[0],
- s = n[1],
- o = n[4],
- l = n[5],
- h = n[12],
- c = n[13];
- t.transform(r, s, o, l, h, c), t.scale(1, -1), a.context.setGlobalAlpha(t, i.opacity / 255);
- var u = e.spriteFrame,
- _ = u._rect,
- f = u._texture,
- d = _.x,
- p = _.y,
- m = u._rotated ? _.height : _.width,
- y = u._rotated ? _.width : _.height,
- v = a.getFrameCache(f, i._color, d, p, m, y),
- g = i.width,
- x = i.height,
- b = -i.anchorX * g,
- A = -i.anchorY * x;
- return A = -A - x, t.translate(b, A), t.fillStyle = t.createPattern(v, "repeat"), t.fillRect(0, 0, g, x), 1
- }, e
- })(n.default);
- i.default = l, e.exports = i.default
- }), {
- "../../../assembler": 227,
- "../utils": 246
- }],
- 246: [(function(t, e, i) {
- "use strict";
- function n(t, e, i, n, r, s, o) {
- var a = e._image,
- l = t.getContext("2d");
- return t.width = s, t.height = o, l.globalCompositeOperation = "source-over", l.fillStyle = "rgb(" + i.r + "," + i.g + "," + i.b + ")", l.fillRect(0, 0, s, o), l.globalCompositeOperation = "multiply", l.drawImage(a, n, r, s, o, 0, 0, s, o), l.globalCompositeOperation = "destination-atop", l.drawImage(a, n, r, s, o, 0, 0, s, o), t
- }
- var r = {
- canvasMap: {},
- canvasUsed: {},
- canvasPool: [],
- checking: !1,
- check: function() {
- var t = !1;
- for (var e in this.canvasUsed)
- if (t = !0, this.canvasUsed[e]) this.canvasUsed[e] = !1;
- else {
- var i = this.canvasMap[e];
- i.width = 0, i.height = 0, this.canvasPool.length < 32 && this.canvasPool.push(i), delete this.canvasMap[e], delete this.canvasUsed[e]
- }
- t || (cc.director.off(cc.Director.EVENT_AFTER_DRAW, this.check, this), this.checking = !1)
- },
- startCheck: function() {
- cc.director.on(cc.Director.EVENT_AFTER_DRAW, this.check, this), this.checking = !0
- },
- getCanvas: function(t) {
- return this.canvasUsed[t] = !0, this.canvasMap[t]
- },
- cacheCanvas: function(t, e) {
- this.canvasMap[e] = t, this.canvasUsed[e] = !0, this.checking || this.startCheck()
- },
- dropImage: function(t) {
- this.canvasMap[t] && delete this.canvasMap[t]
- }
- };
- e.exports = {
- getColorizedImage: function(t, e) {
- if (!t) return null;
- if (0 === t.width || 0 === t.height) return t._image;
- var i = 16777215 & e._val;
- if (16777215 === i) return t._image;
- var s = t.url + i,
- o = r.getCanvas(s);
- return o || (n(o = r.canvasPool.pop() || document.createElement("canvas"), t, e, 0, 0, t.width, t.height), r.cacheCanvas(o, s)), o
- },
- getFrameCache: function(t, e, i, s, o, a) {
- if (!t || !t.url || i < 0 || s < 0 || o <= 0 || a <= 0) return null;
- var l = t.url,
- h = !1,
- c = 16777215 & e._val;
- if (16777215 !== c && (l += c, h = !0), (0 !== i || 0 !== s && o !== t.width && a !== t.height) && (l += "_" + i + "_" + s + "_" + o + "_" + a, h = !0), !h) return t._image;
- var u = r.getCanvas(l);
- return u || (n(u = r.canvasPool.pop() || document.createElement("canvas"), t, e, i, s, o, a), r.cacheCanvas(u, l)), u
- },
- dropColorizedImage: function(t, e) {
- var i = t.url + (16777215 & e._val);
- r.dropImage(i)
- }
- };
- var s = -1,
- o = {
- setGlobalAlpha: function(t, e) {
- s !== e && (s = e, t.globalAlpha = s)
- },
- reset: function() {
- s = -1
- }
- };
- e.exports.context = o
- }), {}],
- 247: [(function(t, e, i) {
- "use strict";
- var n = a(t("../../renderer/config")),
- r = a(t("../../renderer/gfx")),
- s = a(t("../../renderer/core/input-assembler")),
- o = a(t("../../renderer/core/pass"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t) {
- return {
- defaultTexture: new r.default.Texture2D(t, {
- images: [],
- width: 128,
- height: 128,
- wrapS: r.default.WRAP_REPEAT,
- wrapT: r.default.WRAP_REPEAT,
- format: r.default.TEXTURE_FMT_RGB8,
- mipmap: !1
- }),
- programTemplates: [],
- programChunks: {}
- }
- }
- cc.renderer = e.exports = {
- Texture2D: null,
- InputAssembler: s.default,
- Pass: o.default,
- renderEngine: null,
- canvas: null,
- device: null,
- scene: null,
- drawCalls: 0,
- _handle: null,
- _cameraNode: null,
- _camera: null,
- _forward: null,
- _flow: null,
- initWebGL: function(e, i) {
- t("./webgl/assemblers");
- var s = t("./webgl/model-batcher");
- this.Texture2D = r.default.Texture2D, this.canvas = e, this._flow = cc.RenderFlow;
- var o = t("../../renderer/scene/scene"),
- a = t("../../renderer/renderers/forward-renderer");
- this.device = new r.default.Device(e, i), this.scene = new o;
- var h = l(this.device);
- this._forward = new a(this.device, h), this._handle = new s(this.device, this.scene), this._flow.init(this._handle, this._forward), n.default.addStage("shadowcast"), n.default.addStage("opaque"), n.default.addStage("transparent")
- },
- initCanvas: function(e) {
- var i = t("./canvas"),
- n = t("./canvas/Texture2D"),
- r = t("./canvas/Device");
- this.Device = r, this.Texture2D = n, this.canvas = e, this.device = new r(e), this._camera = {
- a: 1,
- b: 0,
- c: 0,
- d: 1,
- tx: 0,
- ty: 0
- }, this._handle = new i.RenderComponentHandle(this.device, this._camera), this._forward = new i.ForwardRenderer, this._flow = cc.RenderFlow, this._flow.init(this._handle, this._forward)
- },
- updateCameraViewport: function() {
- if (cc.director) {
- var t = cc.director.getScene();
- t && t.setScale(1, 1, 1)
- }
- if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
- var e = cc.view.getViewportRect();
- this.device.setViewport(e.x, e.y, e.width, e.height), this._camera.a = cc.view.getScaleX(), this._camera.d = cc.view.getScaleY(), this._camera.tx = e.x, this._camera.ty = e.y + e.height
- }
- },
- render: function(t, e) {
- this.device.resetDrawCalls(), t && (this._flow.render(t, e), this.drawCalls = this.device.getDrawCalls())
- },
- clear: function() {
- this._handle.reset(), this._forward.clear()
- }
- }
- }), {
- "../../renderer/config": 347,
- "../../renderer/core/input-assembler": 350,
- "../../renderer/core/pass": 351,
- "../../renderer/gfx": 360,
- "../../renderer/renderers/forward-renderer": 379,
- "../../renderer/scene/scene": 383,
- "./canvas": 231,
- "./canvas/Device": 228,
- "./canvas/Texture2D": 229,
- "./webgl/assemblers": 259,
- "./webgl/model-batcher": 284
- }],
- 248: [(function(t, e, i) {
- "use strict";
- var n = 0,
- r = 1 << n++,
- s = 1 << n++,
- o = 1 << n++,
- a = 1 << n++,
- l = o | a,
- h = 1 << n++,
- c = 1 << n++,
- u = 1 << n++,
- _ = c | u,
- f = 1 << n++,
- d = 1 << n++,
- p = 1 << n++,
- m = 1 << n++,
- y = void 0,
- v = void 0,
- g = 0;
- function x() {
- this._func = w, this._next = null
- }
- var b = x.prototype;
- b._doNothing = function() {}, b._localTransform = function(t) {
- t._updateLocalMatrix(), t._renderFlag &= ~o, this._next._func(t)
- }, b._worldTransform = function(t) {
- y.worldMatDirty++;
- var e = t._matrix,
- i = t._trs,
- n = e.m;
- n[12] = i[0], n[13] = i[1], n[14] = i[2], t._mulMat(t._worldMatrix, t._parent._worldMatrix, e), t._renderFlag &= ~a, this._next._func(t), y.worldMatDirty--
- }, b._opacity = function(t) {
- y.parentOpacityDirty++, t._renderFlag &= ~c, this._next._func(t), y.parentOpacityDirty--
- }, b._color = function(t) {
- var e = t._renderComponent;
- e && e._updateColor(), t._renderFlag &= ~u, this._next._func(t)
- }, b._updateRenderData = function(t) {
- var e = t._renderComponent;
- e._assembler.updateRenderData(e), t._renderFlag &= ~h, this._next._func(t)
- }, b._render = function(t) {
- var e = t._renderComponent;
- e._checkBacth(y, t._cullingMask), e._assembler.fillBuffers(e, y), this._next._func(t)
- }, b._children = function(t) {
- for (var e = g, i = y, n = i.parentOpacity, r = i.parentOpacity *= t._opacity / 255, s = (i.worldMatDirty ? a : 0) | (i.parentOpacityDirty ? _ : 0), o = t._children, l = 0, h = o.length; l < h; l++) {
- var c = o[l];
- if (c._renderFlag |= s, c._activeInHierarchy && 0 !== c._opacity) {
- g = c._cullingMask = 0 === c.groupIndex ? e : 1 << c.groupIndex;
- var u = c._color._val;
- c._color._fastSetA(c._opacity * r), C[c._renderFlag]._func(c), c._color._val = u
- }
- }
- i.parentOpacity = n, this._next._func(t)
- }, b._postRender = function(t) {
- var e = t._renderComponent;
- e._checkBacth(y, t._cullingMask), e._assembler.postFillBuffers(e, y), this._next._func(t)
- };
- var A = new x;
- A._func = A._doNothing, A._next = A;
- var C = {};
- function T(t, e) {
- var i = new x;
- switch (i._next = e || A, t) {
- case r:
- case s:
- i._func = i._doNothing;
- break;
- case o:
- i._func = i._localTransform;
- break;
- case a:
- i._func = i._worldTransform;
- break;
- case c:
- i._func = i._opacity;
- break;
- case u:
- i._func = i._color;
- break;
- case h:
- i._func = i._updateRenderData;
- break;
- case f:
- i._func = i._render;
- break;
- case d:
- i._func = i._children;
- break;
- case p:
- i._func = i._postRender
- }
- return i
- }
- function S(t) {
- for (var e = null, i = m; i > 0;) i & t && (e = T(i, e)), i >>= 1;
- return e
- }
- function w(t) {
- var e = t._renderFlag;
- (C[e] = S(e))._func(t)
- }
- x.flows = C, x.createFlow = T, x.visitRootNode = function(t) {
- g = 1 << t.groupIndex, t._renderFlag & a ? (y.worldMatDirty++, t._calculWorldMatrix(), t._renderFlag &= ~a, C[t._renderFlag]._func(t), y.worldMatDirty--) : C[t._renderFlag]._func(t)
- }, x.render = function(t, e) {
- y.reset(), y.walking = !0, x.visitRootNode(t), y.terminate(), y.walking = !1, v.render(y._renderScene, e)
- }, x.init = function(t, e) {
- y = t, v = e, C[0] = A;
- for (var i = 1; i < m; i++) C[i] = new x
- }, x.getBachther = function() {
- return y
- }, x.FLAG_DONOTHING = r, x.FLAG_BREAK_FLOW = s, x.FLAG_LOCAL_TRANSFORM = o, x.FLAG_WORLD_TRANSFORM = a, x.FLAG_TRANSFORM = l, x.FLAG_OPACITY = c, x.FLAG_COLOR = u, x.FLAG_OPACITY_COLOR = _, x.FLAG_UPDATE_RENDER_DATA = h, x.FLAG_RENDER = f, x.FLAG_CHILDREN = d, x.FLAG_POST_RENDER = p, x.FLAG_FINAL = m, e.exports = cc.RenderFlow = x
- }), {}],
- 249: [(function(t, e, i) {
- "use strict";
- var n = t("../../../assets/CCRenderTexture"),
- r = 2;
- function s(t, e) {
- var i = new n;
- i.initWithSize(t, e), i.update(), this._texture = i, this._x = r, this._y = r, this._nexty = r, this._width = t, this._height = e, this._innerTextureInfos = {}, this._innerSpriteFrames = []
- }
- s.DEFAULT_HASH = (new n)._getHash(), cc.js.mixin(s.prototype, {
- insertSpriteFrame: function(t) {
- var e = t._rect,
- i = t._texture,
- n = this._innerTextureInfos[i._id],
- s = e.x,
- o = e.y;
- if (n) s += n.x, o += n.y;
- else {
- var a = i.width,
- l = i.height;
- if (this._x + a + r > this._width && (this._x = r, this._y = this._nexty), this._y + l + r > this._nexty && (this._nexty = this._y + l + r), this._nexty > this._height) return null;
- cc.dynamicAtlasManager.textureBleeding && (this._texture.drawTextureAt(i, this._x - 1, this._y), this._texture.drawTextureAt(i, this._x + 1, this._y), this._texture.drawTextureAt(i, this._x, this._y - 1), this._texture.drawTextureAt(i, this._x, this._y + 1)), this._texture.drawTextureAt(i, this._x, this._y), this._innerTextureInfos[i._id] = {
- x: this._x,
- y: this._y,
- texture: i
- }, s += this._x, o += this._y, this._x += a + r, this._dirty = !0
- }
- var h = {
- x: s,
- y: o,
- texture: this._texture
- };
- return this._innerSpriteFrames.push(t), h
- },
- update: function() {
- this._dirty && (this._texture.update(), this._dirty = !1)
- },
- deleteInnerTexture: function(t) {
- t && delete this._innerTextureInfos[t._id]
- },
- reset: function() {
- this._x = r, this._y = r, this._nexty = r;
- for (var t = this._innerSpriteFrames, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n.isValid && n._resetDynamicAtlasFrame()
- }
- this._innerSpriteFrames.length = 0, this._innerTextureInfos = {}
- },
- destroy: function() {
- this.reset(), this._texture.destroy()
- }
- }), e.exports = s
- }), {
- "../../../assets/CCRenderTexture": 66
- }],
- 250: [(function(t, e, i) {
- "use strict";
- var n = t("./atlas"),
- r = [],
- s = -1,
- o = 5,
- a = 2048,
- l = 8,
- h = 512,
- c = !0;
- function u() {
- var t = r[++s];
- return t || (t = new n(a, a), r.push(t)), t
- }
- function _() {
- d.reset()
- }
- var f = !1,
- d = {
- Atlas: n,
- get enabled() {
- return f
- },
- set enabled(t) {
- f !== t && (t ? (this.reset(), cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, _)) : cc.director.off(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, _), f = t)
- },
- get maxAtlasCount() {
- return o
- },
- set maxAtlasCount(t) {
- o = t
- },
- get textureBleeding() {
- return c
- },
- set textureBleeding(t) {
- c = t
- },
- get textureSize() {
- return a
- },
- set textureSize(t) {
- a = t
- },
- get maxFrameSize() {
- return h
- },
- set maxFrameSize(t) {
- h = t
- },
- get minFrameSize() {
- return l
- },
- set minFrameSize(t) {
- l = t
- },
- insertSpriteFrame: function(t) {
- if (!f || s === o || !t || t._original) return null;
- if (!t._texture.packable) return null;
- var e = r[s];
- e || (e = u());
- var i = e.insertSpriteFrame(t);
- return i || s === o ? i : (e = u()).insertSpriteFrame(t)
- },
- reset: function() {
- for (var t = 0, e = r.length; t < e; t++) r[t].destroy();
- r.length = 0, s = -1
- },
- deleteAtlasTexture: function(t) {
- if (t._original) {
- var e = t._original._texture;
- if (e)
- for (var i = 0, n = r.length; i < n; i++) r[i].deleteInnerTexture(e)
- }
- },
- showDebug: !1,
- update: function() {
- if (this.enabled)
- for (var t = 0; t <= s; t++) r[t].update()
- }
- };
- e.exports = cc.dynamicAtlasManager = d
- }), {
- "./atlas": 249
- }],
- 251: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../assembler-2d"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../utils/text-utils"),
- l = t("../../../platform/CCMacro"),
- h = t("../../../components/CCLabel").Overflow,
- c = t("../utils").shareLabelInfo,
- u = function() {
- this.char = "", this.valid = !0, this.x = 0, this.y = 0, this.line = 0, this.hash = ""
- },
- _ = cc.rect(),
- f = null,
- d = [],
- p = [],
- m = [],
- y = [],
- v = null,
- g = 0,
- x = 0,
- b = 0,
- A = 0,
- C = 0,
- T = 1,
- S = null,
- w = cc.size(),
- E = "",
- M = 0,
- D = 0,
- B = 0,
- I = 0,
- P = 0,
- R = 0,
- O = 0,
- L = !1,
- F = 0,
- N = 0,
- V = 0,
- k = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateRenderData = function(t) {
- t._vertsDirty && f !== t && (f = t, this._reserveQuads(t, t.string.toString().length), this._updateFontFamily(t), this._updateProperties(t), this._updateLabelInfo(t), this._updateContent(), this.updateWorldVerts(t), f._actualFontSize = M, f.node.setContentSize(w), f._vertsDirty = !1, f = null, this._resetProperties())
- }, e.prototype._updateFontScale = function() {
- T = M / D
- }, e.prototype._updateFontFamily = function(t) {
- var e = t.font;
- S = e.spriteFrame, v = e._fntConfig, c.fontAtlas = e._fontDefDictionary
- }, e.prototype._updateLabelInfo = function() {
- c.hash = "", c.margin = 0
- }, e.prototype._updateProperties = function(t) {
- E = t.string.toString(), M = t.fontSize, D = v ? v.fontSize : t.fontSize, B = t.horizontalAlign, I = t.verticalAlign, P = t.spacingX, O = t.overflow, R = t._lineHeight, w.width = t.node.width, w.height = t.node.height, O === h.NONE ? (L = !1, w.width += 2 * c.margin, w.height += 2 * c.margin) : O === h.RESIZE_HEIGHT ? (L = !0, w.height += 2 * c.margin) : L = t.enableWrapText, c.lineHeight = R, c.fontSize = M, this._setupBMFontOverflowMetrics()
- }, e.prototype._resetProperties = function() {
- v = null, S = null, c.hash = "", c.margin = 0
- }, e.prototype._updateContent = function() {
- this._updateFontScale(), this._computeHorizontalKerningForText(), this._alignText()
- }, e.prototype._computeHorizontalKerningForText = function() {
- for (var t = E, e = t.length, i = v.kerningDict, n = d, r = -1, s = 0; s < e; ++s) {
- var o = t.charCodeAt(s),
- a = i[r << 16 | 65535 & o] || 0;
- n[s] = s < e - 1 ? a : 0, r = o
- }
- }, e.prototype._multilineTextWrap = function(t) {
- for (var e = E.length, i = 0, n = 0, r = 0, s = 0, o = 0, l = 0, h = 0, u = null, _ = cc.v2(0, 0), f = 0; f < e;) {
- var p = E.charAt(f);
- if ("\n" !== p) {
- for (var y = t(E, f, e), b = l, S = h, M = o, D = n, B = !1, I = 0; I < y; ++I) {
- var O = f + I;
- if ("\r" !== (p = E.charAt(O)))
- if (u = c.fontAtlas.getLetterDefinitionForChar(p, c)) {
- var k = D + u.offsetX * T - c.margin;
- if (L && V > 0 && n > 0 && k + u.w * T > V && !a.isUnicodeSpace(p)) {
- m.push(o), o = 0, i++, n = 0, r -= R * T + 0, B = !0;
- break
- }
- _.x = k, _.y = r - u.offsetY * T + c.margin, this._recordLetterInfo(_, p, O, i), O + 1 < d.length && O < e - 1 && (D += d[O + 1]), D += u.xAdvance * T + P - 2 * c.margin, M = _.x + u.w * T - c.margin, b < _.y && (b = _.y), S > _.y - u.h * T && (S = _.y - u.h * T)
- } else this._recordPlaceholderInfo(O, p), console.log("Can't find letter definition in texture atlas " + v.atlasName + " for letter:" + p);
- else this._recordPlaceholderInfo(O, p)
- }
- B || (n = D, o = M, l < b && (l = b), h > S && (h = S), s < o && (s = o), f += y)
- } else m.push(o), o = 0, i++, n = 0, r -= R * T + 0, this._recordPlaceholderInfo(f, p), f++
- }
- return m.push(o), x = (g = i + 1) * R * T, g > 1 && (x += 0 * (g - 1)), w.width = F, w.height = N, F <= 0 && (w.width = parseFloat(s.toFixed(2)) + 2 * c.margin), N <= 0 && (w.height = parseFloat(x.toFixed(2)) + 2 * c.margin), A = w.height, C = 0, l > 0 && (A = w.height + l), h < -x && (C = x + h), !0
- }, e.prototype._getFirstCharLen = function() {
- return 1
- }, e.prototype._getFirstWordLen = function(t, e, i) {
- var n = t.charAt(e);
- if (a.isUnicodeCJK(n) || "\n" === n || a.isUnicodeSpace(n)) return 1;
- var r = 1,
- s = c.fontAtlas.getLetterDefinitionForChar(n, c);
- if (!s) return r;
- for (var o = s.xAdvance * T + P, l = e + 1; l < i && (n = t.charAt(l), s = c.fontAtlas.getLetterDefinitionForChar(n, c)); ++l) {
- if (o + s.offsetX * T + s.w * T > V && !a.isUnicodeSpace(n) && V > 0) return r;
- if (o += s.xAdvance * T + P, "\n" === n || a.isUnicodeSpace(n) || a.isUnicodeCJK(n)) break;
- r++
- }
- return r
- }, e.prototype._multilineTextWrapByWord = function() {
- return this._multilineTextWrap(this._getFirstWordLen)
- }, e.prototype._multilineTextWrapByChar = function() {
- return this._multilineTextWrap(this._getFirstCharLen)
- }, e.prototype._recordPlaceholderInfo = function(t, e) {
- if (t >= p.length) {
- var i = new u;
- p.push(i)
- }
- p[t].char = e, p[t].hash = e.charCodeAt(0) + c.hash, p[t].valid = !1
- }, e.prototype._recordLetterInfo = function(t, e, i, n) {
- if (i >= p.length) {
- var r = new u;
- p.push(r)
- }
- var s = e.charCodeAt(0) + c.hash;
- p[i].line = n, p[i].char = e, p[i].hash = s, p[i].valid = c.fontAtlas.getLetter(s).valid, p[i].x = t.x, p[i].y = t.y
- }, e.prototype._alignText = function() {
- x = 0, m.length = 0, this._multilineTextWrapByWord(), this._computeAlignmentOffset(), O === h.SHRINK && M > 0 && this._isVerticalClamp() && this._shrinkLabelToContentSize(this._isVerticalClamp), this._updateQuads() || O === h.SHRINK && this._shrinkLabelToContentSize(this._isHorizontalClamp)
- }, e.prototype._scaleFontSizeDown = function(t) {
- var e = !0;
- t || (t = .1, e = !1), M = t, e && this._updateContent()
- }, e.prototype._shrinkLabelToContentSize = function(t) {
- for (var e = M, i = 0, n = !0; t();) {
- var r = e - ++i;
- if (n = !1, r <= 0) break;
- T = r / D, this._multilineTextWrapByWord(), this._computeAlignmentOffset()
- }
- n || e - i >= 0 && this._scaleFontSizeDown(e - i)
- }, e.prototype._isVerticalClamp = function() {
- return x > w.height
- }, e.prototype._isHorizontalClamp = function() {
- for (var t = !1, e = 0, i = E.length; e < i; ++e) {
- var n = p[e];
- if (n.valid) {
- var r = c.fontAtlas.getLetter(n.hash),
- s = n.x + r.w * T,
- o = n.line;
- if (F > 0)
- if (L) {
- if (m[o] > w.width && (s > w.width || s < 0)) {
- t = !0;
- break
- }
- } else if (s > w.width) {
- t = !0;
- break
- }
- }
- }
- return t
- }, e.prototype._isHorizontalClamped = function(t, e) {
- var i = m[e],
- n = t > w.width || t < 0;
- return L ? i > w.width && n : n
- }, e.prototype._updateQuads = function() {
- var t = c.fontAtlas.getTexture(),
- e = f.node;
- this.verticesCount = this.indicesCount = 0, this._renderData && (this._renderData.dataLength = 0);
- for (var i = w, n = e._anchorPoint.x * i.width, r = e._anchorPoint.y * i.height, s = !0, o = 0, a = E.length; o < a; ++o) {
- var l = p[o];
- if (l.valid) {
- var u = c.fontAtlas.getLetter(l.hash);
- _.height = u.h, _.width = u.w, _.x = u.u, _.y = u.v;
- var d = l.y + b;
- if (N > 0) {
- if (d > A) {
- var m = d - A;
- _.y += m, _.height -= m, d -= m
- }
- d - u.h * T < C && O === h.CLAMP && (_.height = d < C ? 0 : d - C)
- }
- var v = l.line,
- g = l.x + u.w / 2 * T + y[v];
- if (F > 0 && this._isHorizontalClamped(g, v))
- if (O === h.CLAMP) _.width = 0;
- else if (O === h.SHRINK) {
- if (w.width > u.w) {
- s = !1;
- break
- }
- _.width = 0
- }
- if (_.height > 0 && _.width > 0) {
- var x = this._determineRect(_),
- S = l.x + y[l.line];
- this.appendQuad(f, t, _, x, S - n, d - r, T)
- }
- }
- }
- return this._quadsUpdated(f), s
- }, e.prototype._determineRect = function(t) {
- var e = S.isRotated(),
- i = S._originalSize,
- n = S._rect,
- r = S._offset,
- s = r.x + (i.width - n.width) / 2,
- o = r.y - (i.height - n.height) / 2;
- if (e) {
- var a = t.x;
- t.x = n.x + n.height - t.y - t.height - o, t.y = a + n.y - s, t.y < 0 && (t.height = t.height + o)
- } else t.x += n.x - s, t.y += n.y + o;
- return e
- }, e.prototype._computeAlignmentOffset = function() {
- switch (y.length = 0, B) {
- case l.TextAlignment.LEFT:
- for (var t = 0; t < g; ++t) y.push(0);
- break;
- case l.TextAlignment.CENTER:
- for (var e = 0, i = m.length; e < i; e++) y.push((w.width - m[e]) / 2);
- break;
- case l.TextAlignment.RIGHT:
- for (var n = 0, r = m.length; n < r; n++) y.push(w.width - m[n])
- }
- if (b = w.height, I !== l.VerticalTextAlignment.TOP) {
- var s = w.height - x + (R - D) * T;
- I === l.VerticalTextAlignment.BOTTOM ? b -= s : b -= s / 2
- }
- }, e.prototype._setupBMFontOverflowMetrics = function() {
- var t = w.width,
- e = w.height;
- O === h.RESIZE_HEIGHT && (e = 0), O === h.NONE && (t = 0, e = 0), F = t, N = e, V = t
- }, e.prototype.updateWorldVerts = function() {}, e.prototype.appendQuad = function(t, e, i, n, r, s, o) {}, e.prototype._quadsUpdated = function(t) {}, e.prototype._reserveQuads = function() {}, e
- })(n.default);
- i.default = k, e.exports = i.default
- }), {
- "../../../components/CCLabel": 97,
- "../../../platform/CCMacro": 203,
- "../../../utils/text-utils": 307,
- "../../assembler-2d": 224,
- "../utils": 255
- }],
- 252: [(function(t, e, i) {
- "use strict";
- function n() {
- this._rect = null, this.uv = [], this._texture = null, this._original = null
- }
- n.prototype = {
- constructor: n,
- getRect: function() {
- return cc.rect(this._rect)
- },
- setRect: function(t) {
- this._rect = t, this._texture && this._calculateUV()
- },
- _setDynamicAtlasFrame: function(t) {
- t && (this._original = {
- _texture: this._texture,
- _x: this._rect.x,
- _y: this._rect.y
- }, this._texture = t.texture, this._rect.x = t.x, this._rect.y = t.y, this._calculateUV())
- },
- _resetDynamicAtlasFrame: function() {
- this._original && (this._rect.x = this._original._x, this._rect.y = this._original._y, this._texture = this._original._texture, this._original = null, this._calculateUV())
- },
- _refreshTexture: function(t) {
- this._texture = t, this._rect = cc.rect(0, 0, t.width, t.height), this._calculateUV()
- },
- _calculateUV: function() {
- var t = this._rect,
- e = this._texture,
- i = this.uv,
- n = e.width,
- r = e.height,
- s = 0 === n ? 0 : t.x / n,
- o = 0 === n ? 0 : (t.x + t.width) / n,
- a = 0 === r ? 0 : (t.y + t.height) / r,
- l = 0 === r ? 0 : t.y / r;
- i[0] = s, i[1] = a, i[2] = o, i[3] = a, i[4] = s, i[5] = l, i[6] = o, i[7] = l
- }
- }, e.exports = n
- }), {}],
- 253: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../webgl/assemblers/label/2d/bmfont"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../components/CCLabel"),
- l = t("../../../components/CCLabelOutline"),
- h = t("../../../utils/text-utils"),
- c = t("../../../components/CCComponent"),
- u = t("../../../assets/CCRenderTexture"),
- _ = cc.js.isChildClassOf(l, c),
- f = t("../utils").getFontFamily,
- d = t("../utils").shareLabelInfo,
- p = cc.BitmapFont.FontLetterDefinition,
- m = cc.BitmapFont.FontAtlas,
- y = cc.Color.WHITE,
- v = 2,
- g = (1 / 255).toFixed(3);
- function x(t, e) {
- this._texture = null, this._labelInfo = e, this._char = t, this._hash = null, this._data = null, this._canvas = null, this._context = null, this._width = 0, this._height = 0, this._offsetY = 0, this._hash = t.charCodeAt(0) + e.hash
- }
- function b(t, e) {
- var i = new u;
- i.initWithSize(t, e), i.update(), this._fontDefDictionary = new m(i), this._x = v, this._y = v, this._nexty = v, this._width = t, this._height = e, cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this)
- }
- function A(t) {
- var e = t.color.toHEX("#rrggbb"),
- i = "";
- return t.isOutlined && (i = i + t.margin + t.out.toHEX("#rrggbb")), "" + t.fontSize + t.fontFamily + e + i
- }
- x.prototype = {
- constructor: x,
- updateRenderData: function() {
- this._updateProperties(), this._updateTexture()
- },
- _updateProperties: function() {
- this._texture = new cc.Texture2D, this._data = a._canvasPool.get(), this._canvas = this._data.canvas, this._context = this._data.context, this._context.font = this._labelInfo.fontDesc;
- var t = h.safeMeasureText(this._context, this._char);
- this._width = parseFloat(t.toFixed(2)) + 2 * this._labelInfo.margin, this._height = (1 + h.BASELINE_RATIO) * this._labelInfo.fontSize + 2 * this._labelInfo.margin, this._offsetY = -this._labelInfo.fontSize * h.BASELINE_RATIO / 2, this._canvas.width !== this._width && (this._canvas.width = this._width), this._canvas.height !== this._height && (this._canvas.height = this._height), this._texture.initWithElement(this._canvas)
- },
- _updateTexture: function() {
- var t = this._context,
- e = this._labelInfo,
- i = this._canvas.width,
- n = this._canvas.height,
- r = i / 2,
- s = n / 2 + this._labelInfo.fontSize * h.MIDDLE_RATIO,
- o = e.color;
- if (t.textAlign = "center", t.textBaseline = "alphabetic", t.clearRect(0, 0, i, n), t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", " + g + ")", t.fillRect(0, 0, i, n), t.font = e.fontDesc, t.lineJoin = "round", t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", 1)", e.isOutlined) {
- var a = e.out || y;
- t.strokeStyle = "rgba(" + a.r + ", " + a.g + ", " + a.b + ", " + a.a / 255 + ")", t.lineWidth = 2 * e.margin, t.strokeText(this._char, r, s)
- }
- t.fillText(this._char, r, s), this._texture.handleLoadedTexture()
- },
- destroy: function() {
- this._texture.destroy(), this._texture = null, a._canvasPool.put(this._data)
- }
- }, cc.js.mixin(b.prototype, {
- insertLetterTexture: function(t) {
- var e = t._texture,
- i = e.width,
- n = e.height;
- if (this._x + i + v > this._width && (this._x = v, this._y = this._nexty), this._y + n > this._nexty && (this._nexty = this._y + n + v), this._nexty > this._height) return null;
- this._fontDefDictionary._texture.drawTextureAt(e, this._x, this._y), this._dirty = !0;
- var r = new p;
- return r.u = this._x, r.v = this._y, r.texture = this._fontDefDictionary._texture, r.valid = !0, r.w = t._width, r.h = t._height, r.xAdvance = t._width, r.offsetY = t._offsetY, this._x += i + v, this._fontDefDictionary.addLetterDefinitions(t._hash, r), r
- },
- update: function() {
- this._dirty && (this._fontDefDictionary._texture.update(), this._dirty = !1)
- },
- reset: function() {
- this._x = v, this._y = v, this._nexty = v;
- for (var t = this._fontDefDictionary._letterDefinitions, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n.isValid && n.destroy()
- }
- this._fontDefDictionary.clear()
- },
- destroy: function() {
- this.reset(), this._fontDefDictionary._texture.destroy(), this._fontDefDictionary._texture = null
- },
- beforeSceneLoad: function() {
- this.clearAllCache()
- },
- clearAllCache: function() {
- this.destroy();
- var t = new u;
- t.initWithSize(this._width, this._height), t.update(), this._fontDefDictionary._texture = t
- },
- getLetter: function(t) {
- return this._fontDefDictionary._letterDefinitions[t]
- },
- getTexture: function() {
- return this._fontDefDictionary.getTexture()
- },
- getLetterDefinitionForChar: function(t, e) {
- var i = t.charCodeAt(0) + e.hash,
- n = this._fontDefDictionary._letterDefinitions[i];
- if (!n) {
- var r = new x(t, e);
- r.updateRenderData(), n = this.insertLetterTexture(r), r.destroy()
- }
- return n
- }
- });
- var C = null,
- T = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype._getAssemblerData = function() {
- return C || (C = new b(2048, 2048), cc.Label._shareAtlas = C), C.getTexture()
- }, e.prototype._updateFontFamily = function(t) {
- d.fontAtlas = C, d.fontFamily = f(t);
- var e = _ && t.getComponent(l);
- e && e.enabled ? (d.isOutlined = !0, d.margin = e.width, d.out = e.color.clone(), d.out.a = e.color.a * t.node.color.a / 255) : (d.isOutlined = !1, d.margin = 0)
- }, e.prototype._updateLabelInfo = function(t) {
- d.fontDesc = this._getFontDesc(), d.color = t.node.color, d.hash = A(d)
- }, e.prototype._getFontDesc = function() {
- var t = d.fontSize.toString() + "px ";
- return t += d.fontFamily
- }, e.prototype._computeHorizontalKerningForText = function() {}, e.prototype._determineRect = function(t) {
- return !1
- }, e
- })(n.default);
- i.default = T, e.exports = i.default
- }), {
- "../../../assets/CCRenderTexture": 66,
- "../../../components/CCComponent": 95,
- "../../../components/CCLabel": 97,
- "../../../components/CCLabelOutline": 98,
- "../../../utils/text-utils": 307,
- "../../webgl/assemblers/label/2d/bmfont": 260,
- "../utils": 255
- }],
- 254: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../assembler-2d"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../utils/text-utils"),
- l = t("../../../platform/CCMacro"),
- h = t("../../../components/CCLabel"),
- c = t("../../../components/CCLabelOutline"),
- u = t("../../../components/CCLabelShadow"),
- _ = h.Overflow,
- f = t("../utils").deleteFromDynamicAtlas,
- d = t("../utils").getFontFamily,
- p = (1 / 255).toFixed(3),
- m = null,
- y = null,
- v = null,
- g = "",
- x = "",
- b = 0,
- A = 0,
- C = [],
- T = cc.Size.ZERO,
- S = 0,
- w = 0,
- E = 0,
- M = null,
- D = "",
- B = _.NONE,
- I = !1,
- P = null,
- R = cc.Color.WHITE,
- O = null,
- L = cc.Color.BLACK,
- F = cc.rect(),
- N = cc.Size.ZERO,
- V = cc.Size.ZERO,
- k = !1,
- G = !1,
- U = !1,
- z = 0,
- j = cc.Vec2.ZERO,
- W = 0,
- H = void 0,
- X = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype._getAssemblerData = function() {
- return (H = h._canvasPool.get()).canvas.width = H.canvas.height = 1, H
- }, e.prototype._resetAssemblerData = function(t) {
- t && h._canvasPool.put(t)
- }, e.prototype.updateRenderData = function(e) {
- t.prototype.updateRenderData.call(this, e), e._vertsDirty && (this._updateFontFamily(e), this._updateProperties(e), this._calculateLabelFont(), this._calculateSplitedStrings(), this._updateLabelDimensions(), this._calculateTextBaseline(), this._updateTexture(e), this._calDynamicAtlas(e), e._actualFontSize = b, e.node.setContentSize(V), this.updateVerts(e), e._vertsDirty = !1, m = null, y = null, v = null)
- }, e.prototype.updateVerts = function() {}, e.prototype._updatePaddingRect = function() {
- var t = 0,
- e = 0,
- i = 0,
- n = 0,
- r = 0;
- if (N.width = N.height = 0, P && (t = e = i = n = r = P.width, N.width = N.height = 2 * r), O) {
- var s = O.blur + r;
- i = Math.max(i, -O._offset.x + s), n = Math.max(n, O._offset.x + s), t = Math.max(t, O._offset.y + s), e = Math.max(e, -O._offset.y + s)
- }
- if (G) {
- var o = A * Math.tan(.20943951);
- n += o, N.width += o
- }
- F.x = i, F.y = t, F.width = i + n, F.height = t + e
- }, e.prototype._updateFontFamily = function(t) {
- D = d(t)
- }, e.prototype._updateProperties = function(t) {
- var e = t._assemblerData;
- m = e.context, y = e.canvas, v = t._frame._original ? t._frame._original._texture : t._frame._texture, x = t.string.toString(), b = t._fontSize, z = (A = b) / 8, B = t.overflow, T.width = t.node.width, T.height = t.node.height, V = t.node.getContentSize(), S = t._lineHeight, w = t.horizontalAlign, E = t.verticalAlign, M = t.node.color, k = t._isBold, G = t._isItalic, U = t._isUnderline, I = B !== _.NONE && (B === _.RESIZE_HEIGHT || t.enableWrapText), (P = (P = c && t.getComponent(c)) && P.enabled && P.width > 0 ? P : null) && R.set(P.color), (O = (O = u && t.getComponent(u)) && O.enabled ? O : null) && (L.set(O.color), L.a = L.a * t.node.color.a / 255), this._updatePaddingRect()
- }, e.prototype._calculateFillTextStartPosition = function() {
- var t = 0;
- w === l.TextAlignment.RIGHT ? t = T.width - F.width : w === l.TextAlignment.CENTER && (t = (T.width - F.width) / 2);
- var e = this._getLineHeight() * (C.length - 1),
- i = b * (1 - a.BASELINE_RATIO / 2);
- if (E !== l.VerticalTextAlignment.TOP) {
- var n = e + F.height + b - T.height;
- E === l.VerticalTextAlignment.BOTTOM ? i -= n : i -= n / 2
- }
- return cc.v2(t + F.x, i + F.y)
- }, e.prototype._setupOutline = function() {
- m.strokeStyle = "rgba(" + R.r + ", " + R.g + ", " + R.b + ", " + R.a / 255 + ")", m.lineWidth = 2 * P.width
- }, e.prototype._setupShadow = function() {
- m.shadowColor = "rgba(" + L.r + ", " + L.g + ", " + L.b + ", " + L.a / 255 + ")", m.shadowBlur = O.blur, m.shadowOffsetX = O.offset.x, m.shadowOffsetY = -O.offset.y
- }, e.prototype._drawUnderline = function(t) {
- P && (this._setupOutline(), m.strokeRect(j.x, j.y, t, z)), m.lineWidth = z, m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", " + M.a / 255 + ")", m.fillRect(j.x, j.y, t, z)
- }, e.prototype._updateTexture = function() {
- m.clearRect(0, 0, y.width, y.height);
- var t = P ? R : M;
- m.fillStyle = "rgba(" + t.r + ", " + t.g + ", " + t.b + ", " + p + ")", m.fillRect(0, 0, y.width, y.height), m.font = g;
- var e = this._calculateFillTextStartPosition(),
- i = this._getLineHeight();
- m.lineJoin = "round", m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", 1)";
- var n = C.length > 1,
- r = this._measureText(m),
- s = 0,
- o = 0;
- O && this._setupShadow(), P && P.width > 0 && this._setupOutline();
- for (var a = 0; a < C.length; ++a) s = e.x, o = e.y + a * i, O && n && (P && P.width > 0 && m.strokeText(C[a], s, o), m.fillText(C[a], s, o)), U && (W = r(C[a]), w === l.TextAlignment.RIGHT ? j.x = e.x - W : w === l.TextAlignment.CENTER ? j.x = e.x - W / 2 : j.x = e.x, j.y = o, this._drawUnderline(W));
- O && n && (m.shadowColor = "transparent");
- for (var h = 0; h < C.length; ++h) s = e.x, o = e.y + h * i, P && P.width > 0 && m.strokeText(C[h], s, o), m.fillText(C[h], s, o);
- O && (m.shadowColor = "transparent"), v.handleLoadedTexture()
- }, e.prototype._calDynamicAtlas = function(t) {
- if (t.cacheMode === h.CacheMode.BITMAP) {
- var e = t._frame;
- f(t, e), e._original || e.setRect(cc.rect(0, 0, y.width, y.height)), this.packToDynamicAtlas(t, e)
- }
- }, e.prototype._updateLabelDimensions = function() {
- var t = x.split("\n");
- if (B === _.RESIZE_HEIGHT) {
- var e = (C.length + a.BASELINE_RATIO) * this._getLineHeight();
- T.height = e + F.height, V.height = e + N.height
- } else if (B === _.NONE) {
- C = t;
- for (var i = 0, n = 0, r = 0; r < t.length; ++r) {
- var s = a.safeMeasureText(m, t[r]);
- i = i > s ? i : s
- }
- n = (C.length + a.BASELINE_RATIO) * this._getLineHeight();
- var o = parseFloat(i.toFixed(2)),
- l = parseFloat(n.toFixed(2));
- T.width = o + F.width, T.height = l + F.height, V.width = o + N.width, V.height = l + N.height
- }
- T.width = Math.min(T.width, 2048), T.height = Math.min(T.height, 2048), y.width !== T.width && (y.width = T.width), y.height !== T.height && (y.height = T.height)
- }, e.prototype._calculateTextBaseline = function() {
- var t = void 0;
- t = w === l.TextAlignment.RIGHT ? "right" : w === l.TextAlignment.CENTER ? "center" : "left", m.textAlign = t, m.textBaseline = "alphabetic"
- }, e.prototype._calculateSplitedStrings = function() {
- var t = x.split("\n");
- if (I) {
- C = [];
- for (var e = V.width, i = 0; i < t.length; ++i) {
- var n = a.safeMeasureText(m, t[i]),
- r = a.fragmentText(t[i], n, e, this._measureText(m));
- C = C.concat(r)
- }
- } else C = t
- }, e.prototype._getFontDesc = function() {
- var t = b.toString() + "px ";
- return t += D, k && (t = "bold " + t), G && (t = "italic " + t), t
- }, e.prototype._getLineHeight = function() {
- var t = S;
- return 0 | (t = 0 === t ? b : t * b / A)
- }, e.prototype._calculateParagraphLength = function(t, e) {
- for (var i = [], n = 0; n < t.length; ++n) {
- var r = a.safeMeasureText(e, t[n]);
- i.push(r)
- }
- return i
- }, e.prototype._measureText = function(t) {
- return function(e) {
- return a.safeMeasureText(t, e)
- }
- }, e.prototype._calculateLabelFont = function() {
- if (g = this._getFontDesc(), m.font = g, B === _.SHRINK) {
- var t = x.split("\n"),
- e = this._calculateParagraphLength(t, m),
- i = 0,
- n = 0,
- r = 0;
- if (I) {
- var s = V.width,
- o = V.height;
- if (s < 0 || o < 0) return g = this._getFontDesc(), void(m.font = g);
- n = o + 1, r = s + 1;
- for (var l = b + 1, h = "", c = !0, u = 0 | l; n > o || r > s;) {
- if (c ? l = u / 2 | 0 : u = l = u - 1, l <= 0) {
- cc.logID(4003);
- break
- }
- for (b = l, g = this._getFontDesc(), m.font = g, n = 0, i = 0; i < t.length; ++i) {
- var f = 0,
- d = a.safeMeasureText(m, t[i]);
- for (h = a.fragmentText(t[i], d, s, this._measureText(m)); f < h.length;) r = a.safeMeasureText(m, h[f]), n += this._getLineHeight(), ++f
- }
- c && (n > o ? u = 0 | l : (c = !1, n = o + 1))
- }
- } else {
- for (n = t.length * this._getLineHeight(), i = 0; i < t.length; ++i) r < e[i] && (r = e[i]);
- var p = (T.width - F.width) / r,
- y = T.height / n;
- b = A * Math.min(1, p, y) | 0, g = this._getFontDesc(), m.font = g
- }
- }
- }, e
- })(n.default);
- i.default = X, e.exports = i.default
- }), {
- "../../../components/CCLabel": 97,
- "../../../components/CCLabelOutline": 98,
- "../../../components/CCLabelShadow": 99,
- "../../../platform/CCMacro": 203,
- "../../../utils/text-utils": 307,
- "../../assembler-2d": 224,
- "../utils": 255
- }],
- 255: [(function(t, e, i) {
- "use strict";
- var n = t("./dynamic-atlas/manager"),
- r = cc.Color.WHITE,
- s = {
- fontAtlas: null,
- fontSize: 0,
- lineHeight: 0,
- hAlign: 0,
- vAlign: 0,
- hash: "",
- fontFamily: "",
- fontDesc: "Arial",
- color: r,
- isOutlined: !1,
- out: r,
- margin: 0
- };
- e.exports = {
- deleteFromDynamicAtlas: function(t, e) {
- e && e._original && n && (n.deleteAtlasTexture(e), e._resetDynamicAtlasFrame())
- },
- getFontFamily: function(t) {
- return t.useSystemFont ? t.fontFamily || "Arial" : t.font ? t.font._nativeAsset ? t.font._nativeAsset : (cc.loader.load(t.font.nativeUrl, (function(e, i) {
- t.font._nativeAsset = i, t._lazyUpdateRenderData()
- })), "Arial") : "Arial"
- },
- shareLabelInfo: s
- }
- }), {
- "./dynamic-atlas/manager": 250
- }],
- 256: [(function(t, e, i) {
- "use strict";
- function n(t, e, i) {
- i = i || 2;
- var n, s, a, l, h, c, _, f = e && e.length,
- d = f ? e[0] * i : t.length,
- p = r(t, 0, d, i, !0),
- m = [];
- if (!p) return m;
- if (f && (p = u(t, e, p, i)), t.length > 80 * i) {
- n = a = t[0], s = l = t[1];
- for (var y = i; y < d; y += i) h = t[y], c = t[y + 1], h < n && (n = h), c < s && (s = c), h > a && (a = h), c > l && (l = c);
- _ = Math.max(a - n, l - s)
- }
- return o(p, m, i, n, s, _), m
- }
- function r(t, e, i, n, r) {
- var s, o;
- if (r === I(t, e, i, n) > 0)
- for (s = e; s < i; s += n) o = M(s, t[s], t[s + 1], o);
- else
- for (s = i - n; s >= e; s -= n) o = M(s, t[s], t[s + 1], o);
- return o && A(o, o.next) && (D(o), o = o.next), o
- }
- function s(t, e) {
- if (!t) return t;
- e || (e = t);
- var i, n = t;
- do {
- if (i = !1, n.steiner || !A(n, n.next) && 0 !== b(n.prev, n, n.next)) n = n.next;
- else {
- if (D(n), (n = e = n.prev) === n.next) return null;
- i = !0
- }
- } while (i || n !== e);
- return e
- }
- function o(t, e, i, n, r, u, _) {
- if (t) {
- !_ && u && p(t, n, r, u);
- for (var f, d, m = t; t.prev !== t.next;)
- if (f = t.prev, d = t.next, u ? l(t, n, r, u) : a(t)) e.push(f.i / i), e.push(t.i / i), e.push(d.i / i), D(t), t = d.next, m = d.next;
- else if ((t = d) === m) {
- _ ? 1 === _ ? o(t = h(t, e, i), e, i, n, r, u, 2) : 2 === _ && c(t, e, i, n, r, u) : o(s(t), e, i, n, r, u, 1);
- break
- }
- }
- }
- function a(t) {
- var e = t.prev,
- i = t,
- n = t.next;
- if (b(e, i, n) >= 0) return !1;
- for (var r = t.next.next; r !== t.prev;) {
- if (g(e.x, e.y, i.x, i.y, n.x, n.y, r.x, r.y) && b(r.prev, r, r.next) >= 0) return !1;
- r = r.next
- }
- return !0
- }
- function l(t, e, i, n) {
- var r = t.prev,
- s = t,
- o = t.next;
- if (b(r, s, o) >= 0) return !1;
- for (var a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, l = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, h = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, c = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, u = y(a, l, e, i, n), _ = y(h, c, e, i, n), f = t.nextZ; f && f.z <= _;) {
- if (f !== t.prev && f !== t.next && g(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
- f = f.nextZ
- }
- for (f = t.prevZ; f && f.z >= u;) {
- if (f !== t.prev && f !== t.next && g(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
- f = f.prevZ
- }
- return !0
- }
- function h(t, e, i) {
- var n = t;
- do {
- var r = n.prev,
- s = n.next.next;
- !A(r, s) && C(r, n, n.next, s) && S(r, s) && S(s, r) && (e.push(r.i / i), e.push(n.i / i), e.push(s.i / i), D(n), D(n.next), n = t = s), n = n.next
- } while (n !== t);
- return n
- }
- function c(t, e, i, n, r, a) {
- var l = t;
- do {
- for (var h = l.next.next; h !== l.prev;) {
- if (l.i !== h.i && x(l, h)) {
- var c = E(l, h);
- return l = s(l, l.next), c = s(c, c.next), o(l, e, i, n, r, a), void o(c, e, i, n, r, a)
- }
- h = h.next
- }
- l = l.next
- } while (l !== t)
- }
- function u(t, e, i, n) {
- var o, a, l, h = [];
- for (o = 0, a = e.length; o < a; o++)(l = r(t, e[o] * n, o < a - 1 ? e[o + 1] * n : t.length, n, !1)) === l.next && (l.steiner = !0), h.push(v(l));
- for (h.sort(_), o = 0; o < h.length; o++) f(h[o], i), i = s(i, i.next);
- return i
- }
- function _(t, e) {
- return t.x - e.x
- }
- function f(t, e) {
- if (e = d(t, e)) {
- var i = E(e, t);
- s(i, i.next)
- }
- }
- function d(t, e) {
- var i, n = e,
- r = t.x,
- s = t.y,
- o = -1 / 0;
- do {
- if (s <= n.y && s >= n.next.y) {
- var a = n.x + (s - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
- if (a <= r && a > o) {
- if (o = a, a === r) {
- if (s === n.y) return n;
- if (s === n.next.y) return n.next
- }
- i = n.x < n.next.x ? n : n.next
- }
- }
- n = n.next
- } while (n !== e);
- if (!i) return null;
- if (r === o) return i.prev;
- var l, h = i,
- c = i.x,
- u = i.y,
- _ = 1 / 0;
- for (n = i.next; n !== h;) r >= n.x && n.x >= c && g(s < u ? r : o, s, c, u, s < u ? o : r, s, n.x, n.y) && ((l = Math.abs(s - n.y) / (r - n.x)) < _ || l === _ && n.x > i.x) && S(n, t) && (i = n, _ = l), n = n.next;
- return i
- }
- function p(t, e, i, n) {
- var r = t;
- do {
- null === r.z && (r.z = y(r.x, r.y, e, i, n)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next
- } while (r !== t);
- r.prevZ.nextZ = null, r.prevZ = null, m(r)
- }
- function m(t) {
- var e, i, n, r, s, o, a, l, h = 1;
- do {
- for (i = t, t = null, s = null, o = 0; i;) {
- for (o++, n = i, a = 0, e = 0; e < h && (a++, n = n.nextZ); e++);
- for (l = h; a > 0 || l > 0 && n;) 0 === a ? (r = n, n = n.nextZ, l--) : 0 !== l && n ? i.z <= n.z ? (r = i, i = i.nextZ, a--) : (r = n, n = n.nextZ, l--) : (r = i, i = i.nextZ, a--), s ? s.nextZ = r : t = r, r.prevZ = s, s = r;
- i = n
- }
- s.nextZ = null, h *= 2
- } while (o > 1);
- return t
- }
- function y(t, e, i, n, r) {
- return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) / r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) / r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1
- }
- function v(t) {
- var e = t,
- i = t;
- do {
- e.x < i.x && (i = e), e = e.next
- } while (e !== t);
- return i
- }
- function g(t, e, i, n, r, s, o, a) {
- return (r - o) * (e - a) - (t - o) * (s - a) >= 0 && (t - o) * (n - a) - (i - o) * (e - a) >= 0 && (i - o) * (s - a) - (r - o) * (n - a) >= 0
- }
- function x(t, e) {
- return t.next.i !== e.i && t.prev.i !== e.i && !T(t, e) && S(t, e) && S(e, t) && w(t, e)
- }
- function b(t, e, i) {
- return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y)
- }
- function A(t, e) {
- return t.x === e.x && t.y === e.y
- }
- function C(t, e, i, n) {
- return !!(A(t, e) && A(i, n) || A(t, n) && A(i, e)) || b(t, e, i) > 0 != b(t, e, n) > 0 && b(i, n, t) > 0 != b(i, n, e) > 0
- }
- function T(t, e) {
- var i = t;
- do {
- if (i.i !== t.i && i.next.i !== t.i && i.i !== e.i && i.next.i !== e.i && C(i, i.next, t, e)) return !0;
- i = i.next
- } while (i !== t);
- return !1
- }
- function S(t, e) {
- return b(t.prev, t, t.next) < 0 ? b(t, e, t.next) >= 0 && b(t, t.prev, e) >= 0 : b(t, e, t.prev) < 0 || b(t, t.next, e) < 0
- }
- function w(t, e) {
- var i = t,
- n = !1,
- r = (t.x + e.x) / 2,
- s = (t.y + e.y) / 2;
- do {
- i.y > s != i.next.y > s && r < (i.next.x - i.x) * (s - i.y) / (i.next.y - i.y) + i.x && (n = !n), i = i.next
- } while (i !== t);
- return n
- }
- function E(t, e) {
- var i = new B(t.i, t.x, t.y),
- n = new B(e.i, e.x, e.y),
- r = t.next,
- s = e.prev;
- return t.next = e, e.prev = t, i.next = r, r.prev = i, n.next = i, i.prev = n, s.next = n, n.prev = s, n
- }
- function M(t, e, i, n) {
- var r = new B(t, e, i);
- return n ? (r.next = n.next, r.prev = n, n.next.prev = r, n.next = r) : (r.prev = r, r.next = r), r
- }
- function D(t) {
- t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ)
- }
- function B(t, e, i) {
- this.i = t, this.x = e, this.y = i, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1
- }
- function I(t, e, i, n) {
- for (var r = 0, s = e, o = i - n; s < i; s += n) r += (t[o] - t[s]) * (t[s + 1] + t[o + 1]), o = s;
- return r
- }
- cc.Graphics.earcut = e.exports = n, n.deviation = function(t, e, i, n) {
- var r = e && e.length,
- s = r ? e[0] * i : t.length,
- o = Math.abs(I(t, 0, s, i));
- if (r)
- for (var a = 0, l = e.length; a < l; a++) {
- var h = e[a] * i,
- c = a < l - 1 ? e[a + 1] * i : t.length;
- o -= Math.abs(I(t, h, c, i))
- }
- var u = 0;
- for (a = 0; a < n.length; a += 3) {
- var _ = n[a] * i,
- f = n[a + 1] * i,
- d = n[a + 2] * i;
- u += Math.abs((t[_] - t[d]) * (t[f + 1] - t[_ + 1]) - (t[_] - t[f]) * (t[d + 1] - t[_ + 1]))
- }
- return 0 === o && 0 === u ? 0 : Math.abs((u - o) / o)
- }, n.flatten = function(t) {
- for (var e = t[0][0].length, i = {
- vertices: [],
- holes: [],
- dimensions: e
- }, n = 0, r = 0; r < t.length; r++) {
- for (var s = 0; s < t[r].length; s++)
- for (var o = 0; o < e; o++) i.vertices.push(t[r][s][o]);
- r > 0 && (n += t[r - 1].length, i.holes.push(n))
- }
- return i
- }
- }), {}],
- 257: [(function(t, e, i) {
- "use strict";
- var n = t("../../../../graphics/helper"),
- r = t("../../../../graphics/types").PointFlags,
- s = cc.Graphics.Point = cc.Class({
- name: "cc.GraphicsPoint",
- extends: cc.Vec2,
- ctor: function(t, e) {
- this.reset()
- },
- reset: function() {
- this.dx = 0, this.dy = 0, this.dmx = 0, this.dmy = 0, this.flags = 0, this.len = 0
- }
- });
- function o() {
- this.reset()
- }
- function a(t) {
- this._tessTol = .25, this._distTol = .01, this._updatePathOffset = !1, this._paths = null, this._pathLength = 0, this._pathOffset = 0, this._points = null, this._pointsOffset = 0, this._commandx = 0, this._commandy = 0, this._paths = [], this._points = []
- }
- cc.js.mixin(o.prototype, {
- reset: function() {
- this.closed = !1, this.nbevel = 0, this.complex = !0, this.points ? this.points.length = 0 : this.points = []
- }
- }), cc.js.mixin(a.prototype, {
- moveTo: function(t, e) {
- this._updatePathOffset && (this._pathOffset = this._pathLength, this._updatePathOffset = !1), this._addPath(), this._addPoint(t, e, r.PT_CORNER), this._commandx = t, this._commandy = e
- },
- lineTo: function(t, e) {
- this._addPoint(t, e, r.PT_CORNER), this._commandx = t, this._commandy = e
- },
- bezierCurveTo: function(t, e, i, s, o, a) {
- var l = this._curPath,
- h = l.points[l.points.length - 1];
- h.x !== t || h.y !== e || i !== o || s !== a ? (n.tesselateBezier(this, h.x, h.y, t, e, i, s, o, a, 0, r.PT_CORNER), this._commandx = o, this._commandy = a) : this.lineTo(o, a)
- },
- quadraticCurveTo: function(t, e, i, n) {
- var r = this._commandx,
- s = this._commandy;
- this.bezierCurveTo(r + 2 / 3 * (t - r), s + 2 / 3 * (e - s), i + 2 / 3 * (t - i), n + 2 / 3 * (e - n), i, n)
- },
- arc: function(t, e, i, r, s, o) {
- n.arc(this, t, e, i, r, s, o)
- },
- ellipse: function(t, e, i, r) {
- n.ellipse(this, t, e, i, r), this._curPath.complex = !1
- },
- circle: function(t, e, i) {
- n.ellipse(this, t, e, i, i), this._curPath.complex = !1
- },
- rect: function(t, e, i, n) {
- this.moveTo(t, e), this.lineTo(t, e + n), this.lineTo(t + i, e + n), this.lineTo(t + i, e), this.close(), this._curPath.complex = !1
- },
- roundRect: function(t, e, i, r, s) {
- n.roundRect(this, t, e, i, r, s), this._curPath.complex = !1
- },
- clear: function(t) {
- this._pathLength = 0, this._pathOffset = 0, this._pointsOffset = 0, this._curPath = null, t && (this._paths.length = 0, this._points.length = 0)
- },
- close: function() {
- this._curPath.closed = !0
- },
- _addPath: function() {
- var t = this._pathLength,
- e = this._paths[t];
- return e ? e.reset() : (e = new o, this._paths.push(e)), this._pathLength++, this._curPath = e, e
- },
- _addPoint: function(t, e, i) {
- var n = this._curPath;
- if (n) {
- var r, o = this._points,
- a = n.points;
- (r = o[this._pointsOffset++]) ? (r.x = t, r.y = e) : (r = new s(t, e), o.push(r)), r.flags = i, a.push(r)
- }
- }
- }), cc.Graphics._Impl = a, e.exports = a
- }), {
- "../../../../graphics/helper": 141,
- "../../../../graphics/types": 143
- }],
- 258: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = s(t("../../../assembler")),
- r = s(t("../../../../../renderer/core/input-assembler"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = t("../../mesh-buffer"),
- c = t("../../vertex-format").vfmtPosColor,
- u = t("../../../index"),
- _ = t("../../../../graphics/graphics"),
- f = t("../../../../graphics/types").PointFlags,
- d = _.LineJoin,
- p = _.LineCap,
- m = t("./earcut"),
- y = (t("./impl"), Math.PI),
- v = Math.min,
- g = Math.max,
- x = Math.ceil,
- b = Math.acos,
- A = Math.cos,
- C = Math.sin,
- T = Math.atan2;
- function S(t, e, i) {
- var n = 2 * b(t / (t + i));
- return g(2, x(e / n))
- }
- function w(t, e, i) {
- return t < e ? e : t > i ? i : t
- }
- var E = (function(t) {
- function e(i) {
- o(this, e);
- var n = a(this, t.call(this, i));
- return n._buffer = null, n._buffers = [], n._bufferOffset = 0, n
- }
- return l(e, t), e.prototype.getVfmt = function() {
- return c
- }, e.prototype.requestBuffer = function() {
- var t = {
- indiceStart: 0,
- vertexStart: 0
- },
- e = new h(u._handle, c);
- t.meshbuffer = e;
- var i = new r.default(e._vb, e._ib);
- return t.ia = i, this._buffers.push(t), t
- }, e.prototype.getBuffers = function() {
- return 0 === this._buffers.length && this.requestBuffer(), this._buffers
- }, e.prototype.clear = function(t) {
- this._bufferOffset = 0;
- var e = this._buffers;
- if (t) {
- for (var i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- r.meshbuffer.destroy(), r.meshbuffer = null
- }
- e.length = 0
- } else
- for (var s = 0, o = e.length; s < o; s++) {
- var a = e[s];
- a.indiceStart = 0, a.vertexStart = 0, a.meshbuffer.reset()
- }
- }, e.prototype.fillBuffers = function(t, e) {
- e._flush(), e.node = t.node, e.material = t.sharedMaterials[0];
- for (var i = this.getBuffers(), n = 0, r = i.length; n < r; n++) {
- var s = i[n],
- o = s.meshbuffer;
- s.ia._count = s.indiceStart, e._flushIA(s.ia), o.uploadData()
- }
- }, e.prototype.genBuffer = function(t, e) {
- var i = this.getBuffers(),
- n = i[this._bufferOffset],
- r = n.meshbuffer,
- s = n.vertexStart + e;
- return (s > 65535 || 3 * s > 131070) && (++this._bufferOffset, s = e, this._bufferOffset < i.length ? n = i[this._bufferOffset] : (n = this.requestBuffer(t), i[this._bufferOffset] = n), r = n.meshbuffer), s > r.vertexOffset && r.requestStatic(e, 3 * e), this._buffer = n, n
- }, e.prototype.stroke = function(t) {
- this._curColor = t._strokeColor._val, this._flattenPaths(t._impl), this._expandStroke(t), t._impl._updatePathOffset = !0
- }, e.prototype.fill = function(t) {
- this._curColor = t._fillColor._val, this._expandFill(t), t._impl._updatePathOffset = !0
- }, e.prototype._expandStroke = function(t) {
- var e = .5 * t.lineWidth,
- i = t.lineCap,
- n = t.lineJoin,
- r = t.miterLimit,
- s = t._impl,
- o = S(e, y, s._tessTol);
- this._calculateJoins(s, e, n, r);
- for (var a = s._paths, l = 0, h = s._pathOffset, c = s._pathLength; h < c; h++) {
- var u = a[h],
- _ = u.points.length;
- n === d.ROUND ? l += 2 * (_ + u.nbevel * (o + 2) + 1) : l += 2 * (_ + 5 * u.nbevel + 1), u.closed || (i === p.ROUND ? l += 2 * (2 * o + 2) : l += 12)
- }
- for (var m = this.genBuffer(t, l), v = m.meshbuffer, g = v._vData, x = v._iData, b = s._pathOffset, A = s._pathLength; b < A; b++) {
- var C, T = a[b],
- w = T.points,
- E = w.length,
- M = m.vertexStart,
- D = void 0,
- B = void 0,
- I = void 0,
- P = void 0;
- if ((C = T.closed) ? (D = w[E - 1], B = w[0], I = 0, P = E) : (D = w[0], B = w[1], I = 1, P = E - 1), !C) {
- var R = B.sub(D);
- R.normalizeSelf();
- var O = R.x,
- L = R.y;
- i === p.BUTT ? this._buttCapStart(D, O, L, e, 0) : i === p.SQUARE ? this._buttCapStart(D, O, L, e, e) : i === p.ROUND && this._roundCapStart(D, O, L, e, o)
- }
- for (var F = I; F < P; ++F) n === d.ROUND ? this._roundJoin(D, B, e, e, o) : 0 != (B.flags & (f.PT_BEVEL | f.PT_INNERBEVEL)) ? this._bevelJoin(D, B, e, e) : (this._vset(B.x + B.dmx * e, B.y + B.dmy * e), this._vset(B.x - B.dmx * e, B.y - B.dmy * e)), D = B, B = w[F + 1];
- if (C) {
- var N = 3 * M;
- this._vset(g[N], g[N + 1]), this._vset(g[N + 3], g[N + 4])
- } else {
- var V = B.sub(D);
- V.normalizeSelf();
- var k = V.x,
- G = V.y;
- i === p.BUTT ? this._buttCapEnd(B, k, G, e, 0) : i === p.SQUARE ? this._buttCapEnd(B, k, G, e, e) : i === p.ROUND && this._roundCapEnd(B, k, G, e, o)
- }
- for (var U = m.indiceStart, z = M + 2, j = m.vertexStart; z < j; z++) x[U++] = z - 2, x[U++] = z - 1, x[U++] = z;
- m.indiceStart = U
- }
- }, e.prototype._expandFill = function(t) {
- for (var e = t._impl, i = e._paths, n = 0, r = e._pathOffset, s = e._pathLength; r < s; r++) {
- n += i[r].points.length
- }
- for (var o = this.genBuffer(t, n), a = o.meshbuffer, l = a._vData, h = a._iData, c = e._pathOffset, u = e._pathLength; c < u; c++) {
- var _ = i[c],
- f = _.points,
- d = f.length;
- if (0 !== d) {
- for (var p = o.vertexStart, y = 0; y < d; ++y) this._vset(f[y].x, f[y].y);
- var v = o.indiceStart;
- if (_.complex) {
- for (var g = [], x = p, b = o.vertexStart; x < b; x++) {
- var A = 3 * x;
- g.push(l[A]), g.push(l[A + 1])
- }
- var C = m(g, null, 2);
- if (!C || 0 === C.length) continue;
- for (var T = 0, S = C.length; T < S; T++) h[v++] = C[T] + p
- } else
- for (var w = p, E = p + 2, M = o.vertexStart; E < M; E++) h[v++] = w, h[v++] = E - 1, h[v++] = E;
- o.indiceStart = v
- }
- }
- }, e.prototype._calculateJoins = function(t, e, i, n) {
- var r = 0;
- e > 0 && (r = 1 / e);
- for (var s = t._paths, o = t._pathOffset, a = t._pathLength; o < a; o++) {
- var l = s[o],
- h = l.points,
- c = h.length,
- u = h[c - 1],
- _ = h[0];
- l.nbevel = 0;
- for (var p = 0; p < c; p++) {
- var m, y, x = u.dy,
- b = -u.dx,
- A = _.dy,
- C = -_.dx;
- if (_.dmx = .5 * (x + A), _.dmy = .5 * (b + C), (m = _.dmx * _.dmx + _.dmy * _.dmy) > 1e-6) {
- var T = 1 / m;
- T > 600 && (T = 600), _.dmx *= T, _.dmy *= T
- }
- _.dx * u.dy - u.dx * _.dy > 0 && (0, _.flags |= f.PT_LEFT), m * (y = g(11, v(u.len, _.len) * r)) * y < 1 && (_.flags |= f.PT_INNERBEVEL), _.flags & f.PT_CORNER && (m * n * n < 1 || i === d.BEVEL || i === d.ROUND) && (_.flags |= f.PT_BEVEL), 0 != (_.flags & (f.PT_BEVEL | f.PT_INNERBEVEL)) && l.nbevel++, u = _, _ = h[p + 1]
- }
- }
- }, e.prototype._flattenPaths = function(t) {
- for (var e = t._paths, i = t._pathOffset, n = t._pathLength; i < n; i++) {
- var r = e[i],
- s = r.points,
- o = s[s.length - 1],
- a = s[0];
- o.equals(a) && (r.closed = !0, s.pop(), o = s[s.length - 1]);
- for (var l = 0, h = s.length; l < h; l++) {
- var c = a.sub(o);
- o.len = c.mag(), (c.x || c.y) && c.normalizeSelf(), o.dx = c.x, o.dy = c.y, o = a, a = s[l + 1]
- }
- }
- }, e.prototype._chooseBevel = function(t, e, i, n) {
- var r = i.x,
- s = i.y,
- o = void 0,
- a = void 0,
- l = void 0,
- h = void 0;
- return 0 !== t ? (o = r + e.dy * n, a = s - e.dx * n, l = r + i.dy * n, h = s - i.dx * n) : (o = l = r + i.dmx * n, a = h = s + i.dmy * n), [o, a, l, h]
- }, e.prototype._buttCapStart = function(t, e, i, n, r) {
- var s = t.x - e * r,
- o = t.y - i * r,
- a = i,
- l = -e;
- this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
- }, e.prototype._buttCapEnd = function(t, e, i, n, r) {
- var s = t.x + e * r,
- o = t.y + i * r,
- a = i,
- l = -e;
- this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
- }, e.prototype._roundCapStart = function(t, e, i, n, r) {
- for (var s = t.x, o = t.y, a = i, l = -e, h = 0; h < r; h++) {
- var c = h / (r - 1) * y,
- u = A(c) * n,
- _ = C(c) * n;
- this._vset(s - a * u - e * _, o - l * u - i * _), this._vset(s, o)
- }
- this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
- }, e.prototype._roundCapEnd = function(t, e, i, n, r) {
- var s = t.x,
- o = t.y,
- a = i,
- l = -e;
- this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n);
- for (var h = 0; h < r; h++) {
- var c = h / (r - 1) * y,
- u = A(c) * n,
- _ = C(c) * n;
- this._vset(s, o), this._vset(s - a * u + e * _, o - l * u + i * _)
- }
- }, e.prototype._roundJoin = function(t, e, i, n, r) {
- var s = t.dy,
- o = -t.dx,
- a = e.dy,
- l = -e.dx,
- h = e.x,
- c = e.y;
- if (0 != (e.flags & f.PT_LEFT)) {
- var u = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, i),
- _ = u[0],
- d = u[1],
- p = u[2],
- m = u[3],
- v = T(-o, -s),
- g = T(-l, -a);
- g > v && (g -= 2 * y), this._vset(_, d), this._vset(h - s * n, e.y - o * n);
- for (var b = w(x((v - g) / y) * r, 2, r), S = 0; S < b; S++) {
- var E = v + S / (b - 1) * (g - v),
- M = h + A(E) * n,
- D = c + C(E) * n;
- this._vset(h, c), this._vset(M, D)
- }
- this._vset(p, m), this._vset(h - a * n, c - l * n)
- } else {
- var B = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, -n),
- I = B[0],
- P = B[1],
- R = B[2],
- O = B[3],
- L = T(o, s),
- F = T(l, a);
- F < L && (F += 2 * y), this._vset(h + s * n, c + o * n), this._vset(I, P);
- for (var N = w(x((F - L) / y) * r, 2, r), V = 0; V < N; V++) {
- var k = L + V / (N - 1) * (F - L),
- G = h + A(k) * i,
- U = c + C(k) * i;
- this._vset(G, U), this._vset(h, c)
- }
- this._vset(h + a * n, c + l * n), this._vset(R, O)
- }
- }, e.prototype._bevelJoin = function(t, e, i, n) {
- var r = void 0,
- s = void 0,
- o = void 0,
- a = void 0,
- l = void 0,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = t.dy,
- d = -t.dx,
- p = e.dy,
- m = -e.dx;
- if (e.flags & f.PT_LEFT) {
- var y = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, i);
- l = y[0], h = y[1], c = y[2], u = y[3], this._vset(l, h), this._vset(e.x - _ * n, e.y - d * n), this._vset(c, u), this._vset(e.x - p * n, e.y - m * n)
- } else {
- var v = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, -n);
- r = v[0], s = v[1], o = v[2], a = v[3], this._vset(e.x + _ * i, e.y + d * i), this._vset(r, s), this._vset(e.x + p * i, e.y + m * i), this._vset(o, a)
- }
- }, e.prototype._vset = function(t, e) {
- var i = this._buffer,
- n = i.meshbuffer,
- r = 3 * i.vertexStart,
- s = n._vData,
- o = n._uintVData;
- s[r] = t, s[r + 1] = e, o[r + 2] = this._curColor, i.vertexStart++, n._dirty = !0
- }, e
- })(n.default);
- i.default = E, n.default.register(cc.Graphics, E), e.exports = i.default
- }), {
- "../../../../../renderer/core/input-assembler": 350,
- "../../../../graphics/graphics": 140,
- "../../../../graphics/types": 143,
- "../../../assembler": 227,
- "../../../index": 247,
- "../../mesh-buffer": 283,
- "../../vertex-format": 288,
- "./earcut": 256,
- "./impl": 257
- }],
- 259: [(function(t, e, i) {
- "use strict";
- cc.assemblers = {}, t("./sprite"), t("./mask-assembler"), t("./graphics"), t("./label"), t("./motion-streak")
- }), {
- "./graphics": 258,
- "./label": 266,
- "./mask-assembler": 267,
- "./motion-streak": 268,
- "./sprite": 281
- }],
- 260: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0, i.default = void 0;
- var o = 0,
- a = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.initData = function() {
- this._renderData.createFlexData(0, 4, 6, this.getVfmt())
- }, e.prototype._reserveQuads = function(t, e) {
- var i = 4 * e,
- n = 6 * e,
- r = this._renderData._flexBuffer;
- r.reserve(i, n), r.used(i, n);
- for (var s = this._renderData.iDatas[0], a = 0, l = 0, h = n; a < h; a += 6, l += 4) s[a] = l, s[a + 1] = l + 1, s[a + 2] = l + 2, s[a + 3] = l + 1, s[a + 4] = l + 3, s[a + 5] = l + 2;
- o = 0
- }, e.prototype._quadsUpdated = function(t) {
- o = 0, this._renderData._flexBuffer.used(this.verticesCount, this.indicesCount)
- }, e.prototype._getColor = function(t) {
- return t.node._color._val
- }, e.prototype.appendQuad = function(t, e, i, n, r, s, a) {
- var l = this._renderData,
- h = l.vDatas[0],
- c = l.uintVDatas[0];
- this.verticesCount += 4, this.indicesCount = this.verticesCount / 2 * 3;
- var u = e.width,
- _ = e.height,
- f = i.width,
- d = i.height,
- p = this._getColor(t),
- m = void 0,
- y = void 0,
- v = void 0,
- g = void 0,
- x = this.floatsPerVert,
- b = o + this.uvOffset;
- n ? (m = i.x / u, v = (i.x + d) / u, y = (i.y + f) / _, g = i.y / _, h[b] = m, h[b + 1] = g, h[b += x] = m, h[b + 1] = y, h[b += x] = v, h[b + 1] = g, h[b += x] = v, h[b + 1] = y) : (m = i.x / u, v = (i.x + f) / u, y = (i.y + d) / _, g = i.y / _, h[b] = m, h[b + 1] = y, h[b += x] = v, h[b + 1] = y, h[b += x] = m, h[b + 1] = g, h[b += x] = v, h[b + 1] = g), m = r, v = r + f * a, y = s - d * a, g = s, this.appendVerts(t, o, m, v, y, g);
- for (var A = o + this.colorOffset, C = 0; C < 4; C++) c[A] = p, A += x;
- o += 4 * this.floatsPerVert
- }, e.prototype.appendVerts = function(t, e, i, n, r, s) {
- var o = this._local,
- a = this.floatsPerVert;
- o[e] = i, o[e + 1] = r, o[e += a] = n, o[e + 1] = r, o[e += a] = i, o[e + 1] = s, o[e += a] = n, o[e + 1] = s
- }, e.prototype.updateWorldVerts = function(t) {
- for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) {
- var _ = l[u],
- f = l[u + 1];
- h[u] = _ * i + f * r + o, h[u + 1] = _ * n + f * s + a
- }
- }, e
- })(function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }(t("../../../../utils/label/bmfont")).default);
- i.default = a, e.exports = i.default
- }), {
- "../../../../utils/label/bmfont": 251
- }],
- 261: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- t("../../../../../platform/js"), t("./bmfont");
- var o = t("../../../../utils/label/letter-font"),
- a = cc.color(255, 255, 255, 255),
- l = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.createData = function(t) {
- return t.requestRenderData()
- }, e.prototype._getColor = function(t) {
- return a._fastSetA(t.node._color.a), a._val
- }, e.prototype.updateColor = function(e) {
- var i = this._getColor(e);
- t.prototype.updateColor.call(this, e, i)
- }, e
- })(o);
- i.default = l, e.exports = i.default
- }), {
- "../../../../../platform/js": 218,
- "../../../../utils/label/letter-font": 253,
- "./bmfont": 260
- }],
- 262: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../../utils/label/ttf"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../../../components/CCLabelShadow"),
- l = cc.color(255, 255, 255, 255),
- h = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateUVs = function(t) {
- for (var e = this._renderData.vDatas[0], i = t._frame.uv, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; s++) {
- var o = 2 * s,
- a = r * s + n;
- e[a] = i[o], e[a + 1] = i[o + 1]
- }
- }, e.prototype.updateColor = function(e) {
- l._fastSetA(e.node._color.a);
- var i = l._val;
- t.prototype.updateColor.call(this, e, i)
- }, e.prototype.updateVerts = function(t) {
- var e = t.node,
- i = t._ttfTexture.width,
- n = t._ttfTexture.height,
- r = e.anchorX * e.width,
- s = e.anchorY * e.height,
- o = a && t.getComponent(a);
- if (o && o._enabled) {
- var l = (i - e.width) / 2,
- h = (n - e.height) / 2,
- c = o.offset; - c.x > l ? r += i - e.width : l > c.x && (r += l - c.x), -c.y > h ? s += n - e.height : h > c.y && (s += h - c.y)
- }
- var u = this._local;
- u[0] = -r, u[1] = -s, u[2] = i - r, u[3] = n - s, this.updateUVs(t), this.updateWorldVerts(t)
- }, e
- })(n.default);
- i.default = h, e.exports = i.default
- }), {
- "../../../../../components/CCLabelShadow": 99,
- "../../../../utils/label/ttf": 254
- }],
- 263: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = t("../2d/bmfont"),
- l = cc.vmath.vec3,
- h = l.create(),
- c = l.create(),
- u = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(a);
- i.default = u, cc.js.mixin(u.prototype, o, {
- updateWorldVerts: function(t) {
- for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < n.length; s += r) l.set(h, i[s], i[s + 1], 0), l.transformMat4(c, h, e), n[s] = c.x, n[s + 1] = c.y, n[s + 2] = c.z
- }
- }), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/bmfont": 260
- }],
- 264: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(t("../2d/letter"));
- i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/letter": 261
- }],
- 265: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(t("../2d/ttf"));
- i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/ttf": 262
- }],
- 266: [(function(t, e, i) {
- "use strict";
- var n = u(t("../../../assembler")),
- r = u(t("../../../../components/CCLabel")),
- s = u(t("./2d/ttf")),
- o = u(t("./2d/bmfont")),
- a = u(t("./2d/letter")),
- l = u(t("./3d/ttf")),
- h = u(t("./3d/bmfont")),
- c = u(t("./3d/letter"));
- function u(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- r.default._canvasPool = {
- pool: [],
- get: function() {
- var t = this.pool.pop();
- if (!t) {
- var e = document.createElement("canvas");
- t = {
- canvas: e,
- context: e.getContext("2d")
- }
- }
- return t
- },
- put: function(t) {
- this.pool.length >= 32 || this.pool.push(t)
- }
- }, n.default.register(cc.Label, {
- getConstructor: function(t) {
- var e = t.node.is3DNode,
- i = e ? l.default : s.default;
- return t.font instanceof cc.BitmapFont ? i = e ? h.default : o.default : t.cacheMode === r.default.CacheMode.CHAR && (cc.sys.browserType === cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB ? cc.warn("sorry, subdomain does not support CHAR mode currently!") : i = e ? c.default : a.default), i
- },
- TTF: s.default,
- Bmfont: o.default,
- Letter: a.default,
- TTF3D: l.default,
- Bmfont3D: h.default,
- Letter3D: c.default
- })
- }), {
- "../../../../components/CCLabel": 97,
- "../../../assembler": 227,
- "./2d/bmfont": 260,
- "./2d/letter": 261,
- "./2d/ttf": 262,
- "./3d/bmfont": 263,
- "./3d/letter": 264,
- "./3d/ttf": 265
- }],
- 267: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.MaskAssembler = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../assembler"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../components/CCMask"),
- l = t("../../render-flow"),
- h = t("./sprite/2d/simple"),
- c = t("./graphics"),
- u = t("../../../../renderer/gfx"),
- _ = t("../vertex-format").vfmtPos,
- f = 8,
- d = [];
- function p() {
- return 1 << d.length - 1
- }
- function m() {
- for (var t = 0, e = 0; e < d.length; ++e) t += 1 << e;
- return t
- }
- function y(t, e, i, n, r, s) {
- var o = t.effect,
- a = u.STENCIL_OP_KEEP,
- l = u.STENCIL_OP_KEEP;
- o.setStencil(u.STENCIL_ENABLE, e, n, r, i, a, l, s)
- }
- function v(t) {
- d.length + 1 > f && cc.errorID(9e3, f), d.push(t)
- }
- function g(t, e) {
- 0 === d.length && cc.errorID(9001), d.pop(), 0 === d.length ? e._flushMaterial(t._exitMaterial) : A(e)
- }
- function x(t, e) {
- var i = u.DS_FUNC_NEVER,
- n = p(),
- r = n,
- s = n,
- o = t.inverted ? u.STENCIL_OP_REPLACE : u.STENCIL_OP_ZERO;
- y(t._clearMaterial, i, o, n, r, s);
- var a = e.getBuffer("mesh", _),
- l = a.request(4, 6),
- h = l.indiceOffset,
- c = l.byteOffset >> 2,
- f = l.vertexOffset,
- d = a._vData,
- m = a._iData;
- d[c++] = -1, d[c++] = -1, d[c++] = -1, d[c++] = 1, d[c++] = 1, d[c++] = 1, d[c++] = 1, d[c++] = -1, m[h++] = f, m[h++] = f + 3, m[h++] = f + 1, m[h++] = f + 1, m[h++] = f + 3, m[h++] = f + 2, e.node = e._dummyNode, e.material = t._clearMaterial, e._flush()
- }
- function b(t, e) {
- var i = u.DS_FUNC_NEVER,
- n = p(),
- r = n,
- s = n,
- o = t.inverted ? u.STENCIL_OP_ZERO : u.STENCIL_OP_REPLACE;
- y(t.sharedMaterials[0], i, o, n, r, s), e.material = t.sharedMaterials[0], t._type === a.Type.IMAGE_STENCIL ? (e.node = e._dummyNode, h.prototype.fillBuffers.call(t._assembler, t, e), e._flush()) : (e.node = t.node, c.prototype.fillBuffers.call(t._graphics._assembler, t._graphics, e))
- }
- function A(t) {
- var e = u.DS_FUNC_EQUAL,
- i = u.STENCIL_OP_KEEP,
- n = m(),
- r = n,
- s = p(),
- o = d[d.length - 1];
- y(o._enableMaterial, e, i, n, r, s), t._flushMaterial(o._enableMaterial)
- }
- var C = i.MaskAssembler = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateRenderData = function(t) {
- t._type === a.Type.IMAGE_STENCIL ? t.spriteFrame ? h.prototype.updateRenderData.call(this, t) : t.setMaterial(0, null) : (t._graphics.setMaterial(0, t.sharedMaterials[0]), c.prototype.updateRenderData.call(t._graphics._assembler, t._graphics, t._graphics))
- }, e.prototype.fillBuffers = function(t, e) {
- (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && (v(t), x(t, e), b(t, e), A(e)), t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
- }, e.prototype.postFillBuffers = function(t, e) {
- (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && g(t, e), t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
- }, e
- })(h);
- n.default.register(a, C)
- }), {
- "../../../../renderer/gfx": 360,
- "../../../components/CCMask": 101,
- "../../assembler": 227,
- "../../render-flow": 248,
- "../vertex-format": 288,
- "./graphics": 258,
- "./sprite/2d/simple": 272
- }],
- 268: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../assembler-2d"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../components/CCMotionStreak"),
- l = t("../../render-flow");
- function h(t, e) {
- this.point = t || cc.v2(), this.dir = e || cc.v2(), this.distance = 0, this.time = 0
- }
- h.prototype.setPoint = function(t, e) {
- this.point.x = t, this.point.y = e
- }, h.prototype.setDir = function(t, e) {
- this.dir.x = t, this.dir.y = e
- };
- cc.v2(), cc.v2();
- var c = cc.v2(),
- u = cc.v2();
- function _(t, e) {
- return t.x = -e.y, t.y = e.x, t
- }
- var f = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.initData = function() {
- this._renderData.createFlexData(0, 16, 42)
- }, e.prototype.update = function(t, e) {
- var i = t._stroke / 2,
- n = t.node._worldMatrix.m,
- r = n[12],
- s = n[13],
- o = t._points,
- a = void 0;
- if (o.length > 1) {
- var l = o[0].point.x - r,
- f = o[0].point.y - s;
- l * l + f * f < t.minSeg && (a = o[0])
- }
- a || (a = new h, o.splice(0, 0, a)), a.setPoint(r, s), a.time = t._fadeTime + e;
- var d, p = 0;
- if (!(o.length < 2)) {
- var m = t._color,
- y = m.r,
- v = m.g,
- g = m.b,
- x = m.a,
- b = o[1];
- b.distance = a.point.sub(b.point, u).mag(), u.normalizeSelf(), b.setDir(u.x, u.y), a.setDir(u.x, u.y);
- var A = this._renderData._flexBuffer;
- A.reserve(2 * o.length, 6 * (o.length - 1));
- for (var C = A.vData, T = A.uintVData, S = t._fadeTime, w = !1, E = o.length - 1; E >= 0; E--) {
- var M = o[E],
- D = M.point,
- B = M.dir;
- if (M.time -= e, M.time < 0) o.splice(E, 1);
- else {
- var I = M.time / S,
- P = o[E - 1];
- if (!w) {
- if (!P) {
- o.splice(E, 1);
- continue
- }
- D.x = P.point.x - B.x * I, D.y = P.point.y - B.y * I
- }
- w = !0, _(c, B);
- var R = (I * x << 24 >>> 0) + (g << 16) + (v << 8) + y,
- O = 5 * p;
- C[O] = D.x + c.x * i, C[O + 1] = D.y + c.y * i, C[O + 2] = 1, C[O + 3] = I, T[O + 4] = R, C[O += 5] = D.x - c.x * i, C[O + 1] = D.y - c.y * i, C[O + 2] = 0, C[O + 3] = I, T[O + 4] = R, p += 2
- }
- }
- d = p <= 2 ? 0 : 3 * (p - 2), A.used(p, d)
- }
- }, e.prototype.fillBuffers = function(t, e) {
- var i = this._renderData._flexBuffer,
- n = i.vData,
- r = i.usedVertices,
- s = i.usedIndices,
- o = i.usedVerticesFloats,
- a = e._meshBuffer,
- h = a.request(r, s),
- c = h.byteOffset >> 2,
- u = a._vData;
- n.length + c > u.length ? u.set(n.subarray(0, o), c) : u.set(n, c);
- for (var _ = a._iData, f = h.indiceOffset, d = h.vertexOffset, p = 0, m = r; p < m; p += 2) {
- var y = d + p;
- _[f++] = y, _[f++] = y + 2, _[f++] = y + 1, _[f++] = y + 1, _[f++] = y + 2, _[f++] = y + 3
- }
- t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
- }, e
- })(n.default);
- i.default = f, f.register(a, f), e.exports = i.default
- }), {
- "../../../components/CCMotionStreak": 102,
- "../../assembler-2d": 224,
- "../../render-flow": 248
- }],
- 269: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../../assembler-2d"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("../../../../../components/CCSprite").FillType,
- l = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateRenderData = function(t) {
- var e = t._spriteFrame;
- if (e && (this.packToDynamicAtlas(t, e), t._vertsDirty)) {
- var i = t._fillStart,
- n = t._fillRange;
- n < 0 && (i += n, n = -n), n = i + n, i = (i = i > 1 ? 1 : i) < 0 ? 0 : i, n = (n = n > 1 ? 1 : n) < 0 ? 0 : n;
- var r = i + (n = (n -= i) < 0 ? 0 : n);
- r = r > 1 ? 1 : r, this.updateUVs(t, i, r), this.updateVerts(t, i, r), t._vertsDirty = !1
- }
- }, e.prototype.updateUVs = function(t, e, i) {
- var n = t._spriteFrame,
- r = n._texture.width,
- s = n._texture.height,
- o = n._rect,
- l = void 0,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = void 0,
- f = void 0,
- d = void 0,
- p = void 0,
- m = void 0,
- y = void 0;
- n._rotated ? (l = o.x / r, h = (o.y + o.width) / s, c = _ = l, d = m = (o.x + o.height) / r, f = y = h, u = p = o.y / s) : (l = o.x / r, h = (o.y + o.height) / s, c = d = l, _ = m = (o.x + o.width) / r, u = f = h, p = y = o.y / s);
- var v = this._renderData.vDatas[0],
- g = this.uvOffset,
- x = this.floatsPerVert;
- switch (t._fillType) {
- case a.HORIZONTAL:
- v[g] = c + (_ - c) * e, v[g + 1] = u + (f - u) * e, v[g + x] = c + (_ - c) * i, v[g + x + 1] = u + (f - u) * i, v[g + 2 * x] = d + (m - d) * e, v[g + 2 * x + 1] = p + (y - p) * e, v[g + 3 * x] = d + (m - d) * i, v[g + 3 * x + 1] = p + (y - p) * i;
- break;
- case a.VERTICAL:
- v[g] = c + (d - c) * e, v[g + 1] = u + (p - u) * e, v[g + x] = _ + (m - _) * e, v[g + x + 1] = f + (y - f) * e, v[g + 2 * x] = c + (d - c) * i, v[g + 2 * x + 1] = u + (p - u) * i, v[g + 3 * x] = _ + (m - _) * i, v[g + 3 * x + 1] = f + (y - f) * i;
- break;
- default:
- cc.errorID(2626)
- }
- }, e.prototype.updateVerts = function(t, e, i) {
- var n = t.node,
- r = n.width,
- s = n.height,
- o = n.anchorX * r,
- l = n.anchorY * s,
- h = -o,
- c = -l,
- u = r - o,
- _ = s - l,
- f = void 0;
- switch (t._fillType) {
- case a.HORIZONTAL:
- f = h + (u - h) * i, h = h + (u - h) * e, u = f;
- break;
- case a.VERTICAL:
- f = c + (_ - c) * i, c = c + (_ - c) * e, _ = f;
- break;
- default:
- cc.errorID(2626)
- }
- var d = this._local;
- d[0] = h, d[1] = c, d[2] = u, d[3] = _, this.updateWorldVerts(t)
- }, e
- })(n.default);
- i.default = l, e.exports = i.default
- }), {
- "../../../../../components/CCSprite": 111,
- "../../../../assembler-2d": 224
- }],
- 270: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0, i.default = void 0;
- var o = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.initData = function(t) {
- this._renderData.createFlexData(0, 4, 6, this.getVfmt())
- }, e.prototype.updateRenderData = function(t) {
- this.packToDynamicAtlas(t, t._spriteFrame);
- var e = t.spriteFrame;
- if (e) {
- var i = e.vertices;
- if (i) {
- this.verticesCount = i.x.length, this.indicesCount = i.triangles.length;
- var n = this._renderData._flexBuffer;
- n.reserve(this.verticesCount, this.indicesCount) && (this.updateColor(t), t._vertsDirty = !0), n.used(this.verticesCount, this.indicesCount), this.updateIndices(i.triangles), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), this.updateWorldVerts(t), t._vertsDirty = !1)
- }
- }
- }, e.prototype.updateIndices = function(t) {
- this._renderData.iDatas[0].set(t)
- }, e.prototype.updateUVs = function(t) {
- for (var e = t.spriteFrame.vertices, i = e.nu, n = e.nv, r = this.uvOffset, s = this.floatsPerVert, o = this._renderData.vDatas[0], a = 0; a < i.length; a++) {
- var l = s * a + r;
- o[l] = i[a], o[l + 1] = n[a]
- }
- }, e.prototype.updateVerts = function(t) {
- var e = t.node,
- i = Math.abs(e.width),
- n = Math.abs(e.height),
- r = e.anchorX * i,
- s = e.anchorY * n,
- o = t.spriteFrame,
- a = o.vertices,
- l = a.x,
- h = a.y,
- c = o._originalSize.width,
- u = o._originalSize.height,
- _ = o._rect.width,
- f = o._rect.height,
- d = o._offset.x + (c - _) / 2,
- p = o._offset.y + (u - f) / 2,
- m = i / (t.trim ? _ : c),
- y = n / (t.trim ? f : u),
- v = this._local;
- if (t.trim)
- for (var g = 0, x = l.length; g < x; g++) {
- var b = 2 * g;
- v[b] = (l[g] - d) * m - r, v[b + 1] = (u - h[g] - p) * y - s
- } else
- for (var A = 0, C = l.length; A < C; A++) {
- var T = 2 * A;
- v[T] = l[A] * m - r, v[T + 1] = (u - h[A]) * y - s
- }
- }, e.prototype.updateWorldVerts = function(t) {
- for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0, _ = this.verticesCount; u < _; u++) {
- var f = l[2 * u],
- d = l[2 * u + 1];
- h[c * u] = f * i + d * r + o, h[c * u + 1] = f * n + d * s + a
- }
- }, e
- })(function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }(t("../../../../assembler-2d")).default);
- i.default = o, e.exports = i.default
- }), {
- "../../../../assembler-2d": 224
- }],
- 271: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../../assembler-2d"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = 2 * Math.PI,
- l = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
- h = [0, 0, 0, 0],
- c = [0, 0, 0, 0, 0, 0, 0, 0],
- u = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
- _ = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
- f = cc.v2(0, 0),
- d = [];
- function p(t, e, i, n, r, s, o) {
- var a = Math.sin(s),
- l = Math.cos(s),
- h = void 0,
- c = void 0;
- if (0 !== Math.cos(s)) {
- if (h = a / l, (t - r.x) * l > 0) {
- var u = r.y + h * (t - r.x);
- o[0].x = t, o[0].y = u
- }
- if ((e - r.x) * l > 0) {
- var _ = r.y + h * (e - r.x);
- o[2].x = e, o[2].y = _
- }
- }
- if (0 !== Math.sin(s)) {
- if (c = l / a, (n - r.y) * a > 0) {
- var f = r.x + c * (n - r.y);
- o[3].x = f, o[3].y = n
- }
- if ((i - r.y) * a > 0) {
- var d = r.x + c * (i - r.y);
- o[1].x = d, o[1].y = i
- }
- }
- }
- function m(t) {
- var e = t.node,
- i = e.width,
- n = e.height,
- r = e.anchorX * i,
- s = e.anchorY * n,
- o = -r,
- a = -s,
- c = i - r,
- u = n - s,
- _ = h;
- _[0] = o, _[1] = a, _[2] = c, _[3] = u;
- var p = t._fillCenter,
- m = f.x = Math.min(Math.max(0, p.x), 1) * (c - o) + o,
- y = f.y = Math.min(Math.max(0, p.y), 1) * (u - a) + a;
- l[0].x = l[3].x = o, l[1].x = l[2].x = c, l[0].y = l[1].y = a, l[2].y = l[3].y = u, d.length = 0, m !== _[0] && (d[0] = [3, 0]), m !== _[2] && (d[2] = [1, 2]), y !== _[1] && (d[1] = [0, 1]), y !== _[3] && (d[3] = [2, 3])
- }
- function y(t) {
- var e = t._texture.width,
- i = t._texture.height,
- n = t._rect,
- r = void 0,
- s = void 0,
- o = void 0,
- a = void 0,
- l = c;
- t._rotated ? (r = n.x / e, s = (n.x + n.height) / e, o = n.y / i, a = (n.y + n.width) / i, l[0] = l[2] = r, l[4] = l[6] = s, l[3] = l[7] = a, l[1] = l[5] = o) : (r = n.x / e, s = (n.x + n.width) / e, o = n.y / i, a = (n.y + n.height) / i, l[0] = l[4] = r, l[2] = l[6] = s, l[1] = l[3] = a, l[5] = l[7] = o)
- }
- function v(t, e) {
- var i, n;
- if (i = e.x - t.x, n = e.y - t.y, 0 !== i || 0 !== n) {
- if (0 === i) return n > 0 ? .5 * Math.PI : 1.5 * Math.PI;
- var r = Math.atan(n / i);
- return i < 0 && (r += Math.PI), r
- }
- }
- var g = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.initData = function(t) {
- this._renderData.createFlexData(0, 4, 6, this.getVfmt()), this.updateIndices()
- }, e.prototype.updateRenderData = function(e) {
- t.prototype.updateRenderData.call(this, e);
- var i = e.spriteFrame;
- if (i && (this.packToDynamicAtlas(e, i), e._vertsDirty)) {
- var n = e._fillStart,
- r = e._fillRange;
- for (r < 0 && (n += r, r = -r); n >= 1;) n -= 1;
- for (; n < 0;) n += 1;
- n *= a, r *= a, m(e), y(i), p(h[0], h[2], h[1], h[3], f, n, u), p(h[0], h[2], h[1], h[3], f, n + r, _), this.updateVerts(e, n, r), e._vertsDirty = !1
- }
- }, e.prototype.updateVerts = function(t, e, i) {
- for (var n = e + i, r = this._local, s = 0, o = 3 * this.floatsPerVert, h = 0; h < 4; ++h) {
- var c = d[h];
- if (c)
- if (i >= a) r.length = s + o, this._generateTriangle(r, s, f, l[c[0]], l[c[1]]), s += o;
- else {
- var p = v(f, l[c[0]]),
- m = v(f, l[c[1]]);
- m < p && (m += a), p -= a, m -= a;
- for (var y = 0; y < 3; ++y) p >= n || (p >= e ? (r.length = s + o, m >= n ? this._generateTriangle(r, s, f, l[c[0]], _[h]) : this._generateTriangle(r, s, f, l[c[0]], l[c[1]]), s += o) : m <= e || (m <= n ? (r.length = s + o, this._generateTriangle(r, s, f, u[h], l[c[1]]), s += o) : (r.length = s + o, this._generateTriangle(r, s, f, u[h], _[h]), s += o))), p += a, m += a
- }
- }
- this.allocWorldVerts(t), this.updateWorldVerts(t)
- }, e.prototype.allocWorldVerts = function(t) {
- var e = t.node._color._val,
- i = this._renderData,
- n = this.floatsPerVert,
- r = this._local,
- s = r.length / n;
- this.verticesCount = this.indicesCount = s;
- var o = i._flexBuffer;
- o.reserve(s, s) && this.updateIndices(), o.used(this.verticesCount, this.indicesCount);
- for (var a = i.vDatas[0], l = i.uintVDatas[0], h = this.uvOffset, c = 0; c < r.length; c += n) {
- var u = c + h;
- a[u] = r[u], a[u + 1] = r[u + 1], l[u + 2] = e
- }
- }, e.prototype.updateIndices = function() {
- for (var t = this._renderData.iDatas[0], e = 0; e < t.length; e++) t[e] = e
- }, e.prototype.updateWorldVerts = function(t) {
- for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) {
- var _ = l[u],
- f = l[u + 1];
- h[u] = _ * i + f * r + o, h[u + 1] = _ * n + f * s + a
- }
- }, e.prototype._generateTriangle = function(t, e, i, n, r) {
- var s = h,
- o = s[0],
- a = s[1],
- l = s[2],
- c = s[3],
- u = this.floatsPerVert;
- t[e] = i.x, t[e + 1] = i.y, t[e + u] = n.x, t[e + u + 1] = n.y, t[e + 2 * u] = r.x, t[e + 2 * u + 1] = r.y;
- var _ = this.uvOffset,
- f = void 0,
- d = void 0;
- f = (i.x - o) / (l - o), d = (i.y - a) / (c - a), this._generateUV(f, d, t, e + _), f = (n.x - o) / (l - o), d = (n.y - a) / (c - a), this._generateUV(f, d, t, e + u + _), f = (r.x - o) / (l - o), d = (r.y - a) / (c - a), this._generateUV(f, d, t, e + 2 * u + _)
- }, e.prototype._generateUV = function(t, e, i, n) {
- var r = c,
- s = r[0] + (r[2] - r[0]) * t,
- o = r[4] + (r[6] - r[4]) * t,
- a = r[1] + (r[3] - r[1]) * t,
- l = r[5] + (r[7] - r[5]) * t;
- i[n] = s + (o - s) * e, i[n + 1] = a + (l - a) * e
- }, e
- })(n.default);
- i.default = g, e.exports = i.default
- }), {
- "../../../../assembler-2d": 224
- }],
- 272: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0, i.default = void 0;
- var o = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.updateRenderData = function(t) {
- var e = t._spriteFrame;
- e && (this.packToDynamicAtlas(t, e), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1))
- }, e.prototype.updateUVs = function(t) {
- for (var e = t._spriteFrame.uv, i = this.uvOffset, n = this.floatsPerVert, r = this._renderData.vDatas[0], s = 0; s < 4; s++) {
- var o = 2 * s,
- a = n * s + i;
- r[a] = e[o], r[a + 1] = e[o + 1]
- }
- }, e.prototype.updateVerts = function(t) {
- var e = t.node,
- i = e.width,
- n = e.height,
- r = e.anchorX * i,
- s = e.anchorY * n,
- o = void 0,
- a = void 0,
- l = void 0,
- h = void 0;
- if (t.trim) o = -r, a = -s, l = i - r, h = n - s;
- else {
- var c = t.spriteFrame,
- u = c._originalSize.width,
- _ = c._originalSize.height,
- f = c._rect.width,
- d = c._rect.height,
- p = c._offset,
- m = i / u,
- y = n / _,
- v = p.x + (u - f) / 2,
- g = p.x - (u - f) / 2;
- o = v * m - r, a = (p.y + (_ - d) / 2) * y - s, l = i + g * m - r, h = n + (p.y - (_ - d) / 2) * y - s
- }
- var x = this._local;
- x[0] = o, x[1] = a, x[2] = l, x[3] = h, this.updateWorldVerts(t)
- }, e
- })(function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }(t("../../../../assembler-2d")).default);
- i.default = o, e.exports = i.default
- }), {
- "../../../../assembler-2d": 224
- }],
- 273: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0, i.default = void 0;
- var o = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.initData = function(t) {
- if (!(this._renderData.meshCount > 0)) {
- this._renderData.createData(0, this.verticesFloats, this.indicesCount);
- for (var e = this._renderData.iDatas[0], i = 0, n = 0; n < 3; ++n)
- for (var r = 0; r < 3; ++r) {
- var s = 4 * n + r;
- e[i++] = s, e[i++] = s + 1, e[i++] = s + 4, e[i++] = s + 1, e[i++] = s + 5, e[i++] = s + 4
- }
- }
- }, e.prototype.initLocal = function() {
- this._local = [], this._local.length = 8
- }, e.prototype.updateRenderData = function(t) {
- var e = t._spriteFrame;
- e && (this.packToDynamicAtlas(t, e), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1))
- }, e.prototype.updateVerts = function(t) {
- var e = t.node,
- i = e.width,
- n = e.height,
- r = e.anchorX * i,
- s = e.anchorY * n,
- o = t.spriteFrame,
- a = o.insetLeft,
- l = o.insetRight,
- h = o.insetTop,
- c = o.insetBottom,
- u = i - a - l,
- _ = n - h - c,
- f = i / (a + l),
- d = n / (h + c);
- f = isNaN(f) || f > 1 ? 1 : f, d = isNaN(d) || d > 1 ? 1 : d, u = u < 0 ? 0 : u, _ = _ < 0 ? 0 : _;
- var p = this._local;
- p[0] = -r, p[1] = -s, p[2] = a * f - r, p[3] = c * d - s, p[4] = p[2] + u, p[5] = p[3] + _, p[6] = i - r, p[7] = n - s, this.updateWorldVerts(t)
- }, e.prototype.updateUVs = function(t) {
- for (var e = this._renderData.vDatas[0], i = t.spriteFrame.uvSliced, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; ++s)
- for (var o = 0; o < 4; ++o) {
- var a = 4 * s + o,
- l = i[a],
- h = a * r;
- e[h + n] = l.u, e[h + n + 1] = l.v
- }
- }, e.prototype.updateWorldVerts = function(t) {
- for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < 4; ++u)
- for (var _ = l[2 * u + 1], f = 0; f < 4; ++f) {
- var d = l[2 * f],
- p = (4 * u + f) * c;
- h[p] = d * i + _ * r + o, h[p + 1] = d * n + _ * s + a
- }
- }, e
- })(function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }(t("../../../../assembler-2d")).default);
- i.default = o, Object.assign(o.prototype, {
- verticesCount: 16,
- indicesCount: 54
- }), e.exports = i.default
- }), {
- "../../../../assembler-2d": 224
- }],
- 274: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0, i.default = void 0;
- var o = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e.prototype.initData = function(t) {
- this.verticesCount = 0, this.contentWidth = 0, this.contentHeight = 0, this.rectWidth = 0, this.rectHeight = 0, this.hRepeat = 0, this.vRepeat = 0, this.row = 0, this.col = 0, this._renderData.createFlexData(0, 4, 6, this.getVfmt()), this._updateIndices()
- }, e.prototype.initLocal = function() {
- this._local = {
- x: [],
- y: []
- }
- }, e.prototype._updateIndices = function() {
- for (var t = this._renderData.iDatas[0], e = 0, i = 0, n = t.length; e < n; e += 6, i += 4) t[e] = i, t[e + 1] = i + 1, t[e + 2] = i + 2, t[e + 3] = i + 1, t[e + 4] = i + 3, t[e + 5] = i + 2
- }, e.prototype.updateRenderData = function(t) {
- var e = t._spriteFrame;
- if (e) {
- this.packToDynamicAtlas(t, e);
- var i = t.node,
- n = this.contentWidth = Math.abs(i.width),
- r = this.contentHeight = Math.abs(i.height),
- s = e._rect,
- o = this.rectWidth = s.width,
- a = this.rectHeight = s.height,
- l = this.hRepeat = n / o,
- h = this.vRepeat = r / a,
- c = (this.row = Math.ceil(h)) * (this.col = Math.ceil(l));
- this.verticesCount = 4 * c, this.indicesCount = 6 * c;
- var u = this._renderData._flexBuffer;
- u.reserve(this.verticesCount, this.indicesCount) && (this._updateIndices(), this.updateColor(t)), u.used(this.verticesCount, this.indicesCount), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1)
- }
- }, e.prototype.updateVerts = function(t) {
- var e = t.node,
- i = e.anchorX * e.width,
- n = e.anchorY * e.height,
- r = this.row,
- s = this.col,
- o = this.rectWidth,
- a = this.rectHeight,
- l = this.contentWidth,
- h = this.contentHeight,
- c = this._local,
- u = c.x,
- _ = c.y;
- u.length = _.length = 0;
- for (var f = 0; f <= s; ++f) u[f] = Math.min(o * f, l) - i;
- for (var d = 0; d <= r; ++d) _[d] = Math.min(a * d, h) - n;
- this.updateWorldVerts(t)
- }, e.prototype.updateWorldVerts = function(t) {
- for (var e = this._renderData, i = this._local, n = i.x, r = i.y, s = e.vDatas[0], o = this.row, a = this.col, l = t.node._worldMatrix.m, h = l[0], c = l[1], u = l[4], _ = l[5], f = l[12], d = l[13], p = void 0, m = void 0, y = void 0, v = void 0, g = this.floatsPerVert, x = 0, b = 0, A = o; b < A; ++b) {
- y = r[b], v = r[b + 1];
- for (var C = 0, T = a; C < T; ++C) p = n[C], m = n[C + 1], s[x] = p * h + y * u + f, s[x + 1] = p * c + y * _ + d, s[x += g] = m * h + y * u + f, s[x + 1] = m * c + y * _ + d, s[x += g] = p * h + v * u + f, s[x + 1] = p * c + v * _ + d, s[x += g] = m * h + v * u + f, s[x + 1] = m * c + v * _ + d, x += g
- }
- }, e.prototype.updateUVs = function(t) {
- var e = this._renderData.vDatas[0];
- if (e)
- for (var i = this.row, n = this.col, r = this.hRepeat, s = this.vRepeat, o = t.spriteFrame.uv, a = t.spriteFrame._rotated, l = this.floatsPerVert, h = this.uvOffset, c = 0, u = i; c < u; ++c)
- for (var _ = Math.min(1, s - c), f = 0, d = n; f < d; ++f) {
- var p = Math.min(1, r - f);
- a ? (e[h] = o[0], e[h + 1] = o[1], e[h += l] = o[0], e[h + 1] = o[1] + (o[7] - o[1]) * p, e[h += l] = o[0] + (o[6] - o[0]) * _, e[h + 1] = o[1], e[h += l] = e[h - l], e[h + 1] = e[h + 1 - 2 * l], h += l) : (e[h] = o[0], e[h + 1] = o[1], e[h += l] = o[0] + (o[6] - o[0]) * p, e[h + 1] = o[1], e[h += l] = o[0], e[h + 1] = o[1] + (o[7] - o[1]) * _, e[h += l] = e[h - 2 * l], e[h + 1] = e[h + 1 - l], h += l)
- }
- }, e
- })(function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }(t("../../../../assembler-2d")).default);
- i.default = o, e.exports = i.default
- }), {
- "../../../../assembler-2d": 224
- }],
- 275: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(t("../2d/bar-filled"));
- i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/bar-filled": 269
- }],
- 276: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = t("../2d/mesh"),
- l = cc.vmath.vec3,
- h = cc.v3(),
- c = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(a);
- i.default = c, cc.js.mixin(c.prototype, o, {
- updateWorldVerts: function(t) {
- for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0, o = i.length / 2; s < o; s++) {
- l.set(h, i[2 * s], i[2 * s + 1], 0), l.transformMat4(h, h, e);
- var a = r * s;
- n[a] = h.x, n[a + 1] = h.y, n[a + 2] = h.z
- }
- }
- }), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/mesh": 270
- }],
- 277: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = t("../2d/radial-filled"),
- l = cc.vmath.vec3,
- h = l.create(),
- c = l.create(),
- u = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(a);
- i.default = u, cc.js.mixin(u.prototype, o, {
- updateWorldVerts: function(t) {
- for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < n.length; s += r) l.set(h, i[s], i[s + 1], 0), l.transformMat4(c, h, e), n[s] = c.x, n[s + 1] = c.y, n[s + 2] = c.z
- }
- }), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/radial-filled": 271
- }],
- 278: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(t("../2d/simple"));
- i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/simple": 272
- }],
- 279: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- var o = t("../../../../assembler-3d"),
- a = t("../2d/sliced"),
- l = cc.vmath.vec3,
- h = l.create(),
- c = l.create(),
- u = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(a);
- i.default = u, cc.js.mixin(u.prototype, o, {
- updateWorldVerts: function(t) {
- for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < 4; ++s)
- for (var o = i[2 * s + 1], a = 0; a < 4; ++a) {
- var u = i[2 * a];
- l.set(h, u, o, 0), l.transformMat4(c, h, e);
- var _ = (4 * s + a) * r;
- n[_] = c.x, n[_ + 1] = c.y, n[_ + 2] = c.z
- }
- }
- }), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/sliced": 273
- }],
- 280: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function r(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function s(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- i.__esModule = !0;
- for (var o = t("../../../../assembler-3d"), a = t("../2d/tiled"), l = cc.vmath.vec3, h = [], c = 0; c < 4; c++) h.push(l.create());
- var u = (function(t) {
- function e() {
- return n(this, e), r(this, t.apply(this, arguments))
- }
- return s(e, t), e
- })(a);
- i.default = u, cc.js.mixin(u.prototype, o, {
- updateWorldVerts: function(t) {
- for (var e = this._local, i = e.x, n = e.y, r = this._renderData.vDatas[0], s = this.row, o = this.col, a = t.node._worldMatrix, c = void 0, u = void 0, _ = void 0, f = void 0, d = 0, p = 0, m = s; p < m; ++p) {
- _ = n[p], f = n[p + 1];
- for (var y = 0, v = o; y < v; ++y) {
- c = i[y], u = i[y + 1], l.set(h[0], c, _, 0), l.set(h[1], u, _, 0), l.set(h[2], c, f, 0), l.set(h[3], u, f, 0);
- for (var g = 0; g < 4; g++) {
- var x = h[g];
- l.transformMat4(x, x, a);
- var b = 6 * g;
- r[d + b] = x.x, r[d + b + 1] = x.y, r[d + b + 2] = x.z
- }
- d += 24
- }
- }
- }
- }), e.exports = i.default
- }), {
- "../../../../assembler-3d": 225,
- "../2d/tiled": 274
- }],
- 281: [(function(t, e, i) {
- "use strict";
- var n = y(t("../../../assembler")),
- r = t("../../../../components/CCSprite"),
- s = y(t("./2d/simple")),
- o = y(t("./2d/sliced")),
- a = y(t("./2d/tiled")),
- l = y(t("./2d/radial-filled")),
- h = y(t("./2d/bar-filled")),
- c = y(t("./2d/mesh")),
- u = y(t("./3d/simple")),
- _ = y(t("./3d/sliced")),
- f = y(t("./3d/tiled")),
- d = y(t("./3d/radial-filled")),
- p = y(t("./3d/bar-filled")),
- m = y(t("./3d/mesh"));
- function y(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var v = {
- getConstructor: function(t) {
- var e = t.node.is3DNode,
- i = e ? u.default : s.default;
- switch (t.type) {
- case r.Type.SLICED:
- i = e ? _.default : o.default;
- break;
- case r.Type.TILED:
- i = e ? f.default : a.default;
- break;
- case r.Type.FILLED:
- i = t._fillType === r.FillType.RADIAL ? e ? d.default : l.default : e ? p.default : h.default;
- break;
- case r.Type.MESH:
- i = e ? m.default : c.default
- }
- return i
- },
- Simple: s.default,
- Sliced: o.default,
- Tiled: a.default,
- RadialFilled: l.default,
- BarFilled: h.default,
- Mesh: c.default,
- Simple3D: u.default,
- Sliced3D: _.default,
- Tiled3D: f.default,
- RadialFilled3D: d.default,
- BarFilled3D: p.default,
- Mesh3D: m.default
- };
- n.default.register(cc.Sprite, v)
- }), {
- "../../../../components/CCSprite": 111,
- "../../../assembler": 227,
- "./2d/bar-filled": 269,
- "./2d/mesh": 270,
- "./2d/radial-filled": 271,
- "./2d/simple": 272,
- "./2d/sliced": 273,
- "./2d/tiled": 274,
- "./3d/bar-filled": 275,
- "./3d/mesh": 276,
- "./3d/radial-filled": 277,
- "./3d/simple": 278,
- "./3d/sliced": 279,
- "./3d/tiled": 280
- }],
- 282: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t(e, i, r, s, o) {
- n(this, t), this._handler = e, this._index = i, this._vfmt = o, this._verticesBytes = o._bytes, this._initVerticesCount = r, this._initIndicesCount = s, this.reset()
- }
- return t.prototype._reallocVData = function(t, e) {
- this.vData = new Float32Array(t), this.uintVData = new Uint32Array(this.vData.buffer), e && this.vData.set(e), this._handler.updateMesh(this._index, this.vData, this.iData)
- }, t.prototype._reallocIData = function(t, e) {
- this.iData = new Uint16Array(t), e && this.iData.set(e), this._handler.updateMesh(this._index, this.vData, this.iData)
- }, t.prototype.reserve = function(t, e) {
- var i = t * this._verticesBytes >> 2,
- n = this.vData.length,
- r = !1;
- if (i > n) {
- for (; n < i;) n *= 2;
- this._reallocVData(n, this.vData), r = !0
- }
- var s = this.iData.length;
- if (e > s) {
- for (; s < e;) s *= 2;
- this._reallocIData(e, this.iData), r = !0
- }
- return r
- }, t.prototype.used = function(t, e) {
- this.usedVertices = t, this.usedIndices = e, this.usedVerticesFloats = t * this._verticesBytes >> 2, this._handler.updateMeshRange(t, e)
- }, t.prototype.reset = function() {
- var t = this._initVerticesCount * this._verticesBytes >> 2;
- this._reallocVData(t), this._reallocIData(this._initIndicesCount), this.usedVertices = 0, this.usedVerticesFloats = 0, this.usedIndices = 0
- }, t
- })();
- i.default = r, cc.FlexBuffer = r, e.exports = i.default
- }), {}],
- 283: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../renderer/gfx"));
- var r = cc.Class({
- name: "cc.MeshBuffer",
- ctor: function(t, e) {
- this.init(t, e)
- },
- init: function(t, e) {
- this.byteOffset = 0, this.indiceOffset = 0, this.vertexOffset = 0, this.indiceStart = 0, this._dirty = !1, this._vertexFormat = e, this._vertexBytes = this._vertexFormat._bytes, this._arrOffset = 0, this._vbArr = [], this._vb = new n.default.VertexBuffer(t._device, e, n.default.USAGE_DYNAMIC, new ArrayBuffer, 0), this._vbArr[0] = this._vb, this._ibArr = [], this._ib = new n.default.IndexBuffer(t._device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, new ArrayBuffer, 0), this._ibArr[0] = this._ib, this._vData = null, this._uintVData = null, this._iData = null, this._batcher = t, this._initVDataCount = 256 * e._bytes, this._initIDataCount = 1536, this._offsetInfo = {
- byteOffset: 0,
- vertexOffset: 0,
- indiceOffset: 0
- }, this._reallocBuffer()
- },
- uploadData: function() {
- if (0 !== this.byteOffset && this._dirty) {
- var t = new Float32Array(this._vData.buffer, 0, this.byteOffset >> 2),
- e = new Uint16Array(this._iData.buffer, 0, this.indiceOffset);
- this._vb.update(0, t), this._ib.update(0, e), this._dirty = !1
- }
- },
- switchBuffer: function() {
- var t = ++this._arrOffset;
- this.byteOffset = 0, this.vertexOffset = 0, this.indiceOffset = 0, this.indiceStart = 0, t < this._vbArr.length ? (this._vb = this._vbArr[t], this._ib = this._ibArr[t]) : (this._vb = new n.default.VertexBuffer(this._batcher._device, this._vertexFormat, n.default.USAGE_DYNAMIC, new ArrayBuffer, 0), this._vbArr[t] = this._vb, this._ib = new n.default.IndexBuffer(this._batcher._device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, new ArrayBuffer, 0), this._ibArr[t] = this._ib)
- },
- checkAndSwitchBuffer: function(t) {
- this.vertexOffset + t > 65535 && (this.uploadData(), this._batcher._flush(), this.switchBuffer())
- },
- requestStatic: function(t, e) {
- this.checkAndSwitchBuffer(t);
- var i = this.byteOffset + t * this._vertexBytes,
- n = this.indiceOffset + e,
- r = this._vData.byteLength,
- s = this._iData.length;
- if (i > r || n > s) {
- for (; r < i || s < n;) this._initVDataCount *= 2, this._initIDataCount *= 2, r = 4 * this._initVDataCount, s = this._initIDataCount;
- this._reallocBuffer()
- }
- this._updateOffset(t, e, i)
- },
- _updateOffset: function(t, e, i) {
- var n = this._offsetInfo;
- n.vertexOffset = this.vertexOffset, this.vertexOffset += t, n.indiceOffset = this.indiceOffset, this.indiceOffset += e, n.byteOffset = this.byteOffset, this.byteOffset = i, this._dirty = !0
- },
- request: function(t, e) {
- return this._batcher._buffer !== this && (this._batcher._flush(), this._batcher._buffer = this), this.requestStatic(t, e), this._offsetInfo
- },
- _reallocBuffer: function() {
- this._reallocVData(!0), this._reallocIData(!0)
- },
- _reallocVData: function(t) {
- var e = void 0;
- this._vData && (e = new Uint8Array(this._vData.buffer)), this._vData = new Float32Array(this._initVDataCount), this._uintVData = new Uint32Array(this._vData.buffer);
- var i = new Uint8Array(this._uintVData.buffer);
- if (e && t)
- for (var n = 0, r = e.length; n < r; n++) i[n] = e[n]
- },
- _reallocIData: function(t) {
- var e = this._iData;
- if (this._iData = new Uint16Array(this._initIDataCount), e && t)
- for (var i = this._iData, n = 0, r = e.length; n < r; n++) i[n] = e[n]
- },
- reset: function() {
- this._arrOffset = 0, this._vb = this._vbArr[0], this._ib = this._ibArr[0], this.byteOffset = 0, this.indiceOffset = 0, this.vertexOffset = 0, this.indiceStart = 0, this._dirty = !1
- },
- destroy: function() {
- this.reset();
- for (var t = 0; t < this._vbArr.length; t++) {
- this._vbArr[t].destroy()
- }
- this._vbArr = null;
- for (var e = 0; e < this._ibArr.length; e++) {
- this._ibArr[e].destroy()
- }
- this._ibArr = null, this._ib = null, this._vb = null
- },
- forwardIndiceStartToOffset: function() {
- this.indiceStart = this.indiceOffset
- }
- });
- cc.MeshBuffer = e.exports = r
- }), {
- "../../../renderer/gfx": 360
- }],
- 284: [(function(t, e, i) {
- "use strict";
- var n = o(t("../../../renderer/core/input-assembler")),
- r = o(t("../../../renderer/memop/recycle-pool")),
- s = o(t("../../../renderer/scene/model"));
- function o(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var a = t("./vertex-format"),
- l = a.vfmtPosUvColor,
- h = a.vfmt3D,
- c = t("./quad-buffer"),
- u = t("./mesh-buffer"),
- _ = t("./spine-buffer"),
- f = t("../../assets/material/CCMaterial"),
- d = (new(t("../../platform/id-generater"))("VertextFormat"), {}),
- p = new f,
- m = new n.default;
- m._count = 0;
- var y = function(t, e) {
- this._renderScene = e, this._device = t, this.walking = !1, this.material = p, this.cullingMask = 1, this._iaPool = new r.default(function() {
- return new n.default
- }, 16), this._modelPool = new r.default(function() {
- return new s.default
- }, 16), this._quadBuffer = this.getBuffer("quad", l), this._meshBuffer = this.getBuffer("mesh", l), this._quadBuffer3D = this.getBuffer("quad", h), this._meshBuffer3D = this.getBuffer("mesh", h), this._buffer = this._meshBuffer, this._batchedModels = [], this._dummyNode = new cc.Node, this._sortKey = 0, this.node = this._dummyNode, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.customProperties = null
- };
- y.prototype = {
- constructor: y,
- reset: function() {
- this._iaPool.reset();
- for (var t = this._renderScene, e = this._batchedModels, i = 0; i < e.length; ++i) e[i].setInputAssembler(null), e[i].setEffect(null), t.removeModel(e[i]);
- for (var n in this._modelPool.reset(), e.length = 0, this._sortKey = 0, d) d[n].reset();
- this._buffer = this._meshBuffer, this.node = this._dummyNode, this.material = p, this.cullingMask = 1, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.customProperties = null
- },
- _flushMaterial: function(t) {
- if (t) {
- this.material = t;
- var e = t.effect;
- if (e) {
- var i = this._modelPool.add();
- this._batchedModels.push(i), i.sortKey = this._sortKey++, i._cullingMask = this.cullingMask, i.setNode(this.node), i.setEffect(e, null), i.setInputAssembler(m), this._renderScene.addModel(i)
- }
- }
- },
- _flush: function() {
- var t = this.material,
- e = this._buffer,
- i = e.indiceOffset - e.indiceStart;
- if (this.walking && t && !(i <= 0)) {
- var n = t.effect;
- if (n) {
- var r = this._iaPool.add();
- r._vertexBuffer = e._vb, r._indexBuffer = e._ib, r._start = e.indiceStart, r._count = i;
- var s = this._modelPool.add();
- this._batchedModels.push(s), s.sortKey = this._sortKey++, s._cullingMask = this.cullingMask, s.setNode(this.node), s.setEffect(n, this.customProperties), s.setInputAssembler(r), this._renderScene.addModel(s), e.forwardIndiceStartToOffset()
- }
- }
- },
- _flushIA: function(t) {
- if (t) {
- var e = this.material.effect;
- if (e) {
- var i = this._modelPool.add();
- this._batchedModels.push(i), i.sortKey = this._sortKey++, i._cullingMask = this.cullingMask, i.setNode(this.node), i.setEffect(e, this.customProperties), i.setInputAssembler(t), this._renderScene.addModel(i)
- }
- }
- },
- terminate: function() {
- for (var t in cc.dynamicAtlasManager && cc.dynamicAtlasManager.enabled && cc.dynamicAtlasManager.update(), this._flush(), d) d[t].uploadData();
- this.walking = !1
- },
- getBuffer: function(t, e) {
- var i = t + e.getHash(),
- n = d[i];
- if (!n) {
- if ("mesh" === t) n = new u(this, e);
- else if ("quad" === t) n = new c(this, e);
- else {
- if ("spine" !== t) return cc.error("Not support buffer type [" + t + "]"), null;
- n = new _(this, e)
- }
- d[i] = n
- }
- return n
- }
- }, e.exports = y
- }), {
- "../../../renderer/core/input-assembler": 350,
- "../../../renderer/memop/recycle-pool": 375,
- "../../../renderer/scene/model": 382,
- "../../assets/material/CCMaterial": 75,
- "../../platform/id-generater": 214,
- "./mesh-buffer": 283,
- "./quad-buffer": 285,
- "./spine-buffer": 287,
- "./vertex-format": 288
- }],
- 285: [(function(t, e, i) {
- "use strict";
- var n = t("./mesh-buffer"),
- r = cc.Class({
- name: "cc.QuadBuffer",
- extends: n,
- _fillQuadBuffer: function() {
- for (var t = this._initIDataCount / 6, e = this._iData, i = 0, n = 0; i < t; i++) {
- var r = 4 * i;
- e[n++] = r, e[n++] = r + 1, e[n++] = r + 2, e[n++] = r + 1, e[n++] = r + 3, e[n++] = r + 2
- }
- var s = new Uint16Array(this._iData.buffer, 0, 6 * t);
- this._ib.update(0, s)
- },
- uploadData: function() {
- if (0 !== this.byteOffset && this._dirty) {
- var t = new Float32Array(this._vData.buffer, 0, this.byteOffset >> 2);
- this._vb.update(0, t), this._dirty = !1
- }
- },
- switchBuffer: function() {
- this._super();
- var t = new Uint16Array(this._iData.buffer, 0, this._initIDataCount);
- this._ib.update(0, t)
- },
- _reallocBuffer: function() {
- this._reallocVData(!0), this._reallocIData(), this._fillQuadBuffer()
- }
- });
- cc.QuadBuffer = e.exports = r
- }), {
- "./mesh-buffer": 283
- }],
- 286: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = s;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./flex-buffer")),
- r = t("./vertex-format");
- function s() {
- this.vDatas = [], this.uintVDatas = [], this.iDatas = [], this.meshCount = 0, this._infos = null, this._flexBuffer = null
- }
- cc.js.mixin(s.prototype, {
- init: function(t) {},
- clear: function() {
- this.vDatas.length = 0, this.iDatas.length = 0, this.uintVDatas.length = 0, this.meshCount = 0, this._infos = null, this._flexBuffer && this._flexBuffer.reset()
- },
- updateMesh: function(t, e, i) {
- this.vDatas[t] = e, this.uintVDatas[t] = new Uint32Array(e.buffer, 0, e.length), this.iDatas[t] = i, this.meshCount = this.vDatas.length
- },
- updateMeshRange: function(t, e) {},
- createData: function(t, e, i) {
- var n = new Float32Array(e),
- r = new Uint16Array(i);
- this.updateMesh(t, n, r)
- },
- createQuadData: function(t, e, i) {
- this.createData(t, e, i), this.initQuadIndices(this.iDatas[t])
- },
- createFlexData: function(t, e, i, s) {
- s = s || r.vfmtPosUvColor, this._flexBuffer = new n.default(this, t, e, i, s)
- },
- initQuadIndices: function(t) {
- for (var e = t.length / 6, i = 0, n = 0; i < e; i++) {
- var r = 4 * i;
- t[n++] = r, t[n++] = r + 1, t[n++] = r + 2, t[n++] = r + 1, t[n++] = r + 3, t[n++] = r + 2
- }
- }
- }), cc.RenderData = s, e.exports = i.default
- }), {
- "./flex-buffer": 282,
- "./vertex-format": 288
- }],
- 287: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.SpineBuffer",
- extends: t("./mesh-buffer"),
- requestStatic: function(t, e) {
- this.checkAndSwitchBuffer(t);
- var i = this.byteOffset + t * this._vertexBytes,
- n = this.indiceOffset + e,
- r = this._vData.byteLength,
- s = this._iData.length;
- if (i > r || n > s) {
- for (; r < i || s < n;) this._initVDataCount *= 2, this._initIDataCount *= 2, r = 4 * this._initVDataCount, s = this._initIDataCount;
- this._reallocBuffer()
- }
- var o = this._offsetInfo;
- o.vertexOffset = this.vertexOffset, o.indiceOffset = this.indiceOffset, o.byteOffset = this.byteOffset
- },
- adjust: function(t, e) {
- this.vertexOffset += t, this.indiceOffset += e, this.byteOffset = this.byteOffset + t * this._vertexBytes, this._dirty = !0
- }
- });
- cc.SpineBuffer = e.exports = n
- }), {
- "./mesh-buffer": 283
- }],
- 288: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../../renderer/gfx"));
- var r = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 3
- }, {
- name: n.default.ATTR_UV0,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_COLOR,
- type: n.default.ATTR_TYPE_UINT8,
- num: 4,
- normalize: !0
- }]);
- r.name = "vfmt3D", n.default.VertexFormat.XYZ_UV_Color = r;
- var s = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_UV0,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_COLOR,
- type: n.default.ATTR_TYPE_UINT8,
- num: 4,
- normalize: !0
- }]);
- s.name = "vfmtPosUvColor", n.default.VertexFormat.XY_UV_Color = s;
- var o = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_UV0,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_COLOR,
- type: n.default.ATTR_TYPE_UINT8,
- num: 4,
- normalize: !0
- }, {
- name: n.default.ATTR_COLOR0,
- type: n.default.ATTR_TYPE_UINT8,
- num: 4,
- normalize: !0
- }]);
- o.name = "vfmtPosUvTwoColor", n.default.VertexFormat.XY_UV_Two_Color = o;
- var a = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_UV0,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }]);
- a.name = "vfmtPosUv", n.default.VertexFormat.XY_UV = a;
- var l = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }, {
- name: n.default.ATTR_COLOR,
- type: n.default.ATTR_TYPE_UINT8,
- num: 4,
- normalize: !0
- }]);
- l.name = "vfmtPosColor", n.default.VertexFormat.XY_Color = l;
- var h = new n.default.VertexFormat([{
- name: n.default.ATTR_POSITION,
- type: n.default.ATTR_TYPE_FLOAT32,
- num: 2
- }]);
- h.name = "vfmtPos", n.default.VertexFormat.XY = h, e.exports = {
- vfmt3D: r,
- vfmtPosUvColor: s,
- vfmtPosUvTwoColor: o,
- vfmtPosUv: a,
- vfmtPosColor: l,
- vfmtPos: h
- }
- }), {
- "../../../renderer/gfx": 360
- }],
- 289: [(function(t, e, i) {
- "use strict";
- t("../platform/CCSys");
- var n = /(\.[^\.\/\?\\]*)(\?.*)?$/,
- r = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/,
- s = /[^\.\/]+\/\.\.\//;
- cc.path = {
- join: function() {
- for (var t = arguments.length, e = "", i = 0; i < t; i++) e = (e + ("" === e ? "" : "/") + arguments[i]).replace(/(\/|\\\\)$/, "");
- return e
- },
- extname: function(t) {
- var e = n.exec(t);
- return e ? e[1] : ""
- },
- mainFileName: function(t) {
- if (t) {
- var e = t.lastIndexOf(".");
- if (-1 !== e) return t.substring(0, e)
- }
- return t
- },
- basename: function(t, e) {
- var i = t.indexOf("?");
- i > 0 && (t = t.substring(0, i));
- var n = /(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/, ""));
- if (!n) return null;
- var r = n[2];
- return e && t.substring(t.length - e.length).toLowerCase() === e.toLowerCase() ? r.substring(0, r.length - e.length) : r
- },
- dirname: function(t) {
- var e = r.exec(t);
- return e ? e[2] : ""
- },
- changeExtname: function(t, e) {
- e = e || "";
- var i = t.indexOf("?"),
- n = "";
- return i > 0 && (n = t.substring(i), t = t.substring(0, i)), (i = t.lastIndexOf(".")) < 0 ? t + e + n : t.substring(0, i) + e + n
- },
- changeBasename: function(t, e, i) {
- if (0 === e.indexOf(".")) return this.changeExtname(t, e);
- var n = t.indexOf("?"),
- r = "",
- s = i ? this.extname(t) : "";
- return n > 0 && (r = t.substring(n), t = t.substring(0, n)), n = (n = t.lastIndexOf("/")) <= 0 ? 0 : n + 1, t.substring(0, n) + e + s + r
- },
- _normalize: function(t) {
- var e = t = String(t);
- do {
- e = t, t = t.replace(s, "")
- } while (e.length !== t.length);
- return t
- },
- sep: cc.sys.os === cc.sys.OS_WINDOWS ? "\\" : "/",
- stripSep: function(t) {
- return t.replace(/[\/\\]$/, "")
- }
- }, e.exports = cc.path
- }), {
- "../platform/CCSys": 207
- }],
- 290: [(function(t, e, i) {
- "use strict";
- var n = function(t, e, i, n, r, s) {
- this.a = t, this.b = e, this.c = i, this.d = n, this.tx = r, this.ty = s
- };
- n.create = function(t, e, i, n, r, s) {
- return {
- a: t,
- b: e,
- c: i,
- d: n,
- tx: r,
- ty: s
- }
- }, n.identity = function() {
- return {
- a: 1,
- b: 0,
- c: 0,
- d: 1,
- tx: 0,
- ty: 0
- }
- }, n.clone = function(t) {
- return {
- a: t.a,
- b: t.b,
- c: t.c,
- d: t.d,
- tx: t.tx,
- ty: t.ty
- }
- }, n.concat = function(t, e, i) {
- var n = e.a,
- r = e.b,
- s = e.c,
- o = e.d,
- a = e.tx,
- l = e.ty;
- return t.a = n * i.a + r * i.c, t.b = n * i.b + r * i.d, t.c = s * i.a + o * i.c, t.d = s * i.b + o * i.d, t.tx = a * i.a + l * i.c + i.tx, t.ty = a * i.b + l * i.d + i.ty, t
- }, n.invert = function(t, e) {
- var i = e.a,
- n = e.b,
- r = e.c,
- s = e.d,
- o = 1 / (i * s - n * r),
- a = e.tx,
- l = e.ty;
- return t.a = o * s, t.b = -o * n, t.c = -o * r, t.d = o * i, t.tx = o * (r * l - s * a), t.ty = o * (n * a - i * l), t
- }, n.fromMat4 = function(t, e) {
- var i = e.m;
- return t.a = i[0], t.b = i[1], t.c = i[4], t.d = i[5], t.tx = i[12], t.ty = i[13], t
- }, n.transformVec2 = function(t, e, i, n) {
- var r, s;
- return void 0 === n ? (n = i, r = e.x, s = e.y) : (r = e, s = i), t.x = n.a * r + n.c * s + n.tx, t.y = n.b * r + n.d * s + n.ty, t
- }, n.transformSize = function(t, e, i) {
- return t.width = i.a * e.width + i.c * e.height, t.height = i.b * e.width + i.d * e.height, t
- }, n.transformRect = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = n + e.width,
- o = r + e.height,
- a = i.a * n + i.c * r + i.tx,
- l = i.b * n + i.d * r + i.ty,
- h = i.a * s + i.c * r + i.tx,
- c = i.b * s + i.d * r + i.ty,
- u = i.a * n + i.c * o + i.tx,
- _ = i.b * n + i.d * o + i.ty,
- f = i.a * s + i.c * o + i.tx,
- d = i.b * s + i.d * o + i.ty,
- p = Math.min(a, h, u, f),
- m = Math.max(a, h, u, f),
- y = Math.min(l, c, _, d),
- v = Math.max(l, c, _, d);
- return t.x = p, t.y = y, t.width = m - p, t.height = v - y, t
- }, n.transformObb = function(t, e, i, n, r, s) {
- var o = r.x,
- a = r.y,
- l = r.width,
- h = r.height,
- c = s.a * o + s.c * a + s.tx,
- u = s.b * o + s.d * a + s.ty,
- _ = s.a * l,
- f = s.b * l,
- d = s.c * h,
- p = s.d * h;
- e.x = c, e.y = u, i.x = _ + c, i.y = f + u, t.x = d + c, t.y = p + u, n.x = _ + d + c, n.y = f + p + u
- }, cc.AffineTransform = e.exports = n
- }), {}],
- 291: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/CCObject").Flags,
- r = t("./misc"),
- s = t("../platform/js"),
- o = t("../platform/id-generater"),
- a = t("../event-manager"),
- l = t("../renderer/render-flow"),
- h = n.Destroying,
- c = n.DontDestroy,
- u = n.Deactivating,
- _ = new o("Node");
- function f(t) {
- return t ? "string" == typeof t ? s.getClassByName(t) : t : (cc.errorID(3804), null)
- }
- function d(t, e) {
- if (e._sealed)
- for (var i = 0; i < t._components.length; ++i) {
- var n = t._components[i];
- if (n.constructor === e) return n
- } else
- for (var r = 0; r < t._components.length; ++r) {
- var s = t._components[r];
- if (s instanceof e) return s
- }
- return null
- }
- function p(t, e, i) {
- if (e._sealed)
- for (var n = 0; n < t._components.length; ++n) {
- var r = t._components[n];
- r.constructor === e && i.push(r)
- } else
- for (var s = 0; s < t._components.length; ++s) {
- var o = t._components[s];
- o instanceof e && i.push(o)
- }
- }
- function m(t, e) {
- for (var i = 0; i < t.length; ++i) {
- var n = t[i],
- r = d(n, e);
- if (r) return r;
- if (n._children.length > 0 && (r = m(n._children, e))) return r
- }
- return null
- }
- function y(t, e, i) {
- for (var n = 0; n < t.length; ++n) {
- var r = t[n];
- p(r, e, i), r._children.length > 0 && y(r._children, e, i)
- }
- }
- var v = cc.Class({
- name: "cc._BaseNode",
- extends: cc.Object,
- properties: {
- _parent: null,
- _children: [],
- _active: !0,
- _components: [],
- _prefab: null,
- _persistNode: {
- get: function() {
- return (this._objFlags & c) > 0
- },
- set: function(t) {
- t ? this._objFlags |= c : this._objFlags &= ~c
- }
- },
- name: {
- get: function() {
- return this._name
- },
- set: function(t) {
- this._name = t
- }
- },
- uuid: {
- get: function() {
- return this._id
- }
- },
- children: {
- get: function() {
- return this._children
- }
- },
- childrenCount: {
- get: function() {
- return this._children.length
- }
- },
- active: {
- get: function() {
- return this._active
- },
- set: function(t) {
- if (t = !!t, this._active !== t) {
- this._active = t;
- var e = this._parent;
- if (e) e._activeInHierarchy && cc.director._nodeActivator.activateNode(this, t)
- }
- }
- },
- activeInHierarchy: {
- get: function() {
- return this._activeInHierarchy
- }
- }
- },
- ctor: function(t) {
- this._name = void 0 !== t ? t : "New Node", this._activeInHierarchy = !1, this._id = _.getNewId(), cc.director._scheduler && cc.director._scheduler.enableForTarget(this), this.__eventTargets = []
- },
- getParent: function() {
- return this._parent
- },
- setParent: function(t) {
- if (this._parent !== t) {
- 0;
- var e = this._parent;
- if (this._parent = t || null, this._onSetParent(t), t && (a._setDirtyForNode(this), t._children.push(this), t.emit && t.emit("child-added", this), t._renderFlag |= l.FLAG_CHILDREN), e) {
- if (!(e._objFlags & h)) {
- var i = e._children.indexOf(this);
- 0, e._children.splice(i, 1), e.emit && e.emit("child-removed", this), this._onHierarchyChanged(e), 0 === e._children.length && (e._renderFlag &= ~l.FLAG_CHILDREN)
- }
- } else t && this._onHierarchyChanged(null)
- }
- },
- attr: function(t) {
- s.mixin(this, t)
- },
- getChildByUuid: function(t) {
- if (!t) return cc.log("Invalid uuid"), null;
- for (var e = this._children, i = 0, n = e.length; i < n; i++)
- if (e[i]._id === t) return e[i];
- return null
- },
- getChildByName: function(t) {
- if (!t) return cc.log("Invalid name"), null;
- for (var e = this._children, i = 0, n = e.length; i < n; i++)
- if (e[i]._name === t) return e[i];
- return null
- },
- addChild: function(t) {
- cc.assertID(t, 1606), cc.assertID(null === t._parent, 1605), t.setParent(this)
- },
- insertChild: function(t, e) {
- t.parent = this, t.setSiblingIndex(e)
- },
- getSiblingIndex: function() {
- return this._parent ? this._parent._children.indexOf(this) : 0
- },
- setSiblingIndex: function(t) {
- if (this._parent)
- if (this._parent._objFlags & u) cc.errorID(3821);
- else {
- var e = this._parent._children;
- t = -1 !== t ? t : e.length - 1;
- var i = e.indexOf(this);
- t !== i && (e.splice(i, 1), t < e.length ? e.splice(t, 0, this) : e.push(this), this._onSiblingIndexChanged && this._onSiblingIndexChanged(t))
- }
- },
- walk: function(t, e) {
- var i, n, r, s, o = cc._BaseNode,
- a = 1,
- l = o._stacks[o._stackId];
- l || (l = [], o._stacks.push(l)), o._stackId++, l.length = 0, l[0] = this;
- var h = null;
- for (s = !1; a;)
- if (n = l[--a])
- if (!s && t ? t(n) : s && e && e(n), l[a] = null, s) {
- if (s = !1, i)
- if (i[++r]) l[a] = i[r], a++;
- else if (h && (l[a] = h, a++, s = !0, h._parent ? (r = (i = h._parent._children).indexOf(h), h = h._parent) : (h = null, i = null), r < 0)) break
- } else n._children.length > 0 ? (h = n, i = n._children, r = 0, l[a] = i[r], a++) : (l[a] = n, a++, s = !0);
- l.length = 0, o._stackId--
- },
- cleanup: function() {},
- removeFromParent: function(t) {
- this._parent && (void 0 === t && (t = !0), this._parent.removeChild(this, t))
- },
- removeChild: function(t, e) {
- this._children.indexOf(t) > -1 && ((e || void 0 === e) && t.cleanup(), t.parent = null)
- },
- removeAllChildren: function(t) {
- var e = this._children;
- void 0 === t && (t = !0);
- for (var i = e.length - 1; i >= 0; i--) {
- var n = e[i];
- n && (t && n.cleanup(), n.parent = null)
- }
- this._children.length = 0
- },
- isChildOf: function(t) {
- var e = this;
- do {
- if (e === t) return !0;
- e = e._parent
- } while (e);
- return !1
- },
- getComponent: function(t) {
- var e = f(t);
- return e ? d(this, e) : null
- },
- getComponents: function(t) {
- var e = f(t),
- i = [];
- return e && p(this, e, i), i
- },
- getComponentInChildren: function(t) {
- var e = f(t);
- return e ? m(this._children, e) : null
- },
- getComponentsInChildren: function(t) {
- var e = f(t),
- i = [];
- return e && (p(this, e, i), y(this._children, e, i)), i
- },
- _checkMultipleComp: !1,
- addComponent: function(t) {
- var e;
- if ("string" == typeof t) {
- if (!(e = s.getClassByName(t))) return cc.errorID(3807, t), cc._RFpeek() && cc.errorID(3808, t), null
- } else {
- if (!t) return cc.errorID(3804), null;
- e = t
- }
- if ("function" != typeof e) return cc.errorID(3809), null;
- if (!s.isChildClassOf(e, cc.Component)) return cc.errorID(3810), null;
- var i = e._requireComponent;
- if (i && !this.getComponent(i) && !this.addComponent(i)) return null;
- var n = new e;
- return n.node = this, this._components.push(n), this._activeInHierarchy && cc.director._nodeActivator.activateComp(n), n
- },
- _addComponentAt: !1,
- removeComponent: function(t) {
- t ? (t instanceof cc.Component || (t = this.getComponent(t)), t && t.destroy()) : cc.errorID(3813)
- },
- _getDependComponent: !1,
- _removeComponent: function(t) {
- if (t) {
- if (!(this._objFlags & h)) {
- var e = this._components.indexOf(t); - 1 !== e ? this._components.splice(e, 1) : t.node !== this && cc.errorID(3815)
- }
- } else cc.errorID(3814)
- },
- destroy: function() {
- cc.Object.prototype.destroy.call(this) && (this.active = !1)
- },
- destroyAllChildren: function() {
- for (var t = this._children, e = 0; e < t.length; ++e) t[e].destroy()
- },
- _onSetParent: function(t) {},
- _onPostActivated: function() {},
- _onBatchRestored: function() {},
- _onBatchCreated: function() {},
- _onHierarchyChanged: function(t) {
- var e = this._parent;
- !this._persistNode || e instanceof cc.Scene || cc.game.removePersistRootNode(this);
- var i = this._active && !(!e || !e._activeInHierarchy);
- this._activeInHierarchy !== i && cc.director._nodeActivator.activateNode(this, i)
- },
- _instantiate: function(t) {
- t || (t = cc.instantiate._clone(this, this));
- var e = this._prefab;
- e && this === e.root && e.sync;
- return t._parent = null, t._onBatchRestored(), t
- },
- _registerIfAttached: !1,
- _onPreDestroy: function() {
- var t, e;
- this._objFlags |= h;
- var i = this._parent,
- n = i && i._objFlags & h;
- var r = this._children;
- for (t = 0, e = r.length; t < e; ++t) r[t]._destroyImmediate();
- for (t = 0, e = this._components.length; t < e; ++t) {
- this._components[t]._destroyImmediate()
- }
- var s = this.__eventTargets;
- for (t = 0, e = s.length; t < e; ++t) {
- var o = s[t];
- o && o.targetOff(this)
- }
- if (s.length = 0, this._persistNode && cc.game.removePersistRootNode(this), !n && i) {
- var a = i._children.indexOf(this);
- i._children.splice(a, 1), i.emit && i.emit("child-removed", this)
- }
- return n
- },
- onRestore: !1
- });
- v.idGenerater = _, v._stacks = [
- []
- ], v._stackId = 0, v.prototype._onPreDestroyBase = v.prototype._onPreDestroy, v.prototype._onHierarchyChangedBase = v.prototype._onHierarchyChanged;
- r.propertyDefine(v, ["parent", "name", "children", "childrenCount"], {}), cc._BaseNode = e.exports = v
- }), {
- "../event-manager": 129,
- "../platform/CCObject": 204,
- "../platform/id-generater": 214,
- "../platform/js": 218,
- "../renderer/render-flow": 248,
- "./misc": 300
- }],
- 292: [(function(t, e, i) {
- "use strict";
- var n = 1e-6;
- e.exports = {
- binarySearchEpsilon: function(t, e) {
- for (var i = 0, r = t.length - 1, s = r >>> 1; i <= r; s = i + r >>> 1) {
- var o = t[s];
- if (o > e + n) r = s - 1;
- else {
- if (!(o < e - n)) return s;
- i = s + 1
- }
- }
- return ~i
- }
- }
- }), {}],
- 293: [(function(t, e, i) {
- "use strict";
- var n = t("../components/CCRenderComponent"),
- r = t("../platform/CCMacro").BlendFactor,
- s = t("../../renderer/gfx"),
- o = cc.Class({
- properties: {
- _srcBlendFactor: r.SRC_ALPHA,
- _dstBlendFactor: r.ONE_MINUS_SRC_ALPHA,
- srcBlendFactor: {
- get: function() {
- return this._srcBlendFactor
- },
- set: function(t) {
- this._srcBlendFactor !== t && (this._srcBlendFactor = t, this._updateBlendFunc())
- },
- animatable: !1,
- type: r,
- tooltip: !1,
- visible: !0
- },
- dstBlendFactor: {
- get: function() {
- return this._dstBlendFactor
- },
- set: function(t) {
- this._dstBlendFactor !== t && (this._dstBlendFactor = t, this._updateBlendFunc())
- },
- animatable: !1,
- type: r,
- tooltip: !1,
- visible: !0
- }
- },
- setMaterial: function(t, e) {
- this._materials[t] !== e && (n.prototype.setMaterial.call(this, t, e), e && this._updateMaterialBlendFunc(e))
- },
- _updateBlendFunc: function() {
- for (var t = this._materials, e = 0; e < t.length; e++) {
- var i = t[e];
- this._updateMaterialBlendFunc(i)
- }
- },
- _updateMaterialBlendFunc: function(t) {
- t.effect.setBlend(!0, s.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor, s.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor), t.setDirty(!0)
- }
- });
- e.exports = cc.BlendFunc = o
- }), {
- "../../renderer/gfx": 360,
- "../components/CCRenderComponent": 106,
- "../platform/CCMacro": 203
- }],
- 294: [(function(t, e, i) {
- "use strict";
- var n = t("./misc").BASE64_VALUES,
- r = "0123456789abcdef".split(""),
- s = ["", "", "", ""],
- o = s.concat(s, "-", s, "-", s, "-", s, "-", s, s, s),
- a = o.map((function(t, e) {
- return "-" === t ? NaN : e
- })).filter(isFinite);
- e.exports = function(t) {
- if (22 !== t.length) return t;
- o[0] = t[0], o[1] = t[1];
- for (var e = 2, i = 2; e < 22; e += 2) {
- var s = n[t.charCodeAt(e)],
- l = n[t.charCodeAt(e + 1)];
- o[a[i++]] = r[s >> 2], o[a[i++]] = r[(3 & s) << 2 | l >> 4], o[a[i++]] = r[15 & l]
- }
- return o.join("")
- }
- }), {
- "./misc": 300
- }],
- 295: [(function(t, e, i) {
- "use strict";
- cc.find = e.exports = function(t, e) {
- if (null == t) return cc.errorID(5600), null;
- if (e) 0;
- else {
- var i = cc.director.getScene();
- if (!i) return null;
- e = i
- }
- for (var n = e, r = "/" !== t[0] ? 0 : 1, s = t.split("/"), o = r; o < s.length; o++) {
- var a = s[o],
- l = n._children;
- n = null;
- for (var h = 0, c = l.length; h < c; ++h) {
- var u = l[h];
- if (u.name === a) {
- n = u;
- break
- }
- }
- if (!n) return null
- }
- return n
- }
- }), {}],
- 296: [(function(t, e, i) {
- "use strict";
- var n = t("../assets/material/CCMaterial"),
- r = cc.Class({
- properties: {
- _normalMaterial: null,
- normalMaterial: {
- get: function() {
- return this._normalMaterial
- },
- set: function(t) {
- this._normalMaterial = t, this._updateDisabledState && this._updateDisabledState()
- },
- type: n,
- tooltip: !1,
- animatable: !1
- },
- _grayMaterial: null,
- grayMaterial: {
- get: function() {
- return this._grayMaterial
- },
- set: function(t) {
- this._grayMaterial = t, this._updateDisabledState && this._updateDisabledState()
- },
- type: n,
- tooltip: !1,
- animatable: !1
- }
- },
- _switchGrayMaterial: function(t, e) {
- if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
- var i = void 0;
- t ? ((i = this._grayMaterial) || (i = n.getBuiltinMaterial("2d-gray-sprite")), i = this._grayMaterial = n.getInstantiatedMaterial(i, e)) : ((i = this._normalMaterial) || (i = n.getBuiltinMaterial("2d-sprite", e)), i = this._normalMaterial = n.getInstantiatedMaterial(i, e)), e.setMaterial(0, i)
- }
- }
- });
- e.exports = r
- }), {
- "../assets/material/CCMaterial": 75
- }],
- 297: [(function(t, e, i) {
- "use strict";
- var n = /^(click)(\s)*=|(param)(\s)*=/,
- r = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,
- s = function() {
- this._parsedObject = {}, this._specialSymbolArray = [], this._specialSymbolArray.push([/</g, "<"]), this._specialSymbolArray.push([/>/g, ">"]), this._specialSymbolArray.push([/&/g, "&"]), this._specialSymbolArray.push([/"/g, '"']), this._specialSymbolArray.push([/'/g, "'"])
- };
- s.prototype = {
- constructor: s,
- parse: function(t) {
- this._resultObjectArray = [], this._stack = [];
- for (var e = 0, i = t.length; e < i;) {
- var n = t.indexOf("<", e);
- if (n < 0) this._stack.pop(), this._processResult(t.substring(e)), e = i;
- else {
- this._processResult(t.substring(e, n));
- var r = t.indexOf(">", e); - 1 === r ? r = n : "/" === t.charAt(n + 1) ? this._stack.pop() : this._addToStack(t.substring(n + 1, r)), e = r + 1
- }
- }
- return this._resultObjectArray
- },
- _attributeToObject: function(t) {
- var e, i, n, s, o = {},
- a = (t = t.trim()).match(/^(color|size)(\s)*=/);
- if (a) {
- if (e = a[0], "" === (t = t.substring(e.length).trim())) return o;
- switch (i = t.indexOf(" "), e[0]) {
- case "c":
- o.color = i > -1 ? t.substring(0, i).trim() : t;
- break;
- case "s":
- o.size = parseInt(t)
- }
- return i > -1 && (s = t.substring(i + 1).trim(), n = this._processEventHandler(s), o.event = n), o
- }
- if ((a = t.match(/^(br(\s)*\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("br") && "/" === e[e.length - 1]) return o.isNewLine = !0, this._resultObjectArray.push({
- text: "",
- style: {
- newline: !0
- }
- }), o;
- if ((a = t.match(/^(img(\s)*src(\s)*=[^>]+\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("img") && "/" === e[e.length - 1]) {
- var l;
- a = t.match(r);
- for (var h = !1; a;) e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length), u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), t = l.substring(i).trim(), "src" === e ? (o.isImage = !0, u.endsWith("/") && (u = u.substring(0, u.length - 1)), 0 === u.indexOf("'") ? (h = !0, u = u.substring(1, u.length - 1)) : 0 === u.indexOf('"') && (h = !0, u = u.substring(1, u.length - 1)), o.src = u) : "height" === e ? o.imageHeight = parseInt(u) : "width" === e ? o.imageWidth = parseInt(u) : "click" === e && (o.event = this._processEventHandler(e + "=" + u)), o.event && "param" === e && (o.event.param = u.replace(/^\"|\"$/g, "")), a = t.match(r);
- return h && o.isImage && this._resultObjectArray.push({
- text: "",
- style: o
- }), {}
- }
- if (a = t.match(/^(outline(\s)*[^>]*)/)) {
- var c = {
- color: "#ffffff",
- width: 1
- };
- if (t = a[0].substring("outline".length).trim()) {
- var u, _ = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
- for (a = t.match(_); a;) e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length), u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), t = l.substring(i).trim(), "click" === e ? o.event = this._processEventHandler(e + "=" + u) : "color" === e ? c.color = u : "width" === e && (c.width = parseInt(u)), o.event && "param" === e && (o.event.param = u.replace(/^\"|\"$/g, "")), a = t.match(_)
- }
- o.outline = c
- }
- if ((a = t.match(/^(on|u|b|i)(\s)*/)) && a[0].length > 0) {
- switch (e = a[0], t = t.substring(e.length).trim(), e[0]) {
- case "u":
- o.underline = !0;
- break;
- case "i":
- o.italic = !0;
- break;
- case "b":
- o.bold = !0
- }
- if ("" === t) return o;
- n = this._processEventHandler(t), o.event = n
- }
- return o
- },
- _processEventHandler: function(t) {
- for (var e = 0, i = {}, r = t.match(n), s = !1; r;) {
- var o = r[0],
- a = "";
- if (s = !1, '"' === (t = t.substring(o.length).trim()).charAt(0))(e = t.indexOf('"', 1)) > -1 && (a = t.substring(1, e).trim(), s = !0), e++;
- else if ("'" === t.charAt(0))(e = t.indexOf("'", 1)) > -1 && (a = t.substring(1, e).trim(), s = !0), e++;
- else {
- var l = t.match(/(\S)+/);
- e = (a = l ? l[0] : "").length
- }
- s && (i[o = o.substring(0, o.length - 1).trim()] = a), r = (t = t.substring(e).trim()).match(n)
- }
- return i
- },
- _addToStack: function(t) {
- var e = this._attributeToObject(t);
- if (0 === this._stack.length) this._stack.push(e);
- else {
- if (e.isNewLine || e.isImage) return;
- var i = this._stack[this._stack.length - 1];
- for (var n in i) e[n] || (e[n] = i[n]);
- this._stack.push(e)
- }
- },
- _processResult: function(t) {
- "" !== t && (t = this._escapeSpecialSymbol(t), this._stack.length > 0 ? this._resultObjectArray.push({
- text: t,
- style: this._stack[this._stack.length - 1]
- }) : this._resultObjectArray.push({
- text: t
- }))
- },
- _escapeSpecialSymbol: function(t) {
- for (var e = 0; e < this._specialSymbolArray.length; ++e) {
- var i = this._specialSymbolArray[e][0],
- n = this._specialSymbolArray[e][1];
- t = t.replace(i, n)
- }
- return t
- }
- }, e.exports = s
- }), {}],
- 298: [(function(t, e, i) {
- "use strict";
- t("./CCPath"), t("./profiler/CCProfiler"), t("./find"), t("./mutable-forward-iterator")
- }), {
- "./CCPath": 289,
- "./find": 295,
- "./mutable-forward-iterator": 301,
- "./profiler/CCProfiler": 304
- }],
- 299: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.postLoadMesh = function(t, e) {
- if (t.loaded || !t.nativeUrl) return void(e && e());
- cc.loader.load(t.nativeUrl, (function(i, n) {
- n && (t._nativeAsset = n), e && e(i)
- }))
- }
- }), {}],
- 300: [(function(t, e, i) {
- "use strict";
- for (var n = t("../platform/js"), r = {
- propertyDefine: function(t, e, i) {
- function r(t, e, i, r) {
- var s = Object.getOwnPropertyDescriptor(t, e);
- if (s) s.get && (t[i] = s.get), s.set && r && (t[r] = s.set);
- else {
- var o = t[i];
- n.getset(t, e, o, t[r])
- }
- }
- for (var s, o = t.prototype, a = 0; a < e.length; a++) {
- var l = (s = e[a])[0].toUpperCase() + s.slice(1);
- r(o, s, "get" + l, "set" + l)
- }
- for (s in i) {
- var h = i[s];
- r(o, s, h[0], h[1])
- }
- },
- NextPOT: function(t) {
- return t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, (t |= t >> 16) + 1
- },
- BUILTIN_CLASSID_RE: /^(?:cc|dragonBones|sp|ccsg)\..+/
- }, s = new Array(123), o = 0; o < 123; ++o) s[o] = 64;
- for (var a = 0; a < 64; ++a) s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(a)] = a;
- r.BASE64_VALUES = s, r.pushToMap = function(t, e, i, n) {
- var r = t[e];
- r ? Array.isArray(r) ? n ? (r.push(r[0]), r[0] = i) : r.push(i) : t[e] = n ? [i, r] : [r, i] : t[e] = i
- }, r.clampf = function(t, e, i) {
- if (e > i) {
- var n = e;
- e = i, i = n
- }
- return t < e ? e : t < i ? t : i
- }, r.clamp01 = function(t) {
- return t < 0 ? 0 : t < 1 ? t : 1
- }, r.lerp = function(t, e, i) {
- return t + (e - t) * i
- }, r.degreesToRadians = function(t) {
- return t * cc.macro.RAD
- }, r.radiansToDegrees = function(t) {
- return t * cc.macro.DEG
- }, cc.misc = e.exports = r
- }), {
- "../platform/js": 218
- }],
- 301: [(function(t, e, i) {
- "use strict";
- function n(t) {
- this.i = 0, this.array = t
- }
- var r = n.prototype;
- r.remove = function(t) {
- var e = this.array.indexOf(t);
- e >= 0 && this.removeAt(e)
- }, r.removeAt = function(t) {
- this.array.splice(t, 1), t <= this.i && --this.i
- }, r.fastRemove = function(t) {
- var e = this.array.indexOf(t);
- e >= 0 && this.fastRemoveAt(e)
- }, r.fastRemoveAt = function(t) {
- var e = this.array;
- e[t] = e[e.length - 1], --e.length, t <= this.i && --this.i
- }, r.push = function(t) {
- this.array.push(t)
- }, e.exports = n
- }), {}],
- 302: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t() {
- n(this, t), this.enabled = !1, this.count = 0, this.maxSize = 1024
- }
- return t.prototype.get = function() {}, t.prototype.put = function() {}, t.prototype.clear = function() {}, t
- })();
- i.default = r, cc.pool = {}, r.register = function(t, e) {
- cc.pool[t] = e
- }, e.exports = i.default
- }), {}],
- 303: [(function(t, e, i) {
- "use strict";
- t("../vmath");
- cc._PrefabInfo = cc.Class({
- name: "cc.PrefabInfo",
- properties: {
- root: null,
- asset: null,
- fileId: "",
- sync: !1,
- _synced: {
- default: !1,
- serializable: !1
- }
- }
- }), e.exports = {
- syncWithPrefab: function(t) {
- var e = t._prefab;
- if (e._synced = !0, !e.asset) return cc.errorID(3701, t.name), void(t._prefab = null);
- var i = t._objFlags,
- n = t._parent,
- r = t._id,
- s = t._name,
- o = t._active,
- a = t._eulerAngles.x,
- l = t._eulerAngles.y,
- h = t._eulerAngles.z,
- c = t._localZOrder,
- u = t._globalZOrder,
- _ = t._trs,
- f = _[0],
- d = _[1],
- p = _[2];
- cc.game._isCloning = !0, e.asset._doInstantiate(t), cc.game._isCloning = !1, t._objFlags = i, t._parent = n, t._id = r, t._prefab = e, t._name = s, t._active = o, t._localZOrder = c, t._globalZOrder = u, (_ = t._trs)[0] = f, _[1] = d, _[2] = p, t._eulerAngles.x = a, t._eulerAngles.y = l, t._eulerAngles.z = h
- }
- }
- }), {
- "../vmath": 326
- }],
- 304: [(function(t, e, i) {
- "use strict";
- var n = t("../../platform/CCMacro"),
- r = t("./perf-counter"),
- s = !1,
- o = 15,
- a = null,
- l = null,
- h = null;
- function c() {
- if (!a) {
- a = {
- frame: {
- desc: "Frame time (ms)",
- min: 0,
- max: 50,
- average: 500
- },
- fps: {
- desc: "Framerate (FPS)",
- below: 30,
- average: 500
- },
- draws: {
- desc: "Draw call"
- },
- logic: {
- desc: "Game Logic (ms)",
- min: 0,
- max: 50,
- average: 500,
- color: "#080"
- },
- render: {
- desc: "Renderer (ms)",
- min: 0,
- max: 50,
- average: 500,
- color: "#f90"
- },
- mode: {
- desc: cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WebGL" : "Canvas",
- min: 1
- }
- };
- var t = performance.now();
- for (var e in a) a[e]._counter = new r(e, a[e], t)
- }
- }
- function u() {
- if (!l || !l.isValid) {
- (l = new cc.Node("PROFILER-NODE")).x = l.y = 10, l.groupIndex = cc.Node.BuiltinGroupIndex.DEBUG, cc.Camera._setupDebugCamera(), l.zIndex = n.MAX_ZINDEX, cc.game.addPersistRootNode(l);
- var t = new cc.Node("LEFT-PANEL");
- t.anchorX = t.anchorY = 0;
- var e = t.addComponent(cc.Label);
- e.fontSize = o, e.lineHeight = o, t.parent = l;
- var i = new cc.Node("RIGHT-PANEL");
- i.anchorX = 1, i.anchorY = 0, i.x = 200;
- var r = i.addComponent(cc.Label);
- r.horizontalAlign = cc.Label.HorizontalAlign.RIGHT, r.fontSize = o, r.lineHeight = o, i.parent = l, cc.sys.browserType !== cc.sys.BROWSER_TYPE_BAIDU_GAME_SUB && cc.sys.browserType !== cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB && (e.cacheMode = cc.Label.CacheMode.CHAR, r.cacheMode = cc.Label.CacheMode.CHAR), h = {
- left: e,
- right: r
- }
- }
- }
- function _() {
- u();
- var t = cc.director._lastUpdate;
- a.frame._counter.start(t), a.logic._counter.start(t)
- }
- function f() {
- var t = performance.now();
- cc.director.isPaused() ? a.frame._counter.start(t) : a.logic._counter.end(t), a.render._counter.start(t)
- }
- function d() {
- var t = performance.now();
- a.render._counter.end(t), a.draws._counter.value = cc.renderer.drawCalls, a.frame._counter.end(t), a.fps._counter.frame(t);
- var e = "",
- i = "";
- for (var n in a) {
- var r = a[n];
- r._counter.sample(t), e += r.desc + "\n", i += r._counter.human() + "\n"
- }
- h && (h.left.string = e, h.right.string = i)
- }
- cc.profiler = e.exports = {
- isShowingStats: function() {
- return s
- },
- hideStats: function() {
- s && (l && (l.active = !1), cc.director.off(cc.Director.EVENT_BEFORE_UPDATE, _), cc.director.off(cc.Director.EVENT_AFTER_UPDATE, f), cc.director.off(cc.Director.EVENT_AFTER_DRAW, d), s = !1)
- },
- showStats: function() {
- s || (c(), l && (l.active = !0), cc.director.on(cc.Director.EVENT_BEFORE_UPDATE, _), cc.director.on(cc.Director.EVENT_AFTER_UPDATE, f), cc.director.on(cc.Director.EVENT_AFTER_DRAW, d), s = !0)
- }
- }
- }), {
- "../../platform/CCMacro": 203,
- "./perf-counter": 306
- }],
- 305: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.Counter",
- ctor: function(t, e, i) {
- this._id = t, this._opts = e || {}, this._value = 0, this._total = 0, this._averageValue = 0, this._accumValue = 0, this._accumSamples = 0, this._accumStart = i
- },
- properties: {
- value: {
- get: function() {
- return this._value
- },
- set: function(t) {
- this._value = t
- }
- }
- },
- _average: function(t, e) {
- if (this._opts.average) {
- this._accumValue += t, ++this._accumSamples;
- var i = e;
- i - this._accumStart >= this._opts.average && (this._averageValue = this._accumValue / this._accumSamples, this._accumValue = 0, this._accumStart = i, this._accumSamples = 0)
- }
- },
- sample: function(t) {
- this._average(this._value, t)
- },
- human: function() {
- var t = this._opts.average ? this._averageValue : this._value;
- return Math.round(100 * t) / 100
- },
- alarm: function() {
- return this._opts.below && this._value < this._opts.below || this._opts.over && this._value > this._opts.over
- }
- });
- e.exports = n
- }), {}],
- 306: [(function(t, e, i) {
- "use strict";
- var n = t("./counter"),
- r = cc.Class({
- name: "cc.PerfCounter",
- extends: n,
- ctor: function(t, e, i) {
- this._time = i
- },
- start: function(t) {
- this._time = t
- },
- end: function(t) {
- this._value = t - this._time, this._average(this._value)
- },
- tick: function() {
- this.end(), this.start()
- },
- frame: function(t) {
- var e = t,
- i = e - this._time;
- this._total++, i > (this._opts.average || 1e3) && (this._value = 1e3 * this._total / i, this._total = 0, this._time = e, this._average(this._value))
- }
- });
- e.exports = r
- }), {
- "./counter": 305
- }],
- 307: [(function(t, e, i) {
- "use strict";
- var n = .26;
- var r = {
- BASELINE_RATIO: n,
- MIDDLE_RATIO: (n + 1) / 2 - n,
- label_wordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430-\u044f\u0410-\u042f\u0401\u0451]+|\S)/,
- label_symbolRex: /^[!,.:;'}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/,
- label_lastWordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+|\S)$/,
- label_lastEnglish: /[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+$/,
- label_firstEnglish: /^[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]/,
- label_firstEmoji: /^[\uD83C\uDF00-\uDFFF\uDC00-\uDE4F]/,
- label_lastEmoji: /([\uDF00-\uDFFF\uDC00-\uDE4F]+|\S)$/,
- label_wrapinspection: !0,
- __CHINESE_REG: /^[\u4E00-\u9FFF\u3400-\u4DFF]+$/,
- __JAPANESE_REG: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g,
- __KOREAN_REG: /^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/,
- isUnicodeCJK: function(t) {
- return this.__CHINESE_REG.test(t) || this.__JAPANESE_REG.test(t) || this.__KOREAN_REG.test(t)
- },
- isUnicodeSpace: function(t) {
- return (t = t.charCodeAt(0)) >= 9 && t <= 13 || 32 === t || 133 === t || 160 === t || 5760 === t || t >= 8192 && t <= 8202 || 8232 === t || 8233 === t || 8239 === t || 8287 === t || 12288 === t
- },
- safeMeasureText: function(t, e) {
- var i = t.measureText(e);
- return i && i.width || 0
- },
- fragmentText: function(t, e, i, n) {
- var r = [];
- if (0 === t.length || i < 0) return r.push(""), r;
- for (var s = t; e > i && s.length > 1;) {
- for (var o = s.length * (i / e) | 0, a = s.substring(o), l = e - n(a), h = a, c = 0, u = 0; l > i && u++ < 10;) o *= i / l, o |= 0, l = e - n(a = s.substring(o));
- for (u = 0; l <= i && u++ < 10;) {
- if (a) {
- var _ = this.label_wordRex.exec(a);
- c = _ ? _[0].length : 1, h = a
- }
- o += c, l = e - n(a = s.substring(o))
- }
- 0 === (o -= c) && (o = 1, h = h.substring(1));
- var f, d = s.substring(0, 0 + o);
- this.label_wrapinspection && this.label_symbolRex.test(h || a) && (0 === (o -= (f = this.label_lastWordRex.exec(d)) ? f[0].length : 0) && (o = 1), h = s.substring(o), d = s.substring(0, 0 + o)), this.label_firstEmoji.test(h) && (f = this.label_lastEmoji.exec(d)) && d !== f[0] && (o -= f[0].length, h = s.substring(o), d = s.substring(0, 0 + o)), this.label_firstEnglish.test(h) && (f = this.label_lastEnglish.exec(d)) && d !== f[0] && (o -= f[0].length, h = s.substring(o), d = s.substring(0, 0 + o)), 0 === r.length ? r.push(d) : (d = d.trimLeft()).length > 0 && r.push(d), e = n(s = h || a)
- }
- return 0 === r.length ? r.push(s) : (s = s.trimLeft()).length > 0 && r.push(s), r
- }
- };
- cc.textUtils = e.exports = r
- }), {}],
- 308: [(function(t, e, i) {
- "use strict";
- var n = t("../assets/CCTexture2D"),
- r = {
- loadImage: function(t, e, i) {
- cc.assertID(t, 3103);
- var r = cc.loader.getRes(t);
- return r ? r.loaded ? (e && e.call(i, null, r), r) : (r.once("load", (function() {
- e && e.call(i, null, r)
- }), i), r) : ((r = new n).url = t, cc.loader.load({
- url: t,
- texture: r
- }, (function(t, n) {
- if (t) return e && e.call(i, t || new Error("Unknown error"));
- n.handleLoadedTexture(), e && e.call(i, null, n)
- })), r)
- },
- cacheImage: function(t, e) {
- if (t && e) {
- var i = new n;
- i.initWithElement(e);
- var r = {
- id: t,
- url: t,
- error: null,
- content: i,
- complete: !1
- };
- return cc.loader.flowOut(r), i
- }
- },
- postLoadTexture: function(t, e) {
- t.loaded ? e && e() : t.url ? cc.loader.load({
- url: t.url,
- skips: ["Loader"]
- }, (function(i, n) {
- n && (t.loaded || (t._nativeAsset = n)), e && e(i)
- })) : e && e()
- }
- };
- cc.textureUtil = e.exports = r
- }), {
- "../assets/CCTexture2D": 73
- }],
- 309: [(function(t, e, i) {
- "use strict";
- var n = t("./node-unit"),
- r = t("./node-mem-pool");
- e.exports = {
- NodeMemPool: new r(n)
- }
- }), {
- "./node-mem-pool": 311,
- "./node-unit": 312
- }],
- 310: [(function(t, e, i) {
- "use strict";
- var n = function(t) {
- this._unitClass = t, this._pool = [], this._findOrder = []
- },
- r = n.prototype;
- r._initNative = function() {
- this._nativeMemPool = new renderer.MemPool
- }, r._buildUnit = function(t) {
- var e = new this._unitClass(t, this);
- return e
- }, r._destroyUnit = function(t) {
- this._pool[t] = null;
- for (var e = 0, i = this._findOrder.length; e < i; e++) {
- var n = this._findOrder[e];
- if (n && n.unitID == t) {
- this._findOrder.splice(e, 1);
- break
- }
- }
- }, r._findUnitID = function() {
- for (var t = 0, e = this._pool; e[t];) t++;
- return t
- }, r.pop = function() {
- for (var t = null, e = 0, i = this._findOrder, n = this._pool, r = i.length; e < r; e++) {
- var s = i[e];
- if (s && s.hasSpace()) {
- t = s;
- break
- }
- }
- if (!t) {
- var o = this._findUnitID();
- t = this._buildUnit(o), n[o] = t, i.push(t), e = i.length - 1
- }
- var a = i[0];
- return a !== t && (i[0] = t, i[e] = a), t.pop()
- }, r.push = function(t) {
- var e = this._pool[t.unitID];
- return e.push(t.index), this._findOrder.length > 1 && e.isAllFree() && this._destroyUnit(t.unitID), e
- }, e.exports = n
- }), {}],
- 311: [(function(t, e, i) {
- "use strict";
- var n = t("./mem-pool"),
- r = function(t) {
- n.call(this, t)
- };
- (function() {
- var t = function() {};
- t.prototype = n.prototype, r.prototype = new t
- })();
- var s = r.prototype;
- s._initNative = function() {
- this._nativeMemPool = new renderer.NodeMemPool
- }, s._destroyUnit = function(t) {
- n.prototype._destroyUnit.call(this, t)
- }, e.exports = r
- }), {
- "./mem-pool": 310
- }],
- 312: [(function(t, e, i) {
- "use strict";
- var n = t("../../vmath/utils"),
- r = (Uint32Array, 10 * n.FLOAT_BYTES),
- s = 16 * n.FLOAT_BYTES,
- o = 16 * n.FLOAT_BYTES,
- a = (Uint32Array, Uint32Array, Int32Array, Uint8Array, Uint8Array, Uint32Array, n.FLOAT_BYTES, t("./unit-base")),
- l = function(t, e) {
- a.call(this, t, e);
- var i = this._contentNum;
- this.trsList = new n.FLOAT_ARRAY_TYPE(10 * i), this.localMatList = new n.FLOAT_ARRAY_TYPE(16 * i), this.worldMatList = new n.FLOAT_ARRAY_TYPE(16 * i);
- for (var l = 0; l < i; l++) {
- var h = this._spacesData[l];
- h.trs = new n.FLOAT_ARRAY_TYPE(this.trsList.buffer, l * r, 10), h.localMat = new n.FLOAT_ARRAY_TYPE(this.localMatList.buffer, l * s, 16), h.worldMat = new n.FLOAT_ARRAY_TYPE(this.worldMatList.buffer, l * o, 16)
- }
- };
- (function() {
- var t = function() {};
- t.prototype = a.prototype, l.prototype = new t
- })(), e.exports = l
- }), {
- "../../vmath/utils": 333,
- "./unit-base": 313
- }],
- 313: [(function(t, e, i) {
- "use strict";
- var n = function(t, e, i) {
- i = i || 128, this.unitID = t, this._memPool = e, this._data = new Uint16Array(2), this._data[0] = 0, this._data[1] = 0, this._contentNum = i, this._signData = new Uint16Array(2 * this._contentNum), this._spacesData = [];
- for (var n = 0; n < i; n++) {
- var r = 2 * n;
- this._signData[r + 0] = n + 1, this._signData[r + 1] = 0, this._spacesData[n] = {
- index: n,
- unitID: t
- }
- }
- this._signData[2 * (i - 1)] = 65535
- },
- r = n.prototype;
- r.hasSpace = function() {
- return 65535 !== this._data[0]
- }, r.isAllFree = function() {
- return 0 == this._data[1]
- }, r.pop = function() {
- var t = this._data[0];
- if (65535 === t) return null;
- var e = t,
- i = 2 * e,
- n = this._spacesData[e];
- return this._signData[i + 1] = 1, this._data[0] = this._signData[i + 0], this._data[1]++, n
- }, r.push = function(t) {
- var e = 2 * t;
- this._signData[e + 1] = 0, this._signData[e + 0] = this._data[0], this._data[0] = t, this._data[1]--
- }, r.dump = function() {
- for (var t = 0, e = this._data[0], i = ""; 65535 != e;) t++, i += e + "->", e = this._signData[2 * e + 0];
- for (var n = 0, r = "", s = this._contentNum, o = 0; o < s; o++) {
- 1 == this._signData[2 * o + 1] && (n++, r += o + "->")
- }
- var a = t + n;
- console.log("unitID:", this.unitID, "spaceNum:", t, "calc using num:", n, "store using num:", this._data[1], "calc total num:", a, "actually total num:", this._contentNum), console.log("free info:", i), console.log("using info:", r), n != this._data[1] && cc.error("using num error", "calc using num:", n, "store using num:", this._data[1]), t + n != this._contentNum && cc.error("total num error", "calc total num:", a, "actually total num:", this._contentNum)
- }, e.exports = n
- }), {}],
- 314: [(function(t, e, i) {
- "use strict";
- var n = t("../vmath"),
- r = t("./value-type"),
- s = t("../platform/js"),
- o = (function() {
- function e(t, e, i, n) {
- "object" == typeof t && (e = t.g, i = t.b, n = t.a, t = t.r), t = t || 0, e = e || 0, i = i || 0, n = "number" == typeof n ? n : 255, this._val = (n << 24 >>> 0) + (i << 16) + (e << 8) + t
- }
- s.extend(e, r), t("../platform/CCClass").fastDefine("cc.Color", e, {
- r: 0,
- g: 0,
- b: 0,
- a: 255
- });
- var i = {
- WHITE: [255, 255, 255, 255],
- BLACK: [0, 0, 0, 255],
- TRANSPARENT: [0, 0, 0, 0],
- GRAY: [127.5, 127.5, 127.5],
- RED: [255, 0, 0],
- GREEN: [0, 255, 0],
- BLUE: [0, 0, 255],
- YELLOW: [255, 235, 4],
- ORANGE: [255, 127, 0],
- CYAN: [0, 255, 255],
- MAGENTA: [255, 0, 255]
- };
- for (var o in i) s.get(e, o, (function(t) {
- return function() {
- return new e(t[0], t[1], t[2], t[3])
- }
- })(i[o]));
- var a = e.prototype;
- return a.clone = function() {
- var t = new e;
- return t._val = this._val, t
- }, a.equals = function(t) {
- return t && this._val === t._val
- }, a.lerp = function(t, i, n) {
- n = n || new e;
- var r = this.r,
- s = this.g,
- o = this.b,
- a = this.a;
- return n.r = r + (t.r - r) * i, n.g = s + (t.g - s) * i, n.b = o + (t.b - o) * i, n.a = a + (t.a - a) * i, n
- }, a.toString = function() {
- return "rgba(" + this.r.toFixed() + ", " + this.g.toFixed() + ", " + this.b.toFixed() + ", " + this.a.toFixed() + ")"
- }, a.getR = function() {
- return 255 & this._val
- }, a.setR = function(t) {
- return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4294967040 & this._val | t) >>> 0, this
- }, a.getG = function() {
- return (65280 & this._val) >> 8
- }, a.setG = function(t) {
- return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4294902015 & this._val | t << 8) >>> 0, this
- }, a.getB = function() {
- return (16711680 & this._val) >> 16
- }, a.setB = function(t) {
- return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4278255615 & this._val | t << 16) >>> 0, this
- }, a.getA = function() {
- return (4278190080 & this._val) >>> 24
- }, a.setA = function(t) {
- return t = ~~cc.misc.clampf(t, 0, 255), this._val = (16777215 & this._val | t << 24) >>> 0, this
- }, a._fastSetA = function(t) {
- this._val = (16777215 & this._val | t << 24) >>> 0
- }, s.getset(a, "r", a.getR, a.setR, !0), s.getset(a, "g", a.getG, a.setG, !0), s.getset(a, "b", a.getB, a.setB, !0), s.getset(a, "a", a.getA, a.setA, !0), a.toCSS = function(t) {
- return "rgba" === t ? "rgba(" + (0 | this.r) + "," + (0 | this.g) + "," + (0 | this.b) + "," + (this.a / 255).toFixed(2) + ")" : "rgb" === t ? "rgb(" + (0 | this.r) + "," + (0 | this.g) + "," + (0 | this.b) + ")" : "#" + this.toHEX(t)
- }, a.fromHEX = function(t) {
- t = 0 === t.indexOf("#") ? t.substring(1) : t;
- var e = parseInt(t.substr(0, 2), 16) || 0,
- i = parseInt(t.substr(2, 2), 16) || 0,
- n = parseInt(t.substr(4, 2), 16) || 0,
- r = parseInt(t.substr(6, 2), 16) || 255;
- return this._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + e, this
- }, a.toHEX = function(t) {
- var e = [(this.r < 16 ? "0" : "") + (0 | this.r).toString(16), (this.g < 16 ? "0" : "") + (0 | this.g).toString(16), (this.b < 16 ? "0" : "") + (0 | this.b).toString(16)],
- i = -1;
- if ("#rgb" === t)
- for (i = 0; i < e.length; ++i) e[i].length > 1 && (e[i] = e[i][0]);
- else if ("#rrggbb" === t)
- for (i = 0; i < e.length; ++i) 1 === e[i].length && (e[i] = "0" + e[i]);
- else "#rrggbbaa" === t && e.push((this.a < 16 ? "0" : "") + (0 | this.a).toString(16));
- return e.join("")
- }, a.toRGBValue = function() {
- return 16777215 & this._val
- }, a.fromHSV = function(t, e, i) {
- var n, r, s;
- if (0 === e) n = r = s = i;
- else if (0 === i) n = r = s = 0;
- else {
- 1 === t && (t = 0), t *= 6, e = e, i = i;
- var o = Math.floor(t),
- a = t - o,
- l = i * (1 - e),
- h = i * (1 - e * a),
- c = i * (1 - e * (1 - a));
- switch (o) {
- case 0:
- n = i, r = c, s = l;
- break;
- case 1:
- n = h, r = i, s = l;
- break;
- case 2:
- n = l, r = i, s = c;
- break;
- case 3:
- n = l, r = h, s = i;
- break;
- case 4:
- n = c, r = l, s = i;
- break;
- case 5:
- n = i, r = l, s = h
- }
- }
- return n *= 255, r *= 255, s *= 255, this._val = (this.a << 24 >>> 0) + (s << 16) + (r << 8) + n, this
- }, a.toHSV = function() {
- var t = this.r / 255,
- e = this.g / 255,
- i = this.b / 255,
- n = {
- h: 0,
- s: 0,
- v: 0
- },
- r = Math.max(t, e, i),
- s = Math.min(t, e, i),
- o = 0;
- return n.v = r, n.s = r ? (r - s) / r : 0, n.s ? (o = r - s, n.h = t === r ? (e - i) / o : e === r ? 2 + (i - t) / o : 4 + (t - e) / o, n.h /= 6, n.h < 0 && (n.h += 1)) : n.h = 0, n
- }, a.set = function(t) {
- t._val ? this._val = t._val : (this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a)
- }, a.array = function(t) {
- n.color4.array(t, this)
- }, e
- })();
- cc.Color = o, cc.color = function(t, e, i, n) {
- return "string" == typeof t ? (new cc.Color).fromHEX(t) : "object" == typeof t ? new cc.Color(t.r, t.g, t.b, t.a) : new cc.Color(t, e, i, n)
- }, e.exports = cc.Color
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../vmath": 326,
- "./value-type": 320
- }],
- 315: [(function(t, e, i) {
- "use strict";
- t("./value-type"), cc.vmath = t("../vmath").default, e.exports = {
- Vec2: t("./vec2"),
- Vec3: t("./vec3"),
- Vec4: t("./vec4"),
- Quat: t("./quat"),
- Mat4: t("./mat4"),
- Size: t("./size"),
- Rect: t("./rect"),
- Color: t("./color")
- }
- }), {
- "../vmath": 326,
- "./color": 314,
- "./mat4": 316,
- "./quat": 317,
- "./rect": 318,
- "./size": 319,
- "./value-type": 320,
- "./vec2": 321,
- "./vec3": 322,
- "./vec4": 323
- }],
- 316: [(function(t, e, i) {
- "use strict";
- var n = t("../vmath"),
- r = t("../vmath/utils"),
- s = t("./value-type"),
- o = t("../platform/js"),
- a = t("../platform/CCClass");
- function l(t, e, i, n, s, o, a, l, h, c, u, _, f, d, p, m) {
- this.m = new r.FLOAT_ARRAY_TYPE(16);
- var y = this.m;
- y[0] = t, y[1] = e, y[2] = i, y[3] = n, y[4] = s, y[5] = o, y[6] = a, y[7] = l, y[8] = h, y[9] = c, y[10] = u, y[11] = _, y[12] = f, y[13] = d, y[14] = p, y[15] = m
- }
- o.extend(l, s), a.fastDefine("cc.Mat4", l, {
- m00: 1,
- m01: 0,
- m02: 0,
- m03: 0,
- m04: 0,
- m05: 1,
- m06: 0,
- m07: 0,
- m08: 0,
- m09: 0,
- m10: 1,
- m11: 0,
- m12: 0,
- m13: 0,
- m14: 0,
- m15: 1
- });
- for (var h = function(t) {
- Object.defineProperty(l.prototype, "m" + t, {
- get: function() {
- return this.m[t]
- },
- set: function(e) {
- this.m[t] = e
- }
- })
- }, c = 0; c < 16; c++) h(c);
- o.mixin(l.prototype, {
- clone: function() {
- var t = this.m;
- return new l(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15])
- },
- set: function(t) {
- var e = this.m,
- i = t.m;
- return e[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], e[9] = i[9], e[10] = i[10], e[11] = i[11], e[12] = i[12], e[13] = i[13], e[14] = i[14], e[15] = i[15], this
- },
- equals: function(t) {
- return n.mat4.exactEquals(this, t)
- },
- fuzzyEquals: function(t) {
- return n.mat4.equals(this, t)
- },
- toString: function() {
- var t = this.m;
- return t ? "[\n" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ",\n" + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ",\n" + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ",\n" + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + "\n]" : "[\n1, 0, 0, 0\n0, 1, 0, 0\n0, 0, 1, 0\n0, 0, 0, 1\n]"
- },
- identity: function() {
- return n.mat4.identity(this)
- },
- transpose: function(t) {
- return t = t || new cc.Mat4, n.mat4.transpose(t, this)
- },
- invert: function(t) {
- return t = t || new cc.Mat4, n.mat4.invert(t, this)
- },
- adjoint: function(t) {
- return t = t || new cc.Mat4, n.mat4.adjoint(t, this)
- },
- determinant: function() {
- return n.mat4.determinant(this)
- },
- add: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.add(e, this, t)
- },
- sub: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.subtract(e, this, t)
- },
- mul: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.multiply(e, this, t)
- },
- mulScalar: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.mulScalar(e, this, t)
- },
- translate: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.translate(e, this, t)
- },
- scale: function(t, e) {
- return e = e || new cc.Mat4, n.mat4.scale(e, this, t)
- },
- rotate: function(t, e, i) {
- return i = i || new cc.Mat4, n.mat4.rotate(i, this, t, e)
- },
- getTranslation: function(t) {
- return t = t || new cc.Vec3, n.mat4.getTranslation(t, this)
- },
- getScale: function(t) {
- return t = t || new cc.Vec3, n.mat4.getScaling(t, this)
- },
- getRotation: function(t) {
- return t = t || new cc.Quat, n.mat4.getRotation(t, this)
- },
- fromRTS: function(t, e, i) {
- return n.mat4.fromRTS(this, t, e, i)
- },
- fromQuat: function(t) {
- return n.mat4.fromQuat(this, t)
- },
- array: function(t) {
- return n.mat4.array(t, this)
- }
- }), cc.mat4 = function(t, e, i, r, s, o, a, h, c, u, _, f, d, p, m, y) {
- var v = new l(t, e, i, r, s, o, a, h, c, u, _, f, d, p, m, y);
- return void 0 === t && n.mat4.identity(v), v
- }, e.exports = cc.Mat4 = l
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../vmath": 326,
- "../vmath/utils": 333,
- "./value-type": 320
- }],
- 317: [(function(t, e, i) {
- "use strict";
- var n = t("./value-type"),
- r = t("../platform/js"),
- s = t("../platform/CCClass"),
- o = t("../vmath/quat");
- function a(t, e, i, n) {
- t && "object" == typeof t && (i = t.z, e = t.y, n = t.w, t = t.x), this.x = t || 0, this.y = e || 0, this.z = i || 0, this.w = n || 1
- }
- r.extend(a, n), s.fastDefine("cc.Quat", a, {
- x: 0,
- y: 0,
- z: 0,
- w: 1
- });
- var l = a.prototype;
- l.clone = function() {
- return new a(this.x, this.y, this.z, this.w)
- }, l.set = function(t) {
- return this.x = t.x, this.y = t.y, this.z = t.z, this.w = t.w, this
- }, l.equals = function(t) {
- return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w
- }, l.toEuler = function(t) {
- return o.toEuler(t, this), t
- }, l.fromEuler = function(t) {
- return o.fromEuler(this, t.x, t.y, t.z), this
- }, l.lerp = function(t, e, i) {
- return i = i || new cc.Quat, o.slerp(i, this, t, e), i
- }, l.mul = function(t, e) {
- return e = e || new cc.Quat, o.mul(e, this, t), e
- }, l.array = function(t) {
- o.array(t, this)
- }, l.rotateAround = function(t, e, i, n) {
- return n = n || new cc.Quat, o.rotateAround(n, t, e, i)
- }, cc.quat = function(t, e, i, n) {
- return new a(t, e, i, n)
- }, e.exports = cc.Quat = a
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../vmath/quat": 331,
- "./value-type": 320
- }],
- 318: [(function(t, e, i) {
- "use strict";
- var n = t("./value-type"),
- r = t("../platform/js");
- function s(t, e, i, n) {
- t && "object" == typeof t && (e = t.y, i = t.width, n = t.height, t = t.x), this.x = t || 0, this.y = e || 0, this.width = i || 0, this.height = n || 0
- }
- r.extend(s, n), t("../platform/CCClass").fastDefine("cc.Rect", s, {
- x: 0,
- y: 0,
- width: 0,
- height: 0
- }), s.fromMinMax = function(t, e) {
- var i = Math.min(t.x, e.x),
- n = Math.min(t.y, e.y);
- return new s(i, n, Math.max(t.x, e.x) - i, Math.max(t.y, e.y) - n)
- };
- var o = s.prototype;
- o.clone = function() {
- return new s(this.x, this.y, this.width, this.height)
- }, o.equals = function(t) {
- return t && this.x === t.x && this.y === t.y && this.width === t.width && this.height === t.height
- }, o.lerp = function(t, e, i) {
- i = i || new s;
- var n = this.x,
- r = this.y,
- o = this.width,
- a = this.height;
- return i.x = n + (t.x - n) * e, i.y = r + (t.y - r) * e, i.width = o + (t.width - o) * e, i.height = a + (t.height - a) * e, i
- }, o.set = function(t) {
- this.x = t.x, this.y = t.y, this.width = t.width, this.height = t.height
- }, o.intersects = function(t) {
- var e = this.x + this.width,
- i = this.y + this.height,
- n = t.x + t.width,
- r = t.y + t.height;
- return !(e < t.x || n < this.x || i < t.y || r < this.y)
- }, o.intersection = function(t, e) {
- var i = this.x,
- n = this.y,
- r = this.x + this.width,
- s = this.y + this.height,
- o = e.x,
- a = e.y,
- l = e.x + e.width,
- h = e.y + e.height;
- return t.x = Math.max(i, o), t.y = Math.max(n, a), t.width = Math.min(r, l) - t.x, t.height = Math.min(s, h) - t.y, t
- }, o.contains = function(t) {
- return this.x <= t.x && this.x + this.width >= t.x && this.y <= t.y && this.y + this.height >= t.y
- }, o.containsRect = function(t) {
- return this.x <= t.x && this.x + this.width >= t.x + t.width && this.y <= t.y && this.y + this.height >= t.y + t.height
- }, o.union = function(t, e) {
- var i = this.x,
- n = this.y,
- r = this.width,
- s = this.height,
- o = e.x,
- a = e.y,
- l = e.width,
- h = e.height;
- return t.x = Math.min(i, o), t.y = Math.min(n, a), t.width = Math.max(i + r, o + l) - t.x, t.height = Math.max(n + s, a + h) - t.y, t
- }, o.transformMat4 = function(t, e) {
- var i = this.x,
- n = this.y,
- r = i + this.width,
- s = n + this.height,
- o = e.m,
- a = o[0] * i + o[4] * n + o[12],
- l = o[1] * i + o[5] * n + o[13],
- h = o[0] * r + o[4] * n + o[12],
- c = o[1] * r + o[5] * n + o[13],
- u = o[0] * i + o[4] * s + o[12],
- _ = o[1] * i + o[5] * s + o[13],
- f = o[0] * r + o[4] * s + o[12],
- d = o[1] * r + o[5] * s + o[13],
- p = Math.min(a, h, u, f),
- m = Math.max(a, h, u, f),
- y = Math.min(l, c, _, d),
- v = Math.max(l, c, _, d);
- return t.x = p, t.y = y, t.width = m - p, t.height = v - y, t
- }, o.toString = function() {
- return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")"
- }, r.getset(o, "xMin", (function() {
- return this.x
- }), (function(t) {
- this.width += this.x - t, this.x = t
- })), r.getset(o, "yMin", (function() {
- return this.y
- }), (function(t) {
- this.height += this.y - t, this.y = t
- })), r.getset(o, "xMax", (function() {
- return this.x + this.width
- }), (function(t) {
- this.width = t - this.x
- })), r.getset(o, "yMax", (function() {
- return this.y + this.height
- }), (function(t) {
- this.height = t - this.y
- })), r.getset(o, "center", (function() {
- return new cc.Vec2(this.x + .5 * this.width, this.y + .5 * this.height)
- }), (function(t) {
- this.x = t.x - .5 * this.width, this.y = t.y - .5 * this.height
- })), r.getset(o, "origin", (function() {
- return new cc.Vec2(this.x, this.y)
- }), (function(t) {
- this.x = t.x, this.y = t.y
- })), r.getset(o, "size", (function() {
- return new cc.Size(this.width, this.height)
- }), (function(t) {
- this.width = t.width, this.height = t.height
- })), cc.Rect = s, cc.rect = function(t, e, i, n) {
- return new s(t, e, i, n)
- }, e.exports = cc.Rect
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "./value-type": 320
- }],
- 319: [(function(t, e, i) {
- "use strict";
- var n = t("./value-type"),
- r = t("../platform/js");
- function s(t, e) {
- t && "object" == typeof t && (e = t.height, t = t.width), this.width = t || 0, this.height = e || 0
- }
- r.extend(s, n), t("../platform/CCClass").fastDefine("cc.Size", s, {
- width: 0,
- height: 0
- }), r.get(s, "ZERO", (function() {
- return new s(0, 0)
- }));
- var o = s.prototype;
- o.clone = function() {
- return new s(this.width, this.height)
- }, o.equals = function(t) {
- return t && this.width === t.width && this.height === t.height
- }, o.lerp = function(t, e, i) {
- i = i || new s;
- var n = this.width,
- r = this.height;
- return i.width = n + (t.width - n) * e, i.height = r + (t.height - r) * e, i
- }, o.set = function(t) {
- this.width = t.width, this.height = t.height
- }, o.toString = function() {
- return "(" + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")"
- }, cc.size = function(t, e) {
- return new s(t, e)
- }, cc.Size = e.exports = s
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "./value-type": 320
- }],
- 320: [(function(t, e, i) {
- "use strict";
- var n = t("../platform/js");
- function r() {}
- n.setClassName("cc.ValueType", r);
- var s = r.prototype;
- s.toString = function() {
- return "" + {}
- }, cc.ValueType = e.exports = r
- }), {
- "../platform/js": 218
- }],
- 321: [(function(t, e, i) {
- "use strict";
- var n = t("../vmath"),
- r = t("./value-type"),
- s = t("../platform/js"),
- o = t("../platform/CCClass"),
- a = t("../utils/misc");
- function l(t, e) {
- t && "object" == typeof t && (e = t.y, t = t.x), this.x = t || 0, this.y = e || 0
- }
- s.extend(l, r), o.fastDefine("cc.Vec2", l, {
- x: 0,
- y: 0
- });
- var h = l.prototype;
- s.value(h, "z", 0, !0), h.clone = function() {
- return new l(this.x, this.y)
- }, h.set = function(t) {
- return this.x = t.x, this.y = t.y, this
- }, h.equals = function(t) {
- return t && this.x === t.x && this.y === t.y
- }, h.fuzzyEquals = function(t, e) {
- return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e
- }, h.toString = function() {
- return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ")"
- }, h.lerp = function(t, e, i) {
- i = i || new l;
- var n = this.x,
- r = this.y;
- return i.x = n + (t.x - n) * e, i.y = r + (t.y - r) * e, i
- }, h.clampf = function(t, e) {
- return this.x = a.clampf(this.x, t.x, e.x), this.y = a.clampf(this.y, t.y, e.y), this
- }, h.addSelf = function(t) {
- return this.x += t.x, this.y += t.y, this
- }, h.add = function(t, e) {
- return (e = e || new l).x = this.x + t.x, e.y = this.y + t.y, e
- }, h.subSelf = function(t) {
- return this.x -= t.x, this.y -= t.y, this
- }, h.sub = function(t, e) {
- return (e = e || new l).x = this.x - t.x, e.y = this.y - t.y, e
- }, h.mulSelf = function(t) {
- return this.x *= t, this.y *= t, this
- }, h.mul = function(t, e) {
- return (e = e || new l).x = this.x * t, e.y = this.y * t, e
- }, h.scaleSelf = function(t) {
- return this.x *= t.x, this.y *= t.y, this
- }, h.scale = function(t, e) {
- return (e = e || new l).x = this.x * t.x, e.y = this.y * t.y, e
- }, h.divSelf = function(t) {
- return this.x /= t, this.y /= t, this
- }, h.div = function(t, e) {
- return (e = e || new l).x = this.x / t, e.y = this.y / t, e
- }, h.negSelf = function() {
- return this.x = -this.x, this.y = -this.y, this
- }, h.neg = function(t) {
- return (t = t || new l).x = -this.x, t.y = -this.y, t
- }, h.dot = function(t) {
- return this.x * t.x + this.y * t.y
- }, h.cross = function(t) {
- return this.x * t.y - this.y * t.x
- }, h.mag = function() {
- return Math.sqrt(this.x * this.x + this.y * this.y)
- }, h.magSqr = function() {
- return this.x * this.x + this.y * this.y
- }, h.normalizeSelf = function() {
- var t = this.x * this.x + this.y * this.y;
- if (1 === t) return this;
- if (0 === t) return this;
- var e = 1 / Math.sqrt(t);
- return this.x *= e, this.y *= e, this
- }, h.normalize = function(t) {
- return (t = t || new l).x = this.x, t.y = this.y, t.normalizeSelf(), t
- }, h.angle = function(t) {
- var e = this.magSqr(),
- i = t.magSqr();
- if (0 === e || 0 === i) return console.warn("Can't get angle between zero vector"), 0;
- var n = this.dot(t) / Math.sqrt(e * i);
- return n = a.clampf(n, -1, 1), Math.acos(n)
- }, h.signAngle = function(t) {
- var e = this.angle(t);
- return this.cross(t) < 0 ? -e : e
- }, h.rotate = function(t, e) {
- return (e = e || new l).x = this.x, e.y = this.y, e.rotateSelf(t)
- }, h.rotateSelf = function(t) {
- var e = Math.sin(t),
- i = Math.cos(t),
- n = this.x;
- return this.x = i * n - e * this.y, this.y = e * n + i * this.y, this
- }, h.project = function(t) {
- return t.mul(this.dot(t) / t.dot(t))
- }, h.transformMat4 = function(t, e) {
- e = e || new l, n.vec2.transformMat4(e, this, t)
- }, h.fromTranslation = function(t) {
- return this.x = t[0], this.y = t[1], this
- }, h.toTranslation = function(t) {
- t[0] = this.x, t[1] = this.y
- }, h.fromScale = function(t) {
- return this.x = t[7], this.y = t[8], this
- }, h.toScale = function(t) {
- t[7] = this.x, t[8] = this.y
- }, h.array = function(t) {
- n.vec2.array(t, this)
- }, s.get(l, "ONE", (function() {
- return new l(1, 1)
- })), s.get(l, "ZERO", (function() {
- return new l(0, 0)
- })), s.get(l, "UP", (function() {
- return new l(0, 1)
- })), s.get(l, "RIGHT", (function() {
- return new l(1, 0)
- })), cc.Vec2 = l, cc.v2 = function(t, e) {
- return new l(t, e)
- }, cc.p = cc.v2, e.exports = cc.Vec2
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../utils/misc": 300,
- "../vmath": 326,
- "./value-type": 320
- }],
- 322: [(function(t, e, i) {
- "use strict";
- var n = t("../vmath"),
- r = t("./value-type"),
- s = t("../platform/js"),
- o = t("../platform/CCClass"),
- a = t("../utils/misc"),
- l = t("./vec2").prototype;
- function h(t, e, i) {
- t && "object" == typeof t && (i = t.z, e = t.y, t = t.x), this.x = t || 0, this.y = e || 0, this.z = i || 0
- }
- s.extend(h, r), o.fastDefine("cc.Vec3", h, {
- x: 0,
- y: 0,
- z: 0
- });
- var c = h.prototype;
- c.clone = function() {
- return new h(this.x, this.y, this.z)
- }, c.set = function(t) {
- return this.x = t.x, this.y = t.y, this.z = t.z, this
- }, c.equals = function(t) {
- return t && this.x === t.x && this.y === t.y && this.z === t.z
- }, c.fuzzyEquals = function(t, e) {
- return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e && this.z - e <= t.z && t.z <= this.z + e
- }, c.toString = function() {
- return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ")"
- }, c.lerp = function(t, e, i) {
- return i = i || new h, n.vec3.lerp(i, this, t, e), i
- }, c.clampf = function(t, e) {
- return this.x = a.clampf(this.x, t.x, e.x), this.y = a.clampf(this.y, t.y, e.y), this.z = a.clampf(this.z, t.z, e.z), this
- }, c.addSelf = function(t) {
- return this.x += t.x, this.y += t.y, this.z += t.z, this
- }, c.add = function(t, e) {
- return (e = e || new h).x = this.x + t.x, e.y = this.y + t.y, e.z = this.z + t.z, e
- }, c.subSelf = function(t) {
- return this.x -= t.x, this.y -= t.y, this.z -= t.z, this
- }, c.sub = function(t, e) {
- return (e = e || new h).x = this.x - t.x, e.y = this.y - t.y, e.z = this.z - t.z, e
- }, c.mulSelf = function(t) {
- return this.x *= t, this.y *= t, this.z *= t, this
- }, c.mul = function(t, e) {
- return (e = e || new h).x = this.x * t, e.y = this.y * t, e.z = this.z * t, e
- }, c.scaleSelf = function(t) {
- return this.x *= t.x, this.y *= t.y, this.z *= t.z, this
- }, c.scale = function(t, e) {
- return (e = e || new h).x = this.x * t.x, e.y = this.y * t.y, e.z = this.z * t.z, e
- }, c.divSelf = function(t) {
- return this.x /= t, this.y /= t, this.z /= t, this
- }, c.div = function(t, e) {
- return (e = e || new h).x = this.x / t, e.y = this.y / t, e.z = this.z / t, e
- }, c.negSelf = function() {
- return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
- }, c.neg = function(t) {
- return (t = t || new h).x = -this.x, t.y = -this.y, t.z = -this.z, t
- }, c.dot = function(t) {
- return this.x * t.x + this.y * t.y + this.z * t.z
- }, c.cross = function(t, e) {
- return e = e || new h, n.vec3.cross(e, this, t), e
- }, c.mag = function() {
- return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
- }, c.magSqr = function() {
- return this.x * this.x + this.y * this.y + this.z * this.z
- }, c.normalizeSelf = function() {
- return n.vec3.normalize(this, this), this
- }, c.normalize = function(t) {
- return t = t || new h, n.vec3.normalize(t, this), t
- }, c.transformMat4 = function(t, e) {
- e = e || new h, n.vec3.transformMat4(e, this, t)
- }, c.angle = l.angle, c.project = l.project, c.signAngle = function(t) {
- cc.warnID(1408, "vec3.signAngle", "v2.1", "cc.v2(selfVector).signAngle(vector)");
- var e = new cc.Vec2(this.x, this.y),
- i = new cc.Vec2(t.x, t.y);
- return e.signAngle(i)
- }, c.rotate = function(t, e) {
- return cc.warnID(1408, "vec3.rotate", "v2.1", "cc.v2(selfVector).rotate(radians, out)"), l.rotate.call(this, t, e)
- }, c.rotateSelf = function(t) {
- return cc.warnID(1408, "vec3.rotateSelf", "v2.1", "cc.v2(selfVector).rotateSelf(radians)"), l.rotateSelf.call(this, t)
- }, c.array = function(t) {
- n.vec3.array(t, this)
- }, s.get(h, "ONE", (function() {
- return new h(1, 1, 1)
- })), s.get(h, "ZERO", (function() {
- return new h(0, 0, 0)
- })), s.get(h, "UP", (function() {
- return new h(0, 1, 0)
- })), s.get(h, "RIGHT", (function() {
- return new h(1, 0, 0)
- })), s.get(h, "FRONT", (function() {
- return new h(0, 0, 1)
- })), cc.v3 = function(t, e, i) {
- return new h(t, e, i)
- }, e.exports = cc.Vec3 = h
- }), {
- "../platform/CCClass": 198,
- "../platform/js": 218,
- "../utils/misc": 300,
- "../vmath": 326,
- "./value-type": 320,
- "./vec2": 321
- }],
- 323: [(function(t, e, i) {
- "use strict";
- var n = a(t("./value-type")),
- r = a(t("../platform/CCClass")),
- s = t("../vmath"),
- o = t("../utils/misc");
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function h(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function c(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var u = (function(t) {
- function e(i, n, r, s) {
- l(this, e);
- var o = h(this, t.call(this));
- return i && "object" == typeof i && (s = i.w, r = i.z, n = i.y, i = i.x), o.x = i || 0, o.y = n || 0, o.z = r || 0, o.w = s || 0, o
- }
- return c(e, t), e.prototype.clone = function() {
- return new e(this.x, this.y, this.z, this.w)
- }, e.prototype.set = function(t) {
- return this.x = t.x, this.y = t.y, this.z = t.z, this.w = t.w, this
- }, e.prototype.equals = function(t) {
- return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w
- }, e.prototype.fuzzyEquals = function(t, e) {
- return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e && this.z - e <= t.z && t.z <= this.z + e && this.w - e <= t.w && t.w <= this.w + e
- }, e.prototype.toString = function() {
- return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ", " + this.w.toFixed(2) + ")"
- }, e.prototype.lerp = function(t, i, n) {
- return n = n || new e, s.vec4.lerp(n, this, t, i), n
- }, e.prototype.clampf = function(t, e) {
- return this.x = (0, o.clampf)(this.x, t.x, e.x), this.y = (0, o.clampf)(this.y, t.y, e.y), this.z = (0, o.clampf)(this.z, t.z, e.z), this.w = (0, o.clampf)(this.w, t.w, e.w), this
- }, e.prototype.addSelf = function(t) {
- return this.x += t.x, this.y += t.y, this.z += t.z, this.w += t.w, this
- }, e.prototype.add = function(t, i) {
- return (i = i || new e).x = this.x + t.x, i.y = this.y + t.y, i.z = this.z + t.z, i.w = this.w + t.w, i
- }, e.prototype.subSelf = function(t) {
- return this.x -= t.x, this.y -= t.y, this.z -= t.z, this.w -= t.w, this
- }, e.prototype.sub = function(t, i) {
- return (i = i || new e).x = this.x - t.x, i.y = this.y - t.y, i.z = this.z - t.z, i.w = this.w - t.w, i
- }, e.prototype.mulSelf = function(t) {
- return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this
- }, e.prototype.mul = function(t, i) {
- return (i = i || new e).x = this.x * t, i.y = this.y * t, i.z = this.z * t, i.w = this.w * t, i
- }, e.prototype.scaleSelf = function(t) {
- return this.x *= t.x, this.y *= t.y, this.z *= t.z, this.w *= t.w, this
- }, e.prototype.scale = function(t, i) {
- return (i = i || new e).x = this.x * t.x, i.y = this.y * t.y, i.z = this.z * t.z, i.w = this.w * t.w, i
- }, e.prototype.divSelf = function(t) {
- return this.x /= t, this.y /= t, this.z /= t, this.w /= t, this
- }, e.prototype.div = function(t, i) {
- return (i = i || new e).x = this.x / t, i.y = this.y / t, i.z = this.z / t, i.w = this.w / t, i
- }, e.prototype.negSelf = function() {
- return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this
- }, e.prototype.neg = function(t) {
- return (t = t || new e).x = -this.x, t.y = -this.y, t.z = -this.z, t.w = -this.w, t
- }, e.prototype.dot = function(t) {
- return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w
- }, e.prototype.cross = function(t, i) {
- return i = i || new e, s.vec4.cross(i, this, t), i
- }, e.prototype.mag = function() {
- var t = this.x,
- e = this.y,
- i = this.z,
- n = this.w;
- return Math.sqrt(t * t + e * e + i * i + n * n)
- }, e.prototype.magSqr = function() {
- var t = this.x,
- e = this.y,
- i = this.z,
- n = this.w;
- return t * t + e * e + i * i + n * n
- }, e.prototype.normalizeSelf = function() {
- return s.vec4.normalize(this, this), this
- }, e.prototype.normalize = function(t) {
- return t = t || new e, s.vec4.normalize(t, this), t
- }, e.prototype.transformMat4 = function(t, i) {
- return i = i || new e, s.vec4.transformMat4(i, this, t), i
- }, e.prototype.array = function(t) {
- s.vec4.array(t, this)
- }, e
- })(n.default);
- r.default.fastDefine("cc.Vec4", u, {
- x: 0,
- y: 0,
- z: 0,
- w: 0
- }), cc.v4 = function(t, e, i, n) {
- return new u(t, e, i, n)
- }, e.exports = cc.Vec4 = u
- }), {
- "../platform/CCClass": 198,
- "../utils/misc": 300,
- "../vmath": 326,
- "./value-type": 320
- }],
- 324: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
- r(this, t), this.r = e, this.g = i, this.b = n
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1)
- }, t.clone = function(e) {
- return new t(e.r, e.g, e.b)
- }, t.copy = function(t, e) {
- return t.r = e.r, t.g = e.g, t.b = e.b, t
- }, t.set = function(t, e, i, n) {
- return t.r = e, t.g = i, t.b = n, t
- }, t.fromHex = function(t, e) {
- var i = (e >> 16) / 255,
- n = (e >> 8 & 255) / 255,
- r = (255 & e) / 255;
- return t.r = i, t.g = n, t.b = r, t
- }, t.add = function(t, e, i) {
- return t.r = e.r + i.r, t.g = e.g + i.g, t.b = e.b + i.b, t
- }, t.subtract = function(t, e, i) {
- return t.r = e.r - i.r, t.g = e.g - i.g, t.b = e.b - i.b, t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiply = function(t, e, i) {
- return t.r = e.r * i.r, t.g = e.g * i.g, t.b = e.b * i.b, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.divide = function(t, e, i) {
- return t.r = e.r / i.r, t.g = e.g / i.g, t.b = e.b / i.b, t
- }, t.div = function(e, i, n) {
- return t.divide(e, i, n)
- }, t.scale = function(t, e, i) {
- return t.r = e.r * i, t.g = e.g * i, t.b = e.b * i, t
- }, t.lerp = function(t, e, i, n) {
- var r = e.r,
- s = e.g,
- o = e.b;
- return t.r = r + n * (i.r - r), t.g = s + n * (i.g - s), t.b = o + n * (i.b - o), t
- }, t.str = function(t) {
- return "color3(" + t.r + ", " + t.g + ", " + t.b + ")"
- }, t.array = function(t, e) {
- var i = e instanceof cc.Color ? 1 / 255 : 1;
- return t[0] = e.r * i, t[1] = e.g * i, t[2] = e.b * i, t
- }, t.exactEquals = function(t, e) {
- return t.r === e.r && t.g === e.g && t.b === e.b
- }, t.equals = function(t, e) {
- var i = t.r,
- r = t.g,
- s = t.b,
- o = e.r,
- a = e.g,
- l = e.b;
- return Math.abs(i - o) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(r - a) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(s - l) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(l))
- }, t.hex = function(t) {
- return 255 * t.r << 16 | 255 * t.g << 8 | 255 * t.b
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 325: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1,
- s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
- r(this, t), this.r = e, this.g = i, this.b = n, this.a = s
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
- }, t.clone = function(e) {
- return new t(e.r, e.g, e.b, e.a)
- }, t.copy = function(t, e) {
- return t.r = e.r, t.g = e.g, t.b = e.b, t.a = e.a, t
- }, t.set = function(t, e, i, n, r) {
- return t.r = e, t.g = i, t.b = n, t.a = r, t
- }, t.fromHex = function(t, e) {
- var i = (e >> 24) / 255,
- n = (e >> 16 & 255) / 255,
- r = (e >> 8 & 255) / 255,
- s = (255 & e) / 255;
- return t.r = i, t.g = n, t.b = r, t.a = s, t
- }, t.add = function(t, e, i) {
- return t.r = e.r + i.r, t.g = e.g + i.g, t.b = e.b + i.b, t.a = e.a + i.a, t
- }, t.subtract = function(t, e, i) {
- return t.r = e.r - i.r, t.g = e.g - i.g, t.b = e.b - i.b, t.a = e.a - i.a, t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiply = function(t, e, i) {
- return t.r = e.r * i.r, t.g = e.g * i.g, t.b = e.b * i.b, t.a = e.a * i.a, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.divide = function(t, e, i) {
- return t.r = e.r / i.r, t.g = e.g / i.g, t.b = e.b / i.b, t.a = e.a / i.a, t
- }, t.div = function(e, i, n) {
- return t.divide(e, i, n)
- }, t.scale = function(t, e, i) {
- return t.r = e.r * i, t.g = e.g * i, t.b = e.b * i, t.a = e.a * i, t
- }, t.lerp = function(t, e, i, n) {
- var r = e.r,
- s = e.g,
- o = e.b,
- a = e.a;
- return t.r = r + n * (i.r - r), t.g = s + n * (i.g - s), t.b = o + n * (i.b - o), t.a = a + n * (i.a - a), t
- }, t.str = function(t) {
- return "color4(" + t.r + ", " + t.g + ", " + t.b + ", " + t.a + ")"
- }, t.array = function(t, e) {
- var i = e instanceof cc.Color || e.a > 1 ? 1 / 255 : 1;
- return t[0] = e.r * i, t[1] = e.g * i, t[2] = e.b * i, t[3] = e.a * i, t
- }, t.exactEquals = function(t, e) {
- return t.r === e.r && t.g === e.g && t.b === e.b && t.a === e.a
- }, t.equals = function(t, e) {
- var i = t.r,
- r = t.g,
- s = t.b,
- o = t.a,
- a = e.r,
- l = e.g,
- h = e.b,
- c = e.a;
- return Math.abs(i - a) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(r - l) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c))
- }, t.hex = function(t) {
- return (255 * t.r << 24 | 255 * t.g << 16 | 255 * t.b << 8 | 255 * t.a) >>> 0
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 326: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.color4 = i.color3 = i.mat4 = i.mat3 = i.mat23 = i.mat2 = i.trs = i.quat = i.vec4 = i.vec3 = i.vec2 = void 0;
- var n = t("./utils");
- Object.keys(n).forEach((function(t) {
- "default" !== t && "__esModule" !== t && Object.defineProperty(i, t, {
- enumerable: !0,
- get: function() {
- return n[t]
- }
- })
- }));
- var r = p(t("./vec2")),
- s = p(t("./vec3")),
- o = p(t("./vec4")),
- a = p(t("./quat")),
- l = p(t("./trs")),
- h = p(t("./mat2")),
- c = p(t("./mat23")),
- u = p(t("./mat3")),
- _ = p(t("./mat4")),
- f = p(t("./color3")),
- d = p(t("./color4"));
- function p(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- i.vec2 = r.default, i.vec3 = s.default, i.vec4 = o.default, i.quat = a.default, i.trs = l.default, i.mat2 = h.default, i.mat23 = c.default, i.mat3 = u.default, i.mat4 = _.default, i.color3 = f.default, i.color4 = d.default, i.default = {
- vec2: r.default,
- vec3: s.default,
- vec4: o.default,
- quat: a.default,
- trs: l.default,
- mat2: h.default,
- mat23: c.default,
- mat3: u.default,
- mat4: _.default,
- color3: f.default,
- color4: d.default
- }
- }), {
- "./color3": 324,
- "./color4": 325,
- "./mat2": 327,
- "./mat23": 328,
- "./mat3": 329,
- "./mat4": 330,
- "./quat": 331,
- "./trs": 332,
- "./utils": 333,
- "./vec2": 334,
- "./vec3": 335,
- "./vec4": 336
- }],
- 327: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
- if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(4), this.m.set(e)) : this.m = e;
- else {
- this.m = new n.FLOAT_ARRAY_TYPE(4);
- var a = this.m;
- a[0] = e, a[1] = i, a[2] = s, a[3] = o
- }
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
- }, t.clone = function(e) {
- var i = e.m;
- return new t(i[0], i[1], i[2], i[3])
- }, t.copy = function(t, e) {
- return t.m.set(e.m), t
- }, t.identity = function(t) {
- var e = t.m;
- return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, t
- }, t.set = function(t, e, i, n, r) {
- var s = t.m;
- return s[0] = e, s[1] = i, s[2] = n, s[3] = r, t
- }, t.transpose = function(t, e) {
- var i = t.m,
- n = e.m;
- if (t === e) {
- var r = n[1];
- i[1] = n[2], i[2] = r
- } else i[0] = n[0], i[1] = n[2], i[2] = n[1], i[3] = n[3];
- return t
- }, t.invert = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = r * a - o * s;
- return l ? (l = 1 / l, n[0] = a * l, n[1] = -s * l, n[2] = -o * l, n[3] = r * l, t) : null
- }, t.adjoint = function(t, e) {
- var i = t.m,
- n = e.m,
- r = n[0];
- return i[0] = n[3], i[1] = -n[1], i[2] = -n[2], i[3] = r, t
- }, t.determinant = function(t) {
- var e = t.m;
- return e[0] * e[3] - e[2] * e[1]
- }, t.multiply = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = bm[0],
- c = bm[1],
- u = bm[2],
- _ = bm[3];
- return r[0] = s * h + a * c, r[1] = o * h + l * c, r[2] = s * u + a * _, r[3] = o * u + l * _, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.rotate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = Math.sin(i),
- c = Math.cos(i);
- return r[0] = s * c + a * h, r[1] = o * c + l * h, r[2] = s * -h + a * c, r[3] = o * -h + l * c, t
- }, t.scale = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = i.x,
- c = i.y;
- return r[0] = s * h, r[1] = o * h, r[2] = a * c, r[3] = l * c, t
- }, t.fromRotation = function(t, e) {
- var i = t.m,
- n = Math.sin(e),
- r = Math.cos(e);
- return i[0] = r, i[1] = n, i[2] = -n, i[3] = r, t
- }, t.fromScaling = function(t, e) {
- var i = t.m;
- return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = e.y, t
- }, t.str = function(t) {
- var e = t.m;
- return "mat2(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ")"
- }, t.array = function(t, e) {
- var i = e.m;
- return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t
- }, t.frob = function(t) {
- var e = t.m;
- return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2))
- }, t.LDU = function(t, e, i, n) {
- var r = t.m,
- s = i.m,
- o = n.m;
- r[2] = o[2] / o[0], s[0] = o[0], s[1] = o[1], s[3] = o[3] - r[2] * s[1]
- }, t.add = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], t
- }, t.subtract = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.exactEquals = function(t, e) {
- var i = t.m,
- n = e.m;
- return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3]
- }, t.equals = function(t, e) {
- var i = t.m,
- r = e.m,
- s = i[0],
- o = i[1],
- a = i[2],
- l = i[3],
- h = r[0],
- c = r[1],
- u = r[2],
- _ = r[3];
- return Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c)) && Math.abs(a - u) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(u)) && Math.abs(l - _) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(_))
- }, t.multiplyScalar = function(t, e, i) {
- var n = e.m,
- r = t.m;
- return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, t
- }, t.multiplyScalarAndAdd = function(t, e, i, n) {
- var r = e.m,
- s = i.m,
- o = t.m;
- return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, t
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 328: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1,
- a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0,
- l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0;
- if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(6), this.m.set(e)) : this.m = e;
- else {
- this.m = new n.FLOAT_ARRAY_TYPE(6);
- var h = this.m;
- h[0] = e, h[1] = i, h[2] = s, h[3] = o, h[4] = a, h[5] = l
- }
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0)
- }, t.clone = function(e) {
- var i = e.m;
- return new t(i[0], i[1], i[2], i[3], i[4], i[5])
- }, t.copy = function(t, e) {
- return t.m.set(e.m), t
- }, t.identity = function(t) {
- var e = t.m;
- return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, t
- }, t.set = function(t, e, i, n, r, s, o) {
- var a = t.m;
- return a[0] = e, a[1] = i, a[2] = n, a[3] = r, a[4] = s, a[5] = o, t
- }, t.invert = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = r * a - s * o;
- return c ? (c = 1 / c, n[0] = a * c, n[1] = -s * c, n[2] = -o * c, n[3] = r * c, n[4] = (o * h - a * l) * c, n[5] = (s * l - r * h) * c, t) : null
- }, t.determinant = function(t) {
- var e = t.m;
- return e[0] * e[3] - e[1] * e[2]
- }, t.multiply = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m,
- o = n[0],
- a = n[1],
- l = n[2],
- h = n[3],
- c = n[4],
- u = n[5],
- _ = r[0],
- f = r[1],
- d = r[2],
- p = r[3],
- m = r[4],
- y = r[5];
- return s[0] = o * _ + l * f, s[1] = a * _ + h * f, s[2] = o * d + l * p, s[3] = a * d + h * p, s[4] = o * m + l * y + c, s[5] = a * m + h * y + u, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.rotate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = n[4],
- c = n[5],
- u = Math.sin(i),
- _ = Math.cos(i);
- return r[0] = s * _ + a * u, r[1] = o * _ + l * u, r[2] = s * -u + a * _, r[3] = o * -u + l * _, r[4] = h, r[5] = c, t
- }, t.scale = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = n[4],
- c = n[5],
- u = i.x,
- _ = i.y;
- return r[0] = s * u, r[1] = o * u, r[2] = a * _, r[3] = l * _, r[4] = h, r[5] = c, t
- }, t.translate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = n[4],
- c = n[5],
- u = i.x,
- _ = i.y;
- return r[0] = s, r[1] = o, r[2] = a, r[3] = l, r[4] = s * u + a * _ + h, r[5] = o * u + l * _ + c, t
- }, t.fromRotation = function(t, e) {
- var i = t.m,
- n = Math.sin(e),
- r = Math.cos(e);
- return i[0] = r, i[1] = n, i[2] = -n, i[3] = r, i[4] = 0, i[5] = 0, t
- }, t.fromScaling = function(t, e) {
- var i = e.m,
- n = t.m;
- return n[0] = i[0], n[1] = 0, n[2] = 0, n[3] = i[1], n[4] = 0, n[5] = 0, t
- }, t.fromTranslation = function(t, e) {
- var i = t.m;
- return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 1, i[4] = e.x, i[5] = e.y, t
- }, t.fromRTS = function(t, e, i, n) {
- var r = t.m,
- s = Math.sin(e),
- o = Math.cos(e);
- return r[0] = o * n.x, r[1] = s * n.x, r[2] = -s * n.y, r[3] = o * n.y, r[4] = i.x, r[5] = i.y, t
- }, t.str = function(t) {
- var e = t.m;
- return "mat23(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ")"
- }, t.array = function(t, e) {
- var i = e.m;
- return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t
- }, t.array4x4 = function(t, e) {
- var i = e.m;
- return t[0] = i[0], t[1] = i[1], t[2] = 0, t[3] = 0, t[4] = i[2], t[5] = i[3], t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = i[4], t[13] = i[5], t[14] = 0, t[15] = 1, t
- }, t.frob = function(t) {
- var e = t.m;
- return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + 1)
- }, t.add = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], t
- }, t.subtract = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiplyScalar = function(t, e, i) {
- var n = e.m,
- r = t.m;
- return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, t
- }, t.multiplyScalarAndAdd = function(t, e, i, n) {
- var r = e.m,
- s = i.m,
- o = t.m;
- return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, t
- }, t.exactEquals = function(t, e) {
- var i = t.m,
- n = e.m;
- return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5]
- }, t.equals = function(t, e) {
- var i = t.m,
- r = e.m,
- s = i[0],
- o = i[1],
- a = i[2],
- l = i[3],
- h = i[4],
- c = i[5],
- u = r[0],
- _ = r[1],
- f = r[2],
- d = r[3],
- p = r[4],
- m = r[5];
- return Math.abs(s - u) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(u)) && Math.abs(o - _) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(_)) && Math.abs(a - f) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(f)) && Math.abs(l - d) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(d)) && Math.abs(h - p) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(p)) && Math.abs(c - m) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(m))
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 329: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./vec3"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
- a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 1,
- l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0,
- h = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0,
- c = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0,
- u = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 1;
- if (s(this, t), "object" == typeof e) i ? (this.m = new e.constructor(9), this.m.set(e)) : this.m = e;
- else {
- this.m = new n.FLOAT_ARRAY_TYPE(9);
- var _ = this.m;
- _[0] = e, _[1] = i, _[2] = r, _[3] = o, _[4] = a, _[5] = l, _[6] = h, _[7] = c, _[8] = u
- }
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 1, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0, arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0, arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 1)
- }, t.clone = function(e) {
- var i = e.m;
- return new t(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8])
- }, t.copy = function(t, e) {
- return t.m.set(e.m), t
- }, t.set = function(t, e, i, n, r, s, o, a, l, h) {
- var c = t.m;
- return c[0] = e, c[1] = i, c[2] = n, c[3] = r, c[4] = s, c[5] = o, c[6] = a, c[7] = l, c[8] = h, t
- }, t.identity = function(t) {
- var e = t.m;
- return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, t
- }, t.transpose = function(t, e) {
- var i = e.m,
- n = t.m;
- if (t === e) {
- var r = i[1],
- s = i[2],
- o = i[5];
- n[1] = i[3], n[2] = i[6], n[3] = r, n[5] = i[7], n[6] = s, n[7] = o
- } else n[0] = i[0], n[1] = i[3], n[2] = i[6], n[3] = i[1], n[4] = i[4], n[5] = i[7], n[6] = i[2], n[7] = i[5], n[8] = i[8];
- return t
- }, t.invert = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = i[6],
- u = i[7],
- _ = i[8],
- f = _ * l - h * u,
- d = -_ * a + h * c,
- p = u * a - l * c,
- m = r * f + s * d + o * p;
- return m ? (m = 1 / m, n[0] = f * m, n[1] = (-_ * s + o * u) * m, n[2] = (h * s - o * l) * m, n[3] = d * m, n[4] = (_ * r - o * c) * m, n[5] = (-h * r + o * a) * m, n[6] = p * m, n[7] = (-u * r + s * c) * m, n[8] = (l * r - s * a) * m, t) : null
- }, t.adjoint = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = i[6],
- u = i[7],
- _ = i[8];
- return n[0] = l * _ - h * u, n[1] = o * u - s * _, n[2] = s * h - o * l, n[3] = h * c - a * _, n[4] = r * _ - o * c, n[5] = o * a - r * h, n[6] = a * u - l * c, n[7] = s * c - r * u, n[8] = r * l - s * a, t
- }, t.determinant = function(t) {
- var e = t.m,
- i = e[0],
- n = e[1],
- r = e[2],
- s = e[3],
- o = e[4],
- a = e[5],
- l = e[6],
- h = e[7],
- c = e[8];
- return i * (c * o - a * h) + n * (-c * s + a * l) + r * (h * s - o * l)
- }, t.multiply = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m,
- o = n[0],
- a = n[1],
- l = n[2],
- h = n[3],
- c = n[4],
- u = n[5],
- _ = n[6],
- f = n[7],
- d = n[8],
- p = r[0],
- m = r[1],
- y = r[2],
- v = r[3],
- g = r[4],
- x = r[5],
- b = r[6],
- A = r[7],
- C = r[8];
- return s[0] = p * o + m * h + y * _, s[1] = p * a + m * c + y * f, s[2] = p * l + m * u + y * d, s[3] = v * o + g * h + x * _, s[4] = v * a + g * c + x * f, s[5] = v * l + g * u + x * d, s[6] = b * o + A * h + C * _, s[7] = b * a + A * c + C * f, s[8] = b * l + A * u + C * d, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.translate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = n[4],
- c = n[5],
- u = n[6],
- _ = n[7],
- f = n[8],
- d = i.x,
- p = i.y;
- return r[0] = s, r[1] = o, r[2] = a, r[3] = l, r[4] = h, r[5] = c, r[6] = d * s + p * l + u, r[7] = d * o + p * h + _, r[8] = d * a + p * c + f, t
- }, t.rotate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = n[0],
- o = n[1],
- a = n[2],
- l = n[3],
- h = n[4],
- c = n[5],
- u = n[6],
- _ = n[7],
- f = n[8],
- d = Math.sin(i),
- p = Math.cos(i);
- return r[0] = p * s + d * l, r[1] = p * o + d * h, r[2] = p * a + d * c, r[3] = p * l - d * s, r[4] = p * h - d * o, r[5] = p * c - d * a, r[6] = u, r[7] = _, r[8] = f, t
- }, t.scale = function(t, e, i) {
- var n = i.x,
- r = i.y,
- s = e.m,
- o = t.m;
- return o[0] = n * s[0], o[1] = n * s[1], o[2] = n * s[2], o[3] = r * s[3], o[4] = r * s[4], o[5] = r * s[5], o[6] = s[6], o[7] = s[7], o[8] = s[8], t
- }, t.fromMat4 = function(t, e) {
- var i = e.m,
- n = t.m;
- return n[0] = i[0], n[1] = i[1], n[2] = i[2], n[3] = i[4], n[4] = i[5], n[5] = i[6], n[6] = i[8], n[7] = i[9], n[8] = i[10], t
- }, t.fromTranslation = function(t, e) {
- var i = t.m;
- return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 1, i[5] = 0, i[6] = e.x, i[7] = e.y, i[8] = 1, t
- }, t.fromRotation = function(t, e) {
- var i = Math.sin(e),
- n = Math.cos(e),
- r = t.m;
- return r[0] = n, r[1] = i, r[2] = 0, r[3] = -i, r[4] = n, r[5] = 0, r[6] = 0, r[7] = 0, r[8] = 1, t
- }, t.fromScaling = function(t, e) {
- var i = t.m;
- return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = e.y, i[5] = 0, i[6] = 0, i[7] = 0, i[8] = 1, t
- }, t.fromMat2d = function(t, e) {
- var i = e.m,
- n = t.m;
- return n[0] = i[0], n[1] = i[1], n[2] = 0, n[3] = i[2], n[4] = i[3], n[5] = 0, n[6] = i[4], n[7] = i[5], n[8] = 1, t
- }, t.fromQuat = function(t, e) {
- var i = t.m,
- n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = n + n,
- l = r + r,
- h = s + s,
- c = n * a,
- u = r * a,
- _ = r * l,
- f = s * a,
- d = s * l,
- p = s * h,
- m = o * a,
- y = o * l,
- v = o * h;
- return i[0] = 1 - _ - p, i[3] = u - v, i[6] = f + y, i[1] = u + v, i[4] = 1 - c - p, i[7] = d - m, i[2] = f - y, i[5] = d + m, i[8] = 1 - c - _, t
- }, t.fromViewUp = function(e, i, s) {
- return (function() {
- var e = r.default.create(0, 1, 0),
- i = r.default.create(0, 0, 0),
- s = r.default.create(0, 0, 0);
- return function(o, a, l) {
- return r.default.sqrMag(a) < n.EPSILON * n.EPSILON ? (t.identity(o), o) : (l = l || e, r.default.normalize(i, r.default.cross(i, l, a)), r.default.sqrMag(i) < n.EPSILON * n.EPSILON ? (t.identity(o), o) : (r.default.cross(s, a, i), t.set(o, i.x, i.y, i.z, s.x, s.y, s.z, a.x, a.y, a.z), o))
- }
- })()(e, i, s)
- }, t.normalFromMat4 = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = i[6],
- u = i[7],
- _ = i[8],
- f = i[9],
- d = i[10],
- p = i[11],
- m = i[12],
- y = i[13],
- v = i[14],
- g = i[15],
- x = r * h - s * l,
- b = r * c - o * l,
- A = r * u - a * l,
- C = s * c - o * h,
- T = s * u - a * h,
- S = o * u - a * c,
- w = _ * y - f * m,
- E = _ * v - d * m,
- M = _ * g - p * m,
- D = f * v - d * y,
- B = f * g - p * y,
- I = d * g - p * v,
- P = x * I - b * B + A * D + C * M - T * E + S * w;
- return P ? (P = 1 / P, n[0] = (h * I - c * B + u * D) * P, n[1] = (c * M - l * I - u * E) * P, n[2] = (l * B - h * M + u * w) * P, n[3] = (o * B - s * I - a * D) * P, n[4] = (r * I - o * M + a * E) * P, n[5] = (s * M - r * B - a * w) * P, n[6] = (y * S - v * T + g * C) * P, n[7] = (v * A - m * S - g * b) * P, n[8] = (m * T - y * A + g * x) * P, t) : null
- }, t.str = function(t) {
- var e = t.m;
- return "mat3(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ", " + e[6] + ", " + e[7] + ", " + e[8] + ")"
- }, t.array = function(t, e) {
- var i = e.m;
- return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t
- }, t.frob = function(t) {
- var e = t.m;
- return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2))
- }, t.add = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], s[6] = n[6] + r[6], s[7] = n[7] + r[7], s[8] = n[8] + r[8], t
- }, t.subtract = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], s[6] = n[6] - r[6], s[7] = n[7] - r[7], s[8] = n[8] - r[8], t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiplyScalar = function(t, e, i) {
- var n = e.m,
- r = t.m;
- return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, r[6] = n[6] * i, r[7] = n[7] * i, r[8] = n[8] * i, t
- }, t.multiplyScalarAndAdd = function(t, e, i, n) {
- var r = e.m,
- s = i.m,
- o = t.m;
- return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, o[6] = r[6] + s[6] * n, o[7] = r[7] + s[7] * n, o[8] = r[8] + s[8] * n, t
- }, t.exactEquals = function(t, e) {
- var i = t.m,
- n = e.m;
- return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8]
- }, t.equals = function(t, e) {
- var i = t.m,
- r = e.m,
- s = i[0],
- o = i[1],
- a = i[2],
- l = i[3],
- h = i[4],
- c = i[5],
- u = i[6],
- _ = i[7],
- f = i[8],
- d = r[0],
- p = r[1],
- m = r[2],
- y = r[3],
- v = r[4],
- g = r[5],
- x = r[6],
- b = r[7],
- A = r[8];
- return Math.abs(s - d) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(o - p) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(p)) && Math.abs(a - m) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(m)) && Math.abs(l - y) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(y)) && Math.abs(h - v) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(v)) && Math.abs(c - g) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(g)) && Math.abs(u - x) <= n.EPSILON * Math.max(1, Math.abs(u), Math.abs(x)) && Math.abs(_ - b) <= n.EPSILON * Math.max(1, Math.abs(_), Math.abs(b)) && Math.abs(f - A) <= n.EPSILON * Math.max(1, Math.abs(f), Math.abs(A))
- }, t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./utils": 333,
- "./vec3": 335
- }],
- 330: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
- a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0,
- l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 1,
- h = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0,
- c = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0,
- u = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 0,
- _ = arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0,
- f = arguments.length > 10 && void 0 !== arguments[10] ? arguments[10] : 1,
- d = arguments.length > 11 && void 0 !== arguments[11] ? arguments[11] : 0,
- p = arguments.length > 12 && void 0 !== arguments[12] ? arguments[12] : 0,
- m = arguments.length > 13 && void 0 !== arguments[13] ? arguments[13] : 0,
- y = arguments.length > 14 && void 0 !== arguments[14] ? arguments[14] : 0,
- v = arguments.length > 15 && void 0 !== arguments[15] ? arguments[15] : 1;
- if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(16), this.m.set(e)) : this.m = e;
- else {
- this.m = new n.FLOAT_ARRAY_TYPE(16);
- var g = this.m;
- g[0] = e, g[1] = i, g[2] = s, g[3] = o, g[4] = a, g[5] = l, g[6] = h, g[7] = c, g[8] = u, g[9] = _, g[10] = f, g[11] = d, g[12] = p, g[13] = m, g[14] = y, g[15] = v
- }
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 1, arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0, arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0, arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 0, arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0, arguments.length > 10 && void 0 !== arguments[10] ? arguments[10] : 1, arguments.length > 11 && void 0 !== arguments[11] ? arguments[11] : 0, arguments.length > 12 && void 0 !== arguments[12] ? arguments[12] : 0, arguments.length > 13 && void 0 !== arguments[13] ? arguments[13] : 0, arguments.length > 14 && void 0 !== arguments[14] ? arguments[14] : 0, arguments.length > 15 && void 0 !== arguments[15] ? arguments[15] : 1)
- }, t.clone = function(e) {
- var i = e.m;
- return new t(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8], i[9], i[10], i[11], i[12], i[13], i[14], i[15])
- }, t.copy = function(t, e) {
- return t.m.set(e.m), t
- }, t.set = function(t, e, i, n, r, s, o, a, l, h, c, u, _, f, d, p, m) {
- var y = t.m;
- return y[0] = e, y[1] = i, y[2] = n, y[3] = r, y[4] = s, y[5] = o, y[6] = a, y[7] = l, y[8] = h, y[9] = c, y[10] = u, y[11] = _, y[12] = f, y[13] = d, y[14] = p, y[15] = m, t
- }, t.identity = function(t) {
- var e = t.m;
- return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, t
- }, t.transpose = function(t, e) {
- var i = e.m,
- n = t.m;
- if (t === e) {
- var r = i[1],
- s = i[2],
- o = i[3],
- a = i[6],
- l = i[7],
- h = i[11];
- n[1] = i[4], n[2] = i[8], n[3] = i[12], n[4] = r, n[6] = i[9], n[7] = i[13], n[8] = s, n[9] = a, n[11] = i[14], n[12] = o, n[13] = l, n[14] = h
- } else n[0] = i[0], n[1] = i[4], n[2] = i[8], n[3] = i[12], n[4] = i[1], n[5] = i[5], n[6] = i[9], n[7] = i[13], n[8] = i[2], n[9] = i[6], n[10] = i[10], n[11] = i[14], n[12] = i[3], n[13] = i[7], n[14] = i[11], n[15] = i[15];
- return t
- }, t.invert = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = i[6],
- u = i[7],
- _ = i[8],
- f = i[9],
- d = i[10],
- p = i[11],
- m = i[12],
- y = i[13],
- v = i[14],
- g = i[15],
- x = r * h - s * l,
- b = r * c - o * l,
- A = r * u - a * l,
- C = s * c - o * h,
- T = s * u - a * h,
- S = o * u - a * c,
- w = _ * y - f * m,
- E = _ * v - d * m,
- M = _ * g - p * m,
- D = f * v - d * y,
- B = f * g - p * y,
- I = d * g - p * v,
- P = x * I - b * B + A * D + C * M - T * E + S * w;
- return P ? (P = 1 / P, n[0] = (h * I - c * B + u * D) * P, n[1] = (o * B - s * I - a * D) * P, n[2] = (y * S - v * T + g * C) * P, n[3] = (d * T - f * S - p * C) * P, n[4] = (c * M - l * I - u * E) * P, n[5] = (r * I - o * M + a * E) * P, n[6] = (v * A - m * S - g * b) * P, n[7] = (_ * S - d * A + p * b) * P, n[8] = (l * B - h * M + u * w) * P, n[9] = (s * M - r * B - a * w) * P, n[10] = (m * T - y * A + g * x) * P, n[11] = (f * A - _ * T - p * x) * P, n[12] = (h * E - l * D - c * w) * P, n[13] = (r * D - s * E + o * w) * P, n[14] = (y * b - m * C - v * x) * P, n[15] = (_ * C - f * b + d * x) * P, t) : null
- }, t.adjoint = function(t, e) {
- var i = e.m,
- n = t.m,
- r = i[0],
- s = i[1],
- o = i[2],
- a = i[3],
- l = i[4],
- h = i[5],
- c = i[6],
- u = i[7],
- _ = i[8],
- f = i[9],
- d = i[10],
- p = i[11],
- m = i[12],
- y = i[13],
- v = i[14],
- g = i[15];
- return n[0] = h * (d * g - p * v) - f * (c * g - u * v) + y * (c * p - u * d), n[1] = -(s * (d * g - p * v) - f * (o * g - a * v) + y * (o * p - a * d)), n[2] = s * (c * g - u * v) - h * (o * g - a * v) + y * (o * u - a * c), n[3] = -(s * (c * p - u * d) - h * (o * p - a * d) + f * (o * u - a * c)), n[4] = -(l * (d * g - p * v) - _ * (c * g - u * v) + m * (c * p - u * d)), n[5] = r * (d * g - p * v) - _ * (o * g - a * v) + m * (o * p - a * d), n[6] = -(r * (c * g - u * v) - l * (o * g - a * v) + m * (o * u - a * c)), n[7] = r * (c * p - u * d) - l * (o * p - a * d) + _ * (o * u - a * c), n[8] = l * (f * g - p * y) - _ * (h * g - u * y) + m * (h * p - u * f), n[9] = -(r * (f * g - p * y) - _ * (s * g - a * y) + m * (s * p - a * f)), n[10] = r * (h * g - u * y) - l * (s * g - a * y) + m * (s * u - a * h), n[11] = -(r * (h * p - u * f) - l * (s * p - a * f) + _ * (s * u - a * h)), n[12] = -(l * (f * v - d * y) - _ * (h * v - c * y) + m * (h * d - c * f)), n[13] = r * (f * v - d * y) - _ * (s * v - o * y) + m * (s * d - o * f), n[14] = -(r * (h * v - c * y) - l * (s * v - o * y) + m * (s * c - o * h)), n[15] = r * (h * d - c * f) - l * (s * d - o * f) + _ * (s * c - o * h), t
- }, t.determinant = function(t) {
- var e = t.m,
- i = e[0],
- n = e[1],
- r = e[2],
- s = e[3],
- o = e[4],
- a = e[5],
- l = e[6],
- h = e[7],
- c = e[8],
- u = e[9],
- _ = e[10],
- f = e[11],
- d = e[12],
- p = e[13],
- m = e[14],
- y = e[15];
- return (i * a - n * o) * (_ * y - f * m) - (i * l - r * o) * (u * y - f * p) + (i * h - s * o) * (u * m - _ * p) + (n * l - r * a) * (c * y - f * d) - (n * h - s * a) * (c * m - _ * d) + (r * h - s * l) * (c * p - u * d)
- }, t.multiply = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m,
- o = n[0],
- a = n[1],
- l = n[2],
- h = n[3],
- c = n[4],
- u = n[5],
- _ = n[6],
- f = n[7],
- d = n[8],
- p = n[9],
- m = n[10],
- y = n[11],
- v = n[12],
- g = n[13],
- x = n[14],
- b = n[15],
- A = r[0],
- C = r[1],
- T = r[2],
- S = r[3];
- return s[0] = A * o + C * c + T * d + S * v, s[1] = A * a + C * u + T * p + S * g, s[2] = A * l + C * _ + T * m + S * x, s[3] = A * h + C * f + T * y + S * b, A = r[4], C = r[5], T = r[6], S = r[7], s[4] = A * o + C * c + T * d + S * v, s[5] = A * a + C * u + T * p + S * g, s[6] = A * l + C * _ + T * m + S * x, s[7] = A * h + C * f + T * y + S * b, A = r[8], C = r[9], T = r[10], S = r[11], s[8] = A * o + C * c + T * d + S * v, s[9] = A * a + C * u + T * p + S * g, s[10] = A * l + C * _ + T * m + S * x, s[11] = A * h + C * f + T * y + S * b, A = r[12], C = r[13], T = r[14], S = r[15], s[12] = A * o + C * c + T * d + S * v, s[13] = A * a + C * u + T * p + S * g, s[14] = A * l + C * _ + T * m + S * x, s[15] = A * h + C * f + T * y + S * b, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.translate = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = i.x,
- o = i.y,
- a = i.z,
- l = void 0,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = void 0,
- f = void 0,
- d = void 0,
- p = void 0,
- m = void 0,
- y = void 0,
- v = void 0,
- g = void 0;
- return e === t ? (r[12] = n[0] * s + n[4] * o + n[8] * a + n[12], r[13] = n[1] * s + n[5] * o + n[9] * a + n[13], r[14] = n[2] * s + n[6] * o + n[10] * a + n[14], r[15] = n[3] * s + n[7] * o + n[11] * a + n[15]) : (l = n[0], h = n[1], c = n[2], u = n[3], _ = n[4], f = n[5], d = n[6], p = n[7], m = n[8], y = n[9], v = n[10], g = n[11], r[0] = l, r[1] = h, r[2] = c, r[3] = u, r[4] = _, r[5] = f, r[6] = d, r[7] = p, r[8] = m, r[9] = y, r[10] = v, r[11] = g, r[12] = l * s + _ * o + m * a + n[12], r[13] = h * s + f * o + y * a + n[13], r[14] = c * s + d * o + v * a + n[14], r[15] = u * s + p * o + g * a + n[15]), t
- }, t.scale = function(t, e, i) {
- var n = i.x,
- r = i.y,
- s = i.z,
- o = e.m,
- a = t.m;
- return a[0] = o[0] * n, a[1] = o[1] * n, a[2] = o[2] * n, a[3] = o[3] * n, a[4] = o[4] * r, a[5] = o[5] * r, a[6] = o[6] * r, a[7] = o[7] * r, a[8] = o[8] * s, a[9] = o[9] * s, a[10] = o[10] * s, a[11] = o[11] * s, a[12] = o[12], a[13] = o[13], a[14] = o[14], a[15] = o[15], t
- }, t.rotate = function(t, e, i, r) {
- var s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S, w, E, M, D = e.m,
- B = t.m,
- I = r.x,
- P = r.y,
- R = r.z,
- O = Math.sqrt(I * I + P * P + R * R);
- return Math.abs(O) < n.EPSILON ? null : (I *= O = 1 / O, P *= O, R *= O, s = Math.sin(i), a = 1 - (o = Math.cos(i)), l = D[0], h = D[1], c = D[2], u = D[3], _ = D[4], f = D[5], d = D[6], p = D[7], m = D[8], y = D[9], v = D[10], g = D[11], x = I * I * a + o, b = P * I * a + R * s, A = R * I * a - P * s, C = I * P * a - R * s, T = P * P * a + o, S = R * P * a + I * s, w = I * R * a + P * s, E = P * R * a - I * s, M = R * R * a + o, B[0] = l * x + _ * b + m * A, B[1] = h * x + f * b + y * A, B[2] = c * x + d * b + v * A, B[3] = u * x + p * b + g * A, B[4] = l * C + _ * T + m * S, B[5] = h * C + f * T + y * S, B[6] = c * C + d * T + v * S, B[7] = u * C + p * T + g * S, B[8] = l * w + _ * E + m * M, B[9] = h * w + f * E + y * M, B[10] = c * w + d * E + v * M, B[11] = u * w + p * E + g * M, e !== t && (B[12] = D[12], B[13] = D[13], B[14] = D[14], B[15] = D[15]), t)
- }, t.rotateX = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = Math.sin(i),
- o = Math.cos(i),
- a = n[4],
- l = n[5],
- h = n[6],
- c = n[7],
- u = n[8],
- _ = n[9],
- f = n[10],
- d = n[11];
- return e !== t && (r[0] = n[0], r[1] = n[1], r[2] = n[2], r[3] = n[3], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[4] = a * o + u * s, r[5] = l * o + _ * s, r[6] = h * o + f * s, r[7] = c * o + d * s, r[8] = u * o - a * s, r[9] = _ * o - l * s, r[10] = f * o - h * s, r[11] = d * o - c * s, t
- }, t.rotateY = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = Math.sin(i),
- o = Math.cos(i),
- a = n[0],
- l = n[1],
- h = n[2],
- c = n[3],
- u = n[8],
- _ = n[9],
- f = n[10],
- d = n[11];
- return e !== t && (r[4] = n[4], r[5] = n[5], r[6] = n[6], r[7] = n[7], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[0] = a * o - u * s, r[1] = l * o - _ * s, r[2] = h * o - f * s, r[3] = c * o - d * s, r[8] = a * s + u * o, r[9] = l * s + _ * o, r[10] = h * s + f * o, r[11] = c * s + d * o, t
- }, t.rotateZ = function(t, e, i) {
- var n = e.m,
- r = t.m,
- s = Math.sin(i),
- o = Math.cos(i),
- a = n[0],
- l = n[1],
- h = n[2],
- c = n[3],
- u = n[4],
- _ = n[5],
- f = n[6],
- d = n[7];
- return e !== t && (r[8] = n[8], r[9] = n[9], r[10] = n[10], r[11] = n[11], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[0] = a * o + u * s, r[1] = l * o + _ * s, r[2] = h * o + f * s, r[3] = c * o + d * s, r[4] = u * o - a * s, r[5] = _ * o - l * s, r[6] = f * o - h * s, r[7] = d * o - c * s, t
- }, t.fromTranslation = function(t, e) {
- var i = t.m;
- return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, t
- }, t.fromScaling = function(t, e) {
- var i = t.m;
- return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = e.y, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = e.z, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
- }, t.fromRotation = function(t, e, i) {
- var r, s, o, a = t.m,
- l = i.x,
- h = i.y,
- c = i.z,
- u = Math.sqrt(l * l + h * h + c * c);
- return Math.abs(u) < n.EPSILON ? null : (l *= u = 1 / u, h *= u, c *= u, r = Math.sin(e), o = 1 - (s = Math.cos(e)), a[0] = l * l * o + s, a[1] = h * l * o + c * r, a[2] = c * l * o - h * r, a[3] = 0, a[4] = l * h * o - c * r, a[5] = h * h * o + s, a[6] = c * h * o + l * r, a[7] = 0, a[8] = l * c * o + h * r, a[9] = h * c * o - l * r, a[10] = c * c * o + s, a[11] = 0, a[12] = 0, a[13] = 0, a[14] = 0, a[15] = 1, t)
- }, t.fromXRotation = function(t, e) {
- var i = t.m,
- n = Math.sin(e),
- r = Math.cos(e);
- return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = r, i[6] = n, i[7] = 0, i[8] = 0, i[9] = -n, i[10] = r, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
- }, t.fromYRotation = function(t, e) {
- var i = t.m,
- n = Math.sin(e),
- r = Math.cos(e);
- return i[0] = r, i[1] = 0, i[2] = -n, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = n, i[9] = 0, i[10] = r, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
- }, t.fromZRotation = function(t, e) {
- var i = t.m,
- n = Math.sin(e),
- r = Math.cos(e);
- return i[0] = r, i[1] = n, i[2] = 0, i[3] = 0, i[4] = -n, i[5] = r, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
- }, t.fromRT = function(t, e, i) {
- var n = t.m,
- r = e.x,
- s = e.y,
- o = e.z,
- a = e.w,
- l = r + r,
- h = s + s,
- c = o + o,
- u = r * l,
- _ = r * h,
- f = r * c,
- d = s * h,
- p = s * c,
- m = o * c,
- y = a * l,
- v = a * h,
- g = a * c;
- return n[0] = 1 - (d + m), n[1] = _ + g, n[2] = f - v, n[3] = 0, n[4] = _ - g, n[5] = 1 - (u + m), n[6] = p + y, n[7] = 0, n[8] = f + v, n[9] = p - y, n[10] = 1 - (u + d), n[11] = 0, n[12] = i.x, n[13] = i.y, n[14] = i.z, n[15] = 1, t
- }, t.fromTRSArray = function(t, e) {
- var i = t.m,
- n = e[3],
- r = e[4],
- s = e[5],
- o = e[6],
- a = n + n,
- l = r + r,
- h = s + s,
- c = n * a,
- u = n * l,
- _ = n * h,
- f = r * l,
- d = r * h,
- p = s * h,
- m = o * a,
- y = o * l,
- v = o * h,
- g = e[7],
- x = e[8],
- b = e[9];
- return i[0] = (1 - (f + p)) * g, i[1] = (u + v) * g, i[2] = (_ - y) * g, i[3] = 0, i[4] = (u - v) * x, i[5] = (1 - (c + p)) * x, i[6] = (d + m) * x, i[7] = 0, i[8] = (_ + y) * b, i[9] = (d - m) * b, i[10] = (1 - (c + f)) * b, i[11] = 0, i[12] = e[0], i[13] = e[1], i[14] = e[2], i[15] = 1, t
- }, t.getTranslation = function(t, e) {
- var i = e.m;
- return t.x = i[12], t.y = i[13], t.z = i[14], t
- }, t.getScaling = function(t, e) {
- var i = e.m,
- n = i[0],
- r = i[1],
- s = i[2],
- o = i[4],
- a = i[5],
- l = i[6],
- h = i[8],
- c = i[9],
- u = i[10];
- return t.x = Math.sqrt(n * n + r * r + s * s), t.y = Math.sqrt(o * o + a * a + l * l), t.z = Math.sqrt(h * h + c * c + u * u), t
- }, t.getRotation = function(t, e) {
- var i = e.m,
- n = i[0] + i[5] + i[10],
- r = 0;
- return n > 0 ? (r = 2 * Math.sqrt(n + 1), t.w = .25 * r, t.x = (i[6] - i[9]) / r, t.y = (i[8] - i[2]) / r, t.z = (i[1] - i[4]) / r) : i[0] > i[5] & i[0] > i[10] ? (r = 2 * Math.sqrt(1 + i[0] - i[5] - i[10]), t.w = (i[6] - i[9]) / r, t.x = .25 * r, t.y = (i[1] + i[4]) / r, t.z = (i[8] + i[2]) / r) : i[5] > i[10] ? (r = 2 * Math.sqrt(1 + i[5] - i[0] - i[10]), t.w = (i[8] - i[2]) / r, t.x = (i[1] + i[4]) / r, t.y = .25 * r, t.z = (i[6] + i[9]) / r) : (r = 2 * Math.sqrt(1 + i[10] - i[0] - i[5]), t.w = (i[1] - i[4]) / r, t.x = (i[8] + i[2]) / r, t.y = (i[6] + i[9]) / r, t.z = .25 * r), t
- }, t.fromRTS = function(t, e, i, n) {
- var r = t.m,
- s = e.x,
- o = e.y,
- a = e.z,
- l = e.w,
- h = s + s,
- c = o + o,
- u = a + a,
- _ = s * h,
- f = s * c,
- d = s * u,
- p = o * c,
- m = o * u,
- y = a * u,
- v = l * h,
- g = l * c,
- x = l * u,
- b = n.x,
- A = n.y,
- C = n.z;
- return r[0] = (1 - (p + y)) * b, r[1] = (f + x) * b, r[2] = (d - g) * b, r[3] = 0, r[4] = (f - x) * A, r[5] = (1 - (_ + y)) * A, r[6] = (m + v) * A, r[7] = 0, r[8] = (d + g) * C, r[9] = (m - v) * C, r[10] = (1 - (_ + p)) * C, r[11] = 0, r[12] = i.x, r[13] = i.y, r[14] = i.z, r[15] = 1, t
- }, t.fromRTSOrigin = function(t, e, i, n, r) {
- var s = t.m,
- o = e.x,
- a = e.y,
- l = e.z,
- h = e.w,
- c = o + o,
- u = a + a,
- _ = l + l,
- f = o * c,
- d = o * u,
- p = o * _,
- m = a * u,
- y = a * _,
- v = l * _,
- g = h * c,
- x = h * u,
- b = h * _,
- A = n.x,
- C = n.y,
- T = n.z,
- S = r.x,
- w = r.y,
- E = r.z;
- return s[0] = (1 - (m + v)) * A, s[1] = (d + b) * A, s[2] = (p - x) * A, s[3] = 0, s[4] = (d - b) * C, s[5] = (1 - (f + v)) * C, s[6] = (y + g) * C, s[7] = 0, s[8] = (p + x) * T, s[9] = (y - g) * T, s[10] = (1 - (f + m)) * T, s[11] = 0, s[12] = i.x + S - (s[0] * S + s[4] * w + s[8] * E), s[13] = i.y + w - (s[1] * S + s[5] * w + s[9] * E), s[14] = i.z + E - (s[2] * S + s[6] * w + s[10] * E), s[15] = 1, t
- }, t.fromQuat = function(t, e) {
- var i = t.m,
- n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = n + n,
- l = r + r,
- h = s + s,
- c = n * a,
- u = r * a,
- _ = r * l,
- f = s * a,
- d = s * l,
- p = s * h,
- m = o * a,
- y = o * l,
- v = o * h;
- return i[0] = 1 - _ - p, i[1] = u + v, i[2] = f - y, i[3] = 0, i[4] = u - v, i[5] = 1 - c - p, i[6] = d + m, i[7] = 0, i[8] = f + y, i[9] = d - m, i[10] = 1 - c - _, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
- }, t.frustum = function(t, e, i, n, r, s, o) {
- var a = t.m,
- l = 1 / (i - e),
- h = 1 / (r - n),
- c = 1 / (s - o);
- return a[0] = 2 * s * l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = 2 * s * h, a[6] = 0, a[7] = 0, a[8] = (i + e) * l, a[9] = (r + n) * h, a[10] = (o + s) * c, a[11] = -1, a[12] = 0, a[13] = 0, a[14] = o * s * 2 * c, a[15] = 0, t
- }, t.perspective = function(t, e, i, n, r) {
- var s = t.m,
- o = 1 / Math.tan(e / 2),
- a = 1 / (n - r);
- return s[0] = o / i, s[1] = 0, s[2] = 0, s[3] = 0, s[4] = 0, s[5] = o, s[6] = 0, s[7] = 0, s[8] = 0, s[9] = 0, s[10] = (r + n) * a, s[11] = -1, s[12] = 0, s[13] = 0, s[14] = 2 * r * n * a, s[15] = 0, t
- }, t.perspectiveFromFieldOfView = function(t, e, i, n) {
- var r = t.m,
- s = Math.tan(e.upDegrees * Math.PI / 180),
- o = Math.tan(e.downDegrees * Math.PI / 180),
- a = Math.tan(e.leftDegrees * Math.PI / 180),
- l = Math.tan(e.rightDegrees * Math.PI / 180),
- h = 2 / (a + l),
- c = 2 / (s + o);
- return r[0] = h, r[1] = 0, r[2] = 0, r[3] = 0, r[4] = 0, r[5] = c, r[6] = 0, r[7] = 0, r[8] = -(a - l) * h * .5, r[9] = (s - o) * c * .5, r[10] = n / (i - n), r[11] = -1, r[12] = 0, r[13] = 0, r[14] = n * i / (i - n), r[15] = 0, t
- }, t.ortho = function(t, e, i, n, r, s, o) {
- var a = t.m,
- l = 1 / (e - i),
- h = 1 / (n - r),
- c = 1 / (s - o);
- return a[0] = -2 * l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = -2 * h, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = 2 * c, a[11] = 0, a[12] = (e + i) * l, a[13] = (r + n) * h, a[14] = (o + s) * c, a[15] = 1, t
- }, t.lookAt = function(t, e, i, n) {
- var r, s, o, a = t.m,
- l = void 0,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = void 0,
- f = void 0,
- d = void 0,
- p = e.x,
- m = e.y,
- y = e.z,
- v = n.x,
- g = n.y,
- x = n.z;
- return u = p - i.x, _ = m - i.y, f = y - i.z, l = g * (f *= d = 1 / Math.sqrt(u * u + _ * _ + f * f)) - x * (_ *= d), h = x * (u *= d) - v * f, c = v * _ - g * u, r = _ * (c *= d = 1 / Math.sqrt(l * l + h * h + c * c)) - f * (h *= d), s = f * (l *= d) - u * c, o = u * h - _ * l, a[0] = l, a[1] = r, a[2] = u, a[3] = 0, a[4] = h, a[5] = s, a[6] = _, a[7] = 0, a[8] = c, a[9] = o, a[10] = f, a[11] = 0, a[12] = -(l * p + h * m + c * y), a[13] = -(r * p + s * m + o * y), a[14] = -(u * p + _ * m + f * y), a[15] = 1, t
- }, t.str = function(t) {
- var e = t.m;
- return "mat4(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ", " + e[6] + ", " + e[7] + ", " + e[8] + ", " + e[9] + ", " + e[10] + ", " + e[11] + ", " + e[12] + ", " + e[13] + ", " + e[14] + ", " + e[15] + ")"
- }, t.array = function(t, e) {
- var i = e.m;
- return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t[9] = i[9], t[10] = i[10], t[11] = i[11], t[12] = i[12], t[13] = i[13], t[14] = i[14], t[15] = i[15], t
- }, t.frob = function(t) {
- var e = t.m;
- return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2) + Math.pow(e[9], 2) + Math.pow(e[10], 2) + Math.pow(e[11], 2) + Math.pow(e[12], 2) + Math.pow(e[13], 2) + Math.pow(e[14], 2) + Math.pow(e[15], 2))
- }, t.add = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], s[6] = n[6] + r[6], s[7] = n[7] + r[7], s[8] = n[8] + r[8], s[9] = n[9] + r[9], s[10] = n[10] + r[10], s[11] = n[11] + r[11], s[12] = n[12] + r[12], s[13] = n[13] + r[13], s[14] = n[14] + r[14], s[15] = n[15] + r[15], t
- }, t.subtract = function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m;
- return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], s[6] = n[6] - r[6], s[7] = n[7] - r[7], s[8] = n[8] - r[8], s[9] = n[9] - r[9], s[10] = n[10] - r[10], s[11] = n[11] - r[11], s[12] = n[12] - r[12], s[13] = n[13] - r[13], s[14] = n[14] - r[14], s[15] = n[15] - r[15], t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiplyScalar = function(t, e, i) {
- var n = e.m,
- r = t.m;
- return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, r[6] = n[6] * i, r[7] = n[7] * i, r[8] = n[8] * i, r[9] = n[9] * i, r[10] = n[10] * i, r[11] = n[11] * i, r[12] = n[12] * i, r[13] = n[13] * i, r[14] = n[14] * i, r[15] = n[15] * i, t
- }, t.multiplyScalarAndAdd = function(t, e, i, n) {
- var r = e.m,
- s = i.m,
- o = t.m;
- return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, o[6] = r[6] + s[6] * n, o[7] = r[7] + s[7] * n, o[8] = r[8] + s[8] * n, o[9] = r[9] + s[9] * n, o[10] = r[10] + s[10] * n, o[11] = r[11] + s[11] * n, o[12] = r[12] + s[12] * n, o[13] = r[13] + s[13] * n, o[14] = r[14] + s[14] * n, o[15] = r[15] + s[15] * n, t
- }, t.exactEquals = function(t, e) {
- var i = t.m,
- n = e.m;
- return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8] && i[9] === n[9] && i[10] === n[10] && i[11] === n[11] && i[12] === n[12] && i[13] === n[13] && i[14] === n[14] && i[15] === n[15]
- }, t.equals = function(t, e) {
- var i = t.m,
- r = e.m,
- s = i[0],
- o = i[1],
- a = i[2],
- l = i[3],
- h = i[4],
- c = i[5],
- u = i[6],
- _ = i[7],
- f = i[8],
- d = i[9],
- p = i[10],
- m = i[11],
- y = i[12],
- v = i[13],
- g = i[14],
- x = i[15],
- b = r[0],
- A = r[1],
- C = r[2],
- T = r[3],
- S = r[4],
- w = r[5],
- E = r[6],
- M = r[7],
- D = r[8],
- B = r[9],
- I = r[10],
- P = r[11],
- R = r[12],
- O = r[13],
- L = r[14],
- F = r[15];
- return Math.abs(s - b) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(o - A) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(A)) && Math.abs(a - C) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(C)) && Math.abs(l - T) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(T)) && Math.abs(h - S) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(S)) && Math.abs(c - w) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(w)) && Math.abs(u - E) <= n.EPSILON * Math.max(1, Math.abs(u), Math.abs(E)) && Math.abs(_ - M) <= n.EPSILON * Math.max(1, Math.abs(_), Math.abs(M)) && Math.abs(f - D) <= n.EPSILON * Math.max(1, Math.abs(f), Math.abs(D)) && Math.abs(d - B) <= n.EPSILON * Math.max(1, Math.abs(d), Math.abs(B)) && Math.abs(p - I) <= n.EPSILON * Math.max(1, Math.abs(p), Math.abs(I)) && Math.abs(m - P) <= n.EPSILON * Math.max(1, Math.abs(m), Math.abs(P)) && Math.abs(y - R) <= n.EPSILON * Math.max(1, Math.abs(y), Math.abs(R)) && Math.abs(v - O) <= n.EPSILON * Math.max(1, Math.abs(v), Math.abs(O)) && Math.abs(g - L) <= n.EPSILON * Math.max(1, Math.abs(g), Math.abs(L)) && Math.abs(x - F) <= n.EPSILON * Math.max(1, Math.abs(x), Math.abs(F))
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 331: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = a(t("./vec3")),
- r = a(t("./vec4")),
- s = a(t("./mat3")),
- o = t("./utils");
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var h = .5 * Math.PI / 180,
- c = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
- l(this, t), this.x = e, this.y = i, this.z = n, this.w = r
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
- }, t.clone = function(e) {
- return new t(e.x, e.y, e.z, e.w)
- }, t.copy = function(t, e) {
- return r.default.copy(t, e)
- }, t.set = function(t, e, i, n, r) {
- return t.x = e, t.y = i, t.z = n, t.w = r, t
- }, t.identity = function(t) {
- return t.x = 0, t.y = 0, t.z = 0, t.w = 1, t
- }, t.rotationTo = function(e, i, r) {
- return (function() {
- var e = n.default.create(0, 0, 0),
- i = n.default.create(1, 0, 0),
- r = n.default.create(0, 1, 0);
- return function(s, o, a) {
- var l = n.default.dot(o, a);
- return l < -.999999 ? (n.default.cross(e, i, o), n.default.magnitude(e) < 1e-6 && n.default.cross(e, r, o), n.default.normalize(e, e), t.fromAxisAngle(s, e, Math.PI), s) : l > .999999 ? (s.x = 0, s.y = 0, s.z = 0, s.w = 1, s) : (n.default.cross(e, o, a), s.x = e.x, s.y = e.y, s.z = e.z, s.w = 1 + l, t.normalize(s, s))
- }
- })()(e, i, r)
- }, t.getAxisAngle = function(t, e) {
- var i = 2 * Math.acos(e.w),
- n = Math.sin(i / 2);
- return 0 != n ? (t.x = e.x / n, t.y = e.y / n, t.z = e.z / n) : (t.x = 1, t.y = 0, t.z = 0), i
- }, t.multiply = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = i.x,
- l = i.y,
- h = i.z,
- c = i.w;
- return t.x = n * c + o * a + r * h - s * l, t.y = r * c + o * l + s * a - n * h, t.z = s * c + o * h + n * l - r * a, t.w = o * c - n * a - r * l - s * h, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.scale = function(t, e, i) {
- return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t.w = e.w * i, t
- }, t.rotateX = function(t, e, i) {
- i *= .5;
- var n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = Math.sin(i),
- l = Math.cos(i);
- return t.x = n * l + o * a, t.y = r * l + s * a, t.z = s * l - r * a, t.w = o * l - n * a, t
- }, t.rotateY = function(t, e, i) {
- i *= .5;
- var n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = Math.sin(i),
- l = Math.cos(i);
- return t.x = n * l - s * a, t.y = r * l + o * a, t.z = s * l + n * a, t.w = o * l - r * a, t
- }, t.rotateZ = function(t, e, i) {
- i *= .5;
- var n = e.x,
- r = e.y,
- s = e.z,
- o = e.w,
- a = Math.sin(i),
- l = Math.cos(i);
- return t.x = n * l + r * a, t.y = r * l - n * a, t.z = s * l + o * a, t.w = o * l - s * a, t
- }, t.rotateAround = function(e, i, r, s) {
- return (function() {
- var e = n.default.create(0, 0, 0),
- i = t.create();
- return function(r, s, o, a) {
- return t.invert(i, s), n.default.transformQuat(e, o, i), t.fromAxisAngle(i, e, a), t.mul(r, s, i), r
- }
- })()(e, i, r, s)
- }, t.rotateAroundLocal = function(e, i, n, r) {
- return (function() {
- var e = t.create();
- return function(i, n, r, s) {
- return t.fromAxisAngle(e, r, s), t.mul(i, n, e), i
- }
- })()(e, i, n, r)
- }, t.calculateW = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z;
- return t.x = i, t.y = n, t.z = r, t.w = Math.sqrt(Math.abs(1 - i * i - n * n - r * r)), t
- }, t.dot = function(t, e) {
- return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w
- }, t.lerp = function(t, e, i, n) {
- var r = e.x,
- s = e.y,
- o = e.z,
- a = e.w;
- return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t.w = a + n * (i.w - a), t
- }, t.slerp = function(t, e, i, n) {
- var r = e.x,
- s = e.y,
- o = e.z,
- a = e.w,
- l = i.x,
- h = i.y,
- c = i.z,
- u = i.w,
- _ = void 0,
- f = void 0,
- d = void 0,
- p = void 0,
- m = void 0;
- return (f = r * l + s * h + o * c + a * u) < 0 && (f = -f, l = -l, h = -h, c = -c, u = -u), 1 - f > 1e-6 ? (_ = Math.acos(f), d = Math.sin(_), p = Math.sin((1 - n) * _) / d, m = Math.sin(n * _) / d) : (p = 1 - n, m = n), t.x = p * r + m * l, t.y = p * s + m * h, t.z = p * o + m * c, t.w = p * a + m * u, t
- }, t.sqlerp = function(e, i, n, r, s, o) {
- return (function() {
- var e = t.create(),
- i = t.create();
- return function(n, r, s, o, a, l) {
- return t.slerp(e, r, a, l), t.slerp(i, s, o, l), t.slerp(n, e, i, 2 * l * (1 - l)), n
- }
- })()(e, i, n, r, s, o)
- }, t.invert = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z,
- s = e.w,
- o = i * i + n * n + r * r + s * s,
- a = o ? 1 / o : 0;
- return t.x = -i * a, t.y = -n * a, t.z = -r * a, t.w = s * a, t
- }, t.conjugate = function(t, e) {
- return t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = e.w, t
- }, t.magnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z,
- r = t.w;
- return Math.sqrt(e * e + i * i + n * n + r * r)
- }, t.mag = function(e) {
- return t.magnitude(e)
- }, t.squaredMagnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z,
- r = t.w;
- return e * e + i * i + n * n + r * r
- }, t.sqrMag = function(e) {
- return t.squaredMagnitude(e)
- }, t.normalize = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z,
- s = e.w,
- o = i * i + n * n + r * r + s * s;
- return o > 0 && (o = 1 / Math.sqrt(o), t.x = i * o, t.y = n * o, t.z = r * o, t.w = s * o), t
- }, t.fromAxes = function(e, i, n, r) {
- return (function() {
- var e = s.default.create();
- return function(i, n, r, o) {
- return s.default.set(e, n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z), t.normalize(i, t.fromMat3(i, e))
- }
- })()(e, i, n, r)
- }, t.fromViewUp = function(e, i, n) {
- return (function() {
- var e = s.default.create();
- return function(i, n, r) {
- return s.default.fromViewUp(e, n, r), e ? t.normalize(i, t.fromMat3(i, e)) : null
- }
- })()(e, i, n)
- }, t.fromAxisAngle = function(t, e, i) {
- i *= .5;
- var n = Math.sin(i);
- return t.x = n * e.x, t.y = n * e.y, t.z = n * e.z, t.w = Math.cos(i), t
- }, t.fromMat3 = function(t, e) {
- var i = e.m,
- n = i[0],
- r = i[3],
- s = i[6],
- o = i[1],
- a = i[4],
- l = i[7],
- h = i[2],
- c = i[5],
- u = i[8],
- _ = n + a + u;
- if (_ > 0) {
- var f = .5 / Math.sqrt(_ + 1);
- t.w = .25 / f, t.x = (c - l) * f, t.y = (s - h) * f, t.z = (o - r) * f
- } else if (n > a && n > u) {
- var d = 2 * Math.sqrt(1 + n - a - u);
- t.w = (c - l) / d, t.x = .25 * d, t.y = (r + o) / d, t.z = (s + h) / d
- } else if (a > u) {
- var p = 2 * Math.sqrt(1 + a - n - u);
- t.w = (s - h) / p, t.x = (r + o) / p, t.y = .25 * p, t.z = (l + c) / p
- } else {
- var m = 2 * Math.sqrt(1 + u - n - a);
- t.w = (o - r) / m, t.x = (s + h) / m, t.y = (l + c) / m, t.z = .25 * m
- }
- return t
- }, t.fromEuler = function(t, e, i, n) {
- e *= h, i *= h, n *= h;
- var r = Math.sin(e),
- s = Math.cos(e),
- o = Math.sin(i),
- a = Math.cos(i),
- l = Math.sin(n),
- c = Math.cos(n);
- return t.x = r * a * c + s * o * l, t.y = s * o * c + r * a * l, t.z = s * a * l - r * o * c, t.w = s * a * c - r * o * l, t
- }, t.fromAngleZ = function(t, e) {
- e *= h, t.x = t.y = 0, t.z = Math.sin(e), t.w = Math.cos(e)
- }, t.toEuler = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z,
- s = e.w,
- a = void 0,
- l = void 0,
- h = void 0,
- c = i * n + r * s;
- if (c > .499 && (a = 2 * Math.atan2(i, s), l = Math.PI / 2, h = 0), c < -.499 && (a = -2 * Math.atan2(i, s), l = -Math.PI / 2, h = 0), isNaN(a)) {
- var u = i * i,
- _ = n * n,
- f = r * r;
- a = Math.atan2(2 * n * s - 2 * i * r, 1 - 2 * _ - 2 * f), l = Math.asin(2 * c), h = Math.atan2(2 * i * s - 2 * n * r, 1 - 2 * u - 2 * f)
- }
- return t.y = (0, o.toDegree)(a), t.z = (0, o.toDegree)(l), t.x = (0, o.toDegree)(h), t
- }, t.str = function(t) {
- return "quat(" + t.x + ", " + t.y + ", " + t.z + ", " + t.w + ")"
- }, t.array = function(t, e) {
- return t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w, t
- }, t.exactEquals = function(t, e) {
- return r.default.exactEquals(t, e)
- }, t.equals = function(t, e) {
- return r.default.equals(t, e)
- }, t
- })();
- i.default = c, e.exports = i.default
- }), {
- "./mat3": 329,
- "./utils": 333,
- "./vec3": 335,
- "./vec4": 336
- }],
- 332: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./quat"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = n.default.create(),
- o = (function() {
- function t() {
- r(this, t)
- }
- return t.toRotation = function(t, e) {
- return t.x = e[3], t.y = e[4], t.z = e[5], t.w = e[6], t
- }, t.fromRotation = function(t, e) {
- return t[3] = e.x, t[4] = e.y, t[5] = e.z, t[6] = e.w, t
- }, t.toEuler = function(e, i) {
- return t.toRotation(s, i), n.default.toEuler(e, s), e
- }, t.fromEuler = function(e, i) {
- return n.default.fromEuler(s, i.x, i.y, i.z), t.fromRotation(e, s), e
- }, t.fromEulerNumber = function(e, i, r, o) {
- return n.default.fromEuler(s, i, r, o), t.fromRotation(e, s), e
- }, t.toScale = function(t, e) {
- return t.x = e[7], t.y = e[8], t.z = e[9], t
- }, t.fromScale = function(t, e) {
- return t[7] = e.x, t[8] = e.y, t[9] = e.z, t
- }, t.toPosition = function(t, e) {
- return t.x = e[0], t.y = e[1], t.z = e[2], t
- }, t.fromPosition = function(t, e) {
- return t[0] = e.x, t[1] = e.y, t[2] = e.z, t
- }, t.fromAngleZ = function(e, i) {
- return n.default.fromAngleZ(s, i), t.fromRotation(e, s), e
- }, t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./quat": 331
- }],
- 333: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.equals = function(t, e) {
- return Math.abs(t - e) <= s * Math.max(1, Math.abs(t), Math.abs(e))
- }, i.approx = function(t, e, i) {
- return i = i || s, Math.abs(t - e) <= i
- }, i.clamp = function(t, e, i) {
- return t < e ? e : t > i ? i : t
- }, i.clamp01 = function(t) {
- return t < 0 ? 0 : t > 1 ? 1 : t
- }, i.lerp = function(t, e, i) {
- return t + (e - t) * i
- }, i.toRadian = function(t) {
- return t * n
- }, i.toDegree = function(t) {
- return t * r
- }, i.randomRange = o, i.randomRangeInt = function(t, e) {
- return Math.floor(o(t, e))
- }, i.pseudoRandom = a, i.pseudoRandomRange = l, i.pseudoRandomRangeInt = function(t, e, i) {
- return Math.floor(l(t, e, i))
- }, i.nextPow2 = function(t) {
- return --t, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, t |= t >> 16, ++t
- }, i.repeat = h, i.pingPong = function(t, e) {
- return t = h(t, 2 * e), t = e - Math.abs(t - e)
- }, i.inverseLerp = function(t, e, i) {
- return (i - t) / (e - t)
- };
- var n = Math.PI / 180,
- r = 180 / Math.PI,
- s = i.EPSILON = 1e-6;
- i.FLOAT_ARRAY_TYPE = Float64Array, i.FLOAT_BYTES = 8;
- i.random = Math.random;
- function o(t, e) {
- return Math.random() * (e - t) + t
- }
- function a(t) {
- return (t = (9301 * t + 49297) % 233280) / 233280
- }
- function l(t, e, i) {
- return a(t) * (i - e) + e
- }
- function h(t, e) {
- return t - Math.floor(t / e) * e
- }
- }), {}],
- 334: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
- r(this, t), this.x = e, this.y = i
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0)
- }, t.zero = function(t) {
- return t.x = 0, t.y = 0, t
- }, t.clone = function(e) {
- return new t(e.x, e.y)
- }, t.copy = function(t, e) {
- return t.x = e.x, t.y = e.y, t
- }, t.set = function(t, e, i) {
- return t.x = e, t.y = i, t
- }, t.add = function(t, e, i) {
- return t.x = e.x + i.x, t.y = e.y + i.y, t
- }, t.subtract = function(t, e, i) {
- return t.x = e.x - i.x, t.y = e.y - i.y, t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiply = function(t, e, i) {
- return t.x = e.x * i.x, t.y = e.y * i.y, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.divide = function(t, e, i) {
- return t.x = e.x / i.x, t.y = e.y / i.y, t
- }, t.div = function(e, i, n) {
- return t.divide(e, i, n)
- }, t.ceil = function(t, e) {
- return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t
- }, t.floor = function(t, e) {
- return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t
- }, t.min = function(t, e, i) {
- return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t
- }, t.max = function(t, e, i) {
- return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t
- }, t.round = function(t, e) {
- return t.x = Math.round(e.x), t.y = Math.round(e.y), t
- }, t.scale = function(t, e, i) {
- return t.x = e.x * i, t.y = e.y * i, t
- }, t.scaleAndAdd = function(t, e, i, n) {
- return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t
- }, t.distance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y;
- return Math.sqrt(i * i + n * n)
- }, t.dist = function(e, i) {
- return t.distance(e, i)
- }, t.squaredDistance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y;
- return i * i + n * n
- }, t.sqrDist = function(e, i) {
- return t.squaredDistance(e, i)
- }, t.magnitude = function(t) {
- var e = t.x,
- i = t.y;
- return Math.sqrt(e * e + i * i)
- }, t.mag = function(e) {
- return t.magnitude(e)
- }, t.squaredMagnitude = function(t) {
- var e = t.x,
- i = t.y;
- return e * e + i * i
- }, t.sqrMag = function(e) {
- return t.squaredMagnitude(e)
- }, t.negate = function(t, e) {
- return t.x = -e.x, t.y = -e.y, t
- }, t.inverse = function(t, e) {
- return t.x = 1 / e.x, t.y = 1 / e.y, t
- }, t.inverseSafe = function(t, e) {
- var i = e.x,
- r = e.y;
- return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / e.y, t
- }, t.normalize = function(t, e) {
- var i = e.x,
- n = e.y,
- r = i * i + n * n;
- return r > 0 && (r = 1 / Math.sqrt(r), t.x = e.x * r, t.y = e.y * r), t
- }, t.dot = function(t, e) {
- return t.x * e.x + t.y * e.y
- }, t.cross = function(t, e, i) {
- var n = e.x * i.y - e.y * i.x;
- return t.x = t.y = 0, t.z = n, t
- }, t.lerp = function(t, e, i, n) {
- var r = e.x,
- s = e.y;
- return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t
- }, t.random = function(t, e) {
- e = e || 1;
- var i = 2 * (0, n.random)() * Math.PI;
- return t.x = Math.cos(i) * e, t.y = Math.sin(i) * e, t
- }, t.transformMat2 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y;
- return t.x = n[0] * r + n[2] * s, t.y = n[1] * r + n[3] * s, t
- }, t.transformMat23 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y;
- return t.x = n[0] * r + n[2] * s + n[4], t.y = n[1] * r + n[3] * s + n[5], t
- }, t.transformMat3 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y;
- return t.x = n[0] * r + n[3] * s + n[6], t.y = n[1] * r + n[4] * s + n[7], t
- }, t.transformMat4 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y;
- return t.x = n[0] * r + n[4] * s + n[12], t.y = n[1] * r + n[5] * s + n[13], t
- }, t.forEach = function(e, i, n, r, s, o) {
- return t._forEach(e, i, n, r, s, o)
- }, t.str = function(t) {
- return "vec2(" + t.x + ", " + t.y + ")"
- }, t.array = function(t, e) {
- return t[0] = e.x, t[1] = e.y, t
- }, t.exactEquals = function(t, e) {
- return t.x === e.x && t.y === e.y
- }, t.equals = function(t, e) {
- var i = t.x,
- r = t.y,
- s = e.x,
- o = e.y;
- return Math.abs(i - s) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(s)) && Math.abs(r - o) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(o))
- }, t.angle = function(e, i) {
- return t._angle(e, i)
- }, t
- })();
- s._forEach = (function() {
- var t = s.create(0, 0);
- return function(e, i, n, r, s, o) {
- var a = void 0,
- l = void 0;
- for (i || (i = 2), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], s(t, t, o), e[a] = t.x, e[a + 1] = t.y;
- return e
- }
- })(), s._angle = (function() {
- var t = s.create(0, 0),
- e = s.create(0, 0);
- return function(i, n) {
- s.normalize(t, i), s.normalize(e, n);
- var r = s.dot(t, e);
- return r > 1 ? 0 : r < -1 ? Math.PI : Math.acos(r)
- }
- })(), i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 335: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
- r(this, t), this.x = e, this.y = i, this.z = n
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0)
- }, t.zero = function(t) {
- return t.x = 0, t.y = 0, t.z = 0, t
- }, t.clone = function(e) {
- return new t(e.x, e.y, e.z)
- }, t.copy = function(t, e) {
- return t.x = e.x, t.y = e.y, t.z = e.z, t
- }, t.set = function(t, e, i, n) {
- return t.x = e, t.y = i, t.z = n, t
- }, t.add = function(t, e, i) {
- return t.x = e.x + i.x, t.y = e.y + i.y, t.z = e.z + i.z, t
- }, t.subtract = function(t, e, i) {
- return t.x = e.x - i.x, t.y = e.y - i.y, t.z = e.z - i.z, t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiply = function(t, e, i) {
- return t.x = e.x * i.x, t.y = e.y * i.y, t.z = e.z * i.z, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.divide = function(t, e, i) {
- return t.x = e.x / i.x, t.y = e.y / i.y, t.z = e.z / i.z, t
- }, t.div = function(e, i, n) {
- return t.divide(e, i, n)
- }, t.ceil = function(t, e) {
- return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t.z = Math.ceil(e.z), t
- }, t.floor = function(t, e) {
- return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t.z = Math.floor(e.z), t
- }, t.min = function(t, e, i) {
- return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t.z = Math.min(e.z, i.z), t
- }, t.max = function(t, e, i) {
- return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t.z = Math.max(e.z, i.z), t
- }, t.round = function(t, e) {
- return t.x = Math.round(e.x), t.y = Math.round(e.y), t.z = Math.round(e.z), t
- }, t.scale = function(t, e, i) {
- return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t
- }, t.scaleAndAdd = function(t, e, i, n) {
- return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t.z = e.z + i.z * n, t
- }, t.distance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y,
- r = e.z - t.z;
- return Math.sqrt(i * i + n * n + r * r)
- }, t.dist = function(e, i) {
- return t.distance(e, i)
- }, t.squaredDistance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y,
- r = e.z - t.z;
- return i * i + n * n + r * r
- }, t.sqrDist = function(e, i) {
- return t.squaredDistance(e, i)
- }, t.magnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z;
- return Math.sqrt(e * e + i * i + n * n)
- }, t.mag = function(e) {
- return t.magnitude(e)
- }, t.squaredMagnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z;
- return e * e + i * i + n * n
- }, t.sqrMag = function(e) {
- return t.squaredMagnitude(e)
- }, t.negate = function(t, e) {
- return t.x = -e.x, t.y = -e.y, t.z = -e.z, t
- }, t.inverse = function(t, e) {
- return t.x = 1 / e.x, t.y = 1 / e.y, t.z = 1 / e.z, t
- }, t.inverseSafe = function(t, e) {
- var i = e.x,
- r = e.y,
- s = e.z;
- return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / r, Math.abs(s) < n.EPSILON ? t.z = 0 : t.z = 1 / s, t
- }, t.normalize = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z,
- s = i * i + n * n + r * r;
- return s > 0 && (s = 1 / Math.sqrt(s), t.x = i * s, t.y = n * s, t.z = r * s), t
- }, t.dot = function(t, e) {
- return t.x * e.x + t.y * e.y + t.z * e.z
- }, t.cross = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = e.z,
- o = i.x,
- a = i.y,
- l = i.z;
- return t.x = r * l - s * a, t.y = s * o - n * l, t.z = n * a - r * o, t
- }, t.lerp = function(t, e, i, n) {
- var r = e.x,
- s = e.y,
- o = e.z;
- return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t
- }, t.hermite = function(t, e, i, n, r, s) {
- var o = s * s,
- a = o * (2 * s - 3) + 1,
- l = o * (s - 2) + s,
- h = o * (s - 1),
- c = o * (3 - 2 * s);
- return t.x = e.x * a + i.x * l + n.x * h + r.x * c, t.y = e.y * a + i.y * l + n.y * h + r.y * c, t.z = e.z * a + i.z * l + n.z * h + r.z * c, t
- }, t.bezier = function(t, e, i, n, r, s) {
- var o = 1 - s,
- a = o * o,
- l = s * s,
- h = a * o,
- c = 3 * s * a,
- u = 3 * l * o,
- _ = l * s;
- return t.x = e.x * h + i.x * c + n.x * u + r.x * _, t.y = e.y * h + i.y * c + n.y * u + r.y * _, t.z = e.z * h + i.z * c + n.z * u + r.z * _, t
- }, t.random = function(t, e) {
- e = e || 1;
- var i = 2 * (0, n.random)() * Math.PI,
- r = Math.acos(2 * (0, n.random)() - 1);
- return t.x = Math.sin(r) * Math.cos(i) * e, t.y = Math.sin(r) * Math.sin(i) * e, t.z = Math.cos(r) * e, t
- }, t.transformMat4 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y,
- o = e.z,
- a = n[3] * r + n[7] * s + n[11] * o + n[15];
- return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o + n[12]) * a, t.y = (n[1] * r + n[5] * s + n[9] * o + n[13]) * a, t.z = (n[2] * r + n[6] * s + n[10] * o + n[14]) * a, t
- }, t.transformMat4Normal = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y,
- o = e.z,
- a = n[3] * r + n[7] * s + n[11] * o;
- return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o) * a, t.y = (n[1] * r + n[5] * s + n[9] * o) * a, t.z = (n[2] * r + n[6] * s + n[10] * o) * a, t
- }, t.transformMat3 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y,
- o = e.z;
- return t.x = r * n[0] + s * n[3] + o * n[6], t.y = r * n[1] + s * n[4] + o * n[7], t.z = r * n[2] + s * n[5] + o * n[8], t
- }, t.transformQuat = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = e.z,
- o = i.x,
- a = i.y,
- l = i.z,
- h = i.w,
- c = h * n + a * s - l * r,
- u = h * r + l * n - o * s,
- _ = h * s + o * r - a * n,
- f = -o * n - a * r - l * s;
- return t.x = c * h + f * -o + u * -l - _ * -a, t.y = u * h + f * -a + _ * -o - c * -l, t.z = _ * h + f * -l + c * -a - u * -o, t
- }, t.rotateX = function(t, e, i, n) {
- var r = e.x - i.x,
- s = e.y - i.y,
- o = e.z - i.z,
- a = r,
- l = s * Math.cos(n) - o * Math.sin(n),
- h = s * Math.sin(n) + o * Math.cos(n);
- return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
- }, t.rotateY = function(t, e, i, n) {
- var r = e.x - i.x,
- s = e.y - i.y,
- o = e.z - i.z,
- a = o * Math.sin(n) + r * Math.cos(n),
- l = s,
- h = o * Math.cos(n) - r * Math.sin(n);
- return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
- }, t.rotateZ = function(t, e, i, n) {
- var r = e.x - i.x,
- s = e.y - i.y,
- o = e.z - i.z,
- a = r * Math.cos(n) - s * Math.sin(n),
- l = r * Math.sin(n) + s * Math.cos(n),
- h = o;
- return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
- }, t.str = function(t) {
- return "vec3(" + t.x + ", " + t.y + ", " + t.z + ")"
- }, t.array = function(t, e) {
- return t[0] = e.x, t[1] = e.y, t[2] = e.z, t
- }, t.exactEquals = function(t, e) {
- return t.x === e.x && t.y === e.y && t.z === e.z
- }, t.equals = function(t, e) {
- var i = t.x,
- r = t.y,
- s = t.z,
- o = e.x,
- a = e.y,
- l = e.z;
- return Math.abs(i - o) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(r - a) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(s - l) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(l))
- }, t.forEach = function(e, i, n, r, s, o) {
- return t._forEach(e, i, n, r, s, o)
- }, t.angle = function(e, i) {
- return t._angle(e, i)
- }, t.projectOnPlane = function(e, i, n) {
- return t.sub(e, i, t.project(e, i, n))
- }, t.project = function(e, i, n) {
- var r = t.squaredMagnitude(n);
- return r < 1e-6 ? t.set(e, 0, 0, 0) : t.scale(e, n, t.dot(i, n) / r)
- }, t
- })();
- s._forEach = (function() {
- var t = s.create(0, 0, 0);
- return function(e, i, n, r, s, o) {
- var a = void 0,
- l = void 0;
- for (i || (i = 3), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], t.z = e[a + 2], s(t, t, o), e[a] = t.x, e[a + 1] = t.y, e[a + 2] = t.z;
- return e
- }
- })(), s._angle = (function() {
- var t = s.create(0, 0, 0),
- e = s.create(0, 0, 0);
- return function(i, n) {
- s.copy(t, i), s.copy(e, n), s.normalize(t, t), s.normalize(e, e);
- var r = s.dot(t, e);
- return r > 1 ? 0 : r < -1 ? Math.PI : Math.acos(r)
- }
- })(), i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 336: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./utils");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t() {
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
- i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
- r(this, t), this.x = e, this.y = i, this.z = n, this.w = s
- }
- return t.create = function() {
- return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
- }, t.zero = function(t) {
- return t.x = 0, t.y = 0, t.z = 0, t.w = 0, t
- }, t.clone = function(e) {
- return new t(e.x, e.y, e.z, e.w)
- }, t.copy = function(t, e) {
- return t.x = e.x, t.y = e.y, t.z = e.z, t.w = e.w, t
- }, t.set = function(t, e, i, n, r) {
- return t.x = e, t.y = i, t.z = n, t.w = r, t
- }, t.add = function(t, e, i) {
- return t.x = e.x + i.x, t.y = e.y + i.y, t.z = e.z + i.z, t.w = e.w + i.w, t
- }, t.subtract = function(t, e, i) {
- return t.x = e.x - i.x, t.y = e.y - i.y, t.z = e.z - i.z, t.w = e.w - i.w, t
- }, t.sub = function(e, i, n) {
- return t.subtract(e, i, n)
- }, t.multiply = function(t, e, i) {
- return t.x = e.x * i.x, t.y = e.y * i.y, t.z = e.z * i.z, t.w = e.w * i.w, t
- }, t.mul = function(e, i, n) {
- return t.multiply(e, i, n)
- }, t.divide = function(t, e, i) {
- return t.x = e.x / i.x, t.y = e.y / i.y, t.z = e.z / i.z, t.w = e.w / i.w, t
- }, t.div = function(e, i, n) {
- return t.divide(e, i, n)
- }, t.ceil = function(t, e) {
- return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t.z = Math.ceil(e.z), t.w = Math.ceil(e.w), t
- }, t.floor = function(t, e) {
- return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t.z = Math.floor(e.z), t.w = Math.floor(e.w), t
- }, t.min = function(t, e, i) {
- return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t.z = Math.min(e.z, i.z), t.w = Math.min(e.w, i.w), t
- }, t.max = function(t, e, i) {
- return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t.z = Math.max(e.z, i.z), t.w = Math.max(e.w, i.w), t
- }, t.round = function(t, e) {
- return t.x = Math.round(e.x), t.y = Math.round(e.y), t.z = Math.round(e.z), t.w = Math.round(e.w), t
- }, t.scale = function(t, e, i) {
- return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t.w = e.w * i, t
- }, t.scaleAndAdd = function(t, e, i, n) {
- return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t.z = e.z + i.z * n, t.w = e.w + i.w * n, t
- }, t.distance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y,
- r = e.z - t.z,
- s = e.w - t.w;
- return Math.sqrt(i * i + n * n + r * r + s * s)
- }, t.dist = function(e, i) {
- return t.distance(e, i)
- }, t.squaredDistance = function(t, e) {
- var i = e.x - t.x,
- n = e.y - t.y,
- r = e.z - t.z,
- s = e.w - t.w;
- return i * i + n * n + r * r + s * s
- }, t.sqrDist = function(e, i) {
- return t.squaredDistance(e, i)
- }, t.magnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z,
- r = t.w;
- return Math.sqrt(e * e + i * i + n * n + r * r)
- }, t.mag = function(e) {
- return t.magnitude(e)
- }, t.squaredMagnitude = function(t) {
- var e = t.x,
- i = t.y,
- n = t.z,
- r = t.w;
- return e * e + i * i + n * n + r * r
- }, t.sqrMag = function(e) {
- return t.squaredMagnitude(e)
- }, t.negate = function(t, e) {
- return t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = -e.w, t
- }, t.inverse = function(t, e) {
- return t.x = 1 / e.x, t.y = 1 / e.y, t.z = 1 / e.z, t.w = 1 / e.w, t
- }, t.inverseSafe = function(t, e) {
- var i = e.x,
- r = e.y,
- s = e.z,
- o = e.w;
- return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / r, Math.abs(s) < n.EPSILON ? t.z = 0 : t.z = 1 / s, Math.abs(o) < n.EPSILON ? t.w = 0 : t.w = 1 / o, t
- }, t.normalize = function(t, e) {
- var i = e.x,
- n = e.y,
- r = e.z,
- s = e.w,
- o = i * i + n * n + r * r + s * s;
- return o > 0 && (o = 1 / Math.sqrt(o), t.x = i * o, t.y = n * o, t.z = r * o, t.w = s * o), t
- }, t.dot = function(t, e) {
- return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w
- }, t.lerp = function(t, e, i, n) {
- var r = e.x,
- s = e.y,
- o = e.z,
- a = e.w;
- return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t.w = a + n * (i.w - a), t
- }, t.random = function(t, e) {
- e = e || 1;
- var i = 2 * (0, n.random)() * Math.PI,
- r = Math.acos(2 * (0, n.random)() - 1);
- return t.x = Math.sin(r) * Math.cos(i) * e, t.y = Math.sin(r) * Math.sin(i) * e, t.z = Math.cos(r) * e, t.w = 0, t
- }, t.transformMat4 = function(t, e, i) {
- var n = i.m,
- r = e.x,
- s = e.y,
- o = e.z,
- a = e.w;
- return t.x = n[0] * r + n[4] * s + n[8] * o + n[12] * a, t.y = n[1] * r + n[5] * s + n[9] * o + n[13] * a, t.z = n[2] * r + n[6] * s + n[10] * o + n[14] * a, t.w = n[3] * r + n[7] * s + n[11] * o + n[15] * a, t
- }, t.transformQuat = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = e.z,
- o = i.x,
- a = i.y,
- l = i.z,
- h = i.w,
- c = h * n + a * s - l * r,
- u = h * r + l * n - o * s,
- _ = h * s + o * r - a * n,
- f = -o * n - a * r - l * s;
- return t.x = c * h + f * -o + u * -l - _ * -a, t.y = u * h + f * -a + _ * -o - c * -l, t.z = _ * h + f * -l + c * -a - u * -o, t.w = e.w, t
- }, t.str = function(t) {
- return "vec4(" + t.x + ", " + t.y + ", " + t.z + ", " + t.w + ")"
- }, t.array = function(t, e) {
- return t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w, t
- }, t.exactEquals = function(t, e) {
- return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w
- }, t.equals = function(t, e) {
- var i = t.x,
- r = t.y,
- s = t.z,
- o = t.w,
- a = e.x,
- l = e.y,
- h = e.z,
- c = e.w;
- return Math.abs(i - a) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(r - l) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c))
- }, t.forEach = function(e, i, n, r, s, o) {
- return t._forEach(e, i, n, r, s, o)
- }, t
- })();
- s._forEach = (function() {
- var t = s.create(0, 0, 0, 0);
- return function(e, i, n, r, s, o) {
- var a = void 0,
- l = void 0;
- for (i || (i = 4), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], t.z = e[a + 2], t.w = e[a + 3], s(t, t, o), e[a] = t.x, e[a + 1] = t.y, e[a + 2] = t.z, e[a + 3] = t.w;
- return e
- }
- })(), i.default = s, e.exports = i.default
- }), {
- "./utils": 333
- }],
- 337: [(function(t, e, i) {
- "use strict";
- cc.js
- }), {}],
- 338: [(function(t, e, i) {
- "use strict";
- t("./core/CCGame"), t("./actions")
- }), {
- "./actions": 7,
- "./core/CCGame": 51
- }],
- 339: [(function(t, e, i) {
- "use strict";
- var n = t("../compression/zlib.min"),
- r = t("../core/CCDebug"),
- s = function(t) {
- var e, i, n, s, o, a, l, h, c, u, _, f, d;
- for (this.data = t, this.pos = 8, this.palette = [], this.imgData = [], this.transparency = {}, this.animation = null, this.text = {}, o = null;;) {
- switch (e = this.readUInt32(), h = function() {
- var t, e;
- for (e = [], t = 0; t < 4; ++t) e.push(String.fromCharCode(this.data[this.pos++]));
- return e
- }.call(this).join("")) {
- case "IHDR":
- this.width = this.readUInt32(), this.height = this.readUInt32(), this.bits = this.data[this.pos++], this.colorType = this.data[this.pos++], this.compressionMethod = this.data[this.pos++], this.filterMethod = this.data[this.pos++], this.interlaceMethod = this.data[this.pos++];
- break;
- case "acTL":
- this.animation = {
- numFrames: this.readUInt32(),
- numPlays: this.readUInt32() || 1 / 0,
- frames: []
- };
- break;
- case "PLTE":
- this.palette = this.read(e);
- break;
- case "fcTL":
- o && this.animation.frames.push(o), this.pos += 4, o = {
- width: this.readUInt32(),
- height: this.readUInt32(),
- xOffset: this.readUInt32(),
- yOffset: this.readUInt32()
- }, s = this.readUInt16(), n = this.readUInt16() || 100, o.delay = 1e3 * s / n, o.disposeOp = this.data[this.pos++], o.blendOp = this.data[this.pos++], o.data = [];
- break;
- case "IDAT":
- case "fdAT":
- for ("fdAT" === h && (this.pos += 4, e -= 4), t = (null != o ? o.data : void 0) || this.imgData, _ = 0; 0 <= e ? _ < e : _ > e; 0 <= e ? ++_ : --_) t.push(this.data[this.pos++]);
- break;
- case "tRNS":
- switch (this.transparency = {}, this.colorType) {
- case 3:
- if (this.transparency.indexed = this.read(e), (c = 255 - this.transparency.indexed.length) > 0)
- for (f = 0; 0 <= c ? f < c : f > c; 0 <= c ? ++f : --f) this.transparency.indexed.push(255);
- break;
- case 0:
- this.transparency.grayscale = this.read(e)[0];
- break;
- case 2:
- this.transparency.rgb = this.read(e)
- }
- break;
- case "tEXt":
- a = (u = this.read(e)).indexOf(0), l = String.fromCharCode.apply(String, u.slice(0, a)), this.text[l] = String.fromCharCode.apply(String, u.slice(a + 1));
- break;
- case "IEND":
- return o && this.animation.frames.push(o), this.colors = function() {
- switch (this.colorType) {
- case 0:
- case 3:
- case 4:
- return 1;
- case 2:
- case 6:
- return 3
- }
- }.call(this), this.hasAlphaChannel = 4 === (d = this.colorType) || 6 === d, i = this.colors + (this.hasAlphaChannel ? 1 : 0), this.pixelBitlength = this.bits * i, this.colorSpace = function() {
- switch (this.colors) {
- case 1:
- return "DeviceGray";
- case 3:
- return "DeviceRGB"
- }
- }.call(this), void(Uint8Array != Array && (this.imgData = new Uint8Array(this.imgData)));
- default:
- this.pos += e
- }
- if (this.pos += 4, this.pos > this.data.length) throw new Error(r.getError(6017))
- }
- };
- s.prototype = {
- constructor: s,
- read: function(t) {
- var e, i;
- for (i = [], e = 0; 0 <= t ? e < t : e > t; 0 <= t ? ++e : --e) i.push(this.data[this.pos++]);
- return i
- },
- readUInt32: function() {
- return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]
- },
- readUInt16: function() {
- return this.data[this.pos++] << 8 | this.data[this.pos++]
- },
- decodePixels: function(t) {
- var e, i, s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S;
- if (null == t && (t = this.imgData), 0 === t.length) return new Uint8Array(0);
- for (t = new n.Inflate(t, {
- index: 0,
- verify: !1
- }).decompress(), v = (d = this.pixelBitlength / 8) * this.width, p = new Uint8Array(v * this.height), l = t.length, y = 0, m = 0, i = 0; m < l;) {
- switch (t[m++]) {
- case 0:
- for (o = b = 0; b < v; o = b += 1) p[i++] = t[m++];
- break;
- case 1:
- for (o = A = 0; A < v; o = A += 1) e = t[m++], a = o < d ? 0 : p[i - d], p[i++] = (e + a) % 256;
- break;
- case 2:
- for (o = C = 0; C < v; o = C += 1) e = t[m++], s = (o - o % d) / d, g = y && p[(y - 1) * v + s * d + o % d], p[i++] = (g + e) % 256;
- break;
- case 3:
- for (o = T = 0; T < v; o = T += 1) e = t[m++], s = (o - o % d) / d, a = o < d ? 0 : p[i - d], g = y && p[(y - 1) * v + s * d + o % d], p[i++] = (e + Math.floor((a + g) / 2)) % 256;
- break;
- case 4:
- for (o = S = 0; S < v; o = S += 1) e = t[m++], s = (o - o % d) / d, a = o < d ? 0 : p[i - d], 0 === y ? g = x = 0 : (g = p[(y - 1) * v + s * d + o % d], x = s && p[(y - 1) * v + (s - 1) * d + o % d]), h = a + g - x, c = Math.abs(h - a), _ = Math.abs(h - g), f = Math.abs(h - x), u = c <= _ && c <= f ? a : _ <= f ? g : x, p[i++] = (e + u) % 256;
- break;
- default:
- throw new Error(r.getError(6018, t[m - 1]))
- }
- y++
- }
- return p
- },
- copyToImageData: function(t, e) {
- var i, n, r, s, o, a, l, h, c, u, _;
- if (n = this.colors, c = null, i = this.hasAlphaChannel, this.palette.length && (c = null != (_ = this._decodedPalette) ? _ : this._decodedPalette = this.decodePalette(), n = 4, i = !0), h = (r = t.data || t).length, o = c || e, s = a = 0, 1 === n)
- for (; s < h;) l = c ? 4 * e[s / 4] : a, u = o[l++], r[s++] = u, r[s++] = u, r[s++] = u, r[s++] = i ? o[l++] : 255, a = l;
- else
- for (; s < h;) l = c ? 4 * e[s / 4] : a, r[s++] = o[l++], r[s++] = o[l++], r[s++] = o[l++], r[s++] = i ? o[l++] : 255, a = l
- },
- decodePalette: function() {
- var t, e, i, n, r, s, o, a, l;
- for (i = this.palette, s = this.transparency.indexed || [], r = new Uint8Array((s.length || 0) + i.length), n = 0, t = 0, e = o = 0, a = i.length; o < a; e = o += 3) r[n++] = i[e], r[n++] = i[e + 1], r[n++] = i[e + 2], r[n++] = null != (l = s[t++]) ? l : 255;
- return r
- },
- render: function(t) {
- var e, i;
- return t.width = this.width, t.height = this.height, i = (e = t.getContext("2d")).createImageData(this.width, this.height), this.copyToImageData(i, this.decodePixels()), e.putImageData(i, 0, 0)
- }
- }, e.exports = s
- }), {
- "../compression/zlib.min": 25,
- "../core/CCDebug": 49
- }],
- 340: [(function(t, e, i) {
- "use strict";
- var n = t("../core/assets/CCAsset"),
- r = t("../core/assets/CCSpriteFrame"),
- s = cc.Class({
- name: "cc.ParticleAsset",
- extends: n,
- properties: {
- spriteFrame: {
- default: null,
- type: r
- }
- }
- });
- cc.ParticleAsset = e.exports = s
- }), {
- "../core/assets/CCAsset": 56,
- "../core/assets/CCSpriteFrame": 70
- }],
- 341: [(function(t, e, i) {
- "use strict";
- var n = t("../core/platform/CCMacro"),
- r = t("./CCParticleAsset"),
- s = t("../core/components/CCRenderComponent"),
- o = t("../compression/ZipUtils"),
- a = t("./CCPNGReader"),
- l = t("./CCTIFFReader"),
- h = t("../core/utils/texture-util"),
- c = (t("../core/renderer/render-flow"), t("./particle-simulator")),
- u = t("../core/assets/material/CCMaterial"),
- _ = t("../core/utils/blend-func");
- function f(t) {
- return t.length > 8 && 137 === t[0] && 80 === t[1] && 78 === t[2] && 71 === t[3] && 13 === t[4] && 10 === t[5] && 26 === t[6] && 10 === t[7] ? n.ImageFormat.PNG : t.length > 2 && (73 === t[0] && 73 === t[1] || 77 === t[0] && 77 === t[1] || 255 === t[0] && 216 === t[1]) ? n.ImageFormat.TIFF : n.ImageFormat.UNKNOWN
- }
- var d = cc.Enum({
- GRAVITY: 0,
- RADIUS: 1
- }),
- p = cc.Enum({
- FREE: 0,
- RELATIVE: 1,
- GROUPED: 2
- }),
- m = {
- preview: {
- default: !0,
- editorOnly: !0,
- notify: !1,
- animatable: !1,
- tooltip: !1
- },
- _custom: !1,
- custom: {
- get: function() {
- return this._custom
- },
- set: function(t) {
- this._custom !== t && (this._custom = t, this._applyFile())
- },
- animatable: !1,
- tooltip: !1
- },
- _file: {
- default: null,
- type: r
- },
- file: {
- get: function() {
- return this._file
- },
- set: function(t, e) {
- this._file !== t && (this._file = t, t ? this._applyFile() : this.custom = !0)
- },
- animatable: !1,
- type: r,
- tooltip: !1
- },
- _spriteFrame: {
- default: null,
- type: cc.SpriteFrame
- },
- spriteFrame: {
- get: function() {
- return this._spriteFrame
- },
- set: function(t, e) {
- var i = this._renderSpriteFrame;
- i !== t && (this._renderSpriteFrame = t, t && !t._uuid || (this._spriteFrame = t), (i && i.getTexture()) !== (t && t.getTexture()) && (this._texture = null, this._applySpriteFrame(i)))
- },
- type: cc.SpriteFrame,
- tooltip: !1
- },
- _texture: {
- default: null,
- type: cc.Texture2D,
- editorOnly: !0
- },
- texture: {
- get: function() {
- return this._texture
- },
- set: function(t) {
- t && cc.warnID(6017)
- },
- type: cc.Texture2D,
- tooltip: !1,
- readonly: !0,
- visible: !1,
- animatable: !1
- },
- particleCount: {
- visible: !1,
- get: function() {
- return this._simulator.particles.length
- },
- readonly: !0
- },
- _stopped: !0,
- stopped: {
- get: function() {
- return this._stopped
- },
- animatable: !1,
- visible: !1
- },
- playOnLoad: !0,
- autoRemoveOnFinish: {
- default: !1,
- animatable: !1,
- tooltip: !1
- },
- active: {
- get: function() {
- return this._simulator.active
- },
- visible: !1
- },
- totalParticles: 150,
- duration: -1,
- emissionRate: 10,
- life: 1,
- lifeVar: 0,
- _startColor: null,
- startColor: {
- type: cc.Color,
- get: function() {
- return this._startColor
- },
- set: function(t) {
- this._startColor.r = t.r, this._startColor.g = t.g, this._startColor.b = t.b, this._startColor.a = t.a
- }
- },
- _startColorVar: null,
- startColorVar: {
- type: cc.Color,
- get: function() {
- return this._startColorVar
- },
- set: function(t) {
- this._startColorVar.r = t.r, this._startColorVar.g = t.g, this._startColorVar.b = t.b, this._startColorVar.a = t.a
- }
- },
- _endColor: null,
- endColor: {
- type: cc.Color,
- get: function() {
- return this._endColor
- },
- set: function(t) {
- this._endColor.r = t.r, this._endColor.g = t.g, this._endColor.b = t.b, this._endColor.a = t.a
- }
- },
- _endColorVar: null,
- endColorVar: {
- type: cc.Color,
- get: function() {
- return this._endColorVar
- },
- set: function(t) {
- this._endColorVar.r = t.r, this._endColorVar.g = t.g, this._endColorVar.b = t.b, this._endColorVar.a = t.a
- }
- },
- angle: 90,
- angleVar: 20,
- startSize: 50,
- startSizeVar: 0,
- endSize: 0,
- endSizeVar: 0,
- startSpin: 0,
- startSpinVar: 0,
- endSpin: 0,
- endSpinVar: 0,
- sourcePos: cc.Vec2.ZERO,
- posVar: cc.Vec2.ZERO,
- _positionType: {
- default: p.FREE,
- formerlySerializedAs: "positionType"
- },
- positionType: {
- type: p,
- get: function() {
- return this._positionType
- },
- set: function(t) {
- var e = this.getMaterial(0);
- e && e.define("CC_USE_MODEL", t !== p.FREE), this._positionType = t
- }
- },
- emitterMode: {
- default: d.GRAVITY,
- type: d
- },
- gravity: cc.Vec2.ZERO,
- speed: 180,
- speedVar: 50,
- tangentialAccel: 80,
- tangentialAccelVar: 0,
- radialAccel: 0,
- radialAccelVar: 0,
- rotationIsDir: !1,
- startRadius: 0,
- startRadiusVar: 0,
- endRadius: 0,
- endRadiusVar: 0,
- rotatePerS: 0,
- rotatePerSVar: 0
- },
- y = cc.Class({
- name: "cc.ParticleSystem",
- extends: s,
- mixins: [_],
- editor: !1,
- ctor: function() {
- this.initProperties()
- },
- initProperties: function() {
- this._previewTimer = null, this._focused = !1, this._simulator = new c(this), this._texture = null, this._startColor = cc.color(255, 255, 255, 255), this._startColorVar = cc.color(0, 0, 0, 0), this._endColor = cc.color(255, 255, 255, 0), this._endColorVar = cc.color(0, 0, 0, 0), this._renderSpriteFrame = null
- },
- properties: m,
- statics: {
- DURATION_INFINITY: -1,
- START_SIZE_EQUAL_TO_END_SIZE: -1,
- START_RADIUS_EQUAL_TO_END_RADIUS: -1,
- EmitterMode: d,
- PositionType: p,
- _PNGReader: a,
- _TIFFReader: l
- },
- onFocusInEditor: !1,
- onLostFocusInEditor: !1,
- _startPreview: !1,
- _stopPreview: !1,
- _convertTextureToSpriteFrame: !1,
- __preload: function() {
- if (this._super(), this._custom && this.spriteFrame && !this._renderSpriteFrame) this._applySpriteFrame(this.spriteFrame);
- else if (this._file) {
- if (this._custom) !this._texture && this._applyFile();
- else this._applyFile()
- }
- this.playOnLoad && this.resetSystem()
- },
- onEnable: function() {
- this._super(), this._activateMaterial()
- },
- onDestroy: function() {
- this.autoRemoveOnFinish && (this.autoRemoveOnFinish = !1), this._buffer && (this._buffer.destroy(), this._buffer = null), this._simulator._uvFilled = 0, this._super()
- },
- lateUpdate: function(t) {
- this._simulator.finished || this._simulator.step(t)
- },
- addParticle: function() {},
- stopSystem: function() {
- this._stopped = !0, this._simulator.stop()
- },
- resetSystem: function() {
- this._stopped = !1, this._simulator.reset(), this._activateMaterial()
- },
- isFull: function() {
- return this.particleCount >= this.totalParticles
- },
- setTextureWithRect: function(t, e) {
- t instanceof cc.Texture2D && (this.spriteFrame = new cc.SpriteFrame(t, e))
- },
- _applyFile: function() {
- var t = this._file;
- if (t) {
- var e = this;
- cc.loader.load(t.nativeUrl, (function(i, n) {
- !i && n ? e.isValid && (e._plistFile = t.nativeUrl, e._custom || e._initWithDictionary(n), e._spriteFrame ? !e._renderSpriteFrame && e._spriteFrame && e._applySpriteFrame(e.spriteFrame) : t.spriteFrame ? e.spriteFrame = t.spriteFrame : e._custom && e._initTextureWithDictionary(n)) : cc.errorID(6029)
- }))
- }
- },
- _initTextureWithDictionary: function(t) {
- var e = cc.path.changeBasename(this._plistFile, t.textureFileName || "");
- if (t.textureFileName) h.loadImage(e, (function(e, i) {
- e ? (t.textureFileName = void 0, this._initTextureWithDictionary(t)) : this.spriteFrame = new cc.SpriteFrame(i)
- }), this);
- else if (t.textureImageData) {
- var i = t.textureImageData;
- if (!(i && i.length > 0)) return !1;
- var r = cc.loader.getRes(e);
- if (!r) {
- var s = o.unzipBase64AsArray(i, 1);
- if (!s) return cc.logID(6030), !1;
- var c = f(s);
- if (c !== n.ImageFormat.TIFF && c !== n.ImageFormat.PNG) return cc.logID(6031), !1;
- var u = document.createElement("canvas");
- if (c === n.ImageFormat.PNG) new a(s).render(u);
- else l.parseTIFF(s, u);
- r = h.cacheImage(e, u)
- }
- r || cc.logID(6032), this.spriteFrame = new cc.SpriteFrame(r)
- }
- return !0
- },
- _initWithDictionary: function(t) {
- this.totalParticles = parseInt(t.maxParticles || 0), this.life = parseFloat(t.particleLifespan || 0), this.lifeVar = parseFloat(t.particleLifespanVariance || 0);
- var e = t.emissionRate;
- this.emissionRate = e || Math.min(this.totalParticles / this.life, Number.MAX_VALUE), this.duration = parseFloat(t.duration || 0), this.srcBlendFactor = parseInt(t.blendFuncSource || n.SRC_ALPHA), this.dstBlendFactor = parseInt(t.blendFuncDestination || n.ONE_MINUS_SRC_ALPHA);
- var i = this._startColor;
- i.r = 255 * parseFloat(t.startColorRed || 0), i.g = 255 * parseFloat(t.startColorGreen || 0), i.b = 255 * parseFloat(t.startColorBlue || 0), i.a = 255 * parseFloat(t.startColorAlpha || 0);
- var r = this._startColorVar;
- r.r = 255 * parseFloat(t.startColorVarianceRed || 0), r.g = 255 * parseFloat(t.startColorVarianceGreen || 0), r.b = 255 * parseFloat(t.startColorVarianceBlue || 0), r.a = 255 * parseFloat(t.startColorVarianceAlpha || 0);
- var s = this._endColor;
- s.r = 255 * parseFloat(t.finishColorRed || 0), s.g = 255 * parseFloat(t.finishColorGreen || 0), s.b = 255 * parseFloat(t.finishColorBlue || 0), s.a = 255 * parseFloat(t.finishColorAlpha || 0);
- var o = this._endColorVar;
- if (o.r = 255 * parseFloat(t.finishColorVarianceRed || 0), o.g = 255 * parseFloat(t.finishColorVarianceGreen || 0), o.b = 255 * parseFloat(t.finishColorVarianceBlue || 0), o.a = 255 * parseFloat(t.finishColorVarianceAlpha || 0), this.startSize = parseFloat(t.startParticleSize || 0), this.startSizeVar = parseFloat(t.startParticleSizeVariance || 0), this.endSize = parseFloat(t.finishParticleSize || 0), this.endSizeVar = parseFloat(t.finishParticleSizeVariance || 0), this.positionType = parseFloat(t.positionType || p.RELATIVE), this.sourcePos.x = 0, this.sourcePos.y = 0, this.posVar.x = parseFloat(t.sourcePositionVariancex || 0), this.posVar.y = parseFloat(t.sourcePositionVariancey || 0), this.angle = parseFloat(t.angle || 0), this.angleVar = parseFloat(t.angleVariance || 0), this.startSpin = parseFloat(t.rotationStart || 0), this.startSpinVar = parseFloat(t.rotationStartVariance || 0), this.endSpin = parseFloat(t.rotationEnd || 0), this.endSpinVar = parseFloat(t.rotationEndVariance || 0), this.emitterMode = parseInt(t.emitterType || d.GRAVITY), this.emitterMode === d.GRAVITY) {
- this.gravity.x = parseFloat(t.gravityx || 0), this.gravity.y = parseFloat(t.gravityy || 0), this.speed = parseFloat(t.speed || 0), this.speedVar = parseFloat(t.speedVariance || 0), this.radialAccel = parseFloat(t.radialAcceleration || 0), this.radialAccelVar = parseFloat(t.radialAccelVariance || 0), this.tangentialAccel = parseFloat(t.tangentialAcceleration || 0), this.tangentialAccelVar = parseFloat(t.tangentialAccelVariance || 0);
- var a = t.rotationIsDir || "";
- null !== a ? (a = a.toString().toLowerCase(), this.rotationIsDir = "true" === a || "1" === a) : this.rotationIsDir = !1
- } else {
- if (this.emitterMode !== d.RADIUS) return cc.warnID(6009), !1;
- this.startRadius = parseFloat(t.maxRadius || 0), this.startRadiusVar = parseFloat(t.maxRadiusVariance || 0), this.endRadius = parseFloat(t.minRadius || 0), this.endRadiusVar = parseFloat(t.minRadiusVariance || 0), this.rotatePerS = parseFloat(t.rotatePerSecond || 0), this.rotatePerSVar = parseFloat(t.rotatePerSecondVariance || 0)
- }
- return this._initTextureWithDictionary(t), !0
- },
- _onTextureLoaded: function() {
- this._texture = this._renderSpriteFrame.getTexture(), this._simulator.updateUVs(!0), this._activateMaterial()
- },
- _applySpriteFrame: function(t) {
- t && t.off && t.off("load", this._onTextureLoaded, this);
- var e = this._renderSpriteFrame = this._renderSpriteFrame || this._spriteFrame;
- e && (e.textureLoaded() ? this._onTextureLoaded(null) : (e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()))
- },
- _activateMaterial: function() {
- if (!this._texture || !this._texture.loaded) return this.markForUpdateRenderData(!1), this.markForRender(!1), void(this._renderSpriteFrame && this._applySpriteFrame());
- var t = this.sharedMaterials[0];
- (t = t ? u.getInstantiatedMaterial(t, this) : u.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("CC_USE_MODEL", this._positionType !== p.FREE), t.setProperty("texture", this._texture), this.setMaterial(0, t), this.markForRender(!0)
- },
- _finishedSimulation: function() {
- this.resetSystem(), this.stopSystem(), this.disableRender(), this.autoRemoveOnFinish && this._stopped && this.node.destroy()
- }
- });
- cc.ParticleSystem = e.exports = y
- }), {
- "../compression/ZipUtils": 22,
- "../core/assets/material/CCMaterial": 75,
- "../core/components/CCRenderComponent": 106,
- "../core/platform/CCMacro": 203,
- "../core/renderer/render-flow": 248,
- "../core/utils/blend-func": 293,
- "../core/utils/texture-util": 308,
- "./CCPNGReader": 339,
- "./CCParticleAsset": 340,
- "./CCTIFFReader": 342,
- "./particle-simulator": 344,
- "fire-url": void 0
- }],
- 342: [(function(t, e, i) {
- "use strict";
- var n = t("../core/CCDebug"),
- r = {
- _littleEndian: !1,
- _tiffData: null,
- _fileDirectories: [],
- getUint8: function(t) {
- return this._tiffData[t]
- },
- getUint16: function(t) {
- return this._littleEndian ? this._tiffData[t + 1] << 8 | this._tiffData[t] : this._tiffData[t] << 8 | this._tiffData[t + 1]
- },
- getUint32: function(t) {
- var e = this._tiffData;
- return this._littleEndian ? e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t] : e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]
- },
- checkLittleEndian: function() {
- var t = this.getUint16(0);
- if (18761 === t) this.littleEndian = !0;
- else {
- if (19789 !== t) throw console.log(t), TypeError(n.getError(6019));
- this.littleEndian = !1
- }
- return this.littleEndian
- },
- hasTowel: function() {
- if (42 !== this.getUint16(2)) throw RangeError(n.getError(6020));
- return !0
- },
- getFieldTypeName: function(t) {
- var e = this.fieldTypeNames;
- return t in e ? e[t] : null
- },
- getFieldTagName: function(t) {
- var e = this.fieldTagNames;
- return t in e ? e[t] : (cc.logID(6021, t), "Tag" + t)
- },
- getFieldTypeLength: function(t) {
- return -1 !== ["BYTE", "ASCII", "SBYTE", "UNDEFINED"].indexOf(t) ? 1 : -1 !== ["SHORT", "SSHORT"].indexOf(t) ? 2 : -1 !== ["LONG", "SLONG", "FLOAT"].indexOf(t) ? 4 : -1 !== ["RATIONAL", "SRATIONAL", "DOUBLE"].indexOf(t) ? 8 : null
- },
- getFieldValues: function(t, e, i, n) {
- var r = [],
- s = this.getFieldTypeLength(e);
- if (s * i <= 4) !1 === this.littleEndian ? r.push(n >>> 8 * (4 - s)) : r.push(n);
- else
- for (var o = 0; o < i; o++) {
- var a = s * o;
- s >= 8 ? -1 !== ["RATIONAL", "SRATIONAL"].indexOf(e) ? (r.push(this.getUint32(n + a)), r.push(this.getUint32(n + a + 4))) : cc.logID(8e3) : r.push(this.getBytes(s, n + a))
- }
- return "ASCII" === e && r.forEach((function(t, e, i) {
- i[e] = String.fromCharCode(t)
- })), r
- },
- getBytes: function(t, e) {
- if (t <= 0) cc.logID(8001);
- else {
- if (t <= 1) return this.getUint8(e);
- if (t <= 2) return this.getUint16(e);
- if (t <= 3) return this.getUint32(e) >>> 8;
- if (t <= 4) return this.getUint32(e);
- cc.logID(8002)
- }
- },
- getBits: function(t, e, i) {
- i = i || 0;
- var n, r, s = e + Math.floor(i / 8),
- o = i + t,
- a = 32 - t;
- return o <= 0 ? cc.logID(6023) : o <= 8 ? (n = 24 + i, r = this.getUint8(s)) : o <= 16 ? (n = 16 + i, r = this.getUint16(s)) : o <= 32 ? (n = i, r = this.getUint32(s)) : cc.logID(6022), {
- bits: r << n >>> a,
- byteOffset: s + Math.floor(o / 8),
- bitOffset: o % 8
- }
- },
- parseFileDirectory: function(t) {
- for (var e = this.getUint16(t), i = [], n = t + 2, r = 0; r < e; n += 12, r++) {
- var s = this.getUint16(n),
- o = this.getUint16(n + 2),
- a = this.getUint32(n + 4),
- l = this.getUint32(n + 8),
- h = this.getFieldTagName(s),
- c = this.getFieldTypeName(o),
- u = this.getFieldValues(h, c, a, l);
- i[h] = {
- type: c,
- values: u
- }
- }
- this._fileDirectories.push(i);
- var _ = this.getUint32(n);
- 0 !== _ && this.parseFileDirectory(_)
- },
- clampColorSample: function(t, e) {
- var i = Math.pow(2, 8 - e);
- return Math.floor(t * i + (i - 1))
- },
- parseTIFF: function(t, e) {
- if (e = e || document.createElement("canvas"), this._tiffData = t, this.canvas = e, this.checkLittleEndian(), this.hasTowel()) {
- var i = this.getUint32(4);
- this._fileDirectories.length = 0, this.parseFileDirectory(i);
- var r = this._fileDirectories[0],
- s = r.ImageWidth.values[0],
- o = r.ImageLength.values[0];
- this.canvas.width = s, this.canvas.height = o;
- var a = [],
- l = r.Compression ? r.Compression.values[0] : 1,
- h = r.SamplesPerPixel.values[0],
- c = [],
- u = 0,
- _ = !1;
- if (r.BitsPerSample.values.forEach((function(t, e, i) {
- c[e] = {
- bitsPerSample: t,
- hasBytesPerSample: !1,
- bytesPerSample: void 0
- }, t % 8 == 0 && (c[e].hasBytesPerSample = !0, c[e].bytesPerSample = t / 8), u += t
- }), this), u % 8 == 0) {
- _ = !0;
- var f = u / 8
- }
- var d = r.StripOffsets.values,
- p = d.length;
- if (r.StripByteCounts) var m = r.StripByteCounts.values;
- else {
- if (cc.logID(8003), 1 !== p) throw Error(n.getError(6024));
- m = [Math.ceil(s * o * u / 8)]
- }
- for (var y = 0; y < p; y++) {
- var v = d[y];
- a[y] = [];
- for (var g = m[y], x = 0, b = 0, A = 1, C = !0, T = [], S = 0, w = 0, E = 0; x < g; x += A) switch (l) {
- case 1:
- var M = 0;
- for (T = []; M < h; M++) {
- if (!c[M].hasBytesPerSample) {
- var D = this.getBits(c[M].bitsPerSample, v + x, b);
- throw T.push(D.bits), x = D.byteOffset - v, b = D.bitOffset, RangeError(n.getError(6025))
- }
- var B = c[M].bytesPerSample * M;
- T.push(this.getBytes(c[M].bytesPerSample, v + x + B))
- }
- if (a[y].push(T), !_) throw A = 0, RangeError(n.getError(6026));
- A = f;
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- break;
- case 32773:
- if (C) {
- C = !1;
- var I = 1,
- P = 1,
- R = this.getInt8(v + x);
- R >= 0 && R <= 127 ? I = R + 1 : R >= -127 && R <= -1 ? P = 1 - R : C = !0
- } else {
- var O = this.getUint8(v + x);
- for (M = 0; M < P; M++) {
- if (!c[w].hasBytesPerSample) throw RangeError(n.getError(6025));
- E = E << 8 * S | O, ++S === c[w].bytesPerSample && (T.push(E), E = S = 0, w++), w === h && (a[y].push(T), T = [], w = 0)
- }
- 0 === --I && (C = !0)
- }
- A = 1
- }
- }
- if (e.getContext) {
- var L = this.canvas.getContext("2d");
- L.fillStyle = "rgba(255, 255, 255, 0)";
- var F = r.RowsPerStrip ? r.RowsPerStrip.values[0] : o,
- N = a.length,
- V = o % F,
- k = 0 === V ? F : V,
- G = F,
- U = 0,
- z = r.PhotometricInterpretation.values[0],
- j = [],
- W = 0;
- if (r.ExtraSamples && (W = (j = r.ExtraSamples.values).length), r.ColorMap) var H = r.ColorMap.values,
- X = Math.pow(2, c[0].bitsPerSample);
- for (y = 0; y < N; y++) {
- y + 1 === N && (G = k);
- for (var Y = a[y].length, q = U * y, J = 0, Z = 0; Z < Y; J++)
- for (var K = 0; K < s; K++, Z++) {
- var Q = a[y][Z],
- $ = 0,
- tt = 0,
- et = 0,
- it = 1;
- if (W > 0)
- for (var nt = 0; nt < W; nt++)
- if (1 === j[nt] || 2 === j[nt]) {
- it = Q[3 + nt] / 256;
- break
- }
- switch (z) {
- case 0:
- if (c[0].hasBytesPerSample) var rt = Math.pow(16, 2 * c[0].bytesPerSample);
- Q.forEach((function(t, e, i) {
- i[e] = rt - t
- }));
- case 1:
- $ = tt = et = this.clampColorSample(Q[0], c[0].bitsPerSample);
- break;
- case 2:
- $ = this.clampColorSample(Q[0], c[0].bitsPerSample), tt = this.clampColorSample(Q[1], c[1].bitsPerSample), et = this.clampColorSample(Q[2], c[2].bitsPerSample);
- break;
- case 3:
- if (void 0 === H) throw Error(n.getError(6027));
- var st = Q[0];
- $ = this.clampColorSample(H[st], 16), tt = this.clampColorSample(H[X + st], 16), et = this.clampColorSample(H[2 * X + st], 16);
- break;
- default:
- throw RangeError(n.getError(6028, z))
- }
- L.fillStyle = "rgba(" + $ + ", " + tt + ", " + et + ", " + it + ")", L.fillRect(K, q + J, 1, 1)
- }
- U = G
- }
- }
- return this.canvas
- }
- },
- fieldTagNames: {
- 315: "Artist",
- 258: "BitsPerSample",
- 265: "CellLength",
- 264: "CellWidth",
- 320: "ColorMap",
- 259: "Compression",
- 33432: "Copyright",
- 306: "DateTime",
- 338: "ExtraSamples",
- 266: "FillOrder",
- 289: "FreeByteCounts",
- 288: "FreeOffsets",
- 291: "GrayResponseCurve",
- 290: "GrayResponseUnit",
- 316: "HostComputer",
- 270: "ImageDescription",
- 257: "ImageLength",
- 256: "ImageWidth",
- 271: "Make",
- 281: "MaxSampleValue",
- 280: "MinSampleValue",
- 272: "Model",
- 254: "NewSubfileType",
- 274: "Orientation",
- 262: "PhotometricInterpretation",
- 284: "PlanarConfiguration",
- 296: "ResolutionUnit",
- 278: "RowsPerStrip",
- 277: "SamplesPerPixel",
- 305: "Software",
- 279: "StripByteCounts",
- 273: "StripOffsets",
- 255: "SubfileType",
- 263: "Threshholding",
- 282: "XResolution",
- 283: "YResolution",
- 326: "BadFaxLines",
- 327: "CleanFaxData",
- 343: "ClipPath",
- 328: "ConsecutiveBadFaxLines",
- 433: "Decode",
- 434: "DefaultImageColor",
- 269: "DocumentName",
- 336: "DotRange",
- 321: "HalftoneHints",
- 346: "Indexed",
- 347: "JPEGTables",
- 285: "PageName",
- 297: "PageNumber",
- 317: "Predictor",
- 319: "PrimaryChromaticities",
- 532: "ReferenceBlackWhite",
- 339: "SampleFormat",
- 559: "StripRowCounts",
- 330: "SubIFDs",
- 292: "T4Options",
- 293: "T6Options",
- 325: "TileByteCounts",
- 323: "TileLength",
- 324: "TileOffsets",
- 322: "TileWidth",
- 301: "TransferFunction",
- 318: "WhitePoint",
- 344: "XClipPathUnits",
- 286: "XPosition",
- 529: "YCbCrCoefficients",
- 531: "YCbCrPositioning",
- 530: "YCbCrSubSampling",
- 345: "YClipPathUnits",
- 287: "YPosition",
- 37378: "ApertureValue",
- 40961: "ColorSpace",
- 36868: "DateTimeDigitized",
- 36867: "DateTimeOriginal",
- 34665: "Exif IFD",
- 36864: "ExifVersion",
- 33434: "ExposureTime",
- 41728: "FileSource",
- 37385: "Flash",
- 40960: "FlashpixVersion",
- 33437: "FNumber",
- 42016: "ImageUniqueID",
- 37384: "LightSource",
- 37500: "MakerNote",
- 37377: "ShutterSpeedValue",
- 37510: "UserComment",
- 33723: "IPTC",
- 34675: "ICC Profile",
- 700: "XMP",
- 42112: "GDAL_METADATA",
- 42113: "GDAL_NODATA",
- 34377: "Photoshop"
- },
- fieldTypeNames: {
- 1: "BYTE",
- 2: "ASCII",
- 3: "SHORT",
- 4: "LONG",
- 5: "RATIONAL",
- 6: "SBYTE",
- 7: "UNDEFINED",
- 8: "SSHORT",
- 9: "SLONG",
- 10: "SRATIONAL",
- 11: "FLOAT",
- 12: "DOUBLE"
- }
- };
- e.exports = r
- }), {
- "../core/CCDebug": 49
- }],
- 343: [(function(t, e, i) {
- "use strict";
- t("./CCParticleAsset"), t("./CCParticleSystem"), t("./particle-simulator"), t("./particle-system-assembler")
- }), {
- "./CCParticleAsset": 340,
- "./CCParticleSystem": 341,
- "./particle-simulator": 344,
- "./particle-system-assembler": 345
- }],
- 344: [(function(t, e, i) {
- "use strict";
- var n = t("../core/utils/affine-transform"),
- r = t("../core/platform/js"),
- s = t("../core/utils/misc"),
- o = cc.v2(0, 0),
- a = n.create(),
- l = cc.v2(),
- h = cc.v2(),
- c = cc.v2(),
- u = cc.v2(),
- _ = function() {
- this.pos = cc.v2(0, 0), this.startPos = cc.v2(0, 0), this.color = cc.color(0, 0, 0, 255), this.deltaColor = {
- r: 0,
- g: 0,
- b: 0,
- a: 255
- }, this.size = 0, this.deltaSize = 0, this.rotation = 0, this.deltaRotation = 0, this.timeToLive = 0, this.drawPos = cc.v2(0, 0), this.dir = cc.v2(0, 0), this.radialAccel = 0, this.tangentialAccel = 0, this.angle = 0, this.degreesPerSecond = 0, this.radius = 0, this.deltaRadius = 0
- },
- f = new r.Pool(function(t) {
- t.pos.set(o), t.startPos.set(o), t.color._val = 4278190080, t.deltaColor.r = t.deltaColor.g = t.deltaColor.b = 0, t.deltaColor.a = 255, t.size = 0, t.deltaSize = 0, t.rotation = 0, t.deltaRotation = 0, t.timeToLive = 0, t.drawPos.set(o), t.dir.set(o), t.radialAccel = 0, t.tangentialAccel = 0, t.angle = 0, t.degreesPerSecond = 0, t.radius = 0, t.deltaRadius = 0
- }, 1024);
- f.get = function() {
- return this._get() || new _
- };
- var d = function(t) {
- this.sys = t, this.particles = [], this.active = !1, this.readyToPlay = !0, this.finished = !1, this.elapsed = 0, this.emitCounter = 0, this._uvFilled = 0
- };
- function p(t) {
- for (var e = 0, i = t; i;) e += i.angle, i = i.parent;
- return e
- }
- d.prototype.stop = function() {
- this.active = !1, this.readyToPlay = !1, this.elapsed = this.sys.duration, this.emitCounter = 0
- }, d.prototype.reset = function() {
- this.active = !0, this.readyToPlay = !0, this.elapsed = 0, this.emitCounter = 0, this.finished = !1;
- for (var t = this.particles, e = 0; e < t.length; ++e) f.put(t[e]);
- t.length = 0
- }, d.prototype.emitParticle = function(t) {
- var e = this.sys,
- i = s.clampf,
- n = f.get();
- this.particles.push(n), n.timeToLive = e.life + e.lifeVar * (Math.random() - .5) * 2;
- var r = n.timeToLive = Math.max(0, n.timeToLive);
- n.pos.x = e.sourcePos.x + e.posVar.x * (Math.random() - .5) * 2, n.pos.y = e.sourcePos.y + e.posVar.y * (Math.random() - .5) * 2;
- var o, a, l, h, c = e._startColor,
- u = e._startColorVar,
- _ = e._endColor,
- d = e._endColorVar;
- n.color.r = o = i(c.r + u.r * (Math.random() - .5) * 2, 0, 255), n.color.g = a = i(c.g + u.g * (Math.random() - .5) * 2, 0, 255), n.color.b = l = i(c.b + u.b * (Math.random() - .5) * 2, 0, 255), n.color.a = h = i(c.a + u.a * (Math.random() - .5) * 2, 0, 255), n.deltaColor.r = (i(_.r + d.r * (Math.random() - .5) * 2, 0, 255) - o) / r, n.deltaColor.g = (i(_.g + d.g * (Math.random() - .5) * 2, 0, 255) - a) / r, n.deltaColor.b = (i(_.b + d.b * (Math.random() - .5) * 2, 0, 255) - l) / r, n.deltaColor.a = (i(_.a + d.a * (Math.random() - .5) * 2, 0, 255) - h) / r;
- var m = e.startSize + e.startSizeVar * (Math.random() - .5) * 2;
- if (m = Math.max(0, m), n.size = m, e.endSize === cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE) n.deltaSize = 0;
- else {
- var y = e.endSize + e.endSizeVar * (Math.random() - .5) * 2;
- y = Math.max(0, y), n.deltaSize = (y - m) / r
- }
- var v = e.startSpin + e.startSpinVar * (Math.random() - .5) * 2,
- g = e.endSpin + e.endSpinVar * (Math.random() - .5) * 2;
- n.rotation = v, n.deltaRotation = (g - v) / r, n.startPos.x = t.x, n.startPos.y = t.y;
- var x = p(e.node),
- b = e.positionType === cc.ParticleSystem.PositionType.FREE ? e.angle + x : e.angle,
- A = s.degreesToRadians(b + e.angleVar * (Math.random() - .5) * 2);
- if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
- var C = e.speed + e.speedVar * (Math.random() - .5) * 2;
- n.dir.x = Math.cos(A), n.dir.y = Math.sin(A), n.dir.mulSelf(C), n.radialAccel = e.radialAccel + e.radialAccelVar * (Math.random() - .5) * 2, n.tangentialAccel = e.tangentialAccel + e.tangentialAccelVar * (Math.random() - .5) * 2, e.rotationIsDir && (n.rotation = -s.radiansToDegrees(Math.atan2(n.dir.y, n.dir.x)))
- } else {
- var T = e.startRadius + e.startRadiusVar * (Math.random() - .5) * 2,
- S = e.endRadius + e.endRadiusVar * (Math.random() - .5) * 2;
- n.radius = T, n.deltaRadius = e.endRadius === cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS ? 0 : (S - T) / r, n.angle = A, n.degreesPerSecond = s.degreesToRadians(e.rotatePerS + e.rotatePerSVar * (Math.random() - .5) * 2)
- }
- }, d.prototype.updateUVs = function(t) {
- var e = this.sys._assembler;
- if (e) {
- var i = e.getBuffer();
- if (i && this.sys._renderSpriteFrame) {
- for (var n = 4 * e._vfmt._bytes / 4, r = i._vData, s = this.sys._renderSpriteFrame.uv, o = t ? 0 : this._uvFilled, a = this.particles.length, l = o; l < a; l++) {
- var h = l * n;
- r[h + 2] = s[0], r[h + 3] = s[1], r[h + 7] = s[2], r[h + 8] = s[3], r[h + 12] = s[4], r[h + 13] = s[5], r[h + 17] = s[6], r[h + 18] = s[7]
- }
- this._uvFilled = a
- }
- }
- }, d.prototype.updateParticleBuffer = function(t, e, i, n) {
- var r = i._vData,
- o = i._uintVData,
- a = e.x,
- l = e.y,
- h = t.size / 2;
- if (t.rotation) {
- var c = -h,
- u = -h,
- _ = h,
- f = h,
- d = -s.degreesToRadians(t.rotation),
- p = Math.cos(d),
- m = Math.sin(d);
- r[n] = c * p - u * m + a, r[n + 1] = c * m + u * p + l, r[n + 5] = _ * p - u * m + a, r[n + 6] = _ * m + u * p + l, r[n + 10] = c * p - f * m + a, r[n + 11] = c * m + f * p + l, r[n + 15] = _ * p - f * m + a, r[n + 16] = _ * m + f * p + l
- } else r[n] = a - h, r[n + 1] = l - h, r[n + 5] = a + h, r[n + 6] = l - h, r[n + 10] = a - h, r[n + 11] = l + h, r[n + 15] = a + h, r[n + 16] = l + h;
- o[n + 4] = t.color._val, o[n + 9] = t.color._val, o[n + 14] = t.color._val, o[n + 19] = t.color._val
- }, d.prototype.step = function(t) {
- var e = this.sys,
- i = e.node,
- r = this.particles,
- _ = 4 * this.sys._assembler._vfmt._bytes / 4;
- if (i._updateWorldMatrix(), a = n.identity(), e.positionType === cc.ParticleSystem.PositionType.FREE) {
- var d = i._worldMatrix.m;
- a.tx = d[12], a.ty = d[13], n.transformVec2(l, o, a)
- } else if (e.positionType === cc.ParticleSystem.PositionType.RELATIVE) {
- var p = s.degreesToRadians(-i.angle),
- m = Math.cos(p),
- y = Math.sin(p);
- a = n.create(m, -y, y, m, 0, 0), l.x = i.x, l.y = i.y
- }
- n.invert(a, a);
- var v = a;
- if (this.active && e.emissionRate) {
- var g = 1 / e.emissionRate;
- for (r.length < e.totalParticles && (this.emitCounter += t); r.length < e.totalParticles && this.emitCounter > g;) this.emitParticle(l), this.emitCounter -= g;
- this.elapsed += t, -1 !== e.duration && e.duration < this.elapsed && e.stopSystem()
- }
- var x = e._assembler.getBuffer(),
- b = r.length;
- x.reset(), x.request(4 * b, 6 * b), b > this._uvFilled && this.updateUVs();
- for (var A = 0; A < r.length;) {
- h.x = h.y = c.x = c.y = u.x = u.y = 0;
- var C = r[A];
- if (C.timeToLive -= t, C.timeToLive > 0) {
- if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
- var T = u,
- S = h,
- w = c;
- (C.pos.x || C.pos.y) && (S.set(C.pos), S.normalizeSelf()), w.set(S), S.mulSelf(C.radialAccel);
- var E = w.x;
- w.x = -w.y, w.y = E, w.mulSelf(C.tangentialAccel), T.set(S), T.addSelf(w), T.addSelf(e.gravity), T.mulSelf(t), C.dir.addSelf(T), T.set(C.dir), T.mulSelf(t), C.pos.addSelf(T)
- } else C.angle += C.degreesPerSecond * t, C.radius += C.deltaRadius * t, C.pos.x = -Math.cos(C.angle) * C.radius, C.pos.y = -Math.sin(C.angle) * C.radius;
- C.color.r += C.deltaColor.r * t, C.color.g += C.deltaColor.g * t, C.color.b += C.deltaColor.b * t, C.color.a += C.deltaColor.a * t, C.size += C.deltaSize * t, C.size < 0 && (C.size = 0), C.rotation += C.deltaRotation * t;
- var M = h,
- D = c;
- if (e.positionType === cc.ParticleSystem.PositionType.FREE) D.set(C.startPos), D.negSelf(), M.set(C.pos), M.subSelf(D);
- else if (e.positionType === cc.ParticleSystem.PositionType.RELATIVE) {
- var B = u;
- n.transformVec2(D, l, v), n.transformVec2(B, C.startPos, v), D.subSelf(B), M.set(C.pos), M.subSelf(D)
- } else M.set(C.pos);
- var I = _ * A;
- this.updateParticleBuffer(C, M, x, I), ++A
- } else {
- var P = r[A];
- A !== r.length - 1 && (r[A] = r[r.length - 1]), f.put(P), r.length--
- }
- }
- r.length > 0 ? (x.uploadData(), e._assembler._ia._count = 6 * r.length) : this.active || this.readyToPlay || (this.finished = !0, e._finishedSimulation())
- }, e.exports = d
- }), {
- "../core/platform/js": 218,
- "../core/utils/affine-transform": 290,
- "../core/utils/misc": 300
- }],
- 345: [(function(t, e, i) {
- "use strict";
- var n = s(t("../core/renderer/assembler")),
- r = s(t("../renderer/core/input-assembler"));
- function s(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = t("./CCParticleSystem"),
- c = t("../core/renderer/"),
- u = t("../core/renderer/webgl/quad-buffer"),
- _ = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,
- f = (function(t) {
- function e(i) {
- o(this, e);
- var n = a(this, t.call(this, i));
- return n._buffer = null, n._ia = null, n._vfmt = _, n
- }
- return l(e, t), e.prototype.getBuffer = function() {
- return this._buffer || (this._buffer = new u(c._handle, _), this._ia = new r.default, this._ia._vertexBuffer = this._buffer._vb, this._ia._indexBuffer = this._buffer._ib, this._ia._start = 0, this._ia._count = 0), this._buffer
- }, e.prototype.fillBuffers = function(t, e) {
- this._ia && (e.node = t.node, e.material = t.sharedMaterials[0], e._flushIA(this._ia))
- }, e
- })(n.default);
- n.default.register(h, f), e.exports = f
- }), {
- "../core/renderer/": 247,
- "../core/renderer/assembler": 227,
- "../core/renderer/webgl/quad-buffer": 285,
- "../core/renderer/webgl/vertex-format": 288,
- "../renderer/core/input-assembler": 350,
- "./CCParticleSystem": 341
- }],
- 346: [(function(t, e, i) {
- "use strict";
- var n, r, s, o = 512,
- a = 513,
- l = 514,
- h = 515,
- c = 516,
- u = 517,
- _ = 518,
- f = 519,
- d = 32774,
- p = 32778,
- m = 32779,
- y = 0,
- v = 1,
- g = 768,
- x = 769,
- b = 774,
- A = 775,
- C = 770,
- T = 771,
- S = 772,
- w = 773,
- E = 32769,
- M = 32770,
- D = 32771,
- B = 32772,
- I = 776,
- P = 7680,
- R = 7681,
- O = 7682,
- L = 34055,
- F = 7683,
- N = 34056,
- V = 5386,
- k = 0,
- G = 1028,
- U = 1029;
- (function(t) {
- t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", t[t.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL"
- })(n || (n = {})), (function(t) {
- t[t.UNKNOWN = 0] = "UNKNOWN", t[t.BUFFER = 1] = "BUFFER", t[t.TEXTURE = 2] = "TEXTURE", t[t.TEXTURE_VIEW = 3] = "TEXTURE_VIEW", t[t.RENDER_PASS = 4] = "RENDER_PASS", t[t.FRAMEBUFFER = 5] = "FRAMEBUFFER", t[t.SAMPLER = 6] = "SAMPLER", t[t.SHADER = 7] = "SHADER", t[t.PIPELINE_LAYOUT = 8] = "PIPELINE_LAYOUT", t[t.PIPELINE_STATE = 9] = "PIPELINE_STATE", t[t.BINDING_LAYOUT = 10] = "BINDING_LAYOUT", t[t.INPUT_ASSEMBLER = 11] = "INPUT_ASSEMBLER", t[t.COMMAND_ALLOCATOR = 12] = "COMMAND_ALLOCATOR", t[t.COMMAND_BUFFER = 13] = "COMMAND_BUFFER", t[t.QUEUE = 14] = "QUEUE", t[t.WINDOW = 15] = "WINDOW"
- })(r || (r = {})), (function(t) {
- t[t.UNREADY = 0] = "UNREADY", t[t.FAILED = 1] = "FAILED", t[t.SUCCESS = 2] = "SUCCESS"
- })(s || (s = {}));
- var z, j, W, H, X, Y, q, J, Z, K, Q, $, tt, et, it, nt, rt, st, ot, at, lt, ht, ct, ut, _t, ft, dt, pt, mt, yt, vt, gt, xt, bt, At;
- (function() {
- function t(t) {
- this._gfxType = r.UNKNOWN, this._status = s.UNREADY, this._gfxType = t
- }
- Object.defineProperty(t.prototype, "gfxType", {
- get: function() {
- return this._gfxType
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t.prototype, "status", {
- get: function() {
- return this._status
- },
- enumerable: !0,
- configurable: !0
- })
- })();
- (function(t) {
- t.ATTR_POSITION = "a_position", t.ATTR_NORMAL = "a_normal", t.ATTR_TANGENT = "a_tangent", t.ATTR_BITANGENT = "a_bitangent", t.ATTR_WEIGHTS = "a_weights", t.ATTR_JOINTS = "a_joints", t.ATTR_COLOR = "a_color", t.ATTR_COLOR1 = "a_color1", t.ATTR_COLOR2 = "a_color2", t.ATTR_TEX_COORD = "a_texCoord", t.ATTR_TEX_COORD1 = "a_texCoord1", t.ATTR_TEX_COORD2 = "a_texCoord2", t.ATTR_TEX_COORD3 = "a_texCoord3", t.ATTR_TEX_COORD4 = "a_texCoord4", t.ATTR_TEX_COORD5 = "a_texCoord5", t.ATTR_TEX_COORD6 = "a_texCoord6", t.ATTR_TEX_COORD7 = "a_texCoord7", t.ATTR_TEX_COORD8 = "a_texCoord8"
- })(z || (z = {})), (function(t) {
- t[t.UNKNOWN = 0] = "UNKNOWN", t[t.BOOL = 1] = "BOOL", t[t.BOOL2 = 2] = "BOOL2", t[t.BOOL3 = 3] = "BOOL3", t[t.BOOL4 = 4] = "BOOL4", t[t.INT = 5] = "INT", t[t.INT2 = 6] = "INT2", t[t.INT3 = 7] = "INT3", t[t.INT4 = 8] = "INT4", t[t.UINT = 9] = "UINT", t[t.UINT2 = 10] = "UINT2", t[t.UINT3 = 11] = "UINT3", t[t.UINT4 = 12] = "UINT4", t[t.FLOAT = 13] = "FLOAT", t[t.FLOAT2 = 14] = "FLOAT2", t[t.FLOAT3 = 15] = "FLOAT3", t[t.FLOAT4 = 16] = "FLOAT4", t[t.COLOR4 = 17] = "COLOR4", t[t.MAT2 = 18] = "MAT2", t[t.MAT2X3 = 19] = "MAT2X3", t[t.MAT2X4 = 20] = "MAT2X4", t[t.MAT3X2 = 21] = "MAT3X2", t[t.MAT3 = 22] = "MAT3", t[t.MAT3X4 = 23] = "MAT3X4", t[t.MAT4X2 = 24] = "MAT4X2", t[t.MAT4X3 = 25] = "MAT4X3", t[t.MAT4 = 26] = "MAT4", t[t.SAMPLER1D = 27] = "SAMPLER1D", t[t.SAMPLER1D_ARRAY = 28] = "SAMPLER1D_ARRAY", t[t.SAMPLER2D = 29] = "SAMPLER2D", t[t.SAMPLER2D_ARRAY = 30] = "SAMPLER2D_ARRAY", t[t.SAMPLER3D = 31] = "SAMPLER3D", t[t.SAMPLER_CUBE = 32] = "SAMPLER_CUBE", t[t.COUNT = 33] = "COUNT"
- })(j || (j = {})), (function(t) {
- t[t.UNKNOWN = 0] = "UNKNOWN", t[t.A8 = 1] = "A8", t[t.L8 = 2] = "L8", t[t.LA8 = 3] = "LA8", t[t.R8 = 4] = "R8", t[t.R8SN = 5] = "R8SN", t[t.R8UI = 6] = "R8UI", t[t.R8I = 7] = "R8I", t[t.R16F = 8] = "R16F", t[t.R16UI = 9] = "R16UI", t[t.R16I = 10] = "R16I", t[t.R32F = 11] = "R32F", t[t.R32UI = 12] = "R32UI", t[t.R32I = 13] = "R32I", t[t.RG8 = 14] = "RG8", t[t.RG8SN = 15] = "RG8SN", t[t.RG8UI = 16] = "RG8UI", t[t.RG8I = 17] = "RG8I", t[t.RG16F = 18] = "RG16F", t[t.RG16UI = 19] = "RG16UI", t[t.RG16I = 20] = "RG16I", t[t.RG32F = 21] = "RG32F", t[t.RG32UI = 22] = "RG32UI", t[t.RG32I = 23] = "RG32I", t[t.RGB8 = 24] = "RGB8", t[t.SRGB8 = 25] = "SRGB8", t[t.RGB8SN = 26] = "RGB8SN", t[t.RGB8UI = 27] = "RGB8UI", t[t.RGB8I = 28] = "RGB8I", t[t.RGB16F = 29] = "RGB16F", t[t.RGB16UI = 30] = "RGB16UI", t[t.RGB16I = 31] = "RGB16I", t[t.RGB32F = 32] = "RGB32F", t[t.RGB32UI = 33] = "RGB32UI", t[t.RGB32I = 34] = "RGB32I", t[t.RGBA8 = 35] = "RGBA8", t[t.SRGB8_A8 = 36] = "SRGB8_A8", t[t.RGBA8SN = 37] = "RGBA8SN", t[t.RGBA8UI = 38] = "RGBA8UI", t[t.RGBA8I = 39] = "RGBA8I", t[t.RGBA16F = 40] = "RGBA16F", t[t.RGBA16UI = 41] = "RGBA16UI", t[t.RGBA16I = 42] = "RGBA16I", t[t.RGBA32F = 43] = "RGBA32F", t[t.RGBA32UI = 44] = "RGBA32UI", t[t.RGBA32I = 45] = "RGBA32I", t[t.R5G6B5 = 46] = "R5G6B5", t[t.R11G11B10F = 47] = "R11G11B10F", t[t.RGB5A1 = 48] = "RGB5A1", t[t.RGBA4 = 49] = "RGBA4", t[t.RGB10A2 = 50] = "RGB10A2", t[t.RGB10A2UI = 51] = "RGB10A2UI", t[t.RGB9E5 = 52] = "RGB9E5", t[t.D16 = 53] = "D16", t[t.D16S8 = 54] = "D16S8", t[t.D24 = 55] = "D24", t[t.D24S8 = 56] = "D24S8", t[t.D32F = 57] = "D32F", t[t.D32F_S8 = 58] = "D32F_S8", t[t.BC1 = 59] = "BC1", t[t.BC1_ALPHA = 60] = "BC1_ALPHA", t[t.BC1_SRGB = 61] = "BC1_SRGB", t[t.BC1_SRGB_ALPHA = 62] = "BC1_SRGB_ALPHA", t[t.BC2 = 63] = "BC2", t[t.BC2_SRGB = 64] = "BC2_SRGB", t[t.BC3 = 65] = "BC3", t[t.BC3_SRGB = 66] = "BC3_SRGB", t[t.BC4 = 67] = "BC4", t[t.BC4_SNORM = 68] = "BC4_SNORM", t[t.BC5 = 69] = "BC5", t[t.BC5_SNORM = 70] = "BC5_SNORM", t[t.BC6H_UF16 = 71] = "BC6H_UF16", t[t.BC6H_SF16 = 72] = "BC6H_SF16", t[t.BC7 = 73] = "BC7", t[t.BC7_SRGB = 74] = "BC7_SRGB", t[t.ETC_RGB8 = 75] = "ETC_RGB8", t[t.ETC2_RGB8 = 76] = "ETC2_RGB8", t[t.ETC2_SRGB8 = 77] = "ETC2_SRGB8", t[t.ETC2_RGB8_A1 = 78] = "ETC2_RGB8_A1", t[t.ETC2_SRGB8_A1 = 79] = "ETC2_SRGB8_A1", t[t.ETC2_RGBA8 = 80] = "ETC2_RGBA8", t[t.ETC2_SRGB8_A8 = 81] = "ETC2_SRGB8_A8", t[t.EAC_R11 = 82] = "EAC_R11", t[t.EAC_R11SN = 83] = "EAC_R11SN", t[t.EAC_RG11 = 84] = "EAC_RG11", t[t.EAC_RG11SN = 85] = "EAC_RG11SN", t[t.PVRTC_RGB2 = 86] = "PVRTC_RGB2", t[t.PVRTC_RGBA2 = 87] = "PVRTC_RGBA2", t[t.PVRTC_RGB4 = 88] = "PVRTC_RGB4", t[t.PVRTC_RGBA4 = 89] = "PVRTC_RGBA4", t[t.PVRTC2_2BPP = 90] = "PVRTC2_2BPP", t[t.PVRTC2_4BPP = 91] = "PVRTC2_4BPP"
- })(W || (W = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", t[t.TRANSFER_DST = 2] = "TRANSFER_DST", t[t.INDEX = 4] = "INDEX", t[t.VERTEX = 8] = "VERTEX", t[t.UNIFORM = 16] = "UNIFORM", t[t.STORAGE = 32] = "STORAGE", t[t.INDIRECT = 64] = "INDIRECT"
- })(H || (H = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.DEVICE = 1] = "DEVICE", t[t.HOST = 2] = "HOST"
- })(X || (X = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.READ = 1] = "READ", t[t.WRITE = 2] = "WRITE"
- })(Y || (Y = {})), (function(t) {
- t[t.POINT_LIST = 0] = "POINT_LIST", t[t.LINE_LIST = 1] = "LINE_LIST", t[t.LINE_STRIP = 2] = "LINE_STRIP", t[t.LINE_LOOP = 3] = "LINE_LOOP", t[t.LINE_LIST_ADJACENCY = 4] = "LINE_LIST_ADJACENCY", t[t.LINE_STRIP_ADJACENCY = 5] = "LINE_STRIP_ADJACENCY", t[t.ISO_LINE_LIST = 6] = "ISO_LINE_LIST", t[t.TRIANGLE_LIST = 7] = "TRIANGLE_LIST", t[t.TRIANGLE_STRIP = 8] = "TRIANGLE_STRIP", t[t.TRIANGLE_FAN = 9] = "TRIANGLE_FAN", t[t.TRIANGLE_LIST_ADJACENCY = 10] = "TRIANGLE_LIST_ADJACENCY", t[t.TRIANGLE_STRIP_ADJACENCY = 11] = "TRIANGLE_STRIP_ADJACENCY", t[t.TRIANGLE_PATCH_ADJACENCY = 12] = "TRIANGLE_PATCH_ADJACENCY", t[t.QUAD_PATCH_LIST = 13] = "QUAD_PATCH_LIST"
- })(q || (q = {})), (function(t) {
- t[t.FILL = 0] = "FILL", t[t.POINT = 1] = "POINT", t[t.LINE = 2] = "LINE"
- })(J || (J = {})), (function(t) {
- t[t.GOURAND = 0] = "GOURAND", t[t.FLAT = 1] = "FLAT"
- })(Z || (Z = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.FRONT = 1] = "FRONT", t[t.BACK = 2] = "BACK"
- })(K || (K = {})), (function(t) {
- t[t.NEVER = 0] = "NEVER", t[t.LESS = 1] = "LESS", t[t.EQUAL = 2] = "EQUAL", t[t.LESS_EQUAL = 3] = "LESS_EQUAL", t[t.GREATER = 4] = "GREATER", t[t.NOT_EQUAL = 5] = "NOT_EQUAL", t[t.GREATER_EQUAL = 6] = "GREATER_EQUAL", t[t.ALWAYS = 7] = "ALWAYS"
- })(Q || (Q = {})), (function(t) {
- t[t.ZERO = 0] = "ZERO", t[t.KEEP = 1] = "KEEP", t[t.REPLACE = 2] = "REPLACE", t[t.INCR = 3] = "INCR", t[t.DECR = 4] = "DECR", t[t.INVERT = 5] = "INVERT", t[t.INCR_WRAP = 6] = "INCR_WRAP", t[t.DECR_WRAP = 7] = "DECR_WRAP"
- })($ || ($ = {})), (function(t) {
- t[t.ADD = 0] = "ADD", t[t.SUB = 1] = "SUB", t[t.REV_SUB = 2] = "REV_SUB", t[t.MIN = 3] = "MIN", t[t.MAX = 4] = "MAX"
- })(tt || (tt = {})), (function(t) {
- t[t.ZERO = 0] = "ZERO", t[t.ONE = 1] = "ONE", t[t.SRC_ALPHA = 2] = "SRC_ALPHA", t[t.DST_ALPHA = 3] = "DST_ALPHA", t[t.ONE_MINUS_SRC_ALPHA = 4] = "ONE_MINUS_SRC_ALPHA", t[t.ONE_MINUS_DST_ALPHA = 5] = "ONE_MINUS_DST_ALPHA", t[t.SRC_COLOR = 6] = "SRC_COLOR", t[t.DST_COLOR = 7] = "DST_COLOR", t[t.ONE_MINUS_SRC_COLOR = 8] = "ONE_MINUS_SRC_COLOR", t[t.ONE_MINUS_DST_COLOR = 9] = "ONE_MINUS_DST_COLOR", t[t.SRC_ALPHA_SATURATE = 10] = "SRC_ALPHA_SATURATE", t[t.CONSTANT_COLOR = 11] = "CONSTANT_COLOR", t[t.ONE_MINUS_CONSTANT_COLOR = 12] = "ONE_MINUS_CONSTANT_COLOR", t[t.CONSTANT_ALPHA = 13] = "CONSTANT_ALPHA", t[t.ONE_MINUS_CONSTANT_ALPHA = 14] = "ONE_MINUS_CONSTANT_ALPHA"
- })(et || (et = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.R = 1] = "R", t[t.G = 2] = "G", t[t.B = 4] = "B", t[t.A = 8] = "A", t[t.ALL = 15] = "ALL"
- })(it || (it = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.POINT = 1] = "POINT", t[t.LINEAR = 2] = "LINEAR", t[t.ANISOTROPIC = 3] = "ANISOTROPIC"
- })(nt || (nt = {})), (function(t) {
- t[t.WRAP = 0] = "WRAP", t[t.MIRROR = 1] = "MIRROR", t[t.CLAMP = 2] = "CLAMP", t[t.BORDER = 3] = "BORDER"
- })(rt || (rt = {})), (function(t) {
- t[t.TEX1D = 0] = "TEX1D", t[t.TEX2D = 1] = "TEX2D", t[t.TEX3D = 2] = "TEX3D"
- })(st || (st = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", t[t.TRANSFER_DST = 2] = "TRANSFER_DST", t[t.SAMPLED = 4] = "SAMPLED", t[t.STORAGE = 8] = "STORAGE", t[t.COLOR_ATTACHMENT = 16] = "COLOR_ATTACHMENT", t[t.DEPTH_STENCIL_ATTACHMENT = 32] = "DEPTH_STENCIL_ATTACHMENT", t[t.TRANSIENT_ATTACHMENT = 64] = "TRANSIENT_ATTACHMENT", t[t.INPUT_ATTACHMENT = 128] = "INPUT_ATTACHMENT"
- })(ot || (ot = {})), (function(t) {
- t[t.X1 = 0] = "X1", t[t.X2 = 1] = "X2", t[t.X4 = 2] = "X4", t[t.X8 = 3] = "X8", t[t.X16 = 4] = "X16", t[t.X32 = 5] = "X32", t[t.X64 = 6] = "X64"
- })(at || (at = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.GEN_MIPMAP = 1] = "GEN_MIPMAP", t[t.CUBEMAP = 2] = "CUBEMAP", t[t.BAKUP_BUFFER = 4] = "BAKUP_BUFFER"
- })(lt || (lt = {})), (function(t) {
- t[t.TV1D = 0] = "TV1D", t[t.TV2D = 1] = "TV2D", t[t.TV3D = 2] = "TV3D", t[t.CUBE = 3] = "CUBE", t[t.TV1D_ARRAY = 4] = "TV1D_ARRAY", t[t.TV2D_ARRAY = 5] = "TV2D_ARRAY"
- })(ht || (ht = {})), (function(t) {
- t[t.VERTEX = 0] = "VERTEX", t[t.HULL = 1] = "HULL", t[t.DOMAIN = 2] = "DOMAIN", t[t.GEOMETRY = 3] = "GEOMETRY", t[t.FRAGMENT = 4] = "FRAGMENT", t[t.COMPUTE = 5] = "COMPUTE", t[t.COUNT = 6] = "COUNT"
- })(ct || (ct = {})), (function(t) {
- t[t.UNKNOWN = 0] = "UNKNOWN", t[t.UNIFORM_BUFFER = 1] = "UNIFORM_BUFFER", t[t.SAMPLER = 2] = "SAMPLER", t[t.STORAGE_BUFFER = 3] = "STORAGE_BUFFER"
- })(ut || (ut = {})), (function(t) {
- t[t.PRIMARY = 0] = "PRIMARY", t[t.SECONDARY = 1] = "SECONDARY"
- })(_t || (_t = {})), (function(t) {
- t[t.LOAD = 0] = "LOAD", t[t.CLEAR = 1] = "CLEAR", t[t.DISCARD = 2] = "DISCARD"
- })(ft || (ft = {})), (function(t) {
- t[t.STORE = 0] = "STORE", t[t.DISCARD = 1] = "DISCARD"
- })(dt || (dt = {})), (function(t) {
- t[t.UNDEFINED = 0] = "UNDEFINED", t[t.GENERAL = 1] = "GENERAL", t[t.COLOR_ATTACHMENT_OPTIMAL = 2] = "COLOR_ATTACHMENT_OPTIMAL", t[t.DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3] = "DEPTH_STENCIL_ATTACHMENT_OPTIMAL", t[t.DEPTH_STENCIL_READONLY_OPTIMAL = 4] = "DEPTH_STENCIL_READONLY_OPTIMAL", t[t.SHADER_READONLY_OPTIMAL = 5] = "SHADER_READONLY_OPTIMAL", t[t.TRANSFER_SRC_OPTIMAL = 6] = "TRANSFER_SRC_OPTIMAL", t[t.TRANSFER_DST_OPTIMAL = 7] = "TRANSFER_DST_OPTIMAL", t[t.PREINITIALIZED = 8] = "PREINITIALIZED", t[t.PRESENT_SRC = 9] = "PRESENT_SRC"
- })(pt || (pt = {})), (function(t) {
- t[t.GRAPHICS = 0] = "GRAPHICS", t[t.COMPUTE = 1] = "COMPUTE", t[t.RAY_TRACING = 2] = "RAY_TRACING"
- })(mt || (mt = {})), (function(t) {
- t[t.VIEWPORT = 0] = "VIEWPORT", t[t.SCISSOR = 1] = "SCISSOR", t[t.LINE_WIDTH = 2] = "LINE_WIDTH", t[t.DEPTH_BIAS = 3] = "DEPTH_BIAS", t[t.BLEND_CONSTANTS = 4] = "BLEND_CONSTANTS", t[t.DEPTH_BOUNDS = 5] = "DEPTH_BOUNDS", t[t.STENCIL_WRITE_MASK = 6] = "STENCIL_WRITE_MASK", t[t.STENCIL_COMPARE_MASK = 7] = "STENCIL_COMPARE_MASK"
- })(yt || (yt = {})), (function(t) {
- t[t.FRONT = 0] = "FRONT", t[t.BACK = 1] = "BACK", t[t.ALL = 2] = "ALL"
- })(vt || (vt = {})), (function(t) {
- t[t.GRAPHICS = 0] = "GRAPHICS", t[t.COMPUTE = 1] = "COMPUTE", t[t.TRANSFER = 2] = "TRANSFER"
- })(gt || (gt = {})), (function(t) {
- t[t.NONE = 0] = "NONE", t[t.COLOR = 1] = "COLOR", t[t.DEPTH = 2] = "DEPTH", t[t.STENCIL = 4] = "STENCIL", t[t.DEPTH_STENCIL = 6] = "DEPTH_STENCIL", t[t.ALL = 7] = "ALL"
- })(xt || (xt = {})), (function(t) {
- t[t.DEFAULT = 100] = "DEFAULT"
- })(bt || (bt = {})), (function(t) {
- t[t.MIN = 0] = "MIN", t[t.MAX = 255] = "MAX", t[t.DEFAULT = 128] = "DEFAULT"
- })(At || (At = {}));
- var Ct, Tt, St, wt;
- (function(t) {
- t[t.UBO_GLOBAL = 23] = "UBO_GLOBAL", t[t.UBO_SHADOW = 22] = "UBO_SHADOW", t[t.UBO_LOCAL = 21] = "UBO_LOCAL", t[t.UBO_FORWARD_LIGHTS = 20] = "UBO_FORWARD_LIGHTS", t[t.UBO_SKINNING = 19] = "UBO_SKINNING", t[t.UBO_SKINNING_TEXTURE = 18] = "UBO_SKINNING_TEXTURE", t[t.UBO_UI = 17] = "UBO_UI", t[t.SAMPLER_JOINTS = 25] = "SAMPLER_JOINTS", t[t.SAMPLER_ENVIRONMENT = 26] = "SAMPLER_ENVIRONMENT", t[t.CUSTUM_UBO_BINDING_END_POINT = 17] = "CUSTUM_UBO_BINDING_END_POINT", t[t.CUSTOM_SAMPLER_BINDING_START_POINT = 30] = "CUSTOM_SAMPLER_BINDING_START_POINT"
- })(Ct || (Ct = {})), (function(t) {
- t[t.minFilter = 0] = "minFilter", t[t.magFilter = 1] = "magFilter", t[t.mipFilter = 2] = "mipFilter", t[t.addressU = 3] = "addressU", t[t.addressV = 4] = "addressV", t[t.addressW = 5] = "addressW", t[t.maxAnisotropy = 6] = "maxAnisotropy", t[t.cmpFunc = 7] = "cmpFunc", t[t.minLOD = 8] = "minLOD", t[t.maxLOD = 9] = "maxLOD", t[t.mipLODBias = 10] = "mipLODBias", t[t.borderColor = 11] = "borderColor", t[t.total = 15] = "total"
- })(wt || (wt = {}));
- var Et = {};
- Et[Et.bool = j.BOOL] = "bool", Et[Et.int = j.INT] = "int", Et[Et.ivec2 = j.INT2] = "ivec2invTypeParams", Et[Et.ivec3 = j.INT3] = "ivec3", Et[Et.ivec4 = j.INT4] = "ivec4", Et[Et.float = j.FLOAT] = "float", Et[Et.vec2 = j.FLOAT2] = "vec2", Et[Et.vec3 = j.FLOAT3] = "vec3", Et[Et.vec4 = j.FLOAT4] = "vec4", Et[Et.mat2 = j.MAT2] = "mat2", Et[Et.mat3 = j.MAT3] = "mat3", Et[Et.mat4 = j.MAT4] = "mat4", Et[Et.sampler2D = j.SAMPLER2D] = "sampler2D", Et[Et.samplerCube = j.SAMPLER_CUBE] = "samplerCube";
- var Mt = ((Tt = {})[j.BOOL] = 4, Tt[j.INT] = 4, Tt[j.INT2] = 8, Tt[j.INT3] = 12, Tt[j.INT4] = 16, Tt[j.FLOAT] = 4, Tt[j.FLOAT2] = 8, Tt[j.FLOAT3] = 12, Tt[j.FLOAT4] = 16, Tt[j.MAT2] = 16, Tt[j.MAT3] = 36, Tt[j.MAT4] = 64, Tt[j.SAMPLER2D] = 4, Tt[j.SAMPLER_CUBE] = 4, Tt),
- Dt = ((St = {})[j.BOOL] = W.R32I, St[j.INT] = W.R32I, St[j.INT2] = W.RG32I, St[j.INT3] = W.RGB32I, St[j.INT4] = W.RGBA32I, St[j.FLOAT] = W.R32F, St[j.FLOAT2] = W.RG32F, St[j.FLOAT3] = W.RGB32F, St[j.FLOAT4] = W.RGBA32F, St),
- Bt = {
- BACK: U,
- FRONT: G,
- NONE: k,
- ADD: d,
- SUB: p,
- REV_SUB: m,
- ZERO: y,
- ONE: v,
- SRC_COLOR: g,
- ONE_MINUS_SRC_COLOR: x,
- DST_COLOR: b,
- ONE_MINUS_DST_COLOR: A,
- SRC_ALPHA: C,
- ONE_MINUS_SRC_ALPHA: T,
- DST_ALPHA: S,
- ONE_MINUS_DST_ALPHA: w,
- CONSTANT_COLOR: E,
- ONE_MINUS_CONSTANT_COLOR: M,
- CONSTANT_ALPHA: D,
- ONE_MINUS_CONSTANT_ALPHA: B,
- SRC_ALPHA_SATURATE: I,
- NEVER: o,
- LESS: a,
- EQUAL: l,
- LEQUAL: h,
- GREATER: c,
- NOTEQUAL: u,
- GEQUAL: _,
- ALWAYS: f,
- KEEP: P,
- REPLACE: R,
- INCR: O,
- INCR_WRAP: L,
- DECR: F,
- DECR_WRAP: N,
- INVERT: V
- };
- Object.assign(Bt, bt);
- var It = {
- murmurhash2_32_gc: function(t, e) {
- for (var i, n = t.length, r = e ^ n, s = 0; n >= 4;) i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), n -= 4, ++s;
- switch (n) {
- case 3:
- r ^= (255 & t.charCodeAt(s + 2)) << 16;
- case 2:
- r ^= (255 & t.charCodeAt(s + 1)) << 8;
- case 1:
- r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16)
- }
- return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), (r ^= r >>> 15) >>> 0
- },
- SamplerInfoIndex: wt,
- effectStructure: {
- $techniques: [{
- $passes: [{
- depthStencilState: {},
- rasterizerState: {},
- blendState: {
- targets: [{}]
- },
- properties: {
- any: {
- sampler: {},
- inspector: {}
- }
- }
- }]
- }]
- },
- typeMap: Et,
- sizeMap: Mt,
- formatMap: Dt,
- passParams: Bt,
- RenderQueue: {
- OPAQUE: 0,
- TRANSPARENT: 1,
- OVERLAY: 2
- },
- RenderPriority: At,
- GFXGetTypeSize: function(t) {
- switch (t) {
- case j.BOOL:
- case j.INT:
- case j.UINT:
- case j.FLOAT:
- return 4;
- case j.BOOL2:
- case j.INT2:
- case j.UINT2:
- case j.FLOAT2:
- return 8;
- case j.BOOL3:
- case j.INT3:
- case j.UINT3:
- case j.FLOAT3:
- return 12;
- case j.BOOL4:
- case j.INT4:
- case j.UINT4:
- case j.FLOAT4:
- case j.MAT2:
- return 16;
- case j.MAT2X3:
- return 24;
- case j.MAT2X4:
- return 32;
- case j.MAT3X2:
- return 24;
- case j.MAT3:
- return 36;
- case j.MAT3X4:
- return 48;
- case j.MAT4X2:
- case j.MAT4X2:
- return 32;
- case j.MAT4:
- return 64;
- case j.SAMPLER1D:
- case j.SAMPLER1D_ARRAY:
- case j.SAMPLER2D:
- case j.SAMPLER2D_ARRAY:
- case j.SAMPLER3D:
- case j.SAMPLER_CUBE:
- return 4;
- default:
- return 0
- }
- },
- UniformBinding: Ct
- };
- e.exports = It
- }), {}],
- 347: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = 0,
- r = {};
- i.default = {
- addStage: function(t) {
- if (void 0 === r[t]) {
- var e = 1 << n;
- r[t] = e, n += 1
- }
- },
- stageID: function(t) {
- var e = r[t];
- return void 0 === e ? -1 : e
- },
- stageIDs: function(t) {
- for (var e = 0, i = 0; i < t.length; ++i) {
- var n = r[t[i]];
- void 0 !== n && (e |= n)
- }
- return e
- }
- }, e.exports = i.default
- }), {}],
- 348: [(function(t, e, i) {
- "use strict";
- var n, r;
- i.__esModule = !0, i.default = void 0;
- var s = t("../memop"),
- o = u(t("../enums")),
- a = t("../../core/vmath"),
- l = u(t("./program-lib")),
- h = u(t("./view")),
- c = u(t("../gfx"));
- function u(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function _(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- a.mat3.create();
- var f = a.mat4.create(),
- d = new s.RecyclePool(function() {
- return {
- stage: null,
- items: null
- }
- }, 8),
- p = new s.RecyclePool(function() {
- return new Float32Array(2)
- }, 8),
- m = new s.RecyclePool(function() {
- return new Float32Array(3)
- }, 8),
- y = new s.RecyclePool(function() {
- return new Float32Array(4)
- }, 8),
- v = new s.RecyclePool(function() {
- return new Float32Array(9)
- }, 8),
- g = new s.RecyclePool(function() {
- return new Float32Array(16)
- }, 8),
- x = new s.RecyclePool(function() {
- return new Float32Array(64)
- }, 8),
- b = new s.RecyclePool(function() {
- return new Int32Array(2)
- }, 8),
- A = new s.RecyclePool(function() {
- return new Int32Array(3)
- }, 8),
- C = new s.RecyclePool(function() {
- return new Int32Array(4)
- }, 8),
- T = new s.RecyclePool(function() {
- return new Int32Array(64)
- }, 8),
- S = ((n = {})[o.default.PARAM_INT] = function(t) {
- return t
- }, n[o.default.PARAM_INT2] = function(t) {
- return a.vec2.array(b.add(), t)
- }, n[o.default.PARAM_INT3] = function(t) {
- return a.vec3.array(A.add(), t)
- }, n[o.default.PARAM_INT4] = function(t) {
- return a.vec4.array(C.add(), t)
- }, n[o.default.PARAM_FLOAT] = function(t) {
- return t
- }, n[o.default.PARAM_FLOAT2] = function(t) {
- return a.vec2.array(p.add(), t)
- }, n[o.default.PARAM_FLOAT3] = function(t) {
- return a.vec3.array(m.add(), t)
- }, n[o.default.PARAM_FLOAT4] = function(t) {
- return a.vec4.array(y.add(), t)
- }, n[o.default.PARAM_COLOR3] = function(t) {
- return a.color3.array(m.add(), t)
- }, n[o.default.PARAM_COLOR4] = function(t) {
- return a.color4.array(y.add(), t)
- }, n[o.default.PARAM_MAT2] = function(t) {
- return a.mat2.array(y.add(), t)
- }, n[o.default.PARAM_MAT3] = function(t) {
- return a.mat3.array(v.add(), t)
- }, n[o.default.PARAM_MAT4] = function(t) {
- return a.mat4.array(g.add(), t)
- }, (r = {})[o.default.PARAM_INT] = {
- func: function(t) {
- for (var e = T.add(), i = 0; i < t.length; ++i) e[i] = t[i];
- return e
- },
- size: 1
- }, r[o.default.PARAM_INT2] = {
- func: function(t) {
- for (var e = T.add(), i = 0; i < t.length; ++i) e[2 * i] = t[i].x, e[2 * i + 1] = t[i].y;
- return e
- },
- size: 2
- }, r[o.default.PARAM_INT3] = {
- func: void 0,
- size: 3
- }, r[o.default.PARAM_INT4] = {
- func: function(t) {
- for (var e = T.add(), i = 0; i < t.length; ++i) {
- var n = t[i];
- e[4 * i] = n.x, e[4 * i + 1] = n.y, e[4 * i + 2] = n.z, e[4 * i + 3] = n.w
- }
- return e
- },
- size: 4
- }, r[o.default.PARAM_FLOAT] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) e[i] = t[i];
- return e
- },
- size: 1
- }, r[o.default.PARAM_FLOAT2] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) e[2 * i] = t[i].x, e[2 * i + 1] = t[i].y;
- return e
- },
- size: 2
- }, r[o.default.PARAM_FLOAT3] = {
- func: void 0,
- size: 3
- }, r[o.default.PARAM_FLOAT4] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) {
- var n = t[i];
- e[4 * i] = n.x, e[4 * i + 1] = n.y, e[4 * i + 2] = n.z, e[4 * i + 3] = n.w
- }
- return e
- },
- size: 4
- }, r[o.default.PARAM_COLOR3] = {
- func: void 0,
- size: 3
- }, r[o.default.PARAM_COLOR4] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) {
- var n = t[i];
- e[4 * i] = n.r, e[4 * i + 1] = n.g, e[4 * i + 2] = n.b, e[4 * i + 3] = n.a
- }
- return e
- },
- size: 4
- }, r[o.default.PARAM_MAT2] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) {
- var n = t[i];
- e.set(n.m, 4 * i)
- }
- return e
- },
- size: 4
- }, r[o.default.PARAM_MAT3] = {
- func: void 0,
- size: 9
- }, r[o.default.PARAM_MAT4] = {
- func: function(t) {
- for (var e = x.add(), i = 0; i < t.length; ++i) {
- var n = t[i];
- e.set(n.m, 16 * i)
- }
- return e
- },
- size: 16
- }, (function() {
- function t(e, i) {
- var n;
- _(this, t), this._device = e, this._programLib = new l.default(e), this._opts = i, this._type2defaultValue = ((n = {})[o.default.PARAM_INT] = 0, n[o.default.PARAM_INT2] = a.vec2.create(0, 0), n[o.default.PARAM_INT3] = a.vec3.create(0, 0, 0), n[o.default.PARAM_INT4] = a.vec4.create(0, 0, 0, 0), n[o.default.PARAM_FLOAT] = 0, n[o.default.PARAM_FLOAT2] = a.vec2.create(0, 0), n[o.default.PARAM_FLOAT3] = a.vec3.create(0, 0, 0), n[o.default.PARAM_FLOAT4] = a.vec4.create(0, 0, 0, 0), n[o.default.PARAM_COLOR3] = a.color3.create(0, 0, 0), n[o.default.PARAM_COLOR4] = a.color4.create(0, 0, 0, 1), n[o.default.PARAM_MAT2] = a.mat2.create(), n[o.default.PARAM_MAT3] = a.mat3.create(), n[o.default.PARAM_MAT4] = a.mat4.create(), n[o.default.PARAM_TEXTURE_2D] = i.defaultTexture, n[o.default.PARAM_TEXTURE_CUBE] = i.defaultTextureCube, n), this._stage2fn = {}, this._usedTextureUnits = 0, this._viewPools = new s.RecyclePool(function() {
- return new h.default
- }, 8), this._drawItemsPools = new s.RecyclePool(function() {
- return {
- model: null,
- node: null,
- ia: null,
- effect: null,
- defines: null,
- uniforms: null
- }
- }, 100), this._stageItemsPools = new s.RecyclePool(function() {
- return new s.RecyclePool(function() {
- return {
- model: null,
- node: null,
- ia: null,
- effect: null,
- defines: null,
- technique: null,
- sortKey: -1,
- uniforms: null
- }
- }, 100)
- }, 16)
- }
- return t.prototype._resetTextuerUnit = function() {
- this._usedTextureUnits = 0
- }, t.prototype._allocTextureUnit = function() {
- var t = this._device,
- e = this._usedTextureUnits;
- return e >= t._caps.maxTextureUnits && console.warn("Trying to use " + e + " texture units while this GPU supports only " + t._caps.maxTextureUnits), this._usedTextureUnits += 1, e
- }, t.prototype._registerStage = function(t, e) {
- this._stage2fn[t] = e
- }, t.prototype.clear = function() {
- this._programLib.clear(), this.reset()
- }, t.prototype.reset = function() {
- this._viewPools.reset(), this._stageItemsPools.reset()
- }, t.prototype._requestView = function() {
- return this._viewPools.add()
- }, t.prototype._render = function(t, e) {
- var i = this._device;
- i.setFrameBuffer(t._framebuffer), i.setViewport(t._rect.x, t._rect.y, t._rect.w, t._rect.h);
- var n = {};
- t._clearFlags & o.default.CLEAR_COLOR && (n.color = [t._color.r, t._color.g, t._color.b, t._color.a]), t._clearFlags & o.default.CLEAR_DEPTH && (n.depth = t._depth), t._clearFlags & o.default.CLEAR_STENCIL && (n.stencil = t._stencil), i.clear(n), this._drawItemsPools.reset();
- for (var r = 0; r < e._models.length; ++r) {
- var s = e._models.data[r];
- if (0 != (s._cullingMask & t._cullingMask)) {
- var a = this._drawItemsPools.add();
- s.extractDrawItem(a)
- }
- }
- d.reset();
- for (var l = 0; l < t._stages.length; ++l) {
- var h = t._stages[l],
- c = this._stageItemsPools.add();
- c.reset();
- for (var u = 0; u < this._drawItemsPools.length; ++u) {
- var _ = this._drawItemsPools.data[u],
- f = _.effect.getTechnique(h);
- if (f) {
- var p = c.add();
- p.model = _.model, p.node = _.node, p.ia = _.ia, p.effect = _.effect, p.defines = _.defines, p.technique = f, p.sortKey = -1, p.uniforms = _.uniforms
- }
- }
- var m = d.add();
- m.stage = h, m.items = c
- }
- for (var y = 0; y < d.length; ++y) {
- var v = d.data[y];
- (0, this._stage2fn[v.stage])(t, v.items)
- }
- }, t.prototype._setProperty = function(t) {
- var e = this._device,
- i = t.value;
- if (void 0 === i && (i = t.val), void 0 === i && (i = this._type2defaultValue[t.type]), void 0 !== i)
- if (t.type === o.default.PARAM_TEXTURE_2D || t.type === o.default.PARAM_TEXTURE_CUBE)
- if (Array.isArray(i)) {
- if (i.length > t.count) return void console.error("Failed to set property [" + t.name + "] : The length of texture array [" + i.length + "] is bigger than [" + t.count + "].");
- for (var n = T.add(), r = 0; r < i.length; ++r) n[r] = this._allocTextureUnit();
- e.setTextureArray(t.name, i, n)
- } else e.setTexture(t.name, i, this._allocTextureUnit());
- else t.directly ? e.setUniformDirectly(t.name, i) : e.setUniform(t.name, i);
- else console.warn("Failed to set technique property " + t.name + ", value not found.")
- }, t.prototype._draw = function(t) {
- var e = this._device,
- i = this._programLib,
- n = t.node,
- r = t.ia,
- s = t.uniforms,
- o = t.technique,
- l = t.defines,
- h = t.effect;
- p.reset(), m.reset(), y.reset(), v.reset(), g.reset(), x.reset(), b.reset(), A.reset(), C.reset(), T.reset(), n.getWorldMatrix(f), e.setUniform("cc_matWorld", a.mat4.array(g.add(), f)), a.mat4.invert(f, f), a.mat4.transpose(f, f), e.setUniform("cc_matWorldIT", a.mat4.array(g.add(), f));
- for (var u = 0; u < s.length; u++) {
- var _ = s[u];
- for (var d in _) this._setProperty(_[d])
- }
- for (var S = 0; S < o._passes.length; ++S) {
- var w = o._passes[S],
- E = r.count;
- r._vertexBuffer && e.setVertexBuffer(0, r._vertexBuffer), r._indexBuffer && e.setIndexBuffer(r._indexBuffer), e.setPrimitiveType(r._primitiveType);
- var M = i.getProgram(w._programName, l, h._name);
- e.setProgram(M), e.setCullMode(w._cullMode), w._blend && (e.enableBlend(), e.setBlendFuncSep(w._blendSrc, w._blendDst, w._blendSrcAlpha, w._blendDstAlpha), e.setBlendEqSep(w._blendEq, w._blendAlphaEq), e.setBlendColor32(w._blendColor)), w._depthTest && (e.enableDepthTest(), e.setDepthFunc(w._depthFunc)), w._depthWrite && e.enableDepthWrite(), e.setStencilTest(w._stencilTest), w._stencilTest === c.default.STENCIL_ENABLE && (e.setStencilFuncFront(w._stencilFuncFront, w._stencilRefFront, w._stencilMaskFront), e.setStencilOpFront(w._stencilFailOpFront, w._stencilZFailOpFront, w._stencilZPassOpFront, w._stencilWriteMaskFront), e.setStencilFuncBack(w._stencilFuncBack, w._stencilRefBack, w._stencilMaskBack), e.setStencilOpBack(w._stencilFailOpBack, w._stencilZFailOpBack, w._stencilZPassOpBack, w._stencilWriteMaskBack)), e.draw(r._start, E), this._resetTextuerUnit()
- }
- }, t
- })());
- i.default = S, e.exports = i.default
- }), {
- "../../core/vmath": 326,
- "../enums": 355,
- "../gfx": 360,
- "../memop": 372,
- "./program-lib": 352,
- "./view": 354
- }],
- 349: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = l(t("../config")),
- r = l(t("../core/pass")),
- s = l(t("../core/technique")),
- o = t("../types"),
- a = l(t("../enums"));
- l(t("../gfx"));
- function l(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function h(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var c = (function() {
- function t(e, i) {
- var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
- r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
- s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : [];
- h(this, t), this._name = e, this._techniques = i, this._properties = n, this._defines = r, this._dependencies = s
- }
- return t.prototype.clear = function() {
- this._techniques.length = 0, this._properties = {}, this._defines = {}
- }, t.prototype.setCullMode = function(t) {
- for (var e = this._techniques[0].passes, i = 0; i < e.length; i++) e[i].setCullMode(t)
- }, t.prototype.setDepth = function(t, e, i) {
- for (var n = this._techniques[0].passes, r = 0; r < n.length; r++) n[r].setDepth(t, e, i)
- }, t.prototype.setBlend = function(t, e, i, n, r, s, o, a) {
- for (var l = this._techniques[0].passes, h = 0; h < l.length; h++) {
- l[h].setBlend(t, e, i, n, r, s, o, a)
- }
- }, t.prototype.setStencilEnabled = function(t) {
- for (var e = this._techniques[0].passes, i = 0; i < e.length; i++) e[i].setStencilEnabled(t)
- }, t.prototype.setStencil = function(t, e, i, n, r, s, o, a) {
- for (var l = this._techniques[0].passes, h = 0; h < l.length; ++h) {
- var c = l[h];
- c.setStencilFront(t, e, i, n, r, s, o, a), c.setStencilBack(t, e, i, n, r, s, o, a)
- }
- }, t.prototype.getTechnique = function(t) {
- var e = n.default.stageID(t);
- if (-1 === e) return null;
- for (var i = 0; i < this._techniques.length; ++i) {
- var r = this._techniques[i];
- if (r.stageIDs & e) return r
- }
- return null
- }, t.prototype.getProperty = function(t) {
- return this._properties[t] ? this._properties[t].value : (cc.warn(this._name + " : Failed to get property " + t + ", property not found."), null)
- }, t.prototype.setProperty = function(t, e) {
- var i = this._properties[t];
- if (i)
- if (Array.isArray(e)) {
- var n = i.value;
- if (n.length !== e.length) return void cc.warn(this._name + " : Failed to set property " + t + ", property length not correct.");
- for (var r = 0; r < e.length; r++) n[r] = e[r]
- } else i.type === a.default.PARAM_TEXTURE_2D ? i.value = e ? e.getImpl() : null : e.array ? e.array(i.value) : (e && "object" == typeof e && cc.warn("Set effect property " + this._name + " warning : should transform object to ArrayBuffer"), i.value = e);
- else cc.warn(this._name + " : Failed to set property " + t + ", property not found.")
- }, t.prototype.updateHash = function(t) {}, t.prototype.getDefine = function(t) {
- var e = this._defines[t];
- return void 0 === e && cc.warn(this._name + " : Failed to get define " + t + ", define not found."), e
- }, t.prototype.define = function(t, e) {
- void 0 !== this._defines[t] ? this._defines[t] = e : cc.warn(this._name + " : Failed to set define " + t + ", define not found.")
- }, t.prototype.extractProperties = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
- return Object.assign(t, this._properties), t
- }, t.prototype.extractDefines = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
- return Object.assign(t, this._defines), t
- }, t.prototype.extractDependencies = function() {
- for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = 0; e < this._dependencies.length; ++e) {
- var i = this._dependencies[e];
- t[i.define] = i.extension
- }
- return t
- }, t.prototype.clone = function() {
- var t = this.extractDefines({}),
- e = this.extractDependencies({}),
- i = {},
- n = this._properties;
- for (var r in n) {
- var s = n[r],
- o = i[r] = {},
- a = s.value;
- for (var l in Array.isArray(a) ? o.value = a.concat() : ArrayBuffer.isView(a) ? o.value = new a.__proto__.constructor(a) : o.value = a, s) "value" !== l && (o[l] = s[l])
- }
- for (var h = [], c = 0; c < this._techniques.length; c++) h.push(this._techniques[c].clone());
- return new cc.Effect(this._name, h, i, t, e)
- }, t
- })(),
- u = function(t) {
- var e = [],
- i = cc.renderer._forward._programLib;
- return t.techniques.forEach((function(t) {
- t.passes.forEach((function(t) {
- e.push(i.getTemplate(t.program))
- }))
- })), e
- };
- function _(t, e) {
- var i = {},
- n = {};
- t.techniques.forEach((function(t) {
- t.passes.forEach((function(t) {
- Object.assign(n, t.properties)
- }))
- }));
- var r = function(r) {
- for (var s = n[r], o = void 0, l = 0; l < e.length && !(o = e[l].uniforms.find((function(t) {
- return t.name === r
- }))); l++);
- if (!o) return cc.warn(t.name + " : illegal property: " + r + ", myabe defined a not used property"), "continue";
- i[r] = Object.assign({}, s), i[r].value = s.type === a.default.PARAM_TEXTURE_2D ? null : new Float32Array(s.value)
- };
- for (var s in n) r(s);
- return i
- }
- c.parseTechniques = function(t) {
- for (var e = t.techniques.length, i = new Array(e), n = 0; n < e; ++n) {
- var o = t.techniques[n];
- o.stages || (o.stages = ["opaque"]);
- for (var a = o.passes.length, l = new Array(a), h = 0; h < a; ++h) {
- var c = o.passes[h];
- l[h] = new r.default(c.program), c.rasterizerState && l[h].setCullMode(c.rasterizerState.cullMode);
- var u = c.blendState && c.blendState.targets[0];
- u && l[h].setBlend(u.blend, u.blendEq, u.blendSrc, u.blendDst, u.blendAlphaEq, u.blendSrcAlpha, u.blendDstAlpha, u.blendColor);
- var _ = c.depthStencilState;
- _ && (l[h].setDepth(_.depthTest, _.depthWrite, _.depthFunc), l[h].setStencilFront(_.stencilTest, _.stencilFuncFront, _.stencilRefFront, _.stencilMaskFront, _.stencilFailOpFront, _.stencilZFailOpFront, _.stencilZPassOpFront, _.stencilWriteMaskFront), l[h].setStencilBack(_.stencilTest, _.stencilFuncBack, _.stencilRefBack, _.stencilMaskBack, _.stencilFailOpBack, _.stencilZFailOpBack, _.stencilZPassOpBack, _.stencilWriteMaskBack))
- }
- i[n] = new s.default(o.stages, l, o.layer)
- }
- return i
- }, c.parseEffect = function(t) {
- var e = c.parseTechniques(t),
- i = u(t),
- n = _(t, i),
- r = {},
- s = {};
- i.forEach((function(t) {
- t.uniforms.forEach((function(t) {
- var e = t.name,
- i = r[e] = Object.assign({}, t);
- n[e] ? i.value = n[e].value : i.value = o.enums2default[t.type]
- })), t.defines.forEach((function(t) {
- s[t.name] = o.enums2default[t.type]
- }))
- }));
- var a = i.reduce((function(t, e) {
- return t.concat(e.extensions)
- }), []);
- return a = a.map((function(t) {
- return Object.assign({}, t)
- })), new cc.Effect(t.name, e, r, s, a, t)
- }, cc.Effect = c, i.default = c, e.exports = i.default
- }), {
- "../config": 347,
- "../core/pass": 351,
- "../core/technique": 353,
- "../enums": 355,
- "../gfx": 360,
- "../types": 384
- }],
- 350: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../gfx"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t(e, i) {
- var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : r.default.PT_TRIANGLES;
- s(this, t), this._vertexBuffer = e, this._indexBuffer = i, this._primitiveType = n, this._start = 0, this._count = -1
- }
- return n(t, [{
- key: "count",
- get: function() {
- return -1 !== this._count ? this._count : this._indexBuffer ? this._indexBuffer.count : this._vertexBuffer ? this._vertexBuffer.count : 0
- }
- }]), t
- })();
- i.default = o, e.exports = i.default
- }), {
- "../gfx": 360
- }],
- 351: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../gfx"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t(e) {
- r(this, t), this._programName = e, this._cullMode = n.default.CULL_BACK, this._blend = !1, this._blendEq = n.default.BLEND_FUNC_ADD, this._blendAlphaEq = n.default.BLEND_FUNC_ADD, this._blendSrc = n.default.BLEND_SRC_ALPHA, this._blendDst = n.default.BLEND_ONE_MINUS_SRC_ALPHA, this._blendSrcAlpha = n.default.BLEND_SRC_ALPHA, this._blendDstAlpha = n.default.BLEND_ONE_MINUS_SRC_ALPHA, this._blendColor = 4294967295, this._depthTest = !1, this._depthWrite = !1, this._depthFunc = n.default.DS_FUNC_LESS, this._stencilTest = n.default.STENCIL_INHERIT, this._stencilFuncFront = n.default.DS_FUNC_ALWAYS, this._stencilRefFront = 0, this._stencilMaskFront = 255, this._stencilFailOpFront = n.default.STENCIL_OP_KEEP, this._stencilZFailOpFront = n.default.STENCIL_OP_KEEP, this._stencilZPassOpFront = n.default.STENCIL_OP_KEEP, this._stencilWriteMaskFront = 255, this._stencilFuncBack = n.default.DS_FUNC_ALWAYS, this._stencilRefBack = 0, this._stencilMaskBack = 255, this._stencilFailOpBack = n.default.STENCIL_OP_KEEP, this._stencilZFailOpBack = n.default.STENCIL_OP_KEEP, this._stencilZPassOpBack = n.default.STENCIL_OP_KEEP, this._stencilWriteMaskBack = 255
- }
- return t.prototype.setCullMode = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.CULL_BACK;
- this._cullMode = t
- }, t.prototype.setBlend = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.BLEND_FUNC_ADD,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : n.default.BLEND_SRC_ALPHA,
- r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : n.default.BLEND_ONE_MINUS_SRC_ALPHA,
- s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.BLEND_FUNC_ADD,
- o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.BLEND_SRC_ALPHA,
- a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.BLEND_ONE_MINUS_SRC_ALPHA,
- l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 4294967295;
- this._blend = t, this._blendEq = e, this._blendSrc = i, this._blendDst = r, this._blendAlphaEq = s, this._blendSrcAlpha = o, this._blendDstAlpha = a, this._blendColor = l
- }, t.prototype.setDepth = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
- e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : n.default.DS_FUNC_LESS;
- this._depthTest = t, this._depthWrite = e, this._depthFunc = i
- }, t.prototype.setStencilFront = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.DS_FUNC_ALWAYS,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 255,
- s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.STENCIL_OP_KEEP,
- o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.STENCIL_OP_KEEP,
- a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.STENCIL_OP_KEEP,
- l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 255;
- this._stencilTest = t, this._stencilFuncFront = e, this._stencilRefFront = i, this._stencilMaskFront = r, this._stencilFailOpFront = s, this._stencilZFailOpFront = o, this._stencilZPassOpFront = a, this._stencilWriteMaskFront = l
- }, t.prototype.setStencilEnabled = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT;
- this._stencilTest = t
- }, t.prototype.setStencilBack = function() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT,
- e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.DS_FUNC_ALWAYS,
- i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
- r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 255,
- s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.STENCIL_OP_KEEP,
- o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.STENCIL_OP_KEEP,
- a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.STENCIL_OP_KEEP,
- l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 255;
- this._stencilTest = t, this._stencilFuncBack = e, this._stencilRefBack = i, this._stencilMaskBack = r, this._stencilFailOpBack = s, this._stencilZFailOpBack = o, this._stencilZPassOpBack = a, this._stencilWriteMaskBack = l
- }, t.prototype.clone = function() {
- var e = new t(this._programName);
- return Object.assign(e, this), e
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "../gfx": 360
- }],
- 352: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../gfx"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = 0;
- function o(t) {
- for (var e = [], i = {}, n = t.length - 1; n >= 0; n--) {
- var r = t[n];
- for (var s in r) {
- var o = r[s];
- void 0 !== o && (void 0 === i[s] && ("number" != typeof o && (o = o ? 1 : 0), i[s] = o, e.push("#define " + s + " " + o)))
- }
- }
- return e.join("\n") + "\n"
- }
- function a(t, e) {
- for (var i = {}, n = t, r = e.length - 1; r >= 0; r--) {
- var s = e[r];
- for (var o in s) {
- var a = s[o];
- void 0 !== a && (void 0 === i[o] && Number.isInteger(a) && (i[o] = a))
- }
- }
- for (var l in i) {
- var h = new RegExp(l, "g");
- n = n.replace(h, i[l])
- }
- return n
- }
- function l(t) {
- return t.replace(/#pragma for (\w+) in range\(\s*(\d+)\s*,\s*(\d+)\s*\)([\s\S]+?)#pragma endFor/g, (function(t, e, i, n, r) {
- var s = "",
- o = parseInt(i),
- a = parseInt(n);
- (o.isNaN || a.isNaN) && console.error("Unroll For Loops Error: begin and end of range must be an int num.");
- for (var l = o; l < a; ++l) s += r.replace(new RegExp("{" + e + "}", "g"), l);
- return s
- }))
- }
- function h(t) {
- return t.replace(/\bhighp\b/g, "mediump")
- }
- var c = (function() {
- function t(e) {
- r(this, t), this._device = e, this._templates = {}, this._cache = {}, this._checkPrecision()
- }
- return t.prototype.clear = function() {
- this._templates = {}, this._cache = {}
- }, t.prototype.define = function(t) {
- var e = t.name,
- i = t.defines,
- n = t.glsl1 || t,
- r = n.vert,
- o = n.frag;
- if (!this._templates[e]) {
- for (var a = ++s, l = 0, h = 0; h < i.length; ++h) {
- var c = i[h],
- u = 1;
- if ("number" === c.type) {
- var _ = c.range || [];
- c.min = _[0] || 0, c.max = _[1] || 4, u = Math.ceil(Math.log2(c.max - c.min)), c._map = function(t) {
- return t - this.min << this._offset
- }.bind(c)
- } else c._map = function(t) {
- return t ? 1 << this._offset : 0
- }.bind(c);
- l += u, c._offset = l
- }
- var f = t.uniforms || [];
- if (t.samplers)
- for (var d = 0; d < t.samplers.length; d++) f.push(t.samplers[d]);
- if (t.blocks)
- for (var p = 0; p < t.blocks.length; p++)
- for (var m = t.blocks[p].defines, y = t.blocks[p].members, v = 0; v < y.length; v++) f.push({
- defines: m,
- name: y[v].name,
- type: y[v].type
- });
- this._templates[e] = {
- id: a,
- name: e,
- vert: r,
- frag: o,
- defines: i,
- attributes: t.attributes,
- uniforms: f,
- extensions: t.extensions
- }
- }
- }, t.prototype.getTemplate = function(t) {
- return this._templates[t]
- }, t.prototype.hasProgram = function(t) {
- return void 0 !== this._templates[t]
- }, t.prototype.getKey = function(t, e) {
- for (var i = this._templates[t], n = 0, r = 0; r < i.defines.length; ++r) {
- var s = i.defines[r],
- o = this._getValueFromDefineList(s.name, e);
- void 0 !== o && (n |= s._map(o))
- }
- return i.id + ":" + n
- }, t.prototype.getProgram = function(t, e, i) {
- var r = this.getKey(t, e),
- s = this._cache[r];
- if (s) return s;
- var c = this._templates[t],
- u = o(e),
- _ = a(c.vert, e);
- _ = u + l(_), this._highpSupported || (_ = h(_));
- var f = a(c.frag, e);
- f = u + l(f), this._highpSupported || (f = h(f));
- var d = (s = new n.default.Program(this._device, {
- vert: _,
- frag: f
- })).link();
- if (d) {
- var p = _.split("\n"),
- m = f.split("\n"),
- y = Object.keys(e).length;
- d.forEach((function(t) {
- var e = t.line - 1,
- n = t.line - y,
- r = ("vs" === t.type ? p : m)[e],
- s = t.info || "Failed to compile " + t.type + " " + t.fileID + " (ln " + n + "): \n " + t.message + ": \n " + r;
- cc.error(i + " : " + s)
- }))
- }
- return this._cache[r] = s, s
- }, t.prototype._getValueFromDefineList = function(t, e) {
- for (var i = void 0, n = e.length - 1; n >= 0; n--)
- if (void 0 !== (i = e[n][t])) return i
- }, t.prototype._checkPrecision = function() {
- var t = this._device._gl,
- e = !1;
- if (t.getShaderPrecisionFormat) {
- var i = t.getShaderPrecisionFormat(t.VERTEX_SHADER, t.HIGH_FLOAT),
- n = t.getShaderPrecisionFormat(t.FRAGMENT_SHADER, t.HIGH_FLOAT);
- e = i && i.precision > 0 && n && n.precision > 0
- }
- e || cc.warnID(9102), this._highpSupported = e
- }, t
- })();
- i.default = c, e.exports = i.default
- }), {
- "../gfx": 360
- }],
- 353: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../config"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = 0,
- a = (function() {
- function t(e, i) {
- var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
- s(this, t), this._id = o++, this._stages = e, this._stageIDs = r.default.stageIDs(e), this._passes = i, this._layer = n
- }
- return t.prototype.setStages = function(t) {
- this._stageIDs = r.default.stageIDs(t)
- }, t.prototype.clone = function() {
- for (var e = [], i = 0; i < this._passes.length; i++) e.push(this._passes[i].clone());
- return new t(this._stages, e, this._layer)
- }, n(t, [{
- key: "passes",
- get: function() {
- return this._passes
- }
- }, {
- key: "stageIDs",
- get: function() {
- return this._stageIDs
- }
- }]), t
- })();
- i.default = a, e.exports = i.default
- }), {
- "../config": 347
- }],
- 354: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("../../core/vmath"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../enums"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = n.mat4.create(),
- a = 0,
- l = (function() {
- function t() {
- s(this, t), this._id = a++, this._priority = 0, this._rect = {
- x: 0,
- y: 0,
- w: 1,
- h: 1
- }, this._color = n.color4.create(.3, .3, .3, 1), this._depth = 1, this._stencil = 0, this._clearFlags = r.default.CLEAR_COLOR | r.default.CLEAR_DEPTH, this._clearModel = null, this._matView = n.mat4.create(), this._matProj = n.mat4.create(), this._matViewProj = n.mat4.create(), this._matInvViewProj = n.mat4.create(), this._stages = [], this._cullingByID = !1, this._framebuffer = null, this._shadowLight = null, this._cullingMask = 4294967295
- }
- return t.prototype.getForward = function(t) {
- var e = this._matView.m;
- return n.vec3.set(t, -e[2], -e[6], -e[10])
- }, t.prototype.getPosition = function(t) {
- return n.mat4.invert(o, this._matView), n.mat4.getTranslation(t, o)
- }, t
- })();
- i.default = l, e.exports = i.default
- }), {
- "../../core/vmath": 326,
- "../enums": 355
- }],
- 355: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./build/mappings");
- i.default = {
- PROJ_PERSPECTIVE: 0,
- PROJ_ORTHO: 1,
- LIGHT_DIRECTIONAL: 0,
- LIGHT_POINT: 1,
- LIGHT_SPOT: 2,
- LIGHT_AMBIENT: 3,
- SHADOW_NONE: 0,
- SHADOW_HARD: 1,
- SHADOW_SOFT: 2,
- PARAM_INT: n.typeMap.int,
- PARAM_INT2: n.typeMap.ivec2,
- PARAM_INT3: n.typeMap.ivec3,
- PARAM_INT4: n.typeMap.ivec4,
- PARAM_FLOAT: n.typeMap.float,
- PARAM_FLOAT2: n.typeMap.vec2,
- PARAM_FLOAT3: n.typeMap.vec3,
- PARAM_FLOAT4: n.typeMap.vec4,
- PARAM_MAT2: n.typeMap.mat2,
- PARAM_MAT3: n.typeMap.mat3,
- PARAM_MAT4: n.typeMap.mat4,
- PARAM_TEXTURE_2D: n.typeMap.sampler2D,
- PARAM_TEXTURE_CUBE: n.typeMap.samplerCube,
- CLEAR_COLOR: 1,
- CLEAR_DEPTH: 2,
- CLEAR_STENCIL: 4,
- CLEAR_SKYBOX: 8,
- BUFFER_VIEW_INT8: 0,
- BUFFER_VIEW_UINT8: 1,
- BUFFER_VIEW_INT16: 2,
- BUFFER_VIEW_UINT16: 3,
- BUFFER_VIEW_INT32: 4,
- BUFFER_VIEW_UINT32: 5,
- BUFFER_VIEW_FLOAT32: 6
- }, e.exports = i.default
- }), {
- "./build/mappings": 346
- }],
- 356: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n, r, s = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- o = c(t("./state")),
- a = t("./enums"),
- l = c(t("./texture-2d")),
- h = c(t("./texture-cube"));
- function c(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function u(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var _ = ((n = {})[5124] = function(t, e, i) {
- t.uniform1i(e, i)
- }, n[5126] = function(t, e, i) {
- t.uniform1f(e, i)
- }, n[35664] = function(t, e, i) {
- t.uniform2fv(e, i)
- }, n[35665] = function(t, e, i) {
- t.uniform3fv(e, i)
- }, n[35666] = function(t, e, i) {
- t.uniform4fv(e, i)
- }, n[35667] = function(t, e, i) {
- t.uniform2iv(e, i)
- }, n[35668] = function(t, e, i) {
- t.uniform3iv(e, i)
- }, n[35669] = function(t, e, i) {
- t.uniform4iv(e, i)
- }, n[35670] = function(t, e, i) {
- t.uniform1i(e, i)
- }, n[35671] = function(t, e, i) {
- t.uniform2iv(e, i)
- }, n[35672] = function(t, e, i) {
- t.uniform3iv(e, i)
- }, n[35673] = function(t, e, i) {
- t.uniform4iv(e, i)
- }, n[35674] = function(t, e, i) {
- t.uniformMatrix2fv(e, !1, i)
- }, n[35675] = function(t, e, i) {
- t.uniformMatrix3fv(e, !1, i)
- }, n[35676] = function(t, e, i) {
- t.uniformMatrix4fv(e, !1, i)
- }, n[35678] = function(t, e, i) {
- t.uniform1i(e, i)
- }, n[35680] = function(t, e, i) {
- t.uniform1i(e, i)
- }, n),
- f = ((r = {})[5124] = function(t, e, i) {
- t.uniform1iv(e, i)
- }, r[5126] = function(t, e, i) {
- t.uniform1fv(e, i)
- }, r[35664] = function(t, e, i) {
- t.uniform2fv(e, i)
- }, r[35665] = function(t, e, i) {
- t.uniform3fv(e, i)
- }, r[35666] = function(t, e, i) {
- t.uniform4fv(e, i)
- }, r[35667] = function(t, e, i) {
- t.uniform2iv(e, i)
- }, r[35668] = function(t, e, i) {
- t.uniform3iv(e, i)
- }, r[35669] = function(t, e, i) {
- t.uniform4iv(e, i)
- }, r[35670] = function(t, e, i) {
- t.uniform1iv(e, i)
- }, r[35671] = function(t, e, i) {
- t.uniform2iv(e, i)
- }, r[35672] = function(t, e, i) {
- t.uniform3iv(e, i)
- }, r[35673] = function(t, e, i) {
- t.uniform4iv(e, i)
- }, r[35674] = function(t, e, i) {
- t.uniformMatrix2fv(e, !1, i)
- }, r[35675] = function(t, e, i) {
- t.uniformMatrix3fv(e, !1, i)
- }, r[35676] = function(t, e, i) {
- t.uniformMatrix4fv(e, !1, i)
- }, r[35678] = function(t, e, i) {
- t.uniform1iv(e, i)
- }, r[35680] = function(t, e, i) {
- t.uniform1iv(e, i)
- }, r);
- function d(t, e, i) {
- if (e.blend !== i.blend) return i.blend ? (t.enable(t.BLEND), i.blendSrc !== a.enums.BLEND_CONSTANT_COLOR && i.blendSrc !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR || t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), void(i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), t.blendEquation(i.blendEq)))) : void t.disable(t.BLEND);
- !1 !== i.blend && (e.blendColor !== i.blendColor && t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), e.blendSep === i.blendSep ? i.blendSep ? (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst && e.blendSrcAlpha === i.blendSrcAlpha && e.blendDstAlpha === i.blendDstAlpha || t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), e.blendEq === i.blendEq && e.blendAlphaEq === i.blendAlphaEq || t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst || t.blendFunc(i.blendSrc, i.blendDst), e.blendEq !== i.blendEq && t.blendEquation(i.blendEq)) : i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), t.blendEquation(i.blendEq)))
- }
- function p(t, e, i) {
- if (e.depthTest !== i.depthTest) return i.depthTest ? (t.enable(t.DEPTH_TEST), t.depthFunc(i.depthFunc), void t.depthMask(i.depthWrite)) : void t.disable(t.DEPTH_TEST);
- e.depthWrite !== i.depthWrite && t.depthMask(i.depthWrite), !1 !== i.depthTest ? e.depthFunc !== i.depthFunc && t.depthFunc(i.depthFunc) : i.depthWrite && (i.depthTest = !0, i.depthFunc = a.enums.DS_FUNC_ALWAYS, t.enable(t.DEPTH_TEST), t.depthFunc(i.depthFunc))
- }
- function m(t, e, i) {
- if (i.stencilTest !== a.enums.STENCIL_INHERIT) return i.stencilTest !== e.stencilTest ? i.stencilTest === a.enums.STENCIL_DISABLE ? void t.disable(t.STENCIL_TEST) : (t.enable(t.STENCIL_TEST), void(i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMask(i.stencilWriteMaskFront), t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)))) : void(i.stencilTest !== a.enums.STENCIL_DISABLE && (e.stencilSep === i.stencilSep ? i.stencilSep ? (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), e.stencilFuncBack === i.stencilFuncBack && e.stencilRefBack === i.stencilRefBack && e.stencilMaskBack === i.stencilMaskBack || t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), e.stencilWriteMaskBack !== i.stencilWriteMaskBack && t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), e.stencilFailOpBack === i.stencilFailOpBack && e.stencilZFailOpBack === i.stencilZFailOpBack && e.stencilZPassOpBack === i.stencilZPassOpBack || t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMask(i.stencilWriteMaskFront), e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)) : i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMask(i.stencilWriteMaskFront), t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront))))
- }
- function y(t, e, i) {
- e.cullMode !== i.cullMode && (i.cullMode !== a.enums.CULL_NONE ? (t.enable(t.CULL_FACE), t.cullFace(i.cullMode)) : t.disable(t.CULL_FACE))
- }
- function v(t, e, i, n) {
- var r = !1;
- if (-1 !== n.maxStream) {
- if (i.maxStream !== n.maxStream) r = !0;
- else if (i.program !== n.program) r = !0;
- else
- for (var s = 0; s < n.maxStream + 1; ++s)
- if (i.vertexBuffers[s] !== n.vertexBuffers[s] || i.vertexBufferOffsets[s] !== n.vertexBufferOffsets[s]) {
- r = !0;
- break
- } if (r) {
- for (var o = 0; o < t._caps.maxVertexAttribs; ++o) t._newAttributes[o] = 0;
- for (var a = 0; a < n.maxStream + 1; ++a) {
- var l = n.vertexBuffers[a],
- h = n.vertexBufferOffsets[a];
- if (l && -1 !== l._glID) {
- e.bindBuffer(e.ARRAY_BUFFER, l._glID);
- for (var c = 0; c < n.program._attributes.length; ++c) {
- var u = n.program._attributes[c],
- _ = l._format.element(u.name);
- _ ? (0 === t._enabledAttributes[u.location] && (e.enableVertexAttribArray(u.location), t._enabledAttributes[u.location] = 1), t._newAttributes[u.location] = 1, e.vertexAttribPointer(u.location, _.num, _.type, _.normalize, _.stride, _.offset + h * _.stride)) : console.warn("Can not find vertex attribute: " + u.name)
- }
- }
- }
- for (var f = 0; f < t._caps.maxVertexAttribs; ++f) t._enabledAttributes[f] !== t._newAttributes[f] && (e.disableVertexAttribArray(f), t._enabledAttributes[f] = 0)
- }
- }
- }
- function g(t, e, i) {
- for (var n = 0; n < i.maxTextureSlot + 1; ++n)
- if (e.textureUnits[n] !== i.textureUnits[n]) {
- var r = i.textureUnits[n];
- r && -1 !== r._glID && (t.activeTexture(t.TEXTURE0 + n), t.bindTexture(r._target, r._glID))
- }
- }
- function x(t, e, i) {
- var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
- i instanceof l.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_2D, i._glID, 0) : i instanceof h.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_CUBE_MAP_POSITIVE_X + n, i._glID, 0) : t.framebufferRenderbuffer(t.FRAMEBUFFER, e, t.RENDERBUFFER, i._glID)
- }
- var b = (function() {
- function t(e, i) {
- u(this, t);
- var n = void 0;
- void 0 === (i = i || {}).alpha && (i.alpha = !1), void 0 === i.stencil && (i.stencil = !0), void 0 === i.depth && (i.depth = !0), void 0 === i.antialias && (i.antialias = !1), void 0 === i.preserveDrawingBuffer && (i.preserveDrawingBuffer = !1);
- try {
- n = e.getContext("webgl", i) || e.getContext("experimental-webgl", i) || e.getContext("webkit-3d", i) || e.getContext("moz-webgl", i)
- } catch (t) {
- return void console.error(t)
- }
- n || console.error("This device does not support webgl"), this._gl = n, this._extensions = {}, this._caps = {}, this._stats = {
- texture: 0,
- vb: 0,
- ib: 0,
- drawcalls: 0
- }, this._initExtensions(["EXT_texture_filter_anisotropic", "EXT_shader_texture_lod", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_object", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_depth_texture", "WEBGL_draw_buffers"]), this._initCaps(), this._initStates(), o.default.initDefault(this), this._current = new o.default(this), this._next = new o.default(this), this._uniforms = {}, this._vx = this._vy = this._vw = this._vh = 0, this._sx = this._sy = this._sw = this._sh = 0, this._framebuffer = null, this._enabledAttributes = new Array(this._caps.maxVertexAttribs), this._newAttributes = new Array(this._caps.maxVertexAttribs);
- for (var r = 0; r < this._caps.maxVertexAttribs; ++r) this._enabledAttributes[r] = 0, this._newAttributes[r] = 0
- }
- return s(t, [{
- key: "caps",
- get: function() {
- return this._caps
- }
- }]), t.prototype._initExtensions = function(t) {
- for (var e = this._gl, i = 0; i < t.length; ++i)
- for (var n = t[i], r = ["", "WEBKIT_", "MOZ_"], s = 0; s < r.length; s++) try {
- var o = e.getExtension(r[s] + n);
- if (o) {
- this._extensions[n] = o;
- break
- }
- } catch (t) {
- console.error(t)
- }
- }, t.prototype._initCaps = function() {
- var t = this._gl,
- e = this.ext("WEBGL_draw_buffers");
- this._caps.maxVertexStreams = 4, this._caps.maxVertexTextures = t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS), this._caps.maxFragUniforms = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS), this._caps.maxTextureUnits = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS), this._caps.maxVertexAttribs = t.getParameter(t.MAX_VERTEX_ATTRIBS), this._caps.maxTextureSize = t.getParameter(t.MAX_TEXTURE_SIZE), this._caps.maxDrawBuffers = e ? t.getParameter(e.MAX_DRAW_BUFFERS_WEBGL) : 1, this._caps.maxColorAttachments = e ? t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL) : 1
- }, t.prototype._initStates = function() {
- var t = this._gl;
- t.disable(t.BLEND), t.blendFunc(t.ONE, t.ZERO), t.blendEquation(t.FUNC_ADD), t.blendColor(1, 1, 1, 1), t.colorMask(!0, !0, !0, !0), t.enable(t.CULL_FACE), t.cullFace(t.BACK), t.disable(t.DEPTH_TEST), t.depthFunc(t.LESS), t.depthMask(!1), t.disable(t.POLYGON_OFFSET_FILL), t.depthRange(0, 1), t.disable(t.STENCIL_TEST), t.stencilFunc(t.ALWAYS, 0, 255), t.stencilMask(255), t.stencilOp(t.KEEP, t.KEEP, t.KEEP), t.clearDepth(1), t.clearColor(0, 0, 0, 0), t.clearStencil(0), t.disable(t.SCISSOR_TEST)
- }, t.prototype._restoreTexture = function(t) {
- var e = this._gl,
- i = this._current.textureUnits[t];
- i && -1 !== i._glID ? e.bindTexture(i._target, i._glID) : e.bindTexture(e.TEXTURE_2D, null)
- }, t.prototype._restoreIndexBuffer = function() {
- var t = this._gl,
- e = this._current.indexBuffer;
- e && -1 !== e._glID ? t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e._glID) : t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null)
- }, t.prototype.ext = function(t) {
- return this._extensions[t]
- }, t.prototype.allowFloatTexture = function() {
- return null != this.ext("OES_texture_float")
- }, t.prototype.setFrameBuffer = function(t) {
- if (this._framebuffer !== t) {
- this._framebuffer = t;
- var e = this._gl;
- if (null !== t) {
- e.bindFramebuffer(e.FRAMEBUFFER, t._glID);
- for (var i = t._colors.length, n = 0; n < i; ++n) {
- var r = t._colors[n];
- x(e, e.COLOR_ATTACHMENT0 + n, r)
- }
- for (var s = i; s < this._caps.maxColorAttachments; ++s) e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + s, e.TEXTURE_2D, null, 0);
- t._depth && x(e, e.DEPTH_ATTACHMENT, t._depth), t._stencil && x(e, e.STENCIL_ATTACHMENT, t._stencil), t._depthStencil && x(e, e.DEPTH_STENCIL_ATTACHMENT, t._depthStencil)
- } else e.bindFramebuffer(e.FRAMEBUFFER, null)
- }
- }, t.prototype.setViewport = function(t, e, i, n) {
- this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._gl.viewport(t, e, i, n), this._vx = t, this._vy = e, this._vw = i, this._vh = n)
- }, t.prototype.setScissor = function(t, e, i, n) {
- this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._gl.scissor(t, e, i, n), this._sx = t, this._sy = e, this._sw = i, this._sh = n)
- }, t.prototype.clear = function(t) {
- if (void 0 !== t.color || void 0 !== t.depth || void 0 !== t.stencil) {
- var e = this._gl,
- i = 0;
- void 0 !== t.color && (i |= e.COLOR_BUFFER_BIT, e.clearColor(t.color[0], t.color[1], t.color[2], t.color[3])), void 0 !== t.depth && (i |= e.DEPTH_BUFFER_BIT, e.clearDepth(t.depth), e.enable(e.DEPTH_TEST), e.depthMask(!0), e.depthFunc(e.ALWAYS)), void 0 !== t.stencil && (i |= e.STENCIL_BUFFER_BIT, e.clearStencil(t.stencil)), e.clear(i), void 0 !== t.depth && (!1 === this._current.depthTest ? e.disable(e.DEPTH_TEST) : (!1 === this._current.depthWrite && e.depthMask(!1), this._current.depthFunc !== a.enums.DS_FUNC_ALWAYS && e.depthFunc(this._current.depthFunc)))
- }
- }, t.prototype.enableBlend = function() {
- this._next.blend = !0
- }, t.prototype.enableDepthTest = function() {
- this._next.depthTest = !0
- }, t.prototype.enableDepthWrite = function() {
- this._next.depthWrite = !0
- }, t.prototype.setStencilTest = function(t) {
- this._next.stencilTest = t
- }, t.prototype.setStencilFunc = function(t, e, i) {
- this._next.stencilSep = !1, this._next.stencilFuncFront = this._next.stencilFuncBack = t, this._next.stencilRefFront = this._next.stencilRefBack = e, this._next.stencilMaskFront = this._next.stencilMaskBack = i
- }, t.prototype.setStencilFuncFront = function(t, e, i) {
- this._next.stencilSep = !0, this._next.stencilFuncFront = t, this._next.stencilRefFront = e, this._next.stencilMaskFront = i
- }, t.prototype.setStencilFuncBack = function(t, e, i) {
- this._next.stencilSep = !0, this._next.stencilFuncBack = t, this._next.stencilRefBack = e, this._next.stencilMaskBack = i
- }, t.prototype.setStencilOp = function(t, e, i, n) {
- this._next.stencilFailOpFront = this._next.stencilFailOpBack = t, this._next.stencilZFailOpFront = this._next.stencilZFailOpBack = e, this._next.stencilZPassOpFront = this._next.stencilZPassOpBack = i, this._next.stencilWriteMaskFront = this._next.stencilWriteMaskBack = n
- }, t.prototype.setStencilOpFront = function(t, e, i, n) {
- this._next.stencilSep = !0, this._next.stencilFailOpFront = t, this._next.stencilZFailOpFront = e, this._next.stencilZPassOpFront = i, this._next.stencilWriteMaskFront = n
- }, t.prototype.setStencilOpBack = function(t, e, i, n) {
- this._next.stencilSep = !0, this._next.stencilFailOpBack = t, this._next.stencilZFailOpBack = e, this._next.stencilZPassOpBack = i, this._next.stencilWriteMaskBack = n
- }, t.prototype.setDepthFunc = function(t) {
- this._next.depthFunc = t
- }, t.prototype.setBlendColor32 = function(t) {
- this._next.blendColor = t
- }, t.prototype.setBlendColor = function(t, e, i, n) {
- this._next.blendColor = (255 * t << 24 | 255 * e << 16 | 255 * i << 8 | 255 * n) >>> 0
- }, t.prototype.setBlendFunc = function(t, e) {
- this._next.blendSep = !1, this._next.blendSrc = t, this._next.blendDst = e
- }, t.prototype.setBlendFuncSep = function(t, e, i, n) {
- this._next.blendSep = !0, this._next.blendSrc = t, this._next.blendDst = e, this._next.blendSrcAlpha = i, this._next.blendDstAlpha = n
- }, t.prototype.setBlendEq = function(t) {
- this._next.blendSep = !1, this._next.blendEq = t
- }, t.prototype.setBlendEqSep = function(t, e) {
- this._next.blendSep = !0, this._next.blendEq = t, this._next.blendAlphaEq = e
- }, t.prototype.setCullMode = function(t) {
- this._next.cullMode = t
- }, t.prototype.setVertexBuffer = function(t, e) {
- var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
- this._next.vertexBuffers[t] = e, this._next.vertexBufferOffsets[t] = i, this._next.maxStream < t && (this._next.maxStream = t)
- }, t.prototype.setIndexBuffer = function(t) {
- this._next.indexBuffer = t
- }, t.prototype.setProgram = function(t) {
- this._next.program = t
- }, t.prototype.setTexture = function(t, e, i) {
- i >= this._caps.maxTextureUnits ? console.warn("Can not set texture " + t + " at stage " + i + ", max texture exceed: " + this._caps.maxTextureUnits) : (this._next.textureUnits[i] = e, this.setUniform(t, i), this._next.maxTextureSlot < i && (this._next.maxTextureSlot = i))
- }, t.prototype.setTextureArray = function(t, e, i) {
- var n = e.length;
- if (n >= this._caps.maxTextureUnits) console.warn("Can not set " + n + " textures for " + t + ", max texture exceed: " + this._caps.maxTextureUnits);
- else {
- for (var r = 0; r < n; ++r) {
- var s = i[r];
- this._next.textureUnits[s] = e[r]
- }
- this.setUniform(t, i)
- }
- }, t.prototype.setUniform = function(t, e) {
- var i = this._uniforms[t],
- n = !1,
- r = !1,
- s = !1,
- o = !1;
- do {
- if (!i) break;
- if (s = Array.isArray(e) || e instanceof Float32Array, o = e instanceof Int32Array, r = s || o, i.isArray !== r) break;
- if (i.isArray && i.value.length !== e.length) break;
- n = !0
- } while (0);
- if (n) {
- var a = i.value,
- l = !1;
- if (i.isArray)
- for (var h = 0, c = a.length; h < c; h++) a[h] !== e[h] && (l = !0, a[h] = e[h]);
- else a !== e && (l = !0, i.value = e);
- l && (i.dirty = !0)
- } else {
- var u = e;
- s ? u = new Float32Array(e) : o && (u = new Int32Array(e)), i = {
- dirty: !0,
- value: u,
- isArray: r
- }
- }
- this._uniforms[t] = i
- }, t.prototype.setUniformDirectly = function(t, e) {
- var i = this._uniforms[t];
- i || (this._uniforms[t] = i = {}), i.dirty = !0, i.value = e
- }, t.prototype.setPrimitiveType = function(t) {
- this._next.primitiveType = t
- }, t.prototype.resetDrawCalls = function() {
- this._stats.drawcalls = 0
- }, t.prototype.getDrawCalls = function() {
- return this._stats.drawcalls
- }, t.prototype.draw = function(t, e) {
- var i = this._gl,
- n = this._current,
- r = this._next;
- d(i, n, r), p(i, n, r), m(i, n, r), y(i, n, r), v(this, i, n, r), n.indexBuffer !== r.indexBuffer && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, r.indexBuffer && -1 !== r.indexBuffer._glID ? r.indexBuffer._glID : null);
- var s = !1;
- n.program !== r.program && (r.program._linked ? i.useProgram(r.program._glID) : console.warn("Failed to use program: has not linked yet."), s = !0), g(i, n, r);
- for (var o = 0; o < r.program._uniforms.length; ++o) {
- var a = r.program._uniforms[o],
- l = this._uniforms[a.name];
- if (l && (s || l.dirty)) {
- l.dirty = !1;
- var h = void 0 === a.size ? _[a.type] : f[a.type];
- h ? h(i, a.location, l.value) : console.warn("Can not find commit function for uniform " + a.name)
- }
- }
- e && (r.indexBuffer ? i.drawElements(this._next.primitiveType, e, r.indexBuffer._format, t * r.indexBuffer._bytesPerIndex) : i.drawArrays(this._next.primitiveType, t, e)), this._stats.drawcalls++, n.set(r), r.reset()
- }, t
- })();
- i.default = b, e.exports = i.default
- }), {
- "./enums": 357,
- "./state": 364,
- "./texture-2d": 365,
- "./texture-cube": 366
- }],
- 357: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.attrTypeBytes = function(t) {
- if (t === s.ATTR_TYPE_INT8) return 1;
- if (t === s.ATTR_TYPE_UINT8) return 1;
- if (t === s.ATTR_TYPE_INT16) return 2;
- if (t === s.ATTR_TYPE_UINT16) return 2;
- if (t === s.ATTR_TYPE_INT32) return 4;
- if (t === s.ATTR_TYPE_UINT32) return 4;
- if (t === s.ATTR_TYPE_FLOAT32) return 4;
- return console.warn("Unknown ATTR_TYPE: " + t), 0
- }, i.glFilter = function(t, e) {
- var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1,
- r = n[e][i + 1];
- if (void 0 === r) return console.warn("Unknown FILTER: " + e), -1 === i ? t.LINEAR : t.LINEAR_MIPMAP_LINEAR;
- return r
- }, i.glTextureFmt = function(t) {
- var e = r[t];
- if (void 0 === e) return console.warn("Unknown TEXTURE_FMT: " + t), r[s.TEXTURE_FMT_RGBA8];
- return e
- };
- var n = [
- [9728, 9984, 9986],
- [9729, 9985, 9987]
- ],
- r = [{
- format: 6407,
- internalFormat: 33776,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 33777,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 33778,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 33779,
- pixelType: null
- }, {
- format: 6407,
- internalFormat: 36196,
- pixelType: null
- }, {
- format: 6407,
- internalFormat: 35841,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 35843,
- pixelType: null
- }, {
- format: 6407,
- internalFormat: 35840,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 35842,
- pixelType: null
- }, {
- format: 6406,
- internalFormat: 6406,
- pixelType: 5121
- }, {
- format: 6409,
- internalFormat: 6409,
- pixelType: 5121
- }, {
- format: 6410,
- internalFormat: 6410,
- pixelType: 5121
- }, {
- format: 6407,
- internalFormat: 6407,
- pixelType: 33635
- }, {
- format: 6408,
- internalFormat: 6408,
- pixelType: 32820
- }, {
- format: 6408,
- internalFormat: 6408,
- pixelType: 32819
- }, {
- format: 6407,
- internalFormat: 6407,
- pixelType: 5121
- }, {
- format: 6408,
- internalFormat: 6408,
- pixelType: 5121
- }, {
- format: 6407,
- internalFormat: 6407,
- pixelType: 36193
- }, {
- format: 6408,
- internalFormat: 6408,
- pixelType: 36193
- }, {
- format: 6407,
- internalFormat: 6407,
- pixelType: 5126
- }, {
- format: 6408,
- internalFormat: 6408,
- pixelType: 5126
- }, {
- format: null,
- internalFormat: null,
- pixelType: null
- }, {
- format: null,
- internalFormat: null,
- pixelType: null
- }, {
- format: null,
- internalFormat: null,
- pixelType: null
- }, {
- format: null,
- internalFormat: null,
- pixelType: null
- }, {
- format: 6402,
- internalFormat: 6402,
- pixelType: 5123
- }, {
- format: 6402,
- internalFormat: 6402,
- pixelType: 5125
- }, {
- format: 6402,
- internalFormat: 6402,
- pixelType: 5125
- }, {
- format: 6407,
- internalFormat: 37492,
- pixelType: null
- }, {
- format: 6408,
- internalFormat: 37496,
- pixelType: null
- }],
- s = i.enums = {
- USAGE_STATIC: 35044,
- USAGE_DYNAMIC: 35048,
- USAGE_STREAM: 35040,
- INDEX_FMT_UINT8: 5121,
- INDEX_FMT_UINT16: 5123,
- INDEX_FMT_UINT32: 5125,
- ATTR_POSITION: "a_position",
- ATTR_NORMAL: "a_normal",
- ATTR_TANGENT: "a_tangent",
- ATTR_BITANGENT: "a_bitangent",
- ATTR_WEIGHTS: "a_weights",
- ATTR_JOINTS: "a_joints",
- ATTR_COLOR: "a_color",
- ATTR_COLOR0: "a_color0",
- ATTR_COLOR1: "a_color1",
- ATTR_UV: "a_uv",
- ATTR_UV0: "a_uv0",
- ATTR_UV1: "a_uv1",
- ATTR_UV2: "a_uv2",
- ATTR_UV3: "a_uv3",
- ATTR_UV4: "a_uv4",
- ATTR_UV5: "a_uv5",
- ATTR_UV6: "a_uv6",
- ATTR_UV7: "a_uv7",
- ATTR_TYPE_INT8: 5120,
- ATTR_TYPE_UINT8: 5121,
- ATTR_TYPE_INT16: 5122,
- ATTR_TYPE_UINT16: 5123,
- ATTR_TYPE_INT32: 5124,
- ATTR_TYPE_UINT32: 5125,
- ATTR_TYPE_FLOAT32: 5126,
- FILTER_NEAREST: 0,
- FILTER_LINEAR: 1,
- WRAP_REPEAT: 10497,
- WRAP_CLAMP: 33071,
- WRAP_MIRROR: 33648,
- TEXTURE_FMT_RGB_DXT1: 0,
- TEXTURE_FMT_RGBA_DXT1: 1,
- TEXTURE_FMT_RGBA_DXT3: 2,
- TEXTURE_FMT_RGBA_DXT5: 3,
- TEXTURE_FMT_RGB_ETC1: 4,
- TEXTURE_FMT_RGB_PVRTC_2BPPV1: 5,
- TEXTURE_FMT_RGBA_PVRTC_2BPPV1: 6,
- TEXTURE_FMT_RGB_PVRTC_4BPPV1: 7,
- TEXTURE_FMT_RGBA_PVRTC_4BPPV1: 8,
- TEXTURE_FMT_A8: 9,
- TEXTURE_FMT_L8: 10,
- TEXTURE_FMT_L8_A8: 11,
- TEXTURE_FMT_R5_G6_B5: 12,
- TEXTURE_FMT_R5_G5_B5_A1: 13,
- TEXTURE_FMT_R4_G4_B4_A4: 14,
- TEXTURE_FMT_RGB8: 15,
- TEXTURE_FMT_RGBA8: 16,
- TEXTURE_FMT_RGB16F: 17,
- TEXTURE_FMT_RGBA16F: 18,
- TEXTURE_FMT_RGB32F: 19,
- TEXTURE_FMT_RGBA32F: 20,
- TEXTURE_FMT_R32F: 21,
- TEXTURE_FMT_111110F: 22,
- TEXTURE_FMT_SRGB: 23,
- TEXTURE_FMT_SRGBA: 24,
- TEXTURE_FMT_D16: 25,
- TEXTURE_FMT_D32: 26,
- TEXTURE_FMT_D24S8: 27,
- TEXTURE_FMT_RGB_ETC2: 28,
- TEXTURE_FMT_RGBA_ETC2: 29,
- DS_FUNC_NEVER: 512,
- DS_FUNC_LESS: 513,
- DS_FUNC_EQUAL: 514,
- DS_FUNC_LEQUAL: 515,
- DS_FUNC_GREATER: 516,
- DS_FUNC_NOTEQUAL: 517,
- DS_FUNC_GEQUAL: 518,
- DS_FUNC_ALWAYS: 519,
- RB_FMT_RGBA4: 32854,
- RB_FMT_RGB5_A1: 32855,
- RB_FMT_RGB565: 36194,
- RB_FMT_D16: 33189,
- RB_FMT_S8: 36168,
- RB_FMT_D24S8: 34041,
- BLEND_FUNC_ADD: 32774,
- BLEND_FUNC_SUBTRACT: 32778,
- BLEND_FUNC_REVERSE_SUBTRACT: 32779,
- BLEND_ZERO: 0,
- BLEND_ONE: 1,
- BLEND_SRC_COLOR: 768,
- BLEND_ONE_MINUS_SRC_COLOR: 769,
- BLEND_DST_COLOR: 774,
- BLEND_ONE_MINUS_DST_COLOR: 775,
- BLEND_SRC_ALPHA: 770,
- BLEND_ONE_MINUS_SRC_ALPHA: 771,
- BLEND_DST_ALPHA: 772,
- BLEND_ONE_MINUS_DST_ALPHA: 773,
- BLEND_CONSTANT_COLOR: 32769,
- BLEND_ONE_MINUS_CONSTANT_COLOR: 32770,
- BLEND_CONSTANT_ALPHA: 32771,
- BLEND_ONE_MINUS_CONSTANT_ALPHA: 32772,
- BLEND_SRC_ALPHA_SATURATE: 776,
- STENCIL_DISABLE: 0,
- STENCIL_ENABLE: 1,
- STENCIL_INHERIT: 2,
- STENCIL_OP_KEEP: 7680,
- STENCIL_OP_ZERO: 0,
- STENCIL_OP_REPLACE: 7681,
- STENCIL_OP_INCR: 7682,
- STENCIL_OP_INCR_WRAP: 34055,
- STENCIL_OP_DECR: 7683,
- STENCIL_OP_DECR_WRAP: 34056,
- STENCIL_OP_INVERT: 5386,
- CULL_NONE: 0,
- CULL_FRONT: 1028,
- CULL_BACK: 1029,
- CULL_FRONT_AND_BACK: 1032,
- PT_POINTS: 0,
- PT_LINES: 1,
- PT_LINE_LOOP: 2,
- PT_LINE_STRIP: 3,
- PT_TRIANGLES: 4,
- PT_TRIANGLE_STRIP: 5,
- PT_TRIANGLE_FAN: 6
- }
- }), {}],
- 358: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t(e, i, r, s) {
- n(this, t), this._device = e, this._width = i, this._height = r, this._colors = s.colors || [], this._depth = s.depth || null, this._stencil = s.stencil || null, this._depthStencil = s.depthStencil || null, this._glID = e._gl.createFramebuffer()
- }
- return t.prototype.destroy = function() {
- null !== this._glID ? (this._device._gl.deleteFramebuffer(this._glID), this._glID = null) : console.error("The frame-buffer already destroyed")
- }, t.prototype.getHandle = function() {
- return this._glID
- }, t
- })();
- i.default = r, e.exports = i.default
- }), {}],
- 359: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n, r = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- s = t("./enums");
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var a = ((n = {})[s.enums.INDEX_FMT_UINT8] = 1, n[s.enums.INDEX_FMT_UINT16] = 2, n[s.enums.INDEX_FMT_UINT32] = 4, n),
- l = (function() {
- function t(e, i, n, r) {
- o(this, t), this._device = e, this._format = i, this._usage = n, this._bytesPerIndex = a[i], this._bytes = r.byteLength, this._numIndices = this._bytes / this._bytesPerIndex, this._needExpandDataStore = !0, this._glID = e._gl.createBuffer(), this.update(0, r), e._stats.ib += this._bytes
- }
- return t.prototype.destroy = function() {
- -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), this._device._stats.ib -= this.bytes, this._glID = -1) : console.error("The buffer already destroyed")
- }, t.prototype.update = function(t, e) {
- if (-1 !== this._glID) {
- if (0 !== e.byteLength) {
- if (t + e.byteLength > this._bytes) {
- if (t) return void console.error("Failed to update data, bytes exceed.");
- this._needExpandDataStore = !0, this._bytes = t + e.byteLength, this._numIndices = this._bytes / this._bytesPerIndex
- }
- var i = this._device._gl,
- n = this._usage;
- i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this._glID), this._needExpandDataStore ? (i.bufferData(i.ELEMENT_ARRAY_BUFFER, e, n), this._needExpandDataStore = !1) : i.bufferSubData(i.ELEMENT_ARRAY_BUFFER, t, e), this._device._restoreIndexBuffer()
- }
- } else console.error("The buffer is destroyed")
- }, t.prototype.setUsage = function(t) {
- this._usage = t
- }, r(t, [{
- key: "count",
- get: function() {
- return this._numIndices
- }
- }]), t
- })();
- l.BYTES_PER_INDEX = a, i.default = l, e.exports = i.default
- }), {
- "./enums": 357
- }],
- 360: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./enums"),
- r = null;
- r = {
- VertexFormat: t("./vertex-format"),
- IndexBuffer: t("./index-buffer"),
- VertexBuffer: t("./vertex-buffer"),
- Program: t("./program"),
- Texture: t("./texture"),
- Texture2D: t("./texture-2d"),
- TextureCube: t("./texture-cube"),
- RenderBuffer: t("./render-buffer"),
- FrameBuffer: t("./frame-buffer"),
- Device: t("./device"),
- attrTypeBytes: n.attrTypeBytes,
- glFilter: n.glFilter,
- glTextureFmt: n.glTextureFmt
- }, Object.assign(r, n.enums), i.default = r, cc.gfx = r, e.exports = i.default
- }), {
- "./device": 356,
- "./enums": 357,
- "./frame-buffer": 358,
- "./index-buffer": 359,
- "./program": 362,
- "./render-buffer": 363,
- "./texture": 367,
- "./texture-2d": 365,
- "./texture-cube": 366,
- "./vertex-buffer": 368,
- "./vertex-format": 369
- }],
- 361: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.isPow2 = function(t) {
- return !(t & t - 1 || !t)
- }
- }), {}],
- 362: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })();
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = 0;
- function o(t, e, i) {
- i.split("\n").forEach((function(i) {
- if (!(i.length < 5)) {
- var n = /^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(i);
- n ? t.push({
- type: e,
- fileID: 0 | n[1],
- line: 0 | n[2],
- message: n[3].trim()
- }) : i.length > 0 && t.push({
- type: e,
- fileID: -1,
- line: 0,
- message: i
- })
- }
- }))
- }
- var a = (function() {
- function t(e, i) {
- r(this, t), this._device = e, this._attributes = [], this._uniforms = [], this._samplers = [], this._errors = [], this._linked = !1, this._vertSource = i.vert, this._fragSource = i.frag, this._glID = null, this._id = s++
- }
- return t.prototype.link = function() {
- if (!this._linked) {
- var t = this._device._gl,
- e = l(t, t.VERTEX_SHADER, this._vertSource),
- i = l(t, t.FRAGMENT_SHADER, this._fragSource),
- n = t.createProgram();
- t.attachShader(n, e), t.attachShader(n, i), t.linkProgram(n);
- var r = !1,
- s = this._errors;
- if (t.getShaderParameter(e, t.COMPILE_STATUS) || (o(s, "vs", t.getShaderInfoLog(e)), r = !0), t.getShaderParameter(i, t.COMPILE_STATUS) || (o(s, "fs", t.getShaderInfoLog(i)), r = !0), t.deleteShader(e), t.deleteShader(i), r) return s;
- if (!t.getProgramParameter(n, t.LINK_STATUS)) return s.push({
- info: "Failed to link shader program: " + t.getProgramInfoLog(n)
- }), s;
- this._glID = n;
- for (var a = t.getProgramParameter(n, t.ACTIVE_ATTRIBUTES), h = 0; h < a; ++h) {
- var c = t.getActiveAttrib(n, h),
- u = t.getAttribLocation(n, c.name);
- this._attributes.push({
- name: c.name,
- location: u,
- type: c.type
- })
- }
- for (var _ = t.getProgramParameter(n, t.ACTIVE_UNIFORMS), f = 0; f < _; ++f) {
- var d = t.getActiveUniform(n, f),
- p = d.name,
- m = t.getUniformLocation(n, p),
- y = "[0]" === p.substr(p.length - 3);
- y && (p = p.substr(0, p.length - 3));
- var v = {
- name: p,
- location: m,
- type: d.type,
- size: y ? d.size : void 0
- };
- this._uniforms.push(v)
- }
- this._linked = !0
- }
- }, t.prototype.destroy = function() {
- this._device._gl.deleteProgram(this._glID), this._linked = !1, this._glID = null, this._attributes = [], this._uniforms = [], this._samplers = []
- }, n(t, [{
- key: "id",
- get: function() {
- return this._id
- }
- }]), t
- })();
- function l(t, e, i) {
- var n = t.createShader(e);
- return t.shaderSource(n, i), t.compileShader(n), n
- }
- i.default = a, e.exports = i.default
- }), {}],
- 363: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t(e, i, r, s) {
- n(this, t), this._device = e, this._format = i, this._glID = e._gl.createRenderbuffer(), this.update(r, s)
- }
- return t.prototype.update = function(t, e) {
- this._width = t, this._height = e;
- var i = this._device._gl;
- i.bindRenderbuffer(i.RENDERBUFFER, this._glID), i.renderbufferStorage(i.RENDERBUFFER, this._format, t, e), i.bindRenderbuffer(i.RENDERBUFFER, null)
- }, t.prototype.destroy = function() {
- if (null !== this._glID) {
- var t = this._device._gl;
- t.bindRenderbuffer(t.RENDERBUFFER, null), t.deleteRenderbuffer(this._glID), this._glID = null
- } else console.error("The render-buffer already destroyed")
- }, t
- })();
- i.default = r, e.exports = i.default
- }), {}],
- 364: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("./enums");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = {
- blend: !1,
- blendSep: !1,
- blendColor: 4294967295,
- blendEq: n.enums.BLEND_FUNC_ADD,
- blendAlphaEq: n.enums.BLEND_FUNC_ADD,
- blendSrc: n.enums.BLEND_ONE,
- blendDst: n.enums.BLEND_ZERO,
- blendSrcAlpha: n.enums.BLEND_ONE,
- blendDstAlpha: n.enums.BLEND_ZERO,
- depthTest: !1,
- depthWrite: !1,
- depthFunc: n.enums.DS_FUNC_LESS,
- stencilTest: !1,
- stencilSep: !1,
- stencilFuncFront: n.enums.DS_FUNC_ALWAYS,
- stencilRefFront: 0,
- stencilMaskFront: 255,
- stencilFailOpFront: n.enums.STENCIL_OP_KEEP,
- stencilZFailOpFront: n.enums.STENCIL_OP_KEEP,
- stencilZPassOpFront: n.enums.STENCIL_OP_KEEP,
- stencilWriteMaskFront: 255,
- stencilFuncBack: n.enums.DS_FUNC_ALWAYS,
- stencilRefBack: 0,
- stencilMaskBack: 255,
- stencilFailOpBack: n.enums.STENCIL_OP_KEEP,
- stencilZFailOpBack: n.enums.STENCIL_OP_KEEP,
- stencilZPassOpBack: n.enums.STENCIL_OP_KEEP,
- stencilWriteMaskBack: 255,
- cullMode: n.enums.CULL_BACK,
- primitiveType: n.enums.PT_TRIANGLES,
- maxStream: -1,
- vertexBuffers: [],
- vertexBufferOffsets: [],
- indexBuffer: null,
- maxTextureSlot: -1,
- textureUnits: [],
- program: null
- },
- o = (function() {
- function t(e) {
- r(this, t), this.vertexBuffers = new Array(e._caps.maxVertexStreams), this.vertexBufferOffsets = new Array(e._caps.maxVertexStreams), this.textureUnits = new Array(e._caps.maxTextureUnits), this.set(s)
- }
- return t.initDefault = function(t) {
- s.vertexBuffers = new Array(t._caps.maxVertexStreams), s.vertexBufferOffsets = new Array(t._caps.maxVertexStreams), s.textureUnits = new Array(t._caps.maxTextureUnits)
- }, t.prototype.reset = function() {
- this.set(s)
- }, t.prototype.set = function(t) {
- this.blend = t.blend, this.blendSep = t.blendSep, this.blendColor = t.blendColor, this.blendEq = t.blendEq, this.blendAlphaEq = t.blendAlphaEq, this.blendSrc = t.blendSrc, this.blendDst = t.blendDst, this.blendSrcAlpha = t.blendSrcAlpha, this.blendDstAlpha = t.blendDstAlpha, this.depthTest = t.depthTest, this.depthWrite = t.depthWrite, this.depthFunc = t.depthFunc, this.stencilTest = t.stencilTest, this.stencilSep = t.stencilSep, this.stencilFuncFront = t.stencilFuncFront, this.stencilRefFront = t.stencilRefFront, this.stencilMaskFront = t.stencilMaskFront, this.stencilFailOpFront = t.stencilFailOpFront, this.stencilZFailOpFront = t.stencilZFailOpFront, this.stencilZPassOpFront = t.stencilZPassOpFront, this.stencilWriteMaskFront = t.stencilWriteMaskFront, this.stencilFuncBack = t.stencilFuncBack, this.stencilRefBack = t.stencilRefBack, this.stencilMaskBack = t.stencilMaskBack, this.stencilFailOpBack = t.stencilFailOpBack, this.stencilZFailOpBack = t.stencilZFailOpBack, this.stencilZPassOpBack = t.stencilZPassOpBack, this.stencilWriteMaskBack = t.stencilWriteMaskBack, this.cullMode = t.cullMode, this.primitiveType = t.primitiveType, this.maxStream = t.maxStream;
- for (var e = 0; e < t.vertexBuffers.length; ++e) this.vertexBuffers[e] = t.vertexBuffers[e];
- for (var i = 0; i < t.vertexBufferOffsets.length; ++i) this.vertexBufferOffsets[i] = t.vertexBufferOffsets[i];
- this.indexBuffer = t.indexBuffer, this.maxTextureSlot = t.maxTextureSlot;
- for (var n = 0; n < t.textureUnits.length; ++n) this.textureUnits[n] = t.textureUnits[n];
- this.program = t.program
- }, t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./enums": 357
- }],
- 365: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./texture")),
- r = t("./enums"),
- s = t("./misc");
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)).constructor;
- var h = (function(t) {
- function e(i, n) {
- o(this, e);
- var r = a(this, t.call(this, i)),
- s = r._device._gl;
- return r._target = s.TEXTURE_2D, r._glID = s.createTexture(), n.images = n.images || [null], r.update(n), r
- }
- return l(e, t), e.prototype.update = function(t) {
- var e = this._device._gl,
- i = this._genMipmap;
- if (t) {
- void 0 !== t.width && (this._width = t.width), void 0 !== t.height && (this._height = t.height), void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), void 0 !== t.minFilter && (this._minFilter = t.minFilter), void 0 !== t.magFilter && (this._magFilter = t.magFilter), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format, this._compressed = this._format >= r.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= r.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= r.enums.TEXTURE_FMT_RGBA_ETC2), void 0 !== t.genMipmaps && (this._genMipmap = t.genMipmaps, i = t.genMipmaps);
- var n = this._device.caps.maxTextureSize || Number.MAX_VALUE,
- o = Math.max(t.width || 0, t.height || 0);
- if (n < o && console.warn("The current texture size " + o + " exceeds the maximum size [" + n + "] supported on the device."), void 0 !== t.images)
- if (t.images.length > 1) i = !1, (t.width > t.height ? t.width : t.height) >> t.images.length - 1 != 1 && console.error("texture-2d mipmap is invalid, should have a 1x1 mipmap.")
- }(0, s.isPow2)(this._width) && (0, s.isPow2)(this._height) || (i = !1), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), t.images.length > 1 && (this._genMipmap = !0)), i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), e.generateMipmap(e.TEXTURE_2D), this._genMipmap = !0), this._setTexInfo(), this._device._restoreTexture(0)
- }, e.prototype.updateSubImage = function(t) {
- var e = this._device._gl,
- i = (0, r.glTextureFmt)(this._format);
- e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), this._setSubImage(i, t), this._device._restoreTexture(0)
- }, e.prototype.updateImage = function(t) {
- var e = this._device._gl,
- i = (0, r.glTextureFmt)(this._format);
- e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), this._setImage(i, t), this._device._restoreTexture(0)
- }, e.prototype._setSubImage = function(t, e) {
- var i = this._device._gl,
- n = e.flipY,
- r = e.premultiplyAlpha,
- s = e.image;
- !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, s) : i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, t.format, t.pixelType, s))
- }, e.prototype._setImage = function(t, e) {
- var i = this._device._gl,
- n = e.flipY,
- r = e.premultiplyAlpha,
- s = e.image;
- !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), this._compressed ? i.compressedTexImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, s) : i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, t.format, t.pixelType, s))
- }, e.prototype._setMipmap = function(t, e, i) {
- for (var n = (0, r.glTextureFmt)(this._format), s = {
- width: this._width,
- height: this._height,
- flipY: e,
- premultiplyAlpha: i,
- level: 0,
- image: null
- }, o = 0; o < t.length; ++o) s.level = o, s.width = this._width >> o, s.height = this._height >> o, s.image = t[o], this._setImage(n, s)
- }, e.prototype._setTexInfo = function() {
- var t = this._device._gl,
- e = (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height);
- e || this._wrapS === r.enums.WRAP_CLAMP && this._wrapT === r.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), this._wrapS = r.enums.WRAP_CLAMP, this._wrapT = r.enums.WRAP_CLAMP);
- var i = this._genMipmap ? this._mipFilter : -1;
- e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), i = -1), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, (0, r.glFilter)(t, this._minFilter, i)), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, (0, r.glFilter)(t, this._magFilter, -1)), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, this._wrapS), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, this._wrapT);
- var n = this._device.ext("EXT_texture_filter_anisotropic");
- n && t.texParameteri(t.TEXTURE_2D, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy)
- }, e
- })(n.default);
- i.default = h, e.exports = i.default
- }), {
- "./enums": 357,
- "./misc": 361,
- "./texture": 367
- }],
- 366: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./texture")),
- r = t("./enums"),
- s = t("./misc");
- function o(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function a(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function l(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var h = (function(t) {
- function e(i, n) {
- o(this, e);
- var r = a(this, t.call(this, i)),
- s = r._device._gl;
- return r._target = s.TEXTURE_CUBE_MAP, r._glID = s.createTexture(), r.update(n), r
- }
- return l(e, t), e.prototype.update = function(t) {
- var e = this._device._gl,
- i = this._genMipmaps;
- t && (void 0 !== t.width && (this._width = t.width), void 0 !== t.height && (this._height = t.height), void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), void 0 !== t.minFilter && (this._minFilter = t.minFilter), void 0 !== t.magFilter && (this._magFilter = t.magFilter), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format, this._compressed = this._format >= r.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= r.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= r.enums.TEXTURE_FMT_RGBA_ETC2), void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps, i = t.genMipmaps), void 0 !== t.images && t.images.length > 1 && (i = !1, t.width !== t.height && console.warn("texture-cube width and height should be identical."), t.width >> t.images.length - 1 != 1 && console.error("texture-cube mipmap is invalid. please set mipmap as 1x1, 2x2, 4x4 ... nxn"))), (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height) || (i = !1), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), t.images.length > 1 && (this._genMipmaps = !0)), i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), e.generateMipmap(e.TEXTURE_CUBE_MAP), this._genMipmaps = !0), this._setTexInfo(), this._device._restoreTexture(0)
- }, e.prototype.updateSubImage = function(t) {
- var e = this._device._gl,
- i = (0, r.glTextureFmt)(this._format);
- e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), this._setSubImage(i, t), this._device._restoreTexture(0)
- }, e.prototype.updateImage = function(t) {
- var e = this._device._gl,
- i = (0, r.glTextureFmt)(this._format);
- e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), this._setImage(i, t), this._device._restoreTexture(0)
- }, e.prototype._setSubImage = function(t, e) {
- var i = this._device._gl,
- n = e.flipY,
- r = e.premultiplyAlpha,
- s = e.faceIndex,
- o = e.image;
- void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), !o || ArrayBuffer.isView(o) || o instanceof ArrayBuffer ? this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, o) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, o) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, t.format, t.pixelType, o)
- }, e.prototype._setImage = function(t, e) {
- var i = this._device._gl,
- n = e.flipY,
- r = e.premultiplyAlpha,
- s = e.faceIndex,
- o = e.image;
- void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), !o || ArrayBuffer.isView(o) || o instanceof ArrayBuffer ? this._compressed ? i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, o) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, o) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, t.format, t.pixelType, o)
- }, e.prototype._setMipmap = function(t, e, i) {
- for (var n = (0, r.glTextureFmt)(this._format), s = {
- width: this._width,
- height: this._height,
- faceIndex: 0,
- flipY: e,
- premultiplyAlpha: i,
- level: 0,
- image: null
- }, o = 0; o < t.length; ++o) {
- var a = t[o];
- s.level = o, s.width = this._width >> o, s.height = this._height >> o;
- for (var l = 0; l < 6; ++l) s.faceIndex = l, s.image = a[l], this._setImage(n, s)
- }
- }, e.prototype._setTexInfo = function() {
- var t = this._device._gl,
- e = (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height);
- e || this._wrapS === r.enums.WRAP_CLAMP && this._wrapT === r.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), this._wrapS = r.enums.WRAP_CLAMP, this._wrapT = r.enums.WRAP_CLAMP);
- var i = this._genMipmaps ? this._mipFilter : -1;
- e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), i = -1), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MIN_FILTER, (0, r.glFilter)(t, this._minFilter, i)), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MAG_FILTER, (0, r.glFilter)(t, this._magFilter, -1)), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_S, this._wrapS), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_T, this._wrapT);
- var n = this._device.ext("EXT_texture_filter_anisotropic");
- n && t.texParameteri(t.TEXTURE_CUBE_MAP, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy)
- }, e
- })(n.default);
- i.default = h, e.exports = i.default
- }), {
- "./enums": 357,
- "./misc": 361,
- "./texture": 367
- }],
- 367: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("./enums");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = 0,
- o = (function() {
- function t(e) {
- r(this, t), this._device = e, this._width = 4, this._height = 4, this._genMipmaps = !1, this._compressed = !1, this._anisotropy = 1, this._minFilter = n.enums.FILTER_LINEAR, this._magFilter = n.enums.FILTER_LINEAR, this._mipFilter = n.enums.FILTER_LINEAR, this._wrapS = n.enums.WRAP_REPEAT, this._wrapT = n.enums.WRAP_REPEAT, this._format = n.enums.TEXTURE_FMT_RGBA8, this._target = -1, this._id = s++
- }
- return t.prototype.destroy = function() {
- null !== this._glID ? (this._device._gl.deleteTexture(this._glID), this._device._stats.tex -= this.bytes, this._glID = null) : console.error("The texture already destroyed")
- }, t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./enums": 357
- }],
- 368: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })();
- t("./enums");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t(e, i, n, s) {
- r(this, t), this._device = e, this._format = i, this._usage = n, this._bytesPerVertex = this._format._bytes, this._bytes = s.byteLength, this._numVertices = this._bytes / this._bytesPerVertex, this._needExpandDataStore = !0, this._glID = e._gl.createBuffer(), this.update(0, s), e._stats.vb += this._bytes
- }
- return t.prototype.destroy = function() {
- -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), this._device._stats.vb -= this.bytes, this._glID = -1) : console.error("The buffer already destroyed")
- }, t.prototype.update = function(t, e) {
- if (-1 !== this._glID) {
- if (0 !== e.byteLength) {
- if (t + e.byteLength > this._bytes) {
- if (t) return void console.error("Failed to update data, bytes exceed.");
- this._needExpandDataStore = !0, this._bytes = t + e.byteLength, this._numVertices = this._bytes / this._bytesPerVertex
- }
- var i = this._device._gl,
- n = this._usage;
- i.bindBuffer(i.ARRAY_BUFFER, this._glID), this._needExpandDataStore ? (i.bufferData(i.ARRAY_BUFFER, e, n), this._needExpandDataStore = !1) : i.bufferSubData(i.ARRAY_BUFFER, t, e), i.bindBuffer(i.ARRAY_BUFFER, null)
- }
- } else console.error("The buffer is destroyed")
- }, t.prototype.getFormat = function(t) {
- return this._format.element(t)
- }, t.prototype.setUsage = function(t) {
- this._usage = t
- }, n(t, [{
- key: "count",
- get: function() {
- return this._numVertices
- }
- }]), t
- })();
- i.default = s, e.exports = i.default
- }), {
- "./enums": 357
- }],
- 369: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("./enums"),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../murmurhash2_gc"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t(e) {
- s(this, t), this._attr2el = {}, this._elements = [], this._bytes = 0;
- for (var i = "", o = 0, a = e.length; o < a; ++o) {
- var l = e[o],
- h = {
- name: l.name,
- offset: this._bytes,
- stride: 0,
- stream: -1,
- type: l.type,
- num: l.num,
- normalize: void 0 !== l.normalize && l.normalize,
- bytes: l.num * (0, n.attrTypeBytes)(l.type)
- };
- this._attr2el[h.name] = h, this._elements.push(h), this._bytes += h.bytes, i += h.name + ":" + h.num + ":" + h.type + ":" + h.normalize
- }
- for (var c = 0, u = this._elements.length; c < u; ++c) {
- this._elements[c].stride = this._bytes
- }
- this._hash = (0, r.default)(i, 666)
- }
- return t.prototype.element = function(t) {
- return this._attr2el[t]
- }, t.prototype.getHash = function() {
- return this._hash
- }, t
- })();
- i.default = o, e.exports = i.default
- }), {
- "../murmurhash2_gc": 378,
- "./enums": 357
- }],
- 370: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t(e, i) {
- n(this, t), this._cursor = 0, this._data = new Array(i);
- for (var r = 0; r < i; ++r) this._data[r] = e()
- }
- return t.prototype.request = function() {
- var t = this._data[this._cursor];
- return this._cursor = (this._cursor + 1) % this._data.length, t
- }, t
- })();
- i.default = r, e.exports = i.default
- }), {}],
- 371: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./timsort"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t(e) {
- s(this, t), this._count = 0, this._data = new Array(e)
- }
- return t.prototype._resize = function(t) {
- if (t > this._data.length)
- for (var e = this._data.length; e < t; ++e) this._data[e] = void 0
- }, t.prototype.reset = function() {
- for (var t = 0; t < this._count; ++t) this._data[t] = void 0;
- this._count = 0
- }, t.prototype.push = function(t) {
- this._count >= this._data.length && this._resize(2 * this._data.length), this._data[this._count] = t, ++this._count
- }, t.prototype.pop = function() {
- --this._count, this._count < 0 && (this._count = 0);
- var t = this._data[this._count];
- return this._data[this._count] = void 0, t
- }, t.prototype.fastRemove = function(t) {
- if (!(t >= this._count || t < 0)) {
- var e = this._count - 1;
- this._data[t] = this._data[e], this._data[e] = void 0, this._count -= 1
- }
- }, t.prototype.indexOf = function(t) {
- return this._data.indexOf(t)
- }, t.prototype.sort = function(t) {
- return (0, r.default)(this._data, 0, this._count, t)
- }, n(t, [{
- key: "length",
- get: function() {
- return this._count
- }
- }, {
- key: "data",
- get: function() {
- return this._data
- }
- }]), t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./timsort": 376
- }],
- 372: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("./circular-pool");
- Object.defineProperty(i, "CircularPool", {
- enumerable: !0,
- get: function() {
- return h(n).default
- }
- });
- var r = t("./fixed-array");
- Object.defineProperty(i, "FixedArray", {
- enumerable: !0,
- get: function() {
- return h(r).default
- }
- });
- var s = t("./linked-array");
- Object.defineProperty(i, "LinkedArray", {
- enumerable: !0,
- get: function() {
- return h(s).default
- }
- });
- var o = t("./pool");
- Object.defineProperty(i, "Pool", {
- enumerable: !0,
- get: function() {
- return h(o).default
- }
- });
- var a = t("./recycle-pool");
- Object.defineProperty(i, "RecyclePool", {
- enumerable: !0,
- get: function() {
- return h(a).default
- }
- });
- var l = t("./typed-array-pool");
- function h(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- Object.defineProperty(i, "TypedArrayPool", {
- enumerable: !0,
- get: function() {
- return h(l).default
- }
- })
- }), {
- "./circular-pool": 370,
- "./fixed-array": 371,
- "./linked-array": 373,
- "./pool": 374,
- "./recycle-pool": 375,
- "./typed-array-pool": 377
- }],
- 373: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./pool"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t(e, i) {
- s(this, t), this._fn = e, this._count = 0, this._head = null, this._tail = null, this._pool = new r.default(e, i)
- }
- return t.prototype.add = function() {
- var t = this._pool.alloc();
- return this._tail ? (this._tail._next = t, t._prev = this._tail) : this._head = t, this._tail = t, this._count += 1, t
- }, t.prototype.remove = function(t) {
- t._prev ? t._prev._next = t._next : this._head = t._next, t._next ? t._next._prev = t._prev : this._tail = t._prev, t._next = null, t._prev = null, this._pool.free(t), this._count -= 1
- }, t.prototype.forEach = function(t, e) {
- var i = this._head;
- if (i) {
- e && (t = t.bind(e));
- for (var n = 0, r = i; i;) r = i._next, t(i, n, this), i = r, ++n
- }
- }, n(t, [{
- key: "head",
- get: function() {
- return this._head
- }
- }, {
- key: "tail",
- get: function() {
- return this._tail
- }
- }, {
- key: "length",
- get: function() {
- return this._count
- }
- }]), t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./pool": 374
- }],
- 374: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t(e, i) {
- n(this, t), this._fn = e, this._idx = i - 1, this._frees = new Array(i);
- for (var r = 0; r < i; ++r) this._frees[r] = e()
- }
- return t.prototype._expand = function(t) {
- var e = this._frees;
- this._frees = new Array(t);
- for (var i = t - e.length, n = 0; n < i; ++n) this._frees[n] = this._fn();
- for (var r = i, s = 0; r < t; ++r, ++s) this._frees[r] = e[s];
- this._idx += i
- }, t.prototype.alloc = function() {
- this._idx < 0 && this._expand(Math.round(1.2 * this._frees.length) + 1);
- var t = this._frees[this._idx];
- return this._frees[this._idx] = null, --this._idx, t
- }, t.prototype.free = function(t) {
- ++this._idx, this._frees[this._idx] = t
- }, t
- })();
- i.default = r, e.exports = i.default
- }), {}],
- 375: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("./timsort"));
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var o = (function() {
- function t(e, i) {
- s(this, t), this._fn = e, this._count = 0, this._data = new Array(i);
- for (var n = 0; n < i; ++n) this._data[n] = e()
- }
- return t.prototype.reset = function() {
- this._count = 0
- }, t.prototype.resize = function(t) {
- if (t > this._data.length)
- for (var e = this._data.length; e < t; ++e) this._data[e] = this._fn()
- }, t.prototype.add = function() {
- return this._count >= this._data.length && this.resize(2 * this._data.length), this._data[this._count++]
- }, t.prototype.remove = function(t) {
- if (!(t >= this._count)) {
- var e = this._count - 1,
- i = this._data[t];
- this._data[t] = this._data[e], this._data[e] = i, this._count -= 1
- }
- }, t.prototype.sort = function(t) {
- return (0, r.default)(this._data, 0, this._count, t)
- }, n(t, [{
- key: "length",
- get: function() {
- return this._count
- }
- }, {
- key: "data",
- get: function() {
- return this._data
- }
- }]), t
- })();
- i.default = o, e.exports = i.default
- }), {
- "./timsort": 376
- }],
- 376: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0, i.default = function(t, e, i, n) {
- if (!Array.isArray(t)) throw new TypeError("Can only sort arrays");
- void 0 === e && (e = 0), void 0 === i && (i = t.length), void 0 === n && (n = h);
- var s = i - e;
- if (!(s < 2)) {
- var o = 0;
- if (s < r) f(t, e, i, e + (o = u(t, e, i, n)), n);
- else {
- var a = new m(t, n),
- l = c(s);
- do {
- if ((o = u(t, e, i, n)) < l) {
- var _ = s;
- _ > l && (_ = l), f(t, e, e + _, e + o, n), o = _
- }
- a.pushRun(e, o), a.mergeRuns(), s -= o, e += o
- } while (0 !== s);
- a.forceMergeRuns()
- }
- }
- };
- var r = 32,
- s = 7,
- o = 256,
- a = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
- function l(t) {
- return t < 1e5 ? t < 100 ? t < 10 ? 0 : 1 : t < 1e4 ? t < 1e3 ? 2 : 3 : 4 : t < 1e7 ? t < 1e6 ? 5 : 6 : t < 1e9 ? t < 1e8 ? 7 : 8 : 9
- }
- function h(t, e) {
- if (t === e) return 0;
- if (~~t === t && ~~e === e) {
- if (0 === t || 0 === e) return t < e ? -1 : 1;
- if (t < 0 || e < 0) {
- if (e >= 0) return -1;
- if (t >= 0) return 1;
- t = -t, e = -e
- }
- var i = l(t),
- n = l(e),
- r = 0;
- return i < n ? (t *= a[n - i - 1], e /= 10, r = -1) : i > n && (e *= a[i - n - 1], t /= 10, r = 1), t === e ? r : t < e ? -1 : 1
- }
- var s = String(t),
- o = String(e);
- return s === o ? 0 : s < o ? -1 : 1
- }
- function c(t) {
- for (var e = 0; t >= r;) e |= 1 & t, t >>= 1;
- return t + e
- }
- function u(t, e, i, n) {
- var r = e + 1;
- if (r === i) return 1;
- if (n(t[r++], t[e]) < 0) {
- for (; r < i && n(t[r], t[r - 1]) < 0;) r++;
- _(t, e, r)
- } else
- for (; r < i && n(t[r], t[r - 1]) >= 0;) r++;
- return r - e
- }
- function _(t, e, i) {
- for (i--; e < i;) {
- var n = t[e];
- t[e++] = t[i], t[i--] = n
- }
- }
- function f(t, e, i, n, r) {
- for (n === e && n++; n < i; n++) {
- for (var s = t[n], o = e, a = n; o < a;) {
- var l = o + a >>> 1;
- r(s, t[l]) < 0 ? a = l : o = l + 1
- }
- var h = n - o;
- switch (h) {
- case 3:
- t[o + 3] = t[o + 2];
- case 2:
- t[o + 2] = t[o + 1];
- case 1:
- t[o + 1] = t[o];
- break;
- default:
- for (; h > 0;) t[o + h] = t[o + h - 1], h--
- }
- t[o] = s
- }
- }
- function d(t, e, i, n, r, s) {
- var o = 0,
- a = 0,
- l = 1;
- if (s(t, e[i + r]) > 0) {
- for (a = n - r; l < a && s(t, e[i + r + l]) > 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
- l > a && (l = a), o += r, l += r
- } else {
- for (a = r + 1; l < a && s(t, e[i + r - l]) <= 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
- l > a && (l = a);
- var h = o;
- o = r - l, l = r - h
- }
- for (o++; o < l;) {
- var c = o + (l - o >>> 1);
- s(t, e[i + c]) > 0 ? o = c + 1 : l = c
- }
- return l
- }
- function p(t, e, i, n, r, s) {
- var o = 0,
- a = 0,
- l = 1;
- if (s(t, e[i + r]) < 0) {
- for (a = r + 1; l < a && s(t, e[i + r - l]) < 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
- l > a && (l = a);
- var h = o;
- o = r - l, l = r - h
- } else {
- for (a = n - r; l < a && s(t, e[i + r + l]) >= 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
- l > a && (l = a), o += r, l += r
- }
- for (o++; o < l;) {
- var c = o + (l - o >>> 1);
- s(t, e[i + c]) < 0 ? l = c : o = c + 1
- }
- return l
- }
- var m = (function() {
- function t(e, i) {
- n(this, t), this.array = e, this.compare = i, this.minGallop = s, this.length = e.length, this.tmpStorageLength = o, this.length < 2 * o && (this.tmpStorageLength = this.length >>> 1), this.tmp = new Array(this.tmpStorageLength), this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40, this.runStart = new Array(this.stackLength), this.runLength = new Array(this.stackLength), this.stackSize = 0
- }
- return t.prototype.pushRun = function(t, e) {
- this.runStart[this.stackSize] = t, this.runLength[this.stackSize] = e, this.stackSize += 1
- }, t.prototype.mergeRuns = function() {
- for (; this.stackSize > 1;) {
- var t = this.stackSize - 2;
- if (t >= 1 && this.runLength[t - 1] <= this.runLength[t] + this.runLength[t + 1] || t >= 2 && this.runLength[t - 2] <= this.runLength[t] + this.runLength[t - 1]) this.runLength[t - 1] < this.runLength[t + 1] && t--;
- else if (this.runLength[t] > this.runLength[t + 1]) break;
- this.mergeAt(t)
- }
- }, t.prototype.forceMergeRuns = function() {
- for (; this.stackSize > 1;) {
- var t = this.stackSize - 2;
- t > 0 && this.runLength[t - 1] < this.runLength[t + 1] && t--, this.mergeAt(t)
- }
- }, t.prototype.mergeAt = function(t) {
- var e = this.compare,
- i = this.array,
- n = this.runStart[t],
- r = this.runLength[t],
- s = this.runStart[t + 1],
- o = this.runLength[t + 1];
- this.runLength[t] = r + o, t === this.stackSize - 3 && (this.runStart[t + 1] = this.runStart[t + 2], this.runLength[t + 1] = this.runLength[t + 2]), this.stackSize--;
- var a = p(i[s], i, n, r, 0, e);
- n += a, 0 !== (r -= a) && 0 !== (o = d(i[n + r - 1], i, s, o, o - 1, e)) && (r <= o ? this.mergeLow(n, r, s, o) : this.mergeHigh(n, r, s, o))
- }, t.prototype.mergeLow = function(t, e, i, n) {
- var r = this.compare,
- o = this.array,
- a = this.tmp,
- l = 0;
- for (l = 0; l < e; l++) a[l] = o[t + l];
- var h = 0,
- c = i,
- u = t;
- if (o[u++] = o[c++], 0 != --n)
- if (1 !== e) {
- for (var _ = this.minGallop;;) {
- var f = 0,
- m = 0,
- y = !1;
- do {
- if (r(o[c], a[h]) < 0) {
- if (o[u++] = o[c++], m++, f = 0, 0 == --n) {
- y = !0;
- break
- }
- } else if (o[u++] = a[h++], f++, m = 0, 1 == --e) {
- y = !0;
- break
- }
- } while ((f | m) < _);
- if (y) break;
- do {
- if (0 !== (f = p(o[c], a, h, e, 0, r))) {
- for (l = 0; l < f; l++) o[u + l] = a[h + l];
- if (u += f, h += f, (e -= f) <= 1) {
- y = !0;
- break
- }
- }
- if (o[u++] = o[c++], 0 == --n) {
- y = !0;
- break
- }
- if (0 !== (m = d(a[h], o, c, n, 0, r))) {
- for (l = 0; l < m; l++) o[u + l] = o[c + l];
- if (u += m, c += m, 0 === (n -= m)) {
- y = !0;
- break
- }
- }
- if (o[u++] = a[h++], 1 == --e) {
- y = !0;
- break
- }
- _--
- } while (f >= s || m >= s);
- if (y) break;
- _ < 0 && (_ = 0), _ += 2
- }
- if (this.minGallop = _, _ < 1 && (this.minGallop = 1), 1 === e) {
- for (l = 0; l < n; l++) o[u + l] = o[c + l];
- o[u + n] = a[h]
- } else {
- if (0 === e) throw new Error("mergeLow preconditions were not respected");
- for (l = 0; l < e; l++) o[u + l] = a[h + l]
- }
- } else {
- for (l = 0; l < n; l++) o[u + l] = o[c + l];
- o[u + n] = a[h]
- }
- else
- for (l = 0; l < e; l++) o[u + l] = a[h + l]
- }, t.prototype.mergeHigh = function(t, e, i, n) {
- var r = this.compare,
- o = this.array,
- a = this.tmp,
- l = 0;
- for (l = 0; l < n; l++) a[l] = o[i + l];
- var h = t + e - 1,
- c = n - 1,
- u = i + n - 1,
- _ = 0,
- f = 0;
- if (o[u--] = o[h--], 0 != --e)
- if (1 !== n) {
- for (var m = this.minGallop;;) {
- var y = 0,
- v = 0,
- g = !1;
- do {
- if (r(a[c], o[h]) < 0) {
- if (o[u--] = o[h--], y++, v = 0, 0 == --e) {
- g = !0;
- break
- }
- } else if (o[u--] = a[c--], v++, y = 0, 1 == --n) {
- g = !0;
- break
- }
- } while ((y | v) < m);
- if (g) break;
- do {
- if (0 !== (y = e - p(a[c], o, t, e, e - 1, r))) {
- for (e -= y, f = (u -= y) + 1, _ = (h -= y) + 1, l = y - 1; l >= 0; l--) o[f + l] = o[_ + l];
- if (0 === e) {
- g = !0;
- break
- }
- }
- if (o[u--] = a[c--], 1 == --n) {
- g = !0;
- break
- }
- if (0 !== (v = n - d(o[h], a, 0, n, n - 1, r))) {
- for (n -= v, f = (u -= v) + 1, _ = (c -= v) + 1, l = 0; l < v; l++) o[f + l] = a[_ + l];
- if (n <= 1) {
- g = !0;
- break
- }
- }
- if (o[u--] = o[h--], 0 == --e) {
- g = !0;
- break
- }
- m--
- } while (y >= s || v >= s);
- if (g) break;
- m < 0 && (m = 0), m += 2
- }
- if (this.minGallop = m, m < 1 && (this.minGallop = 1), 1 === n) {
- for (f = (u -= e) + 1, _ = (h -= e) + 1, l = e - 1; l >= 0; l--) o[f + l] = o[_ + l];
- o[u] = a[c]
- } else {
- if (0 === n) throw new Error("mergeHigh preconditions were not respected");
- for (_ = u - (n - 1), l = 0; l < n; l++) o[_ + l] = a[l]
- }
- } else {
- for (f = (u -= e) + 1, _ = (h -= e) + 1, l = e - 1; l >= 0; l--) o[f + l] = o[_ + l];
- o[u] = a[c]
- }
- else
- for (_ = u - (n - 1), l = 0; l < n; l++) o[_ + l] = a[l]
- }, t
- })();
- e.exports = i.default
- }), {}],
- 377: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- for (var n = Array(8), r = 0; r < 8; ++r) n[r] = [];
- function s(t) {
- for (var e = 16; e <= 1 << 28; e *= 16)
- if (t <= e) return e;
- return 0
- }
- function o(t) {
- var e = void 0,
- i = void 0;
- return e = (t > 65535) << 4, e |= i = ((t >>>= e) > 255) << 3, e |= i = ((t >>>= i) > 15) << 2, (e |= i = ((t >>>= i) > 3) << 1) | (t >>>= i) >> 1
- }
- function a(t) {
- var e = s(t),
- i = n[o(e) >> 2];
- return i.length > 0 ? i.pop() : new ArrayBuffer(e)
- }
- function l(t) {
- n[o(t.byteLength) >> 2].push(t)
- }
- i.default = {
- alloc_int8: function(t) {
- var e = new Int8Array(a(t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_uint8: function(t) {
- var e = new Uint8Array(a(t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_int16: function(t) {
- var e = new Int16Array(a(2 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_uint16: function(t) {
- var e = new Uint16Array(a(2 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_int32: function(t) {
- var e = new Int32Array(a(4 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_uint32: function(t) {
- var e = new Uint32Array(a(4 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_float32: function(t) {
- var e = new Float32Array(a(4 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_float64: function(t) {
- var e = new Float64Array(a(8 * t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- alloc_dataview: function(t) {
- var e = new DataView(a(t), 0, t);
- return e.length !== t ? e.subarray(0, t) : e
- },
- free: function(t) {
- l(t.buffer)
- },
- reset: function() {
- for (var t = Array(8), e = 0; e < 8; ++e) t[e] = []
- }
- }, e.exports = i.default
- }), {}],
- 378: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = function(t, e) {
- var i, n = t.length,
- r = e ^ n,
- s = 0;
- for (; n >= 4;) i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), n -= 4, ++s;
- switch (n) {
- case 3:
- r ^= (255 & t.charCodeAt(s + 2)) << 16;
- case 2:
- r ^= (255 & t.charCodeAt(s + 1)) << 8;
- case 1:
- r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16)
- }
- return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), (r ^= r >>> 15) >>> 0
- }, e.exports = i.default
- }), {}],
- 379: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = t("../../core/vmath"),
- r = a(t("../core/base-renderer")),
- s = a(t("../enums")),
- o = t("../memop");
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function h(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function c(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var u = new Float32Array(16),
- _ = new Float32Array(16),
- f = new Float32Array(16),
- d = new Float32Array(4),
- p = new Float32Array(64),
- m = [],
- y = new Float32Array(4),
- v = cc.v4(0, 0, 0, 0),
- g = cc.v3(0, 0, 0),
- x = cc.v3(0, 0, 0),
- b = new o.RecyclePool(function() {
- return new Float32Array(16)
- }, 8),
- A = (function(t) {
- function e(i, n) {
- l(this, e);
- var r = h(this, t.call(this, i, n));
- return r._time = new Float32Array(4), r._directionalLights = [], r._pointLights = [], r._spotLights = [], r._shadowLights = [], r._ambientLights = [], r._shadowMaps = [], r._shadowMapSlots = new Int32Array(4), r._numLights = 0, r._defines = {}, r._registerStage("shadowcast", r._shadowStage.bind(r)), r._registerStage("opaque", r._opaqueStage.bind(r)), r._registerStage("transparent", r._transparentStage.bind(r)), r
- }
- return c(e, t), e.prototype.reset = function() {
- b.reset(), t.prototype.reset.call(this)
- }, e.prototype.render = function(t, e) {
- this.reset(), this._time[0] += e, this._device.setUniform("cc_time", this._time), this._updateLights(t);
- for (var i = this._device._gl.canvas, n = 0; n < t._cameras.length; ++n) {
- var r = this._requestView(),
- s = i.width,
- o = i.height;
- t._cameras.data[n].extractView(r, s, o)
- }
- this._viewPools.sort((function(t, e) {
- return t._priority - e._priority
- }));
- for (var a = 0; a < this._viewPools.length; ++a) {
- var l = this._viewPools.data[a];
- this._render(l, t)
- }
- }, e.prototype.renderCamera = function(t, e) {
- this.reset();
- var i = this._device._gl.canvas,
- n = i.width,
- r = i.height,
- s = this._requestView();
- t.extractView(s, n, r), this._render(s, e)
- }, e.prototype._updateLights = function(t) {
- this._directionalLights.length = 0, this._pointLights.length = 0, this._spotLights.length = 0, this._shadowLights.length = 0, this._ambientLights.length = 0;
- for (var e = t._lights, i = 0; i < e.length; ++i) {
- var n = e.data[i];
- if (n.update(this._device), n.shadowType !== s.default.SHADOW_NONE) {
- this._shadowLights.push(n);
- var r = this._requestView();
- n.extractView(r, ["shadowcast"])
- }
- n._type === s.default.LIGHT_DIRECTIONAL ? this._directionalLights.push(n) : n._type === s.default.LIGHT_POINT ? this._pointLights.push(n) : n._type === s.default.LIGHT_SPOT ? this._spotLights.push(n) : this._ambientLights.push(n)
- }
- this._updateDefines(), this._numLights = e._count
- }, e.prototype._updateDefines = function() {
- var t = this._defines;
- t.CC_NUM_DIR_LIGHTS = Math.min(4, this._directionalLights.length), t.CC_NUM_POINT_LIGHTS = Math.min(4, this._pointLights.length), t.CC_NUM_SPOT_LIGHTS = Math.min(4, this._spotLights.length), t.CC_NUM_AMBIENT_LIGHTS = Math.min(4, this._ambientLights.length), t.CC_NUM_SHADOW_LIGHTS = Math.min(4, this._shadowLights.length)
- }, e.prototype._submitLightsUniforms = function() {
- var t = this._device;
- if (this._directionalLights.length > 0) {
- for (var e = b.add(), i = b.add(), n = Math.min(4, this._directionalLights.length), r = 0; r < n; ++r) {
- var s = this._directionalLights[r],
- o = 4 * r;
- e.set(s._directionUniform, o), i.set(s._colorUniform, o)
- }
- t.setUniform("cc_dirLightDirection", e), t.setUniform("cc_dirLightColor", i)
- }
- if (this._pointLights.length > 0) {
- for (var a = b.add(), l = b.add(), h = Math.min(4, this._pointLights.length), c = 0; c < h; ++c) {
- var u = this._pointLights[c],
- _ = 4 * c;
- a.set(u._positionUniform, _), a[_ + 3] = u._range, l.set(u._colorUniform, _)
- }
- t.setUniform("cc_pointLightPositionAndRange", a), t.setUniform("cc_pointLightColor", l)
- }
- if (this._spotLights.length > 0) {
- for (var f = b.add(), d = b.add(), p = b.add(), m = Math.min(4, this._spotLights.length), y = 0; y < m; ++y) {
- var v = this._spotLights[y],
- g = 4 * y;
- f.set(v._positionUniform, g), f[g + 3] = v._range, d.set(v._directionUniform, g), d[g + 3] = v._spotUniform[0], p.set(v._colorUniform, g), p[g + 3] = v._spotUniform[1]
- }
- t.setUniform("cc_spotLightPositionAndRange", f), t.setUniform("cc_spotLightDirection", d), t.setUniform("cc_spotLightColor", p)
- }
- if (this._ambientLights.length > 0) {
- for (var x = b.add(), A = Math.min(4, this._ambientLights.length), C = 0; C < A; ++C) {
- var T = this._ambientLights[C],
- S = 4 * C;
- x.set(T._colorUniform, S)
- }
- t.setUniform("cc_ambientColor", x)
- }
- }, e.prototype._submitShadowStageUniforms = function(t) {
- var e = t._shadowLight,
- i = y;
- i[0] = e.shadowMinDepth, i[1] = e.shadowMaxDepth, i[2] = e.shadowDepthScale, i[3] = e.shadowDarkness, this._device.setUniform("cc_shadow_map_lightViewProjMatrix", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_shadow_map_info", i), this._device.setUniform("cc_shadow_map_bias", e.shadowBias)
- }, e.prototype._submitOtherStagesUniforms = function() {
- for (var t = b.add(), e = 0; e < this._shadowLights.length; ++e) {
- var i = this._shadowLights[e],
- r = m[e];
- r || (r = m[e] = new Float32Array(p.buffer, 16 * e, 16)), n.mat4.array(r, i.viewProjMatrix);
- var s = 4 * e;
- t[s] = i.shadowMinDepth, t[s + 1] = i.shadowMaxDepth, t[s + 2] = i.shadowDepthScale, t[s + 3] = i.shadowDarkness
- }
- this._device.setUniform("cc_shadow_lightViewProjMatrix", p), this._device.setUniform("cc_shadow_info", t)
- }, e.prototype._updateShaderDefines = function(t) {
- t.defines.push(this._defines)
- }, e.prototype._sortItems = function(t) {
- t.sort((function(t, e) {
- var i = t.technique,
- n = e.technique;
- return i._layer !== n._layer ? i._layer - n._layer : i._passes.length !== n._passes.length ? i._passes.length - n._passes.length : t.sortKey - e.sortKey
- }))
- }, e.prototype._shadowStage = function(t, e) {
- this._submitShadowStageUniforms(t);
- for (var i = 0; i < e.length; ++i) {
- var n = e.data[i];
- this._programLib._getValueFromDefineList("CC_SHADOW_CASTING", n.defines) && (this._updateShaderDefines(n), this._draw(n))
- }
- }, e.prototype._drawItems = function(t, e) {
- var i = this._shadowLights;
- if (0 === i.length && 0 === this._numLights)
- for (var n = 0; n < e.length; ++n) {
- var r = e.data[n];
- this._updateShaderDefines(r), this._draw(r)
- } else
- for (var s = 0; s < e.length; ++s) {
- var o = e.data[s];
- this._shadowMaps.length = i.length;
- for (var a = 0; a < i.length; ++a) {
- var l = i[a];
- this._shadowMaps[a] = l.shadowMap, this._shadowMapSlots[a] = this._allocTextureUnit()
- }
- this._device.setTextureArray("cc_shadow_map", this._shadowMaps, this._shadowMapSlots), this._updateShaderDefines(o), this._draw(o)
- }
- }, e.prototype._opaqueStage = function(t, e) {
- t.getPosition(v), this._device.setUniform("cc_matView", n.mat4.array(u, t._matView)), this._device.setUniform("cc_matpProj", n.mat4.array(_, t._matProj)), this._device.setUniform("cc_matViewProj", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_cameraPos", n.vec4.array(d, v)), this._submitLightsUniforms(), this._submitOtherStagesUniforms(), this._drawItems(t, e)
- }, e.prototype._transparentStage = function(t, e) {
- t.getPosition(v), t.getForward(g), this._device.setUniform("cc_matView", n.mat4.array(u, t._matView)), this._device.setUniform("cc_matpProj", n.mat4.array(_, t._matProj)), this._device.setUniform("cc_matViewProj", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_cameraPos", n.vec4.array(d, v)), this._submitLightsUniforms(), this._submitOtherStagesUniforms();
- for (var i = 0; i < e.length; ++i) {
- var r = e.data[i];
- r.node.getWorldPosition(x), n.vec3.sub(x, x, v), r.sortKey = -n.vec3.dot(x, g)
- }
- this._sortItems(e), this._drawItems(t, e)
- }, e
- })(r.default);
- i.default = A, e.exports = i.default
- }), {
- "../../core/vmath": 326,
- "../core/base-renderer": 348,
- "../enums": 355,
- "../memop": 372
- }],
- 380: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = t("../../core/vmath"),
- s = a(t("../../core/geom-utils")),
- o = a(t("../enums"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var h = r.mat4.create(),
- c = r.mat4.create(),
- u = r.mat4.create(),
- _ = r.mat4.create(),
- f = r.mat4.create(),
- d = cc.v3(),
- p = cc.v3(),
- m = (function() {
- function t() {
- l(this, t), this._poolID = -1, this._node = null, this._projection = o.default.PROJ_PERSPECTIVE, this._priority = 0, this._color = r.color4.create(.2, .3, .47, 1), this._depth = 1, this._stencil = 0, this._clearFlags = o.default.CLEAR_COLOR | o.default.CLEAR_DEPTH, this._clearModel = null, this._stages = [], this._framebuffer = null, this._near = .01, this._far = 1e3, this._fov = Math.PI / 4, this._rect = {
- x: 0,
- y: 0,
- w: 1,
- h: 1
- }, this._orthoHeight = 10, this._cullingMask = 4294967295
- }
- return t.prototype.setCullingMask = function(t) {
- this._cullingMask = t
- }, t.prototype.getNode = function() {
- return this._node
- }, t.prototype.setNode = function(t) {
- this._node = t
- }, t.prototype.getType = function() {
- return this._projection
- }, t.prototype.setType = function(t) {
- this._projection = t
- }, t.prototype.getPriority = function() {
- return this._priority
- }, t.prototype.setPriority = function(t) {
- this._priority = t
- }, t.prototype.getOrthoHeight = function() {
- return this._orthoHeight
- }, t.prototype.setOrthoHeight = function(t) {
- this._orthoHeight = t
- }, t.prototype.getFov = function() {
- return this._fov
- }, t.prototype.setFov = function(t) {
- this._fov = t
- }, t.prototype.getNear = function() {
- return this._near
- }, t.prototype.setNear = function(t) {
- this._near = t
- }, t.prototype.getFar = function() {
- return this._far
- }, t.prototype.setFar = function(t) {
- this._far = t
- }, t.prototype.getColor = function(t) {
- return r.color4.copy(t, this._color)
- }, t.prototype.setColor = function(t, e, i, n) {
- r.color4.set(this._color, t, e, i, n)
- }, t.prototype.getDepth = function() {
- return this._depth
- }, t.prototype.setDepth = function(t) {
- this._depth = t
- }, t.prototype.getStencil = function() {
- return this._stencil
- }, t.prototype.setStencil = function(t) {
- this._stencil = t
- }, t.prototype.getClearFlags = function() {
- return this._clearFlags
- }, t.prototype.setClearFlags = function(t) {
- this._clearFlags = t
- }, t.prototype.getRect = function(t) {
- return t.x = this._rect.x, t.y = this._rect.y, t.w = this._rect.w, t.h = this._rect.h, t
- }, t.prototype.setRect = function(t, e, i, n) {
- this._rect.x = t, this._rect.y = e, this._rect.w = i, this._rect.h = n
- }, t.prototype.getStages = function() {
- return this._stages
- }, t.prototype.setStages = function(t) {
- this._stages = t
- }, t.prototype.getFramebuffer = function() {
- return this._framebuffer
- }, t.prototype.setFrameBuffer = function(t) {
- this._framebuffer = t
- }, t.prototype._calcMatrices = function(t, e) {
- this._node.getWorldRT(c), r.mat4.invert(c, c);
- var i = t / e;
- if (this._projection === o.default.PROJ_PERSPECTIVE) r.mat4.perspective(u, this._fov, i, this._near, this._far);
- else {
- var n = this._orthoHeight * i,
- s = this._orthoHeight;
- r.mat4.ortho(u, -n, n, -s, s, this._near, this._far)
- }
- r.mat4.mul(_, u, c), r.mat4.invert(f, _)
- }, t.prototype.extractView = function(t, e, i) {
- this._framebuffer && (e = this._framebuffer._width, i = this._framebuffer._height), t._priority = this._priority, t._rect.x = this._rect.x * e, t._rect.y = this._rect.y * i, t._rect.w = this._rect.w * e, t._rect.h = this._rect.h * i, this.getColor(t._color), t._depth = this._depth, t._stencil = this._stencil, t._clearFlags = this._clearFlags, t._clearModel = this._clearModel, t._stages = this._stages, t._framebuffer = this._framebuffer, this._calcMatrices(e, i), r.mat4.copy(t._matView, c), r.mat4.copy(t._matProj, u), r.mat4.copy(t._matViewProj, _), r.mat4.copy(t._matInvViewProj, f), t._cullingMask = this._cullingMask
- }, t.prototype.screenPointToRay = function(t, e, i, n, a) {
- if (!s.default) return a;
- a = a || s.default.Ray.create(), this._calcMatrices(i, n);
- var l = this._rect.x * i,
- h = this._rect.y * n,
- c = this._rect.w * i,
- u = this._rect.h * n;
- return r.vec3.set(p, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, 1), r.vec3.transformMat4(p, p, f), this._projection === o.default.PROJ_PERSPECTIVE ? this._node.getWorldPosition(d) : (r.vec3.set(d, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, -1), r.vec3.transformMat4(d, d, f)), s.default.Ray.fromPoints(a, d, p)
- }, t.prototype.screenToWorld = function(t, e, i, n) {
- this._calcMatrices(i, n);
- var s = this._rect.x * i,
- a = this._rect.y * n,
- l = this._rect.w * i,
- h = this._rect.h * n;
- return this._projection === o.default.PROJ_PERSPECTIVE ? (r.vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - a) / h * 2 - 1, .9999), r.vec3.transformMat4(t, t, f), this._node.getWorldPosition(d), r.vec3.lerp(t, d, t, (0, r.lerp)(this._near / this._far, 1, e.z))) : (r.vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - a) / h * 2 - 1, 2 * e.z - 1), r.vec3.transformMat4(t, t, f)), t
- }, t.prototype.worldToScreen = function(t, e, i, n) {
- this._calcMatrices(i, n);
- var s = this._rect.x * i,
- o = this._rect.y * n,
- a = this._rect.w * i,
- l = this._rect.h * n;
- return r.vec3.transformMat4(t, e, _), t.x = s + .5 * (t.x + 1) * a, t.y = o + .5 * (t.y + 1) * l, t.z = .5 * t.z + .5, t
- }, t.prototype.worldMatrixToScreen = function(t, e, i, n) {
- this._calcMatrices(i, n), r.mat4.mul(t, _, e);
- var s = i / 2,
- o = n / 2;
- return r.mat4.identity(h), r.mat4.translate(h, h, r.vec3.set(d, s, o, 0)), r.mat4.scale(h, h, r.vec3.set(d, s, o, 1)), r.mat4.mul(t, h, t), t
- }, n(t, [{
- key: "cullingMask",
- get: function() {
- return this._cullingMask
- },
- set: function(t) {
- this._cullingMask = t
- }
- }]), t
- })();
- i.default = m, e.exports = i.default
- }), {
- "../../core/geom-utils": 136,
- "../../core/vmath": 326,
- "../enums": 355
- }],
- 381: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function() {
- function t(t, e) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
- return function(e, i, n) {
- return i && t(e.prototype, i), n && t(e, n), e
- }
- })(),
- r = t("../../core/vmath"),
- s = a(t("../gfx")),
- o = a(t("../enums"));
- function a(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- function l(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var h = r.vec3.create(0, 0, -1),
- c = r.mat4.create(),
- u = r.mat3.create(),
- _ = r.vec3.create(0, 0, 0);
- function f(t, e, i) {
- t._node.getWorldRT(e), r.mat4.invert(e, e), r.mat4.perspective(i, t._spotAngle * t._spotAngleScale, 1, t._shadowMinDepth, t._shadowMaxDepth)
- }
- function d(t, e, i) {
- t._node.getWorldRT(e), r.mat4.invert(e, e);
- var n = t._shadowFrustumSize / 2;
- r.mat4.ortho(i, -n, n, -n, n, t._shadowMinDepth, t._shadowMaxDepth)
- }
- function p(t, e, i) {
- t._node.getWorldRT(e), r.mat4.invert(e, e), r.mat4.perspective(i, (0, r.toRadian)(179), 1, t._shadowMinDepth, t._shadowMaxDepth)
- }
- var m = (function() {
- function t() {
- l(this, t), this._poolID = -1, this._node = null, this._type = o.default.LIGHT_DIRECTIONAL, this._color = r.color3.create(1, 1, 1), this._intensity = 1, this._range = 1, this._spotAngle = (0, r.toRadian)(60), this._spotExp = 1, this._directionUniform = new Float32Array(3), this._positionUniform = new Float32Array(3), this._colorUniform = new Float32Array([this._color.r * this._intensity, this._color.g * this._intensity, this._color.b * this._intensity]), this._spotUniform = new Float32Array([Math.cos(.5 * this._spotAngle), this._spotExp]), this._shadowType = o.default.SHADOW_NONE, this._shadowFrameBuffer = null, this._shadowMap = null, this._shadowMapDirty = !1, this._shadowDepthBuffer = null, this._shadowResolution = 1024, this._shadowBias = 5e-4, this._shadowDarkness = 1, this._shadowMinDepth = 1, this._shadowMaxDepth = 1e3, this._shadowDepthScale = 50, this._frustumEdgeFalloff = 0, this._viewProjMatrix = r.mat4.create(), this._spotAngleScale = 1, this._shadowFrustumSize = 50
- }
- return t.prototype.getNode = function() {
- return this._node
- }, t.prototype.setNode = function(t) {
- this._node = t
- }, t.prototype.setColor = function(t, e, i) {
- r.color3.set(this._color, t, e, i), this._colorUniform[0] = t * this._intensity, this._colorUniform[1] = e * this._intensity, this._colorUniform[2] = i * this._intensity
- }, t.prototype.setIntensity = function(t) {
- this._intensity = t, this._colorUniform[0] = t * this._color.r, this._colorUniform[1] = t * this._color.g, this._colorUniform[2] = t * this._color.b
- }, t.prototype.setType = function(t) {
- this._type = t
- }, t.prototype.setSpotAngle = function(t) {
- this._spotAngle = t, this._spotUniform[0] = Math.cos(.5 * this._spotAngle)
- }, t.prototype.setSpotExp = function(t) {
- this._spotExp = t, this._spotUniform[1] = t
- }, t.prototype.setRange = function(t) {
- this._range = t
- }, t.prototype.setShadowType = function(t) {
- this._shadowType === o.default.SHADOW_NONE && t !== o.default.SHADOW_NONE && (this._shadowMapDirty = !0), this._shadowType = t
- }, t.prototype.setShadowResolution = function(t) {
- this._shadowResolution !== t && (this._shadowMapDirty = !0), this._shadowResolution = t
- }, t.prototype.setShadowBias = function(t) {
- this._shadowBias = t
- }, t.prototype.setShadowDarkness = function(t) {
- this._shadowDarkness = t
- }, t.prototype.setShadowMinDepth = function(t) {
- this._shadowMinDepth = t
- }, t.prototype.setShadowMaxDepth = function(t) {
- this._shadowMaxDepth = t
- }, t.prototype.setShadowDepthScale = function(t) {
- this._shadowDepthScale = t
- }, t.prototype.setFrustumEdgeFalloff = function(t) {
- this._frustumEdgeFalloff = t
- }, t.prototype.setShadowFrustumSize = function(t) {
- this._shadowFrustumSize = t
- }, t.prototype.extractView = function(t, e) {
- switch (t._shadowLight = this, t._priority = -1, t._rect.x = 0, t._rect.y = 0, t._rect.w = this._shadowResolution, t._rect.h = this._shadowResolution, r.color4.set(t._color, 1, 1, 1, 1), t._depth = 1, t._stencil = 1, t._clearFlags = o.default.CLEAR_COLOR | o.default.CLEAR_DEPTH, t._stages = e, t._framebuffer = this._shadowFrameBuffer, this._type) {
- case o.default.LIGHT_SPOT:
- f(this, t._matView, t._matProj);
- break;
- case o.default.LIGHT_DIRECTIONAL:
- d(this, t._matView, t._matProj);
- break;
- case o.default.LIGHT_POINT:
- p(this, t._matView, t._matProj);
- break;
- case o.default.LIGHT_AMBIENT:
- break;
- default:
- console.warn("shadow of this light type is not supported")
- }
- r.mat4.mul(t._matViewProj, t._matProj, t._matView), this._viewProjMatrix = t._matViewProj, r.mat4.invert(t._matInvViewProj, t._matViewProj), t._cullingMask = 4294967295
- }, t.prototype._updateLightPositionAndDirection = function() {
- this._node.getWorldMatrix(c), r.mat3.fromMat4(u, c), r.vec3.transformMat3(_, h, u), r.vec3.array(this._directionUniform, _);
- var t = this._positionUniform,
- e = c.m;
- t[0] = e[12], t[1] = e[13], t[2] = e[14]
- }, t.prototype._generateShadowMap = function(t) {
- this._shadowMap = new s.default.Texture2D(t, {
- width: this._shadowResolution,
- height: this._shadowResolution,
- format: s.default.TEXTURE_FMT_RGBA8,
- wrapS: s.default.WRAP_CLAMP,
- wrapT: s.default.WRAP_CLAMP
- }), this._shadowDepthBuffer = new s.default.RenderBuffer(t, s.default.RB_FMT_D16, this._shadowResolution, this._shadowResolution), this._shadowFrameBuffer = new s.default.FrameBuffer(t, this._shadowResolution, this._shadowResolution, {
- colors: [this._shadowMap],
- depth: this._shadowDepthBuffer
- })
- }, t.prototype._destroyShadowMap = function() {
- this._shadowMap && (this._shadowMap.destroy(), this._shadowDepthBuffer.destroy(), this._shadowFrameBuffer.destroy(), this._shadowMap = null, this._shadowDepthBuffer = null, this._shadowFrameBuffer = null)
- }, t.prototype.update = function(t) {
- this._updateLightPositionAndDirection(), this._shadowType === o.default.SHADOW_NONE ? this._destroyShadowMap() : this._shadowMapDirty && (this._destroyShadowMap(), this._generateShadowMap(t), this._shadowMapDirty = !1)
- }, n(t, [{
- key: "color",
- get: function() {
- return this._color
- }
- }, {
- key: "intensity",
- get: function() {
- return this._intensity
- }
- }, {
- key: "type",
- get: function() {
- return this._type
- }
- }, {
- key: "spotAngle",
- get: function() {
- return this._spotAngle
- }
- }, {
- key: "spotExp",
- get: function() {
- return this._spotExp
- }
- }, {
- key: "range",
- get: function() {
- return this._range
- }
- }, {
- key: "shadowType",
- get: function() {
- return this._shadowType
- }
- }, {
- key: "shadowMap",
- get: function() {
- return this._shadowMap
- }
- }, {
- key: "viewProjMatrix",
- get: function() {
- return this._viewProjMatrix
- }
- }, {
- key: "shadowResolution",
- get: function() {
- return this._shadowResolution
- }
- }, {
- key: "shadowBias",
- get: function() {
- return this._shadowBias
- }
- }, {
- key: "shadowDarkness",
- get: function() {
- return this._shadowDarkness
- }
- }, {
- key: "shadowMinDepth",
- get: function() {
- return this._type === o.default.LIGHT_DIRECTIONAL ? 1 : this._shadowMinDepth
- }
- }, {
- key: "shadowMaxDepth",
- get: function() {
- return this._type === o.default.LIGHT_DIRECTIONAL ? 1 : this._shadowMaxDepth
- }
- }, {
- key: "shadowDepthScale",
- get: function() {
- return this._shadowDepthScale
- }
- }, {
- key: "frustumEdgeFalloff",
- get: function() {
- return this._frustumEdgeFalloff
- }
- }, {
- key: "shadowFrustumSize",
- get: function() {
- return this._shadowFrustumSize
- }
- }]), t
- })();
- i.default = m, e.exports = i.default
- }), {
- "../../core/vmath": 326,
- "../enums": 355,
- "../gfx": 360
- }],
- 382: [(function(t, e, i) {
- "use strict";
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- i.__esModule = !0;
- var r = (function() {
- function t() {
- n(this, t), this._type = "default", this._poolID = -1, this._node = null, this._inputAssembler = null, this._effect = null, this._viewID = -1, this._cameraID = -1, this._userKey = -1, this._castShadow = !1, this._boundingShape = null, this._defines = [], this._uniforms = []
- }
- return t.prototype.setNode = function(t) {
- this._node = t
- }, t.prototype.setInputAssembler = function(t) {
- this._inputAssembler = t
- }, t.prototype.setEffect = function(t, e) {
- this._effect = t;
- var i = this._defines,
- n = this._uniforms;
- i.length = 0, n.length = 0, t && (i.push(t._defines), n.push(t._properties)), e && (i.push(e._defines), n.push(e._properties))
- }, t.prototype.setUserKey = function(t) {
- this._userKey = t
- }, t.prototype.extractDrawItem = function(t) {
- t.model = this, t.node = this._node, t.ia = this._inputAssembler, t.effect = this._effect, t.defines = this._defines, t.dependencies = this._dependencies, t.uniforms = this._uniforms
- }, t
- })();
- i.default = r, e.exports = i.default
- }), {}],
- 383: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0;
- var n = t("../memop");
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- var s = (function() {
- function t(e) {
- r(this, t), this._lights = new n.FixedArray(16), this._models = new n.FixedArray(16), this._cameras = new n.FixedArray(16), this._debugCamera = null, this._app = e, this._views = []
- }
- return t.prototype._add = function(t, e) {
- -1 === e._poolID && (t.push(e), e._poolID = t.length - 1)
- }, t.prototype._remove = function(t, e) {
- -1 !== e._poolID && (t.data[t.length - 1]._poolID = e._poolID, t.fastRemove(e._poolID), e._poolID = -1)
- }, t.prototype.reset = function() {
- for (var t = 0; t < this._models.length; ++t) {
- this._models.data[t]._viewID = -1
- }
- }, t.prototype.setDebugCamera = function(t) {
- this._debugCamera = t
- }, t.prototype.getCameraCount = function() {
- return this._cameras.length
- }, t.prototype.getCamera = function(t) {
- return this._cameras.data[t]
- }, t.prototype.addCamera = function(t) {
- this._add(this._cameras, t)
- }, t.prototype.removeCamera = function(t) {
- this._remove(this._cameras, t)
- }, t.prototype.getModelCount = function() {
- return this._models.length
- }, t.prototype.getModel = function(t) {
- return this._models.data[t]
- }, t.prototype.addModel = function(t) {
- this._add(this._models, t)
- }, t.prototype.removeModel = function(t) {
- this._remove(this._models, t)
- }, t.prototype.getLightCount = function() {
- return this._lights.length
- }, t.prototype.getLight = function(t) {
- return this._lights.data[t]
- }, t.prototype.addLight = function(t) {
- this._add(this._lights, t)
- }, t.prototype.removeLight = function(t) {
- this._remove(this._lights, t)
- }, t.prototype.addView = function(t) {
- -1 === this._views.indexOf(t) && this._views.push(t)
- }, t.prototype.removeView = function(t) {
- var e = this._views.indexOf(t); - 1 !== e && this._views.splice(e, 1)
- }, t
- })();
- i.default = s, e.exports = i.default
- }), {
- "../memop": 372
- }],
- 384: [(function(t, e, i) {
- "use strict";
- var n, r, s, o;
- i.__esModule = !0, i.getClassName = i.getInstanceCtor = i.getInstanceType = i.enums2default = i.ctor2enums = void 0, i.getInspectorProps = function(t) {
- var e = {
- type: t.type
- };
- Object.assign(e, t.inspector), e.defines = t.defines, e.value = m(e.type)(t.value);
- var i = y(e.type);
- e.typeName = v[i] || i, "cc.Texture2D" == e.typeName && (e.typeName = "cc.Asset", e.assetType = "cc.Texture2D");
- return e
- };
- var a = c(t("./enums")),
- l = t("../core/value-types"),
- h = c(t("../core/assets/CCTexture2D"));
- function c(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- var u = null;
- u = t("./gfx/texture-2d");
- var _ = cc.Object,
- f = ((n = {})[Boolean] = function(t) {
- return t || !1
- }, n[Number] = function(t) {
- return t ? ArrayBuffer.isView(t) ? t[0] : t : 0
- }, n[l.Vec2] = function(t) {
- return t ? cc.v2(t[0], t[1]) : cc.v2()
- }, n[l.Vec3] = function(t) {
- return t ? cc.v3(t[0], t[1], t[2]) : cc.v3()
- }, n[l.Vec4] = function(t) {
- return t ? cc.v4(t[0], t[1], t[2], t[3]) : cc.v4()
- }, n[l.Color] = function(t) {
- return t ? cc.color(255 * t[0], 255 * t[1], 255 * t[2], 255 * (t[3] || 1)) : cc.color()
- }, n[l.Mat4] = function(t) {
- return t ? cc.mat4(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]) : cc.mat4()
- }, n[h.default] = function() {
- return null
- }, n[_] = function() {
- return null
- }, n),
- d = ((r = {})[a.default.PARAM_INT] = Number, r[a.default.PARAM_INT2] = l.Vec2, r[a.default.PARAM_INT3] = l.Vec3, r[a.default.PARAM_INT4] = l.Vec4, r[a.default.PARAM_FLOAT] = Number, r[a.default.PARAM_FLOAT2] = l.Vec2, r[a.default.PARAM_FLOAT3] = l.Vec3, r[a.default.PARAM_FLOAT4] = l.Vec4, r[a.default.PARAM_MAT4] = l.Mat4, r[a.default.PARAM_TEXTURE_2D] = h.default, r.color = l.Color, r.number = Number, r.boolean = Boolean, r.default = _, r),
- p = (i.ctor2enums = ((s = {})[Number] = a.default.PARAM_FLOAT, s[l.Vec2] = a.default.PARAM_FLOAT2, s[l.Vec3] = a.default.PARAM_FLOAT3, s[l.Vec4] = a.default.PARAM_FLOAT4, s[l.Color] = a.default.PARAM_COLOR3, s[l.Color] = a.default.PARAM_COLOR4, s[l.Mat4] = a.default.PARAM_MAT4, s[h.default] = a.default.PARAM_TEXTURE_2D, s[u] = a.default.PARAM_TEXTURE_2D, s), i.enums2default = ((o = {})[a.default.PARAM_INT] = new Uint32Array([0]), o[a.default.PARAM_INT2] = new Uint32Array([0, 0]), o[a.default.PARAM_INT3] = new Uint32Array([0, 0, 0]), o[a.default.PARAM_INT4] = new Uint32Array([0, 0, 0, 0]), o[a.default.PARAM_FLOAT] = new Float32Array([0]), o[a.default.PARAM_FLOAT2] = new Float32Array([0, 0]), o[a.default.PARAM_FLOAT3] = new Float32Array([0, 0, 0]), o[a.default.PARAM_FLOAT4] = new Float32Array([0, 0, 0, 0]), o[a.default.PARAM_MAT4] = cc.mat4().m, o[a.default.PARAM_TEXTURE_2D] = null, o.number = 0, o.boolean = !1, o), i.getInstanceType = function(t) {
- return d[t] || d.default
- }),
- m = i.getInstanceCtor = function(t) {
- return f[p(t)]
- },
- y = i.getClassName = function(t) {
- return cc.js.getClassName(p(t))
- },
- v = {
- Number: "number",
- Boolean: "boolean"
- }
- }), {
- "../core/assets/CCTexture2D": 73,
- "../core/value-types": 315,
- "./enums": 355,
- "./gfx/texture-2d": 365
- }],
- 385: [(function(t, e, i) {
- "use strict";
- var n = t("../compression/ZipUtils"),
- r = t("../compression/zlib.min"),
- s = t("../core/platform/js");
- function o(t) {
- if (t.length % 4 != 0) return null;
- for (var e = t.length / 4, i = window.Uint32Array ? new Uint32Array(e) : [], n = 0; n < e; n++) {
- var r = 4 * n;
- i[n] = t[r] + 256 * t[r + 1] + 65536 * t[r + 2] + t[r + 3] * (1 << 24)
- }
- return i
- }
- function a(t) {
- var e = cc.Label.HorizontalAlign;
- switch (t) {
- case "center":
- return e.CENTER;
- case "right":
- return e.RIGHT;
- default:
- return e.LEFT
- }
- }
- function l(t) {
- var e = cc.Label.VerticalAlign;
- switch (t) {
- case "center":
- return e.CENTER;
- case "bottom":
- return e.BOTTOM;
- default:
- return e.TOP
- }
- }
- function h(t) {
- if (!t) return cc.color(0, 0, 0, 255);
- if (8 === (t = -1 !== t.indexOf("#") ? t.substring(1) : t).length) {
- var e = parseInt(t.substr(0, 2), 16) || 255,
- i = parseInt(t.substr(2, 2), 16) || 0,
- n = parseInt(t.substr(4, 2), 16) || 0,
- r = parseInt(t.substr(6, 2), 16) || 0;
- return cc.color(i, n, r, e)
- }
- var s = parseInt(t.substr(0, 2), 16) || 0,
- o = parseInt(t.substr(2, 2), 16) || 0,
- a = parseInt(t.substr(4, 2), 16) || 0;
- return cc.color(s, o, a, 255)
- }
- function c(t, e) {
- for (var i = [], n = t.getElementsByTagName("properties"), r = 0; r < n.length; ++r)
- for (var s = n[r].getElementsByTagName("property"), o = 0; o < s.length; ++o) i.push(s[o]);
- e = e || {};
- for (var a = 0; a < i.length; a++) {
- var l = i[a],
- c = l.getAttribute("name"),
- u = l.getAttribute("type") || "string",
- _ = l.getAttribute("value");
- "int" === u ? _ = parseInt(_) : "float" === u ? _ = parseFloat(_) : "bool" === u ? _ = "true" === _ : "color" === u && (_ = h(_)), e[c] = _
- }
- return e
- }
- t("../core/platform/CCSAXParser"), cc.TMXLayerInfo = function() {
- this.properties = {}, this.name = "", this._layerSize = null, this._tiles = [], this.visible = !0, this._opacity = 0, this.ownTiles = !0, this._minGID = 1e5, this._maxGID = 0, this.offset = cc.v2(0, 0)
- }, cc.TMXLayerInfo.prototype = {
- constructor: cc.TMXLayerInfo,
- getProperties: function() {
- return this.properties
- },
- setProperties: function(t) {
- this.properties = t
- }
- }, cc.TMXImageLayerInfo = function() {
- this.name = "", this.visible = !0, this.width = 0, this.height = 0, this.offset = cc.v2(0, 0), this._opacity = 0, this._trans = new cc.Color(255, 255, 255, 255), this.sourceImage = null
- }, cc.TMXObjectGroupInfo = function() {
- this.properties = {}, this.name = "", this._objects = [], this.visible = !0, this._opacity = 0, this._color = new cc.Color(255, 255, 255, 255), this.offset = cc.v2(0, 0), this._draworder = "topdown"
- }, cc.TMXObjectGroupInfo.prototype = {
- constructor: cc.TMXObjectGroupInfo,
- getProperties: function() {
- return this.properties
- },
- setProperties: function(t) {
- this.properties = t
- }
- }, cc.TMXTilesetInfo = function() {
- this.name = "", this.firstGid = 0, this.spacing = 0, this.margin = 0, this.sourceImage = null, this.imageSize = cc.size(0, 0), this.tileOffset = cc.v2(0, 0), this._tileSize = cc.size(0, 0)
- }, cc.TMXTilesetInfo.prototype = {
- constructor: cc.TMXTilesetInfo,
- rectForGID: function(t, e) {
- var i = e || cc.rect(0, 0, 0, 0);
- i.width = this._tileSize.width, i.height = this._tileSize.height, t &= cc.TiledMap.TileFlag.FLIPPED_MASK, t -= parseInt(this.firstGid, 10);
- var n = parseInt((this.imageSize.width - 2 * this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10);
- return i.x = parseInt(t % n * (this._tileSize.width + this.spacing) + this.margin, 10), i.y = parseInt(parseInt(t / n, 10) * (this._tileSize.height + this.spacing) + this.margin, 10), i
- }
- }, cc.TMXMapInfo = function(t, e, i, n) {
- this.properties = [], this.orientation = null, this.parentElement = null, this.parentGID = null, this.layerAttrs = 0, this.storingCharacters = !1, this.currentString = null, this.renderOrder = cc.TiledMap.RenderOrder.RightDown, this._supportVersion = [1, 2, 0], this._parser = new cc.SAXParser, this._objectGroups = [], this._allChildren = [], this._mapSize = cc.size(0, 0), this._tileSize = cc.size(0, 0), this._layers = [], this._tilesets = [], this._imageLayers = [], this._tileProperties = {}, this._tileAnimations = {}, this._tsxMap = null, this._textures = null, this._staggerAxis = null, this._staggerIndex = null, this._hexSideLength = 0, this._imageLayerTextures = null, this.initWithXML(t, e, i, n)
- }, cc.TMXMapInfo.prototype = {
- constructor: cc.TMXMapInfo,
- getOrientation: function() {
- return this.orientation
- },
- setOrientation: function(t) {
- this.orientation = t
- },
- getStaggerAxis: function() {
- return this._staggerAxis
- },
- setStaggerAxis: function(t) {
- this._staggerAxis = t
- },
- getStaggerIndex: function() {
- return this._staggerIndex
- },
- setStaggerIndex: function(t) {
- this._staggerIndex = t
- },
- getHexSideLength: function() {
- return this._hexSideLength
- },
- setHexSideLength: function(t) {
- this._hexSideLength = t
- },
- getMapSize: function() {
- return cc.size(this._mapSize.width, this._mapSize.height)
- },
- setMapSize: function(t) {
- this._mapSize.width = t.width, this._mapSize.height = t.height
- },
- _getMapWidth: function() {
- return this._mapSize.width
- },
- _setMapWidth: function(t) {
- this._mapSize.width = t
- },
- _getMapHeight: function() {
- return this._mapSize.height
- },
- _setMapHeight: function(t) {
- this._mapSize.height = t
- },
- getTileSize: function() {
- return cc.size(this._tileSize.width, this._tileSize.height)
- },
- setTileSize: function(t) {
- this._tileSize.width = t.width, this._tileSize.height = t.height
- },
- _getTileWidth: function() {
- return this._tileSize.width
- },
- _setTileWidth: function(t) {
- this._tileSize.width = t
- },
- _getTileHeight: function() {
- return this._tileSize.height
- },
- _setTileHeight: function(t) {
- this._tileSize.height = t
- },
- getLayers: function() {
- return this._layers
- },
- setLayers: function(t) {
- this._allChildren.push(t), this._layers.push(t)
- },
- getImageLayers: function() {
- return this._imageLayers
- },
- setImageLayers: function(t) {
- this._allChildren.push(t), this._imageLayers.push(t)
- },
- getTilesets: function() {
- return this._tilesets
- },
- setTilesets: function(t) {
- this._tilesets.push(t)
- },
- getObjectGroups: function() {
- return this._objectGroups
- },
- setObjectGroups: function(t) {
- this._allChildren.push(t), this._objectGroups.push(t)
- },
- getAllChildren: function() {
- return this._allChildren
- },
- getParentElement: function() {
- return this.parentElement
- },
- setParentElement: function(t) {
- this.parentElement = t
- },
- getParentGID: function() {
- return this.parentGID
- },
- setParentGID: function(t) {
- this.parentGID = t
- },
- getLayerAttribs: function() {
- return this.layerAttrs
- },
- setLayerAttribs: function(t) {
- this.layerAttrs = t
- },
- getStoringCharacters: function() {
- return this.storingCharacters
- },
- setStoringCharacters: function(t) {
- this.storingCharacters = t
- },
- getProperties: function() {
- return this.properties
- },
- setProperties: function(t) {
- this.properties = t
- },
- initWithXML: function(t, e, i, n) {
- return this._tilesets.length = 0, this._layers.length = 0, this._imageLayers.length = 0, this._tsxMap = e, this._textures = i, this._imageLayerTextures = n, this._objectGroups.length = 0, this._allChildren.length = 0, this.properties.length = 0, this._tileProperties = {}, this._tileAnimations = {}, this.currentString = "", this.storingCharacters = !1, this.layerAttrs = cc.TMXLayerInfo.ATTRIB_NONE, this.parentElement = cc.TiledMap.NONE, this.parseXMLString(t)
- },
- parseXMLString: function(t, e) {
- var i = void 0,
- n = this._parser._parseXML(t).documentElement,
- r = n.getAttribute("orientation"),
- s = n.getAttribute("staggeraxis"),
- o = n.getAttribute("staggerindex"),
- a = n.getAttribute("hexsidelength"),
- l = n.getAttribute("renderorder"),
- h = n.getAttribute("version") || "1.0.0";
- if ("map" === n.nodeName) {
- for (var u = h.split("."), _ = this._supportVersion, f = 0; f < _.length; f++) {
- var d = parseInt(u[f]) || 0;
- if (_[f] < d) {
- cc.logID(7216, h);
- break
- }
- }
- "orthogonal" === r ? this.orientation = cc.TiledMap.Orientation.ORTHO : "isometric" === r ? this.orientation = cc.TiledMap.Orientation.ISO : "hexagonal" === r ? this.orientation = cc.TiledMap.Orientation.HEX : null !== r && cc.logID(7217, r), this.renderOrder = "right-up" === l ? cc.TiledMap.RenderOrder.RightUp : "left-up" === l ? cc.TiledMap.RenderOrder.LeftUp : "left-down" === l ? cc.TiledMap.RenderOrder.LeftDown : cc.TiledMap.RenderOrder.RightDown, "x" === s ? this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_X) : "y" === s && this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_Y), "odd" === o ? this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD) : "even" === o && this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_EVEN), a && this.setHexSideLength(parseFloat(a));
- var p = cc.size(0, 0);
- p.width = parseFloat(n.getAttribute("width")), p.height = parseFloat(n.getAttribute("height")), this.setMapSize(p), (p = cc.size(0, 0)).width = parseFloat(n.getAttribute("tilewidth")), p.height = parseFloat(n.getAttribute("tileheight")), this.setTileSize(p), this.properties = c(n)
- }
- var m = n.getElementsByTagName("tileset");
- for ("map" !== n.nodeName && (m = []).push(n), i = 0; i < m.length; i++) {
- var y = m[i],
- v = y.getAttribute("source");
- if (v) {
- var g = parseInt(y.getAttribute("firstgid")),
- x = this._tsxMap[v];
- x && this.parseXMLString(x, g)
- } else {
- var b = y.getElementsByTagName("image"),
- A = b.length > 1,
- C = b[0],
- T = C.getAttribute("source");
- T.replace(/\\/g, "/");
- var S = y.getElementsByTagName("tile"),
- w = S && S.length || 1,
- E = null,
- M = y.getAttribute("name") || "",
- D = parseInt(y.getAttribute("spacing")) || 0,
- B = parseInt(y.getAttribute("margin")) || 0,
- I = parseInt(e);
- I || (I = parseInt(y.getAttribute("firstgid")) || 0);
- var P = cc.size(0, 0);
- P.width = parseFloat(y.getAttribute("tilewidth")), P.height = parseFloat(y.getAttribute("tileheight"));
- var R = y.getElementsByTagName("tileoffset")[0],
- O = cc.v2(0, 0);
- R && (O.x = parseFloat(R.getAttribute("x")), O.y = parseFloat(R.getAttribute("y")));
- for (var L = null, F = 0; F < w; F++)
- if (L && !A || ((L = new cc.TMXTilesetInfo).name = M, L.firstGid = I, L.spacing = D, L.margin = B, L._tileSize = P, L.tileOffset = O, L.sourceImage = this._textures[T], L.sourceImage || cc.errorID(7221, T), this.setTilesets(L)), E = S && S[F]) {
- this.parentGID = parseInt(I) + parseInt(E.getAttribute("id") || 0);
- var N = E.getElementsByTagName("image");
- if (N && N.length > 0) {
- var V = (C = N[0]).getAttribute("source");
- V.replace(/\\/g, "/"), L.sourceImage = this._textures[V], L.sourceImage || cc.errorID(7221, V);
- var k = cc.size(0, 0);
- k.width = parseFloat(C.getAttribute("width")), k.height = parseFloat(C.getAttribute("height")), L._tileSize = k, L.firstGid = this.parentGID
- }
- this._tileProperties[this.parentGID] = c(E);
- var G = E.getElementsByTagName("animation");
- if (G && G.length > 0) {
- var U = G[0].getElementsByTagName("frame"),
- z = {
- frames: [],
- dt: 0,
- frameIdx: 0
- };
- this._tileAnimations[this.parentGID] = z;
- for (var j = z.frames, W = 0; W < U.length; W++) {
- var H = U[W],
- X = parseInt(I) + parseInt(H.getAttribute("tileid")),
- Y = parseFloat(H.getAttribute("duration"));
- j.push({
- tileid: X,
- duration: Y / 1e3,
- grid: null
- })
- }
- }
- }
- }
- }
- var q = n.childNodes;
- for (i = 0; i < q.length; i++) {
- var J = q[i];
- if (!this._shouldIgnoreNode(J)) {
- if ("imagelayer" === J.nodeName) {
- var Z = this._parseImageLayer(J);
- Z && this.setImageLayers(Z)
- }
- if ("layer" === J.nodeName) {
- var K = this._parseLayer(J);
- this.setLayers(K)
- }
- if ("objectgroup" === J.nodeName) {
- var Q = this._parseObjectGroup(J);
- this.setObjectGroups(Q)
- }
- }
- }
- return n
- },
- _shouldIgnoreNode: function(t) {
- return 3 === t.nodeType || 8 === t.nodeType || 4 === t.nodeType
- },
- _parseImageLayer: function(t) {
- var e = t.getElementsByTagName("image");
- if (!e || 0 == e.length) return null;
- var i = new cc.TMXImageLayerInfo;
- i.name = t.getAttribute("name"), i.offset.x = parseFloat(t.getAttribute("offsetx")) || 0, i.offset.y = parseFloat(t.getAttribute("offsety")) || 0;
- var n = t.getAttribute("visible");
- i.visible = !("0" === n);
- var r = t.getAttribute("opacity") || 1;
- i.opacity = parseInt(255 * parseFloat(r)) || 255;
- var s = e[0],
- o = s.getAttribute("source");
- return i.sourceImage = this._imageLayerTextures[o], i.width = parseInt(s.getAttribute("width")) || 0, i.height = parseInt(s.getAttribute("height")) || 0, i.trans = h(s.getAttribute("trans")), i.sourceImage ? i : (cc.errorID(7221, o), null)
- },
- _parseLayer: function(t) {
- var e = t.getElementsByTagName("data")[0],
- i = new cc.TMXLayerInfo;
- i.name = t.getAttribute("name");
- var s = cc.size(0, 0);
- s.width = parseFloat(t.getAttribute("width")), s.height = parseFloat(t.getAttribute("height")), i._layerSize = s;
- var a = t.getAttribute("visible");
- i.visible = !("0" === a);
- var l = t.getAttribute("opacity") || 1;
- i._opacity = l ? parseInt(255 * parseFloat(l)) : 255, i.offset = cc.v2(parseFloat(t.getAttribute("offsetx")) || 0, parseFloat(t.getAttribute("offsety")) || 0);
- for (var h = "", u = 0; u < e.childNodes.length; u++) h += e.childNodes[u].nodeValue;
- h = h.trim();
- var _ = e.getAttribute("compression"),
- f = e.getAttribute("encoding");
- if (_ && "gzip" !== _ && "zlib" !== _) return cc.logID(7218), null;
- var d = void 0;
- switch (_) {
- case "gzip":
- d = n.unzipBase64AsArray(h, 4);
- break;
- case "zlib":
- d = o(new r.Inflate(n.Base64.decodeAsArray(h, 1)).decompress());
- break;
- case null:
- case "":
- if ("base64" === f) d = n.Base64.decodeAsArray(h, 4);
- else if ("csv" === f) {
- d = [];
- for (var p = h.split(","), m = 0; m < p.length; m++) d.push(parseInt(p[m]))
- } else {
- var y = e.getElementsByTagName("tile");
- d = [];
- for (var v = 0; v < y.length; v++) d.push(parseInt(y[v].getAttribute("gid")))
- }
- break;
- default:
- this.layerAttrs === cc.TMXLayerInfo.ATTRIB_NONE && cc.logID(7219)
- }
- return d && (i._tiles = new Uint32Array(d)), i.properties = c(t), i
- },
- _parseObjectGroup: function(t) {
- var e = new cc.TMXObjectGroupInfo;
- e.name = t.getAttribute("name") || "", e.offset = cc.v2(parseFloat(t.getAttribute("offsetx")), parseFloat(t.getAttribute("offsety")));
- var i = t.getAttribute("opacity") || 1;
- e._opacity = i ? parseInt(255 * parseFloat(i)) : 255;
- var n = t.getAttribute("visible");
- n && 0 === parseInt(n) && (e.visible = !1);
- var r = t.getAttribute("color");
- r && e._color.fromHEX(r);
- var s = t.getAttribute("draworder");
- s && (e._draworder = s), e.setProperties(c(t));
- var o = t.getElementsByTagName("object");
- if (o)
- for (var u = 0; u < o.length; u++) {
- var _ = o[u],
- f = {};
- f.id = _.getAttribute("id") || 0, f.name = _.getAttribute("name") || "", f.width = parseFloat(_.getAttribute("width")) || 0, f.height = parseFloat(_.getAttribute("height")) || 0, f.x = parseFloat(_.getAttribute("x")) || 0, f.y = parseFloat(_.getAttribute("y")) || 0, f.rotation = parseFloat(_.getAttribute("rotation")) || 0, c(_, f);
- var d = _.getAttribute("visible");
- f.visible = !(d && 0 === parseInt(d));
- var p = _.getElementsByTagName("text");
- if (p && p.length > 0) {
- var m = p[0];
- f.type = cc.TiledMap.TMXObjectType.TEXT, f.wrap = "1" == m.getAttribute("wrap"), f.color = h(m.getAttribute("color")), f.halign = a(m.getAttribute("halign")), f.valign = l(m.getAttribute("valign")), f.pixelsize = parseInt(m.getAttribute("pixelsize")) || 16, f.text = m.childNodes[0].nodeValue
- }
- var y = _.getAttribute("gid");
- y && (f.gid = parseInt(y), f.type = cc.TiledMap.TMXObjectType.IMAGE);
- var v = _.getElementsByTagName("ellipse");
- v && v.length > 0 && (f.type = cc.TiledMap.TMXObjectType.ELLIPSE);
- var g = _.getElementsByTagName("polygon");
- if (g && g.length > 0) {
- f.type = cc.TiledMap.TMXObjectType.POLYGON;
- var x = g[0].getAttribute("points");
- x && (f.points = this._parsePointsString(x))
- }
- var b = _.getElementsByTagName("polyline");
- if (b && b.length > 0) {
- f.type = cc.TiledMap.TMXObjectType.POLYLINE;
- var A = b[0].getAttribute("points");
- A && (f.polylinePoints = this._parsePointsString(A))
- }
- f.type || (f.type = cc.TiledMap.TMXObjectType.RECT), e._objects.push(f)
- }
- return e
- },
- _parsePointsString: function(t) {
- if (!t) return null;
- for (var e = [], i = t.split(" "), n = 0; n < i.length; n++) {
- var r = i[n].split(",");
- e.push({
- x: parseFloat(r[0]),
- y: parseFloat(r[1])
- })
- }
- return e
- },
- setTileAnimations: function(t) {
- this._tileAnimations = t
- },
- getTileAnimations: function() {
- return this._tileAnimations
- },
- getTileProperties: function() {
- return this._tileProperties
- },
- setTileProperties: function(t) {
- this._tileProperties = t
- },
- getCurrentString: function() {
- return this.currentString
- },
- setCurrentString: function(t) {
- this.currentString = t
- }
- };
- var u = cc.TMXMapInfo.prototype;
- s.getset(u, "mapWidth", u._getMapWidth, u._setMapWidth), s.getset(u, "mapHeight", u._getMapHeight, u._setMapHeight), s.getset(u, "tileWidth", u._getTileWidth, u._setTileWidth), s.getset(u, "tileHeight", u._getTileHeight, u._setTileHeight), cc.TMXLayerInfo.ATTRIB_NONE = 1, cc.TMXLayerInfo.ATTRIB_BASE64 = 2, cc.TMXLayerInfo.ATTRIB_GZIP = 4, cc.TMXLayerInfo.ATTRIB_ZLIB = 8
- }), {
- "../compression/ZipUtils": 22,
- "../compression/zlib.min": 25,
- "../core/platform/CCSAXParser": 205,
- "../core/platform/js": 218
- }],
- 386: [(function(t, e, i) {
- "use strict";
- var n = t("../core/vmath"),
- r = t("../core/components/CCRenderComponent"),
- s = t("../core/assets/material/CCMaterial"),
- o = t("../core/renderer/render-flow"),
- a = n.mat4.create(),
- l = n.vec2.create(),
- h = n.vec2.create(),
- c = {
- row: 0,
- col: 0
- },
- u = cc.Class({
- name: "cc.TiledUserNodeData",
- extends: cc.Component,
- ctor: function() {
- this._index = -1, this._row = -1, this._col = -1, this._tiledLayer = null
- }
- }),
- _ = cc.Class({
- name: "cc.TiledLayer",
- extends: r,
- editor: {
- inspector: "packages://inspector/inspectors/comps/tiled-layer.js"
- },
- ctor: function() {
- this._userNodeGrid = {}, this._userNodeMap = {}, this._userNodeDirty = !1, this._tiledTiles = [], this._tilesetIndexArr = [], this._texIdToMatIndex = {}, this._viewPort = {
- x: -1,
- y: -1,
- width: -1,
- height: -1
- }, this._cullingRect = {
- leftDown: {
- row: -1,
- col: -1
- },
- rightTop: {
- row: -1,
- col: -1
- }
- }, this._cullingDirty = !0, this._rightTop = {
- row: -1,
- col: -1
- }, this._layerInfo = null, this._mapInfo = null, this._topOffset = 0, this._downOffset = 0, this._leftOffset = 0, this._rightOffset = 0, this._tiles = [], this._vertices = [], this._verticesDirty = !0, this._layerName = "", this._layerOrientation = null, this._texGrids = null, this._textures = null, this._tilesets = null, this._leftDownToCenterX = 0, this._leftDownToCenterY = 0, this._hasTiledNodeGrid = !1, this._hasAniGrid = !1, this._animations = null, this._enableCulling = cc.macro.ENABLE_TILEDMAP_CULLING
- },
- _hasTiledNode: function() {
- return this._hasTiledNodeGrid
- },
- _hasAnimation: function() {
- return this._hasAniGrid
- },
- enableCulling: function(t) {
- this._enableCulling != t && (this._enableCulling = t, this._cullingDirty = !0)
- },
- addUserNode: function(t) {
- var e = t.getComponent(u);
- return e ? (cc.warn("CCTiledLayer:addUserNode node has been added"), !1) : (e = t.addComponent(u), t.parent = this.node, t._renderFlag |= o.FLAG_BREAK_FLOW, this._userNodeMap[t._id] = e, e._row = -1, e._col = -1, e._tiledLayer = this, this._nodeLocalPosToLayerPos(t, l), this._positionToRowCol(l.x, l.y, c), this._addUserNodeToGrid(e, c), this._updateCullingOffsetByUserNode(t), t.on(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), t.on(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), !0)
- },
- removeUserNode: function(t) {
- var e = t.getComponent(u);
- return e ? (t.off(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), t.off(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), this._removeUserNodeFromGrid(e), delete this._userNodeMap[t._id], t._removeComponent(e), e.destroy(), t.removeFromParent(!0), t._renderFlag &= ~o.FLAG_BREAK_FLOW, !0) : (cc.warn("CCTiledLayer:removeUserNode node is not exist"), !1)
- },
- destroyUserNode: function(t) {
- this.removeUserNode(t), t.destroy()
- },
- _nodeLocalPosToLayerPos: function(t, e) {
- e.x = t.x + this._leftDownToCenterX, e.y = t.y + this._leftDownToCenterY
- },
- _getNodesByRowCol: function(t, e) {
- var i = this._userNodeGrid[t];
- return i ? i[e] : null
- },
- _getNodesCountByRow: function(t) {
- var e = this._userNodeGrid[t];
- return e ? e.count : 0
- },
- _updateAllUserNode: function() {
- for (var t in this._userNodeGrid = {}, this._userNodeMap) {
- var e = this._userNodeMap[t];
- this._nodeLocalPosToLayerPos(e.node, l), this._positionToRowCol(l.x, l.y, c), this._addUserNodeToGrid(e, c), this._updateCullingOffsetByUserNode(e.node)
- }
- },
- _updateCullingOffsetByUserNode: function(t) {
- this._topOffset < t.height && (this._topOffset = t.height), this._downOffset < t.height && (this._downOffset = t.height), this._leftOffset < t.width && (this._leftOffset = t.width), this._rightOffset < t.width && (this._rightOffset = t.width)
- },
- _userNodeSizeChange: function() {
- var t = this.node;
- this._tiledLayer._updateCullingOffsetByUserNode(t)
- },
- _userNodePosChange: function() {
- var t = this.node,
- e = this._tiledLayer;
- e._nodeLocalPosToLayerPos(t, l), e._positionToRowCol(l.x, l.y, c), c.row === this._row && c.col === this._col || (e._removeUserNodeFromGrid(this), e._addUserNodeToGrid(this, c))
- },
- _removeUserNodeFromGrid: function(t) {
- var e = t._row,
- i = t._col,
- n = t._index,
- r = this._userNodeGrid[e],
- s = r && r[i];
- s && (r.count--, s.count--, s.list[n] = null, s.count <= 0 && (s.list.length = 0, s.count = 0)), t._row = -1, t._col = -1, t._index = -1, this._userNodeDirty = !0
- },
- _isInLayer: function(t, e) {
- return t >= 0 && e >= 0 && t <= this._rightTop.row && e <= this._rightTop.col
- },
- _addUserNodeToGrid: function(t, e) {
- var i = e.row,
- n = e.col;
- if (this._isInLayer(i, n)) {
- var r = this._userNodeGrid[i] = this._userNodeGrid[i] || {
- count: 0
- },
- s = r[n] = r[n] || {
- count: 0,
- list: []
- };
- t._row = i, t._col = n, t._index = s.list.length, r.count++, s.count++, s.list.push(t)
- } else t._row = -1, t._col = -1, t._index = -1;
- this._userNodeDirty = !0
- },
- _isUserNodeDirty: function() {
- return this._userNodeDirty
- },
- _setUserNodeDirty: function(t) {
- this._userNodeDirty = t
- },
- onEnable: function() {
- this._super(), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this), this._activateMaterial()
- },
- onDisable: function() {
- this._super(), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
- },
- _syncAnchorPoint: function() {
- var t = this.node;
- this._leftDownToCenterX = t.width * t.anchorX * t.scaleX, this._leftDownToCenterY = t.height * t.anchorY * t.scaleY, this._cullingDirty = !0
- },
- onDestroy: function() {
- this._super(), this._buffer && (this._buffer.destroy(), this._buffer = null), this._renderDataList = null
- },
- getLayerName: function() {
- return this._layerName
- },
- setLayerName: function(t) {
- this._layerName = t
- },
- getProperty: function(t) {
- return this._properties[t]
- },
- getPositionAt: function(t, e) {
- var i = void 0;
- void 0 !== e ? (i = Math.floor(t), e = Math.floor(e)) : (i = Math.floor(t.x), e = Math.floor(t.y));
- var n = void 0;
- switch (this._layerOrientation) {
- case cc.TiledMap.Orientation.ORTHO:
- n = this._positionForOrthoAt(i, e);
- break;
- case cc.TiledMap.Orientation.ISO:
- n = this._positionForIsoAt(i, e);
- break;
- case cc.TiledMap.Orientation.HEX:
- n = this._positionForHexAt(i, e)
- }
- return n
- },
- _isInvalidPosition: function(t, e) {
- if (t && "object" == typeof t) {
- var i = t;
- e = i.y, t = i.x
- }
- return t >= this._layerSize.width || e >= this._layerSize.height || t < 0 || e < 0
- },
- _positionForIsoAt: function(t, e) {
- return cc.v2(this._mapTileSize.width / 2 * (this._layerSize.width + t - e - 1), this._mapTileSize.height / 2 * (2 * this._layerSize.height - t - e - 2))
- },
- _positionForOrthoAt: function(t, e) {
- return cc.v2(t * this._mapTileSize.width, (this._layerSize.height - e - 1) * this._mapTileSize.height)
- },
- _positionForHexAt: function(t, e) {
- var i = this._mapTileSize.width,
- n = this._mapTileSize.height,
- r = this._layerSize.height,
- s = Math.floor(t) + Math.floor(e) * this._layerSize.width,
- o = this._tiles[s],
- a = this._texGrids[o].tileset.tileOffset,
- l = this.node.width / 2,
- h = this.node.height / 2,
- c = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 1 : -1,
- u = 0,
- _ = 0,
- f = 0,
- d = 0,
- p = 0,
- m = 0;
- switch (this._staggerAxis) {
- case cc.TiledMap.StaggerAxis.STAGGERAXIS_Y:
- f = 0, d = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 0 : i / 2, e % 2 == 1 && (f = i / 2 * c), u = t * i + f + d + a.x - l, _ = (r - e - 1) * (n - (n - this._hexSideLength) / 2) - a.y - h;
- break;
- case cc.TiledMap.StaggerAxis.STAGGERAXIS_X:
- p = 0, m = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? n / 2 : 0, t % 2 == 1 && (p = n / 2 * -c), u = t * (i - (i - this._hexSideLength) / 2) + a.x - l, _ = (r - e - 1) * n + p + m - a.y - h
- }
- return cc.v2(u, _)
- },
- setTileGIDAt: function(t, e, i, n) {
- if (void 0 === e) throw new Error("cc.TiledLayer.setTileGIDAt(): pos should be non-null");
- var r = void 0;
- if (void 0 === n && e instanceof cc.Vec2 ? (r = e, n = i) : r = cc.v2(e, i), r.x = Math.floor(r.x), r.y = Math.floor(r.y), this._isInvalidPosition(r)) throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");
- if (this._tiles && this._tilesets && 0 != this._tilesets.length)
- if (0 !== t && t < this._tilesets[0].firstGid) cc.logID(7239, t);
- else {
- n = n || 0;
- var s = this.getTileFlagsAt(r);
- if (this.getTileGIDAt(r) !== t || s !== n) {
- var o = (t | n) >>> 0;
- this._updateTileForGID(o, r)
- }
- }
- else cc.logID(7238)
- },
- _updateTileForGID: function(t, e) {
- if (0 === t || this._texGrids[t]) {
- var i = 0 | e.x + e.y * this._layerSize.width;
- i < this._tiles.length && (this._tiles[i] = t, this._cullingDirty = !0)
- }
- },
- getTileGIDAt: function(t, e) {
- if (void 0 === t) throw new Error("cc.TiledLayer.getTileGIDAt(): pos should be non-null");
- var i = t;
- if (void 0 === e && (i = t.x, e = t.y), this._isInvalidPosition(i, e)) throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");
- if (!this._tiles) return cc.logID(7237), null;
- var n = Math.floor(i) + Math.floor(e) * this._layerSize.width;
- return (this._tiles[n] & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0
- },
- getTileFlagsAt: function(t, e) {
- if (!t) throw new Error("TiledLayer.getTileFlagsAt: pos should be non-null");
- if (void 0 !== e && (t = cc.v2(t, e)), this._isInvalidPosition(t)) throw new Error("TiledLayer.getTileFlagsAt: invalid position");
- if (!this._tiles) return cc.logID(7240), null;
- var i = Math.floor(t.x) + Math.floor(t.y) * this._layerSize.width;
- return (this._tiles[i] & cc.TiledMap.TileFlag.FLIPPED_ALL) >>> 0
- },
- _setCullingDirty: function(t) {
- this._cullingDirty = t
- },
- _isCullingDirty: function() {
- return this._cullingDirty
- },
- _updateViewPort: function(t, e, i, n) {
- if (this._viewPort.width !== i || this._viewPort.height !== n || this._viewPort.x !== t || this._viewPort.y !== e) {
- this._viewPort.x = t, this._viewPort.y = e, this._viewPort.width = i, this._viewPort.height = n;
- var r = 1;
- this._layerOrientation === cc.TiledMap.Orientation.ISO && (r = 2);
- var s = this._viewPort.x - this._offset.x + this._leftDownToCenterX,
- o = this._viewPort.y - this._offset.y + this._leftDownToCenterY,
- a = s - this._leftOffset,
- l = o - this._downOffset,
- h = s + i + this._rightOffset,
- u = o + n + this._topOffset,
- _ = this._cullingRect.leftDown,
- f = this._cullingRect.rightTop;
- a < 0 && (a = 0), l < 0 && (l = 0), this._positionToRowCol(a, l, c), c.row -= r, c.col -= r, c.row = c.row > 0 ? c.row : 0, c.col = c.col > 0 ? c.col : 0, c.row === _.row && c.col === _.col || (_.row = c.row, _.col = c.col, this._cullingDirty = !0), h < 0 || u < 0 ? (c.row = -1, c.col = -1) : (this._positionToRowCol(h, u, c), c.row++, c.col++), c.row > this._rightTop.row && (c.row = this._rightTop.row), c.col > this._rightTop.col && (c.col = this._rightTop.col), c.row === f.row && c.col === f.col || (f.row = c.row, f.col = c.col, this._cullingDirty = !0)
- }
- },
- _positionToRowCol: function(t, e, i) {
- var n = cc.TiledMap,
- r = n.Orientation,
- s = n.StaggerAxis,
- o = this._mapTileSize.width,
- a = this._mapTileSize.height,
- l = .5 * o,
- h = .5 * a,
- c = 0,
- u = 0,
- _ = 0,
- f = 0,
- d = this._staggerAxis;
- this._layerSize.width;
- switch (this._layerOrientation) {
- case r.ORTHO:
- u = Math.floor(t / o), c = Math.floor(e / a);
- break;
- case r.ISO:
- u = Math.floor(t / l), c = Math.floor(e / h);
- break;
- case r.HEX:
- d === s.STAGGERAXIS_Y ? (_ = (c = Math.floor(e / (a - this._diffY1))) % 2 == 1 ? l * this._odd_even : 0, u = Math.floor((t - _) / o)) : (f = (u = Math.floor(t / (o - this._diffX1))) % 2 == 1 ? h * -this._odd_even : 0, c = Math.floor((e - f) / a))
- }
- return i.row = c, i.col = u, i
- },
- _updateCulling: function() {
- if (this._enableCulling) {
- this.node._updateWorldMatrix(), n.mat4.invert(a, this.node._worldMatrix);
- var t = cc.visibleRect,
- e = cc.Camera.findCamera(this.node);
- e && (l.x = 0, l.y = 0, h.x = l.x + t.width, h.y = l.y + t.height, e.getScreenToWorldPoint(l, l), e.getScreenToWorldPoint(h, h), n.vec2.transformMat4(l, l, a), n.vec2.transformMat4(h, h, a), this._updateViewPort(l.x, l.y, h.x - l.x, h.y - l.y))
- }
- },
- getLayerOrientation: function() {
- return this._layerOrientation
- },
- getProperties: function() {
- return this._properties
- },
- _updateVertices: function() {
- var t = cc.TiledMap,
- e = t.TileFlag.FLIPPED_MASK,
- i = t.StaggerAxis,
- n = t.Orientation,
- r = this._vertices;
- r.length = 0;
- var s = this._layerOrientation,
- o = this._tiles;
- if (o) {
- var a = this._rightTop;
- a.row = -1, a.col = -1;
- var l = this._mapTileSize.width,
- h = this._mapTileSize.height,
- c = .5 * l,
- u = .5 * h,
- _ = this._layerSize.height,
- f = this._layerSize.width,
- d = this._texGrids,
- p = 0,
- m = void 0,
- y = void 0,
- v = void 0,
- g = void 0,
- x = void 0,
- b = void 0,
- A = void 0;
- s === n.HEX && (g = this._staggerAxis, x = this._diffX1, b = this._diffY1, A = this._odd_even);
- var C = 0,
- T = 0,
- S = null,
- w = 0;
- this._topOffset = 0, this._downOffset = 0, this._leftOffset = 0, this._rightOffset = 0, this._hasAniGrid = !1;
- for (var E = 0, M = 0, D = 0, B = 0, I = 0; I < _; ++I) {
- for (var P = 0; P < f; ++P) {
- var R = p + P;
- if (m = d[w = (o[R] & e) >>> 0], this._animations[w] && (this._hasAniGrid = !0), m) {
- switch (s) {
- case n.ORTHO:
- y = (C = P) * l, v = (T = _ - I - 1) * h;
- break;
- case n.ISO:
- y = c * (C = _ + P - I - 1), v = u * (T = _ + f - P - I - 2);
- break;
- case n.HEX:
- y = P * (l - x) + (g === i.STAGGERAXIS_Y && I % 2 == 1 ? c * A : 0), v = (_ - I - 1) * (h - b) + (g === i.STAGGERAXIS_X && P % 2 == 1 ? u * -A : 0), C = P, T = _ - I - 1
- }
- var O = r[T] = r[T] || {
- minCol: 0,
- maxCol: 0
- },
- L = O[C] = O[C] || {};
- O.minCol > C && (O.minCol = C), O.maxCol < C && (O.maxCol = C), a.row < T && (a.row = T), a.col < C && (a.col = C), S = m.tileset.tileOffset, y += this._offset.x + S.x, v += this._offset.y - S.y, E = (E = -S.y + m.tileset._tileSize.height - h) < 0 ? 0 : E, M = S.y < 0 ? 0 : S.y, D = -S.x < 0 ? 0 : -S.x, B = (B = S.x + m.tileset._tileSize.width - l) < 0 ? 0 : B, this._rightOffset < D && (this._rightOffset = D), this._leftOffset < B && (this._leftOffset = B), this._topOffset < M && (this._topOffset = M), this._downOffset < E && (this._downOffset = E), L.left = y, L.bottom = v, L.index = R
- }
- }
- p += f
- }
- this._verticesDirty = !1
- }
- },
- getTiledTileAt: function(t, e, i) {
- if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.getTiledTileAt: invalid position");
- if (!this._tiles) return cc.logID(7236), null;
- var n = Math.floor(t) + Math.floor(e) * this._layerSize.width,
- r = this._tiledTiles[n];
- if (!r && i) {
- var s = new cc.Node;
- return (r = s.addComponent(cc.TiledTile))._x = t, r._y = e, r._layer = this, r._updateInfo(), s.parent = this.node, r
- }
- return r
- },
- setTiledTileAt: function(t, e, i) {
- if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.setTiledTileAt: invalid position");
- if (!this._tiles) return cc.logID(7236), null;
- var n = Math.floor(t) + Math.floor(e) * this._layerSize.width;
- return this._tiledTiles[n] = i, this._cullingDirty = !0, this._hasTiledNodeGrid = !!i || this._tiledTiles.some((function(t, e) {
- return !!t
- })), i
- },
- getTexture: function(t) {
- return t = t || 0, this._textures && t >= 0 && this._textures.length > t ? this._textures[t] : null
- },
- getTextures: function() {
- return this._textures
- },
- setTexture: function(t) {
- this.setTextures([t])
- },
- setTextures: function(t) {
- this._textures = t, this._activateMaterial()
- },
- getLayerSize: function() {
- return this._layerSize
- },
- getMapTileSize: function() {
- return this._mapTileSize
- },
- getTileSet: function(t) {
- return t = t || 0, this._tilesets && t >= 0 && this._tilesets.length > t ? this._tilesets[t] : null
- },
- getTileSets: function() {
- return this._tilesets
- },
- setTileSet: function(t) {
- this.setTileSets([t])
- },
- setTileSets: function(t) {
- this._tilesets = t;
- for (var e = this._textures = [], i = this._texGrids = [], n = 0; n < t.length; n++) {
- var r = t[n];
- r && (e[n] = r.sourceImage)
- }
- cc.TiledMap.loadAllTextures(e, function() {
- for (var e = 0, n = t.length; e < n; ++e) {
- var r = t[e];
- r && cc.TiledMap.fillTextureGrids(r, i, e)
- }
- this._prepareToRender()
- }.bind(this))
- },
- _traverseAllGrid: function() {
- var t = this._tiles,
- e = this._texGrids,
- i = this._tilesetIndexArr,
- n = {},
- r = cc.TiledMap.TileFlag.FLIPPED_MASK;
- i.length = 0;
- for (var s = 0; s < t.length; s++) {
- var o = t[s];
- if (0 !== o) {
- var a = e[o = (o & r) >>> 0];
- if (a) {
- var l = a.texId;
- n[l] || (n[l] = !0, i.push(l))
- } else cc.error("CCTiledLayer:_traverseAllGrid grid is null, gid is:", o)
- }
- }
- },
- _init: function(t, e, i, n, r) {
- this._cullingDirty = !0, this._layerInfo = t, this._mapInfo = e;
- var s = t._layerSize;
- if (this._layerName = t.name, this._tiles = t._tiles, this._properties = t.properties, this._layerSize = s, this._minGID = t._minGID, this._maxGID = t._maxGID, this._opacity = t._opacity, this._renderOrder = e.renderOrder, this._staggerAxis = e.getStaggerAxis(), this._staggerIndex = e.getStaggerIndex(), this._hexSideLength = e.getHexSideLength(), this._animations = e.getTileAnimations(), this._tilesets = i, this._textures = n, this._texGrids = r, this._layerOrientation = e.orientation, this._mapTileSize = e.getTileSize(), this._layerOrientation === cc.TiledMap.Orientation.HEX) {
- var o = cc.TiledMap,
- a = o.StaggerAxis,
- l = o.StaggerIndex,
- h = this._mapTileSize.width,
- c = this._mapTileSize.height,
- u = 0,
- _ = 0;
- this._odd_even = this._staggerIndex === l.STAGGERINDEX_ODD ? 1 : -1, this._staggerAxis === a.STAGGERAXIS_X ? (this._diffX1 = (h - this._hexSideLength) / 2, this._diffY1 = 0, _ = c * (this._layerSize.height + .5), u = (h + this._hexSideLength) * Math.floor(this._layerSize.width / 2) + h * (this._layerSize.width % 2)) : (this._diffX1 = 0, this._diffY1 = (c - this._hexSideLength) / 2, u = h * (this._layerSize.width + .5), _ = (c + this._hexSideLength) * Math.floor(this._layerSize.height / 2) + c * (this._layerSize.height % 2)), this.node.setContentSize(u, _)
- } else this.node.setContentSize(this._layerSize.width * this._mapTileSize.width, this._layerSize.height * this._mapTileSize.height);
- this._offset = cc.v2(t.offset.x, -t.offset.y), this._useAutomaticVertexZ = !1, this._vertexZvalue = 0, this._syncAnchorPoint(), this._prepareToRender()
- },
- _prepareToRender: function() {
- this._updateVertices(), this._traverseAllGrid(), this._updateAllUserNode(), this._activateMaterial()
- },
- _activateMaterial: function() {
- var t = this._tilesetIndexArr;
- if (0 !== t.length) {
- for (var e = this._texIdToMatIndex = {}, i = this._textures, n = 0; n < t.length; n++) {
- var r = t[n],
- o = i[r],
- a = this.sharedMaterials[n];
- (a = a ? s.getInstantiatedMaterial(a, this) : s.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("USE_TEXTURE", !0), a.define("CC_USE_MODEL", !0), a.setProperty("texture", o), this.setMaterial(n, a), e[r] = n
- }
- this.markForUpdateRenderData(!0), this.markForRender(!0)
- } else this.disableRender()
- }
- });
- cc.TiledLayer = e.exports = _
- }), {
- "../core/assets/material/CCMaterial": 75,
- "../core/components/CCRenderComponent": 106,
- "../core/renderer/render-flow": 248,
- "../core/vmath": 326
- }],
- 387: [(function(t, e, i) {
- "use strict";
- t("./CCTMXXMLParser"), t("./CCTiledMapAsset"), t("./CCTiledLayer"), t("./CCTiledTile"), t("./CCTiledObjectGroup");
- var n = cc.Enum({
- ORTHO: 0,
- HEX: 1,
- ISO: 2
- }),
- r = cc.Enum({
- NONE: 0,
- MAP: 1,
- LAYER: 2,
- OBJECTGROUP: 3,
- OBJECT: 4,
- TILE: 5
- }),
- s = cc.Enum({
- HORIZONTAL: 2147483648,
- VERTICAL: 1073741824,
- DIAGONAL: 536870912,
- FLIPPED_ALL: 4026531840,
- FLIPPED_MASK: 268435455
- }),
- o = cc.Enum({
- STAGGERAXIS_X: 0,
- STAGGERAXIS_Y: 1
- }),
- a = cc.Enum({
- STAGGERINDEX_ODD: 0,
- STAGGERINDEX_EVEN: 1
- }),
- l = cc.Enum({
- RightDown: 0,
- RightUp: 1,
- LeftDown: 2,
- LeftUp: 3
- }),
- h = cc.Enum({
- RECT: 0,
- ELLIPSE: 1,
- POLYGON: 2,
- POLYLINE: 3,
- IMAGE: 4,
- TEXT: 5
- }),
- c = cc.Class({
- name: "cc.TiledMap",
- extends: cc.Component,
- editor: !1,
- ctor: function() {
- this._texGrids = [], this._textures = [], this._tilesets = [], this._animations = [], this._imageLayers = [], this._layers = [], this._groups = [], this._images = [], this._properties = [], this._tileProperties = [], this._mapSize = cc.size(0, 0), this._tileSize = cc.size(0, 0)
- },
- statics: {
- Orientation: n,
- Property: r,
- TileFlag: s,
- StaggerAxis: o,
- StaggerIndex: a,
- TMXObjectType: h,
- RenderOrder: l
- },
- properties: {
- _tmxFile: {
- default: null,
- type: cc.TiledMapAsset
- },
- tmxAsset: {
- get: function() {
- return this._tmxFile
- },
- set: function(t, e) {
- this._tmxFile !== t && (this._tmxFile = t, this._applyFile())
- },
- type: cc.TiledMapAsset
- }
- },
- getMapSize: function() {
- return this._mapSize
- },
- getTileSize: function() {
- return this._tileSize
- },
- getMapOrientation: function() {
- return this._mapOrientation
- },
- getObjectGroups: function() {
- return this._groups
- },
- getObjectGroup: function(t) {
- for (var e = this._groups, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r && r.getGroupName() === t) return r
- }
- return null
- },
- enableCulling: function(t) {
- for (var e = this._layers, i = 0; i < e.length; ++i) e[i].enableCulling(t)
- },
- getProperties: function() {
- return this._properties
- },
- getLayers: function() {
- return this._layers
- },
- getLayer: function(t) {
- for (var e = this._layers, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r && r.getLayerName() === t) return r
- }
- return null
- },
- _changeLayer: function(t, e) {
- for (var i = this._layers, n = 0, r = i.length; n < r; n++) {
- var s = i[n];
- if (s && s.getLayerName() === t) return void(i[n] = e)
- }
- },
- getProperty: function(t) {
- return this._properties[t.toString()]
- },
- getPropertiesForGID: function(t) {
- return this._tileProperties[t]
- },
- __preload: function() {
- this._tmxFile && this._applyFile()
- },
- onEnable: function() {
- this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
- },
- onDisable: function() {
- this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
- },
- _applyFile: function() {
- var t = this._tmxFile;
- if (t) {
- for (var e = t.textures, i = t.textureNames, n = {}, r = 0; r < e.length; ++r) n[i[r]] = e[r];
- var s = {};
- e = t.imageLayerTextures, i = t.imageLayerTextureNames;
- for (var o = 0; o < e.length; ++o) s[i[o]] = e[o];
- for (var a = t.tsxFileNames, l = t.tsxFiles, h = {}, c = 0; c < a.length; ++c) a[c].length > 0 && (h[a[c]] = l[c].text);
- var u = new cc.TMXMapInfo(t.tmxXmlStr, h, n, s),
- _ = u.getTilesets();
- _ && 0 !== _.length || cc.logID(7241), this._buildWithMapInfo(u)
- } else this._releaseMapInfo()
- },
- _releaseMapInfo: function() {
- for (var t = this._layers, e = 0, i = t.length; e < i; e++) t[e].node.removeFromParent(!0), t[e].node.destroy();
- t.length = 0;
- for (var n = this._groups, r = 0, s = n.length; r < s; r++) n[r].node.removeFromParent(!0), n[r].node.destroy();
- n.length = 0;
- for (var o = this._images, a = 0, l = o.length; a < l; a++) o[a].removeFromParent(!0), o[a].destroy();
- o.length = 0
- },
- _syncAnchorPoint: function() {
- var t = this.node.getAnchorPoint(),
- e = this.node.width * t.x,
- i = this.node.height * (1 - t.y),
- n = void 0,
- r = void 0;
- for (n = 0, r = this._layers.length; n < r; n++) {
- this._layers[n].node.setAnchorPoint(t)
- }
- for (n = 0, r = this._groups.length; n < r; n++) {
- var s = this._groups[n],
- o = s.node;
- o.anchorX = .5, o.anchorY = .5, o.x = s._offset.x - e + o.width * o.anchorX, o.y = s._offset.y + i - o.height * o.anchorY
- }
- for (n = 0, r = this._images.length; n < r; n++) {
- var a = this._images[n];
- a.anchorX = .5, a.anchorY = .5, a.x = a._offset.x - e + a.width * a.anchorX, a.y = a._offset.y + i - a.height * a.anchorY
- }
- },
- _fillAniGrids: function(t, e) {
- for (var i in e) {
- var n = e[i];
- if (n)
- for (var r = n.frames, s = 0; s < r.length; s++) {
- var o = r[s];
- o.grid = t[o.tileid]
- }
- }
- },
- _buildLayerAndGroup: function() {
- var t = this._tilesets,
- e = this._texGrids,
- i = this._animations;
- e.length = 0;
- for (var n = 0, r = t.length; n < r; ++n) {
- var s = t[n];
- s && cc.TiledMap.fillTextureGrids(s, e, n)
- }
- this._fillAniGrids(e, i);
- for (var o = this._layers, a = this._groups, l = this._images, h = {}, c = 0, u = o.length; c < u; c++) h[o[c].node._name] = !0;
- for (var _ = 0, f = a.length; _ < f; _++) h[a[_].node._name] = !0;
- for (var d = 0, p = l.length; d < p; d++) h[l[d]._name] = !0;
- o = this._layers = [], a = this._groups = [], l = this._images = [];
- var m = this._mapInfo,
- y = this.node,
- v = m.getAllChildren(),
- g = this._textures,
- x = 0,
- b = 0;
- if (v && v.length > 0)
- for (var A = 0, C = v.length; A < C; A++) {
- var T = v[A],
- S = T.name,
- w = this.node.getChildByName(S);
- if (h[S] = !1, w || ((w = new cc.Node).name = S, y.addChild(w)), w.setSiblingIndex(A), w.active = T.visible, T instanceof cc.TMXLayerInfo) {
- var E = w.getComponent(cc.TiledLayer);
- E || (E = w.addComponent(cc.TiledLayer)), E._init(T, m, t, g, e), T.ownTiles = !1, o.push(E)
- } else if (T instanceof cc.TMXObjectGroupInfo) {
- var M = w.getComponent(cc.TiledObjectGroup);
- M || (M = w.addComponent(cc.TiledObjectGroup)), M._init(T, m, e), a.push(M)
- } else if (T instanceof cc.TMXImageLayerInfo) {
- var D = T.sourceImage;
- w.opacity = T.opacity, w.layerInfo = T, w._offset = cc.v2(T.offset.x, -T.offset.y);
- var B = w.getComponent(cc.Sprite);
- B || (B = w.addComponent(cc.Sprite)), B.spriteFrame = new cc.SpriteFrame, B.spriteFrame.setTexture(D), w.width = D.width, w.height = D.height, l.push(w)
- }
- x = Math.max(x, w.width), b = Math.max(b, w.height)
- }
- for (var I = y.children, P = 0, R = I.length; P < R; P++) {
- var O = I[P];
- h[O._name] && O.destroy()
- }
- this.node.width = x, this.node.height = b, this._syncAnchorPoint()
- },
- _buildWithMapInfo: function(t) {
- this._mapInfo = t, this._mapSize = t.getMapSize(), this._tileSize = t.getTileSize(), this._mapOrientation = t.orientation, this._properties = t.properties, this._tileProperties = t.getTileProperties(), this._imageLayers = t.getImageLayers(), this._animations = t.getTileAnimations(), this._tilesets = t.getTilesets();
- var e = this._tilesets;
- this._textures.length = 0;
- for (var i = [], n = 0, r = e.length; n < r; ++n) {
- var s = e[n];
- s && s.sourceImage && (this._textures[n] = s.sourceImage, i.push(s.sourceImage))
- }
- for (var o = 0; o < this._imageLayers.length; o++) {
- var a = this._imageLayers[o];
- a && a.sourceImage && i.push(a.sourceImage)
- }
- cc.TiledMap.loadAllTextures(i, function() {
- this._buildLayerAndGroup()
- }.bind(this))
- },
- update: function(t) {
- var e = this._animations,
- i = this._texGrids;
- for (var n in e) {
- var r = e[n],
- s = r.frames,
- o = s[r.frameIdx];
- r.dt += t, o.duration < r.dt && (r.dt = 0, r.frameIdx++, r.frameIdx >= s.length && (r.frameIdx = 0), o = s[r.frameIdx]), i[n] = o.grid
- }
- }
- });
- cc.TiledMap = e.exports = c, cc.TiledMap.loadAllTextures = function(t, e) {
- var i = t.length;
- if (0 !== i)
- for (var n = 0, r = function() {
- ++n >= i && e()
- }, s = 0; s < i; s++) {
- var o = t[s];
- o.loaded ? r() : o.once("load", (function() {
- r()
- }))
- } else e()
- }, cc.TiledMap.fillTextureGrids = function(t, e, i) {
- var n = t.sourceImage;
- t.imageSize.width && t.imageSize.height || (t.imageSize.width = n.width, t.imageSize.height = n.height);
- var r = t._tileSize.width,
- s = t._tileSize.height,
- o = n.width,
- a = n.height,
- l = t.spacing,
- h = t.margin,
- c = Math.floor((o - 2 * h + l) / (r + l)),
- u = Math.floor((a - 2 * h + l) / (s + l)) * c,
- _ = t.firstGid,
- f = null,
- d = !!e[_],
- p = cc.macro.FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX ? .5 : 0;
- u <= 0 && (u = 1);
- for (var m = t.firstGid + u; _ < m && (d && !e[_] && (d = !1), d || !e[_]); ++_) f = {
- texId: i,
- tileset: t,
- x: 0,
- y: 0,
- width: r,
- height: s,
- t: 0,
- l: 0,
- r: 0,
- b: 0,
- gid: _
- }, t.rectForGID(_, f), f.x += p, f.y += p, f.width -= 2 * p, f.height -= 2 * p, f.t = f.y / a, f.l = f.x / o, f.r = (f.x + f.width) / o, f.b = (f.y + f.height) / a, e[_] = f
- }, cc.js.obsolete(cc.TiledMap.prototype, "cc.TiledMap.tmxFile", "tmxAsset", !0), cc.js.get(cc.TiledMap.prototype, "mapLoaded", (function() {
- return cc.errorID(7203), []
- }), !1)
- }), {
- "./CCTMXXMLParser": 385,
- "./CCTiledLayer": 386,
- "./CCTiledMapAsset": 388,
- "./CCTiledObjectGroup": 390,
- "./CCTiledTile": 391
- }],
- 388: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TiledMapAsset",
- extends: cc.Asset,
- properties: {
- tmxXmlStr: "",
- textures: {
- default: [],
- type: [cc.Texture2D]
- },
- textureNames: [cc.String],
- imageLayerTextures: {
- default: [],
- type: [cc.Texture2D]
- },
- imageLayerTextureNames: [cc.String],
- tsxFiles: [cc.TextAsset],
- tsxFileNames: [cc.String]
- },
- statics: {
- preventDeferredLoadDependents: !0
- },
- createNode: !1
- });
- cc.TiledMapAsset = n, e.exports = n
- }), {}],
- 389: [(function(t, e, i) {
- "use strict";
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../renderer/core/input-assembler"));
- var r = cc.Class({
- name: "cc.TiledMapRenderDataList",
- ctor: function() {
- this._dataList = [], this._offset = 0
- },
- _pushRenderData: function() {
- var t = {};
- t.ia = new n.default, t.nodesRenderList = [], this._dataList.push(t)
- },
- popRenderData: function(t) {
- this._offset >= this._dataList.length && this._pushRenderData();
- var e = this._dataList[this._offset];
- e.nodesRenderList.length = 0;
- var i = e.ia;
- return i._vertexBuffer = t._vb, i._indexBuffer = t._ib, i._start = t.indiceOffset, i._count = 0, this._offset++, e
- },
- pushNodesList: function(t, e) {
- t.nodesRenderList.push(e)
- },
- reset: function() {
- this._offset = 0
- }
- });
- cc.TiledMapRenderDataList = e.exports = r
- }), {
- "../renderer/core/input-assembler": 350
- }],
- 390: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TiledObjectGroup",
- extends: cc.Component,
- getPositionOffset: function() {
- return this._positionOffset
- },
- getProperties: function() {
- this._properties
- },
- getGroupName: function() {
- return this._groupName
- },
- getProperty: function(t) {
- return this._properties[t.toString()]
- },
- getObject: function(t) {
- for (var e = 0, i = this._objects.length; e < i; e++) {
- var n = this._objects[e];
- if (n && n.name === t) return n
- }
- return null
- },
- getObjects: function() {
- return this._objects
- },
- _init: function(t, e, i) {
- var n = cc.TiledMap,
- r = n.TMXObjectType,
- s = n.Orientation,
- o = n.StaggerAxis,
- a = n.TileFlag.FLIPPED_MASK;
- this._groupName = t.name, this._positionOffset = t.offset, this._mapInfo = e, this._properties = t.getProperties(), this._offset = cc.v2(t.offset.x, -t.offset.y), this._opacity = t._opacity;
- var l = e._mapSize,
- h = e._tileSize,
- c = 0,
- u = 0;
- e.orientation === s.HEX ? e.getStaggerAxis() === o.STAGGERAXIS_X ? (u = h.height * (l.height + .5), c = (h.width + e.getHexSideLength()) * Math.floor(l.width / 2) + h.width * (l.width % 2)) : (c = h.width * (l.width + .5), u = (h.height + e.getHexSideLength()) * Math.floor(l.height / 2) + h.height * (l.height % 2)) : (c = l.width * h.width, u = l.height * h.height), this.node.setContentSize(c, u);
- for (var _ = c * this.node.anchorX, f = u * (1 - this.node.anchorY), d = t._objects, p = {}, m = 0, y = d.length - 1, v = d.length; m < v; m++, y--) {
- var g = d[m],
- x = g.type;
- g.offset = cc.v2(g.x, g.y);
- var b = g.points || g.polylinePoints;
- if (b)
- for (var A = 0; A < b.length; A++) b[A].y *= -1;
- if (s.ISO !== e.orientation) g.y = u - g.y;
- else {
- var C = g.x / h.width * 2,
- T = g.y / h.height;
- g.x = h.width / 2 * (l.width + C - T), g.y = h.height / 2 * (2 * l.height - C - T)
- }
- if (x === r.TEXT) {
- var S = "text" + g.id;
- p[S] = !0;
- var w = this.node.getChildByName(S);
- w || (w = new cc.Node), w.anchorX = 0, w.anchorY = 1, w.angle = -g.rotation, w.x = g.x - _, w.y = g.y - f, w.name = S, w.parent = this.node, w.color = g.color, w.opacity = this._opacity, w.setSiblingIndex(y);
- var E = w.getComponent(cc.Label);
- E || (E = w.addComponent(cc.Label)), E.overflow = cc.Label.Overflow.SHRINK, E.lineHeight = g.height, E.string = g.text, E.horizontalAlign = g.halign, E.verticalAlign = g.valign, E.fontSize = g.pixelsize, w.width = g.width, w.height = g.height
- }
- if (x === r.IMAGE) {
- var M = i[(g.gid & a) >>> 0];
- if (!M) continue;
- var D = M.tileset,
- B = "img" + g.id;
- p[B] = !0;
- var I = this.node.getChildByName(B);
- I instanceof cc.PrivateNode && (I.removeFromParent(), I.destroy(), I = null), I || (I = new cc.Node), s.ISO == e.orientation ? (I.anchorX = .5, I.anchorY = 0) : (I.anchorX = 0, I.anchorY = 0), I.angle = -g.rotation, I.x = g.x - _ + D.tileOffset.x, I.y = g.y - f + D.tileOffset.y, I.name = B, I.parent = this.node, I.opacity = this._opacity, I.setSiblingIndex(y);
- var P = I.getComponent(cc.Sprite);
- P || (P = I.addComponent(cc.Sprite));
- var R = new cc.SpriteFrame;
- R.setTexture(M.tileset.sourceImage, cc.rect(M)), P.spriteFrame = R, I.width = g.width, I.height = g.height
- }
- }
- this._objects = d;
- for (var O = this.node.children, L = /^img\d+$/, F = /^text\d+$/, N = 0, V = O.length; N < V; N++) {
- var k = O[N],
- G = k._name,
- U = L.test(G);
- (U = U || F.test(G)) && !p[G] && k.destroy()
- }
- }
- });
- cc.TiledObjectGroup = e.exports = n
- }), {}],
- 391: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TiledTile",
- extends: cc.Component,
- editor: !1,
- ctor: function() {
- this._layer = null
- },
- properties: {
- _x: 0,
- _y: 0,
- x: {
- get: function() {
- return this._x
- },
- set: function(t) {
- t !== this._x && (this._layer && this._layer._isInvalidPosition(t, this._y) ? cc.warn("Invalid x, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.width) : (this._resetTile(), this._x = t, this._updateInfo()))
- },
- type: cc.Integer
- },
- y: {
- get: function() {
- return this._y
- },
- set: function(t) {
- t !== this._y && (this._layer && this._layer._isInvalidPosition(this._x, t) ? cc.warn("Invalid y, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.height) : (this._resetTile(), this._y = t, this._updateInfo()))
- },
- type: cc.Integer
- },
- gid: {
- get: function() {
- return this._layer ? this._layer.getTileGIDAt(this._x, this._y) : 0
- },
- set: function(t) {
- this._layer && this._layer.setTileGIDAt(t, this._x, this._y)
- },
- type: cc.Integer
- }
- },
- onEnable: function() {
- var t = this.node.parent;
- this._layer = t.getComponent(cc.TiledLayer), this._resetTile(), this._updateInfo()
- },
- onDisable: function() {
- this._resetTile()
- },
- _resetTile: function() {
- this._layer && this._layer.getTiledTileAt(this._x, this._y) === this && this._layer.setTiledTileAt(this._x, this._y, null)
- },
- _updateInfo: function() {
- if (this._layer) {
- var t = this._x,
- e = this._y;
- this._layer.getTiledTileAt(t, e) ? cc.warn("There is already a TiledTile at [%s, %s]", t, e) : (this.node.setPosition(this._layer.getPositionAt(t, e)), this._layer.setTiledTileAt(t, e, this))
- }
- }
- });
- cc.TiledTile = e.exports = n
- }), {}],
- 392: [(function(t, e, i) {
- "use strict";
- t("./CCTiledMap"), t("./CCTiledMapRenderDataList"), t("./tiledmap-buffer"), t("./tmx-layer-assembler")
- }), {
- "./CCTiledMap": 387,
- "./CCTiledMapRenderDataList": 389,
- "./tiledmap-buffer": 393,
- "./tmx-layer-assembler": 394
- }],
- 393: [(function(t, e, i) {
- "use strict";
- var n = cc.Class({
- name: "cc.TiledMapBuffer",
- extends: t("../core/renderer/webgl/quad-buffer"),
- _updateOffset: function() {
- var t = this._offsetInfo;
- t.vertexOffset = this.vertexOffset, t.indiceOffset = this.indiceOffset, t.byteOffset = this.byteOffset
- },
- adjust: function(t, e) {
- this.vertexOffset += t, this.indiceOffset += e, this.indiceStart = this.indiceOffset, this.byteOffset = this.byteOffset + t * this._vertexBytes, this._dirty = !0
- }
- });
- cc.TiledMapBuffer = e.exports = n
- }), {
- "../core/renderer/webgl/quad-buffer": 285
- }],
- 394: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../core/renderer/assembler")),
- r = t("../core/vmath");
- function s(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function o(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function a(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var l = t("./CCTiledLayer"),
- h = t("./CCTiledMap"),
- c = h.TileFlag,
- u = c.FLIPPED_MASK,
- _ = t("../core/renderer/"),
- f = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,
- d = parseInt(10922.5),
- p = h.RenderOrder,
- m = t("../core/renderer/render-flow"),
- y = r.mat4.create(),
- v = r.vec3.create(),
- g = {
- row: 0,
- col: 0
- },
- x = {
- x: 0,
- y: 0
- },
- b = {
- x: 0,
- y: 0
- },
- A = {
- x: 0,
- y: 0
- },
- C = {
- x: 0,
- y: 0
- },
- T = null,
- S = null,
- w = 0,
- E = 0,
- M = 0,
- D = 0,
- B = null,
- I = null,
- P = null,
- R = null,
- O = null,
- L = null,
- F = null,
- N = null;
- function V(t) {
- t._updateLocalMatrix(), r.mat4.mul(t._worldMatrix, B, t._matrix), t._renderFlag &= ~(m.FLAG_TRANSFORM | m.FLAG_BREAK_FLOW), m.visitRootNode(t), t._renderFlag |= m.FLAG_BREAK_FLOW
- }
- function k() {
- 0 !== S._count && (I.material = T.material, I.node = L.node, I._flushIA(T.ia), w >= d ? (R.uploadData(), R.switchBuffer(), F = R._vData, N = R._uintVData, T = P.popRenderData(R), S = T.ia, E = 0, w = 0) : (T = P.popRenderData(R), S = T.ia), T.material = O)
- }
- function G(t, e) {
- var i = L._getNodesByRowCol(t, e);
- if (i && 0 != i.count) {
- var n = i.list,
- r = 0,
- s = 0;
- for (k(), I.worldMatDirty++; r < i.count;) {
- var o = n[s];
- s++, o && (V(o.node), r !== s && (n[r] = o, o._index = r), r++)
- }
- n.length = r, I.worldMatDirty--, P.pushNodesList(T, n), I._flush(), I.node = L.node
- }
- }
- function U(t, e) {
- x.x = t.l, x.y = t.t, b.x = t.r, b.y = t.t, A.x = t.l, A.y = t.b, C.x = t.r, C.y = t.b;
- var i = null;
- (e & c.DIAGONAL) >>> 0 && (i = b, b = A, A = i), (e & c.HORIZONTAL) >>> 0 && (i = x, x = b, b = i, i = A, A = C, C = i), (e & c.VERTICAL) >>> 0 && (i = x, x = A, A = i, i = b, b = C, C = i)
- }
- var z = (function(t) {
- function e() {
- return s(this, e), o(this, t.apply(this, arguments))
- }
- return a(e, t), e.prototype.updateRenderData = function(t) {
- t._renderDataList || (t._buffer = new cc.TiledMapBuffer(_._handle, f), t._renderDataList = new cc.TiledMapRenderDataList)
- }, e.prototype.fillBuffers = function(t, e) {
- if (0 !== t._vertices.length) {
- t._updateCulling();
- var i = t.node;
- if (M = t._leftDownToCenterX, D = t._leftDownToCenterY, B = i._worldMatrix, I = e, L = t, P = t._renderDataList, R = t._buffer, t._isCullingDirty() || t._isUserNodeDirty() || t._hasAnimation() || t._hasTiledNode()) {
- R.reset();
- var n = void 0,
- r = void 0;
- if (t._enableCulling) {
- var s = t._cullingRect;
- n = s.leftDown, r = s.rightTop
- } else n = g, r = t._rightTop;
- var o = (r.row - n.row + 1) * (r.col - n.col + 1);
- switch (o > d && (o = d), R.request(4 * o, 6 * o), t._renderOrder) {
- case p.RightDown:
- this.traverseGrids(n, r, -1, 1);
- break;
- case p.LeftDown:
- this.traverseGrids(n, r, -1, -1);
- break;
- case p.RightUp:
- this.traverseGrids(n, r, 1, 1);
- break;
- case p.LeftUp:
- this.traverseGrids(n, r, 1, -1)
- }
- t._setCullingDirty(!1), t._setUserNodeDirty(!1)
- } else {
- for (var a = null, l = null, h = null, c = 0; c < P._offset; c++) {
- if ((l = (a = P._dataList[c]).nodesRenderList).length > 0) {
- e.worldMatDirty++;
- for (var u = 0; u < l.length; u++)
- if (h = l[u])
- for (var _ = 0; _ < h.length; _++) {
- var f = h[_];
- f && V(f.node)
- }
- e.worldMatDirty--, e._flush()
- }
- a.ia._count > 0 && (e.material = a.material, e.node = i, e._flushIA(a.ia))
- }
- }
- T = null, S = null, B = null, I = null, P = null, R = null, O = null, L = null, F = null, N = null
- }
- }, e.prototype.traverseGrids = function(t, e, i, n) {
- if (P.reset(), !(e.row < 0 || e.col < 0)) {
- T = P.popRenderData(R), S = T.ia, F = R._vData, N = R._uintVData, w = 0, E = 0, O = null;
- var r = L.node._color._val,
- s = L._tiledTiles,
- o = L._texGrids,
- a = L._tiles,
- l = L._texIdToMatIndex,
- h = L.sharedMaterials,
- c = L._vertices,
- _ = void 0,
- f = void 0,
- p = void 0,
- m = void 0,
- y = void 0,
- v = void 0,
- g = void 0,
- B = null,
- V = 0,
- z = 0,
- j = 0,
- W = 0,
- H = 0,
- X = null,
- Y = -1,
- q = void 0,
- J = 0,
- Z = !0;
- for (-1 == i ? (m = e.row, y = t.row) : (m = t.row, y = e.row);
- (y - m) * i >= 0; m += i)
- for (_ = c[m], Z = 0 == (J = L._getNodesCountByRow(m)) && void 0 != _, 1 == n ? (f = Z && t.col < _.minCol ? _.minCol : t.col, p = Z && e.col > _.maxCol ? _.maxCol : e.col) : (f = Z && e.col > _.maxCol ? _.maxCol : e.col, p = Z && t.col < _.minCol ? _.minCol : t.col);
- (p - f) * n >= 0; f += n)(v = _ && _[f]) ? (B = o[((V = a[v.index]) & u) >>> 0]) && (Y !== B.texId && (-1 !== Y && k(), q = l[Y = B.texId], O = h[q], T.material = O), O && (z = v.left - M, j = v.bottom - D, W = z + (g = B.tileset._tileSize).width, H = j + g.height, (X = s[v.index]) ? this.fillByTiledNode(X.node, F, N, z, W, H, j) : (F[E] = z, F[E + 1] = H, N[E + 4] = r, F[E + 5] = z, F[E + 6] = j, N[E + 9] = r, F[E + 10] = W, F[E + 11] = H, N[E + 14] = r, F[E + 15] = W, F[E + 16] = j, N[E + 19] = r), U(B, V), F[E + 2] = x.x, F[E + 3] = x.y, F[E + 7] = A.x, F[E + 8] = A.y, F[E + 12] = b.x, F[E + 13] = b.y, F[E + 17] = C.x, F[E + 18] = C.y, E += 20, R.adjust(4, 6), S._count += 6, w++, J > 0 && G(m, f), w >= d && k())) : J > 0 && G(m, f);
- R.uploadData(), S._count > 0 && (I.material = T.material, I.node = L.node, I._flushIA(T.ia))
- }
- }, e.prototype.fillByTiledNode = function(t, e, i, n, s, o, a) {
- t._updateLocalMatrix(), r.mat4.copy(y, t._matrix), r.vec3.set(v, -(n + M), -(a + D), 0), r.mat4.translate(y, y, v);
- var l = y.m,
- h = l[0],
- c = l[1],
- u = l[4],
- _ = l[5],
- f = l[12],
- d = l[13],
- p = t._color._val;
- e[E] = n * h + o * u + f, e[E + 1] = n * c + o * _ + d, i[E + 4] = p, e[E + 5] = n * h + a * u + f, e[E + 6] = n * c + a * _ + d, i[E + 9] = p, e[E + 10] = s * h + o * u + f, e[E + 11] = s * c + o * _ + d, i[E + 14] = p, e[E + 15] = s * h + a * u + f, e[E + 16] = s * c + a * _ + d, i[E + 19] = p
- }, e
- })(n.default);
- i.default = z, n.default.register(l, z), e.exports = i.default
- }), {
- "../core/renderer/": 247,
- "../core/renderer/assembler": 227,
- "../core/renderer/render-flow": 248,
- "../core/renderer/webgl/vertex-format": 288,
- "../core/vmath": 326,
- "./CCTiledLayer": 386,
- "./CCTiledMap": 387
- }],
- 395: [(function(t, e, i) {
- "use strict";
- var n = t("./video-player-impl"),
- r = n.EventType,
- s = cc.Enum({
- REMOTE: 0,
- LOCAL: 1
- }),
- o = cc.Class({
- name: "cc.VideoPlayer",
- extends: cc.Component,
- editor: !1,
- properties: {
- _resourceType: s.REMOTE,
- resourceType: {
- tooltip: !1,
- type: s,
- set: function(t) {
- this._resourceType = t, this._updateVideoSource()
- },
- get: function() {
- return this._resourceType
- }
- },
- _remoteURL: "",
- remoteURL: {
- tooltip: !1,
- type: cc.String,
- set: function(t) {
- this._remoteURL = t, this._updateVideoSource()
- },
- get: function() {
- return this._remoteURL
- }
- },
- _clip: {
- default: null,
- type: cc.Asset
- },
- clip: {
- tooltip: !1,
- get: function() {
- return this._clip
- },
- set: function(t) {
- this._clip = t, this._updateVideoSource()
- },
- type: cc.Asset
- },
- currentTime: {
- tooltip: !1,
- type: cc.Float,
- set: function(t) {
- this._impl && this._impl.seekTo(t)
- },
- get: function() {
- return this._impl ? this._impl.currentTime() : -1
- }
- },
- _volume: 1,
- volume: {
- get: function() {
- return this._volume
- },
- set: function(t) {
- this._volume = t, this.isPlaying() && !this._mute && this._syncVolume()
- },
- range: [0, 1],
- type: cc.Float,
- tooltip: !1
- },
- _mute: !1,
- mute: {
- get: function() {
- return this._mute
- },
- set: function(t) {
- this._mute = t, this._syncVolume()
- },
- tooltip: !1
- },
- keepAspectRatio: {
- tooltip: !1,
- default: !0,
- type: cc.Boolean,
- notify: function() {
- this._impl && this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio)
- }
- },
- _isFullscreen: {
- default: !1,
- formerlySerializedAs: "_N$isFullscreen"
- },
- isFullscreen: {
- get: function() {
- return this._isFullscreen = this._impl && this._impl.isFullScreenEnabled(), this._isFullscreen
- },
- set: function(t) {
- this._isFullscreen = t, this._impl && this._impl.setFullScreenEnabled(t)
- },
- animatable: !1,
- tooltip: !1
- },
- videoPlayerEvent: {
- default: [],
- type: cc.Component.EventHandler
- }
- },
- statics: {
- EventType: r,
- ResourceType: s,
- Impl: n
- },
- ctor: function() {
- this._impl = new n
- },
- _syncVolume: function() {
- var t = this._impl;
- if (t) {
- var e = this._mute ? 0 : this._volume;
- t.setVolume(e)
- }
- },
- _updateVideoSource: function() {
- var t = "";
- this.resourceType === s.REMOTE ? t = this.remoteURL : this._clip && (t = this._clip.nativeUrl || ""), t && cc.loader.md5Pipe && (t = cc.loader.md5Pipe.transformURL(t)), this._impl.setURL(t, this._mute || 0 === this._volume)
- },
- onLoad: function() {
- var t = this._impl;
- t && (t.createDomElementIfNeeded(this._mute || 0 === this._volume), this._updateVideoSource(), t.seekTo(this.currentTime), t.setKeepAspectRatioEnabled(this.keepAspectRatio), t.setFullScreenEnabled(this._isFullscreen), this.pause(), t.setEventListener(r.PLAYING, this.onPlaying.bind(this)), t.setEventListener(r.PAUSED, this.onPasued.bind(this)), t.setEventListener(r.STOPPED, this.onStopped.bind(this)), t.setEventListener(r.COMPLETED, this.onCompleted.bind(this)), t.setEventListener(r.META_LOADED, this.onMetaLoaded.bind(this)), t.setEventListener(r.CLICKED, this.onClicked.bind(this)), t.setEventListener(r.READY_TO_PLAY, this.onReadyToPlay.bind(this)))
- },
- onRestore: function() {
- this._impl || (this._impl = new n)
- },
- onEnable: function() {
- this._impl && this._impl.enable()
- },
- onDisable: function() {
- this._impl && this._impl.disable()
- },
- onDestroy: function() {
- this._impl && (this._impl.destroy(), this._impl = null)
- },
- update: function(t) {
- this._impl && this._impl.updateMatrix(this.node)
- },
- onReadyToPlay: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.READY_TO_PLAY), this.node.emit("ready-to-play", this)
- },
- onMetaLoaded: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.META_LOADED), this.node.emit("meta-loaded", this)
- },
- onClicked: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.CLICKED), this.node.emit("clicked", this)
- },
- onPlaying: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.PLAYING), this.node.emit("playing", this)
- },
- onPasued: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.PAUSED), this.node.emit("paused", this)
- },
- onStopped: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.STOPPED), this.node.emit("stopped", this)
- },
- onCompleted: function() {
- cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.COMPLETED), this.node.emit("completed", this)
- },
- play: function() {
- this._impl && (this._syncVolume(), this._impl.play())
- },
- resume: function() {
- this._impl && (this._syncVolume(), this._impl.resume())
- },
- pause: function() {
- this._impl && this._impl.pause()
- },
- stop: function() {
- this._impl && this._impl.stop()
- },
- getDuration: function() {
- return this._impl ? this._impl.duration() : -1
- },
- isPlaying: function() {
- return !!this._impl && this._impl.isPlaying()
- }
- });
- cc.VideoPlayer = e.exports = o
- }), {
- "./video-player-impl": 396
- }],
- 396: [(function(t, e, i) {
- "use strict";
- var n = t("../core/vmath"),
- r = t("../core/platform/utils"),
- s = t("../core/platform/CCSys"),
- o = {
- HAVE_NOTHING: 0,
- HAVE_METADATA: 1,
- HAVE_CURRENT_DATA: 2,
- HAVE_FUTURE_DATA: 3,
- HAVE_ENOUGH_DATA: 4
- },
- a = n.mat4.create(),
- l = cc.Class({
- name: "VideoPlayerImpl",
- ctor: function() {
- this._EventList = {}, this._video = null, this._url = "", this._waitingFullscreen = !1, this._fullScreenEnabled = !1, this._loadedmeta = !1, this._loaded = !1, this._visible = !1, this._playing = !1, this._ignorePause = !1, this._forceUpdate = !1, this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this.__eventListeners = {}
- },
- _bindEvent: function() {
- var t = this._video,
- e = this,
- i = this.__eventListeners;
- i.loadedmetadata = function() {
- e._loadedmeta = !0, e._forceUpdate = !0, e._waitingFullscreen && (e._waitingFullscreen = !1, e._toggleFullscreen(!0)), e._dispatchEvent(l.EventType.META_LOADED)
- }, i.ended = function() {
- e._video === t && (e._playing = !1, e._dispatchEvent(l.EventType.COMPLETED))
- }, i.play = function() {
- e._video === t && (e._playing = !0, e._updateVisibility(), e._dispatchEvent(l.EventType.PLAYING))
- }, i.pause = function() {
- e._video === t && (e._playing = !1, e._ignorePause || e._dispatchEvent(l.EventType.PAUSED))
- }, i.click = function() {
- e._dispatchEvent(l.EventType.CLICKED)
- }, t.addEventListener("loadedmetadata", i.loadedmetadata), t.addEventListener("ended", i.ended), t.addEventListener("play", i.play), t.addEventListener("pause", i.pause), t.addEventListener("click", i.click), i.onCanPlay = function() {
- if (!e._loaded && !e._playing) {
- var t = e._video;
- t.readyState !== o.HAVE_ENOUGH_DATA && t.readyState !== o.HAVE_METADATA || (t.currentTime = 0, e._loaded = !0, e._forceUpdate = !0, e._dispatchEvent(l.EventType.READY_TO_PLAY), e._updateVisibility())
- }
- }, t.addEventListener("canplay", i.onCanPlay), t.addEventListener("canplaythrough", i.onCanPlay), t.addEventListener("suspend", i.onCanPlay)
- },
- _updateVisibility: function() {
- var t = this._video;
- t && (this._visible ? t.style.visibility = "visible" : (t.style.visibility = "hidden", t.pause(), this._playing = !1))
- },
- _updateSize: function(t, e) {
- var i = this._video;
- i && (i.style.width = t + "px", i.style.height = e + "px")
- },
- _createDom: function(t) {
- var e = document.createElement("video");
- e.style.position = "absolute", e.style.bottom = "0px", e.style.left = "0px", e.className = "cocosVideo", e.setAttribute("preload", "auto"), e.setAttribute("webkit-playsinline", ""), e.setAttribute("x5-playsinline", ""), e.setAttribute("playsinline", ""), t && e.setAttribute("muted", ""), this._video = e, cc.game.container.appendChild(e)
- },
- createDomElementIfNeeded: function(t) {
- this._video || this._createDom(t)
- },
- removeDom: function() {
- var t = this._video;
- if (t) {
- r.contains(cc.game.container, t) && cc.game.container.removeChild(t);
- var e = this.__eventListeners;
- t.removeEventListener("loadedmetadata", e.loadedmetadata), t.removeEventListener("ended", e.ended), t.removeEventListener("play", e.play), t.removeEventListener("pause", e.pause), t.removeEventListener("click", e.click), t.removeEventListener("canplay", e.onCanPlay), t.removeEventListener("canplaythrough", e.onCanPlay), t.removeEventListener("suspend", e.onCanPlay), e.loadedmetadata = null, e.ended = null, e.play = null, e.pause = null, e.click = null, e.onCanPlay = null
- }
- this._video = null, this._url = ""
- },
- setURL: function(t, e) {
- var i, n = void 0;
- if (this._url !== t) {
- this._url = t, this.removeDom(), this.createDomElementIfNeeded(e), this._bindEvent();
- var r = this._video;
- r.style.visibility = "hidden", this._loaded = !1, this._playing = !1, this._loadedmeta = !1, (n = document.createElement("source")).src = t, r.appendChild(n), i = cc.path.extname(t);
- for (var s = l._polyfill, o = 0; o < s.canPlayType.length; o++) i !== s.canPlayType[o] && ((n = document.createElement("source")).src = t.replace(i, s.canPlayType[o]), r.appendChild(n))
- }
- },
- getURL: function() {
- return this._url
- },
- play: function() {
- var t = this._video;
- if (t && this._visible && !this._playing)
- if (l._polyfill.autoplayAfterOperation) {
- setTimeout((function() {
- t.play()
- }), 20)
- } else t.play()
- },
- pause: function() {
- var t = this._video;
- this._playing && t && t.pause()
- },
- resume: function() {
- this.play()
- },
- stop: function() {
- var t = this._video;
- t && this._visible && (this._ignorePause = !0, t.currentTime = 0, t.pause(), setTimeout(function() {
- this._dispatchEvent(l.EventType.STOPPED), this._ignorePause = !1
- }.bind(this), 0))
- },
- setVolume: function(t) {
- var e = this._video;
- e && (e.volume = t)
- },
- seekTo: function(t) {
- var e = this._video;
- if (e) {
- if (this._loaded) e.currentTime = t;
- else {
- e.addEventListener(l._polyfill.event, (function i() {
- e.currentTime = t, e.removeEventListener(l._polyfill.event, i)
- }))
- }
- l._polyfill.autoplayAfterOperation && this.isPlaying() && setTimeout((function() {
- e.play()
- }), 20)
- }
- },
- isPlaying: function() {
- var t = this._video;
- return l._polyfill.autoplayAfterOperation && this._playing && setTimeout((function() {
- t.play()
- }), 20), this._playing
- },
- duration: function() {
- var t = this._video,
- e = -1;
- return t ? (e = t.duration, e <= 0 && cc.logID(7702), e) : e
- },
- currentTime: function() {
- var t = this._video;
- return t ? t.currentTime : -1
- },
- setKeepAspectRatioEnabled: function() {
- cc.logID(7700)
- },
- isKeepAspectRatioEnabled: function() {
- return !0
- },
- _toggleFullscreen: function(t) {
- var e = this,
- i = this._video;
- i && (t ? (s.browserType === s.BROWSER_TYPE_IE && (i.style.transform = ""), cc.screen.requestFullScreen(i, (function(t) {
- var n = s.browserType === s.BROWSER_TYPE_IE ? document.msFullscreenElement : document.fullscreenElement;
- e._fullScreenEnabled = n === i
- }), (function(t) {
- e._fullScreenEnabled = !1
- }))) : cc.screen.fullScreen() && cc.screen.exitFullScreen(i))
- },
- setFullScreenEnabled: function(t) {
- !this._loadedmeta && t ? this._waitingFullscreen = !0 : this._toggleFullscreen(t)
- },
- isFullScreenEnabled: function() {
- return this._fullScreenEnabled
- },
- setEventListener: function(t, e) {
- this._EventList[t] = e
- },
- removeEventListener: function(t) {
- this._EventList[t] = null
- },
- _dispatchEvent: function(t) {
- var e = this._EventList[t];
- e && e.call(this, this, this._video.src)
- },
- onPlayEvent: function() {
- this._EventList[l.EventType.PLAYING].call(this, this, this._video.src)
- },
- enable: function() {
- var t = l.elements; - 1 === t.indexOf(this) && t.push(this), this.setVisible(!0)
- },
- disable: function() {
- var t = l.elements,
- e = t.indexOf(this); - 1 !== e && t.splice(e, 1), this.setVisible(!1)
- },
- destroy: function() {
- this.disable(), this.removeDom()
- },
- setVisible: function(t) {
- this._visible !== t && (this._visible = !!t, this._updateVisibility())
- },
- updateMatrix: function(t) {
- if (this._video && this._visible && !this._fullScreenEnabled) {
- t.getWorldMatrix(a);
- var e = cc.Camera._findRendererCamera(t);
- e && e.worldMatrixToScreen(a, a, cc.game.canvas.width, cc.game.canvas.height);
- var i = a.m;
- if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
- this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
- var n = cc.view._devicePixelRatio,
- r = 1 / n,
- s = 1 / n,
- o = cc.game.container,
- h = i[0] * r,
- c = i[1],
- u = i[4],
- _ = i[5] * s,
- f = o && o.style.paddingLeft ? parseInt(o.style.paddingLeft) : 0,
- d = o && o.style.paddingBottom ? parseInt(o.style.paddingBottom) : 0,
- p = void 0,
- m = void 0;
- l._polyfill.zoomInvalid ? (this._updateSize(this._w * h, this._h * _), h = 1, _ = 1, p = this._w * r, m = this._h * s) : (p = this._w * r, m = this._h * s, this._updateSize(this._w, this._h));
- var y = p * i[0] * t._anchorPoint.x,
- v = m * i[5] * t._anchorPoint.y,
- g = "matrix(" + h + "," + -c + "," + -u + "," + _ + "," + (i[12] * r - y + f) + "," + -(i[13] * s - v + d) + ")";
- this._video.style.transform = g, this._video.style["-webkit-transform"] = g, this._video.style["transform-origin"] = "0px 100% 0px", this._video.style["-webkit-transform-origin"] = "0px 100% 0px", this._forceUpdate = !1
- }
- }
- }
- });
- l.EventType = {
- PLAYING: 0,
- PAUSED: 1,
- STOPPED: 2,
- COMPLETED: 3,
- META_LOADED: 4,
- CLICKED: 5,
- READY_TO_PLAY: 6
- }, l.elements = [], l.pauseElements = [], cc.game.on(cc.game.EVENT_HIDE, (function() {
- for (var t, e = l.elements, i = 0; i < e.length; i++)(t = e[i]).isPlaying() && (t.pause(), l.pauseElements.push(t))
- })), cc.game.on(cc.game.EVENT_SHOW, (function() {
- for (var t = l.pauseElements, e = t.pop(); e;) e.play(), e = t.pop()
- })), l._polyfill = {
- devicePixelRatio: !1,
- event: "canplay",
- canPlayType: []
- };
- var h = document.createElement("video");
- h.canPlayType && (h.canPlayType("video/ogg") && (l._polyfill.canPlayType.push(".ogg"), l._polyfill.canPlayType.push(".ogv")), h.canPlayType("video/mp4") && l._polyfill.canPlayType.push(".mp4"), h.canPlayType("video/webm") && l._polyfill.canPlayType.push(".webm")), s.browserType === s.BROWSER_TYPE_FIREFOX && (l._polyfill.autoplayAfterOperation = !0), s.OS_ANDROID !== s.os || s.browserType !== s.BROWSER_TYPE_SOUGOU && s.browserType !== s.BROWSER_TYPE_360 || (l._polyfill.zoomInvalid = !0);
- var c = document.createElement("style");
- c.innerHTML = ".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}", document.head.appendChild(c), e.exports = l
- }), {
- "../core/platform/CCSys": 207,
- "../core/platform/utils": 222,
- "../core/vmath": 326
- }],
- 397: [(function(t, e, i) {
- "use strict";
- var n = t("./webview-impl"),
- r = n.EventType;
- function s() {}
- var o = cc.Class({
- name: "cc.WebView",
- extends: cc.Component,
- editor: !1,
- properties: {
- _useOriginalSize: !0,
- _url: "",
- url: {
- type: cc.String,
- tooltip: !1,
- get: function() {
- return this._url
- },
- set: function(t) {
- this._url = t;
- var e = this._impl;
- e && e.loadURL(t)
- }
- },
- webviewEvents: {
- default: [],
- type: cc.Component.EventHandler
- }
- },
- statics: {
- EventType: r,
- Impl: n
- },
- ctor: function() {
- this._impl = new o.Impl
- },
- onRestore: function() {
- this._impl || (this._impl = new o.Impl)
- },
- onEnable: function() {
- var t = this._impl;
- t.createDomElementIfNeeded(this.node.width, this.node.height), t.setEventListener(r.LOADED, this._onWebViewLoaded.bind(this)), t.setEventListener(r.LOADING, this._onWebViewLoading.bind(this)), t.setEventListener(r.ERROR, this._onWebViewLoadError.bind(this)), t.loadURL(this._url), t.setVisible(!0)
- },
- onDisable: function() {
- var t = this._impl;
- t.setVisible(!1), t.setEventListener(r.LOADED, s), t.setEventListener(r.LOADING, s), t.setEventListener(r.ERROR, s)
- },
- onDestroy: function() {
- this._impl && (this._impl.destroy(), this._impl = null)
- },
- update: function(t) {
- this._impl && this._impl.updateMatrix(this.node)
- },
- _onWebViewLoaded: function() {
- cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.LOADED), this.node.emit("loaded", this)
- },
- _onWebViewLoading: function() {
- return cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.LOADING), this.node.emit("loading", this), !0
- },
- _onWebViewLoadError: function() {
- cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.ERROR), this.node.emit("error", this)
- },
- setJavascriptInterfaceScheme: function(t) {
- this._impl && this._impl.setJavascriptInterfaceScheme(t)
- },
- setOnJSCallback: function(t) {
- this._impl && this._impl.setOnJSCallback(t)
- },
- evaluateJS: function(t) {
- this._impl && this._impl.evaluateJS(t)
- }
- });
- cc.WebView = e.exports = o
- }), {
- "./webview-impl": 398
- }],
- 398: [(function(t, e, i) {
- "use strict";
- var n = t("../core/vmath"),
- r = t("../core/platform/utils"),
- s = t("../core/platform/CCSys"),
- o = n.mat4.create(),
- a = cc.Class({
- name: "WebViewImpl",
- ctor: function() {
- this._EventList = {}, this._visible = !1, this._parent = null, this._div = null, this._iframe = null, this._listener = null, this._forceUpdate = !1, this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this.__eventListeners = {}
- },
- _updateVisibility: function() {
- if (this._div) {
- var t = this._div;
- this._visible ? t.style.visibility = "visible" : t.style.visibility = "hidden"
- }
- },
- _updateSize: function(t, e) {
- var i = this._div;
- i && (i.style.width = t + "px", i.style.height = e + "px")
- },
- _initEvent: function() {
- var t = this._iframe;
- if (t) {
- var e = this.__eventListeners,
- i = this;
- e.load = function() {
- i._forceUpdate = !0, i._dispatchEvent(a.EventType.LOADED)
- }, e.error = function() {
- i._dispatchEvent(a.EventType.ERROR)
- }, t.addEventListener("load", e.load), t.addEventListener("error", e.error)
- }
- },
- _initStyle: function() {
- if (this._div) {
- var t = this._div;
- t.style.position = "absolute", t.style.bottom = "0px", t.style.left = "0px"
- }
- },
- _setOpacity: function(t) {
- var e = this._iframe;
- e && e.style && (e.style.opacity = t / 255)
- },
- _createDom: function(t, e) {
- a._polyfill.enableDiv ? (this._div = document.createElement("div"), this._div.style["-webkit-overflow"] = "auto", this._div.style["-webkit-overflow-scrolling"] = "touch", this._iframe = document.createElement("iframe"), this._div.appendChild(this._iframe), this._iframe.style.width = "100%", this._iframe.style.height = "100%") : this._div = this._iframe = document.createElement("iframe"), a._polyfill.enableBG && (this._div.style.background = "#FFF"), this._div.style.background = "#FFF", this._div.style.height = e + "px", this._div.style.width = t + "px", this._div.style.overflow = "scroll", this._iframe.style.border = "none", cc.game.container.appendChild(this._div), this._updateVisibility()
- },
- _createNativeControl: function(t, e) {
- this._createDom(t, e), this._initStyle(), this._initEvent()
- },
- createDomElementIfNeeded: function(t, e) {
- this._div ? this._updateSize(t, e) : this._createNativeControl(t, e)
- },
- removeDom: function() {
- var t = this._div;
- t && (r.contains(cc.game.container, t) && cc.game.container.removeChild(t), this._div = null);
- var e = this._iframe;
- if (e) {
- var i = this.__eventListeners;
- e.removeEventListener("load", i.load), e.removeEventListener("error", i.error), i.load = null, i.error = null, this._iframe = null
- }
- },
- setOnJSCallback: function(t) {},
- setJavascriptInterfaceScheme: function(t) {},
- loadData: function(t, e, i, n) {},
- loadHTMLString: function(t, e) {},
- loadURL: function(t) {
- var e = this._iframe;
- if (e) {
- e.src = t;
- var i = this;
- e.addEventListener("load", (function t() {
- i._loaded = !0, i._updateVisibility(), e.removeEventListener("load", t)
- })), this._dispatchEvent(a.EventType.LOADING)
- }
- },
- stopLoading: function() {
- cc.logID(7800)
- },
- reload: function() {
- var t = this._iframe;
- if (t) {
- var e = t.contentWindow;
- e && e.location && e.location.reload()
- }
- },
- canGoBack: function() {
- return cc.logID(7801), !0
- },
- canGoForward: function() {
- return cc.logID(7802), !0
- },
- goBack: function() {
- try {
- if (a._polyfill.closeHistory) return cc.logID(7803);
- var t = this._iframe;
- if (t) {
- var e = t.contentWindow;
- e && e.location && e.history.back.call(e)
- }
- } catch (t) {
- cc.log(t)
- }
- },
- goForward: function() {
- try {
- if (a._polyfill.closeHistory) return cc.logID(7804);
- var t = this._iframe;
- if (t) {
- var e = t.contentWindow;
- e && e.location && e.history.forward.call(e)
- }
- } catch (t) {
- cc.log(t)
- }
- },
- evaluateJS: function(t) {
- var e = this._iframe;
- if (e) {
- var i = e.contentWindow;
- try {
- i.eval(t), this._dispatchEvent(a.EventType.JS_EVALUATED)
- } catch (t) {
- console.error(t)
- }
- }
- },
- setScalesPageToFit: function() {
- cc.logID(7805)
- },
- setEventListener: function(t, e) {
- this._EventList[t] = e
- },
- removeEventListener: function(t) {
- this._EventList[t] = null
- },
- _dispatchEvent: function(t) {
- var e = this._EventList[t];
- e && e.call(this, this, this._iframe.src)
- },
- _createRenderCmd: function() {
- return new a.RenderCmd(this)
- },
- destroy: function() {
- this.removeDom()
- },
- setVisible: function(t) {
- this._visible !== t && (this._visible = !!t, this._updateVisibility())
- },
- updateMatrix: function(t) {
- if (this._div && this._visible) {
- t.getWorldMatrix(o);
- var e = cc.Camera._findRendererCamera(t);
- e && e.worldMatrixToScreen(o, o, cc.game.canvas.width, cc.game.canvas.height);
- var i = o.m;
- if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
- this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
- var n = cc.view._devicePixelRatio,
- r = 1 / n,
- s = 1 / n,
- a = cc.game.container,
- l = i[0] * r,
- h = i[1],
- c = i[4],
- u = i[5] * s,
- _ = a && a.style.paddingLeft ? parseInt(a.style.paddingLeft) : 0,
- f = a && a.style.paddingBottom ? parseInt(a.style.paddingBottom) : 0;
- this._updateSize(this._w, this._h);
- var d = this._w * r,
- p = this._h * s,
- m = d * i[0] * t._anchorPoint.x,
- y = p * i[5] * t._anchorPoint.y,
- v = "matrix(" + l + "," + -h + "," + -c + "," + u + "," + (i[12] * r - m + _) + "," + -(i[13] * s - y + f) + ")";
- this._div.style.transform = v, this._div.style["-webkit-transform"] = v, this._div.style["transform-origin"] = "0px 100% 0px", this._div.style["-webkit-transform-origin"] = "0px 100% 0px", this._setOpacity(t.opacity), this._forceUpdate = !1
- }
- }
- }
- });
- a.EventType = {
- LOADING: 0,
- LOADED: 1,
- ERROR: 2,
- JS_EVALUATED: 3
- };
- var l = a._polyfill = {
- devicePixelRatio: !1,
- enableDiv: !1
- };
- s.os === s.OS_IOS && (l.enableDiv = !0), s.isMobile ? s.browserType === s.BROWSER_TYPE_FIREFOX && (l.enableBG = !0) : s.browserType === s.BROWSER_TYPE_IE && (l.closeHistory = !0), e.exports = a
- }), {
- "../core/platform/CCSys": 207,
- "../core/platform/utils": 222,
- "../core/vmath": 326
- }],
- 399: [(function(t, e, i) {
- "use strict";
- t("./cocos2d/core"), t("./cocos2d/animation"), t("./cocos2d/particle"), t("./cocos2d/tilemap"), t("./cocos2d/videoplayer/CCVideoPlayer"), t("./cocos2d/webview/CCWebView"), t("./cocos2d/core/components/CCStudioComponent"), t("./extensions/ccpool/CCNodePool"), t("./cocos2d/actions"), t("./extensions/spine"), t("./extensions/dragonbones"), t("./cocos2d/deprecated")
- }), {
- "./cocos2d/actions": 7,
- "./cocos2d/animation": 16,
- "./cocos2d/core": 144,
- "./cocos2d/core/components/CCStudioComponent": 112,
- "./cocos2d/deprecated": 337,
- "./cocos2d/particle": 343,
- "./cocos2d/particle/CCParticleAsset": 340,
- "./cocos2d/tilemap": 392,
- "./cocos2d/tilemap/CCTiledMapAsset": 388,
- "./cocos2d/videoplayer/CCVideoPlayer": 395,
- "./cocos2d/webview/CCWebView": 397,
- "./extensions/ccpool/CCNodePool": 400,
- "./extensions/dragonbones": 409,
- "./extensions/spine": 413
- }],
- 400: [(function(t, e, i) {
- "use strict";
- cc.NodePool = function(t) {
- this.poolHandlerComp = t, this._pool = []
- }, cc.NodePool.prototype = {
- constructor: cc.NodePool,
- size: function() {
- return this._pool.length
- },
- clear: function() {
- for (var t = this._pool.length, e = 0; e < t; ++e) this._pool[e].destroy();
- this._pool.length = 0
- },
- put: function(t) {
- if (t && -1 === this._pool.indexOf(t)) {
- t.removeFromParent(!1);
- var e = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null;
- e && e.unuse && e.unuse(), this._pool.push(t)
- }
- },
- get: function() {
- var t = this._pool.length - 1;
- if (t < 0) return null;
- var e = this._pool[t];
- this._pool.length = t;
- var i = this.poolHandlerComp ? e.getComponent(this.poolHandlerComp) : null;
- return i && i.reuse && i.reuse.apply(i, arguments), e
- }
- }, e.exports = cc.NodePool
- }), {}],
- 401: [(function(t, e, i) {
- "use strict";
- var n = [],
- r = [],
- s = 0,
- o = 0,
- a = null,
- l = null,
- h = 0,
- c = 0,
- u = 0,
- _ = 0,
- f = null,
- d = void 0,
- p = void 0,
- m = cc.Class({
- ctor: function() {
- this._inited = !1, this._invalid = !0, this.frames = [], this.totalTime = 0, this.isCompleted = !1, this._frameIdx = -1, this._armatureInfo = null, this._animationName = null, this._tempSegments = null, this._tempColors = null
- },
- init: function(t, e) {
- this._inited = !0, this._armatureInfo = t, this._animationName = e
- },
- clear: function() {
- this._inited = !1;
- for (var t = 0, e = this.frames.length; t < e; t++) {
- this.frames[t].segments.length = 0
- }
- this.invalidAllFrame()
- },
- begin: function() {
- if (this._invalid) {
- var t = this._armatureInfo,
- e = t.curAnimationCache;
- e && e != this && e.updateToFrame(), t.armature.animation.play(this._animationName, 1), t.curAnimationCache = this, this._invalid = !1, this._frameIdx = -1, this.totalTime = 0, this.isCompleted = !1
- }
- },
- end: function() {
- this._needToUpdate() || (this._armatureInfo.curAnimationCache = null, this.frames.length = this._frameIdx + 1, this.isCompleted = !0)
- },
- _needToUpdate: function(t) {
- return !this._armatureInfo.armature.animation.isCompleted && this.totalTime < 30 && (void 0 == t || this._frameIdx < t)
- },
- updateToFrame: function(t) {
- if (this._inited && (this.begin(), this._needToUpdate(t))) {
- var e = this._armatureInfo.armature;
- do {
- e.advanceTime(1 / 60), this._frameIdx++, this._updateFrame(e, this._frameIdx), this.totalTime += 1 / 60
- } while (this._needToUpdate(t));
- this.end()
- }
- },
- isInited: function() {
- return this._inited
- },
- isInvalid: function() {
- return this._invalid
- },
- invalidAllFrame: function() {
- this.isCompleted = !1, this._invalid = !0
- },
- updateAllFrame: function() {
- this.invalidAllFrame(), this.updateToFrame()
- },
- _updateFrame: function(t, e) {
- o = 0, s = 0, 0, a = null, l = null, h = 0, c = 0, u = 0, _ = 0, f = null, this.frames[e] = this.frames[e] || {
- segments: [],
- colors: [],
- vertices: null,
- uintVert: null,
- indices: null
- };
- var i = this.frames[e],
- d = this._tempSegments = i.segments,
- p = this._tempColors = i.colors;
- this._traverseArmature(t, 1), _ > 0 && (p[_ - 1].vfOffset = o), p.length = _;
- var m = u - 1;
- if (m >= 0)
- if (c > 0) {
- var y = d[m];
- y.indexCount = c, y.vfCount = 5 * h, y.vertexCount = h, d.length = u
- } else d.length = u - 1;
- if (0 !== d.length) {
- var v = i.vertices,
- g = i.uintVert;
- (!v || v.length < o) && (v = i.vertices = new Float32Array(o), g = i.uintVert = new Uint32Array(v.buffer));
- for (var x = 0, b = 0; x < o;) v[x++] = n[b++], v[x++] = n[b++], v[x++] = n[b++], v[x++] = n[b++], g[x++] = n[b++];
- var A = i.indices;
- (!A || A.length < s) && (A = i.indices = new Uint16Array(s));
- for (var C = 0; C < s; C++) A[C] = r[C];
- i.vertices = v, i.uintVert = g, i.indices = A
- }
- },
- _traverseArmature: function(t, e) {
- for (var i = this._tempColors, m = this._tempSegments, y = n, v = r, g = void 0, x = void 0, b = t._slots, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, E = void 0, M = void 0, D = 0, B = b.length; D < B; D++)
- if ((A = b[D])._visible && A._displayData)
- if (A.updateWorldMatrix(), T = A._color, A.childArmature) this._traverseArmature(A.childArmature, e * T.a / 255);
- else if (w = A.getTexture()) {
- a === w.url && l === A._blendMode || (a = w.url, l = A._blendMode, (E = u - 1) >= 0 && (c > 0 ? ((M = m[E]).indexCount = c, M.vertexCount = h, M.vfCount = 5 * h) : u--), m[u] = {
- tex: w,
- blendMode: A._blendMode,
- indexCount: 0,
- vertexCount: 0,
- vfCount: 0
- }, u++, c = 0, h = 0), S = (T.a * e << 24 >>> 0) + (T.b << 16) + (T.g << 8) + T.r, f !== S && (f = S, _ > 0 && (i[_ - 1].vfOffset = o), i[_++] = {
- r: T.r,
- g: T.g,
- b: T.b,
- a: T.a * e,
- vfOffset: 0
- }), g = A._localVertices, x = A._indices, C = A._worldMatrix.m;
- for (var I = 0, P = g.length; I < P;) d = g[I++], p = g[I++], y[o++] = d * C[0] + p * C[4] + C[12], y[o++] = d * C[1] + p * C[5] + C[13], y[o++] = g[I++], y[o++] = g[I++], y[o++] = S;
- for (var R = 0, O = x.length; R < O; R++) v[s++] = h + x[R];
- o / 5, c += x.length, h += g.length / 4
- }
- }
- }),
- y = cc.Class({
- ctor: function() {
- this._animationPool = {}, this._armatureCache = {}
- },
- dispose: function() {
- for (var t in this._armatureCache) {
- var e = this._armatureCache[t];
- if (e) {
- var i = e.armature;
- i && i.dispose()
- }
- }
- this._armatureCache = null, this._animationPool = null
- },
- _removeArmature: function(t) {
- var e = this._armatureCache[t],
- i = e.animationsCache;
- for (var n in i) {
- var r = i[n];
- r && (this._animationPool[t + "#" + n] = r, r.clear())
- }
- var s = e.armature;
- s && s.dispose(), delete this._armatureCache[t]
- },
- resetArmature: function(t) {
- for (var e in this._armatureCache) - 1 != e.indexOf(t) && this._removeArmature(e)
- },
- getArmatureCache: function(t, e, i) {
- var n = this._armatureCache[e],
- r = void 0;
- if (n) r = n.armature;
- else {
- var s = dragonBones.CCFactory.getInstance().buildArmatureDisplay(t, e, "", i);
- if (!s || !s._armature) return;
- if (r = s._armature, !y.canCache(r)) return void r.dispose();
- this._armatureCache[e] = {
- armature: r,
- animationsCache: {},
- curAnimationCache: null
- }
- }
- return r
- },
- getAnimationCache: function(t, e) {
- var i = this._armatureCache[t];
- return i ? i.animationsCache[e] : null
- },
- initAnimationCache: function(t, e) {
- if (!e) return null;
- var i = this._armatureCache[t],
- n = i && i.armature;
- if (!n) return null;
- if (!n.animation.hasAnimation(e)) return null;
- var r = i.animationsCache,
- s = r[e];
- if (!s) {
- var o = t + "#" + e;
- (s = this._animationPool[o]) ? delete this._animationPool[o]: s = new m, s.init(i, e), r[e] = s
- }
- return s
- },
- invalidAnimationCache: function(t) {
- var e = this._armatureCache[t];
- if (!(e && e.armature)) return null;
- var i = e.animationsCache;
- for (var n in i) {
- i[n].invalidAllFrame()
- }
- },
- updateAnimationCache: function(t, e) {
- if (e) {
- var i = this.initAnimationCache(t, e);
- if (!i) return;
- i.updateAllFrame()
- } else {
- var n = this._armatureCache[t];
- if (!(n && n.armature)) return null;
- var r = n.animationsCache;
- for (var s in r) {
- r[s].updateAllFrame()
- }
- }
- }
- });
- y.FrameTime = 1 / 60, y.sharedCache = new y, y.canCache = function(t) {
- for (var e = t._slots, i = 0, n = e.length; i < n; i++) {
- if (e[i].childArmature) return !1
- }
- return !0
- }, e.exports = y
- }), {}],
- 402: [(function(t, e, i) {
- "use strict";
- var n = t("../../cocos2d/core/components/CCRenderComponent"),
- r = t("../../cocos2d/core/assets/material/CCMaterial"),
- s = t("../../cocos2d/core/event/event-target"),
- o = (t("../../cocos2d/core/CCNode"), t("../../cocos2d/core/graphics/graphics")),
- a = t("./ArmatureCache"),
- l = cc.Enum({
- default: -1
- }),
- h = cc.Enum({
- "<None>": 0
- }),
- c = (cc.Enum({
- REALTIME: 0
- }), cc.Enum({
- REALTIME: 0,
- SHARED_CACHE: 1,
- PRIVATE_CACHE: 2
- }));
- var u = cc.Class({
- name: "dragonBones.ArmatureDisplay",
- extends: n,
- editor: !1,
- statics: {
- AnimationCacheMode: c
- },
- properties: {
- _factory: {
- default: null,
- type: dragonBones.CCFactory,
- serializable: !1
- },
- dragonAsset: {
- default: null,
- type: dragonBones.DragonBonesAsset,
- notify: function() {
- this._refresh()
- },
- tooltip: !1
- },
- dragonAtlasAsset: {
- default: null,
- type: dragonBones.DragonBonesAtlasAsset,
- notify: function() {
- this._parseDragonAtlasAsset(), this._refresh(), this._activateMaterial()
- },
- tooltip: !1
- },
- _armatureName: "",
- armatureName: {
- get: function() {
- return this._armatureName
- },
- set: function(t) {
- this._armatureName = t;
- var e = this.getAnimationNames(this._armatureName);
- (!this.animationName || e.indexOf(this.animationName) < 0) && (this.animationName = ""), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature), this._refresh(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature)
- },
- visible: !1
- },
- _animationName: "",
- animationName: {
- get: function() {
- return this._animationName
- },
- set: function(t) {
- this._animationName = t
- },
- visible: !1
- },
- _defaultArmatureIndex: {
- default: 0,
- notify: function() {
- var t = "";
- if (this.dragonAsset) {
- var e = void 0;
- if (this.dragonAsset && (e = this.dragonAsset.getArmatureEnum()), !e) return cc.errorID(7400, this.name);
- t = e[this._defaultArmatureIndex]
- }
- void 0 !== t ? this.armatureName = t : cc.errorID(7401, this.name)
- },
- type: l,
- visible: !0,
- editorOnly: !0,
- animatable: !1,
- displayName: "Armature",
- tooltip: !1
- },
- _animationIndex: {
- default: 0,
- notify: function() {
- if (0 !== this._animationIndex) {
- var t = void 0;
- if (this.dragonAsset && (t = this.dragonAsset.getAnimsEnum(this.armatureName)), t) {
- var e = t[this._animationIndex];
- void 0 !== e ? this.playAnimation(e, this.playTimes) : cc.errorID(7402, this.name)
- }
- } else this.animationName = ""
- },
- type: h,
- visible: !0,
- editorOnly: !0,
- displayName: "Animation",
- tooltip: !1
- },
- _preCacheMode: -1,
- _cacheMode: c.REALTIME,
- _defaultCacheMode: {
- default: 0,
- type: c,
- notify: function() {
- this.setAnimationCacheMode(this._defaultCacheMode)
- },
- editorOnly: !0,
- visible: !0,
- animatable: !1,
- displayName: "Animation Cache Mode",
- tooltip: !1
- },
- timeScale: {
- default: 1,
- notify: function() {
- this._armature && !this.isAnimationCached() && (this._armature.animation.timeScale = this.timeScale)
- },
- tooltip: !1
- },
- playTimes: {
- default: -1,
- tooltip: !1
- },
- premultipliedAlpha: {
- default: !1,
- tooltip: !1
- },
- debugBones: {
- default: !1,
- notify: function() {
- this._updateDebugDraw()
- },
- tooltip: !1
- },
- enableBatch: {
- default: !1,
- notify: function() {
- this._updateBatch()
- },
- tooltip: !1
- },
- _armatureKey: "",
- _accTime: 0,
- _playCount: 0,
- _frameCache: null,
- _curFrame: null,
- _playing: !1,
- _armatureCache: null
- },
- ctor: function() {
- this._eventTarget = new s, this._materialCache = {}, this._inited = !1, this._factory = dragonBones.CCFactory.getInstance()
- },
- onLoad: function() {
- for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- 0 === (n._name && n._name.search("CHILD_ARMATURE-")) && n.destroy()
- }
- },
- _updateBatch: function() {
- var t = this.getMaterial(0);
- t && t.define("CC_USE_MODEL", !this.enableBatch);
- var e = this._materialCache;
- for (var i in e) {
- var n = e[i];
- n && n.define("CC_USE_MODEL", !this.enableBatch)
- }
- },
- setMaterial: function(t, e) {
- this._super(t, e), this._materialCache = {}
- },
- __preload: function() {
- this._resetAssembler(), this._init()
- },
- _init: function() {
- if (!this._inited) {
- this._inited = !0, this._parseDragonAtlasAsset(), this._refresh(), this._activateMaterial();
- for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n && "DEBUG_DRAW_NODE" === n._name && n.destroy()
- }
- this._updateDebugDraw()
- }
- },
- getArmatureKey: function() {
- return this._armatureKey
- },
- setAnimationCacheMode: function(t) {
- this._preCacheMode !== t && (this._cacheMode = t, this._buildArmature())
- },
- isAnimationCached: function() {
- return this._cacheMode !== c.REALTIME
- },
- onEnable: function() {
- this._super(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature), this._activateMaterial()
- },
- onDisable: function() {
- this._super(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature)
- },
- _emitCacheCompleteEvent: function() {
- this._eventTarget.emit(dragonBones.EventObject.LOOP_COMPLETE), this._eventTarget.emit(dragonBones.EventObject.COMPLETE)
- },
- update: function(t) {
- if (this.isAnimationCached() && this._frameCache) {
- var e = this._frameCache;
- if (e.isInited()) {
- var i = e.frames;
- if (this._playing) {
- var n = a.FrameTime;
- 0 == this._accTime && 0 == this._playCount && this._eventTarget.emit(dragonBones.EventObject.START);
- var r = dragonBones.timeScale;
- this._accTime += t * this.timeScale * r;
- var s = Math.floor(this._accTime / n);
- if (e.isCompleted || e.updateToFrame(s), e.isCompleted && s >= i.length) {
- if (this._playCount++, this.playTimes > 0 && this._playCount >= this.playTimes) return this._curFrame = i[i.length - 1], this._accTime = 0, this._playing = !1, this._playCount = 0, void this._emitCacheCompleteEvent();
- this._accTime = 0, s = 0, this._emitCacheCompleteEvent()
- }
- this._curFrame = i[s]
- } else e.isInvalid() && (e.updateToFrame(), this._curFrame = i[i.length - 1])
- }
- }
- },
- onDestroy: function() {
- this._super(), this._inited = !1, this._cacheMode === c.PRIVATE_CACHE ? (this._armatureCache.dispose(), this._armatureCache = null, this._armature = null) : this._cacheMode === c.SHARED_CACHE ? (this._armatureCache = null, this._armature = null) : this._armature && (this._armature.dispose(), this._armature = null)
- },
- _updateDebugDraw: function() {
- if (this.debugBones) {
- if (!this._debugDraw) {
- var t = new cc.PrivateNode;
- t.name = "DEBUG_DRAW_NODE";
- var e = t.addComponent(o);
- e.lineWidth = 1, e.strokeColor = cc.color(255, 0, 0, 255), this._debugDraw = e
- }
- this._debugDraw.node.parent = this.node
- } else this._debugDraw && (this._debugDraw.node.parent = null)
- },
- _activateMaterial: function() {
- var t = this.dragonAtlasAsset && this.dragonAtlasAsset.texture;
- if (t) {
- if (!t.loaded) return this.disableRender(), void t.once("load", this._activateMaterial, this);
- var e = this.sharedMaterials[0];
- (e = e ? r.getInstantiatedMaterial(e, this) : r.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("CC_USE_MODEL", !0), e.define("USE_TEXTURE", !0), e.setProperty("texture", t), this.setMaterial(0, e), this._prepareToRender()
- } else this.disableRender()
- },
- _prepareToRender: function() {
- this.node && this.node._renderComponent == this && this.markForRender(!0)
- },
- _buildArmature: function() {
- if (this.dragonAsset && this.dragonAtlasAsset && this.armatureName) {
- this._armature && (this._preCacheMode === c.PRIVATE_CACHE ? this._armatureCache.dispose() : this._preCacheMode === c.REALTIME && this._armature.dispose(), this._armatureCache = null, this._armature = null, this._displayProxy = null, this._frameCache = null, this._curFrame = null, this._playing = !1, this._preCacheMode = null), this._cacheMode === c.SHARED_CACHE ? this._armatureCache = a.sharedCache : this._cacheMode === c.PRIVATE_CACHE && (this._armatureCache = new a);
- var t = this.dragonAtlasAsset._uuid;
- if (this._armatureKey = this.dragonAsset.init(this._factory, t), this.isAnimationCached() && (this._armature = this._armatureCache.getArmatureCache(this.armatureName, this._armatureKey, t), this._armature || (this._cacheMode = c.REALTIME)), this._preCacheMode = this._cacheMode, this._cacheMode === c.REALTIME) {
- if (this._displayProxy = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t), !this._displayProxy) return;
- this._displayProxy._ccNode = this.node, this._displayProxy.setEventTarget(this._eventTarget), this._armature = this._displayProxy._armature, this._armature.animation.timeScale = this.timeScale
- }
- this._cacheMode !== c.REALTIME && this.debugBones && cc.warn("Debug bones is invalid in cached mode"), this._updateBatch(), this.animationName && this.playAnimation(this.animationName, this.playTimes)
- }
- },
- _parseDragonAtlasAsset: function() {
- this.dragonAtlasAsset && this.dragonAtlasAsset.init(this._factory)
- },
- _refresh: function() {
- this._buildArmature()
- },
- _updateCacheModeEnum: !1,
- _updateAnimEnum: !1,
- _updateArmatureEnum: !1,
- playAnimation: function(t, e) {
- if (this.playTimes = void 0 === e ? -1 : e, this.animationName = t, this.isAnimationCached()) {
- var i = this._armatureCache.getAnimationCache(this._armatureKey, t);
- i || (i = this._armatureCache.initAnimationCache(this._armatureKey, t)), i && (this._accTime = 0, this._playCount = 0, this._frameCache = i, this._frameCache.updateToFrame(0), this._playing = !0, this._curFrame = this._frameCache.frames[0])
- } else if (this._armature) return this._armature.animation.play(t, this.playTimes)
- },
- updateAnimationCache: function(t) {
- this.isAnimationCached() && this._armatureCache.updateAnimationCache(this._armatureKey, t)
- },
- invalidAnimationCache: function() {
- this.isAnimationCached() && this._armatureCache.invalidAnimationCache(this._armatureKey)
- },
- getArmatureNames: function() {
- var t = this._factory.getDragonBonesData(this._armatureKey);
- return t && t.armatureNames || []
- },
- getAnimationNames: function(t) {
- var e = [],
- i = this._factory.getDragonBonesData(this._armatureKey);
- if (i) {
- var n = i.getArmature(t);
- if (n)
- for (var r in n.animations) n.animations.hasOwnProperty(r) && e.push(r)
- }
- return e
- },
- on: function(t, e, i) {
- this.addEventListener(t, e, i)
- },
- off: function(t, e, i) {
- this.removeEventListener(t, e, i)
- },
- once: function(t, e, i) {
- this._eventTarget.once(t, e, i)
- },
- addEventListener: function(t, e, i) {
- this._eventTarget.on(t, e, i)
- },
- removeEventListener: function(t, e, i) {
- this._eventTarget.off(t, e, i)
- },
- buildArmature: function(t, e) {
- return this._factory.createArmatureNode(this, t, e)
- },
- armature: function() {
- return this._armature
- }
- });
- e.exports = dragonBones.ArmatureDisplay = u
- }), {
- "../../cocos2d/core/CCNode": 52,
- "../../cocos2d/core/assets/material/CCMaterial": 75,
- "../../cocos2d/core/components/CCRenderComponent": 106,
- "../../cocos2d/core/event/event-target": 131,
- "../../cocos2d/core/graphics/graphics": 140,
- "./ArmatureCache": 401
- }],
- 403: [(function(t, e, i) {
- "use strict";
- var n = t("../../cocos2d/core/event/event-target");
- dragonBones.CCArmatureDisplay = cc.Class({
- name: "dragonBones.CCArmatureDisplay",
- properties: {
- node: {
- get: function() {
- return this
- }
- }
- },
- ctor: function() {
- this._eventTarget = new n
- },
- setEventTarget: function(t) {
- this._eventTarget = t
- },
- getRootDisplay: function() {
- var t, e = this._armature._parent;
- if (!e) return this;
- for (; e;) t = e, e = e._armature._parent;
- return t._armature.getDisplay()
- },
- convertToRootSpace: function(t) {
- var e = this._armature._parent;
- if (!e) return t;
- e.updateWorldMatrix();
- var i = e._worldMatrix.m,
- n = cc.v2(0, 0);
- return n.x = t.x * i[0] + t.y * i[4] + i[12], n.y = t.x * i[1] + t.y * i[5] + i[13], n
- },
- convertToWorldSpace: function(t) {
- var e = this.convertToRootSpace(t);
- return this.getRootNode().convertToWorldSpace(e)
- },
- getRootNode: function() {
- var t = this.getRootDisplay();
- return t && t._ccNode
- },
- dbInit: function(t) {
- this._armature = t
- },
- dbClear: function() {
- this._armature = null
- },
- dbUpdate: function() {},
- advanceTimeBySelf: function(t) {
- this.shouldAdvanced = !!t
- },
- hasDBEventListener: function(t) {
- return this._eventTarget.hasEventListener(t)
- },
- addDBEventListener: function(t, e, i) {
- this._eventTarget.on(t, e, i)
- },
- removeDBEventListener: function(t, e, i) {
- this._eventTarget.off(t, e, i)
- },
- dispatchDBEvent: function(t, e) {
- this._eventTarget.emit(t, e)
- }
- })
- }), {
- "../../cocos2d/core/event/event-target": 131
- }],
- 404: [(function(t, e, i) {
- "use strict";
- var n = dragonBones.BaseObject,
- r = dragonBones.BaseFactory,
- s = dragonBones.CCFactory = cc.Class({
- name: "dragonBones.CCFactory",
- extends: r,
- statics: {
- _factory: null,
- getInstance: function() {
- return s._factory || (s._factory = new s), s._factory
- }
- },
- ctor: function() {
- var t = new dragonBones.CCArmatureDisplay;
- this._dragonBones = new dragonBones.DragonBones(t), cc.director._scheduler && (cc.game.on(cc.game.EVENT_RESTART, this.initUpdate, this), this.initUpdate())
- },
- initUpdate: function(t) {
- cc.director._scheduler.enableForTarget(this), cc.director._scheduler.scheduleUpdate(this, cc.Scheduler.PRIORITY_SYSTEM, !1)
- },
- update: function(t) {
- this._dragonBones.advanceTime(t)
- },
- getDragonBonesDataByRawData: function(t) {
- return (t instanceof ArrayBuffer ? r._binaryParser : this._dataParser).parseDragonBonesData(t, 1)
- },
- buildArmatureDisplay: function(t, e, i, n) {
- var r = this.buildArmature(t, e, i, n);
- return r && r._display
- },
- createArmatureNode: function(t, e, i) {
- var n = (i = i || new cc.Node).getComponent(dragonBones.ArmatureDisplay);
- return n || (n = i.addComponent(dragonBones.ArmatureDisplay)), i.name = e, n._armatureName = e, n._N$dragonAsset = t.dragonAsset, n._N$dragonAtlasAsset = t.dragonAtlasAsset, n._init(), n
- },
- _buildTextureAtlasData: function(t, e) {
- return t ? t.renderTexture = e : t = n.borrowObject(dragonBones.CCTextureAtlasData), t
- },
- _sortSlots: function() {
- for (var t = this._slots, e = [], i = 0, n = t.length; i < n; i++) {
- for (var r = t[i], s = r._zOrder, o = !1, a = e.length - 1; a >= 0; a--)
- if (s >= e[a]._zOrder) {
- e.splice(a + 1, 0, r), o = !0;
- break
- }
- o || e.splice(0, 0, r)
- }
- this._slots = e
- },
- _buildArmature: function(t) {
- var e = n.borrowObject(dragonBones.Armature);
- e._skinData = t.skin, e._animation = n.borrowObject(dragonBones.Animation), e._animation._armature = e, e._animation.animations = t.armature.animations, e._isChildArmature = !1;
- var i = new dragonBones.CCArmatureDisplay;
- return e.init(t.armature, i, i, this._dragonBones), e
- },
- _buildSlot: function(t, e, i) {
- var r = n.borrowObject(dragonBones.CCSlot),
- s = r;
- return r.init(e, i, s, s), r
- },
- getDragonBonesDataByUUID: function(t) {
- for (var e in this._dragonBonesDataMap)
- if (-1 != e.indexOf(t)) return this._dragonBonesDataMap[e];
- return null
- },
- removeDragonBonesDataByUUID: function(t, e) {
- for (var i in void 0 === e && (e = !0), this._dragonBonesDataMap) - 1 !== i.indexOf(t) && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[i]), delete this._dragonBonesDataMap[i])
- }
- })
- }), {}],
- 405: [(function(t, e, i) {
- "use strict";
- var n = t("../../cocos2d/core/vmath"),
- r = dragonBones.BinaryOffset,
- s = dragonBones.BoneType;
- dragonBones.CCSlot = cc.Class({
- name: "dragonBones.CCSlot",
- extends: dragonBones.Slot,
- ctor: function() {
- this._localVertices = [], this._indices = [], this._matrix = n.mat4.create(), this._worldMatrix = n.mat4.create(), this._worldMatrixDirty = !0, this._visible = !1, this._color = cc.color()
- },
- _onClear: function() {
- this._super(), this._localVertices.length = 0, this._indices.length = 0, n.mat4.identity(this._matrix), n.mat4.identity(this._worldMatrix), this._worldMatrixDirty = !0, this._color = cc.color(), this._visible = !1
- },
- statics: {
- toString: function() {
- return "[class dragonBones.CCSlot]"
- }
- },
- _onUpdateDisplay: function() {},
- _initDisplay: function(t) {},
- _addDisplay: function() {
- this._visible = !0
- },
- _replaceDisplay: function(t) {},
- _removeDisplay: function() {
- this._visible = !1
- },
- _disposeDisplay: function(t) {},
- _updateVisible: function() {
- this._visible = this.parent._visible
- },
- _updateZOrder: function() {},
- _updateBlendMode: function() {
- if (this._childArmature)
- for (var t = this._childArmature.getSlots(), e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n._blendMode = this._blendMode, n._updateBlendMode()
- }
- },
- _updateColor: function() {
- var t = this._color;
- t.r = 255 * this._colorTransform.redMultiplier, t.g = 255 * this._colorTransform.greenMultiplier, t.b = 255 * this._colorTransform.blueMultiplier, t.a = 255 * this._colorTransform.alphaMultiplier
- },
- getTexture: function() {
- return this._textureData && this._textureData.spriteFrame && this._textureData.spriteFrame.getTexture()
- },
- _updateFrame: function() {
- this._indices.length = 0;
- var t = this._indices,
- e = this._localVertices,
- i = 0,
- n = 0,
- s = this._textureData;
- if (this._display && !(this._displayIndex < 0) && s && s.spriteFrame) {
- var o = s.spriteFrame.getTexture(),
- a = o.width,
- l = o.height,
- h = s.region,
- c = null !== this._deformVertices && this._display === this._meshDisplay ? this._deformVertices.verticesData : null;
- if (c) {
- var u = c.data,
- _ = u.intArray,
- f = u.floatArray,
- d = _[c.offset + r.MeshVertexCount],
- p = _[c.offset + r.MeshTriangleCount],
- m = _[c.offset + r.MeshFloatOffset];
- m < 0 && (m += 65536);
- for (var y = m + 2 * d, v = this._armature._armatureData.scale, g = 0, x = 2 * d; g < x; g += 2) e[n++] = f[m + g] * v, e[n++] = -f[m + g + 1] * v, c.rotated ? (e[n++] = (h.x + (1 - f[y + g]) * h.width) / a, e[n++] = (h.y + f[y + g + 1] * h.height) / l) : (e[n++] = (h.x + f[y + g] * h.width) / a, e[n++] = (h.y + f[y + g + 1] * h.height) / l);
- for (var b = 0; b < 3 * p; ++b) t[i++] = _[c.offset + r.MeshVertexIndices + b];
- e.length = n, t.length = i, !!c.weight && this._identityTransform()
- } else {
- var A = h.x / a,
- C = (h.y + h.height) / l,
- T = (h.x + h.width) / a,
- S = h.y / l;
- e[n++] = 0, e[n++] = 0, e[n++] = A, e[n++] = C, e[n++] = h.width, e[n++] = 0, e[n++] = T, e[n++] = C, e[n++] = 0, e[n++] = h.height, e[n++] = A, e[n++] = S, e[n++] = h.width, e[n++] = h.height, e[n++] = T, e[n++] = S, t[0] = 0, t[1] = 1, t[2] = 2, t[3] = 1, t[4] = 3, t[5] = 2, e.length = n, t.length = 6
- }
- this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0
- }
- },
- _updateMesh: function() {
- var t = this._armature._armatureData.scale,
- e = this._deformVertices.vertices,
- i = this._deformVertices.bones,
- n = this._deformVertices.verticesData,
- o = n.weight,
- a = e.length > 0 && n.inheritDeform,
- l = this._localVertices;
- if (o) {
- var h = n.data,
- c = h.intArray,
- u = h.floatArray,
- _ = c[n.offset + r.MeshVertexCount],
- f = c[o.offset + r.WeigthFloatOffset];
- f < 0 && (f += 65536);
- for (var d = 0, p = o.offset + r.WeigthBoneIndices + i.length, m = f, y = 0, v = 0; d < _; d++, v += 4) {
- for (var g = c[p++], x = 0, b = 0, A = 0; A < g; ++A) {
- var C = i[c[p++]];
- if (null !== C) {
- var T = C.globalTransformMatrix,
- S = u[m++],
- w = u[m++] * t,
- E = u[m++] * t;
- a && (w += e[y++], E += e[y++]), x += (T.a * w + T.c * E + T.tx) * S, b += (T.b * w + T.d * E + T.ty) * S
- }
- }
- l[v] = x, l[v + 1] = -b
- }
- } else if (a) {
- var M = this._parent._boneData.type !== s.Bone,
- D = n.data,
- B = D.intArray,
- I = D.floatArray,
- P = B[n.offset + r.MeshVertexCount],
- R = B[n.offset + r.MeshFloatOffset];
- R < 0 && (R += 65536);
- for (var O = 0, L = P, F = 0; O < L; O++, F += 4) {
- var N = I[R + 2 * O] * t + e[2 * O],
- V = I[R + 2 * O + 1] * t + e[2 * O + 1];
- if (M) {
- var k = this._parent._getGlobalTransformMatrix(N, V);
- l[F] = k.a * N + k.c * V + k.tx, l[F + 1] = -k.b * N + k.d * V + k.ty
- } else l[F] = N, l[F + 1] = -V
- }
- }
- o && this._identityTransform()
- },
- _identityTransform: function() {
- var t = this._matrix.m;
- t[0] = 1, t[1] = 0, t[4] = -0, t[5] = -1, t[12] = 0, t[13] = 0, this._worldMatrixDirty = !0
- },
- _updateTransform: function() {
- var t = this._matrix.m;
- t[0] = this.globalTransformMatrix.a, t[1] = this.globalTransformMatrix.b, t[4] = -this.globalTransformMatrix.c, t[5] = -this.globalTransformMatrix.d, this._childArmature ? (t[12] = this.globalTransformMatrix.tx, t[13] = this.globalTransformMatrix.ty) : (t[12] = this.globalTransformMatrix.tx - (this.globalTransformMatrix.a * this._pivotX - this.globalTransformMatrix.c * this._pivotY), t[13] = this.globalTransformMatrix.ty - (this.globalTransformMatrix.b * this._pivotX - this.globalTransformMatrix.d * this._pivotY)), this._worldMatrixDirty = !0
- },
- updateWorldMatrix: function() {
- if (this._armature) {
- var t = this._armature._parent;
- if (t && t.updateWorldMatrix(), this._worldMatrixDirty) {
- this.calculWorldMatrix();
- var e = this.childArmature;
- if (!e) return;
- for (var i = e.getSlots(), n = 0, r = i.length; n < r; n++) {
- var s = i[n];
- s && (s._worldMatrixDirty = !0)
- }
- }
- }
- },
- _mulMat: function(t, e, i) {
- var n = e.m,
- r = i.m,
- s = t.m,
- o = n[0],
- a = n[1],
- l = n[4],
- h = n[5],
- c = n[12],
- u = n[13],
- _ = r[0],
- f = r[1],
- d = r[4],
- p = r[5],
- m = r[12],
- y = r[13];
- 0 !== a || 0 !== l ? (s[0] = _ * o + f * l, s[1] = _ * a + f * h, s[4] = d * o + p * l, s[5] = d * a + p * h, s[12] = o * m + l * y + c, s[13] = a * m + h * y + u) : (s[0] = _ * o, s[1] = f * h, s[4] = d * o, s[5] = p * h, s[12] = o * m + c, s[13] = h * y + u)
- },
- calculWorldMatrix: function() {
- var t = this._armature._parent;
- t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : n.mat4.copy(this._worldMatrix, this._matrix), this._worldMatrixDirty = !1
- }
- })
- }), {
- "../../cocos2d/core/vmath": 326
- }],
- 406: [(function(t, e, i) {
- "use strict";
- dragonBones.CCTextureAtlasData = cc.Class({
- extends: dragonBones.TextureAtlasData,
- name: "dragonBones.CCTextureAtlasData",
- properties: {
- _renderTexture: {
- default: null,
- serializable: !1
- },
- renderTexture: {
- get: function() {
- return this._renderTexture
- },
- set: function(t) {
- if (this._renderTexture = t, t)
- for (var e in this.textures) {
- var i = this.textures[e];
- if (!i.spriteFrame) {
- var n = null;
- n = i.rotated ? cc.rect(i.region.x, i.region.y, i.region.height, i.region.width) : cc.rect(i.region.x, i.region.y, i.region.width, i.region.height);
- var r = cc.v2(0, 0),
- s = cc.size(n.width, n.height);
- i.spriteFrame = new cc.SpriteFrame, i.spriteFrame.setTexture(t, n, !1, r, s)
- }
- } else
- for (var o in this.textures) {
- this.textures[o].spriteFrame = null
- }
- }
- }
- },
- statics: {
- toString: function() {
- return "[class dragonBones.CCTextureAtlasData]"
- }
- },
- _onClear: function() {
- dragonBones.TextureAtlasData.prototype._onClear.call(this), this.renderTexture = null
- },
- createTexture: function() {
- return dragonBones.BaseObject.borrowObject(dragonBones.CCTextureData)
- }
- }), dragonBones.CCTextureData = cc.Class({
- extends: dragonBones.TextureData,
- name: "dragonBones.CCTextureData",
- properties: {
- spriteFrame: {
- default: null,
- serializable: !1
- }
- },
- statics: {
- toString: function() {
- return "[class dragonBones.CCTextureData]"
- }
- },
- _onClear: function() {
- dragonBones.TextureData.prototype._onClear.call(this), this.spriteFrame = null
- }
- })
- }), {}],
- 407: [(function(t, e, i) {
- "use strict";
- var n = t("./ArmatureCache").sharedCache,
- r = cc.Class({
- name: "dragonBones.DragonBonesAsset",
- extends: cc.Asset,
- ctor: function() {
- this.reset()
- },
- properties: {
- _dragonBonesJson: "",
- dragonBonesJson: {
- get: function() {
- return this._dragonBonesJson
- },
- set: function(t) {
- this._dragonBonesJson = t, this._dragonBonesJsonData = JSON.parse(t), this.reset()
- }
- },
- _nativeAsset: {
- get: function() {
- return this._buffer
- },
- set: function(t) {
- this._buffer = t.buffer || t, this.reset()
- },
- override: !0
- }
- },
- statics: {
- preventDeferredLoadDependents: !0
- },
- createNode: !1,
- reset: function() {
- this._clear()
- },
- init: function(t, e) {
- this._factory = t, !this._dragonBonesJsonData && this.dragonBonesJson && (this._dragonBonesJsonData = JSON.parse(this.dragonBonesJson));
- var i = null;
- if (i = this._dragonBonesJsonData ? this._dragonBonesJsonData : this._nativeAsset, !this._uuid) {
- var n = this._factory.getDragonBonesDataByRawData(i);
- n ? this._uuid = n.name : cc.warn("dragonbones name is empty")
- }
- var r = this._uuid + "#" + e;
- return this._factory.getDragonBonesData(r) ? r : (this._factory.parseDragonBonesData(i, r), r)
- },
- getArmatureEnum: !1,
- getAnimsEnum: !1,
- _clear: function() {
- this._factory && (n.resetArmature(this._uuid), this._factory.removeDragonBonesDataByUUID(this._uuid, !0))
- },
- destroy: function() {
- this._clear(), this._super()
- }
- });
- dragonBones.DragonBonesAsset = e.exports = r
- }), {
- "./ArmatureCache": 401
- }],
- 408: [(function(t, e, i) {
- "use strict";
- var n = t("./ArmatureCache").sharedCache,
- r = cc.Class({
- name: "dragonBones.DragonBonesAtlasAsset",
- extends: cc.Asset,
- ctor: function() {
- this._clear()
- },
- properties: {
- _atlasJson: "",
- atlasJson: {
- get: function() {
- return this._atlasJson
- },
- set: function(t) {
- this._atlasJson = t, this._atlasJsonData = JSON.parse(this.atlasJson), this._clear()
- }
- },
- _texture: {
- default: null,
- type: cc.Texture2D,
- formerlySerializedAs: "texture"
- },
- texture: {
- get: function() {
- return this._texture
- },
- set: function(t) {
- this._texture = t, this._clear()
- }
- },
- _textureAtlasData: null
- },
- statics: {
- preventDeferredLoadDependents: !0
- },
- createNode: !1,
- init: function(t) {
- this._factory = t, this._atlasJsonData || (this._atlasJsonData = JSON.parse(this.atlasJson));
- var e = this._atlasJsonData;
- this._uuid = this._uuid || e.name, this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this._textureAtlasData = t.parseTextureAtlasData(e, this.texture, this._uuid)
- },
- _clear: function() {
- this._factory && (n.resetArmature(this._uuid), this._factory.removeTextureAtlasData(this._uuid, !0), this._factory.removeDragonBonesDataByUUID(this._uuid, !0)), this._textureAtlasData = null
- },
- destroy: function() {
- this._clear(), this._super()
- }
- });
- dragonBones.DragonBonesAtlasAsset = e.exports = r
- }), {
- "./ArmatureCache": 401
- }],
- 409: [(function(t, e, i) {
- "use strict";
- var n = "undefined" == typeof window ? global : window;
- n.dragonBones = t("./lib/dragonBones"), void 0 !== n.dragonBones && (dragonBones._timeScale = 1, Object.defineProperty(dragonBones, "timeScale", {
- get: function() {
- return this._timeScale
- },
- set: function(t) {
- this._timeScale = t, this.CCFactory.getInstance()._dragonBones.clock.timeScale = t
- },
- configurable: !0
- }), dragonBones.DisplayType = {
- Image: 0,
- Armature: 1,
- Mesh: 2
- }, dragonBones.ArmatureType = {
- Armature: 0,
- MovieClip: 1,
- Stage: 2
- }, dragonBones.ExtensionType = {
- FFD: 0,
- AdjustColor: 10,
- BevelFilter: 11,
- BlurFilter: 12,
- DropShadowFilter: 13,
- GlowFilter: 14,
- GradientBevelFilter: 15,
- GradientGlowFilter: 16
- }, dragonBones.EventType = {
- Frame: 0,
- Sound: 1
- }, dragonBones.ActionType = {
- Play: 0,
- Stop: 1,
- GotoAndPlay: 2,
- GotoAndStop: 3,
- FadeIn: 4,
- FadeOut: 5
- }, dragonBones.AnimationFadeOutMode = {
- None: 0,
- SameLayer: 1,
- SameGroup: 2,
- SameLayerAndGroup: 3,
- All: 4
- }, dragonBones.BinaryOffset = {
- WeigthBoneCount: 0,
- WeigthFloatOffset: 1,
- WeigthBoneIndices: 2,
- MeshVertexCount: 0,
- MeshTriangleCount: 1,
- MeshFloatOffset: 2,
- MeshWeightOffset: 3,
- MeshVertexIndices: 4,
- TimelineScale: 0,
- TimelineOffset: 1,
- TimelineKeyFrameCount: 2,
- TimelineFrameValueCount: 3,
- TimelineFrameValueOffset: 4,
- TimelineFrameOffset: 5,
- FramePosition: 0,
- FrameTweenType: 1,
- FrameTweenEasingOrCurveSampleCount: 2,
- FrameCurveSamples: 3,
- DeformMeshOffset: 0,
- DeformCount: 1,
- DeformValueCount: 2,
- DeformValueOffset: 3,
- DeformFloatOffset: 4
- }, dragonBones.BoneType = {
- Bone: 0,
- Surface: 1
- }, t("./CCFactory"), t("./CCSlot"), t("./CCTextureData"), t("./CCArmatureDisplay"), t("./ArmatureCache"), t("./DragonBonesAsset"), t("./DragonBonesAtlasAsset"), t("./ArmatureDisplay"), t("./webgl-assembler"))
- }), {
- "./ArmatureCache": 401,
- "./ArmatureDisplay": 402,
- "./CCArmatureDisplay": 403,
- "./CCFactory": 404,
- "./CCSlot": 405,
- "./CCTextureData": 406,
- "./DragonBonesAsset": 407,
- "./DragonBonesAtlasAsset": 408,
- "./lib/dragonBones": 410,
- "./webgl-assembler": 411
- }],
- 410: [(function(t, e, i) {
- "use strict";
- var n = (function() {
- var t = Object.setPrototypeOf || {
- __proto__: []
- }
- instanceof Array && function(t, e) {
- t.__proto__ = e
- } || function(t, e) {
- for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
- }
- })();
- r || (r = {}), (function(t) {
- var e = (function() {
- function e(i) {
- this._clock = new t.WorldClock, this._events = [], this._objects = [], this._eventManager = null, this._eventManager = i, console.info("DragonBones: " + e.VERSION + "\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")
- }
- return e.prototype.advanceTime = function(e) {
- if (this._objects.length > 0) {
- for (var i = 0, n = this._objects; i < n.length; i++) {
- n[i].returnToPool()
- }
- this._objects.length = 0
- }
- if (this._clock.advanceTime(e), this._events.length > 0) {
- for (var r = 0; r < this._events.length; ++r) {
- var s = this._events[r],
- o = s.armature;
- null !== o._armatureData && (o.eventDispatcher.dispatchDBEvent(s.type, s), s.type === t.EventObject.SOUND_EVENT && this._eventManager.dispatchDBEvent(s.type, s)), this.bufferObject(s)
- }
- this._events.length = 0
- }
- }, e.prototype.bufferEvent = function(t) {
- this._events.indexOf(t) < 0 && this._events.push(t)
- }, e.prototype.bufferObject = function(t) {
- this._objects.indexOf(t) < 0 && this._objects.push(t)
- }, Object.defineProperty(e.prototype, "clock", {
- get: function() {
- return this._clock
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(e.prototype, "eventManager", {
- get: function() {
- return this._eventManager
- },
- enumerable: !0,
- configurable: !0
- }), e.VERSION = "5.6.300", e.yDown = !1, e.debug = !1, e.debugDraw = !1, e.webAssembly = !1, e
- })();
- t.DragonBones = e
- })(r || (r = {})), console.warn || (console.warn = function() {}), console.assert || (console.assert = function() {}), Date.now || (Date.now = function() {
- return (new Date).getTime()
- });
- var r;
- n = function(t, e) {
- function i() {
- this.constructor = t
- }
- for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
- i.prototype = e.prototype, t.prototype = new i
- };
- (function(t) {
- var e = (function() {
- function t() {
- this.hashCode = t._hashCode++, this._isInPool = !1
- }
- return t._returnObject = function(e) {
- var i = String(e.constructor),
- n = i in t._maxCountMap ? t._maxCountMap[i] : t._defaultMaxCount,
- r = t._poolsMap[i] = t._poolsMap[i] || [];
- r.length < n && (e._isInPool ? console.warn("The object is already in the pool.") : (e._isInPool = !0, r.push(e)))
- }, t.toString = function() {
- throw new Error
- }, t.setMaxCount = function(e, i) {
- if ((i < 0 || i != i) && (i = 0), null !== e) null !== (r = (n = String(e)) in t._poolsMap ? t._poolsMap[n] : null) && r.length > i && (r.length = i), t._maxCountMap[n] = i;
- else
- for (var n in t._defaultMaxCount = i, t._poolsMap) {
- var r;
- (r = t._poolsMap[n]).length > i && (r.length = i), n in t._maxCountMap && (t._maxCountMap[n] = i)
- }
- }, t.clearPool = function(e) {
- if (void 0 === e && (e = null), null !== e) {
- var i = String(e);
- null !== (r = i in t._poolsMap ? t._poolsMap[i] : null) && r.length > 0 && (r.length = 0)
- } else
- for (var n in t._poolsMap) {
- var r;
- (r = t._poolsMap[n]).length = 0
- }
- }, t.borrowObject = function(e) {
- var i = String(e),
- n = i in t._poolsMap ? t._poolsMap[i] : null;
- if (null !== n && n.length > 0) {
- var r = n.pop();
- return r._isInPool = !1, r
- }
- var s = new e;
- return s._onClear(), s
- }, t.prototype.returnToPool = function() {
- this._onClear(), t._returnObject(this)
- }, t._hashCode = 0, t._defaultMaxCount = 3e3, t._maxCountMap = {}, t._poolsMap = {}, t
- })();
- t.BaseObject = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t, e, i, n, r, s) {
- void 0 === t && (t = 1), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 1), void 0 === r && (r = 0), void 0 === s && (s = 0), this.a = t, this.b = e, this.c = i, this.d = n, this.tx = r, this.ty = s
- }
- return t.prototype.toString = function() {
- return "[object dragonBones.Matrix] a:" + this.a + " b:" + this.b + " c:" + this.c + " d:" + this.d + " tx:" + this.tx + " ty:" + this.ty
- }, t.prototype.copyFrom = function(t) {
- return this.a = t.a, this.b = t.b, this.c = t.c, this.d = t.d, this.tx = t.tx, this.ty = t.ty, this
- }, t.prototype.copyFromArray = function(t, e) {
- return void 0 === e && (e = 0), this.a = t[e], this.b = t[e + 1], this.c = t[e + 2], this.d = t[e + 3], this.tx = t[e + 4], this.ty = t[e + 5], this
- }, t.prototype.identity = function() {
- return this.a = this.d = 1, this.b = this.c = 0, this.tx = this.ty = 0, this
- }, t.prototype.concat = function(t) {
- var e = this.a * t.a,
- i = 0,
- n = 0,
- r = this.d * t.d,
- s = this.tx * t.a + t.tx,
- o = this.ty * t.d + t.ty;
- return 0 === this.b && 0 === this.c || (e += this.b * t.c, i += this.b * t.d, n += this.c * t.a, r += this.c * t.b), 0 === t.b && 0 === t.c || (i += this.a * t.b, n += this.d * t.c, s += this.ty * t.c, o += this.tx * t.b), this.a = e, this.b = i, this.c = n, this.d = r, this.tx = s, this.ty = o, this
- }, t.prototype.invert = function() {
- var t = this.a,
- e = this.b,
- i = this.c,
- n = this.d,
- r = this.tx,
- s = this.ty;
- if (0 === e && 0 === i) return this.b = this.c = 0, 0 === t || 0 === n ? this.a = this.b = this.tx = this.ty = 0 : (t = this.a = 1 / t, n = this.d = 1 / n, this.tx = -t * r, this.ty = -n * s), this;
- var o = t * n - e * i;
- if (0 === o) return this.a = this.d = 1, this.b = this.c = 0, this.tx = this.ty = 0, this;
- o = 1 / o;
- var a = this.a = n * o;
- return e = this.b = -e * o, i = this.c = -i * o, n = this.d = t * o, this.tx = -(a * r + i * s), this.ty = -(e * r + n * s), this
- }, t.prototype.transformPoint = function(t, e, i, n) {
- void 0 === n && (n = !1), i.x = this.a * t + this.c * e, i.y = this.b * t + this.d * e, n || (i.x += this.tx, i.y += this.ty)
- }, t.prototype.transformRectangle = function(t, e) {
- void 0 === e && (e = !1);
- var i = this.a,
- n = this.b,
- r = this.c,
- s = this.d,
- o = e ? 0 : this.tx,
- a = e ? 0 : this.ty,
- l = t.x,
- h = t.y,
- c = l + t.width,
- u = h + t.height,
- _ = i * l + r * h + o,
- f = n * l + s * h + a,
- d = i * c + r * h + o,
- p = n * c + s * h + a,
- m = i * c + r * u + o,
- y = n * c + s * u + a,
- v = i * l + r * u + o,
- g = n * l + s * u + a,
- x = 0;
- _ > d && (x = _, _ = d, d = x), m > v && (x = m, m = v, v = x), t.x = Math.floor(_ < m ? _ : m), t.width = Math.ceil((d > v ? d : v) - t.x), f > p && (x = f, f = p, p = x), y > g && (x = y, y = g, g = x), t.y = Math.floor(f < y ? f : y), t.height = Math.ceil((p > g ? p : g) - t.y)
- }, t
- })();
- t.Matrix = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t, e, i, n, r, s) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), void 0 === r && (r = 1), void 0 === s && (s = 1), this.x = t, this.y = e, this.skew = i, this.rotation = n, this.scaleX = r, this.scaleY = s
- }
- return t.normalizeRadian = function(t) {
- return t = (t + Math.PI) % (2 * Math.PI), t += t > 0 ? -Math.PI : Math.PI
- }, t.prototype.toString = function() {
- return "[object dragonBones.Transform] x:" + this.x + " y:" + this.y + " skewX:" + 180 * this.skew / Math.PI + " skewY:" + 180 * this.rotation / Math.PI + " scaleX:" + this.scaleX + " scaleY:" + this.scaleY
- }, t.prototype.copyFrom = function(t) {
- return this.x = t.x, this.y = t.y, this.skew = t.skew, this.rotation = t.rotation, this.scaleX = t.scaleX, this.scaleY = t.scaleY, this
- }, t.prototype.identity = function() {
- return this.x = this.y = 0, this.skew = this.rotation = 0, this.scaleX = this.scaleY = 1, this
- }, t.prototype.add = function(t) {
- return this.x += t.x, this.y += t.y, this.skew += t.skew, this.rotation += t.rotation, this.scaleX *= t.scaleX, this.scaleY *= t.scaleY, this
- }, t.prototype.minus = function(t) {
- return this.x -= t.x, this.y -= t.y, this.skew -= t.skew, this.rotation -= t.rotation, this.scaleX /= t.scaleX, this.scaleY /= t.scaleY, this
- }, t.prototype.fromMatrix = function(e) {
- var i = this.scaleX,
- n = this.scaleY,
- r = t.PI_Q;
- this.x = e.tx, this.y = e.ty, this.rotation = Math.atan(e.b / e.a);
- var s = Math.atan(-e.c / e.d);
- return this.scaleX = this.rotation > -r && this.rotation < r ? e.a / Math.cos(this.rotation) : e.b / Math.sin(this.rotation), this.scaleY = s > -r && s < r ? e.d / Math.cos(s) : -e.c / Math.sin(s), i >= 0 && this.scaleX < 0 && (this.scaleX = -this.scaleX, this.rotation = this.rotation - Math.PI), n >= 0 && this.scaleY < 0 && (this.scaleY = -this.scaleY, s -= Math.PI), this.skew = s - this.rotation, this
- }, t.prototype.toMatrix = function(t) {
- return 0 === this.rotation ? (t.a = 1, t.b = 0) : (t.a = Math.cos(this.rotation), t.b = Math.sin(this.rotation)), 0 === this.skew ? (t.c = -t.b, t.d = t.a) : (t.c = -Math.sin(this.skew + this.rotation), t.d = Math.cos(this.skew + this.rotation)), 1 !== this.scaleX && (t.a *= this.scaleX, t.b *= this.scaleX), 1 !== this.scaleY && (t.c *= this.scaleY, t.d *= this.scaleY), t.tx = this.x, t.ty = this.y, this
- }, t.PI = Math.PI, t.PI_D = 2 * Math.PI, t.PI_H = Math.PI / 2, t.PI_Q = Math.PI / 4, t.RAD_DEG = 180 / Math.PI, t.DEG_RAD = Math.PI / 180, t
- })();
- t.Transform = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t, e, i, n, r, s, o, a) {
- void 0 === t && (t = 1), void 0 === e && (e = 1), void 0 === i && (i = 1), void 0 === n && (n = 1), void 0 === r && (r = 0), void 0 === s && (s = 0), void 0 === o && (o = 0), void 0 === a && (a = 0), this.alphaMultiplier = t, this.redMultiplier = e, this.greenMultiplier = i, this.blueMultiplier = n, this.alphaOffset = r, this.redOffset = s, this.greenOffset = o, this.blueOffset = a
- }
- return t.prototype.copyFrom = function(t) {
- this.alphaMultiplier = t.alphaMultiplier, this.redMultiplier = t.redMultiplier, this.greenMultiplier = t.greenMultiplier, this.blueMultiplier = t.blueMultiplier, this.alphaOffset = t.alphaOffset, this.redOffset = t.redOffset, this.greenOffset = t.greenOffset, this.blueOffset = t.blueOffset
- }, t.prototype.identity = function() {
- this.alphaMultiplier = this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 1, this.alphaOffset = this.redOffset = this.greenOffset = this.blueOffset = 0
- }, t
- })();
- t.ColorTransform = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t, e) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
- }
- return t.prototype.copyFrom = function(t) {
- this.x = t.x, this.y = t.y
- }, t.prototype.clear = function() {
- this.x = this.y = 0
- }, t
- })();
- t.Point = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t, e, i, n) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.x = t, this.y = e, this.width = i, this.height = n
- }
- return t.prototype.copyFrom = function(t) {
- this.x = t.x, this.y = t.y, this.width = t.width, this.height = t.height
- }, t.prototype.clear = function() {
- this.x = this.y = 0, this.width = this.height = 0
- }, t
- })();
- t.Rectangle = e
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.ints = [], e.floats = [], e.strings = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.UserData]"
- }, e.prototype._onClear = function() {
- this.ints.length = 0, this.floats.length = 0, this.strings.length = 0
- }, e.prototype.addInt = function(t) {
- this.ints.push(t)
- }, e.prototype.addFloat = function(t) {
- this.floats.push(t)
- }, e.prototype.addString = function(t) {
- this.strings.push(t)
- }, e.prototype.getInt = function(t) {
- return void 0 === t && (t = 0), t >= 0 && t < this.ints.length ? this.ints[t] : 0
- }, e.prototype.getFloat = function(t) {
- return void 0 === t && (t = 0), t >= 0 && t < this.floats.length ? this.floats[t] : 0
- }, e.prototype.getString = function(t) {
- return void 0 === t && (t = 0), t >= 0 && t < this.strings.length ? this.strings[t] : ""
- }, e
- })(t.BaseObject);
- t.UserData = e;
- var i = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.data = null, e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.ActionData]"
- }, e.prototype._onClear = function() {
- null !== this.data && this.data.returnToPool(), this.type = 0, this.name = "", this.bone = null, this.slot = null, this.data = null
- }, e
- })(t.BaseObject);
- t.ActionData = i
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.frameIndices = [], e.cachedFrames = [], e.armatureNames = [], e.armatures = {}, e.userData = null, e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.DragonBonesData]"
- }, e.prototype._onClear = function() {
- for (var t in this.armatures) this.armatures[t].returnToPool(), delete this.armatures[t];
- null !== this.userData && this.userData.returnToPool(), this.autoSearch = !1, this.frameRate = 0, this.version = "", this.name = "", this.stage = null, this.frameIndices.length = 0, this.cachedFrames.length = 0, this.armatureNames.length = 0, this.binary = null, this.intArray = null, this.floatArray = null, this.frameIntArray = null, this.frameFloatArray = null, this.frameArray = null, this.timelineArray = null, this.userData = null
- }, e.prototype.addArmature = function(t) {
- t.name in this.armatures ? console.warn("Same armature: " + t.name) : (t.parent = this, this.armatures[t.name] = t, this.armatureNames.push(t.name))
- }, e.prototype.getArmature = function(t) {
- return t in this.armatures ? this.armatures[t] : null
- }, e.prototype.dispose = function() {
- console.warn("\u5df2\u5e9f\u5f03"), this.returnToPool()
- }, e
- })(t.BaseObject);
- t.DragonBonesData = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.aabb = new t.Rectangle, i.animationNames = [], i.sortedBones = [], i.sortedSlots = [], i.defaultActions = [], i.actions = [], i.bones = {}, i.slots = {}, i.constraints = {}, i.skins = {}, i.animations = {}, i.canvas = null, i.userData = null, i
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.ArmatureData]"
- }, i.prototype._onClear = function() {
- for (var t = 0, e = this.defaultActions; t < e.length; t++) {
- e[t].returnToPool()
- }
- for (var i = 0, n = this.actions; i < n.length; i++) {
- n[i].returnToPool()
- }
- for (var r in this.bones) this.bones[r].returnToPool(), delete this.bones[r];
- for (var r in this.slots) this.slots[r].returnToPool(), delete this.slots[r];
- for (var r in this.constraints) this.constraints[r].returnToPool(), delete this.constraints[r];
- for (var r in this.skins) this.skins[r].returnToPool(), delete this.skins[r];
- for (var r in this.animations) this.animations[r].returnToPool(), delete this.animations[r];
- null !== this.canvas && this.canvas.returnToPool(), null !== this.userData && this.userData.returnToPool(), this.type = 0, this.frameRate = 0, this.cacheFrameRate = 0, this.scale = 1, this.name = "", this.aabb.clear(), this.animationNames.length = 0, this.sortedBones.length = 0, this.sortedSlots.length = 0, this.defaultActions.length = 0, this.actions.length = 0, this.defaultSkin = null, this.defaultAnimation = null, this.canvas = null, this.userData = null, this.parent = null
- }, i.prototype.sortBones = function() {
- var t = this.sortedBones.length;
- if (!(t <= 0)) {
- var e = this.sortedBones.concat(),
- i = 0,
- n = 0;
- for (this.sortedBones.length = 0; n < t;) {
- var r = e[i++];
- if (i >= t && (i = 0), !(this.sortedBones.indexOf(r) >= 0)) {
- var s = !1;
- for (var o in this.constraints) {
- var a = this.constraints[o];
- if (a.root === r && this.sortedBones.indexOf(a.target) < 0) {
- s = !0;
- break
- }
- }
- s || null !== r.parent && this.sortedBones.indexOf(r.parent) < 0 || (this.sortedBones.push(r), n++)
- }
- }
- }
- }, i.prototype.cacheFrames = function(t) {
- if (!(this.cacheFrameRate > 0))
- for (var e in this.cacheFrameRate = t, this.animations) this.animations[e].cacheFrames(this.cacheFrameRate)
- }, i.prototype.setCacheFrame = function(t, e) {
- var i = this.parent.cachedFrames,
- n = i.length;
- return i.length += 10, i[n] = t.a, i[n + 1] = t.b, i[n + 2] = t.c, i[n + 3] = t.d, i[n + 4] = t.tx, i[n + 5] = t.ty, i[n + 6] = e.rotation, i[n + 7] = e.skew, i[n + 8] = e.scaleX, i[n + 9] = e.scaleY, n
- }, i.prototype.getCacheFrame = function(t, e, i) {
- var n = this.parent.cachedFrames;
- t.a = n[i], t.b = n[i + 1], t.c = n[i + 2], t.d = n[i + 3], t.tx = n[i + 4], t.ty = n[i + 5], e.rotation = n[i + 6], e.skew = n[i + 7], e.scaleX = n[i + 8], e.scaleY = n[i + 9], e.x = t.tx, e.y = t.ty
- }, i.prototype.addBone = function(t) {
- t.name in this.bones ? console.warn("Same bone: " + t.name) : (this.bones[t.name] = t, this.sortedBones.push(t))
- }, i.prototype.addSlot = function(t) {
- t.name in this.slots ? console.warn("Same slot: " + t.name) : (this.slots[t.name] = t, this.sortedSlots.push(t))
- }, i.prototype.addConstraint = function(t) {
- t.name in this.constraints ? console.warn("Same constraint: " + t.name) : this.constraints[t.name] = t
- }, i.prototype.addSkin = function(t) {
- t.name in this.skins ? console.warn("Same skin: " + t.name) : (t.parent = this, this.skins[t.name] = t, null === this.defaultSkin && (this.defaultSkin = t), "default" === t.name && (this.defaultSkin = t))
- }, i.prototype.addAnimation = function(t) {
- t.name in this.animations ? console.warn("Same animation: " + t.name) : (t.parent = this, this.animations[t.name] = t, this.animationNames.push(t.name), null === this.defaultAnimation && (this.defaultAnimation = t))
- }, i.prototype.addAction = function(t, e) {
- e ? this.defaultActions.push(t) : this.actions.push(t)
- }, i.prototype.getBone = function(t) {
- return t in this.bones ? this.bones[t] : null
- }, i.prototype.getSlot = function(t) {
- return t in this.slots ? this.slots[t] : null
- }, i.prototype.getConstraint = function(t) {
- return t in this.constraints ? this.constraints[t] : null
- }, i.prototype.getSkin = function(t) {
- return t in this.skins ? this.skins[t] : null
- }, i.prototype.getMesh = function(t, e, i) {
- var n = this.getSkin(t);
- return null === n ? null : n.getDisplay(e, i)
- }, i.prototype.getAnimation = function(t) {
- return t in this.animations ? this.animations[t] : null
- }, i
- })(t.BaseObject);
- t.ArmatureData = e;
- var i = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.transform = new t.Transform, i.userData = null, i
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.BoneData]"
- }, i.prototype._onClear = function() {
- null !== this.userData && this.userData.returnToPool(), this.inheritTranslation = !1, this.inheritRotation = !1, this.inheritScale = !1, this.inheritReflection = !1, this.type = 0, this.length = 0, this.name = "", this.transform.identity(), this.userData = null, this.parent = null
- }, i
- })(t.BaseObject);
- t.BoneData = i;
- var r = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.vertices = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.SurfaceData]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 1, this.segmentX = 0, this.segmentY = 0, this.vertices.length = 0
- }, e
- })(i);
- t.SurfaceData = r;
- var s = (function(e) {
- function i() {
- var t = null !== e && e.apply(this, arguments) || this;
- return t.color = null, t.userData = null, t
- }
- return n(i, e), i.createColor = function() {
- return new t.ColorTransform
- }, i.toString = function() {
- return "[class dragonBones.SlotData]"
- }, i.prototype._onClear = function() {
- null !== this.userData && this.userData.returnToPool(), this.blendMode = 0, this.displayIndex = 0, this.zOrder = 0, this.name = "", this.color = null, this.userData = null, this.parent = null
- }, i.DEFAULT_COLOR = new t.ColorTransform, i
- })(t.BaseObject);
- t.SlotData = s
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- this.order = 0, this.name = "", this.type = 0, this.target = null, this.root = null, this.bone = null
- }, e
- })(t.BaseObject);
- t.ConstraintData = e;
- var i = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.IKConstraintData]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.scaleEnabled = !1, this.bendPositive = !1, this.weight = 1
- }, e
- })(e);
- t.IKConstraintData = i;
- var r = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.bones = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.PathConstraintData]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.pathSlot = null, this.pathDisplayData = null, this.bones.length = 0, this.positionMode = 0, this.spacingMode = 1, this.rotateMode = 1, this.position = 0, this.spacing = 0, this.rotateOffset = 0, this.rotateMix = 0, this.translateMix = 0
- }, e.prototype.AddBone = function(t) {
- this.bones.push(t)
- }, e
- })(e);
- t.PathConstraintData = r
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.CanvasData]"
- }, e.prototype._onClear = function() {
- this.hasBackground = !1, this.color = 0, this.x = 0, this.y = 0, this.width = 0, this.height = 0
- }, e
- })(t.BaseObject);
- t.CanvasData = e
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.displays = {}, e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.SkinData]"
- }, e.prototype._onClear = function() {
- for (var t in this.displays) {
- for (var e = 0, i = this.displays[t]; e < i.length; e++) {
- var n = i[e];
- null !== n && n.returnToPool()
- }
- delete this.displays[t]
- }
- this.name = "", this.parent = null
- }, e.prototype.addDisplay = function(t, e) {
- t in this.displays || (this.displays[t] = []), null !== e && (e.parent = this), this.displays[t].push(e)
- }, e.prototype.getDisplay = function(t, e) {
- var i = this.getDisplays(t);
- if (null !== i)
- for (var n = 0, r = i; n < r.length; n++) {
- var s = r[n];
- if (null !== s && s.name === e) return s
- }
- return null
- }, e.prototype.getDisplays = function(t) {
- return t in this.displays ? this.displays[t] : null
- }, e
- })(t.BaseObject);
- t.SkinData = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t() {
- this.weight = null
- }
- return t.prototype.clear = function() {
- this.isShared || null === this.weight || this.weight.returnToPool(), this.isShared = !1, this.inheritDeform = !1, this.offset = 0, this.data = null, this.weight = null
- }, t.prototype.shareFrom = function(t) {
- this.isShared = !0, this.offset = t.offset, this.weight = t.weight
- }, t
- })();
- t.VerticesData = e;
- var i = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.transform = new t.Transform, i
- }
- return n(i, e), i.prototype._onClear = function() {
- this.name = "", this.path = "", this.transform.identity(), this.parent = null
- }, i
- })(t.BaseObject);
- t.DisplayData = i;
- var r = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.pivot = new t.Point, i
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.ImageDisplayData]"
- }, i.prototype._onClear = function() {
- e.prototype._onClear.call(this), this.type = 0, this.pivot.clear(), this.texture = null
- }, i
- })(i);
- t.ImageDisplayData = r;
- var s = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.actions = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.ArmatureDisplayData]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this);
- for (var e = 0, i = this.actions; e < i.length; e++) {
- i[e].returnToPool()
- }
- this.type = 1, this.inheritAnimation = !1, this.actions.length = 0, this.armature = null
- }, e.prototype.addAction = function(t) {
- this.actions.push(t)
- }, e
- })(i);
- t.ArmatureDisplayData = s;
- var o = (function(t) {
- function i() {
- var i = null !== t && t.apply(this, arguments) || this;
- return i.vertices = new e, i
- }
- return n(i, t), i.toString = function() {
- return "[class dragonBones.MeshDisplayData]"
- }, i.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 2, this.vertices.clear(), this.texture = null
- }, i
- })(i);
- t.MeshDisplayData = o;
- var a = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.boundingBox = null, e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.BoundingBoxDisplayData]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), null !== this.boundingBox && this.boundingBox.returnToPool(), this.type = 3, this.boundingBox = null
- }, e
- })(i);
- t.BoundingBoxDisplayData = a;
- var l = (function(t) {
- function i() {
- var i = null !== t && t.apply(this, arguments) || this;
- return i.vertices = new e, i.curveLengths = [], i
- }
- return n(i, t), i.toString = function() {
- return "[class dragonBones.PathDisplayData]"
- }, i.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 4, this.closed = !1, this.constantSpeed = !1, this.vertices.clear(), this.curveLengths.length = 0
- }, i
- })(i);
- t.PathDisplayData = l;
- var h = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.bones = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.WeightData]"
- }, e.prototype._onClear = function() {
- this.count = 0, this.offset = 0, this.bones.length = 0
- }, e.prototype.addBone = function(t) {
- this.bones.push(t)
- }, e
- })(t.BaseObject);
- t.WeightData = h
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- this.color = 0, this.width = 0, this.height = 0
- }, e
- })(t.BaseObject);
- t.BoundingBoxData = e;
- var i = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.RectangleBoundingBoxData]"
- }, e._computeOutCode = function(t, e, i, n, r, s) {
- var o = 0;
- return t < i ? o |= 1 : t > r && (o |= 2), e < n ? o |= 4 : e > s && (o |= 8), o
- }, e.rectangleIntersectsSegment = function(t, i, n, r, s, o, a, l, h, c, u) {
- void 0 === h && (h = null), void 0 === c && (c = null), void 0 === u && (u = null);
- var _ = t > s && t < a && i > o && i < l,
- f = n > s && n < a && r > o && r < l;
- if (_ && f) return -1;
- for (var d = 0, p = e._computeOutCode(t, i, s, o, a, l), m = e._computeOutCode(n, r, s, o, a, l);;) {
- if (0 == (p | m)) {
- d = 2;
- break
- }
- if (0 != (p & m)) break;
- var y = 0,
- v = 0,
- g = 0,
- x = 0 !== p ? p : m;
- 0 != (4 & x) ? (y = t + (n - t) * (o - i) / (r - i), v = o, null !== u && (g = .5 * -Math.PI)) : 0 != (8 & x) ? (y = t + (n - t) * (l - i) / (r - i), v = l, null !== u && (g = .5 * Math.PI)) : 0 != (2 & x) ? (v = i + (r - i) * (a - t) / (n - t), y = a, null !== u && (g = 0)) : 0 != (1 & x) && (v = i + (r - i) * (s - t) / (n - t), y = s, null !== u && (g = Math.PI)), x === p ? (t = y, i = v, p = e._computeOutCode(t, i, s, o, a, l), null !== u && (u.x = g)) : (n = y, r = v, m = e._computeOutCode(n, r, s, o, a, l), null !== u && (u.y = g))
- }
- return d && (_ ? (d = 2, null !== h && (h.x = n, h.y = r), null !== c && (c.x = n, c.y = n), null !== u && (u.x = u.y + Math.PI)) : f ? (d = 1, null !== h && (h.x = t, h.y = i), null !== c && (c.x = t, c.y = i), null !== u && (u.y = u.x + Math.PI)) : (d = 3, null !== h && (h.x = t, h.y = i), null !== c && (c.x = n, c.y = r))), d
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 0
- }, e.prototype.containsPoint = function(t, e) {
- var i = .5 * this.width;
- if (t >= -i && t <= i) {
- var n = .5 * this.height;
- if (e >= -n && e <= n) return !0
- }
- return !1
- }, e.prototype.intersectsSegment = function(t, i, n, r, s, o, a) {
- void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null);
- var l = .5 * this.width,
- h = .5 * this.height;
- return e.rectangleIntersectsSegment(t, i, n, r, -l, -h, l, h, s, o, a)
- }, e
- })(e);
- t.RectangleBoundingBoxData = i;
- var r = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.EllipseData]"
- }, e.ellipseIntersectsSegment = function(t, e, i, n, r, s, o, a, l, h, c) {
- void 0 === l && (l = null), void 0 === h && (h = null), void 0 === c && (c = null);
- var u = o / a,
- _ = u * u,
- f = i - t,
- d = (n *= u) - (e *= u),
- p = Math.sqrt(f * f + d * d),
- m = f / p,
- y = d / p,
- v = (r - t) * m + (s - e) * y,
- g = o * o,
- x = g - (t * t + e * e) + v * v,
- b = 0;
- if (x >= 0) {
- var A = Math.sqrt(x),
- C = v - A,
- T = v + A,
- S = C < 0 ? -1 : C <= p ? 0 : 1,
- w = T < 0 ? -1 : T <= p ? 0 : 1,
- E = S * w;
- if (E < 0) return -1;
- 0 === E && (-1 === S ? (b = 2, i = t + T * m, n = (e + T * y) / u, null !== l && (l.x = i, l.y = n), null !== h && (h.x = i, h.y = n), null !== c && (c.x = Math.atan2(n / g * _, i / g), c.y = c.x + Math.PI)) : 1 === w ? (b = 1, t += C * m, e = (e + C * y) / u, null !== l && (l.x = t, l.y = e), null !== h && (h.x = t, h.y = e), null !== c && (c.x = Math.atan2(e / g * _, t / g), c.y = c.x + Math.PI)) : (b = 3, null !== l && (l.x = t + C * m, l.y = (e + C * y) / u, null !== c && (c.x = Math.atan2(l.y / g * _, l.x / g))), null !== h && (h.x = t + T * m, h.y = (e + T * y) / u, null !== c && (c.y = Math.atan2(h.y / g * _, h.x / g)))))
- }
- return b
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 1
- }, e.prototype.containsPoint = function(t, e) {
- var i = .5 * this.width;
- if (t >= -i && t <= i) {
- var n = .5 * this.height;
- if (e >= -n && e <= n) return e *= i / n, Math.sqrt(t * t + e * e) <= i
- }
- return !1
- }, e.prototype.intersectsSegment = function(t, i, n, r, s, o, a) {
- return void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), e.ellipseIntersectsSegment(t, i, n, r, 0, 0, .5 * this.width, .5 * this.height, s, o, a)
- }, e
- })(e);
- t.EllipseBoundingBoxData = r;
- var s = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.vertices = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.PolygonBoundingBoxData]"
- }, e.polygonIntersectsSegment = function(t, e, i, n, r, s, o, a) {
- void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), t === i && (t = i + 1e-6), e === n && (e = n + 1e-6);
- for (var l = r.length, h = t - i, c = e - n, u = t * n - e * i, _ = 0, f = r[l - 2], d = r[l - 1], p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < l; b += 2) {
- var A = r[b],
- C = r[b + 1];
- f === A && (f = A + 1e-4), d === C && (d = C + 1e-4);
- var T = f - A,
- S = d - C,
- w = f * C - d * A,
- E = h * S - c * T,
- M = (u * T - h * w) / E;
- if ((M >= f && M <= A || M >= A && M <= f) && (0 === h || M >= t && M <= i || M >= i && M <= t)) {
- var D = (u * S - c * w) / E;
- if ((D >= d && D <= C || D >= C && D <= d) && (0 === c || D >= e && D <= n || D >= n && D <= e)) {
- if (null === o) {
- y = M, v = D, g = M, x = D, _++, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI, a.y = a.x);
- break
- }
- var B = M - t;
- B < 0 && (B = -B), 0 === _ ? (p = B, m = B, y = M, v = D, g = M, x = D, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI, a.y = a.x)) : (B < p && (p = B, y = M, v = D, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI)), B > m && (m = B, g = M, x = D, null !== a && (a.y = Math.atan2(C - d, A - f) - .5 * Math.PI))), _++
- }
- }
- f = A, d = C
- }
- return 1 === _ ? (null !== s && (s.x = y, s.y = v), null !== o && (o.x = y, o.y = v), null !== a && (a.y = a.x + Math.PI)) : _ > 1 && (_++, null !== s && (s.x = y, s.y = v), null !== o && (o.x = g, o.y = x)), _
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.type = 2, this.x = 0, this.y = 0, this.vertices.length = 0
- }, e.prototype.containsPoint = function(t, e) {
- var i = !1;
- if (t >= this.x && t <= this.width && e >= this.y && e <= this.height)
- for (var n = 0, r = this.vertices.length, s = r - 2; n < r; n += 2) {
- var o = this.vertices[s + 1],
- a = this.vertices[n + 1];
- if (a < e && o >= e || o < e && a >= e) {
- var l = this.vertices[s],
- h = this.vertices[n];
- (e - a) * (l - h) / (o - a) + h < t && (i = !i)
- }
- s = n
- }
- return i
- }, e.prototype.intersectsSegment = function(t, n, r, s, o, a, l) {
- void 0 === o && (o = null), void 0 === a && (a = null), void 0 === l && (l = null);
- var h = 0;
- return 0 !== i.rectangleIntersectsSegment(t, n, r, s, this.x, this.y, this.x + this.width, this.y + this.height, null, null, null) && (h = e.polygonIntersectsSegment(t, n, r, s, this.vertices, o, a, l)), h
- }, e
- })(e);
- t.PolygonBoundingBoxData = s
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.cachedFrames = [], e.boneTimelines = {}, e.surfaceTimelines = {}, e.slotTimelines = {}, e.constraintTimelines = {}, e.animationTimelines = {}, e.boneCachedFrameIndices = {}, e.slotCachedFrameIndices = {}, e.actionTimeline = null, e.zOrderTimeline = null, e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.AnimationData]"
- }, e.prototype._onClear = function() {
- for (var t in this.boneTimelines) {
- for (var e = 0, i = this.boneTimelines[t]; e < i.length; e++) {
- i[e].returnToPool()
- }
- delete this.boneTimelines[t]
- }
- for (var t in this.surfaceTimelines) {
- for (var n = 0, r = this.surfaceTimelines[t]; n < r.length; n++) {
- r[n].returnToPool()
- }
- delete this.surfaceTimelines[t]
- }
- for (var t in this.slotTimelines) {
- for (var s = 0, o = this.slotTimelines[t]; s < o.length; s++) {
- o[s].returnToPool()
- }
- delete this.slotTimelines[t]
- }
- for (var t in this.constraintTimelines) {
- for (var a = 0, l = this.constraintTimelines[t]; a < l.length; a++) {
- l[a].returnToPool()
- }
- delete this.constraintTimelines[t]
- }
- for (var t in this.animationTimelines) {
- for (var h = 0, c = this.animationTimelines[t]; h < c.length; h++) {
- c[h].returnToPool()
- }
- delete this.animationTimelines[t]
- }
- for (var t in this.boneCachedFrameIndices) delete this.boneCachedFrameIndices[t];
- for (var t in this.slotCachedFrameIndices) delete this.slotCachedFrameIndices[t];
- null !== this.actionTimeline && this.actionTimeline.returnToPool(), null !== this.zOrderTimeline && this.zOrderTimeline.returnToPool(), this.frameIntOffset = 0, this.frameFloatOffset = 0, this.frameOffset = 0, this.frameCount = 0, this.playTimes = 0, this.duration = 0, this.scale = 1, this.fadeInTime = 0, this.cacheFrameRate = 0, this.name = "", this.cachedFrames.length = 0, this.actionTimeline = null, this.zOrderTimeline = null, this.parent = null
- }, e.prototype.cacheFrames = function(t) {
- if (!(this.cacheFrameRate > 0)) {
- this.cacheFrameRate = Math.max(Math.ceil(t * this.scale), 1);
- var e = Math.ceil(this.cacheFrameRate * this.duration) + 1;
- this.cachedFrames.length = e;
- for (var i = 0, n = this.cacheFrames.length; i < n; ++i) this.cachedFrames[i] = !1;
- for (var r = 0, s = this.parent.sortedBones; r < s.length; r++) {
- var o = s[r];
- for (i = 0, n = (h = new Array(e)).length; i < n; ++i) h[i] = -1;
- this.boneCachedFrameIndices[o.name] = h
- }
- for (var a = 0, l = this.parent.sortedSlots; a < l.length; a++) {
- var h, c = l[a];
- for (i = 0, n = (h = new Array(e)).length; i < n; ++i) h[i] = -1;
- this.slotCachedFrameIndices[c.name] = h
- }
- }
- }, e.prototype.addBoneTimeline = function(t, e) {
- var i = t.name in this.boneTimelines ? this.boneTimelines[t.name] : this.boneTimelines[t.name] = [];
- i.indexOf(e) < 0 && i.push(e)
- }, e.prototype.addSurfaceTimeline = function(t, e) {
- var i = t.name in this.surfaceTimelines ? this.surfaceTimelines[t.name] : this.surfaceTimelines[t.name] = [];
- i.indexOf(e) < 0 && i.push(e)
- }, e.prototype.addSlotTimeline = function(t, e) {
- var i = t.name in this.slotTimelines ? this.slotTimelines[t.name] : this.slotTimelines[t.name] = [];
- i.indexOf(e) < 0 && i.push(e)
- }, e.prototype.addConstraintTimeline = function(t, e) {
- var i = t.name in this.constraintTimelines ? this.constraintTimelines[t.name] : this.constraintTimelines[t.name] = [];
- i.indexOf(e) < 0 && i.push(e)
- }, e.prototype.addAnimationTimeline = function(t, e) {
- var i = t in this.animationTimelines ? this.animationTimelines[t] : this.animationTimelines[t] = [];
- i.indexOf(e) < 0 && i.push(e)
- }, e.prototype.getBoneTimelines = function(t) {
- return t in this.boneTimelines ? this.boneTimelines[t] : null
- }, e.prototype.getSurfaceTimelines = function(t) {
- return t in this.surfaceTimelines ? this.surfaceTimelines[t] : null
- }, e.prototype.getSlotTimelines = function(t) {
- return t in this.slotTimelines ? this.slotTimelines[t] : null
- }, e.prototype.getConstraintTimelines = function(t) {
- return t in this.constraintTimelines ? this.constraintTimelines[t] : null
- }, e.prototype.getAnimationTimelines = function(t) {
- return t in this.animationTimelines ? this.animationTimelines[t] : null
- }, e.prototype.getBoneCachedFrameIndices = function(t) {
- return t in this.boneCachedFrameIndices ? this.boneCachedFrameIndices[t] : null
- }, e.prototype.getSlotCachedFrameIndices = function(t) {
- return t in this.slotCachedFrameIndices ? this.slotCachedFrameIndices[t] : null
- }, e
- })(t.BaseObject);
- t.AnimationData = e;
- var i = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.TimelineData]"
- }, e.prototype._onClear = function() {
- this.type = 10, this.offset = 0, this.frameIndicesOffset = -1
- }, e
- })(t.BaseObject);
- t.TimelineData = i
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.boneMask = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.AnimationConfig]"
- }, e.prototype._onClear = function() {
- this.pauseFadeOut = !0, this.fadeOutMode = 4, this.fadeOutTweenType = 1, this.fadeOutTime = -1, this.actionEnabled = !0, this.additiveBlending = !1, this.displayControl = !0, this.pauseFadeIn = !0, this.resetToPose = !0, this.fadeInTweenType = 1, this.playTimes = -1, this.layer = 0, this.position = 0, this.duration = -1, this.timeScale = -100, this.weight = 1, this.fadeInTime = -1, this.autoFadeOutTime = -1, this.name = "", this.animation = "", this.group = "", this.boneMask.length = 0
- }, e.prototype.clear = function() {
- this._onClear()
- }, e.prototype.copyFrom = function(t) {
- this.pauseFadeOut = t.pauseFadeOut, this.fadeOutMode = t.fadeOutMode, this.autoFadeOutTime = t.autoFadeOutTime, this.fadeOutTweenType = t.fadeOutTweenType, this.actionEnabled = t.actionEnabled, this.additiveBlending = t.additiveBlending, this.displayControl = t.displayControl, this.pauseFadeIn = t.pauseFadeIn, this.resetToPose = t.resetToPose, this.playTimes = t.playTimes, this.layer = t.layer, this.position = t.position, this.duration = t.duration, this.timeScale = t.timeScale, this.fadeInTime = t.fadeInTime, this.fadeOutTime = t.fadeOutTime, this.fadeInTweenType = t.fadeInTweenType, this.weight = t.weight, this.name = t.name, this.animation = t.animation, this.group = t.group, this.boneMask.length = t.boneMask.length;
- for (var e = 0, i = this.boneMask.length; e < i; ++e) this.boneMask[e] = t.boneMask[e]
- }, e.prototype.containsBoneMask = function(t) {
- return 0 === this.boneMask.length || this.boneMask.indexOf(t) >= 0
- }, e.prototype.addBoneMask = function(t, e, i) {
- void 0 === i && (i = !0);
- var n = t.getBone(e);
- if (null !== n && (this.boneMask.indexOf(e) < 0 && this.boneMask.push(e), i))
- for (var r = 0, s = t.getBones(); r < s.length; r++) {
- var o = s[r];
- this.boneMask.indexOf(o.name) < 0 && n.contains(o) && this.boneMask.push(o.name)
- }
- }, e.prototype.removeBoneMask = function(t, e, i) {
- void 0 === i && (i = !0);
- var n = this.boneMask.indexOf(e);
- if (n >= 0 && this.boneMask.splice(n, 1), i) {
- var r = t.getBone(e);
- if (null !== r)
- if (this.boneMask.length > 0)
- for (var s = 0, o = t.getBones(); s < o.length; s++) {
- var a = o[s],
- l = this.boneMask.indexOf(a.name);
- l >= 0 && r.contains(a) && this.boneMask.splice(l, 1)
- } else
- for (var h = 0, c = t.getBones(); h < c.length; h++) {
- (a = c[h]) !== r && (r.contains(a) || this.boneMask.push(a.name))
- }
- }
- }, e
- })(t.BaseObject);
- t.AnimationConfig = e
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.textures = {}, e
- }
- return n(e, t), e.prototype._onClear = function() {
- for (var t in this.textures) this.textures[t].returnToPool(), delete this.textures[t];
- this.autoSearch = !1, this.width = 0, this.height = 0, this.scale = 1, this.name = "", this.imagePath = ""
- }, e.prototype.copyFrom = function(t) {
- for (var e in this.autoSearch = t.autoSearch, this.scale = t.scale, this.width = t.width, this.height = t.height, this.name = t.name, this.imagePath = t.imagePath, this.textures) this.textures[e].returnToPool(), delete this.textures[e];
- for (var e in t.textures) {
- var i = this.createTexture();
- i.copyFrom(t.textures[e]), this.textures[e] = i
- }
- }, e.prototype.addTexture = function(t) {
- t.name in this.textures ? console.warn("Same texture: " + t.name) : (t.parent = this, this.textures[t.name] = t)
- }, e.prototype.getTexture = function(t) {
- return t in this.textures ? this.textures[t] : null
- }, e
- })(t.BaseObject);
- t.TextureAtlasData = e;
- var i = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.region = new t.Rectangle, i.frame = null, i
- }
- return n(i, e), i.createRectangle = function() {
- return new t.Rectangle
- }, i.prototype._onClear = function() {
- this.rotated = !1, this.name = "", this.region.clear(), this.parent = null, this.frame = null
- }, i.prototype.copyFrom = function(t) {
- this.rotated = t.rotated, this.name = t.name, this.region.copyFrom(t.region), this.parent = t.parent, null === this.frame && null !== t.frame ? this.frame = i.createRectangle() : null !== this.frame && null === t.frame && (this.frame = null), null !== this.frame && null !== t.frame && this.frame.copyFrom(t.frame)
- }, i
- })(t.BaseObject);
- t.TextureData = i
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.vertices = [], e.bones = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.DeformVertices]"
- }, e.prototype._onClear = function() {
- this.verticesDirty = !1, this.vertices.length = 0, this.bones.length = 0, this.verticesData = null
- }, e.prototype.init = function(t, e) {
- if (this.verticesData = t, null !== this.verticesData) {
- var i = 0;
- i = null !== this.verticesData.weight ? 2 * this.verticesData.weight.count : 2 * this.verticesData.data.intArray[this.verticesData.offset + 0], this.verticesDirty = !0, this.vertices.length = i, this.bones.length = 0;
- for (var n = 0, r = this.vertices.length; n < r; ++n) this.vertices[n] = 0;
- if (null !== this.verticesData.weight)
- for (n = 0, r = this.verticesData.weight.bones.length; n < r; ++n) {
- var s = e.getBone(this.verticesData.weight.bones[n].name);
- this.bones.push(s)
- }
- } else this.verticesDirty = !1, this.vertices.length = 0, this.bones.length = 0, this.verticesData = null
- }, e.prototype.isBonesUpdate = function() {
- for (var t = 0, e = this.bones; t < e.length; t++) {
- var i = e[t];
- if (null !== i && i._childrenTransformDirty) return !0
- }
- return !1
- }, e
- })(t.BaseObject);
- t.DeformVertices = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var t = null !== e && e.apply(this, arguments) || this;
- return t._bones = [], t._slots = [], t._constraints = [], t._actions = [], t._animation = null, t._proxy = null, t._replaceTextureAtlasData = null, t._clock = null, t
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.Armature]"
- }, i._onSortSlots = function(t, e) {
- return t._zOrder > e._zOrder ? 1 : -1
- }, i.prototype._onClear = function() {
- null !== this._clock && this._clock.remove(this);
- for (var t = 0, e = this._bones; t < e.length; t++) {
- e[t].returnToPool()
- }
- for (var i = 0, n = this._slots; i < n.length; i++) {
- n[i].returnToPool()
- }
- for (var r = 0, s = this._constraints; r < s.length; r++) {
- s[r].returnToPool()
- }
- for (var o = 0, a = this._actions; o < a.length; o++) {
- a[o].returnToPool()
- }
- null !== this._animation && this._animation.returnToPool(), null !== this._proxy && this._proxy.dbClear(), null !== this._replaceTextureAtlasData && this._replaceTextureAtlasData.returnToPool(), this.inheritAnimation = !0, this.userData = null, this._lockUpdate = !1, this._slotsDirty = !0, this._zOrderDirty = !1, this._flipX = !1, this._flipY = !1, this._cacheFrameIndex = -1, this._bones.length = 0, this._slots.length = 0, this._constraints.length = 0, this._actions.length = 0, this._armatureData = null, this._animation = null, this._proxy = null, this._display = null, this._replaceTextureAtlasData = null, this._replacedTexture = null, this._dragonBones = null, this._clock = null, this._parent = null
- }, i.prototype._sortZOrder = function(t, e) {
- var i = this._armatureData.sortedSlots,
- n = null === t;
- if (this._zOrderDirty || !n) {
- for (var r = 0, s = i.length; r < s; ++r) {
- var o = n ? r : t[e + r];
- if (!(o < 0 || o >= s)) {
- var a = i[o],
- l = this.getSlot(a.name);
- null !== l && l._setZorder(r)
- }
- }
- this._slotsDirty = !0, this._zOrderDirty = !n
- }
- }, i.prototype._addBone = function(t) {
- this._bones.indexOf(t) < 0 && this._bones.push(t)
- }, i.prototype._addSlot = function(t) {
- this._slots.indexOf(t) < 0 && this._slots.push(t)
- }, i.prototype._addConstraint = function(t) {
- this._constraints.indexOf(t) < 0 && this._constraints.push(t)
- }, i.prototype._bufferAction = function(t, e) {
- this._actions.indexOf(t) < 0 && (e ? this._actions.push(t) : this._actions.unshift(t))
- }, i.prototype.dispose = function() {
- null !== this._armatureData && (this._lockUpdate = !0, this._dragonBones.bufferObject(this))
- }, i.prototype.init = function(e, i, n, r) {
- null === this._armatureData && (this._armatureData = e, this._animation = t.BaseObject.borrowObject(t.Animation), this._proxy = i, this._display = n, this._dragonBones = r, this._proxy.dbInit(this), this._animation.init(this), this._animation.animations = this._armatureData.animations)
- }, i.prototype.advanceTime = function(t) {
- if (!this._lockUpdate)
- if (null !== this._armatureData)
- if (null !== this._armatureData.parent) {
- var e = this._cacheFrameIndex;
- if (this._animation.advanceTime(t), this._slotsDirty && (this._slotsDirty = !1, this._slots.sort(i._onSortSlots)), this._cacheFrameIndex < 0 || this._cacheFrameIndex !== e) {
- var n = 0,
- r = 0;
- for (n = 0, r = this._bones.length; n < r; ++n) this._bones[n].update(this._cacheFrameIndex);
- for (n = 0, r = this._slots.length; n < r; ++n) this._slots[n].update(this._cacheFrameIndex)
- }
- if (this._actions.length > 0) {
- this._lockUpdate = !0;
- for (var s = 0, o = this._actions; s < o.length; s++) {
- var a = o[s],
- l = a.actionData;
- if (null !== l)
- if (0 === l.type)
- if (null !== a.slot) null !== (u = a.slot.childArmature) && u.animation.fadeIn(l.name);
- else if (null !== a.bone)
- for (var h = 0, c = this.getSlots(); h < c.length; h++) {
- var u, _ = c[h];
- if (_.parent === a.bone) null !== (u = _.childArmature) && u.animation.fadeIn(l.name)
- } else this._animation.fadeIn(l.name);
- a.returnToPool()
- }
- this._actions.length = 0, this._lockUpdate = !1
- }
- this._proxy.dbUpdate()
- } else console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");
- else console.warn("The armature has been disposed.")
- }, i.prototype.invalidUpdate = function(t, e) {
- if (void 0 === t && (t = null), void 0 === e && (e = !1), null !== t && t.length > 0) {
- if (null !== (o = this.getBone(t)) && (o.invalidUpdate(), e))
- for (var i = 0, n = this._slots; i < n.length; i++) {
- (h = n[i]).parent === o && h.invalidUpdate()
- }
- } else {
- for (var r = 0, s = this._bones; r < s.length; r++) {
- var o;
- (o = s[r]).invalidUpdate()
- }
- if (e)
- for (var a = 0, l = this._slots; a < l.length; a++) {
- var h;
- (h = l[a]).invalidUpdate()
- }
- }
- }, i.prototype.containsPoint = function(t, e) {
- for (var i = 0, n = this._slots; i < n.length; i++) {
- var r = n[i];
- if (r.containsPoint(t, e)) return r
- }
- return null
- }, i.prototype.intersectsSegment = function(t, e, i, n, r, s, o) {
- void 0 === r && (r = null), void 0 === s && (s = null), void 0 === o && (o = null);
- for (var a = t === i, l = 0, h = 0, c = 0, u = 0, _ = 0, f = 0, d = 0, p = 0, m = null, y = null, v = 0, g = this._slots; v < g.length; v++) {
- var x = g[v];
- if (x.intersectsSegment(t, e, i, n, r, s, o) > 0) {
- if (null === r && null === s) {
- m = x;
- break
- }
- var b;
- null !== r && ((b = a ? r.y - e : r.x - t) < 0 && (b = -b), (null === m || b < l) && (l = b, c = r.x, u = r.y, m = x, o && (d = o.x))), null !== s && ((b = s.x - t) < 0 && (b = -b), (null === y || b > h) && (h = b, _ = s.x, f = s.y, y = x, null !== o && (p = o.y)))
- }
- }
- return null !== m && null !== r && (r.x = c, r.y = u, null !== o && (o.x = d)), null !== y && null !== s && (s.x = _, s.y = f, null !== o && (o.y = p)), m
- }, i.prototype.getBone = function(t) {
- for (var e = 0, i = this._bones; e < i.length; e++) {
- var n = i[e];
- if (n.name === t) return n
- }
- return null
- }, i.prototype.getBoneByDisplay = function(t) {
- var e = this.getSlotByDisplay(t);
- return null !== e ? e.parent : null
- }, i.prototype.getSlot = function(t) {
- for (var e = 0, i = this._slots; e < i.length; e++) {
- var n = i[e];
- if (n.name === t) return n
- }
- return null
- }, i.prototype.getSlotByDisplay = function(t) {
- if (null !== t)
- for (var e = 0, i = this._slots; e < i.length; e++) {
- var n = i[e];
- if (n.display === t) return n
- }
- return null
- }, i.prototype.getBones = function() {
- return this._bones
- }, i.prototype.getSlots = function() {
- return this._slots
- }, Object.defineProperty(i.prototype, "flipX", {
- get: function() {
- return this._flipX
- },
- set: function(t) {
- this._flipX !== t && (this._flipX = t, this.invalidUpdate())
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "flipY", {
- get: function() {
- return this._flipY
- },
- set: function(t) {
- this._flipY !== t && (this._flipY = t, this.invalidUpdate())
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "cacheFrameRate", {
- get: function() {
- return this._armatureData.cacheFrameRate
- },
- set: function(t) {
- if (this._armatureData.cacheFrameRate !== t) {
- this._armatureData.cacheFrames(t);
- for (var e = 0, i = this._slots; e < i.length; e++) {
- var n = i[e].childArmature;
- null !== n && (n.cacheFrameRate = t)
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "name", {
- get: function() {
- return this._armatureData.name
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "armatureData", {
- get: function() {
- return this._armatureData
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "animation", {
- get: function() {
- return this._animation
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "proxy", {
- get: function() {
- return this._proxy
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "eventDispatcher", {
- get: function() {
- return this._proxy
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "display", {
- get: function() {
- return this._display
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "replacedTexture", {
- get: function() {
- return this._replacedTexture
- },
- set: function(t) {
- if (this._replacedTexture !== t) {
- null !== this._replaceTextureAtlasData && (this._replaceTextureAtlasData.returnToPool(), this._replaceTextureAtlasData = null), this._replacedTexture = t;
- for (var e = 0, i = this._slots; e < i.length; e++) {
- var n = i[e];
- n.invalidUpdate(), n.update(-1)
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "clock", {
- get: function() {
- return this._clock
- },
- set: function(t) {
- if (this._clock !== t) {
- null !== this._clock && this._clock.remove(this), this._clock = t, this._clock && this._clock.add(this);
- for (var e = 0, i = this._slots; e < i.length; e++) {
- var n = i[e].childArmature;
- null !== n && (n.clock = this._clock)
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "parent", {
- get: function() {
- return this._parent
- },
- enumerable: !0,
- configurable: !0
- }), i.prototype.replaceTexture = function(t) {
- this.replacedTexture = t
- }, i.prototype.hasEventListener = function(t) {
- return this._proxy.hasDBEventListener(t)
- }, i.prototype.addEventListener = function(t, e, i) {
- this._proxy.addDBEventListener(t, e, i)
- }, i.prototype.removeEventListener = function(t, e, i) {
- this._proxy.removeDBEventListener(t, e, i)
- }, i.prototype.enableAnimationCache = function(t) {
- console.warn("Deprecated."), this.cacheFrameRate = t
- }, i.prototype.getDisplay = function() {
- return this._display
- }, i
- })(t.BaseObject);
- t.Armature = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.globalTransformMatrix = new t.Matrix, i.global = new t.Transform, i.offset = new t.Transform, i
- }
- return n(i, e), i.prototype._onClear = function() {
- this.globalTransformMatrix.identity(), this.global.identity(), this.offset.identity(), this.origin = null, this.userData = null, this._globalDirty = !1, this._armature = null
- }, i.prototype.updateGlobalTransform = function() {
- this._globalDirty && (this._globalDirty = !1, this.global.fromMatrix(this.globalTransformMatrix))
- }, Object.defineProperty(i.prototype, "armature", {
- get: function() {
- return this._armature
- },
- enumerable: !0,
- configurable: !0
- }), i._helpMatrix = new t.Matrix, i._helpTransform = new t.Transform, i._helpPoint = new t.Point, i
- })(t.BaseObject);
- t.TransformObject = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.animationPose = new t.Transform, i._blendState = new t.BlendState, i
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.Bone]"
- }, i.prototype._onClear = function() {
- e.prototype._onClear.call(this), this.offsetMode = 1, this.animationPose.identity(), this._transformDirty = !1, this._childrenTransformDirty = !1, this._localDirty = !0, this._hasConstraint = !1, this._visible = !0, this._cachedFrameIndex = -1, this._blendState.clear(), this._boneData = null, this._parent = null, this._cachedFrameIndices = null
- }, i.prototype._updateGlobalTransformMatrix = function(e) {
- var i = this._boneData,
- n = this.global,
- r = this.globalTransformMatrix,
- s = this.origin,
- o = this.offset,
- a = this.animationPose,
- l = this._parent,
- h = this._armature.flipX,
- c = this._armature.flipY === t.DragonBones.yDown,
- u = null !== l,
- _ = 0;
- if (1 === this.offsetMode ? null !== s ? (n.x = s.x + o.x + a.x, n.scaleX = s.scaleX * o.scaleX * a.scaleX, n.scaleY = s.scaleY * o.scaleY * a.scaleY, t.DragonBones.yDown ? (n.y = s.y + o.y + a.y, n.skew = s.skew + o.skew + a.skew, n.rotation = s.rotation + o.rotation + a.rotation) : (n.y = s.y - o.y + a.y, n.skew = s.skew - o.skew + a.skew, n.rotation = s.rotation - o.rotation + a.rotation)) : (n.copyFrom(o), t.DragonBones.yDown || (n.y = -n.y, n.skew = -n.skew, n.rotation = -n.rotation), n.add(a)) : 0 === this.offsetMode ? null !== s ? n.copyFrom(s).add(a) : n.copyFrom(a) : (u = !1, n.copyFrom(o), t.DragonBones.yDown || (n.y = -n.y, n.skew = -n.skew, n.rotation = -n.rotation)), u) {
- var f = 0 === l._boneData.type ? l.globalTransformMatrix : l._getGlobalTransformMatrix(n.x, n.y);
- if (i.inheritScale) i.inheritRotation || (l.updateGlobalTransform(), _ = h && c ? n.rotation - (l.global.rotation + Math.PI) : h ? n.rotation + l.global.rotation + Math.PI : c ? n.rotation + l.global.rotation : n.rotation - l.global.rotation, n.rotation = _), n.toMatrix(r), r.concat(f), i.inheritTranslation ? (n.x = r.tx, n.y = r.ty) : (r.tx = n.x, r.ty = n.y), e ? n.fromMatrix(r) : this._globalDirty = !0;
- else {
- if (i.inheritTranslation) {
- var d = n.x,
- p = n.y;
- n.x = f.a * d + f.c * p + f.tx, n.y = f.b * d + f.d * p + f.ty
- } else h && (n.x = -n.x), c && (n.y = -n.y);
- i.inheritRotation ? (l.updateGlobalTransform(), _ = l.global.scaleX < 0 ? n.rotation + l.global.rotation + Math.PI : n.rotation + l.global.rotation, f.a * f.d - f.b * f.c < 0 && (_ -= 2 * n.rotation, (h !== c || i.inheritReflection) && (n.skew += Math.PI), t.DragonBones.yDown || (n.skew = -n.skew)), n.rotation = _) : (h || c) && (h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, n.skew += Math.PI), n.rotation = _), n.toMatrix(r)
- }
- } else(h || c) && (h && (n.x = -n.x), c && (n.y = -n.y), h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, n.skew += Math.PI), n.rotation = _), n.toMatrix(r)
- }, i.prototype.init = function(t, e) {
- null === this._boneData && (this._boneData = t, this._armature = e, null !== this._boneData.parent && (this._parent = this._armature.getBone(this._boneData.parent.name)), this._armature._addBone(this), this.origin = this._boneData.transform)
- }, i.prototype.update = function(t) {
- if (this._blendState.dirty = !1, t >= 0 && null !== this._cachedFrameIndices) {
- var e = this._cachedFrameIndices[t];
- if (e >= 0 && this._cachedFrameIndex === e) this._transformDirty = !1;
- else if (e >= 0) this._transformDirty = !0, this._cachedFrameIndex = e;
- else {
- if (this._hasConstraint)
- for (var i = 0, n = this._armature._constraints; i < n.length; i++) {
- (o = n[i])._root === this && o.update()
- }
- this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
- }
- } else {
- if (this._hasConstraint)
- for (var r = 0, s = this._armature._constraints; r < s.length; r++) {
- var o;
- (o = s[r])._root === this && o.update()
- }(this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1)
- }
- if (this._transformDirty)
- if (this._transformDirty = !1, this._childrenTransformDirty = !0, this._cachedFrameIndex < 0) {
- var a = t >= 0;
- this._localDirty && this._updateGlobalTransformMatrix(a), a && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
- } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
- else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
- this._localDirty = !0
- }, i.prototype.updateByConstraint = function() {
- this._localDirty && (this._localDirty = !1, (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && this._updateGlobalTransformMatrix(!0), this._transformDirty = !0)
- }, i.prototype.invalidUpdate = function() {
- this._transformDirty = !0
- }, i.prototype.contains = function(t) {
- if (t === this) return !1;
- for (var e = t; e !== this && null !== e;) e = e.parent;
- return e === this
- }, Object.defineProperty(i.prototype, "boneData", {
- get: function() {
- return this._boneData
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "visible", {
- get: function() {
- return this._visible
- },
- set: function(t) {
- if (this._visible !== t) {
- this._visible = t;
- for (var e = 0, i = this._armature.getSlots(); e < i.length; e++) {
- var n = i[e];
- n.parent === this && n._updateVisible()
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "name", {
- get: function() {
- return this._boneData.name
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "parent", {
- get: function() {
- return this._parent
- },
- enumerable: !0,
- configurable: !0
- }), i.prototype.getBones = function() {
- console.warn("Deprecated.");
- for (var t = new Array, e = 0, i = this._armature.getBones(); e < i.length; e++) {
- var n = i[e];
- n.parent === this && t.push(n)
- }
- return t
- }, i.prototype.getSlots = function() {
- console.warn("Deprecated.");
- for (var t = new Array, e = 0, i = this._armature.getSlots(); e < i.length; e++) {
- var n = i[e];
- n.parent === this && t.push(n)
- }
- return t
- }, Object.defineProperty(i.prototype, "slot", {
- get: function() {
- console.warn("Deprecated.");
- for (var t = 0, e = this._armature.getSlots(); t < e.length; t++) {
- var i = e[t];
- if (i.parent === this) return i
- }
- return null
- },
- enumerable: !0,
- configurable: !0
- }), i
- })(t.TransformObject);
- t.Bone = e
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e._vertices = [], e._deformVertices = [], e._hullCache = [], e._matrixCahce = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.Surface]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this._dX = 0, this._dY = 0, this._k = 0, this._kX = 0, this._kY = 0, this._vertices.length = 0, this._deformVertices.length = 0, this._matrixCahce.length = 0, this._hullCache.length = 0
- }, e.prototype._getAffineTransform = function(t, e, i, n, r, s, o, a, l, h, c, u, _) {
- var f = o - r,
- d = a - s,
- p = l - r,
- m = h - s;
- c.rotation = Math.atan2(d, f), c.skew = Math.atan2(m, p) - .5 * Math.PI - c.rotation, _ && (c.rotation += Math.PI), c.scaleX = Math.sqrt(f * f + d * d) / i, c.scaleY = Math.sqrt(p * p + m * m) / n, c.toMatrix(u), c.x = u.tx = r - (u.a * t + u.c * e), c.y = u.ty = s - (u.b * t + u.d * e)
- }, e.prototype._updateVertices = function() {
- var t = this._boneData.vertices,
- e = this._vertices,
- i = this._deformVertices;
- if (null !== this._parent)
- if (1 === this._parent._boneData.type)
- for (var n = 0, r = t.length; n < r; n += 2) {
- var s = t[n] + i[n],
- o = t[n + 1] + i[n],
- a = this._parent._getGlobalTransformMatrix(s, o);
- e[n] = a.a * s + a.c * o + a.tx, e[n + 1] = a.b * s + a.d * o + a.ty
- } else {
- var l = this._parent.globalTransformMatrix;
- for (n = 0, r = t.length; n < r; n += 2) {
- s = t[n] + i[n], o = t[n + 1] + i[n + 1];
- e[n] = l.a * s + l.c * o + l.tx, e[n + 1] = l.b * s + l.d * o + l.ty
- }
- } else
- for (n = 0, r = t.length; n < r; n += 2) e[n] = t[n] + i[n], e[n + 1] = t[n + 1] + i[n + 1]
- }, e.prototype._updateGlobalTransformMatrix = function(t) {
- var e = 2 * this._boneData.segmentX,
- i = this._vertices.length - 2,
- n = this._vertices[0],
- r = this._vertices[1],
- s = this._vertices[e],
- o = this._vertices[e + 1],
- a = this._vertices[i],
- l = this._vertices[i + 1],
- h = this._vertices[i - e],
- c = this._vertices[i - e + 1],
- u = n + .5 * (a - n),
- _ = r + .5 * (l - r),
- f = u + .5 * (s + .5 * (h - s) - u),
- d = _ + .5 * (o + .5 * (c - o) - _),
- p = s + .5 * (a - s),
- m = o + .5 * (l - o),
- y = h + .5 * (a - h),
- v = c + .5 * (l - c);
- this._globalDirty = !1, this._getAffineTransform(0, 0, 200, 200, f, d, p, m, y, v, this.global, this.globalTransformMatrix, !1)
- }, e.prototype._getGlobalTransformMatrix = function(t, i) {
- var n = 1e3;
- if (t < -n || n < t || i < -n || n < i) return this.globalTransformMatrix;
- var r = !1,
- s = 200,
- o = this._boneData,
- a = o.segmentX,
- l = o.segmentY,
- h = 2 * o.segmentX,
- c = this._dX,
- u = this._dY,
- _ = Math.floor((t + s) / c),
- f = Math.floor((i + s) / u),
- d = 0,
- p = _ * c - s,
- m = f * u - s,
- y = this._matrixCahce,
- v = e._helpMatrix;
- if (t < -s) {
- if (i < -s || i >= s) return this.globalTransformMatrix;
- if (d = 7 * (2 * (a * (l + 1) + 2 * a + l + f) + ((r = i > this._kX * (t + s) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
- else {
- var g = f * (h + 2),
- x = this._hullCache[4],
- b = this._hullCache[5],
- A = this._hullCache[2] - (l - f) * x,
- C = this._hullCache[3] - (l - f) * b,
- T = this._vertices;
- r ? this._getAffineTransform(-s, m + u, 800, u, T[g + h + 2], T[g + h + 3], A + x, C + b, T[g], T[g + 1], e._helpTransform, v, !0) : this._getAffineTransform(-n, m, 800, u, A, C, T[g], T[g + 1], A + x, C + b, e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
- }
- } else if (t >= s) {
- if (i < -s || i >= s) return this.globalTransformMatrix;
- if (d = 7 * (2 * (a * (l + 1) + a + f) + ((r = i > this._kX * (t - n) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
- else {
- g = (f + 1) * (h + 2) - 2, x = this._hullCache[4], b = this._hullCache[5], A = this._hullCache[0] + f * x, C = this._hullCache[1] + f * b, T = this._vertices;
- r ? this._getAffineTransform(n, m + u, 800, u, A + x, C + b, T[g + h + 2], T[g + h + 3], A, C, e._helpTransform, v, !0) : this._getAffineTransform(s, m, 800, u, T[g], T[g + 1], A, C, T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
- }
- } else if (i < -s) {
- if (t < -s || t >= s) return this.globalTransformMatrix;
- if (d = 7 * (a * (l + 1) + 2 * _ + ((r = i > this._kY * (t - p - c) - n) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
- else {
- g = 2 * _, x = this._hullCache[10], b = this._hullCache[11], A = this._hullCache[8] + _ * x, C = this._hullCache[9] + _ * b, T = this._vertices;
- r ? this._getAffineTransform(p + c, -s, c, 800, T[g + 2], T[g + 3], T[g], T[g + 1], A + x, C + b, e._helpTransform, v, !0) : this._getAffineTransform(p, -n, c, 800, A, C, A + x, C + b, T[g], T[g + 1], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
- }
- } else if (i >= s) {
- if (t < -s || t >= s) return this.globalTransformMatrix;
- if (d = 7 * (2 * (a * (l + 1) + a + l + f) + ((r = i > this._kY * (t - p - c) + s) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
- else {
- g = l * (h + 2) + 2 * _, x = this._hullCache[10], b = this._hullCache[11], A = this._hullCache[6] - (a - _) * x, C = this._hullCache[7] - (a - _) * b, T = this._vertices;
- r ? this._getAffineTransform(p + c, n, c, 800, A + x, C + b, A, C, T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, s, c, 800, T[g], T[g + 1], T[g + 2], T[g + 3], A, C, e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
- }
- } else if (d = 7 * (2 * (a * f + _) + ((r = i > this._k * (t - p - c) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
- else {
- g = 2 * _ + f * (h + 2), T = this._vertices;
- r ? this._getAffineTransform(p + c, m + u, c, u, T[g + h + 4], T[g + h + 5], T[g + h + 2], T[g + h + 3], T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, m, c, u, T[g], T[g + 1], T[g + 2], T[g + 3], T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
- }
- return v
- }, e.prototype.init = function(e, i) {
- if (null === this._boneData) {
- t.prototype.init.call(this, e, i);
- var n = e.segmentX,
- r = e.segmentY,
- s = e.vertices.length;
- this._dX = 400 / n, this._dY = 400 / r, this._k = -this._dY / this._dX, this._kX = -this._dY / 800, this._kY = -800 / this._dX, this._vertices.length = s, this._deformVertices.length = s, this._matrixCahce.length = 2 * (n * r + 2 * n + 2 * r) * 7, this._hullCache.length = 10;
- for (var o = 0; o < s; ++o) this._deformVertices[o] = 0
- }
- }, e.prototype.update = function(t) {
- if (this._blendState.dirty = !1, t >= 0 && null !== this._cachedFrameIndices) {
- var i = this._cachedFrameIndices[t];
- if (i >= 0 && this._cachedFrameIndex === i) this._transformDirty = !1;
- else if (i >= 0) this._transformDirty = !0, this._cachedFrameIndex = i;
- else {
- if (this._hasConstraint)
- for (var n = 0, r = this._armature._constraints; n < r.length; n++) {
- (a = r[n])._root === this && a.update()
- }
- this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
- }
- } else {
- if (this._hasConstraint)
- for (var s = 0, o = this._armature._constraints; s < o.length; s++) {
- var a;
- (a = o[s])._root === this && a.update()
- }(this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1)
- }
- if (this._transformDirty) {
- this._transformDirty = !1, this._childrenTransformDirty = !0;
- for (var l = 0, h = this._matrixCahce.length; l < h; l += 7) this._matrixCahce[l] = -1;
- if (this._updateVertices(), this._cachedFrameIndex < 0) {
- var c = t >= 0;
- this._localDirty && this._updateGlobalTransformMatrix(c), c && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
- } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
- var u = 2 * this.global.x,
- _ = 2 * this.global.y,
- f = e._helpPoint;
- this.globalTransformMatrix.transformPoint(1e3, -200, f), this._hullCache[0] = f.x, this._hullCache[1] = f.y, this._hullCache[2] = u - f.x, this._hullCache[3] = _ - f.y, this.globalTransformMatrix.transformPoint(0, this._dY, f, !0), this._hullCache[4] = f.x, this._hullCache[5] = f.y, this.globalTransformMatrix.transformPoint(200, 1e3, f), this._hullCache[6] = f.x, this._hullCache[7] = f.y, this._hullCache[8] = u - f.x, this._hullCache[9] = _ - f.y, this.globalTransformMatrix.transformPoint(this._dX, 0, f, !0), this._hullCache[10] = f.x, this._hullCache[11] = f.y
- } else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
- this._localDirty = !0
- }, e
- })(t.Bone);
- t.Surface = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i._localMatrix = new t.Matrix, i._colorTransform = new t.ColorTransform, i._displayDatas = [], i._displayList = [], i._deformVertices = null, i._rawDisplay = null, i._meshDisplay = null, i
- }
- return n(i, e), i.prototype._onClear = function() {
- e.prototype._onClear.call(this);
- for (var i = [], n = 0, r = this._displayList; n < r.length; n++) {
- null !== (a = r[n]) && a !== this._rawDisplay && a !== this._meshDisplay && i.indexOf(a) < 0 && i.push(a)
- }
- for (var s = 0, o = i; s < o.length; s++) {
- var a;
- (a = o[s]) instanceof t.Armature ? a.dispose() : this._disposeDisplay(a, !0)
- }
- null !== this._deformVertices && this._deformVertices.returnToPool(), null !== this._meshDisplay && this._meshDisplay !== this._rawDisplay && this._disposeDisplay(this._meshDisplay, !1), null !== this._rawDisplay && this._disposeDisplay(this._rawDisplay, !1), this.displayController = null, this._displayDirty = !1, this._zOrderDirty = !1, this._blendModeDirty = !1, this._colorDirty = !1, this._transformDirty = !1, this._visible = !0, this._blendMode = 0, this._displayIndex = -1, this._animationDisplayIndex = -1, this._zOrder = 0, this._cachedFrameIndex = -1, this._pivotX = 0, this._pivotY = 0, this._localMatrix.identity(), this._colorTransform.identity(), this._displayList.length = 0, this._displayDatas.length = 0, this._slotData = null, this._rawDisplayDatas = null, this._displayData = null, this._boundingBoxData = null, this._textureData = null, this._deformVertices = null, this._rawDisplay = null, this._meshDisplay = null, this._display = null, this._childArmature = null, this._parent = null, this._cachedFrameIndices = null
- }, i.prototype._getDefaultRawDisplayData = function(t) {
- var e = this._armature._armatureData.defaultSkin;
- if (null !== e) {
- var i = e.getDisplays(this._slotData.name);
- if (null !== i) return t < i.length ? i[t] : null
- }
- return null
- }, i.prototype._updateDisplayData = function() {
- var e = this._displayData,
- n = null !== this._deformVertices ? this._deformVertices.verticesData : null,
- r = this._textureData,
- s = null,
- o = null;
- if (this._displayData = null, this._boundingBoxData = null, this._textureData = null, this._displayIndex >= 0 && (null !== this._rawDisplayDatas && (s = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null), null === s && (s = this._getDefaultRawDisplayData(this._displayIndex)), this._displayIndex < this._displayDatas.length && (this._displayData = this._displayDatas[this._displayIndex])), null !== this._displayData && (2 === this._displayData.type ? o = this._displayData.vertices : 4 === this._displayData.type ? o = this._displayData.vertices : null !== s && (2 === s.type ? o = s.vertices : 4 === s.type && (o = s.vertices)), 3 === this._displayData.type ? this._boundingBoxData = this._displayData.boundingBox : null !== s && 3 === s.type && (this._boundingBoxData = s.boundingBox), 0 === this._displayData.type ? this._textureData = this._displayData.texture : 2 === this._displayData.type && (this._textureData = this._displayData.texture)), this._displayData !== e || o !== n || this._textureData !== r) {
- if (null === o && null !== this._textureData) {
- var a = this._displayData,
- l = this._textureData.parent.scale * this._armature._armatureData.scale,
- h = this._textureData.frame;
- this._pivotX = a.pivot.x, this._pivotY = a.pivot.y;
- var c = null !== h ? h : this._textureData.region,
- u = c.width,
- _ = c.height;
- this._textureData.rotated && null === h && (u = c.height, _ = c.width), this._pivotX *= u * l, this._pivotY *= _ * l, null !== h && (this._pivotX += h.x * l, this._pivotY += h.y * l), null !== this._displayData && null !== s && this._displayData !== s && (s.transform.toMatrix(i._helpMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(0, 0, i._helpPoint), this._pivotX -= i._helpPoint.x, this._pivotY -= i._helpPoint.y, this._displayData.transform.toMatrix(i._helpMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(0, 0, i._helpPoint), this._pivotX += i._helpPoint.x, this._pivotY += i._helpPoint.y), t.DragonBones.yDown || (this._pivotY = (this._textureData.rotated ? this._textureData.region.width : this._textureData.region.height) * l - this._pivotY)
- } else this._pivotX = 0, this._pivotY = 0;
- null !== s ? this.origin = s.transform : null !== this._displayData ? this.origin = this._displayData.transform : this.origin = null, o !== n ? (null === this._deformVertices && (this._deformVertices = t.BaseObject.borrowObject(t.DeformVertices)), this._deformVertices.init(o, this._armature)) : null !== this._deformVertices && this._textureData !== r && (this._deformVertices.verticesDirty = !0), this._displayDirty = !0, this._transformDirty = !0
- }
- }, i.prototype._updateDisplay = function() {
- var e = null !== this._display ? this._display : this._rawDisplay,
- i = this._childArmature;
- this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? (this._display = this._displayList[this._displayIndex], null !== this._display && this._display instanceof t.Armature ? (this._childArmature = this._display, this._display = this._childArmature.display) : this._childArmature = null) : (this._display = null, this._childArmature = null);
- var n = null !== this._display ? this._display : this._rawDisplay;
- if (n !== e && (this._onUpdateDisplay(), this._replaceDisplay(e), this._transformDirty = !0, this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0), n !== this._rawDisplay && n !== this._meshDisplay || this._updateFrame(), this._childArmature !== i && (null !== i && (i._parent = null, i.clock = null, i.inheritAnimation && i.animation.reset()), null !== this._childArmature && (this._childArmature._parent = this, this._childArmature.clock = this._armature.clock, this._childArmature.inheritAnimation))) {
- if (0 === this._childArmature.cacheFrameRate) {
- var r = this._armature.cacheFrameRate;
- 0 !== r && (this._childArmature.cacheFrameRate = r)
- }
- var s = null;
- if (null !== this._displayData && 1 === this._displayData.type) s = this._displayData.actions;
- else if (this._displayIndex >= 0 && null !== this._rawDisplayDatas) {
- var o = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null;
- null === o && (o = this._getDefaultRawDisplayData(this._displayIndex)), null !== o && 1 === o.type && (s = o.actions)
- }
- if (null !== s && s.length > 0)
- for (var a = 0, l = s; a < l.length; a++) {
- var h = l[a],
- c = t.BaseObject.borrowObject(t.EventObject);
- t.EventObject.actionDataToInstance(h, c, this._armature), c.slot = this, this._armature._bufferAction(c, !1)
- } else this._childArmature.animation.play()
- }
- }, i.prototype._updateGlobalTransformMatrix = function(t) {
- var e = 0 === this._parent._boneData.type ? this._parent.globalTransformMatrix : this._parent._getGlobalTransformMatrix(this.global.x, this.global.y);
- this.globalTransformMatrix.copyFrom(this._localMatrix), this.globalTransformMatrix.concat(e), t ? this.global.fromMatrix(this.globalTransformMatrix) : this._globalDirty = !0
- }, i.prototype._setDisplayIndex = function(t, e) {
- if (void 0 === e && (e = !1), e) {
- if (this._animationDisplayIndex === t) return !1;
- this._animationDisplayIndex = t
- }
- return this._displayIndex !== t && (this._displayIndex = t, this._displayDirty = !0, this._updateDisplayData(), this._displayDirty)
- }, i.prototype._setZorder = function(t) {
- return this._zOrder, this._zOrder = t, this._zOrderDirty = !0, this._zOrderDirty
- }, i.prototype._setColor = function(t) {
- return this._colorTransform.copyFrom(t), this._colorDirty = !0, this._colorDirty
- }, i.prototype._setDisplayList = function(e) {
- if (null !== e && e.length > 0) {
- this._displayList.length !== e.length && (this._displayList.length = e.length);
- for (var i = 0, n = e.length; i < n; ++i) {
- var r = e[i];
- null !== r && r !== this._rawDisplay && r !== this._meshDisplay && !(r instanceof t.Armature) && this._displayList.indexOf(r) < 0 && this._initDisplay(r, !0), this._displayList[i] = r
- }
- } else this._displayList.length > 0 && (this._displayList.length = 0);
- return this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? this._displayDirty = this._display !== this._displayList[this._displayIndex] : this._displayDirty = null !== this._display, this._updateDisplayData(), this._displayDirty
- }, i.prototype.init = function(t, e, i, n) {
- if (null === this._slotData) {
- this._slotData = t, this._isFromCache = !1, this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0, this._blendMode = this._slotData.blendMode, this._zOrder = this._slotData.zOrder, this._colorTransform.copyFrom(this._slotData.color), this._rawDisplay = i, this._meshDisplay = n, this._armature = e;
- var r = this._armature.getBone(this._slotData.parent.name);
- null !== r && (this._parent = r), this._armature._addSlot(this), this._initDisplay(this._rawDisplay, !1), this._rawDisplay !== this._meshDisplay && this._initDisplay(this._meshDisplay, !1), this._onUpdateDisplay(), this._addDisplay()
- }
- }, i.prototype.update = function(t) {
- if (this._isFromCache = !1, this._displayDirty && (this._displayDirty = !1, this._updateDisplay(), this._transformDirty && (null !== this.origin ? this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix) : this.global.copyFrom(this.offset).toMatrix(this._localMatrix))), this._zOrderDirty && (this._zOrderDirty = !1, this._updateZOrder()), t >= 0 && null !== this._cachedFrameIndices) {
- var e = this._cachedFrameIndices[t];
- e >= 0 && this._cachedFrameIndex === e ? this._transformDirty = !1 : e >= 0 ? (this._transformDirty = !0, this._cachedFrameIndex = e) : this._transformDirty || this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
- } else(this._transformDirty || this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1);
- if (null !== this._display) {
- if (this._visibleDirty && (this._visibleDirty = !1, this._updateVisible()), this._blendModeDirty && (this._blendModeDirty = !1, this._updateBlendMode()), this._colorDirty && (this._colorDirty = !1, this._updateColor()), null !== this._deformVertices && null !== this._deformVertices.verticesData && this._display === this._meshDisplay) {
- var i = null !== this._deformVertices.verticesData.weight,
- n = 0 !== this._parent._boneData.type;
- if ((this._deformVertices.verticesDirty || i && this._deformVertices.isBonesUpdate() || n && this._parent._childrenTransformDirty) && (this._deformVertices.verticesDirty = !1, this._updateMesh()), i || n) return
- }
- if (this._transformDirty) {
- if (this._transformDirty = !1, this._cachedFrameIndex < 0) {
- var r = t >= 0;
- this._updateGlobalTransformMatrix(r), r && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
- } else this._isFromCache = !0, this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
- this._updateTransform()
- }
- }
- }, i.prototype.updateTransformAndMatrix = function() {
- this._transformDirty && (this._transformDirty = !1, this._updateGlobalTransformMatrix(!1))
- }, i.prototype.replaceDisplayData = function(t, e) {
- if (void 0 === e && (e = -1), e < 0 && (e = this._displayIndex < 0 ? 0 : this._displayIndex), this._displayDatas.length <= e) {
- this._displayDatas.length = e + 1;
- for (var i = 0, n = this._displayDatas.length; i < n; ++i) this._displayDatas[i] || (this._displayDatas[i] = null)
- }
- this._displayDatas[e] = t
- }, i.prototype.containsPoint = function(t, e) {
- return null !== this._boundingBoxData && (this.updateTransformAndMatrix(), i._helpMatrix.copyFrom(this.globalTransformMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(t, e, i._helpPoint), this._boundingBoxData.containsPoint(i._helpPoint.x, i._helpPoint.y))
- }, i.prototype.intersectsSegment = function(t, e, n, r, s, o, a) {
- if (void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), null === this._boundingBoxData) return 0;
- this.updateTransformAndMatrix(), i._helpMatrix.copyFrom(this.globalTransformMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(t, e, i._helpPoint), t = i._helpPoint.x, e = i._helpPoint.y, i._helpMatrix.transformPoint(n, r, i._helpPoint), n = i._helpPoint.x, r = i._helpPoint.y;
- var l = this._boundingBoxData.intersectsSegment(t, e, n, r, s, o, a);
- return l > 0 && (1 === l || 2 === l ? null !== s ? (this.globalTransformMatrix.transformPoint(s.x, s.y, s), null !== o && (o.x = s.x, o.y = s.y)) : null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o) : (null !== s && this.globalTransformMatrix.transformPoint(s.x, s.y, s), null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o)), null !== a && (this.globalTransformMatrix.transformPoint(Math.cos(a.x), Math.sin(a.x), i._helpPoint, !0), a.x = Math.atan2(i._helpPoint.y, i._helpPoint.x), this.globalTransformMatrix.transformPoint(Math.cos(a.y), Math.sin(a.y), i._helpPoint, !0), a.y = Math.atan2(i._helpPoint.y, i._helpPoint.x))), l
- }, i.prototype.invalidUpdate = function() {
- this._displayDirty = !0, this._transformDirty = !0
- }, Object.defineProperty(i.prototype, "visible", {
- get: function() {
- return this._visible
- },
- set: function(t) {
- this._visible !== t && (this._visible = t, this._updateVisible())
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "displayIndex", {
- get: function() {
- return this._displayIndex
- },
- set: function(t) {
- this._setDisplayIndex(t) && this.update(-1)
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "name", {
- get: function() {
- return this._slotData.name
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "displayList", {
- get: function() {
- return this._displayList.concat()
- },
- set: function(e) {
- var i = this._displayList.concat(),
- n = new Array;
- this._setDisplayList(e) && this.update(-1);
- for (var r = 0, s = i; r < s.length; r++) {
- null !== (l = s[r]) && l !== this._rawDisplay && l !== this._meshDisplay && this._displayList.indexOf(l) < 0 && n.indexOf(l) < 0 && n.push(l)
- }
- for (var o = 0, a = n; o < a.length; o++) {
- var l;
- (l = a[o]) instanceof t.Armature || this._disposeDisplay(l, !0)
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "slotData", {
- get: function() {
- return this._slotData
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "rawDisplayDatas", {
- get: function() {
- return this._rawDisplayDatas
- },
- set: function(t) {
- if (this._rawDisplayDatas !== t)
- if (this._displayDirty = !0, this._rawDisplayDatas = t, null !== this._rawDisplayDatas) {
- this._displayDatas.length = this._rawDisplayDatas.length;
- for (var e = 0, i = this._displayDatas.length; e < i; ++e) {
- var n = this._rawDisplayDatas[e];
- null === n && (n = this._getDefaultRawDisplayData(e)), this._displayDatas[e] = n
- }
- } else this._displayDatas.length = 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "displayData", {
- get: function() {
- return this._displayData
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "boundingBoxData", {
- get: function() {
- return this._boundingBoxData
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "rawDisplay", {
- get: function() {
- return this._rawDisplay
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "meshDisplay", {
- get: function() {
- return this._meshDisplay
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "display", {
- get: function() {
- return this._display
- },
- set: function(t) {
- if (this._display !== t) {
- var e = this._displayList.length;
- if (this._displayIndex < 0 && 0 === e && (this._displayIndex = 0), !(this._displayIndex < 0)) {
- var i = this.displayList;
- e <= this._displayIndex && (i.length = this._displayIndex + 1), i[this._displayIndex] = t, this.displayList = i
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "childArmature", {
- get: function() {
- return this._childArmature
- },
- set: function(t) {
- this._childArmature !== t && (this.display = t)
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "parent", {
- get: function() {
- return this._parent
- },
- enumerable: !0,
- configurable: !0
- }), i.prototype.getDisplay = function() {
- return this._display
- }, i.prototype.setDisplay = function(t) {
- this.display = t
- }, i
- })(t.TransformObject);
- t.Slot = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.prototype._onClear = function() {
- this._armature = null, this._target = null, this._root = null, this._bone = null
- }, Object.defineProperty(i.prototype, "name", {
- get: function() {
- return this._constraintData.name
- },
- enumerable: !0,
- configurable: !0
- }), i._helpMatrix = new t.Matrix, i._helpTransform = new t.Transform, i._helpPoint = new t.Point, i
- })(t.BaseObject);
- t.Constraint = e;
- var i = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.IKConstraint]"
- }, i.prototype._onClear = function() {
- e.prototype._onClear.call(this), this._scaleEnabled = !1, this._bendPositive = !1, this._weight = 1, this._constraintData = null
- }, i.prototype._computeA = function() {
- var e = this._target.global,
- i = this._root.global,
- n = this._root.globalTransformMatrix,
- r = Math.atan2(e.y - i.y, e.x - i.x);
- i.scaleX < 0 && (r += Math.PI), i.rotation += t.Transform.normalizeRadian(r - i.rotation) * this._weight, i.toMatrix(n)
- }, i.prototype._computeB = function() {
- var e = this._bone._boneData.length,
- i = this._root,
- n = this._target.global,
- r = i.global,
- s = this._bone.global,
- o = this._bone.globalTransformMatrix,
- a = o.a * e,
- l = o.b * e,
- h = a * a + l * l,
- c = Math.sqrt(h),
- u = s.x - r.x,
- _ = s.y - r.y,
- f = u * u + _ * _,
- d = Math.sqrt(f),
- p = s.rotation,
- m = r.rotation,
- y = Math.atan2(_, u),
- v = (u = n.x - r.x) * u + (_ = n.y - r.y) * _,
- g = Math.sqrt(v),
- x = 0;
- if (c + d <= g || g + c <= d || g + d <= c) x = Math.atan2(n.y - r.y, n.x - r.x), c + d <= g || d < c && (x += Math.PI);
- else {
- var b = (f - h + v) / (2 * v),
- A = Math.sqrt(f - b * b * v) / g,
- C = r.x + u * b,
- T = r.y + _ * b,
- S = -_ * A,
- w = u * A,
- E = !1,
- M = i.parent;
- if (null !== M) {
- var D = M.globalTransformMatrix;
- E = D.a * D.d - D.b * D.c < 0
- }
- E !== this._bendPositive ? (s.x = C - S, s.y = T - w) : (s.x = C + S, s.y = T + w), x = Math.atan2(s.y - r.y, s.x - r.x)
- }
- var B = t.Transform.normalizeRadian(x - y);
- r.rotation = m + B * this._weight, r.toMatrix(i.globalTransformMatrix);
- var I = y + B * this._weight;
- s.x = r.x + Math.cos(I) * d, s.y = r.y + Math.sin(I) * d;
- var P = Math.atan2(n.y - s.y, n.x - s.x);
- s.scaleX < 0 && (P += Math.PI), s.rotation = r.rotation + p - m + t.Transform.normalizeRadian(P - B - p) * this._weight, s.toMatrix(o)
- }, i.prototype.init = function(t, e) {
- if (null === this._constraintData) {
- this._constraintData = t, this._armature = e, this._target = this._armature.getBone(this._constraintData.target.name), this._root = this._armature.getBone(this._constraintData.root.name), this._bone = null !== this._constraintData.bone ? this._armature.getBone(this._constraintData.bone.name) : null;
- var i = this._constraintData;
- this._scaleEnabled = i.scaleEnabled, this._bendPositive = i.bendPositive, this._weight = i.weight, this._root._hasConstraint = !0
- }
- }, i.prototype.update = function() {
- this._root.updateByConstraint(), null !== this._bone ? (this._bone.updateByConstraint(), this._computeB()) : this._computeA()
- }, i.prototype.invalidUpdate = function() {
- this._root.invalidUpdate(), null !== this._bone && this._bone.invalidUpdate()
- }, i
- })(e);
- t.IKConstraint = i;
- var r = (function(e) {
- function i() {
- var t = null !== e && e.apply(this, arguments) || this;
- return t._bones = [], t._spaces = [], t._positions = [], t._curves = [], t._boneLengths = [], t._pathGlobalVertices = [], t._segments = [10], t
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.PathConstraint]"
- }, i.prototype._onClear = function() {
- e.prototype._onClear.call(this), this.dirty = !1, this.pathOffset = 0, this.position = 0, this.spacing = 0, this.rotateOffset = 0, this.rotateMix = 1, this.translateMix = 1, this._pathSlot = null, this._bones.length = 0, this._spaces.length = 0, this._positions.length = 0, this._curves.length = 0, this._boneLengths.length = 0, this._pathGlobalVertices.length = 0
- }, i.prototype._updatePathVertices = function(t) {
- var e = this._armature,
- i = e.armatureData.parent,
- n = e.armatureData.scale,
- r = i.intArray,
- s = i.floatArray,
- o = t.offset,
- a = r[o + 0],
- l = r[o + 2];
- this._pathGlobalVertices.length = 2 * a;
- var h = t.weight;
- if (null !== h)
- for (var c = this._pathSlot._deformVertices.bones, u = h.bones.length, _ = h.offset, f = r[_ + 1], d = _ + 2 + u, p = (T = 0, 0); T < a; T++) {
- for (var m = 0, y = 0, v = 0, g = r[d++]; v < g; v++) {
- var x = c[r[d++]];
- if (null !== x) {
- x.updateByConstraint();
- C = x.globalTransformMatrix;
- var b = s[f++];
- w = s[f++] * n, E = s[f++] * n;
- m += (C.a * w + C.c * E + C.tx) * b, y += (C.b * w + C.d * E + C.ty) * b
- }
- }
- this._pathGlobalVertices[p++] = m, this._pathGlobalVertices[p++] = y
- } else {
- var A = this._pathSlot.parent;
- A.updateByConstraint();
- for (var C = A.globalTransformMatrix, T = 0, S = l; T < a; T += 2) {
- var w = s[S++] * n,
- E = s[S++] * n,
- M = C.a * w + C.c * E + C.tx,
- D = C.b * w + C.d * E + C.ty;
- this._pathGlobalVertices[T] = M, this._pathGlobalVertices[T + 1] = D
- }
- }
- }, i.prototype._computeVertices = function(t, e, i, n) {
- for (var r = i, s = t; r < e; r += 2) n[r] = this._pathGlobalVertices[s++], n[r + 1] = this._pathGlobalVertices[s++]
- }, i.prototype._computeBezierCurve = function(t, e, i, n, r) {
- var s = this._armature.armatureData.parent.intArray[t.vertices.offset + 0],
- o = this._positions,
- a = this._spaces,
- l = t.closed,
- h = Array(),
- c = 2 * s,
- u = c / 6,
- _ = -1,
- f = this.position;
- o.length = 3 * e + 2;
- var d = 0;
- if (t.constantSpeed) {
- l ? (c += 2, h.length = s, this._computeVertices(2, c - 4, 0, h), this._computeVertices(0, 2, c - 4, h), h[c - 2] = h[0], h[c - 1] = h[1]) : (u--, c -= 4, h.length = c, this._computeVertices(2, c, 0, h));
- var p = new Array(u);
- d = 0;
- for (var m, y, v, g, x, b, A, C, T = h[0], S = h[1], w = 0, E = 0, M = 0, D = 0, B = 0, I = 0, P = (z = 0, 2); z < u; z++, P += 6) w = h[P], E = h[P + 1], M = h[P + 2], D = h[P + 3], B = h[P + 4], I = h[P + 5], x = 2 * (m = .1875 * (T - 2 * w + M)) + (v = .09375 * (3 * (w - M) - T + B)), b = 2 * (y = .1875 * (S - 2 * E + D)) + (g = .09375 * (3 * (E - D) - S + I)), A = .75 * (w - T) + m + .16666667 * v, C = .75 * (E - S) + y + .16666667 * g, d += Math.sqrt(A * A + C * C), A += x, C += b, x += v, b += g, d += Math.sqrt(A * A + C * C), A += x, C += b, d += Math.sqrt(A * A + C * C), A += x + v, C += b + g, d += Math.sqrt(A * A + C * C), p[z] = d, T = B, S = I;
- if (n && (f *= d), r)
- for (z = 0; z < e; z++) a[z] *= d;
- for (var R = this._segments, O = 0, L = (z = 0, j = 0, W = 0, 0); z < e; z++, j += 3) {
- var F = f += a[z];
- if (l)(F %= d) < 0 && (F += d), W = 0;
- else {
- if (F < 0) continue;
- if (F > d) continue
- }
- for (;; W++) {
- var N = p[W];
- if (!(F > N)) {
- if (0 === W) F /= N;
- else F = (F - (G = p[W - 1])) / (N - G);
- break
- }
- }
- if (W !== _) {
- _ = W;
- var V = 6 * W;
- for (T = h[V], S = h[V + 1], w = h[V + 2], E = h[V + 3], M = h[V + 4], D = h[V + 5], B = h[V + 6], I = h[V + 7], x = 2 * (m = .03 * (T - 2 * w + M)) + (v = .006 * (3 * (w - M) - T + B)), b = 2 * (y = .03 * (S - 2 * E + D)) + (g = .006 * (3 * (E - D) - S + I)), A = .3 * (w - T) + m + .16666667 * v, C = .3 * (E - S) + y + .16666667 * g, O = Math.sqrt(A * A + C * C), R[0] = O, V = 1; V < 8; V++) A += x, C += b, x += v, b += g, O += Math.sqrt(A * A + C * C), R[V] = O;
- A += x, C += b, O += Math.sqrt(A * A + C * C), R[8] = O, A += x + v, C += b + g, O += Math.sqrt(A * A + C * C), R[9] = O, L = 0
- }
- for (F *= O;; L++) {
- var k = R[L];
- if (!(F > k)) {
- var G;
- if (0 === L) F /= k;
- else F = L + (F - (G = R[L - 1])) / (k - G);
- break
- }
- }
- this.addCurvePosition(.1 * F, T, S, w, E, M, D, B, I, o, j, i)
- }
- } else {
- var U = t.curveLengths;
- if (d = U[u -= l ? 1 : 2], n && (f *= d), r)
- for (var z = 0; z < e; z++) a[z] *= d;
- h.length = 8;
- for (var z = 0, j = 0, W = 0; z < e; z++, j += 3) {
- if (f += a[z], l)(f %= d) < 0 && (f += d), W = 0;
- else {
- if (f < 0) continue;
- if (f > d) continue
- }
- for (var H = 0;; W++) {
- var X = U[W];
- if (!(f > X)) {
- if (0 === W) H = f / X;
- else {
- var Y = U[W - 1];
- H = (f - Y) / (X - Y)
- }
- break
- }
- }
- W !== _ && (_ = W, l && W === u ? (this._computeVertices(c - 4, 4, 0, h), this._computeVertices(0, 4, 4, h)) : this._computeVertices(6 * W + 2, 8, 0, h)), this.addCurvePosition(H, h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], o, j, i)
- }
- }
- }, i.prototype.addCurvePosition = function(t, e, i, n, r, s, o, a, l, h, c, u) {
- if (0 === t) return h[c] = e, h[c + 1] = i, void(h[c + 2] = 0);
- if (1 === t) return h[c] = a, h[c + 1] = l, void(h[c + 2] = 0);
- var _ = 1 - t,
- f = _ * _,
- d = t * t,
- p = f * _,
- m = f * t * 3,
- y = _ * d * 3,
- v = t * d,
- g = p * e + m * n + y * s + v * a,
- x = p * i + m * r + y * o + v * l;
- h[c] = g, h[c + 1] = x, h[c + 2] = u ? Math.atan2(x - (p * i + m * r + y * o), g - (p * e + m * n + y * s)) : 0
- }, i.prototype.init = function(t, e) {
- this._constraintData = t, this._armature = e;
- var i = t;
- this.pathOffset = i.pathDisplayData.vertices.offset, this.position = i.position, this.spacing = i.spacing, this.rotateOffset = i.rotateOffset, this.rotateMix = i.rotateMix, this.translateMix = i.translateMix, this._root = this._armature.getBone(i.root.name), this._target = this._armature.getBone(i.target.name), this._pathSlot = this._armature.getSlot(i.pathSlot.name);
- for (var n = 0, r = i.bones.length; n < r; n++) {
- var s = this._armature.getBone(i.bones[n].name);
- null !== s && this._bones.push(s)
- }
- 2 === i.rotateMode && (this._boneLengths.length = this._bones.length), this._root._hasConstraint = !0
- }, i.prototype.update = function() {
- var e = this._pathSlot;
- if (null !== e._deformVertices && null !== e._deformVertices.verticesData && e._deformVertices.verticesData.offset === this.pathOffset) {
- var i = this._constraintData,
- n = e._displayData,
- r = !1,
- s = e._deformVertices;
- if (this._root._childrenTransformDirty ? (this._updatePathVertices(n.vertices), r = !0) : null !== s && (s.verticesDirty || s.isBonesUpdate()) && (this._updatePathVertices(n.vertices), s.verticesDirty = !1, r = !0), r || this.dirty) {
- var o = i.positionMode,
- a = i.spacingMode,
- l = i.rotateMode,
- h = this._bones,
- c = 0 === a,
- u = 2 === l,
- _ = 0 === l,
- f = h.length,
- d = _ ? f : f + 1,
- p = this.spacing,
- m = this._spaces;
- if (m.length = d, u || c) {
- m[0] = 0;
- for (var y = 0, v = d - 1; y < v; y++) {
- (I = h[y]).updateByConstraint();
- var g = I._boneData.length,
- x = g * (P = I.globalTransformMatrix).a,
- b = g * P.b,
- A = Math.sqrt(x * x + b * b);
- u && (this._boneLengths[y] = A), m[y + 1] = (g + p) * A / g
- }
- } else
- for (y = 0; y < d; y++) m[y] = p;
- this._computeBezierCurve(n, d, _, 1 === o, 2 === a);
- var C, T = this._positions,
- S = this.rotateOffset,
- w = T[0],
- E = T[1];
- if (0 === S) C = 1 === l;
- else if (C = !1, null !== (I = e.parent)) S *= (P = I.globalTransformMatrix).a * P.d - P.b * P.c > 0 ? t.Transform.DEG_RAD : -t.Transform.DEG_RAD;
- for (var M = this.rotateMix, D = this.translateMix, B = (y = 0, 3); y < f; y++, B += 3) {
- var I, P;
- (I = h[y]).updateByConstraint(), (P = I.globalTransformMatrix).tx += (w - P.tx) * D, P.ty += (E - P.ty) * D;
- var R = (x = T[B]) - w,
- O = (b = T[B + 1]) - E;
- if (u) {
- var L = this._boneLengths[y],
- F = (Math.sqrt(R * R + O * O) / L - 1) * M + 1;
- P.a *= F, P.b *= F
- }
- if (w = x, E = b, M > 0) {
- var N = P.a,
- V = P.b,
- k = P.c,
- G = P.d,
- U = void 0,
- z = void 0,
- j = void 0;
- if (U = _ ? T[B - 1] : Math.atan2(O, R), U -= Math.atan2(V, N), C) {
- z = Math.cos(U), j = Math.sin(U);
- var W = I._boneData.length;
- w += (W * (z * N - j * V) - R) * M, E += (W * (j * N + z * V) - O) * M
- } else U += S;
- U > t.Transform.PI ? U -= t.Transform.PI_D : U < -t.Transform.PI && (U += t.Transform.PI_D), U *= M, z = Math.cos(U), j = Math.sin(U), P.a = z * N - j * V, P.b = j * N + z * V, P.c = z * k - j * G, P.d = j * k + z * G
- }
- I.global.fromMatrix(P)
- }
- this.dirty = !1
- }
- }
- }, i.prototype.invalidUpdate = function() {}, i
- })(e);
- t.PathConstraint = r
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function t(t) {
- void 0 === t && (t = 0), this.time = 0, this.timeScale = 1, this._systemTime = 0, this._animatebles = [], this._clock = null, this.time = t, this._systemTime = .001 * (new Date).getTime()
- }
- return t.prototype.advanceTime = function(t) {
- t != t && (t = 0);
- var e = .001 * Date.now();
- if (t < 0 && (t = e - this._systemTime), this._systemTime = e, 1 !== this.timeScale && (t *= this.timeScale), 0 !== t) {
- t < 0 ? this.time -= t : this.time += t;
- for (var i = 0, n = 0, r = this._animatebles.length; i < r; ++i) {
- var s = this._animatebles[i];
- null !== s ? (n > 0 && (this._animatebles[i - n] = s, this._animatebles[i] = null), s.advanceTime(t)) : n++
- }
- if (n > 0) {
- for (r = this._animatebles.length; i < r; ++i) {
- var o = this._animatebles[i];
- null !== o ? this._animatebles[i - n] = o : n++
- }
- this._animatebles.length -= n
- }
- }
- }, t.prototype.contains = function(t) {
- if (t === this) return !1;
- for (var e = t; e !== this && null !== e;) e = e.clock;
- return e === this
- }, t.prototype.add = function(t) {
- this._animatebles.indexOf(t) < 0 && (this._animatebles.push(t), t.clock = this)
- }, t.prototype.remove = function(t) {
- var e = this._animatebles.indexOf(t);
- e >= 0 && (this._animatebles[e] = null, t.clock = null)
- }, t.prototype.clear = function() {
- for (var t = 0, e = this._animatebles; t < e.length; t++) {
- var i = e[t];
- null !== i && (i.clock = null)
- }
- }, Object.defineProperty(t.prototype, "clock", {
- get: function() {
- return this._clock
- },
- set: function(t) {
- this._clock !== t && (null !== this._clock && this._clock.remove(this), this._clock = t, null !== this._clock && this._clock.add(this))
- },
- enumerable: !0,
- configurable: !0
- }), t.clock = new t, t
- })();
- t.WorldClock = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- var t = null !== e && e.apply(this, arguments) || this;
- return t._animationNames = [], t._animationStates = [], t._animations = {}, t._animationConfig = null, t
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.Animation]"
- }, i.prototype._onClear = function() {
- for (var t = 0, e = this._animationStates; t < e.length; t++) {
- e[t].returnToPool()
- }
- for (var i in this._animations) delete this._animations[i];
- null !== this._animationConfig && this._animationConfig.returnToPool(), this.timeScale = 1, this._lockUpdate = !1, this._animationDirty = !1, this._inheritTimeScale = 1, this._animationNames.length = 0, this._animationStates.length = 0, this._armature = null, this._animationConfig = null, this._lastAnimationState = null
- }, i.prototype._fadeOut = function(t) {
- switch (t.fadeOutMode) {
- case 1:
- for (var e = 0, i = this._animationStates; e < i.length; e++) {
- null === (h = i[e])._parent && (h.layer === t.layer && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
- }
- break;
- case 2:
- for (var n = 0, r = this._animationStates; n < r.length; n++) {
- null === (h = r[n])._parent && (h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
- }
- break;
- case 3:
- for (var s = 0, o = this._animationStates; s < o.length; s++) {
- null === (h = o[s])._parent && (h.layer === t.layer && h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
- }
- break;
- case 4:
- for (var a = 0, l = this._animationStates; a < l.length; a++) {
- var h;
- null === (h = l[a])._parent && h.fadeOut(t.fadeOutTime, t.pauseFadeOut)
- }
- }
- }, i.prototype.init = function(e) {
- null === this._armature && (this._armature = e, this._animationConfig = t.BaseObject.borrowObject(t.AnimationConfig))
- }, i.prototype.advanceTime = function(t) {
- t < 0 && (t = -t), this._armature.inheritAnimation && null !== this._armature._parent ? this._inheritTimeScale = this._armature._parent._armature.animation._inheritTimeScale * this.timeScale : this._inheritTimeScale = this.timeScale, 1 !== this._inheritTimeScale && (t *= this._inheritTimeScale);
- var e = this._animationStates.length;
- if (1 === e)
- if ((d = this._animationStates[0])._fadeState > 0 && d._subFadeState > 0) this._armature._dragonBones.bufferObject(d), this._animationStates.length = 0, this._lastAnimationState = null;
- else {
- var i = d._animationData,
- n = i.cacheFrameRate;
- if (this._animationDirty && n > 0) {
- this._animationDirty = !1;
- for (var r = 0, s = this._armature.getBones(); r < s.length; r++) {
- var o = s[r];
- o._cachedFrameIndices = i.getBoneCachedFrameIndices(o.name)
- }
- for (var a = 0, l = this._armature.getSlots(); a < l.length; a++) {
- var h = l[a],
- c = h.rawDisplayDatas;
- if (null !== c && c.length > 0) {
- var u = c[0];
- if (null !== u && u.parent === this._armature.armatureData.defaultSkin) {
- h._cachedFrameIndices = i.getSlotCachedFrameIndices(h.name);
- continue
- }
- }
- h._cachedFrameIndices = null
- }
- }
- d.advanceTime(t, n)
- }
- else if (e > 1) {
- for (var _ = 0, f = 0; _ < e; ++_) {
- var d;
- (d = this._animationStates[_])._fadeState > 0 && d._subFadeState > 0 ? (f++, this._armature._dragonBones.bufferObject(d), this._animationDirty = !0, this._lastAnimationState === d && (this._lastAnimationState = null)) : (f > 0 && (this._animationStates[_ - f] = d), d.advanceTime(t, 0)), _ === e - 1 && f > 0 && (this._animationStates.length -= f, null === this._lastAnimationState && this._animationStates.length > 0 && (this._lastAnimationState = this._animationStates[this._animationStates.length - 1]))
- }
- this._armature._cacheFrameIndex = -1
- } else this._armature._cacheFrameIndex = -1
- }, i.prototype.reset = function() {
- for (var t = 0, e = this._animationStates; t < e.length; t++) {
- e[t].returnToPool()
- }
- this._animationDirty = !1, this._animationConfig.clear(), this._animationStates.length = 0, this._lastAnimationState = null
- }, i.prototype.stop = function(t) {
- if (void 0 === t && (t = null), null !== t) null !== (n = this.getState(t)) && n.stop();
- else
- for (var e = 0, i = this._animationStates; e < i.length; e++) {
- var n;
- (n = i[e]).stop()
- }
- }, i.prototype.playConfig = function(e) {
- var i = e.animation;
- if (!(i in this._animations)) return console.warn("Non-existent animation.\n", "DragonBones name: " + this._armature.armatureData.parent.name, "Armature name: " + this._armature.name, "Animation name: " + i), null;
- var n = this._animations[i];
- if (5 === e.fadeOutMode)
- for (var r = 0, s = this._animationStates; r < s.length; r++) {
- var o = s[r];
- if (o._animationData === n) return o
- }
- 0 === this._animationStates.length ? e.fadeInTime = 0 : e.fadeInTime < 0 && (e.fadeInTime = n.fadeInTime), e.fadeOutTime < 0 && (e.fadeOutTime = e.fadeInTime), e.timeScale <= -100 && (e.timeScale = 1 / n.scale), n.frameCount > 1 ? (e.position < 0 ? (e.position %= n.duration, e.position = n.duration - e.position) : e.position === n.duration ? e.position -= 1e-6 : e.position > n.duration && (e.position %= n.duration), e.duration > 0 && e.position + e.duration > n.duration && (e.duration = n.duration - e.position), e.playTimes < 0 && (e.playTimes = n.playTimes)) : (e.playTimes = 1, e.position = 0, e.duration > 0 && (e.duration = 0)), 0 === e.duration && (e.duration = -1), this._fadeOut(e);
- var a = t.BaseObject.borrowObject(t.AnimationState);
- if (a.init(this._armature, n, e), this._animationDirty = !0, this._armature._cacheFrameIndex = -1, this._animationStates.length > 0) {
- for (var l = !1, h = 0, c = this._animationStates.length; h < c; ++h) {
- if (a.layer > this._animationStates[h].layer) {
- l = !0, this._animationStates.splice(h, 0, a);
- break
- }
- if (h !== c - 1 && a.layer > this._animationStates[h + 1].layer) {
- l = !0, this._animationStates.splice(h + 1, 0, a);
- break
- }
- }
- l || this._animationStates.push(a)
- } else this._animationStates.push(a);
- for (var u = 0, _ = this._armature.getSlots(); u < _.length; u++) {
- var f = _[u].childArmature;
- null !== f && f.inheritAnimation && f.animation.hasAnimation(i) && null === f.animation.getState(i) && f.animation.fadeIn(i)
- }
- var d = !1;
- for (var p in n.animationTimelines) {
- this._lockUpdate || (d = !0, this._lockUpdate = !0);
- var m = this.fadeIn(p, e.fadeInTime, 1, a.layer, null, 0);
- null !== m && (m.resetToPose = !1, m._parent = a, m.stop())
- }
- return d && (this._lockUpdate = !1), this._lockUpdate || (e.fadeInTime <= 0 && this._armature.advanceTime(0), this._lastAnimationState = a), a
- }, i.prototype.play = function(t, e) {
- if (void 0 === t && (t = null), void 0 === e && (e = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = e, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = null !== t ? t : "", null !== t && t.length > 0) this.playConfig(this._animationConfig);
- else if (null === this._lastAnimationState) {
- var i = this._armature.armatureData.defaultAnimation;
- null !== i && (this._animationConfig.animation = i.name, this.playConfig(this._animationConfig))
- } else this._lastAnimationState.isPlaying || this._lastAnimationState.isCompleted ? (this._animationConfig.animation = this._lastAnimationState.name, this.playConfig(this._animationConfig)) : this._lastAnimationState.play();
- return this._lastAnimationState
- }, i.prototype.fadeIn = function(t, e, i, n, r, s) {
- return void 0 === e && (e = -1), void 0 === i && (i = -1), void 0 === n && (n = 0), void 0 === r && (r = null), void 0 === s && (s = 3), this._animationConfig.clear(), this._animationConfig.fadeOutMode = s, this._animationConfig.playTimes = i, this._animationConfig.layer = n, this._animationConfig.fadeInTime = e, this._animationConfig.animation = t, this._animationConfig.group = null !== r ? r : "", this.playConfig(this._animationConfig)
- }, i.prototype.gotoAndPlayByTime = function(t, e, i) {
- return void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.position = e, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t, this.playConfig(this._animationConfig)
- }, i.prototype.gotoAndPlayByFrame = function(t, e, i) {
- void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t;
- var n = t in this._animations ? this._animations[t] : null;
- return null !== n && (this._animationConfig.position = n.duration * e / n.frameCount), this.playConfig(this._animationConfig)
- }, i.prototype.gotoAndPlayByProgress = function(t, e, i) {
- void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t;
- var n = t in this._animations ? this._animations[t] : null;
- return null !== n && (this._animationConfig.position = n.duration * (e > 0 ? e : 0)), this.playConfig(this._animationConfig)
- }, i.prototype.gotoAndStopByTime = function(t, e) {
- void 0 === e && (e = 0);
- var i = this.gotoAndPlayByTime(t, e, 1);
- return null !== i && i.stop(), i
- }, i.prototype.gotoAndStopByFrame = function(t, e) {
- void 0 === e && (e = 0);
- var i = this.gotoAndPlayByFrame(t, e, 1);
- return null !== i && i.stop(), i
- }, i.prototype.gotoAndStopByProgress = function(t, e) {
- void 0 === e && (e = 0);
- var i = this.gotoAndPlayByProgress(t, e, 1);
- return null !== i && i.stop(), i
- }, i.prototype.getState = function(t) {
- for (var e = this._animationStates.length; e--;) {
- var i = this._animationStates[e];
- if (i.name === t) return i
- }
- return null
- }, i.prototype.hasAnimation = function(t) {
- return t in this._animations
- }, i.prototype.getStates = function() {
- return this._animationStates
- }, Object.defineProperty(i.prototype, "isPlaying", {
- get: function() {
- for (var t = 0, e = this._animationStates; t < e.length; t++) {
- if (e[t].isPlaying) return !0
- }
- return !1
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "isCompleted", {
- get: function() {
- for (var t = 0, e = this._animationStates; t < e.length; t++) {
- if (!e[t].isCompleted) return !1
- }
- return this._animationStates.length > 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "lastAnimationName", {
- get: function() {
- return null !== this._lastAnimationState ? this._lastAnimationState.name : ""
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "animationNames", {
- get: function() {
- return this._animationNames
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "animations", {
- get: function() {
- return this._animations
- },
- set: function(t) {
- if (this._animations !== t) {
- for (var e in this._animationNames.length = 0, this._animations) delete this._animations[e];
- for (var e in t) this._animationNames.push(e), this._animations[e] = t[e]
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "animationConfig", {
- get: function() {
- return this._animationConfig.clear(), this._animationConfig
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "lastAnimationState", {
- get: function() {
- return this._lastAnimationState
- },
- enumerable: !0,
- configurable: !0
- }), i.prototype.gotoAndPlay = function(t, e, i, n, r, s, o, a, l) {
- void 0 === e && (e = -1), void 0 === i && (i = -1), void 0 === n && (n = -1), void 0 === r && (r = 0), void 0 === s && (s = null), void 0 === o && (o = 3), void 0 === a && (a = !0), void 0 === l && (l = !0), console.warn("Deprecated."), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.fadeOutMode = o, this._animationConfig.playTimes = n, this._animationConfig.layer = r, this._animationConfig.fadeInTime = e, this._animationConfig.animation = t, this._animationConfig.group = null !== s ? s : "";
- var h = this._animations[t];
- return h && i > 0 && (this._animationConfig.timeScale = h.duration / i), this.playConfig(this._animationConfig)
- }, i.prototype.gotoAndStop = function(t, e) {
- return void 0 === e && (e = 0), console.warn("Deprecated."), this.gotoAndStopByTime(t, e)
- }, Object.defineProperty(i.prototype, "animationList", {
- get: function() {
- return console.warn("Deprecated."), this._animationNames
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(i.prototype, "animationDataList", {
- get: function() {
- console.warn("Deprecated.");
- for (var t = [], e = 0, i = this._animationNames.length; e < i; ++e) t.push(this._animations[this._animationNames[e]]);
- return t
- },
- enumerable: !0,
- configurable: !0
- }), i
- })(t.BaseObject);
- t.Animation = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function s() {
- var t = null !== e && e.apply(this, arguments) || this;
- return t._blendState = new r, t._boneMask = [], t._boneTimelines = [], t._surfaceTimelines = [], t._slotTimelines = [], t._constraintTimelines = [], t._animationTimelines = [], t._poseTimelines = [], t._bonePoses = {}, t._actionTimeline = null, t._zOrderTimeline = null, t._parent = null, t
- }
- return n(s, e), s.toString = function() {
- return "[class dragonBones.AnimationState]"
- }, s.prototype._onClear = function() {
- for (var t = 0, e = this._boneTimelines; t < e.length; t++) {
- e[t].returnToPool()
- }
- for (var i = 0, n = this._surfaceTimelines; i < n.length; i++) {
- n[i].returnToPool()
- }
- for (var r = 0, s = this._slotTimelines; r < s.length; r++) {
- s[r].returnToPool()
- }
- for (var o = 0, a = this._constraintTimelines; o < a.length; o++) {
- a[o].returnToPool()
- }
- for (var l = 0, h = this._animationTimelines; l < h.length; l++) {
- h[l].returnToPool()
- }
- for (var c in this._bonePoses) this._bonePoses[c].returnToPool(), delete this._bonePoses[c];
- null !== this._actionTimeline && this._actionTimeline.returnToPool(), null !== this._zOrderTimeline && this._zOrderTimeline.returnToPool(), this.actionEnabled = !1, this.additiveBlending = !1, this.displayControl = !1, this.resetToPose = !1, this.playTimes = 1, this.layer = 0, this.timeScale = 1, this.weight = 1, this.autoFadeOutTime = 0, this.fadeTotalTime = 0, this.name = "", this.group = "", this._timelineDirty = 2, this._playheadState = 0, this._fadeState = -1, this._subFadeState = -1, this._position = 0, this._duration = 0, this._fadeTime = 0, this._time = 0, this._fadeProgress = 0, this._weightResult = 0, this._blendState.clear(), this._boneMask.length = 0, this._boneTimelines.length = 0, this._surfaceTimelines.length = 0, this._slotTimelines.length = 0, this._constraintTimelines.length = 0, this._animationTimelines.length = 0, this._poseTimelines.length = 0, this._animationData = null, this._armature = null, this._actionTimeline = null, this._zOrderTimeline = null, this._parent = null
- }, s.prototype._updateTimelines = function() {
- for (var e = 0, i = this._armature._constraints; e < i.length; e++) {
- var n = i[e];
- if (null !== (l = this._animationData.getConstraintTimelines(n.name)))
- for (var r = 0, s = l; r < s.length; r++) {
- switch ((_ = s[r]).type) {
- case 30:
- (f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, f.init(this._armature, this, _), this._constraintTimelines.push(f)
- }
- } else if (this.resetToPose) {
- (f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, f.init(this._armature, this, null), this._constraintTimelines.push(f), this._poseTimelines.push(f)
- }
- }
- for (var o = 0, a = this._armature.animation.getStates(); o < a.length; o++) {
- var l, h = a[o];
- if (h._parent === this)
- if (null !== (l = this._animationData.getAnimationTimelines(h.name)))
- for (var c = 0, u = l; c < u.length; c++) {
- var _;
- switch ((_ = u[c]).type) {
- case 40:
- var f;
- (f = t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState = h, f.init(this._armature, this, _), this._animationTimelines.push(f)
- }
- }
- }
- }, s.prototype._updateBoneAndSlotTimelines = function() {
- for (var e = {}, n = 0, r = this._boneTimelines; n < r.length; n++) {
- (l = (v = r[n]).bone.name) in e || (e[l] = []), e[l].push(v)
- }
- for (var s = 0, o = this._armature.getBones(); s < o.length; s++) {
- var a = o[s],
- l = a.name;
- if (this.containsBoneMask(l))
- if (l in e) delete e[l];
- else if (0 === a._boneData.type) {
- var h = this._animationData.getBoneTimelines(l),
- c = l in this._bonePoses ? this._bonePoses[l] : this._bonePoses[l] = t.BaseObject.borrowObject(i);
- if (null !== h)
- for (var u = 0, _ = h; u < _.length; u++) {
- switch ((I = _[u]).type) {
- case 10:
- (v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
- break;
- case 11:
- (v = t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
- break;
- case 12:
- (v = t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
- break;
- case 13:
- (v = t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v)
- }
- } else if (this.resetToPose) {
- (v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, null), this._boneTimelines.push(v), this._poseTimelines.push(v)
- }
- } else if (1 === a._boneData.type) {
- if (null !== (h = this._animationData.getSurfaceTimelines(l)))
- for (var f = 0, d = h; f < d.length; f++) {
- switch ((I = d[f]).type) {
- case 50:
- (v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a, v.init(this._armature, this, I), this._surfaceTimelines.push(v)
- }
- } else if (this.resetToPose) {
- (v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a, v.init(this._armature, this, null), this._surfaceTimelines.push(v), this._poseTimelines.push(v)
- }
- }
- }
- for (var p in e)
- for (var m = 0, y = e[p]; m < y.length; m++) {
- var v = y[m];
- this._boneTimelines.splice(this._boneTimelines.indexOf(v), 1), v.returnToPool()
- }
- for (var g = {}, x = [], b = 0, A = this._slotTimelines; b < A.length; b++) {
- (l = (v = A[b]).slot.name) in g || (g[l] = []), g[l].push(v)
- }
- for (var C = 0, T = this._armature.getSlots(); C < T.length; C++) {
- var S = T[C],
- w = S.parent.name;
- if (this.containsBoneMask(w)) {
- l = S.name, h = this._animationData.getSlotTimelines(l);
- if (l in g) delete g[l];
- else {
- var E = !1,
- M = !1;
- if (x.length = 0, null !== h)
- for (var D = 0, B = h; D < B.length; D++) {
- var I;
- switch ((I = B[D]).type) {
- case 20:
- (v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), E = !0;
- break;
- case 21:
- (v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), M = !0;
- break;
- case 22:
- (v = t.BaseObject.borrowObject(t.DeformTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), x.push(v.vertexOffset)
- }
- }
- if (this.resetToPose) {
- if (!E)(v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v);
- if (!M)(v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v);
- if (null !== S.rawDisplayDatas)
- for (var P = 0, R = S.rawDisplayDatas; P < R.length; P++) {
- var O = R[P];
- if (null !== O && 2 === O.type) {
- var L = O.vertices.offset;
- if (x.indexOf(L) < 0)(v = t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset = L, v.slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v)
- }
- }
- }
- }
- }
- }
- for (var p in g)
- for (var F = 0, N = g[p]; F < N.length; F++) {
- v = N[F];
- this._slotTimelines.splice(this._slotTimelines.indexOf(v), 1), v.returnToPool()
- }
- }, s.prototype._advanceFadeTime = function(e) {
- var i = this._fadeState > 0;
- if (this._subFadeState < 0) {
- this._subFadeState = 0;
- var n = i ? t.EventObject.FADE_OUT : t.EventObject.FADE_IN;
- if (this._armature.eventDispatcher.hasDBEventListener(n))(r = t.BaseObject.borrowObject(t.EventObject)).type = n, r.armature = this._armature, r.animationState = this, this._armature._dragonBones.bufferEvent(r)
- }
- if (e < 0 && (e = -e), this._fadeTime += e, this._fadeTime >= this.fadeTotalTime ? (this._subFadeState = 1, this._fadeProgress = i ? 0 : 1) : this._fadeTime > 0 ? this._fadeProgress = i ? 1 - this._fadeTime / this.fadeTotalTime : this._fadeTime / this.fadeTotalTime : this._fadeProgress = i ? 1 : 0, this._subFadeState > 0) {
- i || (this._playheadState |= 1, this._fadeState = 0);
- var r;
- n = i ? t.EventObject.FADE_OUT_COMPLETE : t.EventObject.FADE_IN_COMPLETE;
- if (this._armature.eventDispatcher.hasDBEventListener(n))(r = t.BaseObject.borrowObject(t.EventObject)).type = n, r.armature = this._armature, r.animationState = this, this._armature._dragonBones.bufferEvent(r)
- }
- }, s.prototype.init = function(e, i, n) {
- if (null === this._armature) {
- if (this._armature = e, this._animationData = i, this.resetToPose = n.resetToPose, this.additiveBlending = n.additiveBlending, this.displayControl = n.displayControl, this.actionEnabled = n.actionEnabled, this.layer = n.layer, this.playTimes = n.playTimes, this.timeScale = n.timeScale, this.fadeTotalTime = n.fadeInTime, this.autoFadeOutTime = n.autoFadeOutTime, this.weight = n.weight, this.name = n.name.length > 0 ? n.name : n.animation, this.group = n.group, n.pauseFadeIn ? this._playheadState = 2 : this._playheadState = 3, n.duration < 0 ? (this._position = 0, this._duration = this._animationData.duration, 0 !== n.position ? this.timeScale >= 0 ? this._time = n.position : this._time = n.position - this._duration : this._time = 0) : (this._position = n.position, this._duration = n.duration, this._time = 0), this.timeScale < 0 && 0 === this._time && (this._time = -1e-6), this.fadeTotalTime <= 0 && (this._fadeProgress = .999999), n.boneMask.length > 0) {
- this._boneMask.length = n.boneMask.length;
- for (var r = 0, s = this._boneMask.length; r < s; ++r) this._boneMask[r] = n.boneMask[r]
- }
- this._actionTimeline = t.BaseObject.borrowObject(t.ActionTimelineState), this._actionTimeline.init(this._armature, this, this._animationData.actionTimeline), this._actionTimeline.currentTime = this._time, this._actionTimeline.currentTime < 0 && (this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime), null !== this._animationData.zOrderTimeline && (this._zOrderTimeline = t.BaseObject.borrowObject(t.ZOrderTimelineState), this._zOrderTimeline.init(this._armature, this, this._animationData.zOrderTimeline))
- }
- }, s.prototype.advanceTime = function(e, i) {
- if (this._blendState.dirty = !1, 0 === this._fadeState && 0 === this._subFadeState || this._advanceFadeTime(e), 3 === this._playheadState && (1 !== this.timeScale && (e *= this.timeScale), this._time += e), 0 !== this._timelineDirty && (2 === this._timelineDirty && this._updateTimelines(), this._timelineDirty = 0, this._updateBoneAndSlotTimelines()), 0 !== this.weight) {
- var n = 0 === this._fadeState && i > 0,
- r = !0,
- s = !0,
- o = this._time;
- if (this._weightResult = this.weight * this._fadeProgress, null !== this._parent && (this._weightResult *= this._parent._weightResult / this._parent._fadeProgress), this._actionTimeline.playState <= 0 && this._actionTimeline.update(o), n) {
- var a = 2 * i;
- this._actionTimeline.currentTime = Math.floor(this._actionTimeline.currentTime * a) / a
- }
- if (null !== this._zOrderTimeline && this._zOrderTimeline.playState <= 0 && this._zOrderTimeline.update(o), n) {
- var l = Math.floor(this._actionTimeline.currentTime * i);
- this._armature._cacheFrameIndex === l ? (r = !1, s = !1) : (this._armature._cacheFrameIndex = l, this._animationData.cachedFrames[l] ? s = !1 : this._animationData.cachedFrames[l] = !0)
- }
- if (r) {
- if (s)
- for (var h = 0, c = this._boneTimelines.length; h < c; ++h) {
- if ((p = this._boneTimelines[h]).playState <= 0 && p.update(o), h === c - 1 || p.bone !== this._boneTimelines[h + 1].bone) 0 !== (u = p.bone._blendState.update(this._weightResult, this.layer)) && p.blend(u)
- }
- for (h = 0, c = this._surfaceTimelines.length; h < c; ++h) {
- var u = (p = this._surfaceTimelines[h]).surface._blendState.update(this._weightResult, this.layer);
- p.playState <= 0 && p.update(o), 0 !== u && p.blend(u)
- }
- if (this.displayControl)
- for (h = 0, c = this._slotTimelines.length; h < c; ++h) {
- var _ = (p = this._slotTimelines[h]).slot.displayController;
- null !== _ && _ !== this.name && _ !== this.group || p.playState <= 0 && p.update(o)
- }
- for (h = 0, c = this._constraintTimelines.length; h < c; ++h) {
- (p = this._constraintTimelines[h]).playState <= 0 && p.update(o)
- }
- for (h = 0, c = this._animationTimelines.length; h < c; ++h) {
- u = (p = this._animationTimelines[h]).animationState._blendState.update(this._weightResult, this.layer);
- p.playState <= 0 && p.update(o), 0 !== u && p.blend(u)
- }
- }
- if (0 === this._fadeState) {
- if (this._subFadeState > 0 && (this._subFadeState = 0, this._poseTimelines.length > 0)) {
- for (var f = 0, d = this._poseTimelines; f < d.length; f++) {
- var p;
- (p = d[f]) instanceof t.BoneTimelineState ? this._boneTimelines.splice(this._boneTimelines.indexOf(p), 1) : p instanceof t.SurfaceTimelineState ? this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p), 1) : p instanceof t.SlotTimelineState ? this._slotTimelines.splice(this._slotTimelines.indexOf(p), 1) : p instanceof t.ConstraintTimelineState && this._constraintTimelines.splice(this._constraintTimelines.indexOf(p), 1), p.returnToPool()
- }
- this._poseTimelines.length = 0
- }
- this._actionTimeline.playState > 0 && this.autoFadeOutTime >= 0 && this.fadeOut(this.autoFadeOutTime)
- }
- }
- }, s.prototype.play = function() {
- this._playheadState = 3
- }, s.prototype.stop = function() {
- this._playheadState &= 1
- }, s.prototype.fadeOut = function(t, e) {
- if (void 0 === e && (e = !0), t < 0 && (t = 0), e && (this._playheadState &= 2), this._fadeState > 0) {
- if (t > this.fadeTotalTime - this._fadeTime) return
- } else {
- this._fadeState = 1, this._subFadeState = -1, (t <= 0 || this._fadeProgress <= 0) && (this._fadeProgress = 1e-6);
- for (var i = 0, n = this._boneTimelines; i < n.length; i++) {
- (_ = n[i]).fadeOut()
- }
- for (var r = 0, s = this._surfaceTimelines; r < s.length; r++) {
- (_ = s[r]).fadeOut()
- }
- for (var o = 0, a = this._slotTimelines; o < a.length; o++) {
- (_ = a[o]).fadeOut()
- }
- for (var l = 0, h = this._constraintTimelines; l < h.length; l++) {
- (_ = h[l]).fadeOut()
- }
- for (var c = 0, u = this._animationTimelines; c < u.length; c++) {
- var _;
- (_ = u[c]).animationState.fadeOut(t, e), _.fadeOut()
- }
- }
- this.displayControl = !1, this.fadeTotalTime = this._fadeProgress > 1e-6 ? t / this._fadeProgress : 0, this._fadeTime = this.fadeTotalTime * (1 - this._fadeProgress)
- }, s.prototype.containsBoneMask = function(t) {
- return 0 === this._boneMask.length || this._boneMask.indexOf(t) >= 0
- }, s.prototype.addBoneMask = function(t, e) {
- void 0 === e && (e = !0);
- var i = this._armature.getBone(t);
- if (null !== i) {
- if (this._boneMask.indexOf(t) < 0 && this._boneMask.push(t), e)
- for (var n = 0, r = this._armature.getBones(); n < r.length; n++) {
- var s = r[n];
- this._boneMask.indexOf(s.name) < 0 && i.contains(s) && this._boneMask.push(s.name)
- }
- this._timelineDirty = 1
- }
- }, s.prototype.removeBoneMask = function(t, e) {
- void 0 === e && (e = !0);
- var i = this._boneMask.indexOf(t);
- if (i >= 0 && this._boneMask.splice(i, 1), e) {
- var n = this._armature.getBone(t);
- if (null !== n) {
- var r = this._armature.getBones();
- if (this._boneMask.length > 0)
- for (var s = 0, o = r; s < o.length; s++) {
- var a = o[s],
- l = this._boneMask.indexOf(a.name);
- l >= 0 && n.contains(a) && this._boneMask.splice(l, 1)
- } else
- for (var h = 0, c = r; h < c.length; h++) {
- (a = c[h]) !== n && (n.contains(a) || this._boneMask.push(a.name))
- }
- }
- }
- this._timelineDirty = 1
- }, s.prototype.removeAllBoneMask = function() {
- this._boneMask.length = 0, this._timelineDirty = 1
- }, Object.defineProperty(s.prototype, "isFadeIn", {
- get: function() {
- return this._fadeState < 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "isFadeOut", {
- get: function() {
- return this._fadeState > 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "isFadeComplete", {
- get: function() {
- return 0 === this._fadeState
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "isPlaying", {
- get: function() {
- return 0 != (2 & this._playheadState) && this._actionTimeline.playState <= 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "isCompleted", {
- get: function() {
- return this._actionTimeline.playState > 0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "currentPlayTimes", {
- get: function() {
- return this._actionTimeline.currentPlayTimes
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "totalTime", {
- get: function() {
- return this._duration
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "currentTime", {
- get: function() {
- return this._actionTimeline.currentTime
- },
- set: function(t) {
- var e = this._actionTimeline.currentPlayTimes - (this._actionTimeline.playState > 0 ? 1 : 0);
- if ((t < 0 || this._duration < t) && (t = t % this._duration + e * this._duration) < 0 && (t += this._duration), this.playTimes > 0 && e === this.playTimes - 1 && t === this._duration && (t = this._duration - 1e-6), this._time !== t) {
- this._time = t, this._actionTimeline.setCurrentTime(this._time), null !== this._zOrderTimeline && (this._zOrderTimeline.playState = -1);
- for (var i = 0, n = this._boneTimelines; i < n.length; i++) {
- n[i].playState = -1
- }
- for (var r = 0, s = this._slotTimelines; r < s.length; r++) {
- s[r].playState = -1
- }
- }
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(s.prototype, "animationData", {
- get: function() {
- return this._animationData
- },
- enumerable: !0,
- configurable: !0
- }), s
- })(t.BaseObject);
- t.AnimationState = e;
- var i = (function(e) {
- function i() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i.current = new t.Transform, i.delta = new t.Transform, i.result = new t.Transform, i
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.BonePose]"
- }, i.prototype._onClear = function() {
- this.current.identity(), this.delta.identity(), this.result.identity()
- }, i
- })(t.BaseObject);
- t.BonePose = i;
- var r = (function() {
- function t() {}
- return t.prototype.update = function(t, e) {
- if (this.dirty) {
- if (!(this.leftWeight > 0)) return 0;
- if (this.layer !== e) {
- if (this.layerWeight >= this.leftWeight) return this.leftWeight = 0, 0;
- this.layer = e, this.leftWeight -= this.layerWeight, this.layerWeight = 0
- }
- return t *= this.leftWeight, this.layerWeight += t, this.blendWeight = t, 2
- }
- return this.dirty = !0, this.layer = e, this.layerWeight = t, this.leftWeight = 1, this.blendWeight = t, 1
- }, t.prototype.clear = function() {
- this.dirty = !1, this.layer = 0, this.leftWeight = 0, this.layerWeight = 0, this.blendWeight = 0
- }, t
- })();
- t.BlendState = r
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- this.playState = -1, this.currentPlayTimes = -1, this.currentTime = -1, this._tweenState = 0, this._frameRate = 0, this._frameValueOffset = 0, this._frameCount = 0, this._frameOffset = 0, this._frameIndex = -1, this._frameRateR = 0, this._position = 0, this._duration = 0, this._timeScale = 1, this._timeOffset = 0, this._dragonBonesData = null, this._animationData = null, this._timelineData = null, this._armature = null, this._animationState = null, this._actionTimeline = null, this._frameArray = null, this._frameIntArray = null, this._frameFloatArray = null, this._timelineArray = null, this._frameIndices = null
- }, e.prototype._setCurrentTime = function(t) {
- var e = this.playState,
- i = this.currentPlayTimes,
- n = this.currentTime;
- if (null !== this._actionTimeline && this._frameCount <= 1) this.playState = this._actionTimeline.playState >= 0 ? 1 : -1, this.currentPlayTimes = 1, this.currentTime = this._actionTimeline.currentTime;
- else if (null === this._actionTimeline || 1 !== this._timeScale || 0 !== this._timeOffset) {
- var r = this._animationState.playTimes,
- s = r * this._duration;
- t *= this._timeScale, 0 !== this._timeOffset && (t += this._timeOffset * this._animationData.duration), r > 0 && (t >= s || t <= -s) ? (this.playState <= 0 && 3 === this._animationState._playheadState && (this.playState = 1), this.currentPlayTimes = r, this.currentTime = t < 0 ? 0 : this._duration + 1e-6) : (0 !== this.playState && 3 === this._animationState._playheadState && (this.playState = 0), t < 0 ? (t = -t, this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = this._duration - t % this._duration) : (this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = t % this._duration)), this.currentTime += this._position
- } else this.playState = this._actionTimeline.playState, this.currentPlayTimes = this._actionTimeline.currentPlayTimes, this.currentTime = this._actionTimeline.currentTime;
- return (this.currentPlayTimes !== i || this.currentTime !== n) && ((e < 0 && this.playState !== e || this.playState <= 0 && this.currentPlayTimes !== i) && (this._frameIndex = -1), !0)
- }, e.prototype.init = function(t, e, i) {
- this._armature = t, this._animationState = e, this._timelineData = i, this._actionTimeline = this._animationState._actionTimeline, this === this._actionTimeline && (this._actionTimeline = null), this._animationData = this._animationState._animationData, this._frameRate = this._animationData.parent.frameRate, this._frameRateR = 1 / this._frameRate, this._position = this._animationState._position, this._duration = this._animationState._duration, this._dragonBonesData = this._animationData.parent.parent, null !== this._timelineData && (this._frameIntArray = this._dragonBonesData.frameIntArray, this._frameFloatArray = this._dragonBonesData.frameFloatArray, this._frameArray = this._dragonBonesData.frameArray, this._timelineArray = this._dragonBonesData.timelineArray, this._frameIndices = this._dragonBonesData.frameIndices, this._frameCount = this._timelineArray[this._timelineData.offset + 2], this._frameValueOffset = this._timelineArray[this._timelineData.offset + 4], this._timeScale = 100 / this._timelineArray[this._timelineData.offset + 0], this._timeOffset = .01 * this._timelineArray[this._timelineData.offset + 1])
- }, e.prototype.fadeOut = function() {}, e.prototype.update = function(t) {
- if (this._setCurrentTime(t)) {
- if (this._frameCount > 1) {
- var e = Math.floor(this.currentTime * this._frameRate),
- i = this._frameIndices[this._timelineData.frameIndicesOffset + e];
- this._frameIndex !== i && (this._frameIndex = i, this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex], this._onArriveAtFrame())
- } else this._frameIndex < 0 && (this._frameIndex = 0, null !== this._timelineData && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5]), this._onArriveAtFrame());
- 0 !== this._tweenState && this._onUpdateFrame()
- }
- }, e
- })(t.BaseObject);
- t.TimelineState = e;
- var i = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e._getEasingValue = function(t, e, i) {
- var n = e;
- switch (t) {
- case 3:
- n = Math.pow(e, 2);
- break;
- case 4:
- n = 1 - Math.pow(1 - e, 2);
- break;
- case 5:
- n = .5 * (1 - Math.cos(e * Math.PI))
- }
- return (n - e) * i + e
- }, e._getEasingCurveValue = function(t, e, i, n) {
- if (t <= 0) return 0;
- if (t >= 1) return 1;
- var r = i + 1,
- s = Math.floor(t * r),
- o = 0 === s ? 0 : e[n + s - 1];
- return 1e-4 * (o + ((s === r - 1 ? 1e4 : e[n + s]) - o) * (t * r - s))
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this._tweenType = 0, this._curveCount = 0, this._framePosition = 0, this._frameDurationR = 0, this._tweenProgress = 0, this._tweenEasing = 0
- }, e.prototype._onArriveAtFrame = function() {
- if (this._frameCount > 1 && (this._frameIndex !== this._frameCount - 1 || 0 === this._animationState.playTimes || this._animationState.currentPlayTimes < this._animationState.playTimes - 1))
- if (this._tweenType = this._frameArray[this._frameOffset + 1], this._tweenState = 0 === this._tweenType ? 1 : 2, 2 === this._tweenType ? this._curveCount = this._frameArray[this._frameOffset + 2] : 0 !== this._tweenType && 1 !== this._tweenType && (this._tweenEasing = .01 * this._frameArray[this._frameOffset + 2]), this._framePosition = this._frameArray[this._frameOffset] * this._frameRateR, this._frameIndex === this._frameCount - 1) this._frameDurationR = 1 / (this._animationData.duration - this._framePosition);
- else {
- var t = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex + 1],
- e = this._frameArray[t] * this._frameRateR - this._framePosition;
- this._frameDurationR = e > 0 ? 1 / e : 0
- }
- else this._tweenState = 1
- }, e.prototype._onUpdateFrame = function() {
- 2 === this._tweenState ? (this._tweenProgress = (this.currentTime - this._framePosition) * this._frameDurationR, 2 === this._tweenType ? this._tweenProgress = e._getEasingCurveValue(this._tweenProgress, this._frameArray, this._curveCount, this._frameOffset + 3) : 1 !== this._tweenType && (this._tweenProgress = e._getEasingValue(this._tweenType, this._tweenProgress, this._tweenEasing))) : this._tweenProgress = 0
- }, e
- })(e);
- t.TweenTimelineState = i;
- var r = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.bone = null, this.bonePose = null
- }, e.prototype.blend = function(t) {
- var e = this.bone._blendState.blendWeight,
- i = this.bone.animationPose,
- n = this.bonePose.result;
- 2 === t ? (i.x += n.x * e, i.y += n.y * e, i.rotation += n.rotation * e, i.skew += n.skew * e, i.scaleX += (n.scaleX - 1) * e, i.scaleY += (n.scaleY - 1) * e) : 1 !== e ? (i.x = n.x * e, i.y = n.y * e, i.rotation = n.rotation * e, i.skew = n.skew * e, i.scaleX = (n.scaleX - 1) * e + 1, i.scaleY = (n.scaleY - 1) * e + 1) : (i.x = n.x, i.y = n.y, i.rotation = n.rotation, i.skew = n.skew, i.scaleX = n.scaleX, i.scaleY = n.scaleY), 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.bone._transformDirty = !0)
- }, e
- })(i);
- t.BoneTimelineState = r;
- var s = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.slot = null
- }, e
- })(i);
- t.SlotTimelineState = s;
- var o = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.constraint = null
- }, e
- })(i);
- t.ConstraintTimelineState = o
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.ActionTimelineState]"
- }, i.prototype._onCrossFrame = function(e) {
- var i = this._armature.eventDispatcher;
- if (this._animationState.actionEnabled)
- for (var n = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + e], r = this._frameArray[n + 1], s = this._animationData.parent.actions, o = 0; o < r; ++o) {
- var a = s[this._frameArray[n + 2 + o]];
- if (0 === a.type) {
- (l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, l.animationState = this._animationState, t.EventObject.actionDataToInstance(a, l, this._armature), this._armature._bufferAction(l, !0)
- } else {
- var l, h = 10 === a.type ? t.EventObject.FRAME_EVENT : t.EventObject.SOUND_EVENT;
- if (11 === a.type || i.hasDBEventListener(h))(l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, l.animationState = this._animationState, t.EventObject.actionDataToInstance(a, l, this._armature), this._armature._dragonBones.bufferEvent(l)
- }
- }
- }, i.prototype._onArriveAtFrame = function() {}, i.prototype._onUpdateFrame = function() {}, i.prototype.update = function(e) {
- var i = this.playState,
- n = this.currentPlayTimes,
- r = this.currentTime;
- if (this._setCurrentTime(e)) {
- var s = this._armature.eventDispatcher;
- if (i < 0) {
- if (this.playState === i) return;
- if (this._animationState.displayControl && this._animationState.resetToPose && this._armature._sortZOrder(null, 0), n = this.currentPlayTimes, s.hasDBEventListener(t.EventObject.START)) {
- var o = t.BaseObject.borrowObject(t.EventObject);
- o.type = t.EventObject.START, o.armature = this._armature, o.animationState = this._animationState, this._armature._dragonBones.bufferEvent(o)
- }
- }
- var a = this._animationState.timeScale < 0,
- l = null,
- h = null;
- if (this.currentPlayTimes !== n && (s.hasDBEventListener(t.EventObject.LOOP_COMPLETE) && ((l = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.LOOP_COMPLETE, l.armature = this._armature, l.animationState = this._animationState), this.playState > 0 && s.hasDBEventListener(t.EventObject.COMPLETE) && ((h = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.COMPLETE, h.armature = this._armature, h.animationState = this._animationState)), this._frameCount > 1) {
- var c = this._timelineData,
- u = Math.floor(this.currentTime * this._frameRate),
- _ = this._frameIndices[c.frameIndicesOffset + u];
- if (this._frameIndex !== _) {
- var f = this._frameIndex;
- if (this._frameIndex = _, null !== this._timelineArray)
- if (this._frameOffset = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + this._frameIndex], a) {
- if (f < 0) {
- var d = Math.floor(r * this._frameRate);
- f = this._frameIndices[c.frameIndicesOffset + d], this.currentPlayTimes === n && f === _ && (f = -1)
- }
- for (; f >= 0;) {
- var p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f],
- m = this._frameArray[p] / this._frameRate;
- if (this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), l = null), f > 0 ? f-- : f = this._frameCount - 1, f === _) break
- }
- } else {
- if (f < 0) {
- d = Math.floor(r * this._frameRate);
- f = this._frameIndices[c.frameIndicesOffset + d];
- p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], m = this._frameArray[p] / this._frameRate;
- this.currentPlayTimes === n && (r <= m ? f > 0 ? f-- : f = this._frameCount - 1 : f === _ && (f = -1))
- }
- for (; f >= 0;) {
- f < this._frameCount - 1 ? f++ : f = 0;
- p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], m = this._frameArray[p] / this._frameRate;
- if (this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), l = null), f === _) break
- }
- }
- }
- } else if (this._frameIndex < 0 && (this._frameIndex = 0, null !== this._timelineData)) {
- this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5];
- m = this._frameArray[this._frameOffset] / this._frameRate;
- this.currentPlayTimes === n ? r <= m && this._onCrossFrame(this._frameIndex) : this._position <= m && (a || null === l || (this._armature._dragonBones.bufferEvent(l), l = null), this._onCrossFrame(this._frameIndex))
- }
- null !== l && this._armature._dragonBones.bufferEvent(l), null !== h && this._armature._dragonBones.bufferEvent(h)
- }
- }, i.prototype.setCurrentTime = function(t) {
- this._setCurrentTime(t), this._frameIndex = -1
- }, i
- })(t.TimelineState);
- t.ActionTimelineState = e;
- var i = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.ZOrderTimelineState]"
- }, e.prototype._onArriveAtFrame = function() {
- this.playState >= 0 && (this._frameArray[this._frameOffset + 1] > 0 ? this._armature._sortZOrder(this._frameArray, this._frameOffset + 2) : this._armature._sortZOrder(null, 0))
- }, e.prototype._onUpdateFrame = function() {}, e
- })(t.TimelineState);
- t.ZOrderTimelineState = i;
- var r = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.BoneAllTimelineState]"
- }, i.prototype._onArriveAtFrame = function() {
- if (e.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var t = this._animationData.frameFloatOffset + this._frameValueOffset + 6 * this._frameIndex,
- i = this._armature._armatureData.scale,
- n = this._frameFloatArray,
- r = this.bonePose.current,
- s = this.bonePose.delta;
- r.x = n[t++] * i, r.y = n[t++] * i, r.rotation = n[t++], r.skew = n[t++], r.scaleX = n[t++], r.scaleY = n[t++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (t = this._animationData.frameFloatOffset + this._frameValueOffset), s.x = n[t++] * i - r.x, s.y = n[t++] * i - r.y, s.rotation = n[t++] - r.rotation, s.skew = n[t++] - r.skew, s.scaleX = n[t++] - r.scaleX, s.scaleY = n[t++] - r.scaleY) : (s.x = 0, s.y = 0, s.rotation = 0, s.skew = 0, s.scaleX = 0, s.scaleY = 0)
- } else {
- r = this.bonePose.current, s = this.bonePose.delta;
- r.x = 0, r.y = 0, r.rotation = 0, r.skew = 0, r.scaleX = 1, r.scaleY = 1, s.x = 0, s.y = 0, s.rotation = 0, s.skew = 0, s.scaleX = 0, s.scaleY = 0
- }
- }, i.prototype._onUpdateFrame = function() {
- e.prototype._onUpdateFrame.call(this);
- var t = this.bonePose.current,
- i = this.bonePose.delta,
- n = this.bonePose.result;
- this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.x = t.x + i.x * this._tweenProgress, n.y = t.y + i.y * this._tweenProgress, n.rotation = t.rotation + i.rotation * this._tweenProgress, n.skew = t.skew + i.skew * this._tweenProgress, n.scaleX = t.scaleX + i.scaleX * this._tweenProgress, n.scaleY = t.scaleY + i.scaleY * this._tweenProgress
- }, i.prototype.fadeOut = function() {
- var e = this.bonePose.result;
- e.rotation = t.Transform.normalizeRadian(e.rotation), e.skew = t.Transform.normalizeRadian(e.skew)
- }, i
- })(t.BoneTimelineState);
- t.BoneAllTimelineState = r;
- var s = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.BoneTranslateTimelineState]"
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
- i = this._armature._armatureData.scale,
- n = this._frameFloatArray,
- r = this.bonePose.current,
- s = this.bonePose.delta;
- r.x = n[e++] * i, r.y = n[e++] * i, 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), s.x = n[e++] * i - r.x, s.y = n[e++] * i - r.y) : (s.x = 0, s.y = 0)
- } else {
- r = this.bonePose.current, s = this.bonePose.delta;
- r.x = 0, r.y = 0, s.x = 0, s.y = 0
- }
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this);
- var e = this.bonePose.current,
- i = this.bonePose.delta,
- n = this.bonePose.result;
- this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.x = e.x + i.x * this._tweenProgress, n.y = e.y + i.y * this._tweenProgress
- }, e
- })(t.BoneTimelineState);
- t.BoneTranslateTimelineState = s;
- var o = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.toString = function() {
- return "[class dragonBones.BoneRotateTimelineState]"
- }, i.prototype._onArriveAtFrame = function() {
- if (e.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var i = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
- n = this._frameFloatArray,
- r = this.bonePose.current,
- s = this.bonePose.delta;
- r.rotation = n[i++], r.skew = n[i++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 ? (i = this._animationData.frameFloatOffset + this._frameValueOffset, s.rotation = t.Transform.normalizeRadian(n[i++] - r.rotation)) : s.rotation = n[i++] - r.rotation, s.skew = n[i++] - r.skew) : (s.rotation = 0, s.skew = 0)
- } else {
- r = this.bonePose.current, s = this.bonePose.delta;
- r.rotation = 0, r.skew = 0, s.rotation = 0, s.skew = 0
- }
- }, i.prototype._onUpdateFrame = function() {
- e.prototype._onUpdateFrame.call(this);
- var t = this.bonePose.current,
- i = this.bonePose.delta,
- n = this.bonePose.result;
- this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.rotation = t.rotation + i.rotation * this._tweenProgress, n.skew = t.skew + i.skew * this._tweenProgress
- }, i.prototype.fadeOut = function() {
- var e = this.bonePose.result;
- e.rotation = t.Transform.normalizeRadian(e.rotation), e.skew = t.Transform.normalizeRadian(e.skew)
- }, i
- })(t.BoneTimelineState);
- t.BoneRotateTimelineState = o;
- var a = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.BoneScaleTimelineState]"
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
- i = this._frameFloatArray,
- n = this.bonePose.current,
- r = this.bonePose.delta;
- n.scaleX = i[e++], n.scaleY = i[e++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), r.scaleX = i[e++] - n.scaleX, r.scaleY = i[e++] - n.scaleY) : (r.scaleX = 0, r.scaleY = 0)
- } else {
- n = this.bonePose.current, r = this.bonePose.delta;
- n.scaleX = 1, n.scaleY = 1, r.scaleX = 0, r.scaleY = 0
- }
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this);
- var e = this.bonePose.current,
- i = this.bonePose.delta,
- n = this.bonePose.result;
- this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.scaleX = e.scaleX + i.scaleX * this._tweenProgress, n.scaleY = e.scaleY + i.scaleY * this._tweenProgress
- }, e
- })(t.BoneTimelineState);
- t.BoneScaleTimelineState = a;
- var l = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e._current = [], e._delta = [], e._result = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.SurfaceTimelineState]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.surface = null, this._frameFloatOffset = 0, this._valueCount = 0, this._deformCount = 0, this._valueOffset = 0, this._current.length = 0, this._delta.length = 0, this._result.length = 0
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount,
- i = this._armature._armatureData.scale,
- n = this._frameFloatArray;
- if (2 === this._tweenState) {
- var r = e + this._valueCount;
- this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset);
- for (var s = 0; s < this._valueCount; ++s) this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i)
- } else
- for (s = 0; s < this._valueCount; ++s) this._current[s] = n[e + s] * i
- } else
- for (s = 0; s < this._valueCount; ++s) this._current[s] = 0
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this), this.surface._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0);
- for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress
- }, e.prototype.init = function(e, i, n) {
- if (t.prototype.init.call(this, e, i, n), null !== this._timelineData) {
- var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
- this._deformCount = this._frameIntArray[r + 1], this._valueCount = this._frameIntArray[r + 2], this._valueOffset = this._frameIntArray[r + 3], this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset
- } else this._deformCount = this.surface._deformVertices.length, this._valueCount = this._deformCount, this._valueOffset = 0, this._frameFloatOffset = 0;
- this._current.length = this._valueCount, this._delta.length = this._valueCount, this._result.length = this._valueCount;
- for (var s = 0; s < this._valueCount; ++s) this._delta[s] = 0
- }, e.prototype.blend = function(t) {
- for (var e = this.surface._blendState.blendWeight, i = this.surface._deformVertices, n = 0; n < this._deformCount; ++n) {
- var r = 0;
- r = n < this._valueOffset ? this._frameFloatArray[this._frameFloatOffset + n] : n < this._valueOffset + this._valueCount ? this._result[n - this._valueOffset] : this._frameFloatArray[this._frameFloatOffset + n - this._valueCount], 2 === t ? i[n] += r * e : i[n] = 1 !== e ? r * e : r
- }
- 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.surface._transformDirty = !0)
- }, e
- })(t.TweenTimelineState);
- t.SurfaceTimelineState = l;
- var h = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.SlotDislayTimelineState]"
- }, e.prototype._onArriveAtFrame = function() {
- if (this.playState >= 0) {
- var t = null !== this._timelineData ? this._frameArray[this._frameOffset + 1] : this.slot._slotData.displayIndex;
- this.slot.displayIndex !== t && this.slot._setDisplayIndex(t, !0)
- }
- }, e
- })(t.SlotTimelineState);
- t.SlotDislayTimelineState = h;
- var c = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e._current = [0, 0, 0, 0, 0, 0, 0, 0], e._delta = [0, 0, 0, 0, 0, 0, 0, 0], e._result = [0, 0, 0, 0, 0, 0, 0, 0], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.SlotColorTimelineState]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this._dirty = !1
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._dragonBonesData.intArray,
- i = this._frameIntArray,
- n = this._animationData.frameIntOffset + this._frameValueOffset + 1 * this._frameIndex,
- r = i[n];
- r < 0 && (r += 65536), this._current[0] = e[r++], this._current[1] = e[r++], this._current[2] = e[r++], this._current[3] = e[r++], this._current[4] = e[r++], this._current[5] = e[r++], this._current[6] = e[r++], this._current[7] = e[r++], 2 === this._tweenState && ((r = this._frameIndex === this._frameCount - 1 ? i[this._animationData.frameIntOffset + this._frameValueOffset] : i[n + 1]) < 0 && (r += 65536), this._delta[0] = e[r++] - this._current[0], this._delta[1] = e[r++] - this._current[1], this._delta[2] = e[r++] - this._current[2], this._delta[3] = e[r++] - this._current[3], this._delta[4] = e[r++] - this._current[4], this._delta[5] = e[r++] - this._current[5], this._delta[6] = e[r++] - this._current[6], this._delta[7] = e[r++] - this._current[7])
- } else {
- var s = this.slot._slotData.color;
- this._current[0] = 100 * s.alphaMultiplier, this._current[1] = 100 * s.redMultiplier, this._current[2] = 100 * s.greenMultiplier, this._current[3] = 100 * s.blueMultiplier, this._current[4] = s.alphaOffset, this._current[5] = s.redOffset, this._current[6] = s.greenOffset, this._current[7] = s.blueOffset
- }
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this), this._dirty = !0, 2 !== this._tweenState && (this._tweenState = 0), this._result[0] = .01 * (this._current[0] + this._delta[0] * this._tweenProgress), this._result[1] = .01 * (this._current[1] + this._delta[1] * this._tweenProgress), this._result[2] = .01 * (this._current[2] + this._delta[2] * this._tweenProgress), this._result[3] = .01 * (this._current[3] + this._delta[3] * this._tweenProgress), this._result[4] = this._current[4] + this._delta[4] * this._tweenProgress, this._result[5] = this._current[5] + this._delta[5] * this._tweenProgress, this._result[6] = this._current[6] + this._delta[6] * this._tweenProgress, this._result[7] = this._current[7] + this._delta[7] * this._tweenProgress
- }, e.prototype.fadeOut = function() {
- this._tweenState = 0, this._dirty = !1
- }, e.prototype.update = function(e) {
- if (t.prototype.update.call(this, e), 0 !== this._tweenState || this._dirty) {
- var i = this.slot._colorTransform;
- if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
- if (i.alphaMultiplier !== this._result[0] || i.redMultiplier !== this._result[1] || i.greenMultiplier !== this._result[2] || i.blueMultiplier !== this._result[3] || i.alphaOffset !== this._result[4] || i.redOffset !== this._result[5] || i.greenOffset !== this._result[6] || i.blueOffset !== this._result[7]) {
- var n = Math.pow(this._animationState._fadeProgress, 4);
- i.alphaMultiplier += (this._result[0] - i.alphaMultiplier) * n, i.redMultiplier += (this._result[1] - i.redMultiplier) * n, i.greenMultiplier += (this._result[2] - i.greenMultiplier) * n, i.blueMultiplier += (this._result[3] - i.blueMultiplier) * n, i.alphaOffset += (this._result[4] - i.alphaOffset) * n, i.redOffset += (this._result[5] - i.redOffset) * n, i.greenOffset += (this._result[6] - i.greenOffset) * n, i.blueOffset += (this._result[7] - i.blueOffset) * n, this.slot._colorDirty = !0
- }
- } else this._dirty && (this._dirty = !1, i.alphaMultiplier === this._result[0] && i.redMultiplier === this._result[1] && i.greenMultiplier === this._result[2] && i.blueMultiplier === this._result[3] && i.alphaOffset === this._result[4] && i.redOffset === this._result[5] && i.greenOffset === this._result[6] && i.blueOffset === this._result[7] || (i.alphaMultiplier = this._result[0], i.redMultiplier = this._result[1], i.greenMultiplier = this._result[2], i.blueMultiplier = this._result[3], i.alphaOffset = this._result[4], i.redOffset = this._result[5], i.greenOffset = this._result[6], i.blueOffset = this._result[7], this.slot._colorDirty = !0))
- }
- }, e
- })(t.SlotTimelineState);
- t.SlotColorTimelineState = c;
- var u = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e._current = [], e._delta = [], e._result = [], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.DeformTimelineState]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.vertexOffset = 0, this._dirty = !1, this._frameFloatOffset = 0, this._valueCount = 0, this._deformCount = 0, this._valueOffset = 0, this._current.length = 0, this._delta.length = 0, this._result.length = 0
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount,
- i = this._armature._armatureData.scale,
- n = this._frameFloatArray;
- if (2 === this._tweenState) {
- var r = e + this._valueCount;
- this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset);
- for (var s = 0; s < this._valueCount; ++s) this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i)
- } else
- for (s = 0; s < this._valueCount; ++s) this._current[s] = n[e + s] * i
- } else
- for (s = 0; s < this._valueCount; ++s) this._current[s] = 0
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this), this._dirty = !0, 2 !== this._tweenState && (this._tweenState = 0);
- for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress
- }, e.prototype.init = function(e, i, n) {
- if (t.prototype.init.call(this, e, i, n), null !== this._timelineData) {
- var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
- this.vertexOffset = this._frameIntArray[r + 0], this.vertexOffset < 0 && (this.vertexOffset += 65536), this._deformCount = this._frameIntArray[r + 1], this._valueCount = this._frameIntArray[r + 2], this._valueOffset = this._frameIntArray[r + 3], this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset
- } else {
- var s = this.slot._deformVertices;
- this._deformCount = null !== s ? s.vertices.length : 0, this._valueCount = this._deformCount, this._valueOffset = 0, this._frameFloatOffset = 0
- }
- this._current.length = this._valueCount, this._delta.length = this._valueCount, this._result.length = this._valueCount;
- for (var o = 0; o < this._valueCount; ++o) this._delta[o] = 0
- }, e.prototype.fadeOut = function() {
- this._tweenState = 0, this._dirty = !1
- }, e.prototype.update = function(e) {
- var i = this.slot._deformVertices;
- if (null !== i && null !== i.verticesData && i.verticesData.offset === this.vertexOffset && (t.prototype.update.call(this, e), 0 !== this._tweenState || this._dirty)) {
- var n = i.vertices;
- if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
- for (var r = Math.pow(this._animationState._fadeProgress, 2), s = 0; s < this._deformCount; ++s) s < this._valueOffset ? n[s] += (this._frameFloatArray[this._frameFloatOffset + s] - n[s]) * r : s < this._valueOffset + this._valueCount ? n[s] += (this._result[s - this._valueOffset] - n[s]) * r : n[s] += (this._frameFloatArray[this._frameFloatOffset + s - this._valueCount] - n[s]) * r;
- i.verticesDirty = !0
- } else if (this._dirty) {
- this._dirty = !1;
- for (s = 0; s < this._deformCount; ++s) s < this._valueOffset ? n[s] = this._frameFloatArray[this._frameFloatOffset + s] : s < this._valueOffset + this._valueCount ? n[s] = this._result[s - this._valueOffset] : n[s] = this._frameFloatArray[this._frameFloatOffset + s - this._valueCount];
- i.verticesDirty = !0
- }
- }
- }, e
- })(t.SlotTimelineState);
- t.DeformTimelineState = u;
- var _ = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.IKConstraintTimelineState]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this._current = 0, this._delta = 0
- }, e.prototype._onArriveAtFrame = function() {
- t.prototype._onArriveAtFrame.call(this);
- var e = this.constraint;
- if (null !== this._timelineData) {
- var i = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex,
- n = this._frameIntArray,
- r = 0 !== n[i++];
- this._current = .01 * n[i++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (i = this._animationData.frameIntOffset + this._frameValueOffset), this._delta = .01 * n[i + 1] - this._current) : this._delta = 0, e._bendPositive = r
- } else {
- var s = e._constraintData;
- this._current = s.weight, this._delta = 0, e._bendPositive = s.bendPositive
- }
- e.invalidUpdate()
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this), 2 !== this._tweenState && (this._tweenState = 0);
- var e = this.constraint;
- e._weight = this._current + this._delta * this._tweenProgress, e.invalidUpdate()
- }, e
- })(t.ConstraintTimelineState);
- t.IKConstraintTimelineState = _;
- var f = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e._floats = [0, 0, 0, 0, 0, 0], e
- }
- return n(e, t), e.toString = function() {
- return "[class dragonBones.AnimationTimelineState]"
- }, e.prototype._onClear = function() {
- t.prototype._onClear.call(this), this.animationState = null
- }, e.prototype._onArriveAtFrame = function() {
- if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
- var e = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex,
- i = 1 / this.animationState._animationData.parent.frameRate,
- n = this._frameIntArray;
- this._floats[0] = n[e++] * i, this._floats[3] = .01 * n[e++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameIntOffset + this._frameValueOffset), this._floats[1] = n[e++] * i - this._floats[0], this._floats[4] = .01 * n[e++] - this._floats[3]) : (this._floats[1] = 0, this._floats[4] = 0)
- }
- }, e.prototype._onUpdateFrame = function() {
- t.prototype._onUpdateFrame.call(this), 2 !== this._tweenState && (this._tweenState = 0), this._floats[0] >= 0 && (this._floats[2] = this._floats[0] + this._floats[1] * this._tweenProgress), this._floats[5] = this._floats[3] + this._floats[4] * this._tweenProgress
- }, e.prototype.blend = function(t) {
- var e = this.animationState,
- i = e._blendState.blendWeight;
- 2 === t ? (e.weight += this._floats[5] * i, e.currentTime += this._floats[2] * i) : (e.weight = this._floats[5] * i, e.currentTime = this._floats[2] * i)
- }, e
- })(t.TweenTimelineState);
- t.AnimationTimelineState = f
- })(r || (r = {})), (function(t) {
- var e = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return n(e, t), e.actionDataToInstance = function(t, i, n) {
- 0 === t.type ? i.type = e.FRAME_EVENT : i.type = 10 === t.type ? e.FRAME_EVENT : e.SOUND_EVENT, i.name = t.name, i.armature = n, i.actionData = t, i.data = t.data, null !== t.bone && (i.bone = n.getBone(t.bone.name)), null !== t.slot && (i.slot = n.getSlot(t.slot.name))
- }, e.toString = function() {
- return "[class dragonBones.EventObject]"
- }, e.prototype._onClear = function() {
- this.time = 0, this.type = "", this.name = "", this.armature = null, this.bone = null, this.slot = null, this.animationState = null, this.actionData = null, this.data = null
- }, e.START = "start", e.LOOP_COMPLETE = "loopComplete", e.COMPLETE = "complete", e.FADE_IN = "fadeIn", e.FADE_IN_COMPLETE = "fadeInComplete", e.FADE_OUT = "fadeOut", e.FADE_OUT_COMPLETE = "fadeOutComplete", e.FRAME_EVENT = "frameEvent", e.SOUND_EVENT = "soundEvent", e
- })(t.BaseObject);
- t.EventObject = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function e() {}
- return e._getArmatureType = function(t) {
- switch (t.toLowerCase()) {
- case "stage":
- return 2;
- case "armature":
- return 0;
- case "movieclip":
- return 1;
- default:
- return 0
- }
- }, e._getBoneType = function(t) {
- switch (t.toLowerCase()) {
- case "bone":
- return 0;
- case "surface":
- return 1;
- default:
- return 0
- }
- }, e._getDisplayType = function(t) {
- switch (t.toLowerCase()) {
- case "image":
- return 0;
- case "mesh":
- return 2;
- case "armature":
- return 1;
- case "boundingbox":
- return 3;
- case "path":
- return 4;
- default:
- return 0
- }
- }, e._getBoundingBoxType = function(t) {
- switch (t.toLowerCase()) {
- case "rectangle":
- return 0;
- case "ellipse":
- return 1;
- case "polygon":
- return 2;
- default:
- return 0
- }
- }, e._getActionType = function(t) {
- switch (t.toLowerCase()) {
- case "play":
- return 0;
- case "frame":
- return 10;
- case "sound":
- return 11;
- default:
- return 0
- }
- }, e._getBlendMode = function(t) {
- switch (t.toLowerCase()) {
- case "normal":
- return 0;
- case "add":
- return 1;
- case "alpha":
- return 2;
- case "darken":
- return 3;
- case "difference":
- return 4;
- case "erase":
- return 5;
- case "hardlight":
- return 6;
- case "invert":
- return 7;
- case "layer":
- return 8;
- case "lighten":
- return 9;
- case "multiply":
- return 10;
- case "overlay":
- return 11;
- case "screen":
- return 12;
- case "subtract":
- return 13;
- default:
- return 0
- }
- }, e._getPositionMode = function(t) {
- switch (t.toLocaleLowerCase()) {
- case "percent":
- return 1;
- case "fixed":
- return 0;
- default:
- return 1
- }
- }, e._getSpacingMode = function(t) {
- switch (t.toLocaleLowerCase()) {
- case "length":
- return 0;
- case "percent":
- return 2;
- case "fixed":
- return 1;
- default:
- return 0
- }
- }, e._getRotateMode = function(t) {
- switch (t.toLocaleLowerCase()) {
- case "tangent":
- return 0;
- case "chain":
- return 1;
- case "chainscale":
- return 2;
- default:
- return 0
- }
- }, e.parseDragonBonesData = function(e) {
- return console.warn("Deprecated."), e instanceof ArrayBuffer ? t.BinaryDataParser.getInstance().parseDragonBonesData(e) : t.ObjectDataParser.getInstance().parseDragonBonesData(e)
- }, e.parseTextureAtlasData = function(i, n) {
- void 0 === n && (n = 1), console.warn("\u5df2\u5e9f\u5f03");
- for (var r = {}, s = i[e.SUB_TEXTURE], o = 0, a = s.length; o < a; o++) {
- var l = s[o],
- h = l[e.NAME],
- c = new t.Rectangle,
- u = null;
- c.x = l[e.X] / n, c.y = l[e.Y] / n, c.width = l[e.WIDTH] / n, c.height = l[e.HEIGHT] / n, e.FRAME_WIDTH in l && ((u = new t.Rectangle).x = l[e.FRAME_X] / n, u.y = l[e.FRAME_Y] / n, u.width = l[e.FRAME_WIDTH] / n, u.height = l[e.FRAME_HEIGHT] / n), r[h] = {
- region: c,
- frame: u,
- rotated: !1
- }
- }
- return r
- }, e.DATA_VERSION_2_3 = "2.3", e.DATA_VERSION_3_0 = "3.0", e.DATA_VERSION_4_0 = "4.0", e.DATA_VERSION_4_5 = "4.5", e.DATA_VERSION_5_0 = "5.0", e.DATA_VERSION_5_5 = "5.5", e.DATA_VERSION = e.DATA_VERSION_5_5, e.DATA_VERSIONS = [e.DATA_VERSION_4_0, e.DATA_VERSION_4_5, e.DATA_VERSION_5_0, e.DATA_VERSION_5_5], e.TEXTURE_ATLAS = "textureAtlas", e.SUB_TEXTURE = "SubTexture", e.FORMAT = "format", e.IMAGE_PATH = "imagePath", e.WIDTH = "width", e.HEIGHT = "height", e.ROTATED = "rotated", e.FRAME_X = "frameX", e.FRAME_Y = "frameY", e.FRAME_WIDTH = "frameWidth", e.FRAME_HEIGHT = "frameHeight", e.DRADON_BONES = "dragonBones", e.USER_DATA = "userData", e.ARMATURE = "armature", e.BONE = "bone", e.SURFACE = "surface", e.SLOT = "slot", e.CONSTRAINT = "constraint", e.IK = "ik", e.PATH_CONSTRAINT = "path", e.SKIN = "skin", e.DISPLAY = "display", e.ANIMATION = "animation", e.Z_ORDER = "zOrder", e.FFD = "ffd", e.FRAME = "frame", e.TRANSLATE_FRAME = "translateFrame", e.ROTATE_FRAME = "rotateFrame", e.SCALE_FRAME = "scaleFrame", e.DISPLAY_FRAME = "displayFrame", e.COLOR_FRAME = "colorFrame", e.DEFAULT_ACTIONS = "defaultActions", e.ACTIONS = "actions", e.EVENTS = "events", e.INTS = "ints", e.FLOATS = "floats", e.STRINGS = "strings", e.CANVAS = "canvas", e.TRANSFORM = "transform", e.PIVOT = "pivot", e.AABB = "aabb", e.COLOR = "color", e.VERSION = "version", e.COMPATIBLE_VERSION = "compatibleVersion", e.FRAME_RATE = "frameRate", e.TYPE = "type", e.SUB_TYPE = "subType", e.NAME = "name", e.PARENT = "parent", e.TARGET = "target", e.STAGE = "stage", e.SHARE = "share", e.PATH = "path", e.LENGTH = "length", e.DISPLAY_INDEX = "displayIndex", e.BLEND_MODE = "blendMode", e.INHERIT_TRANSLATION = "inheritTranslation", e.INHERIT_ROTATION = "inheritRotation", e.INHERIT_SCALE = "inheritScale", e.INHERIT_REFLECTION = "inheritReflection", e.INHERIT_ANIMATION = "inheritAnimation", e.INHERIT_DEFORM = "inheritDeform", e.SEGMENT_X = "segmentX", e.SEGMENT_Y = "segmentY", e.BEND_POSITIVE = "bendPositive", e.CHAIN = "chain", e.WEIGHT = "weight", e.FADE_IN_TIME = "fadeInTime", e.PLAY_TIMES = "playTimes", e.SCALE = "scale", e.OFFSET = "offset", e.POSITION = "position", e.DURATION = "duration", e.TWEEN_EASING = "tweenEasing", e.TWEEN_ROTATE = "tweenRotate", e.TWEEN_SCALE = "tweenScale", e.CLOCK_WISE = "clockwise", e.CURVE = "curve", e.SOUND = "sound", e.EVENT = "event", e.ACTION = "action", e.X = "x", e.Y = "y", e.SKEW_X = "skX", e.SKEW_Y = "skY", e.SCALE_X = "scX", e.SCALE_Y = "scY", e.VALUE = "value", e.ROTATE = "rotate", e.SKEW = "skew", e.ALPHA_OFFSET = "aO", e.RED_OFFSET = "rO", e.GREEN_OFFSET = "gO", e.BLUE_OFFSET = "bO", e.ALPHA_MULTIPLIER = "aM", e.RED_MULTIPLIER = "rM", e.GREEN_MULTIPLIER = "gM", e.BLUE_MULTIPLIER = "bM", e.UVS = "uvs", e.VERTICES = "vertices", e.TRIANGLES = "triangles", e.WEIGHTS = "weights", e.SLOT_POSE = "slotPose", e.BONE_POSE = "bonePose", e.GLUE_WEIGHTS = "glueWeights", e.GLUE_MESHES = "glueMeshes", e.BONES = "bones", e.POSITION_MODE = "positionMode", e.SPACING_MODE = "spacingMode", e.ROTATE_MODE = "rotateMode", e.SPACING = "spacing", e.ROTATE_OFFSET = "rotateOffset", e.ROTATE_MIX = "rotateMix", e.TRANSLATE_MIX = "translateMix", e.TARGET_DISPLAY = "targetDisplay", e.CLOSED = "closed", e.CONSTANT_SPEED = "constantSpeed", e.VERTEX_COUNT = "vertexCount", e.LENGTHS = "lengths", e.GOTO_AND_PLAY = "gotoAndPlay", e.DEFAULT_NAME = "default", e
- })();
- t.DataParser = e
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function r() {
- var i = null !== e && e.apply(this, arguments) || this;
- return i._rawTextureAtlasIndex = 0, i._rawBones = [], i._data = null, i._armature = null, i._bone = null, i._surface = null, i._slot = null, i._skin = null, i._mesh = null, i._animation = null, i._timeline = null, i._rawTextureAtlases = null, i._defaultColorOffset = -1, i._prevClockwise = 0, i._prevRotation = 0, i._helpMatrixA = new t.Matrix, i._helpMatrixB = new t.Matrix, i._helpTransform = new t.Transform, i._helpColorTransform = new t.ColorTransform, i._helpPoint = new t.Point, i._helpArray = [], i._intArray = [], i._floatArray = [], i._frameIntArray = [], i._frameFloatArray = [], i._frameArray = [], i._timelineArray = [], i._cacheRawMeshes = [], i._cacheMeshes = [], i._actionFrames = [], i._weightSlotPose = {}, i._weightBonePoses = {}, i._cacheBones = {}, i._slotChildActions = {}, i
- }
- return n(r, e), r._getBoolean = function(t, e, i) {
- if (e in t) {
- var n = t[e],
- r = typeof n;
- if ("boolean" === r) return n;
- if ("string" !== r) return !!n;
- switch (n) {
- case "0":
- case "NaN":
- case "":
- case "false":
- case "null":
- case "undefined":
- return !1;
- default:
- return !0
- }
- }
- return i
- }, r._getNumber = function(t, e, i) {
- if (e in t) {
- var n = t[e];
- return null === n || "NaN" === n ? i : +n || 0
- }
- return i
- }, r._getString = function(e, i, n) {
- if (i in e) {
- var r = e[i];
- if ("string" === typeof r) {
- if (t.DragonBones.webAssembly)
- for (var s = 0, o = r.length; s < o; ++s)
- if (r.charCodeAt(s) > 255) return encodeURI(r);
- return r
- }
- return String(r)
- }
- return n
- }, r.prototype._getCurvePoint = function(t, e, i, n, r, s, o, a, l, h) {
- var c = 1 - l,
- u = c * c,
- _ = l * l,
- f = c * u,
- d = 3 * l * u,
- p = 3 * c * _,
- m = l * _;
- h.x = f * t + d * i + p * r + m * o, h.y = f * e + d * n + p * s + m * a
- }, r.prototype._samplingEasingCurve = function(t, e) {
- for (var i = t.length, n = -2, r = 0, s = e.length; r < s; ++r) {
- for (var o = (r + 1) / (s + 1);
- (n + 6 < i ? t[n + 6] : 1) < o;) n += 6;
- for (var a = n >= 0 && n + 6 < i, l = a ? t[n] : 0, h = a ? t[n + 1] : 0, c = t[n + 2], u = t[n + 3], _ = t[n + 4], f = t[n + 5], d = a ? t[n + 6] : 1, p = a ? t[n + 7] : 1, m = 0, y = 1; y - m > 1e-4;) {
- var v = .5 * (y + m);
- this._getCurvePoint(l, h, c, u, _, f, d, p, v, this._helpPoint), o - this._helpPoint.x > 0 ? m = v : y = v
- }
- e[r] = this._helpPoint.y
- }
- }, r.prototype._parseActionDataInFrame = function(e, i, n, r) {
- t.DataParser.EVENT in e && this._mergeActionFrame(e[t.DataParser.EVENT], i, 10, n, r), t.DataParser.SOUND in e && this._mergeActionFrame(e[t.DataParser.SOUND], i, 11, n, r), t.DataParser.ACTION in e && this._mergeActionFrame(e[t.DataParser.ACTION], i, 0, n, r), t.DataParser.EVENTS in e && this._mergeActionFrame(e[t.DataParser.EVENTS], i, 10, n, r), t.DataParser.ACTIONS in e && this._mergeActionFrame(e[t.DataParser.ACTIONS], i, 0, n, r)
- }, r.prototype._mergeActionFrame = function(e, n, r, s, o) {
- for (var a = t.DragonBones.webAssembly ? this._armature.actions.size() : this._armature.actions.length, l = this._parseActionData(e, r, s, o), h = 0, c = null, u = 0, _ = l; u < _.length; u++) {
- var f = _[u];
- this._armature.addAction(f, !1)
- }
- 0 === this._actionFrames.length && ((c = new i).frameStart = 0, this._actionFrames.push(c), c = null);
- for (var d = 0, p = this._actionFrames; d < p.length; d++) {
- var m = p[d];
- if (m.frameStart === n) {
- c = m;
- break
- }
- if (m.frameStart > n) break;
- h++
- }
- null === c && ((c = new i).frameStart = n, this._actionFrames.splice(h + 1, 0, c));
- for (var y = 0; y < l.length; ++y) c.actions.push(a + y)
- }, r.prototype._parseArmature = function(e, i) {
- var n = t.BaseObject.borrowObject(t.ArmatureData);
- if (n.name = r._getString(e, t.DataParser.NAME, ""), n.frameRate = r._getNumber(e, t.DataParser.FRAME_RATE, this._data.frameRate), n.scale = i, t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? n.type = t.DataParser._getArmatureType(e[t.DataParser.TYPE]) : n.type = r._getNumber(e, t.DataParser.TYPE, 0), 0 === n.frameRate && (n.frameRate = 24), this._armature = n, t.DataParser.CANVAS in e) {
- var s = e[t.DataParser.CANVAS],
- o = t.BaseObject.borrowObject(t.CanvasData);
- t.DataParser.COLOR in s ? o.hasBackground = !0 : o.hasBackground = !1, o.color = r._getNumber(s, t.DataParser.COLOR, 0), o.x = r._getNumber(s, t.DataParser.X, 0) * n.scale, o.y = r._getNumber(s, t.DataParser.Y, 0) * n.scale, o.width = r._getNumber(s, t.DataParser.WIDTH, 0) * n.scale, o.height = r._getNumber(s, t.DataParser.HEIGHT, 0) * n.scale, n.canvas = o
- }
- if (t.DataParser.AABB in e) {
- var a = e[t.DataParser.AABB];
- n.aabb.x = r._getNumber(a, t.DataParser.X, 0) * n.scale, n.aabb.y = r._getNumber(a, t.DataParser.Y, 0) * n.scale, n.aabb.width = r._getNumber(a, t.DataParser.WIDTH, 0) * n.scale, n.aabb.height = r._getNumber(a, t.DataParser.HEIGHT, 0) * n.scale
- }
- if (t.DataParser.BONE in e)
- for (var l = 0, h = e[t.DataParser.BONE]; l < h.length; l++) {
- var c = h[l],
- u = r._getString(c, t.DataParser.PARENT, ""),
- _ = this._parseBone(c);
- if (u.length > 0) {
- var f = n.getBone(u);
- null !== f ? _.parent = f : (u in this._cacheBones || (this._cacheBones[u] = []), this._cacheBones[u].push(_))
- }
- if (_.name in this._cacheBones) {
- for (var d = 0, p = this._cacheBones[_.name]; d < p.length; d++) {
- p[d].parent = _
- }
- delete this._cacheBones[_.name]
- }
- n.addBone(_), this._rawBones.push(_)
- }
- if (t.DataParser.IK in e)
- for (var m = 0, y = e[t.DataParser.IK]; m < y.length; m++) {
- var v = y[m];
- (M = this._parseIKConstraint(v)) && n.addConstraint(M)
- }
- if (n.sortBones(), t.DataParser.SLOT in e)
- for (var g = 0, x = 0, b = e[t.DataParser.SLOT]; x < b.length; x++) {
- var A = b[x];
- n.addSlot(this._parseSlot(A, g++))
- }
- if (t.DataParser.SKIN in e)
- for (var C = 0, T = e[t.DataParser.SKIN]; C < T.length; C++) {
- var S = T[C];
- n.addSkin(this._parseSkin(S))
- }
- if (t.DataParser.PATH_CONSTRAINT in e)
- for (var w = 0, E = e[t.DataParser.PATH_CONSTRAINT]; w < E.length; w++) {
- var M, D = E[w];
- (M = this._parsePathConstraint(D)) && n.addConstraint(M)
- }
- for (var B = 0, I = this._cacheRawMeshes.length; B < I; ++B) {
- var P = this._cacheRawMeshes[B];
- t.DataParser.GLUE_WEIGHTS in P && t.DataParser.GLUE_MESHES in P && this._parseMeshGlue(P, this._cacheMeshes[B])
- }
- for (B = 0, I = this._cacheRawMeshes.length; B < I; ++B) {
- var R = this._cacheRawMeshes[B],
- O = r._getString(R, t.DataParser.SHARE, "");
- if (0 !== O.length) {
- var L = r._getString(R, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME);
- 0 === L.length && (L = t.DataParser.DEFAULT_NAME);
- var F = n.getMesh(L, "", O);
- if (null !== F) this._cacheMeshes[B].vertices.shareFrom(F.vertices)
- }
- }
- if (t.DataParser.ANIMATION in e)
- for (var N = 0, V = e[t.DataParser.ANIMATION]; N < V.length; N++) {
- var k = V[N],
- G = this._parseAnimation(k);
- n.addAnimation(G)
- }
- if (t.DataParser.DEFAULT_ACTIONS in e)
- for (var U = 0, z = this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS], 0, null, null); U < z.length; U++) {
- var j = z[U];
- if (n.addAction(j, !0), 0 === j.type) null !== (G = n.getAnimation(j.name)) && (n.defaultAnimation = G)
- }
- if (t.DataParser.ACTIONS in e)
- for (var W = 0, H = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); W < H.length; W++) {
- j = H[W];
- n.addAction(j, !1)
- }
- for (var X in this._rawBones.length = 0, this._cacheRawMeshes.length = 0, this._cacheMeshes.length = 0, this._armature = null, this._weightSlotPose) delete this._weightSlotPose[X];
- for (var X in this._weightBonePoses) delete this._weightBonePoses[X];
- for (var X in this._cacheBones) delete this._cacheBones[X];
- for (var X in this._slotChildActions) delete this._slotChildActions[X];
- return n
- }, r.prototype._parseBone = function(e) {
- var i = this._armature.scale;
- if (0 === (t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getBoneType(e[t.DataParser.TYPE]) : r._getNumber(e, t.DataParser.TYPE, 0))) {
- var n = t.BaseObject.borrowObject(t.BoneData);
- return n.inheritTranslation = r._getBoolean(e, t.DataParser.INHERIT_TRANSLATION, !0), n.inheritRotation = r._getBoolean(e, t.DataParser.INHERIT_ROTATION, !0), n.inheritScale = r._getBoolean(e, t.DataParser.INHERIT_SCALE, !0), n.inheritReflection = r._getBoolean(e, t.DataParser.INHERIT_REFLECTION, !0), n.length = r._getNumber(e, t.DataParser.LENGTH, 0) * i, n.name = r._getString(e, t.DataParser.NAME, ""), t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], n.transform, i), n
- }
- var s = t.BaseObject.borrowObject(t.SurfaceData);
- if (s.name = r._getString(e, t.DataParser.NAME, ""), s.segmentX = r._getNumber(e, t.DataParser.SEGMENT_X, 0), s.segmentY = r._getNumber(e, t.DataParser.SEGMENT_Y, 0), s.vertices.length = (s.segmentX + 1) * (s.segmentY + 1) * 2, t.DataParser.VERTICES in e)
- for (var o = e[t.DataParser.VERTICES], a = 0, l = s.vertices.length; a < l; ++a) a < o.length ? s.vertices[a] = o[a] * i : s.vertices[a] = 0;
- return s
- }, r.prototype._parseIKConstraint = function(e) {
- var i = this._armature.getBone(r._getString(e, t.DataParser.BONE, ""));
- if (null === i) return null;
- var n = this._armature.getBone(r._getString(e, t.DataParser.TARGET, ""));
- if (null === n) return null;
- var s = t.BaseObject.borrowObject(t.IKConstraintData);
- return s.scaleEnabled = r._getBoolean(e, t.DataParser.SCALE, !1), s.bendPositive = r._getBoolean(e, t.DataParser.BEND_POSITIVE, !0), s.weight = r._getNumber(e, t.DataParser.WEIGHT, 1), s.name = r._getString(e, t.DataParser.NAME, ""), s.type = 0, s.target = n, r._getNumber(e, t.DataParser.CHAIN, 0) > 0 && null !== i.parent ? (s.root = i.parent, s.bone = i) : (s.root = i, s.bone = null), s
- }, r.prototype._parsePathConstraint = function(e) {
- var i = this._armature.getSlot(r._getString(e, t.DataParser.TARGET, ""));
- if (null === i) return null;
- var n = this._armature.defaultSkin;
- if (null === n) return null;
- var s = n.getDisplay(i.name, r._getString(e, t.DataParser.TARGET_DISPLAY, i.name));
- if (null === s || !(s instanceof t.PathDisplayData)) return null;
- var o = e[t.DataParser.BONES];
- if (null === o || 0 === o.length) return null;
- var a = t.BaseObject.borrowObject(t.PathConstraintData);
- a.name = r._getString(e, t.DataParser.NAME, ""), a.type = 1, a.pathSlot = i, a.pathDisplayData = s, a.target = i.parent, a.positionMode = t.DataParser._getPositionMode(r._getString(e, t.DataParser.POSITION_MODE, "")), a.spacingMode = t.DataParser._getSpacingMode(r._getString(e, t.DataParser.SPACING_MODE, "")), a.rotateMode = t.DataParser._getRotateMode(r._getString(e, t.DataParser.ROTATE_MODE, "")), a.position = r._getNumber(e, t.DataParser.POSITION, 0), a.spacing = r._getNumber(e, t.DataParser.SPACING, 0), a.rotateOffset = r._getNumber(e, t.DataParser.ROTATE_OFFSET, 0), a.rotateMix = r._getNumber(e, t.DataParser.ROTATE_MIX, 1), a.translateMix = r._getNumber(e, t.DataParser.TRANSLATE_MIX, 1);
- for (var l = 0, h = o; l < h.length; l++) {
- var c = h[l],
- u = this._armature.getBone(c);
- null !== u && (a.AddBone(u), null === a.root && (a.root = u))
- }
- return a
- }, r.prototype._parseSlot = function(e, i) {
- var n = t.BaseObject.borrowObject(t.SlotData);
- return n.displayIndex = r._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), n.zOrder = i, n.name = r._getString(e, t.DataParser.NAME, ""), n.parent = this._armature.getBone(r._getString(e, t.DataParser.PARENT, "")), t.DataParser.BLEND_MODE in e && "string" == typeof e[t.DataParser.BLEND_MODE] ? n.blendMode = t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]) : n.blendMode = r._getNumber(e, t.DataParser.BLEND_MODE, 0), t.DataParser.COLOR in e ? (n.color = t.SlotData.createColor(), this._parseColorTransform(e[t.DataParser.COLOR], n.color)) : n.color = t.SlotData.DEFAULT_COLOR, t.DataParser.ACTIONS in e && (this._slotChildActions[n.name] = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null)), n
- }, r.prototype._parseSkin = function(e) {
- var i = t.BaseObject.borrowObject(t.SkinData);
- if (i.name = r._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), t.DataParser.SLOT in e) {
- var n = e[t.DataParser.SLOT];
- this._skin = i;
- for (var s = 0, o = n; s < o.length; s++) {
- var a = o[s],
- l = r._getString(a, t.DataParser.NAME, ""),
- h = this._armature.getSlot(l);
- if (null !== h) {
- if (this._slot = h, t.DataParser.DISPLAY in a)
- for (var c = 0, u = a[t.DataParser.DISPLAY]; c < u.length; c++) {
- var _ = u[c];
- _ ? i.addDisplay(l, this._parseDisplay(_)) : i.addDisplay(l, null)
- }
- this._slot = null
- }
- }
- this._skin = null
- }
- return i
- }, r.prototype._parseDisplay = function(e) {
- var i = r._getString(e, t.DataParser.NAME, ""),
- n = r._getString(e, t.DataParser.PATH, ""),
- s = 0,
- o = null;
- switch (s = t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getDisplayType(e[t.DataParser.TYPE]) : r._getNumber(e, t.DataParser.TYPE, s)) {
- case 0:
- var a = o = t.BaseObject.borrowObject(t.ImageDisplayData);
- a.name = i, a.path = n.length > 0 ? n : i, this._parsePivot(e, a);
- break;
- case 1:
- var l = o = t.BaseObject.borrowObject(t.ArmatureDisplayData);
- if (l.name = i, l.path = n.length > 0 ? n : i, l.inheritAnimation = !0, t.DataParser.ACTIONS in e)
- for (var h = 0, c = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); h < c.length; h++) {
- var u = c[h];
- l.addAction(u)
- } else if (this._slot.name in this._slotChildActions) {
- var _ = this._skin.getDisplays(this._slot.name);
- if (null === _ ? 0 === this._slot.displayIndex : this._slot.displayIndex === _.length) {
- for (var f = 0, d = this._slotChildActions[this._slot.name]; f < d.length; f++) {
- u = d[f];
- l.addAction(u)
- }
- delete this._slotChildActions[this._slot.name]
- }
- }
- break;
- case 2:
- var p = o = t.BaseObject.borrowObject(t.MeshDisplayData);
- p.vertices.inheritDeform = r._getBoolean(e, t.DataParser.INHERIT_DEFORM, !0), p.name = i, p.path = n.length > 0 ? n : i, p.vertices.data = this._data, t.DataParser.SHARE in e ? (this._cacheRawMeshes.push(e), this._cacheMeshes.push(p)) : this._parseMesh(e, p), t.DataParser.GLUE_WEIGHTS in e && t.DataParser.GLUE_MESHES in e && (this._cacheRawMeshes.push(e), this._cacheMeshes.push(p));
- break;
- case 3:
- var m = this._parseBoundingBox(e);
- if (null !== m) {
- var y = o = t.BaseObject.borrowObject(t.BoundingBoxDisplayData);
- y.name = i, y.path = n.length > 0 ? n : i, y.boundingBox = m
- }
- break;
- case 4:
- var v = e[t.DataParser.LENGTHS],
- g = o = t.BaseObject.borrowObject(t.PathDisplayData);
- g.closed = r._getBoolean(e, t.DataParser.CLOSED, !1), g.constantSpeed = r._getBoolean(e, t.DataParser.CONSTANT_SPEED, !1), g.name = i, g.path = n.length > 0 ? n : i, g.vertices.data = this._data, g.curveLengths.length = v.length;
- for (var x = 0, b = v.length; x < b; ++x) g.curveLengths[x] = v[x];
- this._parsePath(e, g)
- }
- return null !== o && t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], o.transform, this._armature.scale), o
- }, r.prototype._parsePath = function(e, i) {
- var n = e[t.DataParser.VERTICES],
- s = r._getNumber(e, t.DataParser.VERTEX_COUNT, 0),
- o = this._floatArray.length,
- a = this._intArray.length;
- if (i.vertices.offset = a, this._intArray.length += 2, this._intArray[a + 0] = s, this._intArray[a + 2] = o, t.DataParser.WEIGHTS in e) {
- var l = e[t.DataParser.WEIGHTS],
- h = e[t.DataParser.BONES],
- c = h.length,
- u = Math.floor(l.length - s) / 2,
- _ = this._intArray.length,
- f = this._floatArray.length,
- d = this._armature.sortedBones,
- p = t.BaseObject.borrowObject(t.WeightData);
- p.count = u, p.offset = _, this._intArray.length += 2 + c + s + u, this._intArray[_ + 0] = c, this._intArray[_ + 1] = f;
- for (M = 0; M < c; M++) {
- var m = h[M],
- y = this._rawBones[m];
- p.addBone(y), this._intArray[_ + 2 + M] = d.indexOf(y)
- }
- this._floatArray.length += 3 * u;
- M = 0;
- for (var v = 0, g = 0, x = _ + 2 + c, b = f; M < u; M++) {
- var A = l[v++];
- this._intArray[x++] = A;
- for (var C = 0; C < A; C++) {
- var T = l[v++],
- S = l[v++],
- w = n[g++],
- E = n[g++];
- this._intArray[x++] = h.indexOf(T), this._floatArray[b++] = S, this._floatArray[b++] = w, this._floatArray[b++] = E
- }
- }
- i.vertices.weight = p
- } else {
- this._floatArray.length += n.length;
- for (var M = 0, D = n.length; M < D; ++M) this._floatArray[o + M] = n[M]
- }
- }, r.prototype._parsePivot = function(e, i) {
- if (t.DataParser.PIVOT in e) {
- var n = e[t.DataParser.PIVOT];
- i.pivot.x = r._getNumber(n, t.DataParser.X, 0), i.pivot.y = r._getNumber(n, t.DataParser.Y, 0)
- } else i.pivot.x = .5, i.pivot.y = .5
- }, r.prototype._parseMesh = function(e, i) {
- var n = e[t.DataParser.VERTICES],
- r = e[t.DataParser.UVS],
- s = e[t.DataParser.TRIANGLES],
- o = Math.floor(n.length / 2),
- a = Math.floor(s.length / 3),
- l = this._floatArray.length,
- h = l + 2 * o,
- c = this._intArray.length,
- u = this._skin.name + "_" + this._slot.name + "_" + i.name;
- i.vertices.offset = c, this._intArray.length += 4 + 3 * a, this._intArray[c + 0] = o, this._intArray[c + 1] = a, this._intArray[c + 2] = l;
- for (var _ = 0, f = 3 * a; _ < f; ++_) this._intArray[c + 4 + _] = s[_];
- this._floatArray.length += 2 * o + 2 * o;
- for (_ = 0, f = 2 * o; _ < f; ++_) this._floatArray[l + _] = n[_], this._floatArray[h + _] = r[_];
- if (t.DataParser.WEIGHTS in e) {
- var d = e[t.DataParser.WEIGHTS],
- p = e[t.DataParser.SLOT_POSE],
- m = e[t.DataParser.BONE_POSE],
- y = this._armature.sortedBones,
- v = new Array,
- g = Math.floor(m.length / 7),
- x = this._floatArray.length,
- b = Math.floor(d.length - o) / 2,
- A = this._intArray.length,
- C = t.BaseObject.borrowObject(t.WeightData);
- C.count = b, C.offset = A, v.length = g, this._intArray.length += 2 + g + o + b, this._intArray[A + 1] = x;
- for (_ = 0; _ < g; ++_) {
- var T = m[7 * _],
- S = this._rawBones[T];
- C.addBone(S), v[_] = T, this._intArray[A + 2 + _] = y.indexOf(S)
- }
- this._floatArray.length += 3 * b, this._helpMatrixA.copyFromArray(p, 0);
- _ = 0;
- for (var w = 0, E = A + 2 + g, M = x; _ < o; ++_) {
- var D = 2 * _,
- B = this._intArray[E++] = d[w++],
- I = this._floatArray[l + D],
- P = this._floatArray[l + D + 1];
- this._helpMatrixA.transformPoint(I, P, this._helpPoint), I = this._helpPoint.x, P = this._helpPoint.y;
- for (var R = 0; R < B; ++R) {
- T = d[w++];
- var O = v.indexOf(T);
- this._helpMatrixB.copyFromArray(m, 7 * O + 1), this._helpMatrixB.invert(), this._helpMatrixB.transformPoint(I, P, this._helpPoint), this._intArray[E++] = O, this._floatArray[M++] = d[w++], this._floatArray[M++] = this._helpPoint.x, this._floatArray[M++] = this._helpPoint.y
- }
- }
- i.vertices.weight = C, this._weightSlotPose[u] = p, this._weightBonePoses[u] = m
- }
- }, r.prototype._parseMeshGlue = function(t, e) {}, r.prototype._parseBoundingBox = function(e) {
- var i = null,
- n = 0;
- switch (n = t.DataParser.SUB_TYPE in e && "string" == typeof e[t.DataParser.SUB_TYPE] ? t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]) : r._getNumber(e, t.DataParser.SUB_TYPE, n)) {
- case 0:
- i = t.BaseObject.borrowObject(t.RectangleBoundingBoxData);
- break;
- case 1:
- i = t.BaseObject.borrowObject(t.EllipseBoundingBoxData);
- break;
- case 2:
- i = this._parsePolygonBoundingBox(e)
- }
- return null !== i && (i.color = r._getNumber(e, t.DataParser.COLOR, 0), 0 !== i.type && 1 !== i.type || (i.width = r._getNumber(e, t.DataParser.WIDTH, 0), i.height = r._getNumber(e, t.DataParser.HEIGHT, 0))), i
- }, r.prototype._parsePolygonBoundingBox = function(e) {
- var i = t.BaseObject.borrowObject(t.PolygonBoundingBoxData);
- if (t.DataParser.VERTICES in e) {
- var n = this._armature.scale,
- r = e[t.DataParser.VERTICES],
- s = i.vertices;
- t.DragonBones.webAssembly ? s.resize(r.length, 0) : s.length = r.length;
- for (var o = 0, a = r.length; o < a; o += 2) {
- var l = r[o] * n,
- h = r[o + 1] * n;
- t.DragonBones.webAssembly ? (s.set(o, l), s.set(o + 1, h)) : (s[o] = l, s[o + 1] = h), 0 === o ? (i.x = l, i.y = h, i.width = l, i.height = h) : (l < i.x ? i.x = l : l > i.width && (i.width = l), h < i.y ? i.y = h : h > i.height && (i.height = h))
- }
- i.width -= i.x, i.height -= i.y
- } else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");
- return i
- }, r.prototype._parseAnimation = function(e) {
- var i = t.BaseObject.borrowObject(t.AnimationData);
- if (i.frameCount = Math.max(r._getNumber(e, t.DataParser.DURATION, 1), 1), i.playTimes = r._getNumber(e, t.DataParser.PLAY_TIMES, 1), i.duration = i.frameCount / this._armature.frameRate, i.fadeInTime = r._getNumber(e, t.DataParser.FADE_IN_TIME, 0), i.scale = r._getNumber(e, t.DataParser.SCALE, 1), i.name = r._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), i.frameIntOffset = this._frameIntArray.length, i.frameFloatOffset = this._frameFloatArray.length, i.frameOffset = this._frameArray.length, this._animation = i, t.DataParser.FRAME in e) {
- var n = e[t.DataParser.FRAME],
- s = n.length;
- if (s > 0)
- for (var o = 0, a = 0; o < s; ++o) {
- var l = n[o];
- this._parseActionDataInFrame(l, a, null, null), a += r._getNumber(l, t.DataParser.DURATION, 1)
- }
- }
- if (t.DataParser.Z_ORDER in e && (this._animation.zOrderTimeline = this._parseTimeline(e[t.DataParser.Z_ORDER], null, t.DataParser.FRAME, 1, !1, !1, 0, this._parseZOrderFrame)), t.DataParser.BONE in e)
- for (var h = 0, c = e[t.DataParser.BONE]; h < c.length; h++) {
- var u = c[h];
- this._parseBoneTimeline(u)
- }
- if (t.DataParser.SURFACE in e)
- for (var _ = 0, f = e[t.DataParser.SURFACE]; _ < f.length; _++) {
- u = f[_];
- var d = r._getString(u, t.DataParser.NAME, "");
- if (this._surface = this._armature.getBone(d), null !== this._surface) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 50, !1, !0, 0, this._parseSurfaceFrame)) && this._animation.addSurfaceTimeline(this._surface, M), this._surface = null
- }
- if (t.DataParser.SLOT in e)
- for (var p = 0, m = e[t.DataParser.SLOT]; p < m.length; p++) {
- u = m[p];
- this._parseSlotTimeline(u)
- }
- if (t.DataParser.FFD in e)
- for (var y = 0, v = e[t.DataParser.FFD]; y < v.length; y++) {
- u = v[y];
- var g = r._getString(u, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME),
- x = r._getString(u, t.DataParser.SLOT, ""),
- b = r._getString(u, t.DataParser.NAME, "");
- if (0 === g.length && (g = t.DataParser.DEFAULT_NAME), this._slot = this._armature.getSlot(x), this._mesh = this._armature.getMesh(g, x, b), null !== this._slot && null !== this._mesh) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 22, !1, !0, 0, this._parseSlotFFDFrame)) && this._animation.addSlotTimeline(this._slot, M), this._slot = null, this._mesh = null
- }
- if (t.DataParser.IK in e)
- for (var A = 0, C = e[t.DataParser.IK]; A < C.length; A++) {
- u = C[A];
- var T = r._getString(u, t.DataParser.NAME, ""),
- S = this._armature.getConstraint(T);
- if (null !== S) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 30, !0, !1, 2, this._parseIKConstraintFrame)) && this._animation.addConstraintTimeline(S, M)
- }
- if (t.DataParser.ANIMATION in e)
- for (var w = 0, E = e[t.DataParser.ANIMATION]; w < E.length; w++) {
- u = E[w];
- var M, D = r._getString(u, t.DataParser.NAME, "");
- null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 40, !0, !1, 2, this._parseAnimationFrame)) && this._animation.addAnimationTimeline(D, M)
- }
- return this._actionFrames.length > 0 && (this._animation.actionTimeline = this._parseTimeline(null, this._actionFrames, "", 0, !1, !1, 0, this._parseActionFrame), this._actionFrames.length = 0), this._animation = null, i
- }, r.prototype._parseTimeline = function(e, n, s, o, a, l, h, c) {
- if (null !== e && s.length > 0 && s in e && (n = e[s]), null === n) return null;
- var u = n.length;
- if (0 === u) return null;
- var _ = this._frameIntArray.length,
- f = this._frameFloatArray.length,
- d = t.BaseObject.borrowObject(t.TimelineData),
- p = this._timelineArray.length;
- if (this._timelineArray.length += 5 + u, null !== e ? (this._timelineArray[p + 0] = Math.round(100 * r._getNumber(e, t.DataParser.SCALE, 1)), this._timelineArray[p + 1] = Math.round(100 * r._getNumber(e, t.DataParser.OFFSET, 0))) : (this._timelineArray[p + 0] = 100, this._timelineArray[p + 1] = 0), this._timelineArray[p + 2] = u, this._timelineArray[p + 3] = h, this._timelineArray[p + 4] = a ? _ - this._animation.frameIntOffset : l ? f - this._animation.frameFloatOffset : 0, this._timeline = d, d.type = o, d.offset = p, 1 === u) d.frameIndicesOffset = -1, this._timelineArray[p + 5 + 0] = c.call(this, n[0], 0, 0) - this._animation.frameOffset;
- else {
- var m = this._animation.frameCount + 1,
- y = this._data.frameIndices,
- v = 0;
- t.DragonBones.webAssembly ? (v = y.size(), y.resize(v + m, 0)) : (v = y.length, y.length += m), d.frameIndicesOffset = v;
- for (var g = 0, x = 0, b = 0, A = 0; g < m; ++g) {
- if (b + A <= g && x < u) {
- var C = n[x];
- b = g, A = x === u - 1 ? this._animation.frameCount - b : C instanceof i ? this._actionFrames[x + 1].frameStart - b : r._getNumber(C, t.DataParser.DURATION, 1), this._timelineArray[p + 5 + x] = c.call(this, C, b, A) - this._animation.frameOffset, x++
- }
- t.DragonBones.webAssembly ? y.set(v + g, x - 1) : y[v + g] = x - 1
- }
- }
- return this._timeline = null, d
- }, r.prototype._parseBoneTimeline = function(e) {
- var i = this._armature.getBone(r._getString(e, t.DataParser.NAME, ""));
- if (null !== i) {
- var n;
- if (this._bone = i, this._slot = this._armature.getSlot(this._bone.name), t.DataParser.TRANSLATE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.TRANSLATE_FRAME, 11, !1, !0, 2, this._parseBoneTranslateFrame)) && this._animation.addBoneTimeline(i, n);
- if (t.DataParser.ROTATE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.ROTATE_FRAME, 12, !1, !0, 2, this._parseBoneRotateFrame)) && this._animation.addBoneTimeline(i, n);
- if (t.DataParser.SCALE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.SCALE_FRAME, 13, !1, !0, 2, this._parseBoneScaleFrame)) && this._animation.addBoneTimeline(i, n);
- if (t.DataParser.FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.FRAME, 10, !1, !0, 6, this._parseBoneAllFrame)) && this._animation.addBoneTimeline(i, n);
- this._bone = null, this._slot = null
- }
- }, r.prototype._parseSlotTimeline = function(e) {
- var i = this._armature.getSlot(r._getString(e, t.DataParser.NAME, ""));
- if (null !== i) {
- this._slot = i;
- var n = null;
- null !== (n = t.DataParser.DISPLAY_FRAME in e ? this._parseTimeline(e, null, t.DataParser.DISPLAY_FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame)) && this._animation.addSlotTimeline(i, n);
- var s = null;
- null !== (s = t.DataParser.COLOR_FRAME in e ? this._parseTimeline(e, null, t.DataParser.COLOR_FRAME, 21, !0, !1, 1, this._parseSlotColorFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 21, !0, !1, 1, this._parseSlotColorFrame)) && this._animation.addSlotTimeline(i, s), this._slot = null
- }
- }, r.prototype._parseFrame = function(t, e, i) {
- var n = this._frameArray.length;
- return this._frameArray.length += 1, this._frameArray[n + 0] = e, n
- }, r.prototype._parseTweenFrame = function(e, i, n) {
- var s = this._parseFrame(e, i, n);
- if (n > 0)
- if (t.DataParser.CURVE in e) {
- var o = n + 1;
- this._helpArray.length = o, this._samplingEasingCurve(e[t.DataParser.CURVE], this._helpArray), this._frameArray.length += 2 + this._helpArray.length, this._frameArray[s + 1] = 2, this._frameArray[s + 2] = o;
- for (var a = 0; a < o; ++a) this._frameArray[s + 3 + a] = Math.round(1e4 * this._helpArray[a])
- } else {
- var l = -2;
- t.DataParser.TWEEN_EASING in e && (l = r._getNumber(e, t.DataParser.TWEEN_EASING, -2)), -2 === l ? (this._frameArray.length += 1, this._frameArray[s + 1] = 0) : 0 === l ? (this._frameArray.length += 1, this._frameArray[s + 1] = 1) : l < 0 ? (this._frameArray.length += 2, this._frameArray[s + 1] = 3, this._frameArray[s + 2] = Math.round(100 * -l)) : l <= 1 ? (this._frameArray.length += 2, this._frameArray[s + 1] = 4, this._frameArray[s + 2] = Math.round(100 * l)) : (this._frameArray.length += 2, this._frameArray[s + 1] = 5, this._frameArray[s + 2] = Math.round(100 * l - 100))
- }
- else this._frameArray.length += 1, this._frameArray[s + 1] = 0;
- return s
- }, r.prototype._parseActionFrame = function(t, e, i) {
- var n = this._frameArray.length,
- r = t.actions.length;
- this._frameArray.length += 2 + r, this._frameArray[n + 0] = e, this._frameArray[n + 0 + 1] = r;
- for (var s = 0; s < r; ++s) this._frameArray[n + 0 + 2 + s] = t.actions[s];
- return n
- }, r.prototype._parseZOrderFrame = function(e, i, n) {
- var r = this._parseFrame(e, i, n);
- if (t.DataParser.Z_ORDER in e) {
- var s = e[t.DataParser.Z_ORDER];
- if (s.length > 0) {
- for (var o = this._armature.sortedSlots.length, a = new Array(o - s.length / 2), l = new Array(o), h = 0; h < a.length; ++h) a[h] = 0;
- for (var c = 0; c < o; ++c) l[c] = -1;
- for (var u = 0, _ = 0, f = 0, d = s.length; f < d; f += 2) {
- for (var p = s[f], m = s[f + 1]; u !== p;) a[_++] = u++;
- l[u + m] = u++
- }
- for (; u < o;) a[_++] = u++;
- this._frameArray.length += 1 + o, this._frameArray[r + 1] = o;
- for (var y = o; y--;) - 1 === l[y] ? this._frameArray[r + 2 + y] = a[--_] || 0 : this._frameArray[r + 2 + y] = l[y] || 0;
- return r
- }
- }
- return this._frameArray.length += 1, this._frameArray[r + 1] = 0, r
- }, r.prototype._parseBoneAllFrame = function(e, i, n) {
- this._helpTransform.identity(), t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], this._helpTransform, 1);
- var s = this._helpTransform.rotation;
- 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), this._prevClockwise = r._getNumber(e, t.DataParser.TWEEN_ROTATE, 0), this._prevRotation = s;
- var o = this._parseTweenFrame(e, i, n),
- a = this._frameFloatArray.length;
- return this._frameFloatArray.length += 6, this._frameFloatArray[a++] = this._helpTransform.x, this._frameFloatArray[a++] = this._helpTransform.y, this._frameFloatArray[a++] = s, this._frameFloatArray[a++] = this._helpTransform.skew, this._frameFloatArray[a++] = this._helpTransform.scaleX, this._frameFloatArray[a++] = this._helpTransform.scaleY, this._parseActionDataInFrame(e, i, this._bone, this._slot), o
- }, r.prototype._parseBoneTranslateFrame = function(e, i, n) {
- var s = this._parseTweenFrame(e, i, n),
- o = this._frameFloatArray.length;
- return this._frameFloatArray.length += 2, this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.X, 0), this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.Y, 0), s
- }, r.prototype._parseBoneRotateFrame = function(e, i, n) {
- var s = r._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD;
- 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), this._prevClockwise = r._getNumber(e, t.DataParser.CLOCK_WISE, 0), this._prevRotation = s;
- var o = this._parseTweenFrame(e, i, n),
- a = this._frameFloatArray.length;
- return this._frameFloatArray.length += 2, this._frameFloatArray[a++] = s, this._frameFloatArray[a++] = r._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD, o
- }, r.prototype._parseBoneScaleFrame = function(e, i, n) {
- var s = this._parseTweenFrame(e, i, n),
- o = this._frameFloatArray.length;
- return this._frameFloatArray.length += 2, this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.X, 1), this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.Y, 1), s
- }, r.prototype._parseSurfaceFrame = function(e, i, n) {
- var s = this._frameFloatArray.length,
- o = this._parseTweenFrame(e, i, n),
- a = e[t.DataParser.VERTICES],
- l = r._getNumber(e, t.DataParser.OFFSET, 0),
- h = this._surface.vertices.length / 2,
- c = 0,
- u = 0;
- this._frameFloatArray.length += 2 * h;
- for (var _ = 0; _ < 2 * h; _ += 2) c = _ < l || _ - l >= a.length ? 0 : a[_ - l], u = _ + 1 < l || _ + 1 - l >= a.length ? 0 : a[_ + 1 - l], this._frameFloatArray[s + _] = c, this._frameFloatArray[s + _ + 1] = u;
- if (0 === i) {
- var f = this._frameIntArray.length;
- this._frameIntArray.length += 5, this._frameIntArray[f + 0] = 0, this._frameIntArray[f + 1] = this._frameFloatArray.length - s, this._frameIntArray[f + 2] = this._frameFloatArray.length - s, this._frameIntArray[f + 3] = 0, this._frameIntArray[f + 4] = s - this._animation.frameFloatOffset, this._timelineArray[this._timeline.offset + 3] = f - this._animation.frameIntOffset
- }
- return o
- }, r.prototype._parseSlotDisplayFrame = function(e, i, n) {
- var s = this._parseFrame(e, i, n);
- return this._frameArray.length += 1, t.DataParser.VALUE in e ? this._frameArray[s + 1] = r._getNumber(e, t.DataParser.VALUE, 0) : this._frameArray[s + 1] = r._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), this._parseActionDataInFrame(e, i, this._slot.parent, this._slot), s
- }, r.prototype._parseSlotColorFrame = function(e, i, n) {
- var r = this._parseTweenFrame(e, i, n),
- s = -1;
- if (t.DataParser.VALUE in e || t.DataParser.COLOR in e) {
- var o = t.DataParser.VALUE in e ? e[t.DataParser.VALUE] : e[t.DataParser.COLOR];
- for (var a in o) {
- this._parseColorTransform(o, this._helpColorTransform), s = this._intArray.length, this._intArray.length += 8, this._intArray[s++] = Math.round(100 * this._helpColorTransform.alphaMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.redMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.greenMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.blueMultiplier), this._intArray[s++] = Math.round(this._helpColorTransform.alphaOffset), this._intArray[s++] = Math.round(this._helpColorTransform.redOffset), this._intArray[s++] = Math.round(this._helpColorTransform.greenOffset), this._intArray[s++] = Math.round(this._helpColorTransform.blueOffset), s -= 8;
- break
- }
- }
- s < 0 && (this._defaultColorOffset < 0 && (this._defaultColorOffset = s = this._intArray.length, this._intArray.length += 8, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 0, this._intArray[s++] = 0, this._intArray[s++] = 0, this._intArray[s++] = 0), s = this._defaultColorOffset);
- var l = this._frameIntArray.length;
- return this._frameIntArray.length += 1, this._frameIntArray[l] = s, r
- }, r.prototype._parseSlotFFDFrame = function(e, i, n) {
- var s = this._frameFloatArray.length,
- o = this._parseTweenFrame(e, i, n),
- a = t.DataParser.VERTICES in e ? e[t.DataParser.VERTICES] : null,
- l = r._getNumber(e, t.DataParser.OFFSET, 0),
- h = this._intArray[this._mesh.vertices.offset + 0],
- c = this._mesh.parent.name + "_" + this._slot.name + "_" + this._mesh.name,
- u = this._mesh.vertices.weight,
- _ = 0,
- f = 0,
- d = 0,
- p = 0;
- if (null !== u) {
- var m = this._weightSlotPose[c];
- this._helpMatrixA.copyFromArray(m, 0), this._frameFloatArray.length += 2 * u.count, d = u.offset + 2 + u.bones.length
- } else this._frameFloatArray.length += 2 * h;
- for (var y = 0; y < 2 * h; y += 2)
- if (null === a ? (_ = 0, f = 0) : (_ = y < l || y - l >= a.length ? 0 : a[y - l], f = y + 1 < l || y + 1 - l >= a.length ? 0 : a[y + 1 - l]), null !== u) {
- var v = this._weightBonePoses[c],
- g = this._intArray[d++];
- this._helpMatrixA.transformPoint(_, f, this._helpPoint, !0), _ = this._helpPoint.x, f = this._helpPoint.y;
- for (var x = 0; x < g; ++x) {
- var b = this._intArray[d++];
- this._helpMatrixB.copyFromArray(v, 7 * b + 1), this._helpMatrixB.invert(), this._helpMatrixB.transformPoint(_, f, this._helpPoint, !0), this._frameFloatArray[s + p++] = this._helpPoint.x, this._frameFloatArray[s + p++] = this._helpPoint.y
- }
- } else this._frameFloatArray[s + y] = _, this._frameFloatArray[s + y + 1] = f;
- if (0 === i) {
- var A = this._frameIntArray.length;
- this._frameIntArray.length += 5, this._frameIntArray[A + 0] = this._mesh.vertices.offset, this._frameIntArray[A + 1] = this._frameFloatArray.length - s, this._frameIntArray[A + 2] = this._frameFloatArray.length - s, this._frameIntArray[A + 3] = 0, this._frameIntArray[A + 4] = s - this._animation.frameFloatOffset, this._timelineArray[this._timeline.offset + 3] = A - this._animation.frameIntOffset
- }
- return o
- }, r.prototype._parseIKConstraintFrame = function(e, i, n) {
- var s = this._parseTweenFrame(e, i, n),
- o = this._frameIntArray.length;
- return this._frameIntArray.length += 2, this._frameIntArray[o++] = r._getBoolean(e, t.DataParser.BEND_POSITIVE, !0) ? 1 : 0, this._frameIntArray[o++] = Math.round(100 * r._getNumber(e, t.DataParser.WEIGHT, 1)), s
- }, r.prototype._parseAnimationFrame = function(e, i, n) {
- var s = this._parseTweenFrame(e, i, n),
- o = this._frameIntArray.length;
- return this._frameIntArray.length += 2, this._frameIntArray[o++] = r._getNumber(e, t.DataParser.VALUE, 0), this._frameIntArray[o++] = Math.round(100 * r._getNumber(e, t.DataParser.WEIGHT, 1)), s
- }, r.prototype._parseActionData = function(e, i, n, s) {
- var o = new Array;
- if ("string" == typeof e)(c = t.BaseObject.borrowObject(t.ActionData)).type = i, c.name = e, c.bone = n, c.slot = s, o.push(c);
- else if (e instanceof Array)
- for (var a = 0, l = e; a < l.length; a++) {
- var h = l[a],
- c = t.BaseObject.borrowObject(t.ActionData);
- if (t.DataParser.GOTO_AND_PLAY in h ? (c.type = 0, c.name = r._getString(h, t.DataParser.GOTO_AND_PLAY, "")) : (t.DataParser.TYPE in h && "string" == typeof h[t.DataParser.TYPE] ? c.type = t.DataParser._getActionType(h[t.DataParser.TYPE]) : c.type = r._getNumber(h, t.DataParser.TYPE, i), c.name = r._getString(h, t.DataParser.NAME, "")), t.DataParser.BONE in h) {
- var u = r._getString(h, t.DataParser.BONE, "");
- c.bone = this._armature.getBone(u)
- } else c.bone = n;
- if (t.DataParser.SLOT in h) {
- var _ = r._getString(h, t.DataParser.SLOT, "");
- c.slot = this._armature.getSlot(_)
- } else c.slot = s;
- var f = null;
- if (t.DataParser.INTS in h) {
- null === f && (f = t.BaseObject.borrowObject(t.UserData));
- for (var d = 0, p = h[t.DataParser.INTS]; d < p.length; d++) {
- var m = p[d];
- f.addInt(m)
- }
- }
- if (t.DataParser.FLOATS in h) {
- null === f && (f = t.BaseObject.borrowObject(t.UserData));
- for (var y = 0, v = h[t.DataParser.FLOATS]; y < v.length; y++) {
- m = v[y];
- f.addFloat(m)
- }
- }
- if (t.DataParser.STRINGS in h) {
- null === f && (f = t.BaseObject.borrowObject(t.UserData));
- for (var g = 0, x = h[t.DataParser.STRINGS]; g < x.length; g++) {
- m = x[g];
- f.addString(m)
- }
- }
- c.data = f, o.push(c)
- }
- return o
- }, r.prototype._parseTransform = function(e, i, n) {
- i.x = r._getNumber(e, t.DataParser.X, 0) * n, i.y = r._getNumber(e, t.DataParser.Y, 0) * n, t.DataParser.ROTATE in e || t.DataParser.SKEW in e ? (i.rotation = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD), i.skew = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD)) : (t.DataParser.SKEW_X in e || t.DataParser.SKEW_Y in e) && (i.rotation = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW_Y, 0) * t.Transform.DEG_RAD), i.skew = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW_X, 0) * t.Transform.DEG_RAD) - i.rotation), i.scaleX = r._getNumber(e, t.DataParser.SCALE_X, 1), i.scaleY = r._getNumber(e, t.DataParser.SCALE_Y, 1)
- }, r.prototype._parseColorTransform = function(e, i) {
- i.alphaMultiplier = .01 * r._getNumber(e, t.DataParser.ALPHA_MULTIPLIER, 100), i.redMultiplier = .01 * r._getNumber(e, t.DataParser.RED_MULTIPLIER, 100), i.greenMultiplier = .01 * r._getNumber(e, t.DataParser.GREEN_MULTIPLIER, 100), i.blueMultiplier = .01 * r._getNumber(e, t.DataParser.BLUE_MULTIPLIER, 100), i.alphaOffset = r._getNumber(e, t.DataParser.ALPHA_OFFSET, 0), i.redOffset = r._getNumber(e, t.DataParser.RED_OFFSET, 0), i.greenOffset = r._getNumber(e, t.DataParser.GREEN_OFFSET, 0), i.blueOffset = r._getNumber(e, t.DataParser.BLUE_OFFSET, 0)
- }, r.prototype._parseArray = function(t) {
- this._intArray.length = 0, this._floatArray.length = 0, this._frameIntArray.length = 0, this._frameFloatArray.length = 0, this._frameArray.length = 0, this._timelineArray.length = 0
- }, r.prototype._modifyArray = function() {
- this._intArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._intArray.push(0), this._frameIntArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameIntArray.push(0), this._frameArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameArray.push(0), this._timelineArray.length % Uint16Array.BYTES_PER_ELEMENT != 0 && this._timelineArray.push(0);
- var e = this._intArray.length * Int16Array.BYTES_PER_ELEMENT,
- i = this._floatArray.length * Float32Array.BYTES_PER_ELEMENT,
- n = this._frameIntArray.length * Int16Array.BYTES_PER_ELEMENT,
- r = this._frameFloatArray.length * Float32Array.BYTES_PER_ELEMENT,
- s = this._frameArray.length * Int16Array.BYTES_PER_ELEMENT,
- o = this._timelineArray.length * Uint16Array.BYTES_PER_ELEMENT,
- a = e + i + n + r + s + o;
- if (t.DragonBones.webAssembly) {
- for (var l = t.webAssemblyModule.HEAP16.buffer, h = t.webAssemblyModule._malloc(a), c = new Int16Array(l, h, this._intArray.length), u = new Float32Array(l, h + e, this._floatArray.length), _ = new Int16Array(l, h + e + i, this._frameIntArray.length), f = new Float32Array(l, h + e + i + n, this._frameFloatArray.length), d = new Int16Array(l, h + e + i + n + r, this._frameArray.length), p = new Uint16Array(l, h + e + i + n + r + s, this._timelineArray.length), m = 0, y = this._intArray.length; m < y; ++m) c[m] = this._intArray[m];
- for (m = 0, y = this._floatArray.length; m < y; ++m) u[m] = this._floatArray[m];
- for (m = 0, y = this._frameIntArray.length; m < y; ++m) _[m] = this._frameIntArray[m];
- for (m = 0, y = this._frameFloatArray.length; m < y; ++m) f[m] = this._frameFloatArray[m];
- for (m = 0, y = this._frameArray.length; m < y; ++m) d[m] = this._frameArray[m];
- for (m = 0, y = this._timelineArray.length; m < y; ++m) p[m] = this._timelineArray[m];
- t.webAssemblyModule.setDataBinary(this._data, h, e, i, n, r, s, o)
- } else {
- var v = new ArrayBuffer(a);
- for (c = new Int16Array(v, 0, this._intArray.length), u = new Float32Array(v, e, this._floatArray.length), _ = new Int16Array(v, e + i, this._frameIntArray.length), f = new Float32Array(v, e + i + n, this._frameFloatArray.length), d = new Int16Array(v, e + i + n + r, this._frameArray.length), p = new Uint16Array(v, e + i + n + r + s, this._timelineArray.length), m = 0, y = this._intArray.length; m < y; ++m) c[m] = this._intArray[m];
- for (m = 0, y = this._floatArray.length; m < y; ++m) u[m] = this._floatArray[m];
- for (m = 0, y = this._frameIntArray.length; m < y; ++m) _[m] = this._frameIntArray[m];
- for (m = 0, y = this._frameFloatArray.length; m < y; ++m) f[m] = this._frameFloatArray[m];
- for (m = 0, y = this._frameArray.length; m < y; ++m) d[m] = this._frameArray[m];
- for (m = 0, y = this._timelineArray.length; m < y; ++m) p[m] = this._timelineArray[m];
- this._data.binary = v, this._data.intArray = c, this._data.floatArray = u, this._data.frameIntArray = _, this._data.frameFloatArray = f, this._data.frameArray = d, this._data.timelineArray = p
- }
- this._defaultColorOffset = -1
- }, r.prototype.parseDragonBonesData = function(e, i) {
- void 0 === i && (i = 1), console.assert(null !== e && void 0 !== e, "Data error.");
- var n = r._getString(e, t.DataParser.VERSION, ""),
- s = r._getString(e, t.DataParser.COMPATIBLE_VERSION, "");
- if (t.DataParser.DATA_VERSIONS.indexOf(n) >= 0 || t.DataParser.DATA_VERSIONS.indexOf(s) >= 0) {
- var o = t.BaseObject.borrowObject(t.DragonBonesData);
- if (o.version = n, o.name = r._getString(e, t.DataParser.NAME, ""), o.frameRate = r._getNumber(e, t.DataParser.FRAME_RATE, 24), 0 === o.frameRate && (o.frameRate = 24), t.DataParser.ARMATURE in e) {
- this._data = o, this._parseArray(e);
- for (var a = 0, l = e[t.DataParser.ARMATURE]; a < l.length; a++) {
- var h = l[a];
- o.addArmature(this._parseArmature(h, i))
- }
- this._data.binary || this._modifyArray(), t.DataParser.STAGE in e ? o.stage = o.getArmature(r._getString(e, t.DataParser.STAGE, "")) : o.armatureNames.length > 0 && (o.stage = o.getArmature(o.armatureNames[0])), this._data = null
- }
- return t.DataParser.TEXTURE_ATLAS in e && (this._rawTextureAtlases = e[t.DataParser.TEXTURE_ATLAS]), o
- }
- return console.assert(!1, "Nonsupport data version: " + n + "\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"), null
- }, r.prototype.parseTextureAtlasData = function(e, i, n) {
- if (void 0 === n && (n = 1), console.assert(void 0 !== e), null === e) {
- if (null === this._rawTextureAtlases || 0 === this._rawTextureAtlases.length) return !1;
- var s = this._rawTextureAtlases[this._rawTextureAtlasIndex++];
- return this.parseTextureAtlasData(s, i, n), this._rawTextureAtlasIndex >= this._rawTextureAtlases.length && (this._rawTextureAtlasIndex = 0, this._rawTextureAtlases = null), !0
- }
- if (i.width = r._getNumber(e, t.DataParser.WIDTH, 0), i.height = r._getNumber(e, t.DataParser.HEIGHT, 0), i.scale = 1 === n ? 1 / r._getNumber(e, t.DataParser.SCALE, 1) : n, i.name = r._getString(e, t.DataParser.NAME, ""), i.imagePath = r._getString(e, t.DataParser.IMAGE_PATH, ""), t.DataParser.SUB_TEXTURE in e)
- for (var o = e[t.DataParser.SUB_TEXTURE], a = 0, l = o.length; a < l; ++a) {
- var h = o[a],
- c = i.createTexture();
- c.rotated = r._getBoolean(h, t.DataParser.ROTATED, !1), c.name = r._getString(h, t.DataParser.NAME, ""), c.region.x = r._getNumber(h, t.DataParser.X, 0), c.region.y = r._getNumber(h, t.DataParser.Y, 0), c.region.width = r._getNumber(h, t.DataParser.WIDTH, 0), c.region.height = r._getNumber(h, t.DataParser.HEIGHT, 0);
- var u = r._getNumber(h, t.DataParser.FRAME_WIDTH, -1),
- _ = r._getNumber(h, t.DataParser.FRAME_HEIGHT, -1);
- u > 0 && _ > 0 && (c.frame = t.TextureData.createRectangle(), c.frame.x = r._getNumber(h, t.DataParser.FRAME_X, 0), c.frame.y = r._getNumber(h, t.DataParser.FRAME_Y, 0), c.frame.width = u, c.frame.height = _), i.addTexture(c)
- }
- return !0
- }, r.getInstance = function() {
- return null === r._objectDataParserInstance && (r._objectDataParserInstance = new r), r._objectDataParserInstance
- }, r._objectDataParserInstance = null, r
- })(t.DataParser);
- t.ObjectDataParser = e;
- var i = (function() {
- return function() {
- this.frameStart = 0, this.actions = []
- }
- })();
- t.ActionFrame = i
- })(r || (r = {})), (function(t) {
- var e = (function(e) {
- function i() {
- return null !== e && e.apply(this, arguments) || this
- }
- return n(i, e), i.prototype._inRange = function(t, e, i) {
- return e <= t && t <= i
- }, i.prototype._decodeUTF8 = function(t) {
- for (var e, i = 0, n = "", r = 0, s = 0, o = 0, a = 0; t.length > i;) {
- var l = t[i++];
- if (-1 === l) e = 0 !== s ? 65533 : -1;
- else if (0 === s) this._inRange(l, 0, 127) ? e = l : (this._inRange(l, 194, 223) ? (s = 1, a = 128, r = l - 192) : this._inRange(l, 224, 239) ? (s = 2, a = 2048, r = l - 224) : this._inRange(l, 240, 244) && (s = 3, a = 65536, r = l - 240), r *= Math.pow(64, s), e = null);
- else if (this._inRange(l, 128, 191))
- if (o += 1, r += (l - 128) * Math.pow(64, s - o), o !== s) e = null;
- else {
- var h = r,
- c = a;
- r = 0, s = 0, o = 0, a = 0, e = this._inRange(h, c, 1114111) && !this._inRange(h, 55296, 57343) ? h : l
- }
- else r = 0, s = 0, o = 0, a = 0, i--, e = l;
- null !== e && -1 !== e && (e <= 65535 ? e > 0 && (n += String.fromCharCode(e)) : (e -= 65536, n += String.fromCharCode(55296 + (e >> 10 & 1023)), n += String.fromCharCode(56320 + (1023 & e))))
- }
- return n
- }, i.prototype._getUTF16Key = function(t) {
- for (var e = 0, i = t.length; e < i; ++e)
- if (t.charCodeAt(e) > 255) return encodeURI(t);
- return t
- }, i.prototype._parseBinaryTimeline = function(e, i, n) {
- void 0 === n && (n = null);
- var r = null !== n ? n : t.BaseObject.borrowObject(t.TimelineData);
- r.type = e, r.offset = i, this._timeline = r;
- var s = this._timelineArrayBuffer[r.offset + 2];
- if (1 === s) r.frameIndicesOffset = -1;
- else {
- var o = 0,
- a = this._animation.frameCount + 1,
- l = this._data.frameIndices;
- t.DragonBones.webAssembly ? (o = l.size(), l.resize(o + a, 0)) : (o = l.length, l.length += a), r.frameIndicesOffset = o;
- for (var h = 0, c = 0, u = 0, _ = 0; h < a; ++h) u + _ <= h && c < s && (u = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c]], _ = c === s - 1 ? this._animation.frameCount - u : this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c + 1]] - u, c++), t.DragonBones.webAssembly ? l.set(o + h, c - 1) : l[o + h] = c - 1
- }
- return this._timeline = null, r
- }, i.prototype._parseVertices = function(e, i) {
- i.offset = e[t.DataParser.OFFSET];
- var n = this._intArrayBuffer[i.offset + 3];
- if (n >= 0) {
- var r = t.BaseObject.borrowObject(t.WeightData),
- s = this._intArrayBuffer[i.offset + 0],
- o = this._intArrayBuffer[n + 0];
- r.offset = n;
- for (var a = 0; a < o; ++a) {
- var l = this._intArrayBuffer[n + 2 + a];
- r.addBone(this._rawBones[l])
- }
- for (var h = n + 2 + o, c = 0, u = (a = 0, s); a < u; ++a) {
- var _ = this._intArrayBuffer[h++];
- c += _, h += _
- }
- r.count = c, i.weight = r
- }
- }, i.prototype._parseMesh = function(t, e) {
- this._parseVertices(t, e.vertices)
- }, i.prototype._parsePath = function(t, e) {
- this._parseVertices(t, e.vertices)
- }, i.prototype._parseAnimation = function(e) {
- var i = t.BaseObject.borrowObject(t.AnimationData);
- i.frameCount = Math.max(t.ObjectDataParser._getNumber(e, t.DataParser.DURATION, 1), 1), i.playTimes = t.ObjectDataParser._getNumber(e, t.DataParser.PLAY_TIMES, 1), i.duration = i.frameCount / this._armature.frameRate, i.fadeInTime = t.ObjectDataParser._getNumber(e, t.DataParser.FADE_IN_TIME, 0), i.scale = t.ObjectDataParser._getNumber(e, t.DataParser.SCALE, 1), i.name = t.ObjectDataParser._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME);
- var n = e[t.DataParser.OFFSET];
- if (i.frameIntOffset = n[0], i.frameFloatOffset = n[1], i.frameOffset = n[2], this._animation = i, t.DataParser.ACTION in e && (i.actionTimeline = this._parseBinaryTimeline(0, e[t.DataParser.ACTION])), t.DataParser.Z_ORDER in e && (i.zOrderTimeline = this._parseBinaryTimeline(1, e[t.DataParser.Z_ORDER])), t.DataParser.BONE in e) {
- var r = e[t.DataParser.BONE];
- for (var s in r) {
- var o = r[s];
- t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
- var a = this._armature.getBone(s);
- if (null !== a)
- for (var l = 0, h = o.length; l < h; l += 2) {
- var c = o[l],
- u = o[l + 1],
- _ = this._parseBinaryTimeline(c, u);
- this._animation.addBoneTimeline(a, _)
- }
- }
- }
- if (t.DataParser.SURFACE in e) {
- r = e[t.DataParser.SURFACE];
- for (var s in r) {
- o = r[s];
- t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
- var f = this._armature.getBone(s);
- if (null !== f)
- for (l = 0, h = o.length; l < h; l += 2) {
- c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
- this._animation.addSurfaceTimeline(f, _)
- }
- }
- }
- if (t.DataParser.SLOT in e) {
- r = e[t.DataParser.SLOT];
- for (var s in r) {
- o = r[s];
- t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
- var d = this._armature.getSlot(s);
- if (null !== d)
- for (l = 0, h = o.length; l < h; l += 2) {
- c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
- this._animation.addSlotTimeline(d, _)
- }
- }
- }
- if (t.DataParser.CONSTRAINT in e) {
- r = e[t.DataParser.CONSTRAINT];
- for (var s in r) {
- o = r[s];
- t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
- var p = this._armature.getConstraint(s);
- if (null !== p)
- for (l = 0, h = o.length; l < h; l += 2) {
- c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
- this._animation.addConstraintTimeline(p, _)
- }
- }
- }
- if (t.DataParser.ANIMATION in e) {
- r = e[t.DataParser.ANIMATION];
- for (var s in r) {
- o = r[s];
- t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
- for (l = 0, h = o.length; l < h; l += 2) {
- c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
- this._animation.addAnimationTimeline(s, _)
- }
- }
- }
- return this._animation = null, i
- }, i.prototype._parseArray = function(e) {
- var i = e[t.DataParser.OFFSET],
- n = i[1],
- r = i[3],
- s = i[5],
- o = i[7],
- a = i[9],
- l = i[11],
- h = new Int16Array(this._binary, this._binaryOffset + i[0], n / Int16Array.BYTES_PER_ELEMENT),
- c = new Float32Array(this._binary, this._binaryOffset + i[2], r / Float32Array.BYTES_PER_ELEMENT),
- u = new Int16Array(this._binary, this._binaryOffset + i[4], s / Int16Array.BYTES_PER_ELEMENT),
- _ = new Float32Array(this._binary, this._binaryOffset + i[6], o / Float32Array.BYTES_PER_ELEMENT),
- f = new Int16Array(this._binary, this._binaryOffset + i[8], a / Int16Array.BYTES_PER_ELEMENT),
- d = new Uint16Array(this._binary, this._binaryOffset + i[10], l / Uint16Array.BYTES_PER_ELEMENT);
- if (t.DragonBones.webAssembly) {
- for (var p = n + r + s + o + a + l, m = t.webAssemblyModule._malloc(p), y = new Uint8Array(this._binary, this._binaryOffset, p / Uint8Array.BYTES_PER_ELEMENT), v = new Uint8Array(t.webAssemblyModule.HEAP16.buffer, m, y.length), g = 0, x = y.length; g < x; ++g) v[g] = y[g];
- t.webAssemblyModule.setDataBinary(this._data, m, n, r, s, o, a, l), this._intArrayBuffer = h, this._floatArrayBuffer = c, this._frameIntArrayBuffer = u, this._frameFloatArrayBuffer = _, this._frameArrayBuffer = f, this._timelineArrayBuffer = d
- } else this._data.binary = this._binary, this._data.intArray = this._intArrayBuffer = h, this._data.floatArray = this._floatArrayBuffer = c, this._data.frameIntArray = this._frameIntArrayBuffer = u, this._data.frameFloatArray = this._frameFloatArrayBuffer = _, this._data.frameArray = this._frameArrayBuffer = f, this._data.timelineArray = this._timelineArrayBuffer = d
- }, i.prototype.parseDragonBonesData = function(t, i) {
- void 0 === i && (i = 1), console.assert(null !== t && void 0 !== t && t instanceof ArrayBuffer, "Data error.");
- var n = new Uint8Array(t, 0, 8);
- if (n[0] !== "D".charCodeAt(0) || n[1] !== "B".charCodeAt(0) || n[2] !== "D".charCodeAt(0) || n[3] !== "T".charCodeAt(0)) return console.assert(!1, "Nonsupport data."), null;
- var r = new Uint32Array(t, 8, 1)[0],
- s = new Uint8Array(t, 12, r),
- o = this._decodeUTF8(s),
- a = JSON.parse(o);
- return this._binaryOffset = 12 + r, this._binary = t, e.prototype.parseDragonBonesData.call(this, a, i)
- }, i.getInstance = function() {
- return null === i._binaryDataParserInstance && (i._binaryDataParserInstance = new i), i._binaryDataParserInstance
- }, i._binaryDataParserInstance = null, i
- })(t.ObjectDataParser);
- t.BinaryDataParser = e
- })(r || (r = {})), (function(t) {
- var e = (function() {
- function e(i) {
- void 0 === i && (i = null), this.autoSearch = !1, this._dragonBonesDataMap = {}, this._textureAtlasDataMap = {}, this._dragonBones = null, this._dataParser = null, null === e._objectParser && (e._objectParser = new t.ObjectDataParser), null === e._binaryParser && (e._binaryParser = new t.BinaryDataParser), this._dataParser = null !== i ? i : e._objectParser
- }
- return e.prototype._isSupportMesh = function() {
- return !0
- }, e.prototype._getTextureData = function(t, e) {
- if (t in this._textureAtlasDataMap)
- for (var i = 0, n = this._textureAtlasDataMap[t]; i < n.length; i++) {
- if (null !== (l = (a = n[i]).getTexture(e))) return l
- }
- if (this.autoSearch)
- for (var r in this._textureAtlasDataMap)
- for (var s = 0, o = this._textureAtlasDataMap[r]; s < o.length; s++) {
- var a, l;
- if ((a = o[s]).autoSearch)
- if (null !== (l = a.getTexture(e))) return l
- }
- return null
- }, e.prototype._fillBuildArmaturePackage = function(t, e, i, n, r) {
- var s = null,
- o = null;
- if (e.length > 0 && e in this._dragonBonesDataMap && (o = (s = this._dragonBonesDataMap[e]).getArmature(i)), null === o && (0 === e.length || this.autoSearch))
- for (var a in this._dragonBonesDataMap)
- if (s = this._dragonBonesDataMap[a], (0 === e.length || s.autoSearch) && null !== (o = s.getArmature(i))) {
- e = a;
- break
- }
- if (null !== o) {
- if (t.dataName = e, t.textureAtlasName = r, t.data = s, t.armature = o, t.skin = null, n.length > 0 && (t.skin = o.getSkin(n), null === t.skin && this.autoSearch))
- for (var a in this._dragonBonesDataMap) {
- var l = this._dragonBonesDataMap[a].getArmature(n);
- if (null !== l) {
- t.skin = l.defaultSkin;
- break
- }
- }
- return null === t.skin && (t.skin = o.defaultSkin), !0
- }
- return !1
- }, e.prototype._buildBones = function(e, i) {
- for (var n = 0, r = e.armature.sortedBones; n < r.length; n++) {
- var s = r[n];
- t.BaseObject.borrowObject(0 === s.type ? t.Bone : t.Surface).init(s, i)
- }
- }, e.prototype._buildSlots = function(e, i) {
- var n = e.skin,
- r = e.armature.defaultSkin;
- if (null !== n && null !== r) {
- var s = {};
- for (var o in r.displays) {
- var a = r.getDisplays(o);
- s[o] = a
- }
- if (n !== r)
- for (var o in n.displays) {
- a = n.getDisplays(o);
- s[o] = a
- }
- for (var l = 0, h = e.armature.sortedSlots; l < h.length; l++) {
- var c = h[l],
- u = c.name in s ? s[c.name] : null,
- _ = this._buildSlot(e, c, i);
- if (_.rawDisplayDatas = u, null !== u) {
- for (var f = new Array, d = 0, p = t.DragonBones.webAssembly ? u.size() : u.length; d < p; ++d) {
- var m = t.DragonBones.webAssembly ? u.get(d) : u[d];
- null !== m ? f.push(this._getSlotDisplay(e, m, null, _)) : f.push(null)
- }
- _._setDisplayList(f)
- }
- _._setDisplayIndex(c.displayIndex, !0)
- }
- }
- }, e.prototype._buildConstraints = function(e, i) {
- var n = e.armature.constraints;
- for (var r in n) {
- var s = n[r];
- switch (s.type) {
- case 0:
- var o = t.BaseObject.borrowObject(t.IKConstraint);
- o.init(s, i), i._addConstraint(o);
- break;
- case 1:
- var a = t.BaseObject.borrowObject(t.PathConstraint);
- a.init(s, i), i._addConstraint(a);
- break;
- default:
- var l = t.BaseObject.borrowObject(t.IKConstraint);
- l.init(s, i), i._addConstraint(l)
- }
- }
- }, e.prototype._buildChildArmature = function(t, e, i) {
- return this.buildArmature(i.path, null !== t ? t.dataName : "", "", null !== t ? t.textureAtlasName : "")
- }, e.prototype._getSlotDisplay = function(e, i, n, r) {
- var s = null !== e ? e.dataName : i.parent.parent.parent.name,
- o = null;
- switch (i.type) {
- case 0:
- var a = i;
- null !== e && e.textureAtlasName.length > 0 && (a.texture = this._getTextureData(e.textureAtlasName, i.path)), null === a.texture && (a.texture = this._getTextureData(s, i.path)), o = null !== n && 2 === n.type && this._isSupportMesh() ? r.meshDisplay : r.rawDisplay;
- break;
- case 2:
- var l = i;
- null !== e && e.textureAtlasName.length > 0 && (l.texture = this._getTextureData(e.textureAtlasName, l.path)), null === l.texture && (l.texture = this._getTextureData(s, l.path)), o = this._isSupportMesh() ? r.meshDisplay : r.rawDisplay;
- break;
- case 1:
- var h = i,
- c = this._buildChildArmature(e, r, i);
- if (null !== c) {
- if (c.inheritAnimation = h.inheritAnimation, !c.inheritAnimation) {
- var u = h.actions.length > 0 ? h.actions : c.armatureData.defaultActions;
- if (u.length > 0)
- for (var _ = 0, f = u; _ < f.length; _++) {
- var d = f[_],
- p = t.BaseObject.borrowObject(t.EventObject);
- t.EventObject.actionDataToInstance(d, p, r.armature), p.slot = r, r.armature._bufferAction(p, !1)
- } else c.animation.play()
- }
- h.armature = c.armatureData
- }
- o = c
- }
- return o
- }, e.prototype.parseDragonBonesData = function(t, i, n) {
- void 0 === i && (i = null), void 0 === n && (n = 1);
- for (var r = t instanceof ArrayBuffer ? e._binaryParser : this._dataParser, s = r.parseDragonBonesData(t, n);;) {
- var o = this._buildTextureAtlasData(null, null);
- if (!r.parseTextureAtlasData(null, o, n)) {
- o.returnToPool();
- break
- }
- this.addTextureAtlasData(o, i)
- }
- return null !== s && this.addDragonBonesData(s, i), s
- }, e.prototype.parseTextureAtlasData = function(t, e, i, n) {
- void 0 === i && (i = null), void 0 === n && (n = 1);
- var r = this._buildTextureAtlasData(null, null);
- return this._dataParser.parseTextureAtlasData(t, r, n), this._buildTextureAtlasData(r, e || null), this.addTextureAtlasData(r, i), r
- }, e.prototype.updateTextureAtlasData = function(t, e) {
- var i = this.getTextureAtlasData(t);
- if (null !== i)
- for (var n = 0, r = i.length; n < r; ++n) n < e.length && this._buildTextureAtlasData(i[n], e[n])
- }, e.prototype.getDragonBonesData = function(t) {
- return t in this._dragonBonesDataMap ? this._dragonBonesDataMap[t] : null
- }, e.prototype.addDragonBonesData = function(t, e) {
- if (void 0 === e && (e = null), (e = null !== e ? e : t.name) in this._dragonBonesDataMap) {
- if (this._dragonBonesDataMap[e] === t) return;
- console.warn("Can not add same name data: " + e)
- } else this._dragonBonesDataMap[e] = t
- }, e.prototype.removeDragonBonesData = function(t, e) {
- void 0 === e && (e = !0), t in this._dragonBonesDataMap && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[t]), delete this._dragonBonesDataMap[t])
- }, e.prototype.getTextureAtlasData = function(t) {
- return t in this._textureAtlasDataMap ? this._textureAtlasDataMap[t] : null
- }, e.prototype.addTextureAtlasData = function(t, e) {
- void 0 === e && (e = null);
- var i = (e = null !== e ? e : t.name) in this._textureAtlasDataMap ? this._textureAtlasDataMap[e] : this._textureAtlasDataMap[e] = [];
- i.indexOf(t) < 0 && i.push(t)
- }, e.prototype.removeTextureAtlasData = function(t, e) {
- if (void 0 === e && (e = !0), t in this._textureAtlasDataMap) {
- var i = this._textureAtlasDataMap[t];
- if (e)
- for (var n = 0, r = i; n < r.length; n++) {
- var s = r[n];
- this._dragonBones.bufferObject(s)
- }
- delete this._textureAtlasDataMap[t]
- }
- }, e.prototype.getArmatureData = function(t, e) {
- void 0 === e && (e = "");
- var n = new i;
- return this._fillBuildArmaturePackage(n, e, t, "", "") ? n.armature : null
- }, e.prototype.clear = function(t) {
- for (var e in void 0 === t && (t = !0), this._dragonBonesDataMap) t && this._dragonBones.bufferObject(this._dragonBonesDataMap[e]), delete this._dragonBonesDataMap[e];
- for (var e in this._textureAtlasDataMap) {
- if (t)
- for (var i = 0, n = this._textureAtlasDataMap[e]; i < n.length; i++) {
- var r = n[i];
- this._dragonBones.bufferObject(r)
- }
- delete this._textureAtlasDataMap[e]
- }
- }, e.prototype.buildArmature = function(t, e, n, r) {
- void 0 === e && (e = ""), void 0 === n && (n = ""), void 0 === r && (r = "");
- var s = new i;
- if (!this._fillBuildArmaturePackage(s, e || "", t, n || "", r || "")) return console.warn("No armature data: " + t + ", " + (null !== e ? e : "")), null;
- var o = this._buildArmature(s);
- return this._buildBones(s, o), this._buildSlots(s, o), this._buildConstraints(s, o), o.invalidUpdate(null, !0), o.advanceTime(0), o
- }, e.prototype.replaceDisplay = function(e, i, n) {
- void 0 === n && (n = -1), n < 0 && (n = e.displayIndex), n < 0 && (n = 0), e.replaceDisplayData(i, n);
- var r = e.displayList;
- if (r.length <= n) {
- r.length = n + 1;
- for (var s = 0, o = r.length; s < o; ++s) r[s] || (r[s] = null)
- }
- if (null !== i) {
- var a = e.rawDisplayDatas,
- l = null;
- a && (t.DragonBones.webAssembly ? n < a.size() && (l = a.get(n)) : n < a.length && (l = a[n])), r[n] = this._getSlotDisplay(null, i, l, e)
- } else r[n] = null;
- e.displayList = r
- }, e.prototype.replaceSlotDisplay = function(t, e, i, n, r, s) {
- void 0 === s && (s = -1);
- var o = this.getArmatureData(e, t || "");
- if (!o || !o.defaultSkin) return !1;
- var a = o.defaultSkin.getDisplay(i, n);
- return !!a && (this.replaceDisplay(r, a, s), !0)
- }, e.prototype.replaceSlotDisplayList = function(e, i, n, r) {
- var s = this.getArmatureData(i, e || "");
- if (!s || !s.defaultSkin) return !1;
- var o = s.defaultSkin.getDisplays(n);
- if (!o) return !1;
- for (var a = 0, l = 0, h = t.DragonBones.webAssembly ? o.size() : o.length; l < h; ++l) {
- var c = t.DragonBones.webAssembly ? o.get(l) : o[l];
- this.replaceDisplay(r, c, a++)
- }
- return !0
- }, e.prototype.replaceSkin = function(e, i, n, r) {
- void 0 === n && (n = !1), void 0 === r && (r = null);
- for (var s = !1, o = i.parent.defaultSkin, a = 0, l = e.getSlots(); a < l.length; a++) {
- var h = l[a];
- if (!(null !== r && r.indexOf(h.name) >= 0)) {
- var c = i.getDisplays(h.name);
- if (c || (null !== o && i !== o && (c = o.getDisplays(h.name)), c)) {
- var u = t.DragonBones.webAssembly ? c.size() : c.length,
- _ = h.displayList;
- _.length = u;
- for (var f = 0, d = u; f < d; ++f) {
- var p = t.DragonBones.webAssembly ? c.get(f) : c[f];
- _[f] = null !== p ? this._getSlotDisplay(null, p, null, h) : null
- }
- s = !0, h.rawDisplayDatas = c, h.displayList = _
- } else n && (h.rawDisplayDatas = null, h.displayList = [])
- }
- }
- return s
- }, e.prototype.replaceAnimation = function(e, i, n) {
- void 0 === n && (n = !0);
- var r = i.defaultSkin;
- if (null === r) return !1;
- if (n) e.animation.animations = i.animations;
- else {
- var s = e.animation.animations,
- o = {};
- for (var a in s) o[a] = s[a];
- for (var a in i.animations) o[a] = i.animations[a];
- e.animation.animations = o
- }
- for (var l = 0, h = e.getSlots(); l < h.length; l++)
- for (var c = h[l], u = 0, _ = 0, f = c.displayList; _ < f.length; _++) {
- var d = f[_];
- if (d instanceof t.Armature) {
- var p = r.getDisplays(c.name);
- if (null !== p && u < (t.DragonBones.webAssembly ? p.size() : p.length)) {
- var m = t.DragonBones.webAssembly ? p.get(u) : p[u];
- if (null !== m && 1 === m.type) {
- var y = this.getArmatureData(m.path, m.parent.parent.parent.name);
- y && this.replaceAnimation(d, y, n)
- }
- }
- }
- u++
- }
- return !0
- }, e.prototype.getAllDragonBonesData = function() {
- return this._dragonBonesDataMap
- }, e.prototype.getAllTextureAtlasData = function() {
- return this._textureAtlasDataMap
- }, Object.defineProperty(e.prototype, "clock", {
- get: function() {
- return this._dragonBones.clock
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(e.prototype, "dragonBones", {
- get: function() {
- return this._dragonBones
- },
- enumerable: !0,
- configurable: !0
- }), e.prototype.changeSkin = function(t, e, i) {
- return void 0 === i && (i = null), this.replaceSkin(t, e, !1, i)
- }, e.prototype.copyAnimationsToArmature = function(t, e, i, n, r) {
- void 0 === i && (i = ""), void 0 === n && (n = ""), void 0 === r && (r = !0);
- var s = this.getArmatureData(e, n);
- return !!s && this.replaceAnimation(t, s, r)
- }, e._objectParser = null, e._binaryParser = null, e
- })();
- t.BaseFactory = e;
- var i = (function() {
- return function() {
- this.dataName = "", this.textureAtlasName = "", this.skin = null
- }
- })();
- t.BuildArmaturePackage = i
- })(r || (r = {})), e.exports = r
- }), {}],
- 411: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../cocos2d/core/renderer/assembler"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("./ArmatureDisplay"),
- l = t("../../cocos2d/core/renderer/render-flow"),
- h = cc.gfx,
- c = cc.vmath.mat4,
- u = cc.color(255, 0, 0, 255),
- _ = cc.color(0, 0, 255, 255),
- f = void 0,
- d = void 0,
- p = void 0,
- m = void 0,
- y = void 0,
- v = void 0,
- g = void 0,
- x = void 0,
- b = void 0,
- A = void 0,
- C = void 0,
- T = void 0,
- S = void 0,
- w = void 0,
- E = void 0,
- M = void 0,
- D = void 0,
- B = void 0,
- I = void 0,
- P = void 0,
- R = void 0,
- O = void 0,
- L = void 0,
- F = void 0,
- N = void 0,
- V = void 0,
- k = void 0,
- G = void 0,
- U = void 0,
- z = void 0;
- function j(t, e) {
- if (!t) return null;
- var i = void 0,
- n = void 0;
- switch (e) {
- case 1:
- i = y ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE;
- break;
- case 10:
- i = cc.macro.DST_COLOR, n = cc.macro.ONE_MINUS_SRC_ALPHA;
- break;
- case 12:
- i = cc.macro.ONE, n = cc.macro.ONE_MINUS_SRC_COLOR;
- break;
- case 0:
- default:
- i = y ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE_MINUS_SRC_ALPHA
- }
- var r = !C.enableBatch,
- s = t.getId() + i + n + r,
- o = C.sharedMaterials[0];
- if (!o) return null;
- var a = C._materialCache,
- l = a[s];
- l ? l.texture !== t && (l.setProperty("texture", t), l.updateHash(s)) : (a[o._hash] ? (l = new cc.Material).copy(o) : l = o, l.define("CC_USE_MODEL", r), l.setProperty("texture", t), l.effect.setBlend(!0, h.BLEND_FUNC_ADD, i, n, h.BLEND_FUNC_ADD, i, n), a[s] = l, l.updateHash(s));
- return l
- }
- function W(t, e) {
- L = t.a * e * m, v = y ? L / 255 : 1, P = t.r * f * v, R = t.g * d * v, O = t.b * p * v, I = (L << 24 >>> 0) + (O << 16) + (R << 8) + P
- }
- var H = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateRenderData = function(t, e) {}, e.prototype.realTimeTraverse = function(t, e, i) {
- for (var n = t._slots, r = void 0, s = void 0, o = void 0, a = void 0, l = void 0, h = void 0, u = void 0, _ = void 0, f = void 0, d = void 0, p = 0, m = n.length; p < m; p++)
- if (u = (_ = n[p])._color, _._visible && _._displayData)
- if (e ? _._mulMat(_._worldMatrix, e, _._matrix) : c.copy(_._worldMatrix, _._matrix), _.childArmature) this.realTimeTraverse(_.childArmature, _._worldMatrix, i * u.a / 255);
- else if (a = j(_.getTexture(), _._blendMode)) {
- (g || a._hash !== A.material._hash) && (g = !1, A._flush(), A.node = b, A.material = a), W(u, i), f = _._worldMatrix.m, l = _._localVertices, E = l.length >> 2, h = _._indices, M = h.length, d = x.request(E, M), S = d.indiceOffset, T = d.byteOffset >> 2, w = d.vertexOffset, r = x._vData, s = x._iData, o = x._uintVData, N = f[0], V = f[4], k = f[12], G = f[1], U = f[5], z = f[13];
- for (var y = 0, v = l.length; y < v;) D = l[y++], B = l[y++], r[T++] = D * N + B * V + k, r[T++] = D * G + B * U + z, r[T++] = l[y++], r[T++] = l[y++], o[T++] = I;
- for (var C = 0, P = h.length; C < P; C++) s[S++] = w + h[C]
- }
- }, e.prototype.cacheTraverse = function(t, e) {
- if (t) {
- var i = t.segments;
- if (0 != i.length) {
- var n = void 0,
- r = void 0,
- s = void 0,
- o = void 0,
- a = void 0,
- l = t.vertices,
- h = t.indices,
- c = 0,
- u = 0,
- _ = 0;
- if (e) {
- var f = e.m;
- N = f[0], G = f[1], V = f[4], U = f[5], k = f[12], z = f[13]
- }
- var d = 16 & F,
- p = d && (1 === N && 0 === G && 0 === V && 1 === U),
- m = 0,
- y = t.colors,
- v = y[m++],
- C = v.vfOffset;
- W(v, 1);
- for (var P = 0, R = i.length; P < R; P++) {
- var O = i[P];
- o = j(O.tex, O.blendMode), (g || o._hash !== A.material._hash) && (g = !1, A._flush(), A.node = b, A.material = o), E = O.vertexCount, M = O.indexCount, a = x.request(E, M), S = a.indiceOffset, w = a.vertexOffset, T = a.byteOffset >> 2, n = x._vData, r = x._iData, s = x._uintVData;
- for (var L = S, H = S + M; L < H; L++) r[L] = w + h[u++];
- if (_ = O.vfCount, n.set(l.subarray(c, c + _), T), c += _, p)
- for (var X = T, Y = T + _; X < Y; X += 5) n[X] += k, n[X + 1] += z;
- else if (d)
- for (var q = T, J = T + _; q < J; q += 5) D = n[q], B = n[q + 1], n[q] = D * N + B * V + k, n[q + 1] = D * G + B * U + z;
- if (1 & F)
- for (var Z = c - _, K = T + 4, Q = T + 4 + _; K < Q; K += 5, Z += 5) Z >= C && (W(v = y[m++], 1), C = v.vfOffset), s[K] = I
- }
- }
- }
- }, e.prototype.fillBuffers = function(t, e) {
- t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA;
- var i = t._armature;
- if (i) {
- g = !0, y = t.premultipliedAlpha, b = t.node, x = e._meshBuffer, A = e, C = t, F = 0;
- var n = b._color;
- f = n.r / 255, d = n.g / 255, p = n.b / 255, m = n.a / 255, 4294967295 !== n._val && (F |= 1);
- var r = void 0;
- if (C.enableBatch && (r = b._worldMatrix, g = !1, F |= 16), t.isAnimationCached()) this.cacheTraverse(t._curFrame, r);
- else {
- this.realTimeTraverse(i, r, 1);
- var s = t._debugDraw;
- if (t.debugBones && s) {
- s.clear(), s.lineWidth = 5, s.strokeColor = u, s.fillColor = _;
- for (var o = i.getBones(), a = 0, h = o.length; a < h; a++) {
- var c = o[a],
- v = Math.max(c.boneData.length, 5),
- T = c.globalTransformMatrix.tx,
- S = -c.globalTransformMatrix.ty,
- w = T + c.globalTransformMatrix.a * v,
- E = S - c.globalTransformMatrix.b * v;
- s.moveTo(T, S), s.lineTo(w, E), s.stroke()
- }
- }
- }
- b = void 0, x = void 0, A = void 0, C = void 0
- }
- }, e
- })(n.default);
- i.default = H, n.default.register(a, H), e.exports = i.default
- }), {
- "../../cocos2d/core/renderer/assembler": 227,
- "../../cocos2d/core/renderer/render-flow": 248,
- "./ArmatureDisplay": 402
- }],
- 412: [(function(t, e, i) {
- "use strict";
- var n = t("./track-entry-listeners"),
- r = t("../../cocos2d/core/components/CCRenderComponent"),
- s = t("./lib/spine"),
- o = t("../../cocos2d/core/assets/material/CCMaterial"),
- a = t("../../cocos2d/core/graphics/graphics"),
- l = t("./skeleton-cache"),
- h = cc.Enum({
- default: -1
- }),
- c = cc.Enum({
- "<None>": 0
- }),
- u = cc.Enum({
- REALTIME: 0,
- SHARED_CACHE: 1,
- PRIVATE_CACHE: 2
- });
- sp.Skeleton = cc.Class({
- name: "sp.Skeleton",
- extends: r,
- editor: !1,
- statics: {
- AnimationCacheMode: u
- },
- properties: {
- paused: {
- default: !1,
- visible: !1
- },
- skeletonData: {
- default: null,
- type: sp.SkeletonData,
- notify: function() {
- this.defaultSkin = "", this.defaultAnimation = "", this._updateSkeletonData()
- },
- tooltip: !1
- },
- defaultSkin: {
- default: "",
- visible: !1
- },
- defaultAnimation: {
- default: "",
- visible: !1
- },
- animation: {
- get: function() {
- if (this.isAnimationCached()) return this._animationName;
- var t = this.getCurrent(0);
- return t && t.animation.name || ""
- },
- set: function(t) {
- this.defaultAnimation = t, t ? this.setAnimation(0, t, this.loop) : this.isAnimationCached() || (this.clearTrack(0), this.setToSetupPose())
- },
- visible: !1
- },
- _defaultSkinIndex: {
- get: function() {
- if (this.skeletonData && this.defaultSkin) {
- var t = this.skeletonData.getSkinsEnum();
- if (t) {
- var e = t[this.defaultSkin];
- if (void 0 !== e) return e
- }
- }
- return 0
- },
- set: function(t) {
- var e;
- if (this.skeletonData && (e = this.skeletonData.getSkinsEnum()), !e) return cc.errorID("", this.name);
- var i = e[t];
- void 0 !== i ? (this.defaultSkin = i, this.setSkin(this.defaultSkin)) : cc.errorID(7501, this.name)
- },
- type: h,
- visible: !0,
- displayName: "Default Skin",
- tooltip: !1
- },
- _animationIndex: {
- get: function() {
- var t = this.animation;
- if (this.skeletonData && t) {
- var e = this.skeletonData.getAnimsEnum();
- if (e) {
- var i = e[t];
- if (void 0 !== i) return i
- }
- }
- return 0
- },
- set: function(t) {
- if (0 !== t) {
- var e;
- if (this.skeletonData && (e = this.skeletonData.getAnimsEnum()), !e) return cc.errorID(7502, this.name);
- var i = e[t];
- void 0 !== i ? this.animation = i : cc.errorID(7503, this.name)
- } else this.animation = ""
- },
- type: c,
- visible: !0,
- displayName: "Animation",
- tooltip: !1
- },
- _preCacheMode: -1,
- _cacheMode: u.REALTIME,
- _defaultCacheMode: {
- default: 0,
- type: u,
- notify: function() {
- this.setAnimationCacheMode(this._defaultCacheMode)
- },
- editorOnly: !0,
- visible: !0,
- animatable: !1,
- displayName: "Animation Cache Mode",
- tooltip: !1
- },
- loop: {
- default: !0,
- tooltip: !1
- },
- premultipliedAlpha: {
- default: !0,
- tooltip: !1
- },
- timeScale: {
- default: 1,
- tooltip: !1
- },
- debugSlots: {
- default: !1,
- editorOnly: !0,
- tooltip: !1,
- notify: function() {
- this._updateDebugDraw()
- }
- },
- debugBones: {
- default: !1,
- editorOnly: !0,
- tooltip: !1,
- notify: function() {
- this._updateDebugDraw()
- }
- },
- debugMesh: {
- default: !1,
- editorOnly: !0,
- tooltip: !1,
- notify: function() {
- this._updateDebugDraw()
- }
- },
- useTint: {
- default: !1,
- tooltip: !1,
- notify: function() {
- this._updateUseTint()
- }
- },
- enableBatch: {
- default: !1,
- notify: function() {
- this._updateBatch()
- },
- tooltip: !1
- },
- _accTime: 0,
- _playCount: 0,
- _frameCache: null,
- _curFrame: null,
- _skeletonCache: null,
- _animationName: "",
- _animationQueue: [],
- _headAniInfo: null,
- _playTimes: 0,
- _isAniComplete: !0
- },
- ctor: function() {
- this._effectDelegate = null, this._skeleton = null, this._rootBone = null, this._listener = null, this._boundingBox = cc.rect(), this._materialCache = {}, this._debugRenderer = null, this._startSlotIndex = -1, this._endSlotIndex = -1, this._startEntry = {
- animation: {
- name: ""
- },
- trackIndex: 0
- }, this._endEntry = {
- animation: {
- name: ""
- },
- trackIndex: 0
- }
- },
- setMaterial: function(t, e) {
- this._super(t, e), this._materialCache = {}
- },
- _updateUseTint: function() {
- var t = this.getMaterial(0),
- e = this.useTint || this.isAnimationCached();
- t && t.define("USE_TINT", e);
- var i = this._materialCache;
- for (var n in i) {
- var r = i[n];
- r && r.define("USE_TINT", e)
- }
- },
- _updateBatch: function() {
- var t = this.getMaterial(0);
- t && t.define("CC_USE_MODEL", !this.enableBatch);
- var e = this._materialCache;
- for (var i in e) {
- var n = e[i];
- n && n.define("CC_USE_MODEL", !this.enableBatch)
- }
- },
- setSkeletonData: function(t) {
- if (null != t.width && null != t.height && this.node.setContentSize(t.width, t.height), this._cacheMode === u.SHARED_CACHE ? this._skeletonCache = l.sharedCache : this._cacheMode === u.PRIVATE_CACHE && (this._skeletonCache = new l), this.isAnimationCached()) {
- (this.debugBones || this.debugSlots) && cc.warn("Debug bones or slots is invalid in cached mode");
- var e = this._skeletonCache.getSkeletonCache(this.skeletonData._uuid, t);
- this._skeleton = e.skeleton, this._clipper = e.clipper, this._rootBone = this._skeleton.getRootBone()
- } else this._skeleton = new s.Skeleton(t), this._clipper = new s.SkeletonClipping, this._rootBone = this._skeleton.getRootBone();
- this._activateMaterial()
- },
- setSlotsRange: function(t, e) {
- this.isAnimationCached() ? cc.warn("Slots visible range can not be modified in cached mode.") : (this._startSlotIndex = t, this._endSlotIndex = e)
- },
- setAnimationStateData: function(t) {
- if (this.isAnimationCached()) cc.warn("'setAnimationStateData' interface can not be invoked in cached mode.");
- else {
- var e = new s.AnimationState(t);
- this._listener && (this._state && this._state.removeListener(this._listener), e.addListener(this._listener)), this._state = e
- }
- },
- __preload: function() {
- for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n && "DEBUG_DRAW_NODE" === n._name && n.destroy()
- }
- this._resetAssembler(), this._updateSkeletonData(), this._updateDebugDraw(), this._updateUseTint(), this._updateBatch()
- },
- setAnimationCacheMode: function(t) {
- this._preCacheMode !== t && (this._cacheMode = t, this._updateSkeletonData(), this._updateUseTint())
- },
- isAnimationCached: function() {
- return this._cacheMode !== u.REALTIME
- },
- update: function(t) {
- if (!this.paused)
- if (t *= this.timeScale * sp.timeScale, this.isAnimationCached()) {
- if (this._isAniComplete) {
- if (0 === this._animationQueue.length && !this._headAniInfo) {
- var e = this._frameCache;
- if (e && e.isInvalid()) {
- e.updateToFrame();
- var i = e.frames;
- this._curFrame = i[i.length - 1]
- }
- return
- }
- if (this._headAniInfo || (this._headAniInfo = this._animationQueue.shift()), this._accTime += t, this._accTime > this._headAniInfo.delay) {
- var n = this._headAniInfo;
- this._headAniInfo = null, this.setAnimation(0, n.animationName, n.loop)
- }
- return
- }
- this._updateCache(t)
- } else this._updateRealtime(t)
- },
- _emitCacheCompleteEvent: function() {
- this._listener && (this._endEntry.animation.name = this._animationName, this._listener.complete && this._listener.complete(this._endEntry), this._listener.end && this._listener.end(this._endEntry))
- },
- _updateCache: function(t) {
- var e = this._frameCache;
- if (e.isInited()) {
- var i = e.frames,
- n = l.FrameTime;
- 0 == this._accTime && 0 == this._playCount && (this._startEntry.animation.name = this._animationName, this._listener && this._listener.start && this._listener.start(this._startEntry)), this._accTime += t;
- var r = Math.floor(this._accTime / n);
- if (e.isCompleted || e.updateToFrame(r), e.isCompleted && r >= i.length) {
- if (this._playCount++, this._playTimes > 0 && this._playCount >= this._playTimes) return this._curFrame = i[i.length - 1], this._accTime = 0, this._playCount = 0, this._isAniComplete = !0, void this._emitCacheCompleteEvent();
- this._accTime = 0, r = 0, this._emitCacheCompleteEvent()
- }
- this._curFrame = i[r]
- }
- },
- _updateRealtime: function(t) {
- var e = this._skeleton,
- i = this._state;
- e && (e.update(t), i && (i.update(t), i.apply(e)))
- },
- _activateMaterial: function() {
- this.skeletonData ? this.skeletonData.ensureTexturesLoaded((function(t) {
- if (t) {
- var e = this.sharedMaterials[0];
- (e = e ? o.getInstantiatedMaterial(e, this) : o.getInstantiatedBuiltinMaterial("2d-spine", this)).define("CC_USE_MODEL", !0), this._prepareToRender(e)
- } else this.disableRender()
- }), this) : this.disableRender()
- },
- _prepareToRender: function(t) {
- this.setMaterial(0, t), this.node && this.node._renderComponent == this && this.markForRender(!0)
- },
- onEnable: function() {
- this._super(), this._activateMaterial()
- },
- onRestore: function() {
- this._boundingBox = cc.rect()
- },
- setVertexEffectDelegate: function(t) {
- this._effectDelegate = t
- },
- updateWorldTransform: function() {
- this.isAnimationCached() && this._skeleton && this._skeleton.updateWorldTransform()
- },
- setToSetupPose: function() {
- this._skeleton && this._skeleton.setToSetupPose()
- },
- setBonesToSetupPose: function() {
- this._skeleton && this._skeleton.setBonesToSetupPose()
- },
- setSlotsToSetupPose: function() {
- this._skeleton && this._skeleton.setSlotsToSetupPose()
- },
- updateAnimationCache: function(t) {
- if (this.isAnimationCached()) {
- var e = this.skeletonData._uuid;
- this._skeletonCache && this._skeletonCache.updateAnimationCache(e, t)
- }
- },
- invalidAnimationCache: function() {
- this.isAnimationCached() && this._skeletonCache && this._skeletonCache.invalidAnimationCache(this.skeletonData._uuid)
- },
- findBone: function(t) {
- return this._skeleton ? this._skeleton.findBone(t) : null
- },
- findSlot: function(t) {
- return this._skeleton ? this._skeleton.findSlot(t) : null
- },
- setSkin: function(t) {
- this._skeleton && (this._skeleton.setSkinByName(t), this._skeleton.setSlotsToSetupPose()), this.invalidAnimationCache()
- },
- getAttachment: function(t, e) {
- return this._skeleton ? this._skeleton.getAttachmentByName(t, e) : null
- },
- setAttachment: function(t, e) {
- this._skeleton && this._skeleton.setAttachment(t, e), this.invalidAnimationCache()
- },
- getTextureAtlas: function(t) {
- return t.region
- },
- setMix: function(t, e, i) {
- this._state && this._state.data.setMix(t, e, i)
- },
- setAnimation: function(t, e, i) {
- if (this._playTimes = i ? 0 : 1, this._animationName = e, this.isAnimationCached()) {
- if (0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), !this._skeletonCache) return null;
- var n = this._skeletonCache.getAnimationCache(this.skeletonData._uuid, e);
- n || (n = this._skeletonCache.initAnimationCache(this.skeletonData._uuid, e)), n && (this._isAniComplete = !1, this._accTime = 0, this._playCount = 0, this._frameCache = n, this._frameCache.updateToFrame(0), this._curFrame = this._frameCache.frames[0])
- } else if (this._skeleton) {
- var r = this._skeleton.data.findAnimation(e);
- if (!r) return cc.logID(7509, e), null;
- var s = this._state.setAnimationWith(t, r, i);
- return this._state.apply(this._skeleton), s
- }
- return null
- },
- addAnimation: function(t, e, i, n) {
- if (n = n || 0, this.isAnimationCached()) 0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), this._animationQueue.push({
- animationName: e,
- loop: i,
- delay: n
- });
- else if (this._skeleton) {
- var r = this._skeleton.data.findAnimation(e);
- return r ? this._state.addAnimationWith(t, r, i, n) : (cc.logID(7510, e), null)
- }
- return null
- },
- findAnimation: function(t) {
- return this._skeleton ? this._skeleton.data.findAnimation(t) : null
- },
- getCurrent: function(t) {
- if (this.isAnimationCached()) cc.warn("'getCurrent' interface can not be invoked in cached mode.");
- else if (this._state) return this._state.getCurrent(t);
- return null
- },
- clearTracks: function() {
- this.isAnimationCached() ? cc.warn("'clearTracks' interface can not be invoked in cached mode.") : this._state && this._state.clearTracks()
- },
- clearTrack: function(t) {
- this.isAnimationCached() ? cc.warn("'clearTrack' interface can not be invoked in cached mode.") : this._state && this._state.clearTrack(t)
- },
- setStartListener: function(t) {
- this._ensureListener(), this._listener.start = t
- },
- setInterruptListener: function(t) {
- this._ensureListener(), this._listener.interrupt = t
- },
- setEndListener: function(t) {
- this._ensureListener(), this._listener.end = t
- },
- setDisposeListener: function(t) {
- this._ensureListener(), this._listener.dispose = t
- },
- setCompleteListener: function(t) {
- this._ensureListener(), this._listener.complete = t
- },
- setEventListener: function(t) {
- this._ensureListener(), this._listener.event = t
- },
- setTrackStartListener: function(t, e) {
- n.getListeners(t).start = e
- },
- setTrackInterruptListener: function(t, e) {
- n.getListeners(t).interrupt = e
- },
- setTrackEndListener: function(t, e) {
- n.getListeners(t).end = e
- },
- setTrackDisposeListener: function(t, e) {
- n.getListeners(t).dispose = e
- },
- setTrackCompleteListener: function(t, e) {
- n.getListeners(t).complete = function(t) {
- var i = Math.floor(t.trackTime / t.animationEnd);
- e(t, i)
- }
- },
- setTrackEventListener: function(t, e) {
- n.getListeners(t).event = e
- },
- getState: function() {
- return this._state
- },
- _updateAnimEnum: !1,
- _updateSkinEnum: !1,
- _ensureListener: function() {
- this._listener || (this._listener = new n, this._state && this._state.addListener(this._listener))
- },
- _updateSkeletonData: function() {
- if (this.skeletonData) {
- var t = this.skeletonData.getRuntimeData();
- if (t) {
- try {
- this.setSkeletonData(t), this.isAnimationCached() || this.setAnimationStateData(new s.AnimationStateData(this._skeleton.data)), this.defaultSkin && this.setSkin(this.defaultSkin)
- } catch (t) {
- cc.warn(t)
- }
- this._preCacheMode = this._cacheMode, this.animation = this.defaultAnimation
- }
- }
- },
- _refreshInspector: function() {
- this._updateAnimEnum(), this._updateSkinEnum(), Editor.Utils.refreshSelectedInspector("node", this.node.uuid)
- },
- _updateDebugDraw: function() {
- if (this.debugBones || this.debugSlots) {
- if (!this._debugRenderer) {
- var t = new cc.PrivateNode;
- t.name = "DEBUG_DRAW_NODE";
- var e = t.addComponent(a);
- e.lineWidth = 1, e.strokeColor = cc.color(255, 0, 0, 255), this._debugRenderer = e
- }
- this._debugRenderer.node.parent = this.node, this.isAnimationCached() && cc.warn("Debug bones or slots is invalid in cached mode")
- } else this._debugRenderer && (this._debugRenderer.node.parent = null)
- }
- }), e.exports = sp.Skeleton
- }), {
- "../../cocos2d/core/assets/material/CCMaterial": 75,
- "../../cocos2d/core/components/CCRenderComponent": 106,
- "../../cocos2d/core/graphics/graphics": 140,
- "./lib/spine": 414,
- "./skeleton-cache": 415,
- "./track-entry-listeners": 419
- }],
- 413: [(function(t, e, i) {
- "use strict";
- var n = "undefined" == typeof window ? global : window,
- r = !0;
- r && (n.sp = {}, sp._timeScale = 1, Object.defineProperty(sp, "timeScale", {
- get: function() {
- return this._timeScale
- },
- set: function(t) {
- this._timeScale = t
- },
- configurable: !0
- }), sp.ATTACHMENT_TYPE = {
- REGION: 0,
- BOUNDING_BOX: 1,
- MESH: 2,
- SKINNED_MESH: 3
- }, sp.AnimationEventType = cc.Enum({
- START: 0,
- INTERRUPT: 1,
- END: 2,
- DISPOSE: 3,
- COMPLETE: 4,
- EVENT: 5
- }), sp.spine = t("./lib/spine"), t("./skeleton-texture"), t("./skeleton-data"), t("./vertex-effect-delegate"), t("./Skeleton"), t("./spine-assembler"))
- }), {
- "./Skeleton": 412,
- "./lib/spine": 414,
- "./skeleton-data": 416,
- "./skeleton-texture": 417,
- "./spine-assembler": 418,
- "./vertex-effect-delegate": 420
- }],
- 414: [(function(t, e, i) {
- "use strict";
- var n, r = (function() {
- var t = function(e, i) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }
- instanceof Array && function(t, e) {
- t.__proto__ = e
- } || function(t, e) {
- for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
- })(e, i)
- };
- return function(e, i) {
- function n() {
- this.constructor = e
- }
- t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n)
- }
- })();
- (function(t) {
- var e, i, n, s = (function() {
- function t(t, e, i) {
- if (null == t) throw new Error("name cannot be null.");
- if (null == e) throw new Error("timelines cannot be null.");
- this.name = t, this.timelines = e, this.duration = i
- }
- return t.prototype.apply = function(t, e, i, n, r, s, o, a) {
- if (null == t) throw new Error("skeleton cannot be null.");
- n && 0 != this.duration && (i %= this.duration, e > 0 && (e %= this.duration));
- for (var l = this.timelines, h = 0, c = l.length; h < c; h++) l[h].apply(t, e, i, r, s, o, a)
- }, t.binarySearch = function(t, e, i) {
- void 0 === i && (i = 1);
- var n = 0,
- r = t.length / i - 2;
- if (0 == r) return i;
- for (var s = r >>> 1;;) {
- if (t[(s + 1) * i] <= e ? n = s + 1 : r = s, n == r) return (n + 1) * i;
- s = n + r >>> 1
- }
- }, t.linearSearch = function(t, e, i) {
- for (var n = 0, r = t.length - i; n <= r; n += i)
- if (t[n] > e) return n;
- return -1
- }, t
- })();
- t.Animation = s, (function(t) {
- t[t.setup = 0] = "setup", t[t.current = 1] = "current", t[t.currentLayered = 2] = "currentLayered"
- })(e = t.MixPose || (t.MixPose = {})), (function(t) {
- t[t.in = 0] = "in", t[t.out = 1] = "out"
- })(i = t.MixDirection || (t.MixDirection = {})), (function(t) {
- t[t.rotate = 0] = "rotate", t[t.translate = 1] = "translate", t[t.scale = 2] = "scale", t[t.shear = 3] = "shear", t[t.attachment = 4] = "attachment", t[t.color = 5] = "color", t[t.deform = 6] = "deform", t[t.event = 7] = "event", t[t.drawOrder = 8] = "drawOrder", t[t.ikConstraint = 9] = "ikConstraint", t[t.transformConstraint = 10] = "transformConstraint", t[t.pathConstraintPosition = 11] = "pathConstraintPosition", t[t.pathConstraintSpacing = 12] = "pathConstraintSpacing", t[t.pathConstraintMix = 13] = "pathConstraintMix", t[t.twoColor = 14] = "twoColor"
- })(n = t.TimelineType || (t.TimelineType = {}));
- var o = (function() {
- function e(i) {
- if (i <= 0) throw new Error("frameCount must be > 0: " + i);
- this.curves = t.Utils.newFloatArray((i - 1) * e.BEZIER_SIZE)
- }
- return e.prototype.getFrameCount = function() {
- return this.curves.length / e.BEZIER_SIZE + 1
- }, e.prototype.setLinear = function(t) {
- this.curves[t * e.BEZIER_SIZE] = e.LINEAR
- }, e.prototype.setStepped = function(t) {
- this.curves[t * e.BEZIER_SIZE] = e.STEPPED
- }, e.prototype.getCurveType = function(t) {
- var i = t * e.BEZIER_SIZE;
- if (i == this.curves.length) return e.LINEAR;
- var n = this.curves[i];
- return n == e.LINEAR ? e.LINEAR : n == e.STEPPED ? e.STEPPED : e.BEZIER
- }, e.prototype.setCurve = function(t, i, n, r, s) {
- var o = .03 * (2 * -i + r),
- a = .03 * (2 * -n + s),
- l = .006 * (3 * (i - r) + 1),
- h = .006 * (3 * (n - s) + 1),
- c = 2 * o + l,
- u = 2 * a + h,
- _ = .3 * i + o + .16666667 * l,
- f = .3 * n + a + .16666667 * h,
- d = t * e.BEZIER_SIZE,
- p = this.curves;
- p[d++] = e.BEZIER;
- for (var m = _, y = f, v = d + e.BEZIER_SIZE - 1; d < v; d += 2) p[d] = m, p[d + 1] = y, _ += c, f += u, c += l, u += h, m += _, y += f
- }, e.prototype.getCurvePercent = function(i, n) {
- n = t.MathUtils.clamp(n, 0, 1);
- var r = this.curves,
- s = i * e.BEZIER_SIZE,
- o = r[s];
- if (o == e.LINEAR) return n;
- if (o == e.STEPPED) return 0;
- for (var a = 0, l = ++s, h = s + e.BEZIER_SIZE - 1; s < h; s += 2)
- if ((a = r[s]) >= n) {
- var c = void 0,
- u = void 0;
- return s == l ? (c = 0, u = 0) : (c = r[s - 2], u = r[s - 1]), u + (r[s + 1] - u) * (n - c) / (a - c)
- }
- var _ = r[s - 1];
- return _ + (1 - _) * (n - a) / (1 - a)
- }, e.LINEAR = 0, e.STEPPED = 1, e.BEZIER = 2, e.BEZIER_SIZE = 19, e
- })();
- t.CurveTimeline = o;
- var a = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e << 1), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.rotate << 24) + this.boneIndex
- }, o.prototype.setFrame = function(t, e, i) {
- t <<= 1, this.frames[t] = e, this.frames[t + o.ROTATION] = i
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = this.frames,
- u = t.bones[this.boneIndex];
- if (n < c[0]) switch (l) {
- case e.setup:
- return void(u.rotation = u.data.rotation);
- case e.current:
- var _ = u.data.rotation - u.rotation;
- _ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0)), u.rotation += _ * a
- } else if (n >= c[c.length - o.ENTRIES])
- if (l == e.setup) u.rotation = u.data.rotation + c[c.length + o.PREV_ROTATION] * a;
- else {
- var f = u.data.rotation + c[c.length + o.PREV_ROTATION] - u.rotation;
- f -= 360 * (16384 - (16384.499999999996 - f / 360 | 0)), u.rotation += f * a
- }
- else {
- var d = s.binarySearch(c, n, o.ENTRIES),
- p = c[d + o.PREV_ROTATION],
- m = c[d],
- y = this.getCurvePercent((d >> 1) - 1, 1 - (n - m) / (c[d + o.PREV_TIME] - m)),
- v = c[d + o.ROTATION] - p;
- v = p + (v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0))) * y, l == e.setup ? (v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0)), u.rotation = u.data.rotation + v * a) : (v = u.data.rotation + v - u.rotation, v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0)), u.rotation += v * a)
- }
- }, o.ENTRIES = 2, o.PREV_TIME = -2, o.PREV_ROTATION = -1, o.ROTATION = 1, o
- })(o);
- t.RotateTimeline = a;
- var l = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.translate << 24) + this.boneIndex
- }, o.prototype.setFrame = function(t, e, i, n) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.X] = i, this.frames[t + o.Y] = n
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = this.frames,
- u = t.bones[this.boneIndex];
- if (n < c[0]) switch (l) {
- case e.setup:
- return u.x = u.data.x, void(u.y = u.data.y);
- case e.current:
- u.x += (u.data.x - u.x) * a, u.y += (u.data.y - u.y) * a
- } else {
- var _ = 0,
- f = 0;
- if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_X], f = c[c.length + o.PREV_Y];
- else {
- var d = s.binarySearch(c, n, o.ENTRIES);
- _ = c[d + o.PREV_X], f = c[d + o.PREV_Y];
- var p = c[d],
- m = this.getCurvePercent(d / o.ENTRIES - 1, 1 - (n - p) / (c[d + o.PREV_TIME] - p));
- _ += (c[d + o.X] - _) * m, f += (c[d + o.Y] - f) * m
- }
- l == e.setup ? (u.x = u.data.x + _ * a, u.y = u.data.y + f * a) : (u.x += (u.data.x + _ - u.x) * a, u.y += (u.data.y + f - u.y) * a)
- }
- }, o.ENTRIES = 3, o.PREV_TIME = -3, o.PREV_X = -2, o.PREV_Y = -1, o.X = 1, o.Y = 2, o
- })(o);
- t.TranslateTimeline = l;
- var h = (function(o) {
- function a(t) {
- return o.call(this, t) || this
- }
- return r(a, o), a.prototype.getPropertyId = function() {
- return (n.scale << 24) + this.boneIndex
- }, a.prototype.apply = function(n, r, o, l, h, c, u) {
- var _ = this.frames,
- f = n.bones[this.boneIndex];
- if (o < _[0]) switch (c) {
- case e.setup:
- return f.scaleX = f.data.scaleX, void(f.scaleY = f.data.scaleY);
- case e.current:
- f.scaleX += (f.data.scaleX - f.scaleX) * h, f.scaleY += (f.data.scaleY - f.scaleY) * h
- } else {
- var d = 0,
- p = 0;
- if (o >= _[_.length - a.ENTRIES]) d = _[_.length + a.PREV_X] * f.data.scaleX, p = _[_.length + a.PREV_Y] * f.data.scaleY;
- else {
- var m = s.binarySearch(_, o, a.ENTRIES);
- d = _[m + a.PREV_X], p = _[m + a.PREV_Y];
- var y = _[m],
- v = this.getCurvePercent(m / a.ENTRIES - 1, 1 - (o - y) / (_[m + a.PREV_TIME] - y));
- d = (d + (_[m + a.X] - d) * v) * f.data.scaleX, p = (p + (_[m + a.Y] - p) * v) * f.data.scaleY
- }
- if (1 == h) f.scaleX = d, f.scaleY = p;
- else {
- var g = 0,
- x = 0;
- c == e.setup ? (g = f.data.scaleX, x = f.data.scaleY) : (g = f.scaleX, x = f.scaleY), u == i.out ? (d = Math.abs(d) * t.MathUtils.signum(g), p = Math.abs(p) * t.MathUtils.signum(x)) : (g = Math.abs(g) * t.MathUtils.signum(d), x = Math.abs(x) * t.MathUtils.signum(p)), f.scaleX = g + (d - g) * h, f.scaleY = x + (p - x) * h
- }
- }
- }, a
- })(l);
- t.ScaleTimeline = h;
- var c = (function(t) {
- function i(e) {
- return t.call(this, e) || this
- }
- return r(i, t), i.prototype.getPropertyId = function() {
- return (n.shear << 24) + this.boneIndex
- }, i.prototype.apply = function(t, n, r, o, a, l, h) {
- var c = this.frames,
- u = t.bones[this.boneIndex];
- if (r < c[0]) switch (l) {
- case e.setup:
- return u.shearX = u.data.shearX, void(u.shearY = u.data.shearY);
- case e.current:
- u.shearX += (u.data.shearX - u.shearX) * a, u.shearY += (u.data.shearY - u.shearY) * a
- } else {
- var _ = 0,
- f = 0;
- if (r >= c[c.length - i.ENTRIES]) _ = c[c.length + i.PREV_X], f = c[c.length + i.PREV_Y];
- else {
- var d = s.binarySearch(c, r, i.ENTRIES);
- _ = c[d + i.PREV_X], f = c[d + i.PREV_Y];
- var p = c[d],
- m = this.getCurvePercent(d / i.ENTRIES - 1, 1 - (r - p) / (c[d + i.PREV_TIME] - p));
- _ += (c[d + i.X] - _) * m, f += (c[d + i.Y] - f) * m
- }
- l == e.setup ? (u.shearX = u.data.shearX + _ * a, u.shearY = u.data.shearY + f * a) : (u.shearX += (u.data.shearX + _ - u.shearX) * a, u.shearY += (u.data.shearY + f - u.shearY) * a)
- }
- }, i
- })(l);
- t.ShearTimeline = c;
- var u = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.color << 24) + this.slotIndex
- }, o.prototype.setFrame = function(t, e, i, n, r, s) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.R] = i, this.frames[t + o.G] = n, this.frames[t + o.B] = r, this.frames[t + o.A] = s
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = t.slots[this.slotIndex],
- u = this.frames;
- if (n < u[0]) switch (l) {
- case e.setup:
- return void c.color.setFromColor(c.data.color);
- case e.current:
- var _ = c.color,
- f = c.data.color;
- _.add((f.r - _.r) * a, (f.g - _.g) * a, (f.b - _.b) * a, (f.a - _.a) * a)
- } else {
- var d = 0,
- p = 0,
- m = 0,
- y = 0;
- if (n >= u[u.length - o.ENTRIES]) {
- var v = u.length;
- d = u[v + o.PREV_R], p = u[v + o.PREV_G], m = u[v + o.PREV_B], y = u[v + o.PREV_A]
- } else {
- var g = s.binarySearch(u, n, o.ENTRIES);
- d = u[g + o.PREV_R], p = u[g + o.PREV_G], m = u[g + o.PREV_B], y = u[g + o.PREV_A];
- var x = u[g],
- b = this.getCurvePercent(g / o.ENTRIES - 1, 1 - (n - x) / (u[g + o.PREV_TIME] - x));
- d += (u[g + o.R] - d) * b, p += (u[g + o.G] - p) * b, m += (u[g + o.B] - m) * b, y += (u[g + o.A] - y) * b
- }
- if (1 == a) c.color.set(d, p, m, y);
- else {
- _ = c.color;
- l == e.setup && _.setFromColor(c.data.color), _.add((d - _.r) * a, (p - _.g) * a, (m - _.b) * a, (y - _.a) * a)
- }
- }
- }, o.ENTRIES = 5, o.PREV_TIME = -5, o.PREV_R = -4, o.PREV_G = -3, o.PREV_B = -2, o.PREV_A = -1, o.R = 1, o.G = 2, o.B = 3, o.A = 4, o
- })(o);
- t.ColorTimeline = u;
- var _ = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.twoColor << 24) + this.slotIndex
- }, o.prototype.setFrame = function(t, e, i, n, r, s, a, l, h) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.R] = i, this.frames[t + o.G] = n, this.frames[t + o.B] = r, this.frames[t + o.A] = s, this.frames[t + o.R2] = a, this.frames[t + o.G2] = l, this.frames[t + o.B2] = h
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = t.slots[this.slotIndex],
- u = this.frames;
- if (n < u[0]) switch (l) {
- case e.setup:
- return c.color.setFromColor(c.data.color), void c.darkColor.setFromColor(c.data.darkColor);
- case e.current:
- var _ = c.color,
- f = c.darkColor,
- d = c.data.color,
- p = c.data.darkColor;
- _.add((d.r - _.r) * a, (d.g - _.g) * a, (d.b - _.b) * a, (d.a - _.a) * a), f.add((p.r - f.r) * a, (p.g - f.g) * a, (p.b - f.b) * a, 0)
- } else {
- var m = 0,
- y = 0,
- v = 0,
- g = 0,
- x = 0,
- b = 0,
- A = 0;
- if (n >= u[u.length - o.ENTRIES]) {
- var C = u.length;
- m = u[C + o.PREV_R], y = u[C + o.PREV_G], v = u[C + o.PREV_B], g = u[C + o.PREV_A], x = u[C + o.PREV_R2], b = u[C + o.PREV_G2], A = u[C + o.PREV_B2]
- } else {
- var T = s.binarySearch(u, n, o.ENTRIES);
- m = u[T + o.PREV_R], y = u[T + o.PREV_G], v = u[T + o.PREV_B], g = u[T + o.PREV_A], x = u[T + o.PREV_R2], b = u[T + o.PREV_G2], A = u[T + o.PREV_B2];
- var S = u[T],
- w = this.getCurvePercent(T / o.ENTRIES - 1, 1 - (n - S) / (u[T + o.PREV_TIME] - S));
- m += (u[T + o.R] - m) * w, y += (u[T + o.G] - y) * w, v += (u[T + o.B] - v) * w, g += (u[T + o.A] - g) * w, x += (u[T + o.R2] - x) * w, b += (u[T + o.G2] - b) * w, A += (u[T + o.B2] - A) * w
- }
- if (1 == a) c.color.set(m, y, v, g), c.darkColor.set(x, b, A, 1);
- else {
- _ = c.color, f = c.darkColor;
- l == e.setup && (_.setFromColor(c.data.color), f.setFromColor(c.data.darkColor)), _.add((m - _.r) * a, (y - _.g) * a, (v - _.b) * a, (g - _.a) * a), f.add((x - f.r) * a, (b - f.g) * a, (A - f.b) * a, 0)
- }
- }
- }, o.ENTRIES = 8, o.PREV_TIME = -8, o.PREV_R = -7, o.PREV_G = -6, o.PREV_B = -5, o.PREV_A = -4, o.PREV_R2 = -3, o.PREV_G2 = -2, o.PREV_B2 = -1, o.R = 1, o.G = 2, o.B = 3, o.A = 4, o.R2 = 5, o.G2 = 6, o.B2 = 7, o
- })(o);
- t.TwoColorTimeline = _;
- var f = (function() {
- function r(e) {
- this.frames = t.Utils.newFloatArray(e), this.attachmentNames = new Array(e)
- }
- return r.prototype.getPropertyId = function() {
- return (n.attachment << 24) + this.slotIndex
- }, r.prototype.getFrameCount = function() {
- return this.frames.length
- }, r.prototype.setFrame = function(t, e, i) {
- this.frames[t] = e, this.attachmentNames[t] = i
- }, r.prototype.apply = function(t, n, r, o, a, l, h) {
- var c = t.slots[this.slotIndex];
- if (h != i.out || l != e.setup) {
- var u = this.frames;
- if (r < u[0]) {
- if (l == e.setup) {
- var _ = c.data.attachmentName;
- c.setAttachment(null == _ ? null : t.getAttachment(this.slotIndex, _))
- }
- } else {
- var f = 0;
- f = r >= u[u.length - 1] ? u.length - 1 : s.binarySearch(u, r, 1) - 1;
- var d = this.attachmentNames[f];
- t.slots[this.slotIndex].setAttachment(null == d ? null : t.getAttachment(this.slotIndex, d))
- }
- } else {
- var p = c.data.attachmentName;
- c.setAttachment(null == p ? null : t.getAttachment(this.slotIndex, p))
- }
- }, r
- })();
- t.AttachmentTimeline = f;
- var d = null,
- p = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e), n.frameVertices = new Array(e), null == d && (d = t.Utils.newFloatArray(64)), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.deform << 27) + +this.attachment.id + this.slotIndex
- }, o.prototype.setFrame = function(t, e, i) {
- this.frames[t] = e, this.frameVertices[t] = i
- }, o.prototype.apply = function(i, n, r, o, a, l, h) {
- var c = i.slots[this.slotIndex],
- u = c.getAttachment();
- if (u instanceof t.VertexAttachment && u.applyDeform(this.attachment)) {
- var _ = c.attachmentVertices;
- 0 == _.length && (a = 1);
- var f = this.frameVertices,
- d = f[0].length,
- p = this.frames;
- if (r < p[0]) {
- var m = u;
- switch (l) {
- case e.setup:
- return void(_.length = 0);
- case e.current:
- if (1 == a) {
- _.length = 0;
- break
- }
- var y = t.Utils.setArraySize(_, d);
- if (null == m.bones)
- for (var v = m.vertices, g = 0; g < d; g++) y[g] += (v[g] - y[g]) * a;
- else {
- a = 1 - a;
- for (g = 0; g < d; g++) y[g] *= a
- }
- }
- } else {
- var x = t.Utils.setArraySize(_, d);
- if (r >= p[p.length - 1]) {
- var b = f[p.length - 1];
- if (1 == a) t.Utils.arrayCopy(b, 0, x, 0, d);
- else if (l == e.setup) {
- if (null == (m = u).bones)
- for (var A = m.vertices, C = 0; C < d; C++) {
- var T = A[C];
- x[C] = T + (b[C] - T) * a
- } else
- for (var S = 0; S < d; S++) x[S] = b[S] * a
- } else
- for (var w = 0; w < d; w++) x[w] += (b[w] - x[w]) * a
- } else {
- var E = s.binarySearch(p, r),
- M = f[E - 1],
- D = f[E],
- B = p[E],
- I = this.getCurvePercent(E - 1, 1 - (r - B) / (p[E - 1] - B));
- if (1 == a)
- for (var P = 0; P < d; P++) {
- var R = M[P];
- x[P] = R + (D[P] - R) * I
- } else if (l == e.setup) {
- if (null == (m = u).bones)
- for (var O = m.vertices, L = 0; L < d; L++) {
- R = M[L], T = O[L];
- x[L] = T + (R + (D[L] - R) * I - T) * a
- } else
- for (var F = 0; F < d; F++) {
- R = M[F];
- x[F] = (R + (D[F] - R) * I) * a
- }
- } else
- for (var N = 0; N < d; N++) {
- R = M[N];
- x[N] += (R + (D[N] - R) * I - x[N]) * a
- }
- }
- }
- }
- }, o
- })(o);
- t.DeformTimeline = p;
- var m = (function() {
- function e(e) {
- this.frames = t.Utils.newFloatArray(e), this.events = new Array(e)
- }
- return e.prototype.getPropertyId = function() {
- return n.event << 24
- }, e.prototype.getFrameCount = function() {
- return this.frames.length
- }, e.prototype.setFrame = function(t, e) {
- this.frames[t] = e.time, this.events[t] = e
- }, e.prototype.apply = function(t, e, i, n, r, o, a) {
- if (null != n) {
- var l = this.frames,
- h = this.frames.length;
- if (e > i) this.apply(t, e, Number.MAX_VALUE, n, r, o, a), e = -1;
- else if (e >= l[h - 1]) return;
- if (!(i < l[0])) {
- var c = 0;
- if (e < l[0]) c = 0;
- else
- for (var u = l[c = s.binarySearch(l, e)]; c > 0 && l[c - 1] == u;) c--;
- for (; c < h && i >= l[c]; c++) n.push(this.events[c])
- }
- }
- }, e
- })();
- t.EventTimeline = m;
- var y = (function() {
- function r(e) {
- this.frames = t.Utils.newFloatArray(e), this.drawOrders = new Array(e)
- }
- return r.prototype.getPropertyId = function() {
- return n.drawOrder << 24
- }, r.prototype.getFrameCount = function() {
- return this.frames.length
- }, r.prototype.setFrame = function(t, e, i) {
- this.frames[t] = e, this.drawOrders[t] = i
- }, r.prototype.apply = function(n, r, o, a, l, h, c) {
- var u = n.drawOrder,
- _ = n.slots;
- if (c != i.out || h != e.setup) {
- var f = this.frames;
- if (o < f[0]) h == e.setup && t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length);
- else {
- var d = 0;
- d = o >= f[f.length - 1] ? f.length - 1 : s.binarySearch(f, o) - 1;
- var p = this.drawOrders[d];
- if (null == p) t.Utils.arrayCopy(_, 0, u, 0, _.length);
- else
- for (var m = 0, y = p.length; m < y; m++) u[m] = _[p[m]]
- }
- } else t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length)
- }, r
- })();
- t.DrawOrderTimeline = y;
- var v = (function(o) {
- function a(e) {
- var i = o.call(this, e) || this;
- return i.frames = t.Utils.newFloatArray(e * a.ENTRIES), i
- }
- return r(a, o), a.prototype.getPropertyId = function() {
- return (n.ikConstraint << 24) + this.ikConstraintIndex
- }, a.prototype.setFrame = function(t, e, i, n) {
- t *= a.ENTRIES, this.frames[t] = e, this.frames[t + a.MIX] = i, this.frames[t + a.BEND_DIRECTION] = n
- }, a.prototype.apply = function(t, n, r, o, l, h, c) {
- var u = this.frames,
- _ = t.ikConstraints[this.ikConstraintIndex];
- if (r < u[0]) switch (h) {
- case e.setup:
- return _.mix = _.data.mix, void(_.bendDirection = _.data.bendDirection);
- case e.current:
- _.mix += (_.data.mix - _.mix) * l, _.bendDirection = _.data.bendDirection
- } else if (r >= u[u.length - a.ENTRIES]) h == e.setup ? (_.mix = _.data.mix + (u[u.length + a.PREV_MIX] - _.data.mix) * l, _.bendDirection = c == i.out ? _.data.bendDirection : u[u.length + a.PREV_BEND_DIRECTION]) : (_.mix += (u[u.length + a.PREV_MIX] - _.mix) * l, c == i.in && (_.bendDirection = u[u.length + a.PREV_BEND_DIRECTION]));
- else {
- var f = s.binarySearch(u, r, a.ENTRIES),
- d = u[f + a.PREV_MIX],
- p = u[f],
- m = this.getCurvePercent(f / a.ENTRIES - 1, 1 - (r - p) / (u[f + a.PREV_TIME] - p));
- h == e.setup ? (_.mix = _.data.mix + (d + (u[f + a.MIX] - d) * m - _.data.mix) * l, _.bendDirection = c == i.out ? _.data.bendDirection : u[f + a.PREV_BEND_DIRECTION]) : (_.mix += (d + (u[f + a.MIX] - d) * m - _.mix) * l, c == i.in && (_.bendDirection = u[f + a.PREV_BEND_DIRECTION]))
- }
- }, a.ENTRIES = 3, a.PREV_TIME = -3, a.PREV_MIX = -2, a.PREV_BEND_DIRECTION = -1, a.MIX = 1, a.BEND_DIRECTION = 2, a
- })(o);
- t.IkConstraintTimeline = v;
- var g = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.transformConstraint << 24) + this.transformConstraintIndex
- }, o.prototype.setFrame = function(t, e, i, n, r, s) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.ROTATE] = i, this.frames[t + o.TRANSLATE] = n, this.frames[t + o.SCALE] = r, this.frames[t + o.SHEAR] = s
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = this.frames,
- u = t.transformConstraints[this.transformConstraintIndex];
- if (n < c[0]) {
- var _ = u.data;
- switch (l) {
- case e.setup:
- return u.rotateMix = _.rotateMix, u.translateMix = _.translateMix, u.scaleMix = _.scaleMix, void(u.shearMix = _.shearMix);
- case e.current:
- u.rotateMix += (_.rotateMix - u.rotateMix) * a, u.translateMix += (_.translateMix - u.translateMix) * a, u.scaleMix += (_.scaleMix - u.scaleMix) * a, u.shearMix += (_.shearMix - u.shearMix) * a
- }
- } else {
- var f = 0,
- d = 0,
- p = 0,
- m = 0;
- if (n >= c[c.length - o.ENTRIES]) {
- var y = c.length;
- f = c[y + o.PREV_ROTATE], d = c[y + o.PREV_TRANSLATE], p = c[y + o.PREV_SCALE], m = c[y + o.PREV_SHEAR]
- } else {
- var v = s.binarySearch(c, n, o.ENTRIES);
- f = c[v + o.PREV_ROTATE], d = c[v + o.PREV_TRANSLATE], p = c[v + o.PREV_SCALE], m = c[v + o.PREV_SHEAR];
- var g = c[v],
- x = this.getCurvePercent(v / o.ENTRIES - 1, 1 - (n - g) / (c[v + o.PREV_TIME] - g));
- f += (c[v + o.ROTATE] - f) * x, d += (c[v + o.TRANSLATE] - d) * x, p += (c[v + o.SCALE] - p) * x, m += (c[v + o.SHEAR] - m) * x
- }
- if (l == e.setup) {
- _ = u.data;
- u.rotateMix = _.rotateMix + (f - _.rotateMix) * a, u.translateMix = _.translateMix + (d - _.translateMix) * a, u.scaleMix = _.scaleMix + (p - _.scaleMix) * a, u.shearMix = _.shearMix + (m - _.shearMix) * a
- } else u.rotateMix += (f - u.rotateMix) * a, u.translateMix += (d - u.translateMix) * a, u.scaleMix += (p - u.scaleMix) * a, u.shearMix += (m - u.shearMix) * a
- }
- }, o.ENTRIES = 5, o.PREV_TIME = -5, o.PREV_ROTATE = -4, o.PREV_TRANSLATE = -3, o.PREV_SCALE = -2, o.PREV_SHEAR = -1, o.ROTATE = 1, o.TRANSLATE = 2, o.SCALE = 3, o.SHEAR = 4, o
- })(o);
- t.TransformConstraintTimeline = g;
- var x = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.pathConstraintPosition << 24) + this.pathConstraintIndex
- }, o.prototype.setFrame = function(t, e, i) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.VALUE] = i
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = this.frames,
- u = t.pathConstraints[this.pathConstraintIndex];
- if (n < c[0]) switch (l) {
- case e.setup:
- return void(u.position = u.data.position);
- case e.current:
- u.position += (u.data.position - u.position) * a
- } else {
- var _ = 0;
- if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_VALUE];
- else {
- var f = s.binarySearch(c, n, o.ENTRIES);
- _ = c[f + o.PREV_VALUE];
- var d = c[f],
- p = this.getCurvePercent(f / o.ENTRIES - 1, 1 - (n - d) / (c[f + o.PREV_TIME] - d));
- _ += (c[f + o.VALUE] - _) * p
- }
- l == e.setup ? u.position = u.data.position + (_ - u.data.position) * a : u.position += (_ - u.position) * a
- }
- }, o.ENTRIES = 2, o.PREV_TIME = -2, o.PREV_VALUE = -1, o.VALUE = 1, o
- })(o);
- t.PathConstraintPositionTimeline = x;
- var b = (function(t) {
- function i(e) {
- return t.call(this, e) || this
- }
- return r(i, t), i.prototype.getPropertyId = function() {
- return (n.pathConstraintSpacing << 24) + this.pathConstraintIndex
- }, i.prototype.apply = function(t, n, r, o, a, l, h) {
- var c = this.frames,
- u = t.pathConstraints[this.pathConstraintIndex];
- if (r < c[0]) switch (l) {
- case e.setup:
- return void(u.spacing = u.data.spacing);
- case e.current:
- u.spacing += (u.data.spacing - u.spacing) * a
- } else {
- var _ = 0;
- if (r >= c[c.length - i.ENTRIES]) _ = c[c.length + i.PREV_VALUE];
- else {
- var f = s.binarySearch(c, r, i.ENTRIES);
- _ = c[f + i.PREV_VALUE];
- var d = c[f],
- p = this.getCurvePercent(f / i.ENTRIES - 1, 1 - (r - d) / (c[f + i.PREV_TIME] - d));
- _ += (c[f + i.VALUE] - _) * p
- }
- l == e.setup ? u.spacing = u.data.spacing + (_ - u.data.spacing) * a : u.spacing += (_ - u.spacing) * a
- }
- }, i
- })(x);
- t.PathConstraintSpacingTimeline = b;
- var A = (function(i) {
- function o(e) {
- var n = i.call(this, e) || this;
- return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
- }
- return r(o, i), o.prototype.getPropertyId = function() {
- return (n.pathConstraintMix << 24) + this.pathConstraintIndex
- }, o.prototype.setFrame = function(t, e, i, n) {
- t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.ROTATE] = i, this.frames[t + o.TRANSLATE] = n
- }, o.prototype.apply = function(t, i, n, r, a, l, h) {
- var c = this.frames,
- u = t.pathConstraints[this.pathConstraintIndex];
- if (n < c[0]) switch (l) {
- case e.setup:
- return u.rotateMix = u.data.rotateMix, void(u.translateMix = u.data.translateMix);
- case e.current:
- u.rotateMix += (u.data.rotateMix - u.rotateMix) * a, u.translateMix += (u.data.translateMix - u.translateMix) * a
- } else {
- var _ = 0,
- f = 0;
- if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_ROTATE], f = c[c.length + o.PREV_TRANSLATE];
- else {
- var d = s.binarySearch(c, n, o.ENTRIES);
- _ = c[d + o.PREV_ROTATE], f = c[d + o.PREV_TRANSLATE];
- var p = c[d],
- m = this.getCurvePercent(d / o.ENTRIES - 1, 1 - (n - p) / (c[d + o.PREV_TIME] - p));
- _ += (c[d + o.ROTATE] - _) * m, f += (c[d + o.TRANSLATE] - f) * m
- }
- l == e.setup ? (u.rotateMix = u.data.rotateMix + (_ - u.data.rotateMix) * a, u.translateMix = u.data.translateMix + (f - u.data.translateMix) * a) : (u.rotateMix += (_ - u.rotateMix) * a, u.translateMix += (f - u.translateMix) * a)
- }
- }, o.ENTRIES = 3, o.PREV_TIME = -3, o.PREV_ROTATE = -2, o.PREV_TRANSLATE = -1, o.ROTATE = 1, o.TRANSLATE = 2, o
- })(o);
- t.PathConstraintMixTimeline = A
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(e) {
- this.tracks = new Array, this.events = new Array, this.listeners = new Array, this.queue = new r(this), this.propertyIDs = new t.IntSet, this.mixingTo = new Array, this.animationsChanged = !1, this.timeScale = 1, this.trackEntryPool = new t.Pool(function() {
- return new i
- }), this.data = e
- }
- return e.prototype.update = function(t) {
- t *= this.timeScale;
- for (var e = this.tracks, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (null != r) {
- r.animationLast = r.nextAnimationLast, r.trackLast = r.nextTrackLast;
- var s = t * r.timeScale;
- if (r.delay > 0) {
- if (r.delay -= s, r.delay > 0) continue;
- s = -r.delay, r.delay = 0
- }
- var o = r.next;
- if (null != o) {
- var a = r.trackLast - o.delay;
- if (a >= 0) {
- for (o.delay = 0, o.trackTime = a + t * o.timeScale, r.trackTime += s, this.setCurrent(i, o, !0); null != o.mixingFrom;) o.mixTime += s, o = o.mixingFrom;
- continue
- }
- } else if (r.trackLast >= r.trackEnd && null == r.mixingFrom) {
- e[i] = null, this.queue.end(r), this.disposeNext(r);
- continue
- }
- if (null != r.mixingFrom && this.updateMixingFrom(r, t)) {
- var l = r.mixingFrom;
- for (r.mixingFrom = null; null != l;) this.queue.end(l), l = l.mixingFrom
- }
- r.trackTime += s
- }
- }
- this.queue.drain()
- }, e.prototype.updateMixingFrom = function(t, e) {
- var i = t.mixingFrom;
- if (null == i) return !0;
- var n = this.updateMixingFrom(i, e);
- return i.animationLast = i.nextAnimationLast, i.trackLast = i.nextTrackLast, t.mixTime > 0 && (t.mixTime >= t.mixDuration || 0 == t.timeScale) ? (0 != i.totalAlpha && 0 != t.mixDuration || (t.mixingFrom = i.mixingFrom, t.interruptAlpha = i.interruptAlpha, this.queue.end(i)), n) : (i.trackTime += e * i.timeScale, t.mixTime += e * t.timeScale, !1)
- }, e.prototype.apply = function(i) {
- if (null == i) throw new Error("skeleton cannot be null.");
- this.animationsChanged && this._animationsChanged();
- for (var n = this.events, r = this.tracks, s = !1, o = 0, a = r.length; o < a; o++) {
- var l = r[o];
- if (!(null == l || l.delay > 0)) {
- s = !0;
- var h = 0 == o ? t.MixPose.current : t.MixPose.currentLayered,
- c = l.alpha;
- null != l.mixingFrom ? c *= this.applyMixingFrom(l, i, h) : l.trackTime >= l.trackEnd && null == l.next && (c = 0);
- var u = l.animationLast,
- _ = l.getAnimationTime(),
- f = l.animation.timelines.length,
- d = l.animation.timelines;
- if (1 == c)
- for (var p = 0; p < f; p++) d[p].apply(i, u, _, n, 1, t.MixPose.setup, t.MixDirection.in);
- else {
- var m = l.timelineData,
- y = 0 == l.timelinesRotation.length;
- y && t.Utils.setArraySize(l.timelinesRotation, f << 1, null);
- var v = l.timelinesRotation;
- for (p = 0; p < f; p++) {
- var g = d[p],
- x = m[p] >= e.FIRST ? t.MixPose.setup : h;
- g instanceof t.RotateTimeline ? this.applyRotateTimeline(g, i, _, c, x, v, p << 1, y) : (t.Utils.webkit602BugfixHelper(c, x), g.apply(i, u, _, n, c, x, t.MixDirection.in))
- }
- }
- this.queueEvents(l, _), n.length = 0, l.nextAnimationLast = _, l.nextTrackLast = l.trackTime
- }
- }
- return this.queue.drain(), s
- }, e.prototype.applyMixingFrom = function(i, n, r) {
- var s = i.mixingFrom;
- null != s.mixingFrom && this.applyMixingFrom(s, n, r);
- var o = 0;
- 0 == i.mixDuration ? (o = 1, r = t.MixPose.setup) : (o = i.mixTime / i.mixDuration) > 1 && (o = 1);
- var a = o < s.eventThreshold ? this.events : null,
- l = o < s.attachmentThreshold,
- h = o < s.drawOrderThreshold,
- c = s.animationLast,
- u = s.getAnimationTime(),
- _ = s.animation.timelines.length,
- f = s.animation.timelines,
- d = s.timelineData,
- p = s.timelineDipMix,
- m = 0 == s.timelinesRotation.length;
- m && t.Utils.setArraySize(s.timelinesRotation, _ << 1, null);
- var y, v = s.timelinesRotation,
- g = s.alpha * i.interruptAlpha,
- x = g * (1 - o),
- b = 0;
- s.totalAlpha = 0;
- for (var A = 0; A < _; A++) {
- var C = f[A];
- switch (d[A]) {
- case e.SUBSEQUENT:
- if (!l && C instanceof t.AttachmentTimeline) continue;
- if (!h && C instanceof t.DrawOrderTimeline) continue;
- y = r, b = x;
- break;
- case e.FIRST:
- y = t.MixPose.setup, b = x;
- break;
- case e.DIP:
- y = t.MixPose.setup, b = g;
- break;
- default:
- y = t.MixPose.setup, b = g;
- var T = p[A];
- b *= Math.max(0, 1 - T.mixTime / T.mixDuration)
- }
- s.totalAlpha += b, C instanceof t.RotateTimeline ? this.applyRotateTimeline(C, n, u, b, y, v, A << 1, m) : (t.Utils.webkit602BugfixHelper(b, y), C.apply(n, c, u, a, b, y, t.MixDirection.out))
- }
- return i.mixDuration > 0 && this.queueEvents(s, u), this.events.length = 0, s.nextAnimationLast = u, s.nextTrackLast = s.trackTime, o
- }, e.prototype.applyRotateTimeline = function(e, i, n, r, s, o, a, l) {
- if (l && (o[a] = 0), 1 != r) {
- var h = e,
- c = h.frames,
- u = i.bones[h.boneIndex];
- if (n < c[0]) s == t.MixPose.setup && (u.rotation = u.data.rotation);
- else {
- var _ = 0;
- if (n >= c[c.length - t.RotateTimeline.ENTRIES]) _ = u.data.rotation + c[c.length + t.RotateTimeline.PREV_ROTATION];
- else {
- var f = t.Animation.binarySearch(c, n, t.RotateTimeline.ENTRIES),
- d = c[f + t.RotateTimeline.PREV_ROTATION],
- p = c[f],
- m = h.getCurvePercent((f >> 1) - 1, 1 - (n - p) / (c[f + t.RotateTimeline.PREV_TIME] - p));
- _ = c[f + t.RotateTimeline.ROTATION] - d, _ = d + (_ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0))) * m + u.data.rotation, _ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0))
- }
- var y = s == t.MixPose.setup ? u.data.rotation : u.rotation,
- v = 0,
- g = _ - y;
- if (0 == g) v = o[a];
- else {
- g -= 360 * (16384 - (16384.499999999996 - g / 360 | 0));
- var x = 0,
- b = 0;
- l ? (x = 0, b = g) : (x = o[a], b = o[a + 1]);
- var A = g > 0,
- C = x >= 0;
- t.MathUtils.signum(b) != t.MathUtils.signum(g) && Math.abs(b) <= 90 && (Math.abs(x) > 180 && (x += 360 * t.MathUtils.signum(x)), C = A), v = g + x - x % 360, C != A && (v += 360 * t.MathUtils.signum(x)), o[a] = v
- }
- o[a + 1] = g, y += v * r, u.rotation = y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))
- }
- } else e.apply(i, 0, n, null, 1, s, t.MixDirection.in)
- }, e.prototype.queueEvents = function(t, e) {
- for (var i = t.animationStart, n = t.animationEnd, r = n - i, s = t.trackLast % r, o = this.events, a = 0, l = o.length; a < l; a++) {
- var h = o[a];
- if (h.time < s) break;
- h.time > n || this.queue.event(t, h)
- }
- for ((t.loop ? 0 == r || s > t.trackTime % r : e >= n && t.animationLast < n) && this.queue.complete(t); a < l; a++) {
- o[a].time < i || this.queue.event(t, o[a])
- }
- }, e.prototype.clearTracks = function() {
- var t = this.queue.drainDisabled;
- this.queue.drainDisabled = !0;
- for (var e = 0, i = this.tracks.length; e < i; e++) this.clearTrack(e);
- this.tracks.length = 0, this.queue.drainDisabled = t, this.queue.drain()
- }, e.prototype.clearTrack = function(t) {
- if (!(t >= this.tracks.length)) {
- var e = this.tracks[t];
- if (null != e) {
- this.queue.end(e), this.disposeNext(e);
- for (var i = e;;) {
- var n = i.mixingFrom;
- if (null == n) break;
- this.queue.end(n), i.mixingFrom = null, i = n
- }
- this.tracks[e.trackIndex] = null, this.queue.drain()
- }
- }
- }, e.prototype.setCurrent = function(t, e, i) {
- var n = this.expandToIndex(t);
- this.tracks[t] = e, null != n && (i && this.queue.interrupt(n), e.mixingFrom = n, e.mixTime = 0, null != n.mixingFrom && n.mixDuration > 0 && (e.interruptAlpha *= Math.min(1, n.mixTime / n.mixDuration)), n.timelinesRotation.length = 0), this.queue.start(e)
- }, e.prototype.setAnimation = function(t, e, i) {
- var n = this.data.skeletonData.findAnimation(e);
- if (null == n) throw new Error("Animation not found: " + e);
- return this.setAnimationWith(t, n, i)
- }, e.prototype.setAnimationWith = function(t, e, i) {
- if (null == e) throw new Error("animation cannot be null.");
- var n = !0,
- r = this.expandToIndex(t);
- null != r && (-1 == r.nextTrackLast ? (this.tracks[t] = r.mixingFrom, this.queue.interrupt(r), this.queue.end(r), this.disposeNext(r), r = r.mixingFrom, n = !1) : this.disposeNext(r));
- var s = this.trackEntry(t, e, i, r);
- return this.setCurrent(t, s, n), this.queue.drain(), s
- }, e.prototype.addAnimation = function(t, e, i, n) {
- var r = this.data.skeletonData.findAnimation(e);
- if (null == r) throw new Error("Animation not found: " + e);
- return this.addAnimationWith(t, r, i, n)
- }, e.prototype.addAnimationWith = function(t, e, i, n) {
- if (null == e) throw new Error("animation cannot be null.");
- var r = this.expandToIndex(t);
- if (null != r)
- for (; null != r.next;) r = r.next;
- var s = this.trackEntry(t, e, i, r);
- if (null == r) this.setCurrent(t, s, !0), this.queue.drain();
- else if (r.next = s, n <= 0) {
- var o = r.animationEnd - r.animationStart;
- 0 != o ? (r.loop ? n += o * (1 + (r.trackTime / o | 0)) : n += o, n -= this.data.getMix(r.animation, e)) : n = 0
- }
- return s.delay = n, s
- }, e.prototype.setEmptyAnimation = function(t, i) {
- var n = this.setAnimationWith(t, e.emptyAnimation, !1);
- return n.mixDuration = i, n.trackEnd = i, n
- }, e.prototype.addEmptyAnimation = function(t, i, n) {
- n <= 0 && (n -= i);
- var r = this.addAnimationWith(t, e.emptyAnimation, !1, n);
- return r.mixDuration = i, r.trackEnd = i, r
- }, e.prototype.setEmptyAnimations = function(t) {
- var e = this.queue.drainDisabled;
- this.queue.drainDisabled = !0;
- for (var i = 0, n = this.tracks.length; i < n; i++) {
- var r = this.tracks[i];
- null != r && this.setEmptyAnimation(r.trackIndex, t)
- }
- this.queue.drainDisabled = e, this.queue.drain()
- }, e.prototype.expandToIndex = function(e) {
- return e < this.tracks.length ? this.tracks[e] : (t.Utils.ensureArrayCapacity(this.tracks, e - this.tracks.length + 1, null), this.tracks.length = e + 1, null)
- }, e.prototype.trackEntry = function(t, e, i, n) {
- var r = this.trackEntryPool.obtain();
- return r.trackIndex = t, r.animation = e, r.loop = i, r.eventThreshold = 0, r.attachmentThreshold = 0, r.drawOrderThreshold = 0, r.animationStart = 0, r.animationEnd = e.duration, r.animationLast = -1, r.nextAnimationLast = -1, r.delay = 0, r.trackTime = 0, r.trackLast = -1, r.nextTrackLast = -1, r.trackEnd = Number.MAX_VALUE, r.timeScale = 1, r.alpha = 1, r.interruptAlpha = 1, r.mixTime = 0, r.mixDuration = null == n ? 0 : this.data.getMix(n.animation, e), r
- }, e.prototype.disposeNext = function(t) {
- for (var e = t.next; null != e;) this.queue.dispose(e), e = e.next;
- t.next = null
- }, e.prototype._animationsChanged = function() {
- this.animationsChanged = !1;
- var t = this.propertyIDs;
- t.clear();
- for (var e = this.mixingTo, i = 0, n = this.tracks.length; i < n; i++) {
- var r = this.tracks[i];
- null != r && r.setTimelineData(null, e, t)
- }
- }, e.prototype.getCurrent = function(t) {
- return t >= this.tracks.length ? null : this.tracks[t]
- }, e.prototype.addListener = function(t) {
- if (null == t) throw new Error("listener cannot be null.");
- this.listeners.push(t)
- }, e.prototype.removeListener = function(t) {
- var e = this.listeners.indexOf(t);
- e >= 0 && this.listeners.splice(e, 1)
- }, e.prototype.clearListeners = function() {
- this.listeners.length = 0
- }, e.prototype.clearListenerNotifications = function() {
- this.queue.clear()
- }, e.emptyAnimation = new t.Animation("<empty>", [], 0), e.SUBSEQUENT = 0, e.FIRST = 1, e.DIP = 2, e.DIP_MIX = 3, e
- })();
- t.AnimationState = e;
- var i = (function() {
- function i() {
- this.timelineData = new Array, this.timelineDipMix = new Array, this.timelinesRotation = new Array
- }
- return i.prototype.reset = function() {
- this.next = null, this.mixingFrom = null, this.animation = null, this.listener = null, this.timelineData.length = 0, this.timelineDipMix.length = 0, this.timelinesRotation.length = 0
- }, i.prototype.setTimelineData = function(i, n, r) {
- null != i && n.push(i);
- var s = null != this.mixingFrom ? this.mixingFrom.setTimelineData(this, n, r) : this;
- null != i && n.pop();
- var o = n,
- a = n.length - 1,
- l = this.animation.timelines,
- h = this.animation.timelines.length,
- c = t.Utils.setArraySize(this.timelineData, h);
- this.timelineDipMix.length = 0;
- var u = t.Utils.setArraySize(this.timelineDipMix, h);
- t: for (var _ = 0; _ < h; _++) {
- var f = l[_].getPropertyId();
- if (r.add(f))
- if (null != i && i.hasTimeline(f)) {
- for (var d = a; d >= 0; d--) {
- var p = o[d];
- if (!p.hasTimeline(f) && p.mixDuration > 0) {
- c[_] = e.DIP_MIX, u[_] = p;
- continue t
- }
- }
- c[_] = e.DIP
- } else c[_] = e.FIRST;
- else c[_] = e.SUBSEQUENT
- }
- return s
- }, i.prototype.hasTimeline = function(t) {
- for (var e = this.animation.timelines, i = 0, n = e.length; i < n; i++)
- if (e[i].getPropertyId() == t) return !0;
- return !1
- }, i.prototype.getAnimationTime = function() {
- if (this.loop) {
- var t = this.animationEnd - this.animationStart;
- return 0 == t ? this.animationStart : this.trackTime % t + this.animationStart
- }
- return Math.min(this.trackTime + this.animationStart, this.animationEnd)
- }, i.prototype.setAnimationLast = function(t) {
- this.animationLast = t, this.nextAnimationLast = t
- }, i.prototype.isComplete = function() {
- return this.trackTime >= this.animationEnd - this.animationStart
- }, i.prototype.resetRotationDirections = function() {
- this.timelinesRotation.length = 0
- }, i
- })();
- t.TrackEntry = i;
- var n, r = (function() {
- function t(t) {
- this.objects = [], this.drainDisabled = !1, this.animState = t
- }
- return t.prototype.start = function(t) {
- this.objects.push(n.start), this.objects.push(t), this.animState.animationsChanged = !0
- }, t.prototype.interrupt = function(t) {
- this.objects.push(n.interrupt), this.objects.push(t)
- }, t.prototype.end = function(t) {
- this.objects.push(n.end), this.objects.push(t), this.animState.animationsChanged = !0
- }, t.prototype.dispose = function(t) {
- this.objects.push(n.dispose), this.objects.push(t)
- }, t.prototype.complete = function(t) {
- this.objects.push(n.complete), this.objects.push(t)
- }, t.prototype.event = function(t, e) {
- this.objects.push(n.event), this.objects.push(t), this.objects.push(e)
- }, t.prototype.drain = function() {
- if (!this.drainDisabled) {
- this.drainDisabled = !0;
- for (var t = this.objects, e = this.animState.listeners, i = 0; i < t.length; i += 2) {
- var r = t[i],
- s = t[i + 1];
- switch (r) {
- case n.start:
- null != s.listener && s.listener.start && s.listener.start(s);
- for (var o = 0; o < e.length; o++) e[o].start && e[o].start(s);
- break;
- case n.interrupt:
- null != s.listener && s.listener.interrupt && s.listener.interrupt(s);
- for (o = 0; o < e.length; o++) e[o].interrupt && e[o].interrupt(s);
- break;
- case n.end:
- null != s.listener && s.listener.end && s.listener.end(s);
- for (o = 0; o < e.length; o++) e[o].end && e[o].end(s);
- case n.dispose:
- null != s.listener && s.listener.dispose && s.listener.dispose(s);
- for (o = 0; o < e.length; o++) e[o].dispose && e[o].dispose(s);
- this.animState.trackEntryPool.free(s);
- break;
- case n.complete:
- null != s.listener && s.listener.complete && s.listener.complete(s);
- for (o = 0; o < e.length; o++) e[o].complete && e[o].complete(s);
- break;
- case n.event:
- var a = t[2 + i++];
- null != s.listener && s.listener.event && s.listener.event(s, a);
- for (o = 0; o < e.length; o++) e[o].event && e[o].event(s, a)
- }
- }
- this.clear(), this.drainDisabled = !1
- }
- }, t.prototype.clear = function() {
- this.objects.length = 0
- }, t
- })();
- t.EventQueue = r, (function(t) {
- t[t.start = 0] = "start", t[t.interrupt = 1] = "interrupt", t[t.end = 2] = "end", t[t.dispose = 3] = "dispose", t[t.complete = 4] = "complete", t[t.event = 5] = "event"
- })(n = t.EventType || (t.EventType = {}));
- var s = (function() {
- function t() {}
- return t.prototype.start = function(t) {}, t.prototype.interrupt = function(t) {}, t.prototype.end = function(t) {}, t.prototype.dispose = function(t) {}, t.prototype.complete = function(t) {}, t.prototype.event = function(t, e) {}, t
- })();
- t.AnimationStateAdapter2 = s
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function t(t) {
- if (this.animationToMixTime = {}, this.defaultMix = 0, null == t) throw new Error("skeletonData cannot be null.");
- this.skeletonData = t
- }
- return t.prototype.setMix = function(t, e, i) {
- var n = this.skeletonData.findAnimation(t);
- if (null == n) throw new Error("Animation not found: " + t);
- var r = this.skeletonData.findAnimation(e);
- if (null == r) throw new Error("Animation not found: " + e);
- this.setMixWith(n, r, i)
- }, t.prototype.setMixWith = function(t, e, i) {
- if (null == t) throw new Error("from cannot be null.");
- if (null == e) throw new Error("to cannot be null.");
- var n = t.name + "." + e.name;
- this.animationToMixTime[n] = i
- }, t.prototype.getMix = function(t, e) {
- var i = t.name + "." + e.name,
- n = this.animationToMixTime[i];
- return void 0 === n ? this.defaultMix : n
- }, t
- })();
- t.AnimationStateData = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- void 0 === e && (e = ""), this.assets = {}, this.errors = {}, this.toLoad = 0, this.loaded = 0, this.textureLoader = t, this.pathPrefix = e
- }
- return e.downloadText = function(t, e, i) {
- var n = new XMLHttpRequest;
- n.open("GET", t, !0), n.onload = function() {
- 200 == n.status ? e(n.responseText) : i(n.status, n.responseText)
- }, n.onerror = function() {
- i(n.status, n.responseText)
- }, n.send()
- }, e.downloadBinary = function(t, e, i) {
- var n = new XMLHttpRequest;
- n.open("GET", t, !0), n.responseType = "arraybuffer", n.onload = function() {
- 200 == n.status ? e(new Uint8Array(n.response)) : i(n.status, n.responseText)
- }, n.onerror = function() {
- i(n.status, n.responseText)
- }, n.send()
- }, e.prototype.loadText = function(t, i, n) {
- var r = this;
- void 0 === i && (i = null), void 0 === n && (n = null), t = this.pathPrefix + t, this.toLoad++, e.downloadText(t, (function(e) {
- r.assets[t] = e, i && i(t, e), r.toLoad--, r.loaded++
- }), (function(e, i) {
- r.errors[t] = "Couldn't load text " + t + ": status " + status + ", " + i, n && n(t, "Couldn't load text " + t + ": status " + status + ", " + i), r.toLoad--, r.loaded++
- }))
- }, e.prototype.loadTexture = function(t, e, i) {
- var n = this;
- void 0 === e && (e = null), void 0 === i && (i = null), t = this.pathPrefix + t, this.toLoad++;
- var r = new Image;
- r.crossOrigin = "anonymous", r.onload = function(i) {
- var s = n.textureLoader(r);
- n.assets[t] = s, n.toLoad--, n.loaded++, e && e(t, r)
- }, r.onerror = function(e) {
- n.errors[t] = "Couldn't load image " + t, n.toLoad--, n.loaded++, i && i(t, "Couldn't load image " + t)
- }, r.src = t
- }, e.prototype.loadTextureData = function(t, e, i, n) {
- var r = this;
- void 0 === i && (i = null), void 0 === n && (n = null), t = this.pathPrefix + t, this.toLoad++;
- var s = new Image;
- s.onload = function(e) {
- var n = r.textureLoader(s);
- r.assets[t] = n, r.toLoad--, r.loaded++, i && i(t, s)
- }, s.onerror = function(e) {
- r.errors[t] = "Couldn't load image " + t, r.toLoad--, r.loaded++, n && n(t, "Couldn't load image " + t)
- }, s.src = e
- }, e.prototype.loadTextureAtlas = function(i, n, r) {
- var s = this;
- void 0 === n && (n = null), void 0 === r && (r = null);
- var o = i.lastIndexOf("/") >= 0 ? i.substring(0, i.lastIndexOf("/")) : "";
- i = this.pathPrefix + i, this.toLoad++, e.downloadText(i, (function(e) {
- var a = {
- count: 0
- },
- l = new Array;
- try {
- new t.TextureAtlas(e, function(e) {
- l.push(o + "/" + e);
- var i = document.createElement("img");
- return i.width = 16, i.height = 16, new t.FakeTexture(i)
- })
- } catch (t) {
- var h = t;
- return s.errors[i] = "Couldn't load texture atlas " + i + ": " + h.message, r && r(i, "Couldn't load texture atlas " + i + ": " + h.message), s.toLoad--, void s.loaded++
- }
- for (var c = function(h) {
- var c = !1;
- s.loadTexture(h, (function(h, u) {
- if (a.count++, a.count == l.length)
- if (c) s.errors[i] = "Couldn't load texture atlas page " + h + "} of atlas " + i, r && r(i, "Couldn't load texture atlas page " + h + " of atlas " + i), s.toLoad--, s.loaded++;
- else try {
- var _ = new t.TextureAtlas(e, function(t) {
- return s.get(o + "/" + t)
- });
- s.assets[i] = _, n && n(i, _), s.toLoad--, s.loaded++
- } catch (t) {
- var f = t;
- s.errors[i] = "Couldn't load texture atlas " + i + ": " + f.message, r && r(i, "Couldn't load texture atlas " + i + ": " + f.message), s.toLoad--, s.loaded++
- }
- }), (function(t, e) {
- c = !0, a.count++, a.count == l.length && (s.errors[i] = "Couldn't load texture atlas page " + t + "} of atlas " + i, r && r(i, "Couldn't load texture atlas page " + t + " of atlas " + i), s.toLoad--, s.loaded++)
- }))
- }, u = 0, _ = l; u < _.length; u++) {
- c(_[u])
- }
- }), (function(t, e) {
- s.errors[i] = "Couldn't load texture atlas " + i + ": status " + status + ", " + e, r && r(i, "Couldn't load texture atlas " + i + ": status " + status + ", " + e), s.toLoad--, s.loaded++
- }))
- }, e.prototype.get = function(t) {
- return t = this.pathPrefix + t, this.assets[t]
- }, e.prototype.remove = function(t) {
- t = this.pathPrefix + t;
- var e = this.assets[t];
- e.dispose && e.dispose(), this.assets[t] = null
- }, e.prototype.removeAll = function() {
- for (var t in this.assets) {
- var e = this.assets[t];
- e.dispose && e.dispose()
- }
- this.assets = {}
- }, e.prototype.isLoadingComplete = function() {
- return 0 == this.toLoad
- }, e.prototype.getToLoad = function() {
- return this.toLoad
- }, e.prototype.getLoaded = function() {
- return this.loaded
- }, e.prototype.dispose = function() {
- this.removeAll()
- }, e.prototype.hasErrors = function() {
- return Object.keys(this.errors).length > 0
- }, e.prototype.getErrors = function() {
- return this.errors
- }, e
- })();
- t.AssetManager = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t) {
- this.atlas = t
- }
- return e.prototype.newRegionAttachment = function(e, i, n) {
- var r = this.atlas.findRegion(n);
- if (null == r) throw new Error("Region not found in atlas: " + n + " (region attachment: " + i + ")");
- r.renderObject = r;
- var s = new t.RegionAttachment(i);
- return s.setRegion(r), s
- }, e.prototype.newMeshAttachment = function(e, i, n) {
- var r = this.atlas.findRegion(n);
- if (null == r) throw new Error("Region not found in atlas: " + n + " (mesh attachment: " + i + ")");
- r.renderObject = r;
- var s = new t.MeshAttachment(i);
- return s.region = r, s
- }, e.prototype.newBoundingBoxAttachment = function(e, i) {
- return new t.BoundingBoxAttachment(i)
- }, e.prototype.newPathAttachment = function(e, i) {
- return new t.PathAttachment(i)
- }, e.prototype.newPointAttachment = function(e, i) {
- return new t.PointAttachment(i)
- }, e.prototype.newClippingAttachment = function(e, i) {
- return new t.ClippingAttachment(i)
- }, e
- })();
- t.AtlasAttachmentLoader = e
- })(n || (n = {})), (function(t) {
- (function(t) {
- t[t.Normal = 0] = "Normal", t[t.Additive = 1] = "Additive", t[t.Multiply = 2] = "Multiply", t[t.Screen = 3] = "Screen"
- })(t.BlendMode || (t.BlendMode = {}))
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e, i) {
- if (this.children = new Array, this.x = 0, this.y = 0, this.rotation = 0, this.scaleX = 0, this.scaleY = 0, this.shearX = 0, this.shearY = 0, this.ax = 0, this.ay = 0, this.arotation = 0, this.ascaleX = 0, this.ascaleY = 0, this.ashearX = 0, this.ashearY = 0, this.appliedValid = !1, this.a = 0, this.b = 0, this.worldX = 0, this.c = 0, this.d = 0, this.worldY = 0, this.sorted = !1, null == t) throw new Error("data cannot be null.");
- if (null == e) throw new Error("skeleton cannot be null.");
- this.data = t, this.skeleton = e, this.parent = i, this.setToSetupPose()
- }
- return e.prototype.update = function() {
- this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY)
- }, e.prototype.updateWorldTransform = function() {
- this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY)
- }, e.prototype.updateWorldTransformWith = function(e, i, n, r, s, o, a) {
- this.ax = e, this.ay = i, this.arotation = n, this.ascaleX = r, this.ascaleY = s, this.ashearX = o, this.ashearY = a, this.appliedValid = !0;
- var l = this.parent;
- if (null == l) {
- var h = n + 90 + a,
- c = t.MathUtils.cosDeg(n + o) * r,
- u = t.MathUtils.cosDeg(h) * s,
- _ = t.MathUtils.sinDeg(n + o) * r,
- f = t.MathUtils.sinDeg(h) * s,
- d = this.skeleton;
- return d.flipX && (e = -e, c = -c, u = -u), d.flipY && (i = -i, _ = -_, f = -f), this.a = c, this.b = u, this.c = _, this.d = f, this.worldX = e + d.x, void(this.worldY = i + d.y)
- }
- var p = l.a,
- m = l.b,
- y = l.c,
- v = l.d;
- switch (this.worldX = p * e + m * i + l.worldX, this.worldY = y * e + v * i + l.worldY, this.data.transformMode) {
- case t.TransformMode.Normal:
- h = n + 90 + a, c = t.MathUtils.cosDeg(n + o) * r, u = t.MathUtils.cosDeg(h) * s, _ = t.MathUtils.sinDeg(n + o) * r, f = t.MathUtils.sinDeg(h) * s;
- return this.a = p * c + m * _, this.b = p * u + m * f, this.c = y * c + v * _, void(this.d = y * u + v * f);
- case t.TransformMode.OnlyTranslation:
- h = n + 90 + a;
- this.a = t.MathUtils.cosDeg(n + o) * r, this.b = t.MathUtils.cosDeg(h) * s, this.c = t.MathUtils.sinDeg(n + o) * r, this.d = t.MathUtils.sinDeg(h) * s;
- break;
- case t.TransformMode.NoRotationOrReflection:
- var g = 0;
- (A = p * p + y * y) > 1e-4 ? (m = y * (A = Math.abs(p * v - m * y) / A), v = p * A, g = Math.atan2(y, p) * t.MathUtils.radDeg) : (p = 0, y = 0, g = 90 - Math.atan2(v, m) * t.MathUtils.radDeg);
- var x = n + o - g,
- b = n + a - g + 90;
- c = t.MathUtils.cosDeg(x) * r, u = t.MathUtils.cosDeg(b) * s, _ = t.MathUtils.sinDeg(x) * r, f = t.MathUtils.sinDeg(b) * s;
- this.a = p * c - m * _, this.b = p * u - m * f, this.c = y * c + v * _, this.d = y * u + v * f;
- break;
- case t.TransformMode.NoScale:
- case t.TransformMode.NoScaleOrReflection:
- var A, C = t.MathUtils.cosDeg(n),
- T = t.MathUtils.sinDeg(n),
- S = p * C + m * T,
- w = y * C + v * T;
- (A = Math.sqrt(S * S + w * w)) > 1e-5 && (A = 1 / A), S *= A, w *= A, A = Math.sqrt(S * S + w * w);
- var E = Math.PI / 2 + Math.atan2(w, S),
- M = Math.cos(E) * A,
- D = Math.sin(E) * A;
- c = t.MathUtils.cosDeg(o) * r, u = t.MathUtils.cosDeg(90 + a) * s, _ = t.MathUtils.sinDeg(o) * r, f = t.MathUtils.sinDeg(90 + a) * s;
- return (this.data.transformMode != t.TransformMode.NoScaleOrReflection ? p * v - m * y < 0 : this.skeleton.flipX != this.skeleton.flipY) && (M = -M, D = -D), this.a = S * c + M * _, this.b = S * u + M * f, this.c = w * c + D * _, void(this.d = w * u + D * f)
- }
- this.skeleton.flipX && (this.a = -this.a, this.b = -this.b), this.skeleton.flipY && (this.c = -this.c, this.d = -this.d)
- }, e.prototype.setToSetupPose = function() {
- var t = this.data;
- this.x = t.x, this.y = t.y, this.rotation = t.rotation, this.scaleX = t.scaleX, this.scaleY = t.scaleY, this.shearX = t.shearX, this.shearY = t.shearY
- }, e.prototype.getWorldRotationX = function() {
- return Math.atan2(this.c, this.a) * t.MathUtils.radDeg
- }, e.prototype.getWorldRotationY = function() {
- return Math.atan2(this.d, this.b) * t.MathUtils.radDeg
- }, e.prototype.getWorldScaleX = function() {
- return Math.sqrt(this.a * this.a + this.c * this.c)
- }, e.prototype.getWorldScaleY = function() {
- return Math.sqrt(this.b * this.b + this.d * this.d)
- }, e.prototype.updateAppliedTransform = function() {
- this.appliedValid = !0;
- var e = this.parent;
- if (null == e) return this.ax = this.worldX, this.ay = this.worldY, this.arotation = Math.atan2(this.c, this.a) * t.MathUtils.radDeg, this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c), this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d), this.ashearX = 0, void(this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * t.MathUtils.radDeg);
- var i = e.a,
- n = e.b,
- r = e.c,
- s = e.d,
- o = 1 / (i * s - n * r),
- a = this.worldX - e.worldX,
- l = this.worldY - e.worldY;
- this.ax = a * s * o - l * n * o, this.ay = l * i * o - a * r * o;
- var h = o * s,
- c = o * i,
- u = o * n,
- _ = o * r,
- f = h * this.a - u * this.c,
- d = h * this.b - u * this.d,
- p = c * this.c - _ * this.a,
- m = c * this.d - _ * this.b;
- if (this.ashearX = 0, this.ascaleX = Math.sqrt(f * f + p * p), this.ascaleX > 1e-4) {
- var y = f * m - d * p;
- this.ascaleY = y / this.ascaleX, this.ashearY = Math.atan2(f * d + p * m, y) * t.MathUtils.radDeg, this.arotation = Math.atan2(p, f) * t.MathUtils.radDeg
- } else this.ascaleX = 0, this.ascaleY = Math.sqrt(d * d + m * m), this.ashearY = 0, this.arotation = 90 - Math.atan2(m, d) * t.MathUtils.radDeg
- }, e.prototype.worldToLocal = function(t) {
- var e = this.a,
- i = this.b,
- n = this.c,
- r = this.d,
- s = 1 / (e * r - i * n),
- o = t.x - this.worldX,
- a = t.y - this.worldY;
- return t.x = o * r * s - a * i * s, t.y = a * e * s - o * n * s, t
- }, e.prototype.localToWorld = function(t) {
- var e = t.x,
- i = t.y;
- return t.x = e * this.a + i * this.b + this.worldX, t.y = e * this.c + i * this.d + this.worldY, t
- }, e.prototype.worldToLocalRotation = function(e) {
- var i = t.MathUtils.sinDeg(e),
- n = t.MathUtils.cosDeg(e);
- return Math.atan2(this.a * i - this.c * n, this.d * n - this.b * i) * t.MathUtils.radDeg
- }, e.prototype.localToWorldRotation = function(e) {
- var i = t.MathUtils.sinDeg(e),
- n = t.MathUtils.cosDeg(e);
- return Math.atan2(n * this.c + i * this.d, n * this.a + i * this.b) * t.MathUtils.radDeg
- }, e.prototype.rotateWorld = function(e) {
- var i = this.a,
- n = this.b,
- r = this.c,
- s = this.d,
- o = t.MathUtils.cosDeg(e),
- a = t.MathUtils.sinDeg(e);
- this.a = o * i - a * r, this.b = o * n - a * s, this.c = a * i + o * r, this.d = a * n + o * s, this.appliedValid = !1
- }, e
- })();
- t.Bone = e
- })(n || (n = {})), (function(t) {
- var e, i = (function() {
- return function(t, i, n) {
- if (this.x = 0, this.y = 0, this.rotation = 0, this.scaleX = 1, this.scaleY = 1, this.shearX = 0, this.shearY = 0, this.transformMode = e.Normal, t < 0) throw new Error("index must be >= 0.");
- if (null == i) throw new Error("name cannot be null.");
- this.index = t, this.name = i, this.parent = n
- }
- })();
- t.BoneData = i, (function(t) {
- t[t.Normal = 0] = "Normal", t[t.OnlyTranslation = 1] = "OnlyTranslation", t[t.NoRotationOrReflection = 2] = "NoRotationOrReflection", t[t.NoScale = 3] = "NoScale", t[t.NoScaleOrReflection = 4] = "NoScaleOrReflection"
- })(e = t.TransformMode || (t.TransformMode = {}))
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(t, e) {
- if (null == e) throw new Error("data cannot be null.");
- this.time = t, this.data = e
- }
- })();
- t.Event = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(t) {
- this.name = t
- }
- })();
- t.EventData = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- if (this.mix = 1, this.bendDirection = 0, null == t) throw new Error("data cannot be null.");
- if (null == e) throw new Error("skeleton cannot be null.");
- this.data = t, this.mix = t.mix, this.bendDirection = t.bendDirection, this.bones = new Array;
- for (var i = 0; i < t.bones.length; i++) this.bones.push(e.findBone(t.bones[i].name));
- this.target = e.findBone(t.target.name)
- }
- return e.prototype.getOrder = function() {
- return this.data.order
- }, e.prototype.apply = function() {
- this.update()
- }, e.prototype.update = function() {
- var t = this.target,
- e = this.bones;
- switch (e.length) {
- case 1:
- this.apply1(e[0], t.worldX, t.worldY, this.mix);
- break;
- case 2:
- this.apply2(e[0], e[1], t.worldX, t.worldY, this.bendDirection, this.mix)
- }
- }, e.prototype.apply1 = function(e, i, n, r) {
- e.appliedValid || e.updateAppliedTransform();
- var s = e.parent,
- o = 1 / (s.a * s.d - s.b * s.c),
- a = i - s.worldX,
- l = n - s.worldY,
- h = (a * s.d - l * s.b) * o - e.ax,
- c = (l * s.a - a * s.c) * o - e.ay,
- u = Math.atan2(c, h) * t.MathUtils.radDeg - e.ashearX - e.arotation;
- e.ascaleX < 0 && (u += 180), u > 180 ? u -= 360 : u < -180 && (u += 360), e.updateWorldTransformWith(e.ax, e.ay, e.arotation + u * r, e.ascaleX, e.ascaleY, e.ashearX, e.ashearY)
- }, e.prototype.apply2 = function(e, i, n, r, s, o) {
- if (0 != o) {
- e.appliedValid || e.updateAppliedTransform(), i.appliedValid || i.updateAppliedTransform();
- var a = e.ax,
- l = e.ay,
- h = e.ascaleX,
- c = e.ascaleY,
- u = i.ascaleX,
- _ = 0,
- f = 0,
- d = 0;
- h < 0 ? (h = -h, _ = 180, d = -1) : (_ = 0, d = 1), c < 0 && (c = -c, d = -d), u < 0 ? (u = -u, f = 180) : f = 0;
- var p = i.ax,
- m = 0,
- y = 0,
- v = 0,
- g = e.a,
- x = e.b,
- b = e.c,
- A = e.d,
- C = Math.abs(h - c) <= 1e-4;
- C ? (y = g * p + x * (m = i.ay) + e.worldX, v = b * p + A * m + e.worldY) : (m = 0, y = g * p + e.worldX, v = b * p + e.worldY);
- var T = e.parent;
- g = T.a, x = T.b, b = T.c;
- var S = 1 / (g * (A = T.d) - x * b),
- w = n - T.worldX,
- E = r - T.worldY,
- M = (w * A - E * x) * S - a,
- D = (E * g - w * b) * S - l,
- B = ((w = y - T.worldX) * A - (E = v - T.worldY) * x) * S - a,
- I = (E * g - w * b) * S - l,
- P = Math.sqrt(B * B + I * I),
- R = i.data.length * u,
- O = 0,
- L = 0;
- t: if (C) {
- var F = (M * M + D * D - P * P - (R *= h) * R) / (2 * P * R);
- F < -1 ? F = -1 : F > 1 && (F = 1), L = Math.acos(F) * s, g = P + R * F, x = R * Math.sin(L), O = Math.atan2(D * g - M * x, M * g + D * x)
- } else {
- var N = (g = h * R) * g,
- V = (x = c * R) * x,
- k = M * M + D * D,
- G = Math.atan2(D, M),
- U = -2 * V * P,
- z = V - N;
- if ((A = U * U - 4 * z * (b = V * P * P + N * k - N * V)) >= 0) {
- var j = Math.sqrt(A);
- U < 0 && (j = -j);
- var W = (j = -(U + j) / 2) / z,
- H = b / j,
- X = Math.abs(W) < Math.abs(H) ? W : H;
- if (X * X <= k) {
- E = Math.sqrt(k - X * X) * s, O = G - Math.atan2(E, X), L = Math.atan2(E / c, (X - P) / h);
- break t
- }
- }
- var Y = t.MathUtils.PI,
- q = P - g,
- J = q * q,
- Z = 0,
- K = 0,
- Q = P + g,
- $ = Q * Q,
- tt = 0;
- (b = -g * P / (N - V)) >= -1 && b <= 1 && (b = Math.acos(b), (A = (w = g * Math.cos(b) + P) * w + (E = x * Math.sin(b)) * E) < J && (Y = b, J = A, q = w, Z = E), A > $ && (K = b, $ = A, Q = w, tt = E)), k <= (J + $) / 2 ? (O = G - Math.atan2(Z * s, q), L = Y * s) : (O = G - Math.atan2(tt * s, Q), L = K * s)
- }
- var et = Math.atan2(m, p) * d,
- it = e.arotation;
- (O = (O - et) * t.MathUtils.radDeg + _ - it) > 180 ? O -= 360 : O < -180 && (O += 360), e.updateWorldTransformWith(a, l, it + O * o, e.ascaleX, e.ascaleY, 0, 0), it = i.arotation, (L = ((L + et) * t.MathUtils.radDeg - i.ashearX) * d + f - it) > 180 ? L -= 360 : L < -180 && (L += 360), i.updateWorldTransformWith(p, m, it + L * o, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY)
- } else i.updateWorldTransform()
- }, e
- })();
- t.IkConstraint = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(t) {
- this.order = 0, this.bones = new Array, this.bendDirection = 1, this.mix = 1, this.name = t
- }
- })();
- t.IkConstraintData = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- if (this.position = 0, this.spacing = 0, this.rotateMix = 0, this.translateMix = 0, this.spaces = new Array, this.positions = new Array, this.world = new Array, this.curves = new Array, this.lengths = new Array, this.segments = new Array, null == t) throw new Error("data cannot be null.");
- if (null == e) throw new Error("skeleton cannot be null.");
- this.data = t, this.bones = new Array;
- for (var i = 0, n = t.bones.length; i < n; i++) this.bones.push(e.findBone(t.bones[i].name));
- this.target = e.findSlot(t.target.name), this.position = t.position, this.spacing = t.spacing, this.rotateMix = t.rotateMix, this.translateMix = t.translateMix
- }
- return e.prototype.apply = function() {
- this.update()
- }, e.prototype.update = function() {
- var i = this.target.getAttachment();
- if (i instanceof t.PathAttachment) {
- var n = this.rotateMix,
- r = this.translateMix,
- s = n > 0;
- if (r > 0 || s) {
- var o = this.data,
- a = o.spacingMode,
- l = a == t.SpacingMode.Length,
- h = o.rotateMode,
- c = h == t.RotateMode.Tangent,
- u = h == t.RotateMode.ChainScale,
- _ = this.bones.length,
- f = c ? _ : _ + 1,
- d = this.bones,
- p = t.Utils.setArraySize(this.spaces, f),
- m = null,
- y = this.spacing;
- if (u || l) {
- u && (m = t.Utils.setArraySize(this.lengths, _));
- for (var v = 0, g = f - 1; v < g;) {
- var x = (B = d[v]).data.length;
- if (x < e.epsilon) u && (m[v] = 0), p[++v] = 0;
- else {
- var b = x * B.a,
- A = x * B.c,
- C = Math.sqrt(b * b + A * A);
- u && (m[v] = C), p[++v] = (l ? x + y : y) * C / x
- }
- }
- } else
- for (v = 1; v < f; v++) p[v] = y;
- var T = this.computeWorldPositions(i, f, c, o.positionMode == t.PositionMode.Percent, a == t.SpacingMode.Percent),
- S = T[0],
- w = T[1],
- E = o.offsetRotation,
- M = !1;
- if (0 == E) M = h == t.RotateMode.Chain;
- else M = !1, E *= (D = this.target.bone).a * D.d - D.b * D.c > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad;
- v = 0;
- for (var D = 3; v < _; v++, D += 3) {
- var B;
- (B = d[v]).worldX += (S - B.worldX) * r, B.worldY += (w - B.worldY) * r;
- var I = (b = T[D]) - S,
- P = (A = T[D + 1]) - w;
- if (u) {
- var R = m[v];
- if (0 != R) {
- var O = (Math.sqrt(I * I + P * P) / R - 1) * n + 1;
- B.a *= O, B.c *= O
- }
- }
- if (S = b, w = A, s) {
- var L = B.a,
- F = B.b,
- N = B.c,
- V = B.d,
- k = 0,
- G = 0,
- U = 0;
- if (k = c ? T[D - 1] : 0 == p[v + 1] ? T[D + 2] : Math.atan2(P, I), k -= Math.atan2(N, L), M) {
- G = Math.cos(k), U = Math.sin(k);
- var z = B.data.length;
- S += (z * (G * L - U * N) - I) * n, w += (z * (U * L + G * N) - P) * n
- } else k += E;
- k > t.MathUtils.PI ? k -= t.MathUtils.PI2 : k < -t.MathUtils.PI && (k += t.MathUtils.PI2), k *= n, G = Math.cos(k), U = Math.sin(k), B.a = G * L - U * N, B.b = G * F - U * V, B.c = U * L + G * N, B.d = U * F + G * V
- }
- B.appliedValid = !1
- }
- }
- }
- }, e.prototype.computeWorldPositions = function(i, n, r, s, o) {
- var a = this.target,
- l = this.position,
- h = this.spaces,
- c = t.Utils.setArraySize(this.positions, 3 * n + 2),
- u = null,
- _ = i.closed,
- f = i.worldVerticesLength,
- d = f / 6,
- p = e.NONE;
- if (!i.constantSpeed) {
- var m = i.lengths,
- y = m[d -= _ ? 1 : 2];
- if (s && (l *= y), o)
- for (var v = 0; v < n; v++) h[v] *= y;
- u = t.Utils.setArraySize(this.world, 8);
- v = 0;
- for (var g = 0, x = 0; v < n; v++, g += 3) {
- var b = l += H = h[v];
- if (_)(b %= y) < 0 && (b += y), x = 0;
- else {
- if (b < 0) {
- p != e.BEFORE && (p = e.BEFORE, i.computeWorldVertices(a, 2, 4, u, 0, 2)), this.addBeforePosition(b, u, 0, c, g);
- continue
- }
- if (b > y) {
- p != e.AFTER && (p = e.AFTER, i.computeWorldVertices(a, f - 6, 4, u, 0, 2)), this.addAfterPosition(b - y, u, 0, c, g);
- continue
- }
- }
- for (;; x++) {
- var A = m[x];
- if (!(b > A)) {
- if (0 == x) b /= A;
- else b = (b - (J = m[x - 1])) / (A - J);
- break
- }
- }
- x != p && (p = x, _ && x == d ? (i.computeWorldVertices(a, f - 4, 4, u, 0, 2), i.computeWorldVertices(a, 0, 4, u, 4, 2)) : i.computeWorldVertices(a, 6 * x + 2, 8, u, 0, 2)), this.addCurvePosition(b, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], c, g, r || v > 0 && 0 == H)
- }
- return c
- }
- _ ? (f += 2, u = t.Utils.setArraySize(this.world, f), i.computeWorldVertices(a, 2, f - 4, u, 0, 2), i.computeWorldVertices(a, 0, 2, u, f - 4, 2), u[f - 2] = u[0], u[f - 1] = u[1]) : (d--, f -= 4, u = t.Utils.setArraySize(this.world, f), i.computeWorldVertices(a, 2, f, u, 0, 2));
- for (var C = t.Utils.setArraySize(this.curves, d), T = 0, S = u[0], w = u[1], E = 0, M = 0, D = 0, B = 0, I = 0, P = 0, R = 0, O = 0, L = 0, F = 0, N = 0, V = 0, k = 0, G = 0, U = (v = 0, 2); v < d; v++, U += 6) E = u[U], M = u[U + 1], D = u[U + 2], B = u[U + 3], I = u[U + 4], P = u[U + 5], N = 2 * (R = .1875 * (S - 2 * E + D)) + (L = .09375 * (3 * (E - D) - S + I)), V = 2 * (O = .1875 * (w - 2 * M + B)) + (F = .09375 * (3 * (M - B) - w + P)), k = .75 * (E - S) + R + .16666667 * L, G = .75 * (M - w) + O + .16666667 * F, T += Math.sqrt(k * k + G * G), k += N, G += V, N += L, V += F, T += Math.sqrt(k * k + G * G), k += N, G += V, T += Math.sqrt(k * k + G * G), k += N + L, G += V + F, T += Math.sqrt(k * k + G * G), C[v] = T, S = I, w = P;
- if (s && (l *= T), o)
- for (v = 0; v < n; v++) h[v] *= T;
- for (var z = this.segments, j = 0, W = (v = 0, g = 0, x = 0, 0); v < n; v++, g += 3) {
- var H;
- b = l += H = h[v];
- if (_)(b %= T) < 0 && (b += T), x = 0;
- else {
- if (b < 0) {
- this.addBeforePosition(b, u, 0, c, g);
- continue
- }
- if (b > T) {
- this.addAfterPosition(b - T, u, f - 4, c, g);
- continue
- }
- }
- for (;; x++) {
- var X = C[x];
- if (!(b > X)) {
- if (0 == x) b /= X;
- else b = (b - (J = C[x - 1])) / (X - J);
- break
- }
- }
- if (x != p) {
- p = x;
- var Y = 6 * x;
- for (S = u[Y], w = u[Y + 1], E = u[Y + 2], M = u[Y + 3], D = u[Y + 4], B = u[Y + 5], I = u[Y + 6], P = u[Y + 7], N = 2 * (R = .03 * (S - 2 * E + D)) + (L = .006 * (3 * (E - D) - S + I)), V = 2 * (O = .03 * (w - 2 * M + B)) + (F = .006 * (3 * (M - B) - w + P)), k = .3 * (E - S) + R + .16666667 * L, G = .3 * (M - w) + O + .16666667 * F, j = Math.sqrt(k * k + G * G), z[0] = j, Y = 1; Y < 8; Y++) k += N, G += V, N += L, V += F, j += Math.sqrt(k * k + G * G), z[Y] = j;
- k += N, G += V, j += Math.sqrt(k * k + G * G), z[8] = j, k += N + L, G += V + F, j += Math.sqrt(k * k + G * G), z[9] = j, W = 0
- }
- for (b *= j;; W++) {
- var q = z[W];
- if (!(b > q)) {
- var J;
- if (0 == W) b /= q;
- else b = W + (b - (J = z[W - 1])) / (q - J);
- break
- }
- }
- this.addCurvePosition(.1 * b, S, w, E, M, D, B, I, P, c, g, r || v > 0 && 0 == H)
- }
- return c
- }, e.prototype.addBeforePosition = function(t, e, i, n, r) {
- var s = e[i],
- o = e[i + 1],
- a = e[i + 2] - s,
- l = e[i + 3] - o,
- h = Math.atan2(l, a);
- n[r] = s + t * Math.cos(h), n[r + 1] = o + t * Math.sin(h), n[r + 2] = h
- }, e.prototype.addAfterPosition = function(t, e, i, n, r) {
- var s = e[i + 2],
- o = e[i + 3],
- a = s - e[i],
- l = o - e[i + 1],
- h = Math.atan2(l, a);
- n[r] = s + t * Math.cos(h), n[r + 1] = o + t * Math.sin(h), n[r + 2] = h
- }, e.prototype.addCurvePosition = function(t, e, i, n, r, s, o, a, l, h, c, u) {
- (0 == t || isNaN(t)) && (t = 1e-4);
- var _ = t * t,
- f = _ * t,
- d = 1 - t,
- p = d * d,
- m = p * d,
- y = d * t,
- v = 3 * y,
- g = d * v,
- x = v * t,
- b = e * m + n * g + s * x + a * f,
- A = i * m + r * g + o * x + l * f;
- h[c] = b, h[c + 1] = A, u && (h[c + 2] = Math.atan2(A - (i * p + r * y * 2 + o * _), b - (e * p + n * y * 2 + s * _)))
- }, e.prototype.getOrder = function() {
- return this.data.order
- }, e.NONE = -1, e.BEFORE = -2, e.AFTER = -3, e.epsilon = 1e-5, e
- })();
- t.PathConstraint = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(t) {
- this.order = 0, this.bones = new Array, this.name = t
- }
- })();
- t.PathConstraintData = e, (function(t) {
- t[t.Fixed = 0] = "Fixed", t[t.Percent = 1] = "Percent"
- })(t.PositionMode || (t.PositionMode = {})), (function(t) {
- t[t.Length = 0] = "Length", t[t.Fixed = 1] = "Fixed", t[t.Percent = 2] = "Percent"
- })(t.SpacingMode || (t.SpacingMode = {})), (function(t) {
- t[t.Tangent = 0] = "Tangent", t[t.Chain = 1] = "Chain", t[t.ChainScale = 2] = "ChainScale"
- })(t.RotateMode || (t.RotateMode = {}))
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function t(t) {
- this.toLoad = new Array, this.assets = {}, this.clientId = t
- }
- return t.prototype.loaded = function() {
- var t = 0;
- for (var e in this.assets) t++;
- return t
- }, t
- })(),
- i = (function() {
- function t(t) {
- void 0 === t && (t = ""), this.clientAssets = {}, this.queuedAssets = {}, this.rawAssets = {}, this.errors = {}, this.pathPrefix = t
- }
- return t.prototype.queueAsset = function(t, i, n) {
- var r = this.clientAssets[t];
- return null !== r && void 0 !== r || (r = new e(t), this.clientAssets[t] = r), null !== i && (r.textureLoader = i), r.toLoad.push(n), this.queuedAssets[n] !== n && (this.queuedAssets[n] = n, !0)
- }, t.prototype.loadText = function(t, e) {
- var i = this;
- if (e = this.pathPrefix + e, this.queueAsset(t, null, e)) {
- var n = new XMLHttpRequest;
- n.onreadystatechange = function() {
- n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = n.responseText : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText)
- }, n.open("GET", e, !0), n.send()
- }
- }, t.prototype.loadJson = function(t, e) {
- var i = this;
- if (e = this.pathPrefix + e, this.queueAsset(t, null, e)) {
- var n = new XMLHttpRequest;
- n.onreadystatechange = function() {
- n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = JSON.parse(n.responseText) : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText)
- }, n.open("GET", e, !0), n.send()
- }
- }, t.prototype.loadTexture = function(t, e, i) {
- var n = this;
- if (i = this.pathPrefix + i, this.queueAsset(t, e, i)) {
- var r = new Image;
- r.src = i, r.crossOrigin = "anonymous", r.onload = function(t) {
- n.rawAssets[i] = r
- }, r.onerror = function(t) {
- n.errors[i] = "Couldn't load image " + i
- }
- }
- }, t.prototype.get = function(t, e) {
- e = this.pathPrefix + e;
- var i = this.clientAssets[t];
- return null === i || void 0 === i || i.assets[e]
- }, t.prototype.updateClientAssets = function(t) {
- for (var e = 0; e < t.toLoad.length; e++) {
- var i = t.toLoad[e],
- n = t.assets[i];
- if (null === n || void 0 === n) {
- var r = this.rawAssets[i];
- if (null === r || void 0 === r) continue;
- r instanceof HTMLImageElement ? t.assets[i] = t.textureLoader(r) : t.assets[i] = r
- }
- }
- }, t.prototype.isLoadingComplete = function(t) {
- var e = this.clientAssets[t];
- return null === e || void 0 === e || (this.updateClientAssets(e), e.toLoad.length == e.loaded())
- }, t.prototype.dispose = function() {}, t.prototype.hasErrors = function() {
- return Object.keys(this.errors).length > 0
- }, t.prototype.getErrors = function() {
- return this.errors
- }, t
- })();
- t.SharedAssetManager = i
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(e) {
- if (this._updateCache = new Array, this.updateCacheReset = new Array, this.time = 0, this.flipX = !1, this.flipY = !1, this.x = 0, this.y = 0, null == e) throw new Error("data cannot be null.");
- this.data = e, this.bones = new Array;
- for (var i = 0; i < e.bones.length; i++) {
- var n = e.bones[i],
- r = void 0;
- if (null == n.parent) r = new t.Bone(n, this, null);
- else {
- var s = this.bones[n.parent.index];
- r = new t.Bone(n, this, s), s.children.push(r)
- }
- this.bones.push(r)
- }
- this.slots = new Array, this.drawOrder = new Array;
- for (i = 0; i < e.slots.length; i++) {
- var o = e.slots[i],
- a = (r = this.bones[o.boneData.index], new t.Slot(o, r));
- this.slots.push(a), this.drawOrder.push(a)
- }
- this.ikConstraints = new Array;
- for (i = 0; i < e.ikConstraints.length; i++) {
- var l = e.ikConstraints[i];
- this.ikConstraints.push(new t.IkConstraint(l, this))
- }
- this.transformConstraints = new Array;
- for (i = 0; i < e.transformConstraints.length; i++) {
- var h = e.transformConstraints[i];
- this.transformConstraints.push(new t.TransformConstraint(h, this))
- }
- this.pathConstraints = new Array;
- for (i = 0; i < e.pathConstraints.length; i++) {
- var c = e.pathConstraints[i];
- this.pathConstraints.push(new t.PathConstraint(c, this))
- }
- this.color = new t.Color(1, 1, 1, 1), this.updateCache()
- }
- return e.prototype.updateCache = function() {
- this._updateCache.length = 0, this.updateCacheReset.length = 0;
- for (var t = this.bones, e = 0, i = t.length; e < i; e++) t[e].sorted = !1;
- var n = this.ikConstraints,
- r = this.transformConstraints,
- s = this.pathConstraints,
- o = n.length,
- a = r.length,
- l = s.length,
- h = o + a + l;
- t: for (e = 0; e < h; e++) {
- for (var c = 0; c < o; c++) {
- if ((u = n[c]).data.order == e) {
- this.sortIkConstraint(u);
- continue t
- }
- }
- for (c = 0; c < a; c++) {
- if ((u = r[c]).data.order == e) {
- this.sortTransformConstraint(u);
- continue t
- }
- }
- for (c = 0; c < l; c++) {
- var u;
- if ((u = s[c]).data.order == e) {
- this.sortPathConstraint(u);
- continue t
- }
- }
- }
- for (e = 0, i = t.length; e < i; e++) this.sortBone(t[e])
- }, e.prototype.sortIkConstraint = function(t) {
- var e = t.target;
- this.sortBone(e);
- var i = t.bones,
- n = i[0];
- if (this.sortBone(n), i.length > 1) {
- var r = i[i.length - 1];
- this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r)
- }
- this._updateCache.push(t), this.sortReset(n.children), i[i.length - 1].sorted = !0
- }, e.prototype.sortPathConstraint = function(e) {
- var i = e.target,
- n = i.data.index,
- r = i.bone;
- null != this.skin && this.sortPathConstraintAttachment(this.skin, n, r), null != this.data.defaultSkin && this.data.defaultSkin != this.skin && this.sortPathConstraintAttachment(this.data.defaultSkin, n, r);
- for (var s = 0, o = this.data.skins.length; s < o; s++) this.sortPathConstraintAttachment(this.data.skins[s], n, r);
- var a = i.getAttachment();
- a instanceof t.PathAttachment && this.sortPathConstraintAttachmentWith(a, r);
- var l = e.bones,
- h = l.length;
- for (s = 0; s < h; s++) this.sortBone(l[s]);
- this._updateCache.push(e);
- for (s = 0; s < h; s++) this.sortReset(l[s].children);
- for (s = 0; s < h; s++) l[s].sorted = !0
- }, e.prototype.sortTransformConstraint = function(t) {
- this.sortBone(t.target);
- var e = t.bones,
- i = e.length;
- if (t.data.local)
- for (var n = 0; n < i; n++) {
- var r = e[n];
- this.sortBone(r.parent), this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r)
- } else
- for (n = 0; n < i; n++) this.sortBone(e[n]);
- this._updateCache.push(t);
- for (var s = 0; s < i; s++) this.sortReset(e[s].children);
- for (s = 0; s < i; s++) e[s].sorted = !0
- }, e.prototype.sortPathConstraintAttachment = function(t, e, i) {
- var n = t.attachments[e];
- if (n)
- for (var r in n) this.sortPathConstraintAttachmentWith(n[r], i)
- }, e.prototype.sortPathConstraintAttachmentWith = function(e, i) {
- if (e instanceof t.PathAttachment) {
- var n = e.bones;
- if (null == n) this.sortBone(i);
- else
- for (var r = this.bones, s = 0; s < n.length;)
- for (var o = n[s++], a = s + o; s < a; s++) {
- var l = n[s];
- this.sortBone(r[l])
- }
- }
- }, e.prototype.sortBone = function(t) {
- if (!t.sorted) {
- var e = t.parent;
- null != e && this.sortBone(e), t.sorted = !0, this._updateCache.push(t)
- }
- }, e.prototype.sortReset = function(t) {
- for (var e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n.sorted && this.sortReset(n.children), n.sorted = !1
- }
- }, e.prototype.updateWorldTransform = function() {
- for (var t = this.updateCacheReset, e = 0, i = t.length; e < i; e++) {
- var n = t[e];
- n.ax = n.x, n.ay = n.y, n.arotation = n.rotation, n.ascaleX = n.scaleX, n.ascaleY = n.scaleY, n.ashearX = n.shearX, n.ashearY = n.shearY, n.appliedValid = !0
- }
- var r = this._updateCache;
- for (e = 0, i = r.length; e < i; e++) r[e].update()
- }, e.prototype.setToSetupPose = function() {
- this.setBonesToSetupPose(), this.setSlotsToSetupPose()
- }, e.prototype.setBonesToSetupPose = function() {
- for (var t = this.bones, e = 0, i = t.length; e < i; e++) t[e].setToSetupPose();
- var n = this.ikConstraints;
- for (e = 0, i = n.length; e < i; e++) {
- (a = n[e]).bendDirection = a.data.bendDirection, a.mix = a.data.mix
- }
- var r = this.transformConstraints;
- for (e = 0, i = r.length; e < i; e++) {
- var s = (a = r[e]).data;
- a.rotateMix = s.rotateMix, a.translateMix = s.translateMix, a.scaleMix = s.scaleMix, a.shearMix = s.shearMix
- }
- var o = this.pathConstraints;
- for (e = 0, i = o.length; e < i; e++) {
- var a;
- s = (a = o[e]).data;
- a.position = s.position, a.spacing = s.spacing, a.rotateMix = s.rotateMix, a.translateMix = s.translateMix
- }
- }, e.prototype.setSlotsToSetupPose = function() {
- var e = this.slots;
- t.Utils.arrayCopy(e, 0, this.drawOrder, 0, e.length);
- for (var i = 0, n = e.length; i < n; i++) e[i].setToSetupPose()
- }, e.prototype.getRootBone = function() {
- return 0 == this.bones.length ? null : this.bones[0]
- }, e.prototype.findBone = function(t) {
- if (null == t) throw new Error("boneName cannot be null.");
- for (var e = this.bones, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.data.name == t) return r
- }
- return null
- }, e.prototype.findBoneIndex = function(t) {
- if (null == t) throw new Error("boneName cannot be null.");
- for (var e = this.bones, i = 0, n = e.length; i < n; i++)
- if (e[i].data.name == t) return i;
- return -1
- }, e.prototype.findSlot = function(t) {
- if (null == t) throw new Error("slotName cannot be null.");
- for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.data.name == t) return r
- }
- return null
- }, e.prototype.findSlotIndex = function(t) {
- if (null == t) throw new Error("slotName cannot be null.");
- for (var e = this.slots, i = 0, n = e.length; i < n; i++)
- if (e[i].data.name == t) return i;
- return -1
- }, e.prototype.setSkinByName = function(t) {
- var e = this.data.findSkin(t);
- if (null == e) throw new Error("Skin not found: " + t);
- this.setSkin(e)
- }, e.prototype.setSkin = function(t) {
- if (null != t)
- if (null != this.skin) t.attachAll(this, this.skin);
- else
- for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
- var r = e[i],
- s = r.data.attachmentName;
- if (null != s) {
- var o = t.getAttachment(i, s);
- null != o && r.setAttachment(o)
- }
- }
- this.skin = t
- }, e.prototype.getAttachmentByName = function(t, e) {
- return this.getAttachment(this.data.findSlotIndex(t), e)
- }, e.prototype.getAttachment = function(t, e) {
- if (null == e) throw new Error("attachmentName cannot be null.");
- if (null != this.skin) {
- var i = this.skin.getAttachment(t, e);
- if (null != i) return i
- }
- return null != this.data.defaultSkin ? this.data.defaultSkin.getAttachment(t, e) : null
- }, e.prototype.setAttachment = function(t, e) {
- if (null == t) throw new Error("slotName cannot be null.");
- for (var i = this.slots, n = 0, r = i.length; n < r; n++) {
- var s = i[n];
- if (s.data.name == t) {
- var o = null;
- if (null != e && null == (o = this.getAttachment(n, e))) throw new Error("Attachment not found: " + e + ", for slot: " + t);
- return void s.setAttachment(o)
- }
- }
- throw new Error("Slot not found: " + t)
- }, e.prototype.findIkConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.data.name == t) return r
- }
- return null
- }, e.prototype.findTransformConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.data.name == t) return r
- }
- return null
- }, e.prototype.findPathConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.data.name == t) return r
- }
- return null
- }, e.prototype.getBounds = function(e, i, n) {
- if (null == e) throw new Error("offset cannot be null.");
- if (null == i) throw new Error("size cannot be null.");
- for (var r = this.drawOrder, s = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY, a = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, h = 0, c = r.length; h < c; h++) {
- var u = r[h],
- _ = 0,
- f = null,
- d = u.getAttachment();
- if (d instanceof t.RegionAttachment) _ = 8, f = t.Utils.setArraySize(n, _, 0), d.computeWorldVertices(u.bone, f, 0, 2);
- else if (d instanceof t.MeshAttachment) {
- var p = d;
- _ = p.worldVerticesLength, f = t.Utils.setArraySize(n, _, 0), p.computeWorldVertices(u, 0, _, f, 0, 2)
- }
- if (null != f)
- for (var m = 0, y = f.length; m < y; m += 2) {
- var v = f[m],
- g = f[m + 1];
- s = Math.min(s, v), o = Math.min(o, g), a = Math.max(a, v), l = Math.max(l, g)
- }
- }
- e.set(s, o), i.set(a - s, l - o)
- }, e.prototype.update = function(t) {
- this.time += t
- }, e
- })();
- t.Skeleton = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e() {
- this.minX = 0, this.minY = 0, this.maxX = 0, this.maxY = 0, this.boundingBoxes = new Array, this.polygons = new Array, this.polygonPool = new t.Pool(function() {
- return t.Utils.newFloatArray(16)
- })
- }
- return e.prototype.update = function(e, i) {
- if (null == e) throw new Error("skeleton cannot be null.");
- var n = this.boundingBoxes,
- r = this.polygons,
- s = this.polygonPool,
- o = e.slots,
- a = o.length;
- n.length = 0, s.freeAll(r), r.length = 0;
- for (var l = 0; l < a; l++) {
- var h = o[l],
- c = h.getAttachment();
- if (c instanceof t.BoundingBoxAttachment) {
- var u = c;
- n.push(u);
- var _ = s.obtain();
- _.length != u.worldVerticesLength && (_ = t.Utils.newFloatArray(u.worldVerticesLength)), r.push(_), u.computeWorldVertices(h, 0, u.worldVerticesLength, _, 0, 2)
- }
- }
- i ? this.aabbCompute() : (this.minX = Number.POSITIVE_INFINITY, this.minY = Number.POSITIVE_INFINITY, this.maxX = Number.NEGATIVE_INFINITY, this.maxY = Number.NEGATIVE_INFINITY)
- }, e.prototype.aabbCompute = function() {
- for (var t = Number.POSITIVE_INFINITY, e = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY, n = Number.NEGATIVE_INFINITY, r = this.polygons, s = 0, o = r.length; s < o; s++)
- for (var a = r[s], l = a, h = 0, c = a.length; h < c; h += 2) {
- var u = l[h],
- _ = l[h + 1];
- t = Math.min(t, u), e = Math.min(e, _), i = Math.max(i, u), n = Math.max(n, _)
- }
- this.minX = t, this.minY = e, this.maxX = i, this.maxY = n
- }, e.prototype.aabbContainsPoint = function(t, e) {
- return t >= this.minX && t <= this.maxX && e >= this.minY && e <= this.maxY
- }, e.prototype.aabbIntersectsSegment = function(t, e, i, n) {
- var r = this.minX,
- s = this.minY,
- o = this.maxX,
- a = this.maxY;
- if (t <= r && i <= r || e <= s && n <= s || t >= o && i >= o || e >= a && n >= a) return !1;
- var l = (n - e) / (i - t),
- h = l * (r - t) + e;
- if (h > s && h < a) return !0;
- if ((h = l * (o - t) + e) > s && h < a) return !0;
- var c = (s - e) / l + t;
- return c > r && c < o || (c = (a - e) / l + t) > r && c < o
- }, e.prototype.aabbIntersectsSkeleton = function(t) {
- return this.minX < t.maxX && this.maxX > t.minX && this.minY < t.maxY && this.maxY > t.minY
- }, e.prototype.containsPoint = function(t, e) {
- for (var i = this.polygons, n = 0, r = i.length; n < r; n++)
- if (this.containsPointPolygon(i[n], t, e)) return this.boundingBoxes[n];
- return null
- }, e.prototype.containsPointPolygon = function(t, e, i) {
- for (var n = t, r = t.length, s = r - 2, o = !1, a = 0; a < r; a += 2) {
- var l = n[a + 1],
- h = n[s + 1];
- if (l < i && h >= i || h < i && l >= i) {
- var c = n[a];
- c + (i - l) / (h - l) * (n[s] - c) < e && (o = !o)
- }
- s = a
- }
- return o
- }, e.prototype.intersectsSegment = function(t, e, i, n) {
- for (var r = this.polygons, s = 0, o = r.length; s < o; s++)
- if (this.intersectsSegmentPolygon(r[s], t, e, i, n)) return this.boundingBoxes[s];
- return null
- }, e.prototype.intersectsSegmentPolygon = function(t, e, i, n, r) {
- for (var s = t, o = t.length, a = e - n, l = i - r, h = e * r - i * n, c = s[o - 2], u = s[o - 1], _ = 0; _ < o; _ += 2) {
- var f = s[_],
- d = s[_ + 1],
- p = c * d - u * f,
- m = c - f,
- y = u - d,
- v = a * y - l * m,
- g = (h * m - a * p) / v;
- if ((g >= c && g <= f || g >= f && g <= c) && (g >= e && g <= n || g >= n && g <= e)) {
- var x = (h * y - l * p) / v;
- if ((x >= u && x <= d || x >= d && x <= u) && (x >= i && x <= r || x >= r && x <= i)) return !0
- }
- c = f, u = d
- }
- return !1
- }, e.prototype.getPolygon = function(t) {
- if (null == t) throw new Error("boundingBox cannot be null.");
- var e = this.boundingBoxes.indexOf(t);
- return -1 == e ? null : this.polygons[e]
- }, e.prototype.getWidth = function() {
- return this.maxX - this.minX
- }, e.prototype.getHeight = function() {
- return this.maxY - this.minY
- }, e
- })();
- t.SkeletonBounds = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e() {
- this.triangulator = new t.Triangulator, this.clippingPolygon = new Array, this.clipOutput = new Array, this.clippedVertices = new Array, this.clippedTriangles = new Array, this.scratch = new Array
- }
- return e.prototype.clipStart = function(i, n) {
- if (null != this.clipAttachment) return 0;
- this.clipAttachment = n;
- var r = n.worldVerticesLength,
- s = t.Utils.setArraySize(this.clippingPolygon, r);
- n.computeWorldVertices(i, 0, r, s, 0, 2);
- var o = this.clippingPolygon;
- e.makeClockwise(o);
- for (var a = this.clippingPolygons = this.triangulator.decompose(o, this.triangulator.triangulate(o)), l = 0, h = a.length; l < h; l++) {
- var c = a[l];
- e.makeClockwise(c), c.push(c[0]), c.push(c[1])
- }
- return a.length
- }, e.prototype.clipEndWithSlot = function(t) {
- null != this.clipAttachment && this.clipAttachment.endSlot == t.data && this.clipEnd()
- }, e.prototype.clipEnd = function() {
- null != this.clipAttachment && (this.clipAttachment = null, this.clippingPolygons = null, this.clippedVertices.length = 0, this.clippedTriangles.length = 0, this.clippingPolygon.length = 0)
- }, e.prototype.isClipping = function() {
- return null != this.clipAttachment
- }, e.prototype.clipTriangles = function(e, i, n, r, s, o, a, l, h, c, u, _) {
- var f = this.clipOutput,
- d = this.clippedVertices,
- p = this.clippedTriangles,
- m = this.clippingPolygons,
- y = this.clippingPolygons.length,
- v = l ? 12 : 8,
- g = 0;
- c = c || 0, u = u || 0, _ = _ || 0, d.length = 0, p.length = 0;
- t: for (var x = c, b = c + r; x < b; x += 3) {
- var A = n[x] * h,
- C = A + u,
- T = A + _,
- S = e[C],
- w = e[C + 1],
- E = s[T],
- M = s[T + 1];
- T = (A = n[x + 1] * h) + _;
- var D = e[C = A + u],
- B = e[C + 1],
- I = s[T],
- P = s[T + 1];
- T = (A = n[x + 2] * h) + _;
- for (var R = e[C = A + u], O = e[C + 1], L = s[T], F = s[T + 1], N = 0; N < y; N++) {
- var V = d.length;
- if (!this.clip(S, w, D, B, R, O, m[N], f)) {
- (Y = t.Utils.setArraySize(d, V + 3 * v))[V] = S, Y[V + 1] = w, Y[V + 2] = o.r, Y[V + 3] = o.g, Y[V + 4] = o.b, Y[V + 5] = o.a, l ? (Y[V + 6] = E, Y[V + 7] = M, Y[V + 8] = a.r, Y[V + 9] = a.g, Y[V + 10] = a.b, Y[V + 11] = a.a, Y[V + 12] = D, Y[V + 13] = B, Y[V + 14] = o.r, Y[V + 15] = o.g, Y[V + 16] = o.b, Y[V + 17] = o.a, Y[V + 18] = I, Y[V + 19] = P, Y[V + 20] = a.r, Y[V + 21] = a.g, Y[V + 22] = a.b, Y[V + 23] = a.a, Y[V + 24] = R, Y[V + 25] = O, Y[V + 26] = o.r, Y[V + 27] = o.g, Y[V + 28] = o.b, Y[V + 29] = o.a, Y[V + 30] = L, Y[V + 31] = F, Y[V + 32] = a.r, Y[V + 33] = a.g, Y[V + 34] = a.b, Y[V + 35] = a.a) : (Y[V + 6] = E, Y[V + 7] = M, Y[V + 8] = D, Y[V + 9] = B, Y[V + 10] = o.r, Y[V + 11] = o.g, Y[V + 12] = o.b, Y[V + 13] = o.a, Y[V + 14] = I, Y[V + 15] = P, Y[V + 16] = R, Y[V + 17] = O, Y[V + 18] = o.r, Y[V + 19] = o.g, Y[V + 20] = o.b, Y[V + 21] = o.a, Y[V + 22] = L, Y[V + 23] = F), V = p.length, (it = t.Utils.setArraySize(p, V + 3))[V] = g, it[V + 1] = g + 1, it[V + 2] = g + 2, g += 3;
- continue t
- }
- var k = f.length;
- if (0 != k) {
- for (var G = B - O, U = R - D, z = S - R, j = O - w, W = 1 / (G * z + U * (w - O)), H = k >> 1, X = this.clipOutput, Y = t.Utils.setArraySize(d, V + H * v), q = 0; q < k; q += 2) {
- var J = X[q],
- Z = X[q + 1];
- Y[V] = J, Y[V + 1] = Z, Y[V + 2] = o.r, Y[V + 3] = o.g, Y[V + 4] = o.b, Y[V + 5] = o.a;
- var K = J - R,
- Q = Z - O,
- $ = (G * K + U * Q) * W,
- tt = (j * K + z * Q) * W,
- et = 1 - $ - tt;
- Y[V + 6] = E * $ + I * tt + L * et, Y[V + 7] = M * $ + P * tt + F * et, l && (Y[V + 8] = a.r, Y[V + 9] = a.g, Y[V + 10] = a.b, Y[V + 11] = a.a), V += v
- }
- V = p.length;
- var it = t.Utils.setArraySize(p, V + 3 * (H - 2));
- H--;
- for (q = 1; q < H; q++) it[V] = g, it[V + 1] = g + q, it[V + 2] = g + q + 1, V += 3;
- g += H + 1
- }
- }
- }
- }, e.prototype.clip = function(t, e, i, n, r, s, o, a) {
- var l = a,
- h = !1,
- c = null;
- o.length % 4 >= 2 ? (c = a, a = this.scratch) : c = this.scratch, c.length = 0, c.push(t), c.push(e), c.push(i), c.push(n), c.push(r), c.push(s), c.push(t), c.push(e), a.length = 0;
- for (var u = o, _ = o.length - 4, f = 0;; f += 2) {
- for (var d = u[f], p = u[f + 1], m = u[f + 2], y = u[f + 3], v = d - m, g = p - y, x = c, b = c.length - 2, A = a.length, C = 0; C < b; C += 2) {
- var T = x[C],
- S = x[C + 1],
- w = x[C + 2],
- E = x[C + 3],
- M = v * (E - y) - g * (w - m) > 0;
- if (v * (S - y) - g * (T - m) > 0) {
- if (M) {
- a.push(w), a.push(E);
- continue
- }
- var D = ((I = w - T) * (p - S) - (B = E - S) * (d - T)) / (B * (m - d) - I * (y - p));
- a.push(d + (m - d) * D), a.push(p + (y - p) * D)
- } else if (M) {
- var B, I;
- D = ((I = w - T) * (p - S) - (B = E - S) * (d - T)) / (B * (m - d) - I * (y - p));
- a.push(d + (m - d) * D), a.push(p + (y - p) * D), a.push(w), a.push(E)
- }
- h = !0
- }
- if (A == a.length) return l.length = 0, !0;
- if (a.push(a[0]), a.push(a[1]), f == _) break;
- var P = a;
- (a = c).length = 0, c = P
- }
- if (l != a) {
- l.length = 0;
- f = 0;
- for (var R = a.length - 2; f < R; f++) l[f] = a[f]
- } else l.length = l.length - 2;
- return h
- }, e.makeClockwise = function(t) {
- for (var e = t, i = t.length, n = e[i - 2] * e[1] - e[0] * e[i - 1], r = 0, s = 0, o = 0, a = 0, l = i - 3; a < l; a += 2) r = e[a], s = e[a + 1], o = e[a + 2], n += r * e[a + 3] - o * s;
- if (!(n < 0)) {
- a = 0;
- var h = i - 2;
- for (l = i >> 1; a < l; a += 2) {
- var c = e[a],
- u = e[a + 1],
- _ = h - a;
- e[a] = e[_], e[a + 1] = e[_ + 1], e[_] = c, e[_ + 1] = u
- }
- }
- }, e
- })();
- t.SkeletonClipping = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function t() {
- this.bones = new Array, this.slots = new Array, this.skins = new Array, this.events = new Array, this.animations = new Array, this.ikConstraints = new Array, this.transformConstraints = new Array, this.pathConstraints = new Array, this.fps = 0
- }
- return t.prototype.findBone = function(t) {
- if (null == t) throw new Error("boneName cannot be null.");
- for (var e = this.bones, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findBoneIndex = function(t) {
- if (null == t) throw new Error("boneName cannot be null.");
- for (var e = this.bones, i = 0, n = e.length; i < n; i++)
- if (e[i].name == t) return i;
- return -1
- }, t.prototype.findSlot = function(t) {
- if (null == t) throw new Error("slotName cannot be null.");
- for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findSlotIndex = function(t) {
- if (null == t) throw new Error("slotName cannot be null.");
- for (var e = this.slots, i = 0, n = e.length; i < n; i++)
- if (e[i].name == t) return i;
- return -1
- }, t.prototype.findSkin = function(t) {
- if (null == t) throw new Error("skinName cannot be null.");
- for (var e = this.skins, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findEvent = function(t) {
- if (null == t) throw new Error("eventDataName cannot be null.");
- for (var e = this.events, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findAnimation = function(t) {
- if (null == t) throw new Error("animationName cannot be null.");
- for (var e = this.animations, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findIkConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findTransformConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findPathConstraint = function(t) {
- if (null == t) throw new Error("constraintName cannot be null.");
- for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) {
- var r = e[i];
- if (r.name == t) return r
- }
- return null
- }, t.prototype.findPathConstraintIndex = function(t) {
- if (null == t) throw new Error("pathConstraintName cannot be null.");
- for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++)
- if (e[i].name == t) return i;
- return -1
- }, t
- })();
- t.SkeletonData = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t) {
- this.scale = 1, this.linkedMeshes = new Array, this.attachmentLoader = t
- }
- return e.prototype.readSkeletonData = function(i) {
- var n = this.scale,
- r = new t.SkeletonData,
- s = "string" == typeof i ? JSON.parse(i) : i,
- o = s.skeleton;
- if (null != o && (r.hash = o.hash, r.version = o.spine, r.width = o.width, r.height = o.height, r.fps = o.fps, r.imagesPath = o.images), s.bones)
- for (var a = 0; a < s.bones.length; a++) {
- var l = s.bones[a],
- h = null,
- c = this.getValue(l, "parent", null);
- if (null != c && null == (h = r.findBone(c))) throw new Error("Parent bone not found: " + c);
- (d = new t.BoneData(r.bones.length, l.name, h)).length = this.getValue(l, "length", 0) * n, d.x = this.getValue(l, "x", 0) * n, d.y = this.getValue(l, "y", 0) * n, d.rotation = this.getValue(l, "rotation", 0), d.scaleX = this.getValue(l, "scaleX", 1), d.scaleY = this.getValue(l, "scaleY", 1), d.shearX = this.getValue(l, "shearX", 0), d.shearY = this.getValue(l, "shearY", 0), d.transformMode = e.transformModeFromString(this.getValue(l, "transform", "normal")), r.bones.push(d)
- }
- if (s.slots)
- for (a = 0; a < s.slots.length; a++) {
- var u = (S = s.slots[a]).name,
- _ = S.bone,
- f = r.findBone(_);
- if (null == f) throw new Error("Slot bone not found: " + _);
- var d = new t.SlotData(r.slots.length, u, f),
- p = this.getValue(S, "color", null);
- null != p && d.color.setFromString(p);
- var m = this.getValue(S, "dark", null);
- null != m && (d.darkColor = new t.Color(1, 1, 1, 1), d.darkColor.setFromString(m)), d.attachmentName = this.getValue(S, "attachment", null), d.blendMode = e.blendModeFromString(this.getValue(S, "blend", "normal")), r.slots.push(d)
- }
- if (s.ik)
- for (a = 0; a < s.ik.length; a++) {
- var y = s.ik[a];
- (d = new t.IkConstraintData(y.name)).order = this.getValue(y, "order", 0);
- for (var v = 0; v < y.bones.length; v++) {
- _ = y.bones[v];
- if (null == (x = r.findBone(_))) throw new Error("IK bone not found: " + _);
- d.bones.push(x)
- }
- var g = y.target;
- if (d.target = r.findBone(g), null == d.target) throw new Error("IK target bone not found: " + g);
- d.bendDirection = this.getValue(y, "bendPositive", !0) ? 1 : -1, d.mix = this.getValue(y, "mix", 1), r.ikConstraints.push(d)
- }
- if (s.transform)
- for (a = 0; a < s.transform.length; a++) {
- y = s.transform[a];
- (d = new t.TransformConstraintData(y.name)).order = this.getValue(y, "order", 0);
- for (v = 0; v < y.bones.length; v++) {
- _ = y.bones[v];
- if (null == (x = r.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
- d.bones.push(x)
- }
- g = y.target;
- if (d.target = r.findBone(g), null == d.target) throw new Error("Transform constraint target bone not found: " + g);
- d.local = this.getValue(y, "local", !1), d.relative = this.getValue(y, "relative", !1), d.offsetRotation = this.getValue(y, "rotation", 0), d.offsetX = this.getValue(y, "x", 0) * n, d.offsetY = this.getValue(y, "y", 0) * n, d.offsetScaleX = this.getValue(y, "scaleX", 0), d.offsetScaleY = this.getValue(y, "scaleY", 0), d.offsetShearY = this.getValue(y, "shearY", 0), d.rotateMix = this.getValue(y, "rotateMix", 1), d.translateMix = this.getValue(y, "translateMix", 1), d.scaleMix = this.getValue(y, "scaleMix", 1), d.shearMix = this.getValue(y, "shearMix", 1), r.transformConstraints.push(d)
- }
- if (s.path)
- for (a = 0; a < s.path.length; a++) {
- y = s.path[a];
- (d = new t.PathConstraintData(y.name)).order = this.getValue(y, "order", 0);
- for (v = 0; v < y.bones.length; v++) {
- var x;
- _ = y.bones[v];
- if (null == (x = r.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
- d.bones.push(x)
- }
- g = y.target;
- if (d.target = r.findSlot(g), null == d.target) throw new Error("Path target slot not found: " + g);
- d.positionMode = e.positionModeFromString(this.getValue(y, "positionMode", "percent")), d.spacingMode = e.spacingModeFromString(this.getValue(y, "spacingMode", "length")), d.rotateMode = e.rotateModeFromString(this.getValue(y, "rotateMode", "tangent")), d.offsetRotation = this.getValue(y, "rotation", 0), d.position = this.getValue(y, "position", 0), d.positionMode == t.PositionMode.Fixed && (d.position *= n), d.spacing = this.getValue(y, "spacing", 0), d.spacingMode != t.SpacingMode.Length && d.spacingMode != t.SpacingMode.Fixed || (d.spacing *= n), d.rotateMix = this.getValue(y, "rotateMix", 1), d.translateMix = this.getValue(y, "translateMix", 1), r.pathConstraints.push(d)
- }
- if (s.skins)
- for (var b in s.skins) {
- var A = s.skins[b],
- C = new t.Skin(b);
- for (var u in A) {
- var T = r.findSlotIndex(u);
- if (-1 == T) throw new Error("Slot not found: " + u);
- var S = A[u];
- for (var w in S) {
- var E = this.readAttachment(S[w], C, T, w, r);
- null != E && C.addAttachment(T, w, E)
- }
- }
- r.skins.push(C), "default" == C.name && (r.defaultSkin = C)
- }
- a = 0;
- for (var M = this.linkedMeshes.length; a < M; a++) {
- var D = this.linkedMeshes[a];
- if (null == (C = null == D.skin ? r.defaultSkin : r.findSkin(D.skin))) throw new Error("Skin not found: " + D.skin);
- var B = C.getAttachment(D.slotIndex, D.parent);
- if (null == B) throw new Error("Parent mesh not found: " + D.parent);
- D.mesh.setParentMesh(B), D.mesh.updateUVs()
- }
- if (this.linkedMeshes.length = 0, s.events)
- for (var I in s.events) {
- var P = s.events[I];
- (d = new t.EventData(I)).intValue = this.getValue(P, "int", 0), d.floatValue = this.getValue(P, "float", 0), d.stringValue = this.getValue(P, "string", ""), r.events.push(d)
- }
- if (s.animations)
- for (var R in s.animations) {
- var O = s.animations[R];
- this.readAnimation(O, R, r)
- }
- return r
- }, e.prototype.readAttachment = function(e, n, r, s, o) {
- var a = this.scale;
- switch (s = this.getValue(e, "name", s), this.getValue(e, "type", "region")) {
- case "region":
- var l = this.getValue(e, "path", s),
- h = this.attachmentLoader.newRegionAttachment(n, s, l);
- return null == h ? null : (h.path = l, h.x = this.getValue(e, "x", 0) * a, h.y = this.getValue(e, "y", 0) * a, h.scaleX = this.getValue(e, "scaleX", 1), h.scaleY = this.getValue(e, "scaleY", 1), h.rotation = this.getValue(e, "rotation", 0), h.width = e.width * a, h.height = e.height * a, null != (b = this.getValue(e, "color", null)) && h.color.setFromString(b), h.updateOffset(), h);
- case "boundingbox":
- var c = this.attachmentLoader.newBoundingBoxAttachment(n, s);
- return null == c ? null : (this.readVertices(e, c, e.vertexCount << 1), null != (b = this.getValue(e, "color", null)) && c.color.setFromString(b), c);
- case "mesh":
- case "linkedmesh":
- l = this.getValue(e, "path", s);
- var u = this.attachmentLoader.newMeshAttachment(n, s, l);
- if (null == u) return null;
- u.path = l, null != (b = this.getValue(e, "color", null)) && u.color.setFromString(b);
- var _ = this.getValue(e, "parent", null);
- if (null != _) return u.inheritDeform = this.getValue(e, "deform", !0), this.linkedMeshes.push(new i(u, this.getValue(e, "skin", null), r, _)), u;
- var f = e.uvs;
- return this.readVertices(e, u, f.length), u.triangles = e.triangles, u.regionUVs = f, u.updateUVs(), u.hullLength = 2 * this.getValue(e, "hull", 0), u;
- case "path":
- if (null == (l = this.attachmentLoader.newPathAttachment(n, s))) return null;
- l.closed = this.getValue(e, "closed", !1), l.constantSpeed = this.getValue(e, "constantSpeed", !0);
- var d = e.vertexCount;
- this.readVertices(e, l, d << 1);
- for (var p = t.Utils.newArray(d / 3, 0), m = 0; m < e.lengths.length; m++) p[m] = e.lengths[m] * a;
- return l.lengths = p, null != (b = this.getValue(e, "color", null)) && l.color.setFromString(b), l;
- case "point":
- var y = this.attachmentLoader.newPointAttachment(n, s);
- return null == y ? null : (y.x = this.getValue(e, "x", 0) * a, y.y = this.getValue(e, "y", 0) * a, y.rotation = this.getValue(e, "rotation", 0), null != (b = this.getValue(e, "color", null)) && y.color.setFromString(b), y);
- case "clipping":
- var v = this.attachmentLoader.newClippingAttachment(n, s);
- if (null == v) return null;
- var g = this.getValue(e, "end", null);
- if (null != g) {
- var x = o.findSlot(g);
- if (null == x) throw new Error("Clipping end slot not found: " + g);
- v.endSlot = x
- }
- var b;
- d = e.vertexCount;
- return this.readVertices(e, v, d << 1), null != (b = this.getValue(e, "color", null)) && v.color.setFromString(b), v
- }
- return null
- }, e.prototype.readVertices = function(e, i, n) {
- var r = this.scale;
- i.worldVerticesLength = n;
- var s = e.vertices;
- if (n != s.length) {
- var o = new Array,
- a = new Array;
- for (u = 0, _ = s.length; u < _;) {
- var l = s[u++];
- a.push(l);
- for (var h = u + 4 * l; u < h; u += 4) a.push(s[u]), o.push(s[u + 1] * r), o.push(s[u + 2] * r), o.push(s[u + 3])
- }
- i.bones = a, i.vertices = t.Utils.toFloatArray(o)
- } else {
- var c = t.Utils.toFloatArray(s);
- if (1 != r)
- for (var u = 0, _ = s.length; u < _; u++) c[u] *= r;
- i.vertices = c
- }
- }, e.prototype.readAnimation = function(e, i, n) {
- var r = this.scale,
- s = new Array,
- o = 0;
- if (e.slots)
- for (var a in e.slots) {
- var l = e.slots[a];
- if (-1 == (J = n.findSlotIndex(a))) throw new Error("Slot not found: " + a);
- for (var h in l) {
- var c = l[h];
- if ("attachment" == h) {
- (x = new t.AttachmentTimeline(c.length)).slotIndex = J;
- for (var u = 0, _ = 0; _ < c.length; _++) {
- var f = c[_];
- x.setFrame(u++, f.time, f.name)
- }
- s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
- } else if ("color" == h) {
- (x = new t.ColorTimeline(c.length)).slotIndex = J;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- var d = new t.Color;
- d.setFromString(f.color), x.setFrame(u, f.time, d.r, d.g, d.b, d.a), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.ColorTimeline.ENTRIES])
- } else {
- if ("twoColor" != h) throw new Error("Invalid timeline type for a slot: " + h + " (" + a + ")");
- (x = new t.TwoColorTimeline(c.length)).slotIndex = J;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- var p = new t.Color,
- m = new t.Color;
- p.setFromString(f.light), m.setFromString(f.dark), x.setFrame(u, f.time, p.r, p.g, p.b, p.a, m.r, m.g, m.b), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TwoColorTimeline.ENTRIES])
- }
- }
- }
- if (e.bones)
- for (var y in e.bones) {
- var v = e.bones[y],
- g = n.findBoneIndex(y);
- if (-1 == g) throw new Error("Bone not found: " + y);
- for (var h in v) {
- c = v[h];
- if ("rotate" === h) {
- (x = new t.RotateTimeline(c.length)).boneIndex = g;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- x.setFrame(u, f.time, f.angle), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.RotateTimeline.ENTRIES])
- } else {
- if ("translate" !== h && "scale" !== h && "shear" !== h) throw new Error("Invalid timeline type for a bone: " + h + " (" + y + ")");
- var x = null,
- b = 1;
- "scale" === h ? x = new t.ScaleTimeline(c.length) : "shear" === h ? x = new t.ShearTimeline(c.length) : (x = new t.TranslateTimeline(c.length), b = r), x.boneIndex = g;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- var A = this.getValue(f, "x", 0),
- C = this.getValue(f, "y", 0);
- x.setFrame(u, f.time, A * b, C * b), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TranslateTimeline.ENTRIES])
- }
- }
- }
- if (e.ik)
- for (var T in e.ik) {
- var S = e.ik[T],
- w = n.findIkConstraint(T);
- (x = new t.IkConstraintTimeline(S.length)).ikConstraintIndex = n.ikConstraints.indexOf(w);
- for (u = 0, _ = 0; _ < S.length; _++) {
- f = S[_];
- x.setFrame(u, f.time, this.getValue(f, "mix", 1), this.getValue(f, "bendPositive", !0) ? 1 : -1), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.IkConstraintTimeline.ENTRIES])
- }
- if (e.transform)
- for (var T in e.transform) {
- S = e.transform[T], w = n.findTransformConstraint(T);
- (x = new t.TransformConstraintTimeline(S.length)).transformConstraintIndex = n.transformConstraints.indexOf(w);
- for (u = 0, _ = 0; _ < S.length; _++) {
- f = S[_];
- x.setFrame(u, f.time, this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1), this.getValue(f, "scaleMix", 1), this.getValue(f, "shearMix", 1)), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TransformConstraintTimeline.ENTRIES])
- }
- if (e.paths)
- for (var T in e.paths) {
- S = e.paths[T];
- var E = n.findPathConstraintIndex(T);
- if (-1 == E) throw new Error("Path constraint not found: " + T);
- var M = n.pathConstraints[E];
- for (var h in S) {
- c = S[h];
- if ("position" === h || "spacing" === h) {
- x = null, b = 1;
- "spacing" === h ? (x = new t.PathConstraintSpacingTimeline(c.length), M.spacingMode != t.SpacingMode.Length && M.spacingMode != t.SpacingMode.Fixed || (b = r)) : (x = new t.PathConstraintPositionTimeline(c.length), M.positionMode == t.PositionMode.Fixed && (b = r)), x.pathConstraintIndex = E;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- x.setFrame(u, f.time, this.getValue(f, h, 0) * b), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.PathConstraintPositionTimeline.ENTRIES])
- } else if ("mix" === h) {
- (x = new t.PathConstraintMixTimeline(c.length)).pathConstraintIndex = E;
- for (u = 0, _ = 0; _ < c.length; _++) {
- f = c[_];
- x.setFrame(u, f.time, this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1)), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.PathConstraintMixTimeline.ENTRIES])
- }
- }
- }
- if (e.deform)
- for (var D in e.deform) {
- var B = e.deform[D],
- I = n.findSkin(D);
- if (null == I) throw new Error("Skin not found: " + D);
- for (var a in B) {
- l = B[a];
- if (-1 == (J = n.findSlotIndex(a))) throw new Error("Slot not found: " + l.name);
- for (var h in l) {
- c = l[h];
- var P = I.getAttachment(J, h);
- if (null == P) throw new Error("Deform attachment not found: " + c.name);
- var R = null != P.bones,
- O = P.vertices,
- L = R ? O.length / 3 * 2 : O.length;
- (x = new t.DeformTimeline(c.length)).slotIndex = J, x.attachment = P;
- u = 0;
- for (var F = 0; F < c.length; F++) {
- f = c[F];
- var N = void 0,
- V = this.getValue(f, "vertices", null);
- if (null == V) N = R ? t.Utils.newFloatArray(L) : O;
- else {
- N = t.Utils.newFloatArray(L);
- var k = this.getValue(f, "offset", 0);
- if (t.Utils.arrayCopy(V, 0, N, k, V.length), 1 != r)
- for (var G = (_ = k) + V.length; _ < G; _++) N[_] *= r;
- if (!R)
- for (_ = 0; _ < L; _++) N[_] += O[_]
- }
- x.setFrame(u, f.time, N), this.readCurve(f, x, u), u++
- }
- s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
- }
- }
- }
- var U = e.drawOrder;
- if (null == U && (U = e.draworder), null != U) {
- x = new t.DrawOrderTimeline(U.length);
- var z = n.slots.length;
- for (u = 0, F = 0; F < U.length; F++) {
- var j = U[F],
- W = null,
- H = this.getValue(j, "offsets", null);
- if (null != H) {
- W = t.Utils.newArray(z, -1);
- var X = t.Utils.newArray(z - H.length, 0),
- Y = 0,
- q = 0;
- for (_ = 0; _ < H.length; _++) {
- var J, Z = H[_];
- if (-1 == (J = n.findSlotIndex(Z.slot))) throw new Error("Slot not found: " + Z.slot);
- for (; Y != J;) X[q++] = Y++;
- W[Y + Z.offset] = Y++
- }
- for (; Y < z;) X[q++] = Y++;
- for (_ = z - 1; _ >= 0; _--) - 1 == W[_] && (W[_] = X[--q])
- }
- x.setFrame(u++, j.time, W)
- }
- s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
- }
- if (e.events) {
- for (x = new t.EventTimeline(e.events.length), u = 0, _ = 0; _ < e.events.length; _++) {
- var K = e.events[_],
- Q = n.findEvent(K.name);
- if (null == Q) throw new Error("Event not found: " + K.name);
- var $ = new t.Event(t.Utils.toSinglePrecision(K.time), Q);
- $.intValue = this.getValue(K, "int", Q.intValue), $.floatValue = this.getValue(K, "float", Q.floatValue), $.stringValue = this.getValue(K, "string", Q.stringValue), x.setFrame(u++, $)
- }
- s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
- }
- if (isNaN(o)) throw new Error("Error while parsing animation, duration is NaN");
- n.animations.push(new t.Animation(i, s, o))
- }, e.prototype.readCurve = function(t, e, i) {
- if (t.curve)
- if ("stepped" === t.curve) e.setStepped(i);
- else if ("[object Array]" === Object.prototype.toString.call(t.curve)) {
- var n = t.curve;
- e.setCurve(i, n[0], n[1], n[2], n[3])
- }
- }, e.prototype.getValue = function(t, e, i) {
- return void 0 !== t[e] ? t[e] : i
- }, e.blendModeFromString = function(e) {
- if ("normal" == (e = e.toLowerCase())) return t.BlendMode.Normal;
- if ("additive" == e) return t.BlendMode.Additive;
- if ("multiply" == e) return t.BlendMode.Multiply;
- if ("screen" == e) return t.BlendMode.Screen;
- throw new Error("Unknown blend mode: " + e)
- }, e.positionModeFromString = function(e) {
- if ("fixed" == (e = e.toLowerCase())) return t.PositionMode.Fixed;
- if ("percent" == e) return t.PositionMode.Percent;
- throw new Error("Unknown position mode: " + e)
- }, e.spacingModeFromString = function(e) {
- if ("length" == (e = e.toLowerCase())) return t.SpacingMode.Length;
- if ("fixed" == e) return t.SpacingMode.Fixed;
- if ("percent" == e) return t.SpacingMode.Percent;
- throw new Error("Unknown position mode: " + e)
- }, e.rotateModeFromString = function(e) {
- if ("tangent" == (e = e.toLowerCase())) return t.RotateMode.Tangent;
- if ("chain" == e) return t.RotateMode.Chain;
- if ("chainscale" == e) return t.RotateMode.ChainScale;
- throw new Error("Unknown rotate mode: " + e)
- }, e.transformModeFromString = function(e) {
- if ("normal" == (e = e.toLowerCase())) return t.TransformMode.Normal;
- if ("onlytranslation" == e) return t.TransformMode.OnlyTranslation;
- if ("norotationorreflection" == e) return t.TransformMode.NoRotationOrReflection;
- if ("noscale" == e) return t.TransformMode.NoScale;
- if ("noscaleorreflection" == e) return t.TransformMode.NoScaleOrReflection;
- throw new Error("Unknown transform mode: " + e)
- }, e
- })();
- t.SkeletonJson = e;
- var i = (function() {
- return function(t, e, i, n) {
- this.mesh = t, this.skin = e, this.slotIndex = i, this.parent = n
- }
- })()
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function t(t) {
- if (this.attachments = new Array, null == t) throw new Error("name cannot be null.");
- this.name = t
- }
- return t.prototype.addAttachment = function(t, e, i) {
- if (null == i) throw new Error("attachment cannot be null.");
- var n = this.attachments;
- t >= n.length && (n.length = t + 1), n[t] || (n[t] = {}), n[t][e] = i
- }, t.prototype.getAttachment = function(t, e) {
- var i = this.attachments[t];
- return i ? i[e] : null
- }, t.prototype.attachAll = function(t, e) {
- for (var i = 0, n = 0; n < t.slots.length; n++) {
- var r = t.slots[n],
- s = r.getAttachment();
- if (s && i < e.attachments.length) {
- var o = e.attachments[i];
- for (var a in o) {
- if (s == o[a]) {
- var l = this.getAttachment(i, a);
- null != l && r.setAttachment(l);
- break
- }
- }
- }
- i++
- }
- }, t
- })();
- t.Skin = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(e, i) {
- if (this.attachmentVertices = new Array, null == e) throw new Error("data cannot be null.");
- if (null == i) throw new Error("bone cannot be null.");
- this.data = e, this.bone = i, this.color = new t.Color, this.darkColor = null == e.darkColor ? null : new t.Color, this.setToSetupPose()
- }
- return e.prototype.getAttachment = function() {
- return this.attachment
- }, e.prototype.setAttachment = function(t) {
- this.attachment != t && (this.attachment = t, this.attachmentTime = this.bone.skeleton.time, this.attachmentVertices.length = 0)
- }, e.prototype.setAttachmentTime = function(t) {
- this.attachmentTime = this.bone.skeleton.time - t
- }, e.prototype.getAttachmentTime = function() {
- return this.bone.skeleton.time - this.attachmentTime
- }, e.prototype.setToSetupPose = function() {
- this.color.setFromColor(this.data.color), null != this.darkColor && this.darkColor.setFromColor(this.data.darkColor), null == this.data.attachmentName ? this.attachment = null : (this.attachment = null, this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName)))
- }, e
- })();
- t.Slot = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(e, i, n) {
- if (this.color = new t.Color(1, 1, 1, 1), e < 0) throw new Error("index must be >= 0.");
- if (null == i) throw new Error("name cannot be null.");
- if (null == n) throw new Error("boneData cannot be null.");
- this.index = e, this.name = i, this.boneData = n
- }
- })();
- t.SlotData = e
- })(n || (n = {})), (function(t) {
- var e, i, n = (function() {
- function t(t) {
- this._image = t
- }
- return t.prototype.getImage = function() {
- return this._image
- }, t.filterFromString = function(t) {
- switch (t.toLowerCase()) {
- case "nearest":
- return e.Nearest;
- case "linear":
- return e.Linear;
- case "mipmap":
- return e.MipMap;
- case "mipmapnearestnearest":
- return e.MipMapNearestNearest;
- case "mipmaplinearnearest":
- return e.MipMapLinearNearest;
- case "mipmapnearestlinear":
- return e.MipMapNearestLinear;
- case "mipmaplinearlinear":
- return e.MipMapLinearLinear;
- default:
- throw new Error("Unknown texture filter " + t)
- }
- }, t.wrapFromString = function(t) {
- switch (t.toLowerCase()) {
- case "mirroredtepeat":
- return i.MirroredRepeat;
- case "clamptoedge":
- return i.ClampToEdge;
- case "repeat":
- return i.Repeat;
- default:
- throw new Error("Unknown texture wrap " + t)
- }
- }, t
- })();
- t.Texture = n, (function(t) {
- t[t.Nearest = 9728] = "Nearest", t[t.Linear = 9729] = "Linear", t[t.MipMap = 9987] = "MipMap", t[t.MipMapNearestNearest = 9984] = "MipMapNearestNearest", t[t.MipMapLinearNearest = 9985] = "MipMapLinearNearest", t[t.MipMapNearestLinear = 9986] = "MipMapNearestLinear", t[t.MipMapLinearLinear = 9987] = "MipMapLinearLinear"
- })(e = t.TextureFilter || (t.TextureFilter = {})), (function(t) {
- t[t.MirroredRepeat = 33648] = "MirroredRepeat", t[t.ClampToEdge = 33071] = "ClampToEdge", t[t.Repeat = 10497] = "Repeat"
- })(i = t.TextureWrap || (t.TextureWrap = {}));
- var s = (function() {
- return function() {
- this.u = 0, this.v = 0, this.u2 = 0, this.v2 = 0, this.width = 0, this.height = 0, this.rotate = !1, this.offsetX = 0, this.offsetY = 0, this.originalWidth = 0, this.originalHeight = 0
- }
- })();
- t.TextureRegion = s;
- var o = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return r(e, t), e.prototype.setFilters = function(t, e) {}, e.prototype.setWraps = function(t, e) {}, e.prototype.dispose = function() {}, e
- })(t.Texture);
- t.FakeTexture = o
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- this.pages = new Array, this.regions = new Array, this.load(t, e)
- }
- return e.prototype.load = function(e, r) {
- if (null == r) throw new Error("textureLoader cannot be null.");
- for (var o = new i(e), a = new Array(4), l = null;;) {
- var h = o.readLine();
- if (null == h) break;
- if (0 == (h = h.trim()).length) l = null;
- else if (l) {
- var c = new s;
- c.name = h, c.page = l, c.rotate = "true" == o.readValue(), o.readTuple(a);
- var u = parseInt(a[0]),
- _ = parseInt(a[1]);
- o.readTuple(a);
- var f = parseInt(a[0]),
- d = parseInt(a[1]);
- c.u = u / l.width, c.v = _ / l.height, c.rotate ? (c.u2 = (u + d) / l.width, c.v2 = (_ + f) / l.height) : (c.u2 = (u + f) / l.width, c.v2 = (_ + d) / l.height), c.x = u, c.y = _, c.width = Math.abs(f), c.height = Math.abs(d), 4 == o.readTuple(a) && 4 == o.readTuple(a) && o.readTuple(a), c.originalWidth = parseInt(a[0]), c.originalHeight = parseInt(a[1]), o.readTuple(a), c.offsetX = parseInt(a[0]), c.offsetY = parseInt(a[1]), c.index = parseInt(o.readValue()), c.texture = l.texture, this.regions.push(c)
- } else {
- (l = new n).name = h, 2 == o.readTuple(a) && (l.width = parseInt(a[0]), l.height = parseInt(a[1]), o.readTuple(a)), o.readTuple(a), l.minFilter = t.Texture.filterFromString(a[0]), l.magFilter = t.Texture.filterFromString(a[1]);
- var p = o.readValue();
- l.uWrap = t.TextureWrap.ClampToEdge, l.vWrap = t.TextureWrap.ClampToEdge, "x" == p ? l.uWrap = t.TextureWrap.Repeat : "y" == p ? l.vWrap = t.TextureWrap.Repeat : "xy" == p && (l.uWrap = l.vWrap = t.TextureWrap.Repeat), l.texture = r(h), l.texture.setFilters(l.minFilter, l.magFilter), l.texture.setWraps(l.uWrap, l.vWrap), l.width = l.texture.getImage().width, l.height = l.texture.getImage().height, this.pages.push(l)
- }
- }
- }, e.prototype.findRegion = function(t) {
- for (var e = 0; e < this.regions.length; e++)
- if (this.regions[e].name == t) return this.regions[e];
- return null
- }, e.prototype.dispose = function() {
- for (var t = 0; t < this.pages.length; t++) this.pages[t].texture.dispose()
- }, e
- })();
- t.TextureAtlas = e;
- var i = (function() {
- function t(t) {
- this.index = 0, this.lines = t.split(/\r\n|\r|\n/)
- }
- return t.prototype.readLine = function() {
- return this.index >= this.lines.length ? null : this.lines[this.index++]
- }, t.prototype.readValue = function() {
- var t = this.readLine(),
- e = t.indexOf(":");
- if (-1 == e) throw new Error("Invalid line: " + t);
- return t.substring(e + 1).trim()
- }, t.prototype.readTuple = function(t) {
- var e = this.readLine(),
- i = e.indexOf(":");
- if (-1 == i) throw new Error("Invalid line: " + e);
- for (var n = 0, r = i + 1; n < 3; n++) {
- var s = e.indexOf(",", r);
- if (-1 == s) break;
- t[n] = e.substr(r, s - r).trim(), r = s + 1
- }
- return t[n] = e.substring(r).trim(), n + 1
- }, t
- })(),
- n = (function() {
- return function() {}
- })();
- t.TextureAtlasPage = n;
- var s = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return r(e, t), e
- })(t.TextureRegion);
- t.TextureAtlasRegion = s
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(e, i) {
- if (this.rotateMix = 0, this.translateMix = 0, this.scaleMix = 0, this.shearMix = 0, this.temp = new t.Vector2, null == e) throw new Error("data cannot be null.");
- if (null == i) throw new Error("skeleton cannot be null.");
- this.data = e, this.rotateMix = e.rotateMix, this.translateMix = e.translateMix, this.scaleMix = e.scaleMix, this.shearMix = e.shearMix, this.bones = new Array;
- for (var n = 0; n < e.bones.length; n++) this.bones.push(i.findBone(e.bones[n].name));
- this.target = i.findBone(e.target.name)
- }
- return e.prototype.apply = function() {
- this.update()
- }, e.prototype.update = function() {
- this.data.local ? this.data.relative ? this.applyRelativeLocal() : this.applyAbsoluteLocal() : this.data.relative ? this.applyRelativeWorld() : this.applyAbsoluteWorld()
- }, e.prototype.applyAbsoluteWorld = function() {
- for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, o = s.a, a = s.b, l = s.c, h = s.d, c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) {
- var m = f[d],
- y = !1;
- if (0 != e) {
- var v = m.a,
- g = m.b,
- x = m.c,
- b = m.d;
- (E = Math.atan2(l, o) - Math.atan2(x, v) + u) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), E *= e;
- var A = Math.cos(E),
- C = Math.sin(E);
- m.a = A * v - C * x, m.b = A * g - C * b, m.c = C * v + A * x, m.d = C * g + A * b, y = !0
- }
- if (0 != i) {
- var T = this.temp;
- s.localToWorld(T.set(this.data.offsetX, this.data.offsetY)), m.worldX += (T.x - m.worldX) * i, m.worldY += (T.y - m.worldY) * i, y = !0
- }
- if (n > 0) {
- var S = Math.sqrt(m.a * m.a + m.c * m.c),
- w = Math.sqrt(o * o + l * l);
- S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleX) * n) / S), m.a *= S, m.c *= S, S = Math.sqrt(m.b * m.b + m.d * m.d), w = Math.sqrt(a * a + h * h), S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleY) * n) / S), m.b *= S, m.d *= S, y = !0
- }
- if (r > 0) {
- g = m.b, b = m.d;
- var E, M = Math.atan2(b, g);
- (E = Math.atan2(h, a) - Math.atan2(l, o) - (M - Math.atan2(m.c, m.a))) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), E = M + (E + _) * r;
- S = Math.sqrt(g * g + b * b);
- m.b = Math.cos(E) * S, m.d = Math.sin(E) * S, y = !0
- }
- y && (m.appliedValid = !1)
- }
- }, e.prototype.applyRelativeWorld = function() {
- for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, o = s.a, a = s.b, l = s.c, h = s.d, c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) {
- var m = f[d],
- y = !1;
- if (0 != e) {
- var v = m.a,
- g = m.b,
- x = m.c,
- b = m.d;
- (w = Math.atan2(l, o) + u) > t.MathUtils.PI ? w -= t.MathUtils.PI2 : w < -t.MathUtils.PI && (w += t.MathUtils.PI2), w *= e;
- var A = Math.cos(w),
- C = Math.sin(w);
- m.a = A * v - C * x, m.b = A * g - C * b, m.c = C * v + A * x, m.d = C * g + A * b, y = !0
- }
- if (0 != i) {
- var T = this.temp;
- s.localToWorld(T.set(this.data.offsetX, this.data.offsetY)), m.worldX += T.x * i, m.worldY += T.y * i, y = !0
- }
- if (n > 0) {
- var S = (Math.sqrt(o * o + l * l) - 1 + this.data.offsetScaleX) * n + 1;
- m.a *= S, m.c *= S, S = (Math.sqrt(a * a + h * h) - 1 + this.data.offsetScaleY) * n + 1, m.b *= S, m.d *= S, y = !0
- }
- if (r > 0) {
- var w;
- (w = Math.atan2(h, a) - Math.atan2(l, o)) > t.MathUtils.PI ? w -= t.MathUtils.PI2 : w < -t.MathUtils.PI && (w += t.MathUtils.PI2);
- g = m.b, b = m.d;
- w = Math.atan2(b, g) + (w - t.MathUtils.PI / 2 + _) * r;
- S = Math.sqrt(g * g + b * b);
- m.b = Math.cos(w) * S, m.d = Math.sin(w) * S, y = !0
- }
- y && (m.appliedValid = !1)
- }
- }, e.prototype.applyAbsoluteLocal = function() {
- var t = this.rotateMix,
- e = this.translateMix,
- i = this.scaleMix,
- n = this.shearMix,
- r = this.target;
- r.appliedValid || r.updateAppliedTransform();
- for (var s = this.bones, o = 0, a = s.length; o < a; o++) {
- var l = s[o];
- l.appliedValid || l.updateAppliedTransform();
- var h = l.arotation;
- if (0 != t) {
- var c = r.arotation - h + this.data.offsetRotation;
- h += (c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0))) * t
- }
- var u = l.ax,
- _ = l.ay;
- 0 != e && (u += (r.ax - u + this.data.offsetX) * e, _ += (r.ay - _ + this.data.offsetY) * e);
- var f = l.ascaleX,
- d = l.ascaleY;
- i > 0 && (f > 1e-5 && (f = (f + (r.ascaleX - f + this.data.offsetScaleX) * i) / f), d > 1e-5 && (d = (d + (r.ascaleY - d + this.data.offsetScaleY) * i) / d));
- var p = l.ashearY;
- if (n > 0) {
- c = r.ashearY - p + this.data.offsetShearY;
- c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0)), l.shearY += c * n
- }
- l.updateWorldTransformWith(u, _, h, f, d, l.ashearX, p)
- }
- }, e.prototype.applyRelativeLocal = function() {
- var t = this.rotateMix,
- e = this.translateMix,
- i = this.scaleMix,
- n = this.shearMix,
- r = this.target;
- r.appliedValid || r.updateAppliedTransform();
- for (var s = this.bones, o = 0, a = s.length; o < a; o++) {
- var l = s[o];
- l.appliedValid || l.updateAppliedTransform();
- var h = l.arotation;
- 0 != t && (h += (r.arotation + this.data.offsetRotation) * t);
- var c = l.ax,
- u = l.ay;
- 0 != e && (c += (r.ax + this.data.offsetX) * e, u += (r.ay + this.data.offsetY) * e);
- var _ = l.ascaleX,
- f = l.ascaleY;
- i > 0 && (_ > 1e-5 && (_ *= (r.ascaleX - 1 + this.data.offsetScaleX) * i + 1), f > 1e-5 && (f *= (r.ascaleY - 1 + this.data.offsetScaleY) * i + 1));
- var d = l.ashearY;
- n > 0 && (d += (r.ashearY + this.data.offsetShearY) * n), l.updateWorldTransformWith(c, u, h, _, f, l.ashearX, d)
- }
- }, e.prototype.getOrder = function() {
- return this.data.order
- }, e
- })();
- t.TransformConstraint = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- return function(t) {
- if (this.order = 0, this.bones = new Array, this.rotateMix = 0, this.translateMix = 0, this.scaleMix = 0, this.shearMix = 0, this.offsetRotation = 0, this.offsetX = 0, this.offsetY = 0, this.offsetScaleX = 0, this.offsetScaleY = 0, this.offsetShearY = 0, this.relative = !1, this.local = !1, null == t) throw new Error("name cannot be null.");
- this.name = t
- }
- })();
- t.TransformConstraintData = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e() {
- this.convexPolygons = new Array, this.convexPolygonsIndices = new Array, this.indicesArray = new Array, this.isConcaveArray = new Array, this.triangles = new Array, this.polygonPool = new t.Pool(function() {
- return new Array
- }), this.polygonIndicesPool = new t.Pool(function() {
- return new Array
- })
- }
- return e.prototype.triangulate = function(t) {
- var i = t,
- n = t.length >> 1,
- r = this.indicesArray;
- r.length = 0;
- for (var s = 0; s < n; s++) r[s] = s;
- var o = this.isConcaveArray;
- o.length = 0;
- s = 0;
- for (var a = n; s < a; ++s) o[s] = e.isConcave(s, n, i, r);
- var l = this.triangles;
- for (l.length = 0; n > 3;) {
- for (var h = n - 1, c = (s = 0, 1);;) {
- t: if (!o[s]) {
- for (var u = r[h] << 1, _ = r[s] << 1, f = r[c] << 1, d = i[u], p = i[u + 1], m = i[_], y = i[_ + 1], v = i[f], g = i[f + 1], x = (c + 1) % n; x != h; x = (x + 1) % n)
- if (o[x]) {
- var b = r[x] << 1,
- A = i[b],
- C = i[b + 1];
- if (e.positiveArea(v, g, d, p, A, C) && e.positiveArea(d, p, m, y, A, C) && e.positiveArea(m, y, v, g, A, C)) break t
- }
- break
- }if (0 == c) {
- do {
- if (!o[s]) break;
- s--
- } while (s > 0);
- break
- }
- h = s,
- s = c,
- c = (c + 1) % n
- }
- l.push(r[(n + s - 1) % n]), l.push(r[s]), l.push(r[(s + 1) % n]), r.splice(s, 1), o.splice(s, 1);
- var T = (--n + s - 1) % n,
- S = s == n ? 0 : s;
- o[T] = e.isConcave(T, n, i, r), o[S] = e.isConcave(S, n, i, r)
- }
- return 3 == n && (l.push(r[2]), l.push(r[0]), l.push(r[1])), l
- }, e.prototype.decompose = function(t, i) {
- var n = t,
- r = this.convexPolygons;
- this.polygonPool.freeAll(r), r.length = 0;
- var s = this.convexPolygonsIndices;
- this.polygonIndicesPool.freeAll(s), s.length = 0;
- var o = this.polygonIndicesPool.obtain();
- o.length = 0;
- var a = this.polygonPool.obtain();
- a.length = 0;
- for (var l = -1, h = 0, c = 0, u = i.length; c < u; c += 3) {
- var _ = i[c] << 1,
- f = i[c + 1] << 1,
- d = i[c + 2] << 1,
- p = n[_],
- m = n[_ + 1],
- y = n[f],
- v = n[f + 1],
- g = n[d],
- x = n[d + 1],
- b = !1;
- if (l == _) {
- var A = a.length - 4,
- C = e.winding(a[A], a[A + 1], a[A + 2], a[A + 3], g, x),
- T = e.winding(g, x, a[0], a[1], a[2], a[3]);
- C == h && T == h && (a.push(g), a.push(x), o.push(d), b = !0)
- }
- b || (a.length > 0 ? (r.push(a), s.push(o)) : (this.polygonPool.free(a), this.polygonIndicesPool.free(o)), (a = this.polygonPool.obtain()).length = 0, a.push(p), a.push(m), a.push(y), a.push(v), a.push(g), a.push(x), (o = this.polygonIndicesPool.obtain()).length = 0, o.push(_), o.push(f), o.push(d), h = e.winding(p, m, y, v, g, x), l = _)
- }
- a.length > 0 && (r.push(a), s.push(o));
- for (c = 0, u = r.length; c < u; c++)
- if (0 != (o = s[c]).length)
- for (var S = o[0], w = o[o.length - 1], E = (a = r[c])[A = a.length - 4], M = a[A + 1], D = a[A + 2], B = a[A + 3], I = a[0], P = a[1], R = a[2], O = a[3], L = e.winding(E, M, D, B, I, P), F = 0; F < u; F++)
- if (F != c) {
- var N = s[F];
- if (3 == N.length) {
- var V = N[0],
- k = N[1],
- G = N[2],
- U = r[F];
- g = U[U.length - 2], x = U[U.length - 1];
- if (V == S && k == w) {
- C = e.winding(E, M, D, B, g, x), T = e.winding(g, x, I, P, R, O);
- C == L && T == L && (U.length = 0, N.length = 0, a.push(g), a.push(x), o.push(G), E = D, M = B, D = g, B = x, F = 0)
- }
- }
- }
- for (c = r.length - 1; c >= 0; c--) 0 == (a = r[c]).length && (r.splice(c, 1), this.polygonPool.free(a), o = s[c], s.splice(c, 1), this.polygonIndicesPool.free(o));
- return r
- }, e.isConcave = function(t, e, i, n) {
- var r = n[(e + t - 1) % e] << 1,
- s = n[t] << 1,
- o = n[(t + 1) % e] << 1;
- return !this.positiveArea(i[r], i[r + 1], i[s], i[s + 1], i[o], i[o + 1])
- }, e.positiveArea = function(t, e, i, n, r, s) {
- return t * (s - n) + i * (e - s) + r * (n - e) >= 0
- }, e.winding = function(t, e, i, n, r, s) {
- var o = i - t,
- a = n - e;
- return r * a - s * o + o * e - t * a >= 0 ? 1 : -1
- }, e
- })();
- t.Triangulator = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function t() {
- this.array = new Array
- }
- return t.prototype.add = function(t) {
- var e = this.contains(t);
- return this.array[0 | t] = 0 | t, !e
- }, t.prototype.contains = function(t) {
- return void 0 != this.array[0 | t]
- }, t.prototype.remove = function(t) {
- this.array[0 | t] = void 0
- }, t.prototype.clear = function() {
- this.array.length = 0
- }, t
- })();
- t.IntSet = e;
- var i = (function() {
- function t(t, e, i, n) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.r = t, this.g = e, this.b = i, this.a = n
- }
- return t.prototype.set = function(t, e, i, n) {
- return this.r = t, this.g = e, this.b = i, this.a = n, this.clamp(), this
- }, t.prototype.setFromColor = function(t) {
- return this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this
- }, t.prototype.setFromString = function(t) {
- return t = "#" == t.charAt(0) ? t.substr(1) : t, this.r = parseInt(t.substr(0, 2), 16) / 255, this.g = parseInt(t.substr(2, 2), 16) / 255, this.b = parseInt(t.substr(4, 2), 16) / 255, this.a = (8 != t.length ? 255 : parseInt(t.substr(6, 2), 16)) / 255, this
- }, t.prototype.add = function(t, e, i, n) {
- return this.r += t, this.g += e, this.b += i, this.a += n, this.clamp(), this
- }, t.prototype.clamp = function() {
- return this.r < 0 ? this.r = 0 : this.r > 1 && (this.r = 1), this.g < 0 ? this.g = 0 : this.g > 1 && (this.g = 1), this.b < 0 ? this.b = 0 : this.b > 1 && (this.b = 1), this.a < 0 ? this.a = 0 : this.a > 1 && (this.a = 1), this
- }, t.WHITE = new t(1, 1, 1, 1), t.RED = new t(1, 0, 0, 1), t.GREEN = new t(0, 1, 0, 1), t.BLUE = new t(0, 0, 1, 1), t.MAGENTA = new t(1, 0, 1, 1), t
- })();
- t.Color = i;
- var n = (function() {
- function t() {}
- return t.clamp = function(t, e, i) {
- return t < e ? e : t > i ? i : t
- }, t.cosDeg = function(e) {
- return Math.cos(e * t.degRad)
- }, t.sinDeg = function(e) {
- return Math.sin(e * t.degRad)
- }, t.signum = function(t) {
- return t > 0 ? 1 : t < 0 ? -1 : 0
- }, t.toInt = function(t) {
- return t > 0 ? Math.floor(t) : Math.ceil(t)
- }, t.cbrt = function(t) {
- var e = Math.pow(Math.abs(t), 1 / 3);
- return t < 0 ? -e : e
- }, t.randomTriangular = function(e, i) {
- return t.randomTriangularWith(e, i, .5 * (e + i))
- }, t.randomTriangularWith = function(t, e, i) {
- var n = Math.random(),
- r = e - t;
- return n <= (i - t) / r ? t + Math.sqrt(n * r * (i - t)) : e - Math.sqrt((1 - n) * r * (e - i))
- }, t.PI = 3.1415927, t.PI2 = 2 * t.PI, t.radiansToDegrees = 180 / t.PI, t.radDeg = t.radiansToDegrees, t.degreesToRadians = t.PI / 180, t.degRad = t.degreesToRadians, t
- })();
- t.MathUtils = n;
- var s = (function() {
- function t() {}
- return t.prototype.apply = function(t, e, i) {
- return t + (e - t) * this.applyInternal(i)
- }, t
- })();
- t.Interpolation = s;
- var o = (function(t) {
- function e(e) {
- var i = t.call(this) || this;
- return i.power = 2, i.power = e, i
- }
- return r(e, t), e.prototype.applyInternal = function(t) {
- return t <= .5 ? Math.pow(2 * t, this.power) / 2 : Math.pow(2 * (t - 1), this.power) / (this.power % 2 == 0 ? -2 : 2) + 1
- }, e
- })(s);
- t.Pow = o;
- var a = (function(t) {
- function e(e) {
- return t.call(this, e) || this
- }
- return r(e, t), e.prototype.applyInternal = function(t) {
- return Math.pow(t - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1
- }, e
- })(o);
- t.PowOut = a;
- var l = (function() {
- function t() {}
- return t.arrayCopy = function(t, e, i, n, r) {
- for (var s = e, o = n; s < e + r; s++, o++) i[o] = t[s]
- }, t.setArraySize = function(t, e, i) {
- void 0 === i && (i = 0);
- var n = t.length;
- if (n == e) return t;
- if (t.length = e, n < e)
- for (var r = n; r < e; r++) t[r] = i;
- return t
- }, t.ensureArrayCapacity = function(e, i, n) {
- return void 0 === n && (n = 0), e.length >= i ? e : t.setArraySize(e, i, n)
- }, t.newArray = function(t, e) {
- for (var i = new Array(t), n = 0; n < t; n++) i[n] = e;
- return i
- }, t.newFloatArray = function(e) {
- if (t.SUPPORTS_TYPED_ARRAYS) return new Float32Array(e);
- for (var i = new Array(e), n = 0; n < i.length; n++) i[n] = 0;
- return i
- }, t.newShortArray = function(e) {
- if (t.SUPPORTS_TYPED_ARRAYS) return new Int16Array(e);
- for (var i = new Array(e), n = 0; n < i.length; n++) i[n] = 0;
- return i
- }, t.toFloatArray = function(e) {
- return t.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e
- }, t.toSinglePrecision = function(e) {
- return t.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e
- }, t.webkit602BugfixHelper = function(t, e) {}, t.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array, t
- })();
- t.Utils = l;
- var h = (function() {
- function t() {}
- return t.logBones = function(t) {
- for (var e = 0; e < t.bones.length; e++) {
- var i = t.bones[e];
- console.log(i.data.name + ", " + i.a + ", " + i.b + ", " + i.c + ", " + i.d + ", " + i.worldX + ", " + i.worldY)
- }
- }, t
- })();
- t.DebugUtils = h;
- var c = (function() {
- function t(t) {
- this.items = new Array, this.instantiator = t
- }
- return t.prototype.obtain = function() {
- return this.items.length > 0 ? this.items.pop() : this.instantiator()
- }, t.prototype.free = function(t) {
- t.reset && t.reset(), this.items.push(t)
- }, t.prototype.freeAll = function(t) {
- for (var e = 0; e < t.length; e++) t[e].reset && t[e].reset(), this.items[e] = t[e]
- }, t.prototype.clear = function() {
- this.items.length = 0
- }, t
- })();
- t.Pool = c;
- var u = (function() {
- function t(t, e) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
- }
- return t.prototype.set = function(t, e) {
- return this.x = t, this.y = e, this
- }, t.prototype.length = function() {
- var t = this.x,
- e = this.y;
- return Math.sqrt(t * t + e * e)
- }, t.prototype.normalize = function() {
- var t = this.length();
- return 0 != t && (this.x /= t, this.y /= t), this
- }, t
- })();
- t.Vector2 = u;
- var _ = (function() {
- function t() {
- this.maxDelta = .064, this.framesPerSecond = 0, this.delta = 0, this.totalTime = 0, this.lastTime = Date.now() / 1e3, this.frameCount = 0, this.frameTime = 0
- }
- return t.prototype.update = function() {
- var t = Date.now() / 1e3;
- this.delta = t - this.lastTime, this.frameTime += this.delta, this.totalTime += this.delta, this.delta > this.maxDelta && (this.delta = this.maxDelta), this.lastTime = t, this.frameCount++, this.frameTime > 1 && (this.framesPerSecond = this.frameCount / this.frameTime, this.frameTime = 0, this.frameCount = 0)
- }, t
- })();
- t.TimeKeeper = _;
- var f = (function() {
- function t(t) {
- void 0 === t && (t = 32), this.addedValues = 0, this.lastValue = 0, this.mean = 0, this.dirty = !0, this.values = new Array(t)
- }
- return t.prototype.hasEnoughData = function() {
- return this.addedValues >= this.values.length
- }, t.prototype.addValue = function(t) {
- this.addedValues < this.values.length && this.addedValues++, this.values[this.lastValue++] = t, this.lastValue > this.values.length - 1 && (this.lastValue = 0), this.dirty = !0
- }, t.prototype.getMean = function() {
- if (this.hasEnoughData()) {
- if (this.dirty) {
- for (var t = 0, e = 0; e < this.values.length; e++) t += this.values[e];
- this.mean = t / this.values.length, this.dirty = !1
- }
- return this.mean
- }
- return 0
- }, t
- })();
- t.WindowedMean = f
- })(n || (n = {})), Math.fround || (Math.fround = (function(t) {
- return function(e) {
- return t[0] = e, t[0]
- }
- })(new Float32Array(1))), (function(t) {
- var e = (function() {
- return function(t) {
- if (null == t) throw new Error("name cannot be null.");
- this.name = t
- }
- })();
- t.Attachment = e;
- var i = (function(t) {
- function e(i) {
- var n = t.call(this, i) || this;
- return n.id = (65535 & e.nextID++) << 11, n.worldVerticesLength = 0, n
- }
- return r(e, t), e.prototype.computeWorldVertices = function(t, e, i, n, r, s) {
- i = r + (i >> 1) * s;
- var o = t.bone.skeleton,
- a = t.attachmentVertices,
- l = this.vertices,
- h = this.bones;
- if (null != h) {
- for (var c = 0, u = 0, _ = 0; _ < e; _ += 2) {
- c += (m = h[c]) + 1, u += m
- }
- var f = o.bones;
- if (0 == a.length)
- for (M = r, T = 3 * u; M < i; M += s) {
- var d = 0,
- p = 0,
- m = h[c++];
- for (m += c; c < m; c++, T += 3) {
- x = f[h[c]], D = l[T], B = l[T + 1];
- var y = l[T + 2];
- d += (D * x.a + B * x.b + x.worldX) * y, p += (D * x.c + B * x.d + x.worldY) * y
- }
- n[M] = d, n[M + 1] = p
- } else
- for (var v = a, g = (M = r, T = 3 * u, u << 1); M < i; M += s) {
- d = 0, p = 0, m = h[c++];
- for (m += c; c < m; c++, T += 3, g += 2) {
- x = f[h[c]], D = l[T] + v[g], B = l[T + 1] + v[g + 1], y = l[T + 2];
- d += (D * x.a + B * x.b + x.worldX) * y, p += (D * x.c + B * x.d + x.worldY) * y
- }
- n[M] = d, n[M + 1] = p
- }
- } else {
- a.length > 0 && (l = a);
- for (var x, b = (x = t.bone).worldX, A = x.worldY, C = x.a, T = x.b, S = x.c, w = x.d, E = e, M = r; M < i; E += 2, M += s) {
- var D = l[E],
- B = l[E + 1];
- n[M] = D * C + B * T + b, n[M + 1] = D * S + B * w + A
- }
- }
- }, e.prototype.applyDeform = function(t) {
- return this == t
- }, e.nextID = 0, e
- })(e);
- t.VertexAttachment = i
- })(n || (n = {})), (function(t) {
- (function(t) {
- t[t.Region = 0] = "Region", t[t.BoundingBox = 1] = "BoundingBox", t[t.Mesh = 2] = "Mesh", t[t.LinkedMesh = 3] = "LinkedMesh", t[t.Path = 4] = "Path", t[t.Point = 5] = "Point"
- })(t.AttachmentType || (t.AttachmentType = {}))
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.color = new t.Color(1, 1, 1, 1), n
- }
- return r(i, e), i
- })(t.VertexAttachment);
- t.BoundingBoxAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.color = new t.Color(.2275, .2275, .8078, 1), n
- }
- return r(i, e), i
- })(t.VertexAttachment);
- t.ClippingAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.color = new t.Color(1, 1, 1, 1), n.inheritDeform = !1, n.tempColor = new t.Color(0, 0, 0, 0), n
- }
- return r(i, e), i.prototype.updateUVs = function() {
- var e = 0,
- i = 0,
- n = 0,
- r = 0;
- null == this.region ? (e = i = 0, n = r = 1) : (e = this.region.u, i = this.region.v, n = this.region.u2 - e, r = this.region.v2 - i);
- var s = this.regionUVs;
- null != this.uvs && this.uvs.length == s.length || (this.uvs = t.Utils.newFloatArray(s.length));
- var o = this.uvs;
- if (this.region.rotate)
- for (var a = 0, l = o.length; a < l; a += 2) o[a] = e + s[a + 1] * n, o[a + 1] = i + r - s[a] * r;
- else
- for (a = 0, l = o.length; a < l; a += 2) o[a] = e + s[a] * n, o[a + 1] = i + s[a + 1] * r
- }, i.prototype.applyDeform = function(t) {
- return this == t || this.inheritDeform && this.parentMesh == t
- }, i.prototype.getParentMesh = function() {
- return this.parentMesh
- }, i.prototype.setParentMesh = function(t) {
- this.parentMesh = t, null != t && (this.bones = t.bones, this.vertices = t.vertices, this.worldVerticesLength = t.worldVerticesLength, this.regionUVs = t.regionUVs, this.triangles = t.triangles, this.hullLength = t.hullLength, this.worldVerticesLength = t.worldVerticesLength)
- }, i
- })(t.VertexAttachment);
- t.MeshAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.closed = !1, n.constantSpeed = !1, n.color = new t.Color(1, 1, 1, 1), n
- }
- return r(i, e), i
- })(t.VertexAttachment);
- t.PathAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.color = new t.Color(.38, .94, 0, 1), n
- }
- return r(i, e), i.prototype.computeWorldPosition = function(t, e) {
- return e.x = this.x * t.a + this.y * t.b + t.worldX, e.y = this.x * t.c + this.y * t.d + t.worldY, e
- }, i.prototype.computeWorldRotation = function(e) {
- var i = t.MathUtils.cosDeg(this.rotation),
- n = t.MathUtils.sinDeg(this.rotation),
- r = i * e.a + n * e.b,
- s = i * e.c + n * e.d;
- return Math.atan2(s, r) * t.MathUtils.radDeg
- }, i
- })(t.VertexAttachment);
- t.PointAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function(e) {
- function i(i) {
- var n = e.call(this, i) || this;
- return n.x = 0, n.y = 0, n.scaleX = 1, n.scaleY = 1, n.rotation = 0, n.width = 0, n.height = 0, n.color = new t.Color(1, 1, 1, 1), n.offset = t.Utils.newFloatArray(8), n.uvs = t.Utils.newFloatArray(8), n.tempColor = new t.Color(1, 1, 1, 1), n
- }
- return r(i, e), i.prototype.updateOffset = function() {
- var t = this.width / this.region.originalWidth * this.scaleX,
- e = this.height / this.region.originalHeight * this.scaleY,
- n = -this.width / 2 * this.scaleX + this.region.offsetX * t,
- r = -this.height / 2 * this.scaleY + this.region.offsetY * e,
- s = n + this.region.width * t,
- o = r + this.region.height * e,
- a = this.rotation * Math.PI / 180,
- l = Math.cos(a),
- h = Math.sin(a),
- c = n * l + this.x,
- u = n * h,
- _ = r * l + this.y,
- f = r * h,
- d = s * l + this.x,
- p = s * h,
- m = o * l + this.y,
- y = o * h,
- v = this.offset;
- v[i.OX1] = c - f, v[i.OY1] = _ + u, v[i.OX2] = c - y, v[i.OY2] = m + u, v[i.OX3] = d - y, v[i.OY3] = m + p, v[i.OX4] = d - f, v[i.OY4] = _ + p
- }, i.prototype.setRegion = function(t) {
- this.region = t;
- var e = this.uvs;
- t.rotate ? (e[2] = t.u, e[3] = t.v2, e[4] = t.u, e[5] = t.v, e[6] = t.u2, e[7] = t.v, e[0] = t.u2, e[1] = t.v2) : (e[0] = t.u, e[1] = t.v2, e[2] = t.u, e[3] = t.v, e[4] = t.u2, e[5] = t.v, e[6] = t.u2, e[7] = t.v2)
- }, i.prototype.computeWorldVertices = function(t, e, n, r) {
- var s = this.offset,
- o = t.worldX,
- a = t.worldY,
- l = t.a,
- h = t.b,
- c = t.c,
- u = t.d,
- _ = 0,
- f = 0;
- _ = s[i.OX1], f = s[i.OY1], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX2], f = s[i.OY2], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX3], f = s[i.OY3], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX4], f = s[i.OY4], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a
- }, i.OX1 = 0, i.OY1 = 1, i.OX2 = 2, i.OY2 = 3, i.OX3 = 4, i.OY3 = 5, i.OX4 = 6, i.OY4 = 7, i.X1 = 0, i.Y1 = 1, i.C1R = 2, i.C1G = 3, i.C1B = 4, i.C1A = 5, i.U1 = 6, i.V1 = 7, i.X2 = 8, i.Y2 = 9, i.C2R = 10, i.C2G = 11, i.C2B = 12, i.C2A = 13, i.U2 = 14, i.V2 = 15, i.X3 = 16, i.Y3 = 17, i.C3R = 18, i.C3G = 19, i.C3B = 20, i.C3A = 21, i.U3 = 22, i.V3 = 23, i.X4 = 24, i.Y4 = 25, i.C4R = 26, i.C4G = 27, i.C4B = 28, i.C4A = 29, i.U4 = 30, i.V4 = 31, i
- })(t.Attachment);
- t.RegionAttachment = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- this.jitterX = 0, this.jitterY = 0, this.jitterX = t, this.jitterY = e
- }
- return e.prototype.begin = function(t) {}, e.prototype.transform = function(e, i, n, r) {
- e.x += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY), e.y += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY)
- }, e.prototype.end = function() {}, e
- })();
- t.JitterEffect = e
- })(n || (n = {})), (function(t) {
- var e = (function() {
- function e(t, e) {
- this.centerX = 0, this.centerY = 0, this.radius = 0, this.angle = 0, this.worldX = 0, this.worldY = 0, this.radius = t, this.interpolation = e
- }
- return e.prototype.begin = function(t) {
- this.worldX = t.x + this.centerX, this.worldY = t.y + this.centerY
- }, e.prototype.transform = function(e, i, n, r) {
- var s = this.angle * t.MathUtils.degreesToRadians,
- o = e.x - this.worldX,
- a = e.y - this.worldY,
- l = Math.sqrt(o * o + a * a);
- if (l < this.radius) {
- var h = this.interpolation.apply(0, s, (this.radius - l) / this.radius),
- c = Math.cos(h),
- u = Math.sin(h);
- e.x = c * o - u * a + this.worldX, e.y = u * o + c * a + this.worldY
- }
- }, e.prototype.end = function() {}, e.interpolation = new t.PowOut(2), e
- })();
- t.SwirlEffect = e
- })(n || (n = {})), e.exports = n
- }), {}],
- 415: [(function(t, e, i) {
- "use strict";
- var n = t("./track-entry-listeners"),
- r = t("./lib/spine"),
- s = [],
- o = [],
- a = 0,
- l = 0,
- h = null,
- c = null,
- u = 0,
- _ = 0,
- f = 0,
- d = 0,
- p = null,
- m = null,
- y = 0,
- v = 0,
- g = void 0,
- x = void 0,
- b = void 0,
- A = void 0,
- C = void 0,
- T = void 0,
- S = new r.Color(1, 1, 1, 1),
- w = new r.Color(1, 1, 1, 1),
- E = [0, 1, 2, 2, 3, 0],
- M = cc.Class({
- ctor: function() {
- this._inited = !1, this._invalid = !0, this.frames = [], this.totalTime = 0, this._frameIdx = -1, this.isCompleted = !1, this._skeletonInfo = null, this._animationName = null, this._tempSegments = null, this._tempColors = null
- },
- init: function(t, e) {
- this._inited = !0, this._animationName = e, this._skeletonInfo = t
- },
- clear: function() {
- this._inited = !1;
- for (var t = 0, e = this.frames.length; t < e; t++) {
- this.frames[t].segments.length = 0
- }
- this.invalidAllFrame()
- },
- bind: function(t) {
- var e = function(t) {
- t && t.animation.name === this._animationName && (this.isCompleted = !0)
- }.bind(this);
- t.complete = e
- },
- unbind: function(t) {
- t.complete = null
- },
- begin: function() {
- if (this._invalid) {
- var t = this._skeletonInfo,
- e = t.curAnimationCache;
- e && e !== this && e.updateToFrame();
- var i = t.skeleton,
- n = t.listener,
- r = t.state,
- s = i.data.findAnimation(this._animationName);
- r.setAnimationWith(0, s, !1), this.bind(n), t.curAnimationCache = this, this._frameIdx = -1, this.isCompleted = !1, this.totalTime = 0, this._invalid = !1
- }
- },
- end: function() {
- this._needToUpdate() || (this._skeletonInfo.curAnimationCache = null, this.frames.length = this._frameIdx + 1, this.isCompleted = !0, this.unbind(this._skeletonInfo.listener))
- },
- _needToUpdate: function(t) {
- return !this.isCompleted && this.totalTime < 30 && (void 0 == t || this._frameIdx < t)
- },
- updateToFrame: function(t) {
- if (this._inited && (this.begin(), this._needToUpdate(t))) {
- var e = this._skeletonInfo,
- i = e.skeleton,
- n = e.clipper,
- r = e.state;
- do {
- i.update(1 / 60), r.update(1 / 60), r.apply(i), i.updateWorldTransform(), this._frameIdx++, this._updateFrame(i, n, this._frameIdx), this.totalTime += 1 / 60
- } while (this._needToUpdate(t));
- this.end()
- }
- },
- isInited: function() {
- return this._inited
- },
- isInvalid: function() {
- return this._invalid
- },
- invalidAllFrame: function() {
- this.isCompleted = !1, this._invalid = !0
- },
- updateAllFrame: function() {
- this.invalidAllFrame(), this.updateToFrame()
- },
- _updateFrame: function(t, e, i) {
- l = 0, a = 0, 0, h = null, c = null, u = 0, _ = 0, f = 0, d = 0, p = null, m = null, this.frames[i] = this.frames[i] || {
- segments: [],
- colors: [],
- vertices: null,
- uintVert: null,
- indices: null
- };
- var n = this.frames[i],
- r = this._tempSegments = n.segments,
- y = this._tempColors = n.colors;
- this._traverseSkeleton(t, e), d > 0 && (y[d - 1].vfOffset = l), y.length = d;
- var v = f - 1;
- if (v >= 0)
- if (_ > 0) {
- var g = r[v];
- g.indexCount = _, g.vfCount = 6 * u, g.vertexCount = u, r.length = f
- } else r.length = f - 1;
- if (0 != r.length) {
- var x = n.vertices,
- b = n.uintVert;
- (!x || x.length < l) && (x = n.vertices = new Float32Array(l), b = n.uintVert = new Uint32Array(x.buffer));
- for (var A = 0, C = 0; A < l;) x[A++] = s[C++], x[A++] = s[C++], x[A++] = s[C++], x[A++] = s[C++], b[A++] = s[C++], b[A++] = s[C++];
- var T = n.indices;
- (!T || T.length < a) && (T = n.indices = new Uint16Array(a));
- for (var S = 0; S < a; S++) T[S] = o[S];
- n.vertices = x, n.uintVert = b, n.indices = T
- }
- },
- fillVertices: function(t, e, i, n, r) {
- if (A = i.a * e.a * t.a * 255, g = e.r * t.r * 255, x = e.g * t.g * 255, b = e.b * t.b * 255, S.r = g * i.r, S.g = x * i.g, S.b = b * i.b, S.a = A, null == r.darkColor ? w.set(0, 0, 0, 1) : (w.r = r.darkColor.r * g, w.g = r.darkColor.g * x, w.b = r.darkColor.b * b), w.a = 0, C = (S.a << 24 >>> 0) + (S.b << 16) + (S.g << 8) + S.r, T = (w.a << 24 >>> 0) + (w.b << 16) + (w.g << 8) + w.r, p !== C || m !== T) {
- var h = this._tempColors;
- p = C, m = T, d > 0 && (h[d - 1].vfOffset = l), h[d++] = {
- fr: S.r,
- fg: S.g,
- fb: S.b,
- fa: S.a,
- dr: w.r,
- dg: w.g,
- db: w.b,
- da: w.a,
- vfOffset: 0
- }
- }
- if (n.isClipping()) {
- n.clipTriangles(s, y, o, v, s, S, w, !0, 6, a, l, l + 2);
- var c = n.clippedVertices,
- u = n.clippedTriangles;
- v = u.length, y = c.length / 12 * 6;
- for (var _ = 0, f = a, E = u.length; _ < E;) o[f++] = u[_++];
- for (var M = 0, D = c.length, B = l; M < D; M += 12, B += 6) s[B] = c[M], s[B + 1] = c[M + 1], s[B + 2] = c[M + 6], s[B + 3] = c[M + 7], s[B + 4] = C, s[B + 5] = T
- } else
- for (var I = l, P = l + y; I < P; I += 6) s[I + 4] = C, s[I + 5] = T
- },
- _traverseSkeleton: function(t, e) {
- for (var i = this._tempSegments, n = t.color, d = void 0, p = void 0, m = void 0, g = void 0, x = void 0, b = void 0, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, M = void 0, D = 0, B = t.drawOrder.length; D < B; D++)
- if (M = t.drawOrder[D], y = 0, v = 0, d = M.getAttachment())
- if (b = d instanceof r.RegionAttachment, A = d instanceof r.MeshAttachment, d instanceof r.ClippingAttachment) e.clipStart(M, d);
- else if (b || A)
- if (C = d.region.texture._texture)
- if (w = M.data.blendMode, h === C.url && c === w || (h = C.url, c = w, (T = f - 1) >= 0 && (_ > 0 ? ((S = i[T]).indexCount = _, S.vertexCount = u, S.vfCount = 6 * u) : f--), i[f] = {
- tex: C,
- blendMode: w,
- indexCount: 0,
- vertexCount: 0,
- vfCount: 0
- }, f++, _ = 0, u = 0), b ? (x = E, y = 24, v = 6, d.computeWorldVertices(M.bone, s, l, 6)) : A && (x = d.triangles, y = 6 * (d.worldVerticesLength >> 1), v = x.length, d.computeWorldVertices(M, 0, d.worldVerticesLength, s, l, 6)), 0 != y && 0 != v) {
- for (var I = 0, P = a, R = x.length; I < R;) o[P++] = x[I++];
- g = d.uvs;
- for (var O = l, L = l + y, F = 0; O < L; O += 6, F += 2) s[O + 2] = g[F], s[O + 3] = g[F + 1];
- if (p = d.color, m = M.color, this.fillVertices(n, p, m, e, M), v > 0) {
- for (var N = a, V = a + v; N < V; N++) o[N] += u;
- a += v, (l += y) / 6, _ += v, u += y / 6
- }
- e.clipEndWithSlot(M)
- } else e.clipEndWithSlot(M);
- else e.clipEndWithSlot(M);
- else e.clipEndWithSlot(M);
- else e.clipEndWithSlot(M);
- e.clipEnd()
- }
- }),
- D = cc.Class({
- ctor: function() {
- this._animationPool = {}, this._skeletonCache = {}
- },
- clear: function() {
- this._animationPool = {}, this._skeletonCache = {}
- },
- removeSkeleton: function(t) {
- var e = this._skeletonCache[t];
- if (e) {
- var i = e.animationsCache;
- for (var n in i) {
- var r = i[n];
- r && (this._animationPool[t + "#" + n] = r, r.clear())
- }
- delete this._skeletonCache[t]
- }
- },
- getSkeletonCache: function(t, e) {
- var i = this._skeletonCache[t];
- if (!i) {
- var s = new r.Skeleton(e),
- o = new r.SkeletonClipping,
- a = new r.AnimationStateData(s.data),
- l = new r.AnimationState(a),
- h = new n;
- l.addListener(h), this._skeletonCache[t] = i = {
- skeleton: s,
- clipper: o,
- state: l,
- listener: h,
- animationsCache: {},
- curAnimationCache: null
- }
- }
- return i
- },
- getAnimationCache: function(t, e) {
- var i = this._skeletonCache[t];
- return i ? i.animationsCache[e] : null
- },
- invalidAnimationCache: function(t) {
- var e = this._skeletonCache[t];
- if (e && e.skeleton) {
- var i = e.animationsCache;
- for (var n in i) {
- i[n].invalidAllFrame()
- }
- }
- },
- initAnimationCache: function(t, e) {
- if (!e) return null;
- var i = this._skeletonCache[t],
- n = i && i.skeleton;
- if (!n) return null;
- if (!n.data.findAnimation(e)) return null;
- var r = i.animationsCache,
- s = r[e];
- if (!s) {
- var o = t + "#" + e;
- (s = this._animationPool[o]) ? delete this._animationPool[o]: s = new M, s.init(i, e), r[e] = s
- }
- return s
- },
- updateAnimationCache: function(t, e) {
- if (e) {
- var i = this.initAnimationCache(t, e);
- if (!i) return null;
- i.updateAllFrame()
- } else {
- var n = this._skeletonCache[t];
- if (!(n && n.skeleton)) return;
- var r = n.animationsCache;
- for (var s in r) {
- r[s].updateAllFrame()
- }
- }
- }
- });
- D.FrameTime = 1 / 60, D.sharedCache = new D, e.exports = D
- }), {
- "./lib/spine": 414,
- "./track-entry-listeners": 419
- }],
- 416: [(function(t, e, i) {
- "use strict";
- var n = t("./skeleton-cache").sharedCache,
- r = cc.Class({
- name: "sp.SkeletonData",
- extends: cc.Asset,
- ctor: function() {
- this.reset()
- },
- properties: {
- _skeletonJson: null,
- skeletonJsonStr: {
- get: function() {
- return this._skeletonJson ? JSON.stringify(this._skeletonJson) : ""
- }
- },
- skeletonJson: {
- get: function() {
- return this._skeletonJson
- },
- set: function(t) {
- this._skeletonJson = "string" == typeof t ? JSON.parse(t) : t, !this._uuid && t.skeleton && (this._uuid = t.skeleton.hash), this.reset()
- }
- },
- _atlasText: "",
- atlasText: {
- get: function() {
- return this._atlasText
- },
- set: function(t) {
- this._atlasText = t, this.reset()
- }
- },
- textures: {
- default: [],
- type: [cc.Texture2D]
- },
- textureNames: {
- default: [],
- type: [cc.String]
- },
- scale: 1
- },
- statics: {
- preventDeferredLoadDependents: !0,
- preventPreloadNativeObject: !0
- },
- createNode: !1,
- reset: function() {
- this._skeletonCache = null, this._atlasCache = null
- },
- ensureTexturesLoaded: function(t, e) {
- var i = this.textures,
- n = i.length;
- if (0 != n)
- for (var r = 0, s = function() {
- ++r >= n && (t && t.call(e, !0), t = null)
- }, o = 0; o < n; o++) {
- var a = i[o];
- a.loaded ? s() : a.once("load", s)
- } else t.call(e, !1)
- },
- getRuntimeData: function(t) {
- if (this._skeletonCache) return this._skeletonCache;
- if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) return t || cc.errorID(7507, this.name), null;
- var e = this._getAtlas(t);
- if (!e) return null;
- var i = new sp.spine.AtlasAttachmentLoader(e),
- n = new sp.spine.SkeletonJson(i);
- n.scale = this.scale;
- var r = this.skeletonJson;
- return this._skeletonCache = n.readSkeletonData(r), e.dispose(n), this._skeletonCache
- },
- getSkinsEnum: !1,
- getAnimsEnum: !1,
- _getTexture: function(t) {
- for (var e = this.textureNames, i = 0; i < e.length; i++)
- if (e[i] === t) {
- var n = this.textures[i],
- r = new sp.SkeletonTexture({
- width: n.width,
- height: n.height
- });
- return r.setRealTexture(n), r
- }
- return cc.errorID(7506, t), null
- },
- _getAtlas: function(t) {
- return this._atlasCache ? this._atlasCache : this.atlasText ? this._atlasCache = new sp.spine.TextureAtlas(this.atlasText, this._getTexture.bind(this)) : (t || cc.errorID(7508, this.name), null)
- },
- destroy: function() {
- n.removeSkeleton(this._uuid), this._super()
- }
- });
- sp.SkeletonData = e.exports = r
- }), {
- "./skeleton-cache": 415
- }],
- 417: [(function(t, e, i) {
- "use strict";
- sp.SkeletonTexture = cc.Class({
- name: "sp.SkeletonTexture",
- extends: sp.spine.Texture,
- _texture: null,
- _material: null,
- setRealTexture: function(t) {
- this._texture = t
- },
- getRealTexture: function() {
- return this._texture
- },
- setFilters: function(t, e) {
- this._texture && this._texture.setFilters(t, e)
- },
- setWraps: function(t, e) {
- this._texture && this._texture.setWrapMode(t, e)
- },
- dispose: function() {}
- })
- }), {}],
- 418: [(function(t, e, i) {
- "use strict";
- i.__esModule = !0, i.default = void 0;
- var n = (function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- })(t("../../cocos2d/core/renderer/assembler"));
- function r(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
- function s(t, e) {
- if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !e || "object" != typeof e && "function" != typeof e ? t : e
- }
- function o(t, e) {
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
- t.prototype = Object.create(e && e.prototype, {
- constructor: {
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
- }
- var a = t("./Skeleton"),
- l = t("./lib/spine"),
- h = t("../../cocos2d/core/renderer/render-flow"),
- c = t("../../cocos2d/core/renderer/webgl/vertex-format"),
- u = c.vfmtPosUvColor,
- _ = c.vfmtPosUvTwoColor,
- f = cc.gfx,
- d = 0,
- p = [0, 1, 2, 2, 3, 0],
- m = cc.color(0, 0, 255, 255),
- y = cc.color(255, 0, 0, 255),
- v = cc.color(0, 255, 0, 255),
- g = cc.color(255, 255, 0, 255),
- x = null,
- b = null,
- A = null,
- C = null;
- x = new l.Color(1, 1, 1, 1), b = new l.Color(1, 1, 1, 1), A = new l.Vector2, C = new l.Vector2;
- var T = void 0,
- S = void 0,
- w = void 0,
- E = void 0,
- M = void 0,
- D = void 0,
- B = void 0,
- I = void 0,
- P = void 0,
- R = void 0,
- O = void 0,
- L = void 0,
- F = void 0,
- N = void 0,
- V = void 0,
- k = void 0,
- G = void 0,
- U = 0,
- z = 0,
- j = 0,
- W = 0,
- H = 0,
- X = 0,
- Y = 0,
- q = void 0,
- J = void 0,
- Z = void 0,
- K = void 0,
- Q = void 0,
- $ = void 0,
- tt = void 0,
- et = void 0,
- it = void 0,
- nt = void 0,
- rt = void 0,
- st = void 0,
- ot = void 0,
- at = void 0,
- lt = void 0,
- ht = void 0,
- ct = void 0,
- ut = void 0,
- _t = void 0,
- ft = void 0,
- dt = void 0,
- pt = void 0,
- mt = void 0,
- yt = void 0,
- vt = void 0,
- gt = void 0,
- xt = void 0,
- bt = void 0,
- At = void 0;
- function Ct(t, e) {
- var i = void 0,
- n = void 0;
- switch (e) {
- case l.BlendMode.Additive:
- i = T ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE;
- break;
- case l.BlendMode.Multiply:
- i = cc.macro.DST_COLOR, n = cc.macro.ONE_MINUS_SRC_ALPHA;
- break;
- case l.BlendMode.Screen:
- i = cc.macro.ONE, n = cc.macro.ONE_MINUS_SRC_COLOR;
- break;
- case l.BlendMode.Normal:
- default:
- i = T ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE_MINUS_SRC_ALPHA
- }
- var r = !yt.enableBatch,
- s = t.getId() + i + n + M + r,
- o = yt.sharedMaterials[0];
- if (!o) return null;
- var a = yt._materialCache,
- h = a[s];
- h ? h.getProperty("texture") !== t && (h.setProperty("texture", t), h.updateHash(s)) : (a[o._hash] ? (h = new cc.Material).copy(o) : h = o, h.define("CC_USE_MODEL", r), h.define("USE_TINT", M), h.setProperty("texture", t), h.effect.setBlend(!0, f.BLEND_FUNC_ADD, i, n, f.BLEND_FUNC_ADD, i, n), h.updateHash(s), a[s] = h);
- return h
- }
- function Tt(t) {
- ft = t.fa * L, at = P * (S = T ? ft / 255 : 1), lt = R * S, ht = O * S, ct = t.fr * at, ut = t.fg * lt, _t = t.fb * ht, F = (ft << 24 >>> 0) + (_t << 16) + (ut << 8) + ct, dt = t.dr * at, pt = t.dg * lt, mt = t.db * ht, N = ((T ? 255 : 0) << 24 >>> 0) + (mt << 16) + (pt << 8) + dt
- }
- function St(t) {
- return (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r
- }
- var wt = (function(t) {
- function e() {
- return r(this, e), s(this, t.apply(this, arguments))
- }
- return o(e, t), e.prototype.updateRenderData = function(t) {
- if (!t.isAnimationCached()) {
- var e = t._skeleton;
- e && e.updateWorldTransform()
- }
- }, e.prototype.fillVertices = function(t, e, i, n, r) {
- var s = vt._vData,
- o = vt._iData,
- a = vt._uintVData,
- l = void 0;
- if (x.a = i.a * e.a * t.a * L * 255, S = T ? x.a : 255, q = P * e.r * t.r * S, J = R * e.g * t.g * S, Z = O * e.b * t.b * S, x.r = q * i.r, x.g = J * i.g, x.b = Z * i.b, null == r.darkColor ? b.set(0, 0, 0, 1) : (b.r = r.darkColor.r * q, b.g = r.darkColor.g * J, b.b = r.darkColor.b * Z), b.a = T ? 255 : 0, n.isClipping()) {
- var h = s.subarray(j + 2);
- n.clipTriangles(s.subarray(j), U, o.subarray(X), H, h, x, b, M, k);
- var c = new Float32Array(n.clippedVertices),
- u = n.clippedTriangles;
- if (H = u.length, U = c.length / G * k, l = vt.request(U / k, H), X = l.indiceOffset, W = l.vertexOffset, j = l.byteOffset >> 2, s = vt._vData, o = vt._iData, a = vt._uintVData, o.set(u, X), At)
- for (var _ = 0, f = c.length, d = j; _ < f; _ += G, d += k) A.x = c[_], A.y = c[_ + 1], x.set(c[_ + 2], c[_ + 3], c[_ + 4], c[_ + 5]), C.x = c[_ + 6], C.y = c[_ + 7], M ? b.set(c[_ + 8], c[_ + 9], c[_ + 10], c[_ + 11]) : b.set(0, 0, 0, 0), At.transform(A, C, x, b), s[d] = A.x, s[d + 1] = A.y, s[d + 2] = C.x, s[d + 3] = C.y, a[d + 4] = St(x), M && (a[d + 5] = St(b));
- else
- for (var p = 0, m = c.length, y = j; p < m; p += G, y += k) s[y] = c[p], s[y + 1] = c[p + 1], s[y + 2] = c[p + 6], s[y + 3] = c[p + 7], F = (c[p + 5] << 24 >>> 0) + (c[p + 4] << 16) + (c[p + 3] << 8) + c[p + 2], a[y + 4] = F, M && (N = (c[p + 11] << 24 >>> 0) + (c[p + 10] << 16) + (c[p + 9] << 8) + c[p + 8], a[y + 5] = N)
- } else if (At)
- for (var v = j, g = j + U; v < g; v += k) A.x = s[v], A.y = s[v + 1], C.x = s[v + 2], C.y = s[v + 3], At.transform(A, C, x, b), s[v] = A.x, s[v + 1] = A.y, s[v + 2] = C.x, s[v + 3] = C.y, a[v + 4] = St(x), M && (a[v + 5] = St(b));
- else {
- F = St(x), N = St(b);
- for (var w = j, E = j + U; w < E; w += k) a[w + 4] = F, M && (a[w + 5] = N)
- }
- }, e.prototype.realTimeTraverse = function(t) {
- var e = void 0,
- i = void 0,
- n = yt._skeleton,
- r = n.color,
- s = yt._debugRenderer,
- o = yt._clipper,
- a = null,
- h = void 0,
- c = void 0,
- u = void 0,
- _ = void 0,
- f = void 0,
- d = void 0,
- x = void 0,
- b = void 0,
- A = void 0,
- C = void 0;
- w = yt._startSlotIndex, E = yt._endSlotIndex, K = !1, -1 == w && (K = !0), D = yt.debugSlots, B = yt.debugBones, I = yt.debugMesh, s && (B || D || I) && (s.clear(), s.lineWidth = 2), G = M ? 12 : 8, U = 0, j = 0, W = 0, H = 0, X = 0;
- for (var T = 0, S = n.drawOrder.length; T < S; T++)
- if (A = n.drawOrder[T], w >= 0 && w == A.data.index && (K = !0), K)
- if (E >= 0 && E == A.data.index && (K = !1), U = 0, H = 0, h = A.getAttachment())
- if (d = h instanceof l.RegionAttachment, x = h instanceof l.MeshAttachment, h instanceof l.ClippingAttachment) o.clipStart(A, h);
- else if (d || x)
- if (a = Ct(h.region.texture._texture, A.data.blendMode)) {
- if ((Q || a._hash !== gt.material._hash) && (Q = !1, gt._flush(), gt.node = xt, gt.material = a), d) {
- if (f = p, U = 4 * k, H = 6, b = vt.request(4, 6), X = b.indiceOffset, W = b.vertexOffset, j = b.byteOffset >> 2, e = vt._vData, i = vt._iData, h.computeWorldVertices(A.bone, e, j, k), s && D) {
- s.strokeColor = m, s.moveTo(e[j], e[j + 1]);
- for (var P = j + k, R = j + U; P < R; P += k) s.lineTo(e[P], e[P + 1]);
- s.close(), s.stroke()
- }
- } else if (x && (f = h.triangles, U = (h.worldVerticesLength >> 1) * k, H = f.length, b = vt.request(U / k, H), X = b.indiceOffset, W = b.vertexOffset, j = b.byteOffset >> 2, e = vt._vData, i = vt._iData, h.computeWorldVertices(A, 0, h.worldVerticesLength, e, j, k), s && I)) {
- s.strokeColor = g;
- for (var O = 0, L = f.length; O < L; O += 3) {
- var F = f[O] * k + j,
- N = f[O + 1] * k + j,
- V = f[O + 2] * k + j;
- s.moveTo(e[F], e[F + 1]), s.lineTo(e[N], e[N + 1]), s.lineTo(e[V], e[V + 1]), s.close(), s.stroke()
- }
- }
- if (0 != U && 0 != H) {
- i.set(f, X), _ = h.uvs;
- for (var z = j, Y = j + U, q = 0; z < Y; z += k, q += 2) e[z + 2] = _[q], e[z + 3] = _[q + 1];
- if (c = h.color, u = A.color, this.fillVertices(r, c, u, o, A), H > 0) {
- for (var J = X, Z = X + H; J < Z; J++) i[J] += W;
- if (t) {
- C = t.m, et = C[0], it = C[4], nt = C[12], rt = C[1], st = C[5], ot = C[13];
- for (var at = j, lt = j + U; at < lt; at += k) $ = e[at], tt = e[at + 1], e[at] = $ * et + tt * it + nt, e[at + 1] = $ * rt + tt * st + ot
- }
- vt.adjust(U / k, H)
- }
- o.clipEndWithSlot(A)
- } else o.clipEndWithSlot(A)
- } else o.clipEndWithSlot(A);
- else o.clipEndWithSlot(A);
- else o.clipEndWithSlot(A);
- else o.clipEndWithSlot(A);
- if (o.clipEnd(), s && B) {
- var ht = void 0;
- s.strokeColor = y, s.fillColor = m;
- for (var ct = 0, ut = n.bones.length; ct < ut; ct++) {
- var _t = (ht = n.bones[ct]).data.length * ht.a + ht.worldX,
- ft = ht.data.length * ht.c + ht.worldY;
- s.moveTo(ht.worldX, ht.worldY), s.lineTo(_t, ft), s.stroke(), s.circle(ht.worldX, ht.worldY, 1.5 * Math.PI), s.fill(), 0 === ct && (s.fillColor = v)
- }
- }
- }, e.prototype.cacheTraverse = function(t) {
- var e = yt._curFrame;
- if (e) {
- var i = e.segments;
- if (0 != i.length) {
- var n = void 0,
- r = void 0,
- s = void 0,
- o = void 0,
- a = void 0,
- l = e.vertices,
- h = e.indices,
- c = void 0,
- u = 0,
- _ = 0,
- f = 0;
- t && (c = t.m, et = c[0], rt = c[1], it = c[4], st = c[5], nt = c[12], ot = c[13]);
- var p = 16 & d,
- m = p && (1 === et && 0 === rt && 0 === it && 1 === st),
- y = 0,
- v = e.colors,
- g = v[y++],
- x = g.vfOffset;
- Tt(g);
- for (var b = 0, A = i.length; b < A; b++) {
- var C = i[b];
- if (o = Ct(C.tex, C.blendMode)) {
- (Q || o._hash !== gt.material._hash) && (Q = !1, gt._flush(), gt.node = xt, gt.material = o), z = C.vertexCount, H = C.indexCount, a = vt.request(z, H), X = a.indiceOffset, W = a.vertexOffset, Y = a.byteOffset >> 2, n = vt._vData, r = vt._iData, s = vt._uintVData;
- for (var T = X, S = X + H; T < S; T++) r[T] = W + h[_++];
- if (f = C.vfCount, n.set(l.subarray(u, u + f), Y), u += f, m)
- for (var w = Y, E = Y + f; w < E; w += 6) n[w] += nt, n[w + 1] += ot;
- else if (p)
- for (var M = Y, D = Y + f; M < D; M += 6) $ = n[M], tt = n[M + 1], n[M] = $ * et + tt * it + nt, n[M + 1] = $ * rt + tt * st + ot;
- if (vt.adjust(z, H), bt)
- for (var B = u - f, I = Y + 4, P = Y + 4 + f; I < P; I += 6, B += 6) B >= x && (Tt(g = v[y++]), x = g.vfOffset), s[I] = F, s[I + 1] = N
- }
- }
- }
- }
- }, e.prototype.fillBuffers = function(t, e) {
- var i = t.node;
- if (i._renderFlag |= h.FLAG_UPDATE_RENDER_DATA, t._skeleton) {
- var n = i._color;
- P = n.r / 255, R = n.g / 255, O = n.b / 255, L = n.a / 255, M = t.useTint || t.isAnimationCached(), V = M ? _ : u, k = M ? 6 : 5, xt = t.node, vt = e.getBuffer("spine", V), gt = e, yt = t, Q = !0, T = t.premultipliedAlpha, S = 1, d = 0, bt = !1, At = t._effectDelegate && t._effectDelegate._vertexEffect, (4294967295 !== n._val || T) && (bt = !0), M && (d |= 1);
- var r = void 0;
- yt.enableBatch && (r = xt._worldMatrix, Q = !1, d |= 16), t.isAnimationCached() ? this.cacheTraverse(r) : (At && At.begin(t._skeleton), this.realTimeTraverse(r), At && At.end()), xt = void 0, vt = void 0, gt = void 0, yt = void 0, At = null
- }
- }, e
- })(n.default);
- i.default = wt, n.default.register(a, wt), e.exports = i.default
- }), {
- "../../cocos2d/core/renderer/assembler": 227,
- "../../cocos2d/core/renderer/render-flow": 248,
- "../../cocos2d/core/renderer/webgl/vertex-format": 288,
- "./Skeleton": 412,
- "./lib/spine": 414
- }],
- 419: [(function(t, e, i) {
- "use strict";
- var n = function() {
- this.start = null, this.end = null, this.complete = null, this.event = null, this.interrupt = null, this.dispose = null
- };
- n.getListeners = function(t) {
- return t.listener || (t.listener = new n), t.listener
- }, e.exports = n
- }), {}],
- 420: [(function(t, e, i) {
- "use strict";
- var n = t("./lib/spine");
- sp.VertexEffectDelegate = cc.Class({
- name: "sp.VertexEffectDelegate",
- ctor: function() {
- this._vertexEffect = null, this._interpolation = null, this._effectType = "none"
- },
- clear: function() {
- this._vertexEffect = null, this._interpolation = null, this._effectType = "none"
- },
- initJitter: function(t, e) {
- return this._effectType = "jitter", this._vertexEffect = new n.JitterEffect(t, e), this._vertexEffect
- },
- initSwirlWithPow: function(t, e) {
- return this._interpolation = new n.Pow(e), this._vertexEffect = new n.SwirlEffect(t, this._interpolation), this._vertexEffect
- },
- initSwirlWithPowOut: function(t, e) {
- return this._interpolation = new n.PowOut(e), this._vertexEffect = new n.SwirlEffect(t, this._interpolation), this._vertexEffect
- },
- getJitterVertexEffect: function() {
- return this._vertexEffect
- },
- getSwirlVertexEffect: function() {
- return this._vertexEffect
- },
- getVertexEffect: function() {
- return this._vertexEffect
- },
- getEffectType: function() {
- return this._effectType
- }
- }), e.exports = sp.VertexEffectDelegate
- }), {
- "./lib/spine": 414
- }],
- 421: [(function(t, e, i) {
- "use strict";
- (function(t, n) {
- "object" == typeof i && void 0 !== e ? n(i) : "function" == typeof define && define.amd ? define(["exports"], n) : n(t.box2d = {})
- })(void 0, (function(t) {
- function e(t, e) {
- return void 0 !== t ? t : e
- }
- var i = 1e37,
- n = 1e-5,
- r = n * n,
- s = 3.14159265359,
- o = 2,
- a = 8,
- l = .008,
- h = 2 / 180 * s,
- c = 2 * l,
- u = -1;
- var _ = (function() {
- function t(t, e, i) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), this.major = 0, this.minor = 0, this.revision = 0, this.major = t, this.minor = e, this.revision = i
- }
- return t.prototype.toString = function() {
- return this.major + "." + this.minor + "." + this.revision
- }, t
- })(),
- f = new _(2, 3, 2);
- function d(t, e) {
- for (var i = [], n = 0; n < t; ++n) i.push(e(n));
- return i
- }
- function p(t, e) {
- void 0 === e && (e = 0);
- for (var i = [], n = 0; n < t; ++n) i.push(e);
- return i
- }
- var m = s / 180,
- y = 180 / s,
- v = Math.abs,
- g = Math.min,
- x = Math.max;
- function b(t, e, i) {
- return t < e ? e : t > i ? i : t
- }
- var A = isFinite;
- function C(t) {
- return t * t
- }
- function T(t) {
- return 1 / Math.sqrt(t)
- }
- var S = Math.sqrt,
- w = Math.pow;
- var E = Math.cos,
- M = Math.sin,
- D = Math.acos,
- B = Math.asin,
- I = Math.atan2;
- var P = (function() {
- function t(t, e) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
- }
- return t.prototype.Clone = function() {
- return new t(this.x, this.y)
- }, t.prototype.SetZero = function() {
- return this.x = 0, this.y = 0, this
- }, t.prototype.Set = function(t, e) {
- return this.x = t, this.y = e, this
- }, t.prototype.Copy = function(t) {
- return this.x = t.x, this.y = t.y, this
- }, t.prototype.SelfAdd = function(t) {
- return this.x += t.x, this.y += t.y, this
- }, t.prototype.SelfAddXY = function(t, e) {
- return this.x += t, this.y += e, this
- }, t.prototype.SelfSub = function(t) {
- return this.x -= t.x, this.y -= t.y, this
- }, t.prototype.SelfSubXY = function(t, e) {
- return this.x -= t, this.y -= e, this
- }, t.prototype.SelfMul = function(t) {
- return this.x *= t, this.y *= t, this
- }, t.prototype.SelfMulAdd = function(t, e) {
- return this.x += t * e.x, this.y += t * e.y, this
- }, t.prototype.SelfMulSub = function(t, e) {
- return this.x -= t * e.x, this.y -= t * e.y, this
- }, t.prototype.Dot = function(t) {
- return this.x * t.x + this.y * t.y
- }, t.prototype.Cross = function(t) {
- return this.x * t.y - this.y * t.x
- }, t.prototype.Length = function() {
- var t = this.x,
- e = this.y;
- return Math.sqrt(t * t + e * e)
- }, t.prototype.LengthSquared = function() {
- var t = this.x,
- e = this.y;
- return t * t + e * e
- }, t.prototype.Normalize = function() {
- var t = this.Length();
- if (t >= n) {
- var e = 1 / t;
- this.x *= e, this.y *= e
- }
- return t
- }, t.prototype.SelfNormalize = function() {
- var t = this.Length();
- if (t >= n) {
- var e = 1 / t;
- this.x *= e, this.y *= e
- }
- return this
- }, t.prototype.SelfRotate = function(t) {
- var e = Math.cos(t),
- i = Math.sin(t),
- n = this.x;
- return this.x = e * n - i * this.y, this.y = i * n + e * this.y, this
- }, t.prototype.IsValid = function() {
- return isFinite(this.x) && isFinite(this.y)
- }, t.prototype.SelfCrossVS = function(t) {
- var e = this.x;
- return this.x = t * this.y, this.y = -t * e, this
- }, t.prototype.SelfCrossSV = function(t) {
- var e = this.x;
- return this.x = -t * this.y, this.y = t * e, this
- }, t.prototype.SelfMinV = function(t) {
- return this.x = g(this.x, t.x), this.y = g(this.y, t.y), this
- }, t.prototype.SelfMaxV = function(t) {
- return this.x = x(this.x, t.x), this.y = x(this.y, t.y), this
- }, t.prototype.SelfAbs = function() {
- return this.x = v(this.x), this.y = v(this.y), this
- }, t.prototype.SelfNeg = function() {
- return this.x = -this.x, this.y = -this.y, this
- }, t.prototype.SelfSkew = function() {
- var t = this.x;
- return this.x = -this.y, this.y = t, this
- }, t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t.AbsV = function(t, e) {
- return e.x = v(t.x), e.y = v(t.y), e
- }, t.MinV = function(t, e, i) {
- return i.x = g(t.x, e.x), i.y = g(t.y, e.y), i
- }, t.MaxV = function(t, e, i) {
- return i.x = x(t.x, e.x), i.y = x(t.y, e.y), i
- }, t.ClampV = function(t, e, i, n) {
- return n.x = b(t.x, e.x, i.x), n.y = b(t.y, e.y, i.y), n
- }, t.RotateV = function(t, e, i) {
- var n = t.x,
- r = t.y,
- s = Math.cos(e),
- o = Math.sin(e);
- return i.x = s * n - o * r, i.y = o * n + s * r, i
- }, t.DotVV = function(t, e) {
- return t.x * e.x + t.y * e.y
- }, t.CrossVV = function(t, e) {
- return t.x * e.y - t.y * e.x
- }, t.CrossVS = function(t, e, i) {
- var n = t.x;
- return i.x = e * t.y, i.y = -e * n, i
- }, t.CrossVOne = function(t, e) {
- var i = t.x;
- return e.x = t.y, e.y = -i, e
- }, t.CrossSV = function(t, e, i) {
- var n = e.x;
- return i.x = -t * e.y, i.y = t * n, i
- }, t.CrossOneV = function(t, e) {
- var i = t.x;
- return e.x = -t.y, e.y = i, e
- }, t.AddVV = function(t, e, i) {
- return i.x = t.x + e.x, i.y = t.y + e.y, i
- }, t.SubVV = function(t, e, i) {
- return i.x = t.x - e.x, i.y = t.y - e.y, i
- }, t.MulSV = function(t, e, i) {
- return i.x = e.x * t, i.y = e.y * t, i
- }, t.MulVS = function(t, e, i) {
- return i.x = t.x * e, i.y = t.y * e, i
- }, t.AddVMulSV = function(t, e, i, n) {
- return n.x = t.x + e * i.x, n.y = t.y + e * i.y, n
- }, t.SubVMulSV = function(t, e, i, n) {
- return n.x = t.x - e * i.x, n.y = t.y - e * i.y, n
- }, t.AddVCrossSV = function(t, e, i, n) {
- var r = i.x;
- return n.x = t.x - e * i.y, n.y = t.y + e * r, n
- }, t.MidVV = function(t, e, i) {
- return i.x = .5 * (t.x + e.x), i.y = .5 * (t.y + e.y), i
- }, t.ExtVV = function(t, e, i) {
- return i.x = .5 * (e.x - t.x), i.y = .5 * (e.y - t.y), i
- }, t.IsEqualToV = function(t, e) {
- return t.x === e.x && t.y === e.y
- }, t.DistanceVV = function(t, e) {
- var i = t.x - e.x,
- n = t.y - e.y;
- return Math.sqrt(i * i + n * n)
- }, t.DistanceSquaredVV = function(t, e) {
- var i = t.x - e.x,
- n = t.y - e.y;
- return i * i + n * n
- }, t.NegV = function(t, e) {
- return e.x = -t.x, e.y = -t.y, e
- }, t.ZERO = new t(0, 0), t.UNITX = new t(1, 0), t.UNITY = new t(0, 1), t.s_t0 = new t, t.s_t1 = new t, t.s_t2 = new t, t.s_t3 = new t, t
- })(),
- R = new P(0, 0),
- O = (function() {
- function t(t, e, i) {
- void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), this.x = t, this.y = e, this.z = i
- }
- return t.prototype.Clone = function() {
- return new t(this.x, this.y, this.z)
- }, t.prototype.SetZero = function() {
- return this.x = 0, this.y = 0, this.z = 0, this
- }, t.prototype.SetXYZ = function(t, e, i) {
- return this.x = t, this.y = e, this.z = i, this
- }, t.prototype.Copy = function(t) {
- return this.x = t.x, this.y = t.y, this.z = t.z, this
- }, t.prototype.SelfNeg = function() {
- return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
- }, t.prototype.SelfAdd = function(t) {
- return this.x += t.x, this.y += t.y, this.z += t.z, this
- }, t.prototype.SelfAddXYZ = function(t, e, i) {
- return this.x += t, this.y += e, this.z += i, this
- }, t.prototype.SelfSub = function(t) {
- return this.x -= t.x, this.y -= t.y, this.z -= t.z, this
- }, t.prototype.SelfSubXYZ = function(t, e, i) {
- return this.x -= t, this.y -= e, this.z -= i, this
- }, t.prototype.SelfMul = function(t) {
- return this.x *= t, this.y *= t, this.z *= t, this
- }, t.DotV3V3 = function(t, e) {
- return t.x * e.x + t.y * e.y + t.z * e.z
- }, t.CrossV3V3 = function(t, e, i) {
- var n = t.x,
- r = t.y,
- s = t.z,
- o = e.x,
- a = e.y,
- l = e.z;
- return i.x = r * l - s * a, i.y = s * o - n * l, i.z = n * a - r * o, i
- }, t.ZERO = new t(0, 0, 0), t.s_t0 = new t, t
- })(),
- L = (function() {
- function t() {
- this.ex = new P(1, 0), this.ey = new P(0, 1)
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.FromVV = function(e, i) {
- return (new t).SetVV(e, i)
- }, t.FromSSSS = function(e, i, n, r) {
- return (new t).SetSSSS(e, i, n, r)
- }, t.FromAngle = function(e) {
- return (new t).SetAngle(e)
- }, t.prototype.SetSSSS = function(t, e, i, n) {
- return this.ex.Set(t, i), this.ey.Set(e, n), this
- }, t.prototype.SetVV = function(t, e) {
- return this.ex.Copy(t), this.ey.Copy(e), this
- }, t.prototype.SetAngle = function(t) {
- var e = Math.cos(t),
- i = Math.sin(t);
- return this.ex.Set(e, i), this.ey.Set(-i, e), this
- }, t.prototype.Copy = function(t) {
- return this.ex.Copy(t.ex), this.ey.Copy(t.ey), this
- }, t.prototype.SetIdentity = function() {
- return this.ex.Set(1, 0), this.ey.Set(0, 1), this
- }, t.prototype.SetZero = function() {
- return this.ex.SetZero(), this.ey.SetZero(), this
- }, t.prototype.GetAngle = function() {
- return Math.atan2(this.ex.y, this.ex.x)
- }, t.prototype.GetInverse = function(t) {
- var e = this.ex.x,
- i = this.ey.x,
- n = this.ex.y,
- r = this.ey.y,
- s = e * r - i * n;
- return 0 !== s && (s = 1 / s), t.ex.x = s * r, t.ey.x = -s * i, t.ex.y = -s * n, t.ey.y = s * e, t
- }, t.prototype.Solve = function(t, e, i) {
- var n = this.ex.x,
- r = this.ey.x,
- s = this.ex.y,
- o = this.ey.y,
- a = n * o - r * s;
- return 0 !== a && (a = 1 / a), i.x = a * (o * t - r * e), i.y = a * (n * e - s * t), i
- }, t.prototype.SelfAbs = function() {
- return this.ex.SelfAbs(), this.ey.SelfAbs(), this
- }, t.prototype.SelfInv = function() {
- return this.GetInverse(this), this
- }, t.prototype.SelfAddM = function(t) {
- return this.ex.SelfAdd(t.ex), this.ey.SelfAdd(t.ey), this
- }, t.prototype.SelfSubM = function(t) {
- return this.ex.SelfSub(t.ex), this.ey.SelfSub(t.ey), this
- }, t.AbsM = function(t, e) {
- var i = t.ex,
- n = t.ey;
- return e.ex.x = v(i.x), e.ex.y = v(i.y), e.ey.x = v(n.x), e.ey.y = v(n.y), e
- }, t.MulMV = function(t, e, i) {
- var n = t.ex,
- r = t.ey,
- s = e.x,
- o = e.y;
- return i.x = n.x * s + r.x * o, i.y = n.y * s + r.y * o, i
- }, t.MulTMV = function(t, e, i) {
- var n = t.ex,
- r = t.ey,
- s = e.x,
- o = e.y;
- return i.x = n.x * s + n.y * o, i.y = r.x * s + r.y * o, i
- }, t.AddMM = function(t, e, i) {
- var n = t.ex,
- r = t.ey,
- s = e.ex,
- o = e.ey;
- return i.ex.x = n.x + s.x, i.ex.y = n.y + s.y, i.ey.x = r.x + o.x, i.ey.y = r.y + o.y, i
- }, t.MulMM = function(t, e, i) {
- var n = t.ex.x,
- r = t.ex.y,
- s = t.ey.x,
- o = t.ey.y,
- a = e.ex.x,
- l = e.ex.y,
- h = e.ey.x,
- c = e.ey.y;
- return i.ex.x = n * a + s * l, i.ex.y = r * a + o * l, i.ey.x = n * h + s * c, i.ey.y = r * h + o * c, i
- }, t.MulTMM = function(t, e, i) {
- var n = t.ex.x,
- r = t.ex.y,
- s = t.ey.x,
- o = t.ey.y,
- a = e.ex.x,
- l = e.ex.y,
- h = e.ey.x,
- c = e.ey.y;
- return i.ex.x = n * a + r * l, i.ex.y = s * a + o * l, i.ey.x = n * h + r * c, i.ey.y = s * h + o * c, i
- }, t.IDENTITY = new t, t
- })(),
- F = (function() {
- function t() {
- this.ex = new O(1, 0, 0), this.ey = new O(0, 1, 0), this.ez = new O(0, 0, 1)
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.SetVVV = function(t, e, i) {
- return this.ex.Copy(t), this.ey.Copy(e), this.ez.Copy(i), this
- }, t.prototype.Copy = function(t) {
- return this.ex.Copy(t.ex), this.ey.Copy(t.ey), this.ez.Copy(t.ez), this
- }, t.prototype.SetIdentity = function() {
- return this.ex.SetXYZ(1, 0, 0), this.ey.SetXYZ(0, 1, 0), this.ez.SetXYZ(0, 0, 1), this
- }, t.prototype.SetZero = function() {
- return this.ex.SetZero(), this.ey.SetZero(), this.ez.SetZero(), this
- }, t.prototype.SelfAddM = function(t) {
- return this.ex.SelfAdd(t.ex), this.ey.SelfAdd(t.ey), this.ez.SelfAdd(t.ez), this
- }, t.prototype.Solve33 = function(t, e, i, n) {
- var r = this.ex.x,
- s = this.ex.y,
- o = this.ex.z,
- a = this.ey.x,
- l = this.ey.y,
- h = this.ey.z,
- c = this.ez.x,
- u = this.ez.y,
- _ = this.ez.z,
- f = r * (l * _ - h * u) + s * (h * c - a * _) + o * (a * u - l * c);
- return 0 !== f && (f = 1 / f), n.x = f * (t * (l * _ - h * u) + e * (h * c - a * _) + i * (a * u - l * c)), n.y = f * (r * (e * _ - i * u) + s * (i * c - t * _) + o * (t * u - e * c)), n.z = f * (r * (l * i - h * e) + s * (h * t - a * i) + o * (a * e - l * t)), n
- }, t.prototype.Solve22 = function(t, e, i) {
- var n = this.ex.x,
- r = this.ey.x,
- s = this.ex.y,
- o = this.ey.y,
- a = n * o - r * s;
- return 0 !== a && (a = 1 / a), i.x = a * (o * t - r * e), i.y = a * (n * e - s * t), i
- }, t.prototype.GetInverse22 = function(t) {
- var e = this.ex.x,
- i = this.ey.x,
- n = this.ex.y,
- r = this.ey.y,
- s = e * r - i * n;
- 0 !== s && (s = 1 / s), t.ex.x = s * r, t.ey.x = -s * i, t.ex.z = 0, t.ex.y = -s * n, t.ey.y = s * e, t.ey.z = 0, t.ez.x = 0, t.ez.y = 0, t.ez.z = 0
- }, t.prototype.GetSymInverse33 = function(t) {
- var e = O.DotV3V3(this.ex, O.CrossV3V3(this.ey, this.ez, O.s_t0));
- 0 !== e && (e = 1 / e);
- var i = this.ex.x,
- n = this.ey.x,
- r = this.ez.x,
- s = this.ey.y,
- o = this.ez.y,
- a = this.ez.z;
- t.ex.x = e * (s * a - o * o), t.ex.y = e * (r * o - n * a), t.ex.z = e * (n * o - r * s), t.ey.x = t.ex.y, t.ey.y = e * (i * a - r * r), t.ey.z = e * (r * n - i * o), t.ez.x = t.ex.z, t.ez.y = t.ey.z, t.ez.z = e * (i * s - n * n)
- }, t.MulM33V3 = function(t, e, i) {
- var n = e.x,
- r = e.y,
- s = e.z;
- return i.x = t.ex.x * n + t.ey.x * r + t.ez.x * s, i.y = t.ex.y * n + t.ey.y * r + t.ez.y * s, i.z = t.ex.z * n + t.ey.z * r + t.ez.z * s, i
- }, t.MulM33XYZ = function(t, e, i, n, r) {
- return r.x = t.ex.x * e + t.ey.x * i + t.ez.x * n, r.y = t.ex.y * e + t.ey.y * i + t.ez.y * n, r.z = t.ex.z * e + t.ey.z * i + t.ez.z * n, r
- }, t.MulM33V2 = function(t, e, i) {
- var n = e.x,
- r = e.y;
- return i.x = t.ex.x * n + t.ey.x * r, i.y = t.ex.y * n + t.ey.y * r, i
- }, t.MulM33XY = function(t, e, i, n) {
- return n.x = t.ex.x * e + t.ey.x * i, n.y = t.ex.y * e + t.ey.y * i, n
- }, t.IDENTITY = new t, t
- })(),
- N = (function() {
- function t(t) {
- void 0 === t && (t = 0), this.s = 0, this.c = 1, t && (this.s = Math.sin(t), this.c = Math.cos(t))
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.Copy = function(t) {
- return this.s = t.s, this.c = t.c, this
- }, t.prototype.SetAngle = function(t) {
- return this.s = Math.sin(t), this.c = Math.cos(t), this
- }, t.prototype.SetIdentity = function() {
- return this.s = 0, this.c = 1, this
- }, t.prototype.GetAngle = function() {
- return Math.atan2(this.s, this.c)
- }, t.prototype.GetXAxis = function(t) {
- return t.x = this.c, t.y = this.s, t
- }, t.prototype.GetYAxis = function(t) {
- return t.x = -this.s, t.y = this.c, t
- }, t.MulRR = function(t, e, i) {
- var n = t.c,
- r = t.s,
- s = e.c,
- o = e.s;
- return i.s = r * s + n * o, i.c = n * s - r * o, i
- }, t.MulTRR = function(t, e, i) {
- var n = t.c,
- r = t.s,
- s = e.c,
- o = e.s;
- return i.s = n * o - r * s, i.c = n * s + r * o, i
- }, t.MulRV = function(t, e, i) {
- var n = t.c,
- r = t.s,
- s = e.x,
- o = e.y;
- return i.x = n * s - r * o, i.y = r * s + n * o, i
- }, t.MulTRV = function(t, e, i) {
- var n = t.c,
- r = t.s,
- s = e.x,
- o = e.y;
- return i.x = n * s + r * o, i.y = -r * s + n * o, i
- }, t.IDENTITY = new t, t
- })(),
- V = (function() {
- function t() {
- this.p = new P, this.q = new N
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.Copy = function(t) {
- return this.p.Copy(t.p), this.q.Copy(t.q), this
- }, t.prototype.SetIdentity = function() {
- return this.p.SetZero(), this.q.SetIdentity(), this
- }, t.prototype.SetPositionRotation = function(t, e) {
- return this.p.Copy(t), this.q.Copy(e), this
- }, t.prototype.SetPositionAngle = function(t, e) {
- return this.p.Copy(t), this.q.SetAngle(e), this
- }, t.prototype.SetPosition = function(t) {
- return this.p.Copy(t), this
- }, t.prototype.SetPositionXY = function(t, e) {
- return this.p.Set(t, e), this
- }, t.prototype.SetRotation = function(t) {
- return this.q.Copy(t), this
- }, t.prototype.SetRotationAngle = function(t) {
- return this.q.SetAngle(t), this
- }, t.prototype.GetPosition = function() {
- return this.p
- }, t.prototype.GetRotation = function() {
- return this.q
- }, t.prototype.GetRotationAngle = function() {
- return this.q.GetAngle()
- }, t.prototype.GetAngle = function() {
- return this.q.GetAngle()
- }, t.MulXV = function(t, e, i) {
- var n = t.q.c,
- r = t.q.s,
- s = e.x,
- o = e.y;
- return i.x = n * s - r * o + t.p.x, i.y = r * s + n * o + t.p.y, i
- }, t.MulTXV = function(t, e, i) {
- var n = t.q.c,
- r = t.q.s,
- s = e.x - t.p.x,
- o = e.y - t.p.y;
- return i.x = n * s + r * o, i.y = -r * s + n * o, i
- }, t.MulXX = function(t, e, i) {
- return N.MulRR(t.q, e.q, i.q), P.AddVV(N.MulRV(t.q, e.p, i.p), t.p, i.p), i
- }, t.MulTXX = function(t, e, i) {
- return N.MulTRR(t.q, e.q, i.q), N.MulTRV(t.q, P.SubVV(e.p, t.p, i.p), i.p), i
- }, t.IDENTITY = new t, t
- })(),
- k = (function() {
- function t() {
- this.localCenter = new P, this.c0 = new P, this.c = new P, this.a0 = 0, this.a = 0, this.alpha0 = 0
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.Copy = function(t) {
- return this.localCenter.Copy(t.localCenter), this.c0.Copy(t.c0), this.c.Copy(t.c), this.a0 = t.a0, this.a = t.a, this.alpha0 = t.alpha0, this
- }, t.prototype.GetTransform = function(t, e) {
- var i = 1 - e;
- t.p.x = i * this.c0.x + e * this.c.x, t.p.y = i * this.c0.y + e * this.c.y;
- var n = i * this.a0 + e * this.a;
- return t.q.SetAngle(n), t.p.SelfSub(N.MulRV(t.q, this.localCenter, P.s_t0)), t
- }, t.prototype.Advance = function(t) {
- var e = (t - this.alpha0) / (1 - this.alpha0),
- i = 1 - e;
- this.c0.x = i * this.c0.x + e * this.c.x, this.c0.y = i * this.c0.y + e * this.c.y, this.a0 = i * this.a0 + e * this.a, this.alpha0 = t
- }, t.prototype.Normalize = function() {
- var t = 6.28318530718 * Math.floor(this.a0 / 6.28318530718);
- this.a0 -= t, this.a -= t
- }, t
- })(),
- G = (function() {
- function t(t, e, i, n) {
- void 0 === t && (t = .5), void 0 === e && (e = .5), void 0 === i && (i = .5), void 0 === n && (n = 1), this.r = t, this.g = e, this.b = i, this.a = n
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.Copy = function(t) {
- return this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this
- }, t.prototype.IsEqual = function(t) {
- return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a
- }, t.prototype.IsZero = function() {
- return 0 === this.r && 0 === this.g && 0 === this.b && 0 === this.a
- }, t.prototype.Set = function(t, e, i, n) {
- void 0 === n && (n = this.a), this.SetRGBA(t, e, i, n)
- }, t.prototype.SetByteRGB = function(t, e, i) {
- return this.r = t / 255, this.g = e / 255, this.b = i / 255, this
- }, t.prototype.SetByteRGBA = function(t, e, i, n) {
- return this.r = t / 255, this.g = e / 255, this.b = i / 255, this.a = n / 255, this
- }, t.prototype.SetRGB = function(t, e, i) {
- return this.r = t, this.g = e, this.b = i, this
- }, t.prototype.SetRGBA = function(t, e, i, n) {
- return this.r = t, this.g = e, this.b = i, this.a = n, this
- }, t.prototype.SelfAdd = function(t) {
- return this.r += t.r, this.g += t.g, this.b += t.b, this.a += t.a, this
- }, t.prototype.Add = function(t, e) {
- return e.r = this.r + t.r, e.g = this.g + t.g, e.b = this.b + t.b, e.a = this.a + t.a, e
- }, t.prototype.SelfSub = function(t) {
- return this.r -= t.r, this.g -= t.g, this.b -= t.b, this.a -= t.a, this
- }, t.prototype.Sub = function(t, e) {
- return e.r = this.r - t.r, e.g = this.g - t.g, e.b = this.b - t.b, e.a = this.a - t.a, e
- }, t.prototype.SelfMul = function(t) {
- return this.r *= t, this.g *= t, this.b *= t, this.a *= t, this
- }, t.prototype.Mul = function(t, e) {
- return e.r = this.r * t, e.g = this.g * t, e.b = this.b * t, e.a = this.a * t, e
- }, t.prototype.Mix = function(e, i) {
- t.MixColors(this, e, i)
- }, t.MixColors = function(t, e, i) {
- var n = i * (e.r - t.r),
- r = i * (e.g - t.g),
- s = i * (e.b - t.b),
- o = i * (e.a - t.a);
- t.r += n, t.g += r, t.b += s, t.a += o, e.r -= n, e.g -= r, e.b -= s, e.a -= o
- }, t.prototype.MakeStyleString = function(e) {
- return void 0 === e && (e = this.a), t.MakeStyleString(this.r, this.g, this.b, e)
- }, t.MakeStyleString = function(t, e, i, n) {
- return void 0 === n && (n = 1), t *= 255, e *= 255, i *= 255, n < 1 ? "rgba(" + t + "," + e + "," + i + "," + n + ")" : "rgb(" + t + "," + e + "," + i + ")"
- }, t.ZERO = new t(0, 0, 0, 0), t.RED = new t(1, 0, 0), t.GREEN = new t(0, 1, 0), t.BLUE = new t(0, 0, 1), t
- })();
- (function(t) {
- t[t.e_none = 0] = "e_none", t[t.e_shapeBit = 1] = "e_shapeBit", t[t.e_jointBit = 2] = "e_jointBit", t[t.e_aabbBit = 4] = "e_aabbBit", t[t.e_pairBit = 8] = "e_pairBit", t[t.e_centerOfMassBit = 16] = "e_centerOfMassBit", t[t.e_particleBit = 32] = "e_particleBit", t[t.e_controllerBit = 64] = "e_controllerBit", t[t.e_all = 63] = "e_all"
- })(t.b2DrawFlags || (t.b2DrawFlags = {}));
- var U = (function() {
- function t() {
- this.m_drawFlags = 0
- }
- return t.prototype.SetFlags = function(t) {
- this.m_drawFlags = t
- }, t.prototype.GetFlags = function() {
- return this.m_drawFlags
- }, t.prototype.AppendFlags = function(t) {
- this.m_drawFlags |= t
- }, t.prototype.ClearFlags = function(t) {
- this.m_drawFlags &= ~t
- }, t
- })(),
- z = (function() {
- function t() {
- this.m_start = Date.now()
- }
- return t.prototype.Reset = function() {
- return this.m_start = Date.now(), this
- }, t.prototype.GetMilliseconds = function() {
- return Date.now() - this.m_start
- }, t
- })(),
- j = (function() {
- function t() {
- this.m_count = 0, this.m_min_count = 0, this.m_max_count = 0
- }
- return t.prototype.GetCount = function() {
- return this.m_count
- }, t.prototype.GetMinCount = function() {
- return this.m_min_count
- }, t.prototype.GetMaxCount = function() {
- return this.m_max_count
- }, t.prototype.ResetCount = function() {
- var t = this.m_count;
- return this.m_count = 0, t
- }, t.prototype.ResetMinCount = function() {
- this.m_min_count = 0
- }, t.prototype.ResetMaxCount = function() {
- this.m_max_count = 0
- }, t.prototype.Increment = function() {
- this.m_count++, this.m_max_count < this.m_count && (this.m_max_count = this.m_count)
- }, t.prototype.Decrement = function() {
- this.m_count--, this.m_min_count > this.m_count && (this.m_min_count = this.m_count)
- }, t
- })(),
- W = (function() {
- function t(t) {
- this.m_stack = [], this.m_count = 0, this.m_stack = d(t, (function(t) {
- return null
- })), this.m_count = 0
- }
- return t.prototype.Reset = function() {
- return this.m_count = 0, this
- }, t.prototype.Push = function(t) {
- this.m_stack[this.m_count] = t, this.m_count++
- }, t.prototype.Pop = function() {
- this.m_count--;
- var t = this.m_stack[this.m_count];
- if (this.m_stack[this.m_count] = null, null === t) throw new Error;
- return t
- }, t.prototype.GetCount = function() {
- return this.m_count
- }, t
- })(),
- H = (function() {
- return function() {}
- })(),
- X = (function() {
- return function() {}
- })(),
- Y = (function() {
- function t() {
- this.m_buffer = P.MakeArray(2), this.m_vertices = this.m_buffer, this.m_count = 0, this.m_radius = 0
- }
- return t.prototype.Copy = function(t) {
- return t.m_vertices === t.m_buffer ? (this.m_vertices = this.m_buffer, this.m_buffer[0].Copy(t.m_buffer[0]), this.m_buffer[1].Copy(t.m_buffer[1])) : this.m_vertices = t.m_vertices, this.m_count = t.m_count, this.m_radius = t.m_radius, this
- }, t.prototype.Reset = function() {
- return this.m_vertices = this.m_buffer, this.m_count = 0, this.m_radius = 0, this
- }, t.prototype.SetShape = function(t, e) {
- t.SetupDistanceProxy(this, e)
- }, t.prototype.SetVerticesRadius = function(t, e, i) {
- this.m_vertices = t, this.m_count = e, this.m_radius = i
- }, t.prototype.GetSupport = function(t) {
- for (var e = 0, i = P.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
- var r = P.DotVV(this.m_vertices[n], t);
- r > i && (e = n, i = r)
- }
- return e
- }, t.prototype.GetSupportVertex = function(t) {
- for (var e = 0, i = P.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
- var r = P.DotVV(this.m_vertices[n], t);
- r > i && (e = n, i = r)
- }
- return this.m_vertices[e]
- }, t.prototype.GetVertexCount = function() {
- return this.m_count
- }, t.prototype.GetVertex = function(t) {
- return this.m_vertices[t]
- }, t
- })(),
- q = (function() {
- function t() {
- this.metric = 0, this.count = 0, this.indexA = [0, 0, 0], this.indexB = [0, 0, 0]
- }
- return t.prototype.Reset = function() {
- return this.metric = 0, this.count = 0, this
- }, t
- })(),
- J = (function() {
- function t() {
- this.proxyA = new Y, this.proxyB = new Y, this.transformA = new V, this.transformB = new V, this.useRadii = !1
- }
- return t.prototype.Reset = function() {
- return this.proxyA.Reset(), this.proxyB.Reset(), this.transformA.SetIdentity(), this.transformB.SetIdentity(), this.useRadii = !1, this
- }, t
- })(),
- Z = (function() {
- function t() {
- this.pointA = new P, this.pointB = new P, this.distance = 0, this.iterations = 0
- }
- return t.prototype.Reset = function() {
- return this.pointA.SetZero(), this.pointB.SetZero(), this.distance = 0, this.iterations = 0, this
- }, t
- })(),
- K = (function() {
- return function() {
- this.proxyA = new Y, this.proxyB = new Y, this.transformA = new V, this.transformB = new V, this.translationB = new P
- }
- })(),
- Q = (function() {
- return function() {
- this.point = new P, this.normal = new P, this.lambda = 0, this.iterations = 0
- }
- })();
- t.b2_gjkCalls = 0, t.b2_gjkIters = 0, t.b2_gjkMaxIters = 0;
- var $ = (function() {
- function t() {
- this.wA = new P, this.wB = new P, this.w = new P, this.a = 0, this.indexA = 0, this.indexB = 0
- }
- return t.prototype.Copy = function(t) {
- return this.wA.Copy(t.wA), this.wB.Copy(t.wB), this.w.Copy(t.w), this.a = t.a, this.indexA = t.indexA, this.indexB = t.indexB, this
- }, t
- })(),
- tt = (function() {
- function t() {
- this.m_v1 = new $, this.m_v2 = new $, this.m_v3 = new $, this.m_vertices = [], this.m_count = 0, this.m_vertices[0] = this.m_v1, this.m_vertices[1] = this.m_v2, this.m_vertices[2] = this.m_v3
- }
- return t.prototype.ReadCache = function(t, e, i, r, s) {
- this.m_count = t.count;
- for (var o = this.m_vertices, a = 0; a < this.m_count; ++a) {
- (_ = o[a]).indexA = t.indexA[a], _.indexB = t.indexB[a];
- var l = e.GetVertex(_.indexA),
- h = r.GetVertex(_.indexB);
- V.MulXV(i, l, _.wA), V.MulXV(s, h, _.wB), P.SubVV(_.wB, _.wA, _.w), _.a = 0
- }
- if (this.m_count > 1) {
- var c = t.metric,
- u = this.GetMetric();
- (u < .5 * c || 2 * c < u || u < n) && (this.m_count = 0)
- }
- if (0 === this.m_count) {
- var _;
- (_ = o[0]).indexA = 0, _.indexB = 0;
- l = e.GetVertex(0), h = r.GetVertex(0);
- V.MulXV(i, l, _.wA), V.MulXV(s, h, _.wB), P.SubVV(_.wB, _.wA, _.w), _.a = 1, this.m_count = 1
- }
- }, t.prototype.WriteCache = function(t) {
- t.metric = this.GetMetric(), t.count = this.m_count;
- for (var e = this.m_vertices, i = 0; i < this.m_count; ++i) t.indexA[i] = e[i].indexA, t.indexB[i] = e[i].indexB
- }, t.prototype.GetSearchDirection = function(t) {
- switch (this.m_count) {
- case 1:
- return P.NegV(this.m_v1.w, t);
- case 2:
- var e = P.SubVV(this.m_v2.w, this.m_v1.w, t);
- return P.CrossVV(e, P.NegV(this.m_v1.w, P.s_t0)) > 0 ? P.CrossOneV(e, t) : P.CrossVOne(e, t);
- default:
- return t.SetZero()
- }
- }, t.prototype.GetClosestPoint = function(t) {
- switch (this.m_count) {
- case 0:
- return t.SetZero();
- case 1:
- return t.Copy(this.m_v1.w);
- case 2:
- return t.Set(this.m_v1.a * this.m_v1.w.x + this.m_v2.a * this.m_v2.w.x, this.m_v1.a * this.m_v1.w.y + this.m_v2.a * this.m_v2.w.y);
- case 3:
- default:
- return t.SetZero()
- }
- }, t.prototype.GetWitnessPoints = function(t, e) {
- switch (this.m_count) {
- case 0:
- break;
- case 1:
- t.Copy(this.m_v1.wA), e.Copy(this.m_v1.wB);
- break;
- case 2:
- t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x, t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y, e.x = this.m_v1.a * this.m_v1.wB.x + this.m_v2.a * this.m_v2.wB.x, e.y = this.m_v1.a * this.m_v1.wB.y + this.m_v2.a * this.m_v2.wB.y;
- break;
- case 3:
- e.x = t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x + this.m_v3.a * this.m_v3.wA.x, e.y = t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y + this.m_v3.a * this.m_v3.wA.y
- }
- }, t.prototype.GetMetric = function() {
- switch (this.m_count) {
- case 0:
- case 1:
- return 0;
- case 2:
- return P.DistanceVV(this.m_v1.w, this.m_v2.w);
- case 3:
- return P.CrossVV(P.SubVV(this.m_v2.w, this.m_v1.w, P.s_t0), P.SubVV(this.m_v3.w, this.m_v1.w, P.s_t1));
- default:
- return 0
- }
- }, t.prototype.Solve2 = function() {
- var e = this.m_v1.w,
- i = this.m_v2.w,
- n = P.SubVV(i, e, t.s_e12),
- r = -P.DotVV(e, n);
- if (r <= 0) return this.m_v1.a = 1, void(this.m_count = 1);
- var s = P.DotVV(i, n);
- if (s <= 0) return this.m_v2.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v2);
- var o = 1 / (s + r);
- this.m_v1.a = s * o, this.m_v2.a = r * o, this.m_count = 2
- }, t.prototype.Solve3 = function() {
- var e = this.m_v1.w,
- i = this.m_v2.w,
- n = this.m_v3.w,
- r = P.SubVV(i, e, t.s_e12),
- s = P.DotVV(e, r),
- o = P.DotVV(i, r),
- a = -s,
- l = P.SubVV(n, e, t.s_e13),
- h = P.DotVV(e, l),
- c = P.DotVV(n, l),
- u = -h,
- _ = P.SubVV(n, i, t.s_e23),
- f = P.DotVV(i, _),
- d = P.DotVV(n, _),
- p = -f,
- m = P.CrossVV(r, l),
- y = m * P.CrossVV(i, n),
- v = m * P.CrossVV(n, e),
- g = m * P.CrossVV(e, i);
- if (a <= 0 && u <= 0) return this.m_v1.a = 1, void(this.m_count = 1);
- if (o > 0 && a > 0 && g <= 0) {
- var x = 1 / (o + a);
- return this.m_v1.a = o * x, this.m_v2.a = a * x, void(this.m_count = 2)
- }
- if (c > 0 && u > 0 && v <= 0) {
- var b = 1 / (c + u);
- return this.m_v1.a = c * b, this.m_v3.a = u * b, this.m_count = 2, void this.m_v2.Copy(this.m_v3)
- }
- if (o <= 0 && p <= 0) return this.m_v2.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v2);
- if (c <= 0 && d <= 0) return this.m_v3.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v3);
- if (d > 0 && p > 0 && y <= 0) {
- var A = 1 / (d + p);
- return this.m_v2.a = d * A, this.m_v3.a = p * A, this.m_count = 2, void this.m_v1.Copy(this.m_v3)
- }
- var C = 1 / (y + v + g);
- this.m_v1.a = y * C, this.m_v2.a = v * C, this.m_v3.a = g * C, this.m_count = 3
- }, t.s_e12 = new P, t.s_e13 = new P, t.s_e23 = new P, t
- })(),
- et = new tt,
- it = [0, 0, 0],
- nt = [0, 0, 0],
- rt = new P,
- st = new P,
- ot = new P,
- at = new P,
- lt = new P;
- function ht(e, i, s) {
- ++t.b2_gjkCalls;
- var o = s.proxyA,
- a = s.proxyB,
- l = s.transformA,
- h = s.transformB,
- c = et;
- c.ReadCache(i, o, l, a, h);
- for (var u = c.m_vertices, _ = it, f = nt, d = 0, p = 0; p < 20;) {
- d = c.m_count;
- for (var m = 0; m < d; ++m) _[m] = u[m].indexA, f[m] = u[m].indexB;
- switch (c.m_count) {
- case 1:
- break;
- case 2:
- c.Solve2();
- break;
- case 3:
- c.Solve3()
- }
- if (3 === c.m_count) break;
- var y = c.GetSearchDirection(st);
- if (y.LengthSquared() < r) break;
- var v = u[c.m_count];
- v.indexA = o.GetSupport(N.MulTRV(l.q, P.NegV(y, P.s_t0), at)), V.MulXV(l, o.GetVertex(v.indexA), v.wA), v.indexB = a.GetSupport(N.MulTRV(h.q, y, lt)), V.MulXV(h, a.GetVertex(v.indexB), v.wB), P.SubVV(v.wB, v.wA, v.w), ++p, ++t.b2_gjkIters;
- var g = !1;
- for (m = 0; m < d; ++m)
- if (v.indexA === _[m] && v.indexB === f[m]) {
- g = !0;
- break
- }
- if (g) break;
- ++c.m_count
- }
- if (t.b2_gjkMaxIters = x(t.b2_gjkMaxIters, p), c.GetWitnessPoints(e.pointA, e.pointB), e.distance = P.DistanceVV(e.pointA, e.pointB), e.iterations = p, c.WriteCache(i), s.useRadii) {
- var b = o.m_radius,
- A = a.m_radius;
- if (e.distance > b + A && e.distance > n) {
- e.distance -= b + A;
- var C = P.SubVV(e.pointB, e.pointA, ot);
- C.Normalize(), e.pointA.SelfMulAdd(b, C), e.pointB.SelfMulSub(A, C)
- } else {
- var T = P.MidVV(e.pointA, e.pointB, rt);
- e.pointA.Copy(T), e.pointB.Copy(T), e.distance = 0
- }
- }
- }
- var ct = new P,
- ut = new tt,
- _t = new P,
- ft = new P,
- dt = new P,
- pt = new P,
- mt = new P,
- yt = new P;
- (function(t) {
- t[t.e_vertex = 0] = "e_vertex", t[t.e_face = 1] = "e_face"
- })(t.b2ContactFeatureType || (t.b2ContactFeatureType = {}));
- var vt = (function() {
- function t() {
- this._key = 0, this._key_invalid = !1, this._indexA = 0, this._indexB = 0, this._typeA = 0, this._typeB = 0
- }
- return Object.defineProperty(t.prototype, "key", {
- get: function() {
- return this._key_invalid && (this._key_invalid = !1, this._key = this._indexA | this._indexB << 8 | this._typeA << 16 | this._typeB << 24), this._key
- },
- set: function(t) {
- this._key = t, this._key_invalid = !1, this._indexA = 255 & this._key, this._indexB = this._key >> 8 & 255, this._typeA = this._key >> 16 & 255, this._typeB = this._key >> 24 & 255
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t.prototype, "indexA", {
- get: function() {
- return this._indexA
- },
- set: function(t) {
- this._indexA = t, this._key_invalid = !0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t.prototype, "indexB", {
- get: function() {
- return this._indexB
- },
- set: function(t) {
- this._indexB = t, this._key_invalid = !0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t.prototype, "typeA", {
- get: function() {
- return this._typeA
- },
- set: function(t) {
- this._typeA = t, this._key_invalid = !0
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(t.prototype, "typeB", {
- get: function() {
- return this._typeB
- },
- set: function(t) {
- this._typeB = t, this._key_invalid = !0
- },
- enumerable: !0,
- configurable: !0
- }), t
- })(),
- gt = (function() {
- function t() {
- this.cf = new vt
- }
- return t.prototype.Copy = function(t) {
- return this.key = t.key, this
- }, t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, Object.defineProperty(t.prototype, "key", {
- get: function() {
- return this.cf.key
- },
- set: function(t) {
- this.cf.key = t
- },
- enumerable: !0,
- configurable: !0
- }), t
- })(),
- xt = (function() {
- function t() {
- this.localPoint = new P, this.normalImpulse = 0, this.tangentImpulse = 0, this.id = new gt
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t.prototype.Reset = function() {
- this.localPoint.SetZero(), this.normalImpulse = 0, this.tangentImpulse = 0, this.id.key = 0
- }, t.prototype.Copy = function(t) {
- return this.localPoint.Copy(t.localPoint), this.normalImpulse = t.normalImpulse, this.tangentImpulse = t.tangentImpulse, this.id.Copy(t.id), this
- }, t
- })();
- (function(t) {
- t[t.e_unknown = -1] = "e_unknown", t[t.e_circles = 0] = "e_circles", t[t.e_faceA = 1] = "e_faceA", t[t.e_faceB = 2] = "e_faceB"
- })(t.b2ManifoldType || (t.b2ManifoldType = {}));
- var bt = (function() {
- function e() {
- this.points = xt.MakeArray(o), this.localNormal = new P, this.localPoint = new P, this.type = t.b2ManifoldType.e_unknown, this.pointCount = 0
- }
- return e.prototype.Reset = function() {
- for (var e = 0; e < o; ++e) this.points[e].Reset();
- this.localNormal.SetZero(), this.localPoint.SetZero(), this.type = t.b2ManifoldType.e_unknown, this.pointCount = 0
- }, e.prototype.Copy = function(t) {
- this.pointCount = t.pointCount;
- for (var e = 0; e < o; ++e) this.points[e].Copy(t.points[e]);
- return this.localNormal.Copy(t.localNormal), this.localPoint.Copy(t.localPoint), this.type = t.type, this
- }, e.prototype.Clone = function() {
- return (new e).Copy(this)
- }, e
- })(),
- At = (function() {
- function e() {
- this.normal = new P, this.points = P.MakeArray(o), this.separations = p(o)
- }
- return e.prototype.Initialize = function(i, n, s, o, a) {
- if (0 !== i.pointCount) switch (i.type) {
- case t.b2ManifoldType.e_circles:
- this.normal.Set(1, 0);
- var l = V.MulXV(n, i.localPoint, e.Initialize_s_pointA),
- h = V.MulXV(o, i.points[0].localPoint, e.Initialize_s_pointB);
- P.DistanceSquaredVV(l, h) > r && P.SubVV(h, l, this.normal).SelfNormalize();
- var c = P.AddVMulSV(l, s, this.normal, e.Initialize_s_cA),
- u = P.SubVMulSV(h, a, this.normal, e.Initialize_s_cB);
- P.MidVV(c, u, this.points[0]), this.separations[0] = P.DotVV(P.SubVV(u, c, P.s_t0), this.normal);
- break;
- case t.b2ManifoldType.e_faceA:
- N.MulRV(n.q, i.localNormal, this.normal);
- for (var _ = V.MulXV(n, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
- var d = V.MulXV(o, i.points[f].localPoint, e.Initialize_s_clipPoint),
- p = s - P.DotVV(P.SubVV(d, _, P.s_t0), this.normal);
- c = P.AddVMulSV(d, p, this.normal, e.Initialize_s_cA), u = P.SubVMulSV(d, a, this.normal, e.Initialize_s_cB);
- P.MidVV(c, u, this.points[f]), this.separations[f] = P.DotVV(P.SubVV(u, c, P.s_t0), this.normal)
- }
- break;
- case t.b2ManifoldType.e_faceB:
- N.MulRV(o.q, i.localNormal, this.normal);
- for (_ = V.MulXV(o, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
- d = V.MulXV(n, i.points[f].localPoint, e.Initialize_s_clipPoint), p = a - P.DotVV(P.SubVV(d, _, P.s_t0), this.normal), u = P.AddVMulSV(d, p, this.normal, e.Initialize_s_cB), c = P.SubVMulSV(d, s, this.normal, e.Initialize_s_cA);
- P.MidVV(c, u, this.points[f]), this.separations[f] = P.DotVV(P.SubVV(c, u, P.s_t0), this.normal)
- }
- this.normal.SelfNeg()
- }
- }, e.Initialize_s_pointA = new P, e.Initialize_s_pointB = new P, e.Initialize_s_cA = new P, e.Initialize_s_cB = new P, e.Initialize_s_planePoint = new P, e.Initialize_s_clipPoint = new P, e
- })();
- (function(t) {
- t[t.b2_nullState = 0] = "b2_nullState", t[t.b2_addState = 1] = "b2_addState", t[t.b2_persistState = 2] = "b2_persistState", t[t.b2_removeState = 3] = "b2_removeState"
- })(t.b2PointState || (t.b2PointState = {}));
- var Ct = (function() {
- function t() {
- this.v = new P, this.id = new gt
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t.prototype.Copy = function(t) {
- return this.v.Copy(t.v), this.id.Copy(t.id), this
- }, t
- })(),
- Tt = (function() {
- function t() {
- this.p1 = new P, this.p2 = new P, this.maxFraction = 1
- }
- return t.prototype.Copy = function(t) {
- return this.p1.Copy(t.p1), this.p2.Copy(t.p2), this.maxFraction = t.maxFraction, this
- }, t
- })(),
- St = (function() {
- function t() {
- this.normal = new P, this.fraction = 0
- }
- return t.prototype.Copy = function(t) {
- return this.normal.Copy(t.normal), this.fraction = t.fraction, this
- }, t
- })(),
- wt = (function() {
- function t() {
- this.lowerBound = new P, this.upperBound = new P, this.m_cache_center = new P, this.m_cache_extent = new P
- }
- return t.prototype.Copy = function(t) {
- return this.lowerBound.Copy(t.lowerBound), this.upperBound.Copy(t.upperBound), this
- }, t.prototype.IsValid = function() {
- var t = this.upperBound.x - this.lowerBound.x,
- e = this.upperBound.y - this.lowerBound.y,
- i = t >= 0 && e >= 0;
- return i = i && this.lowerBound.IsValid() && this.upperBound.IsValid()
- }, t.prototype.GetCenter = function() {
- return P.MidVV(this.lowerBound, this.upperBound, this.m_cache_center)
- }, t.prototype.GetExtents = function() {
- return P.ExtVV(this.lowerBound, this.upperBound, this.m_cache_extent)
- }, t.prototype.GetPerimeter = function() {
- return 2 * (this.upperBound.x - this.lowerBound.x + (this.upperBound.y - this.lowerBound.y))
- }, t.prototype.Combine1 = function(t) {
- return this.lowerBound.x = g(this.lowerBound.x, t.lowerBound.x), this.lowerBound.y = g(this.lowerBound.y, t.lowerBound.y), this.upperBound.x = x(this.upperBound.x, t.upperBound.x), this.upperBound.y = x(this.upperBound.y, t.upperBound.y), this
- }, t.prototype.Combine2 = function(t, e) {
- return this.lowerBound.x = g(t.lowerBound.x, e.lowerBound.x), this.lowerBound.y = g(t.lowerBound.y, e.lowerBound.y), this.upperBound.x = x(t.upperBound.x, e.upperBound.x), this.upperBound.y = x(t.upperBound.y, e.upperBound.y), this
- }, t.Combine = function(t, e, i) {
- return i.Combine2(t, e), i
- }, t.prototype.Contains = function(t) {
- var e = !0;
- return e = (e = (e = (e = e && this.lowerBound.x <= t.lowerBound.x) && this.lowerBound.y <= t.lowerBound.y) && t.upperBound.x <= this.upperBound.x) && t.upperBound.y <= this.upperBound.y
- }, t.prototype.RayCast = function(t, e) {
- var r = -i,
- s = i,
- o = e.p1.x,
- a = e.p1.y,
- l = e.p2.x - e.p1.x,
- h = e.p2.y - e.p1.y,
- c = v(l),
- u = v(h),
- _ = t.normal;
- if (c < n) {
- if (o < this.lowerBound.x || this.upperBound.x < o) return !1
- } else {
- var f = 1 / l,
- d = -1;
- if ((m = (this.lowerBound.x - o) * f) > (y = (this.upperBound.x - o) * f)) {
- var p = m;
- m = y, y = p, d = 1
- }
- if (m > r && (_.x = d, _.y = 0, r = m), r > (s = g(s, y))) return !1
- }
- if (u < n) {
- if (a < this.lowerBound.y || this.upperBound.y < a) return !1
- } else {
- var m, y;
- f = 1 / h, d = -1;
- if ((m = (this.lowerBound.y - a) * f) > (y = (this.upperBound.y - a) * f)) {
- p = m;
- m = y, y = p, d = 1
- }
- if (m > r && (_.x = 0, _.y = d, r = m), r > (s = g(s, y))) return !1
- }
- return !(r < 0 || e.maxFraction < r) && (t.fraction = r, !0)
- }, t.prototype.TestContain = function(t) {
- return !(t.x < this.lowerBound.x || this.upperBound.x < t.x) && !(t.y < this.lowerBound.y || this.upperBound.y < t.y)
- }, t.prototype.TestOverlap = function(t) {
- var e = t.lowerBound.x - this.upperBound.x,
- i = t.lowerBound.y - this.upperBound.y,
- n = this.lowerBound.x - t.upperBound.x,
- r = this.lowerBound.y - t.upperBound.y;
- return !(e > 0 || i > 0) && !(n > 0 || r > 0)
- }, t
- })();
- function Et(t, e) {
- var i = e.lowerBound.x - t.upperBound.x,
- n = e.lowerBound.y - t.upperBound.y,
- r = t.lowerBound.x - e.upperBound.x,
- s = t.lowerBound.y - e.upperBound.y;
- return !(i > 0 || n > 0) && !(r > 0 || s > 0)
- }
- function Mt(e, i, n, r, s) {
- var o = 0,
- a = i[0],
- l = i[1],
- h = P.DotVV(n, a.v) - r,
- c = P.DotVV(n, l.v) - r;
- if (h <= 0 && e[o++].Copy(a), c <= 0 && e[o++].Copy(l), h * c < 0) {
- var u = h / (h - c),
- _ = e[o].v;
- _.x = a.v.x + u * (l.v.x - a.v.x), _.y = a.v.y + u * (l.v.y - a.v.y);
- var f = e[o].id;
- f.cf.indexA = s, f.cf.indexB = a.id.cf.indexB, f.cf.typeA = t.b2ContactFeatureType.e_vertex, f.cf.typeB = t.b2ContactFeatureType.e_face, ++o
- }
- return o
- }
- var Dt = new J,
- Bt = new q,
- It = new Z;
- function Pt(t, e, i, r, s, o) {
- var a = Dt.Reset();
- a.proxyA.SetShape(t, e), a.proxyB.SetShape(i, r), a.transformA.Copy(s), a.transformB.Copy(o), a.useRadii = !0;
- var l = Bt.Reset();
- l.count = 0;
- var h = It.Reset();
- return ht(h, l, a), h.distance < 10 * n
- }
- function Rt(t) {
- if (null === t) throw new Error;
- return t
- }
- var Ot = (function() {
- function t(t) {
- void 0 === t && (t = 0), this.m_id = 0, this.aabb = new wt, this.parent = null, this.child1 = null, this.child2 = null, this.height = 0, this.m_id = t
- }
- return t.prototype.IsLeaf = function() {
- return null === this.child1
- }, t
- })(),
- Lt = (function() {
- function t() {
- this.m_root = null, this.m_freeList = null, this.m_path = 0, this.m_insertionCount = 0, this.m_stack = new W(256)
- }
- return t.prototype.Query = function(t, e) {
- if (null !== this.m_root) {
- var i = this.m_stack.Reset();
- for (i.Push(this.m_root); i.GetCount() > 0;) {
- var n = i.Pop();
- if (n.aabb.TestOverlap(t))
- if (n.IsLeaf()) {
- if (!e(n)) return
- } else i.Push(Rt(n.child1)), i.Push(Rt(n.child2))
- }
- }
- }, t.prototype.QueryPoint = function(t, e) {
- if (null !== this.m_root) {
- var i = this.m_stack.Reset();
- for (i.Push(this.m_root); i.GetCount() > 0;) {
- var n = i.Pop();
- if (n.aabb.TestContain(t))
- if (n.IsLeaf()) {
- if (!e(n)) return
- } else i.Push(Rt(n.child1)), i.Push(Rt(n.child2))
- }
- }
- }, t.prototype.RayCast = function(e, i) {
- if (null !== this.m_root) {
- var n = e.p1,
- r = e.p2,
- s = P.SubVV(r, n, t.s_r);
- s.Normalize();
- var o = P.CrossOneV(s, t.s_v),
- a = P.AbsV(o, t.s_abs_v),
- l = e.maxFraction,
- h = t.s_segmentAABB,
- c = n.x + l * (r.x - n.x),
- u = n.y + l * (r.y - n.y);
- h.lowerBound.x = g(n.x, c), h.lowerBound.y = g(n.y, u), h.upperBound.x = x(n.x, c), h.upperBound.y = x(n.y, u);
- var _ = this.m_stack.Reset();
- for (_.Push(this.m_root); _.GetCount() > 0;) {
- var f = _.Pop();
- if (Et(f.aabb, h)) {
- var d = f.aabb.GetCenter(),
- p = f.aabb.GetExtents();
- if (!(v(P.DotVV(o, P.SubVV(n, d, P.s_t0))) - P.DotVV(a, p) > 0))
- if (f.IsLeaf()) {
- var m = t.s_subInput;
- m.p1.Copy(e.p1), m.p2.Copy(e.p2), m.maxFraction = l;
- var y = i(m, f);
- if (0 === y) return;
- y > 0 && (l = y, c = n.x + l * (r.x - n.x), u = n.y + l * (r.y - n.y), h.lowerBound.x = g(n.x, c), h.lowerBound.y = g(n.y, u), h.upperBound.x = x(n.x, c), h.upperBound.y = x(n.y, u))
- } else _.Push(Rt(f.child1)), _.Push(Rt(f.child2))
- }
- }
- }
- }, t.prototype.AllocateNode = function() {
- if (this.m_freeList) {
- var e = this.m_freeList;
- return this.m_freeList = e.parent, e.parent = null, e.child1 = null, e.child2 = null, e.height = 0, delete e.userData, e
- }
- return new Ot(t.s_node_id++)
- }, t.prototype.FreeNode = function(t) {
- t.parent = this.m_freeList, t.child1 = null, t.child2 = null, t.height = -1, delete t.userData, this.m_freeList = t
- }, t.prototype.CreateProxy = function(t, e) {
- var i = this.AllocateNode();
- return i.aabb.lowerBound.x = t.lowerBound.x - .1, i.aabb.lowerBound.y = t.lowerBound.y - .1, i.aabb.upperBound.x = t.upperBound.x + .1, i.aabb.upperBound.y = t.upperBound.y + .1, i.userData = e, i.height = 0, this.InsertLeaf(i), i
- }, t.prototype.DestroyProxy = function(t) {
- this.RemoveLeaf(t), this.FreeNode(t)
- }, t.prototype.MoveProxy = function(t, e, i) {
- if (t.aabb.Contains(e)) return !1;
- this.RemoveLeaf(t);
- var n = .1 + 2 * (i.x > 0 ? i.x : -i.x),
- r = .1 + 2 * (i.y > 0 ? i.y : -i.y);
- return t.aabb.lowerBound.x = e.lowerBound.x - n, t.aabb.lowerBound.y = e.lowerBound.y - r, t.aabb.upperBound.x = e.upperBound.x + n, t.aabb.upperBound.y = e.upperBound.y + r, this.InsertLeaf(t), !0
- }, t.prototype.InsertLeaf = function(e) {
- if (++this.m_insertionCount, null === this.m_root) return this.m_root = e, void(this.m_root.parent = null);
- for (var i = e.aabb, n = this.m_root; !n.IsLeaf();) {
- var r = Rt(n.child1),
- s = Rt(n.child2),
- o = n.aabb.GetPerimeter(),
- a = t.s_combinedAABB;
- a.Combine2(n.aabb, i);
- var l = a.GetPerimeter(),
- h = 2 * l,
- c = 2 * (l - o),
- u = void 0,
- _ = t.s_aabb,
- f = void 0;
- r.IsLeaf() ? (_.Combine2(i, r.aabb), u = _.GetPerimeter() + c) : (_.Combine2(i, r.aabb), f = r.aabb.GetPerimeter(), u = _.GetPerimeter() - f + c);
- var d = void 0;
- if (s.IsLeaf() ? (_.Combine2(i, s.aabb), d = _.GetPerimeter() + c) : (_.Combine2(i, s.aabb), f = s.aabb.GetPerimeter(), d = _.GetPerimeter() - f + c), h < u && h < d) break;
- n = u < d ? r : s
- }
- var p = n,
- m = p.parent,
- y = this.AllocateNode();
- y.parent = m, delete y.userData, y.aabb.Combine2(i, p.aabb), y.height = p.height + 1, m ? (m.child1 === p ? m.child1 = y : m.child2 = y, y.child1 = p, y.child2 = e, p.parent = y, e.parent = y) : (y.child1 = p, y.child2 = e, p.parent = y, e.parent = y, this.m_root = y);
- for (var v = e.parent; null !== v;) {
- r = Rt((v = this.Balance(v)).child1), s = Rt(v.child2);
- v.height = 1 + x(r.height, s.height), v.aabb.Combine2(r.aabb, s.aabb), v = v.parent
- }
- }, t.prototype.RemoveLeaf = function(t) {
- if (t !== this.m_root) {
- var e, i = Rt(t.parent),
- n = i && i.parent;
- if (e = i.child1 === t ? Rt(i.child2) : Rt(i.child1), n) {
- n.child1 === i ? n.child1 = e : n.child2 = e, e.parent = n, this.FreeNode(i);
- for (var r = n; r;) {
- var s = Rt((r = this.Balance(r)).child1),
- o = Rt(r.child2);
- r.aabb.Combine2(s.aabb, o.aabb), r.height = 1 + x(s.height, o.height), r = r.parent
- }
- } else this.m_root = e, e.parent = null, this.FreeNode(i)
- } else this.m_root = null
- }, t.prototype.Balance = function(t) {
- if (t.IsLeaf() || t.height < 2) return t;
- var e = Rt(t.child1),
- i = Rt(t.child2),
- n = i.height - e.height;
- if (n > 1) {
- var r = Rt(i.child1),
- s = Rt(i.child2);
- return i.child1 = t, i.parent = t.parent, t.parent = i, null !== i.parent ? i.parent.child1 === t ? i.parent.child1 = i : i.parent.child2 = i : this.m_root = i, r.height > s.height ? (i.child2 = r, t.child2 = s, s.parent = t, t.aabb.Combine2(e.aabb, s.aabb), i.aabb.Combine2(t.aabb, r.aabb), t.height = 1 + x(e.height, s.height), i.height = 1 + x(t.height, r.height)) : (i.child2 = s, t.child2 = r, r.parent = t, t.aabb.Combine2(e.aabb, r.aabb), i.aabb.Combine2(t.aabb, s.aabb), t.height = 1 + x(e.height, r.height), i.height = 1 + x(t.height, s.height)), i
- }
- if (n < -1) {
- var o = Rt(e.child1),
- a = Rt(e.child2);
- return e.child1 = t, e.parent = t.parent, t.parent = e, null !== e.parent ? e.parent.child1 === t ? e.parent.child1 = e : e.parent.child2 = e : this.m_root = e, o.height > a.height ? (e.child2 = o, t.child1 = a, a.parent = t, t.aabb.Combine2(i.aabb, a.aabb), e.aabb.Combine2(t.aabb, o.aabb), t.height = 1 + x(i.height, a.height), e.height = 1 + x(t.height, o.height)) : (e.child2 = a, t.child1 = o, o.parent = t, t.aabb.Combine2(i.aabb, o.aabb), e.aabb.Combine2(t.aabb, a.aabb), t.height = 1 + x(i.height, o.height), e.height = 1 + x(t.height, a.height)), e
- }
- return t
- }, t.prototype.GetHeight = function() {
- return null === this.m_root ? 0 : this.m_root.height
- }, t.GetAreaNode = function(e) {
- if (null === e) return 0;
- if (e.IsLeaf()) return 0;
- var i = e.aabb.GetPerimeter();
- return i += t.GetAreaNode(e.child1), i += t.GetAreaNode(e.child2)
- }, t.prototype.GetAreaRatio = function() {
- if (null === this.m_root) return 0;
- var e = this.m_root.aabb.GetPerimeter();
- return t.GetAreaNode(this.m_root) / e
- }, t.prototype.ComputeHeightNode = function(t) {
- if (!t || t.IsLeaf()) return 0;
- var e = this.ComputeHeightNode(t.child1),
- i = this.ComputeHeightNode(t.child2);
- return 1 + x(e, i)
- }, t.prototype.ComputeHeight = function() {
- return this.ComputeHeightNode(this.m_root)
- }, t.prototype.ValidateStructure = function(t) {
- if (null !== t) {
- this.m_root;
- var e = t;
- if (!e.IsLeaf()) {
- var i = Rt(e.child1),
- n = Rt(e.child2);
- this.ValidateStructure(i), this.ValidateStructure(n)
- }
- }
- }, t.prototype.ValidateMetrics = function(e) {
- if (null !== e) {
- var i = e;
- if (!i.IsLeaf()) {
- var n = Rt(i.child1),
- r = Rt(i.child2);
- t.s_aabb.Combine2(n.aabb, r.aabb), this.ValidateMetrics(n), this.ValidateMetrics(r)
- }
- }
- }, t.prototype.Validate = function() {}, t.GetMaxBalanceNode = function(t, e) {
- if (null === t) return e;
- if (t.height <= 1) return e;
- var i = Rt(t.child1),
- n = Rt(t.child2),
- r = v(n.height - i.height);
- return x(e, r)
- }, t.prototype.GetMaxBalance = function() {
- return t.GetMaxBalanceNode(this.m_root, 0)
- }, t.prototype.RebuildBottomUp = function() {
- this.Validate()
- }, t.ShiftOriginNode = function(e, i) {
- if (null !== e && !(e.height <= 1)) {
- var n = e.child1,
- r = e.child2;
- t.ShiftOriginNode(n, i), t.ShiftOriginNode(r, i), e.aabb.lowerBound.SelfSub(i), e.aabb.upperBound.SelfSub(i)
- }
- }, t.prototype.ShiftOrigin = function(e) {
- t.ShiftOriginNode(this.m_root, e)
- }, t.s_r = new P, t.s_v = new P, t.s_abs_v = new P, t.s_segmentAABB = new wt, t.s_subInput = new Tt, t.s_combinedAABB = new wt, t.s_aabb = new wt, t.s_node_id = 0, t
- })(),
- Ft = (function() {
- return function(t, e) {
- this.proxyA = t, this.proxyB = e
- }
- })(),
- Nt = (function() {
- function t() {
- this.m_tree = new Lt, this.m_proxyCount = 0, this.m_moveCount = 0, this.m_moveBuffer = [], this.m_pairCount = 0, this.m_pairBuffer = []
- }
- return t.prototype.CreateProxy = function(t, e) {
- var i = this.m_tree.CreateProxy(t, e);
- return ++this.m_proxyCount, this.BufferMove(i), i
- }, t.prototype.DestroyProxy = function(t) {
- this.UnBufferMove(t), --this.m_proxyCount, this.m_tree.DestroyProxy(t)
- }, t.prototype.MoveProxy = function(t, e, i) {
- this.m_tree.MoveProxy(t, e, i) && this.BufferMove(t)
- }, t.prototype.TouchProxy = function(t) {
- this.BufferMove(t)
- }, t.prototype.GetProxyCount = function() {
- return this.m_proxyCount
- }, t.prototype.UpdatePairs = function(t) {
- var e = this;
- this.m_pairCount = 0;
- for (var i = function(t) {
- var i = n.m_moveBuffer[t];
- if (null === i) return "continue";
- var r = i.aabb;
- n.m_tree.Query(r, (function(t) {
- if (t.m_id === i.m_id) return !0;
- var n, r;
- if (t.m_id < i.m_id ? (n = t, r = i) : (n = i, r = t), e.m_pairCount === e.m_pairBuffer.length) e.m_pairBuffer[e.m_pairCount] = new Ft(n, r);
- else {
- var s = e.m_pairBuffer[e.m_pairCount];
- s.proxyA = n, s.proxyB = r
- }
- return ++e.m_pairCount, !0
- }))
- }, n = this, r = 0; r < this.m_moveCount; ++r) i(r);
- this.m_moveCount = 0, this.m_pairBuffer.length = this.m_pairCount, this.m_pairBuffer.sort(Vt);
- for (var s = 0; s < this.m_pairCount;) {
- var o = this.m_pairBuffer[s],
- a = o.proxyA.userData,
- l = o.proxyB.userData;
- for (a && l && t(a, l), ++s; s < this.m_pairCount;) {
- var h = this.m_pairBuffer[s];
- if (h.proxyA.m_id !== o.proxyA.m_id || h.proxyB.m_id !== o.proxyB.m_id) break;
- ++s
- }
- }
- }, t.prototype.Query = function(t, e) {
- this.m_tree.Query(t, e)
- }, t.prototype.QueryPoint = function(t, e) {
- this.m_tree.QueryPoint(t, e)
- }, t.prototype.RayCast = function(t, e) {
- this.m_tree.RayCast(t, e)
- }, t.prototype.GetTreeHeight = function() {
- return this.m_tree.GetHeight()
- }, t.prototype.GetTreeBalance = function() {
- return this.m_tree.GetMaxBalance()
- }, t.prototype.GetTreeQuality = function() {
- return this.m_tree.GetAreaRatio()
- }, t.prototype.ShiftOrigin = function(t) {
- this.m_tree.ShiftOrigin(t)
- }, t.prototype.BufferMove = function(t) {
- this.m_moveBuffer[this.m_moveCount] = t, ++this.m_moveCount
- }, t.prototype.UnBufferMove = function(t) {
- var e = this.m_moveBuffer.indexOf(t);
- this.m_moveBuffer[e] = null
- }, t
- })();
- function Vt(t, e) {
- return t.proxyA.m_id === e.proxyA.m_id ? t.proxyB.m_id - e.proxyB.m_id : t.proxyA.m_id - e.proxyA.m_id
- }
- t.b2_toiTime = 0, t.b2_toiMaxTime = 0, t.b2_toiCalls = 0, t.b2_toiIters = 0, t.b2_toiMaxIters = 0, t.b2_toiRootIters = 0, t.b2_toiMaxRootIters = 0;
- var kt = new V,
- Gt = new V,
- Ut = new P,
- zt = new P,
- jt = new P,
- Wt = new P,
- Ht = new P,
- Xt = (function() {
- return function() {
- this.proxyA = new Y, this.proxyB = new Y, this.sweepA = new k, this.sweepB = new k, this.tMax = 0
- }
- })();
- (function(t) {
- t[t.e_unknown = 0] = "e_unknown", t[t.e_failed = 1] = "e_failed", t[t.e_overlapped = 2] = "e_overlapped", t[t.e_touching = 3] = "e_touching", t[t.e_separated = 4] = "e_separated"
- })(t.b2TOIOutputState || (t.b2TOIOutputState = {}));
- var Yt = (function() {
- return function() {
- this.state = t.b2TOIOutputState.e_unknown, this.t = 0
- }
- })();
- (function(t) {
- t[t.e_unknown = -1] = "e_unknown", t[t.e_points = 0] = "e_points", t[t.e_faceA = 1] = "e_faceA", t[t.e_faceB = 2] = "e_faceB"
- })(t.b2SeparationFunctionType || (t.b2SeparationFunctionType = {}));
- var qt = (function() {
- function e() {
- this.m_sweepA = new k, this.m_sweepB = new k, this.m_type = t.b2SeparationFunctionType.e_unknown, this.m_localPoint = new P, this.m_axis = new P
- }
- return e.prototype.Initialize = function(e, i, n, r, s, o) {
- this.m_proxyA = i, this.m_proxyB = r;
- var a = e.count;
- this.m_sweepA.Copy(n), this.m_sweepB.Copy(s);
- var l = kt,
- h = Gt;
- if (this.m_sweepA.GetTransform(l, o), this.m_sweepB.GetTransform(h, o), 1 === a) {
- this.m_type = t.b2SeparationFunctionType.e_points;
- var c = this.m_proxyA.GetVertex(e.indexA[0]),
- u = this.m_proxyB.GetVertex(e.indexB[0]),
- _ = V.MulXV(l, c, Ut),
- f = V.MulXV(h, u, zt);
- P.SubVV(f, _, this.m_axis);
- var d = this.m_axis.Normalize();
- return this.m_localPoint.SetZero(), d
- }
- if (e.indexA[0] === e.indexA[1]) {
- this.m_type = t.b2SeparationFunctionType.e_faceB;
- var p = this.m_proxyB.GetVertex(e.indexB[0]),
- m = this.m_proxyB.GetVertex(e.indexB[1]);
- P.CrossVOne(P.SubVV(m, p, P.s_t0), this.m_axis).SelfNormalize();
- var y = N.MulRV(h.q, this.m_axis, jt);
- P.MidVV(p, m, this.m_localPoint);
- f = V.MulXV(h, this.m_localPoint, zt), c = this.m_proxyA.GetVertex(e.indexA[0]), _ = V.MulXV(l, c, Ut);
- return (d = P.DotVV(P.SubVV(_, f, P.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), d = -d), d
- }
- this.m_type = t.b2SeparationFunctionType.e_faceA;
- var v = this.m_proxyA.GetVertex(e.indexA[0]),
- g = this.m_proxyA.GetVertex(e.indexA[1]);
- P.CrossVOne(P.SubVV(g, v, P.s_t0), this.m_axis).SelfNormalize();
- y = N.MulRV(l.q, this.m_axis, jt);
- P.MidVV(v, g, this.m_localPoint);
- _ = V.MulXV(l, this.m_localPoint, Ut), u = this.m_proxyB.GetVertex(e.indexB[0]), f = V.MulXV(h, u, zt);
- return (d = P.DotVV(P.SubVV(f, _, P.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), d = -d), d
- }, e.prototype.FindMinSeparation = function(e, i, n) {
- var r = kt,
- s = Gt;
- switch (this.m_sweepA.GetTransform(r, n), this.m_sweepB.GetTransform(s, n), this.m_type) {
- case t.b2SeparationFunctionType.e_points:
- var o = N.MulTRV(r.q, this.m_axis, Wt),
- a = N.MulTRV(s.q, P.NegV(this.m_axis, P.s_t0), Ht);
- e[0] = this.m_proxyA.GetSupport(o), i[0] = this.m_proxyB.GetSupport(a);
- var l = this.m_proxyA.GetVertex(e[0]),
- h = this.m_proxyB.GetVertex(i[0]),
- c = V.MulXV(r, l, Ut),
- u = V.MulXV(s, h, zt);
- return P.DotVV(P.SubVV(u, c, P.s_t0), this.m_axis);
- case t.b2SeparationFunctionType.e_faceA:
- var _ = N.MulRV(r.q, this.m_axis, jt);
- c = V.MulXV(r, this.m_localPoint, Ut), a = N.MulTRV(s.q, P.NegV(_, P.s_t0), Ht);
- e[0] = -1, i[0] = this.m_proxyB.GetSupport(a);
- h = this.m_proxyB.GetVertex(i[0]), u = V.MulXV(s, h, zt);
- return P.DotVV(P.SubVV(u, c, P.s_t0), _);
- case t.b2SeparationFunctionType.e_faceB:
- _ = N.MulRV(s.q, this.m_axis, jt), u = V.MulXV(s, this.m_localPoint, zt), o = N.MulTRV(r.q, P.NegV(_, P.s_t0), Wt);
- i[0] = -1, e[0] = this.m_proxyA.GetSupport(o);
- l = this.m_proxyA.GetVertex(e[0]), c = V.MulXV(r, l, Ut);
- return P.DotVV(P.SubVV(c, u, P.s_t0), _);
- default:
- return e[0] = -1, i[0] = -1, 0
- }
- }, e.prototype.Evaluate = function(e, i, n) {
- var r = kt,
- s = Gt;
- switch (this.m_sweepA.GetTransform(r, n), this.m_sweepB.GetTransform(s, n), this.m_type) {
- case t.b2SeparationFunctionType.e_points:
- var o = this.m_proxyA.GetVertex(e),
- a = this.m_proxyB.GetVertex(i),
- l = V.MulXV(r, o, Ut),
- h = V.MulXV(s, a, zt);
- return P.DotVV(P.SubVV(h, l, P.s_t0), this.m_axis);
- case t.b2SeparationFunctionType.e_faceA:
- var c = N.MulRV(r.q, this.m_axis, jt);
- l = V.MulXV(r, this.m_localPoint, Ut), a = this.m_proxyB.GetVertex(i), h = V.MulXV(s, a, zt);
- return P.DotVV(P.SubVV(h, l, P.s_t0), c);
- case t.b2SeparationFunctionType.e_faceB:
- c = N.MulRV(s.q, this.m_axis, jt), h = V.MulXV(s, this.m_localPoint, zt), o = this.m_proxyA.GetVertex(e), l = V.MulXV(r, o, Ut);
- return P.DotVV(P.SubVV(l, h, P.s_t0), c);
- default:
- return 0
- }
- }, e
- })(),
- Jt = new z,
- Zt = new q,
- Kt = new J,
- Qt = new Z,
- $t = new qt,
- te = [0],
- ee = [0],
- ie = new k,
- ne = new k;
- function re(e, i) {
- var n = Jt.Reset();
- ++t.b2_toiCalls, e.state = t.b2TOIOutputState.e_unknown, e.t = i.tMax;
- var r = i.proxyA,
- s = i.proxyB,
- o = ie.Copy(i.sweepA),
- h = ne.Copy(i.sweepB);
- o.Normalize(), h.Normalize();
- var c = i.tMax,
- u = r.m_radius + s.m_radius,
- _ = x(l, u - 3 * l),
- f = .25 * l,
- d = 0,
- p = 0,
- m = Zt;
- m.count = 0;
- var y = Kt;
- for (y.proxyA.Copy(i.proxyA), y.proxyB.Copy(i.proxyB), y.useRadii = !1;;) {
- var g = kt,
- b = Gt;
- o.GetTransform(g, d), h.GetTransform(b, d), y.transformA.Copy(g), y.transformB.Copy(b);
- var A = Qt;
- if (ht(A, m, y), A.distance <= 0) {
- e.state = t.b2TOIOutputState.e_overlapped, e.t = 0;
- break
- }
- if (A.distance < _ + f) {
- e.state = t.b2TOIOutputState.e_touching, e.t = d;
- break
- }
- var C = $t;
- C.Initialize(m, r, o, s, h, d);
- for (var T = !1, S = c, w = 0;;) {
- var E = te,
- M = ee,
- D = C.FindMinSeparation(E, M, S);
- if (D > _ + f) {
- e.state = t.b2TOIOutputState.e_separated, e.t = c, T = !0;
- break
- }
- if (D > _ - f) {
- d = S;
- break
- }
- var B = C.Evaluate(E[0], M[0], d);
- if (B < _ - f) {
- e.state = t.b2TOIOutputState.e_failed, e.t = d, T = !0;
- break
- }
- if (B <= _ + f) {
- e.state = t.b2TOIOutputState.e_touching, e.t = d, T = !0;
- break
- }
- for (var I = 0, P = d, R = S;;) {
- var O = 0;
- O = 1 & I ? P + (_ - B) * (R - P) / (D - B) : .5 * (P + R), ++I, ++t.b2_toiRootIters;
- var L = C.Evaluate(E[0], M[0], O);
- if (v(L - _) < f) {
- S = O;
- break
- }
- if (L > _ ? (P = O, B = L) : (R = O, D = L), 50 === I) break
- }
- if (t.b2_toiMaxRootIters = x(t.b2_toiMaxRootIters, I), ++w === a) break
- }
- if (++p, ++t.b2_toiIters, T) break;
- if (20 === p) {
- e.state = t.b2TOIOutputState.e_failed, e.t = d;
- break
- }
- }
- t.b2_toiMaxIters = x(t.b2_toiMaxIters, p);
- var F = n.GetMilliseconds();
- t.b2_toiMaxTime = x(t.b2_toiMaxTime, F), t.b2_toiTime += F
- }
- var se = new P,
- oe = new P;
- function ae(e, i, n, r, s) {
- e.pointCount = 0;
- var o = V.MulXV(n, i.m_p, se),
- a = V.MulXV(s, r.m_p, oe),
- l = P.DistanceSquaredVV(o, a),
- h = i.m_radius + r.m_radius;
- l > h * h || (e.type = t.b2ManifoldType.e_circles, e.localPoint.Copy(i.m_p), e.localNormal.SetZero(), e.pointCount = 1, e.points[0].localPoint.Copy(r.m_p), e.points[0].id.key = 0)
- }
- var le = new P,
- he = new P,
- ce = new P;
- function ue(e, r, s, o, a) {
- e.pointCount = 0;
- for (var l = V.MulXV(a, o.m_p, le), h = V.MulTXV(s, l, he), c = 0, u = -i, _ = r.m_radius + o.m_radius, f = r.m_count, d = r.m_vertices, p = r.m_normals, m = 0; m < f; ++m) {
- var y = P.DotVV(p[m], P.SubVV(h, d[m], P.s_t0));
- if (y > _) return;
- y > u && (u = y, c = m)
- }
- var v = c,
- g = (v + 1) % f,
- x = d[v],
- b = d[g];
- if (u < n) return e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(p[c]), P.MidVV(x, b, e.localPoint), e.points[0].localPoint.Copy(o.m_p), void(e.points[0].id.key = 0);
- var A = P.DotVV(P.SubVV(h, x, P.s_t0), P.SubVV(b, x, P.s_t1)),
- C = P.DotVV(P.SubVV(h, b, P.s_t0), P.SubVV(x, b, P.s_t1));
- if (A <= 0) {
- if (P.DistanceSquaredVV(h, x) > _ * _) return;
- e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, P.SubVV(h, x, e.localNormal).SelfNormalize(), e.localPoint.Copy(x), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
- } else if (C <= 0) {
- if (P.DistanceSquaredVV(h, b) > _ * _) return;
- e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, P.SubVV(h, b, e.localNormal).SelfNormalize(), e.localPoint.Copy(b), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
- } else {
- var T = P.MidVV(x, b, ce);
- if (P.DotVV(P.SubVV(h, T, P.s_t1), p[v]) > _) return;
- e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(p[v]).SelfNormalize(), e.localPoint.Copy(T), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
- }
- }
- var _e = new P,
- fe = new P,
- de = new P,
- pe = new P;
- function me(t, e, n, r, s) {
- for (var o = t.m_vertices, a = t.m_normals, l = r.m_count, h = r.m_vertices, c = N.MulRV(e.q, a[n], _e), u = N.MulTRV(s.q, c, fe), _ = 0, f = i, d = 0; d < l; ++d) {
- var p = P.DotVV(h[d], u);
- p < f && (f = p, _ = d)
- }
- var m = V.MulXV(e, o[n], de),
- y = V.MulXV(s, h[_], pe);
- return P.DotVV(P.SubVV(y, m, P.s_t0), c)
- }
- var ye = new P,
- ve = new P;
- function ge(t, e, n, r, s) {
- for (var o = e.m_count, a = e.m_normals, l = P.SubVV(V.MulXV(s, r.m_centroid, P.s_t0), V.MulXV(n, e.m_centroid, P.s_t1), ye), h = N.MulTRV(n.q, l, ve), c = 0, u = -i, _ = 0; _ < o; ++_) {
- var f = P.DotVV(a[_], h);
- f > u && (u = f, c = _)
- }
- var d = me(e, n, c, r, s),
- p = (c + o - 1) % o,
- m = me(e, n, p, r, s),
- y = (c + 1) % o,
- v = me(e, n, y, r, s),
- g = 0,
- x = 0,
- b = 0;
- if (m > d && m > v) b = -1, g = p, x = m;
- else {
- if (!(v > d)) return t[0] = c, d;
- b = 1, g = y, x = v
- }
- for (;
- (d = me(e, n, c = -1 === b ? (g + o - 1) % o : (g + 1) % o, r, s)) > x;) g = c, x = d;
- return t[0] = g, x
- }
- var xe = new P;
- function be(e, n, r, s, o, a) {
- for (var l = n.m_normals, h = o.m_count, c = o.m_vertices, u = o.m_normals, _ = N.MulTRV(a.q, N.MulRV(r.q, l[s], P.s_t0), xe), f = 0, d = i, p = 0; p < h; ++p) {
- var m = P.DotVV(_, u[p]);
- m < d && (d = m, f = p)
- }
- var y = f,
- v = (y + 1) % h,
- g = e[0];
- V.MulXV(a, c[y], g.v);
- var x = g.id.cf;
- x.indexA = s, x.indexB = y, x.typeA = t.b2ContactFeatureType.e_face, x.typeB = t.b2ContactFeatureType.e_vertex;
- var b = e[1];
- V.MulXV(a, c[v], b.v);
- var A = b.id.cf;
- A.indexA = s, A.indexB = v, A.typeA = t.b2ContactFeatureType.e_face, A.typeB = t.b2ContactFeatureType.e_vertex
- }
- var Ae = Ct.MakeArray(2),
- Ce = Ct.MakeArray(2),
- Te = Ct.MakeArray(2),
- Se = [0],
- we = [0],
- Ee = new P,
- Me = new P,
- De = new P,
- Be = new P,
- Ie = new P,
- Pe = new P,
- Re = new P,
- Oe = new P;
- function Le(e, i, n, r, s) {
- e.pointCount = 0;
- var a = i.m_radius + r.m_radius,
- l = Se;
- l[0] = 0;
- var h = ge(l, i, n, r, s);
- if (!(h > a)) {
- var c = we;
- c[0] = 0;
- var u = ge(c, r, s, i, n);
- if (!(u > a)) {
- var _, f, d, p, m = 0,
- y = 0;
- u > .98 * h + .001 ? (_ = r, f = i, d = s, p = n, m = c[0], e.type = t.b2ManifoldType.e_faceB, y = 1) : (_ = i, f = r, d = n, p = s, m = l[0], e.type = t.b2ManifoldType.e_faceA, y = 0);
- var v = Ae;
- be(v, _, d, m, f, p);
- var g = _.m_count,
- x = _.m_vertices,
- b = m,
- A = (m + 1) % g,
- C = x[b],
- T = x[A],
- S = P.SubVV(T, C, Ee);
- S.Normalize();
- var w = P.CrossVOne(S, Me),
- E = P.MidVV(C, T, De),
- M = N.MulRV(d.q, S, Ie),
- D = P.CrossVOne(M, Be),
- B = V.MulXV(d, C, Re),
- I = V.MulXV(d, T, Oe),
- R = P.DotVV(D, B),
- O = -P.DotVV(M, B) + a,
- L = P.DotVV(M, I) + a,
- F = Ce,
- k = Te;
- if (!(Mt(F, v, P.NegV(M, Pe), O, b) < 2 || Mt(k, F, M, L, A) < 2)) {
- e.localNormal.Copy(w), e.localPoint.Copy(E);
- for (var G = 0, U = 0; U < o; ++U) {
- var z = k[U];
- if (P.DotVV(D, z.v) - R <= a) {
- var j = e.points[G];
- if (V.MulTXV(p, z.v, j.localPoint), j.id.Copy(z.id), y) {
- var W = j.id.cf;
- j.id.cf.indexA = W.indexB, j.id.cf.indexB = W.indexA, j.id.cf.typeA = W.typeB, j.id.cf.typeB = W.typeA
- }++G
- }
- }
- e.pointCount = G
- }
- }
- }
- }
- var Fe = new P,
- Ne = new P,
- Ve = new P,
- ke = new P,
- Ge = new P,
- Ue = new P,
- ze = new P,
- je = new gt;
- function We(e, i, n, r, s) {
- e.pointCount = 0;
- var o = V.MulTXV(n, V.MulXV(s, r.m_p, P.s_t0), Fe),
- a = i.m_vertex1,
- l = i.m_vertex2,
- h = P.SubVV(l, a, Ne),
- c = P.DotVV(h, P.SubVV(l, o, P.s_t0)),
- u = P.DotVV(h, P.SubVV(o, a, P.s_t0)),
- _ = i.m_radius + r.m_radius,
- f = je;
- if (f.cf.indexB = 0, f.cf.typeB = t.b2ContactFeatureType.e_vertex, u <= 0) {
- var d = a,
- p = P.SubVV(o, d, Ve);
- if (P.DotVV(p, p) > _ * _) return;
- if (i.m_hasVertex0) {
- var m = i.m_vertex0,
- y = a,
- v = P.SubVV(y, m, ke);
- if (P.DotVV(v, P.SubVV(y, o, P.s_t0)) > 0) return
- }
- return f.cf.indexA = 0, f.cf.typeA = t.b2ContactFeatureType.e_vertex, e.pointCount = 1, e.type = t.b2ManifoldType.e_circles, e.localNormal.SetZero(), e.localPoint.Copy(d), e.points[0].id.Copy(f), void e.points[0].localPoint.Copy(r.m_p)
- }
- if (c <= 0) {
- var g = l,
- x = P.SubVV(o, g, Ve);
- if (P.DotVV(x, x) > _ * _) return;
- if (i.m_hasVertex3) {
- var b = i.m_vertex3,
- A = l,
- C = P.SubVV(b, A, Ge);
- if (P.DotVV(C, P.SubVV(o, A, P.s_t0)) > 0) return
- }
- return f.cf.indexA = 1, f.cf.typeA = t.b2ContactFeatureType.e_vertex, e.pointCount = 1, e.type = t.b2ManifoldType.e_circles, e.localNormal.SetZero(), e.localPoint.Copy(g), e.points[0].id.Copy(f), void e.points[0].localPoint.Copy(r.m_p)
- }
- var T = P.DotVV(h, h),
- S = Ue;
- S.x = 1 / T * (c * a.x + u * l.x), S.y = 1 / T * (c * a.y + u * l.y);
- var w = P.SubVV(o, S, Ve);
- if (!(P.DotVV(w, w) > _ * _)) {
- var E = ze.Set(-h.y, h.x);
- P.DotVV(E, P.SubVV(o, a, P.s_t0)) < 0 && E.Set(-E.x, -E.y), E.Normalize(), f.cf.indexA = 0, f.cf.typeA = t.b2ContactFeatureType.e_face, e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(E), e.localPoint.Copy(a), e.points[0].id.Copy(f), e.points[0].localPoint.Copy(r.m_p)
- }
- }
- var He = (function() {
- return function() {
- this.type = 0, this.index = 0, this.separation = 0
- }
- })(),
- Xe = (function() {
- return function() {
- this.vertices = P.MakeArray(a), this.normals = P.MakeArray(a), this.count = 0
- }
- })(),
- Ye = (function() {
- return function() {
- this.i1 = 0, this.i2 = 0, this.v1 = new P, this.v2 = new P, this.normal = new P, this.sideNormal1 = new P, this.sideOffset1 = 0, this.sideNormal2 = new P, this.sideOffset2 = 0
- }
- })(),
- qe = new(function() {
- function e() {
- this.m_polygonB = new Xe, this.m_xf = new V, this.m_centroidB = new P, this.m_v0 = new P, this.m_v1 = new P, this.m_v2 = new P, this.m_v3 = new P, this.m_normal0 = new P, this.m_normal1 = new P, this.m_normal2 = new P, this.m_normal = new P, this.m_type1 = 0, this.m_type2 = 0, this.m_lowerLimit = new P, this.m_upperLimit = new P, this.m_radius = 0, this.m_front = !1
- }
- return e.prototype.Collide = function(i, n, r, s, a) {
- V.MulTXX(r, a, this.m_xf), V.MulXV(this.m_xf, s.m_centroid, this.m_centroidB), this.m_v0.Copy(n.m_vertex0), this.m_v1.Copy(n.m_vertex1), this.m_v2.Copy(n.m_vertex2), this.m_v3.Copy(n.m_vertex3);
- var l = n.m_hasVertex0,
- h = n.m_hasVertex3,
- c = P.SubVV(this.m_v2, this.m_v1, e.s_edge1);
- c.Normalize(), this.m_normal1.Set(c.y, -c.x);
- var u = P.DotVV(this.m_normal1, P.SubVV(this.m_centroidB, this.m_v1, P.s_t0)),
- _ = 0,
- f = 0,
- d = !1,
- p = !1;
- if (l) {
- var m = P.SubVV(this.m_v1, this.m_v0, e.s_edge0);
- m.Normalize(), this.m_normal0.Set(m.y, -m.x), d = P.CrossVV(m, c) >= 0, _ = P.DotVV(this.m_normal0, P.SubVV(this.m_centroidB, this.m_v0, P.s_t0))
- }
- if (h) {
- var y = P.SubVV(this.m_v3, this.m_v2, e.s_edge2);
- y.Normalize(), this.m_normal2.Set(y.y, -y.x), p = P.CrossVV(c, y) > 0, f = P.DotVV(this.m_normal2, P.SubVV(this.m_centroidB, this.m_v2, P.s_t0))
- }
- l && h ? d && p ? (this.m_front = _ >= 0 || u >= 0 || f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : d ? (this.m_front = _ >= 0 || u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : p ? (this.m_front = f >= 0 || _ >= 0 && u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : l ? d ? (this.m_front = _ >= 0 || u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : h ? p ? (this.m_front = u >= 0 || f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1))), this.m_polygonB.count = s.m_count;
- for (var v = 0; v < s.m_count; ++v) V.MulXV(this.m_xf, s.m_vertices[v], this.m_polygonB.vertices[v]), N.MulRV(this.m_xf.q, s.m_normals[v], this.m_polygonB.normals[v]);
- this.m_radius = s.m_radius + n.m_radius, i.pointCount = 0;
- var g = this.ComputeEdgeSeparation(e.s_edgeAxis);
- if (0 !== g.type && !(g.separation > this.m_radius)) {
- var x = this.ComputePolygonSeparation(e.s_polygonAxis);
- if (!(0 !== x.type && x.separation > this.m_radius)) {
- var b;
- b = 0 === x.type ? g : x.separation > .98 * g.separation + .001 ? x : g;
- var A = e.s_ie,
- C = e.s_rf;
- if (1 === b.type) {
- i.type = t.b2ManifoldType.e_faceA;
- var T = 0,
- S = P.DotVV(this.m_normal, this.m_polygonB.normals[0]);
- for (v = 1; v < this.m_polygonB.count; ++v) {
- var w = P.DotVV(this.m_normal, this.m_polygonB.normals[v]);
- w < S && (S = w, T = v)
- }
- var E = T,
- M = (E + 1) % this.m_polygonB.count;
- (D = A[0]).v.Copy(this.m_polygonB.vertices[E]), D.id.cf.indexA = 0, D.id.cf.indexB = E, D.id.cf.typeA = t.b2ContactFeatureType.e_face, D.id.cf.typeB = t.b2ContactFeatureType.e_vertex, (B = A[1]).v.Copy(this.m_polygonB.vertices[M]), B.id.cf.indexA = 0, B.id.cf.indexB = M, B.id.cf.typeA = t.b2ContactFeatureType.e_face, B.id.cf.typeB = t.b2ContactFeatureType.e_vertex, this.m_front ? (C.i1 = 0, C.i2 = 1, C.v1.Copy(this.m_v1), C.v2.Copy(this.m_v2), C.normal.Copy(this.m_normal1)) : (C.i1 = 1, C.i2 = 0, C.v1.Copy(this.m_v2), C.v2.Copy(this.m_v1), C.normal.Copy(this.m_normal1).SelfNeg())
- } else {
- var D, B;
- i.type = t.b2ManifoldType.e_faceB, (D = A[0]).v.Copy(this.m_v1), D.id.cf.indexA = 0, D.id.cf.indexB = b.index, D.id.cf.typeA = t.b2ContactFeatureType.e_vertex, D.id.cf.typeB = t.b2ContactFeatureType.e_face, (B = A[1]).v.Copy(this.m_v2), B.id.cf.indexA = 0, B.id.cf.indexB = b.index, B.id.cf.typeA = t.b2ContactFeatureType.e_vertex, B.id.cf.typeB = t.b2ContactFeatureType.e_face, C.i1 = b.index, C.i2 = (C.i1 + 1) % this.m_polygonB.count, C.v1.Copy(this.m_polygonB.vertices[C.i1]), C.v2.Copy(this.m_polygonB.vertices[C.i2]), C.normal.Copy(this.m_polygonB.normals[C.i1])
- }
- C.sideNormal1.Set(C.normal.y, -C.normal.x), C.sideNormal2.Copy(C.sideNormal1).SelfNeg(), C.sideOffset1 = P.DotVV(C.sideNormal1, C.v1), C.sideOffset2 = P.DotVV(C.sideNormal2, C.v2);
- var I = e.s_clipPoints1,
- R = e.s_clipPoints2;
- if (!(Mt(I, A, C.sideNormal1, C.sideOffset1, C.i1) < o || Mt(R, I, C.sideNormal2, C.sideOffset2, C.i2) < o)) {
- 1 === b.type ? (i.localNormal.Copy(C.normal), i.localPoint.Copy(C.v1)) : (i.localNormal.Copy(s.m_normals[C.i1]), i.localPoint.Copy(s.m_vertices[C.i1]));
- var O = 0;
- for (v = 0; v < o; ++v) {
- if (P.DotVV(C.normal, P.SubVV(R[v].v, C.v1, P.s_t0)) <= this.m_radius) {
- var L = i.points[O];
- 1 === b.type ? (V.MulTXV(this.m_xf, R[v].v, L.localPoint), L.id = R[v].id) : (L.localPoint.Copy(R[v].v), L.id.cf.typeA = R[v].id.cf.typeB, L.id.cf.typeB = R[v].id.cf.typeA, L.id.cf.indexA = R[v].id.cf.indexB, L.id.cf.indexB = R[v].id.cf.indexA), ++O
- }
- }
- i.pointCount = O
- }
- }
- }
- }, e.prototype.ComputeEdgeSeparation = function(t) {
- var e = t;
- e.type = 1, e.index = this.m_front ? 0 : 1, e.separation = i;
- for (var n = 0; n < this.m_polygonB.count; ++n) {
- var r = P.DotVV(this.m_normal, P.SubVV(this.m_polygonB.vertices[n], this.m_v1, P.s_t0));
- r < e.separation && (e.separation = r)
- }
- return e
- }, e.prototype.ComputePolygonSeparation = function(t) {
- var n = t;
- n.type = 0, n.index = -1, n.separation = -i;
- for (var r = e.s_perp.Set(-this.m_normal.y, this.m_normal.x), s = 0; s < this.m_polygonB.count; ++s) {
- var o = P.NegV(this.m_polygonB.normals[s], e.s_n),
- a = P.DotVV(o, P.SubVV(this.m_polygonB.vertices[s], this.m_v1, P.s_t0)),
- l = P.DotVV(o, P.SubVV(this.m_polygonB.vertices[s], this.m_v2, P.s_t0)),
- c = g(a, l);
- if (c > this.m_radius) return n.type = 2, n.index = s, n.separation = c, n;
- if (P.DotVV(o, r) >= 0) {
- if (P.DotVV(P.SubVV(o, this.m_upperLimit, P.s_t0), this.m_normal) < -h) continue
- } else if (P.DotVV(P.SubVV(o, this.m_lowerLimit, P.s_t0), this.m_normal) < -h) continue;
- c > n.separation && (n.type = 2, n.index = s, n.separation = c)
- }
- return n
- }, e.s_edge1 = new P, e.s_edge0 = new P, e.s_edge2 = new P, e.s_ie = Ct.MakeArray(2), e.s_rf = new Ye, e.s_clipPoints1 = Ct.MakeArray(2), e.s_clipPoints2 = Ct.MakeArray(2), e.s_edgeAxis = new He, e.s_polygonAxis = new He, e.s_n = new P, e.s_perp = new P, e
- }());
- function Je(t, e, i, n, r) {
- qe.Collide(t, e, i, n, r)
- }
- var Ze = (function() {
- return function() {
- this.mass = 0, this.center = new P(0, 0), this.I = 0
- }
- })();
- (function(t) {
- t[t.e_unknown = -1] = "e_unknown", t[t.e_circleShape = 0] = "e_circleShape", t[t.e_edgeShape = 1] = "e_edgeShape", t[t.e_polygonShape = 2] = "e_polygonShape", t[t.e_chainShape = 3] = "e_chainShape", t[t.e_shapeTypeCount = 4] = "e_shapeTypeCount"
- })(t.b2ShapeType || (t.b2ShapeType = {}));
- var Ke = (function() {
- function e(e, i) {
- this.m_type = t.b2ShapeType.e_unknown, this.m_radius = 0, this.m_type = e, this.m_radius = i
- }
- return e.prototype.Copy = function(t) {
- return this.m_radius = t.m_radius, this
- }, e.prototype.GetType = function() {
- return this.m_type
- }, e
- })(),
- Qe = Object.setPrototypeOf || {
- __proto__: []
- }
- instanceof Array && function(t, e) {
- t.__proto__ = e
- } || function(t, e) {
- for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
- };
- function $e(t, e) {
- function i() {
- this.constructor = t
- }
- Qe(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i)
- }
- var ti = (function(e) {
- function i(i) {
- void 0 === i && (i = 0);
- var n = e.call(this, t.b2ShapeType.e_circleShape, i) || this;
- return n.m_p = new P, n
- }
- return $e(i, e), i.prototype.Set = function(t, e) {
- return void 0 === e && (e = this.m_radius), this.m_p.Copy(t), this.m_radius = e, this
- }, i.prototype.Clone = function() {
- return (new i).Copy(this)
- }, i.prototype.Copy = function(t) {
- return e.prototype.Copy.call(this, t), this.m_p.Copy(t.m_p), this
- }, i.prototype.GetChildCount = function() {
- return 1
- }, i.prototype.TestPoint = function(t, e) {
- var n = V.MulXV(t, this.m_p, i.TestPoint_s_center),
- r = P.SubVV(e, n, i.TestPoint_s_d);
- return P.DotVV(r, r) <= C(this.m_radius)
- }, i.prototype.ComputeDistance = function(t, e, n, r) {
- var s = V.MulXV(t, this.m_p, i.ComputeDistance_s_center);
- return P.SubVV(e, s, n), n.Normalize() - this.m_radius
- }, i.prototype.RayCast = function(t, e, r, s) {
- var o = V.MulXV(r, this.m_p, i.RayCast_s_position),
- a = P.SubVV(e.p1, o, i.RayCast_s_s),
- l = P.DotVV(a, a) - C(this.m_radius),
- h = P.SubVV(e.p2, e.p1, i.RayCast_s_r),
- c = P.DotVV(a, h),
- u = P.DotVV(h, h),
- _ = c * c - u * l;
- if (_ < 0 || u < n) return !1;
- var f = -(c + S(_));
- return 0 <= f && f <= e.maxFraction * u && (f /= u, t.fraction = f, P.AddVMulSV(a, f, h, t.normal).SelfNormalize(), !0)
- }, i.prototype.ComputeAABB = function(t, e, n) {
- var r = V.MulXV(e, this.m_p, i.ComputeAABB_s_p);
- t.lowerBound.Set(r.x - this.m_radius, r.y - this.m_radius), t.upperBound.Set(r.x + this.m_radius, r.y + this.m_radius)
- }, i.prototype.ComputeMass = function(t, e) {
- var i = C(this.m_radius);
- t.mass = e * s * i, t.center.Copy(this.m_p), t.I = t.mass * (.5 * i + P.DotVV(this.m_p, this.m_p))
- }, i.prototype.SetupDistanceProxy = function(t, e) {
- t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_p), t.m_count = 1, t.m_radius = this.m_radius
- }, i.prototype.ComputeSubmergedArea = function(t, e, i, r) {
- var o = V.MulXV(i, this.m_p, new P),
- a = -(P.DotVV(t, o) - e);
- if (a < -this.m_radius + n) return 0;
- if (a > this.m_radius) return r.Copy(o), s * this.m_radius * this.m_radius;
- var l = this.m_radius * this.m_radius,
- h = a * a,
- c = l * (B(a / this.m_radius) + s / 2) + a * S(l - h),
- u = -2 / 3 * w(l - h, 1.5) / c;
- return r.x = o.x + t.x * u, r.y = o.y + t.y * u, c
- }, i.prototype.Dump = function(t) {
- t(" const shape: b2CircleShape = new b2CircleShape();\n"), t(" shape.m_radius = %.15f;\n", this.m_radius), t(" shape.m_p.Set(%.15f, %.15f);\n", this.m_p.x, this.m_p.y)
- }, i.TestPoint_s_center = new P, i.TestPoint_s_d = new P, i.ComputeDistance_s_center = new P, i.RayCast_s_position = new P, i.RayCast_s_s = new P, i.RayCast_s_r = new P, i.ComputeAABB_s_p = new P, i
- })(Ke),
- ei = (function(e) {
- function r() {
- var i = e.call(this, t.b2ShapeType.e_polygonShape, c) || this;
- return i.m_centroid = new P(0, 0), i.m_vertices = [], i.m_normals = [], i.m_count = 0, i
- }
- return $e(r, e), r.prototype.Clone = function() {
- return (new r).Copy(this)
- }, r.prototype.Copy = function(t) {
- e.prototype.Copy.call(this, t), this.m_centroid.Copy(t.m_centroid), this.m_count = t.m_count, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count);
- for (var i = 0; i < this.m_count; ++i) this.m_vertices[i].Copy(t.m_vertices[i]), this.m_normals[i].Copy(t.m_normals[i]);
- return this
- }, r.prototype.GetChildCount = function() {
- return 1
- }, r.prototype.Set = function(t, e, i) {
- if (void 0 === e && (e = t.length), void 0 === i && (i = 0), e < 3) return this.SetAsBox(1, 1);
- for (var n = g(e, a), s = r.Set_s_ps, o = 0, h = 0; h < n; ++h) {
- for (var c = t[i + h], u = !0, _ = 0; _ < o; ++_)
- if (P.DistanceSquaredVV(c, s[_]) < .5 * l * (.5 * l)) {
- u = !1;
- break
- }
- u && s[o++].Copy(c)
- }
- if ((n = o) < 3) return this.SetAsBox(1, 1);
- var f = 0,
- d = s[0].x;
- for (h = 1; h < n; ++h) {
- var p = s[h].x;
- (p > d || p === d && s[h].y < s[f].y) && (f = h, d = p)
- }
- for (var m = r.Set_s_hull, y = 0, v = f;;) {
- m[y] = v;
- var x = 0;
- for (_ = 1; _ < n; ++_)
- if (x !== v) {
- var b = P.SubVV(s[x], s[m[y]], r.Set_s_r),
- A = (c = P.SubVV(s[_], s[m[y]], r.Set_s_v), P.CrossVV(b, c));
- A < 0 && (x = _), 0 === A && c.LengthSquared() > b.LengthSquared() && (x = _)
- } else x = _;
- if (++y, v = x, x === f) break
- }
- this.m_count = y, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count);
- for (h = 0; h < y; ++h) this.m_vertices[h].Copy(s[m[h]]);
- for (h = 0; h < y; ++h) {
- var C = this.m_vertices[h],
- T = this.m_vertices[(h + 1) % y],
- S = P.SubVV(T, C, P.s_t0);
- P.CrossVOne(S, this.m_normals[h]).SelfNormalize()
- }
- return r.ComputeCentroid(this.m_vertices, y, this.m_centroid), this
- }, r.prototype.SetAsArray = function(t, e) {
- return void 0 === e && (e = t.length), this.Set(t, e)
- }, r.prototype.SetAsBox = function(t, e, i, n) {
- if (void 0 === n && (n = 0), this.m_count = 4, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count), this.m_vertices[0].Set(-t, -e), this.m_vertices[1].Set(t, -e), this.m_vertices[2].Set(t, e), this.m_vertices[3].Set(-t, e), this.m_normals[0].Set(0, -1), this.m_normals[1].Set(1, 0), this.m_normals[2].Set(0, 1), this.m_normals[3].Set(-1, 0), this.m_centroid.SetZero(), i) {
- this.m_centroid.Copy(i);
- var r = new V;
- r.SetPosition(i), r.SetRotationAngle(n);
- for (var s = 0; s < this.m_count; ++s) V.MulXV(r, this.m_vertices[s], this.m_vertices[s]), N.MulRV(r.q, this.m_normals[s], this.m_normals[s])
- }
- return this
- }, r.prototype.TestPoint = function(t, e) {
- for (var i = V.MulTXV(t, e, r.TestPoint_s_pLocal), n = 0; n < this.m_count; ++n) {
- if (P.DotVV(this.m_normals[n], P.SubVV(i, this.m_vertices[n], P.s_t0)) > 0) return !1
- }
- return !0
- }, r.prototype.ComputeDistance = function(t, e, n, s) {
- for (var o = V.MulTXV(t, e, r.ComputeDistance_s_pLocal), a = -i, l = r.ComputeDistance_s_normalForMaxDistance.Copy(o), h = 0; h < this.m_count; ++h) {
- var c = P.DotVV(this.m_normals[h], P.SubVV(o, this.m_vertices[h], P.s_t0));
- c > a && (a = c, l.Copy(this.m_normals[h]))
- }
- if (a > 0) {
- var u = r.ComputeDistance_s_minDistance.Copy(l),
- _ = a * a;
- for (h = 0; h < this.m_count; ++h) {
- var f = P.SubVV(o, this.m_vertices[h], r.ComputeDistance_s_distance),
- d = f.LengthSquared();
- _ > d && (u.Copy(f), _ = d)
- }
- return N.MulRV(t.q, u, n), n.Normalize(), Math.sqrt(_)
- }
- return N.MulRV(t.q, l, n), a
- }, r.prototype.RayCast = function(t, e, i, n) {
- for (var s = V.MulTXV(i, e.p1, r.RayCast_s_p1), o = V.MulTXV(i, e.p2, r.RayCast_s_p2), a = P.SubVV(o, s, r.RayCast_s_d), l = 0, h = e.maxFraction, c = -1, u = 0; u < this.m_count; ++u) {
- var _ = P.DotVV(this.m_normals[u], P.SubVV(this.m_vertices[u], s, P.s_t0)),
- f = P.DotVV(this.m_normals[u], a);
- if (0 === f) {
- if (_ < 0) return !1
- } else f < 0 && _ < l * f ? (l = _ / f, c = u) : f > 0 && _ < h * f && (h = _ / f);
- if (h < l) return !1
- }
- return c >= 0 && (t.fraction = l, N.MulRV(i.q, this.m_normals[c], t.normal), !0)
- }, r.prototype.ComputeAABB = function(t, e, i) {
- for (var n = V.MulXV(e, this.m_vertices[0], t.lowerBound), s = t.upperBound.Copy(n), o = 0; o < this.m_count; ++o) {
- var a = V.MulXV(e, this.m_vertices[o], r.ComputeAABB_s_v);
- P.MinV(a, n, n), P.MaxV(a, s, s)
- }
- var l = this.m_radius;
- n.SelfSubXY(l, l), s.SelfAddXY(l, l)
- }, r.prototype.ComputeMass = function(t, e) {
- for (var i = r.ComputeMass_s_center.SetZero(), n = 0, s = 0, o = r.ComputeMass_s_s.SetZero(), a = 0; a < this.m_count; ++a) o.SelfAdd(this.m_vertices[a]);
- o.SelfMul(1 / this.m_count);
- for (a = 0; a < this.m_count; ++a) {
- var l = P.SubVV(this.m_vertices[a], o, r.ComputeMass_s_e1),
- h = P.SubVV(this.m_vertices[(a + 1) % this.m_count], o, r.ComputeMass_s_e2),
- c = P.CrossVV(l, h),
- u = .5 * c;
- n += u, i.SelfAdd(P.MulSV(u * (1 / 3), P.AddVV(l, h, P.s_t0), P.s_t1));
- var _ = l.x,
- f = l.y,
- d = h.x,
- p = h.y;
- s += 1 / 3 * .25 * c * (_ * _ + d * _ + d * d + (f * f + p * f + p * p))
- }
- t.mass = e * n, i.SelfMul(1 / n), P.AddVV(i, o, t.center), t.I = e * s, t.I += t.mass * (P.DotVV(t.center, t.center) - P.DotVV(i, i))
- }, r.prototype.Validate = function() {
- for (var t = 0; t < this.m_count; ++t)
- for (var e = t, i = (t + 1) % this.m_count, n = this.m_vertices[e], s = P.SubVV(this.m_vertices[i], n, r.Validate_s_e), o = 0; o < this.m_count; ++o)
- if (o !== e && o !== i) {
- var a = P.SubVV(this.m_vertices[o], n, r.Validate_s_v);
- if (P.CrossVV(s, a) < 0) return !1
- }
- return !0
- }, r.prototype.SetupDistanceProxy = function(t, e) {
- t.m_vertices = this.m_vertices, t.m_count = this.m_count, t.m_radius = this.m_radius
- }, r.prototype.ComputeSubmergedArea = function(t, e, i, s) {
- for (var o = N.MulTRV(i.q, t, r.ComputeSubmergedArea_s_normalL), a = e - P.DotVV(t, i.p), l = r.ComputeSubmergedArea_s_depths, h = 0, c = -1, u = -1, _ = !1, f = 0; f < this.m_count; ++f) {
- l[f] = P.DotVV(o, this.m_vertices[f]) - a;
- var d = l[f] < -n;
- f > 0 && (d ? _ || (c = f - 1, h++) : _ && (u = f - 1, h++)), _ = d
- }
- switch (h) {
- case 0:
- if (_) {
- var p = r.ComputeSubmergedArea_s_md;
- return this.ComputeMass(p, 1), V.MulXV(i, p.center, s), p.mass
- }
- return 0;
- case 1:
- -1 === c ? c = this.m_count - 1 : u = this.m_count - 1
- }
- for (var m, y = (c + 1) % this.m_count, v = (u + 1) % this.m_count, g = (0 - l[c]) / (l[y] - l[c]), x = (0 - l[u]) / (l[v] - l[u]), b = r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[c].x * (1 - g) + this.m_vertices[y].x * g, this.m_vertices[c].y * (1 - g) + this.m_vertices[y].y * g), A = r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[u].x * (1 - x) + this.m_vertices[v].x * x, this.m_vertices[u].y * (1 - x) + this.m_vertices[v].y * x), C = 0, T = r.ComputeSubmergedArea_s_center.SetZero(), S = this.m_vertices[y], w = y; w !== v;) {
- m = (w = (w + 1) % this.m_count) === v ? A : this.m_vertices[w];
- var E = .5 * ((S.x - b.x) * (m.y - b.y) - (S.y - b.y) * (m.x - b.x));
- C += E, T.x += E * (b.x + S.x + m.x) / 3, T.y += E * (b.y + S.y + m.y) / 3, S = m
- }
- return T.SelfMul(1 / C), V.MulXV(i, T, s), C
- }, r.prototype.Dump = function(t) {
- t(" const shape: b2PolygonShape = new b2PolygonShape();\n"), t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
- for (var e = 0; e < this.m_count; ++e) t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
- t(" shape.Set(vs, %d);\n", this.m_count)
- }, r.ComputeCentroid = function(t, e, i) {
- var n = i;
- n.SetZero();
- for (var s = 0, o = r.ComputeCentroid_s_pRef.SetZero(), a = 0; a < e; ++a) {
- var l = o,
- h = t[a],
- c = t[(a + 1) % e],
- u = P.SubVV(h, l, r.ComputeCentroid_s_e1),
- _ = P.SubVV(c, l, r.ComputeCentroid_s_e2),
- f = .5 * P.CrossVV(u, _);
- s += f, n.x += f * (1 / 3) * (l.x + h.x + c.x), n.y += f * (1 / 3) * (l.y + h.y + c.y)
- }
- return n.SelfMul(1 / s), n
- }, r.Set_s_ps = P.MakeArray(a), r.Set_s_hull = p(a), r.Set_s_r = new P, r.Set_s_v = new P, r.TestPoint_s_pLocal = new P, r.ComputeDistance_s_pLocal = new P, r.ComputeDistance_s_normalForMaxDistance = new P, r.ComputeDistance_s_minDistance = new P, r.ComputeDistance_s_distance = new P, r.RayCast_s_p1 = new P, r.RayCast_s_p2 = new P, r.RayCast_s_d = new P, r.ComputeAABB_s_v = new P, r.ComputeMass_s_center = new P, r.ComputeMass_s_s = new P, r.ComputeMass_s_e1 = new P, r.ComputeMass_s_e2 = new P, r.Validate_s_e = new P, r.Validate_s_v = new P, r.ComputeSubmergedArea_s_normalL = new P, r.ComputeSubmergedArea_s_depths = p(a), r.ComputeSubmergedArea_s_md = new Ze, r.ComputeSubmergedArea_s_intoVec = new P, r.ComputeSubmergedArea_s_outoVec = new P, r.ComputeSubmergedArea_s_center = new P, r.ComputeCentroid_s_pRef = new P, r.ComputeCentroid_s_e1 = new P, r.ComputeCentroid_s_e2 = new P, r
- })(Ke),
- ii = (function(e) {
- function i() {
- var i = e.call(this, t.b2ShapeType.e_edgeShape, c) || this;
- return i.m_vertex1 = new P, i.m_vertex2 = new P, i.m_vertex0 = new P, i.m_vertex3 = new P, i.m_hasVertex0 = !1, i.m_hasVertex3 = !1, i
- }
- return $e(i, e), i.prototype.Set = function(t, e) {
- return this.m_vertex1.Copy(t), this.m_vertex2.Copy(e), this.m_hasVertex0 = !1, this.m_hasVertex3 = !1, this
- }, i.prototype.Clone = function() {
- return (new i).Copy(this)
- }, i.prototype.Copy = function(t) {
- return e.prototype.Copy.call(this, t), this.m_vertex1.Copy(t.m_vertex1), this.m_vertex2.Copy(t.m_vertex2), this.m_vertex0.Copy(t.m_vertex0), this.m_vertex3.Copy(t.m_vertex3), this.m_hasVertex0 = t.m_hasVertex0, this.m_hasVertex3 = t.m_hasVertex3, this
- }, i.prototype.GetChildCount = function() {
- return 1
- }, i.prototype.TestPoint = function(t, e) {
- return !1
- }, i.prototype.ComputeDistance = function(t, e, n, r) {
- var s = V.MulXV(t, this.m_vertex1, i.ComputeDistance_s_v1),
- o = V.MulXV(t, this.m_vertex2, i.ComputeDistance_s_v2),
- a = P.SubVV(e, s, i.ComputeDistance_s_d),
- l = P.SubVV(o, s, i.ComputeDistance_s_s),
- h = P.DotVV(a, l);
- if (h > 0) {
- var c = P.DotVV(l, l);
- h > c ? P.SubVV(e, o, a) : a.SelfMulSub(h / c, l)
- }
- return n.Copy(a), n.Normalize()
- }, i.prototype.RayCast = function(t, e, n, r) {
- var s = V.MulTXV(n, e.p1, i.RayCast_s_p1),
- o = V.MulTXV(n, e.p2, i.RayCast_s_p2),
- a = P.SubVV(o, s, i.RayCast_s_d),
- l = this.m_vertex1,
- h = this.m_vertex2,
- c = P.SubVV(h, l, i.RayCast_s_e),
- u = t.normal.Set(c.y, -c.x).SelfNormalize(),
- _ = P.DotVV(u, P.SubVV(l, s, P.s_t0)),
- f = P.DotVV(u, a);
- if (0 === f) return !1;
- var d = _ / f;
- if (d < 0 || e.maxFraction < d) return !1;
- var p = P.AddVMulSV(s, d, a, i.RayCast_s_q),
- m = P.SubVV(h, l, i.RayCast_s_r),
- y = P.DotVV(m, m);
- if (0 === y) return !1;
- var v = P.DotVV(P.SubVV(p, l, P.s_t0), m) / y;
- return !(v < 0 || 1 < v) && (t.fraction = d, N.MulRV(n.q, t.normal, t.normal), _ > 0 && t.normal.SelfNeg(), !0)
- }, i.prototype.ComputeAABB = function(t, e, n) {
- var r = V.MulXV(e, this.m_vertex1, i.ComputeAABB_s_v1),
- s = V.MulXV(e, this.m_vertex2, i.ComputeAABB_s_v2);
- P.MinV(r, s, t.lowerBound), P.MaxV(r, s, t.upperBound);
- var o = this.m_radius;
- t.lowerBound.SelfSubXY(o, o), t.upperBound.SelfAddXY(o, o)
- }, i.prototype.ComputeMass = function(t, e) {
- t.mass = 0, P.MidVV(this.m_vertex1, this.m_vertex2, t.center), t.I = 0
- }, i.prototype.SetupDistanceProxy = function(t, e) {
- t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_vertex1), t.m_vertices[1].Copy(this.m_vertex2), t.m_count = 2, t.m_radius = this.m_radius
- }, i.prototype.ComputeSubmergedArea = function(t, e, i, n) {
- return n.SetZero(), 0
- }, i.prototype.Dump = function(t) {
- t(" const shape: b2EdgeShape = new b2EdgeShape();\n"), t(" shape.m_radius = %.15f;\n", this.m_radius), t(" shape.m_vertex0.Set(%.15f, %.15f);\n", this.m_vertex0.x, this.m_vertex0.y), t(" shape.m_vertex1.Set(%.15f, %.15f);\n", this.m_vertex1.x, this.m_vertex1.y), t(" shape.m_vertex2.Set(%.15f, %.15f);\n", this.m_vertex2.x, this.m_vertex2.y), t(" shape.m_vertex3.Set(%.15f, %.15f);\n", this.m_vertex3.x, this.m_vertex3.y), t(" shape.m_hasVertex0 = %s;\n", this.m_hasVertex0), t(" shape.m_hasVertex3 = %s;\n", this.m_hasVertex3)
- }, i.ComputeDistance_s_v1 = new P, i.ComputeDistance_s_v2 = new P, i.ComputeDistance_s_d = new P, i.ComputeDistance_s_s = new P, i.RayCast_s_p1 = new P, i.RayCast_s_p2 = new P, i.RayCast_s_d = new P, i.RayCast_s_e = new P, i.RayCast_s_q = new P, i.RayCast_s_r = new P, i.ComputeAABB_s_v1 = new P, i.ComputeAABB_s_v2 = new P, i
- })(Ke),
- ni = (function(e) {
- function i() {
- var i = e.call(this, t.b2ShapeType.e_chainShape, c) || this;
- return i.m_vertices = [], i.m_count = 0, i.m_prevVertex = new P, i.m_nextVertex = new P, i.m_hasPrevVertex = !1, i.m_hasNextVertex = !1, i
- }
- return $e(i, e), i.prototype.CreateLoop = function(t, e, i) {
- if (void 0 === e && (e = t.length), void 0 === i && (i = 0), e < 3) return this;
- this.m_count = e + 1, this.m_vertices = P.MakeArray(this.m_count);
- for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
- return this.m_vertices[e].Copy(this.m_vertices[0]), this.m_prevVertex.Copy(this.m_vertices[this.m_count - 2]), this.m_nextVertex.Copy(this.m_vertices[1]), this.m_hasPrevVertex = !0, this.m_hasNextVertex = !0, this
- }, i.prototype.CreateChain = function(t, e, i) {
- void 0 === e && (e = t.length), void 0 === i && (i = 0), this.m_count = e, this.m_vertices = P.MakeArray(e);
- for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
- return this.m_hasPrevVertex = !1, this.m_hasNextVertex = !1, this.m_prevVertex.SetZero(), this.m_nextVertex.SetZero(), this
- }, i.prototype.SetPrevVertex = function(t) {
- return this.m_prevVertex.Copy(t), this.m_hasPrevVertex = !0, this
- }, i.prototype.SetNextVertex = function(t) {
- return this.m_nextVertex.Copy(t), this.m_hasNextVertex = !0, this
- }, i.prototype.Clone = function() {
- return (new i).Copy(this)
- }, i.prototype.Copy = function(t) {
- return e.prototype.Copy.call(this, t), this.CreateChain(t.m_vertices, t.m_count), this.m_prevVertex.Copy(t.m_prevVertex), this.m_nextVertex.Copy(t.m_nextVertex), this.m_hasPrevVertex = t.m_hasPrevVertex, this.m_hasNextVertex = t.m_hasNextVertex, this
- }, i.prototype.GetChildCount = function() {
- return this.m_count - 1
- }, i.prototype.GetChildEdge = function(e, i) {
- e.m_type = t.b2ShapeType.e_edgeShape, e.m_radius = this.m_radius, e.m_vertex1.Copy(this.m_vertices[i]), e.m_vertex2.Copy(this.m_vertices[i + 1]), i > 0 ? (e.m_vertex0.Copy(this.m_vertices[i - 1]), e.m_hasVertex0 = !0) : (e.m_vertex0.Copy(this.m_prevVertex), e.m_hasVertex0 = this.m_hasPrevVertex), i < this.m_count - 2 ? (e.m_vertex3.Copy(this.m_vertices[i + 2]), e.m_hasVertex3 = !0) : (e.m_vertex3.Copy(this.m_nextVertex), e.m_hasVertex3 = this.m_hasNextVertex)
- }, i.prototype.TestPoint = function(t, e) {
- return !1
- }, i.prototype.ComputeDistance = function(t, e, n, r) {
- var s = i.ComputeDistance_s_edgeShape;
- return this.GetChildEdge(s, r), s.ComputeDistance(t, e, n, 0)
- }, i.prototype.RayCast = function(t, e, n, r) {
- var s = i.RayCast_s_edgeShape;
- return s.m_vertex1.Copy(this.m_vertices[r]), s.m_vertex2.Copy(this.m_vertices[(r + 1) % this.m_count]), s.RayCast(t, e, n, 0)
- }, i.prototype.ComputeAABB = function(t, e, n) {
- var r = this.m_vertices[n],
- s = this.m_vertices[(n + 1) % this.m_count],
- o = V.MulXV(e, r, i.ComputeAABB_s_v1),
- a = V.MulXV(e, s, i.ComputeAABB_s_v2);
- P.MinV(o, a, t.lowerBound), P.MaxV(o, a, t.upperBound)
- }, i.prototype.ComputeMass = function(t, e) {
- t.mass = 0, t.center.SetZero(), t.I = 0
- }, i.prototype.SetupDistanceProxy = function(t, e) {
- t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_vertices[e]), e + 1 < this.m_count ? t.m_vertices[1].Copy(this.m_vertices[e + 1]) : t.m_vertices[1].Copy(this.m_vertices[0]), t.m_count = 2, t.m_radius = this.m_radius
- }, i.prototype.ComputeSubmergedArea = function(t, e, i, n) {
- return n.SetZero(), 0
- }, i.prototype.Dump = function(t) {
- t(" const shape: b2ChainShape = new b2ChainShape();\n"), t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
- for (var e = 0; e < this.m_count; ++e) t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
- t(" shape.CreateChain(vs, %d);\n", this.m_count), t(" shape.m_prevVertex.Set(%.15f, %.15f);\n", this.m_prevVertex.x, this.m_prevVertex.y), t(" shape.m_nextVertex.Set(%.15f, %.15f);\n", this.m_nextVertex.x, this.m_nextVertex.y), t(" shape.m_hasPrevVertex = %s;\n", this.m_hasPrevVertex ? "true" : "false"), t(" shape.m_hasNextVertex = %s;\n", this.m_hasNextVertex ? "true" : "false")
- }, i.ComputeDistance_s_edgeShape = new ii, i.RayCast_s_edgeShape = new ii, i.ComputeAABB_s_v1 = new P, i.ComputeAABB_s_v2 = new P, i
- })(Ke),
- ri = (function() {
- function t() {
- this.categoryBits = 1, this.maskBits = 65535, this.groupIndex = 0
- }
- return t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t.prototype.Copy = function(t) {
- return this.categoryBits = t.categoryBits, this.maskBits = t.maskBits, this.groupIndex = t.groupIndex || 0, this
- }, t.DEFAULT = new t, t
- })(),
- si = (function() {
- return function() {
- this.userData = null, this.friction = .2, this.restitution = 0, this.density = 0, this.isSensor = !1, this.filter = new ri
- }
- })(),
- oi = (function() {
- return function(t) {
- this.aabb = new wt, this.childIndex = 0, this.fixture = t
- }
- })(),
- ai = (function() {
- function t(t, e) {
- this.m_density = 0, this.m_next = null, this.m_friction = 0, this.m_restitution = 0, this.m_proxies = [], this.m_proxyCount = 0, this.m_filter = new ri, this.m_isSensor = !1, this.m_userData = null, this.m_body = e, this.m_shape = t.shape.Clone()
- }
- return t.prototype.GetType = function() {
- return this.m_shape.GetType()
- }, t.prototype.GetShape = function() {
- return this.m_shape
- }, t.prototype.SetSensor = function(t) {
- t !== this.m_isSensor && (this.m_body.SetAwake(!0), this.m_isSensor = t)
- }, t.prototype.IsSensor = function() {
- return this.m_isSensor
- }, t.prototype.SetFilterData = function(t) {
- this.m_filter.Copy(t), this.Refilter()
- }, t.prototype.GetFilterData = function() {
- return this.m_filter
- }, t.prototype.Refilter = function() {
- for (var t = this.m_body.GetContactList(); t;) {
- var e = t.contact,
- i = e.GetFixtureA(),
- n = e.GetFixtureB();
- i !== this && n !== this || e.FlagForFiltering(), t = t.next
- }
- var r = this.m_body.GetWorld();
- if (null !== r)
- for (var s = r.m_contactManager.m_broadPhase, o = 0; o < this.m_proxyCount; ++o) s.TouchProxy(this.m_proxies[o].treeNode)
- }, t.prototype.GetBody = function() {
- return this.m_body
- }, t.prototype.GetNext = function() {
- return this.m_next
- }, t.prototype.GetUserData = function() {
- return this.m_userData
- }, t.prototype.SetUserData = function(t) {
- this.m_userData = t
- }, t.prototype.TestPoint = function(t) {
- return this.m_shape.TestPoint(this.m_body.GetTransform(), t)
- }, t.prototype.ComputeDistance = function(t, e, i) {
- return this.m_shape.ComputeDistance(this.m_body.GetTransform(), t, e, i)
- }, t.prototype.RayCast = function(t, e, i) {
- return this.m_shape.RayCast(t, e, this.m_body.GetTransform(), i)
- }, t.prototype.GetMassData = function(t) {
- return void 0 === t && (t = new Ze), this.m_shape.ComputeMass(t, this.m_density), t
- }, t.prototype.SetDensity = function(t) {
- this.m_density = t
- }, t.prototype.GetDensity = function() {
- return this.m_density
- }, t.prototype.GetFriction = function() {
- return this.m_friction
- }, t.prototype.SetFriction = function(t) {
- this.m_friction = t
- }, t.prototype.GetRestitution = function() {
- return this.m_restitution
- }, t.prototype.SetRestitution = function(t) {
- this.m_restitution = t
- }, t.prototype.GetAABB = function(t) {
- return this.m_proxies[t].aabb
- }, t.prototype.Dump = function(t, e) {
- t(" const fd: b2FixtureDef = new b2FixtureDef();\n"), t(" fd.friction = %.15f;\n", this.m_friction), t(" fd.restitution = %.15f;\n", this.m_restitution), t(" fd.density = %.15f;\n", this.m_density), t(" fd.isSensor = %s;\n", this.m_isSensor ? "true" : "false"), t(" fd.filter.categoryBits = %d;\n", this.m_filter.categoryBits), t(" fd.filter.maskBits = %d;\n", this.m_filter.maskBits), t(" fd.filter.groupIndex = %d;\n", this.m_filter.groupIndex), this.m_shape.Dump(t), t("\n"), t(" fd.shape = shape;\n"), t("\n"), t(" bodies[%d].CreateFixture(fd);\n", e)
- }, t.prototype.Create = function(t) {
- var i = this;
- this.m_userData = t.userData, this.m_friction = e(t.friction, .2), this.m_restitution = e(t.restitution, 0), this.m_next = null, this.m_filter.Copy(e(t.filter, ri.DEFAULT)), this.m_isSensor = e(t.isSensor, !1), this.m_proxies = d(this.m_shape.GetChildCount(), (function(t) {
- return new oi(i)
- })), this.m_proxyCount = 0, this.m_density = e(t.density, 0)
- }, t.prototype.Destroy = function() {}, t.prototype.CreateProxies = function(t) {
- var e = this.m_body.m_world.m_contactManager.m_broadPhase;
- this.m_proxyCount = this.m_shape.GetChildCount();
- for (var i = 0; i < this.m_proxyCount; ++i) {
- var n = this.m_proxies[i] = new oi(this);
- this.m_shape.ComputeAABB(n.aabb, t, i), n.treeNode = e.CreateProxy(n.aabb, n), n.childIndex = i
- }
- }, t.prototype.DestroyProxies = function() {
- for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = 0; e < this.m_proxyCount; ++e) {
- var i = this.m_proxies[e];
- delete i.treeNode.userData, t.DestroyProxy(i.treeNode), delete i.treeNode
- }
- this.m_proxyCount = 0
- }, t.prototype.TouchProxies = function() {
- for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = this.m_proxyCount, i = 0; i < e; ++i) t.TouchProxy(this.m_proxies[i].treeNode)
- }, t.prototype.Synchronize = function(e, i) {
- if (0 !== this.m_proxyCount)
- for (var n = this.m_body.m_world.m_contactManager.m_broadPhase, r = 0; r < this.m_proxyCount; ++r) {
- var s = this.m_proxies[r],
- o = t.Synchronize_s_aabb1,
- a = t.Synchronize_s_aabb2;
- this.m_shape.ComputeAABB(o, e, r), this.m_shape.ComputeAABB(a, i, r), s.aabb.Combine2(o, a);
- var l = P.SubVV(i.p, e.p, t.Synchronize_s_displacement);
- n.MoveProxy(s.treeNode, s.aabb, l)
- }
- }, t.Synchronize_s_aabb1 = new wt, t.Synchronize_s_aabb2 = new wt, t.Synchronize_s_displacement = new P, t
- })();
- (function(t) {
- t[t.b2_unknown = -1] = "b2_unknown", t[t.b2_staticBody = 0] = "b2_staticBody", t[t.b2_kinematicBody = 1] = "b2_kinematicBody", t[t.b2_dynamicBody = 2] = "b2_dynamicBody"
- })(t.b2BodyType || (t.b2BodyType = {}));
- var li = (function() {
- return function() {
- this.type = t.b2BodyType.b2_staticBody, this.position = new P(0, 0), this.angle = 0, this.linearVelocity = new P(0, 0), this.angularVelocity = 0, this.linearDamping = 0, this.angularDamping = 0, this.allowSleep = !0, this.awake = !0, this.fixedRotation = !1, this.bullet = !1, this.active = !0, this.userData = null, this.gravityScale = 1
- }
- })(),
- hi = (function() {
- function i(i, n) {
- this.m_type = t.b2BodyType.b2_staticBody, this.m_islandFlag = !1, this.m_awakeFlag = !1, this.m_autoSleepFlag = !1, this.m_bulletFlag = !1, this.m_fixedRotationFlag = !1, this.m_activeFlag = !1, this.m_toiFlag = !1, this.m_islandIndex = 0, this.m_xf = new V, this.m_xf0 = new V, this.m_sweep = new k, this.m_linearVelocity = new P, this.m_angularVelocity = 0, this.m_force = new P, this.m_torque = 0, this.m_prev = null, this.m_next = null, this.m_fixtureList = null, this.m_fixtureCount = 0, this.m_jointList = null, this.m_contactList = null, this.m_mass = 1, this.m_invMass = 1, this.m_I = 0, this.m_invI = 0, this.m_linearDamping = 0, this.m_angularDamping = 0, this.m_gravityScale = 1, this.m_sleepTime = 0, this.m_userData = null, this.m_controllerList = null, this.m_controllerCount = 0, this.m_bulletFlag = e(i.bullet, !1), this.m_fixedRotationFlag = e(i.fixedRotation, !1), this.m_autoSleepFlag = e(i.allowSleep, !0), this.m_awakeFlag = e(i.awake, !0), this.m_activeFlag = e(i.active, !0), this.m_world = n, this.m_xf.p.Copy(e(i.position, P.ZERO)), this.m_xf.q.SetAngle(e(i.angle, 0)), this.m_xf0.Copy(this.m_xf), this.m_sweep.localCenter.SetZero(), this.m_sweep.c0.Copy(this.m_xf.p), this.m_sweep.c.Copy(this.m_xf.p), this.m_sweep.a0 = this.m_sweep.a = this.m_xf.q.GetAngle(), this.m_sweep.alpha0 = 0, this.m_linearVelocity.Copy(e(i.linearVelocity, P.ZERO)), this.m_angularVelocity = e(i.angularVelocity, 0), this.m_linearDamping = e(i.linearDamping, 0), this.m_angularDamping = e(i.angularDamping, 0), this.m_gravityScale = e(i.gravityScale, 1), this.m_force.SetZero(), this.m_torque = 0, this.m_sleepTime = 0, this.m_type = e(i.type, t.b2BodyType.b2_staticBody), i.type === t.b2BodyType.b2_dynamicBody ? (this.m_mass = 1, this.m_invMass = 1) : (this.m_mass = 0, this.m_invMass = 0), this.m_I = 0, this.m_invI = 0, this.m_userData = i.userData, this.m_fixtureList = null, this.m_fixtureCount = 0, this.m_controllerList = null, this.m_controllerCount = 0
- }
- return i.prototype.CreateFixture = function(t, e) {
- return void 0 === e && (e = 0), t instanceof Ke ? this.CreateFixtureShapeDensity(t, e) : this.CreateFixtureDef(t)
- }, i.prototype.CreateFixtureDef = function(t) {
- if (this.m_world.IsLocked()) throw new Error;
- var e = new ai(t, this);
- return e.Create(t), this.m_activeFlag && e.CreateProxies(this.m_xf), e.m_next = this.m_fixtureList, this.m_fixtureList = e, ++this.m_fixtureCount, e.m_density > 0 && this.ResetMassData(), this.m_world.m_newFixture = !0, e
- }, i.prototype.CreateFixtureShapeDensity = function(t, e) {
- void 0 === e && (e = 0);
- var n = i.CreateFixtureShapeDensity_s_def;
- return n.shape = t, n.density = e, this.CreateFixtureDef(n)
- }, i.prototype.DestroyFixture = function(t) {
- if (this.m_world.IsLocked()) throw new Error;
- for (var e = this.m_fixtureList, i = null; null !== e;) {
- if (e === t) {
- i ? i.m_next = t.m_next : this.m_fixtureList = t.m_next;
- break
- }
- i = e, e = e.m_next
- }
- for (var n = this.m_contactList; n;) {
- var r = n.contact;
- n = n.next;
- var s = r.GetFixtureA(),
- o = r.GetFixtureB();
- t !== s && t !== o || this.m_world.m_contactManager.Destroy(r)
- }
- this.m_activeFlag && t.DestroyProxies(), t.m_next = null, t.Destroy(), --this.m_fixtureCount, this.ResetMassData()
- }, i.prototype.SetTransformVec = function(t, e) {
- this.SetTransformXY(t.x, t.y, e)
- }, i.prototype.SetTransformXY = function(t, e, i) {
- if (this.m_world.IsLocked()) throw new Error;
- this.m_xf.q.SetAngle(i), this.m_xf.p.Set(t, e), this.m_xf0.Copy(this.m_xf), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.a = i, this.m_sweep.c0.Copy(this.m_sweep.c), this.m_sweep.a0 = i;
- for (var n = this.m_fixtureList; n; n = n.m_next) n.Synchronize(this.m_xf, this.m_xf);
- this.m_world.m_contactManager.FindNewContacts()
- }, i.prototype.SetTransform = function(t) {
- this.SetTransformVec(t.p, t.GetAngle())
- }, i.prototype.GetTransform = function() {
- return this.m_xf
- }, i.prototype.GetPosition = function() {
- return this.m_xf.p
- }, i.prototype.SetPosition = function(t) {
- this.SetTransformVec(t, this.GetAngle())
- }, i.prototype.SetPositionXY = function(t, e) {
- this.SetTransformXY(t, e, this.GetAngle())
- }, i.prototype.GetAngle = function() {
- return this.m_sweep.a
- }, i.prototype.SetAngle = function(t) {
- this.SetTransformVec(this.GetPosition(), t)
- }, i.prototype.GetWorldCenter = function() {
- return this.m_sweep.c
- }, i.prototype.GetLocalCenter = function() {
- return this.m_sweep.localCenter
- }, i.prototype.SetLinearVelocity = function(e) {
- this.m_type !== t.b2BodyType.b2_staticBody && (P.DotVV(e, e) > 0 && this.SetAwake(!0), this.m_linearVelocity.Copy(e))
- }, i.prototype.GetLinearVelocity = function() {
- return this.m_linearVelocity
- }, i.prototype.SetAngularVelocity = function(e) {
- this.m_type !== t.b2BodyType.b2_staticBody && (e * e > 0 && this.SetAwake(!0), this.m_angularVelocity = e)
- }, i.prototype.GetAngularVelocity = function() {
- return this.m_angularVelocity
- }, i.prototype.GetDefinition = function(t) {
- return t.type = this.GetType(), t.allowSleep = this.m_autoSleepFlag, t.angle = this.GetAngle(), t.angularDamping = this.m_angularDamping, t.gravityScale = this.m_gravityScale, t.angularVelocity = this.m_angularVelocity, t.fixedRotation = this.m_fixedRotationFlag, t.bullet = this.m_bulletFlag, t.awake = this.m_awakeFlag, t.linearDamping = this.m_linearDamping, t.linearVelocity.Copy(this.GetLinearVelocity()), t.position.Copy(this.GetPosition()), t.userData = this.GetUserData(), t
- }, i.prototype.ApplyForce = function(e, i, n) {
- void 0 === n && (n = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_force.x += e.x, this.m_force.y += e.y, this.m_torque += (i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x))
- }, i.prototype.ApplyForceToCenter = function(e, i) {
- void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_force.x += e.x, this.m_force.y += e.y))
- }, i.prototype.ApplyTorque = function(e, i) {
- void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_torque += e))
- }, i.prototype.ApplyLinearImpulse = function(e, i, n) {
- void 0 === n && (n = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, this.m_linearVelocity.y += this.m_invMass * e.y, this.m_angularVelocity += this.m_invI * ((i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x)))
- }, i.prototype.ApplyLinearImpulseToCenter = function(e, i) {
- void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, this.m_linearVelocity.y += this.m_invMass * e.y))
- }, i.prototype.ApplyAngularImpulse = function(e, i) {
- void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_angularVelocity += this.m_invI * e))
- }, i.prototype.GetMass = function() {
- return this.m_mass
- }, i.prototype.GetInertia = function() {
- return this.m_I + this.m_mass * P.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter)
- }, i.prototype.GetMassData = function(t) {
- return t.mass = this.m_mass, t.I = this.m_I + this.m_mass * P.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter), t.center.Copy(this.m_sweep.localCenter), t
- }, i.prototype.SetMassData = function(e) {
- if (this.m_world.IsLocked()) throw new Error;
- if (this.m_type === t.b2BodyType.b2_dynamicBody) {
- this.m_invMass = 0, this.m_I = 0, this.m_invI = 0, this.m_mass = e.mass, this.m_mass <= 0 && (this.m_mass = 1), this.m_invMass = 1 / this.m_mass, e.I > 0 && !this.m_fixedRotationFlag && (this.m_I = e.I - this.m_mass * P.DotVV(e.center, e.center), this.m_invI = 1 / this.m_I);
- var n = i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);
- this.m_sweep.localCenter.Copy(e.center), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.c0.Copy(this.m_sweep.c), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(this.m_sweep.c, n, P.s_t0), this.m_linearVelocity)
- }
- }, i.prototype.ResetMassData = function() {
- if (this.m_mass = 0, this.m_invMass = 0, this.m_I = 0, this.m_invI = 0, this.m_sweep.localCenter.SetZero(), this.m_type === t.b2BodyType.b2_staticBody || this.m_type === t.b2BodyType.b2_kinematicBody) return this.m_sweep.c0.Copy(this.m_xf.p), this.m_sweep.c.Copy(this.m_xf.p), void(this.m_sweep.a0 = this.m_sweep.a);
- for (var e = i.ResetMassData_s_localCenter.SetZero(), n = this.m_fixtureList; n; n = n.m_next)
- if (0 !== n.m_density) {
- var r = n.GetMassData(i.ResetMassData_s_massData);
- this.m_mass += r.mass, e.x += r.center.x * r.mass, e.y += r.center.y * r.mass, this.m_I += r.I
- }
- this.m_mass > 0 ? (this.m_invMass = 1 / this.m_mass, e.x *= this.m_invMass, e.y *= this.m_invMass) : (this.m_mass = 1, this.m_invMass = 1), this.m_I > 0 && !this.m_fixedRotationFlag ? (this.m_I -= this.m_mass * P.DotVV(e, e), this.m_invI = 1 / this.m_I) : (this.m_I = 0, this.m_invI = 0);
- var s = i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);
- this.m_sweep.localCenter.Copy(e), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.c0.Copy(this.m_sweep.c), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(this.m_sweep.c, s, P.s_t0), this.m_linearVelocity)
- }, i.prototype.GetWorldPoint = function(t, e) {
- return V.MulXV(this.m_xf, t, e)
- }, i.prototype.GetWorldVector = function(t, e) {
- return N.MulRV(this.m_xf.q, t, e)
- }, i.prototype.GetLocalPoint = function(t, e) {
- return V.MulTXV(this.m_xf, t, e)
- }, i.prototype.GetLocalVector = function(t, e) {
- return N.MulTRV(this.m_xf.q, t, e)
- }, i.prototype.GetLinearVelocityFromWorldPoint = function(t, e) {
- return P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(t, this.m_sweep.c, P.s_t0), e)
- }, i.prototype.GetLinearVelocityFromLocalPoint = function(t, e) {
- return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t, e), e)
- }, i.prototype.GetLinearDamping = function() {
- return this.m_linearDamping
- }, i.prototype.SetLinearDamping = function(t) {
- this.m_linearDamping = t
- }, i.prototype.GetAngularDamping = function() {
- return this.m_angularDamping
- }, i.prototype.SetAngularDamping = function(t) {
- this.m_angularDamping = t
- }, i.prototype.GetGravityScale = function() {
- return this.m_gravityScale
- }, i.prototype.SetGravityScale = function(t) {
- this.m_gravityScale = t
- }, i.prototype.SetType = function(e) {
- if (this.m_world.IsLocked()) throw new Error;
- if (this.m_type !== e) {
- this.m_type = e, this.ResetMassData(), this.m_type === t.b2BodyType.b2_staticBody && (this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0, this.m_sweep.a0 = this.m_sweep.a, this.m_sweep.c0.Copy(this.m_sweep.c), this.SynchronizeFixtures()), this.SetAwake(!0), this.m_force.SetZero(), this.m_torque = 0;
- for (var i = this.m_contactList; i;) {
- var n = i;
- i = i.next, this.m_world.m_contactManager.Destroy(n.contact)
- }
- this.m_contactList = null;
- for (var r = this.m_fixtureList; r; r = r.m_next) r.TouchProxies()
- }
- }, i.prototype.GetType = function() {
- return this.m_type
- }, i.prototype.SetBullet = function(t) {
- this.m_bulletFlag = t
- }, i.prototype.IsBullet = function() {
- return this.m_bulletFlag
- }, i.prototype.SetSleepingAllowed = function(t) {
- this.m_autoSleepFlag = t, t || this.SetAwake(!0)
- }, i.prototype.IsSleepingAllowed = function() {
- return this.m_autoSleepFlag
- }, i.prototype.SetAwake = function(t) {
- t ? (this.m_awakeFlag = !0, this.m_sleepTime = 0) : (this.m_awakeFlag = !1, this.m_sleepTime = 0, this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0, this.m_force.SetZero(), this.m_torque = 0)
- }, i.prototype.IsAwake = function() {
- return this.m_awakeFlag
- }, i.prototype.SetActive = function(t) {
- if (this.m_world.IsLocked()) throw new Error;
- if (t !== this.IsActive())
- if (this.m_activeFlag = t, t)
- for (var e = this.m_fixtureList; e; e = e.m_next) e.CreateProxies(this.m_xf);
- else {
- for (e = this.m_fixtureList; e; e = e.m_next) e.DestroyProxies();
- for (var i = this.m_contactList; i;) {
- var n = i;
- i = i.next, this.m_world.m_contactManager.Destroy(n.contact)
- }
- this.m_contactList = null
- }
- }, i.prototype.IsActive = function() {
- return this.m_activeFlag
- }, i.prototype.SetFixedRotation = function(t) {
- this.m_fixedRotationFlag !== t && (this.m_fixedRotationFlag = t, this.m_angularVelocity = 0, this.ResetMassData())
- }, i.prototype.IsFixedRotation = function() {
- return this.m_fixedRotationFlag
- }, i.prototype.GetFixtureList = function() {
- return this.m_fixtureList
- }, i.prototype.GetJointList = function() {
- return this.m_jointList
- }, i.prototype.GetContactList = function() {
- return this.m_contactList
- }, i.prototype.GetNext = function() {
- return this.m_next
- }, i.prototype.GetUserData = function() {
- return this.m_userData
- }, i.prototype.SetUserData = function(t) {
- this.m_userData = t
- }, i.prototype.GetWorld = function() {
- return this.m_world
- }, i.prototype.Dump = function(e) {
- var i = this.m_islandIndex;
- e("{\n"), e(" const bd: b2BodyDef = new b2BodyDef();\n");
- var n = "";
- switch (this.m_type) {
- case t.b2BodyType.b2_staticBody:
- n = "b2BodyType.b2_staticBody";
- break;
- case t.b2BodyType.b2_kinematicBody:
- n = "b2BodyType.b2_kinematicBody";
- break;
- case t.b2BodyType.b2_dynamicBody:
- n = "b2BodyType.b2_dynamicBody"
- }
- e(" bd.type = %s;\n", n), e(" bd.position.Set(%.15f, %.15f);\n", this.m_xf.p.x, this.m_xf.p.y), e(" bd.angle = %.15f;\n", this.m_sweep.a), e(" bd.linearVelocity.Set(%.15f, %.15f);\n", this.m_linearVelocity.x, this.m_linearVelocity.y), e(" bd.angularVelocity = %.15f;\n", this.m_angularVelocity), e(" bd.linearDamping = %.15f;\n", this.m_linearDamping), e(" bd.angularDamping = %.15f;\n", this.m_angularDamping), e(" bd.allowSleep = %s;\n", this.m_autoSleepFlag ? "true" : "false"), e(" bd.awake = %s;\n", this.m_awakeFlag ? "true" : "false"), e(" bd.fixedRotation = %s;\n", this.m_fixedRotationFlag ? "true" : "false"), e(" bd.bullet = %s;\n", this.m_bulletFlag ? "true" : "false"), e(" bd.active = %s;\n", this.m_activeFlag ? "true" : "false"), e(" bd.gravityScale = %.15f;\n", this.m_gravityScale), e("\n"), e(" bodies[%d] = this.m_world.CreateBody(bd);\n", this.m_islandIndex), e("\n");
- for (var r = this.m_fixtureList; r; r = r.m_next) e(" {\n"), r.Dump(e, i), e(" }\n");
- e("}\n")
- }, i.prototype.SynchronizeFixtures = function() {
- var t = i.SynchronizeFixtures_s_xf1;
- t.q.SetAngle(this.m_sweep.a0), N.MulRV(t.q, this.m_sweep.localCenter, t.p), P.SubVV(this.m_sweep.c0, t.p, t.p);
- for (var e = this.m_fixtureList; e; e = e.m_next) e.Synchronize(t, this.m_xf)
- }, i.prototype.SynchronizeTransform = function() {
- this.m_xf.q.SetAngle(this.m_sweep.a), N.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), P.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p)
- }, i.prototype.ShouldCollide = function(e) {
- return (this.m_type !== t.b2BodyType.b2_staticBody || e.m_type !== t.b2BodyType.b2_staticBody) && this.ShouldCollideConnected(e)
- }, i.prototype.ShouldCollideConnected = function(t) {
- for (var e = this.m_jointList; e; e = e.next)
- if (e.other === t && !e.joint.m_collideConnected) return !1;
- return !0
- }, i.prototype.Advance = function(t) {
- this.m_sweep.Advance(t), this.m_sweep.c.Copy(this.m_sweep.c0), this.m_sweep.a = this.m_sweep.a0, this.m_xf.q.SetAngle(this.m_sweep.a), N.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), P.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p)
- }, i.prototype.GetControllerList = function() {
- return this.m_controllerList
- }, i.prototype.GetControllerCount = function() {
- return this.m_controllerCount
- }, i.CreateFixtureShapeDensity_s_def = new si, i.SetMassData_s_oldCenter = new P, i.ResetMassData_s_localCenter = new P, i.ResetMassData_s_oldCenter = new P, i.ResetMassData_s_massData = new Ze, i.SynchronizeFixtures_s_xf1 = new V, i
- })();
- (function(t) {
- t[t.e_unknownJoint = 0] = "e_unknownJoint", t[t.e_revoluteJoint = 1] = "e_revoluteJoint", t[t.e_prismaticJoint = 2] = "e_prismaticJoint", t[t.e_distanceJoint = 3] = "e_distanceJoint", t[t.e_pulleyJoint = 4] = "e_pulleyJoint", t[t.e_mouseJoint = 5] = "e_mouseJoint", t[t.e_gearJoint = 6] = "e_gearJoint", t[t.e_wheelJoint = 7] = "e_wheelJoint", t[t.e_weldJoint = 8] = "e_weldJoint", t[t.e_frictionJoint = 9] = "e_frictionJoint", t[t.e_ropeJoint = 10] = "e_ropeJoint", t[t.e_motorJoint = 11] = "e_motorJoint", t[t.e_areaJoint = 12] = "e_areaJoint"
- })(t.b2JointType || (t.b2JointType = {})), (function(t) {
- t[t.e_inactiveLimit = 0] = "e_inactiveLimit", t[t.e_atLowerLimit = 1] = "e_atLowerLimit", t[t.e_atUpperLimit = 2] = "e_atUpperLimit", t[t.e_equalLimits = 3] = "e_equalLimits"
- })(t.b2LimitState || (t.b2LimitState = {}));
- var ci = (function() {
- function t() {
- this.linear = new P, this.angularA = 0, this.angularB = 0
- }
- return t.prototype.SetZero = function() {
- return this.linear.SetZero(), this.angularA = 0, this.angularB = 0, this
- }, t.prototype.Set = function(t, e, i) {
- return this.linear.Copy(t), this.angularA = e, this.angularB = i, this
- }, t
- })(),
- ui = (function() {
- return function(t, e) {
- this.prev = null, this.next = null, this.joint = t, this.other = e
- }
- })(),
- _i = (function() {
- return function(e) {
- this.type = t.b2JointType.e_unknownJoint, this.userData = null, this.collideConnected = !1, this.type = e
- }
- })(),
- fi = (function() {
- function i(i) {
- this.m_type = t.b2JointType.e_unknownJoint, this.m_prev = null, this.m_next = null, this.m_index = 0, this.m_islandFlag = !1, this.m_collideConnected = !1, this.m_userData = null, this.m_type = i.type, this.m_edgeA = new ui(this, i.bodyB), this.m_edgeB = new ui(this, i.bodyA), this.m_bodyA = i.bodyA, this.m_bodyB = i.bodyB, this.m_collideConnected = e(i.collideConnected, !1), this.m_userData = i.userData
- }
- return i.prototype.GetType = function() {
- return this.m_type
- }, i.prototype.GetBodyA = function() {
- return this.m_bodyA
- }, i.prototype.GetBodyB = function() {
- return this.m_bodyB
- }, i.prototype.GetNext = function() {
- return this.m_next
- }, i.prototype.GetUserData = function() {
- return this.m_userData
- }, i.prototype.SetUserData = function(t) {
- this.m_userData = t
- }, i.prototype.IsActive = function() {
- return this.m_bodyA.IsActive() && this.m_bodyB.IsActive()
- }, i.prototype.GetCollideConnected = function() {
- return this.m_collideConnected
- }, i.prototype.Dump = function(t) {
- t("// Dump is not supported for this joint type.\n")
- }, i.prototype.ShiftOrigin = function(t) {}, i
- })(),
- di = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_distanceJoint) || this;
- return i.localAnchorA = new P, i.localAnchorB = new P, i.length = 1, i.frequencyHz = 0, i.dampingRatio = 0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(n, this.localAnchorB), this.length = P.DistanceVV(i, n), this.frequencyHz = 0, this.dampingRatio = 0
- }, i
- })(_i),
- pi = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_bias = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_gamma = 0, n.m_impulse = 0, n.m_length = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_u = new P, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_localAnchorA.Copy(i.localAnchorA), n.m_localAnchorB.Copy(i.localAnchorB), n.m_length = i.length, n
- }
- return $e(i, t), i.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return e.x = t * this.m_impulse * this.m_u.x, e.y = t * this.m_impulse * this.m_u.y, e
- }, i.prototype.GetReactionTorque = function(t) {
- return 0
- }, i.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, i.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, i.prototype.SetLength = function(t) {
- this.m_length = t
- }, i.prototype.Length = function() {
- return this.m_length
- }, i.prototype.SetFrequency = function(t) {
- this.m_frequencyHz = t
- }, i.prototype.GetFrequency = function() {
- return this.m_frequencyHz
- }, i.prototype.SetDampingRatio = function(t) {
- this.m_dampingRatio = t
- }, i.prototype.GetDampingRatio = function() {
- return this.m_dampingRatio
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.length = %.15f;\n", this.m_length), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.velocities[this.m_indexA].v,
- o = t.velocities[this.m_indexA].w,
- a = t.positions[this.m_indexB].c,
- h = t.positions[this.m_indexB].a,
- c = t.velocities[this.m_indexB].v,
- u = t.velocities[this.m_indexB].w,
- _ = this.m_qA.SetAngle(n),
- f = this.m_qB.SetAngle(h);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(_, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(f, this.m_lalcB, this.m_rB), this.m_u.x = a.x + this.m_rB.x - e.x - this.m_rA.x, this.m_u.y = a.y + this.m_rB.y - e.y - this.m_rA.y;
- var d = this.m_u.Length();
- d > l ? this.m_u.SelfMul(1 / d) : this.m_u.SetZero();
- var p = P.CrossVV(this.m_rA, this.m_u),
- m = P.CrossVV(this.m_rB, this.m_u),
- y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
- if (this.m_mass = 0 !== y ? 1 / y : 0, this.m_frequencyHz > 0) {
- var v = d - this.m_length,
- g = 2 * s * this.m_frequencyHz,
- x = 2 * this.m_mass * this.m_dampingRatio * g,
- b = this.m_mass * g * g,
- A = t.step.dt;
- this.m_gamma = A * (x + A * b), this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, this.m_bias = v * A * b * this.m_gamma, y += this.m_gamma, this.m_mass = 0 !== y ? 1 / y : 0
- } else this.m_gamma = 0, this.m_bias = 0;
- if (t.step.warmStarting) {
- this.m_impulse *= t.step.dtRatio;
- var C = P.MulSV(this.m_impulse, this.m_u, i.InitVelocityConstraints_s_P);
- r.SelfMulSub(this.m_invMassA, C), o -= this.m_invIA * P.CrossVV(this.m_rA, C), c.SelfMulAdd(this.m_invMassB, C), u += this.m_invIB * P.CrossVV(this.m_rB, C)
- } else this.m_impulse = 0;
- t.velocities[this.m_indexA].w = o, t.velocities[this.m_indexB].w = u
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = P.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA),
- a = P.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB),
- l = P.DotVV(this.m_u, P.SubVV(a, o, P.s_t0)),
- h = -this.m_mass * (l + this.m_bias + this.m_gamma * this.m_impulse);
- this.m_impulse += h;
- var c = P.MulSV(h, this.m_u, i.SolveVelocityConstraints_s_P);
- e.SelfMulSub(this.m_invMassA, c), n -= this.m_invIA * P.CrossVV(this.m_rA, c), r.SelfMulAdd(this.m_invMassB, c), s += this.m_invIB * P.CrossVV(this.m_rB, c), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
- }, i.prototype.SolvePositionConstraints = function(t) {
- if (this.m_frequencyHz > 0) return !0;
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(n),
- a = this.m_qB.SetAngle(s),
- h = N.MulRV(o, this.m_lalcA, this.m_rA),
- c = N.MulRV(a, this.m_lalcB, this.m_rB),
- u = this.m_u;
- u.x = r.x + c.x - e.x - h.x, u.y = r.y + c.y - e.y - h.y;
- var _ = this.m_u.Normalize() - this.m_length;
- _ = b(_, -.2, .2);
- var f = -this.m_mass * _,
- d = P.MulSV(f, u, i.SolvePositionConstraints_s_P);
- return e.SelfMulSub(this.m_invMassA, d), n -= this.m_invIA * P.CrossVV(h, d), r.SelfMulAdd(this.m_invMassB, d), s += this.m_invIB * P.CrossVV(c, d), t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, v(_) < l
- }, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_vpA = new P, i.SolveVelocityConstraints_s_vpB = new P, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_P = new P, i
- })(fi),
- mi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_areaJoint) || this;
- return i.bodies = [], i.frequencyHz = 0, i.dampingRatio = 0, i
- }
- return $e(i, e), i.prototype.AddBody = function(t) {
- this.bodies.push(t), 1 === this.bodies.length ? this.bodyA = t : 2 === this.bodies.length && (this.bodyB = t)
- }, i
- })(_i),
- yi = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_impulse = 0, n.m_targetArea = 0, n.m_bodies = i.bodies, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_targetLengths = p(i.bodies.length), n.m_normals = P.MakeArray(i.bodies.length), n.m_joints = [], n.m_deltas = P.MakeArray(i.bodies.length), n.m_delta = new P;
- var r = new di;
- r.frequencyHz = n.m_frequencyHz, r.dampingRatio = n.m_dampingRatio, n.m_targetArea = 0;
- for (var s = 0; s < n.m_bodies.length; ++s) {
- var o = n.m_bodies[s],
- a = n.m_bodies[(s + 1) % n.m_bodies.length],
- l = o.GetWorldCenter(),
- h = a.GetWorldCenter();
- n.m_targetLengths[s] = P.DistanceVV(l, h), n.m_targetArea += P.CrossVV(l, h), r.Initialize(o, a, l, h), n.m_joints[s] = o.GetWorld().CreateJoint(r)
- }
- return n.m_targetArea *= .5, n
- }
- return $e(i, t), i.prototype.GetAnchorA = function(t) {
- return t
- }, i.prototype.GetAnchorB = function(t) {
- return t
- }, i.prototype.GetReactionForce = function(t, e) {
- return e
- }, i.prototype.GetReactionTorque = function(t) {
- return 0
- }, i.prototype.SetFrequency = function(t) {
- this.m_frequencyHz = t;
- for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetFrequency(t)
- }, i.prototype.GetFrequency = function() {
- return this.m_frequencyHz
- }, i.prototype.SetDampingRatio = function(t) {
- this.m_dampingRatio = t;
- for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetDampingRatio(t)
- }, i.prototype.GetDampingRatio = function() {
- return this.m_dampingRatio
- }, i.prototype.Dump = function(t) {
- t("Area joint dumping is not supported.\n")
- }, i.prototype.InitVelocityConstraints = function(t) {
- for (var e = 0; e < this.m_bodies.length; ++e) {
- var i = this.m_bodies[(e + this.m_bodies.length - 1) % this.m_bodies.length],
- n = this.m_bodies[(e + 1) % this.m_bodies.length],
- r = t.positions[i.m_islandIndex].c,
- s = t.positions[n.m_islandIndex].c,
- o = this.m_deltas[e];
- P.SubVV(s, r, o)
- }
- if (t.step.warmStarting) {
- this.m_impulse *= t.step.dtRatio;
- for (e = 0; e < this.m_bodies.length; ++e) {
- var a = this.m_bodies[e],
- l = t.velocities[a.m_islandIndex].v;
- o = this.m_deltas[e];
- l.x += a.m_invMass * o.y * .5 * this.m_impulse, l.y += a.m_invMass * -o.x * .5 * this.m_impulse
- }
- } else this.m_impulse = 0
- }, i.prototype.SolveVelocityConstraints = function(t) {
- for (var e = 0, i = 0, n = 0; n < this.m_bodies.length; ++n) {
- var r = this.m_bodies[n],
- s = t.velocities[r.m_islandIndex].v;
- e += (a = this.m_deltas[n]).LengthSquared() / r.GetMass(), i += P.CrossVV(s, a)
- }
- var o = -2 * i / e;
- this.m_impulse += o;
- for (n = 0; n < this.m_bodies.length; ++n) {
- r = this.m_bodies[n], s = t.velocities[r.m_islandIndex].v;
- var a = this.m_deltas[n];
- s.x += r.m_invMass * a.y * .5 * o, s.y += r.m_invMass * -a.x * .5 * o
- }
- }, i.prototype.SolvePositionConstraints = function(t) {
- for (var e = 0, i = 0, r = 0; r < this.m_bodies.length; ++r) {
- var s = this.m_bodies[r],
- o = this.m_bodies[(r + 1) % this.m_bodies.length],
- a = t.positions[s.m_islandIndex].c,
- h = t.positions[o.m_islandIndex].c,
- c = (f = P.SubVV(h, a, this.m_delta)).Length();
- c < n && (c = 1), this.m_normals[r].x = f.y / c, this.m_normals[r].y = -f.x / c, e += c, i += P.CrossVV(a, h)
- }
- i *= .5;
- var u = .5 * (this.m_targetArea - i) / e,
- _ = !0;
- for (r = 0; r < this.m_bodies.length; ++r) {
- s = this.m_bodies[r], a = t.positions[s.m_islandIndex].c;
- var f, d = (r + 1) % this.m_bodies.length;
- (f = P.AddVV(this.m_normals[r], this.m_normals[d], this.m_delta)).SelfMul(u);
- var p = f.LengthSquared();
- p > C(.2) && f.SelfMul(.2 / S(p)), p > C(l) && (_ = !1), a.x += f.x, a.y += f.y
- }
- return _
- }, i
- })(fi),
- vi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_frictionJoint) || this;
- return i.localAnchorA = new P, i.localAnchorB = new P, i.maxForce = 0, i.maxTorque = 0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB)
- }, i
- })(_i),
- gi = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_linearImpulse = new P, n.m_angularImpulse = 0, n.m_maxForce = 0, n.m_maxTorque = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_linearMass = new L, n.m_angularMass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_K = new L, n.m_localAnchorA.Copy(i.localAnchorA), n.m_localAnchorB.Copy(i.localAnchorB), n.m_linearImpulse.SetZero(), n.m_maxForce = e(i.maxForce, 0), n.m_maxTorque = e(i.maxTorque, 0), n.m_linearMass.SetZero(), n
- }
- return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexA].a,
- i = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.positions[this.m_indexB].a,
- s = t.velocities[this.m_indexB].v,
- o = t.velocities[this.m_indexB].w,
- a = this.m_qA.SetAngle(e),
- l = this.m_qB.SetAngle(r);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var h = N.MulRV(a, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var c = N.MulRV(l, this.m_lalcB, this.m_rB),
- u = this.m_invMassA,
- _ = this.m_invMassB,
- f = this.m_invIA,
- d = this.m_invIB,
- p = this.m_K;
- if (p.ex.x = u + _ + f * h.y * h.y + d * c.y * c.y, p.ex.y = -f * h.x * h.y - d * c.x * c.y, p.ey.x = p.ex.y, p.ey.y = u + _ + f * h.x * h.x + d * c.x * c.x, p.GetInverse(this.m_linearMass), this.m_angularMass = f + d, this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), t.step.warmStarting) {
- this.m_linearImpulse.SelfMul(t.step.dtRatio), this.m_angularImpulse *= t.step.dtRatio;
- var m = this.m_linearImpulse;
- i.SelfMulSub(u, m), n -= f * (P.CrossVV(this.m_rA, m) + this.m_angularImpulse), s.SelfMulAdd(_, m), o += d * (P.CrossVV(this.m_rB, m) + this.m_angularImpulse)
- } else this.m_linearImpulse.SetZero(), this.m_angularImpulse = 0;
- t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = o
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = this.m_invMassA,
- a = this.m_invMassB,
- l = this.m_invIA,
- h = this.m_invIB,
- c = t.step.dt,
- u = s - n,
- _ = -this.m_angularMass * u,
- f = this.m_angularImpulse,
- d = c * this.m_maxTorque;
- this.m_angularImpulse = b(this.m_angularImpulse + _, -d, d), n -= l * (_ = this.m_angularImpulse - f), s += h * _;
- var p = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot_v2),
- m = L.MulMV(this.m_linearMass, p, i.SolveVelocityConstraints_s_impulseV).SelfNeg(),
- y = i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);
- this.m_linearImpulse.SelfAdd(m);
- d = c * this.m_maxForce;
- this.m_linearImpulse.LengthSquared() > d * d && (this.m_linearImpulse.Normalize(), this.m_linearImpulse.SelfMul(d)), P.SubVV(this.m_linearImpulse, y, m), e.SelfMulSub(o, m), n -= l * P.CrossVV(this.m_rA, m), r.SelfMulAdd(a, m), s += h * P.CrossVV(this.m_rB, m), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
- }, i.prototype.SolvePositionConstraints = function(t) {
- return !0
- }, i.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return e.x = t * this.m_linearImpulse.x, e.y = t * this.m_linearImpulse.y, e
- }, i.prototype.GetReactionTorque = function(t) {
- return t * this.m_angularImpulse
- }, i.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, i.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, i.prototype.SetMaxForce = function(t) {
- this.m_maxForce = t
- }, i.prototype.GetMaxForce = function() {
- return this.m_maxForce
- }, i.prototype.SetMaxTorque = function(t) {
- this.m_maxTorque = t
- }, i.prototype.GetMaxTorque = function() {
- return this.m_maxTorque
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.maxForce = %.15f;\n", this.m_maxForce), t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.SolveVelocityConstraints_s_Cdot_v2 = new P, i.SolveVelocityConstraints_s_impulseV = new P, i.SolveVelocityConstraints_s_oldImpulseV = new P, i
- })(fi),
- xi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_gearJoint) || this;
- return i.ratio = 1, i
- }
- return $e(i, e), i
- })(_i),
- bi = (function(i) {
- function n(n) {
- var r, s, o = i.call(this, n) || this;
- o.m_typeA = t.b2JointType.e_unknownJoint, o.m_typeB = t.b2JointType.e_unknownJoint, o.m_localAnchorA = new P, o.m_localAnchorB = new P, o.m_localAnchorC = new P, o.m_localAnchorD = new P, o.m_localAxisC = new P, o.m_localAxisD = new P, o.m_referenceAngleA = 0, o.m_referenceAngleB = 0, o.m_constant = 0, o.m_ratio = 0, o.m_impulse = 0, o.m_indexA = 0, o.m_indexB = 0, o.m_indexC = 0, o.m_indexD = 0, o.m_lcA = new P, o.m_lcB = new P, o.m_lcC = new P, o.m_lcD = new P, o.m_mA = 0, o.m_mB = 0, o.m_mC = 0, o.m_mD = 0, o.m_iA = 0, o.m_iB = 0, o.m_iC = 0, o.m_iD = 0, o.m_JvAC = new P, o.m_JvBD = new P, o.m_JwA = 0, o.m_JwB = 0, o.m_JwC = 0, o.m_JwD = 0, o.m_mass = 0, o.m_qA = new N, o.m_qB = new N, o.m_qC = new N, o.m_qD = new N, o.m_lalcA = new P, o.m_lalcB = new P, o.m_lalcC = new P, o.m_lalcD = new P, o.m_joint1 = n.joint1, o.m_joint2 = n.joint2, o.m_typeA = o.m_joint1.GetType(), o.m_typeB = o.m_joint2.GetType(), o.m_bodyC = o.m_joint1.GetBodyA(), o.m_bodyA = o.m_joint1.GetBodyB();
- var a = o.m_bodyA.m_xf,
- l = o.m_bodyA.m_sweep.a,
- h = o.m_bodyC.m_xf,
- c = o.m_bodyC.m_sweep.a;
- if (o.m_typeA === t.b2JointType.e_revoluteJoint) {
- var u = n.joint1;
- o.m_localAnchorC.Copy(u.m_localAnchorA), o.m_localAnchorA.Copy(u.m_localAnchorB), o.m_referenceAngleA = u.m_referenceAngle, o.m_localAxisC.SetZero(), r = l - c - o.m_referenceAngleA
- } else {
- var _ = n.joint1;
- o.m_localAnchorC.Copy(_.m_localAnchorA), o.m_localAnchorA.Copy(_.m_localAnchorB), o.m_referenceAngleA = _.m_referenceAngle, o.m_localAxisC.Copy(_.m_localXAxisA);
- var f = o.m_localAnchorC,
- d = N.MulTRV(h.q, P.AddVV(N.MulRV(a.q, o.m_localAnchorA, P.s_t0), P.SubVV(a.p, h.p, P.s_t1), P.s_t0), P.s_t0);
- r = P.DotVV(P.SubVV(d, f, P.s_t0), o.m_localAxisC)
- }
- o.m_bodyD = o.m_joint2.GetBodyA(), o.m_bodyB = o.m_joint2.GetBodyB();
- var p = o.m_bodyB.m_xf,
- m = o.m_bodyB.m_sweep.a,
- y = o.m_bodyD.m_xf,
- v = o.m_bodyD.m_sweep.a;
- if (o.m_typeB === t.b2JointType.e_revoluteJoint) {
- u = n.joint2;
- o.m_localAnchorD.Copy(u.m_localAnchorA), o.m_localAnchorB.Copy(u.m_localAnchorB), o.m_referenceAngleB = u.m_referenceAngle, o.m_localAxisD.SetZero(), s = m - v - o.m_referenceAngleB
- } else {
- _ = n.joint2;
- o.m_localAnchorD.Copy(_.m_localAnchorA), o.m_localAnchorB.Copy(_.m_localAnchorB), o.m_referenceAngleB = _.m_referenceAngle, o.m_localAxisD.Copy(_.m_localXAxisA);
- var g = o.m_localAnchorD,
- x = N.MulTRV(y.q, P.AddVV(N.MulRV(p.q, o.m_localAnchorB, P.s_t0), P.SubVV(p.p, y.p, P.s_t1), P.s_t0), P.s_t0);
- s = P.DotVV(P.SubVV(x, g, P.s_t0), o.m_localAxisD)
- }
- return o.m_ratio = e(n.ratio, 1), o.m_constant = r + o.m_ratio * s, o.m_impulse = 0, o
- }
- return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_indexC = this.m_bodyC.m_islandIndex, this.m_indexD = this.m_bodyD.m_islandIndex, this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter), this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter), this.m_mA = this.m_bodyA.m_invMass, this.m_mB = this.m_bodyB.m_invMass, this.m_mC = this.m_bodyC.m_invMass, this.m_mD = this.m_bodyD.m_invMass, this.m_iA = this.m_bodyA.m_invI, this.m_iB = this.m_bodyB.m_invI, this.m_iC = this.m_bodyC.m_invI, this.m_iD = this.m_bodyD.m_invI;
- var i = e.positions[this.m_indexA].a,
- r = e.velocities[this.m_indexA].v,
- s = e.velocities[this.m_indexA].w,
- o = e.positions[this.m_indexB].a,
- a = e.velocities[this.m_indexB].v,
- l = e.velocities[this.m_indexB].w,
- h = e.positions[this.m_indexC].a,
- c = e.velocities[this.m_indexC].v,
- u = e.velocities[this.m_indexC].w,
- _ = e.positions[this.m_indexD].a,
- f = e.velocities[this.m_indexD].v,
- d = e.velocities[this.m_indexD].w,
- p = this.m_qA.SetAngle(i),
- m = this.m_qB.SetAngle(o),
- y = this.m_qC.SetAngle(h),
- v = this.m_qD.SetAngle(_);
- if (this.m_mass = 0, this.m_typeA === t.b2JointType.e_revoluteJoint) this.m_JvAC.SetZero(), this.m_JwA = 1, this.m_JwC = 1, this.m_mass += this.m_iA + this.m_iC;
- else {
- var g = N.MulRV(y, this.m_localAxisC, n.InitVelocityConstraints_s_u);
- P.SubVV(this.m_localAnchorC, this.m_lcC, this.m_lalcC);
- var x = N.MulRV(y, this.m_lalcC, n.InitVelocityConstraints_s_rC);
- P.SubVV(this.m_localAnchorA, this.m_lcA, this.m_lalcA);
- var b = N.MulRV(p, this.m_lalcA, n.InitVelocityConstraints_s_rA);
- this.m_JvAC.Copy(g), this.m_JwC = P.CrossVV(x, g), this.m_JwA = P.CrossVV(b, g), this.m_mass += this.m_mC + this.m_mA + this.m_iC * this.m_JwC * this.m_JwC + this.m_iA * this.m_JwA * this.m_JwA
- }
- if (this.m_typeB === t.b2JointType.e_revoluteJoint) this.m_JvBD.SetZero(), this.m_JwB = this.m_ratio, this.m_JwD = this.m_ratio, this.m_mass += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD);
- else {
- g = N.MulRV(v, this.m_localAxisD, n.InitVelocityConstraints_s_u);
- P.SubVV(this.m_localAnchorD, this.m_lcD, this.m_lalcD);
- var A = N.MulRV(v, this.m_lalcD, n.InitVelocityConstraints_s_rD);
- P.SubVV(this.m_localAnchorB, this.m_lcB, this.m_lalcB);
- var C = N.MulRV(m, this.m_lalcB, n.InitVelocityConstraints_s_rB);
- P.MulSV(this.m_ratio, g, this.m_JvBD), this.m_JwD = this.m_ratio * P.CrossVV(A, g), this.m_JwB = this.m_ratio * P.CrossVV(C, g), this.m_mass += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * this.m_JwD * this.m_JwD + this.m_iB * this.m_JwB * this.m_JwB
- }
- this.m_mass = this.m_mass > 0 ? 1 / this.m_mass : 0, e.step.warmStarting ? (r.SelfMulAdd(this.m_mA * this.m_impulse, this.m_JvAC), s += this.m_iA * this.m_impulse * this.m_JwA, a.SelfMulAdd(this.m_mB * this.m_impulse, this.m_JvBD), l += this.m_iB * this.m_impulse * this.m_JwB, c.SelfMulSub(this.m_mC * this.m_impulse, this.m_JvAC), u -= this.m_iC * this.m_impulse * this.m_JwC, f.SelfMulSub(this.m_mD * this.m_impulse, this.m_JvBD), d -= this.m_iD * this.m_impulse * this.m_JwD) : this.m_impulse = 0, e.velocities[this.m_indexA].w = s, e.velocities[this.m_indexB].w = l, e.velocities[this.m_indexC].w = u, e.velocities[this.m_indexD].w = d
- }, n.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- i = t.velocities[this.m_indexA].w,
- n = t.velocities[this.m_indexB].v,
- r = t.velocities[this.m_indexB].w,
- s = t.velocities[this.m_indexC].v,
- o = t.velocities[this.m_indexC].w,
- a = t.velocities[this.m_indexD].v,
- l = t.velocities[this.m_indexD].w,
- h = P.DotVV(this.m_JvAC, P.SubVV(e, s, P.s_t0)) + P.DotVV(this.m_JvBD, P.SubVV(n, a, P.s_t0));
- h += this.m_JwA * i - this.m_JwC * o + (this.m_JwB * r - this.m_JwD * l);
- var c = -this.m_mass * h;
- this.m_impulse += c, e.SelfMulAdd(this.m_mA * c, this.m_JvAC), i += this.m_iA * c * this.m_JwA, n.SelfMulAdd(this.m_mB * c, this.m_JvBD), r += this.m_iB * c * this.m_JwB, s.SelfMulSub(this.m_mC * c, this.m_JvAC), o -= this.m_iC * c * this.m_JwC, a.SelfMulSub(this.m_mD * c, this.m_JvBD), l -= this.m_iD * c * this.m_JwD, t.velocities[this.m_indexA].w = i, t.velocities[this.m_indexB].w = r, t.velocities[this.m_indexC].w = o, t.velocities[this.m_indexD].w = l
- }, n.prototype.SolvePositionConstraints = function(e) {
- var i, r, s, o, a, h, c = e.positions[this.m_indexA].c,
- u = e.positions[this.m_indexA].a,
- _ = e.positions[this.m_indexB].c,
- f = e.positions[this.m_indexB].a,
- d = e.positions[this.m_indexC].c,
- p = e.positions[this.m_indexC].a,
- m = e.positions[this.m_indexD].c,
- y = e.positions[this.m_indexD].a,
- v = this.m_qA.SetAngle(u),
- g = this.m_qB.SetAngle(f),
- x = this.m_qC.SetAngle(p),
- b = this.m_qD.SetAngle(y),
- A = this.m_JvAC,
- C = this.m_JvBD,
- T = 0;
- if (this.m_typeA === t.b2JointType.e_revoluteJoint) A.SetZero(), s = 1, a = 1, T += this.m_iA + this.m_iC, i = u - p - this.m_referenceAngleA;
- else {
- var S = N.MulRV(x, this.m_localAxisC, n.SolvePositionConstraints_s_u),
- w = N.MulRV(x, this.m_lalcC, n.SolvePositionConstraints_s_rC),
- E = N.MulRV(v, this.m_lalcA, n.SolvePositionConstraints_s_rA);
- A.Copy(S), a = P.CrossVV(w, S), s = P.CrossVV(E, S), T += this.m_mC + this.m_mA + this.m_iC * a * a + this.m_iA * s * s;
- var M = this.m_lalcC,
- D = N.MulTRV(x, P.AddVV(E, P.SubVV(c, d, P.s_t0), P.s_t0), P.s_t0);
- i = P.DotVV(P.SubVV(D, M, P.s_t0), this.m_localAxisC)
- }
- if (this.m_typeB === t.b2JointType.e_revoluteJoint) C.SetZero(), o = this.m_ratio, h = this.m_ratio, T += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD), r = f - y - this.m_referenceAngleB;
- else {
- S = N.MulRV(b, this.m_localAxisD, n.SolvePositionConstraints_s_u);
- var B = N.MulRV(b, this.m_lalcD, n.SolvePositionConstraints_s_rD),
- I = N.MulRV(g, this.m_lalcB, n.SolvePositionConstraints_s_rB);
- P.MulSV(this.m_ratio, S, C), h = this.m_ratio * P.CrossVV(B, S), o = this.m_ratio * P.CrossVV(I, S), T += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * h * h + this.m_iB * o * o;
- var R = this.m_lalcD,
- O = N.MulTRV(b, P.AddVV(I, P.SubVV(_, m, P.s_t0), P.s_t0), P.s_t0);
- r = P.DotVV(P.SubVV(O, R, P.s_t0), this.m_localAxisD)
- }
- var L = i + this.m_ratio * r - this.m_constant,
- F = 0;
- return T > 0 && (F = -L / T), c.SelfMulAdd(this.m_mA * F, A), u += this.m_iA * F * s, _.SelfMulAdd(this.m_mB * F, C), f += this.m_iB * F * o, d.SelfMulSub(this.m_mC * F, A), p -= this.m_iC * F * a, m.SelfMulSub(this.m_mD * F, C), y -= this.m_iD * F * h, e.positions[this.m_indexA].a = u, e.positions[this.m_indexB].a = f, e.positions[this.m_indexC].a = p, e.positions[this.m_indexD].a = y, 0 < l
- }, n.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, n.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, n.prototype.GetReactionForce = function(t, e) {
- return P.MulSV(t * this.m_impulse, this.m_JvAC, e)
- }, n.prototype.GetReactionTorque = function(t) {
- return t * this.m_impulse * this.m_JwA
- }, n.prototype.GetJoint1 = function() {
- return this.m_joint1
- }, n.prototype.GetJoint2 = function() {
- return this.m_joint2
- }, n.prototype.GetRatio = function() {
- return this.m_ratio
- }, n.prototype.SetRatio = function(t) {
- this.m_ratio = t
- }, n.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex,
- n = this.m_joint1.m_index,
- r = this.m_joint2.m_index;
- t(" const jd: b2GearJointDef = new b2GearJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.joint1 = joints[%d];\n", n), t(" jd.joint2 = joints[%d];\n", r), t(" jd.ratio = %.15f;\n", this.m_ratio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, n.InitVelocityConstraints_s_u = new P, n.InitVelocityConstraints_s_rA = new P, n.InitVelocityConstraints_s_rB = new P, n.InitVelocityConstraints_s_rC = new P, n.InitVelocityConstraints_s_rD = new P, n.SolvePositionConstraints_s_u = new P, n.SolvePositionConstraints_s_rA = new P, n.SolvePositionConstraints_s_rB = new P, n.SolvePositionConstraints_s_rC = new P, n.SolvePositionConstraints_s_rD = new P, n
- })(fi),
- Ai = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_motorJoint) || this;
- return i.linearOffset = new P(0, 0), i.angularOffset = 0, i.maxForce = 1, i.maxTorque = 1, i.correctionFactor = .3, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(this.bodyB.GetPosition(), this.linearOffset);
- var i = this.bodyA.GetAngle(),
- n = this.bodyB.GetAngle();
- this.angularOffset = n - i
- }, i
- })(_i),
- Ci = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_linearOffset = new P, n.m_angularOffset = 0, n.m_linearImpulse = new P, n.m_angularImpulse = 0, n.m_maxForce = 0, n.m_maxTorque = 0, n.m_correctionFactor = .3, n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_linearError = new P, n.m_angularError = 0, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_linearMass = new L, n.m_angularMass = 0, n.m_qA = new N, n.m_qB = new N, n.m_K = new L, n.m_linearOffset.Copy(e(i.linearOffset, P.ZERO)), n.m_linearImpulse.SetZero(), n.m_maxForce = e(i.maxForce, 0), n.m_maxTorque = e(i.maxTorque, 0), n.m_correctionFactor = e(i.correctionFactor, .3), n
- }
- return $e(i, t), i.prototype.GetAnchorA = function(t) {
- var e = this.m_bodyA.GetPosition();
- return t.x = e.x, t.y = e.y, t
- }, i.prototype.GetAnchorB = function(t) {
- var e = this.m_bodyB.GetPosition();
- return t.x = e.x, t.y = e.y, t
- }, i.prototype.GetReactionForce = function(t, e) {
- return P.MulSV(t, this.m_linearImpulse, e)
- }, i.prototype.GetReactionTorque = function(t) {
- return t * this.m_angularImpulse
- }, i.prototype.SetLinearOffset = function(t) {
- P.IsEqualToV(t, this.m_linearOffset) || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_linearOffset.Copy(t))
- }, i.prototype.GetLinearOffset = function() {
- return this.m_linearOffset
- }, i.prototype.SetAngularOffset = function(t) {
- t !== this.m_angularOffset && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_angularOffset = t)
- }, i.prototype.GetAngularOffset = function() {
- return this.m_angularOffset
- }, i.prototype.SetMaxForce = function(t) {
- this.m_maxForce = t
- }, i.prototype.GetMaxForce = function() {
- return this.m_maxForce
- }, i.prototype.SetMaxTorque = function(t) {
- this.m_maxTorque = t
- }, i.prototype.GetMaxTorque = function() {
- return this.m_maxTorque
- }, i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexA].c,
- i = t.positions[this.m_indexA].a,
- n = t.velocities[this.m_indexA].v,
- r = t.velocities[this.m_indexA].w,
- s = t.positions[this.m_indexB].c,
- o = t.positions[this.m_indexB].a,
- a = t.velocities[this.m_indexB].v,
- l = t.velocities[this.m_indexB].w,
- h = this.m_qA.SetAngle(i),
- c = this.m_qB.SetAngle(o),
- u = N.MulRV(h, P.SubVV(this.m_linearOffset, this.m_localCenterA, P.s_t0), this.m_rA),
- _ = N.MulRV(c, P.NegV(this.m_localCenterB, P.s_t0), this.m_rB),
- f = this.m_invMassA,
- d = this.m_invMassB,
- p = this.m_invIA,
- m = this.m_invIB,
- y = this.m_K;
- if (y.ex.x = f + d + p * u.y * u.y + m * _.y * _.y, y.ex.y = -p * u.x * u.y - m * _.x * _.y, y.ey.x = y.ex.y, y.ey.y = f + d + p * u.x * u.x + m * _.x * _.x, y.GetInverse(this.m_linearMass), this.m_angularMass = p + m, this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), P.SubVV(P.AddVV(s, _, P.s_t0), P.AddVV(e, u, P.s_t1), this.m_linearError), this.m_angularError = o - i - this.m_angularOffset, t.step.warmStarting) {
- this.m_linearImpulse.SelfMul(t.step.dtRatio), this.m_angularImpulse *= t.step.dtRatio;
- var v = this.m_linearImpulse;
- n.SelfMulSub(f, v), r -= p * (P.CrossVV(u, v) + this.m_angularImpulse), a.SelfMulAdd(d, v), l += m * (P.CrossVV(_, v) + this.m_angularImpulse)
- } else this.m_linearImpulse.SetZero(), this.m_angularImpulse = 0;
- t.velocities[this.m_indexA].w = r, t.velocities[this.m_indexB].w = l
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = this.m_invMassA,
- a = this.m_invMassB,
- l = this.m_invIA,
- h = this.m_invIB,
- c = t.step.dt,
- u = t.step.inv_dt,
- _ = s - n + u * this.m_correctionFactor * this.m_angularError,
- f = -this.m_angularMass * _,
- d = this.m_angularImpulse,
- p = c * this.m_maxTorque;
- this.m_angularImpulse = b(this.m_angularImpulse + f, -p, p), n -= l * (f = this.m_angularImpulse - d), s += h * f;
- var m = this.m_rA,
- y = this.m_rB,
- v = P.AddVV(P.SubVV(P.AddVV(r, P.CrossSV(s, y, P.s_t0), P.s_t0), P.AddVV(e, P.CrossSV(n, m, P.s_t1), P.s_t1), P.s_t2), P.MulSV(u * this.m_correctionFactor, this.m_linearError, P.s_t3), i.SolveVelocityConstraints_s_Cdot_v2),
- g = L.MulMV(this.m_linearMass, v, i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),
- x = i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);
- this.m_linearImpulse.SelfAdd(g);
- p = c * this.m_maxForce;
- this.m_linearImpulse.LengthSquared() > p * p && (this.m_linearImpulse.Normalize(), this.m_linearImpulse.SelfMul(p)), P.SubVV(this.m_linearImpulse, x, g), e.SelfMulSub(o, g), n -= l * P.CrossVV(m, g), r.SelfMulAdd(a, g), s += h * P.CrossVV(y, g), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
- }, i.prototype.SolvePositionConstraints = function(t) {
- return !0
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.linearOffset.Set(%.15f, %.15f);\n", this.m_linearOffset.x, this.m_linearOffset.y), t(" jd.angularOffset = %.15f;\n", this.m_angularOffset), t(" jd.maxForce = %.15f;\n", this.m_maxForce), t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), t(" jd.correctionFactor = %.15f;\n", this.m_correctionFactor), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.SolveVelocityConstraints_s_Cdot_v2 = new P, i.SolveVelocityConstraints_s_impulse_v2 = new P, i.SolveVelocityConstraints_s_oldImpulse_v2 = new P, i
- })(fi),
- Ti = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_mouseJoint) || this;
- return i.target = new P, i.maxForce = 0, i.frequencyHz = 5, i.dampingRatio = .7, i
- }
- return $e(i, e), i
- })(_i),
- Si = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_localAnchorB = new P, n.m_targetA = new P, n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_beta = 0, n.m_impulse = new P, n.m_maxForce = 0, n.m_gamma = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_rB = new P, n.m_localCenterB = new P, n.m_invMassB = 0, n.m_invIB = 0, n.m_mass = new L, n.m_C = new P, n.m_qB = new N, n.m_lalcB = new P, n.m_K = new L, n.m_targetA.Copy(e(i.target, P.ZERO)), V.MulTXV(n.m_bodyB.GetTransform(), n.m_targetA, n.m_localAnchorB), n.m_maxForce = e(i.maxForce, 0), n.m_impulse.SetZero(), n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_beta = 0, n.m_gamma = 0, n
- }
- return $e(i, t), i.prototype.SetTarget = function(t) {
- this.m_bodyB.IsAwake() || this.m_bodyB.SetAwake(!0), this.m_targetA.Copy(t)
- }, i.prototype.GetTarget = function() {
- return this.m_targetA
- }, i.prototype.SetMaxForce = function(t) {
- this.m_maxForce = t
- }, i.prototype.GetMaxForce = function() {
- return this.m_maxForce
- }, i.prototype.SetFrequency = function(t) {
- this.m_frequencyHz = t
- }, i.prototype.GetFrequency = function() {
- return this.m_frequencyHz
- }, i.prototype.SetDampingRatio = function(t) {
- this.m_dampingRatio = t
- }, i.prototype.GetDampingRatio = function() {
- return this.m_dampingRatio
- }, i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexB].c,
- i = t.positions[this.m_indexB].a,
- n = t.velocities[this.m_indexB].v,
- r = t.velocities[this.m_indexB].w,
- o = this.m_qB.SetAngle(i),
- a = this.m_bodyB.GetMass(),
- l = 2 * s * this.m_frequencyHz,
- h = 2 * a * this.m_dampingRatio * l,
- c = a * (l * l),
- u = t.step.dt;
- this.m_gamma = u * (h + u * c), 0 !== this.m_gamma && (this.m_gamma = 1 / this.m_gamma), this.m_beta = u * c * this.m_gamma, P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(o, this.m_lalcB, this.m_rB);
- var _ = this.m_K;
- _.ex.x = this.m_invMassB + this.m_invIB * this.m_rB.y * this.m_rB.y + this.m_gamma, _.ex.y = -this.m_invIB * this.m_rB.x * this.m_rB.y, _.ey.x = _.ex.y, _.ey.y = this.m_invMassB + this.m_invIB * this.m_rB.x * this.m_rB.x + this.m_gamma, _.GetInverse(this.m_mass), this.m_C.x = e.x + this.m_rB.x - this.m_targetA.x, this.m_C.y = e.y + this.m_rB.y - this.m_targetA.y, this.m_C.SelfMul(this.m_beta), r *= .98, t.step.warmStarting ? (this.m_impulse.SelfMul(t.step.dtRatio), n.x += this.m_invMassB * this.m_impulse.x, n.y += this.m_invMassB * this.m_impulse.y, r += this.m_invIB * P.CrossVV(this.m_rB, this.m_impulse)) : this.m_impulse.SetZero(), t.velocities[this.m_indexB].w = r
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexB].v,
- n = t.velocities[this.m_indexB].w,
- r = P.AddVCrossSV(e, n, this.m_rB, i.SolveVelocityConstraints_s_Cdot),
- s = L.MulMV(this.m_mass, P.AddVV(r, P.AddVV(this.m_C, P.MulSV(this.m_gamma, this.m_impulse, P.s_t0), P.s_t0), P.s_t0).SelfNeg(), i.SolveVelocityConstraints_s_impulse),
- o = i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);
- this.m_impulse.SelfAdd(s);
- var a = t.step.dt * this.m_maxForce;
- this.m_impulse.LengthSquared() > a * a && this.m_impulse.SelfMul(a / this.m_impulse.Length()), P.SubVV(this.m_impulse, o, s), e.SelfMulAdd(this.m_invMassB, s), n += this.m_invIB * P.CrossVV(this.m_rB, s), t.velocities[this.m_indexB].w = n
- }, i.prototype.SolvePositionConstraints = function(t) {
- return !0
- }, i.prototype.GetAnchorA = function(t) {
- return t.x = this.m_targetA.x, t.y = this.m_targetA.y, t
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return P.MulSV(t, this.m_impulse, e)
- }, i.prototype.GetReactionTorque = function(t) {
- return 0
- }, i.prototype.Dump = function(t) {
- t("Mouse joint dumping is not supported.\n")
- }, i.prototype.ShiftOrigin = function(t) {
- this.m_targetA.SelfSub(t)
- }, i.SolveVelocityConstraints_s_Cdot = new P, i.SolveVelocityConstraints_s_impulse = new P, i.SolveVelocityConstraints_s_oldImpulse = new P, i
- })(fi),
- wi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_prismaticJoint) || this;
- return i.localAnchorA = new P, i.localAnchorB = new P, i.localAxisA = new P(1, 0), i.referenceAngle = 0, i.enableLimit = !1, i.lowerTranslation = 0, i.upperTranslation = 0, i.enableMotor = !1, i.maxMotorForce = 0, i.motorSpeed = 0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.bodyA.GetLocalVector(n, this.localAxisA), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
- }, i
- })(_i),
- Ei = (function(i) {
- function n(n) {
- var r = i.call(this, n) || this;
- return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_localXAxisA = new P, r.m_localYAxisA = new P, r.m_referenceAngle = 0, r.m_impulse = new O(0, 0, 0), r.m_motorImpulse = 0, r.m_lowerTranslation = 0, r.m_upperTranslation = 0, r.m_maxMotorForce = 0, r.m_motorSpeed = 0, r.m_enableLimit = !1, r.m_enableMotor = !1, r.m_limitState = t.b2LimitState.e_inactiveLimit, r.m_indexA = 0, r.m_indexB = 0, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_axis = new P(0, 0), r.m_perp = new P(0, 0), r.m_s1 = 0, r.m_s2 = 0, r.m_a1 = 0, r.m_a2 = 0, r.m_K = new F, r.m_K3 = new F, r.m_K2 = new L, r.m_motorMass = 0, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_rA = new P, r.m_rB = new P, r.m_localAnchorA.Copy(e(n.localAnchorA, P.ZERO)), r.m_localAnchorB.Copy(e(n.localAnchorB, P.ZERO)), r.m_localXAxisA.Copy(e(n.localAxisA, new P(1, 0))).SelfNormalize(), P.CrossOneV(r.m_localXAxisA, r.m_localYAxisA), r.m_referenceAngle = e(n.referenceAngle, 0), r.m_lowerTranslation = e(n.lowerTranslation, 0), r.m_upperTranslation = e(n.upperTranslation, 0), r.m_maxMotorForce = e(n.maxMotorForce, 0), r.m_motorSpeed = e(n.motorSpeed, 0), r.m_enableLimit = e(n.enableLimit, !1), r.m_enableMotor = e(n.enableMotor, !1), r
- }
- return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var i = e.positions[this.m_indexA].c,
- r = e.positions[this.m_indexA].a,
- s = e.velocities[this.m_indexA].v,
- o = e.velocities[this.m_indexA].w,
- a = e.positions[this.m_indexB].c,
- h = e.positions[this.m_indexB].a,
- c = e.velocities[this.m_indexB].v,
- u = e.velocities[this.m_indexB].w,
- _ = this.m_qA.SetAngle(r),
- f = this.m_qB.SetAngle(h);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var d = N.MulRV(_, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var p = N.MulRV(f, this.m_lalcB, this.m_rB),
- m = P.AddVV(P.SubVV(a, i, P.s_t0), P.SubVV(p, d, P.s_t1), n.InitVelocityConstraints_s_d),
- y = this.m_invMassA,
- g = this.m_invMassB,
- x = this.m_invIA,
- b = this.m_invIB;
- if (N.MulRV(_, this.m_localXAxisA, this.m_axis), this.m_a1 = P.CrossVV(P.AddVV(m, d, P.s_t0), this.m_axis), this.m_a2 = P.CrossVV(p, this.m_axis), this.m_motorMass = y + g + x * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), N.MulRV(_, this.m_localYAxisA, this.m_perp), this.m_s1 = P.CrossVV(P.AddVV(m, d, P.s_t0), this.m_perp), this.m_s2 = P.CrossVV(p, this.m_perp), this.m_K.ex.x = y + g + x * this.m_s1 * this.m_s1 + b * this.m_s2 * this.m_s2, this.m_K.ex.y = x * this.m_s1 + b * this.m_s2, this.m_K.ex.z = x * this.m_s1 * this.m_a1 + b * this.m_s2 * this.m_a2, this.m_K.ey.x = this.m_K.ex.y, this.m_K.ey.y = x + b, 0 === this.m_K.ey.y && (this.m_K.ey.y = 1), this.m_K.ey.z = x * this.m_a1 + b * this.m_a2, this.m_K.ez.x = this.m_K.ex.z, this.m_K.ez.y = this.m_K.ey.z, this.m_K.ez.z = y + g + x * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2, this.m_enableLimit) {
- var A = P.DotVV(this.m_axis, m);
- v(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? this.m_limitState = t.b2LimitState.e_equalLimits : A <= this.m_lowerTranslation ? this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_limitState = t.b2LimitState.e_atLowerLimit, this.m_impulse.z = 0) : A >= this.m_upperTranslation ? this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_limitState = t.b2LimitState.e_atUpperLimit, this.m_impulse.z = 0) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0)
- } else this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0;
- if (this.m_enableMotor || (this.m_motorImpulse = 0), e.step.warmStarting) {
- this.m_impulse.SelfMul(e.step.dtRatio), this.m_motorImpulse *= e.step.dtRatio;
- var C = P.AddVV(P.MulSV(this.m_impulse.x, this.m_perp, P.s_t0), P.MulSV(this.m_motorImpulse + this.m_impulse.z, this.m_axis, P.s_t1), n.InitVelocityConstraints_s_P),
- T = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1,
- S = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2;
- s.SelfMulSub(y, C), o -= x * T, c.SelfMulAdd(g, C), u += b * S
- } else this.m_impulse.SetZero(), this.m_motorImpulse = 0;
- e.velocities[this.m_indexA].w = o, e.velocities[this.m_indexB].w = u
- }, n.prototype.SolveVelocityConstraints = function(e) {
- var i = e.velocities[this.m_indexA].v,
- r = e.velocities[this.m_indexA].w,
- s = e.velocities[this.m_indexB].v,
- o = e.velocities[this.m_indexB].w,
- a = this.m_invMassA,
- l = this.m_invMassB,
- h = this.m_invIA,
- c = this.m_invIB;
- if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits) {
- var u = P.DotVV(this.m_axis, P.SubVV(s, i, P.s_t0)) + this.m_a2 * o - this.m_a1 * r,
- _ = this.m_motorMass * (this.m_motorSpeed - u),
- f = this.m_motorImpulse,
- d = e.step.dt * this.m_maxMotorForce;
- this.m_motorImpulse = b(this.m_motorImpulse + _, -d, d), _ = this.m_motorImpulse - f;
- var p = P.MulSV(_, this.m_axis, n.SolveVelocityConstraints_s_P),
- m = _ * this.m_a1,
- y = _ * this.m_a2;
- i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
- }
- var v = P.DotVV(this.m_perp, P.SubVV(s, i, P.s_t0)) + this.m_s2 * o - this.m_s1 * r,
- A = o - r;
- if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit) {
- var C = P.DotVV(this.m_axis, P.SubVV(s, i, P.s_t0)) + this.m_a2 * o - this.m_a1 * r,
- T = n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),
- S = this.m_K.Solve33(-v, -A, -C, n.SolveVelocityConstraints_s_df3);
- this.m_impulse.SelfAdd(S), this.m_limitState === t.b2LimitState.e_atLowerLimit ? this.m_impulse.z = x(this.m_impulse.z, 0) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = g(this.m_impulse.z, 0));
- var w = -v - (this.m_impulse.z - T.z) * this.m_K.ez.x,
- E = -A - (this.m_impulse.z - T.z) * this.m_K.ez.y,
- M = this.m_K.Solve22(w, E, n.SolveVelocityConstraints_s_f2r);
- M.x += T.x, M.y += T.y, this.m_impulse.x = M.x, this.m_impulse.y = M.y, S.x = this.m_impulse.x - T.x, S.y = this.m_impulse.y - T.y, S.z = this.m_impulse.z - T.z;
- p = P.AddVV(P.MulSV(S.x, this.m_perp, P.s_t0), P.MulSV(S.z, this.m_axis, P.s_t1), n.SolveVelocityConstraints_s_P), m = S.x * this.m_s1 + S.y + S.z * this.m_a1, y = S.x * this.m_s2 + S.y + S.z * this.m_a2;
- i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
- } else {
- var D = this.m_K.Solve22(-v, -A, n.SolveVelocityConstraints_s_df2);
- this.m_impulse.x += D.x, this.m_impulse.y += D.y;
- p = P.MulSV(D.x, this.m_perp, n.SolveVelocityConstraints_s_P), m = D.x * this.m_s1 + D.y, y = D.x * this.m_s2 + D.y;
- i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
- }
- e.velocities[this.m_indexA].w = r, e.velocities[this.m_indexB].w = o
- }, n.prototype.SolvePositionConstraints = function(t) {
- var e = t.positions[this.m_indexA].c,
- i = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(i),
- a = this.m_qB.SetAngle(s),
- c = this.m_invMassA,
- u = this.m_invMassB,
- _ = this.m_invIA,
- f = this.m_invIB,
- d = N.MulRV(o, this.m_lalcA, this.m_rA),
- p = N.MulRV(a, this.m_lalcB, this.m_rB),
- m = P.SubVV(P.AddVV(r, p, P.s_t0), P.AddVV(e, d, P.s_t1), n.SolvePositionConstraints_s_d),
- y = N.MulRV(o, this.m_localXAxisA, this.m_axis),
- g = P.CrossVV(P.AddVV(m, d, P.s_t0), y),
- A = P.CrossVV(p, y),
- C = N.MulRV(o, this.m_localYAxisA, this.m_perp),
- T = P.CrossVV(P.AddVV(m, d, P.s_t0), C),
- S = P.CrossVV(p, C),
- w = n.SolvePositionConstraints_s_impulse,
- E = P.DotVV(C, m),
- M = s - i - this.m_referenceAngle,
- D = v(E),
- B = v(M),
- I = !1,
- R = 0;
- if (this.m_enableLimit) {
- var O = P.DotVV(y, m);
- v(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? (R = b(O, -.2, .2), D = x(D, v(O)), I = !0) : O <= this.m_lowerTranslation ? (R = b(O - this.m_lowerTranslation + l, -.2, 0), D = x(D, this.m_lowerTranslation - O), I = !0) : O >= this.m_upperTranslation && (R = b(O - this.m_upperTranslation - l, 0, .2), D = x(D, O - this.m_upperTranslation), I = !0)
- }
- if (I) {
- var L = c + u + _ * T * T + f * S * S,
- F = _ * T + f * S,
- V = _ * T * g + f * S * A;
- 0 === (z = _ + f) && (z = 1);
- var k = _ * g + f * A,
- G = c + u + _ * g * g + f * A * A,
- U = this.m_K3;
- U.ex.SetXYZ(L, F, V), U.ey.SetXYZ(F, z, k), U.ez.SetXYZ(V, k, G), w = U.Solve33(-E, -M, -R, w)
- } else {
- var z;
- L = c + u + _ * T * T + f * S * S, F = _ * T + f * S;
- 0 === (z = _ + f) && (z = 1);
- var j = this.m_K2;
- j.ex.Set(L, F), j.ey.Set(F, z);
- var W = j.Solve(-E, -M, n.SolvePositionConstraints_s_impulse1);
- w.x = W.x, w.y = W.y, w.z = 0
- }
- var H = P.AddVV(P.MulSV(w.x, C, P.s_t0), P.MulSV(w.z, y, P.s_t1), n.SolvePositionConstraints_s_P),
- X = w.x * T + w.y + w.z * g,
- Y = w.x * S + w.y + w.z * A;
- return e.SelfMulSub(c, H), i -= _ * X, r.SelfMulAdd(u, H), s += f * Y, t.positions[this.m_indexA].a = i, t.positions[this.m_indexB].a = s, D <= l && B <= h
- }, n.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, n.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, n.prototype.GetReactionForce = function(t, e) {
- return e.x = t * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x), e.y = t * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y), e
- }, n.prototype.GetReactionTorque = function(t) {
- return t * this.m_impulse.y
- }, n.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, n.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, n.prototype.GetLocalAxisA = function() {
- return this.m_localXAxisA
- }, n.prototype.GetReferenceAngle = function() {
- return this.m_referenceAngle
- }, n.prototype.GetJointTranslation = function() {
- var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, n.GetJointTranslation_s_pA),
- e = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, n.GetJointTranslation_s_pB),
- i = P.SubVV(e, t, n.GetJointTranslation_s_d),
- r = this.m_bodyA.GetWorldVector(this.m_localXAxisA, n.GetJointTranslation_s_axis);
- return P.DotVV(i, r)
- }, n.prototype.GetJointSpeed = function() {
- var t = this.m_bodyA,
- e = this.m_bodyB;
- P.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
- var i = N.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
- var n = N.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB),
- r = P.AddVV(t.m_sweep.c, i, P.s_t0),
- s = P.AddVV(e.m_sweep.c, n, P.s_t1),
- o = P.SubVV(s, r, P.s_t2),
- a = t.GetWorldVector(this.m_localXAxisA, this.m_axis),
- l = t.m_linearVelocity,
- h = e.m_linearVelocity,
- c = t.m_angularVelocity,
- u = e.m_angularVelocity;
- return P.DotVV(o, P.CrossSV(c, a, P.s_t0)) + P.DotVV(a, P.SubVV(P.AddVCrossSV(h, u, n, P.s_t0), P.AddVCrossSV(l, c, i, P.s_t1), P.s_t0))
- }, n.prototype.IsLimitEnabled = function() {
- return this.m_enableLimit
- }, n.prototype.EnableLimit = function(t) {
- t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = t, this.m_impulse.z = 0)
- }, n.prototype.GetLowerLimit = function() {
- return this.m_lowerTranslation
- }, n.prototype.GetUpperLimit = function() {
- return this.m_upperTranslation
- }, n.prototype.SetLimits = function(t, e) {
- t === this.m_lowerTranslation && e === this.m_upperTranslation || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_lowerTranslation = t, this.m_upperTranslation = e, this.m_impulse.z = 0)
- }, n.prototype.IsMotorEnabled = function() {
- return this.m_enableMotor
- }, n.prototype.EnableMotor = function(t) {
- t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
- }, n.prototype.SetMotorSpeed = function(t) {
- t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
- }, n.prototype.GetMotorSpeed = function() {
- return this.m_motorSpeed
- }, n.prototype.SetMaxMotorForce = function(t) {
- t !== this.m_maxMotorForce && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorForce = t)
- }, n.prototype.GetMaxMotorForce = function() {
- return this.m_maxMotorForce
- }, n.prototype.GetMotorForce = function(t) {
- return t * this.m_motorImpulse
- }, n.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), t(" jd.lowerTranslation = %.15f;\n", this.m_lowerTranslation), t(" jd.upperTranslation = %.15f;\n", this.m_upperTranslation), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorForce = %.15f;\n", this.m_maxMotorForce), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, n.InitVelocityConstraints_s_d = new P, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_f2r = new P, n.SolveVelocityConstraints_s_f1 = new O, n.SolveVelocityConstraints_s_df3 = new O, n.SolveVelocityConstraints_s_df2 = new P, n.SolvePositionConstraints_s_d = new P, n.SolvePositionConstraints_s_impulse = new O, n.SolvePositionConstraints_s_impulse1 = new P, n.SolvePositionConstraints_s_P = new P, n.GetJointTranslation_s_pA = new P, n.GetJointTranslation_s_pB = new P, n.GetJointTranslation_s_d = new P, n.GetJointTranslation_s_axis = new P, n
- })(fi),
- Mi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_pulleyJoint) || this;
- return i.groundAnchorA = new P(-1, 1), i.groundAnchorB = new P(1, 1), i.localAnchorA = new P(-1, 0), i.localAnchorB = new P(1, 0), i.lengthA = 0, i.lengthB = 0, i.ratio = 1, i.collideConnected = !0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i, n, r, s, o) {
- this.bodyA = t, this.bodyB = e, this.groundAnchorA.Copy(i), this.groundAnchorB.Copy(n), this.bodyA.GetLocalPoint(r, this.localAnchorA), this.bodyB.GetLocalPoint(s, this.localAnchorB), this.lengthA = P.DistanceVV(r, i), this.lengthB = P.DistanceVV(s, n), this.ratio = o
- }, i
- })(_i),
- Di = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_groundAnchorA = new P, n.m_groundAnchorB = new P, n.m_lengthA = 0, n.m_lengthB = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_constant = 0, n.m_ratio = 0, n.m_impulse = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_uA = new P, n.m_uB = new P, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_groundAnchorA.Copy(e(i.groundAnchorA, new P(-1, 1))), n.m_groundAnchorB.Copy(e(i.groundAnchorB, new P(1, 0))), n.m_localAnchorA.Copy(e(i.localAnchorA, new P(-1, 0))), n.m_localAnchorB.Copy(e(i.localAnchorB, new P(1, 0))), n.m_lengthA = e(i.lengthA, 0), n.m_lengthB = e(i.lengthB, 0), n.m_ratio = e(i.ratio, 1), n.m_constant = e(i.lengthA, 0) + n.m_ratio * e(i.lengthB, 0), n.m_impulse = 0, n
- }
- return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.velocities[this.m_indexA].v,
- s = t.velocities[this.m_indexA].w,
- o = t.positions[this.m_indexB].c,
- a = t.positions[this.m_indexB].a,
- h = t.velocities[this.m_indexB].v,
- c = t.velocities[this.m_indexB].w,
- u = this.m_qA.SetAngle(n),
- _ = this.m_qB.SetAngle(a);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(u, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(_, this.m_lalcB, this.m_rB), this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA), this.m_uB.Copy(o).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);
- var f = this.m_uA.Length(),
- d = this.m_uB.Length();
- f > 10 * l ? this.m_uA.SelfMul(1 / f) : this.m_uA.SetZero(), d > 10 * l ? this.m_uB.SelfMul(1 / d) : this.m_uB.SetZero();
- var p = P.CrossVV(this.m_rA, this.m_uA),
- m = P.CrossVV(this.m_rB, this.m_uB),
- y = this.m_invMassA + this.m_invIA * p * p,
- v = this.m_invMassB + this.m_invIB * m * m;
- if (this.m_mass = y + this.m_ratio * this.m_ratio * v, this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), t.step.warmStarting) {
- this.m_impulse *= t.step.dtRatio;
- var g = P.MulSV(-this.m_impulse, this.m_uA, i.InitVelocityConstraints_s_PA),
- x = P.MulSV(-this.m_ratio * this.m_impulse, this.m_uB, i.InitVelocityConstraints_s_PB);
- r.SelfMulAdd(this.m_invMassA, g), s += this.m_invIA * P.CrossVV(this.m_rA, g), h.SelfMulAdd(this.m_invMassB, x), c += this.m_invIB * P.CrossVV(this.m_rB, x)
- } else this.m_impulse = 0;
- t.velocities[this.m_indexA].w = s, t.velocities[this.m_indexB].w = c
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = P.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA),
- a = P.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB),
- l = -P.DotVV(this.m_uA, o) - this.m_ratio * P.DotVV(this.m_uB, a),
- h = -this.m_mass * l;
- this.m_impulse += h;
- var c = P.MulSV(-h, this.m_uA, i.SolveVelocityConstraints_s_PA),
- u = P.MulSV(-this.m_ratio * h, this.m_uB, i.SolveVelocityConstraints_s_PB);
- e.SelfMulAdd(this.m_invMassA, c), n += this.m_invIA * P.CrossVV(this.m_rA, c), r.SelfMulAdd(this.m_invMassB, u), s += this.m_invIB * P.CrossVV(this.m_rB, u), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
- }, i.prototype.SolvePositionConstraints = function(t) {
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(n),
- a = this.m_qB.SetAngle(s);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var h = N.MulRV(o, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var c = N.MulRV(a, this.m_lalcB, this.m_rB),
- u = this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),
- _ = this.m_uB.Copy(r).SelfAdd(c).SelfSub(this.m_groundAnchorB),
- f = u.Length(),
- d = _.Length();
- f > 10 * l ? u.SelfMul(1 / f) : u.SetZero(), d > 10 * l ? _.SelfMul(1 / d) : _.SetZero();
- var p = P.CrossVV(h, u),
- m = P.CrossVV(c, _),
- y = this.m_invMassA + this.m_invIA * p * p,
- g = this.m_invMassB + this.m_invIB * m * m,
- x = y + this.m_ratio * this.m_ratio * g;
- x > 0 && (x = 1 / x);
- var b = this.m_constant - f - this.m_ratio * d,
- A = v(b),
- C = -x * b,
- T = P.MulSV(-C, u, i.SolvePositionConstraints_s_PA),
- S = P.MulSV(-this.m_ratio * C, _, i.SolvePositionConstraints_s_PB);
- return e.SelfMulAdd(this.m_invMassA, T), n += this.m_invIA * P.CrossVV(h, T), r.SelfMulAdd(this.m_invMassB, S), s += this.m_invIB * P.CrossVV(c, S), t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, A < l
- }, i.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return e.x = t * this.m_impulse * this.m_uB.x, e.y = t * this.m_impulse * this.m_uB.y, e
- }, i.prototype.GetReactionTorque = function(t) {
- return 0
- }, i.prototype.GetGroundAnchorA = function() {
- return this.m_groundAnchorA
- }, i.prototype.GetGroundAnchorB = function() {
- return this.m_groundAnchorB
- }, i.prototype.GetLengthA = function() {
- return this.m_lengthA
- }, i.prototype.GetLengthB = function() {
- return this.m_lengthB
- }, i.prototype.GetRatio = function() {
- return this.m_ratio
- }, i.prototype.GetCurrentLengthA = function() {
- var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, i.GetCurrentLengthA_s_p),
- e = this.m_groundAnchorA;
- return P.DistanceVV(t, e)
- }, i.prototype.GetCurrentLengthB = function() {
- var t = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, i.GetCurrentLengthB_s_p),
- e = this.m_groundAnchorB;
- return P.DistanceVV(t, e)
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2PulleyJointDef = new b2PulleyJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.groundAnchorA.Set(%.15f, %.15f);\n", this.m_groundAnchorA.x, this.m_groundAnchorA.y), t(" jd.groundAnchorB.Set(%.15f, %.15f);\n", this.m_groundAnchorB.x, this.m_groundAnchorB.y), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.lengthA = %.15f;\n", this.m_lengthA), t(" jd.lengthB = %.15f;\n", this.m_lengthB), t(" jd.ratio = %.15f;\n", this.m_ratio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.prototype.ShiftOrigin = function(t) {
- this.m_groundAnchorA.SelfSub(t), this.m_groundAnchorB.SelfSub(t)
- }, i.InitVelocityConstraints_s_PA = new P, i.InitVelocityConstraints_s_PB = new P, i.SolveVelocityConstraints_s_vpA = new P, i.SolveVelocityConstraints_s_vpB = new P, i.SolveVelocityConstraints_s_PA = new P, i.SolveVelocityConstraints_s_PB = new P, i.SolvePositionConstraints_s_PA = new P, i.SolvePositionConstraints_s_PB = new P, i.GetCurrentLengthA_s_p = new P, i.GetCurrentLengthB_s_p = new P, i
- })(fi),
- Bi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_revoluteJoint) || this;
- return i.localAnchorA = new P(0, 0), i.localAnchorB = new P(0, 0), i.referenceAngle = 0, i.enableLimit = !1, i.lowerAngle = 0, i.upperAngle = 0, i.enableMotor = !1, i.motorSpeed = 0, i.maxMotorTorque = 0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
- }, i
- })(_i),
- Ii = (function(i) {
- function n(n) {
- var r = i.call(this, n) || this;
- return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_impulse = new O, r.m_motorImpulse = 0, r.m_enableMotor = !1, r.m_maxMotorTorque = 0, r.m_motorSpeed = 0, r.m_enableLimit = !1, r.m_referenceAngle = 0, r.m_lowerAngle = 0, r.m_upperAngle = 0, r.m_indexA = 0, r.m_indexB = 0, r.m_rA = new P, r.m_rB = new P, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_mass = new F, r.m_motorMass = 0, r.m_limitState = t.b2LimitState.e_inactiveLimit, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_K = new L, r.m_localAnchorA.Copy(e(n.localAnchorA, P.ZERO)), r.m_localAnchorB.Copy(e(n.localAnchorB, P.ZERO)), r.m_referenceAngle = e(n.referenceAngle, 0), r.m_impulse.SetZero(), r.m_motorImpulse = 0, r.m_lowerAngle = e(n.lowerAngle, 0), r.m_upperAngle = e(n.upperAngle, 0), r.m_maxMotorTorque = e(n.maxMotorTorque, 0), r.m_motorSpeed = e(n.motorSpeed, 0), r.m_enableLimit = e(n.enableLimit, !1), r.m_enableMotor = e(n.enableMotor, !1), r.m_limitState = t.b2LimitState.e_inactiveLimit, r
- }
- return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var i = e.positions[this.m_indexA].a,
- r = e.velocities[this.m_indexA].v,
- s = e.velocities[this.m_indexA].w,
- o = e.positions[this.m_indexB].a,
- a = e.velocities[this.m_indexB].v,
- l = e.velocities[this.m_indexB].w,
- c = this.m_qA.SetAngle(i),
- u = this.m_qB.SetAngle(o);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(c, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(u, this.m_lalcB, this.m_rB);
- var _ = this.m_invMassA,
- f = this.m_invMassB,
- d = this.m_invIA,
- p = this.m_invIB,
- m = d + p === 0;
- if (this.m_mass.ex.x = _ + f + this.m_rA.y * this.m_rA.y * d + this.m_rB.y * this.m_rB.y * p, this.m_mass.ey.x = -this.m_rA.y * this.m_rA.x * d - this.m_rB.y * this.m_rB.x * p, this.m_mass.ez.x = -this.m_rA.y * d - this.m_rB.y * p, this.m_mass.ex.y = this.m_mass.ey.x, this.m_mass.ey.y = _ + f + this.m_rA.x * this.m_rA.x * d + this.m_rB.x * this.m_rB.x * p, this.m_mass.ez.y = this.m_rA.x * d + this.m_rB.x * p, this.m_mass.ex.z = this.m_mass.ez.x, this.m_mass.ey.z = this.m_mass.ez.y, this.m_mass.ez.z = d + p, this.m_motorMass = d + p, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), this.m_enableMotor && !m || (this.m_motorImpulse = 0), this.m_enableLimit && !m) {
- var y = o - i - this.m_referenceAngle;
- v(this.m_upperAngle - this.m_lowerAngle) < 2 * h ? this.m_limitState = t.b2LimitState.e_equalLimits : y <= this.m_lowerAngle ? (this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_impulse.z = 0), this.m_limitState = t.b2LimitState.e_atLowerLimit) : y >= this.m_upperAngle ? (this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = 0), this.m_limitState = t.b2LimitState.e_atUpperLimit) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0)
- } else this.m_limitState = t.b2LimitState.e_inactiveLimit;
- if (e.step.warmStarting) {
- this.m_impulse.SelfMul(e.step.dtRatio), this.m_motorImpulse *= e.step.dtRatio;
- var g = n.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
- r.SelfMulSub(_, g), s -= d * (P.CrossVV(this.m_rA, g) + this.m_motorImpulse + this.m_impulse.z), a.SelfMulAdd(f, g), l += p * (P.CrossVV(this.m_rB, g) + this.m_motorImpulse + this.m_impulse.z)
- } else this.m_impulse.SetZero(), this.m_motorImpulse = 0;
- e.velocities[this.m_indexA].w = s, e.velocities[this.m_indexB].w = l
- }, n.prototype.SolveVelocityConstraints = function(e) {
- var i = e.velocities[this.m_indexA].v,
- r = e.velocities[this.m_indexA].w,
- s = e.velocities[this.m_indexB].v,
- o = e.velocities[this.m_indexB].w,
- a = this.m_invMassA,
- l = this.m_invMassB,
- h = this.m_invIA,
- c = this.m_invIB,
- u = h + c === 0;
- if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits && !u) {
- var _ = o - r - this.m_motorSpeed,
- f = -this.m_motorMass * _,
- d = this.m_motorImpulse,
- p = e.step.dt * this.m_maxMotorTorque;
- this.m_motorImpulse = b(this.m_motorImpulse + f, -p, p), r -= h * (f = this.m_motorImpulse - d), o += c * f
- }
- if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !u) {
- var m = P.SubVV(P.AddVCrossSV(s, o, this.m_rB, P.s_t0), P.AddVCrossSV(i, r, this.m_rA, P.s_t1), n.SolveVelocityConstraints_s_Cdot1),
- y = o - r,
- v = this.m_mass.Solve33(m.x, m.y, y, n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();
- if (this.m_limitState === t.b2LimitState.e_equalLimits) this.m_impulse.SelfAdd(v);
- else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
- if (this.m_impulse.z + v.z < 0) {
- var g = -m.x + this.m_impulse.z * this.m_mass.ez.x,
- x = -m.y + this.m_impulse.z * this.m_mass.ez.y,
- A = this.m_mass.Solve22(g, x, n.SolveVelocityConstraints_s_reduced_v2);
- v.x = A.x, v.y = A.y, v.z = -this.m_impulse.z, this.m_impulse.x += A.x, this.m_impulse.y += A.y, this.m_impulse.z = 0
- } else this.m_impulse.SelfAdd(v)
- } else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
- if (this.m_impulse.z + v.z > 0) {
- g = -m.x + this.m_impulse.z * this.m_mass.ez.x, x = -m.y + this.m_impulse.z * this.m_mass.ez.y, A = this.m_mass.Solve22(g, x, n.SolveVelocityConstraints_s_reduced_v2);
- v.x = A.x, v.y = A.y, v.z = -this.m_impulse.z, this.m_impulse.x += A.x, this.m_impulse.y += A.y, this.m_impulse.z = 0
- } else this.m_impulse.SelfAdd(v)
- }
- var C = n.SolveVelocityConstraints_s_P.Set(v.x, v.y);
- i.SelfMulSub(a, C), r -= h * (P.CrossVV(this.m_rA, C) + v.z), s.SelfMulAdd(l, C), o += c * (P.CrossVV(this.m_rB, C) + v.z)
- } else {
- var T = P.SubVV(P.AddVCrossSV(s, o, this.m_rB, P.s_t0), P.AddVCrossSV(i, r, this.m_rA, P.s_t1), n.SolveVelocityConstraints_s_Cdot_v2),
- S = this.m_mass.Solve22(-T.x, -T.y, n.SolveVelocityConstraints_s_impulse_v2);
- this.m_impulse.x += S.x, this.m_impulse.y += S.y, i.SelfMulSub(a, S), r -= h * P.CrossVV(this.m_rA, S), s.SelfMulAdd(l, S), o += c * P.CrossVV(this.m_rB, S)
- }
- e.velocities[this.m_indexA].w = r, e.velocities[this.m_indexB].w = o
- }, n.prototype.SolvePositionConstraints = function(e) {
- var i, r = e.positions[this.m_indexA].c,
- s = e.positions[this.m_indexA].a,
- o = e.positions[this.m_indexB].c,
- a = e.positions[this.m_indexB].a,
- c = this.m_qA.SetAngle(s),
- u = this.m_qB.SetAngle(a),
- _ = 0,
- f = this.m_invIA + this.m_invIB === 0;
- if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !f) {
- var d = a - s - this.m_referenceAngle,
- p = 0;
- if (this.m_limitState === t.b2LimitState.e_equalLimits) {
- var m = b(d - this.m_lowerAngle, -.13962634015955555, .13962634015955555);
- p = -this.m_motorMass * m, _ = v(m)
- } else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
- _ = -(m = d - this.m_lowerAngle), m = b(m + h, -.13962634015955555, 0), p = -this.m_motorMass * m
- } else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
- _ = m = d - this.m_upperAngle, m = b(m - h, 0, .13962634015955555), p = -this.m_motorMass * m
- }
- s -= this.m_invIA * p, a += this.m_invIB * p
- }
- c.SetAngle(s), u.SetAngle(a), P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var y = N.MulRV(c, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var g = N.MulRV(u, this.m_lalcB, this.m_rB),
- x = P.SubVV(P.AddVV(o, g, P.s_t0), P.AddVV(r, y, P.s_t1), n.SolvePositionConstraints_s_C_v2);
- i = x.Length();
- var A = this.m_invMassA,
- C = this.m_invMassB,
- T = this.m_invIA,
- S = this.m_invIB,
- w = this.m_K;
- w.ex.x = A + C + T * y.y * y.y + S * g.y * g.y, w.ex.y = -T * y.x * y.y - S * g.x * g.y, w.ey.x = w.ex.y, w.ey.y = A + C + T * y.x * y.x + S * g.x * g.x;
- var E = w.Solve(x.x, x.y, n.SolvePositionConstraints_s_impulse).SelfNeg();
- return r.SelfMulSub(A, E), s -= T * P.CrossVV(y, E), o.SelfMulAdd(C, E), a += S * P.CrossVV(g, E), e.positions[this.m_indexA].a = s, e.positions[this.m_indexB].a = a, i <= l && _ <= h
- }, n.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, n.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, n.prototype.GetReactionForce = function(t, e) {
- return e.x = t * this.m_impulse.x, e.y = t * this.m_impulse.y, e
- }, n.prototype.GetReactionTorque = function(t) {
- return t * this.m_impulse.z
- }, n.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, n.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, n.prototype.GetReferenceAngle = function() {
- return this.m_referenceAngle
- }, n.prototype.GetJointAngle = function() {
- return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle
- }, n.prototype.GetJointSpeed = function() {
- return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity
- }, n.prototype.IsMotorEnabled = function() {
- return this.m_enableMotor
- }, n.prototype.EnableMotor = function(t) {
- t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
- }, n.prototype.GetMotorTorque = function(t) {
- return t * this.m_motorImpulse
- }, n.prototype.GetMotorSpeed = function() {
- return this.m_motorSpeed
- }, n.prototype.SetMaxMotorTorque = function(t) {
- t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorTorque = t)
- }, n.prototype.GetMaxMotorTorque = function() {
- return this.m_maxMotorTorque
- }, n.prototype.IsLimitEnabled = function() {
- return this.m_enableLimit
- }, n.prototype.EnableLimit = function(t) {
- t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = t, this.m_impulse.z = 0)
- }, n.prototype.GetLowerLimit = function() {
- return this.m_lowerAngle
- }, n.prototype.GetUpperLimit = function() {
- return this.m_upperAngle
- }, n.prototype.SetLimits = function(t, e) {
- t === this.m_lowerAngle && e === this.m_upperAngle || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_impulse.z = 0, this.m_lowerAngle = t, this.m_upperAngle = e)
- }, n.prototype.SetMotorSpeed = function(t) {
- t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
- }, n.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), t(" jd.lowerAngle = %.15f;\n", this.m_lowerAngle), t(" jd.upperAngle = %.15f;\n", this.m_upperAngle), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_Cdot_v2 = new P, n.SolveVelocityConstraints_s_Cdot1 = new P, n.SolveVelocityConstraints_s_impulse_v3 = new O, n.SolveVelocityConstraints_s_reduced_v2 = new P, n.SolveVelocityConstraints_s_impulse_v2 = new P, n.SolvePositionConstraints_s_C_v2 = new P, n.SolvePositionConstraints_s_impulse = new P, n
- })(fi),
- Pi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_ropeJoint) || this;
- return i.localAnchorA = new P(-1, 0), i.localAnchorB = new P(1, 0), i.maxLength = 0, i
- }
- return $e(i, e), i
- })(_i),
- Ri = (function(i) {
- function n(n) {
- var r = i.call(this, n) || this;
- return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_maxLength = 0, r.m_length = 0, r.m_impulse = 0, r.m_indexA = 0, r.m_indexB = 0, r.m_u = new P, r.m_rA = new P, r.m_rB = new P, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_mass = 0, r.m_state = t.b2LimitState.e_inactiveLimit, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_localAnchorA.Copy(e(n.localAnchorA, new P(-1, 0))), r.m_localAnchorB.Copy(e(n.localAnchorB, new P(1, 0))), r.m_maxLength = e(n.maxLength, 0), r
- }
- return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var i = e.positions[this.m_indexA].c,
- r = e.positions[this.m_indexA].a,
- s = e.velocities[this.m_indexA].v,
- o = e.velocities[this.m_indexA].w,
- a = e.positions[this.m_indexB].c,
- h = e.positions[this.m_indexB].a,
- c = e.velocities[this.m_indexB].v,
- u = e.velocities[this.m_indexB].w,
- _ = this.m_qA.SetAngle(r),
- f = this.m_qB.SetAngle(h);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(_, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(f, this.m_lalcB, this.m_rB), this.m_u.Copy(a).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA), this.m_length = this.m_u.Length();
- var d = this.m_length - this.m_maxLength;
- if (this.m_state = d > 0 ? t.b2LimitState.e_atUpperLimit : t.b2LimitState.e_inactiveLimit, !(this.m_length > l)) return this.m_u.SetZero(), this.m_mass = 0, void(this.m_impulse = 0);
- this.m_u.SelfMul(1 / this.m_length);
- var p = P.CrossVV(this.m_rA, this.m_u),
- m = P.CrossVV(this.m_rB, this.m_u),
- y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
- if (this.m_mass = 0 !== y ? 1 / y : 0, e.step.warmStarting) {
- this.m_impulse *= e.step.dtRatio;
- var v = P.MulSV(this.m_impulse, this.m_u, n.InitVelocityConstraints_s_P);
- s.SelfMulSub(this.m_invMassA, v), o -= this.m_invIA * P.CrossVV(this.m_rA, v), c.SelfMulAdd(this.m_invMassB, v), u += this.m_invIB * P.CrossVV(this.m_rB, v)
- } else this.m_impulse = 0;
- e.velocities[this.m_indexA].w = o, e.velocities[this.m_indexB].w = u
- }, n.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- i = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = P.AddVCrossSV(e, i, this.m_rA, n.SolveVelocityConstraints_s_vpA),
- a = P.AddVCrossSV(r, s, this.m_rB, n.SolveVelocityConstraints_s_vpB),
- l = this.m_length - this.m_maxLength,
- h = P.DotVV(this.m_u, P.SubVV(a, o, P.s_t0));
- l < 0 && (h += t.step.inv_dt * l);
- var c = -this.m_mass * h,
- u = this.m_impulse;
- this.m_impulse = g(0, this.m_impulse + c), c = this.m_impulse - u;
- var _ = P.MulSV(c, this.m_u, n.SolveVelocityConstraints_s_P);
- e.SelfMulSub(this.m_invMassA, _), i -= this.m_invIA * P.CrossVV(this.m_rA, _), r.SelfMulAdd(this.m_invMassB, _), s += this.m_invIB * P.CrossVV(this.m_rB, _), t.velocities[this.m_indexA].w = i, t.velocities[this.m_indexB].w = s
- }, n.prototype.SolvePositionConstraints = function(t) {
- var e = t.positions[this.m_indexA].c,
- i = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(i),
- a = this.m_qB.SetAngle(s);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var h = N.MulRV(o, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var c = N.MulRV(a, this.m_lalcB, this.m_rB),
- u = this.m_u.Copy(r).SelfAdd(c).SelfSub(e).SelfSub(h),
- _ = u.Normalize(),
- f = _ - this.m_maxLength;
- f = b(f, 0, .2);
- var d = -this.m_mass * f,
- p = P.MulSV(d, u, n.SolvePositionConstraints_s_P);
- return e.SelfMulSub(this.m_invMassA, p), i -= this.m_invIA * P.CrossVV(h, p), r.SelfMulAdd(this.m_invMassB, p), s += this.m_invIB * P.CrossVV(c, p), t.positions[this.m_indexA].a = i, t.positions[this.m_indexB].a = s, _ - this.m_maxLength < l
- }, n.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, n.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, n.prototype.GetReactionForce = function(t, e) {
- return P.MulSV(t * this.m_impulse, this.m_u, e)
- }, n.prototype.GetReactionTorque = function(t) {
- return 0
- }, n.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, n.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, n.prototype.SetMaxLength = function(t) {
- this.m_maxLength = t
- }, n.prototype.GetMaxLength = function() {
- return this.m_maxLength
- }, n.prototype.GetLimitState = function() {
- return this.m_state
- }, n.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2RopeJointDef = new b2RopeJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.maxLength = %.15f;\n", this.m_maxLength), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_vpA = new P, n.SolveVelocityConstraints_s_vpB = new P, n.SolveVelocityConstraints_s_P = new P, n.SolvePositionConstraints_s_P = new P, n
- })(fi),
- Oi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_weldJoint) || this;
- return i.localAnchorA = new P, i.localAnchorB = new P, i.referenceAngle = 0, i.frequencyHz = 0, i.dampingRatio = 0, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
- }, i
- })(_i),
- Li = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_bias = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_referenceAngle = 0, n.m_gamma = 0, n.m_impulse = new O(0, 0, 0), n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = new F, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_K = new F, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_localAnchorA.Copy(e(i.localAnchorA, P.ZERO)), n.m_localAnchorB.Copy(e(i.localAnchorB, P.ZERO)), n.m_referenceAngle = e(i.referenceAngle, 0), n.m_impulse.SetZero(), n
- }
- return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = t.positions[this.m_indexA].a,
- n = t.velocities[this.m_indexA].v,
- r = t.velocities[this.m_indexA].w,
- o = t.positions[this.m_indexB].a,
- a = t.velocities[this.m_indexB].v,
- l = t.velocities[this.m_indexB].w,
- h = this.m_qA.SetAngle(e),
- c = this.m_qB.SetAngle(o);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(h, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(c, this.m_lalcB, this.m_rB);
- var u = this.m_invMassA,
- _ = this.m_invMassB,
- f = this.m_invIA,
- d = this.m_invIB,
- p = this.m_K;
- if (p.ex.x = u + _ + this.m_rA.y * this.m_rA.y * f + this.m_rB.y * this.m_rB.y * d, p.ey.x = -this.m_rA.y * this.m_rA.x * f - this.m_rB.y * this.m_rB.x * d, p.ez.x = -this.m_rA.y * f - this.m_rB.y * d, p.ex.y = p.ey.x, p.ey.y = u + _ + this.m_rA.x * this.m_rA.x * f + this.m_rB.x * this.m_rB.x * d, p.ez.y = this.m_rA.x * f + this.m_rB.x * d, p.ex.z = p.ez.x, p.ey.z = p.ez.y, p.ez.z = f + d, this.m_frequencyHz > 0) {
- p.GetInverse22(this.m_mass);
- var m = f + d,
- y = m > 0 ? 1 / m : 0,
- v = o - e - this.m_referenceAngle,
- g = 2 * s * this.m_frequencyHz,
- x = 2 * y * this.m_dampingRatio * g,
- b = y * g * g,
- A = t.step.dt;
- this.m_gamma = A * (x + A * b), this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, this.m_bias = v * A * b * this.m_gamma, m += this.m_gamma, this.m_mass.ez.z = 0 !== m ? 1 / m : 0
- } else p.GetSymInverse33(this.m_mass), this.m_gamma = 0, this.m_bias = 0;
- if (t.step.warmStarting) {
- this.m_impulse.SelfMul(t.step.dtRatio);
- var C = i.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
- n.SelfMulSub(u, C), r -= f * (P.CrossVV(this.m_rA, C) + this.m_impulse.z), a.SelfMulAdd(_, C), l += d * (P.CrossVV(this.m_rB, C) + this.m_impulse.z)
- } else this.m_impulse.SetZero();
- t.velocities[this.m_indexA].w = r, t.velocities[this.m_indexB].w = l
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = t.velocities[this.m_indexA].v,
- n = t.velocities[this.m_indexA].w,
- r = t.velocities[this.m_indexB].v,
- s = t.velocities[this.m_indexB].w,
- o = this.m_invMassA,
- a = this.m_invMassB,
- l = this.m_invIA,
- h = this.m_invIB;
- if (this.m_frequencyHz > 0) {
- var c = s - n,
- u = -this.m_mass.ez.z * (c + this.m_bias + this.m_gamma * this.m_impulse.z);
- this.m_impulse.z += u, n -= l * u, s += h * u;
- var _ = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot1),
- f = F.MulM33XY(this.m_mass, _.x, _.y, i.SolveVelocityConstraints_s_impulse1).SelfNeg();
- this.m_impulse.x += f.x, this.m_impulse.y += f.y;
- var d = f;
- e.SelfMulSub(o, d), n -= l * P.CrossVV(this.m_rA, d), r.SelfMulAdd(a, d), s += h * P.CrossVV(this.m_rB, d)
- } else {
- _ = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot1), c = s - n;
- var p = F.MulM33XYZ(this.m_mass, _.x, _.y, c, i.SolveVelocityConstraints_s_impulse).SelfNeg();
- this.m_impulse.SelfAdd(p);
- d = i.SolveVelocityConstraints_s_P.Set(p.x, p.y);
- e.SelfMulSub(o, d), n -= l * (P.CrossVV(this.m_rA, d) + p.z), r.SelfMulAdd(a, d), s += h * (P.CrossVV(this.m_rB, d) + p.z)
- }
- t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
- }, i.prototype.SolvePositionConstraints = function(t) {
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(n),
- a = this.m_qB.SetAngle(s),
- c = this.m_invMassA,
- u = this.m_invMassB,
- _ = this.m_invIA,
- f = this.m_invIB;
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var d = N.MulRV(o, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var p, m, y = N.MulRV(a, this.m_lalcB, this.m_rB),
- g = this.m_K;
- if (g.ex.x = c + u + d.y * d.y * _ + y.y * y.y * f, g.ey.x = -d.y * d.x * _ - y.y * y.x * f, g.ez.x = -d.y * _ - y.y * f, g.ex.y = g.ey.x, g.ey.y = c + u + d.x * d.x * _ + y.x * y.x * f, g.ez.y = d.x * _ + y.x * f, g.ex.z = g.ez.x, g.ey.z = g.ez.y, g.ez.z = _ + f, this.m_frequencyHz > 0) {
- p = (b = P.SubVV(P.AddVV(r, y, P.s_t0), P.AddVV(e, d, P.s_t1), i.SolvePositionConstraints_s_C1)).Length(), m = 0;
- var x = g.Solve22(b.x, b.y, i.SolvePositionConstraints_s_P).SelfNeg();
- e.SelfMulSub(c, x), n -= _ * P.CrossVV(d, x), r.SelfMulAdd(u, x), s += f * P.CrossVV(y, x)
- } else {
- var b = P.SubVV(P.AddVV(r, y, P.s_t0), P.AddVV(e, d, P.s_t1), i.SolvePositionConstraints_s_C1),
- A = s - n - this.m_referenceAngle;
- p = b.Length(), m = v(A);
- var C = g.Solve33(b.x, b.y, A, i.SolvePositionConstraints_s_impulse).SelfNeg();
- x = i.SolvePositionConstraints_s_P.Set(C.x, C.y);
- e.SelfMulSub(c, x), n -= _ * (P.CrossVV(this.m_rA, x) + C.z), r.SelfMulAdd(u, x), s += f * (P.CrossVV(this.m_rB, x) + C.z)
- }
- return t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, p <= l && m <= h
- }, i.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return e.x = t * this.m_impulse.x, e.y = t * this.m_impulse.y, e
- }, i.prototype.GetReactionTorque = function(t) {
- return t * this.m_impulse.z
- }, i.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, i.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, i.prototype.GetReferenceAngle = function() {
- return this.m_referenceAngle
- }, i.prototype.SetFrequency = function(t) {
- this.m_frequencyHz = t
- }, i.prototype.GetFrequency = function() {
- return this.m_frequencyHz
- }, i.prototype.SetDampingRatio = function(t) {
- this.m_dampingRatio = t
- }, i.prototype.GetDampingRatio = function() {
- return this.m_dampingRatio
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_Cdot1 = new P, i.SolveVelocityConstraints_s_impulse1 = new P, i.SolveVelocityConstraints_s_impulse = new O, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_C1 = new P, i.SolvePositionConstraints_s_P = new P, i.SolvePositionConstraints_s_impulse = new O, i
- })(fi),
- Fi = (function(e) {
- function i() {
- var i = e.call(this, t.b2JointType.e_wheelJoint) || this;
- return i.localAnchorA = new P(0, 0), i.localAnchorB = new P(0, 0), i.localAxisA = new P(1, 0), i.enableMotor = !1, i.maxMotorTorque = 0, i.motorSpeed = 0, i.frequencyHz = 2, i.dampingRatio = .7, i
- }
- return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
- this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.bodyA.GetLocalVector(n, this.localAxisA)
- }, i
- })(_i),
- Ni = (function(t) {
- function i(i) {
- var n = t.call(this, i) || this;
- return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_localXAxisA = new P, n.m_localYAxisA = new P, n.m_impulse = 0, n.m_motorImpulse = 0, n.m_springImpulse = 0, n.m_maxMotorTorque = 0, n.m_motorSpeed = 0, n.m_enableMotor = !1, n.m_indexA = 0, n.m_indexB = 0, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_ax = new P, n.m_ay = new P, n.m_sAx = 0, n.m_sBx = 0, n.m_sAy = 0, n.m_sBy = 0, n.m_mass = 0, n.m_motorMass = 0, n.m_springMass = 0, n.m_bias = 0, n.m_gamma = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_rA = new P, n.m_rB = new P, n.m_frequencyHz = e(i.frequencyHz, 2), n.m_dampingRatio = e(i.dampingRatio, .7), n.m_localAnchorA.Copy(e(i.localAnchorA, P.ZERO)), n.m_localAnchorB.Copy(e(i.localAnchorB, P.ZERO)), n.m_localXAxisA.Copy(e(i.localAxisA, P.UNITX)), P.CrossOneV(n.m_localXAxisA, n.m_localYAxisA), n.m_maxMotorTorque = e(i.maxMotorTorque, 0), n.m_motorSpeed = e(i.motorSpeed, 0), n.m_enableMotor = e(i.enableMotor, !1), n.m_ax.SetZero(), n.m_ay.SetZero(), n
- }
- return $e(i, t), i.prototype.GetMotorSpeed = function() {
- return this.m_motorSpeed
- }, i.prototype.GetMaxMotorTorque = function() {
- return this.m_maxMotorTorque
- }, i.prototype.SetSpringFrequencyHz = function(t) {
- this.m_frequencyHz = t
- }, i.prototype.GetSpringFrequencyHz = function() {
- return this.m_frequencyHz
- }, i.prototype.SetSpringDampingRatio = function(t) {
- this.m_dampingRatio = t
- }, i.prototype.GetSpringDampingRatio = function() {
- return this.m_dampingRatio
- }, i.prototype.InitVelocityConstraints = function(t) {
- this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
- var e = this.m_invMassA,
- n = this.m_invMassB,
- r = this.m_invIA,
- o = this.m_invIB,
- a = t.positions[this.m_indexA].c,
- l = t.positions[this.m_indexA].a,
- h = t.velocities[this.m_indexA].v,
- c = t.velocities[this.m_indexA].w,
- u = t.positions[this.m_indexB].c,
- _ = t.positions[this.m_indexB].a,
- f = t.velocities[this.m_indexB].v,
- d = t.velocities[this.m_indexB].w,
- p = this.m_qA.SetAngle(l),
- m = this.m_qB.SetAngle(_);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var y = N.MulRV(p, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var v = N.MulRV(m, this.m_lalcB, this.m_rB),
- g = P.SubVV(P.AddVV(u, v, P.s_t0), P.AddVV(a, y, P.s_t1), i.InitVelocityConstraints_s_d);
- if (N.MulRV(p, this.m_localYAxisA, this.m_ay), this.m_sAy = P.CrossVV(P.AddVV(g, y, P.s_t0), this.m_ay), this.m_sBy = P.CrossVV(v, this.m_ay), this.m_mass = e + n + r * this.m_sAy * this.m_sAy + o * this.m_sBy * this.m_sBy, this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), this.m_springMass = 0, this.m_bias = 0, this.m_gamma = 0, this.m_frequencyHz > 0) {
- N.MulRV(p, this.m_localXAxisA, this.m_ax), this.m_sAx = P.CrossVV(P.AddVV(g, y, P.s_t0), this.m_ax), this.m_sBx = P.CrossVV(v, this.m_ax);
- var x = e + n + r * this.m_sAx * this.m_sAx + o * this.m_sBx * this.m_sBx;
- if (x > 0) {
- this.m_springMass = 1 / x;
- var b = P.DotVV(g, this.m_ax),
- A = 2 * s * this.m_frequencyHz,
- C = 2 * this.m_springMass * this.m_dampingRatio * A,
- T = this.m_springMass * A * A,
- S = t.step.dt;
- this.m_gamma = S * (C + S * T), this.m_gamma > 0 && (this.m_gamma = 1 / this.m_gamma), this.m_bias = b * S * T * this.m_gamma, this.m_springMass = x + this.m_gamma, this.m_springMass > 0 && (this.m_springMass = 1 / this.m_springMass)
- }
- } else this.m_springImpulse = 0;
- if (this.m_enableMotor ? (this.m_motorMass = r + o, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass)) : (this.m_motorMass = 0, this.m_motorImpulse = 0), t.step.warmStarting) {
- this.m_impulse *= t.step.dtRatio, this.m_springImpulse *= t.step.dtRatio, this.m_motorImpulse *= t.step.dtRatio;
- var w = P.AddVV(P.MulSV(this.m_impulse, this.m_ay, P.s_t0), P.MulSV(this.m_springImpulse, this.m_ax, P.s_t1), i.InitVelocityConstraints_s_P),
- E = this.m_impulse * this.m_sAy + this.m_springImpulse * this.m_sAx + this.m_motorImpulse,
- M = this.m_impulse * this.m_sBy + this.m_springImpulse * this.m_sBx + this.m_motorImpulse;
- h.SelfMulSub(this.m_invMassA, w), c -= this.m_invIA * E, f.SelfMulAdd(this.m_invMassB, w), d += this.m_invIB * M
- } else this.m_impulse = 0, this.m_springImpulse = 0, this.m_motorImpulse = 0;
- t.velocities[this.m_indexA].w = c, t.velocities[this.m_indexB].w = d
- }, i.prototype.SolveVelocityConstraints = function(t) {
- var e = this.m_invMassA,
- n = this.m_invMassB,
- r = this.m_invIA,
- s = this.m_invIB,
- o = t.velocities[this.m_indexA].v,
- a = t.velocities[this.m_indexA].w,
- l = t.velocities[this.m_indexB].v,
- h = t.velocities[this.m_indexB].w,
- c = P.DotVV(this.m_ax, P.SubVV(l, o, P.s_t0)) + this.m_sBx * h - this.m_sAx * a,
- u = -this.m_springMass * (c + this.m_bias + this.m_gamma * this.m_springImpulse);
- this.m_springImpulse += u;
- var _ = P.MulSV(u, this.m_ax, i.SolveVelocityConstraints_s_P),
- f = u * this.m_sAx,
- d = u * this.m_sBx;
- o.SelfMulSub(e, _), a -= r * f, l.SelfMulAdd(n, _);
- c = (h += s * d) - a - this.m_motorSpeed, u = -this.m_motorMass * c;
- var p = this.m_motorImpulse,
- m = t.step.dt * this.m_maxMotorTorque;
- this.m_motorImpulse = b(this.m_motorImpulse + u, -m, m), a -= r * (u = this.m_motorImpulse - p), h += s * u;
- c = P.DotVV(this.m_ay, P.SubVV(l, o, P.s_t0)) + this.m_sBy * h - this.m_sAy * a, u = -this.m_mass * c;
- this.m_impulse += u;
- _ = P.MulSV(u, this.m_ay, i.SolveVelocityConstraints_s_P), f = u * this.m_sAy, d = u * this.m_sBy;
- o.SelfMulSub(e, _), a -= r * f, l.SelfMulAdd(n, _), h += s * d, t.velocities[this.m_indexA].w = a, t.velocities[this.m_indexB].w = h
- }, i.prototype.SolvePositionConstraints = function(t) {
- var e = t.positions[this.m_indexA].c,
- n = t.positions[this.m_indexA].a,
- r = t.positions[this.m_indexB].c,
- s = t.positions[this.m_indexB].a,
- o = this.m_qA.SetAngle(n),
- a = this.m_qB.SetAngle(s);
- P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
- var h = N.MulRV(o, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
- var c, u = N.MulRV(a, this.m_lalcB, this.m_rB),
- _ = P.AddVV(P.SubVV(r, e, P.s_t0), P.SubVV(u, h, P.s_t1), i.SolvePositionConstraints_s_d),
- f = N.MulRV(o, this.m_localYAxisA, this.m_ay),
- d = P.CrossVV(P.AddVV(_, h, P.s_t0), f),
- p = P.CrossVV(u, f),
- m = P.DotVV(_, this.m_ay),
- y = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_sAy * this.m_sAy + this.m_invIB * this.m_sBy * this.m_sBy;
- c = 0 !== y ? -m / y : 0;
- var g = P.MulSV(c, f, i.SolvePositionConstraints_s_P),
- x = c * d,
- b = c * p;
- return e.SelfMulSub(this.m_invMassA, g), n -= this.m_invIA * x, r.SelfMulAdd(this.m_invMassB, g), s += this.m_invIB * b, t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, v(m) <= l
- }, i.prototype.GetDefinition = function(t) {
- return t
- }, i.prototype.GetAnchorA = function(t) {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
- }, i.prototype.GetAnchorB = function(t) {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
- }, i.prototype.GetReactionForce = function(t, e) {
- return e.x = t * (this.m_impulse * this.m_ay.x + this.m_springImpulse * this.m_ax.x), e.y = t * (this.m_impulse * this.m_ay.y + this.m_springImpulse * this.m_ax.y), e
- }, i.prototype.GetReactionTorque = function(t) {
- return t * this.m_motorImpulse
- }, i.prototype.GetLocalAnchorA = function() {
- return this.m_localAnchorA
- }, i.prototype.GetLocalAnchorB = function() {
- return this.m_localAnchorB
- }, i.prototype.GetLocalAxisA = function() {
- return this.m_localXAxisA
- }, i.prototype.GetJointTranslation = function() {
- return this.GetPrismaticJointTranslation()
- }, i.prototype.GetJointLinearSpeed = function() {
- return this.GetPrismaticJointSpeed()
- }, i.prototype.GetJointAngle = function() {
- return this.GetRevoluteJointAngle()
- }, i.prototype.GetJointAngularSpeed = function() {
- return this.GetRevoluteJointSpeed()
- }, i.prototype.GetPrismaticJointTranslation = function() {
- var t = this.m_bodyA,
- e = this.m_bodyB,
- i = t.GetWorldPoint(this.m_localAnchorA, new P),
- n = e.GetWorldPoint(this.m_localAnchorB, new P),
- r = P.SubVV(n, i, new P),
- s = t.GetWorldVector(this.m_localXAxisA, new P);
- return P.DotVV(r, s)
- }, i.prototype.GetPrismaticJointSpeed = function() {
- var t = this.m_bodyA,
- e = this.m_bodyB;
- P.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
- var i = N.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
- P.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
- var n = N.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB),
- r = P.AddVV(t.m_sweep.c, i, P.s_t0),
- s = P.AddVV(e.m_sweep.c, n, P.s_t1),
- o = P.SubVV(s, r, P.s_t2),
- a = t.GetWorldVector(this.m_localXAxisA, new P),
- l = t.m_linearVelocity,
- h = e.m_linearVelocity,
- c = t.m_angularVelocity,
- u = e.m_angularVelocity;
- return P.DotVV(o, P.CrossSV(c, a, P.s_t0)) + P.DotVV(a, P.SubVV(P.AddVCrossSV(h, u, n, P.s_t0), P.AddVCrossSV(l, c, i, P.s_t1), P.s_t0))
- }, i.prototype.GetRevoluteJointAngle = function() {
- return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a
- }, i.prototype.GetRevoluteJointSpeed = function() {
- var t = this.m_bodyA.m_angularVelocity;
- return this.m_bodyB.m_angularVelocity - t
- }, i.prototype.IsMotorEnabled = function() {
- return this.m_enableMotor
- }, i.prototype.EnableMotor = function(t) {
- t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
- }, i.prototype.SetMotorSpeed = function(t) {
- t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
- }, i.prototype.SetMaxMotorTorque = function(t) {
- t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorTorque = t)
- }, i.prototype.GetMotorTorque = function(t) {
- return t * this.m_motorImpulse
- }, i.prototype.Dump = function(t) {
- var e = this.m_bodyA.m_islandIndex,
- i = this.m_bodyB.m_islandIndex;
- t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
- }, i.InitVelocityConstraints_s_d = new P, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_d = new P, i.SolvePositionConstraints_s_P = new P, i
- })(fi);
- function Vi(t, e) {
- return S(t * e)
- }
- function ki(t, e) {
- return t > e ? t : e
- }
- var Gi = (function() {
- return function(t) {
- this.prev = null, this.next = null, this.contact = t
- }
- })(),
- Ui = (function() {
- function t() {
- this.m_islandFlag = !1, this.m_touchingFlag = !1, this.m_enabledFlag = !1, this.m_filterFlag = !1, this.m_bulletHitFlag = !1, this.m_toiFlag = !1, this.m_prev = null, this.m_next = null, this.m_indexA = 0, this.m_indexB = 0, this.m_manifold = new bt, this.m_toiCount = 0, this.m_toi = 0, this.m_friction = 0, this.m_restitution = 0, this.m_tangentSpeed = 0, this.m_oldManifold = new bt, this.m_nodeA = new Gi(this), this.m_nodeB = new Gi(this)
- }
- return t.prototype.GetManifold = function() {
- return this.m_manifold
- }, t.prototype.GetWorldManifold = function(t) {
- var e = this.m_fixtureA.GetBody(),
- i = this.m_fixtureB.GetBody(),
- n = this.m_fixtureA.GetShape(),
- r = this.m_fixtureB.GetShape();
- t.Initialize(this.m_manifold, e.GetTransform(), n.m_radius, i.GetTransform(), r.m_radius)
- }, t.prototype.IsTouching = function() {
- return this.m_touchingFlag
- }, t.prototype.SetEnabled = function(t) {
- this.m_enabledFlag = t
- }, t.prototype.IsEnabled = function() {
- return this.m_enabledFlag
- }, t.prototype.GetNext = function() {
- return this.m_next
- }, t.prototype.GetFixtureA = function() {
- return this.m_fixtureA
- }, t.prototype.GetChildIndexA = function() {
- return this.m_indexA
- }, t.prototype.GetFixtureB = function() {
- return this.m_fixtureB
- }, t.prototype.GetChildIndexB = function() {
- return this.m_indexB
- }, t.prototype.FlagForFiltering = function() {
- this.m_filterFlag = !0
- }, t.prototype.SetFriction = function(t) {
- this.m_friction = t
- }, t.prototype.GetFriction = function() {
- return this.m_friction
- }, t.prototype.ResetFriction = function() {
- this.m_friction = Vi(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction)
- }, t.prototype.SetRestitution = function(t) {
- this.m_restitution = t
- }, t.prototype.GetRestitution = function() {
- return this.m_restitution
- }, t.prototype.ResetRestitution = function() {
- this.m_restitution = ki(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution)
- }, t.prototype.SetTangentSpeed = function(t) {
- this.m_tangentSpeed = t
- }, t.prototype.GetTangentSpeed = function() {
- return this.m_tangentSpeed
- }, t.prototype.Reset = function(t, e, i, n) {
- this.m_islandFlag = !1, this.m_touchingFlag = !1, this.m_enabledFlag = !0, this.m_filterFlag = !1, this.m_bulletHitFlag = !1, this.m_toiFlag = !1, this.m_fixtureA = t, this.m_fixtureB = i, this.m_indexA = e, this.m_indexB = n, this.m_manifold.pointCount = 0, this.m_prev = null, this.m_next = null, delete this.m_nodeA.contact, this.m_nodeA.prev = null, this.m_nodeA.next = null, delete this.m_nodeA.other, delete this.m_nodeB.contact, this.m_nodeB.prev = null, this.m_nodeB.next = null, delete this.m_nodeB.other, this.m_toiCount = 0, this.m_friction = Vi(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction), this.m_restitution = ki(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution)
- }, t.prototype.Update = function(t) {
- var e = this.m_oldManifold;
- this.m_oldManifold = this.m_manifold, this.m_manifold = e, this.m_enabledFlag = !0;
- var i = !1,
- n = this.m_touchingFlag,
- r = this.m_fixtureA.IsSensor(),
- s = this.m_fixtureB.IsSensor(),
- o = r || s,
- a = this.m_fixtureA.GetBody(),
- l = this.m_fixtureB.GetBody(),
- h = a.GetTransform(),
- c = l.GetTransform();
- if (o) {
- var u = this.m_fixtureA.GetShape(),
- _ = this.m_fixtureB.GetShape();
- i = Pt(u, this.m_indexA, _, this.m_indexB, h, c), this.m_manifold.pointCount = 0
- } else {
- this.Evaluate(this.m_manifold, h, c), i = this.m_manifold.pointCount > 0;
- for (var f = 0; f < this.m_manifold.pointCount; ++f) {
- var d = this.m_manifold.points[f];
- d.normalImpulse = 0, d.tangentImpulse = 0;
- for (var p = d.id, m = 0; m < this.m_oldManifold.pointCount; ++m) {
- var y = this.m_oldManifold.points[m];
- if (y.id.key === p.key) {
- d.normalImpulse = y.normalImpulse, d.tangentImpulse = y.tangentImpulse;
- break
- }
- }
- }
- i !== n && (a.SetAwake(!0), l.SetAwake(!0))
- }
- this.m_touchingFlag = i, !n && i && t && t.BeginContact(this), n && !i && t && t.EndContact(this), !o && i && t && t.PreSolve(this, this.m_oldManifold)
- }, t.prototype.ComputeTOI = function(e, i) {
- var n = t.ComputeTOI_s_input;
- n.proxyA.SetShape(this.m_fixtureA.GetShape(), this.m_indexA), n.proxyB.SetShape(this.m_fixtureB.GetShape(), this.m_indexB), n.sweepA.Copy(e), n.sweepB.Copy(i), n.tMax = l;
- var r = t.ComputeTOI_s_output;
- return re(r, n), r.t
- }, t.ComputeTOI_s_input = new Xt, t.ComputeTOI_s_output = new Yt, t
- })(),
- zi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, e, i) {
- ae(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
- }, e
- })(Ui),
- ji = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, e, i) {
- Le(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
- }, e
- })(Ui),
- Wi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, e, i) {
- ue(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
- }, e
- })(Ui),
- Hi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, e, i) {
- We(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
- }, e
- })(Ui),
- Xi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, e, i) {
- Je(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
- }, e
- })(Ui),
- Yi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, i, n) {
- var r = this.m_fixtureA.GetShape(),
- s = this.m_fixtureB.GetShape(),
- o = r,
- a = e.Evaluate_s_edge;
- o.GetChildEdge(a, this.m_indexA), We(t, a, i, s, n)
- }, e.Evaluate_s_edge = new ii, e
- })(Ui),
- qi = (function(t) {
- function e() {
- return t.call(this) || this
- }
- return $e(e, t), e.Create = function(t) {
- return new e
- }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
- t.prototype.Reset.call(this, e, i, n, r)
- }, e.prototype.Evaluate = function(t, i, n) {
- var r = this.m_fixtureA.GetShape(),
- s = this.m_fixtureB.GetShape(),
- o = r,
- a = e.Evaluate_s_edge;
- o.GetChildEdge(a, this.m_indexA), Je(t, a, i, s, n)
- }, e.Evaluate_s_edge = new ii, e
- })(Ui),
- Ji = (function() {
- return function() {
- this.createFcn = null, this.destroyFcn = null, this.primary = !1
- }
- })(),
- Zi = (function() {
- function e(t) {
- this.m_allocator = null, this.m_allocator = t, this.InitializeRegisters()
- }
- return e.prototype.AddType = function(t, e, i, n) {
- var r = this,
- s = d(256, (function(e) {
- return t(r.m_allocator)
- }));
- function o(e) {
- return s.pop() || t(e)
- }
- function a(t, e) {
- s.push(t)
- }
- this.m_registers[i][n].createFcn = o, this.m_registers[i][n].destroyFcn = a, this.m_registers[i][n].primary = !0, i !== n && (this.m_registers[n][i].createFcn = o, this.m_registers[n][i].destroyFcn = a, this.m_registers[n][i].primary = !1)
- }, e.prototype.InitializeRegisters = function() {
- this.m_registers = [];
- for (var e = 0; e < t.b2ShapeType.e_shapeTypeCount; e++) {
- this.m_registers[e] = [];
- for (var i = 0; i < t.b2ShapeType.e_shapeTypeCount; i++) this.m_registers[e][i] = new Ji
- }
- this.AddType(zi.Create, zi.Destroy, t.b2ShapeType.e_circleShape, t.b2ShapeType.e_circleShape), this.AddType(Wi.Create, Wi.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_circleShape), this.AddType(ji.Create, ji.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_polygonShape), this.AddType(Hi.Create, Hi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_circleShape), this.AddType(Xi.Create, Xi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_polygonShape), this.AddType(Yi.Create, Yi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_circleShape), this.AddType(qi.Create, qi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_polygonShape)
- }, e.prototype.Create = function(t, e, i, n) {
- var r = t.GetType(),
- s = i.GetType(),
- o = this.m_registers[r][s];
- if (o.createFcn) {
- var a = o.createFcn(this.m_allocator);
- return o.primary ? a.Reset(t, e, i, n) : a.Reset(i, n, t, e), a
- }
- return null
- }, e.prototype.Destroy = function(t) {
- var e = t.m_fixtureA,
- i = t.m_fixtureB;
- t.m_manifold.pointCount > 0 && !e.IsSensor() && !i.IsSensor() && (e.GetBody().SetAwake(!0), i.GetBody().SetAwake(!0));
- var n = e.GetType(),
- r = i.GetType(),
- s = this.m_registers[n][r];
- s.destroyFcn && s.destroyFcn(t, this.m_allocator)
- }, e
- })(),
- Ki = (function() {
- function t() {}
- return t.prototype.SayGoodbyeJoint = function(t) {}, t.prototype.SayGoodbyeFixture = function(t) {}, t.prototype.SayGoodbyeParticleGroup = function(t) {}, t.prototype.SayGoodbyeParticle = function(t, e) {}, t
- })(),
- Qi = (function() {
- function e() {}
- return e.prototype.ShouldCollide = function(e, i) {
- var n = e.GetBody(),
- r = i.GetBody();
- if (r.GetType() === t.b2BodyType.b2_staticBody && n.GetType() === t.b2BodyType.b2_staticBody) return !1;
- if (!r.ShouldCollideConnected(n)) return !1;
- var s = e.GetFilterData(),
- o = i.GetFilterData();
- return s.groupIndex === o.groupIndex && 0 !== s.groupIndex ? s.groupIndex > 0 : 0 != (s.maskBits & o.categoryBits) && 0 != (s.categoryBits & o.maskBits)
- }, e.prototype.ShouldCollideFixtureParticle = function(t, e, i) {
- return !0
- }, e.prototype.ShouldCollideParticleParticle = function(t, e, i) {
- return !0
- }, e.b2_defaultFilter = new e, e
- })(),
- $i = (function() {
- return function() {
- this.normalImpulses = p(o), this.tangentImpulses = p(o), this.count = 0
- }
- })(),
- tn = (function() {
- function t() {}
- return t.prototype.BeginContact = function(t) {}, t.prototype.EndContact = function(t) {}, t.prototype.BeginContactFixtureParticle = function(t, e) {}, t.prototype.EndContactFixtureParticle = function(t, e) {}, t.prototype.BeginContactParticleParticle = function(t, e) {}, t.prototype.EndContactParticleParticle = function(t, e) {}, t.prototype.PreSolve = function(t, e) {}, t.prototype.PostSolve = function(t, e) {}, t.b2_defaultListener = new t, t
- })(),
- en = (function() {
- function t() {}
- return t.prototype.ReportFixture = function(t) {
- return !0
- }, t.prototype.ReportParticle = function(t, e) {
- return !1
- }, t.prototype.ShouldQueryParticleSystem = function(t) {
- return !0
- }, t
- })(),
- nn = (function() {
- function t() {}
- return t.prototype.ReportFixture = function(t, e, i, n) {
- return n
- }, t.prototype.ReportParticle = function(t, e, i, n, r) {
- return 0
- }, t.prototype.ShouldQueryParticleSystem = function(t) {
- return !0
- }, t
- })(),
- rn = (function() {
- function e() {
- this.m_broadPhase = new Nt, this.m_contactList = null, this.m_contactCount = 0, this.m_contactFilter = Qi.b2_defaultFilter, this.m_contactListener = tn.b2_defaultListener, this.m_allocator = null, this.m_contactFactory = new Zi(this.m_allocator)
- }
- return e.prototype.AddPair = function(t, e) {
- var i = t.fixture,
- n = e.fixture,
- r = t.childIndex,
- s = e.childIndex,
- o = i.GetBody(),
- a = n.GetBody();
- if (o !== a) {
- for (var l = a.GetContactList(); l;) {
- if (l.other === o) {
- var h = l.contact.GetFixtureA(),
- c = l.contact.GetFixtureB(),
- u = l.contact.GetChildIndexA(),
- _ = l.contact.GetChildIndexB();
- if (h === i && c === n && u === r && _ === s) return;
- if (h === n && c === i && u === s && _ === r) return
- }
- l = l.next
- }
- if (!this.m_contactFilter || this.m_contactFilter.ShouldCollide(i, n)) {
- var f = this.m_contactFactory.Create(i, r, n, s);
- null !== f && (i = f.GetFixtureA(), n = f.GetFixtureB(), r = f.GetChildIndexA(), s = f.GetChildIndexB(), o = i.m_body, a = n.m_body, f.m_prev = null, f.m_next = this.m_contactList, null !== this.m_contactList && (this.m_contactList.m_prev = f), this.m_contactList = f, f.m_nodeA.contact = f, f.m_nodeA.other = a, f.m_nodeA.prev = null, f.m_nodeA.next = o.m_contactList, null !== o.m_contactList && (o.m_contactList.prev = f.m_nodeA), o.m_contactList = f.m_nodeA, f.m_nodeB.contact = f, f.m_nodeB.other = o, f.m_nodeB.prev = null, f.m_nodeB.next = a.m_contactList, null !== a.m_contactList && (a.m_contactList.prev = f.m_nodeB), a.m_contactList = f.m_nodeB, i.IsSensor() || n.IsSensor() || (o.SetAwake(!0), a.SetAwake(!0)), ++this.m_contactCount)
- }
- }
- }, e.prototype.FindNewContacts = function() {
- var t = this;
- this.m_broadPhase.UpdatePairs((function(e, i) {
- t.AddPair(e, i)
- }))
- }, e.prototype.Destroy = function(t) {
- var e = t.GetFixtureA(),
- i = t.GetFixtureB(),
- n = e.GetBody(),
- r = i.GetBody();
- this.m_contactListener && t.IsTouching() && this.m_contactListener.EndContact(t), t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_contactList && (this.m_contactList = t.m_next), t.m_nodeA.prev && (t.m_nodeA.prev.next = t.m_nodeA.next), t.m_nodeA.next && (t.m_nodeA.next.prev = t.m_nodeA.prev), t.m_nodeA === n.m_contactList && (n.m_contactList = t.m_nodeA.next), t.m_nodeB.prev && (t.m_nodeB.prev.next = t.m_nodeB.next), t.m_nodeB.next && (t.m_nodeB.next.prev = t.m_nodeB.prev), t.m_nodeB === r.m_contactList && (r.m_contactList = t.m_nodeB.next), this.m_contactFactory.Destroy(t), --this.m_contactCount
- }, e.prototype.Collide = function() {
- for (var e = this.m_contactList; e;) {
- var i = e.GetFixtureA(),
- n = e.GetFixtureB(),
- r = e.GetChildIndexA(),
- s = e.GetChildIndexB(),
- o = i.GetBody(),
- a = n.GetBody();
- if (e.m_filterFlag) {
- if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, n)) {
- e = (c = e).m_next, this.Destroy(c);
- continue
- }
- e.m_filterFlag = !1
- }
- var l = o.IsAwake() && o.m_type !== t.b2BodyType.b2_staticBody,
- h = a.IsAwake() && a.m_type !== t.b2BodyType.b2_staticBody;
- if (l || h) {
- var c, u = i.m_proxies[r].treeNode,
- _ = n.m_proxies[s].treeNode;
- if (Et(u.aabb, _.aabb)) e.Update(this.m_contactListener), e = e.m_next;
- else e = (c = e).m_next, this.Destroy(c)
- } else e = e.m_next
- }
- }, e
- })(),
- sn = (function() {
- function t() {
- this.step = 0, this.collide = 0, this.solve = 0, this.solveInit = 0, this.solveVelocity = 0, this.solvePosition = 0, this.broadphase = 0, this.solveTOI = 0
- }
- return t.prototype.Reset = function() {
- return this.step = 0, this.collide = 0, this.solve = 0, this.solveInit = 0, this.solveVelocity = 0, this.solvePosition = 0, this.broadphase = 0, this.solveTOI = 0, this
- }, t
- })(),
- on = (function() {
- function t() {
- this.dt = 0, this.inv_dt = 0, this.dtRatio = 0, this.velocityIterations = 0, this.positionIterations = 0, this.particleIterations = 0, this.warmStarting = !1
- }
- return t.prototype.Copy = function(t) {
- return this.dt = t.dt, this.inv_dt = t.inv_dt, this.dtRatio = t.dtRatio, this.positionIterations = t.positionIterations, this.velocityIterations = t.velocityIterations, this.particleIterations = t.particleIterations, this.warmStarting = t.warmStarting, this
- }, t
- })(),
- an = (function() {
- function t() {
- this.c = new P, this.a = 0
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t
- })(),
- ln = (function() {
- function t() {
- this.v = new P, this.w = 0
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t
- })(),
- hn = (function() {
- return function() {
- this.step = new on
- }
- })(),
- cn = (function() {
- function t() {
- this.rA = new P, this.rB = new P, this.normalImpulse = 0, this.tangentImpulse = 0, this.normalMass = 0, this.tangentMass = 0, this.velocityBias = 0
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t
- })(),
- un = (function() {
- function t() {
- this.points = cn.MakeArray(o), this.normal = new P, this.tangent = new P, this.normalMass = new L, this.K = new L, this.indexA = 0, this.indexB = 0, this.invMassA = 0, this.invMassB = 0, this.invIA = 0, this.invIB = 0, this.friction = 0, this.restitution = 0, this.tangentSpeed = 0, this.pointCount = 0, this.contactIndex = 0
- }
- return t.MakeArray = function(e) {
- return d(e, (function(e) {
- return new t
- }))
- }, t
- })(),
- _n = (function() {
- function e() {
- this.localPoints = P.MakeArray(o), this.localNormal = new P, this.localPoint = new P, this.indexA = 0, this.indexB = 0, this.invMassA = 0, this.invMassB = 0, this.localCenterA = new P, this.localCenterB = new P, this.invIA = 0, this.invIB = 0, this.type = t.b2ManifoldType.e_unknown, this.radiusA = 0, this.radiusB = 0, this.pointCount = 0
- }
- return e.MakeArray = function(t) {
- return d(t, (function(t) {
- return new e
- }))
- }, e
- })(),
- fn = (function() {
- return function() {
- this.step = new on, this.count = 0, this.allocator = null
- }
- })(),
- dn = (function() {
- function e() {
- this.normal = new P, this.point = new P, this.separation = 0
- }
- return e.prototype.Initialize = function(i, n, r, s) {
- var o = e.Initialize_s_pointA,
- a = e.Initialize_s_pointB,
- l = e.Initialize_s_planePoint,
- h = e.Initialize_s_clipPoint;
- switch (i.type) {
- case t.b2ManifoldType.e_circles:
- V.MulXV(n, i.localPoint, o), V.MulXV(r, i.localPoints[0], a), P.SubVV(a, o, this.normal).SelfNormalize(), P.MidVV(o, a, this.point), this.separation = P.DotVV(P.SubVV(a, o, P.s_t0), this.normal) - i.radiusA - i.radiusB;
- break;
- case t.b2ManifoldType.e_faceA:
- N.MulRV(n.q, i.localNormal, this.normal), V.MulXV(n, i.localPoint, l), V.MulXV(r, i.localPoints[s], h), this.separation = P.DotVV(P.SubVV(h, l, P.s_t0), this.normal) - i.radiusA - i.radiusB, this.point.Copy(h);
- break;
- case t.b2ManifoldType.e_faceB:
- N.MulRV(r.q, i.localNormal, this.normal), V.MulXV(r, i.localPoint, l), V.MulXV(n, i.localPoints[s], h), this.separation = P.DotVV(P.SubVV(h, l, P.s_t0), this.normal) - i.radiusA - i.radiusB, this.point.Copy(h), this.normal.SelfNeg()
- }
- }, e.Initialize_s_pointA = new P, e.Initialize_s_pointB = new P, e.Initialize_s_planePoint = new P, e.Initialize_s_clipPoint = new P, e
- })(),
- pn = (function() {
- function t() {
- this.m_step = new on, this.m_allocator = null, this.m_positionConstraints = _n.MakeArray(1024), this.m_velocityConstraints = un.MakeArray(1024), this.m_count = 0
- }
- return t.prototype.Initialize = function(t) {
- if (this.m_step.Copy(t.step), this.m_allocator = t.allocator, this.m_count = t.count, this.m_positionConstraints.length < this.m_count)
- for (var e = x(2 * this.m_positionConstraints.length, this.m_count); this.m_positionConstraints.length < e;) this.m_positionConstraints[this.m_positionConstraints.length] = new _n;
- if (this.m_velocityConstraints.length < this.m_count)
- for (e = x(2 * this.m_velocityConstraints.length, this.m_count); this.m_velocityConstraints.length < e;) this.m_velocityConstraints[this.m_velocityConstraints.length] = new un;
- this.m_positions = t.positions, this.m_velocities = t.velocities, this.m_contacts = t.contacts;
- for (var i = 0; i < this.m_count; ++i) {
- var n = this.m_contacts[i],
- r = n.m_fixtureA,
- s = n.m_fixtureB,
- o = r.GetShape(),
- a = s.GetShape(),
- l = o.m_radius,
- h = a.m_radius,
- c = r.GetBody(),
- u = s.GetBody(),
- _ = n.GetManifold(),
- f = _.pointCount,
- d = this.m_velocityConstraints[i];
- d.friction = n.m_friction, d.restitution = n.m_restitution, d.tangentSpeed = n.m_tangentSpeed, d.indexA = c.m_islandIndex, d.indexB = u.m_islandIndex, d.invMassA = c.m_invMass, d.invMassB = u.m_invMass, d.invIA = c.m_invI, d.invIB = u.m_invI, d.contactIndex = i, d.pointCount = f, d.K.SetZero(), d.normalMass.SetZero();
- var p = this.m_positionConstraints[i];
- p.indexA = c.m_islandIndex, p.indexB = u.m_islandIndex, p.invMassA = c.m_invMass, p.invMassB = u.m_invMass, p.localCenterA.Copy(c.m_sweep.localCenter), p.localCenterB.Copy(u.m_sweep.localCenter), p.invIA = c.m_invI, p.invIB = u.m_invI, p.localNormal.Copy(_.localNormal), p.localPoint.Copy(_.localPoint), p.pointCount = f, p.radiusA = l, p.radiusB = h, p.type = _.type;
- for (var m = 0; m < f; ++m) {
- var y = _.points[m],
- v = d.points[m];
- this.m_step.warmStarting ? (v.normalImpulse = this.m_step.dtRatio * y.normalImpulse, v.tangentImpulse = this.m_step.dtRatio * y.tangentImpulse) : (v.normalImpulse = 0, v.tangentImpulse = 0), v.rA.SetZero(), v.rB.SetZero(), v.normalMass = 0, v.tangentMass = 0, v.velocityBias = 0, p.localPoints[m].Copy(y.localPoint)
- }
- }
- return this
- }, t.prototype.InitializeVelocityConstraints = function() {
- for (var e = t.InitializeVelocityConstraints_s_xfA, i = t.InitializeVelocityConstraints_s_xfB, n = t.InitializeVelocityConstraints_s_worldManifold, r = 0; r < this.m_count; ++r) {
- var s = this.m_velocityConstraints[r],
- o = this.m_positionConstraints[r],
- a = o.radiusA,
- l = o.radiusB,
- h = this.m_contacts[s.contactIndex].GetManifold(),
- c = s.indexA,
- u = s.indexB,
- _ = s.invMassA,
- f = s.invMassB,
- d = s.invIA,
- p = s.invIB,
- m = o.localCenterA,
- y = o.localCenterB,
- v = this.m_positions[c].c,
- g = this.m_positions[c].a,
- x = this.m_velocities[c].v,
- b = this.m_velocities[c].w,
- A = this.m_positions[u].c,
- C = this.m_positions[u].a,
- T = this.m_velocities[u].v,
- S = this.m_velocities[u].w;
- e.q.SetAngle(g), i.q.SetAngle(C), P.SubVV(v, N.MulRV(e.q, m, P.s_t0), e.p), P.SubVV(A, N.MulRV(i.q, y, P.s_t0), i.p), n.Initialize(h, e, a, i, l), s.normal.Copy(n.normal), P.CrossVOne(s.normal, s.tangent);
- for (var w = s.pointCount, E = 0; E < w; ++E) {
- var M = s.points[E];
- P.SubVV(n.points[E], v, M.rA), P.SubVV(n.points[E], A, M.rB);
- var D = P.CrossVV(M.rA, s.normal),
- B = P.CrossVV(M.rB, s.normal),
- I = _ + f + d * D * D + p * B * B;
- M.normalMass = I > 0 ? 1 / I : 0;
- var R = s.tangent,
- O = P.CrossVV(M.rA, R),
- L = P.CrossVV(M.rB, R),
- F = _ + f + d * O * O + p * L * L;
- M.tangentMass = F > 0 ? 1 / F : 0, M.velocityBias = 0;
- var V = P.DotVV(s.normal, P.SubVV(P.AddVCrossSV(T, S, M.rB, P.s_t0), P.AddVCrossSV(x, b, M.rA, P.s_t1), P.s_t0));
- V < -1 && (M.velocityBias += -s.restitution * V)
- }
- s.pointCount
- }
- }, t.prototype.WarmStart = function() {
- for (var e = t.WarmStart_s_P, i = 0; i < this.m_count; ++i) {
- for (var n = this.m_velocityConstraints[i], r = n.indexA, s = n.indexB, o = n.invMassA, a = n.invIA, l = n.invMassB, h = n.invIB, c = n.pointCount, u = this.m_velocities[r].v, _ = this.m_velocities[r].w, f = this.m_velocities[s].v, d = this.m_velocities[s].w, p = n.normal, m = n.tangent, y = 0; y < c; ++y) {
- var v = n.points[y];
- P.AddVV(P.MulSV(v.normalImpulse, p, P.s_t0), P.MulSV(v.tangentImpulse, m, P.s_t1), e), _ -= a * P.CrossVV(v.rA, e), u.SelfMulSub(o, e), d += h * P.CrossVV(v.rB, e), f.SelfMulAdd(l, e)
- }
- this.m_velocities[r].w = _, this.m_velocities[s].w = d
- }
- }, t.prototype.SolveVelocityConstraints = function() {
- for (var e = t.SolveVelocityConstraints_s_dv, i = (t.SolveVelocityConstraints_s_dv1, t.SolveVelocityConstraints_s_dv2, t.SolveVelocityConstraints_s_P), n = (t.SolveVelocityConstraints_s_a, t.SolveVelocityConstraints_s_b, t.SolveVelocityConstraints_s_x, t.SolveVelocityConstraints_s_d, t.SolveVelocityConstraints_s_P1, t.SolveVelocityConstraints_s_P2, t.SolveVelocityConstraints_s_P1P2, 0); n < this.m_count; ++n) {
- for (var r = this.m_velocityConstraints[n], s = r.indexA, o = r.indexB, a = r.invMassA, l = r.invIA, h = r.invMassB, c = r.invIB, u = r.pointCount, _ = this.m_velocities[s].v, f = this.m_velocities[s].w, d = this.m_velocities[o].v, p = this.m_velocities[o].w, m = r.normal, y = r.tangent, v = r.friction, g = 0; g < u; ++g) {
- var A = r.points[g];
- P.SubVV(P.AddVCrossSV(d, p, A.rB, P.s_t0), P.AddVCrossSV(_, f, A.rA, P.s_t1), e);
- var C = P.DotVV(e, y) - r.tangentSpeed,
- T = A.tangentMass * -C,
- S = v * A.normalImpulse;
- T = (w = b(A.tangentImpulse + T, -S, S)) - A.tangentImpulse, A.tangentImpulse = w, P.MulSV(T, y, i), _.SelfMulSub(a, i), f -= l * P.CrossVV(A.rA, i), d.SelfMulAdd(h, i), p += c * P.CrossVV(A.rB, i)
- }
- r.pointCount;
- for (g = 0; g < u; ++g) {
- A = r.points[g];
- P.SubVV(P.AddVCrossSV(d, p, A.rB, P.s_t0), P.AddVCrossSV(_, f, A.rA, P.s_t1), e);
- var w, E = P.DotVV(e, m);
- T = -A.normalMass * (E - A.velocityBias);
- T = (w = x(A.normalImpulse + T, 0)) - A.normalImpulse, A.normalImpulse = w, P.MulSV(T, m, i), _.SelfMulSub(a, i), f -= l * P.CrossVV(A.rA, i), d.SelfMulAdd(h, i), p += c * P.CrossVV(A.rB, i)
- }
- this.m_velocities[s].w = f, this.m_velocities[o].w = p
- }
- }, t.prototype.StoreImpulses = function() {
- for (var t = 0; t < this.m_count; ++t)
- for (var e = this.m_velocityConstraints[t], i = this.m_contacts[e.contactIndex].GetManifold(), n = 0; n < e.pointCount; ++n) i.points[n].normalImpulse = e.points[n].normalImpulse, i.points[n].tangentImpulse = e.points[n].tangentImpulse
- }, t.prototype.SolvePositionConstraints = function() {
- for (var e = t.SolvePositionConstraints_s_xfA, i = t.SolvePositionConstraints_s_xfB, n = t.SolvePositionConstraints_s_psm, r = t.SolvePositionConstraints_s_rA, s = t.SolvePositionConstraints_s_rB, o = t.SolvePositionConstraints_s_P, a = 0, h = 0; h < this.m_count; ++h) {
- for (var c = this.m_positionConstraints[h], u = c.indexA, _ = c.indexB, f = c.localCenterA, d = c.invMassA, p = c.invIA, m = c.localCenterB, y = c.invMassB, v = c.invIB, x = c.pointCount, A = this.m_positions[u].c, C = this.m_positions[u].a, T = this.m_positions[_].c, S = this.m_positions[_].a, w = 0; w < x; ++w) {
- e.q.SetAngle(C), i.q.SetAngle(S), P.SubVV(A, N.MulRV(e.q, f, P.s_t0), e.p), P.SubVV(T, N.MulRV(i.q, m, P.s_t0), i.p), n.Initialize(c, e, i, w);
- var E = n.normal,
- M = n.point,
- D = n.separation;
- P.SubVV(M, A, r), P.SubVV(M, T, s), a = g(a, D);
- var B = b(.2 * (D + l), -.2, 0),
- I = P.CrossVV(r, E),
- R = P.CrossVV(s, E),
- O = d + y + p * I * I + v * R * R,
- L = O > 0 ? -B / O : 0;
- P.MulSV(L, E, o), A.SelfMulSub(d, o), C -= p * P.CrossVV(r, o), T.SelfMulAdd(y, o), S += v * P.CrossVV(s, o)
- }
- this.m_positions[u].a = C, this.m_positions[_].a = S
- }
- return a > -3 * l
- }, t.prototype.SolveTOIPositionConstraints = function(e, i) {
- for (var n = t.SolveTOIPositionConstraints_s_xfA, r = t.SolveTOIPositionConstraints_s_xfB, s = t.SolveTOIPositionConstraints_s_psm, o = t.SolveTOIPositionConstraints_s_rA, a = t.SolveTOIPositionConstraints_s_rB, h = t.SolveTOIPositionConstraints_s_P, c = 0, u = 0; u < this.m_count; ++u) {
- var _ = this.m_positionConstraints[u],
- f = _.indexA,
- d = _.indexB,
- p = _.localCenterA,
- m = _.localCenterB,
- y = _.pointCount,
- v = 0,
- x = 0;
- f !== e && f !== i || (v = _.invMassA, x = _.invIA);
- var A = 0,
- C = 0;
- d !== e && d !== i || (A = _.invMassB, C = _.invIB);
- for (var T = this.m_positions[f].c, S = this.m_positions[f].a, w = this.m_positions[d].c, E = this.m_positions[d].a, M = 0; M < y; ++M) {
- n.q.SetAngle(S), r.q.SetAngle(E), P.SubVV(T, N.MulRV(n.q, p, P.s_t0), n.p), P.SubVV(w, N.MulRV(r.q, m, P.s_t0), r.p), s.Initialize(_, n, r, M);
- var D = s.normal,
- B = s.point,
- I = s.separation;
- P.SubVV(B, T, o), P.SubVV(B, w, a), c = g(c, I);
- var R = b(.75 * (I + l), -.2, 0),
- O = P.CrossVV(o, D),
- L = P.CrossVV(a, D),
- F = v + A + x * O * O + C * L * L,
- V = F > 0 ? -R / F : 0;
- P.MulSV(V, D, h), T.SelfMulSub(v, h), S -= x * P.CrossVV(o, h), w.SelfMulAdd(A, h), E += C * P.CrossVV(a, h)
- }
- this.m_positions[f].a = S, this.m_positions[d].a = E
- }
- return c >= -1.5 * l
- }, t.InitializeVelocityConstraints_s_xfA = new V, t.InitializeVelocityConstraints_s_xfB = new V, t.InitializeVelocityConstraints_s_worldManifold = new At, t.WarmStart_s_P = new P, t.SolveVelocityConstraints_s_dv = new P, t.SolveVelocityConstraints_s_dv1 = new P, t.SolveVelocityConstraints_s_dv2 = new P, t.SolveVelocityConstraints_s_P = new P, t.SolveVelocityConstraints_s_a = new P, t.SolveVelocityConstraints_s_b = new P, t.SolveVelocityConstraints_s_x = new P, t.SolveVelocityConstraints_s_d = new P, t.SolveVelocityConstraints_s_P1 = new P, t.SolveVelocityConstraints_s_P2 = new P, t.SolveVelocityConstraints_s_P1P2 = new P, t.SolvePositionConstraints_s_xfA = new V, t.SolvePositionConstraints_s_xfB = new V, t.SolvePositionConstraints_s_psm = new dn, t.SolvePositionConstraints_s_rA = new P, t.SolvePositionConstraints_s_rB = new P, t.SolvePositionConstraints_s_P = new P, t.SolveTOIPositionConstraints_s_xfA = new V, t.SolveTOIPositionConstraints_s_xfB = new V, t.SolveTOIPositionConstraints_s_psm = new dn, t.SolveTOIPositionConstraints_s_rA = new P, t.SolveTOIPositionConstraints_s_rB = new P, t.SolveTOIPositionConstraints_s_P = new P, t
- })(),
- mn = (function() {
- function e() {
- this.m_allocator = null, this.m_bodies = [], this.m_contacts = [], this.m_joints = [], this.m_positions = an.MakeArray(1024), this.m_velocities = ln.MakeArray(1024), this.m_bodyCount = 0, this.m_jointCount = 0, this.m_contactCount = 0, this.m_bodyCapacity = 0, this.m_contactCapacity = 0, this.m_jointCapacity = 0
- }
- return e.prototype.Initialize = function(t, e, i, n, r) {
- if (this.m_bodyCapacity = t, this.m_contactCapacity = e, this.m_jointCapacity = i, this.m_bodyCount = 0, this.m_contactCount = 0, this.m_jointCount = 0, this.m_allocator = n, this.m_listener = r, this.m_positions.length < t)
- for (var s = x(2 * this.m_positions.length, t); this.m_positions.length < s;) this.m_positions[this.m_positions.length] = new an;
- if (this.m_velocities.length < t)
- for (s = x(2 * this.m_velocities.length, t); this.m_velocities.length < s;) this.m_velocities[this.m_velocities.length] = new ln
- }, e.prototype.Clear = function() {
- this.m_bodyCount = 0, this.m_contactCount = 0, this.m_jointCount = 0
- }, e.prototype.AddBody = function(t) {
- t.m_islandIndex = this.m_bodyCount, this.m_bodies[this.m_bodyCount++] = t
- }, e.prototype.AddContact = function(t) {
- this.m_contacts[this.m_contactCount++] = t
- }, e.prototype.AddJoint = function(t) {
- this.m_joints[this.m_jointCount++] = t
- }, e.prototype.Solve = function(n, r, s, o) {
- for (var a = e.s_timer.Reset(), l = r.dt, h = 0; h < this.m_bodyCount; ++h) {
- var c = this.m_bodies[h];
- this.m_positions[h].c.Copy(c.m_sweep.c);
- var u = c.m_sweep.a,
- _ = this.m_velocities[h].v.Copy(c.m_linearVelocity),
- f = c.m_angularVelocity;
- c.m_sweep.c0.Copy(c.m_sweep.c), c.m_sweep.a0 = c.m_sweep.a, c.m_type === t.b2BodyType.b2_dynamicBody && (_.x += l * (c.m_gravityScale * s.x + c.m_invMass * c.m_force.x), _.y += l * (c.m_gravityScale * s.y + c.m_invMass * c.m_force.y), f += l * c.m_invI * c.m_torque, _.SelfMul(1 / (1 + l * c.m_linearDamping)), f *= 1 / (1 + l * c.m_angularDamping)), this.m_positions[h].a = u, this.m_velocities[h].w = f
- }
- a.Reset();
- var d = e.s_solverData;
- d.step.Copy(r), d.positions = this.m_positions, d.velocities = this.m_velocities;
- var p = e.s_contactSolverDef;
- p.step.Copy(r), p.contacts = this.m_contacts, p.count = this.m_contactCount, p.positions = this.m_positions, p.velocities = this.m_velocities, p.allocator = this.m_allocator;
- var m = e.s_contactSolver.Initialize(p);
- m.InitializeVelocityConstraints(), r.warmStarting && m.WarmStart();
- for (h = 0; h < this.m_jointCount; ++h) this.m_joints[h].InitVelocityConstraints(d);
- n.solveInit = a.GetMilliseconds(), a.Reset();
- for (h = 0; h < r.velocityIterations; ++h) {
- for (var y = 0; y < this.m_jointCount; ++y) this.m_joints[y].SolveVelocityConstraints(d);
- m.SolveVelocityConstraints()
- }
- m.StoreImpulses(), n.solveVelocity = a.GetMilliseconds();
- for (h = 0; h < this.m_bodyCount; ++h) {
- var x = this.m_positions[h].c,
- b = (u = this.m_positions[h].a, _ = this.m_velocities[h].v, f = this.m_velocities[h].w, P.MulSV(l, _, e.s_translation));
- if (P.DotVV(b, b) > 4) {
- var A = 2 / b.Length();
- _.SelfMul(A)
- }
- var C = l * f;
- if (C * C > 2.4674011002726646) f *= A = 1.570796326795 / v(C);
- x.x += l * _.x, x.y += l * _.y, u += l * f, this.m_positions[h].a = u, this.m_velocities[h].w = f
- }
- a.Reset();
- var T = !1;
- for (h = 0; h < r.positionIterations; ++h) {
- var S = m.SolvePositionConstraints(),
- w = !0;
- for (y = 0; y < this.m_jointCount; ++y) {
- var E = this.m_joints[y].SolvePositionConstraints(d);
- w = w && E
- }
- if (S && w) {
- T = !0;
- break
- }
- }
- for (h = 0; h < this.m_bodyCount; ++h) {
- var M = this.m_bodies[h];
- M.m_sweep.c.Copy(this.m_positions[h].c), M.m_sweep.a = this.m_positions[h].a, M.m_linearVelocity.Copy(this.m_velocities[h].v), M.m_angularVelocity = this.m_velocities[h].w, M.SynchronizeTransform()
- }
- if (n.solvePosition = a.GetMilliseconds(), this.Report(m.m_velocityConstraints), o) {
- var D = i;
- for (h = 0; h < this.m_bodyCount; ++h) {
- (c = this.m_bodies[h]).GetType() !== t.b2BodyType.b2_staticBody && (!c.m_autoSleepFlag || c.m_angularVelocity * c.m_angularVelocity > .0012184696791469947 || P.DotVV(c.m_linearVelocity, c.m_linearVelocity) > 1e-4 ? (c.m_sleepTime = 0, D = 0) : (c.m_sleepTime += l, D = g(D, c.m_sleepTime)))
- }
- if (D >= .5 && T)
- for (h = 0; h < this.m_bodyCount; ++h) {
- (c = this.m_bodies[h]).SetAwake(!1)
- }
- }
- }, e.prototype.SolveTOI = function(t, i, n) {
- for (var r = 0; r < this.m_bodyCount; ++r) {
- var s = this.m_bodies[r];
- this.m_positions[r].c.Copy(s.m_sweep.c), this.m_positions[r].a = s.m_sweep.a, this.m_velocities[r].v.Copy(s.m_linearVelocity), this.m_velocities[r].w = s.m_angularVelocity
- }
- var o = e.s_contactSolverDef;
- o.contacts = this.m_contacts, o.count = this.m_contactCount, o.allocator = this.m_allocator, o.step.Copy(t), o.positions = this.m_positions, o.velocities = this.m_velocities;
- var a = e.s_contactSolver.Initialize(o);
- for (r = 0; r < t.positionIterations; ++r) {
- if (a.SolveTOIPositionConstraints(i, n)) break
- }
- this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c), this.m_bodies[i].m_sweep.a0 = this.m_positions[i].a, this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c), this.m_bodies[n].m_sweep.a0 = this.m_positions[n].a, a.InitializeVelocityConstraints();
- for (r = 0; r < t.velocityIterations; ++r) a.SolveVelocityConstraints();
- var l = t.dt;
- for (r = 0; r < this.m_bodyCount; ++r) {
- var h = this.m_positions[r].c,
- c = this.m_positions[r].a,
- u = this.m_velocities[r].v,
- _ = this.m_velocities[r].w,
- f = P.MulSV(l, u, e.s_translation);
- if (P.DotVV(f, f) > 4) {
- var d = 2 / f.Length();
- u.SelfMul(d)
- }
- var p = l * _;
- if (p * p > 2.4674011002726646) _ *= d = 1.570796326795 / v(p);
- h.SelfMulAdd(l, u), c += l * _, this.m_positions[r].a = c, this.m_velocities[r].w = _;
- var m = this.m_bodies[r];
- m.m_sweep.c.Copy(h), m.m_sweep.a = c, m.m_linearVelocity.Copy(u), m.m_angularVelocity = _, m.SynchronizeTransform()
- }
- this.Report(a.m_velocityConstraints)
- }, e.prototype.Report = function(t) {
- if (null !== this.m_listener)
- for (var i = 0; i < this.m_contactCount; ++i) {
- var n = this.m_contacts[i];
- if (n) {
- var r = t[i],
- s = e.s_impulse;
- s.count = r.pointCount;
- for (var o = 0; o < r.pointCount; ++o) s.normalImpulses[o] = r.points[o].normalImpulse, s.tangentImpulses[o] = r.points[o].tangentImpulse;
- this.m_listener.PostSolve(n, s)
- }
- }
- }, e.s_timer = new z, e.s_solverData = new hn, e.s_contactSolverDef = new fn, e.s_contactSolver = new pn, e.s_translation = new P, e.s_impulse = new $i, e
- })();
- (function(t) {
- t[t.b2_waterParticle = 0] = "b2_waterParticle", t[t.b2_zombieParticle = 2] = "b2_zombieParticle", t[t.b2_wallParticle = 4] = "b2_wallParticle", t[t.b2_springParticle = 8] = "b2_springParticle", t[t.b2_elasticParticle = 16] = "b2_elasticParticle", t[t.b2_viscousParticle = 32] = "b2_viscousParticle", t[t.b2_powderParticle = 64] = "b2_powderParticle", t[t.b2_tensileParticle = 128] = "b2_tensileParticle", t[t.b2_colorMixingParticle = 256] = "b2_colorMixingParticle", t[t.b2_destructionListenerParticle = 512] = "b2_destructionListenerParticle", t[t.b2_barrierParticle = 1024] = "b2_barrierParticle", t[t.b2_staticPressureParticle = 2048] = "b2_staticPressureParticle", t[t.b2_reactiveParticle = 4096] = "b2_reactiveParticle", t[t.b2_repulsiveParticle = 8192] = "b2_repulsiveParticle", t[t.b2_fixtureContactListenerParticle = 16384] = "b2_fixtureContactListenerParticle", t[t.b2_particleContactListenerParticle = 32768] = "b2_particleContactListenerParticle", t[t.b2_fixtureContactFilterParticle = 65536] = "b2_fixtureContactFilterParticle", t[t.b2_particleContactFilterParticle = 131072] = "b2_particleContactFilterParticle"
- })(t.b2ParticleFlag || (t.b2ParticleFlag = {}));
- var yn = (function() {
- return function() {
- this.flags = 0, this.position = new P, this.velocity = new P, this.color = new G(0, 0, 0, 0), this.lifetime = 0, this.userData = null, this.group = null
- }
- })();
- function vn(t, e, i) {
- return b(Math.ceil(Math.sqrt(t / (.01 * e)) * i), 1, 8)
- }
- var gn = (function() {
- function t() {
- this.m_index = u
- }
- return t.prototype.GetIndex = function() {
- return this.m_index
- }, t.prototype.SetIndex = function(t) {
- this.m_index = t
- }, t
- })();
- (function(t) {
- t[t.b2_solidParticleGroup = 1] = "b2_solidParticleGroup", t[t.b2_rigidParticleGroup = 2] = "b2_rigidParticleGroup", t[t.b2_particleGroupCanBeEmpty = 4] = "b2_particleGroupCanBeEmpty", t[t.b2_particleGroupWillBeDestroyed = 8] = "b2_particleGroupWillBeDestroyed", t[t.b2_particleGroupNeedsUpdateDepth = 16] = "b2_particleGroupNeedsUpdateDepth", t[t.b2_particleGroupInternalMask = 24] = "b2_particleGroupInternalMask"
- })(t.b2ParticleGroupFlag || (t.b2ParticleGroupFlag = {}));
- var xn = (function() {
- return function() {
- this.flags = 0, this.groupFlags = 0, this.position = new P, this.angle = 0, this.linearVelocity = new P, this.angularVelocity = 0, this.color = new G, this.strength = 1, this.shapeCount = 0, this.stride = 0, this.particleCount = 0, this.lifetime = 0, this.userData = null, this.group = null
- }
- })(),
- bn = (function() {
- function e(t) {
- this.m_firstIndex = 0, this.m_lastIndex = 0, this.m_groupFlags = 0, this.m_strength = 1, this.m_prev = null, this.m_next = null, this.m_timestamp = -1, this.m_mass = 0, this.m_inertia = 0, this.m_center = new P, this.m_linearVelocity = new P, this.m_angularVelocity = 0, this.m_transform = new V, this.m_userData = null, this.m_system = t
- }
- return e.prototype.GetNext = function() {
- return this.m_next
- }, e.prototype.GetParticleSystem = function() {
- return this.m_system
- }, e.prototype.GetParticleCount = function() {
- return this.m_lastIndex - this.m_firstIndex
- }, e.prototype.GetBufferIndex = function() {
- return this.m_firstIndex
- }, e.prototype.ContainsParticle = function(t) {
- return this.m_firstIndex <= t && t < this.m_lastIndex
- }, e.prototype.GetAllParticleFlags = function() {
- if (!this.m_system.m_flagsBuffer.data) throw new Error;
- for (var t = 0, e = this.m_firstIndex; e < this.m_lastIndex; e++) t |= this.m_system.m_flagsBuffer.data[e];
- return t
- }, e.prototype.GetGroupFlags = function() {
- return this.m_groupFlags
- }, e.prototype.SetGroupFlags = function(e) {
- e |= this.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupInternalMask, this.m_system.SetGroupFlags(this, e)
- }, e.prototype.GetMass = function() {
- return this.UpdateStatistics(), this.m_mass
- }, e.prototype.GetInertia = function() {
- return this.UpdateStatistics(), this.m_inertia
- }, e.prototype.GetCenter = function() {
- return this.UpdateStatistics(), this.m_center
- }, e.prototype.GetLinearVelocity = function() {
- return this.UpdateStatistics(), this.m_linearVelocity
- }, e.prototype.GetAngularVelocity = function() {
- return this.UpdateStatistics(), this.m_angularVelocity
- }, e.prototype.GetTransform = function() {
- return this.m_transform
- }, e.prototype.GetPosition = function() {
- return this.m_transform.p
- }, e.prototype.GetAngle = function() {
- return this.m_transform.q.GetAngle()
- }, e.prototype.GetLinearVelocityFromWorldPoint = function(t, i) {
- var n = e.GetLinearVelocityFromWorldPoint_s_t0;
- return this.UpdateStatistics(), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(t, this.m_center, n), i)
- }, e.prototype.GetUserData = function() {
- return this.m_userData
- }, e.prototype.SetUserData = function(t) {
- this.m_userData = t
- }, e.prototype.ApplyForce = function(t) {
- this.m_system.ApplyForce(this.m_firstIndex, this.m_lastIndex, t)
- }, e.prototype.ApplyLinearImpulse = function(t) {
- this.m_system.ApplyLinearImpulse(this.m_firstIndex, this.m_lastIndex, t)
- }, e.prototype.DestroyParticles = function(t) {
- if (this.m_system.m_world.IsLocked()) throw new Error;
- for (var e = this.m_firstIndex; e < this.m_lastIndex; e++) this.m_system.DestroyParticle(e, t)
- }, e.prototype.UpdateStatistics = function() {
- if (!this.m_system.m_positionBuffer.data) throw new Error;
- if (!this.m_system.m_velocityBuffer.data) throw new Error;
- var t = new P,
- e = new P;
- if (this.m_timestamp !== this.m_system.m_timestamp) {
- var i = this.m_system.GetParticleMass();
- this.m_mass = i * (this.m_lastIndex - this.m_firstIndex), this.m_center.SetZero(), this.m_linearVelocity.SetZero();
- for (var n = this.m_firstIndex; n < this.m_lastIndex; n++) this.m_center.SelfMulAdd(i, this.m_system.m_positionBuffer.data[n]), this.m_linearVelocity.SelfMulAdd(i, this.m_system.m_velocityBuffer.data[n]);
- if (this.m_mass > 0) {
- var r = 1 / this.m_mass;
- this.m_center.SelfMul(r), this.m_linearVelocity.SelfMul(r)
- }
- this.m_inertia = 0, this.m_angularVelocity = 0;
- for (n = this.m_firstIndex; n < this.m_lastIndex; n++) P.SubVV(this.m_system.m_positionBuffer.data[n], this.m_center, t), P.SubVV(this.m_system.m_velocityBuffer.data[n], this.m_linearVelocity, e), this.m_inertia += i * P.DotVV(t, t), this.m_angularVelocity += i * P.CrossVV(t, e);
- this.m_inertia > 0 && (this.m_angularVelocity *= 1 / this.m_inertia), this.m_timestamp = this.m_system.m_timestamp
- }
- }, e.GetLinearVelocityFromWorldPoint_s_t0 = new P, e
- })(),
- An = (function() {
- function t(t) {
- this.m_front = 0, this.m_back = 0, this.m_capacity = 0, this.m_buffer = d(t, (function(t) {
- return null
- })), this.m_capacity = t
- }
- return t.prototype.Push = function(t) {
- if (this.m_back >= this.m_capacity) {
- for (var e = this.m_front; e < this.m_back; e++) this.m_buffer[e - this.m_front] = this.m_buffer[e];
- this.m_back -= this.m_front, this.m_front = 0, this.m_back >= this.m_capacity && (this.m_capacity > 0 ? (this.m_buffer.concat(d(this.m_capacity, (function(t) {
- return null
- }))), this.m_capacity *= 2) : (this.m_buffer.concat(d(1, (function(t) {
- return null
- }))), this.m_capacity = 1))
- }
- this.m_buffer[this.m_back] = t, this.m_back++
- }, t.prototype.Pop = function() {
- this.m_buffer[this.m_front] = null, this.m_front++
- }, t.prototype.Empty = function() {
- return this.m_front === this.m_back
- }, t.prototype.Front = function() {
- var t = this.m_buffer[this.m_front];
- if (!t) throw new Error;
- return t
- }, t
- })(),
- Cn = (function() {
- function t(e) {
- this.m_generatorCapacity = 0, this.m_generatorCount = 0, this.m_countX = 0, this.m_countY = 0, this.m_diagram = [], this.m_generatorBuffer = d(e, (function(e) {
- return new t.Generator
- })), this.m_generatorCapacity = e
- }
- return t.prototype.AddGenerator = function(t, e, i) {
- var n = this.m_generatorBuffer[this.m_generatorCount++];
- n.center.Copy(t), n.tag = e, n.necessary = i
- }, t.prototype.Generate = function(e, n) {
- for (var r = 1 / e, s = new P(+i, +i), o = new P(-i, -i), a = 0, l = 0; l < this.m_generatorCount; l++) {
- (f = this.m_generatorBuffer[l]).necessary && (P.MinV(s, f.center, s), P.MaxV(o, f.center, o), ++a)
- }
- if (0 === a) return this.m_countX = 0, void(this.m_countY = 0);
- s.x -= n, s.y -= n, o.x += n, o.y += n, this.m_countX = 1 + Math.floor(r * (o.x - s.x)), this.m_countY = 1 + Math.floor(r * (o.y - s.y)), this.m_diagram = [];
- var h = new An(4 * this.m_countX * this.m_countY);
- for (l = 0; l < this.m_generatorCount; l++) {
- (f = this.m_generatorBuffer[l]).center.SelfSub(s).SelfMul(r);
- var c = Math.floor(f.center.x),
- u = Math.floor(f.center.y);
- c >= 0 && u >= 0 && c < this.m_countX && u < this.m_countY && h.Push(new t.Task(c, u, c + u * this.m_countX, f))
- }
- for (; !h.Empty();) {
- c = (d = h.Front()).m_x, u = d.m_y;
- var _ = d.m_i,
- f = d.m_generator;
- h.Pop(), this.m_diagram[_] || (this.m_diagram[_] = f, c > 0 && h.Push(new t.Task(c - 1, u, _ - 1, f)), u > 0 && h.Push(new t.Task(c, u - 1, _ - this.m_countX, f)), c < this.m_countX - 1 && h.Push(new t.Task(c + 1, u, _ + 1, f)), u < this.m_countY - 1 && h.Push(new t.Task(c, u + 1, _ + this.m_countX, f)))
- }
- for (u = 0; u < this.m_countY; u++)
- for (c = 0; c < this.m_countX - 1; c++) {
- _ = c + u * this.m_countX;
- (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + 1]) && (h.Push(new t.Task(c, u, _, m)), h.Push(new t.Task(c + 1, u, _ + 1, p)))
- }
- for (u = 0; u < this.m_countY - 1; u++)
- for (c = 0; c < this.m_countX; c++) {
- _ = c + u * this.m_countX;
- (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + this.m_countX]) && (h.Push(new t.Task(c, u, _, m)), h.Push(new t.Task(c, u + 1, _ + this.m_countX, p)))
- }
- for (; !h.Empty();) {
- var d, p, m;
- c = (d = h.Front()).m_x, u = d.m_y, _ = d.m_i, l = d.m_generator;
- if (h.Pop(), (p = this.m_diagram[_]) !== (m = l)) {
- var y = p.center.x - c,
- v = p.center.y - u,
- g = m.center.x - c,
- x = m.center.y - u;
- y * y + v * v > g * g + x * x && (this.m_diagram[_] = m, c > 0 && h.Push(new t.Task(c - 1, u, _ - 1, m)), u > 0 && h.Push(new t.Task(c, u - 1, _ - this.m_countX, m)), c < this.m_countX - 1 && h.Push(new t.Task(c + 1, u, _ + 1, m)), u < this.m_countY - 1 && h.Push(new t.Task(c, u + 1, _ + this.m_countX, m)))
- }
- }
- }, t.prototype.GetNodes = function(t) {
- for (var e = 0; e < this.m_countY - 1; e++)
- for (var i = 0; i < this.m_countX - 1; i++) {
- var n = i + e * this.m_countX,
- r = this.m_diagram[n],
- s = this.m_diagram[n + 1],
- o = this.m_diagram[n + this.m_countX],
- a = this.m_diagram[n + 1 + this.m_countX];
- s !== o && (r !== s && r !== o && (r.necessary || s.necessary || o.necessary) && t(r.tag, s.tag, o.tag), a !== s && a !== o && (r.necessary || s.necessary || o.necessary) && t(s.tag, a.tag, o.tag))
- }
- }, t
- })();
- function Tn(t, e, i) {
- var n = t[e];
- t[e] = t[i], t[i] = n
- }
- function Sn(t, e) {
- return t < e
- }
- function wn(t, e, i, n) {
- void 0 === e && (e = 0), void 0 === i && (i = t.length - e), void 0 === n && (n = Sn);
- for (var r = e, s = [], o = 0;;) {
- for (; r + 1 < i; i++) {
- var a = t[r + Math.floor(Math.random() * (i - r))];
- s[o++] = i;
- for (var l = r - 1;;) {
- for (; n(t[++l], a););
- for (; n(a, t[--i]););
- if (l >= i) break;
- Tn(t, l, i)
- }
- }
- if (0 === o) break;
- r = i, i = s[--o]
- }
- return t
- }
- function En(t, e, i, n) {
- return void 0 === e && (e = 0), void 0 === i && (i = t.length - e), void 0 === n && (n = Sn), wn(t, e, i, n)
- }
- function Mn(t, e, i) {
- void 0 === i && (i = t.length);
- for (var n = 0, r = 0; r < i; ++r) e(t[r]) || (r !== n ? Tn(t, n++, r) : ++n);
- return n
- }
- function Dn(t, e, i, n, r) {
- void 0 === r && (r = Sn);
- for (var s = i - e; s > 0;) {
- var o = Math.floor(s / 2),
- a = e + o;
- r(t[a], n) ? (e = ++a, s -= o + 1) : s = o
- }
- return e
- }
- function Bn(t, e, i, n, r) {
- void 0 === r && (r = Sn);
- for (var s = i - e; s > 0;) {
- var o = Math.floor(s / 2),
- a = e + o;
- r(n, t[a]) ? s = o : (e = ++a, s -= o + 1)
- }
- return e
- }
- function In(t, e, i, n) {
- for (var r = i; e !== r;) Tn(t, e++, r++), r === n ? r = i : e === i && (i = r)
- }
- function Pn(t, e, i, n) {
- if (e === i) return i;
- for (var r = e; ++e !== i;) n(t[r], t[e]) || Tn(t, ++r, e);
- return ++r
- }(function(t) {
- var e = (function() {
- return function() {
- this.center = new P, this.tag = 0, this.necessary = !1
- }
- })();
- t.Generator = e;
- var i = (function() {
- return function(t, e, i, n) {
- this.m_x = t, this.m_y = e, this.m_i = i, this.m_generator = n
- }
- })();
- t.Task = i
- })(Cn || (Cn = {}));
- var Rn = (function() {
- function t(t) {
- this.data = [], this.count = 0, this.capacity = 0, this.allocator = t
- }
- return t.prototype.Append = function() {
- return this.count >= this.capacity && this.Grow(), this.count++
- }, t.prototype.Reserve = function(t) {
- if (!(this.capacity >= t)) {
- for (var e = this.capacity; e < t; ++e) this.data[e] = this.allocator();
- this.capacity = t
- }
- }, t.prototype.Grow = function() {
- var t = this.capacity ? 2 * this.capacity : 256;
- this.Reserve(t)
- }, t.prototype.Free = function() {
- 0 !== this.data.length && (this.data = [], this.capacity = 0, this.count = 0)
- }, t.prototype.Shorten = function(t) {}, t.prototype.Data = function() {
- return this.data
- }, t.prototype.GetCount = function() {
- return this.count
- }, t.prototype.SetCount = function(t) {
- this.count = t
- }, t.prototype.GetCapacity = function() {
- return this.capacity
- }, t.prototype.RemoveIf = function(t) {
- this.count = Mn(this.data, t, this.count)
- }, t.prototype.Unique = function(t) {
- this.count = Pn(this.data, 0, this.count, t)
- }, t
- })(),
- On = (function(t) {
- function e(e) {
- var i = t.call(this) || this;
- return i.m_system = e, i
- }
- return $e(e, t), e.prototype.ShouldQueryParticleSystem = function(t) {
- return !1
- }, e.prototype.ReportFixture = function(t) {
- if (t.IsSensor()) return !0;
- for (var e = t.GetShape().GetChildCount(), i = 0; i < e; i++)
- for (var n = t.GetAABB(i), r = this.m_system.GetInsideBoundsEnumerator(n), s = void 0;
- (s = r.GetNext()) >= 0;) this.ReportFixtureAndParticle(t, i, s);
- return !0
- }, e.prototype.ReportParticle = function(t, e) {
- return !1
- }, e.prototype.ReportFixtureAndParticle = function(t, e, i) {}, e
- })(en),
- Ln = (function() {
- function t() {
- this.indexA = 0, this.indexB = 0, this.weight = 0, this.normal = new P, this.flags = 0
- }
- return t.prototype.SetIndices = function(t, e) {
- this.indexA = t, this.indexB = e
- }, t.prototype.SetWeight = function(t) {
- this.weight = t
- }, t.prototype.SetNormal = function(t) {
- this.normal.Copy(t)
- }, t.prototype.SetFlags = function(t) {
- this.flags = t
- }, t.prototype.GetIndexA = function() {
- return this.indexA
- }, t.prototype.GetIndexB = function() {
- return this.indexB
- }, t.prototype.GetWeight = function() {
- return this.weight
- }, t.prototype.GetNormal = function() {
- return this.normal
- }, t.prototype.GetFlags = function() {
- return this.flags
- }, t.prototype.IsEqual = function(t) {
- return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && this.weight === t.weight && this.normal.x === t.normal.x && this.normal.y === t.normal.y
- }, t.prototype.IsNotEqual = function(t) {
- return !this.IsEqual(t)
- }, t.prototype.ApproximatelyEqual = function(t) {
- return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && v(this.weight - t.weight) < .01 && P.DistanceSquaredVV(this.normal, t.normal) < 1e-4
- }, t
- })(),
- Fn = (function() {
- return function() {
- this.index = 0, this.weight = 0, this.normal = new P, this.mass = 0
- }
- })(),
- Nn = (function() {
- return function() {
- this.indexA = 0, this.indexB = 0, this.flags = 0, this.strength = 0, this.distance = 0
- }
- })(),
- Vn = (function() {
- return function() {
- this.indexA = 0, this.indexB = 0, this.indexC = 0, this.flags = 0, this.strength = 0, this.pa = new P(0, 0), this.pb = new P(0, 0), this.pc = new P(0, 0), this.ka = 0, this.kb = 0, this.kc = 0, this.s = 0
- }
- })(),
- kn = (function() {
- function t() {
- this.strictContactCheck = !1, this.density = 1, this.gravityScale = 1, this.radius = 1, this.maxCount = 0, this.pressureStrength = .005, this.dampingStrength = 1, this.elasticStrength = .25, this.springStrength = .25, this.viscousStrength = .25, this.surfaceTensionPressureStrength = .2, this.surfaceTensionNormalStrength = .2, this.repulsiveStrength = 1, this.powderStrength = .5, this.ejectionStrength = .5, this.staticPressureStrength = .2, this.staticPressureRelaxation = .2, this.staticPressureIterations = 8, this.colorMixingStrength = .5, this.destroyByAge = !0, this.lifetimeGranularity = 1 / 60
- }
- return t.prototype.Copy = function(t) {
- return this.strictContactCheck = t.strictContactCheck, this.density = t.density, this.gravityScale = t.gravityScale, this.radius = t.radius, this.maxCount = t.maxCount, this.pressureStrength = t.pressureStrength, this.dampingStrength = t.dampingStrength, this.elasticStrength = t.elasticStrength, this.springStrength = t.springStrength, this.viscousStrength = t.viscousStrength, this.surfaceTensionPressureStrength = t.surfaceTensionPressureStrength, this.surfaceTensionNormalStrength = t.surfaceTensionNormalStrength, this.repulsiveStrength = t.repulsiveStrength, this.powderStrength = t.powderStrength, this.ejectionStrength = t.ejectionStrength, this.staticPressureStrength = t.staticPressureStrength, this.staticPressureRelaxation = t.staticPressureRelaxation, this.staticPressureIterations = t.staticPressureIterations, this.colorMixingStrength = t.colorMixingStrength, this.destroyByAge = t.destroyByAge, this.lifetimeGranularity = t.lifetimeGranularity, this
- }, t.prototype.Clone = function() {
- return (new t).Copy(this)
- }, t
- })();
- t.b2ParticleSystem = (function() {
- function n(t, e) {
- this.m_paused = !1, this.m_timestamp = 0, this.m_allParticleFlags = 0, this.m_needsUpdateAllParticleFlags = !1, this.m_allGroupFlags = 0, this.m_needsUpdateAllGroupFlags = !1, this.m_hasForce = !1, this.m_iterationIndex = 0, this.m_inverseDensity = 0, this.m_particleDiameter = 0, this.m_inverseDiameter = 0, this.m_squaredDiameter = 0, this.m_count = 0, this.m_internalAllocatedCapacity = 0, this.m_handleIndexBuffer = new n.UserOverridableBuffer, this.m_flagsBuffer = new n.UserOverridableBuffer, this.m_positionBuffer = new n.UserOverridableBuffer, this.m_velocityBuffer = new n.UserOverridableBuffer, this.m_forceBuffer = [], this.m_weightBuffer = [], this.m_staticPressureBuffer = [], this.m_accumulationBuffer = [], this.m_accumulation2Buffer = [], this.m_depthBuffer = [], this.m_colorBuffer = new n.UserOverridableBuffer, this.m_groupBuffer = [], this.m_userDataBuffer = new n.UserOverridableBuffer, this.m_stuckThreshold = 0, this.m_lastBodyContactStepBuffer = new n.UserOverridableBuffer, this.m_bodyContactCountBuffer = new n.UserOverridableBuffer, this.m_consecutiveContactStepsBuffer = new n.UserOverridableBuffer, this.m_stuckParticleBuffer = new Rn(function() {
- return 0
- }), this.m_proxyBuffer = new Rn(function() {
- return new n.Proxy
- }), this.m_contactBuffer = new Rn(function() {
- return new Ln
- }), this.m_bodyContactBuffer = new Rn(function() {
- return new Fn
- }), this.m_pairBuffer = new Rn(function() {
- return new Nn
- }), this.m_triadBuffer = new Rn(function() {
- return new Vn
- }), this.m_expirationTimeBuffer = new n.UserOverridableBuffer, this.m_indexByExpirationTimeBuffer = new n.UserOverridableBuffer, this.m_timeElapsed = 0, this.m_expirationTimeBufferRequiresSorting = !1, this.m_groupCount = 0, this.m_groupList = null, this.m_def = new kn, this.m_prev = null, this.m_next = null, this.SetStrictContactCheck(t.strictContactCheck), this.SetDensity(t.density), this.SetGravityScale(t.gravityScale), this.SetRadius(t.radius), this.SetMaxParticleCount(t.maxCount), this.m_def = t.Clone(), this.m_world = e, this.SetDestructionByAge(this.m_def.destroyByAge)
- }
- return n.computeTag = function(t, e) {
- return (e + n.yOffset >>> 0 << n.yShift) + (n.xScale * t + n.xOffset >>> 0) >>> 0
- }, n.computeRelativeTag = function(t, e, i) {
- return t + (i << n.yShift) + (e << n.xShift) >>> 0
- }, n.prototype.Drop = function() {
- for (; this.m_groupList;) this.DestroyParticleGroup(this.m_groupList);
- this.FreeUserOverridableBuffer(this.m_handleIndexBuffer), this.FreeUserOverridableBuffer(this.m_flagsBuffer), this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer), this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer), this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer), this.FreeUserOverridableBuffer(this.m_positionBuffer), this.FreeUserOverridableBuffer(this.m_velocityBuffer), this.FreeUserOverridableBuffer(this.m_colorBuffer), this.FreeUserOverridableBuffer(this.m_userDataBuffer), this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer), this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer), this.FreeBuffer(this.m_forceBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_weightBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_staticPressureBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_accumulationBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_accumulation2Buffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_depthBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_groupBuffer, this.m_internalAllocatedCapacity)
- }, n.prototype.CreateParticle = function(t) {
- if (this.m_world.IsLocked()) throw new Error;
- if (this.m_count >= this.m_internalAllocatedCapacity) {
- var i = this.m_count ? 2 * this.m_count : 256;
- this.ReallocateInternalAllocatedBuffers(i)
- }
- if (this.m_count >= this.m_internalAllocatedCapacity) {
- if (!this.m_def.destroyByAge) return u;
- this.DestroyOldestParticle(0, !1), this.SolveZombie()
- }
- var n = this.m_count++;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (this.m_flagsBuffer.data[n] = 0, this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = 0), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = 0), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = 0), !this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- this.m_positionBuffer.data[n] = (this.m_positionBuffer.data[n] || new P).Copy(e(t.position, P.ZERO)), this.m_velocityBuffer.data[n] = (this.m_velocityBuffer.data[n] || new P).Copy(e(t.velocity, P.ZERO)), this.m_weightBuffer[n] = 0, this.m_forceBuffer[n] = (this.m_forceBuffer[n] || new P).SetZero(), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = 0), this.m_depthBuffer && (this.m_depthBuffer[n] = 0);
- var r = (new G).Copy(e(t.color, G.ZERO));
- !this.m_colorBuffer.data && r.IsZero() || (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), this.m_colorBuffer.data[n] = (this.m_colorBuffer.data[n] || new G).Copy(r)), (this.m_userDataBuffer.data || t.userData) && (this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), this.m_userDataBuffer.data[n] = t.userData), this.m_handleIndexBuffer.data && (this.m_handleIndexBuffer.data[n] = null);
- var s = this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],
- o = e(t.lifetime, 0),
- a = o > 0;
- if (this.m_expirationTimeBuffer.data || a) {
- if (this.SetParticleLifetime(n, a ? o : this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())), !this.m_indexByExpirationTimeBuffer.data) throw new Error;
- this.m_indexByExpirationTimeBuffer.data[n] = n
- }
- s.index = n;
- var l = e(t.group, null);
- return this.m_groupBuffer[n] = l, l && (l.m_firstIndex < l.m_lastIndex ? (this.RotateBuffer(l.m_firstIndex, l.m_lastIndex, n), l.m_lastIndex = n + 1) : (l.m_firstIndex = n, l.m_lastIndex = n + 1)), this.SetParticleFlags(n, e(t.flags, 0)), n
- }, n.prototype.GetParticleHandleFromIndex = function(t) {
- this.m_handleIndexBuffer.data = this.RequestBuffer(this.m_handleIndexBuffer.data);
- var e = this.m_handleIndexBuffer.data[t];
- return e || ((e = new gn).SetIndex(t), this.m_handleIndexBuffer.data[t] = e, e)
- }, n.prototype.DestroyParticle = function(e, i) {
- if (void 0 === i && (i = !1), !this.m_flagsBuffer.data) throw new Error;
- var n = t.b2ParticleFlag.b2_zombieParticle;
- i && (n |= t.b2ParticleFlag.b2_destructionListenerParticle), this.SetParticleFlags(e, this.m_flagsBuffer.data[e] | n)
- }, n.prototype.DestroyOldestParticle = function(t, e) {
- void 0 === e && (e = !1);
- var i = this.GetParticleCount();
- if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
- if (!this.m_expirationTimeBuffer.data) throw new Error;
- var n = this.m_indexByExpirationTimeBuffer.data[i - (t + 1)],
- r = this.m_indexByExpirationTimeBuffer.data[t];
- this.DestroyParticle(this.m_expirationTimeBuffer.data[n] > 0 ? n : r, e)
- }, n.prototype.DestroyParticlesInShape = function(t, e, i) {
- void 0 === i && (i = !1);
- var r = n.DestroyParticlesInShape_s_aabb;
- if (this.m_world.IsLocked()) throw new Error;
- var s = new n.DestroyParticlesInShapeCallback(this, t, e, i),
- o = r;
- return t.ComputeAABB(o, e, 0), this.m_world.QueryAABB(s, o), s.Destroyed()
- }, n.prototype.CreateParticleGroup = function(t) {
- var i = n.CreateParticleGroup_s_transform;
- if (this.m_world.IsLocked()) throw new Error;
- var r = i;
- r.SetPositionAngle(e(t.position, P.ZERO), e(t.angle, 0));
- var s = this.m_count;
- if (t.shape && this.CreateParticlesWithShapeForGroup(t.shape, t, r), t.shapes && this.CreateParticlesWithShapesForGroup(t.shapes, e(t.shapeCount, t.shapes.length), t, r), t.positionData)
- for (var o = e(t.particleCount, t.positionData.length), a = 0; a < o; a++) {
- var l = t.positionData[a];
- this.CreateParticleForGroup(t, r, l)
- }
- var h = this.m_count,
- c = new bn(this);
- c.m_firstIndex = s, c.m_lastIndex = h, c.m_strength = e(t.strength, 1), c.m_userData = t.userData, c.m_transform.Copy(r), c.m_prev = null, c.m_next = this.m_groupList, this.m_groupList && (this.m_groupList.m_prev = c), this.m_groupList = c, ++this.m_groupCount;
- for (a = s; a < h; a++) this.m_groupBuffer[a] = c;
- this.SetGroupFlags(c, e(t.groupFlags, 0));
- var u = new n.ConnectionFilter;
- return this.UpdateContacts(!0), this.UpdatePairsAndTriads(s, h, u), t.group && (this.JoinParticleGroups(t.group, c), c = t.group), c
- }, n.prototype.JoinParticleGroups = function(t, e) {
- if (this.m_world.IsLocked()) throw new Error;
- this.RotateBuffer(e.m_firstIndex, e.m_lastIndex, this.m_count), this.RotateBuffer(t.m_firstIndex, t.m_lastIndex, e.m_firstIndex);
- var i = new n.JoinParticleGroupsFilter(e.m_firstIndex);
- this.UpdateContacts(!0), this.UpdatePairsAndTriads(t.m_firstIndex, e.m_lastIndex, i);
- for (var r = e.m_firstIndex; r < e.m_lastIndex; r++) this.m_groupBuffer[r] = t;
- var s = t.m_groupFlags | e.m_groupFlags;
- this.SetGroupFlags(t, s), t.m_lastIndex = e.m_lastIndex, e.m_firstIndex = e.m_lastIndex, this.DestroyParticleGroup(e)
- }, n.prototype.SplitParticleGroup = function(t) {
- this.UpdateContacts(!0);
- var e = d(t.GetParticleCount(), (function(t) {
- return new n.ParticleListNode
- }));
- n.InitializeParticleLists(t, e), this.MergeParticleListsInContact(t, e);
- var i = n.FindLongestParticleList(t, e);
- this.MergeZombieParticleListNodes(t, e, i), this.CreateParticleGroupsFromParticleList(t, e, i), this.UpdatePairsAndTriadsWithParticleList(t, e)
- }, n.prototype.GetParticleGroupList = function() {
- return this.m_groupList
- }, n.prototype.GetParticleGroupCount = function() {
- return this.m_groupCount
- }, n.prototype.GetParticleCount = function() {
- return this.m_count
- }, n.prototype.GetMaxParticleCount = function() {
- return this.m_def.maxCount
- }, n.prototype.SetMaxParticleCount = function(t) {
- this.m_def.maxCount = t
- }, n.prototype.GetAllParticleFlags = function() {
- return this.m_allParticleFlags
- }, n.prototype.GetAllGroupFlags = function() {
- return this.m_allGroupFlags
- }, n.prototype.SetPaused = function(t) {
- this.m_paused = t
- }, n.prototype.GetPaused = function() {
- return this.m_paused
- }, n.prototype.SetDensity = function(t) {
- this.m_def.density = t, this.m_inverseDensity = 1 / this.m_def.density
- }, n.prototype.GetDensity = function() {
- return this.m_def.density
- }, n.prototype.SetGravityScale = function(t) {
- this.m_def.gravityScale = t
- }, n.prototype.GetGravityScale = function() {
- return this.m_def.gravityScale
- }, n.prototype.SetDamping = function(t) {
- this.m_def.dampingStrength = t
- }, n.prototype.GetDamping = function() {
- return this.m_def.dampingStrength
- }, n.prototype.SetStaticPressureIterations = function(t) {
- this.m_def.staticPressureIterations = t
- }, n.prototype.GetStaticPressureIterations = function() {
- return this.m_def.staticPressureIterations
- }, n.prototype.SetRadius = function(t) {
- this.m_particleDiameter = 2 * t, this.m_squaredDiameter = this.m_particleDiameter * this.m_particleDiameter, this.m_inverseDiameter = 1 / this.m_particleDiameter
- }, n.prototype.GetRadius = function() {
- return this.m_particleDiameter / 2
- }, n.prototype.GetPositionBuffer = function() {
- if (!this.m_positionBuffer.data) throw new Error;
- return this.m_positionBuffer.data
- }, n.prototype.GetVelocityBuffer = function() {
- if (!this.m_velocityBuffer.data) throw new Error;
- return this.m_velocityBuffer.data
- }, n.prototype.GetColorBuffer = function() {
- return this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), this.m_colorBuffer.data
- }, n.prototype.GetGroupBuffer = function() {
- return this.m_groupBuffer
- }, n.prototype.GetWeightBuffer = function() {
- return this.m_weightBuffer
- }, n.prototype.GetUserDataBuffer = function() {
- return this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), this.m_userDataBuffer.data
- }, n.prototype.GetFlagsBuffer = function() {
- if (!this.m_flagsBuffer.data) throw new Error;
- return this.m_flagsBuffer.data
- }, n.prototype.SetParticleFlags = function(e, i) {
- if (!this.m_flagsBuffer.data) throw new Error;
- this.m_flagsBuffer.data[e] & ~i && (this.m_needsUpdateAllParticleFlags = !0), ~this.m_allParticleFlags & i && (i & t.b2ParticleFlag.b2_tensileParticle && (this.m_accumulation2Buffer = this.RequestBuffer(this.m_accumulation2Buffer)), i & t.b2ParticleFlag.b2_colorMixingParticle && (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data)), this.m_allParticleFlags |= i), this.m_flagsBuffer.data[e] = i
- }, n.prototype.GetParticleFlags = function(t) {
- if (!this.m_flagsBuffer.data) throw new Error;
- return this.m_flagsBuffer.data[t]
- }, n.prototype.SetFlagsBuffer = function(t, e) {
- this.SetUserOverridableBuffer(this.m_flagsBuffer, t, e)
- }, n.prototype.SetPositionBuffer = function(t, e) {
- this.SetUserOverridableBuffer(this.m_positionBuffer, t, e)
- }, n.prototype.SetVelocityBuffer = function(t, e) {
- this.SetUserOverridableBuffer(this.m_velocityBuffer, t, e)
- }, n.prototype.SetColorBuffer = function(t, e) {
- this.SetUserOverridableBuffer(this.m_colorBuffer, t, e)
- }, n.prototype.SetUserDataBuffer = function(t, e) {
- this.SetUserOverridableBuffer(this.m_userDataBuffer, t, e)
- }, n.prototype.GetContacts = function() {
- return this.m_contactBuffer.data
- }, n.prototype.GetContactCount = function() {
- return this.m_contactBuffer.count
- }, n.prototype.GetBodyContacts = function() {
- return this.m_bodyContactBuffer.data
- }, n.prototype.GetBodyContactCount = function() {
- return this.m_bodyContactBuffer.count
- }, n.prototype.GetPairs = function() {
- return this.m_pairBuffer.data
- }, n.prototype.GetPairCount = function() {
- return this.m_pairBuffer.count
- }, n.prototype.GetTriads = function() {
- return this.m_triadBuffer.data
- }, n.prototype.GetTriadCount = function() {
- return this.m_triadBuffer.count
- }, n.prototype.SetStuckThreshold = function(t) {
- this.m_stuckThreshold = t, t > 0 && (this.m_lastBodyContactStepBuffer.data = this.RequestBuffer(this.m_lastBodyContactStepBuffer.data), this.m_bodyContactCountBuffer.data = this.RequestBuffer(this.m_bodyContactCountBuffer.data), this.m_consecutiveContactStepsBuffer.data = this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))
- }, n.prototype.GetStuckCandidates = function() {
- return this.m_stuckParticleBuffer.Data()
- }, n.prototype.GetStuckCandidateCount = function() {
- return this.m_stuckParticleBuffer.GetCount()
- }, n.prototype.ComputeCollisionEnergy = function() {
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var t = n.ComputeCollisionEnergy_s_v, e = this.m_velocityBuffer.data, i = 0, r = 0; r < this.m_contactBuffer.count; r++) {
- var s = this.m_contactBuffer.data[r],
- o = s.indexA,
- a = s.indexB,
- l = s.normal,
- h = P.SubVV(e[a], e[o], t),
- c = P.DotVV(h, l);
- c < 0 && (i += c * c)
- }
- return .5 * this.GetParticleMass() * i
- }, n.prototype.SetStrictContactCheck = function(t) {
- this.m_def.strictContactCheck = t
- }, n.prototype.GetStrictContactCheck = function() {
- return this.m_def.strictContactCheck
- }, n.prototype.SetParticleLifetime = function(t, e) {
- var i = null === this.m_indexByExpirationTimeBuffer.data;
- if (this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), i)
- for (var n = this.GetParticleCount(), r = 0; r < n; ++r) this.m_indexByExpirationTimeBuffer.data[r] = r;
- var s = e / this.m_def.lifetimeGranularity,
- o = s > 0 ? this.GetQuantizedTimeElapsed() + s : s;
- o !== this.m_expirationTimeBuffer.data[t] && (this.m_expirationTimeBuffer.data[t] = o, this.m_expirationTimeBufferRequiresSorting = !0)
- }, n.prototype.GetParticleLifetime = function(t) {
- return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])
- }, n.prototype.SetDestructionByAge = function(t) {
- t && this.GetExpirationTimeBuffer(), this.m_def.destroyByAge = t
- }, n.prototype.GetDestructionByAge = function() {
- return this.m_def.destroyByAge
- }, n.prototype.GetExpirationTimeBuffer = function() {
- return this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), this.m_expirationTimeBuffer.data
- }, n.prototype.ExpirationTimeToLifetime = function(t) {
- return (t > 0 ? t - this.GetQuantizedTimeElapsed() : t) * this.m_def.lifetimeGranularity
- }, n.prototype.GetIndexByExpirationTimeBuffer = function() {
- if (this.GetParticleCount() ? this.SetParticleLifetime(0, this.GetParticleLifetime(0)) : this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), !this.m_indexByExpirationTimeBuffer.data) throw new Error;
- return this.m_indexByExpirationTimeBuffer.data
- }, n.prototype.ParticleApplyLinearImpulse = function(t, e) {
- this.ApplyLinearImpulse(t, t + 1, e)
- }, n.prototype.ApplyLinearImpulse = function(t, e, i) {
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var n = this.m_velocityBuffer.data, r = (e - t) * this.GetParticleMass(), s = (new P).Copy(i).SelfMul(1 / r), o = t; o < e; o++) n[o].SelfAdd(s)
- }, n.IsSignificantForce = function(t) {
- return 0 !== t.x || 0 !== t.y
- }, n.prototype.ParticleApplyForce = function(t, e) {
- if (!this.m_flagsBuffer.data) throw new Error;
- n.IsSignificantForce(e) && this.ForceCanBeApplied(this.m_flagsBuffer.data[t]) && (this.PrepareForceBuffer(), this.m_forceBuffer[t].SelfAdd(e))
- }, n.prototype.ApplyForce = function(t, e, i) {
- var r = (new P).Copy(i).SelfMul(1 / (e - t));
- if (n.IsSignificantForce(r)) {
- this.PrepareForceBuffer();
- for (var s = t; s < e; s++) this.m_forceBuffer[s].SelfAdd(r)
- }
- }, n.prototype.GetNext = function() {
- return this.m_next
- }, n.prototype.QueryAABB = function(t, e) {
- if (0 !== this.m_proxyBuffer.count) {
- var i = this.m_proxyBuffer.count,
- r = Dn(this.m_proxyBuffer.data, 0, i, n.computeTag(this.m_inverseDiameter * e.lowerBound.x, this.m_inverseDiameter * e.lowerBound.y), n.Proxy.CompareProxyTag),
- s = Bn(this.m_proxyBuffer.data, r, i, n.computeTag(this.m_inverseDiameter * e.upperBound.x, this.m_inverseDiameter * e.upperBound.y), n.Proxy.CompareTagProxy);
- if (!this.m_positionBuffer.data) throw new Error;
- for (var o = this.m_positionBuffer.data, a = r; a < s; ++a) {
- var l = this.m_proxyBuffer.data[a].index,
- h = o[l];
- if (e.lowerBound.x < h.x && h.x < e.upperBound.x && e.lowerBound.y < h.y && h.y < e.upperBound.y && !t.ReportParticle(this, l)) break
- }
- }
- }, n.prototype.QueryShapeAABB = function(t, e, i, r) {
- void 0 === r && (r = 0);
- var s = n.QueryShapeAABB_s_aabb;
- e.ComputeAABB(s, i, r), this.QueryAABB(t, s)
- }, n.prototype.QueryPointAABB = function(t, e, i) {
- void 0 === i && (i = l);
- var r = n.QueryPointAABB_s_aabb;
- r.lowerBound.Set(e.x - i, e.y - i), r.upperBound.Set(e.x + i, e.y + i), this.QueryAABB(t, r)
- }, n.prototype.RayCast = function(t, e, i) {
- var r = n.RayCast_s_aabb,
- s = n.RayCast_s_p,
- o = n.RayCast_s_v,
- a = n.RayCast_s_n,
- l = n.RayCast_s_point;
- if (0 !== this.m_proxyBuffer.count) {
- if (!this.m_positionBuffer.data) throw new Error;
- var h = this.m_positionBuffer.data,
- c = r;
- P.MinV(e, i, c.lowerBound), P.MaxV(e, i, c.upperBound);
- for (var u, _ = 1, f = P.SubVV(i, e, o), d = P.DotVV(f, f), p = this.GetInsideBoundsEnumerator(c);
- (u = p.GetNext()) >= 0;) {
- var m = P.SubVV(e, h[u], s),
- y = P.DotVV(m, f),
- v = y * y - d * (P.DotVV(m, m) - this.m_squaredDiameter);
- if (v >= 0) {
- var x = S(v),
- b = (-y - x) / d;
- if (b > _) continue;
- if (b < 0 && ((b = (-y + x) / d) < 0 || b > _)) continue;
- var A = P.AddVMulSV(m, b, f, a);
- A.Normalize();
- var C = t.ReportParticle(this, u, P.AddVMulSV(e, b, f, l), A, b);
- if ((_ = g(_, C)) <= 0) break
- }
- }
- }
- }, n.prototype.ComputeAABB = function(t) {
- var e = this.GetParticleCount();
- if (t.lowerBound.x = +i, t.lowerBound.y = +i, t.upperBound.x = -i, t.upperBound.y = -i, !this.m_positionBuffer.data) throw new Error;
- for (var n = this.m_positionBuffer.data, r = 0; r < e; r++) {
- var s = n[r];
- P.MinV(t.lowerBound, s, t.lowerBound), P.MaxV(t.upperBound, s, t.upperBound)
- }
- t.lowerBound.x -= this.m_particleDiameter, t.lowerBound.y -= this.m_particleDiameter, t.upperBound.x += this.m_particleDiameter, t.upperBound.y += this.m_particleDiameter
- }, n.prototype.FreeBuffer = function(t, e) {
- null !== t && (t.length = 0)
- }, n.prototype.FreeUserOverridableBuffer = function(t) {
- 0 === t.userSuppliedCapacity && this.FreeBuffer(t.data, this.m_internalAllocatedCapacity)
- }, n.prototype.ReallocateBuffer3 = function(t, e, i) {
- if (i <= e) throw new Error;
- var n = t ? t.slice() : [];
- return n.length = i, n
- }, n.prototype.ReallocateBuffer5 = function(t, e, i, n, r) {
- if (n <= i) throw new Error;
- if (e && !(n <= e)) throw new Error;
- return r && !t || e || (t = this.ReallocateBuffer3(t, i, n)), t
- }, n.prototype.ReallocateBuffer4 = function(t, e, i, n) {
- return this.ReallocateBuffer5(t.data, t.userSuppliedCapacity, e, i, n)
- }, n.prototype.RequestBuffer = function(t) {
- return t || (0 === this.m_internalAllocatedCapacity && this.ReallocateInternalAllocatedBuffers(256), (t = []).length = this.m_internalAllocatedCapacity), t
- }, n.prototype.ReallocateHandleBuffers = function(t) {
- this.m_handleIndexBuffer.data = this.ReallocateBuffer4(this.m_handleIndexBuffer, this.m_internalAllocatedCapacity, t, !0)
- }, n.prototype.ReallocateInternalAllocatedBuffers = function(t) {
- function e(t, e) {
- return e && t > e ? e : t
- }
- if (t = e(t = e(t = e(t = e(t = e(t = e(t, this.m_def.maxCount), this.m_flagsBuffer.userSuppliedCapacity), this.m_positionBuffer.userSuppliedCapacity), this.m_velocityBuffer.userSuppliedCapacity), this.m_colorBuffer.userSuppliedCapacity), this.m_userDataBuffer.userSuppliedCapacity), this.m_internalAllocatedCapacity < t) {
- this.ReallocateHandleBuffers(t), this.m_flagsBuffer.data = this.ReallocateBuffer4(this.m_flagsBuffer, this.m_internalAllocatedCapacity, t, !1);
- var i = this.m_stuckThreshold > 0;
- this.m_lastBodyContactStepBuffer.data = this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer, this.m_internalAllocatedCapacity, t, i), this.m_bodyContactCountBuffer.data = this.ReallocateBuffer4(this.m_bodyContactCountBuffer, this.m_internalAllocatedCapacity, t, i), this.m_consecutiveContactStepsBuffer.data = this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer, this.m_internalAllocatedCapacity, t, i), this.m_positionBuffer.data = this.ReallocateBuffer4(this.m_positionBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_velocityBuffer.data = this.ReallocateBuffer4(this.m_velocityBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_forceBuffer = this.ReallocateBuffer5(this.m_forceBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_weightBuffer = this.ReallocateBuffer5(this.m_weightBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_staticPressureBuffer = this.ReallocateBuffer5(this.m_staticPressureBuffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_accumulationBuffer = this.ReallocateBuffer5(this.m_accumulationBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_accumulation2Buffer = this.ReallocateBuffer5(this.m_accumulation2Buffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_depthBuffer = this.ReallocateBuffer5(this.m_depthBuffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_colorBuffer.data = this.ReallocateBuffer4(this.m_colorBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_groupBuffer = this.ReallocateBuffer5(this.m_groupBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_userDataBuffer.data = this.ReallocateBuffer4(this.m_userDataBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_expirationTimeBuffer.data = this.ReallocateBuffer4(this.m_expirationTimeBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_indexByExpirationTimeBuffer.data = this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_internalAllocatedCapacity = t
- }
- }, n.prototype.CreateParticleForGroup = function(t, i, n) {
- var r = new yn;
- r.flags = e(t.flags, 0), V.MulXV(i, n, r.position), P.AddVV(e(t.linearVelocity, P.ZERO), P.CrossSV(e(t.angularVelocity, 0), P.SubVV(r.position, e(t.position, P.ZERO), P.s_t0), P.s_t0), r.velocity), r.color.Copy(e(t.color, G.ZERO)), r.lifetime = e(t.lifetime, 0), r.userData = t.userData, this.CreateParticle(r)
- }, n.prototype.CreateParticlesStrokeShapeForGroup = function(i, r, s) {
- var o = n.CreateParticlesStrokeShapeForGroup_s_edge,
- a = n.CreateParticlesStrokeShapeForGroup_s_d,
- l = n.CreateParticlesStrokeShapeForGroup_s_p,
- h = e(r.stride, 0);
- 0 === h && (h = this.GetParticleStride());
- for (var c = 0, u = i.GetChildCount(), _ = 0; _ < u; _++) {
- var f = null;
- i.GetType() === t.b2ShapeType.e_edgeShape ? f = i : (f = o, i.GetChildEdge(f, _));
- for (var d = P.SubVV(f.m_vertex2, f.m_vertex1, a), p = d.Length(); c < p;) {
- var m = P.AddVMulSV(f.m_vertex1, c / p, d, l);
- this.CreateParticleForGroup(r, s, m), c += h
- }
- c -= p
- }
- }, n.prototype.CreateParticlesFillShapeForGroup = function(t, i, r) {
- var s = n.CreateParticlesFillShapeForGroup_s_aabb,
- o = n.CreateParticlesFillShapeForGroup_s_p,
- a = e(i.stride, 0);
- 0 === a && (a = this.GetParticleStride());
- var l = V.IDENTITY,
- h = s;
- t.ComputeAABB(h, l, 0);
- for (var c = Math.floor(h.lowerBound.y / a) * a; c < h.upperBound.y; c += a)
- for (var u = Math.floor(h.lowerBound.x / a) * a; u < h.upperBound.x; u += a) {
- var _ = o.Set(u, c);
- t.TestPoint(l, _) && this.CreateParticleForGroup(i, r, _)
- }
- }, n.prototype.CreateParticlesWithShapeForGroup = function(e, i, n) {
- switch (e.GetType()) {
- case t.b2ShapeType.e_edgeShape:
- case t.b2ShapeType.e_chainShape:
- this.CreateParticlesStrokeShapeForGroup(e, i, n);
- break;
- case t.b2ShapeType.e_polygonShape:
- case t.b2ShapeType.e_circleShape:
- this.CreateParticlesFillShapeForGroup(e, i, n)
- }
- }, n.prototype.CreateParticlesWithShapesForGroup = function(t, e, i, r) {
- var s = new n.CompositeShape(t, e);
- this.CreateParticlesFillShapeForGroup(s, i, r)
- }, n.prototype.CloneParticle = function(t, e) {
- var i = new yn;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- i.flags = this.m_flagsBuffer.data[t], i.position.Copy(this.m_positionBuffer.data[t]), i.velocity.Copy(this.m_velocityBuffer.data[t]), this.m_colorBuffer.data && i.color.Copy(this.m_colorBuffer.data[t]), this.m_userDataBuffer.data && (i.userData = this.m_userDataBuffer.data[t]), i.group = e;
- var n = this.CreateParticle(i);
- if (this.m_handleIndexBuffer.data) {
- var r = this.m_handleIndexBuffer.data[t];
- r && r.SetIndex(n), this.m_handleIndexBuffer.data[n] = r, this.m_handleIndexBuffer.data[t] = null
- }
- return this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = this.m_lastBodyContactStepBuffer.data[t]), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = this.m_bodyContactCountBuffer.data[t]), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = this.m_consecutiveContactStepsBuffer.data[t]), this.m_hasForce && this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = this.m_staticPressureBuffer[t]), this.m_depthBuffer && (this.m_depthBuffer[n] = this.m_depthBuffer[t]), this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[n] = this.m_expirationTimeBuffer.data[t]), n
- }, n.prototype.DestroyParticlesInGroup = function(t, e) {
- void 0 === e && (e = !1);
- for (var i = t.m_firstIndex; i < t.m_lastIndex; i++) this.DestroyParticle(i, e)
- }, n.prototype.DestroyParticleGroup = function(t) {
- this.m_world.m_destructionListener && this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t), this.SetGroupFlags(t, 0);
- for (var e = t.m_firstIndex; e < t.m_lastIndex; e++) this.m_groupBuffer[e] = null;
- t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_groupList && (this.m_groupList = t.m_next), --this.m_groupCount
- }, n.ParticleCanBeConnected = function(e, i) {
- return 0 != (e & (t.b2ParticleFlag.b2_wallParticle | t.b2ParticleFlag.b2_springParticle | t.b2ParticleFlag.b2_elasticParticle)) || null !== i && 0 != (i.GetGroupFlags() & t.b2ParticleGroupFlag.b2_rigidParticleGroup)
- }, n.prototype.UpdatePairsAndTriads = function(e, i, r) {
- var s = n.UpdatePairsAndTriads_s_dab,
- o = n.UpdatePairsAndTriads_s_dbc,
- a = n.UpdatePairsAndTriads_s_dca;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var l = this.m_positionBuffer.data, h = 0, c = e; c < i; c++) h |= this.m_flagsBuffer.data[c];
- if (h & n.k_pairFlags)
- for (var u = 0; u < this.m_contactBuffer.count; u++) {
- var _ = this.m_contactBuffer.data[u],
- f = _.indexA,
- d = _.indexB,
- p = this.m_flagsBuffer.data[f],
- m = this.m_flagsBuffer.data[d],
- y = this.m_groupBuffer[f],
- v = this.m_groupBuffer[d];
- if (f >= e && f < i && d >= e && d < i && !((p | m) & t.b2ParticleFlag.b2_zombieParticle) && (p | m) & n.k_pairFlags && (r.IsNecessary(f) || r.IsNecessary(d)) && n.ParticleCanBeConnected(p, y) && n.ParticleCanBeConnected(m, v) && r.ShouldCreatePair(f, d)) {
- var x = this.m_pairBuffer.data[this.m_pairBuffer.Append()];
- x.indexA = f, x.indexB = d, x.flags = _.flags, x.strength = g(y ? y.m_strength : 1, v ? v.m_strength : 1), x.distance = P.DistanceVV(l[f], l[d])
- }
- En(this.m_pairBuffer.data, 0, this.m_pairBuffer.count, n.ComparePairIndices), this.m_pairBuffer.Unique(n.MatchPairIndices)
- }
- if (h & n.k_triadFlags) {
- var b = new Cn(i - e);
- for (c = e; c < i; c++) {
- var A = this.m_flagsBuffer.data[c],
- C = this.m_groupBuffer[c];
- A & t.b2ParticleFlag.b2_zombieParticle || !n.ParticleCanBeConnected(A, C) || b.AddGenerator(l[c], c, r.IsNecessary(c))
- }
- var T = this.GetParticleStride();
- b.Generate(T / 2, 2 * T);
- var S = this;
- b.GetNodes((function(t, e, i) {
- if (!S.m_flagsBuffer.data) throw new Error;
- var h = S.m_flagsBuffer.data[t],
- c = S.m_flagsBuffer.data[e],
- u = S.m_flagsBuffer.data[i];
- if ((h | c | u) & n.k_triadFlags && r.ShouldCreateTriad(t, e, i)) {
- var _ = l[t],
- f = l[e],
- d = l[i],
- p = P.SubVV(_, f, s),
- m = P.SubVV(f, d, o),
- y = P.SubVV(d, _, a),
- v = 4 * S.m_squaredDiameter;
- if (P.DotVV(p, p) > v || P.DotVV(m, m) > v || P.DotVV(y, y) > v) return;
- var x = S.m_groupBuffer[t],
- b = S.m_groupBuffer[e],
- A = S.m_groupBuffer[i],
- C = S.m_triadBuffer.data[S.m_triadBuffer.Append()];
- C.indexA = t, C.indexB = e, C.indexC = i, C.flags = h | c | u, C.strength = g(g(x ? x.m_strength : 1, b ? b.m_strength : 1), A ? A.m_strength : 1);
- var T = (_.x + f.x + d.x) / 3,
- w = (_.y + f.y + d.y) / 3;
- C.pa.x = _.x - T, C.pa.y = _.y - w, C.pb.x = f.x - T, C.pb.y = f.y - w, C.pc.x = d.x - T, C.pc.y = d.y - w, C.ka = -P.DotVV(y, p), C.kb = -P.DotVV(p, m), C.kc = -P.DotVV(m, y), C.s = P.CrossVV(_, f) + P.CrossVV(f, d) + P.CrossVV(d, _)
- }
- })), En(this.m_triadBuffer.data, 0, this.m_triadBuffer.count, n.CompareTriadIndices), this.m_triadBuffer.Unique(n.MatchTriadIndices)
- }
- }, n.prototype.UpdatePairsAndTriadsWithReactiveParticles = function() {
- var e = new n.ReactiveFilter(this.m_flagsBuffer);
- if (this.UpdatePairsAndTriads(0, this.m_count, e), !this.m_flagsBuffer.data) throw new Error;
- for (var i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] &= ~t.b2ParticleFlag.b2_reactiveParticle;
- this.m_allParticleFlags &= ~t.b2ParticleFlag.b2_reactiveParticle
- }, n.ComparePairIndices = function(t, e) {
- var i = t.indexA - e.indexA;
- return 0 !== i ? i < 0 : t.indexB < e.indexB
- }, n.MatchPairIndices = function(t, e) {
- return t.indexA === e.indexA && t.indexB === e.indexB
- }, n.CompareTriadIndices = function(t, e) {
- var i = t.indexA - e.indexA;
- if (0 !== i) return i < 0;
- var n = t.indexB - e.indexB;
- return 0 !== n ? n < 0 : t.indexC < e.indexC
- }, n.MatchTriadIndices = function(t, e) {
- return t.indexA === e.indexA && t.indexB === e.indexB && t.indexC === e.indexC
- }, n.InitializeParticleLists = function(t, e) {
- for (var i = t.GetBufferIndex(), n = t.GetParticleCount(), r = 0; r < n; r++) {
- var s = e[r];
- s.list = s, s.next = null, s.count = 1, s.index = r + i
- }
- }, n.prototype.MergeParticleListsInContact = function(t, e) {
- for (var i = t.GetBufferIndex(), r = 0; r < this.m_contactBuffer.count; r++) {
- var s = this.m_contactBuffer.data[r],
- o = s.indexA,
- a = s.indexB;
- if (t.ContainsParticle(o) && t.ContainsParticle(a)) {
- var l = e[o - i].list,
- h = e[a - i].list;
- if (l !== h) {
- if (l.count < h.count) {
- var c = l;
- l = h, h = c
- }
- n.MergeParticleLists(l, h)
- }
- }
- }
- }, n.MergeParticleLists = function(t, e) {
- for (var i = e;;) {
- i.list = t;
- var n = i.next;
- if (!n) {
- i.next = t.next;
- break
- }
- i = n
- }
- t.next = e, t.count += e.count, e.count = 0
- }, n.FindLongestParticleList = function(t, e) {
- for (var i = t.GetParticleCount(), n = e[0], r = 0; r < i; r++) {
- var s = e[r];
- n.count < s.count && (n = s)
- }
- return n
- }, n.prototype.MergeZombieParticleListNodes = function(e, i, r) {
- if (!this.m_flagsBuffer.data) throw new Error;
- for (var s = e.GetParticleCount(), o = 0; o < s; o++) {
- var a = i[o];
- a !== r && this.m_flagsBuffer.data[a.index] & t.b2ParticleFlag.b2_zombieParticle && n.MergeParticleListAndNode(r, a)
- }
- }, n.MergeParticleListAndNode = function(t, e) {
- e.list = t, e.next = t.next, t.next = e, t.count++, e.count = 0
- }, n.prototype.CreateParticleGroupsFromParticleList = function(e, i, n) {
- if (!this.m_flagsBuffer.data) throw new Error;
- var r = e.GetParticleCount(),
- s = new xn;
- s.groupFlags = e.GetGroupFlags(), s.userData = e.GetUserData();
- for (var o = 0; o < r; o++) {
- var a = i[o];
- if (a.count && a !== n)
- for (var l = this.CreateParticleGroup(s), h = a; h; h = h.next) {
- var c = h.index,
- u = this.CloneParticle(c, l);
- this.m_flagsBuffer.data[c] |= t.b2ParticleFlag.b2_zombieParticle, h.index = u
- }
- }
- }, n.prototype.UpdatePairsAndTriadsWithParticleList = function(t, e) {
- for (var i = t.GetBufferIndex(), n = 0; n < this.m_pairBuffer.count; n++) {
- var r = this.m_pairBuffer.data[n],
- s = r.indexA,
- o = r.indexB;
- t.ContainsParticle(s) && (r.indexA = e[s - i].index), t.ContainsParticle(o) && (r.indexB = e[o - i].index)
- }
- for (n = 0; n < this.m_triadBuffer.count; n++) {
- var a = this.m_triadBuffer.data[n],
- l = (s = a.indexA, o = a.indexB, a.indexC);
- t.ContainsParticle(s) && (a.indexA = e[s - i].index), t.ContainsParticle(o) && (a.indexB = e[o - i].index), t.ContainsParticle(l) && (a.indexC = e[l - i].index)
- }
- }, n.prototype.ComputeDepth = function() {
- for (var e = [], n = 0, r = 0; r < this.m_contactBuffer.count; r++) {
- var s = (v = this.m_contactBuffer.data[r]).indexA,
- o = v.indexB,
- a = this.m_groupBuffer[s],
- l = this.m_groupBuffer[o];
- a && a === l && a.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && (e[n++] = v)
- }
- for (var h = [], c = 0, u = this.m_groupList; u; u = u.GetNext())
- if (u.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth) {
- h[c++] = u, this.SetGroupFlags(u, u.m_groupFlags & ~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
- for (var _ = u.m_firstIndex; _ < u.m_lastIndex; _++) this.m_accumulationBuffer[_] = 0
- }
- for (r = 0; r < n; r++) {
- s = (v = e[r]).indexA, o = v.indexB;
- var f = v.weight;
- this.m_accumulationBuffer[s] += f, this.m_accumulationBuffer[o] += f
- }
- for (_ = 0; _ < c; _++)
- for (var d = (u = h[_]).m_firstIndex; d < u.m_lastIndex; d++) {
- f = this.m_accumulationBuffer[d];
- this.m_depthBuffer[d] = f < .8 ? 0 : i
- }
- for (var p = S(this.m_count) >> 0, m = 0; m < p; m++) {
- var y = !1;
- for (r = 0; r < n; r++) {
- s = (v = e[r]).indexA, o = v.indexB;
- var v, g = 1 - v.weight,
- x = this.m_depthBuffer[s],
- b = this.m_depthBuffer[o],
- A = b + g,
- C = x + g;
- x > A && (this.m_depthBuffer[s] = A, y = !0), b > C && (this.m_depthBuffer[o] = C, y = !0)
- }
- if (!y) break
- }
- for (_ = 0; _ < c; _++)
- for (var T = (u = h[_]).m_firstIndex; T < u.m_lastIndex; T++) this.m_depthBuffer[T] < i ? this.m_depthBuffer[T] *= this.m_particleDiameter : this.m_depthBuffer[T] = 0
- }, n.prototype.GetInsideBoundsEnumerator = function(t) {
- var e = n.computeTag(this.m_inverseDiameter * t.lowerBound.x - 1, this.m_inverseDiameter * t.lowerBound.y - 1),
- i = n.computeTag(this.m_inverseDiameter * t.upperBound.x + 1, this.m_inverseDiameter * t.upperBound.y + 1),
- r = this.m_proxyBuffer.count,
- s = Dn(this.m_proxyBuffer.data, 0, r, e, n.Proxy.CompareProxyTag),
- o = Bn(this.m_proxyBuffer.data, 0, r, i, n.Proxy.CompareTagProxy);
- return new n.InsideBoundsEnumerator(this, e, i, s, o)
- }, n.prototype.UpdateAllParticleFlags = function() {
- if (!this.m_flagsBuffer.data) throw new Error;
- this.m_allParticleFlags = 0;
- for (var t = 0; t < this.m_count; t++) this.m_allParticleFlags |= this.m_flagsBuffer.data[t];
- this.m_needsUpdateAllParticleFlags = !1
- }, n.prototype.UpdateAllGroupFlags = function() {
- this.m_allGroupFlags = 0;
- for (var t = this.m_groupList; t; t = t.GetNext()) this.m_allGroupFlags |= t.m_groupFlags;
- this.m_needsUpdateAllGroupFlags = !1
- }, n.prototype.AddContact = function(t, e, i) {
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- var r = n.AddContact_s_d,
- s = this.m_positionBuffer.data,
- o = P.SubVV(s[e], s[t], r),
- a = P.DotVV(o, o);
- if (a < this.m_squaredDiameter) {
- var l = T(a);
- isFinite(l) || (l = 198177537e11);
- var h = this.m_contactBuffer.data[this.m_contactBuffer.Append()];
- h.indexA = t, h.indexB = e, h.flags = this.m_flagsBuffer.data[t] | this.m_flagsBuffer.data[e], h.weight = 1 - a * l * this.m_inverseDiameter, P.MulSV(l, o, h.normal)
- }
- }, n.prototype.FindContacts_Reference = function(t) {
- var e = this.m_proxyBuffer.count;
- this.m_contactBuffer.count = 0;
- for (var i = 0, r = 0; i < e; i++) {
- for (var s = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, 1, 0), o = i + 1; o < e && !(s < this.m_proxyBuffer.data[o].tag); o++) this.AddContact(this.m_proxyBuffer.data[i].index, this.m_proxyBuffer.data[o].index, this.m_contactBuffer);
- for (var a = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, -1, 1); r < e && !(a <= this.m_proxyBuffer.data[r].tag); r++);
- var l = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, 1, 1);
- for (o = r; o < e && !(l < this.m_proxyBuffer.data[o].tag); o++) this.AddContact(this.m_proxyBuffer.data[i].index, this.m_proxyBuffer.data[o].index, this.m_contactBuffer)
- }
- }, n.prototype.FindContacts = function(t) {
- this.FindContacts_Reference(t)
- }, n.prototype.UpdateProxies_Reference = function(t) {
- if (!this.m_positionBuffer.data) throw new Error;
- for (var e = this.m_positionBuffer.data, i = this.m_inverseDiameter, r = 0; r < this.m_proxyBuffer.count; ++r) {
- var s = this.m_proxyBuffer.data[r],
- o = e[s.index];
- s.tag = n.computeTag(i * o.x, i * o.y)
- }
- }, n.prototype.UpdateProxies = function(t) {
- this.UpdateProxies_Reference(t)
- }, n.prototype.SortProxies = function(t) {
- wn(this.m_proxyBuffer.data, 0, this.m_proxyBuffer.count, n.Proxy.CompareProxyProxy)
- }, n.prototype.FilterContacts = function(e) {
- var i = this.GetParticleContactFilter();
- if (null !== i) {
- var n = this;
- this.m_contactBuffer.RemoveIf((function(e) {
- return 0 != (e.flags & t.b2ParticleFlag.b2_particleContactFilterParticle) && !i.ShouldCollideParticleParticle(n, e.indexA, e.indexB)
- }))
- }
- }, n.prototype.NotifyContactListenerPreContact = function(t) {
- if (null !== this.GetParticleContactListener()) throw t.Initialize(this.m_contactBuffer, this.m_flagsBuffer), new Error
- }, n.prototype.NotifyContactListenerPostContact = function(t) {
- var e = this.GetParticleContactListener();
- if (null !== e) {
- for (var i = 0; i < this.m_contactBuffer.count; ++i) {
- var n = this.m_contactBuffer.data[i];
- e.BeginContactParticleParticle(this, n)
- }
- throw new Error
- }
- }, n.b2ParticleContactIsZombie = function(e) {
- return (e.flags & t.b2ParticleFlag.b2_zombieParticle) === t.b2ParticleFlag.b2_zombieParticle
- }, n.prototype.UpdateContacts = function(t) {
- this.UpdateProxies(this.m_proxyBuffer), this.SortProxies(this.m_proxyBuffer);
- var e = new n.b2ParticlePairSet;
- this.NotifyContactListenerPreContact(e), this.FindContacts(this.m_contactBuffer), this.FilterContacts(this.m_contactBuffer), this.NotifyContactListenerPostContact(e), t && this.m_contactBuffer.RemoveIf(n.b2ParticleContactIsZombie)
- }, n.prototype.NotifyBodyContactListenerPreContact = function(t) {
- if (null !== this.GetFixtureContactListener()) throw t.Initialize(this.m_bodyContactBuffer, this.m_flagsBuffer), new Error
- }, n.prototype.NotifyBodyContactListenerPostContact = function(t) {
- var e = this.GetFixtureContactListener();
- if (null !== e) {
- for (var i = 0; i < this.m_bodyContactBuffer.count; i++) {
- var n = this.m_bodyContactBuffer.data[i];
- e.BeginContactFixtureParticle(this, n)
- }
- throw new Error
- }
- }, n.prototype.UpdateBodyContacts = function() {
- var t = n.UpdateBodyContacts_s_aabb,
- e = new n.FixtureParticleSet;
- if (this.NotifyBodyContactListenerPreContact(e), this.m_stuckThreshold > 0) {
- if (!this.m_bodyContactCountBuffer.data) throw new Error;
- if (!this.m_lastBodyContactStepBuffer.data) throw new Error;
- if (!this.m_consecutiveContactStepsBuffer.data) throw new Error;
- for (var i = this.GetParticleCount(), r = 0; r < i; r++) this.m_bodyContactCountBuffer.data[r] = 0, this.m_timestamp > this.m_lastBodyContactStepBuffer.data[r] + 1 && (this.m_consecutiveContactStepsBuffer.data[r] = 0)
- }
- this.m_bodyContactBuffer.SetCount(0), this.m_stuckParticleBuffer.SetCount(0);
- var s = t;
- this.ComputeAABB(s);
- var o = new n.UpdateBodyContactsCallback(this, this.GetFixtureContactFilter());
- this.m_world.QueryAABB(o, s), this.m_def.strictContactCheck && this.RemoveSpuriousBodyContacts(), this.NotifyBodyContactListenerPostContact(e)
- }, n.prototype.Solve = function(e) {
- var i = n.Solve_s_subStep;
- if (0 !== this.m_count && (this.m_expirationTimeBuffer.data && this.SolveLifetimes(e), this.m_allParticleFlags & t.b2ParticleFlag.b2_zombieParticle && this.SolveZombie(), this.m_needsUpdateAllParticleFlags && this.UpdateAllParticleFlags(), this.m_needsUpdateAllGroupFlags && this.UpdateAllGroupFlags(), !this.m_paused))
- for (this.m_iterationIndex = 0; this.m_iterationIndex < e.particleIterations; this.m_iterationIndex++) {
- ++this.m_timestamp;
- var r = i.Copy(e);
- if (r.dt /= e.particleIterations, r.inv_dt *= e.particleIterations, this.UpdateContacts(!1), this.UpdateBodyContacts(), this.ComputeWeight(), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && this.ComputeDepth(), this.m_allParticleFlags & t.b2ParticleFlag.b2_reactiveParticle && this.UpdatePairsAndTriadsWithReactiveParticles(), this.m_hasForce && this.SolveForce(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_viscousParticle && this.SolveViscous(), this.m_allParticleFlags & t.b2ParticleFlag.b2_repulsiveParticle && this.SolveRepulsive(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_powderParticle && this.SolvePowder(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_tensileParticle && this.SolveTensile(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SolveSolid(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_colorMixingParticle && this.SolveColorMixing(), this.SolveGravity(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle && this.SolveStaticPressure(r), this.SolvePressure(r), this.SolveDamping(r), this.m_allParticleFlags & n.k_extraDampingFlags && this.SolveExtraDamping(), this.m_allParticleFlags & t.b2ParticleFlag.b2_elasticParticle && this.SolveElastic(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_springParticle && this.SolveSpring(r), this.LimitVelocity(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigidDamping(), this.m_allParticleFlags & t.b2ParticleFlag.b2_barrierParticle && this.SolveBarrier(r), this.SolveCollision(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigid(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_wallParticle && this.SolveWall(), !this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var s = 0; s < this.m_count; s++) this.m_positionBuffer.data[s].SelfMulAdd(r.dt, this.m_velocityBuffer.data[s])
- }
- }, n.prototype.SolveCollision = function(t) {
- var e = n.SolveCollision_s_aabb;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- var r = this.m_positionBuffer.data,
- s = this.m_velocityBuffer.data,
- o = e;
- o.lowerBound.x = +i, o.lowerBound.y = +i, o.upperBound.x = -i, o.upperBound.y = -i;
- for (var a = 0; a < this.m_count; a++) {
- var l = s[a],
- h = r[a],
- c = h.x + t.dt * l.x,
- u = h.y + t.dt * l.y;
- o.lowerBound.x = g(o.lowerBound.x, g(h.x, c)), o.lowerBound.y = g(o.lowerBound.y, g(h.y, u)), o.upperBound.x = x(o.upperBound.x, x(h.x, c)), o.upperBound.y = x(o.upperBound.y, x(h.y, u))
- }
- var _ = new n.SolveCollisionCallback(this, t);
- this.m_world.QueryAABB(_, o)
- }, n.prototype.LimitVelocity = function(t) {
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var e = this.m_velocityBuffer.data, i = this.GetCriticalVelocitySquared(t), n = 0; n < this.m_count; n++) {
- var r = e[n],
- s = P.DotVV(r, r);
- s > i && r.SelfMul(S(i / s))
- }
- }, n.prototype.SolveGravity = function(t) {
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var e = n.SolveGravity_s_gravity, i = this.m_velocityBuffer.data, r = P.MulSV(t.dt * this.m_def.gravityScale, this.m_world.GetGravity(), e), s = 0; s < this.m_count; s++) i[s].SelfAdd(r)
- }, n.prototype.SolveBarrier = function(e) {
- var i = n.SolveBarrier_s_aabb,
- r = n.SolveBarrier_s_va,
- s = n.SolveBarrier_s_vb,
- o = n.SolveBarrier_s_pba,
- a = n.SolveBarrier_s_vba,
- l = n.SolveBarrier_s_vc,
- h = n.SolveBarrier_s_pca,
- c = n.SolveBarrier_s_vca,
- u = n.SolveBarrier_s_qba,
- _ = n.SolveBarrier_s_qca,
- f = n.SolveBarrier_s_dv,
- d = n.SolveBarrier_s_f;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var p = this.m_positionBuffer.data, m = this.m_velocityBuffer.data, y = 0; y < this.m_count; y++) {
- 0 != (this.m_flagsBuffer.data[y] & n.k_barrierWallFlags) && m[y].SetZero()
- }
- for (var v = 2.5 * e.dt, g = this.GetParticleMass(), x = 0; x < this.m_pairBuffer.count; x++) {
- var b = this.m_pairBuffer.data[x];
- if (b.flags & t.b2ParticleFlag.b2_barrierParticle) {
- var A = b.indexA,
- C = b.indexB,
- T = p[A],
- w = p[C],
- E = i;
- P.MinV(T, w, E.lowerBound), P.MaxV(T, w, E.upperBound);
- for (var M = this.m_groupBuffer[A], D = this.m_groupBuffer[C], B = this.GetLinearVelocity(M, A, T, r), I = this.GetLinearVelocity(D, C, w, s), R = P.SubVV(w, T, o), O = P.SubVV(I, B, a), L = this.GetInsideBoundsEnumerator(E), F = void 0;
- (F = L.GetNext()) >= 0;) {
- var N = p[F],
- V = this.m_groupBuffer[F];
- if (M !== V && D !== V) {
- var k = this.GetLinearVelocity(V, F, N, l),
- G = P.SubVV(N, T, h),
- U = P.SubVV(k, B, c),
- z = P.CrossVV(O, U),
- j = P.CrossVV(R, U) - P.CrossVV(G, O),
- W = P.CrossVV(R, G),
- H = void 0,
- X = void 0,
- Y = u,
- q = _;
- if (0 === z) {
- if (0 === j) continue;
- if (!((X = -W / j) >= 0 && X < v)) continue;
- if (P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), !((H = P.DotVV(Y, q) / P.DotVV(Y, Y)) >= 0 && H <= 1)) continue
- } else {
- var J = j * j - 4 * W * z;
- if (J < 0) continue;
- var Z = S(J),
- K = (-j - Z) / (2 * z),
- Q = (-j + Z) / (2 * z);
- if (K > Q) {
- var $ = K;
- K = Q, Q = $
- }
- if (X = K, P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), H = P.DotVV(Y, q) / P.DotVV(Y, Y), !(X >= 0 && X < v && H >= 0 && H <= 1)) {
- if (!((X = Q) >= 0 && X < v)) continue;
- if (P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), !((H = P.DotVV(Y, q) / P.DotVV(Y, Y)) >= 0 && H <= 1)) continue
- }
- }
- var tt = f;
- tt.x = B.x + H * O.x - k.x, tt.y = B.y + H * O.y - k.y;
- var et = P.MulSV(g, tt, d);
- if (V && this.IsRigidGroup(V)) {
- var it = V.GetMass(),
- nt = V.GetInertia();
- it > 0 && V.m_linearVelocity.SelfMulAdd(1 / it, et), nt > 0 && (V.m_angularVelocity += P.CrossVV(P.SubVV(N, V.GetCenter(), P.s_t0), et) / nt)
- } else m[F].SelfAdd(tt);
- this.ParticleApplyForce(F, et.SelfMul(-e.inv_dt))
- }
- }
- }
- }
- }, n.prototype.SolveStaticPressure = function(e) {
- if (!this.m_flagsBuffer.data) throw new Error;
- this.m_staticPressureBuffer = this.RequestBuffer(this.m_staticPressureBuffer);
- for (var i = this.GetCriticalPressure(e), n = this.m_def.staticPressureStrength * i, r = .25 * i, s = this.m_def.staticPressureRelaxation, o = 0; o < this.m_def.staticPressureIterations; o++) {
- for (var a = 0; a < this.m_count; a++) this.m_accumulationBuffer[a] = 0;
- for (var l = 0; l < this.m_contactBuffer.count; l++) {
- var h = this.m_contactBuffer.data[l];
- if (h.flags & t.b2ParticleFlag.b2_staticPressureParticle) {
- var c = h.indexA,
- u = h.indexB,
- _ = h.weight;
- this.m_accumulationBuffer[c] += _ * this.m_staticPressureBuffer[u], this.m_accumulationBuffer[u] += _ * this.m_staticPressureBuffer[c]
- }
- }
- for (a = 0; a < this.m_count; a++) {
- _ = this.m_weightBuffer[a];
- if (this.m_flagsBuffer.data[a] & t.b2ParticleFlag.b2_staticPressureParticle) {
- var f = (this.m_accumulationBuffer[a] + n * (_ - 1)) / (_ + s);
- this.m_staticPressureBuffer[a] = b(f, 0, r)
- } else this.m_staticPressureBuffer[a] = 0
- }
- }
- }, n.prototype.ComputeWeight = function() {
- for (var t = 0; t < this.m_count; t++) this.m_weightBuffer[t] = 0;
- for (t = 0; t < this.m_bodyContactBuffer.count; t++) {
- var e = (n = this.m_bodyContactBuffer.data[t]).index,
- i = n.weight;
- this.m_weightBuffer[e] += i
- }
- for (t = 0; t < this.m_contactBuffer.count; t++) {
- e = (n = this.m_contactBuffer.data[t]).indexA;
- var n, r = n.indexB;
- i = n.weight;
- this.m_weightBuffer[e] += i, this.m_weightBuffer[r] += i
- }
- }, n.prototype.SolvePressure = function(e) {
- var i = n.SolvePressure_s_f;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.GetCriticalPressure(e), a = this.m_def.pressureStrength * o, l = .25 * o, h = 0; h < this.m_count; h++) {
- var c = this.m_weightBuffer[h],
- u = a * x(0, c - 1);
- this.m_accumulationBuffer[h] = g(u, l)
- }
- if (this.m_allParticleFlags & n.k_noPressureFlags)
- for (h = 0; h < this.m_count; h++) this.m_flagsBuffer.data[h] & n.k_noPressureFlags && (this.m_accumulationBuffer[h] = 0);
- if (this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle)
- for (h = 0; h < this.m_count; h++) this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_staticPressureParticle && (this.m_accumulationBuffer[h] += this.m_staticPressureBuffer[h]);
- for (var _ = e.dt / (this.m_def.density * this.m_particleDiameter), f = this.GetParticleInvMass(), d = 0; d < this.m_bodyContactBuffer.count; d++) {
- var p = (C = this.m_bodyContactBuffer.data[d]).index,
- m = C.body,
- y = (c = C.weight, C.mass),
- v = C.normal,
- b = r[p],
- A = (u = this.m_accumulationBuffer[p] + a * c, P.MulSV(_ * c * y * u, v, i));
- s[p].SelfMulSub(f, A), m.ApplyLinearImpulse(A, b, !0)
- }
- for (d = 0; d < this.m_contactBuffer.count; d++) {
- var C;
- p = (C = this.m_contactBuffer.data[d]).indexA, m = C.indexB, c = C.weight, v = C.normal, u = this.m_accumulationBuffer[p] + this.m_accumulationBuffer[m], A = P.MulSV(_ * c * u, v, i);
- s[p].SelfSub(A), s[m].SelfAdd(A)
- }
- }, n.prototype.SolveDamping = function(t) {
- var e = n.SolveDamping_s_v,
- i = n.SolveDamping_s_f;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.dampingStrength, a = 1 / this.GetCriticalVelocity(t), l = this.GetParticleInvMass(), h = 0; h < this.m_bodyContactBuffer.count; h++) {
- var c = (b = this.m_bodyContactBuffer.data[h]).index,
- u = b.body,
- _ = b.weight,
- f = b.mass,
- d = b.normal,
- p = r[c],
- m = P.SubVV(u.GetLinearVelocityFromWorldPoint(p, P.s_t0), s[c], e);
- if ((A = P.DotVV(m, d)) < 0) {
- var y = x(o * _, g(-a * A, .5)),
- v = P.MulSV(y * f * A, d, i);
- s[c].SelfMulAdd(l, v), u.ApplyLinearImpulse(v.SelfNeg(), p, !0)
- }
- }
- for (h = 0; h < this.m_contactBuffer.count; h++) {
- var b, A;
- c = (b = this.m_contactBuffer.data[h]).indexA, u = b.indexB, _ = b.weight, d = b.normal, m = P.SubVV(s[u], s[c], e);
- if ((A = P.DotVV(m, d)) < 0) {
- y = x(o * _, g(-a * A, .5)), v = P.MulSV(y * A, d, i);
- s[c].SelfAdd(v), s[u].SelfSub(v)
- }
- }
- }, n.prototype.SolveRigidDamping = function() {
- var t = n.SolveRigidDamping_s_t0,
- e = n.SolveRigidDamping_s_t1,
- i = n.SolveRigidDamping_s_p,
- r = n.SolveRigidDamping_s_v,
- s = [0],
- o = [0],
- a = [0],
- l = [0],
- h = [0],
- c = [0];
- if (!this.m_positionBuffer.data) throw new Error;
- for (var u = this.m_positionBuffer.data, _ = this.m_def.dampingStrength, f = 0; f < this.m_bodyContactBuffer.count; f++) {
- var d = (A = this.m_bodyContactBuffer.data[f]).index;
- if ((C = this.m_groupBuffer[d]) && this.IsRigidGroup(C)) {
- var p = A.body,
- m = A.normal,
- y = A.weight,
- v = u[d],
- x = P.SubVV(p.GetLinearVelocityFromWorldPoint(v, t), C.GetLinearVelocityFromWorldPoint(v, e), r);
- if ((E = P.DotVV(x, m)) < 0) {
- this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, !0, C, d, v, m), this.InitDampingParameter(l, h, c, p.GetMass(), p.GetInertia() - p.GetMass() * p.GetLocalCenter().LengthSquared(), p.GetWorldCenter(), v, m);
- var b = _ * g(y, 1) * this.ComputeDampingImpulse(s[0], o[0], a[0], l[0], h[0], c[0], E);
- this.ApplyDamping(s[0], o[0], a[0], !0, C, d, b, m), p.ApplyLinearImpulse(P.MulSV(-b, m, P.s_t0), v, !0)
- }
- }
- }
- for (f = 0; f < this.m_contactBuffer.count; f++) {
- d = (A = this.m_contactBuffer.data[f]).indexA, p = A.indexB, m = A.normal, y = A.weight;
- var A, C = this.m_groupBuffer[d],
- T = this.m_groupBuffer[p],
- S = this.IsRigidGroup(C),
- w = this.IsRigidGroup(T);
- if (C !== T && (S || w)) {
- var E;
- v = P.MidVV(u[d], u[p], i), x = P.SubVV(this.GetLinearVelocity(T, p, v, t), this.GetLinearVelocity(C, d, v, e), r);
- if ((E = P.DotVV(x, m)) < 0) {
- this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, S, C, d, v, m), this.InitDampingParameterWithRigidGroupOrParticle(l, h, c, w, T, p, v, m);
- b = _ * y * this.ComputeDampingImpulse(s[0], o[0], a[0], l[0], h[0], c[0], E);
- this.ApplyDamping(s[0], o[0], a[0], S, C, d, b, m), this.ApplyDamping(l[0], h[0], c[0], w, T, p, -b, m)
- }
- }
- }
- }, n.prototype.SolveExtraDamping = function() {
- var t = n.SolveExtraDamping_s_v,
- e = n.SolveExtraDamping_s_f;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var i = this.m_velocityBuffer.data, r = this.m_positionBuffer.data, s = this.GetParticleInvMass(), o = 0; o < this.m_bodyContactBuffer.count; o++) {
- var a = this.m_bodyContactBuffer.data[o],
- l = a.index;
- if (this.m_flagsBuffer.data[l] & n.k_extraDampingFlags) {
- var h = a.body,
- c = a.mass,
- u = a.normal,
- _ = r[l],
- f = P.SubVV(h.GetLinearVelocityFromWorldPoint(_, P.s_t0), i[l], t),
- d = P.DotVV(f, u);
- if (d < 0) {
- var p = P.MulSV(.5 * c * d, u, e);
- i[l].SelfMulAdd(s, p), h.ApplyLinearImpulse(p.SelfNeg(), _, !0)
- }
- }
- }
- }, n.prototype.SolveWall = function() {
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var e = this.m_velocityBuffer.data, i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] & t.b2ParticleFlag.b2_wallParticle && e[i].SetZero()
- }, n.prototype.SolveRigid = function(e) {
- var i = n.SolveRigid_s_position,
- r = n.SolveRigid_s_rotation,
- s = n.SolveRigid_s_transform,
- o = n.SolveRigid_s_velocityTransform;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var a = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = this.m_groupList; h; h = h.GetNext())
- if (h.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) {
- h.UpdateStatistics();
- var c = r;
- c.SetAngle(e.dt * h.m_angularVelocity);
- var u = P.AddVV(h.m_center, P.SubVV(P.MulSV(e.dt, h.m_linearVelocity, P.s_t0), N.MulRV(c, h.m_center, P.s_t1), P.s_t0), i),
- _ = s;
- _.SetPositionRotation(u, c), V.MulXX(_, h.m_transform, h.m_transform);
- var f = o;
- f.p.x = e.inv_dt * _.p.x, f.p.y = e.inv_dt * _.p.y, f.q.s = e.inv_dt * _.q.s, f.q.c = e.inv_dt * (_.q.c - 1);
- for (var d = h.m_firstIndex; d < h.m_lastIndex; d++) V.MulXV(f, a[d], l[d])
- }
- }, n.prototype.SolveElastic = function(e) {
- var i = n.SolveElastic_s_pa,
- r = n.SolveElastic_s_pb,
- s = n.SolveElastic_s_pc,
- o = n.SolveElastic_s_r,
- a = n.SolveElastic_s_t0;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var l = this.m_positionBuffer.data, h = this.m_velocityBuffer.data, c = e.inv_dt * this.m_def.elasticStrength, u = 0; u < this.m_triadBuffer.count; u++) {
- var _ = this.m_triadBuffer.data[u];
- if (_.flags & t.b2ParticleFlag.b2_elasticParticle) {
- var f = _.indexA,
- d = _.indexB,
- p = _.indexC,
- m = _.pa,
- y = _.pb,
- v = _.pc,
- g = i.Copy(l[f]),
- x = r.Copy(l[d]),
- b = s.Copy(l[p]),
- A = h[f],
- C = h[d],
- S = h[p];
- g.SelfMulAdd(e.dt, A), x.SelfMulAdd(e.dt, C), b.SelfMulAdd(e.dt, S);
- var w = (g.x + x.x + b.x) / 3,
- E = (g.y + x.y + b.y) / 3;
- g.x -= w, g.y -= E, x.x -= w, x.y -= E, b.x -= w, b.y -= E;
- var M = o;
- M.s = P.CrossVV(m, g) + P.CrossVV(y, x) + P.CrossVV(v, b), M.c = P.DotVV(m, g) + P.DotVV(y, x) + P.DotVV(v, b);
- var D = T(M.s * M.s + M.c * M.c);
- isFinite(D) || (D = 198177537e11), M.s *= D, M.c *= D;
- var B = c * _.strength;
- N.MulRV(M, m, a), P.SubVV(a, g, a), P.MulSV(B, a, a), A.SelfAdd(a), N.MulRV(M, y, a), P.SubVV(a, x, a), P.MulSV(B, a, a), C.SelfAdd(a), N.MulRV(M, v, a), P.SubVV(a, b, a), P.MulSV(B, a, a), S.SelfAdd(a)
- }
- }
- }, n.prototype.SolveSpring = function(e) {
- var i = n.SolveSpring_s_pa,
- r = n.SolveSpring_s_pb,
- s = n.SolveSpring_s_d,
- o = n.SolveSpring_s_f;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var a = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = e.inv_dt * this.m_def.springStrength, c = 0; c < this.m_pairBuffer.count; c++) {
- var u = this.m_pairBuffer.data[c];
- if (u.flags & t.b2ParticleFlag.b2_springParticle) {
- var _ = u.indexA,
- f = u.indexB,
- d = i.Copy(a[_]),
- p = r.Copy(a[f]),
- m = l[_],
- y = l[f];
- d.SelfMulAdd(e.dt, m), p.SelfMulAdd(e.dt, y);
- var v = P.SubVV(p, d, s),
- g = u.distance,
- x = v.Length(),
- b = h * u.strength,
- A = P.MulSV(b * (g - x) / x, v, o);
- m.SelfSub(A), y.SelfAdd(A)
- }
- }
- }, n.prototype.SolveTensile = function(e) {
- var i = n.SolveTensile_s_weightedNormal,
- r = n.SolveTensile_s_s,
- s = n.SolveTensile_s_f;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var o = this.m_velocityBuffer.data, a = 0; a < this.m_count; a++) this.m_accumulation2Buffer[a] = new P, this.m_accumulation2Buffer[a].SetZero();
- for (var l = 0; l < this.m_contactBuffer.count; l++) {
- if ((v = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) {
- var h = v.indexA,
- c = v.indexB,
- u = v.weight,
- _ = v.normal,
- f = P.MulSV((1 - u) * u, _, i);
- this.m_accumulation2Buffer[h].SelfSub(f), this.m_accumulation2Buffer[c].SelfAdd(f)
- }
- }
- var d = this.GetCriticalVelocity(e),
- p = this.m_def.surfaceTensionPressureStrength * d,
- m = this.m_def.surfaceTensionNormalStrength * d,
- y = .5 * d;
- for (l = 0; l < this.m_contactBuffer.count; l++) {
- var v;
- if ((v = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) {
- h = v.indexA, c = v.indexB, u = v.weight, _ = v.normal;
- var x = this.m_weightBuffer[h] + this.m_weightBuffer[c],
- b = P.SubVV(this.m_accumulation2Buffer[c], this.m_accumulation2Buffer[h], r),
- A = g(p * (x - 2) + m * P.DotVV(b, _), y) * u,
- C = P.MulSV(A, _, s);
- o[h].SelfSub(C), o[c].SelfAdd(C)
- }
- }
- }, n.prototype.SolveViscous = function() {
- var e = n.SolveViscous_s_v,
- i = n.SolveViscous_s_f;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.viscousStrength, a = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) {
- var h = (m = this.m_bodyContactBuffer.data[l]).index;
- if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_viscousParticle) {
- var c = m.body,
- u = m.weight,
- _ = m.mass,
- f = r[h],
- d = P.SubVV(c.GetLinearVelocityFromWorldPoint(f, P.s_t0), s[h], e),
- p = P.MulSV(o * _ * u, d, i);
- s[h].SelfMulAdd(a, p), c.ApplyLinearImpulse(p.SelfNeg(), f, !0)
- }
- }
- for (l = 0; l < this.m_contactBuffer.count; l++) {
- var m;
- if ((m = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_viscousParticle) {
- h = m.indexA, c = m.indexB, u = m.weight, d = P.SubVV(s[c], s[h], e), p = P.MulSV(o * u, d, i);
- s[h].SelfAdd(p), s[c].SelfSub(p)
- }
- }
- }, n.prototype.SolveRepulsive = function(e) {
- var i = n.SolveRepulsive_s_f;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var r = this.m_velocityBuffer.data, s = this.m_def.repulsiveStrength * this.GetCriticalVelocity(e), o = 0; o < this.m_contactBuffer.count; o++) {
- var a = this.m_contactBuffer.data[o];
- if (a.flags & t.b2ParticleFlag.b2_repulsiveParticle) {
- var l = a.indexA,
- h = a.indexB;
- if (this.m_groupBuffer[l] !== this.m_groupBuffer[h]) {
- var c = a.weight,
- u = a.normal,
- _ = P.MulSV(s * c, u, i);
- r[l].SelfSub(_), r[h].SelfAdd(_)
- }
- }
- }
- }, n.prototype.SolvePowder = function(e) {
- var i = n.SolvePowder_s_f;
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.powderStrength * this.GetCriticalVelocity(e), a = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) {
- var h = (p = this.m_bodyContactBuffer.data[l]).index;
- if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_powderParticle)
- if ((m = p.weight) > .25) {
- var c = p.body,
- u = p.mass,
- _ = r[h],
- f = p.normal,
- d = P.MulSV(o * u * (m - .25), f, i);
- s[h].SelfMulSub(a, d), c.ApplyLinearImpulse(d, _, !0)
- }
- }
- for (l = 0; l < this.m_contactBuffer.count; l++) {
- var p, m;
- if ((p = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_powderParticle)
- if ((m = p.weight) > .25) {
- h = p.indexA, c = p.indexB, f = p.normal, d = P.MulSV(o * (m - .25), f, i);
- s[h].SelfSub(d), s[c].SelfAdd(d)
- }
- }
- }, n.prototype.SolveSolid = function(t) {
- var e = n.SolveSolid_s_f;
- if (!this.m_velocityBuffer.data) throw new Error;
- var i = this.m_velocityBuffer.data;
- this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer);
- for (var r = t.inv_dt * this.m_def.ejectionStrength, s = 0; s < this.m_contactBuffer.count; s++) {
- var o = this.m_contactBuffer.data[s],
- a = o.indexA,
- l = o.indexB;
- if (this.m_groupBuffer[a] !== this.m_groupBuffer[l]) {
- var h = o.weight,
- c = o.normal,
- u = this.m_depthBuffer[a] + this.m_depthBuffer[l],
- _ = P.MulSV(r * u * h, c, e);
- i[a].SelfSub(_), i[l].SelfAdd(_)
- }
- }
- }, n.prototype.SolveForce = function(t) {
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var e = this.m_velocityBuffer.data, i = t.dt * this.GetParticleInvMass(), n = 0; n < this.m_count; n++) e[n].SelfMulAdd(i, this.m_forceBuffer[n]);
- this.m_hasForce = !1
- }, n.prototype.SolveColorMixing = function() {
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_colorBuffer.data) throw new Error;
- var e = .5 * this.m_def.colorMixingStrength;
- if (e)
- for (var i = 0; i < this.m_contactBuffer.count; i++) {
- var n = this.m_contactBuffer.data[i],
- r = n.indexA,
- s = n.indexB;
- if (this.m_flagsBuffer.data[r] & this.m_flagsBuffer.data[s] & t.b2ParticleFlag.b2_colorMixingParticle) {
- var o = this.m_colorBuffer.data[r],
- a = this.m_colorBuffer.data[s];
- G.MixColors(o, a, e)
- }
- }
- }, n.prototype.SolveZombie = function() {
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- for (var e = 0, i = [], n = 0; n < this.m_count; n++) i[n] = u;
- var r = 0;
- for (n = 0; n < this.m_count; n++) {
- var s = this.m_flagsBuffer.data[n];
- if (s & t.b2ParticleFlag.b2_zombieParticle) {
- var o = this.m_world.m_destructionListener;
- if (s & t.b2ParticleFlag.b2_destructionListenerParticle && o && o.SayGoodbyeParticle(this, n), this.m_handleIndexBuffer.data)(a = this.m_handleIndexBuffer.data[n]) && (a.SetIndex(u), this.m_handleIndexBuffer.data[n] = null);
- i[n] = u
- } else {
- if (i[n] = e, n !== e) {
- var a;
- if (this.m_handleIndexBuffer.data)(a = this.m_handleIndexBuffer.data[n]) && a.SetIndex(e), this.m_handleIndexBuffer.data[e] = a;
- this.m_flagsBuffer.data[e] = this.m_flagsBuffer.data[n], this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = this.m_lastBodyContactStepBuffer.data[n]), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = this.m_bodyContactCountBuffer.data[n]), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = this.m_consecutiveContactStepsBuffer.data[n]), this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[n]), this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[n]), this.m_groupBuffer[e] = this.m_groupBuffer[n], this.m_hasForce && this.m_forceBuffer[e].Copy(this.m_forceBuffer[n]), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = this.m_staticPressureBuffer[n]), this.m_depthBuffer && (this.m_depthBuffer[e] = this.m_depthBuffer[n]), this.m_colorBuffer.data && this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[n]), this.m_userDataBuffer.data && (this.m_userDataBuffer.data[e] = this.m_userDataBuffer.data[n]), this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[e] = this.m_expirationTimeBuffer.data[n])
- }
- e++, r |= s
- }
- }
- for (var l = function(t) {
- return t.index < 0
- }, h = function(t) {
- return t.indexA < 0 || t.indexB < 0
- }, c = function(t) {
- return t.index < 0
- }, _ = function(t) {
- return t.indexA < 0 || t.indexB < 0
- }, f = function(t) {
- return t.indexA < 0 || t.indexB < 0 || t.indexC < 0
- }, d = 0; d < this.m_proxyBuffer.count; d++) {
- var p = this.m_proxyBuffer.data[d];
- p.index = i[p.index]
- }
- this.m_proxyBuffer.RemoveIf(l);
- for (d = 0; d < this.m_contactBuffer.count; d++) {
- (m = this.m_contactBuffer.data[d]).indexA = i[m.indexA], m.indexB = i[m.indexB]
- }
- this.m_contactBuffer.RemoveIf(h);
- for (d = 0; d < this.m_bodyContactBuffer.count; d++) {
- var m;
- (m = this.m_bodyContactBuffer.data[d]).index = i[m.index]
- }
- this.m_bodyContactBuffer.RemoveIf(c);
- for (d = 0; d < this.m_pairBuffer.count; d++) {
- var y = this.m_pairBuffer.data[d];
- y.indexA = i[y.indexA], y.indexB = i[y.indexB]
- }
- this.m_pairBuffer.RemoveIf(_);
- for (d = 0; d < this.m_triadBuffer.count; d++) {
- var v = this.m_triadBuffer.data[d];
- v.indexA = i[v.indexA], v.indexB = i[v.indexB], v.indexC = i[v.indexC]
- }
- if (this.m_triadBuffer.RemoveIf(f), this.m_indexByExpirationTimeBuffer.data)
- for (var b = 0, A = 0; A < this.m_count; A++) {
- var C = i[this.m_indexByExpirationTimeBuffer.data[A]];
- C !== u && (this.m_indexByExpirationTimeBuffer.data[b++] = C)
- }
- for (var T = this.m_groupList; T; T = T.GetNext()) {
- var S = e,
- w = 0,
- E = !1;
- for (n = T.m_firstIndex; n < T.m_lastIndex; n++) {
- var M = i[n];
- M >= 0 ? (S = g(S, M), w = x(w, M + 1)) : E = !0
- }
- S < w ? (T.m_firstIndex = S, T.m_lastIndex = w, E && T.m_groupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SetGroupFlags(T, T.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)) : (T.m_firstIndex = 0, T.m_lastIndex = 0, T.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty || this.SetGroupFlags(T, T.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed))
- }
- this.m_count = e, this.m_allParticleFlags = r, this.m_needsUpdateAllParticleFlags = !1;
- for (T = this.m_groupList; T;) {
- var D = T.GetNext();
- T.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed && this.DestroyParticleGroup(T), T = D
- }
- }, n.prototype.SolveLifetimes = function(t) {
- if (!this.m_expirationTimeBuffer.data) throw new Error;
- if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
- this.m_timeElapsed = this.LifetimeToExpirationTime(t.dt);
- var e = this.GetQuantizedTimeElapsed(),
- i = this.m_expirationTimeBuffer.data,
- n = this.m_indexByExpirationTimeBuffer.data,
- r = this.GetParticleCount();
- if (this.m_expirationTimeBufferRequiresSorting) {
- wn(n, 0, r, (function(t, e) {
- var n = i[t],
- r = i[e],
- s = n <= 0;
- return s === r <= 0 ? n > r : s
- })), this.m_expirationTimeBufferRequiresSorting = !1
- }
- for (var s = r - 1; s >= 0; --s) {
- var o = n[s],
- a = i[o];
- if (e < a || a <= 0) break;
- this.DestroyParticle(o)
- }
- }, n.prototype.RotateBuffer = function(t, e, i) {
- if (t !== e && e !== i) {
- if (!this.m_flagsBuffer.data) throw new Error;
- if (!this.m_positionBuffer.data) throw new Error;
- if (!this.m_velocityBuffer.data) throw new Error;
- if (In(this.m_flagsBuffer.data, t, e, i), this.m_lastBodyContactStepBuffer.data && In(this.m_lastBodyContactStepBuffer.data, t, e, i), this.m_bodyContactCountBuffer.data && In(this.m_bodyContactCountBuffer.data, t, e, i), this.m_consecutiveContactStepsBuffer.data && In(this.m_consecutiveContactStepsBuffer.data, t, e, i), In(this.m_positionBuffer.data, t, e, i), In(this.m_velocityBuffer.data, t, e, i), In(this.m_groupBuffer, t, e, i), this.m_hasForce && In(this.m_forceBuffer, t, e, i), this.m_staticPressureBuffer && In(this.m_staticPressureBuffer, t, e, i), this.m_depthBuffer && In(this.m_depthBuffer, t, e, i), this.m_colorBuffer.data && In(this.m_colorBuffer.data, t, e, i), this.m_userDataBuffer.data && In(this.m_userDataBuffer.data, t, e, i), this.m_handleIndexBuffer.data) {
- In(this.m_handleIndexBuffer.data, t, e, i);
- for (var n = t; n < i; ++n) {
- var r = this.m_handleIndexBuffer.data[n];
- r && r.SetIndex(f(r.GetIndex()))
- }
- }
- if (this.m_expirationTimeBuffer.data) {
- In(this.m_expirationTimeBuffer.data, t, e, i);
- var s = this.GetParticleCount();
- if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
- var o = this.m_indexByExpirationTimeBuffer.data;
- for (n = 0; n < s; ++n) o[n] = f(o[n])
- }
- for (var a = 0; a < this.m_proxyBuffer.count; a++) {
- var l = this.m_proxyBuffer.data[a];
- l.index = f(l.index)
- }
- for (a = 0; a < this.m_contactBuffer.count; a++) {
- (h = this.m_contactBuffer.data[a]).indexA = f(h.indexA), h.indexB = f(h.indexB)
- }
- for (a = 0; a < this.m_bodyContactBuffer.count; a++) {
- var h;
- (h = this.m_bodyContactBuffer.data[a]).index = f(h.index)
- }
- for (a = 0; a < this.m_pairBuffer.count; a++) {
- var c = this.m_pairBuffer.data[a];
- c.indexA = f(c.indexA), c.indexB = f(c.indexB)
- }
- for (a = 0; a < this.m_triadBuffer.count; a++) {
- var u = this.m_triadBuffer.data[a];
- u.indexA = f(u.indexA), u.indexB = f(u.indexB), u.indexC = f(u.indexC)
- }
- for (var _ = this.m_groupList; _; _ = _.GetNext()) _.m_firstIndex = f(_.m_firstIndex), _.m_lastIndex = f(_.m_lastIndex - 1) + 1
- }
- function f(n) {
- return n < t ? n : n < e ? n + i - e : n < i ? n + t - e : n
- }
- }, n.prototype.GetCriticalVelocity = function(t) {
- return this.m_particleDiameter * t.inv_dt
- }, n.prototype.GetCriticalVelocitySquared = function(t) {
- var e = this.GetCriticalVelocity(t);
- return e * e
- }, n.prototype.GetCriticalPressure = function(t) {
- return this.m_def.density * this.GetCriticalVelocitySquared(t)
- }, n.prototype.GetParticleStride = function() {
- return .75 * this.m_particleDiameter
- }, n.prototype.GetParticleMass = function() {
- var t = this.GetParticleStride();
- return this.m_def.density * t * t
- }, n.prototype.GetParticleInvMass = function() {
- var t = this.m_inverseDiameter * (1 / .75);
- return this.m_inverseDensity * t * t
- }, n.prototype.GetFixtureContactFilter = function() {
- return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null
- }, n.prototype.GetParticleContactFilter = function() {
- return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null
- }, n.prototype.GetFixtureContactListener = function() {
- return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null
- }, n.prototype.GetParticleContactListener = function() {
- return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null
- }, n.prototype.SetUserOverridableBuffer = function(t, e, i) {
- t.data = e, t.userSuppliedCapacity = i
- }, n.prototype.SetGroupFlags = function(e, i) {
- var n = e.m_groupFlags;
- (n ^ i) & t.b2ParticleGroupFlag.b2_solidParticleGroup && (i |= t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth), n & ~i && (this.m_needsUpdateAllGroupFlags = !0), ~this.m_allGroupFlags & i && (i & t.b2ParticleGroupFlag.b2_solidParticleGroup && (this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer)), this.m_allGroupFlags |= i), e.m_groupFlags = i
- }, n.BodyContactCompare = function(t, e) {
- return t.index === e.index ? t.weight > e.weight : t.index < e.index
- }, n.prototype.RemoveSpuriousBodyContacts = function() {
- wn(this.m_bodyContactBuffer.data, 0, this.m_bodyContactBuffer.count, n.BodyContactCompare);
- var t = n.RemoveSpuriousBodyContacts_s_n,
- e = n.RemoveSpuriousBodyContacts_s_pos,
- i = n.RemoveSpuriousBodyContacts_s_normal,
- r = this,
- s = -1,
- o = 0;
- this.m_bodyContactBuffer.count = Mn(this.m_bodyContactBuffer.data, (function(n) {
- if (n.index !== s && (o = 0, s = n.index), o++ > 3) return !0;
- var a = t.Copy(n.normal);
- if (a.SelfMul(r.m_particleDiameter * (1 - n.weight)), !r.m_positionBuffer.data) throw new Error;
- var h = P.AddVV(r.m_positionBuffer.data[n.index], a, e);
- if (!n.fixture.TestPoint(h)) {
- for (var c = n.fixture.GetShape().GetChildCount(), u = 0; u < c; u++) {
- var _ = i;
- if (n.fixture.ComputeDistance(h, _, u) < l) return !1
- }
- return !0
- }
- return !1
- }), this.m_bodyContactBuffer.count)
- }, n.prototype.DetectStuckParticle = function(t) {
- if (!(this.m_stuckThreshold <= 0)) {
- if (!this.m_bodyContactCountBuffer.data) throw new Error;
- if (!this.m_consecutiveContactStepsBuffer.data) throw new Error;
- if (!this.m_lastBodyContactStepBuffer.data) throw new Error;
- ++this.m_bodyContactCountBuffer.data[t], 2 === this.m_bodyContactCountBuffer.data[t] && (++this.m_consecutiveContactStepsBuffer.data[t], this.m_consecutiveContactStepsBuffer.data[t] > this.m_stuckThreshold && (this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()] = t)), this.m_lastBodyContactStepBuffer.data[t] = this.m_timestamp
- }
- }, n.prototype.ValidateParticleIndex = function(t) {
- return t >= 0 && t < this.GetParticleCount() && t !== u
- }, n.prototype.GetQuantizedTimeElapsed = function() {
- return Math.floor(this.m_timeElapsed / 4294967296)
- }, n.prototype.LifetimeToExpirationTime = function(t) {
- return this.m_timeElapsed + Math.floor(t / this.m_def.lifetimeGranularity * 4294967296)
- }, n.prototype.ForceCanBeApplied = function(e) {
- return !(e & t.b2ParticleFlag.b2_wallParticle)
- }, n.prototype.PrepareForceBuffer = function() {
- if (!this.m_hasForce) {
- for (var t = 0; t < this.m_count; t++) this.m_forceBuffer[t].SetZero();
- this.m_hasForce = !0
- }
- }, n.prototype.IsRigidGroup = function(e) {
- return null !== e && 0 != (e.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup)
- }, n.prototype.GetLinearVelocity = function(t, e, i, n) {
- if (t && this.IsRigidGroup(t)) return t.GetLinearVelocityFromWorldPoint(i, n);
- if (!this.m_velocityBuffer.data) throw new Error;
- return n.Copy(this.m_velocityBuffer.data[e])
- }, n.prototype.InitDampingParameter = function(t, e, i, n, r, s, o, a) {
- t[0] = n > 0 ? 1 / n : 0, e[0] = r > 0 ? 1 / r : 0, i[0] = P.CrossVV(P.SubVV(o, s, P.s_t0), a)
- }, n.prototype.InitDampingParameterWithRigidGroupOrParticle = function(e, i, n, r, s, o, a, l) {
- if (s && r) this.InitDampingParameter(e, i, n, s.GetMass(), s.GetInertia(), s.GetCenter(), a, l);
- else {
- if (!this.m_flagsBuffer.data) throw new Error;
- var h = this.m_flagsBuffer.data[o];
- this.InitDampingParameter(e, i, n, h & t.b2ParticleFlag.b2_wallParticle ? 0 : this.GetParticleMass(), 0, a, a, l)
- }
- }, n.prototype.ComputeDampingImpulse = function(t, e, i, n, r, s, o) {
- var a = t + e * i * i + n + r * s * s;
- return a > 0 ? o / a : 0
- }, n.prototype.ApplyDamping = function(t, e, i, n, r, s, o, a) {
- if (r && n) r.m_linearVelocity.SelfMulAdd(o * t, a), r.m_angularVelocity += o * i * e;
- else {
- if (!this.m_velocityBuffer.data) throw new Error;
- this.m_velocityBuffer.data[s].SelfMulAdd(o * t, a)
- }
- }, n.xTruncBits = 12, n.yTruncBits = 12, n.tagBits = 32, n.yOffset = 1 << n.yTruncBits - 1, n.yShift = n.tagBits - n.yTruncBits, n.xShift = n.tagBits - n.yTruncBits - n.xTruncBits, n.xScale = 1 << n.xShift, n.xOffset = n.xScale * (1 << n.xTruncBits - 1), n.yMask = (1 << n.yTruncBits) - 1 << n.yShift, n.xMask = ~n.yMask, n.DestroyParticlesInShape_s_aabb = new wt, n.CreateParticleGroup_s_transform = new V, n.ComputeCollisionEnergy_s_v = new P, n.QueryShapeAABB_s_aabb = new wt, n.QueryPointAABB_s_aabb = new wt, n.RayCast_s_aabb = new wt, n.RayCast_s_p = new P, n.RayCast_s_v = new P, n.RayCast_s_n = new P, n.RayCast_s_point = new P, n.k_pairFlags = t.b2ParticleFlag.b2_springParticle, n.k_triadFlags = t.b2ParticleFlag.b2_elasticParticle, n.k_noPressureFlags = t.b2ParticleFlag.b2_powderParticle | t.b2ParticleFlag.b2_tensileParticle, n.k_extraDampingFlags = t.b2ParticleFlag.b2_staticPressureParticle, n.k_barrierWallFlags = t.b2ParticleFlag.b2_barrierParticle | t.b2ParticleFlag.b2_wallParticle, n.CreateParticlesStrokeShapeForGroup_s_edge = new ii, n.CreateParticlesStrokeShapeForGroup_s_d = new P, n.CreateParticlesStrokeShapeForGroup_s_p = new P, n.CreateParticlesFillShapeForGroup_s_aabb = new wt, n.CreateParticlesFillShapeForGroup_s_p = new P, n.UpdatePairsAndTriads_s_dab = new P, n.UpdatePairsAndTriads_s_dbc = new P, n.UpdatePairsAndTriads_s_dca = new P, n.AddContact_s_d = new P, n.UpdateBodyContacts_s_aabb = new wt, n.Solve_s_subStep = new on, n.SolveCollision_s_aabb = new wt, n.SolveGravity_s_gravity = new P, n.SolveBarrier_s_aabb = new wt, n.SolveBarrier_s_va = new P, n.SolveBarrier_s_vb = new P, n.SolveBarrier_s_pba = new P, n.SolveBarrier_s_vba = new P, n.SolveBarrier_s_vc = new P, n.SolveBarrier_s_pca = new P, n.SolveBarrier_s_vca = new P, n.SolveBarrier_s_qba = new P, n.SolveBarrier_s_qca = new P, n.SolveBarrier_s_dv = new P, n.SolveBarrier_s_f = new P, n.SolvePressure_s_f = new P, n.SolveDamping_s_v = new P, n.SolveDamping_s_f = new P, n.SolveRigidDamping_s_t0 = new P, n.SolveRigidDamping_s_t1 = new P, n.SolveRigidDamping_s_p = new P, n.SolveRigidDamping_s_v = new P, n.SolveExtraDamping_s_v = new P, n.SolveExtraDamping_s_f = new P, n.SolveRigid_s_position = new P, n.SolveRigid_s_rotation = new N, n.SolveRigid_s_transform = new V, n.SolveRigid_s_velocityTransform = new V, n.SolveElastic_s_pa = new P, n.SolveElastic_s_pb = new P, n.SolveElastic_s_pc = new P, n.SolveElastic_s_r = new N, n.SolveElastic_s_t0 = new P, n.SolveSpring_s_pa = new P, n.SolveSpring_s_pb = new P, n.SolveSpring_s_d = new P, n.SolveSpring_s_f = new P, n.SolveTensile_s_weightedNormal = new P, n.SolveTensile_s_s = new P, n.SolveTensile_s_f = new P, n.SolveViscous_s_v = new P, n.SolveViscous_s_f = new P, n.SolveRepulsive_s_f = new P, n.SolvePowder_s_f = new P, n.SolveSolid_s_f = new P, n.RemoveSpuriousBodyContacts_s_n = new P, n.RemoveSpuriousBodyContacts_s_pos = new P, n.RemoveSpuriousBodyContacts_s_normal = new P, n
- })(), (function(e) {
- var n = (function() {
- return function() {
- this.data = null, this.userSuppliedCapacity = 0
- }
- })();
- e.UserOverridableBuffer = n;
- var r = (function() {
- function t() {
- this.index = u, this.tag = 0
- }
- return t.CompareProxyProxy = function(t, e) {
- return t.tag < e.tag
- }, t.CompareTagProxy = function(t, e) {
- return t < e.tag
- }, t.CompareProxyTag = function(t, e) {
- return t.tag < e
- }, t
- })();
- e.Proxy = r;
- var s = (function() {
- function t(t, i, n, r, s) {
- this.m_system = t, this.m_xLower = (i & e.xMask) >>> 0, this.m_xUpper = (n & e.xMask) >>> 0, this.m_yLower = (i & e.yMask) >>> 0, this.m_yUpper = (n & e.yMask) >>> 0, this.m_first = r, this.m_last = s
- }
- return t.prototype.GetNext = function() {
- for (; this.m_first < this.m_last;) {
- var t = (this.m_system.m_proxyBuffer.data[this.m_first].tag & e.xMask) >>> 0;
- if (t >= this.m_xLower && t <= this.m_xUpper) return this.m_system.m_proxyBuffer.data[this.m_first++].index;
- this.m_first++
- }
- return u
- }, t
- })();
- e.InsideBoundsEnumerator = s;
- var o = (function() {
- return function() {
- this.next = null, this.count = 0, this.index = 0
- }
- })();
- e.ParticleListNode = o;
- var a = (function() {
- function t() {}
- return t.prototype.Allocate = function(t, e) {
- return e
- }, t.prototype.Clear = function() {}, t.prototype.GetCount = function() {
- return 0
- }, t.prototype.Invalidate = function(t) {}, t.prototype.GetValidBuffer = function() {
- return []
- }, t.prototype.GetBuffer = function() {
- return []
- }, t.prototype.SetCount = function(t) {}, t
- })();
- e.FixedSetAllocator = a;
- var h = (function() {
- return function(t, e) {
- this.second = u, this.first = t, this.second = e
- }
- })();
- e.FixtureParticle = h;
- var c = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return $e(e, t), e.prototype.Initialize = function(t, e) {}, e.prototype.Find = function(t) {
- return u
- }, e
- })(e.FixedSetAllocator);
- e.FixtureParticleSet = c;
- var _ = (function() {
- return function(t, e) {
- this.first = u, this.second = u, this.first = t, this.second = e
- }
- })();
- e.ParticlePair = _;
- var f = (function(t) {
- function e() {
- return null !== t && t.apply(this, arguments) || this
- }
- return $e(e, t), e.prototype.Initialize = function(t, e) {}, e.prototype.Find = function(t) {
- return u
- }, e
- })(e.FixedSetAllocator);
- e.b2ParticlePairSet = f;
- var d = (function() {
- function t() {}
- return t.prototype.IsNecessary = function(t) {
- return !0
- }, t.prototype.ShouldCreatePair = function(t, e) {
- return !0
- }, t.prototype.ShouldCreateTriad = function(t, e, i) {
- return !0
- }, t
- })();
- e.ConnectionFilter = d;
- var p = (function(t) {
- function e(e, i, n, r) {
- var s = t.call(this) || this;
- return s.m_callDestructionListener = !1, s.m_destroyed = 0, s.m_system = e, s.m_shape = i, s.m_xf = n, s.m_callDestructionListener = r, s.m_destroyed = 0, s
- }
- return $e(e, t), e.prototype.ReportFixture = function(t) {
- return !1
- }, e.prototype.ReportParticle = function(t, e) {
- if (t !== this.m_system) return !1;
- if (!this.m_system.m_positionBuffer.data) throw new Error;
- return this.m_shape.TestPoint(this.m_xf, this.m_system.m_positionBuffer.data[e]) && (this.m_system.DestroyParticle(e, this.m_callDestructionListener), this.m_destroyed++), !0
- }, e.prototype.Destroyed = function() {
- return this.m_destroyed
- }, e
- })(en);
- e.DestroyParticlesInShapeCallback = p;
- var m = (function(t) {
- function e(e) {
- var i = t.call(this) || this;
- return i.m_threshold = 0, i.m_threshold = e, i
- }
- return $e(e, t), e.prototype.ShouldCreatePair = function(t, e) {
- return t < this.m_threshold && this.m_threshold <= e || e < this.m_threshold && this.m_threshold <= t
- }, e.prototype.ShouldCreateTriad = function(t, e, i) {
- return (t < this.m_threshold || e < this.m_threshold || i < this.m_threshold) && (this.m_threshold <= t || this.m_threshold <= e || this.m_threshold <= i)
- }, e
- })(e.ConnectionFilter);
- e.JoinParticleGroupsFilter = m;
- var y = (function(e) {
- function n(i, n) {
- void 0 === n && (n = i.length);
- var r = e.call(this, t.b2ShapeType.e_unknown, 0) || this;
- return r.m_shapeCount = 0, r.m_shapes = i, r.m_shapeCount = n, r
- }
- return $e(n, e), n.prototype.Clone = function() {
- throw new Error
- }, n.prototype.GetChildCount = function() {
- return 1
- }, n.prototype.TestPoint = function(t, e) {
- for (var i = 0; i < this.m_shapeCount; i++)
- if (this.m_shapes[i].TestPoint(t, e)) return !0;
- return !1
- }, n.prototype.ComputeDistance = function(t, e, i, n) {
- return 0
- }, n.prototype.RayCast = function(t, e, i, n) {
- return !1
- }, n.prototype.ComputeAABB = function(t, e, n) {
- var r = new wt;
- t.lowerBound.x = +i, t.lowerBound.y = +i, t.upperBound.x = -i, t.upperBound.y = -i;
- for (var s = 0; s < this.m_shapeCount; s++)
- for (var o = this.m_shapes[s].GetChildCount(), a = 0; a < o; a++) {
- var l = r;
- this.m_shapes[s].ComputeAABB(l, e, a), t.Combine1(l)
- }
- }, n.prototype.ComputeMass = function(t, e) {}, n.prototype.SetupDistanceProxy = function(t, e) {}, n.prototype.ComputeSubmergedArea = function(t, e, i, n) {
- return 0
- }, n.prototype.Dump = function(t) {}, n
- })(Ke);
- e.CompositeShape = y;
- var v = (function(e) {
- function i(t) {
- var i = e.call(this) || this;
- return i.m_flagsBuffer = t, i
- }
- return $e(i, e), i.prototype.IsNecessary = function(e) {
- if (!this.m_flagsBuffer.data) throw new Error;
- return 0 != (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_reactiveParticle)
- }, i
- })(e.ConnectionFilter);
- e.ReactiveFilter = v;
- var g = (function(i) {
- function n(t, e) {
- var n = i.call(this, t) || this;
- return n.m_contactFilter = e, n
- }
- return $e(n, i), n.prototype.ShouldCollideFixtureParticle = function(e, i, n) {
- if (this.m_contactFilter && this.m_system.GetFlagsBuffer()[n] & t.b2ParticleFlag.b2_fixtureContactFilterParticle) return this.m_contactFilter.ShouldCollideFixtureParticle(e, this.m_system, n);
- return !0
- }, n.prototype.ReportFixtureAndParticle = function(i, n, r) {
- var s = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_n,
- o = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_rp;
- if (!this.m_system.m_flagsBuffer.data) throw new Error;
- if (!this.m_system.m_positionBuffer.data) throw new Error;
- var a = this.m_system.m_positionBuffer.data[r],
- l = s,
- h = i.ComputeDistance(a, l, n);
- if (h < this.m_system.m_particleDiameter && this.ShouldCollideFixtureParticle(i, this.m_system, r)) {
- var c = i.GetBody(),
- u = c.GetWorldCenter(),
- _ = c.GetMass(),
- f = c.GetInertia() - _ * c.GetLocalCenter().LengthSquared(),
- d = _ > 0 ? 1 / _ : 0,
- p = f > 0 ? 1 / f : 0,
- m = this.m_system.m_flagsBuffer.data[r] & t.b2ParticleFlag.b2_wallParticle ? 0 : this.m_system.GetParticleInvMass(),
- y = P.SubVV(a, u, o),
- v = P.CrossVV(y, l),
- g = m + d + p * v * v,
- x = this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];
- x.index = r, x.body = c, x.fixture = i, x.weight = 1 - h * this.m_system.m_inverseDiameter, x.normal.Copy(l.SelfNeg()), x.mass = g > 0 ? 1 / g : 0, this.m_system.DetectStuckParticle(r)
- }
- }, n.ReportFixtureAndParticle_s_n = new P, n.ReportFixtureAndParticle_s_rp = new P, n
- })(On);
- e.UpdateBodyContactsCallback = g;
- var x = (function(i) {
- function n(t, e) {
- var n = i.call(this, t) || this;
- return n.m_step = e, n
- }
- return $e(n, i), n.prototype.ReportFixtureAndParticle = function(i, n, r) {
- var s = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1,
- o = e.SolveCollisionCallback.ReportFixtureAndParticle_s_output,
- a = e.SolveCollisionCallback.ReportFixtureAndParticle_s_input,
- h = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p,
- c = e.SolveCollisionCallback.ReportFixtureAndParticle_s_v,
- u = e.SolveCollisionCallback.ReportFixtureAndParticle_s_f,
- _ = i.GetBody();
- if (!this.m_system.m_positionBuffer.data) throw new Error;
- if (!this.m_system.m_velocityBuffer.data) throw new Error;
- var f = this.m_system.m_positionBuffer.data[r],
- d = this.m_system.m_velocityBuffer.data[r],
- p = o,
- m = a;
- if (0 === this.m_system.m_iterationIndex) {
- var y = V.MulTXV(_.m_xf0, f, s);
- i.GetShape().GetType() === t.b2ShapeType.e_circleShape && (y.SelfSub(_.GetLocalCenter()), N.MulRV(_.m_xf0.q, y, y), N.MulTRV(_.m_xf.q, y, y), y.SelfAdd(_.GetLocalCenter())), V.MulXV(_.m_xf, y, m.p1)
- } else m.p1.Copy(f);
- if (P.AddVMulSV(f, this.m_step.dt, d, m.p2), m.maxFraction = 1, i.RayCast(p, m, n)) {
- var v = p.normal,
- g = h;
- g.x = (1 - p.fraction) * m.p1.x + p.fraction * m.p2.x + l * v.x, g.y = (1 - p.fraction) * m.p1.y + p.fraction * m.p2.y + l * v.y;
- var x = c;
- x.x = this.m_step.inv_dt * (g.x - f.x), x.y = this.m_step.inv_dt * (g.y - f.y), this.m_system.m_velocityBuffer.data[r].Copy(x);
- var b = u;
- b.x = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.x - x.x), b.y = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.y - x.y), this.m_system.ParticleApplyForce(r, b)
- }
- }, n.prototype.ReportParticle = function(t, e) {
- return !1
- }, n.ReportFixtureAndParticle_s_p1 = new P, n.ReportFixtureAndParticle_s_output = new St, n.ReportFixtureAndParticle_s_input = new Tt, n.ReportFixtureAndParticle_s_p = new P, n.ReportFixtureAndParticle_s_v = new P, n.ReportFixtureAndParticle_s_f = new P, n
- })(On);
- e.SolveCollisionCallback = x
- })(t.b2ParticleSystem || (t.b2ParticleSystem = {}));
- var Gn = (function() {
- function e(t) {
- this.m_newFixture = !1, this.m_locked = !1, this.m_clearForces = !0, this.m_contactManager = new rn, this.m_bodyList = null, this.m_jointList = null, this.m_particleSystemList = null, this.m_bodyCount = 0, this.m_jointCount = 0, this.m_gravity = new P, this.m_allowSleep = !0, this.m_destructionListener = null, this.m_debugDraw = null, this.m_inv_dt0 = 0, this.m_warmStarting = !0, this.m_continuousPhysics = !0, this.m_subStepping = !1, this.m_stepComplete = !0, this.m_profile = new sn, this.m_island = new mn, this.s_stack = [], this.m_controllerList = null, this.m_controllerCount = 0, this.m_gravity.Copy(t)
- }
- return e.prototype.SetDestructionListener = function(t) {
- this.m_destructionListener = t
- }, e.prototype.SetContactFilter = function(t) {
- this.m_contactManager.m_contactFilter = t
- }, e.prototype.SetContactListener = function(t) {
- this.m_contactManager.m_contactListener = t
- }, e.prototype.SetDebugDraw = function(t) {
- this.m_debugDraw = t
- }, e.prototype.CreateBody = function(t) {
- if (void 0 === t && (t = {}), this.IsLocked()) throw new Error;
- var e = new hi(t, this);
- return e.m_prev = null, e.m_next = this.m_bodyList, this.m_bodyList && (this.m_bodyList.m_prev = e), this.m_bodyList = e, ++this.m_bodyCount, e
- }, e.prototype.DestroyBody = function(t) {
- if (this.IsLocked()) throw new Error;
- for (var e = t.m_jointList; e;) {
- var i = e;
- e = e.next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeJoint(i.joint), this.DestroyJoint(i.joint), t.m_jointList = e
- }
- t.m_jointList = null;
- for (var n = t.m_controllerList; n;) {
- var r = n;
- n = n.nextController, r.controller.RemoveBody(t)
- }
- for (var s = t.m_contactList; s;) {
- var o = s;
- s = s.next, this.m_contactManager.Destroy(o.contact)
- }
- t.m_contactList = null;
- for (var a = t.m_fixtureList; a;) {
- var l = a;
- a = a.m_next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(l), l.DestroyProxies(), l.Destroy(), t.m_fixtureList = a, t.m_fixtureCount -= 1
- }
- t.m_fixtureList = null, t.m_fixtureCount = 0, t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_bodyList && (this.m_bodyList = t.m_next), --this.m_bodyCount
- }, e._Joint_Create = function(e, i) {
- switch (e.type) {
- case t.b2JointType.e_distanceJoint:
- return new pi(e);
- case t.b2JointType.e_mouseJoint:
- return new Si(e);
- case t.b2JointType.e_prismaticJoint:
- return new Ei(e);
- case t.b2JointType.e_revoluteJoint:
- return new Ii(e);
- case t.b2JointType.e_pulleyJoint:
- return new Di(e);
- case t.b2JointType.e_gearJoint:
- return new bi(e);
- case t.b2JointType.e_wheelJoint:
- return new Ni(e);
- case t.b2JointType.e_weldJoint:
- return new Li(e);
- case t.b2JointType.e_frictionJoint:
- return new gi(e);
- case t.b2JointType.e_ropeJoint:
- return new Ri(e);
- case t.b2JointType.e_motorJoint:
- return new Ci(e);
- case t.b2JointType.e_areaJoint:
- return new yi(e)
- }
- throw new Error
- }, e._Joint_Destroy = function(t, e) {}, e.prototype.CreateJoint = function(t) {
- if (this.IsLocked()) throw new Error;
- var i = e._Joint_Create(t, null);
- i.m_prev = null, i.m_next = this.m_jointList, this.m_jointList && (this.m_jointList.m_prev = i), this.m_jointList = i, ++this.m_jointCount, i.m_edgeA.prev = null, i.m_edgeA.next = i.m_bodyA.m_jointList, i.m_bodyA.m_jointList && (i.m_bodyA.m_jointList.prev = i.m_edgeA), i.m_bodyA.m_jointList = i.m_edgeA, i.m_edgeB.prev = null, i.m_edgeB.next = i.m_bodyB.m_jointList, i.m_bodyB.m_jointList && (i.m_bodyB.m_jointList.prev = i.m_edgeB), i.m_bodyB.m_jointList = i.m_edgeB;
- var n = t.bodyA,
- r = t.bodyB;
- if (!t.collideConnected)
- for (var s = r.GetContactList(); s;) s.other === n && s.contact.FlagForFiltering(), s = s.next;
- return i
- }, e.prototype.DestroyJoint = function(t) {
- if (this.IsLocked()) throw new Error;
- var i = t.m_collideConnected;
- t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_jointList && (this.m_jointList = t.m_next);
- var n = t.m_bodyA,
- r = t.m_bodyB;
- if (n.SetAwake(!0), r.SetAwake(!0), t.m_edgeA.prev && (t.m_edgeA.prev.next = t.m_edgeA.next), t.m_edgeA.next && (t.m_edgeA.next.prev = t.m_edgeA.prev), t.m_edgeA === n.m_jointList && (n.m_jointList = t.m_edgeA.next), t.m_edgeA.prev = null, t.m_edgeA.next = null, t.m_edgeB.prev && (t.m_edgeB.prev.next = t.m_edgeB.next), t.m_edgeB.next && (t.m_edgeB.next.prev = t.m_edgeB.prev), t.m_edgeB === r.m_jointList && (r.m_jointList = t.m_edgeB.next), t.m_edgeB.prev = null, t.m_edgeB.next = null, e._Joint_Destroy(t, null), --this.m_jointCount, !i)
- for (var s = r.GetContactList(); s;) s.other === n && s.contact.FlagForFiltering(), s = s.next
- }, e.prototype.CreateParticleSystem = function(e) {
- if (this.IsLocked()) throw new Error;
- var i = new t.b2ParticleSystem(e, this);
- return i.m_prev = null, i.m_next = this.m_particleSystemList, this.m_particleSystemList && (this.m_particleSystemList.m_prev = i), this.m_particleSystemList = i, i
- }, e.prototype.DestroyParticleSystem = function(t) {
- if (this.IsLocked()) throw new Error;
- t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_particleSystemList && (this.m_particleSystemList = t.m_next)
- }, e.prototype.CalculateReasonableParticleIterations = function(t) {
- if (null === this.m_particleSystemList) return 1;
- return vn(this.m_gravity.Length(), (function(t) {
- for (var e = i, n = t.GetParticleSystemList(); null !== n; n = n.m_next) e = g(e, n.GetRadius());
- return e
- })(this), t)
- }, e.prototype.Step = function(t, i, n, r) {
- void 0 === r && (r = this.CalculateReasonableParticleIterations(t));
- var s = e.Step_s_stepTimer.Reset();
- this.m_newFixture && (this.m_contactManager.FindNewContacts(), this.m_newFixture = !1), this.m_locked = !0;
- var o = e.Step_s_step;
- o.dt = t, o.velocityIterations = i, o.positionIterations = n, o.particleIterations = r, o.inv_dt = t > 0 ? 1 / t : 0, o.dtRatio = this.m_inv_dt0 * t, o.warmStarting = this.m_warmStarting;
- var a = e.Step_s_timer.Reset();
- if (this.m_contactManager.Collide(), this.m_profile.collide = a.GetMilliseconds(), this.m_stepComplete && o.dt > 0) {
- for (var l = e.Step_s_timer.Reset(), h = this.m_particleSystemList; h; h = h.m_next) h.Solve(o);
- this.Solve(o), this.m_profile.solve = l.GetMilliseconds()
- }
- if (this.m_continuousPhysics && o.dt > 0) {
- var c = e.Step_s_timer.Reset();
- this.SolveTOI(o), this.m_profile.solveTOI = c.GetMilliseconds()
- }
- o.dt > 0 && (this.m_inv_dt0 = o.inv_dt), this.m_clearForces && this.ClearForces(), this.m_locked = !1, this.m_profile.step = s.GetMilliseconds()
- }, e.prototype.ClearForces = function() {
- for (var t = this.m_bodyList; t; t = t.m_next) t.m_force.SetZero(), t.m_torque = 0
- }, e.prototype.DrawParticleSystem = function(t) {
- if (null !== this.m_debugDraw) {
- var e = t.GetParticleCount();
- if (e) {
- var i = t.GetRadius(),
- n = t.GetPositionBuffer();
- if (t.m_colorBuffer.data) {
- var r = t.GetColorBuffer();
- this.m_debugDraw.DrawParticles(n, i, r, e)
- } else this.m_debugDraw.DrawParticles(n, i, null, e)
- }
- }
- }, e.prototype.DrawDebugData = function() {
- if (null !== this.m_debugDraw) {
- var i = this.m_debugDraw.GetFlags(),
- n = e.DrawDebugData_s_color.SetRGB(0, 0, 0);
- if (i & t.b2DrawFlags.e_shapeBit)
- for (var r = this.m_bodyList; r; r = r.m_next) {
- var s = r.m_xf;
- this.m_debugDraw.PushTransform(s);
- for (var o = r.GetFixtureList(); o; o = o.m_next) r.IsActive() ? r.GetType() === t.b2BodyType.b2_staticBody ? (n.SetRGB(.5, .9, .5), this.DrawShape(o, n)) : r.GetType() === t.b2BodyType.b2_kinematicBody ? (n.SetRGB(.5, .5, .9), this.DrawShape(o, n)) : r.IsAwake() ? (n.SetRGB(.9, .7, .7), this.DrawShape(o, n)) : (n.SetRGB(.6, .6, .6), this.DrawShape(o, n)) : (n.SetRGB(.5, .5, .3), this.DrawShape(o, n));
- this.m_debugDraw.PopTransform(s)
- }
- if (i & t.b2DrawFlags.e_particleBit)
- for (var a = this.m_particleSystemList; a; a = a.m_next) this.DrawParticleSystem(a);
- if (i & t.b2DrawFlags.e_jointBit)
- for (var l = this.m_jointList; l; l = l.m_next) this.DrawJoint(l);
- if (i & t.b2DrawFlags.e_aabbBit) {
- n.SetRGB(.9, .3, .9);
- var h = e.DrawDebugData_s_vs;
- for (r = this.m_bodyList; r; r = r.m_next)
- if (r.IsActive())
- for (o = r.GetFixtureList(); o; o = o.m_next)
- for (var c = 0; c < o.m_proxyCount; ++c) {
- var u = o.m_proxies[c].treeNode.aabb;
- h[0].Set(u.lowerBound.x, u.lowerBound.y), h[1].Set(u.upperBound.x, u.lowerBound.y), h[2].Set(u.upperBound.x, u.upperBound.y), h[3].Set(u.lowerBound.x, u.upperBound.y), this.m_debugDraw.DrawPolygon(h, 4, n)
- }
- }
- if (i & t.b2DrawFlags.e_centerOfMassBit)
- for (r = this.m_bodyList; r; r = r.m_next) {
- (s = e.DrawDebugData_s_xf).q.Copy(r.m_xf.q), s.p.Copy(r.GetWorldCenter()), this.m_debugDraw.DrawTransform(s)
- }
- if (i & t.b2DrawFlags.e_controllerBit)
- for (var _ = this.m_controllerList; _; _ = _.m_next) _.Draw(this.m_debugDraw)
- }
- }, e.prototype.QueryAABB = function(t, e, i) {
- if (this.m_contactManager.m_broadPhase.Query(e, (function(e) {
- var n = e.userData.fixture;
- return t ? t.ReportFixture(n) : !i || i(n)
- })), t instanceof en)
- for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryAABB(t, e)
- }, e.prototype.QueryAllAABB = function(t, e) {
- return void 0 === e && (e = []), this.QueryAABB(null, t, (function(t) {
- return e.push(t), !0
- })), e
- }, e.prototype.QueryPointAABB = function(t, e, i) {
- if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(e) {
- var n = e.userData.fixture;
- return t ? t.ReportFixture(n) : !i || i(n)
- })), t instanceof en)
- for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e)
- }, e.prototype.QueryAllPointAABB = function(t, e) {
- return void 0 === e && (e = []), this.QueryPointAABB(null, t, (function(t) {
- return e.push(t), !0
- })), e
- }, e.prototype.QueryFixtureShape = function(t, i, n, r, s) {
- var o = e.QueryFixtureShape_s_aabb;
- if (i.ComputeAABB(o, r, n), this.m_contactManager.m_broadPhase.Query(o, (function(e) {
- var o = e.userData,
- a = o.fixture;
- if (Pt(i, n, a.GetShape(), o.childIndex, r, a.GetBody().GetTransform())) {
- if (t) return t.ReportFixture(a);
- if (s) return s(a)
- }
- return !0
- })), t instanceof en)
- for (var a = this.m_particleSystemList; a; a = a.m_next) t.ShouldQueryParticleSystem(a) && a.QueryAABB(t, o)
- }, e.prototype.QueryAllFixtureShape = function(t, e, i, n) {
- return void 0 === n && (n = []), this.QueryFixtureShape(null, t, e, i, (function(t) {
- return n.push(t), !0
- })), n
- }, e.prototype.QueryFixturePoint = function(t, e, i) {
- if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(n) {
- var r = n.userData.fixture;
- if (r.TestPoint(e)) {
- if (t) return t.ReportFixture(r);
- if (i) return i(r)
- }
- return !0
- })), t)
- for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e)
- }, e.prototype.QueryAllFixturePoint = function(t, e) {
- return void 0 === e && (e = []), this.QueryFixturePoint(null, t, (function(t) {
- return e.push(t), !0
- })), e
- }, e.prototype.RayCast = function(t, i, n, r) {
- var s = e.RayCast_s_input;
- if (s.maxFraction = 1, s.p1.Copy(i), s.p2.Copy(n), this.m_contactManager.m_broadPhase.RayCast(s, (function(s, o) {
- var a = o.userData,
- l = a.fixture,
- h = a.childIndex,
- c = e.RayCast_s_output;
- if (l.RayCast(c, s, h)) {
- var u = c.fraction,
- _ = e.RayCast_s_point;
- if (_.Set((1 - u) * i.x + u * n.x, (1 - u) * i.y + u * n.y), t) return t.ReportFixture(l, _, c.normal, u);
- if (r) return r(l, _, c.normal, u)
- }
- return s.maxFraction
- })), t)
- for (var o = this.m_particleSystemList; o; o = o.m_next) t.ShouldQueryParticleSystem(o) && o.RayCast(t, i, n)
- }, e.prototype.RayCastOne = function(t, e) {
- var i = null,
- n = 1;
- return this.RayCast(null, t, e, (function(t, e, r, s) {
- return s < n && (n = s, i = t), n
- })), i
- }, e.prototype.RayCastAll = function(t, e, i) {
- return void 0 === i && (i = []), this.RayCast(null, t, e, (function(t, e, n, r) {
- return i.push(t), 1
- })), i
- }, e.prototype.GetBodyList = function() {
- return this.m_bodyList
- }, e.prototype.GetJointList = function() {
- return this.m_jointList
- }, e.prototype.GetParticleSystemList = function() {
- return this.m_particleSystemList
- }, e.prototype.GetContactList = function() {
- return this.m_contactManager.m_contactList
- }, e.prototype.SetAllowSleeping = function(t) {
- if (t !== this.m_allowSleep && (this.m_allowSleep = t, !this.m_allowSleep))
- for (var e = this.m_bodyList; e; e = e.m_next) e.SetAwake(!0)
- }, e.prototype.GetAllowSleeping = function() {
- return this.m_allowSleep
- }, e.prototype.SetWarmStarting = function(t) {
- this.m_warmStarting = t
- }, e.prototype.GetWarmStarting = function() {
- return this.m_warmStarting
- }, e.prototype.SetContinuousPhysics = function(t) {
- this.m_continuousPhysics = t
- }, e.prototype.GetContinuousPhysics = function() {
- return this.m_continuousPhysics
- }, e.prototype.SetSubStepping = function(t) {
- this.m_subStepping = t
- }, e.prototype.GetSubStepping = function() {
- return this.m_subStepping
- }, e.prototype.GetProxyCount = function() {
- return this.m_contactManager.m_broadPhase.GetProxyCount()
- }, e.prototype.GetBodyCount = function() {
- return this.m_bodyCount
- }, e.prototype.GetJointCount = function() {
- return this.m_jointCount
- }, e.prototype.GetContactCount = function() {
- return this.m_contactManager.m_contactCount
- }, e.prototype.GetTreeHeight = function() {
- return this.m_contactManager.m_broadPhase.GetTreeHeight()
- }, e.prototype.GetTreeBalance = function() {
- return this.m_contactManager.m_broadPhase.GetTreeBalance()
- }, e.prototype.GetTreeQuality = function() {
- return this.m_contactManager.m_broadPhase.GetTreeQuality()
- }, e.prototype.SetGravity = function(t, e) {
- if (void 0 === e && (e = !0), !P.IsEqualToV(this.m_gravity, t) && (this.m_gravity.Copy(t), e))
- for (var i = this.m_bodyList; i; i = i.m_next) i.SetAwake(!0)
- }, e.prototype.GetGravity = function() {
- return this.m_gravity
- }, e.prototype.IsLocked = function() {
- return this.m_locked
- }, e.prototype.SetAutoClearForces = function(t) {
- this.m_clearForces = t
- }, e.prototype.GetAutoClearForces = function() {
- return this.m_clearForces
- }, e.prototype.ShiftOrigin = function(t) {
- if (this.IsLocked()) throw new Error;
- for (var e = this.m_bodyList; e; e = e.m_next) e.m_xf.p.SelfSub(t), e.m_sweep.c0.SelfSub(t), e.m_sweep.c.SelfSub(t);
- for (var i = this.m_jointList; i; i = i.m_next) i.ShiftOrigin(t);
- this.m_contactManager.m_broadPhase.ShiftOrigin(t)
- }, e.prototype.GetContactManager = function() {
- return this.m_contactManager
- }, e.prototype.GetProfile = function() {
- return this.m_profile
- }, e.prototype.Dump = function(e) {
- if (!this.m_locked) {
- e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n", this.m_gravity.x, this.m_gravity.y), e("this.m_world.SetGravity(g);\n"), e("const bodies: b2Body[] = [];\n"), e("const joints: b2Joint[] = [];\n");
- for (var i = 0, n = this.m_bodyList; n; n = n.m_next) n.m_islandIndex = i, n.Dump(e), ++i;
- i = 0;
- for (var r = this.m_jointList; r; r = r.m_next) r.m_index = i, ++i;
- for (r = this.m_jointList; r; r = r.m_next) r.m_type !== t.b2JointType.e_gearJoint && (e("{\n"), r.Dump(e), e("}\n"));
- for (r = this.m_jointList; r; r = r.m_next) r.m_type === t.b2JointType.e_gearJoint && (e("{\n"), r.Dump(e), e("}\n"))
- }
- }, e.prototype.DrawJoint = function(i) {
- if (null !== this.m_debugDraw) {
- var n = i.GetBodyA(),
- r = i.GetBodyB(),
- s = n.m_xf,
- o = r.m_xf,
- a = s.p,
- l = o.p,
- h = i.GetAnchorA(e.DrawJoint_s_p1),
- c = i.GetAnchorB(e.DrawJoint_s_p2),
- u = e.DrawJoint_s_color.SetRGB(.5, .8, .8);
- switch (i.m_type) {
- case t.b2JointType.e_distanceJoint:
- this.m_debugDraw.DrawSegment(h, c, u);
- break;
- case t.b2JointType.e_pulleyJoint:
- var _ = i,
- f = _.GetGroundAnchorA(),
- d = _.GetGroundAnchorB();
- this.m_debugDraw.DrawSegment(f, h, u), this.m_debugDraw.DrawSegment(d, c, u), this.m_debugDraw.DrawSegment(f, d, u);
- break;
- case t.b2JointType.e_mouseJoint:
- var p = e.DrawJoint_s_c;
- p.Set(0, 1, 0), this.m_debugDraw.DrawPoint(h, 4, p), this.m_debugDraw.DrawPoint(c, 4, p), p.Set(.8, .8, .8), this.m_debugDraw.DrawSegment(h, c, p);
- break;
- default:
- this.m_debugDraw.DrawSegment(a, h, u), this.m_debugDraw.DrawSegment(h, c, u), this.m_debugDraw.DrawSegment(l, c, u)
- }
- }
- }, e.prototype.DrawShape = function(i, n) {
- if (null !== this.m_debugDraw) {
- var r = i.GetShape();
- switch (r.m_type) {
- case t.b2ShapeType.e_circleShape:
- var s = r,
- o = s.m_p,
- a = s.m_radius,
- l = P.UNITX;
- this.m_debugDraw.DrawSolidCircle(o, a, l, n);
- break;
- case t.b2ShapeType.e_edgeShape:
- var h = r,
- c = h.m_vertex1,
- u = h.m_vertex2;
- this.m_debugDraw.DrawSegment(c, u, n);
- break;
- case t.b2ShapeType.e_chainShape:
- var _ = r,
- f = _.m_count,
- d = _.m_vertices,
- p = e.DrawShape_s_ghostColor.SetRGBA(.75 * n.r, .75 * n.g, .75 * n.b, n.a);
- c = d[0];
- if (this.m_debugDraw.DrawPoint(c, 4, n), _.m_hasPrevVertex) {
- var m = _.m_prevVertex;
- this.m_debugDraw.DrawSegment(m, c, p), this.m_debugDraw.DrawCircle(m, .1, p)
- }
- for (var y = 1; y < f; ++y) {
- u = d[y];
- this.m_debugDraw.DrawSegment(c, u, n), this.m_debugDraw.DrawPoint(u, 4, n), c = u
- }
- if (_.m_hasNextVertex) {
- var v = _.m_nextVertex;
- this.m_debugDraw.DrawSegment(v, c, p), this.m_debugDraw.DrawCircle(v, .1, p)
- }
- break;
- case t.b2ShapeType.e_polygonShape:
- var g = r,
- x = g.m_count;
- d = g.m_vertices;
- this.m_debugDraw.DrawSolidPolygon(d, x, n)
- }
- }
- }, e.prototype.Solve = function(e) {
- for (var i = this.m_bodyList; i; i = i.m_next) i.m_xf0.Copy(i.m_xf);
- for (var n = this.m_controllerList; n; n = n.m_next) n.Step(e);
- this.m_profile.solveInit = 0, this.m_profile.solveVelocity = 0, this.m_profile.solvePosition = 0;
- var r = this.m_island;
- r.Initialize(this.m_bodyCount, this.m_contactManager.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener);
- for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag = !1;
- for (var s = this.m_contactManager.m_contactList; s; s = s.m_next) s.m_islandFlag = !1;
- for (var o = this.m_jointList; o; o = o.m_next) o.m_islandFlag = !1;
- for (var a = this.s_stack, l = this.m_bodyList; l; l = l.m_next)
- if (!l.m_islandFlag && l.IsAwake() && l.IsActive() && l.GetType() !== t.b2BodyType.b2_staticBody) {
- r.Clear();
- var h = 0;
- for (a[h++] = l, l.m_islandFlag = !0; h > 0;) {
- if (!(i = a[--h])) throw new Error;
- if (r.AddBody(i), i.m_awakeFlag = !0, i.GetType() !== t.b2BodyType.b2_staticBody) {
- for (var c = i.m_contactList; c; c = c.next) {
- var u = c.contact;
- if (!u.m_islandFlag && (u.IsEnabled() && u.IsTouching())) {
- var _ = u.m_fixtureA.m_isSensor,
- f = u.m_fixtureB.m_isSensor;
- if (!_ && !f) {
- if (r.AddContact(u), u.m_islandFlag = !0, !(p = c.other)) throw new Error;
- p.m_islandFlag || (a[h++] = p, p.m_islandFlag = !0)
- }
- }
- }
- for (var d = i.m_jointList; d; d = d.next) {
- var p;
- if (!d.joint.m_islandFlag)(p = d.other).IsActive() && (r.AddJoint(d.joint), d.joint.m_islandFlag = !0, p.m_islandFlag || (a[h++] = p, p.m_islandFlag = !0))
- }
- }
- }
- var m = new sn;
- r.Solve(m, e, this.m_gravity, this.m_allowSleep), this.m_profile.solveInit += m.solveInit, this.m_profile.solveVelocity += m.solveVelocity, this.m_profile.solvePosition += m.solvePosition;
- for (var y = 0; y < r.m_bodyCount; ++y) {
- (i = r.m_bodies[y]).GetType() === t.b2BodyType.b2_staticBody && (i.m_islandFlag = !1)
- }
- }
- for (y = 0; y < a.length && a[y]; ++y) a[y] = null;
- var v = new z;
- for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag && i.GetType() !== t.b2BodyType.b2_staticBody && i.SynchronizeFixtures();
- this.m_contactManager.FindNewContacts(), this.m_profile.broadphase = v.GetMilliseconds()
- }, e.prototype.SolveTOI = function(i) {
- var r = this.m_island;
- if (r.Initialize(64, 32, 0, null, this.m_contactManager.m_contactListener), this.m_stepComplete) {
- for (var s = this.m_bodyList; s; s = s.m_next) s.m_islandFlag = !1, s.m_sweep.alpha0 = 0;
- for (var o = this.m_contactManager.m_contactList; o; o = o.m_next) o.m_toiFlag = !1, o.m_islandFlag = !1, o.m_toiCount = 0, o.m_toi = 1
- }
- for (;;) {
- var a = null,
- l = 1;
- for (o = this.m_contactManager.m_contactList; o; o = o.m_next)
- if (o.IsEnabled() && !(o.m_toiCount > 8)) {
- var h = 1;
- if (o.m_toiFlag) h = o.m_toi;
- else {
- var c = o.GetFixtureA(),
- u = o.GetFixtureB();
- if (c.IsSensor() || u.IsSensor()) continue;
- var _ = c.GetBody(),
- f = u.GetBody(),
- d = _.m_type,
- p = f.m_type,
- m = _.IsAwake() && d !== t.b2BodyType.b2_staticBody,
- y = f.IsAwake() && p !== t.b2BodyType.b2_staticBody;
- if (!m && !y) continue;
- var v = _.IsBullet() || d !== t.b2BodyType.b2_dynamicBody,
- x = f.IsBullet() || p !== t.b2BodyType.b2_dynamicBody;
- if (!v && !x) continue;
- var b = _.m_sweep.alpha0;
- _.m_sweep.alpha0 < f.m_sweep.alpha0 ? (b = f.m_sweep.alpha0, _.m_sweep.Advance(b)) : f.m_sweep.alpha0 < _.m_sweep.alpha0 && (b = _.m_sweep.alpha0, f.m_sweep.Advance(b));
- var A = o.GetChildIndexA(),
- C = o.GetChildIndexB(),
- T = e.SolveTOI_s_toi_input;
- T.proxyA.SetShape(c.GetShape(), A), T.proxyB.SetShape(u.GetShape(), C), T.sweepA.Copy(_.m_sweep), T.sweepB.Copy(f.m_sweep), T.tMax = 1;
- var S = e.SolveTOI_s_toi_output;
- re(S, T);
- var w = S.t;
- h = S.state === t.b2TOIOutputState.e_touching ? g(b + (1 - b) * w, 1) : 1, o.m_toi = h, o.m_toiFlag = !0
- }
- h < l && (a = o, l = h)
- }
- if (null === a || 1 - 10 * n < l) {
- this.m_stepComplete = !0;
- break
- }
- var E = a.GetFixtureA(),
- M = a.GetFixtureB(),
- D = E.GetBody(),
- B = M.GetBody(),
- I = e.SolveTOI_s_backup1.Copy(D.m_sweep),
- P = e.SolveTOI_s_backup2.Copy(B.m_sweep);
- if (D.Advance(l), B.Advance(l), a.Update(this.m_contactManager.m_contactListener), a.m_toiFlag = !1, ++a.m_toiCount, a.IsEnabled() && a.IsTouching()) {
- D.SetAwake(!0), B.SetAwake(!0), r.Clear(), r.AddBody(D), r.AddBody(B), r.AddContact(a), D.m_islandFlag = !0, B.m_islandFlag = !0, a.m_islandFlag = !0;
- for (var R = 0; R < 2; ++R) {
- if ((U = 0 === R ? D : B).m_type === t.b2BodyType.b2_dynamicBody)
- for (var O = U.m_contactList; O && r.m_bodyCount !== r.m_bodyCapacity && r.m_contactCount !== r.m_contactCapacity; O = O.next) {
- var L = O.contact;
- if (!L.m_islandFlag) {
- var F = O.other;
- if (F.m_type !== t.b2BodyType.b2_dynamicBody || U.IsBullet() || F.IsBullet()) {
- var N = L.m_fixtureA.m_isSensor,
- V = L.m_fixtureB.m_isSensor;
- if (!N && !V) {
- var k = e.SolveTOI_s_backup.Copy(F.m_sweep);
- F.m_islandFlag || F.Advance(l), L.Update(this.m_contactManager.m_contactListener), L.IsEnabled() && L.IsTouching() ? (L.m_islandFlag = !0, r.AddContact(L), F.m_islandFlag || (F.m_islandFlag = !0, F.m_type !== t.b2BodyType.b2_staticBody && F.SetAwake(!0), r.AddBody(F))) : (F.m_sweep.Copy(k), F.SynchronizeTransform())
- }
- }
- }
- }
- }
- var G = e.SolveTOI_s_subStep;
- G.dt = (1 - l) * i.dt, G.inv_dt = 1 / G.dt, G.dtRatio = 1, G.positionIterations = 20, G.velocityIterations = i.velocityIterations, G.particleIterations = i.particleIterations, G.warmStarting = !1, r.SolveTOI(G, D.m_islandIndex, B.m_islandIndex);
- for (R = 0; R < r.m_bodyCount; ++R) {
- var U;
- if ((U = r.m_bodies[R]).m_islandFlag = !1, U.m_type === t.b2BodyType.b2_dynamicBody) {
- U.SynchronizeFixtures();
- for (O = U.m_contactList; O; O = O.next) O.contact.m_toiFlag = !1, O.contact.m_islandFlag = !1
- }
- }
- if (this.m_contactManager.FindNewContacts(), this.m_subStepping) {
- this.m_stepComplete = !1;
- break
- }
- } else a.SetEnabled(!1), D.m_sweep.Copy(I), B.m_sweep.Copy(P), D.SynchronizeTransform(), B.SynchronizeTransform()
- }
- }, e.prototype.AddController = function(t) {
- return t.m_next = this.m_controllerList, t.m_prev = null, this.m_controllerList && (this.m_controllerList.m_prev = t), this.m_controllerList = t, ++this.m_controllerCount, t
- }, e.prototype.RemoveController = function(t) {
- return t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), this.m_controllerList === t && (this.m_controllerList = t.m_next), --this.m_controllerCount, t.m_prev = null, t.m_next = null, t
- }, e.Step_s_step = new on, e.Step_s_stepTimer = new z, e.Step_s_timer = new z, e.DrawDebugData_s_color = new G(0, 0, 0), e.DrawDebugData_s_vs = P.MakeArray(4), e.DrawDebugData_s_xf = new V, e.QueryFixtureShape_s_aabb = new wt, e.RayCast_s_input = new Tt, e.RayCast_s_output = new St, e.RayCast_s_point = new P, e.DrawJoint_s_p1 = new P, e.DrawJoint_s_p2 = new P, e.DrawJoint_s_color = new G(.5, .8, .8), e.DrawJoint_s_c = new G, e.DrawShape_s_ghostColor = new G, e.SolveTOI_s_subStep = new on, e.SolveTOI_s_backup = new k, e.SolveTOI_s_backup1 = new k, e.SolveTOI_s_backup2 = new k, e.SolveTOI_s_toi_input = new Xt, e.SolveTOI_s_toi_output = new Yt, e
- })(),
- Un = (function() {
- return function(t, e) {
- this.prevBody = null, this.nextBody = null, this.prevController = null, this.nextController = null, this.controller = t, this.body = e
- }
- })(),
- zn = (function() {
- function t() {
- this.m_bodyList = null, this.m_bodyCount = 0, this.m_prev = null, this.m_next = null
- }
- return t.prototype.GetNext = function() {
- return this.m_next
- }, t.prototype.GetPrev = function() {
- return this.m_prev
- }, t.prototype.GetBodyList = function() {
- return this.m_bodyList
- }, t.prototype.AddBody = function(t) {
- var e = new Un(this, t);
- e.nextBody = this.m_bodyList, e.prevBody = null, this.m_bodyList && (this.m_bodyList.prevBody = e), this.m_bodyList = e, ++this.m_bodyCount, e.nextController = t.m_controllerList, e.prevController = null, t.m_controllerList && (t.m_controllerList.prevController = e), t.m_controllerList = e, ++t.m_controllerCount
- }, t.prototype.RemoveBody = function(t) {
- if (this.m_bodyCount <= 0) throw new Error;
- for (var e = this.m_bodyList; e && e.body !== t;) e = e.nextBody;
- if (null === e) throw new Error;
- e.prevBody && (e.prevBody.nextBody = e.nextBody), e.nextBody && (e.nextBody.prevBody = e.prevBody), this.m_bodyList === e && (this.m_bodyList = e.nextBody), --this.m_bodyCount, e.nextController && (e.nextController.prevController = e.prevController), e.prevController && (e.prevController.nextController = e.nextController), t.m_controllerList === e && (t.m_controllerList = e.nextController), --t.m_controllerCount
- }, t.prototype.Clear = function() {
- for (; this.m_bodyList;) this.RemoveBody(this.m_bodyList.body);
- this.m_bodyCount = 0
- }, t
- })(),
- jn = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.normal = new P(0, 1), e.offset = 0, e.density = 0, e.velocity = new P(0, 0), e.linearDrag = 0, e.angularDrag = 0, e.useDensity = !1, e.useWorldGravity = !0, e.gravity = new P(0, 0), e
- }
- return $e(e, t), e.prototype.Step = function(t) {
- if (this.m_bodyList) {
- this.useWorldGravity && this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());
- for (var e = this.m_bodyList; e; e = e.nextBody) {
- var i = e.body;
- if (i.IsAwake()) {
- for (var r = new P, s = new P, o = 0, a = 0, l = i.GetFixtureList(); l; l = l.m_next) {
- var h = new P,
- c = l.GetShape().ComputeSubmergedArea(this.normal, this.offset, i.GetTransform(), h);
- o += c, r.x += c * h.x, r.y += c * h.y;
- var u = 0;
- a += c * (u = this.useDensity ? l.GetDensity() : 1), s.x += c * h.x * u, s.y += c * h.y * u
- }
- if (r.x /= o, r.y /= o, s.x /= a, s.y /= a, !(o < n)) {
- var _ = this.gravity.Clone().SelfNeg();
- _.SelfMul(this.density * o), i.ApplyForce(_, s);
- var f = i.GetLinearVelocityFromWorldPoint(r, new P);
- f.SelfSub(this.velocity), f.SelfMul(-this.linearDrag * o), i.ApplyForce(f, r), i.ApplyTorque(-i.GetInertia() / i.GetMass() * o * i.GetAngularVelocity() * this.angularDrag)
- }
- }
- }
- }
- }, e.prototype.Draw = function(t) {
- var e = 100,
- i = new P,
- n = new P;
- i.x = this.normal.x * this.offset + this.normal.y * e, i.y = this.normal.y * this.offset - this.normal.x * e, n.x = this.normal.x * this.offset - this.normal.y * e, n.y = this.normal.y * this.offset + this.normal.x * e;
- var r = new G(0, 0, .8);
- t.DrawSegment(i, n, r)
- }, e
- })(zn),
- Wn = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.A = new P(0, 0), e
- }
- return $e(e, t), e.prototype.Step = function(t) {
- for (var i = P.MulSV(t.dt, this.A, e.Step_s_dtA), n = this.m_bodyList; n; n = n.nextBody) {
- var r = n.body;
- r.IsAwake() && r.SetLinearVelocity(P.AddVV(r.GetLinearVelocity(), i, P.s_t0))
- }
- }, e.prototype.Draw = function(t) {}, e.Step_s_dtA = new P, e
- })(zn),
- Hn = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.F = new P(0, 0), e
- }
- return $e(e, t), e.prototype.Step = function(t) {
- for (var e = this.m_bodyList; e; e = e.nextBody) {
- var i = e.body;
- i.IsAwake() && i.ApplyForce(this.F, i.GetWorldCenter())
- }
- }, e.prototype.Draw = function(t) {}, e
- })(zn),
- Xn = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.G = 1, e.invSqr = !0, e
- }
- return $e(e, t), e.prototype.Step = function(t) {
- if (this.invSqr)
- for (var i = this.m_bodyList; i; i = i.nextBody)
- for (var r = (h = i.body).GetWorldCenter(), s = h.GetMass(), o = this.m_bodyList; o && o !== i; o = o.nextBody) {
- var a = (c = o.body).GetWorldCenter(),
- l = c.GetMass();
- if (!((f = (u = a.x - r.x) * u + (_ = a.y - r.y) * _) < n))(d = e.Step_s_f.Set(u, _)).SelfMul(this.G / f / S(f) * s * l), h.IsAwake() && h.ApplyForce(d, r), c.IsAwake() && c.ApplyForce(d.SelfMul(-1), a)
- } else
- for (i = this.m_bodyList; i; i = i.nextBody) {
- var h;
- for (r = (h = i.body).GetWorldCenter(), s = h.GetMass(), o = this.m_bodyList; o && o !== i; o = o.nextBody) {
- var c, u, _, f, d;
- a = (c = o.body).GetWorldCenter(), l = c.GetMass();
- if (!((f = (u = a.x - r.x) * u + (_ = a.y - r.y) * _) < n))(d = e.Step_s_f.Set(u, _)).SelfMul(this.G / f * s * l), h.IsAwake() && h.ApplyForce(d, r), c.IsAwake() && c.ApplyForce(d.SelfMul(-1), a)
- }
- }
- }, e.prototype.Draw = function(t) {}, e.Step_s_f = new P, e
- })(zn),
- Yn = (function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.T = new L, e.maxTimestep = 0, e
- }
- return $e(e, t), e.prototype.Step = function(t) {
- var i = t.dt;
- if (!(i <= n)) {
- i > this.maxTimestep && this.maxTimestep > 0 && (i = this.maxTimestep);
- for (var r = this.m_bodyList; r; r = r.nextBody) {
- var s = r.body;
- if (s.IsAwake()) {
- var o = s.GetWorldVector(L.MulMV(this.T, s.GetLocalVector(s.GetLinearVelocity(), P.s_t0), P.s_t1), e.Step_s_damping);
- s.SetLinearVelocity(P.AddVV(s.GetLinearVelocity(), P.MulSV(i, o, P.s_t0), P.s_t1))
- }
- }
- }
- }, e.prototype.Draw = function(t) {}, e.prototype.SetAxisAligned = function(t, e) {
- this.T.ex.x = -t, this.T.ex.y = 0, this.T.ey.x = 0, this.T.ey.y = -e, this.maxTimestep = t > 0 || e > 0 ? 1 / x(t, e) : 0
- }, e.Step_s_damping = new P, e
- })(zn),
- qn = (function() {
- return function() {
- this.vertices = [], this.count = 0, this.masses = [], this.gravity = new P(0, 0), this.damping = .1, this.k2 = .9, this.k3 = .1
- }
- })(),
- Jn = (function() {
- function t() {
- this.m_count = 0, this.m_ps = [], this.m_p0s = [], this.m_vs = [], this.m_ims = [], this.m_Ls = [], this.m_as = [], this.m_gravity = new P, this.m_damping = 0, this.m_k2 = 1, this.m_k3 = .1
- }
- return t.prototype.GetVertexCount = function() {
- return this.m_count
- }, t.prototype.GetVertices = function() {
- return this.m_ps
- }, t.prototype.Initialize = function(t) {
- this.m_count = t.count, this.m_ps = P.MakeArray(this.m_count), this.m_p0s = P.MakeArray(this.m_count), this.m_vs = P.MakeArray(this.m_count), this.m_ims = p(this.m_count);
- for (var e = 0; e < this.m_count; ++e) {
- this.m_ps[e].Copy(t.vertices[e]), this.m_p0s[e].Copy(t.vertices[e]), this.m_vs[e].SetZero();
- var i = t.masses[e];
- this.m_ims[e] = i > 0 ? 1 / i : 0
- }
- var n = this.m_count - 1,
- r = this.m_count - 2;
- this.m_Ls = p(n), this.m_as = p(r);
- for (e = 0; e < n; ++e) {
- var s = this.m_ps[e],
- o = this.m_ps[e + 1];
- this.m_Ls[e] = P.DistanceVV(s, o)
- }
- for (e = 0; e < r; ++e) {
- s = this.m_ps[e], o = this.m_ps[e + 1];
- var a = this.m_ps[e + 2],
- l = P.SubVV(o, s, P.s_t0),
- h = P.SubVV(a, o, P.s_t1),
- c = P.CrossVV(l, h),
- u = P.DotVV(l, h);
- this.m_as[e] = I(c, u)
- }
- this.m_gravity.Copy(t.gravity), this.m_damping = t.damping, this.m_k2 = t.k2, this.m_k3 = t.k3
- }, t.prototype.Step = function(t, e) {
- if (0 !== t) {
- for (var i = Math.exp(-t * this.m_damping), n = 0; n < this.m_count; ++n) this.m_p0s[n].Copy(this.m_ps[n]), this.m_ims[n] > 0 && this.m_vs[n].SelfMulAdd(t, this.m_gravity), this.m_vs[n].SelfMul(i), this.m_ps[n].SelfMulAdd(t, this.m_vs[n]);
- for (n = 0; n < e; ++n) this.SolveC2(), this.SolveC3(), this.SolveC2();
- var r = 1 / t;
- for (n = 0; n < this.m_count; ++n) P.MulSV(r, P.SubVV(this.m_ps[n], this.m_p0s[n], P.s_t0), this.m_vs[n])
- }
- }, t.prototype.SolveC2 = function() {
- for (var e = this.m_count - 1, i = 0; i < e; ++i) {
- var n = this.m_ps[i],
- r = this.m_ps[i + 1],
- s = P.SubVV(r, n, t.s_d),
- o = s.Normalize(),
- a = this.m_ims[i],
- l = this.m_ims[i + 1];
- if (a + l !== 0) {
- var h = a / (a + l),
- c = l / (a + l);
- n.SelfMulSub(this.m_k2 * h * (this.m_Ls[i] - o), s), r.SelfMulAdd(this.m_k2 * c * (this.m_Ls[i] - o), s)
- }
- }
- }, t.prototype.SetAngle = function(t) {
- for (var e = this.m_count - 2, i = 0; i < e; ++i) this.m_as[i] = t
- }, t.prototype.SolveC3 = function() {
- for (var e = this.m_count - 2, i = 0; i < e; ++i) {
- var n = this.m_ps[i],
- r = this.m_ps[i + 1],
- o = this.m_ps[i + 2],
- a = this.m_ims[i],
- l = this.m_ims[i + 1],
- h = this.m_ims[i + 2],
- c = P.SubVV(r, n, t.s_d1),
- u = P.SubVV(o, r, t.s_d2),
- _ = c.LengthSquared(),
- f = u.LengthSquared();
- if (_ * f != 0) {
- var d = P.CrossVV(c, u),
- p = P.DotVV(c, u),
- m = I(d, p),
- y = P.MulSV(-1 / _, c.SelfSkew(), t.s_Jd1),
- v = P.MulSV(1 / f, u.SelfSkew(), t.s_Jd2),
- g = P.NegV(y, t.s_J1),
- x = P.SubVV(y, v, t.s_J2),
- b = v,
- A = a * P.DotVV(g, g) + l * P.DotVV(x, x) + h * P.DotVV(b, b);
- if (0 !== A) {
- A = 1 / A;
- for (var C = m - this.m_as[i]; C > s;) C = (m -= 2 * s) - this.m_as[i];
- for (; C < -s;) C = (m += 2 * s) - this.m_as[i];
- var T = -this.m_k3 * A * C;
- n.SelfMulAdd(a * T, g), r.SelfMulAdd(l * T, x), o.SelfMulAdd(h * T, b)
- }
- }
- }
- }, t.prototype.Draw = function(t) {
- for (var e = new G(.4, .5, .7), i = 0; i < this.m_count - 1; ++i) t.DrawSegment(this.m_ps[i], this.m_ps[i + 1], e)
- }, t.s_d = new P, t.s_d1 = new P, t.s_d2 = new P, t.s_Jd1 = new P, t.s_Jd2 = new P, t.s_J1 = new P, t.s_J2 = new P, t
- })();
- t.b2Assert = function(t) {
- for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
- if (!t) throw new(Error.bind.apply(Error, [void 0].concat(e)))
- }, t.b2Maybe = e, t.b2_maxFloat = i, t.b2_epsilon = n, t.b2_epsilon_sq = r, t.b2_pi = s, t.b2_maxManifoldPoints = o, t.b2_maxPolygonVertices = a, t.b2_aabbExtension = .1, t.b2_aabbMultiplier = 2, t.b2_linearSlop = l, t.b2_angularSlop = h, t.b2_polygonRadius = c, t.b2_maxSubSteps = 8, t.b2_maxTOIContacts = 32, t.b2_velocityThreshold = 1, t.b2_maxLinearCorrection = .2, t.b2_maxAngularCorrection = .13962634015955555, t.b2_maxTranslation = 2, t.b2_maxTranslationSquared = 4, t.b2_maxRotation = 1.570796326795, t.b2_maxRotationSquared = 2.4674011002726646, t.b2_baumgarte = .2, t.b2_toiBaumgarte = .75, t.b2_invalidParticleIndex = u, t.b2_maxParticleIndex = 2147483647, t.b2_particleStride = .75, t.b2_minParticleWeight = 1, t.b2_maxParticlePressure = .25, t.b2_maxParticleForce = .5, t.b2_maxTriadDistance = 2, t.b2_maxTriadDistanceSquared = 4, t.b2_minParticleSystemBufferCapacity = 256, t.b2_barrierCollisionTime = 2.5, t.b2_timeToSleep = .5, t.b2_linearSleepTolerance = .01, t.b2_angularSleepTolerance = .03490658503988889, t.b2Alloc = function(t) {
- return null
- }, t.b2Free = function(t) {}, t.b2Log = function(t) {
- for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i]
- }, t.b2Version = _, t.b2_version = f, t.b2_branch = "master", t.b2_commit = "fbf51801d80fc389d43dc46524520e89043b6faf", t.b2ParseInt = function(t) {
- return parseInt(t, 10)
- }, t.b2ParseUInt = function(t) {
- return Math.abs(parseInt(t, 10))
- }, t.b2MakeArray = d, t.b2MakeNullArray = function(t) {
- for (var e = [], i = 0; i < t; ++i) e.push(null);
- return e
- }, t.b2MakeNumberArray = p, t.b2_pi_over_180 = m, t.b2_180_over_pi = y, t.b2_two_pi = 6.28318530718, t.b2Abs = v, t.b2Min = g, t.b2Max = x, t.b2Clamp = b, t.b2Swap = function(t, e) {
- var i = t[0];
- t[0] = e[0], e[0] = i
- }, t.b2IsValid = A, t.b2Sq = C, t.b2InvSqrt = T, t.b2Sqrt = S, t.b2Pow = w, t.b2DegToRad = function(t) {
- return t * m
- }, t.b2RadToDeg = function(t) {
- return t * y
- }, t.b2Cos = E, t.b2Sin = M, t.b2Acos = D, t.b2Asin = B, t.b2Atan2 = I, t.b2NextPowerOfTwo = function(t) {
- return t |= t >> 1 & 2147483647, t |= t >> 2 & 1073741823, t |= t >> 4 & 268435455, t |= t >> 8 & 16777215, 1 + (t |= t >> 16 & 65535)
- }, t.b2IsPowerOfTwo = function(t) {
- return t > 0 && 0 == (t & t - 1)
- }, t.b2Random = function() {
- return 2 * Math.random() - 1
- }, t.b2RandomRange = function(t, e) {
- return (e - t) * Math.random() + t
- }, t.b2Vec2 = P, t.b2Vec2_zero = R, t.b2Vec3 = O, t.b2Mat22 = L, t.b2Mat33 = F, t.b2Rot = N, t.b2Transform = V, t.b2Sweep = k, t.b2Color = G, t.b2Draw = U, t.b2Timer = z, t.b2Counter = j, t.b2GrowableStack = W, t.b2BlockAllocator = H, t.b2StackAllocator = X, t.b2ContactFeature = vt, t.b2ContactID = gt, t.b2ManifoldPoint = xt, t.b2Manifold = bt, t.b2WorldManifold = At, t.b2GetPointStates = function(e, i, n, r) {
- var s;
- for (s = 0; s < n.pointCount; ++s) {
- var a = n.points[s].id.key;
- e[s] = t.b2PointState.b2_removeState;
- for (var l = 0, h = r.pointCount; l < h; ++l)
- if (r.points[l].id.key === a) {
- e[s] = t.b2PointState.b2_persistState;
- break
- }
- }
- for (; s < o; ++s) e[s] = t.b2PointState.b2_nullState;
- for (s = 0; s < r.pointCount; ++s)
- for (a = r.points[s].id.key, i[s] = t.b2PointState.b2_addState, l = 0, h = n.pointCount; l < h; ++l)
- if (n.points[l].id.key === a) {
- i[s] = t.b2PointState.b2_persistState;
- break
- }
- for (; s < o; ++s) i[s] = t.b2PointState.b2_nullState
- }, t.b2ClipVertex = Ct, t.b2RayCastInput = Tt, t.b2RayCastOutput = St, t.b2AABB = wt, t.b2TestOverlapAABB = Et, t.b2ClipSegmentToLine = Mt, t.b2TestOverlapShape = Pt, t.b2DistanceProxy = Y, t.b2SimplexCache = q, t.b2DistanceInput = J, t.b2DistanceOutput = Z, t.b2ShapeCastInput = K, t.b2ShapeCastOutput = Q, t.b2_gjk_reset = function() {
- t.b2_gjkCalls = 0, t.b2_gjkIters = 0, t.b2_gjkMaxIters = 0
- }, t.b2SimplexVertex = $, t.b2Simplex = tt, t.b2Distance = ht, t.b2ShapeCast = function(t, e) {
- t.iterations = 0, t.lambda = 1, t.normal.SetZero(), t.point.SetZero();
- var i = e.proxyA,
- n = e.proxyB,
- r = x(i.m_radius, c) + x(n.m_radius, c),
- s = e.transformA,
- o = e.transformB,
- a = e.translationB,
- h = ct.Set(0, 0),
- u = 0,
- _ = ut;
- _.m_count = 0;
- for (var f = _.m_vertices, d = i.GetSupport(N.MulTRV(s.q, P.NegV(a, P.s_t1), P.s_t0)), p = V.MulXV(s, i.GetVertex(d), _t), m = n.GetSupport(N.MulTRV(o.q, a, P.s_t0)), y = V.MulXV(o, n.GetVertex(m), ft), g = P.SubVV(p, y, dt), b = x(c, r - c), A = .5 * l, C = 0; C < 20 && v(g.Length() - b) > A;) {
- t.iterations += 1, d = i.GetSupport(N.MulTRV(s.q, P.NegV(g, P.s_t1), P.s_t0)), p = V.MulXV(s, i.GetVertex(d), _t), m = n.GetSupport(N.MulTRV(o.q, g, P.s_t0)), y = V.MulXV(o, n.GetVertex(m), ft);
- var T = P.SubVV(p, y, pt);
- g.Normalize();
- var S = P.DotVV(g, T),
- w = P.DotVV(g, a);
- if (S - b > u * w) {
- if (w <= 0) return !1;
- if ((u = (S - b) / w) > 1) return !1;
- h.Copy(g).SelfNeg(), _.m_count = 0
- }
- var E = f[_.m_count];
- switch (E.indexA = m, E.wA.Copy(y).SelfMulAdd(u, a), E.indexB = d, E.wB.Copy(p), E.w.Copy(E.wB).SelfSub(E.wA), E.a = 1, _.m_count += 1, _.m_count) {
- case 1:
- break;
- case 2:
- _.Solve2();
- break;
- case 3:
- _.Solve3()
- }
- if (3 === _.m_count) return !1;
- _.GetClosestPoint(g), ++C
- }
- var M = mt,
- D = yt;
- return _.GetWitnessPoints(M, D), g.LengthSquared() > 0 && (h.Copy(g).SelfNeg(), h.Normalize()), t.normal.Copy(h), t.lambda = u, t.iterations = C, !0
- }, t.b2Pair = Ft, t.b2BroadPhase = Nt, t.b2PairLessThan = Vt, t.b2TreeNode = Ot, t.b2DynamicTree = Lt, t.b2_toi_reset = function() {
- t.b2_toiTime = 0, t.b2_toiMaxTime = 0, t.b2_toiCalls = 0, t.b2_toiIters = 0, t.b2_toiMaxIters = 0, t.b2_toiRootIters = 0, t.b2_toiMaxRootIters = 0
- }, t.b2TOIInput = Xt, t.b2TOIOutput = Yt, t.b2SeparationFunction = qt, t.b2TimeOfImpact = re, t.b2CollideCircles = ae, t.b2CollidePolygonAndCircle = ue, t.b2CollidePolygons = Le, t.b2CollideEdgeAndCircle = We, t.b2CollideEdgeAndPolygon = Je, t.b2MassData = Ze, t.b2Shape = Ke, t.b2CircleShape = ti, t.b2PolygonShape = ei, t.b2EdgeShape = ii, t.b2ChainShape = ni, t.b2Filter = ri, t.b2FixtureDef = si, t.b2FixtureProxy = oi, t.b2Fixture = ai, t.b2BodyDef = li, t.b2Body = hi, t.b2World = Gn, t.b2DestructionListener = Ki, t.b2ContactFilter = Qi, t.b2ContactImpulse = $i, t.b2ContactListener = tn, t.b2QueryCallback = en, t.b2RayCastCallback = nn, t.b2Island = mn, t.b2Profile = sn, t.b2TimeStep = on, t.b2Position = an, t.b2Velocity = ln, t.b2SolverData = hn, t.b2ContactManager = rn, t.b2MixFriction = Vi, t.b2MixRestitution = ki, t.b2ContactEdge = Gi, t.b2Contact = Ui, t.b2ContactRegister = Ji, t.b2ContactFactory = Zi, t.g_blockSolve = !1, t.b2VelocityConstraintPoint = cn, t.b2ContactVelocityConstraint = un, t.b2ContactPositionConstraint = _n, t.b2ContactSolverDef = fn, t.b2PositionSolverManifold = dn, t.b2ContactSolver = pn, t.b2CircleContact = zi, t.b2PolygonContact = ji, t.b2PolygonAndCircleContact = Wi, t.b2EdgeAndCircleContact = Hi, t.b2EdgeAndPolygonContact = Xi, t.b2ChainAndCircleContact = Yi, t.b2ChainAndPolygonContact = qi, t.b2Jacobian = ci, t.b2JointEdge = ui, t.b2JointDef = _i, t.b2Joint = fi, t.b2AreaJointDef = mi, t.b2AreaJoint = yi, t.b2DistanceJointDef = di, t.b2DistanceJoint = pi, t.b2FrictionJointDef = vi, t.b2FrictionJoint = gi, t.b2GearJointDef = xi, t.b2GearJoint = bi, t.b2MotorJointDef = Ai, t.b2MotorJoint = Ci, t.b2MouseJointDef = Ti, t.b2MouseJoint = Si, t.b2PrismaticJointDef = wi, t.b2PrismaticJoint = Ei, t.b2_minPulleyLength = 2, t.b2PulleyJointDef = Mi, t.b2PulleyJoint = Di, t.b2RevoluteJointDef = Bi, t.b2RevoluteJoint = Ii, t.b2RopeJointDef = Pi, t.b2RopeJoint = Ri, t.b2WeldJointDef = Oi, t.b2WeldJoint = Li, t.b2WheelJointDef = Fi, t.b2WheelJoint = Ni, t.b2ControllerEdge = Un, t.b2Controller = zn, t.b2BuoyancyController = jn, t.b2ConstantAccelController = Wn, t.b2ConstantForceController = Hn, t.b2GravityController = Xn, t.b2TensorDampingController = Yn, t.b2ParticleDef = yn, t.b2CalculateParticleIterations = vn, t.b2ParticleHandle = gn, t.b2ParticleGroupDef = xn, t.b2ParticleGroup = bn, t.b2GrowableBuffer = Rn, t.b2FixtureParticleQueryCallback = On, t.b2ParticleContact = Ln, t.b2ParticleBodyContact = Fn, t.b2ParticlePair = Nn, t.b2ParticleTriad = Vn, t.b2ParticleSystemDef = kn, t.b2RopeDef = qn, t.b2Rope = Jn, Object.defineProperty(t, "__esModule", {
- value: !0
- })
- }))
- }), {}],
- 422: [(function(t, e, i) {
- "use strict";
- var n = "undefined" == typeof window ? global : window;
- n.cc = n.cc || {}, n._cc = n._cc || {}, t("./predefine"), t("./polyfill/string"), t("./polyfill/misc"), t("./polyfill/array"), t("./polyfill/object"), t("./polyfill/array-buffer"), t("./polyfill/number"), t("./polyfill/typescript"), t("./cocos2d/core/predefine"), t("./cocos2d"), t("./extends"), e.exports = n.cc
- }), {
- "./cocos2d": 338,
- "./cocos2d/core/predefine": 223,
- "./extends": 399,
- "./package": void 0,
- "./polyfill/array": 424,
- "./polyfill/array-buffer": 423,
- "./polyfill/misc": 425,
- "./polyfill/number": 426,
- "./polyfill/object": 427,
- "./polyfill/string": 428,
- "./polyfill/typescript": 429,
- "./predefine": 430
- }],
- 423: [(function(t, e, i) {
- "use strict";
- if (!ArrayBuffer.isView) {
- var n = Object.getPrototypeOf(Int8Array);
- ArrayBuffer.isView = "function" == typeof n ? function(t) {
- return t instanceof n
- } : function(t) {
- if ("object" != typeof t) return !1;
- var e = t.constructor;
- return e === Float32Array || e === Uint8Array || e === Uint32Array || e === Int8Array
- }
- }
- }), {}],
- 424: [(function(t, e, i) {
- "use strict";
- Array.isArray || (Array.isArray = function(t) {
- return "[object Array]" === Object.prototype.toString.call(t)
- }), Array.prototype.find || (Array.prototype.find = function(t) {
- for (var e = this.length, i = 0; i < e; i++) {
- var n = this[i];
- if (t.call(this, n, i, this)) return n
- }
- }), Array.prototype.includes || (Array.prototype.includes = function(t) {
- return -1 !== this.indexOf(t)
- })
- }), {}],
- 425: [(function(t, e, i) {
- "use strict";
- if (Math.sign || (Math.sign = function(t) {
- return 0 === (t = +t) || isNaN(t) ? t : t > 0 ? 1 : -1
- }), Math.log2 || (Math.log2 = function(t) {
- return Math.log(t) * Math.LOG2E
- }), Number.isInteger || (Number.isInteger = function(t) {
- return "number" == typeof t && isFinite(t) && Math.floor(t) === t
- }), !console.time) {
- var n = window.performance || Date,
- r = Object.create(null);
- console.time = function(t) {
- r[t] = n.now()
- }, console.timeEnd = function(t) {
- var e = r[t],
- i = n.now() - e;
- console.log(t + ": " + i + "ms")
- }
- }
- }), {}],
- 426: [(function(t, e, i) {
- "use strict";
- Number.parseFloat = Number.parseFloat || parseFloat, Number.parseInt = Number.parseInt || parseInt
- }), {}],
- 427: [(function(t, e, i) {
- "use strict";
- Object.assign || (Object.assign = function(t, e) {
- return cc.js.mixin(t, e)
- }), Object.getOwnPropertyDescriptors || (Object.getOwnPropertyDescriptors = function(t) {
- var e = {},
- i = Object.getOwnPropertyNames(t);
- Object.getOwnPropertySymbols && (i = i.concat(Object.getOwnPropertySymbols(t)));
- for (var n = 0; n < i.length; ++n) {
- var r = i[n];
- e[r] = Object.getOwnPropertyDescriptor(t, r)
- }
- return e
- })
- }), {}],
- 428: [(function(t, e, i) {
- "use strict";
- String.prototype.startsWith || (String.prototype.startsWith = function(t, e) {
- return e = e || 0, this.lastIndexOf(t, e) === e
- }), String.prototype.endsWith || (String.prototype.endsWith = function(t, e) {
- (void 0 === e || e > this.length) && (e = this.length), e -= t.length;
- var i = this.indexOf(t, e);
- return -1 !== i && i === e
- }), String.prototype.trimLeft || (String.prototype.trimLeft = function() {
- return this.replace(/^\s+/, "")
- })
- }), {}],
- 429: [(function(t, e, i) {
- "use strict";
- var n = Object.setPrototypeOf || {
- __proto__: []
- }
- instanceof Array && function(t, e) {
- t.__proto__ = e
- } || function(t, e) {
- for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
- };
- window.__extends = function(t, e) {
- function i() {
- this.constructor = t
- }
- n(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i)
- }, window.__assign = Object.assign || function(t) {
- for (var e, i = 1, n = arguments.length; i < n; i++)
- for (var r in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
- return t
- }, window.__rest = function(t, e) {
- var i = {};
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
- if (null != t && "function" == typeof Object.getOwnPropertySymbols) {
- var r = 0;
- for (n = Object.getOwnPropertySymbols(t); r < n.length; r++) e.indexOf(n[r]) < 0 && (i[n[r]] = t[n[r]])
- }
- return i
- }, window.__decorate = function(t, e, i, n) {
- var r, s = arguments.length,
- o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n);
- else
- for (var a = t.length - 1; a >= 0; a--)(r = t[a]) && (o = (s < 3 ? r(o) : s > 3 ? r(e, i, o) : r(e, i)) || o);
- return s > 3 && o && Object.defineProperty(e, i, o), o
- }, window.__param = function(t, e) {
- return function(i, n) {
- e(i, n, t)
- }
- }, window.__metadata = function(t, e) {
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(t, e)
- }, window.__awaiter = function(t, e, i, n) {
- return new(i || (i = Promise))(function(r, s) {
- function o(t) {
- try {
- l(n.next(t))
- } catch (t) {
- s(t)
- }
- }
- function a(t) {
- try {
- l(n.throw(t))
- } catch (t) {
- s(t)
- }
- }
- function l(t) {
- t.done ? r(t.value) : new i(function(e) {
- e(t.value)
- }).then(o, a)
- }
- l((n = n.apply(t, e || [])).next())
- })
- }, window.__generator = function(t, e) {
- var i, n, r, s, o = {
- label: 0,
- sent: function() {
- if (1 & r[0]) throw r[1];
- return r[1]
- },
- trys: [],
- ops: []
- };
- return s = {
- next: a(0),
- throw: a(1),
- return: a(2)
- }, "function" == typeof Symbol && (s[Symbol.iterator] = function() {
- return this
- }), s;
- function a(t) {
- return function(e) {
- return l([t, e])
- }
- }
- function l(s) {
- if (i) throw new TypeError("Generator is already executing.");
- for (; o;) try {
- if (i = 1, n && (r = 2 & s[0] ? n.return : s[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, s[1])).done) return r;
- switch (n = 0, r && (s = [2 & s[0], r.value]), s[0]) {
- case 0:
- case 1:
- r = s;
- break;
- case 4:
- return o.label++, {
- value: s[1],
- done: !1
- };
- case 5:
- o.label++, n = s[1], s = [0];
- continue;
- case 7:
- s = o.ops.pop(), o.trys.pop();
- continue;
- default:
- if (!(r = (r = o.trys).length > 0 && r[r.length - 1]) && (6 === s[0] || 2 === s[0])) {
- o = 0;
- continue
- }
- if (3 === s[0] && (!r || s[1] > r[0] && s[1] < r[3])) {
- o.label = s[1];
- break
- }
- if (6 === s[0] && o.label < r[1]) {
- o.label = r[1], r = s;
- break
- }
- if (r && o.label < r[2]) {
- o.label = r[2], o.ops.push(s);
- break
- }
- r[2] && o.ops.pop(), o.trys.pop();
- continue
- }
- s = e.call(t, o)
- } catch (t) {
- s = [6, t], n = 0
- } finally {
- i = r = 0
- }
- if (5 & s[0]) throw s[1];
- return {
- value: s[0] ? s[1] : void 0,
- done: !0
- }
- }
- }, window.__exportStar = function(t, e) {
- for (var i in t) e.hasOwnProperty(i) || (e[i] = t[i])
- }, window.__values = function(t) {
- var e = "function" == typeof Symbol && t[Symbol.iterator],
- i = 0;
- return e ? e.call(t) : {
- next: function() {
- return t && i >= t.length && (t = void 0), {
- value: t && t[i++],
- done: !t
- }
- }
- }
- }, window.__read = function(t, e) {
- var i = "function" == typeof Symbol && t[Symbol.iterator];
- if (!i) return t;
- var n, r, s = i.call(t),
- o = [];
- try {
- for (;
- (void 0 === e || e-- > 0) && !(n = s.next()).done;) o.push(n.value)
- } catch (t) {
- r = {
- error: t
- }
- } finally {
- try {
- n && !n.done && (i = s.return) && i.call(s)
- } finally {
- if (r) throw r.error
- }
- }
- return o
- }, window.__spread = function() {
- for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(__read(arguments[e]));
- return t
- }, window.__await = function(t) {
- return this instanceof __await ? (this.v = t, this) : new __await(t)
- }, window.__asyncGenerator = function(t, e, i) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var n, r = i.apply(t, e || []),
- s = [];
- return n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
- return this
- }, n;
- function o(t) {
- r[t] && (n[t] = function(e) {
- return new Promise(function(i, n) {
- s.push([t, e, i, n]) > 1 || a(t, e)
- })
- })
- }
- function a(t, e) {
- try {
- l(r[t](e))
- } catch (t) {
- u(s[0][3], t)
- }
- }
- function l(t) {
- t.value instanceof __await ? Promise.resolve(t.value.v).then(h, c) : u(s[0][2], t)
- }
- function h(t) {
- a("next", t)
- }
- function c(t) {
- a("throw", t)
- }
- function u(t, e) {
- t(e), s.shift(), s.length && a(s[0][0], s[0][1])
- }
- }, window.__asyncDelegator = function(t) {
- var e, i;
- return e = {}, n("next"), n("throw", (function(t) {
- throw t
- })), n("return"), e[Symbol.iterator] = function() {
- return this
- }, e;
- function n(n, r) {
- e[n] = t[n] ? function(e) {
- return (i = !i) ? {
- value: __await(t[n](e)),
- done: "return" === n
- } : r ? r(e) : e
- } : r
- }
- }, window.__asyncValues = function(t) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var e, i = t[Symbol.asyncIterator];
- return i ? i.call(t) : (t = "function" == typeof __values ? __values(t) : t[Symbol.iterator](), e = {}, n("next"), n("throw"), n("return"), e[Symbol.asyncIterator] = function() {
- return this
- }, e);
- function n(i) {
- e[i] = t[i] && function(e) {
- return new Promise(function(n, s) {
- r(n, s, (e = t[i](e)).done, e.value)
- })
- }
- }
- function r(t, e, i, n) {
- Promise.resolve(n).then((function(e) {
- t({
- value: e,
- done: i
- })
- }), e)
- }
- }, window.__makeTemplateObject = function(t, e) {
- return Object.defineProperty ? Object.defineProperty(t, "raw", {
- value: e
- }) : t.raw = e, t
- }, window.__importStar = function(t) {
- if (t && t.__esModule) return t;
- var e = {};
- if (null != t)
- for (var i in t) Object.hasOwnProperty.call(t, i) && (e[i] = t[i]);
- return e.default = t, e
- }, window.__importDefault = function(t) {
- return t && t.__esModule ? t : {
- default: t
- }
- }
- }), {}],
- 430: [(function(t, e, i) {
- "use strict";
- var n = "undefined" == typeof window ? global : window;
- function r(t, e) {
- void 0 === n[t] && (n[t] = e)
- }
- function s(t, e) {
- void 0 === n[t] && Object.defineProperty(n, t, {
- get: function() {
- var i = void 0;
- return "CC_WECHATGAMESUB" === t ? i = "cc.sys.platform === cc.sys.WECHAT_GAME_SUB" : "CC_WECHATGAME" === t ? i = "cc.sys.platform === cc.sys.WECHAT_GAME" : "CC_QQPLAY" === t && (i = "cc.sys.platform === cc.sys.QQ_PLAY"), cc.warnID(1400, t, i), e
- }
- })
- }
- function o(t) {
- return "object" == typeof n[t]
- }
- r("CC_BUILD", !1), n.CC_BUILD = !0, n.CC_DEV = !1, n.CC_DEBUG = !1, n.CC_JSB = !1, n.CC_NATIVERENDERER = !1, n.CC_SUPPORT_JIT = !0, r("CC_TEST", o("tap") || o("QUnit")), r("CC_EDITOR", o("Editor") && o("process") && "electron" in process.versions), r("CC_PREVIEW", !0), r("CC_RUNTIME", "function" == typeof loadRuntime), r("CC_JSB", o("jsb") && !0);
- var a = !(!o("wx") || !wx.getSharedCanvas),
- l = !(!o("wx") || !wx.getSystemInfoSync && !wx.getSharedCanvas),
- h = o("bk");
- s("CC_WECHATGAMESUB", a), s("CC_WECHATGAME", l), s("CC_QQPLAY", h);
- n.CocosEngine = cc.ENGINE_VERSION = "2.2.2"
- }), {}]
- }, {}, [422]);
|